@tailor-platform/sdk 2.0.0-next.0 → 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.
- package/CHANGELOG.md +161 -0
- package/dist/application-Dtqap5jM.mjs +3 -0
- package/dist/{client-CobIRHl-.mjs → application-XuMWK4eq.mjs} +5869 -25
- package/dist/application-XuMWK4eq.mjs.map +1 -0
- package/dist/{assert-CKfwrmCV.mjs → assert-DBxo8jPo.mjs} +1 -2
- package/dist/{assert-CKfwrmCV.mjs.map → assert-DBxo8jPo.mjs.map} +1 -1
- package/dist/{authconnection-D8SJGMpj.mjs → authconnection-D2MhtTN5.mjs} +2 -3
- package/dist/{authconnection-D8SJGMpj.mjs.map → authconnection-D2MhtTN5.mjs.map} +1 -1
- package/dist/{authconnection-BIYzEh2p.d.mts → authconnection-DvUQAjQS.d.mts} +1 -1
- package/dist/{brand-DlnJ375c.mjs → brand-Eo4pLXPJ.mjs} +1 -2
- package/dist/{brand-DlnJ375c.mjs.map → brand-Eo4pLXPJ.mjs.map} +1 -1
- package/dist/cli/index.mjs +241 -237
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +547 -620
- package/dist/cli/lib.mjs +9 -11
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +4108 -0
- package/dist/configure/index.d.mts +9 -7
- package/dist/configure/index.mjs +76 -40
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{context-s0lxhu8_.mjs → context-Bd266-ru.mjs} +2 -3
- package/dist/context-Bd266-ru.mjs.map +1 -0
- package/dist/{context-CUBwSBq4.d.mts → context-C2lEi9uw.d.mts} +7 -28
- package/dist/{crashreport-D1wKBJ8N.mjs → crashreport-BMWcxeSE.mjs} +1 -2
- package/dist/{crashreport-BhD0y14F.mjs → crashreport-DFq-vsU0.mjs} +21 -14
- package/dist/{crashreport-BhD0y14F.mjs.map → crashreport-DFq-vsU0.mjs.map} +1 -1
- package/dist/{enum-constants-C7DaWeQo.mjs → enum-constants-j9QBF0cB.mjs} +1 -2
- package/dist/enum-constants-j9QBF0cB.mjs.map +1 -0
- package/dist/{errors-EsY4XO6O.mjs → errors-Dtf2WPaW.mjs} +1 -2
- package/dist/{errors-EsY4XO6O.mjs.map → errors-Dtf2WPaW.mjs.map} +1 -1
- package/dist/{field-C4zdJLW5.mjs → field-DOsJCPFa.mjs} +1 -2
- package/dist/field-DOsJCPFa.mjs.map +1 -0
- package/dist/{file-B58Dm-2P.mjs → file-BbdFGdMV.mjs} +3 -12
- package/dist/file-BbdFGdMV.mjs.map +1 -0
- package/dist/{file-BzK8z3X-.d.mts → file-Dq3NIt_F.d.mts} +3 -42
- package/dist/{file-utils-BHPxPXmn.mjs → file-utils-CYZnO1pX.mjs} +6 -7
- package/dist/file-utils-CYZnO1pX.mjs.map +1 -0
- package/dist/{globals-ByrCoDip.mjs → globals-Cf0sxIt8.mjs} +53 -5
- package/dist/globals-Cf0sxIt8.mjs.map +1 -0
- package/dist/http-adapter.generated-DFsXDdm5.d.mts +581 -0
- package/dist/{iconv-kwrmd1U_.d.mts → iconv-Co-TOPuH.d.mts} +1 -1
- package/dist/{iconv-DreIffeM.mjs → iconv-D2vi8G36.mjs} +2 -3
- package/dist/{iconv-DreIffeM.mjs.map → iconv-D2vi8G36.mjs.map} +1 -1
- package/dist/{idp-Ch95ag8h.mjs → idp-BDbK5gjm.mjs} +2 -3
- package/dist/{idp-Ch95ag8h.mjs.map → idp-BDbK5gjm.mjs.map} +1 -1
- package/dist/{idp-BlBPtXJ-.d.mts → idp-DrhVrLmV.d.mts} +1 -1
- package/dist/{index-CLxubakC.d.mts → index-BI-_j9Z3.d.mts} +49 -261
- package/dist/{index-CPRnOjjt.d.mts → index-C4JirJH8.d.mts} +2 -2
- package/dist/{index-CQZVJ5SX.d.mts → index-CZfWhr0a.d.mts} +2 -2
- package/dist/{index-DRhMpdnA.d.mts → index-Cg8VKAdN.d.mts} +8 -8
- package/dist/{index-CfRFkXIO.d.mts → index-DYRjoLXD.d.mts} +2 -2
- package/dist/index-lFpcjHPU.d.mts +201 -0
- package/dist/{index-DUupuPhZ.d.mts → index-nW7hE6oE.d.mts} +2 -2
- package/dist/{interceptor-DOqRkCya.mjs → interceptor-D-q1rvRl.mjs} +1 -2
- package/dist/{interceptor-DOqRkCya.mjs.map → interceptor-D-q1rvRl.mjs.map} +1 -1
- package/dist/kysely/index.mjs +0 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-D1e0Vwkd.mjs → kysely-type-DR8uzZTA.mjs} +2 -3
- package/dist/kysely-type-DR8uzZTA.mjs.map +1 -0
- package/dist/{logger-DpJyJvNz.mjs → logger-CxF-Ex5d.mjs} +1 -2
- package/dist/{logger-DpJyJvNz.mjs.map → logger-CxF-Ex5d.mjs.map} +1 -1
- package/dist/{mock-DMgIygjE.mjs → mock-FPxmnt-y.mjs} +9 -56
- package/dist/mock-FPxmnt-y.mjs.map +1 -0
- package/dist/{multiline-Cf9ODpr1.mjs → multiline-sfHpTZZK.mjs} +1 -2
- package/dist/{multiline-Cf9ODpr1.mjs.map → multiline-sfHpTZZK.mjs.map} +1 -1
- package/dist/{package-json-DcQApfPQ.mjs → package-json-8b0O9TlX.mjs} +1 -2
- package/dist/{package-json-DcQApfPQ.mjs.map → package-json-8b0O9TlX.mjs.map} +1 -1
- package/dist/package-json-Cv2Z-TqQ.mjs +3 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -2
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -2
- package/dist/plugin/index.d.mts +4 -5
- package/dist/plugin/index.mjs +0 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/registry-DH4m7eYo.mjs +53 -0
- package/dist/registry-DH4m7eYo.mjs.map +1 -0
- package/dist/{repl-editor-CJG3sz7A.mjs → repl-editor-DmGr9zMw.mjs} +2 -3
- package/dist/{repl-editor-CJG3sz7A.mjs.map → repl-editor-DmGr9zMw.mjs.map} +1 -1
- package/dist/{chunk-BkoGK1jX.mjs → rolldown-runtime-DXywRVcq.mjs} +0 -1
- package/dist/runtime/authconnection.d.mts +1 -1
- package/dist/runtime/authconnection.mjs +1 -2
- package/dist/runtime/context.d.mts +1 -1
- package/dist/runtime/context.mjs +1 -2
- package/dist/runtime/file.d.mts +2 -2
- package/dist/runtime/file.mjs +2 -3
- package/dist/runtime/globals.d.mts +8 -41
- package/dist/runtime/globals.mjs +0 -1
- package/dist/runtime/iconv.d.mts +1 -1
- package/dist/runtime/iconv.mjs +1 -2
- package/dist/runtime/idp.d.mts +1 -1
- package/dist/runtime/idp.mjs +1 -2
- package/dist/runtime/index.d.mts +8 -8
- package/dist/runtime/index.mjs +7 -8
- package/dist/runtime/secretmanager.d.mts +1 -1
- package/dist/runtime/secretmanager.mjs +1 -2
- package/dist/runtime/workflow.d.mts +2 -2
- package/dist/runtime/workflow.mjs +1 -2
- package/dist/{runtime-C7qTBDD2.mjs → runtime-CY4JvrDj.mjs} +1069 -542
- package/dist/runtime-CY4JvrDj.mjs.map +1 -0
- package/dist/{schema-1msIhXwA.mjs → schema-Dtw9Orye.mjs} +18 -16
- package/dist/schema-Dtw9Orye.mjs.map +1 -0
- package/dist/{secret-file-CWzF8rry.mjs → secret-file-VSVGy1V0.mjs} +27 -3
- package/dist/{secret-file-CWzF8rry.mjs.map → secret-file-VSVGy1V0.mjs.map} +1 -1
- package/dist/{secretmanager-CKLB3wAQ.d.mts → secretmanager-B3n4KHfm.d.mts} +1 -1
- package/dist/{secretmanager-B9h-U_8U.mjs → secretmanager-BVxw3ih_.mjs} +2 -3
- package/dist/{secretmanager-B9h-U_8U.mjs.map → secretmanager-BVxw3ih_.mjs.map} +1 -1
- package/dist/seed/index.mjs +0 -1
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{seed-BH2FbrPV.mjs → seed-izIEyP3z.mjs} +7 -19
- package/dist/seed-izIEyP3z.mjs.map +1 -0
- package/dist/service-DCqIWibD.mjs +3 -0
- package/dist/{service-DMohAx8a2.mjs → service-DU1mVzri2.mjs} +3 -4
- package/dist/{service-DMohAx8a2.mjs.map → service-DU1mVzri2.mjs.map} +1 -1
- package/dist/{service-wI3Hvrgx.mjs → service-DjyqbCaJ.mjs} +9 -10
- package/dist/service-DjyqbCaJ.mjs.map +1 -0
- package/dist/{telemetry-BQbbVo2t.mjs → telemetry-CdqJEzkj.mjs} +2 -3
- package/dist/{telemetry-BQbbVo2t.mjs.map → telemetry-CdqJEzkj.mjs.map} +1 -1
- package/dist/telemetry-ClwW5ohF.mjs +3 -0
- package/dist/test-env-key-D7UkZp99.mjs +75 -0
- package/dist/test-env-key-D7UkZp99.mjs.map +1 -0
- package/dist/type-source-DH_LH20p.mjs +13 -0
- package/dist/type-source-DH_LH20p.mjs.map +1 -0
- package/dist/types-74etvaxy.mjs +4 -0
- package/dist/{plugin-C_FyVSdl.d.mts → types-BDRml5C3.d.mts} +128 -188
- package/dist/{types-CmzfQP_m.mjs → types-BQijbo4m.mjs} +10 -11
- package/dist/types-BQijbo4m.mjs.map +1 -0
- package/dist/types-BX4q6Mo6.d.mts +339 -0
- package/dist/types-BZ7QKVE8.d.mts +21 -0
- package/dist/{tailordb-BlBGmQK-.d.mts → types-CdcQh4Z2.d.mts} +92 -242
- package/dist/utils/test/index.d.mts +6 -14
- package/dist/utils/test/index.mjs +4 -14
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -2
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +42 -5
- package/dist/vitest/index.mjs +133 -4
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/setup.mjs +2 -3
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/{workflow--aPbA8Uq.mjs → workflow-BOmaZwwG.mjs} +9 -5
- package/dist/workflow-BOmaZwwG.mjs.map +1 -0
- package/dist/{workflow-CMamswkK.d.mts → workflow-BVy4XWjS.d.mts} +15 -10
- package/dist/workflow.generated-ClEjBYhm.d.mts +671 -0
- package/docs/cli/application.md +0 -2
- package/docs/cli/completion.md +3 -0
- package/docs/cli/crashreport.md +0 -2
- package/docs/cli/executor.md +53 -0
- package/docs/cli/function.md +1 -1
- package/docs/cli/setup.md +35 -33
- package/docs/cli/user.md +3 -3
- package/docs/cli/workflow.md +157 -20
- package/docs/cli/workspace.md +3 -3
- package/docs/cli-reference.md +26 -20
- package/docs/configuration.md +0 -2
- package/docs/github-actions.md +29 -16
- package/docs/migration/v2.md +475 -0
- package/docs/plugin/custom.md +2 -2
- package/docs/plugin/index.md +1 -1
- package/docs/runtime.md +4 -4
- package/docs/services/aigateway.md +97 -0
- package/docs/services/auth.md +31 -14
- package/docs/services/executor.md +3 -5
- package/docs/services/resolver.md +8 -10
- package/docs/services/tailordb.md +15 -13
- package/docs/services/workflow.md +17 -19
- package/docs/testing.md +75 -56
- package/package.json +18 -17
- package/dist/actor-J2gJ0eK5.d.mts +0 -24
- package/dist/application-76hhIhnJ.mjs +0 -5594
- package/dist/application-76hhIhnJ.mjs.map +0 -1
- package/dist/application-av2raLs6.mjs +0 -4
- package/dist/cli/skills.d.mts +0 -1
- package/dist/cli/skills.mjs +0 -22
- package/dist/cli/skills.mjs.map +0 -1
- package/dist/client-C68VWo4g.mjs +0 -4
- package/dist/client-CobIRHl-.mjs.map +0 -1
- package/dist/context-s0lxhu8_.mjs.map +0 -1
- package/dist/enum-constants-C7DaWeQo.mjs.map +0 -1
- package/dist/env-B-g-qgE4.d.mts +0 -7
- package/dist/field-C4zdJLW5.mjs.map +0 -1
- package/dist/file-B58Dm-2P.mjs.map +0 -1
- package/dist/file-utils-BHPxPXmn.mjs.map +0 -1
- package/dist/globals-ByrCoDip.mjs.map +0 -1
- package/dist/job-BpsFXPbi.mjs +0 -54
- package/dist/job-BpsFXPbi.mjs.map +0 -1
- package/dist/kysely-type-D1e0Vwkd.mjs.map +0 -1
- package/dist/mock-DMgIygjE.mjs.map +0 -1
- package/dist/package-json-wzO6nV9O.mjs +0 -4
- package/dist/registry-D0uB0OrK.mjs +0 -178
- package/dist/registry-D0uB0OrK.mjs.map +0 -1
- package/dist/runtime-C7qTBDD2.mjs.map +0 -1
- package/dist/schema-1msIhXwA.mjs.map +0 -1
- package/dist/seed-BH2FbrPV.mjs.map +0 -1
- package/dist/service-BHQIerYh.mjs +0 -4
- package/dist/service-wI3Hvrgx.mjs.map +0 -1
- package/dist/telemetry-w92bvGdC.mjs +0 -4
- package/dist/types-2Be3wSMc.mjs +0 -5
- package/dist/types-CmzfQP_m.mjs.map +0 -1
- package/dist/workflow--aPbA8Uq.mjs.map +0 -1
- package/dist/workflow.generated-Bf1tWylx.d.mts +0 -1416
- package/docs/generator/builtin.md +0 -257
- package/docs/generator/custom.md +0 -147
- package/docs/generator/index.md +0 -66
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import { r as withSpan } from "./telemetry-BQbbVo2t.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
|
+
import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
|
|
4
|
+
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-CxF-Ex5d.mjs";
|
|
5
|
+
import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-DjyqbCaJ.mjs";
|
|
6
|
+
import { t as multiline } from "./multiline-sfHpTZZK.mjs";
|
|
7
|
+
import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
|
|
8
|
+
import { i as userAgent } from "./secret-file-VSVGy1V0.mjs";
|
|
9
|
+
import { n as isCLIError, t as createCLIError } from "./errors-Dtf2WPaW.mjs";
|
|
10
|
+
import { r as withSpan } from "./telemetry-CdqJEzkj.mjs";
|
|
12
11
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
13
12
|
import { z } from "zod";
|
|
14
13
|
import { ScalarType, create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
@@ -24,6 +23,7 @@ import { tmpdir } from "node:os";
|
|
|
24
23
|
import { findUpSync } from "find-up-simple";
|
|
25
24
|
import { xdgConfig } from "xdg-basedir";
|
|
26
25
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
26
|
+
import pLimit from "p-limit";
|
|
27
27
|
import { resolveTSConfig } from "pkg-types";
|
|
28
28
|
import * as crypto$1 from "node:crypto";
|
|
29
29
|
import { createHash } from "node:crypto";
|
|
@@ -35,10 +35,10 @@ import * as fs from "node:fs/promises";
|
|
|
35
35
|
import { glob } from "node:fs/promises";
|
|
36
36
|
import { parseSync } from "oxc-parser";
|
|
37
37
|
import * as inflection from "inflection";
|
|
38
|
-
import pLimit from "p-limit";
|
|
39
38
|
import { pathToString } from "@bufbuild/protobuf/reflect";
|
|
40
39
|
import { createValidator } from "@bufbuild/protovalidate";
|
|
41
40
|
import { setTimeout as setTimeout$1 } from "timers/promises";
|
|
41
|
+
import { setTimeout as setTimeout$2 } from "node:timers/promises";
|
|
42
42
|
import { spawn } from "node:child_process";
|
|
43
43
|
import { watch } from "chokidar";
|
|
44
44
|
import * as madgeModule from "madge";
|
|
@@ -1103,7 +1103,7 @@ function extractAttributesFromConfig(config) {
|
|
|
1103
1103
|
* @param attributeMap - Attribute map configuration
|
|
1104
1104
|
* @param attributeList - Attribute list configuration
|
|
1105
1105
|
* @param env - Environment configuration
|
|
1106
|
-
* @param machineUserNames - Registered machine user names (used to narrow `
|
|
1106
|
+
* @param machineUserNames - Registered machine user names (used to narrow `invoker` strings)
|
|
1107
1107
|
* @param idpNames - Registered IdP names (used to narrow `idpUser*Trigger({ idp })` strings)
|
|
1108
1108
|
* @returns Generated type definition source
|
|
1109
1109
|
*/
|
|
@@ -1240,35 +1240,6 @@ async function generateUserTypes(options) {
|
|
|
1240
1240
|
}
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
|
-
//#endregion
|
|
1244
|
-
//#region src/types/plugin-generation.ts
|
|
1245
|
-
/**
|
|
1246
|
-
* Derives generation-time dependency set from hook presence on a plugin.
|
|
1247
|
-
* @param plugin - The plugin object to inspect.
|
|
1248
|
-
* @param plugin.onTailorDBReady - Hook for TailorDB readiness.
|
|
1249
|
-
* @param plugin.onResolverReady - Hook for resolver readiness.
|
|
1250
|
-
* @param plugin.onExecutorReady - Hook for executor readiness.
|
|
1251
|
-
* @returns Set of dependency kinds required by the plugin.
|
|
1252
|
-
*/
|
|
1253
|
-
function getPluginGenerationDependencies(plugin) {
|
|
1254
|
-
const deps = /* @__PURE__ */ new Set();
|
|
1255
|
-
if (plugin.onTailorDBReady) deps.add("tailordb");
|
|
1256
|
-
if (plugin.onResolverReady) deps.add("resolver");
|
|
1257
|
-
if (plugin.onExecutorReady) deps.add("executor");
|
|
1258
|
-
return deps;
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Checks if a plugin has any generation-time hooks.
|
|
1262
|
-
* @param plugin - The plugin object to inspect.
|
|
1263
|
-
* @param plugin.onTailorDBReady - Hook for TailorDB readiness.
|
|
1264
|
-
* @param plugin.onResolverReady - Hook for resolver readiness.
|
|
1265
|
-
* @param plugin.onExecutorReady - Hook for executor readiness.
|
|
1266
|
-
* @returns True if the plugin has at least one generation hook.
|
|
1267
|
-
*/
|
|
1268
|
-
function hasGenerationHooks(plugin) {
|
|
1269
|
-
return !!(plugin.onTailorDBReady || plugin.onResolverReady || plugin.onExecutorReady);
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
1243
|
//#endregion
|
|
1273
1244
|
//#region src/plugin/manager.ts
|
|
1274
1245
|
/**
|
|
@@ -1806,6 +1777,219 @@ async function buildMetaRequest(params) {
|
|
|
1806
1777
|
};
|
|
1807
1778
|
}
|
|
1808
1779
|
|
|
1780
|
+
//#endregion
|
|
1781
|
+
//#region src/cli/commands/deploy/owned-resource.ts
|
|
1782
|
+
/**
|
|
1783
|
+
* Fetch a workspace-scoped resource list and attach SDK ownership metadata.
|
|
1784
|
+
* @template T
|
|
1785
|
+
* @param params - Resource fetch parameters
|
|
1786
|
+
* @param params.client - Operator client instance
|
|
1787
|
+
* @param params.workspaceId - Workspace ID
|
|
1788
|
+
* @param params.fetchPage - Function that fetches one resource page
|
|
1789
|
+
* @param params.getName - Function that extracts the resource name
|
|
1790
|
+
* @param params.getTrn - Function that builds the resource TRN
|
|
1791
|
+
* @returns Existing resources keyed by resource name, with SDK labels attached
|
|
1792
|
+
*/
|
|
1793
|
+
async function fetchExistingResourcesWithLabels(params) {
|
|
1794
|
+
const { client, workspaceId, fetchPage, getName, getTrn } = params;
|
|
1795
|
+
const withoutLabel = await fetchAll(async (pageToken, maxPageSize) => {
|
|
1796
|
+
try {
|
|
1797
|
+
return await fetchPage(pageToken, maxPageSize);
|
|
1798
|
+
} catch (error) {
|
|
1799
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
1800
|
+
throw error;
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
const existingResources = {};
|
|
1804
|
+
await Promise.all(withoutLabel.map(async (resource) => {
|
|
1805
|
+
const name = getName(resource);
|
|
1806
|
+
if (!name) return;
|
|
1807
|
+
const { metadata } = await client.getMetadata({ trn: getTrn(workspaceId, name) });
|
|
1808
|
+
existingResources[name] = {
|
|
1809
|
+
resource,
|
|
1810
|
+
label: metadata?.labels[sdkNameLabelKey],
|
|
1811
|
+
allLabels: metadata?.labels
|
|
1812
|
+
};
|
|
1813
|
+
}));
|
|
1814
|
+
return existingResources;
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* Determine whether a same-named existing resource is managed by this app.
|
|
1818
|
+
* Records the user-facing confirmation data when ownership does not match.
|
|
1819
|
+
* @param params - Ownership classification inputs
|
|
1820
|
+
* @param params.labels - Existing resource labels
|
|
1821
|
+
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
1822
|
+
* @param params.appName - Current application name
|
|
1823
|
+
* @param params.appId - Current application id, when present
|
|
1824
|
+
* @param params.resourceType - Resource kind for confirmation messages
|
|
1825
|
+
* @param params.resourceName - Resource name for confirmation messages
|
|
1826
|
+
* @param params.conflicts - Conflict accumulator
|
|
1827
|
+
* @param params.unmanaged - Unmanaged-resource accumulator
|
|
1828
|
+
* @returns True when the resource is owned by the current app
|
|
1829
|
+
*/
|
|
1830
|
+
function trackDesiredResourceOwnership(params) {
|
|
1831
|
+
const { labels, ownerLabel, appName, appId, resourceType, resourceName, conflicts, unmanaged } = params;
|
|
1832
|
+
const owned = isOwnedByApp(labels, appName, appId);
|
|
1833
|
+
if (!owned) if (!ownerLabel) unmanaged.push({
|
|
1834
|
+
resourceType,
|
|
1835
|
+
resourceName
|
|
1836
|
+
});
|
|
1837
|
+
else conflicts.push({
|
|
1838
|
+
resourceType,
|
|
1839
|
+
resourceName,
|
|
1840
|
+
currentOwner: ownerLabel
|
|
1841
|
+
});
|
|
1842
|
+
return owned;
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Determine whether a remote-only resource is still owned by this app.
|
|
1846
|
+
* Also records other SDK owners so renamed-empty applications can be handled.
|
|
1847
|
+
* @param params - Ownership classification inputs
|
|
1848
|
+
* @param params.labels - Existing resource labels
|
|
1849
|
+
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
1850
|
+
* @param params.appName - Current application name
|
|
1851
|
+
* @param params.appId - Current application id, when present
|
|
1852
|
+
* @param params.resourceOwners - Other-owner accumulator
|
|
1853
|
+
* @returns True when the resource is owned by the current app
|
|
1854
|
+
*/
|
|
1855
|
+
function trackRemainingResourceOwner(params) {
|
|
1856
|
+
const { labels, ownerLabel, appName, appId, resourceOwners } = params;
|
|
1857
|
+
const owned = isOwnedByApp(labels, appName, appId);
|
|
1858
|
+
if (ownerLabel && !owned) resourceOwners.add(ownerLabel);
|
|
1859
|
+
return owned;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
//#endregion
|
|
1863
|
+
//#region src/cli/commands/deploy/aigateway.ts
|
|
1864
|
+
/**
|
|
1865
|
+
* Apply AI Gateway changes for the given phase.
|
|
1866
|
+
* @param client - Operator client instance
|
|
1867
|
+
* @param result - Planned AI Gateway changes
|
|
1868
|
+
* @param phase - Apply phase
|
|
1869
|
+
* @returns Promise that resolves when AI Gateways are applied
|
|
1870
|
+
*/
|
|
1871
|
+
async function applyAIGateway(client, result, phase = "create-update") {
|
|
1872
|
+
const { changeSet } = result;
|
|
1873
|
+
if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create) => {
|
|
1874
|
+
create.request.cors = await resolveStaticWebsiteUrls(client, assertDefined(create.request.workspaceId, "request missing workspaceId"), create.request.cors, "AIGateway CORS");
|
|
1875
|
+
await client.createAIGateway(create.request);
|
|
1876
|
+
await client.setMetadata(create.metaRequest);
|
|
1877
|
+
}), ...changeSet.updates.map(async (update) => {
|
|
1878
|
+
update.request.cors = await resolveStaticWebsiteUrls(client, assertDefined(update.request.workspaceId, "request missing workspaceId"), update.request.cors, "AIGateway CORS");
|
|
1879
|
+
await client.updateAIGateway(update.request);
|
|
1880
|
+
await client.setMetadata(update.metaRequest);
|
|
1881
|
+
})]);
|
|
1882
|
+
else await Promise.all(changeSet.deletes.map((del) => client.deleteAIGateway(del.request)));
|
|
1883
|
+
}
|
|
1884
|
+
function normalizeComparableAIGatewayShape(input) {
|
|
1885
|
+
return {
|
|
1886
|
+
authNamespace: input.authNamespace,
|
|
1887
|
+
cors: input.cors.toSorted()
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
function normalizeComparableAIGateway(input) {
|
|
1891
|
+
return normalizeComparableAIGatewayShape({
|
|
1892
|
+
authNamespace: input.authNamespace || "",
|
|
1893
|
+
cors: [...input.cors || []]
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
function areAIGatewaysEqual(existing, desired) {
|
|
1897
|
+
return areNormalizedEqual(normalizeComparableAIGateway(existing), normalizeComparableAIGateway(desired));
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Plan AI Gateway changes based on current and desired state.
|
|
1901
|
+
* @param context - Planning context
|
|
1902
|
+
* @returns Planned changes
|
|
1903
|
+
*/
|
|
1904
|
+
async function planAIGateway(context) {
|
|
1905
|
+
const { client, workspaceId, application, forRemoval } = context;
|
|
1906
|
+
const changeSet = createChangeSet("AIGateways");
|
|
1907
|
+
const conflicts = [];
|
|
1908
|
+
const unmanaged = [];
|
|
1909
|
+
const resourceOwners = /* @__PURE__ */ new Set();
|
|
1910
|
+
const existingGateways = await fetchExistingResourcesWithLabels({
|
|
1911
|
+
client,
|
|
1912
|
+
workspaceId,
|
|
1913
|
+
fetchPage: async (pageToken, pageSize) => {
|
|
1914
|
+
const { aigateways, nextPageToken } = await client.listAIGateways({
|
|
1915
|
+
workspaceId,
|
|
1916
|
+
pageToken,
|
|
1917
|
+
pageSize
|
|
1918
|
+
});
|
|
1919
|
+
return [aigateways, nextPageToken];
|
|
1920
|
+
},
|
|
1921
|
+
getName: (resource) => resource.name,
|
|
1922
|
+
getTrn: (workspaceId, name) => resourceTrn(workspaceId, "aigateway", name)
|
|
1923
|
+
});
|
|
1924
|
+
const aiGatewayServices = forRemoval ? [] : application.aiGatewayServices;
|
|
1925
|
+
const expectedLocalWebsites = new Set(application.staticWebsiteServices.map((website) => website.name));
|
|
1926
|
+
for (const gatewayService of aiGatewayServices) {
|
|
1927
|
+
const config = gatewayService;
|
|
1928
|
+
const name = gatewayService.name;
|
|
1929
|
+
const existing = existingGateways[name];
|
|
1930
|
+
const metaRequest = await buildMetaRequest({
|
|
1931
|
+
trn: resourceTrn(workspaceId, "aigateway", name),
|
|
1932
|
+
appName: application.name,
|
|
1933
|
+
appId: application.id
|
|
1934
|
+
});
|
|
1935
|
+
const resolvedCors = await resolveStaticWebsiteUrls(client, workspaceId, config.cors ? [...config.cors] : [], "AIGateway CORS", { expectedLocalNames: expectedLocalWebsites });
|
|
1936
|
+
const desired = normalizeComparableAIGateway({
|
|
1937
|
+
...config,
|
|
1938
|
+
cors: resolvedCors
|
|
1939
|
+
});
|
|
1940
|
+
const request = {
|
|
1941
|
+
workspaceId,
|
|
1942
|
+
aigatewayName: name,
|
|
1943
|
+
authNamespace: config.authNamespace,
|
|
1944
|
+
cors: config.cors ? [...config.cors] : []
|
|
1945
|
+
};
|
|
1946
|
+
if (existing) {
|
|
1947
|
+
if (trackDesiredResourceOwnership({
|
|
1948
|
+
labels: existing.allLabels,
|
|
1949
|
+
ownerLabel: existing.label,
|
|
1950
|
+
appName: application.name,
|
|
1951
|
+
appId: application.id,
|
|
1952
|
+
resourceType: "AIGateway",
|
|
1953
|
+
resourceName: name,
|
|
1954
|
+
conflicts,
|
|
1955
|
+
unmanaged
|
|
1956
|
+
}) && hasMatchingSdkVersion(existing.allLabels, metaRequest.labels) && areAIGatewaysEqual(existing.resource, desired)) changeSet.unchanged.push({ name });
|
|
1957
|
+
else changeSet.updates.push({
|
|
1958
|
+
name,
|
|
1959
|
+
request,
|
|
1960
|
+
metaRequest
|
|
1961
|
+
});
|
|
1962
|
+
delete existingGateways[name];
|
|
1963
|
+
} else changeSet.creates.push({
|
|
1964
|
+
name,
|
|
1965
|
+
request,
|
|
1966
|
+
metaRequest
|
|
1967
|
+
});
|
|
1968
|
+
}
|
|
1969
|
+
Object.entries(existingGateways).forEach(([name, entry]) => {
|
|
1970
|
+
const label = entry?.label;
|
|
1971
|
+
if (trackRemainingResourceOwner({
|
|
1972
|
+
labels: entry?.allLabels,
|
|
1973
|
+
ownerLabel: label,
|
|
1974
|
+
appName: application.name,
|
|
1975
|
+
appId: application.id,
|
|
1976
|
+
resourceOwners
|
|
1977
|
+
})) changeSet.deletes.push({
|
|
1978
|
+
name,
|
|
1979
|
+
request: {
|
|
1980
|
+
workspaceId,
|
|
1981
|
+
aigatewayName: name
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
});
|
|
1985
|
+
return {
|
|
1986
|
+
changeSet,
|
|
1987
|
+
conflicts,
|
|
1988
|
+
unmanaged,
|
|
1989
|
+
resourceOwners
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1809
1993
|
//#endregion
|
|
1810
1994
|
//#region src/cli/commands/deploy/application.ts
|
|
1811
1995
|
/**
|
|
@@ -4707,7 +4891,7 @@ async function readConfigId(configPath) {
|
|
|
4707
4891
|
async function assertConfigIdInCI(configPath) {
|
|
4708
4892
|
const result = await readConfigId(configPath);
|
|
4709
4893
|
if (result === null) return;
|
|
4710
|
-
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
|
|
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.");
|
|
4711
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.`);
|
|
4712
4896
|
}
|
|
4713
4897
|
/**
|
|
@@ -4875,111 +5059,29 @@ async function confirmImportantResourceDeletion(resources, yes) {
|
|
|
4875
5059
|
}
|
|
4876
5060
|
|
|
4877
5061
|
//#endregion
|
|
4878
|
-
//#region src/cli/commands/deploy/
|
|
5062
|
+
//#region src/cli/commands/deploy/invoker.ts
|
|
4879
5063
|
/**
|
|
4880
|
-
* Normalize an
|
|
5064
|
+
* Normalize an invoker value to the object form required by the proto payload.
|
|
4881
5065
|
*
|
|
4882
5066
|
* Accepts either:
|
|
4883
5067
|
* - `undefined` — returns undefined
|
|
4884
5068
|
* - a plain string (machine user name) — expands to `{ namespace, machineUserName }` using `authNamespace`
|
|
4885
|
-
* - an object `{ namespace, machineUserName }` — returned as-is
|
|
4886
|
-
* @param
|
|
4887
|
-
* @param authNamespace - Auth service namespace (required when
|
|
5069
|
+
* - an internal object `{ namespace, machineUserName }` — returned as-is
|
|
5070
|
+
* @param invoker - String machine user name or internal object form
|
|
5071
|
+
* @param authNamespace - Auth service namespace (required when invoker is a string)
|
|
4888
5072
|
* @param context - Contextual label used in error messages (e.g. `resolver "foo"`)
|
|
4889
|
-
* @returns Object form of
|
|
5073
|
+
* @returns Object form of the invoker, or undefined
|
|
4890
5074
|
*/
|
|
4891
|
-
function
|
|
4892
|
-
if (
|
|
4893
|
-
if (typeof
|
|
4894
|
-
if (!authNamespace) throw new Error(`${context} uses a string
|
|
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.`);
|
|
4895
5079
|
return {
|
|
4896
5080
|
namespace: authNamespace,
|
|
4897
|
-
machineUserName:
|
|
5081
|
+
machineUserName: invoker
|
|
4898
5082
|
};
|
|
4899
5083
|
}
|
|
4900
|
-
return
|
|
4901
|
-
}
|
|
4902
|
-
|
|
4903
|
-
//#endregion
|
|
4904
|
-
//#region src/cli/commands/deploy/owned-resource.ts
|
|
4905
|
-
/**
|
|
4906
|
-
* Fetch a workspace-scoped resource list and attach SDK ownership metadata.
|
|
4907
|
-
* @template T
|
|
4908
|
-
* @param params - Resource fetch parameters
|
|
4909
|
-
* @param params.client - Operator client instance
|
|
4910
|
-
* @param params.workspaceId - Workspace ID
|
|
4911
|
-
* @param params.fetchPage - Function that fetches one resource page
|
|
4912
|
-
* @param params.getName - Function that extracts the resource name
|
|
4913
|
-
* @param params.getTrn - Function that builds the resource TRN
|
|
4914
|
-
* @returns Existing resources keyed by resource name, with SDK labels attached
|
|
4915
|
-
*/
|
|
4916
|
-
async function fetchExistingResourcesWithLabels(params) {
|
|
4917
|
-
const { client, workspaceId, fetchPage, getName, getTrn } = params;
|
|
4918
|
-
const withoutLabel = await fetchAll(async (pageToken, maxPageSize) => {
|
|
4919
|
-
try {
|
|
4920
|
-
return await fetchPage(pageToken, maxPageSize);
|
|
4921
|
-
} catch (error) {
|
|
4922
|
-
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
4923
|
-
throw error;
|
|
4924
|
-
}
|
|
4925
|
-
});
|
|
4926
|
-
const existingResources = {};
|
|
4927
|
-
await Promise.all(withoutLabel.map(async (resource) => {
|
|
4928
|
-
const name = getName(resource);
|
|
4929
|
-
if (!name) return;
|
|
4930
|
-
const { metadata } = await client.getMetadata({ trn: getTrn(workspaceId, name) });
|
|
4931
|
-
existingResources[name] = {
|
|
4932
|
-
resource,
|
|
4933
|
-
label: metadata?.labels[sdkNameLabelKey],
|
|
4934
|
-
allLabels: metadata?.labels
|
|
4935
|
-
};
|
|
4936
|
-
}));
|
|
4937
|
-
return existingResources;
|
|
4938
|
-
}
|
|
4939
|
-
/**
|
|
4940
|
-
* Determine whether a same-named existing resource is managed by this app.
|
|
4941
|
-
* Records the user-facing confirmation data when ownership does not match.
|
|
4942
|
-
* @param params - Ownership classification inputs
|
|
4943
|
-
* @param params.labels - Existing resource labels
|
|
4944
|
-
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
4945
|
-
* @param params.appName - Current application name
|
|
4946
|
-
* @param params.appId - Current application id, when present
|
|
4947
|
-
* @param params.resourceType - Resource kind for confirmation messages
|
|
4948
|
-
* @param params.resourceName - Resource name for confirmation messages
|
|
4949
|
-
* @param params.conflicts - Conflict accumulator
|
|
4950
|
-
* @param params.unmanaged - Unmanaged-resource accumulator
|
|
4951
|
-
* @returns True when the resource is owned by the current app
|
|
4952
|
-
*/
|
|
4953
|
-
function trackDesiredResourceOwnership(params) {
|
|
4954
|
-
const { labels, ownerLabel, appName, appId, resourceType, resourceName, conflicts, unmanaged } = params;
|
|
4955
|
-
const owned = isOwnedByApp(labels, appName, appId);
|
|
4956
|
-
if (!owned) if (!ownerLabel) unmanaged.push({
|
|
4957
|
-
resourceType,
|
|
4958
|
-
resourceName
|
|
4959
|
-
});
|
|
4960
|
-
else conflicts.push({
|
|
4961
|
-
resourceType,
|
|
4962
|
-
resourceName,
|
|
4963
|
-
currentOwner: ownerLabel
|
|
4964
|
-
});
|
|
4965
|
-
return owned;
|
|
4966
|
-
}
|
|
4967
|
-
/**
|
|
4968
|
-
* Determine whether a remote-only resource is still owned by this app.
|
|
4969
|
-
* Also records other SDK owners so renamed-empty applications can be handled.
|
|
4970
|
-
* @param params - Ownership classification inputs
|
|
4971
|
-
* @param params.labels - Existing resource labels
|
|
4972
|
-
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
4973
|
-
* @param params.appName - Current application name
|
|
4974
|
-
* @param params.appId - Current application id, when present
|
|
4975
|
-
* @param params.resourceOwners - Other-owner accumulator
|
|
4976
|
-
* @returns True when the resource is owned by the current app
|
|
4977
|
-
*/
|
|
4978
|
-
function trackRemainingResourceOwner(params) {
|
|
4979
|
-
const { labels, ownerLabel, appName, appId, resourceOwners } = params;
|
|
4980
|
-
const owned = isOwnedByApp(labels, appName, appId);
|
|
4981
|
-
if (ownerLabel && !owned) resourceOwners.add(ownerLabel);
|
|
4982
|
-
return owned;
|
|
5084
|
+
return invoker;
|
|
4983
5085
|
}
|
|
4984
5086
|
|
|
4985
5087
|
//#endregion
|
|
@@ -5192,8 +5294,9 @@ function resolveIdpNamespace(application, executorName, idpName) {
|
|
|
5192
5294
|
return assertDefined(application.idpServices[0], "idp service missing").name;
|
|
5193
5295
|
}
|
|
5194
5296
|
function resolveAuthNamespace(application) {
|
|
5195
|
-
|
|
5196
|
-
|
|
5297
|
+
const authNamespace = getApplicationAuthNamespace(application);
|
|
5298
|
+
if (!authNamespace) throw new Error("No Auth service configured");
|
|
5299
|
+
return authNamespace;
|
|
5197
5300
|
}
|
|
5198
5301
|
function protoExecutor(application, executor) {
|
|
5199
5302
|
const appName = application.name;
|
|
@@ -5278,7 +5381,7 @@ function protoExecutor(application, executor) {
|
|
|
5278
5381
|
const target = executor.operation;
|
|
5279
5382
|
let targetType;
|
|
5280
5383
|
let targetConfig;
|
|
5281
|
-
const authNamespace = application
|
|
5384
|
+
const authNamespace = getApplicationAuthNamespace(application);
|
|
5282
5385
|
const invokerContext = `Executor "${executor.name}"`;
|
|
5283
5386
|
switch (target.kind) {
|
|
5284
5387
|
case "webhook":
|
|
@@ -5317,7 +5420,7 @@ function protoExecutor(application, executor) {
|
|
|
5317
5420
|
appName: target.appName ?? appName,
|
|
5318
5421
|
query: target.query,
|
|
5319
5422
|
variables: target.variables ? { expr: `(${stringifyFunction(target.variables)})(${argsExpr})` } : void 0,
|
|
5320
|
-
invoker:
|
|
5423
|
+
invoker: normalizeInvoker(target.invoker, authNamespace, invokerContext)
|
|
5321
5424
|
}
|
|
5322
5425
|
} };
|
|
5323
5426
|
break;
|
|
@@ -5331,7 +5434,7 @@ function protoExecutor(application, executor) {
|
|
|
5331
5434
|
name: "operation",
|
|
5332
5435
|
scriptRef: executorFunctionName(executor.name),
|
|
5333
5436
|
variables: { expr: argsExpr },
|
|
5334
|
-
invoker:
|
|
5437
|
+
invoker: normalizeInvoker(target.invoker, authNamespace, invokerContext)
|
|
5335
5438
|
}
|
|
5336
5439
|
} };
|
|
5337
5440
|
break;
|
|
@@ -5342,7 +5445,7 @@ function protoExecutor(application, executor) {
|
|
|
5342
5445
|
value: {
|
|
5343
5446
|
workflowName: target.workflowName,
|
|
5344
5447
|
variables: target.args ? typeof target.args === "function" ? { expr: `(${stringifyFunction(target.args)})(${argsExpr})` } : { expr: JSON.stringify(target.args) } : void 0,
|
|
5345
|
-
invoker:
|
|
5448
|
+
invoker: normalizeInvoker(target.invoker, authNamespace, invokerContext)
|
|
5346
5449
|
}
|
|
5347
5450
|
} };
|
|
5348
5451
|
break;
|
|
@@ -5434,7 +5537,7 @@ async function planPipeline(context) {
|
|
|
5434
5537
|
}
|
|
5435
5538
|
const executors = forRemoval ? [] : Object.values(await application.executorService?.loadExecutors() ?? {});
|
|
5436
5539
|
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$1(client, workspaceId, application.name, application.id, pipelines);
|
|
5437
|
-
const { changeSet: resolverChangeSet } = await planResolvers(client, workspaceId, pipelines, executors, serviceChangeSet.deletes.map((del) => del.name), application.env, application
|
|
5540
|
+
const { changeSet: resolverChangeSet } = await planResolvers(client, workspaceId, pipelines, executors, serviceChangeSet.deletes.map((del) => del.name), application.env, getApplicationAuthNamespace(application), forceApplyAll);
|
|
5438
5541
|
return {
|
|
5439
5542
|
changeSet: {
|
|
5440
5543
|
service: serviceChangeSet,
|
|
@@ -5678,7 +5781,7 @@ function processResolver(namespace, resolver, executorUsedResolvers, env, authNa
|
|
|
5678
5781
|
operationSourceRef: resolverFunctionName(namespace, resolver.name),
|
|
5679
5782
|
operationHook: { expr: buildResolverOperationHookExpr(env) },
|
|
5680
5783
|
postScript: `args.body`,
|
|
5681
|
-
invoker:
|
|
5784
|
+
invoker: normalizeInvoker(resolver.invoker, authNamespace, `Resolver "${resolver.name}"`)
|
|
5682
5785
|
}];
|
|
5683
5786
|
const typeBaseName = inflection.camelize(resolver.name);
|
|
5684
5787
|
const inputs = resolver.input ? protoFields(resolver.input, `${typeBaseName}Input`, true) : [];
|
|
@@ -6873,7 +6976,7 @@ function createSnapshotFieldConfig(field) {
|
|
|
6873
6976
|
}
|
|
6874
6977
|
/**
|
|
6875
6978
|
* Create a snapshot field config from an OperatorFieldConfig (for nested fields)
|
|
6876
|
-
* @param {import("@/
|
|
6979
|
+
* @param {import("@/parser/service/tailordb/types").OperatorFieldConfig} fieldConfig - Field configuration
|
|
6877
6980
|
* @returns {SnapshotFieldConfig} Snapshot field configuration
|
|
6878
6981
|
*/
|
|
6879
6982
|
function createSnapshotFieldConfigFromOperatorConfig(fieldConfig) {
|
|
@@ -8598,7 +8701,7 @@ const DEFAULT_POLL_INTERVAL = 1e3;
|
|
|
8598
8701
|
* @returns {Promise<ExecutionWaitResult>} Execution result
|
|
8599
8702
|
* @throws {Error} If execution is not found
|
|
8600
8703
|
*/
|
|
8601
|
-
async function waitForExecution
|
|
8704
|
+
async function waitForExecution(client, workspaceId, executionId, pollInterval = DEFAULT_POLL_INTERVAL) {
|
|
8602
8705
|
while (true) {
|
|
8603
8706
|
const { execution } = await client.getFunctionExecution({
|
|
8604
8707
|
workspaceId,
|
|
@@ -8629,11 +8732,11 @@ async function executeScript(options) {
|
|
|
8629
8732
|
workspaceId,
|
|
8630
8733
|
name,
|
|
8631
8734
|
code,
|
|
8632
|
-
arg:
|
|
8735
|
+
arg: JSON.stringify(arg === void 0 ? {} : arg),
|
|
8633
8736
|
invoker
|
|
8634
8737
|
});
|
|
8635
8738
|
const executionId = response.executionId;
|
|
8636
|
-
const result = await waitForExecution
|
|
8739
|
+
const result = await waitForExecution(client, workspaceId, executionId, pollInterval);
|
|
8637
8740
|
if (result.status === FunctionExecution_Status.SUCCESS) return {
|
|
8638
8741
|
success: true,
|
|
8639
8742
|
logs: result.logs,
|
|
@@ -8882,13 +8985,13 @@ async function detectPendingMigrations(client, workspaceId, namespacesWithMigrat
|
|
|
8882
8985
|
* @returns {Promise<ExecutionResult>} Execution result
|
|
8883
8986
|
*/
|
|
8884
8987
|
async function executeSingleMigration(options, migration) {
|
|
8885
|
-
const { client, workspaceId,
|
|
8988
|
+
const { client, workspaceId, invoker, env } = options;
|
|
8886
8989
|
const result = await executeScript({
|
|
8887
8990
|
client,
|
|
8888
8991
|
workspaceId,
|
|
8889
8992
|
name: `migration-${migration.namespace}-${formatMigrationNumber(migration.number)}.js`,
|
|
8890
8993
|
code: (await bundleMigrationScript(migration.scriptPath, migration.namespace, migration.number, env)).bundledCode,
|
|
8891
|
-
invoker
|
|
8994
|
+
invoker
|
|
8892
8995
|
});
|
|
8893
8996
|
return {
|
|
8894
8997
|
namespace: migration.namespace,
|
|
@@ -8933,14 +9036,14 @@ async function executeMigrations(context, migrations) {
|
|
|
8933
9036
|
const migrationConfig = context.dbConfig[namespace]?.migration;
|
|
8934
9037
|
const machineUserName = getMigrationMachineUser(migrationConfig, context.machineUsers);
|
|
8935
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.`);
|
|
8936
|
-
const
|
|
9039
|
+
const invoker = create(AuthInvokerSchema, {
|
|
8937
9040
|
namespace: context.authNamespace,
|
|
8938
9041
|
machineUserName
|
|
8939
9042
|
});
|
|
8940
9043
|
const options = {
|
|
8941
9044
|
client: context.client,
|
|
8942
9045
|
workspaceId: context.workspaceId,
|
|
8943
|
-
|
|
9046
|
+
invoker,
|
|
8944
9047
|
env: context.env
|
|
8945
9048
|
};
|
|
8946
9049
|
logger.info(`Using machine user: ${styles.bold(machineUserName)} for namespace '${namespace}'`);
|
|
@@ -9593,6 +9696,9 @@ async function planTailorDB(context) {
|
|
|
9593
9696
|
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices(client, workspaceId, application.name, application.id, tailordbs);
|
|
9594
9697
|
const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
|
|
9595
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);
|
|
9596
9702
|
return {
|
|
9597
9703
|
changeSet: {
|
|
9598
9704
|
service: serviceChangeSet,
|
|
@@ -10620,6 +10726,9 @@ async function shouldForceApplyAll(client, workspaceId, application, functionEnt
|
|
|
10620
10726
|
application.staticWebsiteServices.forEach((website) => {
|
|
10621
10727
|
candidateTrns.add(resourceTrn(workspaceId, "staticwebsite", website.name));
|
|
10622
10728
|
});
|
|
10729
|
+
application.aiGatewayServices.forEach((gateway) => {
|
|
10730
|
+
candidateTrns.add(resourceTrn(workspaceId, "aigateway", gateway.name));
|
|
10731
|
+
});
|
|
10623
10732
|
application.resolverServices.forEach((pipeline) => {
|
|
10624
10733
|
candidateTrns.add(resourceTrn(workspaceId, "pipeline", pipeline.namespace));
|
|
10625
10734
|
});
|
|
@@ -10698,6 +10807,7 @@ function printPlanResults(results) {
|
|
|
10698
10807
|
const authServiceActions = extractServiceActions(results.auth.changeSet.service);
|
|
10699
10808
|
results.staticWebsite.changeSet.print();
|
|
10700
10809
|
results.staticWebsite.customDomainChangeSet.print();
|
|
10810
|
+
results.aiGateway.changeSet.print();
|
|
10701
10811
|
results.app.print();
|
|
10702
10812
|
printGroupedDisplaySection("TailorDB", tailorDBEntries, tailorDBServiceActions);
|
|
10703
10813
|
printGroupedDisplaySection("Resolver", pipelineEntries, pipelineServiceActions);
|
|
@@ -10748,6 +10858,7 @@ function summarizePlanResults(results, displayEntries, serviceActions) {
|
|
|
10748
10858
|
otherChanges,
|
|
10749
10859
|
results.staticWebsite.changeSet,
|
|
10750
10860
|
results.staticWebsite.customDomainChangeSet,
|
|
10861
|
+
results.aiGateway.changeSet,
|
|
10751
10862
|
results.app,
|
|
10752
10863
|
results.secretManager.vaultChangeSet,
|
|
10753
10864
|
results.secretManager.secretChangeSet
|
|
@@ -10852,7 +10963,7 @@ async function deploy(options) {
|
|
|
10852
10963
|
const dryRun = options?.dryRun ?? false;
|
|
10853
10964
|
const yes = options?.yes ?? false;
|
|
10854
10965
|
const forceApplyAll = await withSpan("plan.detectSdkVersionChange", () => shouldForceApplyAll(client, workspaceId, application, functionEntries));
|
|
10855
|
-
const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
|
|
10966
|
+
const { functionRegistry, tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
|
|
10856
10967
|
const idpUserTriggerTargets = collectIdpUserTriggerTargets(application);
|
|
10857
10968
|
const ctx = {
|
|
10858
10969
|
client,
|
|
@@ -10866,9 +10977,10 @@ async function deploy(options) {
|
|
|
10866
10977
|
};
|
|
10867
10978
|
const functionRegistry = await withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, application.id, functionEntries));
|
|
10868
10979
|
const unchangedWorkflowJobs = new Set(functionRegistry.changeSet.unchanged.filter((entry) => entry.name.startsWith(WORKFLOW_PREFIX)).map((entry) => entry.name.slice(WORKFLOW_PREFIX.length)));
|
|
10869
|
-
const [tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
|
|
10980
|
+
const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
|
|
10870
10981
|
withSpan("plan.tailorDB", () => planTailorDB(ctx)),
|
|
10871
10982
|
withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
|
|
10983
|
+
withSpan("plan.aiGateway", () => planAIGateway(ctx)),
|
|
10872
10984
|
withSpan("plan.idp", () => planIdP(ctx)),
|
|
10873
10985
|
withSpan("plan.auth", () => planAuth(ctx)),
|
|
10874
10986
|
withSpan("plan.pipeline", () => planPipeline(ctx)),
|
|
@@ -10881,6 +10993,7 @@ async function deploy(options) {
|
|
|
10881
10993
|
functionRegistry,
|
|
10882
10994
|
tailorDB,
|
|
10883
10995
|
staticWebsite,
|
|
10996
|
+
aiGateway,
|
|
10884
10997
|
idp,
|
|
10885
10998
|
auth,
|
|
10886
10999
|
pipeline,
|
|
@@ -10895,6 +11008,7 @@ async function deploy(options) {
|
|
|
10895
11008
|
...functionRegistry.conflicts,
|
|
10896
11009
|
...tailorDB.conflicts,
|
|
10897
11010
|
...staticWebsite.conflicts,
|
|
11011
|
+
...aiGateway.conflicts,
|
|
10898
11012
|
...idp.conflicts,
|
|
10899
11013
|
...auth.conflicts,
|
|
10900
11014
|
...pipeline.conflicts,
|
|
@@ -10907,6 +11021,7 @@ async function deploy(options) {
|
|
|
10907
11021
|
...functionRegistry.unmanaged,
|
|
10908
11022
|
...tailorDB.unmanaged,
|
|
10909
11023
|
...staticWebsite.unmanaged,
|
|
11024
|
+
...aiGateway.unmanaged,
|
|
10910
11025
|
...idp.unmanaged,
|
|
10911
11026
|
...auth.unmanaged,
|
|
10912
11027
|
...pipeline.unmanaged,
|
|
@@ -10923,6 +11038,10 @@ async function deploy(options) {
|
|
|
10923
11038
|
resourceType: "StaticWebsite",
|
|
10924
11039
|
resourceName: del.name
|
|
10925
11040
|
});
|
|
11041
|
+
for (const del of aiGateway.changeSet.deletes) importantDeletions.push({
|
|
11042
|
+
resourceType: "AIGateway",
|
|
11043
|
+
resourceName: del.name
|
|
11044
|
+
});
|
|
10926
11045
|
for (const del of auth.changeSet.oauth2Client.deletes) importantDeletions.push({
|
|
10927
11046
|
resourceType: "OAuth2 client",
|
|
10928
11047
|
resourceName: del.name
|
|
@@ -10950,6 +11069,7 @@ async function deploy(options) {
|
|
|
10950
11069
|
...functionRegistry.resourceOwners,
|
|
10951
11070
|
...tailorDB.resourceOwners,
|
|
10952
11071
|
...staticWebsite.resourceOwners,
|
|
11072
|
+
...aiGateway.resourceOwners,
|
|
10953
11073
|
...idp.resourceOwners,
|
|
10954
11074
|
...auth.resourceOwners,
|
|
10955
11075
|
...pipeline.resourceOwners,
|
|
@@ -10971,6 +11091,7 @@ async function deploy(options) {
|
|
|
10971
11091
|
functionRegistry,
|
|
10972
11092
|
tailorDB,
|
|
10973
11093
|
staticWebsite,
|
|
11094
|
+
aiGateway,
|
|
10974
11095
|
idp,
|
|
10975
11096
|
auth,
|
|
10976
11097
|
pipeline,
|
|
@@ -11000,6 +11121,7 @@ async function deploy(options) {
|
|
|
11000
11121
|
await applySecretManager(client, secretManager, "create-update", application);
|
|
11001
11122
|
await applyFunctionRegistry(client, workspaceId, functionRegistry, "create-update");
|
|
11002
11123
|
await applyStaticWebsite(client, staticWebsite, "create-update");
|
|
11124
|
+
await applyAIGateway(client, aiGateway, "create-update");
|
|
11003
11125
|
await applyIdP(client, idp, "create-update");
|
|
11004
11126
|
await applyAuth(client, auth, "create-update");
|
|
11005
11127
|
await applyTailorDB(client, tailorDB, "create-update");
|
|
@@ -11019,6 +11141,7 @@ async function deploy(options) {
|
|
|
11019
11141
|
await applyWorkflow(client, workflow, "delete");
|
|
11020
11142
|
await applyExecutor(client, executor, "delete");
|
|
11021
11143
|
await applyStaticWebsite(client, staticWebsite, "delete");
|
|
11144
|
+
await applyAIGateway(client, aiGateway, "delete");
|
|
11022
11145
|
await applySecretManager(client, secretManager, "delete");
|
|
11023
11146
|
});
|
|
11024
11147
|
await withSpan("apply.deleteApplication", () => applyApplication(client, app, "delete"));
|
|
@@ -11056,7 +11179,42 @@ function colorizeExecutorJobStatus(status) {
|
|
|
11056
11179
|
* @returns True if status is terminal
|
|
11057
11180
|
*/
|
|
11058
11181
|
function isExecutorJobTerminalStatus(status) {
|
|
11059
|
-
return status
|
|
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";
|
|
11060
11218
|
}
|
|
11061
11219
|
/**
|
|
11062
11220
|
* Parse executor job status string to enum.
|
|
@@ -11448,36 +11606,158 @@ function functionExecutionStatusToString(status) {
|
|
|
11448
11606
|
}
|
|
11449
11607
|
}
|
|
11450
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
|
+
|
|
11451
11629
|
//#endregion
|
|
11452
11630
|
//#region src/cli/commands/workflow/args.ts
|
|
11631
|
+
const workflowWaitUntilArg = z.enum([
|
|
11632
|
+
"success",
|
|
11633
|
+
"suspended",
|
|
11634
|
+
"terminal"
|
|
11635
|
+
]);
|
|
11453
11636
|
const nameArgs = { name: arg(z.string(), {
|
|
11454
11637
|
positional: true,
|
|
11455
11638
|
description: "Workflow name"
|
|
11456
11639
|
}) };
|
|
11457
|
-
const
|
|
11458
|
-
wait: arg(z.boolean().default(false), {
|
|
11459
|
-
alias: "W",
|
|
11460
|
-
description: "Wait for execution to complete"
|
|
11461
|
-
}),
|
|
11640
|
+
const workflowWaitControlArgs = {
|
|
11462
11641
|
interval: arg(durationArg.default("3s"), {
|
|
11463
11642
|
alias: "i",
|
|
11464
|
-
description: "Polling interval when
|
|
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)"
|
|
11465
11652
|
}),
|
|
11466
11653
|
logs: arg(z.boolean().default(false), {
|
|
11467
11654
|
alias: "l",
|
|
11468
|
-
description: "Display job execution logs after completion
|
|
11655
|
+
description: "Display job execution logs after completion"
|
|
11469
11656
|
})
|
|
11470
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
|
+
};
|
|
11471
11665
|
|
|
11472
11666
|
//#endregion
|
|
11473
11667
|
//#region src/cli/commands/workflow/status.ts
|
|
11474
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
|
+
/**
|
|
11475
11709
|
* Check if workflow execution status is terminal.
|
|
11476
11710
|
* @param status - Workflow execution status enum value
|
|
11477
11711
|
* @returns True if status is terminal
|
|
11478
11712
|
*/
|
|
11479
11713
|
function isWorkflowExecutionTerminalStatus(status) {
|
|
11480
|
-
return status
|
|
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
|
+
}
|
|
11481
11761
|
}
|
|
11482
11762
|
|
|
11483
11763
|
//#endregion
|
|
@@ -11494,6 +11774,8 @@ function workflowExecutionStatusToString(status) {
|
|
|
11494
11774
|
case WorkflowExecution_Status.RUNNING: return "RUNNING";
|
|
11495
11775
|
case WorkflowExecution_Status.SUCCESS: return "SUCCESS";
|
|
11496
11776
|
case WorkflowExecution_Status.FAILED: return "FAILED";
|
|
11777
|
+
case WorkflowExecution_Status.PENDING_RETRY: return "PENDING_RETRY";
|
|
11778
|
+
case WorkflowExecution_Status.WAITING: return "WAITING";
|
|
11497
11779
|
default: return "UNSPECIFIED";
|
|
11498
11780
|
}
|
|
11499
11781
|
}
|
|
@@ -11508,6 +11790,7 @@ function workflowJobExecutionStatusToString(status) {
|
|
|
11508
11790
|
case WorkflowJobExecution_Status.SUSPEND: return "SUSPEND";
|
|
11509
11791
|
case WorkflowJobExecution_Status.SUCCESS: return "SUCCESS";
|
|
11510
11792
|
case WorkflowJobExecution_Status.FAILED: return "FAILED";
|
|
11793
|
+
case WorkflowJobExecution_Status.WAITING: return "WAITING";
|
|
11511
11794
|
default: return "UNSPECIFIED";
|
|
11512
11795
|
}
|
|
11513
11796
|
}
|
|
@@ -11573,24 +11856,200 @@ function toWorkflowExecutionInfo(execution) {
|
|
|
11573
11856
|
}
|
|
11574
11857
|
|
|
11575
11858
|
//#endregion
|
|
11576
|
-
//#region src/cli/commands/workflow/
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
}
|
|
11580
|
-
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) {
|
|
11581
11862
|
return date.toLocaleTimeString("en-US", { hour12: false });
|
|
11582
11863
|
}
|
|
11583
|
-
function colorizeStatus
|
|
11864
|
+
function colorizeStatus(status) {
|
|
11584
11865
|
const statusText = WorkflowExecution_Status[status];
|
|
11585
11866
|
switch (status) {
|
|
11586
|
-
case WorkflowExecution_Status.PENDING:
|
|
11587
|
-
case WorkflowExecution_Status.
|
|
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);
|
|
11588
11872
|
case WorkflowExecution_Status.RUNNING: return styles.info(statusText);
|
|
11589
11873
|
case WorkflowExecution_Status.SUCCESS: return styles.success(statusText);
|
|
11590
11874
|
case WorkflowExecution_Status.FAILED: return styles.error(statusText);
|
|
11591
11875
|
default: return statusText;
|
|
11592
11876
|
}
|
|
11593
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
|
|
11594
12053
|
function parseStatus(status) {
|
|
11595
12054
|
switch (status.toUpperCase()) {
|
|
11596
12055
|
case "PENDING": return WorkflowExecution_Status.PENDING;
|
|
@@ -11598,7 +12057,10 @@ function parseStatus(status) {
|
|
|
11598
12057
|
case "RUNNING": return WorkflowExecution_Status.RUNNING;
|
|
11599
12058
|
case "SUCCESS": return WorkflowExecution_Status.SUCCESS;
|
|
11600
12059
|
case "FAILED": return WorkflowExecution_Status.FAILED;
|
|
11601
|
-
|
|
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`);
|
|
11602
12064
|
}
|
|
11603
12065
|
}
|
|
11604
12066
|
async function listWorkflowExecutions(options) {
|
|
@@ -11685,39 +12147,30 @@ async function getWorkflowExecution(options) {
|
|
|
11685
12147
|
}));
|
|
11686
12148
|
return result;
|
|
11687
12149
|
}
|
|
11688
|
-
async function waitForCompletion() {
|
|
11689
|
-
const interval = options.interval ?? 3e3;
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
12150
|
+
async function waitForCompletion() {
|
|
12151
|
+
const interval = options.interval ?? 3e3;
|
|
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
|
+
};
|
|
11699
12168
|
}
|
|
11700
12169
|
return {
|
|
11701
12170
|
execution: await fetchExecutionWithLogs(options.executionId, options.logs ?? false),
|
|
11702
12171
|
wait: waitForCompletion
|
|
11703
12172
|
};
|
|
11704
12173
|
}
|
|
11705
|
-
async function waitWithSpinner(waitFn, interval, json) {
|
|
11706
|
-
const sp = !json ? spinner().start("Waiting for workflow to complete...") : null;
|
|
11707
|
-
const updateInterval = setInterval(() => {
|
|
11708
|
-
if (sp) sp.text = `Waiting for workflow to complete... (${formatTime$2(/* @__PURE__ */ new Date())})`;
|
|
11709
|
-
}, interval);
|
|
11710
|
-
try {
|
|
11711
|
-
const result = await waitFn();
|
|
11712
|
-
const coloredStatus = colorizeStatus$1(WorkflowExecution_Status[result.status]);
|
|
11713
|
-
if (result.status === "SUCCESS") sp?.succeed(`Completed: ${coloredStatus}`);
|
|
11714
|
-
else sp?.fail(`Completed: ${coloredStatus}`);
|
|
11715
|
-
return result;
|
|
11716
|
-
} finally {
|
|
11717
|
-
clearInterval(updateInterval);
|
|
11718
|
-
sp?.stop();
|
|
11719
|
-
}
|
|
11720
|
-
}
|
|
11721
12174
|
/**
|
|
11722
12175
|
* Print a workflow execution and its logs in a human-readable format.
|
|
11723
12176
|
* @param execution - Workflow execution detail info
|
|
@@ -11779,19 +12232,55 @@ const executionsCommand = defineAppCommand({
|
|
|
11779
12232
|
logs: arg(z.boolean().default(false), { description: "Display job execution logs (detail mode only)" })
|
|
11780
12233
|
}).strict(),
|
|
11781
12234
|
run: async (args) => {
|
|
12235
|
+
const jsonOutput = logger.jsonMode || args.json;
|
|
11782
12236
|
if (args.executionId) {
|
|
11783
12237
|
const interval = parseDuration(args.interval);
|
|
11784
|
-
|
|
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({
|
|
11785
12276
|
executionId: args.executionId,
|
|
11786
12277
|
workspaceId: args["workspace-id"],
|
|
11787
12278
|
profile: args.profile,
|
|
11788
12279
|
interval,
|
|
11789
12280
|
logs: args.logs
|
|
11790
12281
|
});
|
|
11791
|
-
if (
|
|
11792
|
-
|
|
11793
|
-
if (args.logs && !args.json) printExecutionWithLogs(result);
|
|
11794
|
-
else logger.out(result);
|
|
12282
|
+
if (args.logs && !jsonOutput) printExecutionWithLogs(execution);
|
|
12283
|
+
else logger.out(execution);
|
|
11795
12284
|
} else {
|
|
11796
12285
|
const executions = await listWorkflowExecutions({
|
|
11797
12286
|
workspaceId: args["workspace-id"],
|
|
@@ -11856,109 +12345,27 @@ const getCommand$5 = defineAppCommand({
|
|
|
11856
12345
|
|
|
11857
12346
|
//#endregion
|
|
11858
12347
|
//#region src/cli/commands/workflow/start.ts
|
|
11859
|
-
function sleep(ms) {
|
|
11860
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11861
|
-
}
|
|
11862
|
-
function formatTime$1(date) {
|
|
11863
|
-
return date.toLocaleTimeString("en-US", { hour12: false });
|
|
11864
|
-
}
|
|
11865
|
-
function colorizeStatus(status) {
|
|
11866
|
-
const statusText = WorkflowExecution_Status[status];
|
|
11867
|
-
switch (status) {
|
|
11868
|
-
case WorkflowExecution_Status.PENDING: return styles.dim(statusText);
|
|
11869
|
-
case WorkflowExecution_Status.PENDING_RESUME: return styles.warning(statusText);
|
|
11870
|
-
case WorkflowExecution_Status.RUNNING: return styles.info(statusText);
|
|
11871
|
-
case WorkflowExecution_Status.SUCCESS: return styles.success(statusText);
|
|
11872
|
-
case WorkflowExecution_Status.FAILED: return styles.error(statusText);
|
|
11873
|
-
default: return statusText;
|
|
11874
|
-
}
|
|
11875
|
-
}
|
|
11876
|
-
/**
|
|
11877
|
-
* Wait for a workflow execution to reach a terminal state, optionally showing progress.
|
|
11878
|
-
* @param options - Wait options
|
|
11879
|
-
* @returns Final workflow execution info
|
|
11880
|
-
*/
|
|
11881
|
-
async function waitForExecution(options) {
|
|
11882
|
-
const { client, workspaceId, executionId, interval, showProgress, trackJobs } = options;
|
|
11883
|
-
let lastStatus;
|
|
11884
|
-
let lastRunningJobs;
|
|
11885
|
-
const sp = showProgress ? spinner({ indent: 2 }).start("Waiting for workflow to complete...") : null;
|
|
11886
|
-
try {
|
|
11887
|
-
while (true) {
|
|
11888
|
-
const { execution } = await client.getWorkflowExecution({
|
|
11889
|
-
workspaceId,
|
|
11890
|
-
executionId
|
|
11891
|
-
});
|
|
11892
|
-
if (!execution) {
|
|
11893
|
-
sp?.fail(`Execution '${executionId}' not found.`);
|
|
11894
|
-
throw new Error(`Execution '${executionId}' not found.`);
|
|
11895
|
-
}
|
|
11896
|
-
const now = formatTime$1(/* @__PURE__ */ new Date());
|
|
11897
|
-
const coloredStatus = colorizeStatus(execution.status);
|
|
11898
|
-
if (execution.status !== lastStatus) {
|
|
11899
|
-
if (showProgress) {
|
|
11900
|
-
sp?.stop();
|
|
11901
|
-
logger.info(`Status: ${coloredStatus}`, {
|
|
11902
|
-
mode: "stream",
|
|
11903
|
-
indent: 2
|
|
11904
|
-
});
|
|
11905
|
-
sp?.start(`Waiting for workflow to complete...`);
|
|
11906
|
-
}
|
|
11907
|
-
lastStatus = execution.status;
|
|
11908
|
-
}
|
|
11909
|
-
if (trackJobs && execution.status === WorkflowExecution_Status.RUNNING) {
|
|
11910
|
-
const runningJobs = getRunningJobs(execution);
|
|
11911
|
-
if (runningJobs && runningJobs !== lastRunningJobs) {
|
|
11912
|
-
if (showProgress) {
|
|
11913
|
-
sp?.stop();
|
|
11914
|
-
logger.info(`Job | ${runningJobs}: ${coloredStatus}`, {
|
|
11915
|
-
mode: "stream",
|
|
11916
|
-
indent: 2
|
|
11917
|
-
});
|
|
11918
|
-
sp?.start(`Waiting for workflow to complete...`);
|
|
11919
|
-
}
|
|
11920
|
-
lastRunningJobs = runningJobs;
|
|
11921
|
-
}
|
|
11922
|
-
}
|
|
11923
|
-
if (sp) sp.text = `Waiting for workflow to complete... (${now})`;
|
|
11924
|
-
if (isTerminalStatus(execution.status)) {
|
|
11925
|
-
if (execution.status === WorkflowExecution_Status.SUCCESS) sp?.succeed(`Completed: ${coloredStatus}`);
|
|
11926
|
-
else if (execution.status === WorkflowExecution_Status.FAILED) sp?.fail(`Completed: ${coloredStatus}`);
|
|
11927
|
-
else sp?.warn(`Completed: ${coloredStatus}`);
|
|
11928
|
-
return toWorkflowExecutionInfo(execution);
|
|
11929
|
-
}
|
|
11930
|
-
await sleep(interval);
|
|
11931
|
-
}
|
|
11932
|
-
} catch (error) {
|
|
11933
|
-
sp?.stop();
|
|
11934
|
-
throw error;
|
|
11935
|
-
}
|
|
11936
|
-
}
|
|
11937
|
-
function getRunningJobs(execution) {
|
|
11938
|
-
return execution.jobExecutions.filter((job) => job.status === WorkflowJobExecution_Status.RUNNING).map((job) => job.stackedJobName).join(", ");
|
|
11939
|
-
}
|
|
11940
|
-
function isTerminalStatus(status) {
|
|
11941
|
-
return status === WorkflowExecution_Status.SUCCESS || status === WorkflowExecution_Status.FAILED || status === WorkflowExecution_Status.PENDING_RESUME;
|
|
11942
|
-
}
|
|
11943
12348
|
async function startWorkflowCore(options) {
|
|
11944
12349
|
const { client, workspaceId, workflowName } = options;
|
|
11945
12350
|
try {
|
|
11946
12351
|
const workflow = await resolveWorkflow(client, workspaceId, workflowName);
|
|
11947
|
-
const
|
|
12352
|
+
const invoker = create(AuthInvokerSchema, options.invoker);
|
|
11948
12353
|
const arg = options.arg === void 0 ? void 0 : typeof options.arg === "string" ? options.arg : JSON.stringify(options.arg);
|
|
11949
12354
|
const { executionId } = await client.testStartWorkflow({
|
|
11950
12355
|
workspaceId,
|
|
11951
12356
|
workflowId: workflow.id,
|
|
11952
|
-
authInvoker,
|
|
12357
|
+
authInvoker: invoker,
|
|
11953
12358
|
arg
|
|
11954
12359
|
});
|
|
11955
12360
|
return {
|
|
11956
12361
|
executionId,
|
|
11957
|
-
wait: (waitOptions) =>
|
|
12362
|
+
wait: (waitOptions) => waitForWorkflowExecution({
|
|
11958
12363
|
client,
|
|
11959
12364
|
workspaceId,
|
|
11960
12365
|
executionId,
|
|
11961
12366
|
interval: options.interval ?? 3e3,
|
|
12367
|
+
timeout: waitOptions?.timeout,
|
|
12368
|
+
until: waitOptions?.until,
|
|
11962
12369
|
showProgress: waitOptions?.showProgress,
|
|
11963
12370
|
trackJobs: true
|
|
11964
12371
|
})
|
|
@@ -11968,6 +12375,16 @@ async function startWorkflowCore(options) {
|
|
|
11968
12375
|
throw error;
|
|
11969
12376
|
}
|
|
11970
12377
|
}
|
|
12378
|
+
async function resolveApplicationAuthNamespace(options) {
|
|
12379
|
+
const { config } = await loadConfig(options.configPath);
|
|
12380
|
+
const { application } = await options.client.getApplication({
|
|
12381
|
+
workspaceId: options.workspaceId,
|
|
12382
|
+
applicationName: config.name
|
|
12383
|
+
});
|
|
12384
|
+
const authNamespace = application?.authNamespace || config.auth?.name;
|
|
12385
|
+
if (!authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
12386
|
+
return authNamespace;
|
|
12387
|
+
}
|
|
11971
12388
|
async function startWorkflowByName(options) {
|
|
11972
12389
|
const machineUser = await loadMachineUserName({
|
|
11973
12390
|
machineUser: options.machineUser,
|
|
@@ -11979,18 +12396,17 @@ async function startWorkflowByName(options) {
|
|
|
11979
12396
|
workspaceId: options.workspaceId,
|
|
11980
12397
|
profile: options.profile
|
|
11981
12398
|
});
|
|
11982
|
-
const
|
|
11983
|
-
|
|
12399
|
+
const authNamespace = await resolveApplicationAuthNamespace({
|
|
12400
|
+
client,
|
|
11984
12401
|
workspaceId,
|
|
11985
|
-
|
|
12402
|
+
configPath: options.configPath
|
|
11986
12403
|
});
|
|
11987
|
-
if (!application?.authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
11988
12404
|
return await startWorkflowCore({
|
|
11989
12405
|
client,
|
|
11990
12406
|
workspaceId,
|
|
11991
12407
|
workflowName: options.name,
|
|
11992
|
-
|
|
11993
|
-
namespace:
|
|
12408
|
+
invoker: {
|
|
12409
|
+
namespace: authNamespace,
|
|
11994
12410
|
machineUserName: machineUser
|
|
11995
12411
|
},
|
|
11996
12412
|
arg: options.arg,
|
|
@@ -11999,14 +12415,24 @@ async function startWorkflowByName(options) {
|
|
|
11999
12415
|
}
|
|
12000
12416
|
async function startWorkflow(options) {
|
|
12001
12417
|
if ("name" in options) return await startWorkflowByName(options);
|
|
12418
|
+
const client = await initOperatorClient(await loadAccessToken({ profile: options.profile }));
|
|
12419
|
+
const workspaceId = await loadWorkspaceId({
|
|
12420
|
+
workspaceId: options.workspaceId,
|
|
12421
|
+
profile: options.profile
|
|
12422
|
+
});
|
|
12423
|
+
const authNamespace = await resolveApplicationAuthNamespace({
|
|
12424
|
+
client,
|
|
12425
|
+
workspaceId,
|
|
12426
|
+
configPath: options.configPath
|
|
12427
|
+
});
|
|
12002
12428
|
return await startWorkflowCore({
|
|
12003
|
-
client
|
|
12004
|
-
workspaceId
|
|
12005
|
-
workspaceId: options.workspaceId,
|
|
12006
|
-
profile: options.profile
|
|
12007
|
-
}),
|
|
12429
|
+
client,
|
|
12430
|
+
workspaceId,
|
|
12008
12431
|
workflowName: options.workflow.name,
|
|
12009
|
-
|
|
12432
|
+
invoker: {
|
|
12433
|
+
namespace: authNamespace,
|
|
12434
|
+
machineUserName: options.invoker
|
|
12435
|
+
},
|
|
12010
12436
|
arg: options.arg,
|
|
12011
12437
|
interval: options.interval
|
|
12012
12438
|
});
|
|
@@ -12019,7 +12445,6 @@ const startCommand = defineAppCommand({
|
|
|
12019
12445
|
...nameArgs,
|
|
12020
12446
|
"machine-user": arg(z.string().optional(), {
|
|
12021
12447
|
alias: "m",
|
|
12022
|
-
hiddenAlias: "machineuser",
|
|
12023
12448
|
description: "Machine user name. Falls back to the active profile's default machine user.",
|
|
12024
12449
|
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
12025
12450
|
}),
|
|
@@ -12042,7 +12467,11 @@ const startCommand = defineAppCommand({
|
|
|
12042
12467
|
const jsonOutput = logger.jsonMode;
|
|
12043
12468
|
logger.info(`Execution ID: ${executionId}`, { mode: "stream" });
|
|
12044
12469
|
if (args.wait) {
|
|
12045
|
-
const result = await wait({
|
|
12470
|
+
const result = await wait({
|
|
12471
|
+
showProgress: !jsonOutput,
|
|
12472
|
+
timeout: parseDuration(args.timeout),
|
|
12473
|
+
until: args.until
|
|
12474
|
+
});
|
|
12046
12475
|
if (args.logs && !jsonOutput) {
|
|
12047
12476
|
const { execution } = await getWorkflowExecution({
|
|
12048
12477
|
executionId,
|
|
@@ -12051,7 +12480,20 @@ const startCommand = defineAppCommand({
|
|
|
12051
12480
|
logs: true
|
|
12052
12481
|
});
|
|
12053
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
|
+
});
|
|
12054
12494
|
} else logger.out(result);
|
|
12495
|
+
const failureMessage = getWorkflowWaitFailureMessage(result, args.until);
|
|
12496
|
+
if (failureMessage) throw new Error(failureMessage);
|
|
12055
12497
|
} else logger.out({ executionId });
|
|
12056
12498
|
}
|
|
12057
12499
|
});
|
|
@@ -12061,6 +12503,16 @@ const startCommand = defineAppCommand({
|
|
|
12061
12503
|
function formatTime(date) {
|
|
12062
12504
|
return date.toLocaleTimeString("en-US", { hour12: false });
|
|
12063
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
|
+
}
|
|
12064
12516
|
async function listExecutorJobs(options) {
|
|
12065
12517
|
const executorName = "executorName" in options ? options.executorName : options.executor.name;
|
|
12066
12518
|
const client = await initOperatorClient(await loadAccessToken({ profile: options.profile }));
|
|
@@ -12144,7 +12596,27 @@ async function watchExecutorJob(options) {
|
|
|
12144
12596
|
profile: options.profile
|
|
12145
12597
|
});
|
|
12146
12598
|
const interval = options.interval ?? 3e3;
|
|
12147
|
-
const
|
|
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);
|
|
12148
12620
|
try {
|
|
12149
12621
|
const { executor } = await client.getExecutorExecutor({
|
|
12150
12622
|
workspaceId,
|
|
@@ -12155,29 +12627,47 @@ async function watchExecutorJob(options) {
|
|
|
12155
12627
|
const targetTypeStr = executorTargetTypeToString(targetType);
|
|
12156
12628
|
let job;
|
|
12157
12629
|
while (true) {
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
}
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
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));
|
|
12167
12657
|
}
|
|
12168
12658
|
const jobInfo = toExecutorJobInfo(job);
|
|
12169
12659
|
const coloredStatus = colorizeExecutorJobStatus(jobInfo.status);
|
|
12170
|
-
if (job.status === ExecutorJobStatus.SUCCESS) sp
|
|
12171
|
-
else sp
|
|
12660
|
+
if (job.status === ExecutorJobStatus.SUCCESS) sp?.succeed(`Executor job completed: ${coloredStatus}`);
|
|
12661
|
+
else sp?.fail(`Executor job completed: ${coloredStatus}`);
|
|
12172
12662
|
const attemptInfos = (await fetchAll(async (pageToken, maxPageSize) => {
|
|
12173
|
-
const { attempts, nextPageToken } = await client.listExecutorJobAttempts({
|
|
12663
|
+
const { attempts: jobAttempts, nextPageToken } = await client.listExecutorJobAttempts({
|
|
12174
12664
|
workspaceId,
|
|
12175
12665
|
jobId: options.jobId,
|
|
12176
12666
|
pageToken,
|
|
12177
12667
|
pageSize: maxPageSize,
|
|
12178
12668
|
pageDirection: PageDirection.DESC
|
|
12179
12669
|
});
|
|
12180
|
-
return [
|
|
12670
|
+
return [jobAttempts, nextPageToken];
|
|
12181
12671
|
})).map(toExecutorJobAttemptInfo);
|
|
12182
12672
|
const jobDetail = {
|
|
12183
12673
|
...jobInfo,
|
|
@@ -12186,18 +12676,27 @@ async function watchExecutorJob(options) {
|
|
|
12186
12676
|
const operationReference = attemptInfos[0]?.operationReference;
|
|
12187
12677
|
if (operationReference) switch (targetType) {
|
|
12188
12678
|
case ExecutorTargetType.WORKFLOW:
|
|
12189
|
-
sp
|
|
12679
|
+
sp?.stop();
|
|
12190
12680
|
try {
|
|
12191
|
-
const
|
|
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({
|
|
12192
12688
|
client,
|
|
12193
12689
|
workspaceId,
|
|
12194
12690
|
executionId: operationReference,
|
|
12195
12691
|
interval,
|
|
12196
|
-
|
|
12692
|
+
timeout: workflowTimeout,
|
|
12693
|
+
showProgress,
|
|
12197
12694
|
trackJobs: true
|
|
12198
12695
|
});
|
|
12696
|
+
attempts += executionResult.attempts;
|
|
12697
|
+
lastError = executionResult.lastError;
|
|
12199
12698
|
let workflowJobLogs;
|
|
12200
|
-
if (options.logs) {
|
|
12699
|
+
if (options.logs) try {
|
|
12201
12700
|
const { execution: execWithLogs } = await getWorkflowExecution({
|
|
12202
12701
|
executionId: operationReference,
|
|
12203
12702
|
workspaceId: options.workspaceId,
|
|
@@ -12209,67 +12708,109 @@ async function watchExecutorJob(options) {
|
|
|
12209
12708
|
logs: job.logs,
|
|
12210
12709
|
result: job.result
|
|
12211
12710
|
}));
|
|
12711
|
+
} catch (error) {
|
|
12712
|
+
logger.warn(`Could not fetch workflow execution logs: ${error instanceof Error ? error.message : error}`);
|
|
12212
12713
|
}
|
|
12213
|
-
return {
|
|
12714
|
+
return withWaitMetadata({
|
|
12214
12715
|
job: jobDetail,
|
|
12215
12716
|
targetType: targetTypeStr,
|
|
12216
12717
|
workflowExecutionId: operationReference,
|
|
12217
12718
|
workflowStatus: executionResult.status,
|
|
12218
12719
|
workflowJobLogs
|
|
12219
|
-
};
|
|
12720
|
+
}, executionResult.timedOut);
|
|
12220
12721
|
} catch (error) {
|
|
12221
12722
|
logger.warn(`Could not track workflow execution: ${error instanceof Error ? error.message : error}`);
|
|
12222
|
-
return {
|
|
12723
|
+
return withWaitMetadata({
|
|
12223
12724
|
job: jobDetail,
|
|
12224
12725
|
targetType: targetTypeStr,
|
|
12225
12726
|
workflowExecutionId: operationReference
|
|
12226
|
-
};
|
|
12727
|
+
}, false);
|
|
12227
12728
|
}
|
|
12228
12729
|
case ExecutorTargetType.FUNCTION:
|
|
12229
12730
|
case ExecutorTargetType.JOB_FUNCTION:
|
|
12230
|
-
sp
|
|
12731
|
+
sp?.start(`Waiting for function execution ${operationReference}...`);
|
|
12231
12732
|
try {
|
|
12733
|
+
let functionStatus;
|
|
12232
12734
|
while (true) {
|
|
12233
|
-
const
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12237
|
-
if (!execution) throw new Error(`Function execution '${operationReference}' not found.`);
|
|
12238
|
-
if (isFunctionExecutionTerminalStatus(execution.status)) {
|
|
12239
|
-
const statusStr = functionExecutionStatusToString(execution.status);
|
|
12240
|
-
const coloredFnStatus = colorizeFunctionExecutionStatus(statusStr);
|
|
12241
|
-
if (execution.status === FunctionExecution_Status.SUCCESS) sp.succeed(`Function execution completed: ${coloredFnStatus}`);
|
|
12242
|
-
else sp.fail(`Function execution completed: ${coloredFnStatus}`);
|
|
12243
|
-
return {
|
|
12735
|
+
const functionTimeout = remainingTimeout();
|
|
12736
|
+
if (functionTimeout !== void 0 && functionTimeout <= 0) {
|
|
12737
|
+
sp?.fail("Function execution wait timed out.");
|
|
12738
|
+
return withWaitMetadata({
|
|
12244
12739
|
job: jobDetail,
|
|
12245
12740
|
targetType: targetTypeStr,
|
|
12246
12741
|
functionExecutionId: operationReference,
|
|
12247
|
-
functionStatus
|
|
12248
|
-
|
|
12249
|
-
|
|
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);
|
|
12250
12780
|
}
|
|
12251
|
-
sp.text = `Waiting for function execution... (${formatTime(/* @__PURE__ */ new Date())})`;
|
|
12252
|
-
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));
|
|
12253
12783
|
}
|
|
12254
12784
|
} catch (error) {
|
|
12255
|
-
sp
|
|
12256
|
-
return {
|
|
12785
|
+
sp?.warn(`Could not track function execution: ${error instanceof Error ? error.message : error}`);
|
|
12786
|
+
return withWaitMetadata({
|
|
12257
12787
|
job: jobDetail,
|
|
12258
12788
|
targetType: targetTypeStr,
|
|
12259
12789
|
functionExecutionId: operationReference
|
|
12260
|
-
};
|
|
12790
|
+
}, false);
|
|
12261
12791
|
}
|
|
12262
12792
|
break;
|
|
12263
12793
|
default: break;
|
|
12264
12794
|
}
|
|
12265
|
-
return {
|
|
12795
|
+
return withWaitMetadata({
|
|
12266
12796
|
job: jobDetail,
|
|
12267
12797
|
targetType: targetTypeStr
|
|
12268
|
-
};
|
|
12798
|
+
}, false);
|
|
12269
12799
|
} finally {
|
|
12270
|
-
sp
|
|
12800
|
+
sp?.stop();
|
|
12271
12801
|
}
|
|
12272
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
|
+
}
|
|
12273
12814
|
function printJobWithAttempts(job) {
|
|
12274
12815
|
const summaryData = [
|
|
12275
12816
|
["id", job.id],
|
|
@@ -12351,6 +12892,10 @@ const jobsCommand = defineAppCommand({
|
|
|
12351
12892
|
alias: "i",
|
|
12352
12893
|
description: "Polling interval when using --wait (e.g., '3s', '500ms', '1m')"
|
|
12353
12894
|
}),
|
|
12895
|
+
timeout: arg(durationArg.default("5m"), {
|
|
12896
|
+
alias: "t",
|
|
12897
|
+
description: "Maximum time to wait when using --wait (e.g., '30s', '5m')"
|
|
12898
|
+
}),
|
|
12354
12899
|
...pagedLogArgs,
|
|
12355
12900
|
limit: arg(nonNegativeIntArg.default(50), { description: "Maximum number of jobs to list (0: unlimited, default: 50) (list mode only)" }),
|
|
12356
12901
|
logs: arg(z.boolean().default(false), {
|
|
@@ -12359,6 +12904,7 @@ const jobsCommand = defineAppCommand({
|
|
|
12359
12904
|
})
|
|
12360
12905
|
}).strict(),
|
|
12361
12906
|
run: async (args) => {
|
|
12907
|
+
const jsonOutput = logger.jsonMode || args.json;
|
|
12362
12908
|
if (args.jobId) {
|
|
12363
12909
|
if (args.wait) {
|
|
12364
12910
|
const result = await watchExecutorJob({
|
|
@@ -12367,9 +12913,11 @@ const jobsCommand = defineAppCommand({
|
|
|
12367
12913
|
workspaceId: args["workspace-id"],
|
|
12368
12914
|
profile: args.profile,
|
|
12369
12915
|
interval: parseDuration(args.interval),
|
|
12370
|
-
|
|
12916
|
+
timeout: parseDuration(args.timeout),
|
|
12917
|
+
logs: args.logs,
|
|
12918
|
+
showProgress: !jsonOutput
|
|
12371
12919
|
});
|
|
12372
|
-
if (!
|
|
12920
|
+
if (!jsonOutput) {
|
|
12373
12921
|
logger.log(styles.bold(`Target Type: ${result.targetType}\n`));
|
|
12374
12922
|
printJobWithAttempts(result.job);
|
|
12375
12923
|
if (result.workflowExecutionId) {
|
|
@@ -12404,6 +12952,8 @@ const jobsCommand = defineAppCommand({
|
|
|
12404
12952
|
}
|
|
12405
12953
|
}
|
|
12406
12954
|
} else logger.out(result);
|
|
12955
|
+
const failureMessage = getExecutorWaitFailureMessage(result);
|
|
12956
|
+
if (failureMessage) throw new Error(failureMessage);
|
|
12407
12957
|
return;
|
|
12408
12958
|
}
|
|
12409
12959
|
const job = await getExecutorJob({
|
|
@@ -12413,7 +12963,7 @@ const jobsCommand = defineAppCommand({
|
|
|
12413
12963
|
workspaceId: args["workspace-id"],
|
|
12414
12964
|
profile: args.profile
|
|
12415
12965
|
});
|
|
12416
|
-
if (args.attempts && !
|
|
12966
|
+
if (args.attempts && !jsonOutput) printJobWithAttempts(job);
|
|
12417
12967
|
else logger.out(job);
|
|
12418
12968
|
} else {
|
|
12419
12969
|
if (args.wait) logger.warn("--wait flag is ignored in list mode. Specify a job ID to wait.");
|
|
@@ -12600,12 +13150,17 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
12600
13150
|
alias: "i",
|
|
12601
13151
|
description: "Polling interval when using --wait (e.g., '3s', '500ms', '1m')"
|
|
12602
13152
|
}),
|
|
13153
|
+
timeout: arg(durationArg.default("5m"), {
|
|
13154
|
+
alias: "t",
|
|
13155
|
+
description: "Maximum time to wait when using --wait (e.g., '30s', '5m')"
|
|
13156
|
+
}),
|
|
12603
13157
|
logs: arg(z.boolean().default(false), {
|
|
12604
13158
|
alias: "l",
|
|
12605
13159
|
description: "Display function execution logs after completion (requires --wait)"
|
|
12606
13160
|
})
|
|
12607
13161
|
}).strict(),
|
|
12608
13162
|
run: async (args) => {
|
|
13163
|
+
const jsonOutput = logger.jsonMode || args.json;
|
|
12609
13164
|
await assertWritable({ profile: args.profile });
|
|
12610
13165
|
const client = await initOperatorClient(await loadAccessToken({ profile: args.profile }));
|
|
12611
13166
|
const workspaceId = await loadWorkspaceId({
|
|
@@ -12646,9 +13201,11 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
12646
13201
|
workspaceId: args["workspace-id"],
|
|
12647
13202
|
profile: args.profile,
|
|
12648
13203
|
interval: parseDuration(args.interval),
|
|
12649
|
-
|
|
13204
|
+
timeout: parseDuration(args.timeout),
|
|
13205
|
+
logs: args.logs,
|
|
13206
|
+
showProgress: !jsonOutput
|
|
12650
13207
|
});
|
|
12651
|
-
if (!
|
|
13208
|
+
if (!jsonOutput) {
|
|
12652
13209
|
logger.log(styles.bold(`\nTarget Type: ${watchResult.targetType}`));
|
|
12653
13210
|
logger.log(`Job Status: ${watchResult.job.status}`);
|
|
12654
13211
|
if (watchResult.workflowExecutionId) {
|
|
@@ -12683,6 +13240,8 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
12683
13240
|
}
|
|
12684
13241
|
}
|
|
12685
13242
|
} else logger.out(watchResult);
|
|
13243
|
+
const failureMessage = getExecutorWaitFailureMessage(watchResult);
|
|
13244
|
+
if (failureMessage) throw new Error(failureMessage);
|
|
12686
13245
|
}
|
|
12687
13246
|
}
|
|
12688
13247
|
});
|
|
@@ -12894,19 +13453,6 @@ const listCommand$8 = defineAppCommand({
|
|
|
12894
13453
|
}
|
|
12895
13454
|
});
|
|
12896
13455
|
|
|
12897
|
-
//#endregion
|
|
12898
|
-
//#region src/cli/commands/generate/types.ts
|
|
12899
|
-
/**
|
|
12900
|
-
* Type guard to check if a generator has a specific dependency.
|
|
12901
|
-
* @template D
|
|
12902
|
-
* @param generator - Code generator instance
|
|
12903
|
-
* @param dependency - Dependency kind to check
|
|
12904
|
-
* @returns True if the generator has the dependency
|
|
12905
|
-
*/
|
|
12906
|
-
function hasDependency(generator, dependency) {
|
|
12907
|
-
return generator.dependencies.includes(dependency);
|
|
12908
|
-
}
|
|
12909
|
-
|
|
12910
13456
|
//#endregion
|
|
12911
13457
|
//#region src/cli/commands/generate/watch/index.ts
|
|
12912
13458
|
/**
|
|
@@ -13295,12 +13841,11 @@ function createDependencyWatcher(options = {}) {
|
|
|
13295
13841
|
* @param params - Parameters for creating the generation manager
|
|
13296
13842
|
* @param params.application - Application instance to generate code for
|
|
13297
13843
|
* @param params.config - Loaded configuration
|
|
13298
|
-
* @param params.generators - Code generators to run
|
|
13299
13844
|
* @param params.pluginManager - Plugin manager for processing plugins
|
|
13300
13845
|
* @returns GenerationManager instance
|
|
13301
13846
|
*/
|
|
13302
13847
|
function createGenerationManager(params) {
|
|
13303
|
-
const { application, config,
|
|
13848
|
+
const { application, config, pluginManager } = params;
|
|
13304
13849
|
const baseDir = path.join(getDistDir(), "generated");
|
|
13305
13850
|
fs$1.mkdirSync(baseDir, { recursive: true });
|
|
13306
13851
|
const services = {
|
|
@@ -13309,11 +13854,7 @@ function createGenerationManager(params) {
|
|
|
13309
13854
|
executor: {}
|
|
13310
13855
|
};
|
|
13311
13856
|
let watcher = null;
|
|
13312
|
-
const generatorResults = {};
|
|
13313
13857
|
const generationPlugins = pluginManager?.getPluginsWithGenerationHooks() ?? [];
|
|
13314
|
-
function getReadyGenerators(dep) {
|
|
13315
|
-
return generators.filter((g) => g.dependencies.includes(dep));
|
|
13316
|
-
}
|
|
13317
13858
|
function getAuthInput() {
|
|
13318
13859
|
const authService = application.authService;
|
|
13319
13860
|
if (!authService) return void 0;
|
|
@@ -13331,98 +13872,6 @@ function createGenerationManager(params) {
|
|
|
13331
13872
|
idProvider: authConfig.idProvider
|
|
13332
13873
|
};
|
|
13333
13874
|
}
|
|
13334
|
-
async function processTailorDBNamespace(gen, namespace, typeInfo) {
|
|
13335
|
-
const results = assertDefined(generatorResults[gen.id], `generator result not initialized for ${gen.id}`);
|
|
13336
|
-
results.tailordbResults[namespace] = {};
|
|
13337
|
-
if (!gen.processType) return;
|
|
13338
|
-
const processType = gen.processType;
|
|
13339
|
-
await Promise.allSettled(Object.entries(typeInfo.types).map(async ([typeName, type]) => {
|
|
13340
|
-
try {
|
|
13341
|
-
assertDefined(results.tailordbResults[namespace], `tailordb results not initialized for namespace ${namespace}`)[typeName] = await processType({
|
|
13342
|
-
type,
|
|
13343
|
-
namespace,
|
|
13344
|
-
source: typeInfo.sourceInfo[typeName],
|
|
13345
|
-
plugins: typeInfo.pluginAttachments.get(typeName) ?? []
|
|
13346
|
-
});
|
|
13347
|
-
} catch (error) {
|
|
13348
|
-
logger.error(`Error processing type ${styles.bold(typeName)} in ${namespace} with generator ${gen.id}`);
|
|
13349
|
-
logger.error(String(error));
|
|
13350
|
-
}
|
|
13351
|
-
}));
|
|
13352
|
-
if ("processTailorDBNamespace" in gen && typeof gen.processTailorDBNamespace === "function") try {
|
|
13353
|
-
results.tailordbNamespaceResults[namespace] = await gen.processTailorDBNamespace({
|
|
13354
|
-
namespace,
|
|
13355
|
-
types: results.tailordbResults[namespace]
|
|
13356
|
-
});
|
|
13357
|
-
} catch (error) {
|
|
13358
|
-
logger.error(`Error processing TailorDB namespace ${styles.bold(namespace)} with generator ${gen.id}`);
|
|
13359
|
-
logger.error(String(error));
|
|
13360
|
-
}
|
|
13361
|
-
else results.tailordbNamespaceResults[namespace] = results.tailordbResults[namespace];
|
|
13362
|
-
}
|
|
13363
|
-
async function processResolverNamespace(gen, namespace, resolvers) {
|
|
13364
|
-
const results = assertDefined(generatorResults[gen.id], `generator result not initialized for ${gen.id}`);
|
|
13365
|
-
results.resolverResults[namespace] = {};
|
|
13366
|
-
if (!gen.processResolver) return;
|
|
13367
|
-
const processResolver = gen.processResolver;
|
|
13368
|
-
await Promise.allSettled(Object.entries(resolvers).map(async ([resolverName, resolver]) => {
|
|
13369
|
-
try {
|
|
13370
|
-
assertDefined(results.resolverResults[namespace], `resolver results not initialized for namespace ${namespace}`)[resolverName] = await processResolver({
|
|
13371
|
-
resolver,
|
|
13372
|
-
namespace
|
|
13373
|
-
});
|
|
13374
|
-
} catch (error) {
|
|
13375
|
-
logger.error(`Error processing resolver ${styles.bold(resolverName)} in ${namespace} with generator ${gen.id}`);
|
|
13376
|
-
logger.error(String(error));
|
|
13377
|
-
}
|
|
13378
|
-
}));
|
|
13379
|
-
if ("processResolverNamespace" in gen && typeof gen.processResolverNamespace === "function") try {
|
|
13380
|
-
results.resolverNamespaceResults[namespace] = await gen.processResolverNamespace({
|
|
13381
|
-
namespace,
|
|
13382
|
-
resolvers: results.resolverResults[namespace]
|
|
13383
|
-
});
|
|
13384
|
-
} catch (error) {
|
|
13385
|
-
logger.error(`Error processing Resolver namespace ${styles.bold(namespace)} with generator ${gen.id}`);
|
|
13386
|
-
logger.error(String(error));
|
|
13387
|
-
}
|
|
13388
|
-
else results.resolverNamespaceResults[namespace] = results.resolverResults[namespace];
|
|
13389
|
-
}
|
|
13390
|
-
async function processExecutors(gen) {
|
|
13391
|
-
const results = assertDefined(generatorResults[gen.id], `generator result not initialized for ${gen.id}`);
|
|
13392
|
-
if (!gen.processExecutor) return;
|
|
13393
|
-
const processExecutor = gen.processExecutor;
|
|
13394
|
-
await Promise.allSettled(Object.entries(services.executor).map(async ([executorId, executor]) => {
|
|
13395
|
-
try {
|
|
13396
|
-
results.executorResults[executorId] = await processExecutor(executor);
|
|
13397
|
-
} catch (error) {
|
|
13398
|
-
logger.error(`Error processing executor ${styles.bold(executor.name)} with generator ${gen.id}`);
|
|
13399
|
-
logger.error(String(error));
|
|
13400
|
-
}
|
|
13401
|
-
}));
|
|
13402
|
-
}
|
|
13403
|
-
async function aggregate(gen) {
|
|
13404
|
-
const results = assertDefined(generatorResults[gen.id], `generator result not initialized for ${gen.id}`);
|
|
13405
|
-
const tailordbResults = [];
|
|
13406
|
-
const resolverResults = [];
|
|
13407
|
-
for (const [namespace, types] of Object.entries(results.tailordbNamespaceResults)) tailordbResults.push({
|
|
13408
|
-
namespace,
|
|
13409
|
-
types
|
|
13410
|
-
});
|
|
13411
|
-
for (const [namespace, resolvers] of Object.entries(results.resolverNamespaceResults)) resolverResults.push({
|
|
13412
|
-
namespace,
|
|
13413
|
-
resolvers
|
|
13414
|
-
});
|
|
13415
|
-
const input = { auth: getAuthInput() };
|
|
13416
|
-
if (hasDependency(gen, "tailordb")) input.tailordb = tailordbResults;
|
|
13417
|
-
if (hasDependency(gen, "resolver")) input.resolver = resolverResults;
|
|
13418
|
-
if (hasDependency(gen, "executor")) input.executor = Object.values(results.executorResults);
|
|
13419
|
-
const result = await gen.aggregate({
|
|
13420
|
-
input,
|
|
13421
|
-
baseDir: path.join(baseDir, gen.id),
|
|
13422
|
-
configPath: config.path
|
|
13423
|
-
});
|
|
13424
|
-
await writeGeneratedFiles(gen.id, result);
|
|
13425
|
-
}
|
|
13426
13875
|
/**
|
|
13427
13876
|
* Build TailorDB namespace data array from loaded services.
|
|
13428
13877
|
* @returns Array of TailorDB namespace data
|
|
@@ -13517,8 +13966,8 @@ function createGenerationManager(params) {
|
|
|
13517
13966
|
}
|
|
13518
13967
|
/**
|
|
13519
13968
|
* Write generated files to disk.
|
|
13520
|
-
* @param sourceId -
|
|
13521
|
-
* @param result -
|
|
13969
|
+
* @param sourceId - Plugin ID for logging
|
|
13970
|
+
* @param result - Generation result containing files to write
|
|
13522
13971
|
*/
|
|
13523
13972
|
async function writeGeneratedFiles(sourceId, result) {
|
|
13524
13973
|
await Promise.all(result.files.map(async (file) => {
|
|
@@ -13552,36 +14001,6 @@ function createGenerationManager(params) {
|
|
|
13552
14001
|
});
|
|
13553
14002
|
}));
|
|
13554
14003
|
}
|
|
13555
|
-
async function processGenerator(gen) {
|
|
13556
|
-
generatorResults[gen.id] = {
|
|
13557
|
-
tailordbResults: {},
|
|
13558
|
-
resolverResults: {},
|
|
13559
|
-
tailordbNamespaceResults: {},
|
|
13560
|
-
resolverNamespaceResults: {},
|
|
13561
|
-
executorResults: {}
|
|
13562
|
-
};
|
|
13563
|
-
if (hasDependency(gen, "tailordb")) for (const [namespace, types] of Object.entries(services.tailordb)) await processTailorDBNamespace(gen, namespace, types);
|
|
13564
|
-
if (hasDependency(gen, "resolver")) for (const [namespace, resolvers] of Object.entries(services.resolver)) await processResolverNamespace(gen, namespace, resolvers);
|
|
13565
|
-
if (hasDependency(gen, "executor")) await processExecutors(gen);
|
|
13566
|
-
await aggregate(gen);
|
|
13567
|
-
}
|
|
13568
|
-
async function runGenerators(gens, watch) {
|
|
13569
|
-
const results = await Promise.allSettled(gens.map(async (gen) => {
|
|
13570
|
-
await withSpan(`generate.generator.${gen.id}`, async () => {
|
|
13571
|
-
try {
|
|
13572
|
-
await processGenerator(gen);
|
|
13573
|
-
} catch (error) {
|
|
13574
|
-
logger.error(`Error processing generator ${styles.bold(gen.id)}`);
|
|
13575
|
-
logger.error(String(error));
|
|
13576
|
-
if (!watch) throw error;
|
|
13577
|
-
}
|
|
13578
|
-
});
|
|
13579
|
-
}));
|
|
13580
|
-
if (!watch) {
|
|
13581
|
-
const failures = results.filter((r) => r.status === "rejected");
|
|
13582
|
-
if (failures.length > 0) throw new AggregateError(failures.map((f) => f.reason));
|
|
13583
|
-
}
|
|
13584
|
-
}
|
|
13585
14004
|
async function restartWatchProcess() {
|
|
13586
14005
|
logger.newline();
|
|
13587
14006
|
logger.info("Restarting watch process to clear module cache...", { mode: "stream" });
|
|
@@ -13609,14 +14028,7 @@ function createGenerationManager(params) {
|
|
|
13609
14028
|
return {
|
|
13610
14029
|
application,
|
|
13611
14030
|
baseDir,
|
|
13612
|
-
generators,
|
|
13613
14031
|
services,
|
|
13614
|
-
generatorResults,
|
|
13615
|
-
processGenerator,
|
|
13616
|
-
processTailorDBNamespace,
|
|
13617
|
-
processResolverNamespace,
|
|
13618
|
-
processExecutors,
|
|
13619
|
-
aggregate,
|
|
13620
14032
|
async generate(watch) {
|
|
13621
14033
|
logger.newline();
|
|
13622
14034
|
logger.log(`Generation for application: ${styles.highlight(application.config.name)}`);
|
|
@@ -13661,11 +14073,9 @@ function createGenerationManager(params) {
|
|
|
13661
14073
|
await withSpan("generate.resolveAuthNamespaces", async () => authService.resolveNamespaces());
|
|
13662
14074
|
}
|
|
13663
14075
|
if (app.tailorDBServices.length > 0 || pluginExecutorFiles.length > 0) logger.newline();
|
|
13664
|
-
|
|
13665
|
-
const hasOnTailorDBReady = generationPlugins.some((p) => p.onTailorDBReady != null);
|
|
13666
|
-
if (readyAfterTailorDB.length > 0 || hasOnTailorDBReady) {
|
|
14076
|
+
if (generationPlugins.some((p) => p.onTailorDBReady != null)) {
|
|
13667
14077
|
await withSpan("generate.onTailorDBReady", async () => {
|
|
13668
|
-
await
|
|
14078
|
+
await runPluginHook("onTailorDBReady", watch);
|
|
13669
14079
|
});
|
|
13670
14080
|
logger.newline();
|
|
13671
14081
|
}
|
|
@@ -13688,11 +14098,9 @@ function createGenerationManager(params) {
|
|
|
13688
14098
|
});
|
|
13689
14099
|
}
|
|
13690
14100
|
});
|
|
13691
|
-
|
|
13692
|
-
const hasOnResolverReady = generationPlugins.some((p) => p.onResolverReady != null);
|
|
13693
|
-
if (readyAfterResolvers.length > 0 || hasOnResolverReady) {
|
|
14101
|
+
if (generationPlugins.some((p) => p.onResolverReady != null)) {
|
|
13694
14102
|
await withSpan("generate.onResolversReady", async () => {
|
|
13695
|
-
await
|
|
14103
|
+
await runPluginHook("onResolverReady", watch);
|
|
13696
14104
|
});
|
|
13697
14105
|
logger.newline();
|
|
13698
14106
|
}
|
|
@@ -13706,11 +14114,9 @@ function createGenerationManager(params) {
|
|
|
13706
14114
|
services.executor[key] = executor;
|
|
13707
14115
|
});
|
|
13708
14116
|
});
|
|
13709
|
-
|
|
13710
|
-
const hasOnExecutorReady = generationPlugins.some((p) => p.onExecutorReady != null);
|
|
13711
|
-
if (readyAfterExecutors.length > 0 || hasOnExecutorReady) {
|
|
14117
|
+
if (generationPlugins.some((p) => p.onExecutorReady != null)) {
|
|
13712
14118
|
await withSpan("generate.onExecutorsReady", async () => {
|
|
13713
|
-
await
|
|
14119
|
+
await runPluginHook("onExecutorReady", watch);
|
|
13714
14120
|
});
|
|
13715
14121
|
logger.newline();
|
|
13716
14122
|
}
|
|
@@ -13735,18 +14141,17 @@ function createGenerationManager(params) {
|
|
|
13735
14141
|
};
|
|
13736
14142
|
}
|
|
13737
14143
|
/**
|
|
13738
|
-
* Run code generation using the Tailor configuration
|
|
14144
|
+
* Run code generation using the Tailor configuration.
|
|
13739
14145
|
* @param options - Generation options
|
|
13740
14146
|
* @returns Promise that resolves when generation (and watch, if enabled) completes
|
|
13741
14147
|
*/
|
|
13742
14148
|
async function generate$1(options) {
|
|
13743
14149
|
return withSpan("generate", async (rootSpan) => {
|
|
13744
|
-
const { config,
|
|
14150
|
+
const { config, plugins } = await withSpan("generate.loadConfig", async () => {
|
|
13745
14151
|
return loadConfig(options?.configPath);
|
|
13746
14152
|
});
|
|
13747
14153
|
const watch = options?.watch ?? false;
|
|
13748
14154
|
rootSpan.setAttribute("generate.watch", watch);
|
|
13749
|
-
rootSpan.setAttribute("generate.generators.count", generators.length);
|
|
13750
14155
|
await withSpan("generate.generateUserTypes", async () => generateUserTypes({
|
|
13751
14156
|
config,
|
|
13752
14157
|
configPath: config.path
|
|
@@ -13761,7 +14166,6 @@ async function generate$1(options) {
|
|
|
13761
14166
|
const manager = createGenerationManager({
|
|
13762
14167
|
application,
|
|
13763
14168
|
config,
|
|
13764
|
-
generators,
|
|
13765
14169
|
pluginManager
|
|
13766
14170
|
});
|
|
13767
14171
|
await manager.generate(watch);
|
|
@@ -14561,6 +14965,7 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14561
14965
|
};
|
|
14562
14966
|
const tailorDB = await planTailorDB(ctx);
|
|
14563
14967
|
const staticWebsite = await planStaticWebsite(ctx);
|
|
14968
|
+
const aiGateway = await planAIGateway(ctx);
|
|
14564
14969
|
const idp = await planIdP(ctx);
|
|
14565
14970
|
const auth = await planAuth(ctx);
|
|
14566
14971
|
const pipeline = await planPipeline(ctx);
|
|
@@ -14571,6 +14976,7 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14571
14976
|
const secretManager = await planSecretManager(ctx);
|
|
14572
14977
|
functionRegistry.changeSet.print();
|
|
14573
14978
|
staticWebsite.changeSet.print();
|
|
14979
|
+
aiGateway.changeSet.print();
|
|
14574
14980
|
app.print();
|
|
14575
14981
|
tailorDB.changeSet.service.print();
|
|
14576
14982
|
tailorDB.changeSet.type.print();
|
|
@@ -14593,11 +14999,12 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14593
14999
|
auth.changeSet.connection.print();
|
|
14594
15000
|
secretManager.vaultChangeSet.print();
|
|
14595
15001
|
secretManager.secretChangeSet.print();
|
|
14596
|
-
if (tailorDB.changeSet.service.deletes.length === 0 && staticWebsite.changeSet.deletes.length === 0 && idp.changeSet.service.deletes.length === 0 && auth.changeSet.service.deletes.length === 0 && pipeline.changeSet.service.deletes.length === 0 && app.deletes.length === 0 && executor.changeSet.deletes.length === 0 && workflow.changeSet.deletes.length === 0 && functionRegistry.changeSet.deletes.length === 0 && secretManager.vaultChangeSet.deletes.length === 0 && secretManager.secretChangeSet.deletes.length === 0) return;
|
|
15002
|
+
if (tailorDB.changeSet.service.deletes.length === 0 && staticWebsite.changeSet.deletes.length === 0 && aiGateway.changeSet.deletes.length === 0 && idp.changeSet.service.deletes.length === 0 && auth.changeSet.service.deletes.length === 0 && pipeline.changeSet.service.deletes.length === 0 && app.deletes.length === 0 && executor.changeSet.deletes.length === 0 && workflow.changeSet.deletes.length === 0 && functionRegistry.changeSet.deletes.length === 0 && secretManager.vaultChangeSet.deletes.length === 0 && secretManager.secretChangeSet.deletes.length === 0) return;
|
|
14597
15003
|
if (confirm) await confirm();
|
|
14598
15004
|
await applyWorkflow(client, workflow, "delete");
|
|
14599
15005
|
await applyExecutor(client, executor, "delete");
|
|
14600
15006
|
await applyStaticWebsite(client, staticWebsite, "delete");
|
|
15007
|
+
await applyAIGateway(client, aiGateway, "delete");
|
|
14601
15008
|
await applyApplication(client, app, "delete");
|
|
14602
15009
|
await applyPipeline(client, pipeline, "delete-resources");
|
|
14603
15010
|
await applyPipeline(client, pipeline, "delete-services");
|
|
@@ -15064,6 +15471,11 @@ function generateEnumChangeColumnType(enumValueChange, config) {
|
|
|
15064
15471
|
if (!config.required) return `ColumnType<(${selectType}) | null, (${afterType}) | null, (${afterType}) | null>`;
|
|
15065
15472
|
return `ColumnType<${selectType}, ${afterType}, ${afterType}>`;
|
|
15066
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
|
+
}
|
|
15067
15479
|
/**
|
|
15068
15480
|
* Generate field type from snapshot field config
|
|
15069
15481
|
* @param {SnapshotFieldConfig} config - Field configuration
|
|
@@ -15089,11 +15501,19 @@ function generateFieldType(config, isOptionalToRequired, enumValueChange) {
|
|
|
15089
15501
|
}
|
|
15090
15502
|
let type = baseType;
|
|
15091
15503
|
if (config.array) type = config.type === "enum" && config.allowedValues && config.allowedValues.length > 0 ? `(${baseType})[]` : `${baseType}[]`;
|
|
15092
|
-
if (isOptionalToRequired)
|
|
15093
|
-
|
|
15094
|
-
|
|
15095
|
-
|
|
15096
|
-
|
|
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
|
+
}
|
|
15097
15517
|
if (!config.required) type = `${type} | null`;
|
|
15098
15518
|
return {
|
|
15099
15519
|
type,
|
|
@@ -15384,7 +15804,7 @@ async function generate(options) {
|
|
|
15384
15804
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
15385
15805
|
let pluginManager;
|
|
15386
15806
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
15387
|
-
const { defineApplication } = await import("./application-
|
|
15807
|
+
const { defineApplication } = await import("./application-Dtqap5jM.mjs");
|
|
15388
15808
|
const application = defineApplication({
|
|
15389
15809
|
config,
|
|
15390
15810
|
pluginManager
|
|
@@ -15817,11 +16237,13 @@ async function resumeWorkflow(options) {
|
|
|
15817
16237
|
});
|
|
15818
16238
|
return {
|
|
15819
16239
|
executionId,
|
|
15820
|
-
wait: (waitOptions) =>
|
|
16240
|
+
wait: (waitOptions) => waitForWorkflowExecution({
|
|
15821
16241
|
client,
|
|
15822
16242
|
workspaceId,
|
|
15823
16243
|
executionId,
|
|
15824
16244
|
interval: options.interval ?? 3e3,
|
|
16245
|
+
timeout: waitOptions?.timeout,
|
|
16246
|
+
until: waitOptions?.until,
|
|
15825
16247
|
showProgress: waitOptions?.showProgress
|
|
15826
16248
|
})
|
|
15827
16249
|
};
|
|
@@ -15845,16 +16267,21 @@ const resumeCommand = defineAppCommand({
|
|
|
15845
16267
|
...waitArgs
|
|
15846
16268
|
}).strict(),
|
|
15847
16269
|
run: async (args) => {
|
|
16270
|
+
const jsonOutput = logger.jsonMode || args.json;
|
|
15848
16271
|
const { executionId, wait } = await resumeWorkflow({
|
|
15849
16272
|
executionId: args.executionId,
|
|
15850
16273
|
workspaceId: args["workspace-id"],
|
|
15851
16274
|
profile: args.profile,
|
|
15852
16275
|
interval: parseDuration(args.interval)
|
|
15853
16276
|
});
|
|
15854
|
-
if (!
|
|
16277
|
+
if (!jsonOutput) logger.info(`Execution ID: ${executionId}`, { mode: "stream" });
|
|
15855
16278
|
if (args.wait) {
|
|
15856
|
-
const result = await wait({
|
|
15857
|
-
|
|
16279
|
+
const result = await wait({
|
|
16280
|
+
showProgress: !jsonOutput,
|
|
16281
|
+
timeout: parseDuration(args.timeout),
|
|
16282
|
+
until: args.until
|
|
16283
|
+
});
|
|
16284
|
+
if (args.logs && !jsonOutput) {
|
|
15858
16285
|
const { execution } = await getWorkflowExecution({
|
|
15859
16286
|
executionId,
|
|
15860
16287
|
workspaceId: args["workspace-id"],
|
|
@@ -15862,11 +16289,112 @@ const resumeCommand = defineAppCommand({
|
|
|
15862
16289
|
logs: true
|
|
15863
16290
|
});
|
|
15864
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
|
+
});
|
|
15865
16303
|
} else logger.out(result);
|
|
16304
|
+
const failureMessage = getWorkflowWaitFailureMessage(result, args.until);
|
|
16305
|
+
if (failureMessage) throw new Error(failureMessage);
|
|
15866
16306
|
} else logger.out({ executionId });
|
|
15867
16307
|
}
|
|
15868
16308
|
});
|
|
15869
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
|
+
|
|
15870
16398
|
//#endregion
|
|
15871
16399
|
//#region src/cli/commands/workspace/app/transform.ts
|
|
15872
16400
|
const statusToString = (status) => {
|
|
@@ -16089,7 +16617,7 @@ const createCommand = defineAppCommand({
|
|
|
16089
16617
|
alias: "p",
|
|
16090
16618
|
description: "Profile name to create"
|
|
16091
16619
|
}),
|
|
16092
|
-
"profile-user": arg(z.string().optional(), { description: "User email for the profile (defaults to current user)" }),
|
|
16620
|
+
"profile-user": arg(z.string().optional(), { description: "User email address or machine user client ID for the profile (defaults to current user)" }),
|
|
16093
16621
|
permission: arg(z.enum(["write", "read"]).default("write"), { description: "Profile permission (requires --profile-name). 'read' blocks all write commands while the profile is active." })
|
|
16094
16622
|
}).strict(),
|
|
16095
16623
|
run: async (args) => {
|
|
@@ -17030,10 +17558,10 @@ async function sqlQuery(client, invoker, args) {
|
|
|
17030
17558
|
workspaceId: args.workspaceId,
|
|
17031
17559
|
name: `query-sql-${args.namespace}.js`,
|
|
17032
17560
|
code: args.bundledCode,
|
|
17033
|
-
arg:
|
|
17561
|
+
arg: {
|
|
17034
17562
|
namespace: args.namespace,
|
|
17035
17563
|
queries
|
|
17036
|
-
}
|
|
17564
|
+
},
|
|
17037
17565
|
invoker
|
|
17038
17566
|
});
|
|
17039
17567
|
if (!executed.success) throw new Error(executed.error);
|
|
@@ -17051,11 +17579,11 @@ async function gqlQuery(client, invoker, application, machineUser, args) {
|
|
|
17051
17579
|
workspaceId: args.workspaceId,
|
|
17052
17580
|
name: `query-gql.js`,
|
|
17053
17581
|
code: args.bundledCode,
|
|
17054
|
-
arg:
|
|
17582
|
+
arg: {
|
|
17055
17583
|
endpoint: `${application.url}/query`,
|
|
17056
17584
|
accessToken,
|
|
17057
17585
|
query: args.query
|
|
17058
|
-
}
|
|
17586
|
+
},
|
|
17059
17587
|
invoker
|
|
17060
17588
|
});
|
|
17061
17589
|
if (!executed.success) throw new Error(executed.error);
|
|
@@ -17210,7 +17738,7 @@ async function runRepl(options) {
|
|
|
17210
17738
|
const execute = await prepareQueryExecutor(options);
|
|
17211
17739
|
const historyPath = getReplHistoryPath(options.engine, options.profile, options.workspaceId);
|
|
17212
17740
|
const validate = createReplValidator(options.engine);
|
|
17213
|
-
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-
|
|
17741
|
+
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-DmGr9zMw.mjs");
|
|
17214
17742
|
const highlight = options.engine === "sql" ? highlightSqlLine : highlightGraphqlLine;
|
|
17215
17743
|
const prompt = createPrompt({
|
|
17216
17744
|
prefix: "",
|
|
@@ -17378,7 +17906,6 @@ const queryCommand = defineAppCommand({
|
|
|
17378
17906
|
edit: arg(z.boolean().default(false), { description: "Open a temporary file in your editor; omit to start REPL mode" }),
|
|
17379
17907
|
"machine-user": arg(z.string().optional(), {
|
|
17380
17908
|
alias: "m",
|
|
17381
|
-
hiddenAlias: "machineuser",
|
|
17382
17909
|
description: "Machine user name for query execution. Falls back to the active profile's default machine user.",
|
|
17383
17910
|
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
17384
17911
|
}),
|
|
@@ -17544,5 +18071,5 @@ function isDeno() {
|
|
|
17544
18071
|
}
|
|
17545
18072
|
|
|
17546
18073
|
//#endregion
|
|
17547
|
-
export {
|
|
17548
|
-
//# sourceMappingURL=runtime-
|
|
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
|