@glubean/sdk 0.2.1 → 0.2.3

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.
Files changed (119) hide show
  1. package/dist/bootstrap-registry.d.ts +38 -0
  2. package/dist/bootstrap-registry.d.ts.map +1 -0
  3. package/dist/bootstrap-registry.js +54 -0
  4. package/dist/bootstrap-registry.js.map +1 -0
  5. package/dist/configure/http.d.ts +25 -0
  6. package/dist/configure/http.d.ts.map +1 -0
  7. package/dist/configure/http.js +88 -0
  8. package/dist/configure/http.js.map +1 -0
  9. package/dist/configure/index.d.ts +78 -0
  10. package/dist/configure/index.d.ts.map +1 -0
  11. package/dist/configure/index.js +78 -0
  12. package/dist/configure/index.js.map +1 -0
  13. package/dist/configure/plugin.d.ts +23 -0
  14. package/dist/configure/plugin.d.ts.map +1 -0
  15. package/dist/configure/plugin.js +81 -0
  16. package/dist/configure/plugin.js.map +1 -0
  17. package/dist/configure/runtime.d.ts +24 -0
  18. package/dist/configure/runtime.d.ts.map +1 -0
  19. package/dist/configure/runtime.js +45 -0
  20. package/dist/configure/runtime.js.map +1 -0
  21. package/dist/configure/template.d.ts +22 -0
  22. package/dist/configure/template.d.ts.map +1 -0
  23. package/dist/configure/template.js +34 -0
  24. package/dist/configure/template.js.map +1 -0
  25. package/dist/configure/vars.d.ts +20 -0
  26. package/dist/configure/vars.d.ts.map +1 -0
  27. package/dist/configure/vars.js +48 -0
  28. package/dist/configure/vars.js.map +1 -0
  29. package/dist/configure.d.ts +2 -133
  30. package/dist/configure.d.ts.map +1 -1
  31. package/dist/configure.js +2 -436
  32. package/dist/configure.js.map +1 -1
  33. package/dist/contract-artifacts.d.ts +268 -0
  34. package/dist/contract-artifacts.d.ts.map +1 -0
  35. package/dist/contract-artifacts.js +402 -0
  36. package/dist/contract-artifacts.js.map +1 -0
  37. package/dist/contract-core.d.ts +43 -1
  38. package/dist/contract-core.d.ts.map +1 -1
  39. package/dist/contract-core.js +376 -5
  40. package/dist/contract-core.js.map +1 -1
  41. package/dist/contract-http/adapter.d.ts +1 -7
  42. package/dist/contract-http/adapter.d.ts.map +1 -1
  43. package/dist/contract-http/adapter.js +221 -199
  44. package/dist/contract-http/adapter.js.map +1 -1
  45. package/dist/contract-http/factory.d.ts.map +1 -1
  46. package/dist/contract-http/factory.js +13 -14
  47. package/dist/contract-http/factory.js.map +1 -1
  48. package/dist/contract-http/index.d.ts +1 -0
  49. package/dist/contract-http/index.d.ts.map +1 -1
  50. package/dist/contract-http/index.js +1 -0
  51. package/dist/contract-http/index.js.map +1 -1
  52. package/dist/contract-http/openapi.d.ts +56 -7
  53. package/dist/contract-http/openapi.d.ts.map +1 -1
  54. package/dist/contract-http/openapi.js +371 -21
  55. package/dist/contract-http/openapi.js.map +1 -1
  56. package/dist/contract-http/types.d.ts +72 -24
  57. package/dist/contract-http/types.d.ts.map +1 -1
  58. package/dist/contract-http/types.js +45 -1
  59. package/dist/contract-http/types.js.map +1 -1
  60. package/dist/contract-types.d.ts +270 -30
  61. package/dist/contract-types.d.ts.map +1 -1
  62. package/dist/expect.d.ts +13 -0
  63. package/dist/expect.d.ts.map +1 -1
  64. package/dist/expect.js +18 -0
  65. package/dist/expect.js.map +1 -1
  66. package/dist/index.d.ts +57 -10
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +15 -8
  69. package/dist/index.js.map +1 -1
  70. package/dist/install-plugin.d.ts +94 -0
  71. package/dist/install-plugin.d.ts.map +1 -0
  72. package/dist/install-plugin.js +222 -0
  73. package/dist/install-plugin.js.map +1 -0
  74. package/dist/internal.d.ts +2 -0
  75. package/dist/internal.d.ts.map +1 -1
  76. package/dist/internal.js +8 -0
  77. package/dist/internal.js.map +1 -1
  78. package/dist/plugin.d.ts +45 -34
  79. package/dist/plugin.d.ts.map +1 -1
  80. package/dist/plugin.js +47 -34
  81. package/dist/plugin.js.map +1 -1
  82. package/dist/runner-input-channel.d.ts +95 -0
  83. package/dist/runner-input-channel.d.ts.map +1 -0
  84. package/dist/runner-input-channel.js +110 -0
  85. package/dist/runner-input-channel.js.map +1 -0
  86. package/dist/{test-builder.d.ts → test/builder.d.ts} +2 -2
  87. package/dist/test/builder.d.ts.map +1 -0
  88. package/dist/{test-builder.js → test/builder.js} +3 -3
  89. package/dist/{test-builder.js.map → test/builder.js.map} +1 -1
  90. package/dist/{each-builder.d.ts → test/each-builder.d.ts} +1 -1
  91. package/dist/test/each-builder.d.ts.map +1 -0
  92. package/dist/{each-builder.js → test/each-builder.js} +3 -3
  93. package/dist/test/each-builder.js.map +1 -0
  94. package/dist/{test-extend.d.ts → test/extend.d.ts} +3 -3
  95. package/dist/test/extend.d.ts.map +1 -0
  96. package/dist/{test-extend.js → test/extend.js} +5 -5
  97. package/dist/test/extend.js.map +1 -0
  98. package/dist/{test-utils.d.ts → test/utils.d.ts} +2 -2
  99. package/dist/test/utils.d.ts.map +1 -0
  100. package/dist/{test-utils.js → test/utils.js} +1 -1
  101. package/dist/test/utils.js.map +1 -0
  102. package/dist/types.d.ts +78 -7
  103. package/dist/types.d.ts.map +1 -1
  104. package/package.json +1 -1
  105. package/dist/contract-http/flow-helpers.d.ts +0 -12
  106. package/dist/contract-http/flow-helpers.d.ts.map +0 -1
  107. package/dist/contract-http/flow-helpers.js +0 -34
  108. package/dist/contract-http/flow-helpers.js.map +0 -1
  109. package/dist/contract-http/markdown.d.ts +0 -10
  110. package/dist/contract-http/markdown.d.ts.map +0 -1
  111. package/dist/contract-http/markdown.js +0 -21
  112. package/dist/contract-http/markdown.js.map +0 -1
  113. package/dist/each-builder.d.ts.map +0 -1
  114. package/dist/each-builder.js.map +0 -1
  115. package/dist/test-builder.d.ts.map +0 -1
  116. package/dist/test-extend.d.ts.map +0 -1
  117. package/dist/test-extend.js.map +0 -1
  118. package/dist/test-utils.d.ts.map +0 -1
  119. package/dist/test-utils.js.map +0 -1
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Bootstrap attachment registry.
3
+ *
4
+ * Per contract-attachment-model.md v1.3:
5
+ * - `contract.bootstrap(ref, spec)` registers an overlay targeting a
6
+ * specific contract case (identified by testId = `${contractId}.${caseKey}`).
7
+ * - Each test id may have at most one bootstrap overlay. Duplicate
8
+ * registration throws.
9
+ * - Registry is consulted by the runner at runnable resolution time
10
+ * (single-case-execution-api §5.1 algorithm).
11
+ *
12
+ * The registry is a process-global side-effect map. Modules that export
13
+ * `contract.bootstrap(...)` register on evaluation. Scanner / runner are
14
+ * responsible for eager module loading per attachment model §7.4.
15
+ */
16
+ import type { BootstrapAttachment, Bootstrap, ContractCaseRef } from "./contract-types.js";
17
+ interface BootstrapRegistration {
18
+ testId: string;
19
+ contractId: string;
20
+ caseKey: string;
21
+ protocol: string;
22
+ spec: Bootstrap<unknown, unknown>;
23
+ }
24
+ /**
25
+ * Register a bootstrap overlay for a specific case. Called by
26
+ * `contract.bootstrap(ref, spec)`.
27
+ *
28
+ * Throws if another overlay is already registered for the same testId.
29
+ */
30
+ export declare function registerBootstrap<Needs, Params = void>(ref: ContractCaseRef<Needs, unknown>, spec: Bootstrap<Params, Needs>): BootstrapAttachment<Needs, Params>;
31
+ /** Look up a bootstrap registration by testId. Returns undefined if none. */
32
+ export declare function getBootstrap(testId: string): BootstrapRegistration | undefined;
33
+ /** Enumerate all registered bootstrap overlays. Used by scanner / CLI list. */
34
+ export declare function listBootstraps(): BootstrapRegistration[];
35
+ /** Test-only: clear the registry between test runs. Not part of public API. */
36
+ export declare function clearBootstrapRegistry(): void;
37
+ export {};
38
+ //# sourceMappingURL=bootstrap-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-registry.d.ts","sourceRoot":"","sources":["../src/bootstrap-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B,UAAU,qBAAqB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;CACnC;AAID;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EACpD,GAAG,EAAE,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,EACpC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,GAC7B,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAuBpC;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,GACb,qBAAqB,GAAG,SAAS,CAEnC;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,IAAI,qBAAqB,EAAE,CAExD;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Bootstrap attachment registry.
3
+ *
4
+ * Per contract-attachment-model.md v1.3:
5
+ * - `contract.bootstrap(ref, spec)` registers an overlay targeting a
6
+ * specific contract case (identified by testId = `${contractId}.${caseKey}`).
7
+ * - Each test id may have at most one bootstrap overlay. Duplicate
8
+ * registration throws.
9
+ * - Registry is consulted by the runner at runnable resolution time
10
+ * (single-case-execution-api §5.1 algorithm).
11
+ *
12
+ * The registry is a process-global side-effect map. Modules that export
13
+ * `contract.bootstrap(...)` register on evaluation. Scanner / runner are
14
+ * responsible for eager module loading per attachment model §7.4.
15
+ */
16
+ const _bootstrapRegistry = new Map();
17
+ /**
18
+ * Register a bootstrap overlay for a specific case. Called by
19
+ * `contract.bootstrap(ref, spec)`.
20
+ *
21
+ * Throws if another overlay is already registered for the same testId.
22
+ */
23
+ export function registerBootstrap(ref, spec) {
24
+ const testId = `${ref.contractId}.${ref.caseKey}`;
25
+ if (_bootstrapRegistry.has(testId)) {
26
+ throw new Error(`contract.bootstrap: duplicate overlay for case "${testId}". ` +
27
+ `Only one bootstrap overlay per case is allowed. ` +
28
+ `If you need multiple variants, use the \`bootstrap.params\` schema.`);
29
+ }
30
+ _bootstrapRegistry.set(testId, {
31
+ testId,
32
+ contractId: ref.contractId,
33
+ caseKey: ref.caseKey,
34
+ protocol: ref.protocol,
35
+ spec: spec,
36
+ });
37
+ return {
38
+ __glubean_type: "bootstrap-attachment",
39
+ testId,
40
+ };
41
+ }
42
+ /** Look up a bootstrap registration by testId. Returns undefined if none. */
43
+ export function getBootstrap(testId) {
44
+ return _bootstrapRegistry.get(testId);
45
+ }
46
+ /** Enumerate all registered bootstrap overlays. Used by scanner / CLI list. */
47
+ export function listBootstraps() {
48
+ return [..._bootstrapRegistry.values()];
49
+ }
50
+ /** Test-only: clear the registry between test runs. Not part of public API. */
51
+ export function clearBootstrapRegistry() {
52
+ _bootstrapRegistry.clear();
53
+ }
54
+ //# sourceMappingURL=bootstrap-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-registry.js","sourceRoot":"","sources":["../src/bootstrap-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAiC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAoC,EACpC,IAA8B;IAE9B,MAAM,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;IAElD,IAAI,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,mDAAmD,MAAM,KAAK;YAC5D,kDAAkD;YAClD,qEAAqE,CACxE,CAAC;IACJ,CAAC;IAED,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE;QAC7B,MAAM;QACN,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,IAAI,EAAE,IAAmC;KAC1C,CAAC,CAAC;IAEH,OAAO;QACL,cAAc,EAAE,sBAAsB;QACtC,MAAM;KAC+B,CAAC;AAC1C,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,YAAY,CAC1B,MAAc;IAEd,OAAO,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,cAAc;IAC5B,OAAO,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB;IACpC,kBAAkB,CAAC,KAAK,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @module configure/http
3
+ *
4
+ * Lazy HTTP client builders for configure().
5
+ *
6
+ * - `buildLazyHttp` — creates a proxy that resolves and caches an extended
7
+ * HttpClient on first call (WeakMap keyed by runtime identity).
8
+ * - `buildPassthroughHttp` — delegates directly to runtime.http when no
9
+ * http options are declared in configure().
10
+ */
11
+ import type { ConfigureHttpOptions, HttpClient } from "../types.js";
12
+ /**
13
+ * Build a lazy HTTP client proxy.
14
+ * On first method call, resolves the config and creates an extended client.
15
+ * Result is cached per runtime identity via WeakMap.
16
+ * @internal
17
+ */
18
+ export declare function buildLazyHttp(httpOptions: ConfigureHttpOptions): HttpClient;
19
+ /**
20
+ * Build a passthrough HTTP client that delegates directly to runtime.http.
21
+ * Used when configure() is called without http options.
22
+ * @internal
23
+ */
24
+ export declare function buildPassthroughHttp(): HttpClient;
25
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/configure/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIpE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,oBAAoB,GAAG,UAAU,CA0E3E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,UAAU,CAcjD"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @module configure/http
3
+ *
4
+ * Lazy HTTP client builders for configure().
5
+ *
6
+ * - `buildLazyHttp` — creates a proxy that resolves and caches an extended
7
+ * HttpClient on first call (WeakMap keyed by runtime identity).
8
+ * - `buildPassthroughHttp` — delegates directly to runtime.http when no
9
+ * http options are declared in configure().
10
+ */
11
+ import { getRuntime } from "./runtime.js";
12
+ import { resolveTemplate } from "./template.js";
13
+ /**
14
+ * Build a lazy HTTP client proxy.
15
+ * On first method call, resolves the config and creates an extended client.
16
+ * Result is cached per runtime identity via WeakMap.
17
+ * @internal
18
+ */
19
+ export function buildLazyHttp(httpOptions) {
20
+ const cache = new WeakMap();
21
+ function getClient() {
22
+ const runtime = getRuntime();
23
+ let client = cache.get(runtime);
24
+ if (client)
25
+ return client;
26
+ const extendOptions = {};
27
+ if (httpOptions.prefixUrl) {
28
+ extendOptions.prefixUrl = resolveTemplate(httpOptions.prefixUrl, runtime.vars, runtime.secrets, runtime.session);
29
+ }
30
+ if (httpOptions.headers) {
31
+ const resolvedHeaders = {};
32
+ for (const [name, template] of Object.entries(httpOptions.headers)) {
33
+ resolvedHeaders[name] = resolveTemplate(template, runtime.vars, runtime.secrets, runtime.session);
34
+ }
35
+ extendOptions.headers = resolvedHeaders;
36
+ }
37
+ if (httpOptions.searchParams) {
38
+ const resolvedParams = {};
39
+ for (const [name, template] of Object.entries(httpOptions.searchParams)) {
40
+ resolvedParams[name] = resolveTemplate(template, runtime.vars, runtime.secrets, runtime.session);
41
+ }
42
+ extendOptions.searchParams = resolvedParams;
43
+ }
44
+ if (httpOptions.timeout !== undefined)
45
+ extendOptions.timeout = httpOptions.timeout;
46
+ if (httpOptions.retry !== undefined)
47
+ extendOptions.retry = httpOptions.retry;
48
+ if (httpOptions.throwHttpErrors !== undefined)
49
+ extendOptions.throwHttpErrors = httpOptions.throwHttpErrors;
50
+ if (httpOptions.hooks)
51
+ extendOptions.hooks = httpOptions.hooks;
52
+ if (httpOptions.redirect !== undefined)
53
+ extendOptions.redirect = httpOptions.redirect;
54
+ if (typeof process !== "undefined" && process.env?.["GLUBEAN_DEBUG"]) {
55
+ process.stderr.write(`[glubean:debug] configure.getClient extendOptions=${JSON.stringify({ ...extendOptions, headers: "..." })}\n`);
56
+ }
57
+ client = runtime.http.extend(extendOptions);
58
+ cache.set(runtime, client);
59
+ return client;
60
+ }
61
+ const HTTP_METHODS = ["get", "post", "put", "patch", "delete", "head"];
62
+ const proxy = function (url, options) {
63
+ return getClient()(url, options);
64
+ };
65
+ for (const method of HTTP_METHODS) {
66
+ proxy[method] = (url, options) => getClient()[method](url, options);
67
+ }
68
+ proxy.extend = (options) => getClient().extend(options);
69
+ proxy._configuredTimeout = httpOptions.timeout;
70
+ return proxy;
71
+ }
72
+ /**
73
+ * Build a passthrough HTTP client that delegates directly to runtime.http.
74
+ * Used when configure() is called without http options.
75
+ * @internal
76
+ */
77
+ export function buildPassthroughHttp() {
78
+ const HTTP_METHODS = ["get", "post", "put", "patch", "delete", "head"];
79
+ const proxy = function (url, options) {
80
+ return getRuntime().http(url, options);
81
+ };
82
+ for (const method of HTTP_METHODS) {
83
+ proxy[method] = (url, options) => getRuntime().http[method](url, options);
84
+ }
85
+ proxy.extend = (options) => getRuntime().http.extend(options);
86
+ return proxy;
87
+ }
88
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/configure/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,WAAiC;IA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M,CAAC,GAAG,CAAC,GAA2B,EAAE,OAAa,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACpG,CAAC;IAED,KAAK,CAAC,MAAM,GAAG,CAAC,OAAY,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5D,KAAa,CAAC,kBAAkB,GAAG,WAAW,CAAC,OAAO,CAAC;IAExD,OAAO,KAAmB,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;IAEhF,MAAM,KAAK,GAAQ,UAAU,GAA2B,EAAE,OAAa;QACrE,OAAO,UAAU,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;QAClC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAA2B,EAAE,OAAa,EAAE,EAAE,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1G,CAAC;IAED,KAAK,CAAC,MAAM,GAAG,CAAC,OAAY,EAAE,EAAE,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnE,OAAO,KAAmB,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @module configure
3
+ *
4
+ * File-level configuration for Glubean tests.
5
+ *
6
+ * `configure()` lets you declare shared dependencies (vars, secrets, HTTP config)
7
+ * once at the top of a test file (or in a shared `configure.ts`), eliminating
8
+ * repetitive `ctx.vars.require()` / `ctx.secrets.require()` calls in every test.
9
+ *
10
+ * All returned values are **lazy** — they are not resolved until a test function
11
+ * actually accesses them at runtime. This means:
12
+ * - Safe to call at module top-level (scanner won't trigger resolution)
13
+ * - Safe to share across files via re-exports
14
+ * - Each test execution gets the correct runtime values
15
+ *
16
+ * @example Single file usage
17
+ * ```ts
18
+ * import { test, configure } from "@glubean/sdk";
19
+ *
20
+ * const { vars, secrets, http } = configure({
21
+ * vars: { baseUrl: "{{BASE_URL}}" },
22
+ * secrets: { apiKey: "{{API_KEY}}" },
23
+ * http: {
24
+ * prefixUrl: "{{BASE_URL}}",
25
+ * headers: { Authorization: "Bearer {{API_KEY}}" },
26
+ * },
27
+ * });
28
+ *
29
+ * export const listUsers = test("list-users", async (ctx) => {
30
+ * const res = await http.get("users").json();
31
+ * ctx.assert(res.length > 0, "has users");
32
+ * });
33
+ * ```
34
+ *
35
+ * @example Shared across files (tests/configure.ts)
36
+ * ```ts
37
+ * // tests/configure.ts
38
+ * export const { vars, http } = configure({
39
+ * vars: { baseUrl: "{{BASE_URL}}" },
40
+ * http: { prefixUrl: "{{BASE_URL}}" },
41
+ * });
42
+ *
43
+ * // tests/users.test.ts
44
+ * import { http } from "./configure.js";
45
+ * export const listUsers = test("list-users", async (ctx) => {
46
+ * const res = await http.get("users").json();
47
+ * });
48
+ * ```
49
+ */
50
+ import type { ConfigureOptions, ConfigureResult, PluginFactory, ReservedConfigureKeys, ResolvePlugins } from "../types.js";
51
+ export type { InternalRuntime } from "./runtime.js";
52
+ export { resolveTemplate } from "./template.js";
53
+ /**
54
+ * Declare file-level dependencies on vars, secrets, and HTTP configuration.
55
+ *
56
+ * Returns lazy accessors that resolve at test runtime, not at import time.
57
+ * All declared vars and secrets are **required** — missing values cause the test
58
+ * to fail immediately with a clear error message.
59
+ *
60
+ * @param options Configuration declaring vars, secrets, and HTTP defaults
61
+ * @returns Lazy accessors for vars, secrets, and a pre-configured HTTP client
62
+ */
63
+ export declare function configure<V extends Record<string, string> = Record<string, string>, S extends Record<string, string> = Record<string, string>, P extends Record<string, PluginFactory<any>> = Record<string, never>>(options: ConfigureOptions & {
64
+ vars?: {
65
+ [K in keyof V]: string;
66
+ };
67
+ secrets?: {
68
+ [K in keyof S]: string;
69
+ };
70
+ plugins?: P & {
71
+ [K in ReservedConfigureKeys]?: never;
72
+ };
73
+ }): ConfigureResult<{
74
+ [K in keyof V]: string;
75
+ }, {
76
+ [K in keyof S]: string;
77
+ }> & ResolvePlugins<P>;
78
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configure/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,cAAc,EACf,MAAM,aAAa,CAAC;AAKrB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAEpE,OAAO,EAAE,gBAAgB,GAAG;IAC1B,IAAI,CAAC,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;KAAE,CAAC;IAClC,OAAO,CAAC,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;KAAE,CAAC;IACrC,OAAO,CAAC,EAAE,CAAC,GAAG;SAAG,CAAC,IAAI,qBAAqB,CAAC,CAAC,EAAE,KAAK;KAAE,CAAC;CACxD,GAEC,eAAe,CAAC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAAE,EAAE;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAAE,CAAC,GACvE,cAAc,CAAC,CAAC,CAAC,CAoBpB"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @module configure
3
+ *
4
+ * File-level configuration for Glubean tests.
5
+ *
6
+ * `configure()` lets you declare shared dependencies (vars, secrets, HTTP config)
7
+ * once at the top of a test file (or in a shared `configure.ts`), eliminating
8
+ * repetitive `ctx.vars.require()` / `ctx.secrets.require()` calls in every test.
9
+ *
10
+ * All returned values are **lazy** — they are not resolved until a test function
11
+ * actually accesses them at runtime. This means:
12
+ * - Safe to call at module top-level (scanner won't trigger resolution)
13
+ * - Safe to share across files via re-exports
14
+ * - Each test execution gets the correct runtime values
15
+ *
16
+ * @example Single file usage
17
+ * ```ts
18
+ * import { test, configure } from "@glubean/sdk";
19
+ *
20
+ * const { vars, secrets, http } = configure({
21
+ * vars: { baseUrl: "{{BASE_URL}}" },
22
+ * secrets: { apiKey: "{{API_KEY}}" },
23
+ * http: {
24
+ * prefixUrl: "{{BASE_URL}}",
25
+ * headers: { Authorization: "Bearer {{API_KEY}}" },
26
+ * },
27
+ * });
28
+ *
29
+ * export const listUsers = test("list-users", async (ctx) => {
30
+ * const res = await http.get("users").json();
31
+ * ctx.assert(res.length > 0, "has users");
32
+ * });
33
+ * ```
34
+ *
35
+ * @example Shared across files (tests/configure.ts)
36
+ * ```ts
37
+ * // tests/configure.ts
38
+ * export const { vars, http } = configure({
39
+ * vars: { baseUrl: "{{BASE_URL}}" },
40
+ * http: { prefixUrl: "{{BASE_URL}}" },
41
+ * });
42
+ *
43
+ * // tests/users.test.ts
44
+ * import { http } from "./configure.js";
45
+ * export const listUsers = test("list-users", async (ctx) => {
46
+ * const res = await http.get("users").json();
47
+ * });
48
+ * ```
49
+ */
50
+ import { buildLazyVars, buildLazySecrets } from "./vars.js";
51
+ import { buildLazyHttp, buildPassthroughHttp } from "./http.js";
52
+ import { buildLazyPlugins } from "./plugin.js";
53
+ export { resolveTemplate } from "./template.js";
54
+ /**
55
+ * Declare file-level dependencies on vars, secrets, and HTTP configuration.
56
+ *
57
+ * Returns lazy accessors that resolve at test runtime, not at import time.
58
+ * All declared vars and secrets are **required** — missing values cause the test
59
+ * to fail immediately with a clear error message.
60
+ *
61
+ * @param options Configuration declaring vars, secrets, and HTTP defaults
62
+ * @returns Lazy accessors for vars, secrets, and a pre-configured HTTP client
63
+ */
64
+ export function configure(options) {
65
+ const vars = options.vars
66
+ ? buildLazyVars(options.vars)
67
+ : {};
68
+ const secrets = options.secrets
69
+ ? buildLazySecrets(options.secrets)
70
+ : {};
71
+ const http = options.http ? buildLazyHttp(options.http) : buildPassthroughHttp();
72
+ const base = { vars, secrets, http };
73
+ if (options.plugins) {
74
+ Object.assign(base, buildLazyPlugins(options.plugins));
75
+ }
76
+ return base;
77
+ }
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/configure/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AASH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAKvB,OAIC;IAID,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;QACvB,CAAC,CAAC,aAAa,CAA6B,OAAO,CAAC,IAAI,CAAC;QACzD,CAAC,CAAE,EAA2C,CAAC;IAEjD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO;QAC7B,CAAC,CAAC,gBAAgB,CAA6B,OAAO,CAAC,OAAO,CAAC;QAC/D,CAAC,CAAE,EAA2C,CAAC;IAEjD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,oBAAoB,EAAE,CAAC;IAEjF,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAErC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,IAEc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @module configure/plugin
3
+ *
4
+ * Lazy plugin builder for configure().
5
+ *
6
+ * Each plugin is a transparent Proxy at module load time. On first property
7
+ * access during test execution, the plugin factory is called with an augmented
8
+ * GlubeanRuntime. The instance is cached per runtime identity via WeakMap.
9
+ */
10
+ import type { PluginFactory } from "../types.js";
11
+ /** Reserved keys that plugins cannot shadow. */
12
+ export declare const RESERVED_KEYS: Set<string>;
13
+ /**
14
+ * Build a transparent Proxy that defers plugin instantiation until first use.
15
+ * @internal
16
+ */
17
+ export declare function buildLazyPlugin(factory: PluginFactory<any>): unknown;
18
+ /**
19
+ * Build lazy proxies for all declared plugins, checking for reserved key conflicts.
20
+ * @internal
21
+ */
22
+ export declare function buildLazyPlugins(plugins: Record<string, PluginFactory<any>>): Record<string, unknown>;
23
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/configure/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjE,gDAAgD;AAChD,eAAO,MAAM,aAAa,aAAuC,CAAC;AAkClE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAsBpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,GAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @module configure/plugin
3
+ *
4
+ * Lazy plugin builder for configure().
5
+ *
6
+ * Each plugin is a transparent Proxy at module load time. On first property
7
+ * access during test execution, the plugin factory is called with an augmented
8
+ * GlubeanRuntime. The instance is cached per runtime identity via WeakMap.
9
+ */
10
+ import { getRuntime, requireVar, requireSecret } from "./runtime.js";
11
+ import { resolveTemplate } from "./template.js";
12
+ /** Reserved keys that plugins cannot shadow. */
13
+ export const RESERVED_KEYS = new Set(["vars", "secrets", "http"]);
14
+ /**
15
+ * Resolve (or retrieve cached) the real plugin instance for the current runtime.
16
+ * @internal
17
+ */
18
+ function resolvePlugin(factory, cache) {
19
+ const runtime = getRuntime();
20
+ if (cache.has(runtime))
21
+ return cache.get(runtime);
22
+ const noop = () => { };
23
+ const augmented = {
24
+ vars: runtime.vars,
25
+ secrets: runtime.secrets,
26
+ http: runtime.http,
27
+ test: runtime.test,
28
+ requireVar,
29
+ requireSecret,
30
+ resolveTemplate: (template) => resolveTemplate(template, runtime.vars, runtime.secrets, runtime.session),
31
+ trace: runtime.trace?.bind(runtime) ?? noop,
32
+ action: runtime.action?.bind(runtime) ?? noop,
33
+ event: runtime.event?.bind(runtime) ?? noop,
34
+ log: runtime.log?.bind(runtime) ?? noop,
35
+ };
36
+ const instance = factory.create(augmented);
37
+ cache.set(runtime, instance);
38
+ return instance;
39
+ }
40
+ /**
41
+ * Build a transparent Proxy that defers plugin instantiation until first use.
42
+ * @internal
43
+ */
44
+ export function buildLazyPlugin(factory) {
45
+ const cache = new WeakMap();
46
+ return new Proxy(Object.create(null), {
47
+ get(_target, prop, receiver) {
48
+ const instance = resolvePlugin(factory, cache);
49
+ const value = Reflect.get(instance, prop, receiver);
50
+ return typeof value === "function" ? value.bind(instance) : value;
51
+ },
52
+ set(_target, prop, value) {
53
+ return Reflect.set(resolvePlugin(factory, cache), prop, value);
54
+ },
55
+ has(_target, prop) {
56
+ return Reflect.has(resolvePlugin(factory, cache), prop);
57
+ },
58
+ ownKeys() {
59
+ return Reflect.ownKeys(resolvePlugin(factory, cache));
60
+ },
61
+ getOwnPropertyDescriptor(_target, prop) {
62
+ return Object.getOwnPropertyDescriptor(resolvePlugin(factory, cache), prop);
63
+ },
64
+ });
65
+ }
66
+ /**
67
+ * Build lazy proxies for all declared plugins, checking for reserved key conflicts.
68
+ * @internal
69
+ */
70
+ export function buildLazyPlugins(plugins) {
71
+ const result = {};
72
+ for (const [name, factory] of Object.entries(plugins)) {
73
+ if (RESERVED_KEYS.has(name)) {
74
+ throw new Error(`Plugin name "${name}" conflicts with a reserved configure() field. ` +
75
+ `Choose a different key (reserved: ${[...RESERVED_KEYS].join(", ")}).`);
76
+ }
77
+ result[name] = buildLazyPlugin(factory);
78
+ }
79
+ return result;
80
+ }
81
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/configure/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAwB,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,gDAAgD;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAElE;;;GAGG;AACH,SAAS,aAA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gBAAgB,IAAI,iDAAiD;gBACnE,qCAAqC,CAAC,GAAG,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACzE,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @module configure/runtime
3
+ *
4
+ * Runtime accessor helpers used by all configure lazy builders.
5
+ * Wraps the carrier's optional getRuntime() with a throw-on-missing contract.
6
+ */
7
+ import { type InternalRuntime } from "../runtime-carrier.js";
8
+ export type { InternalRuntime };
9
+ /**
10
+ * Get the current runtime context, throwing if accessed outside test execution.
11
+ * @internal
12
+ */
13
+ export declare function getRuntime(): InternalRuntime;
14
+ /**
15
+ * Require a var from the runtime context. Throws if missing or empty.
16
+ * @internal
17
+ */
18
+ export declare function requireVar(key: string): string;
19
+ /**
20
+ * Require a secret from the runtime context. Throws if missing or empty.
21
+ * @internal
22
+ */
23
+ export declare function requireSecret(key: string): string;
24
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/configure/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;;GAGG;AACH,wBAAgB,UAAU,IAAI,eAAe,CAU5C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO9C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOjD"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @module configure/runtime
3
+ *
4
+ * Runtime accessor helpers used by all configure lazy builders.
5
+ * Wraps the carrier's optional getRuntime() with a throw-on-missing contract.
6
+ */
7
+ import { getRuntime as getCarrierRuntime, } from "../runtime-carrier.js";
8
+ /**
9
+ * Get the current runtime context, throwing if accessed outside test execution.
10
+ * @internal
11
+ */
12
+ export function getRuntime() {
13
+ const runtime = getCarrierRuntime();
14
+ if (!runtime) {
15
+ throw new Error("configure() values can only be accessed during test execution. " +
16
+ "Did you try to read a var or secret at module load time? " +
17
+ "Move the access inside a test function.");
18
+ }
19
+ return runtime;
20
+ }
21
+ /**
22
+ * Require a var from the runtime context. Throws if missing or empty.
23
+ * @internal
24
+ */
25
+ export function requireVar(key) {
26
+ const runtime = getRuntime();
27
+ const value = runtime.vars[key];
28
+ if (value === undefined || value === null || value === "") {
29
+ throw new Error(`Missing required var: ${key}`);
30
+ }
31
+ return value;
32
+ }
33
+ /**
34
+ * Require a secret from the runtime context. Throws if missing or empty.
35
+ * @internal
36
+ */
37
+ export function requireSecret(key) {
38
+ const runtime = getRuntime();
39
+ const value = runtime.secrets[key];
40
+ if (value === undefined || value === null || value === "") {
41
+ throw new Error(`Missing required secret: ${key}`);
42
+ }
43
+ return value;
44
+ }
45
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/configure/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,UAAU,IAAI,iBAAiB,GAEhC,MAAM,uBAAuB,CAAC;AAI/B;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,iEAAiE;YAC/D,2DAA2D;YAC3D,yCAAyC,CAC5C,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module configure/template
3
+ *
4
+ * `{{key}}` placeholder resolution used by vars, secrets, and http builders.
5
+ *
6
+ * Resolution priority: session → secrets → vars.
7
+ */
8
+ /** Regex for `{{key}}` template placeholders. */
9
+ export declare const TEMPLATE_RE: RegExp;
10
+ /**
11
+ * Resolve `{{key}}` template placeholders in a string.
12
+ *
13
+ * Resolution priority (first non-empty wins):
14
+ * 1. Session — dynamic values set during session setup (e.g., auth tokens)
15
+ * 2. Secrets — from `.env.secrets`
16
+ * 3. Vars — from `.env`
17
+ *
18
+ * Session values must be strings to resolve in templates. Non-string session
19
+ * values are silently skipped (they're still accessible via `ctx.session.get()`).
20
+ */
21
+ export declare function resolveTemplate(template: string, vars: Record<string, string>, secrets: Record<string, string>, session?: Record<string, unknown>): string;
22
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/configure/template.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iDAAiD;AACjD,eAAO,MAAM,WAAW,QAAsB,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CAeR"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @module configure/template
3
+ *
4
+ * `{{key}}` placeholder resolution used by vars, secrets, and http builders.
5
+ *
6
+ * Resolution priority: session → secrets → vars.
7
+ */
8
+ /** Regex for `{{key}}` template placeholders. */
9
+ export const TEMPLATE_RE = /\{\{([\w-]+)\}\}/g;
10
+ /**
11
+ * Resolve `{{key}}` template placeholders in a string.
12
+ *
13
+ * Resolution priority (first non-empty wins):
14
+ * 1. Session — dynamic values set during session setup (e.g., auth tokens)
15
+ * 2. Secrets — from `.env.secrets`
16
+ * 3. Vars — from `.env`
17
+ *
18
+ * Session values must be strings to resolve in templates. Non-string session
19
+ * values are silently skipped (they're still accessible via `ctx.session.get()`).
20
+ */
21
+ export function resolveTemplate(template, vars, secrets, session) {
22
+ return template.replace(TEMPLATE_RE, (_match, key) => {
23
+ const sessionValue = session?.[key];
24
+ const value = (typeof sessionValue === "string" ? sessionValue : undefined) ??
25
+ secrets[key] ??
26
+ vars[key];
27
+ if (value === undefined || value === null || value === "") {
28
+ throw new Error(`Missing value for template placeholder "{{${key}}}" in configure() http headers. ` +
29
+ `Ensure "${key}" is available in session, as a secret, or as a var.`);
30
+ }
31
+ return value;
32
+ });
33
+ }
34
+ //# sourceMappingURL=template.js.map