flags 3.2.0 → 4.0.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 +10 -0
- package/README.md +2 -0
- package/dist/{chunk-RDI4Q5KS.js → chunk-4EH7RLTD.js} +93 -25
- package/dist/chunk-4EH7RLTD.js.map +1 -0
- package/dist/{chunk-QXF5OB2B.cjs → chunk-L3FUM2ST.cjs} +96 -28
- package/dist/chunk-L3FUM2ST.cjs.map +1 -0
- package/dist/index.cjs +16 -2
- package/dist/index.d.cts +77 -7
- package/dist/index.d.ts +77 -7
- package/dist/index.js +21 -7
- package/dist/next.cjs +44 -22
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +15 -2
- package/dist/next.d.ts +15 -2
- package/dist/next.js +26 -4
- package/dist/next.js.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/sveltekit.cjs +56 -14
- package/dist/sveltekit.cjs.map +1 -1
- package/dist/sveltekit.d.cts +18 -19
- package/dist/sveltekit.d.ts +18 -19
- package/dist/sveltekit.js +55 -13
- package/dist/sveltekit.js.map +1 -1
- package/dist/{types-CGpl9epN.d.cts → types-CisDd6Kq.d.cts} +1 -1
- package/dist/{types-CGpl9epN.d.ts → types-CisDd6Kq.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-QXF5OB2B.cjs.map +0 -1
- package/dist/chunk-RDI4Q5KS.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { TracerProvider } from '@opentelemetry/api';
|
|
2
|
-
import { P as ProviderData } from './types-
|
|
3
|
-
export { A as Adapter,
|
|
2
|
+
import { F as FlagOverridesType, a as FlagValuesType, b as FlagDefinitionsType, P as ProviderData } from './types-CisDd6Kq.cjs';
|
|
3
|
+
export { A as Adapter, c as ApiData, D as Decide, f as FlagDeclaration, e as FlagDefinitionType, d as FlagOptionType, G as GenerousOption, H as HeadersAdapter, I as Identify, J as JsonValue, O as Origin, R as ReadonlyHeaders, g as ReadonlyRequestCookies, h as RequestCookiesAdapter } from './types-CisDd6Kq.cjs';
|
|
4
4
|
import 'http';
|
|
5
5
|
import '@edge-runtime/cookies';
|
|
6
6
|
|
|
7
|
+
var version = "4.0.0";
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Allows setting the `@opentelemetry/api` tracer provider to generate traces
|
|
9
11
|
* for `flags` operations.
|
|
@@ -33,14 +35,82 @@ declare function safeJsonStringify(value: any, replacer?: (this: any, key: strin
|
|
|
33
35
|
*/
|
|
34
36
|
declare function safeJsonStringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
35
37
|
|
|
38
|
+
type ExpirationTime = string | number | Date;
|
|
39
|
+
/**
|
|
40
|
+
* Encrypts flag overrides data.
|
|
41
|
+
*
|
|
42
|
+
* @param overrides - The flag overrides to encrypt
|
|
43
|
+
* @param secret - The encryption secret (defaults to FLAGS_SECRET env var)
|
|
44
|
+
* @param expirationTime - When the encrypted data should expire (defaults to 1 year)
|
|
45
|
+
* @returns A promise resolving to the encrypted JWE string
|
|
46
|
+
* @throws Error if the secret is missing or invalid
|
|
47
|
+
*/
|
|
48
|
+
declare function encryptOverrides(overrides: FlagOverridesType, secret?: string | undefined, expirationTime?: ExpirationTime): Promise<string>;
|
|
36
49
|
/**
|
|
37
|
-
*
|
|
50
|
+
* Decrypts and validates flag overrides data.
|
|
51
|
+
*
|
|
52
|
+
* @param encryptedData - The encrypted JWE token string
|
|
53
|
+
* @param secret - The decryption secret (defaults to FLAGS_SECRET env var)
|
|
54
|
+
* @returns A promise resolving to the decrypted flag overrides or undefined if invalid
|
|
55
|
+
* @throws Error if the secret is missing or invalid
|
|
56
|
+
*/
|
|
57
|
+
declare function decryptOverrides(encryptedData: string, secret?: string | undefined): Promise<FlagOverridesType | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* Encrypts flag values data.
|
|
60
|
+
*
|
|
61
|
+
* @param flagValues - The flag values to encrypt
|
|
62
|
+
* @param secret - The encryption secret (defaults to FLAGS_SECRET env var)
|
|
63
|
+
* @param expirationTime - When the encrypted data should expire (defaults to 1 year)
|
|
64
|
+
* @returns A promise resolving to the encrypted JWE string
|
|
65
|
+
* @throws Error if the secret is missing or invalid
|
|
66
|
+
*/
|
|
67
|
+
declare function encryptFlagValues(flagValues: FlagValuesType, secret?: string | undefined, expirationTime?: ExpirationTime): Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Decrypts and validates flag values data.
|
|
70
|
+
*
|
|
71
|
+
* @param encryptedData - The encrypted JWE token string
|
|
72
|
+
* @param secret - The decryption secret (defaults to FLAGS_SECRET env var)
|
|
73
|
+
* @returns A promise resolving to the decrypted flag values or undefined if invalid
|
|
74
|
+
* @throws Error if the secret is missing or invalid
|
|
38
75
|
*/
|
|
39
|
-
declare function
|
|
76
|
+
declare function decryptFlagValues(encryptedData: string, secret?: string | undefined): Promise<FlagValuesType | undefined>;
|
|
40
77
|
/**
|
|
41
|
-
*
|
|
78
|
+
* Encrypts flag definitions data.
|
|
79
|
+
*
|
|
80
|
+
* @param flagDefinitions - The flag definitions to encrypt
|
|
81
|
+
* @param secret - The encryption secret (defaults to FLAGS_SECRET env var)
|
|
82
|
+
* @param expirationTime - When the encrypted data should expire (defaults to 1 year)
|
|
83
|
+
* @returns A promise resolving to the encrypted JWE string
|
|
84
|
+
* @throws Error if the secret is missing or invalid
|
|
85
|
+
*/
|
|
86
|
+
declare function encryptFlagDefinitions(flagDefinitions: FlagDefinitionsType, secret?: string | undefined, expirationTime?: ExpirationTime): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Decrypts and validates flag definitions data.
|
|
89
|
+
*
|
|
90
|
+
* @param encryptedData - The encrypted JWE token string
|
|
91
|
+
* @param secret - The decryption secret (defaults to FLAGS_SECRET env var)
|
|
92
|
+
* @returns A promise resolving to the decrypted flag definitions or undefined if invalid
|
|
93
|
+
* @throws Error if the secret is missing or invalid
|
|
94
|
+
*/
|
|
95
|
+
declare function decryptFlagDefinitions(encryptedData: string, secret?: string | undefined): Promise<FlagDefinitionsType | undefined>;
|
|
96
|
+
/**
|
|
97
|
+
* Creates an access proof token.
|
|
98
|
+
*
|
|
99
|
+
* @param secret - The encryption secret (defaults to FLAGS_SECRET env var)
|
|
100
|
+
* @param expirationTime - When the token should expire (defaults to 1 year)
|
|
101
|
+
* @returns A promise resolving to the encrypted access proof token
|
|
102
|
+
* @throws Error if the secret is missing or invalid
|
|
103
|
+
*/
|
|
104
|
+
declare function createAccessProof(secret?: string | undefined, expirationTime?: ExpirationTime): Promise<string>;
|
|
105
|
+
/**
|
|
106
|
+
* Verifies an access proof token is valid.
|
|
107
|
+
*
|
|
108
|
+
* @param encryptedData - The encrypted access proof token
|
|
109
|
+
* @param secret - The decryption secret (defaults to FLAGS_SECRET env var)
|
|
110
|
+
* @returns A promise resolving to a boolean indicating if the token is valid
|
|
111
|
+
* @throws Error if the secret is missing or invalid
|
|
42
112
|
*/
|
|
43
|
-
declare function
|
|
113
|
+
declare function verifyAccessProof(encryptedData: string, secret?: string | undefined): Promise<boolean>;
|
|
44
114
|
|
|
45
115
|
/**
|
|
46
116
|
* This function lets you verify whether a request to your application's .well-known/vercel/flags endpoint was made by the toolbar.
|
|
@@ -86,4 +156,4 @@ declare function reportValue(key: string, value: unknown): void;
|
|
|
86
156
|
|
|
87
157
|
declare function mergeProviderData(itemsPromises: (Promise<ProviderData> | ProviderData)[]): Promise<ProviderData>;
|
|
88
158
|
|
|
89
|
-
export { ProviderData,
|
|
159
|
+
export { FlagDefinitionsType, FlagOverridesType, FlagValuesType, ProviderData, createAccessProof, decryptFlagDefinitions, decryptFlagValues, decryptOverrides, encryptFlagDefinitions, encryptFlagValues, encryptOverrides, mergeProviderData, reportValue, safeJsonStringify, setTracerProvider, verifyAccess, verifyAccessProof, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { TracerProvider } from '@opentelemetry/api';
|
|
2
|
-
import { P as ProviderData } from './types-
|
|
3
|
-
export { A as Adapter,
|
|
2
|
+
import { F as FlagOverridesType, a as FlagValuesType, b as FlagDefinitionsType, P as ProviderData } from './types-CisDd6Kq.js';
|
|
3
|
+
export { A as Adapter, c as ApiData, D as Decide, f as FlagDeclaration, e as FlagDefinitionType, d as FlagOptionType, G as GenerousOption, H as HeadersAdapter, I as Identify, J as JsonValue, O as Origin, R as ReadonlyHeaders, g as ReadonlyRequestCookies, h as RequestCookiesAdapter } from './types-CisDd6Kq.js';
|
|
4
4
|
import 'http';
|
|
5
5
|
import '@edge-runtime/cookies';
|
|
6
6
|
|
|
7
|
+
var version = "4.0.0";
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Allows setting the `@opentelemetry/api` tracer provider to generate traces
|
|
9
11
|
* for `flags` operations.
|
|
@@ -33,14 +35,82 @@ declare function safeJsonStringify(value: any, replacer?: (this: any, key: strin
|
|
|
33
35
|
*/
|
|
34
36
|
declare function safeJsonStringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
35
37
|
|
|
38
|
+
type ExpirationTime = string | number | Date;
|
|
39
|
+
/**
|
|
40
|
+
* Encrypts flag overrides data.
|
|
41
|
+
*
|
|
42
|
+
* @param overrides - The flag overrides to encrypt
|
|
43
|
+
* @param secret - The encryption secret (defaults to FLAGS_SECRET env var)
|
|
44
|
+
* @param expirationTime - When the encrypted data should expire (defaults to 1 year)
|
|
45
|
+
* @returns A promise resolving to the encrypted JWE string
|
|
46
|
+
* @throws Error if the secret is missing or invalid
|
|
47
|
+
*/
|
|
48
|
+
declare function encryptOverrides(overrides: FlagOverridesType, secret?: string | undefined, expirationTime?: ExpirationTime): Promise<string>;
|
|
36
49
|
/**
|
|
37
|
-
*
|
|
50
|
+
* Decrypts and validates flag overrides data.
|
|
51
|
+
*
|
|
52
|
+
* @param encryptedData - The encrypted JWE token string
|
|
53
|
+
* @param secret - The decryption secret (defaults to FLAGS_SECRET env var)
|
|
54
|
+
* @returns A promise resolving to the decrypted flag overrides or undefined if invalid
|
|
55
|
+
* @throws Error if the secret is missing or invalid
|
|
56
|
+
*/
|
|
57
|
+
declare function decryptOverrides(encryptedData: string, secret?: string | undefined): Promise<FlagOverridesType | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* Encrypts flag values data.
|
|
60
|
+
*
|
|
61
|
+
* @param flagValues - The flag values to encrypt
|
|
62
|
+
* @param secret - The encryption secret (defaults to FLAGS_SECRET env var)
|
|
63
|
+
* @param expirationTime - When the encrypted data should expire (defaults to 1 year)
|
|
64
|
+
* @returns A promise resolving to the encrypted JWE string
|
|
65
|
+
* @throws Error if the secret is missing or invalid
|
|
66
|
+
*/
|
|
67
|
+
declare function encryptFlagValues(flagValues: FlagValuesType, secret?: string | undefined, expirationTime?: ExpirationTime): Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Decrypts and validates flag values data.
|
|
70
|
+
*
|
|
71
|
+
* @param encryptedData - The encrypted JWE token string
|
|
72
|
+
* @param secret - The decryption secret (defaults to FLAGS_SECRET env var)
|
|
73
|
+
* @returns A promise resolving to the decrypted flag values or undefined if invalid
|
|
74
|
+
* @throws Error if the secret is missing or invalid
|
|
38
75
|
*/
|
|
39
|
-
declare function
|
|
76
|
+
declare function decryptFlagValues(encryptedData: string, secret?: string | undefined): Promise<FlagValuesType | undefined>;
|
|
40
77
|
/**
|
|
41
|
-
*
|
|
78
|
+
* Encrypts flag definitions data.
|
|
79
|
+
*
|
|
80
|
+
* @param flagDefinitions - The flag definitions to encrypt
|
|
81
|
+
* @param secret - The encryption secret (defaults to FLAGS_SECRET env var)
|
|
82
|
+
* @param expirationTime - When the encrypted data should expire (defaults to 1 year)
|
|
83
|
+
* @returns A promise resolving to the encrypted JWE string
|
|
84
|
+
* @throws Error if the secret is missing or invalid
|
|
85
|
+
*/
|
|
86
|
+
declare function encryptFlagDefinitions(flagDefinitions: FlagDefinitionsType, secret?: string | undefined, expirationTime?: ExpirationTime): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Decrypts and validates flag definitions data.
|
|
89
|
+
*
|
|
90
|
+
* @param encryptedData - The encrypted JWE token string
|
|
91
|
+
* @param secret - The decryption secret (defaults to FLAGS_SECRET env var)
|
|
92
|
+
* @returns A promise resolving to the decrypted flag definitions or undefined if invalid
|
|
93
|
+
* @throws Error if the secret is missing or invalid
|
|
94
|
+
*/
|
|
95
|
+
declare function decryptFlagDefinitions(encryptedData: string, secret?: string | undefined): Promise<FlagDefinitionsType | undefined>;
|
|
96
|
+
/**
|
|
97
|
+
* Creates an access proof token.
|
|
98
|
+
*
|
|
99
|
+
* @param secret - The encryption secret (defaults to FLAGS_SECRET env var)
|
|
100
|
+
* @param expirationTime - When the token should expire (defaults to 1 year)
|
|
101
|
+
* @returns A promise resolving to the encrypted access proof token
|
|
102
|
+
* @throws Error if the secret is missing or invalid
|
|
103
|
+
*/
|
|
104
|
+
declare function createAccessProof(secret?: string | undefined, expirationTime?: ExpirationTime): Promise<string>;
|
|
105
|
+
/**
|
|
106
|
+
* Verifies an access proof token is valid.
|
|
107
|
+
*
|
|
108
|
+
* @param encryptedData - The encrypted access proof token
|
|
109
|
+
* @param secret - The decryption secret (defaults to FLAGS_SECRET env var)
|
|
110
|
+
* @returns A promise resolving to a boolean indicating if the token is valid
|
|
111
|
+
* @throws Error if the secret is missing or invalid
|
|
42
112
|
*/
|
|
43
|
-
declare function
|
|
113
|
+
declare function verifyAccessProof(encryptedData: string, secret?: string | undefined): Promise<boolean>;
|
|
44
114
|
|
|
45
115
|
/**
|
|
46
116
|
* This function lets you verify whether a request to your application's .well-known/vercel/flags endpoint was made by the toolbar.
|
|
@@ -86,4 +156,4 @@ declare function reportValue(key: string, value: unknown): void;
|
|
|
86
156
|
|
|
87
157
|
declare function mergeProviderData(itemsPromises: (Promise<ProviderData> | ProviderData)[]): Promise<ProviderData>;
|
|
88
158
|
|
|
89
|
-
export { ProviderData,
|
|
159
|
+
export { FlagDefinitionsType, FlagOverridesType, FlagValuesType, ProviderData, createAccessProof, decryptFlagDefinitions, decryptFlagValues, decryptOverrides, encryptFlagDefinitions, encryptFlagValues, encryptOverrides, mergeProviderData, reportValue, safeJsonStringify, setTracerProvider, verifyAccess, verifyAccessProof, version };
|
package/dist/index.js
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HeadersAdapter,
|
|
3
3
|
RequestCookiesAdapter,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
createAccessProof,
|
|
5
|
+
decryptFlagDefinitions,
|
|
6
|
+
decryptFlagValues,
|
|
7
|
+
decryptOverrides,
|
|
8
|
+
encryptFlagDefinitions,
|
|
9
|
+
encryptFlagValues,
|
|
10
|
+
encryptOverrides,
|
|
6
11
|
mergeProviderData,
|
|
7
12
|
reportValue,
|
|
8
13
|
setTracerProvider,
|
|
9
|
-
verifyAccess
|
|
10
|
-
|
|
14
|
+
verifyAccess,
|
|
15
|
+
verifyAccessProof,
|
|
16
|
+
version
|
|
17
|
+
} from "./chunk-4EH7RLTD.js";
|
|
11
18
|
import {
|
|
12
19
|
safeJsonStringify
|
|
13
20
|
} from "./chunk-2UDLZC33.js";
|
|
14
21
|
export {
|
|
15
22
|
HeadersAdapter,
|
|
16
23
|
RequestCookiesAdapter,
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
createAccessProof,
|
|
25
|
+
decryptFlagDefinitions,
|
|
26
|
+
decryptFlagValues,
|
|
27
|
+
decryptOverrides,
|
|
28
|
+
encryptFlagDefinitions,
|
|
29
|
+
encryptFlagValues,
|
|
30
|
+
encryptOverrides,
|
|
19
31
|
mergeProviderData,
|
|
20
32
|
reportValue,
|
|
21
33
|
safeJsonStringify,
|
|
22
34
|
setTracerProvider,
|
|
23
|
-
verifyAccess
|
|
35
|
+
verifyAccess,
|
|
36
|
+
verifyAccessProof,
|
|
37
|
+
version
|
|
24
38
|
};
|
|
25
39
|
//# sourceMappingURL=index.js.map
|
package/dist/next.cjs
CHANGED
|
@@ -12,7 +12,9 @@ var _chunkQLJ65HXQcjs = require('./chunk-QLJ65HXQ.cjs');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkL3FUM2STcjs = require('./chunk-L3FUM2ST.cjs');
|
|
16
18
|
require('./chunk-MEG7RDX7.cjs');
|
|
17
19
|
|
|
18
20
|
// src/next/index.ts
|
|
@@ -20,7 +22,7 @@ var _cookies = require('@edge-runtime/cookies');
|
|
|
20
22
|
|
|
21
23
|
// src/next/overrides.ts
|
|
22
24
|
var memoizedDecrypt = _chunkQLJ65HXQcjs.memoizeOne.call(void 0,
|
|
23
|
-
(text) =>
|
|
25
|
+
(text) => _chunkL3FUM2STcjs.decryptOverrides.call(void 0, text),
|
|
24
26
|
(a, b) => a[0] === b[0],
|
|
25
27
|
// only the first argument gets compared
|
|
26
28
|
{ cachePromiseRejection: true }
|
|
@@ -182,10 +184,29 @@ function dedupe(fn) {
|
|
|
182
184
|
};
|
|
183
185
|
}
|
|
184
186
|
|
|
187
|
+
// src/next/create-flags-discovery-endpoint.ts
|
|
188
|
+
function createFlagsDiscoveryEndpoint(getApiData, options) {
|
|
189
|
+
return async (request) => {
|
|
190
|
+
const access = await _chunkL3FUM2STcjs.verifyAccess.call(void 0,
|
|
191
|
+
request.headers.get("Authorization"),
|
|
192
|
+
_optionalChain([options, 'optionalAccess', _ => _.secret])
|
|
193
|
+
);
|
|
194
|
+
if (!access)
|
|
195
|
+
return Response.json(null, { status: 401 });
|
|
196
|
+
const apiData = await getApiData(request);
|
|
197
|
+
return new Response(JSON.stringify(apiData), {
|
|
198
|
+
headers: {
|
|
199
|
+
"x-flags-sdk-version": _chunkL3FUM2STcjs.version,
|
|
200
|
+
"content-type": "application/json"
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
185
206
|
// src/next/index.ts
|
|
186
207
|
var evaluationCache = /* @__PURE__ */ new WeakMap();
|
|
187
208
|
function getCachedValuePromise(headers, flagKey, entitiesKey) {
|
|
188
|
-
const map = _optionalChain([evaluationCache, 'access',
|
|
209
|
+
const map = _optionalChain([evaluationCache, 'access', _2 => _2.get, 'call', _3 => _3(headers), 'optionalAccess', _4 => _4.get, 'call', _5 => _5(flagKey)]);
|
|
189
210
|
if (!map)
|
|
190
211
|
return void 0;
|
|
191
212
|
return map.get(entitiesKey);
|
|
@@ -229,7 +250,7 @@ function sealHeaders(headers) {
|
|
|
229
250
|
const cached = headersMap.get(headers);
|
|
230
251
|
if (cached !== void 0)
|
|
231
252
|
return cached;
|
|
232
|
-
const sealed =
|
|
253
|
+
const sealed = _chunkL3FUM2STcjs.HeadersAdapter.seal(headers);
|
|
233
254
|
headersMap.set(headers, sealed);
|
|
234
255
|
return sealed;
|
|
235
256
|
}
|
|
@@ -237,7 +258,7 @@ function sealCookies(headers) {
|
|
|
237
258
|
const cached = cookiesMap.get(headers);
|
|
238
259
|
if (cached !== void 0)
|
|
239
260
|
return cached;
|
|
240
|
-
const sealed =
|
|
261
|
+
const sealed = _chunkL3FUM2STcjs.RequestCookiesAdapter.seal(new (0, _cookies.RequestCookies)(headers));
|
|
241
262
|
cookiesMap.set(headers, sealed);
|
|
242
263
|
return sealed;
|
|
243
264
|
}
|
|
@@ -263,7 +284,7 @@ function getDecide(definition) {
|
|
|
263
284
|
if (typeof definition.decide === "function") {
|
|
264
285
|
return definition.decide(params);
|
|
265
286
|
}
|
|
266
|
-
if (typeof _optionalChain([definition, 'access',
|
|
287
|
+
if (typeof _optionalChain([definition, 'access', _6 => _6.adapter, 'optionalAccess', _7 => _7.decide]) === "function") {
|
|
267
288
|
return definition.adapter.decide({ key: definition.key, ...params });
|
|
268
289
|
}
|
|
269
290
|
throw new Error(`flags: No decide function provided for ${definition.key}`);
|
|
@@ -274,7 +295,7 @@ function getIdentify(definition) {
|
|
|
274
295
|
if (typeof definition.identify === "function") {
|
|
275
296
|
return definition.identify(params);
|
|
276
297
|
}
|
|
277
|
-
if (typeof _optionalChain([definition, 'access',
|
|
298
|
+
if (typeof _optionalChain([definition, 'access', _8 => _8.adapter, 'optionalAccess', _9 => _9.identify]) === "function") {
|
|
278
299
|
return definition.adapter.identify(params);
|
|
279
300
|
}
|
|
280
301
|
return definition.identify;
|
|
@@ -301,7 +322,7 @@ function getRun(definition, decide) {
|
|
|
301
322
|
dedupeCacheKey = headersStore;
|
|
302
323
|
}
|
|
303
324
|
const overrides = await getOverrides(
|
|
304
|
-
_optionalChain([readonlyCookies, 'access',
|
|
325
|
+
_optionalChain([readonlyCookies, 'access', _10 => _10.get, 'call', _11 => _11("vercel-flag-overrides"), 'optionalAccess', _12 => _12.value])
|
|
305
326
|
);
|
|
306
327
|
const entities = await getEntities(
|
|
307
328
|
options.identify,
|
|
@@ -316,12 +337,12 @@ function getRun(definition, decide) {
|
|
|
316
337
|
entitiesKey
|
|
317
338
|
);
|
|
318
339
|
if (cachedValue !== void 0) {
|
|
319
|
-
|
|
340
|
+
_chunkL3FUM2STcjs.setSpanAttribute.call(void 0, "method", "cached");
|
|
320
341
|
const value = await cachedValue;
|
|
321
342
|
return value;
|
|
322
343
|
}
|
|
323
344
|
if (overrides && overrides[definition.key] !== void 0) {
|
|
324
|
-
|
|
345
|
+
_chunkL3FUM2STcjs.setSpanAttribute.call(void 0, "method", "override");
|
|
325
346
|
const decision2 = overrides[definition.key];
|
|
326
347
|
setCachedValuePromise(
|
|
327
348
|
readonlyHeaders,
|
|
@@ -329,7 +350,7 @@ function getRun(definition, decide) {
|
|
|
329
350
|
entitiesKey,
|
|
330
351
|
Promise.resolve(decision2)
|
|
331
352
|
);
|
|
332
|
-
|
|
353
|
+
_chunkL3FUM2STcjs.internalReportValue.call(void 0, definition.key, decision2, {
|
|
333
354
|
reason: "override"
|
|
334
355
|
});
|
|
335
356
|
return decision2;
|
|
@@ -381,8 +402,8 @@ function getRun(definition, decide) {
|
|
|
381
402
|
decisionPromise
|
|
382
403
|
);
|
|
383
404
|
const decision = await decisionPromise;
|
|
384
|
-
if (_optionalChain([definition, 'access',
|
|
385
|
-
|
|
405
|
+
if (_optionalChain([definition, 'access', _13 => _13.config, 'optionalAccess', _14 => _14.reportValue]) !== false) {
|
|
406
|
+
_chunkL3FUM2STcjs.reportValue.call(void 0, definition.key, decision);
|
|
386
407
|
}
|
|
387
408
|
return decision;
|
|
388
409
|
};
|
|
@@ -390,22 +411,22 @@ function getRun(definition, decide) {
|
|
|
390
411
|
function getOrigin(definition) {
|
|
391
412
|
if (definition.origin)
|
|
392
413
|
return definition.origin;
|
|
393
|
-
if (typeof _optionalChain([definition, 'access',
|
|
414
|
+
if (typeof _optionalChain([definition, 'access', _15 => _15.adapter, 'optionalAccess', _16 => _16.origin]) === "function")
|
|
394
415
|
return definition.adapter.origin(definition.key);
|
|
395
|
-
return _optionalChain([definition, 'access',
|
|
416
|
+
return _optionalChain([definition, 'access', _17 => _17.adapter, 'optionalAccess', _18 => _18.origin]);
|
|
396
417
|
}
|
|
397
418
|
function flag(definition) {
|
|
398
419
|
const decide = getDecide(definition);
|
|
399
420
|
const identify = getIdentify(definition);
|
|
400
421
|
const run = getRun(definition, decide);
|
|
401
422
|
const origin = getOrigin(definition);
|
|
402
|
-
const flag2 =
|
|
423
|
+
const flag2 = _chunkL3FUM2STcjs.trace.call(void 0,
|
|
403
424
|
async (...args) => {
|
|
404
|
-
|
|
425
|
+
_chunkL3FUM2STcjs.setSpanAttribute.call(void 0, "method", "decided");
|
|
405
426
|
if (typeof args[0] === "string" && Array.isArray(args[1])) {
|
|
406
427
|
const [precomputedCode, precomputedGroup, secret] = args;
|
|
407
428
|
if (precomputedCode && precomputedGroup) {
|
|
408
|
-
|
|
429
|
+
_chunkL3FUM2STcjs.setSpanAttribute.call(void 0, "method", "precomputed");
|
|
409
430
|
return getPrecomputed(
|
|
410
431
|
flag2,
|
|
411
432
|
precomputedGroup,
|
|
@@ -431,17 +452,17 @@ function flag(definition) {
|
|
|
431
452
|
flag2.origin = origin;
|
|
432
453
|
flag2.options = _chunkQLJ65HXQcjs.normalizeOptions.call(void 0, definition.options);
|
|
433
454
|
flag2.description = definition.description;
|
|
434
|
-
flag2.identify = identify ?
|
|
455
|
+
flag2.identify = identify ? _chunkL3FUM2STcjs.trace.call(void 0, identify, {
|
|
435
456
|
isVerboseTrace: false,
|
|
436
457
|
name: "identify",
|
|
437
458
|
attributes: { key: definition.key }
|
|
438
459
|
}) : identify;
|
|
439
|
-
flag2.decide =
|
|
460
|
+
flag2.decide = _chunkL3FUM2STcjs.trace.call(void 0, decide, {
|
|
440
461
|
isVerboseTrace: false,
|
|
441
462
|
name: "decide",
|
|
442
463
|
attributes: { key: definition.key }
|
|
443
464
|
});
|
|
444
|
-
flag2.run =
|
|
465
|
+
flag2.run = _chunkL3FUM2STcjs.trace.call(void 0, run, {
|
|
445
466
|
isVerboseTrace: false,
|
|
446
467
|
name: "run",
|
|
447
468
|
attributes: { key: definition.key }
|
|
@@ -472,5 +493,6 @@ function getProviderData(flags) {
|
|
|
472
493
|
|
|
473
494
|
|
|
474
495
|
|
|
475
|
-
|
|
496
|
+
|
|
497
|
+
exports.combine = combine; exports.createFlagsDiscoveryEndpoint = createFlagsDiscoveryEndpoint; exports.dedupe = dedupe; exports.deserialize = deserialize2; exports.evaluate = evaluate; exports.flag = flag; exports.generatePermutations = generatePermutations; exports.getPrecomputed = getPrecomputed; exports.getProviderData = getProviderData; exports.precompute = precompute; exports.serialize = serialize2;
|
|
476
498
|
//# sourceMappingURL=next.cjs.map
|