@tailor-platform/sdk 2.0.0-next.5 → 2.0.0-next.6

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 (118) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/{application-Bf8wxOi6.mjs → application-BJXRpQj5.mjs} +190 -1258
  3. package/dist/application-BJXRpQj5.mjs.map +1 -0
  4. package/dist/application-BV-AXawv.mjs +3 -0
  5. package/dist/cli/commands/deploy/deploy.d.mts +8 -3
  6. package/dist/cli/commands/generate/options.d.mts +0 -1
  7. package/dist/cli/commands/generate/service.d.mts +1 -1
  8. package/dist/cli/commands/staticwebsite/deploy.d.mts +19 -0
  9. package/dist/cli/commands/workspace/create.d.mts +3 -0
  10. package/dist/cli/commands/workspace/list.d.mts +1 -0
  11. package/dist/cli/commands/workspace/transform.d.mts +2 -0
  12. package/dist/cli/index.mjs +776 -1551
  13. package/dist/cli/index.mjs.map +1 -1
  14. package/dist/cli/lib.d.mts +7 -3
  15. package/dist/cli/lib.mjs +49 -3
  16. package/dist/cli/lib.mjs.map +1 -1
  17. package/dist/cli/shared/config-loader.d.mts +1 -1
  18. package/dist/cli/shared/readonly-guard.d.mts +25 -0
  19. package/dist/cli/shared/tailordb-namespaces.d.mts +37 -0
  20. package/dist/cli/shared/workspace-name.d.mts +1 -0
  21. package/dist/completion/zsh-worker.zsh +15 -303
  22. package/dist/configure/index.mjs +7 -6
  23. package/dist/configure/index.mjs.map +1 -1
  24. package/dist/configure/services/executor/executor.d.mts +2 -13
  25. package/dist/configure/services/executor/operation.d.mts +7 -2
  26. package/dist/configure/services/tailordb/schema.d.mts +1 -7
  27. package/dist/configure/services/tailordb/types.d.mts +1 -1
  28. package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
  29. package/dist/configure/types/type.d.mts +1 -9
  30. package/dist/{crashreport-D3RjuSYb.mjs → crashreport-0ioNRZ4K.mjs} +1 -1
  31. package/dist/{crashreport-Cg-pqRJV.mjs → crashreport-CxHne11E.mjs} +4 -3
  32. package/dist/{crashreport-Cg-pqRJV.mjs.map → crashreport-CxHne11E.mjs.map} +1 -1
  33. package/dist/errors-DfnF4ibq.mjs +100 -0
  34. package/dist/errors-DfnF4ibq.mjs.map +1 -0
  35. package/dist/{globals-BjhJJ2dN.mjs → globals-D-YbJKW-.mjs} +16 -10
  36. package/dist/globals-D-YbJKW-.mjs.map +1 -0
  37. package/dist/{logger-BEiZZ3qT.mjs → logger-BwS4ppwO.mjs} +3 -3
  38. package/dist/logger-BwS4ppwO.mjs.map +1 -0
  39. package/dist/parser/service/tailordb/type-source.d.mts +10 -0
  40. package/dist/{register-ts-hook-BhzVkej0.mjs → register-ts-hook-DL31O2W9.mjs} +2623 -1645
  41. package/dist/register-ts-hook-DL31O2W9.mjs.map +1 -0
  42. package/dist/{registry-BSbq6SPo.mjs → registry-CC3CbQiF.mjs} +3 -3
  43. package/dist/registry-CC3CbQiF.mjs.map +1 -0
  44. package/dist/runtime/field-parse.d.mts +10 -0
  45. package/dist/runtime/globals.d.mts +5 -2
  46. package/dist/runtime/index.mjs +1 -1
  47. package/dist/runtime/workflow.d.mts +70 -10
  48. package/dist/runtime/workflow.mjs +1 -1
  49. package/dist/{schema-iCd1ugGp.mjs → schema--xYWRGfe.mjs} +42 -24
  50. package/dist/schema--xYWRGfe.mjs.map +1 -0
  51. package/dist/{secret-file-aoNXJmKa.mjs → secret-file-C3J4Gy8r.mjs} +2 -27
  52. package/dist/secret-file-C3J4Gy8r.mjs.map +1 -0
  53. package/dist/{secretmanager-Bd45j7an.mjs → secretmanager-IY4UvinW.mjs} +42 -9
  54. package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
  55. package/dist/{service-CzZEVrp9.mjs → service-CnHz9rwz.mjs} +34 -12
  56. package/dist/service-CnHz9rwz.mjs.map +1 -0
  57. package/dist/{service-DeZeYa06.mjs → service-DaeJlBoH.mjs} +3 -3
  58. package/dist/{service-DeZeYa06.mjs.map → service-DaeJlBoH.mjs.map} +1 -1
  59. package/dist/service-nU6ITOHL.mjs +3 -0
  60. package/dist/service_pb-BoLM0X4K.mjs +167 -0
  61. package/dist/service_pb-BoLM0X4K.mjs.map +1 -0
  62. package/dist/{service_pb-DZkfjB_6.mjs → service_pb-r1T7kpJc.mjs} +1 -1
  63. package/dist/types/executor.generated.d.mts +60 -42
  64. package/dist/user-agent-Bgsszb5I.mjs +28 -0
  65. package/dist/user-agent-Bgsszb5I.mjs.map +1 -0
  66. package/dist/vitest/environment.mjs +1 -1
  67. package/dist/vitest/index.d.mts +8 -8
  68. package/dist/vitest/index.mjs +591 -173
  69. package/dist/vitest/index.mjs.map +1 -1
  70. package/dist/vitest/mock.d.mts +8 -8
  71. package/dist/vitest/mocks/aigateway.d.mts +14 -4
  72. package/dist/vitest/mocks/authconnection.d.mts +14 -4
  73. package/dist/vitest/mocks/file.d.mts +23 -6
  74. package/dist/vitest/mocks/iconv.d.mts +28 -4
  75. package/dist/vitest/mocks/idp.d.mts +25 -9
  76. package/dist/vitest/mocks/secretmanager.d.mts +13 -4
  77. package/dist/vitest/mocks/tailordb.d.mts +48 -7
  78. package/dist/vitest/mocks/workflow.d.mts +68 -22
  79. package/dist/vitest/setup.mjs +2 -2
  80. package/dist/workflow-9kHGKxF2.mjs +64 -0
  81. package/dist/workflow-9kHGKxF2.mjs.map +1 -0
  82. package/dist/{service_pb-Bk7dL-yT.mjs → workspace_resource_pb-Db3fv68L.mjs} +47 -165
  83. package/dist/workspace_resource_pb-Db3fv68L.mjs.map +1 -0
  84. package/docs/cli/application.md +61 -15
  85. package/docs/cli/tailordb.md +8 -140
  86. package/docs/cli/workspace.md +6 -4
  87. package/docs/cli-reference.md +11 -8
  88. package/docs/github-actions.md +8 -0
  89. package/docs/migration/v2.md +41 -0
  90. package/docs/runtime.md +5 -6
  91. package/docs/services/executor.md +5 -0
  92. package/docs/services/tailordb.md +44 -0
  93. package/docs/services/workflow.md +2 -2
  94. package/docs/testing.md +105 -89
  95. package/package.json +2 -5
  96. package/dist/application-Bf8wxOi6.mjs.map +0 -1
  97. package/dist/application-CUkjzfij.mjs +0 -3
  98. package/dist/cli/erd-viewer-assets/app.js +0 -1424
  99. package/dist/cli/erd-viewer-assets/index.html +0 -77
  100. package/dist/cli/erd-viewer-assets/serve.json +0 -13
  101. package/dist/cli/erd-viewer-assets/styles.css +0 -1036
  102. package/dist/configure/types/field-runtime.d.mts +0 -16
  103. package/dist/errors-118wUDRr.mjs +0 -42
  104. package/dist/errors-118wUDRr.mjs.map +0 -1
  105. package/dist/globals-BjhJJ2dN.mjs.map +0 -1
  106. package/dist/logger-BEiZZ3qT.mjs.map +0 -1
  107. package/dist/register-ts-hook-BhzVkej0.mjs.map +0 -1
  108. package/dist/registry-BSbq6SPo.mjs.map +0 -1
  109. package/dist/resource_pb-BRv7AMXK.mjs +0 -49
  110. package/dist/resource_pb-BRv7AMXK.mjs.map +0 -1
  111. package/dist/schema-iCd1ugGp.mjs.map +0 -1
  112. package/dist/secret-file-aoNXJmKa.mjs.map +0 -1
  113. package/dist/secretmanager-Bd45j7an.mjs.map +0 -1
  114. package/dist/service-BT0GPd01.mjs +0 -3
  115. package/dist/service-CzZEVrp9.mjs.map +0 -1
  116. package/dist/service_pb-Bk7dL-yT.mjs.map +0 -1
  117. package/dist/workflow-GNuSnsTx.mjs +0 -22
  118. package/dist/workflow-GNuSnsTx.mjs.map +0 -1
@@ -3,26 +3,36 @@ import { AuthConnectionTokenResult, ConnectionName } from "@tailor-platform/sdk"
3
3
  interface AuthConnectionCall {
4
4
  connectionName: ConnectionName;
5
5
  }
6
+ /** Initial fixtures and fallback behavior for an AuthConnection mock. */
7
+ interface MockAuthconnectionOptions {
8
+ /** Tokens available when the mock is acquired. */
9
+ tokens?: Partial<Record<ConnectionName, AuthConnectionTokenResult>>;
10
+ /** Return a placeholder token or throw when a connection has no configured token. */
11
+ onUnhandled?: "fallback" | "error";
12
+ }
6
13
  /**
7
14
  * Acquire a disposable mock for `tailor.authconnection`. Restored on dispose.
15
+ * @param options - Initial token fixtures and fallback behavior
8
16
  * @returns Disposable AuthConnection mock control object
9
17
  * @example
10
18
  * ```typescript
11
19
  * import { mockAuthconnection } from "@tailor-platform/sdk/vitest";
12
20
  *
13
21
  * test("returns configured token", async () => {
14
- * using ac = mockAuthconnection();
15
- * ac.setTokens({ google: { access_token: "ya29.xxx" } });
22
+ * using ac = mockAuthconnection({ tokens: { google: { access_token: "ya29.xxx" } } });
23
+ * ac.setToken("google", { access_token: "replacement" });
16
24
  * // …
17
25
  * });
18
26
  * ```
19
27
  */
20
- declare function mockAuthconnection(): {
28
+ declare function mockAuthconnection(options?: MockAuthconnectionOptions): {
21
29
  /** The `getConnectionToken` `vi.fn`. */
22
30
  getConnectionToken: import("vitest").Mock<(connectionName: ConnectionName) => Promise<AuthConnectionTokenResult>>;
23
31
  setTokens(value: Partial<Record<ConnectionName, AuthConnectionTokenResult>>): void;
32
+ setToken(connectionName: ConnectionName, token: AuthConnectionTokenResult): void;
24
33
  readonly calls: AuthConnectionCall[];
34
+ clear(): void;
25
35
  reset(): void;
26
36
  } & Disposable;
27
37
  //#endregion
28
- export { mockAuthconnection };
38
+ export { MockAuthconnectionOptions, mockAuthconnection };
@@ -1,3 +1,5 @@
1
+ import { FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata, FileUploadOptions, FileUploadResponse, FileUploadStreamOptions } from "../../runtime/file.mjs";
2
+ import { Mock } from "vitest";
1
3
  //#region src/vitest/mocks/file.d.ts
2
4
  type FileResolver = (method: string, call: FileCall) => unknown;
3
5
  interface FileCall {
@@ -7,8 +9,14 @@ interface FileCall {
7
9
  fieldName: string;
8
10
  recordId: string;
9
11
  }
12
+ /** Controls fallback behavior for File calls without a configured result. */
13
+ interface MockFileOptions {
14
+ /** Return a type-compatible fixture or throw when no behavior is configured. */
15
+ onUnhandled?: "fallback" | "error";
16
+ }
10
17
  /**
11
18
  * Acquire a disposable mock for `tailordb.file`. Restored on dispose.
19
+ * @param options - Controls behavior for calls without a configured result
12
20
  * @returns Disposable File mock control object
13
21
  * @example
14
22
  * ```typescript
@@ -16,26 +24,35 @@ interface FileCall {
16
24
  *
17
25
  * test("mock file download", async () => {
18
26
  * using file = mockFile();
19
- * file.enqueueResult({ data: new Uint8Array([1, 2, 3]), metadata: { ... } });
27
+ * file.download.mockResolvedValue({ data: new Uint8Array(), metadata: { ... } });
20
28
  * // …
21
29
  * });
22
30
  * ```
23
31
  */
24
- declare function mockFile(): {
32
+ declare function mockFile(options?: MockFileOptions): {
25
33
  setResolver(value: FileResolver): void;
26
34
  /**
27
- * Enqueue a single result for the next `tailordb.file` call (FIFO; falls
28
- * back to `setResolver` when exhausted).
35
+ * Enqueue a single result for the next `tailordb.file` call.
36
+ * The queue is shared across all methods and namespaces.
29
37
  * @param result - Result to return from the next file call
30
38
  */
31
39
  enqueueResult(result: unknown): void;
32
40
  /**
33
41
  * Enqueue results for multiple subsequent `tailordb.file` calls.
42
+ * The queue is shared across all methods and namespaces.
34
43
  * @param results - Results to enqueue, one per upcoming call
35
44
  */
36
45
  enqueueResults(...results: unknown[]): void;
37
- readonly calls: FileCall[];
46
+ calls: FileCall[];
47
+ clear(): void;
38
48
  reset(): void;
49
+ delete: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<void>>;
50
+ upload: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string, data: string | ArrayBuffer | Uint8Array | number[], options?: FileUploadOptions) => Promise<FileUploadResponse>>;
51
+ download: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadResponse>>;
52
+ downloadAsBase64: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadAsBase64Response>>;
53
+ getMetadata: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileMetadata>>;
54
+ downloadStream: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadStreamResponse>>;
55
+ uploadStream: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string, readableStream: ReadableStream<Uint8Array | ArrayBuffer>, options?: FileUploadStreamOptions) => Promise<FileUploadResponse>>;
39
56
  } & Disposable;
40
57
  //#endregion
41
- export { mockFile };
58
+ export { MockFileOptions, mockFile };
@@ -1,11 +1,24 @@
1
+ import { MockInstance } from "vitest";
1
2
  //#region src/vitest/mocks/iconv.d.ts
2
3
  type IconvResolver = (method: string, args: unknown[]) => unknown;
4
+ type IconvMethod = "convert" | "convertBuffer" | "decode" | "encode" | "encodings";
3
5
  interface IconvCall {
4
- method: string;
6
+ method: IconvMethod;
5
7
  args: unknown[];
6
8
  }
9
+ type ConversionResult = string | Uint8Array;
10
+ type ConvertMockProcedure = (input: string | Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: string) => ConversionResult;
11
+ type ConvertBufferMockProcedure = (input: Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: string) => ConversionResult;
12
+ type EncodeMockProcedure = (input: string, encoding: string) => ConversionResult;
13
+ type TypedOperationMock<RuntimeProcedure, MockProcedure extends (...args: never[]) => unknown> = RuntimeProcedure & MockInstance<MockProcedure>;
14
+ /** Controls how unconfigured Iconv operations are handled. */
15
+ interface MockIconvOptions {
16
+ /** Return an empty type-compatible value or throw when no behavior is configured. */
17
+ onUnhandled?: "fallback" | "error";
18
+ }
7
19
  /**
8
20
  * Acquire a disposable mock for `tailor.iconv`. Restored on dispose.
21
+ * @param options - Fallback behavior for unconfigured operations
9
22
  * @returns Disposable Iconv mock control object
10
23
  * @example
11
24
  * ```typescript
@@ -13,15 +26,26 @@ interface IconvCall {
13
26
  *
14
27
  * test("mock encoding conversion", () => {
15
28
  * using iconv = mockIconv();
16
- * iconv.setResolver((method) => (method === "decode" ? "decoded-text" : null));
29
+ * iconv.decode.mockReturnValue("decoded-text");
17
30
  * // …
18
31
  * });
19
32
  * ```
20
33
  */
21
- declare function mockIconv(): {
34
+ declare function mockIconv(options?: MockIconvOptions): {
35
+ /** The `convert` `vi.fn`. */
36
+ convert: TypedOperationMock<(<T extends string>(str: string | Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: T) => T extends "UTF8" | "UTF-8" ? string : Uint8Array), ConvertMockProcedure>;
37
+ /** The `convertBuffer` `vi.fn`. */
38
+ convertBuffer: TypedOperationMock<(<T extends string>(buffer: Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: T) => T extends "UTF8" | "UTF-8" ? string : Uint8Array), ConvertBufferMockProcedure>;
39
+ /** The `decode` `vi.fn`. */
40
+ decode: import("vitest").Mock<(input: Uint8Array | ArrayBuffer, encoding: string) => string>;
41
+ /** The `encode` `vi.fn`. */
42
+ encode: TypedOperationMock<(<T extends string>(str: string, encoding: T) => T extends "UTF8" | "UTF-8" ? string : Uint8Array), EncodeMockProcedure>;
43
+ /** The `encodings` `vi.fn`. */
44
+ encodings: import("vitest").Mock<() => string[]>;
22
45
  setResolver(value: IconvResolver): void;
23
46
  readonly calls: IconvCall[];
47
+ clear: () => void;
24
48
  reset(): void;
25
49
  } & Disposable;
26
50
  //#endregion
27
- export { mockIconv };
51
+ export { MockIconvOptions, mockIconv };
@@ -1,44 +1,60 @@
1
+ import { IdpClientConstructor, IdpClientInstance } from "../../runtime/idp.mjs";
1
2
  import { Mock } from "vitest";
2
3
  //#region src/vitest/mocks/idp.d.ts
4
+ type IdpMethod = keyof IdpClientInstance;
3
5
  type IdpResolver = (method: string, args: unknown[], namespace: string) => unknown;
4
6
  interface IdpCall {
5
7
  method: string;
6
8
  args: unknown[];
7
9
  namespace: string;
8
10
  }
11
+ /** Controls fallback behavior for IdP calls without a configured result. */
12
+ interface MockIdpOptions {
13
+ /** Return a type-compatible fixture or throw when no behavior is configured. */
14
+ onUnhandled?: "fallback" | "error";
15
+ }
16
+ type IdpNamespaceMocks = { [Method in IdpMethod]: Mock<IdpClientInstance[Method]>; };
9
17
  /**
10
18
  * Acquire a disposable mock for `tailor.idp`. Restored on dispose.
19
+ * @param options - Controls behavior for calls without a configured result
11
20
  * @returns Disposable IDP mock control object
12
21
  * @example
13
22
  * ```typescript
14
23
  * import { mockIdp } from "@tailor-platform/sdk/vitest";
15
24
  *
16
- * test("resolver-based", async () => {
25
+ * test("returns a user", async () => {
17
26
  * using idp = mockIdp();
18
- * idp.setResolver((method) =>
19
- * method === "user" ? { id: "u-1", name: "alice", disabled: false } : null,
20
- * );
27
+ * idp.namespace("my-idp").user.mockResolvedValue({
28
+ * id: "u-1",
29
+ * name: "alice",
30
+ * disabled: false,
31
+ * mfaEnrolled: false,
32
+ * mfaFactorIds: [],
33
+ * });
21
34
  * // …
22
35
  * });
23
36
  * ```
24
37
  */
25
- declare function mockIdp(): {
38
+ declare function mockIdp(options?: MockIdpOptions): {
26
39
  /** The mock IDP `Client` constructor (`vi.fn`). */
27
- Client: Mock;
40
+ Client: Mock<IdpClientConstructor>;
41
+ namespace: (name: string) => IdpNamespaceMocks;
28
42
  setResolver(value: IdpResolver): void;
29
43
  /**
30
- * Enqueue a single result for the next IDP call (FIFO; falls back to
31
- * `setResolver` when exhausted).
44
+ * Enqueue a single result for the next IDP call.
45
+ * The queue is shared across all methods and namespaces.
32
46
  * @param result - Result to return from the next IDP call
33
47
  */
34
48
  enqueueResult(result: unknown): void;
35
49
  /**
36
50
  * Enqueue results for multiple subsequent IDP calls.
51
+ * The queue is shared across all methods and namespaces.
37
52
  * @param results - Results to enqueue, one per upcoming call
38
53
  */
39
54
  enqueueResults(...results: unknown[]): void;
40
55
  readonly calls: IdpCall[];
56
+ clear(): void;
41
57
  reset(): void;
42
58
  } & Disposable;
43
59
  //#endregion
44
- export { mockIdp };
60
+ export { MockIdpOptions, mockIdp };
@@ -5,31 +5,40 @@ interface SecretCall {
5
5
  name?: string;
6
6
  names?: readonly string[];
7
7
  }
8
+ /** Initial fixtures for a Secret Manager mock. */
9
+ interface MockSecretmanagerOptions {
10
+ /** Secrets to merge over fixtures inherited from the currently installed mock. */
11
+ secrets?: Record<string, Record<string, string>>;
12
+ }
8
13
  /**
9
14
  * Acquire a disposable mock for `tailor.secretmanager`. The secret store is
10
15
  * inherited (cloned) from the currently-installed mock on acquisition and
11
16
  * restored on dispose, so secrets seeded outside the test survive across
12
17
  * `using` scopes while per-test `setSecrets()` overrides stay isolated.
18
+ * @param options - Initial Secret Manager fixtures
13
19
  * @returns Disposable SecretManager mock control object
14
20
  * @example
15
21
  * ```typescript
16
22
  * import { mockSecretmanager } from "@tailor-platform/sdk/vitest";
17
23
  *
18
24
  * test("reads secrets from vault", async () => {
19
- * using sm = mockSecretmanager();
20
- * sm.setSecrets({ "my-vault": { API_KEY: "sk-123" } });
25
+ * using sm = mockSecretmanager({ secrets: { "my-vault": { API_KEY: "sk-123" } } });
26
+ * sm.setSecret("my-vault", "API_KEY", "replacement");
21
27
  * // …
22
28
  * });
23
29
  * ```
24
30
  */
25
- declare function mockSecretmanager(): {
31
+ declare function mockSecretmanager(options?: MockSecretmanagerOptions): {
26
32
  /** The `getSecret` `vi.fn`. */
27
33
  getSecret: import("vitest").Mock<(vault: string, name: string) => Promise<string | undefined>>;
28
34
  /** The `getSecrets` `vi.fn`. */
29
35
  getSecrets: import("vitest").Mock<(<const T extends readonly string[]>(vault: string, names: T) => Promise<Partial<Record<T[number], string>>>)>;
30
36
  setSecrets(secrets: Record<string, Record<string, string>>): void;
37
+ setSecret(vault: string, name: string, value: string): void;
38
+ mergeSecrets(vault: string, secrets: Record<string, string>): void;
31
39
  readonly calls: SecretCall[];
40
+ clear(): void;
32
41
  reset(): void;
33
42
  } & Disposable;
34
43
  //#endregion
35
- export { mockSecretmanager };
44
+ export { MockSecretmanagerOptions, mockSecretmanager };
@@ -1,5 +1,30 @@
1
1
  //#region src/vitest/mocks/tailordb.d.ts
2
- type QueryResolver = (query: string, params: unknown[]) => unknown[];
2
+ type QueryResolver = (query: string, params: unknown[]) => unknown[] | undefined;
3
+ /** Controls how unmatched TailorDB queries are handled. */
4
+ interface MockTailordbOptions {
5
+ /** Return an empty result or throw when no configured query behavior matches. */
6
+ onUnhandled?: "fallback" | "error";
7
+ }
8
+ /** Matches a TailorDB query by SQL text and optionally by parameters. */
9
+ interface QueryMatch {
10
+ /** Exact SQL text or regular expression to match. */
11
+ sql: string | RegExp;
12
+ /** Exact parameters or a predicate for parameter matching. */
13
+ params?: readonly unknown[] | ((params: unknown[]) => boolean);
14
+ }
15
+ /** Selects TailorDB queries that receive a configured response. */
16
+ type QueryMatcher = string | RegExp | QueryMatch | ((query: string, params: unknown[]) => boolean);
17
+ /** Configures persistent and one-time responses for matched queries. */
18
+ interface QueryBehavior<Row> {
19
+ /** Return these rows for every matching query after one-time responses are consumed. */
20
+ returnsRows(rows: Row[]): QueryBehavior<Row>;
21
+ /** Return these rows for the next matching query. */
22
+ returnsRowsOnce(rows: Row[]): QueryBehavior<Row>;
23
+ /** Reject every matching query after one-time responses are consumed. */
24
+ rejects(error: unknown): QueryBehavior<Row>;
25
+ /** Reject the next matching query. */
26
+ rejectsOnce(error: unknown): QueryBehavior<Row>;
27
+ }
3
28
  interface ExecutedQuery {
4
29
  query: string;
5
30
  params: unknown[];
@@ -19,32 +44,41 @@ declare class MockQueryResult {
19
44
  * `tailordb.Client` whose `queryObject` is a shared `vi.fn()` (so query
20
45
  * responses can be staged before the client is constructed). Restored on
21
46
  * dispose.
47
+ * @param options - Query fallback behavior
22
48
  * @returns Disposable TailorDB mock control object
23
49
  * @example
24
50
  * ```typescript
25
51
  * import { mockTailordb } from "@tailor-platform/sdk/vitest";
26
52
  *
27
- * test("order-based", async () => {
53
+ * test("query-based", async () => {
28
54
  * using db = mockTailordb();
29
- * db.enqueueResults([], [{ age: 30 }], []); // BEGIN / SELECT / COMMIT
55
+ * db.onQuery({ sql: /FROM users/, params: ["u-1"] }).returnsRows([{ age: 30 }]);
30
56
  * // …
31
- * expect(db.queryObject).toHaveBeenCalledTimes(3);
57
+ * expect(db.queryObject).toHaveBeenCalled();
32
58
  * expect(db.Client).toHaveBeenCalledWith({ namespace: "tailordb" });
33
59
  * });
34
60
  * ```
35
61
  */
36
- declare function mockTailordb(): {
62
+ declare function mockTailordb(options?: MockTailordbOptions): {
37
63
  /** The mock `tailordb.Client` constructor (`vi.fn`). */
38
64
  Client: import("vitest").Mock<(this: any, config?: {
39
65
  namespace?: string;
40
66
  }) => void>;
41
67
  /** The shared `queryObject` `vi.fn` used by every client and transaction. */
42
- queryObject: import("vitest").Mock<(_query: string, _params?: unknown[]) => Promise<MockQueryResult>>;
68
+ queryObject: import("vitest").Mock<(query: string, params?: unknown[]) => Promise<MockQueryResult>>;
43
69
  /**
44
70
  * Set a fallback query resolver. Called when the enqueue queue is empty.
45
71
  * @param resolver - Function that returns rows for a given query and params
46
72
  */
47
73
  setQueryResolver(resolver: QueryResolver): void;
74
+ /**
75
+ * Configure responses for queries matching SQL text, parameters, or a predicate.
76
+ * More recently registered matchers take precedence.
77
+ * Do not combine matchers with a direct `queryObject.mockImplementation()` override.
78
+ * @param matcher - Query matcher
79
+ * @returns Chainable query behavior
80
+ */
81
+ onQuery<Row = unknown>(matcher: QueryMatcher): QueryBehavior<Row>;
48
82
  /**
49
83
  * Enqueue rows for the next `queryObject` call (FIFO; takes priority over
50
84
  * `setQueryResolver`). Call with no arguments for an empty result.
@@ -56,6 +90,11 @@ declare function mockTailordb(): {
56
90
  * @param rowsList - Rows arrays, one per upcoming query
57
91
  */
58
92
  enqueueResults(...rowsList: unknown[][]): void;
93
+ /**
94
+ * Enqueue row arrays for subsequent queries whose exact order is under test.
95
+ * @param rowsList - Rows arrays, one per upcoming query
96
+ */
97
+ enqueueRows(...rowsList: unknown[][]): void;
59
98
  /**
60
99
  * All queries executed via `queryObject`, in order, derived from the vi.fn
61
100
  * call records.
@@ -67,8 +106,10 @@ declare function mockTailordb(): {
67
106
  * @returns Created clients array
68
107
  */
69
108
  readonly createdClients: CreatedClient[];
109
+ /** Clear recorded calls while preserving configured query behavior. */
110
+ clear(): void;
70
111
  /** Reset query responses and recorded calls (keeps the mock installed). */
71
112
  reset(): void;
72
113
  } & Disposable;
73
114
  //#endregion
74
- export { mockTailordb };
115
+ export { MockTailordbOptions, QueryBehavior, QueryMatch, QueryMatcher, mockTailordb };
@@ -1,14 +1,12 @@
1
1
  import { TailorEnv } from "../../runtime/types.mjs";
2
- import { TriggerJobFunctionOptions } from "../../runtime/workflow.mjs";
2
+ import { StartJobFunctionOptions, StartWorkflowOptions } from "../../runtime/workflow.mjs";
3
+ import { WorkflowJob } from "../../configure/services/workflow/job.mjs";
4
+ import { Workflow } from "../../configure/services/workflow/workflow.mjs";
5
+ import { WaitPointInstance } from "../../configure/services/workflow/wait-point.mjs";
6
+ import { Mock } from "vitest";
3
7
  //#region src/vitest/mocks/workflow.d.ts
4
- type JobHandler = (jobName: string, args: unknown, options?: TriggerJobFunctionOptions) => unknown;
5
- type TriggerWorkflowOptions = {
6
- authInvoker?: {
7
- namespace: string;
8
- machineUserName: string;
9
- };
10
- };
11
- type TriggerHandlerFn = (workflowName: string, args: unknown, options?: TriggerWorkflowOptions) => string;
8
+ type JobHandler = (jobName: string, args: unknown, options?: StartJobFunctionOptions) => unknown;
9
+ type TriggerHandlerFn = (workflowName: string, args: unknown, options?: StartWorkflowOptions) => string;
12
10
  type ResumeHandlerFn = (executionId: string) => string;
13
11
  type WaitHandlerFn = (key: string, payload: unknown) => unknown;
14
12
  type ResolveHandler = (executionId: string, key: string, callback: (payload: unknown) => unknown) => unknown | Promise<unknown>;
@@ -19,35 +17,81 @@ type SetWaitHandler = {
19
17
  interface TriggeredJob {
20
18
  jobName: string;
21
19
  args: unknown;
22
- options?: TriggerJobFunctionOptions;
20
+ options?: StartJobFunctionOptions;
23
21
  }
22
+ type WaitPayload<Payload> = [Payload] extends [undefined] ? undefined : Payload;
24
23
  /**
25
24
  * Acquire a disposable mock for workflow operations (`tailor.workflow`).
26
25
  * Restored on dispose.
26
+ *
27
+ * Canonical names (`startWorkflow`, `startJobFunction`, `resumeWorkflowExecution`)
28
+ * and their frozen aliases (`triggerWorkflow`, `triggerJobFunction`, `resumeWorkflow`)
29
+ * share the same underlying `vi.fn`, so calls through either name are recorded
30
+ * once and handlers configured on either name apply to both.
27
31
  * @returns Disposable workflow mock control object
28
32
  * @example
29
33
  * ```typescript
30
34
  * import { mockWorkflow } from "@tailor-platform/sdk/vitest";
31
35
  *
32
- * test("job handler", async () => {
36
+ * test("job trigger", async () => {
33
37
  * using wf = mockWorkflow();
34
- * wf.setJobHandler((name) => (name === "validate" ? { valid: true } : null));
35
- * await runWorkflowUnderTest(); // calls tailor.workflow.triggerJobFunction("validate", {})
36
- * expect(wf.triggerJobFunction).toHaveBeenCalledWith("validate", {});
38
+ * const job = wf.job(validateOrder);
39
+ * job.mockResolvedValue({ valid: true });
40
+ * await runWorkflowUnderTest();
41
+ * expect(job).toHaveBeenCalled();
37
42
  * });
38
43
  * ```
39
44
  */
40
45
  declare function mockWorkflow(): {
41
- /** The `triggerJobFunction` `vi.fn`. */
42
- triggerJobFunction: import("vitest").Mock<(jobName: string, _args?: unknown, _options?: TriggerJobFunctionOptions) => unknown>;
43
- /** The `triggerWorkflow` `vi.fn`. */
44
- triggerWorkflow: import("vitest").Mock<(_workflowName: string, _args?: unknown, _options?: TriggerWorkflowOptions) => Promise<string>>;
45
- /** The `resumeWorkflow` `vi.fn`. */
46
- resumeWorkflow: import("vitest").Mock<(executionId: string) => Promise<string>>;
46
+ /** The `startJobFunction` `vi.fn`. */
47
+ startJobFunction: Mock<(jobName: string, _args?: unknown, _options?: StartJobFunctionOptions) => unknown>;
48
+ /**
49
+ * Frozen alias of `startJobFunction` (same `vi.fn` reference).
50
+ * @deprecated Use `startJobFunction` instead.
51
+ */
52
+ triggerJobFunction: Mock<(jobName: string, _args?: unknown, _options?: StartJobFunctionOptions) => unknown>;
53
+ /** The `startWorkflow` `vi.fn`. */
54
+ startWorkflow: Mock<(_workflowName: string, _args?: unknown, _options?: StartWorkflowOptions) => Promise<string>>;
55
+ /**
56
+ * Frozen alias of `startWorkflow` (same `vi.fn` reference).
57
+ * @deprecated Use `startWorkflow` instead.
58
+ */
59
+ triggerWorkflow: Mock<(_workflowName: string, _args?: unknown, _options?: StartWorkflowOptions) => Promise<string>>;
60
+ /** The `resumeWorkflowExecution` `vi.fn`. */
61
+ resumeWorkflowExecution: Mock<(executionId: string) => Promise<string>>;
62
+ /**
63
+ * Frozen alias of `resumeWorkflowExecution` (same `vi.fn` reference).
64
+ * @deprecated Use `resumeWorkflowExecution` instead.
65
+ */
66
+ resumeWorkflow: Mock<(executionId: string) => Promise<string>>;
47
67
  /** The `wait` `vi.fn`. */
48
- wait: import("vitest").Mock<(_key: string, _payload?: unknown) => unknown>;
68
+ wait: Mock<(_key: string, _payload?: unknown) => unknown>;
49
69
  /** The `resolve` `vi.fn`. */
50
- resolve: import("vitest").Mock<(_executionId: string, _key: string, _callback: (payload: unknown) => unknown) => Promise<void>>;
70
+ resolve: Mock<(_executionId: string, _key: string, _callback: (payload: unknown) => unknown) => Promise<void>>;
71
+ /**
72
+ * Get a stable, typed mock for a workflow job's `trigger` method.
73
+ * The real trigger behavior is used until an implementation or result is configured.
74
+ * @param definition - Workflow job definition to mock
75
+ * @returns Typed `trigger` mock for the definition
76
+ */
77
+ job<Name extends string, Input, Output>(definition: WorkflowJob<Name, Input, Output>): Mock<WorkflowJob<Name, Input, Output>["trigger"]>;
78
+ /**
79
+ * Get a stable, typed mock for a workflow definition's `trigger` method.
80
+ * The real trigger behavior is used until an implementation or result is configured.
81
+ * @param definition - Workflow definition to mock
82
+ * @returns Typed `trigger` mock for the definition
83
+ */
84
+ workflow<Definition extends Workflow>(definition: Definition): Mock<Definition["trigger"]>;
85
+ /**
86
+ * Get stable, typed mocks for a wait point's `wait` and `resolve` methods.
87
+ * @param definition - Wait point definition to mock
88
+ * @returns Typed wait point mock control object
89
+ */
90
+ waitPoint<Payload, Result>(definition: WaitPointInstance<Payload, Result>): {
91
+ wait: Mock<WaitPointInstance<Payload, Result>["wait"]>;
92
+ resolve: Mock<WaitPointInstance<Payload, Result>["resolve"]>;
93
+ setResolvePayload(payload: WaitPayload<Payload>): void;
94
+ };
51
95
  /**
52
96
  * Set a fallback job handler. Called when the enqueue queue is empty.
53
97
  * @param handler - Function returning a result for a job name, args, and options
@@ -115,6 +159,8 @@ declare function mockWorkflow(): {
115
159
  executionId: string;
116
160
  key: string;
117
161
  }[];
162
+ /** Clear recorded calls while preserving configured responses. */
163
+ clear(): void;
118
164
  /** Reset all workflow responses and recorded calls (keeps the mock installed). */
119
165
  reset(): void;
120
166
  } & Disposable;
@@ -1,5 +1,5 @@
1
- import { t as RUNTIME_FLAG_KEY } from "../globals-BjhJJ2dN.mjs";
2
- import { t as mockSecretmanager } from "../secretmanager-Bd45j7an.mjs";
1
+ import { t as RUNTIME_FLAG_KEY } from "../globals-D-YbJKW-.mjs";
2
+ import { t as mockSecretmanager } from "../secretmanager-IY4UvinW.mjs";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import { afterEach, beforeAll, beforeEach } from "vitest";
5
5
 
@@ -0,0 +1,64 @@
1
+ //#region src/runtime/workflow.ts
2
+ const api = () => globalThis.tailor.workflow;
3
+ /**
4
+ * See {@link TailorWorkflowAPI.startWorkflow}.
5
+ * @param args - Forwarded to {@link TailorWorkflowAPI.startWorkflow}
6
+ * @returns The execution ID of the started workflow
7
+ */
8
+ const startWorkflow = (...args) => api().startWorkflow(...args);
9
+ /**
10
+ * Frozen alias for {@link startWorkflow}. Kept for backward compatibility.
11
+ * Converts the SDK-facing `invoker` option to the platform's `authInvoker`.
12
+ * @param workflowName - Workflow name as defined in tailor.config
13
+ * @param args - Arguments forwarded to the workflow's main job
14
+ * @param options - Optional SDK trigger options
15
+ * @returns The execution ID of the triggered workflow
16
+ * @deprecated Use {@link startWorkflow} instead.
17
+ */
18
+ function triggerWorkflow(workflowName, args, options) {
19
+ if (options?.invoker === void 0) return api().triggerWorkflow(workflowName, args);
20
+ return api().triggerWorkflow(workflowName, args, { authInvoker: options.invoker });
21
+ }
22
+ /**
23
+ * See {@link TailorWorkflowAPI.resumeWorkflowExecution}.
24
+ * @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflowExecution}
25
+ * @returns The execution ID of the resumed workflow
26
+ */
27
+ const resumeWorkflowExecution = (...args) => api().resumeWorkflowExecution(...args);
28
+ /**
29
+ * Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.
30
+ * @param args - Forwarded to {@link resumeWorkflowExecution}
31
+ * @returns The execution ID of the resumed workflow
32
+ * @deprecated Use {@link resumeWorkflowExecution} instead.
33
+ */
34
+ const resumeWorkflow = (...args) => api().resumeWorkflow(...args);
35
+ /**
36
+ * See {@link TailorWorkflowAPI.startJobFunction}.
37
+ * @param args - Forwarded to {@link TailorWorkflowAPI.startJobFunction}
38
+ * @returns The job's return value
39
+ */
40
+ const startJobFunction = (...args) => api().startJobFunction(...args);
41
+ /**
42
+ * Frozen alias for {@link startJobFunction}. Kept for backward compatibility.
43
+ * @param args - Forwarded to {@link startJobFunction}
44
+ * @returns The job's return value
45
+ * @deprecated Use {@link startJobFunction} instead.
46
+ */
47
+ const triggerJobFunction = (...args) => api().triggerJobFunction(...args);
48
+ const wait = (...args) => api().wait(...args);
49
+ const resolve = (...args) => api().resolve(...args);
50
+ /** Runtime wrapper namespace for `tailor.workflow`. */
51
+ const workflow = {
52
+ startWorkflow,
53
+ triggerWorkflow,
54
+ resumeWorkflowExecution,
55
+ resumeWorkflow,
56
+ startJobFunction,
57
+ triggerJobFunction,
58
+ wait,
59
+ resolve
60
+ };
61
+
62
+ //#endregion
63
+ export { workflow as t };
64
+ //# sourceMappingURL=workflow-9kHGKxF2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-9kHGKxF2.mjs","names":[],"sources":["../src/runtime/workflow.ts"],"sourcesContent":["/**\n * Workflow utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.workflow` runtime API.\n * At runtime this delegates to `globalThis.tailor.workflow`. Use `mockWorkflow`\n * from `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n *\n * The canonical names (`startWorkflow`, `startJobFunction`,\n * `resumeWorkflowExecution`) mirror the public `tailor.v1` RPC vocabulary.\n * The pre-alignment names (`triggerWorkflow`, `triggerJobFunction`,\n * `resumeWorkflow`) are kept as frozen aliases that reference the same platform\n * implementations, so existing code continues to work unchanged.\n * @example\n * import { workflow } from \"@tailor-platform/sdk/runtime\";\n *\n * const executionId = await workflow.startWorkflow(\"myWorkflow\", { data: \"value\" });\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Specifies the machine user that should be used to execute the workflow.\n * This allows workflows to run with specific authentication context.\n */\nexport interface Invoker {\n /** The namespace where the machine user is defined */\n namespace: string;\n /** The name of the machine user to use for workflow execution */\n machineUserName: string;\n}\n\n/** Options for {@link startWorkflow}. */\nexport interface StartWorkflowOptions {\n /** Optional authentication invoker to specify which machine user should execute the workflow */\n authInvoker?: Invoker;\n}\n\n/**\n * Options for the legacy {@link triggerWorkflow} alias, using the SDK-facing\n * `invoker` key that {@link triggerWorkflow} converts to `authInvoker` before\n * calling the platform.\n * @deprecated Use {@link startWorkflow} and {@link StartWorkflowOptions} instead.\n */\nexport interface TriggerWorkflowOptions {\n /** Optional invoker to specify which machine user should execute the workflow */\n invoker?: Invoker;\n}\n\nexport interface PlatformTriggerWorkflowOptions {\n authInvoker?: Invoker;\n}\n\ndeclare const executionPolicyKeyBrand: unique symbol;\n\n/**\n * A concrete runtime key produced by an execution policy instance — either an\n * exact-match policy's `.key`, or a wildcard policy's `.keyFor(suffix)` (see\n * `defineWorkflowExecutionPolicies`). Branded so an arbitrary string that\n * wasn't derived from a declared policy can't be passed as `executionPolicyKey`.\n */\nexport type ExecutionPolicyKey = string & { readonly [executionPolicyKeyBrand]: never };\n\n/** Options for {@link startJobFunction}. */\nexport interface StartJobFunctionOptions {\n /**\n * Execution policy key matched by the platform against the policies\n * declared with `defineWorkflowExecutionPolicies` in `tailor.config.ts`.\n */\n executionPolicyKey?: ExecutionPolicyKey;\n}\n\n/**\n * Frozen alias for {@link StartJobFunctionOptions}. Kept for backward compatibility.\n * @deprecated Use {@link StartJobFunctionOptions} instead.\n */\nexport type TriggerJobFunctionOptions = StartJobFunctionOptions;\n\n/**\n * Platform API surface for `tailor.workflow`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.workflow`.\n */\nexport interface PlatformWorkflowAPI {\n /**\n * Starts a workflow and returns its execution ID.\n *\n * Canonical name that mirrors the `tailor.v1` RPC vocabulary.\n * {@link triggerWorkflow} is a frozen alias that resolves to the same\n * platform implementation.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional start options (e.g. `authInvoker`)\n * @returns The execution ID of the started workflow\n */\n startWorkflow(workflowName: string, args?: any, options?: StartWorkflowOptions): Promise<string>;\n\n /**\n * Frozen alias for {@link startWorkflow}. Kept for backward compatibility.\n * @deprecated Use {@link startWorkflow} instead.\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: PlatformTriggerWorkflowOptions,\n ): Promise<string>;\n\n /**\n * Resumes a failed or pending-retry workflow execution and returns its execution ID.\n *\n * Canonical name that mirrors the `tailor.v1` RPC vocabulary.\n * {@link resumeWorkflow} is a frozen alias that resolves to the same\n * platform implementation.\n * @param executionId - The execution to resume\n * @returns The execution ID of the resumed workflow\n */\n resumeWorkflowExecution(executionId: string): Promise<string>;\n\n /**\n * Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.\n * @deprecated Use {@link resumeWorkflowExecution} instead.\n */\n resumeWorkflow(executionId: string): Promise<string>;\n\n /**\n * Starts a job function and returns its result.\n *\n * Canonical name that mirrors the `tailor.v1` RPC vocabulary.\n * {@link triggerJobFunction} is a frozen alias that resolves to the same\n * platform implementation.\n * @param jobName - Job name as defined in the workflow\n * @param args - Arguments forwarded to the job\n * @param options - Optional start options (e.g. `executionPolicyKey`)\n * @returns The job's return value\n */\n startJobFunction(jobName: string, args?: any, options?: StartJobFunctionOptions): any;\n\n /**\n * Frozen alias for {@link startJobFunction}. Kept for backward compatibility.\n * @deprecated Use {@link startJobFunction} instead.\n */\n triggerJobFunction(jobName: string, args?: any, options?: TriggerJobFunctionOptions): any;\n\n /**\n * Suspends the current workflow execution and waits for an external signal to resume.\n * @param key - Wait point key\n * @param payload - Optional payload to record with the wait point\n * @returns The payload supplied by the corresponding `resolve` call\n */\n wait(key: string, payload?: any): any;\n\n /**\n * Resolves a waiting workflow execution, causing it to resume.\n * @param executionId - The execution to resume\n * @param key - Wait point key to resolve\n * @param callback - Callback receiving the wait payload; its return value is forwarded to `wait`\n * @returns A promise that resolves once the resolve has been recorded\n */\n resolve(executionId: string, key: string, callback: (waitPayload: any) => any): Promise<void>;\n}\n\n/** Runtime wrapper API for workflow and job control. */\nexport interface TailorWorkflowAPI extends Omit<PlatformWorkflowAPI, \"triggerWorkflow\"> {\n /**\n * Triggers a workflow and returns its execution ID.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional SDK trigger options\n * @returns The execution ID of the triggered workflow\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n ): Promise<string>;\n}\n\nconst api = (): PlatformWorkflowAPI =>\n (globalThis as unknown as { tailor: { workflow: PlatformWorkflowAPI } }).tailor.workflow;\n\n/**\n * See {@link TailorWorkflowAPI.startWorkflow}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.startWorkflow}\n * @returns The execution ID of the started workflow\n */\nconst startWorkflow: PlatformWorkflowAPI[\"startWorkflow\"] = (...args) =>\n api().startWorkflow(...args);\n\n/**\n * Frozen alias for {@link startWorkflow}. Kept for backward compatibility.\n * Converts the SDK-facing `invoker` option to the platform's `authInvoker`.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional SDK trigger options\n * @returns The execution ID of the triggered workflow\n * @deprecated Use {@link startWorkflow} instead.\n */\nfunction triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n): Promise<string> {\n if (options?.invoker === undefined) {\n return api().triggerWorkflow(workflowName, args);\n }\n return api().triggerWorkflow(workflowName, args, { authInvoker: options.invoker });\n}\n\n/**\n * See {@link TailorWorkflowAPI.resumeWorkflowExecution}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflowExecution}\n * @returns The execution ID of the resumed workflow\n */\nconst resumeWorkflowExecution: PlatformWorkflowAPI[\"resumeWorkflowExecution\"] = (...args) =>\n api().resumeWorkflowExecution(...args);\n\n/**\n * Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.\n * @param args - Forwarded to {@link resumeWorkflowExecution}\n * @returns The execution ID of the resumed workflow\n * @deprecated Use {@link resumeWorkflowExecution} instead.\n */\nconst resumeWorkflow: PlatformWorkflowAPI[\"resumeWorkflow\"] = (...args) =>\n api().resumeWorkflow(...args);\n\n/**\n * See {@link TailorWorkflowAPI.startJobFunction}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.startJobFunction}\n * @returns The job's return value\n */\nconst startJobFunction: PlatformWorkflowAPI[\"startJobFunction\"] = (...args) =>\n api().startJobFunction(...args);\n\n/**\n * Frozen alias for {@link startJobFunction}. Kept for backward compatibility.\n * @param args - Forwarded to {@link startJobFunction}\n * @returns The job's return value\n * @deprecated Use {@link startJobFunction} instead.\n */\nconst triggerJobFunction: PlatformWorkflowAPI[\"triggerJobFunction\"] = (...args) =>\n api().triggerJobFunction(...args);\n\nconst wait: PlatformWorkflowAPI[\"wait\"] = (...args) => api().wait(...args);\n\nconst resolve: PlatformWorkflowAPI[\"resolve\"] = (...args) => api().resolve(...args);\n\n/** Runtime wrapper namespace for `tailor.workflow`. */\nexport const workflow = {\n startWorkflow,\n triggerWorkflow,\n resumeWorkflowExecution,\n resumeWorkflow,\n startJobFunction,\n triggerJobFunction,\n wait,\n resolve,\n} as const satisfies TailorWorkflowAPI;\n"],"mappings":";AA+KA,MAAM,YACH,WAAwE,OAAO;;;;;;AAOlF,MAAM,iBAAuD,GAAG,SAC9D,IAAI,CAAC,CAAC,cAAc,GAAG,IAAI;;;;;;;;;;AAW7B,SAAS,gBACP,cACA,MACA,SACiB;CACjB,IAAI,SAAS,YAAY,QACvB,OAAO,IAAI,CAAC,CAAC,gBAAgB,cAAc,IAAI;CAEjD,OAAO,IAAI,CAAC,CAAC,gBAAgB,cAAc,MAAM,EAAE,aAAa,QAAQ,QAAQ,CAAC;AACnF;;;;;;AAOA,MAAM,2BAA2E,GAAG,SAClF,IAAI,CAAC,CAAC,wBAAwB,GAAG,IAAI;;;;;;;AAQvC,MAAM,kBAAyD,GAAG,SAChE,IAAI,CAAC,CAAC,eAAe,GAAG,IAAI;;;;;;AAO9B,MAAM,oBAA6D,GAAG,SACpE,IAAI,CAAC,CAAC,iBAAiB,GAAG,IAAI;;;;;;;AAQhC,MAAM,sBAAiE,GAAG,SACxE,IAAI,CAAC,CAAC,mBAAmB,GAAG,IAAI;AAElC,MAAM,QAAqC,GAAG,SAAS,IAAI,CAAC,CAAC,KAAK,GAAG,IAAI;AAEzE,MAAM,WAA2C,GAAG,SAAS,IAAI,CAAC,CAAC,QAAQ,GAAG,IAAI;;AAGlF,MAAa,WAAW;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}