@tailor-platform/sdk 1.82.0 → 1.83.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 (41) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/application-CP7JKG9R.mjs +3 -0
  3. package/dist/{application-CVeA53ok.mjs → application-Cp0FxIm2.mjs} +3 -3
  4. package/dist/application-Cp0FxIm2.mjs.map +1 -0
  5. package/dist/cli/index.mjs +3 -3
  6. package/dist/cli/lib.mjs +2 -2
  7. package/dist/completion/zsh-worker.zsh +1 -1
  8. package/dist/configure/index.mjs +3 -3
  9. package/dist/configure/index.mjs.map +1 -1
  10. package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
  11. package/dist/{globals-DUqEetIh.mjs → globals-DraXTdqg.mjs} +6 -5
  12. package/dist/globals-DraXTdqg.mjs.map +1 -0
  13. package/dist/{register-typescript-runtime-O7zQNif0.mjs → register-typescript-runtime-CCHyKeXO.mjs} +125 -11
  14. package/dist/register-typescript-runtime-CCHyKeXO.mjs.map +1 -0
  15. package/dist/{registry-CXi7rJq7.mjs → registry-Ct0Wgxp1.mjs} +3 -3
  16. package/dist/registry-Ct0Wgxp1.mjs.map +1 -0
  17. package/dist/runtime/index.mjs +1 -1
  18. package/dist/runtime/workflow.d.mts +39 -21
  19. package/dist/runtime/workflow.mjs +2 -2
  20. package/dist/utils/test/index.mjs +18 -12
  21. package/dist/utils/test/index.mjs.map +1 -1
  22. package/dist/utils/test/mock.d.mts +2 -2
  23. package/dist/vitest/environment.mjs +1 -1
  24. package/dist/vitest/index.mjs +30 -24
  25. package/dist/vitest/index.mjs.map +1 -1
  26. package/dist/vitest/mocks/file.d.mts +1 -1
  27. package/dist/vitest/mocks/workflow.d.mts +20 -15
  28. package/dist/vitest/setup.mjs +1 -1
  29. package/dist/{workflow-CkIDJpdg.mjs → workflow-B2mwc7aT.mjs} +17 -9
  30. package/dist/workflow-B2mwc7aT.mjs.map +1 -0
  31. package/docs/runtime.md +1 -1
  32. package/docs/services/tailordb-migration.md +5 -3
  33. package/docs/services/workflow.md +2 -2
  34. package/docs/testing.md +1 -1
  35. package/package.json +2 -2
  36. package/dist/application-CP0W2sQo.mjs +0 -3
  37. package/dist/application-CVeA53ok.mjs.map +0 -1
  38. package/dist/globals-DUqEetIh.mjs.map +0 -1
  39. package/dist/register-typescript-runtime-O7zQNif0.mjs.map +0 -1
  40. package/dist/registry-CXi7rJq7.mjs.map +0 -1
  41. package/dist/workflow-CkIDJpdg.mjs.map +0 -1
@@ -46,10 +46,10 @@ declare function mockFile(options?: MockFileOptions): {
46
46
  calls: FileCall[];
47
47
  clear(): void;
48
48
  reset(): void;
49
+ delete: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<void>>;
49
50
  upload: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string, data: string | ArrayBuffer | Uint8Array | number[], options?: FileUploadOptions) => Promise<FileUploadResponse>>;
50
51
  download: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadResponse>>;
51
52
  downloadAsBase64: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadAsBase64Response>>;
52
- delete: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<void>>;
53
53
  getMetadata: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileMetadata>>;
54
54
  openDownloadStream: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileStreamIterator>>;
55
55
  downloadStream: Mock<(namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadStreamResponse>>;
@@ -1,11 +1,11 @@
1
1
  import { TailorEnv } from "../../runtime/types.mjs";
2
- import { StartJobFunctionOptions, StartWorkflowOptions } from "../../runtime/workflow.mjs";
2
+ import { ExecJobFunctionOptions, StartWorkflowOptions } from "../../runtime/workflow.mjs";
3
3
  import { WorkflowJob } from "../../configure/services/workflow/job.mjs";
4
4
  import { Workflow } from "../../configure/services/workflow/workflow.mjs";
5
5
  import { WaitPointInstance } from "../../configure/services/workflow/wait-point.mjs";
6
6
  import { Mock } from "vitest";
7
7
  //#region src/vitest/mocks/workflow.d.ts
8
- type JobHandler = (jobName: string, args: unknown, options?: StartJobFunctionOptions) => unknown;
8
+ type JobHandler = (jobName: string, args: unknown, options?: ExecJobFunctionOptions) => unknown;
9
9
  type TriggerHandlerFn = (workflowName: string, args: unknown, options?: StartWorkflowOptions) => string;
10
10
  type ResumeHandlerFn = (executionId: string) => string;
11
11
  type WaitHandlerFn = (key: string, payload: unknown) => unknown;
@@ -17,17 +17,17 @@ type SetWaitHandler = {
17
17
  interface TriggeredJob {
18
18
  jobName: string;
19
19
  args: unknown;
20
- options?: StartJobFunctionOptions;
20
+ options?: ExecJobFunctionOptions;
21
21
  }
22
22
  type WaitPayload<Payload> = [Payload] extends [undefined] ? undefined : Payload;
23
23
  /**
24
24
  * Acquire a disposable mock for workflow operations (`tailor.workflow`).
25
25
  * Restored on dispose.
26
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
+ * Canonical names (`startWorkflow`, `execJobFunction`, `resumeWorkflowExecution`)
28
+ * and their aliases (`triggerWorkflow`, `startJobFunction`, `triggerJobFunction`,
29
+ * `resumeWorkflow`) share the same underlying `vi.fn`, so calls through any
30
+ * name are recorded once and handlers configured on any name apply to all.
31
31
  * @returns Disposable workflow mock control object
32
32
  * @example
33
33
  * ```typescript
@@ -43,13 +43,18 @@ type WaitPayload<Payload> = [Payload] extends [undefined] ? undefined : Payload;
43
43
  * ```
44
44
  */
45
45
  declare function mockWorkflow(): {
46
- /** The `startJobFunction` `vi.fn`. */
47
- startJobFunction: Mock<(jobName: string, args?: unknown, _options?: StartJobFunctionOptions) => unknown>;
46
+ /** The `execJobFunction` `vi.fn`. */
47
+ execJobFunction: Mock<(jobName: string, args?: unknown, _options?: ExecJobFunctionOptions) => unknown>;
48
48
  /**
49
- * Frozen alias of `startJobFunction` (same `vi.fn` reference).
50
- * @deprecated Use `startJobFunction` instead.
49
+ * Alias of `execJobFunction` (same `vi.fn` reference).
50
+ * @deprecated Use `execJobFunction` instead.
51
51
  */
52
- triggerJobFunction: Mock<(jobName: string, args?: unknown, _options?: StartJobFunctionOptions) => unknown>;
52
+ startJobFunction: Mock<(jobName: string, args?: unknown, _options?: ExecJobFunctionOptions) => unknown>;
53
+ /**
54
+ * Frozen alias of `execJobFunction` (same `vi.fn` reference).
55
+ * @deprecated Use `execJobFunction` instead.
56
+ */
57
+ triggerJobFunction: Mock<(jobName: string, args?: unknown, _options?: ExecJobFunctionOptions) => unknown>;
53
58
  /** The `startWorkflow` `vi.fn`. */
54
59
  startWorkflow: Mock<(workflowName: string, args?: unknown, _options?: StartWorkflowOptions) => Promise<string>>;
55
60
  /**
@@ -98,18 +103,18 @@ declare function mockWorkflow(): {
98
103
  */
99
104
  setJobHandler(handler: JobHandler): void;
100
105
  /**
101
- * Enqueue a single result for the next `triggerJobFunction` call (FIFO;
106
+ * Enqueue a single result for the next `execJobFunction` call (FIFO;
102
107
  * takes priority over `setJobHandler`).
103
108
  * @param result - Result to return from the next call
104
109
  */
105
110
  enqueueResult(result: unknown): void;
106
111
  /**
107
- * Enqueue results for multiple subsequent `triggerJobFunction` calls (FIFO).
112
+ * Enqueue results for multiple subsequent `execJobFunction` calls (FIFO).
108
113
  * @param results - Results to enqueue, one per upcoming call
109
114
  */
110
115
  enqueueResults(...results: unknown[]): void;
111
116
  /**
112
- * All jobs triggered via `triggerJobFunction`, in order.
117
+ * All jobs executed via `execJobFunction`, in order.
113
118
  * @returns Triggered jobs array
114
119
  */
115
120
  readonly triggeredJobs: TriggeredJob[];
@@ -1,4 +1,4 @@
1
- import { t as RUNTIME_FLAG_KEY } from "../globals-DUqEetIh.mjs";
1
+ import { t as RUNTIME_FLAG_KEY } from "../globals-DraXTdqg.mjs";
2
2
  import { t as mockSecretmanager } from "../secretmanager-IY4UvinW.mjs";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import { afterEach, beforeAll, beforeEach } from "vitest";
@@ -2,6 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-DXywRVcq.mjs";
2
2
 
3
3
  //#region src/runtime/workflow.ts
4
4
  var workflow_exports = /* @__PURE__ */ __exportAll({
5
+ execJobFunction: () => execJobFunction,
5
6
  resolve: () => resolve,
6
7
  resumeWorkflow: () => resumeWorkflow,
7
8
  resumeWorkflowExecution: () => resumeWorkflowExecution,
@@ -39,18 +40,25 @@ const resumeWorkflowExecution = (...args) => api().resumeWorkflowExecution(...ar
39
40
  */
40
41
  const resumeWorkflow = (...args) => api().resumeWorkflow(...args);
41
42
  /**
42
- * See {@link TailorWorkflowAPI.startJobFunction}.
43
- * @param args - Forwarded to {@link TailorWorkflowAPI.startJobFunction}
43
+ * See {@link TailorWorkflowAPI.execJobFunction}.
44
+ * @param args - Forwarded to {@link TailorWorkflowAPI.execJobFunction}
44
45
  * @returns The job's return value
45
46
  */
46
- const startJobFunction = (...args) => api().startJobFunction(...args);
47
+ const execJobFunction = (...args) => api().execJobFunction(...args);
47
48
  /**
48
- * Frozen alias for {@link startJobFunction}. Kept for backward compatibility.
49
- * @deprecated Use {@link startJobFunction} instead.
50
- * @param args - Forwarded to {@link TailorWorkflowAPI.triggerJobFunction}
49
+ * Alias for {@link execJobFunction}. Kept for backward compatibility.
50
+ * @deprecated Use {@link execJobFunction} instead.
51
+ * @param args - Forwarded to {@link TailorWorkflowAPI.execJobFunction}
51
52
  * @returns The job's return value
52
53
  */
53
- const triggerJobFunction = (...args) => api().triggerJobFunction(...args);
54
+ const startJobFunction = (...args) => api().execJobFunction(...args);
55
+ /**
56
+ * Frozen alias for {@link execJobFunction}. Kept for backward compatibility.
57
+ * @deprecated Use {@link execJobFunction} instead.
58
+ * @param args - Forwarded to {@link TailorWorkflowAPI.execJobFunction}
59
+ * @returns The job's return value
60
+ */
61
+ const triggerJobFunction = (...args) => api().execJobFunction(...args);
54
62
  /**
55
63
  * See {@link TailorWorkflowAPI.wait}.
56
64
  * @param args - Forwarded to {@link TailorWorkflowAPI.wait}
@@ -65,5 +73,5 @@ const wait = (...args) => api().wait(...args);
65
73
  const resolve = (...args) => api().resolve(...args);
66
74
 
67
75
  //#endregion
68
- export { startWorkflow as a, wait as c, startJobFunction as i, workflow_exports as l, resumeWorkflow as n, triggerJobFunction as o, resumeWorkflowExecution as r, triggerWorkflow as s, resolve as t };
69
- //# sourceMappingURL=workflow-CkIDJpdg.mjs.map
76
+ export { startJobFunction as a, triggerWorkflow as c, resumeWorkflowExecution as i, wait as l, resolve as n, startWorkflow as o, resumeWorkflow as r, triggerJobFunction as s, execJobFunction as t, workflow_exports as u };
77
+ //# sourceMappingURL=workflow-B2mwc7aT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-B2mwc7aT.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`, `execJobFunction`,\n * `resumeWorkflowExecution`) mirror the public `tailor.v1` RPC vocabulary.\n * The pre-alignment names (`triggerWorkflow`, `triggerJobFunction`,\n * `startJobFunction`, `resumeWorkflow`) are kept as aliases that reference\n * the same platform implementations, so existing code continues to work\n * 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 AuthInvoker {\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?: AuthInvoker;\n}\n\n/**\n * Frozen alias for {@link StartWorkflowOptions}. Kept for backward compatibility.\n * @deprecated Use {@link StartWorkflowOptions} instead.\n */\nexport type TriggerWorkflowOptions = StartWorkflowOptions;\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 execJobFunction}. */\nexport interface ExecJobFunctionOptions {\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 * Alias for {@link ExecJobFunctionOptions}. Kept for backward compatibility.\n * @deprecated Use {@link ExecJobFunctionOptions} instead.\n */\nexport type StartJobFunctionOptions = ExecJobFunctionOptions;\n\n/**\n * Frozen alias for {@link ExecJobFunctionOptions}. Kept for backward compatibility.\n * @deprecated Use {@link ExecJobFunctionOptions} instead.\n */\nexport type TriggerJobFunctionOptions = ExecJobFunctionOptions;\n\n/**\n * Platform API surface for `tailor.workflow`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.workflow`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module so callers can either `import * as workflow from\n * \"@tailor-platform/sdk/runtime/workflow\"` or pick individual methods.\n */\nexport interface TailorWorkflowAPI {\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?: TriggerWorkflowOptions,\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 * Executes a job function and returns its result.\n *\n * Canonical name that mirrors the `tailor.v1` RPC vocabulary.\n * {@link startJobFunction} and {@link triggerJobFunction} are aliases that\n * resolve to the same platform implementation.\n * @param jobName - Job name as defined in the workflow\n * @param args - Arguments forwarded to the job\n * @param options - Optional exec options (e.g. `executionPolicyKey`)\n * @returns The job's return value\n */\n execJobFunction(jobName: string, args?: any, options?: ExecJobFunctionOptions): any;\n\n /**\n * Alias for {@link execJobFunction}. Kept for backward compatibility.\n * @deprecated Use {@link execJobFunction} instead.\n */\n startJobFunction(jobName: string, args?: any, options?: StartJobFunctionOptions): any;\n\n /**\n * Frozen alias for {@link execJobFunction}. Kept for backward compatibility.\n * @deprecated Use {@link execJobFunction} 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\nconst api = (): TailorWorkflowAPI =>\n (globalThis as { tailor: { workflow: TailorWorkflowAPI } }).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 */\nexport const startWorkflow: TailorWorkflowAPI[\"startWorkflow\"] = (...args) =>\n api().startWorkflow(...args);\n\n/**\n * Frozen alias for {@link startWorkflow}. Kept for backward compatibility.\n * @deprecated Use {@link startWorkflow} instead.\n * @param args - Forwarded to {@link TailorWorkflowAPI.triggerWorkflow}\n * @returns The execution ID of the triggered workflow\n */\nexport const triggerWorkflow: TailorWorkflowAPI[\"triggerWorkflow\"] = (...args) =>\n api().triggerWorkflow(...args);\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 */\nexport const resumeWorkflowExecution: TailorWorkflowAPI[\"resumeWorkflowExecution\"] = (...args) =>\n api().resumeWorkflowExecution(...args);\n\n/**\n * Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.\n * @deprecated Use {@link resumeWorkflowExecution} instead.\n * @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflow}\n * @returns The execution ID of the resumed workflow\n */\nexport const resumeWorkflow: TailorWorkflowAPI[\"resumeWorkflow\"] = (...args) =>\n api().resumeWorkflow(...args);\n\n/**\n * See {@link TailorWorkflowAPI.execJobFunction}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.execJobFunction}\n * @returns The job's return value\n */\nexport const execJobFunction: TailorWorkflowAPI[\"execJobFunction\"] = (...args) =>\n api().execJobFunction(...args);\n\n/**\n * Alias for {@link execJobFunction}. Kept for backward compatibility.\n * @deprecated Use {@link execJobFunction} instead.\n * @param args - Forwarded to {@link TailorWorkflowAPI.execJobFunction}\n * @returns The job's return value\n */\nexport const startJobFunction: TailorWorkflowAPI[\"startJobFunction\"] = (...args) =>\n api().execJobFunction(...args);\n\n/**\n * Frozen alias for {@link execJobFunction}. Kept for backward compatibility.\n * @deprecated Use {@link execJobFunction} instead.\n * @param args - Forwarded to {@link TailorWorkflowAPI.execJobFunction}\n * @returns The job's return value\n */\nexport const triggerJobFunction: TailorWorkflowAPI[\"triggerJobFunction\"] = (...args) =>\n api().execJobFunction(...args);\n\n/**\n * See {@link TailorWorkflowAPI.wait}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.wait}\n * @returns The payload supplied by the corresponding `resolve` call\n */\nexport const wait: TailorWorkflowAPI[\"wait\"] = (...args) => api().wait(...args);\n\n/**\n * See {@link TailorWorkflowAPI.resolve}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.resolve}\n * @returns A promise that resolves once the resolve has been recorded\n */\nexport const resolve: TailorWorkflowAPI[\"resolve\"] = (...args) => api().resolve(...args);\n"],"mappings":";;;;;;;;;;;;;;AAuKA,MAAM,YACH,WAA2D,OAAO;;;;;;AAOrE,MAAa,iBAAqD,GAAG,SACnE,IAAI,CAAC,CAAC,cAAc,GAAG,IAAI;;;;;;;AAQ7B,MAAa,mBAAyD,GAAG,SACvE,IAAI,CAAC,CAAC,gBAAgB,GAAG,IAAI;;;;;;AAO/B,MAAa,2BAAyE,GAAG,SACvF,IAAI,CAAC,CAAC,wBAAwB,GAAG,IAAI;;;;;;;AAQvC,MAAa,kBAAuD,GAAG,SACrE,IAAI,CAAC,CAAC,eAAe,GAAG,IAAI;;;;;;AAO9B,MAAa,mBAAyD,GAAG,SACvE,IAAI,CAAC,CAAC,gBAAgB,GAAG,IAAI;;;;;;;AAQ/B,MAAa,oBAA2D,GAAG,SACzE,IAAI,CAAC,CAAC,gBAAgB,GAAG,IAAI;;;;;;;AAQ/B,MAAa,sBAA+D,GAAG,SAC7E,IAAI,CAAC,CAAC,gBAAgB,GAAG,IAAI;;;;;;AAO/B,MAAa,QAAmC,GAAG,SAAS,IAAI,CAAC,CAAC,KAAK,GAAG,IAAI;;;;;;AAO9E,MAAa,WAAyC,GAAG,SAAS,IAAI,CAAC,CAAC,QAAQ,GAAG,IAAI"}
package/docs/runtime.md CHANGED
@@ -82,7 +82,7 @@ The runtime entry re-exports the following namespaces. Detailed signatures, para
82
82
  - `secretmanager` — secret-vault access (`getSecret`, `getSecrets`)
83
83
  - `authconnection` — OAuth-style connection tokens (`getConnectionToken`)
84
84
  - `idp` — IdP user management (`new Client({ namespace })`)
85
- - `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `startJobFunction`, `wait`, `resolve`; the pre-alignment names `triggerWorkflow`, `resumeWorkflow`, `triggerJobFunction` are kept as frozen aliases)
85
+ - `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `execJobFunction`, `wait`, `resolve`; the pre-alignment names `triggerWorkflow`, `resumeWorkflow`, `startJobFunction`, `triggerJobFunction` are kept as aliases)
86
86
  - `context` — execution context (`getInvoker`)
87
87
  - `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `downloadStream`, `uploadStream`, `openDownloadStream` _(deprecated)_)
88
88
  - `aigateway` — AI Gateway URL resolution (`get`)
@@ -220,8 +220,10 @@ The `env` values are injected at bundle time (the same mechanism as resolvers/ex
220
220
  | Remove field | No | Optional | Warning tier — no script is auto-generated, but you can add one with `tailordb migration script` to preserve data before the field is dropped. The field stays readable from `migrate.ts` during Pre-migration and is dropped in Post-migration. |
221
221
  | Change optional → required | Yes | Yes | Script sets defaults for null values |
222
222
  | Change required → optional | No | No | Schema change only |
223
- | Add index | No | No | Schema change only |
224
- | Remove index | No | No | Schema change only |
223
+ | Add index (non-unique) | No | No | Schema change only |
224
+ | Add unique index | Yes | Yes | Script must resolve duplicate value combinations across the index fields |
225
+ | Change unique index fields | Yes | Yes | Treated like adding a new unique constraint over the new field set |
226
+ | Remove index | No | No | Schema change only (removing the unique constraint from an index is also non-breaking) |
225
227
  | Add unique constraint | Yes | Yes | Script must resolve duplicate values |
226
228
  | Remove unique constraint | No | No | Schema change only |
227
229
  | Add enum value | No | No | Schema change only |
@@ -251,7 +253,7 @@ When you run `tailor-sdk deploy`, the SDK detects pending migrations (anything p
251
253
 
252
254
  For each pending migration:
253
255
 
254
- 1. **Pre-migration**: Type changes that would be breaking are applied in a relaxed form first. Newly-required fields are added as optional; fields whose `optional → required` transition is breaking are temporarily kept optional. Fields that are being removed in this migration are temporarily kept on the type so that `migrate.ts` can still read them (for example, to `innerJoin` through a foreign key that is about to be dropped). Non-breaking changes that are part of the same migration are also applied here.
256
+ 1. **Pre-migration**: Type changes that would be breaking are applied in a relaxed form first. Newly-required fields are added as optional; fields whose `optional → required` transition is breaking are temporarily kept optional. Fields that are being removed in this migration are temporarily kept on the type so that `migrate.ts` can still read them (for example, to `innerJoin` through a foreign key that is about to be dropped). Breaking type-level index changes are relaxed the same way: a newly-added unique index is withheld, and an index gaining a unique constraint (or a unique index changing its field set) keeps its previous definition, so `migrate.ts` can resolve duplicates first. Non-breaking changes that are part of the same migration are also applied here.
255
257
  2. **Script execution**: If `migrate.ts` exists on disk for this migration, it is bundled and sent to the platform via the script execution API and runs as the configured machine user inside a transaction. The script is hard-required for breaking changes (`diff.requiresMigrationScript`) but is also executed when present for warning-tier diffs — see [Warnings and optional migration scripts](#warnings-and-optional-migration-scripts).
256
258
  3. **Post-migration**: Required constraints are enforced; field and type deletions are applied (the columns/tables are physically dropped here); the `sdk-migration` label is bumped to this migration's number.
257
259
 
@@ -401,7 +401,7 @@ An exact-key policy applies to dispatches whose runtime key equals the policy ke
401
401
 
402
402
  ### Referencing a Policy from a Workflow
403
403
 
404
- Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.startJobFunction()` (or its frozen alias `triggerJobFunction`). For exact-key policies, use `<policy>.key` directly — it's typed so only a value that came from a declared policy can be passed. For wildcard policies (`matchType: "prefix"`), there is no `<policy>.key` — call `<policy>.keyFor(suffix)` to build the concrete key. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator` — the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group), or a `def` field on a single `defineWorkflowExecutionPolicy`.
404
+ Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.execJobFunction()` (or its aliases `startJobFunction` / `triggerJobFunction`). For exact-key policies, use `<policy>.key` directly — it's typed so only a value that came from a declared policy can be passed. For wildcard policies (`matchType: "prefix"`), there is no `<policy>.key` — call `<policy>.keyFor(suffix)` to build the concrete key. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator` — the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group), or a `def` field on a single `defineWorkflowExecutionPolicy`.
405
405
 
406
406
  ```typescript
407
407
  import { createWorkflowJob } from "@tailor-platform/sdk";
@@ -427,7 +427,7 @@ export const mainJob = createWorkflowJob({
427
427
  });
428
428
  ```
429
429
 
430
- The same `executionPolicyKey` option is available on `tailor.workflow.startJobFunction(name, args, options)` (or the frozen alias `tailor.workflow.triggerJobFunction`) for jobs invoked by name.
430
+ The same `executionPolicyKey` option is available on `tailor.workflow.execJobFunction(name, args, options)` (or its aliases `tailor.workflow.startJobFunction` / `tailor.workflow.triggerJobFunction`) for jobs invoked by name.
431
431
 
432
432
  ## Triggering a Workflow from a Resolver
433
433
 
package/docs/testing.md CHANGED
@@ -153,7 +153,7 @@ test("workflow triggers jobs", async () => {
153
153
  });
154
154
  ```
155
155
 
156
- Unconfigured definition mocks continue to run their real implementations. The lower-level `triggerJobFunction`, `triggerWorkflow`, `resumeWorkflow`, `wait`, and `resolve` mocks and the existing `setJobHandler`, `enqueueResult`, `enqueueResults`, and call-record helpers remain available.
156
+ Unconfigured definition mocks continue to run their real implementations. The lower-level `execJobFunction`, `triggerWorkflow`, `resumeWorkflow`, `wait`, and `resolve` mocks and the existing `setJobHandler`, `enqueueResult`, `enqueueResults`, and call-record helpers remain available.
157
157
 
158
158
  Use `waitPoint(definition)` for typed wait-point control:
159
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.82.0",
3
+ "version": "1.83.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -214,7 +214,7 @@
214
214
  "oxlint": "1.74.0",
215
215
  "oxlint-tsgolint": "0.25.0",
216
216
  "sonda": "0.14.0",
217
- "tsdown": "0.22.9",
217
+ "tsdown": "0.22.12",
218
218
  "typescript": "6.0.3",
219
219
  "vitest": "4.1.10",
220
220
  "zinfer": "0.2.7",
@@ -1,3 +0,0 @@
1
- import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-CVeA53ok.mjs";
2
-
3
- export { defineApplication, generatePluginFilesIfNeeded };