@spotify-confidence/openfeature-server-provider-local 0.15.0 → 0.15.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/CHANGELOG.md +16 -0
- package/dist/confidence_resolver.wasm +0 -0
- package/dist/index.fetch.d.ts +3 -0
- package/dist/index.fetch.js +31 -8
- package/dist/index.inlined.d.ts +3 -0
- package/dist/index.inlined.js +32 -9
- package/dist/index.node.d.ts +3 -0
- package/dist/index.node.js +31 -8
- package/package.json +3 -3
package/dist/index.node.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.node.js
CHANGED
|
@@ -779,6 +779,7 @@ let ResolveReason = /* @__PURE__ */ function(ResolveReason$1) {
|
|
|
779
779
|
ResolveReason$1[ResolveReason$1["RESOLVE_REASON_MATERIALIZATION_NOT_SUPPORTED"] = 8] = "RESOLVE_REASON_MATERIALIZATION_NOT_SUPPORTED";
|
|
780
780
|
ResolveReason$1[ResolveReason$1["RESOLVE_REASON_TYPE_MISMATCH"] = 9] = "RESOLVE_REASON_TYPE_MISMATCH";
|
|
781
781
|
ResolveReason$1[ResolveReason$1["RESOLVE_REASON_FLAG_NOT_FOUND"] = 10] = "RESOLVE_REASON_FLAG_NOT_FOUND";
|
|
782
|
+
ResolveReason$1[ResolveReason$1["RESOLVE_REASON_BUNDLE"] = 11] = "RESOLVE_REASON_BUNDLE";
|
|
782
783
|
ResolveReason$1[ResolveReason$1["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
783
784
|
return ResolveReason$1;
|
|
784
785
|
}({});
|
|
@@ -806,6 +807,8 @@ function resolveReasonFromJSON(object) {
|
|
|
806
807
|
case "RESOLVE_REASON_TYPE_MISMATCH": return ResolveReason.RESOLVE_REASON_TYPE_MISMATCH;
|
|
807
808
|
case 10:
|
|
808
809
|
case "RESOLVE_REASON_FLAG_NOT_FOUND": return ResolveReason.RESOLVE_REASON_FLAG_NOT_FOUND;
|
|
810
|
+
case 11:
|
|
811
|
+
case "RESOLVE_REASON_BUNDLE": return ResolveReason.RESOLVE_REASON_BUNDLE;
|
|
809
812
|
case -1:
|
|
810
813
|
case "UNRECOGNIZED":
|
|
811
814
|
default: return ResolveReason.UNRECOGNIZED;
|
|
@@ -824,6 +827,7 @@ function resolveReasonToJSON(object) {
|
|
|
824
827
|
case ResolveReason.RESOLVE_REASON_MATERIALIZATION_NOT_SUPPORTED: return "RESOLVE_REASON_MATERIALIZATION_NOT_SUPPORTED";
|
|
825
828
|
case ResolveReason.RESOLVE_REASON_TYPE_MISMATCH: return "RESOLVE_REASON_TYPE_MISMATCH";
|
|
826
829
|
case ResolveReason.RESOLVE_REASON_FLAG_NOT_FOUND: return "RESOLVE_REASON_FLAG_NOT_FOUND";
|
|
830
|
+
case ResolveReason.RESOLVE_REASON_BUNDLE: return "RESOLVE_REASON_BUNDLE";
|
|
827
831
|
case ResolveReason.UNRECOGNIZED:
|
|
828
832
|
default: return "UNRECOGNIZED";
|
|
829
833
|
}
|
|
@@ -1433,7 +1437,7 @@ function isObject(value) {
|
|
|
1433
1437
|
function isSet$3(value) {
|
|
1434
1438
|
return value !== null && value !== void 0;
|
|
1435
1439
|
}
|
|
1436
|
-
const VERSION = "0.15.
|
|
1440
|
+
const VERSION = "0.15.2";
|
|
1437
1441
|
const NOOP_LOG_FN = Object.assign(() => {}, { enabled: false });
|
|
1438
1442
|
const debugBackend = loadDebug();
|
|
1439
1443
|
const logger$2 = new class LoggerImpl {
|
|
@@ -2899,6 +2903,24 @@ var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
|
2899
2903
|
this.main.abort();
|
|
2900
2904
|
}
|
|
2901
2905
|
async resolve(context, flagNames, apply = false) {
|
|
2906
|
+
const startMs = performance.now();
|
|
2907
|
+
let reason = ResolveReason.RESOLVE_REASON_BUNDLE;
|
|
2908
|
+
try {
|
|
2909
|
+
return await this.resolveFlags(context, flagNames, apply);
|
|
2910
|
+
} catch (err) {
|
|
2911
|
+
reason = ResolveReason.RESOLVE_REASON_ERROR;
|
|
2912
|
+
return error(ErrorCode.GENERAL, String(err));
|
|
2913
|
+
} finally {
|
|
2914
|
+
const latencyUs = Math.round((performance.now() - startMs) * 1e3);
|
|
2915
|
+
try {
|
|
2916
|
+
this.resolver.registerResolve({
|
|
2917
|
+
reason,
|
|
2918
|
+
latencyUs
|
|
2919
|
+
});
|
|
2920
|
+
} catch {}
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
async resolveFlags(context, flagNames, apply) {
|
|
2902
2924
|
const resolveRequest = {
|
|
2903
2925
|
flags: flagNames.map((name) => `flags/${name}`),
|
|
2904
2926
|
evaluationContext: ConfidenceServerProviderLocal.convertEvaluationContext(context),
|
|
@@ -2909,12 +2931,8 @@ var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
|
2909
2931
|
version: VERSION
|
|
2910
2932
|
}
|
|
2911
2933
|
};
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
return create(await this.resolveProcess(processRequest));
|
|
2915
|
-
} catch (err) {
|
|
2916
|
-
return error(ErrorCode.GENERAL, String(err));
|
|
2917
|
-
}
|
|
2934
|
+
const processRequest = this.materializationStore ? { deferredMaterializations: resolveRequest } : { withoutMaterializations: resolveRequest };
|
|
2935
|
+
return create(await this.resolveProcess(processRequest));
|
|
2918
2936
|
}
|
|
2919
2937
|
async evaluate(flagKey, defaultValue, context) {
|
|
2920
2938
|
const startMs = performance.now();
|
|
@@ -2922,7 +2940,12 @@ var ConfidenceServerProviderLocal = class ConfidenceServerProviderLocal {
|
|
|
2922
2940
|
const [flagName] = flagKey.split(".", 1);
|
|
2923
2941
|
const { _confidence_skip_apply,...cleanContext } = context;
|
|
2924
2942
|
const skipApply = _confidence_skip_apply === true;
|
|
2925
|
-
|
|
2943
|
+
let resolution;
|
|
2944
|
+
try {
|
|
2945
|
+
resolution = await this.resolveFlags(cleanContext, [flagName], !skipApply);
|
|
2946
|
+
} catch (err) {
|
|
2947
|
+
resolution = error(ErrorCode.GENERAL, String(err));
|
|
2948
|
+
}
|
|
2926
2949
|
const result = resolve(resolution, flagKey, defaultValue, logger$1);
|
|
2927
2950
|
const latencyUs = Math.round((performance.now() - startMs) * 1e3);
|
|
2928
2951
|
let reason;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotify-confidence/openfeature-server-provider-local",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Spotify Confidence Open Feature provider",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/node": "^24.0.1",
|
|
69
69
|
"@types/react": "^19",
|
|
70
70
|
"@types/react-dom": "^19",
|
|
71
|
-
"@vitest/coverage-v8": "^
|
|
71
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
72
72
|
"debug": "^4.4.3",
|
|
73
73
|
"dotenv": "^17.2.2",
|
|
74
74
|
"happy-dom": "^20.3.4",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"ts-proto": "^2.7.3",
|
|
81
81
|
"tsdown": "latest",
|
|
82
82
|
"typescript": "^5.9.3",
|
|
83
|
-
"vitest": "^
|
|
83
|
+
"vitest": "^4.1.7"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@openfeature/core": "^1.0.0",
|