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

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 (441) hide show
  1. package/CHANGELOG.md +511 -10
  2. package/README.md +9 -9
  3. package/agent-skills/{tailor-sdk → tailor}/SKILL.md +3 -1
  4. package/dist/aigateway-DR4Kwuik.mjs +9 -0
  5. package/dist/aigateway-DR4Kwuik.mjs.map +1 -0
  6. package/dist/application-BO4ZF8wP.mjs +3 -0
  7. package/dist/application-BX13RArL.mjs +6669 -0
  8. package/dist/application-BX13RArL.mjs.map +1 -0
  9. package/dist/authconnection-CZvi9ANm.mjs +9 -0
  10. package/dist/authconnection-CZvi9ANm.mjs.map +1 -0
  11. package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
  12. package/dist/cli/cache/bundle-cache.d.mts +1 -0
  13. package/dist/cli/cache/store.d.mts +1 -0
  14. package/dist/cli/cache/types.d.mts +1 -0
  15. package/dist/cli/commands/api/api-call.d.mts +19 -0
  16. package/dist/cli/commands/api/index.d.mts +3 -0
  17. package/dist/cli/commands/deploy/aigateway.d.mts +1 -0
  18. package/dist/cli/commands/deploy/application.d.mts +1 -0
  19. package/dist/cli/commands/deploy/apply-phases.d.mts +1 -0
  20. package/dist/cli/commands/deploy/auth.d.mts +1 -0
  21. package/dist/cli/commands/deploy/deploy.d.mts +24 -0
  22. package/dist/cli/commands/deploy/executor.d.mts +1 -0
  23. package/dist/cli/commands/deploy/function-registry-types.d.mts +12 -0
  24. package/dist/cli/commands/deploy/function-registry.d.mts +2 -0
  25. package/dist/cli/commands/deploy/idp.d.mts +1 -0
  26. package/dist/cli/commands/deploy/resolver.d.mts +1 -0
  27. package/dist/cli/commands/deploy/secret-manager.d.mts +1 -0
  28. package/dist/cli/commands/deploy/staticwebsite.d.mts +1 -0
  29. package/dist/cli/commands/deploy/tailordb/index.d.mts +1 -0
  30. package/dist/cli/commands/deploy/types.d.mts +1 -0
  31. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -0
  32. package/dist/cli/commands/deploy/workflow.d.mts +1 -0
  33. package/dist/cli/commands/executor/get.d.mts +29 -0
  34. package/dist/cli/commands/executor/jobs.d.mts +123 -0
  35. package/dist/cli/commands/executor/list.d.mts +19 -0
  36. package/dist/cli/commands/executor/transform.d.mts +41 -0
  37. package/dist/cli/commands/executor/trigger.d.mts +41 -0
  38. package/dist/cli/commands/executor/webhook.d.mts +22 -0
  39. package/dist/cli/commands/function/get.d.mts +18 -0
  40. package/dist/cli/commands/function/list.d.mts +22 -0
  41. package/dist/cli/commands/function/transform.d.mts +11 -0
  42. package/dist/cli/commands/generate/options.d.mts +7 -0
  43. package/dist/cli/commands/generate/seed/bundler.d.mts +26 -0
  44. package/dist/cli/commands/generate/service.d.mts +11 -0
  45. package/dist/cli/commands/machineuser/list.d.mts +27 -0
  46. package/dist/cli/commands/machineuser/token.d.mts +22 -0
  47. package/dist/cli/commands/oauth2client/get.d.mts +18 -0
  48. package/dist/cli/commands/oauth2client/list.d.mts +20 -0
  49. package/dist/cli/commands/oauth2client/transform.d.mts +20 -0
  50. package/dist/cli/commands/organization/folder/create.d.mts +18 -0
  51. package/dist/cli/commands/organization/folder/delete.d.mts +16 -0
  52. package/dist/cli/commands/organization/folder/get.d.mts +17 -0
  53. package/dist/cli/commands/organization/folder/list.d.mts +22 -0
  54. package/dist/cli/commands/organization/folder/update.d.mts +18 -0
  55. package/dist/cli/commands/organization/get.d.mts +16 -0
  56. package/dist/cli/commands/organization/list.d.mts +15 -0
  57. package/dist/cli/commands/organization/transform.d.mts +27 -0
  58. package/dist/cli/commands/organization/tree.d.mts +25 -0
  59. package/dist/cli/commands/organization/update.d.mts +17 -0
  60. package/dist/cli/commands/remove.d.mts +16 -0
  61. package/dist/cli/commands/show.d.mts +34 -0
  62. package/dist/cli/commands/tailordb/migrate/bundler.d.mts +28 -0
  63. package/dist/cli/commands/tailordb/migrate/config.d.mts +19 -0
  64. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +223 -0
  65. package/dist/cli/commands/tailordb/migrate/generate.d.mts +17 -0
  66. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +202 -0
  67. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +98 -0
  68. package/dist/cli/commands/tailordb/migrate/types.d.mts +7 -0
  69. package/dist/cli/commands/tailordb/truncate.d.mts +19 -0
  70. package/dist/cli/commands/workflow/executions.d.mts +75 -0
  71. package/dist/cli/commands/workflow/get.d.mts +29 -0
  72. package/dist/cli/commands/workflow/list.d.mts +19 -0
  73. package/dist/cli/commands/workflow/resume.d.mts +23 -0
  74. package/dist/cli/commands/workflow/start.d.mts +61 -0
  75. package/dist/cli/commands/workflow/status.d.mts +5 -0
  76. package/dist/cli/commands/workflow/transform.d.mts +33 -0
  77. package/dist/cli/commands/workflow/wait.d.mts +16 -0
  78. package/dist/cli/commands/workflow/waiter.d.mts +23 -0
  79. package/dist/cli/commands/workspace/app/health.d.mts +18 -0
  80. package/dist/cli/commands/workspace/app/list.d.mts +22 -0
  81. package/dist/cli/commands/workspace/app/transform.d.mts +18 -0
  82. package/dist/cli/commands/workspace/create.d.mts +25 -0
  83. package/dist/cli/commands/workspace/delete.d.mts +15 -0
  84. package/dist/cli/commands/workspace/get.d.mts +17 -0
  85. package/dist/cli/commands/workspace/list.d.mts +17 -0
  86. package/dist/cli/commands/workspace/restore.d.mts +15 -0
  87. package/dist/cli/commands/workspace/transform.d.mts +16 -0
  88. package/dist/cli/commands/workspace/user/invite.d.mts +22 -0
  89. package/dist/cli/commands/workspace/user/list.d.mts +22 -0
  90. package/dist/cli/commands/workspace/user/remove.d.mts +17 -0
  91. package/dist/cli/commands/workspace/user/transform.d.mts +8 -0
  92. package/dist/cli/commands/workspace/user/update.d.mts +22 -0
  93. package/dist/cli/erd-viewer-assets/app.js +279 -36
  94. package/dist/cli/erd-viewer-assets/index.html +4 -0
  95. package/dist/cli/erd-viewer-assets/styles.css +252 -5
  96. package/dist/cli/index.d.mts +18 -3
  97. package/dist/cli/index.mjs +2237 -520
  98. package/dist/cli/index.mjs.map +1 -1
  99. package/dist/cli/lib.d.mts +81 -21107
  100. package/dist/cli/lib.mjs +7 -10
  101. package/dist/cli/lib.mjs.map +1 -1
  102. package/dist/cli/query/index.d.mts +39 -0
  103. package/dist/cli/services/application.d.mts +1 -0
  104. package/dist/cli/services/auth/service.d.mts +1 -0
  105. package/dist/cli/services/executor/service.d.mts +1 -0
  106. package/dist/cli/services/http-adapter/bundler.d.mts +1 -0
  107. package/dist/cli/services/http-adapter/service.d.mts +1 -0
  108. package/dist/cli/services/resolver/service.d.mts +1 -0
  109. package/dist/cli/services/tailordb/service.d.mts +1 -0
  110. package/dist/cli/services/workflow/bundler.d.mts +1 -0
  111. package/dist/cli/services/workflow/service.d.mts +1 -0
  112. package/dist/cli/shared/args.d.mts +13 -0
  113. package/dist/cli/shared/client.d.mts +1273 -0
  114. package/dist/cli/shared/config-loader.d.mts +26 -0
  115. package/dist/cli/shared/context.d.mts +28 -0
  116. package/dist/cli/shared/script-executor.d.mts +75 -0
  117. package/dist/cli/shared/seed-chunker.d.mts +46 -0
  118. package/dist/cli/shared/trigger-context.d.mts +1 -0
  119. package/dist/cli/shared/type-generator.d.mts +20 -0
  120. package/dist/cli/ts-hook.d.mts +4 -0
  121. package/dist/cli/ts-hook.mjs +333 -0
  122. package/dist/completion/zsh-worker.zsh +1531 -1131
  123. package/dist/configure/config/index.d.mts +21 -0
  124. package/dist/configure/config/types.d.mts +105 -0
  125. package/dist/configure/index.d.mts +124 -9
  126. package/dist/configure/index.mjs +136 -23
  127. package/dist/configure/index.mjs.map +1 -1
  128. package/dist/configure/services/aigateway/index.d.mts +17 -0
  129. package/dist/configure/services/aigateway/types.d.mts +11 -0
  130. package/dist/configure/services/auth/index.d.mts +34 -0
  131. package/dist/configure/services/auth/types.d.mts +172 -0
  132. package/dist/configure/services/executor/executor.d.mts +81 -0
  133. package/dist/configure/services/executor/index.d.mts +8 -0
  134. package/dist/configure/services/executor/operation.d.mts +45 -0
  135. package/dist/configure/services/executor/trigger/event.d.mts +272 -0
  136. package/dist/configure/services/executor/trigger/index.d.mts +8 -0
  137. package/dist/configure/services/executor/trigger/schedule.d.mts +25 -0
  138. package/dist/configure/services/executor/trigger/webhook.d.mts +44 -0
  139. package/dist/configure/services/executor/types.d.mts +2 -0
  140. package/dist/configure/services/http-adapter/http-adapter.d.mts +125 -0
  141. package/dist/configure/services/http-adapter/index.d.mts +2 -0
  142. package/dist/configure/services/idp/index.d.mts +64 -0
  143. package/dist/configure/services/idp/permission.d.mts +80 -0
  144. package/dist/configure/services/idp/types.d.mts +20 -0
  145. package/dist/configure/services/index.d.mts +34 -0
  146. package/dist/configure/services/resolver/index.d.mts +5 -0
  147. package/dist/configure/services/resolver/resolver.d.mts +75 -0
  148. package/dist/configure/services/resolver/types.d.mts +6 -0
  149. package/dist/configure/services/secrets/index.d.mts +38 -0
  150. package/dist/configure/services/secrets/types.d.mts +11 -0
  151. package/dist/configure/services/staticwebsite/index.d.mts +19 -0
  152. package/dist/configure/services/staticwebsite/types.d.mts +11 -0
  153. package/dist/configure/services/tailordb/index.d.mts +4 -0
  154. package/dist/configure/services/tailordb/permission.d.mts +119 -0
  155. package/dist/configure/services/tailordb/schema.d.mts +456 -0
  156. package/dist/configure/services/tailordb/types.d.mts +149 -0
  157. package/dist/configure/services/workflow/execution-policy.d.mts +71 -0
  158. package/dist/configure/services/workflow/execution-policy.types.d.mts +104 -0
  159. package/dist/configure/services/workflow/index.d.mts +8 -0
  160. package/dist/configure/services/workflow/job.d.mts +84 -0
  161. package/dist/configure/services/workflow/types.d.mts +2 -0
  162. package/dist/configure/services/workflow/wait-point.d.mts +73 -0
  163. package/dist/configure/services/workflow/workflow.d.mts +54 -0
  164. package/dist/configure/types/aigateway-name.d.mts +12 -0
  165. package/dist/configure/types/connection-name.d.mts +12 -0
  166. package/dist/configure/types/field-runtime.d.mts +17 -0
  167. package/dist/configure/types/field.d.mts +9 -0
  168. package/dist/configure/types/field.types.d.mts +109 -0
  169. package/dist/configure/types/idp-name.d.mts +12 -0
  170. package/dist/configure/types/index.d.mts +4 -0
  171. package/dist/configure/types/machine-user.d.mts +2 -0
  172. package/dist/configure/types/type.d.mts +82 -0
  173. package/dist/{context-Bd266-ru.mjs → context-DYQVYWqZ.mjs} +4 -5
  174. package/dist/context-DYQVYWqZ.mjs.map +1 -0
  175. package/dist/{crashreport-DFq-vsU0.mjs → crashreport-Cg-pqRJV.mjs} +6 -6
  176. package/dist/{crashreport-DFq-vsU0.mjs.map → crashreport-Cg-pqRJV.mjs.map} +1 -1
  177. package/dist/{crashreport-BMWcxeSE.mjs → crashreport-D3RjuSYb.mjs} +1 -1
  178. package/dist/enum-constants-j9QBF0cB.mjs.map +1 -1
  179. package/dist/{errors-Dtf2WPaW.mjs → errors-118wUDRr.mjs} +2 -2
  180. package/dist/errors-118wUDRr.mjs.map +1 -0
  181. package/dist/field-runtime-CAnh_oow.mjs +183 -0
  182. package/dist/field-runtime-CAnh_oow.mjs.map +1 -0
  183. package/dist/{file-BbdFGdMV.mjs → file-BUcmVIH2.mjs} +12 -14
  184. package/dist/file-BUcmVIH2.mjs.map +1 -0
  185. package/dist/{file-utils-CYZnO1pX.mjs → file-utils-yEiIS4nJ.mjs} +2 -2
  186. package/dist/file-utils-yEiIS4nJ.mjs.map +1 -0
  187. package/dist/{globals-Cf0sxIt8.mjs → globals-BjhJJ2dN.mjs} +5 -47
  188. package/dist/globals-BjhJJ2dN.mjs.map +1 -0
  189. package/dist/iconv-QWaZh0TT.mjs +38 -0
  190. package/dist/iconv-QWaZh0TT.mjs.map +1 -0
  191. package/dist/{idp-BDbK5gjm.mjs → idp-RA_swu-h.mjs} +12 -5
  192. package/dist/idp-RA_swu-h.mjs.map +1 -0
  193. package/dist/{interceptor-D-q1rvRl.mjs → interceptor-e33JtsC-.mjs} +2 -2
  194. package/dist/interceptor-e33JtsC-.mjs.map +1 -0
  195. package/dist/kysely/index.d.mts +2 -3
  196. package/dist/{kysely-type-DR8uzZTA.mjs → kysely-type-D-zflMGf.mjs} +2 -2
  197. package/dist/{kysely-type-DR8uzZTA.mjs.map → kysely-type-D-zflMGf.mjs.map} +1 -1
  198. package/dist/{logger-CxF-Ex5d.mjs → logger-BEiZZ3qT.mjs} +3 -3
  199. package/dist/{logger-CxF-Ex5d.mjs.map → logger-BEiZZ3qT.mjs.map} +1 -1
  200. package/dist/parser/service/auth/index.d.mts +1 -0
  201. package/dist/parser/service/auth/schema.d.mts +1 -0
  202. package/dist/parser/service/http-adapter/index.d.mts +1 -0
  203. package/dist/parser/service/http-adapter/schema.d.mts +1 -0
  204. package/dist/parser/service/idp/types.d.mts +4 -0
  205. package/dist/parser/service/tailordb/types.d.mts +126 -0
  206. package/dist/platform-serialize-RoRtBS0v.mjs +46 -0
  207. package/dist/platform-serialize-RoRtBS0v.mjs.map +1 -0
  208. package/dist/plugin/builtin/enum-constants/index.d.mts +16 -1
  209. package/dist/plugin/builtin/file-utils/index.d.mts +16 -1
  210. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  211. package/dist/plugin/builtin/kysely-type/index.d.mts +16 -1
  212. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  213. package/dist/plugin/builtin/seed/index.d.mts +45 -1
  214. package/dist/plugin/builtin/seed/index.mjs +1 -1
  215. package/dist/plugin/get-generated-type.d.mts +17 -0
  216. package/dist/plugin/index.d.mts +3 -118
  217. package/dist/plugin/index.mjs +1 -1
  218. package/dist/plugin/index.mjs.map +1 -1
  219. package/dist/plugin/manager.d.mts +1 -0
  220. package/dist/plugin/types.d.mts +243 -0
  221. package/dist/plugin/with-context.d.mts +102 -0
  222. package/dist/{runtime-CY4JvrDj.mjs → register-ts-hook-BM1caLT0.mjs} +4128 -2744
  223. package/dist/register-ts-hook-BM1caLT0.mjs.map +1 -0
  224. package/dist/{registry-DH4m7eYo.mjs → registry-BSbq6SPo.mjs} +4 -3
  225. package/dist/registry-BSbq6SPo.mjs.map +1 -0
  226. package/dist/{repl-editor-DmGr9zMw.mjs → repl-editor-BCozyiNq.mjs} +6 -5
  227. package/dist/{repl-editor-DmGr9zMw.mjs.map → repl-editor-BCozyiNq.mjs.map} +1 -1
  228. package/dist/resource_pb-BRv7AMXK.mjs +49 -0
  229. package/dist/resource_pb-BRv7AMXK.mjs.map +1 -0
  230. package/dist/runtime/aigateway.d.mts +26 -0
  231. package/dist/runtime/aigateway.mjs +3 -0
  232. package/dist/runtime/authconnection.d.mts +22 -2
  233. package/dist/runtime/authconnection.mjs +2 -2
  234. package/dist/runtime/context.d.mts +55 -2
  235. package/dist/runtime/context.mjs +2 -2
  236. package/dist/runtime/file.d.mts +170 -2
  237. package/dist/runtime/file.mjs +2 -2
  238. package/dist/runtime/globals.d.mts +31 -19
  239. package/dist/runtime/iconv.d.mts +73 -2
  240. package/dist/runtime/iconv.mjs +2 -2
  241. package/dist/runtime/idp.d.mts +129 -2
  242. package/dist/runtime/idp.mjs +2 -2
  243. package/dist/runtime/index.d.mts +47 -9
  244. package/dist/runtime/index.mjs +9 -8
  245. package/dist/runtime/secretmanager.d.mts +41 -2
  246. package/dist/runtime/secretmanager.mjs +2 -2
  247. package/dist/{types-BZ7QKVE8.d.mts → runtime/types.d.mts} +4 -5
  248. package/dist/runtime/workflow.d.mts +113 -2
  249. package/dist/runtime/workflow.mjs +2 -2
  250. package/dist/{schema-Dtw9Orye.mjs → schema-C4LYbXVG.mjs} +21 -186
  251. package/dist/schema-C4LYbXVG.mjs.map +1 -0
  252. package/dist/{secret-file-VSVGy1V0.mjs → secret-file-aoNXJmKa.mjs} +3 -3
  253. package/dist/secret-file-aoNXJmKa.mjs.map +1 -0
  254. package/dist/secretmanager-Bd45j7an.mjs +98 -0
  255. package/dist/secretmanager-Bd45j7an.mjs.map +1 -0
  256. package/dist/secretmanager-CYlpffsz.mjs +13 -0
  257. package/dist/secretmanager-CYlpffsz.mjs.map +1 -0
  258. package/dist/seed/index.d.mts +1 -2
  259. package/dist/{seed-izIEyP3z.mjs → seed-CRSQJI_z.mjs} +14 -3
  260. package/dist/seed-CRSQJI_z.mjs.map +1 -0
  261. package/dist/service-CkIwEctX.mjs +3 -0
  262. package/dist/{service-DU1mVzri2.mjs → service-DeZeYa06.mjs} +3 -3
  263. package/dist/service-DeZeYa06.mjs.map +1 -0
  264. package/dist/{service-DjyqbCaJ.mjs → service-ufH7sS8o.mjs} +396 -58
  265. package/dist/service-ufH7sS8o.mjs.map +1 -0
  266. package/dist/service_pb-B2FF59sP.mjs +3 -0
  267. package/dist/service_pb-B5w9rjPY.mjs +955 -0
  268. package/dist/service_pb-B5w9rjPY.mjs.map +1 -0
  269. package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +204 -0
  270. package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +58 -0
  271. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +316 -0
  272. package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +161 -0
  273. package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +2070 -0
  274. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +861 -0
  275. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +112 -0
  276. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +69 -0
  277. package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +439 -0
  278. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +564 -0
  279. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +145 -0
  280. package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +451 -0
  281. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +192 -0
  282. package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +50 -0
  283. package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +407 -0
  284. package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +430 -0
  285. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +73 -0
  286. package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +17 -0
  287. package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +309 -0
  288. package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +591 -0
  289. package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +330 -0
  290. package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +113 -0
  291. package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +346 -0
  292. package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +54 -0
  293. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +3576 -0
  294. package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +187 -0
  295. package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +29 -0
  296. package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +429 -0
  297. package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +90 -0
  298. package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +684 -0
  299. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +797 -0
  300. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +330 -0
  301. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +183 -0
  302. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +862 -0
  303. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +310 -0
  304. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +2015 -0
  305. package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +483 -0
  306. package/dist/{telemetry-CdqJEzkj.mjs → telemetry-BRVdwh14.mjs} +3 -3
  307. package/dist/telemetry-BRVdwh14.mjs.map +1 -0
  308. package/dist/telemetry-CkbkeJxl.mjs +3 -0
  309. package/dist/types/aigateway.generated.d.mts +9 -0
  310. package/dist/types/app-config.generated.d.mts +4 -0
  311. package/dist/types/auth-connection.generated.d.mts +20 -0
  312. package/dist/types/auth.generated.d.mts +145 -0
  313. package/dist/types/executor.generated.d.mts +177 -0
  314. package/dist/types/helpers.d.mts +39 -0
  315. package/dist/types/http-adapter.generated.d.mts +17 -0
  316. package/dist/{workflow.generated-ClEjBYhm.d.mts → types/idp.generated.d.mts} +98 -185
  317. package/dist/types/resolver.generated.d.mts +39 -0
  318. package/dist/types/secrets.generated.d.mts +14 -0
  319. package/dist/types/staticwebsite.generated.d.mts +10 -0
  320. package/dist/{types-CdcQh4Z2.d.mts → types/tailordb.generated.d.mts} +2 -287
  321. package/dist/types/workflow.generated.d.mts +12 -0
  322. package/dist/types-C-lQ4se3.mjs +4 -0
  323. package/dist/types-CXF2OYdR.mjs +199 -0
  324. package/dist/types-CXF2OYdR.mjs.map +1 -0
  325. package/dist/utils/test/index.d.mts +5 -89
  326. package/dist/utils/test/index.mjs.map +1 -1
  327. package/dist/utils/test/mock.d.mts +87 -0
  328. package/dist/vitest/environment.d.mts +1 -2
  329. package/dist/vitest/environment.mjs +2 -2
  330. package/dist/vitest/environment.mjs.map +1 -1
  331. package/dist/vitest/index.d.mts +12 -428
  332. package/dist/vitest/index.mjs +740 -9
  333. package/dist/vitest/index.mjs.map +1 -1
  334. package/dist/vitest/mock-kysely.d.mts +62 -0
  335. package/dist/vitest/mock.d.mts +9 -0
  336. package/dist/vitest/mocks/aigateway.d.mts +30 -0
  337. package/dist/vitest/mocks/authconnection.d.mts +28 -0
  338. package/dist/vitest/mocks/file.d.mts +41 -0
  339. package/dist/vitest/mocks/iconv.d.mts +27 -0
  340. package/dist/vitest/mocks/idp.d.mts +44 -0
  341. package/dist/vitest/mocks/secretmanager.d.mts +33 -0
  342. package/dist/vitest/mocks/tailordb.d.mts +71 -0
  343. package/dist/vitest/mocks/workflow.d.mts +117 -0
  344. package/dist/vitest/setup.d.mts +1 -2
  345. package/dist/vitest/setup.mjs +2 -2
  346. package/dist/vitest/workflow-local.d.mts +40 -0
  347. package/dist/workflow-GNuSnsTx.mjs +22 -0
  348. package/dist/workflow-GNuSnsTx.mjs.map +1 -0
  349. package/docs/cli/application.md +98 -250
  350. package/docs/cli/auth.md +51 -295
  351. package/docs/cli/completion.md +1 -25
  352. package/docs/cli/crashreport.md +3 -61
  353. package/docs/cli/executor.md +23 -187
  354. package/docs/cli/function.md +14 -130
  355. package/docs/cli/organization.md +11 -221
  356. package/docs/cli/plugin.md +29 -0
  357. package/docs/cli/query.md +2 -22
  358. package/docs/cli/secret.md +71 -251
  359. package/docs/cli/setup.md +137 -41
  360. package/docs/cli/skills.md +50 -39
  361. package/docs/cli/staticwebsite.md +32 -180
  362. package/docs/cli/tailordb.md +97 -323
  363. package/docs/cli/upgrade.md +2 -22
  364. package/docs/cli/user.md +78 -247
  365. package/docs/cli/workflow.md +44 -203
  366. package/docs/cli/workspace.md +165 -538
  367. package/docs/cli-reference.md +167 -67
  368. package/docs/configuration.md +34 -4
  369. package/docs/github-actions.md +46 -19
  370. package/docs/migration/v2.md +397 -26
  371. package/docs/multi-environment.md +29 -7
  372. package/docs/plugin/custom.md +4 -4
  373. package/docs/plugin/index.md +8 -8
  374. package/docs/quickstart.md +8 -7
  375. package/docs/runtime.md +9 -3
  376. package/docs/services/aigateway.md +18 -2
  377. package/docs/services/auth.md +34 -42
  378. package/docs/services/http-adapter.md +16 -1
  379. package/docs/services/idp.md +55 -2
  380. package/docs/services/resolver.md +2 -2
  381. package/docs/services/secret.md +11 -11
  382. package/docs/services/staticwebsite.md +8 -2
  383. package/docs/services/tailordb-migration.md +25 -23
  384. package/docs/services/tailordb.md +55 -32
  385. package/docs/services/workflow.md +92 -14
  386. package/docs/testing.md +49 -3
  387. package/package.json +42 -31
  388. package/postinstall.mjs +4 -6
  389. package/dist/application-Dtqap5jM.mjs +0 -3
  390. package/dist/application-XuMWK4eq.mjs +0 -7257
  391. package/dist/application-XuMWK4eq.mjs.map +0 -1
  392. package/dist/authconnection-D2MhtTN5.mjs +0 -15
  393. package/dist/authconnection-D2MhtTN5.mjs.map +0 -1
  394. package/dist/authconnection-DvUQAjQS.d.mts +0 -39
  395. package/dist/context-Bd266-ru.mjs.map +0 -1
  396. package/dist/context-C2lEi9uw.d.mts +0 -47
  397. package/dist/errors-Dtf2WPaW.mjs.map +0 -1
  398. package/dist/field-DOsJCPFa.mjs +0 -22
  399. package/dist/field-DOsJCPFa.mjs.map +0 -1
  400. package/dist/file-BbdFGdMV.mjs.map +0 -1
  401. package/dist/file-Dq3NIt_F.d.mts +0 -211
  402. package/dist/file-utils-CYZnO1pX.mjs.map +0 -1
  403. package/dist/globals-Cf0sxIt8.mjs.map +0 -1
  404. package/dist/http-adapter.generated-DFsXDdm5.d.mts +0 -581
  405. package/dist/iconv-Co-TOPuH.d.mts +0 -122
  406. package/dist/iconv-D2vi8G36.mjs +0 -63
  407. package/dist/iconv-D2vi8G36.mjs.map +0 -1
  408. package/dist/idp-BDbK5gjm.mjs.map +0 -1
  409. package/dist/idp-DrhVrLmV.d.mts +0 -160
  410. package/dist/index-BI-_j9Z3.d.mts +0 -1013
  411. package/dist/index-C4JirJH8.d.mts +0 -18
  412. package/dist/index-CZfWhr0a.d.mts +0 -18
  413. package/dist/index-Cg8VKAdN.d.mts +0 -46
  414. package/dist/index-DYRjoLXD.d.mts +0 -47
  415. package/dist/index-lFpcjHPU.d.mts +0 -201
  416. package/dist/index-nW7hE6oE.d.mts +0 -18
  417. package/dist/interceptor-D-q1rvRl.mjs.map +0 -1
  418. package/dist/mock-FPxmnt-y.mjs +0 -759
  419. package/dist/mock-FPxmnt-y.mjs.map +0 -1
  420. package/dist/registry-DH4m7eYo.mjs.map +0 -1
  421. package/dist/rolldown-runtime-DXywRVcq.mjs +0 -20
  422. package/dist/runtime-CY4JvrDj.mjs.map +0 -1
  423. package/dist/schema-Dtw9Orye.mjs.map +0 -1
  424. package/dist/secret-file-VSVGy1V0.mjs.map +0 -1
  425. package/dist/secretmanager-B3n4KHfm.d.mts +0 -55
  426. package/dist/secretmanager-BVxw3ih_.mjs +0 -24
  427. package/dist/secretmanager-BVxw3ih_.mjs.map +0 -1
  428. package/dist/seed-izIEyP3z.mjs.map +0 -1
  429. package/dist/service-DCqIWibD.mjs +0 -3
  430. package/dist/service-DU1mVzri2.mjs.map +0 -1
  431. package/dist/service-DjyqbCaJ.mjs.map +0 -1
  432. package/dist/telemetry-CdqJEzkj.mjs.map +0 -1
  433. package/dist/telemetry-ClwW5ohF.mjs +0 -3
  434. package/dist/types-74etvaxy.mjs +0 -4
  435. package/dist/types-BDRml5C3.d.mts +0 -574
  436. package/dist/types-BQijbo4m.mjs +0 -371
  437. package/dist/types-BQijbo4m.mjs.map +0 -1
  438. package/dist/types-BX4q6Mo6.d.mts +0 -339
  439. package/dist/workflow-BOmaZwwG.mjs +0 -43
  440. package/dist/workflow-BOmaZwwG.mjs.map +0 -1
  441. package/dist/workflow-BVy4XWjS.d.mts +0 -101
@@ -1,15 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-DXywRVcq.mjs";
2
-
3
- //#region src/runtime/authconnection.ts
4
- var authconnection_exports = /* @__PURE__ */ __exportAll({ getConnectionToken: () => getConnectionToken });
5
- const api = () => globalThis.tailor.authconnection;
6
- /**
7
- * See {@link TailorAuthconnectionAPI.getConnectionToken}.
8
- * @param args - Forwarded to {@link TailorAuthconnectionAPI.getConnectionToken}
9
- * @returns Token payload (provider-specific shape)
10
- */
11
- const getConnectionToken = (...args) => api().getConnectionToken(...args);
12
-
13
- //#endregion
14
- export { getConnectionToken as n, authconnection_exports as t };
15
- //# sourceMappingURL=authconnection-D2MhtTN5.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authconnection-D2MhtTN5.mjs","names":[],"sources":["../src/runtime/authconnection.ts"],"sourcesContent":["/**\n * Auth connection utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.authconnection` runtime API.\n * At runtime this delegates to `globalThis.tailor.authconnection`. Use\n * `mockAuthconnection` from `@tailor-platform/sdk/vitest` to mock in unit tests.\n * @example\n * import { authconnection } from \"@tailor-platform/sdk/runtime\";\n *\n * const token = await authconnection.getConnectionToken(\"my-connection\");\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Platform API surface for `tailor.authconnection`. Describes the shape the\n * platform runtime injects on `globalThis.tailor.authconnection`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module so callers can either `import * as authconnection from\n * \"@tailor-platform/sdk/runtime/authconnection\"` or pick individual methods.\n */\nexport interface TailorAuthconnectionAPI {\n /**\n * Returns the access token for the given auth connection.\n * @param connectionName - Auth connection name as defined in tailor.config\n * @returns Token payload (provider-specific shape)\n */\n getConnectionToken(connectionName: string): Promise<any>;\n}\n\nconst api = (): TailorAuthconnectionAPI =>\n (globalThis as { tailor: { authconnection: TailorAuthconnectionAPI } }).tailor.authconnection;\n\n/**\n * See {@link TailorAuthconnectionAPI.getConnectionToken}.\n * @param args - Forwarded to {@link TailorAuthconnectionAPI.getConnectionToken}\n * @returns Token payload (provider-specific shape)\n */\nexport const getConnectionToken: TailorAuthconnectionAPI[\"getConnectionToken\"] = (...args) =>\n api().getConnectionToken(...args);\n"],"mappings":";;;;AA+BA,MAAM,YACH,WAAuE,OAAO;;;;;;AAOjF,MAAa,sBAAqE,GAAG,SACnF,IAAI,CAAC,CAAC,mBAAmB,GAAG,IAAI"}
@@ -1,39 +0,0 @@
1
- declare namespace authconnection_d_exports {
2
- export { TailorAuthconnectionAPI, getConnectionToken };
3
- }
4
- /**
5
- * Auth connection utilities.
6
- *
7
- * Thin typed wrapper around the platform-provided `tailor.authconnection` runtime API.
8
- * At runtime this delegates to `globalThis.tailor.authconnection`. Use
9
- * `mockAuthconnection` from `@tailor-platform/sdk/vitest` to mock in unit tests.
10
- * @example
11
- * import { authconnection } from "@tailor-platform/sdk/runtime";
12
- *
13
- * const token = await authconnection.getConnectionToken("my-connection");
14
- */
15
- /**
16
- * Platform API surface for `tailor.authconnection`. Describes the shape the
17
- * platform runtime injects on `globalThis.tailor.authconnection`.
18
- *
19
- * Each method below is also re-exported as a top-level named export from this
20
- * module so callers can either `import * as authconnection from
21
- * "@tailor-platform/sdk/runtime/authconnection"` or pick individual methods.
22
- */
23
- interface TailorAuthconnectionAPI {
24
- /**
25
- * Returns the access token for the given auth connection.
26
- * @param connectionName - Auth connection name as defined in tailor.config
27
- * @returns Token payload (provider-specific shape)
28
- */
29
- getConnectionToken(connectionName: string): Promise<any>;
30
- }
31
- /**
32
- * See {@link TailorAuthconnectionAPI.getConnectionToken}.
33
- * @param args - Forwarded to {@link TailorAuthconnectionAPI.getConnectionToken}
34
- * @returns Token payload (provider-specific shape)
35
- */
36
- declare const getConnectionToken: TailorAuthconnectionAPI["getConnectionToken"];
37
- //#endregion
38
- export { authconnection_d_exports as n, getConnectionToken as r, TailorAuthconnectionAPI as t };
39
- //# sourceMappingURL=authconnection-DvUQAjQS.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-Bd266-ru.mjs","names":[],"sources":["../src/runtime/context.ts"],"sourcesContent":["/**\n * Execution context utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.context` runtime API.\n * At runtime this delegates to `globalThis.tailor.context`.\n * @example\n * import { context } from \"@tailor-platform/sdk/runtime\";\n *\n * const invoker = context.getInvoker();\n * if (invoker) {\n * console.log(invoker.id, invoker.type, invoker.attributes, invoker.attributeList);\n * }\n */\n\nimport type { TailorPrincipal } from \"@/runtime/types\";\n\n/**\n * Information about the invoker of the current function execution.\n *\n * Matches the public `TailorPrincipal` shape — `attributes` is the attribute\n * map and `attributeList` is the array of attribute IDs.\n */\nexport type Invoker = TailorPrincipal;\n\n/**\n * Raw platform-side invoker payload returned by `tailor.context.getInvoker()`.\n * The wrapper normalizes this into {@link Invoker}.\n * @internal\n */\nexport interface ContextInvoker {\n /** The invoker's ID */\n id: string;\n /** The invoker's type */\n type: \"user\" | \"machine_user\";\n /** The workspace ID */\n workspaceId: string;\n /** The invoker's attribute IDs */\n attributes: string[];\n /** The invoker's attribute map */\n attributeMap: Record<string, unknown>;\n}\n\n/**\n * Platform API surface for `tailor.context`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.context`.\n * @internal\n */\nexport interface TailorContextAPI {\n getInvoker(): ContextInvoker | null;\n}\n\n/**\n * Returns information about the invoker of the current function execution,\n * or `null` for anonymous invocations.\n * @returns Invoker details, or `null` when the call is anonymous\n */\nexport function getInvoker(): Invoker | null {\n const raw = (globalThis as { tailor: { context: TailorContextAPI } }).tailor.context.getInvoker();\n if (!raw) return null;\n return {\n id: raw.id,\n type: raw.type,\n workspaceId: raw.workspaceId,\n attributes: raw.attributeMap as Invoker[\"attributes\"],\n attributeList: raw.attributes as Invoker[\"attributeList\"],\n };\n}\n"],"mappings":";;;;;;;;;AAwDA,SAAgB,aAA6B;CAC3C,MAAM,MAAO,WAAyD,OAAO,QAAQ,WAAW;CAChG,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,IAAI,IAAI;EACR,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,YAAY,IAAI;EAChB,eAAe,IAAI;CACrB;AACF"}
@@ -1,47 +0,0 @@
1
- import { o as TailorPrincipal } from "./types-BZ7QKVE8.mjs";
2
-
3
- //#region src/runtime/context.d.ts
4
- declare namespace context_d_exports {
5
- export { ContextInvoker, Invoker, TailorContextAPI, getInvoker };
6
- }
7
- /**
8
- * Information about the invoker of the current function execution.
9
- *
10
- * Matches the public `TailorPrincipal` shape — `attributes` is the attribute
11
- * map and `attributeList` is the array of attribute IDs.
12
- */
13
- type Invoker = TailorPrincipal;
14
- /**
15
- * Raw platform-side invoker payload returned by `tailor.context.getInvoker()`.
16
- * The wrapper normalizes this into {@link Invoker}.
17
- * @internal
18
- */
19
- interface ContextInvoker {
20
- /** The invoker's ID */
21
- id: string;
22
- /** The invoker's type */
23
- type: "user" | "machine_user";
24
- /** The workspace ID */
25
- workspaceId: string;
26
- /** The invoker's attribute IDs */
27
- attributes: string[];
28
- /** The invoker's attribute map */
29
- attributeMap: Record<string, unknown>;
30
- }
31
- /**
32
- * Platform API surface for `tailor.context`. Describes the shape the platform
33
- * runtime injects on `globalThis.tailor.context`.
34
- * @internal
35
- */
36
- interface TailorContextAPI {
37
- getInvoker(): ContextInvoker | null;
38
- }
39
- /**
40
- * Returns information about the invoker of the current function execution,
41
- * or `null` for anonymous invocations.
42
- * @returns Invoker details, or `null` when the call is anonymous
43
- */
44
- declare function getInvoker(): Invoker | null;
45
- //#endregion
46
- export { getInvoker as a, context_d_exports as i, Invoker as n, TailorContextAPI as r, ContextInvoker as t };
47
- //# sourceMappingURL=context-C2lEi9uw.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-Dtf2WPaW.mjs","names":[],"sources":["../src/cli/shared/errors.ts"],"sourcesContent":["import chalk from \"chalk\";\n\n/**\n * Options for creating a CLI error\n */\nexport interface CLIErrorOptions {\n message: string;\n details?: string;\n suggestion?: string;\n command?: string;\n code?: string;\n}\n\n/**\n * CLI error interface with formatted output\n */\nexport interface CLIError extends Error {\n readonly code?: string;\n readonly details?: string;\n readonly suggestion?: string;\n readonly command?: string;\n format(): string;\n}\n\ntype CLIErrorInternal = Error & {\n code?: string;\n details?: string;\n suggestion?: string;\n command?: string;\n format(): string;\n};\n\n/**\n * Format CLI error for output\n * @param error - CLIError instance to format\n * @returns Formatted error message\n */\nfunction formatError(error: CLIError): string {\n const parts: string[] = [\n chalk.red(`Error${error.code ? ` [${error.code}]` : \"\"}: ${error.message}`),\n ];\n\n if (error.details) {\n parts.push(`\\n ${chalk.gray(\"Details:\")} ${error.details}`);\n }\n\n if (error.suggestion) {\n parts.push(`\\n ${chalk.cyan(\"Suggestion:\")} ${error.suggestion}`);\n }\n\n if (error.command) {\n parts.push(\n `\\n ${chalk.gray(\"Help:\")} Run \\`tailor-sdk ${error.command} --help\\` for usage information.`,\n );\n }\n\n return parts.join(\"\");\n}\n\n/**\n * Create a CLI error with formatted output\n * @param options - Options to construct a CLIError\n * @returns Constructed CLIError instance\n */\nfunction createCLIError(options: CLIErrorOptions): CLIError {\n const error = new Error(options.message) as CLIErrorInternal;\n error.name = \"CLIError\";\n error.code = options.code;\n error.details = options.details;\n error.suggestion = options.suggestion;\n error.command = options.command;\n error.format = () => formatError(error);\n return error;\n}\n\n/**\n * Type guard to check if an error is a CLIError\n * @param error - Error to check\n * @returns True if the error is a CLIError\n */\nexport function isCLIError(error: unknown): error is CLIError {\n return error instanceof Error && error.name === \"CLIError\";\n}\n\n// Re-export createCLIError as CLIError for backward compatibility\nexport { createCLIError as CLIError };\n"],"mappings":";;;;;;;;AAqCA,SAAS,YAAY,OAAyB;CAC5C,MAAM,QAAkB,CACtB,MAAM,IAAI,QAAQ,MAAM,OAAO,KAAK,MAAM,KAAK,KAAK,GAAG,IAAI,MAAM,SAAS,CAC5E;CAEA,IAAI,MAAM,SACR,MAAM,KAAK,OAAO,MAAM,KAAK,UAAU,EAAE,GAAG,MAAM,SAAS;CAG7D,IAAI,MAAM,YACR,MAAM,KAAK,OAAO,MAAM,KAAK,aAAa,EAAE,GAAG,MAAM,YAAY;CAGnE,IAAI,MAAM,SACR,MAAM,KACJ,OAAO,MAAM,KAAK,OAAO,EAAE,oBAAoB,MAAM,QAAQ,iCAC/D;CAGF,OAAO,MAAM,KAAK,EAAE;AACtB;;;;;;AAOA,SAAS,eAAe,SAAoC;CAC1D,MAAM,QAAQ,IAAI,MAAM,QAAQ,OAAO;CACvC,MAAM,OAAO;CACb,MAAM,OAAO,QAAQ;CACrB,MAAM,UAAU,QAAQ;CACxB,MAAM,aAAa,QAAQ;CAC3B,MAAM,UAAU,QAAQ;CACxB,MAAM,eAAe,YAAY,KAAK;CACtC,OAAO;AACT;;;;;;AAOA,SAAgB,WAAW,OAAmC;CAC5D,OAAO,iBAAiB,SAAS,MAAM,SAAS;AAClD"}
@@ -1,22 +0,0 @@
1
- //#region src/configure/types/field.ts
2
- /**
3
- * Normalize allowed values into EnumValue objects with descriptions.
4
- * @param values - Allowed values as strings or EnumValue objects
5
- * @returns Normalized allowed values
6
- */
7
- function mapAllowedValues(values) {
8
- return values.map((value) => {
9
- if (typeof value === "string") return {
10
- value,
11
- description: ""
12
- };
13
- return {
14
- ...value,
15
- description: value.description ?? ""
16
- };
17
- });
18
- }
19
-
20
- //#endregion
21
- export { mapAllowedValues as t };
22
- //# sourceMappingURL=field-DOsJCPFa.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-DOsJCPFa.mjs","names":[],"sources":["../src/configure/types/field.ts"],"sourcesContent":["import type { EnumValue } from \"@/configure/types/field.types\";\n\nexport type AllowedValues = readonly [string | EnumValue, ...(string | EnumValue)[]];\n\n/**\n * Normalize allowed values into EnumValue objects with descriptions.\n * @param values - Allowed values as strings or EnumValue objects\n * @returns Normalized allowed values\n */\nexport function mapAllowedValues(values: AllowedValues): EnumValue[] {\n return values.map((value) => {\n if (typeof value === \"string\") {\n return { value, description: \"\" };\n }\n return { ...value, description: value.description ?? \"\" };\n });\n}\n\nexport type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T\n ? T extends string\n ? T\n : T extends { value: infer K }\n ? K\n : never\n : never;\n"],"mappings":";;;;;;AASA,SAAgB,iBAAiB,QAAoC;CACnE,OAAO,OAAO,KAAK,UAAU;EAC3B,IAAI,OAAO,UAAU,UACnB,OAAO;GAAE;GAAO,aAAa;EAAG;EAElC,OAAO;GAAE,GAAG;GAAO,aAAa,MAAM,eAAe;EAAG;CAC1D,CAAC;AACH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-BbdFGdMV.mjs","names":[],"sources":["../src/runtime/file.ts"],"sourcesContent":["/**\n * TailorDB file (BLOB) utilities.\n *\n * Thin typed wrapper around the platform-provided `tailordb.file` runtime API.\n * At runtime this delegates to `globalThis.tailordb.file`. Use `mockFile` from\n * `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n * @example\n * import { file } from \"@tailor-platform/sdk/runtime\";\n *\n * const { metadata } = await file.upload(\n * \"my-namespace\",\n * \"Document\",\n * \"attachment\",\n * recordId,\n * bytes,\n * );\n */\n\n/** Upload response metadata. */\nexport interface UploadMetadata {\n fileSize: number;\n sha256sum: string;\n}\n\n/** Download response metadata. */\nexport interface DownloadMetadata {\n contentType: string;\n fileSize: number;\n sha256sum: string;\n lastUploadedAt: string;\n}\n\n/** File metadata (for {@link getMetadata}). */\nexport interface FileMetadata {\n contentType: string;\n fileSize: number;\n sha256sum: string;\n urlPath: string;\n lastUploadedAt?: string;\n}\n\n/** Upload options. */\nexport interface FileUploadOptions {\n contentType?: string;\n}\n\n/** Upload stream options. */\nexport interface FileUploadStreamOptions {\n contentType?: string;\n fileSize?: number;\n}\n\n/** Upload response. */\nexport interface FileUploadResponse {\n metadata: UploadMetadata;\n}\n\n/** Download response. */\nexport interface FileDownloadResponse {\n data: Uint8Array;\n metadata: DownloadMetadata;\n}\n\n/** Download-as-Base64 response. */\nexport interface FileDownloadAsBase64Response {\n data: string;\n metadata: DownloadMetadata;\n}\n\n/** Download stream response. */\nexport interface FileDownloadStreamResponse {\n body: ReadableStream<Uint8Array>;\n metadata: DownloadMetadata;\n}\n\n/** Error code emitted by {@link TailorDBFileError}. */\nexport type TailorDBFileErrorCode =\n | \"INVALID_PARAMS\"\n | \"INVALID_DATA_TYPE\"\n | \"OPERATION_FAILED\"\n | \"DELETE_FAILED\"\n | \"STREAM_OPEN_FAILED\"\n | \"STREAM_READ_ERROR\"\n | \"STREAM_ERROR\"\n | \"FILE_TOO_LARGE\";\n\n/**\n * Type-only shape of the `TailorDBFileError` runtime class. The class itself\n * is provided by the platform runtime (and by `injectMocks` in tests); this\n * interface mirrors it so callers can `import type { TailorDBFileError }` from\n * the wrapper module without depending on any ambient declaration.\n */\nexport interface TailorDBFileError extends Error {\n name: \"TailorDBFileError\";\n code?: TailorDBFileErrorCode;\n cause?: unknown;\n}\n\n/**\n * Platform API surface for `tailordb.file`. Describes the shape the platform\n * runtime injects on `globalThis.tailordb.file`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module (e.g. `upload`, `download`, `deleteFile`) so callers can either\n * `import * as file from \"@tailor-platform/sdk/runtime/file\"` or pick\n * individual methods.\n */\nexport interface TailorDBFileAPI {\n /**\n * Upload a file to TailorDB.\n * @param namespace - TailorDB namespace\n * @param typeName - TailorDB type name\n * @param fieldName - File field name on the type\n * @param recordId - Record ID owning the field\n * @param data - File contents\n * @param options - Upload options (e.g. `contentType`)\n * @returns Upload response containing the file metadata\n */\n upload(\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n data: string | ArrayBuffer | Uint8Array | number[],\n options?: FileUploadOptions,\n ): Promise<FileUploadResponse>;\n\n /**\n * Download a file from TailorDB.\n *\n * Throws `TailorDBFileError` with code `FILE_TOO_LARGE` when the file\n * exceeds 10MB — use {@link downloadStream} for large files.\n * @param namespace - TailorDB namespace\n * @param typeName - TailorDB type name\n * @param fieldName - File field name on the type\n * @param recordId - Record ID owning the field\n * @returns Bytes and metadata for the file\n */\n download(\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n ): Promise<FileDownloadResponse>;\n\n /**\n * Download a file from TailorDB as a Base64-encoded string.\n *\n * Throws `TailorDBFileError` with code `FILE_TOO_LARGE` when the file\n * exceeds 10MB — use {@link downloadStream} for large files.\n * @param namespace - TailorDB namespace\n * @param typeName - TailorDB type name\n * @param fieldName - File field name on the type\n * @param recordId - Record ID owning the field\n * @returns Base64-encoded contents and metadata for the file\n */\n downloadAsBase64(\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n ): Promise<FileDownloadAsBase64Response>;\n\n /**\n * Delete a file from TailorDB. Exported as `deleteFile` (and aliased as\n * `delete`) so it can be used both with named and namespace imports.\n * @param namespace - TailorDB namespace\n * @param typeName - TailorDB type name\n * @param fieldName - File field name on the type\n * @param recordId - Record ID owning the field\n * @returns Resolves once the file has been deleted\n */\n delete(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<void>;\n\n /**\n * Get file metadata from TailorDB.\n * @param namespace - TailorDB namespace\n * @param typeName - TailorDB type name\n * @param fieldName - File field name on the type\n * @param recordId - Record ID owning the field\n * @returns Metadata for the stored file\n */\n getMetadata(\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n ): Promise<FileMetadata>;\n\n /**\n * Download a file as a ReadableStream.\n * @param namespace - TailorDB namespace\n * @param typeName - TailorDB type name\n * @param fieldName - File field name on the type\n * @param recordId - Record ID owning the field\n * @returns ReadableStream body and metadata for the file\n */\n downloadStream(\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n ): Promise<FileDownloadStreamResponse>;\n\n /**\n * Upload a file using a ReadableStream.\n * @param namespace - TailorDB namespace\n * @param typeName - TailorDB type name\n * @param fieldName - File field name on the type\n * @param recordId - Record ID owning the field\n * @param readableStream - ReadableStream providing the file data\n * @param options - Upload stream options (e.g. `contentType`, `fileSize`)\n * @returns Upload response containing the file metadata\n */\n uploadStream(\n namespace: string,\n typeName: string,\n fieldName: string,\n recordId: string,\n readableStream: ReadableStream<Uint8Array | ArrayBuffer>,\n options?: FileUploadStreamOptions,\n ): Promise<FileUploadResponse>;\n}\n\nconst api = (): TailorDBFileAPI =>\n (globalThis as { tailordb: { file: TailorDBFileAPI } }).tailordb.file;\n\n/**\n * See {@link TailorDBFileAPI.upload}.\n * @param args - Forwarded to {@link TailorDBFileAPI.upload}\n * @returns Upload response containing the file metadata\n */\nexport const upload: TailorDBFileAPI[\"upload\"] = (...args) => api().upload(...args);\n\n/**\n * See {@link TailorDBFileAPI.download}.\n * @param args - Forwarded to {@link TailorDBFileAPI.download}\n * @returns Bytes and metadata for the file\n */\nexport const download: TailorDBFileAPI[\"download\"] = (...args) => api().download(...args);\n\n/**\n * See {@link TailorDBFileAPI.downloadAsBase64}.\n * @param args - Forwarded to {@link TailorDBFileAPI.downloadAsBase64}\n * @returns Base64-encoded contents and metadata for the file\n */\nexport const downloadAsBase64: TailorDBFileAPI[\"downloadAsBase64\"] = (...args) =>\n api().downloadAsBase64(...args);\n\n/**\n * See {@link TailorDBFileAPI.delete}.\n * @param args - Forwarded to {@link TailorDBFileAPI.delete}\n * @returns Resolves once the file has been deleted\n */\nexport const deleteFile: TailorDBFileAPI[\"delete\"] = (...args) => api().delete(...args);\n\n/**\n * See {@link TailorDBFileAPI.getMetadata}.\n * @param args - Forwarded to {@link TailorDBFileAPI.getMetadata}\n * @returns Metadata for the stored file\n */\nexport const getMetadata: TailorDBFileAPI[\"getMetadata\"] = (...args) => api().getMetadata(...args);\n\n/**\n * See {@link TailorDBFileAPI.downloadStream}.\n * @param args - Forwarded to {@link TailorDBFileAPI.downloadStream}\n * @returns ReadableStream body and metadata for the file\n */\nexport const downloadStream: TailorDBFileAPI[\"downloadStream\"] = (...args) =>\n api().downloadStream(...args);\n\n/**\n * See {@link TailorDBFileAPI.uploadStream}.\n * @param args - Forwarded to {@link TailorDBFileAPI.uploadStream}\n * @returns Upload response containing the file metadata\n */\nexport const uploadStream: TailorDBFileAPI[\"uploadStream\"] = (...args) =>\n api().uploadStream(...args);\n\nexport { deleteFile as delete };\n"],"mappings":";;;;;;;;;;;;;AAgOA,MAAM,YACH,WAAuD,SAAS;;;;;;AAOnE,MAAa,UAAqC,GAAG,SAAS,IAAI,CAAC,CAAC,OAAO,GAAG,IAAI;;;;;;AAOlF,MAAa,YAAyC,GAAG,SAAS,IAAI,CAAC,CAAC,SAAS,GAAG,IAAI;;;;;;AAOxF,MAAa,oBAAyD,GAAG,SACvE,IAAI,CAAC,CAAC,iBAAiB,GAAG,IAAI;;;;;;AAOhC,MAAa,cAAyC,GAAG,SAAS,IAAI,CAAC,CAAC,OAAO,GAAG,IAAI;;;;;;AAOtF,MAAa,eAA+C,GAAG,SAAS,IAAI,CAAC,CAAC,YAAY,GAAG,IAAI;;;;;;AAOjG,MAAa,kBAAqD,GAAG,SACnE,IAAI,CAAC,CAAC,eAAe,GAAG,IAAI;;;;;;AAO9B,MAAa,gBAAiD,GAAG,SAC/D,IAAI,CAAC,CAAC,aAAa,GAAG,IAAI"}
@@ -1,211 +0,0 @@
1
- declare namespace file_d_exports {
2
- export { DownloadMetadata, FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata, FileUploadOptions, FileUploadResponse, FileUploadStreamOptions, TailorDBFileAPI, TailorDBFileError, TailorDBFileErrorCode, UploadMetadata, deleteFile as delete, deleteFile, download, downloadAsBase64, downloadStream, getMetadata, upload, uploadStream };
3
- }
4
- /**
5
- * TailorDB file (BLOB) utilities.
6
- *
7
- * Thin typed wrapper around the platform-provided `tailordb.file` runtime API.
8
- * At runtime this delegates to `globalThis.tailordb.file`. Use `mockFile` from
9
- * `@tailor-platform/sdk/vitest` to mock these calls in unit tests.
10
- * @example
11
- * import { file } from "@tailor-platform/sdk/runtime";
12
- *
13
- * const { metadata } = await file.upload(
14
- * "my-namespace",
15
- * "Document",
16
- * "attachment",
17
- * recordId,
18
- * bytes,
19
- * );
20
- */
21
- /** Upload response metadata. */
22
- interface UploadMetadata {
23
- fileSize: number;
24
- sha256sum: string;
25
- }
26
- /** Download response metadata. */
27
- interface DownloadMetadata {
28
- contentType: string;
29
- fileSize: number;
30
- sha256sum: string;
31
- lastUploadedAt: string;
32
- }
33
- /** File metadata (for {@link getMetadata}). */
34
- interface FileMetadata {
35
- contentType: string;
36
- fileSize: number;
37
- sha256sum: string;
38
- urlPath: string;
39
- lastUploadedAt?: string;
40
- }
41
- /** Upload options. */
42
- interface FileUploadOptions {
43
- contentType?: string;
44
- }
45
- /** Upload stream options. */
46
- interface FileUploadStreamOptions {
47
- contentType?: string;
48
- fileSize?: number;
49
- }
50
- /** Upload response. */
51
- interface FileUploadResponse {
52
- metadata: UploadMetadata;
53
- }
54
- /** Download response. */
55
- interface FileDownloadResponse {
56
- data: Uint8Array;
57
- metadata: DownloadMetadata;
58
- }
59
- /** Download-as-Base64 response. */
60
- interface FileDownloadAsBase64Response {
61
- data: string;
62
- metadata: DownloadMetadata;
63
- }
64
- /** Download stream response. */
65
- interface FileDownloadStreamResponse {
66
- body: ReadableStream<Uint8Array>;
67
- metadata: DownloadMetadata;
68
- }
69
- /** Error code emitted by {@link TailorDBFileError}. */
70
- type TailorDBFileErrorCode = "INVALID_PARAMS" | "INVALID_DATA_TYPE" | "OPERATION_FAILED" | "DELETE_FAILED" | "STREAM_OPEN_FAILED" | "STREAM_READ_ERROR" | "STREAM_ERROR" | "FILE_TOO_LARGE";
71
- /**
72
- * Type-only shape of the `TailorDBFileError` runtime class. The class itself
73
- * is provided by the platform runtime (and by `injectMocks` in tests); this
74
- * interface mirrors it so callers can `import type { TailorDBFileError }` from
75
- * the wrapper module without depending on any ambient declaration.
76
- */
77
- interface TailorDBFileError extends Error {
78
- name: "TailorDBFileError";
79
- code?: TailorDBFileErrorCode;
80
- cause?: unknown;
81
- }
82
- /**
83
- * Platform API surface for `tailordb.file`. Describes the shape the platform
84
- * runtime injects on `globalThis.tailordb.file`.
85
- *
86
- * Each method below is also re-exported as a top-level named export from this
87
- * module (e.g. `upload`, `download`, `deleteFile`) so callers can either
88
- * `import * as file from "@tailor-platform/sdk/runtime/file"` or pick
89
- * individual methods.
90
- */
91
- interface TailorDBFileAPI {
92
- /**
93
- * Upload a file to TailorDB.
94
- * @param namespace - TailorDB namespace
95
- * @param typeName - TailorDB type name
96
- * @param fieldName - File field name on the type
97
- * @param recordId - Record ID owning the field
98
- * @param data - File contents
99
- * @param options - Upload options (e.g. `contentType`)
100
- * @returns Upload response containing the file metadata
101
- */
102
- upload(namespace: string, typeName: string, fieldName: string, recordId: string, data: string | ArrayBuffer | Uint8Array | number[], options?: FileUploadOptions): Promise<FileUploadResponse>;
103
- /**
104
- * Download a file from TailorDB.
105
- *
106
- * Throws `TailorDBFileError` with code `FILE_TOO_LARGE` when the file
107
- * exceeds 10MB — use {@link downloadStream} for large files.
108
- * @param namespace - TailorDB namespace
109
- * @param typeName - TailorDB type name
110
- * @param fieldName - File field name on the type
111
- * @param recordId - Record ID owning the field
112
- * @returns Bytes and metadata for the file
113
- */
114
- download(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadResponse>;
115
- /**
116
- * Download a file from TailorDB as a Base64-encoded string.
117
- *
118
- * Throws `TailorDBFileError` with code `FILE_TOO_LARGE` when the file
119
- * exceeds 10MB — use {@link downloadStream} for large files.
120
- * @param namespace - TailorDB namespace
121
- * @param typeName - TailorDB type name
122
- * @param fieldName - File field name on the type
123
- * @param recordId - Record ID owning the field
124
- * @returns Base64-encoded contents and metadata for the file
125
- */
126
- downloadAsBase64(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadAsBase64Response>;
127
- /**
128
- * Delete a file from TailorDB. Exported as `deleteFile` (and aliased as
129
- * `delete`) so it can be used both with named and namespace imports.
130
- * @param namespace - TailorDB namespace
131
- * @param typeName - TailorDB type name
132
- * @param fieldName - File field name on the type
133
- * @param recordId - Record ID owning the field
134
- * @returns Resolves once the file has been deleted
135
- */
136
- delete(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<void>;
137
- /**
138
- * Get file metadata from TailorDB.
139
- * @param namespace - TailorDB namespace
140
- * @param typeName - TailorDB type name
141
- * @param fieldName - File field name on the type
142
- * @param recordId - Record ID owning the field
143
- * @returns Metadata for the stored file
144
- */
145
- getMetadata(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileMetadata>;
146
- /**
147
- * Download a file as a ReadableStream.
148
- * @param namespace - TailorDB namespace
149
- * @param typeName - TailorDB type name
150
- * @param fieldName - File field name on the type
151
- * @param recordId - Record ID owning the field
152
- * @returns ReadableStream body and metadata for the file
153
- */
154
- downloadStream(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadStreamResponse>;
155
- /**
156
- * Upload a file using a ReadableStream.
157
- * @param namespace - TailorDB namespace
158
- * @param typeName - TailorDB type name
159
- * @param fieldName - File field name on the type
160
- * @param recordId - Record ID owning the field
161
- * @param readableStream - ReadableStream providing the file data
162
- * @param options - Upload stream options (e.g. `contentType`, `fileSize`)
163
- * @returns Upload response containing the file metadata
164
- */
165
- uploadStream(namespace: string, typeName: string, fieldName: string, recordId: string, readableStream: ReadableStream<Uint8Array | ArrayBuffer>, options?: FileUploadStreamOptions): Promise<FileUploadResponse>;
166
- }
167
- /**
168
- * See {@link TailorDBFileAPI.upload}.
169
- * @param args - Forwarded to {@link TailorDBFileAPI.upload}
170
- * @returns Upload response containing the file metadata
171
- */
172
- declare const upload: TailorDBFileAPI["upload"];
173
- /**
174
- * See {@link TailorDBFileAPI.download}.
175
- * @param args - Forwarded to {@link TailorDBFileAPI.download}
176
- * @returns Bytes and metadata for the file
177
- */
178
- declare const download: TailorDBFileAPI["download"];
179
- /**
180
- * See {@link TailorDBFileAPI.downloadAsBase64}.
181
- * @param args - Forwarded to {@link TailorDBFileAPI.downloadAsBase64}
182
- * @returns Base64-encoded contents and metadata for the file
183
- */
184
- declare const downloadAsBase64: TailorDBFileAPI["downloadAsBase64"];
185
- /**
186
- * See {@link TailorDBFileAPI.delete}.
187
- * @param args - Forwarded to {@link TailorDBFileAPI.delete}
188
- * @returns Resolves once the file has been deleted
189
- */
190
- declare const deleteFile: TailorDBFileAPI["delete"];
191
- /**
192
- * See {@link TailorDBFileAPI.getMetadata}.
193
- * @param args - Forwarded to {@link TailorDBFileAPI.getMetadata}
194
- * @returns Metadata for the stored file
195
- */
196
- declare const getMetadata: TailorDBFileAPI["getMetadata"];
197
- /**
198
- * See {@link TailorDBFileAPI.downloadStream}.
199
- * @param args - Forwarded to {@link TailorDBFileAPI.downloadStream}
200
- * @returns ReadableStream body and metadata for the file
201
- */
202
- declare const downloadStream: TailorDBFileAPI["downloadStream"];
203
- /**
204
- * See {@link TailorDBFileAPI.uploadStream}.
205
- * @param args - Forwarded to {@link TailorDBFileAPI.uploadStream}
206
- * @returns Upload response containing the file metadata
207
- */
208
- declare const uploadStream: TailorDBFileAPI["uploadStream"];
209
- //#endregion
210
- export { file_d_exports as _, FileMetadata as a, uploadStream as b, FileUploadStreamOptions as c, TailorDBFileErrorCode as d, UploadMetadata as f, downloadStream as g, downloadAsBase64 as h, FileDownloadStreamResponse as i, TailorDBFileAPI as l, download as m, FileDownloadAsBase64Response as n, FileUploadOptions as o, deleteFile as p, FileDownloadResponse as r, FileUploadResponse as s, DownloadMetadata as t, TailorDBFileError as u, getMetadata as v, upload as y };
211
- //# sourceMappingURL=file-Dq3NIt_F.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-utils-CYZnO1pX.mjs","names":[],"sources":["../src/plugin/builtin/file-utils/generate-file-utils.ts","../src/plugin/builtin/file-utils/process-file-type.ts","../src/plugin/builtin/file-utils/index.ts"],"sourcesContent":["import multiline from \"@/utils/multiline\";\nimport type { FileUtilMetadata } from \"./types\";\n\n/**\n * Generate unified file utility functions from collected metadata.\n * @param namespaceData - Namespace data with file utility metadata\n * @returns Generated file utility code\n */\nexport function generateUnifiedFileUtils(\n namespaceData: { namespace: string; types: FileUtilMetadata[] }[],\n): string {\n if (namespaceData.length === 0) {\n return \"\";\n }\n\n // Collect all types with their namespace\n const typeNamespaceMap = new Map<string, string>();\n const typeFieldsMap = new Map<string, string[]>();\n\n for (const { namespace, types } of namespaceData) {\n for (const type of types) {\n typeNamespaceMap.set(type.name, namespace);\n typeFieldsMap.set(type.name, type.fileFields);\n }\n }\n\n if (typeNamespaceMap.size === 0) {\n return \"\";\n }\n\n // Generate interface fields\n const interfaceFields = Array.from(typeFieldsMap.entries())\n .map(([typeName, fields]) => {\n const fieldNamesUnion = fields.map((field) => `\"${field}\"`).join(\" | \");\n return ` ${typeName}: {\\n fields: ${fieldNamesUnion};\\n };`;\n })\n .join(\"\\n\");\n\n const importStatement =\n multiline /* ts */ `\n import * as file from \"@tailor-platform/sdk/runtime/file\";\n import type {\n FileUploadOptions,\n FileUploadResponse,\n FileMetadata,\n FileDownloadStreamResponse,\n } from \"@tailor-platform/sdk/runtime/file\";\n ` + \"\\n\";\n\n const interfaceDefinition =\n multiline /* ts */ `\n export interface TypeWithFiles {\n ${interfaceFields}\n }\n ` + \"\\n\";\n\n // Generate namespaces object\n const namespaceEntries = Array.from(typeNamespaceMap.entries())\n .map(([typeName, namespace]) => ` ${typeName}: \"${namespace}\"`)\n .join(\",\\n\");\n\n const namespacesDefinition =\n multiline /* ts */ `\n const namespaces: Record<keyof TypeWithFiles, string> = {\n ${namespaceEntries},\n };\n ` + \"\\n\";\n\n // Generate downloadFile helper function\n const downloadFunction =\n multiline /* ts */ `\n export async function downloadFile<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n ) {\n return await file.download(namespaces[type], type, field, recordId);\n }\n ` + \"\\n\";\n\n // Generate uploadFile helper function\n const uploadFunction =\n multiline /* ts */ `\n export async function uploadFile<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n data: string | ArrayBuffer | Uint8Array<ArrayBufferLike> | number[],\n options?: FileUploadOptions,\n ): Promise<FileUploadResponse> {\n return await file.upload(namespaces[type], type, field, recordId, data, options);\n }\n ` + \"\\n\";\n\n // Generate deleteFile helper function\n const deleteFunction =\n multiline /* ts */ `\n export async function deleteFile<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n ): Promise<void> {\n return await file.delete(namespaces[type], type, field, recordId);\n }\n ` + \"\\n\";\n\n // Generate getFileMetadata helper function\n const getMetadataFunction =\n multiline /* ts */ `\n export async function getFileMetadata<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n ): Promise<FileMetadata> {\n return await file.getMetadata(namespaces[type], type, field, recordId);\n }\n ` + \"\\n\";\n\n // Generate downloadFileStream helper function\n const downloadStreamFunction =\n multiline /* ts */ `\n export async function downloadFileStream<T extends keyof TypeWithFiles>(\n type: T,\n field: TypeWithFiles[T][\"fields\"],\n recordId: string,\n ): Promise<FileDownloadStreamResponse> {\n return await file.downloadStream(namespaces[type], type, field, recordId);\n }\n ` + \"\\n\";\n\n return [\n importStatement,\n interfaceDefinition,\n namespacesDefinition,\n downloadFunction,\n uploadFunction,\n deleteFunction,\n getMetadataFunction,\n downloadStreamFunction,\n ].join(\"\\n\");\n}\n","import type { FileUtilMetadata } from \"./types\";\nimport type { TailorDBType } from \"@/parser/service/tailordb/types\";\n\n/**\n * Process a TailorDB type and extract file field metadata.\n * @param type - The parsed TailorDB type to process\n * @returns File utility metadata for the type\n */\nexport async function processFileType(type: TailorDBType): Promise<FileUtilMetadata> {\n const fileFields: string[] = [];\n\n if (type.files) {\n for (const fileFieldName of Object.keys(type.files)) {\n fileFields.push(fileFieldName);\n }\n }\n\n return {\n name: type.name,\n fileFields,\n };\n}\n","import { generateUnifiedFileUtils } from \"./generate-file-utils\";\nimport { processFileType } from \"./process-file-type\";\nimport type { FileUtilMetadata } from \"./types\";\nimport type { Plugin, GeneratorResult, TailorDBReadyContext } from \"@/plugin/types\";\n\n/** Unique identifier for the file utilities generator plugin. */\nexport const FileUtilsGeneratorID = \"@tailor-platform/file-utils\";\n\ntype FileUtilsPluginOptions = {\n distPath: string;\n};\n\n/**\n * Plugin that generates TypeWithFiles interface from TailorDB type definitions.\n * @param options - Plugin options\n * @param options.distPath - Output file path for generated file utilities\n * @returns Plugin instance with onTailorDBReady hook\n */\nexport function fileUtilsPlugin(\n options: FileUtilsPluginOptions,\n): Plugin<unknown, FileUtilsPluginOptions> {\n return {\n id: FileUtilsGeneratorID,\n description: \"Generates TypeWithFiles interface from TailorDB type definitions\",\n pluginConfig: options,\n\n async onTailorDBReady(\n ctx: TailorDBReadyContext<FileUtilsPluginOptions>,\n ): Promise<GeneratorResult> {\n const namespaceData: { namespace: string; types: FileUtilMetadata[] }[] = [];\n\n for (const ns of ctx.tailordb) {\n const typesWithFiles: FileUtilMetadata[] = [];\n\n for (const type of Object.values(ns.types)) {\n const metadata = await processFileType(type);\n if (metadata.fileFields.length > 0) {\n typesWithFiles.push(metadata);\n }\n }\n\n if (typesWithFiles.length > 0) {\n namespaceData.push({\n namespace: ns.namespace,\n types: typesWithFiles,\n });\n }\n }\n\n const files: GeneratorResult[\"files\"] = [];\n if (namespaceData.length > 0) {\n const content = generateUnifiedFileUtils(namespaceData);\n if (content) {\n files.push({\n path: ctx.pluginConfig.distPath,\n content,\n });\n }\n }\n\n return { files };\n },\n };\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,yBACd,eACQ;CACR,IAAI,cAAc,WAAW,GAC3B,OAAO;CAIT,MAAM,mCAAmB,IAAI,IAAoB;CACjD,MAAM,gCAAgB,IAAI,IAAsB;CAEhD,KAAK,MAAM,EAAE,WAAW,WAAW,eACjC,KAAK,MAAM,QAAQ,OAAO;EACxB,iBAAiB,IAAI,KAAK,MAAM,SAAS;EACzC,cAAc,IAAI,KAAK,MAAM,KAAK,UAAU;CAC9C;CAGF,IAAI,iBAAiB,SAAS,GAC5B,OAAO;CAIT,MAAM,kBAAkB,MAAM,KAAK,cAAc,QAAQ,CAAC,CAAC,CACxD,KAAK,CAAC,UAAU,YAAY;EAE3B,OAAO,KAAK,SAAS,mBADG,OAAO,KAAK,UAAU,IAAI,MAAM,EAAE,CAAC,CAAC,KAAK,KACX,EAAE;CAC1D,CAAC,CAAC,CACD,KAAK,IAAI;CA8FZ,OAAO;EA3FL,SAAmB;;;;;;;;QAQf;EAGJ,SAAmB;;QAEf,gBAAgB;;QAEhB;EAQJ,SAAmB;;QALI,MAAM,KAAK,iBAAiB,QAAQ,CAAC,CAAC,CAC5D,KAAK,CAAC,UAAU,eAAe,KAAK,SAAS,KAAK,UAAU,EAAE,CAAC,CAC/D,KAAK,KAKa,EAAE;;QAEjB;EAIJ,SAAmB;;;;;;;;QAQf;EAIJ,SAAmB;;;;;;;;;;QAUf;EAIJ,SAAmB;;;;;;;;QAQf;EAIJ,SAAmB;;;;;;;;QAQf;EAIJ,SAAmB;;;;;;;;QAQf;CAWN,CAAC,CAAC,KAAK,IAAI;AACb;;;;;;;;;ACpIA,eAAsB,gBAAgB,MAA+C;CACnF,MAAM,aAAuB,CAAC;CAE9B,IAAI,KAAK,OACP,KAAK,MAAM,iBAAiB,OAAO,KAAK,KAAK,KAAK,GAChD,WAAW,KAAK,aAAa;CAIjC,OAAO;EACL,MAAM,KAAK;EACX;CACF;AACF;;;;;ACfA,MAAa,uBAAuB;;;;;;;AAYpC,SAAgB,gBACd,SACyC;CACzC,OAAO;EACL,IAAI;EACJ,aAAa;EACb,cAAc;EAEd,MAAM,gBACJ,KAC0B;GAC1B,MAAM,gBAAoE,CAAC;GAE3E,KAAK,MAAM,MAAM,IAAI,UAAU;IAC7B,MAAM,iBAAqC,CAAC;IAE5C,KAAK,MAAM,QAAQ,OAAO,OAAO,GAAG,KAAK,GAAG;KAC1C,MAAM,WAAW,MAAM,gBAAgB,IAAI;KAC3C,IAAI,SAAS,WAAW,SAAS,GAC/B,eAAe,KAAK,QAAQ;IAEhC;IAEA,IAAI,eAAe,SAAS,GAC1B,cAAc,KAAK;KACjB,WAAW,GAAG;KACd,OAAO;IACT,CAAC;GAEL;GAEA,MAAM,QAAkC,CAAC;GACzC,IAAI,cAAc,SAAS,GAAG;IAC5B,MAAM,UAAU,yBAAyB,aAAa;IACtD,IAAI,SACF,MAAM,KAAK;KACT,MAAM,IAAI,aAAa;KACvB;IACF,CAAC;GAEL;GAEA,OAAO,EAAE,MAAM;EACjB;CACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"globals-Cf0sxIt8.mjs","names":[],"sources":["../src/utils/test/platform-serialize.ts","../src/vitest/workflow-runtime.ts","../src/vitest/globals.ts"],"sourcesContent":["/**\n * Validate and serialize a value as it would cross the Platform JSON boundary.\n *\n * Mirrors the runtime checks the platform performs on workflow arguments,\n * wait payloads, and trigger inputs so that local tests fail in the same\n * places production fails.\n *\n * Throws on:\n * - `NaN` / `Infinity` / `-Infinity` (`JSON.stringify` would silently emit `null`)\n * - `BigInt` (TypeError is thrown by `JSON.stringify`; we emit a clearer message)\n * - Non-plain objects (class instances, including `Date`, `Map`, `Set`, `Error`,\n * and user-defined DTOs whose prototype is not `Object.prototype`)\n *\n * The replacer reads `this[key]` so the check sees the original value before\n * any `toJSON` conversion (e.g. `Date.prototype.toJSON`).\n * @param value - Value to validate and round-trip\n * @returns The JSON-normalized value (undefined/function properties stripped, etc.)\n */\nexport function platformSerialize<T>(value: T): T {\n // Top-level undefined is allowed (jobs may take no input).\n if (value === undefined) return undefined as T;\n\n // Root function/symbol stringify to `undefined`; throw a specific message here.\n if (typeof value === \"function\") {\n throw new TypeError(\"platformSerialize: function is not JSON-serializable at <root>\");\n }\n if (typeof value === \"symbol\") {\n throw new TypeError(\"platformSerialize: Symbol is not JSON-serializable at <root>\");\n }\n\n const serialized = JSON.stringify(value, function (key, val) {\n if (typeof val === \"number\" && !Number.isFinite(val)) {\n throw new TypeError(\n `platformSerialize: non-finite number at ${formatPath(key)}: ${String(val)}`,\n );\n }\n if (typeof val === \"bigint\") {\n throw new TypeError(\n `platformSerialize: BigInt is not JSON-serializable at ${formatPath(key)}`,\n );\n }\n // Look at the pre-toJSON value so Date/Map/Set/etc. can be detected.\n const raw = (this as Record<string, unknown>)[key];\n if (raw !== null && typeof raw === \"object\" && !Array.isArray(raw)) {\n const proto = Object.getPrototypeOf(raw);\n if (proto !== Object.prototype && proto !== null) {\n const ctor = (raw as { constructor?: { name?: string } }).constructor?.name ?? \"anonymous\";\n throw new TypeError(\n `platformSerialize: non-plain object at ${formatPath(key)} (${ctor} instance)`,\n );\n }\n }\n return val;\n });\n\n // `JSON.stringify` returns `undefined` when the root collapses (e.g. a `toJSON`\n // returning `undefined`); parsing that would throw opaquely.\n // JSON.stringify returns undefined for non-serializable values\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (serialized === undefined) {\n throw new TypeError(\"platformSerialize: value is not JSON-serializable at <root>\");\n }\n\n return JSON.parse(serialized) as T;\n}\n\nfunction formatPath(key: string): string {\n return key === \"\" ? \"<root>\" : `\"${key}\"`;\n}\n","// Default `tailor.workflow` runner installed by the `tailor-runtime` environment.\n// Must stay free of `vitest` (`vi`): it loads via `./globals` in the environment\n// realm where `vi` is unavailable, hence relative imports only (no `@/` alias).\nimport { TRIGGER_DEFAULT } from \"../configure/services/workflow/registry\";\nimport { platformSerialize } from \"../utils/test/platform-serialize\";\n\nexport interface DefaultWorkflowRuntime {\n triggerJobFunction: (name: string, args?: unknown) => unknown;\n triggerWorkflow: (name: string, args?: unknown, options?: unknown) => Promise<string>;\n wait: (key: string, payload?: unknown) => unknown;\n resolve: (\n executionId: string,\n key: string,\n callback: (payload: unknown) => unknown,\n ) => Promise<void>;\n}\n\nexport function createDefaultWorkflowRuntime(): DefaultWorkflowRuntime {\n return {\n triggerJobFunction: (name) => {\n throw new Error(\n `No workflow job mock for \"${name}\". Acquire mockWorkflow() and call setJobHandler(...) or enqueueResult(...), or use runWorkflowLocally() for local workflow execution.`,\n );\n },\n triggerWorkflow: async (_name, args) => {\n platformSerialize(args);\n return TRIGGER_DEFAULT;\n },\n wait: (key: string): unknown => {\n throw new Error(\n `No wait handler for \"${key}\". Acquire mockWorkflow() and call setWaitHandler(...).`,\n );\n },\n resolve: async (): Promise<void> => {\n throw new Error(\n \"No resolve handler. Acquire mockWorkflow() and call setResolveHandler(...).\",\n );\n },\n };\n}\n","/**\n * Base platform globals for the tailor-runtime test environment.\n *\n * This module is intentionally free of any `vitest` (`vi`) dependency so it can\n * be imported from the Vitest *environment* module (which runs in a realm where\n * `vi` is not available). It installs only the always-present structural pieces:\n *\n * - `globalThis.tailor` / `globalThis.tailordb` container objects\n * - `globalThis.tailor.context.getInvoker` default stub\n * - the platform error classes (`TailorErrors`, `TailorErrorMessage`,\n * `TailorDBFileError`)\n * - the `__tailorRuntimeActive` sentinel flag\n *\n * The per-namespace mock behavior (TailorDB client, workflow, secretmanager, …)\n * is installed on demand by the `xMock()` factories in `./mock`, which run in\n * test context where `vi` *is* available.\n */\n\nimport { createDefaultWorkflowRuntime } from \"./workflow-runtime\";\nimport type { ContextInvoker } from \"../runtime/context\";\nimport type { TailorDBFileErrorCode } from \"../runtime/file\";\n\n// Sentinel set when the tailor-runtime environment is active. setup.ts reads it\n// to decide whether to run its blocked-globals lifecycle and config-secret\n// loading.\nexport const RUNTIME_FLAG_KEY = \"__tailorRuntimeActive\";\n\n// ---------------------------------------------------------------------------\n// Error class mocks\n// ---------------------------------------------------------------------------\n\ninterface TailorErrorItem {\n message: string;\n path: (string | number)[];\n}\n\nclass TailorErrorsMock extends Error {\n errors: TailorErrorItem[];\n\n constructor(errors: TailorErrorItem[]) {\n if (!Array.isArray(errors)) {\n throw new TypeError(\"TailorErrors: errors must be an array\");\n }\n const validated = errors.map((e, i) => {\n if (typeof e.message !== \"string\") {\n throw new TypeError(`TailorErrors: errors[${i}].message must be a string`);\n }\n if (!Array.isArray(e.path)) {\n throw new TypeError(`TailorErrors: errors[${i}].path must be an array`);\n }\n return { message: e.message, path: e.path };\n });\n // Match the PF runtime's TailorErrors serialization, which prefixes the\n // JSON payload with \"TailorErrors: \". Other SDK code (e.g. apply\n // integration fixtures) strips this prefix before JSON.parse.\n super(`TailorErrors: ${JSON.stringify({ errors: validated })}`);\n this.name = \"TailorErrors\";\n this.errors = validated;\n }\n}\n\nclass TailorErrorMessageMock extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"TailorErrorMessage\";\n }\n}\n\nclass TailorDBFileErrorMock extends Error {\n code?: TailorDBFileErrorCode;\n override cause: unknown;\n\n constructor(message: string, code?: TailorDBFileErrorCode, cause?: unknown) {\n super(message);\n this.name = \"TailorDBFileError\";\n this.code = code;\n this.cause = cause;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Base install / cleanup\n// ---------------------------------------------------------------------------\n\n// Stub-only injection. SDK consumers configure invokers at the body level\n// (resolver/executor/workflow `.body()` `invoker` arg) or, for bundled tests,\n// via `vi.spyOn(globalThis.tailor.context, \"getInvoker\")`.\nfunction defaultGetInvoker(): ContextInvoker | null {\n return null;\n}\n\n/**\n * Install the always-present base platform globals (containers, context stub,\n * error classes, runtime flag). Per-namespace mocks are layered on top by the\n * `xMock()` factories in `./mock`.\n * @param global - The global object to install into (typically `globalThis`)\n */\nexport function installPlatformGlobals(global: typeof globalThis): void {\n const g = global as Record<string, unknown>;\n\n g[RUNTIME_FLAG_KEY] = true;\n\n // Containers. Namespace mocks (secretmanager, …) are added to these by the\n // corresponding `xMock()` on acquisition. `workflow` carries a default runner\n // so `.trigger()` runs the real job chain locally without `mockWorkflow()`;\n // `mockWorkflow()` overlays and restores it.\n g.tailor = {\n context: { getInvoker: defaultGetInvoker },\n workflow: createDefaultWorkflowRuntime(),\n };\n g.tailordb = {};\n\n g.TailorErrors = TailorErrorsMock;\n g.TailorErrorMessage = TailorErrorMessageMock;\n g.TailorDBFileError = TailorDBFileErrorMock;\n}\n\n/**\n * Remove the base platform globals (and anything the namespace mocks layered on\n * top, since they live under the same containers).\n * @param global - The global object to clean up (typically `globalThis`)\n */\nexport function cleanupPlatformGlobals(global: typeof globalThis): void {\n const g = global as Record<string, unknown>;\n delete g.tailordb;\n delete g.tailor;\n delete g.TailorErrors;\n delete g.TailorErrorMessage;\n delete g.TailorDBFileError;\n delete g[RUNTIME_FLAG_KEY];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA,SAAgB,kBAAqB,OAAa;CAEhD,IAAI,UAAU,QAAW,OAAO;CAGhC,IAAI,OAAO,UAAU,YACnB,MAAM,IAAI,UAAU,gEAAgE;CAEtF,IAAI,OAAO,UAAU,UACnB,MAAM,IAAI,UAAU,8DAA8D;CAGpF,MAAM,aAAa,KAAK,UAAU,OAAO,SAAU,KAAK,KAAK;EAC3D,IAAI,OAAO,QAAQ,YAAY,CAAC,OAAO,SAAS,GAAG,GACjD,MAAM,IAAI,UACR,2CAA2C,WAAW,GAAG,EAAE,IAAI,OAAO,GAAG,GAC3E;EAEF,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,UACR,yDAAyD,WAAW,GAAG,GACzE;EAGF,MAAM,MAAO,KAAiC;EAC9C,IAAI,QAAQ,QAAQ,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG,GAAG;GAClE,MAAM,QAAQ,OAAO,eAAe,GAAG;GACvC,IAAI,UAAU,OAAO,aAAa,UAAU,MAAM;IAChD,MAAM,OAAQ,IAA4C,aAAa,QAAQ;IAC/E,MAAM,IAAI,UACR,0CAA0C,WAAW,GAAG,EAAE,IAAI,KAAK,WACrE;GACF;EACF;EACA,OAAO;CACT,CAAC;CAMD,IAAI,eAAe,QACjB,MAAM,IAAI,UAAU,6DAA6D;CAGnF,OAAO,KAAK,MAAM,UAAU;AAC9B;AAEA,SAAS,WAAW,KAAqB;CACvC,OAAO,QAAQ,KAAK,WAAW,IAAI,IAAI;AACzC;;;;ACnDA,SAAgB,+BAAuD;CACrE,OAAO;EACL,qBAAqB,SAAS;GAC5B,MAAM,IAAI,MACR,6BAA6B,KAAK,uIACpC;EACF;EACA,iBAAiB,OAAO,OAAO,SAAS;GACtC,kBAAkB,IAAI;GACtB,OAAO;EACT;EACA,OAAO,QAAyB;GAC9B,MAAM,IAAI,MACR,wBAAwB,IAAI,wDAC9B;EACF;EACA,SAAS,YAA2B;GAClC,MAAM,IAAI,MACR,6EACF;EACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;ACdA,MAAa,mBAAmB;AAWhC,IAAM,mBAAN,cAA+B,MAAM;CACnC;CAEA,YAAY,QAA2B;EACrC,IAAI,CAAC,MAAM,QAAQ,MAAM,GACvB,MAAM,IAAI,UAAU,uCAAuC;EAE7D,MAAM,YAAY,OAAO,KAAK,GAAG,MAAM;GACrC,IAAI,OAAO,EAAE,YAAY,UACvB,MAAM,IAAI,UAAU,wBAAwB,EAAE,2BAA2B;GAE3E,IAAI,CAAC,MAAM,QAAQ,EAAE,IAAI,GACvB,MAAM,IAAI,UAAU,wBAAwB,EAAE,wBAAwB;GAExE,OAAO;IAAE,SAAS,EAAE;IAAS,MAAM,EAAE;GAAK;EAC5C,CAAC;EAID,MAAM,iBAAiB,KAAK,UAAU,EAAE,QAAQ,UAAU,CAAC,GAAG;EAC9D,KAAK,OAAO;EACZ,KAAK,SAAS;CAChB;AACF;AAEA,IAAM,yBAAN,cAAqC,MAAM;CACzC,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;AAEA,IAAM,wBAAN,cAAoC,MAAM;CACxC;CACA,AAAS;CAET,YAAY,SAAiB,MAA8B,OAAiB;EAC1E,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,QAAQ;CACf;AACF;AASA,SAAS,oBAA2C;CAClD,OAAO;AACT;;;;;;;AAQA,SAAgB,uBAAuB,QAAiC;CACtE,MAAM,IAAI;CAEV,EAAE,oBAAoB;CAMtB,EAAE,SAAS;EACT,SAAS,EAAE,YAAY,kBAAkB;EACzC,UAAU,6BAA6B;CACzC;CACA,EAAE,WAAW,CAAC;CAEd,EAAE,eAAe;CACjB,EAAE,qBAAqB;CACvB,EAAE,oBAAoB;AACxB;;;;;;AAOA,SAAgB,uBAAuB,QAAiC;CACtE,MAAM,IAAI;CACV,OAAO,EAAE;CACT,OAAO,EAAE;CACT,OAAO,EAAE;CACT,OAAO,EAAE;CACT,OAAO,EAAE;CACT,OAAO,EAAE;AACX"}