@gapi/gcli 1.8.250 → 1.8.252
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/README-CLI.md +103 -0
- package/README.md +3 -1
- package/docs/changelog.d/2026-10-30-self-managed-nodes-cluster-attach-probes-the-machine-with-talosctl-get-version.md +8 -0
- package/docs/changelog.d/2026-10-31-self-managed-nodes-cluster-commands-call-the-api-by-cluster-id-reset-machine-wo.md +24 -0
- package/docs/features/self-managed-nodes.md +15 -3
- package/package.json +1 -1
- package/release/index.js +646 -365
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 lastValueFrom59(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 = lastValueFrom59;
|
|
12418
12418
|
}
|
|
12419
12419
|
});
|
|
12420
12420
|
|
|
@@ -27839,7 +27839,7 @@ var require_auth = __commonJS({
|
|
|
27839
27839
|
this.a = this.c;
|
|
27840
27840
|
qm(this, true);
|
|
27841
27841
|
};
|
|
27842
|
-
function
|
|
27842
|
+
function rm5(a, b) {
|
|
27843
27843
|
if (b) return a.a = a.c, a.g();
|
|
27844
27844
|
b = a.a;
|
|
27845
27845
|
a.a *= 2;
|
|
@@ -27848,7 +27848,7 @@ var require_auth = __commonJS({
|
|
|
27848
27848
|
}
|
|
27849
27849
|
function qm(a, b) {
|
|
27850
27850
|
a.stop();
|
|
27851
|
-
a.b = Bd(
|
|
27851
|
+
a.b = Bd(rm5(a, b)).then(function() {
|
|
27852
27852
|
return Ye();
|
|
27853
27853
|
}).then(function() {
|
|
27854
27854
|
return a.h();
|
|
@@ -29867,7 +29867,7 @@ var require_buffer_list = __commonJS({
|
|
|
29867
29867
|
}
|
|
29868
29868
|
}, {
|
|
29869
29869
|
key: "join",
|
|
29870
|
-
value: function
|
|
29870
|
+
value: function join6(s2) {
|
|
29871
29871
|
if (this.length === 0) return "";
|
|
29872
29872
|
var p = this.head;
|
|
29873
29873
|
var ret = "" + p.data;
|
|
@@ -32885,7 +32885,7 @@ var require_buffer_list2 = __commonJS({
|
|
|
32885
32885
|
}
|
|
32886
32886
|
}, {
|
|
32887
32887
|
key: "join",
|
|
32888
|
-
value: function
|
|
32888
|
+
value: function join6(s2) {
|
|
32889
32889
|
if (this.length === 0) return "";
|
|
32890
32890
|
var p = this.head;
|
|
32891
32891
|
var ret = "" + p.data;
|
|
@@ -37092,29 +37092,29 @@ var init_gql_client = __esm({
|
|
|
37092
37092
|
variables: { projectId }
|
|
37093
37093
|
}).pipe((0, import_operators.map)((res) => res.projectClusters));
|
|
37094
37094
|
}
|
|
37095
|
-
|
|
37095
|
+
// Cluster operations are keyed by the cluster alone: the server checks the
|
|
37096
|
+
// cluster's own project (one API for users and admins - a platform cluster
|
|
37097
|
+
// has no project).
|
|
37098
|
+
static teardownProjectCluster(clusterId) {
|
|
37096
37099
|
return this.query({
|
|
37097
37100
|
query: gql`
|
|
37098
|
-
mutation teardownProjectCluster(
|
|
37099
|
-
|
|
37100
|
-
$clusterId: String!
|
|
37101
|
-
) {
|
|
37102
|
-
teardownProjectCluster(projectId: $projectId, clusterId: $clusterId) {
|
|
37101
|
+
mutation teardownProjectCluster($clusterId: String!) {
|
|
37102
|
+
teardownProjectCluster(clusterId: $clusterId) {
|
|
37103
37103
|
${ClusterFragment}
|
|
37104
37104
|
}
|
|
37105
37105
|
}
|
|
37106
37106
|
`,
|
|
37107
|
-
variables: {
|
|
37107
|
+
variables: { clusterId }
|
|
37108
37108
|
}).pipe((0, import_operators.map)((res) => res.teardownProjectCluster));
|
|
37109
37109
|
}
|
|
37110
|
-
static clusterKubeconfig(
|
|
37110
|
+
static clusterKubeconfig(clusterId) {
|
|
37111
37111
|
return this.query({
|
|
37112
37112
|
query: gql`
|
|
37113
|
-
query clusterKubeconfig($
|
|
37114
|
-
clusterKubeconfig(
|
|
37113
|
+
query clusterKubeconfig($clusterId: String!) {
|
|
37114
|
+
clusterKubeconfig(clusterId: $clusterId)
|
|
37115
37115
|
}
|
|
37116
37116
|
`,
|
|
37117
|
-
variables: {
|
|
37117
|
+
variables: { clusterId }
|
|
37118
37118
|
}).pipe((0, import_operators.map)((res) => res.clusterKubeconfig));
|
|
37119
37119
|
}
|
|
37120
37120
|
// Cluster scaling, topology, load balancer and health (cluster-provisioner;
|
|
@@ -37294,6 +37294,21 @@ var init_gql_client = __esm({
|
|
|
37294
37294
|
variables: { clusterId, includeCloud }
|
|
37295
37295
|
}).pipe((0, import_operators.map)((res) => res.clusterNodes ?? []));
|
|
37296
37296
|
}
|
|
37297
|
+
static clusterTalosconfig(clusterId, ttlMinutes) {
|
|
37298
|
+
return this.query({
|
|
37299
|
+
query: gql`
|
|
37300
|
+
query clusterTalosconfig($clusterId: String!, $ttlMinutes: Int) {
|
|
37301
|
+
clusterTalosconfig(clusterId: $clusterId, ttlMinutes: $ttlMinutes) {
|
|
37302
|
+
talosconfig
|
|
37303
|
+
expiresAt
|
|
37304
|
+
endpoint
|
|
37305
|
+
talosVersion
|
|
37306
|
+
}
|
|
37307
|
+
}
|
|
37308
|
+
`,
|
|
37309
|
+
variables: { clusterId, ttlMinutes }
|
|
37310
|
+
}).pipe((0, import_operators.map)((res) => res.clusterTalosconfig));
|
|
37311
|
+
}
|
|
37297
37312
|
static setClusterNodePaused(clusterId, name2, paused) {
|
|
37298
37313
|
return this.query({
|
|
37299
37314
|
query: gql`
|
|
@@ -38695,7 +38710,7 @@ var require_util = __commonJS({
|
|
|
38695
38710
|
return path2;
|
|
38696
38711
|
}
|
|
38697
38712
|
exports2.normalize = normalize2;
|
|
38698
|
-
function
|
|
38713
|
+
function join6(aRoot, aPath) {
|
|
38699
38714
|
if (aRoot === "") {
|
|
38700
38715
|
aRoot = ".";
|
|
38701
38716
|
}
|
|
@@ -38727,7 +38742,7 @@ var require_util = __commonJS({
|
|
|
38727
38742
|
}
|
|
38728
38743
|
return joined;
|
|
38729
38744
|
}
|
|
38730
|
-
exports2.join =
|
|
38745
|
+
exports2.join = join6;
|
|
38731
38746
|
exports2.isAbsolute = function(aPath) {
|
|
38732
38747
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
38733
38748
|
};
|
|
@@ -38900,7 +38915,7 @@ var require_util = __commonJS({
|
|
|
38900
38915
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
38901
38916
|
}
|
|
38902
38917
|
}
|
|
38903
|
-
sourceURL =
|
|
38918
|
+
sourceURL = join6(urlGenerate(parsed), sourceURL);
|
|
38904
38919
|
}
|
|
38905
38920
|
return normalize2(sourceURL);
|
|
38906
38921
|
}
|
|
@@ -43026,7 +43041,7 @@ var require_typescript = __commonJS({
|
|
|
43026
43041
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
43027
43042
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
43028
43043
|
writeCommentRange: () => writeCommentRange,
|
|
43029
|
-
writeFile: () =>
|
|
43044
|
+
writeFile: () => writeFile13,
|
|
43030
43045
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
43031
43046
|
zipWith: () => zipWith
|
|
43032
43047
|
});
|
|
@@ -61669,7 +61684,7 @@ ${lanes.join("\n")}
|
|
|
61669
61684
|
sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
|
|
61670
61685
|
return combinePaths(newDirPath, sourceFilePath);
|
|
61671
61686
|
}
|
|
61672
|
-
function
|
|
61687
|
+
function writeFile13(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
61673
61688
|
host.writeFile(
|
|
61674
61689
|
fileName,
|
|
61675
61690
|
text,
|
|
@@ -74191,8 +74206,8 @@ ${lanes.join("\n")}
|
|
|
74191
74206
|
return void 0;
|
|
74192
74207
|
}
|
|
74193
74208
|
function tryRenameExternalModule(factory2, moduleName, sourceFile) {
|
|
74194
|
-
const
|
|
74195
|
-
return
|
|
74209
|
+
const rename2 = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text);
|
|
74210
|
+
return rename2 ? factory2.createStringLiteral(rename2) : void 0;
|
|
74196
74211
|
}
|
|
74197
74212
|
function tryGetModuleNameFromFile(factory2, file2, host, options) {
|
|
74198
74213
|
if (!file2) {
|
|
@@ -170420,7 +170435,7 @@ ${lanes.join("\n")}
|
|
|
170420
170435
|
return;
|
|
170421
170436
|
}
|
|
170422
170437
|
const buildInfo = host.getBuildInfo() || { version: version2 };
|
|
170423
|
-
|
|
170438
|
+
writeFile13(
|
|
170424
170439
|
host,
|
|
170425
170440
|
emitterDiagnostics,
|
|
170426
170441
|
buildInfoPath,
|
|
@@ -170632,7 +170647,7 @@ ${lanes.join("\n")}
|
|
|
170632
170647
|
}
|
|
170633
170648
|
if (sourceMapFilePath) {
|
|
170634
170649
|
const sourceMap = sourceMapGenerator.toString();
|
|
170635
|
-
|
|
170650
|
+
writeFile13(
|
|
170636
170651
|
host,
|
|
170637
170652
|
emitterDiagnostics,
|
|
170638
170653
|
sourceMapFilePath,
|
|
@@ -170647,7 +170662,7 @@ ${lanes.join("\n")}
|
|
|
170647
170662
|
}
|
|
170648
170663
|
const text = writer.getText();
|
|
170649
170664
|
const data = { sourceMapUrlPos, diagnostics: transform22.diagnostics };
|
|
170650
|
-
|
|
170665
|
+
writeFile13(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
|
|
170651
170666
|
writer.clear();
|
|
170652
170667
|
return !data.skippedDtsWrite;
|
|
170653
170668
|
}
|
|
@@ -208313,19 +208328,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
208313
208328
|
}
|
|
208314
208329
|
function convertNamedExport(sourceFile, assignment, changes, exports22) {
|
|
208315
208330
|
const { text } = assignment.left.name;
|
|
208316
|
-
const
|
|
208317
|
-
if (
|
|
208331
|
+
const rename2 = exports22.get(text);
|
|
208332
|
+
if (rename2 !== void 0) {
|
|
208318
208333
|
const newNodes = [
|
|
208319
208334
|
makeConst(
|
|
208320
208335
|
/*modifiers*/
|
|
208321
208336
|
void 0,
|
|
208322
|
-
|
|
208337
|
+
rename2,
|
|
208323
208338
|
assignment.right
|
|
208324
208339
|
),
|
|
208325
208340
|
makeExportDeclaration([factory.createExportSpecifier(
|
|
208326
208341
|
/*isTypeOnly*/
|
|
208327
208342
|
false,
|
|
208328
|
-
|
|
208343
|
+
rename2,
|
|
208329
208344
|
text
|
|
208330
208345
|
)])
|
|
208331
208346
|
];
|
|
@@ -238529,7 +238544,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
238529
238544
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
238530
238545
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
238531
238546
|
writeCommentRange: () => writeCommentRange,
|
|
238532
|
-
writeFile: () =>
|
|
238547
|
+
writeFile: () => writeFile13,
|
|
238533
238548
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
238534
238549
|
zipWith: () => zipWith
|
|
238535
238550
|
});
|
|
@@ -254835,12 +254850,21 @@ var init_build = __esm({
|
|
|
254835
254850
|
});
|
|
254836
254851
|
|
|
254837
254852
|
// src/commands/cluster/helpers/poll-until-ready.ts
|
|
254838
|
-
function pollUntilReady(projectId, clusterId, {
|
|
254853
|
+
function pollUntilReady(projectId, clusterId, {
|
|
254854
|
+
intervalMs = 5e3,
|
|
254855
|
+
timeoutMs = 20 * 60 * 1e3,
|
|
254856
|
+
/** watching a teardown: a cluster no longer listed is deleted (the
|
|
254857
|
+
project's list leaves deleted clusters out) */
|
|
254858
|
+
goneMeansDeleted = false
|
|
254859
|
+
} = {}) {
|
|
254839
254860
|
return (0, import_rxjs7.firstValueFrom)(
|
|
254840
254861
|
(0, import_rxjs7.timer)(0, intervalMs).pipe(
|
|
254841
254862
|
(0, import_operators6.switchMap)(() => GraphqlClienAPI.projectClusters(projectId)),
|
|
254842
254863
|
(0, import_operators6.switchMap)((clusters) => {
|
|
254843
254864
|
const cluster = (clusters || []).find((c) => c.id === clusterId);
|
|
254865
|
+
if (!cluster && goneMeansDeleted) {
|
|
254866
|
+
return [{ id: clusterId, status: "deleted" }];
|
|
254867
|
+
}
|
|
254844
254868
|
if (!cluster) {
|
|
254845
254869
|
throw new Error(`cluster ${clusterId} not found`);
|
|
254846
254870
|
}
|
|
@@ -255471,7 +255495,7 @@ var init_teardown = __esm({
|
|
|
255471
255495
|
const { projectId, cluster } = await (0, import_rxjs14.lastValueFrom)(
|
|
255472
255496
|
parseProjectId(cmd.project).pipe(
|
|
255473
255497
|
(0, import_operators10.switchMap)(
|
|
255474
|
-
(projectId2) => GraphqlClienAPI.teardownProjectCluster(
|
|
255498
|
+
(projectId2) => GraphqlClienAPI.teardownProjectCluster(cmd.cluster).pipe(
|
|
255475
255499
|
(0, import_operators10.map)((cluster2) => ({ projectId: projectId2, cluster: cluster2 }))
|
|
255476
255500
|
)
|
|
255477
255501
|
),
|
|
@@ -255492,7 +255516,9 @@ var init_teardown = __esm({
|
|
|
255492
255516
|
return cluster;
|
|
255493
255517
|
}
|
|
255494
255518
|
Logger.info(`Waiting for cluster ${cluster.id} to finish tearing down...`);
|
|
255495
|
-
const finalCluster = await pollUntilReady(projectId, cluster.id
|
|
255519
|
+
const finalCluster = await pollUntilReady(projectId, cluster.id, {
|
|
255520
|
+
goneMeansDeleted: true
|
|
255521
|
+
});
|
|
255496
255522
|
Logger.log(
|
|
255497
255523
|
`[Action][teardownProjectCluster] final status: ${finalCluster.status}`
|
|
255498
255524
|
);
|
|
@@ -255511,15 +255537,11 @@ var init_kubeconfig = __esm({
|
|
|
255511
255537
|
"src/commands/cluster/kubeconfig.ts"() {
|
|
255512
255538
|
import_rxjs15 = __toESM(require_cjs());
|
|
255513
255539
|
import_operators11 = __toESM(require_operators());
|
|
255514
|
-
init_helpers();
|
|
255515
255540
|
init_gql_client();
|
|
255516
255541
|
init_log();
|
|
255517
255542
|
init_read_file();
|
|
255518
255543
|
kubeconfig_default = (cmd) => (0, import_rxjs15.lastValueFrom)(
|
|
255519
|
-
|
|
255520
|
-
(0, import_operators11.switchMap)(
|
|
255521
|
-
(projectId) => GraphqlClienAPI.clusterKubeconfig(projectId, cmd.cluster)
|
|
255522
|
-
),
|
|
255544
|
+
GraphqlClienAPI.clusterKubeconfig(cmd.cluster).pipe(
|
|
255523
255545
|
(0, import_operators11.switchMap)(
|
|
255524
255546
|
(kubeconfig) => cmd.output ? writeFileAsObservable(cmd.output, kubeconfig).pipe(
|
|
255525
255547
|
(0, import_operators11.tap)(() => Logger.info(`Wrote kubeconfig to ${cmd.output}`))
|
|
@@ -255660,31 +255682,97 @@ var init_attach = __esm({
|
|
|
255660
255682
|
...own && !n.recorded ? { note: "joined by hand" } : {}
|
|
255661
255683
|
};
|
|
255662
255684
|
};
|
|
255663
|
-
resetHint = (ip = "<machine-ip>") => `
|
|
255685
|
+
resetHint = (clusterId = "<cluster-id>", name2 = "<machine-name>", ip = "<machine-ip>") => `gcli cluster:reset-machine --cluster ${clusterId} --name ${name2} --node-ip ${ip}`;
|
|
255664
255686
|
}
|
|
255665
255687
|
});
|
|
255666
255688
|
|
|
255667
|
-
// src/commands/cluster/
|
|
255668
|
-
|
|
255669
|
-
|
|
255670
|
-
|
|
255671
|
-
|
|
255672
|
-
|
|
255673
|
-
|
|
255674
|
-
|
|
255689
|
+
// src/commands/cluster/helpers/talosctl.ts
|
|
255690
|
+
function talosctlAssetName(platform = process.platform, arch = process.arch) {
|
|
255691
|
+
const os2 = platform === "win32" ? "windows" : platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : null;
|
|
255692
|
+
const cpu = arch === "x64" ? "amd64" : arch === "arm64" ? "arm64" : null;
|
|
255693
|
+
if (!os2 || !cpu) {
|
|
255694
|
+
throw new Error(
|
|
255695
|
+
`No talosctl release for ${platform}/${arch}. Install talosctl yourself: https://www.talos.dev/latest/talos-guides/install/talosctl/`
|
|
255696
|
+
);
|
|
255697
|
+
}
|
|
255698
|
+
return `talosctl-${os2}-${cpu}${os2 === "windows" ? ".exe" : ""}`;
|
|
255699
|
+
}
|
|
255700
|
+
function checksumFor(sums, asset) {
|
|
255701
|
+
for (const line of sums.split("\n")) {
|
|
255702
|
+
const [hash2, name2] = line.trim().split(/\s+\*?/);
|
|
255703
|
+
if (name2 === asset && /^[a-f0-9]{64}$/i.test(hash2 ?? "")) {
|
|
255704
|
+
return hash2.toLowerCase();
|
|
255705
|
+
}
|
|
255706
|
+
}
|
|
255707
|
+
return null;
|
|
255708
|
+
}
|
|
255709
|
+
async function download(url2) {
|
|
255710
|
+
const res = await fetch(url2);
|
|
255711
|
+
if (!res.ok) {
|
|
255712
|
+
throw new Error(`Download failed (${res.status}): ${url2}`);
|
|
255713
|
+
}
|
|
255714
|
+
return Buffer.from(await res.arrayBuffer());
|
|
255715
|
+
}
|
|
255716
|
+
async function ensureTalosctl(version2) {
|
|
255717
|
+
if (!VERSION_RE.test(version2)) {
|
|
255718
|
+
throw new Error(`Unknown Talos version "${version2}"`);
|
|
255719
|
+
}
|
|
255720
|
+
const onPath = await runBinary("talosctl", [
|
|
255721
|
+
"version",
|
|
255722
|
+
"--client",
|
|
255723
|
+
"--short"
|
|
255724
|
+
]);
|
|
255725
|
+
if (onPath.code === 0 && clientVersionOf(onPath.stdout) === version2) {
|
|
255726
|
+
return "talosctl";
|
|
255727
|
+
}
|
|
255728
|
+
const asset = talosctlAssetName();
|
|
255729
|
+
const dir = (0, import_path.join)(mainDirectory, "bin");
|
|
255730
|
+
const binary = (0, import_path.join)(
|
|
255731
|
+
dir,
|
|
255732
|
+
`talosctl-${version2}${asset.endsWith(".exe") ? ".exe" : ""}`
|
|
255733
|
+
);
|
|
255734
|
+
if ((0, import_fs3.existsSync)(binary)) {
|
|
255735
|
+
return binary;
|
|
255736
|
+
}
|
|
255737
|
+
Logger.info(
|
|
255738
|
+
`Downloading talosctl ${version2} (${asset}, about 90 MB, once) from the Talos releases ...`
|
|
255739
|
+
);
|
|
255740
|
+
const sums = (await download(`${RELEASES}/${version2}/sha256sum.txt`)).toString("utf8");
|
|
255741
|
+
const expected = checksumFor(sums, asset);
|
|
255742
|
+
if (!expected) {
|
|
255743
|
+
throw new Error(`The ${version2} release lists no checksum for ${asset}.`);
|
|
255744
|
+
}
|
|
255745
|
+
const body = await download(`${RELEASES}/${version2}/${asset}`);
|
|
255746
|
+
const actual = (0, import_crypto.createHash)("sha256").update(body).digest("hex");
|
|
255747
|
+
if (actual !== expected) {
|
|
255748
|
+
throw new Error(
|
|
255749
|
+
`Checksum mismatch for ${asset} ${version2} - the download was not used.`
|
|
255750
|
+
);
|
|
255751
|
+
}
|
|
255752
|
+
await (0, import_promises.mkdir)(dir, { recursive: true });
|
|
255753
|
+
const partial2 = `${binary}.partial`;
|
|
255754
|
+
await (0, import_promises.writeFile)(partial2, body, { mode: 493 });
|
|
255755
|
+
await (0, import_promises.chmod)(partial2, 493);
|
|
255756
|
+
await (0, import_promises.rename)(partial2, binary);
|
|
255757
|
+
Logger.info(`talosctl ${version2} saved to ${binary}`);
|
|
255758
|
+
return binary;
|
|
255759
|
+
}
|
|
255760
|
+
var import_child_process, import_crypto, import_fs3, import_promises, import_path, RELEASES, VERSION_RE, clientVersionOf, runBinary;
|
|
255761
|
+
var init_talosctl = __esm({
|
|
255762
|
+
"src/commands/cluster/helpers/talosctl.ts"() {
|
|
255675
255763
|
import_child_process = require("child_process");
|
|
255764
|
+
import_crypto = require("crypto");
|
|
255765
|
+
import_fs3 = require("fs");
|
|
255676
255766
|
import_promises = require("fs/promises");
|
|
255677
|
-
import_os2 = require("os");
|
|
255678
255767
|
import_path = require("path");
|
|
255679
|
-
import_readline = require("readline");
|
|
255680
|
-
import_rxjs17 = __toESM(require_cjs());
|
|
255681
|
-
init_gql_client();
|
|
255682
255768
|
init_log();
|
|
255683
|
-
|
|
255684
|
-
|
|
255685
|
-
|
|
255769
|
+
init_types();
|
|
255770
|
+
RELEASES = "https://github.com/siderolabs/talos/releases/download";
|
|
255771
|
+
VERSION_RE = /^v\d+\.\d+\.\d+$/;
|
|
255772
|
+
clientVersionOf = (output) => output.match(/Talos (v\d+\.\d+\.\d+\S*)/)?.[1] ?? null;
|
|
255773
|
+
runBinary = (binary, args, timeoutMs = 2e4) => new Promise(
|
|
255686
255774
|
(resolve2) => (0, import_child_process.execFile)(
|
|
255687
|
-
|
|
255775
|
+
binary,
|
|
255688
255776
|
args,
|
|
255689
255777
|
{ timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024 },
|
|
255690
255778
|
(error48, stdout, stderr) => resolve2({
|
|
@@ -255694,6 +255782,27 @@ var init_attach2 = __esm({
|
|
|
255694
255782
|
})
|
|
255695
255783
|
)
|
|
255696
255784
|
);
|
|
255785
|
+
}
|
|
255786
|
+
});
|
|
255787
|
+
|
|
255788
|
+
// src/commands/cluster/attach.ts
|
|
255789
|
+
var attach_exports = {};
|
|
255790
|
+
__export(attach_exports, {
|
|
255791
|
+
default: () => attach_default
|
|
255792
|
+
});
|
|
255793
|
+
var import_promises2, import_os2, import_path2, import_readline, import_rxjs17, sleep, ask, attach_default;
|
|
255794
|
+
var init_attach2 = __esm({
|
|
255795
|
+
"src/commands/cluster/attach.ts"() {
|
|
255796
|
+
import_promises2 = require("fs/promises");
|
|
255797
|
+
import_os2 = require("os");
|
|
255798
|
+
import_path2 = require("path");
|
|
255799
|
+
import_readline = require("readline");
|
|
255800
|
+
import_rxjs17 = __toESM(require_cjs());
|
|
255801
|
+
init_gql_client();
|
|
255802
|
+
init_log();
|
|
255803
|
+
init_attach();
|
|
255804
|
+
init_cluster_change();
|
|
255805
|
+
init_talosctl();
|
|
255697
255806
|
sleep = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
255698
255807
|
ask = (question) => new Promise((resolve2) => {
|
|
255699
255808
|
const rl = (0, import_readline.createInterface)({
|
|
@@ -255716,9 +255825,11 @@ var init_attach2 = __esm({
|
|
|
255716
255825
|
info.reason ?? "Machines cannot be attached to this cluster."
|
|
255717
255826
|
);
|
|
255718
255827
|
}
|
|
255828
|
+
const binary = info.talosVersion ? await ensureTalosctl(info.talosVersion) : "talosctl";
|
|
255829
|
+
const talosctl = (args, timeoutMs = 2e4) => runBinary(binary, args, timeoutMs);
|
|
255719
255830
|
if ((await talosctl(["version", "--client"])).code !== 0) {
|
|
255720
255831
|
throw new Error(
|
|
255721
|
-
"talosctl is not
|
|
255832
|
+
"talosctl is not available. Install it: https://www.talos.dev/latest/talos-guides/install/talosctl/"
|
|
255722
255833
|
);
|
|
255723
255834
|
}
|
|
255724
255835
|
Logger.info(`Looking for the Talos installer at ${opts.nodeIp}:50000 ...`);
|
|
@@ -255778,10 +255889,10 @@ var init_attach2 = __esm({
|
|
|
255778
255889
|
`The cluster runs Talos ${join_.talosVersion}, the machine booted ${version2}. It installs ${join_.talosVersion} anyway; if the join fails, boot ${join_.isoUrl}.`
|
|
255779
255890
|
);
|
|
255780
255891
|
}
|
|
255781
|
-
const dir = await (0,
|
|
255782
|
-
const file2 = (0,
|
|
255892
|
+
const dir = await (0, import_promises2.mkdtemp)((0, import_path2.join)((0, import_os2.tmpdir)(), "gcli-attach-"));
|
|
255893
|
+
const file2 = (0, import_path2.join)(dir, "machine.yaml");
|
|
255783
255894
|
try {
|
|
255784
|
-
await (0,
|
|
255895
|
+
await (0, import_promises2.writeFile)(file2, join_.config, { mode: 384 });
|
|
255785
255896
|
const applied = await talosctl(
|
|
255786
255897
|
["-n", opts.nodeIp, "apply-config", "--insecure", "--file", file2],
|
|
255787
255898
|
6e4
|
|
@@ -255792,7 +255903,7 @@ var init_attach2 = __esm({
|
|
|
255792
255903
|
);
|
|
255793
255904
|
}
|
|
255794
255905
|
} finally {
|
|
255795
|
-
await (0,
|
|
255906
|
+
await (0, import_promises2.rm)(dir, { recursive: true, force: true });
|
|
255796
255907
|
}
|
|
255797
255908
|
Logger.info(
|
|
255798
255909
|
`Config applied - ${opts.name} installs Talos and reboots, then joins "${join_.clusterName}" (pool ${join_.pool}, ${join_.reserved ? "reserved" : "extra capacity"}).`
|
|
@@ -255816,7 +255927,7 @@ var init_attach2 = __esm({
|
|
|
255816
255927
|
}
|
|
255817
255928
|
}
|
|
255818
255929
|
Logger.warn(
|
|
255819
|
-
`${opts.name} has not joined yet. Check gcli cluster:nodes later; if it never joins, reset it (${resetHint(opts.nodeIp)}) and attach again.`
|
|
255930
|
+
`${opts.name} has not joined yet. Check gcli cluster:nodes later; if it never joins, reset it (${resetHint(clusterId, opts.name, opts.nodeIp)}) and attach again.`
|
|
255820
255931
|
);
|
|
255821
255932
|
};
|
|
255822
255933
|
}
|
|
@@ -255885,16 +255996,170 @@ var init_pause = __esm({
|
|
|
255885
255996
|
}
|
|
255886
255997
|
});
|
|
255887
255998
|
|
|
255999
|
+
// src/commands/cluster/reset-machine.ts
|
|
256000
|
+
var reset_machine_exports = {};
|
|
256001
|
+
__export(reset_machine_exports, {
|
|
256002
|
+
default: () => reset_machine_default,
|
|
256003
|
+
hostnameOf: () => hostnameOf
|
|
256004
|
+
});
|
|
256005
|
+
var import_promises3, import_os3, import_path3, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
|
|
256006
|
+
var init_reset_machine = __esm({
|
|
256007
|
+
"src/commands/cluster/reset-machine.ts"() {
|
|
256008
|
+
import_promises3 = require("fs/promises");
|
|
256009
|
+
import_os3 = require("os");
|
|
256010
|
+
import_path3 = require("path");
|
|
256011
|
+
import_readline2 = require("readline");
|
|
256012
|
+
import_rxjs20 = __toESM(require_cjs());
|
|
256013
|
+
init_gql_client();
|
|
256014
|
+
init_log();
|
|
256015
|
+
init_attach();
|
|
256016
|
+
init_cluster_change();
|
|
256017
|
+
init_talosctl();
|
|
256018
|
+
hostnameOf = (yaml) => yaml.match(/^\s*hostname:\s*(\S+)/m)?.[1] ?? null;
|
|
256019
|
+
reset_machine_default = async (cmd) => {
|
|
256020
|
+
const name2 = (cmd.name ?? "").trim();
|
|
256021
|
+
const ip = (cmd.nodeIp ?? "").trim();
|
|
256022
|
+
if (!NAME_RE.test(name2)) {
|
|
256023
|
+
throw new Error(
|
|
256024
|
+
"--name is required: the machine name (see gcli cluster:nodes)"
|
|
256025
|
+
);
|
|
256026
|
+
}
|
|
256027
|
+
if (!HOST_RE.test(ip)) {
|
|
256028
|
+
throw new Error(
|
|
256029
|
+
"--node-ip is required: the machine's address on your network"
|
|
256030
|
+
);
|
|
256031
|
+
}
|
|
256032
|
+
const { clusterId } = await resolveClusterTarget(cmd);
|
|
256033
|
+
const node = (await (0, import_rxjs20.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId, true))).find((n) => n.name === name2);
|
|
256034
|
+
if (node?.source === "hetzner") {
|
|
256035
|
+
throw new Error(
|
|
256036
|
+
`${name2} is a Hetzner node - those are removed by scaling the cluster.`
|
|
256037
|
+
);
|
|
256038
|
+
}
|
|
256039
|
+
if (node && (node.status === "ready" || node.status === "not-ready")) {
|
|
256040
|
+
throw new Error(
|
|
256041
|
+
`${name2} is still in the cluster. Detach it first: gcli cluster:detach --cluster ${clusterId} --name ${name2}`
|
|
256042
|
+
);
|
|
256043
|
+
}
|
|
256044
|
+
const access = await (0, import_rxjs20.lastValueFrom)(
|
|
256045
|
+
GraphqlClienAPI.clusterTalosconfig(clusterId, 15)
|
|
256046
|
+
);
|
|
256047
|
+
const binary = access.talosVersion ? await ensureTalosctl(access.talosVersion) : "talosctl";
|
|
256048
|
+
const dir = await (0, import_promises3.mkdtemp)((0, import_path3.join)((0, import_os3.tmpdir)(), "gcli-reset-"));
|
|
256049
|
+
const config2 = (0, import_path3.join)(dir, "talosconfig");
|
|
256050
|
+
try {
|
|
256051
|
+
await (0, import_promises3.writeFile)(config2, access.talosconfig, { mode: 384 });
|
|
256052
|
+
const talos = (args, timeoutMs = 3e4) => runBinary(
|
|
256053
|
+
binary,
|
|
256054
|
+
["--talosconfig", config2, "-e", ip, "-n", ip, ...args],
|
|
256055
|
+
timeoutMs
|
|
256056
|
+
);
|
|
256057
|
+
const status2 = await talos(["get", "hostnamestatus", "-o", "yaml"]);
|
|
256058
|
+
if (status2.code !== 0) {
|
|
256059
|
+
throw new Error(
|
|
256060
|
+
`Cannot reach the machine at ${ip} with this cluster's credentials: ${(status2.stderr || status2.stdout).trim().split("\n")[0]}. It must be on this network and still configured for this cluster (a machine in maintenance mode needs no reset).`
|
|
256061
|
+
);
|
|
256062
|
+
}
|
|
256063
|
+
const actual = hostnameOf(status2.stdout);
|
|
256064
|
+
if (actual !== name2) {
|
|
256065
|
+
throw new Error(
|
|
256066
|
+
`The machine at ${ip} is "${actual ?? "unknown"}", not "${name2}" - nothing was changed.`
|
|
256067
|
+
);
|
|
256068
|
+
}
|
|
256069
|
+
if (!cmd.yes) {
|
|
256070
|
+
const answer = await new Promise((resolve2) => {
|
|
256071
|
+
const rl = (0, import_readline2.createInterface)({
|
|
256072
|
+
input: process.stdin,
|
|
256073
|
+
output: process.stdout
|
|
256074
|
+
});
|
|
256075
|
+
rl.question(
|
|
256076
|
+
`Wipe the config and data of ${name2} (${ip})? It reboots into maintenance mode, ready to attach again. Type the machine name to continue: `,
|
|
256077
|
+
(a) => {
|
|
256078
|
+
rl.close();
|
|
256079
|
+
resolve2(a.trim());
|
|
256080
|
+
}
|
|
256081
|
+
);
|
|
256082
|
+
});
|
|
256083
|
+
if (answer !== name2) {
|
|
256084
|
+
Logger.warn("Cancelled - nothing was changed.");
|
|
256085
|
+
return;
|
|
256086
|
+
}
|
|
256087
|
+
}
|
|
256088
|
+
const reset = await talos(
|
|
256089
|
+
[
|
|
256090
|
+
"reset",
|
|
256091
|
+
"--graceful=false",
|
|
256092
|
+
"--reboot",
|
|
256093
|
+
"--wait=false",
|
|
256094
|
+
"--system-labels-to-wipe",
|
|
256095
|
+
"STATE",
|
|
256096
|
+
"--system-labels-to-wipe",
|
|
256097
|
+
"EPHEMERAL"
|
|
256098
|
+
],
|
|
256099
|
+
6e4
|
|
256100
|
+
);
|
|
256101
|
+
if (reset.code !== 0) {
|
|
256102
|
+
throw new Error(
|
|
256103
|
+
`Reset failed: ${(reset.stderr || reset.stdout).trim().split("\n")[0]}`
|
|
256104
|
+
);
|
|
256105
|
+
}
|
|
256106
|
+
Logger.log(
|
|
256107
|
+
`${name2} is resetting. In a few minutes its screen shows "Maintenance"; attach it again with gcli cluster:attach.`
|
|
256108
|
+
);
|
|
256109
|
+
} finally {
|
|
256110
|
+
await (0, import_promises3.rm)(dir, { recursive: true, force: true });
|
|
256111
|
+
}
|
|
256112
|
+
};
|
|
256113
|
+
}
|
|
256114
|
+
});
|
|
256115
|
+
|
|
256116
|
+
// src/commands/cluster/talosconfig.ts
|
|
256117
|
+
var talosconfig_exports = {};
|
|
256118
|
+
__export(talosconfig_exports, {
|
|
256119
|
+
default: () => talosconfig_default
|
|
256120
|
+
});
|
|
256121
|
+
var import_promises4, import_rxjs21, talosconfig_default;
|
|
256122
|
+
var init_talosconfig = __esm({
|
|
256123
|
+
"src/commands/cluster/talosconfig.ts"() {
|
|
256124
|
+
import_promises4 = require("fs/promises");
|
|
256125
|
+
import_rxjs21 = __toESM(require_cjs());
|
|
256126
|
+
init_gql_client();
|
|
256127
|
+
init_log();
|
|
256128
|
+
init_cluster_change();
|
|
256129
|
+
talosconfig_default = async (cmd) => {
|
|
256130
|
+
const ttl = cmd.ttl === void 0 ? void 0 : Number(cmd.ttl);
|
|
256131
|
+
if (ttl !== void 0 && (!Number.isInteger(ttl) || ttl < 5 || ttl > 1440)) {
|
|
256132
|
+
throw new Error("--ttl is in minutes, 5 to 1440");
|
|
256133
|
+
}
|
|
256134
|
+
const { clusterId } = await resolveClusterTarget(cmd);
|
|
256135
|
+
const res = await (0, import_rxjs21.lastValueFrom)(
|
|
256136
|
+
GraphqlClienAPI.clusterTalosconfig(clusterId, ttl)
|
|
256137
|
+
);
|
|
256138
|
+
if (!cmd.output) {
|
|
256139
|
+
process.stdout.write(res.talosconfig);
|
|
256140
|
+
return;
|
|
256141
|
+
}
|
|
256142
|
+
await (0, import_promises4.writeFile)(cmd.output, res.talosconfig, { mode: 384 });
|
|
256143
|
+
Logger.log(
|
|
256144
|
+
`Wrote talosconfig to ${cmd.output} (valid until ${res.expiresAt}).`
|
|
256145
|
+
);
|
|
256146
|
+
Logger.info(
|
|
256147
|
+
`Use it with: talosctl --talosconfig ${cmd.output} -n <node-ip> <command> (Talos ${res.talosVersion ?? ""})`
|
|
256148
|
+
);
|
|
256149
|
+
};
|
|
256150
|
+
}
|
|
256151
|
+
});
|
|
256152
|
+
|
|
255888
256153
|
// src/commands/cluster/detach.ts
|
|
255889
256154
|
var detach_exports = {};
|
|
255890
256155
|
__export(detach_exports, {
|
|
255891
256156
|
default: () => detach_default
|
|
255892
256157
|
});
|
|
255893
|
-
var
|
|
256158
|
+
var import_readline3, import_rxjs22, detach_default;
|
|
255894
256159
|
var init_detach = __esm({
|
|
255895
256160
|
"src/commands/cluster/detach.ts"() {
|
|
255896
|
-
|
|
255897
|
-
|
|
256161
|
+
import_readline3 = require("readline");
|
|
256162
|
+
import_rxjs22 = __toESM(require_cjs());
|
|
255898
256163
|
init_gql_client();
|
|
255899
256164
|
init_log();
|
|
255900
256165
|
init_attach();
|
|
@@ -255907,7 +256172,7 @@ var init_detach = __esm({
|
|
|
255907
256172
|
const { clusterId } = await resolveClusterTarget(cmd);
|
|
255908
256173
|
if (!cmd.yes) {
|
|
255909
256174
|
const answer = await new Promise((resolve2) => {
|
|
255910
|
-
const rl = (0,
|
|
256175
|
+
const rl = (0, import_readline3.createInterface)({
|
|
255911
256176
|
input: process.stdin,
|
|
255912
256177
|
output: process.stdout
|
|
255913
256178
|
});
|
|
@@ -255924,12 +256189,12 @@ var init_detach = __esm({
|
|
|
255924
256189
|
return;
|
|
255925
256190
|
}
|
|
255926
256191
|
}
|
|
255927
|
-
const node = await (0,
|
|
256192
|
+
const node = await (0, import_rxjs22.lastValueFrom)(
|
|
255928
256193
|
GraphqlClienAPI.detachClusterNode(clusterId, name2)
|
|
255929
256194
|
);
|
|
255930
256195
|
Logger.log(`${node.name} is detached.`);
|
|
255931
256196
|
Logger.info(
|
|
255932
|
-
`The machine still runs Talos. To
|
|
256197
|
+
`The machine still runs Talos. To attach it again (or anywhere else), reset it from its network: ${resetHint(clusterId, node.name)}`
|
|
255933
256198
|
);
|
|
255934
256199
|
};
|
|
255935
256200
|
}
|
|
@@ -255940,17 +256205,17 @@ var health_exports = {};
|
|
|
255940
256205
|
__export(health_exports, {
|
|
255941
256206
|
default: () => health_default
|
|
255942
256207
|
});
|
|
255943
|
-
var
|
|
256208
|
+
var import_rxjs23, pct2, health_default;
|
|
255944
256209
|
var init_health = __esm({
|
|
255945
256210
|
"src/commands/cluster/health.ts"() {
|
|
255946
|
-
|
|
256211
|
+
import_rxjs23 = __toESM(require_cjs());
|
|
255947
256212
|
init_gql_client();
|
|
255948
256213
|
init_log();
|
|
255949
256214
|
init_cluster_change();
|
|
255950
256215
|
pct2 = (v) => v == null ? "-" : `${Math.round(v)}%`;
|
|
255951
256216
|
health_default = async (cmd) => {
|
|
255952
256217
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
255953
|
-
const [latest] = await (0,
|
|
256218
|
+
const [latest] = await (0, import_rxjs23.lastValueFrom)(
|
|
255954
256219
|
GraphqlClienAPI.clusterHealth(projectId, clusterId, 1)
|
|
255955
256220
|
);
|
|
255956
256221
|
Logger.log("-------------------");
|
|
@@ -255997,17 +256262,17 @@ var scale_events_exports = {};
|
|
|
255997
256262
|
__export(scale_events_exports, {
|
|
255998
256263
|
default: () => scale_events_default
|
|
255999
256264
|
});
|
|
256000
|
-
var
|
|
256265
|
+
var import_rxjs24, scale_events_default;
|
|
256001
256266
|
var init_scale_events = __esm({
|
|
256002
256267
|
"src/commands/cluster/scale-events.ts"() {
|
|
256003
|
-
|
|
256268
|
+
import_rxjs24 = __toESM(require_cjs());
|
|
256004
256269
|
init_gql_client();
|
|
256005
256270
|
init_log();
|
|
256006
256271
|
init_cluster_change();
|
|
256007
256272
|
scale_events_default = async (cmd) => {
|
|
256008
256273
|
const limit = cmd.limit === void 0 ? 20 : parseIntOption("limit", cmd.limit, 1, 200);
|
|
256009
256274
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
256010
|
-
const events = await (0,
|
|
256275
|
+
const events = await (0, import_rxjs24.lastValueFrom)(
|
|
256011
256276
|
GraphqlClienAPI.clusterScaleEvents(projectId, clusterId, limit)
|
|
256012
256277
|
);
|
|
256013
256278
|
Logger.log("-------------------");
|
|
@@ -256037,17 +256302,17 @@ var cost_exports = {};
|
|
|
256037
256302
|
__export(cost_exports, {
|
|
256038
256303
|
default: () => cost_default
|
|
256039
256304
|
});
|
|
256040
|
-
var
|
|
256305
|
+
var import_rxjs25, money, cost_default;
|
|
256041
256306
|
var init_cost = __esm({
|
|
256042
256307
|
"src/commands/cluster/cost.ts"() {
|
|
256043
|
-
|
|
256308
|
+
import_rxjs25 = __toESM(require_cjs());
|
|
256044
256309
|
init_helpers();
|
|
256045
256310
|
init_gql_client();
|
|
256046
256311
|
init_log();
|
|
256047
256312
|
money = (v, sign = "\u20AC") => v == null ? "-" : `${sign}${v.toFixed(2)}`;
|
|
256048
256313
|
cost_default = async (cmd) => {
|
|
256049
|
-
const projectId = await (0,
|
|
256050
|
-
const rows = await (0,
|
|
256314
|
+
const projectId = await (0, import_rxjs25.lastValueFrom)(parseProjectId(cmd.project));
|
|
256315
|
+
const rows = await (0, import_rxjs25.lastValueFrom)(
|
|
256051
256316
|
GraphqlClienAPI.projectClustersOverview(projectId)
|
|
256052
256317
|
);
|
|
256053
256318
|
Logger.log("-------------------");
|
|
@@ -256135,10 +256400,10 @@ __export(autoscale_exports, {
|
|
|
256135
256400
|
default: () => autoscale_default,
|
|
256136
256401
|
toAutoscaleInput: () => toAutoscaleInput
|
|
256137
256402
|
});
|
|
256138
|
-
var
|
|
256403
|
+
var import_rxjs26, toAutoscaleInput, autoscale_default;
|
|
256139
256404
|
var init_autoscale = __esm({
|
|
256140
256405
|
"src/commands/cluster/autoscale.ts"() {
|
|
256141
|
-
|
|
256406
|
+
import_rxjs26 = __toESM(require_cjs());
|
|
256142
256407
|
init_gql_client();
|
|
256143
256408
|
init_log();
|
|
256144
256409
|
init_cluster_change();
|
|
@@ -256179,7 +256444,7 @@ var init_autoscale = __esm({
|
|
|
256179
256444
|
autoscale_default = async (cmd) => {
|
|
256180
256445
|
const input = toAutoscaleInput(cmd);
|
|
256181
256446
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
256182
|
-
const cluster = await (0,
|
|
256447
|
+
const cluster = await (0, import_rxjs26.lastValueFrom)(
|
|
256183
256448
|
GraphqlClienAPI.updateProjectClusterAutoscale(projectId, clusterId, input)
|
|
256184
256449
|
);
|
|
256185
256450
|
const a = cluster.autoscale ?? {};
|
|
@@ -256287,15 +256552,15 @@ var list_environments_exports = {};
|
|
|
256287
256552
|
__export(list_environments_exports, {
|
|
256288
256553
|
default: () => list_environments_default
|
|
256289
256554
|
});
|
|
256290
|
-
var
|
|
256555
|
+
var import_rxjs27, import_operators12, list_environments_default;
|
|
256291
256556
|
var init_list_environments = __esm({
|
|
256292
256557
|
"src/commands/environment/list-environments.ts"() {
|
|
256293
|
-
|
|
256558
|
+
import_rxjs27 = __toESM(require_cjs());
|
|
256294
256559
|
import_operators12 = __toESM(require_operators());
|
|
256295
256560
|
init_helpers();
|
|
256296
256561
|
init_gql_client();
|
|
256297
256562
|
init_log();
|
|
256298
|
-
list_environments_default = (cmd) => (0,
|
|
256563
|
+
list_environments_default = (cmd) => (0, import_rxjs27.lastValueFrom)(
|
|
256299
256564
|
parseProjectId(cmd.project).pipe(
|
|
256300
256565
|
(0, import_operators12.switchMap)((projectId) => GraphqlClienAPI.listEnvironments(projectId)),
|
|
256301
256566
|
(0, import_operators12.tap)((data) => {
|
|
@@ -256328,10 +256593,10 @@ var create_environment_exports = {};
|
|
|
256328
256593
|
__export(create_environment_exports, {
|
|
256329
256594
|
default: () => create_environment_default
|
|
256330
256595
|
});
|
|
256331
|
-
var
|
|
256596
|
+
var import_rxjs28, import_operators13, create_environment_default;
|
|
256332
256597
|
var init_create_environment = __esm({
|
|
256333
256598
|
"src/commands/environment/create-environment.ts"() {
|
|
256334
|
-
|
|
256599
|
+
import_rxjs28 = __toESM(require_cjs());
|
|
256335
256600
|
import_operators13 = __toESM(require_operators());
|
|
256336
256601
|
init_helpers();
|
|
256337
256602
|
init_gql_client();
|
|
@@ -256339,7 +256604,7 @@ var init_create_environment = __esm({
|
|
|
256339
256604
|
init_load_spec();
|
|
256340
256605
|
create_environment_default = (cmd) => {
|
|
256341
256606
|
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
256342
|
-
return (0,
|
|
256607
|
+
return (0, import_rxjs28.lastValueFrom)(
|
|
256343
256608
|
parseProjectId(cmd.project).pipe(
|
|
256344
256609
|
(0, import_operators13.switchMap)(
|
|
256345
256610
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -256394,10 +256659,10 @@ var update_environment_exports = {};
|
|
|
256394
256659
|
__export(update_environment_exports, {
|
|
256395
256660
|
default: () => update_environment_default
|
|
256396
256661
|
});
|
|
256397
|
-
var
|
|
256662
|
+
var import_rxjs29, import_operators14, update_environment_default;
|
|
256398
256663
|
var init_update_environment = __esm({
|
|
256399
256664
|
"src/commands/environment/update-environment.ts"() {
|
|
256400
|
-
|
|
256665
|
+
import_rxjs29 = __toESM(require_cjs());
|
|
256401
256666
|
import_operators14 = __toESM(require_operators());
|
|
256402
256667
|
init_helpers();
|
|
256403
256668
|
init_gql_client();
|
|
@@ -256405,7 +256670,7 @@ var init_update_environment = __esm({
|
|
|
256405
256670
|
init_load_spec();
|
|
256406
256671
|
update_environment_default = (cmd) => {
|
|
256407
256672
|
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
256408
|
-
return (0,
|
|
256673
|
+
return (0, import_rxjs29.lastValueFrom)(
|
|
256409
256674
|
parseProjectId(cmd.project).pipe(
|
|
256410
256675
|
(0, import_operators14.switchMap)(
|
|
256411
256676
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -256461,16 +256726,16 @@ var delete_environment_exports = {};
|
|
|
256461
256726
|
__export(delete_environment_exports, {
|
|
256462
256727
|
default: () => delete_environment_default
|
|
256463
256728
|
});
|
|
256464
|
-
var
|
|
256729
|
+
var import_rxjs30, import_operators15, delete_environment_default;
|
|
256465
256730
|
var init_delete_environment = __esm({
|
|
256466
256731
|
"src/commands/environment/delete-environment.ts"() {
|
|
256467
|
-
|
|
256732
|
+
import_rxjs30 = __toESM(require_cjs());
|
|
256468
256733
|
import_operators15 = __toESM(require_operators());
|
|
256469
256734
|
init_helpers();
|
|
256470
256735
|
init_gql_client();
|
|
256471
256736
|
init_log();
|
|
256472
256737
|
init_load_spec();
|
|
256473
|
-
delete_environment_default = (cmd) => (0,
|
|
256738
|
+
delete_environment_default = (cmd) => (0, import_rxjs30.lastValueFrom)(
|
|
256474
256739
|
parseProjectId(cmd.project).pipe(
|
|
256475
256740
|
(0, import_operators15.switchMap)(
|
|
256476
256741
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -256523,16 +256788,16 @@ var get_environment_exports = {};
|
|
|
256523
256788
|
__export(get_environment_exports, {
|
|
256524
256789
|
default: () => get_environment_default
|
|
256525
256790
|
});
|
|
256526
|
-
var
|
|
256791
|
+
var import_rxjs31, import_operators16, get_environment_default;
|
|
256527
256792
|
var init_get_environment = __esm({
|
|
256528
256793
|
"src/commands/environment/get-environment.ts"() {
|
|
256529
|
-
|
|
256794
|
+
import_rxjs31 = __toESM(require_cjs());
|
|
256530
256795
|
import_operators16 = __toESM(require_operators());
|
|
256531
256796
|
init_helpers();
|
|
256532
256797
|
init_gql_client();
|
|
256533
256798
|
init_log();
|
|
256534
256799
|
init_load_spec();
|
|
256535
|
-
get_environment_default = (cmd) => (0,
|
|
256800
|
+
get_environment_default = (cmd) => (0, import_rxjs31.lastValueFrom)(
|
|
256536
256801
|
parseProjectId(cmd.project).pipe(
|
|
256537
256802
|
(0, import_operators16.switchMap)(
|
|
256538
256803
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -270241,8 +270506,8 @@ var require_graceful_fs = __commonJS({
|
|
|
270241
270506
|
}
|
|
270242
270507
|
}
|
|
270243
270508
|
var fs$writeFile = fs4.writeFile;
|
|
270244
|
-
fs4.writeFile =
|
|
270245
|
-
function
|
|
270509
|
+
fs4.writeFile = writeFile13;
|
|
270510
|
+
function writeFile13(path2, data, options, cb) {
|
|
270246
270511
|
if (typeof options === "function")
|
|
270247
270512
|
cb = options, options = null;
|
|
270248
270513
|
return go$writeFile(path2, data, options, cb);
|
|
@@ -270691,7 +270956,7 @@ var require_BufferList2 = __commonJS({
|
|
|
270691
270956
|
this.head = this.tail = null;
|
|
270692
270957
|
this.length = 0;
|
|
270693
270958
|
};
|
|
270694
|
-
BufferList.prototype.join = function
|
|
270959
|
+
BufferList.prototype.join = function join6(s2) {
|
|
270695
270960
|
if (this.length === 0) return "";
|
|
270696
270961
|
var p = this.head;
|
|
270697
270962
|
var ret = "" + p.data;
|
|
@@ -275491,7 +275756,7 @@ var require_buffer_list3 = __commonJS({
|
|
|
275491
275756
|
}
|
|
275492
275757
|
}, {
|
|
275493
275758
|
key: "join",
|
|
275494
|
-
value: function
|
|
275759
|
+
value: function join6(s2) {
|
|
275495
275760
|
if (this.length === 0) return "";
|
|
275496
275761
|
var p = this.head;
|
|
275497
275762
|
var ret = "" + p.data;
|
|
@@ -278833,7 +279098,7 @@ var require_buffer_list4 = __commonJS({
|
|
|
278833
279098
|
}
|
|
278834
279099
|
}, {
|
|
278835
279100
|
key: "join",
|
|
278836
|
-
value: function
|
|
279101
|
+
value: function join6(s2) {
|
|
278837
279102
|
if (this.length === 0) return "";
|
|
278838
279103
|
var p = this.head;
|
|
278839
279104
|
var ret = "" + p.data;
|
|
@@ -281605,7 +281870,7 @@ var require_buffer_list5 = __commonJS({
|
|
|
281605
281870
|
}
|
|
281606
281871
|
}, {
|
|
281607
281872
|
key: "join",
|
|
281608
|
-
value: function
|
|
281873
|
+
value: function join6(s2) {
|
|
281609
281874
|
if (this.length === 0) return "";
|
|
281610
281875
|
var p = this.head;
|
|
281611
281876
|
var ret = "" + p.data;
|
|
@@ -284842,7 +285107,7 @@ var require_buffer_list6 = __commonJS({
|
|
|
284842
285107
|
}
|
|
284843
285108
|
}, {
|
|
284844
285109
|
key: "join",
|
|
284845
|
-
value: function
|
|
285110
|
+
value: function join6(s2) {
|
|
284846
285111
|
if (this.length === 0) return "";
|
|
284847
285112
|
var p = this.head;
|
|
284848
285113
|
var ret = "" + p.data;
|
|
@@ -287790,22 +288055,22 @@ var package_exports = {};
|
|
|
287790
288055
|
__export(package_exports, {
|
|
287791
288056
|
default: () => package_default
|
|
287792
288057
|
});
|
|
287793
|
-
var import_archiver, import_child_process2,
|
|
288058
|
+
var import_archiver, import_child_process2, import_fs4, import_rxjs32, import_operators17, import_util3, ReadFile, package_default;
|
|
287794
288059
|
var init_package = __esm({
|
|
287795
288060
|
"src/commands/lambda/package.ts"() {
|
|
287796
288061
|
import_archiver = __toESM(require_archiver());
|
|
287797
288062
|
import_child_process2 = require("child_process");
|
|
287798
|
-
|
|
287799
|
-
|
|
288063
|
+
import_fs4 = require("fs");
|
|
288064
|
+
import_rxjs32 = __toESM(require_cjs());
|
|
287800
288065
|
import_operators17 = __toESM(require_operators());
|
|
287801
288066
|
import_util3 = require("util");
|
|
287802
288067
|
init_helpers2();
|
|
287803
288068
|
init_load_spec();
|
|
287804
288069
|
init_parse_ignore();
|
|
287805
288070
|
init_read_file();
|
|
287806
|
-
ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0,
|
|
288071
|
+
ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0, import_rxjs32.of)("")));
|
|
287807
288072
|
package_default = (cmd) => {
|
|
287808
|
-
return (0,
|
|
288073
|
+
return (0, import_rxjs32.lastValueFrom)(
|
|
287809
288074
|
loadSpec(cmd.spec).pipe(
|
|
287810
288075
|
(0, import_operators17.map)((spec) => spec?.function ?? spec),
|
|
287811
288076
|
(0, import_operators17.switchMap)(async (data) => {
|
|
@@ -287814,7 +288079,7 @@ var init_package = __esm({
|
|
|
287814
288079
|
// Sets the compression level.
|
|
287815
288080
|
});
|
|
287816
288081
|
await (0, import_util3.promisify)(import_child_process2.exec)(["chmod", "+x", data.script].join(" "));
|
|
287817
|
-
const ignore = await (0,
|
|
288082
|
+
const ignore = await (0, import_rxjs32.lastValueFrom)(
|
|
287818
288083
|
ReadFile(".gignore").pipe(
|
|
287819
288084
|
(0, import_operators17.map)((ignore2) => parseIgnoredFiles(ignore2))
|
|
287820
288085
|
)
|
|
@@ -287823,13 +288088,13 @@ var init_package = __esm({
|
|
|
287823
288088
|
ignore: [".gcache/**", ...ignore]
|
|
287824
288089
|
});
|
|
287825
288090
|
archive.finalize();
|
|
287826
|
-
return (0,
|
|
287827
|
-
(0,
|
|
288091
|
+
return (0, import_rxjs32.lastValueFrom)(
|
|
288092
|
+
(0, import_rxjs32.from)(streamToBufferPromise(archive)).pipe(
|
|
287828
288093
|
(0, import_operators17.switchMap)(
|
|
287829
|
-
(buffer) => (0,
|
|
287830
|
-
(0, import_operators17.catchError)(() => (0,
|
|
288094
|
+
(buffer) => (0, import_rxjs32.from)((0, import_util3.promisify)(import_fs4.mkdir)(".gcache")).pipe(
|
|
288095
|
+
(0, import_operators17.catchError)(() => (0, import_rxjs32.of)(true)),
|
|
287831
288096
|
(0, import_operators17.switchMap)(
|
|
287832
|
-
() => (0, import_util3.promisify)(
|
|
288097
|
+
() => (0, import_util3.promisify)(import_fs4.writeFile)(`.gcache/${data.name}.zip`, buffer)
|
|
287833
288098
|
)
|
|
287834
288099
|
)
|
|
287835
288100
|
)
|
|
@@ -287853,13 +288118,13 @@ function streamToBufferPromise(file2) {
|
|
|
287853
288118
|
});
|
|
287854
288119
|
});
|
|
287855
288120
|
}
|
|
287856
|
-
var import_form_data,
|
|
288121
|
+
var import_form_data, import_fs5, import_rxjs33, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, createCommand;
|
|
287857
288122
|
var init_helpers2 = __esm({
|
|
287858
288123
|
"src/commands/lambda/helpers/index.ts"() {
|
|
287859
288124
|
import_form_data = __toESM(require_form_data());
|
|
287860
|
-
|
|
288125
|
+
import_fs5 = require("fs");
|
|
287861
288126
|
init_src();
|
|
287862
|
-
|
|
288127
|
+
import_rxjs33 = __toESM(require_cjs());
|
|
287863
288128
|
import_operators18 = __toESM(require_operators());
|
|
287864
288129
|
import_stream_to_buffer = __toESM(require_stream_to_buffer());
|
|
287865
288130
|
init_helpers();
|
|
@@ -287868,14 +288133,14 @@ var init_helpers2 = __esm({
|
|
|
287868
288133
|
init_package();
|
|
287869
288134
|
init_load_spec();
|
|
287870
288135
|
init_read_file();
|
|
287871
|
-
ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0,
|
|
287872
|
-
createOrUpdateLambda = (cmd, type) => (0,
|
|
288136
|
+
ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0, import_rxjs33.of)("")));
|
|
288137
|
+
createOrUpdateLambda = (cmd, type) => (0, import_rxjs33.lastValueFrom)(
|
|
287873
288138
|
parseProjectId(cmd.project).pipe(
|
|
287874
288139
|
(0, import_operators18.switchMap)(
|
|
287875
288140
|
(projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators18.map)(() => projectId))
|
|
287876
288141
|
),
|
|
287877
288142
|
(0, import_operators18.switchMap)(async (projectId) => {
|
|
287878
|
-
const spec = await (0,
|
|
288143
|
+
const spec = await (0, import_rxjs33.lastValueFrom)(loadSpec(cmd.spec));
|
|
287879
288144
|
return {
|
|
287880
288145
|
projectId,
|
|
287881
288146
|
...spec?.function ?? spec
|
|
@@ -287889,10 +288154,10 @@ var init_helpers2 = __esm({
|
|
|
287889
288154
|
}
|
|
287890
288155
|
await package_default(cmd);
|
|
287891
288156
|
const body = new import_form_data.default();
|
|
287892
|
-
body.append("file[]", (0,
|
|
287893
|
-
const config2 = await (0,
|
|
287894
|
-
return (0,
|
|
287895
|
-
(0,
|
|
288157
|
+
body.append("file[]", (0, import_fs5.createReadStream)(`.gcache/${data.name}.zip`));
|
|
288158
|
+
const config2 = await (0, import_rxjs33.lastValueFrom)(GraphqlClienAPI.getConfig());
|
|
288159
|
+
return (0, import_rxjs33.lastValueFrom)(
|
|
288160
|
+
(0, import_rxjs33.from)(
|
|
287896
288161
|
fetch2(config2.uploadUrl, {
|
|
287897
288162
|
method: "POST",
|
|
287898
288163
|
body,
|
|
@@ -287913,23 +288178,23 @@ var init_helpers2 = __esm({
|
|
|
287913
288178
|
);
|
|
287914
288179
|
}),
|
|
287915
288180
|
(0, import_operators18.switchMap)(async (payload) => {
|
|
287916
|
-
const clusterId = await (0,
|
|
288181
|
+
const clusterId = await (0, import_rxjs33.lastValueFrom)(
|
|
287917
288182
|
resolveClusterId(payload.projectId, {
|
|
287918
288183
|
clusterId: cmd.clusterId || payload.clusterId,
|
|
287919
288184
|
clusterName: cmd.clusterName || payload.clusterName
|
|
287920
288185
|
})
|
|
287921
288186
|
);
|
|
287922
|
-
return (0,
|
|
288187
|
+
return (0, import_rxjs33.lastValueFrom)(
|
|
287923
288188
|
GraphqlClienAPI[type]({
|
|
287924
|
-
code: cmd.code || await (0,
|
|
288189
|
+
code: cmd.code || await (0, import_rxjs33.lastValueFrom)(ReadFile2(cmd.file || payload.file)) || "",
|
|
287925
288190
|
name: cmd.name || payload.name || "",
|
|
287926
288191
|
projectId: payload.projectId,
|
|
287927
288192
|
route: cmd.route || payload.route || "",
|
|
287928
|
-
buildBashScript: cmd.buildBashScript || await (0,
|
|
288193
|
+
buildBashScript: cmd.buildBashScript || await (0, import_rxjs33.lastValueFrom)(ReadFile2(cmd.script || payload.script)) || "",
|
|
287929
288194
|
configs: cmd.configs || payload.configs || [],
|
|
287930
288195
|
env: cmd.env || payload.env || "nodejs",
|
|
287931
288196
|
method: cmd.method || payload.method || ["GET"],
|
|
287932
|
-
packageJson: cmd.packageJson || await (0,
|
|
288197
|
+
packageJson: cmd.packageJson || await (0, import_rxjs33.lastValueFrom)(ReadFile2(cmd.package || payload.package)) || "{}",
|
|
287933
288198
|
params: cmd.params || payload.params || [],
|
|
287934
288199
|
secrets: cmd.secrets || payload.secrets || [],
|
|
287935
288200
|
envSecrets: cmd.envSecrets || payload.envSecrets || [],
|
|
@@ -287985,15 +288250,15 @@ var list_exports2 = {};
|
|
|
287985
288250
|
__export(list_exports2, {
|
|
287986
288251
|
default: () => list_default2
|
|
287987
288252
|
});
|
|
287988
|
-
var
|
|
288253
|
+
var import_rxjs34, import_operators19, list_default2;
|
|
287989
288254
|
var init_list2 = __esm({
|
|
287990
288255
|
"src/commands/lambda/list.ts"() {
|
|
287991
|
-
|
|
288256
|
+
import_rxjs34 = __toESM(require_cjs());
|
|
287992
288257
|
import_operators19 = __toESM(require_operators());
|
|
287993
288258
|
init_helpers();
|
|
287994
288259
|
init_gql_client();
|
|
287995
288260
|
init_log();
|
|
287996
|
-
list_default2 = (cmd) => (0,
|
|
288261
|
+
list_default2 = (cmd) => (0, import_rxjs34.lastValueFrom)(
|
|
287997
288262
|
parseProjectId(cmd.project).pipe(
|
|
287998
288263
|
(0, import_operators19.switchMap)(
|
|
287999
288264
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288028,10 +288293,10 @@ var get_exports = {};
|
|
|
288028
288293
|
__export(get_exports, {
|
|
288029
288294
|
default: () => get_default
|
|
288030
288295
|
});
|
|
288031
|
-
var
|
|
288296
|
+
var import_rxjs35, import_operators20, get_default;
|
|
288032
288297
|
var init_get = __esm({
|
|
288033
288298
|
"src/commands/lambda/get.ts"() {
|
|
288034
|
-
|
|
288299
|
+
import_rxjs35 = __toESM(require_cjs());
|
|
288035
288300
|
import_operators20 = __toESM(require_operators());
|
|
288036
288301
|
init_helpers();
|
|
288037
288302
|
init_gql_client();
|
|
@@ -288053,26 +288318,26 @@ var init_get = __esm({
|
|
|
288053
288318
|
Logger.log("-------------------");
|
|
288054
288319
|
});
|
|
288055
288320
|
if (cmd.lambda) {
|
|
288056
|
-
return (0,
|
|
288321
|
+
return (0, import_rxjs35.lastValueFrom)(
|
|
288057
288322
|
isMongoId(cmd.lambda).pipe(
|
|
288058
288323
|
(0, import_operators20.switchMap)((id) => GraphqlClienAPI.getLambda(id)),
|
|
288059
288324
|
table
|
|
288060
288325
|
)
|
|
288061
288326
|
);
|
|
288062
288327
|
}
|
|
288063
|
-
const spec = await (0,
|
|
288328
|
+
const spec = await (0, import_rxjs35.lastValueFrom)(loadSpec(cmd.spec));
|
|
288064
288329
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288065
288330
|
if (name2) {
|
|
288066
|
-
return (0,
|
|
288331
|
+
return (0, import_rxjs35.lastValueFrom)(
|
|
288067
288332
|
parseProjectId(cmd.project).pipe(
|
|
288068
288333
|
(0, import_operators20.catchError)((error48) => {
|
|
288069
288334
|
if (!cmd.project) {
|
|
288070
|
-
return (0,
|
|
288335
|
+
return (0, import_rxjs35.throwError)(
|
|
288071
288336
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288072
288337
|
Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
|
|
288073
288338
|
);
|
|
288074
288339
|
}
|
|
288075
|
-
return (0,
|
|
288340
|
+
return (0, import_rxjs35.throwError)(() => error48);
|
|
288076
288341
|
}),
|
|
288077
288342
|
(0, import_operators20.switchMap)(
|
|
288078
288343
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288129,22 +288394,22 @@ var delete_exports = {};
|
|
|
288129
288394
|
__export(delete_exports, {
|
|
288130
288395
|
default: () => delete_default
|
|
288131
288396
|
});
|
|
288132
|
-
var
|
|
288397
|
+
var import_rxjs36, import_operators21, delete_default;
|
|
288133
288398
|
var init_delete = __esm({
|
|
288134
288399
|
"src/commands/lambda/delete.ts"() {
|
|
288135
|
-
|
|
288400
|
+
import_rxjs36 = __toESM(require_cjs());
|
|
288136
288401
|
import_operators21 = __toESM(require_operators());
|
|
288137
288402
|
init_helpers();
|
|
288138
288403
|
init_gql_client();
|
|
288139
288404
|
init_log();
|
|
288140
288405
|
init_load_spec();
|
|
288141
288406
|
delete_default = async (cmd) => {
|
|
288142
|
-
const spec = await (0,
|
|
288407
|
+
const spec = await (0, import_rxjs36.lastValueFrom)(loadSpec(cmd.spec));
|
|
288143
288408
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288144
288409
|
const env = cmd.env ?? spec.function?.env ?? spec.env;
|
|
288145
288410
|
const clusterIdHint = cmd.clusterId ?? spec.function?.clusterId ?? spec.clusterId;
|
|
288146
288411
|
const clusterNameHint = cmd.clusterName ?? spec.function?.clusterName ?? spec.clusterName;
|
|
288147
|
-
return (0,
|
|
288412
|
+
return (0, import_rxjs36.lastValueFrom)(
|
|
288148
288413
|
parseProjectId(cmd.project).pipe(
|
|
288149
288414
|
(0, import_operators21.switchMap)(
|
|
288150
288415
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288179,10 +288444,10 @@ var logs_exports = {};
|
|
|
288179
288444
|
__export(logs_exports, {
|
|
288180
288445
|
default: () => logs_default
|
|
288181
288446
|
});
|
|
288182
|
-
var
|
|
288447
|
+
var import_rxjs37, import_operators22, logs_default;
|
|
288183
288448
|
var init_logs = __esm({
|
|
288184
288449
|
"src/commands/lambda/logs.ts"() {
|
|
288185
|
-
|
|
288450
|
+
import_rxjs37 = __toESM(require_cjs());
|
|
288186
288451
|
import_operators22 = __toESM(require_operators());
|
|
288187
288452
|
init_helpers();
|
|
288188
288453
|
init_gql_client();
|
|
@@ -288191,26 +288456,26 @@ var init_logs = __esm({
|
|
|
288191
288456
|
logs_default = async (cmd) => {
|
|
288192
288457
|
const result = (0, import_operators22.tap)(({ data }) => Logger.log(data));
|
|
288193
288458
|
if (cmd.lambda) {
|
|
288194
|
-
return (0,
|
|
288459
|
+
return (0, import_rxjs37.lastValueFrom)(
|
|
288195
288460
|
isMongoId(cmd.lambda).pipe(
|
|
288196
288461
|
(0, import_operators22.switchMap)((id) => GraphqlClienAPI.getLambdaLogs(id)),
|
|
288197
288462
|
result
|
|
288198
288463
|
)
|
|
288199
288464
|
);
|
|
288200
288465
|
}
|
|
288201
|
-
const spec = await (0,
|
|
288466
|
+
const spec = await (0, import_rxjs37.lastValueFrom)(loadSpec(cmd.spec));
|
|
288202
288467
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288203
288468
|
if (name2) {
|
|
288204
|
-
return (0,
|
|
288469
|
+
return (0, import_rxjs37.lastValueFrom)(
|
|
288205
288470
|
parseProjectId(cmd.project).pipe(
|
|
288206
288471
|
(0, import_operators22.catchError)((error48) => {
|
|
288207
288472
|
if (!cmd.project) {
|
|
288208
|
-
return (0,
|
|
288473
|
+
return (0, import_rxjs37.throwError)(
|
|
288209
288474
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288210
288475
|
Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
|
|
288211
288476
|
);
|
|
288212
288477
|
}
|
|
288213
|
-
return (0,
|
|
288478
|
+
return (0, import_rxjs37.throwError)(() => error48);
|
|
288214
288479
|
}),
|
|
288215
288480
|
(0, import_operators22.switchMap)(
|
|
288216
288481
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288236,10 +288501,10 @@ var logs_builder_exports = {};
|
|
|
288236
288501
|
__export(logs_builder_exports, {
|
|
288237
288502
|
default: () => logs_builder_default
|
|
288238
288503
|
});
|
|
288239
|
-
var
|
|
288504
|
+
var import_rxjs38, import_operators23, logs_builder_default;
|
|
288240
288505
|
var init_logs_builder = __esm({
|
|
288241
288506
|
"src/commands/lambda/logs-builder.ts"() {
|
|
288242
|
-
|
|
288507
|
+
import_rxjs38 = __toESM(require_cjs());
|
|
288243
288508
|
import_operators23 = __toESM(require_operators());
|
|
288244
288509
|
init_helpers();
|
|
288245
288510
|
init_gql_client();
|
|
@@ -288248,26 +288513,26 @@ var init_logs_builder = __esm({
|
|
|
288248
288513
|
logs_builder_default = async (cmd) => {
|
|
288249
288514
|
const result = (0, import_operators23.tap)(({ data }) => Logger.log(data));
|
|
288250
288515
|
if (cmd.lambda) {
|
|
288251
|
-
return (0,
|
|
288516
|
+
return (0, import_rxjs38.lastValueFrom)(
|
|
288252
288517
|
isMongoId(cmd.lambda).pipe(
|
|
288253
288518
|
(0, import_operators23.switchMap)((id) => GraphqlClienAPI.getLambdaBuilderLogs(id)),
|
|
288254
288519
|
result
|
|
288255
288520
|
)
|
|
288256
288521
|
);
|
|
288257
288522
|
}
|
|
288258
|
-
const spec = await (0,
|
|
288523
|
+
const spec = await (0, import_rxjs38.lastValueFrom)(loadSpec(cmd.spec));
|
|
288259
288524
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288260
288525
|
if (name2) {
|
|
288261
|
-
return (0,
|
|
288526
|
+
return (0, import_rxjs38.lastValueFrom)(
|
|
288262
288527
|
parseProjectId(cmd.project).pipe(
|
|
288263
288528
|
(0, import_operators23.catchError)((error48) => {
|
|
288264
288529
|
if (!cmd.project) {
|
|
288265
|
-
return (0,
|
|
288530
|
+
return (0, import_rxjs38.throwError)(
|
|
288266
288531
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288267
288532
|
Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
|
|
288268
288533
|
);
|
|
288269
288534
|
}
|
|
288270
|
-
return (0,
|
|
288535
|
+
return (0, import_rxjs38.throwError)(() => error48);
|
|
288271
288536
|
}),
|
|
288272
288537
|
(0, import_operators23.switchMap)(
|
|
288273
288538
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -288297,18 +288562,18 @@ var test_exports = {};
|
|
|
288297
288562
|
__export(test_exports, {
|
|
288298
288563
|
default: () => test_default
|
|
288299
288564
|
});
|
|
288300
|
-
var
|
|
288565
|
+
var import_rxjs39, import_operators24, test_default;
|
|
288301
288566
|
var init_test = __esm({
|
|
288302
288567
|
"src/commands/lambda/test.ts"() {
|
|
288303
|
-
|
|
288568
|
+
import_rxjs39 = __toESM(require_cjs());
|
|
288304
288569
|
import_operators24 = __toESM(require_operators());
|
|
288305
288570
|
init_helpers();
|
|
288306
288571
|
init_gql_client();
|
|
288307
288572
|
init_log();
|
|
288308
288573
|
init_load_spec();
|
|
288309
288574
|
test_default = async (cmd) => {
|
|
288310
|
-
const spec = await (0,
|
|
288311
|
-
const processParameters = (lambda) => (0,
|
|
288575
|
+
const spec = await (0, import_rxjs39.lastValueFrom)(loadSpec(cmd.spec));
|
|
288576
|
+
const processParameters = (lambda) => (0, import_rxjs39.of)(lambda).pipe(
|
|
288312
288577
|
(0, import_operators24.map)((lambda2) => ({
|
|
288313
288578
|
...lambda2,
|
|
288314
288579
|
url: cmd.pathParams ? cmd.pathParams.split(";").map((param) => param.split("=")).reduce(
|
|
@@ -288322,7 +288587,7 @@ var init_test = __esm({
|
|
|
288322
288587
|
);
|
|
288323
288588
|
}),
|
|
288324
288589
|
(0, import_operators24.switchMap)(
|
|
288325
|
-
(lambda2) => (0,
|
|
288590
|
+
(lambda2) => (0, import_rxjs39.from)(
|
|
288326
288591
|
fetch([lambda2.url, cmd.queryParams].filter((i2) => !!i2).join(""), {
|
|
288327
288592
|
method: cmd?.method ?? "GET",
|
|
288328
288593
|
body: cmd.body
|
|
@@ -288338,7 +288603,7 @@ var init_test = __esm({
|
|
|
288338
288603
|
})
|
|
288339
288604
|
);
|
|
288340
288605
|
if (cmd.lambda) {
|
|
288341
|
-
return (0,
|
|
288606
|
+
return (0, import_rxjs39.lastValueFrom)(
|
|
288342
288607
|
isMongoId(cmd.lambda).pipe(
|
|
288343
288608
|
(0, import_operators24.switchMap)(
|
|
288344
288609
|
(id) => GraphqlClienAPI.getLambda(id, ["id", "url", "method", "params"])
|
|
@@ -288349,16 +288614,16 @@ var init_test = __esm({
|
|
|
288349
288614
|
}
|
|
288350
288615
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
288351
288616
|
if (name2) {
|
|
288352
|
-
return (0,
|
|
288617
|
+
return (0, import_rxjs39.lastValueFrom)(
|
|
288353
288618
|
parseProjectId(cmd.project).pipe(
|
|
288354
288619
|
(0, import_operators24.catchError)((error48) => {
|
|
288355
288620
|
if (!cmd.project) {
|
|
288356
|
-
return (0,
|
|
288621
|
+
return (0, import_rxjs39.throwError)(
|
|
288357
288622
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
288358
288623
|
Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
|
|
288359
288624
|
);
|
|
288360
288625
|
}
|
|
288361
|
-
return (0,
|
|
288626
|
+
return (0, import_rxjs39.throwError)(() => error48);
|
|
288362
288627
|
}),
|
|
288363
288628
|
(0, import_operators24.switchMap)(
|
|
288364
288629
|
(projectId) => GraphqlClienAPI.getLambdaByName(name2, projectId, [
|
|
@@ -288382,14 +288647,14 @@ var list_exports3 = {};
|
|
|
288382
288647
|
__export(list_exports3, {
|
|
288383
288648
|
default: () => list_default3
|
|
288384
288649
|
});
|
|
288385
|
-
var
|
|
288650
|
+
var import_rxjs40, import_operators25, list_default3;
|
|
288386
288651
|
var init_list3 = __esm({
|
|
288387
288652
|
"src/commands/plugin/list.ts"() {
|
|
288388
|
-
|
|
288653
|
+
import_rxjs40 = __toESM(require_cjs());
|
|
288389
288654
|
import_operators25 = __toESM(require_operators());
|
|
288390
288655
|
init_gql_client();
|
|
288391
288656
|
init_log();
|
|
288392
|
-
list_default3 = () => (0,
|
|
288657
|
+
list_default3 = () => (0, import_rxjs40.lastValueFrom)(
|
|
288393
288658
|
GraphqlClienAPI.listAvailablePlugins().pipe(
|
|
288394
288659
|
(0, import_operators25.tap)((plugins) => {
|
|
288395
288660
|
Logger.log("-------------------");
|
|
@@ -288414,15 +288679,15 @@ var installed_exports = {};
|
|
|
288414
288679
|
__export(installed_exports, {
|
|
288415
288680
|
default: () => installed_default
|
|
288416
288681
|
});
|
|
288417
|
-
var
|
|
288682
|
+
var import_rxjs41, import_operators26, installed_default;
|
|
288418
288683
|
var init_installed = __esm({
|
|
288419
288684
|
"src/commands/plugin/installed.ts"() {
|
|
288420
|
-
|
|
288685
|
+
import_rxjs41 = __toESM(require_cjs());
|
|
288421
288686
|
import_operators26 = __toESM(require_operators());
|
|
288422
288687
|
init_helpers();
|
|
288423
288688
|
init_gql_client();
|
|
288424
288689
|
init_log();
|
|
288425
|
-
installed_default = (cmd) => (0,
|
|
288690
|
+
installed_default = (cmd) => (0, import_rxjs41.lastValueFrom)(
|
|
288426
288691
|
parseProjectId(cmd.project).pipe(
|
|
288427
288692
|
(0, import_operators26.switchMap)((projectId) => GraphqlClienAPI.listInstalledPlugins(projectId)),
|
|
288428
288693
|
(0, import_operators26.tap)((installed) => {
|
|
@@ -288453,16 +288718,16 @@ var install_exports = {};
|
|
|
288453
288718
|
__export(install_exports, {
|
|
288454
288719
|
default: () => install_default
|
|
288455
288720
|
});
|
|
288456
|
-
var
|
|
288721
|
+
var import_rxjs42, import_operators27, install_default;
|
|
288457
288722
|
var init_install = __esm({
|
|
288458
288723
|
"src/commands/plugin/install.ts"() {
|
|
288459
|
-
|
|
288724
|
+
import_rxjs42 = __toESM(require_cjs());
|
|
288460
288725
|
import_operators27 = __toESM(require_operators());
|
|
288461
288726
|
init_helpers();
|
|
288462
288727
|
init_gql_client();
|
|
288463
288728
|
init_log();
|
|
288464
288729
|
init_load_spec();
|
|
288465
|
-
install_default = (cmd) => (0,
|
|
288730
|
+
install_default = (cmd) => (0, import_rxjs42.lastValueFrom)(
|
|
288466
288731
|
parseProjectId(cmd.project).pipe(
|
|
288467
288732
|
(0, import_operators27.switchMap)(
|
|
288468
288733
|
(projectId) => loadSpec(
|
|
@@ -288471,7 +288736,7 @@ var init_install = __esm({
|
|
|
288471
288736
|
// No spec file is required at all if --name/--cluster fully
|
|
288472
288737
|
// cover it (unlike every other resource here, a plugin install
|
|
288473
288738
|
// is often just "install this by name", no YAML needed).
|
|
288474
|
-
(0, import_operators27.catchError)(() => (0,
|
|
288739
|
+
(0, import_operators27.catchError)(() => (0, import_rxjs42.of)(void 0)),
|
|
288475
288740
|
(0, import_operators27.map)((data) => ({
|
|
288476
288741
|
projectId,
|
|
288477
288742
|
...data ? data.plugin ?? data : {}
|
|
@@ -288502,15 +288767,15 @@ var uninstall_exports = {};
|
|
|
288502
288767
|
__export(uninstall_exports, {
|
|
288503
288768
|
default: () => uninstall_default
|
|
288504
288769
|
});
|
|
288505
|
-
var
|
|
288770
|
+
var import_rxjs43, import_operators28, uninstall_default;
|
|
288506
288771
|
var init_uninstall = __esm({
|
|
288507
288772
|
"src/commands/plugin/uninstall.ts"() {
|
|
288508
|
-
|
|
288773
|
+
import_rxjs43 = __toESM(require_cjs());
|
|
288509
288774
|
import_operators28 = __toESM(require_operators());
|
|
288510
288775
|
init_helpers();
|
|
288511
288776
|
init_gql_client();
|
|
288512
288777
|
init_log();
|
|
288513
|
-
uninstall_default = (cmd) => (0,
|
|
288778
|
+
uninstall_default = (cmd) => (0, import_rxjs43.lastValueFrom)(
|
|
288514
288779
|
parseProjectId(cmd.project).pipe(
|
|
288515
288780
|
(0, import_operators28.switchMap)(
|
|
288516
288781
|
(projectId) => GraphqlClienAPI.uninstallPlugin(projectId, cmd.name, cmd.cluster)
|
|
@@ -288530,14 +288795,14 @@ var list_exports4 = {};
|
|
|
288530
288795
|
__export(list_exports4, {
|
|
288531
288796
|
default: () => list_default4
|
|
288532
288797
|
});
|
|
288533
|
-
var
|
|
288798
|
+
var import_rxjs44, import_operators29, list_default4;
|
|
288534
288799
|
var init_list4 = __esm({
|
|
288535
288800
|
"src/commands/project/list.ts"() {
|
|
288536
|
-
|
|
288801
|
+
import_rxjs44 = __toESM(require_cjs());
|
|
288537
288802
|
import_operators29 = __toESM(require_operators());
|
|
288538
288803
|
init_gql_client();
|
|
288539
288804
|
init_log();
|
|
288540
|
-
list_default4 = async () => (0,
|
|
288805
|
+
list_default4 = async () => (0, import_rxjs44.lastValueFrom)(
|
|
288541
288806
|
GraphqlClienAPI.listProjects().pipe(
|
|
288542
288807
|
(0, import_operators29.tap)((project) => {
|
|
288543
288808
|
const columns = ["id", "name"];
|
|
@@ -288556,25 +288821,25 @@ var use_exports = {};
|
|
|
288556
288821
|
__export(use_exports, {
|
|
288557
288822
|
default: () => use_default
|
|
288558
288823
|
});
|
|
288559
|
-
var
|
|
288824
|
+
var import_fs6, import_rxjs45, import_operators30, import_util4, use_default;
|
|
288560
288825
|
var init_use = __esm({
|
|
288561
288826
|
"src/commands/project/use.ts"() {
|
|
288562
|
-
|
|
288563
|
-
|
|
288827
|
+
import_fs6 = require("fs");
|
|
288828
|
+
import_rxjs45 = __toESM(require_cjs());
|
|
288564
288829
|
import_operators30 = __toESM(require_operators());
|
|
288565
288830
|
import_util4 = require("util");
|
|
288566
288831
|
init_helpers();
|
|
288567
288832
|
init_gql_client();
|
|
288568
288833
|
init_types();
|
|
288569
288834
|
use_default = async (cmd) => {
|
|
288570
|
-
return (0,
|
|
288835
|
+
return (0, import_rxjs45.lastValueFrom)(
|
|
288571
288836
|
parseProjectId(cmd).pipe(
|
|
288572
288837
|
(0, import_operators30.switchMap)(
|
|
288573
288838
|
(projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators30.map)(() => projectId))
|
|
288574
288839
|
),
|
|
288575
288840
|
(0, import_operators30.switchMap)(
|
|
288576
|
-
(projectId) => (0,
|
|
288577
|
-
(0, import_util4.promisify)(
|
|
288841
|
+
(projectId) => (0, import_rxjs45.from)(
|
|
288842
|
+
(0, import_util4.promisify)(import_fs6.writeFile)(projectDirectory, projectId, {
|
|
288578
288843
|
encoding: "utf-8"
|
|
288579
288844
|
})
|
|
288580
288845
|
)
|
|
@@ -288590,13 +288855,13 @@ var clear_exports = {};
|
|
|
288590
288855
|
__export(clear_exports, {
|
|
288591
288856
|
default: () => clear_default
|
|
288592
288857
|
});
|
|
288593
|
-
var
|
|
288858
|
+
var import_fs7, import_util5, clear_default;
|
|
288594
288859
|
var init_clear = __esm({
|
|
288595
288860
|
"src/commands/project/clear.ts"() {
|
|
288596
|
-
|
|
288861
|
+
import_fs7 = require("fs");
|
|
288597
288862
|
import_util5 = require("util");
|
|
288598
288863
|
init_types();
|
|
288599
|
-
clear_default = async () => (0, import_util5.promisify)(
|
|
288864
|
+
clear_default = async () => (0, import_util5.promisify)(import_fs7.unlink)(projectDirectory);
|
|
288600
288865
|
}
|
|
288601
288866
|
});
|
|
288602
288867
|
|
|
@@ -319410,7 +319675,7 @@ __export(start_exports, {
|
|
|
319410
319675
|
default: () => startProxy
|
|
319411
319676
|
});
|
|
319412
319677
|
async function startProxy(cmd) {
|
|
319413
|
-
return (0,
|
|
319678
|
+
return (0, import_rxjs46.lastValueFrom)(
|
|
319414
319679
|
GraphqlClienAPI.getConfig().pipe(
|
|
319415
319680
|
(0, import_operators31.take)(1),
|
|
319416
319681
|
(0, import_operators31.map)((config2) => ({
|
|
@@ -319426,7 +319691,7 @@ async function startProxy(cmd) {
|
|
|
319426
319691
|
process.stderr.write("Retrieving config for auth...\n");
|
|
319427
319692
|
}),
|
|
319428
319693
|
(0, import_operators31.switchMap)(
|
|
319429
|
-
(config2) => config2?.token ? (0,
|
|
319694
|
+
(config2) => config2?.token ? (0, import_rxjs46.of)(config2) : (0, import_rxjs46.throwError)(
|
|
319430
319695
|
() => new Error("User is not authenticated (no token in config)")
|
|
319431
319696
|
)
|
|
319432
319697
|
),
|
|
@@ -319444,7 +319709,7 @@ async function startProxy(cmd) {
|
|
|
319444
319709
|
Authorization: config2.token
|
|
319445
319710
|
}
|
|
319446
319711
|
},
|
|
319447
|
-
fetch: (input, init) => (0,
|
|
319712
|
+
fetch: (input, init) => (0, import_rxjs46.lastValueFrom)(performFetch(input, init))
|
|
319448
319713
|
}),
|
|
319449
319714
|
client: new Client({
|
|
319450
319715
|
name: "gapi-proxy-client",
|
|
@@ -319455,7 +319720,7 @@ async function startProxy(cmd) {
|
|
|
319455
319720
|
process.stderr.write("Connecting to upstream...\n");
|
|
319456
319721
|
}),
|
|
319457
319722
|
(0, import_operators31.switchMap)(
|
|
319458
|
-
(config2) => (0,
|
|
319723
|
+
(config2) => (0, import_rxjs46.from)(config2.client.connect(config2.transport)).pipe((0, import_operators31.map)(() => config2))
|
|
319459
319724
|
),
|
|
319460
319725
|
(0, import_operators31.tap)(() => {
|
|
319461
319726
|
process.stderr.write("Connected to upstream MCP server\n");
|
|
@@ -319481,25 +319746,25 @@ async function startProxy(cmd) {
|
|
|
319481
319746
|
capabilities: config2.capabilities || {}
|
|
319482
319747
|
}
|
|
319483
319748
|
);
|
|
319484
|
-
server2.fallbackRequestHandler = async (request) => (0,
|
|
319485
|
-
(0,
|
|
319749
|
+
server2.fallbackRequestHandler = async (request) => (0, import_rxjs46.lastValueFrom)(
|
|
319750
|
+
(0, import_rxjs46.defer)(() => config2.client.request(request, external_exports3.any())).pipe(
|
|
319486
319751
|
(0, import_operators31.catchError)((e2) => {
|
|
319487
319752
|
process.stderr.write(`Upstream error: ${e2.message}
|
|
319488
319753
|
`);
|
|
319489
|
-
return (0,
|
|
319754
|
+
return (0, import_rxjs46.throwError)(() => e2);
|
|
319490
319755
|
})
|
|
319491
319756
|
)
|
|
319492
319757
|
);
|
|
319493
319758
|
server2.fallbackNotificationHandler = async (notification) => {
|
|
319494
|
-
await (0,
|
|
319495
|
-
(0,
|
|
319759
|
+
await (0, import_rxjs46.lastValueFrom)(
|
|
319760
|
+
(0, import_rxjs46.of)(notification).pipe(
|
|
319496
319761
|
(0, import_operators31.filter)((n) => n.method !== "notifications/initialized"),
|
|
319497
319762
|
(0, import_operators31.switchMap)(
|
|
319498
|
-
(n) => (0,
|
|
319763
|
+
(n) => (0, import_rxjs46.defer)(() => config2.client.notification(n)).pipe(
|
|
319499
319764
|
(0, import_operators31.catchError)((e2) => {
|
|
319500
319765
|
process.stderr.write(`Notification error: ${e2}
|
|
319501
319766
|
`);
|
|
319502
|
-
return
|
|
319767
|
+
return import_rxjs46.EMPTY;
|
|
319503
319768
|
})
|
|
319504
319769
|
)
|
|
319505
319770
|
),
|
|
@@ -319509,7 +319774,7 @@ async function startProxy(cmd) {
|
|
|
319509
319774
|
};
|
|
319510
319775
|
return server2;
|
|
319511
319776
|
}),
|
|
319512
|
-
(0, import_operators31.switchMap)((server2) => (0,
|
|
319777
|
+
(0, import_operators31.switchMap)((server2) => (0, import_rxjs46.from)(server2.connect(new StdioServerTransport()))),
|
|
319513
319778
|
(0, import_operators31.tap)(() => {
|
|
319514
319779
|
process.stderr.write("MCP stdio server ready\n");
|
|
319515
319780
|
}),
|
|
@@ -319519,20 +319784,20 @@ async function startProxy(cmd) {
|
|
|
319519
319784
|
)
|
|
319520
319785
|
);
|
|
319521
319786
|
}
|
|
319522
|
-
var
|
|
319787
|
+
var import_rxjs46, import_operators31, import_stream2, performFetch;
|
|
319523
319788
|
var init_start = __esm({
|
|
319524
319789
|
"src/commands/proxy/start.ts"() {
|
|
319525
319790
|
init_client2();
|
|
319526
319791
|
init_streamableHttp();
|
|
319527
319792
|
init_server2();
|
|
319528
319793
|
init_stdio2();
|
|
319529
|
-
|
|
319794
|
+
import_rxjs46 = __toESM(require_cjs());
|
|
319530
319795
|
import_operators31 = __toESM(require_operators());
|
|
319531
319796
|
import_stream2 = require("stream");
|
|
319532
319797
|
init_zod();
|
|
319533
319798
|
init_gql_client();
|
|
319534
319799
|
performFetch = (input, init) => {
|
|
319535
|
-
return (0,
|
|
319800
|
+
return (0, import_rxjs46.from)(fetch(input, init)).pipe(
|
|
319536
319801
|
(0, import_operators31.switchMap)((res) => {
|
|
319537
319802
|
if (res.status === 401 || res.status === 403) {
|
|
319538
319803
|
process.stderr.write(
|
|
@@ -319554,7 +319819,7 @@ var init_start = __esm({
|
|
|
319554
319819
|
})
|
|
319555
319820
|
);
|
|
319556
319821
|
}
|
|
319557
|
-
return (0,
|
|
319822
|
+
return (0, import_rxjs46.of)(res);
|
|
319558
319823
|
}),
|
|
319559
319824
|
(0, import_operators31.map)((res) => {
|
|
319560
319825
|
if (typeof res?.body?.pipeThrough !== "function") {
|
|
@@ -319573,7 +319838,7 @@ var init_start = __esm({
|
|
|
319573
319838
|
(0, import_operators31.catchError)((e2) => {
|
|
319574
319839
|
process.stderr.write(`[ERROR] Fetch error: ${e2.message}
|
|
319575
319840
|
`);
|
|
319576
|
-
return (0,
|
|
319841
|
+
return (0, import_rxjs46.throwError)(() => e2);
|
|
319577
319842
|
})
|
|
319578
319843
|
);
|
|
319579
319844
|
};
|
|
@@ -319585,16 +319850,16 @@ var create_exports3 = {};
|
|
|
319585
319850
|
__export(create_exports3, {
|
|
319586
319851
|
default: () => create_default3
|
|
319587
319852
|
});
|
|
319588
|
-
var
|
|
319853
|
+
var import_rxjs47, import_operators32, create_default3;
|
|
319589
319854
|
var init_create3 = __esm({
|
|
319590
319855
|
"src/commands/rabbitmq/create.ts"() {
|
|
319591
|
-
|
|
319856
|
+
import_rxjs47 = __toESM(require_cjs());
|
|
319592
319857
|
import_operators32 = __toESM(require_operators());
|
|
319593
319858
|
init_helpers();
|
|
319594
319859
|
init_gql_client();
|
|
319595
319860
|
init_log();
|
|
319596
319861
|
init_load_spec();
|
|
319597
|
-
create_default3 = (cmd) => (0,
|
|
319862
|
+
create_default3 = (cmd) => (0, import_rxjs47.lastValueFrom)(
|
|
319598
319863
|
parseProjectId(cmd.project).pipe(
|
|
319599
319864
|
(0, import_operators32.switchMap)(
|
|
319600
319865
|
(projectId) => loadSpec(
|
|
@@ -319633,15 +319898,15 @@ var list_exports5 = {};
|
|
|
319633
319898
|
__export(list_exports5, {
|
|
319634
319899
|
default: () => list_default5
|
|
319635
319900
|
});
|
|
319636
|
-
var
|
|
319901
|
+
var import_rxjs48, import_operators33, list_default5;
|
|
319637
319902
|
var init_list5 = __esm({
|
|
319638
319903
|
"src/commands/rabbitmq/list.ts"() {
|
|
319639
|
-
|
|
319904
|
+
import_rxjs48 = __toESM(require_cjs());
|
|
319640
319905
|
import_operators33 = __toESM(require_operators());
|
|
319641
319906
|
init_helpers();
|
|
319642
319907
|
init_gql_client();
|
|
319643
319908
|
init_log();
|
|
319644
|
-
list_default5 = (cmd) => (0,
|
|
319909
|
+
list_default5 = (cmd) => (0, import_rxjs48.lastValueFrom)(
|
|
319645
319910
|
parseProjectId(cmd.project).pipe(
|
|
319646
319911
|
(0, import_operators33.switchMap)(
|
|
319647
319912
|
(projectId) => GraphqlClienAPI.listRabbitMqInstances(projectId)
|
|
@@ -319676,15 +319941,15 @@ var delete_exports2 = {};
|
|
|
319676
319941
|
__export(delete_exports2, {
|
|
319677
319942
|
default: () => delete_default2
|
|
319678
319943
|
});
|
|
319679
|
-
var
|
|
319944
|
+
var import_rxjs49, import_operators34, delete_default2;
|
|
319680
319945
|
var init_delete2 = __esm({
|
|
319681
319946
|
"src/commands/rabbitmq/delete.ts"() {
|
|
319682
|
-
|
|
319947
|
+
import_rxjs49 = __toESM(require_cjs());
|
|
319683
319948
|
import_operators34 = __toESM(require_operators());
|
|
319684
319949
|
init_helpers();
|
|
319685
319950
|
init_gql_client();
|
|
319686
319951
|
init_log();
|
|
319687
|
-
delete_default2 = (cmd) => (0,
|
|
319952
|
+
delete_default2 = (cmd) => (0, import_rxjs49.lastValueFrom)(
|
|
319688
319953
|
parseProjectId(cmd.project).pipe(
|
|
319689
319954
|
(0, import_operators34.switchMap)(
|
|
319690
319955
|
(projectId) => GraphqlClienAPI.uninstallRabbitMq(cmd.id, projectId)
|
|
@@ -319701,10 +319966,10 @@ var init_delete2 = __esm({
|
|
|
319701
319966
|
});
|
|
319702
319967
|
|
|
319703
319968
|
// src/commands/runner/config.ts
|
|
319704
|
-
var
|
|
319969
|
+
var import_promises5, DEFAULT_WS_URL, deriveSubscriptionsUrl, readLoginApiUrl, readSavedRunner, saveRunner, forgetRunner;
|
|
319705
319970
|
var init_config = __esm({
|
|
319706
319971
|
"src/commands/runner/config.ts"() {
|
|
319707
|
-
|
|
319972
|
+
import_promises5 = require("fs/promises");
|
|
319708
319973
|
init_types();
|
|
319709
319974
|
DEFAULT_WS_URL = "wss://api.lambforge.com/subscriptions";
|
|
319710
319975
|
deriveSubscriptionsUrl = (apiUrl) => {
|
|
@@ -319720,21 +319985,21 @@ var init_config = __esm({
|
|
|
319720
319985
|
url2.search = "";
|
|
319721
319986
|
return url2.toString();
|
|
319722
319987
|
};
|
|
319723
|
-
readLoginApiUrl = () => (0,
|
|
319988
|
+
readLoginApiUrl = () => (0, import_promises5.readFile)(urlDirectory, "utf-8").catch(() => "");
|
|
319724
319989
|
readSavedRunner = async () => {
|
|
319725
319990
|
try {
|
|
319726
|
-
const saved = JSON.parse(await (0,
|
|
319991
|
+
const saved = JSON.parse(await (0, import_promises5.readFile)(runnerDirectory, "utf-8"));
|
|
319727
319992
|
return saved?.id && saved?.token ? saved : null;
|
|
319728
319993
|
} catch {
|
|
319729
319994
|
return null;
|
|
319730
319995
|
}
|
|
319731
319996
|
};
|
|
319732
319997
|
saveRunner = async (runner) => {
|
|
319733
|
-
await (0,
|
|
319734
|
-
await (0,
|
|
319735
|
-
await (0,
|
|
319998
|
+
await (0, import_promises5.mkdir)(mainDirectory, { recursive: true });
|
|
319999
|
+
await (0, import_promises5.writeFile)(runnerDirectory, JSON.stringify(runner, null, 2), "utf-8");
|
|
320000
|
+
await (0, import_promises5.chmod)(runnerDirectory, 384);
|
|
319736
320001
|
};
|
|
319737
|
-
forgetRunner = () => (0,
|
|
320002
|
+
forgetRunner = () => (0, import_promises5.rm)(runnerDirectory, { force: true });
|
|
319738
320003
|
}
|
|
319739
320004
|
});
|
|
319740
320005
|
|
|
@@ -320256,19 +320521,19 @@ var init_connection = __esm({
|
|
|
320256
320521
|
});
|
|
320257
320522
|
|
|
320258
320523
|
// src/commands/runner/daemon.ts
|
|
320259
|
-
var import_child_process3,
|
|
320524
|
+
var import_child_process3, import_fs8, import_promises6, import_os4, import_path4, import_util11, DEFAULT_SERVICE_NAME, RUNNER_AUTH_EXIT_CODE, systemdQuote, unitPath, buildUnit, resolveGcliCommand, defaultExec, SystemdUserService, assertSystemdAvailable;
|
|
320260
320525
|
var init_daemon = __esm({
|
|
320261
320526
|
"src/commands/runner/daemon.ts"() {
|
|
320262
320527
|
import_child_process3 = require("child_process");
|
|
320263
|
-
|
|
320264
|
-
|
|
320265
|
-
|
|
320266
|
-
|
|
320528
|
+
import_fs8 = require("fs");
|
|
320529
|
+
import_promises6 = require("fs/promises");
|
|
320530
|
+
import_os4 = require("os");
|
|
320531
|
+
import_path4 = require("path");
|
|
320267
320532
|
import_util11 = require("util");
|
|
320268
320533
|
DEFAULT_SERVICE_NAME = "lambforge-runner";
|
|
320269
320534
|
RUNNER_AUTH_EXIT_CODE = 78;
|
|
320270
320535
|
systemdQuote = (word) => /^[A-Za-z0-9_@%+=:,./-]+$/.test(word) ? word : `"${word.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
320271
|
-
unitPath = (serviceName, home = (0,
|
|
320536
|
+
unitPath = (serviceName, home = (0, import_os4.homedir)()) => (0, import_path4.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
|
|
320272
320537
|
buildUnit = ({
|
|
320273
320538
|
serviceName,
|
|
320274
320539
|
execStart,
|
|
@@ -320307,7 +320572,7 @@ var init_daemon = __esm({
|
|
|
320307
320572
|
}
|
|
320308
320573
|
let script = argv[1];
|
|
320309
320574
|
try {
|
|
320310
|
-
script = (0,
|
|
320575
|
+
script = (0, import_fs8.realpathSync)(script);
|
|
320311
320576
|
} catch {
|
|
320312
320577
|
}
|
|
320313
320578
|
const ephemeral = /[/\\]_npx[/\\]|[/\\]\.npm[/\\]_cacache/.test(script);
|
|
@@ -320318,7 +320583,7 @@ var init_daemon = __esm({
|
|
|
320318
320583
|
};
|
|
320319
320584
|
defaultExec = (file2, args) => (0, import_util11.promisify)(import_child_process3.execFile)(file2, args, { encoding: "utf8" });
|
|
320320
320585
|
SystemdUserService = class {
|
|
320321
|
-
constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0,
|
|
320586
|
+
constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0, import_os4.homedir)()) {
|
|
320322
320587
|
this.serviceName = serviceName;
|
|
320323
320588
|
this.exec = exec2;
|
|
320324
320589
|
this.home = home;
|
|
@@ -320329,8 +320594,8 @@ var init_daemon = __esm({
|
|
|
320329
320594
|
/** install -> daemon-reload -> enable -> restart (picks up a changed unit). */
|
|
320330
320595
|
async install(unitContent) {
|
|
320331
320596
|
const path2 = unitPath(this.serviceName, this.home);
|
|
320332
|
-
await (0,
|
|
320333
|
-
await (0,
|
|
320597
|
+
await (0, import_promises6.mkdir)((0, import_path4.join)(path2, ".."), { recursive: true });
|
|
320598
|
+
await (0, import_promises6.writeFile)(path2, unitContent, "utf-8");
|
|
320334
320599
|
await this.systemctl("daemon-reload");
|
|
320335
320600
|
await this.systemctl("enable", this.unit);
|
|
320336
320601
|
await this.systemctl("restart", this.unit);
|
|
@@ -320339,13 +320604,13 @@ var init_daemon = __esm({
|
|
|
320339
320604
|
async uninstall() {
|
|
320340
320605
|
await this.systemctl("disable", "--now", this.unit).catch(() => void 0);
|
|
320341
320606
|
const path2 = unitPath(this.serviceName, this.home);
|
|
320342
|
-
await (0,
|
|
320607
|
+
await (0, import_promises6.rm)(path2, { force: true });
|
|
320343
320608
|
await this.systemctl("daemon-reload");
|
|
320344
320609
|
return path2;
|
|
320345
320610
|
}
|
|
320346
320611
|
/** Whether `runner:daemon:install` wrote the unit. */
|
|
320347
320612
|
installed() {
|
|
320348
|
-
return (0,
|
|
320613
|
+
return (0, import_fs8.existsSync)(unitPath(this.serviceName, this.home));
|
|
320349
320614
|
}
|
|
320350
320615
|
start() {
|
|
320351
320616
|
return this.systemctl("start", this.unit);
|
|
@@ -320409,11 +320674,11 @@ __export(start_exports2, {
|
|
|
320409
320674
|
default: () => start_default,
|
|
320410
320675
|
resolveRunner: () => resolveRunner
|
|
320411
320676
|
});
|
|
320412
|
-
var
|
|
320677
|
+
var import_os5, import_rxjs50, RUNNER_VERSION, resolveRunner, start_default;
|
|
320413
320678
|
var init_start2 = __esm({
|
|
320414
320679
|
"src/commands/runner/start.ts"() {
|
|
320415
|
-
|
|
320416
|
-
|
|
320680
|
+
import_os5 = require("os");
|
|
320681
|
+
import_rxjs50 = __toESM(require_cjs());
|
|
320417
320682
|
init_gql_client();
|
|
320418
320683
|
init_log();
|
|
320419
320684
|
init_config();
|
|
@@ -320432,9 +320697,9 @@ var init_start2 = __esm({
|
|
|
320432
320697
|
if (saved) {
|
|
320433
320698
|
return saved;
|
|
320434
320699
|
}
|
|
320435
|
-
const name2 = cmd.name || (0,
|
|
320700
|
+
const name2 = cmd.name || (0, import_os5.hostname)();
|
|
320436
320701
|
Logger.info(`Registering this machine as local runner "${name2}"...`);
|
|
320437
|
-
const { runner, token } = await (0,
|
|
320702
|
+
const { runner, token } = await (0, import_rxjs50.lastValueFrom)(
|
|
320438
320703
|
GraphqlClienAPI.createLocalRunner(name2)
|
|
320439
320704
|
).catch((e2) => {
|
|
320440
320705
|
throw new Error(
|
|
@@ -320629,14 +320894,14 @@ var list_exports6 = {};
|
|
|
320629
320894
|
__export(list_exports6, {
|
|
320630
320895
|
default: () => list_default6
|
|
320631
320896
|
});
|
|
320632
|
-
var
|
|
320897
|
+
var import_rxjs51, import_operators35, list_default6;
|
|
320633
320898
|
var init_list6 = __esm({
|
|
320634
320899
|
"src/commands/runner/list.ts"() {
|
|
320635
|
-
|
|
320900
|
+
import_rxjs51 = __toESM(require_cjs());
|
|
320636
320901
|
import_operators35 = __toESM(require_operators());
|
|
320637
320902
|
init_gql_client();
|
|
320638
320903
|
init_log();
|
|
320639
|
-
list_default6 = () => (0,
|
|
320904
|
+
list_default6 = () => (0, import_rxjs51.lastValueFrom)(
|
|
320640
320905
|
GraphqlClienAPI.listLocalRunners().pipe(
|
|
320641
320906
|
(0, import_operators35.tap)((runners) => {
|
|
320642
320907
|
Logger.log("-------------------");
|
|
@@ -320669,10 +320934,10 @@ __export(models_exports, {
|
|
|
320669
320934
|
default: () => models_default,
|
|
320670
320935
|
parseSelection: () => parseSelection
|
|
320671
320936
|
});
|
|
320672
|
-
var
|
|
320937
|
+
var import_rxjs52, isShown, parseSelection, models_default;
|
|
320673
320938
|
var init_models = __esm({
|
|
320674
320939
|
"src/commands/runner/models.ts"() {
|
|
320675
|
-
|
|
320940
|
+
import_rxjs52 = __toESM(require_cjs());
|
|
320676
320941
|
init_gql_client();
|
|
320677
320942
|
init_log();
|
|
320678
320943
|
init_config();
|
|
@@ -320702,11 +320967,11 @@ var init_models = __esm({
|
|
|
320702
320967
|
}
|
|
320703
320968
|
let runner;
|
|
320704
320969
|
if (selection) {
|
|
320705
|
-
runner = await (0,
|
|
320970
|
+
runner = await (0, import_rxjs52.lastValueFrom)(
|
|
320706
320971
|
GraphqlClienAPI.setLocalRunnerModels(runnerId, selection.models)
|
|
320707
320972
|
);
|
|
320708
320973
|
} else {
|
|
320709
|
-
const runners = await (0,
|
|
320974
|
+
const runners = await (0, import_rxjs52.lastValueFrom)(GraphqlClienAPI.listLocalRunners());
|
|
320710
320975
|
runner = runners.find((r2) => r2.id === runnerId);
|
|
320711
320976
|
}
|
|
320712
320977
|
if (!runner) {
|
|
@@ -320741,10 +321006,10 @@ var delete_exports3 = {};
|
|
|
320741
321006
|
__export(delete_exports3, {
|
|
320742
321007
|
default: () => delete_default3
|
|
320743
321008
|
});
|
|
320744
|
-
var
|
|
321009
|
+
var import_rxjs53, delete_default3;
|
|
320745
321010
|
var init_delete3 = __esm({
|
|
320746
321011
|
"src/commands/runner/delete.ts"() {
|
|
320747
|
-
|
|
321012
|
+
import_rxjs53 = __toESM(require_cjs());
|
|
320748
321013
|
init_gql_client();
|
|
320749
321014
|
init_log();
|
|
320750
321015
|
init_config();
|
|
@@ -320754,7 +321019,7 @@ var init_delete3 = __esm({
|
|
|
320754
321019
|
if (!runnerId) {
|
|
320755
321020
|
throw new Error("Specify the runner with --id (see `gcli runner:list`).");
|
|
320756
321021
|
}
|
|
320757
|
-
await (0,
|
|
321022
|
+
await (0, import_rxjs53.lastValueFrom)(GraphqlClienAPI.deleteLocalRunner(runnerId));
|
|
320758
321023
|
if (saved?.id === runnerId) {
|
|
320759
321024
|
await forgetRunner();
|
|
320760
321025
|
}
|
|
@@ -320770,10 +321035,10 @@ __export(start_exports3, {
|
|
|
320770
321035
|
});
|
|
320771
321036
|
async function start2(args) {
|
|
320772
321037
|
Logger.log("---------------------------------");
|
|
320773
|
-
return (0,
|
|
321038
|
+
return (0, import_rxjs54.lastValueFrom)(
|
|
320774
321039
|
loadSpec().pipe(
|
|
320775
321040
|
(0, import_operators36.switchMap)(
|
|
320776
|
-
(config2) => (0,
|
|
321041
|
+
(config2) => (0, import_rxjs54.of)({
|
|
320777
321042
|
watcher: (0, import_node_fs2.watch)(process.cwd(), {
|
|
320778
321043
|
recursive: true
|
|
320779
321044
|
}),
|
|
@@ -320802,7 +321067,7 @@ async function start2(args) {
|
|
|
320802
321067
|
outfile,
|
|
320803
321068
|
startCommand,
|
|
320804
321069
|
ignorelist
|
|
320805
|
-
}) => (0,
|
|
321070
|
+
}) => (0, import_rxjs54.from)(build_default(args)).pipe(
|
|
320806
321071
|
(0, import_operators36.tap)(() => {
|
|
320807
321072
|
Logger.warn(
|
|
320808
321073
|
`\u{1F4E2} Starting script "${startCommand} ${outfile}"`
|
|
@@ -320820,10 +321085,10 @@ async function start2(args) {
|
|
|
320820
321085
|
);
|
|
320821
321086
|
}),
|
|
320822
321087
|
(0, import_operators36.tap)(
|
|
320823
|
-
() => (0,
|
|
320824
|
-
(0,
|
|
320825
|
-
(0,
|
|
320826
|
-
(0,
|
|
321088
|
+
() => (0, import_rxjs54.merge)(
|
|
321089
|
+
(0, import_rxjs54.fromEvent)(process, "SIGINT"),
|
|
321090
|
+
(0, import_rxjs54.fromEvent)(process, "SIGTERM"),
|
|
321091
|
+
(0, import_rxjs54.fromEvent)(process, "exit")
|
|
320827
321092
|
).pipe(
|
|
320828
321093
|
(0, import_operators36.debounceTime)(100),
|
|
320829
321094
|
(0, import_operators36.tap)(() => {
|
|
@@ -320835,7 +321100,7 @@ async function start2(args) {
|
|
|
320835
321100
|
).subscribe()
|
|
320836
321101
|
),
|
|
320837
321102
|
(0, import_operators36.switchMap)(
|
|
320838
|
-
() => (0,
|
|
321103
|
+
() => (0, import_rxjs54.fromEvent)(watcher, "change").pipe(
|
|
320839
321104
|
(0, import_operators36.map)(([event, filename]) => ({
|
|
320840
321105
|
event,
|
|
320841
321106
|
filename
|
|
@@ -320884,12 +321149,12 @@ async function start2(args) {
|
|
|
320884
321149
|
)
|
|
320885
321150
|
);
|
|
320886
321151
|
}
|
|
320887
|
-
var import_node_child_process, import_node_fs2,
|
|
321152
|
+
var import_node_child_process, import_node_fs2, import_rxjs54, import_operators36;
|
|
320888
321153
|
var init_start3 = __esm({
|
|
320889
321154
|
"src/commands/start/start.ts"() {
|
|
320890
321155
|
import_node_child_process = require("node:child_process");
|
|
320891
321156
|
import_node_fs2 = require("node:fs");
|
|
320892
|
-
|
|
321157
|
+
import_rxjs54 = __toESM(require_cjs());
|
|
320893
321158
|
import_operators36 = __toESM(require_operators());
|
|
320894
321159
|
init_log();
|
|
320895
321160
|
init_build();
|
|
@@ -320902,16 +321167,16 @@ var create_cron_exports = {};
|
|
|
320902
321167
|
__export(create_cron_exports, {
|
|
320903
321168
|
default: () => create_cron_default
|
|
320904
321169
|
});
|
|
320905
|
-
var
|
|
321170
|
+
var import_rxjs55, import_operators37, create_cron_default;
|
|
320906
321171
|
var init_create_cron = __esm({
|
|
320907
321172
|
"src/commands/triggers/cron/create-cron.ts"() {
|
|
320908
|
-
|
|
321173
|
+
import_rxjs55 = __toESM(require_cjs());
|
|
320909
321174
|
import_operators37 = __toESM(require_operators());
|
|
320910
321175
|
init_helpers();
|
|
320911
321176
|
init_gql_client();
|
|
320912
321177
|
init_log();
|
|
320913
321178
|
init_load_spec();
|
|
320914
|
-
create_cron_default = (cmd) => (0,
|
|
321179
|
+
create_cron_default = (cmd) => (0, import_rxjs55.lastValueFrom)(
|
|
320915
321180
|
parseProjectId(cmd.project).pipe(
|
|
320916
321181
|
(0, import_operators37.switchMap)(
|
|
320917
321182
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
@@ -320934,7 +321199,7 @@ var init_create_cron = __esm({
|
|
|
320934
321199
|
)
|
|
320935
321200
|
),
|
|
320936
321201
|
(0, import_operators37.switchMap)(
|
|
320937
|
-
({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0,
|
|
321202
|
+
({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0, import_rxjs55.throwError)(
|
|
320938
321203
|
() => new Error(
|
|
320939
321204
|
"cron:create needs --cron and --triggerName (or triggers.time.cron / triggerName in lambforge.yaml)"
|
|
320940
321205
|
)
|
|
@@ -320967,16 +321232,16 @@ var delete_cron_exports = {};
|
|
|
320967
321232
|
__export(delete_cron_exports, {
|
|
320968
321233
|
default: () => delete_cron_default
|
|
320969
321234
|
});
|
|
320970
|
-
var
|
|
321235
|
+
var import_rxjs56, import_operators38, delete_cron_default;
|
|
320971
321236
|
var init_delete_cron = __esm({
|
|
320972
321237
|
"src/commands/triggers/cron/delete-cron.ts"() {
|
|
320973
|
-
|
|
321238
|
+
import_rxjs56 = __toESM(require_cjs());
|
|
320974
321239
|
import_operators38 = __toESM(require_operators());
|
|
320975
321240
|
init_helpers();
|
|
320976
321241
|
init_gql_client();
|
|
320977
321242
|
init_log();
|
|
320978
321243
|
init_load_spec();
|
|
320979
|
-
delete_cron_default = (cmd) => (0,
|
|
321244
|
+
delete_cron_default = (cmd) => (0, import_rxjs56.lastValueFrom)(
|
|
320980
321245
|
parseProjectId(cmd.project).pipe(
|
|
320981
321246
|
(0, import_operators38.switchMap)(
|
|
320982
321247
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
@@ -321020,18 +321285,18 @@ var list_crons_exports = {};
|
|
|
321020
321285
|
__export(list_crons_exports, {
|
|
321021
321286
|
default: () => list_crons_default
|
|
321022
321287
|
});
|
|
321023
|
-
var
|
|
321288
|
+
var import_rxjs57, import_operators39, list_crons_default;
|
|
321024
321289
|
var init_list_crons = __esm({
|
|
321025
321290
|
"src/commands/triggers/cron/list-crons.ts"() {
|
|
321026
|
-
|
|
321291
|
+
import_rxjs57 = __toESM(require_cjs());
|
|
321027
321292
|
import_operators39 = __toESM(require_operators());
|
|
321028
321293
|
init_helpers();
|
|
321029
321294
|
init_gql_client();
|
|
321030
321295
|
init_log();
|
|
321031
|
-
list_crons_default = (cmd) => (0,
|
|
321296
|
+
list_crons_default = (cmd) => (0, import_rxjs57.lastValueFrom)(
|
|
321032
321297
|
parseProjectId(cmd.project).pipe(
|
|
321033
321298
|
(0, import_operators39.switchMap)(
|
|
321034
|
-
(projectId) => (0,
|
|
321299
|
+
(projectId) => (0, import_rxjs57.combineLatest)([
|
|
321035
321300
|
GraphqlClienAPI.listProjectTimeTriggers(projectId),
|
|
321036
321301
|
GraphqlClienAPI.listLambdas(projectId)
|
|
321037
321302
|
])
|
|
@@ -321064,15 +321329,15 @@ var list_exports7 = {};
|
|
|
321064
321329
|
__export(list_exports7, {
|
|
321065
321330
|
default: () => list_default7
|
|
321066
321331
|
});
|
|
321067
|
-
var
|
|
321332
|
+
var import_rxjs58, import_operators40, list_default7;
|
|
321068
321333
|
var init_list7 = __esm({
|
|
321069
321334
|
"src/commands/triggers/message-queue/list.ts"() {
|
|
321070
|
-
|
|
321335
|
+
import_rxjs58 = __toESM(require_cjs());
|
|
321071
321336
|
import_operators40 = __toESM(require_operators());
|
|
321072
321337
|
init_helpers();
|
|
321073
321338
|
init_gql_client();
|
|
321074
321339
|
init_log();
|
|
321075
|
-
list_default7 = (cmd) => (0,
|
|
321340
|
+
list_default7 = (cmd) => (0, import_rxjs58.lastValueFrom)(
|
|
321076
321341
|
parseProjectId(cmd.project).pipe(
|
|
321077
321342
|
(0, import_operators40.switchMap)(
|
|
321078
321343
|
(projectId) => GraphqlClienAPI.listMessageQueueTriggers(projectId)
|
|
@@ -321108,10 +321373,10 @@ __export(save_exports, {
|
|
|
321108
321373
|
mergeOverExisting: () => mergeOverExisting,
|
|
321109
321374
|
toTriggerInput: () => toTriggerInput
|
|
321110
321375
|
});
|
|
321111
|
-
var
|
|
321376
|
+
var import_rxjs59, import_operators41, int2, toTriggerInput, mergeOverExisting, save_default;
|
|
321112
321377
|
var init_save = __esm({
|
|
321113
321378
|
"src/commands/triggers/message-queue/save.ts"() {
|
|
321114
|
-
|
|
321379
|
+
import_rxjs59 = __toESM(require_cjs());
|
|
321115
321380
|
import_operators41 = __toESM(require_operators());
|
|
321116
321381
|
init_helpers();
|
|
321117
321382
|
init_gql_client();
|
|
@@ -321174,11 +321439,11 @@ var init_save = __esm({
|
|
|
321174
321439
|
)
|
|
321175
321440
|
);
|
|
321176
321441
|
};
|
|
321177
|
-
save_default = (mode, cmd) => (0,
|
|
321442
|
+
save_default = (mode, cmd) => (0, import_rxjs59.lastValueFrom)(
|
|
321178
321443
|
parseProjectId(cmd.project).pipe(
|
|
321179
321444
|
(0, import_operators41.switchMap)((projectId) => {
|
|
321180
321445
|
const changes = toTriggerInput(mode, cmd);
|
|
321181
|
-
const payload$ = mode === "create" ? (0,
|
|
321446
|
+
const payload$ = mode === "create" ? (0, import_rxjs59.of)(changes) : GraphqlClienAPI.listMessageQueueTriggers(projectId).pipe(
|
|
321182
321447
|
(0, import_operators41.map)(
|
|
321183
321448
|
(triggers) => mergeOverExisting(
|
|
321184
321449
|
triggers.find((t2) => t2.name === cmd.name),
|
|
@@ -321216,15 +321481,15 @@ var delete_exports4 = {};
|
|
|
321216
321481
|
__export(delete_exports4, {
|
|
321217
321482
|
default: () => delete_default4
|
|
321218
321483
|
});
|
|
321219
|
-
var
|
|
321484
|
+
var import_rxjs60, import_operators42, delete_default4;
|
|
321220
321485
|
var init_delete4 = __esm({
|
|
321221
321486
|
"src/commands/triggers/message-queue/delete.ts"() {
|
|
321222
|
-
|
|
321487
|
+
import_rxjs60 = __toESM(require_cjs());
|
|
321223
321488
|
import_operators42 = __toESM(require_operators());
|
|
321224
321489
|
init_helpers();
|
|
321225
321490
|
init_gql_client();
|
|
321226
321491
|
init_log();
|
|
321227
|
-
delete_default4 = (cmd) => (0,
|
|
321492
|
+
delete_default4 = (cmd) => (0, import_rxjs60.lastValueFrom)(
|
|
321228
321493
|
parseProjectId(cmd.project).pipe(
|
|
321229
321494
|
(0, import_operators42.switchMap)(
|
|
321230
321495
|
(projectId) => GraphqlClienAPI.deleteMessageQueueTrigger(projectId, cmd.name)
|
|
@@ -321334,11 +321599,11 @@ var init_definition = __esm({
|
|
|
321334
321599
|
});
|
|
321335
321600
|
|
|
321336
321601
|
// src/commands/workflow/helpers.ts
|
|
321337
|
-
var
|
|
321602
|
+
var import_promises7, import_rxjs61, import_operators43, resolveWorkflow, withProject, readWorkflowFile, writeTextFile, POLL_MS, followRun, printRunResult;
|
|
321338
321603
|
var init_helpers4 = __esm({
|
|
321339
321604
|
"src/commands/workflow/helpers.ts"() {
|
|
321340
|
-
|
|
321341
|
-
|
|
321605
|
+
import_promises7 = require("fs/promises");
|
|
321606
|
+
import_rxjs61 = __toESM(require_cjs());
|
|
321342
321607
|
import_operators43 = __toESM(require_operators());
|
|
321343
321608
|
init_helpers();
|
|
321344
321609
|
init_gql_client();
|
|
@@ -321360,18 +321625,18 @@ var init_helpers4 = __esm({
|
|
|
321360
321625
|
})
|
|
321361
321626
|
);
|
|
321362
321627
|
};
|
|
321363
|
-
withProject = (project, fn) => (0,
|
|
321628
|
+
withProject = (project, fn) => (0, import_rxjs61.lastValueFrom)(parseProjectId(project).pipe((0, import_operators43.switchMap)(fn)));
|
|
321364
321629
|
readWorkflowFile = (path2) => {
|
|
321365
321630
|
if (!path2) {
|
|
321366
321631
|
throw new Error("--file is required (a workflow YAML or JSON file)");
|
|
321367
321632
|
}
|
|
321368
|
-
return (0,
|
|
321633
|
+
return (0, import_rxjs61.from)((0, import_promises7.readFile)(path2, "utf8")).pipe((0, import_operators43.map)(parseWorkflowFile));
|
|
321369
321634
|
};
|
|
321370
|
-
writeTextFile = (path2, text) => (0,
|
|
321635
|
+
writeTextFile = (path2, text) => (0, import_rxjs61.from)((0, import_promises7.writeFile)(path2, text, "utf8"));
|
|
321371
321636
|
POLL_MS = 2e3;
|
|
321372
321637
|
followRun = (projectId, workflowId, runName) => {
|
|
321373
321638
|
let printed = 0;
|
|
321374
|
-
return (0,
|
|
321639
|
+
return (0, import_rxjs61.timer)(0, POLL_MS).pipe(
|
|
321375
321640
|
(0, import_operators43.switchMap)(
|
|
321376
321641
|
() => GraphqlClienAPI.getWorkflowRun(projectId, workflowId, runName)
|
|
321377
321642
|
),
|
|
@@ -321444,10 +321709,10 @@ var get_exports2 = {};
|
|
|
321444
321709
|
__export(get_exports2, {
|
|
321445
321710
|
default: () => get_default2
|
|
321446
321711
|
});
|
|
321447
|
-
var
|
|
321712
|
+
var import_rxjs62, import_operators45, get_default2;
|
|
321448
321713
|
var init_get2 = __esm({
|
|
321449
321714
|
"src/commands/workflow/get.ts"() {
|
|
321450
|
-
|
|
321715
|
+
import_rxjs62 = __toESM(require_cjs());
|
|
321451
321716
|
import_operators45 = __toESM(require_operators());
|
|
321452
321717
|
init_log();
|
|
321453
321718
|
init_definition();
|
|
@@ -321463,7 +321728,7 @@ var init_get2 = __esm({
|
|
|
321463
321728
|
});
|
|
321464
321729
|
if (!cmd.out) {
|
|
321465
321730
|
Logger.log(text);
|
|
321466
|
-
return (0,
|
|
321731
|
+
return (0, import_rxjs62.of)(null);
|
|
321467
321732
|
}
|
|
321468
321733
|
return writeTextFile(cmd.out, text).pipe(
|
|
321469
321734
|
(0, import_operators45.tap)(() => Logger.info(`Wrote ${cmd.out}`))
|
|
@@ -321533,11 +321798,11 @@ var generate_exports = {};
|
|
|
321533
321798
|
__export(generate_exports, {
|
|
321534
321799
|
default: () => generate_default
|
|
321535
321800
|
});
|
|
321536
|
-
var
|
|
321801
|
+
var import_promises8, import_rxjs63, import_operators47, generate_default;
|
|
321537
321802
|
var init_generate = __esm({
|
|
321538
321803
|
"src/commands/workflow/generate.ts"() {
|
|
321539
|
-
|
|
321540
|
-
|
|
321804
|
+
import_promises8 = require("fs/promises");
|
|
321805
|
+
import_rxjs63 = __toESM(require_cjs());
|
|
321541
321806
|
import_operators47 = __toESM(require_operators());
|
|
321542
321807
|
init_gql_client();
|
|
321543
321808
|
init_log();
|
|
@@ -321550,7 +321815,7 @@ var init_generate = __esm({
|
|
|
321550
321815
|
'Describe the workflow: --description "charge the card with retries, then email the receipt"'
|
|
321551
321816
|
);
|
|
321552
321817
|
}
|
|
321553
|
-
const base$ = cmd.from ? (0,
|
|
321818
|
+
const base$ = cmd.from ? (0, import_rxjs63.from)((0, import_promises8.readFile)(cmd.from, "utf8")).pipe((0, import_operators47.map)(parseWorkflowFile)) : cmd.name ? GraphqlClienAPI.listWorkflows(projectId).pipe(
|
|
321554
321819
|
(0, import_operators47.switchMap)(
|
|
321555
321820
|
(workflows) => workflows.some((w) => w.name === cmd.name) ? resolveWorkflow(projectId, cmd.name).pipe(
|
|
321556
321821
|
(0, import_operators47.map)((w) => ({
|
|
@@ -321558,9 +321823,9 @@ var init_generate = __esm({
|
|
|
321558
321823
|
description: w.description ?? void 0,
|
|
321559
321824
|
definition: w.definition
|
|
321560
321825
|
}))
|
|
321561
|
-
) : (0,
|
|
321826
|
+
) : (0, import_rxjs63.of)(null)
|
|
321562
321827
|
)
|
|
321563
|
-
) : (0,
|
|
321828
|
+
) : (0, import_rxjs63.of)(null);
|
|
321564
321829
|
return base$.pipe(
|
|
321565
321830
|
(0, import_operators47.tap)(() => Logger.info("Asking the AI for a draft...")),
|
|
321566
321831
|
(0, import_operators47.switchMap)(
|
|
@@ -321587,10 +321852,10 @@ var init_generate = __esm({
|
|
|
321587
321852
|
const text = toWorkflowYaml(file2);
|
|
321588
321853
|
const written$ = cmd.out ? writeTextFile(cmd.out, text).pipe(
|
|
321589
321854
|
(0, import_operators47.tap)(() => Logger.info(`Wrote ${cmd.out}`))
|
|
321590
|
-
) : (0,
|
|
321855
|
+
) : (0, import_rxjs63.of)(null).pipe((0, import_operators47.tap)(() => !cmd.apply && Logger.log(text)));
|
|
321591
321856
|
return written$.pipe(
|
|
321592
321857
|
(0, import_operators47.switchMap)(
|
|
321593
|
-
() => cmd.apply ? applyWorkflow(projectId, file2) : (0,
|
|
321858
|
+
() => cmd.apply ? applyWorkflow(projectId, file2) : (0, import_rxjs63.of)(null).pipe(
|
|
321594
321859
|
(0, import_operators47.tap)(
|
|
321595
321860
|
() => Logger.info(
|
|
321596
321861
|
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>"
|
|
@@ -321664,11 +321929,11 @@ var run_exports = {};
|
|
|
321664
321929
|
__export(run_exports, {
|
|
321665
321930
|
default: () => run_default
|
|
321666
321931
|
});
|
|
321667
|
-
var
|
|
321932
|
+
var import_promises9, import_rxjs64, import_operators50, run_default;
|
|
321668
321933
|
var init_run = __esm({
|
|
321669
321934
|
"src/commands/workflow/run.ts"() {
|
|
321670
|
-
|
|
321671
|
-
|
|
321935
|
+
import_promises9 = require("fs/promises");
|
|
321936
|
+
import_rxjs64 = __toESM(require_cjs());
|
|
321672
321937
|
import_operators50 = __toESM(require_operators());
|
|
321673
321938
|
init_gql_client();
|
|
321674
321939
|
init_log();
|
|
@@ -321676,7 +321941,7 @@ var init_run = __esm({
|
|
|
321676
321941
|
init_helpers4();
|
|
321677
321942
|
run_default = (cmd) => withProject(
|
|
321678
321943
|
cmd.project,
|
|
321679
|
-
(projectId) => (cmd.inputFile ? (0,
|
|
321944
|
+
(projectId) => (cmd.inputFile ? (0, import_rxjs64.from)((0, import_promises9.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs64.of)(cmd.input)).pipe(
|
|
321680
321945
|
(0, import_operators50.map)(parseRunInput),
|
|
321681
321946
|
(0, import_operators50.switchMap)(
|
|
321682
321947
|
(input) => resolveWorkflow(projectId, cmd.name).pipe(
|
|
@@ -321684,7 +321949,7 @@ var init_run = __esm({
|
|
|
321684
321949
|
(w) => GraphqlClienAPI.startWorkflowRun(projectId, w.id, input).pipe(
|
|
321685
321950
|
(0, import_operators50.tap)((run2) => Logger.info(`Started run ${run2.name}`)),
|
|
321686
321951
|
(0, import_operators50.switchMap)(
|
|
321687
|
-
(run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0,
|
|
321952
|
+
(run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0, import_rxjs64.of)(run2).pipe(
|
|
321688
321953
|
(0, import_operators50.tap)(
|
|
321689
321954
|
() => Logger.info(
|
|
321690
321955
|
`Follow it: gcli workflow:status --name ${w.name} --run ${run2.name} --follow`
|
|
@@ -321858,11 +322123,11 @@ var trigger_add_exports = {};
|
|
|
321858
322123
|
__export(trigger_add_exports, {
|
|
321859
322124
|
default: () => trigger_add_default
|
|
321860
322125
|
});
|
|
321861
|
-
var
|
|
322126
|
+
var import_promises10, import_rxjs65, import_operators54, trigger_add_default;
|
|
321862
322127
|
var init_trigger_add = __esm({
|
|
321863
322128
|
"src/commands/workflow/trigger-add.ts"() {
|
|
321864
|
-
|
|
321865
|
-
|
|
322129
|
+
import_promises10 = require("fs/promises");
|
|
322130
|
+
import_rxjs65 = __toESM(require_cjs());
|
|
321866
322131
|
import_operators54 = __toESM(require_operators());
|
|
321867
322132
|
init_gql_client();
|
|
321868
322133
|
init_log();
|
|
@@ -321870,7 +322135,7 @@ var init_trigger_add = __esm({
|
|
|
321870
322135
|
init_triggers();
|
|
321871
322136
|
trigger_add_default = (cmd) => withProject(
|
|
321872
322137
|
cmd.project,
|
|
321873
|
-
(projectId) => (cmd.inputFile ? (0,
|
|
322138
|
+
(projectId) => (cmd.inputFile ? (0, import_rxjs65.from)((0, import_promises10.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs65.of)(void 0)).pipe(
|
|
321874
322139
|
(0, import_operators54.map)((inputText) => buildTriggerInput({ ...cmd, inputText })),
|
|
321875
322140
|
(0, import_operators54.switchMap)(
|
|
321876
322141
|
(trigger) => resolveWorkflow(projectId, cmd.name).pipe(
|
|
@@ -321959,10 +322224,10 @@ var init_trigger_remove = __esm({
|
|
|
321959
322224
|
});
|
|
321960
322225
|
|
|
321961
322226
|
// src/commands/workspace/approvals.ts
|
|
321962
|
-
var
|
|
322227
|
+
var import_readline4, APPROVAL_TIMEOUT_MS, TerminalPrompt, ApprovalGate;
|
|
321963
322228
|
var init_approvals = __esm({
|
|
321964
322229
|
"src/commands/workspace/approvals.ts"() {
|
|
321965
|
-
|
|
322230
|
+
import_readline4 = require("readline");
|
|
321966
322231
|
APPROVAL_TIMEOUT_MS = 5 * 6e4;
|
|
321967
322232
|
TerminalPrompt = class {
|
|
321968
322233
|
constructor() {
|
|
@@ -321976,7 +322241,7 @@ var init_approvals = __esm({
|
|
|
321976
322241
|
askNow(question, signal) {
|
|
321977
322242
|
if (signal.aborted) return Promise.resolve(null);
|
|
321978
322243
|
return new Promise((resolve2) => {
|
|
321979
|
-
const rl = (0,
|
|
322244
|
+
const rl = (0, import_readline4.createInterface)({
|
|
321980
322245
|
input: process.stdin,
|
|
321981
322246
|
output: process.stdout
|
|
321982
322247
|
});
|
|
@@ -322086,23 +322351,23 @@ var init_approvals = __esm({
|
|
|
322086
322351
|
});
|
|
322087
322352
|
|
|
322088
322353
|
// src/commands/workspace/config.ts
|
|
322089
|
-
var
|
|
322354
|
+
var import_promises11, readSavedWorkspaces, writeAll, readSavedWorkspace, saveWorkspace, forgetWorkspace;
|
|
322090
322355
|
var init_config2 = __esm({
|
|
322091
322356
|
"src/commands/workspace/config.ts"() {
|
|
322092
|
-
|
|
322357
|
+
import_promises11 = require("fs/promises");
|
|
322093
322358
|
init_types();
|
|
322094
322359
|
readSavedWorkspaces = async () => {
|
|
322095
322360
|
try {
|
|
322096
|
-
const saved = JSON.parse(await (0,
|
|
322361
|
+
const saved = JSON.parse(await (0, import_promises11.readFile)(workspacesDirectory, "utf-8"));
|
|
322097
322362
|
return saved && typeof saved === "object" ? saved : {};
|
|
322098
322363
|
} catch {
|
|
322099
322364
|
return {};
|
|
322100
322365
|
}
|
|
322101
322366
|
};
|
|
322102
322367
|
writeAll = async (all) => {
|
|
322103
|
-
await (0,
|
|
322104
|
-
await (0,
|
|
322105
|
-
await (0,
|
|
322368
|
+
await (0, import_promises11.mkdir)(mainDirectory, { recursive: true });
|
|
322369
|
+
await (0, import_promises11.writeFile)(workspacesDirectory, JSON.stringify(all, null, 2), "utf-8");
|
|
322370
|
+
await (0, import_promises11.chmod)(workspacesDirectory, 384);
|
|
322106
322371
|
};
|
|
322107
322372
|
readSavedWorkspace = async (root) => {
|
|
322108
322373
|
const saved = (await readSavedWorkspaces())[root];
|
|
@@ -322131,13 +322396,13 @@ var init_config2 = __esm({
|
|
|
322131
322396
|
});
|
|
322132
322397
|
|
|
322133
322398
|
// src/commands/workspace/files.ts
|
|
322134
|
-
var import_child_process5,
|
|
322399
|
+
var import_child_process5, import_crypto2, import_fs9, import_path5, import_util12, run, WorkspaceError, MAX_READ_BYTES, MAX_WRITE_BYTES, DEFAULT_LIST_LIMIT, MAX_LIST_LIMIT, DEFAULT_SEARCH_RESULTS, MAX_SEARCH_RESULTS, MAX_MATCH_TEXT, SKIP_DIRS, SECRET_FILE, SECRET_TEMPLATE, isSecretFile, contentHash, toPosix, WorkspaceFiles;
|
|
322135
322400
|
var init_files = __esm({
|
|
322136
322401
|
"src/commands/workspace/files.ts"() {
|
|
322137
322402
|
import_child_process5 = require("child_process");
|
|
322138
|
-
|
|
322139
|
-
|
|
322140
|
-
|
|
322403
|
+
import_crypto2 = require("crypto");
|
|
322404
|
+
import_fs9 = require("fs");
|
|
322405
|
+
import_path5 = require("path");
|
|
322141
322406
|
import_util12 = require("util");
|
|
322142
322407
|
run = (0, import_util12.promisify)(import_child_process5.execFile);
|
|
322143
322408
|
WorkspaceError = class extends Error {
|
|
@@ -322157,11 +322422,11 @@ var init_files = __esm({
|
|
|
322157
322422
|
SECRET_FILE = /^(\.env(\..+)?|.*\.(pem|key|p12|pfx|keystore|jks)|id_(rsa|dsa|ecdsa|ed25519)(\.pub)?|\.npmrc|\.pypirc|\.netrc|credentials(\.json)?)$/i;
|
|
322158
322423
|
SECRET_TEMPLATE = /\.(example|sample|template|dist|defaults)$/i;
|
|
322159
322424
|
isSecretFile = (path2) => {
|
|
322160
|
-
const name2 = (0,
|
|
322425
|
+
const name2 = (0, import_path5.basename)(path2);
|
|
322161
322426
|
return SECRET_FILE.test(name2) && !SECRET_TEMPLATE.test(name2);
|
|
322162
322427
|
};
|
|
322163
|
-
contentHash = (content) => (0,
|
|
322164
|
-
toPosix = (p) => p.split(
|
|
322428
|
+
contentHash = (content) => (0, import_crypto2.createHash)("sha256").update(content).digest("hex").slice(0, 16);
|
|
322429
|
+
toPosix = (p) => p.split(import_path5.sep).join("/");
|
|
322165
322430
|
WorkspaceFiles = class {
|
|
322166
322431
|
constructor(root, options = {}) {
|
|
322167
322432
|
this.root = root;
|
|
@@ -322170,9 +322435,9 @@ var init_files = __esm({
|
|
|
322170
322435
|
/** Absolute path for a workspace-relative one, or a WorkspaceError. */
|
|
322171
322436
|
async resolvePath(input, { forWrite = false } = {}) {
|
|
322172
322437
|
const rel = (input ?? ".").trim() || ".";
|
|
322173
|
-
const abs = (0,
|
|
322174
|
-
const fromRoot = (0,
|
|
322175
|
-
if (fromRoot.startsWith("..") || (0,
|
|
322438
|
+
const abs = (0, import_path5.resolve)(this.root, rel);
|
|
322439
|
+
const fromRoot = (0, import_path5.relative)(this.root, abs);
|
|
322440
|
+
if (fromRoot.startsWith("..") || (0, import_path5.isAbsolute)(fromRoot)) {
|
|
322176
322441
|
throw new WorkspaceError(
|
|
322177
322442
|
`${input} is outside the workspace root - paths are relative to ${this.root}`,
|
|
322178
322443
|
403
|
|
@@ -322181,9 +322446,9 @@ var init_files = __esm({
|
|
|
322181
322446
|
let existing = abs;
|
|
322182
322447
|
for (; ; ) {
|
|
322183
322448
|
try {
|
|
322184
|
-
const real = await
|
|
322185
|
-
const realFromRoot = (0,
|
|
322186
|
-
if (realFromRoot.startsWith("..") || (0,
|
|
322449
|
+
const real = await import_fs9.promises.realpath(existing);
|
|
322450
|
+
const realFromRoot = (0, import_path5.relative)(this.root, real);
|
|
322451
|
+
if (realFromRoot.startsWith("..") || (0, import_path5.isAbsolute)(realFromRoot)) {
|
|
322187
322452
|
throw new WorkspaceError(
|
|
322188
322453
|
`${input} resolves outside the workspace root (symlink)`,
|
|
322189
322454
|
403
|
|
@@ -322192,7 +322457,7 @@ var init_files = __esm({
|
|
|
322192
322457
|
break;
|
|
322193
322458
|
} catch (e2) {
|
|
322194
322459
|
if (e2 instanceof WorkspaceError) throw e2;
|
|
322195
|
-
const parent = (0,
|
|
322460
|
+
const parent = (0, import_path5.dirname)(existing);
|
|
322196
322461
|
if (parent === existing) break;
|
|
322197
322462
|
existing = parent;
|
|
322198
322463
|
}
|
|
@@ -322240,7 +322505,7 @@ var init_files = __esm({
|
|
|
322240
322505
|
const out = [];
|
|
322241
322506
|
const walk = async (relDir) => {
|
|
322242
322507
|
if (out.length > limit) return;
|
|
322243
|
-
const entries = await
|
|
322508
|
+
const entries = await import_fs9.promises.readdir((0, import_path5.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
|
|
322244
322509
|
for (const entry of entries) {
|
|
322245
322510
|
if (SKIP_DIRS.has(entry.name)) continue;
|
|
322246
322511
|
const rel = relDir === "." ? entry.name : `${relDir}/${entry.name}`;
|
|
@@ -322283,7 +322548,7 @@ var init_files = __esm({
|
|
|
322283
322548
|
entries = entries.slice(0, limit);
|
|
322284
322549
|
await Promise.all(
|
|
322285
322550
|
entries.filter((e2) => e2.type === "file").map(async (e2) => {
|
|
322286
|
-
e2.size = await
|
|
322551
|
+
e2.size = await import_fs9.promises.stat((0, import_path5.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
|
|
322287
322552
|
})
|
|
322288
322553
|
);
|
|
322289
322554
|
return {
|
|
@@ -322294,12 +322559,12 @@ var init_files = __esm({
|
|
|
322294
322559
|
async read(args) {
|
|
322295
322560
|
if (!args.path) throw new WorkspaceError("path is required");
|
|
322296
322561
|
const { abs, rel } = await this.resolvePath(args.path);
|
|
322297
|
-
const stat2 = await
|
|
322562
|
+
const stat2 = await import_fs9.promises.stat(abs).catch(() => null);
|
|
322298
322563
|
if (!stat2) throw new WorkspaceError(`${rel} does not exist`, 404);
|
|
322299
322564
|
if (stat2.isDirectory()) {
|
|
322300
322565
|
throw new WorkspaceError(`${rel} is a directory - use LocalListFiles`);
|
|
322301
322566
|
}
|
|
322302
|
-
const buffer = await
|
|
322567
|
+
const buffer = await import_fs9.promises.readFile(abs);
|
|
322303
322568
|
if (buffer.subarray(0, 8e3).includes(0)) {
|
|
322304
322569
|
return { path: rel, size: stat2.size, binary: true, content: "" };
|
|
322305
322570
|
}
|
|
@@ -322328,7 +322593,7 @@ var init_files = __esm({
|
|
|
322328
322593
|
};
|
|
322329
322594
|
}
|
|
322330
322595
|
async currentText(abs) {
|
|
322331
|
-
return
|
|
322596
|
+
return import_fs9.promises.readFile(abs, "utf-8").catch((e2) => {
|
|
322332
322597
|
if (e2?.code === "ENOENT") return null;
|
|
322333
322598
|
throw e2;
|
|
322334
322599
|
});
|
|
@@ -322349,8 +322614,8 @@ var init_files = __esm({
|
|
|
322349
322614
|
);
|
|
322350
322615
|
}
|
|
322351
322616
|
}
|
|
322352
|
-
await
|
|
322353
|
-
await
|
|
322617
|
+
await import_fs9.promises.mkdir((0, import_path5.dirname)(abs), { recursive: true });
|
|
322618
|
+
await import_fs9.promises.writeFile(abs, content, "utf-8");
|
|
322354
322619
|
return {
|
|
322355
322620
|
path: rel,
|
|
322356
322621
|
size: Buffer.byteLength(content),
|
|
@@ -322382,7 +322647,7 @@ var init_files = __esm({
|
|
|
322382
322647
|
);
|
|
322383
322648
|
}
|
|
322384
322649
|
const after = args.replaceAll ? before.split(args.oldText).join(args.newText ?? "") : before.replace(args.oldText, () => args.newText ?? "");
|
|
322385
|
-
await
|
|
322650
|
+
await import_fs9.promises.writeFile(abs, after, "utf-8");
|
|
322386
322651
|
return {
|
|
322387
322652
|
path: rel,
|
|
322388
322653
|
replacements: args.replaceAll ? count : 1,
|
|
@@ -322393,14 +322658,14 @@ var init_files = __esm({
|
|
|
322393
322658
|
async delete(args) {
|
|
322394
322659
|
if (!args.path) throw new WorkspaceError("path is required");
|
|
322395
322660
|
const { abs, rel } = await this.resolvePath(args.path, { forWrite: true });
|
|
322396
|
-
const stat2 = await
|
|
322661
|
+
const stat2 = await import_fs9.promises.lstat(abs).catch(() => null);
|
|
322397
322662
|
if (!stat2) return { path: rel, deleted: false };
|
|
322398
322663
|
if (stat2.isDirectory()) {
|
|
322399
322664
|
throw new WorkspaceError(
|
|
322400
322665
|
`${rel} is a directory - only files can be deleted (use RunCommand for more)`
|
|
322401
322666
|
);
|
|
322402
322667
|
}
|
|
322403
|
-
await
|
|
322668
|
+
await import_fs9.promises.unlink(abs);
|
|
322404
322669
|
return { path: rel, deleted: true };
|
|
322405
322670
|
}
|
|
322406
322671
|
async search(args) {
|
|
@@ -322452,7 +322717,7 @@ var init_files = __esm({
|
|
|
322452
322717
|
raw = [];
|
|
322453
322718
|
for (const file2 of await this.allFiles(rel, 2e4)) {
|
|
322454
322719
|
if (globRe && !globRe.test(file2)) continue;
|
|
322455
|
-
const text = await
|
|
322720
|
+
const text = await import_fs9.promises.readFile((0, import_path5.join)(this.root, file2)).catch(() => null);
|
|
322456
322721
|
if (!text || text.subarray(0, 8e3).includes(0)) continue;
|
|
322457
322722
|
text.toString("utf-8").split("\n").forEach((line, i2) => {
|
|
322458
322723
|
if (raw.length <= max && re.test(line)) {
|
|
@@ -322847,10 +323112,10 @@ ${this.text}` : this.text;
|
|
|
322847
323112
|
});
|
|
322848
323113
|
|
|
322849
323114
|
// src/commands/workspace/connection.ts
|
|
322850
|
-
var
|
|
323115
|
+
var import_os6, WORKSPACE_PATH_PREFIX, WORKSPACE_OPS, HEARTBEAT_MUTATION2, REQUEST_APPROVAL_MUTATION, SETTLE_APPROVAL_MUTATION, str, num, short, WorkspaceConnection;
|
|
322851
323116
|
var init_connection2 = __esm({
|
|
322852
323117
|
"src/commands/workspace/connection.ts"() {
|
|
322853
|
-
|
|
323118
|
+
import_os6 = require("os");
|
|
322854
323119
|
init_tunnel();
|
|
322855
323120
|
init_approvals();
|
|
322856
323121
|
init_files();
|
|
@@ -322933,7 +323198,7 @@ var init_connection2 = __esm({
|
|
|
322933
323198
|
const data = await this.operation(HEARTBEAT_MUTATION2, {
|
|
322934
323199
|
info: {
|
|
322935
323200
|
root: this.options.root,
|
|
322936
|
-
hostname: (0,
|
|
323201
|
+
hostname: (0, import_os6.hostname)(),
|
|
322937
323202
|
platform: process.platform,
|
|
322938
323203
|
gitBranch: await this.files.gitBranch(),
|
|
322939
323204
|
clientVersion: this.options.version,
|
|
@@ -323245,12 +323510,12 @@ __export(start_exports4, {
|
|
|
323245
323510
|
WORKSPACE_VERSION: () => WORKSPACE_VERSION,
|
|
323246
323511
|
default: () => start_default2
|
|
323247
323512
|
});
|
|
323248
|
-
var
|
|
323513
|
+
var import_promises12, import_path6, import_rxjs66, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
|
|
323249
323514
|
var init_start4 = __esm({
|
|
323250
323515
|
"src/commands/workspace/start.ts"() {
|
|
323251
|
-
|
|
323252
|
-
|
|
323253
|
-
|
|
323516
|
+
import_promises12 = require("fs/promises");
|
|
323517
|
+
import_path6 = require("path");
|
|
323518
|
+
import_rxjs66 = __toESM(require_cjs());
|
|
323254
323519
|
init_helpers();
|
|
323255
323520
|
init_gql_client();
|
|
323256
323521
|
init_log();
|
|
@@ -323267,7 +323532,7 @@ var init_start4 = __esm({
|
|
|
323267
323532
|
if (cmd.token) {
|
|
323268
323533
|
return {
|
|
323269
323534
|
id: "(from --token)",
|
|
323270
|
-
name: cmd.name ?? (0,
|
|
323535
|
+
name: cmd.name ?? (0, import_path6.basename)(root),
|
|
323271
323536
|
token: cmd.token,
|
|
323272
323537
|
projectId: cmd.project ?? "",
|
|
323273
323538
|
root
|
|
@@ -323280,16 +323545,16 @@ var init_start4 = __esm({
|
|
|
323280
323545
|
if (saved && (!cmd.project || cmd.project === saved.projectId)) {
|
|
323281
323546
|
return saved;
|
|
323282
323547
|
}
|
|
323283
|
-
const projectId = await (0,
|
|
323548
|
+
const projectId = await (0, import_rxjs66.lastValueFrom)(parseProjectId(cmd.project)).catch(
|
|
323284
323549
|
() => {
|
|
323285
323550
|
throw new Error(
|
|
323286
323551
|
"No project selected. Pass --project <projectId> or run `gcli project:use <projectId>` first."
|
|
323287
323552
|
);
|
|
323288
323553
|
}
|
|
323289
323554
|
);
|
|
323290
|
-
const name2 = cmd.name || (0,
|
|
323555
|
+
const name2 = cmd.name || (0, import_path6.basename)(root);
|
|
323291
323556
|
Logger.info(`Registering ${root} as local workspace "${name2}"...`);
|
|
323292
|
-
const { workspace, token } = await (0,
|
|
323557
|
+
const { workspace, token } = await (0, import_rxjs66.lastValueFrom)(
|
|
323293
323558
|
GraphqlClienAPI.createLocalWorkspace(projectId, name2)
|
|
323294
323559
|
).catch((e2) => {
|
|
323295
323560
|
throw new Error(
|
|
@@ -323307,7 +323572,7 @@ var init_start4 = __esm({
|
|
|
323307
323572
|
return created;
|
|
323308
323573
|
};
|
|
323309
323574
|
start_default2 = async (cmd) => {
|
|
323310
|
-
const root = await (0,
|
|
323575
|
+
const root = await (0, import_promises12.realpath)(process.cwd());
|
|
323311
323576
|
const workspace = await resolveWorkspace(root, cmd);
|
|
323312
323577
|
const wsUrl = cmd.wsUrl || workspace.wsUrl || deriveSubscriptionsUrl(await readLoginApiUrl());
|
|
323313
323578
|
const policy = new CommandPolicy(
|
|
@@ -323380,16 +323645,16 @@ var list_exports9 = {};
|
|
|
323380
323645
|
__export(list_exports9, {
|
|
323381
323646
|
default: () => list_default9
|
|
323382
323647
|
});
|
|
323383
|
-
var
|
|
323648
|
+
var import_rxjs67, list_default9;
|
|
323384
323649
|
var init_list9 = __esm({
|
|
323385
323650
|
"src/commands/workspace/list.ts"() {
|
|
323386
|
-
|
|
323651
|
+
import_rxjs67 = __toESM(require_cjs());
|
|
323387
323652
|
init_gql_client();
|
|
323388
323653
|
init_log();
|
|
323389
323654
|
init_config2();
|
|
323390
323655
|
list_default9 = async (cmd) => {
|
|
323391
323656
|
const [workspaces, saved] = await Promise.all([
|
|
323392
|
-
(0,
|
|
323657
|
+
(0, import_rxjs67.lastValueFrom)(GraphqlClienAPI.listLocalWorkspaces(cmd.project)),
|
|
323393
323658
|
readSavedWorkspaces()
|
|
323394
323659
|
]);
|
|
323395
323660
|
const onThisMachine = new Set(Object.values(saved).map((w) => w.id));
|
|
@@ -323423,23 +323688,23 @@ var delete_exports6 = {};
|
|
|
323423
323688
|
__export(delete_exports6, {
|
|
323424
323689
|
default: () => delete_default6
|
|
323425
323690
|
});
|
|
323426
|
-
var
|
|
323691
|
+
var import_promises13, import_rxjs68, delete_default6;
|
|
323427
323692
|
var init_delete6 = __esm({
|
|
323428
323693
|
"src/commands/workspace/delete.ts"() {
|
|
323429
|
-
|
|
323430
|
-
|
|
323694
|
+
import_promises13 = require("fs/promises");
|
|
323695
|
+
import_rxjs68 = __toESM(require_cjs());
|
|
323431
323696
|
init_gql_client();
|
|
323432
323697
|
init_log();
|
|
323433
323698
|
init_config2();
|
|
323434
323699
|
delete_default6 = async (cmd) => {
|
|
323435
|
-
const root = await (0,
|
|
323700
|
+
const root = await (0, import_promises13.realpath)(process.cwd());
|
|
323436
323701
|
const workspaceId = cmd.id || (await readSavedWorkspace(root))?.id;
|
|
323437
323702
|
if (!workspaceId) {
|
|
323438
323703
|
throw new Error(
|
|
323439
323704
|
"No workspace registered for this directory - pass --id (see `gcli workspace:list`)."
|
|
323440
323705
|
);
|
|
323441
323706
|
}
|
|
323442
|
-
await (0,
|
|
323707
|
+
await (0, import_rxjs68.lastValueFrom)(GraphqlClienAPI.deleteLocalWorkspace(workspaceId));
|
|
323443
323708
|
await forgetWorkspace({ id: workspaceId });
|
|
323444
323709
|
Logger.log(
|
|
323445
323710
|
`Local workspace ${workspaceId} deleted; its token no longer works.`
|
|
@@ -323542,6 +323807,22 @@ function registerClusterCommands(program2) {
|
|
|
323542
323807
|
target(
|
|
323543
323808
|
program2.command("cluster:resume").description("Let new work run on a paused machine again (uncordon)")
|
|
323544
323809
|
).option("-n, --name <name>", "Machine name (see cluster:nodes)").action(lazy(() => Promise.resolve().then(() => (init_pause(), pause_exports)).then((m2) => m2.resume)));
|
|
323810
|
+
target(
|
|
323811
|
+
program2.command("cluster:reset-machine").description(
|
|
323812
|
+
"Bring a detached machine back to maintenance mode to attach it again (wipes its config and data, keeps the boot loader)"
|
|
323813
|
+
)
|
|
323814
|
+
).option("-n, --name <name>", "Machine name").option("--node-ip <nodeIp>", "The machine's address on your network").option("--yes", "Do not ask for confirmation").action(lazy(() => Promise.resolve().then(() => (init_reset_machine(), reset_machine_exports)).then((m2) => m2.default)));
|
|
323815
|
+
target(
|
|
323816
|
+
program2.command("cluster:talosconfig").description(
|
|
323817
|
+
"A short-lived talosconfig for one of your Talos clusters (admin of its machines with talosctl) - printed, or saved with -o"
|
|
323818
|
+
)
|
|
323819
|
+
).option(
|
|
323820
|
+
"-o, --output <output>",
|
|
323821
|
+
"Write to this file (mode 600) instead of stdout"
|
|
323822
|
+
).option(
|
|
323823
|
+
"--ttl <minutes>",
|
|
323824
|
+
"How long it works, 5 to 1440 minutes (default 60)"
|
|
323825
|
+
).action(lazy(() => Promise.resolve().then(() => (init_talosconfig(), talosconfig_exports)).then((m2) => m2.default)));
|
|
323545
323826
|
target(
|
|
323546
323827
|
program2.command("cluster:detach").description(
|
|
323547
323828
|
"Drain and remove an attached machine from a cluster (reset the machine afterwards)"
|