Skip to content
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

Merged
merged 5 commits into from
Oct 28, 2021

Conversation

ricardo-devis-agullo
Copy link
Collaborator

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.

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does parseAdapter do?

Copy link
Collaborator Author

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

Copy link
Collaborator

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?

Copy link
Collaborator Author

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' },
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ricardo-devis-agullo ricardo-devis-agullo merged commit a134c55 into callback-to-promises Oct 28, 2021
@ricardo-devis-agullo ricardo-devis-agullo deleted the upgrade-storage-adapters branch October 28, 2021 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants