windmill-cli 1.563.2 → 1.563.4
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/gen/core/OpenAPI.js +1 -1
- package/esm/src/commands/flow/flow.js +1 -1
- package/esm/src/main.js +1 -1
- package/esm/src/utils/metadata.js +29 -9
- package/esm/src/utils/utils.js +27 -0
- package/package.json +1 -1
- package/types/src/main.d.ts +1 -1
- package/types/src/utils/metadata.d.ts +1 -0
- package/types/src/utils/metadata.d.ts.map +1 -1
- package/types/src/utils/utils.d.ts +9 -0
- package/types/src/utils/utils.d.ts.map +1 -1
package/esm/gen/core/OpenAPI.js
CHANGED
|
@@ -171,7 +171,7 @@ async function generateLocks(opts, folder) {
|
|
|
171
171
|
const candidate = await generateFlowLockInternal(folder, true, workspace, opts, undefined, undefined, useRawReqs);
|
|
172
172
|
if (candidate) {
|
|
173
173
|
hasAny = true;
|
|
174
|
-
log.info(colors.
|
|
174
|
+
log.info(colors.yellow.bold(`~ ${candidate}`));
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
if (hasAny) {
|
package/esm/src/main.js
CHANGED
|
@@ -38,7 +38,7 @@ export { flow, app, script, workspace, resource, resourceType, user, variable, h
|
|
|
38
38
|
// console.error(JSON.stringify(event.error, null, 4));
|
|
39
39
|
// }
|
|
40
40
|
// });
|
|
41
|
-
export const VERSION = "1.563.
|
|
41
|
+
export const VERSION = "1.563.4";
|
|
42
42
|
export const WM_FORK_PREFIX = "wm-fork";
|
|
43
43
|
const command = new Command()
|
|
44
44
|
.name("wmill")
|
|
@@ -5,8 +5,8 @@ import { defaultScriptMetadata, } from "../../bootstrap/script_bootstrap.js";
|
|
|
5
5
|
import { languagesWithRawReqsSupport, } from "./script_common.js";
|
|
6
6
|
import { inferContentTypeFromFilePath } from "./script_common.js";
|
|
7
7
|
import { exts, findGlobalDeps } from "../commands/script/script.js";
|
|
8
|
-
import { FSFSElement, findCodebase, yamlOptions } from "../commands/sync/sync.js";
|
|
9
|
-
import { generateHash, readInlinePathSync, getHeaders } from "./utils.js";
|
|
8
|
+
import { FSFSElement, findCodebase, yamlOptions, } from "../commands/sync/sync.js";
|
|
9
|
+
import { generateHash, readInlinePathSync, getHeaders, writeIfChanged, } from "./utils.js";
|
|
10
10
|
import { replaceInlineScripts } from "../../windmill-utils-internal/src/inline-scripts/replacer.js";
|
|
11
11
|
import { extractInlineScripts as extractInlineScriptsForFlows } from "../../windmill-utils-internal/src/inline-scripts/extractor.js";
|
|
12
12
|
import { argSigToJsonSchemaType } from "../../windmill-utils-internal/src/parse/parse-schema.js";
|
|
@@ -110,15 +110,14 @@ export async function generateFlowLockInternal(folder, dryRun, workspace, opts,
|
|
|
110
110
|
//removeChangedLocks
|
|
111
111
|
flowValue.value = await updateFlow(workspace, flowValue.value, remote_path, rawReqs);
|
|
112
112
|
const inlineScripts = extractInlineScriptsForFlows(flowValue.value.modules, {}, SEP, opts.defaultTs);
|
|
113
|
-
inlineScripts
|
|
114
|
-
.
|
|
115
|
-
.forEach((s) => {
|
|
116
|
-
dntShim.Deno.writeTextFileSync(dntShim.Deno.cwd() + SEP + folder + SEP + s.path, s.content);
|
|
113
|
+
inlineScripts.forEach((s) => {
|
|
114
|
+
writeIfChanged(dntShim.Deno.cwd() + SEP + folder + SEP + s.path, s.content);
|
|
117
115
|
});
|
|
118
116
|
// Overwrite `flow.yaml` with the new lockfile references
|
|
119
|
-
|
|
117
|
+
writeIfChanged(dntShim.Deno.cwd() + SEP + folder + SEP + "flow.yaml", yamlStringify(flowValue));
|
|
120
118
|
}
|
|
121
119
|
hashes = await generateFlowHash(rawReqs, folder, opts.defaultTs);
|
|
120
|
+
await clearGlobalLock(folder);
|
|
122
121
|
for (const [path, hash] of Object.entries(hashes)) {
|
|
123
122
|
await updateMetadataGlobalLock(folder, hash, path);
|
|
124
123
|
}
|
|
@@ -443,7 +442,7 @@ export async function inferSchema(language, content, currentSchema, path) {
|
|
|
443
442
|
else if (language === "ruby") {
|
|
444
443
|
const { parse_ruby } = await import("../../wasm/ruby/windmill_parser_wasm.js");
|
|
445
444
|
inferedSchema = JSON.parse(parse_ruby(content));
|
|
446
|
-
// for related places search: ADD_NEW_LANG
|
|
445
|
+
// for related places search: ADD_NEW_LANG
|
|
447
446
|
}
|
|
448
447
|
else {
|
|
449
448
|
throw new Error("Invalid language: " + language);
|
|
@@ -607,6 +606,27 @@ export async function checkifMetadataUptodate(path, hash, conf, subpath) {
|
|
|
607
606
|
export async function generateScriptHash(rawReqs, scriptContent, newMetadataContent) {
|
|
608
607
|
return await generateHash((rawReqs ?? "") + scriptContent + newMetadataContent);
|
|
609
608
|
}
|
|
609
|
+
export async function clearGlobalLock(path) {
|
|
610
|
+
const conf = await readLockfile();
|
|
611
|
+
if (!conf?.locks) {
|
|
612
|
+
conf.locks = {};
|
|
613
|
+
}
|
|
614
|
+
const isV2 = conf?.version == "v2";
|
|
615
|
+
if (isV2) {
|
|
616
|
+
// Remove the specific v2 lock entry
|
|
617
|
+
const key = v2LockPath(path);
|
|
618
|
+
if (conf.locks) {
|
|
619
|
+
Object.keys(conf.locks).forEach((k) => {
|
|
620
|
+
if (conf.locks) {
|
|
621
|
+
if (k.startsWith(key)) {
|
|
622
|
+
delete conf.locks[k];
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
await dntShim.Deno.writeTextFile(WMILL_LOCKFILE, yamlStringify(conf, yamlOptions));
|
|
628
|
+
}
|
|
629
|
+
}
|
|
610
630
|
export async function updateMetadataGlobalLock(path, hash, subpath) {
|
|
611
631
|
const conf = await readLockfile();
|
|
612
632
|
if (!conf?.locks) {
|
|
@@ -614,7 +634,7 @@ export async function updateMetadataGlobalLock(path, hash, subpath) {
|
|
|
614
634
|
}
|
|
615
635
|
const isV2 = conf?.version == "v2";
|
|
616
636
|
if (isV2) {
|
|
617
|
-
conf.locks[v2LockPath(path,
|
|
637
|
+
conf.locks[v2LockPath(path, subpath)] = hash;
|
|
618
638
|
}
|
|
619
639
|
else {
|
|
620
640
|
if (subpath) {
|
package/esm/src/utils/utils.js
CHANGED
|
@@ -175,3 +175,30 @@ export async function getIsWin() {
|
|
|
175
175
|
}
|
|
176
176
|
return isWin;
|
|
177
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Writes content to a file only if it differs from existing content.
|
|
180
|
+
* Creates parent directories if they don't exist.
|
|
181
|
+
*
|
|
182
|
+
* @param path - The file path to write to
|
|
183
|
+
* @param content - The content to write
|
|
184
|
+
* @returns true if file was written, false if skipped (content unchanged)
|
|
185
|
+
*/
|
|
186
|
+
export function writeIfChanged(path, content) {
|
|
187
|
+
try {
|
|
188
|
+
const existing = dntShim.Deno.readTextFileSync(path);
|
|
189
|
+
if (existing === content) {
|
|
190
|
+
// console.log(`Content unchanged for ${path}`);
|
|
191
|
+
return false; // Content unchanged, skip write
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
// File doesn't exist or can't be read, proceed with write
|
|
196
|
+
if (!(error instanceof dntShim.Deno.errors.NotFound)) {
|
|
197
|
+
// If it's not a "not found" error, we might want to know about it
|
|
198
|
+
// but still proceed with the write attempt
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// console.log(`Writing content to ${path}`);
|
|
202
|
+
dntShim.Deno.writeTextFileSync(path, content);
|
|
203
|
+
return true; // File was written
|
|
204
|
+
}
|
package/package.json
CHANGED
package/types/src/main.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { pull as hubPull } from "./commands/hub/hub.js";
|
|
|
22
22
|
import { pull, push } from "./commands/sync/sync.js";
|
|
23
23
|
import { add as workspaceAdd } from "./commands/workspace/workspace.js";
|
|
24
24
|
export { flow, app, script, workspace, resource, resourceType, user, variable, hub, folder, schedule, trigger, sync, gitsyncSettings, instance, dev, hubPull, pull, push, workspaceAdd, };
|
|
25
|
-
export declare const VERSION = "1.563.
|
|
25
|
+
export declare const VERSION = "1.563.4";
|
|
26
26
|
export declare const WM_FORK_PREFIX = "wm-fork";
|
|
27
27
|
declare const command: Command<{
|
|
28
28
|
workspace?: (import("../deps/jsr.io/@windmill-labs/cliffy-command/1.0.0-rc.5/mod.js").StringType & string) | undefined;
|
|
@@ -47,6 +47,7 @@ interface Lock {
|
|
|
47
47
|
export declare function readLockfile(): Promise<Lock>;
|
|
48
48
|
export declare function checkifMetadataUptodate(path: string, hash: string, conf: Lock | undefined, subpath?: string): Promise<boolean>;
|
|
49
49
|
export declare function generateScriptHash(rawReqs: string | undefined, scriptContent: string, newMetadataContent: string): Promise<string>;
|
|
50
|
+
export declare function clearGlobalLock(path: string): Promise<void>;
|
|
50
51
|
export declare function updateMetadataGlobalLock(path: string, hash: string, subpath?: string): Promise<void>;
|
|
51
52
|
export {};
|
|
52
53
|
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/src/utils/metadata.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAa5C,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAGL,cAAc,EACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAwB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/src/utils/metadata.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAa5C,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAGL,cAAc,EACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAwB,MAAM,8BAA8B,CAAC;AAYhF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM7C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC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G,SAAS,EACtB,OAAO,CAAC,EAAE,MAAM,oBAkBjB;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,mBAK3B;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBjE;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|
|
@@ -17,4 +17,13 @@ export interface Repository {
|
|
|
17
17
|
}
|
|
18
18
|
export declare function selectRepository<T extends Repository>(repositories: T[], operation?: string): Promise<T>;
|
|
19
19
|
export declare function getIsWin(): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Writes content to a file only if it differs from existing content.
|
|
22
|
+
* Creates parent directories if they don't exist.
|
|
23
|
+
*
|
|
24
|
+
* @param path - The file path to write to
|
|
25
|
+
* @param content - The content to write
|
|
26
|
+
* @returns true if file was written, false if skipped (content unchanged)
|
|
27
|
+
*/
|
|
28
|
+
export declare function writeIfChanged(path: string, content: string): boolean;
|
|
20
29
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/src/utils/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAO/C,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,CA2EhD;AAED,wBAAgB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAa/D;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,mBAWzD;AAED,wBA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