@tailor-platform/sdk 1.36.0 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/dist/application-C1ipG5Q6.mjs +4 -0
- package/dist/{application-BwboBFcU.mjs → application-DhQrXEld.mjs} +60 -22
- package/dist/application-DhQrXEld.mjs.map +1 -0
- package/dist/{brand-0SscafcY.mjs → brand-D-d15jx3.mjs} +1 -1
- package/dist/{brand-0SscafcY.mjs.map → brand-D-d15jx3.mjs.map} +1 -1
- package/dist/cli/index.mjs +369 -128
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +6 -6
- package/dist/cli/lib.mjs +7 -7
- package/dist/{client-B6icVEv4.mjs → client-BWAbbA1C.mjs} +1 -1
- package/dist/{client-CN15WgW2.mjs → client-xzPXtc_e.mjs} +10 -4
- package/dist/{client-CN15WgW2.mjs.map → client-xzPXtc_e.mjs.map} +1 -1
- package/dist/configure/index.d.mts +4 -5
- package/dist/configure/index.mjs +8 -15
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-CB1UtT3O.mjs → crash-report-BEAiCSCl.mjs} +1 -1
- package/dist/{crash-report-CdxPj_SW.mjs → crash-report-DXhPL8Ue.mjs} +4 -4
- package/dist/{crash-report-CdxPj_SW.mjs.map → crash-report-DXhPL8Ue.mjs.map} +1 -1
- package/dist/{enum-constants-DI85-fPE.mjs → enum-constants-Dx82rSjf.mjs} +1 -1
- package/dist/{enum-constants-DI85-fPE.mjs.map → enum-constants-Dx82rSjf.mjs.map} +1 -1
- package/dist/errors-D9f2UJpT.mjs +43 -0
- package/dist/errors-D9f2UJpT.mjs.map +1 -0
- package/dist/{file-utils-C4rXlOVt.mjs → file-utils-DeWpvq3T.mjs} +1 -1
- package/dist/{file-utils-C4rXlOVt.mjs.map → file-utils-DeWpvq3T.mjs.map} +1 -1
- package/dist/{index-DZN1QFLM.d.mts → index-CHo73Aat.d.mts} +2 -2
- package/dist/{index-CxSLivW7.d.mts → index-CIIXsk3E.d.mts} +2 -2
- package/dist/{index-C7vIBAg8.d.mts → index-Cln_TTZn.d.mts} +2 -2
- package/dist/{index-CYaunQeL.d.mts → index-Cs3fwmLu.d.mts} +33 -13
- package/dist/{index-DDCyefuU.d.mts → index-D_W9-Lvk.d.mts} +2 -2
- package/dist/{interceptor-f7slMkCC.mjs → interceptor-CzaH2Ur6.mjs} +1 -1
- package/dist/{interceptor-f7slMkCC.mjs.map → interceptor-CzaH2Ur6.mjs.map} +1 -1
- package/dist/{job-CPKYCk_e.mjs → job-DkAklmE4.mjs} +2 -2
- package/dist/{job-CPKYCk_e.mjs.map → job-DkAklmE4.mjs.map} +1 -1
- package/dist/{kysely-type-DtnNdHn3.mjs → kysely-type-CwtvQuxh.mjs} +1 -1
- package/dist/{kysely-type-DtnNdHn3.mjs.map → kysely-type-CwtvQuxh.mjs.map} +1 -1
- package/dist/{logger-qz-Y4sBV.mjs → logger-5_JMzHmw.mjs} +42 -3
- package/dist/logger-5_JMzHmw.mjs.map +1 -0
- package/dist/package-json--6dmp6-h.mjs +4 -0
- package/dist/{package-json-CfUqjJaQ.mjs → package-json-BHViVisJ.mjs} +1 -1
- package/dist/{package-json-CfUqjJaQ.mjs.map → package-json-BHViVisJ.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +1 -2
- package/dist/{plugin-CiPUxkyN.d.mts → plugin-D84blivd.d.mts} +67 -11
- package/dist/{runtime-C7RRDaB3.mjs → runtime-ChpwtPut.mjs} +587 -144
- package/dist/runtime-ChpwtPut.mjs.map +1 -0
- package/dist/{schema-D27cW0Ca.mjs → schema-CnwUqPyM.mjs} +4 -361
- package/dist/schema-CnwUqPyM.mjs.map +1 -0
- package/dist/{seed-BZIFDG27.mjs → seed-DrbB1VXd.mjs} +1 -1
- package/dist/{seed-BZIFDG27.mjs.map → seed-DrbB1VXd.mjs.map} +1 -1
- package/dist/service-Bcp6JB3w.mjs +132 -0
- package/dist/service-Bcp6JB3w.mjs.map +1 -0
- package/dist/telemetry-4IOPW6wE.mjs +4 -0
- package/dist/{telemetry-CREcGK8y.mjs → telemetry-DwHuiNiR.mjs} +2 -2
- package/dist/{telemetry-CREcGK8y.mjs.map → telemetry-DwHuiNiR.mjs.map} +1 -1
- package/dist/types-B9ZMosul.mjs +372 -0
- package/dist/types-B9ZMosul.mjs.map +1 -0
- package/dist/types-C45jRrCM.mjs +4 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +7 -3
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/{workflow.generated-8BeGQsVU.d.mts → workflow.generated-BRdcCWfC.d.mts} +2 -2
- package/docs/cli/function.md +42 -16
- package/docs/cli/upgrade.md +51 -0
- package/docs/cli/user.md +1 -1
- package/docs/cli/workflow.md +10 -10
- package/docs/cli-reference.md +23 -14
- package/docs/configuration.md +9 -7
- package/docs/services/auth.md +6 -5
- package/docs/services/executor.md +44 -12
- package/docs/services/resolver.md +6 -13
- package/docs/services/tailordb.md +20 -0
- package/docs/services/workflow.md +4 -3
- package/package.json +10 -10
- package/dist/application-BB5TqXWY.mjs +0 -4
- package/dist/application-BwboBFcU.mjs.map +0 -1
- package/dist/env-_ce3IYbl.d.mts +0 -30
- package/dist/logger-qz-Y4sBV.mjs.map +0 -1
- package/dist/package-json-D5Km1jjt.mjs +0 -4
- package/dist/runtime-C7RRDaB3.mjs.map +0 -1
- package/dist/schema-D27cW0Ca.mjs.map +0 -1
- package/dist/telemetry-C508zIi1.mjs +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.38.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#941](https://github.com/tailor-platform/sdk/pull/941) [`0a1b538`](https://github.com/tailor-platform/sdk/commit/0a1b53886ac738347e0e7fcb4f94e4c713fad316) Thanks [@toiroakr](https://github.com/toiroakr)! - Add `upgrade` command with codemod.com-based architecture for automated SDK version migrations. Codemod execution is handled by the new `@tailor-platform/sdk-codemod` package.
|
|
8
|
+
|
|
9
|
+
- [#986](https://github.com/tailor-platform/sdk/pull/986) [`7de5d91`](https://github.com/tailor-platform/sdk/commit/7de5d91703f7bdd56bf433f60123da7322a6e361) Thanks [@toiroakr](https://github.com/toiroakr)! - Unify machine-user CLI flag naming and add `TAILOR_PLATFORM_MACHINE_USER_NAME` env variable
|
|
10
|
+
|
|
11
|
+
- Add `--machine-user` flag to `query`, `workflow start`, and `login` to align with `function test-run` and the rest of the CLI's kebab-case convention. The previous `--machineuser` flag continues to work as a hidden alias.
|
|
12
|
+
- Add `TAILOR_PLATFORM_MACHINE_USER_NAME` environment variable as a default machine user name for `query`, `workflow start`, and `function test-run`.
|
|
13
|
+
|
|
14
|
+
- [#990](https://github.com/tailor-platform/sdk/pull/990) [`6e9a062`](https://github.com/tailor-platform/sdk/commit/6e9a062b5ac6de3a7f0cd3e11a5d66d4ca85cd87) Thanks [@dqn](https://github.com/dqn)! - `tailor-sdk function logs <executionId>` now displays error details for failed executions. When `getFunctionExecution` returns a stack trace, the deployed script is downloaded automatically and frames are mapped back to the original source files via the inline sourcemap (with clickable file links and code snippets, matching the existing `function test-run` output). When the script cannot be downloaded, the stack trace is missing, or the function has been redeployed after the execution (detected by comparing the registry entry's `updatedAt` against the execution start time), the command falls back to a plain-text `Name: message` display with the raw stack trace to avoid showing misleading source locations.
|
|
15
|
+
|
|
16
|
+
- [#977](https://github.com/tailor-platform/sdk/pull/977) [`44a0781`](https://github.com/tailor-platform/sdk/commit/44a07817272eabe87f9a4f25400fec5231f59e58) Thanks [@haru0017](https://github.com/haru0017)! - Add response customization for incoming webhook trigger executor
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#993](https://github.com/tailor-platform/sdk/pull/993) [`d978a9d`](https://github.com/tailor-platform/sdk/commit/d978a9d26534533bfca78e7c6415cab16279d977) Thanks [@toiroakr](https://github.com/toiroakr)! - Accept a wider range of boolean values for environment variables
|
|
21
|
+
|
|
22
|
+
The following environment variables now accept common truthy/falsy spellings
|
|
23
|
+
(case-insensitive): `true/false`, `1/0`, `yes/no`, `on/off`, `t/f`, `y/n`.
|
|
24
|
+
|
|
25
|
+
- `TAILOR_ENABLE_INLINE_SOURCEMAP`
|
|
26
|
+
- `TAILOR_PLATFORM_SDK_BUILD_ONLY`
|
|
27
|
+
- `DEBUG`
|
|
28
|
+
|
|
29
|
+
Previously only the literal string `"true"` enabled these flags.
|
|
30
|
+
|
|
31
|
+
- [#995](https://github.com/tailor-platform/sdk/pull/995) [`d6bc33c`](https://github.com/tailor-platform/sdk/commit/d6bc33c9b9aee0fdf9cb1edeea58b3cd0bb45f15) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix `createTailorDBHook` to correctly handle `db.object({...}, { array: true })` fields. Previously, array values (and `null`/omitted values for optional array fields) were treated as a single nested object and processed recursively, corrupting the value and causing seed validation to fail with "Expected an array". Array elements are now recursed per element, and non-array values are passed through unchanged.
|
|
32
|
+
|
|
33
|
+
- [#963](https://github.com/tailor-platform/sdk/pull/963) [`0ed350f`](https://github.com/tailor-platform/sdk/commit/0ed350fa90c97634cf7d70ae055550bc021ed1b8) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update vitest to v4.1.4
|
|
34
|
+
|
|
35
|
+
- [#975](https://github.com/tailor-platform/sdk/pull/975) [`120ef30`](https://github.com/tailor-platform/sdk/commit/120ef304e6d4a0593745ad8a0e484aa2cc21202c) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update anthropics/claude-code-action action to v1.0.97
|
|
36
|
+
|
|
37
|
+
- [#976](https://github.com/tailor-platform/sdk/pull/976) [`08897a3`](https://github.com/tailor-platform/sdk/commit/08897a32b90388ed1adcbc07395d445f22ab92ce) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency turbo to v2.9.6
|
|
38
|
+
|
|
39
|
+
- [#979](https://github.com/tailor-platform/sdk/pull/979) [`1e0eb8c`](https://github.com/tailor-platform/sdk/commit/1e0eb8c1b5d25e51b3c846f54cf7133dbddd1509) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency kysely to v0.28.16
|
|
40
|
+
|
|
41
|
+
- [#981](https://github.com/tailor-platform/sdk/pull/981) [`2cc18f5`](https://github.com/tailor-platform/sdk/commit/2cc18f5e3d30e25da02bce70d0263af3fa73df19) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency aquaproj/aqua-registry to v4.494.1
|
|
42
|
+
|
|
43
|
+
- [#982](https://github.com/tailor-platform/sdk/pull/982) [`8ad0591`](https://github.com/tailor-platform/sdk/commit/8ad0591f7934351b4559bced1f46a3dabdeffc48) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency knip to v6.4.0
|
|
44
|
+
|
|
45
|
+
- [#983](https://github.com/tailor-platform/sdk/pull/983) [`b1cb7d3`](https://github.com/tailor-platform/sdk/commit/b1cb7d332ef471ea845011ea9d42819a3e426621) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update pnpm/action-setup action to v6
|
|
46
|
+
|
|
47
|
+
- [#988](https://github.com/tailor-platform/sdk/pull/988) [`484033d`](https://github.com/tailor-platform/sdk/commit/484033d4d17b8f76299102332a972816b8bed877) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency vitest to v4.1.4
|
|
48
|
+
|
|
49
|
+
- [#989](https://github.com/tailor-platform/sdk/pull/989) [`13be969`](https://github.com/tailor-platform/sdk/commit/13be969ad22d2609f974f866c98a23d6100c31fa) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency bufbuild/buf to v1.68.1
|
|
50
|
+
|
|
51
|
+
- [#992](https://github.com/tailor-platform/sdk/pull/992) [`f13ad71`](https://github.com/tailor-platform/sdk/commit/f13ad71475dc444aaf40dd56609c104aa1487677) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency globals to v17.5.0
|
|
52
|
+
|
|
53
|
+
- [#997](https://github.com/tailor-platform/sdk/pull/997) [`61d5c34`](https://github.com/tailor-platform/sdk/commit/61d5c3466962c270410df07fa6d614c36b2ced2e) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update flatt-security/setup-takumi-guard-npm digest to 9a5d797
|
|
54
|
+
|
|
55
|
+
- [#999](https://github.com/tailor-platform/sdk/pull/999) [`4ad6aaf`](https://github.com/tailor-platform/sdk/commit/4ad6aaf4374ecb48f6509cd783cdf597b0a116ee) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency tsdown to v0.21.8
|
|
56
|
+
|
|
57
|
+
- [#994](https://github.com/tailor-platform/sdk/pull/994) [`3622294`](https://github.com/tailor-platform/sdk/commit/36222949efd98d8d5b8ae6d5482d2089d0e2a1f2) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix `tailor-sdk function test-run` showing stack trace paths with a spurious `../` prefix (e.g. `../.tailor-sdk/test-run/test-run--add.entry.js`). Sourcemap `sources` are now emitted relative to the current working directory, and cwd-relative paths that start with a dotfile directory (e.g. `.tailor-sdk/...`) are explicitly prefixed with `./` in the display.
|
|
58
|
+
|
|
59
|
+
## 1.37.0
|
|
60
|
+
|
|
61
|
+
### Minor Changes
|
|
62
|
+
|
|
63
|
+
- [#971](https://github.com/tailor-platform/sdk/pull/971) [`be1a354`](https://github.com/tailor-platform/sdk/commit/be1a354c44f4c406d674fb03fc6695d07662dfac) Thanks [@toiroakr](https://github.com/toiroakr)! - Accept plain string for `authInvoker` in resolvers, executors, and `workflow.trigger()` (e.g. `authInvoker: "kiosk"`). Machine user names are type-narrowed via the generated `tailor.d.ts` (`MachineUserNameRegistry` interface). `auth.invoker(...)` is now deprecated in favor of the string form, which avoids pulling config-layer (Node-only) dependencies into runtime bundles.
|
|
64
|
+
|
|
65
|
+
- [#858](https://github.com/tailor-platform/sdk/pull/858) [`28872e5`](https://github.com/tailor-platform/sdk/commit/28872e538fec564cdbd675a6fa102820fe6ccf49) Thanks [@r253hmdryou](https://github.com/r253hmdryou)! - Group related resource changes in apply dry-run output
|
|
66
|
+
|
|
67
|
+
Consolidate function registry changes with their parent resources (workflow, resolver, executor, auth hook) in dry-run display. Group TailorDB type and gqlPermission changes by type name. Nest resources under their namespace for clearer hierarchy.
|
|
68
|
+
|
|
69
|
+
Plan summary counts now reflect grouped display units to match the displayed rows.
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- [#972](https://github.com/tailor-platform/sdk/pull/972) [`0a70288`](https://github.com/tailor-platform/sdk/commit/0a7028873f6e9d0c13fc8df3e203f9f8c3ff45d3) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix `UNRESOLVED_IMPORT` warning during SDK builds by replacing the self-referential `@tailor-platform/sdk` dynamic import in `function test-run` detection with an alias-based dynamic import
|
|
74
|
+
|
|
75
|
+
- [#961](https://github.com/tailor-platform/sdk/pull/961) [`6638782`](https://github.com/tailor-platform/sdk/commit/663878239f573537965071e61c92c70be1c4bdda) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency typescript-eslint to v8.58.1
|
|
76
|
+
|
|
77
|
+
- [#964](https://github.com/tailor-platform/sdk/pull/964) [`3472427`](https://github.com/tailor-platform/sdk/commit/34724277f12e463d6e60b1613b035aa27d3161e5) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @inquirer/prompts to v8.4.1
|
|
78
|
+
|
|
79
|
+
- [#967](https://github.com/tailor-platform/sdk/pull/967) [`bed9050`](https://github.com/tailor-platform/sdk/commit/bed9050172b74ad5a2200de55b80fbc397b6ef7a) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency rolldown to v1.0.0-rc.15
|
|
80
|
+
|
|
81
|
+
- [#968](https://github.com/tailor-platform/sdk/pull/968) [`da649c6`](https://github.com/tailor-platform/sdk/commit/da649c69285c4b7b53c28b2ad2b3531b2a0686be) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update actions/create-github-app-token action to v3.1.1
|
|
82
|
+
|
|
83
|
+
- [#969](https://github.com/tailor-platform/sdk/pull/969) [`133bc14`](https://github.com/tailor-platform/sdk/commit/133bc143b542fc82a462b844c0eca3888332ae24) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update pnpm/action-setup action to v6
|
|
84
|
+
|
|
3
85
|
## 1.36.0
|
|
4
86
|
|
|
5
87
|
### Minor Changes
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
import { l as initOAuth2Client } from "./client-
|
|
3
|
-
import { n as isSdkBranded } from "./brand-
|
|
4
|
-
import { n as logger, r as styles } from "./logger-
|
|
5
|
-
import { t as readPackageJson } from "./package-json-
|
|
6
|
-
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-
|
|
7
|
-
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-
|
|
8
|
-
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-
|
|
9
|
-
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-
|
|
2
|
+
import { l as initOAuth2Client } from "./client-xzPXtc_e.mjs";
|
|
3
|
+
import { n as isSdkBranded } from "./brand-D-d15jx3.mjs";
|
|
4
|
+
import { a as parseBoolean, n as logger, r as styles } from "./logger-5_JMzHmw.mjs";
|
|
5
|
+
import { t as readPackageJson } from "./package-json-BHViVisJ.mjs";
|
|
6
|
+
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-DrbB1VXd.mjs";
|
|
7
|
+
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-Dx82rSjf.mjs";
|
|
8
|
+
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-DeWpvq3T.mjs";
|
|
9
|
+
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-CwtvQuxh.mjs";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import * as fs$1 from "node:fs";
|
|
@@ -1599,6 +1599,23 @@ function detectDefaultImports(program) {
|
|
|
1599
1599
|
//#endregion
|
|
1600
1600
|
//#region src/cli/services/workflow/trigger-transformer.ts
|
|
1601
1601
|
/**
|
|
1602
|
+
* Name of the injected runtime normalizer helper. Chosen to be unique enough
|
|
1603
|
+
* to avoid collisions with user code.
|
|
1604
|
+
*/
|
|
1605
|
+
const NORMALIZER_IDENTIFIER = "__tailor_normalizeAuthInvoker";
|
|
1606
|
+
/**
|
|
1607
|
+
* Build the source text of the injected normalizer helper.
|
|
1608
|
+
*
|
|
1609
|
+
* Accepts either a plain string (machine user name) or the object form
|
|
1610
|
+
* `{ namespace, machineUserName }`, and always returns the object form.
|
|
1611
|
+
* The auth namespace is baked in at bundle time.
|
|
1612
|
+
* @param authNamespace - Auth service namespace to embed
|
|
1613
|
+
* @returns Source line defining the helper
|
|
1614
|
+
*/
|
|
1615
|
+
function buildNormalizerHelperSource(authNamespace) {
|
|
1616
|
+
return `const ${NORMALIZER_IDENTIFIER} = (v) => typeof v === "string" ? { namespace: ${JSON.stringify(authNamespace)}, machineUserName: v } : v;\n`;
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1602
1619
|
* Extract authInvoker info from a config object expression
|
|
1603
1620
|
* Returns the authInvoker value text and whether it's a shorthand property
|
|
1604
1621
|
* @param configArg - Config argument node
|
|
@@ -1703,9 +1720,10 @@ function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames
|
|
|
1703
1720
|
* @param jobNameMap - Map from variable name to job name
|
|
1704
1721
|
* @param workflowFileMap - Map from file path (without extension) to workflow name for default exports
|
|
1705
1722
|
* @param currentFilePath - Path of the current file being transformed (for resolving relative imports)
|
|
1723
|
+
* @param authNamespace - Auth service namespace used to expand string-literal `authInvoker` to object form
|
|
1706
1724
|
* @returns Transformed source code with trigger calls rewritten
|
|
1707
1725
|
*/
|
|
1708
|
-
function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflowFileMap, currentFilePath) {
|
|
1726
|
+
function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflowFileMap, currentFilePath, authNamespace) {
|
|
1709
1727
|
const { program } = parseSync("input.ts", source);
|
|
1710
1728
|
const localWorkflowNameMap = new Map(workflowNameMap);
|
|
1711
1729
|
if (workflowFileMap && currentFilePath) {
|
|
@@ -1720,10 +1738,16 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
|
|
|
1720
1738
|
}
|
|
1721
1739
|
const triggerCalls = detectExtendedTriggerCalls(program, source, new Set(localWorkflowNameMap.keys()), new Set(jobNameMap.keys()));
|
|
1722
1740
|
const replacements = [];
|
|
1741
|
+
let needsNormalizerHelper = false;
|
|
1723
1742
|
for (const call of triggerCalls) if (call.kind === "workflow" && call.authInvoker) {
|
|
1724
1743
|
const workflowName = localWorkflowNameMap.get(call.identifierName);
|
|
1725
1744
|
if (workflowName) {
|
|
1726
|
-
const
|
|
1745
|
+
const rawExpr = call.authInvoker.isShorthand ? "authInvoker" : call.authInvoker.valueText;
|
|
1746
|
+
let authInvokerExpr;
|
|
1747
|
+
if (authNamespace) {
|
|
1748
|
+
authInvokerExpr = `${NORMALIZER_IDENTIFIER}(${rawExpr})`;
|
|
1749
|
+
needsNormalizerHelper = true;
|
|
1750
|
+
} else authInvokerExpr = rawExpr;
|
|
1727
1751
|
const transformedCall = `tailor.workflow.triggerWorkflow("${workflowName}", ${call.argsText || "undefined"}, { authInvoker: ${authInvokerExpr} })`;
|
|
1728
1752
|
replacements.push({
|
|
1729
1753
|
start: call.callRange.start,
|
|
@@ -1743,7 +1767,9 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
|
|
|
1743
1767
|
});
|
|
1744
1768
|
}
|
|
1745
1769
|
}
|
|
1746
|
-
|
|
1770
|
+
const transformed = applyReplacements(source, replacements);
|
|
1771
|
+
if (needsNormalizerHelper && authNamespace) return buildNormalizerHelperSource(authNamespace) + transformed;
|
|
1772
|
+
return transformed;
|
|
1747
1773
|
}
|
|
1748
1774
|
|
|
1749
1775
|
//#endregion
|
|
@@ -1762,16 +1788,18 @@ function normalizeFilePath(filePath) {
|
|
|
1762
1788
|
* Build trigger context from workflow configuration
|
|
1763
1789
|
* Scans workflow files to collect workflow and job mappings
|
|
1764
1790
|
* @param workflowConfig - Workflow file loading configuration
|
|
1791
|
+
* @param authNamespace - Auth service namespace (optional, used for string-literal authInvoker expansion)
|
|
1765
1792
|
* @returns Trigger context built from workflow sources
|
|
1766
1793
|
*/
|
|
1767
|
-
async function buildTriggerContext(workflowConfig) {
|
|
1794
|
+
async function buildTriggerContext(workflowConfig, authNamespace) {
|
|
1768
1795
|
const workflowNameMap = /* @__PURE__ */ new Map();
|
|
1769
1796
|
const jobNameMap = /* @__PURE__ */ new Map();
|
|
1770
1797
|
const workflowFileMap = /* @__PURE__ */ new Map();
|
|
1771
1798
|
if (!workflowConfig) return {
|
|
1772
1799
|
workflowNameMap,
|
|
1773
1800
|
jobNameMap,
|
|
1774
|
-
workflowFileMap
|
|
1801
|
+
workflowFileMap,
|
|
1802
|
+
authNamespace
|
|
1775
1803
|
};
|
|
1776
1804
|
const workflowFiles = loadFilesWithIgnores(workflowConfig);
|
|
1777
1805
|
for (const file of workflowFiles) try {
|
|
@@ -1794,7 +1822,8 @@ async function buildTriggerContext(workflowConfig) {
|
|
|
1794
1822
|
return {
|
|
1795
1823
|
workflowNameMap,
|
|
1796
1824
|
jobNameMap,
|
|
1797
|
-
workflowFileMap
|
|
1825
|
+
workflowFileMap,
|
|
1826
|
+
authNamespace
|
|
1798
1827
|
};
|
|
1799
1828
|
}
|
|
1800
1829
|
function sortedMapToJson(m) {
|
|
@@ -1808,7 +1837,7 @@ function sortedMapToJson(m) {
|
|
|
1808
1837
|
*/
|
|
1809
1838
|
function serializeTriggerContext(ctx) {
|
|
1810
1839
|
if (!ctx) return "";
|
|
1811
|
-
return sortedMapToJson(ctx.workflowNameMap) + sortedMapToJson(ctx.jobNameMap) + sortedMapToJson(ctx.workflowFileMap);
|
|
1840
|
+
return sortedMapToJson(ctx.workflowNameMap) + sortedMapToJson(ctx.jobNameMap) + sortedMapToJson(ctx.workflowFileMap) + (ctx.authNamespace ?? "");
|
|
1812
1841
|
}
|
|
1813
1842
|
/**
|
|
1814
1843
|
* Create a rolldown plugin for transforming trigger calls
|
|
@@ -1824,7 +1853,7 @@ function createTriggerTransformPlugin(triggerContext) {
|
|
|
1824
1853
|
filter: { id: { include: [/\.ts$/, /\.js$/] } },
|
|
1825
1854
|
handler(code, id) {
|
|
1826
1855
|
if (!code.includes(".trigger(")) return null;
|
|
1827
|
-
return { code: transformFunctionTriggers(code, triggerContext.workflowNameMap, triggerContext.jobNameMap, triggerContext.workflowFileMap, id) };
|
|
1856
|
+
return { code: transformFunctionTriggers(code, triggerContext.workflowNameMap, triggerContext.jobNameMap, triggerContext.workflowFileMap, id, triggerContext.authNamespace) };
|
|
1828
1857
|
}
|
|
1829
1858
|
}
|
|
1830
1859
|
};
|
|
@@ -3179,10 +3208,11 @@ const TailorFieldSchema = z.object({
|
|
|
3179
3208
|
|
|
3180
3209
|
//#endregion
|
|
3181
3210
|
//#region src/parser/service/auth/schema.ts
|
|
3182
|
-
const
|
|
3211
|
+
const AuthInvokerObjectSchema = z.object({
|
|
3183
3212
|
namespace: z.string().describe("Auth namespace"),
|
|
3184
3213
|
machineUserName: z.string().describe("Machine user name for authentication")
|
|
3185
3214
|
});
|
|
3215
|
+
const AuthInvokerSchema = z.union([z.string().describe("Machine user name (namespace auto-resolved from auth service)"), AuthInvokerObjectSchema]);
|
|
3186
3216
|
const secretValueSchema = z.object({
|
|
3187
3217
|
vaultName: z.string().describe("Vault name containing the secret"),
|
|
3188
3218
|
secretKey: z.string().describe("Key of the secret in the vault")
|
|
@@ -3449,7 +3479,14 @@ const ScheduleTriggerSchema = z.object({
|
|
|
3449
3479
|
cron: z.string().describe("CRON expression for the schedule"),
|
|
3450
3480
|
timezone: z.string().optional().default("UTC").describe("Timezone for the CRON schedule (default: UTC)")
|
|
3451
3481
|
});
|
|
3452
|
-
const
|
|
3482
|
+
const IncomingWebhookTriggerResponseSchema = z.object({
|
|
3483
|
+
body: functionSchema.optional().describe("Function returning the response body"),
|
|
3484
|
+
statusCode: z.number().int().optional().describe("HTTP status code for the response")
|
|
3485
|
+
});
|
|
3486
|
+
const IncomingWebhookTriggerSchema = z.object({
|
|
3487
|
+
kind: z.literal("incomingWebhook"),
|
|
3488
|
+
response: IncomingWebhookTriggerResponseSchema.optional().describe("Response configuration")
|
|
3489
|
+
});
|
|
3453
3490
|
const IdpUserTriggerSchema = z.object({
|
|
3454
3491
|
kind: z.literal("idpUser").describe("IdP user event trigger"),
|
|
3455
3492
|
events: z.array(z.enum([
|
|
@@ -4212,7 +4249,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
4212
4249
|
handler(code, id) {
|
|
4213
4250
|
if (!code.includes("createWorkflowJob") && !code.includes("createWorkflow") && !code.includes(".trigger(")) return null;
|
|
4214
4251
|
let transformed = transformWorkflowSource(code, job.name, job.exportName, otherJobExportNames, allJobsMap);
|
|
4215
|
-
if (triggerContext && transformed.includes(".trigger(")) transformed = transformFunctionTriggers(transformed, triggerContext.workflowNameMap, triggerContext.jobNameMap, triggerContext.workflowFileMap, id);
|
|
4252
|
+
if (triggerContext && transformed.includes(".trigger(")) transformed = transformFunctionTriggers(transformed, triggerContext.workflowNameMap, triggerContext.jobNameMap, triggerContext.workflowFileMap, id, triggerContext.authNamespace);
|
|
4216
4253
|
return { code: transformed };
|
|
4217
4254
|
}
|
|
4218
4255
|
}
|
|
@@ -4565,7 +4602,8 @@ async function loadConfig(configPath) {
|
|
|
4565
4602
|
*/
|
|
4566
4603
|
function resolveInlineSourcemap(configValue) {
|
|
4567
4604
|
if (configValue !== void 0) return configValue;
|
|
4568
|
-
|
|
4605
|
+
const envValue = parseBoolean(process.env.TAILOR_ENABLE_INLINE_SOURCEMAP);
|
|
4606
|
+
if (envValue !== void 0) return envValue;
|
|
4569
4607
|
return true;
|
|
4570
4608
|
}
|
|
4571
4609
|
|
|
@@ -4986,7 +5024,7 @@ async function loadApplication(params) {
|
|
|
4986
5024
|
const executorService = defineExecutor(config.executor, pluginExecutorFiles.length > 0);
|
|
4987
5025
|
const workflowService = defineWorkflow(config.workflow);
|
|
4988
5026
|
if (workflowService) await workflowService.loadWorkflows();
|
|
4989
|
-
const triggerContext = await buildTriggerContext(config.workflow);
|
|
5027
|
+
const triggerContext = await buildTriggerContext(config.workflow, authResult.authService?.config.name);
|
|
4990
5028
|
const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
|
|
4991
5029
|
const bundledScripts = {
|
|
4992
5030
|
resolvers: /* @__PURE__ */ new Map(),
|
|
@@ -5050,4 +5088,4 @@ async function loadApplication(params) {
|
|
|
5050
5088
|
|
|
5051
5089
|
//#endregion
|
|
5052
5090
|
export { resolveTokens as C, readPlatformConfig as S, writePlatformConfig as T, hashFile as _, loadConfig as a, loadAccessToken as b, createExecutorService as c, TailorDBTypeSchema as d, stringifyFunction as f, getDistDir as g, createBundleCache as h, resolveInlineSourcemap as i, ExecutorSchema as l, loadFilesWithIgnores as m, generatePluginFilesIfNeeded as n, WorkflowJobSchema as o, tailorUserMap as p, loadApplication as r, ResolverSchema as s, defineApplication as t, OAuth2ClientSchema as u, deleteUserTokens as v, saveUserTokens as w, loadWorkspaceId as x, fetchLatestToken as y };
|
|
5053
|
-
//# sourceMappingURL=application-
|
|
5091
|
+
//# sourceMappingURL=application-DhQrXEld.mjs.map
|