@tailor-platform/sdk 2.4.0 → 2.6.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 (252) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/bin/tailor.mjs +3 -2
  3. package/dist/aigateway-DsWDjzk4.mjs +2 -0
  4. package/dist/{aigateway-DR4Kwuik.mjs.map → aigateway-DsWDjzk4.mjs.map} +1 -1
  5. package/dist/application-CNeOcaLc.mjs +1 -0
  6. package/dist/application-CmXOqTaK.mjs +192 -0
  7. package/dist/application-CmXOqTaK.mjs.map +1 -0
  8. package/dist/assert-WeXvmG4j.mjs +2 -0
  9. package/dist/{assert-DBxo8jPo.mjs.map → assert-WeXvmG4j.mjs.map} +1 -1
  10. package/dist/authconnection-CynFBIv8.mjs +2 -0
  11. package/dist/{authconnection-CZvi9ANm.mjs.map → authconnection-CynFBIv8.mjs.map} +1 -1
  12. package/dist/brand-C8nMKhJC.mjs +2 -0
  13. package/dist/{brand-Eo4pLXPJ.mjs.map → brand-C8nMKhJC.mjs.map} +1 -1
  14. package/dist/cli/commands/api/index.d.mts +1 -1
  15. package/dist/cli/commands/deploy/deploy.d.mts +2 -2
  16. package/dist/cli/commands/deploy/deployment-target.d.mts +2 -0
  17. package/dist/cli/commands/deploy/event-subscriptions.d.mts +3 -0
  18. package/dist/cli/commands/deploy/tailordb/apply.d.mts +3 -0
  19. package/dist/cli/commands/deploy/tailordb/index.d.mts +3 -10
  20. package/dist/cli/commands/deploy/tailordb/migration-validation.d.mts +5 -0
  21. package/dist/cli/commands/deploy/tailordb/plan.d.mts +8 -0
  22. package/dist/cli/commands/executor/jobs.d.mts +1 -1
  23. package/dist/cli/commands/executor/trigger.d.mts +1 -1
  24. package/dist/cli/commands/generate/seed/bundler.d.mts +2 -2
  25. package/dist/cli/commands/show.d.mts +1 -1
  26. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -11
  27. package/dist/cli/commands/tailordb/migrate/generate.d.mts +4 -0
  28. package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +1 -1
  29. package/dist/cli/commands/tailordb/migrate/snapshot-comparison.d.mts +43 -0
  30. package/dist/cli/commands/tailordb/migrate/snapshot-files.d.mts +62 -0
  31. package/dist/cli/commands/tailordb/migrate/snapshot-local.d.mts +12 -0
  32. package/dist/cli/commands/tailordb/migrate/snapshot-migrations.d.mts +12 -0
  33. package/dist/cli/commands/tailordb/migrate/snapshot-remote.d.mts +1 -0
  34. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +3 -1
  35. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +5 -117
  36. package/dist/cli/commands/workflow/start.d.mts +1 -1
  37. package/dist/cli/commands/workspace/list.d.mts +1 -1
  38. package/dist/cli/lib.d.mts +12 -4
  39. package/dist/cli/lib.mjs +1 -9
  40. package/dist/cli/lib.mjs.map +1 -1
  41. package/dist/cli/main.d.mts +2 -0
  42. package/dist/cli/main.mjs +1170 -7754
  43. package/dist/cli/main.mjs.map +1 -1
  44. package/dist/cli/shared/args.d.mts +65 -1
  45. package/dist/cli/shared/command.d.mts +11 -0
  46. package/dist/cli/shared/context.d.mts +1 -1
  47. package/dist/cli/shared/logger.d.mts +64 -0
  48. package/dist/cli/shared/script-executor.d.mts +1 -1
  49. package/dist/cli/shared/seed-chunker.d.mts +5 -5
  50. package/dist/completion/zsh-worker.zsh +82 -9
  51. package/dist/configure/config/index.d.mts +1 -1
  52. package/dist/configure/config/types.d.mts +2 -2
  53. package/dist/configure/index.d.mts +48 -12
  54. package/dist/configure/index.mjs +1 -1267
  55. package/dist/configure/index.mjs.map +1 -1
  56. package/dist/configure/services/auth/types.d.mts +1 -1
  57. package/dist/configure/services/idp/types.d.mts +1 -1
  58. package/dist/configure/services/tailordb/schema.d.mts +22 -8
  59. package/dist/configure/services/tailordb/types.d.mts +2 -2
  60. package/dist/configure/services/workflow/execution-policy.d.mts +3 -3
  61. package/dist/configure/services/workflow/job.d.mts +12 -2
  62. package/dist/configure/types/field.types.d.mts +1 -1
  63. package/dist/configure/types/permission-operand.types.d.mts +1 -1
  64. package/dist/context-D0QjfxzD.mjs +2 -0
  65. package/dist/{context-DYQVYWqZ.mjs.map → context-D0QjfxzD.mjs.map} +1 -1
  66. package/dist/crashreport-BN28xp5B.mjs +42 -0
  67. package/dist/{crashreport-Q0pDAlrj.mjs.map → crashreport-BN28xp5B.mjs.map} +1 -1
  68. package/dist/crashreport-By23O2k-.mjs +1 -0
  69. package/dist/errors-DLsQ_-ol.mjs +2 -0
  70. package/dist/errors-DLsQ_-ol.mjs.map +1 -0
  71. package/dist/es-builtins-n3wBv4Sv.mjs +2 -0
  72. package/dist/es-builtins-n3wBv4Sv.mjs.map +1 -0
  73. package/dist/file-COPYfju_.mjs +2 -0
  74. package/dist/file-COPYfju_.mjs.map +1 -0
  75. package/dist/globals-CMHSnj4w.mjs +2 -0
  76. package/dist/{globals-B2nlxBrz.mjs.map → globals-CMHSnj4w.mjs.map} +1 -1
  77. package/dist/iconv-DlFMt2gW.mjs +2 -0
  78. package/dist/{iconv-QWaZh0TT.mjs.map → iconv-DlFMt2gW.mjs.map} +1 -1
  79. package/dist/idp-G_ojPBB5.mjs +2 -0
  80. package/dist/{idp-RA_swu-h.mjs.map → idp-G_ojPBB5.mjs.map} +1 -1
  81. package/dist/interceptor-DQg3cR_9.mjs +2 -0
  82. package/dist/{interceptor-e33JtsC-.mjs.map → interceptor-DQg3cR_9.mjs.map} +1 -1
  83. package/dist/kysely/index.mjs +1 -32
  84. package/dist/kysely/index.mjs.map +1 -1
  85. package/dist/kysely-type-BTi3BMtL.mjs +43 -0
  86. package/dist/kysely-type-BTi3BMtL.mjs.map +1 -0
  87. package/dist/logger-CCjs1DuH.mjs +9 -0
  88. package/dist/logger-CCjs1DuH.mjs.map +1 -0
  89. package/dist/logger-DP2BjQ93.mjs +2 -0
  90. package/dist/{logger-BtX0suGY.mjs.map → logger-DP2BjQ93.mjs.map} +1 -1
  91. package/dist/multiline-EyzjEwn9.mjs +3 -0
  92. package/dist/{multiline-sfHpTZZK.mjs.map → multiline-EyzjEwn9.mjs.map} +1 -1
  93. package/dist/node-builtins-oBl7EbyV.mjs +2 -0
  94. package/dist/{node-builtins-CmaL2Cbq.mjs.map → node-builtins-oBl7EbyV.mjs.map} +1 -1
  95. package/dist/package-json-C690ceex.mjs +2 -0
  96. package/dist/{package-json-8b0O9TlX.mjs.map → package-json-C690ceex.mjs.map} +1 -1
  97. package/dist/package-json-CmqhDJ__.mjs +1 -0
  98. package/dist/parser/service/tailordb/type-source.d.mts +5 -5
  99. package/dist/parser/service/tailordb/types.d.mts +4 -4
  100. package/dist/platform-serialize-DkiTdHOt.mjs +2 -0
  101. package/dist/{platform-serialize-RoRtBS0v.mjs.map → platform-serialize-DkiTdHOt.mjs.map} +1 -1
  102. package/dist/plugin/builtin/enum-constants/index.mjs +5 -114
  103. package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -1
  104. package/dist/plugin/builtin/file-utils/index.mjs +22 -104
  105. package/dist/plugin/builtin/file-utils/index.mjs.map +1 -1
  106. package/dist/plugin/builtin/kysely-type/index.d.mts +8 -1
  107. package/dist/plugin/builtin/kysely-type/index.mjs +1 -275
  108. package/dist/plugin/builtin/seed/index.d.mts +5 -0
  109. package/dist/plugin/builtin/seed/index.mjs +1 -3
  110. package/dist/plugin/builtin/seed/seed-type-processor.d.mts +0 -2
  111. package/dist/plugin/{get-generated-type.d.mts → get-generated-table.d.mts} +5 -5
  112. package/dist/plugin/index.d.mts +3 -2
  113. package/dist/plugin/index.mjs +1 -251
  114. package/dist/plugin/index.mjs.map +1 -1
  115. package/dist/plugin/types.d.mts +30 -23
  116. package/dist/plugin/with-context.d.mts +3 -3
  117. package/dist/register-ts-hook-oDA2JLp2.mjs +640 -0
  118. package/dist/register-ts-hook-oDA2JLp2.mjs.map +1 -0
  119. package/dist/registry-HlEaGvl5.mjs +2 -0
  120. package/dist/{registry-BIGVUrMB.mjs.map → registry-HlEaGvl5.mjs.map} +1 -1
  121. package/dist/repl-editor-BG1aDOfH.mjs +2 -0
  122. package/dist/{repl-editor-F9LotMNx.mjs.map → repl-editor-BG1aDOfH.mjs.map} +1 -1
  123. package/dist/runtime/aigateway.mjs +1 -3
  124. package/dist/runtime/authconnection.mjs +1 -3
  125. package/dist/runtime/context.mjs +1 -3
  126. package/dist/runtime/file.d.mts +21 -21
  127. package/dist/runtime/file.mjs +1 -3
  128. package/dist/runtime/globals.mjs +1 -1
  129. package/dist/runtime/iconv.mjs +1 -3
  130. package/dist/runtime/idp.mjs +1 -3
  131. package/dist/runtime/index.mjs +1 -11
  132. package/dist/runtime/logger.mjs +1 -3
  133. package/dist/runtime/secretmanager.mjs +1 -3
  134. package/dist/runtime/types.d.mts +1 -1
  135. package/dist/runtime/workflow.mjs +1 -3
  136. package/dist/schema-AYG4OhXY.mjs +2 -0
  137. package/dist/schema-AYG4OhXY.mjs.map +1 -0
  138. package/dist/secret-file-C9wp_FCX.mjs +2 -0
  139. package/dist/{secret-file-C3J4Gy8r.mjs.map → secret-file-C9wp_FCX.mjs.map} +1 -1
  140. package/dist/secretmanager-5olfnI1b.mjs +2 -0
  141. package/dist/{secretmanager-IY4UvinW.mjs.map → secretmanager-5olfnI1b.mjs.map} +1 -1
  142. package/dist/secretmanager-vHQoXdQz.mjs +2 -0
  143. package/dist/{secretmanager-CYlpffsz.mjs.map → secretmanager-vHQoXdQz.mjs.map} +1 -1
  144. package/dist/seed/index.mjs +8 -244
  145. package/dist/seed/index.mjs.map +1 -1
  146. package/dist/seed-DwqRFdqP.mjs +207 -0
  147. package/dist/seed-DwqRFdqP.mjs.map +1 -0
  148. package/dist/service-CLPMoj9n.mjs +2 -0
  149. package/dist/{service-LTfp03ZZ.mjs.map → service-CLPMoj9n.mjs.map} +1 -1
  150. package/dist/service-D7iXk0BT.mjs +1 -0
  151. package/dist/service-YqDsHmlK.mjs +7 -0
  152. package/dist/service-YqDsHmlK.mjs.map +1 -0
  153. package/dist/service_pb-DGKCLuAs.mjs +2 -0
  154. package/dist/{service_pb-BEWj1pOV.mjs.map → service_pb-DGKCLuAs.mjs.map} +1 -1
  155. package/dist/service_pb-_aeFE-Nv.mjs +1 -0
  156. package/dist/shared/src/color.d.mts +5 -0
  157. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +1 -1
  158. package/dist/telemetry-Bklv9kQY.mjs +2 -0
  159. package/dist/{telemetry-BRVdwh14.mjs.map → telemetry-Bklv9kQY.mjs.map} +1 -1
  160. package/dist/telemetry-DXHP3VVi.mjs +1 -0
  161. package/dist/type-source--ZNcV8RJ.mjs +2 -0
  162. package/dist/type-source--ZNcV8RJ.mjs.map +1 -0
  163. package/dist/types/executor.generated.d.mts +1 -1
  164. package/dist/user-agent-vdHYF3QL.mjs +2 -0
  165. package/dist/{user-agent-Bgsszb5I.mjs.map → user-agent-vdHYF3QL.mjs.map} +1 -1
  166. package/dist/utils/test/index.mjs +1 -109
  167. package/dist/utils/test/index.mjs.map +1 -1
  168. package/dist/vitest/environment.mjs +1 -41
  169. package/dist/vitest/environment.mjs.map +1 -1
  170. package/dist/vitest/index.mjs +1 -1986
  171. package/dist/vitest/index.mjs.map +1 -1
  172. package/dist/vitest/mocks/file.d.mts +8 -8
  173. package/dist/vitest/setup.mjs +1 -140
  174. package/dist/vitest/setup.mjs.map +1 -1
  175. package/dist/wait-point-invoker-eiP-IIux.mjs +2 -0
  176. package/dist/wait-point-invoker-eiP-IIux.mjs.map +1 -0
  177. package/dist/wait-point-registry-B-ESkTZX.mjs +2 -0
  178. package/dist/wait-point-registry-B-ESkTZX.mjs.map +1 -0
  179. package/dist/workflow-Cs9ISw6j.mjs +2 -0
  180. package/dist/{workflow-Bamae_Yc.mjs.map → workflow-Cs9ISw6j.mjs.map} +1 -1
  181. package/dist/workspace_resource_pb--GeYQPXu.mjs +2 -0
  182. package/dist/{workspace_resource_pb-HNIL_Vfj.mjs.map → workspace_resource_pb--GeYQPXu.mjs.map} +1 -1
  183. package/docs/cli/function.md +66 -6
  184. package/docs/cli/setup.md +24 -14
  185. package/docs/cli/tailordb.md +2 -0
  186. package/docs/cli-reference.md +9 -8
  187. package/docs/github-actions.md +14 -12
  188. package/docs/migration/v2.md +18 -2
  189. package/docs/migration/v3.md +121 -0
  190. package/docs/plugin/custom.md +130 -85
  191. package/docs/plugin/index.md +3 -3
  192. package/docs/services/tailordb-migration.md +21 -7
  193. package/docs/services/tailordb.md +9 -7
  194. package/docs/services/workflow.md +10 -9
  195. package/package.json +14 -13
  196. package/postinstall.mjs +1 -1
  197. package/dist/aigateway-DR4Kwuik.mjs +0 -9
  198. package/dist/application-C8a0UJ-z.mjs +0 -6071
  199. package/dist/application-C8a0UJ-z.mjs.map +0 -1
  200. package/dist/application-D4zOiLLa.mjs +0 -3
  201. package/dist/assert-DBxo8jPo.mjs +0 -9
  202. package/dist/authconnection-CZvi9ANm.mjs +0 -9
  203. package/dist/brand-Eo4pLXPJ.mjs +0 -36
  204. package/dist/context-DYQVYWqZ.mjs +0 -23
  205. package/dist/crashreport-Cd4TqfZq.mjs +0 -3
  206. package/dist/crashreport-Q0pDAlrj.mjs +0 -427
  207. package/dist/errors-Bxut5_Sy.mjs +0 -89
  208. package/dist/errors-Bxut5_Sy.mjs.map +0 -1
  209. package/dist/file-BUcmVIH2.mjs +0 -58
  210. package/dist/file-BUcmVIH2.mjs.map +0 -1
  211. package/dist/globals-B2nlxBrz.mjs +0 -126
  212. package/dist/iconv-QWaZh0TT.mjs +0 -38
  213. package/dist/idp-RA_swu-h.mjs +0 -82
  214. package/dist/interceptor-e33JtsC-.mjs +0 -33
  215. package/dist/logger-BtX0suGY.mjs +0 -48
  216. package/dist/logger-D0bEznPv.mjs +0 -362
  217. package/dist/logger-D0bEznPv.mjs.map +0 -1
  218. package/dist/multiline-sfHpTZZK.mjs +0 -38
  219. package/dist/node-builtins-CmaL2Cbq.mjs +0 -36
  220. package/dist/package-json-8b0O9TlX.mjs +0 -17
  221. package/dist/package-json-Cv2Z-TqQ.mjs +0 -3
  222. package/dist/platform-serialize-RoRtBS0v.mjs +0 -46
  223. package/dist/plugin/builtin/kysely-type/index.mjs.map +0 -1
  224. package/dist/plugin/builtin/seed/types.d.mts +0 -2
  225. package/dist/register-ts-hook-Vqjza10T.mjs +0 -25679
  226. package/dist/register-ts-hook-Vqjza10T.mjs.map +0 -1
  227. package/dist/registry-BIGVUrMB.mjs +0 -54
  228. package/dist/repl-editor-F9LotMNx.mjs +0 -252
  229. package/dist/schema-D4TC4BC3.mjs +0 -640
  230. package/dist/schema-D4TC4BC3.mjs.map +0 -1
  231. package/dist/secret-file-C3J4Gy8r.mjs +0 -64
  232. package/dist/secretmanager-CYlpffsz.mjs +0 -13
  233. package/dist/secretmanager-IY4UvinW.mjs +0 -131
  234. package/dist/seed-Cibjmtry.mjs +0 -489
  235. package/dist/seed-Cibjmtry.mjs.map +0 -1
  236. package/dist/service-2grcAOCJ.mjs +0 -898
  237. package/dist/service-2grcAOCJ.mjs.map +0 -1
  238. package/dist/service-CaBPNDIZ.mjs +0 -3
  239. package/dist/service-LTfp03ZZ.mjs +0 -133
  240. package/dist/service_pb-BEWj1pOV.mjs +0 -167
  241. package/dist/service_pb-BjlhvK9E.mjs +0 -3
  242. package/dist/telemetry-BRVdwh14.mjs +0 -84
  243. package/dist/telemetry-CkbkeJxl.mjs +0 -3
  244. package/dist/type-source-DH_LH20p.mjs +0 -13
  245. package/dist/type-source-DH_LH20p.mjs.map +0 -1
  246. package/dist/user-agent-Bgsszb5I.mjs +0 -28
  247. package/dist/wait-point-invoker-__oE88_P.mjs +0 -148
  248. package/dist/wait-point-invoker-__oE88_P.mjs.map +0 -1
  249. package/dist/wait-point-registry-TL99zotw.mjs +0 -47
  250. package/dist/wait-point-registry-TL99zotw.mjs.map +0 -1
  251. package/dist/workflow-Bamae_Yc.mjs +0 -34
  252. package/dist/workspace_resource_pb-HNIL_Vfj.mjs +0 -860
@@ -16,12 +16,13 @@ See [Global Options](../cli-reference.md#global-options) for options available t
16
16
 
17
17
  **Commands**
18
18
 
19
- | Command | Aliases | Description |
20
- | --------------------------------- | ---------- | --------------------------------------------------------------- |
21
- | [`function get`](#function-get) | - | Get a function registry by name |
22
- | [`function list`](#function-list) | - | List function registries in a workspace |
23
- | [`function logs`](#function-logs) | - | List or get function execution logs. |
24
- | [`function run`](#function-run) | `test-run` | Run a function on the Tailor Platform server without deploying. |
19
+ | Command | Aliases | Description |
20
+ | ------------------------------------- | ---------- | --------------------------------------------------------------- |
21
+ | [`function get`](#function-get) | - | Get a function registry by name |
22
+ | [`function list`](#function-list) | - | List function registries in a workspace |
23
+ | [`function logs`](#function-logs) | - | List or get function execution logs. |
24
+ | [`function run`](#function-run) | `test-run` | Run a function on the Tailor Platform server without deploying. |
25
+ | [`function script`](#function-script) | - | Scaffold a one-off script to run with `function run`. |
25
26
 
26
27
  ### function get
27
28
 
@@ -151,6 +152,7 @@ tailor function run [options] <file>
151
152
  | `--arg <ARG>` | `-a` | JSON argument to pass to the function | No | - | - |
152
153
  | `--machine-user <MACHINE_USER>` | `-m` | Machine user name for authentication. Falls back to the active profile's default machine user. | No | - | `TAILOR_PLATFORM_MACHINE_USER_NAME` |
153
154
  | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | - |
155
+ | `--allow-schema-drift` | - | Run a scaffolded script even when its schema snapshot no longer matches | No | `false` | - |
154
156
 
155
157
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
156
158
 
@@ -179,8 +181,66 @@ $ tailor function run build/resolvers/add.js --arg '{"a":1,"b":2}'
179
181
  You can pass either a source file (`.ts`) or a pre-bundled file (`.js`).
180
182
  When a `.js` file is provided, detection and bundling are skipped and the file is executed as-is.
181
183
 
184
+ A script scaffolded by `function script` with a generated `db.ts` is checked against its `db.snapshot.json` before execution and refused on schema drift; pass `--allow-schema-drift` to run it anyway. The check compares table and field structure; hook and validator code changes are not detected.
185
+
182
186
  `test-run` is a deprecated alias of this command and will be removed in v3.
183
187
 
184
188
  > [!WARNING]
185
189
  > Workflow job `.start()` calls do not work in this mode.
186
190
  > Started jobs are not executed; only the target job's `body` function runs in isolation.
191
+
192
+ ### function script
193
+
194
+ Scaffold a one-off script to run with `function run`.
195
+
196
+ **Usage**
197
+
198
+ ```
199
+ tailor function script [options] <file>
200
+ ```
201
+
202
+ **Arguments**
203
+
204
+ | Argument | Description | Required |
205
+ | -------- | ------------------------------------------------ | -------- |
206
+ | `file` | Path to create the script at (must end with .ts) | Yes |
207
+
208
+ **Options**
209
+
210
+ | Option | Alias | Description | Required | Default | Env |
211
+ | ------------------------------- | ----- | --------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
212
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
213
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
214
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
215
+ | `--namespace <NAMESPACE>` | - | Target TailorDB namespace (required when the config does not pin one) | No | - | - |
216
+ | `--remote` | - | Generate script-scoped DB types from the deployed schema | No | `false` | - |
217
+
218
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
219
+
220
+ **Examples**
221
+
222
+ **Scaffold a one-off script (single-namespace project)**
223
+
224
+ ```bash
225
+ $ tailor function script scripts/fix-prices.ts
226
+ ```
227
+
228
+ **Scaffold a script targeting a specific namespace**
229
+
230
+ ```bash
231
+ $ tailor function script scripts/fix-prices.ts --namespace tailordb
232
+ ```
233
+
234
+ **Scaffold from a deployed or external namespace**
235
+
236
+ ```bash
237
+ $ tailor function script scripts/fix-prices.ts --namespace shared --remote
238
+ ```
239
+
240
+ **Notes**
241
+
242
+ The scaffolded script is a plain default-exported function; execute it with `tailor function run <file>`.
243
+
244
+ By default, when the project configures `kyselyTypePlugin`, the skeleton imports `getDB()` from the plugin's generated types. Without the plugin, the command uses the namespace's local table definitions to write a script-scoped `db.ts` plus a `db.snapshot.json` next to the script; `function run` refuses to run the script when that snapshot no longer matches the deployed or locally defined table and field structure.
245
+
246
+ Pass `--remote` to generate the script-scoped files from the deployed schema instead, even when `kyselyTypePlugin` is configured. This is required for an external namespace. Re-running the command refreshes `db.ts` and `db.snapshot.json` from the selected source and leaves the script itself untouched.
package/docs/cli/setup.md CHANGED
@@ -23,7 +23,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
23
23
  | [`setup preview`](#setup-preview) | Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace). |
24
24
  | [`setup action`](#setup-action) | Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys). |
25
25
  | [`setup coordinate`](#setup-coordinate) | Generate a coordinator workflow that orchestrates multiple --action-generated composite actions. |
26
- | [`setup renovate`](#setup-renovate) | Generate a Renovate config for Tailor dependency and workflow updates. |
26
+ | [`setup deps`](#setup-deps) | Generate a dependency update config for Tailor dependency and workflow updates. |
27
27
  | [`setup check`](#setup-check) | Audit generated workflows for drift against the current config/repo (read-only). |
28
28
  | [`setup delete`](#setup-delete) | Delete managed workflow/action file(s) and their .github/tailor.lock entries. |
29
29
 
@@ -63,7 +63,7 @@ tailor setup branch [options]
63
63
  | Option | Alias | Description | Required | Default |
64
64
  | ----------------------------- | ----- | ------------------------------------------------------------------------------ | -------- | ------- |
65
65
  | `--name <NAME>` | `-n` | Name (defaults to the config 'name') | No | - |
66
- | `--branch <BRANCH>` | - | Deploy trigger branch (defaults to the detected default branch) | No | - |
66
+ | `--target <TARGET>` | - | Deploy trigger branch (defaults to the detected default branch) | No | - |
67
67
  | `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
68
68
  | `--erd-preview` | - | Add PR ERD viewer artifacts with current/diff previews for TailorDB namespaces | No | `false` |
69
69
  | `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
@@ -71,6 +71,10 @@ tailor setup branch [options]
71
71
 
72
72
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
73
73
 
74
+ **Notes**
75
+
76
+ `--branch` is a deprecated alias of `--target` and will be removed in v3.
77
+
74
78
  ### setup check
75
79
 
76
80
  Audit generated workflows for drift against the current config/repo (read-only).
@@ -136,6 +140,24 @@ tailor setup delete [options] <files>
136
140
 
137
141
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
138
142
 
143
+ ### setup deps
144
+
145
+ Generate a dependency update config for Tailor dependency and workflow updates.
146
+
147
+ **Usage**
148
+
149
+ ```
150
+ tailor setup deps [options]
151
+ ```
152
+
153
+ **Options**
154
+
155
+ | Option | Alias | Description | Required | Default |
156
+ | ----------------------- | ----- | --------------------------------------- | -------- | ------------ |
157
+ | `--provider <PROVIDER>` | - | Dependency update provider to configure | No | `"renovate"` |
158
+
159
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
160
+
139
161
  ### setup preview
140
162
 
141
163
  Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace).
@@ -160,18 +182,6 @@ tailor setup preview [options]
160
182
 
161
183
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
162
184
 
163
- ### setup renovate
164
-
165
- Generate a Renovate config for Tailor dependency and workflow updates.
166
-
167
- **Usage**
168
-
169
- ```
170
- tailor setup renovate
171
- ```
172
-
173
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
174
-
175
185
  ### setup tag
176
186
 
177
187
  Generate a tag-target deploy workflow (tag push triggers deploy).
@@ -125,6 +125,8 @@ tailor tailordb migration generate [options]
125
125
  | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
126
126
  | `--name <NAME>` | `-n` | Optional description for the migration | No | - | - |
127
127
  | `--init` | - | Delete existing migrations and start fresh | No | `false` | - |
128
+ | `--data-only` | - | Create a migration with no schema changes whose migration script runs a standalone data transformation | No | `false` | - |
129
+ | `--namespace <NAMESPACE>` | - | Target TailorDB namespace for --data-only (required if multiple namespaces exist) | No | - | - |
128
130
  | `--rename <RENAME>` | - | Record a field or table rename instead of remove + add (format: "Table.oldField:newField" or "OldTable:NewTable"; repeatable). Renames require a migration script that copies the data. | No | - | - |
129
131
  | `--drop <DROP>` | - | Confirm that a removed field or table is a genuine removal, not a rename (format: "Table.field" or "Table"; repeatable). Required in non-interactive runs for a removal with rename candidates. | No | - | - |
130
132
  | `--expand-contract <EXPAND_CONTRACT>` | - | Convert a field type through a temporary field (format: "Table.field"; repeatable). Generates two migrations. | No | - | - |
@@ -323,13 +323,14 @@ Commands for managing workflows and executions.
323
323
 
324
324
  Commands for managing function registries and viewing function execution logs.
325
325
 
326
- | Command | Description |
327
- | ------------------------------------------------ | --------------------------------------------------------------- |
328
- | [function](./cli/function.md#function) | Manage functions |
329
- | [function get](./cli/function.md#function-get) | Get a function registry by name |
330
- | [function list](./cli/function.md#function-list) | List function registries in a workspace |
331
- | [function logs](./cli/function.md#function-logs) | List or get function execution logs. |
332
- | [function run](./cli/function.md#function-run) | Run a function on the Tailor Platform server without deploying. |
326
+ | Command | Description |
327
+ | ---------------------------------------------------- | --------------------------------------------------------------- |
328
+ | [function](./cli/function.md#function) | Manage functions |
329
+ | [function get](./cli/function.md#function-get) | Get a function registry by name |
330
+ | [function list](./cli/function.md#function-list) | List function registries in a workspace |
331
+ | [function logs](./cli/function.md#function-logs) | List or get function execution logs. |
332
+ | [function run](./cli/function.md#function-run) | Run a function on the Tailor Platform server without deploying. |
333
+ | [function script](./cli/function.md#function-script) | Scaffold a one-off script to run with `function run`. |
333
334
 
334
335
  ### [Executor Commands](./cli/executor.md)
335
336
 
@@ -397,8 +398,8 @@ Commands for setting up project infrastructure.
397
398
  | [setup check](./cli/setup.md#setup-check) | Audit generated workflows for drift against the current config/repo (read-only). |
398
399
  | [setup coordinate](./cli/setup.md#setup-coordinate) | Generate a coordinator workflow that orchestrates multiple --action-generated composite actions. |
399
400
  | [setup delete](./cli/setup.md#setup-delete) | Delete managed workflow/action file(s) and their .github/tailor.lock entries. |
401
+ | [setup deps](./cli/setup.md#setup-deps) | Generate a dependency update config for Tailor dependency and workflow updates. |
400
402
  | [setup preview](./cli/setup.md#setup-preview) | Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace). |
401
- | [setup renovate](./cli/setup.md#setup-renovate) | Generate a Renovate config for Tailor dependency and workflow updates. |
402
403
  | [setup tag](./cli/setup.md#setup-tag) | Generate a tag-target deploy workflow (tag push triggers deploy). |
403
404
 
404
405
  ### [Upgrade Commands](./cli/upgrade.md)
@@ -38,12 +38,13 @@ Run `setup` once per target.
38
38
  ### Branch target (recommended for staging)
39
39
 
40
40
  The branch target fires on pull requests and pushes to the branch you specify
41
- (defaulting to the repository's default branch when `--branch` is omitted):
41
+ (defaulting to the repository's default branch when `--target` is
42
+ omitted):
42
43
 
43
44
  ```bash
44
45
  tailor setup branch --name my-app-stg
45
46
  # Equivalent to:
46
- tailor setup branch --name my-app-stg --branch main
47
+ tailor setup branch --name my-app-stg --target main
47
48
  ```
48
49
 
49
50
  What it does:
@@ -120,12 +121,12 @@ What it does:
120
121
 
121
122
  ### Choosing `--branch` for the tag target
122
123
 
123
- `--branch` has two different roles depending on the target kind:
124
+ The branch each target reads plays a different role, under a different flag:
124
125
 
125
- | Target | Role of `--branch` |
126
- | ------ | ---------------------------------------------------------------------------------------------- |
127
- | Branch | The branch that triggers the workflow (push + PR base). Defaults to the repo's default branch. |
128
- | Tag | The branch whose history the tag must be reachable from. Omit to disable the guard entirely. |
126
+ | Target | Flag | Role |
127
+ | ------ | ---------- | ---------------------------------------------------------------------------------------------- |
128
+ | Branch | `--target` | The branch that triggers the workflow (push + PR base). Defaults to the repo's default branch. |
129
+ | Tag | `--branch` | The branch whose history the tag must be reachable from. Omit to disable the guard entirely. |
129
130
 
130
131
  The workspace name (`--name`, or the config `name` when omitted) must
131
132
  be 3–63 characters of lowercase letters, numbers, and hyphens, and cannot start
@@ -365,7 +366,7 @@ Commit both workflow files and `.github/tailor.lock`.
365
366
  Run this command once from the repository root to add Renovate configuration:
366
367
 
367
368
  ```bash
368
- tailor setup renovate
369
+ tailor setup deps
369
370
  ```
370
371
 
371
372
  It generates `renovate.json`, which extends Tailor's shared Renovate preset. The
@@ -382,12 +383,13 @@ standard root, `.github`, `.gitlab`, and `.renovaterc` locations, including the
382
383
  deprecated `package.json` configuration. When that configuration already extends
383
384
  the preset, the command reports that Renovate is set up and changes nothing.
384
385
 
385
- Configuration written in JSON5 or JSONC with comments or trailing commas —
386
- cannot be edited without losing those comments, so the command leaves it
387
- unchanged and asks you to add the preset to its `extends` array yourself.
386
+ JSONC and JSON5 configurations are updated in place while preserving their
387
+ comments and formatting. Configurations that Renovate itself cannot load such
388
+ as invalid syntax, or duplicate keys outside JSON5 are left unchanged and
389
+ reported for manual inspection.
388
390
 
389
391
  `renovate.json` is yours to edit — it is not tracked in `.github/tailor.lock`.
390
- Add your own rules freely; re-running `tailor setup renovate` does not overwrite
392
+ Add your own rules freely; re-running `tailor setup deps` does not overwrite
391
393
  them. To remove it, delete the file.
392
394
 
393
395
  Renovate updates the SDK dependency and action pins, but it does not regenerate
@@ -661,7 +661,7 @@ After:
661
661
  ```ts
662
662
  ownerId: db.uuid().relation({
663
663
  type: "n-1",
664
- toward: { type: user, as: "user" },
664
+ toward: { table: user, as: "user" },
665
665
  }),
666
666
  ```
667
667
 
@@ -878,6 +878,10 @@ Also review, and migrate by hand:
878
878
  - An invoker option passed via a variable or spread (not a literal object) —
879
879
  the codemod only inspects literal object arguments; rename the invoker key
880
880
  to authInvoker in the options object's own definition.
881
+ - A renamed triggerJobFunction call whose target is another workflow job —
882
+ rewrite it further to that job's own .start() method (e.g. worker.start(args)).
883
+ Calling execJobFunction directly is not detected as a build-time dependency
884
+ and fails the build.
881
885
  ```
882
886
 
883
887
  </details>
@@ -924,6 +928,10 @@ Also review, and migrate by hand:
924
928
  instead; the alias was the same mock function.
925
929
  - A file that already imports ExecJobFunctionOptions alongside the removed type —
926
930
  rename the remaining references by hand and drop the duplicate specifier.
931
+ - A renamed call whose target is another workflow job — rewrite it further to
932
+ that job's own .start() method (e.g. worker.start(args)). Calling
933
+ execJobFunction directly is not detected as a build-time dependency and fails
934
+ the build.
927
935
  ```
928
936
 
929
937
  </details>
@@ -1661,10 +1669,18 @@ The CLI stores human users by their stable subject ID instead of email (email is
1661
1669
 
1662
1670
  `tailor function logs` maps stack traces against the function bundle only when the execution recorded a `contentHash`. Executions without one now show raw stack traces instead of mapped frames. No source change is required.
1663
1671
 
1672
+ ### `db.fields.timestamps()`: `updatedAt` becomes required
1673
+
1674
+ The `updatedAt` field from `db.fields.timestamps()` changes from optional to required (non-null): it defaults to the current time and keeps refreshing automatically on every update, though a value you provide explicitly is still respected. Applying this change to a table that already has rows with `updatedAt: null` makes `deploy` fail with `field "updatedAt" cannot be updated from non-required to required when records with null values exist`. Backfill those rows first, e.g. `UPDATE <table> SET "updatedAt" = "createdAt" WHERE "updatedAt" IS NULL` for each affected table — see [TailorDB migrations](../services/tailordb-migration.md#performance-and-large-tables) for splitting a large backfill across primary-key ranges if a single `UPDATE` times out.
1675
+
1664
1676
  ### Node.js minimum version raised to 22.15.0
1665
1677
 
1666
- v2 requires Node.js **22.15.0** or later. This is the first version that includes `module.registerHooks()`, which the SDK uses to register its TypeScript loader hook synchronously in the main thread. The actual floor is now **22.18.0**: Node 22.15.0–22.17.x has a bug ([nodejs/node#58607](https://github.com/nodejs/node/issues/58607)) that crashes `tailor seed validate` when requiring `node:`-scheme-only builtins such as `node:sqlite`, fixed upstream in 22.18.0. No source change is required; ensure your environment runs Node.js 22.18.0+.
1678
+ v2 requires Node.js **22.15.0** or later. This is the first version that includes `module.registerHooks()`, which the SDK uses to register its TypeScript loader hook synchronously in the main thread. The actual floor is now **22.18.0**: Node 22.15.0–22.17.x has a bug that crashes `tailor seed validate` when requiring `node:`-scheme-only builtins such as `node:sqlite`, fixed upstream by [nodejs/node#58612](https://github.com/nodejs/node/pull/58612) in 22.18.0. No source change is required; ensure your environment runs Node.js 22.18.0+.
1667
1679
 
1668
1680
  ### Legacy bundle artifact cleanup removed from deploy
1669
1681
 
1670
1682
  `tailor deploy` no longer deletes on-disk bundle artifacts (`.entry.js` files, workflow-job bundles, and the `hooks-validate-scripts/` directory) left in the SDK output directory (`.tailor` by default) by SDK versions that predate the current in-memory bundling approach. Current bundlers no longer write these files. No source change is required; if such stale files remain from a very old SDK version, delete only those specific files/directories manually — do not delete the output directory itself, since it also holds deploy state (e.g. `secrets-state/`, `*.context.json`) that existing secrets and Auth Connections depend on.
1683
+
1684
+ ### First v2 deploy to a v1-deployed environment needs migration sync
1685
+
1686
+ The pre-v2 CLI never wrote a script hash into deployed schemas, so the first `tailor deploy` against an environment last deployed with it reports `Remote schema drift detected` with every scripted type showing `has no script hash on remote`. Run `tailor tailordb migration sync <current migration number>` once for that environment to write the missing hashes, then `tailor deploy` as usual. Preview/PR workspaces don't hit this, since they're built with v2 from the start. No source change is required.
@@ -8,6 +8,55 @@ Run the codemods, then finish anything reported as not migrated automatically:
8
8
  npx @tailor-platform/sdk-codemod --from <current-version> --to <target-version>
9
9
  ```
10
10
 
11
+ ## workflow.execJobFunction (imported) removed — use job.start()
12
+
13
+ **Migration:** Manual
14
+
15
+ `execJobFunction` on the `workflow` value imported from @tailor-platform/sdk/runtime(/workflow) is removed in v3. Calling it directly from a workflow job body to reach another job is not detected as a build-time dependency and has no working use; the target job's own `.start()` method is the only supported way to call it. This does not affect the ambient `tailor.workflow.execJobFunction` global — that's what `.start()` itself compiles down to at build time, and it remains fully supported.
16
+
17
+ Before:
18
+
19
+ ```ts
20
+ import { workflow } from "@tailor-platform/sdk/runtime";
21
+
22
+ await workflow.execJobFunction("worker", { id: 1 });
23
+ ```
24
+
25
+ After:
26
+
27
+ ```ts
28
+ import { worker } from "./jobs/worker";
29
+
30
+ await worker.start({ id: 1 });
31
+ ```
32
+
33
+ <details>
34
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
35
+
36
+ ```text
37
+ workflow.execJobFunction — the value imported from
38
+ @tailor-platform/sdk/runtime or @tailor-platform/sdk/runtime/workflow — is
39
+ removed in v3. Replace each call with the target job's own .start() method:
40
+ import the WorkflowJob the call names and call <job>.start(args, options)
41
+ instead of workflow.execJobFunction("<job-name>", args, options).
42
+
43
+ This only removes the re-export from @tailor-platform/sdk/runtime. It does
44
+ not affect the ambient tailor.workflow.execJobFunction global, which stays
45
+ fully supported and is what .start() itself compiles down to at build time.
46
+ This codemod does not rewrite ambient tailor.workflow.execJobFunction(...)
47
+ call sites, since removing the import re-export does not affect them — but
48
+ if such a call site sits inside workflow job source and calls another job
49
+ by name, a separate build-time check already rejects it; migrate that call
50
+ to the target job's own .start() method too.
51
+
52
+ If the job name passed to execJobFunction is not a string literal (a truly
53
+ dynamic dispatch), there is currently no supported replacement — .start()
54
+ only targets a statically known job. Flag this case for a human instead of
55
+ guessing a rewrite.
56
+ ```
57
+
58
+ </details>
59
+
11
60
  ## function test-run → function run
12
61
 
13
62
  **Migration:** Partially automatic
@@ -39,3 +88,75 @@ unchanged unless it documents a command to type.
39
88
  ```
40
89
 
41
90
  </details>
91
+
92
+ ## setup branch --branch → --target
93
+
94
+ **Migration:** Partially automatic
95
+
96
+ Rename the `--branch` option of `tailor setup branch` invocations to `--target`. `--branch` remains as a deprecated alias until it is removed in v3. The `--branch` option of `setup tag`, `setup preview`, and `setup coordinate` is unchanged.
97
+
98
+ Before:
99
+
100
+ ```sh
101
+ tailor setup branch --name my-app-stg --branch main
102
+ ```
103
+
104
+ After:
105
+
106
+ ```sh
107
+ tailor setup branch --name my-app-stg --target main
108
+ ```
109
+
110
+ <details>
111
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
112
+
113
+ ```text
114
+ The `--branch` option of `tailor setup branch` is renamed to `--target`;
115
+ the old spelling is removed in v3. Replace any remaining `--branch` options of
116
+ `setup branch` invocations the codemod did not rewrite (e.g. wrapped across
117
+ lines or invoked through a package runner such as `npx @tailor-platform/sdk`)
118
+ with `--target`. Do not touch the `--branch` option of `setup tag`,
119
+ `setup preview`, or `setup coordinate`, which keeps its name, and leave prose
120
+ that merely mentions the option unchanged unless it documents a command to type.
121
+ ```
122
+
123
+ </details>
124
+
125
+ ## relation() toward.type → toward.table
126
+
127
+ **Migration:** Partially automatic
128
+
129
+ Rename the `.relation()` option `toward.type` to `toward.table`, matching the `db.type()` → `db.table()` rename. The relation's own `type` (its cardinality, e.g. `"n-1"`) is unchanged — only the target-table reference nested under `toward` moves.
130
+
131
+ Before:
132
+
133
+ ```ts
134
+ customerId: db.uuid().relation({
135
+ type: "n-1",
136
+ toward: { type: customer },
137
+ }),
138
+ ```
139
+
140
+ After:
141
+
142
+ ```ts
143
+ customerId: db.uuid().relation({
144
+ type: "n-1",
145
+ toward: { table: customer },
146
+ }),
147
+ ```
148
+
149
+ <details>
150
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
151
+
152
+ ```text
153
+ In Tailor SDK v3, `.relation()`'s `toward.type` option is renamed to
154
+ `toward.table` (it names a target table, not a TypeScript/GraphQL type).
155
+ Rename any remaining `toward.type` the codemod did not rewrite (e.g. a
156
+ `toward` object reached through a shared variable, spread, or computed
157
+ key) to `toward.table`. Do not touch the relation's own outer `type`
158
+ property, which is the relation's cardinality (e.g. "n-1", "1-1",
159
+ "keyOnly") and keeps its name.
160
+ ```
161
+
162
+ </details>