@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.
- package/CHANGELOG.md +22 -0
- package/dist/{application-BsH6tkZC.mjs → application-BUfYmf0O.mjs} +291 -15
- package/dist/application-BUfYmf0O.mjs.map +1 -0
- package/dist/application-DbvD5UUz.mjs +3 -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 +218 -66
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/query/index.d.mts +4 -0
- 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 +112 -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 +28 -15
- 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 -3
- package/dist/{globals-B8XX5TRB.mjs → globals-CcU1ONiK.mjs} +2 -2
- package/dist/globals-CcU1ONiK.mjs.map +1 -0
- package/dist/{job-CtU73PGa.mjs → job-D-PbD1P3.mjs} +5 -3
- package/dist/job-D-PbD1P3.mjs.map +1 -0
- package/dist/{registry-BozuxbPp.mjs → registry-NfSW0BRo.mjs} +4 -3
- package/dist/registry-NfSW0BRo.mjs.map +1 -0
- package/dist/resource_pb-BRv7AMXK.mjs +49 -0
- package/dist/resource_pb-BRv7AMXK.mjs.map +1 -0
- package/dist/runtime/globals.d.mts +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/runtime/workflow.d.mts +22 -3
- package/dist/{runtime-DV1EnfMs.mjs → runtime-_vUgjiqT.mjs} +253 -254
- package/dist/runtime-_vUgjiqT.mjs.map +1 -0
- package/dist/{schema-Dl_y0m9e.mjs → schema-DrVyN-LP.mjs} +60 -36
- package/dist/schema-DrVyN-LP.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 +1 -1
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.mjs +15 -12
- 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-DSwnYPPP.mjs.map +1 -1
- package/docs/cli/auth.md +3 -3
- package/docs/cli/setup.md +8 -8
- package/docs/configuration.md +24 -0
- package/docs/services/tailordb.md +20 -0
- package/docs/services/workflow.md +78 -0
- package/package.json +1 -1
- package/dist/application-BsH6tkZC.mjs.map +0 -1
- package/dist/application-CSUhZMb5.mjs +0 -3
- package/dist/globals-B8XX5TRB.mjs.map +0 -1
- package/dist/job-CtU73PGa.mjs.map +0 -1
- package/dist/registry-BozuxbPp.mjs.map +0 -1
- package/dist/runtime-DV1EnfMs.mjs.map +0 -1
- package/dist/schema-Dl_y0m9e.mjs.map +0 -1
- package/dist/service_pb-CIrhGwHk.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.76.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1699](https://github.com/tailor-platform/sdk/pull/1699) [`f6a8d07`](https://github.com/tailor-platform/sdk/commit/f6a8d0779f94c2de5502dfdc68348e4a41ceee47) Thanks [@dqn](https://github.com/dqn)! - Allow `setup coordinate --action` values to group multiple generated actions into one multi-config deploy by separating action names with commas.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#1702](https://github.com/tailor-platform/sdk/pull/1702) [`03143f5`](https://github.com/tailor-platform/sdk/commit/03143f5213d9fa9d3c7697de78f2376994716679) Thanks [@dqn](https://github.com/dqn)! - Clarify the setup delete warning for coordinator action references so grouped `--action` values tell users to remove the action name from the relevant value.
|
|
12
|
+
|
|
13
|
+
- [#1691](https://github.com/tailor-platform/sdk/pull/1691) [`2f3dbab`](https://github.com/tailor-platform/sdk/commit/2f3dbab7ed3cf40fa174a82053d70c23c356204d) Thanks [@dqn](https://github.com/dqn)! - Clarify when profile machine user override errors are caused by `TAILOR_PLATFORM_MACHINE_USER_NAME`.
|
|
14
|
+
|
|
15
|
+
- [#1701](https://github.com/tailor-platform/sdk/pull/1701) [`e8bcbdf`](https://github.com/tailor-platform/sdk/commit/e8bcbdf92f90f20cc292a4f6b998475e4aa35c8e) Thanks [@dqn](https://github.com/dqn)! - Show the `profile update --user` recovery command when `tailor-sdk login --profile` authenticates a different user than the profile references.
|
|
16
|
+
|
|
17
|
+
- [#1698](https://github.com/tailor-platform/sdk/pull/1698) [`dd25b69`](https://github.com/tailor-platform/sdk/commit/dd25b69ba829e7d446731b4cbf2f6753d2abde95) Thanks [@dqn](https://github.com/dqn)! - Reject duplicate TailorDB type-level builder calls at type-check time and runtime instead of silently overwriting earlier settings.
|
|
18
|
+
|
|
19
|
+
## 1.75.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#1679](https://github.com/tailor-platform/sdk/pull/1679) [`4ff2b23`](https://github.com/tailor-platform/sdk/commit/4ff2b23d84c5dd5f1692cc3b3f7b32b273b4d550) Thanks [@k1LoW](https://github.com/k1LoW)! - Add workflow job function execution policies. Declare them with `defineWorkflowExecutionPolicies` (or the single-key `defineWorkflowExecutionPolicy`), register them via `workflow.executionPolicies` on `defineConfig`, and pass the policy's `key` (or, for wildcard policies declared with `matchType: "prefix"`, the value returned by `keyFor(suffix)`) through the new `executionPolicyKey` option on `triggerJobFunction` / `job.trigger()` to apply the platform-side concurrency cap. `executionPolicyKey` only accepts values produced by a declared policy. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator`, passed as the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group) or as a `def` field on a single `defineWorkflowExecutionPolicy`.
|
|
24
|
+
|
|
3
25
|
## 1.74.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { n as isSdkBranded } from "./brand-Eo4pLXPJ.mjs";
|
|
2
|
+
import { i as PageDirection } from "./resource_pb-BRv7AMXK.mjs";
|
|
2
3
|
import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
|
|
3
4
|
import { a as parseBoolean, n as logger, r as styles } from "./logger-BEiZZ3qT.mjs";
|
|
4
5
|
import { a as TailorFieldSchema, i as AuthInvokerSchema, n as ExecutorSchema, o as loadFilesWithIgnores, r as AuthConfigSchema, s as functionSchema, t as createExecutorService } from "./service-BCRJ-3NV.mjs";
|
|
@@ -11,10 +12,12 @@ import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
|
|
|
11
12
|
import { i as userAgent, n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-VSVGy1V0.mjs";
|
|
12
13
|
import { t as createCLIError } from "./errors-Dtf2WPaW.mjs";
|
|
13
14
|
import { builtinModules, createRequire } from "node:module";
|
|
15
|
+
import { arg } from "politty";
|
|
14
16
|
import { z } from "zod";
|
|
15
17
|
import { create } from "@bufbuild/protobuf";
|
|
16
18
|
import * as fs$1 from "node:fs";
|
|
17
19
|
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
20
|
+
import { parseEnv } from "node:util";
|
|
18
21
|
import { MethodOptions_IdempotencyLevel } from "@bufbuild/protobuf/wkt";
|
|
19
22
|
import * as path from "pathe";
|
|
20
23
|
import { join, resolve } from "pathe";
|
|
@@ -36,6 +39,256 @@ import { parseSync } from "oxc-parser";
|
|
|
36
39
|
import * as inflection from "inflection";
|
|
37
40
|
import * as globals from "globals";
|
|
38
41
|
|
|
42
|
+
//#region src/cli/shared/args.ts
|
|
43
|
+
const unitToMs = {
|
|
44
|
+
ms: 1,
|
|
45
|
+
s: 1e3,
|
|
46
|
+
m: 60 * 1e3
|
|
47
|
+
};
|
|
48
|
+
const durationPattern = /^(\d+)(ms|s|m)$/;
|
|
49
|
+
/**
|
|
50
|
+
* Schema for duration string validation (e.g., "3s", "500ms", "1m")
|
|
51
|
+
* Only validates format; use parseDuration() to convert to milliseconds
|
|
52
|
+
*/
|
|
53
|
+
const durationArg = z.string().refine((val) => durationPattern.test(val), { message: "Invalid duration format. Expected format: '3s', '500ms', '1m'" }).refine((val) => {
|
|
54
|
+
const match = val.match(durationPattern);
|
|
55
|
+
if (!match) return false;
|
|
56
|
+
const digits = match[1];
|
|
57
|
+
return digits !== void 0 && parseInt(digits, 10) > 0;
|
|
58
|
+
}, { message: "Duration must be greater than 0" });
|
|
59
|
+
/**
|
|
60
|
+
* Parse a validated duration string into milliseconds
|
|
61
|
+
* @param duration - Duration string (e.g., "3s", "500ms", "1m")
|
|
62
|
+
* @returns Duration in milliseconds
|
|
63
|
+
*/
|
|
64
|
+
function parseDuration(duration) {
|
|
65
|
+
const match = assertDefined(duration.match(durationPattern), `invalid duration format: ${duration}`);
|
|
66
|
+
const value = parseInt(assertDefined(match[1], "duration digits group missing"), 10);
|
|
67
|
+
const unit = assertDefined(match[2], "duration unit group missing");
|
|
68
|
+
return value * unitToMs[unit];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Schema for positive integer validation (from string input)
|
|
72
|
+
* Transforms the string to a number
|
|
73
|
+
*/
|
|
74
|
+
const positiveIntArg = z.coerce.number().int().positive();
|
|
75
|
+
/**
|
|
76
|
+
* Schema for non-negative integer validation (from string input).
|
|
77
|
+
* Accepts 0 (used for `--limit 0` to disable the limit).
|
|
78
|
+
*/
|
|
79
|
+
const nonNegativeIntArg = z.coerce.number().int().nonnegative();
|
|
80
|
+
/**
|
|
81
|
+
* Schema for sort order (`asc` or `desc`).
|
|
82
|
+
*/
|
|
83
|
+
const orderArg = z.enum(["asc", "desc"]);
|
|
84
|
+
/**
|
|
85
|
+
* Translate a CLI `--order` value into the proto `PageDirection` enum.
|
|
86
|
+
* Returns `undefined` when the user did not specify an order so that
|
|
87
|
+
* callers can omit the field and fall back to the server default.
|
|
88
|
+
* @param order - Order string from CLI args (`"asc"` | `"desc"` | undefined)
|
|
89
|
+
* @returns PageDirection, or undefined when `order` is undefined
|
|
90
|
+
*/
|
|
91
|
+
function toPageDirection(order) {
|
|
92
|
+
if (order === void 0) return void 0;
|
|
93
|
+
return order === "asc" ? PageDirection.ASC : PageDirection.DESC;
|
|
94
|
+
}
|
|
95
|
+
function hasMachineUserFlag(argv) {
|
|
96
|
+
return argv.slice(0, argv.indexOf("--") === -1 ? argv.length : argv.indexOf("--")).some((token) => token === "-m" || token.startsWith("-m=") || token === "--machine-user" || token.startsWith("--machine-user=") || token === "--machineUser" || token.startsWith("--machineUser=") || token === "--machineuser" || token.startsWith("--machineuser="));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolve whether a parsed machine user value came from an explicit CLI option or env fallback.
|
|
100
|
+
* @param machineUser - Parsed machine user value
|
|
101
|
+
* @param argv - Raw CLI argv, excluding the executable and script path
|
|
102
|
+
* @param options - Source resolution options
|
|
103
|
+
* @returns Machine user input source, or undefined when no value was parsed
|
|
104
|
+
*/
|
|
105
|
+
function resolveMachineUserInputSource(machineUser, argv = process.argv.slice(2), options = {}) {
|
|
106
|
+
if (machineUser === void 0) return void 0;
|
|
107
|
+
if (options.valueIsExplicit) return "option";
|
|
108
|
+
if (hasMachineUserFlag(argv)) return "option";
|
|
109
|
+
return process.env.TAILOR_PLATFORM_MACHINE_USER_NAME === machineUser ? "env" : "option";
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Load env files from parsed arguments.
|
|
113
|
+
* Processes --env-file first, then --env-file-if-exists.
|
|
114
|
+
*
|
|
115
|
+
* Follows Node.js --env-file behavior:
|
|
116
|
+
* - Variables already set in the environment are NOT overwritten
|
|
117
|
+
* - Variables from later files override those from earlier files
|
|
118
|
+
* @param envFiles - Required env file path(s) that must exist
|
|
119
|
+
* @param envFilesIfExists - Optional env file path(s) that are loaded if they exist
|
|
120
|
+
*/
|
|
121
|
+
function loadEnvFiles(envFiles, envFilesIfExists) {
|
|
122
|
+
const originalEnvKeys = new Set(Object.keys(process.env));
|
|
123
|
+
const load = (files, required) => {
|
|
124
|
+
for (const file of [files ?? []].flat()) {
|
|
125
|
+
const envPath = path.resolve(process.cwd(), file);
|
|
126
|
+
if (!fs$1.existsSync(envPath)) {
|
|
127
|
+
if (required) throw new Error(`Environment file not found: ${envPath}`);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const parsed = parseEnv(fs$1.readFileSync(envPath, "utf-8"));
|
|
131
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
132
|
+
if (originalEnvKeys.has(key)) continue;
|
|
133
|
+
process.env[key] = value;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
load(envFiles, true);
|
|
138
|
+
load(envFilesIfExists, false);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Common arguments for all CLI commands
|
|
142
|
+
*
|
|
143
|
+
* NOTE: --env-file and --env-file-if-exists collide with Node.js flags due to a bug
|
|
144
|
+
* (https://github.com/nodejs/node/issues/54232). Node.js parses these even after the
|
|
145
|
+
* script path, causing warnings (twice due to tsx loader).
|
|
146
|
+
*/
|
|
147
|
+
const commonArgs = {
|
|
148
|
+
"env-file": arg(z.string().optional(), {
|
|
149
|
+
alias: "e",
|
|
150
|
+
description: "Path to the environment file (error if not found)",
|
|
151
|
+
completion: {
|
|
152
|
+
type: "file",
|
|
153
|
+
matcher: [".env.*", ".env"]
|
|
154
|
+
}
|
|
155
|
+
}),
|
|
156
|
+
"env-file-if-exists": arg(z.string().optional(), {
|
|
157
|
+
description: "Path to the environment file (ignored if not found)",
|
|
158
|
+
completion: {
|
|
159
|
+
type: "file",
|
|
160
|
+
matcher: [".env.*", ".env"]
|
|
161
|
+
},
|
|
162
|
+
effect: (_value, { args }) => {
|
|
163
|
+
loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
verbose: arg(z.boolean().default(false), {
|
|
167
|
+
description: "Enable verbose logging",
|
|
168
|
+
effect: (value) => {
|
|
169
|
+
verboseMode = value;
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
json: arg(z.boolean().default(false), {
|
|
173
|
+
alias: "j",
|
|
174
|
+
description: "Output as JSON",
|
|
175
|
+
effect: (value) => {
|
|
176
|
+
logger.jsonMode = value;
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Arguments for commands that require workspace context
|
|
182
|
+
*/
|
|
183
|
+
const workspaceArgs = {
|
|
184
|
+
"workspace-id": arg(z.string().optional(), {
|
|
185
|
+
alias: "w",
|
|
186
|
+
description: "Workspace ID",
|
|
187
|
+
env: "TAILOR_PLATFORM_WORKSPACE_ID",
|
|
188
|
+
completion: { type: "none" }
|
|
189
|
+
}),
|
|
190
|
+
profile: arg(z.string().optional(), {
|
|
191
|
+
alias: "p",
|
|
192
|
+
description: "Workspace profile",
|
|
193
|
+
env: "TAILOR_PLATFORM_PROFILE",
|
|
194
|
+
completion: { type: "none" }
|
|
195
|
+
})
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Shared config arg for commands that accept a config file path
|
|
199
|
+
*/
|
|
200
|
+
const configArg = { config: arg(z.string().default("tailor.config.ts"), {
|
|
201
|
+
alias: "c",
|
|
202
|
+
description: "Path to SDK config file",
|
|
203
|
+
env: "TAILOR_PLATFORM_SDK_CONFIG_PATH",
|
|
204
|
+
completion: {
|
|
205
|
+
type: "file",
|
|
206
|
+
extensions: ["ts"]
|
|
207
|
+
}
|
|
208
|
+
}) };
|
|
209
|
+
/**
|
|
210
|
+
* Shared config arg for commands that accept one or more comma-separated config file paths
|
|
211
|
+
*/
|
|
212
|
+
const multiConfigArg = { config: arg(z.string().default("tailor.config.ts"), {
|
|
213
|
+
alias: "c",
|
|
214
|
+
description: "Path to SDK config file. Use comma-separated paths to deploy multiple apps together.",
|
|
215
|
+
env: "TAILOR_PLATFORM_SDK_CONFIG_PATH",
|
|
216
|
+
completion: {
|
|
217
|
+
type: "file",
|
|
218
|
+
extensions: ["ts"]
|
|
219
|
+
}
|
|
220
|
+
}) };
|
|
221
|
+
/**
|
|
222
|
+
* Arguments for commands that interact with deployed resources (includes config)
|
|
223
|
+
*/
|
|
224
|
+
const deploymentArgs = {
|
|
225
|
+
...workspaceArgs,
|
|
226
|
+
...configArg
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Arguments for commands that require confirmation
|
|
230
|
+
*/
|
|
231
|
+
const confirmationArgs = { yes: arg(z.boolean().default(false), {
|
|
232
|
+
alias: "y",
|
|
233
|
+
description: "Skip confirmation prompts"
|
|
234
|
+
}) };
|
|
235
|
+
/**
|
|
236
|
+
* Arguments for commands that require organization context
|
|
237
|
+
*/
|
|
238
|
+
const organizationArgs = { "organization-id": arg(z.string(), {
|
|
239
|
+
alias: "o",
|
|
240
|
+
description: "Organization ID",
|
|
241
|
+
env: "TAILOR_PLATFORM_ORGANIZATION_ID",
|
|
242
|
+
completion: { type: "none" }
|
|
243
|
+
}) };
|
|
244
|
+
/**
|
|
245
|
+
* Arguments for list commands that accept `--order` / `--limit`. Sort
|
|
246
|
+
* order defaults to `desc` (newest first) because most callers want the
|
|
247
|
+
* latest items; pass `--order asc` to opt in to ascending order. The
|
|
248
|
+
* limit is unbounded by default so existing invocations keep returning
|
|
249
|
+
* every item; pass `--limit N` to cap the result size.
|
|
250
|
+
* @param defaultOrder - Default value for `--order` (defaults to `"desc"`)
|
|
251
|
+
* @returns Argument shape suitable for spreading into a command schema
|
|
252
|
+
*/
|
|
253
|
+
const paginationArgs = (defaultOrder = "desc") => ({
|
|
254
|
+
order: arg(orderArg.default(defaultOrder), { description: "Sort order (asc or desc)" }),
|
|
255
|
+
limit: arg(nonNegativeIntArg.optional(), {
|
|
256
|
+
alias: "l",
|
|
257
|
+
description: "Maximum number of items to return (0 or omit: unlimited)"
|
|
258
|
+
})
|
|
259
|
+
});
|
|
260
|
+
/**
|
|
261
|
+
* Arguments for time-series log list commands. Defaults to newest-first
|
|
262
|
+
* (`desc`) and a 50-item cap so that listing stays responsive on busy
|
|
263
|
+
* workspaces. Pass `--limit 0` to disable the cap and fetch all entries.
|
|
264
|
+
*/
|
|
265
|
+
const pagedLogArgs = {
|
|
266
|
+
order: arg(orderArg.default("desc"), { description: "Sort order (asc or desc)" }),
|
|
267
|
+
limit: arg(nonNegativeIntArg.default(50), {
|
|
268
|
+
alias: "l",
|
|
269
|
+
description: "Maximum number of items to return (0: unlimited)"
|
|
270
|
+
})
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* Arguments for commands that require folder context
|
|
274
|
+
*/
|
|
275
|
+
const folderArgs = { "folder-id": arg(z.string(), {
|
|
276
|
+
alias: "f",
|
|
277
|
+
description: "Folder ID",
|
|
278
|
+
env: "TAILOR_PLATFORM_FOLDER_ID",
|
|
279
|
+
completion: { type: "none" }
|
|
280
|
+
}) };
|
|
281
|
+
let verboseMode = false;
|
|
282
|
+
/**
|
|
283
|
+
* Returns whether verbose mode is enabled.
|
|
284
|
+
* Used by the global cleanup handler which doesn't have access to parsed args.
|
|
285
|
+
* @returns Whether verbose mode is enabled
|
|
286
|
+
*/
|
|
287
|
+
function isVerbose() {
|
|
288
|
+
return verboseMode;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
//#endregion
|
|
39
292
|
//#region src/parser/app-config/log-level.ts
|
|
40
293
|
const LOG_LEVELS = [
|
|
41
294
|
"DEBUG",
|
|
@@ -294,7 +547,7 @@ function initOAuth2Client(config) {
|
|
|
294
547
|
*/
|
|
295
548
|
async function initOperatorClient(accessToken, config) {
|
|
296
549
|
const platformConfig = config ?? getPlatformConfigForToken(accessToken);
|
|
297
|
-
const [{ createTracingInterceptor }, { OperatorService }] = await Promise.all([import("./interceptor-D-q1rvRl.mjs"), import("./service_pb-
|
|
550
|
+
const [{ createTracingInterceptor }, { OperatorService }] = await Promise.all([import("./interceptor-D-q1rvRl.mjs"), import("./service_pb-B2FF59sP.mjs")]);
|
|
298
551
|
const interceptors = [
|
|
299
552
|
await userAgentInterceptor(),
|
|
300
553
|
await bearerTokenInterceptor(accessToken),
|
|
@@ -464,7 +717,8 @@ const RETRY_SAFE_CREATE_METHODS = /* @__PURE__ */ new Set([
|
|
|
464
717
|
"CreateTailorDBType",
|
|
465
718
|
"CreateTenantConfig",
|
|
466
719
|
"CreateUserProfileConfig",
|
|
467
|
-
"CreateWorkflow"
|
|
720
|
+
"CreateWorkflow",
|
|
721
|
+
"CreateWorkflowJobFunctionExecutionPolicy"
|
|
468
722
|
]);
|
|
469
723
|
/**
|
|
470
724
|
* Whether an error is an `AlreadyExists` from a retry-safe Create RPC.
|
|
@@ -1191,7 +1445,15 @@ async function loadMachineUserName(opts) {
|
|
|
1191
1445
|
message: "Machine user name cannot be empty.",
|
|
1192
1446
|
suggestion: "Pass a non-empty machine user name, or omit the option to use the environment variable or profile default."
|
|
1193
1447
|
});
|
|
1194
|
-
const
|
|
1448
|
+
const envMachineUser = process.env.TAILOR_PLATFORM_MACHINE_USER_NAME || void 0;
|
|
1449
|
+
const explicitMachineUser = opts?.machineUser ? {
|
|
1450
|
+
source: opts.machineUserSource ?? "option",
|
|
1451
|
+
value: opts.machineUser
|
|
1452
|
+
} : envMachineUser ? {
|
|
1453
|
+
source: "env",
|
|
1454
|
+
value: envMachineUser
|
|
1455
|
+
} : void 0;
|
|
1456
|
+
const explicit = explicitMachineUser?.value;
|
|
1195
1457
|
const profile = opts?.profile || process.env.TAILOR_PLATFORM_PROFILE;
|
|
1196
1458
|
if (!profile) return explicit;
|
|
1197
1459
|
const entry = (await readPlatformConfig()).profiles[profile];
|
|
@@ -1200,12 +1462,15 @@ async function loadMachineUserName(opts) {
|
|
|
1200
1462
|
throw new Error(`Profile "${profile}" not found`);
|
|
1201
1463
|
}
|
|
1202
1464
|
if (entry.machine_user && entry.machine_user_override === "deny") {
|
|
1203
|
-
if (explicit && explicit !== entry.machine_user)
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1465
|
+
if (explicit && explicit !== entry.machine_user) {
|
|
1466
|
+
const details = explicitMachineUser.source === "env" ? `The machine user is being set to "${explicit}" via the TAILOR_PLATFORM_MACHINE_USER_NAME environment variable, which conflicts with this profile's pinned machine user "${entry.machine_user}".` : `This profile fixes the machine user to "${entry.machine_user}" for application-data commands.`;
|
|
1467
|
+
throw createCLIError({
|
|
1468
|
+
code: "PROFILE_MACHINE_USER_OVERRIDE_DENIED",
|
|
1469
|
+
message: `Profile "${profile}" denies overriding the machine user.`,
|
|
1470
|
+
details,
|
|
1471
|
+
suggestion: `Omit the machine user option, unset TAILOR_PLATFORM_MACHINE_USER_NAME, or run 'tailor-sdk profile update ${profile} --machine-user-override allow'.`
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1209
1474
|
return entry.machine_user;
|
|
1210
1475
|
}
|
|
1211
1476
|
return explicit || entry.machine_user;
|
|
@@ -2648,7 +2913,8 @@ function detectTriggerCalls(program, sourceText) {
|
|
|
2648
2913
|
if (triggerCall) calls.push({
|
|
2649
2914
|
identifierName: triggerCall.identifierName,
|
|
2650
2915
|
callRange: triggerCall.callRange,
|
|
2651
|
-
argsText: triggerCall.argsText
|
|
2916
|
+
argsText: triggerCall.argsText,
|
|
2917
|
+
optionsText: triggerCall.optionsText
|
|
2652
2918
|
});
|
|
2653
2919
|
for (const key of Object.keys(node)) {
|
|
2654
2920
|
const child = node[key];
|
|
@@ -2912,7 +3178,8 @@ function detectExtendedTriggerCalls(program, sourceText, workflowNames, jobNames
|
|
|
2912
3178
|
kind: "job",
|
|
2913
3179
|
identifierName: triggerCall.identifierName,
|
|
2914
3180
|
callRange: triggerCall.callRange,
|
|
2915
|
-
argsText: triggerCall.argsText
|
|
3181
|
+
argsText: triggerCall.argsText,
|
|
3182
|
+
optionsText: triggerCall.optionsText
|
|
2916
3183
|
});
|
|
2917
3184
|
}
|
|
2918
3185
|
for (const key of Object.keys(node)) {
|
|
@@ -2988,7 +3255,8 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
|
|
|
2988
3255
|
} else {
|
|
2989
3256
|
const jobName = jobNameMap.get(call.identifierName);
|
|
2990
3257
|
if (jobName) {
|
|
2991
|
-
const
|
|
3258
|
+
const optionsPart = call.optionsText !== void 0 ? `, ${call.optionsText}` : "";
|
|
3259
|
+
const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}${optionsPart}))()`;
|
|
2992
3260
|
replacements.push({
|
|
2993
3261
|
start: call.callRange.start,
|
|
2994
3262
|
end: call.callRange.end,
|
|
@@ -5593,7 +5861,8 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
|
|
|
5593
5861
|
if (isInsideRemovedRange(call.callRange.start)) continue;
|
|
5594
5862
|
const jobName = jobNameMap.get(call.identifierName);
|
|
5595
5863
|
if (jobName) {
|
|
5596
|
-
const
|
|
5864
|
+
const optionsPart = call.optionsText !== void 0 ? `, ${call.optionsText}` : "";
|
|
5865
|
+
const transformedCall = `(async () => tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"}${optionsPart}))()`;
|
|
5597
5866
|
replacements.push({
|
|
5598
5867
|
start: call.callRange.start,
|
|
5599
5868
|
end: call.callRange.end,
|
|
@@ -5850,6 +6119,13 @@ const RetryPolicySchema = z.object({
|
|
|
5850
6119
|
path: ["initialBackoff"]
|
|
5851
6120
|
});
|
|
5852
6121
|
const ConcurrencyPolicySchema = z.object({ maxConcurrentExecutions: z.number().int().min(1).max(1e3).describe("Maximum number of concurrent executions (1-1000)") });
|
|
6122
|
+
const ExecutionPolicyNameSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/, "Invalid execution policy name: must match [a-z0-9-] (3-63 chars; must start and end with [a-z0-9])").describe("Workspace-unique execution policy name embedded in the resource TRN");
|
|
6123
|
+
const ExecutionPolicyKeySchema = z.string().regex(/^[a-z0-9][a-z0-9_:.-]{0,62}[a-z0-9*]$/, "Invalid execution policy key: must match [a-z0-9_:.-] (2-64 chars; must start with [a-z0-9] and end with [a-z0-9] or a trailing '*')").describe("Execution policy key passed to triggerJobFunction's executionPolicyKey option");
|
|
6124
|
+
const WorkflowJobFunctionExecutionPolicySchema = z.object({
|
|
6125
|
+
name: ExecutionPolicyNameSchema,
|
|
6126
|
+
key: ExecutionPolicyKeySchema,
|
|
6127
|
+
concurrencyPolicy: ConcurrencyPolicySchema.optional().describe("Optional per-key concurrency cap for job function dispatches matching this policy")
|
|
6128
|
+
});
|
|
5853
6129
|
const WorkflowSchema = z.object({
|
|
5854
6130
|
name: z.string().describe("Workflow name"),
|
|
5855
6131
|
mainJob: WorkflowJobSchema.describe("Main job that starts the workflow"),
|
|
@@ -6570,5 +6846,5 @@ async function loadApplication(params) {
|
|
|
6570
6846
|
}
|
|
6571
6847
|
|
|
6572
6848
|
//#endregion
|
|
6573
|
-
export {
|
|
6574
|
-
//# sourceMappingURL=application-
|
|
6849
|
+
export { getOAuth2ClientId as $, hasAnyUserTokenEntry as A, readPlatformConfig as B, createBundleCache as C, toPageDirection as Ct, loadConfig as D, hashFile as E, loadMachineUserName as F, defaultPlatformBaseUrl as G, saveUserTokens as H, loadPlatformClientConfig as I, fetchMachineUserToken as J, fetchAll as K, loadStoredUserTokens as L, loadAccessToken as M, loadConfigPath as N, deleteUserTokens as O, loadConsoleBaseUrl as P, getConsoleBaseUrl as Q, loadWorkspaceId as R, hasGenerationHooks as S, resolveMachineUserInputSource as St, hashContent as T, writePlatformConfig as U, resolveUserTokenKey as V, closeConnectionPool as W, fetchPlatformMachineUserToken as X, fetchPaged as Y, fetchUserInfo as Z, platformBundleDefinePlugin as _, organizationArgs as _t, resolveInlineSourcemap as a, resolveStaticWebsiteUrls as at, resolveBundleLogLevel as b, parseDuration as bt, ResolverSchema as c, configArg as ct, buildExecutorArgsExpr as d, durationArg as dt, getOrNull as et, buildResolverOperationHookExpr as f, folderArgs as ft, stringifyFunction as g, orderArg as gt, TailorDBTypeSchema as h, nonNegativeIntArg as ht, resolverBundleKey as i, isDefaultPlatform as it, hasUserTokenEntry as j, fetchLatestToken as k, HTTP_METHODS as l, confirmationArgs as lt, assertUniqueTailorDBTypeNamesWithExternal as m, multiConfigArg as mt, generatePluginFilesIfNeeded as n, initOAuth2Client as nt, WorkflowJobFunctionExecutionPolicySchema as o, byName as ot, assertUniqueLocalTailorDBTypeNames as p, isVerbose as pt, fetchAllTolerant as q, loadApplication as r, initOperatorClient as rt, WorkflowJobSchema as s, commonArgs as st, defineApplication as t, getPlatformBaseUrl as tt, INVOKER_EXPR as u, deploymentArgs as ut, composeFunctionTreeshakeOptions as v, pagedLogArgs as vt, getDistDir as w, workspaceArgs as wt, getPluginGenerationDependencies as x, positiveIntArg as xt, createLogLevelTreeshakeOptions as y, paginationArgs as yt, platformConfigFromProfile as z };
|
|
6850
|
+
//# sourceMappingURL=application-BUfYmf0O.mjs.map
|