flagmint-js-sdk 2.2.2 → 2.2.3-rc.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/README.md +1 -1
- package/dist/flagmint.cjs.js +125 -25
- package/dist/flagmint.cjs.js.map +1 -1
- package/dist/flagmint.es.js +125 -25
- package/dist/flagmint.es.js.map +1 -1
- package/dist/flagmint.umd.js +125 -25
- package/dist/flagmint.umd.js.map +1 -1
- package/dist/sdk/core/config-sync/index.d.ts +1 -1
- package/dist/sdk/core/config-sync/piiHash.d.ts +46 -0
- package/dist/sdk/core/config-sync/rulesStore.d.ts +7 -1
- package/dist/sdk/core/config-sync/types.d.ts +5 -0
- package/dist/sdk/core/helpers/cacheHelper.d.ts +7 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ export type { ConfigSyncPayload, DeltaConfigPayload, DeltasCatchUpPayload, FullC
|
|
|
7
7
|
export { performAslHandshake } from './handshake';
|
|
8
8
|
export type { AslHandshakeSuccess } from './handshake';
|
|
9
9
|
export { evaluateSdkFlag, evaluateAllSdkFlags, coerceType, prepareContextForEvaluator, prepareContextForLocalEval, mapToRecord, } from './evaluateSdkFlag';
|
|
10
|
-
export { PII_VALUE_ENCODING, normalizePiiString, hashPiiValue, isPiiAttribute, payloadHasExplicitPiiFields, piiWireOptionsFromPayload, resolvePiiWireForDelta, applyPiiHashToFlatContext, } from './piiHash';
|
|
10
|
+
export { PII_VALUE_ENCODING, normalizePiiString, hashPiiValue, isPiiAttribute, payloadHasExplicitPiiFields, hasExplicitInvalidPiiEncoding, hasMalformedPiiAttributes, payloadRequiresUsablePiiWire, isExplicitPiiRequirementCleared, piiAttributeKeysFromPayload, piiWireOptionsFromPayload, isPiiWireBroken, resolvePiiWireForDelta, applyPiiHashToFlatContext, } from './piiHash';
|
|
11
11
|
export type { PiiWireOptions, ApplyPiiHashMode } from './piiHash';
|
|
12
12
|
export { evaluateRule, evaluateKillSwitch, evaluateOnVariation, evaluateFlagWithTargetingRules, applyRolloutStrategy, applyPercentageRollout, applyVariantRollout, applyGradualRollout, computeCurrentPercentage, defaultHash, getContextAttribute, } from './flagEvaluator';
|
|
13
13
|
export type { ExpectedFlagType, FlagEvaluationResult, Condition, TargetingRule, Rollout, Variation, Segment, EvaluationDeps, } from './flagEvaluator';
|
|
@@ -53,6 +53,40 @@ export type PiiWirePayloadFields = {
|
|
|
53
53
|
* @param payload Signed fullConfig / delta fields
|
|
54
54
|
*/
|
|
55
55
|
export declare function payloadHasExplicitPiiFields(payload: PiiWirePayloadFields | null | undefined): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* String attribute keys listed on a PII wire payload (ignores non-strings).
|
|
58
|
+
*
|
|
59
|
+
* @param payload Signed fullConfig / delta fields
|
|
60
|
+
*/
|
|
61
|
+
export declare function piiAttributeKeysFromPayload(payload: PiiWirePayloadFields | null | undefined): string[];
|
|
62
|
+
/**
|
|
63
|
+
* True when `piiAttributes` is present but not a clean list of non-empty strings.
|
|
64
|
+
* e.g. `[null]`, `['']`, or a non-array — must not count as "remove all PII".
|
|
65
|
+
*
|
|
66
|
+
* @param payload Signed fullConfig / delta fields
|
|
67
|
+
*/
|
|
68
|
+
export declare function hasMalformedPiiAttributes(payload: PiiWirePayloadFields | null | undefined): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* True when `piiValueEncoding` is present but is not usable `hmac-v1`.
|
|
71
|
+
* Distinguishes omitted encoding (OK — default hmac-v1) from e.g. `123` / `hmac-v2`.
|
|
72
|
+
*
|
|
73
|
+
* @param payload Signed fullConfig / delta fields
|
|
74
|
+
*/
|
|
75
|
+
export declare function hasExplicitInvalidPiiEncoding(payload: PiiWirePayloadFields | null | undefined): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* True when the payload claims PII hashing is in play and the client must have
|
|
78
|
+
* usable salt + `hmac-v1` encoding (otherwise local eval must fail closed).
|
|
79
|
+
*
|
|
80
|
+
* @param payload Signed fullConfig / delta fields
|
|
81
|
+
*/
|
|
82
|
+
export declare function payloadRequiresUsablePiiWire(payload: PiiWirePayloadFields | null | undefined): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* True when the payload explicitly clears the PII attribute list.
|
|
85
|
+
* Only a literal empty array `[]` counts — `[null]` / `['']` are malformed, not removal.
|
|
86
|
+
*
|
|
87
|
+
* @param payload Signed fullConfig / delta fields
|
|
88
|
+
*/
|
|
89
|
+
export declare function isExplicitPiiRequirementCleared(payload: PiiWirePayloadFields | null | undefined): boolean;
|
|
56
90
|
/**
|
|
57
91
|
* Parse PII wire options from a config-sync payload body.
|
|
58
92
|
*
|
|
@@ -60,6 +94,18 @@ export declare function payloadHasExplicitPiiFields(payload: PiiWirePayloadField
|
|
|
60
94
|
* @returns Options when salt + encoding are usable; otherwise null
|
|
61
95
|
*/
|
|
62
96
|
export declare function piiWireOptionsFromPayload(payload: PiiWirePayloadFields | null | undefined): PiiWireOptions | null;
|
|
97
|
+
/**
|
|
98
|
+
* Whether resolved PII options are missing while the payload (or prior state)
|
|
99
|
+
* still requires hashing — local eval must use defaults only.
|
|
100
|
+
*
|
|
101
|
+
* Explicit `piiAttributes: []` (literal empty array) clears the requirement
|
|
102
|
+
* even if salt is empty — evaluation may proceed without hashing.
|
|
103
|
+
*
|
|
104
|
+
* @param payload Payload that was just applied (full or merged delta fields)
|
|
105
|
+
* @param resolved Result of {@link piiWireOptionsFromPayload} / delta resolve
|
|
106
|
+
* @param previousPriorHadPiiAttrs Whether the store previously had PII attribute keys
|
|
107
|
+
*/
|
|
108
|
+
export declare function isPiiWireBroken(payload: PiiWirePayloadFields | null | undefined, resolved: PiiWireOptions | null, previousPriorHadPiiAttrs?: boolean): boolean;
|
|
63
109
|
/**
|
|
64
110
|
* Resolve PII wire options for a delta: keep prior when all PII fields are
|
|
65
111
|
* absent; otherwise parse after merging omitted fields from `previous`.
|
|
@@ -11,6 +11,11 @@ export type RulesState = {
|
|
|
11
11
|
needsFullConfig: boolean;
|
|
12
12
|
/** PII hash options from the last fullConfig/delta (null when absent). */
|
|
13
13
|
piiWire: PiiWireOptions | null;
|
|
14
|
+
/**
|
|
15
|
+
* True when hashed PII rules are expected but salt/encoding is unusable.
|
|
16
|
+
* Fail closed (defaults only) until a good fullConfig arrives.
|
|
17
|
+
*/
|
|
18
|
+
piiWireBroken: boolean;
|
|
14
19
|
};
|
|
15
20
|
export type ApplyResult = {
|
|
16
21
|
ok: true;
|
|
@@ -36,7 +41,8 @@ export declare class RulesStore {
|
|
|
36
41
|
getMacKey(): Uint8Array | null;
|
|
37
42
|
getState(): RulesState;
|
|
38
43
|
/**
|
|
39
|
-
* Fail-closed readiness: lease not expired
|
|
44
|
+
* Fail-closed readiness: lease not expired, store marked ready, and PII
|
|
45
|
+
* wire metadata usable when hashing is required.
|
|
40
46
|
*/
|
|
41
47
|
isReady(now?: number): boolean;
|
|
42
48
|
/**
|
|
@@ -79,4 +79,9 @@ export type RulesCacheSnapshot = {
|
|
|
79
79
|
piiAttributes?: string[];
|
|
80
80
|
piiSalt?: string;
|
|
81
81
|
piiValueEncoding?: string;
|
|
82
|
+
/**
|
|
83
|
+
* When true, hydrate must stay fail-closed even if salt/attrs were omitted
|
|
84
|
+
* from the snapshot (broken wire with `piiWire === null`).
|
|
85
|
+
*/
|
|
86
|
+
piiWireBroken?: boolean;
|
|
82
87
|
};
|
|
@@ -8,6 +8,13 @@ export interface StorageAdapter {
|
|
|
8
8
|
export declare function setCacheStorage(customStorage: StorageAdapter): void;
|
|
9
9
|
export declare function loadCachedFlags<T>(apiKey: string, ttl: number): FeatureFlags<T> | null;
|
|
10
10
|
export declare function saveCachedFlags<T>(apiKey: string, data: FeatureFlags<T>): void;
|
|
11
|
+
/**
|
|
12
|
+
* Drop the evaluated-flag localCache entry for an API key.
|
|
13
|
+
* Used when config-sync is on so a prior tab’s answers cannot poison another tab.
|
|
14
|
+
*
|
|
15
|
+
* @param apiKey SDK API key used as the storage key suffix
|
|
16
|
+
*/
|
|
17
|
+
export declare function clearCachedFlags(apiKey: string): void;
|
|
11
18
|
export declare function loadCachedContext<C>(apiKey: string): C | null;
|
|
12
19
|
export declare function saveCachedContext<C>(apiKey: string, context: C): void;
|
|
13
20
|
/** Config-sync rules localCache — no wall-clock TTL; lease `expiresAt` gates reuse. */
|
package/package.json
CHANGED