@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.
- package/CHANGELOG.md +89 -2
- package/dist/application-DB2r36Et.mjs +3 -0
- package/dist/{application-DGDmL8i_.mjs → application-DqS1yBg3.mjs} +188 -128
- package/dist/application-DqS1yBg3.mjs.map +1 -0
- package/dist/{assert-CKfwrmCV.mjs → assert-DBxo8jPo.mjs} +1 -2
- package/dist/{assert-CKfwrmCV.mjs.map → assert-DBxo8jPo.mjs.map} +1 -1
- package/dist/{authconnection-D8SJGMpj.mjs → authconnection-D2MhtTN5.mjs} +2 -3
- package/dist/{authconnection-D8SJGMpj.mjs.map → authconnection-D2MhtTN5.mjs.map} +1 -1
- package/dist/{authconnection-BIYzEh2p.d.mts → authconnection-DvUQAjQS.d.mts} +1 -1
- package/dist/{brand-DlnJ375c.mjs → brand-Eo4pLXPJ.mjs} +1 -2
- package/dist/{brand-DlnJ375c.mjs.map → brand-Eo4pLXPJ.mjs.map} +1 -1
- package/dist/cli/index.mjs +78 -131
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +15 -154
- package/dist/cli/lib.mjs +9 -10
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/{client-boxXYevx.mjs → client-Dbohmtkv.mjs} +1 -2
- package/dist/{client-F0a4cWUM.mjs → client-z_oHGVNy.mjs} +8 -6
- package/dist/client-z_oHGVNy.mjs.map +1 -0
- package/dist/completion/zsh-worker.zsh +5 -19
- package/dist/configure/index.d.mts +8 -7
- package/dist/configure/index.mjs +11 -28
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{context-s0lxhu8_.mjs → context-Bd266-ru.mjs} +2 -3
- package/dist/{context-s0lxhu8_.mjs.map → context-Bd266-ru.mjs.map} +1 -1
- package/dist/{context-CUBwSBq4.d.mts → context-BuuIb8CC.d.mts} +1 -1
- package/dist/{crashreport-0EHy-ayY.mjs → crashreport-BsjAkFWw.mjs} +19 -10
- package/dist/{crashreport-0EHy-ayY.mjs.map → crashreport-BsjAkFWw.mjs.map} +1 -1
- package/dist/{crashreport-Bf6uT6mf.mjs → crashreport-pr6Rhvza.mjs} +1 -2
- package/dist/{enum-constants-C7DaWeQo.mjs → enum-constants-j9QBF0cB.mjs} +1 -2
- package/dist/enum-constants-j9QBF0cB.mjs.map +1 -0
- package/dist/{errors-EsY4XO6O.mjs → errors-Dtf2WPaW.mjs} +1 -2
- package/dist/{errors-EsY4XO6O.mjs.map → errors-Dtf2WPaW.mjs.map} +1 -1
- package/dist/{field-C4zdJLW5.mjs → field-DOsJCPFa.mjs} +1 -2
- package/dist/field-DOsJCPFa.mjs.map +1 -0
- package/dist/{file-BzK8z3X-.d.mts → file-BB8Vs9O_.d.mts} +1 -1
- package/dist/{file-B58Dm-2P.mjs → file-_oUZo76X.mjs} +2 -3
- package/dist/{file-B58Dm-2P.mjs.map → file-_oUZo76X.mjs.map} +1 -1
- package/dist/{file-utils-BHPxPXmn.mjs → file-utils-DcyIPFQh.mjs} +2 -3
- package/dist/{file-utils-BHPxPXmn.mjs.map → file-utils-DcyIPFQh.mjs.map} +1 -1
- package/dist/{globals-ByrCoDip.mjs → globals-Crz8o65k.mjs} +53 -5
- package/dist/globals-Crz8o65k.mjs.map +1 -0
- package/dist/http-adapter.generated-WgMnb7Sb.d.mts +580 -0
- package/dist/{iconv-kwrmd1U_.d.mts → iconv-Co-TOPuH.d.mts} +1 -1
- package/dist/{iconv-DreIffeM.mjs → iconv-D2vi8G36.mjs} +2 -3
- package/dist/{iconv-DreIffeM.mjs.map → iconv-D2vi8G36.mjs.map} +1 -1
- package/dist/{idp-Ch95ag8h.mjs → idp-BDbK5gjm.mjs} +2 -3
- package/dist/{idp-Ch95ag8h.mjs.map → idp-BDbK5gjm.mjs.map} +1 -1
- package/dist/{idp-BlBPtXJ-.d.mts → idp-DrhVrLmV.d.mts} +1 -1
- package/dist/{index-QpC0TNbH.d.mts → index-5vPyRu1y.d.mts} +2 -2
- package/dist/{index-Bhjep8cS.d.mts → index-B7AKc18V.d.mts} +2 -2
- package/dist/{index-BdLqzJDu.d.mts → index-BlpzXncY.d.mts} +25 -247
- package/dist/{index-DRhMpdnA.d.mts → index-CK7u9isy.d.mts} +8 -8
- package/dist/{index-CZ2r3qiO.d.mts → index-CNYe5lnW.d.mts} +2 -2
- package/dist/{index-Db2RvnEH.d.mts → index-DjUdWlzf.d.mts} +2 -2
- package/dist/index-ZePLwxw7.d.mts +208 -0
- package/dist/{interceptor-DOqRkCya.mjs → interceptor-D-q1rvRl.mjs} +1 -2
- package/dist/{interceptor-DOqRkCya.mjs.map → interceptor-D-q1rvRl.mjs.map} +1 -1
- package/dist/{job-BpsFXPbi.mjs → job-fuc3j1Ma.mjs} +9 -10
- package/dist/job-fuc3j1Ma.mjs.map +1 -0
- package/dist/kysely/index.mjs +0 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-D1e0Vwkd.mjs → kysely-type-DR8uzZTA.mjs} +2 -3
- package/dist/kysely-type-DR8uzZTA.mjs.map +1 -0
- package/dist/{logger-DpJyJvNz.mjs → logger-CxF-Ex5d.mjs} +1 -2
- package/dist/{logger-DpJyJvNz.mjs.map → logger-CxF-Ex5d.mjs.map} +1 -1
- package/dist/{mock-DMgIygjE.mjs → mock-BjFj5o1I.mjs} +9 -11
- package/dist/mock-BjFj5o1I.mjs.map +1 -0
- package/dist/{multiline-Cf9ODpr1.mjs → multiline-sfHpTZZK.mjs} +1 -2
- package/dist/{multiline-Cf9ODpr1.mjs.map → multiline-sfHpTZZK.mjs.map} +1 -1
- package/dist/{package-json-DcQApfPQ.mjs → package-json-8b0O9TlX.mjs} +1 -2
- package/dist/{package-json-DcQApfPQ.mjs.map → package-json-8b0O9TlX.mjs.map} +1 -1
- package/dist/package-json-Cv2Z-TqQ.mjs +3 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -2
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -2
- package/dist/plugin/index.d.mts +1 -3
- package/dist/plugin/index.mjs +0 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/registry-DdsYlL_P.mjs +51 -0
- package/dist/registry-DdsYlL_P.mjs.map +1 -0
- package/dist/{repl-editor-CJG3sz7A.mjs → repl-editor-DmGr9zMw.mjs} +2 -3
- package/dist/{repl-editor-CJG3sz7A.mjs.map → repl-editor-DmGr9zMw.mjs.map} +1 -1
- package/dist/{chunk-BkoGK1jX.mjs → rolldown-runtime-DXywRVcq.mjs} +0 -1
- package/dist/runtime/authconnection.d.mts +1 -1
- package/dist/runtime/authconnection.mjs +1 -2
- package/dist/runtime/context.d.mts +1 -1
- package/dist/runtime/context.mjs +1 -2
- package/dist/runtime/file.d.mts +1 -1
- package/dist/runtime/file.mjs +1 -2
- package/dist/runtime/globals.d.mts +6 -39
- package/dist/runtime/globals.mjs +0 -1
- package/dist/runtime/iconv.d.mts +1 -1
- package/dist/runtime/iconv.mjs +1 -2
- package/dist/runtime/idp.d.mts +1 -1
- package/dist/runtime/idp.mjs +1 -2
- package/dist/runtime/index.d.mts +8 -8
- package/dist/runtime/index.mjs +7 -8
- package/dist/runtime/secretmanager.d.mts +1 -1
- package/dist/runtime/secretmanager.mjs +1 -2
- package/dist/runtime/workflow.d.mts +1 -1
- package/dist/runtime/workflow.mjs +1 -2
- package/dist/{runtime-2nzOZCUb.mjs → runtime-n9NCkjee.mjs} +65 -232
- package/dist/runtime-n9NCkjee.mjs.map +1 -0
- package/dist/{schema-1msIhXwA.mjs → schema-BhkpP5Hw.mjs} +3 -4
- package/dist/schema-BhkpP5Hw.mjs.map +1 -0
- package/dist/{secret-file-CWzF8rry.mjs → secret-file-DBqZhjFQ.mjs} +1 -2
- package/dist/{secret-file-CWzF8rry.mjs.map → secret-file-DBqZhjFQ.mjs.map} +1 -1
- package/dist/{secretmanager-CKLB3wAQ.d.mts → secretmanager-B3n4KHfm.d.mts} +1 -1
- package/dist/{secretmanager-B9h-U_8U.mjs → secretmanager-BVxw3ih_.mjs} +2 -3
- package/dist/{secretmanager-B9h-U_8U.mjs.map → secretmanager-BVxw3ih_.mjs.map} +1 -1
- package/dist/seed/index.mjs +0 -1
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{seed-BH2FbrPV.mjs → seed-jf3008-h.mjs} +5 -16
- package/dist/seed-jf3008-h.mjs.map +1 -0
- package/dist/{service-wI3Hvrgx.mjs → service-CCL8ruDf.mjs} +3 -4
- package/dist/service-CCL8ruDf.mjs.map +1 -0
- package/dist/service-D6yonf2I.mjs +3 -0
- package/dist/{service-DMohAx8a2.mjs → service-DU1mVzri.mjs} +3 -4
- package/dist/service-DU1mVzri.mjs.map +1 -0
- package/dist/{telemetry-BQbbVo2t.mjs → telemetry-CdqJEzkj.mjs} +2 -3
- package/dist/{telemetry-BQbbVo2t.mjs.map → telemetry-CdqJEzkj.mjs.map} +1 -1
- package/dist/telemetry-ClwW5ohF.mjs +3 -0
- package/dist/test-env-key-D9kM6ETE.mjs +49 -0
- package/dist/test-env-key-D9kM6ETE.mjs.map +1 -0
- package/dist/type-source-DH_LH20p.mjs +13 -0
- package/dist/type-source-DH_LH20p.mjs.map +1 -0
- package/dist/{types-CmzfQP_m.mjs → types-B2RpYyA_.mjs} +2 -3
- package/dist/types-B2RpYyA_.mjs.map +1 -0
- package/dist/types-ClhIrW_C.mjs +4 -0
- package/dist/{tailordb-C-ar4XCX.d.mts → types-DCUhgpyI.d.mts} +142 -221
- package/dist/{plugin-DylAsA4Z.d.mts → types-DhO_VEZd.d.mts} +119 -179
- package/dist/types-DwDgacni.d.mts +338 -0
- package/dist/utils/test/index.d.mts +4 -3
- package/dist/utils/test/index.mjs +1 -2
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -2
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +42 -5
- package/dist/vitest/index.mjs +133 -4
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/setup.mjs +2 -3
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/{workflow-CMamswkK.d.mts → workflow-BbKvGLQg.d.mts} +1 -1
- package/dist/{workflow--aPbA8Uq.mjs → workflow-DgemCAz3.mjs} +2 -3
- package/dist/{workflow--aPbA8Uq.mjs.map → workflow-DgemCAz3.mjs.map} +1 -1
- package/dist/workflow.generated-DtQwEo-x.d.mts +671 -0
- package/docs/cli/application.md +0 -2
- package/docs/cli/crashreport.md +0 -2
- package/docs/cli/function.md +1 -1
- package/docs/cli/user.md +3 -3
- package/docs/cli/workspace.md +3 -3
- package/docs/configuration.md +0 -2
- package/docs/plugin/custom.md +2 -2
- package/docs/plugin/index.md +1 -1
- package/docs/runtime.md +3 -3
- package/docs/services/auth.md +0 -2
- package/docs/services/executor.md +0 -2
- package/docs/services/resolver.md +2 -4
- package/docs/services/tailordb.md +1 -1
- package/docs/services/workflow.md +13 -15
- package/docs/testing.md +18 -11
- package/package.json +9 -8
- package/dist/actor-D_2aJjYO.d.mts +0 -24
- package/dist/application-DGDmL8i_.mjs.map +0 -1
- package/dist/application-nTydHJm8.mjs +0 -4
- package/dist/cli/skills.d.mts +0 -1
- package/dist/cli/skills.mjs +0 -22
- package/dist/cli/skills.mjs.map +0 -1
- package/dist/client-F0a4cWUM.mjs.map +0 -1
- package/dist/enum-constants-C7DaWeQo.mjs.map +0 -1
- package/dist/env-B-g-qgE4.d.mts +0 -7
- package/dist/field-C4zdJLW5.mjs.map +0 -1
- package/dist/globals-ByrCoDip.mjs.map +0 -1
- package/dist/job-BpsFXPbi.mjs.map +0 -1
- package/dist/kysely-type-D1e0Vwkd.mjs.map +0 -1
- package/dist/mock-DMgIygjE.mjs.map +0 -1
- package/dist/package-json-wzO6nV9O.mjs +0 -4
- package/dist/registry-D0uB0OrK.mjs +0 -178
- package/dist/registry-D0uB0OrK.mjs.map +0 -1
- package/dist/runtime-2nzOZCUb.mjs.map +0 -1
- package/dist/schema-1msIhXwA.mjs.map +0 -1
- package/dist/seed-BH2FbrPV.mjs.map +0 -1
- package/dist/service-BHQIerYh.mjs +0 -4
- package/dist/service-DMohAx8a2.mjs.map +0 -1
- package/dist/service-wI3Hvrgx.mjs.map +0 -1
- package/dist/telemetry-w92bvGdC.mjs +0 -4
- package/dist/types-2Be3wSMc.mjs +0 -5
- package/dist/types-CmzfQP_m.mjs.map +0 -1
- package/dist/workflow.generated--1Qc15Et.d.mts +0 -1471
- package/docs/generator/builtin.md +0 -257
- package/docs/generator/custom.md +0 -147
- package/docs/generator/index.md +0 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,98 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
-
##
|
|
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
|
-
- [#
|
|
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
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
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
|
|
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(
|
|
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:
|
|
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
|
|
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
|
-
|
|
327
|
-
|
|
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
|
|
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.
|
|
365
|
-
*
|
|
366
|
-
*
|
|
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
|
|
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
|
|
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,
|
|
575
|
-
if (new Date(userEntry.token_expires_at) > /* @__PURE__ */ new Date()) return
|
|
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
|
-
|
|
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
|
|
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
|
|
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,
|
|
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/
|
|
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
|
|
1926
|
-
*
|
|
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} = (
|
|
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 = `
|
|
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 = `
|
|
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,
|
|
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 {
|
|
5620
|
-
//# sourceMappingURL=application-
|
|
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
|