@vercel/flags-core 1.9.0-ea4d7de-20260922121332 → 1.9.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/CHANGELOG.md +20 -2
- package/dist/{chunk-L6QJOXJN.cjs → chunk-PGKH4XQ7.cjs} +385 -353
- package/dist/chunk-PGKH4XQ7.cjs.map +1 -0
- package/dist/{chunk-FKI4L3NY.js → chunk-SLNLPFKU.js} +354 -322
- package/dist/chunk-SLNLPFKU.js.map +1 -0
- package/dist/{chunk-C22F472K.js → chunk-TDZBUVBG.js} +354 -322
- package/dist/chunk-TDZBUVBG.js.map +1 -0
- package/dist/{chunk-VQ3WFG4Y.cjs → chunk-W742GGZU.cjs} +386 -354
- package/dist/chunk-W742GGZU.cjs.map +1 -0
- package/dist/index.default.cjs +2 -2
- package/dist/index.default.d.cts +10 -28
- package/dist/index.default.d.ts +10 -28
- package/dist/index.default.js +1 -1
- package/dist/index.next-js.cjs +2 -2
- package/dist/index.next-js.d.cts +10 -28
- package/dist/index.next-js.d.ts +10 -28
- 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-WeTcbSQF.d.cts → types-1OK52NNi.d.cts} +10 -8
- package/dist/{types-WeTcbSQF.d.ts → types-1OK52NNi.d.ts} +10 -8
- package/package.json +4 -4
- package/dist/chunk-C22F472K.js.map +0 -1
- package/dist/chunk-FKI4L3NY.js.map +0 -1
- package/dist/chunk-L6QJOXJN.cjs.map +0 -1
- package/dist/chunk-VQ3WFG4Y.cjs.map +0 -1
package/dist/index.default.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VariantId, R as ResolutionReason, D as DatafileInput, S as StreamOptions, P as PollingOptions, W as WaitUntil, 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, W as WaitUntil, 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-1OK52NNi.cjs';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-1OK52NNi.cjs';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -17,6 +17,8 @@ type BundledDefinitionsLookup = {
|
|
|
17
17
|
};
|
|
18
18
|
interface Auth {
|
|
19
19
|
sdkKey?: string;
|
|
20
|
+
/** Set when reading another project's flags with this deployment's OIDC token. */
|
|
21
|
+
sourceProjectId?: string;
|
|
20
22
|
resolveToken(): Promise<string>;
|
|
21
23
|
resolveBundledDefinitionsLookup(): Promise<BundledDefinitionsLookup>;
|
|
22
24
|
}
|
|
@@ -49,20 +51,6 @@ type ControllerOptions = {
|
|
|
49
51
|
* @default true
|
|
50
52
|
*/
|
|
51
53
|
polling?: boolean | PollingOptions;
|
|
52
|
-
/**
|
|
53
|
-
* Use request version headers instead of streaming or polling at runtime.
|
|
54
|
-
* Initialization starts no network activity; reads fetch only when needed.
|
|
55
|
-
* Disabling both stream and polling still selects offline mode.
|
|
56
|
-
* @default process.env.VERCEL === '1'
|
|
57
|
-
*/
|
|
58
|
-
vercel?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* How long header-driven reads may serve cached data while refreshing in the
|
|
61
|
-
* background, measured from its last fetch or matching version header.
|
|
62
|
-
* Must be a finite, non-negative number. Set to 0 to always block on refresh.
|
|
63
|
-
* @default 10000
|
|
64
|
-
*/
|
|
65
|
-
staleWhileRevalidateMs?: number;
|
|
66
54
|
/**
|
|
67
55
|
* Override build step detection
|
|
68
56
|
* - `true`: Treat as build step (use datafile/bundled only, no network)
|
|
@@ -118,15 +106,6 @@ type ControllerOptions = {
|
|
|
118
106
|
* - Uses polling exclusively
|
|
119
107
|
* - Same fallback chains as streaming mode
|
|
120
108
|
*
|
|
121
|
-
* **Runtime — Vercel mode** (vercel enabled, with stream or polling enabled)
|
|
122
|
-
* - Initialization loads provided/bundled data; no streaming or polling
|
|
123
|
-
* - Missing headers serve cached data, fetching only when empty
|
|
124
|
-
* - Uses the header value to determine if the current data is fresh
|
|
125
|
-
* - A matching header confirms the cached version's freshness
|
|
126
|
-
* - For newer headers, revalidates in the background within staleWhileRevalidateMs
|
|
127
|
-
* of the latest successful fetch or matching header; otherwise blocks
|
|
128
|
-
* - Bundled/provided data preserves fetchedAt, or has unknown freshness without it
|
|
129
|
-
*
|
|
130
109
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
131
110
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
132
111
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -140,7 +119,6 @@ declare class Controller implements ControllerInterface {
|
|
|
140
119
|
private streamSource;
|
|
141
120
|
private pollingSource;
|
|
142
121
|
private bundledSource;
|
|
143
|
-
private headerSource;
|
|
144
122
|
private usageTracker;
|
|
145
123
|
private isFirstGetData;
|
|
146
124
|
private buildDataPromise;
|
|
@@ -153,7 +131,6 @@ declare class Controller implements ControllerInterface {
|
|
|
153
131
|
private onStreamDisconnected;
|
|
154
132
|
private onPollData;
|
|
155
133
|
private onPollError;
|
|
156
|
-
private onFetchedData;
|
|
157
134
|
private wireSourceEvents;
|
|
158
135
|
private unwireSourceEvents;
|
|
159
136
|
private transition;
|
|
@@ -165,7 +142,6 @@ declare class Controller implements ControllerInterface {
|
|
|
165
142
|
* Build step: datafile → bundled → one-time fetch
|
|
166
143
|
* Streaming mode: stream → datafile → bundled
|
|
167
144
|
* Polling mode (no stream): poll → datafile → bundled
|
|
168
|
-
* Vercel mode: datafile → bundled; fetch only on a read
|
|
169
145
|
* Offline mode (neither): datafile → bundled → one-time fetch
|
|
170
146
|
*/
|
|
171
147
|
initialize(): Promise<void>;
|
|
@@ -208,6 +184,7 @@ declare class Controller implements ControllerInterface {
|
|
|
208
184
|
* Only used when streaming is disabled and polling is the primary source.
|
|
209
185
|
*/
|
|
210
186
|
private tryInitializePolling;
|
|
187
|
+
private noteUnauthorized;
|
|
211
188
|
/**
|
|
212
189
|
* Initializes data for build step environments.
|
|
213
190
|
*/
|
|
@@ -226,6 +203,11 @@ declare class Controller implements ControllerInterface {
|
|
|
226
203
|
* Shared fallback chain used by both initialize() and resolveData().
|
|
227
204
|
*/
|
|
228
205
|
private initializeFromFallbacks;
|
|
206
|
+
/**
|
|
207
|
+
* `detail` continues the sentence "No flag definitions available", so it
|
|
208
|
+
* starts with either "." or " during build.".
|
|
209
|
+
*/
|
|
210
|
+
private noDefinitionsError;
|
|
229
211
|
/**
|
|
230
212
|
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
231
213
|
* Streaming mode: stream → datafile → bundled.
|
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, W as WaitUntil, 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, W as WaitUntil, 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-1OK52NNi.js';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-1OK52NNi.js';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -17,6 +17,8 @@ type BundledDefinitionsLookup = {
|
|
|
17
17
|
};
|
|
18
18
|
interface Auth {
|
|
19
19
|
sdkKey?: string;
|
|
20
|
+
/** Set when reading another project's flags with this deployment's OIDC token. */
|
|
21
|
+
sourceProjectId?: string;
|
|
20
22
|
resolveToken(): Promise<string>;
|
|
21
23
|
resolveBundledDefinitionsLookup(): Promise<BundledDefinitionsLookup>;
|
|
22
24
|
}
|
|
@@ -49,20 +51,6 @@ type ControllerOptions = {
|
|
|
49
51
|
* @default true
|
|
50
52
|
*/
|
|
51
53
|
polling?: boolean | PollingOptions;
|
|
52
|
-
/**
|
|
53
|
-
* Use request version headers instead of streaming or polling at runtime.
|
|
54
|
-
* Initialization starts no network activity; reads fetch only when needed.
|
|
55
|
-
* Disabling both stream and polling still selects offline mode.
|
|
56
|
-
* @default process.env.VERCEL === '1'
|
|
57
|
-
*/
|
|
58
|
-
vercel?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* How long header-driven reads may serve cached data while refreshing in the
|
|
61
|
-
* background, measured from its last fetch or matching version header.
|
|
62
|
-
* Must be a finite, non-negative number. Set to 0 to always block on refresh.
|
|
63
|
-
* @default 10000
|
|
64
|
-
*/
|
|
65
|
-
staleWhileRevalidateMs?: number;
|
|
66
54
|
/**
|
|
67
55
|
* Override build step detection
|
|
68
56
|
* - `true`: Treat as build step (use datafile/bundled only, no network)
|
|
@@ -118,15 +106,6 @@ type ControllerOptions = {
|
|
|
118
106
|
* - Uses polling exclusively
|
|
119
107
|
* - Same fallback chains as streaming mode
|
|
120
108
|
*
|
|
121
|
-
* **Runtime — Vercel mode** (vercel enabled, with stream or polling enabled)
|
|
122
|
-
* - Initialization loads provided/bundled data; no streaming or polling
|
|
123
|
-
* - Missing headers serve cached data, fetching only when empty
|
|
124
|
-
* - Uses the header value to determine if the current data is fresh
|
|
125
|
-
* - A matching header confirms the cached version's freshness
|
|
126
|
-
* - For newer headers, revalidates in the background within staleWhileRevalidateMs
|
|
127
|
-
* of the latest successful fetch or matching header; otherwise blocks
|
|
128
|
-
* - Bundled/provided data preserves fetchedAt, or has unknown freshness without it
|
|
129
|
-
*
|
|
130
109
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
131
110
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
132
111
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -140,7 +119,6 @@ declare class Controller implements ControllerInterface {
|
|
|
140
119
|
private streamSource;
|
|
141
120
|
private pollingSource;
|
|
142
121
|
private bundledSource;
|
|
143
|
-
private headerSource;
|
|
144
122
|
private usageTracker;
|
|
145
123
|
private isFirstGetData;
|
|
146
124
|
private buildDataPromise;
|
|
@@ -153,7 +131,6 @@ declare class Controller implements ControllerInterface {
|
|
|
153
131
|
private onStreamDisconnected;
|
|
154
132
|
private onPollData;
|
|
155
133
|
private onPollError;
|
|
156
|
-
private onFetchedData;
|
|
157
134
|
private wireSourceEvents;
|
|
158
135
|
private unwireSourceEvents;
|
|
159
136
|
private transition;
|
|
@@ -165,7 +142,6 @@ declare class Controller implements ControllerInterface {
|
|
|
165
142
|
* Build step: datafile → bundled → one-time fetch
|
|
166
143
|
* Streaming mode: stream → datafile → bundled
|
|
167
144
|
* Polling mode (no stream): poll → datafile → bundled
|
|
168
|
-
* Vercel mode: datafile → bundled; fetch only on a read
|
|
169
145
|
* Offline mode (neither): datafile → bundled → one-time fetch
|
|
170
146
|
*/
|
|
171
147
|
initialize(): Promise<void>;
|
|
@@ -208,6 +184,7 @@ declare class Controller implements ControllerInterface {
|
|
|
208
184
|
* Only used when streaming is disabled and polling is the primary source.
|
|
209
185
|
*/
|
|
210
186
|
private tryInitializePolling;
|
|
187
|
+
private noteUnauthorized;
|
|
211
188
|
/**
|
|
212
189
|
* Initializes data for build step environments.
|
|
213
190
|
*/
|
|
@@ -226,6 +203,11 @@ declare class Controller implements ControllerInterface {
|
|
|
226
203
|
* Shared fallback chain used by both initialize() and resolveData().
|
|
227
204
|
*/
|
|
228
205
|
private initializeFromFallbacks;
|
|
206
|
+
/**
|
|
207
|
+
* `detail` continues the sentence "No flag definitions available", so it
|
|
208
|
+
* starts with either "." or " during build.".
|
|
209
|
+
*/
|
|
210
|
+
private noDefinitionsError;
|
|
229
211
|
/**
|
|
230
212
|
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
231
213
|
* Streaming mode: stream → datafile → bundled.
|
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 _chunkW742GGZUcjs = require('./chunk-W742GGZU.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -18,5 +18,5 @@ var _chunkVQ3WFG4Ycjs = require('./chunk-VQ3WFG4Y.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
exports.Controller =
|
|
21
|
+
exports.Controller = _chunkW742GGZUcjs.Controller; exports.FallbackEntryNotFoundError = _chunkW742GGZUcjs.FallbackEntryNotFoundError; exports.FallbackNotFoundError = _chunkW742GGZUcjs.FallbackNotFoundError; exports.FlagNetworkDataSource = _chunkW742GGZUcjs.Controller; exports.Reason = _chunkW742GGZUcjs.ResolutionReason; exports.createClient = _chunkW742GGZUcjs.createClient; exports.evaluate = _chunkW742GGZUcjs.evaluate; exports.flagsClient = _chunkW742GGZUcjs.flagsClient; exports.resetDefaultFlagsClient = _chunkW742GGZUcjs.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, W as WaitUntil, 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, W as WaitUntil, 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-1OK52NNi.cjs';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-1OK52NNi.cjs';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -17,6 +17,8 @@ type BundledDefinitionsLookup = {
|
|
|
17
17
|
};
|
|
18
18
|
interface Auth {
|
|
19
19
|
sdkKey?: string;
|
|
20
|
+
/** Set when reading another project's flags with this deployment's OIDC token. */
|
|
21
|
+
sourceProjectId?: string;
|
|
20
22
|
resolveToken(): Promise<string>;
|
|
21
23
|
resolveBundledDefinitionsLookup(): Promise<BundledDefinitionsLookup>;
|
|
22
24
|
}
|
|
@@ -49,20 +51,6 @@ type ControllerOptions = {
|
|
|
49
51
|
* @default true
|
|
50
52
|
*/
|
|
51
53
|
polling?: boolean | PollingOptions;
|
|
52
|
-
/**
|
|
53
|
-
* Use request version headers instead of streaming or polling at runtime.
|
|
54
|
-
* Initialization starts no network activity; reads fetch only when needed.
|
|
55
|
-
* Disabling both stream and polling still selects offline mode.
|
|
56
|
-
* @default process.env.VERCEL === '1'
|
|
57
|
-
*/
|
|
58
|
-
vercel?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* How long header-driven reads may serve cached data while refreshing in the
|
|
61
|
-
* background, measured from its last fetch or matching version header.
|
|
62
|
-
* Must be a finite, non-negative number. Set to 0 to always block on refresh.
|
|
63
|
-
* @default 10000
|
|
64
|
-
*/
|
|
65
|
-
staleWhileRevalidateMs?: number;
|
|
66
54
|
/**
|
|
67
55
|
* Override build step detection
|
|
68
56
|
* - `true`: Treat as build step (use datafile/bundled only, no network)
|
|
@@ -118,15 +106,6 @@ type ControllerOptions = {
|
|
|
118
106
|
* - Uses polling exclusively
|
|
119
107
|
* - Same fallback chains as streaming mode
|
|
120
108
|
*
|
|
121
|
-
* **Runtime — Vercel mode** (vercel enabled, with stream or polling enabled)
|
|
122
|
-
* - Initialization loads provided/bundled data; no streaming or polling
|
|
123
|
-
* - Missing headers serve cached data, fetching only when empty
|
|
124
|
-
* - Uses the header value to determine if the current data is fresh
|
|
125
|
-
* - A matching header confirms the cached version's freshness
|
|
126
|
-
* - For newer headers, revalidates in the background within staleWhileRevalidateMs
|
|
127
|
-
* of the latest successful fetch or matching header; otherwise blocks
|
|
128
|
-
* - Bundled/provided data preserves fetchedAt, or has unknown freshness without it
|
|
129
|
-
*
|
|
130
109
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
131
110
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
132
111
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -140,7 +119,6 @@ declare class Controller implements ControllerInterface {
|
|
|
140
119
|
private streamSource;
|
|
141
120
|
private pollingSource;
|
|
142
121
|
private bundledSource;
|
|
143
|
-
private headerSource;
|
|
144
122
|
private usageTracker;
|
|
145
123
|
private isFirstGetData;
|
|
146
124
|
private buildDataPromise;
|
|
@@ -153,7 +131,6 @@ declare class Controller implements ControllerInterface {
|
|
|
153
131
|
private onStreamDisconnected;
|
|
154
132
|
private onPollData;
|
|
155
133
|
private onPollError;
|
|
156
|
-
private onFetchedData;
|
|
157
134
|
private wireSourceEvents;
|
|
158
135
|
private unwireSourceEvents;
|
|
159
136
|
private transition;
|
|
@@ -165,7 +142,6 @@ declare class Controller implements ControllerInterface {
|
|
|
165
142
|
* Build step: datafile → bundled → one-time fetch
|
|
166
143
|
* Streaming mode: stream → datafile → bundled
|
|
167
144
|
* Polling mode (no stream): poll → datafile → bundled
|
|
168
|
-
* Vercel mode: datafile → bundled; fetch only on a read
|
|
169
145
|
* Offline mode (neither): datafile → bundled → one-time fetch
|
|
170
146
|
*/
|
|
171
147
|
initialize(): Promise<void>;
|
|
@@ -208,6 +184,7 @@ declare class Controller implements ControllerInterface {
|
|
|
208
184
|
* Only used when streaming is disabled and polling is the primary source.
|
|
209
185
|
*/
|
|
210
186
|
private tryInitializePolling;
|
|
187
|
+
private noteUnauthorized;
|
|
211
188
|
/**
|
|
212
189
|
* Initializes data for build step environments.
|
|
213
190
|
*/
|
|
@@ -226,6 +203,11 @@ declare class Controller implements ControllerInterface {
|
|
|
226
203
|
* Shared fallback chain used by both initialize() and resolveData().
|
|
227
204
|
*/
|
|
228
205
|
private initializeFromFallbacks;
|
|
206
|
+
/**
|
|
207
|
+
* `detail` continues the sentence "No flag definitions available", so it
|
|
208
|
+
* starts with either "." or " during build.".
|
|
209
|
+
*/
|
|
210
|
+
private noDefinitionsError;
|
|
229
211
|
/**
|
|
230
212
|
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
231
213
|
* Streaming mode: stream → datafile → bundled.
|
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, W as WaitUntil, 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, W as WaitUntil, 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-1OK52NNi.js';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-1OK52NNi.js';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -17,6 +17,8 @@ type BundledDefinitionsLookup = {
|
|
|
17
17
|
};
|
|
18
18
|
interface Auth {
|
|
19
19
|
sdkKey?: string;
|
|
20
|
+
/** Set when reading another project's flags with this deployment's OIDC token. */
|
|
21
|
+
sourceProjectId?: string;
|
|
20
22
|
resolveToken(): Promise<string>;
|
|
21
23
|
resolveBundledDefinitionsLookup(): Promise<BundledDefinitionsLookup>;
|
|
22
24
|
}
|
|
@@ -49,20 +51,6 @@ type ControllerOptions = {
|
|
|
49
51
|
* @default true
|
|
50
52
|
*/
|
|
51
53
|
polling?: boolean | PollingOptions;
|
|
52
|
-
/**
|
|
53
|
-
* Use request version headers instead of streaming or polling at runtime.
|
|
54
|
-
* Initialization starts no network activity; reads fetch only when needed.
|
|
55
|
-
* Disabling both stream and polling still selects offline mode.
|
|
56
|
-
* @default process.env.VERCEL === '1'
|
|
57
|
-
*/
|
|
58
|
-
vercel?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* How long header-driven reads may serve cached data while refreshing in the
|
|
61
|
-
* background, measured from its last fetch or matching version header.
|
|
62
|
-
* Must be a finite, non-negative number. Set to 0 to always block on refresh.
|
|
63
|
-
* @default 10000
|
|
64
|
-
*/
|
|
65
|
-
staleWhileRevalidateMs?: number;
|
|
66
54
|
/**
|
|
67
55
|
* Override build step detection
|
|
68
56
|
* - `true`: Treat as build step (use datafile/bundled only, no network)
|
|
@@ -118,15 +106,6 @@ type ControllerOptions = {
|
|
|
118
106
|
* - Uses polling exclusively
|
|
119
107
|
* - Same fallback chains as streaming mode
|
|
120
108
|
*
|
|
121
|
-
* **Runtime — Vercel mode** (vercel enabled, with stream or polling enabled)
|
|
122
|
-
* - Initialization loads provided/bundled data; no streaming or polling
|
|
123
|
-
* - Missing headers serve cached data, fetching only when empty
|
|
124
|
-
* - Uses the header value to determine if the current data is fresh
|
|
125
|
-
* - A matching header confirms the cached version's freshness
|
|
126
|
-
* - For newer headers, revalidates in the background within staleWhileRevalidateMs
|
|
127
|
-
* of the latest successful fetch or matching header; otherwise blocks
|
|
128
|
-
* - Bundled/provided data preserves fetchedAt, or has unknown freshness without it
|
|
129
|
-
*
|
|
130
109
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
131
110
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
132
111
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -140,7 +119,6 @@ declare class Controller implements ControllerInterface {
|
|
|
140
119
|
private streamSource;
|
|
141
120
|
private pollingSource;
|
|
142
121
|
private bundledSource;
|
|
143
|
-
private headerSource;
|
|
144
122
|
private usageTracker;
|
|
145
123
|
private isFirstGetData;
|
|
146
124
|
private buildDataPromise;
|
|
@@ -153,7 +131,6 @@ declare class Controller implements ControllerInterface {
|
|
|
153
131
|
private onStreamDisconnected;
|
|
154
132
|
private onPollData;
|
|
155
133
|
private onPollError;
|
|
156
|
-
private onFetchedData;
|
|
157
134
|
private wireSourceEvents;
|
|
158
135
|
private unwireSourceEvents;
|
|
159
136
|
private transition;
|
|
@@ -165,7 +142,6 @@ declare class Controller implements ControllerInterface {
|
|
|
165
142
|
* Build step: datafile → bundled → one-time fetch
|
|
166
143
|
* Streaming mode: stream → datafile → bundled
|
|
167
144
|
* Polling mode (no stream): poll → datafile → bundled
|
|
168
|
-
* Vercel mode: datafile → bundled; fetch only on a read
|
|
169
145
|
* Offline mode (neither): datafile → bundled → one-time fetch
|
|
170
146
|
*/
|
|
171
147
|
initialize(): Promise<void>;
|
|
@@ -208,6 +184,7 @@ declare class Controller implements ControllerInterface {
|
|
|
208
184
|
* Only used when streaming is disabled and polling is the primary source.
|
|
209
185
|
*/
|
|
210
186
|
private tryInitializePolling;
|
|
187
|
+
private noteUnauthorized;
|
|
211
188
|
/**
|
|
212
189
|
* Initializes data for build step environments.
|
|
213
190
|
*/
|
|
@@ -226,6 +203,11 @@ declare class Controller implements ControllerInterface {
|
|
|
226
203
|
* Shared fallback chain used by both initialize() and resolveData().
|
|
227
204
|
*/
|
|
228
205
|
private initializeFromFallbacks;
|
|
206
|
+
/**
|
|
207
|
+
* `detail` continues the sentence "No flag definitions available", so it
|
|
208
|
+
* starts with either "." or " during build.".
|
|
209
|
+
*/
|
|
210
|
+
private noDefinitionsError;
|
|
229
211
|
/**
|
|
230
212
|
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
231
213
|
* Streaming mode: stream → datafile → bundled.
|
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 _chunkPGKH4XQ7cjs = require('./chunk-PGKH4XQ7.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(_chunkPGKH4XQ7cjs.createClient, _chunkPGKH4XQ7cjs.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 _chunkW742GGZUcjs = require('./chunk-W742GGZU.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(_chunkW742GGZUcjs.createClient, _chunkW742GGZUcjs.flagsClient);
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
exports.VercelProvider = VercelProvider;
|
|
@@ -31,12 +31,6 @@ type DatafileInput = Packed.Data & {
|
|
|
31
31
|
* Some older responses might return a string instead of a number. Both will be timestamps.
|
|
32
32
|
*/
|
|
33
33
|
configUpdatedAt?: number | string;
|
|
34
|
-
/**
|
|
35
|
-
* When this datafile was successfully fetched, as Unix epoch milliseconds.
|
|
36
|
-
* Preserved when bundled, serialized, or supplied to another client.
|
|
37
|
-
* Omit when the original fetch time is unknown; loading data does not reset it.
|
|
38
|
-
*/
|
|
39
|
-
fetchedAt?: number;
|
|
40
34
|
/** Version number of the data */
|
|
41
35
|
revision?: number;
|
|
42
36
|
};
|
|
@@ -67,7 +61,7 @@ type Metrics = {
|
|
|
67
61
|
/** Whether the stream is currently connected */
|
|
68
62
|
connectionState: 'connected' | 'disconnected';
|
|
69
63
|
/** The current operating mode of the client */
|
|
70
|
-
mode: 'streaming' | 'polling' | 'build' | '
|
|
64
|
+
mode: 'streaming' | 'polling' | 'build' | 'offline';
|
|
71
65
|
/** Time in ms for the pure flag evaluation logic (only present on EvaluationResult) */
|
|
72
66
|
evaluationMs?: number;
|
|
73
67
|
};
|
|
@@ -158,10 +152,12 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
158
152
|
/**
|
|
159
153
|
* Origin information for this client.
|
|
160
154
|
* sdkKey is only present when the client was explicitly created with one.
|
|
155
|
+
* projectId is only present when the client reads another project's flags.
|
|
161
156
|
*/
|
|
162
157
|
origin?: {
|
|
163
158
|
provider: string;
|
|
164
159
|
sdkKey?: string;
|
|
160
|
+
projectId?: string;
|
|
165
161
|
};
|
|
166
162
|
/**
|
|
167
163
|
* Evaluate a feature flag.
|
|
@@ -544,9 +540,15 @@ declare namespace Packed {
|
|
|
544
540
|
* 1_000 = 1%
|
|
545
541
|
* 100_000 = 100%
|
|
546
542
|
*
|
|
547
|
-
* Once all slots are exhausted,
|
|
543
|
+
* Once all slots are exhausted, serve finalPromille (100% by default).
|
|
548
544
|
*/
|
|
549
545
|
slots: [number, number][];
|
|
546
|
+
/**
|
|
547
|
+
* Traffic for rollToVariant after all slots are exhausted (0-100_000).
|
|
548
|
+
* Defaults to 100_000 (100%). For example, 50_000 ends at 50%.
|
|
549
|
+
* Before the start or when slots is empty, serve rollFromVariant.
|
|
550
|
+
*/
|
|
551
|
+
finalPromille?: number;
|
|
550
552
|
};
|
|
551
553
|
type experimental_ExperimentDefinition = {
|
|
552
554
|
/** Experiment identifier. */
|
|
@@ -31,12 +31,6 @@ type DatafileInput = Packed.Data & {
|
|
|
31
31
|
* Some older responses might return a string instead of a number. Both will be timestamps.
|
|
32
32
|
*/
|
|
33
33
|
configUpdatedAt?: number | string;
|
|
34
|
-
/**
|
|
35
|
-
* When this datafile was successfully fetched, as Unix epoch milliseconds.
|
|
36
|
-
* Preserved when bundled, serialized, or supplied to another client.
|
|
37
|
-
* Omit when the original fetch time is unknown; loading data does not reset it.
|
|
38
|
-
*/
|
|
39
|
-
fetchedAt?: number;
|
|
40
34
|
/** Version number of the data */
|
|
41
35
|
revision?: number;
|
|
42
36
|
};
|
|
@@ -67,7 +61,7 @@ type Metrics = {
|
|
|
67
61
|
/** Whether the stream is currently connected */
|
|
68
62
|
connectionState: 'connected' | 'disconnected';
|
|
69
63
|
/** The current operating mode of the client */
|
|
70
|
-
mode: 'streaming' | 'polling' | 'build' | '
|
|
64
|
+
mode: 'streaming' | 'polling' | 'build' | 'offline';
|
|
71
65
|
/** Time in ms for the pure flag evaluation logic (only present on EvaluationResult) */
|
|
72
66
|
evaluationMs?: number;
|
|
73
67
|
};
|
|
@@ -158,10 +152,12 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
158
152
|
/**
|
|
159
153
|
* Origin information for this client.
|
|
160
154
|
* sdkKey is only present when the client was explicitly created with one.
|
|
155
|
+
* projectId is only present when the client reads another project's flags.
|
|
161
156
|
*/
|
|
162
157
|
origin?: {
|
|
163
158
|
provider: string;
|
|
164
159
|
sdkKey?: string;
|
|
160
|
+
projectId?: string;
|
|
165
161
|
};
|
|
166
162
|
/**
|
|
167
163
|
* Evaluate a feature flag.
|
|
@@ -544,9 +540,15 @@ declare namespace Packed {
|
|
|
544
540
|
* 1_000 = 1%
|
|
545
541
|
* 100_000 = 100%
|
|
546
542
|
*
|
|
547
|
-
* Once all slots are exhausted,
|
|
543
|
+
* Once all slots are exhausted, serve finalPromille (100% by default).
|
|
548
544
|
*/
|
|
549
545
|
slots: [number, number][];
|
|
546
|
+
/**
|
|
547
|
+
* Traffic for rollToVariant after all slots are exhausted (0-100_000).
|
|
548
|
+
* Defaults to 100_000 (100%). For example, 50_000 ends at 50%.
|
|
549
|
+
* Before the start or when slots is empty, serve rollFromVariant.
|
|
550
|
+
*/
|
|
551
|
+
finalPromille?: number;
|
|
550
552
|
};
|
|
551
553
|
type experimental_ExperimentDefinition = {
|
|
552
554
|
/** Experiment identifier. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/flags-core",
|
|
3
|
-
"version": "1.9.0
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "A server-side client for Vercel Flags",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vercel",
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
"@vercel/functions": "^3.4.3",
|
|
69
69
|
"@vercel/oidc": "3.5.0",
|
|
70
70
|
"dequal": "2.0.3",
|
|
71
|
-
"jose": "5.
|
|
71
|
+
"jose": "^5.10.0",
|
|
72
72
|
"js-xxhash": "4.0.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@arethetypeswrong/cli": "0.18.2",
|
|
76
76
|
"@types/node": "22.14.0",
|
|
77
|
-
"next": "
|
|
77
|
+
"next": "16.3.6",
|
|
78
78
|
"tsup": "8.5.1",
|
|
79
|
-
"typescript": "5.
|
|
79
|
+
"typescript": "^5.9.3",
|
|
80
80
|
"vite": "8.1.5",
|
|
81
81
|
"vitest": "4.1.10"
|
|
82
82
|
},
|