@shipeasy/sdk 6.2.0 → 7.0.0

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: shipeasy-typescript
3
- description: Use Shipeasy (feature flags, configs, kill switches, A/B experiments, i18n) from TypeScript / JavaScript. Covers configure() + Client(user), getFlag/getConfig/getKillswitch/getExperiment, track, testing, OpenFeature, and the see() error reporter — server (@shipeasy/sdk/server) and browser (@shipeasy/sdk/client).
3
+ description: Use Shipeasy (feature flags, configs, kill switches, A/B experiments, i18n) from TypeScript / JavaScript. Covers configure() + Client(user), getFlag/getConfig/getKillswitch/universe().assign(), track, testing, OpenFeature, and the see() error reporter — server (@shipeasy/sdk/server) and browser (@shipeasy/sdk/client).
4
4
  ---
5
5
 
6
6
  # Shipeasy TypeScript SDK
@@ -12,7 +12,7 @@ public **client** key). Everything works from vanilla JS.
12
12
  > The documented surface is exactly **`configure()`** (setup) and the bound
13
13
  > **`new Client(user)`** (use), plus the package-level helpers below. For deeper
14
14
  > docs, fetch any page/snippet from the manifest at
15
- > <https://shipeasy-ai.github.io/sdk/manifest.json> (raw page/snippet URLs below).
15
+ > <https://shipeasy-ai.github.io/sdk-ts/manifest.json> (raw page/snippet URLs below).
16
16
 
17
17
  ## Install
18
18
 
@@ -42,28 +42,32 @@ flags.getFlagDetail("new_checkout"); // { value, reason }
42
42
  `configure()` is first-config-wins and owns the fetch lifecycle (one-shot by
43
43
  default; `poll: true` for a background refresh). Construct `new Client(user)` once
44
44
  per user/request — it binds the user, so no method takes a user argument.
45
- Full reference: <https://shipeasy-ai.github.io/sdk/pages/configuration.md> ·
46
- <https://shipeasy-ai.github.io/sdk/pages/flags.md> ·
47
- snippets <https://shipeasy-ai.github.io/sdk/snippets/release/flags.md> ·
48
- <https://shipeasy-ai.github.io/sdk/snippets/release/configs.md> ·
49
- <https://shipeasy-ai.github.io/sdk/snippets/release/killswitches.md>
45
+ Full reference: <https://shipeasy-ai.github.io/sdk-ts/pages/configuration.md> ·
46
+ <https://shipeasy-ai.github.io/sdk-ts/pages/flags.md> ·
47
+ snippets <https://shipeasy-ai.github.io/sdk-ts/snippets/release/flags.md> ·
48
+ <https://shipeasy-ai.github.io/sdk-ts/snippets/release/configs.md> ·
49
+ <https://shipeasy-ai.github.io/sdk-ts/snippets/release/killswitches.md>
50
50
 
51
51
  ## Experiments + track (Client-only, end to end)
52
52
 
53
53
  ```ts
54
54
  const flags = new Client(currentUser); // construct once per callsite
55
- const { inExperiment, group, params } = flags.getExperiment("hero_cta", {
56
- primary_label: "Sign up", // default params (control / not-enrolled)
57
- });
58
- render(params.primary_label);
59
55
 
60
- flags.logExposure("hero_cta"); // record the exposure where you present it
56
+ // Read experiments by UNIVERSE (a mutual-exclusion pool — the unit lands in ≤1
57
+ // experiment). assign() auto-logs one deduped exposure when enrolled.
58
+ const exp = flags.universe("hero_cta").assign();
59
+ render(exp.get("primary_label", "Sign up")); // variant ?? universe default ?? fallback
60
+
61
+ if (exp.enrolled) {
62
+ // exp.group is the variant, exp.name is the experiment
63
+ }
61
64
  flags.track("purchase", { value: 42 }); // record a conversion for the bound user
62
65
  ```
63
66
 
64
- `ExperimentResult = { inExperiment: boolean; group: string; params: P }`. Full
65
- reference: <https://shipeasy-ai.github.io/sdk/pages/experiments.md> · track snippet
66
- <https://shipeasy-ai.github.io/sdk/snippets/metrics/track.md>
67
+ `Assignment = { name: string | null; group: string | null; enrolled: boolean;
68
+ get(field, fallback) }`. Full reference:
69
+ <https://shipeasy-ai.github.io/sdk-ts/pages/experiments.md> · track snippet
70
+ <https://shipeasy-ai.github.io/sdk-ts/snippets/metrics/track.md>
67
71
 
68
72
  ## i18n
69
73
 
@@ -76,9 +80,9 @@ i18n.t("checkout.cta", "Place order");
76
80
  i18n.t("cart.count", "{count} items", { count: cart.length });
77
81
  ```
78
82
 
79
- Full reference: <https://shipeasy-ai.github.io/sdk/pages/i18n.md> · snippets
80
- <https://shipeasy-ai.github.io/sdk/snippets/i18n/setup.md> ·
81
- <https://shipeasy-ai.github.io/sdk/snippets/i18n/render.md>
83
+ Full reference: <https://shipeasy-ai.github.io/sdk-ts/pages/i18n.md> · snippets
84
+ <https://shipeasy-ai.github.io/sdk-ts/snippets/i18n/setup.md> ·
85
+ <https://shipeasy-ai.github.io/sdk-ts/snippets/i18n/render.md>
82
86
 
83
87
  ## Error reporting (see)
84
88
 
@@ -94,8 +98,8 @@ see.ControlFlowException(e).because("because it wasn't an encoded Foo"); // expe
94
98
 
95
99
  Fire-and-forget on the next microtask (no `.send()`). Don't catch what you can't
96
100
  name a consequence for. You may `see()` then re-throw (links as `caused_by`). Full
97
- reference: <https://shipeasy-ai.github.io/sdk/pages/error-reporting.md> · snippet
98
- <https://shipeasy-ai.github.io/sdk/snippets/ops/see.md>
101
+ reference: <https://shipeasy-ai.github.io/sdk-ts/pages/error-reporting.md> · snippet
102
+ <https://shipeasy-ai.github.io/sdk-ts/snippets/ops/see.md>
99
103
 
100
104
  ## Testing — no network
101
105
 
@@ -120,7 +124,7 @@ configureForOffline({ path: "./shipeasy-snapshot.json" });
120
124
  // or: configureForOffline({ snapshot: { flags, experiments }, flags: { new_checkout: true } });
121
125
  ```
122
126
 
123
- Full reference: <https://shipeasy-ai.github.io/sdk/pages/testing.md>
127
+ Full reference: <https://shipeasy-ai.github.io/sdk-ts/pages/testing.md>
124
128
 
125
129
  ## OpenFeature
126
130
 
@@ -133,13 +137,13 @@ await OpenFeature.setProviderAndWait(new ShipeasyProvider());
133
137
  await OpenFeature.getClient().getBooleanValue("new_checkout", false, { targetingKey: "u1" });
134
138
  ```
135
139
 
136
- Full reference: <https://shipeasy-ai.github.io/sdk/pages/openfeature.md>
140
+ Full reference: <https://shipeasy-ai.github.io/sdk-ts/pages/openfeature.md>
137
141
 
138
142
  ## Advanced
139
143
 
140
144
  `privateAttributes`, `bucketBy` (custom bucketing unit), `stickyBucketing`
141
- (browser: on by default, `__se_sticky` cookie), manual exposure
142
- (`getExperiment(..., { logExposure: false })` + `flags.logExposure(name)`),
145
+ (browser: on by default, `__se_sticky` cookie), exposure control (browser:
146
+ `universe(name).assign({ logExposure: false })` + `disableAutoExposure`),
143
147
  `onChange(cb)` (requires `configure({ poll: true })`) / browser `subscribe()`.
144
148
  Devtools overlay: `Shift+Alt+S` or `?se=1`. Full reference:
145
- <https://shipeasy-ai.github.io/sdk/pages/advanced.md>
149
+ <https://shipeasy-ai.github.io/sdk-ts/pages/advanced.md>
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@shipeasy/sdk",
3
- "version": "6.2.0",
3
+ "version": "7.0.0",
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",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/shipeasy-ai/sdk.git"
9
+ "url": "https://github.com/shipeasy-ai/sdk-ts.git"
10
10
  },
11
11
  "bugs": {
12
- "url": "https://github.com/shipeasy-ai/sdk/issues"
12
+ "url": "https://github.com/shipeasy-ai/sdk-ts/issues"
13
13
  },
14
14
  "main": "./dist/server/index.js",
15
15
  "module": "./dist/server/index.mjs",
16
16
  "browser": "./dist/client/index.js",
17
+ "react-native": "./dist/client/index.js",
17
18
  "typesVersions": {
18
19
  "*": {
19
20
  "client": [
@@ -29,6 +30,7 @@
29
30
  },
30
31
  "exports": {
31
32
  ".": {
33
+ "react-native": "./dist/client/index.js",
32
34
  "node": "./dist/server/index.js",
33
35
  "browser": "./dist/client/index.js",
34
36
  "default": "./dist/server/index.js"
@@ -105,11 +107,12 @@
105
107
  "@openfeature/server-sdk": "^1.22.0",
106
108
  "@openfeature/web-sdk": "^1.9.0",
107
109
  "@types/murmurhash-js": "^1.0.6",
108
- "@types/node": "^20.0.0",
110
+ "@types/node": "^26.0.1",
109
111
  "next": "^16.2.3",
110
112
  "tsup": "^8.3.0",
111
- "typescript": "^5.7.4",
112
- "vitest": "^2.1.0",
113
+ "typescript": "^6.0.3",
114
+ "vite": "^6.4.3",
115
+ "vitest": "^4.1.9",
113
116
  "wrangler": "^4.83.0"
114
117
  },
115
118
  "publishConfig": {