@vercel/flags-core 1.8.1 → 1.9.0-0fd2f41-20260915094243
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 +8 -0
- package/README.md +50 -5
- package/dist/{chunk-5BWCBI7I.js → chunk-FEALIMCH.js} +276 -49
- package/dist/chunk-FEALIMCH.js.map +1 -0
- package/dist/{chunk-CVDAHZHK.cjs → chunk-OXUU7M2A.cjs} +295 -68
- package/dist/chunk-OXUU7M2A.cjs.map +1 -0
- package/dist/{chunk-DYSF37WV.js → chunk-XFCAUSUZ.js} +276 -49
- package/dist/chunk-XFCAUSUZ.js.map +1 -0
- package/dist/{chunk-CKL562EU.cjs → chunk-ZUO5MVUD.cjs} +295 -68
- package/dist/chunk-ZUO5MVUD.cjs.map +1 -0
- package/dist/index.default.cjs +2 -2
- package/dist/index.default.d.cts +9 -2
- package/dist/index.default.d.ts +9 -2
- package/dist/index.default.js +1 -1
- package/dist/index.next-js.cjs +2 -2
- package/dist/index.next-js.d.cts +9 -2
- package/dist/index.next-js.d.ts +9 -2
- package/dist/index.next-js.js +1 -1
- package/dist/openfeature.default.cjs +2 -2
- package/dist/openfeature.default.d.cts +1 -1
- package/dist/openfeature.default.d.ts +1 -1
- package/dist/openfeature.default.js +1 -1
- package/dist/openfeature.next-js.cjs +2 -2
- package/dist/openfeature.next-js.d.cts +1 -1
- package/dist/openfeature.next-js.d.ts +1 -1
- package/dist/openfeature.next-js.js +1 -1
- package/dist/{types-CIONStRG.d.cts → types-w8u8i22D.d.cts} +15 -5
- package/dist/{types-CIONStRG.d.ts → types-w8u8i22D.d.ts} +15 -5
- package/package.json +1 -1
- package/dist/chunk-5BWCBI7I.js.map +0 -1
- package/dist/chunk-CKL562EU.cjs.map +0 -1
- package/dist/chunk-CVDAHZHK.cjs.map +0 -1
- package/dist/chunk-DYSF37WV.js.map +0 -1
package/dist/index.default.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VariantId, R as ResolutionReason, D as DatafileInput, S as StreamOptions, P as PollingOptions, M as MetricEnvironment, C as ControllerInterface, a as Datafile, B as BundledDefinitions, e as experimental_ReportExposures, E as EvaluationParams, b as EvaluationResult, F as FlagsClient } from './types-
|
|
2
|
-
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-
|
|
1
|
+
import { V as VariantId, R as ResolutionReason, D as DatafileInput, S as StreamOptions, P as PollingOptions, M as MetricEnvironment, C as ControllerInterface, a as Datafile, B as BundledDefinitions, e as experimental_ReportExposures, E as EvaluationParams, b as EvaluationResult, F as FlagsClient } from './types-w8u8i22D.js';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-w8u8i22D.js';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -98,6 +98,11 @@ type ControllerOptions = {
|
|
|
98
98
|
* - Uses polling exclusively
|
|
99
99
|
* - Same fallback chains as streaming mode
|
|
100
100
|
*
|
|
101
|
+
* **Runtime - vercel mode** (request context has matching x-vercel-flags-config-versions header)
|
|
102
|
+
* - Uses the header value to determine if the current data is fresh
|
|
103
|
+
* - Revalidates in the background if the header value is within 10 seconds of the current configUpdatedAt
|
|
104
|
+
* - Blocking fetch if header is newer than current configUpdatedAt
|
|
105
|
+
*
|
|
101
106
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
102
107
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
103
108
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -111,6 +116,7 @@ declare class Controller implements ControllerInterface {
|
|
|
111
116
|
private streamSource;
|
|
112
117
|
private pollingSource;
|
|
113
118
|
private bundledSource;
|
|
119
|
+
private headerSource;
|
|
114
120
|
private usageTracker;
|
|
115
121
|
private isFirstGetData;
|
|
116
122
|
private buildDataPromise;
|
|
@@ -123,6 +129,7 @@ declare class Controller implements ControllerInterface {
|
|
|
123
129
|
private onStreamDisconnected;
|
|
124
130
|
private onPollData;
|
|
125
131
|
private onPollError;
|
|
132
|
+
private onFetchedData;
|
|
126
133
|
private wireSourceEvents;
|
|
127
134
|
private unwireSourceEvents;
|
|
128
135
|
private transition;
|
package/dist/index.default.js
CHANGED
package/dist/index.next-js.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkZUO5MVUDcjs = require('./chunk-ZUO5MVUD.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -18,5 +18,5 @@ var _chunkCKL562EUcjs = require('./chunk-CKL562EU.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
exports.Controller =
|
|
21
|
+
exports.Controller = _chunkZUO5MVUDcjs.Controller; exports.FallbackEntryNotFoundError = _chunkZUO5MVUDcjs.FallbackEntryNotFoundError; exports.FallbackNotFoundError = _chunkZUO5MVUDcjs.FallbackNotFoundError; exports.FlagNetworkDataSource = _chunkZUO5MVUDcjs.Controller; exports.Reason = _chunkZUO5MVUDcjs.ResolutionReason; exports.createClient = _chunkZUO5MVUDcjs.createClient; exports.evaluate = _chunkZUO5MVUDcjs.evaluate; exports.flagsClient = _chunkZUO5MVUDcjs.flagsClient; exports.resetDefaultFlagsClient = _chunkZUO5MVUDcjs.resetDefaultFlagsClient;
|
|
22
22
|
//# sourceMappingURL=index.next-js.cjs.map
|
package/dist/index.next-js.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VariantId, R as ResolutionReason, D as DatafileInput, S as StreamOptions, P as PollingOptions, M as MetricEnvironment, C as ControllerInterface, a as Datafile, B as BundledDefinitions, e as experimental_ReportExposures, E as EvaluationParams, b as EvaluationResult, F as FlagsClient } from './types-
|
|
2
|
-
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-
|
|
1
|
+
import { V as VariantId, R as ResolutionReason, D as DatafileInput, S as StreamOptions, P as PollingOptions, M as MetricEnvironment, C as ControllerInterface, a as Datafile, B as BundledDefinitions, e as experimental_ReportExposures, E as EvaluationParams, b as EvaluationResult, F as FlagsClient } from './types-w8u8i22D.cjs';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-w8u8i22D.cjs';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -98,6 +98,11 @@ type ControllerOptions = {
|
|
|
98
98
|
* - Uses polling exclusively
|
|
99
99
|
* - Same fallback chains as streaming mode
|
|
100
100
|
*
|
|
101
|
+
* **Runtime - vercel mode** (request context has matching x-vercel-flags-config-versions header)
|
|
102
|
+
* - Uses the header value to determine if the current data is fresh
|
|
103
|
+
* - Revalidates in the background if the header value is within 10 seconds of the current configUpdatedAt
|
|
104
|
+
* - Blocking fetch if header is newer than current configUpdatedAt
|
|
105
|
+
*
|
|
101
106
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
102
107
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
103
108
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -111,6 +116,7 @@ declare class Controller implements ControllerInterface {
|
|
|
111
116
|
private streamSource;
|
|
112
117
|
private pollingSource;
|
|
113
118
|
private bundledSource;
|
|
119
|
+
private headerSource;
|
|
114
120
|
private usageTracker;
|
|
115
121
|
private isFirstGetData;
|
|
116
122
|
private buildDataPromise;
|
|
@@ -123,6 +129,7 @@ declare class Controller implements ControllerInterface {
|
|
|
123
129
|
private onStreamDisconnected;
|
|
124
130
|
private onPollData;
|
|
125
131
|
private onPollError;
|
|
132
|
+
private onFetchedData;
|
|
126
133
|
private wireSourceEvents;
|
|
127
134
|
private unwireSourceEvents;
|
|
128
135
|
private transition;
|
package/dist/index.next-js.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VariantId, R as ResolutionReason, D as DatafileInput, S as StreamOptions, P as PollingOptions, M as MetricEnvironment, C as ControllerInterface, a as Datafile, B as BundledDefinitions, e as experimental_ReportExposures, E as EvaluationParams, b as EvaluationResult, F as FlagsClient } from './types-
|
|
2
|
-
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-
|
|
1
|
+
import { V as VariantId, R as ResolutionReason, D as DatafileInput, S as StreamOptions, P as PollingOptions, M as MetricEnvironment, C as ControllerInterface, a as Datafile, B as BundledDefinitions, e as experimental_ReportExposures, E as EvaluationParams, b as EvaluationResult, F as FlagsClient } from './types-w8u8i22D.js';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-w8u8i22D.js';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -98,6 +98,11 @@ type ControllerOptions = {
|
|
|
98
98
|
* - Uses polling exclusively
|
|
99
99
|
* - Same fallback chains as streaming mode
|
|
100
100
|
*
|
|
101
|
+
* **Runtime - vercel mode** (request context has matching x-vercel-flags-config-versions header)
|
|
102
|
+
* - Uses the header value to determine if the current data is fresh
|
|
103
|
+
* - Revalidates in the background if the header value is within 10 seconds of the current configUpdatedAt
|
|
104
|
+
* - Blocking fetch if header is newer than current configUpdatedAt
|
|
105
|
+
*
|
|
101
106
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
102
107
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
103
108
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -111,6 +116,7 @@ declare class Controller implements ControllerInterface {
|
|
|
111
116
|
private streamSource;
|
|
112
117
|
private pollingSource;
|
|
113
118
|
private bundledSource;
|
|
119
|
+
private headerSource;
|
|
114
120
|
private usageTracker;
|
|
115
121
|
private isFirstGetData;
|
|
116
122
|
private buildDataPromise;
|
|
@@ -123,6 +129,7 @@ declare class Controller implements ControllerInterface {
|
|
|
123
129
|
private onStreamDisconnected;
|
|
124
130
|
private onPollData;
|
|
125
131
|
private onPollError;
|
|
132
|
+
private onFetchedData;
|
|
126
133
|
private wireSourceEvents;
|
|
127
134
|
private unwireSourceEvents;
|
|
128
135
|
private transition;
|
package/dist/index.next-js.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkOXUU7M2Acjs = require('./chunk-OXUU7M2A.cjs');
|
|
5
5
|
|
|
6
6
|
// src/openfeature.make.ts
|
|
7
7
|
|
|
@@ -150,7 +150,7 @@ function make(createClient2, defaultFlagsClient) {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// src/openfeature.default.ts
|
|
153
|
-
var VercelProvider = make(
|
|
153
|
+
var VercelProvider = make(_chunkOXUU7M2Acjs.createClient, _chunkOXUU7M2Acjs.flagsClient);
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
exports.VercelProvider = VercelProvider;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkZUO5MVUDcjs = require('./chunk-ZUO5MVUD.cjs');
|
|
5
5
|
|
|
6
6
|
// src/openfeature.make.ts
|
|
7
7
|
|
|
@@ -150,7 +150,7 @@ function make(createClient2, defaultFlagsClient) {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// src/openfeature.next-js.ts
|
|
153
|
-
var VercelProvider = make(
|
|
153
|
+
var VercelProvider = make(_chunkZUO5MVUDcjs.createClient, _chunkZUO5MVUDcjs.flagsClient);
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
exports.VercelProvider = VercelProvider;
|
|
@@ -59,7 +59,7 @@ type Metrics = {
|
|
|
59
59
|
/** Whether the stream is currently connected */
|
|
60
60
|
connectionState: 'connected' | 'disconnected';
|
|
61
61
|
/** The current operating mode of the client */
|
|
62
|
-
mode: 'streaming' | 'polling' | 'build' | 'offline';
|
|
62
|
+
mode: 'streaming' | 'polling' | 'build' | 'vercel' | 'offline';
|
|
63
63
|
/** Time in ms for the pure flag evaluation logic (only present on EvaluationResult) */
|
|
64
64
|
evaluationMs?: number;
|
|
65
65
|
};
|
|
@@ -156,9 +156,11 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
156
156
|
sdkKey?: string;
|
|
157
157
|
};
|
|
158
158
|
/**
|
|
159
|
-
* Evaluate a feature flag
|
|
159
|
+
* Evaluate a feature flag.
|
|
160
160
|
*
|
|
161
|
-
*
|
|
161
|
+
* Initializes the client automatically on first use. Initialization failures
|
|
162
|
+
* are caught so evaluation can try its fallback sources and defaultValue.
|
|
163
|
+
* With request-scoped Vercel OIDC, call this inside a request handler.
|
|
162
164
|
*
|
|
163
165
|
* @param flagKey
|
|
164
166
|
* @param defaultValue
|
|
@@ -173,7 +175,9 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
173
175
|
* Avoids the per-flag overhead of separate `evaluate()` invocations (in particular,
|
|
174
176
|
* the parallel promises and repeated datafile reads they would entail).
|
|
175
177
|
*
|
|
176
|
-
*
|
|
178
|
+
* Initializes the client automatically on first use. Initialization failures
|
|
179
|
+
* are caught so evaluation can try its fallback sources and default values.
|
|
180
|
+
* With request-scoped Vercel OIDC, call this inside a request handler.
|
|
177
181
|
*
|
|
178
182
|
* @param flags Array of `{ key, defaultValue? }` entries to evaluate.
|
|
179
183
|
* @param entities Shared entities used for every flag in the bulk call.
|
|
@@ -193,7 +197,13 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
193
197
|
entities?: E;
|
|
194
198
|
}) => Promise<void>;
|
|
195
199
|
/**
|
|
196
|
-
*
|
|
200
|
+
* Load flag definitions and set up subscriptions if needed.
|
|
201
|
+
*
|
|
202
|
+
* Optional: evaluate() and bulkEvaluate() initialize automatically. This method
|
|
203
|
+
* rejects if initialization fails, while evaluation can still try fallbacks.
|
|
204
|
+
* With request-scoped Vercel OIDC, call this inside a request handler, not at
|
|
205
|
+
* module scope. Creating the client at module scope is safe; starting and
|
|
206
|
+
* caching an initialization promise there can run before a token is available.
|
|
197
207
|
*/
|
|
198
208
|
initialize(): void | Promise<void>;
|
|
199
209
|
/**
|
|
@@ -59,7 +59,7 @@ type Metrics = {
|
|
|
59
59
|
/** Whether the stream is currently connected */
|
|
60
60
|
connectionState: 'connected' | 'disconnected';
|
|
61
61
|
/** The current operating mode of the client */
|
|
62
|
-
mode: 'streaming' | 'polling' | 'build' | 'offline';
|
|
62
|
+
mode: 'streaming' | 'polling' | 'build' | 'vercel' | 'offline';
|
|
63
63
|
/** Time in ms for the pure flag evaluation logic (only present on EvaluationResult) */
|
|
64
64
|
evaluationMs?: number;
|
|
65
65
|
};
|
|
@@ -156,9 +156,11 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
156
156
|
sdkKey?: string;
|
|
157
157
|
};
|
|
158
158
|
/**
|
|
159
|
-
* Evaluate a feature flag
|
|
159
|
+
* Evaluate a feature flag.
|
|
160
160
|
*
|
|
161
|
-
*
|
|
161
|
+
* Initializes the client automatically on first use. Initialization failures
|
|
162
|
+
* are caught so evaluation can try its fallback sources and defaultValue.
|
|
163
|
+
* With request-scoped Vercel OIDC, call this inside a request handler.
|
|
162
164
|
*
|
|
163
165
|
* @param flagKey
|
|
164
166
|
* @param defaultValue
|
|
@@ -173,7 +175,9 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
173
175
|
* Avoids the per-flag overhead of separate `evaluate()` invocations (in particular,
|
|
174
176
|
* the parallel promises and repeated datafile reads they would entail).
|
|
175
177
|
*
|
|
176
|
-
*
|
|
178
|
+
* Initializes the client automatically on first use. Initialization failures
|
|
179
|
+
* are caught so evaluation can try its fallback sources and default values.
|
|
180
|
+
* With request-scoped Vercel OIDC, call this inside a request handler.
|
|
177
181
|
*
|
|
178
182
|
* @param flags Array of `{ key, defaultValue? }` entries to evaluate.
|
|
179
183
|
* @param entities Shared entities used for every flag in the bulk call.
|
|
@@ -193,7 +197,13 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
193
197
|
entities?: E;
|
|
194
198
|
}) => Promise<void>;
|
|
195
199
|
/**
|
|
196
|
-
*
|
|
200
|
+
* Load flag definitions and set up subscriptions if needed.
|
|
201
|
+
*
|
|
202
|
+
* Optional: evaluate() and bulkEvaluate() initialize automatically. This method
|
|
203
|
+
* rejects if initialization fails, while evaluation can still try fallbacks.
|
|
204
|
+
* With request-scoped Vercel OIDC, call this inside a request handler, not at
|
|
205
|
+
* module scope. Creating the client at module scope is safe; starting and
|
|
206
|
+
* caching an initialization promise there can run before a token is available.
|
|
197
207
|
*/
|
|
198
208
|
initialize(): void | Promise<void>;
|
|
199
209
|
/**
|