@tailor-platform/sdk 2.0.0-next.1 → 2.0.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (478) hide show
  1. package/CHANGELOG.md +1056 -24
  2. package/README.md +9 -9
  3. package/agent-skills/{tailor-sdk → tailor}/SKILL.md +3 -1
  4. package/dist/aigateway-DR4Kwuik.mjs +9 -0
  5. package/dist/aigateway-DR4Kwuik.mjs.map +1 -0
  6. package/dist/{application-DqS1yBg3.mjs → application-CM6hKnSK.mjs} +2155 -2008
  7. package/dist/application-CM6hKnSK.mjs.map +1 -0
  8. package/dist/application-CXNaUNhv.mjs +3 -0
  9. package/dist/authconnection-CZvi9ANm.mjs +9 -0
  10. package/dist/authconnection-CZvi9ANm.mjs.map +1 -0
  11. package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
  12. package/dist/cli/cache/bundle-cache.d.mts +2 -0
  13. package/dist/cli/cache/store.d.mts +1 -0
  14. package/dist/cli/cache/types.d.mts +1 -0
  15. package/dist/cli/commands/api/api-call.d.mts +19 -0
  16. package/dist/cli/commands/api/index.d.mts +4 -0
  17. package/dist/cli/commands/deploy/aigateway.d.mts +5 -0
  18. package/dist/cli/commands/deploy/application.d.mts +7 -0
  19. package/dist/cli/commands/deploy/apply-phases.d.mts +14 -0
  20. package/dist/cli/commands/deploy/auth.d.mts +5 -0
  21. package/dist/cli/commands/deploy/deploy.d.mts +35 -0
  22. package/dist/cli/commands/deploy/executor.d.mts +7 -0
  23. package/dist/cli/commands/deploy/function-registry-types.d.mts +12 -0
  24. package/dist/cli/commands/deploy/function-registry.d.mts +6 -0
  25. package/dist/cli/commands/deploy/idp.d.mts +5 -0
  26. package/dist/cli/commands/deploy/label.d.mts +2 -0
  27. package/dist/cli/commands/deploy/resolver.d.mts +5 -0
  28. package/dist/cli/commands/deploy/secret-manager.d.mts +5 -0
  29. package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -0
  30. package/dist/cli/commands/deploy/tailordb/index.d.mts +10 -0
  31. package/dist/cli/commands/deploy/types.d.mts +4 -0
  32. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +2 -0
  33. package/dist/cli/commands/deploy/workflow.d.mts +4 -0
  34. package/dist/cli/commands/executor/get.d.mts +19 -0
  35. package/dist/cli/commands/executor/jobs.d.mts +85 -0
  36. package/dist/cli/commands/executor/list.d.mts +18 -0
  37. package/dist/cli/commands/executor/transform.d.mts +42 -0
  38. package/dist/cli/commands/executor/trigger.d.mts +30 -0
  39. package/dist/cli/commands/executor/webhook.d.mts +21 -0
  40. package/dist/cli/commands/function/get.d.mts +17 -0
  41. package/dist/cli/commands/function/list.d.mts +21 -0
  42. package/dist/cli/commands/function/transform.d.mts +12 -0
  43. package/dist/cli/commands/generate/options.d.mts +6 -0
  44. package/dist/cli/commands/generate/seed/bundler.d.mts +27 -0
  45. package/dist/cli/commands/generate/service.d.mts +15 -0
  46. package/dist/cli/commands/machineuser/list.d.mts +26 -0
  47. package/dist/cli/commands/machineuser/token.d.mts +21 -0
  48. package/dist/cli/commands/oauth2client/get.d.mts +17 -0
  49. package/dist/cli/commands/oauth2client/list.d.mts +19 -0
  50. package/dist/cli/commands/oauth2client/transform.d.mts +21 -0
  51. package/dist/cli/commands/organization/folder/create.d.mts +17 -0
  52. package/dist/cli/commands/organization/folder/delete.d.mts +15 -0
  53. package/dist/cli/commands/organization/folder/get.d.mts +16 -0
  54. package/dist/cli/commands/organization/folder/list.d.mts +21 -0
  55. package/dist/cli/commands/organization/folder/update.d.mts +17 -0
  56. package/dist/cli/commands/organization/get.d.mts +15 -0
  57. package/dist/cli/commands/organization/list.d.mts +14 -0
  58. package/dist/cli/commands/organization/transform.d.mts +29 -0
  59. package/dist/cli/commands/organization/tree.d.mts +24 -0
  60. package/dist/cli/commands/organization/update.d.mts +16 -0
  61. package/dist/cli/commands/remove.d.mts +15 -0
  62. package/dist/cli/commands/show.d.mts +39 -0
  63. package/dist/cli/commands/staticwebsite/deploy.d.mts +19 -0
  64. package/dist/cli/commands/tailordb/migrate/bundler.d.mts +29 -0
  65. package/dist/cli/commands/tailordb/migrate/config.d.mts +18 -0
  66. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +246 -0
  67. package/dist/cli/commands/tailordb/migrate/generate.d.mts +16 -0
  68. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +5 -0
  69. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +208 -0
  70. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +98 -0
  71. package/dist/cli/commands/tailordb/migrate/types.d.mts +7 -0
  72. package/dist/cli/commands/tailordb/truncate.d.mts +18 -0
  73. package/dist/cli/commands/workflow/executions.d.mts +62 -0
  74. package/dist/cli/commands/workflow/get.d.mts +21 -0
  75. package/dist/cli/commands/workflow/list.d.mts +18 -0
  76. package/dist/cli/commands/workflow/resume.d.mts +22 -0
  77. package/dist/cli/commands/workflow/start.d.mts +48 -0
  78. package/dist/cli/commands/workflow/status.d.mts +6 -0
  79. package/dist/cli/commands/workflow/transform.d.mts +34 -0
  80. package/dist/cli/commands/workflow/wait.d.mts +15 -0
  81. package/dist/cli/commands/workflow/waiter.d.mts +23 -0
  82. package/dist/cli/commands/workspace/app/health.d.mts +17 -0
  83. package/dist/cli/commands/workspace/app/list.d.mts +21 -0
  84. package/dist/cli/commands/workspace/app/transform.d.mts +20 -0
  85. package/dist/cli/commands/workspace/create.d.mts +27 -0
  86. package/dist/cli/commands/workspace/delete.d.mts +14 -0
  87. package/dist/cli/commands/workspace/get.d.mts +16 -0
  88. package/dist/cli/commands/workspace/list.d.mts +17 -0
  89. package/dist/cli/commands/workspace/restore.d.mts +14 -0
  90. package/dist/cli/commands/workspace/transform.d.mts +20 -0
  91. package/dist/cli/commands/workspace/user/invite.d.mts +21 -0
  92. package/dist/cli/commands/workspace/user/list.d.mts +21 -0
  93. package/dist/cli/commands/workspace/user/remove.d.mts +16 -0
  94. package/dist/cli/commands/workspace/user/transform.d.mts +9 -0
  95. package/dist/cli/commands/workspace/user/update.d.mts +21 -0
  96. package/dist/cli/index.mjs +12 -5481
  97. package/dist/cli/lib.d.mts +86 -21048
  98. package/dist/cli/lib.mjs +245 -46
  99. package/dist/cli/lib.mjs.map +1 -1
  100. package/dist/cli/main.d.mts +23 -0
  101. package/dist/cli/main.mjs +6777 -0
  102. package/dist/cli/main.mjs.map +1 -0
  103. package/dist/cli/query/index.d.mts +38 -0
  104. package/dist/cli/services/application.d.mts +12 -0
  105. package/dist/cli/services/auth/service.d.mts +3 -0
  106. package/dist/cli/services/executor/service.d.mts +1 -0
  107. package/dist/cli/services/http-adapter/bundler.d.mts +4 -0
  108. package/dist/cli/services/http-adapter/service.d.mts +2 -0
  109. package/dist/cli/services/resolver/service.d.mts +1 -0
  110. package/dist/cli/services/tailordb/service.d.mts +3 -0
  111. package/dist/cli/services/workflow/bundler.d.mts +3 -0
  112. package/dist/cli/services/workflow/service.d.mts +1 -0
  113. package/dist/cli/shared/args.d.mts +13 -0
  114. package/dist/cli/shared/client.d.mts +1298 -0
  115. package/dist/cli/shared/config-loader.d.mts +32 -0
  116. package/dist/cli/shared/context.d.mts +29 -0
  117. package/dist/cli/shared/error-json.d.mts +23 -0
  118. package/dist/cli/shared/readonly-guard.d.mts +25 -0
  119. package/dist/cli/shared/script-executor.d.mts +77 -0
  120. package/dist/cli/shared/seed-chunker.d.mts +45 -0
  121. package/dist/cli/shared/seed-context.d.mts +49 -0
  122. package/dist/cli/shared/tailordb-namespaces.d.mts +40 -0
  123. package/dist/cli/shared/tsconfig-paths-plugin.d.mts +2 -0
  124. package/dist/cli/shared/type-generator.d.mts +20 -0
  125. package/dist/cli/shared/workspace-name.d.mts +1 -0
  126. package/dist/cli/ts-hook.d.mts +4 -0
  127. package/dist/cli/ts-hook.mjs +333 -0
  128. package/dist/completion/zsh-worker.zsh +1471 -1217
  129. package/dist/configure/config/index.d.mts +20 -0
  130. package/dist/configure/config/types.d.mts +134 -0
  131. package/dist/configure/index.d.mts +135 -8
  132. package/dist/configure/index.mjs +558 -36
  133. package/dist/configure/index.mjs.map +1 -1
  134. package/dist/configure/services/aigateway/index.d.mts +16 -0
  135. package/dist/configure/services/aigateway/types.d.mts +10 -0
  136. package/dist/configure/services/auth/index.d.mts +33 -0
  137. package/dist/configure/services/auth/types.d.mts +168 -0
  138. package/dist/configure/services/executor/executor.d.mts +70 -0
  139. package/dist/configure/services/executor/index.d.mts +9 -0
  140. package/dist/configure/services/executor/operation.d.mts +50 -0
  141. package/dist/configure/services/executor/trigger/event.d.mts +514 -0
  142. package/dist/configure/services/executor/trigger/index.d.mts +7 -0
  143. package/dist/configure/services/executor/trigger/schedule.d.mts +24 -0
  144. package/dist/configure/services/executor/trigger/webhook.d.mts +43 -0
  145. package/dist/configure/services/executor/types.d.mts +2 -0
  146. package/dist/configure/services/http-adapter/http-adapter.d.mts +124 -0
  147. package/dist/configure/services/http-adapter/index.d.mts +2 -0
  148. package/dist/configure/services/idp/index.d.mts +60 -0
  149. package/dist/configure/services/idp/permission.d.mts +64 -0
  150. package/dist/configure/services/idp/types.d.mts +23 -0
  151. package/dist/configure/services/index.d.mts +40 -0
  152. package/dist/configure/services/resolver/index.d.mts +6 -0
  153. package/dist/configure/services/resolver/permission.d.mts +64 -0
  154. package/dist/configure/services/resolver/resolver.d.mts +88 -0
  155. package/dist/configure/services/resolver/types.d.mts +5 -0
  156. package/dist/configure/services/secrets/index.d.mts +37 -0
  157. package/dist/configure/services/secrets/types.d.mts +10 -0
  158. package/dist/configure/services/staticwebsite/index.d.mts +18 -0
  159. package/dist/configure/services/staticwebsite/types.d.mts +10 -0
  160. package/dist/configure/services/tailordb/index.d.mts +3 -0
  161. package/dist/configure/services/tailordb/permission.d.mts +103 -0
  162. package/dist/configure/services/tailordb/schema.d.mts +486 -0
  163. package/dist/configure/services/tailordb/types.d.mts +198 -0
  164. package/dist/configure/services/workflow/execution-policy.d.mts +70 -0
  165. package/dist/configure/services/workflow/execution-policy.types.d.mts +103 -0
  166. package/dist/configure/services/workflow/index.d.mts +9 -0
  167. package/dist/configure/services/workflow/job.d.mts +92 -0
  168. package/dist/configure/services/workflow/types.d.mts +2 -0
  169. package/dist/configure/services/workflow/wait-point.d.mts +72 -0
  170. package/dist/configure/services/workflow/workflow.d.mts +66 -0
  171. package/dist/configure/types/aigateway-name.d.mts +12 -0
  172. package/dist/configure/types/connection-name.d.mts +12 -0
  173. package/dist/configure/types/field.d.mts +8 -0
  174. package/dist/configure/types/field.types.d.mts +70 -0
  175. package/dist/configure/types/idp-name.d.mts +12 -0
  176. package/dist/configure/types/index.d.mts +5 -0
  177. package/dist/configure/types/machine-user.d.mts +2 -0
  178. package/dist/configure/types/permission-operand.types.d.mts +20 -0
  179. package/dist/configure/types/type.d.mts +73 -0
  180. package/dist/{context-Bd266-ru.mjs → context-DYQVYWqZ.mjs} +4 -5
  181. package/dist/context-DYQVYWqZ.mjs.map +1 -0
  182. package/dist/{crashreport-BsjAkFWw.mjs → crashreport-B5LqCTfF.mjs} +10 -11
  183. package/dist/{crashreport-BsjAkFWw.mjs.map → crashreport-B5LqCTfF.mjs.map} +1 -1
  184. package/dist/{crashreport-pr6Rhvza.mjs → crashreport-eI7ty7ok.mjs} +1 -1
  185. package/dist/{errors-Dtf2WPaW.mjs → errors-D7583Zz7.mjs} +18 -2
  186. package/dist/errors-D7583Zz7.mjs.map +1 -0
  187. package/dist/{file-_oUZo76X.mjs → file-BUcmVIH2.mjs} +12 -22
  188. package/dist/file-BUcmVIH2.mjs.map +1 -0
  189. package/dist/{globals-Crz8o65k.mjs → globals-TfAVItuK.mjs} +32 -55
  190. package/dist/globals-TfAVItuK.mjs.map +1 -0
  191. package/dist/iconv-QWaZh0TT.mjs +38 -0
  192. package/dist/iconv-QWaZh0TT.mjs.map +1 -0
  193. package/dist/{idp-BDbK5gjm.mjs → idp-RA_swu-h.mjs} +12 -5
  194. package/dist/idp-RA_swu-h.mjs.map +1 -0
  195. package/dist/{interceptor-D-q1rvRl.mjs → interceptor-e33JtsC-.mjs} +2 -2
  196. package/dist/interceptor-e33JtsC-.mjs.map +1 -0
  197. package/dist/kysely/index.d.mts +5 -7
  198. package/dist/logger-BtX0suGY.mjs +48 -0
  199. package/dist/logger-BtX0suGY.mjs.map +1 -0
  200. package/dist/logger-CXQq9YIp.mjs +317 -0
  201. package/dist/logger-CXQq9YIp.mjs.map +1 -0
  202. package/dist/node-builtins-CmaL2Cbq.mjs +36 -0
  203. package/dist/node-builtins-CmaL2Cbq.mjs.map +1 -0
  204. package/dist/parser/service/auth/index.d.mts +1 -0
  205. package/dist/parser/service/auth/schema.d.mts +3 -0
  206. package/dist/parser/service/http-adapter/index.d.mts +1 -0
  207. package/dist/parser/service/http-adapter/schema.d.mts +1 -0
  208. package/dist/parser/service/idp/types.d.mts +5 -0
  209. package/dist/parser/service/tailordb/type-source.d.mts +10 -0
  210. package/dist/parser/service/tailordb/types.d.mts +131 -0
  211. package/dist/platform-serialize-RoRtBS0v.mjs +46 -0
  212. package/dist/platform-serialize-RoRtBS0v.mjs.map +1 -0
  213. package/dist/plugin/builtin/enum-constants/index.d.mts +15 -1
  214. package/dist/plugin/builtin/enum-constants/index.mjs +115 -2
  215. package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -0
  216. package/dist/plugin/builtin/file-utils/index.d.mts +15 -1
  217. package/dist/plugin/builtin/file-utils/index.mjs +149 -2
  218. package/dist/plugin/builtin/file-utils/index.mjs.map +1 -0
  219. package/dist/plugin/builtin/kysely-type/index.d.mts +15 -1
  220. package/dist/plugin/builtin/kysely-type/index.mjs +274 -2
  221. package/dist/plugin/builtin/kysely-type/index.mjs.map +1 -0
  222. package/dist/plugin/builtin/seed/index.d.mts +46 -2
  223. package/dist/plugin/builtin/seed/index.mjs +1 -1
  224. package/dist/plugin/builtin/seed/seed-type-processor.d.mts +21 -0
  225. package/dist/plugin/builtin/seed/types.d.mts +2 -0
  226. package/dist/plugin/get-generated-type.d.mts +16 -0
  227. package/dist/plugin/index.d.mts +3 -117
  228. package/dist/plugin/index.mjs +1 -1
  229. package/dist/plugin/index.mjs.map +1 -1
  230. package/dist/plugin/manager.d.mts +2 -0
  231. package/dist/plugin/types.d.mts +242 -0
  232. package/dist/plugin/with-context.d.mts +101 -0
  233. package/dist/{runtime-n9NCkjee.mjs → register-ts-hook-LYV7zH-e.mjs} +9652 -4479
  234. package/dist/register-ts-hook-LYV7zH-e.mjs.map +1 -0
  235. package/dist/{registry-DdsYlL_P.mjs → registry-BIGVUrMB.mjs} +12 -9
  236. package/dist/registry-BIGVUrMB.mjs.map +1 -0
  237. package/dist/{repl-editor-DmGr9zMw.mjs → repl-editor-BCozyiNq.mjs} +6 -5
  238. package/dist/{repl-editor-DmGr9zMw.mjs.map → repl-editor-BCozyiNq.mjs.map} +1 -1
  239. package/dist/runtime/aigateway.d.mts +25 -0
  240. package/dist/runtime/aigateway.mjs +3 -0
  241. package/dist/runtime/authconnection.d.mts +21 -2
  242. package/dist/runtime/authconnection.mjs +2 -2
  243. package/dist/runtime/context.d.mts +54 -2
  244. package/dist/runtime/context.mjs +2 -2
  245. package/dist/runtime/field-parse.d.mts +10 -0
  246. package/dist/runtime/file.d.mts +170 -2
  247. package/dist/runtime/file.mjs +2 -2
  248. package/dist/runtime/globals.d.mts +38 -20
  249. package/dist/runtime/iconv.d.mts +73 -2
  250. package/dist/runtime/iconv.mjs +2 -2
  251. package/dist/runtime/idp.d.mts +129 -2
  252. package/dist/runtime/idp.mjs +2 -2
  253. package/dist/runtime/index.d.mts +48 -9
  254. package/dist/runtime/index.mjs +10 -8
  255. package/dist/runtime/logger.d.mts +98 -0
  256. package/dist/runtime/logger.mjs +3 -0
  257. package/dist/runtime/secretmanager.d.mts +41 -2
  258. package/dist/runtime/secretmanager.mjs +2 -2
  259. package/dist/runtime/types.d.mts +25 -0
  260. package/dist/runtime/workflow.d.mts +106 -2
  261. package/dist/runtime/workflow.mjs +2 -2
  262. package/dist/{schema-BhkpP5Hw.mjs → schema--xYWRGfe.mjs} +288 -229
  263. package/dist/schema--xYWRGfe.mjs.map +1 -0
  264. package/dist/{secret-file-DBqZhjFQ.mjs → secret-file-C3J4Gy8r.mjs} +2 -2
  265. package/dist/{secret-file-DBqZhjFQ.mjs.map → secret-file-C3J4Gy8r.mjs.map} +1 -1
  266. package/dist/secretmanager-CYlpffsz.mjs +13 -0
  267. package/dist/secretmanager-CYlpffsz.mjs.map +1 -0
  268. package/dist/secretmanager-IY4UvinW.mjs +131 -0
  269. package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
  270. package/dist/seed/index.d.mts +4 -4
  271. package/dist/seed-B-yckgQY.mjs +483 -0
  272. package/dist/seed-B-yckgQY.mjs.map +1 -0
  273. package/dist/{service-DU1mVzri.mjs → service-B5WynBHQ.mjs} +3 -3
  274. package/dist/{service-DU1mVzri.mjs.map → service-B5WynBHQ.mjs.map} +1 -1
  275. package/dist/service-M7OYziQP.mjs +3 -0
  276. package/dist/service-k1xy_A5G.mjs +864 -0
  277. package/dist/service-k1xy_A5G.mjs.map +1 -0
  278. package/dist/service_pb-D5--My_M.mjs +167 -0
  279. package/dist/service_pb-D5--My_M.mjs.map +1 -0
  280. package/dist/service_pb-i8CmnQP4.mjs +3 -0
  281. package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +203 -0
  282. package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +57 -0
  283. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +420 -0
  284. package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +160 -0
  285. package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +2069 -0
  286. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +865 -0
  287. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +111 -0
  288. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +68 -0
  289. package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +438 -0
  290. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +586 -0
  291. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +192 -0
  292. package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +450 -0
  293. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +191 -0
  294. package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +49 -0
  295. package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +406 -0
  296. package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +429 -0
  297. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +72 -0
  298. package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +16 -0
  299. package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +308 -0
  300. package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +590 -0
  301. package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +329 -0
  302. package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +112 -0
  303. package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +345 -0
  304. package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +53 -0
  305. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +3658 -0
  306. package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +186 -0
  307. package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +28 -0
  308. package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +428 -0
  309. package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +89 -0
  310. package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +683 -0
  311. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +796 -0
  312. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +329 -0
  313. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +207 -0
  314. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +961 -0
  315. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +330 -0
  316. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +2014 -0
  317. package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +482 -0
  318. package/dist/{telemetry-CdqJEzkj.mjs → telemetry-BRVdwh14.mjs} +3 -3
  319. package/dist/telemetry-BRVdwh14.mjs.map +1 -0
  320. package/dist/telemetry-CkbkeJxl.mjs +3 -0
  321. package/dist/test-env-key-D7UkZp99.mjs +75 -0
  322. package/dist/test-env-key-D7UkZp99.mjs.map +1 -0
  323. package/dist/types/aigateway.generated.d.mts +12 -0
  324. package/dist/types/app-config.generated.d.mts +4 -0
  325. package/dist/types/auth-connection.generated.d.mts +33 -0
  326. package/dist/types/auth.generated.d.mts +188 -0
  327. package/dist/types/executor.generated.d.mts +229 -0
  328. package/dist/types/helpers.d.mts +40 -0
  329. package/dist/types/http-adapter.generated.d.mts +28 -0
  330. package/dist/types/idp.generated.d.mts +626 -0
  331. package/dist/types/resolver.generated.d.mts +82 -0
  332. package/dist/types/secrets.generated.d.mts +14 -0
  333. package/dist/types/staticwebsite.generated.d.mts +14 -0
  334. package/dist/types/tailordb.generated.d.mts +468 -0
  335. package/dist/types/workflow.generated.d.mts +17 -0
  336. package/dist/user-agent-Bgsszb5I.mjs +28 -0
  337. package/dist/user-agent-Bgsszb5I.mjs.map +1 -0
  338. package/dist/utils/test/index.d.mts +5 -100
  339. package/dist/utils/test/index.mjs +38 -189
  340. package/dist/utils/test/index.mjs.map +1 -1
  341. package/dist/vitest/environment.d.mts +1 -2
  342. package/dist/vitest/environment.mjs +2 -2
  343. package/dist/vitest/environment.mjs.map +1 -1
  344. package/dist/vitest/index.d.mts +17 -431
  345. package/dist/vitest/index.mjs +1234 -67
  346. package/dist/vitest/index.mjs.map +1 -1
  347. package/dist/vitest/mock-kysely.d.mts +61 -0
  348. package/dist/vitest/mock.d.mts +10 -0
  349. package/dist/vitest/mocks/aigateway.d.mts +40 -0
  350. package/dist/vitest/mocks/authconnection.d.mts +38 -0
  351. package/dist/vitest/mocks/file.d.mts +58 -0
  352. package/dist/vitest/mocks/iconv.d.mts +51 -0
  353. package/dist/vitest/mocks/idp.d.mts +60 -0
  354. package/dist/vitest/mocks/logger.d.mts +45 -0
  355. package/dist/vitest/mocks/secretmanager.d.mts +44 -0
  356. package/dist/vitest/mocks/tailordb.d.mts +115 -0
  357. package/dist/vitest/mocks/workflow.d.mts +148 -0
  358. package/dist/vitest/setup.d.mts +1 -2
  359. package/dist/vitest/setup.mjs +2 -2
  360. package/dist/vitest/workflow-local.d.mts +41 -0
  361. package/dist/workflow-Bamae_Yc.mjs +34 -0
  362. package/dist/workflow-Bamae_Yc.mjs.map +1 -0
  363. package/dist/{client-z_oHGVNy.mjs → workspace_resource_pb-DXnO2AT-.mjs} +57 -621
  364. package/dist/workspace_resource_pb-DXnO2AT-.mjs.map +1 -0
  365. package/docs/cli/application.md +150 -250
  366. package/docs/cli/auth.md +51 -295
  367. package/docs/cli/completion.md +1 -25
  368. package/docs/cli/crashreport.md +3 -61
  369. package/docs/cli/executor.md +72 -183
  370. package/docs/cli/function.md +16 -132
  371. package/docs/cli/organization.md +11 -221
  372. package/docs/cli/plugin.md +29 -0
  373. package/docs/cli/query.md +2 -22
  374. package/docs/cli/secret.md +71 -251
  375. package/docs/cli/setup.md +138 -40
  376. package/docs/cli/skills.md +50 -39
  377. package/docs/cli/staticwebsite.md +32 -180
  378. package/docs/cli/tailordb.md +89 -413
  379. package/docs/cli/upgrade.md +2 -22
  380. package/docs/cli/user.md +78 -247
  381. package/docs/cli/workflow.md +150 -172
  382. package/docs/cli/workspace.md +167 -538
  383. package/docs/cli-reference.md +214 -96
  384. package/docs/configuration.md +90 -6
  385. package/docs/github-actions.md +72 -24
  386. package/docs/migration/v2.md +1613 -0
  387. package/docs/multi-environment.md +29 -7
  388. package/docs/plugin/custom.md +4 -4
  389. package/docs/plugin/index.md +8 -8
  390. package/docs/quickstart.md +8 -7
  391. package/docs/runtime.md +18 -9
  392. package/docs/services/aigateway.md +20 -2
  393. package/docs/services/auth.md +51 -59
  394. package/docs/services/executor.md +91 -6
  395. package/docs/services/http-adapter.md +16 -1
  396. package/docs/services/idp.md +62 -7
  397. package/docs/services/resolver.md +67 -11
  398. package/docs/services/secret.md +11 -11
  399. package/docs/services/staticwebsite.md +8 -2
  400. package/docs/services/tailordb-migration.md +55 -29
  401. package/docs/services/tailordb.md +205 -102
  402. package/docs/services/workflow.md +163 -55
  403. package/docs/testing.md +244 -143
  404. package/package.json +61 -46
  405. package/postinstall.mjs +4 -6
  406. package/dist/application-DB2r36Et.mjs +0 -3
  407. package/dist/application-DqS1yBg3.mjs.map +0 -1
  408. package/dist/authconnection-D2MhtTN5.mjs +0 -15
  409. package/dist/authconnection-D2MhtTN5.mjs.map +0 -1
  410. package/dist/authconnection-DvUQAjQS.d.mts +0 -39
  411. package/dist/cli/erd-viewer-assets/app.js +0 -1181
  412. package/dist/cli/erd-viewer-assets/index.html +0 -73
  413. package/dist/cli/erd-viewer-assets/serve.json +0 -13
  414. package/dist/cli/erd-viewer-assets/styles.css +0 -789
  415. package/dist/cli/index.d.mts +0 -5
  416. package/dist/cli/index.mjs.map +0 -1
  417. package/dist/client-Dbohmtkv.mjs +0 -3
  418. package/dist/client-z_oHGVNy.mjs.map +0 -1
  419. package/dist/context-Bd266-ru.mjs.map +0 -1
  420. package/dist/context-BuuIb8CC.d.mts +0 -68
  421. package/dist/enum-constants-j9QBF0cB.mjs +0 -116
  422. package/dist/enum-constants-j9QBF0cB.mjs.map +0 -1
  423. package/dist/errors-Dtf2WPaW.mjs.map +0 -1
  424. package/dist/field-DOsJCPFa.mjs +0 -22
  425. package/dist/field-DOsJCPFa.mjs.map +0 -1
  426. package/dist/file-BB8Vs9O_.d.mts +0 -250
  427. package/dist/file-_oUZo76X.mjs.map +0 -1
  428. package/dist/file-utils-DcyIPFQh.mjs +0 -150
  429. package/dist/file-utils-DcyIPFQh.mjs.map +0 -1
  430. package/dist/globals-Crz8o65k.mjs.map +0 -1
  431. package/dist/http-adapter.generated-WgMnb7Sb.d.mts +0 -580
  432. package/dist/iconv-Co-TOPuH.d.mts +0 -122
  433. package/dist/iconv-D2vi8G36.mjs +0 -63
  434. package/dist/iconv-D2vi8G36.mjs.map +0 -1
  435. package/dist/idp-BDbK5gjm.mjs.map +0 -1
  436. package/dist/idp-DrhVrLmV.d.mts +0 -160
  437. package/dist/index-5vPyRu1y.d.mts +0 -18
  438. package/dist/index-B7AKc18V.d.mts +0 -47
  439. package/dist/index-BlpzXncY.d.mts +0 -1016
  440. package/dist/index-CK7u9isy.d.mts +0 -46
  441. package/dist/index-CNYe5lnW.d.mts +0 -18
  442. package/dist/index-DjUdWlzf.d.mts +0 -18
  443. package/dist/index-ZePLwxw7.d.mts +0 -208
  444. package/dist/interceptor-D-q1rvRl.mjs.map +0 -1
  445. package/dist/job-fuc3j1Ma.mjs +0 -53
  446. package/dist/job-fuc3j1Ma.mjs.map +0 -1
  447. package/dist/kysely-type-DR8uzZTA.mjs +0 -274
  448. package/dist/kysely-type-DR8uzZTA.mjs.map +0 -1
  449. package/dist/logger-CxF-Ex5d.mjs +0 -220
  450. package/dist/logger-CxF-Ex5d.mjs.map +0 -1
  451. package/dist/mock-BjFj5o1I.mjs +0 -804
  452. package/dist/mock-BjFj5o1I.mjs.map +0 -1
  453. package/dist/registry-DdsYlL_P.mjs.map +0 -1
  454. package/dist/rolldown-runtime-DXywRVcq.mjs +0 -20
  455. package/dist/runtime-n9NCkjee.mjs.map +0 -1
  456. package/dist/schema-BhkpP5Hw.mjs.map +0 -1
  457. package/dist/secretmanager-B3n4KHfm.d.mts +0 -55
  458. package/dist/secretmanager-BVxw3ih_.mjs +0 -24
  459. package/dist/secretmanager-BVxw3ih_.mjs.map +0 -1
  460. package/dist/seed-jf3008-h.mjs +0 -1160
  461. package/dist/seed-jf3008-h.mjs.map +0 -1
  462. package/dist/service-CCL8ruDf.mjs +0 -459
  463. package/dist/service-CCL8ruDf.mjs.map +0 -1
  464. package/dist/service-D6yonf2I.mjs +0 -3
  465. package/dist/telemetry-CdqJEzkj.mjs.map +0 -1
  466. package/dist/telemetry-ClwW5ohF.mjs +0 -3
  467. package/dist/test-env-key-D9kM6ETE.mjs +0 -49
  468. package/dist/test-env-key-D9kM6ETE.mjs.map +0 -1
  469. package/dist/types-B2RpYyA_.mjs +0 -371
  470. package/dist/types-B2RpYyA_.mjs.map +0 -1
  471. package/dist/types-ClhIrW_C.mjs +0 -4
  472. package/dist/types-DCUhgpyI.d.mts +0 -784
  473. package/dist/types-DhO_VEZd.d.mts +0 -574
  474. package/dist/types-DwDgacni.d.mts +0 -338
  475. package/dist/workflow-BbKvGLQg.d.mts +0 -96
  476. package/dist/workflow-DgemCAz3.mjs +0 -38
  477. package/dist/workflow-DgemCAz3.mjs.map +0 -1
  478. package/dist/workflow.generated-DtQwEo-x.d.mts +0 -671
@@ -0,0 +1,1613 @@
1
+ # Migrating to v2
2
+
3
+ <!-- Generated from the sdk-codemod registry. Run `pnpm codemod:docs:update` and edit `packages/sdk-codemod/src/registry.ts` instead of this file. -->
4
+
5
+ Run the codemods, then finish anything reported as not migrated automatically:
6
+
7
+ ```sh
8
+ npx @tailor-platform/sdk-codemod --from <current-version> --to <target-version>
9
+ ```
10
+
11
+ ## defineGenerators → definePlugins
12
+
13
+ **Migration:** Partially automatic
14
+
15
+ Migrate defineGenerators() tuple syntax to definePlugins() with explicit plugin imports
16
+
17
+ Before:
18
+
19
+ ```ts
20
+ import { defineGenerators } from "@tailor-platform/sdk";
21
+
22
+ export const generators = defineGenerators(
23
+ ["@tailor-platform/kysely-type", { distPath: "db.ts" }],
24
+ );
25
+ ```
26
+
27
+ After:
28
+
29
+ ```ts
30
+ import { definePlugins } from "@tailor-platform/sdk";
31
+ import { kyselyTypePlugin } from "@tailor-platform/sdk/plugin/kysely-type";
32
+
33
+ export const generators = definePlugins(kyselyTypePlugin({ distPath: "db.ts" }));
34
+ ```
35
+
36
+ <details>
37
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
38
+
39
+ ```text
40
+ defineGenerators() is replaced by definePlugins() in v2. The codemod rewrites the
41
+ known plugin tuples (kysely-type, enum-constants, file-utils, seed). For any
42
+ remaining defineGenerators([...]) the codemod left in place — a plugin it does not
43
+ know, or a non-tuple/spread form — convert it to definePlugins(pluginFn(config)),
44
+ importing the matching plugin from its @tailor-platform/sdk/plugin/<name> subpath.
45
+ ```
46
+
47
+ </details>
48
+
49
+ ## @tailor-platform/sdk/cli plugin imports → dedicated subpaths
50
+
51
+ **Migration:** Automatic
52
+
53
+ Rewrite deprecated plugin re-export imports (kyselyTypePlugin, enumConstantsPlugin, fileUtilsPlugin, seedPlugin) from `@tailor-platform/sdk/cli` to their dedicated plugin subpaths
54
+
55
+ Before:
56
+
57
+ ```ts
58
+ import { kyselyTypePlugin } from "@tailor-platform/sdk/cli";
59
+ ```
60
+
61
+ After:
62
+
63
+ ```ts
64
+ import { kyselyTypePlugin } from "@tailor-platform/sdk/plugin/kysely-type";
65
+ ```
66
+
67
+ ## function test-run --arg input unwrap
68
+
69
+ **Migration:** Automatic
70
+
71
+ Strip the deprecated {input: ...} wrapper from `tailor function test-run --arg` JSON in scripts and docs
72
+
73
+ Before:
74
+
75
+ ```sh
76
+ tailor function test-run resolvers/add.ts --arg '{"input":{"a":1}}'
77
+ ```
78
+
79
+ After:
80
+
81
+ ```sh
82
+ tailor function test-run resolvers/add.ts --arg '{"a":1}'
83
+ ```
84
+
85
+ ## tailor-sdk-skills → tailor skills add
86
+
87
+ **Migration:** Partially automatic
88
+
89
+ Replace deprecated `tailor-sdk-skills` invocations with `tailor skills add`
90
+
91
+ Before:
92
+
93
+ ```sh
94
+ npx tailor-sdk-skills
95
+ ```
96
+
97
+ After:
98
+
99
+ ```sh
100
+ tailor skills add
101
+ ```
102
+
103
+ <details>
104
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
105
+
106
+ ```text
107
+ The standalone tailor-sdk-skills binary is removed in v2; call the skills add
108
+ subcommand on the main tailor CLI instead. Replace any remaining
109
+ tailor-sdk-skills invocations the codemod did not rewrite with
110
+ `tailor skills add`.
111
+ ```
112
+
113
+ </details>
114
+
115
+ ## Unify TailorUser/TailorActor/TailorActorType/TailorInvoker → TailorPrincipal
116
+
117
+ **Migration:** Partially automatic
118
+
119
+ Rename TailorUser/TailorActor/TailorActorType/TailorInvoker to TailorPrincipal, drop unauthenticatedTailorUser, rename resolver body `user` to `caller`, and rename TailorDB callback `user` to `invoker`
120
+
121
+ Type references unify under `TailorPrincipal`:
122
+
123
+ Before:
124
+
125
+ ```ts
126
+ import type { TailorUser } from "@tailor-platform/sdk";
127
+ ```
128
+
129
+ After:
130
+
131
+ ```ts
132
+ import type { TailorPrincipal } from "@tailor-platform/sdk";
133
+ ```
134
+
135
+ The resolver body `user` becomes `caller`:
136
+
137
+ Before:
138
+
139
+ ```ts
140
+ body: ({ input, user }) => user.id,
141
+ ```
142
+
143
+ After:
144
+
145
+ ```ts
146
+ body: ({ input, caller }) => caller.id,
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
+ Finish the cases the codemod left for manual migration:
154
+ - Rename user -> caller in resolver bodies the codemod skipped because a `caller`
155
+ binding already exists or renaming would shadow/collide with another value.
156
+ - Replace member-access on the removed unauthenticatedTailorUser (e.g.
157
+ unauthenticatedTailorUser.id); the codemod only replaced standalone references
158
+ with null and left member access to surface a type error.
159
+ - Review helper adapters that still accept or read `context.user`; v2 resolver
160
+ context uses nullable `caller` and `invoker`, so project-specific helper
161
+ semantics for anonymous callers and command invokers must be chosen explicitly.
162
+ - Review `caller?.` values passed to APIs that require non-null values. If the
163
+ resolver requires authentication, throw or otherwise narrow before the call;
164
+ if anonymous callers are allowed, keep the nullable flow explicit.
165
+ Use TailorPrincipal for the unified user/actor/invoker type.
166
+ ```
167
+
168
+ </details>
169
+
170
+ ## AttributeMap → Attributes
171
+
172
+ **Migration:** Partially automatic
173
+
174
+ Rename auth attribute module augmentation and related SDK type names from `AttributeMap` to `Attributes`
175
+
176
+ Module augmentation uses `Attributes`:
177
+
178
+ Before:
179
+
180
+ ```ts
181
+ declare module "@tailor-platform/sdk" {
182
+ interface AttributeMap {
183
+ role: string;
184
+ }
185
+ }
186
+ ```
187
+
188
+ After:
189
+
190
+ ```ts
191
+ declare module "@tailor-platform/sdk" {
192
+ interface Attributes {
193
+ role: string;
194
+ }
195
+ }
196
+ ```
197
+
198
+ <details>
199
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
200
+
201
+ ```text
202
+ In Tailor SDK v2, the auth attribute type API is renamed from `AttributeMap`
203
+ to `Attributes`; related SDK types are renamed to `UserAttributes` and
204
+ `InferredAttributes`. The codemod rewrites SDK imports, re-exports,
205
+ namespace-qualified references, import() type references, and module
206
+ augmentations. Review any remaining matches manually and leave unrelated
207
+ local names or deploy/proto wire field names unchanged.
208
+ ```
209
+
210
+ </details>
211
+
212
+ ## tailor-sdk apply → tailor-sdk deploy
213
+
214
+ **Migration:** Automatic
215
+
216
+ Rewrite `tailor-sdk apply` invocations in package.json scripts, shell scripts, CI configs, and docs to the canonical v2 `tailor-sdk deploy` command
217
+
218
+ Before:
219
+
220
+ ```sh
221
+ tailor-sdk apply --profile prod
222
+ ```
223
+
224
+ After:
225
+
226
+ ```sh
227
+ tailor-sdk deploy --profile prod
228
+ ```
229
+
230
+ ## v2 CLI rename
231
+
232
+ **Migration:** Partially automatic
233
+
234
+ Rewrite `tailor-sdk crash-report` to `tailor-sdk crashreport` and `--machineuser` to `--machine-user` across package.json scripts, shell scripts, CI configs, and docs
235
+
236
+ Before:
237
+
238
+ ```sh
239
+ tailor-sdk crash-report list
240
+ tailor-sdk login --machineuser
241
+ ```
242
+
243
+ After:
244
+
245
+ ```sh
246
+ tailor-sdk crashreport list
247
+ tailor-sdk login --machine-user
248
+ ```
249
+
250
+ <details>
251
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
252
+
253
+ ```text
254
+ Apply the v2 CLI renames the codemod did not reach (only `tailor-sdk`-prefixed
255
+ invocations are rewritten): `tailor-sdk crash-report` -> `tailor-sdk crashreport`
256
+ and the `--machineuser` option -> `--machine-user`. Leave unrelated commands that
257
+ happen to use `--machineuser` alone.
258
+ ```
259
+
260
+ </details>
261
+
262
+ ## SDK environment variable rename
263
+
264
+ **Migration:** Partially automatic
265
+
266
+ Rewrite unambiguous removed SDK environment variable names to their v2 `TAILOR_*` names and flag generic names for manual review
267
+
268
+ Before:
269
+
270
+ ```sh
271
+ TAILOR_PLATFORM_SDK_BUILD_ONLY=true tailor-sdk deploy
272
+ ```
273
+
274
+ After:
275
+
276
+ ```sh
277
+ TAILOR_DEPLOY_BUILD_ONLY=true tailor-sdk deploy
278
+ ```
279
+
280
+ Before:
281
+
282
+ ```ts
283
+ const token = process.env.TAILOR_TOKEN;
284
+ ```
285
+
286
+ After:
287
+
288
+ ```ts
289
+ const token = process.env.TAILOR_PLATFORM_TOKEN;
290
+ ```
291
+
292
+ <details>
293
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
294
+
295
+ ```text
296
+ Review any remaining removed SDK environment variable names after the codemod
297
+ runs. The codemod intentionally leaves generic names such as `LOG_LEVEL`,
298
+ `PLATFORM_URL`, and `PLATFORM_OAUTH2_CLIENT_ID` for manual review because
299
+ they can configure non-SDK tools. Replace only actual SDK usages with their
300
+ v2 names. If a remaining match is an unrelated local identifier, fixture
301
+ label, or historical documentation that intentionally does not configure the
302
+ SDK, leave it unchanged.
303
+ ```
304
+
305
+ </details>
306
+
307
+ ## auth.invoker("name") → "name"
308
+
309
+ **Migration:** Partially automatic
310
+
311
+ Replace statically identified SDK `auth.invoker("name")` option values with the bare `"name"` string while preserving the `authInvoker` key for SDK versions before the option rename.
312
+
313
+ Before:
314
+
315
+ ```ts
316
+ createResolver({ authInvoker: auth.invoker("manager") });
317
+ ```
318
+
319
+ After:
320
+
321
+ ```ts
322
+ createResolver({ authInvoker: "manager" });
323
+ ```
324
+
325
+ <details>
326
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
327
+
328
+ ```text
329
+ In Tailor SDK v2 the auth.invoker() helper is removed; an invoker is now the
330
+ machine user name passed directly as a string. The codemod already rewrote the
331
+ statically identified SDK option form authInvoker: auth.invoker("name") to authInvoker: "name". These files still contain
332
+ auth.invoker(...) calls that need manual review.
333
+
334
+ For each remaining auth.invoker(<expr>) call:
335
+ 1. Replace the whole call with <expr> only where the target option expects a
336
+ machine user name string; platform/runtime authInvoker payloads still expect
337
+ the object form.
338
+ 2. Keep the authInvoker key when targeting SDK versions before the invoker
339
+ option rename; later v2 targets run a separate codemod for that key rename.
340
+ 3. After removing every auth.invoker usage in a file, delete the now-unused auth
341
+ import (keeping it pulls Node-only config modules into runtime bundles); leave
342
+ the import if auth is still referenced elsewhere.
343
+
344
+ Do not change behavior beyond the auth.invoker() removal.
345
+ ```
346
+
347
+ </details>
348
+
349
+ ## auth.invoker("name") → invoker: "name"
350
+
351
+ **Migration:** Partially automatic
352
+
353
+ Rename statically identified SDK `authInvoker` options to `invoker`, replace `auth.invoker("name")` there with the bare `"name"` string, and drop the `auth` import when no other reference remains. Ambiguous workflow `.start()` calls are left for manual review. The `auth.invoker()` helper is removed in v2 because importing `auth` from `tailor.config.ts` into runtime files pulls Node-only modules into the bundle.
354
+
355
+ Before:
356
+
357
+ ```ts
358
+ createResolver({ invoker: auth.invoker("manager") });
359
+ ```
360
+
361
+ After:
362
+
363
+ ```ts
364
+ createResolver({ invoker: "manager" });
365
+ ```
366
+
367
+ <details>
368
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
369
+
370
+ ```text
371
+ In Tailor SDK v2 the auth.invoker() helper is removed; an invoker is now the
372
+ machine user name passed directly as a string. The codemod already rewrote the
373
+ statically identified SDK option form authInvoker: auth.invoker("name") to invoker: "name" and renamed supported authInvoker option keys. These files still contain
374
+ auth.invoker(...) calls or authInvoker keys that need manual review.
375
+
376
+ For each remaining auth.invoker(<expr>) call:
377
+ 1. Replace the whole call with <expr> only where the target option expects a
378
+ machine user name string; platform/runtime authInvoker payloads still expect
379
+ the object form.
380
+ 2. Rename remaining authInvoker option keys to invoker only for SDK resolver,
381
+ executor, workflow.start(), or startWorkflow() options. Keep platform/runtime
382
+ payload keys such as tailor.workflow.startWorkflow(..., { authInvoker: ... }).
383
+ 3. After removing every auth.invoker usage in a file, delete the now-unused auth
384
+ import (keeping it pulls Node-only config modules into runtime bundles); leave
385
+ the import if auth is still referenced elsewhere.
386
+
387
+ Do not change behavior beyond the SDK option rename and auth.invoker() removal.
388
+ ```
389
+
390
+ </details>
391
+
392
+ ## auth.getConnectionToken() → runtime authconnection
393
+
394
+ **Migration:** Partially automatic
395
+
396
+ The deprecated `auth.getConnectionToken()` helper returned by `defineAuth()` is removed in v2. Use `authconnection.getConnectionToken(...)` from `@tailor-platform/sdk/runtime` in resolvers, executors, and workflows instead.
397
+
398
+ Before:
399
+
400
+ ```ts
401
+ import { auth } from "../tailor.config";
402
+
403
+ const token = await auth.getConnectionToken("google");
404
+ ```
405
+
406
+ After:
407
+
408
+ ```ts
409
+ import { authconnection } from "@tailor-platform/sdk/runtime";
410
+
411
+ const token = await authconnection.getConnectionToken("google");
412
+ ```
413
+
414
+ <details>
415
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
416
+
417
+ ```text
418
+ In Tailor SDK v2 the auth.getConnectionToken() helper returned by defineAuth()
419
+ is removed. Runtime code should call authconnection.getConnectionToken(...) from
420
+ @tailor-platform/sdk/runtime instead of importing auth from tailor.config.ts.
421
+
422
+ For each getConnectionToken usage where <receiver> is a defineAuth() result
423
+ imported from tailor.config.ts:
424
+ 1. Replace <receiver>.getConnectionToken(<expr>) calls with
425
+ authconnection.getConnectionToken(<expr>).
426
+ 2. Update non-call references, including <receiver>.getConnectionToken,
427
+ <receiver>["getConnectionToken"], and destructuring from <receiver>, to
428
+ reference authconnection instead.
429
+ 3. Add or reuse `import { authconnection } from "@tailor-platform/sdk/runtime"`.
430
+ 4. Remove the auth import from tailor.config.ts only when no other auth reference
431
+ remains in the file.
432
+
433
+ Leave usages unchanged when the receiver is already the runtime authconnection
434
+ wrapper or global tailor.authconnection.
435
+ ```
436
+
437
+ </details>
438
+
439
+ ## Runtime subpath imports use namespace objects
440
+
441
+ **Migration:** Partially automatic
442
+
443
+ Rewrite `@tailor-platform/sdk/runtime/*` namespace-star and flat value imports to self-named namespace imports, and aggregate `file.deleteFile` calls to `file.delete`. `TailorContextAPI` and `TailorWorkflowAPI` now describe SDK wrappers; direct platform globals use `PlatformContextAPI` and `PlatformWorkflowAPI`.
444
+
445
+ Before:
446
+
447
+ ```ts
448
+ import * as iconv from "@tailor-platform/sdk/runtime/iconv";
449
+ iconv.convert(value, "UTF-8", "Shift_JIS");
450
+ ```
451
+
452
+ After:
453
+
454
+ ```ts
455
+ import { iconv } from "@tailor-platform/sdk/runtime/iconv";
456
+ iconv.convert(value, "UTF-8", "Shift_JIS");
457
+ ```
458
+
459
+ Before:
460
+
461
+ ```ts
462
+ import { get } from "@tailor-platform/sdk/runtime/aigateway";
463
+ const gateway = await get("main");
464
+ ```
465
+
466
+ After:
467
+
468
+ ```ts
469
+ import { aigateway } from "@tailor-platform/sdk/runtime/aigateway";
470
+ const gateway = await aigateway.get("main");
471
+ ```
472
+
473
+ Before:
474
+
475
+ ```ts
476
+ import { file } from "@tailor-platform/sdk/runtime";
477
+ await file.deleteFile("ns", "Doc", "blob", "record-id");
478
+ ```
479
+
480
+ After:
481
+
482
+ ```ts
483
+ import { file } from "@tailor-platform/sdk/runtime";
484
+ await file.delete("ns", "Doc", "blob", "record-id");
485
+ ```
486
+
487
+ <details>
488
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
489
+
490
+ ```text
491
+ In Tailor SDK v2, runtime subpath modules export only a self-named namespace
492
+ object (for example, `iconv` from `@tailor-platform/sdk/runtime/iconv`).
493
+ Default and flat value imports such as
494
+ `import { get } from "@tailor-platform/sdk/runtime/aigateway"` are removed.
495
+ The codemod rewrites straightforward namespace-star imports and flat named value
496
+ imports. It also rewrites direct `file.deleteFile` calls on the aggregate runtime
497
+ namespace to `file.delete`. Destructured aggregate `deleteFile` references require
498
+ manual migration. Review any remaining runtime imports manually, especially when
499
+ a local binding or nested scope shadows an imported value, or when
500
+ type-position namespace member references need explicit top-level type imports.
501
+ For direct platform globals, replace `TailorContextAPI` and `TailorWorkflowAPI`
502
+ type references with `PlatformContextAPI` and `PlatformWorkflowAPI` respectively.
503
+ ```
504
+
505
+ </details>
506
+
507
+ ## Tailordb → tailordb (lowercase ambient namespace)
508
+
509
+ **Migration:** Partially automatic
510
+
511
+ Rewrite references to the removed capital-cased `Tailordb` ambient namespace (`Tailordb.QueryResult`, `Tailordb.CommandType`, `Tailordb.Client`, `typeof Tailordb.Client`) to the lowercase `tailordb.*` namespace exposed by `@tailor-platform/sdk/runtime/globals`. Because v2 no longer activates ambient declarations automatically, each file that contains `tailordb.*` references after the rewrite must also add `import "@tailor-platform/sdk/runtime/globals"`.
512
+
513
+ Before:
514
+
515
+ ```ts
516
+ const command: Tailordb.CommandType = "SELECT";
517
+ ```
518
+
519
+ After:
520
+
521
+ ```ts
522
+ import "@tailor-platform/sdk/runtime/globals";
523
+ const command: tailordb.CommandType = "SELECT";
524
+ ```
525
+
526
+ <details>
527
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
528
+
529
+ ```text
530
+ The capital-cased Tailordb ambient namespace is removed in v2; use the lowercase
531
+ tailordb.* namespace from @tailor-platform/sdk/runtime/globals. The codemod rewrites
532
+ the known members (QueryResult, CommandType, Client). Rewrite any other remaining
533
+ Tailordb.* reference to its tailordb.* equivalent (and confirm the member still
534
+ exists on the lowercase namespace).
535
+ Also add `import "@tailor-platform/sdk/runtime/globals"` at the top of each file
536
+ that contains any tailordb.* type reference — v2 no longer activates ambient
537
+ declarations automatically on SDK import.
538
+ ```
539
+
540
+ </details>
541
+
542
+ ## db.type() → db.table()
543
+
544
+ **Migration:** Partially automatic
545
+
546
+ Rename TailorDB schema builder calls from `db.type()` to `db.table()`. TailorDB schema definitions now use table terminology in SDK projects.
547
+
548
+ Before:
549
+
550
+ ```ts
551
+ import { db } from "@tailor-platform/sdk";
552
+
553
+ export const user = db.type("User", {
554
+ name: db.string(),
555
+ });
556
+ ```
557
+
558
+ After:
559
+
560
+ ```ts
561
+ import { db } from "@tailor-platform/sdk";
562
+
563
+ export const user = db.table("User", {
564
+ name: db.string(),
565
+ });
566
+ ```
567
+
568
+ <details>
569
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
570
+
571
+ ```text
572
+ In Tailor SDK v2, TailorDB schema definitions use db.table(...) instead of
573
+ db.type(...). The codemod rewrites member accesses on db imported from
574
+ @tailor-platform/sdk, including aliases such as `import { db as schema }`.
575
+ It flags destructured builder aliases such as `const { type } = db` and
576
+ local builder aliases such as `const schema = db`, `schema = db`, or
577
+ `function make(schema = db) { ... }` for manual review because the local
578
+ alias may require call-site renaming.
579
+ Review any remaining db.type references and rename SDK TailorDB schema builder
580
+ calls to db.table. Leave unrelated local objects with a .type() method unchanged.
581
+ ```
582
+
583
+ </details>
584
+
585
+ ## TailorDB forward relation names derive from field names
586
+
587
+ **Migration:** Partially automatic
588
+
589
+ Review TailorDB relations that omit `toward.as`. Their forward GraphQL field names now derive from the relation field name with a trailing `ID`, `Id`, or `id` removed, instead of from the target table name.
590
+
591
+ Preserve the v1 GraphQL field name by making it explicit:
592
+
593
+ Before:
594
+
595
+ ```ts
596
+ ownerId: db.uuid().relation({
597
+ type: "n-1",
598
+ toward: { type: user },
599
+ }),
600
+ ```
601
+
602
+ After:
603
+
604
+ ```ts
605
+ ownerId: db.uuid().relation({
606
+ type: "n-1",
607
+ toward: { type: user, as: "user" },
608
+ }),
609
+ ```
610
+
611
+ <details>
612
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
613
+
614
+ ```text
615
+ Tailor SDK v2 derives a default forward GraphQL relation name from the source
616
+ field name by removing a trailing ID, Id, or id. V1 derived it from the target
617
+ table name. Review each reported non-self relation that omits toward.as.
618
+
619
+ If consumers must keep using the v1 GraphQL field name, inspect the v1 schema and
620
+ copy that exact field name into toward.as. Otherwise, update GraphQL operations
621
+ and consumer code to use the new field-based name. No change is needed when the old
622
+ and new names are identical. Relations with a guaranteed non-empty toward.as,
623
+ self-relations, and keyOnly relations are unchanged. For an empty or dynamic
624
+ toward.as, determine whether its runtime value can be falsy; if so, treat the
625
+ relation as using the default name.
626
+
627
+ A relation field without a trailing ID, Id, or id would default to its own scalar
628
+ field name and therefore conflict. Give that relation an explicit toward.as.
629
+ ```
630
+
631
+ </details>
632
+
633
+ ## executeScript arg JSON.stringify → value
634
+
635
+ **Migration:** Partially automatic
636
+
637
+ Unwrap `JSON.stringify(...)` passed as the `executeScript` `arg` option. In v2 `arg` takes a JSON-serializable value and is serialized internally, so a pre-stringified argument double-encodes.
638
+
639
+ Before:
640
+
641
+ ```ts
642
+ await executeScript({ ...opts, arg: JSON.stringify({ a: 1 }) });
643
+ ```
644
+
645
+ After:
646
+
647
+ ```ts
648
+ await executeScript({ ...opts, arg: { a: 1 } });
649
+ ```
650
+
651
+ <details>
652
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
653
+
654
+ ```text
655
+ In Tailor SDK v2 the executeScript() arg option takes a JSON-serializable value
656
+ and is serialized internally, so a pre-stringified argument double-encodes. The
657
+ codemod already rewrote the direct form arg: JSON.stringify(X) to arg: X. Review
658
+ the executeScript calls in these files for cases it could not rewrite — where the
659
+ arg value is reached indirectly, for example:
660
+ - a variable holding a JSON.stringify(...) result (const s = JSON.stringify(x); ... arg: s)
661
+ - JSON.stringify(x, null, 2) or another multi-argument form
662
+ - an options object built or spread dynamically
663
+
664
+ For each such call, pass the underlying value directly as arg (drop the
665
+ JSON.stringify wrapper) so executeScript serializes it once. Leave calls that
666
+ already pass a plain value unchanged.
667
+ ```
668
+
669
+ </details>
670
+
671
+ ## defineIdp publishUserEvents → publishEvents
672
+
673
+ **Migration:** Partially automatic
674
+
675
+ Rename the `defineIdp` option `publishUserEvents` to `publishEvents`, matching the field name TailorDB types, resolvers, and workflows already use.
676
+
677
+ Before:
678
+
679
+ ```ts
680
+ import { defineIdp } from "@tailor-platform/sdk";
681
+
682
+ export const idp = defineIdp("my-idp", {
683
+ clients: ["my-client"],
684
+ publishUserEvents: true,
685
+ });
686
+ ```
687
+
688
+ After:
689
+
690
+ ```ts
691
+ import { defineIdp } from "@tailor-platform/sdk";
692
+
693
+ export const idp = defineIdp("my-idp", {
694
+ clients: ["my-client"],
695
+ publishEvents: true,
696
+ });
697
+ ```
698
+
699
+ A shorthand option keeps reading the same local:
700
+
701
+ Before:
702
+
703
+ ```ts
704
+ defineIdp("my-idp", { clients, publishUserEvents });
705
+ ```
706
+
707
+ After:
708
+
709
+ ```ts
710
+ defineIdp("my-idp", { clients, publishEvents: publishUserEvents });
711
+ ```
712
+
713
+ <details>
714
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
715
+
716
+ ```text
717
+ In Tailor SDK v2, the IdP option `publishUserEvents` is renamed to
718
+ `publishEvents`, so all four services that publish events use one field name.
719
+ The codemod rewrites the option key on `defineIdp` calls whose callee resolves
720
+ to the SDK export, including aliased and namespace imports, and rewrites a
721
+ shorthand `{ publishUserEvents }` to `{ publishEvents: publishUserEvents }` so
722
+ it keeps reading the same local.
723
+
724
+ Also review, and migrate by hand:
725
+ - An options object built in a variable or spread into the call — the codemod
726
+ only rewrites object literals passed directly to `defineIdp`.
727
+ - A computed key (e.g. `[key]: value`) that resolves to `publishUserEvents`.
728
+ - Type annotations or interfaces that declare the option themselves.
729
+ - A file where a local declaration shadows the `defineIdp` import; the codemod
730
+ skips it because the call may not be the SDK export.
731
+ ```
732
+
733
+ </details>
734
+
735
+ ## defineWaitPoint/defineWaitPoints → createWaitPoint/createWaitPoints
736
+
737
+ **Migration:** Partially automatic
738
+
739
+ Rename `defineWaitPoint` and `defineWaitPoints` to `createWaitPoint` and `createWaitPoints`. The functions create runtime instances with `.wait()` / `.resolve()` methods, so the `create*` prefix is used consistently.
740
+
741
+ Before:
742
+
743
+ ```ts
744
+ import { defineWaitPoints } from "@tailor-platform/sdk";
745
+
746
+ export const { approval } = defineWaitPoints((define) => ({
747
+ approval: define<{ message: string }, { approved: boolean }>(),
748
+ }));
749
+ ```
750
+
751
+ After:
752
+
753
+ ```ts
754
+ import { createWaitPoints } from "@tailor-platform/sdk";
755
+
756
+ export const { approval } = createWaitPoints((define) => ({
757
+ approval: define<{ message: string }, { approved: boolean }>(),
758
+ }));
759
+ ```
760
+
761
+ ## workflow.triggerWorkflow/triggerJobFunction/resumeWorkflow → startWorkflow/execJobFunction/resumeWorkflowExecution
762
+
763
+ **Migration:** Partially automatic
764
+
765
+ Rename tailor.workflow call sites from the pre-alignment triggerWorkflow/triggerJobFunction/resumeWorkflow names to the canonical startWorkflow/execJobFunction/resumeWorkflowExecution names, on both the ambient tailor.workflow global and a workflow value imported from @tailor-platform/sdk/runtime(/workflow). For a renamed triggerWorkflow call, also renames a literal `invoker` option key to `authInvoker` — startWorkflow's options expect the platform shape directly, unlike the removed triggerWorkflow wrapper, which converted invoker to authInvoker internally.
766
+
767
+ Before:
768
+
769
+ ```ts
770
+ import { workflow } from "@tailor-platform/sdk/runtime";
771
+
772
+ await workflow.triggerWorkflow("myWorkflow", { data: "value" });
773
+ ```
774
+
775
+ After:
776
+
777
+ ```ts
778
+ import { workflow } from "@tailor-platform/sdk/runtime";
779
+
780
+ await workflow.startWorkflow("myWorkflow", { data: "value" });
781
+ ```
782
+
783
+ A literal invoker option is renamed to authInvoker:
784
+
785
+ Before:
786
+
787
+ ```ts
788
+ await workflow.triggerWorkflow("myWorkflow", { data: "value" }, { invoker: myInvoker });
789
+ ```
790
+
791
+ After:
792
+
793
+ ```ts
794
+ await workflow.startWorkflow("myWorkflow", { data: "value" }, { authInvoker: myInvoker });
795
+ ```
796
+
797
+ <details>
798
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
799
+
800
+ ```text
801
+ The pre-alignment tailor.workflow names triggerWorkflow, triggerJobFunction, and
802
+ resumeWorkflow are removed from the SDK's type surface in v2; use the canonical
803
+ startWorkflow, execJobFunction, and resumeWorkflowExecution names instead. The
804
+ codemod rewrites direct member-access call sites on the ambient tailor.workflow
805
+ global and on a workflow value imported from @tailor-platform/sdk/runtime or
806
+ @tailor-platform/sdk/runtime/workflow (including aliased imports). It skips a
807
+ file entirely when a local declaration shadows the workflow import or the
808
+ ambient tailor name, to avoid rewriting an unrelated same-named value — review
809
+ those manually.
810
+
811
+ For a renamed triggerWorkflow call, the codemod also renames a literal invoker
812
+ option key (including shorthand { invoker }) to authInvoker, since startWorkflow
813
+ expects the platform's authInvoker shape directly while triggerWorkflow's removed
814
+ wrapper converted invoker to authInvoker internally.
815
+
816
+ Also review, and migrate by hand:
817
+ - Destructured references (e.g. const { triggerWorkflow } = workflow) — the
818
+ codemod only rewrites direct member-access calls.
819
+ - Imported TriggerWorkflowOptions / TriggerJobFunctionOptions types — rename
820
+ them to StartWorkflowOptions / ExecJobFunctionOptions.
821
+ - An invoker option passed via a variable or spread (not a literal object) —
822
+ the codemod only inspects literal object arguments; rename the invoker key
823
+ to authInvoker in the options object's own definition.
824
+ ```
825
+
826
+ </details>
827
+
828
+ ## workflow.startJobFunction → execJobFunction
829
+
830
+ **Migration:** Partially automatic
831
+
832
+ `tailor.workflow.startJobFunction` and the `StartJobFunctionOptions` type are removed in v2. Use the canonical `execJobFunction` / `ExecJobFunctionOptions`: `Exec*` blocks and returns the job's result, while `Start*` returns only an execution ID. The codemod rewrites member-access call sites on the ambient `tailor.workflow` global and on a `workflow` value imported from @tailor-platform/sdk/runtime(/workflow), and renames `StartJobFunctionOptions` imports along with the type references that resolve to them.
833
+
834
+ Before:
835
+
836
+ ```ts
837
+ import { workflow } from "@tailor-platform/sdk/runtime";
838
+
839
+ const result = workflow.startJobFunction("myJob", { data: "value" });
840
+ ```
841
+
842
+ After:
843
+
844
+ ```ts
845
+ import { workflow } from "@tailor-platform/sdk/runtime";
846
+
847
+ const result = workflow.execJobFunction("myJob", { data: "value" });
848
+ ```
849
+
850
+ <details>
851
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
852
+
853
+ ```text
854
+ startJobFunction is removed from the SDK's workflow runtime surface in v2;
855
+ execJobFunction is the canonical name for a blocking job call that returns the
856
+ job's result. The codemod rewrites direct member-access calls on the ambient
857
+ tailor.workflow global and on a workflow value imported from
858
+ @tailor-platform/sdk/runtime or @tailor-platform/sdk/runtime/workflow (including
859
+ aliased imports), and renames the StartJobFunctionOptions type. It skips a file
860
+ entirely when a local declaration shadows the workflow import or the ambient
861
+ tailor name, to avoid rewriting an unrelated same-named value.
862
+
863
+ Also review, and migrate by hand:
864
+ - Destructured references (e.g. const { startJobFunction } = workflow) — the
865
+ codemod only rewrites direct member-access calls.
866
+ - mockWorkflow().startJobFunction in tests — assert on the execJobFunction vi.fn
867
+ instead; the alias was the same mock function.
868
+ - A file that already imports ExecJobFunctionOptions alongside the removed type —
869
+ rename the remaining references by hand and drop the duplicate specifier.
870
+ ```
871
+
872
+ </details>
873
+
874
+ ## openDownloadStream → downloadStream
875
+
876
+ **Migration:** Manual
877
+
878
+ The deprecated `openDownloadStream` file-streaming API is removed in v2. Use `downloadStream` for streamed file downloads. The generated file utilities now emit `downloadFileStream` (which calls `downloadStream` and returns `FileDownloadStreamResponse`) instead of the removed `openFileDownloadStream` helper.
879
+
880
+ Before:
881
+
882
+ ```ts
883
+ const res = await openDownloadStream(namespace, typeName, fieldName, recordId);
884
+ ```
885
+
886
+ After:
887
+
888
+ ```ts
889
+ const res = await downloadStream(namespace, typeName, fieldName, recordId);
890
+ ```
891
+
892
+ <details>
893
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
894
+
895
+ ```text
896
+ The openDownloadStream file-streaming API is removed in v2. Replace every call to
897
+ openDownloadStream with downloadStream (same arguments). If you used the generated
898
+ openFileDownloadStream helper, switch to downloadFileStream, which calls
899
+ downloadStream and returns FileDownloadStreamResponse.
900
+ ```
901
+
902
+ </details>
903
+
904
+ ## Ambient runtime globals are opt-in
905
+
906
+ **Migration:** Partially automatic
907
+
908
+ Importing `@tailor-platform/sdk` no longer activates the ambient `tailor.*` / `tailordb.*` global declarations. The codemod rewrites simple direct `new tailor.idp.Client(...)` calls to the typed `idp.Client` wrapper from `@tailor-platform/sdk/runtime`; broader runtime global usage remains review-only. Only if you relied on the ambient globals directly, add `import "@tailor-platform/sdk/runtime/globals"`. (The capital-cased `Tailordb.*` namespace is removed separately — see the `Tailordb → tailordb` codemod.)
909
+
910
+ Preferred: switch to the typed wrappers from `@tailor-platform/sdk/runtime` and drop the ambient globals:
911
+
912
+ Before:
913
+
914
+ ```ts
915
+ const client = new tailor.idp.Client();
916
+ ```
917
+
918
+ After:
919
+
920
+ ```ts
921
+ import { idp } from "@tailor-platform/sdk/runtime";
922
+ const client = new idp.Client({ namespace: "my-namespace" });
923
+ ```
924
+
925
+ Fallback: only if you must keep referencing the bare `tailor.*` names, opt into the global declarations:
926
+
927
+ Before:
928
+
929
+ ```ts
930
+ const client = new tailor.idp.Client();
931
+ ```
932
+
933
+ After:
934
+
935
+ ```ts
936
+ import "@tailor-platform/sdk/runtime/globals";
937
+ const client = new tailor.idp.Client();
938
+ ```
939
+
940
+ <details>
941
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
942
+
943
+ ```text
944
+ The v2 SDK no longer enables ambient Tailor runtime globals from
945
+ `@tailor-platform/sdk`. For each flagged file that uses `tailor.*`,
946
+ `tailordb.*`, or Tailor runtime error globals, prefer migrating to the
947
+ typed wrappers from `@tailor-platform/sdk/runtime`. The codemod already
948
+ rewrites direct `new tailor.idp.Client(...)` calls to `new idp.Client(...)`
949
+ when the file has no conflicting `tailor` or `idp` binding. For any remaining
950
+ `tailor.idp.Client` references, either resolve the binding collision and use
951
+ `idp.Client`, or keep the ambient global deliberately.
952
+
953
+ Only when the file must keep referencing the bare `tailor.*` names directly,
954
+ opt into the global declarations instead by adding one of these:
955
+ - per-file: `import "@tailor-platform/sdk/runtime/globals";`
956
+ - project-wide: `"types": ["@tailor-platform/sdk/runtime/globals"]` in
957
+ the relevant tsconfig compilerOptions
958
+
959
+ Leave files unchanged when the matching name is local, imported from another
960
+ module, or appears only in comments or prose strings. Embedded code strings
961
+ that use runtime globals are review-only findings; do not insert imports inside
962
+ string literals.
963
+ ```
964
+
965
+ </details>
966
+
967
+ ## Workflow job start() and start tests
968
+
969
+ **Migration:** Manual
970
+
971
+ Workflow job `.start()` (previously `.trigger()`) now aligns with the platform runtime: it returns the job result directly instead of a Promise wrapper, and tests no longer run job bodies locally. Mock start responses with `mockWorkflow()` (`setJobHandler` / `enqueueResult`, assert via `startedJobs`), or use `runWorkflowLocally()` for a full-chain local run.
972
+
973
+ Tests must mock the workflow runtime instead of running bodies locally:
974
+
975
+ Before:
976
+
977
+ ```ts
978
+ const result = await orderJob.start({ id });
979
+ expect(result.status).toBe("done");
980
+ ```
981
+
982
+ After:
983
+
984
+ ```ts
985
+ using wf = mockWorkflow();
986
+ wf.setJobHandler((jobName) => (jobName === "order-job" ? { status: "done" } : null));
987
+ const result = await orderJob.start({ id });
988
+ expect(result.status).toBe("done");
989
+ ```
990
+
991
+ <details>
992
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
993
+
994
+ ```text
995
+ Workflow job .start() now uses the platform workflow runtime instead of running
996
+ the job body locally. In tests, acquire `using wf = mockWorkflow()` and provide
997
+ start responses (setJobHandler / enqueueResult), or use runWorkflowLocally() for a
998
+ full-chain local run; an unmocked start now throws. Outside tests, treat the
999
+ start result as the job output directly (no Promise wrapper to unwrap).
1000
+ ```
1001
+
1002
+ </details>
1003
+
1004
+ ## Workflow.trigger()/WorkflowJob.trigger() → .start()
1005
+
1006
+ **Migration:** Manual
1007
+
1008
+ Rename `Workflow.trigger()` (returned by `createWorkflow()`) and `WorkflowJob.trigger()` (returned by `createWorkflowJob()`) to `.start()`, aligning the SDK's ergonomic verb with the platform's `start*` RPC vocabulary. No codemod ships for this rename: distinguishing a workflow/job `.trigger()` call from an unrelated object's own `.trigger()` method requires resolving the receiver back to a `createWorkflow`/`createWorkflowJob` result across files, which the SDK's own CLI bundler already does for build-time rewriting. Reusing that logic in a standalone script is a nontrivial lift, and — unlike the bundler, which fails loudly when it cannot rewrite a call — a codemod false positive would silently rewrite an unrelated `.trigger()` call with no error. For the call-site volume this rename typically involves, manual review guided by the prompt below is the safer trade-off.
1009
+
1010
+ Before:
1011
+
1012
+ ```ts
1013
+ const inventory = checkInventory.trigger({ orderId: input.orderId });
1014
+ const workflowRunId = await orderProcessingWorkflow.trigger(args, { invoker: "manager" });
1015
+ ```
1016
+
1017
+ After:
1018
+
1019
+ ```ts
1020
+ const inventory = checkInventory.start({ orderId: input.orderId });
1021
+ const workflowRunId = await orderProcessingWorkflow.start(args, { invoker: "manager" });
1022
+ ```
1023
+
1024
+ <details>
1025
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1026
+
1027
+ ```text
1028
+ In Tailor SDK v2, the ergonomic .trigger() method on a createWorkflow() or
1029
+ createWorkflowJob() result is renamed to .start(). This is unrelated to the
1030
+ separate tailor.workflow.triggerWorkflow/triggerJobFunction/resumeWorkflow removal
1031
+ (see the workflow-trigger-rename codemod) — this rename targets the SDK's own
1032
+ ergonomic wrapper, not the low-level platform call.
1033
+
1034
+ For each flagged `.trigger(` call in these files:
1035
+ 1. Confirm the receiver is a workflow or job object — typically a local const
1036
+ assigned from createWorkflow(...)/createWorkflowJob(...), a named import of one,
1037
+ or the default import of a workflow module. Skip receivers that are unrelated
1038
+ objects with their own .trigger() method (state machines, event emitters, etc.).
1039
+ 2. Rename the call from .trigger(...) to .start(...); the argument list is unchanged.
1040
+ 3. Update any mock/test code that reads WorkflowJob['trigger'] / Workflow['trigger']
1041
+ as a type, or that mocks the ergonomic method via a wrapper — for example,
1042
+ `wf.job(definition)` / `wf.workflow(definition)` from mockWorkflow() now return a
1043
+ mock of the `.start` method.
1044
+ 4. Update prose/docs/comments that say "trigger the workflow/job" to "start" only
1045
+ where they describe this SDK verb specifically, not unrelated event terminology.
1046
+ ```
1047
+
1048
+ </details>
1049
+
1050
+ ## tailor-sdk binary → tailor
1051
+
1052
+ **Migration:** Partially automatic
1053
+
1054
+ Rename the CLI binary from `tailor-sdk` to `tailor` in package.json scripts, shell scripts, CI workflows, source files, generated declaration comments, and documentation. Does not rename `.tailor-sdk` directory paths or the `create-tailor-sdk` scaffolding package. Note: v2 also changes the default generated output directory from `.tailor-sdk/` to `.tailor/` and the setup lock file from `.github/tailor-sdk.lock` to `.github/tailor.lock`. Run `mv .tailor-sdk .tailor` to migrate the generated output directory (preserves auth connection state and other local files). Run `git mv .github/tailor-sdk.lock .github/tailor.lock` if the old lock file exists; without it `tailor setup check` will treat all managed workflows as missing. Exact ignore-file entries for `.tailor-sdk/` are handled by the generated-output ignore codemod. If your CI workflows were generated by `tailor setup`, re-run `tailor setup` afterwards so they pin tailor-platform/actions v2 — the v1 actions invoke the removed `tailor-sdk` bin.
1055
+
1056
+ Before:
1057
+
1058
+ ```sh
1059
+ tailor-sdk deploy
1060
+ npx tailor-sdk@latest login
1061
+ ```
1062
+
1063
+ After:
1064
+
1065
+ ```sh
1066
+ tailor deploy
1067
+ npx @tailor-platform/sdk@latest login
1068
+ ```
1069
+
1070
+ <details>
1071
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
1072
+
1073
+ ```text
1074
+ Rename any remaining `tailor-sdk` binary invocations to `tailor`. Only rewrite
1075
+ the binary name — leave `.tailor-sdk` directory paths and `create-tailor-sdk`
1076
+ package references unchanged.
1077
+ ```
1078
+
1079
+ </details>
1080
+
1081
+ ## .tailor-sdk ignore entries → .tailor
1082
+
1083
+ **Migration:** Automatic
1084
+
1085
+ Rewrite exact ignore-file entries for the v1 generated output directory from `.tailor-sdk` to the v2 `.tailor` directory. Other `.tailor-sdk` paths and prose are left unchanged.
1086
+
1087
+ Before:
1088
+
1089
+ ```gitignore
1090
+ .tailor-sdk/
1091
+ ```
1092
+
1093
+ After:
1094
+
1095
+ ```gitignore
1096
+ .tailor/
1097
+ ```
1098
+
1099
+ ## ValidateFn simplification and type-level validate
1100
+
1101
+ **Migration:** Manual
1102
+
1103
+ Field-level `ValidateFn` is simplified from `(args: { value, data, invoker }) => boolean` to `(args: { value }) => string | void` — the function now returns the error message directly instead of a separate `[fn, message]` tuple. The `ValidateConfig` tuple form and `Validators<F>` record syntax on `db.type().validate()` are removed. Type-level validation uses `db.type().validate((args, issues) => void)` with `{ newRecord, oldRecord, invoker }` args and an `issues(field, message)` callback for cross-field rules.
1104
+
1105
+ Field-level validate: return an error message string instead of a boolean (tuple form removed):
1106
+
1107
+ Before:
1108
+
1109
+ ```ts
1110
+ .validate(
1111
+ [({ value }) => value.length > 5, "Name must be longer than 5 characters"],
1112
+ )
1113
+ ```
1114
+
1115
+ After:
1116
+
1117
+ ```ts
1118
+ .validate(({ value }) =>
1119
+ value.length <= 5 ? "Name must be longer than 5 characters" : undefined,
1120
+ )
1121
+ ```
1122
+
1123
+ Type-level validate: per-field record syntax replaced by a single function with `issues()` callback:
1124
+
1125
+ Before:
1126
+
1127
+ ```ts
1128
+ .validate({
1129
+ name: [({ value }) => value.length > 5, "Name must be longer than 5"],
1130
+ })
1131
+ ```
1132
+
1133
+ After:
1134
+
1135
+ ```ts
1136
+ .validate(({ newRecord }, issues) => {
1137
+ if (newRecord.name && newRecord.name.length <= 5) {
1138
+ issues("name", "Name must be longer than 5");
1139
+ }
1140
+ })
1141
+ ```
1142
+
1143
+ <details>
1144
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1145
+
1146
+ ```text
1147
+ The v2 SDK simplifies field validation and introduces type-level validation.
1148
+
1149
+ Field-level `.validate()` changes:
1150
+ - Signature: `(args: { value, data, invoker }) => boolean` → `(args: { value }) => string | void`
1151
+ - The function now returns the error message string directly (or undefined/void to pass)
1152
+ instead of returning a boolean with the message in a separate tuple.
1153
+ - The `[fn, errorMessage]` tuple form (`ValidateConfig`) is removed.
1154
+ - `data` and `invoker` are no longer available in field-level validators.
1155
+ Use type-level `.validate()` for cross-field or invoker-dependent rules.
1156
+
1157
+ Type-level `.validate()` on `db.type()` changes:
1158
+ - Old: `.validate({ fieldName: fn | [fn, msg] | fn[] })` (per-field record, `Validators<F>` type)
1159
+ - New: `.validate((args, issues) => void)` (single function, `TypeValidateFn<F>` type)
1160
+ - Args: `{ newRecord, oldRecord, invoker }` — `newRecord` is the record after hooks run
1161
+ - Call `issues(field, message)` to report validation errors; `field` supports dotted paths
1162
+ - Move per-field validators that need `data`/`invoker` to the type-level function
1163
+
1164
+ For each remaining `ValidateConfig`, `Validators<`, or old-signature `.validate()` usage:
1165
+ 1. Rewrite field-level validators to return the error string directly
1166
+ 2. Move cross-field / invoker-dependent validators to the type-level function
1167
+ 3. Remove unused `ValidateConfig` / `Validators` type imports
1168
+ ```
1169
+
1170
+ </details>
1171
+
1172
+ ## TailorDB hook redesign: field-level args and type-level hooks
1173
+
1174
+ **Migration:** Manual
1175
+
1176
+ Field-level `HookFn` args change from `{ value, data, invoker }` to create `{ input, invoker, now }` / update `{ input, oldValue, invoker, now }` — `value` is renamed to `input`, matching the `input` arg on type-level hooks (same pre-hook data, narrowed to one field); `data` (the full record) is removed; `oldValue` (previous field value) is added for update hooks only; `now` (operation timestamp) is shared across all hooks. Type-level hooks on `db.type().hooks()` change from per-field mapping `{ fieldName: { create, update } }` (`Hooks<F>`) to a single `{ create, update }` object (`TypeHook<F>`) — create hooks take `{ input, invoker, now }`, update hooks take `{ input, oldRecord, invoker, now }` (oldRecord is always non-null). Both return partial field overrides.
1177
+
1178
+ Field-level hooks: `value` renamed to `input`, `data` replaced by `oldValue` and `now`; use `now` instead of `new Date()`:
1179
+
1180
+ Before:
1181
+
1182
+ ```ts
1183
+ db.datetime().hooks({
1184
+ create: ({ value }) => value ?? new Date(),
1185
+ update: () => new Date(),
1186
+ })
1187
+ ```
1188
+
1189
+ After:
1190
+
1191
+ ```ts
1192
+ db.datetime().hooks({
1193
+ create: ({ input, now }) => input ?? now,
1194
+ update: ({ now }) => now,
1195
+ })
1196
+ ```
1197
+
1198
+ Type-level hooks: per-field mapping replaced by single create/update functions:
1199
+
1200
+ Before:
1201
+
1202
+ ```ts
1203
+ .hooks({
1204
+ fullAddress: {
1205
+ create: ({ data }) => `${data.postalCode} ${data.address}`,
1206
+ update: ({ data }) => `${data.postalCode} ${data.address}`,
1207
+ },
1208
+ })
1209
+ ```
1210
+
1211
+ After:
1212
+
1213
+ ```ts
1214
+ .hooks({
1215
+ create: ({ input }) => ({
1216
+ fullAddress: `${input.postalCode} ${input.address}`,
1217
+ }),
1218
+ update: ({ input }) => ({
1219
+ fullAddress: `${input.postalCode} ${input.address}`,
1220
+ }),
1221
+ })
1222
+ ```
1223
+
1224
+ <details>
1225
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1226
+
1227
+ ```text
1228
+ The v2 SDK redesigns TailorDB hooks at both field and type levels.
1229
+
1230
+ Field-level `.hooks()` on individual fields:
1231
+ - Create args: `{ value, data, invoker }` → `{ input, invoker, now }` (no `oldValue`)
1232
+ - Update args: `{ value, data, invoker }` → `{ input, oldValue, invoker, now }`
1233
+ - `value` is renamed to `input`, matching the type-level hook's `input` arg — both are
1234
+ the same pre-hook data, at different granularity
1235
+ - `data` (full record) is removed; update hooks get `oldValue` (previous field value) instead
1236
+ - `now` provides the operation timestamp — use `now` instead of `new Date()`
1237
+ - If a field-level hook needs the full record (other fields), move it to a type-level hook
1238
+
1239
+ Type-level `.hooks()` on `db.type()`:
1240
+ - Old: `.hooks({ fieldName: { create: fn, update: fn } })` (per-field mapping, `Hooks<F>` type)
1241
+ - New: `.hooks({ create: fn, update: fn })` (single object, `TypeHook<F>` type)
1242
+ - Each function: `({ input, oldRecord, invoker, now }) => ({ fieldName: value, ... })`
1243
+ - `input` is the pre-hook input (may have nullish values for optional/defaulted fields)
1244
+ - Create hooks do not receive `oldRecord`; update hooks receive `oldRecord` (always non-null)
1245
+ - Return an object with only the fields to override; unmentioned fields are unchanged
1246
+
1247
+ Migration steps for each `.hooks()` call on a `db.type()`:
1248
+ 1. If the old per-field hooks only use `value`/`invoker` and don't reference `data`,
1249
+ convert them to field-level hooks with the new args (`value` → `input`, plus `oldValue`, `now`)
1250
+ 2. If the old hooks reference `data` (cross-field access), convert to a type-level hook
1251
+ using `input`/`oldRecord`
1252
+ 3. Remove unused `Hooks<F>` / `HookFn<>` type imports
1253
+ ```
1254
+
1255
+ </details>
1256
+
1257
+ ## `db.<namespace>.erdSite` → `tailordbErdPlugin({ sites })`
1258
+
1259
+ **Migration:** Partially automatic
1260
+
1261
+ Move the TailorDB `erdSite` setting from `db.<namespace>` in tailor.config.ts into `tailordbErdPlugin({ sites })` from `@tailor-platform/sdk-plugin-tailordb-erd`, registered via definePlugins(). The core config schema no longer accepts `erdSite`; the `tailor tailordb erd` commands read the target static website from the plugin configuration and validate each site name against `staticWebsites`. Install `@tailor-platform/sdk-plugin-tailordb-erd` as a dev dependency: the migrated config imports it, so config loading fails with a module-not-found error until it is installed.
1262
+
1263
+ Before:
1264
+
1265
+ ```ts
1266
+ export default defineConfig({
1267
+ db: {
1268
+ tailordb: {
1269
+ files: ["./tailordb/*.ts"],
1270
+ erdSite: "my-erd-site",
1271
+ },
1272
+ },
1273
+ });
1274
+ ```
1275
+
1276
+ After:
1277
+
1278
+ ```ts
1279
+ import { tailordbErdPlugin } from "@tailor-platform/sdk-plugin-tailordb-erd";
1280
+
1281
+ export default defineConfig({
1282
+ db: {
1283
+ tailordb: {
1284
+ files: ["./tailordb/*.ts"],
1285
+ },
1286
+ },
1287
+ });
1288
+
1289
+ export const plugins = definePlugins(
1290
+ tailordbErdPlugin({ sites: { tailordb: "my-erd-site" } }),
1291
+ );
1292
+ ```
1293
+
1294
+ <details>
1295
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
1296
+
1297
+ ```text
1298
+ In Tailor SDK v2 the TailorDB `erdSite` setting is removed from the core config
1299
+ schema; the ERD deploy target is configured on the ERD CLI plugin instead. The
1300
+ codemod rewrites literal `db.<namespace>.erdSite` entries inside top-level
1301
+ defineConfig() calls into a `tailordbErdPlugin({ sites: { <namespace>: <value> } })`
1302
+ argument of definePlugins(), importing it from @tailor-platform/sdk-plugin-tailordb-erd.
1303
+
1304
+ First, for every config that now registers tailordbErdPlugin, make sure
1305
+ @tailor-platform/sdk-plugin-tailordb-erd is installed as a dev dependency — the
1306
+ migrated config imports it, so config loading fails with ERR_MODULE_NOT_FOUND
1307
+ until it is installed.
1308
+
1309
+ For any remaining `erdSite` config keys the codemod did not rewrite — a db config
1310
+ built dynamically or passed via a variable, quoted or computed keys, spread
1311
+ properties, a defineConfig() call inside a factory function, or a file that
1312
+ already registers tailordbErdPlugin — move the namespace → static-website-name
1313
+ mapping into tailordbErdPlugin({ sites }) and delete the `erdSite` key. For
1314
+ factory-built configs, keep any referenced parameters or locals in scope when
1315
+ moving the value to the module-level definePlugins() export. Each site name
1316
+ must match a static website defined in staticWebsites. Leave unrelated
1317
+ identifiers that merely contain the name (e.g. a defineStaticWebSite variable
1318
+ named erdSite) unchanged.
1319
+ ```
1320
+
1321
+ </details>
1322
+
1323
+ ## generate --watch flag removed
1324
+
1325
+ **Migration:** Manual
1326
+
1327
+ Review and remove `tailor generate --watch` / `-W` invocations and the `watch` option on `GenerateOptions`. The flag, its dependency watcher, and the self-restart-on-change logic are removed; `generate` now always performs a single generation pass.
1328
+
1329
+ The --watch/-W flag no longer exists; re-run generate after each change:
1330
+
1331
+ Before:
1332
+
1333
+ ```sh
1334
+ tailor generate --watch
1335
+ ```
1336
+
1337
+ After:
1338
+
1339
+ ```sh
1340
+ tailor generate
1341
+ ```
1342
+
1343
+ <details>
1344
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1345
+
1346
+ ```text
1347
+ Tailor SDK v2 removes the `generate --watch` (`-W`) flag along with the
1348
+ dependency watcher and self-restart logic that powered it. `tailor generate`
1349
+ now always runs a single generation pass and exits.
1350
+
1351
+ For each flagged `tailor generate ... --watch` / `-W` invocation (package.json
1352
+ scripts, shell scripts, CI configs, or docs), drop the flag and re-run
1353
+ `tailor generate` after each change instead. If automatic regeneration on file
1354
+ change is still needed, wrap the command with a general-purpose file watcher
1355
+ (e.g. `chokidar-cli`, `nodemon`) at the project level.
1356
+
1357
+ For programmatic use of `generate()` from `@tailor-platform/sdk/cli`, remove the
1358
+ `watch` field from the `GenerateOptions` argument — the function now performs a
1359
+ single generation pass and resolves once it completes.
1360
+ ```
1361
+
1362
+ </details>
1363
+
1364
+ ## Generated seed exec.mjs → tailor seed CLI plugin
1365
+
1366
+ **Migration:** Partially automatic
1367
+
1368
+ `seedPlugin` no longer generates the `exec.mjs` seed runner. Seeding and validation move to the `tailor seed` commands provided by the `@tailor-platform/sdk-plugin-seed` CLI plugin: install it as a devDependency, replace `node <distPath>/exec.mjs` invocations with `tailor seed apply` and `node <distPath>/exec.mjs validate` with `tailor seed validate`, and delete the stale generated `<distPath>/exec.mjs` file. Seed data and schema generation (`data/*.jsonl`, `data/*.schema.ts`) is unchanged, and the `tailor seed apply` options mirror the old script (`--machine-user`, `--namespace`, `--skip-idp`, `--truncate`, `--yes`, type-name arguments), plus a new `--upsert` flag to update existing rows instead of failing on duplicate ids.
1369
+
1370
+ Before:
1371
+
1372
+ ```jsonc
1373
+ "seed": "node ./seed/exec.mjs",
1374
+ "seed:validate": "node ./seed/exec.mjs validate"
1375
+ ```
1376
+
1377
+ After:
1378
+
1379
+ ```jsonc
1380
+ "seed": "tailor seed apply",
1381
+ "seed:validate": "tailor seed validate"
1382
+ ```
1383
+
1384
+ <details>
1385
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
1386
+
1387
+ ```text
1388
+ seedPlugin no longer generates the exec.mjs seed runner in v2. The tailor seed
1389
+ CLI plugin (@tailor-platform/sdk-plugin-seed) replaces it:
1390
+
1391
+ - Install @tailor-platform/sdk-plugin-seed as a devDependency next to
1392
+ @tailor-platform/sdk.
1393
+ - Replace `node <distPath>/exec.mjs [options] [types...]` invocations with
1394
+ `tailor seed apply [options] [types...]` (same options: --machine-user/-m,
1395
+ --namespace/-n, --skip-idp, --truncate, --yes, and type-name arguments,
1396
+ plus a new --upsert flag to update existing rows instead of failing on
1397
+ duplicate ids).
1398
+ - Replace `node <distPath>/exec.mjs validate [path]` with
1399
+ `tailor seed validate [path]`.
1400
+ - Rewrite `fork("<distPath>/exec.mjs", ...)` call sites (test setup files
1401
+ typically fork the runner and await a hand-rolled Promise around
1402
+ `child.on("close", ...)`). The plugin is a CLI-dispatched binary rather
1403
+ than a forkable JS module, so call it synchronously instead —
1404
+ `execSync("npx tailor seed apply", { env, stdio: "inherit" })` — keeping
1405
+ the original `env` and `stdio` forwarding, and unwind the surrounding
1406
+ Promise wrapper (drop the now-unused `await`, and the `async` keyword when
1407
+ nothing else in the function awaits). Note that `execSync` throws on a
1408
+ nonzero exit, replacing the wrapper's explicit reject.
1409
+ - Delete the stale generated `<distPath>/exec.mjs` file; keep the data/
1410
+ directory (JSONL data and generated schemas) as-is. Nothing removes it
1411
+ automatically, and a leftover runner keeps working while no longer being
1412
+ regenerated.
1413
+ ```
1414
+
1415
+ </details>
1416
+
1417
+ ## @tailor-platform/sdk/test global mocks → @tailor-platform/sdk/vitest
1418
+
1419
+ **Migration:** Manual
1420
+
1421
+ The global platform mocks exported from `@tailor-platform/sdk/test` (`setupTailordbMock`, `setupWorkflowMock`, `setupWaitPointMock`, `setupInvokerMock`, `setupTailorErrorsMock`) and the bundled-output helper `createImportMain` are removed in v2. Use the `tailor-runtime` environment from `@tailor-platform/sdk/vitest` together with `mockTailordb` / `mockWorkflow`: the environment injects `TailorErrors` for you, `setWaitHandler` / `setResolveHandler` replace the wait-point stubs, and the invoker is driven through `globalThis.tailor.context.getInvoker` (or passed directly to `.body()` when testing the TypeScript source). No codemod ships for this migration: it replaces per-test global stubs with a Vitest environment plus disposable mocks, which changes the Vitest config, the setup shape, and the assertions of every affected test. The other `@tailor-platform/sdk/test` exports (`createTailorDBHook`, `createStandardSchema`, `unauthenticatedTailorUser`) are unchanged.
1422
+
1423
+ Job mocks move from a global stub to a disposable mock:
1424
+
1425
+ Before:
1426
+
1427
+ ```ts
1428
+ import { setupWorkflowMock } from "@tailor-platform/sdk/test";
1429
+
1430
+ const { startedJobs } = setupWorkflowMock(() => ({ ok: true }));
1431
+ ```
1432
+
1433
+ After:
1434
+
1435
+ ```ts
1436
+ import { mockWorkflow } from "@tailor-platform/sdk/vitest";
1437
+
1438
+ using wf = mockWorkflow();
1439
+ wf.setJobHandler(() => ({ ok: true }));
1440
+ // wf.startedJobs replaces the returned startedJobs array
1441
+ ```
1442
+
1443
+ <details>
1444
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1445
+
1446
+ ```text
1447
+ The global platform mocks from @tailor-platform/sdk/test are removed in v2.
1448
+ Migrate each affected test to the tailor-runtime Vitest environment:
1449
+
1450
+ 1. Add the environment for the test files that need platform globals — set
1451
+ environment: "tailor-runtime" in the Vitest project config, or add the
1452
+ // @vitest-environment tailor-runtime docblock to the file. The environment
1453
+ ships in @tailor-platform/sdk/vitest and installs TailorErrors and the base
1454
+ tailor/tailordb globals, so setupTailorErrorsMock has no replacement — delete it.
1455
+ 2. Replace setupTailordbMock(resolver) with using db = mockTailordb() and
1456
+ configure query results on that mock; read its recorded calls instead of the
1457
+ returned executedQueries / createdClients arrays.
1458
+ 3. Replace setupWorkflowMock(handler) with using wf = mockWorkflow() plus
1459
+ wf.setJobHandler(handler) (or wf.enqueueResult(...) for order-based results),
1460
+ and read wf.startedJobs.
1461
+ 4. Replace setupWaitPointMock({ onWait, onResolve }) with the same mockWorkflow()
1462
+ handle: wf.setWaitHandler / wf.setResolveHandler, asserting on wf.waitCalls /
1463
+ wf.resolveCalls.
1464
+ 5. Replace setupInvokerMock(invoker) with
1465
+ vi.spyOn(globalThis.tailor.context, "getInvoker").mockReturnValue(raw) for a
1466
+ bundled test, or pass invoker directly to .body() when unit-testing a
1467
+ resolver/executor/workflow job against the TypeScript source.
1468
+ 6. Drop createImportMain and the tests that import bundled output through it.
1469
+ Bundling integrity is the SDK's responsibility: unit-test the TypeScript
1470
+ source and cover deployed behavior with E2E tests instead.
1471
+
1472
+ See the SDK testing guide for the full environment setup.
1473
+ ```
1474
+
1475
+ </details>
1476
+
1477
+ ## Programmatic CLI name options → workflow/executor definitions
1478
+
1479
+ **Migration:** Manual
1480
+
1481
+ The name-keyed option types exported from `@tailor-platform/sdk/cli` — `GetWorkflowOptions`, `StartWorkflowOptions`, `ListWorkflowExecutionsOptions`, `GetExecutorOptions`, `TriggerExecutorOptions`, `ListExecutorJobsOptions`, `GetExecutorJobOptions`, `WatchExecutorJobOptions` — are removed in v2, together with the function overloads that accepted them. Pass the workflow or executor definition itself instead: `{ workflow: myWorkflow, invoker: "admin" }` / `{ executor: myExecutor }`, matching the `*TypedOptions` shape that types `arg` and `payload` from the definition. No codemod ships for this migration: rewriting a name string into a definition requires importing the module that defines the workflow or executor, which a source-local transform cannot resolve.
1482
+
1483
+ Before:
1484
+
1485
+ ```ts
1486
+ import { startWorkflow } from "@tailor-platform/sdk/cli";
1487
+
1488
+ const { executionId } = await startWorkflow({ name: "user-sync", machineUser: "admin" });
1489
+ ```
1490
+
1491
+ After:
1492
+
1493
+ ```ts
1494
+ import { startWorkflow } from "@tailor-platform/sdk/cli";
1495
+ import userSync from "./workflows/userSync";
1496
+
1497
+ const { executionId } = await startWorkflow({ workflow: userSync, invoker: "admin" });
1498
+ ```
1499
+
1500
+ Executor commands take the executor definition:
1501
+
1502
+ Before:
1503
+
1504
+ ```ts
1505
+ const result = await watchExecutorJob({ executorName: "daily-sync", jobId });
1506
+ ```
1507
+
1508
+ After:
1509
+
1510
+ ```ts
1511
+ const result = await watchExecutorJob({ executor: dailySync, jobId });
1512
+ ```
1513
+
1514
+ <details>
1515
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1516
+
1517
+ ```text
1518
+ The programmatic CLI functions in @tailor-platform/sdk/cli no longer accept a
1519
+ workflow or executor name; they take the definition object instead. For each
1520
+ flagged call site:
1521
+
1522
+ 1. Import the workflow or executor definition — the module whose default export
1523
+ is createWorkflow(...) or whose export is createExecutor(...) with that name.
1524
+ 2. Replace name: "my-workflow" with workflow: myWorkflow, and
1525
+ executorName: "my-executor" with executor: myExecutor. For
1526
+ listWorkflowExecutions, workflowName becomes workflow.
1527
+ 3. startWorkflow's machine user moves from machineUser to the required
1528
+ invoker, typed against the machine users declared in tailor.config.ts.
1529
+ 4. Replace imported option types with the *TypedOptions equivalent
1530
+ (e.g. GetWorkflowOptions → GetWorkflowTypedOptions<typeof myWorkflow>).
1531
+ Note that arg (startWorkflow) and payload (triggerExecutor) are now typed
1532
+ from the definition, so a mistyped argument becomes a type error.
1533
+
1534
+ When the name is only known at runtime (read from argv or an environment
1535
+ variable), the CLI command itself — `tailor workflow start <name>` /
1536
+ `tailor executor trigger <name>` — remains the name-keyed entry point.
1537
+ ```
1538
+
1539
+ </details>
1540
+
1541
+ ## tailor.d.ts Env uses value types instead of literal values
1542
+
1543
+ **Migration:** Manual
1544
+
1545
+ The `Env` interface in `tailor.d.ts` is generated from the type of each `defineConfig({ env })` value (`string`, `number`, or `boolean`) instead of the value itself, so the generated file no longer carries whatever the config resolved to when it was generated. Keys that aren't valid TypeScript identifiers are quoted, which previously produced a file that failed to parse. Run `tailor generate` to refresh the file, then widen any code that depended on the old literal types. If a `tailor.d.ts` you already committed contains a sensitive value, treat that value as exposed and rotate it; keep secrets in Secret Manager rather than `env`.
1546
+
1547
+ An env value can no longer stand in for a literal union; narrow it explicitly:
1548
+
1549
+ Before:
1550
+
1551
+ ```ts
1552
+ const stage: "production" | "staging" = env.STAGE;
1553
+ ```
1554
+
1555
+ After:
1556
+
1557
+ ```ts
1558
+ const stage = env.STAGE === "staging" ? "staging" : "production";
1559
+ ```
1560
+
1561
+ <details>
1562
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1563
+
1564
+ ```text
1565
+ Tailor SDK v2 generates the `Env` interface in `tailor.d.ts` from the type of
1566
+ each `defineConfig({ env })` value (`string`, `number`, `boolean`) instead of
1567
+ the resolved value, so `Env` properties no longer carry literal types.
1568
+
1569
+ Run `tailor generate` first to refresh `tailor.d.ts`, then review the places
1570
+ that depended on the old literal types:
1571
+
1572
+ - An env value assigned or passed where a literal union is required, e.g.
1573
+ `const stage: "production" | "staging" = env.STAGE`. Narrow it with a
1574
+ comparison or a validation helper instead of relying on the declared type.
1575
+ - A generic argument, conditional type, or template-literal type parameterized
1576
+ by an env value.
1577
+ - `as const` / `satisfies` assertions that assumed one specific literal.
1578
+
1579
+ Plain comparisons (`env.STAGE === "production"`) and arithmetic on numeric env
1580
+ values keep working and need no change. Do not restore the old behavior by
1581
+ editing `tailor.d.ts`: it is generated and will be overwritten, and embedding
1582
+ env values there is what leaked configured secrets into version control.
1583
+ ```
1584
+
1585
+ </details>
1586
+
1587
+ ## Behavioral changes (no migration required)
1588
+
1589
+ These v2 changes alter runtime or CLI behavior; no source change is needed.
1590
+
1591
+ ### publishEvents recomputed from the executors in each deploy
1592
+
1593
+ An unset `publishEvents` is recomputed on every `deploy` from the executors taking part in the run, in both directions: adding a subscribing trigger turns publishing on, and removing the last one turns it back off. Previously a workflow or job kept publishing once it had been enabled, so a workflow whose subscribing trigger is already gone stops publishing on the next `deploy` — declare `publishEvents: true` on it if something outside this project consumes those events. `deploy` also stops instead of applying when a subscription cannot be satisfied: when a trigger names a resource no config in the run declares, when a workflow or job combines `publishEvents: false` with a subscribing trigger, and when a config that resolves without an `id` subscribes across configs. Each of those errors names the resource and both ways to resolve it.
1594
+
1595
+ ### CLI tokens stored in the OS keyring
1596
+
1597
+ CLI login tokens are stored in the OS keyring by default when available, falling back to the platform config file when it is not. No source change is required; re-login if you need tokens moved into the keyring.
1598
+
1599
+ ### CLI users keyed by subject ID
1600
+
1601
+ The CLI stores human users by their stable subject ID instead of email (email is kept for display). Legacy email-keyed entries are migrated automatically on the next login or token refresh. No source change is required.
1602
+
1603
+ ### function logs require a content hash for source mapping
1604
+
1605
+ `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.
1606
+
1607
+ ### Node.js minimum version raised to 22.15.0
1608
+
1609
+ 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. No source change is required; ensure your environment runs Node.js 22.15.0+.
1610
+
1611
+ ### Legacy bundle artifact cleanup removed from deploy
1612
+
1613
+ `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.