@tailor-platform/sdk 1.46.0 → 1.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/{actor-BmxQeMFP.d.mts → actor-jk4-f0yp.d.mts} +3 -3
  3. package/dist/{application-B4zVVNRS.mjs → application-C7H7y0hS.mjs} +66 -103
  4. package/dist/application-C7H7y0hS.mjs.map +1 -0
  5. package/dist/application-Csq5jxYP.mjs +4 -0
  6. package/dist/{brand-Ll48SMXe.mjs → brand-D-d15jx3.mjs} +1 -1
  7. package/dist/{brand-Ll48SMXe.mjs.map → brand-D-d15jx3.mjs.map} +1 -1
  8. package/dist/cli/index.mjs +36 -18
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +6 -6
  11. package/dist/cli/lib.mjs +3 -3
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/cli/skills.mjs.map +1 -1
  14. package/dist/{client-DTaArWQr.mjs → client-DCqdtFte.mjs} +1 -1
  15. package/dist/client-DbyKSN1F.mjs +1061 -0
  16. package/dist/client-DbyKSN1F.mjs.map +1 -0
  17. package/dist/configure/index.d.mts +4 -4
  18. package/dist/configure/index.mjs +8 -47
  19. package/dist/configure/index.mjs.map +1 -1
  20. package/dist/{crashreport-DGeGj9BF.mjs → crashreport-CNSw_BrJ.mjs} +2 -2
  21. package/dist/{crashreport-DGeGj9BF.mjs.map → crashreport-CNSw_BrJ.mjs.map} +1 -1
  22. package/dist/{crashreport-6mcMyWu4.mjs → crashreport-DXGFd16F.mjs} +1 -1
  23. package/dist/enum-constants-C3KSpsYj.mjs.map +1 -1
  24. package/dist/errors-wNQxQQBH.mjs.map +1 -1
  25. package/dist/{field-BY2vbJ8f.mjs → field-DLSIuMTu.mjs} +1 -1
  26. package/dist/{field-BY2vbJ8f.mjs.map → field-DLSIuMTu.mjs.map} +1 -1
  27. package/dist/file-utils-DjNi_3U_.mjs.map +1 -1
  28. package/dist/{index-DV-5OIEv.d.mts → index-BRvNi5q9.d.mts} +2 -2
  29. package/dist/{index-BBvPd9Uv.d.mts → index-BXyS7xKC.d.mts} +2 -2
  30. package/dist/{index-Dxe6alSZ.d.mts → index-BbOTbZFf.d.mts} +2 -2
  31. package/dist/{index-PB0otrDj.d.mts → index-DB8EapT-.d.mts} +7 -15
  32. package/dist/{index-B5_4Tzm2.d.mts → index-iy-hNfGp.d.mts} +2 -2
  33. package/dist/{interceptor-CrcDfLPq.mjs → interceptor-CBsqEWDK.mjs} +1 -1
  34. package/dist/{interceptor-CrcDfLPq.mjs.map → interceptor-CBsqEWDK.mjs.map} +1 -1
  35. package/dist/{job-BOvKyNdT.mjs → job-R5C2Hfcc.mjs} +2 -3
  36. package/dist/job-R5C2Hfcc.mjs.map +1 -0
  37. package/dist/kysely/index.mjs.map +1 -1
  38. package/dist/kysely-type-B8aRz_oC.mjs.map +1 -1
  39. package/dist/logger-DTNAMYGy.mjs.map +1 -1
  40. package/dist/mock-BP-9O5On.mjs +796 -0
  41. package/dist/mock-BP-9O5On.mjs.map +1 -0
  42. package/dist/multiline-e3IpANmS.mjs.map +1 -1
  43. package/dist/package-json-6Px8bDpG.mjs.map +1 -1
  44. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  45. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  46. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  47. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  48. package/dist/plugin/index.d.mts +2 -2
  49. package/dist/plugin/index.mjs.map +1 -1
  50. package/dist/{repl-editor-BlT2dFtm.mjs → repl-editor-CZpLlOBj.mjs} +1 -1
  51. package/dist/{repl-editor-BlT2dFtm.mjs.map → repl-editor-CZpLlOBj.mjs.map} +1 -1
  52. package/dist/{runtime-B67skpW-.mjs → runtime-XjP6JMmP.mjs} +91 -10
  53. package/dist/runtime-XjP6JMmP.mjs.map +1 -0
  54. package/dist/seed/index.mjs.map +1 -1
  55. package/dist/seed-DrKY5yIF.mjs.map +1 -1
  56. package/dist/{service-CCgw66c6.mjs → service-obEU5gSM.mjs} +1 -1
  57. package/dist/{service-CCgw66c6.mjs.map → service-obEU5gSM.mjs.map} +1 -1
  58. package/dist/{tailor-db-field-Hx9OqPWY.d.mts → tailor-db-field-Bn8ZC5lK.d.mts} +1 -1
  59. package/dist/{schema-DBq6hr6h.mjs → tailordb-DjlNUV6u.mjs} +44 -4
  60. package/dist/tailordb-DjlNUV6u.mjs.map +1 -0
  61. package/dist/telemetry-DcL8Fsm_.mjs.map +1 -1
  62. package/dist/types-DoIG6Nij.mjs +5 -0
  63. package/dist/{types-Duhhsx3R.mjs → types-sir9UPht.mjs} +2 -2
  64. package/dist/{types-Duhhsx3R.mjs.map → types-sir9UPht.mjs.map} +1 -1
  65. package/dist/utils/test/index.d.mts +13 -4
  66. package/dist/utils/test/index.mjs +13 -4
  67. package/dist/utils/test/index.mjs.map +1 -1
  68. package/dist/vitest/environment.d.mts +12 -0
  69. package/dist/vitest/environment.mjs +44 -0
  70. package/dist/vitest/environment.mjs.map +1 -0
  71. package/dist/vitest/index.d.mts +345 -0
  72. package/dist/vitest/index.mjs +350 -0
  73. package/dist/vitest/index.mjs.map +1 -0
  74. package/dist/vitest/setup.d.mts +64 -0
  75. package/dist/vitest/setup.mjs +141 -0
  76. package/dist/vitest/setup.mjs.map +1 -0
  77. package/dist/{workflow.generated-DFljpJh7.d.mts → workflow.generated-i7PK4fg-.d.mts} +2 -2
  78. package/docs/cli/setup.md +1 -0
  79. package/docs/services/tailordb.md +43 -12
  80. package/docs/services/workflow.md +1 -6
  81. package/docs/testing.md +530 -243
  82. package/package.json +37 -10
  83. package/dist/application-B4zVVNRS.mjs.map +0 -1
  84. package/dist/application-Boa_11Nv.mjs +0 -4
  85. package/dist/client-BwXkoiMq.mjs +0 -16536
  86. package/dist/client-BwXkoiMq.mjs.map +0 -1
  87. package/dist/job-BOvKyNdT.mjs.map +0 -1
  88. package/dist/runtime-B67skpW-.mjs.map +0 -1
  89. package/dist/schema-DBq6hr6h.mjs.map +0 -1
  90. package/dist/types-BnphjkIJ.mjs +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.47.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1176](https://github.com/tailor-platform/sdk/pull/1176) [`5abed20`](https://github.com/tailor-platform/sdk/commit/5abed20dff48e24f23675989143e33c8afb23845) Thanks [@toiroakr](https://github.com/toiroakr)! - Declare `undici` as a direct dependency. The SDK CLI imports `getGlobalDispatcher` from `undici`, but the package was previously available only through accidental hoisting of a transitive dependency. Strict node_modules layouts (e.g. pnpm 11 with stricter hoisting) would fail to resolve the import; declaring it directly fixes that.
8
+
9
+ - [#1172](https://github.com/tailor-platform/sdk/pull/1172) [`7f37a07`](https://github.com/tailor-platform/sdk/commit/7f37a076a281fdca03d2301e1dba95668b2f7222) Thanks [@toiroakr](https://github.com/toiroakr)! - Widen `TailorEnv` fallback to `Record<string, string | number | boolean>` so it matches the values the type generator emits (string literal / number / boolean). Previously the fallback was `Record<string, string>`, which rejected number and boolean env values until `tailor.d.ts` was generated.
10
+
11
+ - [#1161](https://github.com/tailor-platform/sdk/pull/1161) [`3e835c5`](https://github.com/tailor-platform/sdk/commit/3e835c55e27fbfedff94a169d1c2fb3c4f50e0a3) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update rolldown
12
+
13
+ - [#1165](https://github.com/tailor-platform/sdk/pull/1165) [`f4ff7bd`](https://github.com/tailor-platform/sdk/commit/f4ff7bd5318be0a1142a557c76a17896d9df193a) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix a type/runtime mismatch where calling `workflowJob.trigger()` without `await` returned a raw value at runtime even though the static type is `Promise<Awaited<Output>>`. The bundler now wraps `.trigger()` in an async IIFE (`(async () => tailor.workflow.triggerJobFunction("...", args))()`), so the returned value is always a `Promise` (including for `.then()` chains), synchronous throws from the platform surface as Promise rejections, and the platform's synchronous suspend semantics are preserved (the call site runs to completion before subsequent statements).
14
+
15
+ ## 1.47.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#1115](https://github.com/tailor-platform/sdk/pull/1115) [`8dd619e`](https://github.com/tailor-platform/sdk/commit/8dd619e9c58f4662b117bbd968ecf9528d688fe4) Thanks [@toiroakr](https://github.com/toiroakr)! - Add `@tailor-platform/sdk/vitest` (beta) — a Vitest plugin and environment that emulates the Tailor Platform function runtime locally. Catches `node:*` imports and Node.js globals usage that would fail at deploy time, and provides mock control objects (`tailordbMock`, `workflowMock`, `secretmanagerMock`, `authconnectionMock`, `idpMock`, `fileMock`, `iconvMock`) for all platform APIs with response configuration and call recording.
20
+
21
+ Revamp `packages/sdk/docs/testing.md` into a 2-layer model (Unit Tests / E2E Tests). The previous structure split Unit, Bundled, and Workflow tests across overlapping sections and contained broken vitest imports and references to a non-existent `--template testing`. The new docs cover testing resolvers (simple, with TailorDB mocks, with DI, and with wait points) and workflow jobs (simple, with `triggerJobFunction` mocks, with wait-point mocks, and full-workflow integration), all anchored on the actual `resolver` and `workflow` templates.
22
+
23
+ Mark `createImportMain` and `setupInvokerMock` from `@tailor-platform/sdk/test` as `@deprecated`. `createImportMain` is an SDK-internal helper for verifying bundled output; applications should test their TypeScript source directly (unit) and verify deployed behavior via E2E. `setupInvokerMock` is superseded by the `tailor-runtime` Vitest environment, where bundled tests can drive the invoker via `vi.spyOn(globalThis.tailor.context, "getInvoker").mockReturnValue(...)` and unit tests can pass `invoker` directly to `.body()`. Both exports remain in place for now to avoid a breaking change and will be removed in a future release.
24
+
25
+ Remove the broken `tests/bundled.test.ts` from the `resolver` and `workflow` templates along with the related `bundled` vitest project and `test:bundled` / `test:bundled:prepare` scripts. These tests were not exercised by CI and had drifted out of sync with the SDK, producing failures on a fresh scaffold.
26
+
27
+ Fix a broken anchor in `docs/services/workflow.md` that pointed at the removed `#testing-wait-points` heading; it now links to `../testing.md#jobs-that-wait-on-approval` to match the new testing docs structure.
28
+
29
+ ### Patch Changes
30
+
31
+ - [#1155](https://github.com/tailor-platform/sdk/pull/1155) [`fd70f8c`](https://github.com/tailor-platform/sdk/commit/fd70f8c75aa9a315eaf23ee25f36f43324b2eb54) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix false-positive remote schema drift on `decimal` fields without an explicit
32
+ `scale`. The platform stores decimal fields with a default scale of 6, but the
33
+ snapshot generated by `tailor-sdk tailordb migration generate --init` did not
34
+ record this default, so `tailor-sdk deploy` (formerly `apply`) reported drift as
35
+ `scale: remote=6, expected=undefined` and blocked the deploy.
36
+
37
+ Migration drift detection now treats an unset `scale` on a `decimal` field as
38
+ equivalent to the platform default (6). No regeneration of existing snapshots
39
+ is required; users no longer need `--no-schema-check` to work around this case.
40
+
41
+ - [#1164](https://github.com/tailor-platform/sdk/pull/1164) [`b1e8f5a`](https://github.com/tailor-platform/sdk/commit/b1e8f5a7e971527ff04cdb5867cacda2415e01bf) Thanks [@toiroakr](https://github.com/toiroakr)! - Eliminate the parser-layer exception that allowed `parser/service/tailordb/runtime.ts` to re-export runtime helpers from the configure module. Plugin attachment processing for a TailorDB type now lives in `PluginManager.processAttachmentsForType` and returns plain data (extended type, generated types, render events), so the cli layer applies state and renders progress without depending on `TailorAnyDBType`. Internal refactor with no public API change.
42
+
43
+ - [#1134](https://github.com/tailor-platform/sdk/pull/1134) [`02e12f6`](https://github.com/tailor-platform/sdk/commit/02e12f6b4a0a5986bc925defcac44717ae293c88) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update @opentelemetry
44
+
45
+ - [#1135](https://github.com/tailor-platform/sdk/pull/1135) [`8f53196`](https://github.com/tailor-platform/sdk/commit/8f53196bd66e4ecba702074399979d577e289a07) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @clack/prompts to v1.3.0
46
+
47
+ - [#1137](https://github.com/tailor-platform/sdk/pull/1137) [`aef3653`](https://github.com/tailor-platform/sdk/commit/aef365380900c65420237cb47f75ff56f31c939a) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @napi-rs/keyring to v1.3.0
48
+
49
+ - [#1047](https://github.com/tailor-platform/sdk/pull/1047) [`aa6ec4a`](https://github.com/tailor-platform/sdk/commit/aa6ec4a562b771526ffb553aa03f7061ed483504) Thanks [@toiroakr](https://github.com/toiroakr)! - chore(setup github): bump bundled `tailor-platform/actions` ref to v1.1.0 and let Renovate keep it up to date going forward.
50
+
3
51
  ## 1.46.0
4
52
 
5
53
  ### Minor Changes
@@ -1,10 +1,10 @@
1
1
  /// <reference types="@tailor-platform/function-types" />
2
- import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-Hx9OqPWY.mjs";
2
+ import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-Bn8ZC5lK.mjs";
3
3
 
4
4
  //#region src/types/env.d.ts
5
5
  interface Env {}
6
6
  /** Represents environment variables in the Tailor platform. */
7
- type TailorEnv = keyof Env extends never ? Record<string, string> : Env;
7
+ type TailorEnv = keyof Env extends never ? Record<string, string | number | boolean> : Env;
8
8
  //#endregion
9
9
  //#region src/types/actor.d.ts
10
10
  /** User type enum values from the Tailor Platform server. */
@@ -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-BmxQeMFP.d.mts.map
30
+ //# sourceMappingURL=actor-jk4-f0yp.d.mts.map
@@ -1,6 +1,6 @@
1
1
 
2
- import { u as initOAuth2Client } from "./client-BwXkoiMq.mjs";
3
- import { n as isSdkBranded } from "./brand-Ll48SMXe.mjs";
2
+ import { n as isSdkBranded } from "./brand-D-d15jx3.mjs";
3
+ import { u as initOAuth2Client } from "./client-DbyKSN1F.mjs";
4
4
  import { a as parseBoolean, n as logger, r as styles } from "./logger-DTNAMYGy.mjs";
5
5
  import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-C3KSpsYj.mjs";
6
6
  import { t as multiline } from "./multiline-e3IpANmS.mjs";
@@ -20,8 +20,8 @@ import { parseTOML, parseYAML, stringifyYAML } from "confbox";
20
20
  import { findUpSync } from "find-up-simple";
21
21
  import { lt } from "semver";
22
22
  import { xdgConfig } from "xdg-basedir";
23
- import * as crypto from "node:crypto";
24
23
  import { resolveTSConfig } from "pkg-types";
24
+ import * as crypto from "node:crypto";
25
25
  import * as rolldown from "rolldown";
26
26
  import * as fs from "node:fs/promises";
27
27
  import { parseSync } from "oxc-parser";
@@ -1601,7 +1601,7 @@ function buildJobNameMap(jobs) {
1601
1601
  */
1602
1602
  function detectTriggerCalls(program, sourceText) {
1603
1603
  const calls = [];
1604
- function walk(node, parent = null) {
1604
+ function walk(node) {
1605
1605
  if (!node || typeof node !== "object") return;
1606
1606
  if (node.type === "CallExpression") {
1607
1607
  const callExpr = node;
@@ -1613,33 +1613,23 @@ function detectTriggerCalls(program, sourceText) {
1613
1613
  let argsText = "";
1614
1614
  if (callExpr.arguments.length > 0) {
1615
1615
  const firstArg = callExpr.arguments[0];
1616
- const lastArg = callExpr.arguments[callExpr.arguments.length - 1];
1617
- if (firstArg && lastArg && "start" in firstArg && "end" in lastArg) argsText = sourceText.slice(firstArg.start, lastArg.end);
1616
+ if (firstArg && "start" in firstArg && "end" in firstArg) argsText = sourceText.slice(firstArg.start, firstArg.end);
1618
1617
  }
1619
- const hasAwait = parent?.type === "AwaitExpression";
1620
- const awaitExpr = hasAwait ? parent : null;
1621
- const callRange = {
1622
- start: callExpr.start,
1623
- end: callExpr.end
1624
- };
1625
- const fullRange = awaitExpr ? {
1626
- start: awaitExpr.start,
1627
- end: awaitExpr.end
1628
- } : callRange;
1629
1618
  calls.push({
1630
1619
  identifierName,
1631
- callRange,
1632
- argsText,
1633
- hasAwait,
1634
- fullRange
1620
+ callRange: {
1621
+ start: callExpr.start,
1622
+ end: callExpr.end
1623
+ },
1624
+ argsText
1635
1625
  });
1636
1626
  }
1637
1627
  }
1638
1628
  }
1639
1629
  for (const key of Object.keys(node)) {
1640
1630
  const child = node[key];
1641
- if (Array.isArray(child)) child.forEach((c) => walk(c, node));
1642
- else if (child && typeof child === "object") walk(child, node);
1631
+ if (Array.isArray(child)) child.forEach((c) => walk(c));
1632
+ else if (child && typeof child === "object") walk(child);
1643
1633
  }
1644
1634
  }
1645
1635
  walk(program);
@@ -1906,7 +1896,7 @@ function findDefaultImportRemovalRange(program, localName, source) {
1906
1896
  */
1907
1897
  function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames) {
1908
1898
  const calls = [];
1909
- function walk(node, parent = null) {
1899
+ function walk(node) {
1910
1900
  if (!node || typeof node !== "object") return;
1911
1901
  if (node.type === "CallExpression") {
1912
1902
  const callExpr = node;
@@ -1918,50 +1908,43 @@ function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames
1918
1908
  if (identifierName && propertyName === "trigger") {
1919
1909
  const isWorkflow = workflowNames.has(identifierName);
1920
1910
  const isJob = jobNames.has(identifierName);
1921
- if (!isWorkflow && !isJob) return;
1922
- const argCount = callExpr.arguments.length;
1923
- let argsText = "";
1924
- if (argCount > 0) {
1925
- const firstArg = callExpr.arguments[0];
1926
- if (firstArg && "start" in firstArg && "end" in firstArg) argsText = sourceText.slice(firstArg.start, firstArg.end);
1927
- }
1928
- const hasAwait = parent?.type === "AwaitExpression";
1929
- const awaitExpr = hasAwait ? parent : null;
1930
- if (isWorkflow && argCount >= 2) {
1931
- const secondArg = callExpr.arguments[1];
1932
- const authInvoker = extractAuthInvokerInfo(secondArg, sourceText);
1933
- if (authInvoker) calls.push({
1934
- kind: "workflow",
1911
+ if (isWorkflow || isJob) {
1912
+ const argCount = callExpr.arguments.length;
1913
+ let argsText = "";
1914
+ if (argCount > 0) {
1915
+ const firstArg = callExpr.arguments[0];
1916
+ if (firstArg && "start" in firstArg && "end" in firstArg) argsText = sourceText.slice(firstArg.start, firstArg.end);
1917
+ }
1918
+ if (isWorkflow && argCount >= 2) {
1919
+ const secondArg = callExpr.arguments[1];
1920
+ const authInvoker = extractAuthInvokerInfo(secondArg, sourceText);
1921
+ if (authInvoker) calls.push({
1922
+ kind: "workflow",
1923
+ identifierName,
1924
+ callRange: {
1925
+ start: callExpr.start,
1926
+ end: callExpr.end
1927
+ },
1928
+ argsText,
1929
+ authInvoker
1930
+ });
1931
+ } else if (isJob) calls.push({
1932
+ kind: "job",
1935
1933
  identifierName,
1936
1934
  callRange: {
1937
1935
  start: callExpr.start,
1938
1936
  end: callExpr.end
1939
1937
  },
1940
- argsText,
1941
- authInvoker,
1942
- hasAwait: false
1938
+ argsText
1943
1939
  });
1944
- } else if (isJob) calls.push({
1945
- kind: "job",
1946
- identifierName,
1947
- callRange: {
1948
- start: callExpr.start,
1949
- end: callExpr.end
1950
- },
1951
- argsText,
1952
- hasAwait,
1953
- fullRange: awaitExpr ? {
1954
- start: awaitExpr.start,
1955
- end: awaitExpr.end
1956
- } : void 0
1957
- });
1940
+ }
1958
1941
  }
1959
1942
  }
1960
1943
  }
1961
1944
  for (const key of Object.keys(node)) {
1962
1945
  const child = node[key];
1963
- if (Array.isArray(child)) child.forEach((c) => walk(c, node));
1964
- else if (child && typeof child === "object") walk(child, node);
1946
+ if (Array.isArray(child)) child.forEach((c) => walk(c));
1947
+ else if (child && typeof child === "object") walk(child);
1965
1948
  }
1966
1949
  }
1967
1950
  walk(program);
@@ -2019,11 +2002,10 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
2019
2002
  } else if (call.kind === "job") {
2020
2003
  const jobName = jobNameMap.get(call.identifierName);
2021
2004
  if (jobName) {
2022
- const transformedCall = `tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"})`;
2023
- const range = call.hasAwait && call.fullRange ? call.fullRange : call.callRange;
2005
+ const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}))()`;
2024
2006
  replacements.push({
2025
- start: range.start,
2026
- end: range.end,
2007
+ start: call.callRange.start,
2008
+ end: call.callRange.end,
2027
2009
  text: transformedCall
2028
2010
  });
2029
2011
  transformedCallsPerIdentifier.set(call.identifierName, (transformedCallsPerIdentifier.get(call.identifierName) ?? 0) + 1);
@@ -3287,46 +3269,27 @@ function createTailorDBService(params) {
3287
3269
  */
3288
3270
  const processPluginsForType = async (rawType, attachments, sourceFilePath) => {
3289
3271
  if (!pluginManager) return;
3290
- let currentType = rawType;
3291
- for (const attachment of attachments) {
3292
- const result = await pluginManager.processAttachment({
3293
- type: currentType,
3294
- typeConfig: attachment.config,
3295
- namespace,
3296
- pluginId: attachment.pluginId
3297
- });
3298
- if (!result.success) {
3299
- logger.error(result.error);
3300
- throw new Error(result.error);
3301
- }
3302
- const output = result.output;
3303
- const extendFields = output.extends?.fields;
3304
- if (extendFields && Object.keys(extendFields).length > 0) {
3305
- const extendedType = pluginManager.extendType({
3306
- originalType: currentType,
3307
- extendFields,
3308
- pluginId: attachment.pluginId
3309
- });
3310
- rawTypes[sourceFilePath][currentType.name] = extendedType;
3311
- currentType = extendedType;
3312
- logger.log(` Extended: ${styles.success(currentType.name)} with ${styles.highlight(Object.keys(extendFields).length.toString())} fields by plugin ${styles.info(attachment.pluginId)}`);
3313
- }
3314
- const plugin = pluginManager.getPlugin(attachment.pluginId);
3315
- for (const [kind, generatedType] of Object.entries(output.types ?? {})) {
3316
- rawTypes[sourceFilePath][generatedType.name] = generatedType;
3317
- typeSourceInfo[generatedType.name] = {
3318
- exportName: generatedType.name,
3319
- pluginId: attachment.pluginId,
3320
- pluginImportPath: pluginManager.getPluginImportPath(attachment.pluginId) ?? "",
3321
- originalFilePath: sourceFilePath,
3322
- originalExportName: typeSourceInfo[rawType.name]?.exportName || rawType.name,
3323
- generatedTypeKind: kind,
3324
- pluginConfig: plugin?.pluginConfig,
3325
- namespace
3326
- };
3327
- logger.log(` Generated: ${styles.success(generatedType.name)} by plugin ${styles.info(attachment.pluginId)}`);
3328
- }
3272
+ const { extendedType, generatedTypes, events } = await pluginManager.processAttachmentsForType({
3273
+ rawType,
3274
+ attachments,
3275
+ namespace
3276
+ });
3277
+ if (extendedType) rawTypes[sourceFilePath][rawType.name] = extendedType;
3278
+ for (const gen of generatedTypes) {
3279
+ rawTypes[sourceFilePath][gen.typeName] = gen.type;
3280
+ typeSourceInfo[gen.typeName] = {
3281
+ exportName: gen.typeName,
3282
+ pluginId: gen.pluginId,
3283
+ pluginImportPath: gen.pluginImportPath,
3284
+ originalFilePath: sourceFilePath,
3285
+ originalExportName: typeSourceInfo[rawType.name]?.exportName || rawType.name,
3286
+ generatedTypeKind: gen.kind,
3287
+ pluginConfig: gen.pluginConfig,
3288
+ namespace
3289
+ };
3329
3290
  }
3291
+ for (const ev of events) if (ev.kind === "extended") logger.log(` Extended: ${styles.success(ev.typeName)} with ${styles.highlight(ev.fieldCount.toString())} fields by plugin ${styles.info(ev.pluginId)}`);
3292
+ else logger.log(` Generated: ${styles.success(ev.typeName)} by plugin ${styles.info(ev.pluginId)}`);
3330
3293
  };
3331
3294
  const loadTypeFile = async (typeFile, tsconfig) => {
3332
3295
  rawTypes[typeFile] = {};
@@ -4425,10 +4388,10 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
4425
4388
  if (isInsideRemovedRange(call.callRange.start)) continue;
4426
4389
  const jobName = jobNameMap.get(call.identifierName);
4427
4390
  if (jobName) {
4428
- const transformedCall = `tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"})`;
4391
+ const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}))()`;
4429
4392
  replacements.push({
4430
- start: call.fullRange.start,
4431
- end: call.fullRange.end,
4393
+ start: call.callRange.start,
4394
+ end: call.callRange.end,
4432
4395
  text: transformedCall
4433
4396
  });
4434
4397
  }
@@ -5318,4 +5281,4 @@ async function loadApplication(params) {
5318
5281
 
5319
5282
  //#endregion
5320
5283
  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 };
5321
- //# sourceMappingURL=application-B4zVVNRS.mjs.map
5284
+ //# sourceMappingURL=application-C7H7y0hS.mjs.map