@shipeasy/sdk 2.5.1 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.d.mts +8 -4
- package/dist/server/index.d.ts +8 -4
- package/dist/server/index.js +16 -8
- package/dist/server/index.mjs +16 -8
- package/package.json +1 -1
package/dist/server/index.d.mts
CHANGED
|
@@ -132,14 +132,18 @@ declare function getShipeasyServerClient(): FlagsClient | null;
|
|
|
132
132
|
declare function _resetShipeasyServerForTests(): void;
|
|
133
133
|
interface ShipeasyServerConfig {
|
|
134
134
|
/**
|
|
135
|
-
* Server-side API key — authenticates flag/experiment fetches from the edge
|
|
136
|
-
* Never embedded in browser output.
|
|
135
|
+
* Server-side API key — authenticates flag/experiment fetches from the edge
|
|
136
|
+
* (requireKey("server")). Never embedded in browser output. If omitted, flag
|
|
137
|
+
* and experiment evaluation is skipped and an error is logged — it is NOT
|
|
138
|
+
* substituted with clientKey (a client key 401s against /sdk/flags).
|
|
137
139
|
*/
|
|
138
140
|
apiKey?: string;
|
|
139
141
|
/**
|
|
140
142
|
* Public client key — embedded in window.__SE_BOOTSTRAP and used by the
|
|
141
|
-
* browser SDK
|
|
142
|
-
*
|
|
143
|
+
* browser SDK, and authenticates i18n string fetches (requireKey("client")).
|
|
144
|
+
* Safe to expose (e.g. NEXT_PUBLIC_ env vars). If omitted, i18n loading is
|
|
145
|
+
* skipped and an error is logged — it is NOT substituted with apiKey (a
|
|
146
|
+
* server key 401s against /sdk/i18n/strings).
|
|
143
147
|
*/
|
|
144
148
|
clientKey?: string;
|
|
145
149
|
/** Raw URL or query string for applying ?se_ks_* / ?se_cf_* / ?se_exp_* overrides. */
|
package/dist/server/index.d.ts
CHANGED
|
@@ -132,14 +132,18 @@ declare function getShipeasyServerClient(): FlagsClient | null;
|
|
|
132
132
|
declare function _resetShipeasyServerForTests(): void;
|
|
133
133
|
interface ShipeasyServerConfig {
|
|
134
134
|
/**
|
|
135
|
-
* Server-side API key — authenticates flag/experiment fetches from the edge
|
|
136
|
-
* Never embedded in browser output.
|
|
135
|
+
* Server-side API key — authenticates flag/experiment fetches from the edge
|
|
136
|
+
* (requireKey("server")). Never embedded in browser output. If omitted, flag
|
|
137
|
+
* and experiment evaluation is skipped and an error is logged — it is NOT
|
|
138
|
+
* substituted with clientKey (a client key 401s against /sdk/flags).
|
|
137
139
|
*/
|
|
138
140
|
apiKey?: string;
|
|
139
141
|
/**
|
|
140
142
|
* Public client key — embedded in window.__SE_BOOTSTRAP and used by the
|
|
141
|
-
* browser SDK
|
|
142
|
-
*
|
|
143
|
+
* browser SDK, and authenticates i18n string fetches (requireKey("client")).
|
|
144
|
+
* Safe to expose (e.g. NEXT_PUBLIC_ env vars). If omitted, i18n loading is
|
|
145
|
+
* skipped and an error is logged — it is NOT substituted with apiKey (a
|
|
146
|
+
* server key 401s against /sdk/i18n/strings).
|
|
143
147
|
*/
|
|
144
148
|
clientKey?: string;
|
|
145
149
|
/** Raw URL or query string for applying ?se_ks_* / ?se_cf_* / ?se_exp_* overrides. */
|
package/dist/server/index.js
CHANGED
|
@@ -500,14 +500,19 @@ function _resetShipeasyServerForTests() {
|
|
|
500
500
|
_server = null;
|
|
501
501
|
}
|
|
502
502
|
async function shipeasy(opts) {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
} else if (!opts.apiKey) {
|
|
506
|
-
console.warn("[shipeasy] apiKey not set \u2014 falling back to clientKey for server requests.");
|
|
507
|
-
}
|
|
508
|
-
const apiKey = opts.apiKey ?? opts.clientKey ?? "";
|
|
509
|
-
const clientKey = opts.clientKey ?? _rememberedClientKey ?? opts.apiKey ?? "";
|
|
503
|
+
const apiKey = opts.apiKey ?? "";
|
|
504
|
+
const clientKey = opts.clientKey ?? _rememberedClientKey ?? "";
|
|
510
505
|
if (opts.clientKey && !_rememberedClientKey) _rememberedClientKey = opts.clientKey;
|
|
506
|
+
if (!apiKey) {
|
|
507
|
+
console.error(
|
|
508
|
+
"[shipeasy] No server key \u2014 flags & experiments skipped. Pass `apiKey` to shipeasy() with your server key (SHIPEASY_SERVER_KEY). Set it as a Worker secret with `wrangler secret put SHIPEASY_SERVER_KEY` (or add it to .env for local dev). Do not pass a client key here \u2014 /sdk/flags requires a server key and will 401."
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
if (!clientKey) {
|
|
512
|
+
console.error(
|
|
513
|
+
"[shipeasy] No client key \u2014 i18n strings skipped, falling back to hardcoded text. Pass `clientKey` to shipeasy() with your public client key (NEXT_PUBLIC_SHIPEASY_CLIENT_KEY). Do not pass a server key here \u2014 /sdk/i18n/strings requires a client key and will 401."
|
|
514
|
+
);
|
|
515
|
+
}
|
|
511
516
|
const profile = opts.i18nDefaultProfile ?? "en:prod";
|
|
512
517
|
flags.configure({ apiKey });
|
|
513
518
|
let resolvedUrlOverrides = opts.urlOverrides;
|
|
@@ -529,7 +534,10 @@ async function shipeasy(opts) {
|
|
|
529
534
|
}
|
|
530
535
|
const editLabels = resolvedUrlOverrides ? new URLSearchParams(resolvedUrlOverrides).has("se_edit_labels") : false;
|
|
531
536
|
globalThis[_EDIT_MODE_SSR_SYM] = editLabels;
|
|
532
|
-
await Promise.allSettled([
|
|
537
|
+
await Promise.allSettled([
|
|
538
|
+
apiKey ? flags.initOnce() : Promise.resolve(),
|
|
539
|
+
clientKey ? i18n.init(clientKey, profile) : Promise.resolve()
|
|
540
|
+
]);
|
|
533
541
|
const bootstrap = flags.evaluate(opts.user ?? {}, resolvedUrlOverrides);
|
|
534
542
|
const i18nData = i18n.getForRequest();
|
|
535
543
|
return {
|
package/dist/server/index.mjs
CHANGED
|
@@ -457,14 +457,19 @@ function _resetShipeasyServerForTests() {
|
|
|
457
457
|
_server = null;
|
|
458
458
|
}
|
|
459
459
|
async function shipeasy(opts) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
} else if (!opts.apiKey) {
|
|
463
|
-
console.warn("[shipeasy] apiKey not set \u2014 falling back to clientKey for server requests.");
|
|
464
|
-
}
|
|
465
|
-
const apiKey = opts.apiKey ?? opts.clientKey ?? "";
|
|
466
|
-
const clientKey = opts.clientKey ?? _rememberedClientKey ?? opts.apiKey ?? "";
|
|
460
|
+
const apiKey = opts.apiKey ?? "";
|
|
461
|
+
const clientKey = opts.clientKey ?? _rememberedClientKey ?? "";
|
|
467
462
|
if (opts.clientKey && !_rememberedClientKey) _rememberedClientKey = opts.clientKey;
|
|
463
|
+
if (!apiKey) {
|
|
464
|
+
console.error(
|
|
465
|
+
"[shipeasy] No server key \u2014 flags & experiments skipped. Pass `apiKey` to shipeasy() with your server key (SHIPEASY_SERVER_KEY). Set it as a Worker secret with `wrangler secret put SHIPEASY_SERVER_KEY` (or add it to .env for local dev). Do not pass a client key here \u2014 /sdk/flags requires a server key and will 401."
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
if (!clientKey) {
|
|
469
|
+
console.error(
|
|
470
|
+
"[shipeasy] No client key \u2014 i18n strings skipped, falling back to hardcoded text. Pass `clientKey` to shipeasy() with your public client key (NEXT_PUBLIC_SHIPEASY_CLIENT_KEY). Do not pass a server key here \u2014 /sdk/i18n/strings requires a client key and will 401."
|
|
471
|
+
);
|
|
472
|
+
}
|
|
468
473
|
const profile = opts.i18nDefaultProfile ?? "en:prod";
|
|
469
474
|
flags.configure({ apiKey });
|
|
470
475
|
let resolvedUrlOverrides = opts.urlOverrides;
|
|
@@ -486,7 +491,10 @@ async function shipeasy(opts) {
|
|
|
486
491
|
}
|
|
487
492
|
const editLabels = resolvedUrlOverrides ? new URLSearchParams(resolvedUrlOverrides).has("se_edit_labels") : false;
|
|
488
493
|
globalThis[_EDIT_MODE_SSR_SYM] = editLabels;
|
|
489
|
-
await Promise.allSettled([
|
|
494
|
+
await Promise.allSettled([
|
|
495
|
+
apiKey ? flags.initOnce() : Promise.resolve(),
|
|
496
|
+
clientKey ? i18n.init(clientKey, profile) : Promise.resolve()
|
|
497
|
+
]);
|
|
490
498
|
const bootstrap = flags.evaluate(opts.user ?? {}, resolvedUrlOverrides);
|
|
491
499
|
const i18nData = i18n.getForRequest();
|
|
492
500
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipeasy/sdk",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "Shipeasy SDK — feature gates, runtime configs, experiments, and metrics for the Shipeasy hosted service.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://shipeasy.ai",
|