@shipeasy/sdk 6.3.1 → 7.1.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.
- package/README.md +1 -4
- package/dist/client/index.d.mts +166 -27
- package/dist/client/index.d.ts +166 -27
- package/dist/client/index.js +268 -132
- package/dist/client/index.mjs +268 -132
- package/dist/openfeature-server/index.d.mts +144 -14
- package/dist/openfeature-server/index.d.ts +144 -14
- package/dist/openfeature-server/index.js +65 -33
- package/dist/openfeature-server/index.mjs +65 -33
- package/dist/openfeature-web/index.d.mts +110 -30
- package/dist/openfeature-web/index.d.ts +110 -30
- package/dist/server/index.d.mts +181 -28
- package/dist/server/index.d.ts +181 -28
- package/dist/server/index.js +337 -159
- package/dist/server/index.mjs +337 -159
- package/docs/skill/SKILL.md +20 -10
- package/package.json +3 -1
package/docs/skill/SKILL.md
CHANGED
|
@@ -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/
|
|
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
|
|
@@ -42,6 +42,12 @@ 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
|
+
|
|
46
|
+
Egress is **environment-derived**: network + usage telemetry default ON in
|
|
47
|
+
production and OFF otherwise (prod is read from `SHIPEASY_ENV`/`NODE_ENV`, else
|
|
48
|
+
the `env` option, default `"prod"`), so the SDK never phones home from dev/CI.
|
|
49
|
+
Override with `isNetworkEnabled: false` (fully offline) or `disableTelemetry: true`
|
|
50
|
+
(keep fetching, no usage beacons).
|
|
45
51
|
Full reference: <https://shipeasy-ai.github.io/sdk-ts/pages/configuration.md> ·
|
|
46
52
|
<https://shipeasy-ai.github.io/sdk-ts/pages/flags.md> ·
|
|
47
53
|
snippets <https://shipeasy-ai.github.io/sdk-ts/snippets/release/flags.md> ·
|
|
@@ -52,17 +58,21 @@ snippets <https://shipeasy-ai.github.io/sdk-ts/snippets/release/flags.md> ·
|
|
|
52
58
|
|
|
53
59
|
```ts
|
|
54
60
|
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
61
|
|
|
60
|
-
|
|
62
|
+
// Read experiments by UNIVERSE (a mutual-exclusion pool — the unit lands in ≤1
|
|
63
|
+
// experiment). assign() auto-logs one deduped exposure when enrolled.
|
|
64
|
+
const exp = flags.universe("hero_cta").assign();
|
|
65
|
+
render(exp.get("primary_label", "Sign up")); // variant ?? universe default ?? fallback
|
|
66
|
+
|
|
67
|
+
if (exp.enrolled) {
|
|
68
|
+
// exp.group is the variant, exp.name is the experiment
|
|
69
|
+
}
|
|
61
70
|
flags.track("purchase", { value: 42 }); // record a conversion for the bound user
|
|
62
71
|
```
|
|
63
72
|
|
|
64
|
-
`
|
|
65
|
-
|
|
73
|
+
`Assignment = { name: string | null; group: string | null; enrolled: boolean;
|
|
74
|
+
get(field, fallback) }`. Full reference:
|
|
75
|
+
<https://shipeasy-ai.github.io/sdk-ts/pages/experiments.md> · track snippet
|
|
66
76
|
<https://shipeasy-ai.github.io/sdk-ts/snippets/metrics/track.md>
|
|
67
77
|
|
|
68
78
|
## i18n
|
|
@@ -138,8 +148,8 @@ Full reference: <https://shipeasy-ai.github.io/sdk-ts/pages/openfeature.md>
|
|
|
138
148
|
## Advanced
|
|
139
149
|
|
|
140
150
|
`privateAttributes`, `bucketBy` (custom bucketing unit), `stickyBucketing`
|
|
141
|
-
(browser: on by default, `__se_sticky` cookie),
|
|
142
|
-
|
|
151
|
+
(browser: on by default, `__se_sticky` cookie), exposure control (browser:
|
|
152
|
+
`universe(name).assign({ logExposure: false })` + `disableAutoExposure`),
|
|
143
153
|
`onChange(cb)` (requires `configure({ poll: true })`) / browser `subscribe()`.
|
|
144
154
|
Devtools overlay: `Shift+Alt+S` or `?se=1`. Full reference:
|
|
145
155
|
<https://shipeasy-ai.github.io/sdk-ts/pages/advanced.md>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipeasy/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.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",
|
|
@@ -14,6 +14,7 @@
|
|
|
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"
|