@dipswitch/openfeature-node 0.1.0 → 0.2.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 -1
- package/dist/index.cjs +7 -2
- package/dist/index.mjs +7 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,6 +20,6 @@ const billing = await client.getBooleanDetails('new-billing', false, { targeting
|
|
|
20
20
|
console.log(billing.value, billing.reason)
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Use `targetingKey` for the user id and omit it for anonymous evaluation. The provider forwards OpenFeature configuration-change events. Pass `edgeUrl` to use a local edge. Call `OpenFeature.clearProviders()` when the app shuts down.
|
|
23
|
+
Use `targetingKey` for the user id and omit it for anonymous evaluation. The provider forwards OpenFeature configuration-change events. Pass `edgeUrl` to use a local edge. Call `OpenFeature.clearProviders()` when the app shuts down. Use a string `workspaceId` in the evaluation context for workspace rollouts. If the flag uses a rollout key that is missing, evaluation details report it in `flagMetadata.missingRolloutKey`.
|
|
24
24
|
|
|
25
25
|
Dipswitch flags are boolean. A missing flag returns the supplied default with `FLAG_NOT_FOUND`. When the ruleset is unavailable at startup, evaluations return the default with `PROVIDER_NOT_READY`. The SDK retries temporary failures and stops if the key is the wrong kind, is revoked, or keeps getting a 401. OpenFeature signals readiness when a ruleset arrives.
|
package/dist/index.cjs
CHANGED
|
@@ -39,10 +39,15 @@ var DipswitchProvider = class {
|
|
|
39
39
|
this.sdk = void 0;
|
|
40
40
|
}
|
|
41
41
|
async resolveBooleanEvaluation(key, _defaultValue, context) {
|
|
42
|
-
const result = this.sdk?.getFlagDetails(key, context.targetingKey);
|
|
42
|
+
const result = this.sdk?.getFlagDetails(key, context.targetingKey, typeof context.workspaceId === "string" ? context.workspaceId : void 0);
|
|
43
43
|
if (!result || result.reason === "NOT_READY") throw notReady();
|
|
44
44
|
if (result.value === void 0) throw new _openfeature_server_sdk.FlagNotFoundError(`No flag named ${key}.`);
|
|
45
|
-
|
|
45
|
+
const { value, reason, metadata } = result;
|
|
46
|
+
return {
|
|
47
|
+
value,
|
|
48
|
+
reason,
|
|
49
|
+
...metadata && { flagMetadata: metadata }
|
|
50
|
+
};
|
|
46
51
|
}
|
|
47
52
|
resolveStringEvaluation = unsupported;
|
|
48
53
|
resolveNumberEvaluation = unsupported;
|
package/dist/index.mjs
CHANGED
|
@@ -38,10 +38,15 @@ var DipswitchProvider = class {
|
|
|
38
38
|
this.sdk = void 0;
|
|
39
39
|
}
|
|
40
40
|
async resolveBooleanEvaluation(key, _defaultValue, context) {
|
|
41
|
-
const result = this.sdk?.getFlagDetails(key, context.targetingKey);
|
|
41
|
+
const result = this.sdk?.getFlagDetails(key, context.targetingKey, typeof context.workspaceId === "string" ? context.workspaceId : void 0);
|
|
42
42
|
if (!result || result.reason === "NOT_READY") throw notReady();
|
|
43
43
|
if (result.value === void 0) throw new FlagNotFoundError(`No flag named ${key}.`);
|
|
44
|
-
|
|
44
|
+
const { value, reason, metadata } = result;
|
|
45
|
+
return {
|
|
46
|
+
value,
|
|
47
|
+
reason,
|
|
48
|
+
...metadata && { flagMetadata: metadata }
|
|
49
|
+
};
|
|
45
50
|
}
|
|
46
51
|
resolveStringEvaluation = unsupported;
|
|
47
52
|
resolveNumberEvaluation = unsupported;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dipswitch/openfeature-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Dipswitch provider for the OpenFeature Node SDK.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@dipswitch/sdk-node": "0.
|
|
30
|
+
"@dipswitch/sdk-node": "0.2.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@openfeature/server-sdk": "^1.23.0"
|