@tailor-platform/sdk 1.36.0 → 1.37.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 (76) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/application-ILhZq_oW.mjs +4 -0
  3. package/dist/{application-BwboBFcU.mjs → application-qRGMV8Tr.mjs} +50 -20
  4. package/dist/application-qRGMV8Tr.mjs.map +1 -0
  5. package/dist/{brand-0SscafcY.mjs → brand-D-d15jx3.mjs} +1 -1
  6. package/dist/{brand-0SscafcY.mjs.map → brand-D-d15jx3.mjs.map} +1 -1
  7. package/dist/cli/index.mjs +11 -11
  8. package/dist/cli/index.mjs.map +1 -1
  9. package/dist/cli/lib.d.mts +6 -6
  10. package/dist/cli/lib.mjs +7 -7
  11. package/dist/{client-B6icVEv4.mjs → client-424n_3T9.mjs} +1 -1
  12. package/dist/{client-CN15WgW2.mjs → client-DllDLYmZ.mjs} +4 -4
  13. package/dist/{client-CN15WgW2.mjs.map → client-DllDLYmZ.mjs.map} +1 -1
  14. package/dist/configure/index.d.mts +5 -5
  15. package/dist/configure/index.mjs +4 -14
  16. package/dist/configure/index.mjs.map +1 -1
  17. package/dist/{crash-report-CdxPj_SW.mjs → crash-report-CDQ2JvgR.mjs} +4 -4
  18. package/dist/{crash-report-CdxPj_SW.mjs.map → crash-report-CDQ2JvgR.mjs.map} +1 -1
  19. package/dist/{crash-report-CB1UtT3O.mjs → crash-report-aHnky_xH.mjs} +1 -1
  20. package/dist/{enum-constants-DI85-fPE.mjs → enum-constants-Dx82rSjf.mjs} +1 -1
  21. package/dist/{enum-constants-DI85-fPE.mjs.map → enum-constants-Dx82rSjf.mjs.map} +1 -1
  22. package/dist/{env-_ce3IYbl.d.mts → env-04IQXqsl.d.mts} +2 -2
  23. package/dist/{file-utils-C4rXlOVt.mjs → file-utils-DeWpvq3T.mjs} +1 -1
  24. package/dist/{file-utils-C4rXlOVt.mjs.map → file-utils-DeWpvq3T.mjs.map} +1 -1
  25. package/dist/{index-C7vIBAg8.d.mts → index-BUT18Kak.d.mts} +2 -2
  26. package/dist/{index-CYaunQeL.d.mts → index-BVJQLjyN.d.mts} +27 -12
  27. package/dist/{index-DDCyefuU.d.mts → index-C3kcXHXJ.d.mts} +2 -2
  28. package/dist/{index-DZN1QFLM.d.mts → index-CeS4FA9o.d.mts} +2 -2
  29. package/dist/{index-CxSLivW7.d.mts → index-DnIg_LfT.d.mts} +2 -2
  30. package/dist/{interceptor-f7slMkCC.mjs → interceptor-dSNiQq71.mjs} +1 -1
  31. package/dist/{interceptor-f7slMkCC.mjs.map → interceptor-dSNiQq71.mjs.map} +1 -1
  32. package/dist/{job-CPKYCk_e.mjs → job-DkAklmE4.mjs} +2 -2
  33. package/dist/{job-CPKYCk_e.mjs.map → job-DkAklmE4.mjs.map} +1 -1
  34. package/dist/{kysely-type-DtnNdHn3.mjs → kysely-type-CwtvQuxh.mjs} +1 -1
  35. package/dist/{kysely-type-DtnNdHn3.mjs.map → kysely-type-CwtvQuxh.mjs.map} +1 -1
  36. package/dist/{logger-qz-Y4sBV.mjs → logger-C8qBDCKO.mjs} +1 -1
  37. package/dist/{logger-qz-Y4sBV.mjs.map → logger-C8qBDCKO.mjs.map} +1 -1
  38. package/dist/package-json--6dmp6-h.mjs +4 -0
  39. package/dist/{package-json-CfUqjJaQ.mjs → package-json-BHViVisJ.mjs} +1 -1
  40. package/dist/{package-json-CfUqjJaQ.mjs.map → package-json-BHViVisJ.mjs.map} +1 -1
  41. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  42. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  43. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  44. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  45. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  46. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  47. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  48. package/dist/plugin/builtin/seed/index.mjs +1 -1
  49. package/dist/plugin/index.d.mts +2 -2
  50. package/dist/{plugin-CiPUxkyN.d.mts → plugin-D6P4g_2L.d.mts} +14 -9
  51. package/dist/{runtime-C7RRDaB3.mjs → runtime-D9ejnCm6.mjs} +566 -95
  52. package/dist/runtime-D9ejnCm6.mjs.map +1 -0
  53. package/dist/{schema-D27cW0Ca.mjs → schema-CnwUqPyM.mjs} +4 -361
  54. package/dist/schema-CnwUqPyM.mjs.map +1 -0
  55. package/dist/{seed-BZIFDG27.mjs → seed-DrbB1VXd.mjs} +1 -1
  56. package/dist/{seed-BZIFDG27.mjs.map → seed-DrbB1VXd.mjs.map} +1 -1
  57. package/dist/telemetry-4IOPW6wE.mjs +4 -0
  58. package/dist/{telemetry-CREcGK8y.mjs → telemetry-DwHuiNiR.mjs} +2 -2
  59. package/dist/{telemetry-CREcGK8y.mjs.map → telemetry-DwHuiNiR.mjs.map} +1 -1
  60. package/dist/types-B9ZMosul.mjs +372 -0
  61. package/dist/types-B9ZMosul.mjs.map +1 -0
  62. package/dist/types-C45jRrCM.mjs +4 -0
  63. package/dist/utils/test/index.d.mts +2 -2
  64. package/dist/utils/test/index.mjs +1 -1
  65. package/dist/{workflow.generated-8BeGQsVU.d.mts → workflow.generated-Bj_DVqGh.d.mts} +2 -2
  66. package/docs/services/auth.md +6 -5
  67. package/docs/services/executor.md +5 -12
  68. package/docs/services/resolver.md +6 -13
  69. package/docs/services/workflow.md +4 -3
  70. package/package.json +4 -4
  71. package/dist/application-BB5TqXWY.mjs +0 -4
  72. package/dist/application-BwboBFcU.mjs.map +0 -1
  73. package/dist/package-json-D5Km1jjt.mjs +0 -4
  74. package/dist/runtime-C7RRDaB3.mjs.map +0 -1
  75. package/dist/schema-D27cW0Ca.mjs.map +0 -1
  76. package/dist/telemetry-C508zIi1.mjs +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.37.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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.
8
+
9
+ - [#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
10
+
11
+ 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.
12
+
13
+ Plan summary counts now reflect grouped display units to match the displayed rows.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#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
18
+
19
+ - [#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
20
+
21
+ - [#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
22
+
23
+ - [#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
24
+
25
+ - [#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
26
+
27
+ - [#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
28
+
3
29
  ## 1.36.0
4
30
 
5
31
  ### Minor Changes
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-qRGMV8Tr.mjs";
3
+
4
+ export { defineApplication };
@@ -1,12 +1,12 @@
1
1
 
2
- import { l as initOAuth2Client } from "./client-CN15WgW2.mjs";
3
- import { n as isSdkBranded } from "./brand-0SscafcY.mjs";
4
- import { n as logger, r as styles } from "./logger-qz-Y4sBV.mjs";
5
- import { t as readPackageJson } from "./package-json-CfUqjJaQ.mjs";
6
- import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-BZIFDG27.mjs";
7
- import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-DI85-fPE.mjs";
8
- import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-C4rXlOVt.mjs";
9
- import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-DtnNdHn3.mjs";
2
+ import { l as initOAuth2Client } from "./client-DllDLYmZ.mjs";
3
+ import { n as isSdkBranded } from "./brand-D-d15jx3.mjs";
4
+ import { n as logger, r as styles } from "./logger-C8qBDCKO.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 authInvokerExpr = call.authInvoker.isShorthand ? "authInvoker" : call.authInvoker.valueText;
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
- return applyReplacements(source, replacements);
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 AuthInvokerSchema = z.object({
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")
@@ -4212,7 +4242,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
4212
4242
  handler(code, id) {
4213
4243
  if (!code.includes("createWorkflowJob") && !code.includes("createWorkflow") && !code.includes(".trigger(")) return null;
4214
4244
  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);
4245
+ if (triggerContext && transformed.includes(".trigger(")) transformed = transformFunctionTriggers(transformed, triggerContext.workflowNameMap, triggerContext.jobNameMap, triggerContext.workflowFileMap, id, triggerContext.authNamespace);
4216
4246
  return { code: transformed };
4217
4247
  }
4218
4248
  }
@@ -4986,7 +5016,7 @@ async function loadApplication(params) {
4986
5016
  const executorService = defineExecutor(config.executor, pluginExecutorFiles.length > 0);
4987
5017
  const workflowService = defineWorkflow(config.workflow);
4988
5018
  if (workflowService) await workflowService.loadWorkflows();
4989
- const triggerContext = await buildTriggerContext(config.workflow);
5019
+ const triggerContext = await buildTriggerContext(config.workflow, authResult.authService?.config.name);
4990
5020
  const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
4991
5021
  const bundledScripts = {
4992
5022
  resolvers: /* @__PURE__ */ new Map(),
@@ -5050,4 +5080,4 @@ async function loadApplication(params) {
5050
5080
 
5051
5081
  //#endregion
5052
5082
  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-BwboBFcU.mjs.map
5083
+ //# sourceMappingURL=application-qRGMV8Tr.mjs.map