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.

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

Choose a reason for hiding this comment

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

I assume the environment only supports async crypto?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I need to revisit this, I copied the implementation form the Akamai Edge sdk to get something working... but forgot to revisit. Will look into what is provided by https://shopify.dev/docs/storefronts/headless/hydrogen/deployments/oxygen-runtime#web-crypto-api

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah but yes, the environment only supports async crypto.

const result = this._cryptoJSHmac.finalize();

if (encoding === 'base64') {
return result.toString(CryptoJS.enc.Base64);
Copy link
Member

Choose a reason for hiding this comment

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

Is this import missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So cryptojs actually puts itself into global scope https://github.com/brix/crypto-js/blob/develop/src/core.js

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?

...options,
});

const cachedResponse = await cache.match(request);
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to be looking at a TTL on these?

Copy link
Member

Choose a reason for hiding this comment

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

Or it is just handled by the cache-control?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cache control handles these and will return null on expired extries.

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
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