windmill-cli 1.693.5 → 1.694.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 +84 -29
- package/package.json +1 -1
package/esm/main.js
CHANGED
|
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -13185,7 +13203,7 @@ function sameValueZero(a, b) {
|
|
|
13185
13203
|
}
|
|
13186
13204
|
function equal(a, b) {
|
|
13187
13205
|
const seen = new Map;
|
|
13188
|
-
return function
|
|
13206
|
+
return function compare3(a2, b2) {
|
|
13189
13207
|
if (sameValueZero(a2, b2))
|
|
13190
13208
|
return true;
|
|
13191
13209
|
if (isPrimitive(a2) || isPrimitive(b2))
|
|
@@ -13210,7 +13228,7 @@ function equal(a, b) {
|
|
|
13210
13228
|
throw new TypeError("Cannot compare WeakSet instances");
|
|
13211
13229
|
}
|
|
13212
13230
|
if (a2 instanceof WeakRef) {
|
|
13213
|
-
return
|
|
13231
|
+
return compare3(a2.deref(), b2.deref());
|
|
13214
13232
|
}
|
|
13215
13233
|
if (seen.get(a2) === b2) {
|
|
13216
13234
|
return true;
|
|
@@ -13232,7 +13250,7 @@ function equal(a, b) {
|
|
|
13232
13250
|
return a2.symmetricDifference(b2).size === 0;
|
|
13233
13251
|
}
|
|
13234
13252
|
for (const key of aKeys) {
|
|
13235
|
-
if (!b2.has(key) || !
|
|
13253
|
+
if (!b2.has(key) || !compare3(a2.get(key), b2.get(key))) {
|
|
13236
13254
|
return false;
|
|
13237
13255
|
}
|
|
13238
13256
|
}
|
|
@@ -13241,9 +13259,9 @@ function equal(a, b) {
|
|
|
13241
13259
|
let unmatchedEntries = a2.size;
|
|
13242
13260
|
for (const [aKey, aValue] of a2.entries()) {
|
|
13243
13261
|
for (const [bKey, bValue] of b2.entries()) {
|
|
13244
|
-
if (!
|
|
13262
|
+
if (!compare3(aKey, bKey))
|
|
13245
13263
|
continue;
|
|
13246
|
-
if (aKey === aValue && bKey === bValue ||
|
|
13264
|
+
if (aKey === aValue && bKey === bValue || compare3(aValue, bValue)) {
|
|
13247
13265
|
unmatchedEntries--;
|
|
13248
13266
|
break;
|
|
13249
13267
|
}
|
|
@@ -13263,7 +13281,7 @@ function equal(a, b) {
|
|
|
13263
13281
|
keys = getKeysDeep(a2).union(getKeysDeep(b2));
|
|
13264
13282
|
}
|
|
13265
13283
|
for (const key of keys) {
|
|
13266
|
-
if (!
|
|
13284
|
+
if (!compare3(a2[key], b2[key])) {
|
|
13267
13285
|
return false;
|
|
13268
13286
|
}
|
|
13269
13287
|
if (key in a2 && !(key in b2) || key in b2 && !(key in a2)) {
|
|
@@ -16692,7 +16710,7 @@ var init_OpenAPI = __esm(() => {
|
|
|
16692
16710
|
PASSWORD: undefined,
|
|
16693
16711
|
TOKEN: getEnv3("WM_TOKEN"),
|
|
16694
16712
|
USERNAME: undefined,
|
|
16695
|
-
VERSION: "1.
|
|
16713
|
+
VERSION: "1.694.0",
|
|
16696
16714
|
WITH_CREDENTIALS: true,
|
|
16697
16715
|
interceptors: {
|
|
16698
16716
|
request: new Interceptors,
|
|
@@ -25082,6 +25100,24 @@ async function requireLogin(opts) {
|
|
|
25082
25100
|
throw new Error(`Network error: Could not connect to Windmill server at ${workspace.remote}`);
|
|
25083
25101
|
}
|
|
25084
25102
|
if (opts.token || opts.baseUrl) {
|
|
25103
|
+
const isApiError = error2 && typeof error2 === "object" && "name" in error2 && error2.name === "ApiError";
|
|
25104
|
+
if (isApiError) {
|
|
25105
|
+
const status = error2.status;
|
|
25106
|
+
const body = error2.body;
|
|
25107
|
+
let bodyStr = typeof body === "object" && body !== null ? JSON.stringify(body) : String(body ?? "").trim();
|
|
25108
|
+
bodyStr = bodyStr.replace(/\s*[@(]\w+\.rs:\d+[:\d]*\)?/g, "");
|
|
25109
|
+
bodyStr = bodyStr.replace(/^(Permission denied|Not authorized): /, "");
|
|
25110
|
+
if (status === 403) {
|
|
25111
|
+
info(colors.red(`Permission denied: the token is valid but lacks the required scope.${bodyStr ? `
|
|
25112
|
+
${bodyStr}` : ""}`));
|
|
25113
|
+
} else if (status === 401) {
|
|
25114
|
+
info(colors.red(`Could not authenticate with the provided credentials. Please check your --token and --base-url and try again.${bodyStr ? `
|
|
25115
|
+
${bodyStr}` : ""}`));
|
|
25116
|
+
} else {
|
|
25117
|
+
info(colors.red(`Request failed (${status ?? "unknown"}): ${bodyStr}`));
|
|
25118
|
+
}
|
|
25119
|
+
return process.exit(1);
|
|
25120
|
+
}
|
|
25085
25121
|
info(colors.red("Could not authenticate with the provided credentials. Please check your --token and --base-url and try again."));
|
|
25086
25122
|
return process.exit(1);
|
|
25087
25123
|
}
|
|
@@ -30405,7 +30441,7 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
30405
30441
|
if (!duplex.push(data3))
|
|
30406
30442
|
ws.pause();
|
|
30407
30443
|
});
|
|
30408
|
-
ws.once("error", function
|
|
30444
|
+
ws.once("error", function error2(err) {
|
|
30409
30445
|
if (duplex.destroyed)
|
|
30410
30446
|
return;
|
|
30411
30447
|
terminateOnDestroy = false;
|
|
@@ -30423,7 +30459,7 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
30423
30459
|
return;
|
|
30424
30460
|
}
|
|
30425
30461
|
let called = false;
|
|
30426
|
-
ws.once("error", function
|
|
30462
|
+
ws.once("error", function error2(err2) {
|
|
30427
30463
|
called = true;
|
|
30428
30464
|
callback(err2);
|
|
30429
30465
|
});
|
|
@@ -30437,7 +30473,7 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
30437
30473
|
};
|
|
30438
30474
|
duplex._final = function(callback) {
|
|
30439
30475
|
if (ws.readyState === ws.CONNECTING) {
|
|
30440
|
-
ws.once("open", function
|
|
30476
|
+
ws.once("open", function open2() {
|
|
30441
30477
|
duplex._final(callback);
|
|
30442
30478
|
});
|
|
30443
30479
|
return;
|
|
@@ -30461,7 +30497,7 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
30461
30497
|
};
|
|
30462
30498
|
duplex._write = function(chunk, encoding, callback) {
|
|
30463
30499
|
if (ws.readyState === ws.CONNECTING) {
|
|
30464
|
-
ws.once("open", function
|
|
30500
|
+
ws.once("open", function open2() {
|
|
30465
30501
|
duplex._write(chunk, encoding, callback);
|
|
30466
30502
|
});
|
|
30467
30503
|
return;
|
|
@@ -35512,7 +35548,7 @@ var require_BufferList = __commonJS((exports, module) => {
|
|
|
35512
35548
|
this.tail = null;
|
|
35513
35549
|
this.length = 0;
|
|
35514
35550
|
}
|
|
35515
|
-
BufferList.prototype.push = function
|
|
35551
|
+
BufferList.prototype.push = function push2(v) {
|
|
35516
35552
|
var entry = { data: v, next: null };
|
|
35517
35553
|
if (this.length > 0)
|
|
35518
35554
|
this.tail.next = entry;
|
|
@@ -35543,7 +35579,7 @@ var require_BufferList = __commonJS((exports, module) => {
|
|
|
35543
35579
|
this.head = this.tail = null;
|
|
35544
35580
|
this.length = 0;
|
|
35545
35581
|
};
|
|
35546
|
-
BufferList.prototype.join = function
|
|
35582
|
+
BufferList.prototype.join = function join9(s) {
|
|
35547
35583
|
if (this.length === 0)
|
|
35548
35584
|
return "";
|
|
35549
35585
|
var p = this.head;
|
|
@@ -37478,7 +37514,7 @@ var require_nodejsUtils = __commonJS((exports, module) => {
|
|
|
37478
37514
|
|
|
37479
37515
|
// node_modules/set-immediate-shim/index.js
|
|
37480
37516
|
var require_set_immediate_shim = __commonJS((exports, module) => {
|
|
37481
|
-
module.exports = typeof setImmediate === "function" ? setImmediate : function
|
|
37517
|
+
module.exports = typeof setImmediate === "function" ? setImmediate : function setImmediate2() {
|
|
37482
37518
|
var args = [].slice.apply(arguments);
|
|
37483
37519
|
args.splice(1, 0, 0);
|
|
37484
37520
|
setTimeout.apply(null, args);
|
|
@@ -45833,7 +45869,7 @@ var require_headers = __commonJS((exports) => {
|
|
|
45833
45869
|
}
|
|
45834
45870
|
return result;
|
|
45835
45871
|
};
|
|
45836
|
-
exports.encode = function
|
|
45872
|
+
exports.encode = function encode2(opts) {
|
|
45837
45873
|
const buf = b4a.alloc(512);
|
|
45838
45874
|
let name = opts.name;
|
|
45839
45875
|
let prefix = "";
|
|
@@ -45874,7 +45910,7 @@ var require_headers = __commonJS((exports) => {
|
|
|
45874
45910
|
b4a.write(buf, encodeOct(cksum(buf), 6), 148);
|
|
45875
45911
|
return buf;
|
|
45876
45912
|
};
|
|
45877
|
-
exports.decode = function
|
|
45913
|
+
exports.decode = function decode2(buf, filenameEncoding, allowUnknownFormat) {
|
|
45878
45914
|
let typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET;
|
|
45879
45915
|
let name = decodeStr(buf, 0, 100, filenameEncoding);
|
|
45880
45916
|
const mode = decodeOct(buf, 100, 8);
|
|
@@ -48785,7 +48821,7 @@ var require_subschema = __commonJS((exports) => {
|
|
|
48785
48821
|
|
|
48786
48822
|
// node_modules/fast-deep-equal/index.js
|
|
48787
48823
|
var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
48788
|
-
module.exports = function
|
|
48824
|
+
module.exports = function equal2(a, b) {
|
|
48789
48825
|
if (a === b)
|
|
48790
48826
|
return true;
|
|
48791
48827
|
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
@@ -48797,7 +48833,7 @@ var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
|
48797
48833
|
if (length != b.length)
|
|
48798
48834
|
return false;
|
|
48799
48835
|
for (i = length;i-- !== 0; )
|
|
48800
|
-
if (!
|
|
48836
|
+
if (!equal2(a[i], b[i]))
|
|
48801
48837
|
return false;
|
|
48802
48838
|
return true;
|
|
48803
48839
|
}
|
|
@@ -48816,7 +48852,7 @@ var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
|
48816
48852
|
return false;
|
|
48817
48853
|
for (i = length;i-- !== 0; ) {
|
|
48818
48854
|
var key = keys[i];
|
|
48819
|
-
if (!
|
|
48855
|
+
if (!equal2(a[key], b[key]))
|
|
48820
48856
|
return false;
|
|
48821
48857
|
}
|
|
48822
48858
|
return true;
|
|
@@ -72316,7 +72352,7 @@ async function pushSchedule(workspace, path19, schedule, localSchedule, permissi
|
|
|
72316
72352
|
...preserveFields
|
|
72317
72353
|
}
|
|
72318
72354
|
});
|
|
72319
|
-
if (localSchedule.enabled
|
|
72355
|
+
if (localSchedule.enabled !== undefined && localSchedule.enabled !== schedule.enabled) {
|
|
72320
72356
|
info(colors.bold.yellow(`Schedule ${path19} is ${localSchedule.enabled ? "enabled" : "disabled"} locally but not on remote, updating remote`));
|
|
72321
72357
|
await setScheduleEnabled({
|
|
72322
72358
|
workspace,
|
|
@@ -72351,13 +72387,31 @@ async function enable(opts, path19) {
|
|
|
72351
72387
|
opts = await mergeConfigWithConfigFile(opts);
|
|
72352
72388
|
const workspace = await resolveWorkspace(opts);
|
|
72353
72389
|
await requireLogin(opts);
|
|
72354
|
-
|
|
72355
|
-
|
|
72356
|
-
|
|
72357
|
-
|
|
72358
|
-
|
|
72390
|
+
try {
|
|
72391
|
+
await setScheduleEnabled({
|
|
72392
|
+
workspace: workspace.workspaceId,
|
|
72393
|
+
path: path19,
|
|
72394
|
+
requestBody: { enabled: true, force: opts.force }
|
|
72395
|
+
});
|
|
72396
|
+
} catch (e) {
|
|
72397
|
+
const conflict = parseForkConflict(e);
|
|
72398
|
+
if (conflict) {
|
|
72399
|
+
error(`Cannot enable schedule '${path19}': the parent workspace '${conflict.parentWorkspaceId}' has the same path configured. ` + `Both crons would fire on every tick and the script would run twice per scheduled time.
|
|
72400
|
+
` + `Re-run with --force to enable anyway.`);
|
|
72401
|
+
process.exit(1);
|
|
72402
|
+
}
|
|
72403
|
+
throw e;
|
|
72404
|
+
}
|
|
72359
72405
|
info(colors.green(`Schedule ${path19} enabled.`));
|
|
72360
72406
|
}
|
|
72407
|
+
function parseForkConflict(e) {
|
|
72408
|
+
const body = e?.body;
|
|
72409
|
+
const raw = typeof body === "string" ? body : e?.message ?? "";
|
|
72410
|
+
const m = String(raw).match(/fork-conflict:([^:]+):(.+)/);
|
|
72411
|
+
if (!m)
|
|
72412
|
+
return;
|
|
72413
|
+
return { kind: m[1], parentWorkspaceId: m[2].trim() };
|
|
72414
|
+
}
|
|
72361
72415
|
async function disable(opts, path19) {
|
|
72362
72416
|
opts = await mergeConfigWithConfigFile(opts);
|
|
72363
72417
|
const workspace = await resolveWorkspace(opts);
|
|
@@ -72398,7 +72452,7 @@ var init_schedule = __esm(async () => {
|
|
|
72398
72452
|
init_types()
|
|
72399
72453
|
]);
|
|
72400
72454
|
import_yaml26 = __toESM(require_dist(), 1);
|
|
72401
|
-
command16 = new Command().description("schedule related commands").option("--json", "Output as JSON (for piping to jq)").action(list9).command("list", "list all schedules").option("--json", "Output as JSON (for piping to jq)").action(list9).command("get", "get a schedule's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get7).command("new", "create a new schedule locally").arguments("<path:string>").action(newSchedule).command("push", "push a local schedule spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").action(push8).command("enable", "Enable a schedule").arguments("<path:string>").action(enable).command("disable", "Disable a schedule").arguments("<path:string>").action(disable).command("set-permissioned-as", "Set the email (run-as user) for a schedule (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").action(async (opts, schedulePath, email) => {
|
|
72455
|
+
command16 = new Command().description("schedule related commands").option("--json", "Output as JSON (for piping to jq)").action(list9).command("list", "list all schedules").option("--json", "Output as JSON (for piping to jq)").action(list9).command("get", "get a schedule's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get7).command("new", "create a new schedule locally").arguments("<path:string>").action(newSchedule).command("push", "push a local schedule spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").action(push8).command("enable", "Enable a schedule").option("--force", "Bypass the fork-conflict warning when the parent workspace has the same schedule (acknowledges that both crons will fire)").arguments("<path:string>").action(enable).command("disable", "Disable a schedule").arguments("<path:string>").action(disable).command("set-permissioned-as", "Set the email (run-as user) for a schedule (requires admin or wm_deployers group)").arguments("<path:string> <email:string>").action(async (opts, schedulePath, email) => {
|
|
72402
72456
|
const workspace = await resolveWorkspace(opts);
|
|
72403
72457
|
await requireLogin(opts);
|
|
72404
72458
|
const cache3 = new Map;
|
|
@@ -85544,6 +85598,7 @@ schedule related commands
|
|
|
85544
85598
|
- \`schedule new <path:string>\` - create a new schedule locally
|
|
85545
85599
|
- \`schedule push <file_path:string> <remote_path:string>\` - push a local schedule spec. This overrides any remote versions.
|
|
85546
85600
|
- \`schedule enable <path:string>\` - Enable a schedule
|
|
85601
|
+
- \`--force\` - Bypass the fork-conflict warning when the parent workspace has the same schedule (acknowledges that both crons will fire)
|
|
85547
85602
|
- \`schedule disable <path:string>\` - Disable a schedule
|
|
85548
85603
|
- \`schedule set-permissioned-as <path:string> <email:string>\` - Set the email (run-as user) for a schedule (requires admin or wm_deployers group)
|
|
85549
85604
|
|
|
@@ -88690,7 +88745,7 @@ var config_default = command35;
|
|
|
88690
88745
|
|
|
88691
88746
|
// src/main.ts
|
|
88692
88747
|
await init_context();
|
|
88693
|
-
var VERSION = "1.
|
|
88748
|
+
var VERSION = "1.694.0";
|
|
88694
88749
|
async function checkVersionSafe(cmd) {
|
|
88695
88750
|
const mainCommand = cmd.getMainCommand();
|
|
88696
88751
|
const upgradeCommand = mainCommand.getCommand("upgrade");
|