-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CB-INTERNAL] upgrade storage adapters and parse legacy ones #1266
[CB-INTERNAL] upgrade storage adapters and parse legacy ones #1266
Conversation
src/registry/domain/repository.ts
Outdated
const cdn: Cdn = !conf.local && conf.storage.adapter(conf.storage.options); | ||
const cdn: StorageAdapter = | ||
!conf.local && | ||
(parseAdapter(conf.storage.adapter(conf.storage.options)) as any); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does parseAdapter
do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic is on the new file src/registry/domain/storage-adapter.ts
but what it does is check is and parse your adapter to see if it works with promises. If it does, it will just return it, if it doesnt it will universalify all its methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the function be called getPromiseBasedAdapter
both here and in storage-adapter.ts
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}; | ||
|
||
const officialAdapters = { | ||
s3: { name: 'oc-s3-storage-adapter', version: '1.2.0' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename this version
to firstPromiseBasedVersion
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This upgrades to use the new storage adapters that return promises (see PR). Because users may still be using old versions of the adapters, or maybe even custom adapters that still work with callbacks, we will emit a deprecation warning and then universalify it.