@tailor-platform/sdk 2.0.0-next.8 → 2.0.0

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 (180) hide show
  1. package/CHANGELOG.md +631 -0
  2. package/dist/{application-GzW98_Xr.mjs → application-CM6hKnSK.mjs} +489 -118
  3. package/dist/application-CM6hKnSK.mjs.map +1 -0
  4. package/dist/application-CXNaUNhv.mjs +3 -0
  5. package/dist/cli/commands/deploy/aigateway.d.mts +2 -2
  6. package/dist/cli/commands/deploy/application.d.mts +2 -2
  7. package/dist/cli/commands/deploy/auth.d.mts +2 -2
  8. package/dist/cli/commands/deploy/deploy.d.mts +1 -0
  9. package/dist/cli/commands/deploy/executor.d.mts +2 -2
  10. package/dist/cli/commands/deploy/function-registry.d.mts +1 -2
  11. package/dist/cli/commands/deploy/idp.d.mts +2 -2
  12. package/dist/cli/commands/deploy/label.d.mts +2 -0
  13. package/dist/cli/commands/deploy/resolver.d.mts +2 -2
  14. package/dist/cli/commands/deploy/secret-manager.d.mts +1 -1
  15. package/dist/cli/commands/deploy/staticwebsite.d.mts +2 -2
  16. package/dist/cli/commands/deploy/tailordb/index.d.mts +4 -2
  17. package/dist/cli/commands/deploy/types.d.mts +2 -1
  18. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -2
  19. package/dist/cli/commands/deploy/workflow.d.mts +2 -2
  20. package/dist/cli/commands/executor/get.d.mts +1 -10
  21. package/dist/cli/commands/executor/jobs.d.mts +1 -38
  22. package/dist/cli/commands/executor/trigger.d.mts +1 -11
  23. package/dist/cli/commands/generate/seed/bundler.d.mts +2 -1
  24. package/dist/cli/commands/tailordb/migrate/bundler.d.mts +3 -2
  25. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +11 -1
  26. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +5 -0
  27. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
  28. package/dist/cli/commands/workflow/executions.d.mts +1 -13
  29. package/dist/cli/commands/workflow/get.d.mts +1 -10
  30. package/dist/cli/commands/workflow/start.d.mts +2 -14
  31. package/dist/cli/index.mjs +12 -6552
  32. package/dist/cli/lib.d.mts +14 -15
  33. package/dist/cli/lib.mjs +203 -46
  34. package/dist/cli/lib.mjs.map +1 -1
  35. package/dist/cli/{index.d.mts → main.d.mts} +1 -1
  36. package/dist/cli/main.mjs +6777 -0
  37. package/dist/cli/main.mjs.map +1 -0
  38. package/dist/cli/services/http-adapter/bundler.d.mts +1 -0
  39. package/dist/cli/services/workflow/bundler.d.mts +2 -1
  40. package/dist/cli/shared/client.d.mts +28 -3
  41. package/dist/cli/shared/config-loader.d.mts +11 -4
  42. package/dist/cli/shared/error-json.d.mts +23 -0
  43. package/dist/cli/shared/script-executor.d.mts +6 -3
  44. package/dist/cli/shared/seed-chunker.d.mts +2 -7
  45. package/dist/cli/shared/seed-context.d.mts +49 -0
  46. package/dist/cli/shared/tailordb-namespaces.d.mts +7 -4
  47. package/dist/cli/shared/tsconfig-paths-plugin.d.mts +2 -0
  48. package/dist/cli/shared/type-generator.d.mts +4 -3
  49. package/dist/completion/zsh-worker.zsh +85 -22
  50. package/dist/configure/config/types.d.mts +29 -4
  51. package/dist/configure/index.d.mts +4 -3
  52. package/dist/configure/index.mjs +183 -6
  53. package/dist/configure/index.mjs.map +1 -1
  54. package/dist/configure/services/executor/index.d.mts +2 -2
  55. package/dist/configure/services/executor/trigger/event.d.mts +245 -2
  56. package/dist/configure/services/executor/trigger/index.d.mts +3 -3
  57. package/dist/configure/services/idp/index.d.mts +2 -2
  58. package/dist/configure/services/idp/permission.d.mts +1 -16
  59. package/dist/configure/services/idp/types.d.mts +5 -1
  60. package/dist/configure/services/index.d.mts +4 -3
  61. package/dist/configure/services/resolver/index.d.mts +2 -1
  62. package/dist/configure/services/resolver/permission.d.mts +64 -0
  63. package/dist/configure/services/resolver/resolver.d.mts +14 -2
  64. package/dist/configure/services/tailordb/index.d.mts +0 -1
  65. package/dist/configure/services/tailordb/permission.d.mts +1 -16
  66. package/dist/configure/services/workflow/execution-policy.d.mts +3 -3
  67. package/dist/configure/services/workflow/execution-policy.types.d.mts +1 -1
  68. package/dist/configure/services/workflow/job.d.mts +11 -2
  69. package/dist/configure/services/workflow/workflow.d.mts +10 -0
  70. package/dist/configure/types/permission-operand.types.d.mts +20 -0
  71. package/dist/{crashreport-CxHne11E.mjs → crashreport-B5LqCTfF.mjs} +2 -2
  72. package/dist/{crashreport-CxHne11E.mjs.map → crashreport-B5LqCTfF.mjs.map} +1 -1
  73. package/dist/{crashreport-0ioNRZ4K.mjs → crashreport-eI7ty7ok.mjs} +1 -1
  74. package/dist/{errors-DfnF4ibq.mjs → errors-D7583Zz7.mjs} +2 -44
  75. package/dist/errors-D7583Zz7.mjs.map +1 -0
  76. package/dist/{globals-CBZ0egXT.mjs → globals-TfAVItuK.mjs} +21 -5
  77. package/dist/globals-TfAVItuK.mjs.map +1 -0
  78. package/dist/logger-BtX0suGY.mjs +48 -0
  79. package/dist/logger-BtX0suGY.mjs.map +1 -0
  80. package/dist/{logger-BwS4ppwO.mjs → logger-CXQq9YIp.mjs} +110 -13
  81. package/dist/logger-CXQq9YIp.mjs.map +1 -0
  82. package/dist/node-builtins-CmaL2Cbq.mjs +36 -0
  83. package/dist/node-builtins-CmaL2Cbq.mjs.map +1 -0
  84. package/dist/plugin/builtin/enum-constants/index.mjs +115 -2
  85. package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -0
  86. package/dist/plugin/builtin/file-utils/index.mjs +149 -2
  87. package/dist/plugin/builtin/file-utils/index.mjs.map +1 -0
  88. package/dist/plugin/builtin/kysely-type/index.mjs +274 -2
  89. package/dist/plugin/builtin/kysely-type/index.mjs.map +1 -0
  90. package/dist/plugin/builtin/seed/index.d.mts +3 -2
  91. package/dist/plugin/builtin/seed/index.mjs +1 -1
  92. package/dist/plugin/builtin/seed/seed-type-processor.d.mts +21 -0
  93. package/dist/plugin/builtin/seed/types.d.mts +2 -0
  94. package/dist/{register-ts-hook-DvEs6YsL.mjs → register-ts-hook-LYV7zH-e.mjs} +2953 -996
  95. package/dist/register-ts-hook-LYV7zH-e.mjs.map +1 -0
  96. package/dist/{registry-i7EdJ-D5.mjs → registry-BIGVUrMB.mjs} +3 -3
  97. package/dist/registry-BIGVUrMB.mjs.map +1 -0
  98. package/dist/runtime/globals.d.mts +7 -0
  99. package/dist/runtime/index.d.mts +3 -1
  100. package/dist/runtime/index.mjs +3 -2
  101. package/dist/runtime/logger.d.mts +98 -0
  102. package/dist/runtime/logger.mjs +3 -0
  103. package/dist/runtime/workflow.d.mts +15 -7
  104. package/dist/runtime/workflow.mjs +1 -1
  105. package/dist/seed-B-yckgQY.mjs +483 -0
  106. package/dist/seed-B-yckgQY.mjs.map +1 -0
  107. package/dist/{service-DaeJlBoH.mjs → service-B5WynBHQ.mjs} +3 -3
  108. package/dist/{service-DaeJlBoH.mjs.map → service-B5WynBHQ.mjs.map} +1 -1
  109. package/dist/service-M7OYziQP.mjs +3 -0
  110. package/dist/{service-Dmxa2I4i.mjs → service-k1xy_A5G.mjs} +30 -4
  111. package/dist/service-k1xy_A5G.mjs.map +1 -0
  112. package/dist/{service_pb-BoLM0X4K.mjs → service_pb-D5--My_M.mjs} +5 -5
  113. package/dist/service_pb-D5--My_M.mjs.map +1 -0
  114. package/dist/{service_pb-r1T7kpJc.mjs → service_pb-i8CmnQP4.mjs} +1 -1
  115. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +106 -1
  116. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +6 -1
  117. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +24 -1
  118. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +49 -1
  119. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +89 -6
  120. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +26 -1
  121. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +101 -1
  122. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +22 -1
  123. package/dist/types/auth.generated.d.mts +14 -2
  124. package/dist/types/executor.generated.d.mts +45 -3
  125. package/dist/types/http-adapter.generated.d.mts +5 -0
  126. package/dist/types/idp.generated.d.mts +31 -1
  127. package/dist/types/resolver.generated.d.mts +30 -2
  128. package/dist/types/tailordb.generated.d.mts +15 -3
  129. package/dist/utils/test/index.d.mts +1 -2
  130. package/dist/utils/test/index.mjs +1 -169
  131. package/dist/utils/test/index.mjs.map +1 -1
  132. package/dist/vitest/environment.mjs +1 -1
  133. package/dist/vitest/index.d.mts +6 -4
  134. package/dist/vitest/index.mjs +112 -62
  135. package/dist/vitest/index.mjs.map +1 -1
  136. package/dist/vitest/mock.d.mts +2 -1
  137. package/dist/vitest/mocks/logger.d.mts +45 -0
  138. package/dist/vitest/mocks/workflow.d.mts +8 -8
  139. package/dist/vitest/setup.mjs +1 -1
  140. package/dist/{workflow-CsBvRE3g.mjs → workflow-Bamae_Yc.mjs} +5 -5
  141. package/dist/workflow-Bamae_Yc.mjs.map +1 -0
  142. package/dist/{workspace_resource_pb-Db3fv68L.mjs → workspace_resource_pb-DXnO2AT-.mjs} +13 -8
  143. package/dist/workspace_resource_pb-DXnO2AT-.mjs.map +1 -0
  144. package/docs/cli/application.md +5 -1
  145. package/docs/cli/tailordb.md +47 -13
  146. package/docs/cli-reference.md +38 -30
  147. package/docs/configuration.md +54 -2
  148. package/docs/github-actions.md +2 -2
  149. package/docs/migration/v2.md +408 -5
  150. package/docs/runtime.md +5 -1
  151. package/docs/services/executor.md +83 -3
  152. package/docs/services/idp.md +8 -6
  153. package/docs/services/resolver.md +60 -4
  154. package/docs/services/tailordb-migration.md +31 -7
  155. package/docs/services/tailordb.md +7 -5
  156. package/docs/services/workflow.md +33 -3
  157. package/docs/testing.md +34 -7
  158. package/package.json +31 -24
  159. package/dist/application-GzW98_Xr.mjs.map +0 -1
  160. package/dist/application-OM0taSPn.mjs +0 -3
  161. package/dist/cli/index.mjs.map +0 -1
  162. package/dist/enum-constants-j9QBF0cB.mjs +0 -116
  163. package/dist/enum-constants-j9QBF0cB.mjs.map +0 -1
  164. package/dist/errors-DfnF4ibq.mjs.map +0 -1
  165. package/dist/file-utils-yEiIS4nJ.mjs +0 -150
  166. package/dist/file-utils-yEiIS4nJ.mjs.map +0 -1
  167. package/dist/globals-CBZ0egXT.mjs.map +0 -1
  168. package/dist/kysely-type-DqIRgDYR.mjs +0 -275
  169. package/dist/kysely-type-DqIRgDYR.mjs.map +0 -1
  170. package/dist/logger-BwS4ppwO.mjs.map +0 -1
  171. package/dist/register-ts-hook-DvEs6YsL.mjs.map +0 -1
  172. package/dist/registry-i7EdJ-D5.mjs.map +0 -1
  173. package/dist/seed-CRSQJI_z.mjs +0 -1170
  174. package/dist/seed-CRSQJI_z.mjs.map +0 -1
  175. package/dist/service-BJAQ70e5.mjs +0 -3
  176. package/dist/service-Dmxa2I4i.mjs.map +0 -1
  177. package/dist/service_pb-BoLM0X4K.mjs.map +0 -1
  178. package/dist/utils/test/mock.d.mts +0 -86
  179. package/dist/workflow-CsBvRE3g.mjs.map +0 -1
  180. package/dist/workspace_resource_pb-Db3fv68L.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry-i7EdJ-D5.mjs","names":[],"sources":["../src/configure/services/workflow/registry.ts"],"sourcesContent":["import type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type { StartJobFunctionOptions, 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 startJobFunction: (name: string, args?: unknown, options?: StartJobFunctionOptions) => 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.startJobFunction(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?: StartJobFunctionOptions,\n): unknown {\n const workflow = requirePlatformWorkflow();\n // oxlint-disable-next-line prefer-rest-params\n return arguments.length >= 3\n ? workflow.startJobFunction(name, args, options)\n : workflow.startJobFunction(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;AAYrF,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,iBAAiB,MAAM,MAAM,OAAO,IAC7C,SAAS,iBAAiB,MAAM,IAAI;AAC1C;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"}