windmill-cli 1.835.0 → 1.836.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 +253 -63
- package/package.json +1 -1
package/esm/main.js
CHANGED
|
@@ -16766,7 +16766,7 @@ var init_OpenAPI = __esm(() => {
|
|
|
16766
16766
|
PASSWORD: undefined,
|
|
16767
16767
|
TOKEN: getEnv3("WM_TOKEN"),
|
|
16768
16768
|
USERNAME: undefined,
|
|
16769
|
-
VERSION: "1.
|
|
16769
|
+
VERSION: "1.836.0",
|
|
16770
16770
|
WITH_CREDENTIALS: true,
|
|
16771
16771
|
interceptors: {
|
|
16772
16772
|
request: new Interceptors,
|
|
@@ -20074,7 +20074,7 @@ var init_auth = __esm(async () => {
|
|
|
20074
20074
|
});
|
|
20075
20075
|
|
|
20076
20076
|
// src/core/constants.ts
|
|
20077
|
-
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.
|
|
20077
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.836.0";
|
|
20078
20078
|
|
|
20079
20079
|
// src/utils/resource_folders.ts
|
|
20080
20080
|
import { existsSync } from "node:fs";
|
|
@@ -20867,9 +20867,9 @@ function gitSyncIncludePattern(pathType, path) {
|
|
|
20867
20867
|
case "flow":
|
|
20868
20868
|
return `${path}.flow/*,${path}__flow/*`;
|
|
20869
20869
|
case "app":
|
|
20870
|
-
return `${path}.app/*,${path}__app
|
|
20870
|
+
return `${path}.app/*,${path}__app/*,${path}.custom_path.*,${path}.*.custom_path.*`;
|
|
20871
20871
|
case "raw_app":
|
|
20872
|
-
return `${path}.raw_app/**,${path}__raw_app
|
|
20872
|
+
return `${path}.raw_app/**,${path}__raw_app/**,${path}.custom_path.*,${path}.*.custom_path.*`;
|
|
20873
20873
|
case "folder":
|
|
20874
20874
|
return `${path}/folder.meta.*`;
|
|
20875
20875
|
case "resourcetype":
|
|
@@ -58782,7 +58782,7 @@ var init_openflow = __esm(() => {
|
|
|
58782
58782
|
openflow_default = {
|
|
58783
58783
|
openapi: "3.0.3",
|
|
58784
58784
|
info: {
|
|
58785
|
-
version: "1.
|
|
58785
|
+
version: "1.836.0",
|
|
58786
58786
|
title: "OpenFlow Spec",
|
|
58787
58787
|
contact: {
|
|
58788
58788
|
name: "Ruben Fiszel",
|
|
@@ -63291,9 +63291,16 @@ function getWorkspaceSpecificTypeKinds() {
|
|
|
63291
63291
|
"variable",
|
|
63292
63292
|
"resource",
|
|
63293
63293
|
"schedule",
|
|
63294
|
+
"custom_path",
|
|
63294
63295
|
...TRIGGER_TYPES.map((t) => `${t}_trigger`)
|
|
63295
63296
|
];
|
|
63296
63297
|
}
|
|
63298
|
+
function isCustomPathFile(path) {
|
|
63299
|
+
const p = path.replaceAll("\\", "/");
|
|
63300
|
+
const slash = p.lastIndexOf("/");
|
|
63301
|
+
const parts = p.slice(slash + 1).split(".");
|
|
63302
|
+
return (parts.length == 3 || parts.length == 4) && parts[parts.length - 2] == "custom_path" && (parts[parts.length - 1] == "yaml" || parts[parts.length - 1] == "json") && !p.slice(0, slash + 1).includes(".") && !isFolderResourcePathAnyFormat(p) && !isScriptModulePath(p);
|
|
63303
|
+
}
|
|
63297
63304
|
function isTriggerFile(path) {
|
|
63298
63305
|
return TRIGGER_TYPES.some((type) => path.endsWith(`.${type}_trigger.yaml`) || path.endsWith(`.${type}_trigger.json`));
|
|
63299
63306
|
}
|
|
@@ -63314,7 +63321,7 @@ function getFileTypeSuffix(path) {
|
|
|
63314
63321
|
return null;
|
|
63315
63322
|
}
|
|
63316
63323
|
function buildItemTypePattern() {
|
|
63317
|
-
const basicTypes = ["variable", "resource", "schedule"];
|
|
63324
|
+
const basicTypes = ["variable", "resource", "schedule", "custom_path"];
|
|
63318
63325
|
const triggerTypes = TRIGGER_TYPES.map((t) => `${t}_trigger`);
|
|
63319
63326
|
return `((${basicTypes.join("|")})|(${triggerTypes.join("|")}))`;
|
|
63320
63327
|
}
|
|
@@ -63385,6 +63392,9 @@ function normalizeJsonToYaml(path) {
|
|
|
63385
63392
|
return path.endsWith(".json") ? path.slice(0, -".json".length) + ".yaml" : path;
|
|
63386
63393
|
}
|
|
63387
63394
|
function isItemTypeConfigured(path, specificItems) {
|
|
63395
|
+
if (isCustomPathFile(path)) {
|
|
63396
|
+
return true;
|
|
63397
|
+
}
|
|
63388
63398
|
if (!specificItems) {
|
|
63389
63399
|
return false;
|
|
63390
63400
|
}
|
|
@@ -63413,6 +63423,9 @@ function isItemTypeConfigured(path, specificItems) {
|
|
|
63413
63423
|
return false;
|
|
63414
63424
|
}
|
|
63415
63425
|
function isSpecificItem(path, specificItems) {
|
|
63426
|
+
if (isCustomPathFile(path)) {
|
|
63427
|
+
return true;
|
|
63428
|
+
}
|
|
63416
63429
|
if (!specificItems) {
|
|
63417
63430
|
return false;
|
|
63418
63431
|
}
|
|
@@ -63514,7 +63527,7 @@ function fromWorkspaceSpecificPath(workspaceSpecificPath, workspaceName) {
|
|
|
63514
63527
|
return `${pathWithoutBranchAndExtension}${extension}`;
|
|
63515
63528
|
}
|
|
63516
63529
|
function getWorkspaceSpecificPath(basePath, specificItems, workspaceNameOverride) {
|
|
63517
|
-
if (!specificItems) {
|
|
63530
|
+
if (!specificItems && !isCustomPathFile(basePath)) {
|
|
63518
63531
|
return;
|
|
63519
63532
|
}
|
|
63520
63533
|
let currentWorkspace = null;
|
|
@@ -63532,7 +63545,7 @@ function getWorkspaceSpecificPath(basePath, specificItems, workspaceNameOverride
|
|
|
63532
63545
|
return;
|
|
63533
63546
|
}
|
|
63534
63547
|
function isCurrentWorkspaceFile(path, workspaceNameOverride) {
|
|
63535
|
-
if (isFilesetResource(path)) {
|
|
63548
|
+
if (isFilesetResource(path) || isFolderResourcePathAnyFormat(path)) {
|
|
63536
63549
|
return false;
|
|
63537
63550
|
}
|
|
63538
63551
|
let currentWorkspace = null;
|
|
@@ -63554,7 +63567,7 @@ function isCurrentWorkspaceFile(path, workspaceNameOverride) {
|
|
|
63554
63567
|
return pattern.test(path);
|
|
63555
63568
|
}
|
|
63556
63569
|
function isWorkspaceSpecificFile(path) {
|
|
63557
|
-
if (isFilesetResource(path)) {
|
|
63570
|
+
if (isFilesetResource(path) || isFolderResourcePathAnyFormat(path)) {
|
|
63558
63571
|
return false;
|
|
63559
63572
|
}
|
|
63560
63573
|
const typePattern = buildItemTypePattern();
|
|
@@ -63566,6 +63579,7 @@ var init_specific_items = __esm(async () => {
|
|
|
63566
63579
|
await __promiseAll([
|
|
63567
63580
|
init_git(),
|
|
63568
63581
|
init_utils(),
|
|
63582
|
+
init_resource_folders(),
|
|
63569
63583
|
init_conf(),
|
|
63570
63584
|
init_types()
|
|
63571
63585
|
]);
|
|
@@ -65881,6 +65895,19 @@ async function track_job(workspace, id) {
|
|
|
65881
65895
|
async function pollForJobResult(workspace, jobId) {
|
|
65882
65896
|
return await pollJobWithQueueLogging(workspace, jobId);
|
|
65883
65897
|
}
|
|
65898
|
+
async function ensurePreviewOnBehalfOfSupported(workspace, onBehalfOf) {
|
|
65899
|
+
if (!onBehalfOf)
|
|
65900
|
+
return;
|
|
65901
|
+
const probeId = await runScriptPreview({
|
|
65902
|
+
workspace,
|
|
65903
|
+
requestBody: { kind: "identity", args: {}, on_behalf_of: onBehalfOf }
|
|
65904
|
+
});
|
|
65905
|
+
const job = await getJob({ workspace, id: probeId });
|
|
65906
|
+
if (job.permissioned_as === onBehalfOf || job.email?.toLowerCase() === onBehalfOf.toLowerCase()) {
|
|
65907
|
+
return;
|
|
65908
|
+
}
|
|
65909
|
+
throw new Error(`The server does not support --on-behalf-of: it would run the preview as ${job.permissioned_as}, not ${onBehalfOf}. Upgrade the Windmill instance.`);
|
|
65910
|
+
}
|
|
65884
65911
|
async function show(opts, path) {
|
|
65885
65912
|
const workspace = await resolveWorkspace(opts);
|
|
65886
65913
|
await requireLogin(opts);
|
|
@@ -66032,6 +66059,7 @@ async function preview(opts, filePath) {
|
|
|
66032
66059
|
opts = await mergeConfigWithConfigFile(opts);
|
|
66033
66060
|
const workspace = await resolveWorkspace(opts);
|
|
66034
66061
|
await requireLogin(opts);
|
|
66062
|
+
await ensurePreviewOnBehalfOfSupported(workspace.workspaceId, opts.onBehalfOf);
|
|
66035
66063
|
const argPath = filePath;
|
|
66036
66064
|
filePath = toSyncRootRelativePath(filePath, cwdBeforeConfig);
|
|
66037
66065
|
const remotePath = scriptPathToRemotePath(filePath);
|
|
@@ -66145,7 +66173,8 @@ async function preview(opts, filePath) {
|
|
|
66145
66173
|
tag: opts.tag,
|
|
66146
66174
|
kind: isTar ? "tarbundle" : "bundle",
|
|
66147
66175
|
format: codebase?.format ?? "cjs",
|
|
66148
|
-
temp_script_refs: tempScriptRefs
|
|
66176
|
+
temp_script_refs: tempScriptRefs,
|
|
66177
|
+
on_behalf_of: opts.onBehalfOf
|
|
66149
66178
|
};
|
|
66150
66179
|
form.append("preview", JSON.stringify(previewPayload));
|
|
66151
66180
|
form.append("file", typeof bundledContent === "string" ? new Blob([bundledContent], { type: "application/javascript" }) : bundledContent);
|
|
@@ -66194,7 +66223,8 @@ async function preview(opts, filePath) {
|
|
|
66194
66223
|
language,
|
|
66195
66224
|
tag: opts.tag,
|
|
66196
66225
|
modules: modules ?? undefined,
|
|
66197
|
-
temp_script_refs: tempScriptRefs
|
|
66226
|
+
temp_script_refs: tempScriptRefs,
|
|
66227
|
+
on_behalf_of: opts.onBehalfOf
|
|
66198
66228
|
}
|
|
66199
66229
|
});
|
|
66200
66230
|
const { result, success } = await pollForJobResult(workspace.workspaceId, jobId);
|
|
@@ -66333,7 +66363,7 @@ var init_script = __esm(async () => {
|
|
|
66333
66363
|
languageAliases = {
|
|
66334
66364
|
python: "python3"
|
|
66335
66365
|
};
|
|
66336
|
-
command7 = 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(list5).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(list5).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(push3).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);
|
|
66366
|
+
command7 = 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(list5).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(list5).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(push3).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).").option("--on-behalf-of <identity:string>", "Run the preview as this user or group (an email, u/<username> or g/<group>) instead of yourself, e.g. to reproduce a run_on_behalf_of identity. Requires being an admin or a member of wm_deployers.").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);
|
|
66337
66367
|
script_default = command7;
|
|
66338
66368
|
});
|
|
66339
66369
|
|
|
@@ -68142,7 +68172,7 @@ async function pushFilesetParentResource(childPath, workspaceId, alreadySynced,
|
|
|
68142
68172
|
if (cachedWsName && isWorkspaceSpecificFile(resourceFilePath)) {
|
|
68143
68173
|
serverPath = fromWorkspaceSpecificPath(resourceFilePath, cachedWsName);
|
|
68144
68174
|
wsSpecific = true;
|
|
68145
|
-
} else if (
|
|
68175
|
+
} else if (isSpecificItem(childPath, specificItems)) {
|
|
68146
68176
|
wsSpecific = true;
|
|
68147
68177
|
}
|
|
68148
68178
|
await pushResource(workspaceId, serverPath, undefined, newObj, resourceFilePath, wsSpecific ? true : undefined, true);
|
|
@@ -68306,6 +68336,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
68306
68336
|
markAccessFromPolicy(app);
|
|
68307
68337
|
markIsolationFromPolicy(app, false);
|
|
68308
68338
|
app.policy = undefined;
|
|
68339
|
+
delete app.custom_path;
|
|
68309
68340
|
yield {
|
|
68310
68341
|
isDirectory: false,
|
|
68311
68342
|
path: path15.join(finalPath, "app.yaml"),
|
|
@@ -68344,7 +68375,7 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
68344
68375
|
markAccessFromPolicy(rawApp);
|
|
68345
68376
|
markIsolationFromPolicy(rawApp, true);
|
|
68346
68377
|
rawApp.policy = undefined;
|
|
68347
|
-
delete rawApp
|
|
68378
|
+
delete rawApp.custom_path;
|
|
68348
68379
|
let inlineScripts;
|
|
68349
68380
|
const value = rawApp?.["value"];
|
|
68350
68381
|
const runnables = value?.["runnables"] ?? {};
|
|
@@ -68643,6 +68674,21 @@ function ZipFSElement(zip, useYaml, defaultTs, resourceTypeToFormatExtension, re
|
|
|
68643
68674
|
}
|
|
68644
68675
|
}
|
|
68645
68676
|
}
|
|
68677
|
+
if (kind == "app" || kind == "raw_app") {
|
|
68678
|
+
const customPath = JSON.parse(await f.async("text"))?.custom_path;
|
|
68679
|
+
if (customPath) {
|
|
68680
|
+
const appPath = removeSuffix(p, kind == "app" ? ".app.json" : ".raw_app.json");
|
|
68681
|
+
const obj = { custom_path: customPath };
|
|
68682
|
+
r.push({
|
|
68683
|
+
isDirectory: false,
|
|
68684
|
+
path: appPath + (useYaml ? ".custom_path.yaml" : ".custom_path.json"),
|
|
68685
|
+
async* getChildren() {},
|
|
68686
|
+
async getContentText() {
|
|
68687
|
+
return useYaml ? import_yaml22.stringify(obj, yamlOptions) : JSON.stringify(obj, null, 2);
|
|
68688
|
+
}
|
|
68689
|
+
});
|
|
68690
|
+
}
|
|
68691
|
+
}
|
|
68646
68692
|
return r;
|
|
68647
68693
|
}
|
|
68648
68694
|
function _internal_folder(p, zip) {
|
|
@@ -68793,7 +68839,7 @@ async function elementsToMap(els, ignore, json, skips, specificItems, branchOver
|
|
|
68793
68839
|
}
|
|
68794
68840
|
if (skips.skipFlows && fileType === "flow")
|
|
68795
68841
|
continue;
|
|
68796
|
-
if (skips.skipApps && fileType === "app")
|
|
68842
|
+
if (skips.skipApps && (fileType === "app" || fileType === "custom_path"))
|
|
68797
68843
|
continue;
|
|
68798
68844
|
if (skips.skipFolders && fileType === "folder")
|
|
68799
68845
|
continue;
|
|
@@ -69095,6 +69141,32 @@ function stripUnappliedSettingsFields(local, remote) {
|
|
|
69095
69141
|
remoteInvite.instance_groups_roles ??= {};
|
|
69096
69142
|
}
|
|
69097
69143
|
}
|
|
69144
|
+
function liftInFileCustomPaths(localMap, json) {
|
|
69145
|
+
for (const key of Object.keys(localMap)) {
|
|
69146
|
+
const normalized = key.replaceAll(SEP9, "/");
|
|
69147
|
+
const type = isRawAppFolderMetadataFile(normalized) ? "raw_app" : isAppFolderMetadataFile(normalized) ? "app" : undefined;
|
|
69148
|
+
if (!type || normalized.endsWith(json ? ".yaml" : ".json"))
|
|
69149
|
+
continue;
|
|
69150
|
+
const appPath = extractResourceName(normalized, type);
|
|
69151
|
+
let obj;
|
|
69152
|
+
try {
|
|
69153
|
+
obj = json ? JSON.parse(localMap[key]) : yamlParseContent(key, localMap[key]);
|
|
69154
|
+
} catch {
|
|
69155
|
+
continue;
|
|
69156
|
+
}
|
|
69157
|
+
if (!appPath || !obj || typeof obj != "object" || !("custom_path" in obj)) {
|
|
69158
|
+
continue;
|
|
69159
|
+
}
|
|
69160
|
+
const customPath = obj.custom_path;
|
|
69161
|
+
delete obj.custom_path;
|
|
69162
|
+
localMap[key] = json ? JSON.stringify(obj, null, 2) : import_yaml22.stringify(obj, yamlOptions);
|
|
69163
|
+
const fileKey = appPath.replaceAll("/", SEP9) + (json ? ".custom_path.json" : ".custom_path.yaml");
|
|
69164
|
+
if (customPath && !(fileKey in localMap)) {
|
|
69165
|
+
const file = { custom_path: customPath };
|
|
69166
|
+
localMap[fileKey] = json ? JSON.stringify(file, null, 2) : import_yaml22.stringify(file, yamlOptions);
|
|
69167
|
+
}
|
|
69168
|
+
}
|
|
69169
|
+
}
|
|
69098
69170
|
async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetadataDeletion, codebases, ignoreCodebaseChanges, specificItems, branchOverride, isEls1Remote, caseInsensitiveFs, parentOwnsScheduleEnabled) {
|
|
69099
69171
|
let [m1, m2] = els2 ? await Promise.all([
|
|
69100
69172
|
elementsToMap(els1, ignore, json, skips, specificItems, branchOverride, isEls1Remote),
|
|
@@ -69138,6 +69210,21 @@ async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetada
|
|
|
69138
69210
|
depFiles: skips.skipWorkspaceDependencies ? Object.keys(await getRawWorkspaceDependencies(false)) : undefined
|
|
69139
69211
|
}));
|
|
69140
69212
|
}
|
|
69213
|
+
if (isEls1Remote === false) {
|
|
69214
|
+
liftInFileCustomPaths(m1, json);
|
|
69215
|
+
for (const [k, v] of Object.entries(m1)) {
|
|
69216
|
+
if (!isCustomPathFile(k) || k in m2)
|
|
69217
|
+
continue;
|
|
69218
|
+
let value;
|
|
69219
|
+
try {
|
|
69220
|
+
value = (json ? JSON.parse(v) : yamlParseContent(k, v))?.custom_path;
|
|
69221
|
+
} catch {
|
|
69222
|
+
continue;
|
|
69223
|
+
}
|
|
69224
|
+
if (!value)
|
|
69225
|
+
delete m1[k];
|
|
69226
|
+
}
|
|
69227
|
+
}
|
|
69141
69228
|
const changes = [];
|
|
69142
69229
|
function parseYaml(k, v) {
|
|
69143
69230
|
if (k.endsWith(".script.yaml")) {
|
|
@@ -69265,6 +69352,9 @@ async function compareDynFSElement(els1, els2, ignore, json, skips, ignoreMetada
|
|
|
69265
69352
|
const remoteCodebase = {};
|
|
69266
69353
|
for (const [k] of Object.entries(m2)) {
|
|
69267
69354
|
if (m1[k] === undefined) {
|
|
69355
|
+
if (isEls1Remote === false && isCustomPathFile(k)) {
|
|
69356
|
+
continue;
|
|
69357
|
+
}
|
|
69268
69358
|
if (!ignoreMetadataDeletion || !k?.endsWith(".script.yaml") && !k?.endsWith(".script.json")) {
|
|
69269
69359
|
changes.push({ name: "deleted", path: k });
|
|
69270
69360
|
} else if (k?.endsWith(".script.yaml")) {
|
|
@@ -69348,12 +69438,14 @@ function getOrderFromPath(p) {
|
|
|
69348
69438
|
return 11;
|
|
69349
69439
|
} else if (typ == "app") {
|
|
69350
69440
|
return 12;
|
|
69351
|
-
} else if (typ == "
|
|
69441
|
+
} else if (typ == "custom_path") {
|
|
69352
69442
|
return 13;
|
|
69353
|
-
} else if (typ == "
|
|
69443
|
+
} else if (typ == "schedule") {
|
|
69354
69444
|
return 14;
|
|
69355
|
-
} else {
|
|
69445
|
+
} else if (typ == "http_trigger" || typ == "websocket_trigger" || typ == "kafka_trigger" || typ == "nats_trigger" || typ == "postgres_trigger" || typ == "mqtt_trigger" || typ == "amqp_trigger" || typ == "sqs_trigger" || typ == "gcp_trigger" || typ == "azure_trigger" || typ == "email_trigger" || typ == "native_trigger") {
|
|
69356
69446
|
return 15;
|
|
69447
|
+
} else {
|
|
69448
|
+
return 16;
|
|
69357
69449
|
}
|
|
69358
69450
|
}
|
|
69359
69451
|
async function ignoreF(wmillconf) {
|
|
@@ -69757,7 +69849,7 @@ async function pull(opts) {
|
|
|
69757
69849
|
type: change.name,
|
|
69758
69850
|
path: change.path,
|
|
69759
69851
|
...change.name === "edited" && change.codebase ? { codebase_changed: true } : {},
|
|
69760
|
-
...
|
|
69852
|
+
...isSpecificItem(change.path, specificItems) ? {
|
|
69761
69853
|
workspace_specific: true,
|
|
69762
69854
|
workspace_specific_path: getWorkspaceSpecificPath(change.path, specificItems, wsNameForFiles)
|
|
69763
69855
|
} : {}
|
|
@@ -69787,7 +69879,7 @@ async function pull(opts) {
|
|
|
69787
69879
|
for await (const rawChange of changes) {
|
|
69788
69880
|
const change = rawChange;
|
|
69789
69881
|
let targetPath = change.path;
|
|
69790
|
-
if (
|
|
69882
|
+
if (isSpecificItem(change.path, specificItems)) {
|
|
69791
69883
|
const workspaceSpecificPath = getWorkspaceSpecificPath(change.path, specificItems, wsNameForFiles);
|
|
69792
69884
|
if (workspaceSpecificPath) {
|
|
69793
69885
|
targetPath = workspaceSpecificPath;
|
|
@@ -69917,7 +70009,7 @@ Both local and remote have been modified.`));
|
|
|
69917
70009
|
type: change.name,
|
|
69918
70010
|
path: change.path,
|
|
69919
70011
|
...change.name === "edited" && change.codebase ? { codebase_changed: true } : {},
|
|
69920
|
-
...
|
|
70012
|
+
...isSpecificItem(change.path, specificItems) ? {
|
|
69921
70013
|
workspace_specific: true,
|
|
69922
70014
|
workspace_specific_path: getWorkspaceSpecificPath(change.path, specificItems, wsNameForFiles)
|
|
69923
70015
|
} : {}
|
|
@@ -70037,7 +70129,7 @@ function prettyChanges(changes, specificItems, branchOverride, folderDefaultAnno
|
|
|
70037
70129
|
for (const change of changes) {
|
|
70038
70130
|
let displayPath = change.path;
|
|
70039
70131
|
let wsNote = "";
|
|
70040
|
-
if (
|
|
70132
|
+
if (isSpecificItem(change.path, specificItems)) {
|
|
70041
70133
|
const workspaceSpecificPath = getWorkspaceSpecificPath(change.path, specificItems, branchOverride);
|
|
70042
70134
|
if (workspaceSpecificPath) {
|
|
70043
70135
|
displayPath = workspaceSpecificPath;
|
|
@@ -70590,7 +70682,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
70590
70682
|
type: change.name,
|
|
70591
70683
|
path: change.path,
|
|
70592
70684
|
...change.name === "edited" && change.codebase ? { codebase_changed: true } : {},
|
|
70593
|
-
...
|
|
70685
|
+
...isSpecificItem(change.path, specificItems) ? {
|
|
70594
70686
|
workspace_specific: true,
|
|
70595
70687
|
workspace_specific_path: getWorkspaceSpecificPath(change.path, specificItems, wsNameForFiles)
|
|
70596
70688
|
} : {}
|
|
@@ -70690,7 +70782,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
70690
70782
|
}
|
|
70691
70783
|
const groupedChanges = new Map;
|
|
70692
70784
|
for (const change of changes) {
|
|
70693
|
-
const basePath = getScriptBasePathFromModulePath(change.path) ?? change.path.split(".")[0];
|
|
70785
|
+
const basePath = getScriptBasePathFromModulePath(change.path) ?? extractResourceName(change.path, "raw_app")?.replaceAll("/", SEP9) ?? extractResourceName(change.path, "app")?.replaceAll("/", SEP9) ?? change.path.split(".")[0];
|
|
70694
70786
|
if (!groupedChanges.has(basePath)) {
|
|
70695
70787
|
groupedChanges.set(basePath, []);
|
|
70696
70788
|
}
|
|
@@ -70734,7 +70826,10 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
70734
70826
|
if (deleteRawApp) {
|
|
70735
70827
|
changes = [deleteRawApp];
|
|
70736
70828
|
} else {
|
|
70737
|
-
changes
|
|
70829
|
+
changes = [
|
|
70830
|
+
changes[0],
|
|
70831
|
+
...changes.slice(1).filter((c) => isCustomPathFile(c.path))
|
|
70832
|
+
];
|
|
70738
70833
|
}
|
|
70739
70834
|
}
|
|
70740
70835
|
for await (const change of changes) {
|
|
@@ -70823,7 +70918,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
70823
70918
|
const oldObj = parseFromPath(change.path, change.before);
|
|
70824
70919
|
const newObj = parseFromPath(change.path, change.after);
|
|
70825
70920
|
let originalWorkspaceSpecificPath;
|
|
70826
|
-
const isWsSpecific =
|
|
70921
|
+
const isWsSpecific = isSpecificItem(change.path, specificItems);
|
|
70827
70922
|
if (isWsSpecific) {
|
|
70828
70923
|
originalWorkspaceSpecificPath = getWorkspaceSpecificPath(change.path, specificItems, wsNameForFiles);
|
|
70829
70924
|
}
|
|
@@ -70881,7 +70976,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
70881
70976
|
}
|
|
70882
70977
|
const obj = parseFromPath(change.path, change.content);
|
|
70883
70978
|
let localFilePath = change.path;
|
|
70884
|
-
const isAddedWsSpecific =
|
|
70979
|
+
const isAddedWsSpecific = isSpecificItem(change.path, specificItems);
|
|
70885
70980
|
if (isAddedWsSpecific) {
|
|
70886
70981
|
const workspaceSpecificPath = getWorkspaceSpecificPath(change.path, specificItems, wsNameForFiles);
|
|
70887
70982
|
if (workspaceSpecificPath) {
|
|
@@ -71258,7 +71353,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
71258
71353
|
type: change.name,
|
|
71259
71354
|
path: change.path,
|
|
71260
71355
|
...change.name === "edited" && change.codebase ? { codebase_changed: true } : {},
|
|
71261
|
-
...
|
|
71356
|
+
...isSpecificItem(change.path, specificItems) ? {
|
|
71262
71357
|
workspace_specific: true,
|
|
71263
71358
|
workspace_specific_path: getWorkspaceSpecificPath(change.path, specificItems, wsNameForFiles)
|
|
71264
71359
|
} : {}
|
|
@@ -72610,7 +72705,7 @@ async function collectAppFiles(localPath) {
|
|
|
72610
72705
|
await readDirRecursive(localPath);
|
|
72611
72706
|
return files;
|
|
72612
72707
|
}
|
|
72613
|
-
async function pushRawApp(workspace, remotePath, localPath, message, defaultTs = "bun", permissionedAsContext) {
|
|
72708
|
+
async function pushRawApp(workspace, remotePath, localPath, message, defaultTs = "bun", permissionedAsContext, customPathFromFile = true) {
|
|
72614
72709
|
if (alreadySynced.includes(localPath)) {
|
|
72615
72710
|
return;
|
|
72616
72711
|
}
|
|
@@ -72673,10 +72768,12 @@ async function pushRawApp(workspace, remotePath, localPath, message, defaultTs =
|
|
|
72673
72768
|
extra_perms: localPerms,
|
|
72674
72769
|
sandbox: _sandbox,
|
|
72675
72770
|
frontend_api: _frontendApi,
|
|
72771
|
+
custom_path: localCustomPath,
|
|
72676
72772
|
...localAppNoPerms
|
|
72677
72773
|
} = localApp;
|
|
72774
|
+
const customPath = customPathFromFile ? localCustomPath : undefined;
|
|
72678
72775
|
if (app) {
|
|
72679
|
-
const metadataUpToDate = isSuperset({ ...localAppNoPerms, runnables }, app) && isolationUpToDate(isolation, deployedPolicy, true);
|
|
72776
|
+
const metadataUpToDate = isSuperset({ ...localAppNoPerms, runnables }, app) && changedCustomPath(customPath, app) === undefined && isolationUpToDate(isolation, deployedPolicy, true);
|
|
72680
72777
|
const filesUpToDate = deepEqual(files, app.value?.files);
|
|
72681
72778
|
if (metadataUpToDate && filesUpToDate) {
|
|
72682
72779
|
info(colors.green(`App ${remotePath} is up to date`));
|
|
@@ -72695,7 +72792,7 @@ async function pushRawApp(workspace, remotePath, localPath, message, defaultTs =
|
|
|
72695
72792
|
...preserveFields,
|
|
72696
72793
|
deployment_message: message,
|
|
72697
72794
|
skip_draft_deletion: true,
|
|
72698
|
-
|
|
72795
|
+
custom_path: changedCustomPath(customPath, app)
|
|
72699
72796
|
},
|
|
72700
72797
|
js,
|
|
72701
72798
|
css
|
|
@@ -72714,7 +72811,7 @@ async function pushRawApp(workspace, remotePath, localPath, message, defaultTs =
|
|
|
72714
72811
|
policy: appForPolicy.policy,
|
|
72715
72812
|
deployment_message: message,
|
|
72716
72813
|
skip_draft_deletion: true,
|
|
72717
|
-
...
|
|
72814
|
+
...customPath ? { custom_path: customPath } : {}
|
|
72718
72815
|
},
|
|
72719
72816
|
js,
|
|
72720
72817
|
css
|
|
@@ -74271,7 +74368,7 @@ data: reload
|
|
|
74271
74368
|
if (!runnable) {
|
|
74272
74369
|
throw new Error(`Runnable not found: ${runnableId}`);
|
|
74273
74370
|
}
|
|
74274
|
-
const uuid = await executeRunnable(runnable, workspaceId, appPath, runnableId, args, appTempRefs);
|
|
74371
|
+
const uuid = await executeRunnable(runnable, workspaceId, appPath, runnableId, args, appTempRefs, previewModules(runnables, runnableId));
|
|
74275
74372
|
info(colors.gray(`[backend] Job started: ${uuid}`));
|
|
74276
74373
|
const result = await waitForJob(workspaceId, uuid);
|
|
74277
74374
|
return { uuid, result };
|
|
@@ -74296,7 +74393,7 @@ data: reload
|
|
|
74296
74393
|
if (!runnable) {
|
|
74297
74394
|
throw new Error(`Runnable not found: ${runnable_id}`);
|
|
74298
74395
|
}
|
|
74299
|
-
const uuid = await executeRunnable(runnable, workspaceId, appPath, runnable_id, v, appTempRefs);
|
|
74396
|
+
const uuid = await executeRunnable(runnable, workspaceId, appPath, runnable_id, v, appTempRefs, previewModules(runnables, runnable_id));
|
|
74300
74397
|
info(colors.gray(`[backendAsync] Job started: ${uuid}`));
|
|
74301
74398
|
respond("backendAsyncRes", uuid, false);
|
|
74302
74399
|
waitForJob(workspaceId, uuid).then((result) => {
|
|
@@ -74612,7 +74709,43 @@ async function loadRunnables() {
|
|
|
74612
74709
|
return {};
|
|
74613
74710
|
}
|
|
74614
74711
|
}
|
|
74615
|
-
|
|
74712
|
+
function moduleExtension(language) {
|
|
74713
|
+
if (language === "bun" || language === "bunnative")
|
|
74714
|
+
return "ts";
|
|
74715
|
+
if (language === "python3")
|
|
74716
|
+
return "py";
|
|
74717
|
+
return;
|
|
74718
|
+
}
|
|
74719
|
+
function siblingImports(content, ext) {
|
|
74720
|
+
const pattern = ext === "ts" ? /(?:from|import)\s*['"]\.\/([^'"/]+?)(?:\.ts)?['"]/g : /^\s*from\s+\.([A-Za-z_]\w*)\s+import\b/gm;
|
|
74721
|
+
return Array.from(content.matchAll(pattern), (m) => m[1]);
|
|
74722
|
+
}
|
|
74723
|
+
function previewModules(runnables, runnableId) {
|
|
74724
|
+
const inlineScriptOf = (r) => r && ("inlineScript" in r) ? r.inlineScript : undefined;
|
|
74725
|
+
const own = inlineScriptOf(runnables[runnableId]);
|
|
74726
|
+
const ext = moduleExtension(own?.language);
|
|
74727
|
+
if (!own || !ext)
|
|
74728
|
+
return;
|
|
74729
|
+
const modules = {};
|
|
74730
|
+
const queue = siblingImports(own.content, ext);
|
|
74731
|
+
while (queue.length > 0) {
|
|
74732
|
+
const id = queue.pop();
|
|
74733
|
+
const key = `${id}.${ext}`;
|
|
74734
|
+
const inlineScript = inlineScriptOf(runnables[id]);
|
|
74735
|
+
if (key in modules || key === "main.ts")
|
|
74736
|
+
continue;
|
|
74737
|
+
if (!inlineScript || moduleExtension(inlineScript.language) !== ext) {
|
|
74738
|
+
continue;
|
|
74739
|
+
}
|
|
74740
|
+
modules[key] = {
|
|
74741
|
+
content: inlineScript.content,
|
|
74742
|
+
language: inlineScript.language
|
|
74743
|
+
};
|
|
74744
|
+
queue.push(...siblingImports(inlineScript.content, ext));
|
|
74745
|
+
}
|
|
74746
|
+
return Object.keys(modules).length > 0 ? modules : undefined;
|
|
74747
|
+
}
|
|
74748
|
+
async function executeRunnable(runnable, workspace, appPath, runnableId, args, tempScriptRefs, modules) {
|
|
74616
74749
|
const requestBody = {
|
|
74617
74750
|
component: runnableId,
|
|
74618
74751
|
args: args ?? {},
|
|
@@ -74637,12 +74770,14 @@ async function executeRunnable(runnable, workspace, appPath, runnableId, args, t
|
|
|
74637
74770
|
if (inlineScript.id !== undefined) {
|
|
74638
74771
|
requestBody.id = inlineScript.id;
|
|
74639
74772
|
}
|
|
74773
|
+
const previewMods = inlineScript.id === undefined ? modules : undefined;
|
|
74640
74774
|
requestBody.raw_code = {
|
|
74641
74775
|
content: inlineScript.id === undefined ? inlineScript.content : "",
|
|
74642
74776
|
language: inlineScript.language ?? "",
|
|
74643
74777
|
path: `${appPath}/${runnableId}`,
|
|
74644
|
-
lock: inlineScript.id === undefined ? inlineScript.lock : undefined,
|
|
74645
|
-
cache_ttl: inlineScript.cache_ttl
|
|
74778
|
+
lock: inlineScript.id === undefined && !previewMods ? inlineScript.lock : undefined,
|
|
74779
|
+
cache_ttl: inlineScript.cache_ttl,
|
|
74780
|
+
...previewMods ? { modules: previewMods } : {}
|
|
74646
74781
|
};
|
|
74647
74782
|
if (inlineScript.id === undefined && tempScriptRefs) {
|
|
74648
74783
|
requestBody.temp_script_refs = tempScriptRefs;
|
|
@@ -75605,7 +75740,8 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
|
|
|
75605
75740
|
await mkdir10(path23.join(appDir, "backend"), { recursive: true });
|
|
75606
75741
|
await mkdir10(path23.join(appDir, "sql_to_apply"), { recursive: true });
|
|
75607
75742
|
const rawAppConfig = {
|
|
75608
|
-
summary
|
|
75743
|
+
summary,
|
|
75744
|
+
sandbox: true
|
|
75609
75745
|
};
|
|
75610
75746
|
if (dataConfig.datatable) {
|
|
75611
75747
|
rawAppConfig.data = dataConfig;
|
|
@@ -75987,6 +76123,23 @@ function stripEditorState(app) {
|
|
|
75987
76123
|
delete app.value.parent_version;
|
|
75988
76124
|
}
|
|
75989
76125
|
}
|
|
76126
|
+
function changedCustomPath(local, deployed) {
|
|
76127
|
+
return (local ?? "") === (deployed?.custom_path ?? "") ? undefined : local;
|
|
76128
|
+
}
|
|
76129
|
+
async function pushAppCustomPath(workspace, remotePath, localFile) {
|
|
76130
|
+
remotePath = remotePath.replaceAll(SEP14, "/");
|
|
76131
|
+
const deployed = await getAppByPath({ workspace, path: remotePath });
|
|
76132
|
+
const customPath = changedCustomPath(localFile?.custom_path ?? "", deployed);
|
|
76133
|
+
if (customPath === undefined) {
|
|
76134
|
+
return;
|
|
76135
|
+
}
|
|
76136
|
+
info(colors.bold.yellow(`Setting custom path of app ${remotePath}...`));
|
|
76137
|
+
await updateApp({
|
|
76138
|
+
workspace,
|
|
76139
|
+
path: remotePath,
|
|
76140
|
+
requestBody: { custom_path: customPath, skip_draft_deletion: true }
|
|
76141
|
+
});
|
|
76142
|
+
}
|
|
75990
76143
|
function isExecutionModeAnonymous(app) {
|
|
75991
76144
|
return app?.["policy"]?.["execution_mode"] == "anonymous";
|
|
75992
76145
|
}
|
|
@@ -76067,7 +76220,7 @@ function isolationUpToDate(isolation, deployedPolicy, rawApp) {
|
|
|
76067
76220
|
const deployed = deployedPolicy?.frontend_sdk_scopes ?? [];
|
|
76068
76221
|
return deployed.length === isolation.frontendApi.length && deployed.every((s, i) => s === isolation.frontendApi[i]);
|
|
76069
76222
|
}
|
|
76070
|
-
async function pushApp(workspace, remotePath, localPath, message, permissionedAsContext) {
|
|
76223
|
+
async function pushApp(workspace, remotePath, localPath, message, permissionedAsContext, customPathFromFile = true) {
|
|
76071
76224
|
if (alreadySynced2.includes(localPath)) {
|
|
76072
76225
|
return;
|
|
76073
76226
|
}
|
|
@@ -76099,10 +76252,12 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
76099
76252
|
extra_perms: localPerms,
|
|
76100
76253
|
sandbox: _sandbox,
|
|
76101
76254
|
frontend_api: _frontendApi,
|
|
76255
|
+
custom_path: localCustomPath,
|
|
76102
76256
|
...localAppBody
|
|
76103
76257
|
} = localApp;
|
|
76258
|
+
const customPath = customPathFromFile ? localCustomPath : undefined;
|
|
76104
76259
|
if (app) {
|
|
76105
|
-
if (isSuperset(localAppBody, app) && isolationUpToDate(isolation, deployedPolicy, false)) {
|
|
76260
|
+
if (isSuperset(localAppBody, app) && changedCustomPath(customPath, app) === undefined && isolationUpToDate(isolation, deployedPolicy, false)) {
|
|
76106
76261
|
info(colors.green(`App ${remotePath} is up to date`));
|
|
76107
76262
|
} else {
|
|
76108
76263
|
info(colors.bold.yellow(`Updating app ${remotePath}...`));
|
|
@@ -76112,6 +76267,7 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
76112
76267
|
requestBody: {
|
|
76113
76268
|
deployment_message: message,
|
|
76114
76269
|
...localAppBody,
|
|
76270
|
+
custom_path: changedCustomPath(customPath, app),
|
|
76115
76271
|
...preserveFields,
|
|
76116
76272
|
skip_draft_deletion: true
|
|
76117
76273
|
}
|
|
@@ -76125,6 +76281,7 @@ async function pushApp(workspace, remotePath, localPath, message, permissionedAs
|
|
|
76125
76281
|
path: remotePath,
|
|
76126
76282
|
deployment_message: message,
|
|
76127
76283
|
...localAppBody,
|
|
76284
|
+
...customPath ? { custom_path: customPath } : {},
|
|
76128
76285
|
...preserveFields,
|
|
76129
76286
|
skip_draft_deletion: true
|
|
76130
76287
|
}
|
|
@@ -77717,13 +77874,15 @@ async function pushObj(workspace, p, befObj, newObj, plainSecrets, alreadySynced
|
|
|
77717
77874
|
if (!appName) {
|
|
77718
77875
|
throw new Error(`Could not extract app name from path: ${p}`);
|
|
77719
77876
|
}
|
|
77720
|
-
await pushApp(workspace, appName, buildFolderPath(appName, "app"), message, permissionedAsContext);
|
|
77877
|
+
await pushApp(workspace, appName, buildFolderPath(appName, "app"), message, permissionedAsContext, false);
|
|
77721
77878
|
} else if (typeEnding === "raw_app") {
|
|
77722
77879
|
const rawAppName = extractResourceName(p, "raw_app");
|
|
77723
77880
|
if (!rawAppName) {
|
|
77724
77881
|
throw new Error(`Could not extract raw app name from path: ${p}`);
|
|
77725
77882
|
}
|
|
77726
|
-
await pushRawApp(workspace, rawAppName, buildFolderPath(rawAppName, "raw_app"), message, defaultTs, permissionedAsContext);
|
|
77883
|
+
await pushRawApp(workspace, rawAppName, buildFolderPath(rawAppName, "raw_app"), message, defaultTs, permissionedAsContext, false);
|
|
77884
|
+
} else if (typeEnding === "custom_path") {
|
|
77885
|
+
await pushAppCustomPath(workspace, removeType(p, "custom_path"), newObj);
|
|
77727
77886
|
} else if (typeEnding === "folder") {
|
|
77728
77887
|
await pushFolder(workspace, p, befObj, newObj);
|
|
77729
77888
|
} else if (typeEnding === "variable") {
|
|
@@ -77854,7 +78013,7 @@ function getTypeStrFromPath(p) {
|
|
|
77854
78013
|
if (typeEnding?.endsWith("_native_trigger")) {
|
|
77855
78014
|
return "native_trigger";
|
|
77856
78015
|
}
|
|
77857
|
-
if (typeEnding === "script" || typeEnding === "variable" || typeEnding === "resource" || typeEnding === "resource-type" || typeEnding === "app" || typeEnding === "schedule" || typeEnding === "http_trigger" || typeEnding === "websocket_trigger" || typeEnding === "kafka_trigger" || typeEnding === "nats_trigger" || typeEnding === "postgres_trigger" || typeEnding === "mqtt_trigger" || typeEnding === "amqp_trigger" || typeEnding === "sqs_trigger" || typeEnding === "gcp_trigger" || typeEnding === "azure_trigger" || typeEnding === "email_trigger" || typeEnding === "user" || typeEnding === "group" || typeEnding === "settings" || typeEnding === "encryption_key") {
|
|
78016
|
+
if (typeEnding === "script" || typeEnding === "variable" || typeEnding === "resource" || typeEnding === "resource-type" || typeEnding === "app" || typeEnding === "custom_path" || typeEnding === "schedule" || typeEnding === "http_trigger" || typeEnding === "websocket_trigger" || typeEnding === "kafka_trigger" || typeEnding === "nats_trigger" || typeEnding === "postgres_trigger" || typeEnding === "mqtt_trigger" || typeEnding === "amqp_trigger" || typeEnding === "sqs_trigger" || typeEnding === "gcp_trigger" || typeEnding === "azure_trigger" || typeEnding === "email_trigger" || typeEnding === "user" || typeEnding === "group" || typeEnding === "settings" || typeEnding === "encryption_key") {
|
|
77858
78017
|
return typeEnding;
|
|
77859
78018
|
} else {
|
|
77860
78019
|
throw new Error("Could not infer type of path " + JSON.stringify(parsed));
|
|
@@ -78476,6 +78635,7 @@ async function preview2(opts, flowPath) {
|
|
|
78476
78635
|
}
|
|
78477
78636
|
const workspace = await resolveWorkspace(opts);
|
|
78478
78637
|
await requireLogin(opts);
|
|
78638
|
+
await ensurePreviewOnBehalfOfSupported(workspace.workspaceId, opts.onBehalfOf);
|
|
78479
78639
|
const codebases = useLocalPathScripts ? listSyncCodebases(opts) : [];
|
|
78480
78640
|
const argPath = flowPath;
|
|
78481
78641
|
flowPath = toSyncRootRelativePath(flowPath, cwdBeforeConfig);
|
|
@@ -78529,7 +78689,7 @@ async function preview2(opts, flowPath) {
|
|
|
78529
78689
|
const input = opts.data ? await resolve9(opts.data) : {};
|
|
78530
78690
|
debug(`Flow value: ${JSON.stringify(localFlow.value, null, 2)}`);
|
|
78531
78691
|
if (opts.step) {
|
|
78532
|
-
await previewStep(opts.step, localFlow, flowWmPath, workspace, input, tempScriptRefs, opts.silent, opts.tag);
|
|
78692
|
+
await previewStep(opts.step, localFlow, flowWmPath, workspace, input, tempScriptRefs, opts.silent, opts.tag, opts.onBehalfOf);
|
|
78533
78693
|
return;
|
|
78534
78694
|
}
|
|
78535
78695
|
if (!opts.silent) {
|
|
@@ -78542,7 +78702,8 @@ async function preview2(opts, flowPath) {
|
|
|
78542
78702
|
path: flowWmPath,
|
|
78543
78703
|
args: input,
|
|
78544
78704
|
tag: opts.tag,
|
|
78545
|
-
temp_script_refs: tempScriptRefs
|
|
78705
|
+
temp_script_refs: tempScriptRefs,
|
|
78706
|
+
on_behalf_of: opts.onBehalfOf
|
|
78546
78707
|
}
|
|
78547
78708
|
});
|
|
78548
78709
|
const { result, success } = await pollForJobResult(workspace.workspaceId, jobId);
|
|
@@ -78563,7 +78724,7 @@ async function preview2(opts, flowPath) {
|
|
|
78563
78724
|
info(JSON.stringify(result, null, 2));
|
|
78564
78725
|
}
|
|
78565
78726
|
}
|
|
78566
|
-
async function previewStep(stepId, localFlow, flowWmPath, workspace, baseArgs, tempScriptRefs, silent, tag) {
|
|
78727
|
+
async function previewStep(stepId, localFlow, flowWmPath, workspace, baseArgs, tempScriptRefs, silent, tag, onBehalfOf) {
|
|
78567
78728
|
const module = findStepInFlowValue(localFlow.value, stepId);
|
|
78568
78729
|
if (!module) {
|
|
78569
78730
|
const available = collectStepIds(localFlow.value).join(", ") || "(none)";
|
|
@@ -78583,7 +78744,8 @@ async function previewStep(stepId, localFlow, flowWmPath, workspace, baseArgs, t
|
|
|
78583
78744
|
flow_path: flowWmPath,
|
|
78584
78745
|
args,
|
|
78585
78746
|
tag,
|
|
78586
|
-
temp_script_refs: tempScriptRefs
|
|
78747
|
+
temp_script_refs: tempScriptRefs,
|
|
78748
|
+
on_behalf_of: onBehalfOf
|
|
78587
78749
|
}
|
|
78588
78750
|
});
|
|
78589
78751
|
} else if (moduleValue?.type === "script") {
|
|
@@ -78604,10 +78766,14 @@ async function previewStep(stepId, localFlow, flowWmPath, workspace, baseArgs, t
|
|
|
78604
78766
|
flow_path: flowWmPath,
|
|
78605
78767
|
args,
|
|
78606
78768
|
tag,
|
|
78607
|
-
temp_script_refs: tempScriptRefs
|
|
78769
|
+
temp_script_refs: tempScriptRefs,
|
|
78770
|
+
on_behalf_of: onBehalfOf
|
|
78608
78771
|
}
|
|
78609
78772
|
});
|
|
78610
78773
|
} else if (moduleValue?.type === "flow") {
|
|
78774
|
+
if (onBehalfOf) {
|
|
78775
|
+
throw new Error(`--on-behalf-of does not apply to step '${stepId}': a flow step runs the deployed flow ${moduleValue.path} by path, and this flag cannot override its identity.`);
|
|
78776
|
+
}
|
|
78611
78777
|
info(colors.yellow(`Previewing step '${stepId}' (flow ${moduleValue.path})...`));
|
|
78612
78778
|
jobId = await runFlowByPath({
|
|
78613
78779
|
workspace: workspace.workspaceId,
|
|
@@ -78848,7 +79014,7 @@ var init_flow = __esm(async () => {
|
|
|
78848
79014
|
]);
|
|
78849
79015
|
import_yaml41 = __toESM(require_dist(), 1);
|
|
78850
79016
|
alreadySynced3 = [];
|
|
78851
|
-
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) => {
|
|
79017
|
+
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).").option("--on-behalf-of <identity:string>", "Run the preview as this user or group (an email, u/<username> or g/<group>) instead of yourself, e.g. to reproduce a run_on_behalf_of identity. Requires being an admin or a member of wm_deployers.").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) => {
|
|
78852
79018
|
const workspace = await resolveWorkspace(opts);
|
|
78853
79019
|
await requireLogin(opts);
|
|
78854
79020
|
const remote = await getFlowByPath({
|
|
@@ -86913,6 +87079,10 @@ def main(user_id: str):
|
|
|
86913
87079
|
return user
|
|
86914
87080
|
\`\`\`
|
|
86915
87081
|
|
|
87082
|
+
#### Sharing code between runnables
|
|
87083
|
+
|
|
87084
|
+
An inline runnable can import another inline runnable of the same app by its id, as a relative import: \`import { getDb } from './shared'\` (TypeScript, Bun) or \`from .shared import get_db\` (Python). This works across TypeScript (Bun) runnables and across Python runnables, not between the two. The imported runnable's own dependencies are picked up, and it can import further runnables in turn. A runnable that only holds helpers needs no \`main\`; the frontend just never calls it. A TypeScript runnable whose id is \`main\` cannot be imported, because that name is taken by the entrypoint file of every TypeScript job: give shared code any other id.
|
|
87085
|
+
|
|
86916
87086
|
#### The \`wmill\` client is already authenticated
|
|
86917
87087
|
|
|
86918
87088
|
An inline runnable runs as an ordinary Windmill job. \`import * as wmill from 'windmill-client'\` (TypeScript) and \`import wmill\` (Python) are already pointed at this instance and this workspace — there is nothing to configure.
|
|
@@ -86956,14 +87126,18 @@ A draft app is reachable by nobody; deploying is what exposes it, and its backen
|
|
|
86956
87126
|
Either one lets those people run the app's backend runnables, so never open an app up unless the user asks.
|
|
86957
87127
|
\`public: true\` in \`raw_app.yaml\` deploys the app for anonymous users, and \`guests: true\` for guests. Remove the line and the next push closes the app again.
|
|
86958
87128
|
|
|
87129
|
+
An app's custom URL is not in \`raw_app.yaml\`: each workspace has its own file next to the app folder, \`<app path>.<workspace>.custom_path.yaml\` (for example \`f/sales/dashboard.prod.custom_path.yaml\` holding \`custom_path: dashboard\`), where \`<workspace>\` is the workspace's name in \`wmill.yaml\`, or its id. A push applies only the target workspace's file and leaves the deployed custom URL alone when there is none, so deleting the file does not remove the URL: \`custom_path: ''\` does. Setting or clearing one takes a workspace admin.
|
|
87130
|
+
|
|
86959
87131
|
## Sandbox isolation and frontend API access
|
|
86960
87132
|
|
|
86961
|
-
|
|
87133
|
+
New apps are sandboxed: the frontend is isolated from the viewer's own Windmill session and reaches Windmill only through its backend runnables, plus whatever frontend API scopes the app declares, which each viewer approves before the app runs. With isolation turned off, the frontend runs with the viewer's full session. The scopes are \`jobs:run\`, \`jobs:read\`, \`resources:read\`, \`variables:read\`, \`flow_conversations:read\` and \`flow_conversations:write\`; grant only the ones the frontend calls. The viewer's identity needs no scope: it is in \`window.ctx\`, and whoami works with any of them.
|
|
87134
|
+
|
|
87135
|
+
Inside the sandbox, IndexedDB is unavailable, third-party sign-in and OAuth redirects fail, and requests to other services carry \`Origin: null\`, which an API that checks the origin rejects. Work around these first: call the service from a backend runnable, keep state in a data table or \`localStorage\`, or grant the frontend API scope the code needs. Suggest turning isolation off only when none of that works, and say plainly that it is a security risk: the app's code, and any XSS bug in it, then runs with the full Windmill permissions of everyone who opens the app.
|
|
86962
87136
|
In \`raw_app.yaml\`:
|
|
86963
87137
|
|
|
86964
87138
|
\`\`\`yaml
|
|
86965
87139
|
sandbox: true
|
|
86966
|
-
frontend_api: [jobs:run
|
|
87140
|
+
frontend_api: [jobs:run]
|
|
86967
87141
|
\`\`\`
|
|
86968
87142
|
|
|
86969
87143
|
A file with a \`sandbox\` key states both settings: \`sandbox: false\` turns isolation off, and a missing \`frontend_api\` means no scopes. A file without the key leaves the deployed app's isolation and scopes as they are, so removing \`sandbox: true\` does not unsandbox it. \`frontend_api\` needs \`sandbox: true\`; the push fails otherwise.
|
|
@@ -88578,6 +88752,7 @@ flow related commands
|
|
|
88578
88752
|
- \`--remote\` - Use deployed workspace scripts for PathScript steps instead of local files.
|
|
88579
88753
|
- \`--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.
|
|
88580
88754
|
- \`--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).
|
|
88755
|
+
- \`--on-behalf-of <identity:string>\` - Run the preview as this user or group (an email, u/<username> or g/<group>) instead of yourself, e.g. to reproduce a run_on_behalf_of identity. Requires being an admin or a member of wm_deployers.
|
|
88581
88756
|
- \`flow new <flow_path:string>\` - create a new empty flow
|
|
88582
88757
|
- \`--summary <summary:string>\` - flow summary
|
|
88583
88758
|
- \`--description <description:string>\` - flow description
|
|
@@ -88976,6 +89151,7 @@ script related commands
|
|
|
88976
89151
|
- \`-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.
|
|
88977
89152
|
- \`-s --silent\` - Do not output anything other than the final output. Useful for scripting.
|
|
88978
89153
|
- \`--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).
|
|
89154
|
+
- \`--on-behalf-of <identity:string>\` - Run the preview as this user or group (an email, u/<username> or g/<group>) instead of yourself, e.g. to reproduce a run_on_behalf_of identity. Requires being an admin or a member of wm_deployers.
|
|
88979
89155
|
- \`script new <path:file> <language:string>\` - create a new script
|
|
88980
89156
|
- \`--summary <summary:string>\` - script summary
|
|
88981
89157
|
- \`--description <description:string>\` - script description
|
|
@@ -93465,6 +93641,17 @@ async function listWorkspacePaths() {
|
|
|
93465
93641
|
items.push({ path: stripFolderSuffix(childRel, APP_SUFFIXES), kind: "raw_app" });
|
|
93466
93642
|
continue;
|
|
93467
93643
|
}
|
|
93644
|
+
if (entry.name.endsWith(getModuleFolderSuffix())) {
|
|
93645
|
+
const files = await readdir10(childAbs).catch(() => []);
|
|
93646
|
+
if (files.some((f) => f.startsWith("script.") && hasScriptExt(f))) {
|
|
93647
|
+
items.push({
|
|
93648
|
+
path: childRel.slice(0, -getModuleFolderSuffix().length),
|
|
93649
|
+
kind: "script",
|
|
93650
|
+
_metaPath: path25.join(childAbs, "script.yaml")
|
|
93651
|
+
});
|
|
93652
|
+
}
|
|
93653
|
+
continue;
|
|
93654
|
+
}
|
|
93468
93655
|
if (entry.name.endsWith(DBT_MODULE_SUFFIX)) {
|
|
93469
93656
|
const base = childRel.slice(0, -DBT_MODULE_SUFFIX.length);
|
|
93470
93657
|
items.push({
|
|
@@ -93576,19 +93763,19 @@ async function dev2(opts) {
|
|
|
93576
93763
|
const flowMetadataFile = getMetadataFileName("flow", "yaml");
|
|
93577
93764
|
async function loadPaths(pathsToLoad) {
|
|
93578
93765
|
const rest = [];
|
|
93579
|
-
const
|
|
93766
|
+
const scriptsWithModules = new Set;
|
|
93580
93767
|
for (const raw of pathsToLoad) {
|
|
93581
93768
|
const rel = (await realpath(raw).catch(() => raw)).replace(base + SEP22, "").replaceAll("\\", "/");
|
|
93582
|
-
const wmPath =
|
|
93769
|
+
const wmPath = getScriptBasePathFromModulePath(rel);
|
|
93583
93770
|
if (wmPath)
|
|
93584
|
-
|
|
93771
|
+
scriptsWithModules.add(wmPath);
|
|
93585
93772
|
else
|
|
93586
93773
|
rest.push(raw);
|
|
93587
93774
|
}
|
|
93588
|
-
for (const wmPath of
|
|
93775
|
+
for (const wmPath of scriptsWithModules) {
|
|
93589
93776
|
const edit = await loadWmPath(wmPath);
|
|
93590
93777
|
if (edit) {
|
|
93591
|
-
info("Updated " + wmPath + " (
|
|
93778
|
+
info("Updated " + wmPath + " (script modules)");
|
|
93592
93779
|
broadcastChanges(edit);
|
|
93593
93780
|
}
|
|
93594
93781
|
}
|
|
@@ -93635,8 +93822,7 @@ async function dev2(opts) {
|
|
|
93635
93822
|
info("Updated " + wmFlowPath);
|
|
93636
93823
|
broadcastChanges(currentLastEdit);
|
|
93637
93824
|
} else if (typ == "script") {
|
|
93638
|
-
const
|
|
93639
|
-
const wmPath = splitted[0];
|
|
93825
|
+
const wmPath = removeExtensionToPath(cpath);
|
|
93640
93826
|
const content = await readTextFile(cpath);
|
|
93641
93827
|
const lang = inferContentTypeFromFilePath(cpath, opts.defaultTs);
|
|
93642
93828
|
const typed = (await parseMetadataFile(removeExtensionToPath(cpath), undefined))?.payload;
|
|
@@ -93647,7 +93833,8 @@ async function dev2(opts) {
|
|
|
93647
93833
|
language: lang,
|
|
93648
93834
|
tag: typed?.tag,
|
|
93649
93835
|
lock: typed?.lock,
|
|
93650
|
-
temp_script_refs: tempScriptRefs
|
|
93836
|
+
temp_script_refs: tempScriptRefs,
|
|
93837
|
+
modules: await readModulesFromDisk(wmPath + getModuleFolderSuffix(lang), opts.defaultTs, lang === "dbt", lang === "dbt")
|
|
93651
93838
|
};
|
|
93652
93839
|
info("Updated " + wmPath);
|
|
93653
93840
|
broadcastChanges(currentLastEdit);
|
|
@@ -93690,8 +93877,11 @@ async function dev2(opts) {
|
|
|
93690
93877
|
currentLastEdit = edit;
|
|
93691
93878
|
return edit;
|
|
93692
93879
|
} catch {}
|
|
93693
|
-
|
|
93694
|
-
|
|
93880
|
+
const candidates = [
|
|
93881
|
+
...exts.map((ext) => ({ ext, filePath: wmPath + ext, folderLayout: false })),
|
|
93882
|
+
...exts.filter((ext) => !ext.includes("/")).map((ext) => ({ ext, filePath: wmPath + getModuleFolderSuffix() + "/script" + ext, folderLayout: true }))
|
|
93883
|
+
];
|
|
93884
|
+
for (const { ext, filePath, folderLayout } of candidates) {
|
|
93695
93885
|
try {
|
|
93696
93886
|
const isAbsentDbtDescriptor = ext === "__dbt/" + DBT_DESCRIPTOR_NAME && !await access(filePath).then(() => true, () => false) && await access(wmPath + DBT_MODULE_SUFFIX + "/dbt_project.yml").then(() => true, () => false);
|
|
93697
93887
|
if (!isAbsentDbtDescriptor) {
|
|
@@ -93699,7 +93889,7 @@ async function dev2(opts) {
|
|
|
93699
93889
|
}
|
|
93700
93890
|
const content = isAbsentDbtDescriptor ? "" : await readTextFile(filePath);
|
|
93701
93891
|
const lang = inferContentTypeFromFilePath(filePath, opts.defaultTs);
|
|
93702
|
-
const typed = (await parseMetadataFile(
|
|
93892
|
+
const typed = (await parseMetadataFile(wmPath, undefined))?.payload;
|
|
93703
93893
|
const edit = {
|
|
93704
93894
|
type: "script",
|
|
93705
93895
|
content,
|
|
@@ -93708,7 +93898,7 @@ async function dev2(opts) {
|
|
|
93708
93898
|
tag: typed?.tag,
|
|
93709
93899
|
lock: typed?.lock,
|
|
93710
93900
|
temp_script_refs: tempScriptRefs,
|
|
93711
|
-
modules:
|
|
93901
|
+
modules: await readModulesFromDisk(wmPath + getModuleFolderSuffix(lang), opts.defaultTs, folderLayout || lang === "dbt", lang === "dbt")
|
|
93712
93902
|
};
|
|
93713
93903
|
currentLastEdit = edit;
|
|
93714
93904
|
return edit;
|