@tailor-platform/sdk 2.0.0-next.3 → 2.0.0-next.4
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 +45 -0
- package/dist/aigateway-DR4Kwuik.mjs +9 -0
- package/dist/{aigateway-B3oZZE6v.mjs.map → aigateway-DR4Kwuik.mjs.map} +1 -1
- package/dist/application-BO4ZF8wP.mjs +3 -0
- package/dist/{application-eHp9jXld.mjs → application-BX13RArL.mjs} +293 -17
- package/dist/application-BX13RArL.mjs.map +1 -0
- package/dist/authconnection-CZvi9ANm.mjs +9 -0
- package/dist/authconnection-CZvi9ANm.mjs.map +1 -0
- package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
- package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -0
- package/dist/cli/index.mjs +138 -38
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +4 -4
- package/dist/cli/query/index.d.mts +4 -0
- package/dist/cli/ts-hook.mjs +43 -13
- package/dist/completion/zsh-worker.zsh +10 -10
- package/dist/configure/config/types.d.mts +3 -1
- package/dist/configure/index.d.mts +3 -1
- package/dist/configure/index.mjs +114 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/index.d.mts +3 -1
- package/dist/configure/services/tailordb/schema.d.mts +20 -20
- package/dist/configure/services/workflow/execution-policy.d.mts +71 -0
- package/dist/configure/services/workflow/execution-policy.types.d.mts +104 -0
- package/dist/configure/services/workflow/index.d.mts +3 -1
- package/dist/configure/services/workflow/job.d.mts +7 -2
- package/dist/{context-Bd266-ru.mjs → context-DYQVYWqZ.mjs} +4 -5
- package/dist/{context-Bd266-ru.mjs.map → context-DYQVYWqZ.mjs.map} +1 -1
- package/dist/{file-BbdFGdMV.mjs → file-BUcmVIH2.mjs} +12 -14
- package/dist/file-BUcmVIH2.mjs.map +1 -0
- package/dist/{file-utils-CYZnO1pX.mjs → file-utils-yEiIS4nJ.mjs} +2 -2
- package/dist/file-utils-yEiIS4nJ.mjs.map +1 -0
- package/dist/{globals-DhwZj0RB.mjs → globals-BjhJJ2dN.mjs} +2 -2
- package/dist/globals-BjhJJ2dN.mjs.map +1 -0
- package/dist/iconv-QWaZh0TT.mjs +38 -0
- package/dist/iconv-QWaZh0TT.mjs.map +1 -0
- package/dist/{idp-Bx25ZBdN.mjs → idp-RA_swu-h.mjs} +4 -5
- package/dist/idp-RA_swu-h.mjs.map +1 -0
- package/dist/{kysely-type-5eAChaHO.mjs → kysely-type-D-zflMGf.mjs} +1 -3
- package/dist/kysely-type-D-zflMGf.mjs.map +1 -0
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/{register-ts-hook-ZpBacA07.mjs → register-ts-hook-BM1caLT0.mjs} +255 -256
- package/dist/register-ts-hook-BM1caLT0.mjs.map +1 -0
- package/dist/{registry-DH4m7eYo.mjs → registry-BSbq6SPo.mjs} +4 -3
- package/dist/registry-BSbq6SPo.mjs.map +1 -0
- package/dist/resource_pb-BRv7AMXK.mjs +49 -0
- package/dist/resource_pb-BRv7AMXK.mjs.map +1 -0
- package/dist/runtime/aigateway.d.mts +5 -14
- package/dist/runtime/aigateway.mjs +2 -2
- package/dist/runtime/authconnection.d.mts +5 -14
- package/dist/runtime/authconnection.mjs +2 -2
- package/dist/runtime/context.d.mts +14 -5
- package/dist/runtime/context.mjs +2 -2
- package/dist/runtime/file.d.mts +14 -54
- package/dist/runtime/file.mjs +2 -2
- package/dist/runtime/globals.d.mts +1 -1
- package/dist/runtime/iconv.d.mts +5 -53
- package/dist/runtime/iconv.mjs +2 -2
- package/dist/runtime/idp.d.mts +13 -70
- package/dist/runtime/idp.mjs +2 -2
- package/dist/runtime/index.d.mts +11 -11
- package/dist/runtime/index.mjs +9 -9
- package/dist/runtime/secretmanager.d.mts +7 -20
- package/dist/runtime/secretmanager.mjs +2 -2
- package/dist/runtime/workflow.d.mts +42 -41
- package/dist/runtime/workflow.mjs +2 -2
- package/dist/{schema-89dYxNC2.mjs → schema-C4LYbXVG.mjs} +5 -5
- package/dist/{schema-89dYxNC2.mjs.map → schema-C4LYbXVG.mjs.map} +1 -1
- package/dist/secretmanager-CYlpffsz.mjs +13 -0
- package/dist/secretmanager-CYlpffsz.mjs.map +1 -0
- package/dist/{service_pb-DjwIn4jO.mjs → service_pb-B2FF59sP.mjs} +1 -1
- package/dist/{service_pb-CIrhGwHk.mjs → service_pb-B5w9rjPY.mjs} +17 -50
- package/dist/service_pb-B5w9rjPY.mjs.map +1 -0
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +1 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +29 -9
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +35 -1
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.mjs +11 -11
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/workflow.d.mts +5 -3
- package/dist/vitest/setup.mjs +1 -1
- package/dist/workflow-GNuSnsTx.mjs +22 -0
- package/dist/workflow-GNuSnsTx.mjs.map +1 -0
- package/docs/cli/auth.md +3 -3
- package/docs/cli/setup.md +8 -8
- package/docs/configuration.md +24 -0
- package/docs/migration/v2.md +111 -0
- package/docs/plugin/custom.md +4 -4
- package/docs/plugin/index.md +2 -2
- package/docs/runtime.md +4 -2
- package/docs/services/auth.md +2 -2
- package/docs/services/resolver.md +1 -1
- package/docs/services/tailordb-migration.md +1 -1
- package/docs/services/tailordb.md +31 -31
- package/docs/services/workflow.md +78 -0
- package/package.json +1 -1
- package/dist/aigateway-B3oZZE6v.mjs +0 -15
- package/dist/application-D2hSK1ZL.mjs +0 -3
- package/dist/application-eHp9jXld.mjs.map +0 -1
- package/dist/authconnection-BGQM8FZI.mjs +0 -15
- package/dist/authconnection-BGQM8FZI.mjs.map +0 -1
- package/dist/file-BbdFGdMV.mjs.map +0 -1
- package/dist/file-utils-CYZnO1pX.mjs.map +0 -1
- package/dist/globals-DhwZj0RB.mjs.map +0 -1
- package/dist/iconv-D2vi8G36.mjs +0 -63
- package/dist/iconv-D2vi8G36.mjs.map +0 -1
- package/dist/idp-Bx25ZBdN.mjs.map +0 -1
- package/dist/kysely-type-5eAChaHO.mjs.map +0 -1
- package/dist/register-ts-hook-ZpBacA07.mjs.map +0 -1
- package/dist/registry-DH4m7eYo.mjs.map +0 -1
- package/dist/rolldown-runtime-DXywRVcq.mjs +0 -20
- package/dist/secretmanager-BVxw3ih_.mjs +0 -24
- package/dist/secretmanager-BVxw3ih_.mjs.map +0 -1
- package/dist/service_pb-CIrhGwHk.mjs.map +0 -1
- package/dist/workflow-Bo59B75H.mjs +0 -50
- package/dist/workflow-Bo59B75H.mjs.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { t as db } from "./schema-
|
|
2
|
-
import {
|
|
1
|
+
import { t as db } from "./schema-C4LYbXVG.mjs";
|
|
2
|
+
import { i as PageDirection, n as Condition_Operator, r as FilterSchema, t as ConditionSchema } from "./resource_pb-BRv7AMXK.mjs";
|
|
3
3
|
import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
|
|
4
4
|
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-BEiZZ3qT.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { B as readPlatformConfig, C as createBundleCache, Ct as positiveIntArg, D as loadConfig, E as hashFile, Et as workspaceArgs, F as loadMachineUserName, G as writePlatformConfig, H as resolveConfigUser, I as loadPlatformClientConfig, J as fetchAll, M as loadAccessToken, N as loadConfigPath, R as loadWorkspaceId, S as hasGenerationHooks, St as parseDuration, T as hashContent, Tt as toPageDirection, X as fetchMachineUserToken, Y as fetchAllTolerant, Z as fetchPaged, _ as platformBundleDefinePlugin, _t as nonNegativeIntArg, at as initOperatorClient, bt as pagedLogArgs, ct as byName, dt as confirmationArgs, et as getConsoleBaseUrl, f as buildExecutorArgsExpr, ft as deploymentArgs, g as stringifyFunction, h as assertUniqueTailorDBTypeNamesWithExternal, i as resolverBundleKey, m as assertUniqueLocalTailorDBTypeNames, mt as folderArgs, n as generatePluginFilesIfNeeded, nt as getOrNull, o as getApplicationAuthNamespace, ot as isDefaultPlatform, p as buildResolverOperationHookExpr, pt as durationArg, r as loadApplication, rt as getPlatformBaseUrl, s as WorkflowJobFunctionExecutionPolicySchema, st as resolveStaticWebsiteUrls, t as defineApplication, tt as getOAuth2ClientId, u as HTTP_METHODS, ut as configArg, vt as orderArg, w as getDistDir, wt as resolveMachineUserInputSource, x as getPluginGenerationDependencies, xt as paginationArgs, yt as organizationArgs, z as platformConfigFromProfile } from "./application-BX13RArL.mjs";
|
|
6
6
|
import { c as stripTailorDBTypeBuilderHelpers, h as loadFilesWithIgnores, t as createExecutorService, u as TailorDBTypeSchema } from "./service-ufH7sS8o.mjs";
|
|
7
7
|
import { t as multiline } from "./multiline-sfHpTZZK.mjs";
|
|
8
8
|
import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
|
|
9
9
|
import { i as userAgent } from "./secret-file-aoNXJmKa.mjs";
|
|
10
10
|
import { n as isCLIError, t as createCLIError } from "./errors-118wUDRr.mjs";
|
|
11
|
+
import { $ as CreateAuthServiceRequestSchema, A as CreatePipelineServiceRequestSchema, At as Subgraph_ServiceType, C as CreateStaticWebsiteRequestSchema, D as CreateSecretManagerVaultRequestSchema, Dt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, E as CreateSecretManagerSecretRequestSchema, Et as CreateApplicationRequestSchema, F as UpdateIdPServiceRequestSchema, G as ExecutorTriggerType, H as UpdateExecutorExecutorRequestSchema, I as IdPLang, J as CreateAuthIDPConfigRequestSchema, K as CreateAuthConnectionRequestSchema, L as IdPPermissionOperator, M as UpdatePipelineServiceRequestSchema, N as PipelineResolver_OperationType, O as UpdateSecretManagerSecretRequestSchema, Ot as UpdateApplicationRequestSchema, P as CreateIdPServiceRequestSchema, Q as CreateAuthSCIMResourceRequestSchema, R as IdPPermissionPermit, S as AddCustomDomainRequestSchema, St as AuthSCIMConfig_AuthorizationType, Tt as UserProfileProviderConfig_UserProfileProviderType, U as ExecutorJobStatus, V as CreateExecutorExecutorRequestSchema, W as ExecutorTargetType, X as CreateAuthOAuth2ClientRequestSchema, Y as CreateAuthMachineUserRequestSchema, Z as CreateAuthSCIMConfigRequestSchema, _ as TailorDBGQLPermission_Operator, _t as AuthOAuth2Client_ClientType, a as WorkspacePlatformUserRole, at as UpdateAuthMachineUserRequestSchema, b as TailorDBType_Permission_Permit, bt as AuthSCIMAttribute_Type, c as CreateWorkflowRequestSchema, ct as UpdateAuthSCIMResourceRequestSchema, d as WorkflowExecution_Status, dt as UpdateUserProfileConfigRequestSchema, et as CreateTenantConfigRequestSchema, f as WorkflowJobExecution_Status, ft as AuthConnection_Status, g as TailorDBGQLPermission_Action, gt as AuthInvokerSchema, h as UpdateTailorDBTypeRequestSchema, ht as AuthIDPConfig_AuthType, it as UpdateAuthIDPConfigRequestSchema, j as UpdatePipelineResolverRequestSchema, k as CreatePipelineResolverRequestSchema, kt as ApplicationSchemaUpdateAttemptStatus, l as UpdateWorkflowJobFunctionExecutionPolicyRequestSchema, lt as UpdateAuthServiceRequestSchema, m as CreateTailorDBTypeRequestSchema, mt as AuthHookPoint, nt as UpdateAuthConnectionRequestSchema, o as CreateWorkflowJobFunctionExecutionPolicyRequestSchema, ot as UpdateAuthOAuth2ClientRequestSchema, p as CreateTailorDBServiceRequestSchema, pt as AuthConnection_Type, q as CreateAuthHookRequestSchema, rt as UpdateAuthHookRequestSchema, s as CreateWorkflowJobFunctionRequestSchema, st as UpdateAuthSCIMConfigRequestSchema, t as OperatorService, tt as CreateUserProfileConfigRequestSchema, u as UpdateWorkflowRequestSchema, ut as UpdateTenantConfigRequestSchema, v as TailorDBGQLPermission_Permit, vt as AuthOAuth2Client_GrantType, w as UpdateStaticWebsiteRequestSchema, wt as TenantProviderConfig_TenantProviderType, x as TailorDBType_PermitAction, xt as AuthSCIMAttribute_Uniqueness, y as TailorDBType_Permission_Operator, yt as AuthSCIMAttribute_Mutability, z as FunctionExecution_Status } from "./service_pb-B5w9rjPY.mjs";
|
|
11
12
|
import { r as withSpan } from "./telemetry-BRVdwh14.mjs";
|
|
12
13
|
import * as mod from "node:module";
|
|
13
14
|
import * as path from "pathe";
|
|
@@ -17,7 +18,6 @@ import { z } from "zod";
|
|
|
17
18
|
import { ScalarType, create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
18
19
|
import * as fs$1 from "node:fs";
|
|
19
20
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
20
|
-
import { parseEnv } from "node:util";
|
|
21
21
|
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
22
22
|
import { formatDistanceToNowStrict } from "date-fns";
|
|
23
23
|
import { getBorderCharacters, table } from "table";
|
|
@@ -48,240 +48,6 @@ import { createPrompt } from "@toiroakr/read-multiline";
|
|
|
48
48
|
import { astVisitor, parse } from "pgsql-ast-parser";
|
|
49
49
|
import { parse as parse$1 } from "@0no-co/graphql.web";
|
|
50
50
|
|
|
51
|
-
//#region src/cli/shared/args.ts
|
|
52
|
-
const unitToMs = {
|
|
53
|
-
ms: 1,
|
|
54
|
-
s: 1e3,
|
|
55
|
-
m: 60 * 1e3
|
|
56
|
-
};
|
|
57
|
-
const durationPattern = /^(\d+)(ms|s|m)$/;
|
|
58
|
-
/**
|
|
59
|
-
* Schema for duration string validation (e.g., "3s", "500ms", "1m")
|
|
60
|
-
* Only validates format; use parseDuration() to convert to milliseconds
|
|
61
|
-
*/
|
|
62
|
-
const durationArg = z.string().refine((val) => durationPattern.test(val), { message: "Invalid duration format. Expected format: '3s', '500ms', '1m'" }).refine((val) => {
|
|
63
|
-
const match = val.match(durationPattern);
|
|
64
|
-
if (!match) return false;
|
|
65
|
-
const digits = match[1];
|
|
66
|
-
return digits !== void 0 && parseInt(digits, 10) > 0;
|
|
67
|
-
}, { message: "Duration must be greater than 0" });
|
|
68
|
-
/**
|
|
69
|
-
* Parse a validated duration string into milliseconds
|
|
70
|
-
* @param duration - Duration string (e.g., "3s", "500ms", "1m")
|
|
71
|
-
* @returns Duration in milliseconds
|
|
72
|
-
*/
|
|
73
|
-
function parseDuration(duration) {
|
|
74
|
-
const match = assertDefined(duration.match(durationPattern), `invalid duration format: ${duration}`);
|
|
75
|
-
const value = parseInt(assertDefined(match[1], "duration digits group missing"), 10);
|
|
76
|
-
const unit = assertDefined(match[2], "duration unit group missing");
|
|
77
|
-
return value * unitToMs[unit];
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Schema for positive integer validation (from string input)
|
|
81
|
-
* Transforms the string to a number
|
|
82
|
-
*/
|
|
83
|
-
const positiveIntArg = z.coerce.number().int().positive();
|
|
84
|
-
/**
|
|
85
|
-
* Schema for non-negative integer validation (from string input).
|
|
86
|
-
* Accepts 0 (used for `--limit 0` to disable the limit).
|
|
87
|
-
*/
|
|
88
|
-
const nonNegativeIntArg = z.coerce.number().int().nonnegative();
|
|
89
|
-
/**
|
|
90
|
-
* Schema for sort order (`asc` or `desc`).
|
|
91
|
-
*/
|
|
92
|
-
const orderArg = z.enum(["asc", "desc"]);
|
|
93
|
-
/**
|
|
94
|
-
* Translate a CLI `--order` value into the proto `PageDirection` enum.
|
|
95
|
-
* Returns `undefined` when the user did not specify an order so that
|
|
96
|
-
* callers can omit the field and fall back to the server default.
|
|
97
|
-
* @param order - Order string from CLI args (`"asc"` | `"desc"` | undefined)
|
|
98
|
-
* @returns PageDirection, or undefined when `order` is undefined
|
|
99
|
-
*/
|
|
100
|
-
function toPageDirection(order) {
|
|
101
|
-
if (order === void 0) return void 0;
|
|
102
|
-
return order === "asc" ? PageDirection.ASC : PageDirection.DESC;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Load env files from parsed arguments.
|
|
106
|
-
* Processes --env-file first, then --env-file-if-exists.
|
|
107
|
-
*
|
|
108
|
-
* Follows Node.js --env-file behavior:
|
|
109
|
-
* - Variables already set in the environment are NOT overwritten
|
|
110
|
-
* - Variables from later files override those from earlier files
|
|
111
|
-
* @param envFiles - Required env file path(s) that must exist
|
|
112
|
-
* @param envFilesIfExists - Optional env file path(s) that are loaded if they exist
|
|
113
|
-
*/
|
|
114
|
-
function loadEnvFiles(envFiles, envFilesIfExists) {
|
|
115
|
-
const originalEnvKeys = new Set(Object.keys(process.env));
|
|
116
|
-
const load = (files, required) => {
|
|
117
|
-
for (const file of [files ?? []].flat()) {
|
|
118
|
-
const envPath = path.resolve(process.cwd(), file);
|
|
119
|
-
if (!fs$1.existsSync(envPath)) {
|
|
120
|
-
if (required) throw new Error(`Environment file not found: ${envPath}`);
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
const parsed = parseEnv(fs$1.readFileSync(envPath, "utf-8"));
|
|
124
|
-
for (const [key, value] of Object.entries(parsed)) {
|
|
125
|
-
if (originalEnvKeys.has(key)) continue;
|
|
126
|
-
process.env[key] = value;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
load(envFiles, true);
|
|
131
|
-
load(envFilesIfExists, false);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Common arguments for all CLI commands
|
|
135
|
-
*
|
|
136
|
-
* NOTE: --env-file and --env-file-if-exists collide with Node.js flags due to a bug
|
|
137
|
-
* (https://github.com/nodejs/node/issues/54232). Node.js parses these even after the
|
|
138
|
-
* script path, causing warnings (twice due to tsx loader).
|
|
139
|
-
*/
|
|
140
|
-
const commonArgs = {
|
|
141
|
-
"env-file": arg(z.string().optional(), {
|
|
142
|
-
alias: "e",
|
|
143
|
-
description: "Path to the environment file (error if not found)",
|
|
144
|
-
completion: {
|
|
145
|
-
type: "file",
|
|
146
|
-
matcher: [".env.*", ".env"]
|
|
147
|
-
}
|
|
148
|
-
}),
|
|
149
|
-
"env-file-if-exists": arg(z.string().optional(), {
|
|
150
|
-
description: "Path to the environment file (ignored if not found)",
|
|
151
|
-
completion: {
|
|
152
|
-
type: "file",
|
|
153
|
-
matcher: [".env.*", ".env"]
|
|
154
|
-
},
|
|
155
|
-
effect: (_value, { args }) => {
|
|
156
|
-
loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
|
|
157
|
-
}
|
|
158
|
-
}),
|
|
159
|
-
verbose: arg(z.boolean().default(false), {
|
|
160
|
-
description: "Enable verbose logging",
|
|
161
|
-
effect: (value) => {
|
|
162
|
-
verboseMode = value;
|
|
163
|
-
}
|
|
164
|
-
}),
|
|
165
|
-
json: arg(z.boolean().default(false), {
|
|
166
|
-
alias: "j",
|
|
167
|
-
description: "Output as JSON",
|
|
168
|
-
effect: (value) => {
|
|
169
|
-
logger.jsonMode = value;
|
|
170
|
-
}
|
|
171
|
-
})
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Arguments for commands that require workspace context
|
|
175
|
-
*/
|
|
176
|
-
const workspaceArgs = {
|
|
177
|
-
"workspace-id": arg(z.string().optional(), {
|
|
178
|
-
alias: "w",
|
|
179
|
-
description: "Workspace ID",
|
|
180
|
-
env: "TAILOR_PLATFORM_WORKSPACE_ID",
|
|
181
|
-
completion: { type: "none" }
|
|
182
|
-
}),
|
|
183
|
-
profile: arg(z.string().optional(), {
|
|
184
|
-
alias: "p",
|
|
185
|
-
description: "Workspace profile",
|
|
186
|
-
env: "TAILOR_PLATFORM_PROFILE",
|
|
187
|
-
completion: { type: "none" }
|
|
188
|
-
})
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Shared config arg for commands that accept a config file path
|
|
192
|
-
*/
|
|
193
|
-
const configArg = { config: arg(z.string().default("tailor.config.ts"), {
|
|
194
|
-
alias: "c",
|
|
195
|
-
description: "Path to Tailor config file",
|
|
196
|
-
env: "TAILOR_CONFIG_PATH",
|
|
197
|
-
completion: {
|
|
198
|
-
type: "file",
|
|
199
|
-
extensions: ["ts"]
|
|
200
|
-
}
|
|
201
|
-
}) };
|
|
202
|
-
/**
|
|
203
|
-
* Shared config arg for commands that accept one or more comma-separated config file paths
|
|
204
|
-
*/
|
|
205
|
-
const multiConfigArg = { config: arg(z.string().default("tailor.config.ts"), {
|
|
206
|
-
alias: "c",
|
|
207
|
-
description: "Path to SDK config file. Use comma-separated paths to deploy multiple apps together.",
|
|
208
|
-
env: "TAILOR_PLATFORM_SDK_CONFIG_PATH",
|
|
209
|
-
completion: {
|
|
210
|
-
type: "file",
|
|
211
|
-
extensions: ["ts"]
|
|
212
|
-
}
|
|
213
|
-
}) };
|
|
214
|
-
/**
|
|
215
|
-
* Arguments for commands that interact with deployed resources (includes config)
|
|
216
|
-
*/
|
|
217
|
-
const deploymentArgs = {
|
|
218
|
-
...workspaceArgs,
|
|
219
|
-
...configArg
|
|
220
|
-
};
|
|
221
|
-
/**
|
|
222
|
-
* Arguments for commands that require confirmation
|
|
223
|
-
*/
|
|
224
|
-
const confirmationArgs = { yes: arg(z.boolean().default(false), {
|
|
225
|
-
alias: "y",
|
|
226
|
-
description: "Skip confirmation prompts"
|
|
227
|
-
}) };
|
|
228
|
-
/**
|
|
229
|
-
* Arguments for commands that require organization context
|
|
230
|
-
*/
|
|
231
|
-
const organizationArgs = { "organization-id": arg(z.string(), {
|
|
232
|
-
alias: "o",
|
|
233
|
-
description: "Organization ID",
|
|
234
|
-
env: "TAILOR_PLATFORM_ORGANIZATION_ID",
|
|
235
|
-
completion: { type: "none" }
|
|
236
|
-
}) };
|
|
237
|
-
/**
|
|
238
|
-
* Arguments for list commands that accept `--order` / `--limit`. Sort
|
|
239
|
-
* order defaults to `desc` (newest first) because most callers want the
|
|
240
|
-
* latest items; pass `--order asc` to opt in to ascending order. The
|
|
241
|
-
* limit is unbounded by default so existing invocations keep returning
|
|
242
|
-
* every item; pass `--limit N` to cap the result size.
|
|
243
|
-
* @param defaultOrder - Default value for `--order` (defaults to `"desc"`)
|
|
244
|
-
* @returns Argument shape suitable for spreading into a command schema
|
|
245
|
-
*/
|
|
246
|
-
const paginationArgs = (defaultOrder = "desc") => ({
|
|
247
|
-
order: arg(orderArg.default(defaultOrder), { description: "Sort order (asc or desc)" }),
|
|
248
|
-
limit: arg(nonNegativeIntArg.optional(), {
|
|
249
|
-
alias: "l",
|
|
250
|
-
description: "Maximum number of items to return (0 or omit: unlimited)"
|
|
251
|
-
})
|
|
252
|
-
});
|
|
253
|
-
/**
|
|
254
|
-
* Arguments for time-series log list commands. Defaults to newest-first
|
|
255
|
-
* (`desc`) and a 50-item cap so that listing stays responsive on busy
|
|
256
|
-
* workspaces. Pass `--limit 0` to disable the cap and fetch all entries.
|
|
257
|
-
*/
|
|
258
|
-
const pagedLogArgs = {
|
|
259
|
-
order: arg(orderArg.default("desc"), { description: "Sort order (asc or desc)" }),
|
|
260
|
-
limit: arg(nonNegativeIntArg.default(50), {
|
|
261
|
-
alias: "l",
|
|
262
|
-
description: "Maximum number of items to return (0: unlimited)"
|
|
263
|
-
})
|
|
264
|
-
};
|
|
265
|
-
/**
|
|
266
|
-
* Arguments for commands that require folder context
|
|
267
|
-
*/
|
|
268
|
-
const folderArgs = { "folder-id": arg(z.string(), {
|
|
269
|
-
alias: "f",
|
|
270
|
-
description: "Folder ID",
|
|
271
|
-
env: "TAILOR_PLATFORM_FOLDER_ID",
|
|
272
|
-
completion: { type: "none" }
|
|
273
|
-
}) };
|
|
274
|
-
let verboseMode = false;
|
|
275
|
-
/**
|
|
276
|
-
* Returns whether verbose mode is enabled.
|
|
277
|
-
* Used by the global cleanup handler which doesn't have access to parsed args.
|
|
278
|
-
* @returns Whether verbose mode is enabled
|
|
279
|
-
*/
|
|
280
|
-
function isVerbose() {
|
|
281
|
-
return verboseMode;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
//#endregion
|
|
285
51
|
//#region src/cli/shared/command.ts
|
|
286
52
|
/**
|
|
287
53
|
* defineCommand with global args type (CommonArgsType).
|
|
@@ -1601,7 +1367,7 @@ var PluginManager = class {
|
|
|
1601
1367
|
}
|
|
1602
1368
|
/**
|
|
1603
1369
|
* Extend a TailorDB type with new fields.
|
|
1604
|
-
* This method handles the `db.
|
|
1370
|
+
* This method handles the `db.table()` call and metadata copying internally.
|
|
1605
1371
|
* @param params - Parameters for type extension
|
|
1606
1372
|
* @returns The extended TailorDB type
|
|
1607
1373
|
*/
|
|
@@ -1616,7 +1382,7 @@ var PluginManager = class {
|
|
|
1616
1382
|
};
|
|
1617
1383
|
const pluralForm = originalType.metadata.settings?.pluralForm;
|
|
1618
1384
|
const typeName = pluralForm ? [originalType.name, pluralForm] : originalType.name;
|
|
1619
|
-
return copyMetadataToExtendedType(originalType, db.
|
|
1385
|
+
return copyMetadataToExtendedType(originalType, db.table(typeName, fieldsWithoutId));
|
|
1620
1386
|
}
|
|
1621
1387
|
};
|
|
1622
1388
|
/**
|
|
@@ -10814,6 +10580,198 @@ function normalizeRetryPolicyForCompare(policy) {
|
|
|
10814
10580
|
};
|
|
10815
10581
|
}
|
|
10816
10582
|
|
|
10583
|
+
//#endregion
|
|
10584
|
+
//#region src/cli/commands/deploy/workflow-execution-policy.ts
|
|
10585
|
+
function toConcurrencyPolicyInit(policy) {
|
|
10586
|
+
if (!policy) return void 0;
|
|
10587
|
+
return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
|
|
10588
|
+
}
|
|
10589
|
+
function normalizeComparableConcurrency(policy) {
|
|
10590
|
+
if (!policy || !policy.maxConcurrentExecutions) return void 0;
|
|
10591
|
+
return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
|
|
10592
|
+
}
|
|
10593
|
+
/**
|
|
10594
|
+
* The declared key prefix, regardless of variant. `ExecutionPolicyWildcardInstance`
|
|
10595
|
+
* omits `key` from its public type to force callers through `keyFor()`, but
|
|
10596
|
+
* the underlying value always carries it when produced by
|
|
10597
|
+
* `defineWorkflowExecutionPolicy()` or `defineWorkflowExecutionPolicies()`.
|
|
10598
|
+
* @param policy - Declared policy from the config
|
|
10599
|
+
* @returns The declared key prefix
|
|
10600
|
+
*/
|
|
10601
|
+
function declaredKey(policy) {
|
|
10602
|
+
if (policy.matchType === "exact") return policy.key;
|
|
10603
|
+
const key = policy.key;
|
|
10604
|
+
if (typeof key !== "string") throw new Error(`Invalid workflow execution policy "${policy.name}": prefix policies must be created via defineWorkflowExecutionPolicy() or defineWorkflowExecutionPolicies(), not a hand-constructed object.`);
|
|
10605
|
+
return key;
|
|
10606
|
+
}
|
|
10607
|
+
/**
|
|
10608
|
+
* The literal key the platform registers for a declared policy: `key` with a
|
|
10609
|
+
* trailing `*` appended when `matchType` is `"prefix"`.
|
|
10610
|
+
* @param policy - Declared policy from the config
|
|
10611
|
+
* @returns The platform-facing execution policy key
|
|
10612
|
+
*/
|
|
10613
|
+
function toPlatformExecutionPolicyKey(policy) {
|
|
10614
|
+
const key = declaredKey(policy);
|
|
10615
|
+
return policy.matchType === "prefix" ? `${key}*` : key;
|
|
10616
|
+
}
|
|
10617
|
+
/**
|
|
10618
|
+
* Validate a declared execution policy against the parser schema. Throws with
|
|
10619
|
+
* a descriptive error when `name` or the platform-facing key violates the
|
|
10620
|
+
* platform grammar.
|
|
10621
|
+
* @param policy - Declared policy from the config
|
|
10622
|
+
*/
|
|
10623
|
+
function validatePolicy(policy) {
|
|
10624
|
+
if (declaredKey(policy).endsWith("*")) throw new Error(`Invalid workflow execution policy "${policy.name}": key must not end with '*'; omit the '*' and set matchType: "prefix" for wildcard policies (the SDK appends '*' automatically).`);
|
|
10625
|
+
const parsed = WorkflowJobFunctionExecutionPolicySchema.safeParse({
|
|
10626
|
+
name: policy.name,
|
|
10627
|
+
key: toPlatformExecutionPolicyKey(policy),
|
|
10628
|
+
concurrencyPolicy: policy.concurrencyPolicy
|
|
10629
|
+
});
|
|
10630
|
+
if (!parsed.success) throw new Error(`Invalid workflow execution policy "${policy.name}": ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
10631
|
+
}
|
|
10632
|
+
/**
|
|
10633
|
+
* Plan workflow job function execution policy changes based on desired
|
|
10634
|
+
* declarations and current remote state.
|
|
10635
|
+
* @param client - Operator client instance
|
|
10636
|
+
* @param workspaceId - Workspace ID
|
|
10637
|
+
* @param appName - Application name
|
|
10638
|
+
* @param appId - Application ID for ownership metadata
|
|
10639
|
+
* @param declared - Policies declared in the config (property name → instance)
|
|
10640
|
+
* @returns Planned execution policy changes
|
|
10641
|
+
*/
|
|
10642
|
+
async function planWorkflowJobFunctionExecutionPolicy(client, workspaceId, appName, appId, declared) {
|
|
10643
|
+
const changeSet = createChangeSet("Workflow execution policies");
|
|
10644
|
+
const conflicts = [];
|
|
10645
|
+
const unmanaged = [];
|
|
10646
|
+
const resourceOwners = /* @__PURE__ */ new Set();
|
|
10647
|
+
const declaredList = Object.values(declared);
|
|
10648
|
+
for (const policy of declaredList) validatePolicy(policy);
|
|
10649
|
+
const existing = await fetchExistingResourcesWithLabels({
|
|
10650
|
+
client,
|
|
10651
|
+
fetchPage: async (pageToken, pageSize) => {
|
|
10652
|
+
const response = await client.listWorkflowJobFunctionExecutionPolicies({
|
|
10653
|
+
workspaceId,
|
|
10654
|
+
pageToken,
|
|
10655
|
+
pageSize
|
|
10656
|
+
});
|
|
10657
|
+
return [response.policies, response.nextPageToken];
|
|
10658
|
+
},
|
|
10659
|
+
getName: (resource) => resource.name,
|
|
10660
|
+
getTrn: (name) => resourceTrn(workspaceId, "workflow_job_function_execution_policy", name)
|
|
10661
|
+
});
|
|
10662
|
+
const seenNames = /* @__PURE__ */ new Set();
|
|
10663
|
+
for (const policy of declaredList) {
|
|
10664
|
+
if (seenNames.has(policy.name)) throw new Error(`Duplicate workflow execution policy name "${policy.name}". Each policy must have a unique name within the workspace.`);
|
|
10665
|
+
seenNames.add(policy.name);
|
|
10666
|
+
const metaRequest = await buildMetaRequest({
|
|
10667
|
+
trn: resourceTrn(workspaceId, "workflow_job_function_execution_policy", policy.name),
|
|
10668
|
+
appName,
|
|
10669
|
+
appId
|
|
10670
|
+
});
|
|
10671
|
+
const found = existing[policy.name];
|
|
10672
|
+
if (found) {
|
|
10673
|
+
const owned = trackDesiredResourceOwnership({
|
|
10674
|
+
labels: found.allLabels,
|
|
10675
|
+
ownerLabel: found.label,
|
|
10676
|
+
appName,
|
|
10677
|
+
appId,
|
|
10678
|
+
resourceType: "Workflow execution policy",
|
|
10679
|
+
resourceName: policy.name,
|
|
10680
|
+
conflicts,
|
|
10681
|
+
unmanaged
|
|
10682
|
+
});
|
|
10683
|
+
const remoteKey = found.resource.executionPolicyKey;
|
|
10684
|
+
const desiredKey = toPlatformExecutionPolicyKey(policy);
|
|
10685
|
+
const remoteConcurrency = normalizeComparableConcurrency(found.resource.concurrencyPolicy);
|
|
10686
|
+
const desiredConcurrency = normalizeComparableConcurrency(policy.concurrencyPolicy);
|
|
10687
|
+
if (owned && hasMatchingSdkVersion(found.allLabels, metaRequest.labels) && remoteKey === desiredKey && areNormalizedEqual(remoteConcurrency, desiredConcurrency)) changeSet.unchanged.push({ name: policy.name });
|
|
10688
|
+
else if (remoteKey !== desiredKey) changeSet.replaces.push({
|
|
10689
|
+
name: policy.name,
|
|
10690
|
+
workspaceId,
|
|
10691
|
+
policy,
|
|
10692
|
+
metaRequest
|
|
10693
|
+
});
|
|
10694
|
+
else changeSet.updates.push({
|
|
10695
|
+
name: policy.name,
|
|
10696
|
+
workspaceId,
|
|
10697
|
+
policy,
|
|
10698
|
+
metaRequest
|
|
10699
|
+
});
|
|
10700
|
+
delete existing[policy.name];
|
|
10701
|
+
} else changeSet.creates.push({
|
|
10702
|
+
name: policy.name,
|
|
10703
|
+
workspaceId,
|
|
10704
|
+
policy,
|
|
10705
|
+
metaRequest
|
|
10706
|
+
});
|
|
10707
|
+
}
|
|
10708
|
+
for (const [name, remaining] of Object.entries(existing)) {
|
|
10709
|
+
if (!remaining) continue;
|
|
10710
|
+
if (trackRemainingResourceOwner({
|
|
10711
|
+
labels: remaining.allLabels,
|
|
10712
|
+
ownerLabel: remaining.label,
|
|
10713
|
+
appName,
|
|
10714
|
+
appId,
|
|
10715
|
+
resourceOwners
|
|
10716
|
+
})) changeSet.deletes.push({
|
|
10717
|
+
name,
|
|
10718
|
+
workspaceId
|
|
10719
|
+
});
|
|
10720
|
+
}
|
|
10721
|
+
return {
|
|
10722
|
+
changeSet,
|
|
10723
|
+
conflicts,
|
|
10724
|
+
unmanaged,
|
|
10725
|
+
resourceOwners
|
|
10726
|
+
};
|
|
10727
|
+
}
|
|
10728
|
+
/**
|
|
10729
|
+
* Apply planned workflow execution policy changes for the given phase.
|
|
10730
|
+
* @param client - Operator client instance
|
|
10731
|
+
* @param plan - Result of `planWorkflowJobFunctionExecutionPolicy`
|
|
10732
|
+
* @param phase - Apply phase
|
|
10733
|
+
* @returns Promise that resolves when policies are applied
|
|
10734
|
+
*/
|
|
10735
|
+
async function applyWorkflowJobFunctionExecutionPolicy(client, plan, phase = "create-update") {
|
|
10736
|
+
const { changeSet } = plan;
|
|
10737
|
+
if (phase === "create-update") await Promise.all([
|
|
10738
|
+
...changeSet.replaces.map(async (replace) => {
|
|
10739
|
+
await client.deleteWorkflowJobFunctionExecutionPolicy({
|
|
10740
|
+
workspaceId: replace.workspaceId,
|
|
10741
|
+
executionPolicyName: replace.name
|
|
10742
|
+
});
|
|
10743
|
+
await client.createWorkflowJobFunctionExecutionPolicy({
|
|
10744
|
+
workspaceId: replace.workspaceId,
|
|
10745
|
+
executionPolicyName: replace.policy.name,
|
|
10746
|
+
executionPolicyKey: toPlatformExecutionPolicyKey(replace.policy),
|
|
10747
|
+
concurrencyPolicy: toConcurrencyPolicyInit(replace.policy.concurrencyPolicy)
|
|
10748
|
+
});
|
|
10749
|
+
await client.setMetadata(replace.metaRequest);
|
|
10750
|
+
}),
|
|
10751
|
+
...changeSet.creates.map(async (create) => {
|
|
10752
|
+
await client.createWorkflowJobFunctionExecutionPolicy({
|
|
10753
|
+
workspaceId: create.workspaceId,
|
|
10754
|
+
executionPolicyName: create.policy.name,
|
|
10755
|
+
executionPolicyKey: toPlatformExecutionPolicyKey(create.policy),
|
|
10756
|
+
concurrencyPolicy: toConcurrencyPolicyInit(create.policy.concurrencyPolicy)
|
|
10757
|
+
});
|
|
10758
|
+
await client.setMetadata(create.metaRequest);
|
|
10759
|
+
}),
|
|
10760
|
+
...changeSet.updates.map(async (update) => {
|
|
10761
|
+
await client.updateWorkflowJobFunctionExecutionPolicy({
|
|
10762
|
+
workspaceId: update.workspaceId,
|
|
10763
|
+
executionPolicyName: update.policy.name,
|
|
10764
|
+
concurrencyPolicy: toConcurrencyPolicyInit(update.policy.concurrencyPolicy)
|
|
10765
|
+
});
|
|
10766
|
+
await client.setMetadata(update.metaRequest);
|
|
10767
|
+
})
|
|
10768
|
+
]);
|
|
10769
|
+
else await Promise.all(changeSet.deletes.map((del) => client.deleteWorkflowJobFunctionExecutionPolicy({
|
|
10770
|
+
workspaceId: del.workspaceId,
|
|
10771
|
+
executionPolicyName: del.name
|
|
10772
|
+
})));
|
|
10773
|
+
}
|
|
10774
|
+
|
|
10817
10775
|
//#endregion
|
|
10818
10776
|
//#region src/cli/commands/deploy/apply-phases.ts
|
|
10819
10777
|
/**
|
|
@@ -10847,10 +10805,12 @@ async function applyDeploymentPlans(client, workspaceId, deployments) {
|
|
|
10847
10805
|
});
|
|
10848
10806
|
await withSpan("apply.createUpdateDependentServices", async () => {
|
|
10849
10807
|
await forEachDeployment((d) => applyExecutor(client, d.executor, "create-update"));
|
|
10808
|
+
await forEachDeployment((d) => applyWorkflowJobFunctionExecutionPolicy(client, d.workflowExecutionPolicy, "create-update"));
|
|
10850
10809
|
await forEachDeployment((d) => applyWorkflow(client, d.workflow, "create-update"));
|
|
10851
10810
|
});
|
|
10852
10811
|
await withSpan("apply.deleteDependentServices", async () => {
|
|
10853
10812
|
await forEachDeployment((d) => applyWorkflow(client, d.workflow, "delete"));
|
|
10813
|
+
await forEachDeployment((d) => applyWorkflowJobFunctionExecutionPolicy(client, d.workflowExecutionPolicy, "delete"));
|
|
10854
10814
|
await forEachDeployment((d) => applyExecutor(client, d.executor, "delete"));
|
|
10855
10815
|
await forEachDeployment((d) => applyStaticWebsite(client, d.staticWebsite, "delete"));
|
|
10856
10816
|
await forEachDeployment((d) => applyAIGateway(client, d.aiGateway, "delete"));
|
|
@@ -11175,7 +11135,7 @@ function validateItems(params) {
|
|
|
11175
11135
|
* @param input - Plan results from the plan phase
|
|
11176
11136
|
*/
|
|
11177
11137
|
async function validatePlan(input) {
|
|
11178
|
-
const { tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = input;
|
|
11138
|
+
const { tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, workflowExecutionPolicy, secretManager } = input;
|
|
11179
11139
|
const validator = createValidator();
|
|
11180
11140
|
const violations = [];
|
|
11181
11141
|
function creates(schema, kind, items) {
|
|
@@ -11318,6 +11278,23 @@ async function validatePlan(input) {
|
|
|
11318
11278
|
}
|
|
11319
11279
|
})));
|
|
11320
11280
|
}
|
|
11281
|
+
creates(CreateWorkflowJobFunctionExecutionPolicyRequestSchema, "Workflow execution policy", [...workflowExecutionPolicy.changeSet.creates, ...workflowExecutionPolicy.changeSet.replaces].map((item) => ({
|
|
11282
|
+
name: item.name,
|
|
11283
|
+
request: {
|
|
11284
|
+
workspaceId: item.workspaceId,
|
|
11285
|
+
executionPolicyName: item.policy.name,
|
|
11286
|
+
executionPolicyKey: toPlatformExecutionPolicyKey(item.policy),
|
|
11287
|
+
...item.policy.concurrencyPolicy && { concurrencyPolicy: { maxConcurrentExecutions: item.policy.concurrencyPolicy.maxConcurrentExecutions } }
|
|
11288
|
+
}
|
|
11289
|
+
})));
|
|
11290
|
+
updates(UpdateWorkflowJobFunctionExecutionPolicyRequestSchema, "Workflow execution policy", workflowExecutionPolicy.changeSet.updates.map((item) => ({
|
|
11291
|
+
name: item.name,
|
|
11292
|
+
request: {
|
|
11293
|
+
workspaceId: item.workspaceId,
|
|
11294
|
+
executionPolicyName: item.policy.name,
|
|
11295
|
+
...item.policy.concurrencyPolicy && { concurrencyPolicy: { maxConcurrentExecutions: item.policy.concurrencyPolicy.maxConcurrentExecutions } }
|
|
11296
|
+
}
|
|
11297
|
+
})));
|
|
11321
11298
|
creates(CreateSecretManagerVaultRequestSchema, "Secret Manager vault", secretManager.vaultChangeSet.creates.map((item) => ({
|
|
11322
11299
|
name: item.name,
|
|
11323
11300
|
request: vaultCreateRequest(item)
|
|
@@ -11550,6 +11527,7 @@ function buildPlanReport(results) {
|
|
|
11550
11527
|
const executorEntries = formatExecutorChangeEntries(results.executor.changeSet, buildPlannedExecutorsByName(results.executor.changeSet), results.functionRegistry.executorFunctionChanges);
|
|
11551
11528
|
const resolverEntries = formatResolverChangeEntries(results.pipeline.changeSet.resolver, results.functionRegistry.resolverFunctionChanges);
|
|
11552
11529
|
const workflowEntries = formatWorkflowChangeEntries(results.workflow.changeSet, results.functionRegistry.workflowJobChanges);
|
|
11530
|
+
const workflowExecutionPolicyEntries = formatChangeSetEntries(results.workflowExecutionPolicy.changeSet, ["executionPolicy"]);
|
|
11553
11531
|
const authHookEntries = formatAuthHookChangeEntries(results.auth.changeSet.authHook, results.functionRegistry.authHookFunctionChanges);
|
|
11554
11532
|
const tailorDBEntries = [...formatTailorDBResourceChangeEntries(results.tailorDB.changeSet.type, results.tailorDB.changeSet.gqlPermission)];
|
|
11555
11533
|
const pipelineEntries = [...resolverEntries];
|
|
@@ -11580,6 +11558,7 @@ function buildPlanReport(results) {
|
|
|
11580
11558
|
...pipelineEntries,
|
|
11581
11559
|
...executorEntries,
|
|
11582
11560
|
...workflowEntries,
|
|
11561
|
+
...workflowExecutionPolicyEntries,
|
|
11583
11562
|
...idpEntries,
|
|
11584
11563
|
...authEntries
|
|
11585
11564
|
];
|
|
@@ -11952,7 +11931,7 @@ async function planDeploymentTarget(params) {
|
|
|
11952
11931
|
};
|
|
11953
11932
|
const functionRegistry = await withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, application.id, functionEntries));
|
|
11954
11933
|
const unchangedWorkflowJobs = new Set(functionRegistry.changeSet.unchanged.filter((entry) => entry.name.startsWith(WORKFLOW_PREFIX)).map((entry) => entry.name.slice(WORKFLOW_PREFIX.length)));
|
|
11955
|
-
const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
|
|
11934
|
+
const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, workflowExecutionPolicy, secretManager] = await Promise.all([
|
|
11956
11935
|
withSpan("plan.tailorDB", () => planTailorDB(ctx)),
|
|
11957
11936
|
withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
|
|
11958
11937
|
withSpan("plan.aiGateway", () => planAIGateway(ctx)),
|
|
@@ -11962,6 +11941,7 @@ async function planDeploymentTarget(params) {
|
|
|
11962
11941
|
withSpan("plan.application", () => planApplication(ctx, httpAdapterBuildResult)),
|
|
11963
11942
|
withSpan("plan.executor", () => planExecutor(ctx)),
|
|
11964
11943
|
withSpan("plan.workflow", () => planWorkflow(client, workspaceId, application.name, application.id, workflowService?.workflows ?? {}, workflowBuildResult?.mainJobDeps ?? {}, unchangedWorkflowJobs)),
|
|
11944
|
+
withSpan("plan.workflowExecutionPolicy", () => planWorkflowJobFunctionExecutionPolicy(client, workspaceId, application.name, application.id, config.workflow?.executionPolicies ?? {})),
|
|
11965
11945
|
withSpan("plan.secretManager", () => planSecretManager(ctx))
|
|
11966
11946
|
]);
|
|
11967
11947
|
return {
|
|
@@ -11976,6 +11956,7 @@ async function planDeploymentTarget(params) {
|
|
|
11976
11956
|
app,
|
|
11977
11957
|
executor,
|
|
11978
11958
|
workflow,
|
|
11959
|
+
workflowExecutionPolicy,
|
|
11979
11960
|
secretManager
|
|
11980
11961
|
};
|
|
11981
11962
|
});
|
|
@@ -12003,6 +11984,7 @@ function collectOwnerConflicts(results) {
|
|
|
12003
11984
|
...results.pipeline.conflicts,
|
|
12004
11985
|
...results.executor.conflicts,
|
|
12005
11986
|
...results.workflow.conflicts,
|
|
11987
|
+
...results.workflowExecutionPolicy.conflicts,
|
|
12006
11988
|
...results.secretManager.conflicts
|
|
12007
11989
|
];
|
|
12008
11990
|
}
|
|
@@ -12017,6 +11999,7 @@ function collectUnmanagedResources(results) {
|
|
|
12017
11999
|
...results.pipeline.unmanaged,
|
|
12018
12000
|
...results.executor.unmanaged,
|
|
12019
12001
|
...results.workflow.unmanaged,
|
|
12002
|
+
...results.workflowExecutionPolicy.unmanaged,
|
|
12020
12003
|
...results.secretManager.unmanaged
|
|
12021
12004
|
];
|
|
12022
12005
|
}
|
|
@@ -12031,6 +12014,7 @@ function collectResourceOwners(results) {
|
|
|
12031
12014
|
...results.pipeline.resourceOwners,
|
|
12032
12015
|
...results.executor.resourceOwners,
|
|
12033
12016
|
...results.workflow.resourceOwners,
|
|
12017
|
+
...results.workflowExecutionPolicy.resourceOwners,
|
|
12034
12018
|
...results.secretManager.resourceOwners
|
|
12035
12019
|
]);
|
|
12036
12020
|
}
|
|
@@ -12176,6 +12160,12 @@ const DEPLOY_MANAGED_RESOURCE_DEFINITIONS = [
|
|
|
12176
12160
|
namesOf: (target) => Object.values(target.application.workflowService?.workflows ?? {}).map((workflow) => workflow.name),
|
|
12177
12161
|
changeSetOf: (results) => results.workflow.changeSet
|
|
12178
12162
|
},
|
|
12163
|
+
{
|
|
12164
|
+
resourceLabel: "Workflow execution policy",
|
|
12165
|
+
resourceType: "workflow_job_function_execution_policy",
|
|
12166
|
+
namesOf: (target) => Object.values(target.config.workflow?.executionPolicies ?? {}).map((policy) => policy.name),
|
|
12167
|
+
changeSetOf: (results) => results.workflowExecutionPolicy.changeSet
|
|
12168
|
+
},
|
|
12179
12169
|
{
|
|
12180
12170
|
resourceLabel: "Auth connection",
|
|
12181
12171
|
resourceType: "auth.connection",
|
|
@@ -13723,6 +13713,7 @@ async function resolveApplicationAuthNamespace(options) {
|
|
|
13723
13713
|
async function startWorkflowByName(options) {
|
|
13724
13714
|
const machineUser = await loadMachineUserName({
|
|
13725
13715
|
machineUser: options.machineUser,
|
|
13716
|
+
machineUserSource: options.machineUserSource,
|
|
13726
13717
|
profile: options.profile
|
|
13727
13718
|
});
|
|
13728
13719
|
if (!machineUser) throw new Error("Machine user is required. Specify --machine-user, set TAILOR_PLATFORM_MACHINE_USER_NAME, or set a profile default with 'tailor profile update <profile> --machine-user <name>'.");
|
|
@@ -13793,6 +13784,7 @@ const startCommand = defineAppCommand({
|
|
|
13793
13784
|
const { executionId, wait } = await startWorkflowByName({
|
|
13794
13785
|
name: args.name,
|
|
13795
13786
|
machineUser: args["machine-user"],
|
|
13787
|
+
machineUserSource: resolveMachineUserInputSource(args["machine-user"]),
|
|
13796
13788
|
arg: args.arg,
|
|
13797
13789
|
workspaceId: args["workspace-id"],
|
|
13798
13790
|
profile: args.profile,
|
|
@@ -15578,14 +15570,10 @@ const listCommand$7 = defineAppCommand({
|
|
|
15578
15570
|
|
|
15579
15571
|
//#endregion
|
|
15580
15572
|
//#region src/cli/commands/machineuser/token.ts
|
|
15581
|
-
|
|
15582
|
-
* Get a machine user access token for the current application.
|
|
15583
|
-
* @param options - Token retrieval options
|
|
15584
|
-
* @returns Machine user token info
|
|
15585
|
-
*/
|
|
15586
|
-
async function getMachineUserToken(options) {
|
|
15573
|
+
async function getMachineUserTokenInternal(options) {
|
|
15587
15574
|
const name = await loadMachineUserName({
|
|
15588
15575
|
machineUser: options.name,
|
|
15576
|
+
machineUserSource: options.nameSource,
|
|
15589
15577
|
profile: options.profile
|
|
15590
15578
|
});
|
|
15591
15579
|
if (!name) throw new Error("Machine user is required. Provide the NAME positional argument, set TAILOR_PLATFORM_MACHINE_USER_NAME, or set a profile default with 'tailor profile update <profile> --machine-user <name>'.");
|
|
@@ -15615,6 +15603,14 @@ async function getMachineUserToken(options) {
|
|
|
15615
15603
|
expiresAt: expiresAt.toISOString()
|
|
15616
15604
|
};
|
|
15617
15605
|
}
|
|
15606
|
+
/**
|
|
15607
|
+
* Get a machine user access token for the current application.
|
|
15608
|
+
* @param options - Token retrieval options
|
|
15609
|
+
* @returns Machine user token info
|
|
15610
|
+
*/
|
|
15611
|
+
async function getMachineUserToken(options) {
|
|
15612
|
+
return await getMachineUserTokenInternal(options);
|
|
15613
|
+
}
|
|
15618
15614
|
const tokenCommand = defineAppCommand({
|
|
15619
15615
|
name: "token",
|
|
15620
15616
|
description: "Get an access token for a machine user.",
|
|
@@ -15622,13 +15618,13 @@ const tokenCommand = defineAppCommand({
|
|
|
15622
15618
|
...deploymentArgs,
|
|
15623
15619
|
name: arg(z.string().optional(), {
|
|
15624
15620
|
positional: true,
|
|
15625
|
-
description: "Machine user name. Falls back to the active profile's default machine user."
|
|
15626
|
-
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
15621
|
+
description: "Machine user name. Falls back to TAILOR_PLATFORM_MACHINE_USER_NAME, then the active profile's default machine user."
|
|
15627
15622
|
})
|
|
15628
15623
|
}),
|
|
15629
15624
|
run: async (args) => {
|
|
15630
|
-
const token = await
|
|
15625
|
+
const token = await getMachineUserTokenInternal({
|
|
15631
15626
|
name: args.name,
|
|
15627
|
+
nameSource: resolveMachineUserInputSource(args.name, process.argv.slice(2), { valueIsExplicit: args.name !== void 0 }),
|
|
15632
15628
|
workspaceId: args["workspace-id"],
|
|
15633
15629
|
profile: args.profile,
|
|
15634
15630
|
configPath: args.config
|
|
@@ -17181,7 +17177,7 @@ async function generate(options) {
|
|
|
17181
17177
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
17182
17178
|
let pluginManager;
|
|
17183
17179
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
17184
|
-
const { defineApplication } = await import("./application-
|
|
17180
|
+
const { defineApplication } = await import("./application-BO4ZF8wP.mjs");
|
|
17185
17181
|
const application = defineApplication({
|
|
17186
17182
|
config,
|
|
17187
17183
|
pluginManager
|
|
@@ -18869,7 +18865,8 @@ const queryBaseOptionsSchema = z.object({
|
|
|
18869
18865
|
profile: z.string().optional(),
|
|
18870
18866
|
configPath: z.string().optional(),
|
|
18871
18867
|
engine: queryEngineSchema,
|
|
18872
|
-
machineUser: z.string().optional()
|
|
18868
|
+
machineUser: z.string().optional(),
|
|
18869
|
+
machineUserSource: z.enum(["option", "env"]).optional()
|
|
18873
18870
|
});
|
|
18874
18871
|
const queryOptionsSchema = queryBaseOptionsSchema.extend({ query: z.string() });
|
|
18875
18872
|
async function getNamespaceFromSqlQuery(workspaceId, query, client, namespaces) {
|
|
@@ -18894,6 +18891,7 @@ async function loadOptions(options) {
|
|
|
18894
18891
|
if (!result.success) throw new Error(assertDefined(result.error.issues[0], "validation error missing issues").message);
|
|
18895
18892
|
const machineUser = await loadMachineUserName({
|
|
18896
18893
|
machineUser: result.data.machineUser,
|
|
18894
|
+
machineUserSource: result.data.machineUserSource,
|
|
18897
18895
|
profile: result.data.profile
|
|
18898
18896
|
});
|
|
18899
18897
|
if (!machineUser) throw new Error("Machine user is required. Specify --machine-user, set TAILOR_PLATFORM_MACHINE_USER_NAME, or set a profile default with 'tailor profile update <profile> --machine-user <name>'.");
|
|
@@ -19313,7 +19311,8 @@ const queryCommand = defineAppCommand({
|
|
|
19313
19311
|
profile: args.profile,
|
|
19314
19312
|
configPath: args.config,
|
|
19315
19313
|
engine: args.engine,
|
|
19316
|
-
machineUser: args["machine-user"]
|
|
19314
|
+
machineUser: args["machine-user"],
|
|
19315
|
+
machineUserSource: resolveMachineUserInputSource(args["machine-user"])
|
|
19317
19316
|
};
|
|
19318
19317
|
if (mode.mode === "abort") {
|
|
19319
19318
|
logger.info("Editor closed without a query. Nothing was executed.");
|
|
@@ -19456,5 +19455,5 @@ async function registerTsHook(tsHookUrl) {
|
|
|
19456
19455
|
}
|
|
19457
19456
|
|
|
19458
19457
|
//#endregion
|
|
19459
|
-
export { getOrganization as $, compareSnapshotWithRemote as $t, listCommand$3 as A, apiCommand as An, getExecutorWaitFailureMessage as At, show as B,
|
|
19460
|
-
//# sourceMappingURL=register-ts-hook-
|
|
19458
|
+
export { getOrganization as $, compareSnapshotWithRemote as $t, listCommand$3 as A, apiCommand as An, getExecutorWaitFailureMessage as At, show as B, listWorkflowExecutions as Bt, listCommand$2 as C, hasChanges as Cn, listWebhookExecutors as Ct, waitWorkflowExecution as D, PluginManager as Dn, listCommand$9 as Dt, waitCommand as E, sdkNameLabelKey as En, triggerExecutor as Et, generateCommand as F, startWorkflow as Ft, removeCommand$1 as G, deploy as Gt, extractOwnedNamespaces as H, formatKeyValueTable as Ht, generateMigrationScript as I, getCommand$5 as It, organizationTree as J, waitForExecution as Jt, updateCommand$1 as K, ensureConfigId as Kt, writeDbTypesFile as L, getWorkflow as Lt, truncate as M, assertWritable as Mn, listExecutorJobs as Mt, truncateCommand as N, defineAppCommand as Nn, watchExecutorJob as Nt, resumeCommand as O, generateUserTypes as On, listExecutors as Ot, generate as P, startCommand as Pt, getCommand$1 as Q, parseMigrationLabelNumber as Qt, getConfiguredEditorCommand as R, executionsCommand as Rt, listApps as S, formatMigrationDiff as Sn, getFunctionRegistry as St, healthCommand as T, resourceTrn as Tn, triggerCommand as Tt, logBetaWarning as U, getCommand$6 as Ut, showCommand as V, functionExecutionStatusToString as Vt, remove as W, getExecutor as Wt, listCommand$4 as X, MIGRATION_LABEL_KEY as Xt, treeCommand as Y, bundleMigrationScript as Yt, listOrganizations as Z, handleOptionalToRequiredError as Zt, getWorkspace as _, loadDiff as _n, listMachineUsers as _t, updateUser as a, MIGRATE_FILE_NAME as an, getFolder as at, createCommand as b, parseMigrationNumberArg as bn, listFunctionRegistries as bt, listCommand as c, compareLocalTypesWithSnapshot as cn, createCommand$1 as ct, inviteUser as d, getLatestMigrationNumber as dn, listOAuth2Clients as dt, generateAllTypeManifestsFromSnapshot as en, updateCommand$2 as et, restoreCommand as f, getMigrationDirPath as fn, getCommand$3 as ft, getCommand as g, isValidMigrationNumber as gn, listCommand$7 as gt, listWorkspaces as h, getNextMigrationNumber as hn, tokenCommand as ht, updateCommand as i, INITIAL_SCHEMA_NUMBER as in, getCommand$2 as it, listWorkflows as j, apiCall as jn, jobsCommand as jt, resumeWorkflow as k, prompt as kn, getExecutorJob as kt, listUsers as l, compareSnapshots as ln, createFolder as lt, listCommand$1 as m, getMigrationFiles as mn, getMachineUserToken as mt, query as n, DB_TYPES_FILE_NAME as nn, listCommand$5 as nt, removeCommand as o, SCHEMA_FILE_NAME as on, deleteCommand$1 as ot, restoreWorkspace as p, getMigrationFilePath as pn, getOAuth2Client as pt, updateOrganization as q, executeScript as qt, queryCommand as r, DIFF_FILE_NAME as rn, listFolders as rt, removeUser as s, assertValidMigrationFiles as sn, deleteFolder as st, registerTsHook as t, protoGqlPermission as tn, updateFolder as tt, inviteCommand as u, createSnapshotFromLocalTypes as un, listCommand$6 as ut, deleteCommand as v, reconstructSnapshotFromMigrations as vn, generate$1 as vt, getAppHealth as w, getNamespacesWithMigrations as wn, webhookCommand as wt, createWorkspace as x, formatDiffSummary as xn, getCommand$4 as xt, deleteWorkspace as y, formatMigrationNumber as yn, listCommand$8 as yt, openInConfiguredEditor as z, getWorkflowExecution as zt };
|
|
19459
|
+
//# sourceMappingURL=register-ts-hook-BM1caLT0.mjs.map
|