@tailor-platform/sdk 2.27.0 → 2.29.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 (184) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/README.md +0 -8
  3. package/agent-skills/tailor/SKILL.md +4 -2
  4. package/dist/application-dalGHdrI.mjs +1 -0
  5. package/dist/application-rWYDAfNU.mjs +200 -0
  6. package/dist/application-rWYDAfNU.mjs.map +1 -0
  7. package/dist/cli/cache/bundle-cache.d.mts +1 -0
  8. package/dist/cli/commands/executor/get.d.mts +2 -1
  9. package/dist/cli/commands/executor/jobs.d.mts +2 -1
  10. package/dist/cli/commands/executor/trigger.d.mts +2 -1
  11. package/dist/cli/commands/function/get.d.mts +2 -1
  12. package/dist/cli/commands/function/list.d.mts +2 -1
  13. package/dist/cli/commands/organization/folder/create.d.mts +2 -1
  14. package/dist/cli/commands/organization/folder/delete.d.mts +2 -1
  15. package/dist/cli/commands/organization/folder/get.d.mts +2 -1
  16. package/dist/cli/commands/organization/folder/list.d.mts +2 -1
  17. package/dist/cli/commands/organization/folder/update.d.mts +2 -1
  18. package/dist/cli/commands/organization/get.d.mts +2 -1
  19. package/dist/cli/commands/organization/tree.d.mts +2 -1
  20. package/dist/cli/commands/organization/update.d.mts +2 -1
  21. package/dist/cli/commands/show.d.mts +2 -1
  22. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +2 -1
  23. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +3 -1
  24. package/dist/cli/commands/workflow/executions.d.mts +2 -1
  25. package/dist/cli/commands/workflow/get.d.mts +2 -1
  26. package/dist/cli/commands/workflow/start.d.mts +2 -1
  27. package/dist/cli/commands/workspace/app/health.d.mts +2 -1
  28. package/dist/cli/commands/workspace/app/list.d.mts +2 -1
  29. package/dist/cli/commands/workspace/create.d.mts +5 -2
  30. package/dist/cli/commands/workspace/delete.d.mts +2 -1
  31. package/dist/cli/commands/workspace/get.d.mts +2 -1
  32. package/dist/cli/commands/workspace/restore.d.mts +2 -1
  33. package/dist/cli/commands/workspace/user/invite.d.mts +2 -1
  34. package/dist/cli/commands/workspace/user/list.d.mts +2 -1
  35. package/dist/cli/commands/workspace/user/remove.d.mts +2 -1
  36. package/dist/cli/commands/workspace/user/update.d.mts +2 -1
  37. package/dist/cli/lib.d.mts +1 -1
  38. package/dist/cli/lib.mjs +1 -1
  39. package/dist/cli/lib.mjs.map +1 -1
  40. package/dist/cli/main.d.mts +7 -0
  41. package/dist/cli/main.mjs +55 -42
  42. package/dist/cli/main.mjs.map +1 -1
  43. package/dist/cli/query/index.d.mts +2 -1
  44. package/dist/cli/shared/args.d.mts +4 -2
  45. package/dist/cli/shared/client.d.mts +6 -1
  46. package/dist/cli/shared/context.d.mts +2 -1
  47. package/dist/cli/shared/logger.d.mts +5 -2
  48. package/dist/cli/shared/readonly-guard.d.mts +2 -1
  49. package/dist/cli/shared/seed-context.d.mts +5 -0
  50. package/dist/cli/shared/type-generator.d.mts +2 -1
  51. package/dist/cli/ts-hook.mjs +15 -11
  52. package/dist/completion/zsh-worker.zsh +275 -19
  53. package/dist/configure/config/types.d.mts +80 -1
  54. package/dist/configure/services/aigateway/types.d.mts +2 -1
  55. package/dist/configure/services/auth/types.d.mts +2 -1
  56. package/dist/configure/services/executor/executor.d.mts +2 -1
  57. package/dist/configure/services/executor/operation.d.mts +2 -1
  58. package/dist/configure/services/executor/trigger/event.d.mts +2 -1
  59. package/dist/configure/services/executor/trigger/schedule.d.mts +2 -1
  60. package/dist/configure/services/http-adapter/http-adapter.d.mts +2 -1
  61. package/dist/configure/services/idp/permission.d.mts +2 -1
  62. package/dist/configure/services/idp/types.d.mts +2 -1
  63. package/dist/configure/services/resolver/permission.d.mts +2 -1
  64. package/dist/configure/services/resolver/resolver.d.mts +2 -1
  65. package/dist/configure/services/secrets/types.d.mts +2 -1
  66. package/dist/configure/services/staticwebsite/types.d.mts +2 -1
  67. package/dist/configure/services/tailordb/permission.d.mts +2 -1
  68. package/dist/configure/services/tailordb/schema.d.mts +4 -3
  69. package/dist/configure/services/tailordb/types.d.mts +12 -1
  70. package/dist/configure/services/workflow/execution-policy.types.d.mts +2 -1
  71. package/dist/configure/services/workflow/job.d.mts +2 -1
  72. package/dist/configure/services/workflow/wait-point.d.mts +2 -1
  73. package/dist/configure/types/field.types.d.mts +2 -1
  74. package/dist/configure/types/permission-operand.types.d.mts +2 -1
  75. package/dist/configure/types/type.d.mts +2 -1
  76. package/dist/{crashreport-DFpRn-LS.mjs → crashreport-BAG8c7hB.mjs} +4 -4
  77. package/dist/{crashreport-DFpRn-LS.mjs.map → crashreport-BAG8c7hB.mjs.map} +1 -1
  78. package/dist/crashreport-BcXuocwI.mjs +1 -0
  79. package/dist/{errors-CpvSChyL.mjs → errors-D3qpNHR6.mjs} +2 -2
  80. package/dist/{errors-CpvSChyL.mjs.map → errors-D3qpNHR6.mjs.map} +1 -1
  81. package/dist/kysely-type-BWMfV301.mjs +48 -0
  82. package/dist/kysely-type-BWMfV301.mjs.map +1 -0
  83. package/dist/logger-DuaT2zY3.mjs +9 -0
  84. package/dist/logger-DuaT2zY3.mjs.map +1 -0
  85. package/dist/package-json-D1BRkjtr.mjs +1 -0
  86. package/dist/parser/service/tailordb/types.d.mts +3 -1
  87. package/dist/plugin/builtin/enum-constants/index.d.mts +2 -1
  88. package/dist/plugin/builtin/file-utils/index.d.mts +2 -1
  89. package/dist/plugin/builtin/kysely-type/index.d.mts +2 -1
  90. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  91. package/dist/plugin/builtin/seed/index.d.mts +11 -1
  92. package/dist/plugin/builtin/seed/index.mjs +1 -1
  93. package/dist/register-ts-hook-CkfKqhJT.mjs +1014 -0
  94. package/dist/register-ts-hook-CkfKqhJT.mjs.map +1 -0
  95. package/dist/runtime/aigateway.mjs +1 -1
  96. package/dist/runtime/authconnection.mjs +1 -1
  97. package/dist/runtime/context.d.mts +2 -1
  98. package/dist/runtime/context.mjs +1 -1
  99. package/dist/runtime/date.d.mts +2 -1
  100. package/dist/runtime/field-parse.d.mts +2 -1
  101. package/dist/runtime/file.d.mts +2 -1
  102. package/dist/runtime/file.mjs +1 -1
  103. package/dist/runtime/globals.d.mts +2 -1
  104. package/dist/runtime/iconv.mjs +1 -1
  105. package/dist/runtime/idp.mjs +1 -1
  106. package/dist/runtime/logger.mjs +1 -1
  107. package/dist/runtime/secretmanager.mjs +1 -1
  108. package/dist/runtime/types.d.mts +2 -1
  109. package/dist/runtime/workflow.d.mts +2 -1
  110. package/dist/runtime/workflow.mjs +1 -1
  111. package/dist/schema-B6hJQWp6.mjs.map +1 -1
  112. package/dist/seed/index.d.mts +17 -4
  113. package/dist/seed/index.mjs +6 -6
  114. package/dist/seed/index.mjs.map +1 -1
  115. package/dist/seed-C3P_T_Eh.mjs.map +1 -1
  116. package/dist/{service-Cc7OY0Oh.mjs → service-CETr0AKY.mjs} +3 -3
  117. package/dist/service-CETr0AKY.mjs.map +1 -0
  118. package/dist/service-DREWLYxD.mjs +1 -0
  119. package/dist/{service-DFmt9UJP.mjs → service-b1g22NN9.mjs} +2 -2
  120. package/dist/{service-DFmt9UJP.mjs.map → service-b1g22NN9.mjs.map} +1 -1
  121. package/dist/service_pb-Bbu2QSIr.mjs +2 -0
  122. package/dist/service_pb-Bbu2QSIr.mjs.map +1 -0
  123. package/dist/service_pb-urxAIYHT.mjs +1 -0
  124. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +53 -1
  125. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +33 -0
  126. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +0 -8
  127. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +18 -1
  128. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +4 -0
  129. package/dist/telemetry-DpkFGBmu.mjs +1 -0
  130. package/dist/{telemetry-Bklv9kQY.mjs → telemetry-Xk7J829P.mjs} +2 -2
  131. package/dist/{telemetry-Bklv9kQY.mjs.map → telemetry-Xk7J829P.mjs.map} +1 -1
  132. package/dist/types/tailordb.generated.d.mts +2 -0
  133. package/dist/vitest/index.mjs +1 -1
  134. package/dist/vitest/index.mjs.map +1 -1
  135. package/dist/vitest/mock-kysely.d.mts +2 -1
  136. package/dist/vitest/mocks/aigateway.d.mts +2 -1
  137. package/dist/vitest/mocks/authconnection.d.mts +2 -1
  138. package/dist/vitest/mocks/file.d.mts +2 -1
  139. package/dist/vitest/mocks/iconv.d.mts +2 -1
  140. package/dist/vitest/mocks/idp.d.mts +2 -1
  141. package/dist/vitest/mocks/logger.d.mts +2 -1
  142. package/dist/vitest/mocks/secretmanager.d.mts +2 -1
  143. package/dist/vitest/mocks/tailordb-pglite.d.mts +2 -1
  144. package/dist/vitest/mocks/tailordb.d.mts +2 -1
  145. package/dist/vitest/mocks/workflow.d.mts +3 -1
  146. package/dist/vitest/pglite-kysely.d.mts +2 -1
  147. package/dist/vitest/workflow-local.d.mts +2 -1
  148. package/dist/{workspace_resource_pb-ChWejcj0.mjs → workspace_resource_pb-CaoM2npP.mjs} +2 -2
  149. package/dist/{workspace_resource_pb-ChWejcj0.mjs.map → workspace_resource_pb-CaoM2npP.mjs.map} +1 -1
  150. package/docs/cli/application.md +21 -3
  151. package/docs/cli/data.md +105 -0
  152. package/docs/cli/secret.md +6 -6
  153. package/docs/cli/tailordb.md +52 -16
  154. package/docs/cli/user.md +37 -7
  155. package/docs/cli/workspace.md +9 -1
  156. package/docs/cli-reference.md +36 -3
  157. package/docs/configuration.md +62 -2
  158. package/docs/github-actions.md +179 -13
  159. package/docs/multi-environment.md +24 -0
  160. package/docs/plugin/custom.md +1 -1
  161. package/docs/services/idp.md +1 -1
  162. package/docs/services/resolver.md +1 -58
  163. package/docs/services/tailordb-migration.md +80 -12
  164. package/docs/services/tailordb.md +17 -4
  165. package/docs/services/workflow.md +2 -2
  166. package/docs/testing.md +3 -2
  167. package/package.json +22 -22
  168. package/dist/application-DFeuELRo.mjs +0 -200
  169. package/dist/application-DFeuELRo.mjs.map +0 -1
  170. package/dist/application-nT_4a5HO.mjs +0 -1
  171. package/dist/crashreport-CBaRJl5h.mjs +0 -1
  172. package/dist/kysely-type-RDX59E1j.mjs +0 -48
  173. package/dist/kysely-type-RDX59E1j.mjs.map +0 -1
  174. package/dist/logger-Db-YRTwK.mjs +0 -9
  175. package/dist/logger-Db-YRTwK.mjs.map +0 -1
  176. package/dist/package-json-CmqhDJ__.mjs +0 -1
  177. package/dist/register-ts-hook-D6KXrGrB.mjs +0 -1009
  178. package/dist/register-ts-hook-D6KXrGrB.mjs.map +0 -1
  179. package/dist/service-Cc7OY0Oh.mjs.map +0 -1
  180. package/dist/service-sH2MZ4_W.mjs +0 -1
  181. package/dist/service_pb-Dw2ilc1O.mjs +0 -2
  182. package/dist/service_pb-Dw2ilc1O.mjs.map +0 -1
  183. package/dist/service_pb-GDOqfwb6.mjs +0 -1
  184. package/dist/telemetry-DXHP3VVi.mjs +0 -1
@@ -75,6 +75,11 @@ tailor deploy [options]
75
75
  | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
76
76
 
77
77
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
78
+
79
+ **Notes**
80
+
81
+ Workspace creation uses the selected user's default organization and folder set by `user update` when neither location is given and TAILOR_PLATFORM_TOKEN is not set. Giving --organization-id or --folder-id replaces both defaults. Organization and folder IDs loaded by --env-file also replace the defaults; command-line options take precedence, and empty env-file values are ignored. With --create-workspace, an existing workspace must match the resolved name, region, organization, and folder to be reused.
82
+
78
83
  **JSON result:**
79
84
 
80
85
  After a successful `tailor deploy --json`, stdout includes `status: "applied"`,
@@ -89,6 +94,14 @@ is registered or no resources changed.
89
94
  Plugins that return outputs add entries under `deployedHooks`. For example, the
90
95
  frontend plugin provides upload results in `deployedHooks[].outputs.frontends`.
91
96
 
97
+ When the deploy applied TailorDB migrations with maintenance mode enabled, `tailordbMaintenance` has one entry per
98
+ application whose migrations ran: its `application` name, `namespaces`, `maintenanceMs` (how
99
+ long their tables were in maintenance mode, equal to the sum of `phases`), `phases` in milliseconds
100
+ (`restrict`, `preMigration`, `jobSetup`, `waitingToStart`, `running`, `waitingOrRunning`,
101
+ `jobCleanup`, `postMigration`, `remainingDeploy`, `restore`), and `migrations` with each script's `namespace`,
102
+ `migrationNumber`, `startObserved`, `waitingToStartMs`, `runningMs`, and `waitingOrRunningMs`. See
103
+ [Time spent in maintenance mode](../services/tailordb-migration.md#time-spent-in-maintenance-mode).
104
+
92
105
  ```sh
93
106
  tailor deploy --json > deploy-result.json
94
107
  jq '.applications[] | {name, url, staticWebsites, auth}' deploy-result.json
@@ -161,6 +174,8 @@ tailor deploy --config apps/buyer/tailor.config.ts,apps/supplier/tailor.config.t
161
174
 
162
175
  When multiple configs are provided, `deploy` creates or updates all configured services first, then updates the applications. This lets one application reference resources owned by another config with `external: true` during the same deploy.
163
176
 
177
+ Names that identify a resource across the whole workspace, such as application, executor, workflow, and static website names and service namespaces, must be unique across all configs in one deploy. Otherwise, `deploy` fails before planning any changes and lists every duplicate with the config files that define it.
178
+
164
179
  Each config's `files` and `ignores` patterns (see [Service Configuration](../configuration.md#service-configuration)) resolve relative to that config's own directory, not the directory you ran `deploy` from. For example, `apps/buyer/tailor.config.ts` declaring `files: ["db/**/*.ts"]` loads files from `apps/buyer/db/`, independent of where `apps/supplier/tailor.config.ts`'s patterns resolve. If a config's relative patterns match nothing under its own directory, the SDK falls back to the invocation directory and logs a warning (see [Service Configuration](../configuration.md#service-configuration) for details).
165
180
 
166
181
  **Migration Handling:**
@@ -240,10 +255,12 @@ Pass the global `--json` / `-j` flag to get machine-readable output.
240
255
  }
241
256
  ],
242
257
  "warnings": [
243
- { "type": "unmanaged", "resourceType": "tailorDB", "name": "LegacyType" },
244
- { "type": "skippedSecret", "resourceType": "secret", "name": "DB_PASSWORD" }
258
+ { "type": "unmanaged", "resourceType": "staticwebsite", "name": "legacy-site" },
259
+ { "type": "skippedSecret", "resourceType": "secret.secret", "name": "my-vault/DB_PASSWORD" }
245
260
  ],
246
- "conflicts": [{ "resourceType": "tailorDB", "name": "User", "currentOwner": "other-app" }]
261
+ "conflicts": [
262
+ { "resourceType": "tailordb.service", "name": "tailordb", "currentOwner": "other-app" }
263
+ ]
247
264
  }
248
265
  ```
249
266
 
@@ -251,6 +268,7 @@ Pass the global `--json` / `-j` flag to get machine-readable output.
251
268
  - `changes` — planned resource changes, each with `action`, `name`, and optional `labels` / `namespace`. An update forced by the SDK version also has `forcedBySdkVersion: true`.
252
269
  - `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.
253
270
  - `conflicts` — resources owned by another application that conflict with the current config. Require confirmation in apply mode; apply is cancelled if declined.
271
+ - `resourceType` in `warnings` and `conflicts` is a stable identifier of the resource kind, such as `executor`, `tailordb.service`, or `secret.secret`. The human-readable plan shows a display name instead.
254
272
 
255
273
  **Apply** (`--json`): writes a JSON object to stdout:
256
274
 
@@ -0,0 +1,105 @@
1
+ # Data Commands
2
+
3
+ Commands for managing application data across workspaces.
4
+
5
+ ## data
6
+
7
+ Manage application data across workspaces.
8
+
9
+ **Usage**
10
+
11
+ ```
12
+ tailor data <command>
13
+ ```
14
+
15
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
16
+
17
+ **Commands**
18
+
19
+ | Command | Description |
20
+ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
21
+ | [`data clone`](#data-clone) | Clone the data of an application (TailorDB namespaces registered in its subgraph) from one workspace to another. |
22
+ | [`data operation`](#data-operation) | Inspect asynchronous application data operations. |
23
+
24
+ ### data clone
25
+
26
+ Clone the data of an application (TailorDB namespaces registered in its subgraph) from one workspace to another.
27
+
28
+ **Usage**
29
+
30
+ ```
31
+ tailor data clone [options]
32
+ ```
33
+
34
+ **Options**
35
+
36
+ | Option | Alias | Description | Required | Default | Env |
37
+ | --------------------- | ----- | -------------------------------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------- |
38
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
39
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
40
+ | `--from <FROM>` | - | Workspace ID to copy data from | Yes | - | - |
41
+ | `--to <TO>` | - | Workspace ID to copy data to | Yes | - | - |
42
+ | `--name <NAME>` | `-n` | Application name, the same in the source and the target workspace (default: the name in the config file) | No | - | - |
43
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
44
+ | `--copy-files` | - | Also copy TailorDB file content | No | `false` | - |
45
+ | `--copy-idp-users` | - | Also copy IdP users, including their passwords | No | `false` | - |
46
+ | `--no-wait` | - | Start the clone and exit without waiting for it to finish | No | `false` | - |
47
+
48
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
49
+
50
+ **Notes**
51
+
52
+ The platform rejects the clone with a failed precondition unless all of the following hold:
53
+
54
+ - The source and target workspaces are in the same region.
55
+ - The target workspace has the same namespaces as the source.
56
+ - The TailorDB schema of the target matches the source, so deploy the same version to the target first.
57
+ - The target is empty for every namespace and copy type in scope (TailorDB records, plus files and IdP users when `--copy-files` / `--copy-idp-users` are given).
58
+
59
+ The command waits until the clone finishes. Pressing Ctrl+C or passing --no-wait does not stop the clone, which keeps running on the platform. Use `tailor data operation get --wait` with the operation ID printed at the start to keep waiting, or without --wait to check the status once.
60
+
61
+ With --json, the result carries `status`: `completed` once the clone has finished, or `started` with --no-wait.
62
+
63
+ ### data operation
64
+
65
+ Inspect asynchronous application data operations.
66
+
67
+ **Usage**
68
+
69
+ ```
70
+ tailor data operation <command>
71
+ ```
72
+
73
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
74
+
75
+ **Commands**
76
+
77
+ | Command | Description |
78
+ | ------------------------------------------- | ---------------------------------------------------------- |
79
+ | [`data operation get`](#data-operation-get) | Show the status of a data clone, or wait for it to finish. |
80
+
81
+ #### data operation get
82
+
83
+ Show the status of a data clone, or wait for it to finish.
84
+
85
+ **Usage**
86
+
87
+ ```
88
+ tailor data operation get [options]
89
+ ```
90
+
91
+ **Options**
92
+
93
+ | Option | Alias | Description | Required | Default | Env |
94
+ | ------------------------------- | ----- | ------------------------------------------- | -------- | ------- | ------------------------- |
95
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
96
+ | `--from <FROM>` | - | Workspace ID to copy data from | Yes | - | - |
97
+ | `--to <TO>` | - | Workspace ID to copy data to | Yes | - | - |
98
+ | `--operation-id <OPERATION_ID>` | - | Operation ID printed when the clone started | Yes | - | - |
99
+ | `--wait` | - | Wait until the clone completes or fails | No | `false` | - |
100
+
101
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
102
+
103
+ **Notes**
104
+
105
+ Without --wait, the command prints the current status once and exits. With --wait, it waits until the clone completes or fails, and exits with an error if it fails. Pressing Ctrl+C stops waiting; the clone keeps running on the platform.
@@ -154,9 +154,9 @@ tailor secret vault create [options] <name>
154
154
 
155
155
  **Arguments**
156
156
 
157
- | Argument | Description | Required |
158
- | -------- | ----------- | -------- |
159
- | `name` | Vault name | Yes |
157
+ | Argument | Description | Required |
158
+ | ----------------------- | ----------- | -------- |
159
+ | `name`, `--name <NAME>` | Vault name | Yes |
160
160
 
161
161
  **Options**
162
162
 
@@ -179,9 +179,9 @@ tailor secret vault delete [options] <name>
179
179
 
180
180
  **Arguments**
181
181
 
182
- | Argument | Description | Required |
183
- | -------- | ----------- | -------- |
184
- | `name` | Vault name | Yes |
182
+ | Argument | Description | Required |
183
+ | ----------------------- | ----------- | -------- |
184
+ | `name`, `--name <NAME>` | Vault name | Yes |
185
185
 
186
186
  **Options**
187
187
 
@@ -33,9 +33,9 @@ tailor tailordb truncate [options] [tables]
33
33
 
34
34
  **Arguments**
35
35
 
36
- | Argument | Description | Required |
37
- | -------- | ----------------------- | -------- |
38
- | `tables` | Table names to truncate | No |
36
+ | Argument | Description | Required |
37
+ | ----------------------------- | ----------------------- | -------- |
38
+ | `tables`, `--tables <TABLES>` | Table names to truncate | No |
39
39
 
40
40
  **Options**
41
41
 
@@ -98,6 +98,7 @@ tailor tailordb migration <command>
98
98
  | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99
99
  | [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local tables and the previous migration snapshot. |
100
100
  | [`tailordb migration rebaseline`](#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline. |
101
+ | [`tailordb migration resolve`](#tailordb-migration-resolve) | Settle a migration that a failed deploy left partially applied. |
101
102
  | [`tailordb migration script`](#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
102
103
  | [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
103
104
  | [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
@@ -159,6 +160,39 @@ See [Global Options](../cli-reference.md#global-options) for options available t
159
160
 
160
161
  Re-baselining removes migrations after 0000 from the working tree, records a new migration history ID, and resets the connected workspace checkpoint without changing its schema or data. Every environment must already have applied the latest migration before you run this command.
161
162
 
163
+ #### tailordb migration resolve
164
+
165
+ Settle a migration that a failed deploy left partially applied.
166
+
167
+ **Usage**
168
+
169
+ ```
170
+ tailor tailordb migration resolve [options]
171
+ ```
172
+
173
+ **Options**
174
+
175
+ | Option | Alias | Description | Required | Default | Env |
176
+ | ------------------------------- | ----- | ---------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
177
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
178
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
179
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
180
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
181
+ | `--rollback` | - | Return the namespace to the schema before the in-progress migration | No | `false` | - |
182
+ | `--complete` | - | Apply the schema of the in-progress migration and mark it as completed | No | `false` | - |
183
+ | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
184
+
185
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
186
+
187
+ **Notes**
188
+
189
+ Use this after a deploy failed partway through a migration whose `migrate.ts` exports `steps`. The failed migration stays in progress: when `maintenanceMode` is on in your config, the tables of its namespace stay in maintenance mode, and `sync` and `rebaseline` are refused, while `set` accepts only the number of the in-progress migration.
190
+
191
+ - `--rollback` sends the schema of the migration before the failed one. The next deploy runs the failed migration again from its first step. Data changes made by steps that already completed are not undone.
192
+ - `--complete` sends the schema of the failed migration itself and records it as completed, without running its `migrate.ts` again. Fix the data first (for example with `tailor query`), and make sure no record lacks a value for a field that becomes required.
193
+
194
+ Both options remove the in-progress record, take the tables out of maintenance mode, and remove the temporary resources of the failed run, so `deploy` and the other migration commands work again. As with `tailordb migration sync`, the local migration history must reproduce the current table definitions. If sending the schema stops partway, run the command again.
195
+
162
196
  #### tailordb migration script
163
197
 
164
198
  Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none.
@@ -290,24 +324,26 @@ tailor tailordb migration test [options]
290
324
 
291
325
  **Options**
292
326
 
293
- | Option | Alias | Description | Required | Default | Env |
294
- | --------------------------------------------- | ----- | ---------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
295
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
296
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
297
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
298
- | `--yes` | `-y` | Acknowledge that a designated target workspace may be overwritten | No | `false` | - |
299
- | `--data <DATA>` | - | Data source for the migration test (seed or clone) | No | `"seed"` | - |
300
- | `--target-workspace-id <TARGET_WORKSPACE_ID>` | - | Existing throwaway workspace to retain after the test (requires --yes) | No | - | - |
301
- | `--keep` | - | Keep the automatically created workspace after the test | No | `false` | - |
302
- | `--assert <ASSERT>` | - | Path to a TypeScript assertion script to run after migrations | No | - | - |
303
- | `--assert-namespace <ASSERT_NAMESPACE>` | - | TailorDB namespace exposed to the assertion script | No | - | - |
304
- | `--machine-user <MACHINE_USER>` | - | Machine user for seed and assertion script execution | No | - | - |
327
+ | Option | Alias | Description | Required | Default | Env |
328
+ | --------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
329
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
330
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
331
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
332
+ | `--yes` | `-y` | Acknowledge that a designated target workspace may be overwritten | No | `false` | - |
333
+ | `--data <DATA>` | - | Data source for the migration test (seed or clone) | No | `"seed"` | - |
334
+ | `--target-workspace-id <TARGET_WORKSPACE_ID>` | - | Existing throwaway workspace to retain after the test (requires --yes) | No | - | - |
335
+ | `--keep` | - | Keep the automatically created workspace after the test | No | `false` | - |
336
+ | `--assert <ASSERT>` | - | Path to a TypeScript assertion script to run after migrations | No | - | - |
337
+ | `--assert-namespace <ASSERT_NAMESPACE>` | - | TailorDB namespace exposed to the assertion script | No | - | - |
338
+ | `--keep-ttl <KEEP_TTL>` | - | Record an expiry on the kept workspace, e.g. 24h or 7d, so workspace prune --expired can delete it (requires --keep) | No | - | - |
339
+ | `--clone-timeout <CLONE_TIMEOUT>` | - | How long to wait for the clone to finish with --data clone, e.g. 30s or 10m (default: 30m) | No | - | - |
340
+ | `--machine-user <MACHINE_USER>` | - | Machine user for seed and assertion script execution | No | - | - |
305
341
 
306
342
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
307
343
 
308
344
  **Notes**
309
345
 
310
- The source workspace is read-only. Without --target-workspace-id, the command creates a workspace in the source workspace's region and deletes it after success or failure; pass --keep to retain it for inspection. A designated target is retained and requires --yes. Clone mode copies TailorDB records only; it does not copy IdP users or file blobs.
346
+ The source workspace is read-only. Without --target-workspace-id, the command creates a workspace in the source workspace's region and deletes it after success or failure; pass --keep to retain it for inspection. A designated target is retained and requires --yes. Clone mode copies TailorDB records only; it does not copy IdP users or file blobs. With --keep-ttl, the kept workspace records an expiry; it is not deleted automatically, but workspace prune --expired removes it once the expiry has passed.
311
347
 
312
348
  #### tailordb migration validate
313
349
 
package/docs/cli/user.md CHANGED
@@ -28,7 +28,7 @@ _no options_
28
28
 
29
29
  | Option | Alias | Description | Required | Default | Env |
30
30
  | --------------------------------- | ----- | --------------------------------- | -------- | ------- | -------------------------------------------- |
31
- | `--machine-user <MACHINE_USER>` | - | Login as a platform machine user. | Yes | - | - |
31
+ | `--machine-user` | - | Login as a platform machine user. | Yes | - | - |
32
32
  | `--client-id <CLIENT_ID>` | - | Client ID | Yes | - | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` |
33
33
  | `--client-secret <CLIENT_SECRET>` | - | Client secret | No | - | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` |
34
34
 
@@ -121,12 +121,13 @@ See [Global Options](../cli-reference.md#global-options) for options available t
121
121
 
122
122
  **Commands**
123
123
 
124
- | Command | Description |
125
- | ------------------------------- | ------------------------------ |
126
- | [`user current`](#user-current) | Show current user. |
127
- | [`user list`](#user-list) | List all users. |
128
- | [`user switch`](#user-switch) | Set current user. |
129
- | [`user pat`](#user-pat) | Manage personal access tokens. |
124
+ | Command | Description |
125
+ | ------------------------------- | -------------------------------------------------------------------------- |
126
+ | [`user current`](#user-current) | Show current user. |
127
+ | [`user list`](#user-list) | List all users. |
128
+ | [`user switch`](#user-switch) | Set current user. |
129
+ | [`user update`](#user-update) | Set the current user's default organization and folder for new workspaces. |
130
+ | [`user pat`](#user-pat) | Manage personal access tokens. |
130
131
 
131
132
  ### user current
132
133
 
@@ -302,6 +303,35 @@ tailor user switch [options] <user>
302
303
  | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
303
304
 
304
305
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
306
+
307
+ ### user update
308
+
309
+ Set the current user's default organization and folder for new workspaces.
310
+
311
+ **Usage**
312
+
313
+ ```
314
+ tailor user update [options]
315
+ ```
316
+
317
+ **Options**
318
+
319
+ | Option | Alias | Description | Required | Default | Env |
320
+ | ----------------------------------------------------- | ----- | ---------------------------------------------------------------------------------------------------------------- | -------- | ------- | ------------------------- |
321
+ | `--default-organization-id <DEFAULT_ORGANIZATION_ID>` | `-o` | Organization that `workspace create` uses when no location is given. Pass an empty string to clear the defaults. | No | - | - |
322
+ | `--default-folder-id <DEFAULT_FOLDER_ID>` | `-f` | Folder in the default organization that `workspace create` uses (requires --default-organization-id) | No | - | - |
323
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
324
+
325
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
326
+
327
+ **Notes**
328
+
329
+ `workspace create`, workspace creation during `deploy`, and the programmatic `createWorkspace()` use the default folder, or directly use the default organization when no folder is set. Giving either an organization or a folder replaces both defaults for that run. For the CLI, use --organization-id or --folder-id, or TAILOR_PLATFORM_ORGANIZATION_ID / TAILOR_PLATFORM_FOLDER_ID. The defaults are not used while TAILOR_PLATFORM_TOKEN is set, because that token does not belong to a user logged in here.
330
+
331
+ Each run replaces both defaults: --default-organization-id alone clears the default folder, --default-folder-id is accepted only together with --default-organization-id, and --default-organization-id "" clears both. The IDs are not checked against the Platform here; `workspace create` and `deploy` point back to them when the Platform cannot find them or denies access to them.
332
+
333
+ The defaults belong to this user's login on the selected platform, so `logout` removes them, and older SDK versions drop them when they rewrite the CLI config file.
334
+
305
335
  When no subcommand is provided, defaults to `list`.
306
336
 
307
337
  **Output (default):**
@@ -115,6 +115,12 @@ tailor workspace create [options]
115
115
 
116
116
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
117
117
 
118
+ **Notes**
119
+
120
+ Without --organization-id and --folder-id, on the command line or through TAILOR_PLATFORM_ORGANIZATION_ID / TAILOR_PLATFORM_FOLDER_ID, the workspace is created in the default organization and folder that the logged-in user set with `user update`, unless TAILOR_PLATFORM_TOKEN is set. Giving either option replaces both defaults, and --folder-id requires --organization-id.
121
+
122
+ TAILOR_PLATFORM_ORGANIZATION_ID and TAILOR_PLATFORM_FOLDER_ID are also read from --env-file. Command-line options take precedence over the corresponding environment variables. Empty values in the env file are treated as not given.
123
+
118
124
  ### workspace delete
119
125
 
120
126
  Delete a Tailor Platform workspace.
@@ -207,7 +213,9 @@ Use this to reclaim workspaces left behind by CI runs, preview deployments, or i
207
213
 
208
214
  With --expired the workspaces select themselves instead: each one is deleted only once the --ttl expiry it recorded at creation has passed, so callers need no --name or --older-than. A workspace that records no expiry is never deleted this way, and neither is one whose recorded expiry cannot be read. Because that expiry is recorded on the workspace rather than derived from its name, anything able to write the workspace's metadata can bring its deletion forward -- and writing a workspace's metadata is a lesser permission than deleting it. --expired therefore requires at least one location, and --name still applies on top.
209
215
 
210
- Every workspace lives in exactly one location, and the location options name them explicitly: --organization-root selects the workspaces directly under an organization and none inside its folders, --folder-id selects the workspaces in one folder, and --personal selects the workspaces belonging to no organization and no folder. Each option can be given more than once, they combine as a union, and none of them is read from the environment -- a sweep covers exactly the locations spelled out on the command line. Selecting --personal is a deliberate choice to accept, for every organization-less workspace visible to this login, the expiry that anyone able to write a workspace's metadata may have recorded. Without any location option, a --name / --older-than sweep considers every visible workspace.
216
+ Every workspace lives in exactly one location, and the location options name them explicitly: --organization-root selects the workspaces directly under an organization and none inside its folders, --folder-id selects the workspaces in one folder, and --personal selects the workspaces belonging to no organization and no folder. Each option can be given more than once, they combine as a union, and none of them is read from the environment or from the default organization/folder set by `user update` -- a sweep covers exactly the locations spelled out on the command line. Selecting --personal is a deliberate choice to accept, for every organization-less workspace visible to this login, the expiry that anyone able to write a workspace's metadata may have recorded. Without any location option, a --name / --older-than sweep considers every visible workspace.
217
+
218
+ Without a location option, prune warns before listing workspaces that every workspace visible to this login is a candidate for the name and age filters, even with --yes or --dry-run. The default organization/folder set by `tailor user update` is not used.
211
219
 
212
220
  Restoring a workspace does not clear its recorded expiry, so a workspace restored after expiring is deleted again by the next --expired run. Restore it, then run `workspace ttl set` or `workspace ttl clear` before the next run — or keep it out of that run with --exclude.
213
221
 
@@ -50,6 +50,16 @@ keep table output. Other values are rejected. JSON mode also disables interactiv
50
50
  variable per invocation or per job rather than exporting it from a shell profile; a command that
51
51
  needed a prompt names what selected JSON when it refuses.
52
52
 
53
+ When an AI coding agent such as Claude Code, Codex, Cursor, or Gemini CLI runs the CLI, every
54
+ command defaults to JSON as if `TAILOR_JSON_OUTPUT=true` were set, and `--help` starts with a short
55
+ guide for the agent. The CLI recognizes an agent by the environment variables it sets for the
56
+ commands it runs; a non-blank `AI_AGENT` also counts as one. An explicit `--json` or
57
+ `TAILOR_JSON_OUTPUT` still wins, so `--json=false` or `TAILOR_JSON_OUTPUT=false` keeps table output
58
+ under an agent, and setting `POLITTY_NO_AGENT` to any non-empty value, such as `1`, turns agent
59
+ detection off. Set these variables in the environment itself: values loaded with `--env-file` do not
60
+ change the default. CLI plugins keep table output under an agent unless they receive `--json` or
61
+ `TAILOR_JSON_OUTPUT`, and their `--help` does not include the guide.
62
+
53
63
  Errors, warnings, progress, and diagnostic messages are written to stderr. A command failure under
54
64
  `--json` or `TAILOR_JSON_OUTPUT` emits a JSON error envelope to stderr, including a failure while
55
65
  parsing arguments: an unknown option or subcommand, or an option value that fails validation, is
@@ -62,6 +72,16 @@ runnable command), or `error.context`. `UNEXPECTED_ERROR` marks failures without
62
72
  including SDK-internal errors. Diagnostic lines may precede the error envelope, and stdout is not
63
73
  guaranteed to contain an error object.
64
74
 
75
+ The exit code separates a mistyped command from a failed one without parsing output: `0` on success,
76
+ `2` when the CLI rejects the command line itself, such as an unknown option or subcommand, an
77
+ unexpected argument, or an option value that fails validation (including one set through its
78
+ environment variable), and `1` for other failures, including checks a command makes after reading
79
+ its arguments. A command that only warns about an unknown option or an extra argument keeps
80
+ running. Cancelling an interactive prompt exits with `130`, and a CLI plugin exits with its own
81
+ code. A command group run without a subcommand, such as `tailor` or `tailor tailordb`, can exit
82
+ with `0` after printing its help or a warning even when an option is unknown or its value is
83
+ invalid, so name the subcommand to rely on `2`.
84
+
65
85
  Authentication failures distinguish missing credentials (`AUTH_TOKEN_NOT_FOUND`), a missing saved
66
86
  user (`AUTH_USER_NOT_FOUND`), an expired token (`AUTH_TOKEN_EXPIRED`), and a failed token refresh
67
87
  (`AUTH_TOKEN_REFRESH_FAILED`). Login recovery preserves the selected profile. For saved identities,
@@ -107,9 +127,9 @@ without reporting through the CLI's error path, such as one relaying a failed re
107
127
  writes no annotation.
108
128
 
109
129
  Set `TAILOR_GITHUB_ACTIONS_ANNOTATIONS=false` (also `off`, `no`, or `0`) to turn annotations off.
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.
130
+ Passing `--json`, setting `TAILOR_JSON_OUTPUT`, or the JSON default under an AI coding agent also
131
+ suppresses them, so a workflow step that parses JSON output gets only the error envelope on stderr,
132
+ even when the command fails during argument parsing.
113
133
 
114
134
  An annotation does not by itself fail a step: the step still fails on the CLI's exit code, which
115
135
  is unchanged. Workflows that already echo their own `::error::` around the CLI keep working;
@@ -307,6 +327,7 @@ Commands for managing TailorDB tables, data, and schema migrations.
307
327
  | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
308
328
  | [tailordb migration generate](./cli/tailordb.md#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local tables and the previous migration snapshot. |
309
329
  | [tailordb migration rebaseline](./cli/tailordb.md#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline. |
330
+ | [tailordb migration resolve](./cli/tailordb.md#tailordb-migration-resolve) | Settle a migration that a failed deploy left partially applied. |
310
331
  | [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. |
311
332
  | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
312
333
  | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
@@ -314,6 +335,17 @@ Commands for managing TailorDB tables, data, and schema migrations.
314
335
  | [tailordb migration test](./cli/tailordb.md#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace. |
315
336
  | [tailordb migration validate](./cli/tailordb.md#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and schema drift (local tables 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. |
316
337
 
338
+ ### [Data Commands](./cli/data.md)
339
+
340
+ Commands for managing application data across workspaces.
341
+
342
+ | Command | Description |
343
+ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
344
+ | [data](./cli/data.md#data) | Manage application data across workspaces. |
345
+ | [data clone](./cli/data.md#data-clone) | Clone the data of an application (TailorDB namespaces registered in its subgraph) from one workspace to another. |
346
+ | [data operation](./cli/data.md#data-operation) | Inspect asynchronous application data operations. |
347
+ | [data operation get](./cli/data.md#data-operation-get) | Show the status of a data clone, or wait for it to finish. |
348
+
317
349
  ### [Query Commands](./cli/query.md)
318
350
 
319
351
  Run ad-hoc SQL/GraphQL queries or enter the interactive REPL.
@@ -342,6 +374,7 @@ Commands for authentication and user management.
342
374
  | [user pat list](./cli/user.md#user-pat-list) | List all personal access tokens. |
343
375
  | [user pat update](./cli/user.md#user-pat-update) | Update a personal access token (delete and recreate). |
344
376
  | [user switch](./cli/user.md#user-switch) | Set current user. |
377
+ | [user update](./cli/user.md#user-update) | Set the current user's default organization and folder for new workspaces. |
345
378
 
346
379
  ### [Organization Commands](./cli/organization.md)
347
380
 
@@ -60,7 +60,20 @@ export default defineConfig({
60
60
 
61
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.
62
62
 
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.
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`), `inlineSourcemapDependencySources` (below), `allowedRuntimeGlobals` (see [Node-only globals](#node-only-globals)), and `treeshake` (see [Removing unused code](#removing-unused-code)). 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
+ **Sourcemap Sources** (`buildOptions.inlineSourcemapDependencySources`): Whether the inline sourcemap embeds the source text of installed packages, that is, everything under `node_modules`. The default is `false`: only your own source files are embedded, which makes bundled functions much smaller. Error positions in stack traces resolve to the original files and lines either way. With the default, `tailor function run` and `tailor function logs` show the code snippet for a frame inside an installed package from the package's file on your machine, so the snippet is missing when that file is not installed locally (for `tailor function logs`, run it from the project directory you deployed from). Set it to `true` to embed the source text of installed packages as well, or to a list of package names such as `["kysely", "@scope/lib"]` to embed only those packages. A listed package's own dependencies are not embedded unless they are listed too. It has no effect when `inlineSourcemap` is `false`.
66
+
67
+ ```typescript
68
+ export default defineConfig({
69
+ name: "my-app",
70
+ buildOptions: {
71
+ inlineSourcemapDependencySources: true,
72
+ },
73
+ });
74
+ ```
75
+
76
+ This is a bundle-time setting. It affects newly bundled deployments; already deployed functions keep the sourcemap they were deployed with until they are redeployed.
64
77
 
65
78
  **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:
66
79
 
@@ -90,6 +103,15 @@ The default applies wherever the SDK parses or serializes `t` fields on your beh
90
103
 
91
104
  The setting is per `tailor.config.ts`, but the field types are declared through `tailor.d.ts`, which TypeScript merges across every file in a program. If one `tsconfig.json` includes the `tailor.d.ts` of several applications, they must agree on `defaultDateRepresentation`. When they differ, `t.date()`, `t.datetime()`, and `t.time()` called without `as` fail to type-check in that program until the configs are aligned or each application gets its own `tsconfig.json`.
92
105
 
106
+ **Maintenance Mode** (`maintenanceMode`): Whether `deploy` restricts the TailorDB namespaces it migrates while it applies pending migrations: `"migration"` (the default) restricts them until the migrations complete, `"deploy"` until the whole deploy completes, and `false` does not restrict them. See [Maintenance mode](./services/tailordb-migration.md#maintenance-mode) for what is restricted and what concurrent requests can observe without it.
107
+
108
+ ```typescript
109
+ export default defineConfig({
110
+ name: "my-app",
111
+ maintenanceMode: "migration",
112
+ });
113
+ ```
114
+
93
115
  ### Service Configuration
94
116
 
95
117
  Specify glob patterns to load service files:
@@ -159,6 +181,44 @@ export default defineConfig({
159
181
 
160
182
  `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.
161
183
 
184
+ #### Removing unused code
185
+
186
+ Bundling leaves out code a function never reaches. By default, reading a property such as `shared.db.company` counts as something that may have an effect, so a call like `createService({ db: { company: shared.db.company } })` stays in the bundle even when nothing uses its result, together with every module it imports. When a bundle is larger than expected because of modules the function does not use, set `buildOptions.treeshake.propertyReadSideEffects` to `false`:
187
+
188
+ ```typescript
189
+ export default defineConfig({
190
+ name: "my-app",
191
+ buildOptions: {
192
+ treeshake: { propertyReadSideEffects: false },
193
+ },
194
+ });
195
+ ```
196
+
197
+ With `false`, a property read whose result is unused is removed, and so is a call that only exists to receive such a read. This also removes a read that exists only for its effect: a getter that initializes something when it is read, or a statement such as `settings.db.url;` that throws when `settings.db` is missing. Keep the default if your code or an installed package relies on a read like that.
198
+
199
+ `treeshake` has four switches that control how unused code is removed from bundles. The values below are the SDK's defaults, which are tuned for the Tailor Platform runtime and rarely need changing. Most switches ask whether something has side effects, so `true` keeps it, while `annotations` asks whether to honor annotations, so `true` removes more:
200
+
201
+ ```typescript
202
+ export default defineConfig({
203
+ name: "my-app",
204
+ buildOptions: {
205
+ treeshake: {
206
+ // true: keep an imported module even when none of its exports is used, so code
207
+ // that runs on import (such as registering something on `globalThis`) stays.
208
+ moduleSideEffects: false,
209
+ // true: honor `@__PURE__` and `@__NO_SIDE_EFFECTS__` comment annotations.
210
+ annotations: true,
211
+ // true: keep a read of a global the bundle does not define even when its result is unused.
212
+ unknownGlobalSideEffects: false,
213
+ // true: keep a property read (`shared.db.company`) even when its result is unused.
214
+ propertyReadSideEffects: true,
215
+ },
216
+ },
217
+ });
218
+ ```
219
+
220
+ The settings apply to resolvers, executors, workflow jobs, auth hooks, HTTP adapters, and `tailor function run`; other bundles are not affected. They are bundle-time settings, so already deployed functions must be redeployed to pick up a change.
221
+
162
222
  ### External Resources
163
223
 
164
224
  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.
@@ -445,8 +505,8 @@ Configure plugins using `definePlugins()`, exported as `export const plugins`.
445
505
 
446
506
  ```typescript
447
507
  import { definePlugins } from "@tailor-platform/sdk";
448
- import { kyselyTypePlugin } from "@tailor-platform/sdk/plugin/kysely-type";
449
508
  import { enumConstantsPlugin } from "@tailor-platform/sdk/plugin/enum-constants";
509
+ import { kyselyTypePlugin } from "@tailor-platform/sdk/plugin/kysely-type";
450
510
 
451
511
  export const plugins = definePlugins(
452
512
  kyselyTypePlugin({ distPath: "./generated/tailordb.ts" }),