@tailor-platform/sdk 1.83.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.
- package/CHANGELOG.md +32 -0
- package/dist/application-5FOWIxFQ.mjs +3 -0
- package/dist/{application-Cp0FxIm2.mjs → application-CnCljDwk.mjs} +13 -8
- package/dist/application-CnCljDwk.mjs.map +1 -0
- package/dist/cli/commands/deploy/tailordb/index.d.mts +1 -0
- package/dist/cli/commands/generate/service.d.mts +1 -1
- package/dist/cli/commands/generate/types.d.mts +1 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
- package/dist/cli/index.mjs +65 -10
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +1 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/shared/client.d.mts +28 -3
- package/dist/cli/skills.d.mts +1 -1
- package/dist/completion/zsh-worker.zsh +35 -22
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +170 -2
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/executor/index.d.mts +2 -2
- package/dist/configure/services/executor/trigger/event.d.mts +245 -2
- package/dist/configure/services/executor/trigger/index.d.mts +3 -3
- package/dist/configure/services/index.d.mts +2 -2
- package/dist/configure/services/tailordb/index.d.mts +0 -1
- package/dist/configure/services/workflow/job.d.mts +9 -0
- package/dist/configure/services/workflow/workflow.d.mts +10 -0
- package/dist/{register-typescript-runtime-CCHyKeXO.mjs → register-typescript-runtime-BCvWR3HC.mjs} +398 -117
- package/dist/register-typescript-runtime-BCvWR3HC.mjs.map +1 -0
- package/dist/{service-B0MaodSg.mjs → service-CPJWhTLn.mjs} +29 -2
- package/dist/service-CPJWhTLn.mjs.map +1 -0
- package/dist/service-Cigg_U-v.mjs +3 -0
- package/dist/{service_pb-BwZRiNug.mjs → service_pb-D5--My_M.mjs} +5 -5
- package/dist/service_pb-D5--My_M.mjs.map +1 -0
- package/dist/{service_pb-wRkxUta6.mjs → service_pb-i8CmnQP4.mjs} +1 -1
- package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +106 -1
- package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +24 -1
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +49 -1
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +89 -6
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +26 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +101 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +22 -1
- package/dist/types/executor.generated.d.mts +23 -3
- package/dist/{workspace_resource_pb-UGK1SSn_.mjs → workspace_resource_pb-DXnO2AT-.mjs} +7 -7
- package/dist/workspace_resource_pb-DXnO2AT-.mjs.map +1 -0
- package/docs/cli/tailordb.md +14 -12
- package/docs/cli-reference.md +15 -15
- package/docs/services/executor.md +83 -3
- package/docs/services/idp.md +3 -3
- package/docs/services/tailordb-migration.md +13 -2
- package/docs/services/workflow.md +26 -0
- package/package.json +16 -16
- package/dist/application-CP7JKG9R.mjs +0 -3
- package/dist/application-Cp0FxIm2.mjs.map +0 -1
- package/dist/register-typescript-runtime-CCHyKeXO.mjs.map +0 -1
- package/dist/service-B0MaodSg.mjs.map +0 -1
- package/dist/service-KnAiVofD.mjs +0 -3
- package/dist/service_pb-BwZRiNug.mjs.map +0 -1
- package/dist/workspace_resource_pb-UGK1SSn_.mjs.map +0 -1
package/docs/cli/tailordb.md
CHANGED
|
@@ -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
|
|
148
|
-
| ------------------------- | ----- |
|
|
149
|
-
| `--config <CONFIG>` | `-c` | Path to SDK config file
|
|
150
|
-
| `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist)
|
|
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
|
|
package/docs/cli-reference.md
CHANGED
|
@@ -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
|
|
|
@@ -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 `
|
|
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 `
|
|
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
|
-
|
|
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`.
|
package/docs/services/idp.md
CHANGED
|
@@ -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
|
|
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 `
|
|
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. `
|
|
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
|
|
@@ -226,6 +236,7 @@ The `env` values are injected at bundle time (the same mechanism as resolvers/ex
|
|
|
226
236
|
| Remove index | No | No | Schema change only (removing the unique constraint from an index is also non-breaking) |
|
|
227
237
|
| Add unique constraint | Yes | Yes | Script must resolve duplicate values |
|
|
228
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. |
|
|
229
240
|
| Add enum value | No | No | Schema change only |
|
|
230
241
|
| Remove enum value | Yes | Yes | Script migrates records with removed values |
|
|
231
242
|
| Add type | No | No | Schema change only |
|
|
@@ -254,7 +265,7 @@ When you run `tailor-sdk deploy`, the SDK detects pending migrations (anything p
|
|
|
254
265
|
For each pending migration:
|
|
255
266
|
|
|
256
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.
|
|
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`)
|
|
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).
|
|
258
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.
|
|
259
270
|
|
|
260
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.
|
|
@@ -481,4 +492,4 @@ For genuinely different schemas across environments, prefer separate workspaces
|
|
|
481
492
|
|
|
482
493
|
**Cause:** `diff.requiresMigrationScript` is true but `migrate.ts` is missing from the migration directory.
|
|
483
494
|
|
|
484
|
-
**Resolution:**
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
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.
|
|
164
|
-
"@opentelemetry/resources": "2.
|
|
165
|
-
"@opentelemetry/sdk-trace-node": "2.
|
|
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.
|
|
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.
|
|
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.
|
|
189
|
-
"p-limit": "7.3.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
214
|
-
"oxlint": "1.
|
|
215
|
-
"oxlint-tsgolint": "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.
|
|
217
|
+
"tsdown": "0.22.14",
|
|
218
218
|
"typescript": "6.0.3",
|
|
219
219
|
"vitest": "4.1.10",
|
|
220
220
|
"zinfer": "0.2.7",
|