@tailor-platform/sdk 1.74.1 → 1.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{application-BsH6tkZC.mjs → application-BUfYmf0O.mjs} +291 -15
  3. package/dist/application-BUfYmf0O.mjs.map +1 -0
  4. package/dist/application-DbvD5UUz.mjs +3 -0
  5. package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
  6. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -0
  7. package/dist/cli/index.mjs +218 -66
  8. package/dist/cli/index.mjs.map +1 -1
  9. package/dist/cli/lib.mjs +2 -2
  10. package/dist/cli/query/index.d.mts +4 -0
  11. package/dist/completion/zsh-worker.zsh +10 -10
  12. package/dist/configure/config/types.d.mts +3 -1
  13. package/dist/configure/index.d.mts +3 -1
  14. package/dist/configure/index.mjs +112 -4
  15. package/dist/configure/index.mjs.map +1 -1
  16. package/dist/configure/services/index.d.mts +3 -1
  17. package/dist/configure/services/tailordb/schema.d.mts +28 -15
  18. package/dist/configure/services/workflow/execution-policy.d.mts +71 -0
  19. package/dist/configure/services/workflow/execution-policy.types.d.mts +104 -0
  20. package/dist/configure/services/workflow/index.d.mts +3 -1
  21. package/dist/configure/services/workflow/job.d.mts +7 -3
  22. package/dist/{globals-B8XX5TRB.mjs → globals-CcU1ONiK.mjs} +2 -2
  23. package/dist/globals-CcU1ONiK.mjs.map +1 -0
  24. package/dist/{job-CtU73PGa.mjs → job-D-PbD1P3.mjs} +5 -3
  25. package/dist/job-D-PbD1P3.mjs.map +1 -0
  26. package/dist/{registry-BozuxbPp.mjs → registry-NfSW0BRo.mjs} +4 -3
  27. package/dist/registry-NfSW0BRo.mjs.map +1 -0
  28. package/dist/resource_pb-BRv7AMXK.mjs +49 -0
  29. package/dist/resource_pb-BRv7AMXK.mjs.map +1 -0
  30. package/dist/runtime/globals.d.mts +1 -1
  31. package/dist/runtime/index.d.mts +1 -1
  32. package/dist/runtime/workflow.d.mts +22 -3
  33. package/dist/{runtime-DV1EnfMs.mjs → runtime-_vUgjiqT.mjs} +253 -254
  34. package/dist/runtime-_vUgjiqT.mjs.map +1 -0
  35. package/dist/{schema-Dl_y0m9e.mjs → schema-DrVyN-LP.mjs} +60 -36
  36. package/dist/schema-DrVyN-LP.mjs.map +1 -0
  37. package/dist/{service_pb-DjwIn4jO.mjs → service_pb-B2FF59sP.mjs} +1 -1
  38. package/dist/{service_pb-CIrhGwHk.mjs → service_pb-B5w9rjPY.mjs} +17 -50
  39. package/dist/service_pb-B5w9rjPY.mjs.map +1 -0
  40. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +1 -1
  41. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +29 -9
  42. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +35 -1
  43. package/dist/utils/test/index.mjs +1 -1
  44. package/dist/utils/test/index.mjs.map +1 -1
  45. package/dist/vitest/environment.mjs +1 -1
  46. package/dist/vitest/index.mjs +15 -12
  47. package/dist/vitest/index.mjs.map +1 -1
  48. package/dist/vitest/mocks/workflow.d.mts +5 -3
  49. package/dist/vitest/setup.mjs +1 -1
  50. package/dist/workflow-DSwnYPPP.mjs.map +1 -1
  51. package/docs/cli/auth.md +3 -3
  52. package/docs/cli/setup.md +8 -8
  53. package/docs/configuration.md +24 -0
  54. package/docs/services/tailordb.md +20 -0
  55. package/docs/services/workflow.md +78 -0
  56. package/package.json +1 -1
  57. package/dist/application-BsH6tkZC.mjs.map +0 -1
  58. package/dist/application-CSUhZMb5.mjs +0 -3
  59. package/dist/globals-B8XX5TRB.mjs.map +0 -1
  60. package/dist/job-CtU73PGa.mjs.map +0 -1
  61. package/dist/registry-BozuxbPp.mjs.map +0 -1
  62. package/dist/runtime-DV1EnfMs.mjs.map +0 -1
  63. package/dist/schema-Dl_y0m9e.mjs.map +0 -1
  64. package/dist/service_pb-CIrhGwHk.mjs.map +0 -1
@@ -1,20 +1,20 @@
1
- import { t as db } from "./schema-Dl_y0m9e.mjs";
2
- import { $ as CreateUserProfileConfigRequestSchema, A as UpdatePipelineServiceRequestSchema, At as Condition_Operator, B as UpdateExecutorExecutorRequestSchema, Ct as UserProfileProviderConfig_UserProfileProviderType, D as CreatePipelineResolverRequestSchema, Dt as ApplicationSchemaUpdateAttemptStatus, E as UpdateSecretManagerSecretRequestSchema, Et as UpdateApplicationRequestSchema, F as IdPPermissionOperator, G as CreateAuthHookRequestSchema, H as ExecutorTargetType, I as IdPPermissionPermit, J as CreateAuthOAuth2ClientRequestSchema, K as CreateAuthIDPConfigRequestSchema, L as FunctionExecution_Status, M as CreateIdPServiceRequestSchema, Mt as PageDirection, N as UpdateIdPServiceRequestSchema, O as CreatePipelineServiceRequestSchema, Ot as Subgraph_ServiceType, P as IdPLang, Q as CreateTenantConfigRequestSchema, S as UpdateStaticWebsiteRequestSchema, St as TenantProviderConfig_TenantProviderType, T as CreateSecretManagerVaultRequestSchema, Tt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, U as ExecutorTriggerType, V as ExecutorJobStatus, W as CreateAuthConnectionRequestSchema, X as CreateAuthSCIMResourceRequestSchema, Y as CreateAuthSCIMConfigRequestSchema, Z as CreateAuthServiceRequestSchema, _ as TailorDBType_Permission_Operator, _t as AuthSCIMAttribute_Mutability, a as WorkspacePlatformUserRole, at as UpdateAuthSCIMConfigRequestSchema, b as AddCustomDomainRequestSchema, bt as AuthSCIMConfig_AuthorizationType, c as UpdateWorkflowRequestSchema, ct as UpdateTenantConfigRequestSchema, d as CreateTailorDBServiceRequestSchema, dt as AuthConnection_Type, et as UpdateAuthConnectionRequestSchema, f as CreateTailorDBTypeRequestSchema, ft as AuthHookPoint, g as TailorDBGQLPermission_Permit, gt as AuthOAuth2Client_GrantType, h as TailorDBGQLPermission_Operator, ht as AuthOAuth2Client_ClientType, it as UpdateAuthOAuth2ClientRequestSchema, j as PipelineResolver_OperationType, jt as FilterSchema, k as UpdatePipelineResolverRequestSchema, kt as ConditionSchema, l as WorkflowExecution_Status, lt as UpdateUserProfileConfigRequestSchema, m as TailorDBGQLPermission_Action, mt as AuthInvokerSchema, nt as UpdateAuthIDPConfigRequestSchema, o as CreateWorkflowJobFunctionRequestSchema, ot as UpdateAuthSCIMResourceRequestSchema, p as UpdateTailorDBTypeRequestSchema, pt as AuthIDPConfig_AuthType, q as CreateAuthMachineUserRequestSchema, rt as UpdateAuthMachineUserRequestSchema, s as CreateWorkflowRequestSchema, st as UpdateAuthServiceRequestSchema, t as OperatorService, tt as UpdateAuthHookRequestSchema, u as WorkflowJobExecution_Status, ut as AuthConnection_Status, v as TailorDBType_Permission_Permit, vt as AuthSCIMAttribute_Type, w as CreateSecretManagerSecretRequestSchema, wt as CreateApplicationRequestSchema, x as CreateStaticWebsiteRequestSchema, y as TailorDBType_PermitAction, yt as AuthSCIMAttribute_Uniqueness, z as CreateExecutorExecutorRequestSchema } from "./service_pb-CIrhGwHk.mjs";
1
+ import { t as db } from "./schema-DrVyN-LP.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 { $ as getOrNull, A as hasUserTokenEntry, C as getDistDir, E as loadConfig, F as loadPlatformClientConfig, G as fetchAll, H as writePlatformConfig, J as fetchPaged, K as fetchAllTolerant, L as loadWorkspaceId, M as loadConfigPath, P as loadMachineUserName, Q as getOAuth2ClientId, R as platformConfigFromProfile, S as createBundleCache, T as hashFile, Z as getConsoleBaseUrl, at as byName, b as getPluginGenerationDependencies, c as HTTP_METHODS, d as buildResolverOperationHookExpr, et as getPlatformBaseUrl, f as assertUniqueLocalTailorDBTypeNames, g as platformBundleDefinePlugin, h as stringifyFunction, i as resolverBundleKey, it as resolveStaticWebsiteUrls, j as loadAccessToken, m as TailorDBTypeSchema, n as generatePluginFilesIfNeeded, nt as initOperatorClient, p as assertUniqueTailorDBTypeNamesWithExternal, q as fetchMachineUserToken, r as loadApplication, rt as isDefaultPlatform, t as defineApplication, u as buildExecutorArgsExpr, w as hashContent, x as hasGenerationHooks, z as readPlatformConfig } from "./application-BsH6tkZC.mjs";
5
+ import { $ as getOAuth2ClientId, B as readPlatformConfig, C as createBundleCache, Ct as toPageDirection, D as loadConfig, E as hashFile, F as loadMachineUserName, I as loadPlatformClientConfig, J as fetchMachineUserToken, K as fetchAll, M as loadAccessToken, N as loadConfigPath, Q as getConsoleBaseUrl, R as loadWorkspaceId, S as hasGenerationHooks, St as resolveMachineUserInputSource, T as hashContent, U as writePlatformConfig, Y as fetchPaged, _ as platformBundleDefinePlugin, _t as organizationArgs, at as resolveStaticWebsiteUrls, bt as parseDuration, ct as configArg, d as buildExecutorArgsExpr, dt as durationArg, et as getOrNull, f as buildResolverOperationHookExpr, ft as folderArgs, g as stringifyFunction, gt as orderArg, h as TailorDBTypeSchema, ht as nonNegativeIntArg, i as resolverBundleKey, it as isDefaultPlatform, j as hasUserTokenEntry, l as HTTP_METHODS, lt as confirmationArgs, m as assertUniqueTailorDBTypeNamesWithExternal, n as generatePluginFilesIfNeeded, o as WorkflowJobFunctionExecutionPolicySchema, ot as byName, p as assertUniqueLocalTailorDBTypeNames, q as fetchAllTolerant, r as loadApplication, rt as initOperatorClient, t as defineApplication, tt as getPlatformBaseUrl, ut as deploymentArgs, vt as pagedLogArgs, w as getDistDir, wt as workspaceArgs, x as getPluginGenerationDependencies, xt as positiveIntArg, yt as paginationArgs, z as platformConfigFromProfile } from "./application-BUfYmf0O.mjs";
6
6
  import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-BCRJ-3NV.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-VSVGy1V0.mjs";
10
10
  import { n as isCLIError, t as createCLIError } from "./errors-Dtf2WPaW.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-CdqJEzkj.mjs";
12
13
  import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
13
14
  import { z } from "zod";
14
15
  import { ScalarType, create, fromJson, toJson } from "@bufbuild/protobuf";
15
16
  import * as fs$1 from "node:fs";
16
17
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
17
- import { parseEnv } from "node:util";
18
18
  import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
19
19
  import * as path from "pathe";
20
20
  import { formatDistanceToNowStrict } from "date-fns";
@@ -47,240 +47,6 @@ import { createPrompt } from "@toiroakr/read-multiline";
47
47
  import { astVisitor, parse } from "pgsql-ast-parser";
48
48
  import { parse as parse$1 } from "@0no-co/graphql.web";
49
49
 
50
- //#region src/cli/shared/args.ts
51
- const unitToMs = {
52
- ms: 1,
53
- s: 1e3,
54
- m: 60 * 1e3
55
- };
56
- const durationPattern = /^(\d+)(ms|s|m)$/;
57
- /**
58
- * Schema for duration string validation (e.g., "3s", "500ms", "1m")
59
- * Only validates format; use parseDuration() to convert to milliseconds
60
- */
61
- const durationArg = z.string().refine((val) => durationPattern.test(val), { message: "Invalid duration format. Expected format: '3s', '500ms', '1m'" }).refine((val) => {
62
- const match = val.match(durationPattern);
63
- if (!match) return false;
64
- const digits = match[1];
65
- return digits !== void 0 && parseInt(digits, 10) > 0;
66
- }, { message: "Duration must be greater than 0" });
67
- /**
68
- * Parse a validated duration string into milliseconds
69
- * @param duration - Duration string (e.g., "3s", "500ms", "1m")
70
- * @returns Duration in milliseconds
71
- */
72
- function parseDuration(duration) {
73
- const match = assertDefined(duration.match(durationPattern), `invalid duration format: ${duration}`);
74
- const value = parseInt(assertDefined(match[1], "duration digits group missing"), 10);
75
- const unit = assertDefined(match[2], "duration unit group missing");
76
- return value * unitToMs[unit];
77
- }
78
- /**
79
- * Schema for positive integer validation (from string input)
80
- * Transforms the string to a number
81
- */
82
- const positiveIntArg = z.coerce.number().int().positive();
83
- /**
84
- * Schema for non-negative integer validation (from string input).
85
- * Accepts 0 (used for `--limit 0` to disable the limit).
86
- */
87
- const nonNegativeIntArg = z.coerce.number().int().nonnegative();
88
- /**
89
- * Schema for sort order (`asc` or `desc`).
90
- */
91
- const orderArg = z.enum(["asc", "desc"]);
92
- /**
93
- * Translate a CLI `--order` value into the proto `PageDirection` enum.
94
- * Returns `undefined` when the user did not specify an order so that
95
- * callers can omit the field and fall back to the server default.
96
- * @param order - Order string from CLI args (`"asc"` | `"desc"` | undefined)
97
- * @returns PageDirection, or undefined when `order` is undefined
98
- */
99
- function toPageDirection(order) {
100
- if (order === void 0) return void 0;
101
- return order === "asc" ? PageDirection.ASC : PageDirection.DESC;
102
- }
103
- /**
104
- * Load env files from parsed arguments.
105
- * Processes --env-file first, then --env-file-if-exists.
106
- *
107
- * Follows Node.js --env-file behavior:
108
- * - Variables already set in the environment are NOT overwritten
109
- * - Variables from later files override those from earlier files
110
- * @param envFiles - Required env file path(s) that must exist
111
- * @param envFilesIfExists - Optional env file path(s) that are loaded if they exist
112
- */
113
- function loadEnvFiles(envFiles, envFilesIfExists) {
114
- const originalEnvKeys = new Set(Object.keys(process.env));
115
- const load = (files, required) => {
116
- for (const file of [files ?? []].flat()) {
117
- const envPath = path.resolve(process.cwd(), file);
118
- if (!fs$1.existsSync(envPath)) {
119
- if (required) throw new Error(`Environment file not found: ${envPath}`);
120
- continue;
121
- }
122
- const parsed = parseEnv(fs$1.readFileSync(envPath, "utf-8"));
123
- for (const [key, value] of Object.entries(parsed)) {
124
- if (originalEnvKeys.has(key)) continue;
125
- process.env[key] = value;
126
- }
127
- }
128
- };
129
- load(envFiles, true);
130
- load(envFilesIfExists, false);
131
- }
132
- /**
133
- * Common arguments for all CLI commands
134
- *
135
- * NOTE: --env-file and --env-file-if-exists collide with Node.js flags due to a bug
136
- * (https://github.com/nodejs/node/issues/54232). Node.js parses these even after the
137
- * script path, causing warnings (twice due to tsx loader).
138
- */
139
- const commonArgs = {
140
- "env-file": arg(z.string().optional(), {
141
- alias: "e",
142
- description: "Path to the environment file (error if not found)",
143
- completion: {
144
- type: "file",
145
- matcher: [".env.*", ".env"]
146
- }
147
- }),
148
- "env-file-if-exists": arg(z.string().optional(), {
149
- description: "Path to the environment file (ignored if not found)",
150
- completion: {
151
- type: "file",
152
- matcher: [".env.*", ".env"]
153
- },
154
- effect: (_value, { args }) => {
155
- loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
156
- }
157
- }),
158
- verbose: arg(z.boolean().default(false), {
159
- description: "Enable verbose logging",
160
- effect: (value) => {
161
- verboseMode = value;
162
- }
163
- }),
164
- json: arg(z.boolean().default(false), {
165
- alias: "j",
166
- description: "Output as JSON",
167
- effect: (value) => {
168
- logger.jsonMode = value;
169
- }
170
- })
171
- };
172
- /**
173
- * Arguments for commands that require workspace context
174
- */
175
- const workspaceArgs = {
176
- "workspace-id": arg(z.string().optional(), {
177
- alias: "w",
178
- description: "Workspace ID",
179
- env: "TAILOR_PLATFORM_WORKSPACE_ID",
180
- completion: { type: "none" }
181
- }),
182
- profile: arg(z.string().optional(), {
183
- alias: "p",
184
- description: "Workspace profile",
185
- env: "TAILOR_PLATFORM_PROFILE",
186
- completion: { type: "none" }
187
- })
188
- };
189
- /**
190
- * Shared config arg for commands that accept a config file path
191
- */
192
- const configArg = { config: arg(z.string().default("tailor.config.ts"), {
193
- alias: "c",
194
- description: "Path to SDK config file",
195
- env: "TAILOR_PLATFORM_SDK_CONFIG_PATH",
196
- completion: {
197
- type: "file",
198
- extensions: ["ts"]
199
- }
200
- }) };
201
- /**
202
- * Shared config arg for commands that accept one or more comma-separated config file paths
203
- */
204
- const multiConfigArg = { config: arg(z.string().default("tailor.config.ts"), {
205
- alias: "c",
206
- description: "Path to SDK config file. Use comma-separated paths to deploy multiple apps together.",
207
- env: "TAILOR_PLATFORM_SDK_CONFIG_PATH",
208
- completion: {
209
- type: "file",
210
- extensions: ["ts"]
211
- }
212
- }) };
213
- /**
214
- * Arguments for commands that interact with deployed resources (includes config)
215
- */
216
- const deploymentArgs = {
217
- ...workspaceArgs,
218
- ...configArg
219
- };
220
- /**
221
- * Arguments for commands that require confirmation
222
- */
223
- const confirmationArgs = { yes: arg(z.boolean().default(false), {
224
- alias: "y",
225
- description: "Skip confirmation prompts"
226
- }) };
227
- /**
228
- * Arguments for commands that require organization context
229
- */
230
- const organizationArgs = { "organization-id": arg(z.string(), {
231
- alias: "o",
232
- description: "Organization ID",
233
- env: "TAILOR_PLATFORM_ORGANIZATION_ID",
234
- completion: { type: "none" }
235
- }) };
236
- /**
237
- * Arguments for list commands that accept `--order` / `--limit`. Sort
238
- * order defaults to `desc` (newest first) because most callers want the
239
- * latest items; pass `--order asc` to opt in to ascending order. The
240
- * limit is unbounded by default so existing invocations keep returning
241
- * every item; pass `--limit N` to cap the result size.
242
- * @param defaultOrder - Default value for `--order` (defaults to `"desc"`)
243
- * @returns Argument shape suitable for spreading into a command schema
244
- */
245
- const paginationArgs = (defaultOrder = "desc") => ({
246
- order: arg(orderArg.default(defaultOrder), { description: "Sort order (asc or desc)" }),
247
- limit: arg(nonNegativeIntArg.optional(), {
248
- alias: "l",
249
- description: "Maximum number of items to return (0 or omit: unlimited)"
250
- })
251
- });
252
- /**
253
- * Arguments for time-series log list commands. Defaults to newest-first
254
- * (`desc`) and a 50-item cap so that listing stays responsive on busy
255
- * workspaces. Pass `--limit 0` to disable the cap and fetch all entries.
256
- */
257
- const pagedLogArgs = {
258
- order: arg(orderArg.default("desc"), { description: "Sort order (asc or desc)" }),
259
- limit: arg(nonNegativeIntArg.default(50), {
260
- alias: "l",
261
- description: "Maximum number of items to return (0: unlimited)"
262
- })
263
- };
264
- /**
265
- * Arguments for commands that require folder context
266
- */
267
- const folderArgs = { "folder-id": arg(z.string(), {
268
- alias: "f",
269
- description: "Folder ID",
270
- env: "TAILOR_PLATFORM_FOLDER_ID",
271
- completion: { type: "none" }
272
- }) };
273
- let verboseMode = false;
274
- /**
275
- * Returns whether verbose mode is enabled.
276
- * Used by the global cleanup handler which doesn't have access to parsed args.
277
- * @returns Whether verbose mode is enabled
278
- */
279
- function isVerbose() {
280
- return verboseMode;
281
- }
282
-
283
- //#endregion
284
50
  //#region src/cli/shared/command.ts
285
51
  /**
286
52
  * defineCommand with global args type (CommonArgsType).
@@ -10813,6 +10579,198 @@ function normalizeRetryPolicyForCompare(policy) {
10813
10579
  };
10814
10580
  }
10815
10581
 
10582
+ //#endregion
10583
+ //#region src/cli/commands/deploy/workflow-execution-policy.ts
10584
+ function toConcurrencyPolicyInit(policy) {
10585
+ if (!policy) return void 0;
10586
+ return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
10587
+ }
10588
+ function normalizeComparableConcurrency(policy) {
10589
+ if (!policy || !policy.maxConcurrentExecutions) return void 0;
10590
+ return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
10591
+ }
10592
+ /**
10593
+ * The declared key prefix, regardless of variant. `ExecutionPolicyWildcardInstance`
10594
+ * omits `key` from its public type to force callers through `keyFor()`, but
10595
+ * the underlying value always carries it when produced by
10596
+ * `defineWorkflowExecutionPolicy()` or `defineWorkflowExecutionPolicies()`.
10597
+ * @param policy - Declared policy from the config
10598
+ * @returns The declared key prefix
10599
+ */
10600
+ function declaredKey(policy) {
10601
+ if (policy.matchType === "exact") return policy.key;
10602
+ const key = policy.key;
10603
+ 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.`);
10604
+ return key;
10605
+ }
10606
+ /**
10607
+ * The literal key the platform registers for a declared policy: `key` with a
10608
+ * trailing `*` appended when `matchType` is `"prefix"`.
10609
+ * @param policy - Declared policy from the config
10610
+ * @returns The platform-facing execution policy key
10611
+ */
10612
+ function toPlatformExecutionPolicyKey(policy) {
10613
+ const key = declaredKey(policy);
10614
+ return policy.matchType === "prefix" ? `${key}*` : key;
10615
+ }
10616
+ /**
10617
+ * Validate a declared execution policy against the parser schema. Throws with
10618
+ * a descriptive error when `name` or the platform-facing key violates the
10619
+ * platform grammar.
10620
+ * @param policy - Declared policy from the config
10621
+ */
10622
+ function validatePolicy(policy) {
10623
+ 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).`);
10624
+ const parsed = WorkflowJobFunctionExecutionPolicySchema.safeParse({
10625
+ name: policy.name,
10626
+ key: toPlatformExecutionPolicyKey(policy),
10627
+ concurrencyPolicy: policy.concurrencyPolicy
10628
+ });
10629
+ if (!parsed.success) throw new Error(`Invalid workflow execution policy "${policy.name}": ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
10630
+ }
10631
+ /**
10632
+ * Plan workflow job function execution policy changes based on desired
10633
+ * declarations and current remote state.
10634
+ * @param client - Operator client instance
10635
+ * @param workspaceId - Workspace ID
10636
+ * @param appName - Application name
10637
+ * @param appId - Application ID for ownership metadata
10638
+ * @param declared - Policies declared in the config (property name → instance)
10639
+ * @returns Planned execution policy changes
10640
+ */
10641
+ async function planWorkflowJobFunctionExecutionPolicy(client, workspaceId, appName, appId, declared) {
10642
+ const changeSet = createChangeSet("Workflow execution policies");
10643
+ const conflicts = [];
10644
+ const unmanaged = [];
10645
+ const resourceOwners = /* @__PURE__ */ new Set();
10646
+ const declaredList = Object.values(declared);
10647
+ for (const policy of declaredList) validatePolicy(policy);
10648
+ const existing = await fetchExistingResourcesWithLabels({
10649
+ client,
10650
+ fetchPage: async (pageToken, pageSize) => {
10651
+ const response = await client.listWorkflowJobFunctionExecutionPolicies({
10652
+ workspaceId,
10653
+ pageToken,
10654
+ pageSize
10655
+ });
10656
+ return [response.policies, response.nextPageToken];
10657
+ },
10658
+ getName: (resource) => resource.name,
10659
+ getTrn: (name) => resourceTrn(workspaceId, "workflow_job_function_execution_policy", name)
10660
+ });
10661
+ const seenNames = /* @__PURE__ */ new Set();
10662
+ for (const policy of declaredList) {
10663
+ 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.`);
10664
+ seenNames.add(policy.name);
10665
+ const metaRequest = await buildMetaRequest({
10666
+ trn: resourceTrn(workspaceId, "workflow_job_function_execution_policy", policy.name),
10667
+ appName,
10668
+ appId
10669
+ });
10670
+ const found = existing[policy.name];
10671
+ if (found) {
10672
+ const owned = trackDesiredResourceOwnership({
10673
+ labels: found.allLabels,
10674
+ ownerLabel: found.label,
10675
+ appName,
10676
+ appId,
10677
+ resourceType: "Workflow execution policy",
10678
+ resourceName: policy.name,
10679
+ conflicts,
10680
+ unmanaged
10681
+ });
10682
+ const remoteKey = found.resource.executionPolicyKey;
10683
+ const desiredKey = toPlatformExecutionPolicyKey(policy);
10684
+ const remoteConcurrency = normalizeComparableConcurrency(found.resource.concurrencyPolicy);
10685
+ const desiredConcurrency = normalizeComparableConcurrency(policy.concurrencyPolicy);
10686
+ if (owned && hasMatchingSdkVersion(found.allLabels, metaRequest.labels) && remoteKey === desiredKey && areNormalizedEqual(remoteConcurrency, desiredConcurrency)) changeSet.unchanged.push({ name: policy.name });
10687
+ else if (remoteKey !== desiredKey) changeSet.replaces.push({
10688
+ name: policy.name,
10689
+ workspaceId,
10690
+ policy,
10691
+ metaRequest
10692
+ });
10693
+ else changeSet.updates.push({
10694
+ name: policy.name,
10695
+ workspaceId,
10696
+ policy,
10697
+ metaRequest
10698
+ });
10699
+ delete existing[policy.name];
10700
+ } else changeSet.creates.push({
10701
+ name: policy.name,
10702
+ workspaceId,
10703
+ policy,
10704
+ metaRequest
10705
+ });
10706
+ }
10707
+ for (const [name, remaining] of Object.entries(existing)) {
10708
+ if (!remaining) continue;
10709
+ if (trackRemainingResourceOwner({
10710
+ labels: remaining.allLabels,
10711
+ ownerLabel: remaining.label,
10712
+ appName,
10713
+ appId,
10714
+ resourceOwners
10715
+ })) changeSet.deletes.push({
10716
+ name,
10717
+ workspaceId
10718
+ });
10719
+ }
10720
+ return {
10721
+ changeSet,
10722
+ conflicts,
10723
+ unmanaged,
10724
+ resourceOwners
10725
+ };
10726
+ }
10727
+ /**
10728
+ * Apply planned workflow execution policy changes for the given phase.
10729
+ * @param client - Operator client instance
10730
+ * @param plan - Result of `planWorkflowJobFunctionExecutionPolicy`
10731
+ * @param phase - Apply phase
10732
+ * @returns Promise that resolves when policies are applied
10733
+ */
10734
+ async function applyWorkflowJobFunctionExecutionPolicy(client, plan, phase = "create-update") {
10735
+ const { changeSet } = plan;
10736
+ if (phase === "create-update") await Promise.all([
10737
+ ...changeSet.replaces.map(async (replace) => {
10738
+ await client.deleteWorkflowJobFunctionExecutionPolicy({
10739
+ workspaceId: replace.workspaceId,
10740
+ executionPolicyName: replace.name
10741
+ });
10742
+ await client.createWorkflowJobFunctionExecutionPolicy({
10743
+ workspaceId: replace.workspaceId,
10744
+ executionPolicyName: replace.policy.name,
10745
+ executionPolicyKey: toPlatformExecutionPolicyKey(replace.policy),
10746
+ concurrencyPolicy: toConcurrencyPolicyInit(replace.policy.concurrencyPolicy)
10747
+ });
10748
+ await client.setMetadata(replace.metaRequest);
10749
+ }),
10750
+ ...changeSet.creates.map(async (create) => {
10751
+ await client.createWorkflowJobFunctionExecutionPolicy({
10752
+ workspaceId: create.workspaceId,
10753
+ executionPolicyName: create.policy.name,
10754
+ executionPolicyKey: toPlatformExecutionPolicyKey(create.policy),
10755
+ concurrencyPolicy: toConcurrencyPolicyInit(create.policy.concurrencyPolicy)
10756
+ });
10757
+ await client.setMetadata(create.metaRequest);
10758
+ }),
10759
+ ...changeSet.updates.map(async (update) => {
10760
+ await client.updateWorkflowJobFunctionExecutionPolicy({
10761
+ workspaceId: update.workspaceId,
10762
+ executionPolicyName: update.policy.name,
10763
+ concurrencyPolicy: toConcurrencyPolicyInit(update.policy.concurrencyPolicy)
10764
+ });
10765
+ await client.setMetadata(update.metaRequest);
10766
+ })
10767
+ ]);
10768
+ else await Promise.all(changeSet.deletes.map((del) => client.deleteWorkflowJobFunctionExecutionPolicy({
10769
+ workspaceId: del.workspaceId,
10770
+ executionPolicyName: del.name
10771
+ })));
10772
+ }
10773
+
10816
10774
  //#endregion
10817
10775
  //#region src/cli/commands/deploy/apply-phases.ts
10818
10776
  /**
@@ -10846,10 +10804,12 @@ async function applyDeploymentPlans(client, workspaceId, deployments) {
10846
10804
  });
10847
10805
  await withSpan("apply.createUpdateDependentServices", async () => {
10848
10806
  await forEachDeployment((d) => applyExecutor(client, d.executor, "create-update"));
10807
+ await forEachDeployment((d) => applyWorkflowJobFunctionExecutionPolicy(client, d.workflowExecutionPolicy, "create-update"));
10849
10808
  await forEachDeployment((d) => applyWorkflow(client, d.workflow, "create-update"));
10850
10809
  });
10851
10810
  await withSpan("apply.deleteDependentServices", async () => {
10852
10811
  await forEachDeployment((d) => applyWorkflow(client, d.workflow, "delete"));
10812
+ await forEachDeployment((d) => applyWorkflowJobFunctionExecutionPolicy(client, d.workflowExecutionPolicy, "delete"));
10853
10813
  await forEachDeployment((d) => applyExecutor(client, d.executor, "delete"));
10854
10814
  await forEachDeployment((d) => applyStaticWebsite(client, d.staticWebsite, "delete"));
10855
10815
  await forEachDeployment((d) => applyAIGateway(client, d.aiGateway, "delete"));
@@ -11174,7 +11134,7 @@ function validateItems(params) {
11174
11134
  * @param input - Plan results from the plan phase
11175
11135
  */
11176
11136
  async function validatePlan(input) {
11177
- const { tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = input;
11137
+ const { tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, workflowExecutionPolicy, secretManager } = input;
11178
11138
  const validator = createValidator();
11179
11139
  const violations = [];
11180
11140
  function creates(schema, kind, items) {
@@ -11317,6 +11277,23 @@ async function validatePlan(input) {
11317
11277
  }
11318
11278
  })));
11319
11279
  }
11280
+ creates(CreateWorkflowJobFunctionExecutionPolicyRequestSchema, "Workflow execution policy", [...workflowExecutionPolicy.changeSet.creates, ...workflowExecutionPolicy.changeSet.replaces].map((item) => ({
11281
+ name: item.name,
11282
+ request: {
11283
+ workspaceId: item.workspaceId,
11284
+ executionPolicyName: item.policy.name,
11285
+ executionPolicyKey: toPlatformExecutionPolicyKey(item.policy),
11286
+ ...item.policy.concurrencyPolicy && { concurrencyPolicy: { maxConcurrentExecutions: item.policy.concurrencyPolicy.maxConcurrentExecutions } }
11287
+ }
11288
+ })));
11289
+ updates(UpdateWorkflowJobFunctionExecutionPolicyRequestSchema, "Workflow execution policy", workflowExecutionPolicy.changeSet.updates.map((item) => ({
11290
+ name: item.name,
11291
+ request: {
11292
+ workspaceId: item.workspaceId,
11293
+ executionPolicyName: item.policy.name,
11294
+ ...item.policy.concurrencyPolicy && { concurrencyPolicy: { maxConcurrentExecutions: item.policy.concurrencyPolicy.maxConcurrentExecutions } }
11295
+ }
11296
+ })));
11320
11297
  creates(CreateSecretManagerVaultRequestSchema, "Secret Manager vault", secretManager.vaultChangeSet.creates.map((item) => ({
11321
11298
  name: item.name,
11322
11299
  request: vaultCreateRequest(item)
@@ -11549,6 +11526,7 @@ function buildPlanReport(results) {
11549
11526
  const executorEntries = formatExecutorChangeEntries(results.executor.changeSet, buildPlannedExecutorsByName(results.executor.changeSet), results.functionRegistry.executorFunctionChanges);
11550
11527
  const resolverEntries = formatResolverChangeEntries(results.pipeline.changeSet.resolver, results.functionRegistry.resolverFunctionChanges);
11551
11528
  const workflowEntries = formatWorkflowChangeEntries(results.workflow.changeSet, results.functionRegistry.workflowJobChanges);
11529
+ const workflowExecutionPolicyEntries = formatChangeSetEntries(results.workflowExecutionPolicy.changeSet, ["executionPolicy"]);
11552
11530
  const authHookEntries = formatAuthHookChangeEntries(results.auth.changeSet.authHook, results.functionRegistry.authHookFunctionChanges);
11553
11531
  const tailorDBEntries = [...formatTailorDBResourceChangeEntries(results.tailorDB.changeSet.type, results.tailorDB.changeSet.gqlPermission)];
11554
11532
  const pipelineEntries = [...resolverEntries];
@@ -11579,6 +11557,7 @@ function buildPlanReport(results) {
11579
11557
  ...pipelineEntries,
11580
11558
  ...executorEntries,
11581
11559
  ...workflowEntries,
11560
+ ...workflowExecutionPolicyEntries,
11582
11561
  ...idpEntries,
11583
11562
  ...authEntries
11584
11563
  ];
@@ -11951,7 +11930,7 @@ async function planDeploymentTarget(params) {
11951
11930
  };
11952
11931
  const functionRegistry = await withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, application.id, functionEntries));
11953
11932
  const unchangedWorkflowJobs = new Set(functionRegistry.changeSet.unchanged.filter((entry) => entry.name.startsWith(WORKFLOW_PREFIX)).map((entry) => entry.name.slice(WORKFLOW_PREFIX.length)));
11954
- const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
11933
+ const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, workflowExecutionPolicy, secretManager] = await Promise.all([
11955
11934
  withSpan("plan.tailorDB", () => planTailorDB(ctx)),
11956
11935
  withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
11957
11936
  withSpan("plan.aiGateway", () => planAIGateway(ctx)),
@@ -11961,6 +11940,7 @@ async function planDeploymentTarget(params) {
11961
11940
  withSpan("plan.application", () => planApplication(ctx, httpAdapterBuildResult)),
11962
11941
  withSpan("plan.executor", () => planExecutor(ctx)),
11963
11942
  withSpan("plan.workflow", () => planWorkflow(client, workspaceId, application.name, application.id, workflowService?.workflows ?? {}, workflowBuildResult?.mainJobDeps ?? {}, unchangedWorkflowJobs)),
11943
+ withSpan("plan.workflowExecutionPolicy", () => planWorkflowJobFunctionExecutionPolicy(client, workspaceId, application.name, application.id, config.workflow?.executionPolicies ?? {})),
11964
11944
  withSpan("plan.secretManager", () => planSecretManager(ctx))
11965
11945
  ]);
11966
11946
  return {
@@ -11975,6 +11955,7 @@ async function planDeploymentTarget(params) {
11975
11955
  app,
11976
11956
  executor,
11977
11957
  workflow,
11958
+ workflowExecutionPolicy,
11978
11959
  secretManager
11979
11960
  };
11980
11961
  });
@@ -12002,6 +11983,7 @@ function collectOwnerConflicts(results) {
12002
11983
  ...results.pipeline.conflicts,
12003
11984
  ...results.executor.conflicts,
12004
11985
  ...results.workflow.conflicts,
11986
+ ...results.workflowExecutionPolicy.conflicts,
12005
11987
  ...results.secretManager.conflicts
12006
11988
  ];
12007
11989
  }
@@ -12016,6 +11998,7 @@ function collectUnmanagedResources(results) {
12016
11998
  ...results.pipeline.unmanaged,
12017
11999
  ...results.executor.unmanaged,
12018
12000
  ...results.workflow.unmanaged,
12001
+ ...results.workflowExecutionPolicy.unmanaged,
12019
12002
  ...results.secretManager.unmanaged
12020
12003
  ];
12021
12004
  }
@@ -12030,6 +12013,7 @@ function collectResourceOwners(results) {
12030
12013
  ...results.pipeline.resourceOwners,
12031
12014
  ...results.executor.resourceOwners,
12032
12015
  ...results.workflow.resourceOwners,
12016
+ ...results.workflowExecutionPolicy.resourceOwners,
12033
12017
  ...results.secretManager.resourceOwners
12034
12018
  ]);
12035
12019
  }
@@ -12175,6 +12159,12 @@ const DEPLOY_MANAGED_RESOURCE_DEFINITIONS = [
12175
12159
  namesOf: (target) => Object.values(target.application.workflowService?.workflows ?? {}).map((workflow) => workflow.name),
12176
12160
  changeSetOf: (results) => results.workflow.changeSet
12177
12161
  },
12162
+ {
12163
+ resourceLabel: "Workflow execution policy",
12164
+ resourceType: "workflow_job_function_execution_policy",
12165
+ namesOf: (target) => Object.values(target.config.workflow?.executionPolicies ?? {}).map((policy) => policy.name),
12166
+ changeSetOf: (results) => results.workflowExecutionPolicy.changeSet
12167
+ },
12178
12168
  {
12179
12169
  resourceLabel: "Auth connection",
12180
12170
  resourceType: "auth.connection",
@@ -13712,6 +13702,7 @@ async function startWorkflowCore(options) {
13712
13702
  async function startWorkflowByName(options) {
13713
13703
  const machineUser = await loadMachineUserName({
13714
13704
  machineUser: options.machineUser,
13705
+ machineUserSource: options.machineUserSource,
13715
13706
  profile: options.profile
13716
13707
  });
13717
13708
  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-sdk profile update <profile> --machine-user <name>'.");
@@ -13774,6 +13765,7 @@ const startCommand = defineAppCommand({
13774
13765
  const { executionId, wait } = await startWorkflowByName({
13775
13766
  name: args.name,
13776
13767
  machineUser: args["machine-user"],
13768
+ machineUserSource: resolveMachineUserInputSource(args["machine-user"]),
13777
13769
  arg: args.arg,
13778
13770
  workspaceId: args["workspace-id"],
13779
13771
  profile: args.profile,
@@ -15714,14 +15706,10 @@ const listCommand$7 = defineAppCommand({
15714
15706
 
15715
15707
  //#endregion
15716
15708
  //#region src/cli/commands/machineuser/token.ts
15717
- /**
15718
- * Get a machine user access token for the current application.
15719
- * @param options - Token retrieval options
15720
- * @returns Machine user token info
15721
- */
15722
- async function getMachineUserToken(options) {
15709
+ async function getMachineUserTokenInternal(options) {
15723
15710
  const name = await loadMachineUserName({
15724
15711
  machineUser: options.name,
15712
+ machineUserSource: options.nameSource,
15725
15713
  profile: options.profile
15726
15714
  });
15727
15715
  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-sdk profile update <profile> --machine-user <name>'.");
@@ -15751,6 +15739,14 @@ async function getMachineUserToken(options) {
15751
15739
  expiresAt: expiresAt.toISOString()
15752
15740
  };
15753
15741
  }
15742
+ /**
15743
+ * Get a machine user access token for the current application.
15744
+ * @param options - Token retrieval options
15745
+ * @returns Machine user token info
15746
+ */
15747
+ async function getMachineUserToken(options) {
15748
+ return await getMachineUserTokenInternal(options);
15749
+ }
15754
15750
  const tokenCommand = defineAppCommand({
15755
15751
  name: "token",
15756
15752
  description: "Get an access token for a machine user.",
@@ -15758,13 +15754,13 @@ const tokenCommand = defineAppCommand({
15758
15754
  ...deploymentArgs,
15759
15755
  name: arg(z.string().optional(), {
15760
15756
  positional: true,
15761
- description: "Machine user name. Falls back to the active profile's default machine user.",
15762
- env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
15757
+ description: "Machine user name. Falls back to TAILOR_PLATFORM_MACHINE_USER_NAME, then the active profile's default machine user."
15763
15758
  })
15764
15759
  }).strict(),
15765
15760
  run: async (args) => {
15766
- const token = await getMachineUserToken({
15761
+ const token = await getMachineUserTokenInternal({
15767
15762
  name: args.name,
15763
+ nameSource: resolveMachineUserInputSource(args.name, process.argv.slice(2), { valueIsExplicit: args.name !== void 0 }),
15768
15764
  workspaceId: args["workspace-id"],
15769
15765
  profile: args.profile,
15770
15766
  configPath: args.config
@@ -17297,7 +17293,7 @@ async function generate(options) {
17297
17293
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
17298
17294
  let pluginManager;
17299
17295
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
17300
- const { defineApplication } = await import("./application-CSUhZMb5.mjs");
17296
+ const { defineApplication } = await import("./application-DbvD5UUz.mjs");
17301
17297
  const application = defineApplication({
17302
17298
  config,
17303
17299
  pluginManager
@@ -18984,7 +18980,8 @@ const queryBaseOptionsSchema = z.object({
18984
18980
  profile: z.string().optional(),
18985
18981
  configPath: z.string().optional(),
18986
18982
  engine: queryEngineSchema,
18987
- machineUser: z.string().optional()
18983
+ machineUser: z.string().optional(),
18984
+ machineUserSource: z.enum(["option", "env"]).optional()
18988
18985
  });
18989
18986
  const queryOptionsSchema = queryBaseOptionsSchema.extend({ query: z.string() });
18990
18987
  async function getNamespaceFromSqlQuery(workspaceId, query, client, namespaces) {
@@ -19009,6 +19006,7 @@ async function loadOptions(options) {
19009
19006
  if (!result.success) throw new Error(assertDefined(result.error.issues[0], "validation error missing issues").message);
19010
19007
  const machineUser = await loadMachineUserName({
19011
19008
  machineUser: result.data.machineUser,
19009
+ machineUserSource: result.data.machineUserSource,
19012
19010
  profile: result.data.profile
19013
19011
  });
19014
19012
  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-sdk profile update <profile> --machine-user <name>'.");
@@ -19429,7 +19427,8 @@ const queryCommand = defineAppCommand({
19429
19427
  profile: args.profile,
19430
19428
  configPath: args.config,
19431
19429
  engine: args.engine,
19432
- machineUser: args["machine-user"]
19430
+ machineUser: args["machine-user"],
19431
+ machineUserSource: resolveMachineUserInputSource(args["machine-user"])
19433
19432
  };
19434
19433
  if (mode.mode === "abort") {
19435
19434
  logger.info("Editor closed without a query. Nothing was executed.");
@@ -19561,5 +19560,5 @@ function isDeno() {
19561
19560
  }
19562
19561
 
19563
19562
  //#endregion
19564
- export { getOrganization as $, compareSnapshotWithRemote as $t, listCommand$3 as A, apiCommand as An, getExecutorWaitFailureMessage as At, show as B, pagedLogArgs as Bn, 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, configArg as Fn, startWorkflow as Ft, removeCommand$1 as G, deploy as Gt, extractOwnedNamespaces as H, toPageDirection as Hn, formatKeyValueTable as Ht, generateMigrationScript as I, confirmationArgs as In, getCommand$5 as It, organizationTree as J, waitForExecution as Jt, updateCommand$1 as K, ensureConfigId as Kt, writeDbTypesFile as L, deploymentArgs as Ln, 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, commonArgs as Pn, startCommand as Pt, getCommand$1 as Q, parseMigrationLabelNumber as Qt, getConfiguredEditorCommand as R, isVerbose as Rn, executionsCommand as Rt, listApps as S, formatMigrationDiff as Sn, getFunctionRegistry as St, healthCommand as T, resourceTrn as Tn, triggerCommand as Tt, logBetaWarning as U, workspaceArgs as Un, getCommand$6 as Ut, showCommand as V, paginationArgs as Vn, 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, isNativeTypeScriptRuntime 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, multiConfigArg as zn, getWorkflowExecution as zt };
19565
- //# sourceMappingURL=runtime-DV1EnfMs.mjs.map
19563
+ 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, isNativeTypeScriptRuntime 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 };
19564
+ //# sourceMappingURL=runtime-_vUgjiqT.mjs.map