-
Notifications
You must be signed in to change notification settings - Fork 31
feat: adding shopify oxygen server sdk #991
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
Conversation
This commit level has a barebones working version of the Oxygen SDK
This is to ensure that we only have 1 poll instance per request
|
@launchdarkly/browser size report |
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
this commit will add in the initial set of oxygen sdk unit test
addressing lint issues introduced by unit tests
| import type { Info, PlatformData, SdkData } from '@launchdarkly/js-server-sdk-common'; | ||
|
|
||
| // TODO: maybe not the right name for this package? Currently copied from Akamai... I think | ||
| const name = '@launchdarkly/shopify-oxygen-server-sdk'; |
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.
It reasonably matches our naming convention for these. It runs on "shopify-oxygen" and is a "server-sdk".
|
|
||
| export default class OxygenRequests implements platform.Requests { | ||
| // @ts-ignore - Cache API is available in Shopify Oxygen runtime | ||
| private _cache: Cache | null = null; |
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.
Could we have like a globals.d.ts or something that would make ts aware of the shape of these?
Additionally changed the way we pull in crypto-js so it would work with module syntax
this commit will also do a minor refactor on to reference `crypto-js` from global scope which is less confusing to compilers.
|
|
||
| export type OxygenLDOptions = Pick<LDOptionsCommon, 'logger'> & { | ||
| cache?: OxygenCacheOptions; | ||
| }; |
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.
Bug: OxygenLDOptions Restricts Client Configuration
OxygenLDOptions only picks logger from LDOptionsCommon, preventing users from passing other valid options like sendEvents or diagnosticOptOut. The type should extend LDOptionsCommon (similar to how Cloudflare SDK defines its options) rather than only picking logger, since createOptions expects LDOptions & OxygenLDOptions and passes all options to the client.
Requirements
Related issues
Provide links to any issues in this repository or elsewhere relating to this pull request.
Describe the solution you've provided
Provide a clear and concise description of what you expect to happen.
Describe alternatives you've considered
Provide a clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context about the pull request here.
Note
Adds a new Shopify Oxygen server SDK package with Oxygen-specific platform, cache-backed polling, crypto utilities, initialization helpers, and tests.
packages/sdk/shopify-oxygenadded to workspaces.OxygenRequests: GET request caching via Oxygen Cache API withCache-Controlheaders; usesNullEventSource.OxygenCrypto: SHA1/SHA256 hash/HMAC viacrypto-js;randomUUIDpassthrough.OxygenInfoand platform wiring inplatform/index.ts.src/polyfills/timers.ts).init(sdkKey, options)usingLDClientImplwith callbacks stub; exportsOxygenLDOptions.pollInterval=300, diagnostics opt-out, logger, and configurable cache (ttlSeconds,name,enabled).validateOptions), option merging (createOptions).caches,fetch, timers; JSON flag/segment fixtures.package.json,jest.config.cjs,tsconfig*,tsup.config.ts.README.mdwith usage/options andCHANGELOG.md.Written by Cursor Bugbot for commit d1377ba. This will update automatically on new commits. Configure here.