@gapi/gcli 1.8.261 → 1.8.262
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/release/index.js
CHANGED
|
@@ -12391,7 +12391,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
12391
12391
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12392
12392
|
exports2.lastValueFrom = void 0;
|
|
12393
12393
|
var EmptyError_1 = require_EmptyError();
|
|
12394
|
-
function
|
|
12394
|
+
function lastValueFrom61(source, config2) {
|
|
12395
12395
|
var hasConfig = typeof config2 === "object";
|
|
12396
12396
|
return new Promise(function(resolve2, reject) {
|
|
12397
12397
|
var _hasValue = false;
|
|
@@ -12414,7 +12414,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
12414
12414
|
});
|
|
12415
12415
|
});
|
|
12416
12416
|
}
|
|
12417
|
-
exports2.lastValueFrom =
|
|
12417
|
+
exports2.lastValueFrom = lastValueFrom61;
|
|
12418
12418
|
}
|
|
12419
12419
|
});
|
|
12420
12420
|
|
|
@@ -36193,6 +36193,8 @@ addedAt
|
|
|
36193
36193
|
recorded
|
|
36194
36194
|
source
|
|
36195
36195
|
role
|
|
36196
|
+
storage
|
|
36197
|
+
storageMessage
|
|
36196
36198
|
`;
|
|
36197
36199
|
}
|
|
36198
36200
|
});
|
|
@@ -37324,6 +37326,7 @@ var init_gql_client = __esm({
|
|
|
37324
37326
|
$pool: String
|
|
37325
37327
|
$reserved: Boolean
|
|
37326
37328
|
$installDisk: String
|
|
37329
|
+
$storage: Boolean
|
|
37327
37330
|
) {
|
|
37328
37331
|
clusterNodeJoinConfig(
|
|
37329
37332
|
clusterId: $clusterId
|
|
@@ -37331,11 +37334,13 @@ var init_gql_client = __esm({
|
|
|
37331
37334
|
pool: $pool
|
|
37332
37335
|
reserved: $reserved
|
|
37333
37336
|
installDisk: $installDisk
|
|
37337
|
+
storage: $storage
|
|
37334
37338
|
) {
|
|
37335
37339
|
clusterName
|
|
37336
37340
|
nodeName
|
|
37337
37341
|
pool
|
|
37338
37342
|
reserved
|
|
37343
|
+
storage
|
|
37339
37344
|
config
|
|
37340
37345
|
talosVersion
|
|
37341
37346
|
isoUrl
|
|
@@ -37414,6 +37419,26 @@ var init_gql_client = __esm({
|
|
|
37414
37419
|
variables: { clusterId, name: name2, paused }
|
|
37415
37420
|
}).pipe((0, import_operators.map)((res) => res.setClusterNodePaused));
|
|
37416
37421
|
}
|
|
37422
|
+
static setClusterNodeStorage(clusterId, name2, enabled) {
|
|
37423
|
+
return this.query({
|
|
37424
|
+
query: gql`
|
|
37425
|
+
mutation setClusterNodeStorage(
|
|
37426
|
+
$clusterId: String!
|
|
37427
|
+
$name: String!
|
|
37428
|
+
$enabled: Boolean!
|
|
37429
|
+
) {
|
|
37430
|
+
setClusterNodeStorage(
|
|
37431
|
+
clusterId: $clusterId
|
|
37432
|
+
name: $name
|
|
37433
|
+
enabled: $enabled
|
|
37434
|
+
) {
|
|
37435
|
+
${ClusterNodeFragment}
|
|
37436
|
+
}
|
|
37437
|
+
}
|
|
37438
|
+
`,
|
|
37439
|
+
variables: { clusterId, name: name2, enabled }
|
|
37440
|
+
}).pipe((0, import_operators.map)((res) => res.setClusterNodeStorage));
|
|
37441
|
+
}
|
|
37417
37442
|
static detachClusterNode(clusterId, name2) {
|
|
37418
37443
|
return this.query({
|
|
37419
37444
|
query: gql`
|
|
@@ -255284,11 +255309,86 @@ var init_cluster_change = __esm({
|
|
|
255284
255309
|
}
|
|
255285
255310
|
});
|
|
255286
255311
|
|
|
255312
|
+
// src/commands/cluster/helpers/machines.ts
|
|
255313
|
+
function planMachines(desired, nodes, clusterId) {
|
|
255314
|
+
const steps = [];
|
|
255315
|
+
const notes = [];
|
|
255316
|
+
for (const machine of desired ?? []) {
|
|
255317
|
+
const node = nodes.find(
|
|
255318
|
+
(n) => n.name === machine.name && n.source !== "hetzner"
|
|
255319
|
+
);
|
|
255320
|
+
if (!node || node.status === "detached") {
|
|
255321
|
+
notes.push(
|
|
255322
|
+
`machine "${machine.name}" is not attached - run from its network: ${attachHint(machine, clusterId)}`
|
|
255323
|
+
);
|
|
255324
|
+
continue;
|
|
255325
|
+
}
|
|
255326
|
+
if (machine.storage === void 0) continue;
|
|
255327
|
+
if (machine.storage && node.storage === "preparing") {
|
|
255328
|
+
notes.push(`machine "${machine.name}": storage is being prepared`);
|
|
255329
|
+
continue;
|
|
255330
|
+
}
|
|
255331
|
+
if (machine.storage && node.storage !== "ready") {
|
|
255332
|
+
steps.push({
|
|
255333
|
+
kind: "machine-storage",
|
|
255334
|
+
name: machine.name,
|
|
255335
|
+
enabled: true,
|
|
255336
|
+
description: `turn storage on for ${machine.name} (it may restart once)${node.storage === "failed" ? " - retry" : ""}`
|
|
255337
|
+
});
|
|
255338
|
+
} else if (!machine.storage && hasStorage(node)) {
|
|
255339
|
+
steps.push({
|
|
255340
|
+
kind: "machine-storage",
|
|
255341
|
+
name: machine.name,
|
|
255342
|
+
enabled: false,
|
|
255343
|
+
description: `turn storage off for ${machine.name}`,
|
|
255344
|
+
destructive: true
|
|
255345
|
+
});
|
|
255346
|
+
}
|
|
255347
|
+
}
|
|
255348
|
+
return { steps, notes };
|
|
255349
|
+
}
|
|
255350
|
+
var NAME_RE, validateMachines, attachHint, hasStorage, storageCell;
|
|
255351
|
+
var init_machines = __esm({
|
|
255352
|
+
"src/commands/cluster/helpers/machines.ts"() {
|
|
255353
|
+
NAME_RE = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
255354
|
+
validateMachines = (machines) => {
|
|
255355
|
+
if (machines === void 0) return [];
|
|
255356
|
+
if (!Array.isArray(machines)) return ["cluster.machines must be a list"];
|
|
255357
|
+
const errors = [];
|
|
255358
|
+
const seen = /* @__PURE__ */ new Set();
|
|
255359
|
+
machines.forEach((m2, i2) => {
|
|
255360
|
+
const at = `cluster.machines[${i2}]`;
|
|
255361
|
+
if (!m2 || typeof m2.name !== "string" || !NAME_RE.test(m2.name)) {
|
|
255362
|
+
errors.push(
|
|
255363
|
+
`${at}.name must be the machine's name (lowercase, digits, dashes)`
|
|
255364
|
+
);
|
|
255365
|
+
return;
|
|
255366
|
+
}
|
|
255367
|
+
if (seen.has(m2.name)) errors.push(`${at}.name "${m2.name}" is listed twice`);
|
|
255368
|
+
seen.add(m2.name);
|
|
255369
|
+
if (m2.storage !== void 0 && typeof m2.storage !== "boolean") {
|
|
255370
|
+
errors.push(`${at}.storage must be true or false`);
|
|
255371
|
+
}
|
|
255372
|
+
});
|
|
255373
|
+
return errors;
|
|
255374
|
+
};
|
|
255375
|
+
attachHint = (m2, clusterId = "<cluster-id>") => [
|
|
255376
|
+
`gcli cluster:attach --cluster ${clusterId} --name ${m2.name} --node-ip <ip> --disk <disk>`,
|
|
255377
|
+
m2.pool ? `--pool ${m2.pool}` : "",
|
|
255378
|
+
m2.reserved ? "--reserved" : "",
|
|
255379
|
+
m2.storage ? "--storage" : ""
|
|
255380
|
+
].filter(Boolean).join(" ");
|
|
255381
|
+
hasStorage = (n) => n.storage === "ready" || n.storage === "preparing";
|
|
255382
|
+
storageCell = (n) => n.source === "hetzner" || !n.storage || n.storage === "off" ? "-" : n.storage === "ready" ? "yes" : n.storageMessage ? `${n.storage}: ${n.storageMessage}` : n.storage;
|
|
255383
|
+
}
|
|
255384
|
+
});
|
|
255385
|
+
|
|
255287
255386
|
// src/commands/cluster/helpers/plan.ts
|
|
255288
255387
|
var AUTOSCALE_BOUNDS, SERVER_TYPE_NAME, VIRTUAL_UNSUPPORTED, intIn, validateDesired, planClusterChanges;
|
|
255289
255388
|
var init_plan = __esm({
|
|
255290
255389
|
"src/commands/cluster/helpers/plan.ts"() {
|
|
255291
255390
|
init_types2();
|
|
255391
|
+
init_machines();
|
|
255292
255392
|
AUTOSCALE_BOUNDS = {
|
|
255293
255393
|
minWorkers: [1, 10],
|
|
255294
255394
|
maxWorkers: [1, 10],
|
|
@@ -255309,7 +255409,8 @@ var init_plan = __esm({
|
|
|
255309
255409
|
"singleNode",
|
|
255310
255410
|
"workers",
|
|
255311
255411
|
"controlPlanes",
|
|
255312
|
-
"autoscale"
|
|
255412
|
+
"autoscale",
|
|
255413
|
+
"machines"
|
|
255313
255414
|
];
|
|
255314
255415
|
intIn = (v, min, max) => Number.isInteger(v) && v >= min && v <= max;
|
|
255315
255416
|
validateDesired = (d) => {
|
|
@@ -255329,6 +255430,7 @@ var init_plan = __esm({
|
|
|
255329
255430
|
if (d.host !== void 0) {
|
|
255330
255431
|
errors.push("cluster.host needs provider: 'vcluster'");
|
|
255331
255432
|
}
|
|
255433
|
+
errors.push(...validateMachines(d.machines));
|
|
255332
255434
|
if (d.workers !== void 0 && !intIn(d.workers, 1, 10)) {
|
|
255333
255435
|
errors.push("cluster.workers must be an integer from 1 to 10");
|
|
255334
255436
|
}
|
|
@@ -255521,25 +255623,101 @@ var init_plan = __esm({
|
|
|
255521
255623
|
}
|
|
255522
255624
|
});
|
|
255523
255625
|
|
|
255626
|
+
// src/commands/cluster/node-storage.ts
|
|
255627
|
+
var node_storage_exports = {};
|
|
255628
|
+
__export(node_storage_exports, {
|
|
255629
|
+
default: () => node_storage_default,
|
|
255630
|
+
waitForStorage: () => waitForStorage
|
|
255631
|
+
});
|
|
255632
|
+
async function waitForStorage(clusterId, name2, timeoutMs) {
|
|
255633
|
+
const deadline = Date.now() + timeoutMs;
|
|
255634
|
+
let last = "";
|
|
255635
|
+
while (Date.now() < deadline) {
|
|
255636
|
+
const nodes = await (0, import_rxjs12.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId));
|
|
255637
|
+
const node = nodes.find((n) => n.name === name2);
|
|
255638
|
+
if (node?.storage === "ready") {
|
|
255639
|
+
Logger.log(`${name2} carries volumes now.`);
|
|
255640
|
+
return true;
|
|
255641
|
+
}
|
|
255642
|
+
if (node?.storage === "failed") {
|
|
255643
|
+
throw new Error(
|
|
255644
|
+
`Storage on ${name2} failed: ${node.storageMessage ?? "no reason given"}. Fix it and run the command again.`
|
|
255645
|
+
);
|
|
255646
|
+
}
|
|
255647
|
+
const step = node?.storageMessage ?? node?.storage ?? "";
|
|
255648
|
+
if (step && step !== last) {
|
|
255649
|
+
Logger.info(`${name2}: ${step}`);
|
|
255650
|
+
last = step;
|
|
255651
|
+
}
|
|
255652
|
+
await sleep2(1e4);
|
|
255653
|
+
}
|
|
255654
|
+
Logger.warn(
|
|
255655
|
+
`${name2} is still being prepared - it continues on the platform. Check with: gcli cluster:nodes`
|
|
255656
|
+
);
|
|
255657
|
+
return false;
|
|
255658
|
+
}
|
|
255659
|
+
var import_rxjs12, sleep2, node_storage_default;
|
|
255660
|
+
var init_node_storage = __esm({
|
|
255661
|
+
"src/commands/cluster/node-storage.ts"() {
|
|
255662
|
+
import_rxjs12 = __toESM(require_cjs());
|
|
255663
|
+
init_gql_client();
|
|
255664
|
+
init_log();
|
|
255665
|
+
init_cluster_change();
|
|
255666
|
+
sleep2 = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
255667
|
+
node_storage_default = async (cmd) => {
|
|
255668
|
+
const name2 = (cmd.name ?? "").trim();
|
|
255669
|
+
if (!name2) {
|
|
255670
|
+
throw new Error("--name is required (see gcli cluster:nodes)");
|
|
255671
|
+
}
|
|
255672
|
+
const minutes = cmd.timeout === void 0 ? 40 : Number(cmd.timeout);
|
|
255673
|
+
if (!Number.isFinite(minutes) || minutes < 1 || minutes > 120) {
|
|
255674
|
+
throw new Error("--timeout is in minutes, 1 to 120");
|
|
255675
|
+
}
|
|
255676
|
+
const { clusterId } = await resolveClusterTarget(cmd);
|
|
255677
|
+
const node = await (0, import_rxjs12.lastValueFrom)(
|
|
255678
|
+
GraphqlClienAPI.setClusterNodeStorage(clusterId, name2, !cmd.off)
|
|
255679
|
+
);
|
|
255680
|
+
if (cmd.off) {
|
|
255681
|
+
Logger.log(`${node.name} no longer carries volumes.`);
|
|
255682
|
+
return;
|
|
255683
|
+
}
|
|
255684
|
+
if (node.storage === "ready") {
|
|
255685
|
+
Logger.log(`${node.name} already carries volumes.`);
|
|
255686
|
+
return;
|
|
255687
|
+
}
|
|
255688
|
+
Logger.info(
|
|
255689
|
+
`Preparing ${node.name}: it may restart once (a few minutes); its workloads move to other nodes first.`
|
|
255690
|
+
);
|
|
255691
|
+
if (cmd.wait === false) {
|
|
255692
|
+
Logger.info("Check progress with: gcli cluster:nodes");
|
|
255693
|
+
return;
|
|
255694
|
+
}
|
|
255695
|
+
await waitForStorage(clusterId, name2, minutes * 6e4);
|
|
255696
|
+
};
|
|
255697
|
+
}
|
|
255698
|
+
});
|
|
255699
|
+
|
|
255524
255700
|
// src/commands/cluster/apply.ts
|
|
255525
255701
|
var apply_exports = {};
|
|
255526
255702
|
__export(apply_exports, {
|
|
255527
255703
|
default: () => apply_default
|
|
255528
255704
|
});
|
|
255529
|
-
var
|
|
255705
|
+
var import_rxjs13, readDesired, apply_default, applyMachines, applyCluster;
|
|
255530
255706
|
var init_apply = __esm({
|
|
255531
255707
|
"src/commands/cluster/apply.ts"() {
|
|
255532
|
-
|
|
255708
|
+
import_rxjs13 = __toESM(require_cjs());
|
|
255533
255709
|
init_helpers();
|
|
255534
255710
|
init_gql_client();
|
|
255535
255711
|
init_log();
|
|
255536
255712
|
init_load_spec();
|
|
255537
255713
|
init_cluster_change();
|
|
255714
|
+
init_machines();
|
|
255538
255715
|
init_plan();
|
|
255539
255716
|
init_poll_until_ready();
|
|
255540
255717
|
init_virtual_cluster();
|
|
255718
|
+
init_node_storage();
|
|
255541
255719
|
readDesired = async (spec) => {
|
|
255542
|
-
const data = await (0,
|
|
255720
|
+
const data = await (0, import_rxjs13.lastValueFrom)(
|
|
255543
255721
|
loadSpec(
|
|
255544
255722
|
spec ?? "cluster.yaml"
|
|
255545
255723
|
)
|
|
@@ -255554,13 +255732,54 @@ var init_apply = __esm({
|
|
|
255554
255732
|
};
|
|
255555
255733
|
apply_default = async (cmd) => {
|
|
255556
255734
|
const desired = await readDesired(cmd.spec);
|
|
255735
|
+
const result = await applyCluster(desired, cmd);
|
|
255736
|
+
const clusterId = result.clusterId ?? result.cluster?.id;
|
|
255737
|
+
if (desired.machines?.length && clusterId) {
|
|
255738
|
+
await applyMachines(clusterId, desired.machines, cmd);
|
|
255739
|
+
}
|
|
255740
|
+
return result;
|
|
255741
|
+
};
|
|
255742
|
+
applyMachines = async (clusterId, machines, cmd) => {
|
|
255743
|
+
const nodes = await (0, import_rxjs13.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId));
|
|
255744
|
+
const { steps, notes } = planMachines(machines, nodes, clusterId);
|
|
255745
|
+
notes.forEach((n) => Logger.warn(`note: ${n}`));
|
|
255746
|
+
if (!steps.length) {
|
|
255747
|
+
Logger.info("Machines: nothing to change.");
|
|
255748
|
+
return;
|
|
255749
|
+
}
|
|
255750
|
+
Logger.table(
|
|
255751
|
+
steps.map((s2, i2) => ({
|
|
255752
|
+
step: i2 + 1,
|
|
255753
|
+
change: s2.description,
|
|
255754
|
+
needsYes: s2.destructive ? "yes" : ""
|
|
255755
|
+
}))
|
|
255756
|
+
);
|
|
255757
|
+
if (cmd.dryRun) {
|
|
255758
|
+
return;
|
|
255759
|
+
}
|
|
255760
|
+
for (const step of steps) {
|
|
255761
|
+
if (step.destructive && !cmd.yes) {
|
|
255762
|
+
Logger.warn(`skipped (re-run with --yes to apply): ${step.description}`);
|
|
255763
|
+
continue;
|
|
255764
|
+
}
|
|
255765
|
+
Logger.info(`-> ${step.description}`);
|
|
255766
|
+
await (0, import_rxjs13.lastValueFrom)(
|
|
255767
|
+
GraphqlClienAPI.setClusterNodeStorage(clusterId, step.name, step.enabled)
|
|
255768
|
+
);
|
|
255769
|
+
if (step.enabled && !await waitForStorage(clusterId, step.name, 40 * 6e4)) {
|
|
255770
|
+
Logger.warn("Stopped here - apply again once it is ready.");
|
|
255771
|
+
return;
|
|
255772
|
+
}
|
|
255773
|
+
}
|
|
255774
|
+
};
|
|
255775
|
+
applyCluster = async (desired, cmd) => {
|
|
255557
255776
|
const errors = validateDesired(desired);
|
|
255558
255777
|
if (errors.length) {
|
|
255559
255778
|
throw new Error(`Invalid cluster spec:
|
|
255560
255779
|
- ${errors.join("\n- ")}`);
|
|
255561
255780
|
}
|
|
255562
|
-
const projectId = await (0,
|
|
255563
|
-
const clusters = await (0,
|
|
255781
|
+
const projectId = await (0, import_rxjs13.lastValueFrom)(parseProjectId(cmd.project));
|
|
255782
|
+
const clusters = await (0, import_rxjs13.lastValueFrom)(
|
|
255564
255783
|
GraphqlClienAPI.projectClustersDetailed(projectId)
|
|
255565
255784
|
);
|
|
255566
255785
|
const current = clusters.find(
|
|
@@ -255616,7 +255835,7 @@ var init_apply = __esm({
|
|
|
255616
255835
|
desired.name,
|
|
255617
255836
|
desired.host,
|
|
255618
255837
|
desired.loadBalancer
|
|
255619
|
-
) : await (0,
|
|
255838
|
+
) : await (0, import_rxjs13.lastValueFrom)(
|
|
255620
255839
|
GraphqlClienAPI.provisionProjectCluster(projectId, {
|
|
255621
255840
|
name: desired.name,
|
|
255622
255841
|
imageId: desired.imageId,
|
|
@@ -255637,7 +255856,7 @@ var init_apply = __esm({
|
|
|
255637
255856
|
);
|
|
255638
255857
|
}
|
|
255639
255858
|
} else if (step.kind === "autoscale") {
|
|
255640
|
-
await (0,
|
|
255859
|
+
await (0, import_rxjs13.lastValueFrom)(
|
|
255641
255860
|
GraphqlClienAPI.updateProjectClusterAutoscale(
|
|
255642
255861
|
projectId,
|
|
255643
255862
|
clusterId,
|
|
@@ -255682,15 +255901,15 @@ var list_exports = {};
|
|
|
255682
255901
|
__export(list_exports, {
|
|
255683
255902
|
default: () => list_default
|
|
255684
255903
|
});
|
|
255685
|
-
var
|
|
255904
|
+
var import_rxjs14, import_operators9, list_default;
|
|
255686
255905
|
var init_list = __esm({
|
|
255687
255906
|
"src/commands/cluster/list.ts"() {
|
|
255688
|
-
|
|
255907
|
+
import_rxjs14 = __toESM(require_cjs());
|
|
255689
255908
|
import_operators9 = __toESM(require_operators());
|
|
255690
255909
|
init_helpers();
|
|
255691
255910
|
init_gql_client();
|
|
255692
255911
|
init_log();
|
|
255693
|
-
list_default = (cmd) => (0,
|
|
255912
|
+
list_default = (cmd) => (0, import_rxjs14.lastValueFrom)(
|
|
255694
255913
|
parseProjectId(cmd.project).pipe(
|
|
255695
255914
|
(0, import_operators9.switchMap)((projectId) => GraphqlClienAPI.projectClusters(projectId)),
|
|
255696
255915
|
(0, import_operators9.tap)((clusters) => {
|
|
@@ -255728,17 +255947,17 @@ var teardown_exports = {};
|
|
|
255728
255947
|
__export(teardown_exports, {
|
|
255729
255948
|
default: () => teardown_default
|
|
255730
255949
|
});
|
|
255731
|
-
var
|
|
255950
|
+
var import_rxjs15, import_operators10, teardown_default;
|
|
255732
255951
|
var init_teardown = __esm({
|
|
255733
255952
|
"src/commands/cluster/teardown.ts"() {
|
|
255734
|
-
|
|
255953
|
+
import_rxjs15 = __toESM(require_cjs());
|
|
255735
255954
|
import_operators10 = __toESM(require_operators());
|
|
255736
255955
|
init_helpers();
|
|
255737
255956
|
init_gql_client();
|
|
255738
255957
|
init_log();
|
|
255739
255958
|
init_poll_until_ready();
|
|
255740
255959
|
teardown_default = async (cmd) => {
|
|
255741
|
-
const { projectId, cluster } = await (0,
|
|
255960
|
+
const { projectId, cluster } = await (0, import_rxjs15.lastValueFrom)(
|
|
255742
255961
|
parseProjectId(cmd.project).pipe(
|
|
255743
255962
|
(0, import_operators10.switchMap)(
|
|
255744
255963
|
(projectId2) => GraphqlClienAPI.teardownProjectCluster(cmd.cluster).pipe(
|
|
@@ -255778,20 +255997,20 @@ var kubeconfig_exports = {};
|
|
|
255778
255997
|
__export(kubeconfig_exports, {
|
|
255779
255998
|
default: () => kubeconfig_default
|
|
255780
255999
|
});
|
|
255781
|
-
var
|
|
256000
|
+
var import_rxjs16, import_operators11, kubeconfig_default;
|
|
255782
256001
|
var init_kubeconfig = __esm({
|
|
255783
256002
|
"src/commands/cluster/kubeconfig.ts"() {
|
|
255784
|
-
|
|
256003
|
+
import_rxjs16 = __toESM(require_cjs());
|
|
255785
256004
|
import_operators11 = __toESM(require_operators());
|
|
255786
256005
|
init_gql_client();
|
|
255787
256006
|
init_log();
|
|
255788
256007
|
init_read_file();
|
|
255789
|
-
kubeconfig_default = (cmd) => (0,
|
|
256008
|
+
kubeconfig_default = (cmd) => (0, import_rxjs16.lastValueFrom)(
|
|
255790
256009
|
GraphqlClienAPI.clusterKubeconfig(cmd.cluster).pipe(
|
|
255791
256010
|
(0, import_operators11.switchMap)(
|
|
255792
256011
|
(kubeconfig) => cmd.output ? writeFileAsObservable(cmd.output, kubeconfig).pipe(
|
|
255793
256012
|
(0, import_operators11.tap)(() => Logger.info(`Wrote kubeconfig to ${cmd.output}`))
|
|
255794
|
-
) : (0,
|
|
256013
|
+
) : (0, import_rxjs16.of)(kubeconfig).pipe((0, import_operators11.tap)((value) => Logger.log(value)))
|
|
255795
256014
|
)
|
|
255796
256015
|
)
|
|
255797
256016
|
);
|
|
@@ -255804,10 +256023,10 @@ __export(status_exports, {
|
|
|
255804
256023
|
default: () => status_default,
|
|
255805
256024
|
overviewRow: () => overviewRow
|
|
255806
256025
|
});
|
|
255807
|
-
var
|
|
256026
|
+
var import_rxjs17, pct, overviewRow, status_default;
|
|
255808
256027
|
var init_status = __esm({
|
|
255809
256028
|
"src/commands/cluster/status.ts"() {
|
|
255810
|
-
|
|
256029
|
+
import_rxjs17 = __toESM(require_cjs());
|
|
255811
256030
|
init_helpers();
|
|
255812
256031
|
init_gql_client();
|
|
255813
256032
|
init_log();
|
|
@@ -255825,14 +256044,14 @@ var init_status = __esm({
|
|
|
255825
256044
|
autoscale: c.autoscale?.enabled ? `on ${c.autoscale.minWorkers}-${c.autoscale.maxWorkers}` : "off"
|
|
255826
256045
|
});
|
|
255827
256046
|
status_default = async (cmd) => {
|
|
255828
|
-
const projectId = await (0,
|
|
255829
|
-
const clusterId = await (0,
|
|
256047
|
+
const projectId = await (0, import_rxjs17.lastValueFrom)(parseProjectId(cmd.project));
|
|
256048
|
+
const clusterId = await (0, import_rxjs17.lastValueFrom)(
|
|
255830
256049
|
resolveClusterId(projectId, {
|
|
255831
256050
|
clusterId: cmd.cluster,
|
|
255832
256051
|
clusterName: cmd.clusterName
|
|
255833
256052
|
})
|
|
255834
256053
|
);
|
|
255835
|
-
const all = await (0,
|
|
256054
|
+
const all = await (0, import_rxjs17.lastValueFrom)(
|
|
255836
256055
|
GraphqlClienAPI.projectClustersOverview(projectId)
|
|
255837
256056
|
);
|
|
255838
256057
|
const rows = clusterId ? all.filter((c) => c.clusterId === clusterId) : all;
|
|
@@ -255874,7 +256093,7 @@ function parseAttachOptions(cmd) {
|
|
|
255874
256093
|
"--node-ip is required: the machine's address on your network, shown on its screen after booting the Talos ISO (e.g. 192.168.1.50)"
|
|
255875
256094
|
);
|
|
255876
256095
|
}
|
|
255877
|
-
if (!
|
|
256096
|
+
if (!NAME_RE2.test(name2)) {
|
|
255878
256097
|
throw new Error(
|
|
255879
256098
|
"--name is required: lowercase letters, digits and dashes (it becomes the machine hostname, e.g. home-1)"
|
|
255880
256099
|
);
|
|
@@ -255895,6 +256114,7 @@ function parseAttachOptions(cmd) {
|
|
|
255895
256114
|
pool,
|
|
255896
256115
|
disk,
|
|
255897
256116
|
reserved: !!cmd.reserved,
|
|
256117
|
+
storage: !!cmd.storage,
|
|
255898
256118
|
yes: !!cmd.yes,
|
|
255899
256119
|
wait: cmd.wait !== false,
|
|
255900
256120
|
timeoutMs: timeoutMinutes * 6e4
|
|
@@ -255904,10 +256124,11 @@ function serverTalosVersion(output) {
|
|
|
255904
256124
|
const spec = output.split(/^spec:/m)[1];
|
|
255905
256125
|
return spec?.match(/^\s+version:\s*(v[\d.]+\S*)/m)?.[1];
|
|
255906
256126
|
}
|
|
255907
|
-
var
|
|
256127
|
+
var NAME_RE2, POOL_RE, DISK_RE, HOST_RE, nodeRow, resetHint;
|
|
255908
256128
|
var init_attach = __esm({
|
|
255909
256129
|
"src/commands/cluster/helpers/attach.ts"() {
|
|
255910
|
-
|
|
256130
|
+
init_machines();
|
|
256131
|
+
NAME_RE2 = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
255911
256132
|
POOL_RE = /^[a-z0-9]([a-z0-9-]{0,30}[a-z0-9])?$/;
|
|
255912
256133
|
DISK_RE = /^\/dev\/[A-Za-z0-9/_-]+$/;
|
|
255913
256134
|
HOST_RE = /^[A-Za-z0-9.:-]+$/;
|
|
@@ -255920,6 +256141,7 @@ var init_attach = __esm({
|
|
|
255920
256141
|
status: n.cordoned ? `${n.status}, paused` : n.status,
|
|
255921
256142
|
pool: own ? n.pool ?? "-" : "-",
|
|
255922
256143
|
use: own ? n.reserved ? "reserved" : "capacity" : "-",
|
|
256144
|
+
storage: storageCell(n),
|
|
255923
256145
|
ip: n.internalIp ?? "-",
|
|
255924
256146
|
cpu: n.cpuCores ?? "-",
|
|
255925
256147
|
memoryGb: n.memoryGb ?? "-",
|
|
@@ -256036,20 +256258,20 @@ var attach_exports = {};
|
|
|
256036
256258
|
__export(attach_exports, {
|
|
256037
256259
|
default: () => attach_default
|
|
256038
256260
|
});
|
|
256039
|
-
var import_promises2, import_os3, import_path3, import_readline,
|
|
256261
|
+
var import_promises2, import_os3, import_path3, import_readline, import_rxjs18, sleep3, ask, attach_default;
|
|
256040
256262
|
var init_attach2 = __esm({
|
|
256041
256263
|
"src/commands/cluster/attach.ts"() {
|
|
256042
256264
|
import_promises2 = require("fs/promises");
|
|
256043
256265
|
import_os3 = require("os");
|
|
256044
256266
|
import_path3 = require("path");
|
|
256045
256267
|
import_readline = require("readline");
|
|
256046
|
-
|
|
256268
|
+
import_rxjs18 = __toESM(require_cjs());
|
|
256047
256269
|
init_gql_client();
|
|
256048
256270
|
init_log();
|
|
256049
256271
|
init_attach();
|
|
256050
256272
|
init_cluster_change();
|
|
256051
256273
|
init_talosctl();
|
|
256052
|
-
|
|
256274
|
+
sleep3 = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
256053
256275
|
ask = (question) => new Promise((resolve2) => {
|
|
256054
256276
|
const rl = (0, import_readline.createInterface)({
|
|
256055
256277
|
input: process.stdin,
|
|
@@ -256063,7 +256285,7 @@ var init_attach2 = __esm({
|
|
|
256063
256285
|
attach_default = async (cmd) => {
|
|
256064
256286
|
const opts = parseAttachOptions(cmd);
|
|
256065
256287
|
const { clusterId } = await resolveClusterTarget(cmd);
|
|
256066
|
-
const info = await (0,
|
|
256288
|
+
const info = await (0, import_rxjs18.lastValueFrom)(
|
|
256067
256289
|
GraphqlClienAPI.clusterAttachInfo(clusterId)
|
|
256068
256290
|
);
|
|
256069
256291
|
if (!info.attachable) {
|
|
@@ -256091,7 +256313,7 @@ var init_attach2 = __esm({
|
|
|
256091
256313
|
"yaml"
|
|
256092
256314
|
]);
|
|
256093
256315
|
version2 = probe.code === 0 ? serverTalosVersion(probe.stdout) : void 0;
|
|
256094
|
-
if (!version2) await
|
|
256316
|
+
if (!version2) await sleep3(5e3);
|
|
256095
256317
|
}
|
|
256096
256318
|
if (!version2) {
|
|
256097
256319
|
throw new Error(
|
|
@@ -256121,13 +256343,14 @@ var init_attach2 = __esm({
|
|
|
256121
256343
|
return;
|
|
256122
256344
|
}
|
|
256123
256345
|
}
|
|
256124
|
-
const join_ = await (0,
|
|
256346
|
+
const join_ = await (0, import_rxjs18.lastValueFrom)(
|
|
256125
256347
|
GraphqlClienAPI.clusterNodeJoinConfig({
|
|
256126
256348
|
clusterId,
|
|
256127
256349
|
name: opts.name,
|
|
256128
256350
|
pool: opts.pool,
|
|
256129
256351
|
reserved: opts.reserved,
|
|
256130
|
-
installDisk: opts.disk
|
|
256352
|
+
installDisk: opts.disk,
|
|
256353
|
+
storage: opts.storage
|
|
256131
256354
|
})
|
|
256132
256355
|
);
|
|
256133
256356
|
if (join_.talosVersion && join_.talosVersion !== version2) {
|
|
@@ -256152,7 +256375,7 @@ var init_attach2 = __esm({
|
|
|
256152
256375
|
await (0, import_promises2.rm)(dir, { recursive: true, force: true });
|
|
256153
256376
|
}
|
|
256154
256377
|
Logger.info(
|
|
256155
|
-
`Config applied - ${opts.name} installs Talos and reboots, then joins "${join_.clusterName}" (pool ${join_.pool}, ${join_.reserved ? "reserved" : "extra capacity"}).`
|
|
256378
|
+
`Config applied - ${opts.name} installs Talos and reboots, then joins "${join_.clusterName}" (pool ${join_.pool}, ${join_.reserved ? "reserved" : "extra capacity"}${opts.storage ? ", carries volumes" : ""}).`
|
|
256156
256379
|
);
|
|
256157
256380
|
if (!opts.wait) {
|
|
256158
256381
|
Logger.info("Check progress with: gcli cluster:nodes");
|
|
@@ -256163,12 +256386,17 @@ var init_attach2 = __esm({
|
|
|
256163
256386
|
);
|
|
256164
256387
|
const deadline = Date.now() + opts.timeoutMs;
|
|
256165
256388
|
while (Date.now() < deadline) {
|
|
256166
|
-
await
|
|
256167
|
-
const nodes = await (0,
|
|
256389
|
+
await sleep3(15e3);
|
|
256390
|
+
const nodes = await (0, import_rxjs18.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId));
|
|
256168
256391
|
const node = nodes.find((n) => n.name === opts.name);
|
|
256169
256392
|
if (node?.status === "ready") {
|
|
256170
256393
|
Logger.log(`${opts.name} joined and is ready.`);
|
|
256171
256394
|
Logger.table([nodeRow(node)]);
|
|
256395
|
+
if (opts.storage) {
|
|
256396
|
+
Logger.info(
|
|
256397
|
+
'The cluster installs its storage add-on now (a few minutes) - volumes can be made once gcli cluster:nodes shows storage "yes" and the add-on is up.'
|
|
256398
|
+
);
|
|
256399
|
+
}
|
|
256172
256400
|
return;
|
|
256173
256401
|
}
|
|
256174
256402
|
}
|
|
@@ -256184,17 +256412,17 @@ var nodes_exports = {};
|
|
|
256184
256412
|
__export(nodes_exports, {
|
|
256185
256413
|
default: () => nodes_default
|
|
256186
256414
|
});
|
|
256187
|
-
var
|
|
256415
|
+
var import_rxjs19, nodes_default;
|
|
256188
256416
|
var init_nodes = __esm({
|
|
256189
256417
|
"src/commands/cluster/nodes.ts"() {
|
|
256190
|
-
|
|
256418
|
+
import_rxjs19 = __toESM(require_cjs());
|
|
256191
256419
|
init_gql_client();
|
|
256192
256420
|
init_log();
|
|
256193
256421
|
init_attach();
|
|
256194
256422
|
init_cluster_change();
|
|
256195
256423
|
nodes_default = async (cmd) => {
|
|
256196
256424
|
const { clusterId } = await resolveClusterTarget(cmd);
|
|
256197
|
-
const nodes = await (0,
|
|
256425
|
+
const nodes = await (0, import_rxjs19.lastValueFrom)(
|
|
256198
256426
|
GraphqlClienAPI.clusterNodes(clusterId, true)
|
|
256199
256427
|
);
|
|
256200
256428
|
if (!nodes.length) {
|
|
@@ -256217,10 +256445,10 @@ __export(pause_exports, {
|
|
|
256217
256445
|
pause: () => pause,
|
|
256218
256446
|
resume: () => resume
|
|
256219
256447
|
});
|
|
256220
|
-
var
|
|
256448
|
+
var import_rxjs20, setPaused, pause, resume;
|
|
256221
256449
|
var init_pause = __esm({
|
|
256222
256450
|
"src/commands/cluster/pause.ts"() {
|
|
256223
|
-
|
|
256451
|
+
import_rxjs20 = __toESM(require_cjs());
|
|
256224
256452
|
init_gql_client();
|
|
256225
256453
|
init_log();
|
|
256226
256454
|
init_cluster_change();
|
|
@@ -256230,7 +256458,7 @@ var init_pause = __esm({
|
|
|
256230
256458
|
throw new Error("--name is required (see gcli cluster:nodes)");
|
|
256231
256459
|
}
|
|
256232
256460
|
const { clusterId } = await resolveClusterTarget(cmd);
|
|
256233
|
-
const node = await (0,
|
|
256461
|
+
const node = await (0, import_rxjs20.lastValueFrom)(
|
|
256234
256462
|
GraphqlClienAPI.setClusterNodePaused(clusterId, name2, paused)
|
|
256235
256463
|
);
|
|
256236
256464
|
Logger.log(
|
|
@@ -256248,14 +256476,14 @@ __export(reset_machine_exports, {
|
|
|
256248
256476
|
default: () => reset_machine_default,
|
|
256249
256477
|
hostnameOf: () => hostnameOf
|
|
256250
256478
|
});
|
|
256251
|
-
var import_promises3, import_os4, import_path4, import_readline2,
|
|
256479
|
+
var import_promises3, import_os4, import_path4, import_readline2, import_rxjs21, hostnameOf, reset_machine_default;
|
|
256252
256480
|
var init_reset_machine = __esm({
|
|
256253
256481
|
"src/commands/cluster/reset-machine.ts"() {
|
|
256254
256482
|
import_promises3 = require("fs/promises");
|
|
256255
256483
|
import_os4 = require("os");
|
|
256256
256484
|
import_path4 = require("path");
|
|
256257
256485
|
import_readline2 = require("readline");
|
|
256258
|
-
|
|
256486
|
+
import_rxjs21 = __toESM(require_cjs());
|
|
256259
256487
|
init_gql_client();
|
|
256260
256488
|
init_log();
|
|
256261
256489
|
init_attach();
|
|
@@ -256265,7 +256493,7 @@ var init_reset_machine = __esm({
|
|
|
256265
256493
|
reset_machine_default = async (cmd) => {
|
|
256266
256494
|
const name2 = (cmd.name ?? "").trim();
|
|
256267
256495
|
const ip = (cmd.nodeIp ?? "").trim();
|
|
256268
|
-
if (!
|
|
256496
|
+
if (!NAME_RE2.test(name2)) {
|
|
256269
256497
|
throw new Error(
|
|
256270
256498
|
"--name is required: the machine name (see gcli cluster:nodes)"
|
|
256271
256499
|
);
|
|
@@ -256276,7 +256504,7 @@ var init_reset_machine = __esm({
|
|
|
256276
256504
|
);
|
|
256277
256505
|
}
|
|
256278
256506
|
const { clusterId } = await resolveClusterTarget(cmd);
|
|
256279
|
-
const node = (await (0,
|
|
256507
|
+
const node = (await (0, import_rxjs21.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId, true))).find((n) => n.name === name2);
|
|
256280
256508
|
if (node?.source === "hetzner") {
|
|
256281
256509
|
throw new Error(
|
|
256282
256510
|
`${name2} is a Hetzner node - those are removed by scaling the cluster.`
|
|
@@ -256287,7 +256515,7 @@ var init_reset_machine = __esm({
|
|
|
256287
256515
|
`${name2} is still in the cluster. Detach it first: gcli cluster:detach --cluster ${clusterId} --name ${name2}`
|
|
256288
256516
|
);
|
|
256289
256517
|
}
|
|
256290
|
-
const access = await (0,
|
|
256518
|
+
const access = await (0, import_rxjs21.lastValueFrom)(
|
|
256291
256519
|
GraphqlClienAPI.clusterTalosconfig(clusterId, 15)
|
|
256292
256520
|
);
|
|
256293
256521
|
const binary = access.talosVersion ? await ensureTalosctl(access.talosVersion) : "talosctl";
|
|
@@ -256364,11 +256592,11 @@ var talosconfig_exports = {};
|
|
|
256364
256592
|
__export(talosconfig_exports, {
|
|
256365
256593
|
default: () => talosconfig_default
|
|
256366
256594
|
});
|
|
256367
|
-
var import_promises4,
|
|
256595
|
+
var import_promises4, import_rxjs22, talosconfig_default;
|
|
256368
256596
|
var init_talosconfig = __esm({
|
|
256369
256597
|
"src/commands/cluster/talosconfig.ts"() {
|
|
256370
256598
|
import_promises4 = require("fs/promises");
|
|
256371
|
-
|
|
256599
|
+
import_rxjs22 = __toESM(require_cjs());
|
|
256372
256600
|
init_gql_client();
|
|
256373
256601
|
init_log();
|
|
256374
256602
|
init_cluster_change();
|
|
@@ -256378,7 +256606,7 @@ var init_talosconfig = __esm({
|
|
|
256378
256606
|
throw new Error("--ttl is in minutes, 5 to 1440");
|
|
256379
256607
|
}
|
|
256380
256608
|
const { clusterId } = await resolveClusterTarget(cmd);
|
|
256381
|
-
const res = await (0,
|
|
256609
|
+
const res = await (0, import_rxjs22.lastValueFrom)(
|
|
256382
256610
|
GraphqlClienAPI.clusterTalosconfig(clusterId, ttl)
|
|
256383
256611
|
);
|
|
256384
256612
|
if (!cmd.output) {
|
|
@@ -256401,11 +256629,11 @@ var detach_exports = {};
|
|
|
256401
256629
|
__export(detach_exports, {
|
|
256402
256630
|
default: () => detach_default
|
|
256403
256631
|
});
|
|
256404
|
-
var import_readline3,
|
|
256632
|
+
var import_readline3, import_rxjs23, detach_default;
|
|
256405
256633
|
var init_detach = __esm({
|
|
256406
256634
|
"src/commands/cluster/detach.ts"() {
|
|
256407
256635
|
import_readline3 = require("readline");
|
|
256408
|
-
|
|
256636
|
+
import_rxjs23 = __toESM(require_cjs());
|
|
256409
256637
|
init_gql_client();
|
|
256410
256638
|
init_log();
|
|
256411
256639
|
init_attach();
|
|
@@ -256435,7 +256663,7 @@ var init_detach = __esm({
|
|
|
256435
256663
|
return;
|
|
256436
256664
|
}
|
|
256437
256665
|
}
|
|
256438
|
-
const node = await (0,
|
|
256666
|
+
const node = await (0, import_rxjs23.lastValueFrom)(
|
|
256439
256667
|
GraphqlClienAPI.detachClusterNode(clusterId, name2)
|
|
256440
256668
|
);
|
|
256441
256669
|
Logger.log(`${node.name} is detached.`);
|
|
@@ -256451,17 +256679,17 @@ var health_exports = {};
|
|
|
256451
256679
|
__export(health_exports, {
|
|
256452
256680
|
default: () => health_default
|
|
256453
256681
|
});
|
|
256454
|
-
var
|
|
256682
|
+
var import_rxjs24, pct2, health_default;
|
|
256455
256683
|
var init_health = __esm({
|
|
256456
256684
|
"src/commands/cluster/health.ts"() {
|
|
256457
|
-
|
|
256685
|
+
import_rxjs24 = __toESM(require_cjs());
|
|
256458
256686
|
init_gql_client();
|
|
256459
256687
|
init_log();
|
|
256460
256688
|
init_cluster_change();
|
|
256461
256689
|
pct2 = (v) => v == null ? "-" : `${Math.round(v)}%`;
|
|
256462
256690
|
health_default = async (cmd) => {
|
|
256463
256691
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
256464
|
-
const [latest] = await (0,
|
|
256692
|
+
const [latest] = await (0, import_rxjs24.lastValueFrom)(
|
|
256465
256693
|
GraphqlClienAPI.clusterHealth(projectId, clusterId, 1)
|
|
256466
256694
|
);
|
|
256467
256695
|
Logger.log("-------------------");
|
|
@@ -256508,17 +256736,17 @@ var scale_events_exports = {};
|
|
|
256508
256736
|
__export(scale_events_exports, {
|
|
256509
256737
|
default: () => scale_events_default
|
|
256510
256738
|
});
|
|
256511
|
-
var
|
|
256739
|
+
var import_rxjs25, scale_events_default;
|
|
256512
256740
|
var init_scale_events = __esm({
|
|
256513
256741
|
"src/commands/cluster/scale-events.ts"() {
|
|
256514
|
-
|
|
256742
|
+
import_rxjs25 = __toESM(require_cjs());
|
|
256515
256743
|
init_gql_client();
|
|
256516
256744
|
init_log();
|
|
256517
256745
|
init_cluster_change();
|
|
256518
256746
|
scale_events_default = async (cmd) => {
|
|
256519
256747
|
const limit = cmd.limit === void 0 ? 20 : parseIntOption("limit", cmd.limit, 1, 200);
|
|
256520
256748
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
256521
|
-
const events = await (0,
|
|
256749
|
+
const events = await (0, import_rxjs25.lastValueFrom)(
|
|
256522
256750
|
GraphqlClienAPI.clusterScaleEvents(projectId, clusterId, limit)
|
|
256523
256751
|
);
|
|
256524
256752
|
Logger.log("-------------------");
|
|
@@ -256548,17 +256776,17 @@ var cost_exports = {};
|
|
|
256548
256776
|
__export(cost_exports, {
|
|
256549
256777
|
default: () => cost_default
|
|
256550
256778
|
});
|
|
256551
|
-
var
|
|
256779
|
+
var import_rxjs26, money, cost_default;
|
|
256552
256780
|
var init_cost = __esm({
|
|
256553
256781
|
"src/commands/cluster/cost.ts"() {
|
|
256554
|
-
|
|
256782
|
+
import_rxjs26 = __toESM(require_cjs());
|
|
256555
256783
|
init_helpers();
|
|
256556
256784
|
init_gql_client();
|
|
256557
256785
|
init_log();
|
|
256558
256786
|
money = (v) => v == null ? "-" : v.toFixed(2);
|
|
256559
256787
|
cost_default = async (cmd) => {
|
|
256560
|
-
const projectId = await (0,
|
|
256561
|
-
const rows = await (0,
|
|
256788
|
+
const projectId = await (0, import_rxjs26.lastValueFrom)(parseProjectId(cmd.project));
|
|
256789
|
+
const rows = await (0, import_rxjs26.lastValueFrom)(
|
|
256562
256790
|
GraphqlClienAPI.projectClustersOverview(projectId)
|
|
256563
256791
|
);
|
|
256564
256792
|
Logger.log("-------------------");
|
|
@@ -256646,10 +256874,10 @@ __export(autoscale_exports, {
|
|
|
256646
256874
|
default: () => autoscale_default,
|
|
256647
256875
|
toAutoscaleInput: () => toAutoscaleInput
|
|
256648
256876
|
});
|
|
256649
|
-
var
|
|
256877
|
+
var import_rxjs27, toAutoscaleInput, autoscale_default;
|
|
256650
256878
|
var init_autoscale = __esm({
|
|
256651
256879
|
"src/commands/cluster/autoscale.ts"() {
|
|
256652
|
-
|
|
256880
|
+
import_rxjs27 = __toESM(require_cjs());
|
|
256653
256881
|
init_gql_client();
|
|
256654
256882
|
init_log();
|
|
256655
256883
|
init_cluster_change();
|
|
@@ -256713,7 +256941,7 @@ var init_autoscale = __esm({
|
|
|
256713
256941
|
autoscale_default = async (cmd) => {
|
|
256714
256942
|
const input = toAutoscaleInput(cmd);
|
|
256715
256943
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
256716
|
-
const cluster = await (0,
|
|
256944
|
+
const cluster = await (0, import_rxjs27.lastValueFrom)(
|
|
256717
256945
|
GraphqlClienAPI.updateProjectClusterAutoscale(projectId, clusterId, input)
|
|
256718
256946
|
);
|
|
256719
256947
|
const a = cluster.autoscale ?? {};
|
|
@@ -256747,16 +256975,16 @@ var plan_exports = {};
|
|
|
256747
256975
|
__export(plan_exports, {
|
|
256748
256976
|
default: () => plan_default
|
|
256749
256977
|
});
|
|
256750
|
-
var
|
|
256978
|
+
var import_rxjs28, plan_default;
|
|
256751
256979
|
var init_plan2 = __esm({
|
|
256752
256980
|
"src/commands/cluster/plan.ts"() {
|
|
256753
|
-
|
|
256981
|
+
import_rxjs28 = __toESM(require_cjs());
|
|
256754
256982
|
init_gql_client();
|
|
256755
256983
|
init_log();
|
|
256756
256984
|
init_cluster_change();
|
|
256757
256985
|
plan_default = async (cmd) => {
|
|
256758
256986
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
256759
|
-
const plan = await (0,
|
|
256987
|
+
const plan = await (0, import_rxjs28.lastValueFrom)(
|
|
256760
256988
|
GraphqlClienAPI.clusterProvisioningPlan(projectId, clusterId)
|
|
256761
256989
|
);
|
|
256762
256990
|
Logger.log("-------------------");
|
|
@@ -256880,15 +257108,15 @@ var list_environments_exports = {};
|
|
|
256880
257108
|
__export(list_environments_exports, {
|
|
256881
257109
|
default: () => list_environments_default
|
|
256882
257110
|
});
|
|
256883
|
-
var
|
|
257111
|
+
var import_rxjs29, import_operators12, list_environments_default;
|
|
256884
257112
|
var init_list_environments = __esm({
|
|
256885
257113
|
"src/commands/environment/list-environments.ts"() {
|
|
256886
|
-
|
|
257114
|
+
import_rxjs29 = __toESM(require_cjs());
|
|
256887
257115
|
import_operators12 = __toESM(require_operators());
|
|
256888
257116
|
init_helpers();
|
|
256889
257117
|
init_gql_client();
|
|
256890
257118
|
init_log();
|
|
256891
|
-
list_environments_default = (cmd) => (0,
|
|
257119
|
+
list_environments_default = (cmd) => (0, import_rxjs29.lastValueFrom)(
|
|
256892
257120
|
parseProjectId(cmd.project).pipe(
|
|
256893
257121
|
(0, import_operators12.switchMap)((projectId) => GraphqlClienAPI.listEnvironments(projectId)),
|
|
256894
257122
|
(0, import_operators12.tap)((data) => {
|
|
@@ -256960,10 +257188,10 @@ var create_environment_exports = {};
|
|
|
256960
257188
|
__export(create_environment_exports, {
|
|
256961
257189
|
default: () => create_environment_default
|
|
256962
257190
|
});
|
|
256963
|
-
var
|
|
257191
|
+
var import_rxjs30, import_operators13, create_environment_default;
|
|
256964
257192
|
var init_create_environment = __esm({
|
|
256965
257193
|
"src/commands/environment/create-environment.ts"() {
|
|
256966
|
-
|
|
257194
|
+
import_rxjs30 = __toESM(require_cjs());
|
|
256967
257195
|
import_operators13 = __toESM(require_operators());
|
|
256968
257196
|
init_helpers();
|
|
256969
257197
|
init_gql_client();
|
|
@@ -256972,7 +257200,7 @@ var init_create_environment = __esm({
|
|
|
256972
257200
|
init_environment_payload();
|
|
256973
257201
|
create_environment_default = (cmd) => {
|
|
256974
257202
|
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
256975
|
-
return (0,
|
|
257203
|
+
return (0, import_rxjs30.lastValueFrom)(
|
|
256976
257204
|
parseProjectId(cmd.project).pipe(
|
|
256977
257205
|
(0, import_operators13.switchMap)(
|
|
256978
257206
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -257026,10 +257254,10 @@ var update_environment_exports = {};
|
|
|
257026
257254
|
__export(update_environment_exports, {
|
|
257027
257255
|
default: () => update_environment_default
|
|
257028
257256
|
});
|
|
257029
|
-
var
|
|
257257
|
+
var import_rxjs31, import_operators14, update_environment_default;
|
|
257030
257258
|
var init_update_environment = __esm({
|
|
257031
257259
|
"src/commands/environment/update-environment.ts"() {
|
|
257032
|
-
|
|
257260
|
+
import_rxjs31 = __toESM(require_cjs());
|
|
257033
257261
|
import_operators14 = __toESM(require_operators());
|
|
257034
257262
|
init_helpers();
|
|
257035
257263
|
init_gql_client();
|
|
@@ -257038,7 +257266,7 @@ var init_update_environment = __esm({
|
|
|
257038
257266
|
init_environment_payload();
|
|
257039
257267
|
update_environment_default = (cmd) => {
|
|
257040
257268
|
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
257041
|
-
return (0,
|
|
257269
|
+
return (0, import_rxjs31.lastValueFrom)(
|
|
257042
257270
|
parseProjectId(cmd.project).pipe(
|
|
257043
257271
|
(0, import_operators14.switchMap)(
|
|
257044
257272
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -257093,16 +257321,16 @@ var delete_environment_exports = {};
|
|
|
257093
257321
|
__export(delete_environment_exports, {
|
|
257094
257322
|
default: () => delete_environment_default
|
|
257095
257323
|
});
|
|
257096
|
-
var
|
|
257324
|
+
var import_rxjs32, import_operators15, delete_environment_default;
|
|
257097
257325
|
var init_delete_environment = __esm({
|
|
257098
257326
|
"src/commands/environment/delete-environment.ts"() {
|
|
257099
|
-
|
|
257327
|
+
import_rxjs32 = __toESM(require_cjs());
|
|
257100
257328
|
import_operators15 = __toESM(require_operators());
|
|
257101
257329
|
init_helpers();
|
|
257102
257330
|
init_gql_client();
|
|
257103
257331
|
init_log();
|
|
257104
257332
|
init_load_spec();
|
|
257105
|
-
delete_environment_default = (cmd) => (0,
|
|
257333
|
+
delete_environment_default = (cmd) => (0, import_rxjs32.lastValueFrom)(
|
|
257106
257334
|
parseProjectId(cmd.project).pipe(
|
|
257107
257335
|
(0, import_operators15.switchMap)(
|
|
257108
257336
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -257155,16 +257383,16 @@ var get_environment_exports = {};
|
|
|
257155
257383
|
__export(get_environment_exports, {
|
|
257156
257384
|
default: () => get_environment_default
|
|
257157
257385
|
});
|
|
257158
|
-
var
|
|
257386
|
+
var import_rxjs33, import_operators16, get_environment_default;
|
|
257159
257387
|
var init_get_environment = __esm({
|
|
257160
257388
|
"src/commands/environment/get-environment.ts"() {
|
|
257161
|
-
|
|
257389
|
+
import_rxjs33 = __toESM(require_cjs());
|
|
257162
257390
|
import_operators16 = __toESM(require_operators());
|
|
257163
257391
|
init_helpers();
|
|
257164
257392
|
init_gql_client();
|
|
257165
257393
|
init_log();
|
|
257166
257394
|
init_load_spec();
|
|
257167
|
-
get_environment_default = (cmd) => (0,
|
|
257395
|
+
get_environment_default = (cmd) => (0, import_rxjs33.lastValueFrom)(
|
|
257168
257396
|
parseProjectId(cmd.project).pipe(
|
|
257169
257397
|
(0, import_operators16.switchMap)(
|
|
257170
257398
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -288422,22 +288650,22 @@ var package_exports = {};
|
|
|
288422
288650
|
__export(package_exports, {
|
|
288423
288651
|
default: () => package_default
|
|
288424
288652
|
});
|
|
288425
|
-
var import_archiver, import_child_process3, import_fs5,
|
|
288653
|
+
var import_archiver, import_child_process3, import_fs5, import_rxjs34, import_operators17, import_util3, ReadFile, package_default;
|
|
288426
288654
|
var init_package = __esm({
|
|
288427
288655
|
"src/commands/lambda/package.ts"() {
|
|
288428
288656
|
import_archiver = __toESM(require_archiver());
|
|
288429
288657
|
import_child_process3 = require("child_process");
|
|
288430
288658
|
import_fs5 = require("fs");
|
|
288431
|
-
|
|
288659
|
+
import_rxjs34 = __toESM(require_cjs());
|
|
288432
288660
|
import_operators17 = __toESM(require_operators());
|
|
288433
288661
|
import_util3 = require("util");
|
|
288434
288662
|
init_helpers2();
|
|
288435
288663
|
init_load_spec();
|
|
288436
288664
|
init_parse_ignore();
|
|
288437
288665
|
init_read_file();
|
|
288438
|
-
ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0,
|
|
288666
|
+
ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0, import_rxjs34.of)("")));
|
|
288439
288667
|
package_default = (cmd) => {
|
|
288440
|
-
return (0,
|
|
288668
|
+
return (0, import_rxjs34.lastValueFrom)(
|
|
288441
288669
|
loadSpec(cmd.spec).pipe(
|
|
288442
288670
|
(0, import_operators17.map)((spec) => spec?.function ?? spec),
|
|
288443
288671
|
(0, import_operators17.switchMap)(async (data) => {
|
|
@@ -288446,7 +288674,7 @@ var init_package = __esm({
|
|
|
288446
288674
|
// Sets the compression level.
|
|
288447
288675
|
});
|
|
288448
288676
|
await (0, import_util3.promisify)(import_child_process3.exec)(["chmod", "+x", data.script].join(" "));
|
|
288449
|
-
const ignore = await (0,
|
|
288677
|
+
const ignore = await (0, import_rxjs34.lastValueFrom)(
|
|
288450
288678
|
ReadFile(".gignore").pipe(
|
|
288451
288679
|
(0, import_operators17.map)((ignore2) => parseIgnoredFiles(ignore2))
|
|
288452
288680
|
)
|
|
@@ -288455,11 +288683,11 @@ var init_package = __esm({
|
|
|
288455
288683
|
ignore: [".gcache/**", ...ignore]
|
|
288456
288684
|
});
|
|
288457
288685
|
archive.finalize();
|
|
288458
|
-
return (0,
|
|
288459
|
-
(0,
|
|
288686
|
+
return (0, import_rxjs34.lastValueFrom)(
|
|
288687
|
+
(0, import_rxjs34.from)(streamToBufferPromise(archive)).pipe(
|
|
288460
288688
|
(0, import_operators17.switchMap)(
|
|
288461
|
-
(buffer) => (0,
|
|
288462
|
-
(0, import_operators17.catchError)(() => (0,
|
|
288689
|
+
(buffer) => (0, import_rxjs34.from)((0, import_util3.promisify)(import_fs5.mkdir)(".gcache")).pipe(
|
|
288690
|
+
(0, import_operators17.catchError)(() => (0, import_rxjs34.of)(true)),
|
|
288463
288691
|
(0, import_operators17.switchMap)(
|
|
288464
288692
|
() => (0, import_util3.promisify)(import_fs5.writeFile)(`.gcache/${data.name}.zip`, buffer)
|
|
288465
288693
|
)
|
|
@@ -288485,13 +288713,13 @@ function streamToBufferPromise(file2) {
|
|
|
288485
288713
|
});
|
|
288486
288714
|
});
|
|
288487
288715
|
}
|
|
288488
|
-
var import_form_data, import_fs6,
|
|
288716
|
+
var import_form_data, import_fs6, import_rxjs35, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, printAddresses, createCommand;
|
|
288489
288717
|
var init_helpers2 = __esm({
|
|
288490
288718
|
"src/commands/lambda/helpers/index.ts"() {
|
|
288491
288719
|
import_form_data = __toESM(require_form_data());
|
|
288492
288720
|
import_fs6 = require("fs");
|
|
288493
288721
|
init_src();
|
|
288494
|
-
|
|
288722
|
+
import_rxjs35 = __toESM(require_cjs());
|
|
288495
288723
|
import_operators18 = __toESM(require_operators());
|
|
288496
288724
|
import_stream_to_buffer = __toESM(require_stream_to_buffer());
|
|
288497
288725
|
init_helpers();
|
|
@@ -288500,14 +288728,14 @@ var init_helpers2 = __esm({
|
|
|
288500
288728
|
init_package();
|
|
288501
288729
|
init_load_spec();
|
|
288502
288730
|
init_read_file();
|
|
288503
|
-
ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0,
|
|
288504
|
-
createOrUpdateLambda = (cmd, type) => (0,
|
|
288731
|
+
ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0, import_rxjs35.of)("")));
|
|
288732
|
+
createOrUpdateLambda = (cmd, type) => (0, import_rxjs35.lastValueFrom)(
|
|
288505
288733
|
parseProjectId(cmd.project).pipe(
|
|
288506
288734
|
(0, import_operators18.switchMap)(
|
|
288507
288735
|
(projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators18.map)(() => projectId))
|
|
288508
288736
|
),
|
|
288509
288737
|
(0, import_operators18.switchMap)(async (projectId) => {
|
|
288510
|
-
const spec = await (0,
|
|
288738
|
+
const spec = await (0, import_rxjs35.lastValueFrom)(loadSpec(cmd.spec));
|
|
288511
288739
|
return {
|
|
288512
288740
|
projectId,
|
|
288513
288741
|
...spec?.function ?? spec
|
|
@@ -288522,9 +288750,9 @@ var init_helpers2 = __esm({
|
|
|
288522
288750
|
await package_default(cmd);
|
|
288523
288751
|
const body = new import_form_data.default();
|
|
288524
288752
|
body.append("file[]", (0, import_fs6.createReadStream)(`.gcache/${data.name}.zip`));
|
|
288525
|
-
const config2 = await (0,
|
|
288526
|
-
return (0,
|
|
288527
|
-
(0,
|
|
288753
|
+
const config2 = await (0, import_rxjs35.lastValueFrom)(GraphqlClienAPI.getConfig());
|
|
288754
|
+
return (0, import_rxjs35.lastValueFrom)(
|
|
288755
|
+
(0, import_rxjs35.from)(
|
|
288528
288756
|
fetch2(config2.uploadUrl, {
|
|
288529
288757
|
method: "POST",
|
|
288530
288758
|
body,
|
|
@@ -288545,23 +288773,23 @@ var init_helpers2 = __esm({
|
|
|
288545
288773
|
);
|
|
288546
288774
|
}),
|
|
288547
288775
|
(0, import_operators18.switchMap)(async (payload) => {
|
|
288548
|
-
const clusterId = await (0,
|
|
288776
|
+
const clusterId = await (0, import_rxjs35.lastValueFrom)(
|
|
288549
288777
|
resolveClusterId(payload.projectId, {
|
|
288550
288778
|
clusterId: cmd.clusterId || payload.clusterId,
|
|
288551
288779
|
clusterName: cmd.clusterName || payload.clusterName
|
|
288552
288780
|
})
|
|
288553
288781
|
);
|
|
288554
|
-
return (0,
|
|
288782
|
+
return (0, import_rxjs35.lastValueFrom)(
|
|
288555
288783
|
GraphqlClienAPI[type]({
|
|
288556
|
-
code: cmd.code || await (0,
|
|
288784
|
+
code: cmd.code || await (0, import_rxjs35.lastValueFrom)(ReadFile2(cmd.file || payload.file)) || "",
|
|
288557
288785
|
name: cmd.name || payload.name || "",
|
|
288558
288786
|
projectId: payload.projectId,
|
|
288559
288787
|
route: cmd.route || payload.route || "",
|
|
288560
|
-
buildBashScript: cmd.buildBashScript || await (0,
|
|
288788
|
+
buildBashScript: cmd.buildBashScript || await (0, import_rxjs35.lastValueFrom)(ReadFile2(cmd.script || payload.script)) || "",
|
|
288561
288789
|
configs: cmd.configs || payload.configs || [],
|
|
288562
288790
|
env: cmd.env || payload.env || "nodejs",
|
|
288563
288791
|
method: cmd.method || payload.method || ["GET"],
|
|
288564
|
-
packageJson: cmd.packageJson || await (0,
|
|
288792
|
+
packageJson: cmd.packageJson || await (0, import_rxjs35.lastValueFrom)(ReadFile2(cmd.package || payload.package)) || "{}",
|
|
288565
288793
|
params: cmd.params || payload.params || [],
|
|
288566
288794
|
secrets: cmd.secrets || payload.secrets || [],
|
|
288567
288795
|
envSecrets: cmd.envSecrets || payload.envSecrets || [],
|
|
@@ -288608,8 +288836,8 @@ var init_helpers2 = __esm({
|
|
|
288608
288836
|
);
|
|
288609
288837
|
printAddresses = (data) => (data?.id ? GraphqlClienAPI.getLambda(data.id, ["siteUrl"]).pipe(
|
|
288610
288838
|
(0, import_operators18.map)((l) => l.siteUrl ?? null),
|
|
288611
|
-
(0, import_operators18.catchError)(() => (0,
|
|
288612
|
-
) : (0,
|
|
288839
|
+
(0, import_operators18.catchError)(() => (0, import_rxjs35.of)(null))
|
|
288840
|
+
) : (0, import_rxjs35.of)(null)).pipe(
|
|
288613
288841
|
(0, import_operators18.tap)((siteUrl) => {
|
|
288614
288842
|
if (data?.url) Logger.info(`URL: ${data.url}`);
|
|
288615
288843
|
if (siteUrl) Logger.info(`Site: ${siteUrl}`);
|
|
@@ -288631,15 +288859,15 @@ var list_exports2 = {};
|
|
|
288631
288859
|
__export(list_exports2, {
|
|
288632
288860
|
default: () => list_default2
|
|
288633
288861
|
});
|
|
288634
|
-
var
|
|
288862
|
+
var import_rxjs36, import_operators19, list_default2;
|
|
288635
288863
|
var init_list2 = __esm({
|
|
288636
288864
|
"src/commands/lambda/list.ts"() {
|
|
288637
|
-
|
|
288865
|
+
import_rxjs36 = __toESM(require_cjs());
|
|
288638
288866
|
import_operators19 = __toESM(require_operators());
|
|
288639
288867
|
init_helpers();
|
|
288640
288868
|
init_gql_client();
|
|
288641
288869
|
init_log();
|
|
288642
|
-
list_default2 = (cmd) => (0,
|
|
288870
|
+
list_default2 = (cmd) => (0, import_rxjs36.lastValueFrom)(
|
|
288643
288871
|
parseProjectId(cmd.project).pipe(
|
|
288644
288872
|
(0, import_operators19.switchMap)(
|
|
288645
288873
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288674,10 +288902,10 @@ var get_exports = {};
|
|
|
288674
288902
|
__export(get_exports, {
|
|
288675
288903
|
default: () => get_default
|
|
288676
288904
|
});
|
|
288677
|
-
var
|
|
288905
|
+
var import_rxjs37, import_operators20, get_default;
|
|
288678
288906
|
var init_get = __esm({
|
|
288679
288907
|
"src/commands/lambda/get.ts"() {
|
|
288680
|
-
|
|
288908
|
+
import_rxjs37 = __toESM(require_cjs());
|
|
288681
288909
|
import_operators20 = __toESM(require_operators());
|
|
288682
288910
|
init_helpers();
|
|
288683
288911
|
init_gql_client();
|
|
@@ -288699,26 +288927,26 @@ var init_get = __esm({
|
|
|
288699
288927
|
Logger.log("-------------------");
|
|
288700
288928
|
});
|
|
288701
288929
|
if (cmd.lambda) {
|
|
288702
|
-
return (0,
|
|
288930
|
+
return (0, import_rxjs37.lastValueFrom)(
|
|
288703
288931
|
isMongoId(cmd.lambda).pipe(
|
|
288704
288932
|
(0, import_operators20.switchMap)((id) => GraphqlClienAPI.getLambda(id)),
|
|
288705
288933
|
table
|
|
288706
288934
|
)
|
|
288707
288935
|
);
|
|
288708
288936
|
}
|
|
288709
|
-
const spec = await (0,
|
|
288937
|
+
const spec = await (0, import_rxjs37.lastValueFrom)(loadSpec(cmd.spec));
|
|
288710
288938
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288711
288939
|
if (name2) {
|
|
288712
|
-
return (0,
|
|
288940
|
+
return (0, import_rxjs37.lastValueFrom)(
|
|
288713
288941
|
parseProjectId(cmd.project).pipe(
|
|
288714
288942
|
(0, import_operators20.catchError)((error48) => {
|
|
288715
288943
|
if (!cmd.project) {
|
|
288716
|
-
return (0,
|
|
288944
|
+
return (0, import_rxjs37.throwError)(
|
|
288717
288945
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288718
288946
|
Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
|
|
288719
288947
|
);
|
|
288720
288948
|
}
|
|
288721
|
-
return (0,
|
|
288949
|
+
return (0, import_rxjs37.throwError)(() => error48);
|
|
288722
288950
|
}),
|
|
288723
288951
|
(0, import_operators20.switchMap)(
|
|
288724
288952
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288775,22 +289003,22 @@ var delete_exports = {};
|
|
|
288775
289003
|
__export(delete_exports, {
|
|
288776
289004
|
default: () => delete_default
|
|
288777
289005
|
});
|
|
288778
|
-
var
|
|
289006
|
+
var import_rxjs38, import_operators21, delete_default;
|
|
288779
289007
|
var init_delete = __esm({
|
|
288780
289008
|
"src/commands/lambda/delete.ts"() {
|
|
288781
|
-
|
|
289009
|
+
import_rxjs38 = __toESM(require_cjs());
|
|
288782
289010
|
import_operators21 = __toESM(require_operators());
|
|
288783
289011
|
init_helpers();
|
|
288784
289012
|
init_gql_client();
|
|
288785
289013
|
init_log();
|
|
288786
289014
|
init_load_spec();
|
|
288787
289015
|
delete_default = async (cmd) => {
|
|
288788
|
-
const spec = await (0,
|
|
289016
|
+
const spec = await (0, import_rxjs38.lastValueFrom)(loadSpec(cmd.spec));
|
|
288789
289017
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288790
289018
|
const env = cmd.env ?? spec.function?.env ?? spec.env;
|
|
288791
289019
|
const clusterIdHint = cmd.clusterId ?? spec.function?.clusterId ?? spec.clusterId;
|
|
288792
289020
|
const clusterNameHint = cmd.clusterName ?? spec.function?.clusterName ?? spec.clusterName;
|
|
288793
|
-
return (0,
|
|
289021
|
+
return (0, import_rxjs38.lastValueFrom)(
|
|
288794
289022
|
parseProjectId(cmd.project).pipe(
|
|
288795
289023
|
(0, import_operators21.switchMap)(
|
|
288796
289024
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288825,10 +289053,10 @@ var logs_exports = {};
|
|
|
288825
289053
|
__export(logs_exports, {
|
|
288826
289054
|
default: () => logs_default
|
|
288827
289055
|
});
|
|
288828
|
-
var
|
|
289056
|
+
var import_rxjs39, import_operators22, logs_default;
|
|
288829
289057
|
var init_logs = __esm({
|
|
288830
289058
|
"src/commands/lambda/logs.ts"() {
|
|
288831
|
-
|
|
289059
|
+
import_rxjs39 = __toESM(require_cjs());
|
|
288832
289060
|
import_operators22 = __toESM(require_operators());
|
|
288833
289061
|
init_helpers();
|
|
288834
289062
|
init_gql_client();
|
|
@@ -288837,26 +289065,26 @@ var init_logs = __esm({
|
|
|
288837
289065
|
logs_default = async (cmd) => {
|
|
288838
289066
|
const result = (0, import_operators22.tap)(({ data }) => Logger.log(data));
|
|
288839
289067
|
if (cmd.lambda) {
|
|
288840
|
-
return (0,
|
|
289068
|
+
return (0, import_rxjs39.lastValueFrom)(
|
|
288841
289069
|
isMongoId(cmd.lambda).pipe(
|
|
288842
289070
|
(0, import_operators22.switchMap)((id) => GraphqlClienAPI.getLambdaLogs(id)),
|
|
288843
289071
|
result
|
|
288844
289072
|
)
|
|
288845
289073
|
);
|
|
288846
289074
|
}
|
|
288847
|
-
const spec = await (0,
|
|
289075
|
+
const spec = await (0, import_rxjs39.lastValueFrom)(loadSpec(cmd.spec));
|
|
288848
289076
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288849
289077
|
if (name2) {
|
|
288850
|
-
return (0,
|
|
289078
|
+
return (0, import_rxjs39.lastValueFrom)(
|
|
288851
289079
|
parseProjectId(cmd.project).pipe(
|
|
288852
289080
|
(0, import_operators22.catchError)((error48) => {
|
|
288853
289081
|
if (!cmd.project) {
|
|
288854
|
-
return (0,
|
|
289082
|
+
return (0, import_rxjs39.throwError)(
|
|
288855
289083
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288856
289084
|
Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
|
|
288857
289085
|
);
|
|
288858
289086
|
}
|
|
288859
|
-
return (0,
|
|
289087
|
+
return (0, import_rxjs39.throwError)(() => error48);
|
|
288860
289088
|
}),
|
|
288861
289089
|
(0, import_operators22.switchMap)(
|
|
288862
289090
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288882,10 +289110,10 @@ var logs_builder_exports = {};
|
|
|
288882
289110
|
__export(logs_builder_exports, {
|
|
288883
289111
|
default: () => logs_builder_default
|
|
288884
289112
|
});
|
|
288885
|
-
var
|
|
289113
|
+
var import_rxjs40, import_operators23, logs_builder_default;
|
|
288886
289114
|
var init_logs_builder = __esm({
|
|
288887
289115
|
"src/commands/lambda/logs-builder.ts"() {
|
|
288888
|
-
|
|
289116
|
+
import_rxjs40 = __toESM(require_cjs());
|
|
288889
289117
|
import_operators23 = __toESM(require_operators());
|
|
288890
289118
|
init_helpers();
|
|
288891
289119
|
init_gql_client();
|
|
@@ -288894,26 +289122,26 @@ var init_logs_builder = __esm({
|
|
|
288894
289122
|
logs_builder_default = async (cmd) => {
|
|
288895
289123
|
const result = (0, import_operators23.tap)(({ data }) => Logger.log(data));
|
|
288896
289124
|
if (cmd.lambda) {
|
|
288897
|
-
return (0,
|
|
289125
|
+
return (0, import_rxjs40.lastValueFrom)(
|
|
288898
289126
|
isMongoId(cmd.lambda).pipe(
|
|
288899
289127
|
(0, import_operators23.switchMap)((id) => GraphqlClienAPI.getLambdaBuilderLogs(id)),
|
|
288900
289128
|
result
|
|
288901
289129
|
)
|
|
288902
289130
|
);
|
|
288903
289131
|
}
|
|
288904
|
-
const spec = await (0,
|
|
289132
|
+
const spec = await (0, import_rxjs40.lastValueFrom)(loadSpec(cmd.spec));
|
|
288905
289133
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288906
289134
|
if (name2) {
|
|
288907
|
-
return (0,
|
|
289135
|
+
return (0, import_rxjs40.lastValueFrom)(
|
|
288908
289136
|
parseProjectId(cmd.project).pipe(
|
|
288909
289137
|
(0, import_operators23.catchError)((error48) => {
|
|
288910
289138
|
if (!cmd.project) {
|
|
288911
|
-
return (0,
|
|
289139
|
+
return (0, import_rxjs40.throwError)(
|
|
288912
289140
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288913
289141
|
Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
|
|
288914
289142
|
);
|
|
288915
289143
|
}
|
|
288916
|
-
return (0,
|
|
289144
|
+
return (0, import_rxjs40.throwError)(() => error48);
|
|
288917
289145
|
}),
|
|
288918
289146
|
(0, import_operators23.switchMap)(
|
|
288919
289147
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288943,18 +289171,18 @@ var test_exports = {};
|
|
|
288943
289171
|
__export(test_exports, {
|
|
288944
289172
|
default: () => test_default
|
|
288945
289173
|
});
|
|
288946
|
-
var
|
|
289174
|
+
var import_rxjs41, import_operators24, test_default;
|
|
288947
289175
|
var init_test = __esm({
|
|
288948
289176
|
"src/commands/lambda/test.ts"() {
|
|
288949
|
-
|
|
289177
|
+
import_rxjs41 = __toESM(require_cjs());
|
|
288950
289178
|
import_operators24 = __toESM(require_operators());
|
|
288951
289179
|
init_helpers();
|
|
288952
289180
|
init_gql_client();
|
|
288953
289181
|
init_log();
|
|
288954
289182
|
init_load_spec();
|
|
288955
289183
|
test_default = async (cmd) => {
|
|
288956
|
-
const spec = await (0,
|
|
288957
|
-
const processParameters = (lambda) => (0,
|
|
289184
|
+
const spec = await (0, import_rxjs41.lastValueFrom)(loadSpec(cmd.spec));
|
|
289185
|
+
const processParameters = (lambda) => (0, import_rxjs41.of)(lambda).pipe(
|
|
288958
289186
|
(0, import_operators24.map)((lambda2) => ({
|
|
288959
289187
|
...lambda2,
|
|
288960
289188
|
url: cmd.pathParams ? cmd.pathParams.split(";").map((param) => param.split("=")).reduce(
|
|
@@ -288968,7 +289196,7 @@ var init_test = __esm({
|
|
|
288968
289196
|
);
|
|
288969
289197
|
}),
|
|
288970
289198
|
(0, import_operators24.switchMap)(
|
|
288971
|
-
(lambda2) => (0,
|
|
289199
|
+
(lambda2) => (0, import_rxjs41.from)(
|
|
288972
289200
|
fetch([lambda2.url, cmd.queryParams].filter((i2) => !!i2).join(""), {
|
|
288973
289201
|
method: cmd?.method ?? "GET",
|
|
288974
289202
|
body: cmd.body
|
|
@@ -288984,7 +289212,7 @@ var init_test = __esm({
|
|
|
288984
289212
|
})
|
|
288985
289213
|
);
|
|
288986
289214
|
if (cmd.lambda) {
|
|
288987
|
-
return (0,
|
|
289215
|
+
return (0, import_rxjs41.lastValueFrom)(
|
|
288988
289216
|
isMongoId(cmd.lambda).pipe(
|
|
288989
289217
|
(0, import_operators24.switchMap)(
|
|
288990
289218
|
(id) => GraphqlClienAPI.getLambda(id, ["id", "url", "method", "params"])
|
|
@@ -288995,16 +289223,16 @@ var init_test = __esm({
|
|
|
288995
289223
|
}
|
|
288996
289224
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288997
289225
|
if (name2) {
|
|
288998
|
-
return (0,
|
|
289226
|
+
return (0, import_rxjs41.lastValueFrom)(
|
|
288999
289227
|
parseProjectId(cmd.project).pipe(
|
|
289000
289228
|
(0, import_operators24.catchError)((error48) => {
|
|
289001
289229
|
if (!cmd.project) {
|
|
289002
|
-
return (0,
|
|
289230
|
+
return (0, import_rxjs41.throwError)(
|
|
289003
289231
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
289004
289232
|
Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
|
|
289005
289233
|
);
|
|
289006
289234
|
}
|
|
289007
|
-
return (0,
|
|
289235
|
+
return (0, import_rxjs41.throwError)(() => error48);
|
|
289008
289236
|
}),
|
|
289009
289237
|
(0, import_operators24.switchMap)(
|
|
289010
289238
|
(projectId) => GraphqlClienAPI.getLambdaByName(name2, projectId, [
|
|
@@ -289028,14 +289256,14 @@ var list_exports3 = {};
|
|
|
289028
289256
|
__export(list_exports3, {
|
|
289029
289257
|
default: () => list_default3
|
|
289030
289258
|
});
|
|
289031
|
-
var
|
|
289259
|
+
var import_rxjs42, import_operators25, list_default3;
|
|
289032
289260
|
var init_list3 = __esm({
|
|
289033
289261
|
"src/commands/plugin/list.ts"() {
|
|
289034
|
-
|
|
289262
|
+
import_rxjs42 = __toESM(require_cjs());
|
|
289035
289263
|
import_operators25 = __toESM(require_operators());
|
|
289036
289264
|
init_gql_client();
|
|
289037
289265
|
init_log();
|
|
289038
|
-
list_default3 = () => (0,
|
|
289266
|
+
list_default3 = () => (0, import_rxjs42.lastValueFrom)(
|
|
289039
289267
|
GraphqlClienAPI.listAvailablePlugins().pipe(
|
|
289040
289268
|
(0, import_operators25.tap)((plugins) => {
|
|
289041
289269
|
Logger.log("-------------------");
|
|
@@ -289060,15 +289288,15 @@ var installed_exports = {};
|
|
|
289060
289288
|
__export(installed_exports, {
|
|
289061
289289
|
default: () => installed_default
|
|
289062
289290
|
});
|
|
289063
|
-
var
|
|
289291
|
+
var import_rxjs43, import_operators26, installed_default;
|
|
289064
289292
|
var init_installed = __esm({
|
|
289065
289293
|
"src/commands/plugin/installed.ts"() {
|
|
289066
|
-
|
|
289294
|
+
import_rxjs43 = __toESM(require_cjs());
|
|
289067
289295
|
import_operators26 = __toESM(require_operators());
|
|
289068
289296
|
init_helpers();
|
|
289069
289297
|
init_gql_client();
|
|
289070
289298
|
init_log();
|
|
289071
|
-
installed_default = (cmd) => (0,
|
|
289299
|
+
installed_default = (cmd) => (0, import_rxjs43.lastValueFrom)(
|
|
289072
289300
|
parseProjectId(cmd.project).pipe(
|
|
289073
289301
|
(0, import_operators26.switchMap)((projectId) => GraphqlClienAPI.listInstalledPlugins(projectId)),
|
|
289074
289302
|
(0, import_operators26.tap)((installed) => {
|
|
@@ -289099,16 +289327,16 @@ var install_exports = {};
|
|
|
289099
289327
|
__export(install_exports, {
|
|
289100
289328
|
default: () => install_default
|
|
289101
289329
|
});
|
|
289102
|
-
var
|
|
289330
|
+
var import_rxjs44, import_operators27, install_default;
|
|
289103
289331
|
var init_install = __esm({
|
|
289104
289332
|
"src/commands/plugin/install.ts"() {
|
|
289105
|
-
|
|
289333
|
+
import_rxjs44 = __toESM(require_cjs());
|
|
289106
289334
|
import_operators27 = __toESM(require_operators());
|
|
289107
289335
|
init_helpers();
|
|
289108
289336
|
init_gql_client();
|
|
289109
289337
|
init_log();
|
|
289110
289338
|
init_load_spec();
|
|
289111
|
-
install_default = (cmd) => (0,
|
|
289339
|
+
install_default = (cmd) => (0, import_rxjs44.lastValueFrom)(
|
|
289112
289340
|
parseProjectId(cmd.project).pipe(
|
|
289113
289341
|
(0, import_operators27.switchMap)(
|
|
289114
289342
|
(projectId) => loadSpec(
|
|
@@ -289117,7 +289345,7 @@ var init_install = __esm({
|
|
|
289117
289345
|
// No spec file is required at all if --name/--cluster fully
|
|
289118
289346
|
// cover it (unlike every other resource here, a plugin install
|
|
289119
289347
|
// is often just "install this by name", no YAML needed).
|
|
289120
|
-
(0, import_operators27.catchError)(() => (0,
|
|
289348
|
+
(0, import_operators27.catchError)(() => (0, import_rxjs44.of)(void 0)),
|
|
289121
289349
|
(0, import_operators27.map)((data) => ({
|
|
289122
289350
|
projectId,
|
|
289123
289351
|
...data ? data.plugin ?? data : {}
|
|
@@ -289148,15 +289376,15 @@ var uninstall_exports = {};
|
|
|
289148
289376
|
__export(uninstall_exports, {
|
|
289149
289377
|
default: () => uninstall_default
|
|
289150
289378
|
});
|
|
289151
|
-
var
|
|
289379
|
+
var import_rxjs45, import_operators28, uninstall_default;
|
|
289152
289380
|
var init_uninstall = __esm({
|
|
289153
289381
|
"src/commands/plugin/uninstall.ts"() {
|
|
289154
|
-
|
|
289382
|
+
import_rxjs45 = __toESM(require_cjs());
|
|
289155
289383
|
import_operators28 = __toESM(require_operators());
|
|
289156
289384
|
init_helpers();
|
|
289157
289385
|
init_gql_client();
|
|
289158
289386
|
init_log();
|
|
289159
|
-
uninstall_default = (cmd) => (0,
|
|
289387
|
+
uninstall_default = (cmd) => (0, import_rxjs45.lastValueFrom)(
|
|
289160
289388
|
parseProjectId(cmd.project).pipe(
|
|
289161
289389
|
(0, import_operators28.switchMap)(
|
|
289162
289390
|
(projectId) => GraphqlClienAPI.uninstallPlugin(projectId, cmd.name, cmd.cluster)
|
|
@@ -289176,14 +289404,14 @@ var list_exports4 = {};
|
|
|
289176
289404
|
__export(list_exports4, {
|
|
289177
289405
|
default: () => list_default4
|
|
289178
289406
|
});
|
|
289179
|
-
var
|
|
289407
|
+
var import_rxjs46, import_operators29, list_default4;
|
|
289180
289408
|
var init_list4 = __esm({
|
|
289181
289409
|
"src/commands/project/list.ts"() {
|
|
289182
|
-
|
|
289410
|
+
import_rxjs46 = __toESM(require_cjs());
|
|
289183
289411
|
import_operators29 = __toESM(require_operators());
|
|
289184
289412
|
init_gql_client();
|
|
289185
289413
|
init_log();
|
|
289186
|
-
list_default4 = async () => (0,
|
|
289414
|
+
list_default4 = async () => (0, import_rxjs46.lastValueFrom)(
|
|
289187
289415
|
GraphqlClienAPI.listProjects().pipe(
|
|
289188
289416
|
(0, import_operators29.tap)((project) => {
|
|
289189
289417
|
const columns = ["id", "name"];
|
|
@@ -289202,24 +289430,24 @@ var use_exports = {};
|
|
|
289202
289430
|
__export(use_exports, {
|
|
289203
289431
|
default: () => use_default
|
|
289204
289432
|
});
|
|
289205
|
-
var import_fs7,
|
|
289433
|
+
var import_fs7, import_rxjs47, import_operators30, import_util4, use_default;
|
|
289206
289434
|
var init_use = __esm({
|
|
289207
289435
|
"src/commands/project/use.ts"() {
|
|
289208
289436
|
import_fs7 = require("fs");
|
|
289209
|
-
|
|
289437
|
+
import_rxjs47 = __toESM(require_cjs());
|
|
289210
289438
|
import_operators30 = __toESM(require_operators());
|
|
289211
289439
|
import_util4 = require("util");
|
|
289212
289440
|
init_helpers();
|
|
289213
289441
|
init_gql_client();
|
|
289214
289442
|
init_types();
|
|
289215
289443
|
use_default = async (cmd) => {
|
|
289216
|
-
return (0,
|
|
289444
|
+
return (0, import_rxjs47.lastValueFrom)(
|
|
289217
289445
|
parseProjectId(cmd).pipe(
|
|
289218
289446
|
(0, import_operators30.switchMap)(
|
|
289219
289447
|
(projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators30.map)(() => projectId))
|
|
289220
289448
|
),
|
|
289221
289449
|
(0, import_operators30.switchMap)(
|
|
289222
|
-
(projectId) => (0,
|
|
289450
|
+
(projectId) => (0, import_rxjs47.from)(
|
|
289223
289451
|
(0, import_util4.promisify)(import_fs7.writeFile)(projectDirectory, projectId, {
|
|
289224
289452
|
encoding: "utf-8"
|
|
289225
289453
|
})
|
|
@@ -320162,7 +320390,7 @@ async function startProxy(cmd) {
|
|
|
320162
320390
|
cmd.url ? cmd.url.replace(/\/mcp\/?$/, "") : "https://api.lambforge.com"
|
|
320163
320391
|
);
|
|
320164
320392
|
}
|
|
320165
|
-
return (0,
|
|
320393
|
+
return (0, import_rxjs48.lastValueFrom)(
|
|
320166
320394
|
GraphqlClienAPI.getConfig().pipe(
|
|
320167
320395
|
(0, import_operators31.take)(1),
|
|
320168
320396
|
(0, import_operators31.map)((config2) => ({
|
|
@@ -320178,7 +320406,7 @@ async function startProxy(cmd) {
|
|
|
320178
320406
|
process.stderr.write("Retrieving config for auth...\n");
|
|
320179
320407
|
}),
|
|
320180
320408
|
(0, import_operators31.switchMap)(
|
|
320181
|
-
(config2) => config2?.token ? (0,
|
|
320409
|
+
(config2) => config2?.token ? (0, import_rxjs48.of)(config2) : (0, import_rxjs48.throwError)(
|
|
320182
320410
|
() => new Error("User is not authenticated (no token in config)")
|
|
320183
320411
|
)
|
|
320184
320412
|
),
|
|
@@ -320196,7 +320424,7 @@ async function startProxy(cmd) {
|
|
|
320196
320424
|
Authorization: config2.token
|
|
320197
320425
|
}
|
|
320198
320426
|
},
|
|
320199
|
-
fetch: (input, init) => (0,
|
|
320427
|
+
fetch: (input, init) => (0, import_rxjs48.lastValueFrom)(performFetch(input, init))
|
|
320200
320428
|
}),
|
|
320201
320429
|
client: new Client({
|
|
320202
320430
|
name: "gapi-proxy-client",
|
|
@@ -320207,7 +320435,7 @@ async function startProxy(cmd) {
|
|
|
320207
320435
|
process.stderr.write("Connecting to upstream...\n");
|
|
320208
320436
|
}),
|
|
320209
320437
|
(0, import_operators31.switchMap)(
|
|
320210
|
-
(config2) => (0,
|
|
320438
|
+
(config2) => (0, import_rxjs48.from)(config2.client.connect(config2.transport)).pipe((0, import_operators31.map)(() => config2))
|
|
320211
320439
|
),
|
|
320212
320440
|
(0, import_operators31.tap)(() => {
|
|
320213
320441
|
process.stderr.write("Connected to upstream MCP server\n");
|
|
@@ -320233,25 +320461,25 @@ async function startProxy(cmd) {
|
|
|
320233
320461
|
capabilities: config2.capabilities || {}
|
|
320234
320462
|
}
|
|
320235
320463
|
);
|
|
320236
|
-
server2.fallbackRequestHandler = async (request) => (0,
|
|
320237
|
-
(0,
|
|
320464
|
+
server2.fallbackRequestHandler = async (request) => (0, import_rxjs48.lastValueFrom)(
|
|
320465
|
+
(0, import_rxjs48.defer)(() => config2.client.request(request, external_exports3.any())).pipe(
|
|
320238
320466
|
(0, import_operators31.catchError)((e2) => {
|
|
320239
320467
|
process.stderr.write(`Upstream error: ${e2.message}
|
|
320240
320468
|
`);
|
|
320241
|
-
return (0,
|
|
320469
|
+
return (0, import_rxjs48.throwError)(() => e2);
|
|
320242
320470
|
})
|
|
320243
320471
|
)
|
|
320244
320472
|
);
|
|
320245
320473
|
server2.fallbackNotificationHandler = async (notification) => {
|
|
320246
|
-
await (0,
|
|
320247
|
-
(0,
|
|
320474
|
+
await (0, import_rxjs48.lastValueFrom)(
|
|
320475
|
+
(0, import_rxjs48.of)(notification).pipe(
|
|
320248
320476
|
(0, import_operators31.filter)((n) => n.method !== "notifications/initialized"),
|
|
320249
320477
|
(0, import_operators31.switchMap)(
|
|
320250
|
-
(n) => (0,
|
|
320478
|
+
(n) => (0, import_rxjs48.defer)(() => config2.client.notification(n)).pipe(
|
|
320251
320479
|
(0, import_operators31.catchError)((e2) => {
|
|
320252
320480
|
process.stderr.write(`Notification error: ${e2}
|
|
320253
320481
|
`);
|
|
320254
|
-
return
|
|
320482
|
+
return import_rxjs48.EMPTY;
|
|
320255
320483
|
})
|
|
320256
320484
|
)
|
|
320257
320485
|
),
|
|
@@ -320261,7 +320489,7 @@ async function startProxy(cmd) {
|
|
|
320261
320489
|
};
|
|
320262
320490
|
return server2;
|
|
320263
320491
|
}),
|
|
320264
|
-
(0, import_operators31.switchMap)((server2) => (0,
|
|
320492
|
+
(0, import_operators31.switchMap)((server2) => (0, import_rxjs48.from)(server2.connect(new StdioServerTransport()))),
|
|
320265
320493
|
(0, import_operators31.tap)(() => {
|
|
320266
320494
|
process.stderr.write("MCP stdio server ready\n");
|
|
320267
320495
|
}),
|
|
@@ -320271,7 +320499,7 @@ async function startProxy(cmd) {
|
|
|
320271
320499
|
)
|
|
320272
320500
|
);
|
|
320273
320501
|
}
|
|
320274
|
-
var import_fs9,
|
|
320502
|
+
var import_fs9, import_rxjs48, import_operators31, import_stream2, pendingToken, currentToken, withToken, performFetch;
|
|
320275
320503
|
var init_start = __esm({
|
|
320276
320504
|
"src/commands/proxy/start.ts"() {
|
|
320277
320505
|
init_client2();
|
|
@@ -320279,7 +320507,7 @@ var init_start = __esm({
|
|
|
320279
320507
|
init_server2();
|
|
320280
320508
|
init_stdio2();
|
|
320281
320509
|
import_fs9 = require("fs");
|
|
320282
|
-
|
|
320510
|
+
import_rxjs48 = __toESM(require_cjs());
|
|
320283
320511
|
import_operators31 = __toESM(require_operators());
|
|
320284
320512
|
import_stream2 = require("stream");
|
|
320285
320513
|
init_zod();
|
|
@@ -320289,7 +320517,7 @@ var init_start = __esm({
|
|
|
320289
320517
|
pendingToken = null;
|
|
320290
320518
|
currentToken = (force = false) => {
|
|
320291
320519
|
if (!pendingToken || force) {
|
|
320292
|
-
pendingToken = (0,
|
|
320520
|
+
pendingToken = (0, import_rxjs48.lastValueFrom)(
|
|
320293
320521
|
GraphqlClienAPI.getConfig(force).pipe(
|
|
320294
320522
|
(0, import_operators31.take)(1),
|
|
320295
320523
|
(0, import_operators31.map)((config2) => config2.token)
|
|
@@ -320306,7 +320534,7 @@ var init_start = __esm({
|
|
|
320306
320534
|
return { ...init, headers };
|
|
320307
320535
|
};
|
|
320308
320536
|
performFetch = (input, init) => {
|
|
320309
|
-
return (0,
|
|
320537
|
+
return (0, import_rxjs48.from)(currentToken()).pipe(
|
|
320310
320538
|
(0, import_operators31.switchMap)((token) => fetch(input, withToken(init, token))),
|
|
320311
320539
|
(0, import_operators31.switchMap)((res) => {
|
|
320312
320540
|
if (res.status === 401 || res.status === 403) {
|
|
@@ -320314,7 +320542,7 @@ var init_start = __esm({
|
|
|
320314
320542
|
`[DEBUG] Request failed with ${res.status}. Refreshing token...
|
|
320315
320543
|
`
|
|
320316
320544
|
);
|
|
320317
|
-
return (0,
|
|
320545
|
+
return (0, import_rxjs48.from)(currentToken(true)).pipe(
|
|
320318
320546
|
(0, import_operators31.switchMap)((token) => {
|
|
320319
320547
|
process.stderr.write(
|
|
320320
320548
|
"[DEBUG] Token refreshed. Retrying request...\n"
|
|
@@ -320323,7 +320551,7 @@ var init_start = __esm({
|
|
|
320323
320551
|
})
|
|
320324
320552
|
);
|
|
320325
320553
|
}
|
|
320326
|
-
return (0,
|
|
320554
|
+
return (0, import_rxjs48.of)(res);
|
|
320327
320555
|
}),
|
|
320328
320556
|
(0, import_operators31.map)((res) => {
|
|
320329
320557
|
if (typeof res?.body?.pipeThrough !== "function") {
|
|
@@ -320342,7 +320570,7 @@ var init_start = __esm({
|
|
|
320342
320570
|
(0, import_operators31.catchError)((e2) => {
|
|
320343
320571
|
process.stderr.write(`[ERROR] Fetch error: ${e2.message}
|
|
320344
320572
|
`);
|
|
320345
|
-
return (0,
|
|
320573
|
+
return (0, import_rxjs48.throwError)(() => e2);
|
|
320346
320574
|
})
|
|
320347
320575
|
);
|
|
320348
320576
|
};
|
|
@@ -320354,16 +320582,16 @@ var create_exports3 = {};
|
|
|
320354
320582
|
__export(create_exports3, {
|
|
320355
320583
|
default: () => create_default3
|
|
320356
320584
|
});
|
|
320357
|
-
var
|
|
320585
|
+
var import_rxjs49, import_operators32, create_default3;
|
|
320358
320586
|
var init_create3 = __esm({
|
|
320359
320587
|
"src/commands/rabbitmq/create.ts"() {
|
|
320360
|
-
|
|
320588
|
+
import_rxjs49 = __toESM(require_cjs());
|
|
320361
320589
|
import_operators32 = __toESM(require_operators());
|
|
320362
320590
|
init_helpers();
|
|
320363
320591
|
init_gql_client();
|
|
320364
320592
|
init_log();
|
|
320365
320593
|
init_load_spec();
|
|
320366
|
-
create_default3 = (cmd) => (0,
|
|
320594
|
+
create_default3 = (cmd) => (0, import_rxjs49.lastValueFrom)(
|
|
320367
320595
|
parseProjectId(cmd.project).pipe(
|
|
320368
320596
|
(0, import_operators32.switchMap)(
|
|
320369
320597
|
(projectId) => loadSpec(
|
|
@@ -320402,15 +320630,15 @@ var list_exports5 = {};
|
|
|
320402
320630
|
__export(list_exports5, {
|
|
320403
320631
|
default: () => list_default5
|
|
320404
320632
|
});
|
|
320405
|
-
var
|
|
320633
|
+
var import_rxjs50, import_operators33, list_default5;
|
|
320406
320634
|
var init_list5 = __esm({
|
|
320407
320635
|
"src/commands/rabbitmq/list.ts"() {
|
|
320408
|
-
|
|
320636
|
+
import_rxjs50 = __toESM(require_cjs());
|
|
320409
320637
|
import_operators33 = __toESM(require_operators());
|
|
320410
320638
|
init_helpers();
|
|
320411
320639
|
init_gql_client();
|
|
320412
320640
|
init_log();
|
|
320413
|
-
list_default5 = (cmd) => (0,
|
|
320641
|
+
list_default5 = (cmd) => (0, import_rxjs50.lastValueFrom)(
|
|
320414
320642
|
parseProjectId(cmd.project).pipe(
|
|
320415
320643
|
(0, import_operators33.switchMap)(
|
|
320416
320644
|
(projectId) => GraphqlClienAPI.listRabbitMqInstances(projectId)
|
|
@@ -320445,15 +320673,15 @@ var delete_exports2 = {};
|
|
|
320445
320673
|
__export(delete_exports2, {
|
|
320446
320674
|
default: () => delete_default2
|
|
320447
320675
|
});
|
|
320448
|
-
var
|
|
320676
|
+
var import_rxjs51, import_operators34, delete_default2;
|
|
320449
320677
|
var init_delete2 = __esm({
|
|
320450
320678
|
"src/commands/rabbitmq/delete.ts"() {
|
|
320451
|
-
|
|
320679
|
+
import_rxjs51 = __toESM(require_cjs());
|
|
320452
320680
|
import_operators34 = __toESM(require_operators());
|
|
320453
320681
|
init_helpers();
|
|
320454
320682
|
init_gql_client();
|
|
320455
320683
|
init_log();
|
|
320456
|
-
delete_default2 = (cmd) => (0,
|
|
320684
|
+
delete_default2 = (cmd) => (0, import_rxjs51.lastValueFrom)(
|
|
320457
320685
|
parseProjectId(cmd.project).pipe(
|
|
320458
320686
|
(0, import_operators34.switchMap)(
|
|
320459
320687
|
(projectId) => GraphqlClienAPI.uninstallRabbitMq(cmd.id, projectId)
|
|
@@ -321178,11 +321406,11 @@ __export(start_exports2, {
|
|
|
321178
321406
|
default: () => start_default,
|
|
321179
321407
|
resolveRunner: () => resolveRunner
|
|
321180
321408
|
});
|
|
321181
|
-
var import_os6,
|
|
321409
|
+
var import_os6, import_rxjs52, RUNNER_VERSION, resolveRunner, start_default;
|
|
321182
321410
|
var init_start2 = __esm({
|
|
321183
321411
|
"src/commands/runner/start.ts"() {
|
|
321184
321412
|
import_os6 = require("os");
|
|
321185
|
-
|
|
321413
|
+
import_rxjs52 = __toESM(require_cjs());
|
|
321186
321414
|
init_gql_client();
|
|
321187
321415
|
init_log();
|
|
321188
321416
|
init_config();
|
|
@@ -321203,7 +321431,7 @@ var init_start2 = __esm({
|
|
|
321203
321431
|
}
|
|
321204
321432
|
const name2 = cmd.name || (0, import_os6.hostname)();
|
|
321205
321433
|
Logger.info(`Registering this machine as local runner "${name2}"...`);
|
|
321206
|
-
const { runner, token } = await (0,
|
|
321434
|
+
const { runner, token } = await (0, import_rxjs52.lastValueFrom)(
|
|
321207
321435
|
GraphqlClienAPI.createLocalRunner(name2)
|
|
321208
321436
|
).catch((e2) => {
|
|
321209
321437
|
throw new Error(
|
|
@@ -321398,14 +321626,14 @@ var list_exports6 = {};
|
|
|
321398
321626
|
__export(list_exports6, {
|
|
321399
321627
|
default: () => list_default6
|
|
321400
321628
|
});
|
|
321401
|
-
var
|
|
321629
|
+
var import_rxjs53, import_operators35, list_default6;
|
|
321402
321630
|
var init_list6 = __esm({
|
|
321403
321631
|
"src/commands/runner/list.ts"() {
|
|
321404
|
-
|
|
321632
|
+
import_rxjs53 = __toESM(require_cjs());
|
|
321405
321633
|
import_operators35 = __toESM(require_operators());
|
|
321406
321634
|
init_gql_client();
|
|
321407
321635
|
init_log();
|
|
321408
|
-
list_default6 = () => (0,
|
|
321636
|
+
list_default6 = () => (0, import_rxjs53.lastValueFrom)(
|
|
321409
321637
|
GraphqlClienAPI.listLocalRunners().pipe(
|
|
321410
321638
|
(0, import_operators35.tap)((runners) => {
|
|
321411
321639
|
Logger.log("-------------------");
|
|
@@ -321438,10 +321666,10 @@ __export(models_exports, {
|
|
|
321438
321666
|
default: () => models_default,
|
|
321439
321667
|
parseSelection: () => parseSelection
|
|
321440
321668
|
});
|
|
321441
|
-
var
|
|
321669
|
+
var import_rxjs54, isShown, parseSelection, models_default;
|
|
321442
321670
|
var init_models = __esm({
|
|
321443
321671
|
"src/commands/runner/models.ts"() {
|
|
321444
|
-
|
|
321672
|
+
import_rxjs54 = __toESM(require_cjs());
|
|
321445
321673
|
init_gql_client();
|
|
321446
321674
|
init_log();
|
|
321447
321675
|
init_config();
|
|
@@ -321471,11 +321699,11 @@ var init_models = __esm({
|
|
|
321471
321699
|
}
|
|
321472
321700
|
let runner;
|
|
321473
321701
|
if (selection) {
|
|
321474
|
-
runner = await (0,
|
|
321702
|
+
runner = await (0, import_rxjs54.lastValueFrom)(
|
|
321475
321703
|
GraphqlClienAPI.setLocalRunnerModels(runnerId, selection.models)
|
|
321476
321704
|
);
|
|
321477
321705
|
} else {
|
|
321478
|
-
const runners = await (0,
|
|
321706
|
+
const runners = await (0, import_rxjs54.lastValueFrom)(GraphqlClienAPI.listLocalRunners());
|
|
321479
321707
|
runner = runners.find((r2) => r2.id === runnerId);
|
|
321480
321708
|
}
|
|
321481
321709
|
if (!runner) {
|
|
@@ -321510,10 +321738,10 @@ var delete_exports3 = {};
|
|
|
321510
321738
|
__export(delete_exports3, {
|
|
321511
321739
|
default: () => delete_default3
|
|
321512
321740
|
});
|
|
321513
|
-
var
|
|
321741
|
+
var import_rxjs55, delete_default3;
|
|
321514
321742
|
var init_delete3 = __esm({
|
|
321515
321743
|
"src/commands/runner/delete.ts"() {
|
|
321516
|
-
|
|
321744
|
+
import_rxjs55 = __toESM(require_cjs());
|
|
321517
321745
|
init_gql_client();
|
|
321518
321746
|
init_log();
|
|
321519
321747
|
init_config();
|
|
@@ -321523,7 +321751,7 @@ var init_delete3 = __esm({
|
|
|
321523
321751
|
if (!runnerId) {
|
|
321524
321752
|
throw new Error("Specify the runner with --id (see `gcli runner:list`).");
|
|
321525
321753
|
}
|
|
321526
|
-
await (0,
|
|
321754
|
+
await (0, import_rxjs55.lastValueFrom)(GraphqlClienAPI.deleteLocalRunner(runnerId));
|
|
321527
321755
|
if (saved?.id === runnerId) {
|
|
321528
321756
|
await forgetRunner();
|
|
321529
321757
|
}
|
|
@@ -321539,10 +321767,10 @@ __export(start_exports3, {
|
|
|
321539
321767
|
});
|
|
321540
321768
|
async function start2(args) {
|
|
321541
321769
|
Logger.log("---------------------------------");
|
|
321542
|
-
return (0,
|
|
321770
|
+
return (0, import_rxjs56.lastValueFrom)(
|
|
321543
321771
|
loadSpec().pipe(
|
|
321544
321772
|
(0, import_operators36.switchMap)(
|
|
321545
|
-
(config2) => (0,
|
|
321773
|
+
(config2) => (0, import_rxjs56.of)({
|
|
321546
321774
|
watcher: (0, import_node_fs2.watch)(process.cwd(), {
|
|
321547
321775
|
recursive: true
|
|
321548
321776
|
}),
|
|
@@ -321571,7 +321799,7 @@ async function start2(args) {
|
|
|
321571
321799
|
outfile,
|
|
321572
321800
|
startCommand,
|
|
321573
321801
|
ignorelist
|
|
321574
|
-
}) => (0,
|
|
321802
|
+
}) => (0, import_rxjs56.from)(build_default(args)).pipe(
|
|
321575
321803
|
(0, import_operators36.tap)(() => {
|
|
321576
321804
|
Logger.warn(
|
|
321577
321805
|
`\u{1F4E2} Starting script "${startCommand} ${outfile}"`
|
|
@@ -321589,10 +321817,10 @@ async function start2(args) {
|
|
|
321589
321817
|
);
|
|
321590
321818
|
}),
|
|
321591
321819
|
(0, import_operators36.tap)(
|
|
321592
|
-
() => (0,
|
|
321593
|
-
(0,
|
|
321594
|
-
(0,
|
|
321595
|
-
(0,
|
|
321820
|
+
() => (0, import_rxjs56.merge)(
|
|
321821
|
+
(0, import_rxjs56.fromEvent)(process, "SIGINT"),
|
|
321822
|
+
(0, import_rxjs56.fromEvent)(process, "SIGTERM"),
|
|
321823
|
+
(0, import_rxjs56.fromEvent)(process, "exit")
|
|
321596
321824
|
).pipe(
|
|
321597
321825
|
(0, import_operators36.debounceTime)(100),
|
|
321598
321826
|
(0, import_operators36.tap)(() => {
|
|
@@ -321604,7 +321832,7 @@ async function start2(args) {
|
|
|
321604
321832
|
).subscribe()
|
|
321605
321833
|
),
|
|
321606
321834
|
(0, import_operators36.switchMap)(
|
|
321607
|
-
() => (0,
|
|
321835
|
+
() => (0, import_rxjs56.fromEvent)(watcher, "change").pipe(
|
|
321608
321836
|
(0, import_operators36.map)(([event, filename]) => ({
|
|
321609
321837
|
event,
|
|
321610
321838
|
filename
|
|
@@ -321653,12 +321881,12 @@ async function start2(args) {
|
|
|
321653
321881
|
)
|
|
321654
321882
|
);
|
|
321655
321883
|
}
|
|
321656
|
-
var import_node_child_process, import_node_fs2,
|
|
321884
|
+
var import_node_child_process, import_node_fs2, import_rxjs56, import_operators36;
|
|
321657
321885
|
var init_start3 = __esm({
|
|
321658
321886
|
"src/commands/start/start.ts"() {
|
|
321659
321887
|
import_node_child_process = require("node:child_process");
|
|
321660
321888
|
import_node_fs2 = require("node:fs");
|
|
321661
|
-
|
|
321889
|
+
import_rxjs56 = __toESM(require_cjs());
|
|
321662
321890
|
import_operators36 = __toESM(require_operators());
|
|
321663
321891
|
init_log();
|
|
321664
321892
|
init_build();
|
|
@@ -321671,16 +321899,16 @@ var create_cron_exports = {};
|
|
|
321671
321899
|
__export(create_cron_exports, {
|
|
321672
321900
|
default: () => create_cron_default
|
|
321673
321901
|
});
|
|
321674
|
-
var
|
|
321902
|
+
var import_rxjs57, import_operators37, create_cron_default;
|
|
321675
321903
|
var init_create_cron = __esm({
|
|
321676
321904
|
"src/commands/triggers/cron/create-cron.ts"() {
|
|
321677
|
-
|
|
321905
|
+
import_rxjs57 = __toESM(require_cjs());
|
|
321678
321906
|
import_operators37 = __toESM(require_operators());
|
|
321679
321907
|
init_helpers();
|
|
321680
321908
|
init_gql_client();
|
|
321681
321909
|
init_log();
|
|
321682
321910
|
init_load_spec();
|
|
321683
|
-
create_cron_default = (cmd) => (0,
|
|
321911
|
+
create_cron_default = (cmd) => (0, import_rxjs57.lastValueFrom)(
|
|
321684
321912
|
parseProjectId(cmd.project).pipe(
|
|
321685
321913
|
(0, import_operators37.switchMap)(
|
|
321686
321914
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
@@ -321703,7 +321931,7 @@ var init_create_cron = __esm({
|
|
|
321703
321931
|
)
|
|
321704
321932
|
),
|
|
321705
321933
|
(0, import_operators37.switchMap)(
|
|
321706
|
-
({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0,
|
|
321934
|
+
({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0, import_rxjs57.throwError)(
|
|
321707
321935
|
() => new Error(
|
|
321708
321936
|
"cron:create needs --cron and --triggerName (or triggers.time.cron / triggerName in lambforge.yaml)"
|
|
321709
321937
|
)
|
|
@@ -321736,16 +321964,16 @@ var delete_cron_exports = {};
|
|
|
321736
321964
|
__export(delete_cron_exports, {
|
|
321737
321965
|
default: () => delete_cron_default
|
|
321738
321966
|
});
|
|
321739
|
-
var
|
|
321967
|
+
var import_rxjs58, import_operators38, delete_cron_default;
|
|
321740
321968
|
var init_delete_cron = __esm({
|
|
321741
321969
|
"src/commands/triggers/cron/delete-cron.ts"() {
|
|
321742
|
-
|
|
321970
|
+
import_rxjs58 = __toESM(require_cjs());
|
|
321743
321971
|
import_operators38 = __toESM(require_operators());
|
|
321744
321972
|
init_helpers();
|
|
321745
321973
|
init_gql_client();
|
|
321746
321974
|
init_log();
|
|
321747
321975
|
init_load_spec();
|
|
321748
|
-
delete_cron_default = (cmd) => (0,
|
|
321976
|
+
delete_cron_default = (cmd) => (0, import_rxjs58.lastValueFrom)(
|
|
321749
321977
|
parseProjectId(cmd.project).pipe(
|
|
321750
321978
|
(0, import_operators38.switchMap)(
|
|
321751
321979
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
@@ -321789,18 +322017,18 @@ var list_crons_exports = {};
|
|
|
321789
322017
|
__export(list_crons_exports, {
|
|
321790
322018
|
default: () => list_crons_default
|
|
321791
322019
|
});
|
|
321792
|
-
var
|
|
322020
|
+
var import_rxjs59, import_operators39, list_crons_default;
|
|
321793
322021
|
var init_list_crons = __esm({
|
|
321794
322022
|
"src/commands/triggers/cron/list-crons.ts"() {
|
|
321795
|
-
|
|
322023
|
+
import_rxjs59 = __toESM(require_cjs());
|
|
321796
322024
|
import_operators39 = __toESM(require_operators());
|
|
321797
322025
|
init_helpers();
|
|
321798
322026
|
init_gql_client();
|
|
321799
322027
|
init_log();
|
|
321800
|
-
list_crons_default = (cmd) => (0,
|
|
322028
|
+
list_crons_default = (cmd) => (0, import_rxjs59.lastValueFrom)(
|
|
321801
322029
|
parseProjectId(cmd.project).pipe(
|
|
321802
322030
|
(0, import_operators39.switchMap)(
|
|
321803
|
-
(projectId) => (0,
|
|
322031
|
+
(projectId) => (0, import_rxjs59.combineLatest)([
|
|
321804
322032
|
GraphqlClienAPI.listProjectTimeTriggers(projectId),
|
|
321805
322033
|
GraphqlClienAPI.listLambdas(projectId)
|
|
321806
322034
|
])
|
|
@@ -321833,15 +322061,15 @@ var list_exports7 = {};
|
|
|
321833
322061
|
__export(list_exports7, {
|
|
321834
322062
|
default: () => list_default7
|
|
321835
322063
|
});
|
|
321836
|
-
var
|
|
322064
|
+
var import_rxjs60, import_operators40, list_default7;
|
|
321837
322065
|
var init_list7 = __esm({
|
|
321838
322066
|
"src/commands/triggers/message-queue/list.ts"() {
|
|
321839
|
-
|
|
322067
|
+
import_rxjs60 = __toESM(require_cjs());
|
|
321840
322068
|
import_operators40 = __toESM(require_operators());
|
|
321841
322069
|
init_helpers();
|
|
321842
322070
|
init_gql_client();
|
|
321843
322071
|
init_log();
|
|
321844
|
-
list_default7 = (cmd) => (0,
|
|
322072
|
+
list_default7 = (cmd) => (0, import_rxjs60.lastValueFrom)(
|
|
321845
322073
|
parseProjectId(cmd.project).pipe(
|
|
321846
322074
|
(0, import_operators40.switchMap)(
|
|
321847
322075
|
(projectId) => GraphqlClienAPI.listMessageQueueTriggers(projectId)
|
|
@@ -321877,10 +322105,10 @@ __export(save_exports, {
|
|
|
321877
322105
|
mergeOverExisting: () => mergeOverExisting,
|
|
321878
322106
|
toTriggerInput: () => toTriggerInput
|
|
321879
322107
|
});
|
|
321880
|
-
var
|
|
322108
|
+
var import_rxjs61, import_operators41, int2, toTriggerInput, mergeOverExisting, save_default;
|
|
321881
322109
|
var init_save = __esm({
|
|
321882
322110
|
"src/commands/triggers/message-queue/save.ts"() {
|
|
321883
|
-
|
|
322111
|
+
import_rxjs61 = __toESM(require_cjs());
|
|
321884
322112
|
import_operators41 = __toESM(require_operators());
|
|
321885
322113
|
init_helpers();
|
|
321886
322114
|
init_gql_client();
|
|
@@ -321943,11 +322171,11 @@ var init_save = __esm({
|
|
|
321943
322171
|
)
|
|
321944
322172
|
);
|
|
321945
322173
|
};
|
|
321946
|
-
save_default = (mode, cmd) => (0,
|
|
322174
|
+
save_default = (mode, cmd) => (0, import_rxjs61.lastValueFrom)(
|
|
321947
322175
|
parseProjectId(cmd.project).pipe(
|
|
321948
322176
|
(0, import_operators41.switchMap)((projectId) => {
|
|
321949
322177
|
const changes = toTriggerInput(mode, cmd);
|
|
321950
|
-
const payload$ = mode === "create" ? (0,
|
|
322178
|
+
const payload$ = mode === "create" ? (0, import_rxjs61.of)(changes) : GraphqlClienAPI.listMessageQueueTriggers(projectId).pipe(
|
|
321951
322179
|
(0, import_operators41.map)(
|
|
321952
322180
|
(triggers) => mergeOverExisting(
|
|
321953
322181
|
triggers.find((t2) => t2.name === cmd.name),
|
|
@@ -321985,15 +322213,15 @@ var delete_exports4 = {};
|
|
|
321985
322213
|
__export(delete_exports4, {
|
|
321986
322214
|
default: () => delete_default4
|
|
321987
322215
|
});
|
|
321988
|
-
var
|
|
322216
|
+
var import_rxjs62, import_operators42, delete_default4;
|
|
321989
322217
|
var init_delete4 = __esm({
|
|
321990
322218
|
"src/commands/triggers/message-queue/delete.ts"() {
|
|
321991
|
-
|
|
322219
|
+
import_rxjs62 = __toESM(require_cjs());
|
|
321992
322220
|
import_operators42 = __toESM(require_operators());
|
|
321993
322221
|
init_helpers();
|
|
321994
322222
|
init_gql_client();
|
|
321995
322223
|
init_log();
|
|
321996
|
-
delete_default4 = (cmd) => (0,
|
|
322224
|
+
delete_default4 = (cmd) => (0, import_rxjs62.lastValueFrom)(
|
|
321997
322225
|
parseProjectId(cmd.project).pipe(
|
|
321998
322226
|
(0, import_operators42.switchMap)(
|
|
321999
322227
|
(projectId) => GraphqlClienAPI.deleteMessageQueueTrigger(projectId, cmd.name)
|
|
@@ -322103,11 +322331,11 @@ var init_definition = __esm({
|
|
|
322103
322331
|
});
|
|
322104
322332
|
|
|
322105
322333
|
// src/commands/workflow/helpers.ts
|
|
322106
|
-
var import_promises7,
|
|
322334
|
+
var import_promises7, import_rxjs63, import_operators43, resolveWorkflow, withProject, readWorkflowFile, writeTextFile, POLL_MS, followRun, printRunResult;
|
|
322107
322335
|
var init_helpers4 = __esm({
|
|
322108
322336
|
"src/commands/workflow/helpers.ts"() {
|
|
322109
322337
|
import_promises7 = require("fs/promises");
|
|
322110
|
-
|
|
322338
|
+
import_rxjs63 = __toESM(require_cjs());
|
|
322111
322339
|
import_operators43 = __toESM(require_operators());
|
|
322112
322340
|
init_helpers();
|
|
322113
322341
|
init_gql_client();
|
|
@@ -322129,18 +322357,18 @@ var init_helpers4 = __esm({
|
|
|
322129
322357
|
})
|
|
322130
322358
|
);
|
|
322131
322359
|
};
|
|
322132
|
-
withProject = (project, fn) => (0,
|
|
322360
|
+
withProject = (project, fn) => (0, import_rxjs63.lastValueFrom)(parseProjectId(project).pipe((0, import_operators43.switchMap)(fn)));
|
|
322133
322361
|
readWorkflowFile = (path2) => {
|
|
322134
322362
|
if (!path2) {
|
|
322135
322363
|
throw new Error("--file is required (a workflow YAML or JSON file)");
|
|
322136
322364
|
}
|
|
322137
|
-
return (0,
|
|
322365
|
+
return (0, import_rxjs63.from)((0, import_promises7.readFile)(path2, "utf8")).pipe((0, import_operators43.map)(parseWorkflowFile));
|
|
322138
322366
|
};
|
|
322139
|
-
writeTextFile = (path2, text) => (0,
|
|
322367
|
+
writeTextFile = (path2, text) => (0, import_rxjs63.from)((0, import_promises7.writeFile)(path2, text, "utf8"));
|
|
322140
322368
|
POLL_MS = 2e3;
|
|
322141
322369
|
followRun = (projectId, workflowId, runName) => {
|
|
322142
322370
|
let printed = 0;
|
|
322143
|
-
return (0,
|
|
322371
|
+
return (0, import_rxjs63.timer)(0, POLL_MS).pipe(
|
|
322144
322372
|
(0, import_operators43.switchMap)(
|
|
322145
322373
|
() => GraphqlClienAPI.getWorkflowRun(projectId, workflowId, runName)
|
|
322146
322374
|
),
|
|
@@ -322213,10 +322441,10 @@ var get_exports2 = {};
|
|
|
322213
322441
|
__export(get_exports2, {
|
|
322214
322442
|
default: () => get_default2
|
|
322215
322443
|
});
|
|
322216
|
-
var
|
|
322444
|
+
var import_rxjs64, import_operators45, get_default2;
|
|
322217
322445
|
var init_get2 = __esm({
|
|
322218
322446
|
"src/commands/workflow/get.ts"() {
|
|
322219
|
-
|
|
322447
|
+
import_rxjs64 = __toESM(require_cjs());
|
|
322220
322448
|
import_operators45 = __toESM(require_operators());
|
|
322221
322449
|
init_log();
|
|
322222
322450
|
init_definition();
|
|
@@ -322232,7 +322460,7 @@ var init_get2 = __esm({
|
|
|
322232
322460
|
});
|
|
322233
322461
|
if (!cmd.out) {
|
|
322234
322462
|
Logger.log(text);
|
|
322235
|
-
return (0,
|
|
322463
|
+
return (0, import_rxjs64.of)(null);
|
|
322236
322464
|
}
|
|
322237
322465
|
return writeTextFile(cmd.out, text).pipe(
|
|
322238
322466
|
(0, import_operators45.tap)(() => Logger.info(`Wrote ${cmd.out}`))
|
|
@@ -322302,11 +322530,11 @@ var generate_exports = {};
|
|
|
322302
322530
|
__export(generate_exports, {
|
|
322303
322531
|
default: () => generate_default
|
|
322304
322532
|
});
|
|
322305
|
-
var import_promises8,
|
|
322533
|
+
var import_promises8, import_rxjs65, import_operators47, generate_default;
|
|
322306
322534
|
var init_generate = __esm({
|
|
322307
322535
|
"src/commands/workflow/generate.ts"() {
|
|
322308
322536
|
import_promises8 = require("fs/promises");
|
|
322309
|
-
|
|
322537
|
+
import_rxjs65 = __toESM(require_cjs());
|
|
322310
322538
|
import_operators47 = __toESM(require_operators());
|
|
322311
322539
|
init_gql_client();
|
|
322312
322540
|
init_log();
|
|
@@ -322319,7 +322547,7 @@ var init_generate = __esm({
|
|
|
322319
322547
|
'Describe the workflow: --description "charge the card with retries, then email the receipt"'
|
|
322320
322548
|
);
|
|
322321
322549
|
}
|
|
322322
|
-
const base$ = cmd.from ? (0,
|
|
322550
|
+
const base$ = cmd.from ? (0, import_rxjs65.from)((0, import_promises8.readFile)(cmd.from, "utf8")).pipe((0, import_operators47.map)(parseWorkflowFile)) : cmd.name ? GraphqlClienAPI.listWorkflows(projectId).pipe(
|
|
322323
322551
|
(0, import_operators47.switchMap)(
|
|
322324
322552
|
(workflows) => workflows.some((w) => w.name === cmd.name) ? resolveWorkflow(projectId, cmd.name).pipe(
|
|
322325
322553
|
(0, import_operators47.map)((w) => ({
|
|
@@ -322327,9 +322555,9 @@ var init_generate = __esm({
|
|
|
322327
322555
|
description: w.description ?? void 0,
|
|
322328
322556
|
definition: w.definition
|
|
322329
322557
|
}))
|
|
322330
|
-
) : (0,
|
|
322558
|
+
) : (0, import_rxjs65.of)(null)
|
|
322331
322559
|
)
|
|
322332
|
-
) : (0,
|
|
322560
|
+
) : (0, import_rxjs65.of)(null);
|
|
322333
322561
|
return base$.pipe(
|
|
322334
322562
|
(0, import_operators47.tap)(() => Logger.info("Asking the AI for a draft...")),
|
|
322335
322563
|
(0, import_operators47.switchMap)(
|
|
@@ -322356,10 +322584,10 @@ var init_generate = __esm({
|
|
|
322356
322584
|
const text = toWorkflowYaml(file2);
|
|
322357
322585
|
const written$ = cmd.out ? writeTextFile(cmd.out, text).pipe(
|
|
322358
322586
|
(0, import_operators47.tap)(() => Logger.info(`Wrote ${cmd.out}`))
|
|
322359
|
-
) : (0,
|
|
322587
|
+
) : (0, import_rxjs65.of)(null).pipe((0, import_operators47.tap)(() => !cmd.apply && Logger.log(text)));
|
|
322360
322588
|
return written$.pipe(
|
|
322361
322589
|
(0, import_operators47.switchMap)(
|
|
322362
|
-
() => cmd.apply ? applyWorkflow(projectId, file2) : (0,
|
|
322590
|
+
() => cmd.apply ? applyWorkflow(projectId, file2) : (0, import_rxjs65.of)(null).pipe(
|
|
322363
322591
|
(0, import_operators47.tap)(
|
|
322364
322592
|
() => Logger.info(
|
|
322365
322593
|
cmd.out ? `Review it, then: gcli workflow:apply --file ${cmd.out}${file2.name ? "" : " --name <name>"}` : "Save it with -o <file>, or re-run with --apply --name <name>"
|
|
@@ -322433,11 +322661,11 @@ var run_exports = {};
|
|
|
322433
322661
|
__export(run_exports, {
|
|
322434
322662
|
default: () => run_default
|
|
322435
322663
|
});
|
|
322436
|
-
var import_promises9,
|
|
322664
|
+
var import_promises9, import_rxjs66, import_operators50, run_default;
|
|
322437
322665
|
var init_run = __esm({
|
|
322438
322666
|
"src/commands/workflow/run.ts"() {
|
|
322439
322667
|
import_promises9 = require("fs/promises");
|
|
322440
|
-
|
|
322668
|
+
import_rxjs66 = __toESM(require_cjs());
|
|
322441
322669
|
import_operators50 = __toESM(require_operators());
|
|
322442
322670
|
init_gql_client();
|
|
322443
322671
|
init_log();
|
|
@@ -322445,7 +322673,7 @@ var init_run = __esm({
|
|
|
322445
322673
|
init_helpers4();
|
|
322446
322674
|
run_default = (cmd) => withProject(
|
|
322447
322675
|
cmd.project,
|
|
322448
|
-
(projectId) => (cmd.inputFile ? (0,
|
|
322676
|
+
(projectId) => (cmd.inputFile ? (0, import_rxjs66.from)((0, import_promises9.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs66.of)(cmd.input)).pipe(
|
|
322449
322677
|
(0, import_operators50.map)(parseRunInput),
|
|
322450
322678
|
(0, import_operators50.switchMap)(
|
|
322451
322679
|
(input) => resolveWorkflow(projectId, cmd.name).pipe(
|
|
@@ -322453,7 +322681,7 @@ var init_run = __esm({
|
|
|
322453
322681
|
(w) => GraphqlClienAPI.startWorkflowRun(projectId, w.id, input).pipe(
|
|
322454
322682
|
(0, import_operators50.tap)((run2) => Logger.info(`Started run ${run2.name}`)),
|
|
322455
322683
|
(0, import_operators50.switchMap)(
|
|
322456
|
-
(run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0,
|
|
322684
|
+
(run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0, import_rxjs66.of)(run2).pipe(
|
|
322457
322685
|
(0, import_operators50.tap)(
|
|
322458
322686
|
() => Logger.info(
|
|
322459
322687
|
`Follow it: gcli workflow:status --name ${w.name} --run ${run2.name} --follow`
|
|
@@ -322627,11 +322855,11 @@ var trigger_add_exports = {};
|
|
|
322627
322855
|
__export(trigger_add_exports, {
|
|
322628
322856
|
default: () => trigger_add_default
|
|
322629
322857
|
});
|
|
322630
|
-
var import_promises10,
|
|
322858
|
+
var import_promises10, import_rxjs67, import_operators54, trigger_add_default;
|
|
322631
322859
|
var init_trigger_add = __esm({
|
|
322632
322860
|
"src/commands/workflow/trigger-add.ts"() {
|
|
322633
322861
|
import_promises10 = require("fs/promises");
|
|
322634
|
-
|
|
322862
|
+
import_rxjs67 = __toESM(require_cjs());
|
|
322635
322863
|
import_operators54 = __toESM(require_operators());
|
|
322636
322864
|
init_gql_client();
|
|
322637
322865
|
init_log();
|
|
@@ -322639,7 +322867,7 @@ var init_trigger_add = __esm({
|
|
|
322639
322867
|
init_triggers();
|
|
322640
322868
|
trigger_add_default = (cmd) => withProject(
|
|
322641
322869
|
cmd.project,
|
|
322642
|
-
(projectId) => (cmd.inputFile ? (0,
|
|
322870
|
+
(projectId) => (cmd.inputFile ? (0, import_rxjs67.from)((0, import_promises10.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs67.of)(void 0)).pipe(
|
|
322643
322871
|
(0, import_operators54.map)((inputText) => buildTriggerInput({ ...cmd, inputText })),
|
|
322644
322872
|
(0, import_operators54.switchMap)(
|
|
322645
322873
|
(trigger) => resolveWorkflow(projectId, cmd.name).pipe(
|
|
@@ -324014,12 +324242,12 @@ __export(start_exports4, {
|
|
|
324014
324242
|
WORKSPACE_VERSION: () => WORKSPACE_VERSION,
|
|
324015
324243
|
default: () => start_default2
|
|
324016
324244
|
});
|
|
324017
|
-
var import_promises12, import_path7,
|
|
324245
|
+
var import_promises12, import_path7, import_rxjs68, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
|
|
324018
324246
|
var init_start4 = __esm({
|
|
324019
324247
|
"src/commands/workspace/start.ts"() {
|
|
324020
324248
|
import_promises12 = require("fs/promises");
|
|
324021
324249
|
import_path7 = require("path");
|
|
324022
|
-
|
|
324250
|
+
import_rxjs68 = __toESM(require_cjs());
|
|
324023
324251
|
init_helpers();
|
|
324024
324252
|
init_gql_client();
|
|
324025
324253
|
init_log();
|
|
@@ -324049,7 +324277,7 @@ var init_start4 = __esm({
|
|
|
324049
324277
|
if (saved && (!cmd.project || cmd.project === saved.projectId)) {
|
|
324050
324278
|
return saved;
|
|
324051
324279
|
}
|
|
324052
|
-
const projectId = await (0,
|
|
324280
|
+
const projectId = await (0, import_rxjs68.lastValueFrom)(parseProjectId(cmd.project)).catch(
|
|
324053
324281
|
() => {
|
|
324054
324282
|
throw new Error(
|
|
324055
324283
|
"No project selected. Pass --project <projectId> or run `gcli project:use <projectId>` first."
|
|
@@ -324058,7 +324286,7 @@ var init_start4 = __esm({
|
|
|
324058
324286
|
);
|
|
324059
324287
|
const name2 = cmd.name || (0, import_path7.basename)(root);
|
|
324060
324288
|
Logger.info(`Registering ${root} as local workspace "${name2}"...`);
|
|
324061
|
-
const { workspace, token } = await (0,
|
|
324289
|
+
const { workspace, token } = await (0, import_rxjs68.lastValueFrom)(
|
|
324062
324290
|
GraphqlClienAPI.createLocalWorkspace(projectId, name2)
|
|
324063
324291
|
).catch((e2) => {
|
|
324064
324292
|
throw new Error(
|
|
@@ -324149,16 +324377,16 @@ var list_exports9 = {};
|
|
|
324149
324377
|
__export(list_exports9, {
|
|
324150
324378
|
default: () => list_default9
|
|
324151
324379
|
});
|
|
324152
|
-
var
|
|
324380
|
+
var import_rxjs69, list_default9;
|
|
324153
324381
|
var init_list9 = __esm({
|
|
324154
324382
|
"src/commands/workspace/list.ts"() {
|
|
324155
|
-
|
|
324383
|
+
import_rxjs69 = __toESM(require_cjs());
|
|
324156
324384
|
init_gql_client();
|
|
324157
324385
|
init_log();
|
|
324158
324386
|
init_config2();
|
|
324159
324387
|
list_default9 = async (cmd) => {
|
|
324160
324388
|
const [workspaces, saved] = await Promise.all([
|
|
324161
|
-
(0,
|
|
324389
|
+
(0, import_rxjs69.lastValueFrom)(GraphqlClienAPI.listLocalWorkspaces(cmd.project)),
|
|
324162
324390
|
readSavedWorkspaces()
|
|
324163
324391
|
]);
|
|
324164
324392
|
const onThisMachine = new Set(Object.values(saved).map((w) => w.id));
|
|
@@ -324192,11 +324420,11 @@ var delete_exports6 = {};
|
|
|
324192
324420
|
__export(delete_exports6, {
|
|
324193
324421
|
default: () => delete_default6
|
|
324194
324422
|
});
|
|
324195
|
-
var import_promises13,
|
|
324423
|
+
var import_promises13, import_rxjs70, delete_default6;
|
|
324196
324424
|
var init_delete6 = __esm({
|
|
324197
324425
|
"src/commands/workspace/delete.ts"() {
|
|
324198
324426
|
import_promises13 = require("fs/promises");
|
|
324199
|
-
|
|
324427
|
+
import_rxjs70 = __toESM(require_cjs());
|
|
324200
324428
|
init_gql_client();
|
|
324201
324429
|
init_log();
|
|
324202
324430
|
init_config2();
|
|
@@ -324208,7 +324436,7 @@ var init_delete6 = __esm({
|
|
|
324208
324436
|
"No workspace registered for this directory - pass --id (see `gcli workspace:list`)."
|
|
324209
324437
|
);
|
|
324210
324438
|
}
|
|
324211
|
-
await (0,
|
|
324439
|
+
await (0, import_rxjs70.lastValueFrom)(GraphqlClienAPI.deleteLocalWorkspace(workspaceId));
|
|
324212
324440
|
await forgetWorkspace({ id: workspaceId });
|
|
324213
324441
|
Logger.log(
|
|
324214
324442
|
`Local workspace ${workspaceId} deleted; its token no longer works.`
|
|
@@ -324311,7 +324539,10 @@ function registerClusterCommands(program2) {
|
|
|
324311
324539
|
).option("--node-ip <nodeIp>", "The machine's address on your network").option("-n, --name <name>", "Machine name = hostname, e.g. home-1").option("--pool <pool>", 'Pool label lambforge.io/pool (default "default")').option(
|
|
324312
324540
|
"--reserved",
|
|
324313
324541
|
"Only workloads that tolerate the pool run there (default: plain extra capacity)"
|
|
324314
|
-
).option("--disk <disk>", "Install disk, e.g. /dev/nvme0n1 (WIPED)").option(
|
|
324542
|
+
).option("--disk <disk>", "Install disk, e.g. /dev/nvme0n1 (WIPED)").option(
|
|
324543
|
+
"--storage",
|
|
324544
|
+
"The machine also carries volumes on its own disk (default: lambdas only)"
|
|
324545
|
+
).option("--yes", "Do not ask before wiping the disk").option("--no-wait", "Do not wait for the machine to join").option("--timeout <minutes>", "How long to wait for the join (default 10)").action(lazy(() => Promise.resolve().then(() => (init_attach2(), attach_exports)).then((m2) => m2.default)));
|
|
324315
324546
|
target(
|
|
324316
324547
|
program2.command("cluster:nodes").description(
|
|
324317
324548
|
"Every node of a cluster: its Hetzner control planes and workers and the machines attached to it"
|
|
@@ -324325,6 +324556,11 @@ function registerClusterCommands(program2) {
|
|
|
324325
324556
|
target(
|
|
324326
324557
|
program2.command("cluster:resume").description("Let new work run on a paused machine again (uncordon)")
|
|
324327
324558
|
).option("-n, --name <name>", "Machine name (see cluster:nodes)").action(lazy(() => Promise.resolve().then(() => (init_pause(), pause_exports)).then((m2) => m2.resume)));
|
|
324559
|
+
target(
|
|
324560
|
+
program2.command("cluster:node-storage").description(
|
|
324561
|
+
"Let an attached machine carry volumes on its own disk (it restarts once), or stop with --off"
|
|
324562
|
+
)
|
|
324563
|
+
).option("-n, --name <name>", "Machine name (see cluster:nodes)").option("--off", "Stop carrying volumes (refused while it holds one)").option("--no-wait", "Do not wait until the machine is ready").option("--timeout <minutes>", "How long to wait (default 40)").action(lazy(() => Promise.resolve().then(() => (init_node_storage(), node_storage_exports)).then((m2) => m2.default)));
|
|
324328
324564
|
target(
|
|
324329
324565
|
program2.command("cluster:reset-machine").description(
|
|
324330
324566
|
"Bring a detached machine back to maintenance mode to attach it again (wipes its config and data, keeps the boot loader)"
|