@tailor-platform/sdk 2.0.0-next.3 → 2.0.0-next.5

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 (327) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/dist/aigateway-DR4Kwuik.mjs +9 -0
  3. package/dist/{aigateway-B3oZZE6v.mjs.map → aigateway-DR4Kwuik.mjs.map} +1 -1
  4. package/dist/{application-eHp9jXld.mjs → application-Bf8wxOi6.mjs} +701 -597
  5. package/dist/application-Bf8wxOi6.mjs.map +1 -0
  6. package/dist/application-CUkjzfij.mjs +3 -0
  7. package/dist/authconnection-CZvi9ANm.mjs +9 -0
  8. package/dist/authconnection-CZvi9ANm.mjs.map +1 -0
  9. package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
  10. package/dist/cli/cache/bundle-cache.d.mts +2 -1
  11. package/dist/cli/cache/store.d.mts +1 -1
  12. package/dist/cli/commands/api/index.d.mts +1 -0
  13. package/dist/cli/commands/deploy/aigateway.d.mts +5 -1
  14. package/dist/cli/commands/deploy/application.d.mts +7 -1
  15. package/dist/cli/commands/deploy/apply-phases.d.mts +14 -1
  16. package/dist/cli/commands/deploy/auth.d.mts +5 -1
  17. package/dist/cli/commands/deploy/deploy.d.mts +5 -0
  18. package/dist/cli/commands/deploy/executor.d.mts +7 -1
  19. package/dist/cli/commands/deploy/function-registry.d.mts +5 -0
  20. package/dist/cli/commands/deploy/idp.d.mts +5 -1
  21. package/dist/cli/commands/deploy/resolver.d.mts +5 -1
  22. package/dist/cli/commands/deploy/secret-manager.d.mts +5 -1
  23. package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -1
  24. package/dist/cli/commands/deploy/tailordb/index.d.mts +8 -1
  25. package/dist/cli/commands/deploy/types.d.mts +3 -1
  26. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +3 -0
  27. package/dist/cli/commands/deploy/workflow.d.mts +4 -1
  28. package/dist/cli/commands/executor/get.d.mts +0 -1
  29. package/dist/cli/commands/executor/jobs.d.mts +0 -1
  30. package/dist/cli/commands/executor/list.d.mts +0 -1
  31. package/dist/cli/commands/executor/transform.d.mts +1 -0
  32. package/dist/cli/commands/executor/trigger.d.mts +0 -1
  33. package/dist/cli/commands/executor/webhook.d.mts +0 -1
  34. package/dist/cli/commands/function/get.d.mts +0 -1
  35. package/dist/cli/commands/function/list.d.mts +0 -1
  36. package/dist/cli/commands/function/transform.d.mts +1 -0
  37. package/dist/cli/commands/generate/service.d.mts +5 -1
  38. package/dist/cli/commands/machineuser/list.d.mts +0 -1
  39. package/dist/cli/commands/machineuser/token.d.mts +0 -1
  40. package/dist/cli/commands/oauth2client/get.d.mts +0 -1
  41. package/dist/cli/commands/oauth2client/list.d.mts +0 -1
  42. package/dist/cli/commands/oauth2client/transform.d.mts +1 -0
  43. package/dist/cli/commands/organization/folder/create.d.mts +0 -1
  44. package/dist/cli/commands/organization/folder/delete.d.mts +0 -1
  45. package/dist/cli/commands/organization/folder/get.d.mts +0 -1
  46. package/dist/cli/commands/organization/folder/list.d.mts +0 -1
  47. package/dist/cli/commands/organization/folder/update.d.mts +0 -1
  48. package/dist/cli/commands/organization/get.d.mts +0 -1
  49. package/dist/cli/commands/organization/list.d.mts +0 -1
  50. package/dist/cli/commands/organization/transform.d.mts +2 -0
  51. package/dist/cli/commands/organization/tree.d.mts +0 -1
  52. package/dist/cli/commands/organization/update.d.mts +0 -1
  53. package/dist/cli/commands/remove.d.mts +0 -1
  54. package/dist/cli/commands/show.d.mts +9 -4
  55. package/dist/cli/commands/tailordb/migrate/config.d.mts +0 -1
  56. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +16 -3
  57. package/dist/cli/commands/tailordb/migrate/generate.d.mts +0 -1
  58. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +6 -0
  59. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
  60. package/dist/cli/commands/tailordb/truncate.d.mts +0 -1
  61. package/dist/cli/commands/workflow/executions.d.mts +0 -1
  62. package/dist/cli/commands/workflow/get.d.mts +2 -1
  63. package/dist/cli/commands/workflow/list.d.mts +0 -1
  64. package/dist/cli/commands/workflow/resume.d.mts +0 -1
  65. package/dist/cli/commands/workflow/start.d.mts +0 -1
  66. package/dist/cli/commands/workflow/status.d.mts +1 -0
  67. package/dist/cli/commands/workflow/transform.d.mts +1 -0
  68. package/dist/cli/commands/workflow/wait.d.mts +0 -1
  69. package/dist/cli/commands/workflow/waiter.d.mts +1 -1
  70. package/dist/cli/commands/workspace/app/health.d.mts +0 -1
  71. package/dist/cli/commands/workspace/app/list.d.mts +0 -1
  72. package/dist/cli/commands/workspace/app/transform.d.mts +2 -0
  73. package/dist/cli/commands/workspace/create.d.mts +0 -1
  74. package/dist/cli/commands/workspace/delete.d.mts +0 -1
  75. package/dist/cli/commands/workspace/get.d.mts +0 -1
  76. package/dist/cli/commands/workspace/list.d.mts +0 -1
  77. package/dist/cli/commands/workspace/restore.d.mts +0 -1
  78. package/dist/cli/commands/workspace/transform.d.mts +2 -0
  79. package/dist/cli/commands/workspace/user/invite.d.mts +0 -1
  80. package/dist/cli/commands/workspace/user/list.d.mts +0 -1
  81. package/dist/cli/commands/workspace/user/remove.d.mts +0 -1
  82. package/dist/cli/commands/workspace/user/transform.d.mts +1 -0
  83. package/dist/cli/commands/workspace/user/update.d.mts +0 -1
  84. package/dist/cli/index.d.mts +6 -3
  85. package/dist/cli/index.mjs +273 -104
  86. package/dist/cli/index.mjs.map +1 -1
  87. package/dist/cli/lib.d.mts +4 -2
  88. package/dist/cli/lib.mjs +4 -4
  89. package/dist/cli/lib.mjs.map +1 -1
  90. package/dist/cli/query/index.d.mts +4 -1
  91. package/dist/cli/services/application.d.mts +12 -1
  92. package/dist/cli/services/auth/service.d.mts +2 -0
  93. package/dist/cli/services/executor/service.d.mts +1 -1
  94. package/dist/cli/services/http-adapter/bundler.d.mts +3 -1
  95. package/dist/cli/services/http-adapter/service.d.mts +2 -1
  96. package/dist/cli/services/resolver/service.d.mts +1 -1
  97. package/dist/cli/services/tailordb/service.d.mts +3 -1
  98. package/dist/cli/services/workflow/bundler.d.mts +2 -1
  99. package/dist/cli/services/workflow/service.d.mts +1 -1
  100. package/dist/cli/shared/args.d.mts +1 -1
  101. package/dist/cli/shared/client.d.mts +1 -1
  102. package/dist/cli/shared/config-loader.d.mts +0 -1
  103. package/dist/cli/shared/context.d.mts +2 -1
  104. package/dist/cli/shared/script-executor.d.mts +0 -1
  105. package/dist/cli/shared/seed-chunker.d.mts +7 -3
  106. package/dist/cli/shared/type-generator.d.mts +0 -1
  107. package/dist/cli/ts-hook.mjs +43 -13
  108. package/dist/completion/zsh-worker.zsh +10 -10
  109. package/dist/configure/config/index.d.mts +0 -1
  110. package/dist/configure/config/types.d.mts +3 -1
  111. package/dist/configure/index.d.mts +17 -5
  112. package/dist/configure/index.mjs +309 -5
  113. package/dist/configure/index.mjs.map +1 -1
  114. package/dist/configure/services/aigateway/index.d.mts +0 -1
  115. package/dist/configure/services/aigateway/types.d.mts +0 -1
  116. package/dist/configure/services/auth/index.d.mts +0 -1
  117. package/dist/configure/services/auth/types.d.mts +15 -14
  118. package/dist/configure/services/executor/executor.d.mts +1 -1
  119. package/dist/configure/services/executor/index.d.mts +1 -0
  120. package/dist/configure/services/executor/operation.d.mts +2 -2
  121. package/dist/configure/services/executor/trigger/event.d.mts +0 -1
  122. package/dist/configure/services/executor/trigger/index.d.mts +0 -1
  123. package/dist/configure/services/executor/trigger/schedule.d.mts +0 -1
  124. package/dist/configure/services/executor/trigger/webhook.d.mts +0 -1
  125. package/dist/configure/services/http-adapter/http-adapter.d.mts +1 -2
  126. package/dist/configure/services/idp/index.d.mts +1 -5
  127. package/dist/configure/services/idp/permission.d.mts +4 -5
  128. package/dist/configure/services/idp/types.d.mts +0 -1
  129. package/dist/configure/services/index.d.mts +8 -1
  130. package/dist/configure/services/resolver/resolver.d.mts +1 -0
  131. package/dist/configure/services/resolver/types.d.mts +0 -1
  132. package/dist/configure/services/secrets/index.d.mts +0 -1
  133. package/dist/configure/services/secrets/types.d.mts +0 -1
  134. package/dist/configure/services/staticwebsite/index.d.mts +0 -1
  135. package/dist/configure/services/staticwebsite/types.d.mts +0 -1
  136. package/dist/configure/services/tailordb/permission.d.mts +4 -5
  137. package/dist/configure/services/tailordb/schema.d.mts +104 -68
  138. package/dist/configure/services/tailordb/types.d.mts +66 -17
  139. package/dist/configure/services/workflow/execution-policy.d.mts +70 -0
  140. package/dist/configure/services/workflow/execution-policy.types.d.mts +103 -0
  141. package/dist/configure/services/workflow/index.d.mts +4 -1
  142. package/dist/configure/services/workflow/job.d.mts +7 -3
  143. package/dist/configure/services/workflow/wait-point.d.mts +0 -1
  144. package/dist/configure/services/workflow/workflow.d.mts +1 -1
  145. package/dist/configure/types/field-runtime.d.mts +0 -1
  146. package/dist/configure/types/field.d.mts +1 -2
  147. package/dist/configure/types/field.types.d.mts +6 -45
  148. package/dist/configure/types/index.d.mts +1 -0
  149. package/dist/configure/types/type.d.mts +1 -2
  150. package/dist/{context-Bd266-ru.mjs → context-DYQVYWqZ.mjs} +4 -5
  151. package/dist/{context-Bd266-ru.mjs.map → context-DYQVYWqZ.mjs.map} +1 -1
  152. package/dist/{file-BbdFGdMV.mjs → file-BUcmVIH2.mjs} +12 -14
  153. package/dist/file-BUcmVIH2.mjs.map +1 -0
  154. package/dist/{file-utils-CYZnO1pX.mjs → file-utils-yEiIS4nJ.mjs} +2 -2
  155. package/dist/file-utils-yEiIS4nJ.mjs.map +1 -0
  156. package/dist/{globals-DhwZj0RB.mjs → globals-BjhJJ2dN.mjs} +2 -2
  157. package/dist/globals-BjhJJ2dN.mjs.map +1 -0
  158. package/dist/iconv-QWaZh0TT.mjs +38 -0
  159. package/dist/iconv-QWaZh0TT.mjs.map +1 -0
  160. package/dist/{idp-Bx25ZBdN.mjs → idp-RA_swu-h.mjs} +4 -5
  161. package/dist/idp-RA_swu-h.mjs.map +1 -0
  162. package/dist/kysely/index.d.mts +3 -4
  163. package/dist/{kysely-type-5eAChaHO.mjs → kysely-type-DqIRgDYR.mjs} +4 -5
  164. package/dist/kysely-type-DqIRgDYR.mjs.map +1 -0
  165. package/dist/parser/service/auth/index.d.mts +1 -1
  166. package/dist/parser/service/auth/schema.d.mts +2 -0
  167. package/dist/parser/service/http-adapter/index.d.mts +1 -1
  168. package/dist/parser/service/idp/types.d.mts +1 -0
  169. package/dist/parser/service/tailordb/types.d.mts +6 -1
  170. package/dist/plugin/builtin/enum-constants/index.d.mts +0 -1
  171. package/dist/plugin/builtin/file-utils/index.d.mts +0 -1
  172. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  173. package/dist/plugin/builtin/kysely-type/index.d.mts +0 -1
  174. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  175. package/dist/plugin/builtin/seed/index.d.mts +0 -1
  176. package/dist/plugin/get-generated-type.d.mts +0 -1
  177. package/dist/plugin/manager.d.mts +2 -1
  178. package/dist/plugin/types.d.mts +0 -1
  179. package/dist/plugin/with-context.d.mts +0 -1
  180. package/dist/{register-ts-hook-ZpBacA07.mjs → register-ts-hook-BhzVkej0.mjs} +799 -446
  181. package/dist/register-ts-hook-BhzVkej0.mjs.map +1 -0
  182. package/dist/{registry-DH4m7eYo.mjs → registry-BSbq6SPo.mjs} +4 -3
  183. package/dist/registry-BSbq6SPo.mjs.map +1 -0
  184. package/dist/resource_pb-BRv7AMXK.mjs +49 -0
  185. package/dist/resource_pb-BRv7AMXK.mjs.map +1 -0
  186. package/dist/runtime/aigateway.d.mts +5 -15
  187. package/dist/runtime/aigateway.mjs +2 -2
  188. package/dist/runtime/authconnection.d.mts +5 -15
  189. package/dist/runtime/authconnection.mjs +2 -2
  190. package/dist/runtime/context.d.mts +14 -6
  191. package/dist/runtime/context.mjs +2 -2
  192. package/dist/runtime/file.d.mts +14 -54
  193. package/dist/runtime/file.mjs +2 -2
  194. package/dist/runtime/globals.d.mts +1 -2
  195. package/dist/runtime/iconv.d.mts +5 -53
  196. package/dist/runtime/iconv.mjs +2 -2
  197. package/dist/runtime/idp.d.mts +13 -70
  198. package/dist/runtime/idp.mjs +2 -2
  199. package/dist/runtime/index.d.mts +11 -12
  200. package/dist/runtime/index.mjs +9 -9
  201. package/dist/runtime/secretmanager.d.mts +7 -20
  202. package/dist/runtime/secretmanager.mjs +2 -2
  203. package/dist/runtime/types.d.mts +9 -4
  204. package/dist/runtime/workflow.d.mts +42 -41
  205. package/dist/runtime/workflow.mjs +2 -2
  206. package/dist/{schema-89dYxNC2.mjs → schema-iCd1ugGp.mjs} +257 -54
  207. package/dist/schema-iCd1ugGp.mjs.map +1 -0
  208. package/dist/secretmanager-CYlpffsz.mjs +13 -0
  209. package/dist/secretmanager-CYlpffsz.mjs.map +1 -0
  210. package/dist/seed/index.d.mts +3 -2
  211. package/dist/service-BT0GPd01.mjs +3 -0
  212. package/dist/{service-ufH7sS8o.mjs → service-CzZEVrp9.mjs} +14 -9
  213. package/dist/service-CzZEVrp9.mjs.map +1 -0
  214. package/dist/{service_pb-CIrhGwHk.mjs → service_pb-Bk7dL-yT.mjs} +27 -50
  215. package/dist/service_pb-Bk7dL-yT.mjs.map +1 -0
  216. package/dist/{service_pb-DjwIn4jO.mjs → service_pb-DZkfjB_6.mjs} +1 -1
  217. package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +0 -1
  218. package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +0 -1
  219. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +0 -1
  220. package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +0 -1
  221. package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +0 -1
  222. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +0 -1
  223. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +0 -1
  224. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +0 -1
  225. package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +0 -1
  226. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +0 -1
  227. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +0 -1
  228. package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +0 -1
  229. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +0 -1
  230. package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +0 -1
  231. package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +0 -1
  232. package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +0 -1
  233. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +0 -1
  234. package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +0 -1
  235. package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +0 -1
  236. package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +0 -1
  237. package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +0 -1
  238. package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +0 -1
  239. package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +0 -1
  240. package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +0 -1
  241. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +1 -2
  242. package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +0 -1
  243. package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +0 -1
  244. package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +0 -1
  245. package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +0 -1
  246. package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +0 -1
  247. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +0 -1
  248. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +0 -1
  249. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +0 -1
  250. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +29 -10
  251. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +35 -2
  252. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +0 -1
  253. package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +0 -1
  254. package/dist/types/aigateway.generated.d.mts +5 -2
  255. package/dist/types/auth-connection.generated.d.mts +24 -11
  256. package/dist/types/auth.generated.d.mts +115 -84
  257. package/dist/types/executor.generated.d.mts +76 -84
  258. package/dist/types/helpers.d.mts +7 -6
  259. package/dist/types/http-adapter.generated.d.mts +11 -5
  260. package/dist/types/idp.generated.d.mts +536 -524
  261. package/dist/types/resolver.generated.d.mts +26 -11
  262. package/dist/types/staticwebsite.generated.d.mts +7 -3
  263. package/dist/types/tailordb.generated.d.mts +57 -29
  264. package/dist/types/workflow.generated.d.mts +9 -4
  265. package/dist/utils/test/index.d.mts +1 -2
  266. package/dist/utils/test/index.mjs +36 -10
  267. package/dist/utils/test/index.mjs.map +1 -1
  268. package/dist/utils/test/mock.d.mts +0 -1
  269. package/dist/vitest/environment.mjs +1 -1
  270. package/dist/vitest/index.d.mts +1 -1
  271. package/dist/vitest/index.mjs +11 -11
  272. package/dist/vitest/index.mjs.map +1 -1
  273. package/dist/vitest/mock-kysely.d.mts +0 -1
  274. package/dist/vitest/mocks/aigateway.d.mts +2 -2
  275. package/dist/vitest/mocks/authconnection.d.mts +2 -2
  276. package/dist/vitest/mocks/idp.d.mts +2 -2
  277. package/dist/vitest/mocks/secretmanager.d.mts +3 -1
  278. package/dist/vitest/mocks/tailordb.d.mts +6 -3
  279. package/dist/vitest/mocks/workflow.d.mts +15 -8
  280. package/dist/vitest/setup.mjs +1 -1
  281. package/dist/vitest/workflow-local.d.mts +1 -0
  282. package/dist/workflow-GNuSnsTx.mjs +22 -0
  283. package/dist/workflow-GNuSnsTx.mjs.map +1 -0
  284. package/docs/cli/auth.md +3 -3
  285. package/docs/cli/setup.md +9 -9
  286. package/docs/cli-reference.md +7 -6
  287. package/docs/configuration.md +24 -0
  288. package/docs/migration/v2.md +317 -0
  289. package/docs/plugin/custom.md +4 -4
  290. package/docs/plugin/index.md +2 -2
  291. package/docs/runtime.md +4 -2
  292. package/docs/services/aigateway.md +2 -0
  293. package/docs/services/auth.md +2 -2
  294. package/docs/services/resolver.md +1 -1
  295. package/docs/services/tailordb-migration.md +1 -1
  296. package/docs/services/tailordb.md +125 -93
  297. package/docs/services/workflow.md +78 -0
  298. package/package.json +22 -22
  299. package/dist/aigateway-B3oZZE6v.mjs +0 -15
  300. package/dist/application-D2hSK1ZL.mjs +0 -3
  301. package/dist/application-eHp9jXld.mjs.map +0 -1
  302. package/dist/authconnection-BGQM8FZI.mjs +0 -15
  303. package/dist/authconnection-BGQM8FZI.mjs.map +0 -1
  304. package/dist/cli/shared/trigger-context.d.mts +0 -1
  305. package/dist/field-runtime-CAnh_oow.mjs +0 -183
  306. package/dist/field-runtime-CAnh_oow.mjs.map +0 -1
  307. package/dist/file-BbdFGdMV.mjs.map +0 -1
  308. package/dist/file-utils-CYZnO1pX.mjs.map +0 -1
  309. package/dist/globals-DhwZj0RB.mjs.map +0 -1
  310. package/dist/iconv-D2vi8G36.mjs +0 -63
  311. package/dist/iconv-D2vi8G36.mjs.map +0 -1
  312. package/dist/idp-Bx25ZBdN.mjs.map +0 -1
  313. package/dist/kysely-type-5eAChaHO.mjs.map +0 -1
  314. package/dist/register-ts-hook-ZpBacA07.mjs.map +0 -1
  315. package/dist/registry-DH4m7eYo.mjs.map +0 -1
  316. package/dist/rolldown-runtime-DXywRVcq.mjs +0 -20
  317. package/dist/schema-89dYxNC2.mjs.map +0 -1
  318. package/dist/secretmanager-BVxw3ih_.mjs +0 -24
  319. package/dist/secretmanager-BVxw3ih_.mjs.map +0 -1
  320. package/dist/service-CkIwEctX.mjs +0 -3
  321. package/dist/service-ufH7sS8o.mjs.map +0 -1
  322. package/dist/service_pb-CIrhGwHk.mjs.map +0 -1
  323. package/dist/types-C-lQ4se3.mjs +0 -4
  324. package/dist/types-CXF2OYdR.mjs +0 -199
  325. package/dist/types-CXF2OYdR.mjs.map +0 -1
  326. package/dist/workflow-Bo59B75H.mjs +0 -50
  327. package/dist/workflow-Bo59B75H.mjs.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import { TailorEnv } from "../runtime/types.mjs";
2
2
  import { WorkflowJob } from "../configure/services/workflow/job.mjs";
3
3
  import { Workflow } from "../configure/services/workflow/workflow.mjs";
4
+ import "../configure/services/workflow/index.mjs";
4
5
  //#region src/vitest/workflow-local.d.ts
5
6
  type AnyWorkflowJob = WorkflowJob<string, any, any>;
6
7
  type AnyWorkflow = Workflow<AnyWorkflowJob>;
@@ -0,0 +1,22 @@
1
+ //#region src/runtime/workflow.ts
2
+ const api = () => globalThis.tailor.workflow;
3
+ function triggerWorkflow(workflowName, args, options) {
4
+ if (options?.invoker === void 0) return api().triggerWorkflow(workflowName, args);
5
+ return api().triggerWorkflow(workflowName, args, { authInvoker: options.invoker });
6
+ }
7
+ const resumeWorkflow = (...args) => api().resumeWorkflow(...args);
8
+ const triggerJobFunction = (...args) => api().triggerJobFunction(...args);
9
+ const wait = (...args) => api().wait(...args);
10
+ const resolve = (...args) => api().resolve(...args);
11
+ /** Runtime wrapper namespace for `tailor.workflow`. */
12
+ const workflow = {
13
+ triggerWorkflow,
14
+ resumeWorkflow,
15
+ triggerJobFunction,
16
+ wait,
17
+ resolve
18
+ };
19
+
20
+ //#endregion
21
+ export { workflow as t };
22
+ //# sourceMappingURL=workflow-GNuSnsTx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-GNuSnsTx.mjs","names":[],"sources":["../src/runtime/workflow.ts"],"sourcesContent":["/**\n * Workflow utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.workflow` runtime API.\n * At runtime this delegates to `globalThis.tailor.workflow`. Use `mockWorkflow`\n * from `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n * @example\n * import { workflow } from \"@tailor-platform/sdk/runtime\";\n *\n * const executionId = await workflow.triggerWorkflow(\"myWorkflow\", { data: \"value\" });\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Specifies the machine user that should be used to execute the workflow.\n * This allows workflows to run with specific authentication context.\n */\nexport interface Invoker {\n /** The namespace where the machine user is defined */\n namespace: string;\n /** The name of the machine user to use for workflow execution */\n machineUserName: string;\n}\n\n/** Options for {@link triggerWorkflow}. */\nexport interface TriggerWorkflowOptions {\n /** Optional invoker to specify which machine user should execute the workflow */\n invoker?: Invoker;\n}\n\nexport interface PlatformTriggerWorkflowOptions {\n authInvoker?: Invoker;\n}\n\ndeclare const executionPolicyKeyBrand: unique symbol;\n\n/**\n * A concrete runtime key produced by an execution policy instance — either an\n * exact-match policy's `.key`, or a wildcard policy's `.keyFor(suffix)` (see\n * `defineWorkflowExecutionPolicies`). Branded so an arbitrary string that\n * wasn't derived from a declared policy can't be passed as `executionPolicyKey`.\n */\nexport type ExecutionPolicyKey = string & { readonly [executionPolicyKeyBrand]: never };\n\n/** Options for {@link triggerJobFunction}. */\nexport interface TriggerJobFunctionOptions {\n /**\n * Execution policy key matched by the platform against the policies\n * declared with `defineWorkflowExecutionPolicies` in `tailor.config.ts`.\n */\n executionPolicyKey?: ExecutionPolicyKey;\n}\n\n/**\n * Platform API surface for `tailor.workflow`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.workflow`.\n */\nexport interface PlatformWorkflowAPI {\n /**\n * Triggers a workflow and returns its execution ID.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional platform trigger options\n * @returns The execution ID of the triggered workflow\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: PlatformTriggerWorkflowOptions,\n ): Promise<string>;\n\n /**\n * Resumes a failed or pending-retry workflow execution and returns its execution ID.\n * @param executionId - The execution to resume\n * @returns The execution ID of the resumed workflow\n */\n resumeWorkflow(executionId: string): Promise<string>;\n\n /**\n * Triggers a job function and returns its result.\n * @param jobName - Job name as defined in the workflow\n * @param args - Arguments forwarded to the job\n * @param options - Optional trigger options (e.g. `executionPolicyKey`)\n * @returns The job's return value\n */\n triggerJobFunction(jobName: string, args?: any, options?: TriggerJobFunctionOptions): any;\n\n /**\n * Suspends the current workflow execution and waits for an external signal to resume.\n * @param key - Wait point key\n * @param payload - Optional payload to record with the wait point\n * @returns The payload supplied by the corresponding `resolve` call\n */\n wait(key: string, payload?: any): any;\n\n /**\n * Resolves a waiting workflow execution, causing it to resume.\n * @param executionId - The execution to resume\n * @param key - Wait point key to resolve\n * @param callback - Callback receiving the wait payload; its return value is forwarded to `wait`\n * @returns A promise that resolves once the resolve has been recorded\n */\n resolve(executionId: string, key: string, callback: (waitPayload: any) => any): Promise<void>;\n}\n\n/** Runtime wrapper API for workflow and job control. */\nexport interface TailorWorkflowAPI extends Omit<PlatformWorkflowAPI, \"triggerWorkflow\"> {\n /**\n * Triggers a workflow and returns its execution ID.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional SDK trigger options\n * @returns The execution ID of the triggered workflow\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n ): Promise<string>;\n}\n\nconst api = (): PlatformWorkflowAPI =>\n (globalThis as unknown as { tailor: { workflow: PlatformWorkflowAPI } }).tailor.workflow;\n\nfunction triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n): Promise<string> {\n if (options?.invoker === undefined) {\n return api().triggerWorkflow(workflowName, args);\n }\n return api().triggerWorkflow(workflowName, args, { authInvoker: options.invoker });\n}\n\nconst resumeWorkflow: PlatformWorkflowAPI[\"resumeWorkflow\"] = (...args) =>\n api().resumeWorkflow(...args);\n\nconst triggerJobFunction: PlatformWorkflowAPI[\"triggerJobFunction\"] = (...args) =>\n api().triggerJobFunction(...args);\n\nconst wait: PlatformWorkflowAPI[\"wait\"] = (...args) => api().wait(...args);\n\nconst resolve: PlatformWorkflowAPI[\"resolve\"] = (...args) => api().resolve(...args);\n\n/** Runtime wrapper namespace for `tailor.workflow`. */\nexport const workflow = {\n triggerWorkflow,\n resumeWorkflow,\n triggerJobFunction,\n wait,\n resolve,\n} as const satisfies TailorWorkflowAPI;\n"],"mappings":";AA0HA,MAAM,YACH,WAAwE,OAAO;AAElF,SAAS,gBACP,cACA,MACA,SACiB;CACjB,IAAI,SAAS,YAAY,QACvB,OAAO,IAAI,CAAC,CAAC,gBAAgB,cAAc,IAAI;CAEjD,OAAO,IAAI,CAAC,CAAC,gBAAgB,cAAc,MAAM,EAAE,aAAa,QAAQ,QAAQ,CAAC;AACnF;AAEA,MAAM,kBAAyD,GAAG,SAChE,IAAI,CAAC,CAAC,eAAe,GAAG,IAAI;AAE9B,MAAM,sBAAiE,GAAG,SACxE,IAAI,CAAC,CAAC,mBAAmB,GAAG,IAAI;AAElC,MAAM,QAAqC,GAAG,SAAS,IAAI,CAAC,CAAC,KAAK,GAAG,IAAI;AAEzE,MAAM,WAA2C,GAAG,SAAS,IAAI,CAAC,CAAC,QAAQ,GAAG,IAAI;;AAGlF,MAAa,WAAW;CACtB;CACA;CACA;CACA;CACA;AACF"}
package/docs/cli/auth.md CHANGED
@@ -186,9 +186,9 @@ tailor machineuser token [options] [name]
186
186
 
187
187
  **Arguments**
188
188
 
189
- | Argument | Description | Required |
190
- | -------- | --------------------------------------------------------------------------- | -------- |
191
- | `name` | Machine user name. Falls back to the active profile's default machine user. | No |
189
+ | Argument | Description | Required |
190
+ | -------- | ------------------------------------------------------------------------------------------------------------------- | -------- |
191
+ | `name` | Machine user name. Falls back to TAILOR_PLATFORM_MACHINE_USER_NAME, then the active profile's default machine user. | No |
192
192
 
193
193
  **Options**
194
194
 
package/docs/cli/setup.md CHANGED
@@ -100,14 +100,14 @@ tailor setup coordinate [options]
100
100
 
101
101
  **Options**
102
102
 
103
- | Option | Alias | Description | Required | Default |
104
- | ----------------------------- | ----- | --------------------------------------------------------------------------------------- | -------- | ------- |
105
- | `--name <NAME>` | `-n` | Coordinator name (used in the generated workflow file name and job names) | Yes | - |
106
- | `--action <ACTION>` | - | Composite action to include (can be specified multiple times). tailor- prefix optional. | Yes | - |
107
- | `--branch <BRANCH>` | - | Branch target: deploy trigger branch (defaults to the detected default branch) | No | - |
108
- | `--tag` | - | Generate a tag target coordinator | No | `false` |
109
- | `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs | No | - |
110
- | `--force` | - | Discard hand edits and regenerate | No | `false` |
103
+ | Option | Alias | Description | Required | Default |
104
+ | ----------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
105
+ | `--name <NAME>` | `-n` | Coordinator name (used in the generated workflow file name and job names) | Yes | - |
106
+ | `--action <ACTION>` | - | Composite action to include. Repeat for separate deploy steps, or use commas to deploy actions as one multi-config group. tailor- prefix optional. | Yes | - |
107
+ | `--branch <BRANCH>` | - | Branch target: deploy trigger branch (defaults to the detected default branch) | No | - |
108
+ | `--tag` | - | Generate a tag target coordinator | No | `false` |
109
+ | `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs | No | - |
110
+ | `--force` | - | Discard hand edits and regenerate | No | `false` |
111
111
 
112
112
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
113
113
 
@@ -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 | `"."` |
@@ -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
 
@@ -286,6 +286,30 @@ export default defineConfig({
286
286
 
287
287
  **ignores**: Glob patterns to exclude files. Optional.
288
288
 
289
+ ### Workflow Execution Policies
290
+
291
+ Register workspace-scoped execution policies that workflow job functions reference at runtime for per-key concurrency control. See [Execution Policies](./services/workflow.md#execution-policies) in the Workflow guide for the declaration API.
292
+
293
+ ```typescript
294
+ import { defineWorkflowExecutionPolicies } from "@tailor-platform/sdk";
295
+
296
+ const executionPolicies = defineWorkflowExecutionPolicies((define) => ({
297
+ premium: define({ concurrencyPolicy: { maxConcurrentExecutions: 5 } }),
298
+ tenantApi: define({
299
+ name: "tenant-api",
300
+ matchType: "prefix",
301
+ concurrencyPolicy: { maxConcurrentExecutions: 3 },
302
+ }),
303
+ }));
304
+
305
+ export default defineConfig({
306
+ workflow: {
307
+ files: ["workflows/**/*.ts"],
308
+ executionPolicies,
309
+ },
310
+ });
311
+ ```
312
+
289
313
  ### Plugins
290
314
 
291
315
  Configure plugins using `definePlugins()`. Plugins must be exported as a named export.
@@ -436,6 +436,74 @@ wrapper or global tailor.authconnection.
436
436
 
437
437
  </details>
438
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
+
439
507
  ## Tailordb → tailordb (lowercase ambient namespace)
440
508
 
441
509
  **Migration:** Partially automatic
@@ -471,6 +539,97 @@ declarations automatically on SDK import.
471
539
 
472
540
  </details>
473
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
+
474
633
  ## executeScript arg JSON.stringify → value
475
634
 
476
635
  **Migration:** Partially automatic
@@ -714,6 +873,164 @@ After:
714
873
  .tailor/
715
874
  ```
716
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
+
717
1034
  ## Behavioral changes (no migration required)
718
1035
 
719
1036
  These v2 changes alter runtime or CLI behavior; no source change is needed.
@@ -93,7 +93,7 @@ interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
93
93
  onTypeLoaded(context) {
94
94
  const { type, typeConfig, namespace } = context;
95
95
  return {
96
- types: { archive: db.type(`Deleted_${type.name}`, { ... }) },
96
+ types: { archive: db.table(`Deleted_${type.name}`, { ... }) },
97
97
  extends: { fields: { deletedAt: db.datetime({ optional: true }) } },
98
98
  executors: [{ name: `${type.name}-on-delete`, resolve: async () => await import("./on-delete"), context: { sourceType: type, namespace } }],
99
99
  };
@@ -122,7 +122,7 @@ Same as `TypePluginOutput` but without `extends` (namespace plugins cannot exten
122
122
  ```typescript
123
123
  onNamespaceLoaded(context) {
124
124
  return {
125
- types: { auditLog: db.type("AuditLog", { action: db.string(), ... }) },
125
+ types: { auditLog: db.table("AuditLog", { action: db.string(), ... }) },
126
126
  };
127
127
  },
128
128
  ```
@@ -343,7 +343,7 @@ function processSoftDelete(
343
343
 
344
344
  // Generate archive type
345
345
  const archiveType = db
346
- .type(`${prefix}${type.name}`, {
346
+ .table(`${prefix}${type.name}`, {
347
347
  originalId: db.uuid().description("ID of the deleted record"),
348
348
  originalData: db.string().description("JSON snapshot of deleted record"),
349
349
  deletedAt: db.datetime().description("When the record was deleted"),
@@ -450,7 +450,7 @@ export const plugins = definePlugins(
450
450
 
451
451
  // tailordb/customer.ts
452
452
  export const customer = db
453
- .type("Customer", {
453
+ .table("Customer", {
454
454
  name: db.string(),
455
455
  email: db.string(),
456
456
  })
@@ -43,7 +43,7 @@ Use the `.plugin()` method to attach plugins to specific types:
43
43
  import { db } from "@tailor-platform/sdk";
44
44
 
45
45
  export const user = db
46
- .type("User", {
46
+ .table("User", {
47
47
  name: db.string(),
48
48
  email: db.string(),
49
49
  })
@@ -58,7 +58,7 @@ Some plugins accept per-type configuration:
58
58
 
59
59
  ```typescript
60
60
  export const customer = db
61
- .type("Customer", {
61
+ .table("Customer", {
62
62
  name: db.string(),
63
63
  // ...
64
64
  })
package/docs/runtime.md CHANGED
@@ -45,10 +45,12 @@ const { url } = await aigateway.get("my-aigateway");
45
45
  Each namespace can also be imported individually so you only pull what you need:
46
46
 
47
47
  ```ts
48
- import * as iconv from "@tailor-platform/sdk/runtime/iconv";
49
- import type { ListUsersResponse, ClientConfig } from "@tailor-platform/sdk/runtime/idp";
48
+ import { iconv } from "@tailor-platform/sdk/runtime/iconv";
49
+ import { idp, type ListUsersResponse, type ClientConfig } from "@tailor-platform/sdk/runtime/idp";
50
50
  ```
51
51
 
52
+ `TailorContextAPI` and `TailorWorkflowAPI` describe the imported SDK wrapper objects. When typing direct access to the platform-provided globals or a runtime mock, use `PlatformContextAPI` or `PlatformWorkflowAPI` instead.
53
+
52
54
  ## Activating the global types
53
55
 
54
56
  Most users do not need to touch the globals entry — `@tailor-platform/sdk/runtime` (and its subpath modules) cover the same surface without depending on any ambient declaration.
@@ -111,3 +111,5 @@ const { url } = await aigateway.get("my-aigateway");
111
111
  ```
112
112
 
113
113
  Type narrowing is provided by the generated `tailor.d.ts` (the `AIGatewayNameRegistry` interface). Run `tailor generate` (or `deploy`) after defining new AI Gateways to refresh it. Before the first generate run, `get()` accepts any string.
114
+
115
+ The same URL is also shown by `tailor show`, which lists the URL of each AI Gateway defined in `aiGateways` once it has been deployed.
@@ -86,7 +86,7 @@ Example TailorDB type for user profile:
86
86
  // tailordb/user.ts
87
87
  import { db } from "@tailor-platform/sdk";
88
88
 
89
- export const user = db.type("User", {
89
+ export const user = db.table("User", {
90
90
  email: db.string().unique(), // usernameField must have unique constraint
91
91
  role: db.enum(["admin", "user"]),
92
92
  ...db.fields.timestamps(),
@@ -130,7 +130,7 @@ Example TailorDB type with UUID fields for attribute list:
130
130
  // tailordb/user.ts
131
131
  import { db } from "@tailor-platform/sdk";
132
132
 
133
- export const user = db.type("User", {
133
+ export const user = db.table("User", {
134
134
  email: db.string().unique(),
135
135
  role: db.enum(["admin", "user"]),
136
136
  organizationId: db.uuid(), // Can be used in attributeList
@@ -108,7 +108,7 @@ Define input/output schemas using methods of `t` object. Basic usage and support
108
108
  You can reuse fields defined with `db` object, but note that unsupported options will be ignored:
109
109
 
110
110
  ```typescript
111
- const user = db.type("User", {
111
+ const user = db.table("User", {
112
112
  name: db.string().unique(),
113
113
  age: db.int(),
114
114
  });
@@ -69,7 +69,7 @@ A typical change cycle:
69
69
 
70
70
  ```typescript
71
71
  // tailordb/user.ts
72
- export const user = db.type("User", {
72
+ export const user = db.table("User", {
73
73
  name: db.string(),
74
74
  email: db.string(), // ← new required field
75
75
  ...db.fields.timestamps(),