Skip to content

feat: cloudflare sdk base #74

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

Merged
merged 33 commits into from
Apr 13, 2023
Merged

Conversation

yusinto
Copy link
Contributor

@yusinto yusinto commented Apr 10, 2023

This is the base branch for the cloudflare sdk. Please review this PR first before the following child prs:

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #195479: Move cloudflare sdk to js-core.

@yusinto yusinto marked this pull request as draft April 10, 2023 21:07
@yusinto yusinto changed the title [sc-195479] Cloudflare sdk base feat: cloudflare sdk redesign Apr 11, 2023
@yusinto yusinto changed the title feat: cloudflare sdk redesign feat: cloudflare sdk base Apr 12, 2023
@yusinto yusinto marked this pull request as ready for review April 12, 2023 16:54
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm exporting this so the cloudflare unit tests can use async/await when testing feature store functionality. It's much better to use async/await for unit tests than promise thenables.

Copy link
Contributor

@InTheCloudDan InTheCloudDan left a comment

Choose a reason for hiding this comment

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

Only a couple of minor questions from me.


const defaults = {
stream: false,
sendEvents: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we keeping this for now because that's how it was in the original SDK? For that SDK it was set to false because it wasn't technically possible to polyfill the API we were using.

Copy link
Contributor Author

@yusinto yusinto Apr 12, 2023

Choose a reason for hiding this comment

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

I tried sendEvents: true In #76 and ran miniflare tests. The tests pass but jest exited disgracefully (no offence jest):

Jest did not exit one second after the test run has completed.

'This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

Is this needed for go live on Apr 28? I'm focusing on feature parity and there's still other chores outstanding like documentation, releasing and CI.

Copy link
Contributor

Choose a reason for hiding this comment

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

For parity no, and Tim C should probably be consulted before a default change to the behavior is implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. This will be a major release though so changing sendEvents to true shouldn't be an issue. It does make sense to sendEvents and it's extremely valuable.

I will attempt to include this for go-live only if other necessary tasks are done. If not we can always release a minor version to support this. I'm sure there are many other improvements in addition to this after go-live.

@@ -0,0 +1,33 @@
// TODO: Dry this file duplicated in this repo
Copy link
Contributor Author

@yusinto yusinto Apr 12, 2023

Choose a reason for hiding this comment

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

This duplication has been fixed in #75

Copy link
Member

Choose a reason for hiding this comment

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

If we are using this at runtime we may want to call it NullEventSource. Just because that is a convention we have used for Noop type components in other SDKs. NullEventProcessor for an example.

Not critical, just a thought, because mock often invokes testing thoughts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok done in #75 which deals with making it shareable.

yusinto added 2 commits April 12, 2023 10:07
….com:launchdarkly/js-core into yus/sc-195479/move-cloudflare-sdk-to-js-core
Copy link
Member

@kinyoklion kinyoklion left a comment

Choose a reason for hiding this comment

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

Few comments. Overall looking very good!

yusinto and others added 4 commits April 13, 2023 14:56
* chore: added ci config

* fix: typedoc error index.ts not included in tsconfig.
* chore: added miniflare dep and initial test file.

* fix: suppress node warnings and enable modules when running jest

* chore: added miniflare tests

* chore: turned on jest coverage flag

* chore: add prettierignore

---------

Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>
* chore: moved eventSource for sharing

* chore: renamed MockEventSource NullEventSource
@yusinto yusinto merged commit add0c63 into main Apr 13, 2023
@yusinto yusinto deleted the yus/sc-195479/move-cloudflare-sdk-to-js-core branch April 13, 2023 23:47
@github-actions github-actions bot mentioned this pull request Apr 13, 2023
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.

3 participants