@vercel/flags-core 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +14 -5
- package/dist/{chunk-CKL562EU.cjs → chunk-3WMSFQ2F.cjs} +142 -66
- package/dist/chunk-3WMSFQ2F.cjs.map +1 -0
- package/dist/{chunk-5BWCBI7I.js → chunk-AMDRNXFQ.js} +92 -15
- package/dist/chunk-AMDRNXFQ.js.map +1 -0
- package/dist/{chunk-DYSF37WV.js → chunk-KK44WKSW.js} +91 -15
- package/dist/chunk-KK44WKSW.js.map +1 -0
- package/dist/{chunk-CVDAHZHK.cjs → chunk-ODVYKYSM.cjs} +143 -66
- package/dist/chunk-ODVYKYSM.cjs.map +1 -0
- package/dist/index.default.cjs +2 -2
- package/dist/index.default.d.cts +9 -3
- package/dist/index.default.d.ts +9 -3
- package/dist/index.default.js +1 -1
- package/dist/index.next-js.cjs +2 -2
- package/dist/index.next-js.d.cts +9 -3
- package/dist/index.next-js.d.ts +9 -3
- 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-DLWRa9bG.d.cts} +17 -5
- package/dist/{types-CIONStRG.d.ts → types-DLWRa9bG.d.ts} +17 -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.next-js.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk3WMSFQ2Fcjs = require('./chunk-3WMSFQ2F.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 = _chunk3WMSFQ2Fcjs.Controller; exports.FallbackEntryNotFoundError = _chunk3WMSFQ2Fcjs.FallbackEntryNotFoundError; exports.FallbackNotFoundError = _chunk3WMSFQ2Fcjs.FallbackNotFoundError; exports.FlagNetworkDataSource = _chunk3WMSFQ2Fcjs.Controller; exports.Reason = _chunk3WMSFQ2Fcjs.ResolutionReason; exports.createClient = _chunk3WMSFQ2Fcjs.createClient; exports.evaluate = _chunk3WMSFQ2Fcjs.evaluate; exports.flagsClient = _chunk3WMSFQ2Fcjs.flagsClient; exports.resetDefaultFlagsClient = _chunk3WMSFQ2Fcjs.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-DLWRa9bG.cjs';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-DLWRa9bG.cjs';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -62,6 +62,12 @@ type ControllerOptions = {
|
|
|
62
62
|
* @default globalThis.fetch
|
|
63
63
|
*/
|
|
64
64
|
fetch?: typeof globalThis.fetch;
|
|
65
|
+
/**
|
|
66
|
+
* Custom function for keeping background work alive after a response has
|
|
67
|
+
* been sent.
|
|
68
|
+
* @default waitUntil from `@vercel/functions`
|
|
69
|
+
*/
|
|
70
|
+
waitUntil?: WaitUntil;
|
|
65
71
|
/**
|
|
66
72
|
* Environment included with evaluation metrics sent to the ingest endpoint.
|
|
67
73
|
* Falls back to the `VERCEL_ENV` environment variable when not set.
|
|
@@ -280,4 +286,4 @@ declare const createClient: {
|
|
|
280
286
|
<Entities = Record<string, unknown>>(sdkKeyOrConnectionString?: string, options?: CreateClientOptions<Entities>): FlagsClient<Entities>;
|
|
281
287
|
};
|
|
282
288
|
|
|
283
|
-
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 };
|
|
289
|
+
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-DLWRa9bG.js';
|
|
2
|
+
export { c as Packed, d as Value, f as experimental_EvaluationOptions, g as experimental_ExperimentAssignment, h as experimental_Exposure } from './types-DLWRa9bG.js';
|
|
3
3
|
|
|
4
4
|
interface TrackEvaluationOptions {
|
|
5
5
|
flagKey: string;
|
|
@@ -62,6 +62,12 @@ type ControllerOptions = {
|
|
|
62
62
|
* @default globalThis.fetch
|
|
63
63
|
*/
|
|
64
64
|
fetch?: typeof globalThis.fetch;
|
|
65
|
+
/**
|
|
66
|
+
* Custom function for keeping background work alive after a response has
|
|
67
|
+
* been sent.
|
|
68
|
+
* @default waitUntil from `@vercel/functions`
|
|
69
|
+
*/
|
|
70
|
+
waitUntil?: WaitUntil;
|
|
65
71
|
/**
|
|
66
72
|
* Environment included with evaluation metrics sent to the ingest endpoint.
|
|
67
73
|
* Falls back to the `VERCEL_ENV` environment variable when not set.
|
|
@@ -280,4 +286,4 @@ declare const createClient: {
|
|
|
280
286
|
<Entities = Record<string, unknown>>(sdkKeyOrConnectionString?: string, options?: CreateClientOptions<Entities>): FlagsClient<Entities>;
|
|
281
287
|
};
|
|
282
288
|
|
|
283
|
-
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 };
|
|
289
|
+
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 _chunkODVYKYSMcjs = require('./chunk-ODVYKYSM.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(_chunkODVYKYSMcjs.createClient, _chunkODVYKYSMcjs.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 _chunk3WMSFQ2Fcjs = require('./chunk-3WMSFQ2F.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(_chunk3WMSFQ2Fcjs.createClient, _chunk3WMSFQ2Fcjs.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
|
/**
|
|
@@ -156,9 +158,11 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
156
158
|
sdkKey?: string;
|
|
157
159
|
};
|
|
158
160
|
/**
|
|
159
|
-
* Evaluate a feature flag
|
|
161
|
+
* Evaluate a feature flag.
|
|
160
162
|
*
|
|
161
|
-
*
|
|
163
|
+
* Initializes the client automatically on first use. Initialization failures
|
|
164
|
+
* are caught so evaluation can try its fallback sources and defaultValue.
|
|
165
|
+
* With request-scoped Vercel OIDC, call this inside a request handler.
|
|
162
166
|
*
|
|
163
167
|
* @param flagKey
|
|
164
168
|
* @param defaultValue
|
|
@@ -173,7 +177,9 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
173
177
|
* Avoids the per-flag overhead of separate `evaluate()` invocations (in particular,
|
|
174
178
|
* the parallel promises and repeated datafile reads they would entail).
|
|
175
179
|
*
|
|
176
|
-
*
|
|
180
|
+
* Initializes the client automatically on first use. Initialization failures
|
|
181
|
+
* are caught so evaluation can try its fallback sources and default values.
|
|
182
|
+
* With request-scoped Vercel OIDC, call this inside a request handler.
|
|
177
183
|
*
|
|
178
184
|
* @param flags Array of `{ key, defaultValue? }` entries to evaluate.
|
|
179
185
|
* @param entities Shared entities used for every flag in the bulk call.
|
|
@@ -193,7 +199,13 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
193
199
|
entities?: E;
|
|
194
200
|
}) => Promise<void>;
|
|
195
201
|
/**
|
|
196
|
-
*
|
|
202
|
+
* Load flag definitions and set up subscriptions if needed.
|
|
203
|
+
*
|
|
204
|
+
* Optional: evaluate() and bulkEvaluate() initialize automatically. This method
|
|
205
|
+
* rejects if initialization fails, while evaluation can still try fallbacks.
|
|
206
|
+
* With request-scoped Vercel OIDC, call this inside a request handler, not at
|
|
207
|
+
* module scope. Creating the client at module scope is safe; starting and
|
|
208
|
+
* caching an initialization promise there can run before a token is available.
|
|
197
209
|
*/
|
|
198
210
|
initialize(): void | Promise<void>;
|
|
199
211
|
/**
|
|
@@ -677,4 +689,4 @@ declare namespace Packed {
|
|
|
677
689
|
};
|
|
678
690
|
}
|
|
679
691
|
|
|
680
|
-
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 };
|
|
692
|
+
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
|
/**
|
|
@@ -156,9 +158,11 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
156
158
|
sdkKey?: string;
|
|
157
159
|
};
|
|
158
160
|
/**
|
|
159
|
-
* Evaluate a feature flag
|
|
161
|
+
* Evaluate a feature flag.
|
|
160
162
|
*
|
|
161
|
-
*
|
|
163
|
+
* Initializes the client automatically on first use. Initialization failures
|
|
164
|
+
* are caught so evaluation can try its fallback sources and defaultValue.
|
|
165
|
+
* With request-scoped Vercel OIDC, call this inside a request handler.
|
|
162
166
|
*
|
|
163
167
|
* @param flagKey
|
|
164
168
|
* @param defaultValue
|
|
@@ -173,7 +177,9 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
173
177
|
* Avoids the per-flag overhead of separate `evaluate()` invocations (in particular,
|
|
174
178
|
* the parallel promises and repeated datafile reads they would entail).
|
|
175
179
|
*
|
|
176
|
-
*
|
|
180
|
+
* Initializes the client automatically on first use. Initialization failures
|
|
181
|
+
* are caught so evaluation can try its fallback sources and default values.
|
|
182
|
+
* With request-scoped Vercel OIDC, call this inside a request handler.
|
|
177
183
|
*
|
|
178
184
|
* @param flags Array of `{ key, defaultValue? }` entries to evaluate.
|
|
179
185
|
* @param entities Shared entities used for every flag in the bulk call.
|
|
@@ -193,7 +199,13 @@ type FlagsClient<Entities = Record<string, unknown>> = {
|
|
|
193
199
|
entities?: E;
|
|
194
200
|
}) => Promise<void>;
|
|
195
201
|
/**
|
|
196
|
-
*
|
|
202
|
+
* Load flag definitions and set up subscriptions if needed.
|
|
203
|
+
*
|
|
204
|
+
* Optional: evaluate() and bulkEvaluate() initialize automatically. This method
|
|
205
|
+
* rejects if initialization fails, while evaluation can still try fallbacks.
|
|
206
|
+
* With request-scoped Vercel OIDC, call this inside a request handler, not at
|
|
207
|
+
* module scope. Creating the client at module scope is safe; starting and
|
|
208
|
+
* caching an initialization promise there can run before a token is available.
|
|
197
209
|
*/
|
|
198
210
|
initialize(): void | Promise<void>;
|
|
199
211
|
/**
|
|
@@ -677,4 +689,4 @@ declare namespace Packed {
|
|
|
677
689
|
};
|
|
678
690
|
}
|
|
679
691
|
|
|
680
|
-
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 };
|
|
692
|
+
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 };
|