@tailor-platform/sdk 1.68.0 → 1.69.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 (94) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/dist/application-Br48NXBD.mjs +4 -0
  3. package/dist/application-Cr-limKC.mjs +6192 -0
  4. package/dist/application-Cr-limKC.mjs.map +1 -0
  5. package/dist/cli/index.mjs +13 -12
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +234 -153
  8. package/dist/cli/lib.mjs +3 -3
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/cli/skills.mjs +1 -1
  11. package/dist/completion/zsh-worker.zsh +23 -23
  12. package/dist/configure/index.d.mts +2 -2
  13. package/dist/configure/index.mjs +4 -0
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/{crashreport-u9y2npiy.mjs → crashreport-BqyvFk-_.mjs} +2 -2
  16. package/dist/{crashreport-u9y2npiy.mjs.map → crashreport-BqyvFk-_.mjs.map} +1 -1
  17. package/dist/{crashreport-6jpCceOF.mjs → crashreport-BwF8cHF0.mjs} +1 -1
  18. package/dist/enum-constants-C7DaWeQo.mjs.map +1 -1
  19. package/dist/field-C4zdJLW5.mjs.map +1 -1
  20. package/dist/file-utils-BHPxPXmn.mjs.map +1 -1
  21. package/dist/{idp-BlBPtXJ-.d.mts → idp-BmYwCXnJ.d.mts} +30 -3
  22. package/dist/{idp-BZPqpcYY.mjs → idp-ynUfzwpz.mjs} +9 -1
  23. package/dist/idp-ynUfzwpz.mjs.map +1 -0
  24. package/dist/{index-DvEUb3pX.d.mts → index-B7VbJm0_.d.mts} +25 -16
  25. package/dist/{index-DRhMpdnA.d.mts → index-dKNk8hjo.d.mts} +2 -2
  26. package/dist/job-BpsFXPbi.mjs.map +1 -1
  27. package/dist/{kysely-type-D1e0Vwkd.mjs → kysely-type-CSoZxVKN.mjs} +2 -2
  28. package/dist/{kysely-type-D1e0Vwkd.mjs.map → kysely-type-CSoZxVKN.mjs.map} +1 -1
  29. package/dist/{logger-DpJyJvNz.mjs → logger-DKF-JsAK.mjs} +3 -3
  30. package/dist/{logger-DpJyJvNz.mjs.map → logger-DKF-JsAK.mjs.map} +1 -1
  31. package/dist/{mock-DMgIygjE.mjs → mock-wf5qeZLi.mjs} +19 -9
  32. package/dist/mock-wf5qeZLi.mjs.map +1 -0
  33. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  34. package/dist/plugin/index.mjs.map +1 -1
  35. package/dist/registry-D0uB0OrK.mjs.map +1 -1
  36. package/dist/{repl-editor-CJG3sz7A.mjs → repl-editor-DD5YP5mt.mjs} +4 -4
  37. package/dist/{repl-editor-CJG3sz7A.mjs.map → repl-editor-DD5YP5mt.mjs.map} +1 -1
  38. package/dist/runtime/globals.d.mts +3 -2
  39. package/dist/runtime/idp.d.mts +2 -2
  40. package/dist/runtime/idp.mjs +1 -1
  41. package/dist/runtime/index.d.mts +2 -2
  42. package/dist/runtime/index.mjs +1 -1
  43. package/dist/{runtime-DxaBq6U8.mjs → runtime-jowoN6qC.mjs} +84 -34
  44. package/dist/runtime-jowoN6qC.mjs.map +1 -0
  45. package/dist/schema-1msIhXwA.mjs.map +1 -1
  46. package/dist/seed-YAbtMy65.mjs.map +1 -1
  47. package/dist/{service-wI3Hvrgx.mjs → service-B2Jd9CxS.mjs} +2 -2
  48. package/dist/service-B2Jd9CxS.mjs.map +1 -0
  49. package/dist/service-CRaa4Joe.mjs +4 -0
  50. package/dist/{service-DMohAx8a.mjs → service-DDWgZL_L2.mjs} +2 -2
  51. package/dist/service-DDWgZL_L2.mjs.map +1 -0
  52. package/dist/service_pb-DGSmn-aF.mjs +4 -0
  53. package/dist/{application-WpWwTyk9.mjs → service_pb-DSNjrcbW.mjs} +22 -6176
  54. package/dist/service_pb-DSNjrcbW.mjs.map +1 -0
  55. package/dist/telemetry-BQbbVo2t.mjs.map +1 -1
  56. package/dist/types-CmzfQP_m.mjs.map +1 -1
  57. package/dist/utils/test/index.d.mts +2 -2
  58. package/dist/utils/test/index.mjs.map +1 -1
  59. package/dist/vitest/environment.mjs +1 -1
  60. package/dist/vitest/environment.mjs.map +1 -1
  61. package/dist/vitest/index.mjs +4 -4
  62. package/dist/vitest/index.mjs.map +1 -1
  63. package/dist/vitest/setup.mjs +1 -1
  64. package/dist/{workflow.generated-1S50BhEb.d.mts → workflow.generated-Br9bmLdX.d.mts} +98 -3
  65. package/docs/cli/application.md +5 -202
  66. package/docs/cli/auth.md +12 -256
  67. package/docs/cli/completion.md +0 -24
  68. package/docs/cli/crashreport.md +0 -58
  69. package/docs/cli/executor.md +2 -166
  70. package/docs/cli/function.md +2 -118
  71. package/docs/cli/organization.md +1 -211
  72. package/docs/cli/query.md +0 -20
  73. package/docs/cli/secret.md +70 -250
  74. package/docs/cli/setup.md +1 -41
  75. package/docs/cli/skills.md +0 -39
  76. package/docs/cli/staticwebsite.md +24 -172
  77. package/docs/cli/tailordb.md +5 -255
  78. package/docs/cli/upgrade.md +0 -20
  79. package/docs/cli/user.md +32 -247
  80. package/docs/cli/workflow.md +30 -189
  81. package/docs/cli/workspace.md +158 -537
  82. package/docs/cli-reference.md +55 -37
  83. package/docs/configuration.md +7 -1
  84. package/docs/services/idp.md +55 -2
  85. package/docs/services/staticwebsite.md +7 -1
  86. package/package.json +23 -18
  87. package/dist/application-Djeezk3m.mjs +0 -4
  88. package/dist/application-WpWwTyk9.mjs.map +0 -1
  89. package/dist/idp-BZPqpcYY.mjs.map +0 -1
  90. package/dist/mock-DMgIygjE.mjs.map +0 -1
  91. package/dist/runtime-DxaBq6U8.mjs.map +0 -1
  92. package/dist/service-BHQIerYh.mjs +0 -4
  93. package/dist/service-DMohAx8a.mjs.map +0 -1
  94. package/dist/service-wI3Hvrgx.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"idp-BZPqpcYY.mjs","names":["#impl"],"sources":["../src/runtime/idp.ts"],"sourcesContent":["/**\n * IDP (Identity Provider) utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.idp` runtime API.\n * At runtime this delegates to `globalThis.tailor.idp`. Use `mockIdp` from\n * `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n * @example\n * import { idp } from \"@tailor-platform/sdk/runtime\";\n *\n * const client = new idp.Client({ namespace: \"my-namespace\" });\n * const { users } = await client.users({ first: 10 });\n */\n\n/** Configuration object for {@link Client}. */\nexport interface ClientConfig {\n namespace: string;\n}\n\n/** User record returned by IDP operations. */\nexport interface User {\n id: string;\n name: string;\n disabled: boolean;\n createdAt?: string;\n}\n\n/** Filter options for {@link Client.users}. */\nexport interface UserQuery {\n /** Filter by user IDs */\n ids?: string[];\n /** Filter by user names */\n names?: string[];\n}\n\n/** Pagination/filter options for {@link Client.users}. */\nexport interface ListUsersOptions {\n /** Maximum number of users to return */\n first?: number;\n /** Page token for pagination */\n after?: string;\n /** Query filter for users */\n query?: UserQuery;\n}\n\n/** Response shape for {@link Client.users}. */\nexport interface ListUsersResponse {\n users: User[];\n nextPageToken: string | null;\n totalCount: number;\n}\n\n/** Input for {@link Client.createUser}. */\nexport interface CreateUserInput {\n /** The user's name (typically email) */\n name: string;\n /** The user's password. If omitted, the user is created without a password (cannot log in with any password). */\n password?: string;\n /** Whether the user is disabled */\n disabled?: boolean;\n}\n\n/** Input for {@link Client.updateUser}. */\nexport interface UpdateUserInput {\n /** The user's ID */\n id: string;\n /** New name for the user */\n name?: string;\n /** New password for the user. Cannot be used with clearPassword. */\n password?: string;\n /** If true, remove the user's password. Cannot be used with password. */\n clearPassword?: boolean;\n /** New disabled status for the user */\n disabled?: boolean;\n}\n\n/** Input for {@link Client.sendPasswordResetEmail}. */\nexport interface SendPasswordResetEmailInput {\n /** The ID of the user */\n userId: string;\n /** The URI to redirect to after password reset */\n redirectUri: string;\n /** The sender display name. Defaults to 'Tailor Platform IdP'. */\n fromName?: string;\n /** The email subject line. Defaults to the localized default subject. */\n subject?: string;\n}\n\n/** Instance methods exposed by `tailor.idp.Client`. */\nexport interface IdpClientInstance {\n users(options?: ListUsersOptions): Promise<ListUsersResponse>;\n user(userId: string): Promise<User>;\n userByName(name: string): Promise<User>;\n createUser(input: CreateUserInput): Promise<User>;\n updateUser(input: UpdateUserInput): Promise<User>;\n deleteUser(userId: string): Promise<boolean>;\n sendPasswordResetEmail(input: SendPasswordResetEmailInput): Promise<boolean>;\n}\n\n/**\n * Constructor shape for `tailor.idp.Client`.\n * @internal\n */\nexport interface IdpClientConstructor {\n new (config: ClientConfig): IdpClientInstance;\n}\n\n/**\n * Platform API surface for `tailor.idp`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.idp`.\n * @internal\n */\nexport interface TailorIdpAPI {\n Client: IdpClientConstructor;\n}\n\n/**\n * IDP Client for user management operations.\n *\n * Wraps the platform-provided `tailor.idp.Client` and exposes the same surface.\n */\nexport class Client {\n #impl: IdpClientInstance;\n\n constructor(config: ClientConfig) {\n this.#impl = new (globalThis as { tailor: { idp: TailorIdpAPI } }).tailor.idp.Client(config);\n }\n\n /**\n * List users in the namespace with optional filtering and pagination.\n * @param options - Pagination and filter options\n * @returns Page of users with `nextPageToken` and `totalCount`\n */\n users(options?: ListUsersOptions): Promise<ListUsersResponse> {\n return this.#impl.users(options);\n }\n\n /**\n * Get a user by ID.\n * @param userId - IDP user ID\n * @returns The matching user\n */\n user(userId: string): Promise<User> {\n return this.#impl.user(userId);\n }\n\n /**\n * Get a user by name.\n * @param name - IDP user name\n * @returns The matching user\n */\n userByName(name: string): Promise<User> {\n return this.#impl.userByName(name);\n }\n\n /**\n * Create a new user.\n * @param input - User attributes\n * @returns The newly created user\n */\n createUser(input: CreateUserInput): Promise<User> {\n return this.#impl.createUser(input);\n }\n\n /**\n * Update an existing user.\n * @param input - User ID plus attributes to update\n * @returns The updated user\n */\n updateUser(input: UpdateUserInput): Promise<User> {\n return this.#impl.updateUser(input);\n }\n\n /**\n * Delete a user by ID.\n * @param userId - IDP user ID\n * @returns `true` when the user was deleted\n */\n deleteUser(userId: string): Promise<boolean> {\n return this.#impl.deleteUser(userId);\n }\n\n /**\n * Send a password reset email to a user.\n * @param input - Target user ID and redirect URI\n * @returns `true` when the email was queued\n */\n sendPasswordResetEmail(input: SendPasswordResetEmailInput): Promise<boolean> {\n return this.#impl.sendPasswordResetEmail(input);\n }\n}\n"],"mappings":";;;;;;;;;;AAwHA,IAAa,SAAb,MAAoB;CAClB;CAEA,YAAY,QAAsB;EAChC,KAAKA,QAAQ,IAAK,WAAiD,OAAO,IAAI,OAAO,MAAM;CAC7F;;;;;;CAOA,MAAM,SAAwD;EAC5D,OAAO,KAAKA,MAAM,MAAM,OAAO;CACjC;;;;;;CAOA,KAAK,QAA+B;EAClC,OAAO,KAAKA,MAAM,KAAK,MAAM;CAC/B;;;;;;CAOA,WAAW,MAA6B;EACtC,OAAO,KAAKA,MAAM,WAAW,IAAI;CACnC;;;;;;CAOA,WAAW,OAAuC;EAChD,OAAO,KAAKA,MAAM,WAAW,KAAK;CACpC;;;;;;CAOA,WAAW,OAAuC;EAChD,OAAO,KAAKA,MAAM,WAAW,KAAK;CACpC;;;;;;CAOA,WAAW,QAAkC;EAC3C,OAAO,KAAKA,MAAM,WAAW,MAAM;CACrC;;;;;;CAOA,uBAAuB,OAAsD;EAC3E,OAAO,KAAKA,MAAM,uBAAuB,KAAK;CAChD;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock-DMgIygjE.mjs","names":["#fromEncoding","#toEncoding"],"sources":["../src/vitest/mock.ts"],"sourcesContent":["/**\n * Mock controls for Tailor Platform APIs (vitest).\n *\n * Each `xMock()` factory installs `vi.fn()`-backed mocks for one platform\n * namespace onto `globalThis` when acquired, and restores the previous value\n * when the `using` scope exits. State lives in the per-acquisition vi.fns /\n * closures — there is no shared global state bag — so nested/sequential scopes\n * are isolated and namespaces never interfere with each other.\n *\n * Acquire a mock with a `using` declaration:\n *\n * ```ts\n * test(\"...\", () => {\n * using wf = mockWorkflow();\n * wf.setJobHandler(() => ({ ok: true }));\n * }); // previous workflow mock restored here\n * ```\n *\n * The friendly helpers (`setJobHandler`, `enqueueResult`, `triggeredJobs`, …)\n * are thin wrappers over the underlying vi.fns, which are also exposed directly\n * (`wf.triggerJobFunction`) for native matchers like\n * `expect(wf.triggerJobFunction).toHaveBeenCalledWith(...)`.\n */\n\nimport { type Mock, vi } from \"vitest\";\nimport {\n getRegisteredJob,\n getRegisteredWorkflow,\n TRIGGER_DEFAULT,\n} from \"@/configure/services/workflow/registry\";\nimport { assertDefined } from \"@/utils/assert\";\nimport { platformSerialize } from \"@/utils/test/platform-serialize\";\nimport {\n buildJobContext,\n clearWorkflowTestEnv,\n writeWorkflowTestEnv,\n} from \"../configure/services/workflow/test-env-key\";\nimport type { User as IdpUser } from \"../runtime/idp\";\nimport type { TailorEnv } from \"@/runtime/types\";\n\nexport { RUNTIME_FLAG_KEY } from \"./globals\";\n\n// Re-export the base globals install/cleanup under their historical names so\n// non-environment tests (which run in the plain `node` environment) can set up\n// the base platform surface — `globalThis.tailor`, error classes — themselves.\nexport {\n installPlatformGlobals as injectMocks,\n cleanupPlatformGlobals as cleanupMocks,\n} from \"./globals\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype QueryResolver = (query: string, params: unknown[]) => unknown[];\ntype JobHandler = (jobName: string, args: unknown) => unknown;\ntype IdpResolver = (method: string, args: unknown[], namespace: string) => unknown;\ntype FileResolver = (method: string, call: FileCall) => unknown;\ntype IconvResolver = (method: string, args: unknown[]) => unknown;\n\ntype TriggerWorkflowOptions = {\n authInvoker?: { namespace: string; machineUserName: string };\n};\ntype TriggerHandlerFn = (\n workflowName: string,\n args: unknown,\n options?: TriggerWorkflowOptions,\n) => string;\ntype WaitHandlerFn = (key: string, payload: unknown) => unknown;\ntype ResolveHandler = (\n executionId: string,\n key: string,\n callback: (payload: unknown) => unknown,\n) => unknown | Promise<unknown>;\n\n// Overloaded so TypeScript narrows to WaitHandlerFn first (giving inferred\n// `(key: string, payload: unknown) => …` for callers) before falling back\n// to the static-value form. A union type would let `unknown` swallow the\n// function variant and break inference.\ntype SetWaitHandler = {\n (handler: WaitHandlerFn): void;\n (handler: unknown): void;\n};\n\ninterface ExecutedQuery {\n query: string;\n params: unknown[];\n}\n\ninterface CreatedClient {\n namespace: string | undefined;\n ended: boolean;\n}\n\ninterface TriggeredJob {\n jobName: string;\n args: unknown;\n}\n\ninterface SecretCall {\n method: \"getSecret\" | \"getSecrets\";\n vault: string;\n name?: string;\n names?: readonly string[];\n}\n\ninterface AuthConnectionCall {\n connectionName: string;\n}\n\ninterface IdpCall {\n method: string;\n args: unknown[];\n namespace: string;\n}\n\ninterface FileCall {\n method: string;\n namespace: string;\n typeName: string;\n fieldName: string;\n recordId: string;\n}\n\ninterface IconvCall {\n method: string;\n args: unknown[];\n}\n\n// ---------------------------------------------------------------------------\n// Shared helpers\n// ---------------------------------------------------------------------------\n\n// Attach a non-enumerable `Symbol.dispose` to a facade so it works with `using`.\nfunction withDispose<T extends object>(facade: T, dispose: () => void): T & Disposable {\n Object.defineProperty(facade, Symbol.dispose, {\n value: dispose,\n enumerable: false,\n writable: true,\n configurable: true,\n });\n return facade as T & Disposable;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction tailorRoot(): Record<string, any> {\n const g = globalThis as Record<string, unknown>;\n if (!g.tailor) {\n // Ensure the container (and the always-present context stub) exists even if\n // the base globals were not installed (e.g. a unit test that only acquires\n // a single mock without the tailor-runtime environment).\n g.tailor = { context: { getInvoker: () => null } };\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return g.tailor as Record<string, any>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction tailordbRoot(): Record<string, any> {\n const g = globalThis as Record<string, unknown>;\n if (!g.tailordb) {\n g.tailordb = {};\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return g.tailordb as Record<string, any>;\n}\n\nclass MockQueryResult {\n command: string;\n rowCount: number;\n rows: unknown[];\n\n constructor(rows: unknown[]) {\n this.command = \"\";\n this.rowCount = rows.length;\n this.rows = rows;\n }\n}\n\n// ---------------------------------------------------------------------------\n// TailorDB Mock\n// ---------------------------------------------------------------------------\n\n/**\n * Acquire a disposable mock for TailorDB operations. Installs a mock\n * `tailordb.Client` whose `queryObject` is a shared `vi.fn()` (so query\n * responses can be staged before the client is constructed). Restored on\n * dispose.\n * @returns Disposable TailorDB mock control object\n * @example\n * ```typescript\n * import { mockTailordb } from \"@tailor-platform/sdk/vitest\";\n *\n * test(\"order-based\", async () => {\n * using db = mockTailordb();\n * db.enqueueResults([], [{ age: 30 }], []); // BEGIN / SELECT / COMMIT\n * // …\n * expect(db.queryObject).toHaveBeenCalledTimes(3);\n * expect(db.Client).toHaveBeenCalledWith({ namespace: \"tailordb\" });\n * });\n * ```\n */\nexport function mockTailordb() {\n const root = tailordbRoot();\n const prevClient = root.Client;\n\n const queryObject = vi.fn(\n async (_query: string, _params: unknown[] = []): Promise<MockQueryResult> =>\n new MockQueryResult([]),\n );\n const connect = vi.fn(async (): Promise<void> => {});\n const createdClients: CreatedClient[] = [];\n\n const Client = vi.fn(function (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this: any,\n config?: { namespace?: string },\n ) {\n const record: CreatedClient = { namespace: config?.namespace, ended: false };\n createdClients.push(record);\n this.connect = connect;\n this.end = vi.fn(async (): Promise<void> => {\n record.ended = true;\n });\n this.queryObject = queryObject;\n this.createTransaction = (name: string) => {\n if (!name) {\n throw new Error(\"Transaction name must be a non-empty string\");\n }\n return {\n begin: async (): Promise<void> => {},\n commit: async (): Promise<void> => {},\n rollback: async (): Promise<void> => {},\n queryObject,\n };\n };\n });\n\n root.Client = Client;\n\n const facade = {\n /** The mock `tailordb.Client` constructor (`vi.fn`). */\n Client,\n /** The shared `queryObject` `vi.fn` used by every client and transaction. */\n queryObject,\n\n /**\n * Set a fallback query resolver. Called when the enqueue queue is empty.\n * @param resolver - Function that returns rows for a given query and params\n */\n setQueryResolver(resolver: QueryResolver): void {\n queryObject.mockImplementation(\n async (query: string, params: unknown[] = []) =>\n // user resolvers may return undefined\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n new MockQueryResult(resolver(query, params) ?? []),\n );\n },\n\n /**\n * Enqueue rows for the next `queryObject` call (FIFO; takes priority over\n * `setQueryResolver`). Call with no arguments for an empty result.\n * @param rows - Row objects to return from the next `queryObject` call\n */\n enqueueResult(...rows: unknown[]): void {\n queryObject.mockImplementationOnce(async () => new MockQueryResult(rows));\n },\n\n /**\n * Enqueue rows for multiple subsequent `queryObject` calls (FIFO).\n * @param rowsList - Rows arrays, one per upcoming query\n */\n enqueueResults(...rowsList: unknown[][]): void {\n for (const rows of rowsList) {\n queryObject.mockImplementationOnce(async () => new MockQueryResult(rows));\n }\n },\n\n /**\n * All queries executed via `queryObject`, in order, derived from the vi.fn\n * call records.\n * @returns Executed queries array\n */\n get executedQueries(): ExecutedQuery[] {\n return queryObject.mock.calls.map(([query, params]) => ({\n query: query as string,\n // vitest records an omitted argument as undefined\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n params: (params as unknown[]) ?? [],\n }));\n },\n\n /**\n * All TailorDB clients created, with their namespace and end state.\n * @returns Created clients array\n */\n get createdClients(): CreatedClient[] {\n return createdClients;\n },\n\n /** Reset query responses and recorded calls (keeps the mock installed). */\n reset(): void {\n queryObject.mockReset();\n queryObject.mockImplementation(async () => new MockQueryResult([]));\n connect.mockClear();\n Client.mockClear();\n createdClients.length = 0;\n },\n };\n\n return withDispose(facade, () => {\n root.Client = prevClient;\n });\n}\n\n// ---------------------------------------------------------------------------\n// Workflow Mock\n// ---------------------------------------------------------------------------\n\n/**\n * Acquire a disposable mock for workflow operations (`tailor.workflow`).\n * Restored on dispose.\n * @returns Disposable workflow mock control object\n * @example\n * ```typescript\n * import { mockWorkflow } from \"@tailor-platform/sdk/vitest\";\n *\n * test(\"job handler\", async () => {\n * using wf = mockWorkflow();\n * wf.setJobHandler((name) => (name === \"validate\" ? { valid: true } : null));\n * await runWorkflowUnderTest(); // calls tailor.workflow.triggerJobFunction(\"validate\", {})\n * expect(wf.triggerJobFunction).toHaveBeenCalledWith(\"validate\", {});\n * });\n * ```\n */\nexport function mockWorkflow() {\n const root = tailorRoot();\n const prev = root.workflow;\n\n // Default impls (also restored by reset): run the registered body by name so a\n // `.trigger()` with no handler/result executes the real job locally.\n const defaultTriggerJob = (jobName: string, args?: unknown): unknown => {\n const body = getRegisteredJob(jobName);\n return body ? body(args, buildJobContext()) : null;\n };\n const defaultTriggerWorkflow = async (\n workflowName: string,\n args?: unknown,\n _options?: TriggerWorkflowOptions,\n ): Promise<string> => {\n const wf = getRegisteredWorkflow(workflowName);\n if (wf) await installedTriggerJobFunction(wf.mainJobName, args);\n return TRIGGER_DEFAULT;\n };\n\n // Inner vi.fns hold the overridable behavior + call recording; the installed\n // shims below cross the platform JSON boundary (serialize args + results) once\n // so every path (default body, setJobHandler, enqueueResult) is covered.\n const triggerJobFunction = vi.fn(defaultTriggerJob);\n const triggerWorkflow = vi.fn(defaultTriggerWorkflow);\n const wait = vi.fn((_key: string, _payload?: unknown): unknown => null);\n const resolve = vi.fn(\n async (\n _executionId: string,\n _key: string,\n _callback: (payload: unknown) => unknown,\n ): Promise<void> => {},\n );\n\n const installedTriggerJobFunction = (jobName: string, args?: unknown): unknown => {\n const out = triggerJobFunction(jobName, platformSerialize(args));\n return out instanceof Promise ? out.then((v) => platformSerialize(v)) : platformSerialize(out);\n };\n\n root.workflow = {\n triggerJobFunction: installedTriggerJobFunction,\n // Preserve arity so a forwarded third `options` arg — even `undefined` — is\n // recorded, matching the real `.trigger(args, options)` call shape.\n triggerWorkflow: (...call: [string, unknown?, TriggerWorkflowOptions?]) =>\n call.length >= 3\n ? triggerWorkflow(call[0], platformSerialize(call[1]), call[2])\n : triggerWorkflow(call[0], platformSerialize(call[1])),\n wait: (key: string, payload?: unknown) => wait(key, platformSerialize(payload)),\n resolve: (executionId: string, key: string, callback: (payload: unknown) => unknown) =>\n resolve(executionId, key, (payload: unknown) => {\n const out = callback(payload);\n return out instanceof Promise\n ? out.then((v) => platformSerialize(v))\n : platformSerialize(out);\n }),\n };\n\n const facade = {\n /** The `triggerJobFunction` `vi.fn`. */\n triggerJobFunction,\n /** The `triggerWorkflow` `vi.fn`. */\n triggerWorkflow,\n /** The `wait` `vi.fn`. */\n wait,\n /** The `resolve` `vi.fn`. */\n resolve,\n\n /**\n * Set a fallback job handler. Called when the enqueue queue is empty.\n * @param handler - Function returning a result for a job name and args\n */\n setJobHandler(handler: JobHandler): void {\n triggerJobFunction.mockImplementation((name, args) => handler(name, args));\n },\n\n /**\n * Enqueue a single result for the next `triggerJobFunction` call (FIFO;\n * takes priority over `setJobHandler`).\n * @param result - Result to return from the next call\n */\n enqueueResult(result: unknown): void {\n triggerJobFunction.mockImplementationOnce(() => result);\n },\n\n /**\n * Enqueue results for multiple subsequent `triggerJobFunction` calls (FIFO).\n * @param results - Results to enqueue, one per upcoming call\n */\n enqueueResults(...results: unknown[]): void {\n for (const result of results) {\n triggerJobFunction.mockImplementationOnce(() => result);\n }\n },\n\n /**\n * All jobs triggered via `triggerJobFunction`, in order.\n * @returns Triggered jobs array\n */\n get triggeredJobs(): TriggeredJob[] {\n return triggerJobFunction.mock.calls.map(([jobName, args]) => ({\n jobName: jobName as string,\n args,\n }));\n },\n\n /**\n * Configure what `triggerWorkflow` returns. Pass a string (same id every\n * call) or `(name, args, options) => string`. Default: a placeholder UUID.\n * @param handler - Static execution ID or a function returning one\n */\n setTriggerHandler(handler: string | TriggerHandlerFn): void {\n triggerWorkflow.mockImplementation(\n typeof handler === \"function\"\n ? async (name, args, options) => handler(name, args, options)\n : async () => handler,\n );\n },\n\n /**\n * Configure what `wait` returns. Pass `(key, payload) => unknown` or any\n * other value to return it for every call. Default: `null`.\n * @param handler - Static value or a function returning one\n */\n setWaitHandler: ((handler: unknown) => {\n wait.mockImplementation(\n typeof handler === \"function\"\n ? (key, payload) => (handler as WaitHandlerFn)(key, payload)\n : () => handler,\n );\n }) as SetWaitHandler,\n\n /**\n * Set the `env` passed to job bodies invoked via `createWorkflowJob().trigger()`.\n * Cleared on dispose / reset.\n * @param env - Env passed to job bodies.\n */\n setEnv(env: TailorEnv): void {\n writeWorkflowTestEnv({ ...env });\n },\n\n /**\n * Configure how `resolve` runs the user-supplied callback. Default: callback\n * is not invoked (records the call only).\n * @param handler - Function invoked per `resolve` call\n */\n setResolveHandler(handler: ResolveHandler): void {\n resolve.mockImplementation(async (executionId, key, callback) => {\n await handler(executionId, key, callback);\n });\n },\n\n /**\n * `wait` calls reshaped as `{ key, payload }` for assertions.\n * @returns Wait call records\n */\n get waitCalls(): { key: string; payload: unknown }[] {\n return wait.mock.calls.map(([key, payload]) => ({ key: key as string, payload }));\n },\n\n /**\n * `resolve` calls reshaped as `{ executionId, key }` for assertions.\n * @returns Resolve call records\n */\n get resolveCalls(): { executionId: string; key: string }[] {\n return resolve.mock.calls.map(([executionId, key]) => ({\n executionId: executionId as string,\n key: key as string,\n }));\n },\n\n /** Reset all workflow responses and recorded calls (keeps the mock installed). */\n reset(): void {\n triggerJobFunction.mockReset();\n triggerJobFunction.mockImplementation(defaultTriggerJob);\n triggerWorkflow.mockReset();\n triggerWorkflow.mockImplementation(defaultTriggerWorkflow);\n wait.mockReset();\n wait.mockImplementation(() => null);\n resolve.mockReset();\n resolve.mockImplementation(async () => {});\n clearWorkflowTestEnv();\n },\n };\n\n return withDispose(facade, () => {\n root.workflow = prev;\n clearWorkflowTestEnv();\n });\n}\n\n// ---------------------------------------------------------------------------\n// SecretManager Mock\n// ---------------------------------------------------------------------------\n\n// Hidden accessor key used to inherit the previous scope's secret store on\n// acquisition (so secrets seeded once outside tests — e.g. from tailor.config.ts\n// via setup.ts — remain visible) while still isolating per-test overrides.\nconst SECRET_STORE = Symbol(\"tailorSecretStore\");\n\n/**\n * Acquire a disposable mock for `tailor.secretmanager`. The secret store is\n * inherited (cloned) from the currently-installed mock on acquisition and\n * restored on dispose, so secrets seeded outside the test survive across\n * `using` scopes while per-test `setSecrets()` overrides stay isolated.\n * @returns Disposable SecretManager mock control object\n * @example\n * ```typescript\n * import { mockSecretmanager } from \"@tailor-platform/sdk/vitest\";\n *\n * test(\"reads secrets from vault\", async () => {\n * using sm = mockSecretmanager();\n * sm.setSecrets({ \"my-vault\": { API_KEY: \"sk-123\" } });\n * // …\n * });\n * ```\n */\nexport function mockSecretmanager() {\n const root = tailorRoot();\n const prev = root.secretmanager;\n\n const holder: { store: Record<string, Record<string, string>> } = {\n // prior mock state may be absent\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n store: structuredClone((prev?.[SECRET_STORE]?.store as typeof holder.store) ?? {}),\n };\n\n const getSecret = vi.fn(\n async (vault: string, name: string): Promise<string | undefined> => holder.store[vault]?.[name],\n );\n const getSecrets = vi.fn(\n async <const T extends readonly string[]>(\n vault: string,\n names: T,\n ): Promise<Partial<Record<T[number], string>>> => {\n const vaultData = holder.store[vault] ?? {};\n const result: Record<string, string> = {};\n for (const name of names) {\n if (name in vaultData) {\n result[name] = assertDefined(vaultData[name], `vault entry missing for: ${name}`);\n }\n }\n return result as Partial<Record<T[number], string>>;\n },\n );\n\n root.secretmanager = { getSecret, getSecrets, [SECRET_STORE]: holder };\n\n const facade = {\n /** The `getSecret` `vi.fn`. */\n getSecret,\n /** The `getSecrets` `vi.fn`. */\n getSecrets,\n\n setSecrets(secrets: Record<string, Record<string, string>>): void {\n holder.store = secrets;\n },\n\n get calls(): SecretCall[] {\n // Merge both methods' calls back into chronological order via vi.fn's\n // global invocationCallOrder, so a test mixing getSecret/getSecrets sees\n // them in the order they actually ran (not all getSecret, then all getSecrets).\n const entries: { order: number; call: SecretCall }[] = [\n ...getSecret.mock.calls.map((args, i) => ({\n order: getSecret.mock.invocationCallOrder[i] ?? 0,\n call: { method: \"getSecret\" as const, vault: args[0] as string, name: args[1] as string },\n })),\n ...getSecrets.mock.calls.map((args, i) => ({\n order: getSecrets.mock.invocationCallOrder[i] ?? 0,\n call: {\n method: \"getSecrets\" as const,\n vault: args[0] as string,\n names: args[1] as readonly string[],\n },\n })),\n ];\n return entries.toSorted((a, b) => a.order - b.order).map((e) => e.call);\n },\n\n reset(): void {\n holder.store = {};\n getSecret.mockClear();\n getSecrets.mockClear();\n },\n };\n\n return withDispose(facade, () => {\n root.secretmanager = prev;\n });\n}\n\n// ---------------------------------------------------------------------------\n// AuthConnection Mock\n// ---------------------------------------------------------------------------\n\n/**\n * Acquire a disposable mock for `tailor.authconnection`. Restored on dispose.\n * @returns Disposable AuthConnection mock control object\n * @example\n * ```typescript\n * import { mockAuthconnection } from \"@tailor-platform/sdk/vitest\";\n *\n * test(\"returns configured token\", async () => {\n * using ac = mockAuthconnection();\n * ac.setTokens({ google: { access_token: \"ya29.xxx\" } });\n * // …\n * });\n * ```\n */\nexport function mockAuthconnection() {\n const root = tailorRoot();\n const prev = root.authconnection;\n\n let tokens: Record<string, unknown> = {};\n const getConnectionToken = vi.fn(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n async (connectionName: string): Promise<any> =>\n tokens[connectionName] ?? { access_token: \"mock-token\" },\n );\n\n root.authconnection = { getConnectionToken };\n\n const facade = {\n /** The `getConnectionToken` `vi.fn`. */\n getConnectionToken,\n\n setTokens(value: Record<string, unknown>): void {\n tokens = value;\n },\n\n get calls(): AuthConnectionCall[] {\n return getConnectionToken.mock.calls.map(([connectionName]) => ({\n connectionName: connectionName as string,\n }));\n },\n\n reset(): void {\n tokens = {};\n getConnectionToken.mockClear();\n },\n };\n\n return withDispose(facade, () => {\n root.authconnection = prev;\n });\n}\n\n// ---------------------------------------------------------------------------\n// IDP Mock\n// ---------------------------------------------------------------------------\n\nconst IDP_DEFAULTS: Record<string, unknown> = {\n users: { users: [], nextPageToken: null, totalCount: 0 },\n user: { id: \"mock-id\", name: \"mock-user\", disabled: false },\n userByName: { id: \"mock-id\", name: \"mock-user\", disabled: false },\n createUser: { id: \"mock-id\", name: \"mock-user\", disabled: false },\n updateUser: { id: \"mock-id\", name: \"mock-user\", disabled: false },\n deleteUser: true,\n sendPasswordResetEmail: true,\n};\n\n/**\n * Acquire a disposable mock for `tailor.idp`. Restored on dispose.\n * @returns Disposable IDP mock control object\n * @example\n * ```typescript\n * import { mockIdp } from \"@tailor-platform/sdk/vitest\";\n *\n * test(\"resolver-based\", async () => {\n * using idp = mockIdp();\n * idp.setResolver((method) =>\n * method === \"user\" ? { id: \"u-1\", name: \"alice\", disabled: false } : null,\n * );\n * // …\n * });\n * ```\n */\nexport function mockIdp() {\n const root = tailorRoot();\n const prev = root.idp;\n\n const queue: unknown[] = [];\n let resolver: IdpResolver = () => null;\n const calls: IdpCall[] = [];\n\n function handle(method: string, args: unknown[], namespace: string): unknown {\n calls.push({ method, args, namespace });\n if (queue.length > 0) return queue.shift();\n const resolved = resolver(method, args, namespace);\n // Treat null and undefined alike as \"no override\".\n if (resolved != null) return resolved;\n // Clone the default so a test mutating the returned value cannot corrupt\n // the shared module-level object for subsequent tests.\n const fallback = IDP_DEFAULTS[method];\n return fallback === undefined ? undefined : structuredClone(fallback);\n }\n\n const Client = vi.fn(function (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this: any,\n config: { namespace: string },\n ) {\n const namespace = config.namespace;\n this.users = async (options?: unknown) => handle(\"users\", [options], namespace);\n this.user = async (userId: string) => handle(\"user\", [userId], namespace);\n this.userByName = async (name: string) => handle(\"userByName\", [name], namespace);\n this.createUser = async (input: unknown) => handle(\"createUser\", [input], namespace);\n this.updateUser = async (input: unknown) => handle(\"updateUser\", [input], namespace);\n this.deleteUser = async (userId: string) => handle(\"deleteUser\", [userId], namespace);\n this.sendPasswordResetEmail = async (input: unknown) =>\n handle(\"sendPasswordResetEmail\", [input], namespace);\n }) as unknown as new (config: { namespace: string }) => {\n users(options?: {\n first?: number;\n after?: string;\n query?: { ids?: string[]; names?: string[] };\n }): Promise<{ users: IdpUser[]; nextPageToken: string | null; totalCount: number }>;\n user(userId: string): Promise<IdpUser>;\n userByName(name: string): Promise<IdpUser>;\n createUser(input: { name: string; password?: string; disabled?: boolean }): Promise<IdpUser>;\n updateUser(input: {\n id: string;\n name?: string;\n password?: string;\n clearPassword?: boolean;\n disabled?: boolean;\n }): Promise<IdpUser>;\n deleteUser(userId: string): Promise<boolean>;\n sendPasswordResetEmail(input: { userId: string; redirectUri: string }): Promise<boolean>;\n };\n\n root.idp = { Client };\n\n const facade = {\n /** The mock IDP `Client` constructor (`vi.fn`). */\n Client: Client as unknown as Mock,\n\n setResolver(value: IdpResolver): void {\n resolver = value;\n },\n\n /**\n * Enqueue a single result for the next IDP call (FIFO; falls back to\n * `setResolver` when exhausted).\n * @param result - Result to return from the next IDP call\n */\n enqueueResult(result: unknown): void {\n queue.push(result);\n },\n\n /**\n * Enqueue results for multiple subsequent IDP calls.\n * @param results - Results to enqueue, one per upcoming call\n */\n enqueueResults(...results: unknown[]): void {\n queue.push(...results);\n },\n\n get calls(): IdpCall[] {\n return calls;\n },\n\n reset(): void {\n queue.length = 0;\n resolver = () => null;\n calls.length = 0;\n },\n };\n\n return withDispose(facade, () => {\n root.idp = prev;\n });\n}\n\n// ---------------------------------------------------------------------------\n// Iconv Mock\n// ---------------------------------------------------------------------------\n\n// Iconv methods return `string` for UTF-8 target encodings and `Uint8Array`\n// for any other byte-producing encoding (the platform API mirrors this).\nfunction isUtf8(encoding: unknown): boolean {\n return encoding === \"UTF8\" || encoding === \"UTF-8\";\n}\n\nfunction defaultIconvResult(method: string, args: unknown[]): unknown {\n switch (method) {\n case \"convert\":\n case \"convertBuffer\":\n return isUtf8(args[2]) ? \"\" : new Uint8Array();\n case \"decode\":\n return \"\";\n case \"encode\":\n return isUtf8(args[1]) ? \"\" : new Uint8Array();\n case \"encodings\":\n return [];\n default:\n return undefined;\n }\n}\n\n/**\n * Acquire a disposable mock for `tailor.iconv`. Restored on dispose.\n * @returns Disposable Iconv mock control object\n * @example\n * ```typescript\n * import { mockIconv } from \"@tailor-platform/sdk/vitest\";\n *\n * test(\"mock encoding conversion\", () => {\n * using iconv = mockIconv();\n * iconv.setResolver((method) => (method === \"decode\" ? \"decoded-text\" : null));\n * // …\n * });\n * ```\n */\nexport function mockIconv() {\n const root = tailorRoot();\n const prev = root.iconv;\n\n let resolver: IconvResolver | null = null;\n const calls: IconvCall[] = [];\n\n function handle(method: string, args: unknown[]): unknown {\n calls.push({ method, args: [...args] });\n if (resolver) {\n const result = resolver(method, args);\n if (result != null) return result;\n }\n return defaultIconvResult(method, args);\n }\n\n class MockIconv {\n #fromEncoding: string;\n #toEncoding: string;\n constructor(fromEncoding: string, toEncoding: string) {\n this.#fromEncoding = fromEncoding;\n this.#toEncoding = toEncoding;\n }\n convert(input: string | Uint8Array | ArrayBuffer): string | Uint8Array {\n return handle(\"convert\", [input, this.#fromEncoding, this.#toEncoding]) as\n | string\n | Uint8Array;\n }\n }\n\n root.iconv = {\n convert: (str: unknown, from: string, to: string) => handle(\"convert\", [str, from, to]),\n convertBuffer: (buf: unknown, from: string, to: string) =>\n handle(\"convertBuffer\", [buf, from, to]),\n decode: (buf: unknown, encoding: string) => handle(\"decode\", [buf, encoding]),\n encode: (str: string, encoding: string) => handle(\"encode\", [str, encoding]),\n encodings: () => handle(\"encodings\", []),\n Iconv: MockIconv,\n };\n\n const facade = {\n setResolver(value: IconvResolver): void {\n resolver = value;\n },\n\n get calls(): IconvCall[] {\n return calls;\n },\n\n reset(): void {\n resolver = null;\n calls.length = 0;\n },\n };\n\n return withDispose(facade, () => {\n root.iconv = prev;\n });\n}\n\n// ---------------------------------------------------------------------------\n// File Mock (tailordb.file)\n// ---------------------------------------------------------------------------\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst FILE_DEFAULTS: Record<string, any> = {\n upload: { metadata: { fileSize: 0, sha256sum: \"\" } },\n download: {\n data: new Uint8Array(),\n metadata: { contentType: \"\", fileSize: 0, sha256sum: \"\", lastUploadedAt: \"\" },\n },\n downloadAsBase64: {\n data: \"\",\n metadata: { contentType: \"\", fileSize: 0, sha256sum: \"\", lastUploadedAt: \"\" },\n },\n delete: undefined,\n getMetadata: { contentType: \"\", fileSize: 0, sha256sum: \"\", urlPath: \"\" },\n downloadStream: null,\n uploadStream: { metadata: { fileSize: 0, sha256sum: \"\" } },\n};\n\ntype FileStream = AsyncIterableIterator<unknown> & { close(): Promise<void> };\n\nfunction toFileStream(value: unknown): FileStream {\n if (\n value !== null &&\n typeof value === \"object\" &&\n Symbol.asyncIterator in value &&\n typeof (value as { close?: unknown }).close === \"function\"\n ) {\n return value as FileStream;\n }\n if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {\n throw new TypeError(\n \"openDownloadStream expects an iterable of StreamValue items \" +\n '(e.g. [{ type: \"chunk\", data, position }, { type: \"complete\" }]); ' +\n \"got raw bytes. Wrap the bytes in a structured chunk first.\",\n );\n }\n if (\n value !== null &&\n typeof value === \"object\" &&\n (Symbol.iterator in value || Symbol.asyncIterator in value)\n ) {\n const source = value as Iterable<unknown> | AsyncIterable<unknown>;\n const inner =\n Symbol.asyncIterator in source\n ? (source as AsyncIterable<unknown>)[Symbol.asyncIterator]()\n : (source as Iterable<unknown>)[Symbol.iterator]();\n const stream: FileStream = {\n async next() {\n const r = await inner.next();\n if (!r.done) {\n assertStreamValue(r.value);\n }\n return r.done ? { done: true as const, value: undefined } : r;\n },\n async close() {},\n [Symbol.asyncIterator]() {\n return stream;\n },\n };\n return stream;\n }\n const empty: FileStream = {\n async next() {\n return { done: true as const, value: undefined };\n },\n async close() {},\n [Symbol.asyncIterator]() {\n return empty;\n },\n };\n return empty;\n}\n\nfunction assertStreamValue(v: unknown): void {\n if (v === null || typeof v !== \"object\") {\n throw new TypeError(\n 'openDownloadStream expected a StreamValue item ({ type: \"metadata\" | \"chunk\" | \"complete\", ... }); ' +\n `got ${typeof v === \"object\" ? \"null\" : typeof v}.`,\n );\n }\n if (v instanceof ArrayBuffer || ArrayBuffer.isView(v)) {\n throw new TypeError(\n \"openDownloadStream expected a StreamValue item, got raw bytes. \" +\n 'Wrap the bytes in a structured chunk first (e.g. { type: \"chunk\", data, position }).',\n );\n }\n const type = (v as { type?: unknown }).type;\n if (type !== \"metadata\" && type !== \"chunk\" && type !== \"complete\") {\n throw new TypeError(\n 'openDownloadStream expected a StreamValue item with type \"metadata\" | \"chunk\" | \"complete\"; ' +\n `got ${JSON.stringify(type)}.`,\n );\n }\n}\n\n/**\n * Acquire a disposable mock for `tailordb.file`. Restored on dispose.\n * @returns Disposable File mock control object\n * @example\n * ```typescript\n * import { mockFile } from \"@tailor-platform/sdk/vitest\";\n *\n * test(\"mock file download\", async () => {\n * using file = mockFile();\n * file.enqueueResult({ data: new Uint8Array([1, 2, 3]), metadata: { ... } });\n * // …\n * });\n * ```\n */\nexport function mockFile() {\n const root = tailordbRoot();\n const prev = root.file;\n\n const queue: unknown[] = [];\n let resolver: FileResolver = () => null;\n const calls: FileCall[] = [];\n\n function handle(\n method: string,\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n ): unknown {\n const call: FileCall = { method, namespace, typeName, fieldName, recordId };\n calls.push(call);\n if (queue.length > 0) return queue.shift();\n const resolved = resolver(method, call);\n if (resolved != null) return resolved;\n const fallback = FILE_DEFAULTS[method];\n return fallback === undefined ? undefined : structuredClone(fallback);\n }\n\n root.file = {\n async upload(namespace: string, typeName: string, fieldName: string, recordId: string) {\n return handle(\"upload\", namespace, typeName, fieldName, recordId);\n },\n async download(namespace: string, typeName: string, fieldName: string, recordId: string) {\n return handle(\"download\", namespace, typeName, fieldName, recordId);\n },\n async downloadAsBase64(\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n ) {\n return handle(\"downloadAsBase64\", namespace, typeName, fieldName, recordId);\n },\n async delete(namespace: string, typeName: string, fieldName: string, recordId: string) {\n handle(\"delete\", namespace, typeName, fieldName, recordId);\n },\n async getMetadata(namespace: string, typeName: string, fieldName: string, recordId: string) {\n return handle(\"getMetadata\", namespace, typeName, fieldName, recordId);\n },\n async openDownloadStream(\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n ) {\n return toFileStream(handle(\"openDownloadStream\", namespace, typeName, fieldName, recordId));\n },\n async downloadStream(namespace: string, typeName: string, fieldName: string, recordId: string) {\n const resolved = handle(\"downloadStream\", namespace, typeName, fieldName, recordId);\n if (resolved != null) return resolved;\n return {\n body: new ReadableStream({\n start(c) {\n c.close();\n },\n }),\n metadata: { contentType: \"\", fileSize: 0, sha256sum: \"\", lastUploadedAt: \"\" },\n };\n },\n async uploadStream(namespace: string, typeName: string, fieldName: string, recordId: string) {\n return handle(\"uploadStream\", namespace, typeName, fieldName, recordId);\n },\n };\n\n const facade = {\n setResolver(value: FileResolver): void {\n resolver = value;\n },\n\n /**\n * Enqueue a single result for the next `tailordb.file` call (FIFO; falls\n * back to `setResolver` when exhausted).\n * @param result - Result to return from the next file call\n */\n enqueueResult(result: unknown): void {\n queue.push(result);\n },\n\n /**\n * Enqueue results for multiple subsequent `tailordb.file` calls.\n * @param results - Results to enqueue, one per upcoming call\n */\n enqueueResults(...results: unknown[]): void {\n queue.push(...results);\n },\n\n get calls(): FileCall[] {\n return calls;\n },\n\n reset(): void {\n queue.length = 0;\n resolver = () => null;\n calls.length = 0;\n },\n };\n\n return withDispose(facade, () => {\n root.file = prev;\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsIA,SAAS,YAA8B,QAAW,SAAqC;CACrF,OAAO,eAAe,QAAQ,OAAO,SAAS;EAC5C,OAAO;EACP,YAAY;EACZ,UAAU;EACV,cAAc;CAChB,CAAC;CACD,OAAO;AACT;AAGA,SAAS,aAAkC;CACzC,MAAM,IAAI;CACV,IAAI,CAAC,EAAE,QAIL,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,KAAK,EAAE;CAGnD,OAAO,EAAE;AACX;AAGA,SAAS,eAAoC;CAC3C,MAAM,IAAI;CACV,IAAI,CAAC,EAAE,UACL,EAAE,WAAW,CAAC;CAGhB,OAAO,EAAE;A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