@tailor-platform/sdk 1.35.2 → 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 (79) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/application-ILhZq_oW.mjs +4 -0
  3. package/dist/{application-BnJRroGX.mjs → application-qRGMV8Tr.mjs} +150 -35
  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 +247 -12
  8. package/dist/cli/index.mjs.map +1 -1
  9. package/dist/cli/lib.d.mts +190 -6
  10. package/dist/cli/lib.mjs +7 -7
  11. package/dist/{client-BmQP4kKS.mjs → client-424n_3T9.mjs} +1 -1
  12. package/dist/{client-CA2NM_4R.mjs → client-DllDLYmZ.mjs} +28 -11
  13. package/dist/client-DllDLYmZ.mjs.map +1 -0
  14. package/dist/configure/index.d.mts +5 -4
  15. package/dist/configure/index.mjs +42 -23
  16. package/dist/configure/index.mjs.map +1 -1
  17. package/dist/{crash-report-CPkI2-cp.mjs → crash-report-CDQ2JvgR.mjs} +4 -4
  18. package/dist/{crash-report-CPkI2-cp.mjs.map → crash-report-CDQ2JvgR.mjs.map} +1 -1
  19. package/dist/{crash-report-Bd2T8BhU.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-04IQXqsl.d.mts +30 -0
  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-DTJkkO-t.d.mts → index-BUT18Kak.d.mts} +2 -2
  26. package/dist/{index--9iVDOXn.d.mts → index-BVJQLjyN.d.mts} +98 -12
  27. package/dist/{index-D4pBPp65.d.mts → index-C3kcXHXJ.d.mts} +2 -2
  28. package/dist/{index-niQ9Qblw.d.mts → index-CeS4FA9o.d.mts} +2 -2
  29. package/dist/{index-qVqjEYnr.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 -1
  50. package/dist/{plugin-D8hKE6rZ.d.mts → plugin-D6P4g_2L.d.mts} +17 -36
  51. package/dist/{runtime-D4O-RfcH.mjs → runtime-D9ejnCm6.mjs} +788 -109
  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-DMt8PNVd.d.mts → workflow.generated-Bj_DVqGh.d.mts} +212 -4
  66. package/docs/services/auth.md +6 -5
  67. package/docs/services/executor.md +5 -12
  68. package/docs/services/idp.md +50 -0
  69. package/docs/services/resolver.md +6 -13
  70. package/docs/services/secret.md +25 -0
  71. package/docs/services/workflow.md +4 -3
  72. package/package.json +7 -6
  73. package/dist/application-BnJRroGX.mjs.map +0 -1
  74. package/dist/application-mGasp_EX.mjs +0 -4
  75. package/dist/client-CA2NM_4R.mjs.map +0 -1
  76. package/dist/package-json-D5Km1jjt.mjs +0 -4
  77. package/dist/runtime-D4O-RfcH.mjs.map +0 -1
  78. package/dist/schema-D27cW0Ca.mjs.map +0 -1
  79. package/dist/telemetry-C508zIi1.mjs +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
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
+
29
+ ## 1.36.0
30
+
31
+ ### Minor Changes
32
+
33
+ - [#920](https://github.com/tailor-platform/sdk/pull/920) [`1b64d8e`](https://github.com/tailor-platform/sdk/commit/1b64d8e07c4b8b2c8bcfaded5210b8774d4556ff) Thanks [@dqn](https://github.com/dqn)! - Show original source locations and code snippets in `function test-run` errors using inline sourcemaps
34
+
35
+ - [#931](https://github.com/tailor-platform/sdk/pull/931) [`a1dab54`](https://github.com/tailor-platform/sdk/commit/a1dab54dfec4c7eb69348ab94a82de9d22231c45) Thanks [@toiroakr](https://github.com/toiroakr)! - Add `ignoreNullishValues` option to `defineSecretManager` to skip secrets with nullish values during deploy
36
+
37
+ - [#965](https://github.com/tailor-platform/sdk/pull/965) [`c273be3`](https://github.com/tailor-platform/sdk/commit/c273be330071a9e3d2d2ebc65ef9b17e9c995ddc) Thanks [@haru0017](https://github.com/haru0017)! - Add `defaultRedirectURL` to SAML IdP config for handling SAML ACS responses with empty RelayState
38
+
39
+ ### Patch Changes
40
+
41
+ - [#911](https://github.com/tailor-platform/sdk/pull/911) [`3cf9975`](https://github.com/tailor-platform/sdk/commit/3cf997591ac06c18a973cd16b3c6bc70b05f6793) Thanks [@k1LoW](https://github.com/k1LoW)! - Add `permission` option to `defineIdp()` for per-operation permission policies on IdP users (create, read, update, delete, sendPasswordResetEmail)
42
+
43
+ - [#947](https://github.com/tailor-platform/sdk/pull/947) [`19f95c2`](https://github.com/tailor-platform/sdk/commit/19f95c27e22027037457fcfcd9adca360f62553d) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency oxlint to v1.59.0
44
+
45
+ - [#956](https://github.com/tailor-platform/sdk/pull/956) [`391c53d`](https://github.com/tailor-platform/sdk/commit/391c53d32dd7108aead8917abb12a2b928df792a) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): lock file maintenance
46
+
47
+ - [#957](https://github.com/tailor-platform/sdk/pull/957) [`cc14d77`](https://github.com/tailor-platform/sdk/commit/cc14d773c1f62b9e14c935cf4541983ed514fe90) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update actions/upload-artifact action to v7.0.1
48
+
49
+ - [#958](https://github.com/tailor-platform/sdk/pull/958) [`32e6b1f`](https://github.com/tailor-platform/sdk/commit/32e6b1fa67a582db685f8268dbbb38c0ac45b101) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update anthropics/claude-code-action action to v1.0.93
50
+
51
+ - [#959](https://github.com/tailor-platform/sdk/pull/959) [`61b60c9`](https://github.com/tailor-platform/sdk/commit/61b60c9b0e8af467a50bc4ee06ada89fba76a653) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency knip to v6.3.1
52
+
53
+ - [#960](https://github.com/tailor-platform/sdk/pull/960) [`9e0ce60`](https://github.com/tailor-platform/sdk/commit/9e0ce60b2d5c662c6983c60a377f5ce7c3dea7df) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency turbo to v2.9.5
54
+
55
+ - [#962](https://github.com/tailor-platform/sdk/pull/962) [`dd74185`](https://github.com/tailor-platform/sdk/commit/dd74185d593be00122a173ca427c238292a627bf) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update marocchino/sticky-pull-request-comment action to v3.0.4
56
+
3
57
  ## 1.35.2
4
58
 
5
59
  ### Patch 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-CA2NM_4R.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")
@@ -3201,7 +3231,8 @@ const SAMLSchema = z.object({
3201
3231
  kind: z.literal("SAML"),
3202
3232
  enableSignRequest: z.boolean().default(false).describe("Enable signing of SAML requests"),
3203
3233
  metadataURL: z.string().optional().describe("URL to fetch SAML metadata (mutually exclusive with rawMetadata)"),
3204
- rawMetadata: z.string().optional().describe("Raw SAML metadata XML (mutually exclusive with metadataURL)")
3234
+ rawMetadata: z.string().optional().describe("Raw SAML metadata XML (mutually exclusive with metadataURL)"),
3235
+ defaultRedirectURL: z.string().optional().describe("URL to redirect to when SAML ACS receives a response with an empty RelayState.")
3205
3236
  }).refine((value) => {
3206
3237
  return value.metadataURL !== void 0 !== (value.rawMetadata !== void 0);
3207
3238
  }, "Provide either metadataURL or rawMetadata");
@@ -4211,7 +4242,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
4211
4242
  handler(code, id) {
4212
4243
  if (!code.includes("createWorkflowJob") && !code.includes("createWorkflow") && !code.includes(".trigger(")) return null;
4213
4244
  let transformed = transformWorkflowSource(code, job.name, job.exportName, otherJobExportNames, allJobsMap);
4214
- 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);
4215
4246
  return { code: transformed };
4216
4247
  }
4217
4248
  }
@@ -4644,6 +4675,68 @@ const IdPEmailConfigSchema = z.object({
4644
4675
  fromName: emailFieldSchema.optional().describe("Default sender display name for emails"),
4645
4676
  passwordResetSubject: emailFieldSchema.optional().describe("Default subject for password reset emails")
4646
4677
  }).describe("Namespace-level email configuration defaults");
4678
+ const IdPPermissionOperandSchema = z.union([
4679
+ z.string(),
4680
+ z.boolean(),
4681
+ z.array(z.string()).readonly(),
4682
+ z.array(z.boolean()).readonly(),
4683
+ z.object({ user: z.string() }),
4684
+ z.object({ idpUser: z.enum([
4685
+ "id",
4686
+ "name",
4687
+ "disabled"
4688
+ ]) }),
4689
+ z.object({ oldIdpUser: z.enum([
4690
+ "id",
4691
+ "name",
4692
+ "disabled"
4693
+ ]) }),
4694
+ z.object({ newIdpUser: z.enum([
4695
+ "id",
4696
+ "name",
4697
+ "disabled"
4698
+ ]) })
4699
+ ]);
4700
+ const IdPPermissionOperatorSchema = z.enum([
4701
+ "=",
4702
+ "!=",
4703
+ "in",
4704
+ "not in"
4705
+ ]);
4706
+ const IdPPermissionConditionSchema = z.tuple([
4707
+ IdPPermissionOperandSchema,
4708
+ IdPPermissionOperatorSchema,
4709
+ IdPPermissionOperandSchema
4710
+ ]).readonly();
4711
+ const IdPActionPermissionSchema = z.union([
4712
+ z.object({
4713
+ conditions: z.union([IdPPermissionConditionSchema, z.array(IdPPermissionConditionSchema).readonly()]),
4714
+ description: z.string().optional(),
4715
+ permit: z.boolean().optional()
4716
+ }),
4717
+ z.tuple([
4718
+ IdPPermissionOperandSchema,
4719
+ IdPPermissionOperatorSchema,
4720
+ IdPPermissionOperandSchema
4721
+ ]).readonly(),
4722
+ z.tuple([
4723
+ IdPPermissionOperandSchema,
4724
+ IdPPermissionOperatorSchema,
4725
+ IdPPermissionOperandSchema,
4726
+ z.boolean()
4727
+ ]).readonly(),
4728
+ z.array(z.union([IdPPermissionConditionSchema, z.boolean()])).refine((arr) => {
4729
+ const boolIndex = arr.findIndex((item) => typeof item === "boolean");
4730
+ return boolIndex === -1 || boolIndex === arr.length - 1;
4731
+ }, { message: "Boolean permit flag must only appear at the end" }).readonly()
4732
+ ]);
4733
+ const IdPPermissionSchema = z.object({
4734
+ create: z.array(IdPActionPermissionSchema).readonly(),
4735
+ read: z.array(IdPActionPermissionSchema).readonly(),
4736
+ update: z.array(IdPActionPermissionSchema).readonly(),
4737
+ delete: z.array(IdPActionPermissionSchema).readonly(),
4738
+ sendPasswordResetEmail: z.array(IdPActionPermissionSchema).readonly()
4739
+ }).describe("Per-operation permission policies for IdP users");
4647
4740
  const IdPSchema = z.object({
4648
4741
  name: z.string().describe("IdP service name"),
4649
4742
  authorization: z.union([
@@ -4656,14 +4749,18 @@ const IdPSchema = z.object({
4656
4749
  userAuthPolicy: IdPUserAuthPolicySchema.transform((input) => IdPUserAuthPolicySchema.parse(input ?? {})).optional().describe("User authentication policy configuration"),
4657
4750
  publishUserEvents: z.boolean().optional().describe("Enable publishing user lifecycle events"),
4658
4751
  gqlOperations: IdPGqlOperationsSchema.optional().describe("Configure which GraphQL operations are enabled"),
4659
- emailConfig: IdPEmailConfigSchema.optional().describe("Namespace-level email configuration defaults")
4752
+ emailConfig: IdPEmailConfigSchema.optional().describe("Namespace-level email configuration defaults"),
4753
+ permission: IdPPermissionSchema.optional().describe("Per-operation permission policies for IdP users")
4660
4754
  }).brand("IdPConfig");
4661
4755
 
4662
4756
  //#endregion
4663
4757
  //#region src/parser/service/secrets/schema.ts
4664
4758
  const nameSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/);
4665
- const secretsVaultSchema = z.record(nameSchema, z.string());
4666
- const SecretsSchema = z.record(nameSchema, secretsVaultSchema);
4759
+ const secretsVaultSchema = z.record(nameSchema, z.string().nullish());
4760
+ const SecretsSchema = z.object({
4761
+ vaults: z.record(nameSchema, secretsVaultSchema),
4762
+ options: z.object({ ignoreNullishValues: z.boolean() })
4763
+ });
4667
4764
 
4668
4765
  //#endregion
4669
4766
  //#region src/parser/service/staticwebsite/schema.ts
@@ -4789,27 +4886,43 @@ function defineStaticWebsites(websites) {
4789
4886
  });
4790
4887
  return staticWebsiteServices;
4791
4888
  }
4792
- function defineSecretManager(config) {
4793
- if (!config) return [];
4794
- const data = Object.fromEntries(Object.entries(config));
4795
- const parsed = SecretsSchema.parse(data);
4796
- return Object.entries(parsed).map(([vaultName, vaultSecrets]) => ({
4889
+ function parseSecretManager(config) {
4890
+ if (!config) return {
4891
+ secrets: [],
4892
+ ignoreNullishValues: false
4893
+ };
4894
+ const parsed = SecretsSchema.parse(config);
4895
+ const { ignoreNullishValues } = parsed.options;
4896
+ const secrets = Object.entries(parsed.vaults).map(([vaultName, vaultSecrets]) => ({
4797
4897
  vaultName,
4798
4898
  secrets: Object.entries(vaultSecrets).map(([name, value]) => ({
4799
4899
  name,
4800
4900
  value
4801
4901
  }))
4802
4902
  }));
4903
+ if (!ignoreNullishValues) {
4904
+ for (const vault of secrets) for (const secret of vault.secrets) if (secret.value == null) throw new Error(`Secret "${vault.vaultName}/${secret.name}" has no value. Use { ignoreNullishValues: true } option in defineSecretManager() to skip secrets without values.`);
4905
+ }
4906
+ return {
4907
+ secrets,
4908
+ ignoreNullishValues
4909
+ };
4803
4910
  }
4804
4911
  function defineServices(config, pluginManager) {
4805
4912
  const tailordbResult = defineTailorDB(config.db, pluginManager);
4913
+ const resolverResult = defineResolver(config.resolver);
4914
+ const idpResult = defineIdp(config.idp);
4915
+ const authResult = defineAuth(config.auth, tailordbResult.tailorDBServices, tailordbResult.externalTailorDBNamespaces);
4916
+ const staticWebsiteServices = defineStaticWebsites(config.staticWebsites);
4917
+ const { secrets, ignoreNullishValues } = parseSecretManager(config.secrets);
4806
4918
  return {
4807
4919
  tailordbResult,
4808
- resolverResult: defineResolver(config.resolver),
4809
- idpResult: defineIdp(config.idp),
4810
- authResult: defineAuth(config.auth, tailordbResult.tailorDBServices, tailordbResult.externalTailorDBNamespaces),
4811
- staticWebsiteServices: defineStaticWebsites(config.staticWebsites),
4812
- secrets: defineSecretManager(config.secrets)
4920
+ resolverResult,
4921
+ idpResult,
4922
+ authResult,
4923
+ staticWebsiteServices,
4924
+ secrets,
4925
+ ignoreNullishValues
4813
4926
  };
4814
4927
  }
4815
4928
  function buildApplication(params) {
@@ -4831,6 +4944,7 @@ function buildApplication(params) {
4831
4944
  workflowService: params.workflowService,
4832
4945
  staticWebsiteServices: params.staticWebsiteServices,
4833
4946
  secrets: params.secrets,
4947
+ ignoreNullishValues: params.ignoreNullishValues,
4834
4948
  env: params.env,
4835
4949
  get applications() {
4836
4950
  return [application];
@@ -4893,7 +5007,7 @@ function generatePluginFilesIfNeeded(pluginManager, tailorDBServices, configPath
4893
5007
  */
4894
5008
  async function loadApplication(params) {
4895
5009
  const { config, pluginManager, bundleCache } = params;
4896
- const { tailordbResult, resolverResult, idpResult, authResult, staticWebsiteServices, secrets } = defineServices(config, pluginManager);
5010
+ const { tailordbResult, resolverResult, idpResult, authResult, staticWebsiteServices, secrets, ignoreNullishValues } = defineServices(config, pluginManager);
4897
5011
  for (const tailordb of tailordbResult.tailorDBServices) {
4898
5012
  await tailordb.loadTypes();
4899
5013
  await tailordb.processNamespacePlugins();
@@ -4902,7 +5016,7 @@ async function loadApplication(params) {
4902
5016
  const executorService = defineExecutor(config.executor, pluginExecutorFiles.length > 0);
4903
5017
  const workflowService = defineWorkflow(config.workflow);
4904
5018
  if (workflowService) await workflowService.loadWorkflows();
4905
- const triggerContext = await buildTriggerContext(config.workflow);
5019
+ const triggerContext = await buildTriggerContext(config.workflow, authResult.authService?.config.name);
4906
5020
  const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
4907
5021
  const bundledScripts = {
4908
5022
  resolvers: /* @__PURE__ */ new Map(),
@@ -4956,6 +5070,7 @@ async function loadApplication(params) {
4956
5070
  workflowService,
4957
5071
  staticWebsiteServices,
4958
5072
  secrets,
5073
+ ignoreNullishValues,
4959
5074
  env: config.env ?? {}
4960
5075
  }),
4961
5076
  workflowBuildResult,
@@ -4965,4 +5080,4 @@ async function loadApplication(params) {
4965
5080
 
4966
5081
  //#endregion
4967
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 };
4968
- //# sourceMappingURL=application-BnJRroGX.mjs.map
5083
+ //# sourceMappingURL=application-qRGMV8Tr.mjs.map