windmill-cli 1.416.2 → 1.417.2
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/instance.js +27 -17
- package/esm/main.js +1 -1
- package/esm/settings.js +41 -23
- package/esm/user.js +36 -18
- package/esm/worker_groups.js +4 -4
- package/package.json +1 -1
- package/types/instance.d.ts +1 -0
- package/types/instance.d.ts.map +1 -1
- package/types/main.d.ts +1 -1
- package/types/settings.d.ts +7 -6
- package/types/settings.d.ts.map +1 -1
- package/types/user.d.ts +7 -6
- package/types/user.d.ts.map +1 -1
package/esm/gen/core/OpenAPI.js
CHANGED
package/esm/instance.js
CHANGED
|
@@ -166,23 +166,25 @@ async function instancePull(opts) {
|
|
|
166
166
|
const instance = await pickInstance(opts, true);
|
|
167
167
|
log.info("Pulling instance-level changes");
|
|
168
168
|
log.info(`remote (${instance.name}) -> local`);
|
|
169
|
+
opts.prefix = opts.prefix ?? instance.prefix;
|
|
169
170
|
let uChanges = 0;
|
|
170
171
|
if (!opts.skipUsers) {
|
|
171
|
-
uChanges = (await pullInstanceUsers(true));
|
|
172
|
+
uChanges = (await pullInstanceUsers(opts, true));
|
|
172
173
|
}
|
|
173
174
|
let sChanges = 0;
|
|
174
175
|
if (!opts.skipSettings) {
|
|
175
|
-
sChanges = (await pullInstanceSettings(true));
|
|
176
|
+
sChanges = (await pullInstanceSettings(opts, true));
|
|
176
177
|
}
|
|
177
178
|
let cChanges = 0;
|
|
178
179
|
if (!opts.skipConfigs) {
|
|
179
|
-
cChanges = (await pullInstanceConfigs(true));
|
|
180
|
+
cChanges = (await pullInstanceConfigs(opts, true));
|
|
180
181
|
}
|
|
181
182
|
let gChanges = 0;
|
|
182
183
|
if (!opts.skipGroups) {
|
|
183
|
-
gChanges = (await pullInstanceGroups(true));
|
|
184
|
+
gChanges = (await pullInstanceGroups(opts, true));
|
|
184
185
|
}
|
|
185
186
|
const totalChanges = uChanges + sChanges + cChanges + gChanges;
|
|
187
|
+
const rootDir = dntShim.Deno.cwd();
|
|
186
188
|
if (totalChanges > 0) {
|
|
187
189
|
let confirm = true;
|
|
188
190
|
if (opts.yes !== true) {
|
|
@@ -192,17 +194,24 @@ async function instancePull(opts) {
|
|
|
192
194
|
});
|
|
193
195
|
}
|
|
194
196
|
if (confirm) {
|
|
197
|
+
if (uChanges > 0) {
|
|
198
|
+
if (opts.folderPerInstance && opts.prefixSettings) {
|
|
199
|
+
await dntShim.Deno.mkdir(path.join(rootDir, opts.prefix), {
|
|
200
|
+
recursive: true,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
195
204
|
if (!opts.skipUsers && uChanges > 0) {
|
|
196
|
-
await pullInstanceUsers();
|
|
205
|
+
await pullInstanceUsers(opts);
|
|
197
206
|
}
|
|
198
207
|
if (!opts.skipSettings && sChanges > 0) {
|
|
199
|
-
await pullInstanceSettings();
|
|
208
|
+
await pullInstanceSettings(opts);
|
|
200
209
|
}
|
|
201
210
|
if (!opts.skipConfigs && cChanges > 0) {
|
|
202
|
-
await pullInstanceConfigs();
|
|
211
|
+
await pullInstanceConfigs(opts);
|
|
203
212
|
}
|
|
204
213
|
if (!opts.skipGroups && gChanges > 0) {
|
|
205
|
-
await pullInstanceGroups();
|
|
214
|
+
await pullInstanceGroups(opts);
|
|
206
215
|
}
|
|
207
216
|
}
|
|
208
217
|
}
|
|
@@ -211,7 +220,6 @@ async function instancePull(opts) {
|
|
|
211
220
|
}
|
|
212
221
|
if (opts.includeWorkspaces) {
|
|
213
222
|
log.info("\nPulling all workspaces");
|
|
214
|
-
const rootDir = dntShim.Deno.cwd();
|
|
215
223
|
const localWorkspaces = await getLocalWorkspaces(rootDir, instance.prefix, opts.folderPerInstance);
|
|
216
224
|
const previousActiveWorkspace = await getActiveWorkspace(undefined);
|
|
217
225
|
const remoteWorkspaces = await wmill.listWorkspacesAsSuperAdmin({
|
|
@@ -278,19 +286,19 @@ async function instancePush(opts) {
|
|
|
278
286
|
log.info(`remote (${instance.name}) <- local`);
|
|
279
287
|
let uChanges = 0;
|
|
280
288
|
if (!opts.skipUsers) {
|
|
281
|
-
uChanges = (await pushInstanceUsers(true));
|
|
289
|
+
uChanges = (await pushInstanceUsers(opts, true));
|
|
282
290
|
}
|
|
283
291
|
let sChanges = 0;
|
|
284
292
|
if (!opts.skipSettings) {
|
|
285
|
-
sChanges = (await pushInstanceSettings(
|
|
293
|
+
sChanges = (await pushInstanceSettings(opts, true));
|
|
286
294
|
}
|
|
287
295
|
let cChanges = 0;
|
|
288
296
|
if (!opts.skipConfigs) {
|
|
289
|
-
cChanges = (await pushInstanceConfigs(true));
|
|
297
|
+
cChanges = (await pushInstanceConfigs(opts, true));
|
|
290
298
|
}
|
|
291
299
|
let gChanges = 0;
|
|
292
300
|
if (!opts.skipGroups) {
|
|
293
|
-
gChanges = (await pushInstanceGroups(true));
|
|
301
|
+
gChanges = (await pushInstanceGroups(opts, true));
|
|
294
302
|
}
|
|
295
303
|
const totalChanges = uChanges + sChanges + cChanges + gChanges;
|
|
296
304
|
if (totalChanges > 0) {
|
|
@@ -303,16 +311,16 @@ async function instancePush(opts) {
|
|
|
303
311
|
}
|
|
304
312
|
if (confirm) {
|
|
305
313
|
if (!opts.skipUsers && uChanges > 0) {
|
|
306
|
-
await pushInstanceUsers();
|
|
314
|
+
await pushInstanceUsers(opts);
|
|
307
315
|
}
|
|
308
316
|
if (!opts.skipSettings && sChanges > 0) {
|
|
309
|
-
await pushInstanceSettings(
|
|
317
|
+
await pushInstanceSettings(opts);
|
|
310
318
|
}
|
|
311
319
|
if (!opts.skipConfigs && cChanges > 0) {
|
|
312
|
-
await pushInstanceConfigs();
|
|
320
|
+
await pushInstanceConfigs(opts);
|
|
313
321
|
}
|
|
314
322
|
if (!opts.skipGroups && gChanges > 0) {
|
|
315
|
-
await pushInstanceGroups();
|
|
323
|
+
await pushInstanceGroups(opts);
|
|
316
324
|
}
|
|
317
325
|
}
|
|
318
326
|
}
|
|
@@ -525,6 +533,7 @@ const command = new Command()
|
|
|
525
533
|
.option("--folder-per-instance", "Create a folder per instance")
|
|
526
534
|
.option("--instance <instance:string>", "Name of the instance to pull from, override the active instance")
|
|
527
535
|
.option("--prefix <prefix:string>", "Prefix of the local workspaces to pull, used to create the folders when using --include-workspaces")
|
|
536
|
+
.option("--prefix-settings", "Store instance yamls inside prefixed folders when using --prefix and --folder-per-instance")
|
|
528
537
|
.action(instancePull)
|
|
529
538
|
.command("push")
|
|
530
539
|
.description("Push instance settings, users, configs, group and overwrite remote")
|
|
@@ -537,6 +546,7 @@ const command = new Command()
|
|
|
537
546
|
.option("--folder-per-instance", "Create a folder per instance")
|
|
538
547
|
.option("--instance <instance:string>", "Name of the instance to push to, override the active instance")
|
|
539
548
|
.option("--prefix <prefix:string>", "Prefix of the local workspaces folders to push")
|
|
549
|
+
.option("--prefix-settings", "Store instance yamls inside prefixed folders when using --prefix and --folder-per-instance")
|
|
540
550
|
.action(instancePush)
|
|
541
551
|
.command("whoami")
|
|
542
552
|
.description("Display information about the currently logged-in user")
|
package/esm/main.js
CHANGED
|
@@ -33,7 +33,7 @@ export { flow, app, script, workspace, resource, user, variable, hub, folder, sc
|
|
|
33
33
|
// console.error(JSON.stringify(event.error, null, 4));
|
|
34
34
|
// }
|
|
35
35
|
// });
|
|
36
|
-
export const VERSION = "1.
|
|
36
|
+
export const VERSION = "1.417.2";
|
|
37
37
|
const command = new Command()
|
|
38
38
|
.name("wmill")
|
|
39
39
|
.action(() => log.info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`))
|
package/esm/settings.js
CHANGED
|
@@ -10,6 +10,20 @@ import { deepEqual } from "./utils.js";
|
|
|
10
10
|
import * as wmill from "./gen/services.gen.js";
|
|
11
11
|
import { removeWorkerPrefix } from "./worker_groups.js";
|
|
12
12
|
import process from "node:process";
|
|
13
|
+
const INSTANCE_SETTINGS_PATH = "instance_settings.yaml";
|
|
14
|
+
let instanceSettingsPath = INSTANCE_SETTINGS_PATH;
|
|
15
|
+
async function checkInstanceSettingsPath(opts) {
|
|
16
|
+
if (opts.prefix && opts.folderPerInstance && opts.prefixSettings) {
|
|
17
|
+
instanceSettingsPath = `${opts.prefix}/${INSTANCE_SETTINGS_PATH}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const INSTANCE_CONFIGS_PATH = "instance_configs.yaml";
|
|
21
|
+
let instanceConfigsPath = INSTANCE_CONFIGS_PATH;
|
|
22
|
+
async function checkInstanceConfigPath(opts) {
|
|
23
|
+
if (opts.prefix && opts.folderPerInstance && opts.prefixSettings) {
|
|
24
|
+
instanceConfigsPath = `${opts.prefix}/${INSTANCE_CONFIGS_PATH}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
13
27
|
export async function pushWorkspaceSettings(workspace, _path, settings, localSettings) {
|
|
14
28
|
try {
|
|
15
29
|
const remoteSettings = await wmill.getSettings({
|
|
@@ -203,14 +217,14 @@ export async function pushWorkspaceKey(workspace, _path, key, localKey) {
|
|
|
203
217
|
log.debug(`Workspace encryption key is up to date`);
|
|
204
218
|
}
|
|
205
219
|
}
|
|
206
|
-
|
|
207
|
-
export async function readInstanceSettings() {
|
|
220
|
+
export async function readInstanceSettings(opts) {
|
|
208
221
|
let localSettings = [];
|
|
222
|
+
await checkInstanceSettingsPath(opts);
|
|
209
223
|
try {
|
|
210
|
-
localSettings = (await yamlParseFile(
|
|
224
|
+
localSettings = (await yamlParseFile(instanceSettingsPath));
|
|
211
225
|
}
|
|
212
226
|
catch {
|
|
213
|
-
log.warn(`No ${
|
|
227
|
+
log.warn(`No ${instanceSettingsPath} found`);
|
|
214
228
|
}
|
|
215
229
|
return localSettings;
|
|
216
230
|
}
|
|
@@ -222,7 +236,7 @@ async function processInstanceSettings(settings, mode) {
|
|
|
222
236
|
const res = [];
|
|
223
237
|
for (const s of settings) {
|
|
224
238
|
if (SENSITIVE_FIELD.includes(s.name) && typeof s.value === "string") {
|
|
225
|
-
res.push(await processField(s, "value", encKey, mode));
|
|
239
|
+
res.push((await processField(s, "value", encKey, mode)));
|
|
226
240
|
}
|
|
227
241
|
else if (s.name == "oauths") {
|
|
228
242
|
if (typeof s.value === "object") {
|
|
@@ -251,33 +265,36 @@ async function processInstanceSettings(settings, mode) {
|
|
|
251
265
|
async function processField(obj, field, encKey, mode) {
|
|
252
266
|
return {
|
|
253
267
|
...obj,
|
|
254
|
-
[field]: mode === "encode"
|
|
268
|
+
[field]: mode === "encode"
|
|
269
|
+
? await encrypt(obj[field], encKey)
|
|
270
|
+
: (await decrypt(obj[field], encKey)),
|
|
255
271
|
};
|
|
256
272
|
}
|
|
257
|
-
export async function pullInstanceSettings(preview = false) {
|
|
273
|
+
export async function pullInstanceSettings(opts, preview = false) {
|
|
258
274
|
const remoteSettings = await wmill.listGlobalSettings();
|
|
275
|
+
await checkInstanceSettingsPath(opts);
|
|
259
276
|
if (preview) {
|
|
260
|
-
const localSettings = await readInstanceSettings();
|
|
277
|
+
const localSettings = await readInstanceSettings(opts);
|
|
261
278
|
const processedSettings = await processInstanceSettings(remoteSettings, "encode");
|
|
262
279
|
return compareInstanceObjects(processedSettings, localSettings, "name", "setting");
|
|
263
280
|
}
|
|
264
281
|
else {
|
|
265
282
|
log.info("Pulling settings from instance");
|
|
266
283
|
const processedSettings = await processInstanceSettings(remoteSettings, "encode");
|
|
267
|
-
await dntShim.Deno.writeTextFile(
|
|
268
|
-
log.info(colors.green(`Settings written to ${
|
|
284
|
+
await dntShim.Deno.writeTextFile(instanceSettingsPath, yamlStringify(processedSettings));
|
|
285
|
+
log.info(colors.green(`Settings written to ${instanceSettingsPath}`));
|
|
269
286
|
}
|
|
270
287
|
}
|
|
271
|
-
export async function pushInstanceSettings(preview = false
|
|
288
|
+
export async function pushInstanceSettings(opts, preview = false) {
|
|
272
289
|
const remoteSettings = await wmill.listGlobalSettings();
|
|
273
|
-
let localSettings = await readInstanceSettings();
|
|
290
|
+
let localSettings = await readInstanceSettings(opts);
|
|
274
291
|
localSettings = await processInstanceSettings(localSettings, "decode");
|
|
275
|
-
if (baseUrl) {
|
|
292
|
+
if (opts.baseUrl) {
|
|
276
293
|
localSettings = localSettings.filter((s) => s.name !== "base_url");
|
|
277
294
|
localSettings.push({
|
|
278
295
|
name: "base_url",
|
|
279
296
|
//@ts-ignore
|
|
280
|
-
value: baseUrl,
|
|
297
|
+
value: opts.baseUrl,
|
|
281
298
|
});
|
|
282
299
|
}
|
|
283
300
|
if (preview) {
|
|
@@ -320,17 +337,18 @@ export async function pushInstanceSettings(preview = false, baseUrl) {
|
|
|
320
337
|
log.info(colors.green("Settings pushed to instance"));
|
|
321
338
|
}
|
|
322
339
|
}
|
|
323
|
-
export async function readLocalConfigs() {
|
|
340
|
+
export async function readLocalConfigs(opts) {
|
|
324
341
|
let localConfigs = [];
|
|
342
|
+
await checkInstanceConfigPath(opts);
|
|
325
343
|
try {
|
|
326
|
-
localConfigs = (await yamlParseFile(
|
|
344
|
+
localConfigs = (await yamlParseFile(instanceConfigsPath));
|
|
327
345
|
}
|
|
328
346
|
catch {
|
|
329
|
-
log.warn(
|
|
347
|
+
log.warn(`No ${instanceConfigsPath} found`);
|
|
330
348
|
}
|
|
331
349
|
return localConfigs;
|
|
332
350
|
}
|
|
333
|
-
export async function pullInstanceConfigs(preview = false) {
|
|
351
|
+
export async function pullInstanceConfigs(opts, preview = false) {
|
|
334
352
|
const remoteConfigs = (await wmill.listConfigs()).map((x) => {
|
|
335
353
|
return {
|
|
336
354
|
...x,
|
|
@@ -338,23 +356,23 @@ export async function pullInstanceConfigs(preview = false) {
|
|
|
338
356
|
};
|
|
339
357
|
});
|
|
340
358
|
if (preview) {
|
|
341
|
-
const localConfigs = await readLocalConfigs();
|
|
359
|
+
const localConfigs = await readLocalConfigs(opts);
|
|
342
360
|
return compareInstanceObjects(remoteConfigs, localConfigs, "name", "config");
|
|
343
361
|
}
|
|
344
362
|
else {
|
|
345
363
|
log.info("Pulling configs from instance");
|
|
346
|
-
await dntShim.Deno.writeTextFile(
|
|
347
|
-
log.info(colors.green(
|
|
364
|
+
await dntShim.Deno.writeTextFile(instanceConfigsPath, yamlStringify(remoteConfigs));
|
|
365
|
+
log.info(colors.green(`Configs written to ${instanceConfigsPath}`));
|
|
348
366
|
}
|
|
349
367
|
}
|
|
350
|
-
export async function pushInstanceConfigs(preview = false) {
|
|
368
|
+
export async function pushInstanceConfigs(opts, preview = false) {
|
|
351
369
|
const remoteConfigs = (await wmill.listConfigs()).map((x) => {
|
|
352
370
|
return {
|
|
353
371
|
...x,
|
|
354
372
|
name: removeWorkerPrefix(x.name),
|
|
355
373
|
};
|
|
356
374
|
});
|
|
357
|
-
const localConfigs = await readLocalConfigs();
|
|
375
|
+
const localConfigs = await readLocalConfigs(opts);
|
|
358
376
|
if (preview) {
|
|
359
377
|
return compareInstanceObjects(localConfigs, remoteConfigs, "name", "config");
|
|
360
378
|
}
|
package/esm/user.js
CHANGED
|
@@ -5,6 +5,20 @@ import { isSuperset, removeType, removePathPrefix, } from "./types.js";
|
|
|
5
5
|
import { compareInstanceObjects } from "./instance.js";
|
|
6
6
|
import { colors, Command, log, Table, yamlStringify, yamlParseFile, } from "./deps.js";
|
|
7
7
|
import * as wmill from "./gen/services.gen.js";
|
|
8
|
+
const INSTANCE_USERS_PATH = "instance_users.yaml";
|
|
9
|
+
let instanceUsersPath = INSTANCE_USERS_PATH;
|
|
10
|
+
function checkInstanceUsersPath(opts) {
|
|
11
|
+
if (opts.prefix && opts.folderPerInstance && opts.prefixSettings) {
|
|
12
|
+
instanceUsersPath = `${opts.prefix}/${INSTANCE_USERS_PATH}`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const INSTANCE_GROUPS_PATH = "instance_groups.yaml";
|
|
16
|
+
let instanceGroupsPath = INSTANCE_GROUPS_PATH;
|
|
17
|
+
function checkInstanceGroupsPath(opts) {
|
|
18
|
+
if (opts.prefix && opts.folderPerInstance && opts.prefixSettings) {
|
|
19
|
+
instanceGroupsPath = `${opts.prefix}/${INSTANCE_GROUPS_PATH}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
8
22
|
async function list(opts) {
|
|
9
23
|
await requireLogin(opts);
|
|
10
24
|
const perPage = 10;
|
|
@@ -314,41 +328,44 @@ export async function pushGroup(workspace, path, group, localGroup) {
|
|
|
314
328
|
}
|
|
315
329
|
}
|
|
316
330
|
}
|
|
317
|
-
export async function pullInstanceUsers(preview = false) {
|
|
331
|
+
export async function pullInstanceUsers(opts, preview = false) {
|
|
318
332
|
const remoteUsers = await wmill.globalUsersExport();
|
|
333
|
+
checkInstanceUsersPath(opts);
|
|
319
334
|
if (preview) {
|
|
320
|
-
const localUsers = await readInstanceUsers();
|
|
335
|
+
const localUsers = await readInstanceUsers(opts);
|
|
321
336
|
return compareInstanceObjects(remoteUsers, localUsers, "email", "user");
|
|
322
337
|
}
|
|
323
338
|
else {
|
|
324
339
|
log.info("Pulling users from instance...");
|
|
325
|
-
await dntShim.Deno.writeTextFile(
|
|
326
|
-
log.info(colors.green(
|
|
340
|
+
await dntShim.Deno.writeTextFile(instanceUsersPath, yamlStringify(remoteUsers));
|
|
341
|
+
log.info(colors.green(`Users written to ${instanceUsersPath}`));
|
|
327
342
|
}
|
|
328
343
|
}
|
|
329
|
-
export async function readInstanceUsers() {
|
|
344
|
+
export async function readInstanceUsers(opts) {
|
|
330
345
|
let localUsers = [];
|
|
346
|
+
await checkInstanceUsersPath(opts);
|
|
331
347
|
try {
|
|
332
|
-
localUsers = (await yamlParseFile(
|
|
348
|
+
localUsers = (await yamlParseFile(instanceUsersPath));
|
|
333
349
|
}
|
|
334
350
|
catch {
|
|
335
|
-
log.warn(
|
|
351
|
+
log.warn(`No ${instanceUsersPath} file found`);
|
|
336
352
|
}
|
|
337
353
|
return localUsers;
|
|
338
354
|
}
|
|
339
|
-
export async function readInstanceGroups() {
|
|
355
|
+
export async function readInstanceGroups(opts) {
|
|
340
356
|
let localGroups = [];
|
|
357
|
+
checkInstanceGroupsPath(opts);
|
|
341
358
|
try {
|
|
342
|
-
localGroups = (await yamlParseFile(
|
|
359
|
+
localGroups = (await yamlParseFile(instanceGroupsPath));
|
|
343
360
|
}
|
|
344
361
|
catch {
|
|
345
|
-
log.warn(
|
|
362
|
+
log.warn(`No ${instanceGroupsPath} file found`);
|
|
346
363
|
}
|
|
347
364
|
return localGroups;
|
|
348
365
|
}
|
|
349
|
-
export async function pushInstanceUsers(preview = false) {
|
|
366
|
+
export async function pushInstanceUsers(opts, preview = false) {
|
|
350
367
|
const remoteUsers = await wmill.globalUsersExport();
|
|
351
|
-
const localUsers = await readInstanceUsers();
|
|
368
|
+
const localUsers = await readInstanceUsers(opts);
|
|
352
369
|
if (preview) {
|
|
353
370
|
return compareInstanceObjects(localUsers, remoteUsers, "email", "user");
|
|
354
371
|
}
|
|
@@ -360,21 +377,22 @@ export async function pushInstanceUsers(preview = false) {
|
|
|
360
377
|
log.info(colors.green("Users pushed to the instance"));
|
|
361
378
|
}
|
|
362
379
|
}
|
|
363
|
-
export async function pullInstanceGroups(preview = false) {
|
|
380
|
+
export async function pullInstanceGroups(opts, preview = false) {
|
|
364
381
|
const remoteGroups = await wmill.exportInstanceGroups();
|
|
382
|
+
checkInstanceGroupsPath(opts);
|
|
365
383
|
if (preview) {
|
|
366
|
-
const localGroups = await readInstanceGroups();
|
|
384
|
+
const localGroups = await readInstanceGroups(opts);
|
|
367
385
|
return compareInstanceObjects(remoteGroups, localGroups, "name", "group");
|
|
368
386
|
}
|
|
369
387
|
else {
|
|
370
388
|
log.info("Pulling groups from instance...");
|
|
371
|
-
await dntShim.Deno.writeTextFile(
|
|
372
|
-
log.info(colors.green(
|
|
389
|
+
await dntShim.Deno.writeTextFile(instanceGroupsPath, yamlStringify(remoteGroups));
|
|
390
|
+
log.info(colors.green(`Groups written to ${instanceGroupsPath}`));
|
|
373
391
|
}
|
|
374
392
|
}
|
|
375
|
-
export async function pushInstanceGroups(preview = false) {
|
|
393
|
+
export async function pushInstanceGroups(opts, preview = false) {
|
|
376
394
|
const remoteGroups = await wmill.exportInstanceGroups();
|
|
377
|
-
const localGroups = await readInstanceGroups();
|
|
395
|
+
const localGroups = await readInstanceGroups(opts);
|
|
378
396
|
if (preview) {
|
|
379
397
|
return compareInstanceObjects(localGroups, remoteGroups, "name", "group");
|
|
380
398
|
}
|
package/esm/worker_groups.js
CHANGED
|
@@ -44,7 +44,7 @@ export async function displayWorkerGroups(opts) {
|
|
|
44
44
|
}
|
|
45
45
|
async function pullWorkerGroups(opts) {
|
|
46
46
|
await pickInstance(opts, true);
|
|
47
|
-
const totalChanges = await pullInstanceConfigs(true) ?? 0;
|
|
47
|
+
const totalChanges = await pullInstanceConfigs(opts, true) ?? 0;
|
|
48
48
|
if (totalChanges === 0) {
|
|
49
49
|
log.info("No changes to apply");
|
|
50
50
|
return;
|
|
@@ -57,12 +57,12 @@ async function pullWorkerGroups(opts) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
if (confirm) {
|
|
60
|
-
await pullInstanceConfigs(false);
|
|
60
|
+
await pullInstanceConfigs(opts, false);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
async function pushWorkerGroups(opts) {
|
|
64
64
|
await pickInstance(opts, true);
|
|
65
|
-
const totalChanges = await pushInstanceConfigs(true) ?? 0;
|
|
65
|
+
const totalChanges = await pushInstanceConfigs(opts, true) ?? 0;
|
|
66
66
|
if (totalChanges === 0) {
|
|
67
67
|
log.info("No changes to apply");
|
|
68
68
|
return;
|
|
@@ -75,7 +75,7 @@ async function pushWorkerGroups(opts) {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
if (confirm) {
|
|
78
|
-
await pushInstanceConfigs(false);
|
|
78
|
+
await pushInstanceConfigs(opts, false);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
const command = new Command()
|
package/package.json
CHANGED
package/types/instance.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export type InstanceSyncOptions = {
|
|
|
28
28
|
folderPerInstance?: boolean;
|
|
29
29
|
yes?: boolean;
|
|
30
30
|
prefix?: string;
|
|
31
|
+
prefixSettings?: boolean;
|
|
31
32
|
};
|
|
32
33
|
export declare function pickInstance(opts: InstanceSyncOptions, allowNew: boolean): Promise<Instance>;
|
|
33
34
|
export declare function getActiveInstance(opts: {
|
package/types/instance.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../src/instance.ts"],"names":[],"mappings":"AACA,OAAO,EAML,OAAO,EAGR,MAAM,WAAW,CAAC;AAgCnB,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAiBxD;AACD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,EAAE,EACR,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,KAAK,EAAE,MAAM,GAAG,SAAS;;;;;GA2C1B;AA4BD,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI;KACpC,CAAC,IAAI,CAAC,GAAG,MAAM;CACjB,CAAC;AACF,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EACrD,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,EAC/B,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,EAC7B,MAAM,EAAE,CAAC,EACT,UAAU,EAAE,MAAM,UAwBnB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EA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EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAsB,YAAY,CAChC,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,OAAO,qBAuElB;AAqWD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS9B;AAgBD,QAAA,MAAM,OAAO;;;;;;oBA0GW,CAAC;AAEzB,eAAe,OAAO,CAAC"}
|
package/types/main.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { pull as hubPull } from "./hub.js";
|
|
|
19
19
|
import { pull, push } from "./sync.js";
|
|
20
20
|
import { add as workspaceAdd } from "./workspace.js";
|
|
21
21
|
export { flow, app, script, workspace, resource, user, variable, hub, folder, schedule, sync, instance, dev, hubPull, pull, push, workspaceAdd, };
|
|
22
|
-
export declare const VERSION = "1.
|
|
22
|
+
export declare const VERSION = "1.417.2";
|
|
23
23
|
declare const command: Command<{
|
|
24
24
|
workspace?: (import("./deps/jsr.io/@windmill-labs/cliffy-command/1.0.0-rc.5/mod.js").StringType & string) | undefined;
|
|
25
25
|
} & {
|
package/types/settings.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InstanceSyncOptions } from "./instance.js";
|
|
1
2
|
import { Config, GlobalSetting } from "./gen/types.gen.js";
|
|
2
3
|
export interface SimplifiedSettings {
|
|
3
4
|
auto_invite_enabled: boolean;
|
|
@@ -18,10 +19,10 @@ export interface SimplifiedSettings {
|
|
|
18
19
|
}
|
|
19
20
|
export declare function pushWorkspaceSettings(workspace: string, _path: string, settings: SimplifiedSettings | undefined, localSettings: SimplifiedSettings): Promise<void>;
|
|
20
21
|
export declare function pushWorkspaceKey(workspace: string, _path: string, key: string | undefined, localKey: string): Promise<void>;
|
|
21
|
-
export declare function readInstanceSettings(): Promise<GlobalSetting[]>;
|
|
22
|
-
export declare function pullInstanceSettings(preview?: boolean): Promise<number | undefined>;
|
|
23
|
-
export declare function pushInstanceSettings(
|
|
24
|
-
export declare function readLocalConfigs(): Promise<Config[]>;
|
|
25
|
-
export declare function pullInstanceConfigs(preview?: boolean): Promise<number | undefined>;
|
|
26
|
-
export declare function pushInstanceConfigs(preview?: boolean): Promise<number | undefined>;
|
|
22
|
+
export declare function readInstanceSettings(opts: InstanceSyncOptions): Promise<GlobalSetting[]>;
|
|
23
|
+
export declare function pullInstanceSettings(opts: InstanceSyncOptions, preview?: boolean): Promise<number | undefined>;
|
|
24
|
+
export declare function pushInstanceSettings(opts: InstanceSyncOptions, preview?: boolean): Promise<number | undefined>;
|
|
25
|
+
export declare function readLocalConfigs(opts: InstanceSyncOptions): Promise<Config[]>;
|
|
26
|
+
export declare function pullInstanceConfigs(opts: InstanceSyncOptions, preview?: boolean): Promise<number | undefined>;
|
|
27
|
+
export declare function pushInstanceConfigs(opts: InstanceSyncOptions, preview?: boolean): Promise<number | undefined>;
|
|
27
28
|
//# sourceMappingURL=settings.d.ts.map
|
package/types/settings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0B,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAI5E,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAI3D,MAAM,WAAW,kBAAkB;IAKj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AE,OAAe,+BAoDzB"}
|
package/types/user.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InstanceSyncOptions } from "./instance.js";
|
|
1
2
|
import { Command } from "./deps.js";
|
|
2
3
|
import { ExportedUser, InstanceGroup } from "./gen/types.gen.js";
|
|
3
4
|
interface SimplifiedUser {
|
|
@@ -12,12 +13,12 @@ interface SimplifiedGroup {
|
|
|
12
13
|
members: string[];
|
|
13
14
|
}
|
|
14
15
|
export declare function pushGroup(workspace: string, path: string, group: SimplifiedGroup | undefined, localGroup: SimplifiedGroup): Promise<void>;
|
|
15
|
-
export declare function pullInstanceUsers(preview?: boolean): Promise<number | undefined>;
|
|
16
|
-
export declare function readInstanceUsers(): Promise<ExportedUser[]>;
|
|
17
|
-
export declare function readInstanceGroups(): Promise<InstanceGroup[]>;
|
|
18
|
-
export declare function pushInstanceUsers(preview?: boolean): Promise<number | undefined>;
|
|
19
|
-
export declare function pullInstanceGroups(preview?: boolean): Promise<number | undefined>;
|
|
20
|
-
export declare function pushInstanceGroups(preview?: boolean): Promise<number | undefined>;
|
|
16
|
+
export declare function pullInstanceUsers(opts: InstanceSyncOptions, preview?: boolean): Promise<number | undefined>;
|
|
17
|
+
export declare function readInstanceUsers(opts: InstanceSyncOptions): Promise<ExportedUser[]>;
|
|
18
|
+
export declare function readInstanceGroups(opts: InstanceSyncOptions): Promise<InstanceGroup[]>;
|
|
19
|
+
export declare function pushInstanceUsers(opts: InstanceSyncOptions, preview?: boolean): Promise<number | undefined>;
|
|
20
|
+
export declare function pullInstanceGroups(opts: InstanceSyncOptions, preview?: boolean): Promise<number | undefined>;
|
|
21
|
+
export declare function pushInstanceGroups(opts: InstanceSyncOptions, preview?: boolean): Promise<number | undefined>;
|
|
21
22
|
declare const command: Command<void, void, {
|
|
22
23
|
email?: import("./deps/jsr.io/@windmill-labs/cliffy-command/1.0.0-rc.5/mod.js").StringType | undefined;
|
|
23
24
|
} & {
|
package/types/user.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"AAUA,OAAO,EAA0B,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAEL,OAAO,EAKR,MAAM,WAAW,CAAC;AAEnB,OAAO,EAEL,YAAY,EAEZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAwG5B,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,GAAG,SAAS,EAChC,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,IAAI,CAAC,CA2Ef;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAsB,SAAS,CAC7B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,UAAU,EAAE,eAAe,GAC1B,OAAO,CAAC,IAAI,CAAC,CAgLf;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,mBAAmB,EACzB,OAAO,GAAE,OAAe,+BAiBzB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,2BAWhE;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,4BAajE;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,mBAAmB,EACzB,OAAO,GAAE,OAAe,+BAezB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAA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