Skip to content

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Nov 10, 2025

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

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.

  • New package: packages/sdk/shopify-oxygen added to workspaces.
    • Platform:
      • OxygenRequests: GET request caching via Oxygen Cache API with Cache-Control headers; uses NullEventSource.
      • OxygenCrypto: SHA1/SHA256 hash/HMAC via crypto-js; randomUUID passthrough.
      • OxygenInfo and platform wiring in platform/index.ts.
      • Timer polyfills for Oxygen runtime (src/polyfills/timers.ts).
    • SDK entry & options:
      • init(sdkKey, options) using LDClientImpl with callbacks stub; exports OxygenLDOptions.
      • Defaults: streaming disabled, pollInterval=300, diagnostics opt-out, logger, and configurable cache (ttlSeconds, name, enabled).
      • Option validation (validateOptions), option merging (createOptions).
    • Tests:
      • Jest setup with mocked caches, fetch, timers; JSON flag/segment fixtures.
      • Coverage for initialization, flag evaluation (rules/rollouts/segments), and caching behavior.
    • Tooling & docs:
      • package.json, jest.config.cjs, tsconfig*, tsup.config.ts.
      • README.md with usage/options and CHANGELOG.md.

Written by Cursor Bugbot for commit d1377ba. This will update automatically on new commits. Configure here.

@joker23 joker23 changed the title Szhang/sdk 1557/shopify oxygen sdk feat: adding shopify oxygen server sdk Nov 10, 2025
@github-actions
Copy link
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 169118 bytes
Compressed size limit: 200000
Uncompressed size: 789399 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 24988 bytes
Compressed size limit: 26000
Uncompressed size: 122411 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 17636 bytes
Compressed size limit: 20000
Uncompressed size: 90259 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 21721 bytes
Compressed size limit: 25000
Uncompressed size: 74698 bytes

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';
Copy link
Member

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;
Copy link
Member

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
@joker23 joker23 requested a review from kinyoklion November 12, 2025 15:17
this commit will also do a minor refactor on to reference `crypto-js` from global scope which is less confusing to compilers.
@joker23 joker23 marked this pull request as ready for review November 12, 2025 19:56
@joker23 joker23 requested a review from a team as a code owner November 12, 2025 19:56

export type OxygenLDOptions = Pick<LDOptionsCommon, 'logger'> & {
cache?: OxygenCacheOptions;
};
Copy link

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.

Fix in Cursor Fix in Web

@joker23 joker23 merged commit e70e484 into main Nov 12, 2025
33 checks passed
@joker23 joker23 deleted the szhang/sdk-1557/shopify-oxygen-sdk branch November 12, 2025 20:11
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