@tailor-platform/sdk 2.0.0-next.10 → 2.0.0-next.11
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 +165 -0
- package/dist/{application-miwiXtB4.mjs → application-CM6hKnSK.mjs} +312 -89
- package/dist/application-CM6hKnSK.mjs.map +1 -0
- package/dist/application-CXNaUNhv.mjs +3 -0
- package/dist/cli/commands/deploy/aigateway.d.mts +1 -1
- package/dist/cli/commands/deploy/application.d.mts +1 -1
- package/dist/cli/commands/deploy/auth.d.mts +1 -1
- package/dist/cli/commands/deploy/deploy.d.mts +1 -0
- package/dist/cli/commands/deploy/executor.d.mts +1 -1
- package/dist/cli/commands/deploy/function-registry.d.mts +1 -2
- package/dist/cli/commands/deploy/idp.d.mts +1 -1
- package/dist/cli/commands/deploy/label.d.mts +2 -0
- package/dist/cli/commands/deploy/resolver.d.mts +1 -1
- package/dist/cli/commands/deploy/staticwebsite.d.mts +1 -1
- package/dist/cli/commands/deploy/tailordb/index.d.mts +2 -1
- package/dist/cli/commands/deploy/types.d.mts +2 -1
- package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -2
- package/dist/cli/commands/deploy/workflow.d.mts +1 -1
- package/dist/cli/commands/executor/get.d.mts +1 -10
- package/dist/cli/commands/executor/jobs.d.mts +1 -38
- package/dist/cli/commands/executor/trigger.d.mts +1 -11
- package/dist/cli/commands/generate/seed/bundler.d.mts +2 -1
- package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +5 -0
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
- package/dist/cli/commands/workflow/executions.d.mts +1 -13
- package/dist/cli/commands/workflow/get.d.mts +1 -10
- package/dist/cli/commands/workflow/start.d.mts +2 -14
- package/dist/cli/lib.d.mts +7 -11
- package/dist/cli/lib.mjs +99 -42
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +318 -124
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/services/http-adapter/bundler.d.mts +1 -0
- package/dist/cli/services/workflow/bundler.d.mts +2 -1
- package/dist/cli/shared/client.d.mts +28 -3
- package/dist/cli/shared/config-loader.d.mts +11 -4
- package/dist/cli/shared/tsconfig-paths-plugin.d.mts +2 -0
- package/dist/cli/shared/type-generator.d.mts +4 -3
- package/dist/completion/zsh-worker.zsh +82 -22
- package/dist/configure/config/types.d.mts +26 -3
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +171 -3
- 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/idp/index.d.mts +1 -1
- package/dist/configure/services/index.d.mts +2 -2
- package/dist/configure/services/tailordb/index.d.mts +0 -1
- package/dist/configure/services/workflow/execution-policy.d.mts +1 -1
- package/dist/configure/services/workflow/execution-policy.types.d.mts +1 -1
- package/dist/configure/services/workflow/job.d.mts +11 -2
- package/dist/configure/services/workflow/workflow.d.mts +10 -0
- package/dist/{globals-DQotNuwK.mjs → globals-TfAVItuK.mjs} +1 -2
- package/dist/globals-TfAVItuK.mjs.map +1 -0
- package/dist/node-builtins-CmaL2Cbq.mjs +36 -0
- package/dist/node-builtins-CmaL2Cbq.mjs.map +1 -0
- package/dist/plugin/builtin/enum-constants/index.mjs +115 -2
- package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -0
- package/dist/plugin/builtin/file-utils/index.mjs +149 -2
- package/dist/plugin/builtin/file-utils/index.mjs.map +1 -0
- package/dist/plugin/builtin/kysely-type/index.mjs +274 -2
- package/dist/plugin/builtin/kysely-type/index.mjs.map +1 -0
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/builtin/seed/seed-type-processor.d.mts +2 -0
- package/dist/{register-ts-hook-BAHMwxfG.mjs → register-ts-hook-LYV7zH-e.mjs} +2252 -797
- package/dist/register-ts-hook-LYV7zH-e.mjs.map +1 -0
- package/dist/registry-BIGVUrMB.mjs.map +1 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/workflow.d.mts +2 -20
- package/dist/runtime/workflow.mjs +1 -1
- package/dist/{seed-LUVr7jHL.mjs → seed-B-yckgQY.mjs} +42 -3
- package/dist/seed-B-yckgQY.mjs.map +1 -0
- package/dist/service-M7OYziQP.mjs +3 -0
- package/dist/{service-BNtPsK9Q.mjs → service-k1xy_A5G.mjs} +29 -2
- package/dist/{service-BNtPsK9Q.mjs.map → service-k1xy_A5G.mjs.map} +1 -1
- 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/types/idp.generated.d.mts +1 -1
- package/dist/utils/test/index.d.mts +1 -2
- package/dist/utils/test/index.mjs +1 -173
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +2 -2
- package/dist/vitest/index.mjs +10 -52
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/workflow.d.mts +0 -9
- package/dist/vitest/setup.mjs +1 -1
- package/dist/{workflow-CsaQ9qK-.mjs → workflow-Bamae_Yc.mjs} +1 -9
- package/dist/workflow-Bamae_Yc.mjs.map +1 -0
- 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 +39 -7
- package/docs/cli-reference.md +11 -10
- package/docs/configuration.md +50 -0
- package/docs/migration/v2.md +306 -9
- package/docs/runtime.md +1 -1
- package/docs/services/executor.md +83 -3
- package/docs/services/idp.md +8 -6
- package/docs/services/resolver.md +6 -4
- package/docs/services/tailordb-migration.md +17 -6
- package/docs/services/tailordb.md +6 -4
- package/docs/services/workflow.md +33 -3
- package/package.json +19 -17
- package/dist/application-DArFTTJ9.mjs +0 -3
- package/dist/application-miwiXtB4.mjs.map +0 -1
- package/dist/enum-constants-j9QBF0cB.mjs +0 -116
- package/dist/enum-constants-j9QBF0cB.mjs.map +0 -1
- package/dist/file-utils-yEiIS4nJ.mjs +0 -150
- package/dist/file-utils-yEiIS4nJ.mjs.map +0 -1
- package/dist/globals-DQotNuwK.mjs.map +0 -1
- package/dist/kysely-type-DqIRgDYR.mjs +0 -275
- package/dist/kysely-type-DqIRgDYR.mjs.map +0 -1
- package/dist/register-ts-hook-BAHMwxfG.mjs.map +0 -1
- package/dist/seed-LUVr7jHL.mjs.map +0 -1
- package/dist/service-D5jn05ZI.mjs +0 -3
- package/dist/service_pb-BwZRiNug.mjs.map +0 -1
- package/dist/utils/test/mock.d.mts +0 -86
- package/dist/workflow-CsaQ9qK-.mjs.map +0 -1
- package/dist/workspace_resource_pb-UGK1SSn_.mjs.map +0 -1
package/docs/cli/tailordb.md
CHANGED
|
@@ -94,13 +94,14 @@ tailor tailordb migration <command>
|
|
|
94
94
|
|
|
95
95
|
**Commands**
|
|
96
96
|
|
|
97
|
-
| Command | Description
|
|
98
|
-
| ------------------------------------------------------------- |
|
|
99
|
-
| [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot.
|
|
100
|
-
| [`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.
|
|
101
|
-
| [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number.
|
|
102
|
-
| [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations.
|
|
103
|
-
| [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift).
|
|
97
|
+
| Command | Description |
|
|
98
|
+
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
99
|
+
| [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local types and the previous migration snapshot. |
|
|
100
|
+
| [`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. |
|
|
101
|
+
| [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
|
|
102
|
+
| [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
|
|
103
|
+
| [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
|
|
104
|
+
| [`tailordb migration validate`](#tailordb-migration-validate) | Validate the full migration history and detect schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found. |
|
|
104
105
|
|
|
105
106
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
106
107
|
|
|
@@ -180,6 +181,12 @@ tailor tailordb migration set [options] <number>
|
|
|
180
181
|
|
|
181
182
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
182
183
|
|
|
184
|
+
**Notes**
|
|
185
|
+
|
|
186
|
+
The migration number must be a 4-digit value (e.g. `0001`) or a bare integer (e.g. `1`) within 0–9999, and must exist in the local migration history; `0` is always accepted as the baseline, provided the local history passes validation. A gapped history is rejected.
|
|
187
|
+
|
|
188
|
+
Metadata lookup failures (authentication, permission, or network errors) are reported as errors; only a not-yet-deployed namespace is treated as having no checkpoint.
|
|
189
|
+
|
|
183
190
|
#### tailordb migration status
|
|
184
191
|
|
|
185
192
|
Show the current migration status for TailorDB namespaces, including applied and pending migrations.
|
|
@@ -201,6 +208,10 @@ tailor tailordb migration status [options]
|
|
|
201
208
|
|
|
202
209
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
203
210
|
|
|
211
|
+
**Notes**
|
|
212
|
+
|
|
213
|
+
Metadata lookup failures (authentication, permission, or network errors) are reported per namespace and make the command exit non-zero; only a not-yet-deployed namespace is treated as having no applied migrations.
|
|
214
|
+
|
|
204
215
|
#### tailordb migration sync
|
|
205
216
|
|
|
206
217
|
Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift).
|
|
@@ -229,6 +240,27 @@ tailor tailordb migration sync [options] <number>
|
|
|
229
240
|
|
|
230
241
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
231
242
|
|
|
243
|
+
#### tailordb migration validate
|
|
244
|
+
|
|
245
|
+
Validate the full migration history and detect schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found.
|
|
246
|
+
|
|
247
|
+
**Usage**
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
tailor tailordb migration validate [options]
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Options**
|
|
254
|
+
|
|
255
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
256
|
+
| ------------------------------- | ----- | --------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
|
|
257
|
+
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
|
|
258
|
+
| `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
|
|
259
|
+
| `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
|
|
260
|
+
| `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (validates all namespaces if not specified) | No | - | - |
|
|
261
|
+
|
|
262
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
263
|
+
|
|
232
264
|
**See also:** For migration concepts, configuration, workflow, and troubleshooting, see the [TailorDB Migrations guide](../services/tailordb-migration.md).
|
|
233
265
|
|
|
234
266
|
### tailordb erd
|
package/docs/cli-reference.md
CHANGED
|
@@ -200,16 +200,17 @@ Commands for managing Tailor Platform applications (work with `tailor.config.ts`
|
|
|
200
200
|
|
|
201
201
|
Commands for managing TailorDB tables, data, and schema migrations.
|
|
202
202
|
|
|
203
|
-
| Command | Description
|
|
204
|
-
| ---------------------------------------------------------------------------- |
|
|
205
|
-
| [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data.
|
|
206
|
-
| [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables.
|
|
207
|
-
| [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations.
|
|
208
|
-
| [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.
|
|
209
|
-
| [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.
|
|
210
|
-
| [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number.
|
|
211
|
-
| [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations.
|
|
212
|
-
| [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift).
|
|
203
|
+
| Command | Description |
|
|
204
|
+
| ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
205
|
+
| [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
|
|
206
|
+
| [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
|
|
207
|
+
| [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
|
|
208
|
+
| [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. |
|
|
209
|
+
| [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. |
|
|
210
|
+
| [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
|
|
211
|
+
| [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
|
|
212
|
+
| [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
|
|
213
|
+
| [tailordb migration validate](./cli/tailordb.md#tailordb-migration-validate) | Validate the full migration history and detect schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found. |
|
|
213
214
|
|
|
214
215
|
### [Query Commands](./cli/query.md)
|
|
215
216
|
|
package/docs/configuration.md
CHANGED
|
@@ -86,6 +86,21 @@ export default defineConfig({
|
|
|
86
86
|
|
|
87
87
|
**Pattern resolution**: `files` and `ignores` patterns are resolved relative to the directory of the `tailor.config.ts` file that declares them, not the directory you run the command from. This matters when deploying [multiple configs](./cli/application.md#deploy) together — each config's patterns only match files under its own directory. If a config's _relative_ patterns match nothing under its own directory, the SDK falls back to resolving them from the directory you ran the command from and logs a warning (this fallback doesn't apply to already-absolute patterns, since their resolution can't change). Update such patterns to be relative to the config's own directory — this fallback will be removed in v2.
|
|
88
88
|
|
|
89
|
+
### Bundling
|
|
90
|
+
|
|
91
|
+
Resolvers, executors, workflow jobs, auth hooks, HTTP adapters, TailorDB hooks and validators, functions, seeds, queries, and migration scripts are all bundled before running locally or deploying. Bundling honors `compilerOptions.paths` aliases declared in a `tsconfig.json`, resolved against the importing file's own nearest `tsconfig.json` (the first one found walking up from that file's directory, following its `extends` chain) — so a path alias works the same whether it is imported directly or through another aliased import.
|
|
92
|
+
|
|
93
|
+
An import that cannot be resolved fails the command instead of shipping a broken bundle, naming the specifier, the importing file, and the tsconfig the build used:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
Error [UNRESOLVED_IMPORT]: Could not resolve "@lib/missing" imported from "/path/to/resolver.ts".
|
|
97
|
+
Suggestion: Check that each import path is correct, and that a `compilerOptions.paths`
|
|
98
|
+
entry covering it is declared in the importing file's own tsconfig.json or an ancestor.
|
|
99
|
+
The build used "/path/to/tsconfig.json".
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
If the unresolved specifier is a Node.js built-in (e.g. `fs`, `crypto`, `path`), the suggestion explains that it is not available in the Tailor Platform runtime and, where one exists, names a Web-standard replacement (e.g. the Fetch API instead of `http`/`https`).
|
|
103
|
+
|
|
89
104
|
### External Resources
|
|
90
105
|
|
|
91
106
|
You can reference resources managed by Terraform or other SDK projects to include them in your application's subgraph. External resources are not deployed by this project but can be used for shared access across multiple applications.
|
|
@@ -113,6 +128,7 @@ When using external resources:
|
|
|
113
128
|
- You can combine external resources with locally-defined resources
|
|
114
129
|
- TailorDB type names must remain unique across local and external TailorDB namespaces; `deploy` checks external TailorDB type names before applying changes
|
|
115
130
|
- Destructive operations like `tailordb truncate` (and `tailor seed apply --truncate`) automatically exclude external resources to prevent accidental data loss in shared resources
|
|
131
|
+
- Subscribing an executor to an external resource's events requires the config that owns the resource in the same `deploy`. Publishing is then enabled automatically, and `deploy` records the dependency so a later deploy without that config asks for confirmation instead of silently turning publishing off
|
|
116
132
|
|
|
117
133
|
### Built-in IdP
|
|
118
134
|
|
|
@@ -273,6 +289,40 @@ export async function main(trx: Transaction, { env }: MigrationContext): Promise
|
|
|
273
289
|
}
|
|
274
290
|
```
|
|
275
291
|
|
|
292
|
+
#### Secret Detection
|
|
293
|
+
|
|
294
|
+
`env` values are deployed as plaintext, so loading a config fails when one of them looks like a credential:
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
✖ Secret detected in 'env' in /path/to/tailor.config.ts:
|
|
298
|
+
- env.SLACK_BOT_TOKEN (matched slack: SLACK_TOKEN)
|
|
299
|
+
https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-slack/README.md#SLACK_TOKEN
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Each finding names the pattern that matched and links to its description, so a value flagged as an AWS account id is distinguishable from one flagged as an AWS secret access key.
|
|
303
|
+
|
|
304
|
+
Move the value to [Secret Manager](./services/secret.md) to fix this. Detection recognizes the credential formats published by common providers, such as Slack, GitHub and AWS.
|
|
305
|
+
|
|
306
|
+
A value that is merely long and random-looking, with no recognizable provider format, is reported as a warning instead and does not fail the command.
|
|
307
|
+
|
|
308
|
+
When detection is wrong about a value, allow it in place with `allowSecretReason`, stating why the value is safe to deploy as plaintext:
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
export default defineConfig({
|
|
312
|
+
name: "my-app",
|
|
313
|
+
env: {
|
|
314
|
+
slackRelayUrl: {
|
|
315
|
+
value: process.env.SLACK_RELAY_URL ?? "",
|
|
316
|
+
allowSecretReason: "Public relay endpoint; the token it proxies stays in Secret Manager.",
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
This silences both the failure and the warning, so it also covers a value that is random-looking without being a credential — say so in the reason. Only string and number values accept an allowance: a boolean is never flagged, so it never needs one.
|
|
323
|
+
|
|
324
|
+
Application code still reads `env.slackRelayUrl` as the value itself: the wrapper only carries the reason and does not reach the deployed application.
|
|
325
|
+
|
|
276
326
|
### Workflow Service
|
|
277
327
|
|
|
278
328
|
Configure Workflow service by specifying glob patterns for workflow files:
|
package/docs/migration/v2.md
CHANGED
|
@@ -668,6 +668,70 @@ already pass a plain value unchanged.
|
|
|
668
668
|
|
|
669
669
|
</details>
|
|
670
670
|
|
|
671
|
+
## defineIdp publishUserEvents → publishEvents
|
|
672
|
+
|
|
673
|
+
**Migration:** Partially automatic
|
|
674
|
+
|
|
675
|
+
Rename the `defineIdp` option `publishUserEvents` to `publishEvents`, matching the field name TailorDB types, resolvers, and workflows already use.
|
|
676
|
+
|
|
677
|
+
Before:
|
|
678
|
+
|
|
679
|
+
```ts
|
|
680
|
+
import { defineIdp } from "@tailor-platform/sdk";
|
|
681
|
+
|
|
682
|
+
export const idp = defineIdp("my-idp", {
|
|
683
|
+
clients: ["my-client"],
|
|
684
|
+
publishUserEvents: true,
|
|
685
|
+
});
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
After:
|
|
689
|
+
|
|
690
|
+
```ts
|
|
691
|
+
import { defineIdp } from "@tailor-platform/sdk";
|
|
692
|
+
|
|
693
|
+
export const idp = defineIdp("my-idp", {
|
|
694
|
+
clients: ["my-client"],
|
|
695
|
+
publishEvents: true,
|
|
696
|
+
});
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
A shorthand option keeps reading the same local:
|
|
700
|
+
|
|
701
|
+
Before:
|
|
702
|
+
|
|
703
|
+
```ts
|
|
704
|
+
defineIdp("my-idp", { clients, publishUserEvents });
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
After:
|
|
708
|
+
|
|
709
|
+
```ts
|
|
710
|
+
defineIdp("my-idp", { clients, publishEvents: publishUserEvents });
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
<details>
|
|
714
|
+
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
715
|
+
|
|
716
|
+
```text
|
|
717
|
+
In Tailor SDK v2, the IdP option `publishUserEvents` is renamed to
|
|
718
|
+
`publishEvents`, so all four services that publish events use one field name.
|
|
719
|
+
The codemod rewrites the option key on `defineIdp` calls whose callee resolves
|
|
720
|
+
to the SDK export, including aliased and namespace imports, and rewrites a
|
|
721
|
+
shorthand `{ publishUserEvents }` to `{ publishEvents: publishUserEvents }` so
|
|
722
|
+
it keeps reading the same local.
|
|
723
|
+
|
|
724
|
+
Also review, and migrate by hand:
|
|
725
|
+
- An options object built in a variable or spread into the call — the codemod
|
|
726
|
+
only rewrites object literals passed directly to `defineIdp`.
|
|
727
|
+
- A computed key (e.g. `[key]: value`) that resolves to `publishUserEvents`.
|
|
728
|
+
- Type annotations or interfaces that declare the option themselves.
|
|
729
|
+
- A file where a local declaration shadows the `defineIdp` import; the codemod
|
|
730
|
+
skips it because the call may not be the SDK export.
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
</details>
|
|
734
|
+
|
|
671
735
|
## defineWaitPoint/defineWaitPoints → createWaitPoint/createWaitPoints
|
|
672
736
|
|
|
673
737
|
**Migration:** Partially automatic
|
|
@@ -694,11 +758,11 @@ export const { approval } = createWaitPoints((define) => ({
|
|
|
694
758
|
}));
|
|
695
759
|
```
|
|
696
760
|
|
|
697
|
-
## workflow.triggerWorkflow/triggerJobFunction/resumeWorkflow → startWorkflow/
|
|
761
|
+
## workflow.triggerWorkflow/triggerJobFunction/resumeWorkflow → startWorkflow/execJobFunction/resumeWorkflowExecution
|
|
698
762
|
|
|
699
763
|
**Migration:** Partially automatic
|
|
700
764
|
|
|
701
|
-
Rename tailor.workflow call sites from the pre-alignment triggerWorkflow/triggerJobFunction/resumeWorkflow names to the canonical startWorkflow/
|
|
765
|
+
Rename tailor.workflow call sites from the pre-alignment triggerWorkflow/triggerJobFunction/resumeWorkflow names to the canonical startWorkflow/execJobFunction/resumeWorkflowExecution names, on both the ambient tailor.workflow global and a workflow value imported from @tailor-platform/sdk/runtime(/workflow). For a renamed triggerWorkflow call, also renames a literal `invoker` option key to `authInvoker` — startWorkflow's options expect the platform shape directly, unlike the removed triggerWorkflow wrapper, which converted invoker to authInvoker internally.
|
|
702
766
|
|
|
703
767
|
Before:
|
|
704
768
|
|
|
@@ -736,7 +800,7 @@ await workflow.startWorkflow("myWorkflow", { data: "value" }, { authInvoker: myI
|
|
|
736
800
|
```text
|
|
737
801
|
The pre-alignment tailor.workflow names triggerWorkflow, triggerJobFunction, and
|
|
738
802
|
resumeWorkflow are removed from the SDK's type surface in v2; use the canonical
|
|
739
|
-
startWorkflow,
|
|
803
|
+
startWorkflow, execJobFunction, and resumeWorkflowExecution names instead. The
|
|
740
804
|
codemod rewrites direct member-access call sites on the ambient tailor.workflow
|
|
741
805
|
global and on a workflow value imported from @tailor-platform/sdk/runtime or
|
|
742
806
|
@tailor-platform/sdk/runtime/workflow (including aliased imports). It skips a
|
|
@@ -753,7 +817,7 @@ Also review, and migrate by hand:
|
|
|
753
817
|
- Destructured references (e.g. const { triggerWorkflow } = workflow) — the
|
|
754
818
|
codemod only rewrites direct member-access calls.
|
|
755
819
|
- Imported TriggerWorkflowOptions / TriggerJobFunctionOptions types — rename
|
|
756
|
-
them to StartWorkflowOptions /
|
|
820
|
+
them to StartWorkflowOptions / ExecJobFunctionOptions.
|
|
757
821
|
- An invoker option passed via a variable or spread (not a literal object) —
|
|
758
822
|
the codemod only inspects literal object arguments; rename the invoker key
|
|
759
823
|
to authInvoker in the options object's own definition.
|
|
@@ -761,6 +825,52 @@ Also review, and migrate by hand:
|
|
|
761
825
|
|
|
762
826
|
</details>
|
|
763
827
|
|
|
828
|
+
## workflow.startJobFunction → execJobFunction
|
|
829
|
+
|
|
830
|
+
**Migration:** Partially automatic
|
|
831
|
+
|
|
832
|
+
`tailor.workflow.startJobFunction` and the `StartJobFunctionOptions` type are removed in v2. Use the canonical `execJobFunction` / `ExecJobFunctionOptions`: `Exec*` blocks and returns the job's result, while `Start*` returns only an execution ID. The codemod rewrites member-access call sites on the ambient `tailor.workflow` global and on a `workflow` value imported from @tailor-platform/sdk/runtime(/workflow), and renames `StartJobFunctionOptions` imports along with the type references that resolve to them.
|
|
833
|
+
|
|
834
|
+
Before:
|
|
835
|
+
|
|
836
|
+
```ts
|
|
837
|
+
import { workflow } from "@tailor-platform/sdk/runtime";
|
|
838
|
+
|
|
839
|
+
const result = workflow.startJobFunction("myJob", { data: "value" });
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
After:
|
|
843
|
+
|
|
844
|
+
```ts
|
|
845
|
+
import { workflow } from "@tailor-platform/sdk/runtime";
|
|
846
|
+
|
|
847
|
+
const result = workflow.execJobFunction("myJob", { data: "value" });
|
|
848
|
+
```
|
|
849
|
+
|
|
850
|
+
<details>
|
|
851
|
+
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
852
|
+
|
|
853
|
+
```text
|
|
854
|
+
startJobFunction is removed from the SDK's workflow runtime surface in v2;
|
|
855
|
+
execJobFunction is the canonical name for a blocking job call that returns the
|
|
856
|
+
job's result. The codemod rewrites direct member-access calls on the ambient
|
|
857
|
+
tailor.workflow global and on a workflow value imported from
|
|
858
|
+
@tailor-platform/sdk/runtime or @tailor-platform/sdk/runtime/workflow (including
|
|
859
|
+
aliased imports), and renames the StartJobFunctionOptions type. It skips a file
|
|
860
|
+
entirely when a local declaration shadows the workflow import or the ambient
|
|
861
|
+
tailor name, to avoid rewriting an unrelated same-named value.
|
|
862
|
+
|
|
863
|
+
Also review, and migrate by hand:
|
|
864
|
+
- Destructured references (e.g. const { startJobFunction } = workflow) — the
|
|
865
|
+
codemod only rewrites direct member-access calls.
|
|
866
|
+
- mockWorkflow().startJobFunction in tests — assert on the execJobFunction vi.fn
|
|
867
|
+
instead; the alias was the same mock function.
|
|
868
|
+
- A file that already imports ExecJobFunctionOptions alongside the removed type —
|
|
869
|
+
rename the remaining references by hand and drop the duplicate specifier.
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
</details>
|
|
873
|
+
|
|
764
874
|
## openDownloadStream → downloadStream
|
|
765
875
|
|
|
766
876
|
**Migration:** Manual
|
|
@@ -1253,9 +1363,9 @@ single generation pass and resolves once it completes.
|
|
|
1253
1363
|
|
|
1254
1364
|
## Generated seed exec.mjs → tailor seed CLI plugin
|
|
1255
1365
|
|
|
1256
|
-
**Migration:**
|
|
1366
|
+
**Migration:** Partially automatic
|
|
1257
1367
|
|
|
1258
|
-
`seedPlugin` no longer generates the `exec.mjs` seed runner. Seeding and validation move to the `tailor seed` commands provided by the `@tailor-platform/sdk-plugin-seed` CLI plugin: install it as a devDependency, replace `node <distPath>/exec.mjs` invocations with `tailor seed apply` and `node <distPath>/exec.mjs validate` with `tailor seed validate`, and delete the stale generated `<distPath>/exec.mjs` file. Seed data and schema generation (`data/*.jsonl`, `data/*.schema.ts`) is unchanged, and the `tailor seed apply` options mirror the old script (`--machine-user`, `--namespace`, `--skip-idp`, `--truncate`, `--yes`, type-name arguments).
|
|
1368
|
+
`seedPlugin` no longer generates the `exec.mjs` seed runner. Seeding and validation move to the `tailor seed` commands provided by the `@tailor-platform/sdk-plugin-seed` CLI plugin: install it as a devDependency, replace `node <distPath>/exec.mjs` invocations with `tailor seed apply` and `node <distPath>/exec.mjs validate` with `tailor seed validate`, and delete the stale generated `<distPath>/exec.mjs` file. Seed data and schema generation (`data/*.jsonl`, `data/*.schema.ts`) is unchanged, and the `tailor seed apply` options mirror the old script (`--machine-user`, `--namespace`, `--skip-idp`, `--truncate`, `--yes`, type-name arguments), plus a new `--upsert` flag to update existing rows instead of failing on duplicate ids.
|
|
1259
1369
|
|
|
1260
1370
|
Before:
|
|
1261
1371
|
|
|
@@ -1272,7 +1382,7 @@ After:
|
|
|
1272
1382
|
```
|
|
1273
1383
|
|
|
1274
1384
|
<details>
|
|
1275
|
-
<summary>Prompt for an AI agent (to
|
|
1385
|
+
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
1276
1386
|
|
|
1277
1387
|
```text
|
|
1278
1388
|
seedPlugin no longer generates the exec.mjs seed runner in v2. The tailor seed
|
|
@@ -1282,11 +1392,194 @@ CLI plugin (@tailor-platform/sdk-plugin-seed) replaces it:
|
|
|
1282
1392
|
@tailor-platform/sdk.
|
|
1283
1393
|
- Replace `node <distPath>/exec.mjs [options] [types...]` invocations with
|
|
1284
1394
|
`tailor seed apply [options] [types...]` (same options: --machine-user/-m,
|
|
1285
|
-
--namespace/-n, --skip-idp, --truncate, --yes, and type-name arguments
|
|
1395
|
+
--namespace/-n, --skip-idp, --truncate, --yes, and type-name arguments,
|
|
1396
|
+
plus a new --upsert flag to update existing rows instead of failing on
|
|
1397
|
+
duplicate ids).
|
|
1286
1398
|
- Replace `node <distPath>/exec.mjs validate [path]` with
|
|
1287
1399
|
`tailor seed validate [path]`.
|
|
1400
|
+
- Rewrite `fork("<distPath>/exec.mjs", ...)` call sites (test setup files
|
|
1401
|
+
typically fork the runner and await a hand-rolled Promise around
|
|
1402
|
+
`child.on("close", ...)`). The plugin is a CLI-dispatched binary rather
|
|
1403
|
+
than a forkable JS module, so call it synchronously instead —
|
|
1404
|
+
`execSync("npx tailor seed apply", { env, stdio: "inherit" })` — keeping
|
|
1405
|
+
the original `env` and `stdio` forwarding, and unwind the surrounding
|
|
1406
|
+
Promise wrapper (drop the now-unused `await`, and the `async` keyword when
|
|
1407
|
+
nothing else in the function awaits). Note that `execSync` throws on a
|
|
1408
|
+
nonzero exit, replacing the wrapper's explicit reject.
|
|
1288
1409
|
- Delete the stale generated `<distPath>/exec.mjs` file; keep the data/
|
|
1289
|
-
directory (JSONL data and generated schemas) as-is.
|
|
1410
|
+
directory (JSONL data and generated schemas) as-is. Nothing removes it
|
|
1411
|
+
automatically, and a leftover runner keeps working while no longer being
|
|
1412
|
+
regenerated.
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
</details>
|
|
1416
|
+
|
|
1417
|
+
## @tailor-platform/sdk/test global mocks → @tailor-platform/sdk/vitest
|
|
1418
|
+
|
|
1419
|
+
**Migration:** Manual
|
|
1420
|
+
|
|
1421
|
+
The global platform mocks exported from `@tailor-platform/sdk/test` (`setupTailordbMock`, `setupWorkflowMock`, `setupWaitPointMock`, `setupInvokerMock`, `setupTailorErrorsMock`) and the bundled-output helper `createImportMain` are removed in v2. Use the `tailor-runtime` environment from `@tailor-platform/sdk/vitest` together with `mockTailordb` / `mockWorkflow`: the environment injects `TailorErrors` for you, `setWaitHandler` / `setResolveHandler` replace the wait-point stubs, and the invoker is driven through `globalThis.tailor.context.getInvoker` (or passed directly to `.body()` when testing the TypeScript source). No codemod ships for this migration: it replaces per-test global stubs with a Vitest environment plus disposable mocks, which changes the Vitest config, the setup shape, and the assertions of every affected test. The other `@tailor-platform/sdk/test` exports (`createTailorDBHook`, `createStandardSchema`, `unauthenticatedTailorUser`) are unchanged.
|
|
1422
|
+
|
|
1423
|
+
Job mocks move from a global stub to a disposable mock:
|
|
1424
|
+
|
|
1425
|
+
Before:
|
|
1426
|
+
|
|
1427
|
+
```ts
|
|
1428
|
+
import { setupWorkflowMock } from "@tailor-platform/sdk/test";
|
|
1429
|
+
|
|
1430
|
+
const { startedJobs } = setupWorkflowMock(() => ({ ok: true }));
|
|
1431
|
+
```
|
|
1432
|
+
|
|
1433
|
+
After:
|
|
1434
|
+
|
|
1435
|
+
```ts
|
|
1436
|
+
import { mockWorkflow } from "@tailor-platform/sdk/vitest";
|
|
1437
|
+
|
|
1438
|
+
using wf = mockWorkflow();
|
|
1439
|
+
wf.setJobHandler(() => ({ ok: true }));
|
|
1440
|
+
// wf.startedJobs replaces the returned startedJobs array
|
|
1441
|
+
```
|
|
1442
|
+
|
|
1443
|
+
<details>
|
|
1444
|
+
<summary>Prompt for an AI agent (to perform this migration)</summary>
|
|
1445
|
+
|
|
1446
|
+
```text
|
|
1447
|
+
The global platform mocks from @tailor-platform/sdk/test are removed in v2.
|
|
1448
|
+
Migrate each affected test to the tailor-runtime Vitest environment:
|
|
1449
|
+
|
|
1450
|
+
1. Add the environment for the test files that need platform globals — set
|
|
1451
|
+
environment: "tailor-runtime" in the Vitest project config, or add the
|
|
1452
|
+
// @vitest-environment tailor-runtime docblock to the file. The environment
|
|
1453
|
+
ships in @tailor-platform/sdk/vitest and installs TailorErrors and the base
|
|
1454
|
+
tailor/tailordb globals, so setupTailorErrorsMock has no replacement — delete it.
|
|
1455
|
+
2. Replace setupTailordbMock(resolver) with using db = mockTailordb() and
|
|
1456
|
+
configure query results on that mock; read its recorded calls instead of the
|
|
1457
|
+
returned executedQueries / createdClients arrays.
|
|
1458
|
+
3. Replace setupWorkflowMock(handler) with using wf = mockWorkflow() plus
|
|
1459
|
+
wf.setJobHandler(handler) (or wf.enqueueResult(...) for order-based results),
|
|
1460
|
+
and read wf.startedJobs.
|
|
1461
|
+
4. Replace setupWaitPointMock({ onWait, onResolve }) with the same mockWorkflow()
|
|
1462
|
+
handle: wf.setWaitHandler / wf.setResolveHandler, asserting on wf.waitCalls /
|
|
1463
|
+
wf.resolveCalls.
|
|
1464
|
+
5. Replace setupInvokerMock(invoker) with
|
|
1465
|
+
vi.spyOn(globalThis.tailor.context, "getInvoker").mockReturnValue(raw) for a
|
|
1466
|
+
bundled test, or pass invoker directly to .body() when unit-testing a
|
|
1467
|
+
resolver/executor/workflow job against the TypeScript source.
|
|
1468
|
+
6. Drop createImportMain and the tests that import bundled output through it.
|
|
1469
|
+
Bundling integrity is the SDK's responsibility: unit-test the TypeScript
|
|
1470
|
+
source and cover deployed behavior with E2E tests instead.
|
|
1471
|
+
|
|
1472
|
+
See the SDK testing guide for the full environment setup.
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
</details>
|
|
1476
|
+
|
|
1477
|
+
## Programmatic CLI name options → workflow/executor definitions
|
|
1478
|
+
|
|
1479
|
+
**Migration:** Manual
|
|
1480
|
+
|
|
1481
|
+
The name-keyed option types exported from `@tailor-platform/sdk/cli` — `GetWorkflowOptions`, `StartWorkflowOptions`, `ListWorkflowExecutionsOptions`, `GetExecutorOptions`, `TriggerExecutorOptions`, `ListExecutorJobsOptions`, `GetExecutorJobOptions`, `WatchExecutorJobOptions` — are removed in v2, together with the function overloads that accepted them. Pass the workflow or executor definition itself instead: `{ workflow: myWorkflow, invoker: "admin" }` / `{ executor: myExecutor }`, matching the `*TypedOptions` shape that types `arg` and `payload` from the definition. No codemod ships for this migration: rewriting a name string into a definition requires importing the module that defines the workflow or executor, which a source-local transform cannot resolve.
|
|
1482
|
+
|
|
1483
|
+
Before:
|
|
1484
|
+
|
|
1485
|
+
```ts
|
|
1486
|
+
import { startWorkflow } from "@tailor-platform/sdk/cli";
|
|
1487
|
+
|
|
1488
|
+
const { executionId } = await startWorkflow({ name: "user-sync", machineUser: "admin" });
|
|
1489
|
+
```
|
|
1490
|
+
|
|
1491
|
+
After:
|
|
1492
|
+
|
|
1493
|
+
```ts
|
|
1494
|
+
import { startWorkflow } from "@tailor-platform/sdk/cli";
|
|
1495
|
+
import userSync from "./workflows/userSync";
|
|
1496
|
+
|
|
1497
|
+
const { executionId } = await startWorkflow({ workflow: userSync, invoker: "admin" });
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
Executor commands take the executor definition:
|
|
1501
|
+
|
|
1502
|
+
Before:
|
|
1503
|
+
|
|
1504
|
+
```ts
|
|
1505
|
+
const result = await watchExecutorJob({ executorName: "daily-sync", jobId });
|
|
1506
|
+
```
|
|
1507
|
+
|
|
1508
|
+
After:
|
|
1509
|
+
|
|
1510
|
+
```ts
|
|
1511
|
+
const result = await watchExecutorJob({ executor: dailySync, jobId });
|
|
1512
|
+
```
|
|
1513
|
+
|
|
1514
|
+
<details>
|
|
1515
|
+
<summary>Prompt for an AI agent (to perform this migration)</summary>
|
|
1516
|
+
|
|
1517
|
+
```text
|
|
1518
|
+
The programmatic CLI functions in @tailor-platform/sdk/cli no longer accept a
|
|
1519
|
+
workflow or executor name; they take the definition object instead. For each
|
|
1520
|
+
flagged call site:
|
|
1521
|
+
|
|
1522
|
+
1. Import the workflow or executor definition — the module whose default export
|
|
1523
|
+
is createWorkflow(...) or whose export is createExecutor(...) with that name.
|
|
1524
|
+
2. Replace name: "my-workflow" with workflow: myWorkflow, and
|
|
1525
|
+
executorName: "my-executor" with executor: myExecutor. For
|
|
1526
|
+
listWorkflowExecutions, workflowName becomes workflow.
|
|
1527
|
+
3. startWorkflow's machine user moves from machineUser to the required
|
|
1528
|
+
invoker, typed against the machine users declared in tailor.config.ts.
|
|
1529
|
+
4. Replace imported option types with the *TypedOptions equivalent
|
|
1530
|
+
(e.g. GetWorkflowOptions → GetWorkflowTypedOptions<typeof myWorkflow>).
|
|
1531
|
+
Note that arg (startWorkflow) and payload (triggerExecutor) are now typed
|
|
1532
|
+
from the definition, so a mistyped argument becomes a type error.
|
|
1533
|
+
|
|
1534
|
+
When the name is only known at runtime (read from argv or an environment
|
|
1535
|
+
variable), the CLI command itself — `tailor workflow start <name>` /
|
|
1536
|
+
`tailor executor trigger <name>` — remains the name-keyed entry point.
|
|
1537
|
+
```
|
|
1538
|
+
|
|
1539
|
+
</details>
|
|
1540
|
+
|
|
1541
|
+
## tailor.d.ts Env uses value types instead of literal values
|
|
1542
|
+
|
|
1543
|
+
**Migration:** Manual
|
|
1544
|
+
|
|
1545
|
+
The `Env` interface in `tailor.d.ts` is generated from the type of each `defineConfig({ env })` value (`string`, `number`, or `boolean`) instead of the value itself, so the generated file no longer carries whatever the config resolved to when it was generated. Keys that aren't valid TypeScript identifiers are quoted, which previously produced a file that failed to parse. Run `tailor generate` to refresh the file, then widen any code that depended on the old literal types. If a `tailor.d.ts` you already committed contains a sensitive value, treat that value as exposed and rotate it; keep secrets in Secret Manager rather than `env`.
|
|
1546
|
+
|
|
1547
|
+
An env value can no longer stand in for a literal union; narrow it explicitly:
|
|
1548
|
+
|
|
1549
|
+
Before:
|
|
1550
|
+
|
|
1551
|
+
```ts
|
|
1552
|
+
const stage: "production" | "staging" = env.STAGE;
|
|
1553
|
+
```
|
|
1554
|
+
|
|
1555
|
+
After:
|
|
1556
|
+
|
|
1557
|
+
```ts
|
|
1558
|
+
const stage = env.STAGE === "staging" ? "staging" : "production";
|
|
1559
|
+
```
|
|
1560
|
+
|
|
1561
|
+
<details>
|
|
1562
|
+
<summary>Prompt for an AI agent (to perform this migration)</summary>
|
|
1563
|
+
|
|
1564
|
+
```text
|
|
1565
|
+
Tailor SDK v2 generates the `Env` interface in `tailor.d.ts` from the type of
|
|
1566
|
+
each `defineConfig({ env })` value (`string`, `number`, `boolean`) instead of
|
|
1567
|
+
the resolved value, so `Env` properties no longer carry literal types.
|
|
1568
|
+
|
|
1569
|
+
Run `tailor generate` first to refresh `tailor.d.ts`, then review the places
|
|
1570
|
+
that depended on the old literal types:
|
|
1571
|
+
|
|
1572
|
+
- An env value assigned or passed where a literal union is required, e.g.
|
|
1573
|
+
`const stage: "production" | "staging" = env.STAGE`. Narrow it with a
|
|
1574
|
+
comparison or a validation helper instead of relying on the declared type.
|
|
1575
|
+
- A generic argument, conditional type, or template-literal type parameterized
|
|
1576
|
+
by an env value.
|
|
1577
|
+
- `as const` / `satisfies` assertions that assumed one specific literal.
|
|
1578
|
+
|
|
1579
|
+
Plain comparisons (`env.STAGE === "production"`) and arithmetic on numeric env
|
|
1580
|
+
values keep working and need no change. Do not restore the old behavior by
|
|
1581
|
+
editing `tailor.d.ts`: it is generated and will be overwritten, and embedding
|
|
1582
|
+
env values there is what leaked configured secrets into version control.
|
|
1290
1583
|
```
|
|
1291
1584
|
|
|
1292
1585
|
</details>
|
|
@@ -1295,6 +1588,10 @@ CLI plugin (@tailor-platform/sdk-plugin-seed) replaces it:
|
|
|
1295
1588
|
|
|
1296
1589
|
These v2 changes alter runtime or CLI behavior; no source change is needed.
|
|
1297
1590
|
|
|
1591
|
+
### publishEvents recomputed from the executors in each deploy
|
|
1592
|
+
|
|
1593
|
+
An unset `publishEvents` is recomputed on every `deploy` from the executors taking part in the run, in both directions: adding a subscribing trigger turns publishing on, and removing the last one turns it back off. Previously a workflow or job kept publishing once it had been enabled, so a workflow whose subscribing trigger is already gone stops publishing on the next `deploy` — declare `publishEvents: true` on it if something outside this project consumes those events. `deploy` also stops instead of applying when a subscription cannot be satisfied: when a trigger names a resource no config in the run declares, when a workflow or job combines `publishEvents: false` with a subscribing trigger, and when a config that resolves without an `id` subscribes across configs. Each of those errors names the resource and both ways to resolve it.
|
|
1594
|
+
|
|
1298
1595
|
### CLI tokens stored in the OS keyring
|
|
1299
1596
|
|
|
1300
1597
|
CLI login tokens are stored in the OS keyring by default when available, falling back to the platform config file when it is not. No source change is required; re-login if you need tokens moved into the keyring.
|
package/docs/runtime.md
CHANGED
|
@@ -84,7 +84,7 @@ The runtime entry re-exports the following namespaces. Detailed signatures, para
|
|
|
84
84
|
- `secretmanager` — secret-vault access (`getSecret`, `getSecrets`)
|
|
85
85
|
- `authconnection` — OAuth-style connection tokens (`getConnectionToken`)
|
|
86
86
|
- `idp` — IdP user management (`new Client({ namespace })`)
|
|
87
|
-
- `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `execJobFunction`, `wait`, `resolve
|
|
87
|
+
- `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `execJobFunction`, `wait`, `resolve`)
|
|
88
88
|
- `context` — execution context (`getInvoker`)
|
|
89
89
|
- `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `downloadStream`, `uploadStream`)
|
|
90
90
|
- `aigateway` — AI Gateway URL resolution (`get`)
|