@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
package/docs/runtime.md CHANGED
@@ -31,7 +31,7 @@ const token = await authconnection.getConnectionToken("google");
31
31
  const client = new idp.Client({ namespace: "my-namespace" });
32
32
  const { users } = await client.users({ first: 10 });
33
33
 
34
- const executionId = await workflow.triggerWorkflow("approval", { reportId });
34
+ const executionId = await workflow.startWorkflow("approval", { reportId });
35
35
 
36
36
  const invoker = context.getInvoker();
37
37
 
@@ -81,7 +81,7 @@ The runtime entry re-exports the following namespaces. Detailed signatures, para
81
81
  - `secretmanager` — secret-vault access (`getSecret`, `getSecrets`)
82
82
  - `authconnection` — OAuth-style connection tokens (`getConnectionToken`)
83
83
  - `idp` — IdP user management (`new Client({ namespace })`)
84
- - `workflow` — workflow & job control (`triggerWorkflow`, `resumeWorkflow`, `triggerJobFunction`, `wait`, `resolve`)
84
+ - `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `startJobFunction`, `wait`, `resolve`; the pre-alignment names `triggerWorkflow`, `resumeWorkflow`, `triggerJobFunction` are kept as frozen aliases)
85
85
  - `context` — execution context (`getInvoker`)
86
86
  - `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `downloadStream`, `uploadStream`)
87
87
  - `aigateway` — AI Gateway URL resolution (`get`)
@@ -97,17 +97,16 @@ import { expect, test } from "vitest";
97
97
 
98
98
  test("encodes via iconv", () => {
99
99
  using iconvM = mockIconv();
100
- iconvM.setResolver(() => new Uint8Array([0x82, 0xa0]));
100
+ iconvM.convert.mockReturnValue(new Uint8Array([0x82, 0xa0]));
101
101
 
102
102
  const out = iconv.convert("あ", "UTF-8", "Shift_JIS");
103
103
 
104
104
  expect(out).toEqual(new Uint8Array([0x82, 0xa0]));
105
- expect(iconvM.calls[0]?.method).toBe("convert");
105
+ expect(iconvM.convert).toHaveBeenCalledWith("", "UTF-8", "Shift_JIS");
106
106
  }); // iconvM disposed here — the iconv mock is removed (previous state restored)
107
107
 
108
108
  test("reads from a vault", async () => {
109
- using sm = mockSecretmanager();
110
- sm.setSecrets({ "my-vault": { API_KEY: "sk-123" } });
109
+ using sm = mockSecretmanager({ secrets: { "my-vault": { API_KEY: "sk-123" } } });
111
110
 
112
111
  await expect(secretmanager.getSecret("my-vault", "API_KEY")).resolves.toBe("sk-123");
113
112
  });
@@ -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.
@@ -329,6 +329,11 @@ createExecutor({
329
329
  });
330
330
  ```
331
331
 
332
+ `args` must match the workflow's main job input. It is required when that input is required
333
+ and can be omitted when the workflow has no input. Static arguments can be JSON-compatible
334
+ primitives, arrays, or plain objects; top-level `null` is not supported. An argument callback
335
+ must return the same input type.
336
+
332
337
  ### Authentication for Operations
333
338
 
334
339
  GraphQL and Workflow operations can specify an `invoker` to execute with machine user credentials. Pass the machine user name as a plain string — it is type-narrowed to the names defined in your auth config:
@@ -220,11 +220,14 @@ const user = db.table("User", {
220
220
  const userProfile = db.table("UserProfile", {
221
221
  userEmail: db.string().relation({
222
222
  type: "1-1",
223
- toward: { type: user, key: "email" },
223
+ toward: { type: user, key: "email", as: "user" },
224
224
  }),
225
225
  });
226
226
  ```
227
227
 
228
+ `userEmail` does not end in `ID`, `Id`, or `id`, so this example specifies the forward relation
229
+ name with `toward.as`.
230
+
228
231
  Customize relation names using `toward.as` / `backward` options:
229
232
 
230
233
  ```typescript
@@ -255,52 +258,72 @@ type User {
255
258
  - `backward` - Customizes the field name for accessing this type from the related type
256
259
 
257
260
  Relation names share the same GraphQL field namespace as fields, files, and other relations on
258
- the type. The SDK rejects duplicate or empty relation names. Use `toward.as` when multiple fields
259
- on the same type point to the same target type, because their default forward names are derived
260
- from the target type name:
261
+ the table. The SDK rejects duplicate or empty relation names. When `toward.as` is omitted, the
262
+ default forward name comes from the relation field name with a trailing `ID`, `Id`, or `id`
263
+ removed. This lets multiple fields point to the same target table with distinct forward names:
261
264
 
262
265
  ```typescript
263
266
  const post = db.table("Post", {
264
267
  authorID: db.uuid().relation({
265
268
  type: "n-1",
266
- toward: { type: user, as: "author" },
269
+ toward: { type: user },
267
270
  backward: "authoredPosts",
268
271
  }),
269
272
  reviewerID: db.uuid().relation({
270
273
  type: "n-1",
271
- toward: { type: user, as: "reviewer" },
274
+ toward: { type: user },
272
275
  backward: "reviewedPosts",
273
276
  }),
274
277
  });
275
278
  ```
276
279
 
280
+ These fields generate the forward names `author` and `reviewer`. A relation field without one of
281
+ the recognized ID suffixes needs an explicit `toward.as`, because its generated forward name
282
+ would conflict with the field itself.
283
+
277
284
  Use `toward.as` or `backward` when a generated relation name would conflict with an existing
278
- field, files entry, or relation on the same type.
285
+ field, files entry, or relation on the same table.
279
286
 
280
287
  ### Hooks
281
288
 
282
- Add hooks to execute functions during data creation or update. Hooks receive three arguments:
289
+ Add hooks to execute functions during data creation or update.
290
+
291
+ #### Field-level Hooks
292
+
293
+ Set hooks directly on individual fields.
294
+
295
+ Create hooks receive:
283
296
 
284
- - `value`: User input if provided, otherwise existing value on update or null on create
285
- - `data`: Entire record data (for accessing other field values)
297
+ - `input`: The field value from the input (null when not provided)
286
298
  - `invoker`: Principal performing the operation
299
+ - `now`: Operation timestamp (`Date`), shared across all hooks in the same operation
287
300
 
288
- #### Field-level Hooks
301
+ Update hooks receive the same arguments plus:
289
302
 
290
- Set hooks directly on individual fields:
303
+ - `oldValue`: The previous field value (null only for optional fields)
291
304
 
292
305
  ```typescript
293
306
  db.string().hooks({
294
307
  create: ({ invoker }) => invoker?.id ?? "",
295
- update: ({ value }) => value,
308
+ update: ({ input, oldValue }) => input ?? oldValue,
296
309
  });
297
310
  ```
298
311
 
299
- **Note:** When setting hooks at the field level, the `data` argument type is `unknown` since the field doesn't know about other fields in the type. Use type-level hooks if you need to access other fields with type safety.
312
+ Field-level hooks operate on a single field and cannot access other fields. Use type-level hooks for cross-field logic.
300
313
 
301
314
  #### Type-level Hooks
302
315
 
303
- Set hooks for multiple fields at once using `db.table().hooks()`:
316
+ Set hooks across multiple fields using `db.table().hooks()`. The hook returns an object with the fields to override. When both field-level and type-level hooks exist for the same field, type-level hooks take priority.
317
+
318
+ Create hooks receive:
319
+
320
+ - `input`: The submitted record data. When field-level hooks or defaults exist, `input` reflects their applied results
321
+ - `invoker`: Principal performing the operation
322
+ - `now`: Operation timestamp (`Date`), shared across all hooks in the same operation
323
+
324
+ Update hooks receive the same arguments plus:
325
+
326
+ - `oldRecord`: The existing record (non-null)
304
327
 
305
328
  ```typescript
306
329
  export const customer = db
@@ -310,60 +333,56 @@ export const customer = db
310
333
  fullName: db.string(),
311
334
  })
312
335
  .hooks({
313
- fullName: {
314
- create: ({ data }) => `${data.firstName} ${data.lastName}`,
315
- update: ({ data }) => `${data.firstName} ${data.lastName}`,
316
- },
336
+ create: ({ input }) => ({
337
+ fullName: `${input.firstName} ${input.lastName}`,
338
+ }),
339
+ update: ({ input, oldRecord }) => ({
340
+ fullName: `${input.firstName ?? oldRecord.firstName} ${input.lastName ?? oldRecord.lastName}`,
341
+ }),
317
342
  });
318
343
  ```
319
344
 
320
- **Important:** Field-level and type-level hooks cannot coexist on the same field. TypeScript will prevent this at compile time:
345
+ Use `now` to stamp several fields with the exact same instant:
321
346
 
322
347
  ```typescript
323
- // Compile error - cannot set hooks on the same field twice
324
- export const user = db
325
- .table("User", {
326
- name: db.string().hooks({ create: ({ data }) => data.firstName }), // Field-level
348
+ export const order = db
349
+ .table("Order", {
350
+ createdAt: db.datetime(),
351
+ updatedAt: db.datetime(),
327
352
  })
328
353
  .hooks({
329
- name: { create: ({ data }) => data.lastName }, // Type-level - ERROR
330
- });
331
-
332
- // OK - set hooks on different fields
333
- export const user = db
334
- .table("User", {
335
- firstName: db.string().hooks({ create: () => "John" }), // Field-level on firstName
336
- lastName: db.string(),
337
- })
338
- .hooks({
339
- lastName: { create: () => "Doe" }, // Type-level on lastName
354
+ create: ({ now }) => ({ createdAt: now, updatedAt: now }),
355
+ update: ({ now }) => ({ updatedAt: now }),
340
356
  });
341
357
  ```
342
358
 
359
+ **Note:** `.hooks()` can only be called once on a type. Duplicate type-level calls fail at compile time and throw at runtime.
360
+
343
361
  ### Validation
344
362
 
345
- Add validation rules to fields. Validators receive three arguments (executed after hooks):
363
+ Add validation rules to fields. Validators run after hooks.
346
364
 
347
- - `value`: Field value after hook transformation
348
- - `data`: Entire record data after hook transformations (for accessing other field values)
349
- - `invoker`: Principal performing the operation
365
+ **Note:** Custom validators run only when built-in type validation succeeds, so `value` always has the field's declared type. For array fields, the validator is called once with the complete array, not per element:
350
366
 
351
- Validators return `true` for success, `false` for failure. Use array form `[validator, errorMessage]` for custom error messages.
367
+ ```typescript
368
+ // value is string[], not string
369
+ db.string({ array: true }).validate(({ value }) => value.length >= 2);
370
+ ```
352
371
 
353
372
  #### Field-level Validation
354
373
 
355
- Set validators directly on individual fields:
374
+ Set validators directly on individual fields. Each validator receives `{ value }` (the field value after hooks) and returns an error message string to fail, or void to pass:
356
375
 
357
376
  ```typescript
358
377
  db.string().validate(
359
- ({ value }) => value.includes("@"),
360
- [({ value }) => value.length >= 5, "Email must be at least 5 characters"],
378
+ ({ value }) => (value.includes("@") ? undefined : "Must contain @"),
379
+ ({ value }) => (value.length >= 5 ? undefined : "Must be at least 5 characters"),
361
380
  );
362
381
  ```
363
382
 
364
383
  #### Type-level Validation
365
384
 
366
- Set validators for multiple fields at once using `db.table().validate()`:
385
+ Set a validator across all fields using `db.table().validate()`. The validator receives `{ newRecord, oldRecord, invoker }` and an `issues()` callback to report errors per field:
367
386
 
368
387
  ```typescript
369
388
  export const user = db
@@ -371,38 +390,33 @@ export const user = db
371
390
  name: db.string(),
372
391
  email: db.string(),
373
392
  })
374
- .validate({
375
- name: [({ value }) => value.length > 5, "Name must be longer than 5 characters"],
376
- email: [
377
- ({ value }) => value.includes("@"),
378
- [({ value }) => value.length >= 5, "Email must be at least 5 characters"],
379
- ],
393
+ .validate(({ newRecord }, issues) => {
394
+ if (newRecord.name.length <= 5) {
395
+ issues("name", "Name must be longer than 5 characters");
396
+ }
397
+ if (!newRecord.email.includes("@")) {
398
+ issues("email", "Must contain @");
399
+ }
380
400
  });
381
401
  ```
382
402
 
383
- **Important:** Field-level and type-level validation cannot coexist on the same field. TypeScript will prevent this at compile time:
403
+ ### Defaults
404
+
405
+ Set a default value for a required field on create. The field becomes optional in the create input — the default fills in when no value is provided:
384
406
 
385
407
  ```typescript
386
- // Compile error - cannot set validation on the same field twice
387
- export const user = db
388
- .table("User", {
389
- name: db.string().validate(({ value }) => value.length > 0), // Field-level
390
- })
391
- .validate({
392
- name: [({ value }) => value.length < 100, "Too long"], // Type-level - ERROR
393
- });
408
+ db.int().default(0);
409
+ db.string().default("pending");
410
+ ```
394
411
 
395
- // OK - set validation on different fields
396
- export const user = db
397
- .table("User", {
398
- name: db.string().validate(({ value }) => value.length > 0), // Field-level on name
399
- email: db.string(),
400
- })
401
- .validate({
402
- email: [({ value }) => value.includes("@"), "Invalid email"], // Type-level on email
403
- });
412
+ For datetime/date/time fields, pass `"now"` to use the operation timestamp:
413
+
414
+ ```typescript
415
+ db.datetime().default("now");
404
416
  ```
405
417
 
418
+ **Note:** `.validate()` can only be called once on a type. Duplicate type-level calls fail at compile time and throw at runtime.
419
+
406
420
  ### Vector Search
407
421
 
408
422
  ```typescript
@@ -436,6 +450,22 @@ export const user = db.table("User", {
436
450
 
437
451
  ## Type Modifiers
438
452
 
453
+ Type builder methods that set one type-level configuration can be called only once on the same type. Duplicate calls fail at compile time and throw at runtime. This applies to `.description()`, `.hooks()`, `.validate()`, `.features()`, `.indexes()`, `.files()`, `.permission()`, and `.gqlPermission()`.
454
+
455
+ Conditional assignment is still supported when only one branch calls the method:
456
+
457
+ ```typescript
458
+ let user = db.type("User", {
459
+ name: db.string(),
460
+ });
461
+
462
+ if (enableFiles) {
463
+ user = user.files({
464
+ avatar: "profile image",
465
+ });
466
+ }
467
+ ```
468
+
439
469
  ### Composite Indexes
440
470
 
441
471
  ```typescript
@@ -525,6 +555,48 @@ db.table("User", {
525
555
  });
526
556
  ```
527
557
 
558
+ #### GraphQL Operations
559
+
560
+ Control which GraphQL operations (`create`, `update`, `delete`, `read`) are exposed for a type. All operations are enabled by default.
561
+
562
+ ```typescript
563
+ db.type("Order", {
564
+ status: db.string(),
565
+ }).features({
566
+ gqlOperations: {
567
+ delete: false, // Disable the delete mutation
568
+ },
569
+ });
570
+ ```
571
+
572
+ Use the `"query"` alias to disable all mutations at once (read-only type: `create`/`update`/`delete` false, `read` true):
573
+
574
+ ```typescript
575
+ db.type("AuditLog", {
576
+ action: db.string(),
577
+ }).features({
578
+ gqlOperations: "query",
579
+ });
580
+ ```
581
+
582
+ **Namespace-level default**
583
+
584
+ Set a default for every type in a TailorDB namespace in `tailor.config.ts`. A type's own `.features({ gqlOperations })` always takes precedence over this default.
585
+
586
+ ```typescript
587
+ // tailor.config.ts
588
+ export default defineConfig({
589
+ db: {
590
+ tailordb: {
591
+ files: ["./tailordb/*.ts"],
592
+ gqlOperations: { delete: false }, // Default for every type in this namespace
593
+ },
594
+ },
595
+ });
596
+ ```
597
+
598
+ This default is re-evaluated on every `tailor-sdk deploy`, so changing it also updates types that already exist on the platform, not only newly created ones.
599
+
528
600
  ### Field Extraction (`pickFields` / `omitFields`)
529
601
 
530
602
  Extract subsets of fields from a `TailorDBType` for reuse in resolvers, executors, seed schemas, etc.
@@ -552,6 +624,8 @@ Available options:
552
624
  | `optional` | Makes the selected fields optional |
553
625
  | `array` | Makes the selected fields array types |
554
626
 
627
+ **Note:** The `array` option cannot change fields with custom validation — their validators expect the original value shape. Define a new field with a matching validator instead.
628
+
555
629
  #### `omitFields(keys)`
556
630
 
557
631
  Return all fields except the specified ones:
@@ -603,6 +677,8 @@ Configure Permission and GQLPermission. For details, see the [TailorDB Permissio
603
677
 
604
678
  **Important**: Following the secure-by-default principle, all operations are denied if permissions are not configured. You must explicitly grant permissions for each operation (create, read, update, delete).
605
679
 
680
+ `generate`/`deploy` reject a type that has no `.permission()`, or no `.gqlPermission()` while GraphQL operations are enabled for it (see [GraphQL Operations](#graphql-operations) above). Disable GraphQL exposure entirely with `.features({ gqlOperations: { create: false, update: false, delete: false, read: false } })` if a type only needs record-level permission.
681
+
606
682
  ```typescript
607
683
  db.table("User", {
608
684
  name: db.string(),
@@ -397,11 +397,11 @@ export default defineConfig({
397
397
 
398
398
  `key` accepts `[a-z0-9_:.-]` and must start with `[a-z0-9]`. An exact key must also end with `[a-z0-9]`; a wildcard prefix (`matchType: "prefix"`) may end with any of those characters, since the platform appends a trailing `*` after it. The platform-registered key — including that trailing `*` when wildcarded — is 2 to 64 characters long, so a wildcard prefix must be at most 63 characters. `foo:bar` is a valid exact key; `tenant-api` with `matchType: "prefix"` registers `tenant-api*` as a wildcard prefix.
399
399
 
400
- An exact-key policy applies to dispatches whose runtime key equals the policy key. A wildcard policy applies to every dispatch whose runtime key begins with the prefix; each concrete resolved key gets its own independent pool of the declared size (a `cap = 3` wildcard yields three concurrent dispatches per resolved key, not three across every match). The longest matching prefix wins when a dispatch could match more than one wildcard.
400
+ An exact-key policy applies to dispatches whose runtime key equals the policy key. A wildcard policy applies to every dispatch whose runtime key begins with the prefix; each concrete resolved key gets its own independent pool of the declared size (a `cap = 3` wildcard yields three concurrent dispatches per resolved key, not three across every match). When a dispatch matches more than one policy (for example, an exact key that also falls under a wildcard prefix, or two wildcard prefixes where one starts with the other), every matching policy's cap is enforced independently, and the tightest one blocks.
401
401
 
402
402
  ### Referencing a Policy from a Workflow
403
403
 
404
- Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.triggerJobFunction()`. For exact-key policies, use `<policy>.key` directly — it's typed so only a value that came from a declared policy can be passed. For wildcard policies (`matchType: "prefix"`), there is no `<policy>.key` — call `<policy>.keyFor(suffix)` to build the concrete key. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator` — the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group), or a `def` field on a single `defineWorkflowExecutionPolicy`.
404
+ Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.startJobFunction()` (or its frozen alias `triggerJobFunction`). For exact-key policies, use `<policy>.key` directly — it's typed so only a value that came from a declared policy can be passed. For wildcard policies (`matchType: "prefix"`), there is no `<policy>.key` — call `<policy>.keyFor(suffix)` to build the concrete key. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator` — the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group), or a `def` field on a single `defineWorkflowExecutionPolicy`.
405
405
 
406
406
  ```typescript
407
407
  import { createWorkflowJob } from "@tailor-platform/sdk";
@@ -427,7 +427,7 @@ export const mainJob = createWorkflowJob({
427
427
  });
428
428
  ```
429
429
 
430
- The same `executionPolicyKey` option is available on `tailor.workflow.triggerJobFunction(name, args, options)` for jobs invoked by name.
430
+ The same `executionPolicyKey` option is available on `tailor.workflow.startJobFunction(name, args, options)` (or the frozen alias `tailor.workflow.triggerJobFunction`) for jobs invoked by name.
431
431
 
432
432
  ## Triggering a Workflow from a Resolver
433
433