@vercel/flags-core 1.9.0-da0b044-20260915081607 → 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 +27 -2
- package/README.md +0 -12
- package/dist/{chunk-KF4BZUWK.cjs → chunk-PGKH4XQ7.cjs} +424 -331
- package/dist/chunk-PGKH4XQ7.cjs.map +1 -0
- package/dist/{chunk-4MFMRMFV.js → chunk-SLNLPFKU.js} +384 -291
- package/dist/chunk-SLNLPFKU.js.map +1 -0
- package/dist/{chunk-P6CH6LXX.js → chunk-TDZBUVBG.js} +383 -291
- package/dist/chunk-TDZBUVBG.js.map +1 -0
- package/dist/{chunk-3OXPYLQR.cjs → chunk-W742GGZU.cjs} +422 -330
- package/dist/chunk-W742GGZU.cjs.map +1 -0
- package/dist/index.default.cjs +2 -2
- package/dist/index.default.d.cts +17 -10
- package/dist/index.default.d.ts +17 -10
- package/dist/index.default.js +1 -1
- package/dist/index.next-js.cjs +2 -2
- package/dist/index.next-js.d.cts +17 -10
- package/dist/index.next-js.d.ts +17 -10
- 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-w8u8i22D.d.cts → types-1OK52NNi.d.cts} +13 -3
- package/dist/{types-w8u8i22D.d.ts → types-1OK52NNi.d.ts} +13 -3
- package/package.json +4 -4
- package/dist/chunk-3OXPYLQR.cjs.map +0 -1
- package/dist/chunk-4MFMRMFV.js.map +0 -1
- package/dist/chunk-KF4BZUWK.cjs.map +0 -1
- package/dist/chunk-P6CH6LXX.js.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, 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
|
}
|
|
@@ -62,6 +64,12 @@ type ControllerOptions = {
|
|
|
62
64
|
* @default globalThis.fetch
|
|
63
65
|
*/
|
|
64
66
|
fetch?: typeof globalThis.fetch;
|
|
67
|
+
/**
|
|
68
|
+
* Custom function for keeping background work alive after a response has
|
|
69
|
+
* been sent.
|
|
70
|
+
* @default waitUntil from `@vercel/functions`
|
|
71
|
+
*/
|
|
72
|
+
waitUntil?: WaitUntil;
|
|
65
73
|
/**
|
|
66
74
|
* Environment included with evaluation metrics sent to the ingest endpoint.
|
|
67
75
|
* Falls back to the `VERCEL_ENV` environment variable when not set.
|
|
@@ -98,11 +106,6 @@ type ControllerOptions = {
|
|
|
98
106
|
* - Uses polling exclusively
|
|
99
107
|
* - Same fallback chains as streaming mode
|
|
100
108
|
*
|
|
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
|
-
*
|
|
106
109
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
107
110
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
108
111
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -116,7 +119,6 @@ declare class Controller implements ControllerInterface {
|
|
|
116
119
|
private streamSource;
|
|
117
120
|
private pollingSource;
|
|
118
121
|
private bundledSource;
|
|
119
|
-
private headerSource;
|
|
120
122
|
private usageTracker;
|
|
121
123
|
private isFirstGetData;
|
|
122
124
|
private buildDataPromise;
|
|
@@ -129,7 +131,6 @@ declare class Controller implements ControllerInterface {
|
|
|
129
131
|
private onStreamDisconnected;
|
|
130
132
|
private onPollData;
|
|
131
133
|
private onPollError;
|
|
132
|
-
private onFetchedData;
|
|
133
134
|
private wireSourceEvents;
|
|
134
135
|
private unwireSourceEvents;
|
|
135
136
|
private transition;
|
|
@@ -183,6 +184,7 @@ declare class Controller implements ControllerInterface {
|
|
|
183
184
|
* Only used when streaming is disabled and polling is the primary source.
|
|
184
185
|
*/
|
|
185
186
|
private tryInitializePolling;
|
|
187
|
+
private noteUnauthorized;
|
|
186
188
|
/**
|
|
187
189
|
* Initializes data for build step environments.
|
|
188
190
|
*/
|
|
@@ -201,6 +203,11 @@ declare class Controller implements ControllerInterface {
|
|
|
201
203
|
* Shared fallback chain used by both initialize() and resolveData().
|
|
202
204
|
*/
|
|
203
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;
|
|
204
211
|
/**
|
|
205
212
|
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
206
213
|
* Streaming mode: stream → datafile → bundled.
|
|
@@ -300,4 +307,4 @@ createClient: {
|
|
|
300
307
|
<Entities = Record<string, unknown>>(sdkKeyOrConnectionString?: string, options?: CreateClientOptions<Entities>): FlagsClient<Entities>;
|
|
301
308
|
};
|
|
302
309
|
|
|
303
|
-
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, ResolutionReason as Reason, StreamOptions, createClient, evaluate, experimental_ReportExposures, flagsClient, resetDefaultFlagsClient };
|
|
310
|
+
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, ResolutionReason as Reason, StreamOptions, WaitUntil, createClient, evaluate, experimental_ReportExposures, flagsClient, resetDefaultFlagsClient };
|
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, 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
|
}
|
|
@@ -62,6 +64,12 @@ type ControllerOptions = {
|
|
|
62
64
|
* @default globalThis.fetch
|
|
63
65
|
*/
|
|
64
66
|
fetch?: typeof globalThis.fetch;
|
|
67
|
+
/**
|
|
68
|
+
* Custom function for keeping background work alive after a response has
|
|
69
|
+
* been sent.
|
|
70
|
+
* @default waitUntil from `@vercel/functions`
|
|
71
|
+
*/
|
|
72
|
+
waitUntil?: WaitUntil;
|
|
65
73
|
/**
|
|
66
74
|
* Environment included with evaluation metrics sent to the ingest endpoint.
|
|
67
75
|
* Falls back to the `VERCEL_ENV` environment variable when not set.
|
|
@@ -98,11 +106,6 @@ type ControllerOptions = {
|
|
|
98
106
|
* - Uses polling exclusively
|
|
99
107
|
* - Same fallback chains as streaming mode
|
|
100
108
|
*
|
|
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
|
-
*
|
|
106
109
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
107
110
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
108
111
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -116,7 +119,6 @@ declare class Controller implements ControllerInterface {
|
|
|
116
119
|
private streamSource;
|
|
117
120
|
private pollingSource;
|
|
118
121
|
private bundledSource;
|
|
119
|
-
private headerSource;
|
|
120
122
|
private usageTracker;
|
|
121
123
|
private isFirstGetData;
|
|
122
124
|
private buildDataPromise;
|
|
@@ -129,7 +131,6 @@ declare class Controller implements ControllerInterface {
|
|
|
129
131
|
private onStreamDisconnected;
|
|
130
132
|
private onPollData;
|
|
131
133
|
private onPollError;
|
|
132
|
-
private onFetchedData;
|
|
133
134
|
private wireSourceEvents;
|
|
134
135
|
private unwireSourceEvents;
|
|
135
136
|
private transition;
|
|
@@ -183,6 +184,7 @@ declare class Controller implements ControllerInterface {
|
|
|
183
184
|
* Only used when streaming is disabled and polling is the primary source.
|
|
184
185
|
*/
|
|
185
186
|
private tryInitializePolling;
|
|
187
|
+
private noteUnauthorized;
|
|
186
188
|
/**
|
|
187
189
|
* Initializes data for build step environments.
|
|
188
190
|
*/
|
|
@@ -201,6 +203,11 @@ declare class Controller implements ControllerInterface {
|
|
|
201
203
|
* Shared fallback chain used by both initialize() and resolveData().
|
|
202
204
|
*/
|
|
203
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;
|
|
204
211
|
/**
|
|
205
212
|
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
206
213
|
* Streaming mode: stream → datafile → bundled.
|
|
@@ -300,4 +307,4 @@ createClient: {
|
|
|
300
307
|
<Entities = Record<string, unknown>>(sdkKeyOrConnectionString?: string, options?: CreateClientOptions<Entities>): FlagsClient<Entities>;
|
|
301
308
|
};
|
|
302
309
|
|
|
303
|
-
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, ResolutionReason as Reason, StreamOptions, createClient, evaluate, experimental_ReportExposures, flagsClient, resetDefaultFlagsClient };
|
|
310
|
+
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, ResolutionReason as Reason, StreamOptions, WaitUntil, createClient, evaluate, experimental_ReportExposures, flagsClient, resetDefaultFlagsClient };
|
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 _chunk3OXPYLQRcjs = require('./chunk-3OXPYLQR.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, 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
|
}
|
|
@@ -62,6 +64,12 @@ type ControllerOptions = {
|
|
|
62
64
|
* @default globalThis.fetch
|
|
63
65
|
*/
|
|
64
66
|
fetch?: typeof globalThis.fetch;
|
|
67
|
+
/**
|
|
68
|
+
* Custom function for keeping background work alive after a response has
|
|
69
|
+
* been sent.
|
|
70
|
+
* @default waitUntil from `@vercel/functions`
|
|
71
|
+
*/
|
|
72
|
+
waitUntil?: WaitUntil;
|
|
65
73
|
/**
|
|
66
74
|
* Environment included with evaluation metrics sent to the ingest endpoint.
|
|
67
75
|
* Falls back to the `VERCEL_ENV` environment variable when not set.
|
|
@@ -98,11 +106,6 @@ type ControllerOptions = {
|
|
|
98
106
|
* - Uses polling exclusively
|
|
99
107
|
* - Same fallback chains as streaming mode
|
|
100
108
|
*
|
|
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
|
-
*
|
|
106
109
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
107
110
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
108
111
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -116,7 +119,6 @@ declare class Controller implements ControllerInterface {
|
|
|
116
119
|
private streamSource;
|
|
117
120
|
private pollingSource;
|
|
118
121
|
private bundledSource;
|
|
119
|
-
private headerSource;
|
|
120
122
|
private usageTracker;
|
|
121
123
|
private isFirstGetData;
|
|
122
124
|
private buildDataPromise;
|
|
@@ -129,7 +131,6 @@ declare class Controller implements ControllerInterface {
|
|
|
129
131
|
private onStreamDisconnected;
|
|
130
132
|
private onPollData;
|
|
131
133
|
private onPollError;
|
|
132
|
-
private onFetchedData;
|
|
133
134
|
private wireSourceEvents;
|
|
134
135
|
private unwireSourceEvents;
|
|
135
136
|
private transition;
|
|
@@ -183,6 +184,7 @@ declare class Controller implements ControllerInterface {
|
|
|
183
184
|
* Only used when streaming is disabled and polling is the primary source.
|
|
184
185
|
*/
|
|
185
186
|
private tryInitializePolling;
|
|
187
|
+
private noteUnauthorized;
|
|
186
188
|
/**
|
|
187
189
|
* Initializes data for build step environments.
|
|
188
190
|
*/
|
|
@@ -201,6 +203,11 @@ declare class Controller implements ControllerInterface {
|
|
|
201
203
|
* Shared fallback chain used by both initialize() and resolveData().
|
|
202
204
|
*/
|
|
203
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;
|
|
204
211
|
/**
|
|
205
212
|
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
206
213
|
* Streaming mode: stream → datafile → bundled.
|
|
@@ -287,4 +294,4 @@ declare const createClient: {
|
|
|
287
294
|
<Entities = Record<string, unknown>>(sdkKeyOrConnectionString?: string, options?: CreateClientOptions<Entities>): FlagsClient<Entities>;
|
|
288
295
|
};
|
|
289
296
|
|
|
290
|
-
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, ResolutionReason as Reason, StreamOptions, createClient, evaluate, experimental_ReportExposures, flagsClient, resetDefaultFlagsClient };
|
|
297
|
+
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, ResolutionReason as Reason, StreamOptions, WaitUntil, createClient, evaluate, experimental_ReportExposures, flagsClient, resetDefaultFlagsClient };
|
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, 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
|
}
|
|
@@ -62,6 +64,12 @@ type ControllerOptions = {
|
|
|
62
64
|
* @default globalThis.fetch
|
|
63
65
|
*/
|
|
64
66
|
fetch?: typeof globalThis.fetch;
|
|
67
|
+
/**
|
|
68
|
+
* Custom function for keeping background work alive after a response has
|
|
69
|
+
* been sent.
|
|
70
|
+
* @default waitUntil from `@vercel/functions`
|
|
71
|
+
*/
|
|
72
|
+
waitUntil?: WaitUntil;
|
|
65
73
|
/**
|
|
66
74
|
* Environment included with evaluation metrics sent to the ingest endpoint.
|
|
67
75
|
* Falls back to the `VERCEL_ENV` environment variable when not set.
|
|
@@ -98,11 +106,6 @@ type ControllerOptions = {
|
|
|
98
106
|
* - Uses polling exclusively
|
|
99
107
|
* - Same fallback chains as streaming mode
|
|
100
108
|
*
|
|
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
|
-
*
|
|
106
109
|
* **Runtime — offline mode** (neither stream nor polling):
|
|
107
110
|
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
108
111
|
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
@@ -116,7 +119,6 @@ declare class Controller implements ControllerInterface {
|
|
|
116
119
|
private streamSource;
|
|
117
120
|
private pollingSource;
|
|
118
121
|
private bundledSource;
|
|
119
|
-
private headerSource;
|
|
120
122
|
private usageTracker;
|
|
121
123
|
private isFirstGetData;
|
|
122
124
|
private buildDataPromise;
|
|
@@ -129,7 +131,6 @@ declare class Controller implements ControllerInterface {
|
|
|
129
131
|
private onStreamDisconnected;
|
|
130
132
|
private onPollData;
|
|
131
133
|
private onPollError;
|
|
132
|
-
private onFetchedData;
|
|
133
134
|
private wireSourceEvents;
|
|
134
135
|
private unwireSourceEvents;
|
|
135
136
|
private transition;
|
|
@@ -183,6 +184,7 @@ declare class Controller implements ControllerInterface {
|
|
|
183
184
|
* Only used when streaming is disabled and polling is the primary source.
|
|
184
185
|
*/
|
|
185
186
|
private tryInitializePolling;
|
|
187
|
+
private noteUnauthorized;
|
|
186
188
|
/**
|
|
187
189
|
* Initializes data for build step environments.
|
|
188
190
|
*/
|
|
@@ -201,6 +203,11 @@ declare class Controller implements ControllerInterface {
|
|
|
201
203
|
* Shared fallback chain used by both initialize() and resolveData().
|
|
202
204
|
*/
|
|
203
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;
|
|
204
211
|
/**
|
|
205
212
|
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
206
213
|
* Streaming mode: stream → datafile → bundled.
|
|
@@ -287,4 +294,4 @@ declare const createClient: {
|
|
|
287
294
|
<Entities = Record<string, unknown>>(sdkKeyOrConnectionString?: string, options?: CreateClientOptions<Entities>): FlagsClient<Entities>;
|
|
288
295
|
};
|
|
289
296
|
|
|
290
|
-
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, ResolutionReason as Reason, StreamOptions, createClient, evaluate, experimental_ReportExposures, flagsClient, resetDefaultFlagsClient };
|
|
297
|
+
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, ResolutionReason as Reason, StreamOptions, WaitUntil, createClient, evaluate, experimental_ReportExposures, flagsClient, resetDefaultFlagsClient };
|
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;
|
|
@@ -15,6 +15,8 @@ type PollingOptions = {
|
|
|
15
15
|
/** Timeout in ms to wait for initial poll before falling back */
|
|
16
16
|
initTimeoutMs: number;
|
|
17
17
|
};
|
|
18
|
+
/** Keeps an asynchronous task alive after a response has been sent */
|
|
19
|
+
type WaitUntil = (promise: Promise<unknown>) => void;
|
|
18
20
|
/** Input type for creating a datafile (without metrics) */
|
|
19
21
|
type DatafileInput = Packed.Data & {
|
|
20
22
|
/**
|
|
@@ -59,7 +61,7 @@ type Metrics = {
|
|
|
59
61
|
/** Whether the stream is currently connected */
|
|
60
62
|
connectionState: 'connected' | 'disconnected';
|
|
61
63
|
/** The current operating mode of the client */
|
|
62
|
-
mode: 'streaming' | 'polling' | 'build' | '
|
|
64
|
+
mode: 'streaming' | 'polling' | 'build' | 'offline';
|
|
63
65
|
/** Time in ms for the pure flag evaluation logic (only present on EvaluationResult) */
|
|
64
66
|
evaluationMs?: number;
|
|
65
67
|
};
|
|
@@ -150,10 +152,12 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
150
152
|
/**
|
|
151
153
|
* Origin information for this client.
|
|
152
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.
|
|
153
156
|
*/
|
|
154
157
|
origin?: {
|
|
155
158
|
provider: string;
|
|
156
159
|
sdkKey?: string;
|
|
160
|
+
projectId?: string;
|
|
157
161
|
};
|
|
158
162
|
/**
|
|
159
163
|
* Evaluate a feature flag.
|
|
@@ -536,9 +540,15 @@ declare namespace Packed {
|
|
|
536
540
|
* 1_000 = 1%
|
|
537
541
|
* 100_000 = 100%
|
|
538
542
|
*
|
|
539
|
-
* Once all slots are exhausted,
|
|
543
|
+
* Once all slots are exhausted, serve finalPromille (100% by default).
|
|
540
544
|
*/
|
|
541
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;
|
|
542
552
|
};
|
|
543
553
|
type experimental_ExperimentDefinition = {
|
|
544
554
|
/** Experiment identifier. */
|
|
@@ -687,4 +697,4 @@ declare namespace Packed {
|
|
|
687
697
|
};
|
|
688
698
|
}
|
|
689
699
|
|
|
690
|
-
export { type BundledDefinitions as B, type ControllerInterface as C, type DatafileInput as D, type EvaluationParams as E, type FlagsClient as F, type MetricEnvironment as M, type PollingOptions as P, ResolutionReason as R, type StreamOptions as S, type VariantId as V, type Datafile as a, type EvaluationResult as b, Packed as c, type Value as d, type experimental_ReportExposures as e, type experimental_EvaluationOptions as f, type experimental_ExperimentAssignment as g, type experimental_Exposure as h };
|
|
700
|
+
export { type BundledDefinitions as B, type ControllerInterface as C, type DatafileInput as D, type EvaluationParams as E, type FlagsClient as F, type MetricEnvironment as M, type PollingOptions as P, ResolutionReason as R, type StreamOptions as S, type VariantId as V, type WaitUntil as W, type Datafile as a, type EvaluationResult as b, Packed as c, type Value as d, type experimental_ReportExposures as e, type experimental_EvaluationOptions as f, type experimental_ExperimentAssignment as g, type experimental_Exposure as h };
|
|
@@ -15,6 +15,8 @@ type PollingOptions = {
|
|
|
15
15
|
/** Timeout in ms to wait for initial poll before falling back */
|
|
16
16
|
initTimeoutMs: number;
|
|
17
17
|
};
|
|
18
|
+
/** Keeps an asynchronous task alive after a response has been sent */
|
|
19
|
+
type WaitUntil = (promise: Promise<unknown>) => void;
|
|
18
20
|
/** Input type for creating a datafile (without metrics) */
|
|
19
21
|
type DatafileInput = Packed.Data & {
|
|
20
22
|
/**
|
|
@@ -59,7 +61,7 @@ type Metrics = {
|
|
|
59
61
|
/** Whether the stream is currently connected */
|
|
60
62
|
connectionState: 'connected' | 'disconnected';
|
|
61
63
|
/** The current operating mode of the client */
|
|
62
|
-
mode: 'streaming' | 'polling' | 'build' | '
|
|
64
|
+
mode: 'streaming' | 'polling' | 'build' | 'offline';
|
|
63
65
|
/** Time in ms for the pure flag evaluation logic (only present on EvaluationResult) */
|
|
64
66
|
evaluationMs?: number;
|
|
65
67
|
};
|
|
@@ -150,10 +152,12 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
150
152
|
/**
|
|
151
153
|
* Origin information for this client.
|
|
152
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.
|
|
153
156
|
*/
|
|
154
157
|
origin?: {
|
|
155
158
|
provider: string;
|
|
156
159
|
sdkKey?: string;
|
|
160
|
+
projectId?: string;
|
|
157
161
|
};
|
|
158
162
|
/**
|
|
159
163
|
* Evaluate a feature flag.
|
|
@@ -536,9 +540,15 @@ declare namespace Packed {
|
|
|
536
540
|
* 1_000 = 1%
|
|
537
541
|
* 100_000 = 100%
|
|
538
542
|
*
|
|
539
|
-
* Once all slots are exhausted,
|
|
543
|
+
* Once all slots are exhausted, serve finalPromille (100% by default).
|
|
540
544
|
*/
|
|
541
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;
|
|
542
552
|
};
|
|
543
553
|
type experimental_ExperimentDefinition = {
|
|
544
554
|
/** Experiment identifier. */
|
|
@@ -687,4 +697,4 @@ declare namespace Packed {
|
|
|
687
697
|
};
|
|
688
698
|
}
|
|
689
699
|
|
|
690
|
-
export { type BundledDefinitions as B, type ControllerInterface as C, type DatafileInput as D, type EvaluationParams as E, type FlagsClient as F, type MetricEnvironment as M, type PollingOptions as P, ResolutionReason as R, type StreamOptions as S, type VariantId as V, type Datafile as a, type EvaluationResult as b, Packed as c, type Value as d, type experimental_ReportExposures as e, type experimental_EvaluationOptions as f, type experimental_ExperimentAssignment as g, type experimental_Exposure as h };
|
|
700
|
+
export { type BundledDefinitions as B, type ControllerInterface as C, type DatafileInput as D, type EvaluationParams as E, type FlagsClient as F, type MetricEnvironment as M, type PollingOptions as P, ResolutionReason as R, type StreamOptions as S, type VariantId as V, type WaitUntil as W, type Datafile as a, type EvaluationResult as b, Packed as c, type Value as d, type experimental_ReportExposures as e, type experimental_EvaluationOptions as f, type experimental_ExperimentAssignment as g, type experimental_Exposure as h };
|
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
|
},
|