@tailor-platform/sdk 2.2.0 → 2.4.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 (117) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/README.md +1 -1
  3. package/dist/{application-BpLeawBg.mjs → application-C8a0UJ-z.mjs} +312 -166
  4. package/dist/application-C8a0UJ-z.mjs.map +1 -0
  5. package/dist/application-D4zOiLLa.mjs +3 -0
  6. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +47 -24
  7. package/dist/cli/commands/tailordb/migrate/generate.d.mts +6 -0
  8. package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +22 -0
  9. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +1 -1
  10. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +30 -11
  11. package/dist/cli/commands/tailordb/truncate.d.mts +2 -2
  12. package/dist/cli/lib.mjs +2 -2
  13. package/dist/cli/lib.mjs.map +1 -1
  14. package/dist/cli/main.mjs +366 -137
  15. package/dist/cli/main.mjs.map +1 -1
  16. package/dist/cli/ts-hook.mjs +55 -8
  17. package/dist/completion/zsh-worker.zsh +38 -10
  18. package/dist/configure/config/index.d.mts +1 -1
  19. package/dist/configure/index.d.mts +3 -2
  20. package/dist/configure/index.mjs +92 -25
  21. package/dist/configure/index.mjs.map +1 -1
  22. package/dist/configure/services/aigateway/index.d.mts +5 -4
  23. package/dist/configure/services/aigateway/types.d.mts +6 -1
  24. package/dist/configure/services/auth/types.d.mts +2 -2
  25. package/dist/configure/services/index.d.mts +2 -2
  26. package/dist/configure/services/tailordb/permission.d.mts +1 -1
  27. package/dist/configure/services/tailordb/schema.d.mts +1 -1
  28. package/dist/configure/services/tailordb/types.d.mts +7 -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/configure/types/auth-namespace-name.d.mts +18 -0
  32. package/dist/{crashreport-CINZ5dVN.mjs → crashreport-Cd4TqfZq.mjs} +1 -1
  33. package/dist/{crashreport-CIIfLnoO.mjs → crashreport-Q0pDAlrj.mjs} +8 -4
  34. package/dist/{crashreport-CIIfLnoO.mjs.map → crashreport-Q0pDAlrj.mjs.map} +1 -1
  35. package/dist/{errors-CWj21238.mjs → errors-Bxut5_Sy.mjs} +17 -3
  36. package/dist/{errors-CWj21238.mjs.map → errors-Bxut5_Sy.mjs.map} +1 -1
  37. package/dist/file-BUcmVIH2.mjs.map +1 -1
  38. package/dist/kysely/index.d.mts +2 -1
  39. package/dist/kysely/index.mjs +2 -1
  40. package/dist/kysely/index.mjs.map +1 -1
  41. package/dist/{logger-DSdExfor.mjs → logger-D0bEznPv.mjs} +9 -5
  42. package/dist/{logger-DSdExfor.mjs.map → logger-D0bEznPv.mjs.map} +1 -1
  43. package/dist/package-json-8b0O9TlX.mjs.map +1 -1
  44. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  45. package/dist/plugin/builtin/enum-constants/index.mjs +5 -5
  46. package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -1
  47. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  48. package/dist/plugin/builtin/file-utils/index.mjs +14 -11
  49. package/dist/plugin/builtin/file-utils/index.mjs.map +1 -1
  50. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  51. package/dist/plugin/builtin/kysely-type/index.mjs +9 -9
  52. package/dist/plugin/builtin/kysely-type/index.mjs.map +1 -1
  53. package/dist/plugin/builtin/seed/index.mjs +1 -1
  54. package/dist/plugin/builtin/seed/seed-type-processor.d.mts +4 -4
  55. package/dist/plugin/get-generated-type.d.mts +4 -4
  56. package/dist/plugin/index.mjs +13 -13
  57. package/dist/plugin/index.mjs.map +1 -1
  58. package/dist/plugin/types.d.mts +2 -2
  59. package/dist/plugin/with-context.d.mts +1 -1
  60. package/dist/{register-ts-hook-CTth1eqj.mjs → register-ts-hook-Vqjza10T.mjs} +2516 -857
  61. package/dist/register-ts-hook-Vqjza10T.mjs.map +1 -0
  62. package/dist/{repl-editor-BCozyiNq.mjs → repl-editor-F9LotMNx.mjs} +3 -2
  63. package/dist/{repl-editor-BCozyiNq.mjs.map → repl-editor-F9LotMNx.mjs.map} +1 -1
  64. package/dist/runtime/file.d.mts +14 -14
  65. package/dist/{schema--xYWRGfe.mjs → schema-D4TC4BC3.mjs} +4 -3
  66. package/dist/schema-D4TC4BC3.mjs.map +1 -0
  67. package/dist/seed/index.d.mts +4 -4
  68. package/dist/seed/index.mjs +3 -3
  69. package/dist/seed/index.mjs.map +1 -1
  70. package/dist/{seed-xqM9WIHP.mjs → seed-Cibjmtry.mjs} +46 -40
  71. package/dist/seed-Cibjmtry.mjs.map +1 -0
  72. package/dist/{service-goqlJJgA.mjs → service-2grcAOCJ.mjs} +61 -27
  73. package/dist/service-2grcAOCJ.mjs.map +1 -0
  74. package/dist/service-CaBPNDIZ.mjs +3 -0
  75. package/dist/{service-CCwl3Avt.mjs → service-LTfp03ZZ.mjs} +7 -5
  76. package/dist/{service-CCwl3Avt.mjs.map → service-LTfp03ZZ.mjs.map} +1 -1
  77. package/dist/types/aigateway.generated.d.mts +2 -2
  78. package/dist/types/auth.generated.d.mts +3 -3
  79. package/dist/types/executor.generated.d.mts +1 -1
  80. package/dist/types/tailordb.generated.d.mts +12 -12
  81. package/dist/utils/test/index.d.mts +4 -4
  82. package/dist/utils/test/index.mjs +4 -4
  83. package/dist/utils/test/index.mjs.map +1 -1
  84. package/dist/vitest/index.mjs +95 -7
  85. package/dist/vitest/index.mjs.map +1 -1
  86. package/dist/vitest/mocks/workflow.d.mts +13 -1
  87. package/dist/wait-point-invoker-__oE88_P.mjs +148 -0
  88. package/dist/wait-point-invoker-__oE88_P.mjs.map +1 -0
  89. package/dist/wait-point-registry-TL99zotw.mjs +47 -0
  90. package/dist/wait-point-registry-TL99zotw.mjs.map +1 -0
  91. package/docs/cli/application.md +3 -1
  92. package/docs/cli/function.md +17 -13
  93. package/docs/cli/setup.md +14 -1
  94. package/docs/cli/tailordb.md +30 -27
  95. package/docs/cli/workspace.md +2 -2
  96. package/docs/cli-reference.md +23 -22
  97. package/docs/configuration.md +2 -2
  98. package/docs/github-actions.md +73 -28
  99. package/docs/migration/v2.md +58 -4
  100. package/docs/migration/v3.md +41 -0
  101. package/docs/quickstart.md +1 -1
  102. package/docs/services/aigateway.md +33 -9
  103. package/docs/services/executor.md +5 -1
  104. package/docs/services/tailordb-migration.md +146 -44
  105. package/docs/services/tailordb.md +7 -7
  106. package/docs/services/workflow.md +52 -2
  107. package/docs/testing.md +13 -1
  108. package/package.json +8 -8
  109. package/dist/application-BpLeawBg.mjs.map +0 -1
  110. package/dist/application-BxLLiLsr.mjs +0 -3
  111. package/dist/register-ts-hook-CTth1eqj.mjs.map +0 -1
  112. package/dist/schema--xYWRGfe.mjs.map +0 -1
  113. package/dist/seed-xqM9WIHP.mjs.map +0 -1
  114. package/dist/service-_XmjSEGr.mjs +0 -3
  115. package/dist/service-goqlJJgA.mjs.map +0 -1
  116. package/dist/test-env-key-D7UkZp99.mjs +0 -75
  117. 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
  }
@@ -248,8 +287,15 @@ export async function load(url, context, nextLoad) {
248
287
  return nextLoad(url, context);
249
288
  }
250
289
 
251
- // Sync hooks for module.registerHooks() (Node >= 22.15.0).
290
+ // Sync hooks for module.registerHooks() (Node >= 22.15.0). Node < 22.18.0 crashes
291
+ // on require() of scheme-only builtins (node:sqlite, node:test, node:sea) once both
292
+ // resolve and load are registered — nodejs/node#58607, fixed by nodejs/node#58612.
252
293
  export function resolveSync(specifier, context, nextResolve) {
294
+ const resolved = resolveTsSync(specifier, context, nextResolve);
295
+ return isProjectLocalSpecifier(specifier) ? propagateImportNonce(resolved, context) : resolved;
296
+ }
297
+
298
+ function resolveTsSync(specifier, context, nextResolve) {
253
299
  try {
254
300
  return nextResolve(specifier, context);
255
301
  } catch (err) {
@@ -273,15 +319,16 @@ export function resolveSync(specifier, context, nextResolve) {
273
319
  // Non-relative: try tsconfig path aliases
274
320
  if (context.parentURL?.startsWith("file://")) {
275
321
  const parentParsed = new URL(context.parentURL);
322
+ const parentNonce = parentParsed.searchParams.get(IMPORT_NONCE_PARAM) ?? "";
276
323
  parentParsed.search = "";
277
324
  parentParsed.hash = "";
278
325
  const parentDir = dirname(fileURLToPath(parentParsed));
279
- const tsconfigPaths = loadTsconfigPaths(parentDir);
326
+ const tsconfigPaths = loadTsconfigPaths(parentDir, parentNonce);
280
327
  const candidates = matchTsconfigPaths(specifier, tsconfigPaths);
281
328
  if (candidates) {
282
329
  for (const candidate of candidates) {
283
330
  const result = tryResolveWithExtensionsSync(candidate, context, nextResolve);
284
- if (result) return result;
331
+ if (result) return propagateImportNonce(result, context);
285
332
  }
286
333
  }
287
334
  }
@@ -1,5 +1,5 @@
1
1
  # politty-completion-version: 1
2
- # politty-bin-sig: 1786155894
2
+ # politty-bin-sig: 1787009813
3
3
  # politty-bin-path: /home/runner/work/sdk/sdk/node_modules/.bin/tailor
4
4
  # program: tailor
5
5
  # shell: zsh
@@ -590,6 +590,12 @@ __tailor_worker_opt_takes_value() {
590
590
  function:logs:--profile|function:logs:-p|function:logs:--p) return 0 ;;
591
591
  function:logs:--order) return 0 ;;
592
592
  function:logs:--limit|function:logs:-l|function:logs:--l) return 0 ;;
593
+ function:run:--workspace-id|function:run:--workspaceId|function:run:-w|function:run:--w) return 0 ;;
594
+ function:run:--profile|function:run:-p|function:run:--p) return 0 ;;
595
+ function:run:--name|function:run:-n|function:run:--n) return 0 ;;
596
+ function:run:--arg|function:run:-a|function:run:--a) return 0 ;;
597
+ function:run:--machine-user|function:run:--machineUser|function:run:-m|function:run:--m) return 0 ;;
598
+ function:run:--config|function:run:-c|function:run:--c) return 0 ;;
593
599
  function:test-run:--workspace-id|function:test-run:--workspaceId|function:test-run:-w|function:test-run:--w) return 0 ;;
594
600
  function:test-run:--profile|function:test-run:-p|function:test-run:--p) return 0 ;;
595
601
  function:test-run:--name|function:test-run:-n|function:test-run:--n) return 0 ;;
@@ -739,6 +745,9 @@ __tailor_worker_opt_takes_value() {
739
745
  tailordb:truncate:--namespace|tailordb:truncate:-n|tailordb:truncate:--n) return 0 ;;
740
746
  tailordb:migration:generate:--config|tailordb:migration:generate:-c|tailordb:migration:generate:--c) return 0 ;;
741
747
  tailordb:migration:generate:--name|tailordb:migration:generate:-n|tailordb:migration:generate:--n) return 0 ;;
748
+ tailordb:migration:generate:--rename) return 0 ;;
749
+ tailordb:migration:generate:--drop) return 0 ;;
750
+ tailordb:migration:generate:--expand-contract|tailordb:migration:generate:--expandContract) return 0 ;;
742
751
  tailordb:migration:rebaseline:--workspace-id|tailordb:migration:rebaseline:--workspaceId|tailordb:migration:rebaseline:-w|tailordb:migration:rebaseline:--w) return 0 ;;
743
752
  tailordb:migration:rebaseline:--profile|tailordb:migration:rebaseline:-p|tailordb:migration:rebaseline:--p) return 0 ;;
744
753
  tailordb:migration:rebaseline:--config|tailordb:migration:rebaseline:-c|tailordb:migration:rebaseline:--c) return 0 ;;
@@ -898,6 +907,7 @@ __tailor_worker_is_subcmd() {
898
907
  function:get) return 0 ;;
899
908
  function:list) return 0 ;;
900
909
  function:logs) return 0 ;;
910
+ function:run) return 0 ;;
901
911
  function:test-run) return 0 ;;
902
912
  :function) return 0 ;;
903
913
  :generate) return 0 ;;
@@ -945,6 +955,7 @@ __tailor_worker_is_subcmd() {
945
955
  setup:preview) return 0 ;;
946
956
  setup:action) return 0 ;;
947
957
  setup:coordinate) return 0 ;;
958
+ setup:renovate) return 0 ;;
948
959
  setup:check) return 0 ;;
949
960
  setup:delete) return 0 ;;
950
961
  :setup) return 0 ;;
@@ -1645,9 +1656,9 @@ __tailor_worker_complete_function_logs() {
1645
1656
  esac
1646
1657
  }
1647
1658
 
1648
- __tailor_worker_complete_function_test_run() {
1659
+ __tailor_worker_complete_function_run() {
1649
1660
  local -a _vals=()
1650
- if __tailor_worker_opt_takes_value "function:test-run" "${words[CURRENT-1]}"; then return 0; fi
1661
+ if __tailor_worker_opt_takes_value "function:run" "${words[CURRENT-1]}"; then return 0; fi
1651
1662
  if (( _after_dd )); then
1652
1663
  case "$_pos_count" in
1653
1664
  0)
@@ -1683,7 +1694,7 @@ __tailor_worker_complete_function() {
1683
1694
  __tailor_worker_cdescribe 'options' _opts
1684
1695
  return 0
1685
1696
  fi
1686
- local -a _subs=("get:Get a function registry by name" "list:List function registries in a workspace" "logs:List or get function execution logs." "test-run:Run a function on the Tailor Platform server without deploying.")
1697
+ local -a _subs=("get:Get a function registry by name" "list:List function registries in a workspace" "logs:List or get function execution logs." "run:Run a function on the Tailor Platform server without deploying." "test-run:Run a function on the Tailor Platform server without deploying.")
1687
1698
  __tailor_worker_cdescribe 'subcommands' _subs
1688
1699
  }
1689
1700
 
@@ -2241,7 +2252,7 @@ __tailor_worker_complete_profile_create() {
2241
2252
  __tailor_worker_not_used "--user" "-u" "--u" && _opts+=("--user:User email address or machine user client ID")
2242
2253
  __tailor_worker_not_used "--workspace-id" "--workspaceId" "-w" "--w" && _opts+=("--workspace-id:Workspace ID")
2243
2254
  __tailor_worker_not_used "--permission" && _opts+=("--permission:Profile permission. 'read' blocks all write commands while the profile is active.")
2244
- __tailor_worker_not_used "--machine-user" "--machineUser" "-m" "--m" && _opts+=("--machine-user:Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token).")
2255
+ __tailor_worker_not_used "--machine-user" "--machineUser" "-m" "--m" && _opts+=("--machine-user:Default machine user name for application-data commands (query, workflow start, function run, machineuser token).")
2245
2256
  __tailor_worker_not_used "--machine-user-override" "--machineUserOverride" && _opts+=("--machine-user-override:Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user.")
2246
2257
  __tailor_worker_not_used "--platform-url" "--platformUrl" && _opts+=("--platform-url:Platform API base URL for this profile.")
2247
2258
  __tailor_worker_not_used "--oauth2-client-id" "--oauth2ClientId" && _opts+=("--oauth2-client-id:OAuth2 client ID for logging in to this profile's platform.")
@@ -2315,7 +2326,7 @@ __tailor_worker_complete_profile_update() {
2315
2326
  __tailor_worker_not_used "--user" "-u" "--u" && _opts+=("--user:New user email address or machine user client ID")
2316
2327
  __tailor_worker_not_used "--workspace-id" "--workspaceId" "-w" "--w" && _opts+=("--workspace-id:New workspace ID")
2317
2328
  __tailor_worker_not_used "--permission" && _opts+=("--permission:Profile permission. 'read' blocks all write commands; 'write' lifts the restriction.")
2318
- __tailor_worker_not_used "--machine-user" "--machineUser" "-m" "--m" && _opts+=("--machine-user:Default machine user name for application-data commands (query, workflow start, function test-run, machineuser token). Pass an empty string to clear.")
2329
+ __tailor_worker_not_used "--machine-user" "--machineUser" "-m" "--m" && _opts+=("--machine-user:Default machine user name for application-data commands (query, workflow start, function run, machineuser token). Pass an empty string to clear.")
2319
2330
  __tailor_worker_not_used "--machine-user-override" "--machineUserOverride" && _opts+=("--machine-user-override:Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user; 'allow' lifts the restriction.")
2320
2331
  __tailor_worker_not_used "--platform-url" "--platformUrl" && _opts+=("--platform-url:Platform API base URL for this profile. Pass an empty string to clear.")
2321
2332
  __tailor_worker_not_used "--oauth2-client-id" "--oauth2ClientId" && _opts+=("--oauth2-client-id:OAuth2 client ID for logging in to this profile's platform. Pass an empty string to clear.")
@@ -2705,6 +2716,18 @@ __tailor_worker_complete_setup_coordinate() {
2705
2716
  fi
2706
2717
  }
2707
2718
 
2719
+ __tailor_worker_complete_setup_renovate() {
2720
+ local -a _vals=()
2721
+ if __tailor_worker_opt_takes_value "setup:renovate" "${words[CURRENT-1]}"; then return 0; fi
2722
+ if (( _after_dd )); then return 0; fi
2723
+ if [[ "${words[CURRENT]}" == -* ]]; then
2724
+ local -a _opts=()
2725
+ __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
2726
+ __tailor_worker_cdescribe 'options' _opts
2727
+ return 0
2728
+ fi
2729
+ }
2730
+
2708
2731
  __tailor_worker_complete_setup_check() {
2709
2732
  local -a _vals=()
2710
2733
  if __tailor_worker_opt_takes_value "setup:check" "${words[CURRENT-1]}"; then return 0; fi
@@ -2751,7 +2774,7 @@ __tailor_worker_complete_setup() {
2751
2774
  __tailor_worker_cdescribe 'options' _opts
2752
2775
  return 0
2753
2776
  fi
2754
- 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.")
2777
+ 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.")
2755
2778
  __tailor_worker_cdescribe 'subcommands' _subs
2756
2779
  }
2757
2780
 
@@ -3035,6 +3058,9 @@ __tailor_worker_complete_tailordb_migration_generate() {
3035
3058
  __tailor_worker_not_used "--config" "-c" "--c" && _opts+=("--config:Path to Tailor config file")
3036
3059
  __tailor_worker_not_used "--name" "-n" "--n" && _opts+=("--name:Optional description for the migration")
3037
3060
  __tailor_worker_not_used "--init" && _opts+=("--init:Delete existing migrations and start fresh")
3061
+ _opts+=("--rename:Record a field or table rename instead of remove + add (format\: \"Table.oldField\:newField\" or \"OldTable\:NewTable\"; repeatable). Renames require a migration script that copies the data.")
3062
+ _opts+=("--drop:Confirm that a removed field or table is a genuine removal, not a rename (format\: \"Table.field\" or \"Table\"; repeatable). Required in non-interactive runs for a removal with rename candidates.")
3063
+ _opts+=("--expand-contract:Convert a field type through a temporary field (format\: \"Table.field\"; repeatable). Generates two migrations.")
3038
3064
  __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
3039
3065
  __tailor_worker_cdescribe 'options' _opts
3040
3066
  return 0
@@ -3430,7 +3456,7 @@ __tailor_worker_complete_tailordb_migration() {
3430
3456
  __tailor_worker_cdescribe 'options' _opts
3431
3457
  return 0
3432
3458
  fi
3433
- 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.")
3459
+ local -a _subs=("generate:Generate migration files by detecting schema differences between current local tables 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 tables 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.")
3434
3460
  __tailor_worker_cdescribe 'subcommands' _subs
3435
3461
  }
3436
3462
 
@@ -4241,7 +4267,7 @@ __tailor_worker_complete_root() {
4241
4267
  __tailor_worker_not_used "--help" && _opts+=("--help:Show help")
4242
4268
  __tailor_worker_cdescribe 'options' _opts
4243
4269
  else
4244
- 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")
4270
+ 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")
4245
4271
  __tailor_worker_cdescribe 'subcommands' _subs
4246
4272
  fi
4247
4273
  }
@@ -4313,7 +4339,8 @@ _tailor_worker_completions() {
4313
4339
  function:get) __tailor_worker_complete_function_get ;;
4314
4340
  function:list) __tailor_worker_complete_function_list ;;
4315
4341
  function:logs) __tailor_worker_complete_function_logs ;;
4316
- function:test-run) __tailor_worker_complete_function_test_run ;;
4342
+ function:run) __tailor_worker_complete_function_run ;;
4343
+ function:test-run) __tailor_worker_complete_function_run ;;
4317
4344
  function) __tailor_worker_complete_function ;;
4318
4345
  generate) __tailor_worker_complete_generate ;;
4319
4346
  init) __tailor_worker_complete_init ;;
@@ -4360,6 +4387,7 @@ _tailor_worker_completions() {
4360
4387
  setup:preview) __tailor_worker_complete_setup_preview ;;
4361
4388
  setup:action) __tailor_worker_complete_setup_action ;;
4362
4389
  setup:coordinate) __tailor_worker_complete_setup_coordinate ;;
4390
+ setup:renovate) __tailor_worker_complete_setup_renovate ;;
4363
4391
  setup:check) __tailor_worker_complete_setup_check ;;
4364
4392
  setup:delete) __tailor_worker_complete_setup_delete ;;
4365
4393
  setup) __tailor_worker_complete_setup ;;
@@ -11,7 +11,7 @@ declare function defineConfig<const Config extends AppConfig & Record<Exclude<ke
11
11
  /**
12
12
  * Define plugins to be used with the Tailor SDK.
13
13
  * Plugins can generate additional types, resolvers, and executors
14
- * based on existing TailorDB types.
14
+ * based on existing TailorDB tables.
15
15
  * @param configs - Plugin configurations
16
16
  * @returns Plugin configurations as given
17
17
  */
@@ -10,6 +10,7 @@ import { Resolver } from "../types/resolver.generated.mjs";
10
10
  import { ExecutorReadyContext, GeneratorResult, NamespacePluginOutput, Plugin, PluginConfigs, PluginExecutorContext, PluginExecutorContextBase, PluginGeneratedExecutor, PluginGeneratedExecutorWithFile, PluginGeneratedResolver, PluginGeneratedType, PluginNamespaceProcessContext, PluginOutput, PluginProcessContext, ResolverNamespaceData, ResolverReadyContext, TailorDBNamespaceData, TailorDBReadyContext, TailorDBTypeForPlugin, TypePluginOutput } from "../plugin/types.mjs";
11
11
  import { PermissionCondition, TailorTypeGqlPermission, TailorTypePermission, unsafeAllowAllGqlPermission, unsafeAllowAllTypePermission } from "./services/tailordb/permission.mjs";
12
12
  import { TailorAnyDBField, TailorAnyDBType, TailorDBField, TailorDBInstance, TailorDBType, db } from "./services/tailordb/schema.mjs";
13
+ import { AuthNamespaceName, AuthNamespaceNameRegistry } from "./types/auth-namespace-name.mjs";
13
14
  import { AIGatewayConfig } from "./services/aigateway/types.mjs";
14
15
  import { IdPPermission, IdPPermissionCondition, unsafeAllowAllIdPPermission } from "./services/idp/permission.mjs";
15
16
  import { IdPEmailConfig, IdPGqlOperations, IdPGqlOperationsInput } from "../types/idp.generated.mjs";
@@ -38,7 +39,7 @@ import { IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, I
38
39
  import { Trigger } from "./services/executor/trigger/index.mjs";
39
40
  import { createExecutor } from "./services/executor/executor.mjs";
40
41
  import { defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy } from "./services/workflow/execution-policy.mjs";
41
- import { WaitPointInstance, createWaitPoint, createWaitPoints } from "./services/workflow/wait-point.mjs";
42
+ import { ParameterizedWaitPointInstance, WaitPointInstance, createWaitPoint, createWaitPoints } from "./services/workflow/wait-point.mjs";
42
43
  import { defineStaticWebSite } from "./services/staticwebsite/index.mjs";
43
44
  import { defineAIGateway } from "./services/aigateway/index.mjs";
44
45
  import { defineIdp } from "./services/idp/index.mjs";
@@ -132,4 +133,4 @@ declare namespace t {
132
133
  type infer<T> = TailorOutput<T>;
133
134
  }
134
135
  //#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 IsAutoFilledDBField, type IsReadOnlyDBField, 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 };
136
+ 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 AuthNamespaceName, type AuthNamespaceNameRegistry, 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
- import { i as parseInternal, n as mapAllowedValues, t as db } from "../schema--xYWRGfe.mjs";
1
+ import { i as parseInternal, n as mapAllowedValues, t as db } from "../schema-D4TC4BC3.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
 
@@ -1182,7 +1249,7 @@ function defineConfig(config) {
1182
1249
  /**
1183
1250
  * Define plugins to be used with the Tailor SDK.
1184
1251
  * Plugins can generate additional types, resolvers, and executors
1185
- * based on existing TailorDB types.
1252
+ * based on existing TailorDB tables.
1186
1253
  * @param configs - Plugin configurations
1187
1254
  * @returns Plugin configurations as given
1188
1255
  */