@tailor-platform/sdk 2.23.0 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/dist/application-ChqHuhZW.mjs +1 -0
  3. package/dist/application-DS0XKBtK.mjs +200 -0
  4. package/dist/application-DS0XKBtK.mjs.map +1 -0
  5. package/dist/cli/cache/bundle-cache.d.mts +1 -0
  6. package/dist/cli/commands/deploy/deployment-target.d.mts +1 -0
  7. package/dist/cli/commands/machineuser/list.d.mts +1 -0
  8. package/dist/cli/commands/show.d.mts +13 -1
  9. package/dist/cli/lib.d.mts +2 -2
  10. package/dist/cli/lib.mjs +1 -1
  11. package/dist/cli/lib.mjs.map +1 -1
  12. package/dist/cli/main.mjs +43 -43
  13. package/dist/cli/main.mjs.map +1 -1
  14. package/dist/cli/services/application.d.mts +1 -0
  15. package/dist/cli/services/workflow/bundler.d.mts +2 -1
  16. package/dist/cli/shared/forbidden-runtime-globals.d.mts +1 -0
  17. package/dist/cli/shared/start-context.d.mts +1 -0
  18. package/dist/cli/ts-hook.mjs +3 -3
  19. package/dist/completion/zsh-worker.zsh +3 -3
  20. package/dist/configure/config/types.d.mts +42 -2
  21. package/dist/configure/index.d.mts +2 -2
  22. package/dist/configure/index.mjs +1 -1
  23. package/dist/configure/index.mjs.map +1 -1
  24. package/dist/plugin/index.mjs +1 -1
  25. package/dist/plugin/index.mjs.map +1 -1
  26. package/dist/plugin/types.d.mts +97 -0
  27. package/dist/register-ts-hook-DPAW0Z4M.mjs +924 -0
  28. package/dist/register-ts-hook-DPAW0Z4M.mjs.map +1 -0
  29. package/dist/vitest/mocks/file.d.mts +1 -1
  30. package/docs/cli/application.md +23 -0
  31. package/docs/cli/secret.md +24 -16
  32. package/docs/cli-reference.md +25 -13
  33. package/docs/configuration.md +28 -3
  34. package/docs/github-actions.md +236 -56
  35. package/docs/migration/v3.md +46 -0
  36. package/docs/multi-environment.md +3 -1
  37. package/docs/plugin/custom.md +76 -1
  38. package/docs/plugin/frontend.md +124 -0
  39. package/docs/plugin/index.md +24 -2
  40. package/docs/services/auth.md +2 -0
  41. package/docs/services/secret.md +5 -4
  42. package/docs/services/staticwebsite.md +2 -0
  43. package/docs/services/tailordb-migration.md +1 -1
  44. package/docs/services/workflow.md +3 -0
  45. package/package.json +8 -8
  46. package/dist/application-BtZ8hmx9.mjs +0 -1
  47. package/dist/application-m2G91kKI.mjs +0 -199
  48. package/dist/application-m2G91kKI.mjs.map +0 -1
  49. package/dist/register-ts-hook-ztnEFW6n.mjs +0 -922
  50. package/dist/register-ts-hook-ztnEFW6n.mjs.map +0 -1
@@ -46,9 +46,9 @@ export declare function mockFile(options?: MockFileOptions): {
46
46
  calls: FileCall[];
47
47
  clear(): void;
48
48
  reset(): void;
49
+ delete: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise<void>>;
49
50
  download: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise<FileDownloadResponse>>;
50
51
  downloadAsBase64: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise<FileDownloadAsBase64Response>>;
51
- delete: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise<void>>;
52
52
  getMetadata: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise<FileMetadata>>;
53
53
  downloadStream: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string) => Promise<FileDownloadStreamResponse>>;
54
54
  uploadStream: Mock<(namespace: string, tableName: string, fieldName: string, recordId: string, readableStream: ReadableStream<Uint8Array | ArrayBuffer>, options?: FileUploadStreamOptions) => Promise<FileUploadResponse>>;
@@ -74,6 +74,29 @@ tailor deploy [options]
74
74
  | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
75
75
 
76
76
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
77
+ **JSON result:**
78
+
79
+ After a successful `tailor deploy --json`, stdout includes `status: "applied"`,
80
+ `summary`, `workspaceId`, and `applications` in config order. Each entry includes
81
+ the config's `name`, `configPath`, and, when configured, `id`, plus `aiGateways`
82
+ and `staticWebsites` keyed by site name. Endpoint `url` and `domain` are included
83
+ when a Platform Application with that name exists. If Auth is configured, `auth`
84
+ includes its `namespace` and `oauth2Clients` with each client's `name` and public `clientId`.
85
+ Client secrets are excluded. These fields are returned even when no deploy plugin
86
+ is registered or no resources changed.
87
+
88
+ Plugins that return outputs add entries under `deployedHooks`. For example, the
89
+ frontend plugin provides upload results in `deployedHooks[].outputs.frontends`.
90
+
91
+ ```sh
92
+ tailor deploy --json > deploy-result.json
93
+ jq '.applications[] | {name, url, staticWebsites, auth}' deploy-result.json
94
+ ```
95
+
96
+ Dry-run and build-only deployments do not return deployed application information.
97
+ If resources were applied but loading the JSON result fails, the command reports
98
+ `DEPLOY_RESULT_LOAD_FAILED`; fix the error and run `tailor deploy` again.
99
+
77
100
  **Workspace Selection:**
78
101
 
79
102
  After validating the configuration file, `deploy` resolves a workspace before bundling the
@@ -36,17 +36,21 @@ tailor secret create [options]
36
36
 
37
37
  **Options**
38
38
 
39
- | Option | Alias | Description | Required | Default | Env |
40
- | ------------------------------- | ----- | ------------------------- | -------- | ------- | ------------------------------ |
41
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
42
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
43
- | `--vault-name <VAULT_NAME>` | `-V` | Vault name | Yes | - | - |
44
- | `--name <NAME>` | `-n` | Secret name | Yes | - | - |
45
- | `--value <VALUE>` | `-v` | Secret value | Yes | - | - |
46
- | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
39
+ | Option | Alias | Description | Required | Default | Env |
40
+ | ------------------------------- | ----- | ---------------------------------------------------- | -------- | ------- | ------------------------------ |
41
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
42
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
43
+ | `--vault-name <VAULT_NAME>` | `-V` | Vault name | Yes | - | - |
44
+ | `--name <NAME>` | `-n` | Secret name | Yes | - | - |
45
+ | `--value <VALUE>` | `-v` | Secret value (read from standard input when omitted) | No | - | - |
46
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
47
47
 
48
48
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
49
49
 
50
+ **Notes**
51
+
52
+ Pass the value with `--value`, or omit `--value` and pipe the value in to keep it out of shell history and process listings, for example `printf '%s' "$STRIPE_KEY" | tailor secret create --vault-name api-keys --name stripe-secret-key`. A piped value can be up to 128 KiB, and one trailing newline is removed from it. In a vault managed by `defineSecretManager()`, the command asks for confirmation before releasing the vault from the config, which needs an interactive terminal, so pass `--yes` when piping the value.
53
+
50
54
  ### secret delete
51
55
 
52
56
  Delete a secret in a vault.
@@ -103,17 +107,21 @@ tailor secret update [options]
103
107
 
104
108
  **Options**
105
109
 
106
- | Option | Alias | Description | Required | Default | Env |
107
- | ------------------------------- | ----- | ------------------------- | -------- | ------- | ------------------------------ |
108
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
109
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
110
- | `--vault-name <VAULT_NAME>` | `-V` | Vault name | Yes | - | - |
111
- | `--name <NAME>` | `-n` | Secret name | Yes | - | - |
112
- | `--value <VALUE>` | `-v` | Secret value | Yes | - | - |
113
- | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
110
+ | Option | Alias | Description | Required | Default | Env |
111
+ | ------------------------------- | ----- | ---------------------------------------------------- | -------- | ------- | ------------------------------ |
112
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
113
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
114
+ | `--vault-name <VAULT_NAME>` | `-V` | Vault name | Yes | - | - |
115
+ | `--name <NAME>` | `-n` | Secret name | Yes | - | - |
116
+ | `--value <VALUE>` | `-v` | Secret value (read from standard input when omitted) | No | - | - |
117
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
114
118
 
115
119
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
116
120
 
121
+ **Notes**
122
+
123
+ Pass the value with `--value`, or omit `--value` and pipe the value in to keep it out of shell history and process listings, for example `printf '%s' "$STRIPE_KEY" | tailor secret update --vault-name api-keys --name stripe-secret-key`. A piped value can be up to 128 KiB, and one trailing newline is removed from it. In a vault managed by `defineSecretManager()`, the command asks for confirmation before releasing the vault from the config, which needs an interactive terminal, so pass `--yes` when piping the value.
124
+
117
125
  ### secret vault
118
126
 
119
127
  Manage Secret Manager vaults.
@@ -31,8 +31,16 @@ For commands that return structured results, passing `--json` writes one parseab
31
31
  to stdout on success. Empty successful result sets are emitted as JSON values such as `[]`, not as
32
32
  human-readable text or empty stdout.
33
33
 
34
- Commands that only perform side effects and do not define a structured result may leave stdout empty
35
- even when `--json` is passed.
34
+ Many commands that change state print a JSON object describing the outcome. Its `changed` field is
35
+ `true` when the command did work and `false` when it did nothing, for example because the requested
36
+ state was already in place. The other fields identify what the command acted on and report details of
37
+ the outcome. Other state-changing commands print a result without `changed`, or do not report a
38
+ result yet and leave stdout empty even when `--json` is passed.
39
+
40
+ List commands return at most `--limit` items. When more exist, the list is followed by a notice on
41
+ stderr, `More results exist beyond --limit N. Raise --limit to see more.`, so `--json` output stays a
42
+ plain array of the listed items. Log listings such as `executor jobs`, `function logs`, and
43
+ `workflow executions` default to `--limit 50`; pass `--limit 0` to list everything.
36
44
 
37
45
  Set `TAILOR_JSON_OUTPUT=true` (or `1`) to default every command to JSON without passing `--json`
38
46
  each time. This is intended for agents, scripts, and CI steps that parse CLI output. An explicit
@@ -42,11 +50,13 @@ keep table output. Other values are rejected. JSON mode also disables interactiv
42
50
  variable per invocation or per job rather than exporting it from a shell profile; a command that
43
51
  needed a prompt names what selected JSON when it refuses.
44
52
 
45
- Errors, warnings, progress, and diagnostic messages are written to stderr. After argument parsing,
46
- a command failure under `--json` emits a JSON error envelope to stderr. Failures you can act on — an
47
- invalid or missing option, a resource that does not exist, an invalid configuration, or an unmet
48
- precondition — carry a stable `error.code` such as `PROFILE_NOT_FOUND`, `TAILORDB_NAMESPACE_NOT_FOUND`,
49
- or `MIGRATION_SCRIPT_REQUIRED`. Where a remediation exists, the envelope also includes
53
+ Errors, warnings, progress, and diagnostic messages are written to stderr. A command failure under
54
+ `--json` or `TAILOR_JSON_OUTPUT` emits a JSON error envelope to stderr, including a failure while
55
+ parsing arguments: an unknown option or subcommand, or an option value that fails validation, is
56
+ reported as `INVALID_ARGUMENTS`. Failures you can act on — an invalid or missing option, a resource
57
+ that does not exist, an invalid configuration, or an unmet precondition — carry a stable `error.code`
58
+ such as `PROFILE_NOT_FOUND`, `TAILORDB_NAMESPACE_NOT_FOUND`, or `MIGRATION_SCRIPT_REQUIRED`. Where a
59
+ remediation exists, the envelope also includes
50
60
  `error.suggestion`, `error.help` (the `--help` invocation for the failing command), `error.next` (a
51
61
  runnable command), or `error.context`. `UNEXPECTED_ERROR` marks failures without a dedicated code,
52
62
  including SDK-internal errors. Diagnostic lines may precede the error envelope, and stdout is not
@@ -75,9 +85,11 @@ Use `--verbose` to include debug diagnostics and error stack traces. `DEBUG=true
75
85
  sets `RUNNER_DEBUG=1` when debug logging is enabled, so the same command automatically includes
76
86
  these details in a debug run. These settings do not enable JSON output; pass `--json` separately.
77
87
 
78
- Capture the original failure's stderr and exit code before retrying. Argument parsing and failures
79
- before the CLI starts may produce plain text even with `--json`. A failed deployment may have
80
- already applied changes, so inspect its output before deciding to run it again.
88
+ Capture the original failure's stderr and exit code before retrying. Failures before the CLI starts,
89
+ a rejected `--json` or `TAILOR_JSON_OUTPUT` value, argument errors in the bundled CLI plugins, and
90
+ the install hint for a CLI plugin that is not installed may still produce plain text when JSON output
91
+ is requested. A failed deployment may have already
92
+ applied changes, so inspect its output before deciding to run it again.
81
93
 
82
94
  ### GitHub Actions Annotations
83
95
 
@@ -95,9 +107,9 @@ without reporting through the CLI's error path, such as one relaying a failed re
95
107
  writes no annotation.
96
108
 
97
109
  Set `TAILOR_GITHUB_ACTIONS_ANNOTATIONS=false` (also `off`, `no`, or `0`) to turn annotations off.
98
- Passing `--json` also suppresses them, so a workflow step that parses `--json` output gets only the
99
- error envelope on stderr. The flag is honored even when the command fails during argument parsing,
100
- before the envelope itself becomes available.
110
+ Passing `--json` or setting `TAILOR_JSON_OUTPUT` also suppresses them, so a workflow step that parses
111
+ JSON output gets only the error envelope on stderr, even when the command fails during argument
112
+ parsing.
101
113
 
102
114
  An annotation does not by itself fail a step: the step still fails on the CLI's exit code, which
103
115
  is unchanged. Workflows that already echo their own `::error::` around the CLI keep working;
@@ -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
- **Log Level**: 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:
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
- logLevel: process.env.TAILOR_APP_LOG_LEVEL ?? "DEBUG",
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.