@tailor-platform/sdk 2.0.0-next.4 → 2.0.0-next.6

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 (321) hide show
  1. package/CHANGELOG.md +135 -0
  2. package/dist/{application-BX13RArL.mjs → application-BJXRpQj5.mjs} +602 -1842
  3. package/dist/application-BJXRpQj5.mjs.map +1 -0
  4. package/dist/application-BV-AXawv.mjs +3 -0
  5. package/dist/cli/cache/bundle-cache.d.mts +2 -1
  6. package/dist/cli/cache/store.d.mts +1 -1
  7. package/dist/cli/commands/api/index.d.mts +1 -0
  8. package/dist/cli/commands/deploy/aigateway.d.mts +5 -1
  9. package/dist/cli/commands/deploy/application.d.mts +7 -1
  10. package/dist/cli/commands/deploy/apply-phases.d.mts +14 -1
  11. package/dist/cli/commands/deploy/auth.d.mts +5 -1
  12. package/dist/cli/commands/deploy/deploy.d.mts +13 -3
  13. package/dist/cli/commands/deploy/executor.d.mts +7 -1
  14. package/dist/cli/commands/deploy/function-registry.d.mts +5 -0
  15. package/dist/cli/commands/deploy/idp.d.mts +5 -1
  16. package/dist/cli/commands/deploy/resolver.d.mts +5 -1
  17. package/dist/cli/commands/deploy/secret-manager.d.mts +5 -1
  18. package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -1
  19. package/dist/cli/commands/deploy/tailordb/index.d.mts +8 -1
  20. package/dist/cli/commands/deploy/types.d.mts +3 -1
  21. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +3 -1
  22. package/dist/cli/commands/deploy/workflow.d.mts +4 -1
  23. package/dist/cli/commands/executor/get.d.mts +0 -1
  24. package/dist/cli/commands/executor/jobs.d.mts +0 -1
  25. package/dist/cli/commands/executor/list.d.mts +0 -1
  26. package/dist/cli/commands/executor/transform.d.mts +1 -0
  27. package/dist/cli/commands/executor/trigger.d.mts +0 -1
  28. package/dist/cli/commands/executor/webhook.d.mts +0 -1
  29. package/dist/cli/commands/function/get.d.mts +0 -1
  30. package/dist/cli/commands/function/list.d.mts +0 -1
  31. package/dist/cli/commands/function/transform.d.mts +1 -0
  32. package/dist/cli/commands/generate/options.d.mts +0 -1
  33. package/dist/cli/commands/generate/service.d.mts +6 -2
  34. package/dist/cli/commands/machineuser/list.d.mts +0 -1
  35. package/dist/cli/commands/machineuser/token.d.mts +0 -1
  36. package/dist/cli/commands/oauth2client/get.d.mts +0 -1
  37. package/dist/cli/commands/oauth2client/list.d.mts +0 -1
  38. package/dist/cli/commands/oauth2client/transform.d.mts +1 -0
  39. package/dist/cli/commands/organization/folder/create.d.mts +0 -1
  40. package/dist/cli/commands/organization/folder/delete.d.mts +0 -1
  41. package/dist/cli/commands/organization/folder/get.d.mts +0 -1
  42. package/dist/cli/commands/organization/folder/list.d.mts +0 -1
  43. package/dist/cli/commands/organization/folder/update.d.mts +0 -1
  44. package/dist/cli/commands/organization/get.d.mts +0 -1
  45. package/dist/cli/commands/organization/list.d.mts +0 -1
  46. package/dist/cli/commands/organization/transform.d.mts +2 -0
  47. package/dist/cli/commands/organization/tree.d.mts +0 -1
  48. package/dist/cli/commands/organization/update.d.mts +0 -1
  49. package/dist/cli/commands/remove.d.mts +0 -1
  50. package/dist/cli/commands/show.d.mts +9 -4
  51. package/dist/cli/commands/staticwebsite/deploy.d.mts +19 -0
  52. package/dist/cli/commands/tailordb/migrate/config.d.mts +0 -1
  53. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +16 -3
  54. package/dist/cli/commands/tailordb/migrate/generate.d.mts +0 -1
  55. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +6 -0
  56. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
  57. package/dist/cli/commands/tailordb/truncate.d.mts +0 -1
  58. package/dist/cli/commands/workflow/executions.d.mts +0 -1
  59. package/dist/cli/commands/workflow/get.d.mts +2 -1
  60. package/dist/cli/commands/workflow/list.d.mts +0 -1
  61. package/dist/cli/commands/workflow/resume.d.mts +0 -1
  62. package/dist/cli/commands/workflow/start.d.mts +0 -1
  63. package/dist/cli/commands/workflow/status.d.mts +1 -0
  64. package/dist/cli/commands/workflow/transform.d.mts +1 -0
  65. package/dist/cli/commands/workflow/wait.d.mts +0 -1
  66. package/dist/cli/commands/workflow/waiter.d.mts +1 -1
  67. package/dist/cli/commands/workspace/app/health.d.mts +0 -1
  68. package/dist/cli/commands/workspace/app/list.d.mts +0 -1
  69. package/dist/cli/commands/workspace/app/transform.d.mts +2 -0
  70. package/dist/cli/commands/workspace/create.d.mts +3 -1
  71. package/dist/cli/commands/workspace/delete.d.mts +0 -1
  72. package/dist/cli/commands/workspace/get.d.mts +0 -1
  73. package/dist/cli/commands/workspace/list.d.mts +1 -1
  74. package/dist/cli/commands/workspace/restore.d.mts +0 -1
  75. package/dist/cli/commands/workspace/transform.d.mts +4 -0
  76. package/dist/cli/commands/workspace/user/invite.d.mts +0 -1
  77. package/dist/cli/commands/workspace/user/list.d.mts +0 -1
  78. package/dist/cli/commands/workspace/user/remove.d.mts +0 -1
  79. package/dist/cli/commands/workspace/user/transform.d.mts +1 -0
  80. package/dist/cli/commands/workspace/user/update.d.mts +0 -1
  81. package/dist/cli/index.d.mts +6 -3
  82. package/dist/cli/index.mjs +871 -1577
  83. package/dist/cli/index.mjs.map +1 -1
  84. package/dist/cli/lib.d.mts +10 -4
  85. package/dist/cli/lib.mjs +50 -4
  86. package/dist/cli/lib.mjs.map +1 -1
  87. package/dist/cli/query/index.d.mts +0 -1
  88. package/dist/cli/services/application.d.mts +12 -1
  89. package/dist/cli/services/auth/service.d.mts +2 -0
  90. package/dist/cli/services/executor/service.d.mts +1 -1
  91. package/dist/cli/services/http-adapter/bundler.d.mts +3 -1
  92. package/dist/cli/services/http-adapter/service.d.mts +2 -1
  93. package/dist/cli/services/resolver/service.d.mts +1 -1
  94. package/dist/cli/services/tailordb/service.d.mts +3 -1
  95. package/dist/cli/services/workflow/bundler.d.mts +2 -1
  96. package/dist/cli/services/workflow/service.d.mts +1 -1
  97. package/dist/cli/shared/args.d.mts +1 -1
  98. package/dist/cli/shared/client.d.mts +1 -1
  99. package/dist/cli/shared/config-loader.d.mts +1 -2
  100. package/dist/cli/shared/context.d.mts +2 -1
  101. package/dist/cli/shared/readonly-guard.d.mts +25 -0
  102. package/dist/cli/shared/script-executor.d.mts +0 -1
  103. package/dist/cli/shared/seed-chunker.d.mts +7 -3
  104. package/dist/cli/shared/tailordb-namespaces.d.mts +37 -0
  105. package/dist/cli/shared/type-generator.d.mts +0 -1
  106. package/dist/cli/shared/workspace-name.d.mts +1 -0
  107. package/dist/completion/zsh-worker.zsh +15 -303
  108. package/dist/configure/config/index.d.mts +0 -1
  109. package/dist/configure/config/types.d.mts +2 -2
  110. package/dist/configure/index.d.mts +14 -4
  111. package/dist/configure/index.mjs +201 -6
  112. package/dist/configure/index.mjs.map +1 -1
  113. package/dist/configure/services/aigateway/index.d.mts +0 -1
  114. package/dist/configure/services/aigateway/types.d.mts +0 -1
  115. package/dist/configure/services/auth/index.d.mts +0 -1
  116. package/dist/configure/services/auth/types.d.mts +15 -14
  117. package/dist/configure/services/executor/executor.d.mts +2 -13
  118. package/dist/configure/services/executor/index.d.mts +1 -0
  119. package/dist/configure/services/executor/operation.d.mts +9 -4
  120. package/dist/configure/services/executor/trigger/event.d.mts +0 -1
  121. package/dist/configure/services/executor/trigger/index.d.mts +0 -1
  122. package/dist/configure/services/executor/trigger/schedule.d.mts +0 -1
  123. package/dist/configure/services/executor/trigger/webhook.d.mts +0 -1
  124. package/dist/configure/services/http-adapter/http-adapter.d.mts +1 -2
  125. package/dist/configure/services/idp/index.d.mts +1 -5
  126. package/dist/configure/services/idp/permission.d.mts +4 -5
  127. package/dist/configure/services/idp/types.d.mts +0 -1
  128. package/dist/configure/services/index.d.mts +5 -0
  129. package/dist/configure/services/resolver/resolver.d.mts +1 -0
  130. package/dist/configure/services/resolver/types.d.mts +0 -1
  131. package/dist/configure/services/secrets/index.d.mts +0 -1
  132. package/dist/configure/services/secrets/types.d.mts +0 -1
  133. package/dist/configure/services/staticwebsite/index.d.mts +0 -1
  134. package/dist/configure/services/staticwebsite/types.d.mts +0 -1
  135. package/dist/configure/services/tailordb/permission.d.mts +4 -5
  136. package/dist/configure/services/tailordb/schema.d.mts +86 -56
  137. package/dist/configure/services/tailordb/types.d.mts +66 -17
  138. package/dist/configure/services/workflow/execution-policy.d.mts +2 -3
  139. package/dist/configure/services/workflow/execution-policy.types.d.mts +0 -1
  140. package/dist/configure/services/workflow/index.d.mts +1 -0
  141. package/dist/configure/services/workflow/job.d.mts +0 -1
  142. package/dist/configure/services/workflow/wait-point.d.mts +0 -1
  143. package/dist/configure/services/workflow/workflow.d.mts +1 -1
  144. package/dist/configure/types/field.d.mts +1 -2
  145. package/dist/configure/types/field.types.d.mts +6 -45
  146. package/dist/configure/types/index.d.mts +1 -0
  147. package/dist/configure/types/type.d.mts +2 -11
  148. package/dist/{crashreport-D3RjuSYb.mjs → crashreport-0ioNRZ4K.mjs} +1 -1
  149. package/dist/{crashreport-Cg-pqRJV.mjs → crashreport-CxHne11E.mjs} +4 -3
  150. package/dist/{crashreport-Cg-pqRJV.mjs.map → crashreport-CxHne11E.mjs.map} +1 -1
  151. package/dist/errors-DfnF4ibq.mjs +100 -0
  152. package/dist/errors-DfnF4ibq.mjs.map +1 -0
  153. package/dist/{globals-BjhJJ2dN.mjs → globals-D-YbJKW-.mjs} +16 -10
  154. package/dist/globals-D-YbJKW-.mjs.map +1 -0
  155. package/dist/kysely/index.d.mts +3 -4
  156. package/dist/{kysely-type-D-zflMGf.mjs → kysely-type-DqIRgDYR.mjs} +4 -3
  157. package/dist/kysely-type-DqIRgDYR.mjs.map +1 -0
  158. package/dist/{logger-BEiZZ3qT.mjs → logger-BwS4ppwO.mjs} +3 -3
  159. package/dist/logger-BwS4ppwO.mjs.map +1 -0
  160. package/dist/parser/service/auth/index.d.mts +1 -1
  161. package/dist/parser/service/auth/schema.d.mts +2 -0
  162. package/dist/parser/service/http-adapter/index.d.mts +1 -1
  163. package/dist/parser/service/idp/types.d.mts +1 -0
  164. package/dist/parser/service/tailordb/type-source.d.mts +10 -0
  165. package/dist/parser/service/tailordb/types.d.mts +6 -1
  166. package/dist/plugin/builtin/enum-constants/index.d.mts +0 -1
  167. package/dist/plugin/builtin/file-utils/index.d.mts +0 -1
  168. package/dist/plugin/builtin/kysely-type/index.d.mts +0 -1
  169. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  170. package/dist/plugin/builtin/seed/index.d.mts +0 -1
  171. package/dist/plugin/get-generated-type.d.mts +0 -1
  172. package/dist/plugin/manager.d.mts +2 -1
  173. package/dist/plugin/types.d.mts +0 -1
  174. package/dist/plugin/with-context.d.mts +0 -1
  175. package/dist/{register-ts-hook-BM1caLT0.mjs → register-ts-hook-DL31O2W9.mjs} +3076 -1744
  176. package/dist/register-ts-hook-DL31O2W9.mjs.map +1 -0
  177. package/dist/{registry-BSbq6SPo.mjs → registry-CC3CbQiF.mjs} +3 -3
  178. package/dist/registry-CC3CbQiF.mjs.map +1 -0
  179. package/dist/runtime/aigateway.d.mts +0 -1
  180. package/dist/runtime/authconnection.d.mts +0 -1
  181. package/dist/runtime/context.d.mts +0 -1
  182. package/dist/runtime/field-parse.d.mts +10 -0
  183. package/dist/runtime/globals.d.mts +5 -3
  184. package/dist/runtime/index.d.mts +0 -1
  185. package/dist/runtime/index.mjs +1 -1
  186. package/dist/runtime/types.d.mts +9 -4
  187. package/dist/runtime/workflow.d.mts +70 -10
  188. package/dist/runtime/workflow.mjs +1 -1
  189. package/dist/{schema-C4LYbXVG.mjs → schema--xYWRGfe.mjs} +272 -51
  190. package/dist/schema--xYWRGfe.mjs.map +1 -0
  191. package/dist/{secret-file-aoNXJmKa.mjs → secret-file-C3J4Gy8r.mjs} +2 -27
  192. package/dist/secret-file-C3J4Gy8r.mjs.map +1 -0
  193. package/dist/{secretmanager-Bd45j7an.mjs → secretmanager-IY4UvinW.mjs} +42 -9
  194. package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
  195. package/dist/seed/index.d.mts +3 -2
  196. package/dist/{service-ufH7sS8o.mjs → service-CnHz9rwz.mjs} +47 -20
  197. package/dist/service-CnHz9rwz.mjs.map +1 -0
  198. package/dist/{service-DeZeYa06.mjs → service-DaeJlBoH.mjs} +3 -3
  199. package/dist/{service-DeZeYa06.mjs.map → service-DaeJlBoH.mjs.map} +1 -1
  200. package/dist/service-nU6ITOHL.mjs +3 -0
  201. package/dist/service_pb-BoLM0X4K.mjs +167 -0
  202. package/dist/service_pb-BoLM0X4K.mjs.map +1 -0
  203. package/dist/{service_pb-B2FF59sP.mjs → service_pb-r1T7kpJc.mjs} +1 -1
  204. package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +0 -1
  205. package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +0 -1
  206. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +0 -1
  207. package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +0 -1
  208. package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +0 -1
  209. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +0 -1
  210. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +0 -1
  211. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +0 -1
  212. package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +0 -1
  213. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +0 -1
  214. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +0 -1
  215. package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +0 -1
  216. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +0 -1
  217. package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +0 -1
  218. package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +0 -1
  219. package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +0 -1
  220. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +0 -1
  221. package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +0 -1
  222. package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +0 -1
  223. package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +0 -1
  224. package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +0 -1
  225. package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +0 -1
  226. package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +0 -1
  227. package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +0 -1
  228. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +0 -1
  229. package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +0 -1
  230. package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +0 -1
  231. package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +0 -1
  232. package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +0 -1
  233. package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +0 -1
  234. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +0 -1
  235. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +0 -1
  236. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +0 -1
  237. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +0 -1
  238. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +0 -1
  239. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +0 -1
  240. package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +0 -1
  241. package/dist/types/aigateway.generated.d.mts +5 -2
  242. package/dist/types/auth-connection.generated.d.mts +24 -11
  243. package/dist/types/auth.generated.d.mts +115 -84
  244. package/dist/types/executor.generated.d.mts +133 -123
  245. package/dist/types/helpers.d.mts +7 -6
  246. package/dist/types/http-adapter.generated.d.mts +11 -5
  247. package/dist/types/idp.generated.d.mts +536 -524
  248. package/dist/types/resolver.generated.d.mts +26 -11
  249. package/dist/types/staticwebsite.generated.d.mts +7 -3
  250. package/dist/types/tailordb.generated.d.mts +57 -29
  251. package/dist/types/workflow.generated.d.mts +9 -4
  252. package/dist/user-agent-Bgsszb5I.mjs +28 -0
  253. package/dist/user-agent-Bgsszb5I.mjs.map +1 -0
  254. package/dist/utils/test/index.d.mts +1 -2
  255. package/dist/utils/test/index.mjs +36 -10
  256. package/dist/utils/test/index.mjs.map +1 -1
  257. package/dist/utils/test/mock.d.mts +0 -1
  258. package/dist/vitest/environment.mjs +1 -1
  259. package/dist/vitest/index.d.mts +9 -9
  260. package/dist/vitest/index.mjs +591 -173
  261. package/dist/vitest/index.mjs.map +1 -1
  262. package/dist/vitest/mock-kysely.d.mts +0 -1
  263. package/dist/vitest/mock.d.mts +8 -8
  264. package/dist/vitest/mocks/aigateway.d.mts +16 -6
  265. package/dist/vitest/mocks/authconnection.d.mts +16 -6
  266. package/dist/vitest/mocks/file.d.mts +23 -6
  267. package/dist/vitest/mocks/iconv.d.mts +28 -4
  268. package/dist/vitest/mocks/idp.d.mts +26 -10
  269. package/dist/vitest/mocks/secretmanager.d.mts +16 -5
  270. package/dist/vitest/mocks/tailordb.d.mts +54 -10
  271. package/dist/vitest/mocks/workflow.d.mts +72 -21
  272. package/dist/vitest/setup.mjs +2 -2
  273. package/dist/vitest/workflow-local.d.mts +1 -0
  274. package/dist/workflow-9kHGKxF2.mjs +64 -0
  275. package/dist/workflow-9kHGKxF2.mjs.map +1 -0
  276. package/dist/{service_pb-B5w9rjPY.mjs → workspace_resource_pb-Db3fv68L.mjs} +57 -165
  277. package/dist/workspace_resource_pb-Db3fv68L.mjs.map +1 -0
  278. package/docs/cli/application.md +61 -15
  279. package/docs/cli/setup.md +1 -1
  280. package/docs/cli/tailordb.md +8 -140
  281. package/docs/cli/workspace.md +6 -4
  282. package/docs/cli-reference.md +18 -14
  283. package/docs/github-actions.md +8 -0
  284. package/docs/migration/v2.md +247 -0
  285. package/docs/runtime.md +5 -6
  286. package/docs/services/aigateway.md +2 -0
  287. package/docs/services/executor.md +5 -0
  288. package/docs/services/tailordb.md +144 -68
  289. package/docs/services/workflow.md +3 -3
  290. package/docs/testing.md +105 -89
  291. package/package.json +22 -25
  292. package/dist/application-BO4ZF8wP.mjs +0 -3
  293. package/dist/application-BX13RArL.mjs.map +0 -1
  294. package/dist/cli/erd-viewer-assets/app.js +0 -1424
  295. package/dist/cli/erd-viewer-assets/index.html +0 -77
  296. package/dist/cli/erd-viewer-assets/serve.json +0 -13
  297. package/dist/cli/erd-viewer-assets/styles.css +0 -1036
  298. package/dist/cli/shared/trigger-context.d.mts +0 -1
  299. package/dist/configure/types/field-runtime.d.mts +0 -17
  300. package/dist/errors-118wUDRr.mjs +0 -42
  301. package/dist/errors-118wUDRr.mjs.map +0 -1
  302. package/dist/field-runtime-CAnh_oow.mjs +0 -183
  303. package/dist/field-runtime-CAnh_oow.mjs.map +0 -1
  304. package/dist/globals-BjhJJ2dN.mjs.map +0 -1
  305. package/dist/kysely-type-D-zflMGf.mjs.map +0 -1
  306. package/dist/logger-BEiZZ3qT.mjs.map +0 -1
  307. package/dist/register-ts-hook-BM1caLT0.mjs.map +0 -1
  308. package/dist/registry-BSbq6SPo.mjs.map +0 -1
  309. package/dist/resource_pb-BRv7AMXK.mjs +0 -49
  310. package/dist/resource_pb-BRv7AMXK.mjs.map +0 -1
  311. package/dist/schema-C4LYbXVG.mjs.map +0 -1
  312. package/dist/secret-file-aoNXJmKa.mjs.map +0 -1
  313. package/dist/secretmanager-Bd45j7an.mjs.map +0 -1
  314. package/dist/service-CkIwEctX.mjs +0 -3
  315. package/dist/service-ufH7sS8o.mjs.map +0 -1
  316. package/dist/service_pb-B5w9rjPY.mjs.map +0 -1
  317. package/dist/types-C-lQ4se3.mjs +0 -4
  318. package/dist/types-CXF2OYdR.mjs +0 -199
  319. package/dist/types-CXF2OYdR.mjs.map +0 -1
  320. package/dist/workflow-GNuSnsTx.mjs +0 -22
  321. package/dist/workflow-GNuSnsTx.mjs.map +0 -1
@@ -38,10 +38,9 @@ tailor generate [options]
38
38
 
39
39
  **Options**
40
40
 
41
- | Option | Alias | Description | Required | Default |
42
- | ------------------- | ----- | ---------------------------------------------- | -------- | -------------------- |
43
- | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` |
44
- | `--watch` | `-W` | Watch for type/resolver changes and regenerate | No | `false` |
41
+ | Option | Alias | Description | Required | Default |
42
+ | ------------------- | ----- | ----------------------- | -------- | -------------------- |
43
+ | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` |
45
44
 
46
45
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
47
46
 
@@ -57,19 +56,66 @@ tailor deploy [options]
57
56
 
58
57
  **Options**
59
58
 
60
- | Option | Alias | Description | Required | Default | Env |
61
- | ------------------------------- | ----- | ------------------------------------------------------------------------------------ | -------- | -------------------- | --------------------------------- |
62
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
63
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
64
- | `--config <CONFIG>` | `-c` | Path to SDK config file. Use comma-separated paths to deploy multiple apps together. | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
65
- | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
66
- | `--dry-run` | `-d` | Run the command without making any changes | No | - | - |
67
- | `--no-schema-check` | - | Skip schema diff check against migration snapshots | No | - | - |
68
- | `--no-validate` | - | Skip client-side validation against platform resource constraints | No | - | - |
69
- | `--no-cache` | - | Disable bundle caching for this run | No | - | - |
70
- | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
59
+ | Option | Alias | Description | Required | Default | Env |
60
+ | --------------------------------------- | ----- | ------------------------------------------------------------------------------------ | -------- | -------------------- | --------------------------------- |
61
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
62
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
63
+ | `--config <CONFIG>` | `-c` | Path to SDK config file. Use comma-separated paths to deploy multiple apps together. | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
64
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
65
+ | `--create-workspace` | - | Create a workspace when the account has none | No | - | - |
66
+ | `--workspace-name <WORKSPACE_NAME>` | - | Name for a workspace created during deploy | No | - | - |
67
+ | `--workspace-region <WORKSPACE_REGION>` | - | Region for a workspace created during deploy | No | - | - |
68
+ | `--organization-id <ORGANIZATION_ID>` | - | Organization ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
69
+ | `--folder-id <FOLDER_ID>` | - | Folder ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
70
+ | `--dry-run` | `-d` | Run the command without making any changes | No | - | - |
71
+ | `--no-schema-check` | - | Skip schema diff check against migration snapshots | No | - | - |
72
+ | `--no-validate` | - | Skip client-side validation against platform resource constraints | No | - | - |
73
+ | `--no-cache` | - | Disable bundle caching for this run | No | - | - |
74
+ | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
71
75
 
72
76
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
77
+ **Workspace Selection:**
78
+
79
+ After validating the configuration file, `deploy` resolves a workspace before bundling the
80
+ application. Explicit configuration takes precedence in this order: `--workspace-id`,
81
+ `TAILOR_PLATFORM_WORKSPACE_ID`, and the selected profile. Otherwise, `deploy` reuses the workspace
82
+ previously selected for that configuration from project-local state. Each config file keeps an
83
+ independent selection, including when multiple configs share a directory. An explicit workspace also
84
+ updates this selection. Saved selections are verified against the workspaces currently visible to
85
+ the authenticated user before reuse, and `deploy` warns when it uses one.
86
+
87
+ When the project has no saved selection, `deploy` discovers the account's workspaces:
88
+
89
+ - One or more workspaces open a selection prompt in an interactive terminal, with an option to
90
+ create a new workspace. With one workspace in non-interactive or JSON mode, it is selected
91
+ automatically. With multiple workspaces, pass `--workspace-id` instead.
92
+ - No workspaces open a guided creation flow in an interactive terminal. The flow asks for a name,
93
+ fetches the available regions from the Platform, and confirms before creating anything. After
94
+ creation, the output shows how to reuse the workspace with `--workspace-id` or
95
+ `TAILOR_PLATFORM_WORKSPACE_ID` from CI or another machine.
96
+
97
+ In CI and other non-interactive environments, workspace creation must be explicit:
98
+
99
+ ```bash
100
+ tailor-sdk deploy \
101
+ --create-workspace \
102
+ --workspace-name example-workspace \
103
+ --workspace-region us-west
104
+ ```
105
+
106
+ `--create-workspace` only creates when the account has no workspace. If the existing workspace
107
+ matches the requested name, region, organization, and folder, `deploy` reuses it so the same command
108
+ is safe to rerun. If multiple workspaces exist, the flag never creates another one or guesses which
109
+ workspace to use. `--yes` skips deployment confirmation but does not authorize workspace creation.
110
+
111
+ If a saved workspace has been deleted or is no longer accessible, interactive terminals return to
112
+ workspace selection. Non-interactive environments stop with `WORKSPACE_CONTEXT_STALE` instead of
113
+ silently switching to another workspace. Automatically selected targets are printed with their
114
+ region, organization, and workspace ID.
115
+
116
+ `--dry-run` never creates a workspace or writes project context. When an account has no workspace,
117
+ create one explicitly before requesting a deployment plan.
118
+
73
119
  **Config File Modification:**
74
120
 
75
121
  On first run, `deploy` automatically injects a stable `id: "<uuid>"` field into your `defineConfig({...})` call in `tailor.config.ts`. This UUID is used to track your application across renames so the SDK can recognize ownership across renames. Commit the generated id to version control. See [Configuration](../configuration.md#application-settings) for details.
package/docs/cli/setup.md CHANGED
@@ -174,7 +174,7 @@ tailor setup tag [options]
174
174
  | Option | Alias | Description | Required | Default |
175
175
  | ----------------------------- | ----- | ---------------------------------------------------------------------------- | -------- | ------- |
176
176
  | `--name <NAME>` | `-n` | Name (defaults to the config 'name') | No | - |
177
- | `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (defaults to v\*) | No | `"v*"` |
177
+ | `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (defaults to v*) | No | `"v*"` |
178
178
  | `--branch <BRANCH>` | - | Tag-reachability guard branch (no guard when omitted) | No | - |
179
179
  | `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
180
180
  | `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
@@ -16,11 +16,10 @@ See [Global Options](../cli-reference.md#global-options) for options available t
16
16
 
17
17
  **Commands**
18
18
 
19
- | Command | Description |
20
- | ------------------------------------------- | ------------------------------------------------------------------------- |
21
- | [`tailordb truncate`](#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
22
- | [`tailordb migration`](#tailordb-migration) | Manage TailorDB schema migrations. |
23
- | [`tailordb erd`](#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
19
+ | Command | Description |
20
+ | ------------------------------------------- | --------------------------------------------------- |
21
+ | [`tailordb truncate`](#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
22
+ | [`tailordb migration`](#tailordb-migration) | Manage TailorDB schema migrations. |
24
23
 
25
24
  ### tailordb truncate
26
25
 
@@ -232,142 +231,11 @@ See [Global Options](../cli-reference.md#global-options) for options available t
232
231
 
233
232
  ### tailordb erd
234
233
 
235
- Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta)
236
-
237
- **Usage**
238
-
239
- ```
240
- tailor tailordb erd <command>
241
- ```
242
-
243
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
244
-
245
- **Commands**
246
-
247
- | Command | Description |
248
- | --------------------------------------------- | ----------------------------------------------------------------- |
249
- | [`tailordb erd export`](#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
250
- | [`tailordb erd diff`](#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
251
- | [`tailordb erd serve`](#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
252
- | [`tailordb erd deploy`](#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
253
-
254
- #### tailordb erd export
255
-
256
- Export TailorDB ERD static viewer from local TailorDB schema.
257
-
258
- **Usage**
259
-
260
- ```
261
- tailor tailordb erd export [options]
262
- ```
263
-
264
- **Options**
265
-
266
- | Option | Alias | Description | Required | Default | Env |
267
- | ------------------------- | ----- | ---------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
268
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
269
- | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (optional if only one namespace is defined in config) | No | - | - |
270
- | `--output <OUTPUT>` | `-o` | Output directory path for TailorDB ERD viewer files (writes to `<outputDir>/<namespace>/dist`) | No | `".tailor/erd"` | - |
271
-
272
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
273
-
274
- #### tailordb erd diff
275
-
276
- Render TailorDB ERD schema diff HTML from exported ERD viewers.
277
-
278
- **Usage**
279
-
280
- ```
281
- tailor tailordb erd diff [options]
282
- ```
283
-
284
- **Options**
285
-
286
- | Option | Alias | Description | Required | Default |
287
- | ----------------------------- | ----- | ----------------------------------------------------------------------- | -------- | ------- |
288
- | `--base-html <BASE_HTML>` | - | Base ERD viewer HTML file | No | - |
289
- | `--head-html <HEAD_HTML>` | - | Head ERD viewer HTML file | No | - |
290
- | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (defaults to the provided ERD schema namespace) | No | - |
291
- | `--output <OUTPUT>` | `-o` | Output ERD diff HTML file | Yes | - |
292
- | `--output-json <OUTPUT_JSON>` | - | Optional output JSON file for the computed diff | No | - |
293
-
294
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
295
-
296
- #### tailordb erd serve
297
-
298
- Generate and serve TailorDB ERD locally with watch reload. (beta)
299
-
300
- **Usage**
301
-
302
- ```
303
- tailor tailordb erd serve [options]
304
- ```
305
-
306
- **Options**
307
-
308
- | Option | Alias | Description | Required | Default | Env |
309
- | ------------------------- | ----- | ------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
310
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
311
- | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (uses first namespace in config if not specified) | No | - | - |
312
- | `--port <PORT>` | - | Local server port (0 selects a free port) | No | `0` | - |
313
- | `--open` | - | Open the ERD viewer in the default browser | No | `false` | - |
314
-
315
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
316
-
317
- #### tailordb erd deploy
318
-
319
- Deploy ERD static website for TailorDB namespace(s).
320
-
321
- **Usage**
322
-
323
- ```
324
- tailor tailordb erd deploy [options]
325
- ```
326
-
327
- **Options**
328
-
329
- | Option | Alias | Description | Required | Default | Env |
330
- | ------------------------------- | ----- | ----------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
331
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
332
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
333
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
334
- | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (optional - deploys all namespaces with erdSite if omitted) | No | - | - |
335
-
336
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
337
-
338
- **Notes:**
339
-
340
- - ERD commands build from the local TailorDB schema, including plugin-generated TailorDB types.
341
- - `tailordb erd export` writes a self-contained `index.html` viewer to `<output>/<namespace>/dist`.
342
- - `tailordb erd diff` compares exported self-contained viewer HTML files and writes a visual ERD viewer that can switch between the current schema and the highlighted diff.
343
- - `tailordb erd serve` watches the config file and TailorDB type files, then reloads the browser viewer when the rebuilt `index.html` reports a new embedded schema revision.
344
- - `tailordb erd deploy` still requires `erdSite` in `tailor.config.ts` because it uploads the generated viewer to a configured Static Website.
345
-
346
- **Usage Examples:**
234
+ The `tailordb erd` commands (export, diff, serve, deploy) are provided by the `@tailor-platform/sdk-tailordb-erd-plugin` CLI plugin. Install it next to the SDK and keep running `tailor tailordb erd <command>` as before:
347
235
 
348
236
  ```bash
349
- # Deploy ERD for all namespaces with erdSite configured
350
- tailor tailordb erd deploy
351
-
352
- # Deploy ERD for a specific namespace
353
- tailor tailordb erd deploy --namespace myNamespace
354
-
355
- # Deploy ERD with JSON output
356
- tailor tailordb erd deploy --json
237
+ npm install -D @tailor-platform/sdk-tailordb-erd-plugin@next
238
+ tailor tailordb erd export --namespace myNamespace
357
239
  ```
358
240
 
359
- **Notes:**
360
-
361
- - This command is a beta feature and may introduce breaking changes in future releases
362
- - Requires `erdSite` to be configured in `tailor.config.ts` for each namespace you want to deploy
363
- - Example config:
364
- ```typescript
365
- export default defineConfig({
366
- db: {
367
- myNamespace: {
368
- // ... table definitions
369
- erdSite: "my-erd-site-name",
370
- },
371
- },
372
- });
373
- ```
241
+ See the plugin's README for the full command reference.
@@ -106,6 +106,7 @@ tailor workspace create [options]
106
106
  | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID to workspace associate with | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
107
107
  | `--folder-id <FOLDER_ID>` | `-f` | Folder ID to workspace associate with | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
108
108
  | `--profile-name <PROFILE_NAME>` | `-p` | Profile name to create | No | - | - |
109
+ | `--profile <PROFILE>` | - | Workspace profile used for authentication and Platform selection | No | - | `TAILOR_PLATFORM_PROFILE` |
109
110
  | `--profile-user <PROFILE_USER>` | - | User email address or machine user client ID for the profile (defaults to current user) | No | - | - |
110
111
  | `--permission <PERMISSION>` | - | Profile permission (requires --profile-name). 'read' blocks all write commands while the profile is active. | No | `"write"` | - |
111
112
 
@@ -161,10 +162,11 @@ tailor workspace list [options]
161
162
 
162
163
  **Options**
163
164
 
164
- | Option | Alias | Description | Required | Default |
165
- | ----------------- | ----- | -------------------------------------------------------- | -------- | -------- |
166
- | `--order <ORDER>` | - | Sort order (asc or desc) | No | `"desc"` |
167
- | `--limit <LIMIT>` | `-l` | Maximum number of items to return (0 or omit: unlimited) | No | - |
165
+ | Option | Alias | Description | Required | Default | Env |
166
+ | --------------------- | ----- | ---------------------------------------------------------------- | -------- | -------- | ------------------------- |
167
+ | `--order <ORDER>` | - | Sort order (asc or desc) | No | `"desc"` | - |
168
+ | `--limit <LIMIT>` | `-l` | Maximum number of items to return (0 or omit: unlimited) | No | - | - |
169
+ | `--profile <PROFILE>` | - | Workspace profile used for authentication and Platform selection | No | - | `TAILOR_PLATFORM_PROFILE` |
168
170
 
169
171
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
170
172
 
@@ -11,12 +11,13 @@ tailor <command> [options]
11
11
  ## Global Options
12
12
 
13
13
  <a id="global-options"></a>
14
- | Option | Alias | Description | Required | Default |
15
- |--------|-------|-------------|----------|---------|
16
- | `--env-file <ENV_FILE>` | `-e` | Path to the environment file (error if not found) | No | - |
17
- | `--env-file-if-exists <ENV_FILE_IF_EXISTS>` | - | Path to the environment file (ignored if not found) | No | - |
18
- | `--verbose` | - | Enable verbose logging | No | `false` |
19
- | `--json` | `-j` | Output as JSON | No | `false` |
14
+
15
+ | Option | Alias | Description | Required | Default |
16
+ | ------------------------------------------- | ----- | --------------------------------------------------- | -------- | ------- |
17
+ | `--env-file <ENV_FILE>` | `-e` | Path to the environment file (error if not found) | No | - |
18
+ | `--env-file-if-exists <ENV_FILE_IF_EXISTS>` | - | Path to the environment file (ignored if not found) | No | - |
19
+ | `--verbose` | - | Enable verbose logging | No | `false` |
20
+ | `--json` | `-j` | Output as JSON | No | `false` |
20
21
 
21
22
  ### JSON Output
22
23
 
@@ -27,8 +28,11 @@ human-readable text or empty stdout.
27
28
  Commands that only perform side effects and do not define a structured result may leave stdout empty
28
29
  even when `--json` is passed.
29
30
 
30
- Errors, warnings, progress, and diagnostic messages are written to stderr. On failure, check the
31
- non-zero exit code and read stderr; stdout is not guaranteed to contain a JSON error object.
31
+ Errors, warnings, progress, and diagnostic messages are written to stderr. After argument parsing,
32
+ a command failure under `--json` emits a JSON error envelope to stderr. CLI errors include a stable
33
+ `error.code` and may include structured `error.next` and `error.context` fields for automated
34
+ recovery. Diagnostic lines may precede the error envelope, and stdout is not guaranteed to contain
35
+ an error object.
32
36
 
33
37
  ## Common Options
34
38
 
@@ -116,7 +120,9 @@ tailor hello world --loud
116
120
  ```
117
121
 
118
122
  This also works under a built-in command group. The command path is joined with hyphens, so a plugin
119
- nested under `tailordb` is named `tailor-tailordb-erd`:
123
+ nested under `tailordb` is named `tailor-tailordb-erd`. This is how the
124
+ `@tailor-platform/sdk-tailordb-erd-plugin`
125
+ package provides the `tailordb erd` commands:
120
126
 
121
127
  ```bash
122
128
  # Runs `tailor-tailordb-erd` with: export
@@ -132,6 +138,9 @@ Resolution rules:
132
138
  - **Lookup order:** the project's `node_modules/.bin` (nearest first, walking up from the current
133
139
  directory), then your `PATH`. So a plugin installed as a project dev-dependency takes precedence over a
134
140
  globally installed one.
141
+ - **Place global flags after the plugin command.** Only the arguments following the plugin name are
142
+ forwarded; a global flag placed before it (e.g. `tailor --json tailordb erd export`) is consumed by
143
+ the host CLI and does not reach the plugin. Write `tailor tailordb erd export --json` instead.
135
144
 
136
145
  Because resolution is based on `node_modules/.bin` and `PATH`, any package manager that populates
137
146
  `node_modules/.bin` works for project-local plugins — npm, pnpm (its content-addressable store is
@@ -194,11 +203,6 @@ Commands for managing TailorDB tables, data, and schema migrations.
194
203
  | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
195
204
  | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
196
205
  | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
197
- | [tailordb erd](./cli/tailordb.md#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
198
- | [tailordb erd export](./cli/tailordb.md#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
199
- | [tailordb erd diff](./cli/tailordb.md#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
200
- | [tailordb erd serve](./cli/tailordb.md#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
201
- | [tailordb erd deploy](./cli/tailordb.md#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
202
206
 
203
207
  ### [Query Commands](./cli/query.md)
204
208
 
@@ -72,6 +72,14 @@ to pull requests:
72
72
  tailor setup -n my-app-stg --erd-preview
73
73
  ```
74
74
 
75
+ The generated workflow runs `tailor tailordb erd`, which is provided by the
76
+ `@tailor-platform/sdk-tailordb-erd-plugin` CLI plugin — install it as a
77
+ dev-dependency in your project:
78
+
79
+ ```bash
80
+ npm install -D @tailor-platform/sdk-tailordb-erd-plugin@next
81
+ ```
82
+
75
83
  The generated workflow builds one self-contained ERD viewer HTML file for each
76
84
  owned TailorDB namespace in `tailor.config.ts`. The viewer compares the pull
77
85
  request merge result with the base branch, can switch between the current schema
@@ -582,6 +582,54 @@ calls to db.table. Leave unrelated local objects with a .type() method unchanged
582
582
 
583
583
  </details>
584
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
+
585
633
  ## executeScript arg JSON.stringify → value
586
634
 
587
635
  **Migration:** Partially automatic
@@ -825,6 +873,205 @@ After:
825
873
  .tailor/
826
874
  ```
827
875
 
876
+ ## ValidateFn simplification and type-level validate
877
+
878
+ **Migration:** Manual
879
+
880
+ 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.
881
+
882
+ Field-level validate: return an error message string instead of a boolean (tuple form removed):
883
+
884
+ Before:
885
+
886
+ ```ts
887
+ .validate(
888
+ [({ value }) => value.length > 5, "Name must be longer than 5 characters"],
889
+ )
890
+ ```
891
+
892
+ After:
893
+
894
+ ```ts
895
+ .validate(({ value }) =>
896
+ value.length <= 5 ? "Name must be longer than 5 characters" : undefined,
897
+ )
898
+ ```
899
+
900
+ Type-level validate: per-field record syntax replaced by a single function with `issues()` callback:
901
+
902
+ Before:
903
+
904
+ ```ts
905
+ .validate({
906
+ name: [({ value }) => value.length > 5, "Name must be longer than 5"],
907
+ })
908
+ ```
909
+
910
+ After:
911
+
912
+ ```ts
913
+ .validate(({ newRecord }, issues) => {
914
+ if (newRecord.name && newRecord.name.length <= 5) {
915
+ issues("name", "Name must be longer than 5");
916
+ }
917
+ })
918
+ ```
919
+
920
+ <details>
921
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
922
+
923
+ ```text
924
+ The v2 SDK simplifies field validation and introduces type-level validation.
925
+
926
+ Field-level `.validate()` changes:
927
+ - Signature: `(args: { value, data, invoker }) => boolean` → `(args: { value }) => string | void`
928
+ - The function now returns the error message string directly (or undefined/void to pass)
929
+ instead of returning a boolean with the message in a separate tuple.
930
+ - The `[fn, errorMessage]` tuple form (`ValidateConfig`) is removed.
931
+ - `data` and `invoker` are no longer available in field-level validators.
932
+ Use type-level `.validate()` for cross-field or invoker-dependent rules.
933
+
934
+ Type-level `.validate()` on `db.type()` changes:
935
+ - Old: `.validate({ fieldName: fn | [fn, msg] | fn[] })` (per-field record, `Validators<F>` type)
936
+ - New: `.validate((args, issues) => void)` (single function, `TypeValidateFn<F>` type)
937
+ - Args: `{ newRecord, oldRecord, invoker }` — `newRecord` is the record after hooks run
938
+ - Call `issues(field, message)` to report validation errors; `field` supports dotted paths
939
+ - Move per-field validators that need `data`/`invoker` to the type-level function
940
+
941
+ For each remaining `ValidateConfig`, `Validators<`, or old-signature `.validate()` usage:
942
+ 1. Rewrite field-level validators to return the error string directly
943
+ 2. Move cross-field / invoker-dependent validators to the type-level function
944
+ 3. Remove unused `ValidateConfig` / `Validators` type imports
945
+ ```
946
+
947
+ </details>
948
+
949
+ ## TailorDB hook redesign: field-level args and type-level hooks
950
+
951
+ **Migration:** Manual
952
+
953
+ 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.
954
+
955
+ Field-level hooks: `value` renamed to `input`, `data` replaced by `oldValue` and `now`; use `now` instead of `new Date()`:
956
+
957
+ Before:
958
+
959
+ ```ts
960
+ db.datetime().hooks({
961
+ create: ({ value }) => value ?? new Date(),
962
+ update: () => new Date(),
963
+ })
964
+ ```
965
+
966
+ After:
967
+
968
+ ```ts
969
+ db.datetime().hooks({
970
+ create: ({ input, now }) => input ?? now,
971
+ update: ({ now }) => now,
972
+ })
973
+ ```
974
+
975
+ Type-level hooks: per-field mapping replaced by single create/update functions:
976
+
977
+ Before:
978
+
979
+ ```ts
980
+ .hooks({
981
+ fullAddress: {
982
+ create: ({ data }) => `${data.postalCode} ${data.address}`,
983
+ update: ({ data }) => `${data.postalCode} ${data.address}`,
984
+ },
985
+ })
986
+ ```
987
+
988
+ After:
989
+
990
+ ```ts
991
+ .hooks({
992
+ create: ({ input }) => ({
993
+ fullAddress: `${input.postalCode} ${input.address}`,
994
+ }),
995
+ update: ({ input }) => ({
996
+ fullAddress: `${input.postalCode} ${input.address}`,
997
+ }),
998
+ })
999
+ ```
1000
+
1001
+ <details>
1002
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1003
+
1004
+ ```text
1005
+ The v2 SDK redesigns TailorDB hooks at both field and type levels.
1006
+
1007
+ Field-level `.hooks()` on individual fields:
1008
+ - Create args: `{ value, data, invoker }` → `{ input, invoker, now }` (no `oldValue`)
1009
+ - Update args: `{ value, data, invoker }` → `{ input, oldValue, invoker, now }`
1010
+ - `value` is renamed to `input`, matching the type-level hook's `input` arg — both are
1011
+ the same pre-hook data, at different granularity
1012
+ - `data` (full record) is removed; update hooks get `oldValue` (previous field value) instead
1013
+ - `now` provides the operation timestamp — use `now` instead of `new Date()`
1014
+ - If a field-level hook needs the full record (other fields), move it to a type-level hook
1015
+
1016
+ Type-level `.hooks()` on `db.type()`:
1017
+ - Old: `.hooks({ fieldName: { create: fn, update: fn } })` (per-field mapping, `Hooks<F>` type)
1018
+ - New: `.hooks({ create: fn, update: fn })` (single object, `TypeHook<F>` type)
1019
+ - Each function: `({ input, oldRecord, invoker, now }) => ({ fieldName: value, ... })`
1020
+ - `input` is the pre-hook input (may have nullish values for optional/defaulted fields)
1021
+ - Create hooks do not receive `oldRecord`; update hooks receive `oldRecord` (always non-null)
1022
+ - Return an object with only the fields to override; unmentioned fields are unchanged
1023
+
1024
+ Migration steps for each `.hooks()` call on a `db.type()`:
1025
+ 1. If the old per-field hooks only use `value`/`invoker` and don't reference `data`,
1026
+ convert them to field-level hooks with the new args (`value` → `input`, plus `oldValue`, `now`)
1027
+ 2. If the old hooks reference `data` (cross-field access), convert to a type-level hook
1028
+ using `input`/`oldRecord`
1029
+ 3. Remove unused `Hooks<F>` / `HookFn<>` type imports
1030
+ ```
1031
+
1032
+ </details>
1033
+
1034
+ ## generate --watch flag removed
1035
+
1036
+ **Migration:** Manual
1037
+
1038
+ 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.
1039
+
1040
+ The --watch/-W flag no longer exists; re-run generate after each change:
1041
+
1042
+ Before:
1043
+
1044
+ ```sh
1045
+ tailor generate --watch
1046
+ ```
1047
+
1048
+ After:
1049
+
1050
+ ```sh
1051
+ tailor generate
1052
+ ```
1053
+
1054
+ <details>
1055
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1056
+
1057
+ ```text
1058
+ Tailor SDK v2 removes the `generate --watch` (`-W`) flag along with the
1059
+ dependency watcher and self-restart logic that powered it. `tailor generate`
1060
+ now always runs a single generation pass and exits.
1061
+
1062
+ For each flagged `tailor generate ... --watch` / `-W` invocation (package.json
1063
+ scripts, shell scripts, CI configs, or docs), drop the flag and re-run
1064
+ `tailor generate` after each change instead. If automatic regeneration on file
1065
+ change is still needed, wrap the command with a general-purpose file watcher
1066
+ (e.g. `chokidar-cli`, `nodemon`) at the project level.
1067
+
1068
+ For programmatic use of `generate()` from `@tailor-platform/sdk/cli`, remove the
1069
+ `watch` field from the `GenerateOptions` argument — the function now performs a
1070
+ single generation pass and resolves once it completes.
1071
+ ```
1072
+
1073
+ </details>
1074
+
828
1075
  ## Behavioral changes (no migration required)
829
1076
 
830
1077
  These v2 changes alter runtime or CLI behavior; no source change is needed.