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

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 (198) hide show
  1. package/CHANGELOG.md +89 -2
  2. package/dist/application-DB2r36Et.mjs +3 -0
  3. package/dist/{application-DGDmL8i_.mjs → application-DqS1yBg3.mjs} +188 -128
  4. package/dist/application-DqS1yBg3.mjs.map +1 -0
  5. package/dist/{assert-CKfwrmCV.mjs → assert-DBxo8jPo.mjs} +1 -2
  6. package/dist/{assert-CKfwrmCV.mjs.map → assert-DBxo8jPo.mjs.map} +1 -1
  7. package/dist/{authconnection-D8SJGMpj.mjs → authconnection-D2MhtTN5.mjs} +2 -3
  8. package/dist/{authconnection-D8SJGMpj.mjs.map → authconnection-D2MhtTN5.mjs.map} +1 -1
  9. package/dist/{authconnection-BIYzEh2p.d.mts → authconnection-DvUQAjQS.d.mts} +1 -1
  10. package/dist/{brand-DlnJ375c.mjs → brand-Eo4pLXPJ.mjs} +1 -2
  11. package/dist/{brand-DlnJ375c.mjs.map → brand-Eo4pLXPJ.mjs.map} +1 -1
  12. package/dist/cli/index.mjs +78 -131
  13. package/dist/cli/index.mjs.map +1 -1
  14. package/dist/cli/lib.d.mts +15 -154
  15. package/dist/cli/lib.mjs +9 -10
  16. package/dist/cli/lib.mjs.map +1 -1
  17. package/dist/{client-boxXYevx.mjs → client-Dbohmtkv.mjs} +1 -2
  18. package/dist/{client-F0a4cWUM.mjs → client-z_oHGVNy.mjs} +8 -6
  19. package/dist/client-z_oHGVNy.mjs.map +1 -0
  20. package/dist/completion/zsh-worker.zsh +5 -19
  21. package/dist/configure/index.d.mts +8 -7
  22. package/dist/configure/index.mjs +11 -28
  23. package/dist/configure/index.mjs.map +1 -1
  24. package/dist/{context-s0lxhu8_.mjs → context-Bd266-ru.mjs} +2 -3
  25. package/dist/{context-s0lxhu8_.mjs.map → context-Bd266-ru.mjs.map} +1 -1
  26. package/dist/{context-CUBwSBq4.d.mts → context-BuuIb8CC.d.mts} +1 -1
  27. package/dist/{crashreport-0EHy-ayY.mjs → crashreport-BsjAkFWw.mjs} +19 -10
  28. package/dist/{crashreport-0EHy-ayY.mjs.map → crashreport-BsjAkFWw.mjs.map} +1 -1
  29. package/dist/{crashreport-Bf6uT6mf.mjs → crashreport-pr6Rhvza.mjs} +1 -2
  30. package/dist/{enum-constants-C7DaWeQo.mjs → enum-constants-j9QBF0cB.mjs} +1 -2
  31. package/dist/enum-constants-j9QBF0cB.mjs.map +1 -0
  32. package/dist/{errors-EsY4XO6O.mjs → errors-Dtf2WPaW.mjs} +1 -2
  33. package/dist/{errors-EsY4XO6O.mjs.map → errors-Dtf2WPaW.mjs.map} +1 -1
  34. package/dist/{field-C4zdJLW5.mjs → field-DOsJCPFa.mjs} +1 -2
  35. package/dist/field-DOsJCPFa.mjs.map +1 -0
  36. package/dist/{file-BzK8z3X-.d.mts → file-BB8Vs9O_.d.mts} +1 -1
  37. package/dist/{file-B58Dm-2P.mjs → file-_oUZo76X.mjs} +2 -3
  38. package/dist/{file-B58Dm-2P.mjs.map → file-_oUZo76X.mjs.map} +1 -1
  39. package/dist/{file-utils-BHPxPXmn.mjs → file-utils-DcyIPFQh.mjs} +2 -3
  40. package/dist/{file-utils-BHPxPXmn.mjs.map → file-utils-DcyIPFQh.mjs.map} +1 -1
  41. package/dist/{globals-ByrCoDip.mjs → globals-Crz8o65k.mjs} +53 -5
  42. package/dist/globals-Crz8o65k.mjs.map +1 -0
  43. package/dist/http-adapter.generated-WgMnb7Sb.d.mts +580 -0
  44. package/dist/{iconv-kwrmd1U_.d.mts → iconv-Co-TOPuH.d.mts} +1 -1
  45. package/dist/{iconv-DreIffeM.mjs → iconv-D2vi8G36.mjs} +2 -3
  46. package/dist/{iconv-DreIffeM.mjs.map → iconv-D2vi8G36.mjs.map} +1 -1
  47. package/dist/{idp-Ch95ag8h.mjs → idp-BDbK5gjm.mjs} +2 -3
  48. package/dist/{idp-Ch95ag8h.mjs.map → idp-BDbK5gjm.mjs.map} +1 -1
  49. package/dist/{idp-BlBPtXJ-.d.mts → idp-DrhVrLmV.d.mts} +1 -1
  50. package/dist/{index-QpC0TNbH.d.mts → index-5vPyRu1y.d.mts} +2 -2
  51. package/dist/{index-Bhjep8cS.d.mts → index-B7AKc18V.d.mts} +2 -2
  52. package/dist/{index-BdLqzJDu.d.mts → index-BlpzXncY.d.mts} +25 -247
  53. package/dist/{index-DRhMpdnA.d.mts → index-CK7u9isy.d.mts} +8 -8
  54. package/dist/{index-CZ2r3qiO.d.mts → index-CNYe5lnW.d.mts} +2 -2
  55. package/dist/{index-Db2RvnEH.d.mts → index-DjUdWlzf.d.mts} +2 -2
  56. package/dist/index-ZePLwxw7.d.mts +208 -0
  57. package/dist/{interceptor-DOqRkCya.mjs → interceptor-D-q1rvRl.mjs} +1 -2
  58. package/dist/{interceptor-DOqRkCya.mjs.map → interceptor-D-q1rvRl.mjs.map} +1 -1
  59. package/dist/{job-BpsFXPbi.mjs → job-fuc3j1Ma.mjs} +9 -10
  60. package/dist/job-fuc3j1Ma.mjs.map +1 -0
  61. package/dist/kysely/index.mjs +0 -1
  62. package/dist/kysely/index.mjs.map +1 -1
  63. package/dist/{kysely-type-D1e0Vwkd.mjs → kysely-type-DR8uzZTA.mjs} +2 -3
  64. package/dist/kysely-type-DR8uzZTA.mjs.map +1 -0
  65. package/dist/{logger-DpJyJvNz.mjs → logger-CxF-Ex5d.mjs} +1 -2
  66. package/dist/{logger-DpJyJvNz.mjs.map → logger-CxF-Ex5d.mjs.map} +1 -1
  67. package/dist/{mock-DMgIygjE.mjs → mock-BjFj5o1I.mjs} +9 -11
  68. package/dist/mock-BjFj5o1I.mjs.map +1 -0
  69. package/dist/{multiline-Cf9ODpr1.mjs → multiline-sfHpTZZK.mjs} +1 -2
  70. package/dist/{multiline-Cf9ODpr1.mjs.map → multiline-sfHpTZZK.mjs.map} +1 -1
  71. package/dist/{package-json-DcQApfPQ.mjs → package-json-8b0O9TlX.mjs} +1 -2
  72. package/dist/{package-json-DcQApfPQ.mjs.map → package-json-8b0O9TlX.mjs.map} +1 -1
  73. package/dist/package-json-Cv2Z-TqQ.mjs +3 -0
  74. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  75. package/dist/plugin/builtin/enum-constants/index.mjs +1 -2
  76. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  77. package/dist/plugin/builtin/file-utils/index.mjs +1 -2
  78. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  79. package/dist/plugin/builtin/kysely-type/index.mjs +1 -2
  80. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  81. package/dist/plugin/builtin/seed/index.mjs +1 -2
  82. package/dist/plugin/index.d.mts +1 -3
  83. package/dist/plugin/index.mjs +0 -1
  84. package/dist/plugin/index.mjs.map +1 -1
  85. package/dist/registry-DdsYlL_P.mjs +51 -0
  86. package/dist/registry-DdsYlL_P.mjs.map +1 -0
  87. package/dist/{repl-editor-CJG3sz7A.mjs → repl-editor-DmGr9zMw.mjs} +2 -3
  88. package/dist/{repl-editor-CJG3sz7A.mjs.map → repl-editor-DmGr9zMw.mjs.map} +1 -1
  89. package/dist/{chunk-BkoGK1jX.mjs → rolldown-runtime-DXywRVcq.mjs} +0 -1
  90. package/dist/runtime/authconnection.d.mts +1 -1
  91. package/dist/runtime/authconnection.mjs +1 -2
  92. package/dist/runtime/context.d.mts +1 -1
  93. package/dist/runtime/context.mjs +1 -2
  94. package/dist/runtime/file.d.mts +1 -1
  95. package/dist/runtime/file.mjs +1 -2
  96. package/dist/runtime/globals.d.mts +6 -39
  97. package/dist/runtime/globals.mjs +0 -1
  98. package/dist/runtime/iconv.d.mts +1 -1
  99. package/dist/runtime/iconv.mjs +1 -2
  100. package/dist/runtime/idp.d.mts +1 -1
  101. package/dist/runtime/idp.mjs +1 -2
  102. package/dist/runtime/index.d.mts +8 -8
  103. package/dist/runtime/index.mjs +7 -8
  104. package/dist/runtime/secretmanager.d.mts +1 -1
  105. package/dist/runtime/secretmanager.mjs +1 -2
  106. package/dist/runtime/workflow.d.mts +1 -1
  107. package/dist/runtime/workflow.mjs +1 -2
  108. package/dist/{runtime-2nzOZCUb.mjs → runtime-n9NCkjee.mjs} +65 -232
  109. package/dist/runtime-n9NCkjee.mjs.map +1 -0
  110. package/dist/{schema-1msIhXwA.mjs → schema-BhkpP5Hw.mjs} +3 -4
  111. package/dist/schema-BhkpP5Hw.mjs.map +1 -0
  112. package/dist/{secret-file-CWzF8rry.mjs → secret-file-DBqZhjFQ.mjs} +1 -2
  113. package/dist/{secret-file-CWzF8rry.mjs.map → secret-file-DBqZhjFQ.mjs.map} +1 -1
  114. package/dist/{secretmanager-CKLB3wAQ.d.mts → secretmanager-B3n4KHfm.d.mts} +1 -1
  115. package/dist/{secretmanager-B9h-U_8U.mjs → secretmanager-BVxw3ih_.mjs} +2 -3
  116. package/dist/{secretmanager-B9h-U_8U.mjs.map → secretmanager-BVxw3ih_.mjs.map} +1 -1
  117. package/dist/seed/index.mjs +0 -1
  118. package/dist/seed/index.mjs.map +1 -1
  119. package/dist/{seed-BH2FbrPV.mjs → seed-jf3008-h.mjs} +5 -16
  120. package/dist/seed-jf3008-h.mjs.map +1 -0
  121. package/dist/{service-wI3Hvrgx.mjs → service-CCL8ruDf.mjs} +3 -4
  122. package/dist/service-CCL8ruDf.mjs.map +1 -0
  123. package/dist/service-D6yonf2I.mjs +3 -0
  124. package/dist/{service-DMohAx8a2.mjs → service-DU1mVzri.mjs} +3 -4
  125. package/dist/service-DU1mVzri.mjs.map +1 -0
  126. package/dist/{telemetry-BQbbVo2t.mjs → telemetry-CdqJEzkj.mjs} +2 -3
  127. package/dist/{telemetry-BQbbVo2t.mjs.map → telemetry-CdqJEzkj.mjs.map} +1 -1
  128. package/dist/telemetry-ClwW5ohF.mjs +3 -0
  129. package/dist/test-env-key-D9kM6ETE.mjs +49 -0
  130. package/dist/test-env-key-D9kM6ETE.mjs.map +1 -0
  131. package/dist/type-source-DH_LH20p.mjs +13 -0
  132. package/dist/type-source-DH_LH20p.mjs.map +1 -0
  133. package/dist/{types-CmzfQP_m.mjs → types-B2RpYyA_.mjs} +2 -3
  134. package/dist/types-B2RpYyA_.mjs.map +1 -0
  135. package/dist/types-ClhIrW_C.mjs +4 -0
  136. package/dist/{tailordb-C-ar4XCX.d.mts → types-DCUhgpyI.d.mts} +142 -221
  137. package/dist/{plugin-DylAsA4Z.d.mts → types-DhO_VEZd.d.mts} +119 -179
  138. package/dist/types-DwDgacni.d.mts +338 -0
  139. package/dist/utils/test/index.d.mts +4 -3
  140. package/dist/utils/test/index.mjs +1 -2
  141. package/dist/utils/test/index.mjs.map +1 -1
  142. package/dist/vitest/environment.mjs +1 -2
  143. package/dist/vitest/environment.mjs.map +1 -1
  144. package/dist/vitest/index.d.mts +42 -5
  145. package/dist/vitest/index.mjs +133 -4
  146. package/dist/vitest/index.mjs.map +1 -1
  147. package/dist/vitest/setup.mjs +2 -3
  148. package/dist/vitest/setup.mjs.map +1 -1
  149. package/dist/{workflow-CMamswkK.d.mts → workflow-BbKvGLQg.d.mts} +1 -1
  150. package/dist/{workflow--aPbA8Uq.mjs → workflow-DgemCAz3.mjs} +2 -3
  151. package/dist/{workflow--aPbA8Uq.mjs.map → workflow-DgemCAz3.mjs.map} +1 -1
  152. package/dist/workflow.generated-DtQwEo-x.d.mts +671 -0
  153. package/docs/cli/application.md +0 -2
  154. package/docs/cli/crashreport.md +0 -2
  155. package/docs/cli/function.md +1 -1
  156. package/docs/cli/user.md +3 -3
  157. package/docs/cli/workspace.md +3 -3
  158. package/docs/configuration.md +0 -2
  159. package/docs/plugin/custom.md +2 -2
  160. package/docs/plugin/index.md +1 -1
  161. package/docs/runtime.md +3 -3
  162. package/docs/services/auth.md +0 -2
  163. package/docs/services/executor.md +0 -2
  164. package/docs/services/resolver.md +2 -4
  165. package/docs/services/tailordb.md +1 -1
  166. package/docs/services/workflow.md +13 -15
  167. package/docs/testing.md +18 -11
  168. package/package.json +9 -8
  169. package/dist/actor-D_2aJjYO.d.mts +0 -24
  170. package/dist/application-DGDmL8i_.mjs.map +0 -1
  171. package/dist/application-nTydHJm8.mjs +0 -4
  172. package/dist/cli/skills.d.mts +0 -1
  173. package/dist/cli/skills.mjs +0 -22
  174. package/dist/cli/skills.mjs.map +0 -1
  175. package/dist/client-F0a4cWUM.mjs.map +0 -1
  176. package/dist/enum-constants-C7DaWeQo.mjs.map +0 -1
  177. package/dist/env-B-g-qgE4.d.mts +0 -7
  178. package/dist/field-C4zdJLW5.mjs.map +0 -1
  179. package/dist/globals-ByrCoDip.mjs.map +0 -1
  180. package/dist/job-BpsFXPbi.mjs.map +0 -1
  181. package/dist/kysely-type-D1e0Vwkd.mjs.map +0 -1
  182. package/dist/mock-DMgIygjE.mjs.map +0 -1
  183. package/dist/package-json-wzO6nV9O.mjs +0 -4
  184. package/dist/registry-D0uB0OrK.mjs +0 -178
  185. package/dist/registry-D0uB0OrK.mjs.map +0 -1
  186. package/dist/runtime-2nzOZCUb.mjs.map +0 -1
  187. package/dist/schema-1msIhXwA.mjs.map +0 -1
  188. package/dist/seed-BH2FbrPV.mjs.map +0 -1
  189. package/dist/service-BHQIerYh.mjs +0 -4
  190. package/dist/service-DMohAx8a2.mjs.map +0 -1
  191. package/dist/service-wI3Hvrgx.mjs.map +0 -1
  192. package/dist/telemetry-w92bvGdC.mjs +0 -4
  193. package/dist/types-2Be3wSMc.mjs +0 -5
  194. package/dist/types-CmzfQP_m.mjs.map +0 -1
  195. package/dist/workflow.generated--1Qc15Et.d.mts +0 -1471
  196. package/docs/generator/builtin.md +0 -257
  197. package/docs/generator/custom.md +0 -147
  198. package/docs/generator/index.md +0 -66
package/CHANGELOG.md CHANGED
@@ -1,11 +1,98 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
- ## 1.66.1
3
+ ## 2.0.0-next.1
4
+ ### Major Changes
5
+
6
+
7
+
8
+ - [#1442](https://github.com/tailor-platform/sdk/pull/1442) [`07cc256`](https://github.com/tailor-platform/sdk/commit/07cc256b9f1d695694d67438e1b0cb6df096ece8) Thanks [@dqn](https://github.com/dqn)! - Remove the deprecated `auth.invoker("<machine-user>")` helper. Pass machine user names directly as `authInvoker` strings in resolver, executor, and workflow APIs.
9
+
10
+
11
+
12
+ - [#1440](https://github.com/tailor-platform/sdk/pull/1440) [`f0895f4`](https://github.com/tailor-platform/sdk/commit/f0895f4231578e54229004d3aa5bac6bd24361e3) Thanks [@dqn](https://github.com/dqn)! - Remove `defineGenerators()` and legacy `generators` config support. Use `definePlugins()` with the built-in plugin packages for code generation.
13
+
14
+
15
+
16
+ - [#1441](https://github.com/tailor-platform/sdk/pull/1441) [`7604ad5`](https://github.com/tailor-platform/sdk/commit/7604ad5fdf27b791e8f1db880faed156cd6554d5) Thanks [@dqn](https://github.com/dqn)! - Remove support for wrapping `tailor-sdk function test-run --arg` resolver input in an `input` object. Pass resolver input fields directly as the `--arg` JSON value.
17
+
18
+
19
+
20
+ - [#1460](https://github.com/tailor-platform/sdk/pull/1460) [`f49c6d1`](https://github.com/tailor-platform/sdk/commit/f49c6d1b5a856969cb4e04ae7d3a87ed34aa020f) Thanks [@dqn](https://github.com/dqn)! - Remove the v1 runtime globals compatibility layer. Importing from `@tailor-platform/sdk` no longer activates the ambient `tailor.*` / `tailordb.*` declarations; opt into globals with `@tailor-platform/sdk/runtime/globals` or use the typed wrappers from `@tailor-platform/sdk/runtime`.
21
+
22
+ The capital-cased `Tailordb.*` namespace is removed. If your project still references `Tailordb.QueryResult`, `Tailordb.CommandType`, `Tailordb.Client`, or `typeof Tailordb.Client`, migrate before upgrading: run `pnpm dlx @tailor-platform/sdk-codemod v2/tailordb-namespace` to rewrite them to lowercase `tailordb.*`, then add `import "@tailor-platform/sdk/runtime/globals"` so the rewritten references resolve.
23
+
24
+
25
+ - [#1459](https://github.com/tailor-platform/sdk/pull/1459) [`2c3d7ad`](https://github.com/tailor-platform/sdk/commit/2c3d7add213b171df2959b8a14e8dc2e3c3a7ec7) Thanks [@dqn](https://github.com/dqn)! - Remove the deprecated `tailor-sdk-skills` binary shim. Use `tailor-sdk skills install` to install the bundled Tailor SDK agent skill.
26
+
27
+
28
+
29
+ - [#1457](https://github.com/tailor-platform/sdk/pull/1457) [`84325f8`](https://github.com/tailor-platform/sdk/commit/84325f8602a5631b7c323c997b1425235509920e) Thanks [@dqn](https://github.com/dqn)! - Remove deprecated CLI aliases for the v2 command surface. Use `tailor-sdk deploy` instead of `tailor-sdk apply`, `tailor-sdk crashreport` instead of `tailor-sdk crash-report`, and the hyphenated `--machine-user` option instead of the hidden `--machineuser` alias.
30
+
31
+ Fix the v2 CLI rename codemod to migrate the hidden `--machineuser` option to `--machine-user`.
32
+
33
+
34
+ - [#1462](https://github.com/tailor-platform/sdk/pull/1462) [`77e7f45`](https://github.com/tailor-platform/sdk/commit/77e7f4512ddd141a8858ab37a3c48d8ad7e16543) Thanks [@dqn](https://github.com/dqn)! - Require `FunctionExecution.contentHash` for `function logs` stack trace source mapping. Executions without a content hash now show raw stack traces instead of mapping against the current function bundle.
35
+
36
+
37
+
38
+ - [#1458](https://github.com/tailor-platform/sdk/pull/1458) [`ad04913`](https://github.com/tailor-platform/sdk/commit/ad049131d61dfc9f96bff8ffe7c5e5e261523b14) Thanks [@dqn](https://github.com/dqn)! - Store CLI human users by stable subject ID in the platform config instead of email, while preserving email for display and migrating legacy email-keyed entries on login or token refresh.
39
+
40
+
41
+
42
+ - [#1438](https://github.com/tailor-platform/sdk/pull/1438) [`2c552cd`](https://github.com/tailor-platform/sdk/commit/2c552cd716f9abbe90ec4b22e51d0cde155c2bf9) Thanks [@dqn](https://github.com/dqn)! - Align workflow job `.trigger()` with the platform runtime. Job triggers now require a mocked workflow runtime in tests instead of running job bodies locally, and `trigger()` returns the job result directly instead of a Promise wrapper. Use `mockWorkflow()` to mock trigger results in tests, or `runWorkflowLocally()` for full-chain local workflow tests.
43
+
44
+
45
+ ### Patch Changes
46
+
47
+
48
+
49
+ - [#1425](https://github.com/tailor-platform/sdk/pull/1425) [`644dca8`](https://github.com/tailor-platform/sdk/commit/644dca8ee631ff18550646d3d82bad76fba6bc33) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency graphql to v16.14.2
50
+
51
+
52
+
53
+ - [#1429](https://github.com/tailor-platform/sdk/pull/1429) [`b933f29`](https://github.com/tailor-platform/sdk/commit/b933f291b99efb3668077cd7870abe979dc3b10b) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update rolldown to v1.1.1
54
+
55
+
56
+
57
+ - [#1433](https://github.com/tailor-platform/sdk/pull/1433) [`4d07f2f`](https://github.com/tailor-platform/sdk/commit/4d07f2fd814bda5886c8f0c9546f21128dcce74b) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency es-toolkit to v1.47.1
58
+
59
+
60
+
61
+ - [#1448](https://github.com/tailor-platform/sdk/pull/1448) [`4ce01dd`](https://github.com/tailor-platform/sdk/commit/4ce01dd851dae7754103a918ba89afe073f942c6) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update @connectrpc to v2.1.2
62
+
63
+
64
+
65
+ - [#1390](https://github.com/tailor-platform/sdk/pull/1390) [`388f3d6`](https://github.com/tailor-platform/sdk/commit/388f3d69b722589cd5cca7bbbc3667a849ecaa3b) Thanks [@toiroakr](https://github.com/toiroakr)! - Guarantee that importing the SDK never loads zod in user projects — neither zod runtime code in bundled functions nor zod type computation in tsc. Internal type definitions are reorganized into per-layer pure type modules, and new CI checks verify every user-facing entry point stays zod-free at both the type and runtime level and that the internal module graph has no import cycles.
66
+
67
+ ## 2.0.0-next.0
68
+ ### Major Changes
69
+
70
+
71
+
72
+ - [#1451](https://github.com/tailor-platform/sdk/pull/1451) [`3e6d582`](https://github.com/tailor-platform/sdk/commit/3e6d582a37d83a42302339cc4aea1d3dd11e8a81) Thanks [@tailor-platform-pr-trigger](https://github.com/apps/tailor-platform-pr-trigger)! - Start the v2 release line. v2 introduces breaking changes to the SDK API and CLI; run `tailor-sdk upgrade` to apply the bundled codemods when migrating. Prereleases are published to the `next` dist-tag — install with `@tailor-platform/sdk@next`.
73
+
74
+
4
75
  ### Patch Changes
5
76
 
6
77
 
7
78
 
8
- - [#1428](https://github.com/tailor-platform/sdk/pull/1428) [`753ac38`](https://github.com/tailor-platform/sdk/commit/753ac3876319d007322c23a7052a2399d194fb72) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency semver to v7.8.4
79
+ - [#1449](https://github.com/tailor-platform/sdk/pull/1449) [`016aff6`](https://github.com/tailor-platform/sdk/commit/016aff6aab31c334c57a5e5244453f2dd559c008) Thanks [@k1LoW](https://github.com/k1LoW)! - Document the `userAuthPolicy`, `gqlOperations`, and `lang` options of `defineIdp()` in the IdP service guide, including the password policy fields, allowed email domains, Google/Microsoft social login, the read-only `"query"` shortcut, and the cross-field validation constraints.
80
+
81
+
82
+
83
+ - [#1450](https://github.com/tailor-platform/sdk/pull/1450) [`162ba62`](https://github.com/tailor-platform/sdk/commit/162ba629e0d511593718f289b93788d5d56778da) Thanks [@toiroakr](https://github.com/toiroakr)! - Update OpenTelemetry runtime dependencies to 2.8.0 to resolve a moderate security advisory (GHSA-8988-4f7v-96qf) in `@opentelemetry/core`
84
+
85
+
86
+
87
+ - [#1432](https://github.com/tailor-platform/sdk/pull/1432) [`3a854a3`](https://github.com/tailor-platform/sdk/commit/3a854a3a10b938ce3cf6fe7527de4ab56ecf48d5) Thanks [@toiroakr](https://github.com/toiroakr)! - Roll back a migration's pre-migration schema changes when its data migration (`migrate.ts`) fails during `apply`. A failed migration now leaves the workspace at its prior checkpoint and prior schema instead of half-applied, so subsequent deploys are no longer blocked by opaque "Remote schema drift detected" errors.
88
+
89
+
90
+
91
+ - [#1422](https://github.com/tailor-platform/sdk/pull/1422) [`f3f8427`](https://github.com/tailor-platform/sdk/commit/f3f84277fe1942601d0fcbb8a64c2c26823b5624) Thanks [@dqn](https://github.com/dqn)! - Internal cleanup of proto field optionality handling. No behavior change.
92
+
93
+
94
+
95
+ - [#1421](https://github.com/tailor-platform/sdk/pull/1421) [`b933f47`](https://github.com/tailor-platform/sdk/commit/b933f474d65f8dfed56f3991aae3a52589368b10) Thanks [@dqn](https://github.com/dqn)! - Corrupted or hand-edited TailorDB migration snapshot/diff files now fail with a clear validation error when loaded, instead of causing undefined behavior later.
9
96
 
10
97
  ## 1.66.0
11
98
  ### Minor Changes
@@ -0,0 +1,3 @@
1
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-DqS1yBg3.mjs";
2
+
3
+ export { defineApplication, generatePluginFilesIfNeeded };
@@ -1,17 +1,13 @@
1
-
2
- import { n as isSdkBranded } from "./brand-DlnJ375c.mjs";
3
- import { a as fetchAll, d as initOAuth2Client } from "./client-F0a4cWUM.mjs";
4
- import { t as assertDefined } from "./assert-CKfwrmCV.mjs";
5
- import { a as parseBoolean, n as logger, r as styles } from "./logger-DpJyJvNz.mjs";
6
- import { a as TailorFieldSchema, i as AuthInvokerSchema, n as ExecutorSchema, o as loadFilesWithIgnores, r as AuthConfigSchema, s as functionSchema, t as createExecutorService } from "./service-wI3Hvrgx.mjs";
7
- import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-C7DaWeQo.mjs";
8
- import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
9
- import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-BHPxPXmn.mjs";
10
- import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-D1e0Vwkd.mjs";
11
- import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-BH2FbrPV.mjs";
12
- import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
13
- import { t as createCLIError } from "./errors-EsY4XO6O.mjs";
14
- import { n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-CWzF8rry.mjs";
1
+ import { n as isSdkBranded } from "./brand-Eo4pLXPJ.mjs";
2
+ import { a as fetchAll, d as initOAuth2Client, l as fetchUserInfo } from "./client-z_oHGVNy.mjs";
3
+ import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
4
+ import { a as parseBoolean, n as logger, r as styles } from "./logger-CxF-Ex5d.mjs";
5
+ import { a as TailorFieldSchema, i as AuthInvokerSchema, n as ExecutorSchema, o as loadFilesWithIgnores, r as AuthConfigSchema, s as functionSchema, t as createExecutorService } from "./service-CCL8ruDf.mjs";
6
+ import { t as multiline } from "./multiline-sfHpTZZK.mjs";
7
+ import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
8
+ import { t as createCLIError } from "./errors-Dtf2WPaW.mjs";
9
+ import { n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-DBqZhjFQ.mjs";
10
+ import { t as isPluginGeneratedType } from "./type-source-DH_LH20p.mjs";
15
11
  import { builtinModules, createRequire } from "node:module";
16
12
  import { z } from "zod";
17
13
  import * as fs$1 from "node:fs";
@@ -87,43 +83,6 @@ const AppConfigSchema = z.object({
87
83
  secrets: z.unknown().optional()
88
84
  });
89
85
 
90
- //#endregion
91
- //#region src/parser/generator-config/schema.ts
92
- const DependencyKindSchema = z.enum([
93
- "tailordb",
94
- "resolver",
95
- "executor"
96
- ]);
97
- const KyselyTypeConfigSchema = z.tuple([z.literal("@tailor-platform/kysely-type"), z.object({ distPath: z.string() })]);
98
- const SeedConfigSchema = z.tuple([z.literal("@tailor-platform/seed"), z.object({
99
- distPath: z.string(),
100
- machineUserName: z.string().optional(),
101
- disableIdpUserSync: z.object({
102
- userToIdp: z.boolean().optional(),
103
- idpToUser: z.boolean().optional()
104
- }).optional()
105
- })]);
106
- const EnumConstantsConfigSchema = z.tuple([z.literal("@tailor-platform/enum-constants"), z.object({ distPath: z.string() })]);
107
- const FileUtilsConfigSchema = z.tuple([z.literal("@tailor-platform/file-utils"), z.object({ distPath: z.string() })]);
108
- const CodeGeneratorSchema = z.object({
109
- id: z.string(),
110
- description: z.string(),
111
- dependencies: z.array(DependencyKindSchema),
112
- processType: z.function().optional(),
113
- processResolver: z.function().optional(),
114
- processExecutor: z.function().optional(),
115
- processTailorDBNamespace: z.function().optional(),
116
- processResolverNamespace: z.function().optional(),
117
- aggregate: z.function({ output: z.any() })
118
- });
119
- const BaseGeneratorConfigSchema = z.union([
120
- KyselyTypeConfigSchema,
121
- SeedConfigSchema,
122
- EnumConstantsConfigSchema,
123
- FileUtilsConfigSchema,
124
- CodeGeneratorSchema
125
- ]);
126
-
127
86
  //#endregion
128
87
  //#region src/parser/plugin-config/schema.ts
129
88
  const PluginConfigSchema = z.object({
@@ -141,15 +100,6 @@ const PluginConfigSchema = z.object({
141
100
  return !(p.onTypeLoaded || p.onNamespaceLoaded) || !!p.importPath;
142
101
  }, { message: "importPath is required when plugin has definition-time hooks (onTypeLoaded/onNamespaceLoaded)" }).transform((plugin) => plugin);
143
102
 
144
- //#endregion
145
- //#region src/plugin/builtin/registry.ts
146
- const builtinPlugins = new Map([
147
- [KyselyGeneratorID, (options) => kyselyTypePlugin(options)],
148
- [SeedGeneratorID, (options) => seedPlugin(options)],
149
- [EnumConstantsGeneratorID, (options) => enumConstantsPlugin(options)],
150
- [FileUtilsGeneratorID, (options) => fileUtilsPlugin(options)]
151
- ]);
152
-
153
103
  //#endregion
154
104
  //#region src/cli/shared/token-store.ts
155
105
  const SERVICE_NAME = "tailor-platform-cli";
@@ -238,14 +188,19 @@ const pfUserFileSchema = z.object({
238
188
  refresh_token: z.string().optional()
239
189
  });
240
190
  const pfUserSchemaV2 = z.discriminatedUnion("storage", [pfUserKeyringSchema, pfUserFileSchema]);
191
+ const pfUserKeyringSchemaV3 = pfUserKeyringSchema.extend({ email: z.string().optional() });
192
+ const pfUserFileSchemaV3 = pfUserFileSchema.extend({ email: z.string().optional() });
193
+ const pfUserSchemaV3 = z.discriminatedUnion("storage", [pfUserKeyringSchemaV3, pfUserFileSchemaV3]);
241
194
  const pfConfigSchemaV1 = z.object({
242
195
  version: z.literal(1),
243
196
  users: z.partialRecord(z.string(), pfUserSchemaV1),
244
197
  profiles: z.partialRecord(z.string(), pfProfileSchema),
245
198
  current_user: z.string().nullable()
246
199
  });
247
- const LATEST_CONFIG_VERSION = 2;
200
+ const V2_CONFIG_VERSION = 2;
201
+ const LATEST_CONFIG_VERSION = 3;
248
202
  const V2_MIN_SDK_VERSION = "1.29.0";
203
+ const V3_MIN_SDK_VERSION = "2.0.0";
249
204
  const semverSchema = z.templateLiteral([
250
205
  z.number().int(),
251
206
  ".",
@@ -254,7 +209,7 @@ const semverSchema = z.templateLiteral([
254
209
  z.number().int()
255
210
  ]);
256
211
  const pfConfigSchemaV2 = z.object({
257
- version: z.literal(LATEST_CONFIG_VERSION),
212
+ version: z.literal(V2_CONFIG_VERSION),
258
213
  min_sdk_version: semverSchema,
259
214
  latest_version: z.number().int().optional(),
260
215
  latest_min_sdk_version: semverSchema.optional(),
@@ -262,6 +217,15 @@ const pfConfigSchemaV2 = z.object({
262
217
  profiles: z.partialRecord(z.string(), pfProfileSchema),
263
218
  current_user: z.string().nullable()
264
219
  });
220
+ const pfConfigSchemaV3 = z.object({
221
+ version: z.literal(LATEST_CONFIG_VERSION),
222
+ min_sdk_version: semverSchema,
223
+ latest_version: z.number().int().optional(),
224
+ latest_min_sdk_version: semverSchema.optional(),
225
+ users: z.partialRecord(z.string(), pfUserSchemaV3),
226
+ profiles: z.partialRecord(z.string(), pfProfileSchema),
227
+ current_user: z.string().nullable()
228
+ });
265
229
  function platformConfigPath() {
266
230
  if (!xdgConfig) throw new Error("User home directory not found");
267
231
  return path.join(xdgConfig, "tailor-platform", "config.yaml");
@@ -285,13 +249,48 @@ function migrateV1ToV2(v1Config) {
285
249
  };
286
250
  }
287
251
  return {
288
- version: LATEST_CONFIG_VERSION,
252
+ version: V2_CONFIG_VERSION,
289
253
  min_sdk_version: V2_MIN_SDK_VERSION,
290
254
  users,
291
255
  profiles: v1Config.profiles,
292
256
  current_user: v1Config.current_user
293
257
  };
294
258
  }
259
+ function inferEmailFromUserId(user) {
260
+ return z.email().safeParse(user).success ? user : void 0;
261
+ }
262
+ function findConfigUserKey(config, user) {
263
+ if (config.users[user]) return user;
264
+ return Object.entries(config.users).find(([, entry]) => entry?.email === user)?.[0];
265
+ }
266
+ function migrateV2ToV3(v2Config) {
267
+ const users = {};
268
+ for (const [user, entry] of Object.entries(v2Config.users)) {
269
+ if (!entry) continue;
270
+ const email = inferEmailFromUserId(user);
271
+ users[user] = {
272
+ ...entry,
273
+ ...email ? { email } : {}
274
+ };
275
+ }
276
+ return {
277
+ version: LATEST_CONFIG_VERSION,
278
+ min_sdk_version: V3_MIN_SDK_VERSION,
279
+ users,
280
+ profiles: v2Config.profiles,
281
+ current_user: v2Config.current_user
282
+ };
283
+ }
284
+ function migrateV1ToV3(v1Config) {
285
+ return migrateV2ToV3(migrateV1ToV2(v1Config));
286
+ }
287
+ async function warnIfNewerConfigAvailable(config) {
288
+ if (!config.latest_min_sdk_version) return;
289
+ if (lt((await readPackageJson()).version ?? "0.0.0", config.latest_min_sdk_version)) logger.warn(multiline`
290
+ A newer config version (${String(config.latest_version)}) is available.
291
+ Please update your SDK to >= ${config.latest_min_sdk_version}: pnpm update @tailor-platform/sdk
292
+ `);
293
+ }
295
294
  /**
296
295
  * Read Tailor Platform CLI configuration, migrating from tailorctl or v1 if necessary.
297
296
  * @returns Parsed platform configuration
@@ -308,7 +307,7 @@ async function readPlatformConfig() {
308
307
  current_user: null
309
308
  };
310
309
  writePlatformConfig(v1Config);
311
- return migrateV1ToV2(v1Config);
310
+ return migrateV1ToV3(v1Config);
312
311
  }
313
312
  const rawConfig = parseYAML(fs$1.readFileSync(configPath, "utf-8"));
314
313
  tightenSecretFilePermissions(configPath);
@@ -321,18 +320,18 @@ async function readPlatformConfig() {
321
320
  ${updateHint}
322
321
  `);
323
322
  }
323
+ const v3Result = pfConfigSchemaV3.safeParse(rawConfig);
324
+ if (v3Result.success) {
325
+ await warnIfNewerConfigAvailable(v3Result.data);
326
+ return v3Result.data;
327
+ }
324
328
  const v2Result = pfConfigSchemaV2.safeParse(rawConfig);
325
329
  if (v2Result.success) {
326
- if (v2Result.data.latest_min_sdk_version) {
327
- if (lt((await readPackageJson()).version ?? "0.0.0", v2Result.data.latest_min_sdk_version)) logger.warn(multiline`
328
- A newer config version (${String(v2Result.data.latest_version)}) is available.
329
- Please update your SDK to >= ${v2Result.data.latest_min_sdk_version}: pnpm update @tailor-platform/sdk
330
- `);
331
- }
332
- return v2Result.data;
330
+ await warnIfNewerConfigAvailable(v2Result.data);
331
+ return migrateV2ToV3(v2Result.data);
333
332
  }
334
333
  const v1Result = pfConfigSchemaV1.safeParse(rawConfig);
335
- if (v1Result.success) return migrateV1ToV2(v1Result.data);
334
+ if (v1Result.success) return migrateV1ToV3(v1Result.data);
336
335
  throw new Error(multiline`
337
336
  Failed to parse config file at ${configPath}.
338
337
  The file may be corrupted or created by an incompatible SDK version.
@@ -361,9 +360,9 @@ function toV1ForDisk(config) {
361
360
  * By default, V2 configs are converted to V1 for backward compatibility, so an
362
361
  * older SDK can still read the file. Configs containing a keyring user are kept
363
362
  * as V2 regardless, because the keyring storage variant is not representable in
364
- * V1 and downgrading it would silently drop the user's login. Such configs are
365
- * already V2 on disk (a keyring entry is only ever persisted with
366
- * TAILOR_USE_KEYRING set), so keeping V2 does not regress backward compatibility.
363
+ * V1 and downgrading it would silently drop the user's login. V3 configs are
364
+ * kept as V3 because user keys are canonical subject IDs and may include email
365
+ * metadata that is not representable in older versions.
367
366
  * Set TAILOR_USE_KEYRING to write V2 format unconditionally.
368
367
  *
369
368
  * The config file may contain access/refresh tokens when the OS keyring is
@@ -506,7 +505,7 @@ async function loadAccessToken(opts) {
506
505
  `);
507
506
  user = u;
508
507
  }
509
- return await fetchLatestToken(pfConfig, user);
508
+ return (await fetchLatestToken(pfConfig, user)).accessToken;
510
509
  }
511
510
  /**
512
511
  * Resolve the actual token values for a user, reading from keyring or config as appropriate.
@@ -533,22 +532,26 @@ async function resolveTokens(userEntry, user) {
533
532
  * @param config - Platform config
534
533
  * @param user - User identifier
535
534
  * @param tokens - Token data to save
536
- * @param tokens.accessToken
537
- * @param tokens.refreshToken
535
+ * @param tokens.accessToken - Access token to save
536
+ * @param tokens.refreshToken - Optional refresh token to save
538
537
  * @param expiresAt - Token expiration date
538
+ * @param metadata - Optional user metadata to persist with the token entry
539
539
  */
540
- async function saveUserTokens(config, user, tokens, expiresAt) {
540
+ async function saveUserTokens(config, user, tokens, expiresAt, metadata) {
541
+ const email = metadata?.email ?? config.users[user]?.email;
541
542
  if (process.env.TAILOR_USE_KEYRING && await isKeyringAvailable()) {
542
543
  await saveKeyringTokens(user, tokens);
543
544
  config.users[user] = {
544
545
  token_expires_at: expiresAt,
545
- storage: "keyring"
546
+ storage: "keyring",
547
+ ...email ? { email } : {}
546
548
  };
547
549
  } else config.users[user] = {
548
550
  access_token: tokens.accessToken,
549
551
  refresh_token: tokens.refreshToken,
550
552
  token_expires_at: expiresAt,
551
- storage: "file"
553
+ storage: "file",
554
+ ...email ? { email } : {}
552
555
  };
553
556
  }
554
557
  /**
@@ -559,20 +562,50 @@ async function saveUserTokens(config, user, tokens, expiresAt) {
559
562
  async function deleteUserTokens(config, user) {
560
563
  if (config.users[user]?.storage === "keyring") await deleteKeyringTokens(user);
561
564
  }
565
+ function updateUserReferences(config, fromUser, toUser) {
566
+ if (fromUser === toUser) return;
567
+ if (config.current_user === fromUser) config.current_user = toUser;
568
+ for (const profile of Object.values(config.profiles)) if (profile?.user === fromUser) profile.user = toUser;
569
+ }
570
+ /**
571
+ * Remove a legacy alias after a canonical user ID has been written.
572
+ * @param config - Platform config
573
+ * @param legacyUser - Previous user key
574
+ * @param canonicalUser - Canonical user key
575
+ */
576
+ async function removeLegacyUserAlias(config, legacyUser, canonicalUser) {
577
+ if (legacyUser === canonicalUser) return;
578
+ updateUserReferences(config, legacyUser, canonicalUser);
579
+ await deleteUserTokens(config, legacyUser);
580
+ delete config.users[legacyUser];
581
+ }
582
+ function shouldResolveSubjectOnRefresh(user, userEntry) {
583
+ return Boolean(userEntry.email || inferEmailFromUserId(user));
584
+ }
562
585
  /**
563
586
  * Fetch the latest access token, refreshing if necessary.
564
587
  * @param config - Platform config
565
- * @param user - User name
566
- * @returns Latest access token
588
+ * @param user - User identifier
589
+ * @returns Latest access token and the canonical user ID it is stored under
590
+ * (the resolved subject when a legacy email key was migrated during refresh,
591
+ * otherwise the matching config user)
567
592
  */
568
593
  async function fetchLatestToken(config, user) {
569
- const userEntry = config.users[user];
594
+ const storedUser = findConfigUserKey(config, user);
595
+ if (!storedUser) throw new Error(multiline`
596
+ User "${user}" not found.
597
+ Please verify your user name and login using 'tailor-sdk login' command.
598
+ `);
599
+ const userEntry = config.users[storedUser];
570
600
  if (!userEntry) throw new Error(multiline`
571
601
  User "${user}" not found.
572
602
  Please verify your user name and login using 'tailor-sdk login' command.
573
603
  `);
574
- const tokens = await resolveTokens(userEntry, user);
575
- if (new Date(userEntry.token_expires_at) > /* @__PURE__ */ new Date()) return tokens.accessToken;
604
+ const tokens = await resolveTokens(userEntry, storedUser);
605
+ if (new Date(userEntry.token_expires_at) > /* @__PURE__ */ new Date()) return {
606
+ accessToken: tokens.accessToken,
607
+ user: storedUser
608
+ };
576
609
  if (!tokens.refreshToken) throw new Error(multiline`
577
610
  Token expired.
578
611
  Please run 'tailor-sdk login' and try again.
@@ -592,12 +625,27 @@ async function fetchLatestToken(config, user) {
592
625
  `);
593
626
  }
594
627
  const newExpiresAt = new Date(assertDefined(resp.expiresAt, "token refresh response missing expiresAt")).toISOString();
595
- await saveUserTokens(config, user, {
628
+ let resolvedUser = storedUser;
629
+ const previousEmail = userEntry.email ?? inferEmailFromUserId(storedUser);
630
+ let email = previousEmail;
631
+ if (shouldResolveSubjectOnRefresh(storedUser, userEntry)) try {
632
+ const userInfo = await fetchUserInfo(resp.accessToken);
633
+ resolvedUser = userInfo.sub;
634
+ email = userInfo.email;
635
+ } catch (error) {
636
+ logger.debug(`Failed to resolve refreshed token user info: ${String(error)}`);
637
+ }
638
+ await saveUserTokens(config, resolvedUser, {
596
639
  accessToken: resp.accessToken,
597
640
  refreshToken: resp.refreshToken ?? void 0
598
- }, newExpiresAt);
641
+ }, newExpiresAt, { email });
642
+ await removeLegacyUserAlias(config, storedUser, resolvedUser);
643
+ if (previousEmail && email && previousEmail !== email) logger.info(`Updated local user email from "${previousEmail}" to "${email}".`);
599
644
  writePlatformConfig(config);
600
- return resp.accessToken;
645
+ return {
646
+ accessToken: resp.accessToken,
647
+ user: resolvedUser
648
+ };
601
649
  }
602
650
  const DEFAULT_CONFIG_FILENAME = "tailor.config.ts";
603
651
  /**
@@ -639,12 +687,11 @@ function installCliTailordbStub() {
639
687
 
640
688
  //#endregion
641
689
  //#region src/cli/shared/config-loader.ts
642
- const GeneratorConfigSchema = CodeGeneratorSchema.brand("CodeGenerator");
643
690
  /**
644
- * Load Tailor configuration file and associated generators and plugins.
691
+ * Load Tailor configuration file and associated plugins.
645
692
  * @param configPath - Optional explicit config path
646
693
  * @param options - Optional module import behavior.
647
- * @returns Loaded config, generators, plugins, and config path
694
+ * @returns Loaded config, plugins, and config path
648
695
  */
649
696
  async function loadConfig(configPath, options = {}) {
650
697
  installCliTailordbStub();
@@ -661,34 +708,8 @@ async function loadConfig(configPath, options = {}) {
661
708
  const issues = validated.error.issues.map((i) => ` - ${i.path.join(".") || "(root)"}: ${i.message}`).join("\n");
662
709
  throw new Error(`Invalid Tailor config in ${resolvedPath}:\n${issues}`);
663
710
  }
664
- const allGenerators = [];
665
711
  const allPlugins = [];
666
712
  for (const value of Object.values(configModule)) if (Array.isArray(value)) {
667
- const generatorParsed = value.reduce((acc, item) => {
668
- if (!acc.success) return acc;
669
- const baseResult = BaseGeneratorConfigSchema.safeParse(item);
670
- if (baseResult.success && Array.isArray(baseResult.data)) {
671
- const [id, options] = baseResult.data;
672
- const pluginFactory = builtinPlugins.get(id);
673
- if (pluginFactory) {
674
- acc.convertedPlugins.push(pluginFactory(options));
675
- return acc;
676
- }
677
- }
678
- const result = GeneratorConfigSchema.safeParse(item);
679
- if (result.success) acc.items.push(result.data);
680
- else acc.success = false;
681
- return acc;
682
- }, {
683
- success: true,
684
- items: [],
685
- convertedPlugins: []
686
- });
687
- if (generatorParsed.success && (generatorParsed.items.length > 0 || generatorParsed.convertedPlugins.length > 0)) {
688
- allGenerators.push(...generatorParsed.items);
689
- allPlugins.push(...generatorParsed.convertedPlugins);
690
- continue;
691
- }
692
713
  const pluginParsed = value.reduce((acc, item) => {
693
714
  if (!acc.success) return acc;
694
715
  const result = PluginConfigSchema.safeParse(item);
@@ -706,7 +727,6 @@ async function loadConfig(configPath, options = {}) {
706
727
  ...configModule.default,
707
728
  path: resolvedPath
708
729
  },
709
- generators: allGenerators,
710
730
  plugins: allPlugins
711
731
  };
712
732
  }
@@ -907,7 +927,33 @@ function resolveRelativePluginImportPath(pluginImportPath, baseDirs) {
907
927
  }
908
928
 
909
929
  //#endregion
910
- //#region src/types/plugin.ts
930
+ //#region src/plugin/guards.ts
931
+ /**
932
+ * Collects the generation-time dependency kinds a plugin requires.
933
+ * @param plugin - The plugin object to inspect.
934
+ * @param plugin.onTailorDBReady - Hook for TailorDB readiness.
935
+ * @param plugin.onResolverReady - Hook for resolver readiness.
936
+ * @param plugin.onExecutorReady - Hook for executor readiness.
937
+ * @returns Set of dependency kinds required by the plugin.
938
+ */
939
+ function getPluginGenerationDependencies(plugin) {
940
+ const deps = /* @__PURE__ */ new Set();
941
+ if (plugin.onTailorDBReady) deps.add("tailordb");
942
+ if (plugin.onResolverReady) deps.add("resolver");
943
+ if (plugin.onExecutorReady) deps.add("executor");
944
+ return deps;
945
+ }
946
+ /**
947
+ * Checks if a plugin has any generation-time hooks.
948
+ * @param plugin - The plugin object to inspect.
949
+ * @param plugin.onTailorDBReady - Hook for TailorDB readiness.
950
+ * @param plugin.onResolverReady - Hook for resolver readiness.
951
+ * @param plugin.onExecutorReady - Hook for executor readiness.
952
+ * @returns True if the plugin has at least one generation hook.
953
+ */
954
+ function hasGenerationHooks(plugin) {
955
+ return !!(plugin.onTailorDBReady || plugin.onResolverReady || plugin.onExecutorReady);
956
+ }
911
957
  /**
912
958
  * Checks if a plugin executor uses file-based resolution.
913
959
  * @param executor - The plugin executor to check.
@@ -1922,14 +1968,14 @@ const NORMALIZER_IDENTIFIER = "__tailor_normalizeAuthInvoker";
1922
1968
  /**
1923
1969
  * Build the source text of the injected normalizer helper.
1924
1970
  *
1925
- * Accepts either a plain string (machine user name) or the object form
1926
- * `{ namespace, machineUserName }`, and always returns the object form.
1971
+ * Accepts a plain string machine user name and returns the object form
1972
+ * expected by the platform RPC.
1927
1973
  * The auth namespace is baked in at bundle time.
1928
1974
  * @param authNamespace - Auth service namespace to embed
1929
1975
  * @returns Source line defining the helper
1930
1976
  */
1931
1977
  function buildNormalizerHelperSource(authNamespace) {
1932
- return `const ${NORMALIZER_IDENTIFIER} = (v) => typeof v === "string" ? { namespace: ${JSON.stringify(authNamespace)}, machineUserName: v } : v;\n`;
1978
+ return `const ${NORMALIZER_IDENTIFIER} = (machineUserName) => ({ namespace: ${JSON.stringify(authNamespace)}, machineUserName });\n`;
1933
1979
  }
1934
1980
  /**
1935
1981
  * Extract authInvoker info from a config object expression
@@ -2189,7 +2235,7 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
2189
2235
  } else if (call.kind === "job") {
2190
2236
  const jobName = jobNameMap.get(call.identifierName);
2191
2237
  if (jobName) {
2192
- const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}))()`;
2238
+ const transformedCall = `tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"})`;
2193
2239
  replacements.push({
2194
2240
  start: call.callRange.start,
2195
2241
  end: call.callRange.end,
@@ -4668,7 +4714,7 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
4668
4714
  if (isInsideRemovedRange(call.callRange.start)) continue;
4669
4715
  const jobName = jobNameMap.get(call.identifierName);
4670
4716
  if (jobName) {
4671
- const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}))()`;
4717
+ const transformedCall = `tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"})`;
4672
4718
  replacements.push({
4673
4719
  start: call.callRange.start,
4674
4720
  end: call.callRange.end,
@@ -5066,6 +5112,17 @@ async function loadFileContent(filePath) {
5066
5112
  };
5067
5113
  }
5068
5114
 
5115
+ //#endregion
5116
+ //#region src/cli/shared/auth-namespace.ts
5117
+ /**
5118
+ * Resolve the auth namespace configured for an application.
5119
+ * @param application - Loaded application with local or external Auth config
5120
+ * @returns Auth namespace, or undefined when no Auth config is present
5121
+ */
5122
+ function getApplicationAuthNamespace(application) {
5123
+ return application.authService?.config.name ?? application.config?.auth?.name;
5124
+ }
5125
+
5069
5126
  //#endregion
5070
5127
  //#region src/cli/shared/inline-sourcemap.ts
5071
5128
  /**
@@ -5538,7 +5595,10 @@ async function loadApplication(params) {
5538
5595
  if (workflowService) await workflowService.loadWorkflows();
5539
5596
  const httpAdapterService = defineHttpAdapterService(config.httpAdapter);
5540
5597
  if (httpAdapterService) await httpAdapterService.loadAdapters();
5541
- const triggerContext = await buildTriggerContext(config.workflow, authResult.authService?.config.name);
5598
+ const triggerContext = await buildTriggerContext(config.workflow, getApplicationAuthNamespace({
5599
+ authService: authResult.authService,
5600
+ config
5601
+ }));
5542
5602
  const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
5543
5603
  const bundleLogLevel = resolveBundleLogLevel(config.logLevel);
5544
5604
  const bundledScripts = {
@@ -5616,5 +5676,5 @@ async function loadApplication(params) {
5616
5676
  }
5617
5677
 
5618
5678
  //#endregion
5619
- export { readPlatformConfig as A, loadConfig as C, loadConfigPath as D, loadAccessToken as E, saveUserTokens as M, writePlatformConfig as N, loadMachineUserName as O, hashFile as S, fetchLatestToken as T, createLogLevelTreeshakeOptions as _, WorkflowJobSchema as a, getDistDir as b, INVOKER_EXPR as c, assertUniqueLocalTailorDBTypeNames as d, assertUniqueTailorDBTypeNamesWithExternal as f, composeFunctionTreeshakeOptions as g, platformBundleDefinePlugin as h, resolveInlineSourcemap as i, resolveTokens as j, loadWorkspaceId as k, buildExecutorArgsExpr as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, buildResolverOperationHookExpr as u, resolveBundleLogLevel as v, deleteUserTokens as w, hashContent as x, createBundleCache as y };
5620
- //# sourceMappingURL=application-DGDmL8i_.mjs.map
5679
+ export { loadAccessToken as A, getDistDir as C, deleteUserTokens as D, loadConfig as E, removeLegacyUserAlias as F, resolveTokens as I, saveUserTokens as L, loadMachineUserName as M, loadWorkspaceId as N, fetchLatestToken as O, readPlatformConfig as P, writePlatformConfig as R, createBundleCache as S, hashFile as T, composeFunctionTreeshakeOptions as _, getApplicationAuthNamespace as a, getPluginGenerationDependencies as b, HTTP_METHODS as c, buildResolverOperationHookExpr as d, assertUniqueLocalTailorDBTypeNames as f, platformBundleDefinePlugin as g, stringifyFunction as h, resolveInlineSourcemap as i, loadConfigPath as j, findConfigUserKey as k, INVOKER_EXPR as l, TailorDBTypeSchema as m, generatePluginFilesIfNeeded as n, WorkflowJobSchema as o, assertUniqueTailorDBTypeNamesWithExternal as p, loadApplication as r, ResolverSchema as s, defineApplication as t, buildExecutorArgsExpr as u, createLogLevelTreeshakeOptions as v, hashContent as w, hasGenerationHooks as x, resolveBundleLogLevel as y };
5680
+ //# sourceMappingURL=application-DqS1yBg3.mjs.map