@spotify-confidence/openfeature-server-provider-local 0.14.2 → 0.15.1
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/CHANGELOG.md +21 -0
- package/README.md +17 -0
- package/dist/confidence_resolver.wasm +0 -0
- package/dist/index.fetch.d.ts +3 -0
- package/dist/index.fetch.js +33 -8
- package/dist/index.inlined.d.ts +3 -0
- package/dist/index.inlined.js +34 -9
- package/dist/index.node.d.ts +3 -0
- package/dist/index.node.js +33 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.15.1](https://github.com/spotify/confidence-resolver/compare/openfeature-provider-js-v0.15.0...openfeature-provider-js-v0.15.1) (2026-06-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* register telemetry on bundle resolve path ([#431](https://github.com/spotify/confidence-resolver/issues/431)) ([2ce5c9a](https://github.com/spotify/confidence-resolver/commit/2ce5c9a5eb50be27b3aa8d98bfb1be469d23b7c0))
|
|
9
|
+
|
|
10
|
+
## [0.15.0](https://github.com/spotify/confidence-resolver/compare/openfeature-provider-js-v0.14.2...openfeature-provider-js-v0.15.0) (2026-05-28)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* support skipping apply using context key ([#421](https://github.com/spotify/confidence-resolver/issues/421)) ([0ad63cc](https://github.com/spotify/confidence-resolver/commit/0ad63ccebef53073e57be42a9ab78a03f14e1851))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
* The following workspace dependencies were updated
|
|
21
|
+
* dependencies
|
|
22
|
+
* rust-guest bumped from 0.2.3 to 0.2.4
|
|
23
|
+
|
|
3
24
|
## [0.14.2](https://github.com/spotify/confidence-resolver/compare/openfeature-provider-js-v0.14.1...openfeature-provider-js-v0.14.2) (2026-05-27)
|
|
4
25
|
|
|
5
26
|
|
package/README.md
CHANGED
|
@@ -339,6 +339,23 @@ yarn add debug
|
|
|
339
339
|
|
|
340
340
|
---
|
|
341
341
|
|
|
342
|
+
## Advanced: Controlling Exposure Events
|
|
343
|
+
|
|
344
|
+
By default, every flag evaluation triggers an exposure event (apply). If you need to resolve a flag without recording an exposure, you can pass `_confidence_skip_apply: true` in the evaluation context:
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
const value = await client.getBooleanValue('my-flag.enabled', false, {
|
|
348
|
+
targetingKey: 'user-123',
|
|
349
|
+
_confidence_skip_apply: true,
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
The key is automatically stripped from the context before it reaches the resolver.
|
|
354
|
+
|
|
355
|
+
This is an advanced feature intended for specific use cases such as prefetching or background evaluation. If you're considering using it, reach out to the Confidence team to discuss the best approach for your setup.
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
342
359
|
## License
|
|
343
360
|
|
|
344
361
|
See the root `LICENSE`.
|
|
Binary file
|
package/dist/index.fetch.d.ts
CHANGED
|
@@ -86,6 +86,8 @@ declare enum ResolveReason {
|
|
|
86
86
|
RESOLVE_REASON_TYPE_MISMATCH = 9,
|
|
87
87
|
/** RESOLVE_REASON_FLAG_NOT_FOUND - The flag was not found in the resolve response */
|
|
88
88
|
RESOLVE_REASON_FLAG_NOT_FOUND = 10,
|
|
89
|
+
/** RESOLVE_REASON_BUNDLE - A bundle resolve was performed (multiple flags resolved at once) */
|
|
90
|
+
RESOLVE_REASON_BUNDLE = 11,
|
|
89
91
|
UNRECOGNIZED = -1,
|
|
90
92
|
}
|
|
91
93
|
declare enum SdkId {
|
|
@@ -514,6 +516,7 @@ declare class ConfidenceServerProviderLocal implements Provider {
|
|
|
514
516
|
initialize(context?: EvaluationContext): Promise<void>;
|
|
515
517
|
onClose(): Promise<void>;
|
|
516
518
|
resolve(context: EvaluationContext, flagNames: string[], apply?: boolean): Promise<FlagBundle$1>;
|
|
519
|
+
private resolveFlags;
|
|
517
520
|
evaluate<T extends JsonValue>(flagKey: string, defaultValue: T, context: EvaluationContext): Promise<ResolutionDetails<T>>;
|
|
518
521
|
private resolveProcess;
|
|
519
522
|
private handleMaterializationWrites;
|
package/dist/index.fetch.js
CHANGED
|
@@ -776,6 +776,7 @@ let ResolveReason = /* @__PURE__ */ function(ResolveReason$1) {
|
|
|
776
776
|
ResolveReason$1[ResolveReason$1["RESOLVE_REASON_MATERIALIZATION_NOT_SUPPORTED"] = 8] = "RESOLVE_REASON_MATERIALIZATION_NOT_SUPPORTED";
|
|
777
777
|
ResolveReason$1[ResolveReason$1["RESOLVE_REASON_TYPE_MISMATCH"] = 9] = "RESOLVE_REASON_TYPE_MISMATCH";
|
|
778
778
|
ResolveReason$1[ResolveReason$1["RESOLVE_REASON_FLAG_NOT_FOUND"] = 10] = "RESOLVE_REASON_FLAG_NOT_FOUND";
|
|
779
|
+
ResolveReason$1[ResolveReason$1["RESOLVE_REASON_BUNDLE"] = 11] = "RESOLVE_REASON_BUNDLE";
|
|
779
780
|
ResolveReason$1[ResolveReason$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
780
781
|
return ResolveReason$1;
|
|
781
782
|
}({});
|
|
@@ -803,6 +804,8 @@ function resolveReasonFromJSON(object) {
|
|
|
803
804
|
case "RESOLVE_REASON_TYPE_MISMATCH": return ResolveReason.RESOLVE_REASON_TYPE_MISMATCH;
|
|
804
805
|
case 10:
|
|
805
806
|
case "RESOLVE_REASON_FLAG_NOT_FOUND": return ResolveReason.RESOLVE_REASON_FLAG_NOT_FOUND;
|
|
807
|
+
case 11:
|
|
808
|
+
case "RESOLVE_REASON_BUNDLE": return ResolveReason.RESOLVE_REASON_BUNDLE;
|
|
806
809
|
case -1:
|
|
807
810
|
case "UNRECOGNIZED":
|
|
808
811
|
default: return ResolveReason.UNRECOGNIZED;
|
|
@@ -821,6 +824,7 @@ function resolveReasonToJSON(object) {
|
|
|
821
824
|
case ResolveReason.RESOLVE_REASON_MATERIALIZATION_NOT_SUPPORTED: return "RESOLVE_REASON_MATERIALIZATION_NOT_SUPPORTED";
|
|
822
825
|
case ResolveReason.RESOLVE_REASON_TYPE_MISMATCH: return "RESOLVE_REASON_TYPE_MISMATCH";
|
|
823
826
|
case ResolveReason.RESOLVE_REASON_FLAG_NOT_FOUND: return "RESOLVE_REASON_FLAG_NOT_FOUND";
|
|
827
|
+
case ResolveReason.RESOLVE_REASON_BUNDLE: return "RESOLVE_REASON_BUNDLE";
|
|
824
828
|
case ResolveReason.UNRECOGNIZED:
|
|
825
829
|
default: return "UNRECOGNIZED";
|
|
826
830
|
}
|
|
@@ -1430,7 +1434,7 @@ function isObject(value) {
|
|
|
1430
1434
|
function isSet$3(value) {
|
|
1431
1435
|
return value !== null && value !== void 0;
|
|
1432
1436
|
}
|
|
1433
|
-
const VERSION = "0.
|
|
1437
|
+
const VERSION = "0.15.1";
|
|
1434
1438
|
const NOOP_LOG_FN = Object.assign(() => {}, { enabled: false });
|
|
1435
1439
|
const debugBackend = loadDebug();
|
|
1436
1440
|
const logger$2 = new class LoggerImpl {
|
|
@@ -2896,6 +2900,24 @@ var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
|
2896
2900
|
this.main.abort();
|
|
2897
2901
|
}
|
|
2898
2902
|
async resolve(context, flagNames, apply = false) {
|
|
2903
|
+
const startMs = performance.now();
|
|
2904
|
+
let reason = ResolveReason.RESOLVE_REASON_BUNDLE;
|
|
2905
|
+
try {
|
|
2906
|
+
return await this.resolveFlags(context, flagNames, apply);
|
|
2907
|
+
} catch (err) {
|
|
2908
|
+
reason = ResolveReason.RESOLVE_REASON_ERROR;
|
|
2909
|
+
return error(ErrorCode.GENERAL, String(err));
|
|
2910
|
+
} finally {
|
|
2911
|
+
const latencyUs = Math.round((performance.now() - startMs) * 1e3);
|
|
2912
|
+
try {
|
|
2913
|
+
this.resolver.registerResolve({
|
|
2914
|
+
reason,
|
|
2915
|
+
latencyUs
|
|
2916
|
+
});
|
|
2917
|
+
} catch {}
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
async resolveFlags(context, flagNames, apply) {
|
|
2899
2921
|
const resolveRequest = {
|
|
2900
2922
|
flags: flagNames.map((name) => `flags/${name}`),
|
|
2901
2923
|
evaluationContext: ConfidenceServerProviderLocal.convertEvaluationContext(context),
|
|
@@ -2906,18 +2928,21 @@ var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
|
2906
2928
|
version: VERSION
|
|
2907
2929
|
}
|
|
2908
2930
|
};
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
return create(await this.resolveProcess(processRequest));
|
|
2912
|
-
} catch (err) {
|
|
2913
|
-
return error(ErrorCode.GENERAL, String(err));
|
|
2914
|
-
}
|
|
2931
|
+
const processRequest = this.materializationStore ? { deferredMaterializations: resolveRequest } : { withoutMaterializations: resolveRequest };
|
|
2932
|
+
return create(await this.resolveProcess(processRequest));
|
|
2915
2933
|
}
|
|
2916
2934
|
async evaluate(flagKey, defaultValue, context) {
|
|
2917
2935
|
const startMs = performance.now();
|
|
2918
2936
|
try {
|
|
2919
2937
|
const [flagName] = flagKey.split(".", 1);
|
|
2920
|
-
const
|
|
2938
|
+
const { _confidence_skip_apply,...cleanContext } = context;
|
|
2939
|
+
const skipApply = _confidence_skip_apply === true;
|
|
2940
|
+
let resolution;
|
|
2941
|
+
try {
|
|
2942
|
+
resolution = await this.resolveFlags(cleanContext, [flagName], !skipApply);
|
|
2943
|
+
} catch (err) {
|
|
2944
|
+
resolution = error(ErrorCode.GENERAL, String(err));
|
|
2945
|
+
}
|
|
2921
2946
|
const result = resolve(resolution, flagKey, defaultValue, logger$1);
|
|
2922
2947
|
const latencyUs = Math.round((performance.now() - startMs) * 1e3);
|
|
2923
2948
|
let reason;
|
package/dist/index.inlined.d.ts
CHANGED
|
@@ -86,6 +86,8 @@ declare enum ResolveReason {
|
|
|
86
86
|
RESOLVE_REASON_TYPE_MISMATCH = 9,
|
|
87
87
|
/** RESOLVE_REASON_FLAG_NOT_FOUND - The flag was not found in the resolve response */
|
|
88
88
|
RESOLVE_REASON_FLAG_NOT_FOUND = 10,
|
|
89
|
+
/** RESOLVE_REASON_BUNDLE - A bundle resolve was performed (multiple flags resolved at once) */
|
|
90
|
+
RESOLVE_REASON_BUNDLE = 11,
|
|
89
91
|
UNRECOGNIZED = -1,
|
|
90
92
|
}
|
|
91
93
|
declare enum SdkId {
|
|
@@ -514,6 +516,7 @@ declare class ConfidenceServerProviderLocal implements Provider {
|
|
|
514
516
|
initialize(context?: EvaluationContext): Promise<void>;
|
|
515
517
|
onClose(): Promise<void>;
|
|
516
518
|
resolve(context: EvaluationContext, flagNames: string[], apply?: boolean): Promise<FlagBundle$1>;
|
|
519
|
+
private resolveFlags;
|
|
517
520
|
evaluate<T extends JsonValue>(flagKey: string, defaultValue: T, context: EvaluationContext): Promise<ResolutionDetails<T>>;
|
|
518
521
|
private resolveProcess;
|
|
519
522
|
private handleMaterializationWrites;
|