@tailor-platform/sdk 2.22.0 → 2.24.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 +59 -0
- package/dist/aigateway-DsWDjzk4.mjs.map +1 -1
- package/dist/application-BDqze-wy.mjs +1 -0
- package/dist/application-CfqvzV3I.mjs +200 -0
- package/dist/application-CfqvzV3I.mjs.map +1 -0
- package/dist/assert-WeXvmG4j.mjs.map +1 -1
- package/dist/authconnection-CynFBIv8.mjs.map +1 -1
- package/dist/brand-C8nMKhJC.mjs.map +1 -1
- package/dist/cli/cache/bundle-cache.d.mts +1 -0
- package/dist/cli/lib.mjs +1 -1
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +40 -40
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/services/application.d.mts +1 -0
- package/dist/cli/services/workflow/bundler.d.mts +2 -1
- package/dist/cli/shared/client.d.mts +17 -2
- package/dist/cli/shared/forbidden-runtime-globals.d.mts +1 -0
- package/dist/cli/shared/start-context.d.mts +1 -0
- package/dist/cli/ts-hook.mjs +3 -3
- package/dist/completion/zsh-worker.zsh +13 -7
- package/dist/configure/config/types.d.mts +42 -2
- package/dist/configure/index.mjs +1 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/context-D0QjfxzD.mjs.map +1 -1
- package/dist/crashreport-DFpRn-LS.mjs.map +1 -1
- package/dist/date-Dri6Yas-.mjs.map +1 -1
- package/dist/errors-CpvSChyL.mjs +7 -0
- package/dist/errors-CpvSChyL.mjs.map +1 -0
- package/dist/es-builtins-SfvXRVoG.mjs.map +1 -1
- package/dist/field-parse-DhnFs9WG.mjs.map +1 -1
- package/dist/file-DKBOj5q4.mjs.map +1 -1
- package/dist/globals-BCmGX05J.mjs.map +1 -1
- package/dist/guards-yDXyKC9F.mjs.map +1 -1
- package/dist/iconv-DlFMt2gW.mjs.map +1 -1
- package/dist/idp-G_ojPBB5.mjs.map +1 -1
- package/dist/interceptor-DQg3cR_9.mjs.map +1 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/kysely-type-C-iyFFH7.mjs.map +1 -1
- package/dist/logger-DP2BjQ93.mjs.map +1 -1
- package/dist/logger-Db-YRTwK.mjs.map +1 -1
- package/dist/manager-8-JOvuLl.mjs.map +1 -1
- package/dist/multiline-EyzjEwn9.mjs.map +1 -1
- package/dist/node-builtins-DYfhPBnz.mjs.map +1 -1
- package/dist/package-json-C690ceex.mjs.map +1 -1
- package/dist/platform-serialize-DkiTdHOt.mjs.map +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs.map +1 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/{register-ts-hook-z7ggXQy4.mjs → register-ts-hook-CVlI9Jzl.mjs} +57 -57
- package/dist/register-ts-hook-CVlI9Jzl.mjs.map +1 -0
- package/dist/registry-BijIDRVA.mjs.map +1 -1
- package/dist/repl-editor-DGJBfIt1.mjs.map +1 -1
- package/dist/schema-CRtAmDcl.mjs.map +1 -1
- package/dist/secret-file-C9wp_FCX.mjs.map +1 -1
- package/dist/secretmanager-5olfnI1b.mjs.map +1 -1
- package/dist/secretmanager-vHQoXdQz.mjs.map +1 -1
- package/dist/seed/index.mjs.map +1 -1
- package/dist/seed-C3P_T_Eh.mjs.map +1 -1
- package/dist/service-CL1Bp4It.mjs.map +1 -1
- package/dist/{service-DHVuH7-X.mjs → service-DFmt9UJP.mjs} +2 -2
- package/dist/service-DFmt9UJP.mjs.map +1 -0
- package/dist/service_pb-ZClWtj1X.mjs +2 -0
- package/dist/service_pb-ZClWtj1X.mjs.map +1 -0
- package/dist/service_pb-dB3RrGeh.mjs +1 -0
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +83 -1
- package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +7 -1
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +79 -7
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +40 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +119 -2
- package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +7 -0
- package/dist/tailordb-ddl-DqInYupv.mjs.map +1 -1
- package/dist/telemetry-Bklv9kQY.mjs.map +1 -1
- package/dist/type-source--ZNcV8RJ.mjs.map +1 -1
- package/dist/user-agent-vdHYF3QL.mjs.map +1 -1
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/file.d.mts +1 -1
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/wait-point-invoker-eiP-IIux.mjs.map +1 -1
- package/dist/wait-point-registry-B-ESkTZX.mjs.map +1 -1
- package/dist/workflow-Cs9ISw6j.mjs.map +1 -1
- package/dist/{workspace_resource_pb-D2njwgsE.mjs → workspace_resource_pb-CxR_6fyN.mjs} +2 -2
- package/dist/workspace_resource_pb-CxR_6fyN.mjs.map +1 -0
- package/docs/cli/application.md +23 -5
- package/docs/cli/function.md +2 -2
- package/docs/configuration.md +28 -3
- package/docs/github-actions.md +167 -52
- package/docs/migration/v3.md +46 -0
- package/docs/multi-environment.md +3 -1
- package/docs/services/workflow.md +3 -0
- package/package.json +6 -6
- package/dist/application-BE4vehXW.mjs +0 -1
- package/dist/application-BzO9ywXQ.mjs +0 -199
- package/dist/application-BzO9ywXQ.mjs.map +0 -1
- package/dist/errors-C9zGf4nz.mjs +0 -7
- package/dist/errors-C9zGf4nz.mjs.map +0 -1
- package/dist/register-ts-hook-z7ggXQy4.mjs.map +0 -1
- package/dist/service-DHVuH7-X.mjs.map +0 -1
- package/dist/service_pb-DNskuJQC.mjs +0 -1
- package/dist/service_pb-y2GYIgfs.mjs +0 -2
- package/dist/service_pb-y2GYIgfs.mjs.map +0 -1
- package/dist/workspace_resource_pb-D2njwgsE.mjs.map +0 -1
package/docs/cli/application.md
CHANGED
|
@@ -167,12 +167,20 @@ Before applying changes, `deploy` shows a preview of the planned resource change
|
|
|
167
167
|
- `-` means the resource will be deleted
|
|
168
168
|
- `±` means the resource will be replaced
|
|
169
169
|
|
|
170
|
+
An update marked `[forced by SDK version]` shows no configuration difference from what is deployed. It is applied again only because resources of this application were last deployed with a different SDK version.
|
|
171
|
+
|
|
170
172
|
After the detailed list, a summary line is printed:
|
|
171
173
|
|
|
172
174
|
```text
|
|
173
175
|
Plan: 5 to create, 3 to update, 1 to delete
|
|
174
176
|
```
|
|
175
177
|
|
|
178
|
+
When some updates are forced by the SDK version, the summary line also shows how many:
|
|
179
|
+
|
|
180
|
+
```text
|
|
181
|
+
Plan: 0 to create, 12 to update (11 forced by SDK version), 0 to delete
|
|
182
|
+
```
|
|
183
|
+
|
|
176
184
|
Use `--dry-run` to preview the plan without applying anything. In dry-run mode the plan is written to **stdout**, so it can be captured in CI without `2>&1`:
|
|
177
185
|
|
|
178
186
|
```bash
|
|
@@ -189,9 +197,16 @@ Pass the global `--json` / `-j` flag to get machine-readable output.
|
|
|
189
197
|
|
|
190
198
|
```json
|
|
191
199
|
{
|
|
192
|
-
"summary": { "create": 2, "update":
|
|
200
|
+
"summary": { "create": 2, "update": 2, "delete": 0, "replace": 0, "forcedBySdkVersion": 1 },
|
|
193
201
|
"changes": [
|
|
194
|
-
{ "action": "create", "name": "Order", "labels": ["table"], "namespace": "tailordb" }
|
|
202
|
+
{ "action": "create", "name": "Order", "labels": ["table"], "namespace": "tailordb" },
|
|
203
|
+
{
|
|
204
|
+
"action": "update",
|
|
205
|
+
"name": "Customer",
|
|
206
|
+
"labels": ["table"],
|
|
207
|
+
"namespace": "tailordb",
|
|
208
|
+
"forcedBySdkVersion": true
|
|
209
|
+
}
|
|
195
210
|
],
|
|
196
211
|
"warnings": [
|
|
197
212
|
{ "type": "unmanaged", "resourceType": "tailorDB", "name": "LegacyType" },
|
|
@@ -201,15 +216,18 @@ Pass the global `--json` / `-j` flag to get machine-readable output.
|
|
|
201
216
|
}
|
|
202
217
|
```
|
|
203
218
|
|
|
204
|
-
- `summary` — counts of each change type.
|
|
205
|
-
- `changes` — planned resource changes, each with `action`, `name`, and optional `labels` / `namespace`.
|
|
219
|
+
- `summary` — counts of each change type. `forcedBySdkVersion` counts the updates forced by the SDK version, which are also included in `update`.
|
|
220
|
+
- `changes` — planned resource changes, each with `action`, `name`, and optional `labels` / `namespace`. An update forced by the SDK version also has `forcedBySdkVersion: true`.
|
|
206
221
|
- `warnings` — resources not in config (`type: "unmanaged"`) or secrets with missing values (`type: "skippedSecret"`). Unmanaged resources require confirmation in apply mode (apply is cancelled if declined); skipped secrets are non-blocking.
|
|
207
222
|
- `conflicts` — resources owned by another application that conflict with the current config. Require confirmation in apply mode; apply is cancelled if declined.
|
|
208
223
|
|
|
209
224
|
**Apply** (`--json`): writes a JSON object to stdout:
|
|
210
225
|
|
|
211
226
|
```json
|
|
212
|
-
{
|
|
227
|
+
{
|
|
228
|
+
"summary": { "create": 1, "update": 2, "delete": 0, "replace": 0, "forcedBySdkVersion": 0 },
|
|
229
|
+
"status": "applied"
|
|
230
|
+
}
|
|
213
231
|
```
|
|
214
232
|
|
|
215
233
|
## remove
|
package/docs/cli/function.md
CHANGED
|
@@ -129,9 +129,9 @@ $ tailor function logs <execution-id> --follow
|
|
|
129
129
|
|
|
130
130
|
**Notes**
|
|
131
131
|
|
|
132
|
-
Execution details include `logEntries`, the structured log lines (message, severity, timestamp) recorded while the function ran. They are available while the execution is still running
|
|
132
|
+
Execution details include `logEntries`, the structured log lines (message, severity, timestamp) recorded while the function ran. They are available while the execution is still running. The `logs` string joins their messages with newlines.
|
|
133
133
|
|
|
134
|
-
Use `--follow` to keep polling a running execution and print new log entries as they arrive until it completes. Polling continues while the execution is suspended at a wait point, and indefinitely unless `--timeout` is set.
|
|
134
|
+
Use `--follow` to keep polling a running execution and print new log entries as they arrive until it completes. Polling continues while the execution is suspended at a wait point, and indefinitely unless `--timeout` is set. With `--json`, `--follow` waits for completion and then emits the final execution details once.
|
|
135
135
|
|
|
136
136
|
When viewing a specific execution that failed, the command displays error details with the stack trace mapped back to your original source files (clickable file links and code snippets, matching `function run` output).
|
|
137
137
|
|
package/docs/configuration.md
CHANGED
|
@@ -25,8 +25,10 @@ export default defineConfig({
|
|
|
25
25
|
cors: ["https://example.com"],
|
|
26
26
|
allowedIpAddresses: ["192.168.1.0/24"],
|
|
27
27
|
disableIntrospection: false,
|
|
28
|
-
logLevel: process.env.TAILOR_APP_LOG_LEVEL ?? "DEBUG",
|
|
29
28
|
metadata: { "erp-kit-version": "v1-2-3" },
|
|
29
|
+
buildOptions: {
|
|
30
|
+
logLevel: process.env.TAILOR_APP_LOG_LEVEL ?? "DEBUG",
|
|
31
|
+
},
|
|
30
32
|
});
|
|
31
33
|
```
|
|
32
34
|
|
|
@@ -58,12 +60,16 @@ export default defineConfig({
|
|
|
58
60
|
|
|
59
61
|
Entries are only added or overwritten. An entry removed from the config keeps its last deployed value on the platform, and labels the config does not name are left untouched. Because those retained labels count towards the platform's limit of 20 labels per resource, `deploy` reports the overflow and stops before changing the application when the labels it would leave behind exceed that limit. The labels are written when the application itself is deployed, so a config with no TailorDB, Resolver, IdP, or Auth service has no application to carry them.
|
|
60
62
|
|
|
61
|
-
**
|
|
63
|
+
**Build Options**: `buildOptions` groups the settings that control how resolvers, executors, workflow jobs, and other functions are bundled: `logLevel` (below), `inlineSourcemap` (whether bundled functions embed an inline sourcemap for readable error stack traces; default `true`), and `allowedRuntimeGlobals` (see [Node-only globals](#node-only-globals)). The top-level `logLevel` and `inlineSourcemap` fields still work but are deprecated; `tailor upgrade` moves them into `buildOptions`. Setting the same option both at the top level and in `buildOptions` is rejected.
|
|
64
|
+
|
|
65
|
+
**Log Level** (`buildOptions.logLevel`): Controls which `console.*` and `logger.*` (from `@tailor-platform/sdk/runtime`) calls are kept when deployment functions are bundled. Supported values are `"DEBUG"`, `"INFO"`, `"WARN"`, `"ERROR"`, and `"SILENT"`. The default is `"DEBUG"` and keeps all calls. `console.log` is treated as a DEBUG-level call (matching the platform's OpenTelemetry severity mapping), so it is dropped at `"INFO"` and above, alongside `console.debug` and `logger.debug`. `logger.setAttributes` has no severity and is never dropped, regardless of `logLevel`. For production deployments, use `"WARN"` to keep warn/error calls while dropping debug, log, and info calls:
|
|
62
66
|
|
|
63
67
|
```typescript
|
|
64
68
|
export default defineConfig({
|
|
65
69
|
name: "my-app",
|
|
66
|
-
|
|
70
|
+
buildOptions: {
|
|
71
|
+
logLevel: process.env.TAILOR_APP_LOG_LEVEL ?? "DEBUG",
|
|
72
|
+
},
|
|
67
73
|
});
|
|
68
74
|
```
|
|
69
75
|
|
|
@@ -121,6 +127,25 @@ Error [UNRESOLVED_IMPORT]: Could not resolve "@lib/missing" imported from "/path
|
|
|
121
127
|
|
|
122
128
|
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`).
|
|
123
129
|
|
|
130
|
+
#### Node-only globals
|
|
131
|
+
|
|
132
|
+
The Tailor Platform runtime does not define Node-only globals such as `process`, `Buffer`, or `require`. When a bundled resolver, executor, or workflow job references one, the build fails with `FORBIDDEN_RUNTIME_GLOBAL`, naming the global and where it is referenced: the file in your own code, or the installed package (code under `node_modules`). A reference behind a `typeof` check, such as `if (typeof process !== "undefined") { ... }`, is not reported.
|
|
133
|
+
|
|
134
|
+
You cannot change an installed package's code, and it may reference a global only on a code path your use never reaches. When you have confirmed that, allow the reference with `buildOptions.allowedRuntimeGlobals`, keyed by package name. List the globals to allow, or set `true` to allow all of them, including any the package only starts referencing in a later version. Code in that package that does reach the global throws a `ReferenceError` at runtime:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
export default defineConfig({
|
|
138
|
+
name: "my-app",
|
|
139
|
+
buildOptions: {
|
|
140
|
+
allowedRuntimeGlobals: {
|
|
141
|
+
"@ai-sdk/gateway": ["Buffer"],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`buildOptions.allowedRuntimeGlobals` has no effect on your own code. Packages from your own workspace (for example, a pnpm or npm workspace) are bundled from their source directory rather than from `node_modules`, so they count as your own code.
|
|
148
|
+
|
|
124
149
|
### External Resources
|
|
125
150
|
|
|
126
151
|
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.
|
package/docs/github-actions.md
CHANGED
|
@@ -33,9 +33,11 @@ tailor setup ci tag --name my-app-prod \
|
|
|
33
33
|
--branch main --environment production
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
After running the command, follow the **Next steps** printed to the terminal
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
After running the command, follow the **Next steps** printed to the terminal:
|
|
37
|
+
run `tailor setup ci env` to get the commands that set the secrets and
|
|
38
|
+
variables each GitHub Environment needs (see
|
|
39
|
+
[Setting secrets and variables](#setting-secrets-and-variables)), then commit
|
|
40
|
+
the generated files.
|
|
39
41
|
|
|
40
42
|
The generated workflow deploys to whichever workspace its
|
|
41
43
|
`TAILOR_PLATFORM_WORKSPACE_ID` Environment variable points at — it never
|
|
@@ -170,10 +172,13 @@ Because the variable is scoped to a GitHub Environment, both the `plan` and
|
|
|
170
172
|
```
|
|
171
173
|
|
|
172
174
|
2. Set the id as the Environment variable (the environment name is your
|
|
173
|
-
`--environment` value, or the workspace name when omitted)
|
|
175
|
+
`--environment` value, or the workspace name when omitted).
|
|
176
|
+
`tailor setup ci env` prints this command together with the other secrets
|
|
177
|
+
and variables each environment needs (see
|
|
178
|
+
[Setting secrets and variables](#setting-secrets-and-variables)):
|
|
174
179
|
|
|
175
180
|
```bash
|
|
176
|
-
gh variable set TAILOR_PLATFORM_WORKSPACE_ID --env
|
|
181
|
+
gh variable set TAILOR_PLATFORM_WORKSPACE_ID --env=my-app-stg
|
|
177
182
|
```
|
|
178
183
|
|
|
179
184
|
If `TAILOR_PLATFORM_WORKSPACE_ID` is unset, `deploy` fails because the target
|
|
@@ -204,8 +209,9 @@ top-level keys it writes (`name:`, `on:`, and `permissions:` in a workflow; the
|
|
|
204
209
|
metadata, inputs, and outputs of a composite action). Do not edit or rename
|
|
205
210
|
them. Everything else is yours, and re-running `setup` keeps it:
|
|
206
211
|
|
|
207
|
-
- **Your own jobs and steps.** Add them anywhere,
|
|
208
|
-
|
|
212
|
+
- **Your own jobs and steps.** Add them anywhere, with an `id` (if any) that
|
|
213
|
+
does not start with `tailor-`: the prefix is reserved for the SDK, even in a
|
|
214
|
+
job of your own. A step you add inside a managed job stays right after the managed step it
|
|
209
215
|
followed. For example, add private registry authentication or a system
|
|
210
216
|
dependency _before_ the managed `tailor-setup` step, and post-install extras
|
|
211
217
|
(such as `playwright install`) _after_ it. A job of your own can depend on a
|
|
@@ -218,25 +224,63 @@ them. Everything else is yours, and re-running `setup` keeps it:
|
|
|
218
224
|
`install-command` on `tailor-install`, `node-version-file` on
|
|
219
225
|
`tailor-setup`, `label` on `tailor-plan`, and `user-mapping` on
|
|
220
226
|
`tailor-notify` and on a coordinator's steps that call an app action.
|
|
221
|
-
- **The `run:` command of the `build-site` step** in a composite action.
|
|
227
|
+
- **The `run:` command of the `tailor-build-site` step** in a composite action.
|
|
228
|
+
|
|
229
|
+
In a preview workflow, the `tailor-preview-deploy` job exposes the per-PR
|
|
230
|
+
workspace as the outputs `workspace-id`, `workspace-name`, and `app-url`, so a
|
|
231
|
+
job of your own can run tests or deploy extra assets against it:
|
|
232
|
+
|
|
233
|
+
```yaml
|
|
234
|
+
deploy-assets:
|
|
235
|
+
needs: tailor-preview-deploy
|
|
236
|
+
runs-on: ubuntu-latest
|
|
237
|
+
environment: my-app
|
|
238
|
+
env:
|
|
239
|
+
TAILOR_PLATFORM_WORKSPACE_ID: ${{ needs.tailor-preview-deploy.outputs.workspace-id }}
|
|
240
|
+
TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}
|
|
241
|
+
TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}
|
|
242
|
+
steps:
|
|
243
|
+
# checkout, dependency installation, and your tailor commands
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
A job that runs `tailor` against the workspace needs the machine-user
|
|
247
|
+
[secrets](#secrets), so it declares the preview target's GitHub Environment
|
|
248
|
+
(the `--environment` value, or the workspace name when omitted) as above. A job
|
|
249
|
+
that only uses `app-url`, such as end-to-end tests, does not.
|
|
250
|
+
|
|
251
|
+
The job is skipped whenever `tailor-preview-deploy` is skipped: when a pull
|
|
252
|
+
request is closed, for draft and fork pull requests, and for unlabeled ones with
|
|
253
|
+
`--require-preview-label`.
|
|
254
|
+
|
|
255
|
+
Likewise, the `tailor-deploy` job of a branch or tag workflow exposes the
|
|
256
|
+
deployed workspace as the outputs `workspace-id` and `app-url` to a job with
|
|
257
|
+
`needs: tailor-deploy`. Reading them does not require the target's GitHub
|
|
258
|
+
Environment; a job that runs `tailor` against the workspace declares it for the
|
|
259
|
+
machine-user secrets, as in the preview example above.
|
|
222
260
|
|
|
223
261
|
Comments above your own jobs and steps and at the end of the file are kept too.
|
|
224
262
|
Comments inside managed jobs and steps, and edits to the header comment, are
|
|
225
263
|
not kept.
|
|
226
264
|
|
|
227
265
|
`setup check` reports an edit to a managed part, and re-running `setup` stops
|
|
228
|
-
on it
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
266
|
+
on it; both name the edited job, step, or top-level key. Revert the edit, or
|
|
267
|
+
pass `--force` to reset the managed parts to the current template; `--force`
|
|
268
|
+
still keeps your own jobs, steps, and settings. A managed step you renamed to
|
|
269
|
+
an id without the `tailor-` prefix counts as your own, so `--force` adds the
|
|
270
|
+
managed one back next to it; rename it back instead of forcing. A managed job
|
|
271
|
+
you renamed still holds the SDK's `tailor-` steps, so `setup check` reports
|
|
272
|
+
them as reserved ids and `setup` stops on them, even with `--force`; rename the
|
|
273
|
+
job back. To start over from a clean template, delete the file and re-run
|
|
274
|
+
`setup`.
|
|
233
275
|
|
|
234
276
|
When a template update removes a managed job that contains steps of yours, or
|
|
235
277
|
a job of yours `needs` a removed job, `setup` stops and names them. Move those
|
|
236
278
|
steps into a job of your own (or update the `needs`) and re-run. `--force` drops
|
|
237
|
-
steps left inside a removed job.
|
|
238
|
-
|
|
239
|
-
|
|
279
|
+
steps left inside a removed job.
|
|
280
|
+
|
|
281
|
+
`setup check` reports a job or step of yours whose `id` starts with `tailor-`,
|
|
282
|
+
and re-running `setup` stops on it, naming the id. Rename it; `--force` does
|
|
283
|
+
not rename or remove it.
|
|
240
284
|
|
|
241
285
|
Files generated by an older SDK version are compared as a whole, so the first
|
|
242
286
|
re-run after upgrading stops if you edited the file in any way. Re-run once with
|
|
@@ -296,7 +340,8 @@ the move.
|
|
|
296
340
|
|
|
297
341
|
## Secrets
|
|
298
342
|
|
|
299
|
-
The generated workflow
|
|
343
|
+
The generated workflow requires two secrets (the optional Slack token is listed in
|
|
344
|
+
[Setting secrets and variables](#setting-secrets-and-variables)):
|
|
300
345
|
|
|
301
346
|
| Secret | Description |
|
|
302
347
|
| -------------------------------------------- | -------------------------- |
|
|
@@ -304,12 +349,8 @@ The generated workflow reads two secrets:
|
|
|
304
349
|
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` | Machine user client secret |
|
|
305
350
|
|
|
306
351
|
Set them on the target GitHub Environment (the `--environment` value, or the
|
|
307
|
-
workspace name when omitted)
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
gh secret set TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID --env my-app-stg
|
|
311
|
-
gh secret set TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET --env my-app-stg
|
|
312
|
-
```
|
|
352
|
+
workspace name when omitted); `tailor setup ci env` prints the commands (see
|
|
353
|
+
[Setting secrets and variables](#setting-secrets-and-variables)).
|
|
313
354
|
|
|
314
355
|
Setting them at the environment level isolates each target's credentials and
|
|
315
356
|
keeps them alongside that environment's `TAILOR_PLATFORM_WORKSPACE_ID`
|
|
@@ -317,6 +358,62 @@ variable. You can also set them as repository-level secrets if every target
|
|
|
317
358
|
shares one machine user, but then any workflow on any branch can read them, so
|
|
318
359
|
the environment's protection rules no longer guard your deploys.
|
|
319
360
|
|
|
361
|
+
### Setting secrets and variables
|
|
362
|
+
|
|
363
|
+
`tailor setup ci env` reads `.github/tailor.lock` and prints, for every GitHub
|
|
364
|
+
Environment the generated workflows use, the commands that create the
|
|
365
|
+
environment (only when it does not exist yet) and set its secrets and
|
|
366
|
+
variables. It is read-only, so re-run it whenever you add a target. When the
|
|
367
|
+
`origin` remote points at github.com, the output names that repository, so the
|
|
368
|
+
commands work from any directory; otherwise `gh` resolves the repository from
|
|
369
|
+
the current directory and the Terraform output leaves it as a placeholder.
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
tailor setup ci env # gh CLI commands (default)
|
|
373
|
+
tailor setup ci env --format terraform # Terraform for the integrations/github provider
|
|
374
|
+
tailor setup ci env --environment my-app-stg # only one environment (repeat for several)
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
The list follows what each generated workflow actually reads:
|
|
378
|
+
|
|
379
|
+
| Name | Kind | Targets | Required | Where the value comes from |
|
|
380
|
+
| -------------------------------------------- | -------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
381
|
+
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` | secret | all | yes | Client ID of the platform machine user CI signs in as; it needs an editor or admin role on the organization or folder that holds the workspace. Contact [Tailor support](https://docs.tailor.tech/administration/support) to get one |
|
|
382
|
+
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` | secret | all | yes | Client secret of the same platform machine user |
|
|
383
|
+
| `TAILOR_PLATFORM_WORKSPACE_ID` | variable | branch, tag, coordinate | yes | `id` printed by `tailor workspace create`, or listed by `tailor workspace list` |
|
|
384
|
+
| `TAILOR_PLATFORM_ORGANIZATION_ID` | variable | preview | yes | Organization to create the per-PR workspaces in (a machine user cannot create a workspace without one): `organizationId` listed by `tailor organization list` |
|
|
385
|
+
| `TAILOR_PLATFORM_FOLDER_ID` | variable | preview | no | Folder to create the per-PR workspaces in: `id` listed by `tailor organization folder list -o <organization id>`. When unset they go directly under the organization, which needs the machine user's role on the organization itself |
|
|
386
|
+
| `TAILOR_PLATFORM_FAIL_ON_DRIFT` | variable | all | no | `true` to fail the drift check when it finds drift |
|
|
387
|
+
| `TAILOR_SLACK_BOT_TOKEN` | secret | branch, tag, coordinate | no | Bot User OAuth Token (`xoxb-...`) of a Slack app with the `chat:write` scope |
|
|
388
|
+
| `TAILOR_SLACK_CHANNEL_ID` | variable | branch, tag, coordinate | no | Channel ID (`C...`) from the channel details in Slack; invite the bot to the channel |
|
|
389
|
+
| `TAILOR_SLACK_USER_MAPPING` | variable | branch, tag | no | JSON object mapping GitHub usernames to Slack member IDs (for example `{"alice":"U0123456"}`) so notifications mention the actor; read only after you uncomment the `user-mapping` input of the `tailor-notify` step |
|
|
390
|
+
|
|
391
|
+
See [Account management](https://docs.tailor.tech/administration/account-management)
|
|
392
|
+
for how organizations, folders, workspaces, and machine users relate.
|
|
393
|
+
|
|
394
|
+
Composite actions (`setup ci action`) read nothing themselves; the coordinator
|
|
395
|
+
that calls them does. Set `TAILOR_SLACK_BOT_TOKEN` and `TAILOR_SLACK_CHANNEL_ID`
|
|
396
|
+
together to enable Slack deploy notifications.
|
|
397
|
+
|
|
398
|
+
The `gh` output creates an environment only when GitHub reports it missing and
|
|
399
|
+
leaves optional entries commented out. Run the commands one at a time: each
|
|
400
|
+
`gh secret set` / `gh variable set` prompts for its value.
|
|
401
|
+
|
|
402
|
+
The Terraform output takes every value from an input variable (secrets are
|
|
403
|
+
`sensitive`) and creates an optional entry only when its variable is set, so no
|
|
404
|
+
value is written to the output. Terraform still stores the secret values in its
|
|
405
|
+
state in plain text, so keep the state encrypted and access-restricted, or set
|
|
406
|
+
the secrets with the `gh` output instead. Its header lists the steps with the variable
|
|
407
|
+
names for your environments: authenticate the provider, put non-secret values in
|
|
408
|
+
`terraform.tfvars`, pass secrets as `TF_VAR_<name>` environment variables, and
|
|
409
|
+
import each environment and variable that already exists (for example
|
|
410
|
+
`terraform import github_repository_environment.production my-repo:production`)
|
|
411
|
+
before `terraform apply`: creating a variable that already exists fails, while
|
|
412
|
+
secrets are overwritten. The generated environments ignore changes to their
|
|
413
|
+
protection settings (reviewers, wait timer, branch policy), so importing an
|
|
414
|
+
environment keeps the approval gate you configured; remove the `lifecycle` block
|
|
415
|
+
to manage those settings in Terraform instead.
|
|
416
|
+
|
|
320
417
|
## GitHub Environments (approval gate)
|
|
321
418
|
|
|
322
419
|
Both the `plan` and `deploy` jobs are associated with a GitHub Environment — the
|
|
@@ -453,18 +550,13 @@ tailor setup ci tag --name my-app-prod \
|
|
|
453
550
|
--branch main --environment production
|
|
454
551
|
```
|
|
455
552
|
|
|
456
|
-
Then provision each workspace and set its id
|
|
457
|
-
staging target's environment defaults to
|
|
458
|
-
`production`)
|
|
553
|
+
Then provision each workspace and set its id and the machine-user credentials
|
|
554
|
+
on the matching environment (the staging target's environment defaults to
|
|
555
|
+
`my-app-stg`; production uses `production`). `tailor setup ci env` prints the
|
|
556
|
+
commands for both environments:
|
|
459
557
|
|
|
460
558
|
```bash
|
|
461
|
-
|
|
462
|
-
gh secret set TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID --env my-app-stg
|
|
463
|
-
gh secret set TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET --env my-app-stg
|
|
464
|
-
|
|
465
|
-
gh variable set TAILOR_PLATFORM_WORKSPACE_ID --env production
|
|
466
|
-
gh secret set TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID --env production
|
|
467
|
-
gh secret set TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET --env production
|
|
559
|
+
tailor setup ci env
|
|
468
560
|
```
|
|
469
561
|
|
|
470
562
|
Commit both workflow files and `.github/tailor.lock`.
|
|
@@ -502,19 +594,21 @@ them. To remove it, delete the file.
|
|
|
502
594
|
|
|
503
595
|
Renovate updates the SDK dependency and action pins, but it does not regenerate
|
|
504
596
|
the workflow template. After an SDK update, `tailor setup check` reports a
|
|
505
|
-
template-version warning until you
|
|
506
|
-
|
|
597
|
+
template-version warning until you run
|
|
598
|
+
[`tailor setup update`](#updating-the-generated-workflow).
|
|
507
599
|
|
|
508
600
|
## Checking for drift
|
|
509
601
|
|
|
510
602
|
`tailor setup check` audits the workflows recorded in
|
|
511
603
|
`.github/tailor.lock` against your current config and repository, without
|
|
512
604
|
writing anything. It reports when a workflow file is missing or its SDK-managed
|
|
513
|
-
parts were edited by hand, a
|
|
514
|
-
newer template is available, `tailor.config.ts` is no longer under the recorded
|
|
605
|
+
parts were edited by hand, a job or step of yours uses the reserved `tailor-`
|
|
606
|
+
prefix, a newer template is available, `tailor.config.ts` is no longer under the recorded
|
|
515
607
|
`--dir`, or the repository default branch no longer matches a branch target's
|
|
516
608
|
trigger. It exits non-zero when it finds drift, so you can run it in CI. Each
|
|
517
|
-
finding names a stable rule key for future suppression.
|
|
609
|
+
finding names a stable rule key for future suppression. Run
|
|
610
|
+
[`tailor setup update`](#updating-the-generated-workflow) to regenerate the
|
|
611
|
+
targets it reports.
|
|
518
612
|
|
|
519
613
|
Workflows generated by `setup ci branch`, `setup ci tag`, `setup ci preview`, and
|
|
520
614
|
`setup ci coordinate` self-audit: each contains a `tailor-drift-check` step that
|
|
@@ -529,21 +623,42 @@ Drift findings are advisory by default. Set the repository variable
|
|
|
529
623
|
`TAILOR_PLATFORM_FAIL_ON_DRIFT` to `true` to make unsuppressed findings fail
|
|
530
624
|
the job. Execution and configuration errors fail regardless of this variable.
|
|
531
625
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
verification there, since the deploy job resolves the Environment variable
|
|
537
|
-
itself at runtime.
|
|
626
|
+
`check` compares only the generated files, `.github/tailor.lock`, and the
|
|
627
|
+
config; it does not read the GitHub Environment secrets and variables, so it
|
|
628
|
+
runs the same on your own machine and in CI. Run `tailor setup ci env` to list
|
|
629
|
+
what each environment needs.
|
|
538
630
|
|
|
539
631
|
## Updating the generated workflow
|
|
540
632
|
|
|
541
|
-
When you upgrade the SDK,
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
633
|
+
When you upgrade the SDK, run `tailor setup update` from the repository root to
|
|
634
|
+
pick up template improvements:
|
|
635
|
+
|
|
636
|
+
```bash
|
|
637
|
+
tailor setup update
|
|
638
|
+
```
|
|
547
639
|
|
|
548
|
-
|
|
549
|
-
|
|
640
|
+
It regenerates every workflow and composite action recorded in
|
|
641
|
+
`.github/tailor.lock` with the flags each one was generated with, so you do not
|
|
642
|
+
have to re-type `setup ci branch`, `setup ci tag`, and the rest one by one.
|
|
643
|
+
Your own jobs, steps, and settings are kept (see
|
|
644
|
+
[Customizing the generated workflow](#customizing-the-generated-workflow)). A
|
|
645
|
+
branch that was detected from the repository default branch is detected again,
|
|
646
|
+
and the parts that follow your config — the migration drift check, seed
|
|
647
|
+
validation, static website builds, and ERD preview namespaces — are derived
|
|
648
|
+
from the current `tailor.config.ts`.
|
|
649
|
+
|
|
650
|
+
A target that cannot be regenerated, for example because you edited a managed
|
|
651
|
+
part, does not stop the others: `update` regenerates the rest, then lists the
|
|
652
|
+
targets it could not update and exits non-zero. Revert the edit, or run
|
|
653
|
+
`tailor setup update --force` to reset the managed parts of every target.
|
|
654
|
+
|
|
655
|
+
Coordinators generated by an older plugin version did not record how their
|
|
656
|
+
`--action` values were grouped, so `update` lists them instead of guessing
|
|
657
|
+
which apps deploy together. Re-run `tailor setup ci coordinate` once with all
|
|
658
|
+
of its original flags and its original `--action` groups. The message `update`
|
|
659
|
+
prints fills in the recorded flags (`--tag`, `--branch`, `--environment`,
|
|
660
|
+
`--restrict-dispatch`), so you only add the `--action` values. Later updates
|
|
661
|
+
pick the grouping up from the lock.
|
|
662
|
+
|
|
663
|
+
To change a flag for one target, re-run its `setup ci` subcommand with the new
|
|
664
|
+
flags. `.github/tailor.lock` records them, and later updates reuse them.
|
package/docs/migration/v3.md
CHANGED
|
@@ -128,6 +128,52 @@ property, which is the relation's cardinality (e.g. "n-1", "1-1",
|
|
|
128
128
|
|
|
129
129
|
</details>
|
|
130
130
|
|
|
131
|
+
## defineConfig inlineSourcemap / logLevel → buildOptions
|
|
132
|
+
|
|
133
|
+
**Migration:** Partially automatic
|
|
134
|
+
|
|
135
|
+
Move the top-level `inlineSourcemap` and `logLevel` of `defineConfig()` into `buildOptions`, which groups the settings that control how functions are bundled. The top-level fields keep working until they are removed in v3; setting the same option in both places is rejected.
|
|
136
|
+
|
|
137
|
+
Before:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
export default defineConfig({
|
|
141
|
+
name: "my-app",
|
|
142
|
+
inlineSourcemap: false,
|
|
143
|
+
logLevel: "WARN",
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
After:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
export default defineConfig({
|
|
151
|
+
name: "my-app",
|
|
152
|
+
buildOptions: {
|
|
153
|
+
inlineSourcemap: false,
|
|
154
|
+
logLevel: "WARN",
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
<details>
|
|
160
|
+
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
161
|
+
|
|
162
|
+
```text
|
|
163
|
+
In Tailor SDK v3, the top-level `inlineSourcemap` and `logLevel` options of
|
|
164
|
+
`defineConfig()` from `@tailor-platform/sdk` are removed in favor of
|
|
165
|
+
`buildOptions.inlineSourcemap` and `buildOptions.logLevel`. For each flagged
|
|
166
|
+
config, move those two properties into a `buildOptions` object (create it if
|
|
167
|
+
it does not exist) without changing their values. When the config is built
|
|
168
|
+
from a variable or a spread, move them in the object that actually defines
|
|
169
|
+
them. If an option is set both at the top level and in `buildOptions`, keep
|
|
170
|
+
the value that the deployed app should use and delete the other; the build
|
|
171
|
+
rejects a config that sets both. Leave `logLevel` options of other tools
|
|
172
|
+
(for example a Vite or Vitest config) unchanged.
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
</details>
|
|
176
|
+
|
|
131
177
|
## String file uploads → explicit encoding
|
|
132
178
|
|
|
133
179
|
**Migration:** Manual
|
|
@@ -64,7 +64,9 @@ tailor deploy -w <production-workspace-id> --env-file .env.production
|
|
|
64
64
|
```typescript
|
|
65
65
|
export default defineConfig({
|
|
66
66
|
name: "my-app",
|
|
67
|
-
|
|
67
|
+
buildOptions: {
|
|
68
|
+
logLevel: process.env.TAILOR_APP_LOG_LEVEL ?? "DEBUG",
|
|
69
|
+
},
|
|
68
70
|
});
|
|
69
71
|
```
|
|
70
72
|
|
|
@@ -516,6 +516,9 @@ You can start a workflow execution from a resolver using `workflow.start()`.
|
|
|
516
516
|
|
|
517
517
|
- `workflow.start(args, options?)` returns a workflow run ID (`Promise<string>`).
|
|
518
518
|
- To run with machine-user permissions, pass `{ invoker: "<machine-user>" }`. The name is type-narrowed to the machine users defined in your auth config.
|
|
519
|
+
- Import the workflow from its workflow file with a default import (or a namespace import, calling `wf.default.start(...)`), using a relative path or a `tsconfig.json` `paths` alias. The build replaces the `.start()` call with a platform call, so it has to recognize the workflow: export it as the file's default export — either `createWorkflow({ name: "..." })` itself or the result of a helper function that calls `createWorkflow()`.
|
|
520
|
+
- Call `.start()` directly on the imported name (`orderProcessingWorkflow.start(...)`, or `wf.default.start(...)` for a namespace import). If you first assign the workflow to another variable (`const wf = orderProcessingWorkflow; wf.start(...)`) or pass it to a function, the call is neither rewritten nor checked, and fails at runtime.
|
|
521
|
+
- If a `.start()` call is made on an export of a workflow file that the build cannot recognize as a workflow or job defined that way, the build fails. A `.start()` on a workflow imported from anywhere other than a workflow file (for example re-exported from a shared package) cannot be checked, and fails at runtime.
|
|
519
522
|
|
|
520
523
|
```typescript
|
|
521
524
|
import { createResolver, t } from "@tailor-platform/sdk";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -166,8 +166,8 @@
|
|
|
166
166
|
"@opentelemetry/semantic-conventions": "1.43.0",
|
|
167
167
|
"@oxc-project/types": "0.151.0",
|
|
168
168
|
"@politty/zod": "0.3.0",
|
|
169
|
-
"@secretlint/core": "13.0.
|
|
170
|
-
"@secretlint/secretlint-rule-preset-recommend": "13.0.
|
|
169
|
+
"@secretlint/core": "13.0.6",
|
|
170
|
+
"@secretlint/secretlint-rule-preset-recommend": "13.0.6",
|
|
171
171
|
"@standard-schema/spec": "1.1.0",
|
|
172
172
|
"@tailor-platform/function-kysely-tailordb": "0.1.3",
|
|
173
173
|
"@toiroakr/lines-db": "0.13.0",
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
"pathe": "2.0.3",
|
|
192
192
|
"pgsql-ast-parser": "12.0.2",
|
|
193
193
|
"pkg-types": "2.3.3",
|
|
194
|
-
"rolldown": "1.2.
|
|
194
|
+
"rolldown": "1.2.11",
|
|
195
195
|
"semver": "7.8.5",
|
|
196
196
|
"sql-highlight": "6.1.0",
|
|
197
197
|
"std-env": "4.2.0",
|
|
@@ -208,14 +208,14 @@
|
|
|
208
208
|
"@tailor-platform/shared": "^0.0.0",
|
|
209
209
|
"@tailor-platform/tailor-proto": "^0.0.1",
|
|
210
210
|
"@types/mime-types": "3.0.1",
|
|
211
|
-
"@types/node": "24.
|
|
211
|
+
"@types/node": "24.19.0",
|
|
212
212
|
"@types/semver": "7.8.0",
|
|
213
213
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
214
214
|
"@vitest/coverage-v8": "5.0.1",
|
|
215
215
|
"eslint-plugin-zod": "4.14.2",
|
|
216
216
|
"oxfmt": "0.70.0",
|
|
217
217
|
"oxlint": "1.85.0",
|
|
218
|
-
"oxlint-tsgolint": "7.0.
|
|
218
|
+
"oxlint-tsgolint": "7.0.2003",
|
|
219
219
|
"sonda": "0.14.0",
|
|
220
220
|
"tsdown": "0.23.0",
|
|
221
221
|
"typescript": "6.0.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./application-BzO9ywXQ.mjs";export{t as defineApplication,e as generatePluginFilesIfNeeded};
|