@tailor-platform/sdk 1.47.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 (64) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{actor-DhXSqWTW.d.mts → actor-jk4-f0yp.d.mts} +2 -2
  3. package/dist/{application-TasSqBTD.mjs → application-C7H7y0hS.mjs} +46 -64
  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 +8 -8
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.mjs +3 -3
  11. package/dist/cli/lib.mjs.map +1 -1
  12. package/dist/cli/skills.mjs.map +1 -1
  13. package/dist/{client-DYSkSLRr.mjs → client-DCqdtFte.mjs} +1 -1
  14. package/dist/client-DbyKSN1F.mjs +1061 -0
  15. package/dist/client-DbyKSN1F.mjs.map +1 -0
  16. package/dist/configure/index.d.mts +2 -2
  17. package/dist/configure/index.mjs +5 -5
  18. package/dist/configure/index.mjs.map +1 -1
  19. package/dist/{crashreport-CKJwnWsX.mjs → crashreport-CNSw_BrJ.mjs} +2 -2
  20. package/dist/{crashreport-CKJwnWsX.mjs.map → crashreport-CNSw_BrJ.mjs.map} +1 -1
  21. package/dist/{crashreport-B8lVOx0U.mjs → crashreport-DXGFd16F.mjs} +1 -1
  22. package/dist/enum-constants-C3KSpsYj.mjs.map +1 -1
  23. package/dist/errors-wNQxQQBH.mjs.map +1 -1
  24. package/dist/{field-BY2vbJ8f.mjs → field-DLSIuMTu.mjs} +1 -1
  25. package/dist/{field-BY2vbJ8f.mjs.map → field-DLSIuMTu.mjs.map} +1 -1
  26. package/dist/file-utils-DjNi_3U_.mjs.map +1 -1
  27. package/dist/{index-BoU_52Du.d.mts → index-DB8EapT-.d.mts} +5 -13
  28. package/dist/interceptor-CBsqEWDK.mjs.map +1 -1
  29. package/dist/{job-BOvKyNdT.mjs → job-R5C2Hfcc.mjs} +2 -3
  30. package/dist/job-R5C2Hfcc.mjs.map +1 -0
  31. package/dist/kysely/index.mjs.map +1 -1
  32. package/dist/kysely-type-B8aRz_oC.mjs.map +1 -1
  33. package/dist/logger-DTNAMYGy.mjs.map +1 -1
  34. package/dist/mock-BP-9O5On.mjs.map +1 -1
  35. package/dist/multiline-e3IpANmS.mjs.map +1 -1
  36. package/dist/package-json-6Px8bDpG.mjs.map +1 -1
  37. package/dist/plugin/index.d.mts +1 -1
  38. package/dist/plugin/index.mjs.map +1 -1
  39. package/dist/repl-editor-CZpLlOBj.mjs.map +1 -1
  40. package/dist/{runtime-DDYL2Zf1.mjs → runtime-XjP6JMmP.mjs} +10 -7
  41. package/dist/{runtime-DDYL2Zf1.mjs.map → runtime-XjP6JMmP.mjs.map} +1 -1
  42. package/dist/seed/index.mjs.map +1 -1
  43. package/dist/seed-DrKY5yIF.mjs.map +1 -1
  44. package/dist/service-obEU5gSM.mjs.map +1 -1
  45. package/dist/{tailordb-Bg9-TZj1.mjs → tailordb-DjlNUV6u.mjs} +3 -3
  46. package/dist/{tailordb-Bg9-TZj1.mjs.map → tailordb-DjlNUV6u.mjs.map} +1 -1
  47. package/dist/telemetry-DcL8Fsm_.mjs.map +1 -1
  48. package/dist/types-DoIG6Nij.mjs +5 -0
  49. package/dist/{types-Duhhsx3R.mjs → types-sir9UPht.mjs} +2 -2
  50. package/dist/{types-Duhhsx3R.mjs.map → types-sir9UPht.mjs.map} +1 -1
  51. package/dist/utils/test/index.d.mts +1 -1
  52. package/dist/utils/test/index.mjs +1 -1
  53. package/dist/utils/test/index.mjs.map +1 -1
  54. package/dist/vitest/environment.mjs.map +1 -1
  55. package/dist/vitest/index.mjs.map +1 -1
  56. package/dist/vitest/setup.mjs.map +1 -1
  57. package/docs/services/workflow.md +0 -5
  58. package/package.json +6 -5
  59. package/dist/application-CN9Htzup.mjs +0 -4
  60. package/dist/application-TasSqBTD.mjs.map +0 -1
  61. package/dist/client-COfsXV69.mjs +0 -16447
  62. package/dist/client-COfsXV69.mjs.map +0 -1
  63. package/dist/job-BOvKyNdT.mjs.map +0 -1
  64. package/dist/types-BnphjkIJ.mjs +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+
3
15
  ## 1.47.0
4
16
 
5
17
  ### Minor Changes
@@ -4,7 +4,7 @@ import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailo
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-DhXSqWTW.d.mts.map
30
+ //# sourceMappingURL=actor-jk4-f0yp.d.mts.map
@@ -1,6 +1,6 @@
1
1
 
2
- import { u as initOAuth2Client } from "./client-COfsXV69.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);
@@ -4406,10 +4388,10 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
4406
4388
  if (isInsideRemovedRange(call.callRange.start)) continue;
4407
4389
  const jobName = jobNameMap.get(call.identifierName);
4408
4390
  if (jobName) {
4409
- const transformedCall = `tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"})`;
4391
+ const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}))()`;
4410
4392
  replacements.push({
4411
- start: call.fullRange.start,
4412
- end: call.fullRange.end,
4393
+ start: call.callRange.start,
4394
+ end: call.callRange.end,
4413
4395
  text: transformedCall
4414
4396
  });
4415
4397
  }
@@ -5299,4 +5281,4 @@ async function loadApplication(params) {
5299
5281
 
5300
5282
  //#endregion
5301
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 };
5302
- //# sourceMappingURL=application-TasSqBTD.mjs.map
5284
+ //# sourceMappingURL=application-C7H7y0hS.mjs.map