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

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 (471) hide show
  1. package/CHANGELOG.md +869 -2
  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-DArFTTJ9.mjs +3 -0
  7. package/dist/{application-DqS1yBg3.mjs → application-miwiXtB4.mjs} +1892 -1968
  8. package/dist/application-miwiXtB4.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 +2 -0
  13. package/dist/cli/cache/store.d.mts +1 -0
  14. package/dist/cli/cache/types.d.mts +1 -0
  15. package/dist/cli/commands/api/api-call.d.mts +19 -0
  16. package/dist/cli/commands/api/index.d.mts +4 -0
  17. package/dist/cli/commands/deploy/aigateway.d.mts +5 -0
  18. package/dist/cli/commands/deploy/application.d.mts +7 -0
  19. package/dist/cli/commands/deploy/apply-phases.d.mts +14 -0
  20. package/dist/cli/commands/deploy/auth.d.mts +5 -0
  21. package/dist/cli/commands/deploy/deploy.d.mts +34 -0
  22. package/dist/cli/commands/deploy/executor.d.mts +7 -0
  23. package/dist/cli/commands/deploy/function-registry-types.d.mts +12 -0
  24. package/dist/cli/commands/deploy/function-registry.d.mts +7 -0
  25. package/dist/cli/commands/deploy/idp.d.mts +5 -0
  26. package/dist/cli/commands/deploy/resolver.d.mts +5 -0
  27. package/dist/cli/commands/deploy/secret-manager.d.mts +5 -0
  28. package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -0
  29. package/dist/cli/commands/deploy/tailordb/index.d.mts +9 -0
  30. package/dist/cli/commands/deploy/types.d.mts +3 -0
  31. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +3 -0
  32. package/dist/cli/commands/deploy/workflow.d.mts +4 -0
  33. package/dist/cli/commands/executor/get.d.mts +28 -0
  34. package/dist/cli/commands/executor/jobs.d.mts +122 -0
  35. package/dist/cli/commands/executor/list.d.mts +18 -0
  36. package/dist/cli/commands/executor/transform.d.mts +42 -0
  37. package/dist/cli/commands/executor/trigger.d.mts +40 -0
  38. package/dist/cli/commands/executor/webhook.d.mts +21 -0
  39. package/dist/cli/commands/function/get.d.mts +17 -0
  40. package/dist/cli/commands/function/list.d.mts +21 -0
  41. package/dist/cli/commands/function/transform.d.mts +12 -0
  42. package/dist/cli/commands/generate/options.d.mts +6 -0
  43. package/dist/cli/commands/generate/seed/bundler.d.mts +26 -0
  44. package/dist/cli/commands/generate/service.d.mts +15 -0
  45. package/dist/cli/commands/machineuser/list.d.mts +26 -0
  46. package/dist/cli/commands/machineuser/token.d.mts +21 -0
  47. package/dist/cli/commands/oauth2client/get.d.mts +17 -0
  48. package/dist/cli/commands/oauth2client/list.d.mts +19 -0
  49. package/dist/cli/commands/oauth2client/transform.d.mts +21 -0
  50. package/dist/cli/commands/organization/folder/create.d.mts +17 -0
  51. package/dist/cli/commands/organization/folder/delete.d.mts +15 -0
  52. package/dist/cli/commands/organization/folder/get.d.mts +16 -0
  53. package/dist/cli/commands/organization/folder/list.d.mts +21 -0
  54. package/dist/cli/commands/organization/folder/update.d.mts +17 -0
  55. package/dist/cli/commands/organization/get.d.mts +15 -0
  56. package/dist/cli/commands/organization/list.d.mts +14 -0
  57. package/dist/cli/commands/organization/transform.d.mts +29 -0
  58. package/dist/cli/commands/organization/tree.d.mts +24 -0
  59. package/dist/cli/commands/organization/update.d.mts +16 -0
  60. package/dist/cli/commands/remove.d.mts +15 -0
  61. package/dist/cli/commands/show.d.mts +39 -0
  62. package/dist/cli/commands/staticwebsite/deploy.d.mts +19 -0
  63. package/dist/cli/commands/tailordb/migrate/bundler.d.mts +29 -0
  64. package/dist/cli/commands/tailordb/migrate/config.d.mts +18 -0
  65. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +246 -0
  66. package/dist/cli/commands/tailordb/migrate/generate.d.mts +16 -0
  67. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +208 -0
  68. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +98 -0
  69. package/dist/cli/commands/tailordb/migrate/types.d.mts +7 -0
  70. package/dist/cli/commands/tailordb/truncate.d.mts +18 -0
  71. package/dist/cli/commands/workflow/executions.d.mts +74 -0
  72. package/dist/cli/commands/workflow/get.d.mts +30 -0
  73. package/dist/cli/commands/workflow/list.d.mts +18 -0
  74. package/dist/cli/commands/workflow/resume.d.mts +22 -0
  75. package/dist/cli/commands/workflow/start.d.mts +60 -0
  76. package/dist/cli/commands/workflow/status.d.mts +6 -0
  77. package/dist/cli/commands/workflow/transform.d.mts +34 -0
  78. package/dist/cli/commands/workflow/wait.d.mts +15 -0
  79. package/dist/cli/commands/workflow/waiter.d.mts +23 -0
  80. package/dist/cli/commands/workspace/app/health.d.mts +17 -0
  81. package/dist/cli/commands/workspace/app/list.d.mts +21 -0
  82. package/dist/cli/commands/workspace/app/transform.d.mts +20 -0
  83. package/dist/cli/commands/workspace/create.d.mts +27 -0
  84. package/dist/cli/commands/workspace/delete.d.mts +14 -0
  85. package/dist/cli/commands/workspace/get.d.mts +16 -0
  86. package/dist/cli/commands/workspace/list.d.mts +17 -0
  87. package/dist/cli/commands/workspace/restore.d.mts +14 -0
  88. package/dist/cli/commands/workspace/transform.d.mts +20 -0
  89. package/dist/cli/commands/workspace/user/invite.d.mts +21 -0
  90. package/dist/cli/commands/workspace/user/list.d.mts +21 -0
  91. package/dist/cli/commands/workspace/user/remove.d.mts +16 -0
  92. package/dist/cli/commands/workspace/user/transform.d.mts +9 -0
  93. package/dist/cli/commands/workspace/user/update.d.mts +21 -0
  94. package/dist/cli/index.mjs +12 -5481
  95. package/dist/cli/lib.d.mts +90 -21048
  96. package/dist/cli/lib.mjs +154 -12
  97. package/dist/cli/lib.mjs.map +1 -1
  98. package/dist/cli/main.d.mts +23 -0
  99. package/dist/cli/main.mjs +6583 -0
  100. package/dist/cli/main.mjs.map +1 -0
  101. package/dist/cli/query/index.d.mts +38 -0
  102. package/dist/cli/services/application.d.mts +12 -0
  103. package/dist/cli/services/auth/service.d.mts +3 -0
  104. package/dist/cli/services/executor/service.d.mts +1 -0
  105. package/dist/cli/services/http-adapter/bundler.d.mts +3 -0
  106. package/dist/cli/services/http-adapter/service.d.mts +2 -0
  107. package/dist/cli/services/resolver/service.d.mts +1 -0
  108. package/dist/cli/services/tailordb/service.d.mts +3 -0
  109. package/dist/cli/services/workflow/bundler.d.mts +2 -0
  110. package/dist/cli/services/workflow/service.d.mts +1 -0
  111. package/dist/cli/shared/args.d.mts +13 -0
  112. package/dist/cli/shared/client.d.mts +1273 -0
  113. package/dist/cli/shared/config-loader.d.mts +25 -0
  114. package/dist/cli/shared/context.d.mts +29 -0
  115. package/dist/cli/shared/error-json.d.mts +23 -0
  116. package/dist/cli/shared/readonly-guard.d.mts +25 -0
  117. package/dist/cli/shared/script-executor.d.mts +77 -0
  118. package/dist/cli/shared/seed-chunker.d.mts +45 -0
  119. package/dist/cli/shared/seed-context.d.mts +49 -0
  120. package/dist/cli/shared/tailordb-namespaces.d.mts +40 -0
  121. package/dist/cli/shared/type-generator.d.mts +19 -0
  122. package/dist/cli/shared/workspace-name.d.mts +1 -0
  123. package/dist/cli/ts-hook.d.mts +4 -0
  124. package/dist/cli/ts-hook.mjs +333 -0
  125. package/dist/completion/zsh-worker.zsh +1433 -1239
  126. package/dist/configure/config/index.d.mts +20 -0
  127. package/dist/configure/config/types.d.mts +111 -0
  128. package/dist/configure/index.d.mts +135 -8
  129. package/dist/configure/index.mjs +390 -36
  130. package/dist/configure/index.mjs.map +1 -1
  131. package/dist/configure/services/aigateway/index.d.mts +16 -0
  132. package/dist/configure/services/aigateway/types.d.mts +10 -0
  133. package/dist/configure/services/auth/index.d.mts +33 -0
  134. package/dist/configure/services/auth/types.d.mts +168 -0
  135. package/dist/configure/services/executor/executor.d.mts +70 -0
  136. package/dist/configure/services/executor/index.d.mts +9 -0
  137. package/dist/configure/services/executor/operation.d.mts +50 -0
  138. package/dist/configure/services/executor/trigger/event.d.mts +271 -0
  139. package/dist/configure/services/executor/trigger/index.d.mts +7 -0
  140. package/dist/configure/services/executor/trigger/schedule.d.mts +24 -0
  141. package/dist/configure/services/executor/trigger/webhook.d.mts +43 -0
  142. package/dist/configure/services/executor/types.d.mts +2 -0
  143. package/dist/configure/services/http-adapter/http-adapter.d.mts +124 -0
  144. package/dist/configure/services/http-adapter/index.d.mts +2 -0
  145. package/dist/configure/services/idp/index.d.mts +60 -0
  146. package/dist/configure/services/idp/permission.d.mts +64 -0
  147. package/dist/configure/services/idp/types.d.mts +23 -0
  148. package/dist/configure/services/index.d.mts +40 -0
  149. package/dist/configure/services/resolver/index.d.mts +6 -0
  150. package/dist/configure/services/resolver/permission.d.mts +64 -0
  151. package/dist/configure/services/resolver/resolver.d.mts +88 -0
  152. package/dist/configure/services/resolver/types.d.mts +5 -0
  153. package/dist/configure/services/secrets/index.d.mts +37 -0
  154. package/dist/configure/services/secrets/types.d.mts +10 -0
  155. package/dist/configure/services/staticwebsite/index.d.mts +18 -0
  156. package/dist/configure/services/staticwebsite/types.d.mts +10 -0
  157. package/dist/configure/services/tailordb/index.d.mts +4 -0
  158. package/dist/configure/services/tailordb/permission.d.mts +103 -0
  159. package/dist/configure/services/tailordb/schema.d.mts +486 -0
  160. package/dist/configure/services/tailordb/types.d.mts +198 -0
  161. package/dist/configure/services/workflow/execution-policy.d.mts +70 -0
  162. package/dist/configure/services/workflow/execution-policy.types.d.mts +103 -0
  163. package/dist/configure/services/workflow/index.d.mts +9 -0
  164. package/dist/configure/services/workflow/job.d.mts +83 -0
  165. package/dist/configure/services/workflow/types.d.mts +2 -0
  166. package/dist/configure/services/workflow/wait-point.d.mts +72 -0
  167. package/dist/configure/services/workflow/workflow.d.mts +56 -0
  168. package/dist/configure/types/aigateway-name.d.mts +12 -0
  169. package/dist/configure/types/connection-name.d.mts +12 -0
  170. package/dist/configure/types/field.d.mts +8 -0
  171. package/dist/configure/types/field.types.d.mts +70 -0
  172. package/dist/configure/types/idp-name.d.mts +12 -0
  173. package/dist/configure/types/index.d.mts +5 -0
  174. package/dist/configure/types/machine-user.d.mts +2 -0
  175. package/dist/configure/types/permission-operand.types.d.mts +20 -0
  176. package/dist/configure/types/type.d.mts +73 -0
  177. package/dist/{context-Bd266-ru.mjs → context-DYQVYWqZ.mjs} +4 -5
  178. package/dist/context-DYQVYWqZ.mjs.map +1 -0
  179. package/dist/{crashreport-BsjAkFWw.mjs → crashreport-B5LqCTfF.mjs} +10 -11
  180. package/dist/{crashreport-BsjAkFWw.mjs.map → crashreport-B5LqCTfF.mjs.map} +1 -1
  181. package/dist/{crashreport-pr6Rhvza.mjs → crashreport-eI7ty7ok.mjs} +1 -1
  182. package/dist/enum-constants-j9QBF0cB.mjs.map +1 -1
  183. package/dist/{errors-Dtf2WPaW.mjs → errors-D7583Zz7.mjs} +18 -2
  184. package/dist/errors-D7583Zz7.mjs.map +1 -0
  185. package/dist/{file-_oUZo76X.mjs → file-BUcmVIH2.mjs} +12 -22
  186. package/dist/file-BUcmVIH2.mjs.map +1 -0
  187. package/dist/{file-utils-DcyIPFQh.mjs → file-utils-yEiIS4nJ.mjs} +6 -6
  188. package/dist/file-utils-yEiIS4nJ.mjs.map +1 -0
  189. package/dist/{globals-Crz8o65k.mjs → globals-DQotNuwK.mjs} +33 -55
  190. package/dist/globals-DQotNuwK.mjs.map +1 -0
  191. package/dist/iconv-QWaZh0TT.mjs +38 -0
  192. package/dist/iconv-QWaZh0TT.mjs.map +1 -0
  193. package/dist/{idp-BDbK5gjm.mjs → idp-RA_swu-h.mjs} +12 -5
  194. package/dist/idp-RA_swu-h.mjs.map +1 -0
  195. package/dist/{interceptor-D-q1rvRl.mjs → interceptor-e33JtsC-.mjs} +2 -2
  196. package/dist/interceptor-e33JtsC-.mjs.map +1 -0
  197. package/dist/kysely/index.d.mts +5 -7
  198. package/dist/{kysely-type-DR8uzZTA.mjs → kysely-type-DqIRgDYR.mjs} +5 -4
  199. package/dist/kysely-type-DqIRgDYR.mjs.map +1 -0
  200. package/dist/logger-BtX0suGY.mjs +48 -0
  201. package/dist/logger-BtX0suGY.mjs.map +1 -0
  202. package/dist/logger-CXQq9YIp.mjs +317 -0
  203. package/dist/logger-CXQq9YIp.mjs.map +1 -0
  204. package/dist/parser/service/auth/index.d.mts +1 -0
  205. package/dist/parser/service/auth/schema.d.mts +3 -0
  206. package/dist/parser/service/http-adapter/index.d.mts +1 -0
  207. package/dist/parser/service/http-adapter/schema.d.mts +1 -0
  208. package/dist/parser/service/idp/types.d.mts +5 -0
  209. package/dist/parser/service/tailordb/type-source.d.mts +10 -0
  210. package/dist/parser/service/tailordb/types.d.mts +131 -0
  211. package/dist/platform-serialize-RoRtBS0v.mjs +46 -0
  212. package/dist/platform-serialize-RoRtBS0v.mjs.map +1 -0
  213. package/dist/plugin/builtin/enum-constants/index.d.mts +15 -1
  214. package/dist/plugin/builtin/file-utils/index.d.mts +15 -1
  215. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  216. package/dist/plugin/builtin/kysely-type/index.d.mts +15 -1
  217. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  218. package/dist/plugin/builtin/seed/index.d.mts +46 -2
  219. package/dist/plugin/builtin/seed/index.mjs +1 -1
  220. package/dist/plugin/builtin/seed/seed-type-processor.d.mts +19 -0
  221. package/dist/plugin/builtin/seed/types.d.mts +2 -0
  222. package/dist/plugin/get-generated-type.d.mts +16 -0
  223. package/dist/plugin/index.d.mts +3 -117
  224. package/dist/plugin/index.mjs +1 -1
  225. package/dist/plugin/index.mjs.map +1 -1
  226. package/dist/plugin/manager.d.mts +2 -0
  227. package/dist/plugin/types.d.mts +242 -0
  228. package/dist/plugin/with-context.d.mts +101 -0
  229. package/dist/{runtime-n9NCkjee.mjs → register-ts-hook-BAHMwxfG.mjs} +7812 -4094
  230. package/dist/register-ts-hook-BAHMwxfG.mjs.map +1 -0
  231. package/dist/{registry-DdsYlL_P.mjs → registry-BIGVUrMB.mjs} +12 -9
  232. package/dist/registry-BIGVUrMB.mjs.map +1 -0
  233. package/dist/{repl-editor-DmGr9zMw.mjs → repl-editor-BCozyiNq.mjs} +6 -5
  234. package/dist/{repl-editor-DmGr9zMw.mjs.map → repl-editor-BCozyiNq.mjs.map} +1 -1
  235. package/dist/runtime/aigateway.d.mts +25 -0
  236. package/dist/runtime/aigateway.mjs +3 -0
  237. package/dist/runtime/authconnection.d.mts +21 -2
  238. package/dist/runtime/authconnection.mjs +2 -2
  239. package/dist/runtime/context.d.mts +54 -2
  240. package/dist/runtime/context.mjs +2 -2
  241. package/dist/runtime/field-parse.d.mts +10 -0
  242. package/dist/runtime/file.d.mts +170 -2
  243. package/dist/runtime/file.mjs +2 -2
  244. package/dist/runtime/globals.d.mts +38 -20
  245. package/dist/runtime/iconv.d.mts +73 -2
  246. package/dist/runtime/iconv.mjs +2 -2
  247. package/dist/runtime/idp.d.mts +129 -2
  248. package/dist/runtime/idp.mjs +2 -2
  249. package/dist/runtime/index.d.mts +48 -9
  250. package/dist/runtime/index.mjs +10 -8
  251. package/dist/runtime/logger.d.mts +98 -0
  252. package/dist/runtime/logger.mjs +3 -0
  253. package/dist/runtime/secretmanager.d.mts +41 -2
  254. package/dist/runtime/secretmanager.mjs +2 -2
  255. package/dist/runtime/types.d.mts +25 -0
  256. package/dist/runtime/workflow.d.mts +124 -2
  257. package/dist/runtime/workflow.mjs +2 -2
  258. package/dist/{schema-BhkpP5Hw.mjs → schema--xYWRGfe.mjs} +288 -229
  259. package/dist/schema--xYWRGfe.mjs.map +1 -0
  260. package/dist/{secret-file-DBqZhjFQ.mjs → secret-file-C3J4Gy8r.mjs} +2 -2
  261. package/dist/{secret-file-DBqZhjFQ.mjs.map → secret-file-C3J4Gy8r.mjs.map} +1 -1
  262. package/dist/secretmanager-CYlpffsz.mjs +13 -0
  263. package/dist/secretmanager-CYlpffsz.mjs.map +1 -0
  264. package/dist/secretmanager-IY4UvinW.mjs +131 -0
  265. package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
  266. package/dist/seed/index.d.mts +4 -4
  267. package/dist/seed-LUVr7jHL.mjs +444 -0
  268. package/dist/seed-LUVr7jHL.mjs.map +1 -0
  269. package/dist/{service-DU1mVzri.mjs → service-B5WynBHQ.mjs} +3 -3
  270. package/dist/{service-DU1mVzri.mjs.map → service-B5WynBHQ.mjs.map} +1 -1
  271. package/dist/service-BNtPsK9Q.mjs +837 -0
  272. package/dist/service-BNtPsK9Q.mjs.map +1 -0
  273. package/dist/service-D5jn05ZI.mjs +3 -0
  274. package/dist/service_pb-BwZRiNug.mjs +167 -0
  275. package/dist/service_pb-BwZRiNug.mjs.map +1 -0
  276. package/dist/service_pb-wRkxUta6.mjs +3 -0
  277. package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +203 -0
  278. package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +57 -0
  279. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +315 -0
  280. package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +160 -0
  281. package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +2069 -0
  282. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +865 -0
  283. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +111 -0
  284. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +68 -0
  285. package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +438 -0
  286. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +563 -0
  287. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +144 -0
  288. package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +450 -0
  289. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +191 -0
  290. package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +49 -0
  291. package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +406 -0
  292. package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +429 -0
  293. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +72 -0
  294. package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +16 -0
  295. package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +308 -0
  296. package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +590 -0
  297. package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +329 -0
  298. package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +112 -0
  299. package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +345 -0
  300. package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +53 -0
  301. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +3575 -0
  302. package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +186 -0
  303. package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +28 -0
  304. package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +428 -0
  305. package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +89 -0
  306. package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +683 -0
  307. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +796 -0
  308. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +329 -0
  309. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +182 -0
  310. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +861 -0
  311. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +309 -0
  312. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +2014 -0
  313. package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +482 -0
  314. package/dist/{telemetry-CdqJEzkj.mjs → telemetry-BRVdwh14.mjs} +3 -3
  315. package/dist/telemetry-BRVdwh14.mjs.map +1 -0
  316. package/dist/telemetry-CkbkeJxl.mjs +3 -0
  317. package/dist/test-env-key-D7UkZp99.mjs +75 -0
  318. package/dist/test-env-key-D7UkZp99.mjs.map +1 -0
  319. package/dist/types/aigateway.generated.d.mts +12 -0
  320. package/dist/types/app-config.generated.d.mts +4 -0
  321. package/dist/types/auth-connection.generated.d.mts +33 -0
  322. package/dist/types/auth.generated.d.mts +188 -0
  323. package/dist/types/executor.generated.d.mts +209 -0
  324. package/dist/types/helpers.d.mts +40 -0
  325. package/dist/types/http-adapter.generated.d.mts +28 -0
  326. package/dist/types/idp.generated.d.mts +626 -0
  327. package/dist/types/resolver.generated.d.mts +82 -0
  328. package/dist/types/secrets.generated.d.mts +14 -0
  329. package/dist/types/staticwebsite.generated.d.mts +14 -0
  330. package/dist/types/tailordb.generated.d.mts +468 -0
  331. package/dist/types/workflow.generated.d.mts +17 -0
  332. package/dist/user-agent-Bgsszb5I.mjs +28 -0
  333. package/dist/user-agent-Bgsszb5I.mjs.map +1 -0
  334. package/dist/utils/test/index.d.mts +6 -100
  335. package/dist/utils/test/index.mjs +60 -39
  336. package/dist/utils/test/index.mjs.map +1 -1
  337. package/dist/utils/test/mock.d.mts +86 -0
  338. package/dist/vitest/environment.d.mts +1 -2
  339. package/dist/vitest/environment.mjs +2 -2
  340. package/dist/vitest/environment.mjs.map +1 -1
  341. package/dist/vitest/index.d.mts +15 -429
  342. package/dist/vitest/index.mjs +1240 -31
  343. package/dist/vitest/index.mjs.map +1 -1
  344. package/dist/vitest/mock-kysely.d.mts +61 -0
  345. package/dist/vitest/mock.d.mts +10 -0
  346. package/dist/vitest/mocks/aigateway.d.mts +40 -0
  347. package/dist/vitest/mocks/authconnection.d.mts +38 -0
  348. package/dist/vitest/mocks/file.d.mts +58 -0
  349. package/dist/vitest/mocks/iconv.d.mts +51 -0
  350. package/dist/vitest/mocks/idp.d.mts +60 -0
  351. package/dist/vitest/mocks/logger.d.mts +45 -0
  352. package/dist/vitest/mocks/secretmanager.d.mts +44 -0
  353. package/dist/vitest/mocks/tailordb.d.mts +115 -0
  354. package/dist/vitest/mocks/workflow.d.mts +157 -0
  355. package/dist/vitest/setup.d.mts +1 -2
  356. package/dist/vitest/setup.mjs +2 -2
  357. package/dist/vitest/workflow-local.d.mts +41 -0
  358. package/dist/workflow-CsaQ9qK-.mjs +42 -0
  359. package/dist/workflow-CsaQ9qK-.mjs.map +1 -0
  360. package/dist/{client-z_oHGVNy.mjs → workspace_resource_pb-UGK1SSn_.mjs} +55 -619
  361. package/dist/workspace_resource_pb-UGK1SSn_.mjs.map +1 -0
  362. package/docs/cli/application.md +150 -250
  363. package/docs/cli/auth.md +51 -295
  364. package/docs/cli/completion.md +1 -25
  365. package/docs/cli/crashreport.md +3 -61
  366. package/docs/cli/executor.md +72 -183
  367. package/docs/cli/function.md +16 -132
  368. package/docs/cli/organization.md +11 -221
  369. package/docs/cli/plugin.md +29 -0
  370. package/docs/cli/query.md +2 -22
  371. package/docs/cli/secret.md +71 -251
  372. package/docs/cli/setup.md +138 -40
  373. package/docs/cli/skills.md +50 -39
  374. package/docs/cli/staticwebsite.md +32 -180
  375. package/docs/cli/tailordb.md +71 -427
  376. package/docs/cli/upgrade.md +2 -22
  377. package/docs/cli/user.md +78 -247
  378. package/docs/cli/workflow.md +150 -172
  379. package/docs/cli/workspace.md +167 -538
  380. package/docs/cli-reference.md +213 -96
  381. package/docs/configuration.md +40 -6
  382. package/docs/github-actions.md +72 -24
  383. package/docs/migration/v2.md +1316 -0
  384. package/docs/multi-environment.md +29 -7
  385. package/docs/plugin/custom.md +4 -4
  386. package/docs/plugin/index.md +8 -8
  387. package/docs/quickstart.md +8 -7
  388. package/docs/runtime.md +18 -9
  389. package/docs/services/aigateway.md +20 -2
  390. package/docs/services/auth.md +51 -59
  391. package/docs/services/executor.md +8 -3
  392. package/docs/services/http-adapter.md +16 -1
  393. package/docs/services/idp.md +55 -2
  394. package/docs/services/resolver.md +62 -8
  395. package/docs/services/secret.md +11 -11
  396. package/docs/services/staticwebsite.md +8 -2
  397. package/docs/services/tailordb-migration.md +43 -28
  398. package/docs/services/tailordb.md +200 -99
  399. package/docs/services/workflow.md +133 -55
  400. package/docs/testing.md +244 -143
  401. package/package.json +59 -46
  402. package/postinstall.mjs +4 -6
  403. package/dist/application-DB2r36Et.mjs +0 -3
  404. package/dist/application-DqS1yBg3.mjs.map +0 -1
  405. package/dist/authconnection-D2MhtTN5.mjs +0 -15
  406. package/dist/authconnection-D2MhtTN5.mjs.map +0 -1
  407. package/dist/authconnection-DvUQAjQS.d.mts +0 -39
  408. package/dist/cli/erd-viewer-assets/app.js +0 -1181
  409. package/dist/cli/erd-viewer-assets/index.html +0 -73
  410. package/dist/cli/erd-viewer-assets/serve.json +0 -13
  411. package/dist/cli/erd-viewer-assets/styles.css +0 -789
  412. package/dist/cli/index.d.mts +0 -5
  413. package/dist/cli/index.mjs.map +0 -1
  414. package/dist/client-Dbohmtkv.mjs +0 -3
  415. package/dist/client-z_oHGVNy.mjs.map +0 -1
  416. package/dist/context-Bd266-ru.mjs.map +0 -1
  417. package/dist/context-BuuIb8CC.d.mts +0 -68
  418. package/dist/errors-Dtf2WPaW.mjs.map +0 -1
  419. package/dist/field-DOsJCPFa.mjs +0 -22
  420. package/dist/field-DOsJCPFa.mjs.map +0 -1
  421. package/dist/file-BB8Vs9O_.d.mts +0 -250
  422. package/dist/file-_oUZo76X.mjs.map +0 -1
  423. package/dist/file-utils-DcyIPFQh.mjs.map +0 -1
  424. package/dist/globals-Crz8o65k.mjs.map +0 -1
  425. package/dist/http-adapter.generated-WgMnb7Sb.d.mts +0 -580
  426. package/dist/iconv-Co-TOPuH.d.mts +0 -122
  427. package/dist/iconv-D2vi8G36.mjs +0 -63
  428. package/dist/iconv-D2vi8G36.mjs.map +0 -1
  429. package/dist/idp-BDbK5gjm.mjs.map +0 -1
  430. package/dist/idp-DrhVrLmV.d.mts +0 -160
  431. package/dist/index-5vPyRu1y.d.mts +0 -18
  432. package/dist/index-B7AKc18V.d.mts +0 -47
  433. package/dist/index-BlpzXncY.d.mts +0 -1016
  434. package/dist/index-CK7u9isy.d.mts +0 -46
  435. package/dist/index-CNYe5lnW.d.mts +0 -18
  436. package/dist/index-DjUdWlzf.d.mts +0 -18
  437. package/dist/index-ZePLwxw7.d.mts +0 -208
  438. package/dist/interceptor-D-q1rvRl.mjs.map +0 -1
  439. package/dist/job-fuc3j1Ma.mjs +0 -53
  440. package/dist/job-fuc3j1Ma.mjs.map +0 -1
  441. package/dist/kysely-type-DR8uzZTA.mjs.map +0 -1
  442. package/dist/logger-CxF-Ex5d.mjs +0 -220
  443. package/dist/logger-CxF-Ex5d.mjs.map +0 -1
  444. package/dist/mock-BjFj5o1I.mjs +0 -804
  445. package/dist/mock-BjFj5o1I.mjs.map +0 -1
  446. package/dist/registry-DdsYlL_P.mjs.map +0 -1
  447. package/dist/rolldown-runtime-DXywRVcq.mjs +0 -20
  448. package/dist/runtime-n9NCkjee.mjs.map +0 -1
  449. package/dist/schema-BhkpP5Hw.mjs.map +0 -1
  450. package/dist/secretmanager-B3n4KHfm.d.mts +0 -55
  451. package/dist/secretmanager-BVxw3ih_.mjs +0 -24
  452. package/dist/secretmanager-BVxw3ih_.mjs.map +0 -1
  453. package/dist/seed-jf3008-h.mjs +0 -1160
  454. package/dist/seed-jf3008-h.mjs.map +0 -1
  455. package/dist/service-CCL8ruDf.mjs +0 -459
  456. package/dist/service-CCL8ruDf.mjs.map +0 -1
  457. package/dist/service-D6yonf2I.mjs +0 -3
  458. package/dist/telemetry-CdqJEzkj.mjs.map +0 -1
  459. package/dist/telemetry-ClwW5ohF.mjs +0 -3
  460. package/dist/test-env-key-D9kM6ETE.mjs +0 -49
  461. package/dist/test-env-key-D9kM6ETE.mjs.map +0 -1
  462. package/dist/types-B2RpYyA_.mjs +0 -371
  463. package/dist/types-B2RpYyA_.mjs.map +0 -1
  464. package/dist/types-ClhIrW_C.mjs +0 -4
  465. package/dist/types-DCUhgpyI.d.mts +0 -784
  466. package/dist/types-DhO_VEZd.d.mts +0 -574
  467. package/dist/types-DwDgacni.d.mts +0 -338
  468. package/dist/workflow-BbKvGLQg.d.mts +0 -96
  469. package/dist/workflow-DgemCAz3.mjs +0 -38
  470. package/dist/workflow-DgemCAz3.mjs.map +0 -1
  471. package/dist/workflow.generated-DtQwEo-x.d.mts +0 -671
@@ -12,9 +12,9 @@ function jobs() {
12
12
  /**
13
13
  * Register a job body keyed by job name. Called as a side effect by
14
14
  * `createWorkflowJob` so `runWorkflowLocally()` can execute dependent job
15
- * bodies when `globalThis.tailor.workflow.triggerJobFunction(name, args)` is invoked.
15
+ * bodies when `globalThis.tailor.workflow.execJobFunction(name, args)` is invoked.
16
16
  *
17
- * In production builds the bundler rewrites `.trigger()` calls so this registry
17
+ * In production builds the bundler rewrites `.start()` calls so this registry
18
18
  * is never read; the gated write is dropped as dead code.
19
19
  * @param name - Job name
20
20
  * @param body - Job body function
@@ -38,14 +38,17 @@ function requirePlatformWorkflow() {
38
38
  if (!workflow) throw new Error("tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment and use mockWorkflow(), or use runWorkflowLocally() from @tailor-platform/sdk/vitest for local workflow execution.");
39
39
  return workflow;
40
40
  }
41
- const TRIGGER_DEFAULT = "00000000-0000-4000-8000-000000000000";
42
- function dispatchTriggerJob(name, args) {
43
- return requirePlatformWorkflow().triggerJobFunction(name, args);
41
+ const START_DEFAULT = "00000000-0000-4000-8000-000000000000";
42
+ function dispatchStartJob(name, args, options) {
43
+ const workflow = requirePlatformWorkflow();
44
+ return arguments.length >= 3 ? workflow.execJobFunction(name, args, options) : workflow.execJobFunction(name, args);
44
45
  }
45
- function dispatchTriggerWorkflow(name, args, options) {
46
- return requirePlatformWorkflow().triggerWorkflow(name, args, options);
46
+ function dispatchStartWorkflow(name, args, options) {
47
+ const workflow = requirePlatformWorkflow();
48
+ if (arguments.length < 3) return workflow.startWorkflow(name, args);
49
+ return workflow.startWorkflow(name, args, options?.invoker === void 0 ? options : { authInvoker: options.invoker });
47
50
  }
48
51
 
49
52
  //#endregion
50
- export { registerJob as a, getRegisteredJob as i, dispatchTriggerJob as n, dispatchTriggerWorkflow as r, TRIGGER_DEFAULT as t };
51
- //# sourceMappingURL=registry-DdsYlL_P.mjs.map
53
+ export { registerJob as a, getRegisteredJob as i, dispatchStartJob as n, dispatchStartWorkflow as r, START_DEFAULT as t };
54
+ //# sourceMappingURL=registry-BIGVUrMB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-BIGVUrMB.mjs","names":[],"sources":["../src/configure/services/workflow/registry.ts"],"sourcesContent":["import type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type { ExecJobFunctionOptions, StartWorkflowOptions } from \"#/runtime/workflow\";\n\n/**\n * Body signature shared by workflow jobs at registry-write time.\n * The user's `createWorkflowJob`/`createWorkflow` body uses concrete types,\n * but the registry erases them for storage.\n */\nexport type RegisteredJobBody = (\n args: unknown,\n context: { env: TailorEnv; invoker: TailorPrincipal | null },\n) => unknown | Promise<unknown>;\n\nconst JOB_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:job-registry\");\n\ntype PlatformWorkflow = {\n startWorkflow: (name: string, args?: unknown, options?: StartWorkflowOptions) => Promise<string>;\n execJobFunction: (name: string, args?: unknown, options?: ExecJobFunctionOptions) => unknown;\n startJobFunction: (name: string, args?: unknown, options?: ExecJobFunctionOptions) => unknown;\n};\n\ntype GlobalWithRegistry = typeof globalThis & {\n [JOB_REGISTRY_KEY]?: Map<string, RegisteredJobBody>;\n tailor?: { workflow?: PlatformWorkflow };\n};\n\nfunction jobs(): Map<string, RegisteredJobBody> {\n const g = globalThis as GlobalWithRegistry;\n let map = g[JOB_REGISTRY_KEY];\n if (!map) {\n map = new Map();\n g[JOB_REGISTRY_KEY] = map;\n }\n return map;\n}\n\n/**\n * Register a job body keyed by job name. Called as a side effect by\n * `createWorkflowJob` so `runWorkflowLocally()` can execute dependent job\n * bodies when `globalThis.tailor.workflow.execJobFunction(name, args)` is invoked.\n *\n * In production builds the bundler rewrites `.start()` calls so this registry\n * is never read; the gated write is dropped as dead code.\n * @param name - Job name\n * @param body - Job body function\n */\nexport function registerJob(name: string, body: RegisteredJobBody): void {\n jobs().set(name, body);\n}\n\n/**\n * Look up a registered job body by name.\n * @param name - Job name\n * @returns The registered body, or undefined when no job is registered\n */\nexport function getRegisteredJob(name: string): RegisteredJobBody | undefined {\n return jobs().get(name);\n}\n\nfunction currentPlatformWorkflow(): PlatformWorkflow | undefined {\n // globalThis may not have the tailor property at runtime\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n return (globalThis as GlobalWithRegistry).tailor?.workflow;\n}\n\nfunction requirePlatformWorkflow(): PlatformWorkflow {\n const workflow = currentPlatformWorkflow();\n if (!workflow) {\n throw new Error(\n \"tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment and use mockWorkflow(), or use runWorkflowLocally() from @tailor-platform/sdk/vitest for local workflow execution.\",\n );\n }\n return workflow;\n}\n\n// A valid placeholder UUID, so callers that validate the execution id behave the\n// same locally as against the platform.\nexport const START_DEFAULT = \"00000000-0000-4000-8000-000000000000\";\n\n// `.start()` routes through the installed `tailor.workflow` shim. Local body\n// execution is intentionally available only through `runWorkflowLocally()`.\n// Preserve arity: the shim sees a 2-argument call when the caller supplied no\n// options, and a 3-argument call otherwise, mirroring the bundler rewrite so\n// mocks observe the same shape in local execution and in bundled workflows.\nexport function dispatchStartJob(\n name: string,\n args?: unknown,\n options?: ExecJobFunctionOptions,\n): unknown {\n const workflow = requirePlatformWorkflow();\n // oxlint-disable-next-line prefer-rest-params\n return arguments.length >= 3\n ? workflow.execJobFunction(name, args, options)\n : workflow.execJobFunction(name, args);\n}\n\n// Accepts `unknown` because the SDK-side `.start()` accepts a wider options\n// shape than the platform surface (e.g. `authInvoker` may be a machine-user\n// name string that the bundler normalizes at build time). Local execution\n// forwards the value verbatim; only the bundled path enforces the platform\n// contract.\nexport function dispatchStartWorkflow(\n name: string,\n args?: unknown,\n options?: { invoker?: unknown },\n): Promise<string> {\n const workflow = requirePlatformWorkflow();\n // oxlint-disable-next-line prefer-rest-params\n if (arguments.length < 3) {\n return workflow.startWorkflow(name, args);\n }\n return workflow.startWorkflow(\n name,\n args,\n options?.invoker === undefined\n ? (options as StartWorkflowOptions | undefined)\n : ({ authInvoker: options.invoker } as StartWorkflowOptions),\n );\n}\n"],"mappings":";AAaA,MAAM,mBAAkC,OAAO,IAAI,kCAAkC;AAarF,SAAS,OAAuC;CAC9C,MAAM,IAAI;CACV,IAAI,MAAM,EAAE;CACZ,IAAI,CAAC,KAAK;EACR,sBAAM,IAAI,IAAI;EACd,EAAE,oBAAoB;CACxB;CACA,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,YAAY,MAAc,MAA+B;CACvE,KAAK,CAAC,CAAC,IAAI,MAAM,IAAI;AACvB;;;;;;AAOA,SAAgB,iBAAiB,MAA6C;CAC5E,OAAO,KAAK,CAAC,CAAC,IAAI,IAAI;AACxB;AAEA,SAAS,0BAAwD;CAG/D,OAAQ,WAAkC,QAAQ;AACpD;AAEA,SAAS,0BAA4C;CACnD,MAAM,WAAW,wBAAwB;CACzC,IAAI,CAAC,UACH,MAAM,IAAI,MACR,2MACF;CAEF,OAAO;AACT;AAIA,MAAa,gBAAgB;AAO7B,SAAgB,iBACd,MACA,MACA,SACS;CACT,MAAM,WAAW,wBAAwB;CAEzC,OAAO,UAAU,UAAU,IACvB,SAAS,gBAAgB,MAAM,MAAM,OAAO,IAC5C,SAAS,gBAAgB,MAAM,IAAI;AACzC;AAOA,SAAgB,sBACd,MACA,MACA,SACiB;CACjB,MAAM,WAAW,wBAAwB;CAEzC,IAAI,UAAU,SAAS,GACrB,OAAO,SAAS,cAAc,MAAM,IAAI;CAE1C,OAAO,SAAS,cACd,MACA,MACA,SAAS,YAAY,SAChB,UACA,EAAE,aAAa,QAAQ,QAAQ,CACtC;AACF"}
@@ -39,7 +39,7 @@ function highlightSqlLine(line) {
39
39
  }
40
40
  return result;
41
41
  }
42
- const GQL_KEYWORDS = new Set([
42
+ const GQL_KEYWORDS = /* @__PURE__ */ new Set([
43
43
  "query",
44
44
  "mutation",
45
45
  "subscription",
@@ -56,13 +56,13 @@ const GQL_KEYWORDS = new Set([
56
56
  "directive",
57
57
  "implements"
58
58
  ]);
59
- const GQL_DEF_KEYWORDS = new Set([
59
+ const GQL_DEF_KEYWORDS = /* @__PURE__ */ new Set([
60
60
  "query",
61
61
  "mutation",
62
62
  "subscription",
63
63
  "fragment"
64
64
  ]);
65
- const GQL_BUILTINS = new Set([
65
+ const GQL_BUILTINS = /* @__PURE__ */ new Set([
66
66
  "true",
67
67
  "false",
68
68
  "null"
@@ -229,7 +229,8 @@ function replTransform(state, event) {
229
229
  };
230
230
  }
231
231
  if (endsWithOpen) {
232
- const closeChar = BRACKET_PAIRS[prevLine.trimEnd().slice(-1)] ?? "}";
232
+ const openChar = prevLine.trimEnd().slice(-1);
233
+ const closeChar = BRACKET_PAIRS[openChar] ?? "}";
233
234
  const indent = baseIndent + " ";
234
235
  return {
235
236
  lines: lines.with(row, indent + currentLine).toSpliced(row + 1, 0, baseIndent + closeChar),
@@ -247,4 +248,4 @@ function replTransform(state, event) {
247
248
 
248
249
  //#endregion
249
250
  export { highlightGraphqlLine, highlightSqlLine, replTransform };
250
- //# sourceMappingURL=repl-editor-DmGr9zMw.mjs.map
251
+ //# sourceMappingURL=repl-editor-BCozyiNq.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"repl-editor-DmGr9zMw.mjs","names":[],"sources":["../src/cli/query/repl-editor.ts"],"sourcesContent":["import { GraphQLError, Lexer, Source, TokenKind } from \"graphql\";\nimport { getSegments } from \"sql-highlight\";\nimport { assertDefined } from \"@/utils/assert\";\nimport type { TransformEvent, TransformState } from \"@toiroakr/read-multiline\";\n\n// ANSI colour sequences. Kept inline (rather than going through `node:util`\n// styleText) so that tests running outside a TTY still produce deterministic\n// escape sequences regardless of detected colour support.\nconst RESET = \"\\x1b[0m\";\nconst BLUE = \"\\x1b[34m\";\nconst MAGENTA = \"\\x1b[35m\";\nconst YELLOW = \"\\x1b[33m\";\nconst BRIGHT_GREEN = \"\\x1b[92m\";\nconst CYAN = \"\\x1b[36m\";\nconst BRIGHT_BLUE = \"\\x1b[94m\";\nconst BOLD_CYAN = \"\\x1b[1;36m\";\nconst BOLD_MAGENTA = \"\\x1b[1;35m\";\nconst ITALIC_YELLOW = \"\\x1b[3;33m\";\nconst GREEN = \"\\x1b[32m\";\nconst DIM = \"\\x1b[90m\";\nconst DIM_YELLOW = \"\\x1b[2;33m\";\n\nconst SQL_STYLE_MAP: Record<string, string> = {\n keyword: BLUE,\n function: MAGENTA,\n identifier: YELLOW,\n string: BRIGHT_GREEN,\n number: CYAN,\n bracket: DIM_YELLOW,\n special: DIM,\n};\n\n/**\n * Highlight a single SQL line using the `sql-highlight` tokenizer.\n * @param line - SQL text for a single editor line\n * @returns ANSI-decorated line safe for terminal output\n */\nexport function highlightSqlLine(line: string): string {\n const segments = getSegments(line);\n let result = \"\";\n for (const seg of segments) {\n const style = SQL_STYLE_MAP[seg.name];\n result += style ? style + seg.content + RESET : seg.content;\n }\n return result;\n}\n\nconst GQL_KEYWORDS = new Set([\n \"query\",\n \"mutation\",\n \"subscription\",\n \"fragment\",\n \"on\",\n \"type\",\n \"input\",\n \"enum\",\n \"interface\",\n \"union\",\n \"scalar\",\n \"extend\",\n \"schema\",\n \"directive\",\n \"implements\",\n]);\n\n// Keywords that introduce a definition name (next NAME token is the def).\nconst GQL_DEF_KEYWORDS = new Set([\"query\", \"mutation\", \"subscription\", \"fragment\"]);\n\nconst GQL_BUILTINS = new Set([\"true\", \"false\", \"null\"]);\n\n/**\n * Highlight a single GraphQL line using the official `graphql` Lexer. Tracks\n * paren depth and the previous token to provide semantic-level colouring\n * (field names vs argument names vs types).\n * @param line - GraphQL text for a single editor line\n * @returns ANSI-decorated line, or the input unchanged when the lexer rejects it\n */\nexport function highlightGraphqlLine(line: string): string {\n if (line.trimStart().startsWith(\"#\")) {\n return `${DIM}${line}${RESET}`;\n }\n\n try {\n const source = new Source(line);\n const lexer = new Lexer(source);\n let result = \"\";\n let pos = 0;\n\n let parenDepth = 0;\n let prevKind: string = \"\";\n let prevText = \"\";\n let afterColon = false;\n\n let token = lexer.advance();\n while (token.kind !== TokenKind.EOF) {\n if (token.start > pos) {\n result += line.slice(pos, token.start);\n }\n\n const text = line.slice(token.start, token.end);\n switch (token.kind) {\n case TokenKind.NAME: {\n if (prevKind === TokenKind.DOLLAR) {\n result += `${MAGENTA}${text}${RESET}`;\n } else if (prevKind === TokenKind.AT) {\n result += `${BOLD_MAGENTA}${text}${RESET}`;\n } else if (GQL_BUILTINS.has(text) || GQL_KEYWORDS.has(text)) {\n result += `${BLUE}${text}${RESET}`;\n } else if (GQL_DEF_KEYWORDS.has(prevText)) {\n result += `${BOLD_CYAN}${text}${RESET}`;\n } else if (afterColon) {\n result += `${CYAN}${text}${RESET}`;\n } else if (parenDepth > 0) {\n result += `${ITALIC_YELLOW}${text}${RESET}`;\n } else {\n result += `${BRIGHT_BLUE}${text}${RESET}`;\n }\n afterColon = false;\n break;\n }\n case TokenKind.INT:\n case TokenKind.FLOAT:\n result += `${BLUE}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n result += `${GREEN}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.DOLLAR:\n result += `${MAGENTA}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.AT:\n result += `${BOLD_MAGENTA}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.BRACE_L:\n case TokenKind.BRACE_R:\n result += `${YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.PAREN_L:\n parenDepth += 1;\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.PAREN_R:\n parenDepth = Math.max(0, parenDepth - 1);\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.BRACKET_L:\n case TokenKind.BRACKET_R:\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.COLON:\n result += `${DIM}${text}${RESET}`;\n afterColon = true;\n break;\n case TokenKind.BANG:\n case TokenKind.EQUALS:\n case TokenKind.PIPE:\n case TokenKind.AMP:\n case TokenKind.SPREAD:\n result += `${DIM}${text}${RESET}`;\n afterColon = false;\n break;\n default:\n result += text;\n afterColon = false;\n }\n\n prevKind = token.kind;\n prevText = text;\n pos = token.end;\n token = lexer.advance();\n }\n\n if (pos < line.length) {\n result += line.slice(pos);\n }\n return result;\n } catch (error) {\n // The lexer throws GraphQLError on partial or invalid input (e.g. an\n // unterminated string while the user is still typing). Fall back to the\n // raw line so the editor keeps rendering without colour until the input\n // is valid. Any other error is a real bug and should surface.\n if (error instanceof GraphQLError) {\n return line;\n }\n throw error;\n }\n}\n\nconst BRACKET_PAIRS: Record<string, string> = { \"(\": \")\", \"[\": \"]\", \"{\": \"}\" };\nconst CLOSE_BRACKETS = new Set(Object.values(BRACKET_PAIRS));\n\n/**\n * Apply auto-close brackets and auto-indent on newline. Works for both SQL\n * and GraphQL because both languages share the `()`, `[]`, `{}` bracket set.\n * @param state - Editor state after the last edit\n * @param event - Event describing the edit that just occurred\n * @returns A new editor state to apply, or `undefined` to leave the state unchanged\n */\nexport function replTransform(\n state: TransformState,\n event: TransformEvent,\n): TransformState | undefined {\n const { lines, row, col } = state;\n\n if (event.type === \"insert\" && event.char in BRACKET_PAIRS) {\n const close = BRACKET_PAIRS[event.char];\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n const newLine = line.slice(0, col) + close + line.slice(col);\n return { lines: lines.with(row, newLine), row, col };\n }\n\n if (event.type === \"insert\" && CLOSE_BRACKETS.has(event.char)) {\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n if (line[col] === event.char) {\n const newLine = line.slice(0, col) + line.slice(col + 1);\n return { lines: lines.with(row, newLine), row, col };\n }\n }\n\n if (event.type === \"backspace\") {\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n const beforeCursor = line.slice(0, col);\n if (beforeCursor.length >= 1 && /^ +$/.test(beforeCursor)) {\n const newIndent = beforeCursor.slice(0, -1);\n const newLine = newIndent + line.slice(col);\n return { lines: lines.with(row, newLine), row, col: newIndent.length };\n }\n }\n\n if (event.type === \"newline\" && row > 0) {\n const prevLine = assertDefined(lines[row - 1], `line at row ${row - 1} missing`);\n const baseIndent = prevLine.match(/^(\\s*)/)?.[1] ?? \"\";\n const endsWithOpen = /[{([]$/.test(prevLine.trimEnd());\n const currentLine = assertDefined(lines[row], `line at row ${row} missing`);\n const startsWithClose = /^[}\\])]/.test(currentLine.trimStart());\n\n if (endsWithOpen && startsWithClose) {\n // Bracket expansion: the cursor sits between a matching open/close\n // pair (e.g. `{|}`). Expand into a three-line block with the cursor\n // on an indented middle line.\n const innerIndent = baseIndent + \" \";\n const newLines = lines\n .with(row, innerIndent)\n .toSpliced(row + 1, 0, baseIndent + currentLine.trimStart());\n return { lines: newLines, row, col: innerIndent.length };\n }\n if (endsWithOpen) {\n // A lone open bracket on the previous line: drop an extra indent for\n // the new line and auto-insert the matching closing bracket below.\n const openChar = prevLine.trimEnd().slice(-1);\n const closeChar = BRACKET_PAIRS[openChar] ?? \"}\";\n const indent = baseIndent + \" \";\n const newLines = lines\n .with(row, indent + currentLine)\n .toSpliced(row + 1, 0, baseIndent + closeChar);\n return { lines: newLines, row, col: indent.length };\n }\n if (baseIndent && col === 0) {\n return { lines: lines.with(row, baseIndent + currentLine), row, col: baseIndent.length };\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;AAQA,MAAM,QAAQ;AACd,MAAM,OAAO;AACb,MAAM,U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OAAO,KAAK,YAAY,GAAG;GACzD,MAAM,YAAY,aAAa,MAAM,GAAG,EAAE;GAC1C,MAAM,UAAU,YAAY,KAAK,MAAM,GAAG;GAC1C,OAAO;IAAE,OAAO,MAAM,KAAK,KAAK,OAAO;IAAG;IAAK,KAAK,UAAU;GAAO;EACvE;CACF;CAEA,IAAI,MAAM,SAAS,aAAa,MAAM,GAAG;EACvC,MAAM,WAAW,cAAc,MAAM,MAAM,IAAI,eAAe,MAAM,EAAE,SAAS;EAC/E,MAAM,aAAa,SAAS,MAAM,QAAQ,CAAC,GAAG,MAAM;EACpD,MAAM,eAAe,SAAS,KAAK,SAAS,QAAQ,CAAC;EACrD,MAAM,cAAc,cAAc,MAAM,MAAM,eAAe,IAAI,SAAS;EAC1E,MAAM,kBAAkB,UAAU,KAAK,YAAY,UAAU,CAAC;EAE9D,IAAI,gBAAgB,iBAAiB;GAInC,MAAM,cAAc,aAAa;GAIjC,OAAO;IAAE,OAHQ,MACd,KAAK,KAAK,WAAW,CAAC,CACtB,UAAU,MAAM,GAAG,GAAG,aAAa,YAAY,UAAU,CACrC;IAAG;IAAK,KAAK,YAAY;GAAO;EACzD;EACA,IAAI,cAAc;GAIhB,MAAM,YAAY,cADD,SAAS,QAAQ,CAAC,CAAC,MAAM,EACH,MAAM;GAC7C,MAAM,SAAS,aAAa;GAI5B,OAAO;IAAE,OAHQ,MACd,KAAK,KAAK,SAAS,WAAW,CAAC,CAC/B,UAAU,MAAM,GAAG,GAAG,aAAa,SACf;IAAG;IAAK,KAAK,OAAO;GAAO;EACpD;EACA,IAAI,cAAc,QAAQ,GACxB,OAAO;GAAE,OAAO,MAAM,KAAK,KAAK,aAAa,WAAW;GAAG;GAAK,KAAK,WAAW;EAAO;CAE3F;AAGF"}
1
+ {"version":3,"file":"repl-editor-BCozyiNq.mjs","names":[],"sources":["../src/cli/query/repl-editor.ts"],"sourcesContent":["import { GraphQLError, Lexer, Source, TokenKind } from \"graphql\";\nimport { getSegments } from \"sql-highlight\";\nimport { assertDefined } from \"#/utils/assert\";\nimport type { TransformEvent, TransformState } from \"@toiroakr/read-multiline\";\n\n// ANSI colour sequences. Kept inline (rather than going through `node:util`\n// styleText) so that tests running outside a TTY still produce deterministic\n// escape sequences regardless of detected colour support.\nconst RESET = \"\\x1b[0m\";\nconst BLUE = \"\\x1b[34m\";\nconst MAGENTA = \"\\x1b[35m\";\nconst YELLOW = \"\\x1b[33m\";\nconst BRIGHT_GREEN = \"\\x1b[92m\";\nconst CYAN = \"\\x1b[36m\";\nconst BRIGHT_BLUE = \"\\x1b[94m\";\nconst BOLD_CYAN = \"\\x1b[1;36m\";\nconst BOLD_MAGENTA = \"\\x1b[1;35m\";\nconst ITALIC_YELLOW = \"\\x1b[3;33m\";\nconst GREEN = \"\\x1b[32m\";\nconst DIM = \"\\x1b[90m\";\nconst DIM_YELLOW = \"\\x1b[2;33m\";\n\nconst SQL_STYLE_MAP: Record<string, string> = {\n keyword: BLUE,\n function: MAGENTA,\n identifier: YELLOW,\n string: BRIGHT_GREEN,\n number: CYAN,\n bracket: DIM_YELLOW,\n special: DIM,\n};\n\n/**\n * Highlight a single SQL line using the `sql-highlight` tokenizer.\n * @param line - SQL text for a single editor line\n * @returns ANSI-decorated line safe for terminal output\n */\nexport function highlightSqlLine(line: string): string {\n const segments = getSegments(line);\n let result = \"\";\n for (const seg of segments) {\n const style = SQL_STYLE_MAP[seg.name];\n result += style ? style + seg.content + RESET : seg.content;\n }\n return result;\n}\n\nconst GQL_KEYWORDS = new Set([\n \"query\",\n \"mutation\",\n \"subscription\",\n \"fragment\",\n \"on\",\n \"type\",\n \"input\",\n \"enum\",\n \"interface\",\n \"union\",\n \"scalar\",\n \"extend\",\n \"schema\",\n \"directive\",\n \"implements\",\n]);\n\n// Keywords that introduce a definition name (next NAME token is the def).\nconst GQL_DEF_KEYWORDS = new Set([\"query\", \"mutation\", \"subscription\", \"fragment\"]);\n\nconst GQL_BUILTINS = new Set([\"true\", \"false\", \"null\"]);\n\n/**\n * Highlight a single GraphQL line using the official `graphql` Lexer. Tracks\n * paren depth and the previous token to provide semantic-level colouring\n * (field names vs argument names vs types).\n * @param line - GraphQL text for a single editor line\n * @returns ANSI-decorated line, or the input unchanged when the lexer rejects it\n */\nexport function highlightGraphqlLine(line: string): string {\n if (line.trimStart().startsWith(\"#\")) {\n return `${DIM}${line}${RESET}`;\n }\n\n try {\n const source = new Source(line);\n const lexer = new Lexer(source);\n let result = \"\";\n let pos = 0;\n\n let parenDepth = 0;\n let prevKind: string = \"\";\n let prevText = \"\";\n let afterColon = false;\n\n let token = lexer.advance();\n while (token.kind !== TokenKind.EOF) {\n if (token.start > pos) {\n result += line.slice(pos, token.start);\n }\n\n const text = line.slice(token.start, token.end);\n switch (token.kind) {\n case TokenKind.NAME: {\n if (prevKind === TokenKind.DOLLAR) {\n result += `${MAGENTA}${text}${RESET}`;\n } else if (prevKind === TokenKind.AT) {\n result += `${BOLD_MAGENTA}${text}${RESET}`;\n } else if (GQL_BUILTINS.has(text) || GQL_KEYWORDS.has(text)) {\n result += `${BLUE}${text}${RESET}`;\n } else if (GQL_DEF_KEYWORDS.has(prevText)) {\n result += `${BOLD_CYAN}${text}${RESET}`;\n } else if (afterColon) {\n result += `${CYAN}${text}${RESET}`;\n } else if (parenDepth > 0) {\n result += `${ITALIC_YELLOW}${text}${RESET}`;\n } else {\n result += `${BRIGHT_BLUE}${text}${RESET}`;\n }\n afterColon = false;\n break;\n }\n case TokenKind.INT:\n case TokenKind.FLOAT:\n result += `${BLUE}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n result += `${GREEN}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.DOLLAR:\n result += `${MAGENTA}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.AT:\n result += `${BOLD_MAGENTA}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.BRACE_L:\n case TokenKind.BRACE_R:\n result += `${YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.PAREN_L:\n parenDepth += 1;\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.PAREN_R:\n parenDepth = Math.max(0, parenDepth - 1);\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.BRACKET_L:\n case TokenKind.BRACKET_R:\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.COLON:\n result += `${DIM}${text}${RESET}`;\n afterColon = true;\n break;\n case TokenKind.BANG:\n case TokenKind.EQUALS:\n case TokenKind.PIPE:\n case TokenKind.AMP:\n case TokenKind.SPREAD:\n result += `${DIM}${text}${RESET}`;\n afterColon = false;\n break;\n default:\n result += text;\n afterColon = false;\n }\n\n prevKind = token.kind;\n prevText = text;\n pos = token.end;\n token = lexer.advance();\n }\n\n if (pos < line.length) {\n result += line.slice(pos);\n }\n return result;\n } catch (error) {\n // The lexer throws GraphQLError on partial or invalid input (e.g. an\n // unterminated string while the user is still typing). Fall back to the\n // raw line so the editor keeps rendering without colour until the input\n // is valid. Any other error is a real bug and should surface.\n if (error instanceof GraphQLError) {\n return line;\n }\n throw error;\n }\n}\n\nconst BRACKET_PAIRS: Record<string, string> = { \"(\": \")\", \"[\": \"]\", \"{\": \"}\" };\nconst CLOSE_BRACKETS = new Set(Object.values(BRACKET_PAIRS));\n\n/**\n * Apply auto-close brackets and auto-indent on newline. Works for both SQL\n * and GraphQL because both languages share the `()`, `[]`, `{}` bracket set.\n * @param state - Editor state after the last edit\n * @param event - Event describing the edit that just occurred\n * @returns A new editor state to apply, or `undefined` to leave the state unchanged\n */\nexport function replTransform(\n state: TransformState,\n event: TransformEvent,\n): TransformState | undefined {\n const { lines, row, col } = state;\n\n if (event.type === \"insert\" && event.char in BRACKET_PAIRS) {\n const close = BRACKET_PAIRS[event.char];\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n const newLine = line.slice(0, col) + close + line.slice(col);\n return { lines: lines.with(row, newLine), row, col };\n }\n\n if (event.type === \"insert\" && CLOSE_BRACKETS.has(event.char)) {\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n if (line[col] === event.char) {\n const newLine = line.slice(0, col) + line.slice(col + 1);\n return { lines: lines.with(row, newLine), row, col };\n }\n }\n\n if (event.type === \"backspace\") {\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n const beforeCursor = line.slice(0, col);\n if (beforeCursor.length >= 1 && /^ +$/.test(beforeCursor)) {\n const newIndent = beforeCursor.slice(0, -1);\n const newLine = newIndent + line.slice(col);\n return { lines: lines.with(row, newLine), row, col: newIndent.length };\n }\n }\n\n if (event.type === \"newline\" && row > 0) {\n const prevLine = assertDefined(lines[row - 1], `line at row ${row - 1} missing`);\n const baseIndent = prevLine.match(/^(\\s*)/)?.[1] ?? \"\";\n const endsWithOpen = /[{([]$/.test(prevLine.trimEnd());\n const currentLine = assertDefined(lines[row], `line at row ${row} missing`);\n const startsWithClose = /^[}\\])]/.test(currentLine.trimStart());\n\n if (endsWithOpen && startsWithClose) {\n // Bracket expansion: the cursor sits between a matching open/close\n // pair (e.g. `{|}`). Expand into a three-line block with the cursor\n // on an indented middle line.\n const innerIndent = baseIndent + \" \";\n const newLines = lines\n .with(row, innerIndent)\n .toSpliced(row + 1, 0, baseIndent + currentLine.trimStart());\n return { lines: newLines, row, col: innerIndent.length };\n }\n if (endsWithOpen) {\n // A lone open bracket on the previous line: drop an extra indent for\n // the new line and auto-insert the matching closing bracket below.\n const openChar = prevLine.trimEnd().slice(-1);\n const closeChar = BRACKET_PAIRS[openChar] ?? \"}\";\n const indent = baseIndent + \" \";\n const newLines = lines\n .with(row, indent + currentLine)\n .toSpliced(row + 1, 0, baseIndent + closeChar);\n return { lines: newLines, row, col: indent.length };\n }\n if (baseIndent && col === 0) {\n return { lines: lines.with(row, baseIndent + currentLine), row, col: baseIndent.length };\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;AAQA,MAAM,QAAQ;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** Result of {@link TailorAigatewayAPI.get}. */
4
+ interface GetAIGatewayResult {
5
+ /** The platform-assigned URL of the AI Gateway. */
6
+ url: string;
7
+ }
8
+ /**
9
+ * Platform API surface for `tailor.aigateway`. Describes the shape the
10
+ * platform runtime injects on `globalThis.tailor.aigateway`.
11
+ */
12
+ interface TailorAigatewayAPI {
13
+ /**
14
+ * Resolves an AI Gateway defined in the caller's own workspace.
15
+ * @param name - AI Gateway name, as passed to `defineAIGateway()`
16
+ * @returns The resolved AI Gateway's platform-assigned URL
17
+ */
18
+ get(name: AIGatewayName): Promise<GetAIGatewayResult>;
19
+ }
20
+ /** Runtime wrapper namespace for `tailor.aigateway`. */
21
+ declare const aigateway: {
22
+ readonly get: (name: AIGatewayName) => Promise<GetAIGatewayResult>;
23
+ };
24
+ //#endregion
25
+ export { GetAIGatewayResult, TailorAigatewayAPI, aigateway };
@@ -0,0 +1,3 @@
1
+ import { t as aigateway } from "../aigateway-DR4Kwuik.mjs";
2
+
3
+ export { aigateway };
@@ -1,2 +1,21 @@
1
- import { r as getConnectionToken, t as TailorAuthconnectionAPI } from "../authconnection-DvUQAjQS.mjs";
2
- export { TailorAuthconnectionAPI, getConnectionToken };
1
+ import { AuthConnectionTokenResult as AuthConnectionTokenResult$1 } from "../configure/services/auth/types.mjs";
2
+ import { ConnectionName } from "@tailor-platform/sdk";
3
+ //#region src/runtime/authconnection.d.ts
4
+ /**
5
+ * Platform API surface for `tailor.authconnection`. Describes the shape the
6
+ * platform runtime injects on `globalThis.tailor.authconnection`.
7
+ */
8
+ interface TailorAuthconnectionAPI {
9
+ /**
10
+ * Returns the access token for the given auth connection.
11
+ * @param connectionName - Auth connection name as defined in tailor.config
12
+ * @returns Token payload
13
+ */
14
+ getConnectionToken(connectionName: ConnectionName): Promise<AuthConnectionTokenResult$1>;
15
+ }
16
+ /** Runtime wrapper namespace for `tailor.authconnection`. */
17
+ declare const authconnection: {
18
+ readonly getConnectionToken: (connectionName: ConnectionName) => Promise<AuthConnectionTokenResult$1>;
19
+ };
20
+ //#endregion
21
+ export { TailorAuthconnectionAPI, authconnection };
@@ -1,3 +1,3 @@
1
- import { n as getConnectionToken } from "../authconnection-D2MhtTN5.mjs";
1
+ import { t as authconnection } from "../authconnection-CZvi9ANm.mjs";
2
2
 
3
- export { getConnectionToken };
3
+ export { authconnection };
@@ -1,2 +1,54 @@
1
- import { a as getInvoker, n as Invoker, r as TailorContextAPI, t as ContextInvoker } from "../context-BuuIb8CC.mjs";
2
- export { ContextInvoker, Invoker, TailorContextAPI, getInvoker };
1
+ import { TailorPrincipal } from "./types.mjs";
2
+ //#region src/runtime/context.d.ts
3
+ /**
4
+ * Information about the invoker of the current function execution.
5
+ *
6
+ * Matches the public `TailorPrincipal` shape — `attributes` is the attribute
7
+ * map and `attributeList` is the array of attribute IDs.
8
+ */
9
+ type Invoker = TailorPrincipal;
10
+ /**
11
+ * Raw platform-side invoker payload returned by `tailor.context.getInvoker()`.
12
+ * The wrapper normalizes this into {@link Invoker}.
13
+ * @internal
14
+ */
15
+ interface ContextInvoker {
16
+ /** The invoker's ID */
17
+ id: string;
18
+ /** The invoker's type */
19
+ type: "user" | "machine_user";
20
+ /** The workspace ID */
21
+ workspaceId: string;
22
+ /** The invoker's attribute IDs */
23
+ attributes: string[];
24
+ /** The invoker's attribute map */
25
+ attributeMap: Record<string, unknown>;
26
+ }
27
+ /**
28
+ * Platform API surface for `tailor.context`. Describes the shape the platform
29
+ * runtime injects on `globalThis.tailor.context`.
30
+ * @internal
31
+ */
32
+ interface PlatformContextAPI {
33
+ getInvoker(): ContextInvoker | null;
34
+ }
35
+ /** Runtime wrapper API for execution context utilities. */
36
+ interface TailorContextAPI {
37
+ /**
38
+ * Returns information about the current invoker.
39
+ * @returns Invoker details, or `null` for anonymous invocations
40
+ */
41
+ getInvoker(): Invoker | null;
42
+ }
43
+ /**
44
+ * Returns information about the invoker of the current function execution,
45
+ * or `null` for anonymous invocations.
46
+ * @returns Invoker details, or `null` when the call is anonymous
47
+ */
48
+ declare function getInvoker(): Invoker | null;
49
+ /** Runtime wrapper namespace for `tailor.context`. */
50
+ declare const context: {
51
+ readonly getInvoker: typeof getInvoker;
52
+ };
53
+ //#endregion
54
+ export { ContextInvoker, Invoker, PlatformContextAPI, TailorContextAPI, context };
@@ -1,3 +1,3 @@
1
- import { n as getInvoker } from "../context-Bd266-ru.mjs";
1
+ import { t as context } from "../context-DYQVYWqZ.mjs";
2
2
 
3
- export { getInvoker };
3
+ export { context };
@@ -0,0 +1,10 @@
1
+ import { TailorPrincipal } from "./types.mjs";
2
+ import { StandardSchemaV1 } from "@standard-schema/spec";
3
+ //#region src/runtime/field-parse.d.ts
4
+ type FieldParseArgs = {
5
+ value: unknown;
6
+ data: unknown;
7
+ invoker: TailorPrincipal | null;
8
+ };
9
+ //#endregion
10
+ export { FieldParseArgs };
@@ -1,2 +1,170 @@
1
- import { C as upload, S as openDownloadStream, _ as download, a as FileMetadata, c as FileUploadResponse, d as StreamValue, f as TailorDBFileAPI, g as deleteFile, h as UploadMetadata, i as FileDownloadStreamResponse, l as FileUploadStreamOptions, m as TailorDBFileErrorCode, n as FileDownloadAsBase64Response, o as FileStreamIterator, p as TailorDBFileError, r as FileDownloadResponse, s as FileUploadOptions, t as DownloadMetadata, u as StreamMetadata, v as downloadAsBase64, w as uploadStream, x as getMetadata, y as downloadStream } from "../file-BB8Vs9O_.mjs";
2
- export { DownloadMetadata, FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata, FileStreamIterator, FileUploadOptions, FileUploadResponse, FileUploadStreamOptions, StreamMetadata, StreamValue, TailorDBFileAPI, TailorDBFileError, TailorDBFileErrorCode, UploadMetadata, deleteFile as delete, deleteFile, download, downloadAsBase64, downloadStream, getMetadata, openDownloadStream, upload, uploadStream };
1
+ //#region src/runtime/file.d.ts
2
+ /**
3
+ * TailorDB file (BLOB) utilities.
4
+ *
5
+ * Thin typed wrapper around the platform-provided `tailordb.file` runtime API.
6
+ * At runtime this delegates to `globalThis.tailordb.file`. Use `mockFile` from
7
+ * `@tailor-platform/sdk/vitest` to mock these calls in unit tests.
8
+ * @example
9
+ * import { file } from "@tailor-platform/sdk/runtime";
10
+ *
11
+ * const { metadata } = await file.upload(
12
+ * "my-namespace",
13
+ * "Document",
14
+ * "attachment",
15
+ * recordId,
16
+ * bytes,
17
+ * );
18
+ */
19
+ /** Upload response metadata. */
20
+ interface UploadMetadata {
21
+ fileSize: number;
22
+ sha256sum: string;
23
+ }
24
+ /** Download response metadata. */
25
+ interface DownloadMetadata {
26
+ contentType: string;
27
+ fileSize: number;
28
+ sha256sum: string;
29
+ lastUploadedAt: string;
30
+ }
31
+ /** File metadata (for {@link TailorDBFileAPI.getMetadata}). */
32
+ interface FileMetadata {
33
+ contentType: string;
34
+ fileSize: number;
35
+ sha256sum: string;
36
+ urlPath: string;
37
+ lastUploadedAt?: string;
38
+ }
39
+ /** Upload options. */
40
+ interface FileUploadOptions {
41
+ contentType?: string;
42
+ }
43
+ /** Upload stream options. */
44
+ interface FileUploadStreamOptions {
45
+ contentType?: string;
46
+ fileSize?: number;
47
+ }
48
+ /** Upload response. */
49
+ interface FileUploadResponse {
50
+ metadata: UploadMetadata;
51
+ }
52
+ /** Download response. */
53
+ interface FileDownloadResponse {
54
+ data: Uint8Array;
55
+ metadata: DownloadMetadata;
56
+ }
57
+ /** Download-as-Base64 response. */
58
+ interface FileDownloadAsBase64Response {
59
+ data: string;
60
+ metadata: DownloadMetadata;
61
+ }
62
+ /** Download stream response. */
63
+ interface FileDownloadStreamResponse {
64
+ body: ReadableStream<Uint8Array>;
65
+ metadata: DownloadMetadata;
66
+ }
67
+ /** Error code emitted by {@link TailorDBFileError}. */
68
+ type TailorDBFileErrorCode = "INVALID_PARAMS" | "INVALID_DATA_TYPE" | "OPERATION_FAILED" | "DELETE_FAILED" | "STREAM_OPEN_FAILED" | "STREAM_READ_ERROR" | "STREAM_ERROR" | "FILE_TOO_LARGE";
69
+ /**
70
+ * Type-only shape of the `TailorDBFileError` runtime class. The class itself
71
+ * is provided by the platform runtime (and by `injectMocks` in tests); this
72
+ * interface mirrors it so callers can `import type { TailorDBFileError }` from
73
+ * the wrapper module without depending on any ambient declaration.
74
+ */
75
+ interface TailorDBFileError extends Error {
76
+ name: "TailorDBFileError";
77
+ code?: TailorDBFileErrorCode;
78
+ cause?: unknown;
79
+ }
80
+ /**
81
+ * Platform API surface for `tailordb.file`. Describes the shape the platform
82
+ * runtime injects on `globalThis.tailordb.file`.
83
+ */
84
+ interface TailorDBFileAPI {
85
+ /**
86
+ * Upload a file to TailorDB.
87
+ * @param namespace - TailorDB namespace
88
+ * @param typeName - TailorDB type name
89
+ * @param fieldName - File field name on the type
90
+ * @param recordId - Record ID owning the field
91
+ * @param data - File contents
92
+ * @param options - Upload options (e.g. `contentType`)
93
+ * @returns Upload response containing the file metadata
94
+ */
95
+ upload(namespace: string, typeName: string, fieldName: string, recordId: string, data: string | ArrayBuffer | Uint8Array | number[], options?: FileUploadOptions): Promise<FileUploadResponse>;
96
+ /**
97
+ * Download a file from TailorDB.
98
+ *
99
+ * Throws `TailorDBFileError` with code `FILE_TOO_LARGE` when the file
100
+ * exceeds 10MB — use {@link downloadStream} for large files.
101
+ * @param namespace - TailorDB namespace
102
+ * @param typeName - TailorDB type name
103
+ * @param fieldName - File field name on the type
104
+ * @param recordId - Record ID owning the field
105
+ * @returns Bytes and metadata for the file
106
+ */
107
+ download(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadResponse>;
108
+ /**
109
+ * Download a file from TailorDB as a Base64-encoded string.
110
+ *
111
+ * Throws `TailorDBFileError` with code `FILE_TOO_LARGE` when the file
112
+ * exceeds 10MB — use {@link downloadStream} for large files.
113
+ * @param namespace - TailorDB namespace
114
+ * @param typeName - TailorDB type name
115
+ * @param fieldName - File field name on the type
116
+ * @param recordId - Record ID owning the field
117
+ * @returns Base64-encoded contents and metadata for the file
118
+ */
119
+ downloadAsBase64(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadAsBase64Response>;
120
+ /**
121
+ * Delete a file from TailorDB.
122
+ * @param namespace - TailorDB namespace
123
+ * @param typeName - TailorDB type name
124
+ * @param fieldName - File field name on the type
125
+ * @param recordId - Record ID owning the field
126
+ * @returns Resolves once the file has been deleted
127
+ */
128
+ delete(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<void>;
129
+ /**
130
+ * Get file metadata from TailorDB.
131
+ * @param namespace - TailorDB namespace
132
+ * @param typeName - TailorDB type name
133
+ * @param fieldName - File field name on the type
134
+ * @param recordId - Record ID owning the field
135
+ * @returns Metadata for the stored file
136
+ */
137
+ getMetadata(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileMetadata>;
138
+ /**
139
+ * Download a file as a ReadableStream.
140
+ * @param namespace - TailorDB namespace
141
+ * @param typeName - TailorDB type name
142
+ * @param fieldName - File field name on the type
143
+ * @param recordId - Record ID owning the field
144
+ * @returns ReadableStream body and metadata for the file
145
+ */
146
+ downloadStream(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadStreamResponse>;
147
+ /**
148
+ * Upload a file using a ReadableStream.
149
+ * @param namespace - TailorDB namespace
150
+ * @param typeName - TailorDB type name
151
+ * @param fieldName - File field name on the type
152
+ * @param recordId - Record ID owning the field
153
+ * @param readableStream - ReadableStream providing the file data
154
+ * @param options - Upload stream options (e.g. `contentType`, `fileSize`)
155
+ * @returns Upload response containing the file metadata
156
+ */
157
+ uploadStream(namespace: string, typeName: string, fieldName: string, recordId: string, readableStream: ReadableStream<Uint8Array | ArrayBuffer>, options?: FileUploadStreamOptions): Promise<FileUploadResponse>;
158
+ }
159
+ /** Runtime wrapper namespace for `tailordb.file`. */
160
+ declare const file: {
161
+ readonly upload: (namespace: string, typeName: string, fieldName: string, recordId: string, data: string | ArrayBuffer | Uint8Array | number[], options?: FileUploadOptions) => Promise<FileUploadResponse>;
162
+ readonly download: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadResponse>;
163
+ readonly downloadAsBase64: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadAsBase64Response>;
164
+ readonly delete: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<void>;
165
+ readonly getMetadata: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileMetadata>;
166
+ readonly downloadStream: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadStreamResponse>;
167
+ readonly uploadStream: (namespace: string, typeName: string, fieldName: string, recordId: string, readableStream: ReadableStream<Uint8Array | ArrayBuffer>, options?: FileUploadStreamOptions) => Promise<FileUploadResponse>;
168
+ };
169
+ //#endregion
170
+ export { DownloadMetadata, FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata, FileUploadOptions, FileUploadResponse, FileUploadStreamOptions, TailorDBFileAPI, TailorDBFileError, TailorDBFileErrorCode, UploadMetadata, file };
@@ -1,3 +1,3 @@
1
- import { c as upload, i as downloadStream, l as uploadStream, n as download, o as getMetadata, r as downloadAsBase64, s as openDownloadStream, t as deleteFile } from "../file-_oUZo76X.mjs";
1
+ import { t as file } from "../file-BUcmVIH2.mjs";
2
2
 
3
- export { deleteFile as delete, deleteFile, download, downloadAsBase64, downloadStream, getMetadata, openDownloadStream, upload, uploadStream };
3
+ export { file };
@@ -1,11 +1,25 @@
1
- import { t as ContextInvoker } from "../context-BuuIb8CC.mjs";
2
- import { m as TailorDBFileErrorCode } from "../file-BB8Vs9O_.mjs";
3
- import { r as IconvInstance } from "../iconv-Co-TOPuH.mjs";
4
- import { a as IdpClientInstance, c as SendPasswordResetEmailInput, d as User, f as UserQuery, n as ClientConfig, o as ListUsersOptions, r as CreateUserInput, s as ListUsersResponse, u as UpdateUserInput } from "../idp-DrhVrLmV.mjs";
5
- import { r as TriggerWorkflowOptions, t as AuthInvoker } from "../workflow-BbKvGLQg.mjs";
6
- import { a as TailordbQueryResult, i as TailordbCommandType, o as TailordbRuntime, r as TailordbClientInstance, t as TailorRuntime } from "../index-CK7u9isy.mjs";
7
-
1
+ import { Invoker, StartWorkflowOptions } from "./workflow.mjs";
2
+ import { ContextInvoker } from "./context.mjs";
3
+ import { TailorDBFileErrorCode } from "./file.mjs";
4
+ import { IconvInstance } from "./iconv.mjs";
5
+ import { ClientConfig, CreateUserInput, IdpClientInstance, ListUsersOptions, ListUsersResponse, SendPasswordResetEmailInput, UnenrollMfaInput, UpdateUserInput, User, UserQuery } from "./idp.mjs";
6
+ import { LogAttributeValue, LogAttributes } from "./logger.mjs";
7
+ import { TailorRuntime, TailordbClientInstance, TailordbCommandType, TailordbQueryResult, TailordbRuntime } from "./index.mjs";
8
8
  //#region src/runtime/globals.d.ts
9
+ type TailorIdpClientConfig = ClientConfig;
10
+ type TailorIdpCreateUserInput = CreateUserInput;
11
+ type TailorIdpClientInstance = IdpClientInstance;
12
+ type TailorIdpListUsersOptions = ListUsersOptions;
13
+ type TailorIdpListUsersResponse = ListUsersResponse;
14
+ type TailorIdpSendPasswordResetEmailInput = SendPasswordResetEmailInput;
15
+ type TailorIdpUnenrollMfaInput = UnenrollMfaInput;
16
+ type TailorIdpUpdateUserInput = UpdateUserInput;
17
+ type TailorIdpUser = User;
18
+ type TailorIdpUserQuery = UserQuery;
19
+ type TailorWorkflowInvoker = Invoker;
20
+ type TailorWorkflowStartWorkflowOptions = StartWorkflowOptions;
21
+ type TailorLoggerLogAttributeValue = LogAttributeValue;
22
+ type TailorLoggerLogAttributes = LogAttributes;
9
23
  declare global {
10
24
  namespace tailordb {
11
25
  type QueryResult<T> = TailordbQueryResult<T>;
@@ -18,23 +32,28 @@ declare global {
18
32
  type Iconv = IconvInstance;
19
33
  }
20
34
  namespace idp {
21
- type Client = IdpClientInstance;
22
- type ClientConfig = ClientConfig;
23
- type User = User;
24
- type UserQuery = UserQuery;
25
- type ListUsersOptions = ListUsersOptions;
26
- type ListUsersResponse = ListUsersResponse;
27
- type CreateUserInput = CreateUserInput;
28
- type UpdateUserInput = UpdateUserInput;
29
- type SendPasswordResetEmailInput = SendPasswordResetEmailInput;
35
+ type Client = TailorIdpClientInstance;
36
+ type ClientConfig = TailorIdpClientConfig;
37
+ type User = TailorIdpUser;
38
+ type UserQuery = TailorIdpUserQuery;
39
+ type ListUsersOptions = TailorIdpListUsersOptions;
40
+ type ListUsersResponse = TailorIdpListUsersResponse;
41
+ type CreateUserInput = TailorIdpCreateUserInput;
42
+ type UpdateUserInput = TailorIdpUpdateUserInput;
43
+ type SendPasswordResetEmailInput = TailorIdpSendPasswordResetEmailInput;
44
+ type UnenrollMfaInput = TailorIdpUnenrollMfaInput;
30
45
  }
31
46
  namespace workflow {
32
- type AuthInvoker = AuthInvoker;
33
- type TriggerWorkflowOptions = TriggerWorkflowOptions;
47
+ type Invoker = TailorWorkflowInvoker;
48
+ type StartWorkflowOptions = TailorWorkflowStartWorkflowOptions;
34
49
  }
35
50
  namespace context {
36
51
  type Invoker = ContextInvoker;
37
52
  }
53
+ namespace logger {
54
+ type LogAttributeValue = TailorLoggerLogAttributeValue;
55
+ type LogAttributes = TailorLoggerLogAttributes;
56
+ }
38
57
  }
39
58
  var tailor: TailorRuntime;
40
59
  /** Custom error class for TailorDB File operations. */
@@ -66,5 +85,4 @@ declare global {
66
85
  constructor(message: string);
67
86
  name: "TailorErrorMessage";
68
87
  }
69
- }
70
- //# sourceMappingURL=globals.d.mts.map
88
+ }
@@ -1,2 +1,73 @@
1
- import { a as convert, c as encode, i as TailorIconvAPI, l as encodings, n as IconvConstructor, o as convertBuffer, r as IconvInstance, s as decode, t as Iconv } from "../iconv-Co-TOPuH.mjs";
2
- export { Iconv, IconvConstructor, IconvInstance, TailorIconvAPI, convert, convertBuffer, decode, encode, encodings };
1
+ //#region src/runtime/iconv.d.ts
2
+ /**
3
+ * Character encoding conversion utilities.
4
+ *
5
+ * Thin typed wrapper around the platform-provided `tailor.iconv` runtime API.
6
+ * At runtime this delegates to `globalThis.tailor.iconv`, which is provided by
7
+ * the Tailor Platform Function runtime. Use `mockIconv` from
8
+ * `@tailor-platform/sdk/vitest` to mock these calls in unit tests.
9
+ * @example
10
+ * import { iconv } from "@tailor-platform/sdk/runtime";
11
+ *
12
+ * const utf8 = iconv.convert(sjisBuffer, "Shift_JIS", "UTF-8"); // string
13
+ * const sjis = iconv.convert("こんにちは", "UTF-8", "Shift_JIS"); // Uint8Array
14
+ *
15
+ * const conv = new iconv.Iconv("Shift_JIS", "UTF-8");
16
+ * const out = conv.convert(sjisBuffer);
17
+ */
18
+ /** Instance methods exposed by `tailor.iconv.Iconv`. */
19
+ interface IconvInstance {
20
+ convert(input: string | Uint8Array | ArrayBuffer): string | Uint8Array;
21
+ }
22
+ /** Constructor shape for `tailor.iconv.Iconv`. */
23
+ interface IconvConstructor {
24
+ new (fromEncoding: string, toEncoding: string): IconvInstance;
25
+ }
26
+ /**
27
+ * Platform API surface for `tailor.iconv`. Describes the shape the platform
28
+ * runtime injects on `globalThis.tailor.iconv` so the wrapper and ambient
29
+ * globals stay in sync.
30
+ */
31
+ interface TailorIconvAPI {
32
+ /**
33
+ * Convert a string or buffer between encodings.
34
+ * @param str - Input data to convert
35
+ * @param fromEncoding - Source encoding name
36
+ * @param toEncoding - Target encoding name
37
+ * @returns `string` when `toEncoding` is `"UTF8"` or `"UTF-8"`, otherwise `Uint8Array`.
38
+ */
39
+ convert<T extends string>(str: string | Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: T): T extends "UTF8" | "UTF-8" ? string : Uint8Array;
40
+ /**
41
+ * Convert a buffer between encodings.
42
+ * @param buffer - Input bytes to convert
43
+ * @param fromEncoding - Source encoding name
44
+ * @param toEncoding - Target encoding name
45
+ * @returns `string` when `toEncoding` is `"UTF8"` or `"UTF-8"`, otherwise `Uint8Array`.
46
+ */
47
+ convertBuffer<T extends string>(buffer: Uint8Array | ArrayBuffer, fromEncoding: string, toEncoding: T): T extends "UTF8" | "UTF-8" ? string : Uint8Array;
48
+ /**
49
+ * Decode a buffer to a UTF-8 string using the given source encoding.
50
+ * @param buffer - Input bytes
51
+ * @param encoding - Source encoding name
52
+ * @returns Decoded UTF-8 string
53
+ */
54
+ decode(buffer: Uint8Array | ArrayBuffer, encoding: string): string;
55
+ /**
56
+ * Encode a UTF-8 string into the given target encoding.
57
+ * @param str - Input string
58
+ * @param encoding - Target encoding name
59
+ * @returns `string` when `encoding` is `"UTF8"` or `"UTF-8"`, otherwise `Uint8Array`.
60
+ */
61
+ encode<T extends string>(str: string, encoding: T): T extends "UTF8" | "UTF-8" ? string : Uint8Array;
62
+ /**
63
+ * Returns the list of supported encoding names.
64
+ * @returns Array of encoding names supported by the platform iconv runtime
65
+ */
66
+ encodings(): string[];
67
+ /** Constructor for the stateful converter. */
68
+ Iconv: IconvConstructor;
69
+ }
70
+ /** Runtime API for `tailor.iconv`. */
71
+ declare const iconv: TailorIconvAPI;
72
+ //#endregion
73
+ export { IconvConstructor, IconvInstance, TailorIconvAPI, iconv };
@@ -1,3 +1,3 @@
1
- import { a as encode, i as decode, n as convert, o as encodings, r as convertBuffer, t as Iconv } from "../iconv-D2vi8G36.mjs";
1
+ import { t as iconv } from "../iconv-QWaZh0TT.mjs";
2
2
 
3
- export { Iconv, convert, convertBuffer, decode, encode, encodings };
3
+ export { iconv };