@tailor-platform/sdk 1.82.0 → 1.84.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 (82) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/application-5FOWIxFQ.mjs +3 -0
  3. package/dist/{application-CVeA53ok.mjs → application-CnCljDwk.mjs} +15 -10
  4. package/dist/application-CnCljDwk.mjs.map +1 -0
  5. package/dist/cli/commands/deploy/tailordb/index.d.mts +1 -0
  6. package/dist/cli/commands/generate/service.d.mts +1 -1
  7. package/dist/cli/commands/generate/types.d.mts +1 -1
  8. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -1
  9. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
  10. package/dist/cli/index.mjs +65 -10
  11. package/dist/cli/index.mjs.map +1 -1
  12. package/dist/cli/lib.d.mts +1 -1
  13. package/dist/cli/lib.mjs +2 -2
  14. package/dist/cli/shared/client.d.mts +28 -3
  15. package/dist/cli/skills.d.mts +1 -1
  16. package/dist/completion/zsh-worker.zsh +35 -22
  17. package/dist/configure/index.d.mts +2 -2
  18. package/dist/configure/index.mjs +173 -5
  19. package/dist/configure/index.mjs.map +1 -1
  20. package/dist/configure/services/executor/index.d.mts +2 -2
  21. package/dist/configure/services/executor/trigger/event.d.mts +245 -2
  22. package/dist/configure/services/executor/trigger/index.d.mts +3 -3
  23. package/dist/configure/services/index.d.mts +2 -2
  24. package/dist/configure/services/tailordb/index.d.mts +0 -1
  25. package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
  26. package/dist/configure/services/workflow/job.d.mts +9 -0
  27. package/dist/configure/services/workflow/workflow.d.mts +10 -0
  28. package/dist/{globals-DUqEetIh.mjs → globals-DraXTdqg.mjs} +6 -5
  29. package/dist/globals-DraXTdqg.mjs.map +1 -0
  30. package/dist/{register-typescript-runtime-O7zQNif0.mjs → register-typescript-runtime-BCvWR3HC.mjs} +518 -123
  31. package/dist/register-typescript-runtime-BCvWR3HC.mjs.map +1 -0
  32. package/dist/{registry-CXi7rJq7.mjs → registry-Ct0Wgxp1.mjs} +3 -3
  33. package/dist/registry-Ct0Wgxp1.mjs.map +1 -0
  34. package/dist/runtime/index.mjs +1 -1
  35. package/dist/runtime/workflow.d.mts +39 -21
  36. package/dist/runtime/workflow.mjs +2 -2
  37. package/dist/{service-B0MaodSg.mjs → service-CPJWhTLn.mjs} +29 -2
  38. package/dist/service-CPJWhTLn.mjs.map +1 -0
  39. package/dist/service-Cigg_U-v.mjs +3 -0
  40. package/dist/{service_pb-BwZRiNug.mjs → service_pb-D5--My_M.mjs} +5 -5
  41. package/dist/service_pb-D5--My_M.mjs.map +1 -0
  42. package/dist/{service_pb-wRkxUta6.mjs → service_pb-i8CmnQP4.mjs} +1 -1
  43. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +106 -1
  44. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +24 -1
  45. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +49 -1
  46. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +89 -6
  47. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +26 -1
  48. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +101 -1
  49. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +22 -1
  50. package/dist/types/executor.generated.d.mts +23 -3
  51. package/dist/utils/test/index.mjs +18 -12
  52. package/dist/utils/test/index.mjs.map +1 -1
  53. package/dist/utils/test/mock.d.mts +2 -2
  54. package/dist/vitest/environment.mjs +1 -1
  55. package/dist/vitest/index.mjs +30 -24
  56. package/dist/vitest/index.mjs.map +1 -1
  57. package/dist/vitest/mocks/file.d.mts +1 -1
  58. package/dist/vitest/mocks/workflow.d.mts +20 -15
  59. package/dist/vitest/setup.mjs +1 -1
  60. package/dist/{workflow-CkIDJpdg.mjs → workflow-B2mwc7aT.mjs} +17 -9
  61. package/dist/workflow-B2mwc7aT.mjs.map +1 -0
  62. package/dist/{workspace_resource_pb-UGK1SSn_.mjs → workspace_resource_pb-DXnO2AT-.mjs} +7 -7
  63. package/dist/workspace_resource_pb-DXnO2AT-.mjs.map +1 -0
  64. package/docs/cli/tailordb.md +14 -12
  65. package/docs/cli-reference.md +15 -15
  66. package/docs/runtime.md +1 -1
  67. package/docs/services/executor.md +83 -3
  68. package/docs/services/idp.md +3 -3
  69. package/docs/services/tailordb-migration.md +18 -5
  70. package/docs/services/workflow.md +28 -2
  71. package/docs/testing.md +1 -1
  72. package/package.json +16 -16
  73. package/dist/application-CP0W2sQo.mjs +0 -3
  74. package/dist/application-CVeA53ok.mjs.map +0 -1
  75. package/dist/globals-DUqEetIh.mjs.map +0 -1
  76. package/dist/register-typescript-runtime-O7zQNif0.mjs.map +0 -1
  77. package/dist/registry-CXi7rJq7.mjs.map +0 -1
  78. package/dist/service-B0MaodSg.mjs.map +0 -1
  79. package/dist/service-KnAiVofD.mjs +0 -3
  80. package/dist/service_pb-BwZRiNug.mjs.map +0 -1
  81. package/dist/workflow-CkIDJpdg.mjs.map +0 -1
  82. package/dist/workspace_resource_pb-UGK1SSn_.mjs.map +0 -1
@@ -95,13 +95,13 @@ tailor-sdk tailordb migration <command>
95
95
 
96
96
  **Commands**
97
97
 
98
- | Command | Description |
99
- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
100
- | [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
101
- | [`tailordb migration script`](#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory. |
102
- | [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
103
- | [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
104
- | [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
98
+ | Command | Description |
99
+ | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
100
+ | [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
101
+ | [`tailordb migration script`](#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
102
+ | [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
103
+ | [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
104
+ | [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
105
105
 
106
106
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
107
107
 
@@ -128,7 +128,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
128
128
 
129
129
  #### tailordb migration script
130
130
 
131
- Add a migration script (migrate.ts) template to an existing migration directory.
131
+ Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none.
132
132
 
133
133
  **Usage**
134
134
 
@@ -144,10 +144,12 @@ tailor-sdk tailordb migration script [options] <number>
144
144
 
145
145
  **Options**
146
146
 
147
- | Option | Alias | Description | Required | Default | Env |
148
- | ------------------------- | ----- | ----------------------------------------------------------------- | -------- | -------------------- | --------------------------------- |
149
- | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
150
- | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
147
+ | Option | Alias | Description | Required | Default | Env |
148
+ | ------------------------- | ----- | -------------------------------------------------------------------------------------------- | -------- | -------------------- | --------------------------------- |
149
+ | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
150
+ | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
151
+ | `--no-script` | - | Record that this migration intentionally runs without a migration script (requires --reason) | No | - | - |
152
+ | `--reason <REASON>` | - | Reason why no migration script is needed (used with --no-script) | No | - | - |
151
153
 
152
154
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
153
155
 
@@ -128,21 +128,21 @@ Commands for managing Tailor Platform applications (work with `tailor.config.ts`
128
128
 
129
129
  Commands for managing TailorDB tables, data, and schema migrations.
130
130
 
131
- | Command | Description |
132
- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
133
- | [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
134
- | [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
135
- | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
136
- | [tailordb migration generate](./cli/tailordb.md#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
137
- | [tailordb migration script](./cli/tailordb.md#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory. |
138
- | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
139
- | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
140
- | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
141
- | [tailordb erd](./cli/tailordb.md#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
142
- | [tailordb erd export](./cli/tailordb.md#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
143
- | [tailordb erd diff](./cli/tailordb.md#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
144
- | [tailordb erd serve](./cli/tailordb.md#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
145
- | [tailordb erd deploy](./cli/tailordb.md#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
131
+ | Command | Description |
132
+ | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
133
+ | [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
134
+ | [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
135
+ | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
136
+ | [tailordb migration generate](./cli/tailordb.md#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
137
+ | [tailordb migration script](./cli/tailordb.md#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
138
+ | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
139
+ | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
140
+ | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
141
+ | [tailordb erd](./cli/tailordb.md#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
142
+ | [tailordb erd export](./cli/tailordb.md#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
143
+ | [tailordb erd diff](./cli/tailordb.md#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
144
+ | [tailordb erd serve](./cli/tailordb.md#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
145
+ | [tailordb erd deploy](./cli/tailordb.md#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
146
146
 
147
147
  ### [Query Commands](./cli/query.md)
148
148
 
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`)
@@ -136,9 +136,9 @@ When the project defines multiple IdPs, pass `idp` to target a specific one. The
136
136
  idpUserCreatedTrigger({ idp: "my-idp" });
137
137
  ```
138
138
 
139
- Omitting `idp` is allowed only when the project has exactly one IdP; otherwise `apply` fails with an error listing the configured IdPs.
139
+ Omitting `idp` is allowed only when the project has exactly one IdP; otherwise `deploy` fails with an error listing the configured IdPs.
140
140
 
141
- These triggers require the IdP to publish user lifecycle events. The SDK enables `publishUserEvents` automatically during `apply` on each IdP that is targeted by an `idpUser` trigger; set the value explicitly on `defineIdp()` to override. See [IdP service - publishUserEvents](./idp.md#publishuserevents).
141
+ These triggers require the IdP to publish user lifecycle events. The SDK enables `publishUserEvents` automatically during `deploy` on each IdP that is targeted by an `idpUser` trigger; set the value explicitly on `defineIdp()` to override. See [IdP service - publishUserEvents](./idp.md#publishuserevents).
142
142
 
143
143
  ### Auth Access Token Triggers
144
144
 
@@ -152,6 +152,37 @@ Fire on auth access token lifecycle events:
152
152
  authAccessTokenIssuedTrigger();
153
153
  ```
154
154
 
155
+ ### Workflow Execution Triggers
156
+
157
+ Fire when a workflow execution changes state. Use the single-event helpers or `workflowExecutionTrigger()` for multiple events:
158
+
159
+ ```typescript
160
+ import { createExecutor, workflowExecutionTrigger } from "@tailor-platform/sdk";
161
+ import orderWorkflow from "../workflows/order";
162
+
163
+ export default createExecutor({
164
+ name: "order-workflow-finished",
165
+ trigger: workflowExecutionTrigger({
166
+ workflow: orderWorkflow,
167
+ events: ["completed", "retried"],
168
+ }),
169
+ operation: {
170
+ kind: "function",
171
+ body: async (args) => {
172
+ if (args.event === "completed" && !args.success) {
173
+ console.error(args.error);
174
+ }
175
+ },
176
+ },
177
+ });
178
+ ```
179
+
180
+ The available workflow events are `started`, `completed`, `retried`, `resumed`, `wait_started`, and `wait_resolved`. To observe job-level events, use `workflowJobExecutionStartedTrigger()`, `workflowJobExecutionCompletedTrigger()`, `workflowJobExecutionWaitStartedTrigger()`, `workflowJobExecutionWaitResolvedTrigger()`, or `workflowJobExecutionTrigger()`.
181
+
182
+ `completed` events include `success`; when it is `false`, `error` contains the failure message. A job released from a wait point emits `wait_resolved` instead of `completed`.
183
+
184
+ These triggers require the workflow to publish execution events. The SDK enables `publishEvents` automatically during `deploy` on each targeted workflow, and on every job of a workflow targeted by a `workflowJobExecution*` trigger; set the value explicitly to override. See [Workflow service - Execution Events](./workflow.md#execution-events).
185
+
155
186
  ### Multi-Event Triggers
156
187
 
157
188
  Handle multiple event types in a single executor using multi-event trigger factories. These accept an `events` array of short event names:
@@ -200,7 +231,14 @@ idpUserTrigger({ events: ["created", "deleted"], idp: "my-idp" });
200
231
  authAccessTokenTrigger({ events: ["issued", "revoked"] });
201
232
  ```
202
233
 
203
- The `event` field on args matches the short event name (e.g., `"created"`, `"updated"`, `"deleted"`, `"issued"`, `"refreshed"`, `"revoked"`), enabling type narrowing. The `rawEvent` field contains the full event type string (e.g., `"tailordb.type_record.created"`).
234
+ #### `workflowExecutionTrigger()` and `workflowJobExecutionTrigger()`
235
+
236
+ ```typescript
237
+ workflowExecutionTrigger({ workflow: orderWorkflow, events: ["started", "completed"] });
238
+ workflowJobExecutionTrigger({ workflow: orderWorkflow, events: ["started", "wait_resolved"] });
239
+ ```
240
+
241
+ The `event` field on args matches the short event name, enabling type narrowing. Record triggers use names such as `"created"`, auth token triggers use `"issued"`, and workflow triggers use `"started"`, `"completed"`, and `"wait_resolved"`. The `rawEvent` field contains the full event type string (e.g., `"tailordb.type_record.created"`).
204
242
 
205
243
  ## Operation Types
206
244
 
@@ -551,3 +589,45 @@ interface AuthAccessTokenContext {
551
589
  userId: string; // The user associated with the token
552
590
  }
553
591
  ```
592
+
593
+ ### Workflow Execution Event Payload
594
+
595
+ Workflow execution triggers receive execution context:
596
+
597
+ ```typescript
598
+ interface WorkflowExecutionContext {
599
+ workspaceId: string; // Workspace identifier
600
+ env: TailorEnv; // Environment variables from tailor.config.ts
601
+ actor: TailorActor | null; // Principal that triggered the workflow
602
+ workflowId: string; // Workflow resource ID
603
+ workflowName: string; // Workflow name
604
+ workflowExecutionId: string; // Workflow execution ID
605
+ event: "started" | "completed" | "retried" | "resumed" | "wait_started" | "wait_resolved";
606
+ rawEvent: string; // Full event type
607
+ }
608
+ ```
609
+
610
+ Completed events narrow on `success`. Failed executions include `error`; retried executions include `retryCount` and `retryAfter`.
611
+
612
+ ```typescript
613
+ body: async (args) => {
614
+ if (args.event === "completed" && !args.success) {
615
+ console.error(args.error);
616
+ }
617
+ };
618
+ ```
619
+
620
+ ### Workflow Job Execution Event Payload
621
+
622
+ Workflow job execution triggers include every `WorkflowExecutionContext` field above, plus job-specific fields:
623
+
624
+ ```typescript
625
+ interface WorkflowJobExecutionContext {
626
+ workflowJobExecutionId: string; // Job execution ID
627
+ jobFunctionName: string; // Name passed to createWorkflowJob
628
+ event: "started" | "completed" | "wait_started" | "wait_resolved";
629
+ rawEvent: string; // Full event type
630
+ }
631
+ ```
632
+
633
+ `wait_started` events include `waitKey`, plus JSON-serialized `waitPayload` when the wait point recorded one; `wait_resolved` events include `waitKey`.
@@ -195,7 +195,7 @@ defineIdp("my-idp", {
195
195
 
196
196
  - `enableMfa` - Make TOTP MFA available for users in this namespace. Default `false`. When enabled, users can register an authenticator app (Google Authenticator, 1Password, etc.) from the IdP self-service page.
197
197
  - `requireMfa` - Force password-authenticated users to enroll and pass an MFA challenge on each sign-in. Default `false`. Social sign-in (`allowGoogleOauth` / `allowMicrosoftOauth`) is not affected; the upstream provider's MFA covers those sessions.
198
- - `allowedReturnOrigins` - Origins the IdP self-service pages (such as `/mfa/settings`) are allowed to redirect back to. Each entry is either a literal origin (`https://app.example.com`, scheme + host + optional port, no path/query/fragment) or a static-website placeholder `<name>:url` (e.g. `website.url`) that the CLI resolves to the deployed website's URL at apply time. Required when `enableMfa` is `true`.
198
+ - `allowedReturnOrigins` - Origins the IdP self-service pages (such as `/mfa/settings`) are allowed to redirect back to. Each entry is either a literal origin (`https://app.example.com`, scheme + host + optional port, no path/query/fragment) or a static-website placeholder `<name>:url` (e.g. `website.url`) that the CLI resolves to the deployed website's URL at deployment time. Required when `enableMfa` is `true`.
199
199
  - `mfaIssuer` - Label shown next to the user account in authenticator apps when TOTP is enrolled. Up to 64 characters. Falls back to `"Tailor Platform IdP"` when empty.
200
200
 
201
201
  **Constraints:** the following combinations are rejected at parse time.
@@ -330,10 +330,10 @@ defineIdp("my-idp", {
330
330
  });
331
331
  ```
332
332
 
333
- **Auto-configuration:** When `publishUserEvents` is omitted, the SDK enables it automatically during `apply` for each IdP that is targeted by an executor's `idpUser` trigger. Targeting is per-IdP: an executor specifies which IdP it subscribes to via the trigger's `idp` option (required in multi-IdP projects). Set the value explicitly to override:
333
+ **Auto-configuration:** When `publishUserEvents` is omitted, the SDK enables it automatically during `deploy` for each IdP that is targeted by an executor's `idpUser` trigger. Targeting is per-IdP: an executor specifies which IdP it subscribes to via the trigger's `idp` option (required in multi-IdP projects). Set the value explicitly to override:
334
334
 
335
335
  - `publishUserEvents: true`: always publish events.
336
- - `publishUserEvents: false`: never publish events. `apply` rejects this with an error if any executor's `idpUser` trigger targets this IdP — either remove `publishUserEvents: false` or remove the matching trigger.
336
+ - `publishUserEvents: false`: never publish events. `deploy` rejects this with an error if any executor's `idpUser` trigger targets this IdP — either remove `publishUserEvents: false` or remove the matching trigger.
337
337
 
338
338
  ## Using idp.provider()
339
339
 
@@ -131,6 +131,16 @@ tailor-sdk tailordb migration script 0002
131
131
 
132
132
  This writes `migrations/0002/migrate.ts` and `migrations/0002/db.ts` next to the existing `diff.json`. The removed field stays readable inside `migrate.ts` because the pre-migration phase keeps it on the type until the script finishes (see [Per-migration phases](#per-migration-phases)). The next `tailor-sdk deploy` runs the script automatically — `migrate.ts` is executed whenever the file exists on disk, regardless of whether the diff itself required it.
133
133
 
134
+ ### Breaking changes without a script
135
+
136
+ Breaking changes require `migrate.ts`. If it is missing at deploy time (for example, the generated script was deleted), `tailor-sdk deploy` fails before applying the migration or anything after it. When there is genuinely nothing to migrate — say, the affected type holds no data yet — record an explicit acknowledgment instead of keeping an empty script:
137
+
138
+ ```bash
139
+ tailor-sdk tailordb migration script 0002 --no-script --reason "no data yet, safe to skip"
140
+ ```
141
+
142
+ This stores the reason in `migrations/0002/diff.json` (commit the change). The next `tailor-sdk deploy` applies the schema change as usual, skips only the script step, and logs the recorded reason. The command refuses to record a skip while `migrate.ts` exists — delete the script first. If `migrate.ts` is added back later, the script takes precedence over the acknowledgment and runs.
143
+
134
144
  ## Configuration
135
145
 
136
146
  ```typescript
@@ -220,10 +230,13 @@ The `env` values are injected at bundle time (the same mechanism as resolvers/ex
220
230
  | 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
231
  | Change optional → required | Yes | Yes | Script sets defaults for null values |
222
232
  | Change required → optional | No | No | Schema change only |
223
- | Add index | No | No | Schema change only |
224
- | Remove index | No | No | Schema change only |
233
+ | Add index (non-unique) | No | No | Schema change only |
234
+ | Add unique index | Yes | Yes | Script must resolve duplicate value combinations across the index fields |
235
+ | Change unique index fields | Yes | Yes | Treated like adding a new unique constraint over the new field set |
236
+ | Remove index | No | No | Schema change only (removing the unique constraint from an index is also non-breaking) |
225
237
  | Add unique constraint | Yes | Yes | Script must resolve duplicate values |
226
238
  | Remove unique constraint | No | No | Schema change only |
239
+ | Change decimal scale | Yes | Yes | Auto-generated script re-saves existing rows under the new scale. Decreasing scale rounds values half-up and can lose precision. If the same change adds a unique constraint, duplicate handling runs after re-saving. |
227
240
  | Add enum value | No | No | Schema change only |
228
241
  | Remove enum value | Yes | Yes | Script migrates records with removed values |
229
242
  | Add type | No | No | Schema change only |
@@ -251,8 +264,8 @@ When you run `tailor-sdk deploy`, the SDK detects pending migrations (anything p
251
264
 
252
265
  For each pending migration:
253
266
 
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.
255
- 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).
267
+ 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.
268
+ 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`) deploy fails if the file is missing, unless a `--no-script` acknowledgment was recorded (see [Breaking changes without a script](#breaking-changes-without-a-script)). It is also executed when present for warning-tier diffs — see [Warnings and optional migration scripts](#warnings-and-optional-migration-scripts).
256
269
  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
270
 
258
271
  This split is what allows existing rows to be backfilled before the database starts rejecting nulls, and what lets `migrate.ts` traverse foreign-key fields that the same migration removes.
@@ -479,4 +492,4 @@ For genuinely different schemas across environments, prefer separate workspaces
479
492
 
480
493
  **Cause:** `diff.requiresMigrationScript` is true but `migrate.ts` is missing from the migration directory.
481
494
 
482
- **Resolution:** Either re-run `migration generate` (it skips already-generated diffs but will fill in a missing script), or restore the file from version control.
495
+ **Resolution:** Restore the file from version control, or create it with `tailor-sdk tailordb migration script <N> --namespace <namespace>`. If the migration intentionally needs no data transformation, record that decision with `tailor-sdk tailordb migration script <N> --namespace <namespace> --no-script --reason "<why no data migration is needed>"` instead.
@@ -201,6 +201,32 @@ export default createWorkflow({
201
201
  });
202
202
  ```
203
203
 
204
+ ## Execution Events
205
+
206
+ Workflows can publish execution lifecycle events for executors. When an executor subscribes to a workflow's events, the SDK enables publishing automatically. A `workflowExecution*` trigger enables it on the workflow, and a `workflowJobExecution*` trigger enables it on every job that workflow runs. See [Workflow Execution Triggers](./executor.md#workflow-execution-triggers).
207
+
208
+ Set `publishEvents` explicitly to override that. Use `true` to publish workflow-level events with no subscribing executor:
209
+
210
+ ```typescript
211
+ export default createWorkflow({
212
+ name: "order-processing",
213
+ mainJob: processOrder,
214
+ publishEvents: true,
215
+ });
216
+ ```
217
+
218
+ A job takes the same field for its own execution events:
219
+
220
+ ```typescript
221
+ export const processOrder = createWorkflowJob({
222
+ name: "process-order",
223
+ publishEvents: true,
224
+ body: async () => ({ processed: true }),
225
+ });
226
+ ```
227
+
228
+ Use `false` to keep publishing off. `deploy` fails if an executor subscribes to events the value opts out of, so the subscription cannot silently go unfulfilled.
229
+
204
230
  ## Wait Points
205
231
 
206
232
  Wait points allow a workflow job to suspend execution and wait for an external signal before resuming. This enables human-in-the-loop patterns such as approvals, reviews, and manual confirmations.
@@ -401,7 +427,7 @@ An exact-key policy applies to dispatches whose runtime key equals the policy ke
401
427
 
402
428
  ### Referencing a Policy from a Workflow
403
429
 
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`.
430
+ 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
431
 
406
432
  ```typescript
407
433
  import { createWorkflowJob } from "@tailor-platform/sdk";
@@ -427,7 +453,7 @@ export const mainJob = createWorkflowJob({
427
453
  });
428
454
  ```
429
455
 
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.
456
+ 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
457
 
432
458
  ## Triggering a Workflow from a Resolver
433
459
 
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.84.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -151,7 +151,7 @@
151
151
  "dependencies": {
152
152
  "@0no-co/graphql.web": "1.3.2",
153
153
  "@badgateway/oauth2-client": "3.3.1",
154
- "@bufbuild/protobuf": "2.12.1",
154
+ "@bufbuild/protobuf": "2.13.0",
155
155
  "@bufbuild/protovalidate": "1.2.0",
156
156
  "@connectrpc/connect": "2.1.2",
157
157
  "@connectrpc/connect-node": "2.1.2",
@@ -160,11 +160,11 @@
160
160
  "@jridgewell/trace-mapping": "0.3.31",
161
161
  "@napi-rs/keyring": "1.3.0",
162
162
  "@opentelemetry/api": "1.9.1",
163
- "@opentelemetry/exporter-trace-otlp-proto": "0.220.0",
164
- "@opentelemetry/resources": "2.9.0",
165
- "@opentelemetry/sdk-trace-node": "2.9.0",
163
+ "@opentelemetry/exporter-trace-otlp-proto": "0.221.0",
164
+ "@opentelemetry/resources": "2.10.0",
165
+ "@opentelemetry/sdk-trace-node": "2.10.0",
166
166
  "@opentelemetry/semantic-conventions": "1.43.0",
167
- "@oxc-project/types": "0.140.0",
167
+ "@oxc-project/types": "0.141.0",
168
168
  "@standard-schema/spec": "1.1.0",
169
169
  "@tailor-platform/function-kysely-tailordb": "0.1.3",
170
170
  "@toiroakr/lines-db": "0.10.1",
@@ -174,7 +174,7 @@
174
174
  "chokidar": "5.0.0",
175
175
  "confbox": "0.2.4",
176
176
  "date-fns": "4.4.0",
177
- "es-toolkit": "1.49.0",
177
+ "es-toolkit": "1.50.0",
178
178
  "find-up-simple": "1.0.1",
179
179
  "get-east-asian-width": "1.6.0",
180
180
  "get-tsconfig": "4.14.0",
@@ -185,12 +185,12 @@
185
185
  "madge": "8.0.0",
186
186
  "mime-types": "3.0.2",
187
187
  "open": "11.0.0",
188
- "oxc-parser": "0.140.0",
189
- "p-limit": "7.3.0",
188
+ "oxc-parser": "0.141.0",
189
+ "p-limit": "7.3.1",
190
190
  "pathe": "2.0.3",
191
191
  "pgsql-ast-parser": "12.0.2",
192
192
  "pkg-types": "2.3.1",
193
- "politty": "0.11.2",
193
+ "politty": "0.11.6",
194
194
  "rolldown": "1.2.0",
195
195
  "semver": "7.8.5",
196
196
  "sql-highlight": "6.1.0",
@@ -198,23 +198,23 @@
198
198
  "ts-cron-validator": "1.1.5",
199
199
  "tsx": "4.23.1",
200
200
  "type-fest": "5.8.0",
201
- "undici": "8.7.0",
201
+ "undici": "8.9.0",
202
202
  "xdg-basedir": "5.1.0",
203
203
  "zod": "4.4.3"
204
204
  },
205
205
  "devDependencies": {
206
- "@opentelemetry/sdk-trace-base": "2.9.0",
206
+ "@opentelemetry/sdk-trace-base": "2.10.0",
207
207
  "@types/madge": "5.0.3",
208
208
  "@types/mime-types": "3.0.1",
209
209
  "@types/node": "24.13.3",
210
210
  "@types/semver": "7.7.1",
211
211
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
212
212
  "@vitest/coverage-v8": "4.1.10",
213
- "oxfmt": "0.59.0",
214
- "oxlint": "1.74.0",
215
- "oxlint-tsgolint": "0.25.0",
213
+ "oxfmt": "0.60.0",
214
+ "oxlint": "1.75.0",
215
+ "oxlint-tsgolint": "7.0.2001",
216
216
  "sonda": "0.14.0",
217
- "tsdown": "0.22.9",
217
+ "tsdown": "0.22.14",
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 };