mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-12 00:06:14 +00:00
+6
-3
@@ -33,7 +33,10 @@ export async function pushApp(
|
||||
if (raw) {
|
||||
// deleting old app if it exists in raw mode
|
||||
try {
|
||||
app = await AppService.getAppByPath({ workspace, path: remotePath });
|
||||
app = await AppService.getAppByPath({
|
||||
workspace,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
});
|
||||
} catch {
|
||||
//ignore
|
||||
}
|
||||
@@ -45,7 +48,7 @@ export async function pushApp(
|
||||
}
|
||||
await AppService.updateApp({
|
||||
workspace,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
requestBody: {
|
||||
...newApp,
|
||||
},
|
||||
@@ -56,7 +59,7 @@ export async function pushApp(
|
||||
await AppService.createApp({
|
||||
workspace,
|
||||
requestBody: {
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
...newApp,
|
||||
},
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// windmill
|
||||
export { setClient } from "https://deno.land/x/windmill@v1.95.1/mod.ts";
|
||||
export * from "https://deno.land/x/windmill@v1.95.1/windmill-api/index.ts";
|
||||
|
||||
export { SEP } from "https://deno.land/std@0.201.0/path/separator.ts";
|
||||
// cliffy
|
||||
export { Command } from "https://deno.land/x/cliffy@v1.0.0-rc.2/command/mod.ts";
|
||||
export { Table } from "https://deno.land/x/cliffy@v1.0.0-rc.2/table/table.ts";
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
// deno-lint-ignore-file no-explicit-any
|
||||
import { GlobalOptions, isSuperset } from "./types.ts";
|
||||
import { log } from "./deps.ts";
|
||||
import { SEP, log } from "./deps.ts";
|
||||
import {
|
||||
colors,
|
||||
Command,
|
||||
@@ -42,8 +42,8 @@ export async function pushFlow(
|
||||
// flow doesn't exist
|
||||
}
|
||||
|
||||
if (!localFlowPath.endsWith("/")) {
|
||||
localFlowPath += "/";
|
||||
if (!localFlowPath.endsWith(SEP)) {
|
||||
localFlowPath += SEP;
|
||||
}
|
||||
const localFlowRaw = await Deno.readTextFile(localFlowPath + "flow.yaml");
|
||||
const localFlow = yamlParse(localFlowRaw) as FlowFile;
|
||||
@@ -74,9 +74,9 @@ export async function pushFlow(
|
||||
log.info(colors.bold.yellow(`Updating flow ${remotePath}...`));
|
||||
await FlowService.updateFlow({
|
||||
workspace: workspace,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
requestBody: {
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
...localFlow,
|
||||
},
|
||||
});
|
||||
@@ -85,7 +85,7 @@ export async function pushFlow(
|
||||
await FlowService.createFlow({
|
||||
workspace: workspace,
|
||||
requestBody: {
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
...localFlow,
|
||||
},
|
||||
});
|
||||
|
||||
+12
-4
@@ -1,5 +1,13 @@
|
||||
// deno-lint-ignore-file no-explicit-any
|
||||
import { colors, Command, Folder, FolderService, log, Table } from "./deps.ts";
|
||||
import {
|
||||
colors,
|
||||
Command,
|
||||
Folder,
|
||||
FolderService,
|
||||
log,
|
||||
SEP,
|
||||
Table,
|
||||
} from "./deps.ts";
|
||||
import { requireLogin, resolveWorkspace, validatePath } from "./context.ts";
|
||||
import { GlobalOptions, isSuperset, parseFromFile } from "./types.ts";
|
||||
|
||||
@@ -38,13 +46,13 @@ export async function pushFolder(
|
||||
localFolder: FolderFile,
|
||||
raw: boolean
|
||||
): Promise<void> {
|
||||
if (name.startsWith("/")) {
|
||||
if (name.startsWith(SEP)) {
|
||||
name = name.substring(1);
|
||||
}
|
||||
if (name.startsWith("f/")) {
|
||||
if (name.startsWith("f" + SEP)) {
|
||||
name = name.substring(2);
|
||||
}
|
||||
name = name.split("/")[0];
|
||||
name = name.split(SEP)[0];
|
||||
log.debug(`Processing local folder ${name}`);
|
||||
|
||||
if (raw) {
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
// deno-lint-ignore-file no-explicit-any
|
||||
import { GlobalOptions } from "./types.ts";
|
||||
import { colors, Command, JSZip } from "./deps.ts";
|
||||
import { colors, Command, JSZip, log } from "./deps.ts";
|
||||
import { Workspace } from "./workspace.ts";
|
||||
import { getHeaders } from "./utils.ts";
|
||||
|
||||
@@ -45,6 +45,8 @@ export async function downloadZip(
|
||||
colors.red("Failed to request tarball from API " + zipResponse.statusText)
|
||||
);
|
||||
throw new Error(await zipResponse.text());
|
||||
} else {
|
||||
log.debug(`Downloaded zip/tarball successfully`);
|
||||
}
|
||||
const blob = await zipResponse.blob();
|
||||
return await JSZip.loadAsync(blob as any);
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ export async function pushResource(
|
||||
try {
|
||||
resource = await ResourceService.getResource({
|
||||
workspace: workspace,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
});
|
||||
} catch {
|
||||
// flow doesn't exist
|
||||
@@ -47,7 +47,7 @@ export async function pushResource(
|
||||
|
||||
await ResourceService.updateResource({
|
||||
workspace: workspace,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
requestBody: { ...localResource },
|
||||
});
|
||||
} else {
|
||||
@@ -63,7 +63,7 @@ export async function pushResource(
|
||||
await ResourceService.createResource({
|
||||
workspace: workspace,
|
||||
requestBody: {
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
...localResource,
|
||||
},
|
||||
});
|
||||
|
||||
+6
-4
@@ -83,7 +83,9 @@ export async function handleFile(
|
||||
log.debug(`Processing local script ${path}`);
|
||||
|
||||
alreadySynced.push(path);
|
||||
const remotePath = path.substring(0, path.indexOf("."));
|
||||
const remotePath = path
|
||||
.substring(0, path.indexOf("."))
|
||||
.replaceAll("\\", "/");
|
||||
const metaPath = remotePath + ".script.json";
|
||||
let typed = undefined;
|
||||
try {
|
||||
@@ -105,7 +107,7 @@ export async function handleFile(
|
||||
try {
|
||||
remote = await ScriptService.getScriptByPath({
|
||||
workspace,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
});
|
||||
log.debug(`Script ${remotePath} exists on remote`);
|
||||
} catch {
|
||||
@@ -142,7 +144,7 @@ export async function handleFile(
|
||||
content,
|
||||
description: typed?.description ?? "",
|
||||
language: language as NewScript.language,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
summary: typed?.summary ?? "",
|
||||
is_template: typed?.is_template,
|
||||
kind: typed?.kind,
|
||||
@@ -162,7 +164,7 @@ export async function handleFile(
|
||||
content,
|
||||
description: typed?.description ?? "",
|
||||
language: language as NewScript.language,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
summary: typed?.summary ?? "",
|
||||
is_template: typed?.is_template,
|
||||
kind: typed?.kind,
|
||||
|
||||
+15
-6
@@ -20,6 +20,7 @@ import {
|
||||
yamlStringify,
|
||||
yamlParse,
|
||||
ScheduleService,
|
||||
SEP,
|
||||
} from "./deps.ts";
|
||||
import {
|
||||
getTypeStrFromPath,
|
||||
@@ -237,7 +238,7 @@ function ZipFSElement(zip: JSZip, useYaml: boolean): DynFSElement {
|
||||
},
|
||||
};
|
||||
}
|
||||
return _internal_folder("./", zip);
|
||||
return _internal_folder("." + SEP, zip);
|
||||
}
|
||||
|
||||
async function* readDirRecursiveWithIgnore(
|
||||
@@ -353,19 +354,27 @@ async function compareDynFSElement(
|
||||
}
|
||||
|
||||
const isNotWmillFile = (p: string, isDirectory: boolean) => {
|
||||
if (p.endsWith("/")) {
|
||||
if (p.endsWith(SEP)) {
|
||||
return false;
|
||||
}
|
||||
if (isDirectory) {
|
||||
return !p.startsWith("u/") && !p.startsWith("f/") && !p.startsWith("g/");
|
||||
return (
|
||||
!p.startsWith("u" + SEP) &&
|
||||
!p.startsWith("f" + SEP) &&
|
||||
!p.startsWith("g" + SEP)
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const typ = getTypeStrFromPath(p);
|
||||
if (typ == "resource-type") {
|
||||
return p.includes("/");
|
||||
return p.includes(SEP);
|
||||
} else {
|
||||
return !p.startsWith("u/") && !p.startsWith("f/") && !p.startsWith("g/");
|
||||
return (
|
||||
!p.startsWith("u" + SEP) &&
|
||||
!p.startsWith("f" + SEP) &&
|
||||
!p.startsWith("g" + SEP)
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
return true;
|
||||
@@ -373,7 +382,7 @@ const isNotWmillFile = (p: string, isDirectory: boolean) => {
|
||||
};
|
||||
|
||||
export const isWhitelisted = (p: string) => {
|
||||
return p == "./" || p == "" || p == "u" || p == "f" || p == "g";
|
||||
return p == "." + SEP || p == "" || p == "u" || p == "f" || p == "g";
|
||||
};
|
||||
export async function ignoreF() {
|
||||
try {
|
||||
|
||||
+3
-3
@@ -62,7 +62,7 @@ export async function pushVariable(
|
||||
try {
|
||||
variable = await VariableService.getVariable({
|
||||
workspace: workspace,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
decryptSecret: plainSecrets,
|
||||
});
|
||||
log.debug(`Variable ${remotePath} exists on remote`);
|
||||
@@ -80,7 +80,7 @@ export async function pushVariable(
|
||||
|
||||
await VariableService.updateVariable({
|
||||
workspace,
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
alreadyEncrypted: !plainSecrets,
|
||||
requestBody: {
|
||||
...localVariable,
|
||||
@@ -94,7 +94,7 @@ export async function pushVariable(
|
||||
workspace,
|
||||
alreadyEncrypted: !plainSecrets,
|
||||
requestBody: {
|
||||
path: remotePath,
|
||||
path: remotePath.replaceAll("\\", "/"),
|
||||
...localVariable,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user