@tailor-platform/sdk 2.1.0 → 2.3.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 (98) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/{dist/cli/index.mjs → bin/tailor.mjs} +1 -1
  3. package/dist/application-BZfk4HKm.mjs +3 -0
  4. package/dist/{application-D77KJFKD.mjs → application-F-nl107y.mjs} +121 -27
  5. package/dist/application-F-nl107y.mjs.map +1 -0
  6. package/dist/cli/commands/deploy/tailordb/index.d.mts +2 -1
  7. package/dist/cli/commands/deploy/types.d.mts +2 -1
  8. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +52 -22
  9. package/dist/cli/commands/tailordb/migrate/file-state.d.mts +1 -0
  10. package/dist/cli/commands/tailordb/migrate/generate.d.mts +6 -0
  11. package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +22 -0
  12. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +2 -2
  13. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +9 -2
  14. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +30 -9
  15. package/dist/cli/lib.d.mts +4 -4
  16. package/dist/cli/lib.mjs +3 -482
  17. package/dist/cli/lib.mjs.map +1 -1
  18. package/dist/cli/main.mjs +1151 -208
  19. package/dist/cli/main.mjs.map +1 -1
  20. package/dist/cli/ts-hook.mjs +52 -7
  21. package/dist/completion/zsh-worker.zsh +167 -4
  22. package/dist/configure/index.d.mts +3 -3
  23. package/dist/configure/index.mjs +90 -23
  24. package/dist/configure/index.mjs.map +1 -1
  25. package/dist/configure/services/index.d.mts +3 -2
  26. package/dist/configure/services/tailordb/index.d.mts +2 -1
  27. package/dist/configure/services/tailordb/schema.d.mts +46 -46
  28. package/dist/configure/services/tailordb/types.d.mts +30 -4
  29. package/dist/configure/services/workflow/index.d.mts +2 -2
  30. package/dist/configure/services/workflow/wait-point.d.mts +72 -13
  31. package/dist/{crashreport-B5LqCTfF.mjs → crashreport-CIIfLnoO.mjs} +2 -2
  32. package/dist/{crashreport-B5LqCTfF.mjs.map → crashreport-CIIfLnoO.mjs.map} +1 -1
  33. package/dist/{crashreport-eI7ty7ok.mjs → crashreport-CINZ5dVN.mjs} +1 -1
  34. package/dist/errors-BVb6vYGy.mjs +89 -0
  35. package/dist/errors-BVb6vYGy.mjs.map +1 -0
  36. package/dist/kysely/index.d.mts +53 -5
  37. package/dist/kysely/index.mjs +7 -2
  38. package/dist/kysely/index.mjs.map +1 -1
  39. package/dist/{logger-CXQq9YIp.mjs → logger-DSdExfor.mjs} +83 -42
  40. package/dist/logger-DSdExfor.mjs.map +1 -0
  41. package/dist/plugin/builtin/seed/index.mjs +1 -1
  42. package/dist/{register-ts-hook-BU18uU44.mjs → register-ts-hook-ClI226n2.mjs} +3541 -703
  43. package/dist/register-ts-hook-ClI226n2.mjs.map +1 -0
  44. package/dist/schema--xYWRGfe.mjs.map +1 -1
  45. package/dist/seed/index.d.mts +52 -3
  46. package/dist/seed/index.mjs +200 -44
  47. package/dist/seed/index.mjs.map +1 -1
  48. package/dist/{seed-B-yckgQY.mjs → seed-xqM9WIHP.mjs} +8 -8
  49. package/dist/seed-xqM9WIHP.mjs.map +1 -0
  50. package/dist/{service-k1xy_A5G.mjs → service-C_WpbKHu.mjs} +39 -5
  51. package/dist/service-C_WpbKHu.mjs.map +1 -0
  52. package/dist/service-D1RCdzIL.mjs +3 -0
  53. package/dist/{service-B5WynBHQ.mjs → service-hZskxZmg.mjs} +3 -3
  54. package/dist/{service-B5WynBHQ.mjs.map → service-hZskxZmg.mjs.map} +1 -1
  55. package/dist/{service_pb-D5--My_M.mjs → service_pb-BEWj1pOV.mjs} +2 -2
  56. package/dist/{service_pb-D5--My_M.mjs.map → service_pb-BEWj1pOV.mjs.map} +1 -1
  57. package/dist/{service_pb-i8CmnQP4.mjs → service_pb-BjlhvK9E.mjs} +1 -1
  58. package/dist/utils/test/index.d.mts +6 -3
  59. package/dist/utils/test/index.mjs +25 -13
  60. package/dist/utils/test/index.mjs.map +1 -1
  61. package/dist/vitest/index.d.mts +2 -1
  62. package/dist/vitest/index.mjs +167 -3
  63. package/dist/vitest/index.mjs.map +1 -1
  64. package/dist/vitest/mocks/workflow.d.mts +13 -1
  65. package/dist/vitest/pglite-kysely.d.mts +43 -0
  66. package/dist/wait-point-invoker-__oE88_P.mjs +148 -0
  67. package/dist/wait-point-invoker-__oE88_P.mjs.map +1 -0
  68. package/dist/wait-point-registry-TL99zotw.mjs +47 -0
  69. package/dist/wait-point-registry-TL99zotw.mjs.map +1 -0
  70. package/dist/{workspace_resource_pb-DXnO2AT-.mjs → workspace_resource_pb-HNIL_Vfj.mjs} +10 -2
  71. package/dist/{workspace_resource_pb-DXnO2AT-.mjs.map → workspace_resource_pb-HNIL_Vfj.mjs.map} +1 -1
  72. package/docs/cli/setup.md +14 -1
  73. package/docs/cli/tailordb.md +96 -28
  74. package/docs/cli-reference.md +15 -12
  75. package/docs/configuration.md +1 -1
  76. package/docs/github-actions.md +73 -28
  77. package/docs/migration/v2.md +55 -1
  78. package/docs/plugin/custom.md +48 -48
  79. package/docs/plugin/index.md +24 -24
  80. package/docs/services/auth.md +10 -10
  81. package/docs/services/executor.md +1 -1
  82. package/docs/services/resolver.md +2 -2
  83. package/docs/services/tailordb-migration.md +485 -84
  84. package/docs/services/tailordb.md +28 -28
  85. package/docs/services/workflow.md +52 -2
  86. package/docs/testing.md +14 -0
  87. package/package.json +12 -7
  88. package/dist/application-Af1zIqSI.mjs +0 -3
  89. package/dist/application-D77KJFKD.mjs.map +0 -1
  90. package/dist/errors-D7583Zz7.mjs +0 -58
  91. package/dist/errors-D7583Zz7.mjs.map +0 -1
  92. package/dist/logger-CXQq9YIp.mjs.map +0 -1
  93. package/dist/register-ts-hook-BU18uU44.mjs.map +0 -1
  94. package/dist/seed-B-yckgQY.mjs.map +0 -1
  95. package/dist/service-M7OYziQP.mjs +0 -3
  96. package/dist/service-k1xy_A5G.mjs.map +0 -1
  97. package/dist/test-env-key-D7UkZp99.mjs +0 -75
  98. package/dist/test-env-key-D7UkZp99.mjs.map +0 -1
@@ -80,8 +80,11 @@ function collectPathsInto(out, configFilePath, content, visited) {
80
80
  }
81
81
  }
82
82
 
83
- function loadTsconfigPaths(startDir) {
84
- if (tsconfigPathsCache.has(startDir)) return tsconfigPathsCache.get(startDir);
83
+ // cacheGeneration partitions the cache per import-nonce run, so a tsconfig
84
+ // edited between two in-process runs is re-read instead of served stale.
85
+ function loadTsconfigPaths(startDir, cacheGeneration) {
86
+ const cacheKey = `${cacheGeneration}\u0000${startDir}`;
87
+ if (tsconfigPathsCache.has(cacheKey)) return tsconfigPathsCache.get(cacheKey);
85
88
 
86
89
  const paths = Object.create(null);
87
90
  let dir = startDir;
@@ -100,7 +103,7 @@ function loadTsconfigPaths(startDir) {
100
103
  dir = dirname(dir);
101
104
  }
102
105
 
103
- tsconfigPathsCache.set(startDir, paths);
106
+ tsconfigPathsCache.set(cacheKey, paths);
104
107
  return paths;
105
108
  }
106
109
 
@@ -163,9 +166,44 @@ function tryResolveWithExtensionsSync(base, context, nextResolve) {
163
166
  return null;
164
167
  }
165
168
 
169
+ // --- import-nonce propagation ---
170
+
171
+ const IMPORT_NONCE_PARAM = "tailorImportNonce";
172
+
173
+ // Carries a parent's cache-busting nonce onto project-local resolutions, so a
174
+ // nonce'd entry module gets a fresh evaluation of its whole project subgraph.
175
+ // Bare specifiers are left alone: node_modules packages (and workspace-linked
176
+ // ones resolving outside node_modules) must stay singletons.
177
+ function propagateImportNonce(resolved, context) {
178
+ if (!resolved?.url?.startsWith("file:")) return resolved;
179
+ if (!context.parentURL?.startsWith("file:")) return resolved;
180
+ const nonce = new URL(context.parentURL).searchParams.get(IMPORT_NONCE_PARAM);
181
+ if (!nonce) return resolved;
182
+ const url = new URL(resolved.url);
183
+ if (url.searchParams.has(IMPORT_NONCE_PARAM) || url.pathname.includes("/node_modules/")) {
184
+ return resolved;
185
+ }
186
+ url.searchParams.set(IMPORT_NONCE_PARAM, nonce);
187
+ return { ...resolved, url: url.href };
188
+ }
189
+
190
+ function isProjectLocalSpecifier(specifier) {
191
+ return (
192
+ specifier.startsWith(".") ||
193
+ specifier.startsWith("/") ||
194
+ specifier.startsWith("file:") ||
195
+ specifier.startsWith("#")
196
+ );
197
+ }
198
+
166
199
  // --- module hooks ---
167
200
 
168
201
  export async function resolve(specifier, context, nextResolve) {
202
+ const resolved = await resolveTs(specifier, context, nextResolve);
203
+ return isProjectLocalSpecifier(specifier) ? propagateImportNonce(resolved, context) : resolved;
204
+ }
205
+
206
+ async function resolveTs(specifier, context, nextResolve) {
169
207
  try {
170
208
  return await nextResolve(specifier, context);
171
209
  } catch (err) {
@@ -189,15 +227,16 @@ export async function resolve(specifier, context, nextResolve) {
189
227
  // Non-relative: try tsconfig path aliases
190
228
  if (context.parentURL?.startsWith("file://")) {
191
229
  const parentParsed = new URL(context.parentURL);
230
+ const parentNonce = parentParsed.searchParams.get(IMPORT_NONCE_PARAM) ?? "";
192
231
  parentParsed.search = "";
193
232
  parentParsed.hash = "";
194
233
  const parentDir = dirname(fileURLToPath(parentParsed));
195
- const tsconfigPaths = loadTsconfigPaths(parentDir);
234
+ const tsconfigPaths = loadTsconfigPaths(parentDir, parentNonce);
196
235
  const candidates = matchTsconfigPaths(specifier, tsconfigPaths);
197
236
  if (candidates) {
198
237
  for (const candidate of candidates) {
199
238
  const result = await tryResolveWithExtensions(candidate, context, nextResolve);
200
- if (result) return result;
239
+ if (result) return propagateImportNonce(result, context);
201
240
  }
202
241
  }
203
242
  }
@@ -250,6 +289,11 @@ export async function load(url, context, nextLoad) {
250
289
 
251
290
  // Sync hooks for module.registerHooks() (Node >= 22.15.0).
252
291
  export function resolveSync(specifier, context, nextResolve) {
292
+ const resolved = resolveTsSync(specifier, context, nextResolve);
293
+ return isProjectLocalSpecifier(specifier) ? propagateImportNonce(resolved, context) : resolved;
294
+ }
295
+
296
+ function resolveTsSync(specifier, context, nextResolve) {
253
297
  try {
254
298
  return nextResolve(specifier, context);
255
299
  } catch (err) {
@@ -273,15 +317,16 @@ export function resolveSync(specifier, context, nextResolve) {
273
317
  // Non-relative: try tsconfig path aliases
274
318
  if (context.parentURL?.startsWith("file://")) {
275
319
  const parentParsed = new URL(context.parentURL);
320
+ const parentNonce = parentParsed.searchParams.get(IMPORT_NONCE_PARAM) ?? "";
276
321
  parentParsed.search = "";
277
322
  parentParsed.hash = "";
278
323
  const parentDir = dirname(fileURLToPath(parentParsed));
279
- const tsconfigPaths = loadTsconfigPaths(parentDir);
324
+ const tsconfigPaths = loadTsconfigPaths(parentDir, parentNonce);
280
325
  const candidates = matchTsconfigPaths(specifier, tsconfigPaths);
281
326
  if (candidates) {
282
327
  for (const candidate of candidates) {
283
328
  const result = tryResolveWithExtensionsSync(candidate, context, nextResolve);
284
- if (result) return result;
329
+ if (result) return propagateImportNonce(result, context);
285
330
  }
286
331
  }
287
332
  }
@@ -1,5 +1,5 @@
1
1
  # politty-completion-version: 1
2
- # politty-bin-sig: 1785985067
2
+ # politty-bin-sig: 1786713018
3
3
  # politty-bin-path: /home/runner/work/sdk/sdk/node_modules/.bin/tailor
4
4
  # program: tailor
5
5
  # shell: zsh
@@ -739,6 +739,13 @@ __tailor_worker_opt_takes_value() {
739
739
  tailordb:truncate:--namespace|tailordb:truncate:-n|tailordb:truncate:--n) return 0 ;;
740
740
  tailordb:migration:generate:--config|tailordb:migration:generate:-c|tailordb:migration:generate:--c) return 0 ;;
741
741
  tailordb:migration:generate:--name|tailordb:migration:generate:-n|tailordb:migration:generate:--n) return 0 ;;
742
+ tailordb:migration:generate:--rename) return 0 ;;
743
+ tailordb:migration:generate:--drop) return 0 ;;
744
+ tailordb:migration:generate:--expand-contract|tailordb:migration:generate:--expandContract) return 0 ;;
745
+ tailordb:migration:rebaseline:--workspace-id|tailordb:migration:rebaseline:--workspaceId|tailordb:migration:rebaseline:-w|tailordb:migration:rebaseline:--w) return 0 ;;
746
+ tailordb:migration:rebaseline:--profile|tailordb:migration:rebaseline:-p|tailordb:migration:rebaseline:--p) return 0 ;;
747
+ tailordb:migration:rebaseline:--config|tailordb:migration:rebaseline:-c|tailordb:migration:rebaseline:--c) return 0 ;;
748
+ tailordb:migration:rebaseline:--namespace|tailordb:migration:rebaseline:-n|tailordb:migration:rebaseline:--n) return 0 ;;
742
749
  tailordb:migration:script:--config|tailordb:migration:script:-c|tailordb:migration:script:--c) return 0 ;;
743
750
  tailordb:migration:script:--namespace|tailordb:migration:script:-n|tailordb:migration:script:--n) return 0 ;;
744
751
  tailordb:migration:script:--reason) return 0 ;;
@@ -754,6 +761,14 @@ __tailor_worker_opt_takes_value() {
754
761
  tailordb:migration:sync:--profile|tailordb:migration:sync:-p|tailordb:migration:sync:--p) return 0 ;;
755
762
  tailordb:migration:sync:--config|tailordb:migration:sync:-c|tailordb:migration:sync:--c) return 0 ;;
756
763
  tailordb:migration:sync:--namespace|tailordb:migration:sync:-n|tailordb:migration:sync:--n) return 0 ;;
764
+ tailordb:migration:test:--workspace-id|tailordb:migration:test:--workspaceId|tailordb:migration:test:-w|tailordb:migration:test:--w) return 0 ;;
765
+ tailordb:migration:test:--profile|tailordb:migration:test:-p|tailordb:migration:test:--p) return 0 ;;
766
+ tailordb:migration:test:--config|tailordb:migration:test:-c|tailordb:migration:test:--c) return 0 ;;
767
+ tailordb:migration:test:--data) return 0 ;;
768
+ tailordb:migration:test:--target-workspace-id|tailordb:migration:test:--targetWorkspaceId) return 0 ;;
769
+ tailordb:migration:test:--assert) return 0 ;;
770
+ tailordb:migration:test:--assert-namespace|tailordb:migration:test:--assertNamespace) return 0 ;;
771
+ tailordb:migration:test:--machine-user|tailordb:migration:test:--machineUser) return 0 ;;
757
772
  tailordb:migration:validate:--workspace-id|tailordb:migration:validate:--workspaceId|tailordb:migration:validate:-w|tailordb:migration:validate:--w) return 0 ;;
758
773
  tailordb:migration:validate:--profile|tailordb:migration:validate:-p|tailordb:migration:validate:--p) return 0 ;;
759
774
  tailordb:migration:validate:--config|tailordb:migration:validate:-c|tailordb:migration:validate:--c) return 0 ;;
@@ -933,6 +948,7 @@ __tailor_worker_is_subcmd() {
933
948
  setup:preview) return 0 ;;
934
949
  setup:action) return 0 ;;
935
950
  setup:coordinate) return 0 ;;
951
+ setup:renovate) return 0 ;;
936
952
  setup:check) return 0 ;;
937
953
  setup:delete) return 0 ;;
938
954
  :setup) return 0 ;;
@@ -946,10 +962,12 @@ __tailor_worker_is_subcmd() {
946
962
  :staticwebsite) return 0 ;;
947
963
  tailordb:truncate) return 0 ;;
948
964
  tailordb:migration:generate) return 0 ;;
965
+ tailordb:migration:rebaseline) return 0 ;;
949
966
  tailordb:migration:script) return 0 ;;
950
967
  tailordb:migration:set) return 0 ;;
951
968
  tailordb:migration:status) return 0 ;;
952
969
  tailordb:migration:sync) return 0 ;;
970
+ tailordb:migration:test) return 0 ;;
953
971
  tailordb:migration:validate) return 0 ;;
954
972
  tailordb:migration) return 0 ;;
955
973
  :tailordb) return 0 ;;
@@ -2691,6 +2709,18 @@ __tailor_worker_complete_setup_coordinate() {
2691
2709
  fi
2692
2710
  }
2693
2711
 
2712
+ __tailor_worker_complete_setup_renovate() {
2713
+ local -a _vals=()
2714
+ if __tailor_worker_opt_takes_value "setup:renovate" "${words[CURRENT-1]}"; then return 0; fi
2715
+ if (( _after_dd )); then return 0; fi
2716
+ if [[ "${words[CURRENT]}" == -* ]]; then
2717
+ local -a _opts=()
2718
+ __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
2719
+ __tailor_worker_cdescribe 'options' _opts
2720
+ return 0
2721
+ fi
2722
+ }
2723
+
2694
2724
  __tailor_worker_complete_setup_check() {
2695
2725
  local -a _vals=()
2696
2726
  if __tailor_worker_opt_takes_value "setup:check" "${words[CURRENT-1]}"; then return 0; fi
@@ -2737,7 +2767,7 @@ __tailor_worker_complete_setup() {
2737
2767
  __tailor_worker_cdescribe 'options' _opts
2738
2768
  return 0
2739
2769
  fi
2740
- local -a _subs=("branch:Generate a branch-target deploy workflow (push to branch triggers deploy)." "tag:Generate a tag-target deploy workflow (tag push triggers deploy)." "preview:Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace)." "action:Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys)." "coordinate:Generate a coordinator workflow that orchestrates multiple --action-generated composite actions." "check:Audit generated workflows for drift against the current config/repo (read-only)." "delete:Delete managed workflow/action file(s) and their .github/tailor.lock entries.")
2770
+ local -a _subs=("branch:Generate a branch-target deploy workflow (push to branch triggers deploy)." "tag:Generate a tag-target deploy workflow (tag push triggers deploy)." "preview:Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace)." "action:Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys)." "coordinate:Generate a coordinator workflow that orchestrates multiple --action-generated composite actions." "renovate:Generate a Renovate config for Tailor dependency and workflow updates." "check:Audit generated workflows for drift against the current config/repo (read-only)." "delete:Delete managed workflow/action file(s) and their .github/tailor.lock entries.")
2741
2771
  __tailor_worker_cdescribe 'subcommands' _subs
2742
2772
  }
2743
2773
 
@@ -3021,6 +3051,54 @@ __tailor_worker_complete_tailordb_migration_generate() {
3021
3051
  __tailor_worker_not_used "--config" "-c" "--c" && _opts+=("--config:Path to Tailor config file")
3022
3052
  __tailor_worker_not_used "--name" "-n" "--n" && _opts+=("--name:Optional description for the migration")
3023
3053
  __tailor_worker_not_used "--init" && _opts+=("--init:Delete existing migrations and start fresh")
3054
+ _opts+=("--rename:Record a field or type rename instead of remove + add (format\: \"Type.oldField\:newField\" or \"OldType\:NewType\"; repeatable). Renames require a migration script that copies the data.")
3055
+ _opts+=("--drop:Confirm that a removed field or type is a genuine removal, not a rename (format\: \"Type.field\" or \"Type\"; repeatable). Required in non-interactive runs for a removal with rename candidates.")
3056
+ _opts+=("--expand-contract:Convert a field type through a temporary field (format\: \"Type.field\"; repeatable). Generates two migrations.")
3057
+ __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
3058
+ __tailor_worker_cdescribe 'options' _opts
3059
+ return 0
3060
+ fi
3061
+ }
3062
+
3063
+ __tailor_worker_complete_tailordb_migration_rebaseline() {
3064
+ local -a _vals=()
3065
+ case "${words[CURRENT-1]}" in
3066
+ --config|-c|--c)
3067
+ setopt local_options null_glob
3068
+ local _cur="${words[CURRENT]:-}" _dir _prefix _f _out
3069
+ local -a _exts=("ts")
3070
+ if [[ -z "$_cur" || "$_cur" != */* ]]; then
3071
+ _dir="."
3072
+ _prefix="$_cur"
3073
+ elif [[ "$_cur" == */ ]]; then
3074
+ _dir="${_cur%/}"
3075
+ _prefix=""
3076
+ else
3077
+ _dir="${_cur%/*}"
3078
+ _prefix="${_cur##*/}"
3079
+ fi
3080
+ for _f in "$_dir"/"$_prefix"*(N/); do
3081
+ _out="${_f#./}"
3082
+ __tailor_worker_add_path_candidate "$_out"
3083
+ done
3084
+ local _ext
3085
+ for _f in "$_dir"/"$_prefix"*(N.); do
3086
+ _out="${_f#./}"
3087
+ for _ext in "${_exts[@]}"; do
3088
+ [[ -n "$_ext" && "$_out" == *."$_ext" ]] && { __tailor_worker_add_path_candidate "$_out"; break; }
3089
+ done
3090
+ done
3091
+ return 0 ;;
3092
+ esac
3093
+ if __tailor_worker_opt_takes_value "tailordb:migration:rebaseline" "${words[CURRENT-1]}"; then return 0; fi
3094
+ if (( _after_dd )); then return 0; fi
3095
+ if [[ "${words[CURRENT]}" == -* ]]; then
3096
+ local -a _opts=()
3097
+ __tailor_worker_not_used "--workspace-id" "--workspaceId" "-w" "--w" && _opts+=("--workspace-id:Workspace ID")
3098
+ __tailor_worker_not_used "--profile" "-p" "--p" && _opts+=("--profile:Workspace profile")
3099
+ __tailor_worker_not_used "--config" "-c" "--c" && _opts+=("--config:Path to Tailor config file")
3100
+ __tailor_worker_not_used "--yes" "-y" "--y" && _opts+=("--yes:Skip confirmation prompts")
3101
+ __tailor_worker_not_used "--namespace" "-n" "--n" && _opts+=("--namespace:Target TailorDB namespace (required if multiple namespaces exist)")
3024
3102
  __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
3025
3103
  __tailor_worker_cdescribe 'options' _opts
3026
3104
  return 0
@@ -3071,6 +3149,7 @@ __tailor_worker_complete_tailordb_migration_script() {
3071
3149
  __tailor_worker_not_used "--namespace" "-n" "--n" && _opts+=("--namespace:Target TailorDB namespace (required if multiple namespaces exist)")
3072
3150
  __tailor_worker_not_used "--no-script" "--noScript" && _opts+=("--no-script:Record that this migration intentionally runs without a migration script (requires --reason)")
3073
3151
  __tailor_worker_not_used "--reason" && _opts+=("--reason:Reason why no migration script is needed (used with --no-script)")
3152
+ __tailor_worker_not_used "--with-test" "--withTest" && _opts+=("--with-test:Also add a migrate.test.ts unit-test scaffold; when migrate.ts already exists, only the test is added")
3074
3153
  __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
3075
3154
  __tailor_worker_cdescribe 'options' _opts
3076
3155
  return 0
@@ -3235,6 +3314,86 @@ __tailor_worker_complete_tailordb_migration_sync() {
3235
3314
  esac
3236
3315
  }
3237
3316
 
3317
+ __tailor_worker_complete_tailordb_migration_test() {
3318
+ local -a _vals=()
3319
+ case "${words[CURRENT-1]}" in
3320
+ --config|-c|--c)
3321
+ setopt local_options null_glob
3322
+ local _cur="${words[CURRENT]:-}" _dir _prefix _f _out
3323
+ local -a _exts=("ts")
3324
+ if [[ -z "$_cur" || "$_cur" != */* ]]; then
3325
+ _dir="."
3326
+ _prefix="$_cur"
3327
+ elif [[ "$_cur" == */ ]]; then
3328
+ _dir="${_cur%/}"
3329
+ _prefix=""
3330
+ else
3331
+ _dir="${_cur%/*}"
3332
+ _prefix="${_cur##*/}"
3333
+ fi
3334
+ for _f in "$_dir"/"$_prefix"*(N/); do
3335
+ _out="${_f#./}"
3336
+ __tailor_worker_add_path_candidate "$_out"
3337
+ done
3338
+ local _ext
3339
+ for _f in "$_dir"/"$_prefix"*(N.); do
3340
+ _out="${_f#./}"
3341
+ for _ext in "${_exts[@]}"; do
3342
+ [[ -n "$_ext" && "$_out" == *."$_ext" ]] && { __tailor_worker_add_path_candidate "$_out"; break; }
3343
+ done
3344
+ done
3345
+ return 0 ;;
3346
+ --data)
3347
+ _vals=("seed" "clone")
3348
+ __tailor_worker_cdescribe 'completions' _vals
3349
+ return 0 ;;
3350
+ --assert)
3351
+ setopt local_options null_glob
3352
+ local _cur="${words[CURRENT]:-}" _dir _prefix _f _out
3353
+ local -a _exts=("ts")
3354
+ if [[ -z "$_cur" || "$_cur" != */* ]]; then
3355
+ _dir="."
3356
+ _prefix="$_cur"
3357
+ elif [[ "$_cur" == */ ]]; then
3358
+ _dir="${_cur%/}"
3359
+ _prefix=""
3360
+ else
3361
+ _dir="${_cur%/*}"
3362
+ _prefix="${_cur##*/}"
3363
+ fi
3364
+ for _f in "$_dir"/"$_prefix"*(N/); do
3365
+ _out="${_f#./}"
3366
+ __tailor_worker_add_path_candidate "$_out"
3367
+ done
3368
+ local _ext
3369
+ for _f in "$_dir"/"$_prefix"*(N.); do
3370
+ _out="${_f#./}"
3371
+ for _ext in "${_exts[@]}"; do
3372
+ [[ -n "$_ext" && "$_out" == *."$_ext" ]] && { __tailor_worker_add_path_candidate "$_out"; break; }
3373
+ done
3374
+ done
3375
+ return 0 ;;
3376
+ esac
3377
+ if __tailor_worker_opt_takes_value "tailordb:migration:test" "${words[CURRENT-1]}"; then return 0; fi
3378
+ if (( _after_dd )); then return 0; fi
3379
+ if [[ "${words[CURRENT]}" == -* ]]; then
3380
+ local -a _opts=()
3381
+ __tailor_worker_not_used "--workspace-id" "--workspaceId" "-w" "--w" && _opts+=("--workspace-id:Workspace ID")
3382
+ __tailor_worker_not_used "--profile" "-p" "--p" && _opts+=("--profile:Workspace profile")
3383
+ __tailor_worker_not_used "--config" "-c" "--c" && _opts+=("--config:Path to Tailor config file")
3384
+ __tailor_worker_not_used "--yes" "-y" "--y" && _opts+=("--yes:Acknowledge that a designated target workspace may be overwritten")
3385
+ __tailor_worker_not_used "--data" && _opts+=("--data:Data source for the migration test (seed or clone)")
3386
+ __tailor_worker_not_used "--target-workspace-id" "--targetWorkspaceId" && _opts+=("--target-workspace-id:Existing throwaway workspace to retain after the test (requires --yes)")
3387
+ __tailor_worker_not_used "--keep" && _opts+=("--keep:Keep the automatically created workspace after the test")
3388
+ __tailor_worker_not_used "--assert" && _opts+=("--assert:Path to a TypeScript assertion script to run after migrations")
3389
+ __tailor_worker_not_used "--assert-namespace" "--assertNamespace" && _opts+=("--assert-namespace:TailorDB namespace exposed to the assertion script")
3390
+ __tailor_worker_not_used "--machine-user" "--machineUser" && _opts+=("--machine-user:Machine user for seed and assertion script execution")
3391
+ __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
3392
+ __tailor_worker_cdescribe 'options' _opts
3393
+ return 0
3394
+ fi
3395
+ }
3396
+
3238
3397
  __tailor_worker_complete_tailordb_migration_validate() {
3239
3398
  local -a _vals=()
3240
3399
  case "${words[CURRENT-1]}" in
@@ -3273,6 +3432,7 @@ __tailor_worker_complete_tailordb_migration_validate() {
3273
3432
  __tailor_worker_not_used "--profile" "-p" "--p" && _opts+=("--profile:Workspace profile")
3274
3433
  __tailor_worker_not_used "--config" "-c" "--c" && _opts+=("--config:Path to Tailor config file")
3275
3434
  __tailor_worker_not_used "--namespace" "-n" "--n" && _opts+=("--namespace:Target TailorDB namespace (validates all namespaces if not specified)")
3435
+ __tailor_worker_not_used "--strict" && _opts+=("--strict:Also fail when a pending migration can drop data without an acknowledgment")
3276
3436
  __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
3277
3437
  __tailor_worker_cdescribe 'options' _opts
3278
3438
  return 0
@@ -3289,7 +3449,7 @@ __tailor_worker_complete_tailordb_migration() {
3289
3449
  __tailor_worker_cdescribe 'options' _opts
3290
3450
  return 0
3291
3451
  fi
3292
- local -a _subs=("generate:Generate migration files by detecting schema differences between current local types and the previous migration snapshot." "script:Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none." "set:Set migration checkpoint to a specific number." "status:Show the current migration status for TailorDB namespaces, including applied and pending migrations." "sync:Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift)." "validate:Validate the full migration history and detect schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found.")
3452
+ local -a _subs=("generate:Generate migration files by detecting schema differences between current local types and the previous migration snapshot." "rebaseline:Collapse the full migration history into a new 0000 baseline." "script:Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none." "set:Set migration checkpoint to a specific number." "status:Show the current migration status for TailorDB namespaces, including applied and pending migrations." "sync:Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift)." "test:Test pending migrations with seed fixtures or cloned data in a temporary workspace." "validate:Validate the full migration history, unreviewed generated migration scripts, and schema drift (local types vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found.")
3293
3453
  __tailor_worker_cdescribe 'subcommands' _subs
3294
3454
  }
3295
3455
 
@@ -4100,7 +4260,7 @@ __tailor_worker_complete_root() {
4100
4260
  __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
4101
4261
  __tailor_worker_cdescribe 'options' _opts
4102
4262
  else
4103
- local -a _subs=("api:Call Tailor Platform API endpoints directly." "auth:Authentication helpers for scripts and plugins." "authconnection:Manage auth connections." "crashreport:Manage crash reports." "deploy:Deploy your application by applying the Tailor configuration." "executor:Manage executors" "function:Manage functions" "generate:Generate files using Tailor configuration." "init:Initialize a new project using create-sdk." "login:Login to Tailor Platform." "logout:Logout from Tailor Platform." "machineuser:Manage machine users in your Tailor Platform application." "oauth2client:Manage OAuth2 clients in your Tailor Platform application." "open:Open Tailor Platform Console." "organization:Manage Tailor Platform organizations." "plugin:Manage and inspect CLI plugins (beta)." "profile:Manage workspace profiles (user + workspace combinations)." "query:Run SQL/GraphQL query." "remove:Remove all resources managed by the application from the workspace." "secret:Manage Secret Manager vaults and secrets." "setup:Generate CI deploy workflows for your project. (beta)" "show:Show information about the deployed application." "staticwebsite:Manage static websites in your workspace." "tailordb:Manage TailorDB tables and data." "upgrade:Run codemods to upgrade your project to a newer SDK version." "user:Manage Tailor Platform users." "workflow:Manage workflows and workflow executions." "workspace:Manage Tailor Platform workspaces." "skills:Manage Tailor SDK agent skills." "completion:Generate shell completion script")
4263
+ local -a _subs=("api:Call Tailor Platform API endpoints directly." "auth:Authentication helpers for scripts and plugins." "authconnection:Manage auth connections." "crashreport:Manage crash reports." "deploy:Deploy your application by applying the Tailor configuration." "executor:Manage executors" "function:Manage functions" "generate:Generate files using Tailor configuration." "init:Initialize a new project using create-sdk." "login:Login to Tailor Platform." "logout:Logout from Tailor Platform." "machineuser:Manage machine users in your Tailor Platform application." "oauth2client:Manage OAuth2 clients in your Tailor Platform application." "open:Open Tailor Platform Console." "organization:Manage Tailor Platform organizations." "plugin:Manage and inspect CLI plugins (beta)." "profile:Manage workspace profiles (user + workspace combinations)." "query:Run SQL/GraphQL query." "remove:Remove all resources managed by the application from the workspace." "secret:Manage Secret Manager vaults and secrets." "setup:Set up repository automation for your project. (beta)" "show:Show information about the deployed application." "staticwebsite:Manage static websites in your workspace." "tailordb:Manage TailorDB tables and data." "upgrade:Run codemods to upgrade your project to a newer SDK version." "user:Manage Tailor Platform users." "workflow:Manage workflows and workflow executions." "workspace:Manage Tailor Platform workspaces." "skills:Manage Tailor SDK agent skills." "completion:Generate shell completion script")
4104
4264
  __tailor_worker_cdescribe 'subcommands' _subs
4105
4265
  fi
4106
4266
  }
@@ -4219,6 +4379,7 @@ _tailor_worker_completions() {
4219
4379
  setup:preview) __tailor_worker_complete_setup_preview ;;
4220
4380
  setup:action) __tailor_worker_complete_setup_action ;;
4221
4381
  setup:coordinate) __tailor_worker_complete_setup_coordinate ;;
4382
+ setup:renovate) __tailor_worker_complete_setup_renovate ;;
4222
4383
  setup:check) __tailor_worker_complete_setup_check ;;
4223
4384
  setup:delete) __tailor_worker_complete_setup_delete ;;
4224
4385
  setup) __tailor_worker_complete_setup ;;
@@ -4232,10 +4393,12 @@ _tailor_worker_completions() {
4232
4393
  staticwebsite) __tailor_worker_complete_staticwebsite ;;
4233
4394
  tailordb:truncate) __tailor_worker_complete_tailordb_truncate ;;
4234
4395
  tailordb:migration:generate) __tailor_worker_complete_tailordb_migration_generate ;;
4396
+ tailordb:migration:rebaseline) __tailor_worker_complete_tailordb_migration_rebaseline ;;
4235
4397
  tailordb:migration:script) __tailor_worker_complete_tailordb_migration_script ;;
4236
4398
  tailordb:migration:set) __tailor_worker_complete_tailordb_migration_set ;;
4237
4399
  tailordb:migration:status) __tailor_worker_complete_tailordb_migration_status ;;
4238
4400
  tailordb:migration:sync) __tailor_worker_complete_tailordb_migration_sync ;;
4401
+ tailordb:migration:test) __tailor_worker_complete_tailordb_migration_test ;;
4239
4402
  tailordb:migration:validate) __tailor_worker_complete_tailordb_migration_validate ;;
4240
4403
  tailordb:migration) __tailor_worker_complete_tailordb_migration ;;
4241
4404
  tailordb) __tailor_worker_complete_tailordb ;;
@@ -1,7 +1,7 @@
1
1
  import { ArrayFieldOutput, FieldMetadata, FieldOptions, FieldOutput, TailorFieldType } from "./types/field.types.mjs";
2
2
  import { AttributeList, Attributes, Env, TailorPrincipal } from "../runtime/types.mjs";
3
3
  import { DeepWritable, NullableToOptional, output as output$1 } from "../types/helpers.mjs";
4
- import { PluginAttachment } from "./services/tailordb/types.mjs";
4
+ import { IsAutoFilledDBField, IsReadOnlyDBField, PluginAttachment } from "./services/tailordb/types.mjs";
5
5
  import { AuthConnectionConfig, AuthConnectionOAuth2Config } from "../types/auth-connection.generated.mjs";
6
6
  import { BuiltinIdP, IDToken, IdProvider, OAuth2ClientInput, OIDC, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAuthorization, SCIMConfig, SCIMResource, TenantProvider } from "../types/auth.generated.mjs";
7
7
  import { AuthConfig, AuthConnectionTokenResult, AuthExternalConfig, AuthOwnConfig, AuthServiceInput, BeforeLoginClaims, BeforeLoginHookArgs, DefinedAuth, FederatedIdentity, FederatedIdentityClaims, FederatedIdentityProvider, MachineUserName, MachineUserNameRegistry, OAuth2ClientGrantType, SCIMAttributeType, UserAttributeKey, UserAttributeListKey, UserAttributes, UsernameFieldKey, ValueOperand } from "./services/auth/types.mjs";
@@ -38,7 +38,7 @@ import { IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, I
38
38
  import { Trigger } from "./services/executor/trigger/index.mjs";
39
39
  import { createExecutor } from "./services/executor/executor.mjs";
40
40
  import { defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy } from "./services/workflow/execution-policy.mjs";
41
- import { WaitPointInstance, createWaitPoint, createWaitPoints } from "./services/workflow/wait-point.mjs";
41
+ import { ParameterizedWaitPointInstance, WaitPointInstance, createWaitPoint, createWaitPoints } from "./services/workflow/wait-point.mjs";
42
42
  import { defineStaticWebSite } from "./services/staticwebsite/index.mjs";
43
43
  import { defineAIGateway } from "./services/aigateway/index.mjs";
44
44
  import { defineIdp } from "./services/idp/index.mjs";
@@ -132,4 +132,4 @@ declare namespace t {
132
132
  type infer<T> = TailorOutput<T>;
133
133
  }
134
134
  //#endregion
135
- export { type AIGatewayConfig, type AIGatewayName, type AIGatewayNameRegistry, type AttributeList, type Attributes, AuthAccessTokenArgs, AuthAccessTokenIssuedArgs, AuthAccessTokenRefreshedArgs, AuthAccessTokenRevokedArgs, AuthAccessTokenTrigger, type AuthConfig, type AuthConnectionConfig, type AuthConnectionOAuth2Config, type AuthConnectionTokenResult, type AuthExternalConfig, type AuthOwnConfig, type AuthServiceInput, type BeforeLoginClaims, type BeforeLoginHookArgs, type BuiltinIdP, type ConcurrencyPolicy, type ConnectionName, type ConnectionNameRegistry, type DefinedAuth, type Env, type ExecutionPolicyConcurrency, type ExecutionPolicyDefInput, type ExecutionPolicyExactInstance, type ExecutionPolicyGroupOptions, type ExecutionPolicyInstance, type ExecutionPolicyWildcardInstance, type ExecutorReadyContext, type ExecutorServiceConfig, type ExecutorServiceInput, type FederatedIdentity, type FederatedIdentityClaims, type FederatedIdentityProvider, FunctionOperation, type GeneratorResult, GqlOperation, HttpAdapter, HttpAdapterGraphQLQuery, HttpAdapterGraphQLRequest, HttpAdapterGraphQLResponse, HttpAdapterInput, HttpAdapterInputFn, HttpAdapterOutputFn, HttpAdapterRequest, HttpAdapterResponse, HttpAdapterTypedDocumentNode, type IDToken, type IdPConfig, type IdPEmailConfig, type IdPExternalConfig, type IdPGqlOperations, type IdPGqlOperationsInput as IdPGqlOperationsConfig, type IdPPermission, type IdPPermissionCondition, type IdProvider as IdProviderConfig, type IdpName, type IdpNameRegistry, IdpUserArgs, IdpUserCreatedArgs, IdpUserDeletedArgs, IdpUserTrigger, IdpUserUpdatedArgs, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, IncomingWebhookResponseConfig, IncomingWebhookTrigger, IncomingWebhookTriggerOptions, type MachineUserName, type MachineUserNameRegistry, type NamespacePluginOutput, type OAuth2ClientInput as OAuth2Client, type OAuth2ClientGrantType, type OIDC, Operation, type PermissionCondition, type Plugin, type PluginAttachment, type PluginConfigs, type PluginExecutorContext, type PluginExecutorContextBase, type PluginGeneratedExecutor, type PluginGeneratedExecutorWithFile, type PluginGeneratedResolver, type PluginGeneratedType, type PluginNamespaceProcessContext, type PluginOutput, type PluginProcessContext, type QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordUpdatedArgs, type ResolvedExecutionPolicyInstance, type Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, type ResolverExternalConfig, type ResolverNamespaceData, type ResolverPermission, type ResolverPermissionCondition, type ResolverPermissionPolicy, type ResolverReadyContext, type ResolverServiceConfig, type ResolverServiceInput, type RetryPolicy, type SAML, type SCIMAttribute, type SCIMAttributeMapping, type SCIMAttributeType, type SCIMAuthorization, type SCIMConfig, type SCIMResource, ScheduleArgs, ScheduleTrigger, type SecretsConfig, type StaticWebsiteConfig, type TailorAnyDBField, type TailorAnyDBType, type TailorDBField, type TailorDBInstance, type TailorDBNamespaceData, type TailorDBReadyContext, TailorDBTrigger, type TailorDBType, type TailorDBTypeForPlugin, type TailorField, type TailorPrincipal, type TailorTypeGqlPermission, type TailorTypePermission, type TenantProvider as TenantProviderConfig, Trigger, type TypePluginOutput, type UserAttributeKey, type UserAttributeListKey, type UserAttributes, type UsernameFieldKey, type ValueOperand, WaitPointInstance, WebhookOperation, Workflow, WorkflowConfig, WorkflowExecutionArgs, WorkflowExecutionCompletedArgs, WorkflowExecutionResumedArgs, WorkflowExecutionRetriedArgs, WorkflowExecutionStartedArgs, WorkflowExecutionTrigger, WorkflowExecutionWaitResolvedArgs, WorkflowExecutionWaitStartedArgs, WorkflowJob, WorkflowJobContext, WorkflowJobExecutionArgs, WorkflowJobExecutionCompletedArgs, WorkflowJobExecutionStartedArgs, WorkflowJobExecutionTrigger, WorkflowJobExecutionWaitResolvedArgs, WorkflowJobExecutionWaitStartedArgs, WorkflowOperation, type WorkflowServiceConfig, type WorkflowServiceInput, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, authAccessTokenTrigger, createExecutor, createHttpAdapter, createResolver, createWaitPoint, createWaitPoints, createWorkflow, createWorkflowJob, db, defineAIGateway, defineAuth, defineConfig, defineIdp, definePlugins, defineSecretManager, defineStaticWebSite, defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unsafeAllowAllGqlPermission, unsafeAllowAllIdPPermission, unsafeAllowAllTypePermission, workflowExecutionCompletedTrigger, workflowExecutionResumedTrigger, workflowExecutionRetriedTrigger, workflowExecutionStartedTrigger, workflowExecutionTrigger, workflowExecutionWaitResolvedTrigger, workflowExecutionWaitStartedTrigger, workflowJobExecutionCompletedTrigger, workflowJobExecutionStartedTrigger, workflowJobExecutionTrigger, workflowJobExecutionWaitResolvedTrigger, workflowJobExecutionWaitStartedTrigger };
135
+ export { type AIGatewayConfig, type AIGatewayName, type AIGatewayNameRegistry, type AttributeList, type Attributes, AuthAccessTokenArgs, AuthAccessTokenIssuedArgs, AuthAccessTokenRefreshedArgs, AuthAccessTokenRevokedArgs, AuthAccessTokenTrigger, type AuthConfig, type AuthConnectionConfig, type AuthConnectionOAuth2Config, type AuthConnectionTokenResult, type AuthExternalConfig, type AuthOwnConfig, type AuthServiceInput, type BeforeLoginClaims, type BeforeLoginHookArgs, type BuiltinIdP, type ConcurrencyPolicy, type ConnectionName, type ConnectionNameRegistry, type DefinedAuth, type Env, type ExecutionPolicyConcurrency, type ExecutionPolicyDefInput, type ExecutionPolicyExactInstance, type ExecutionPolicyGroupOptions, type ExecutionPolicyInstance, type ExecutionPolicyWildcardInstance, type ExecutorReadyContext, type ExecutorServiceConfig, type ExecutorServiceInput, type FederatedIdentity, type FederatedIdentityClaims, type FederatedIdentityProvider, FunctionOperation, type GeneratorResult, GqlOperation, HttpAdapter, HttpAdapterGraphQLQuery, HttpAdapterGraphQLRequest, HttpAdapterGraphQLResponse, HttpAdapterInput, HttpAdapterInputFn, HttpAdapterOutputFn, HttpAdapterRequest, HttpAdapterResponse, HttpAdapterTypedDocumentNode, type IDToken, type IdPConfig, type IdPEmailConfig, type IdPExternalConfig, type IdPGqlOperations, type IdPGqlOperationsInput as IdPGqlOperationsConfig, type IdPPermission, type IdPPermissionCondition, type IdProvider as IdProviderConfig, type IdpName, type IdpNameRegistry, IdpUserArgs, IdpUserCreatedArgs, IdpUserDeletedArgs, IdpUserTrigger, IdpUserUpdatedArgs, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, IncomingWebhookResponseConfig, IncomingWebhookTrigger, IncomingWebhookTriggerOptions, type IsAutoFilledDBField, type IsReadOnlyDBField, type MachineUserName, type MachineUserNameRegistry, type NamespacePluginOutput, type OAuth2ClientInput as OAuth2Client, type OAuth2ClientGrantType, type OIDC, Operation, ParameterizedWaitPointInstance, type PermissionCondition, type Plugin, type PluginAttachment, type PluginConfigs, type PluginExecutorContext, type PluginExecutorContextBase, type PluginGeneratedExecutor, type PluginGeneratedExecutorWithFile, type PluginGeneratedResolver, type PluginGeneratedType, type PluginNamespaceProcessContext, type PluginOutput, type PluginProcessContext, type QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordUpdatedArgs, type ResolvedExecutionPolicyInstance, type Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, type ResolverExternalConfig, type ResolverNamespaceData, type ResolverPermission, type ResolverPermissionCondition, type ResolverPermissionPolicy, type ResolverReadyContext, type ResolverServiceConfig, type ResolverServiceInput, type RetryPolicy, type SAML, type SCIMAttribute, type SCIMAttributeMapping, type SCIMAttributeType, type SCIMAuthorization, type SCIMConfig, type SCIMResource, ScheduleArgs, ScheduleTrigger, type SecretsConfig, type StaticWebsiteConfig, type TailorAnyDBField, type TailorAnyDBType, type TailorDBField, type TailorDBInstance, type TailorDBNamespaceData, type TailorDBReadyContext, TailorDBTrigger, type TailorDBType, type TailorDBTypeForPlugin, type TailorField, type TailorPrincipal, type TailorTypeGqlPermission, type TailorTypePermission, type TenantProvider as TenantProviderConfig, Trigger, type TypePluginOutput, type UserAttributeKey, type UserAttributeListKey, type UserAttributes, type UsernameFieldKey, type ValueOperand, WaitPointInstance, WebhookOperation, Workflow, WorkflowConfig, WorkflowExecutionArgs, WorkflowExecutionCompletedArgs, WorkflowExecutionResumedArgs, WorkflowExecutionRetriedArgs, WorkflowExecutionStartedArgs, WorkflowExecutionTrigger, WorkflowExecutionWaitResolvedArgs, WorkflowExecutionWaitStartedArgs, WorkflowJob, WorkflowJobContext, WorkflowJobExecutionArgs, WorkflowJobExecutionCompletedArgs, WorkflowJobExecutionStartedArgs, WorkflowJobExecutionTrigger, WorkflowJobExecutionWaitResolvedArgs, WorkflowJobExecutionWaitStartedArgs, WorkflowOperation, type WorkflowServiceConfig, type WorkflowServiceInput, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, authAccessTokenTrigger, createExecutor, createHttpAdapter, createResolver, createWaitPoint, createWaitPoints, createWorkflow, createWorkflowJob, db, defineAIGateway, defineAuth, defineConfig, defineIdp, definePlugins, defineSecretManager, defineStaticWebSite, defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unsafeAllowAllGqlPermission, unsafeAllowAllIdPPermission, unsafeAllowAllTypePermission, workflowExecutionCompletedTrigger, workflowExecutionResumedTrigger, workflowExecutionRetriedTrigger, workflowExecutionStartedTrigger, workflowExecutionTrigger, workflowExecutionWaitResolvedTrigger, workflowExecutionWaitStartedTrigger, workflowJobExecutionCompletedTrigger, workflowJobExecutionStartedTrigger, workflowJobExecutionTrigger, workflowJobExecutionWaitResolvedTrigger, workflowJobExecutionWaitStartedTrigger };
@@ -1,7 +1,8 @@
1
1
  import { i as parseInternal, n as mapAllowedValues, t as db } from "../schema--xYWRGfe.mjs";
2
2
  import { t as brandValue } from "../brand-Eo4pLXPJ.mjs";
3
3
  import { a as registerJob, n as dispatchStartJob, r as dispatchStartWorkflow } from "../registry-BIGVUrMB.mjs";
4
- import { i as withWorkflowTestInvoker } from "../test-env-key-D7UkZp99.mjs";
4
+ import { l as withWorkflowTestInvoker, n as attachWaitPointKey, r as createWaitPointInvoker, t as attachWaitPointInvoker } from "../wait-point-invoker-__oE88_P.mjs";
5
+ import { r as registerWaitPoint } from "../wait-point-registry-TL99zotw.mjs";
5
6
 
6
7
  //#region src/configure/types/type.ts
7
8
  function createTailorField(type, options, fields, values, metadata) {
@@ -880,10 +881,39 @@ function createWorkflowJob(config) {
880
881
 
881
882
  //#endregion
882
883
  //#region src/configure/services/workflow/wait-point.ts
883
- function getPlatformWorkflow() {
884
- const workflow = globalThis.tailor?.workflow;
885
- if (!workflow) throw new Error("tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment, or acquire mockWorkflow() from @tailor-platform/sdk/vitest and set a wait/resolve handler.");
886
- return workflow;
884
+ const KEY_REGEX = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
885
+ const PARAM_VALUE_REGEX = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
886
+ const MAX_KEY_LENGTH = 63;
887
+ const KEY_GRAMMAR = "[a-z0-9-] (3-63 characters; must start and end with [a-z0-9])";
888
+ function parseKey(key) {
889
+ const segments = key.split("-");
890
+ return {
891
+ segments,
892
+ paramNames: segments.filter((s) => s.startsWith("$") && s.length > 1).map((s) => s.slice(1))
893
+ };
894
+ }
895
+ function composeKey(key, parsed, params) {
896
+ const composed = parsed.segments.map((segment) => {
897
+ if (!segment.startsWith("$") || segment.length === 1) return segment;
898
+ const name = segment.slice(1);
899
+ const value = params[name];
900
+ if (typeof value !== "string") throw new Error(`Wait point "${key}" needs a string for parameter "${name}" but received ${value === void 0 ? "undefined" : typeof value}.`);
901
+ if (!PARAM_VALUE_REGEX.test(value)) throw new Error(`Wait point "${key}" cannot use ${JSON.stringify(value)} for parameter "${name}": values may only contain [a-z0-9-] and cannot be empty or start or end with "-".`);
902
+ return value;
903
+ }).join("-");
904
+ if (composed.length > MAX_KEY_LENGTH) throw new Error(`Wait point key "${composed}" built from "${key}" is ${composed.length} characters; the limit is ${MAX_KEY_LENGTH}.`);
905
+ if (!KEY_REGEX.test(composed)) throw new Error(`Wait point key "${composed}" built from "${key}" must match ${KEY_GRAMMAR}.`);
906
+ return composed;
907
+ }
908
+ function createBoundWaitPoint(invoker, readKey) {
909
+ return {
910
+ wait(payload) {
911
+ return Promise.resolve(invoker.wait(readKey(), payload));
912
+ },
913
+ async resolve(executionId, callback) {
914
+ await invoker.resolve(readKey(), executionId, callback);
915
+ }
916
+ };
887
917
  }
888
918
  /**
889
919
  * Create a WaitPointInstance that delegates to the platform runtime.
@@ -894,22 +924,47 @@ function getPlatformWorkflow() {
894
924
  */
895
925
  function createWaitPointInstance(initialKey) {
896
926
  let key = initialKey;
927
+ const invoker = createWaitPointInvoker();
928
+ const instance = brandValue(createBoundWaitPoint(invoker, () => key), "wait-point");
929
+ attachWaitPointInvoker(instance, invoker);
897
930
  return {
898
- instance: brandValue({
899
- wait(payload) {
900
- return Promise.resolve(getPlatformWorkflow().wait(key, payload));
901
- },
902
- async resolve(executionId, callback) {
903
- await getPlatformWorkflow().resolve(executionId, key, callback);
904
- }
905
- }, "wait-point"),
931
+ instance,
906
932
  setKey: (k) => {
907
933
  key = k;
908
934
  }
909
935
  };
910
936
  }
937
+ function createParameterizedWaitPointInstance(key, parsed, declaredBy) {
938
+ const invoker = createWaitPointInvoker();
939
+ const unbound = () => {
940
+ throw new Error(declaredBy === "define" ? `Wait point key "${key}" has $params, so it identifies no single suspension on its own. Bind them first: waitPoint.with({ ... }).wait(...).` : `Wait point key "${key}" has $params, which createWaitPoint cannot type. Declare it through createWaitPoints instead: createWaitPoints((define) => ({ myWaitPoint: define.for("${key}")<Payload, Result>() })).`);
941
+ };
942
+ const instance = brandValue({
943
+ with(params) {
944
+ const composed = composeKey(key, parsed, params);
945
+ return attachWaitPointKey(createBoundWaitPoint(invoker, () => composed), composed);
946
+ },
947
+ wait: unbound,
948
+ resolve: unbound
949
+ }, "wait-point");
950
+ attachWaitPointInvoker(instance, invoker);
951
+ return instance;
952
+ }
953
+ function createKeyedWaitPoint(key, declaredBy) {
954
+ registerWaitPoint({
955
+ key,
956
+ declaredBy
957
+ });
958
+ const parsed = parseKey(key);
959
+ return parsed.paramNames.length > 0 ? createParameterizedWaitPointInstance(key, parsed, declaredBy) : createWaitPointInstance(key).instance;
960
+ }
911
961
  /**
912
- * Create a single typed wait point with an explicit key.
962
+ * Create a single typed wait point with a fixed key.
963
+ *
964
+ * The key must match `[a-z0-9-]` (3-63 characters, starting and ending with
965
+ * `[a-z0-9]`), which `deploy` reports on. For a key with `$params`, use
966
+ * {@link createWaitPoints}: binding params needs the key inferred as a literal
967
+ * type, which only its `define` offers.
913
968
  *
914
969
  * `Payload` and `Result` must be JsonValue-compatible.
915
970
  * Functions and objects with a `toJSON` method are rejected at the type level;
@@ -921,13 +976,14 @@ function createWaitPointInstance(initialKey) {
921
976
  *
922
977
  * await approval.wait({ message: "Please approve" });
923
978
  */
924
- /* @__NO_SIDE_EFFECTS__ */
925
979
  function createWaitPoint(key) {
926
- return createWaitPointInstance(key).instance;
980
+ return createKeyedWaitPoint(key, "createWaitPoint");
927
981
  }
928
982
  /**
929
983
  * Create a group of typed wait points for human-in-the-loop workflows.
930
- * Property names become the wait point keys.
984
+ * Property names become the wait point keys, so they must match
985
+ * `[a-z0-9-]`, which `deploy` reports on — pass an explicit key to `define`
986
+ * when they do not.
931
987
  *
932
988
  * The return type is the same as the builder's return type, so JSDoc on each
933
989
  * property is preserved and visible in IDE autocompletion.
@@ -941,23 +997,34 @@ function createWaitPoint(key) {
941
997
  * export const waitPoints = createWaitPoints(define => ({
942
998
  * // Preceding JSDoc on this property is shown in IDE autocompletion
943
999
  * approval: define<{ message: string }, { approved: boolean }>(),
1000
+ * // A key with $params is bound per call through `.with()`
1001
+ * lineApproval: define.for("line-approval-$lineId")<{ message: string }, { approved: boolean }>(),
944
1002
  * }));
945
1003
  *
946
- * // IDE shows the JSDoc when typing `waitPoints.`
947
1004
  * await waitPoints.approval.wait({ message: "Please approve" });
1005
+ * await waitPoints.lineApproval.with({ lineId: line.id }).wait({ message: "Please approve" });
948
1006
  *
949
1007
  * // For 2-level access, use destructured export with JSDoc attached to the export itself.
950
1008
  */
951
- /* @__NO_SIDE_EFFECTS__ */
952
1009
  function createWaitPoints(builder) {
953
1010
  const setters = /* @__PURE__ */ new Map();
954
- const define = (() => {
1011
+ const result = builder(Object.assign(() => {
955
1012
  const { instance, setKey } = createWaitPointInstance("__pending__");
956
1013
  setters.set(instance, setKey);
957
1014
  return instance;
958
- });
959
- const result = builder(define);
960
- for (const key of Object.keys(result)) setters.get(result[key])?.(key);
1015
+ }, { for: (key) => {
1016
+ const instance = createKeyedWaitPoint(key, "define");
1017
+ return () => instance;
1018
+ } }));
1019
+ for (const propName of Object.keys(result)) {
1020
+ const setter = setters.get(result[propName]);
1021
+ if (!setter) continue;
1022
+ registerWaitPoint({
1023
+ key: propName,
1024
+ declaredBy: "property"
1025
+ });
1026
+ setter(propName);
1027
+ }
961
1028
  return result;
962
1029
  }
963
1030