@vercel/flags-core 1.1.0-cea788b-20260305194413 → 1.1.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 +8 -2
- package/README.md +2 -0
- package/dist/{chunk-EB6T2UJ6.js → chunk-J33BA25D.js} +958 -527
- package/dist/chunk-J33BA25D.js.map +1 -0
- package/dist/{chunk-326YN2YT.cjs → chunk-LBP3OTYA.cjs} +965 -535
- package/dist/chunk-LBP3OTYA.cjs.map +1 -0
- package/dist/{chunk-IBIJOSJL.js → chunk-UYFYFLI7.js} +953 -523
- package/dist/chunk-UYFYFLI7.js.map +1 -0
- package/dist/{chunk-WN6UYCJZ.cjs → chunk-ZLGLABMG.cjs} +969 -538
- package/dist/chunk-ZLGLABMG.cjs.map +1 -0
- package/dist/index.default.cjs +3 -2
- package/dist/index.default.cjs.map +1 -1
- package/dist/index.default.d.cts +78 -83
- package/dist/index.default.d.ts +78 -83
- package/dist/index.default.js +4 -3
- package/dist/index.next-js.cjs +3 -2
- package/dist/index.next-js.cjs.map +1 -1
- package/dist/index.next-js.d.cts +78 -83
- package/dist/index.next-js.d.ts +78 -83
- package/dist/index.next-js.js +4 -3
- 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-CpRz8o4d.d.cts → types-DtnecWgl.d.cts} +8 -4
- package/dist/{types-CpRz8o4d.d.ts → types-DtnecWgl.d.ts} +8 -4
- package/package.json +3 -4
- package/dist/chunk-326YN2YT.cjs.map +0 -1
- package/dist/chunk-EB6T2UJ6.js.map +0 -1
- package/dist/chunk-IBIJOSJL.js.map +0 -1
- package/dist/chunk-WN6UYCJZ.cjs.map +0 -1
package/dist/index.default.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { D as DatafileInput, S as StreamOptions, P as PollingOptions,
|
|
2
|
-
export {
|
|
1
|
+
import { D as DatafileInput, S as StreamOptions, P as PollingOptions, C as ControllerInterface, a as Datafile, B as BundledDefinitions, E as EvaluationParams, b as EvaluationResult, F as FlagsClient } from './types-DtnecWgl.cjs';
|
|
2
|
+
export { c as Packed, R as Reason } from './types-DtnecWgl.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Configuration options for
|
|
5
|
+
* Configuration options for Controller
|
|
6
6
|
*/
|
|
7
|
-
type
|
|
7
|
+
type ControllerOptions = {
|
|
8
8
|
/** SDK key for authentication (must start with "vf_") */
|
|
9
9
|
sdkKey: string;
|
|
10
10
|
/**
|
|
@@ -43,44 +43,61 @@ type FlagNetworkDataSourceOptions = {
|
|
|
43
43
|
*/
|
|
44
44
|
fetch?: typeof globalThis.fetch;
|
|
45
45
|
};
|
|
46
|
+
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
+
* Connects to flags.vercel.com and manages flag definitions.
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
+
* Implemented as a state machine controller that delegates all I/O to
|
|
51
|
+
* source modules (StreamSource, PollingSource, BundledSource).
|
|
50
52
|
*
|
|
51
53
|
* **Build step** (CI=1 or Next.js build, or buildStep: true):
|
|
52
|
-
* - Uses datafile (if provided) or
|
|
53
|
-
* - No streaming or polling
|
|
54
|
+
* - Uses datafile (if provided), bundled definitions, or one-time fetch as fallback
|
|
55
|
+
* - No streaming or polling
|
|
56
|
+
*
|
|
57
|
+
* **Runtime — streaming mode** (stream enabled):
|
|
58
|
+
* - Uses streaming exclusively; polling is never started, even if configured
|
|
59
|
+
* - Init fallback (no data yet): constructor datafile → bundled → throw
|
|
60
|
+
* - Read fallback (post-init): in-memory value → constructor datafile → bundled → throw
|
|
54
61
|
*
|
|
55
|
-
* **Runtime** (
|
|
56
|
-
* -
|
|
57
|
-
* -
|
|
58
|
-
*
|
|
59
|
-
*
|
|
62
|
+
* **Runtime — polling mode** (polling enabled, stream disabled):
|
|
63
|
+
* - Uses polling exclusively
|
|
64
|
+
* - Same fallback chains as streaming mode
|
|
65
|
+
*
|
|
66
|
+
* **Runtime — offline mode** (neither stream nor polling):
|
|
67
|
+
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
68
|
+
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
60
69
|
*/
|
|
61
|
-
declare class
|
|
70
|
+
declare class Controller implements ControllerInterface {
|
|
62
71
|
private options;
|
|
63
|
-
private
|
|
72
|
+
private state;
|
|
64
73
|
private data;
|
|
65
|
-
private
|
|
66
|
-
private
|
|
67
|
-
private
|
|
68
|
-
private isStreamConnected;
|
|
69
|
-
private hasWarnedAboutStaleData;
|
|
70
|
-
private pollingIntervalId;
|
|
71
|
-
private pollingAbortController;
|
|
72
|
-
private isInitializing;
|
|
74
|
+
private streamSource;
|
|
75
|
+
private pollingSource;
|
|
76
|
+
private bundledSource;
|
|
73
77
|
private usageTracker;
|
|
74
78
|
private isFirstGetData;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
constructor(options:
|
|
79
|
+
private buildDataPromise;
|
|
80
|
+
private buildReadTracked;
|
|
81
|
+
private unauthorized;
|
|
82
|
+
constructor(options: ControllerOptions);
|
|
83
|
+
private onStreamData;
|
|
84
|
+
private onStreamPrimed;
|
|
85
|
+
private onStreamConnected;
|
|
86
|
+
private onStreamDisconnected;
|
|
87
|
+
private onPollData;
|
|
88
|
+
private onPollError;
|
|
89
|
+
private wireSourceEvents;
|
|
90
|
+
private unwireSourceEvents;
|
|
91
|
+
private transition;
|
|
92
|
+
private get isConnected();
|
|
93
|
+
private get mode();
|
|
79
94
|
/**
|
|
80
95
|
* Initializes the data source.
|
|
81
96
|
*
|
|
82
|
-
* Build step: datafile → bundled → fetch
|
|
83
|
-
*
|
|
97
|
+
* Build step: datafile → bundled → one-time fetch
|
|
98
|
+
* Streaming mode: stream → datafile → bundled
|
|
99
|
+
* Polling mode (no stream): poll → datafile → bundled
|
|
100
|
+
* Offline mode (neither): datafile → bundled → one-time fetch
|
|
84
101
|
*/
|
|
85
102
|
initialize(): Promise<void>;
|
|
86
103
|
/**
|
|
@@ -93,81 +110,60 @@ declare class FlagNetworkDataSource implements DataSource {
|
|
|
93
110
|
shutdown(): Promise<void>;
|
|
94
111
|
/**
|
|
95
112
|
* Returns the datafile with metrics.
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* This method never opens a streaming connection, but will read from
|
|
100
|
-
* the stream if it is already open. Otherwise it fetches over the network.
|
|
113
|
+
* Uses in-memory data if available, otherwise falls back to bundled,
|
|
114
|
+
* then to a one-time fetch if called without prior initialization.
|
|
101
115
|
*/
|
|
102
116
|
getDatafile(): Promise<Datafile>;
|
|
103
117
|
/**
|
|
104
118
|
* Returns the bundled fallback datafile.
|
|
105
119
|
*/
|
|
106
120
|
getFallbackDatafile(): Promise<BundledDefinitions>;
|
|
121
|
+
/**
|
|
122
|
+
* Resolves the current data, using the appropriate strategy for the
|
|
123
|
+
* current mode. Returns tagged data and cache status.
|
|
124
|
+
*
|
|
125
|
+
* Build step: cached → bundled → one-time fetch
|
|
126
|
+
* Runtime with cache: return cached data
|
|
127
|
+
* Runtime without cache: stream/poll → datafile → bundled → fetch → throw
|
|
128
|
+
*/
|
|
129
|
+
private resolveData;
|
|
107
130
|
/**
|
|
108
131
|
* Attempts to initialize via stream with timeout.
|
|
109
132
|
* Returns true if stream connected successfully within timeout.
|
|
110
133
|
*/
|
|
111
134
|
private tryInitializeStream;
|
|
112
|
-
/**
|
|
113
|
-
* Starts the stream connection with callbacks for data and disconnect.
|
|
114
|
-
*/
|
|
115
|
-
private startStream;
|
|
116
|
-
/**
|
|
117
|
-
* Stops the stream connection.
|
|
118
|
-
*/
|
|
119
|
-
private stopStream;
|
|
120
135
|
/**
|
|
121
136
|
* Attempts to initialize via polling with timeout.
|
|
122
137
|
* Returns true if first poll succeeded within timeout.
|
|
138
|
+
*
|
|
139
|
+
* Only used when streaming is disabled and polling is the primary source.
|
|
123
140
|
*/
|
|
124
141
|
private tryInitializePolling;
|
|
125
|
-
/**
|
|
126
|
-
* Starts polling (initial poll + interval).
|
|
127
|
-
*/
|
|
128
|
-
private startPolling;
|
|
129
|
-
/**
|
|
130
|
-
* Starts the polling interval (without initial poll).
|
|
131
|
-
*/
|
|
132
|
-
private startPollingInterval;
|
|
133
|
-
/**
|
|
134
|
-
* Stops polling.
|
|
135
|
-
*/
|
|
136
|
-
private stopPolling;
|
|
137
|
-
/**
|
|
138
|
-
* Performs a single poll request.
|
|
139
|
-
*/
|
|
140
|
-
private performPoll;
|
|
141
|
-
/**
|
|
142
|
-
* Starts background updates (stream or polling) without blocking.
|
|
143
|
-
* Used when we already have data from provided datafile.
|
|
144
|
-
*/
|
|
145
|
-
private startBackgroundUpdates;
|
|
146
142
|
/**
|
|
147
143
|
* Initializes data for build step environments.
|
|
148
144
|
*/
|
|
149
145
|
private initializeForBuildStep;
|
|
150
146
|
/**
|
|
151
147
|
* Retrieves data during build steps.
|
|
148
|
+
* Concurrent callers share a single load promise. The first caller to
|
|
149
|
+
* populate `this.data` gets cacheStatus MISS; subsequent callers get HIT.
|
|
152
150
|
*/
|
|
153
|
-
private
|
|
151
|
+
private resolveDataForBuildStep;
|
|
154
152
|
/**
|
|
155
|
-
*
|
|
153
|
+
* Loads data for a build step: bundled → one-time fetch.
|
|
156
154
|
*/
|
|
157
|
-
private
|
|
155
|
+
private loadBuildData;
|
|
158
156
|
/**
|
|
159
|
-
*
|
|
157
|
+
* Shared fallback chain used by both initialize() and resolveData().
|
|
160
158
|
*/
|
|
161
|
-
private
|
|
159
|
+
private initializeFromFallbacks;
|
|
162
160
|
/**
|
|
163
|
-
*
|
|
161
|
+
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
162
|
+
* Streaming mode: stream → datafile → bundled.
|
|
163
|
+
* Polling mode: poll → datafile → bundled.
|
|
164
|
+
* Offline mode: datafile → bundled → one-time fetch.
|
|
164
165
|
*/
|
|
165
|
-
private
|
|
166
|
-
/**
|
|
167
|
-
* Parses a configUpdatedAt value (number or string) into a numeric timestamp.
|
|
168
|
-
* Returns undefined if the value is missing or cannot be parsed.
|
|
169
|
-
*/
|
|
170
|
-
private static parseConfigUpdatedAt;
|
|
166
|
+
private resolveDataWithFallbacks;
|
|
171
167
|
/**
|
|
172
168
|
* Checks if the incoming data is newer than the current in-memory data.
|
|
173
169
|
* Returns true if the update should proceed, false if it should be skipped.
|
|
@@ -177,15 +173,12 @@ declare class FlagNetworkDataSource implements DataSource {
|
|
|
177
173
|
* - The current data has no configUpdatedAt
|
|
178
174
|
* - The incoming data has no configUpdatedAt
|
|
179
175
|
*
|
|
180
|
-
* Skips the update only when both have configUpdatedAt and incoming is
|
|
176
|
+
* Skips the update only when both have configUpdatedAt and incoming is not newer.
|
|
181
177
|
*/
|
|
182
178
|
private isNewerData;
|
|
183
|
-
/**
|
|
184
|
-
* Logs a warning if returning cached data while stream is disconnected.
|
|
185
|
-
*/
|
|
186
|
-
private warnIfDisconnected;
|
|
187
179
|
/**
|
|
188
180
|
* Tracks a read operation for usage analytics.
|
|
181
|
+
* During build steps, only the first read is tracked.
|
|
189
182
|
*/
|
|
190
183
|
private trackRead;
|
|
191
184
|
}
|
|
@@ -197,7 +190,7 @@ declare class FlagNetworkDataSource implements DataSource {
|
|
|
197
190
|
/**
|
|
198
191
|
* Options for createClient
|
|
199
192
|
*/
|
|
200
|
-
type CreateClientOptions = Omit<
|
|
193
|
+
type CreateClientOptions = Omit<ControllerOptions, 'sdkKey'>;
|
|
201
194
|
|
|
202
195
|
/**
|
|
203
196
|
* Error thrown when the fallback definitions file does not exist.
|
|
@@ -227,7 +220,9 @@ declare function evaluate<T>(
|
|
|
227
220
|
/**
|
|
228
221
|
* The params used for the evaluation
|
|
229
222
|
*/
|
|
230
|
-
params: EvaluationParams<T
|
|
223
|
+
params: EvaluationParams<T>,
|
|
224
|
+
/** Tracks visited environments to detect circular reuse. */
|
|
225
|
+
_visited?: Set<string>): EvaluationResult<T>;
|
|
231
226
|
|
|
232
227
|
declare const
|
|
233
228
|
/**
|
|
@@ -246,4 +241,4 @@ declare const /**
|
|
|
246
241
|
*/
|
|
247
242
|
createClient: (sdkKeyOrConnectionString: string, options?: CreateClientOptions) => FlagsClient;
|
|
248
243
|
|
|
249
|
-
export { BundledDefinitions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, FlagNetworkDataSource, type FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, StreamOptions, createClient, evaluate, flagsClient, resetDefaultFlagsClient };
|
|
244
|
+
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, StreamOptions, createClient, evaluate, flagsClient, resetDefaultFlagsClient };
|
package/dist/index.default.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { D as DatafileInput, S as StreamOptions, P as PollingOptions,
|
|
2
|
-
export {
|
|
1
|
+
import { D as DatafileInput, S as StreamOptions, P as PollingOptions, C as ControllerInterface, a as Datafile, B as BundledDefinitions, E as EvaluationParams, b as EvaluationResult, F as FlagsClient } from './types-DtnecWgl.js';
|
|
2
|
+
export { c as Packed, R as Reason } from './types-DtnecWgl.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Configuration options for
|
|
5
|
+
* Configuration options for Controller
|
|
6
6
|
*/
|
|
7
|
-
type
|
|
7
|
+
type ControllerOptions = {
|
|
8
8
|
/** SDK key for authentication (must start with "vf_") */
|
|
9
9
|
sdkKey: string;
|
|
10
10
|
/**
|
|
@@ -43,44 +43,61 @@ type FlagNetworkDataSourceOptions = {
|
|
|
43
43
|
*/
|
|
44
44
|
fetch?: typeof globalThis.fetch;
|
|
45
45
|
};
|
|
46
|
+
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
+
* Connects to flags.vercel.com and manages flag definitions.
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
+
* Implemented as a state machine controller that delegates all I/O to
|
|
51
|
+
* source modules (StreamSource, PollingSource, BundledSource).
|
|
50
52
|
*
|
|
51
53
|
* **Build step** (CI=1 or Next.js build, or buildStep: true):
|
|
52
|
-
* - Uses datafile (if provided) or
|
|
53
|
-
* - No streaming or polling
|
|
54
|
+
* - Uses datafile (if provided), bundled definitions, or one-time fetch as fallback
|
|
55
|
+
* - No streaming or polling
|
|
56
|
+
*
|
|
57
|
+
* **Runtime — streaming mode** (stream enabled):
|
|
58
|
+
* - Uses streaming exclusively; polling is never started, even if configured
|
|
59
|
+
* - Init fallback (no data yet): constructor datafile → bundled → throw
|
|
60
|
+
* - Read fallback (post-init): in-memory value → constructor datafile → bundled → throw
|
|
54
61
|
*
|
|
55
|
-
* **Runtime** (
|
|
56
|
-
* -
|
|
57
|
-
* -
|
|
58
|
-
*
|
|
59
|
-
*
|
|
62
|
+
* **Runtime — polling mode** (polling enabled, stream disabled):
|
|
63
|
+
* - Uses polling exclusively
|
|
64
|
+
* - Same fallback chains as streaming mode
|
|
65
|
+
*
|
|
66
|
+
* **Runtime — offline mode** (neither stream nor polling):
|
|
67
|
+
* - Init fallback: constructor datafile → bundled → one-time fetch → throw
|
|
68
|
+
* - Read fallback: in-memory value → constructor datafile → bundled → one-time fetch → throw
|
|
60
69
|
*/
|
|
61
|
-
declare class
|
|
70
|
+
declare class Controller implements ControllerInterface {
|
|
62
71
|
private options;
|
|
63
|
-
private
|
|
72
|
+
private state;
|
|
64
73
|
private data;
|
|
65
|
-
private
|
|
66
|
-
private
|
|
67
|
-
private
|
|
68
|
-
private isStreamConnected;
|
|
69
|
-
private hasWarnedAboutStaleData;
|
|
70
|
-
private pollingIntervalId;
|
|
71
|
-
private pollingAbortController;
|
|
72
|
-
private isInitializing;
|
|
74
|
+
private streamSource;
|
|
75
|
+
private pollingSource;
|
|
76
|
+
private bundledSource;
|
|
73
77
|
private usageTracker;
|
|
74
78
|
private isFirstGetData;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
constructor(options:
|
|
79
|
+
private buildDataPromise;
|
|
80
|
+
private buildReadTracked;
|
|
81
|
+
private unauthorized;
|
|
82
|
+
constructor(options: ControllerOptions);
|
|
83
|
+
private onStreamData;
|
|
84
|
+
private onStreamPrimed;
|
|
85
|
+
private onStreamConnected;
|
|
86
|
+
private onStreamDisconnected;
|
|
87
|
+
private onPollData;
|
|
88
|
+
private onPollError;
|
|
89
|
+
private wireSourceEvents;
|
|
90
|
+
private unwireSourceEvents;
|
|
91
|
+
private transition;
|
|
92
|
+
private get isConnected();
|
|
93
|
+
private get mode();
|
|
79
94
|
/**
|
|
80
95
|
* Initializes the data source.
|
|
81
96
|
*
|
|
82
|
-
* Build step: datafile → bundled → fetch
|
|
83
|
-
*
|
|
97
|
+
* Build step: datafile → bundled → one-time fetch
|
|
98
|
+
* Streaming mode: stream → datafile → bundled
|
|
99
|
+
* Polling mode (no stream): poll → datafile → bundled
|
|
100
|
+
* Offline mode (neither): datafile → bundled → one-time fetch
|
|
84
101
|
*/
|
|
85
102
|
initialize(): Promise<void>;
|
|
86
103
|
/**
|
|
@@ -93,81 +110,60 @@ declare class FlagNetworkDataSource implements DataSource {
|
|
|
93
110
|
shutdown(): Promise<void>;
|
|
94
111
|
/**
|
|
95
112
|
* Returns the datafile with metrics.
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* This method never opens a streaming connection, but will read from
|
|
100
|
-
* the stream if it is already open. Otherwise it fetches over the network.
|
|
113
|
+
* Uses in-memory data if available, otherwise falls back to bundled,
|
|
114
|
+
* then to a one-time fetch if called without prior initialization.
|
|
101
115
|
*/
|
|
102
116
|
getDatafile(): Promise<Datafile>;
|
|
103
117
|
/**
|
|
104
118
|
* Returns the bundled fallback datafile.
|
|
105
119
|
*/
|
|
106
120
|
getFallbackDatafile(): Promise<BundledDefinitions>;
|
|
121
|
+
/**
|
|
122
|
+
* Resolves the current data, using the appropriate strategy for the
|
|
123
|
+
* current mode. Returns tagged data and cache status.
|
|
124
|
+
*
|
|
125
|
+
* Build step: cached → bundled → one-time fetch
|
|
126
|
+
* Runtime with cache: return cached data
|
|
127
|
+
* Runtime without cache: stream/poll → datafile → bundled → fetch → throw
|
|
128
|
+
*/
|
|
129
|
+
private resolveData;
|
|
107
130
|
/**
|
|
108
131
|
* Attempts to initialize via stream with timeout.
|
|
109
132
|
* Returns true if stream connected successfully within timeout.
|
|
110
133
|
*/
|
|
111
134
|
private tryInitializeStream;
|
|
112
|
-
/**
|
|
113
|
-
* Starts the stream connection with callbacks for data and disconnect.
|
|
114
|
-
*/
|
|
115
|
-
private startStream;
|
|
116
|
-
/**
|
|
117
|
-
* Stops the stream connection.
|
|
118
|
-
*/
|
|
119
|
-
private stopStream;
|
|
120
135
|
/**
|
|
121
136
|
* Attempts to initialize via polling with timeout.
|
|
122
137
|
* Returns true if first poll succeeded within timeout.
|
|
138
|
+
*
|
|
139
|
+
* Only used when streaming is disabled and polling is the primary source.
|
|
123
140
|
*/
|
|
124
141
|
private tryInitializePolling;
|
|
125
|
-
/**
|
|
126
|
-
* Starts polling (initial poll + interval).
|
|
127
|
-
*/
|
|
128
|
-
private startPolling;
|
|
129
|
-
/**
|
|
130
|
-
* Starts the polling interval (without initial poll).
|
|
131
|
-
*/
|
|
132
|
-
private startPollingInterval;
|
|
133
|
-
/**
|
|
134
|
-
* Stops polling.
|
|
135
|
-
*/
|
|
136
|
-
private stopPolling;
|
|
137
|
-
/**
|
|
138
|
-
* Performs a single poll request.
|
|
139
|
-
*/
|
|
140
|
-
private performPoll;
|
|
141
|
-
/**
|
|
142
|
-
* Starts background updates (stream or polling) without blocking.
|
|
143
|
-
* Used when we already have data from provided datafile.
|
|
144
|
-
*/
|
|
145
|
-
private startBackgroundUpdates;
|
|
146
142
|
/**
|
|
147
143
|
* Initializes data for build step environments.
|
|
148
144
|
*/
|
|
149
145
|
private initializeForBuildStep;
|
|
150
146
|
/**
|
|
151
147
|
* Retrieves data during build steps.
|
|
148
|
+
* Concurrent callers share a single load promise. The first caller to
|
|
149
|
+
* populate `this.data` gets cacheStatus MISS; subsequent callers get HIT.
|
|
152
150
|
*/
|
|
153
|
-
private
|
|
151
|
+
private resolveDataForBuildStep;
|
|
154
152
|
/**
|
|
155
|
-
*
|
|
153
|
+
* Loads data for a build step: bundled → one-time fetch.
|
|
156
154
|
*/
|
|
157
|
-
private
|
|
155
|
+
private loadBuildData;
|
|
158
156
|
/**
|
|
159
|
-
*
|
|
157
|
+
* Shared fallback chain used by both initialize() and resolveData().
|
|
160
158
|
*/
|
|
161
|
-
private
|
|
159
|
+
private initializeFromFallbacks;
|
|
162
160
|
/**
|
|
163
|
-
*
|
|
161
|
+
* Retrieves data using the fallback chain (called when no cached data exists).
|
|
162
|
+
* Streaming mode: stream → datafile → bundled.
|
|
163
|
+
* Polling mode: poll → datafile → bundled.
|
|
164
|
+
* Offline mode: datafile → bundled → one-time fetch.
|
|
164
165
|
*/
|
|
165
|
-
private
|
|
166
|
-
/**
|
|
167
|
-
* Parses a configUpdatedAt value (number or string) into a numeric timestamp.
|
|
168
|
-
* Returns undefined if the value is missing or cannot be parsed.
|
|
169
|
-
*/
|
|
170
|
-
private static parseConfigUpdatedAt;
|
|
166
|
+
private resolveDataWithFallbacks;
|
|
171
167
|
/**
|
|
172
168
|
* Checks if the incoming data is newer than the current in-memory data.
|
|
173
169
|
* Returns true if the update should proceed, false if it should be skipped.
|
|
@@ -177,15 +173,12 @@ declare class FlagNetworkDataSource implements DataSource {
|
|
|
177
173
|
* - The current data has no configUpdatedAt
|
|
178
174
|
* - The incoming data has no configUpdatedAt
|
|
179
175
|
*
|
|
180
|
-
* Skips the update only when both have configUpdatedAt and incoming is
|
|
176
|
+
* Skips the update only when both have configUpdatedAt and incoming is not newer.
|
|
181
177
|
*/
|
|
182
178
|
private isNewerData;
|
|
183
|
-
/**
|
|
184
|
-
* Logs a warning if returning cached data while stream is disconnected.
|
|
185
|
-
*/
|
|
186
|
-
private warnIfDisconnected;
|
|
187
179
|
/**
|
|
188
180
|
* Tracks a read operation for usage analytics.
|
|
181
|
+
* During build steps, only the first read is tracked.
|
|
189
182
|
*/
|
|
190
183
|
private trackRead;
|
|
191
184
|
}
|
|
@@ -197,7 +190,7 @@ declare class FlagNetworkDataSource implements DataSource {
|
|
|
197
190
|
/**
|
|
198
191
|
* Options for createClient
|
|
199
192
|
*/
|
|
200
|
-
type CreateClientOptions = Omit<
|
|
193
|
+
type CreateClientOptions = Omit<ControllerOptions, 'sdkKey'>;
|
|
201
194
|
|
|
202
195
|
/**
|
|
203
196
|
* Error thrown when the fallback definitions file does not exist.
|
|
@@ -227,7 +220,9 @@ declare function evaluate<T>(
|
|
|
227
220
|
/**
|
|
228
221
|
* The params used for the evaluation
|
|
229
222
|
*/
|
|
230
|
-
params: EvaluationParams<T
|
|
223
|
+
params: EvaluationParams<T>,
|
|
224
|
+
/** Tracks visited environments to detect circular reuse. */
|
|
225
|
+
_visited?: Set<string>): EvaluationResult<T>;
|
|
231
226
|
|
|
232
227
|
declare const
|
|
233
228
|
/**
|
|
@@ -246,4 +241,4 @@ declare const /**
|
|
|
246
241
|
*/
|
|
247
242
|
createClient: (sdkKeyOrConnectionString: string, options?: CreateClientOptions) => FlagsClient;
|
|
248
243
|
|
|
249
|
-
export { BundledDefinitions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, FlagNetworkDataSource, type FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, StreamOptions, createClient, evaluate, flagsClient, resetDefaultFlagsClient };
|
|
244
|
+
export { BundledDefinitions, Controller, type ControllerOptions, type CreateClientOptions, Datafile, DatafileInput, EvaluationParams, EvaluationResult, FallbackEntryNotFoundError, FallbackNotFoundError, Controller as FlagNetworkDataSource, type ControllerOptions as FlagNetworkDataSourceOptions, FlagsClient, PollingOptions, StreamOptions, createClient, evaluate, flagsClient, resetDefaultFlagsClient };
|
package/dist/index.default.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Controller,
|
|
2
3
|
FallbackEntryNotFoundError,
|
|
3
4
|
FallbackNotFoundError,
|
|
4
|
-
FlagNetworkDataSource,
|
|
5
5
|
ResolutionReason,
|
|
6
6
|
createClient,
|
|
7
7
|
evaluate,
|
|
8
8
|
flagsClient,
|
|
9
9
|
resetDefaultFlagsClient
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-J33BA25D.js";
|
|
11
11
|
export {
|
|
12
|
+
Controller,
|
|
12
13
|
FallbackEntryNotFoundError,
|
|
13
14
|
FallbackNotFoundError,
|
|
14
|
-
FlagNetworkDataSource,
|
|
15
|
+
Controller as FlagNetworkDataSource,
|
|
15
16
|
ResolutionReason as Reason,
|
|
16
17
|
createClient,
|
|
17
18
|
evaluate,
|
package/dist/index.next-js.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkLBP3OTYAcjs = require('./chunk-LBP3OTYA.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -17,5 +17,6 @@ var _chunk326YN2YTcjs = require('./chunk-326YN2YT.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
exports.Controller = _chunkLBP3OTYAcjs.Controller; exports.FallbackEntryNotFoundError = _chunkLBP3OTYAcjs.FallbackEntryNotFoundError; exports.FallbackNotFoundError = _chunkLBP3OTYAcjs.FallbackNotFoundError; exports.FlagNetworkDataSource = _chunkLBP3OTYAcjs.Controller; exports.Reason = _chunkLBP3OTYAcjs.ResolutionReason; exports.createClient = _chunkLBP3OTYAcjs.createClient; exports.evaluate = _chunkLBP3OTYAcjs.evaluate; exports.flagsClient = _chunkLBP3OTYAcjs.flagsClient; exports.resetDefaultFlagsClient = _chunkLBP3OTYAcjs.resetDefaultFlagsClient;
|
|
21
22
|
//# sourceMappingURL=index.next-js.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/flags/flags/packages/vercel-flags-core/dist/index.next-js.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/flags/flags/packages/vercel-flags-core/dist/index.next-js.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yiBAAC","file":"/home/runner/work/flags/flags/packages/vercel-flags-core/dist/index.next-js.cjs"}
|