windmill-cli 1.801.0 → 1.803.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/esm/main.js +179 -43
- package/package.json +1 -1
package/esm/main.js
CHANGED
|
@@ -4234,6 +4234,7 @@ __export(exports_log, {
|
|
|
4234
4234
|
setSilent: () => setSilent,
|
|
4235
4235
|
setup: () => setup,
|
|
4236
4236
|
warn: () => warn,
|
|
4237
|
+
warnAlways: () => warnAlways,
|
|
4237
4238
|
warnStderr: () => warnStderr
|
|
4238
4239
|
});
|
|
4239
4240
|
function setup(level) {
|
|
@@ -4266,6 +4267,9 @@ function warnStderr(msg) {
|
|
|
4266
4267
|
return;
|
|
4267
4268
|
console.error(`\x1B[33m${String(msg)}\x1B[39m`);
|
|
4268
4269
|
}
|
|
4270
|
+
function warnAlways(msg) {
|
|
4271
|
+
console.error(`\x1B[33m${String(msg)}\x1B[39m`);
|
|
4272
|
+
}
|
|
4269
4273
|
function error(msg) {
|
|
4270
4274
|
console.error(`\x1B[31m${String(msg)}\x1B[39m`);
|
|
4271
4275
|
}
|
|
@@ -16769,7 +16773,7 @@ var init_OpenAPI = __esm(() => {
|
|
|
16769
16773
|
PASSWORD: undefined,
|
|
16770
16774
|
TOKEN: getEnv3("WM_TOKEN"),
|
|
16771
16775
|
USERNAME: undefined,
|
|
16772
|
-
VERSION: "1.
|
|
16776
|
+
VERSION: "1.803.0",
|
|
16773
16777
|
WITH_CREDENTIALS: true,
|
|
16774
16778
|
interceptors: {
|
|
16775
16779
|
request: new Interceptors,
|
|
@@ -27742,7 +27746,7 @@ var init_auth = __esm(async () => {
|
|
|
27742
27746
|
});
|
|
27743
27747
|
|
|
27744
27748
|
// src/core/constants.ts
|
|
27745
|
-
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.
|
|
27749
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.803.0";
|
|
27746
27750
|
|
|
27747
27751
|
// src/utils/git.ts
|
|
27748
27752
|
var exports_git = {};
|
|
@@ -43570,7 +43574,7 @@ var init_bundle = __esm(async () => {
|
|
|
43570
43574
|
});
|
|
43571
43575
|
|
|
43572
43576
|
// src/commands/app/wmillTsDev.ts
|
|
43573
|
-
function wmillTsDev(
|
|
43577
|
+
function wmillTsDev() {
|
|
43574
43578
|
return `
|
|
43575
43579
|
let reqs: Record<string, any> = {}
|
|
43576
43580
|
let ws: WebSocket | null = null
|
|
@@ -43582,7 +43586,7 @@ function initWebSocket() {
|
|
|
43582
43586
|
wsReadyResolve = resolve
|
|
43583
43587
|
})
|
|
43584
43588
|
|
|
43585
|
-
ws = new WebSocket('ws
|
|
43589
|
+
ws = new WebSocket((window.location.protocol === 'https:' ? 'wss:' : 'ws:') + '//' + window.location.host)
|
|
43586
43590
|
|
|
43587
43591
|
ws.onopen = () => {
|
|
43588
43592
|
console.log('[wmill] WebSocket connected')
|
|
@@ -65809,7 +65813,7 @@ var init_openflow = __esm(() => {
|
|
|
65809
65813
|
openflow_default = {
|
|
65810
65814
|
openapi: "3.0.3",
|
|
65811
65815
|
info: {
|
|
65812
|
-
version: "1.
|
|
65816
|
+
version: "1.803.0",
|
|
65813
65817
|
title: "OpenFlow Spec",
|
|
65814
65818
|
contact: {
|
|
65815
65819
|
name: "Ruben Fiszel",
|
|
@@ -72693,7 +72697,7 @@ var init_script = __esm(async () => {
|
|
|
72693
72697
|
languageAliases = {
|
|
72694
72698
|
python: "python3"
|
|
72695
72699
|
};
|
|
72696
|
-
command5 = new Command().description("script related commands").option("--show-archived", "Show archived scripts instead of active ones").option("--json", "Output as JSON (for piping to jq)").action(list4).command("list", "list all scripts").option("--show-archived", "Show archived scripts instead of active ones").option("--json", "Output as JSON (for piping to jq)").action(list4).command("push", "push a local script spec. This overrides any remote versions. Use the script file (.ts, .js, .py, .sh)").arguments("<path:file>").option("--message <message:string>", "Deployment message").action(push2).command("get", "get a script's details").arguments("<path:file>").option("--json", "Output as JSON (for piping to jq)").action(get2).command("show", "show a script's content (alias for get)").arguments("<path:file>").action(show).command("run", "run a script by path").arguments("<path:file>").option("-d --data <data:file>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").option("--tag <tag:string>", "Override the worker tag the run is dispatched to (e.g. to route it to dev workers instead of the script's default tag).").action(run2).command("preview", "preview a local script without deploying it. Supports both regular and codebase scripts.").arguments("<path:file>").option("-d --data <data:file>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other than the final output. Useful for scripting.").option("--tag <tag:string>", "Override the worker tag the preview is dispatched to (e.g. to route it to dev workers instead of the script's default tag).").action(preview).command("new", "create a new script").arguments("<path:file> <language:string>").option("--summary <summary:string>", "script summary").option("--description <description:string>", "script description").action(bootstrap).command("bootstrap", "create a new script (alias for new)").arguments("<path:file> <language:string>").option("--summary <summary:string>", "script summary").option("--description <description:string>", "script description").action(bootstrap).command("generate-metadata", 'DEPRECATED: re-generate script metadata. Use top-level "wmill generate-metadata" instead.').arguments("[script:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("--lock-only", "re-generate only the lock").option("--schema-only", "re-generate only script schema").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateMetadata2).command("set-permissioned-as", "Set the on_behalf_of_email for a script (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").action(setPermissionedAs).command("history", "show version history for a script").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history);
|
|
72700
|
+
command5 = new Command().description("script related commands").option("--show-archived", "Show archived scripts instead of active ones").option("--json", "Output as JSON (for piping to jq)").action(list4).command("list", "list all scripts").option("--show-archived", "Show archived scripts instead of active ones").option("--json", "Output as JSON (for piping to jq)").action(list4).command("push", "push a local script spec. This overrides any remote versions. Use the script file (.ts, .js, .py, .sh)").arguments("<path:file>").option("--message <message:string>", "Deployment message").action(push2).command("get", "get a script's details").arguments("<path:file>").option("--json", "Output as JSON (for piping to jq)").action(get2).command("show", "show a script's content (alias for get)").arguments("<path:file>").action(show).command("run", "run a script by path").arguments("<path:file>").option("-d --data <data:file>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-. A resource argument is the bare string $res:<path> as its whole value, and a variable argument is the bare string $var:<path> — not an object wrapper keyed on $res/$var, and not a plain path.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").option("--tag <tag:string>", "Override the worker tag the run is dispatched to (e.g. to route it to dev workers instead of the script's default tag).").action(run2).command("preview", "preview a local script without deploying it. Supports both regular and codebase scripts.").arguments("<path:file>").option("-d --data <data:file>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-. A resource argument is the bare string $res:<path> as its whole value, and a variable argument is the bare string $var:<path> — not an object wrapper keyed on $res/$var, and not a plain path.").option("-s --silent", "Do not output anything other than the final output. Useful for scripting.").option("--tag <tag:string>", "Override the worker tag the preview is dispatched to (e.g. to route it to dev workers instead of the script's default tag).").action(preview).command("new", "create a new script").arguments("<path:file> <language:string>").option("--summary <summary:string>", "script summary").option("--description <description:string>", "script description").action(bootstrap).command("bootstrap", "create a new script (alias for new)").arguments("<path:file> <language:string>").option("--summary <summary:string>", "script summary").option("--description <description:string>", "script description").action(bootstrap).command("generate-metadata", 'DEPRECATED: re-generate script metadata. Use top-level "wmill generate-metadata" instead.').arguments("[script:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("--lock-only", "re-generate only the lock").option("--schema-only", "re-generate only script schema").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateMetadata2).command("set-permissioned-as", "Set the on_behalf_of_email for a script (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").action(setPermissionedAs).command("history", "show version history for a script").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history);
|
|
72697
72701
|
script_default = command5;
|
|
72698
72702
|
});
|
|
72699
72703
|
|
|
@@ -74056,9 +74060,12 @@ var init_lock_dedup = __esm(async () => {
|
|
|
74056
74060
|
var exports_sync = {};
|
|
74057
74061
|
__export(exports_sync, {
|
|
74058
74062
|
FSFSElement: () => FSFSElement,
|
|
74063
|
+
ZipFSElement: () => ZipFSElement,
|
|
74059
74064
|
buildTracker: () => buildTracker,
|
|
74060
74065
|
canonicalizeCaseInsensitiveKeys: () => canonicalizeCaseInsensitiveKeys,
|
|
74066
|
+
checkoutInlineNames: () => checkoutInlineNames,
|
|
74061
74067
|
collectSharedLockReaders: () => collectSharedLockReaders,
|
|
74068
|
+
compareDynFSElement: () => compareDynFSElement,
|
|
74062
74069
|
computeWsSpecificFlagOnlyPushes: () => computeWsSpecificFlagOnlyPushes,
|
|
74063
74070
|
countDatatableMigrationRecords: () => countDatatableMigrationRecords,
|
|
74064
74071
|
dedupeLockfilesOnDisk: () => dedupeLockfilesOnDisk,
|
|
@@ -74675,7 +74682,7 @@ function rawAppPathWithinFolder(baseFolder, relPath) {
|
|
|
74675
74682
|
}
|
|
74676
74683
|
return resolved;
|
|
74677
74684
|
}
|
|
74678
|
-
function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, resourceTypeToIsFileset, ignoreCodebaseChanges, stripOnBehalfOf) {
|
|
74685
|
+
function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, resourceTypeToIsFileset, ignoreCodebaseChanges, stripOnBehalfOf, localFlowInlineMapping) {
|
|
74679
74686
|
let _moduleScriptPaths = null;
|
|
74680
74687
|
async function getModuleScriptPaths() {
|
|
74681
74688
|
if (_moduleScriptPaths === null) {
|
|
@@ -74742,26 +74749,30 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
74742
74749
|
}
|
|
74743
74750
|
let inlineScripts;
|
|
74744
74751
|
try {
|
|
74745
|
-
const
|
|
74746
|
-
|
|
74747
|
-
|
|
74748
|
-
|
|
74749
|
-
|
|
74750
|
-
|
|
74751
|
-
failOnInlineDirective: true
|
|
74752
|
-
});
|
|
74753
|
-
if (flow.value.failure_module) {
|
|
74754
|
-
inlineScripts.push(...extractInlineScripts([flow.value.failure_module], inlineMapping, SEP9, defaultTs, assigner, {
|
|
74755
|
-
skipInlineScriptSuffix: getNonDottedPaths(),
|
|
74756
|
-
failOnInlineDirective: true
|
|
74757
|
-
}));
|
|
74758
|
-
}
|
|
74759
|
-
if (flow.value.preprocessor_module) {
|
|
74760
|
-
inlineScripts.push(...extractInlineScripts([flow.value.preprocessor_module], inlineMapping, SEP9, defaultTs, assigner, {
|
|
74752
|
+
const render = (source, inlineMapping2) => {
|
|
74753
|
+
const f5 = structuredClone(source);
|
|
74754
|
+
const assigner = newPathAssigner(defaultTs, {
|
|
74755
|
+
skipInlineScriptSuffix: getNonDottedPaths()
|
|
74756
|
+
});
|
|
74757
|
+
const options = {
|
|
74761
74758
|
skipInlineScriptSuffix: getNonDottedPaths(),
|
|
74762
74759
|
failOnInlineDirective: true
|
|
74763
|
-
}
|
|
74760
|
+
};
|
|
74761
|
+
const scripts = extractInlineScripts(f5.value.modules, inlineMapping2, SEP9, defaultTs, assigner, options);
|
|
74762
|
+
if (f5.value.failure_module) {
|
|
74763
|
+
scripts.push(...extractInlineScripts([f5.value.failure_module], inlineMapping2, SEP9, defaultTs, assigner, options));
|
|
74764
|
+
}
|
|
74765
|
+
if (f5.value.preprocessor_module) {
|
|
74766
|
+
scripts.push(...extractInlineScripts([f5.value.preprocessor_module], inlineMapping2, SEP9, defaultTs, assigner, options));
|
|
74767
|
+
}
|
|
74768
|
+
return [f5, scripts];
|
|
74769
|
+
};
|
|
74770
|
+
const inlineMapping = localFlowInlineMapping ? await localFlowInlineMapping(finalPath) : {};
|
|
74771
|
+
let rendered = render(flow, inlineMapping);
|
|
74772
|
+
if (new Set(rendered[1].map((s5) => s5.path)).size !== rendered[1].length) {
|
|
74773
|
+
rendered = render(flow, {});
|
|
74764
74774
|
}
|
|
74775
|
+
[flow, inlineScripts] = rendered;
|
|
74765
74776
|
} catch (error2) {
|
|
74766
74777
|
error(`Failed to extract inline scripts for flow at path: ${p4}`);
|
|
74767
74778
|
throw error2;
|
|
@@ -75579,7 +75590,7 @@ function preservePendingScriptLocks(remote, local) {
|
|
|
75579
75590
|
remote[lockKey] = local[lockKey];
|
|
75580
75591
|
}
|
|
75581
75592
|
}
|
|
75582
|
-
async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetadataDeletion, codebases, ignoreCodebaseChanges, specificItems, branchOverride, isEls1Remote, caseInsensitiveFs) {
|
|
75593
|
+
async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetadataDeletion, codebases, ignoreCodebaseChanges, specificItems, branchOverride, isEls1Remote, caseInsensitiveFs, parentOwnsScheduleEnabled) {
|
|
75583
75594
|
let [m1, m22] = els2 ? await Promise.all([
|
|
75584
75595
|
elementsToMap(els1, ignore, json, skips, specificItems, branchOverride, isEls1Remote),
|
|
75585
75596
|
elementsToMap(els2, ignore, json, skips, specificItems, branchOverride, !isEls1Remote)
|
|
@@ -75690,12 +75701,20 @@ async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetada
|
|
|
75690
75701
|
error(`Failed to parse existing JSON content for comparison at path: ${k4}`);
|
|
75691
75702
|
throw error2;
|
|
75692
75703
|
}
|
|
75704
|
+
if (parentOwnsScheduleEnabled && getTypeStrFromPath(k4) === "schedule" && parentOwnsScheduleEnabled(k4)) {
|
|
75705
|
+
delete parsedV?.enabled;
|
|
75706
|
+
delete parsedM2?.enabled;
|
|
75707
|
+
}
|
|
75693
75708
|
if (deepEqual(parsedV, parsedM2)) {
|
|
75694
75709
|
continue;
|
|
75695
75710
|
}
|
|
75696
75711
|
} else if (k4.endsWith(".yaml")) {
|
|
75697
75712
|
const before = parseYaml(k4, m22[k4]);
|
|
75698
75713
|
const after = parseYaml(k4, v4);
|
|
75714
|
+
if (parentOwnsScheduleEnabled && getTypeStrFromPath(k4) === "schedule" && parentOwnsScheduleEnabled(k4)) {
|
|
75715
|
+
delete before?.enabled;
|
|
75716
|
+
delete after?.enabled;
|
|
75717
|
+
}
|
|
75699
75718
|
if (deepEqual(before, after)) {
|
|
75700
75719
|
continue;
|
|
75701
75720
|
}
|
|
@@ -76522,6 +76541,57 @@ async function checkServerLockJobs(workspaceId, sinceIso, changedPaths) {
|
|
|
76522
76541
|
return { pending: 0, failed: [] };
|
|
76523
76542
|
}
|
|
76524
76543
|
}
|
|
76544
|
+
async function checkoutInlineNames(flowYamlPath) {
|
|
76545
|
+
let flow;
|
|
76546
|
+
try {
|
|
76547
|
+
flow = await yamlParseFile(flowYamlPath);
|
|
76548
|
+
} catch {
|
|
76549
|
+
return {};
|
|
76550
|
+
}
|
|
76551
|
+
const mapping = extractCurrentMapping(flow?.value?.modules, {}, flow?.value?.failure_module, flow?.value?.preprocessor_module);
|
|
76552
|
+
for (const [id, ref] of Object.entries(mapping)) {
|
|
76553
|
+
if (path13.isAbsolute(ref) || ref.split(/[\\/]/).includes("..")) {
|
|
76554
|
+
delete mapping[id];
|
|
76555
|
+
}
|
|
76556
|
+
}
|
|
76557
|
+
return mapping;
|
|
76558
|
+
}
|
|
76559
|
+
async function parentOwnedScheduleEnabled(workspaceId) {
|
|
76560
|
+
let parentWorkspaceId;
|
|
76561
|
+
let known = false;
|
|
76562
|
+
try {
|
|
76563
|
+
const { workspaces } = await listUserWorkspaces();
|
|
76564
|
+
const entry = workspaces?.find((w4) => w4.id === workspaceId);
|
|
76565
|
+
known = entry !== undefined;
|
|
76566
|
+
parentWorkspaceId = entry?.parent_workspace_id;
|
|
76567
|
+
} catch {}
|
|
76568
|
+
if (known && !parentWorkspaceId) {
|
|
76569
|
+
return;
|
|
76570
|
+
}
|
|
76571
|
+
if (!isForkWorkspace(workspaceId, parentWorkspaceId)) {
|
|
76572
|
+
return;
|
|
76573
|
+
}
|
|
76574
|
+
let parentPaths;
|
|
76575
|
+
if (parentWorkspaceId) {
|
|
76576
|
+
try {
|
|
76577
|
+
parentPaths = new Set;
|
|
76578
|
+
const perPage = 100;
|
|
76579
|
+
for (let page = 1;; page++) {
|
|
76580
|
+
const batch = await listSchedules({
|
|
76581
|
+
workspace: parentWorkspaceId,
|
|
76582
|
+
page,
|
|
76583
|
+
perPage
|
|
76584
|
+
});
|
|
76585
|
+
batch.forEach((s5) => parentPaths.add(s5.path));
|
|
76586
|
+
if (batch.length < perPage)
|
|
76587
|
+
break;
|
|
76588
|
+
}
|
|
76589
|
+
} catch {
|
|
76590
|
+
parentPaths = undefined;
|
|
76591
|
+
}
|
|
76592
|
+
}
|
|
76593
|
+
return (scheduleFilePath) => parentPaths === undefined || parentPaths.has(removeType(scheduleFilePath, "schedule").replaceAll(SEP9, "/"));
|
|
76594
|
+
}
|
|
76525
76595
|
async function push4(opts) {
|
|
76526
76596
|
if (opts.jsonOutput)
|
|
76527
76597
|
setSilent(true);
|
|
@@ -76563,6 +76633,7 @@ async function push4(opts) {
|
|
|
76563
76633
|
specificItems = wsSpecificMerge.merged;
|
|
76564
76634
|
const serverWsSpecificItems = wsSpecificMerge.serverItems;
|
|
76565
76635
|
opts = mergeCliWithEffectiveOptions(originalCliOpts, effectiveOpts);
|
|
76636
|
+
const parentOwnsScheduleEnabled = opts.includeSchedules ? await parentOwnedScheduleEnabled(workspace.workspaceId) : undefined;
|
|
76566
76637
|
if (opts.lint) {
|
|
76567
76638
|
info("Running lint validation before push...");
|
|
76568
76639
|
const lintReport = await runLint(opts);
|
|
@@ -76611,9 +76682,10 @@ Push aborted: ${lockIssues.length} script(s) missing locks.`));
|
|
|
76611
76682
|
resourceTypeToFormatExtension = parsed.formatExtMap;
|
|
76612
76683
|
resourceTypeToIsFileset = parsed.filesetMap;
|
|
76613
76684
|
} catch {}
|
|
76614
|
-
const
|
|
76685
|
+
const localFlowInlineMapping = (flowDir) => checkoutInlineNames(path13.join(process.cwd(), flowDir, "flow.yaml"));
|
|
76686
|
+
const remote = ZipFSElement(await downloadZip(workspace, opts.plainSecrets, opts.skipVariables, opts.skipResources, opts.skipResourceTypes, opts.skipSecrets, opts.includeSchedules, opts.includeTriggers, opts.includeUsers, opts.includeGroups, opts.includeSettings, opts.includeKey, opts.skipWorkspaceDependencies, opts.skipDatatableMigrations, opts.defaultTs, opts.syncBehavior), !opts.json, opts.defaultTs ?? "bun", resourceTypeToFormatExtension, resourceTypeToIsFileset, false, parseSyncBehavior(opts.syncBehavior) >= 1, localFlowInlineMapping);
|
|
76615
76687
|
const local = await FSFSElement(path13.join(process.cwd(), ""), codebases, false);
|
|
76616
|
-
const { changes, localMap } = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false, await isCaseInsensitiveFilesystem(process.cwd()));
|
|
76688
|
+
const { changes, localMap } = await compareDynFSElement(local, remote, await ignoreF(opts), opts.json ?? false, opts, true, codebases, false, specificItems, wsNameForFiles, false, await isCaseInsensitiveFilesystem(process.cwd()), parentOwnsScheduleEnabled);
|
|
76617
76689
|
const wsSpecificFlagOnly = computeWsSpecificFlagOnlyPushes(localMap, localSpecificItems, serverWsSpecificItems);
|
|
76618
76690
|
for (const item of wsSpecificFlagOnly) {
|
|
76619
76691
|
if (changes.some((c5) => c5.path === item.filePath))
|
|
@@ -77204,6 +77276,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
77204
77276
|
originalLocalPath: originalWorkspaceSpecificPath,
|
|
77205
77277
|
permissionedAsContext,
|
|
77206
77278
|
wsSpecific: isWsSpecific ? true : undefined,
|
|
77279
|
+
enabledOwnedByParent: parentOwnsScheduleEnabled?.(change.path),
|
|
77207
77280
|
keyPushOpts: {
|
|
77208
77281
|
noninteractive: (opts.yes ?? false) || !process.stdin.isTTY,
|
|
77209
77282
|
skipReencrypt: opts.skipReencryptOnKeyChange
|
|
@@ -77263,6 +77336,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
77263
77336
|
originalLocalPath: localFilePath,
|
|
77264
77337
|
permissionedAsContext,
|
|
77265
77338
|
wsSpecific: isAddedWsSpecific ? true : undefined,
|
|
77339
|
+
enabledOwnedByParent: parentOwnsScheduleEnabled?.(change.path),
|
|
77266
77340
|
keyPushOpts: {
|
|
77267
77341
|
noninteractive: (opts.yes ?? false) || !process.stdin.isTTY,
|
|
77268
77342
|
skipReencrypt: opts.skipReencryptOnKeyChange
|
|
@@ -80228,7 +80302,7 @@ data: reload
|
|
|
80228
80302
|
};
|
|
80229
80303
|
});
|
|
80230
80304
|
build.onLoad({ filter: /.*/, namespace: "wmill-virtual" }, (args) => {
|
|
80231
|
-
const contents = wmillTsDev(
|
|
80305
|
+
const contents = wmillTsDev();
|
|
80232
80306
|
info(colors.yellow(`[wmill-virtual] Loading virtual module: ${args.path}`));
|
|
80233
80307
|
info(colors.gray(`[wmill-virtual] Exports: ${contents.match(/export (const|function) \w+/g)?.join(", ") ?? "none"}`));
|
|
80234
80308
|
return {
|
|
@@ -83079,7 +83153,7 @@ async function get7(opts, path22) {
|
|
|
83079
83153
|
console.log(colors.bold("Enabled:") + " " + (s5.enabled ? "true" : "false"));
|
|
83080
83154
|
}
|
|
83081
83155
|
}
|
|
83082
|
-
async function pushSchedule(workspace, path22, schedule, localSchedule, permissionedAsContext) {
|
|
83156
|
+
async function pushSchedule(workspace, path22, schedule, localSchedule, permissionedAsContext, enabledOwnedByParent) {
|
|
83083
83157
|
path22 = removeType(path22, "schedule").replaceAll(SEP17, "/");
|
|
83084
83158
|
debug(`Processing local schedule ${path22}`);
|
|
83085
83159
|
try {
|
|
@@ -83089,6 +83163,12 @@ async function pushSchedule(workspace, path22, schedule, localSchedule, permissi
|
|
|
83089
83163
|
debug(`Schedule ${path22} does not exist on remote`);
|
|
83090
83164
|
}
|
|
83091
83165
|
delete localSchedule.has_permissioned_as;
|
|
83166
|
+
if (enabledOwnedByParent && schedule) {
|
|
83167
|
+
if (localSchedule.enabled !== undefined && localSchedule.enabled !== schedule.enabled) {
|
|
83168
|
+
warnAlways(`Schedule ${path22} stays ${schedule.enabled ? "enabled" : "disabled"}: the file says ${localSchedule.enabled ? "enabled" : "disabled"}, but in a fork that flag is the parent workspace's`);
|
|
83169
|
+
}
|
|
83170
|
+
delete localSchedule.enabled;
|
|
83171
|
+
}
|
|
83092
83172
|
const preserveFields = {};
|
|
83093
83173
|
if (permissionedAsContext?.userIsAdminOrDeployer) {
|
|
83094
83174
|
if (schedule) {
|
|
@@ -83117,13 +83197,7 @@ async function pushSchedule(workspace, path22, schedule, localSchedule, permissi
|
|
|
83117
83197
|
});
|
|
83118
83198
|
if (localSchedule.enabled !== undefined && localSchedule.enabled !== schedule.enabled) {
|
|
83119
83199
|
info(colors.bold.yellow(`Schedule ${path22} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
|
|
83120
|
-
await
|
|
83121
|
-
workspace,
|
|
83122
|
-
path: path22,
|
|
83123
|
-
requestBody: {
|
|
83124
|
-
enabled: localSchedule.enabled
|
|
83125
|
-
}
|
|
83126
|
-
});
|
|
83200
|
+
await setEnabledUnlessParentOwned(workspace, path22, localSchedule.enabled, schedule.enabled);
|
|
83127
83201
|
}
|
|
83128
83202
|
} catch (e4) {
|
|
83129
83203
|
console.error(e4.body);
|
|
@@ -83144,6 +83218,28 @@ async function pushSchedule(workspace, path22, schedule, localSchedule, permissi
|
|
|
83144
83218
|
console.error(e4.body);
|
|
83145
83219
|
throw e4;
|
|
83146
83220
|
}
|
|
83221
|
+
if (enabledOwnedByParent !== undefined && localSchedule.enabled === true) {
|
|
83222
|
+
if (enabledOwnedByParent) {
|
|
83223
|
+
warnAlways(`Schedule ${path22} created disabled: the file says enabled, but in a fork that flag is the parent workspace's`);
|
|
83224
|
+
} else {
|
|
83225
|
+
await setEnabledUnlessParentOwned(workspace, path22, true, false);
|
|
83226
|
+
}
|
|
83227
|
+
}
|
|
83228
|
+
}
|
|
83229
|
+
}
|
|
83230
|
+
async function setEnabledUnlessParentOwned(workspace, path22, enabled2, remoteEnabled) {
|
|
83231
|
+
try {
|
|
83232
|
+
await setScheduleEnabled({
|
|
83233
|
+
workspace,
|
|
83234
|
+
path: path22,
|
|
83235
|
+
requestBody: { enabled: enabled2 }
|
|
83236
|
+
});
|
|
83237
|
+
} catch (e4) {
|
|
83238
|
+
const conflict = parseForkConflict(e4);
|
|
83239
|
+
if (!conflict) {
|
|
83240
|
+
throw e4;
|
|
83241
|
+
}
|
|
83242
|
+
warnAlways(`Schedule ${path22} left ${remoteEnabled ? "enabled" : "disabled"}: the parent workspace '${conflict.parentWorkspaceId}' has the same schedule, so its flag is the parent's to set`);
|
|
83147
83243
|
}
|
|
83148
83244
|
}
|
|
83149
83245
|
async function enable(opts, path22) {
|
|
@@ -85400,7 +85496,8 @@ async function pushObj(workspace, p4, befObj, newObj, plainSecrets, alreadySynce
|
|
|
85400
85496
|
permissionedAsContext,
|
|
85401
85497
|
wsSpecific,
|
|
85402
85498
|
keyPushOpts,
|
|
85403
|
-
defaultTs: defaultTs2
|
|
85499
|
+
defaultTs: defaultTs2,
|
|
85500
|
+
enabledOwnedByParent
|
|
85404
85501
|
} = opts;
|
|
85405
85502
|
const typeEnding = getTypeStrFromPath(p4);
|
|
85406
85503
|
if (typeEnding === "app") {
|
|
@@ -85433,7 +85530,7 @@ async function pushObj(workspace, p4, befObj, newObj, plainSecrets, alreadySynce
|
|
|
85433
85530
|
} else if (typeEnding === "resource-type") {
|
|
85434
85531
|
await pushResourceType(workspace, p4, befObj, newObj);
|
|
85435
85532
|
} else if (typeEnding === "schedule") {
|
|
85436
|
-
await pushSchedule(workspace, p4, befObj, newObj, permissionedAsContext);
|
|
85533
|
+
await pushSchedule(workspace, p4, befObj, newObj, permissionedAsContext, enabledOwnedByParent);
|
|
85437
85534
|
} else if (typeEnding === "http_trigger") {
|
|
85438
85535
|
await pushTrigger("http", workspace, p4, befObj, newObj, permissionedAsContext);
|
|
85439
85536
|
} else if (typeEnding === "websocket_trigger") {
|
|
@@ -86523,7 +86620,7 @@ var init_flow = __esm(async () => {
|
|
|
86523
86620
|
]);
|
|
86524
86621
|
import_yaml39 = __toESM(require_dist(), 1);
|
|
86525
86622
|
alreadySynced3 = [];
|
|
86526
|
-
command22 = new Command().description("flow related commands").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("list", "list all flows").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("get", "get a flow's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get9).command("push", "push a local flow spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").option("--message <message:string>", "Deployment message").action(push11).command("run", "run a flow by path.").arguments("<path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not ouput anything other then the final output. Useful for scripting.").option("--tag <tag:string>", "Override the worker tag the run is dispatched to (e.g. to route it to dev workers instead of the flow's default tag).").action(run3).command("preview", "preview a local flow without deploying it. Runs the flow definition from local files and uses local PathScripts by default. Pass --step <id> to run only one module in isolation (resolves nested steps inside branchone/branchall/forloopflow/whileloopflow plus the special preprocessor/failure modules; supported step types: rawscript, script, flow).").arguments("<flow_path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").option("--remote", "Use deployed workspace scripts for PathScript steps instead of local files.").option("--step <step_id:string>", "Run only the named step instead of the whole flow. Honors --data as the step's args and --remote / local-PathScript resolution the same way the full-flow preview does.").option("--tag <tag:string>", "Override the worker tag the preview is dispatched to (e.g. to route it to dev workers instead of the flow's default tag).").action(preview2).command("generate-locks", 'DEPRECATED: re-generate flow lock files. Use "wmill generate-metadata" instead.').arguments("[flow:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateLocks).command("new", "create a new empty flow").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("bootstrap", "create a new empty flow (alias for new)").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("history", "Show version history for a flow").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history2).command("show-version", "Show a specific version of a flow").arguments("<path:string> <version:string>").option("--json", "Output as JSON (for piping to jq)").action(showVersion).command("set-permissioned-as", "Set the on_behalf_of_email for a flow (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").action(async (opts, flowPath, email) => {
|
|
86623
|
+
command22 = new Command().description("flow related commands").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("list", "list all flows").option("--show-archived", "Enable archived flows in output").option("--json", "Output as JSON (for piping to jq)").action(list12).command("get", "get a flow's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get9).command("push", "push a local flow spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").option("--message <message:string>", "Deployment message").action(push11).command("run", "run a flow by path.").arguments("<path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-. A resource argument is the bare string $res:<path> as its whole value, and a variable argument is the bare string $var:<path> — not an object wrapper keyed on $res/$var, and not a plain path.").option("-s --silent", "Do not ouput anything other then the final output. Useful for scripting.").option("--tag <tag:string>", "Override the worker tag the run is dispatched to (e.g. to route it to dev workers instead of the flow's default tag).").action(run3).command("preview", "preview a local flow without deploying it. Runs the flow definition from local files and uses local PathScripts by default. Pass --step <id> to run only one module in isolation (resolves nested steps inside branchone/branchall/forloopflow/whileloopflow plus the special preprocessor/failure modules; supported step types: rawscript, script, flow).").arguments("<flow_path:string>").option("-d --data <data:string>", "Inputs specified as a JSON string or a file using @<filename> or stdin using @-. A resource argument is the bare string $res:<path> as its whole value, and a variable argument is the bare string $var:<path> — not an object wrapper keyed on $res/$var, and not a plain path.").option("-s --silent", "Do not output anything other then the final output. Useful for scripting.").option("--remote", "Use deployed workspace scripts for PathScript steps instead of local files.").option("--step <step_id:string>", "Run only the named step instead of the whole flow. Honors --data as the step's args and --remote / local-PathScript resolution the same way the full-flow preview does.").option("--tag <tag:string>", "Override the worker tag the preview is dispatched to (e.g. to route it to dev workers instead of the flow's default tag).").action(preview2).command("generate-locks", 'DEPRECATED: re-generate flow lock files. Use "wmill generate-metadata" instead.').arguments("[flow:file]").option("--yes", "Skip confirmation prompt").option("--dry-run", "Perform a dry run without making changes").option("-i --includes <patterns:file[]>", "Comma separated patterns to specify which file to take into account (among files that are compatible with windmill). Patterns can include * (any string until '/') and ** (any string)").option("-e --excludes <patterns:file[]>", "Comma separated patterns to specify which file to NOT take into account.").action(generateLocks).command("new", "create a new empty flow").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("bootstrap", "create a new empty flow (alias for new)").arguments("<flow_path:string>").option("--summary <summary:string>", "flow summary").option("--description <description:string>", "flow description").action(bootstrap2).command("history", "Show version history for a flow").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(history2).command("show-version", "Show a specific version of a flow").arguments("<path:string> <version:string>").option("--json", "Output as JSON (for piping to jq)").action(showVersion).command("set-permissioned-as", "Set the on_behalf_of_email for a flow (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").action(async (opts, flowPath, email) => {
|
|
86527
86624
|
const workspace = await resolveWorkspace(opts);
|
|
86528
86625
|
await requireLogin(opts);
|
|
86529
86626
|
const remote = await getFlowByPath({
|
|
@@ -87617,6 +87714,8 @@ Local previews exist for every entity type and don't deploy:
|
|
|
87617
87714
|
- \`wmill flow preview <flow_path> -d '<args>'\` — run a local flow.yaml.
|
|
87618
87715
|
- \`wmill app dev\` — live-reload dev server for raw apps.
|
|
87619
87716
|
|
|
87717
|
+
An argument typed as a resource takes the bare string \`"$res:<path>"\` as its whole value (a variable takes \`"$var:<path>"\`) — never an object wrapper like \`{"$res": "<path>"}\`, and never a plain path. See the \`resources\` skill.
|
|
87718
|
+
|
|
87620
87719
|
Argument shapes and per-language details live in the \`write-script-<lang>\`, \`write-flow\`, and \`raw-app\` skills.
|
|
87621
87720
|
|
|
87622
87721
|
## Keeping metadata in sync
|
|
@@ -92827,6 +92926,8 @@ If the user hasn't already told you to run/test the flow, offer it as a one-sent
|
|
|
92827
92926
|
|
|
92828
92927
|
If the user already asked to test/run/try the flow in their original request, skip the offer and just execute \`wmill flow preview <path> -d '<args>'\` directly — pick plausible args from the flow's input schema.
|
|
92829
92928
|
|
|
92929
|
+
An input typed as a resource (\`format: resource-<type>\` in the schema) takes the bare string \`"$res:<path>"\` as its whole value — \`-d '{"db": "$res:f/databases/postgres_prod"}'\`, not \`{"db": {"$res": "..."}}\` and not a plain path. Same for a variable, with \`"$var:<path>"\`. See the \`resources\` skill.
|
|
92930
|
+
|
|
92830
92931
|
\`wmill flow preview\` is safe to run yourself (it does not deploy). \`wmill generate-metadata\` does not deploy either (it only writes local lock/hash files) but re-resolves deps — offer it and run on agreement, unless the project's \`AGENTS.md\` opts into automatic metadata. After running it, check the regenerated \`.lock\` diff and tell the user which inline-script dependency versions changed, so they can catch an unwanted bump before deploying. Only \`wmill sync push\` deploys; run it only when the user explicitly asks.
|
|
92831
92932
|
|
|
92832
92933
|
### Visual preview
|
|
@@ -93899,6 +94000,41 @@ Reference other resources:
|
|
|
93899
94000
|
}
|
|
93900
94001
|
\`\`\`
|
|
93901
94002
|
|
|
94003
|
+
## Passing a Resource or Variable as a Run Argument
|
|
94004
|
+
|
|
94005
|
+
A script or flow argument typed as a resource (schema \`format: resource-<type>\`) is passed as
|
|
94006
|
+
the **bare string** \`$res:<path>\` — the whole argument value. Same for a variable, with
|
|
94007
|
+
\`$var:<path>\`. This applies everywhere job arguments are supplied: \`wmill script run/preview\`,
|
|
94008
|
+
\`wmill flow run/preview\`, the \`runScriptByPath\` / \`runFlowByPath\` API, a schedule's \`args\`, a
|
|
94009
|
+
trigger's configured static args.
|
|
94010
|
+
|
|
94011
|
+
\`\`\`json
|
|
94012
|
+
{
|
|
94013
|
+
"db": "$res:f/databases/postgres_prod",
|
|
94014
|
+
"api_token": "$var:g/all/api_token"
|
|
94015
|
+
}
|
|
94016
|
+
\`\`\`
|
|
94017
|
+
|
|
94018
|
+
The reference is resolved when the job runs, under the job's run-as identity — the caller for an
|
|
94019
|
+
ordinary run, but the configured principal for a schedule, a trigger, or a runnable set to run on
|
|
94020
|
+
behalf of someone else. The run fails if that identity cannot read the referenced resource or
|
|
94021
|
+
variable.
|
|
94022
|
+
|
|
94023
|
+
**Never wrap it in an object.** The resolver only rewrites a JSON value that *is* a string
|
|
94024
|
+
starting with \`$res:\` / \`$var:\`; keys are never inspected. These are all wrong and are passed
|
|
94025
|
+
through to the script unchanged:
|
|
94026
|
+
|
|
94027
|
+
\`\`\`json
|
|
94028
|
+
{ "db": { "$res": "f/databases/postgres_prod" } }
|
|
94029
|
+
{ "db": { "resource": "f/databases/postgres_prod" } }
|
|
94030
|
+
{ "db": "f/databases/postgres_prod" }
|
|
94031
|
+
\`\`\`
|
|
94032
|
+
|
|
94033
|
+
The string may sit anywhere a string can — a top-level argument, a nested object field
|
|
94034
|
+
(\`{ "gh_auth": { "token": "$var:g/all/gh_token" } }\`), or an array element (array elements are
|
|
94035
|
+
walked only while nested at most two levels deep, and only for arrays of at most 1000 items).
|
|
94036
|
+
The prefix must be on the string itself.
|
|
94037
|
+
|
|
93902
94038
|
## Common Resource Types
|
|
93903
94039
|
|
|
93904
94040
|
### PostgreSQL
|
|
@@ -94785,11 +94921,11 @@ flow related commands
|
|
|
94785
94921
|
- \`flow push <file_path:string> <remote_path:string>\` - push a local flow spec. This overrides any remote versions.
|
|
94786
94922
|
- \`--message <message:string>\` - Deployment message
|
|
94787
94923
|
- \`flow run <path:string>\` - run a flow by path.
|
|
94788
|
-
- \`-d --data <data:string>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-.
|
|
94924
|
+
- \`-d --data <data:string>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-. A resource argument is the bare string $res:<path> as its whole value, and a variable argument is the bare string $var:<path> — not an object wrapper keyed on $res/$var, and not a plain path.
|
|
94789
94925
|
- \`-s --silent\` - Do not ouput anything other then the final output. Useful for scripting.
|
|
94790
94926
|
- \`--tag <tag:string>\` - Override the worker tag the run is dispatched to (e.g. to route it to dev workers instead of the flow's default tag).
|
|
94791
94927
|
- \`flow preview <flow_path:string>\` - preview a local flow without deploying it. Runs the flow definition from local files and uses local PathScripts by default. Pass --step <id> to run only one module in isolation (resolves nested steps inside branchone/branchall/forloopflow/whileloopflow plus the special preprocessor/failure modules; supported step types: rawscript, script, flow).
|
|
94792
|
-
- \`-d --data <data:string>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-.
|
|
94928
|
+
- \`-d --data <data:string>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-. A resource argument is the bare string $res:<path> as its whole value, and a variable argument is the bare string $var:<path> — not an object wrapper keyed on $res/$var, and not a plain path.
|
|
94793
94929
|
- \`-s --silent\` - Do not output anything other then the final output. Useful for scripting.
|
|
94794
94930
|
- \`--remote\` - Use deployed workspace scripts for PathScript steps instead of local files.
|
|
94795
94931
|
- \`--step <step_id:string>\` - Run only the named step instead of the whole flow. Honors --data as the step's args and --remote / local-PathScript resolution the same way the full-flow preview does.
|
|
@@ -95185,11 +95321,11 @@ script related commands
|
|
|
95185
95321
|
- \`--json\` - Output as JSON (for piping to jq)
|
|
95186
95322
|
- \`script show <path:file>\` - show a script's content (alias for get)
|
|
95187
95323
|
- \`script run <path:file>\` - run a script by path
|
|
95188
|
-
- \`-d --data <data:file>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-.
|
|
95324
|
+
- \`-d --data <data:file>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-. A resource argument is the bare string $res:<path> as its whole value, and a variable argument is the bare string $var:<path> — not an object wrapper keyed on $res/$var, and not a plain path.
|
|
95189
95325
|
- \`-s --silent\` - Do not output anything other then the final output. Useful for scripting.
|
|
95190
95326
|
- \`--tag <tag:string>\` - Override the worker tag the run is dispatched to (e.g. to route it to dev workers instead of the script's default tag).
|
|
95191
95327
|
- \`script preview <path:file>\` - preview a local script without deploying it. Supports both regular and codebase scripts.
|
|
95192
|
-
- \`-d --data <data:file>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-.
|
|
95328
|
+
- \`-d --data <data:file>\` - Inputs specified as a JSON string or a file using @<filename> or stdin using @-. A resource argument is the bare string $res:<path> as its whole value, and a variable argument is the bare string $var:<path> — not an object wrapper keyed on $res/$var, and not a plain path.
|
|
95193
95329
|
- \`-s --silent\` - Do not output anything other than the final output. Useful for scripting.
|
|
95194
95330
|
- \`--tag <tag:string>\` - Override the worker tag the preview is dispatched to (e.g. to route it to dev workers instead of the script's default tag).
|
|
95195
95331
|
- \`script new <path:file> <language:string>\` - create a new script
|