@tailor-platform/sdk 1.40.1 → 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +23 -0
  3. package/dist/{actor-B2oEmlTc.d.mts → actor-DzCuoMlP.d.mts} +2 -2
  4. package/dist/application-BZRbA1pL.mjs +4 -0
  5. package/dist/{application-EvhIIVg0.mjs → application-DkVNbIuh.mjs} +95 -16
  6. package/dist/application-DkVNbIuh.mjs.map +1 -0
  7. package/dist/brand-Ll48SMXe.mjs.map +1 -1
  8. package/dist/cli/index.mjs +56 -43
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +75 -18
  11. package/dist/cli/lib.mjs +9 -9
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/cli/skills.mjs.map +1 -1
  14. package/dist/{client-CcV6Jjds.mjs → client-DQl5NPG9.mjs} +103 -43
  15. package/dist/{client-CcV6Jjds.mjs.map → client-DQl5NPG9.mjs.map} +1 -1
  16. package/dist/{client-Cn9SqhZT.mjs → client-EI4pMzvm.mjs} +1 -1
  17. package/dist/configure/index.d.mts +5 -5
  18. package/dist/configure/index.mjs +84 -4
  19. package/dist/configure/index.mjs.map +1 -1
  20. package/dist/{crash-report-CUbm1ErM.mjs → crash-report-CSSrblUv.mjs} +4 -4
  21. package/dist/{crash-report-CUbm1ErM.mjs.map → crash-report-CSSrblUv.mjs.map} +1 -1
  22. package/dist/{crash-report-CSYupJ0T.mjs → crash-report-DtkFq9JF.mjs} +1 -1
  23. package/dist/{enum-constants-Dx82rSjf.mjs → enum-constants-C3KSpsYj.mjs} +1 -1
  24. package/dist/{enum-constants-Dx82rSjf.mjs.map → enum-constants-C3KSpsYj.mjs.map} +1 -1
  25. package/dist/{errors-ChWX5ZG8.mjs → errors-_M2TVoWh.mjs} +1 -1
  26. package/dist/{errors-ChWX5ZG8.mjs.map → errors-_M2TVoWh.mjs.map} +1 -1
  27. package/dist/{file-utils-DeWpvq3T.mjs → file-utils-775qWKoo.mjs} +1 -1
  28. package/dist/{file-utils-DeWpvq3T.mjs.map → file-utils-775qWKoo.mjs.map} +1 -1
  29. package/dist/{index-Chvw1Eod.d.mts → index-0Dk-fDWi.d.mts} +2 -2
  30. package/dist/{index-CiNNNpuH.d.mts → index-BEEL1-6Z.d.mts} +2 -2
  31. package/dist/{index-D_ezppY7.d.mts → index-Br4XCvX1.d.mts} +103 -86
  32. package/dist/{index-BtXZdz-F.d.mts → index-DdsUV-aA.d.mts} +2 -2
  33. package/dist/{index-reFAYSX7.d.mts → index-ZZYEd_0R.d.mts} +2 -2
  34. package/dist/interceptor-4UC-KTno.mjs.map +1 -1
  35. package/dist/{job-p6zf8Qpg.mjs → job-BOvKyNdT.mjs} +15 -9
  36. package/dist/job-BOvKyNdT.mjs.map +1 -0
  37. package/dist/kysely/index.mjs.map +1 -1
  38. package/dist/{kysely-type-CwtvQuxh.mjs → kysely-type-BQsYEZoY.mjs} +1 -1
  39. package/dist/kysely-type-BQsYEZoY.mjs.map +1 -0
  40. package/dist/logger-DTNAMYGy.mjs.map +1 -1
  41. package/dist/{package-json-CWp8s9dE.mjs → package-json-CRzw5eUf.mjs} +1 -1
  42. package/dist/{package-json-CWp8s9dE.mjs.map → package-json-CRzw5eUf.mjs.map} +1 -1
  43. package/dist/package-json-DR_mqrCW.mjs +4 -0
  44. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  45. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  46. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  47. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  48. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  49. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  50. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  51. package/dist/plugin/builtin/seed/index.mjs +1 -1
  52. package/dist/plugin/index.d.mts +2 -2
  53. package/dist/plugin/index.mjs.map +1 -1
  54. package/dist/repl-editor-DjycioU-.mjs.map +1 -1
  55. package/dist/{runtime-B9R1TzLD.mjs → runtime-l7GFD3Xg.mjs} +503 -196
  56. package/dist/runtime-l7GFD3Xg.mjs.map +1 -0
  57. package/dist/{schema-CEcfEyPN.mjs → schema-DBq6hr6h.mjs} +13 -2
  58. package/dist/{schema-CEcfEyPN.mjs.map → schema-DBq6hr6h.mjs.map} +1 -1
  59. package/dist/{seed-CyYPhvNL.mjs → seed-BkVKgsxf.mjs} +1 -1
  60. package/dist/{seed-CyYPhvNL.mjs.map → seed-BkVKgsxf.mjs.map} +1 -1
  61. package/dist/{service-SrG26B9T.mjs → service-CCnx_IFw.mjs} +2 -2
  62. package/dist/{service-SrG26B9T.mjs.map → service-CCnx_IFw.mjs.map} +1 -1
  63. package/dist/{tailor-db-field-CoFKRCYW.d.mts → tailor-db-field-D_z185oq.d.mts} +36 -6
  64. package/dist/{telemetry-BuDto_2q.mjs → telemetry-B6Le9XT-.mjs} +2 -2
  65. package/dist/{telemetry-BuDto_2q.mjs.map → telemetry-B6Le9XT-.mjs.map} +1 -1
  66. package/dist/telemetry-C_WXxIo0.mjs +4 -0
  67. package/dist/types-Duhhsx3R.mjs.map +1 -1
  68. package/dist/utils/test/index.d.mts +36 -3
  69. package/dist/utils/test/index.mjs +78 -9
  70. package/dist/utils/test/index.mjs.map +1 -1
  71. package/dist/{workflow.generated-Btz6srLR.d.mts → workflow.generated-CDCnZNkH.d.mts} +2 -2
  72. package/docs/cli/application.md +130 -5
  73. package/docs/cli/crash-report.md +12 -1
  74. package/docs/cli/executor.md +6 -4
  75. package/docs/cli/function.md +83 -1
  76. package/docs/cli/organization.md +6 -5
  77. package/docs/cli/workspace.md +16 -13
  78. package/docs/cli-reference.md +13 -10
  79. package/docs/services/executor.md +4 -0
  80. package/docs/services/idp.md +16 -0
  81. package/docs/services/resolver.md +4 -2
  82. package/docs/services/workflow.md +117 -3
  83. package/docs/testing.md +95 -7
  84. package/package.json +24 -24
  85. package/dist/application-CE2s_a6w.mjs +0 -4
  86. package/dist/application-EvhIIVg0.mjs.map +0 -1
  87. package/dist/job-p6zf8Qpg.mjs.map +0 -1
  88. package/dist/kysely-type-CwtvQuxh.mjs.map +0 -1
  89. package/dist/package-json-CPR7s5hf.mjs +0 -4
  90. package/dist/runtime-B9R1TzLD.mjs.map +0 -1
  91. package/dist/telemetry-C1hzFaiV.mjs +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,73 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.44.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1064](https://github.com/tailor-platform/sdk/pull/1064) [`683478e`](https://github.com/tailor-platform/sdk/commit/683478e13b3e308739da5578ad5e13602087700e) Thanks [@dqn](https://github.com/dqn)! - `tailor-sdk api` discoverability improvements:
8
+
9
+ - New `tailor-sdk api list` subcommand enumerates all invocable `OperatorService` methods. Streaming RPCs are excluded since the command only handles unary requests.
10
+ - New `tailor-sdk api inspect <endpoint>` subcommand prints the input message tree of an endpoint without sending a request, including `oneof` membership, recursive type tagging, and `map` value schemas. Combine with the global `--json` flag for machine-readable output.
11
+ - Shell completion now suggests `OperatorService` method names for the `endpoint` positional of `tailor-sdk api` and `tailor-sdk api inspect`.
12
+
13
+ - [#1039](https://github.com/tailor-platform/sdk/pull/1039) [`852968d`](https://github.com/tailor-platform/sdk/commit/852968d2e25a3deeb5169132fb76db0d93631c34) Thanks [@dqn](https://github.com/dqn)! - Wire `--order` / `--limit` through the remaining list commands that were missed in the previous pass: `workspace list`, `workspace user list`, `workspace app list`, `organization folder list`, `executor webhook list`, and `crash-report list`. Existing behavior is preserved when the flags are omitted (server-default order, unlimited), so scripts already invoking these commands are unaffected. The programmatic helpers (`listWorkspaces`, `listUsers`, `listApps`, `listFolders`, `listWebhookExecutors`) accept a new optional `order` field with the same defaults.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#1079](https://github.com/tailor-platform/sdk/pull/1079) [`8ab2714`](https://github.com/tailor-platform/sdk/commit/8ab271494cf76ee8f588848887fa8e9d3eb91bfa) Thanks [@dqn](https://github.com/dqn)! - Suppress the spurious `Static website "<name>" not found for CORS configuration` warning during `apply` planning on the first deployment. The warning previously fired whenever `plan` looked up a static website that the same apply run was about to create. Locally-defined static websites referenced via `:url` patterns in `cors` or OAuth2 `redirectURIs` are now treated as expected during planning; missing remote websites still warn when they are not part of the local configuration.
18
+
19
+ - [#1074](https://github.com/tailor-platform/sdk/pull/1074) [`d272f26`](https://github.com/tailor-platform/sdk/commit/d272f2604f31f2b61d880f1e57d2732b18f5c982) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency politty to v0.4.15
20
+
21
+ - [#1076](https://github.com/tailor-platform/sdk/pull/1076) [`4d8c7a3`](https://github.com/tailor-platform/sdk/commit/4d8c7a39adadb09a991f93f44ed519efc506762f) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update rolldown
22
+
23
+ - [#1082](https://github.com/tailor-platform/sdk/pull/1082) [`15b791d`](https://github.com/tailor-platform/sdk/commit/15b791d4c2d38e8f30e09d739b947099bfece8bd) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @bufbuild/protobuf to v2.12.0
24
+
25
+ - [#1083](https://github.com/tailor-platform/sdk/pull/1083) [`16d8a42`](https://github.com/tailor-platform/sdk/commit/16d8a427336378a784c0bb492a858206535ff68e) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency es-toolkit to v1.46.0
26
+
27
+ ## 1.43.0
28
+
29
+ ### Minor Changes
30
+
31
+ - [#1062](https://github.com/tailor-platform/sdk/pull/1062) [`7c39665`](https://github.com/tailor-platform/sdk/commit/7c39665bc3364d3bc644c5277f3f9f51926fc2b2) Thanks [@dqn](https://github.com/dqn)! - Auto-enable `publishUserEvents` on IdP services when the project defines executors with `idpUser` triggers (`idpUserCreatedTrigger`, `idpUserUpdatedTrigger`, `idpUserDeletedTrigger`, or `idpUserTrigger`). Previously, omitting `publishUserEvents` defaulted to `false`, silently preventing those executors from firing. The SDK now auto-configures `publishUserEvents: true` for every IdP in the project when any executor uses an `idpUser` trigger, and warns if an IdP explicitly sets `publishUserEvents: false` while such executors are present. Set `publishUserEvents: false` explicitly to opt out.
32
+
33
+ ### Patch Changes
34
+
35
+ - [#1060](https://github.com/tailor-platform/sdk/pull/1060) [`4ffec9f`](https://github.com/tailor-platform/sdk/commit/4ffec9f86766dc1199ccef31223697c786c3f388) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update oxc
36
+
37
+ ## 1.42.0
38
+
39
+ ### Minor Changes
40
+
41
+ - [#1046](https://github.com/tailor-platform/sdk/pull/1046) [`9f99c0d`](https://github.com/tailor-platform/sdk/commit/9f99c0d284a5f227acafbb41db6db0bf7293c496) Thanks [@remiposo](https://github.com/remiposo)! - Expose `invoker` on resolver/executor/workflow body contexts. The SDK now calls `tailor.context.getInvoker()` inside bundled wrappers and passes the result to user code as `context.invoker` / `args.invoker`. This reflects `authInvoker` delegation (machine user when specified) and is `null` for anonymous callers.
42
+
43
+ ## 1.41.0
44
+
45
+ ### Minor Changes
46
+
47
+ - [#514](https://github.com/tailor-platform/sdk/pull/514) [`3047d45`](https://github.com/tailor-platform/sdk/commit/3047d45fd8daa38616ecaad20d5c04cf75d23931) Thanks [@r253hmdryou](https://github.com/r253hmdryou)! - Add `function get` and `function list` CLI commands for querying function registries in a workspace
48
+
49
+ - [#987](https://github.com/tailor-platform/sdk/pull/987) [`35b2090`](https://github.com/tailor-platform/sdk/commit/35b2090b0009d26ebcbb69c76540791b2f39924e) Thanks [@toiroakr](https://github.com/toiroakr)! - Add wait/resolve support for human-in-the-loop workflows via `defineWaitPoint()` and `defineWaitPoints()` with typed `.wait()` and `.resolve()` methods.
50
+
51
+ Tighten `createWorkflowJob` I/O types: both `Input` and `Output` must now be JsonValue-compatible (plain objects/arrays; no class instances or functions). `Output` previously accepted `Jsonifiable` with a `Jsonify<Output>` return transform on `.trigger()`, but the platform runtime rejects non-plain objects, so the old types did not match actual runtime behavior.
52
+
53
+ Reject top-level `null` in `createWorkflowJob` `Input` and in wait-point `Payload`: the platform normalizes top-level `null`/`undefined` args to `{}`, so declaring a top-level nullable type would cause the body/callback to receive `{}` at runtime, mismatching the declared type. Nested `null` inside objects or arrays is preserved by JSON serialization and remains allowed.
54
+
55
+ ### Patch Changes
56
+
57
+ - [#1050](https://github.com/tailor-platform/sdk/pull/1050) [`9232660`](https://github.com/tailor-platform/sdk/commit/92326608640e473138712ac00adc29369980c604) Thanks [@toiroakr](https://github.com/toiroakr)! - Address Dependabot noise for the valibot ReDoS advisory (GHSA-vqpr-j7v3-hqw9): bump `@toiroakr/lines-db` to 0.9.2 and document the remaining transitive `@liam-hq/cli → valibot@1.1.0` report in the SDK README, including an override snippet for consumers who want to silence it.
58
+
59
+ - [#1030](https://github.com/tailor-platform/sdk/pull/1030) [`fc4cc7c`](https://github.com/tailor-platform/sdk/commit/fc4cc7cc4430c545c50eb8bb4b406023c91d8290) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency politty to v0.4.14
60
+
61
+ - [#1041](https://github.com/tailor-platform/sdk/pull/1041) [`0858d64`](https://github.com/tailor-platform/sdk/commit/0858d64b3a03a3a9d994ebe5cd18a803b9780cac) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update pnpm/action-setup action to v6.0.3
62
+
63
+ - [#1044](https://github.com/tailor-platform/sdk/pull/1044) [`04c1fea`](https://github.com/tailor-platform/sdk/commit/04c1fea62a0eb70c24609cdf9bccf0a012d71875) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency std-env to v4.1.0
64
+
65
+ - [#1045](https://github.com/tailor-platform/sdk/pull/1045) [`09fce15`](https://github.com/tailor-platform/sdk/commit/09fce1500cc24bcf6089248030168817598f47bd) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency type-fest to v5.6.0
66
+
67
+ - [#1051](https://github.com/tailor-platform/sdk/pull/1051) [`f7e1d34`](https://github.com/tailor-platform/sdk/commit/f7e1d340ecac5ea37c3c5ab33bd3d4a536274817) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update @inquirer
68
+
69
+ - [#1052](https://github.com/tailor-platform/sdk/pull/1052) [`7e75310`](https://github.com/tailor-platform/sdk/commit/7e7531040b3ceac90e25f633d71f502ac1ac3239) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @toiroakr/read-multiline to v0.3.2
70
+
3
71
  ## 1.40.1
4
72
 
5
73
  ### Patch Changes
package/README.md CHANGED
@@ -96,3 +96,26 @@ See [Create Tailor Platform SDK](https://github.com/tailor-platform/sdk/tree/mai
96
96
 
97
97
  - Node.js 22 or later (or Bun)
98
98
  - A Tailor Platform account ([request access](https://www.tailor.tech/demo))
99
+
100
+ ## Dependabot Noise
101
+
102
+ Installing `@tailor-platform/sdk` pulls in a few transitive advisories that are **not exploitable in practice**. They are listed here so you can triage reports from `npm audit` / `pnpm audit` / Dependabot without diffing our lockfile.
103
+
104
+ ### valibot ReDoS ([GHSA-vqpr-j7v3-hqw9](https://github.com/advisories/GHSA-vqpr-j7v3-hqw9))
105
+
106
+ - **Why it shows up**: `@liam-hq/cli@0.7.24` pins `valibot@1.1.0`, which falls in the vulnerable range (`< 1.2.0`).
107
+ - **Why it's safe here**: `@liam-hq/cli` is invoked only by `tailor-sdk tailordb erd export` as a child process, against developer-controlled schema files. The vulnerable code path (`v.emoji()` on attacker-controlled strings) is never reached.
108
+ - **If you want to silence it**: add an override to your project so `valibot` resolves to `>=1.2.0`. `@toiroakr/lines-db` declares `valibot` as an optional peer with range `>=1.0.0`, so forcing `1.2.0+` is safe.
109
+
110
+ ```jsonc
111
+ // pnpm (package.json)
112
+ "pnpm": { "overrides": { "valibot": ">=1.2.0" } }
113
+
114
+ // npm (package.json)
115
+ "overrides": { "valibot": ">=1.2.0" }
116
+
117
+ // yarn (package.json)
118
+ "resolutions": { "valibot": ">=1.2.0" }
119
+ ```
120
+
121
+ This fix has to live in your project's `package.json` — overrides in a published package do not propagate to consumers.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="@tailor-platform/function-types" />
2
- import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-CoFKRCYW.mjs";
2
+ import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-D_z185oq.mjs";
3
3
 
4
4
  //#region src/types/env.d.ts
5
5
  interface Env {}
@@ -27,4 +27,4 @@ type TailorActor = {
27
27
  };
28
28
  //#endregion
29
29
  export { Env as n, TailorEnv as r, TailorActor as t };
30
- //# sourceMappingURL=actor-B2oEmlTc.d.mts.map
30
+ //# sourceMappingURL=actor-DzCuoMlP.d.mts.map
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-DkVNbIuh.mjs";
3
+
4
+ export { defineApplication };
@@ -1,27 +1,27 @@
1
1
 
2
- import { u as initOAuth2Client } from "./client-CcV6Jjds.mjs";
2
+ import { u as initOAuth2Client } from "./client-DQl5NPG9.mjs";
3
3
  import { n as isSdkBranded } from "./brand-Ll48SMXe.mjs";
4
4
  import { a as parseBoolean, n as logger, r as styles } from "./logger-DTNAMYGy.mjs";
5
- import { t as readPackageJson } from "./package-json-CWp8s9dE.mjs";
6
- import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-Dx82rSjf.mjs";
7
- import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-DeWpvq3T.mjs";
8
- import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-CwtvQuxh.mjs";
9
- import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-CyYPhvNL.mjs";
5
+ import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-C3KSpsYj.mjs";
6
+ import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-775qWKoo.mjs";
7
+ import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-BQsYEZoY.mjs";
8
+ import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-BkVKgsxf.mjs";
9
+ import { t as readPackageJson } from "./package-json-CRzw5eUf.mjs";
10
10
  import { createRequire } from "node:module";
11
11
  import { z } from "zod";
12
12
  import * as fs$1 from "node:fs";
13
13
  import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
14
14
  import * as path from "pathe";
15
15
  import { join, resolve } from "pathe";
16
- import * as crypto from "node:crypto";
17
16
  import { pathToFileURL } from "node:url";
18
- import { resolveTSConfig } from "pkg-types";
19
17
  import ml from "multiline-ts";
20
18
  import * as os from "node:os";
21
19
  import { parseTOML, parseYAML, stringifyYAML } from "confbox";
22
20
  import { findUpSync } from "find-up-simple";
23
21
  import { lt } from "semver";
24
22
  import { xdgConfig } from "xdg-basedir";
23
+ import * as crypto from "node:crypto";
24
+ import { resolveTSConfig } from "pkg-types";
25
25
  import * as rolldown from "rolldown";
26
26
  import * as fs from "node:fs/promises";
27
27
  import { parseSync } from "oxc-parser";
@@ -1798,8 +1798,9 @@ function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames
1798
1798
  const callee = callExpr.callee;
1799
1799
  if (callee.type === "MemberExpression") {
1800
1800
  const memberExpr = callee;
1801
- if (!memberExpr.computed && memberExpr.object.type === "Identifier" && memberExpr.property.name === "trigger") {
1802
- const identifierName = memberExpr.object.name;
1801
+ const identifierName = !memberExpr.computed && memberExpr.object.type === "Identifier" ? memberExpr.object.name : null;
1802
+ const propertyName = !memberExpr.computed ? memberExpr.property.name : null;
1803
+ if (identifierName && propertyName === "trigger") {
1803
1804
  const isWorkflow = workflowNames.has(identifierName);
1804
1805
  const isJob = jobNames.has(identifierName);
1805
1806
  if (!isWorkflow && !isJob) return;
@@ -1853,7 +1854,7 @@ function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames
1853
1854
  }
1854
1855
  /**
1855
1856
  * Transform trigger calls for resolver/executor/workflow functions
1856
- * Handles both job.trigger() and workflow.trigger() calls
1857
+ * Handles job.trigger() and workflow.trigger() calls
1857
1858
  * @param source - The source code to transform
1858
1859
  * @param workflowNameMap - Map from variable name to workflow name
1859
1860
  * @param jobNameMap - Map from variable name to job name
@@ -3592,6 +3593,79 @@ function createAuthService(config, tailorDBServices, externalTailorDBNamespaces)
3592
3593
  };
3593
3594
  }
3594
3595
 
3596
+ //#endregion
3597
+ //#region src/cli/shared/runtime-exprs.ts
3598
+ /**
3599
+ * JS expressions that shape the inputs passed to user-authored code.
3600
+ *
3601
+ * Two delivery paths:
3602
+ * - Apply config: shipped with apply and evaluated by the platform before
3603
+ * invoking user code.
3604
+ * - Bundle inline: interpolated into the generated `.entry.js` wrapper and
3605
+ * evaluated inside the bundled script at function entry.
3606
+ *
3607
+ * The user field mapping (server → SDK) shared across services is defined in
3608
+ * `@/parser/service/tailordb` as `tailorUserMap`.
3609
+ */
3610
+ /**
3611
+ * `invoker` value expression, inlined into bundler entry wrappers.
3612
+ *
3613
+ * Calls `tailor.context.getInvoker()` at function entry and maps the server
3614
+ * shape to TailorInvoker. Anonymous callers (`null`) pass through as `null`.
3615
+ */
3616
+ const INVOKER_EXPR = `(($raw) => $raw ? ({
3617
+ id: $raw.id,
3618
+ type: $raw.type,
3619
+ workspaceId: $raw.workspaceId,
3620
+ attributes: $raw.attributeMap,
3621
+ attributeList: $raw.attributes,
3622
+ }) : null)(tailor.context.getInvoker())`;
3623
+ /**
3624
+ * Actor field transformation expression.
3625
+ *
3626
+ * Transforms the server's actor object to match the SDK's TailorActor type:
3627
+ * server `attributeMap` → SDK `attributes`
3628
+ * server `attributes` → SDK `attributeList`
3629
+ * other fields → passed through
3630
+ * null/undefined actor → null
3631
+ */
3632
+ const ACTOR_TRANSFORM_EXPR = "actor: args.actor ? (({ attributeMap, attributes: attrList, ...rest }) => ({ ...rest, attributes: attributeMap, attributeList: attrList }))(args.actor) : null";
3633
+ /**
3634
+ * Build the JavaScript expression that transforms server-format executor event
3635
+ * args into SDK-format args at runtime.
3636
+ *
3637
+ * The Tailor Platform server delivers event args with server-side field names.
3638
+ * The SDK exposes different field names to user code. This function produces a
3639
+ * JavaScript expression string that performs the mapping when evaluated
3640
+ * server-side.
3641
+ * @param triggerKind - The trigger kind discriminant from the parsed executor
3642
+ * @param env - Application env record to embed in the expression
3643
+ * @returns A JavaScript expression string, e.g. `({ ...args, ... })`
3644
+ */
3645
+ function buildExecutorArgsExpr(triggerKind, env) {
3646
+ const envExpr = `env: ${JSON.stringify(env)}`;
3647
+ switch (triggerKind) {
3648
+ case "schedule": return `({ ...args, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, ${envExpr} })`;
3649
+ case "resolverExecuted": return `({ ...args, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, success: !!args.succeeded, result: args.succeeded?.result.resolver, error: args.failed?.error, ${envExpr} })`;
3650
+ case "incomingWebhook": return `({ ...args, appNamespace: args.namespaceName, rawBody: args.raw_body, ${envExpr} })`;
3651
+ default: return `({ ...args, event: args.eventType?.split(".").pop(), rawEvent: args.eventType, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, ${envExpr} })`;
3652
+ }
3653
+ }
3654
+ /**
3655
+ * Build the operationHook expression for resolver pipelines.
3656
+ *
3657
+ * Transforms server context to SDK resolver context:
3658
+ * context.args → input
3659
+ * context.pipeline → spread into result
3660
+ * user (global var) → TailorUser (via tailorUserMap: workspace_id→workspaceId, attribute_map→attributes, attributes→attributeList)
3661
+ * env → injected as JSON
3662
+ * @param env - Application env record to embed in the expression
3663
+ * @returns A JavaScript expression string for the operationHook
3664
+ */
3665
+ function buildResolverOperationHookExpr(env) {
3666
+ return `({ ...context.pipeline, input: context.args, user: ${tailorUserMap}, env: ${JSON.stringify(env)} });`;
3667
+ }
3668
+
3595
3669
  //#endregion
3596
3670
  //#region src/parser/service/executor/schema.ts
3597
3671
  const TailorDBTriggerSchema = z.object({
@@ -3782,7 +3856,10 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
3782
3856
  const entryContent = ml`
3783
3857
  import _internalExecutor from "${path.resolve(executor.sourceFile)}";
3784
3858
 
3785
- const __executor_function = _internalExecutor.operation.body;
3859
+ const __executor_function = async (args) => {
3860
+ const invoker = ${INVOKER_EXPR};
3861
+ return _internalExecutor.operation.body({ ...args, invoker });
3862
+ };
3786
3863
 
3787
3864
  export { __executor_function as main };
3788
3865
  `;
@@ -3978,6 +4055,7 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
3978
4055
  import { t } from "@tailor-platform/sdk";
3979
4056
 
3980
4057
  const $tailor_resolver_body = async (context) => {
4058
+ const invoker = ${INVOKER_EXPR};
3981
4059
  if (_internalResolver.input) {
3982
4060
  const result = t.object(_internalResolver.input).parse({
3983
4061
  value: context.input,
@@ -3993,7 +4071,7 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
3993
4071
  }
3994
4072
  }
3995
4073
 
3996
- return _internalResolver.body(context);
4074
+ return _internalResolver.body({ ...context, invoker });
3997
4075
  };
3998
4076
 
3999
4077
  export { $tailor_resolver_body as main };
@@ -4370,7 +4448,8 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
4370
4448
 
4371
4449
  export async function main(input) {
4372
4450
  const env = ${JSON.stringify(env)};
4373
- return await ${job.exportName}.body(input, { env });
4451
+ const invoker = ${INVOKER_EXPR};
4452
+ return await ${job.exportName}.body(input, { env, invoker });
4374
4453
  }
4375
4454
  `;
4376
4455
  fs$1.writeFileSync(entryPath, entryContent);
@@ -5087,5 +5166,5 @@ async function loadApplication(params) {
5087
5166
  }
5088
5167
 
5089
5168
  //#endregion
5090
- export { resolveTokens as C, readPlatformConfig as S, writePlatformConfig as T, loadConfig as _, WorkflowJobSchema as a, loadAccessToken as b, ExecutorSchema as c, stringifyFunction as d, tailorUserMap as f, hashFile as g, getDistDir as h, resolveInlineSourcemap as i, OAuth2ClientSchema as l, createBundleCache as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, loadFilesWithIgnores as p, loadApplication as r, createExecutorService as s, defineApplication as t, TailorDBTypeSchema as u, deleteUserTokens as v, saveUserTokens as w, loadWorkspaceId as x, fetchLatestToken as y };
5091
- //# sourceMappingURL=application-EvhIIVg0.mjs.map
5169
+ export { loadWorkspaceId as C, writePlatformConfig as D, saveUserTokens as E, loadAccessToken as S, resolveTokens as T, getDistDir as _, WorkflowJobSchema as a, deleteUserTokens as b, ExecutorSchema as c, buildResolverOperationHookExpr as d, OAuth2ClientSchema as f, createBundleCache as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, INVOKER_EXPR as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, createExecutorService as s, defineApplication as t, buildExecutorArgsExpr as u, hashFile as v, readPlatformConfig as w, fetchLatestToken as x, loadConfig as y };
5170
+ //# sourceMappingURL=application-DkVNbIuh.mjs.map