@tailor-platform/sdk 2.0.0-next.1 → 2.0.0-next.2

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 (119) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/application-Dtqap5jM.mjs +3 -0
  3. package/dist/{client-z_oHGVNy.mjs → application-XuMWK4eq.mjs} +5861 -20
  4. package/dist/application-XuMWK4eq.mjs.map +1 -0
  5. package/dist/cli/index.mjs +179 -122
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +75 -16
  8. package/dist/cli/lib.mjs +5 -6
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/completion/zsh-worker.zsh +105 -26
  11. package/dist/configure/index.d.mts +9 -8
  12. package/dist/configure/index.mjs +56 -19
  13. package/dist/configure/index.mjs.map +1 -1
  14. package/dist/context-Bd266-ru.mjs.map +1 -1
  15. package/dist/{context-BuuIb8CC.d.mts → context-C2lEi9uw.d.mts} +7 -28
  16. package/dist/{crashreport-pr6Rhvza.mjs → crashreport-BMWcxeSE.mjs} +1 -1
  17. package/dist/{crashreport-BsjAkFWw.mjs → crashreport-DFq-vsU0.mjs} +5 -7
  18. package/dist/{crashreport-BsjAkFWw.mjs.map → crashreport-DFq-vsU0.mjs.map} +1 -1
  19. package/dist/{file-_oUZo76X.mjs → file-BbdFGdMV.mjs} +2 -10
  20. package/dist/file-BbdFGdMV.mjs.map +1 -0
  21. package/dist/{file-BB8Vs9O_.d.mts → file-Dq3NIt_F.d.mts} +3 -42
  22. package/dist/{file-utils-DcyIPFQh.mjs → file-utils-CYZnO1pX.mjs} +5 -5
  23. package/dist/file-utils-CYZnO1pX.mjs.map +1 -0
  24. package/dist/{globals-Crz8o65k.mjs → globals-Cf0sxIt8.mjs} +2 -2
  25. package/dist/{globals-Crz8o65k.mjs.map → globals-Cf0sxIt8.mjs.map} +1 -1
  26. package/dist/{http-adapter.generated-WgMnb7Sb.d.mts → http-adapter.generated-DFsXDdm5.d.mts} +11 -10
  27. package/dist/{index-BlpzXncY.d.mts → index-BI-_j9Z3.d.mts} +29 -32
  28. package/dist/{index-DjUdWlzf.d.mts → index-C4JirJH8.d.mts} +2 -2
  29. package/dist/{index-5vPyRu1y.d.mts → index-CZfWhr0a.d.mts} +2 -2
  30. package/dist/{index-CK7u9isy.d.mts → index-Cg8VKAdN.d.mts} +4 -4
  31. package/dist/{index-B7AKc18V.d.mts → index-DYRjoLXD.d.mts} +2 -2
  32. package/dist/{index-ZePLwxw7.d.mts → index-lFpcjHPU.d.mts} +8 -15
  33. package/dist/{index-CNYe5lnW.d.mts → index-nW7hE6oE.d.mts} +2 -2
  34. package/dist/{mock-BjFj5o1I.mjs → mock-FPxmnt-y.mjs} +4 -49
  35. package/dist/{mock-BjFj5o1I.mjs.map → mock-FPxmnt-y.mjs.map} +1 -1
  36. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  37. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  38. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  39. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  40. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  41. package/dist/plugin/builtin/seed/index.mjs +1 -1
  42. package/dist/plugin/index.d.mts +4 -3
  43. package/dist/plugin/index.mjs.map +1 -1
  44. package/dist/{registry-DdsYlL_P.mjs → registry-DH4m7eYo.mjs} +4 -2
  45. package/dist/registry-DH4m7eYo.mjs.map +1 -0
  46. package/dist/runtime/context.d.mts +1 -1
  47. package/dist/runtime/file.d.mts +2 -2
  48. package/dist/runtime/file.mjs +2 -2
  49. package/dist/runtime/globals.d.mts +6 -6
  50. package/dist/runtime/index.d.mts +4 -4
  51. package/dist/runtime/index.mjs +2 -2
  52. package/dist/runtime/workflow.d.mts +2 -2
  53. package/dist/runtime/workflow.mjs +1 -1
  54. package/dist/{runtime-n9NCkjee.mjs → runtime-CY4JvrDj.mjs} +777 -234
  55. package/dist/runtime-CY4JvrDj.mjs.map +1 -0
  56. package/dist/{schema-BhkpP5Hw.mjs → schema-Dtw9Orye.mjs} +16 -13
  57. package/dist/schema-Dtw9Orye.mjs.map +1 -0
  58. package/dist/{secret-file-DBqZhjFQ.mjs → secret-file-VSVGy1V0.mjs} +27 -2
  59. package/dist/{secret-file-DBqZhjFQ.mjs.map → secret-file-VSVGy1V0.mjs.map} +1 -1
  60. package/dist/{seed-jf3008-h.mjs → seed-izIEyP3z.mjs} +3 -4
  61. package/dist/seed-izIEyP3z.mjs.map +1 -0
  62. package/dist/service-DCqIWibD.mjs +3 -0
  63. package/dist/{service-DU1mVzri.mjs → service-DU1mVzri2.mjs} +1 -1
  64. package/dist/service-DU1mVzri2.mjs.map +1 -0
  65. package/dist/{service-CCL8ruDf.mjs → service-DjyqbCaJ.mjs} +7 -7
  66. package/dist/{service-CCL8ruDf.mjs.map → service-DjyqbCaJ.mjs.map} +1 -1
  67. package/dist/test-env-key-D7UkZp99.mjs +75 -0
  68. package/dist/test-env-key-D7UkZp99.mjs.map +1 -0
  69. package/dist/{types-ClhIrW_C.mjs → types-74etvaxy.mjs} +1 -1
  70. package/dist/{types-DhO_VEZd.d.mts → types-BDRml5C3.d.mts} +12 -12
  71. package/dist/{types-B2RpYyA_.mjs → types-BQijbo4m.mjs} +9 -9
  72. package/dist/types-BQijbo4m.mjs.map +1 -0
  73. package/dist/{types-DwDgacni.d.mts → types-BX4q6Mo6.d.mts} +3 -2
  74. package/dist/types-BZ7QKVE8.d.mts +21 -0
  75. package/dist/{types-DCUhgpyI.d.mts → types-CdcQh4Z2.d.mts} +5 -76
  76. package/dist/utils/test/index.d.mts +6 -15
  77. package/dist/utils/test/index.mjs +4 -13
  78. package/dist/utils/test/index.mjs.map +1 -1
  79. package/dist/vitest/environment.mjs +1 -1
  80. package/dist/vitest/index.d.mts +2 -2
  81. package/dist/vitest/index.mjs +4 -4
  82. package/dist/vitest/setup.mjs +2 -2
  83. package/dist/{workflow-DgemCAz3.mjs → workflow-BOmaZwwG.mjs} +8 -3
  84. package/dist/workflow-BOmaZwwG.mjs.map +1 -0
  85. package/dist/{workflow-BbKvGLQg.d.mts → workflow-BVy4XWjS.d.mts} +15 -10
  86. package/dist/{workflow.generated-DtQwEo-x.d.mts → workflow.generated-ClEjBYhm.d.mts} +3 -3
  87. package/docs/cli/executor.md +53 -0
  88. package/docs/cli/setup.md +35 -33
  89. package/docs/cli/workflow.md +157 -20
  90. package/docs/cli-reference.md +26 -20
  91. package/docs/github-actions.md +29 -16
  92. package/docs/migration/v2.md +475 -0
  93. package/docs/runtime.md +1 -1
  94. package/docs/services/auth.md +12 -12
  95. package/docs/services/executor.md +3 -3
  96. package/docs/services/resolver.md +6 -6
  97. package/docs/services/tailordb.md +14 -12
  98. package/docs/services/workflow.md +4 -4
  99. package/docs/testing.md +59 -47
  100. package/package.json +7 -7
  101. package/dist/application-DB2r36Et.mjs +0 -3
  102. package/dist/application-DqS1yBg3.mjs +0 -5680
  103. package/dist/application-DqS1yBg3.mjs.map +0 -1
  104. package/dist/client-Dbohmtkv.mjs +0 -3
  105. package/dist/client-z_oHGVNy.mjs.map +0 -1
  106. package/dist/file-_oUZo76X.mjs.map +0 -1
  107. package/dist/file-utils-DcyIPFQh.mjs.map +0 -1
  108. package/dist/job-fuc3j1Ma.mjs +0 -53
  109. package/dist/job-fuc3j1Ma.mjs.map +0 -1
  110. package/dist/registry-DdsYlL_P.mjs.map +0 -1
  111. package/dist/runtime-n9NCkjee.mjs.map +0 -1
  112. package/dist/schema-BhkpP5Hw.mjs.map +0 -1
  113. package/dist/seed-jf3008-h.mjs.map +0 -1
  114. package/dist/service-D6yonf2I.mjs +0 -3
  115. package/dist/service-DU1mVzri.mjs.map +0 -1
  116. package/dist/test-env-key-D9kM6ETE.mjs +0 -49
  117. package/dist/test-env-key-D9kM6ETE.mjs.map +0 -1
  118. package/dist/types-B2RpYyA_.mjs.map +0 -1
  119. package/dist/workflow-DgemCAz3.mjs.map +0 -1
@@ -1,11 +1,11 @@
1
- import { t as db } from "./schema-BhkpP5Hw.mjs";
2
- import { $ as CreateExecutorExecutorRequestSchema, A as TailorDBGQLPermission_Permit, At as AuthSCIMAttribute_Type, B as UpdateSecretManagerSecretRequestSchema, Bt as Subgraph_ServiceType, C as WorkflowExecution_Status, Ct as AuthConnection_Type, D as UpdateTailorDBTypeRequestSchema, Dt as AuthOAuth2Client_ClientType, E as CreateTailorDBTypeRequestSchema, Et as AuthInvokerSchema, F as CreateStaticWebsiteRequestSchema, Ft as UserProfileProviderConfig_UserProfileProviderType, G as PipelineResolver_OperationType, H as CreatePipelineServiceRequestSchema, Ht as Condition_Operator, I as UpdateStaticWebsiteRequestSchema, It as CreateApplicationRequestSchema, J as IdPLang, K as CreateIdPServiceRequestSchema, Lt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, M as TailorDBType_Permission_Permit, Mt as AuthSCIMConfig_AuthorizationType, N as TailorDBType_PermitAction, O as TailorDBGQLPermission_Action, Ot as AuthOAuth2Client_GrantType, P as AddCustomDomainRequestSchema, Pt as TenantProviderConfig_TenantProviderType, R as CreateSecretManagerSecretRequestSchema, Rt as UpdateApplicationRequestSchema, S as UpdateWorkflowRequestSchema, St as UpdateUserProfileConfigRequestSchema, T as CreateTailorDBServiceRequestSchema, Tt as AuthIDPConfig_AuthType, U as UpdatePipelineResolverRequestSchema, Ut as FilterSchema, V as CreatePipelineResolverRequestSchema, Vt as ConditionSchema, W as UpdatePipelineServiceRequestSchema, Wt as PageDirection, X as IdPPermissionPermit, Y as IdPPermissionOperator, Z as FunctionExecution_Status, _ as userAgent, _t as UpdateAuthOAuth2ClientRequestSchema, a as fetchAll, at as CreateAuthHookRequestSchema, b as CreateWorkflowJobFunctionRequestSchema, bt as UpdateAuthServiceRequestSchema, ct as CreateAuthOAuth2ClientRequestSchema, dt as CreateAuthServiceRequestSchema, et as UpdateExecutorExecutorRequestSchema, f as initOperatorClient, ft as CreateTenantConfigRequestSchema, gt as UpdateAuthMachineUserRequestSchema, h as resolveStaticWebsiteUrls, ht as UpdateAuthIDPConfigRequestSchema, it as CreateAuthConnectionRequestSchema, j as TailorDBType_Permission_Operator, jt as AuthSCIMAttribute_Uniqueness, k as TailorDBGQLPermission_Operator, kt as AuthSCIMAttribute_Mutability, lt as CreateAuthSCIMConfigRequestSchema, m as platformBaseUrl, mt as UpdateAuthHookRequestSchema, nt as ExecutorTargetType, o as fetchMachineUserToken, ot as CreateAuthIDPConfigRequestSchema, pt as CreateUserProfileConfigRequestSchema, q as UpdateIdPServiceRequestSchema, rt as ExecutorTriggerType, s as fetchPaged, st as CreateAuthMachineUserRequestSchema, tt as ExecutorJobStatus, ut as CreateAuthSCIMResourceRequestSchema, v as OperatorService, vt as UpdateAuthSCIMConfigRequestSchema, w as WorkflowJobExecution_Status, wt as AuthHookPoint, x as CreateWorkflowRequestSchema, xt as UpdateTenantConfigRequestSchema, y as WorkspacePlatformUserRole, yt as UpdateAuthSCIMResourceRequestSchema, z as CreateSecretManagerVaultRequestSchema, zt as ApplicationSchemaUpdateAttemptStatus } from "./client-z_oHGVNy.mjs";
1
+ import { t as db } from "./schema-Dtw9Orye.mjs";
2
+ import { $ as CreateWorkflowRequestSchema, $t as UpdateTenantConfigRequestSchema, A as loadAccessToken, B as fetchAll, Bt as CreateAuthOAuth2ClientRequestSchema, C as getDistDir, Ct as PipelineResolver_OperationType, Dt as IdPPermissionOperator, E as loadConfig, Et as IdPLang, Ft as ExecutorTriggerType, Gt as CreateUserProfileConfigRequestSchema, H as fetchPaged, Ht as CreateAuthSCIMResourceRequestSchema, It as CreateAuthConnectionRequestSchema, J as resolveStaticWebsiteUrls, Jt as UpdateAuthMachineUserRequestSchema, K as initOperatorClient, Kt as UpdateAuthHookRequestSchema, Lt as CreateAuthHookRequestSchema, M as loadMachineUserName, Mt as UpdateExecutorExecutorRequestSchema, N as loadWorkspaceId, Nt as ExecutorJobStatus, Ot as IdPPermissionPermit, P as readPlatformConfig, Pt as ExecutorTargetType, Q as CreateWorkflowJobFunctionRequestSchema, Qt as UpdateAuthServiceRequestSchema, R as writePlatformConfig, Rt as CreateAuthIDPConfigRequestSchema, S as createBundleCache, Sn as PageDirection, St as UpdatePipelineServiceRequestSchema, T as hashFile, Tt as UpdateIdPServiceRequestSchema, Ut as CreateAuthServiceRequestSchema, V as fetchMachineUserToken, Vt as CreateAuthSCIMConfigRequestSchema, Wt as CreateTenantConfigRequestSchema, X as OperatorService, Xt as UpdateAuthSCIMConfigRequestSchema, Y as byName, Yt as UpdateAuthOAuth2ClientRequestSchema, Z as WorkspacePlatformUserRole, Zt as UpdateAuthSCIMResourceRequestSchema, _n as ApplicationSchemaUpdateAttemptStatus, _t as CreateSecretManagerVaultRequestSchema, a as getApplicationAuthNamespace, an as AuthOAuth2Client_ClientType, at as UpdateTailorDBTypeRequestSchema, b as getPluginGenerationDependencies, bn as Condition_Operator, bt as CreatePipelineServiceRequestSchema, c as HTTP_METHODS, cn as AuthSCIMAttribute_Type, ct as TailorDBGQLPermission_Permit, d as buildResolverOperationHookExpr, dt as TailorDBType_PermitAction, en as UpdateUserProfileConfigRequestSchema, et as UpdateWorkflowRequestSchema, f as assertUniqueLocalTailorDBTypeNames, fn as TenantProviderConfig_TenantProviderType, ft as AddCustomDomainRequestSchema, g as platformBundleDefinePlugin, gn as UpdateApplicationRequestSchema, gt as CreateSecretManagerSecretRequestSchema, h as stringifyFunction, hn as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, in as AuthInvokerSchema, it as CreateTailorDBTypeRequestSchema, j as loadConfigPath, jt as CreateExecutorExecutorRequestSchema, kt as FunctionExecution_Status, ln as AuthSCIMAttribute_Uniqueness, lt as TailorDBType_Permission_Operator, m as TailorDBTypeSchema, mn as CreateApplicationRequestSchema, mt as UpdateStaticWebsiteRequestSchema, n as generatePluginFilesIfNeeded, nn as AuthHookPoint, nt as WorkflowJobExecution_Status, on as AuthOAuth2Client_GrantType, ot as TailorDBGQLPermission_Action, p as assertUniqueTailorDBTypeNamesWithExternal, pn as UserProfileProviderConfig_UserProfileProviderType, pt as CreateStaticWebsiteRequestSchema, q as platformBaseUrl, qt as UpdateAuthIDPConfigRequestSchema, r as loadApplication, rn as AuthIDPConfig_AuthType, rt as CreateTailorDBServiceRequestSchema, sn as AuthSCIMAttribute_Mutability, st as TailorDBGQLPermission_Operator, t as defineApplication, tn as AuthConnection_Type, tt as WorkflowExecution_Status, u as buildExecutorArgsExpr, un as AuthSCIMConfig_AuthorizationType, ut as TailorDBType_Permission_Permit, vn as Subgraph_ServiceType, vt as UpdateSecretManagerSecretRequestSchema, wt as CreateIdPServiceRequestSchema, x as hasGenerationHooks, xn as FilterSchema, xt as UpdatePipelineResolverRequestSchema, yn as ConditionSchema, yt as CreatePipelineResolverRequestSchema, zt as CreateAuthMachineUserRequestSchema } from "./application-XuMWK4eq.mjs";
3
3
  import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
4
4
  import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-CxF-Ex5d.mjs";
5
- import { A as loadAccessToken, C as getDistDir, E as loadConfig, M as loadMachineUserName, N as loadWorkspaceId, P as readPlatformConfig, R as writePlatformConfig, S as createBundleCache, T as hashFile, a as getApplicationAuthNamespace, b as getPluginGenerationDependencies, c as HTTP_METHODS, d as buildResolverOperationHookExpr, f as assertUniqueLocalTailorDBTypeNames, g as platformBundleDefinePlugin, h as stringifyFunction, j as loadConfigPath, m as TailorDBTypeSchema, n as generatePluginFilesIfNeeded, p as assertUniqueTailorDBTypeNamesWithExternal, r as loadApplication, t as defineApplication, u as buildExecutorArgsExpr, x as hasGenerationHooks } from "./application-DqS1yBg3.mjs";
6
- import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-CCL8ruDf.mjs";
5
+ import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-DjyqbCaJ.mjs";
7
6
  import { t as multiline } from "./multiline-sfHpTZZK.mjs";
8
7
  import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
8
+ import { i as userAgent } from "./secret-file-VSVGy1V0.mjs";
9
9
  import { n as isCLIError, t as createCLIError } from "./errors-Dtf2WPaW.mjs";
10
10
  import { r as withSpan } from "./telemetry-CdqJEzkj.mjs";
11
11
  import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
@@ -23,6 +23,7 @@ import { tmpdir } from "node:os";
23
23
  import { findUpSync } from "find-up-simple";
24
24
  import { xdgConfig } from "xdg-basedir";
25
25
  import { Code, ConnectError } from "@connectrpc/connect";
26
+ import pLimit from "p-limit";
26
27
  import { resolveTSConfig } from "pkg-types";
27
28
  import * as crypto$1 from "node:crypto";
28
29
  import { createHash } from "node:crypto";
@@ -34,10 +35,10 @@ import * as fs from "node:fs/promises";
34
35
  import { glob } from "node:fs/promises";
35
36
  import { parseSync } from "oxc-parser";
36
37
  import * as inflection from "inflection";
37
- import pLimit from "p-limit";
38
38
  import { pathToString } from "@bufbuild/protobuf/reflect";
39
39
  import { createValidator } from "@bufbuild/protovalidate";
40
40
  import { setTimeout as setTimeout$1 } from "timers/promises";
41
+ import { setTimeout as setTimeout$2 } from "node:timers/promises";
41
42
  import { spawn } from "node:child_process";
42
43
  import { watch } from "chokidar";
43
44
  import * as madgeModule from "madge";
@@ -1102,7 +1103,7 @@ function extractAttributesFromConfig(config) {
1102
1103
  * @param attributeMap - Attribute map configuration
1103
1104
  * @param attributeList - Attribute list configuration
1104
1105
  * @param env - Environment configuration
1105
- * @param machineUserNames - Registered machine user names (used to narrow `authInvoker` strings)
1106
+ * @param machineUserNames - Registered machine user names (used to narrow `invoker` strings)
1106
1107
  * @param idpNames - Registered IdP names (used to narrow `idpUser*Trigger({ idp })` strings)
1107
1108
  * @returns Generated type definition source
1108
1109
  */
@@ -4890,7 +4891,7 @@ async function readConfigId(configPath) {
4890
4891
  async function assertConfigIdInCI(configPath) {
4891
4892
  const result = await readConfigId(configPath);
4892
4893
  if (result === null) return;
4893
- if (!result.id) throw new Error("tailor.config.ts is missing an 'id'. CI does not auto-generate one (each run would be treated as a separate app and break resource ownership). Run 'tailor-sdk setup github' or 'tailor-sdk deploy' locally and commit the injected id.");
4894
+ if (!result.id) throw new Error("tailor.config.ts is missing an 'id'. CI does not auto-generate one (each run would be treated as a separate app and break resource ownership). Run 'tailor-sdk setup' or 'tailor-sdk deploy' locally and commit the injected id.");
4894
4895
  if (!uuidRegex.test(result.id)) throw new Error(`'id' in ${configPath} must be a UUID. To use this config for a separate app, delete it.`);
4895
4896
  }
4896
4897
  /**
@@ -5058,29 +5059,29 @@ async function confirmImportantResourceDeletion(resources, yes) {
5058
5059
  }
5059
5060
 
5060
5061
  //#endregion
5061
- //#region src/cli/commands/deploy/auth-invoker.ts
5062
+ //#region src/cli/commands/deploy/invoker.ts
5062
5063
  /**
5063
- * Normalize an authInvoker value to the object form required by the proto payload.
5064
+ * Normalize an invoker value to the object form required by the proto payload.
5064
5065
  *
5065
5066
  * Accepts either:
5066
5067
  * - `undefined` — returns undefined
5067
5068
  * - a plain string (machine user name) — expands to `{ namespace, machineUserName }` using `authNamespace`
5068
5069
  * - an internal object `{ namespace, machineUserName }` — returned as-is
5069
- * @param authInvoker - String machine user name or internal object form
5070
- * @param authNamespace - Auth service namespace (required when authInvoker is a string)
5070
+ * @param invoker - String machine user name or internal object form
5071
+ * @param authNamespace - Auth service namespace (required when invoker is a string)
5071
5072
  * @param context - Contextual label used in error messages (e.g. `resolver "foo"`)
5072
- * @returns Object form of auth invoker, or undefined
5073
+ * @returns Object form of the invoker, or undefined
5073
5074
  */
5074
- function normalizeAuthInvoker(authInvoker, authNamespace, context) {
5075
- if (authInvoker === void 0) return void 0;
5076
- if (typeof authInvoker === "string") {
5077
- if (!authNamespace) throw new Error(`${context} uses a string authInvoker ("${authInvoker}"), but no Auth service is configured. Configure an Auth service before using authInvoker.`);
5075
+ function normalizeInvoker(invoker, authNamespace, context) {
5076
+ if (invoker === void 0) return void 0;
5077
+ if (typeof invoker === "string") {
5078
+ if (!authNamespace) throw new Error(`${context} uses a string invoker ("${invoker}"), but no Auth service is configured. Configure an Auth service before using invoker.`);
5078
5079
  return {
5079
5080
  namespace: authNamespace,
5080
- machineUserName: authInvoker
5081
+ machineUserName: invoker
5081
5082
  };
5082
5083
  }
5083
- return authInvoker;
5084
+ return invoker;
5084
5085
  }
5085
5086
 
5086
5087
  //#endregion
@@ -5419,7 +5420,7 @@ function protoExecutor(application, executor) {
5419
5420
  appName: target.appName ?? appName,
5420
5421
  query: target.query,
5421
5422
  variables: target.variables ? { expr: `(${stringifyFunction(target.variables)})(${argsExpr})` } : void 0,
5422
- invoker: normalizeAuthInvoker(target.authInvoker, authNamespace, invokerContext)
5423
+ invoker: normalizeInvoker(target.invoker, authNamespace, invokerContext)
5423
5424
  }
5424
5425
  } };
5425
5426
  break;
@@ -5433,7 +5434,7 @@ function protoExecutor(application, executor) {
5433
5434
  name: "operation",
5434
5435
  scriptRef: executorFunctionName(executor.name),
5435
5436
  variables: { expr: argsExpr },
5436
- invoker: normalizeAuthInvoker(target.authInvoker, authNamespace, invokerContext)
5437
+ invoker: normalizeInvoker(target.invoker, authNamespace, invokerContext)
5437
5438
  }
5438
5439
  } };
5439
5440
  break;
@@ -5444,7 +5445,7 @@ function protoExecutor(application, executor) {
5444
5445
  value: {
5445
5446
  workflowName: target.workflowName,
5446
5447
  variables: target.args ? typeof target.args === "function" ? { expr: `(${stringifyFunction(target.args)})(${argsExpr})` } : { expr: JSON.stringify(target.args) } : void 0,
5447
- invoker: normalizeAuthInvoker(target.authInvoker, authNamespace, invokerContext)
5448
+ invoker: normalizeInvoker(target.invoker, authNamespace, invokerContext)
5448
5449
  }
5449
5450
  } };
5450
5451
  break;
@@ -5780,7 +5781,7 @@ function processResolver(namespace, resolver, executorUsedResolvers, env, authNa
5780
5781
  operationSourceRef: resolverFunctionName(namespace, resolver.name),
5781
5782
  operationHook: { expr: buildResolverOperationHookExpr(env) },
5782
5783
  postScript: `args.body`,
5783
- invoker: normalizeAuthInvoker(resolver.authInvoker, authNamespace, `Resolver "${resolver.name}"`)
5784
+ invoker: normalizeInvoker(resolver.invoker, authNamespace, `Resolver "${resolver.name}"`)
5784
5785
  }];
5785
5786
  const typeBaseName = inflection.camelize(resolver.name);
5786
5787
  const inputs = resolver.input ? protoFields(resolver.input, `${typeBaseName}Input`, true) : [];
@@ -8700,7 +8701,7 @@ const DEFAULT_POLL_INTERVAL = 1e3;
8700
8701
  * @returns {Promise<ExecutionWaitResult>} Execution result
8701
8702
  * @throws {Error} If execution is not found
8702
8703
  */
8703
- async function waitForExecution$1(client, workspaceId, executionId, pollInterval = DEFAULT_POLL_INTERVAL) {
8704
+ async function waitForExecution(client, workspaceId, executionId, pollInterval = DEFAULT_POLL_INTERVAL) {
8704
8705
  while (true) {
8705
8706
  const { execution } = await client.getFunctionExecution({
8706
8707
  workspaceId,
@@ -8731,11 +8732,11 @@ async function executeScript(options) {
8731
8732
  workspaceId,
8732
8733
  name,
8733
8734
  code,
8734
- arg: arg ?? JSON.stringify({}),
8735
+ arg: JSON.stringify(arg === void 0 ? {} : arg),
8735
8736
  invoker
8736
8737
  });
8737
8738
  const executionId = response.executionId;
8738
- const result = await waitForExecution$1(client, workspaceId, executionId, pollInterval);
8739
+ const result = await waitForExecution(client, workspaceId, executionId, pollInterval);
8739
8740
  if (result.status === FunctionExecution_Status.SUCCESS) return {
8740
8741
  success: true,
8741
8742
  logs: result.logs,
@@ -8984,13 +8985,13 @@ async function detectPendingMigrations(client, workspaceId, namespacesWithMigrat
8984
8985
  * @returns {Promise<ExecutionResult>} Execution result
8985
8986
  */
8986
8987
  async function executeSingleMigration(options, migration) {
8987
- const { client, workspaceId, authInvoker, env } = options;
8988
+ const { client, workspaceId, invoker, env } = options;
8988
8989
  const result = await executeScript({
8989
8990
  client,
8990
8991
  workspaceId,
8991
8992
  name: `migration-${migration.namespace}-${formatMigrationNumber(migration.number)}.js`,
8992
8993
  code: (await bundleMigrationScript(migration.scriptPath, migration.namespace, migration.number, env)).bundledCode,
8993
- invoker: authInvoker
8994
+ invoker
8994
8995
  });
8995
8996
  return {
8996
8997
  namespace: migration.namespace,
@@ -9035,14 +9036,14 @@ async function executeMigrations(context, migrations) {
9035
9036
  const migrationConfig = context.dbConfig[namespace]?.migration;
9036
9037
  const machineUserName = getMigrationMachineUser(migrationConfig, context.machineUsers);
9037
9038
  if (!machineUserName) throw new Error(`No machine user available for migration execution in namespace '${namespace}'. Either configure 'migration.machineUser' in db config or define machine users in auth config.`);
9038
- const authInvoker = create(AuthInvokerSchema, {
9039
+ const invoker = create(AuthInvokerSchema, {
9039
9040
  namespace: context.authNamespace,
9040
9041
  machineUserName
9041
9042
  });
9042
9043
  const options = {
9043
9044
  client: context.client,
9044
9045
  workspaceId: context.workspaceId,
9045
- authInvoker,
9046
+ invoker,
9046
9047
  env: context.env
9047
9048
  };
9048
9049
  logger.info(`Using machine user: ${styles.bold(machineUserName)} for namespace '${namespace}'`);
@@ -9695,6 +9696,9 @@ async function planTailorDB(context) {
9695
9696
  const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices(client, workspaceId, application.name, application.id, tailordbs);
9696
9697
  const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
9697
9698
  const [typeChangeSet, gqlPermissionChangeSet] = await Promise.all([planTypes(client, workspaceId, tailordbs, executorUsedTypes, deletedServices, void 0, forceApplyAll), planGqlPermissions(client, workspaceId, tailordbs, deletedServices, forceApplyAll)]);
9699
+ typeChangeSet.creates.sort(byName);
9700
+ typeChangeSet.updates.sort(byName);
9701
+ typeChangeSet.deletes.sort(byName);
9698
9702
  return {
9699
9703
  changeSet: {
9700
9704
  service: serviceChangeSet,
@@ -11175,7 +11179,42 @@ function colorizeExecutorJobStatus(status) {
11175
11179
  * @returns True if status is terminal
11176
11180
  */
11177
11181
  function isExecutorJobTerminalStatus(status) {
11178
- return status === ExecutorJobStatus.SUCCESS || status === ExecutorJobStatus.FAILED || status === ExecutorJobStatus.CANCELED;
11182
+ return isExecutorJobSuccessStatus(status) || isExecutorJobFailureStatus(status);
11183
+ }
11184
+ /**
11185
+ * Check if executor job status is successful.
11186
+ * @param status - Executor job status enum value
11187
+ * @returns True if status is success
11188
+ */
11189
+ function isExecutorJobSuccessStatus(status) {
11190
+ return status === ExecutorJobStatus.SUCCESS;
11191
+ }
11192
+ /**
11193
+ * Check if executor job status is a terminal failure.
11194
+ * @param status - Executor job status enum value
11195
+ * @returns True if status is failure
11196
+ */
11197
+ function isExecutorJobFailureStatus(status) {
11198
+ return status === ExecutorJobStatus.FAILED || status === ExecutorJobStatus.CANCELED;
11199
+ }
11200
+ /**
11201
+ * Check if executor job status can still progress.
11202
+ * @param status - Executor job status enum value
11203
+ * @returns True if status is transient
11204
+ */
11205
+ function isExecutorJobTransientStatus(status) {
11206
+ return status === ExecutorJobStatus.UNSPECIFIED || status === ExecutorJobStatus.PENDING || status === ExecutorJobStatus.RUNNING;
11207
+ }
11208
+ /**
11209
+ * Classify executor job status for waiter decisions.
11210
+ * @param status - Executor job status enum value
11211
+ * @returns Classified executor job status
11212
+ */
11213
+ function classifyExecutorJobStatus(status) {
11214
+ if (isExecutorJobSuccessStatus(status)) return "success";
11215
+ if (isExecutorJobTerminalStatus(status)) return "failure";
11216
+ if (isExecutorJobTransientStatus(status)) return "transient";
11217
+ return "transient";
11179
11218
  }
11180
11219
  /**
11181
11220
  * Parse executor job status string to enum.
@@ -11567,36 +11606,158 @@ function functionExecutionStatusToString(status) {
11567
11606
  }
11568
11607
  }
11569
11608
 
11609
+ //#endregion
11610
+ //#region src/cli/shared/wait-error.ts
11611
+ /**
11612
+ * Format a caught error into a string for diagnostics.
11613
+ * @param error - Error to format
11614
+ * @returns Error message string
11615
+ */
11616
+ function formatWaitError(error) {
11617
+ return error instanceof Error ? error.message : String(error);
11618
+ }
11619
+ /**
11620
+ * Check whether a polling error is retryable (transient platform errors).
11621
+ * @param error - Error to check
11622
+ * @returns True if the error should be retried
11623
+ */
11624
+ function isRetryableWaitError(error) {
11625
+ if (!(error instanceof ConnectError)) return false;
11626
+ return error.code === Code.Aborted || error.code === Code.ResourceExhausted || error.code === Code.Unavailable;
11627
+ }
11628
+
11570
11629
  //#endregion
11571
11630
  //#region src/cli/commands/workflow/args.ts
11631
+ const workflowWaitUntilArg = z.enum([
11632
+ "success",
11633
+ "suspended",
11634
+ "terminal"
11635
+ ]);
11572
11636
  const nameArgs = { name: arg(z.string(), {
11573
11637
  positional: true,
11574
11638
  description: "Workflow name"
11575
11639
  }) };
11576
- const waitArgs = {
11577
- wait: arg(z.boolean().default(false), {
11578
- alias: "W",
11579
- description: "Wait for execution to complete"
11580
- }),
11640
+ const workflowWaitControlArgs = {
11581
11641
  interval: arg(durationArg.default("3s"), {
11582
11642
  alias: "i",
11583
- description: "Polling interval when using --wait (e.g., '3s', '500ms', '1m')"
11643
+ description: "Polling interval when waiting (e.g., '3s', '500ms', '1m')"
11644
+ }),
11645
+ timeout: arg(durationArg.default("10m"), {
11646
+ alias: "t",
11647
+ description: "Maximum time to wait (e.g., '30s', '10m')"
11648
+ }),
11649
+ until: arg(workflowWaitUntilArg.default("terminal"), {
11650
+ alias: "u",
11651
+ description: "Wait target (success, suspended, terminal)"
11584
11652
  }),
11585
11653
  logs: arg(z.boolean().default(false), {
11586
11654
  alias: "l",
11587
- description: "Display job execution logs after completion (requires --wait)"
11655
+ description: "Display job execution logs after completion"
11588
11656
  })
11589
11657
  };
11658
+ const waitArgs = {
11659
+ wait: arg(z.boolean().default(false), {
11660
+ alias: "W",
11661
+ description: "Wait for execution to complete"
11662
+ }),
11663
+ ...workflowWaitControlArgs
11664
+ };
11590
11665
 
11591
11666
  //#endregion
11592
11667
  //#region src/cli/commands/workflow/status.ts
11593
11668
  /**
11669
+ * Check if workflow execution status is successful.
11670
+ * @param status - Workflow execution status enum value
11671
+ * @returns True if status is success
11672
+ */
11673
+ function isWorkflowExecutionSuccessStatus(status) {
11674
+ return status === WorkflowExecution_Status.SUCCESS;
11675
+ }
11676
+ /**
11677
+ * Check if workflow job execution status is suspended or waiting.
11678
+ * @param status - Workflow job execution status enum value
11679
+ * @returns True if status represents a wait point
11680
+ */
11681
+ function isWorkflowJobExecutionSuspendedStatus(status) {
11682
+ return status === WorkflowJobExecution_Status.SUSPEND || status === WorkflowJobExecution_Status.WAITING;
11683
+ }
11684
+ /**
11685
+ * Check if workflow execution status is suspended or waiting.
11686
+ * @param status - Workflow execution status enum value
11687
+ * @returns True if status represents a suspended execution
11688
+ */
11689
+ function isWorkflowExecutionSuspendedStatus(status) {
11690
+ return status === WorkflowExecution_Status.PENDING_RESUME || status === WorkflowExecution_Status.WAITING;
11691
+ }
11692
+ /**
11693
+ * Check if workflow execution status is a terminal failure.
11694
+ * @param status - Workflow execution status enum value
11695
+ * @returns True if status represents failure
11696
+ */
11697
+ function isWorkflowExecutionFailureStatus(status) {
11698
+ return status === WorkflowExecution_Status.FAILED;
11699
+ }
11700
+ /**
11701
+ * Check if workflow execution status can still progress without user action.
11702
+ * @param status - Workflow execution status enum value
11703
+ * @returns True if status is transient
11704
+ */
11705
+ function isWorkflowExecutionTransientStatus(status) {
11706
+ return status === WorkflowExecution_Status.UNSPECIFIED || status === WorkflowExecution_Status.PENDING || status === WorkflowExecution_Status.RUNNING || status === WorkflowExecution_Status.PENDING_RETRY;
11707
+ }
11708
+ /**
11594
11709
  * Check if workflow execution status is terminal.
11595
11710
  * @param status - Workflow execution status enum value
11596
11711
  * @returns True if status is terminal
11597
11712
  */
11598
11713
  function isWorkflowExecutionTerminalStatus(status) {
11599
- return status === WorkflowExecution_Status.SUCCESS || status === WorkflowExecution_Status.FAILED || status === WorkflowExecution_Status.PENDING_RESUME;
11714
+ return isWorkflowExecutionSuccessStatus(status) || isWorkflowExecutionFailureStatus(status) || isWorkflowExecutionSuspendedStatus(status);
11715
+ }
11716
+ /**
11717
+ * Classify workflow execution status for waiter decisions.
11718
+ * @param execution - Workflow execution to classify
11719
+ * @returns Classified workflow execution status
11720
+ */
11721
+ function classifyWorkflowExecutionStatus(execution) {
11722
+ if (isWorkflowExecutionTerminalStatus(execution.status)) {
11723
+ if (isWorkflowExecutionSuccessStatus(execution.status)) return {
11724
+ statusClass: "success",
11725
+ status: execution.status
11726
+ };
11727
+ if (isWorkflowExecutionFailureStatus(execution.status)) return {
11728
+ statusClass: "failure",
11729
+ status: execution.status
11730
+ };
11731
+ return {
11732
+ statusClass: "suspended",
11733
+ status: execution.status
11734
+ };
11735
+ }
11736
+ if (execution.jobExecutions.some((job) => isWorkflowJobExecutionSuspendedStatus(job.status))) return {
11737
+ statusClass: "suspended",
11738
+ status: execution.status
11739
+ };
11740
+ if (isWorkflowExecutionTransientStatus(execution.status)) return {
11741
+ statusClass: "transient",
11742
+ status: execution.status
11743
+ };
11744
+ return {
11745
+ statusClass: "transient",
11746
+ status: execution.status
11747
+ };
11748
+ }
11749
+ /**
11750
+ * Check if a classified workflow execution has reached the requested waiter target.
11751
+ * @param classification - Workflow execution status classification
11752
+ * @param until - Requested wait target
11753
+ * @returns True if the wait target is reached
11754
+ */
11755
+ function hasReachedWorkflowWaitTarget(classification, until) {
11756
+ switch (until) {
11757
+ case "success": return classification.statusClass === "success";
11758
+ case "suspended": return classification.statusClass === "suspended";
11759
+ case "terminal": return classification.statusClass === "success" || classification.statusClass === "failure" || classification.statusClass === "suspended";
11760
+ }
11600
11761
  }
11601
11762
 
11602
11763
  //#endregion
@@ -11613,6 +11774,8 @@ function workflowExecutionStatusToString(status) {
11613
11774
  case WorkflowExecution_Status.RUNNING: return "RUNNING";
11614
11775
  case WorkflowExecution_Status.SUCCESS: return "SUCCESS";
11615
11776
  case WorkflowExecution_Status.FAILED: return "FAILED";
11777
+ case WorkflowExecution_Status.PENDING_RETRY: return "PENDING_RETRY";
11778
+ case WorkflowExecution_Status.WAITING: return "WAITING";
11616
11779
  default: return "UNSPECIFIED";
11617
11780
  }
11618
11781
  }
@@ -11627,6 +11790,7 @@ function workflowJobExecutionStatusToString(status) {
11627
11790
  case WorkflowJobExecution_Status.SUSPEND: return "SUSPEND";
11628
11791
  case WorkflowJobExecution_Status.SUCCESS: return "SUCCESS";
11629
11792
  case WorkflowJobExecution_Status.FAILED: return "FAILED";
11793
+ case WorkflowJobExecution_Status.WAITING: return "WAITING";
11630
11794
  default: return "UNSPECIFIED";
11631
11795
  }
11632
11796
  }
@@ -11692,24 +11856,200 @@ function toWorkflowExecutionInfo(execution) {
11692
11856
  }
11693
11857
 
11694
11858
  //#endregion
11695
- //#region src/cli/commands/workflow/executions.ts
11696
- function sleep$1(ms) {
11697
- return new Promise((resolve) => setTimeout(resolve, ms));
11698
- }
11699
- function formatTime$2(date) {
11859
+ //#region src/cli/commands/workflow/waiter.ts
11860
+ const DEFAULT_WORKFLOW_WAIT_INTERVAL_MS = 3e3;
11861
+ function formatTime$1(date) {
11700
11862
  return date.toLocaleTimeString("en-US", { hour12: false });
11701
11863
  }
11702
- function colorizeStatus$1(status) {
11864
+ function colorizeStatus(status) {
11703
11865
  const statusText = WorkflowExecution_Status[status];
11704
11866
  switch (status) {
11705
- case WorkflowExecution_Status.PENDING: return styles.dim(statusText);
11706
- case WorkflowExecution_Status.PENDING_RESUME: return styles.warning(statusText);
11867
+ case WorkflowExecution_Status.PENDING:
11868
+ case WorkflowExecution_Status.UNSPECIFIED: return styles.dim(statusText);
11869
+ case WorkflowExecution_Status.PENDING_RESUME:
11870
+ case WorkflowExecution_Status.PENDING_RETRY:
11871
+ case WorkflowExecution_Status.WAITING: return styles.warning(statusText);
11707
11872
  case WorkflowExecution_Status.RUNNING: return styles.info(statusText);
11708
11873
  case WorkflowExecution_Status.SUCCESS: return styles.success(statusText);
11709
11874
  case WorkflowExecution_Status.FAILED: return styles.error(statusText);
11710
11875
  default: return statusText;
11711
11876
  }
11712
11877
  }
11878
+ function getActiveJobs(execution) {
11879
+ return execution.jobExecutions.filter((job) => job.status === WorkflowJobExecution_Status.RUNNING || job.status === WorkflowJobExecution_Status.SUSPEND || job.status === WorkflowJobExecution_Status.WAITING).map((job) => job.stackedJobName).join(", ");
11880
+ }
11881
+ function createWorkflowWaitResult(options) {
11882
+ const elapsedMs = Date.now() - options.startedAt;
11883
+ if (options.execution) {
11884
+ const classification = classifyWorkflowExecutionStatus(options.execution);
11885
+ return {
11886
+ ...toWorkflowExecutionInfo(options.execution),
11887
+ statusClass: classification.statusClass,
11888
+ elapsedMs,
11889
+ attempts: options.attempts,
11890
+ timedOut: options.timedOut,
11891
+ lastError: options.lastError
11892
+ };
11893
+ }
11894
+ return {
11895
+ id: options.executionId,
11896
+ workflowName: "",
11897
+ status: "UNKNOWN",
11898
+ statusClass: "unknown",
11899
+ jobExecutions: 0,
11900
+ startedAt: null,
11901
+ finishedAt: null,
11902
+ elapsedMs,
11903
+ attempts: options.attempts,
11904
+ timedOut: options.timedOut,
11905
+ lastError: options.lastError
11906
+ };
11907
+ }
11908
+ /**
11909
+ * Wait for a workflow execution to reach the requested state.
11910
+ * @param options - Workflow waiter options
11911
+ * @returns Final or timed-out workflow wait result
11912
+ */
11913
+ async function waitForWorkflowExecution(options) {
11914
+ const interval = options.interval ?? 3e3;
11915
+ const until = options.until ?? "terminal";
11916
+ const startedAt = Date.now();
11917
+ const sp = options.showProgress ? spinner({ indent: 2 }).start("Waiting for workflow to complete...") : null;
11918
+ let attempts = 0;
11919
+ let lastExecution;
11920
+ let lastError = null;
11921
+ let lastStatus;
11922
+ let lastActiveJobs;
11923
+ try {
11924
+ while (true) {
11925
+ const elapsedMs = Date.now() - startedAt;
11926
+ const remainingMs = options.timeout === void 0 ? void 0 : options.timeout - elapsedMs;
11927
+ if (remainingMs !== void 0 && remainingMs <= 0) {
11928
+ sp?.fail("Workflow wait timed out.");
11929
+ return createWorkflowWaitResult({
11930
+ executionId: options.executionId,
11931
+ execution: lastExecution,
11932
+ startedAt,
11933
+ attempts,
11934
+ timedOut: true,
11935
+ lastError
11936
+ });
11937
+ }
11938
+ try {
11939
+ attempts += 1;
11940
+ const { execution } = await options.client.getWorkflowExecution({
11941
+ workspaceId: options.workspaceId,
11942
+ executionId: options.executionId
11943
+ });
11944
+ if (!execution) {
11945
+ sp?.fail(`Execution '${options.executionId}' not found.`);
11946
+ throw new Error(`Execution '${options.executionId}' not found.`);
11947
+ }
11948
+ lastExecution = execution;
11949
+ lastError = null;
11950
+ const classification = classifyWorkflowExecutionStatus(execution);
11951
+ const coloredStatus = colorizeStatus(execution.status);
11952
+ if (execution.status !== lastStatus) {
11953
+ if (options.showProgress) {
11954
+ sp?.stop();
11955
+ logger.info(`Status: ${coloredStatus}`, {
11956
+ mode: "stream",
11957
+ indent: 2
11958
+ });
11959
+ sp?.start("Waiting for workflow to complete...");
11960
+ }
11961
+ lastStatus = execution.status;
11962
+ }
11963
+ if (options.trackJobs) {
11964
+ const activeJobs = getActiveJobs(execution);
11965
+ if (activeJobs && activeJobs !== lastActiveJobs) {
11966
+ if (options.showProgress) {
11967
+ sp?.stop();
11968
+ logger.info(`Job | ${activeJobs}: ${coloredStatus}`, {
11969
+ mode: "stream",
11970
+ indent: 2
11971
+ });
11972
+ sp?.start("Waiting for workflow to complete...");
11973
+ }
11974
+ lastActiveJobs = activeJobs;
11975
+ }
11976
+ }
11977
+ if (sp) sp.text = `Waiting for workflow to complete... (${formatTime$1(/* @__PURE__ */ new Date())})`;
11978
+ if (hasReachedWorkflowWaitTarget(classification, until) || classification.statusClass === "failure" || until === "suspended" && classification.statusClass === "success") {
11979
+ if (execution.status === WorkflowExecution_Status.SUCCESS) sp?.succeed(`Completed: ${coloredStatus}`);
11980
+ else if (isWorkflowExecutionFailureStatus(execution.status)) sp?.fail(`Completed: ${coloredStatus}`);
11981
+ else if (isWorkflowExecutionSuspendedStatus(execution.status)) sp?.warn(`Completed: ${coloredStatus}`);
11982
+ else sp?.succeed(`Completed: ${coloredStatus}`);
11983
+ return createWorkflowWaitResult({
11984
+ executionId: options.executionId,
11985
+ execution,
11986
+ startedAt,
11987
+ attempts,
11988
+ timedOut: false,
11989
+ lastError
11990
+ });
11991
+ }
11992
+ } catch (error) {
11993
+ if (!isRetryableWaitError(error)) throw error;
11994
+ lastError = formatWaitError(error);
11995
+ if (options.showProgress) {
11996
+ if (sp) sp.text = `Retrying workflow status poll... (${formatTime$1(/* @__PURE__ */ new Date())})`;
11997
+ }
11998
+ }
11999
+ const nextElapsedMs = Date.now() - startedAt;
12000
+ const nextRemainingMs = options.timeout === void 0 ? void 0 : options.timeout - nextElapsedMs;
12001
+ if (nextRemainingMs !== void 0 && nextRemainingMs <= 0) {
12002
+ sp?.fail("Workflow wait timed out.");
12003
+ return createWorkflowWaitResult({
12004
+ executionId: options.executionId,
12005
+ execution: lastExecution,
12006
+ startedAt,
12007
+ attempts,
12008
+ timedOut: true,
12009
+ lastError
12010
+ });
12011
+ }
12012
+ await setTimeout$2(nextRemainingMs === void 0 ? interval : Math.min(interval, nextRemainingMs));
12013
+ }
12014
+ } finally {
12015
+ sp?.stop();
12016
+ }
12017
+ }
12018
+ /**
12019
+ * Wait for an existing workflow execution by ID.
12020
+ * @param options - Workflow execution wait options
12021
+ * @returns Workflow wait result
12022
+ */
12023
+ async function waitForWorkflowExecutionById(options) {
12024
+ return await waitForWorkflowExecution({
12025
+ client: await initOperatorClient(await loadAccessToken({ profile: options.profile })),
12026
+ workspaceId: await loadWorkspaceId({
12027
+ workspaceId: options.workspaceId,
12028
+ profile: options.profile
12029
+ }),
12030
+ executionId: options.executionId,
12031
+ interval: options.interval,
12032
+ timeout: options.timeout,
12033
+ until: options.until,
12034
+ showProgress: options.showProgress,
12035
+ trackJobs: options.trackJobs
12036
+ });
12037
+ }
12038
+ /**
12039
+ * Build a user-facing failure message for a workflow wait result.
12040
+ * @param result - Workflow wait result
12041
+ * @param until - Requested wait target
12042
+ * @returns Failure message, or undefined when the wait succeeded
12043
+ */
12044
+ function getWorkflowWaitFailureMessage(result, until) {
12045
+ if (result.timedOut) return `Timed out waiting for workflow execution '${result.id}' to reach ${until}. Last status: ${result.status}.`;
12046
+ if (result.status === "FAILED") return `Workflow execution '${result.id}' failed.`;
12047
+ if (until === "success" && result.statusClass !== "success") return `Workflow execution '${result.id}' reached ${result.status} before success.`;
12048
+ if (until === "suspended" && result.statusClass !== "suspended") return `Workflow execution '${result.id}' reached ${result.status} before suspension.`;
12049
+ }
12050
+
12051
+ //#endregion
12052
+ //#region src/cli/commands/workflow/executions.ts
11713
12053
  function parseStatus(status) {
11714
12054
  switch (status.toUpperCase()) {
11715
12055
  case "PENDING": return WorkflowExecution_Status.PENDING;
@@ -11717,7 +12057,10 @@ function parseStatus(status) {
11717
12057
  case "RUNNING": return WorkflowExecution_Status.RUNNING;
11718
12058
  case "SUCCESS": return WorkflowExecution_Status.SUCCESS;
11719
12059
  case "FAILED": return WorkflowExecution_Status.FAILED;
11720
- default: throw new Error(`Invalid status: ${status}. Valid values: PENDING, PENDING_RESUME, RUNNING, SUCCESS, FAILED`);
12060
+ case "PENDING_RETRY": return WorkflowExecution_Status.PENDING_RETRY;
12061
+ case "WAITING": return WorkflowExecution_Status.WAITING;
12062
+ case "UNSPECIFIED": return WorkflowExecution_Status.UNSPECIFIED;
12063
+ default: throw new Error(`Invalid status: ${status}. Valid values: UNSPECIFIED, PENDING, PENDING_RESUME, RUNNING, SUCCESS, FAILED, PENDING_RETRY, WAITING`);
11721
12064
  }
11722
12065
  }
11723
12066
  async function listWorkflowExecutions(options) {
@@ -11806,37 +12149,28 @@ async function getWorkflowExecution(options) {
11806
12149
  }
11807
12150
  async function waitForCompletion() {
11808
12151
  const interval = options.interval ?? 3e3;
11809
- while (true) {
11810
- const { execution } = await client.getWorkflowExecution({
11811
- workspaceId,
11812
- executionId: options.executionId
11813
- });
11814
- if (!execution) throw new Error(`Execution '${options.executionId}' not found.`);
11815
- if (isWorkflowExecutionTerminalStatus(execution.status)) return await fetchExecutionWithLogs(options.executionId, options.logs ?? false);
11816
- await sleep$1(interval);
11817
- }
12152
+ const waitResult = await waitForWorkflowExecution({
12153
+ client,
12154
+ workspaceId,
12155
+ executionId: options.executionId,
12156
+ interval,
12157
+ timeout: options.timeout,
12158
+ until: options.until ?? "terminal"
12159
+ });
12160
+ return {
12161
+ ...await fetchExecutionWithLogs(options.executionId, options.logs ?? false),
12162
+ statusClass: waitResult.statusClass,
12163
+ elapsedMs: waitResult.elapsedMs,
12164
+ attempts: waitResult.attempts,
12165
+ timedOut: waitResult.timedOut,
12166
+ lastError: waitResult.lastError
12167
+ };
11818
12168
  }
11819
12169
  return {
11820
12170
  execution: await fetchExecutionWithLogs(options.executionId, options.logs ?? false),
11821
12171
  wait: waitForCompletion
11822
12172
  };
11823
12173
  }
11824
- async function waitWithSpinner(waitFn, interval, json) {
11825
- const sp = !json ? spinner().start("Waiting for workflow to complete...") : null;
11826
- const updateInterval = setInterval(() => {
11827
- if (sp) sp.text = `Waiting for workflow to complete... (${formatTime$2(/* @__PURE__ */ new Date())})`;
11828
- }, interval);
11829
- try {
11830
- const result = await waitFn();
11831
- const coloredStatus = colorizeStatus$1(WorkflowExecution_Status[result.status]);
11832
- if (result.status === "SUCCESS") sp?.succeed(`Completed: ${coloredStatus}`);
11833
- else sp?.fail(`Completed: ${coloredStatus}`);
11834
- return result;
11835
- } finally {
11836
- clearInterval(updateInterval);
11837
- sp?.stop();
11838
- }
11839
- }
11840
12174
  /**
11841
12175
  * Print a workflow execution and its logs in a human-readable format.
11842
12176
  * @param execution - Workflow execution detail info
@@ -11898,19 +12232,55 @@ const executionsCommand = defineAppCommand({
11898
12232
  logs: arg(z.boolean().default(false), { description: "Display job execution logs (detail mode only)" })
11899
12233
  }).strict(),
11900
12234
  run: async (args) => {
12235
+ const jsonOutput = logger.jsonMode || args.json;
11901
12236
  if (args.executionId) {
11902
12237
  const interval = parseDuration(args.interval);
11903
- const { execution, wait } = await getWorkflowExecution({
12238
+ if (!jsonOutput) logger.info(`Execution ID: ${args.executionId}`, { mode: "stream" });
12239
+ if (args.wait) {
12240
+ const result = await waitForWorkflowExecutionById({
12241
+ executionId: args.executionId,
12242
+ workspaceId: args["workspace-id"],
12243
+ profile: args.profile,
12244
+ interval,
12245
+ timeout: parseDuration(args.timeout),
12246
+ until: args.until,
12247
+ showProgress: !jsonOutput,
12248
+ trackJobs: true
12249
+ });
12250
+ if (args.logs && !jsonOutput) {
12251
+ const { execution } = await getWorkflowExecution({
12252
+ executionId: args.executionId,
12253
+ workspaceId: args["workspace-id"],
12254
+ profile: args.profile,
12255
+ logs: true
12256
+ });
12257
+ printExecutionWithLogs(execution);
12258
+ } else if (args.logs) {
12259
+ const { execution } = await getWorkflowExecution({
12260
+ executionId: args.executionId,
12261
+ workspaceId: args["workspace-id"],
12262
+ profile: args.profile,
12263
+ logs: true
12264
+ });
12265
+ const output = {
12266
+ ...result,
12267
+ jobDetails: execution.jobDetails
12268
+ };
12269
+ logger.out(output);
12270
+ } else logger.out(result);
12271
+ const failureMessage = getWorkflowWaitFailureMessage(result, args.until);
12272
+ if (failureMessage) throw new Error(failureMessage);
12273
+ return;
12274
+ }
12275
+ const { execution } = await getWorkflowExecution({
11904
12276
  executionId: args.executionId,
11905
12277
  workspaceId: args["workspace-id"],
11906
12278
  profile: args.profile,
11907
12279
  interval,
11908
12280
  logs: args.logs
11909
12281
  });
11910
- if (!args.json) logger.info(`Execution ID: ${execution.id}`, { mode: "stream" });
11911
- const result = args.wait ? await waitWithSpinner(wait, interval, args.json) : execution;
11912
- if (args.logs && !args.json) printExecutionWithLogs(result);
11913
- else logger.out(result);
12282
+ if (args.logs && !jsonOutput) printExecutionWithLogs(execution);
12283
+ else logger.out(execution);
11914
12284
  } else {
11915
12285
  const executions = await listWorkflowExecutions({
11916
12286
  workspaceId: args["workspace-id"],
@@ -11975,109 +12345,27 @@ const getCommand$5 = defineAppCommand({
11975
12345
 
11976
12346
  //#endregion
11977
12347
  //#region src/cli/commands/workflow/start.ts
11978
- function sleep(ms) {
11979
- return new Promise((resolve) => setTimeout(resolve, ms));
11980
- }
11981
- function formatTime$1(date) {
11982
- return date.toLocaleTimeString("en-US", { hour12: false });
11983
- }
11984
- function colorizeStatus(status) {
11985
- const statusText = WorkflowExecution_Status[status];
11986
- switch (status) {
11987
- case WorkflowExecution_Status.PENDING: return styles.dim(statusText);
11988
- case WorkflowExecution_Status.PENDING_RESUME: return styles.warning(statusText);
11989
- case WorkflowExecution_Status.RUNNING: return styles.info(statusText);
11990
- case WorkflowExecution_Status.SUCCESS: return styles.success(statusText);
11991
- case WorkflowExecution_Status.FAILED: return styles.error(statusText);
11992
- default: return statusText;
11993
- }
11994
- }
11995
- /**
11996
- * Wait for a workflow execution to reach a terminal state, optionally showing progress.
11997
- * @param options - Wait options
11998
- * @returns Final workflow execution info
11999
- */
12000
- async function waitForExecution(options) {
12001
- const { client, workspaceId, executionId, interval, showProgress, trackJobs } = options;
12002
- let lastStatus;
12003
- let lastRunningJobs;
12004
- const sp = showProgress ? spinner({ indent: 2 }).start("Waiting for workflow to complete...") : null;
12005
- try {
12006
- while (true) {
12007
- const { execution } = await client.getWorkflowExecution({
12008
- workspaceId,
12009
- executionId
12010
- });
12011
- if (!execution) {
12012
- sp?.fail(`Execution '${executionId}' not found.`);
12013
- throw new Error(`Execution '${executionId}' not found.`);
12014
- }
12015
- const now = formatTime$1(/* @__PURE__ */ new Date());
12016
- const coloredStatus = colorizeStatus(execution.status);
12017
- if (execution.status !== lastStatus) {
12018
- if (showProgress) {
12019
- sp?.stop();
12020
- logger.info(`Status: ${coloredStatus}`, {
12021
- mode: "stream",
12022
- indent: 2
12023
- });
12024
- sp?.start(`Waiting for workflow to complete...`);
12025
- }
12026
- lastStatus = execution.status;
12027
- }
12028
- if (trackJobs && execution.status === WorkflowExecution_Status.RUNNING) {
12029
- const runningJobs = getRunningJobs(execution);
12030
- if (runningJobs && runningJobs !== lastRunningJobs) {
12031
- if (showProgress) {
12032
- sp?.stop();
12033
- logger.info(`Job | ${runningJobs}: ${coloredStatus}`, {
12034
- mode: "stream",
12035
- indent: 2
12036
- });
12037
- sp?.start(`Waiting for workflow to complete...`);
12038
- }
12039
- lastRunningJobs = runningJobs;
12040
- }
12041
- }
12042
- if (sp) sp.text = `Waiting for workflow to complete... (${now})`;
12043
- if (isTerminalStatus(execution.status)) {
12044
- if (execution.status === WorkflowExecution_Status.SUCCESS) sp?.succeed(`Completed: ${coloredStatus}`);
12045
- else if (execution.status === WorkflowExecution_Status.FAILED) sp?.fail(`Completed: ${coloredStatus}`);
12046
- else sp?.warn(`Completed: ${coloredStatus}`);
12047
- return toWorkflowExecutionInfo(execution);
12048
- }
12049
- await sleep(interval);
12050
- }
12051
- } catch (error) {
12052
- sp?.stop();
12053
- throw error;
12054
- }
12055
- }
12056
- function getRunningJobs(execution) {
12057
- return execution.jobExecutions.filter((job) => job.status === WorkflowJobExecution_Status.RUNNING).map((job) => job.stackedJobName).join(", ");
12058
- }
12059
- function isTerminalStatus(status) {
12060
- return status === WorkflowExecution_Status.SUCCESS || status === WorkflowExecution_Status.FAILED || status === WorkflowExecution_Status.PENDING_RESUME;
12061
- }
12062
12348
  async function startWorkflowCore(options) {
12063
12349
  const { client, workspaceId, workflowName } = options;
12064
12350
  try {
12065
12351
  const workflow = await resolveWorkflow(client, workspaceId, workflowName);
12066
- const authInvoker = create(AuthInvokerSchema, options.authInvoker);
12352
+ const invoker = create(AuthInvokerSchema, options.invoker);
12067
12353
  const arg = options.arg === void 0 ? void 0 : typeof options.arg === "string" ? options.arg : JSON.stringify(options.arg);
12068
12354
  const { executionId } = await client.testStartWorkflow({
12069
12355
  workspaceId,
12070
12356
  workflowId: workflow.id,
12071
- authInvoker,
12357
+ authInvoker: invoker,
12072
12358
  arg
12073
12359
  });
12074
12360
  return {
12075
12361
  executionId,
12076
- wait: (waitOptions) => waitForExecution({
12362
+ wait: (waitOptions) => waitForWorkflowExecution({
12077
12363
  client,
12078
12364
  workspaceId,
12079
12365
  executionId,
12080
12366
  interval: options.interval ?? 3e3,
12367
+ timeout: waitOptions?.timeout,
12368
+ until: waitOptions?.until,
12081
12369
  showProgress: waitOptions?.showProgress,
12082
12370
  trackJobs: true
12083
12371
  })
@@ -12117,7 +12405,7 @@ async function startWorkflowByName(options) {
12117
12405
  client,
12118
12406
  workspaceId,
12119
12407
  workflowName: options.name,
12120
- authInvoker: {
12408
+ invoker: {
12121
12409
  namespace: authNamespace,
12122
12410
  machineUserName: machineUser
12123
12411
  },
@@ -12141,9 +12429,9 @@ async function startWorkflow(options) {
12141
12429
  client,
12142
12430
  workspaceId,
12143
12431
  workflowName: options.workflow.name,
12144
- authInvoker: {
12432
+ invoker: {
12145
12433
  namespace: authNamespace,
12146
- machineUserName: options.authInvoker
12434
+ machineUserName: options.invoker
12147
12435
  },
12148
12436
  arg: options.arg,
12149
12437
  interval: options.interval
@@ -12179,7 +12467,11 @@ const startCommand = defineAppCommand({
12179
12467
  const jsonOutput = logger.jsonMode;
12180
12468
  logger.info(`Execution ID: ${executionId}`, { mode: "stream" });
12181
12469
  if (args.wait) {
12182
- const result = await wait({ showProgress: !jsonOutput });
12470
+ const result = await wait({
12471
+ showProgress: !jsonOutput,
12472
+ timeout: parseDuration(args.timeout),
12473
+ until: args.until
12474
+ });
12183
12475
  if (args.logs && !jsonOutput) {
12184
12476
  const { execution } = await getWorkflowExecution({
12185
12477
  executionId,
@@ -12188,7 +12480,20 @@ const startCommand = defineAppCommand({
12188
12480
  logs: true
12189
12481
  });
12190
12482
  printExecutionWithLogs(execution);
12483
+ } else if (args.logs) {
12484
+ const { execution } = await getWorkflowExecution({
12485
+ executionId,
12486
+ workspaceId: args["workspace-id"],
12487
+ profile: args.profile,
12488
+ logs: true
12489
+ });
12490
+ logger.out({
12491
+ ...result,
12492
+ jobDetails: execution.jobDetails
12493
+ });
12191
12494
  } else logger.out(result);
12495
+ const failureMessage = getWorkflowWaitFailureMessage(result, args.until);
12496
+ if (failureMessage) throw new Error(failureMessage);
12192
12497
  } else logger.out({ executionId });
12193
12498
  }
12194
12499
  });
@@ -12198,6 +12503,16 @@ const startCommand = defineAppCommand({
12198
12503
  function formatTime(date) {
12199
12504
  return date.toLocaleTimeString("en-US", { hour12: false });
12200
12505
  }
12506
+ function createUnknownExecutorJob(executorName, jobId) {
12507
+ return {
12508
+ id: jobId,
12509
+ executorName,
12510
+ status: "UNKNOWN",
12511
+ scheduledAt: "N/A",
12512
+ createdAt: "N/A",
12513
+ updatedAt: "N/A"
12514
+ };
12515
+ }
12201
12516
  async function listExecutorJobs(options) {
12202
12517
  const executorName = "executorName" in options ? options.executorName : options.executor.name;
12203
12518
  const client = await initOperatorClient(await loadAccessToken({ profile: options.profile }));
@@ -12281,7 +12596,27 @@ async function watchExecutorJob(options) {
12281
12596
  profile: options.profile
12282
12597
  });
12283
12598
  const interval = options.interval ?? 3e3;
12284
- const sp = spinner().start("Waiting for executor job to complete...");
12599
+ const timeout = options.timeout;
12600
+ const showProgress = options.showProgress ?? !logger.jsonMode;
12601
+ const startedAt = Date.now();
12602
+ const sp = showProgress ? spinner().start("Waiting for executor job to complete...") : null;
12603
+ let attempts = 0;
12604
+ let lastError = null;
12605
+ const remainingTimeout = () => {
12606
+ if (timeout === void 0) return;
12607
+ return timeout - (Date.now() - startedAt);
12608
+ };
12609
+ const withWaitMetadata = (result, timedOut) => ({
12610
+ ...result,
12611
+ elapsedMs: Date.now() - startedAt,
12612
+ attempts,
12613
+ timedOut,
12614
+ lastError
12615
+ });
12616
+ const timeoutResult = (targetType, job) => withWaitMetadata({
12617
+ job: job ? toExecutorJobInfo(job) : createUnknownExecutorJob(executorName, options.jobId),
12618
+ targetType
12619
+ }, true);
12285
12620
  try {
12286
12621
  const { executor } = await client.getExecutorExecutor({
12287
12622
  workspaceId,
@@ -12292,29 +12627,47 @@ async function watchExecutorJob(options) {
12292
12627
  const targetTypeStr = executorTargetTypeToString(targetType);
12293
12628
  let job;
12294
12629
  while (true) {
12295
- job = (await client.getExecutorJob({
12296
- workspaceId,
12297
- executorName,
12298
- jobId: options.jobId
12299
- })).job;
12300
- if (!job) throw new Error(`Job '${options.jobId}' not found.`);
12301
- if (isExecutorJobTerminalStatus(job.status)) break;
12302
- sp.text = `Waiting for executor job... (${formatTime(/* @__PURE__ */ new Date())})`;
12303
- await setTimeout$1(interval);
12630
+ const remainingMs = remainingTimeout();
12631
+ if (remainingMs !== void 0 && remainingMs <= 0) {
12632
+ sp?.fail("Executor job wait timed out.");
12633
+ return timeoutResult(targetTypeStr, job);
12634
+ }
12635
+ try {
12636
+ attempts += 1;
12637
+ job = (await client.getExecutorJob({
12638
+ workspaceId,
12639
+ executorName,
12640
+ jobId: options.jobId
12641
+ })).job;
12642
+ if (!job) throw new Error(`Job '${options.jobId}' not found.`);
12643
+ lastError = null;
12644
+ if (classifyExecutorJobStatus(job.status) !== "transient") break;
12645
+ } catch (error) {
12646
+ if (!isRetryableWaitError(error)) throw error;
12647
+ lastError = formatWaitError(error);
12648
+ if (sp) sp.text = `Retrying executor job poll... (${formatTime(/* @__PURE__ */ new Date())})`;
12649
+ }
12650
+ const nextRemainingMs = remainingTimeout();
12651
+ if (nextRemainingMs !== void 0 && nextRemainingMs <= 0) {
12652
+ sp?.fail("Executor job wait timed out.");
12653
+ return timeoutResult(targetTypeStr, job);
12654
+ }
12655
+ if (sp) sp.text = `Waiting for executor job... (${formatTime(/* @__PURE__ */ new Date())})`;
12656
+ await setTimeout$1(nextRemainingMs === void 0 ? interval : Math.min(interval, nextRemainingMs));
12304
12657
  }
12305
12658
  const jobInfo = toExecutorJobInfo(job);
12306
12659
  const coloredStatus = colorizeExecutorJobStatus(jobInfo.status);
12307
- if (job.status === ExecutorJobStatus.SUCCESS) sp.succeed(`Executor job completed: ${coloredStatus}`);
12308
- else sp.fail(`Executor job completed: ${coloredStatus}`);
12660
+ if (job.status === ExecutorJobStatus.SUCCESS) sp?.succeed(`Executor job completed: ${coloredStatus}`);
12661
+ else sp?.fail(`Executor job completed: ${coloredStatus}`);
12309
12662
  const attemptInfos = (await fetchAll(async (pageToken, maxPageSize) => {
12310
- const { attempts, nextPageToken } = await client.listExecutorJobAttempts({
12663
+ const { attempts: jobAttempts, nextPageToken } = await client.listExecutorJobAttempts({
12311
12664
  workspaceId,
12312
12665
  jobId: options.jobId,
12313
12666
  pageToken,
12314
12667
  pageSize: maxPageSize,
12315
12668
  pageDirection: PageDirection.DESC
12316
12669
  });
12317
- return [attempts, nextPageToken];
12670
+ return [jobAttempts, nextPageToken];
12318
12671
  })).map(toExecutorJobAttemptInfo);
12319
12672
  const jobDetail = {
12320
12673
  ...jobInfo,
@@ -12323,18 +12676,27 @@ async function watchExecutorJob(options) {
12323
12676
  const operationReference = attemptInfos[0]?.operationReference;
12324
12677
  if (operationReference) switch (targetType) {
12325
12678
  case ExecutorTargetType.WORKFLOW:
12326
- sp.stop();
12679
+ sp?.stop();
12327
12680
  try {
12328
- const executionResult = await waitForExecution({
12681
+ const workflowTimeout = remainingTimeout();
12682
+ if (workflowTimeout !== void 0 && workflowTimeout <= 0) return withWaitMetadata({
12683
+ job: jobDetail,
12684
+ targetType: targetTypeStr,
12685
+ workflowExecutionId: operationReference
12686
+ }, true);
12687
+ const executionResult = await waitForWorkflowExecution({
12329
12688
  client,
12330
12689
  workspaceId,
12331
12690
  executionId: operationReference,
12332
12691
  interval,
12333
- showProgress: true,
12692
+ timeout: workflowTimeout,
12693
+ showProgress,
12334
12694
  trackJobs: true
12335
12695
  });
12696
+ attempts += executionResult.attempts;
12697
+ lastError = executionResult.lastError;
12336
12698
  let workflowJobLogs;
12337
- if (options.logs) {
12699
+ if (options.logs) try {
12338
12700
  const { execution: execWithLogs } = await getWorkflowExecution({
12339
12701
  executionId: operationReference,
12340
12702
  workspaceId: options.workspaceId,
@@ -12346,67 +12708,109 @@ async function watchExecutorJob(options) {
12346
12708
  logs: job.logs,
12347
12709
  result: job.result
12348
12710
  }));
12711
+ } catch (error) {
12712
+ logger.warn(`Could not fetch workflow execution logs: ${error instanceof Error ? error.message : error}`);
12349
12713
  }
12350
- return {
12714
+ return withWaitMetadata({
12351
12715
  job: jobDetail,
12352
12716
  targetType: targetTypeStr,
12353
12717
  workflowExecutionId: operationReference,
12354
12718
  workflowStatus: executionResult.status,
12355
12719
  workflowJobLogs
12356
- };
12720
+ }, executionResult.timedOut);
12357
12721
  } catch (error) {
12358
12722
  logger.warn(`Could not track workflow execution: ${error instanceof Error ? error.message : error}`);
12359
- return {
12723
+ return withWaitMetadata({
12360
12724
  job: jobDetail,
12361
12725
  targetType: targetTypeStr,
12362
12726
  workflowExecutionId: operationReference
12363
- };
12727
+ }, false);
12364
12728
  }
12365
12729
  case ExecutorTargetType.FUNCTION:
12366
12730
  case ExecutorTargetType.JOB_FUNCTION:
12367
- sp.start(`Waiting for function execution ${operationReference}...`);
12731
+ sp?.start(`Waiting for function execution ${operationReference}...`);
12368
12732
  try {
12733
+ let functionStatus;
12369
12734
  while (true) {
12370
- const { execution } = await client.getFunctionExecution({
12371
- workspaceId,
12372
- executionId: operationReference
12373
- });
12374
- if (!execution) throw new Error(`Function execution '${operationReference}' not found.`);
12375
- if (isFunctionExecutionTerminalStatus(execution.status)) {
12376
- const statusStr = functionExecutionStatusToString(execution.status);
12377
- const coloredFnStatus = colorizeFunctionExecutionStatus(statusStr);
12378
- if (execution.status === FunctionExecution_Status.SUCCESS) sp.succeed(`Function execution completed: ${coloredFnStatus}`);
12379
- else sp.fail(`Function execution completed: ${coloredFnStatus}`);
12380
- return {
12735
+ const functionTimeout = remainingTimeout();
12736
+ if (functionTimeout !== void 0 && functionTimeout <= 0) {
12737
+ sp?.fail("Function execution wait timed out.");
12738
+ return withWaitMetadata({
12381
12739
  job: jobDetail,
12382
12740
  targetType: targetTypeStr,
12383
12741
  functionExecutionId: operationReference,
12384
- functionStatus: statusStr,
12385
- functionLogs: options.logs ? execution.logs || void 0 : void 0
12386
- };
12742
+ functionStatus
12743
+ }, true);
12744
+ }
12745
+ try {
12746
+ attempts += 1;
12747
+ const { execution } = await client.getFunctionExecution({
12748
+ workspaceId,
12749
+ executionId: operationReference
12750
+ });
12751
+ if (!execution) throw new Error(`Function execution '${operationReference}' not found.`);
12752
+ lastError = null;
12753
+ functionStatus = functionExecutionStatusToString(execution.status);
12754
+ if (isFunctionExecutionTerminalStatus(execution.status)) {
12755
+ const coloredFnStatus = colorizeFunctionExecutionStatus(functionStatus);
12756
+ if (execution.status === FunctionExecution_Status.SUCCESS) sp?.succeed(`Function execution completed: ${coloredFnStatus}`);
12757
+ else sp?.fail(`Function execution completed: ${coloredFnStatus}`);
12758
+ return withWaitMetadata({
12759
+ job: jobDetail,
12760
+ targetType: targetTypeStr,
12761
+ functionExecutionId: operationReference,
12762
+ functionStatus,
12763
+ functionLogs: options.logs ? execution.logs || void 0 : void 0
12764
+ }, false);
12765
+ }
12766
+ } catch (error) {
12767
+ if (!isRetryableWaitError(error)) throw error;
12768
+ lastError = formatWaitError(error);
12769
+ if (sp) sp.text = `Retrying function execution poll... (${formatTime(/* @__PURE__ */ new Date())})`;
12770
+ }
12771
+ const nextFunctionTimeout = remainingTimeout();
12772
+ if (nextFunctionTimeout !== void 0 && nextFunctionTimeout <= 0) {
12773
+ sp?.fail("Function execution wait timed out.");
12774
+ return withWaitMetadata({
12775
+ job: jobDetail,
12776
+ targetType: targetTypeStr,
12777
+ functionExecutionId: operationReference,
12778
+ functionStatus
12779
+ }, true);
12387
12780
  }
12388
- sp.text = `Waiting for function execution... (${formatTime(/* @__PURE__ */ new Date())})`;
12389
- await setTimeout$1(interval);
12781
+ if (sp) sp.text = `Waiting for function execution... (${formatTime(/* @__PURE__ */ new Date())})`;
12782
+ await setTimeout$1(nextFunctionTimeout === void 0 ? interval : Math.min(interval, nextFunctionTimeout));
12390
12783
  }
12391
12784
  } catch (error) {
12392
- sp.warn(`Could not track function execution: ${error instanceof Error ? error.message : error}`);
12393
- return {
12785
+ sp?.warn(`Could not track function execution: ${error instanceof Error ? error.message : error}`);
12786
+ return withWaitMetadata({
12394
12787
  job: jobDetail,
12395
12788
  targetType: targetTypeStr,
12396
12789
  functionExecutionId: operationReference
12397
- };
12790
+ }, false);
12398
12791
  }
12399
12792
  break;
12400
12793
  default: break;
12401
12794
  }
12402
- return {
12795
+ return withWaitMetadata({
12403
12796
  job: jobDetail,
12404
12797
  targetType: targetTypeStr
12405
- };
12798
+ }, false);
12406
12799
  } finally {
12407
- sp.stop();
12800
+ sp?.stop();
12408
12801
  }
12409
12802
  }
12803
+ /**
12804
+ * Build a user-facing failure message for an executor job wait result.
12805
+ * @param result - Executor job wait result
12806
+ * @returns Failure message, or undefined when the wait succeeded
12807
+ */
12808
+ function getExecutorWaitFailureMessage(result) {
12809
+ if (result.timedOut) return `Timed out waiting for executor job '${result.job.id}'. Last status: ${result.job.status}.`;
12810
+ if (result.job.status === "FAILED" || result.job.status === "CANCELED") return `Executor job '${result.job.id}' completed with status ${result.job.status}.`;
12811
+ if (result.workflowStatus === "FAILED") return `Workflow execution '${result.workflowExecutionId}' failed.`;
12812
+ if (result.functionStatus === "FAILED") return `Function execution '${result.functionExecutionId}' failed.`;
12813
+ }
12410
12814
  function printJobWithAttempts(job) {
12411
12815
  const summaryData = [
12412
12816
  ["id", job.id],
@@ -12488,6 +12892,10 @@ const jobsCommand = defineAppCommand({
12488
12892
  alias: "i",
12489
12893
  description: "Polling interval when using --wait (e.g., '3s', '500ms', '1m')"
12490
12894
  }),
12895
+ timeout: arg(durationArg.default("5m"), {
12896
+ alias: "t",
12897
+ description: "Maximum time to wait when using --wait (e.g., '30s', '5m')"
12898
+ }),
12491
12899
  ...pagedLogArgs,
12492
12900
  limit: arg(nonNegativeIntArg.default(50), { description: "Maximum number of jobs to list (0: unlimited, default: 50) (list mode only)" }),
12493
12901
  logs: arg(z.boolean().default(false), {
@@ -12496,6 +12904,7 @@ const jobsCommand = defineAppCommand({
12496
12904
  })
12497
12905
  }).strict(),
12498
12906
  run: async (args) => {
12907
+ const jsonOutput = logger.jsonMode || args.json;
12499
12908
  if (args.jobId) {
12500
12909
  if (args.wait) {
12501
12910
  const result = await watchExecutorJob({
@@ -12504,9 +12913,11 @@ const jobsCommand = defineAppCommand({
12504
12913
  workspaceId: args["workspace-id"],
12505
12914
  profile: args.profile,
12506
12915
  interval: parseDuration(args.interval),
12507
- logs: args.logs
12916
+ timeout: parseDuration(args.timeout),
12917
+ logs: args.logs,
12918
+ showProgress: !jsonOutput
12508
12919
  });
12509
- if (!args.json) {
12920
+ if (!jsonOutput) {
12510
12921
  logger.log(styles.bold(`Target Type: ${result.targetType}\n`));
12511
12922
  printJobWithAttempts(result.job);
12512
12923
  if (result.workflowExecutionId) {
@@ -12541,6 +12952,8 @@ const jobsCommand = defineAppCommand({
12541
12952
  }
12542
12953
  }
12543
12954
  } else logger.out(result);
12955
+ const failureMessage = getExecutorWaitFailureMessage(result);
12956
+ if (failureMessage) throw new Error(failureMessage);
12544
12957
  return;
12545
12958
  }
12546
12959
  const job = await getExecutorJob({
@@ -12550,7 +12963,7 @@ const jobsCommand = defineAppCommand({
12550
12963
  workspaceId: args["workspace-id"],
12551
12964
  profile: args.profile
12552
12965
  });
12553
- if (args.attempts && !args.json) printJobWithAttempts(job);
12966
+ if (args.attempts && !jsonOutput) printJobWithAttempts(job);
12554
12967
  else logger.out(job);
12555
12968
  } else {
12556
12969
  if (args.wait) logger.warn("--wait flag is ignored in list mode. Specify a job ID to wait.");
@@ -12737,12 +13150,17 @@ The \`--logs\` option displays logs from the downstream execution when available
12737
13150
  alias: "i",
12738
13151
  description: "Polling interval when using --wait (e.g., '3s', '500ms', '1m')"
12739
13152
  }),
13153
+ timeout: arg(durationArg.default("5m"), {
13154
+ alias: "t",
13155
+ description: "Maximum time to wait when using --wait (e.g., '30s', '5m')"
13156
+ }),
12740
13157
  logs: arg(z.boolean().default(false), {
12741
13158
  alias: "l",
12742
13159
  description: "Display function execution logs after completion (requires --wait)"
12743
13160
  })
12744
13161
  }).strict(),
12745
13162
  run: async (args) => {
13163
+ const jsonOutput = logger.jsonMode || args.json;
12746
13164
  await assertWritable({ profile: args.profile });
12747
13165
  const client = await initOperatorClient(await loadAccessToken({ profile: args.profile }));
12748
13166
  const workspaceId = await loadWorkspaceId({
@@ -12783,9 +13201,11 @@ The \`--logs\` option displays logs from the downstream execution when available
12783
13201
  workspaceId: args["workspace-id"],
12784
13202
  profile: args.profile,
12785
13203
  interval: parseDuration(args.interval),
12786
- logs: args.logs
13204
+ timeout: parseDuration(args.timeout),
13205
+ logs: args.logs,
13206
+ showProgress: !jsonOutput
12787
13207
  });
12788
- if (!args.json) {
13208
+ if (!jsonOutput) {
12789
13209
  logger.log(styles.bold(`\nTarget Type: ${watchResult.targetType}`));
12790
13210
  logger.log(`Job Status: ${watchResult.job.status}`);
12791
13211
  if (watchResult.workflowExecutionId) {
@@ -12820,6 +13240,8 @@ The \`--logs\` option displays logs from the downstream execution when available
12820
13240
  }
12821
13241
  }
12822
13242
  } else logger.out(watchResult);
13243
+ const failureMessage = getExecutorWaitFailureMessage(watchResult);
13244
+ if (failureMessage) throw new Error(failureMessage);
12823
13245
  }
12824
13246
  }
12825
13247
  });
@@ -15049,6 +15471,11 @@ function generateEnumChangeColumnType(enumValueChange, config) {
15049
15471
  if (!config.required) return `ColumnType<(${selectType}) | null, (${afterType}) | null, (${afterType}) | null>`;
15050
15472
  return `ColumnType<${selectType}, ${afterType}, ${afterType}>`;
15051
15473
  }
15474
+ function generateOptionalToRequiredDateColumnType(config) {
15475
+ if (config.type !== "date" && config.type !== "datetime") return null;
15476
+ if (config.array) return "ColumnType<Date[] | null, (Date | string)[], (Date | string)[]>";
15477
+ return "ColumnType<Date | null, Date | string, Date | string>";
15478
+ }
15052
15479
  /**
15053
15480
  * Generate field type from snapshot field config
15054
15481
  * @param {SnapshotFieldConfig} config - Field configuration
@@ -15074,11 +15501,19 @@ function generateFieldType(config, isOptionalToRequired, enumValueChange) {
15074
15501
  }
15075
15502
  let type = baseType;
15076
15503
  if (config.array) type = config.type === "enum" && config.allowedValues && config.allowedValues.length > 0 ? `(${baseType})[]` : `${baseType}[]`;
15077
- if (isOptionalToRequired) return {
15078
- type: `ColumnType<${type} | null, ${type}, ${type}>`,
15079
- usedTimestamp,
15080
- usedColumnType: true
15081
- };
15504
+ if (isOptionalToRequired) {
15505
+ const dateColumnType = generateOptionalToRequiredDateColumnType(config);
15506
+ if (dateColumnType) return {
15507
+ type: dateColumnType,
15508
+ usedTimestamp: false,
15509
+ usedColumnType: true
15510
+ };
15511
+ return {
15512
+ type: `ColumnType<${type} | null, ${type}, ${type}>`,
15513
+ usedTimestamp,
15514
+ usedColumnType: true
15515
+ };
15516
+ }
15082
15517
  if (!config.required) type = `${type} | null`;
15083
15518
  return {
15084
15519
  type,
@@ -15369,7 +15804,7 @@ async function generate(options) {
15369
15804
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
15370
15805
  let pluginManager;
15371
15806
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
15372
- const { defineApplication } = await import("./application-DB2r36Et.mjs");
15807
+ const { defineApplication } = await import("./application-Dtqap5jM.mjs");
15373
15808
  const application = defineApplication({
15374
15809
  config,
15375
15810
  pluginManager
@@ -15802,11 +16237,13 @@ async function resumeWorkflow(options) {
15802
16237
  });
15803
16238
  return {
15804
16239
  executionId,
15805
- wait: (waitOptions) => waitForExecution({
16240
+ wait: (waitOptions) => waitForWorkflowExecution({
15806
16241
  client,
15807
16242
  workspaceId,
15808
16243
  executionId,
15809
16244
  interval: options.interval ?? 3e3,
16245
+ timeout: waitOptions?.timeout,
16246
+ until: waitOptions?.until,
15810
16247
  showProgress: waitOptions?.showProgress
15811
16248
  })
15812
16249
  };
@@ -15830,16 +16267,21 @@ const resumeCommand = defineAppCommand({
15830
16267
  ...waitArgs
15831
16268
  }).strict(),
15832
16269
  run: async (args) => {
16270
+ const jsonOutput = logger.jsonMode || args.json;
15833
16271
  const { executionId, wait } = await resumeWorkflow({
15834
16272
  executionId: args.executionId,
15835
16273
  workspaceId: args["workspace-id"],
15836
16274
  profile: args.profile,
15837
16275
  interval: parseDuration(args.interval)
15838
16276
  });
15839
- if (!args.json) logger.info(`Execution ID: ${executionId}`, { mode: "stream" });
16277
+ if (!jsonOutput) logger.info(`Execution ID: ${executionId}`, { mode: "stream" });
15840
16278
  if (args.wait) {
15841
- const result = await wait({ showProgress: !args.json });
15842
- if (args.logs && !args.json) {
16279
+ const result = await wait({
16280
+ showProgress: !jsonOutput,
16281
+ timeout: parseDuration(args.timeout),
16282
+ until: args.until
16283
+ });
16284
+ if (args.logs && !jsonOutput) {
15843
16285
  const { execution } = await getWorkflowExecution({
15844
16286
  executionId,
15845
16287
  workspaceId: args["workspace-id"],
@@ -15847,11 +16289,112 @@ const resumeCommand = defineAppCommand({
15847
16289
  logs: true
15848
16290
  });
15849
16291
  printExecutionWithLogs(execution);
16292
+ } else if (args.logs) {
16293
+ const { execution } = await getWorkflowExecution({
16294
+ executionId,
16295
+ workspaceId: args["workspace-id"],
16296
+ profile: args.profile,
16297
+ logs: true
16298
+ });
16299
+ logger.out({
16300
+ ...result,
16301
+ jobDetails: execution.jobDetails
16302
+ });
15850
16303
  } else logger.out(result);
16304
+ const failureMessage = getWorkflowWaitFailureMessage(result, args.until);
16305
+ if (failureMessage) throw new Error(failureMessage);
15851
16306
  } else logger.out({ executionId });
15852
16307
  }
15853
16308
  });
15854
16309
 
16310
+ //#endregion
16311
+ //#region src/cli/commands/workflow/wait.ts
16312
+ /**
16313
+ * Wait for an existing workflow execution by ID.
16314
+ * @param options - Workflow wait options
16315
+ * @returns Workflow wait result
16316
+ */
16317
+ async function waitWorkflowExecution(options) {
16318
+ return await waitForWorkflowExecutionById({
16319
+ ...options,
16320
+ showProgress: options.showProgress ?? !logger.jsonMode,
16321
+ trackJobs: options.trackJobs ?? true
16322
+ });
16323
+ }
16324
+ /**
16325
+ * Attach workflow job logs to a wait result when requested.
16326
+ * @param result - Workflow wait result
16327
+ * @param options - Workflow wait options
16328
+ * @returns Workflow wait result with optional job details
16329
+ */
16330
+ async function addWorkflowLogsToWaitResult(result, options) {
16331
+ const { execution } = await getWorkflowExecution({
16332
+ executionId: options.executionId,
16333
+ workspaceId: options.workspaceId,
16334
+ profile: options.profile,
16335
+ logs: true
16336
+ });
16337
+ return {
16338
+ ...result,
16339
+ jobDetails: execution.jobDetails
16340
+ };
16341
+ }
16342
+ const waitCommand = defineAppCommand({
16343
+ name: "wait",
16344
+ description: "Wait for a workflow execution.",
16345
+ examples: [
16346
+ {
16347
+ cmd: "execution-id --until success --timeout 10m --json",
16348
+ desc: "Wait for workflow success"
16349
+ },
16350
+ {
16351
+ cmd: "execution-id --until suspended --timeout 6m --logs --json",
16352
+ desc: "Wait for a workflow wait point"
16353
+ },
16354
+ {
16355
+ cmd: "execution-id --until terminal",
16356
+ desc: "Wait for success, failure, or suspension"
16357
+ }
16358
+ ],
16359
+ args: z.object({
16360
+ ...workspaceArgs,
16361
+ "execution-id": arg(z.string(), {
16362
+ positional: true,
16363
+ description: "Execution ID"
16364
+ }),
16365
+ ...workflowWaitControlArgs
16366
+ }).strict(),
16367
+ run: async (args) => {
16368
+ const jsonOutput = logger.jsonMode || args.json;
16369
+ const result = await waitWorkflowExecution({
16370
+ executionId: args.executionId,
16371
+ workspaceId: args["workspace-id"],
16372
+ profile: args.profile,
16373
+ interval: parseDuration(args.interval),
16374
+ timeout: parseDuration(args.timeout),
16375
+ until: args.until,
16376
+ showProgress: !jsonOutput
16377
+ });
16378
+ const output = args.logs ? await addWorkflowLogsToWaitResult(result, {
16379
+ executionId: args.executionId,
16380
+ workspaceId: args["workspace-id"],
16381
+ profile: args.profile
16382
+ }) : result;
16383
+ if (!jsonOutput && output.jobDetails) printExecutionWithLogs({
16384
+ id: output.id,
16385
+ workflowName: output.workflowName,
16386
+ status: output.status,
16387
+ jobExecutions: output.jobExecutions,
16388
+ startedAt: output.startedAt,
16389
+ finishedAt: output.finishedAt,
16390
+ jobDetails: output.jobDetails
16391
+ });
16392
+ else logger.out(output);
16393
+ const failureMessage = getWorkflowWaitFailureMessage(result, args.until);
16394
+ if (failureMessage) throw new Error(failureMessage);
16395
+ }
16396
+ });
16397
+
15855
16398
  //#endregion
15856
16399
  //#region src/cli/commands/workspace/app/transform.ts
15857
16400
  const statusToString = (status) => {
@@ -17015,10 +17558,10 @@ async function sqlQuery(client, invoker, args) {
17015
17558
  workspaceId: args.workspaceId,
17016
17559
  name: `query-sql-${args.namespace}.js`,
17017
17560
  code: args.bundledCode,
17018
- arg: JSON.stringify({
17561
+ arg: {
17019
17562
  namespace: args.namespace,
17020
17563
  queries
17021
- }),
17564
+ },
17022
17565
  invoker
17023
17566
  });
17024
17567
  if (!executed.success) throw new Error(executed.error);
@@ -17036,11 +17579,11 @@ async function gqlQuery(client, invoker, application, machineUser, args) {
17036
17579
  workspaceId: args.workspaceId,
17037
17580
  name: `query-gql.js`,
17038
17581
  code: args.bundledCode,
17039
- arg: JSON.stringify({
17582
+ arg: {
17040
17583
  endpoint: `${application.url}/query`,
17041
17584
  accessToken,
17042
17585
  query: args.query
17043
- }),
17586
+ },
17044
17587
  invoker
17045
17588
  });
17046
17589
  if (!executed.success) throw new Error(executed.error);
@@ -17528,5 +18071,5 @@ function isDeno() {
17528
18071
  }
17529
18072
 
17530
18073
  //#endregion
17531
- export { listCommand$5 as $, INITIAL_SCHEMA_NUMBER as $t, truncate as A, commonArgs as An, startCommand as At, logBetaWarning as B, getExecutor as Bt, listCommand$2 as C, PluginManager as Cn, triggerExecutor as Ct, resumeWorkflow as D, apiCall as Dn, jobsCommand as Dt, resumeCommand as E, apiCommand as En, getExecutorJob as Et, writeDbTypesFile as F, pagedLogArgs as Fn, getWorkflowExecution as Ft, organizationTree as G, MIGRATION_LABEL_KEY as Gt, removeCommand$1 as H, executeScript as Ht, getConfiguredEditorCommand as I, paginationArgs as In, listWorkflowExecutions as It, listOrganizations as J, compareSnapshotWithRemote as Jt, treeCommand as K, handleOptionalToRequiredError as Kt, openInConfiguredEditor as L, toPageDirection as Ln, functionExecutionStatusToString as Lt, generate as M, confirmationArgs as Mn, getCommand$5 as Mt, generateCommand as N, deploymentArgs as Nn, getWorkflow as Nt, listCommand$3 as O, assertWritable as On, listExecutorJobs as Ot, generateMigrationScript as P, isVerbose as Pn, executionsCommand as Pt, updateFolder as Q, DIFF_FILE_NAME as Qt, show as R, workspaceArgs as Rn, formatKeyValueTable as Rt, listApps as S, sdkNameLabelKey as Sn, triggerCommand as St, healthCommand as T, prompt as Tn, listExecutors as Tt, updateCommand$1 as U, waitForExecution$1 as Ut, remove as V, deploy as Vt, updateOrganization as W, bundleMigrationScript as Wt, getOrganization as X, protoGqlPermission as Xt, getCommand$1 as Y, generateAllTypeManifestsFromSnapshot as Yt, updateCommand$2 as Z, DB_TYPES_FILE_NAME as Zt, getWorkspace as _, formatMigrationDiff as _n, listFunctionRegistries as _t, updateUser as a, createSnapshotFromLocalTypes as an, createCommand$1 as at, createCommand as b, ensureConfigId as bn, listWebhookExecutors as bt, listCommand as c, getMigrationFilePath as cn, listOAuth2Clients as ct, inviteUser as d, isValidMigrationNumber as dn, getMachineUserToken as dt, MIGRATE_FILE_NAME as en, listFolders as et, restoreCommand as f, loadDiff as fn, tokenCommand as ft, getCommand as g, formatDiffSummary as gn, listCommand$8 as gt, listWorkspaces as h, parseMigrationNumberArg as hn, generate$1 as ht, updateCommand as i, compareSnapshots as in, deleteFolder as it, truncateCommand as j, configArg as jn, startWorkflow as jt, listWorkflows as k, defineAppCommand as kn, watchExecutorJob as kt, listUsers as l, getMigrationFiles as ln, getCommand$3 as lt, listCommand$1 as m, formatMigrationNumber as mn, listMachineUsers as mt, query as n, assertValidMigrationFiles as nn, getFolder as nt, removeCommand as o, getLatestMigrationNumber as on, createFolder as ot, restoreWorkspace as p, reconstructSnapshotFromMigrations as pn, listCommand$7 as pt, listCommand$4 as q, parseMigrationLabelNumber as qt, queryCommand as r, compareLocalTypesWithSnapshot as rn, deleteCommand$1 as rt, removeUser as s, getMigrationDirPath as sn, listCommand$6 as st, isNativeTypeScriptRuntime as t, SCHEMA_FILE_NAME as tn, getCommand$2 as tt, inviteCommand as u, getNextMigrationNumber as un, getOAuth2Client as ut, deleteCommand as v, hasChanges as vn, getCommand$4 as vt, getAppHealth as w, generateUserTypes as wn, listCommand$9 as wt, createWorkspace as x, resourceTrn as xn, webhookCommand as xt, deleteWorkspace as y, getNamespacesWithMigrations as yn, getFunctionRegistry as yt, showCommand as z, getCommand$6 as zt };
17532
- //# sourceMappingURL=runtime-n9NCkjee.mjs.map
18074
+ export { updateCommand$2 as $, protoGqlPermission as $t, listCommand$3 as A, apiCall as An, jobsCommand as At, show as B, toPageDirection as Bn, functionExecutionStatusToString as Bt, listCommand$2 as C, ensureConfigId as Cn, webhookCommand as Ct, waitWorkflowExecution as D, generateUserTypes as Dn, listExecutors as Dt, waitCommand as E, PluginManager as En, listCommand$9 as Et, generateCommand as F, confirmationArgs as Fn, getCommand$5 as Ft, updateCommand$1 as G, executeScript as Gt, logBetaWarning as H, getCommand$6 as Ht, generateMigrationScript as I, deploymentArgs as In, getWorkflow as It, treeCommand as J, MIGRATION_LABEL_KEY as Jt, updateOrganization as K, waitForExecution as Kt, writeDbTypesFile as L, isVerbose as Ln, executionsCommand as Lt, truncate as M, defineAppCommand as Mn, watchExecutorJob as Mt, truncateCommand as N, commonArgs as Nn, startCommand as Nt, resumeCommand as O, prompt as On, getExecutorJob as Ot, generate as P, configArg as Pn, startWorkflow as Pt, getOrganization as Q, generateAllTypeManifestsFromSnapshot as Qt, getConfiguredEditorCommand as R, pagedLogArgs as Rn, getWorkflowExecution as Rt, listApps as S, getNamespacesWithMigrations as Sn, listWebhookExecutors as St, healthCommand as T, sdkNameLabelKey as Tn, triggerExecutor as Tt, remove as U, getExecutor as Ut, showCommand as V, workspaceArgs as Vn, formatKeyValueTable as Vt, removeCommand$1 as W, deploy as Wt, listOrganizations as X, parseMigrationLabelNumber as Xt, listCommand$4 as Y, handleOptionalToRequiredError as Yt, getCommand$1 as Z, compareSnapshotWithRemote as Zt, getWorkspace as _, formatMigrationNumber as _n, generate$1 as _t, updateUser as a, assertValidMigrationFiles as an, deleteCommand$1 as at, createCommand as b, formatMigrationDiff as bn, getCommand$4 as bt, listCommand as c, createSnapshotFromLocalTypes as cn, createFolder as ct, inviteUser as d, getMigrationFilePath as dn, getCommand$3 as dt, DB_TYPES_FILE_NAME as en, updateFolder as et, restoreCommand as f, getMigrationFiles as fn, getOAuth2Client as ft, getCommand as g, reconstructSnapshotFromMigrations as gn, listMachineUsers as gt, listWorkspaces as h, loadDiff as hn, listCommand$7 as ht, updateCommand as i, SCHEMA_FILE_NAME as in, getFolder as it, listWorkflows as j, assertWritable as jn, listExecutorJobs as jt, resumeWorkflow as k, apiCommand as kn, getExecutorWaitFailureMessage as kt, listUsers as l, getLatestMigrationNumber as ln, listCommand$6 as lt, listCommand$1 as m, isValidMigrationNumber as mn, tokenCommand as mt, query as n, INITIAL_SCHEMA_NUMBER as nn, listFolders as nt, removeCommand as o, compareLocalTypesWithSnapshot as on, deleteFolder as ot, restoreWorkspace as p, getNextMigrationNumber as pn, getMachineUserToken as pt, organizationTree as q, bundleMigrationScript as qt, queryCommand as r, MIGRATE_FILE_NAME as rn, getCommand$2 as rt, removeUser as s, compareSnapshots as sn, createCommand$1 as st, isNativeTypeScriptRuntime as t, DIFF_FILE_NAME as tn, listCommand$5 as tt, inviteCommand as u, getMigrationDirPath as un, listOAuth2Clients as ut, deleteCommand as v, parseMigrationNumberArg as vn, listCommand$8 as vt, getAppHealth as w, resourceTrn as wn, triggerCommand as wt, createWorkspace as x, hasChanges as xn, getFunctionRegistry as xt, deleteWorkspace as y, formatDiffSummary as yn, listFunctionRegistries as yt, openInConfiguredEditor as z, paginationArgs as zn, listWorkflowExecutions as zt };
18075
+ //# sourceMappingURL=runtime-CY4JvrDj.mjs.map