@barekey/sdk 0.2.0 → 0.3.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/dist/client.d.ts +9 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +159 -39
- package/dist/handle.d.ts +15 -1
- package/dist/handle.d.ts.map +1 -1
- package/dist/handle.js +59 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/evaluate.d.ts.map +1 -1
- package/dist/internal/evaluate.js +3 -0
- package/dist/internal/singleton.d.ts +5 -0
- package/dist/internal/singleton.d.ts.map +1 -0
- package/dist/internal/singleton.js +135 -0
- package/dist/key-types.typecheck.d.ts.map +1 -1
- package/dist/key-types.typecheck.js +2 -0
- package/dist/public-client.d.ts +8 -3
- package/dist/public-client.d.ts.map +1 -1
- package/dist/public-client.js +106 -9
- package/dist/public-types.d.ts +3 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/public.d.ts +3 -3
- package/dist/public.d.ts.map +1 -1
- package/dist/public.js +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/types.d.ts +18 -0
- package/dist/types.d.ts.map +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/client.ts +231 -48
- package/src/handle.ts +90 -2
- package/src/index.ts +11 -1
- package/src/internal/evaluate.ts +3 -0
- package/src/internal/singleton.ts +183 -0
- package/src/key-types.typecheck.ts +14 -2
- package/src/public-client.ts +159 -16
- package/src/public-types.ts +10 -0
- package/src/public.ts +8 -1
- package/src/server.ts +8 -1
- package/src/types.ts +36 -0
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BarekeyEnvHandle } from "./handle.js";
|
|
2
|
-
import type { BarekeyClientOptions,
|
|
1
|
+
import { BarekeyEnvBatchHandle, BarekeyEnvHandle } from "./handle.js";
|
|
2
|
+
import type { BarekeyClientOptions, BarekeyGeneratedValueForKey, BarekeyGeneratedValuesForKeys, BarekeyGetOptions, BarekeyJsonConfig, BarekeyKey, BarekeyTypegenResult } from "./types.js";
|
|
3
3
|
export declare class BarekeyClient {
|
|
4
4
|
private readonly options;
|
|
5
5
|
private readonly fetchFn;
|
|
@@ -21,7 +21,8 @@ export declare class BarekeyClient {
|
|
|
21
21
|
requirements?: BarekeyClientOptions["requirements"];
|
|
22
22
|
typegen?: BarekeyClientOptions["typegen"];
|
|
23
23
|
});
|
|
24
|
-
get<TKey extends BarekeyKey>(name: TKey, options?: BarekeyGetOptions): BarekeyEnvHandle<TKey
|
|
24
|
+
get<TKey extends BarekeyKey>(name: TKey, options?: BarekeyGetOptions): BarekeyEnvHandle<BarekeyGeneratedValueForKey<TKey>>;
|
|
25
|
+
get<const TKeys extends readonly BarekeyKey[]>(names: TKeys, options?: BarekeyGetOptions): BarekeyEnvBatchHandle<BarekeyGeneratedValuesForKeys<TKeys>>;
|
|
25
26
|
typegen(): Promise<BarekeyTypegenResult>;
|
|
26
27
|
private getRuntimeContext;
|
|
27
28
|
private fetchTypegenManifest;
|
|
@@ -32,9 +33,14 @@ export declare class BarekeyClient {
|
|
|
32
33
|
private buildEvaluationCacheKey;
|
|
33
34
|
private fetchDefinitions;
|
|
34
35
|
private ensureRequirementsValidated;
|
|
36
|
+
private getStaticDefinitions;
|
|
35
37
|
private getStaticDefinition;
|
|
36
38
|
private resolveStaticValue;
|
|
39
|
+
private resolveStaticValues;
|
|
40
|
+
private fetchDynamicValues;
|
|
37
41
|
private resolveDynamicValue;
|
|
42
|
+
private resolveDynamicValues;
|
|
38
43
|
private resolveEvaluatedValue;
|
|
44
|
+
private resolveEvaluatedValues;
|
|
39
45
|
}
|
|
40
46
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAmBtE,OAAO,KAAK,EACV,oBAAoB,EAEpB,2BAA2B,EAC3B,6BAA6B,EAC7B,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAqFpB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgD;IAChF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA4C;IAC5E,OAAO,CAAC,qBAAqB,CAA+C;IAC5E,OAAO,CAAC,mBAAmB,CAA8B;IACzD,OAAO,CAAC,qBAAqB,CAAS;;gBAG1B,OAAO,EAAE;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAC;QACpD,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;KAC3C;gBACW,OAAO,EAAE;QACnB,IAAI,EAAE,iBAAiB,CAAC;QACxB,YAAY,CAAC,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAAC;QACpD,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;KAC3C;IAaD,GAAG,CAAC,IAAI,SAAS,UAAU,EACzB,IAAI,EAAE,IAAI,EACV,OAAO,CAAC,EAAE,iBAAiB,GAC1B,gBAAgB,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC;IACtD,GAAG,CAAC,KAAK,CAAC,KAAK,SAAS,SAAS,UAAU,EAAE,EAC3C,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,iBAAiB,GAC1B,qBAAqB,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAgBxD,OAAO,IAAI,OAAO,CAAC,oBAAoB,CAAC;YAkBhC,iBAAiB;YAajB,oBAAoB;IAclC,OAAO,CAAC,oBAAoB;YAWd,mBAAmB;IA6EjC,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,uBAAuB;YAejB,gBAAgB;YA0BhB,2BAA2B;YA4B3B,oBAAoB;YAkCpB,mBAAmB;YASnB,kBAAkB;YAQlB,mBAAmB;YAUnB,kBAAkB;YAwDlB,mBAAmB;YAkCnB,oBAAoB;YAuCpB,qBAAqB;YAarB,sBAAsB;CAsBrC"}
|
package/dist/client.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { BillingUnavailableError, FsNotAvailableError, NetworkError, VariableNotFoundError, } from "./errors.js";
|
|
2
|
-
import { BarekeyEnvHandle } from "./handle.js";
|
|
2
|
+
import { BarekeyEnvBatchHandle, BarekeyEnvHandle } from "./handle.js";
|
|
3
3
|
import { evaluateDefinition, inferSelectedArmFromDecision, parseDeclaredValue, validateDynamicOptions, } from "./internal/evaluate.js";
|
|
4
4
|
import { getJson, postJson } from "./internal/http.js";
|
|
5
5
|
import { validateRequirements } from "./internal/requirements.js";
|
|
6
6
|
import { resolveRuntimeContext } from "./internal/runtime.js";
|
|
7
|
+
import { createBarekeyClientSingletonKey } from "./internal/singleton.js";
|
|
7
8
|
import { MemoryCache } from "./internal/cache.js";
|
|
8
9
|
import { DEFAULT_TYPEGEN_TTL_MS, resolveTtlMilliseconds } from "./internal/ttl.js";
|
|
9
10
|
import { hasFreshInstalledSdkTypegen, resolveInstalledSdkGeneratedTypesPath, writeInstalledSdkGeneratedTypes, } from "./internal/typegen.js";
|
|
10
11
|
const sharedTypegenWatchers = new Map();
|
|
12
|
+
const sharedClients = new Map();
|
|
11
13
|
function createDefaultFetch() {
|
|
12
14
|
if (typeof globalThis.fetch === "function") {
|
|
13
15
|
return globalThis.fetch.bind(globalThis);
|
|
@@ -29,6 +31,30 @@ function warnAutomaticTypegenFailure(error) {
|
|
|
29
31
|
const message = error instanceof Error ? error.message : "Barekey automatic typegen refresh failed.";
|
|
30
32
|
console.warn(`[barekey] Automatic typegen refresh failed.\n${message}`);
|
|
31
33
|
}
|
|
34
|
+
function uniqueNames(names) {
|
|
35
|
+
return [...new Set(names)];
|
|
36
|
+
}
|
|
37
|
+
function mapValuesToRequestedOrder(names, values) {
|
|
38
|
+
const byName = new Map(values.map((value) => [value.name, value]));
|
|
39
|
+
return names.map((name) => {
|
|
40
|
+
const resolved = byName.get(name);
|
|
41
|
+
if (resolved === undefined) {
|
|
42
|
+
throw new VariableNotFoundError();
|
|
43
|
+
}
|
|
44
|
+
return resolved;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function resolveEvaluatedResponse(evaluated) {
|
|
48
|
+
return {
|
|
49
|
+
name: evaluated.name,
|
|
50
|
+
kind: evaluated.kind,
|
|
51
|
+
declaredType: evaluated.declaredType,
|
|
52
|
+
visibility: evaluated.visibility,
|
|
53
|
+
value: evaluated.value,
|
|
54
|
+
decision: evaluated.decision,
|
|
55
|
+
selectedArm: inferSelectedArmFromDecision(evaluated.decision),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
32
58
|
export class BarekeyClient {
|
|
33
59
|
options;
|
|
34
60
|
fetchFn;
|
|
@@ -38,11 +64,20 @@ export class BarekeyClient {
|
|
|
38
64
|
requirementsPromise = null;
|
|
39
65
|
typegenWatcherStarted = false;
|
|
40
66
|
constructor(options = {}) {
|
|
67
|
+
const singletonKey = createBarekeyClientSingletonKey(options);
|
|
68
|
+
const existing = sharedClients.get(singletonKey);
|
|
69
|
+
if (existing !== undefined) {
|
|
70
|
+
return existing;
|
|
71
|
+
}
|
|
41
72
|
this.options = options;
|
|
42
73
|
this.fetchFn = createDefaultFetch();
|
|
74
|
+
sharedClients.set(singletonKey, this);
|
|
43
75
|
}
|
|
44
|
-
get(
|
|
45
|
-
|
|
76
|
+
get(nameOrNames, options) {
|
|
77
|
+
if (Array.isArray(nameOrNames)) {
|
|
78
|
+
return new BarekeyEnvBatchHandle(async () => await this.resolveEvaluatedValues(nameOrNames, options));
|
|
79
|
+
}
|
|
80
|
+
return new BarekeyEnvHandle(async () => await this.resolveEvaluatedValue(nameOrNames, options));
|
|
46
81
|
}
|
|
47
82
|
async typegen() {
|
|
48
83
|
const context = await this.getRuntimeContext();
|
|
@@ -183,6 +218,9 @@ export class BarekeyClient {
|
|
|
183
218
|
].join("|");
|
|
184
219
|
}
|
|
185
220
|
async fetchDefinitions(names) {
|
|
221
|
+
if (names !== undefined && names.length === 0) {
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
186
224
|
const context = await this.getRuntimeContext();
|
|
187
225
|
const response = await postJson({
|
|
188
226
|
fetchFn: this.fetchFn,
|
|
@@ -226,15 +264,35 @@ export class BarekeyClient {
|
|
|
226
264
|
}
|
|
227
265
|
await this.requirementsPromise;
|
|
228
266
|
}
|
|
229
|
-
async
|
|
267
|
+
async getStaticDefinitions(names) {
|
|
230
268
|
await this.ensureRequirementsValidated();
|
|
231
269
|
const context = await this.getRuntimeContext();
|
|
232
|
-
const
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
270
|
+
const cachedDefinitions = new Map();
|
|
271
|
+
const missingNames = [];
|
|
272
|
+
for (const name of uniqueNames(names)) {
|
|
273
|
+
const cacheKey = this.buildDefinitionCacheKey(context, name);
|
|
274
|
+
const cached = this.definitionCache.get(cacheKey);
|
|
275
|
+
if (cached !== null) {
|
|
276
|
+
cachedDefinitions.set(name, cached);
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
missingNames.push(name);
|
|
280
|
+
}
|
|
281
|
+
if (missingNames.length > 0) {
|
|
282
|
+
for (const definition of await this.fetchDefinitions(missingNames)) {
|
|
283
|
+
cachedDefinitions.set(definition.name, definition);
|
|
284
|
+
}
|
|
236
285
|
}
|
|
237
|
-
|
|
286
|
+
return names.map((name) => {
|
|
287
|
+
const resolved = cachedDefinitions.get(name);
|
|
288
|
+
if (resolved === undefined) {
|
|
289
|
+
throw new VariableNotFoundError();
|
|
290
|
+
}
|
|
291
|
+
return resolved;
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
async getStaticDefinition(name) {
|
|
295
|
+
const definitions = await this.getStaticDefinitions([name]);
|
|
238
296
|
const resolved = definitions[0];
|
|
239
297
|
if (resolved === undefined) {
|
|
240
298
|
throw new VariableNotFoundError();
|
|
@@ -245,55 +303,71 @@ export class BarekeyClient {
|
|
|
245
303
|
const definition = await this.getStaticDefinition(name);
|
|
246
304
|
return await evaluateDefinition(definition, options);
|
|
247
305
|
}
|
|
248
|
-
async
|
|
249
|
-
await this.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const dynamicTtlMs = dynamic !== undefined && dynamic !== true
|
|
254
|
-
? resolveTtlMilliseconds(dynamic.ttl, "dynamic.ttl")
|
|
255
|
-
: null;
|
|
256
|
-
if (dynamic !== true) {
|
|
257
|
-
const cached = this.evaluationCache.getRecord(cacheKey);
|
|
258
|
-
if (cached !== null && dynamicTtlMs !== null && Date.now() - cached.storedAtMs <= dynamicTtlMs) {
|
|
259
|
-
return cached.value;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
let resolved;
|
|
306
|
+
async resolveStaticValues(names, options) {
|
|
307
|
+
const definitions = await this.getStaticDefinitions(names);
|
|
308
|
+
return await Promise.all(definitions.map(async (definition) => await evaluateDefinition(definition, options)));
|
|
309
|
+
}
|
|
310
|
+
async fetchDynamicValues(names, context, options) {
|
|
263
311
|
try {
|
|
312
|
+
if (names.length === 1) {
|
|
313
|
+
const evaluated = await postJson({
|
|
314
|
+
fetchFn: this.fetchFn,
|
|
315
|
+
baseUrl: context.baseUrl,
|
|
316
|
+
path: "/v1/env/evaluate",
|
|
317
|
+
payload: {
|
|
318
|
+
orgSlug: context.organization,
|
|
319
|
+
projectSlug: context.project,
|
|
320
|
+
stageSlug: context.environment,
|
|
321
|
+
name: names[0],
|
|
322
|
+
seed: options?.seed,
|
|
323
|
+
key: options?.key,
|
|
324
|
+
},
|
|
325
|
+
auth: context.auth,
|
|
326
|
+
});
|
|
327
|
+
return [resolveEvaluatedResponse(evaluated)];
|
|
328
|
+
}
|
|
264
329
|
const evaluated = await postJson({
|
|
265
330
|
fetchFn: this.fetchFn,
|
|
266
331
|
baseUrl: context.baseUrl,
|
|
267
|
-
path: "/v1/env/evaluate",
|
|
332
|
+
path: "/v1/env/evaluate-batch",
|
|
268
333
|
payload: {
|
|
269
334
|
orgSlug: context.organization,
|
|
270
335
|
projectSlug: context.project,
|
|
271
336
|
stageSlug: context.environment,
|
|
272
|
-
|
|
337
|
+
names,
|
|
273
338
|
seed: options?.seed,
|
|
274
339
|
key: options?.key,
|
|
275
340
|
},
|
|
276
341
|
auth: context.auth,
|
|
277
342
|
});
|
|
278
|
-
|
|
279
|
-
name: evaluated.name,
|
|
280
|
-
kind: evaluated.kind,
|
|
281
|
-
declaredType: evaluated.declaredType,
|
|
282
|
-
value: evaluated.value,
|
|
283
|
-
decision: evaluated.decision,
|
|
284
|
-
selectedArm: inferSelectedArmFromDecision(evaluated.decision),
|
|
285
|
-
};
|
|
343
|
+
return mapValuesToRequestedOrder(names, evaluated.values.map((value) => resolveEvaluatedResponse(value)));
|
|
286
344
|
}
|
|
287
345
|
catch (error) {
|
|
288
346
|
if (!(error instanceof BillingUnavailableError)) {
|
|
289
347
|
throw error;
|
|
290
348
|
}
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
349
|
+
const definitions = await this.getStaticDefinitions(names);
|
|
350
|
+
return await Promise.all(definitions.map(async (definition) => await evaluateDefinition(definition, options)));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
async resolveDynamicValue(name, options) {
|
|
354
|
+
await this.ensureRequirementsValidated();
|
|
355
|
+
const context = await this.getRuntimeContext();
|
|
356
|
+
const cacheKey = this.buildEvaluationCacheKey(context, name, options);
|
|
357
|
+
const dynamic = options?.dynamic;
|
|
358
|
+
const dynamicTtlMs = dynamic !== undefined && dynamic !== true
|
|
359
|
+
? resolveTtlMilliseconds(dynamic.ttl, "dynamic.ttl")
|
|
360
|
+
: null;
|
|
361
|
+
if (dynamic !== true) {
|
|
362
|
+
const cached = this.evaluationCache.getRecord(cacheKey);
|
|
363
|
+
if (cached !== null && dynamicTtlMs !== null && Date.now() - cached.storedAtMs <= dynamicTtlMs) {
|
|
364
|
+
return cached.value;
|
|
295
365
|
}
|
|
296
|
-
|
|
366
|
+
}
|
|
367
|
+
const resolvedValues = await this.fetchDynamicValues([name], context, options);
|
|
368
|
+
const resolved = resolvedValues[0];
|
|
369
|
+
if (resolved === undefined) {
|
|
370
|
+
throw new VariableNotFoundError();
|
|
297
371
|
}
|
|
298
372
|
if (dynamicTtlMs !== null) {
|
|
299
373
|
// dynamic.ttl is evaluated per read, so keep the cached fetch time and let
|
|
@@ -302,6 +376,36 @@ export class BarekeyClient {
|
|
|
302
376
|
}
|
|
303
377
|
return resolved;
|
|
304
378
|
}
|
|
379
|
+
async resolveDynamicValues(names, options) {
|
|
380
|
+
await this.ensureRequirementsValidated();
|
|
381
|
+
const context = await this.getRuntimeContext();
|
|
382
|
+
const dynamic = options?.dynamic;
|
|
383
|
+
const dynamicTtlMs = dynamic !== undefined && dynamic !== true
|
|
384
|
+
? resolveTtlMilliseconds(dynamic.ttl, "dynamic.ttl")
|
|
385
|
+
: null;
|
|
386
|
+
const resolvedValues = new Map();
|
|
387
|
+
const missingNames = [];
|
|
388
|
+
for (const name of uniqueNames(names)) {
|
|
389
|
+
const cacheKey = this.buildEvaluationCacheKey(context, name, options);
|
|
390
|
+
if (dynamic !== true) {
|
|
391
|
+
const cached = this.evaluationCache.getRecord(cacheKey);
|
|
392
|
+
if (cached !== null && dynamicTtlMs !== null && Date.now() - cached.storedAtMs <= dynamicTtlMs) {
|
|
393
|
+
resolvedValues.set(name, cached.value);
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
missingNames.push(name);
|
|
398
|
+
}
|
|
399
|
+
if (missingNames.length > 0) {
|
|
400
|
+
for (const resolved of await this.fetchDynamicValues(missingNames, context, options)) {
|
|
401
|
+
resolvedValues.set(resolved.name, resolved);
|
|
402
|
+
if (dynamicTtlMs !== null) {
|
|
403
|
+
this.evaluationCache.set(this.buildEvaluationCacheKey(context, resolved.name, options), resolved);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return mapValuesToRequestedOrder(names, [...resolvedValues.values()]);
|
|
408
|
+
}
|
|
305
409
|
async resolveEvaluatedValue(name, options) {
|
|
306
410
|
const context = await this.getRuntimeContext();
|
|
307
411
|
this.ensureTypegenWatcher(context);
|
|
@@ -311,4 +415,20 @@ export class BarekeyClient {
|
|
|
311
415
|
}
|
|
312
416
|
return await this.resolveDynamicValue(name, options);
|
|
313
417
|
}
|
|
418
|
+
async resolveEvaluatedValues(names, options) {
|
|
419
|
+
if (names.length === 0) {
|
|
420
|
+
return [];
|
|
421
|
+
}
|
|
422
|
+
if (uniqueNames(names).length === 1) {
|
|
423
|
+
const resolved = await this.resolveEvaluatedValue(names[0] ?? "", options);
|
|
424
|
+
return names.map(() => resolved);
|
|
425
|
+
}
|
|
426
|
+
const context = await this.getRuntimeContext();
|
|
427
|
+
this.ensureTypegenWatcher(context);
|
|
428
|
+
validateDynamicOptions(options);
|
|
429
|
+
if (options?.dynamic === undefined) {
|
|
430
|
+
return await this.resolveStaticValues(names, options);
|
|
431
|
+
}
|
|
432
|
+
return await this.resolveDynamicValues(names, options);
|
|
433
|
+
}
|
|
314
434
|
}
|
package/dist/handle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BarekeyCoerceTarget, BarekeyEvaluatedValue } from "./types.js";
|
|
1
|
+
import type { BarekeyCoerceTarget, BarekeyEvaluatedValue, BarekeyResolvedRecord, BarekeyResolvedRecords } from "./types.js";
|
|
2
2
|
type BarekeyCoercibleEnvMarker = {
|
|
3
3
|
readonly __barekey?: {
|
|
4
4
|
readonly mode: "ab";
|
|
@@ -8,13 +8,27 @@ export declare class BarekeyEnvHandle<TValue = unknown> implements PromiseLike<T
|
|
|
8
8
|
private readonly resolveEvaluatedValue;
|
|
9
9
|
private readonly transform;
|
|
10
10
|
private evaluatedValuePromise;
|
|
11
|
+
private resolvedRecordPromise;
|
|
11
12
|
constructor(resolveEvaluatedValue: () => Promise<BarekeyEvaluatedValue>, transform?: (resolved: BarekeyEvaluatedValue) => Promise<TValue>);
|
|
12
13
|
private resolveValue;
|
|
13
14
|
private getEvaluatedValue;
|
|
15
|
+
inspect(): Promise<BarekeyResolvedRecord<TValue>>;
|
|
14
16
|
coerce<TCoerced = unknown>(this: [TValue] extends [BarekeyCoercibleEnvMarker] ? BarekeyEnvHandle<TValue> : never, target: BarekeyCoerceTarget): BarekeyEnvHandle<TCoerced>;
|
|
15
17
|
then<TResult1 = TValue, TResult2 = never>(onfulfilled?: ((value: TValue) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
16
18
|
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<TValue | TResult>;
|
|
17
19
|
finally(onfinally?: (() => void) | null): Promise<TValue>;
|
|
18
20
|
}
|
|
21
|
+
export declare class BarekeyEnvBatchHandle<TValues extends ReadonlyArray<unknown> = Array<unknown>> implements PromiseLike<TValues> {
|
|
22
|
+
private readonly resolveEvaluatedValues;
|
|
23
|
+
private evaluatedValuesPromise;
|
|
24
|
+
private resolvedRecordsPromise;
|
|
25
|
+
constructor(resolveEvaluatedValues: () => Promise<ReadonlyArray<BarekeyEvaluatedValue>>);
|
|
26
|
+
private getEvaluatedValues;
|
|
27
|
+
inspect(): Promise<BarekeyResolvedRecords<TValues>>;
|
|
28
|
+
private resolveValues;
|
|
29
|
+
then<TResult1 = TValues, TResult2 = never>(onfulfilled?: ((value: TValues) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
30
|
+
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<TValues | TResult>;
|
|
31
|
+
finally(onfinally?: (() => void) | null): Promise<TValues>;
|
|
32
|
+
}
|
|
19
33
|
export {};
|
|
20
34
|
//# sourceMappingURL=handle.d.ts.map
|
package/dist/handle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"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"}
|
package/dist/handle.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { coerceEvaluatedValue, parseDeclaredValue, } from "./internal/evaluate.js";
|
|
2
|
+
function buildResolvedRecord(resolved, value) {
|
|
3
|
+
return {
|
|
4
|
+
...resolved,
|
|
5
|
+
rawValue: resolved.value,
|
|
6
|
+
value,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
2
9
|
export class BarekeyEnvHandle {
|
|
3
10
|
resolveEvaluatedValue;
|
|
4
11
|
transform;
|
|
5
12
|
evaluatedValuePromise = null;
|
|
13
|
+
resolvedRecordPromise = null;
|
|
6
14
|
constructor(resolveEvaluatedValue, transform) {
|
|
7
15
|
this.resolveEvaluatedValue = resolveEvaluatedValue;
|
|
8
16
|
this.transform =
|
|
@@ -10,7 +18,7 @@ export class BarekeyEnvHandle {
|
|
|
10
18
|
(async (resolved) => parseDeclaredValue(resolved.value, resolved.declaredType));
|
|
11
19
|
}
|
|
12
20
|
async resolveValue() {
|
|
13
|
-
return
|
|
21
|
+
return (await this.inspect()).value;
|
|
14
22
|
}
|
|
15
23
|
async getEvaluatedValue() {
|
|
16
24
|
if (this.evaluatedValuePromise === null) {
|
|
@@ -18,6 +26,16 @@ export class BarekeyEnvHandle {
|
|
|
18
26
|
}
|
|
19
27
|
return await this.evaluatedValuePromise;
|
|
20
28
|
}
|
|
29
|
+
async inspect() {
|
|
30
|
+
if (this.resolvedRecordPromise === null) {
|
|
31
|
+
this.resolvedRecordPromise = (async () => {
|
|
32
|
+
const resolved = await this.getEvaluatedValue();
|
|
33
|
+
const value = await this.transform(resolved);
|
|
34
|
+
return buildResolvedRecord(resolved, value);
|
|
35
|
+
})();
|
|
36
|
+
}
|
|
37
|
+
return await this.resolvedRecordPromise;
|
|
38
|
+
}
|
|
21
39
|
coerce(target) {
|
|
22
40
|
return new BarekeyEnvHandle(async () => await this.getEvaluatedValue(), async (resolved) => {
|
|
23
41
|
return coerceEvaluatedValue(resolved, target);
|
|
@@ -33,3 +51,43 @@ export class BarekeyEnvHandle {
|
|
|
33
51
|
return this.resolveValue().finally(onfinally ?? undefined);
|
|
34
52
|
}
|
|
35
53
|
}
|
|
54
|
+
export class BarekeyEnvBatchHandle {
|
|
55
|
+
resolveEvaluatedValues;
|
|
56
|
+
evaluatedValuesPromise = null;
|
|
57
|
+
resolvedRecordsPromise = null;
|
|
58
|
+
constructor(resolveEvaluatedValues) {
|
|
59
|
+
this.resolveEvaluatedValues = resolveEvaluatedValues;
|
|
60
|
+
}
|
|
61
|
+
async getEvaluatedValues() {
|
|
62
|
+
if (this.evaluatedValuesPromise === null) {
|
|
63
|
+
this.evaluatedValuesPromise = this.resolveEvaluatedValues();
|
|
64
|
+
}
|
|
65
|
+
return await this.evaluatedValuesPromise;
|
|
66
|
+
}
|
|
67
|
+
async inspect() {
|
|
68
|
+
if (this.resolvedRecordsPromise === null) {
|
|
69
|
+
this.resolvedRecordsPromise = (async () => {
|
|
70
|
+
const resolvedValues = await this.getEvaluatedValues();
|
|
71
|
+
const records = await Promise.all(resolvedValues.map(async (resolved) => {
|
|
72
|
+
const value = parseDeclaredValue(resolved.value, resolved.declaredType);
|
|
73
|
+
return buildResolvedRecord(resolved, value);
|
|
74
|
+
}));
|
|
75
|
+
return records;
|
|
76
|
+
})();
|
|
77
|
+
}
|
|
78
|
+
return await this.resolvedRecordsPromise;
|
|
79
|
+
}
|
|
80
|
+
async resolveValues() {
|
|
81
|
+
const resolvedRecords = await this.inspect();
|
|
82
|
+
return resolvedRecords.map((resolved) => resolved.value);
|
|
83
|
+
}
|
|
84
|
+
then(onfulfilled, onrejected) {
|
|
85
|
+
return this.resolveValues().then(onfulfilled ?? undefined, onrejected ?? undefined);
|
|
86
|
+
}
|
|
87
|
+
catch(onrejected) {
|
|
88
|
+
return this.resolveValues().catch(onrejected ?? undefined);
|
|
89
|
+
}
|
|
90
|
+
finally(onfinally) {
|
|
91
|
+
return this.resolveValues().finally(onfinally ?? undefined);
|
|
92
|
+
}
|
|
93
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { BarekeyClient } from "./client.js";
|
|
2
2
|
export { PublicBarekeyClient } from "./public-client.js";
|
|
3
|
-
export { BarekeyEnvHandle } from "./handle.js";
|
|
3
|
+
export { BarekeyEnvBatchHandle, BarekeyEnvHandle } from "./handle.js";
|
|
4
4
|
export { BarekeyError, BillingUnavailableError, CoerceFailedError, DeviceCodeExpiredError, DeviceCodeNotFoundError, EvaluationFailedError, FsNotAvailableError, InvalidConfigurationProvidedError, InvalidCredentialsProvidedError, InvalidDynamicOptionsError, InvalidJsonError, InvalidOrgScopeError, InvalidRefreshTokenError, InvalidRequestError, NetworkError, NoConfigurationProvidedError, NoCredentialsProvidedError, OrgScopeInvalidError, RequirementsValidationFailedError, SdkModuleNotFoundError, TemporalNotAvailableError, TypegenReadFailedError, TypegenUnsupportedSdkError, TypegenWriteFailedError, UnauthorizedError, UnknownError, UsageLimitExceededError, UserCodeInvalidError, VariableNotFoundError, createBarekeyErrorFromCode, docsUrlForErrorCode, formatBarekeyErrorMessage, isBarekeyErrorCode, normalizeErrorCode, } from "./errors.js";
|
|
5
|
-
export type { AB, BarekeyClientOptions, BarekeyCoerceTarget, BarekeyDeclaredType, BarekeyErrorCode, BarekeyGeneratedTypeMap, BarekeyGetOptions, BarekeyJsonConfig, BarekeyKey, BarekeyLiteralString, BarekeyKnownKey, BarekeyResolvedKind, BarekeyRolloutMilestone, BarekeyStandardSchemaV1, BarekeyTemporalInstant, BarekeyTemporalInstantLike, BarekeyTtlInput, BarekeyTypegenResult, Env, Linear, Secret, } from "./types.js";
|
|
6
|
-
export type { BarekeyPublicGeneratedTypeMap, BarekeyPublicKey, BarekeyPublicKnownKey, PublicBarekeyClientOptions, } from "./public-types.js";
|
|
5
|
+
export type { AB, BarekeyClientOptions, BarekeyCoerceTarget, BarekeyDeclaredType, BarekeyErrorCode, BarekeyEvaluatedValue, BarekeyGeneratedTypeMap, BarekeyGeneratedValueForKey, BarekeyGeneratedValuesForKeys, BarekeyGetOptions, BarekeyJsonConfig, BarekeyKey, BarekeyLiteralString, BarekeyKnownKey, BarekeyResolvedRecord, BarekeyResolvedRecords, BarekeyResolvedKind, BarekeyRolloutMilestone, BarekeyStandardSchemaV1, BarekeyTemporalInstant, BarekeyTemporalInstantLike, BarekeyTtlInput, BarekeyTypegenResult, BarekeyValueForGeneratedMap, BarekeyValuesForGeneratedMap, Env, Linear, Secret, BarekeyVisibility, } from "./types.js";
|
|
6
|
+
export type { BarekeyPublicGeneratedTypeMap, BarekeyPublicKey, BarekeyPublicKnownKey, BarekeyPublicValueForKey, BarekeyPublicValuesForKeys, PublicBarekeyClientOptions, } from "./public-types.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC1B,oBAAoB,EACpB,iCAAiC,EACjC,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,EAAE,EACF,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAC3B,6BAA6B,EAC7B,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,oBAAoB,EACpB,2BAA2B,EAC3B,4BAA4B,EAC5B,GAAG,EACH,MAAM,EACN,MAAM,EACN,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { BarekeyClient } from "./client.js";
|
|
2
2
|
export { PublicBarekeyClient } from "./public-client.js";
|
|
3
|
-
export { BarekeyEnvHandle } from "./handle.js";
|
|
3
|
+
export { BarekeyEnvBatchHandle, BarekeyEnvHandle } from "./handle.js";
|
|
4
4
|
export { BarekeyError, BillingUnavailableError, CoerceFailedError, DeviceCodeExpiredError, DeviceCodeNotFoundError, EvaluationFailedError, FsNotAvailableError, InvalidConfigurationProvidedError, InvalidCredentialsProvidedError, InvalidDynamicOptionsError, InvalidJsonError, InvalidOrgScopeError, InvalidRefreshTokenError, InvalidRequestError, NetworkError, NoConfigurationProvidedError, NoCredentialsProvidedError, OrgScopeInvalidError, RequirementsValidationFailedError, SdkModuleNotFoundError, TemporalNotAvailableError, TypegenReadFailedError, TypegenUnsupportedSdkError, TypegenWriteFailedError, UnauthorizedError, UnknownError, UsageLimitExceededError, UserCodeInvalidError, VariableNotFoundError, createBarekeyErrorFromCode, docsUrlForErrorCode, formatBarekeyErrorMessage, isBarekeyErrorCode, normalizeErrorCode, } from "./errors.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/internal/evaluate.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EAIjB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAgDrB,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAKxE;AAqHD,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,yBAAyB,EACrC,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,KAAK,CAAC,GAChD,OAAO,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/internal/evaluate.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EAIjB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAgDrB,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAKxE;AAqHD,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,yBAAyB,EACrC,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,KAAK,CAAC,GAChD,OAAO,CAAC,qBAAqB,CAAC,CA0DhC;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAQ9F;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAiB5F;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CA0BT"}
|
|
@@ -130,6 +130,7 @@ export async function evaluateDefinition(definition, options) {
|
|
|
130
130
|
name: definition.name,
|
|
131
131
|
kind: definition.kind,
|
|
132
132
|
declaredType: definition.declaredType,
|
|
133
|
+
visibility: definition.visibility,
|
|
133
134
|
value: definition.value,
|
|
134
135
|
};
|
|
135
136
|
}
|
|
@@ -144,6 +145,7 @@ export async function evaluateDefinition(definition, options) {
|
|
|
144
145
|
name: definition.name,
|
|
145
146
|
kind: definition.kind,
|
|
146
147
|
declaredType: definition.declaredType,
|
|
148
|
+
visibility: definition.visibility,
|
|
147
149
|
value: selectedArm === "A" ? definition.valueA : definition.valueB,
|
|
148
150
|
selectedArm,
|
|
149
151
|
decision: {
|
|
@@ -165,6 +167,7 @@ export async function evaluateDefinition(definition, options) {
|
|
|
165
167
|
name: definition.name,
|
|
166
168
|
kind: definition.kind,
|
|
167
169
|
declaredType: definition.declaredType,
|
|
170
|
+
visibility: definition.visibility,
|
|
168
171
|
value: selectedArm === "A" ? definition.valueA : definition.valueB,
|
|
169
172
|
selectedArm,
|
|
170
173
|
decision: {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PublicBarekeyClientOptions } from "../public-types.js";
|
|
2
|
+
import type { BarekeyClientOptions } from "../types.js";
|
|
3
|
+
export declare function createBarekeyClientSingletonKey(options: BarekeyClientOptions): string;
|
|
4
|
+
export declare function createPublicBarekeyClientSingletonKey(options: PublicBarekeyClientOptions): string;
|
|
5
|
+
//# sourceMappingURL=singleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../src/internal/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EACV,oBAAoB,EAIrB,MAAM,aAAa,CAAC;AAyJrB,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAYrF;AAED,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAOR"}
|