@tailor-platform/sdk 1.58.0 → 1.60.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/dist/{application-B59TaTk_.mjs → application-FnWOxBk7.mjs} +46 -27
  3. package/dist/application-FnWOxBk7.mjs.map +1 -0
  4. package/dist/application-VOdgMtOD.mjs +4 -0
  5. package/dist/{authconnection-TsdLYaLs.d.mts → authconnection-BIYzEh2p.d.mts} +2 -2
  6. package/dist/authconnection-D8SJGMpj.mjs.map +1 -1
  7. package/dist/cli/erd-viewer-assets/app.js +4 -4
  8. package/dist/cli/index.mjs +57 -13
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.mjs +4 -3
  11. package/dist/cli/lib.mjs.map +1 -1
  12. package/dist/client-B-jRdlC_.mjs +4 -0
  13. package/dist/{client-62B-r3MN.mjs → client-W5P4NYYX.mjs} +117 -4
  14. package/dist/{client-62B-r3MN.mjs.map → client-W5P4NYYX.mjs.map} +1 -1
  15. package/dist/configure/index.d.mts +1 -1
  16. package/dist/configure/index.mjs +8 -8
  17. package/dist/configure/index.mjs.map +1 -1
  18. package/dist/{crashreport-CCGpLUlP.mjs → crashreport-D3DvAzdg.mjs} +3 -3
  19. package/dist/crashreport-D3DvAzdg.mjs.map +1 -0
  20. package/dist/{crashreport-CXD_Kjk-.mjs → crashreport-lnVTnbB5.mjs} +1 -1
  21. package/dist/file-B58Dm-2P.mjs.map +1 -1
  22. package/dist/{file-VTJbbOL3.d.mts → file-BzK8z3X-.d.mts} +2 -2
  23. package/dist/globals-ByrCoDip.mjs +109 -0
  24. package/dist/globals-ByrCoDip.mjs.map +1 -0
  25. package/dist/iconv-DreIffeM.mjs.map +1 -1
  26. package/dist/{iconv-Chu6Hit2.d.mts → iconv-kwrmd1U_.d.mts} +2 -2
  27. package/dist/{idp-Di9N4FSJ.d.mts → idp-BlBPtXJ-.d.mts} +2 -2
  28. package/dist/idp-Ch95ag8h.mjs.map +1 -1
  29. package/dist/{index-BWoHfE-i.d.mts → index-Cr6ufjZ5.d.mts} +10 -8
  30. package/dist/{index-DTSQthwF.d.mts → index-DRhMpdnA.d.mts} +7 -7
  31. package/dist/{job-CEAJLiGp.mjs → job-BpsFXPbi.mjs} +8 -17
  32. package/dist/job-BpsFXPbi.mjs.map +1 -0
  33. package/dist/mock-Dpu__UeJ.mjs +805 -0
  34. package/dist/mock-Dpu__UeJ.mjs.map +1 -0
  35. package/dist/registry-D0uB0OrK.mjs +178 -0
  36. package/dist/registry-D0uB0OrK.mjs.map +1 -0
  37. package/dist/{repl-editor-ihh8koiR.mjs → repl-editor-Y9QJDL0K.mjs} +3 -9
  38. package/dist/{repl-editor-ihh8koiR.mjs.map → repl-editor-Y9QJDL0K.mjs.map} +1 -1
  39. package/dist/runtime/authconnection.d.mts +1 -1
  40. package/dist/runtime/file.d.mts +1 -1
  41. package/dist/runtime/globals.d.mts +5 -5
  42. package/dist/runtime/iconv.d.mts +1 -1
  43. package/dist/runtime/idp.d.mts +1 -1
  44. package/dist/runtime/index.d.mts +7 -7
  45. package/dist/runtime/secretmanager.d.mts +1 -1
  46. package/dist/runtime/workflow.d.mts +1 -1
  47. package/dist/{runtime-BC-FbQkg.mjs → runtime-CrUa8Z2k.mjs} +238 -273
  48. package/dist/runtime-CrUa8Z2k.mjs.map +1 -0
  49. package/dist/secretmanager-B9h-U_8U.mjs.map +1 -1
  50. package/dist/{secretmanager-BhpDmxwT.d.mts → secretmanager-CKLB3wAQ.d.mts} +2 -2
  51. package/dist/utils/test/index.d.mts +5 -5
  52. package/dist/utils/test/index.mjs +7 -7
  53. package/dist/utils/test/index.mjs.map +1 -1
  54. package/dist/vitest/environment.mjs +3 -4
  55. package/dist/vitest/environment.mjs.map +1 -1
  56. package/dist/vitest/index.d.mts +167 -120
  57. package/dist/vitest/index.mjs +6 -6
  58. package/dist/vitest/index.mjs.map +1 -1
  59. package/dist/vitest/setup.d.mts +1 -1
  60. package/dist/vitest/setup.mjs +4 -3
  61. package/dist/vitest/setup.mjs.map +1 -1
  62. package/dist/workflow--aPbA8Uq.mjs.map +1 -1
  63. package/dist/{workflow-dYYH7QFa.d.mts → workflow-CMamswkK.d.mts} +2 -2
  64. package/docs/cli/auth.md +40 -0
  65. package/docs/cli-reference.md +1 -0
  66. package/docs/configuration.md +1 -1
  67. package/docs/runtime.md +9 -12
  68. package/docs/services/auth.md +19 -1
  69. package/docs/testing.md +92 -85
  70. package/package.json +5 -5
  71. package/dist/application-B59TaTk_.mjs.map +0 -1
  72. package/dist/application-gO_pa5BO.mjs +0 -4
  73. package/dist/client-BWl3f1XS.mjs +0 -4
  74. package/dist/crashreport-CCGpLUlP.mjs.map +0 -1
  75. package/dist/job-CEAJLiGp.mjs.map +0 -1
  76. package/dist/mock-B6PI49C_.mjs +0 -844
  77. package/dist/mock-B6PI49C_.mjs.map +0 -1
  78. package/dist/runtime-BC-FbQkg.mjs.map +0 -1
  79. package/dist/test-env-key-CSnK4W1Y.mjs +0 -30
  80. package/dist/test-env-key-CSnK4W1Y.mjs.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import { n as TailorEnv } from "../env-B-g-qgE4.mjs";
2
2
  import { Kysely, OperationNode, OperationNodeKind, Transaction } from "kysely";
3
+ import { Mock } from "vitest";
3
4
  import { Plugin } from "vitest/config";
4
5
 
5
6
  //#region src/vitest/mock.d.ts
@@ -58,60 +59,55 @@ interface IconvCall {
58
59
  method: string;
59
60
  args: unknown[];
60
61
  }
61
- interface WorkflowCall {
62
- method: "triggerWorkflow" | "wait" | "resolve";
63
- args: unknown[];
62
+ declare class MockQueryResult {
63
+ command: string;
64
+ rowCount: number;
65
+ rows: unknown[];
66
+ constructor(rows: unknown[]);
64
67
  }
65
68
  /**
66
- * Mock control object for TailorDB operations.
67
- *
68
- * Automatically injected into `globalThis.tailordb` by the tailor-runtime environment.
69
- * Use this object to configure query responses and assert on executed queries.
69
+ * Acquire a disposable mock for TailorDB operations. Installs a mock
70
+ * `tailordb.Client` whose `queryObject` is a shared `vi.fn()` (so query
71
+ * responses can be staged before the client is constructed). Restored on
72
+ * dispose.
73
+ * @returns Disposable TailorDB mock control object
70
74
  * @example
71
75
  * ```typescript
72
- * import { tailordbMock } from "@tailor-platform/sdk/vitest";
73
- *
74
- * beforeEach(() => tailordbMock.reset());
75
- *
76
- * test("content-based", () => {
77
- * tailordbMock.setQueryResolver((query) => {
78
- * if (query.includes("SELECT")) return [{ id: "1" }];
79
- * return [];
80
- * });
81
- * });
76
+ * import { mockTailordb } from "@tailor-platform/sdk/vitest";
82
77
  *
83
- * test("order-based", () => {
84
- * tailordbMock.enqueueResults(
85
- * [], // BEGIN (empty result)
86
- * [{ age: 30 }], // SELECT (one row)
87
- * [], // COMMIT (empty result)
88
- * );
78
+ * test("order-based", async () => {
79
+ * using db = mockTailordb();
80
+ * db.enqueueResults([], [{ age: 30 }], []); // BEGIN / SELECT / COMMIT
81
+ * //
82
+ * expect(db.queryObject).toHaveBeenCalledTimes(3);
83
+ * expect(db.Client).toHaveBeenCalledWith({ namespace: "tailordb" });
89
84
  * });
90
85
  * ```
91
86
  */
92
- declare const tailordbMock: {
87
+ declare function mockTailordb(): {
88
+ /** The mock `tailordb.Client` constructor (`vi.fn`). */Client: Mock<(this: any, config?: {
89
+ namespace?: string;
90
+ }) => void>; /** The shared `queryObject` `vi.fn` used by every client and transaction. */
91
+ queryObject: Mock<(_query: string, _params?: unknown[]) => Promise<MockQueryResult>>;
93
92
  /**
94
- * Set a fallback query resolver. Called when the result queue is empty.
93
+ * Set a fallback query resolver. Called when the enqueue queue is empty.
95
94
  * @param resolver - Function that returns rows for a given query and params
96
95
  */
97
96
  setQueryResolver(resolver: QueryResolver$1): void;
98
97
  /**
99
- * Enqueue rows for the next `queryObject` call. Arguments are the row objects returned
100
- * by that single query. Call with no arguments for an empty result. Consumed in FIFO
101
- * order; when the queue is exhausted, subsequent calls fall back to `setQueryResolver`
102
- * (default: empty rows). Use `enqueueResults` to stage rows for multiple queries in one
103
- * call.
98
+ * Enqueue rows for the next `queryObject` call (FIFO; takes priority over
99
+ * `setQueryResolver`). Call with no arguments for an empty result.
104
100
  * @param rows - Row objects to return from the next `queryObject` call
105
101
  */
106
102
  enqueueResult(...rows: unknown[]): void;
107
103
  /**
108
- * Enqueue rows for multiple subsequent `queryObject` calls. Each argument is a rows
109
- * array for one query, consumed in FIFO order.
104
+ * Enqueue rows for multiple subsequent `queryObject` calls (FIFO).
110
105
  * @param rowsList - Rows arrays, one per upcoming query
111
106
  */
112
107
  enqueueResults(...rowsList: unknown[][]): void;
113
108
  /**
114
- * All queries executed via `queryObject`, in order.
109
+ * All queries executed via `queryObject`, in order, derived from the vi.fn
110
+ * call records.
115
111
  * @returns Executed queries array
116
112
  */
117
113
  readonly executedQueries: ExecutedQuery$1[];
@@ -119,58 +115,43 @@ declare const tailordbMock: {
119
115
  * All TailorDB clients created, with their namespace and end state.
120
116
  * @returns Created clients array
121
117
  */
122
- readonly createdClients: CreatedClient[]; /** Reset all TailorDB mock state. Call in `beforeEach`. */
118
+ readonly createdClients: CreatedClient[]; /** Reset query responses and recorded calls (keeps the mock installed). */
123
119
  reset(): void;
124
- };
120
+ } & Disposable;
125
121
  /**
126
- * Mock control object for workflow operations.
127
- *
128
- * Automatically injected into `globalThis.tailor.workflow` by the tailor-runtime environment.
122
+ * Acquire a disposable mock for workflow operations (`tailor.workflow`).
123
+ * Restored on dispose.
124
+ * @returns Disposable workflow mock control object
129
125
  * @example
130
126
  * ```typescript
131
- * import { workflowMock } from "@tailor-platform/sdk/vitest";
127
+ * import { mockWorkflow } from "@tailor-platform/sdk/vitest";
132
128
  *
133
- * beforeEach(() => workflowMock.reset());
134
- *
135
- * test("job handler", () => {
136
- * workflowMock.setJobHandler((jobName, args) => {
137
- * if (jobName === "validate") return { valid: true };
138
- * return null;
139
- * });
140
- * });
141
- *
142
- * test("wait point", () => {
143
- * workflowMock.setWaitHandler(() => ({ approved: true }));
144
- * // …
145
- * expect(workflowMock.waitCalls).toEqual([{ key: "approval", payload: undefined }]);
146
- * });
147
- *
148
- * test("resolve point", () => {
149
- * workflowMock.setResolveHandler((_executionId, _key, callback) =>
150
- * callback({ approved: true }),
151
- * );
152
- * // …
153
- * expect(workflowMock.resolveCalls).toEqual([
154
- * { executionId: "mock-execution-id", key: "approval" },
155
- * ]);
129
+ * test("job handler", async () => {
130
+ * using wf = mockWorkflow();
131
+ * wf.setJobHandler((name) => (name === "validate" ? { valid: true } : null));
132
+ * await runWorkflowUnderTest(); // calls tailor.workflow.triggerJobFunction("validate", {})
133
+ * expect(wf.triggerJobFunction).toHaveBeenCalledWith("validate", {});
156
134
  * });
157
135
  * ```
158
136
  */
159
- declare const workflowMock: {
137
+ declare function mockWorkflow(): {
138
+ /** The `triggerJobFunction` `vi.fn`. */triggerJobFunction: Mock<(jobName: string, args?: unknown) => unknown>; /** The `triggerWorkflow` `vi.fn`. */
139
+ triggerWorkflow: Mock<(workflowName: string, args?: unknown, _options?: TriggerWorkflowOptions) => Promise<string>>; /** The `wait` `vi.fn`. */
140
+ wait: Mock<(_key: string, _payload?: unknown) => unknown>; /** The `resolve` `vi.fn`. */
141
+ resolve: Mock<(_executionId: string, _key: string, _callback: (payload: unknown) => unknown) => Promise<void>>;
160
142
  /**
161
- * Set a fallback job handler. Called when the result queue is empty.
162
- * @param handler - Function that returns a result for a given job name and args
143
+ * Set a fallback job handler. Called when the enqueue queue is empty.
144
+ * @param handler - Function returning a result for a job name and args
163
145
  */
164
146
  setJobHandler(handler: JobHandler): void;
165
147
  /**
166
- * Enqueue a single result for the next `triggerJobFunction` call. Consumed in FIFO
167
- * order; when the queue is exhausted, subsequent calls fall back to `setJobHandler`
168
- * (default: null). Use `enqueueResults` to stage multiple results in one call.
169
- * @param result - Result to return from the next `triggerJobFunction` call
148
+ * Enqueue a single result for the next `triggerJobFunction` call (FIFO;
149
+ * takes priority over `setJobHandler`).
150
+ * @param result - Result to return from the next call
170
151
  */
171
152
  enqueueResult(result: unknown): void;
172
153
  /**
173
- * Enqueue results for multiple subsequent `triggerJobFunction` calls.
154
+ * Enqueue results for multiple subsequent `triggerJobFunction` calls (FIFO).
174
155
  * @param results - Results to enqueue, one per upcoming call
175
156
  */
176
157
  enqueueResults(...results: unknown[]): void;
@@ -180,38 +161,31 @@ declare const workflowMock: {
180
161
  */
181
162
  readonly triggeredJobs: TriggeredJob[];
182
163
  /**
183
- * Configure what `tailor.workflow.triggerWorkflow` returns. Pass a string to return
184
- * the same execution ID for every call, or a function `(name, args, options) => string`
185
- * to compute one per call. Default: `"mock-execution-id"`.
186
- * @param handler - Static execution ID or a function that returns one
164
+ * Configure what `triggerWorkflow` returns. Pass a string (same id every
165
+ * call) or `(name, args, options) => string`. Default: a placeholder UUID.
166
+ * @param handler - Static execution ID or a function returning one
187
167
  */
188
168
  setTriggerHandler(handler: string | TriggerHandlerFn): void;
189
169
  /**
190
- * Configure what `tailor.workflow.wait` returns. Pass a function `(key, payload) => unknown`
191
- * to compute one per call, or any other value to return it for every call. Default: `null`.
192
- * @param handler - Static value or a function that returns one
170
+ * Configure what `wait` returns. Pass `(key, payload) => unknown` or any
171
+ * other value to return it for every call. Default: `null`.
172
+ * @param handler - Static value or a function returning one
193
173
  */
194
174
  setWaitHandler: SetWaitHandler;
195
175
  /**
196
176
  * Set the `env` passed to job bodies invoked via `createWorkflowJob().trigger()`.
197
- * Cleared by `workflowMock.reset()`.
177
+ * Cleared on dispose / reset.
198
178
  * @param env - Env passed to job bodies.
199
179
  */
200
180
  setEnv(env: TailorEnv): void;
201
181
  /**
202
- * Configure how `tailor.workflow.resolve` runs the user-supplied callback. The handler
203
- * receives `(executionId, key, callback)` invoke `callback(payload)` to drive
204
- * resolve→wait wiring in tests. Default: callback is not invoked (records the call only).
182
+ * Configure how `resolve` runs the user-supplied callback. Default: callback
183
+ * is not invoked (records the call only).
205
184
  * @param handler - Function invoked per `resolve` call
206
185
  */
207
186
  setResolveHandler(handler: ResolveHandler): void;
208
187
  /**
209
- * Calls to triggerWorkflow, wait, resolve (not triggerJobFunction use triggeredJobs).
210
- * @returns Workflow calls array
211
- */
212
- readonly calls: WorkflowCall[];
213
- /**
214
- * `tailor.workflow.wait` calls reshaped as `{ key, payload }` for assertions.
188
+ * `wait` calls reshaped as `{ key, payload }` for assertions.
215
189
  * @returns Wait call records
216
190
  */
217
191
  readonly waitCalls: {
@@ -219,33 +193,81 @@ declare const workflowMock: {
219
193
  payload: unknown;
220
194
  }[];
221
195
  /**
222
- * `tailor.workflow.resolve` calls reshaped as `{ executionId, key }` for assertions.
196
+ * `resolve` calls reshaped as `{ executionId, key }` for assertions.
223
197
  * @returns Resolve call records
224
198
  */
225
199
  readonly resolveCalls: {
226
200
  executionId: string;
227
201
  key: string;
228
- }[]; /** Reset all workflow mock state. Call in `beforeEach`. */
202
+ }[]; /** Reset all workflow responses and recorded calls (keeps the mock installed). */
229
203
  reset(): void;
230
- };
231
- /** Mock control for `tailor.secretmanager` — secret store and call recording. */
232
- declare const secretmanagerMock: {
204
+ } & Disposable;
205
+ /**
206
+ * Acquire a disposable mock for `tailor.secretmanager`. The secret store is
207
+ * inherited (cloned) from the currently-installed mock on acquisition and
208
+ * restored on dispose, so secrets seeded outside the test survive across
209
+ * `using` scopes while per-test `setSecrets()` overrides stay isolated.
210
+ * @returns Disposable SecretManager mock control object
211
+ * @example
212
+ * ```typescript
213
+ * import { mockSecretmanager } from "@tailor-platform/sdk/vitest";
214
+ *
215
+ * test("reads secrets from vault", async () => {
216
+ * using sm = mockSecretmanager();
217
+ * sm.setSecrets({ "my-vault": { API_KEY: "sk-123" } });
218
+ * // …
219
+ * });
220
+ * ```
221
+ */
222
+ declare function mockSecretmanager(): {
223
+ /** The `getSecret` `vi.fn`. */getSecret: Mock<(vault: string, name: string) => Promise<string | undefined>>; /** The `getSecrets` `vi.fn`. */
224
+ getSecrets: Mock<(<const T extends readonly string[]>(vault: string, names: T) => Promise<Partial<Record<T[number], string>>>)>;
233
225
  setSecrets(secrets: Record<string, Record<string, string>>): void;
234
226
  readonly calls: SecretCall[];
235
227
  reset(): void;
236
- };
237
- /** Mock control for `tailor.authconnection` — token store and call recording. */
238
- declare const authconnectionMock: {
239
- setTokens(tokens: Record<string, unknown>): void;
228
+ } & Disposable;
229
+ /**
230
+ * Acquire a disposable mock for `tailor.authconnection`. Restored on dispose.
231
+ * @returns Disposable AuthConnection mock control object
232
+ * @example
233
+ * ```typescript
234
+ * import { mockAuthconnection } from "@tailor-platform/sdk/vitest";
235
+ *
236
+ * test("returns configured token", async () => {
237
+ * using ac = mockAuthconnection();
238
+ * ac.setTokens({ google: { access_token: "ya29.xxx" } });
239
+ * // …
240
+ * });
241
+ * ```
242
+ */
243
+ declare function mockAuthconnection(): {
244
+ /** The `getConnectionToken` `vi.fn`. */getConnectionToken: Mock<(connectionName: string) => Promise<any>>;
245
+ setTokens(value: Record<string, unknown>): void;
240
246
  readonly calls: AuthConnectionCall[];
241
247
  reset(): void;
242
- };
243
- /** Mock control for `tailor.idp` — IDP client responses and call recording. */
244
- declare const idpMock: {
245
- setResolver(resolver: IdpResolver): void;
248
+ } & Disposable;
249
+ /**
250
+ * Acquire a disposable mock for `tailor.idp`. Restored on dispose.
251
+ * @returns Disposable IDP mock control object
252
+ * @example
253
+ * ```typescript
254
+ * import { mockIdp } from "@tailor-platform/sdk/vitest";
255
+ *
256
+ * test("resolver-based", async () => {
257
+ * using idp = mockIdp();
258
+ * idp.setResolver((method) =>
259
+ * method === "user" ? { id: "u-1", name: "alice", disabled: false } : null,
260
+ * );
261
+ * // …
262
+ * });
263
+ * ```
264
+ */
265
+ declare function mockIdp(): {
266
+ /** The mock IDP `Client` constructor (`vi.fn`). */Client: Mock;
267
+ setResolver(value: IdpResolver): void;
246
268
  /**
247
- * Enqueue a single result for the next IDP call. Consumed in FIFO order; falls back
248
- * to `setResolver` when exhausted. Use `enqueueResults` to stage multiple in one call.
269
+ * Enqueue a single result for the next IDP call (FIFO; falls back to
270
+ * `setResolver` when exhausted).
249
271
  * @param result - Result to return from the next IDP call
250
272
  */
251
273
  enqueueResult(result: unknown): void;
@@ -256,14 +278,45 @@ declare const idpMock: {
256
278
  enqueueResults(...results: unknown[]): void;
257
279
  readonly calls: IdpCall[];
258
280
  reset(): void;
259
- };
260
- /** Mock control for `tailordb.file` — file operation responses and call recording. */
261
- declare const fileMock: {
262
- setResolver(resolver: FileResolver): void;
281
+ } & Disposable;
282
+ /**
283
+ * Acquire a disposable mock for `tailor.iconv`. Restored on dispose.
284
+ * @returns Disposable Iconv mock control object
285
+ * @example
286
+ * ```typescript
287
+ * import { mockIconv } from "@tailor-platform/sdk/vitest";
288
+ *
289
+ * test("mock encoding conversion", () => {
290
+ * using iconv = mockIconv();
291
+ * iconv.setResolver((method) => (method === "decode" ? "decoded-text" : null));
292
+ * // …
293
+ * });
294
+ * ```
295
+ */
296
+ declare function mockIconv(): {
297
+ setResolver(value: IconvResolver): void;
298
+ readonly calls: IconvCall[];
299
+ reset(): void;
300
+ } & Disposable;
301
+ /**
302
+ * Acquire a disposable mock for `tailordb.file`. Restored on dispose.
303
+ * @returns Disposable File mock control object
304
+ * @example
305
+ * ```typescript
306
+ * import { mockFile } from "@tailor-platform/sdk/vitest";
307
+ *
308
+ * test("mock file download", async () => {
309
+ * using file = mockFile();
310
+ * file.enqueueResult({ data: new Uint8Array([1, 2, 3]), metadata: { ... } });
311
+ * // …
312
+ * });
313
+ * ```
314
+ */
315
+ declare function mockFile(): {
316
+ setResolver(value: FileResolver): void;
263
317
  /**
264
- * Enqueue a single result for the next `tailordb.file` call. Consumed in FIFO order;
265
- * falls back to `setResolver` when exhausted. Use `enqueueResults` to stage multiple
266
- * in one call.
318
+ * Enqueue a single result for the next `tailordb.file` call (FIFO; falls
319
+ * back to `setResolver` when exhausted).
267
320
  * @param result - Result to return from the next file call
268
321
  */
269
322
  enqueueResult(result: unknown): void;
@@ -274,13 +327,7 @@ declare const fileMock: {
274
327
  enqueueResults(...results: unknown[]): void;
275
328
  readonly calls: FileCall[];
276
329
  reset(): void;
277
- };
278
- /** Mock control for `tailor.iconv` — encoding call recording. */
279
- declare const iconvMock: {
280
- setResolver(resolver: IconvResolver): void;
281
- readonly calls: IconvCall[];
282
- reset(): void;
283
- };
330
+ } & Disposable;
284
331
  //#endregion
285
332
  //#region src/vitest/mock-kysely.d.ts
286
333
  /** A single statement executed against the mock, captured in order. */
@@ -362,8 +409,8 @@ declare function createKyselyMock<DB = Record<string, never>>(): KyselyMock<DB>;
362
409
  * via beforeEach/afterEach since Vitest needs it during initialization.
363
410
  *
364
411
  * 3. **Platform API mocks** (environment) — All platform APIs are auto-injected with
365
- * control objects: `tailordbMock`, `workflowMock`, `secretmanagerMock`,
366
- * `authconnectionMock`, `idpMock`, `fileMock`, `iconvMock`. Each
412
+ * control objects: `mockTailordb`, `mockWorkflow`, `mockSecretmanager`,
413
+ * `mockAuthconnection`, `mockIdp`, `mockFile`, `mockIconv`. Each
367
414
  * provides response configuration, call recording, and reset.
368
415
  *
369
416
  * 4. **Environment resolution** — Rewrites `environment: "tailor-runtime"` to the
@@ -378,7 +425,7 @@ declare function createKyselyMock<DB = Record<string, never>>(): KyselyMock<DB>;
378
425
  * ## Options
379
426
  *
380
427
  * - **`config`** — Path to `tailor.config.ts`. Loads `defineSecretManager()` values
381
- * into `secretmanagerMock` so `getSecret()` returns the configured values.
428
+ * into `mockSecretmanager` so `getSecret()` returns the configured values.
382
429
  * @example
383
430
  * ```typescript
384
431
  * // vitest.config.ts
@@ -400,5 +447,5 @@ declare function tailorRuntime(options?: {
400
447
  config?: string;
401
448
  }): Plugin[];
402
449
  //#endregion
403
- export { type ExecutedQuery, type KyselyMock, authconnectionMock, createKyselyMock, fileMock, iconvMock, idpMock, secretmanagerMock, tailorRuntime, tailordbMock, workflowMock };
450
+ export { type ExecutedQuery, type KyselyMock, createKyselyMock, mockAuthconnection, mockFile, mockIconv, mockIdp, mockSecretmanager, mockTailordb, mockWorkflow, tailorRuntime };
404
451
  //# sourceMappingURL=index.d.mts.map
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as fileMock, d as workflowMock, l as secretmanagerMock, o as iconvMock, r as authconnectionMock, s as idpMock, u as tailordbMock } from "../mock-B6PI49C_.mjs";
2
+ import { a as mockSecretmanager, i as mockIdp, n as mockFile, o as mockTailordb, r as mockIconv, s as mockWorkflow, t as mockAuthconnection } from "../mock-Dpu__UeJ.mjs";
3
3
  import { builtinModules } from "node:module";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { dirname, isAbsolute, matchesGlob, relative, resolve } from "node:path";
@@ -234,7 +234,7 @@ function createBlockPlugin() {
234
234
  }
235
235
  if (replacements.length === 0) return void 0;
236
236
  let transformed = code;
237
- for (const r of replacements.sort((a, b) => b.start - a.start)) transformed = transformed.slice(0, r.start) + r.replacement + transformed.slice(r.end);
237
+ for (const r of replacements.toSorted((a, b) => b.start - a.start)) transformed = transformed.slice(0, r.start) + r.replacement + transformed.slice(r.end);
238
238
  return {
239
239
  code: transformed,
240
240
  map: null
@@ -475,8 +475,8 @@ function createKyselyMock() {
475
475
  * via beforeEach/afterEach since Vitest needs it during initialization.
476
476
  *
477
477
  * 3. **Platform API mocks** (environment) — All platform APIs are auto-injected with
478
- * control objects: `tailordbMock`, `workflowMock`, `secretmanagerMock`,
479
- * `authconnectionMock`, `idpMock`, `fileMock`, `iconvMock`. Each
478
+ * control objects: `mockTailordb`, `mockWorkflow`, `mockSecretmanager`,
479
+ * `mockAuthconnection`, `mockIdp`, `mockFile`, `mockIconv`. Each
480
480
  * provides response configuration, call recording, and reset.
481
481
  *
482
482
  * 4. **Environment resolution** — Rewrites `environment: "tailor-runtime"` to the
@@ -491,7 +491,7 @@ function createKyselyMock() {
491
491
  * ## Options
492
492
  *
493
493
  * - **`config`** — Path to `tailor.config.ts`. Loads `defineSecretManager()` values
494
- * into `secretmanagerMock` so `getSecret()` returns the configured values.
494
+ * into `mockSecretmanager` so `getSecret()` returns the configured values.
495
495
  * @example
496
496
  * ```typescript
497
497
  * // vitest.config.ts
@@ -514,5 +514,5 @@ function tailorRuntime(options) {
514
514
  }
515
515
 
516
516
  //#endregion
517
- export { authconnectionMock, createKyselyMock, fileMock, iconvMock, idpMock, secretmanagerMock, tailorRuntime, tailordbMock, workflowMock };
517
+ export { createKyselyMock, mockAuthconnection, mockFile, mockIconv, mockIdp, mockSecretmanager, mockTailordb, mockWorkflow, tailorRuntime };
518
518
  //# sourceMappingURL=index.mjs.map