@gapi/gcli 1.8.248 → 1.8.250
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 +12 -4
- package/README.md +24 -3
- package/docs/changelog.d/2026-10-28-virtual-clusters-cluster-create-dedicated-lb-loadbalancer-for-virtual-cluster.md +23 -0
- package/docs/changelog.d/2026-10-30-self-managed-nodes-cluster-attach-probes-the-machine-with-talosctl-get-version.md +30 -0
- package/docs/features/README.md +1 -0
- package/docs/features/self-managed-nodes.md +44 -0
- package/docs/features/virtual-clusters.md +16 -2
- package/package.json +1 -1
- package/release/index.js +873 -360
package/release/index.js
CHANGED
|
@@ -11586,11 +11586,11 @@ var require_isReadableStreamLike = __commonJS({
|
|
|
11586
11586
|
function verb(n) {
|
|
11587
11587
|
if (g[n]) i2[n] = function(v) {
|
|
11588
11588
|
return new Promise(function(a, b) {
|
|
11589
|
-
q.push([n, v, a, b]) > 1 ||
|
|
11589
|
+
q.push([n, v, a, b]) > 1 || resume2(n, v);
|
|
11590
11590
|
});
|
|
11591
11591
|
};
|
|
11592
11592
|
}
|
|
11593
|
-
function
|
|
11593
|
+
function resume2(n, v) {
|
|
11594
11594
|
try {
|
|
11595
11595
|
step(g[n](v));
|
|
11596
11596
|
} catch (e2) {
|
|
@@ -11601,13 +11601,13 @@ var require_isReadableStreamLike = __commonJS({
|
|
|
11601
11601
|
r2.value instanceof __await2 ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q[0][2], r2);
|
|
11602
11602
|
}
|
|
11603
11603
|
function fulfill(value) {
|
|
11604
|
-
|
|
11604
|
+
resume2("next", value);
|
|
11605
11605
|
}
|
|
11606
11606
|
function reject(value) {
|
|
11607
|
-
|
|
11607
|
+
resume2("throw", value);
|
|
11608
11608
|
}
|
|
11609
11609
|
function settle(f3, v) {
|
|
11610
|
-
if (f3(v), q.shift(), q.length)
|
|
11610
|
+
if (f3(v), q.shift(), q.length) resume2(q[0][0], q[0][1]);
|
|
11611
11611
|
}
|
|
11612
11612
|
};
|
|
11613
11613
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -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 lastValueFrom57(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 = lastValueFrom57;
|
|
12418
12418
|
}
|
|
12419
12419
|
});
|
|
12420
12420
|
|
|
@@ -18990,11 +18990,11 @@ var require_tslib = __commonJS({
|
|
|
18990
18990
|
function verb(n) {
|
|
18991
18991
|
if (g[n]) i2[n] = function(v) {
|
|
18992
18992
|
return new Promise(function(a, b) {
|
|
18993
|
-
q.push([n, v, a, b]) > 1 ||
|
|
18993
|
+
q.push([n, v, a, b]) > 1 || resume2(n, v);
|
|
18994
18994
|
});
|
|
18995
18995
|
};
|
|
18996
18996
|
}
|
|
18997
|
-
function
|
|
18997
|
+
function resume2(n, v) {
|
|
18998
18998
|
try {
|
|
18999
18999
|
step(g[n](v));
|
|
19000
19000
|
} catch (e2) {
|
|
@@ -19005,13 +19005,13 @@ var require_tslib = __commonJS({
|
|
|
19005
19005
|
r2.value instanceof __await2 ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q[0][2], r2);
|
|
19006
19006
|
}
|
|
19007
19007
|
function fulfill(value) {
|
|
19008
|
-
|
|
19008
|
+
resume2("next", value);
|
|
19009
19009
|
}
|
|
19010
19010
|
function reject(value) {
|
|
19011
|
-
|
|
19011
|
+
resume2("throw", value);
|
|
19012
19012
|
}
|
|
19013
19013
|
function settle(f3, v) {
|
|
19014
|
-
if (f3(v), q.shift(), q.length)
|
|
19014
|
+
if (f3(v), q.shift(), q.length) resume2(q[0][0], q[0][1]);
|
|
19015
19015
|
}
|
|
19016
19016
|
};
|
|
19017
19017
|
__asyncDelegator2 = function(o) {
|
|
@@ -19349,11 +19349,11 @@ var require_tslib2 = __commonJS({
|
|
|
19349
19349
|
function verb(n) {
|
|
19350
19350
|
if (g[n]) i2[n] = function(v) {
|
|
19351
19351
|
return new Promise(function(a, b) {
|
|
19352
|
-
q.push([n, v, a, b]) > 1 ||
|
|
19352
|
+
q.push([n, v, a, b]) > 1 || resume2(n, v);
|
|
19353
19353
|
});
|
|
19354
19354
|
};
|
|
19355
19355
|
}
|
|
19356
|
-
function
|
|
19356
|
+
function resume2(n, v) {
|
|
19357
19357
|
try {
|
|
19358
19358
|
step(g[n](v));
|
|
19359
19359
|
} catch (e2) {
|
|
@@ -19364,13 +19364,13 @@ var require_tslib2 = __commonJS({
|
|
|
19364
19364
|
r2.value instanceof __await2 ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q[0][2], r2);
|
|
19365
19365
|
}
|
|
19366
19366
|
function fulfill(value) {
|
|
19367
|
-
|
|
19367
|
+
resume2("next", value);
|
|
19368
19368
|
}
|
|
19369
19369
|
function reject(value) {
|
|
19370
|
-
|
|
19370
|
+
resume2("throw", value);
|
|
19371
19371
|
}
|
|
19372
19372
|
function settle(f3, v) {
|
|
19373
|
-
if (f3(v), q.shift(), q.length)
|
|
19373
|
+
if (f3(v), q.shift(), q.length) resume2(q[0][0], q[0][1]);
|
|
19374
19374
|
}
|
|
19375
19375
|
};
|
|
19376
19376
|
__asyncDelegator2 = function(o) {
|
|
@@ -20720,11 +20720,11 @@ var require_tslib3 = __commonJS({
|
|
|
20720
20720
|
function verb(n) {
|
|
20721
20721
|
if (g[n]) i2[n] = function(v) {
|
|
20722
20722
|
return new Promise(function(a, b) {
|
|
20723
|
-
q.push([n, v, a, b]) > 1 ||
|
|
20723
|
+
q.push([n, v, a, b]) > 1 || resume2(n, v);
|
|
20724
20724
|
});
|
|
20725
20725
|
};
|
|
20726
20726
|
}
|
|
20727
|
-
function
|
|
20727
|
+
function resume2(n, v) {
|
|
20728
20728
|
try {
|
|
20729
20729
|
step(g[n](v));
|
|
20730
20730
|
} catch (e2) {
|
|
@@ -20735,13 +20735,13 @@ var require_tslib3 = __commonJS({
|
|
|
20735
20735
|
r2.value instanceof __await2 ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q[0][2], r2);
|
|
20736
20736
|
}
|
|
20737
20737
|
function fulfill(value) {
|
|
20738
|
-
|
|
20738
|
+
resume2("next", value);
|
|
20739
20739
|
}
|
|
20740
20740
|
function reject(value) {
|
|
20741
|
-
|
|
20741
|
+
resume2("throw", value);
|
|
20742
20742
|
}
|
|
20743
20743
|
function settle(f3, v) {
|
|
20744
|
-
if (f3(v), q.shift(), q.length)
|
|
20744
|
+
if (f3(v), q.shift(), q.length) resume2(q[0][0], q[0][1]);
|
|
20745
20745
|
}
|
|
20746
20746
|
};
|
|
20747
20747
|
__asyncDelegator2 = function(o) {
|
|
@@ -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 rm4(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(rm4(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 join4(s2) {
|
|
29871
29871
|
if (this.length === 0) return "";
|
|
29872
29872
|
var p = this.head;
|
|
29873
29873
|
var ret = "" + p.data;
|
|
@@ -31980,12 +31980,12 @@ var require_stream_readable = __commonJS({
|
|
|
31980
31980
|
if (!state.flowing) {
|
|
31981
31981
|
debug("resume");
|
|
31982
31982
|
state.flowing = !state.readableListening;
|
|
31983
|
-
|
|
31983
|
+
resume2(this, state);
|
|
31984
31984
|
}
|
|
31985
31985
|
state.paused = false;
|
|
31986
31986
|
return this;
|
|
31987
31987
|
};
|
|
31988
|
-
function
|
|
31988
|
+
function resume2(stream, state) {
|
|
31989
31989
|
if (!state.resumeScheduled) {
|
|
31990
31990
|
state.resumeScheduled = true;
|
|
31991
31991
|
process.nextTick(resume_, stream, state);
|
|
@@ -32885,7 +32885,7 @@ var require_buffer_list2 = __commonJS({
|
|
|
32885
32885
|
}
|
|
32886
32886
|
}, {
|
|
32887
32887
|
key: "join",
|
|
32888
|
-
value: function
|
|
32888
|
+
value: function join4(s2) {
|
|
32889
32889
|
if (this.length === 0) return "";
|
|
32890
32890
|
var p = this.head;
|
|
32891
32891
|
var ret = "" + p.data;
|
|
@@ -34707,12 +34707,12 @@ var require_stream_readable2 = __commonJS({
|
|
|
34707
34707
|
if (!state.flowing) {
|
|
34708
34708
|
debug("resume");
|
|
34709
34709
|
state.flowing = !state.readableListening;
|
|
34710
|
-
|
|
34710
|
+
resume2(this, state);
|
|
34711
34711
|
}
|
|
34712
34712
|
state.paused = false;
|
|
34713
34713
|
return this;
|
|
34714
34714
|
};
|
|
34715
|
-
function
|
|
34715
|
+
function resume2(stream, state) {
|
|
34716
34716
|
if (!state.resumeScheduled) {
|
|
34717
34717
|
state.resumeScheduled = true;
|
|
34718
34718
|
process.nextTick(resume_, stream, state);
|
|
@@ -36015,7 +36015,7 @@ var init_types = __esm({
|
|
|
36015
36015
|
});
|
|
36016
36016
|
|
|
36017
36017
|
// src/commands/cluster/types.ts
|
|
36018
|
-
var ClusterChangeFragment, ClusterAutoscaleFragment, ClusterOverviewFragment, ClusterHealthFragment, ClusterScaleEventFragment;
|
|
36018
|
+
var ClusterChangeFragment, ClusterAutoscaleFragment, ClusterOverviewFragment, ClusterHealthFragment, ClusterScaleEventFragment, ClusterNodeFragment;
|
|
36019
36019
|
var init_types2 = __esm({
|
|
36020
36020
|
"src/commands/cluster/types.ts"() {
|
|
36021
36021
|
ClusterChangeFragment = `
|
|
@@ -36133,6 +36133,23 @@ cpuRequestsPercent
|
|
|
36133
36133
|
memRequestsPercent
|
|
36134
36134
|
pendingPods
|
|
36135
36135
|
error
|
|
36136
|
+
`;
|
|
36137
|
+
ClusterNodeFragment = `
|
|
36138
|
+
name
|
|
36139
|
+
pool
|
|
36140
|
+
reserved
|
|
36141
|
+
status
|
|
36142
|
+
cordoned
|
|
36143
|
+
internalIp
|
|
36144
|
+
cpuCores
|
|
36145
|
+
memoryGb
|
|
36146
|
+
osImage
|
|
36147
|
+
kubeletVersion
|
|
36148
|
+
joinedAt
|
|
36149
|
+
addedAt
|
|
36150
|
+
recorded
|
|
36151
|
+
source
|
|
36152
|
+
role
|
|
36136
36153
|
`;
|
|
36137
36154
|
}
|
|
36138
36155
|
});
|
|
@@ -36155,6 +36172,9 @@ topology {
|
|
|
36155
36172
|
singleNode
|
|
36156
36173
|
}
|
|
36157
36174
|
endpoint
|
|
36175
|
+
routerUrl
|
|
36176
|
+
withLoadBalancer
|
|
36177
|
+
loadBalancerIp
|
|
36158
36178
|
error
|
|
36159
36179
|
`;
|
|
36160
36180
|
}
|
|
@@ -36946,8 +36966,8 @@ var init_gql_client = __esm({
|
|
|
36946
36966
|
}).pipe((0, import_operators.map)((res) => res.provisionProjectCluster));
|
|
36947
36967
|
}
|
|
36948
36968
|
/** A virtual cluster (vCluster) on the shared cluster or on one of the
|
|
36949
|
-
project's private clusters.
|
|
36950
|
-
|
|
36969
|
+
project's private clusters. `dedicatedLoadBalancer` gives its router
|
|
36970
|
+
its own IP (billed); the platform subdomain works either way. */
|
|
36951
36971
|
static provisionProjectVirtualCluster(projectId, input) {
|
|
36952
36972
|
return this.query({
|
|
36953
36973
|
query: gql`
|
|
@@ -36955,14 +36975,15 @@ var init_gql_client = __esm({
|
|
|
36955
36975
|
$projectId: String!
|
|
36956
36976
|
$name: String!
|
|
36957
36977
|
$hostClusterId: String
|
|
36978
|
+
$dedicatedLoadBalancer: Boolean
|
|
36958
36979
|
) {
|
|
36959
36980
|
provisionProjectVirtualCluster(
|
|
36960
36981
|
projectId: $projectId
|
|
36961
36982
|
name: $name
|
|
36962
36983
|
hostClusterId: $hostClusterId
|
|
36984
|
+
dedicatedLoadBalancer: $dedicatedLoadBalancer
|
|
36963
36985
|
) {
|
|
36964
36986
|
${ClusterFragment}
|
|
36965
|
-
routerUrl
|
|
36966
36987
|
hostNamespace
|
|
36967
36988
|
}
|
|
36968
36989
|
}
|
|
@@ -37207,6 +37228,104 @@ var init_gql_client = __esm({
|
|
|
37207
37228
|
variables: { projectId }
|
|
37208
37229
|
}).pipe((0, import_operators.map)((res) => res.projectClustersOverview ?? []));
|
|
37209
37230
|
}
|
|
37231
|
+
// Self-managed machines attached to a Talos cluster (cluster-provisioner,
|
|
37232
|
+
// feature self-managed-nodes; ADMIN in phase 1).
|
|
37233
|
+
static clusterNodeJoinConfig(input) {
|
|
37234
|
+
return this.query({
|
|
37235
|
+
query: gql`
|
|
37236
|
+
mutation clusterNodeJoinConfig(
|
|
37237
|
+
$clusterId: String!
|
|
37238
|
+
$name: String!
|
|
37239
|
+
$pool: String
|
|
37240
|
+
$reserved: Boolean
|
|
37241
|
+
$installDisk: String
|
|
37242
|
+
) {
|
|
37243
|
+
clusterNodeJoinConfig(
|
|
37244
|
+
clusterId: $clusterId
|
|
37245
|
+
name: $name
|
|
37246
|
+
pool: $pool
|
|
37247
|
+
reserved: $reserved
|
|
37248
|
+
installDisk: $installDisk
|
|
37249
|
+
) {
|
|
37250
|
+
clusterName
|
|
37251
|
+
nodeName
|
|
37252
|
+
pool
|
|
37253
|
+
reserved
|
|
37254
|
+
config
|
|
37255
|
+
talosVersion
|
|
37256
|
+
isoUrl
|
|
37257
|
+
isoUrlArm64
|
|
37258
|
+
endpoint
|
|
37259
|
+
}
|
|
37260
|
+
}
|
|
37261
|
+
`,
|
|
37262
|
+
variables: input
|
|
37263
|
+
}).pipe((0, import_operators.map)((res) => res.clusterNodeJoinConfig));
|
|
37264
|
+
}
|
|
37265
|
+
static clusterAttachInfo(clusterId) {
|
|
37266
|
+
return this.query({
|
|
37267
|
+
query: gql`
|
|
37268
|
+
query clusterAttachInfo($clusterId: String!) {
|
|
37269
|
+
clusterAttachInfo(clusterId: $clusterId) {
|
|
37270
|
+
clusterName
|
|
37271
|
+
attachable
|
|
37272
|
+
reason
|
|
37273
|
+
kubespanEnabled
|
|
37274
|
+
talosVersion
|
|
37275
|
+
isoUrl
|
|
37276
|
+
isoUrlArm64
|
|
37277
|
+
}
|
|
37278
|
+
}
|
|
37279
|
+
`,
|
|
37280
|
+
variables: { clusterId }
|
|
37281
|
+
}).pipe((0, import_operators.map)((res) => res.clusterAttachInfo));
|
|
37282
|
+
}
|
|
37283
|
+
/** includeCloud: also the cluster's Hetzner nodes (default: attached
|
|
37284
|
+
machines only, which is what cluster:attach waits on). */
|
|
37285
|
+
static clusterNodes(clusterId, includeCloud = false) {
|
|
37286
|
+
return this.query({
|
|
37287
|
+
query: gql`
|
|
37288
|
+
query clusterNodes($clusterId: String!, $includeCloud: Boolean) {
|
|
37289
|
+
clusterNodes(clusterId: $clusterId, includeCloud: $includeCloud) {
|
|
37290
|
+
${ClusterNodeFragment}
|
|
37291
|
+
}
|
|
37292
|
+
}
|
|
37293
|
+
`,
|
|
37294
|
+
variables: { clusterId, includeCloud }
|
|
37295
|
+
}).pipe((0, import_operators.map)((res) => res.clusterNodes ?? []));
|
|
37296
|
+
}
|
|
37297
|
+
static setClusterNodePaused(clusterId, name2, paused) {
|
|
37298
|
+
return this.query({
|
|
37299
|
+
query: gql`
|
|
37300
|
+
mutation setClusterNodePaused(
|
|
37301
|
+
$clusterId: String!
|
|
37302
|
+
$name: String!
|
|
37303
|
+
$paused: Boolean!
|
|
37304
|
+
) {
|
|
37305
|
+
setClusterNodePaused(
|
|
37306
|
+
clusterId: $clusterId
|
|
37307
|
+
name: $name
|
|
37308
|
+
paused: $paused
|
|
37309
|
+
) {
|
|
37310
|
+
${ClusterNodeFragment}
|
|
37311
|
+
}
|
|
37312
|
+
}
|
|
37313
|
+
`,
|
|
37314
|
+
variables: { clusterId, name: name2, paused }
|
|
37315
|
+
}).pipe((0, import_operators.map)((res) => res.setClusterNodePaused));
|
|
37316
|
+
}
|
|
37317
|
+
static detachClusterNode(clusterId, name2) {
|
|
37318
|
+
return this.query({
|
|
37319
|
+
query: gql`
|
|
37320
|
+
mutation detachClusterNode($clusterId: String!, $name: String!) {
|
|
37321
|
+
detachClusterNode(clusterId: $clusterId, name: $name) {
|
|
37322
|
+
${ClusterNodeFragment}
|
|
37323
|
+
}
|
|
37324
|
+
}
|
|
37325
|
+
`,
|
|
37326
|
+
variables: { clusterId, name: name2 }
|
|
37327
|
+
}).pipe((0, import_operators.map)((res) => res.detachClusterNode));
|
|
37328
|
+
}
|
|
37210
37329
|
static clusterHealth(projectId, clusterId, limit = 1) {
|
|
37211
37330
|
return this.query({
|
|
37212
37331
|
query: gql`
|
|
@@ -38151,13 +38270,13 @@ function __asyncGenerator(thisArg, _arguments, generator) {
|
|
|
38151
38270
|
if (g[n]) {
|
|
38152
38271
|
i2[n] = function(v) {
|
|
38153
38272
|
return new Promise(function(a, b) {
|
|
38154
|
-
q.push([n, v, a, b]) > 1 ||
|
|
38273
|
+
q.push([n, v, a, b]) > 1 || resume2(n, v);
|
|
38155
38274
|
});
|
|
38156
38275
|
};
|
|
38157
38276
|
if (f3) i2[n] = f3(i2[n]);
|
|
38158
38277
|
}
|
|
38159
38278
|
}
|
|
38160
|
-
function
|
|
38279
|
+
function resume2(n, v) {
|
|
38161
38280
|
try {
|
|
38162
38281
|
step(g[n](v));
|
|
38163
38282
|
} catch (e2) {
|
|
@@ -38168,13 +38287,13 @@ function __asyncGenerator(thisArg, _arguments, generator) {
|
|
|
38168
38287
|
r2.value instanceof __await ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q[0][2], r2);
|
|
38169
38288
|
}
|
|
38170
38289
|
function fulfill(value) {
|
|
38171
|
-
|
|
38290
|
+
resume2("next", value);
|
|
38172
38291
|
}
|
|
38173
38292
|
function reject(value) {
|
|
38174
|
-
|
|
38293
|
+
resume2("throw", value);
|
|
38175
38294
|
}
|
|
38176
38295
|
function settle(f3, v) {
|
|
38177
|
-
if (f3(v), q.shift(), q.length)
|
|
38296
|
+
if (f3(v), q.shift(), q.length) resume2(q[0][0], q[0][1]);
|
|
38178
38297
|
}
|
|
38179
38298
|
}
|
|
38180
38299
|
function __asyncDelegator(o) {
|
|
@@ -38576,7 +38695,7 @@ var require_util = __commonJS({
|
|
|
38576
38695
|
return path2;
|
|
38577
38696
|
}
|
|
38578
38697
|
exports2.normalize = normalize2;
|
|
38579
|
-
function
|
|
38698
|
+
function join4(aRoot, aPath) {
|
|
38580
38699
|
if (aRoot === "") {
|
|
38581
38700
|
aRoot = ".";
|
|
38582
38701
|
}
|
|
@@ -38608,7 +38727,7 @@ var require_util = __commonJS({
|
|
|
38608
38727
|
}
|
|
38609
38728
|
return joined;
|
|
38610
38729
|
}
|
|
38611
|
-
exports2.join =
|
|
38730
|
+
exports2.join = join4;
|
|
38612
38731
|
exports2.isAbsolute = function(aPath) {
|
|
38613
38732
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
38614
38733
|
};
|
|
@@ -38781,7 +38900,7 @@ var require_util = __commonJS({
|
|
|
38781
38900
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
38782
38901
|
}
|
|
38783
38902
|
}
|
|
38784
|
-
sourceURL =
|
|
38903
|
+
sourceURL = join4(urlGenerate(parsed), sourceURL);
|
|
38785
38904
|
}
|
|
38786
38905
|
return normalize2(sourceURL);
|
|
38787
38906
|
}
|
|
@@ -42907,7 +43026,7 @@ var require_typescript = __commonJS({
|
|
|
42907
43026
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
42908
43027
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
42909
43028
|
writeCommentRange: () => writeCommentRange,
|
|
42910
|
-
writeFile: () =>
|
|
43029
|
+
writeFile: () => writeFile10,
|
|
42911
43030
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
42912
43031
|
zipWith: () => zipWith
|
|
42913
43032
|
});
|
|
@@ -61550,7 +61669,7 @@ ${lanes.join("\n")}
|
|
|
61550
61669
|
sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
|
|
61551
61670
|
return combinePaths(newDirPath, sourceFilePath);
|
|
61552
61671
|
}
|
|
61553
|
-
function
|
|
61672
|
+
function writeFile10(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
61554
61673
|
host.writeFile(
|
|
61555
61674
|
fileName,
|
|
61556
61675
|
text,
|
|
@@ -170301,7 +170420,7 @@ ${lanes.join("\n")}
|
|
|
170301
170420
|
return;
|
|
170302
170421
|
}
|
|
170303
170422
|
const buildInfo = host.getBuildInfo() || { version: version2 };
|
|
170304
|
-
|
|
170423
|
+
writeFile10(
|
|
170305
170424
|
host,
|
|
170306
170425
|
emitterDiagnostics,
|
|
170307
170426
|
buildInfoPath,
|
|
@@ -170513,7 +170632,7 @@ ${lanes.join("\n")}
|
|
|
170513
170632
|
}
|
|
170514
170633
|
if (sourceMapFilePath) {
|
|
170515
170634
|
const sourceMap = sourceMapGenerator.toString();
|
|
170516
|
-
|
|
170635
|
+
writeFile10(
|
|
170517
170636
|
host,
|
|
170518
170637
|
emitterDiagnostics,
|
|
170519
170638
|
sourceMapFilePath,
|
|
@@ -170528,7 +170647,7 @@ ${lanes.join("\n")}
|
|
|
170528
170647
|
}
|
|
170529
170648
|
const text = writer.getText();
|
|
170530
170649
|
const data = { sourceMapUrlPos, diagnostics: transform22.diagnostics };
|
|
170531
|
-
|
|
170650
|
+
writeFile10(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
|
|
170532
170651
|
writer.clear();
|
|
170533
170652
|
return !data.skippedDtsWrite;
|
|
170534
170653
|
}
|
|
@@ -238410,7 +238529,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
238410
238529
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
238411
238530
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
238412
238531
|
writeCommentRange: () => writeCommentRange,
|
|
238413
|
-
writeFile: () =>
|
|
238532
|
+
writeFile: () => writeFile10,
|
|
238414
238533
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
238415
238534
|
zipWith: () => zipWith
|
|
238416
238535
|
});
|
|
@@ -254759,7 +254878,7 @@ var init_virtual_cluster = __esm({
|
|
|
254759
254878
|
"src/commands/cluster/helpers/virtual-cluster.ts"() {
|
|
254760
254879
|
import_rxjs8 = __toESM(require_cjs());
|
|
254761
254880
|
init_gql_client();
|
|
254762
|
-
provisionVirtualCluster = async (projectId, name2, host) => {
|
|
254881
|
+
provisionVirtualCluster = async (projectId, name2, host, dedicatedLoadBalancer) => {
|
|
254763
254882
|
let hostClusterId;
|
|
254764
254883
|
if (host) {
|
|
254765
254884
|
const clusters = await (0, import_rxjs8.lastValueFrom)(
|
|
@@ -254777,7 +254896,8 @@ var init_virtual_cluster = __esm({
|
|
|
254777
254896
|
return (0, import_rxjs8.lastValueFrom)(
|
|
254778
254897
|
GraphqlClienAPI.provisionProjectVirtualCluster(projectId, {
|
|
254779
254898
|
name: name2,
|
|
254780
|
-
hostClusterId
|
|
254899
|
+
hostClusterId,
|
|
254900
|
+
...dedicatedLoadBalancer === void 0 ? {} : { dedicatedLoadBalancer }
|
|
254781
254901
|
})
|
|
254782
254902
|
);
|
|
254783
254903
|
};
|
|
@@ -254819,7 +254939,8 @@ var init_create = __esm({
|
|
|
254819
254939
|
provisionVirtualCluster(
|
|
254820
254940
|
projectId,
|
|
254821
254941
|
cmd.name || data.name,
|
|
254822
|
-
cmd.host ?? data.host
|
|
254942
|
+
cmd.host ?? data.host,
|
|
254943
|
+
cmd.dedicatedLb ?? data.loadBalancer
|
|
254823
254944
|
)
|
|
254824
254945
|
) : GraphqlClienAPI.provisionProjectCluster(projectId, {
|
|
254825
254946
|
name: cmd.name || data.name,
|
|
@@ -254960,7 +255081,6 @@ var init_plan = __esm({
|
|
|
254960
255081
|
"singleNode",
|
|
254961
255082
|
"workers",
|
|
254962
255083
|
"controlPlanes",
|
|
254963
|
-
"loadBalancer",
|
|
254964
255084
|
"autoscale"
|
|
254965
255085
|
];
|
|
254966
255086
|
intIn = (v, min, max) => Number.isInteger(v) && v >= min && v <= max;
|
|
@@ -255022,8 +255142,21 @@ var init_plan = __esm({
|
|
|
255022
255142
|
if (!current) {
|
|
255023
255143
|
steps.push({
|
|
255024
255144
|
kind: "create",
|
|
255025
|
-
description: `create virtual cluster "${desired.name}" on ${desired.host ? `"${desired.host}"` : "the shared cluster"}`
|
|
255145
|
+
description: `create virtual cluster "${desired.name}" on ${desired.host ? `"${desired.host}"` : "the shared cluster"}${desired.loadBalancer ? " with a dedicated load balancer" : ""}`
|
|
255026
255146
|
});
|
|
255147
|
+
} else if (desired.loadBalancer !== void 0 && !!current.withLoadBalancer !== desired.loadBalancer) {
|
|
255148
|
+
steps.push(
|
|
255149
|
+
desired.loadBalancer ? {
|
|
255150
|
+
kind: "load-balancer",
|
|
255151
|
+
enabled: true,
|
|
255152
|
+
description: "add a dedicated load balancer (its own IP, billed; the subdomain stays)"
|
|
255153
|
+
} : {
|
|
255154
|
+
kind: "load-balancer",
|
|
255155
|
+
enabled: false,
|
|
255156
|
+
description: "remove the dedicated load balancer (its IP is released; the subdomain stays)",
|
|
255157
|
+
destructive: true
|
|
255158
|
+
}
|
|
255159
|
+
);
|
|
255027
255160
|
}
|
|
255028
255161
|
return { steps, notes };
|
|
255029
255162
|
}
|
|
@@ -255208,7 +255341,12 @@ var init_apply = __esm({
|
|
|
255208
255341
|
}
|
|
255209
255342
|
Logger.info(`-> ${step.description}`);
|
|
255210
255343
|
if (step.kind === "create") {
|
|
255211
|
-
const created = desired.provider === "vcluster" ? await provisionVirtualCluster(
|
|
255344
|
+
const created = desired.provider === "vcluster" ? await provisionVirtualCluster(
|
|
255345
|
+
projectId,
|
|
255346
|
+
desired.name,
|
|
255347
|
+
desired.host,
|
|
255348
|
+
desired.loadBalancer
|
|
255349
|
+
) : await (0, import_rxjs12.lastValueFrom)(
|
|
255212
255350
|
GraphqlClienAPI.provisionProjectCluster(projectId, {
|
|
255213
255351
|
name: desired.name,
|
|
255214
255352
|
imageId: desired.imageId,
|
|
@@ -255293,14 +255431,20 @@ var init_list = __esm({
|
|
|
255293
255431
|
"No private clusters for this project yet - this project runs on the shared cluster. See cluster:create."
|
|
255294
255432
|
);
|
|
255295
255433
|
} else {
|
|
255296
|
-
Logger.table(
|
|
255297
|
-
|
|
255298
|
-
|
|
255299
|
-
|
|
255300
|
-
|
|
255301
|
-
|
|
255302
|
-
|
|
255303
|
-
|
|
255434
|
+
Logger.table(
|
|
255435
|
+
clusters.map((c) => {
|
|
255436
|
+
const x2 = c;
|
|
255437
|
+
return {
|
|
255438
|
+
id: x2.id,
|
|
255439
|
+
name: x2.name,
|
|
255440
|
+
type: x2.provider === "vcluster" ? "virtual" : x2.provider,
|
|
255441
|
+
status: x2.status,
|
|
255442
|
+
router: x2.routerUrl ?? "-",
|
|
255443
|
+
api: x2.endpoint ?? "-",
|
|
255444
|
+
loadBalancer: x2.withLoadBalancer ? x2.loadBalancerIp ?? "pending" : "off"
|
|
255445
|
+
};
|
|
255446
|
+
})
|
|
255447
|
+
);
|
|
255304
255448
|
}
|
|
255305
255449
|
Logger.log("-------------------");
|
|
255306
255450
|
})
|
|
@@ -255451,22 +255595,362 @@ var init_status = __esm({
|
|
|
255451
255595
|
}
|
|
255452
255596
|
});
|
|
255453
255597
|
|
|
255598
|
+
// src/commands/cluster/helpers/attach.ts
|
|
255599
|
+
function parseAttachOptions(cmd) {
|
|
255600
|
+
const nodeIp = (cmd.nodeIp ?? "").trim();
|
|
255601
|
+
const name2 = (cmd.name ?? "").trim();
|
|
255602
|
+
const pool = (cmd.pool ?? "").trim() || void 0;
|
|
255603
|
+
const disk = (cmd.disk ?? "").trim() || void 0;
|
|
255604
|
+
if (!nodeIp || !HOST_RE.test(nodeIp)) {
|
|
255605
|
+
throw new Error(
|
|
255606
|
+
"--node-ip is required: the machine's address on your network, shown on its screen after booting the Talos ISO (e.g. 192.168.1.50)"
|
|
255607
|
+
);
|
|
255608
|
+
}
|
|
255609
|
+
if (!NAME_RE.test(name2)) {
|
|
255610
|
+
throw new Error(
|
|
255611
|
+
"--name is required: lowercase letters, digits and dashes (it becomes the machine hostname, e.g. home-1)"
|
|
255612
|
+
);
|
|
255613
|
+
}
|
|
255614
|
+
if (pool && !POOL_RE.test(pool)) {
|
|
255615
|
+
throw new Error("--pool: lowercase letters, digits and dashes (max 32)");
|
|
255616
|
+
}
|
|
255617
|
+
if (disk && !DISK_RE.test(disk)) {
|
|
255618
|
+
throw new Error("--disk must look like /dev/nvme0n1 or /dev/sda");
|
|
255619
|
+
}
|
|
255620
|
+
const timeoutMinutes = cmd.timeout === void 0 ? 10 : Number(cmd.timeout);
|
|
255621
|
+
if (!Number.isFinite(timeoutMinutes) || timeoutMinutes < 1 || timeoutMinutes > 60) {
|
|
255622
|
+
throw new Error("--timeout is in minutes, 1 to 60");
|
|
255623
|
+
}
|
|
255624
|
+
return {
|
|
255625
|
+
nodeIp,
|
|
255626
|
+
name: name2,
|
|
255627
|
+
pool,
|
|
255628
|
+
disk,
|
|
255629
|
+
reserved: !!cmd.reserved,
|
|
255630
|
+
yes: !!cmd.yes,
|
|
255631
|
+
wait: cmd.wait !== false,
|
|
255632
|
+
timeoutMs: timeoutMinutes * 6e4
|
|
255633
|
+
};
|
|
255634
|
+
}
|
|
255635
|
+
function serverTalosVersion(output) {
|
|
255636
|
+
const spec = output.split(/^spec:/m)[1];
|
|
255637
|
+
return spec?.match(/^\s+version:\s*(v[\d.]+\S*)/m)?.[1];
|
|
255638
|
+
}
|
|
255639
|
+
var NAME_RE, POOL_RE, DISK_RE, HOST_RE, nodeRow, resetHint;
|
|
255640
|
+
var init_attach = __esm({
|
|
255641
|
+
"src/commands/cluster/helpers/attach.ts"() {
|
|
255642
|
+
NAME_RE = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
255643
|
+
POOL_RE = /^[a-z0-9]([a-z0-9-]{0,30}[a-z0-9])?$/;
|
|
255644
|
+
DISK_RE = /^\/dev\/[A-Za-z0-9/_-]+$/;
|
|
255645
|
+
HOST_RE = /^[A-Za-z0-9.:-]+$/;
|
|
255646
|
+
nodeRow = (n) => {
|
|
255647
|
+
const own = n.source !== "hetzner";
|
|
255648
|
+
return {
|
|
255649
|
+
node: n.name,
|
|
255650
|
+
role: n.role === "control-plane" ? "control plane" : "worker",
|
|
255651
|
+
source: own ? "own" : "hetzner",
|
|
255652
|
+
status: n.cordoned ? `${n.status}, paused` : n.status,
|
|
255653
|
+
pool: own ? n.pool ?? "-" : "-",
|
|
255654
|
+
use: own ? n.reserved ? "reserved" : "capacity" : "-",
|
|
255655
|
+
ip: n.internalIp ?? "-",
|
|
255656
|
+
cpu: n.cpuCores ?? "-",
|
|
255657
|
+
memoryGb: n.memoryGb ?? "-",
|
|
255658
|
+
talos: n.osImage ?? "-",
|
|
255659
|
+
joined: n.joinedAt ?? "-",
|
|
255660
|
+
...own && !n.recorded ? { note: "joined by hand" } : {}
|
|
255661
|
+
};
|
|
255662
|
+
};
|
|
255663
|
+
resetHint = (ip = "<machine-ip>") => `talosctl --talosconfig <cluster talosconfig> -n ${ip} -e ${ip} reset --graceful=false --reboot --system-labels-to-wipe STATE --system-labels-to-wipe EPHEMERAL`;
|
|
255664
|
+
}
|
|
255665
|
+
});
|
|
255666
|
+
|
|
255667
|
+
// src/commands/cluster/attach.ts
|
|
255668
|
+
var attach_exports = {};
|
|
255669
|
+
__export(attach_exports, {
|
|
255670
|
+
default: () => attach_default
|
|
255671
|
+
});
|
|
255672
|
+
var import_child_process, import_promises, import_os2, import_path, import_readline, import_rxjs17, talosctl, sleep, ask, attach_default;
|
|
255673
|
+
var init_attach2 = __esm({
|
|
255674
|
+
"src/commands/cluster/attach.ts"() {
|
|
255675
|
+
import_child_process = require("child_process");
|
|
255676
|
+
import_promises = require("fs/promises");
|
|
255677
|
+
import_os2 = require("os");
|
|
255678
|
+
import_path = require("path");
|
|
255679
|
+
import_readline = require("readline");
|
|
255680
|
+
import_rxjs17 = __toESM(require_cjs());
|
|
255681
|
+
init_gql_client();
|
|
255682
|
+
init_log();
|
|
255683
|
+
init_attach();
|
|
255684
|
+
init_cluster_change();
|
|
255685
|
+
talosctl = (args, timeoutMs = 2e4) => new Promise(
|
|
255686
|
+
(resolve2) => (0, import_child_process.execFile)(
|
|
255687
|
+
"talosctl",
|
|
255688
|
+
args,
|
|
255689
|
+
{ timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024 },
|
|
255690
|
+
(error48, stdout, stderr) => resolve2({
|
|
255691
|
+
code: error48 ? error48.code ?? 1 : 0,
|
|
255692
|
+
stdout: String(stdout),
|
|
255693
|
+
stderr: String(stderr)
|
|
255694
|
+
})
|
|
255695
|
+
)
|
|
255696
|
+
);
|
|
255697
|
+
sleep = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
255698
|
+
ask = (question) => new Promise((resolve2) => {
|
|
255699
|
+
const rl = (0, import_readline.createInterface)({
|
|
255700
|
+
input: process.stdin,
|
|
255701
|
+
output: process.stdout
|
|
255702
|
+
});
|
|
255703
|
+
rl.question(question, (answer) => {
|
|
255704
|
+
rl.close();
|
|
255705
|
+
resolve2(answer.trim());
|
|
255706
|
+
});
|
|
255707
|
+
});
|
|
255708
|
+
attach_default = async (cmd) => {
|
|
255709
|
+
const opts = parseAttachOptions(cmd);
|
|
255710
|
+
const { clusterId } = await resolveClusterTarget(cmd);
|
|
255711
|
+
const info = await (0, import_rxjs17.lastValueFrom)(
|
|
255712
|
+
GraphqlClienAPI.clusterAttachInfo(clusterId)
|
|
255713
|
+
);
|
|
255714
|
+
if (!info.attachable) {
|
|
255715
|
+
throw new Error(
|
|
255716
|
+
info.reason ?? "Machines cannot be attached to this cluster."
|
|
255717
|
+
);
|
|
255718
|
+
}
|
|
255719
|
+
if ((await talosctl(["version", "--client"])).code !== 0) {
|
|
255720
|
+
throw new Error(
|
|
255721
|
+
"talosctl is not installed. Install it (https://www.talos.dev/latest/talos-guides/install/talosctl/) - e.g. curl -sL https://talos.dev/install | sh"
|
|
255722
|
+
);
|
|
255723
|
+
}
|
|
255724
|
+
Logger.info(`Looking for the Talos installer at ${opts.nodeIp}:50000 ...`);
|
|
255725
|
+
let version2;
|
|
255726
|
+
for (let i2 = 0; i2 < 12 && !version2; i2++) {
|
|
255727
|
+
const probe = await talosctl([
|
|
255728
|
+
"-n",
|
|
255729
|
+
opts.nodeIp,
|
|
255730
|
+
"get",
|
|
255731
|
+
"version",
|
|
255732
|
+
"--insecure",
|
|
255733
|
+
"-o",
|
|
255734
|
+
"yaml"
|
|
255735
|
+
]);
|
|
255736
|
+
version2 = probe.code === 0 ? serverTalosVersion(probe.stdout) : void 0;
|
|
255737
|
+
if (!version2) await sleep(5e3);
|
|
255738
|
+
}
|
|
255739
|
+
if (!version2) {
|
|
255740
|
+
throw new Error(
|
|
255741
|
+
`No Talos installer answers at ${opts.nodeIp}:50000. Boot the machine from the Talos ${info.talosVersion ?? ""} ISO (${info.isoUrl ?? "https://github.com/siderolabs/talos/releases"}; ARM: ${info.isoUrlArm64 ?? "-"}) and run this from the same network.`
|
|
255742
|
+
);
|
|
255743
|
+
}
|
|
255744
|
+
Logger.info(`Machine runs the Talos ${version2} installer. Its disks:`);
|
|
255745
|
+
const disks = await talosctl([
|
|
255746
|
+
"-n",
|
|
255747
|
+
opts.nodeIp,
|
|
255748
|
+
"get",
|
|
255749
|
+
"disks",
|
|
255750
|
+
"--insecure"
|
|
255751
|
+
]);
|
|
255752
|
+
Logger.log(disks.stdout || disks.stderr);
|
|
255753
|
+
if (!opts.disk) {
|
|
255754
|
+
throw new Error(
|
|
255755
|
+
`Pick the install disk from the list above and run again with --disk, e.g. --disk /dev/nvme0n1. It is WIPED. Nothing was changed.`
|
|
255756
|
+
);
|
|
255757
|
+
}
|
|
255758
|
+
if (!opts.yes) {
|
|
255759
|
+
const answer = await ask(
|
|
255760
|
+
`Talos will WIPE ${opts.disk} on ${opts.nodeIp}. Type the machine name (${opts.name}) to continue: `
|
|
255761
|
+
);
|
|
255762
|
+
if (answer !== opts.name) {
|
|
255763
|
+
Logger.warn("Cancelled - nothing was changed.");
|
|
255764
|
+
return;
|
|
255765
|
+
}
|
|
255766
|
+
}
|
|
255767
|
+
const join_ = await (0, import_rxjs17.lastValueFrom)(
|
|
255768
|
+
GraphqlClienAPI.clusterNodeJoinConfig({
|
|
255769
|
+
clusterId,
|
|
255770
|
+
name: opts.name,
|
|
255771
|
+
pool: opts.pool,
|
|
255772
|
+
reserved: opts.reserved,
|
|
255773
|
+
installDisk: opts.disk
|
|
255774
|
+
})
|
|
255775
|
+
);
|
|
255776
|
+
if (join_.talosVersion && join_.talosVersion !== version2) {
|
|
255777
|
+
Logger.warn(
|
|
255778
|
+
`The cluster runs Talos ${join_.talosVersion}, the machine booted ${version2}. It installs ${join_.talosVersion} anyway; if the join fails, boot ${join_.isoUrl}.`
|
|
255779
|
+
);
|
|
255780
|
+
}
|
|
255781
|
+
const dir = await (0, import_promises.mkdtemp)((0, import_path.join)((0, import_os2.tmpdir)(), "gcli-attach-"));
|
|
255782
|
+
const file2 = (0, import_path.join)(dir, "machine.yaml");
|
|
255783
|
+
try {
|
|
255784
|
+
await (0, import_promises.writeFile)(file2, join_.config, { mode: 384 });
|
|
255785
|
+
const applied = await talosctl(
|
|
255786
|
+
["-n", opts.nodeIp, "apply-config", "--insecure", "--file", file2],
|
|
255787
|
+
6e4
|
|
255788
|
+
);
|
|
255789
|
+
if (applied.code !== 0) {
|
|
255790
|
+
throw new Error(
|
|
255791
|
+
`talosctl apply-config failed: ${(applied.stderr || applied.stdout).trim()}`
|
|
255792
|
+
);
|
|
255793
|
+
}
|
|
255794
|
+
} finally {
|
|
255795
|
+
await (0, import_promises.rm)(dir, { recursive: true, force: true });
|
|
255796
|
+
}
|
|
255797
|
+
Logger.info(
|
|
255798
|
+
`Config applied - ${opts.name} installs Talos and reboots, then joins "${join_.clusterName}" (pool ${join_.pool}, ${join_.reserved ? "reserved" : "extra capacity"}).`
|
|
255799
|
+
);
|
|
255800
|
+
if (!opts.wait) {
|
|
255801
|
+
Logger.info("Check progress with: gcli cluster:nodes");
|
|
255802
|
+
return;
|
|
255803
|
+
}
|
|
255804
|
+
Logger.info(
|
|
255805
|
+
"Waiting for it to join (install + reboot take a few minutes) ..."
|
|
255806
|
+
);
|
|
255807
|
+
const deadline = Date.now() + opts.timeoutMs;
|
|
255808
|
+
while (Date.now() < deadline) {
|
|
255809
|
+
await sleep(15e3);
|
|
255810
|
+
const nodes = await (0, import_rxjs17.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId));
|
|
255811
|
+
const node = nodes.find((n) => n.name === opts.name);
|
|
255812
|
+
if (node?.status === "ready") {
|
|
255813
|
+
Logger.log(`${opts.name} joined and is ready.`);
|
|
255814
|
+
Logger.table([nodeRow(node)]);
|
|
255815
|
+
return;
|
|
255816
|
+
}
|
|
255817
|
+
}
|
|
255818
|
+
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.`
|
|
255820
|
+
);
|
|
255821
|
+
};
|
|
255822
|
+
}
|
|
255823
|
+
});
|
|
255824
|
+
|
|
255825
|
+
// src/commands/cluster/nodes.ts
|
|
255826
|
+
var nodes_exports = {};
|
|
255827
|
+
__export(nodes_exports, {
|
|
255828
|
+
default: () => nodes_default
|
|
255829
|
+
});
|
|
255830
|
+
var import_rxjs18, nodes_default;
|
|
255831
|
+
var init_nodes = __esm({
|
|
255832
|
+
"src/commands/cluster/nodes.ts"() {
|
|
255833
|
+
import_rxjs18 = __toESM(require_cjs());
|
|
255834
|
+
init_gql_client();
|
|
255835
|
+
init_log();
|
|
255836
|
+
init_attach();
|
|
255837
|
+
init_cluster_change();
|
|
255838
|
+
nodes_default = async (cmd) => {
|
|
255839
|
+
const { clusterId } = await resolveClusterTarget(cmd);
|
|
255840
|
+
const nodes = await (0, import_rxjs18.lastValueFrom)(
|
|
255841
|
+
GraphqlClienAPI.clusterNodes(clusterId, true)
|
|
255842
|
+
);
|
|
255843
|
+
if (!nodes.length) {
|
|
255844
|
+
Logger.info("No nodes reported for this cluster yet.");
|
|
255845
|
+
return;
|
|
255846
|
+
}
|
|
255847
|
+
Logger.table(nodes.map(nodeRow));
|
|
255848
|
+
if (!nodes.some((n) => n.source !== "hetzner")) {
|
|
255849
|
+
Logger.info(
|
|
255850
|
+
"No machines of your own attached. Attach one with: gcli cluster:attach --cluster <id> --node-ip <ip> --name <name> --disk <disk>"
|
|
255851
|
+
);
|
|
255852
|
+
}
|
|
255853
|
+
};
|
|
255854
|
+
}
|
|
255855
|
+
});
|
|
255856
|
+
|
|
255857
|
+
// src/commands/cluster/pause.ts
|
|
255858
|
+
var pause_exports = {};
|
|
255859
|
+
__export(pause_exports, {
|
|
255860
|
+
pause: () => pause,
|
|
255861
|
+
resume: () => resume
|
|
255862
|
+
});
|
|
255863
|
+
var import_rxjs19, setPaused, pause, resume;
|
|
255864
|
+
var init_pause = __esm({
|
|
255865
|
+
"src/commands/cluster/pause.ts"() {
|
|
255866
|
+
import_rxjs19 = __toESM(require_cjs());
|
|
255867
|
+
init_gql_client();
|
|
255868
|
+
init_log();
|
|
255869
|
+
init_cluster_change();
|
|
255870
|
+
setPaused = (paused) => async (cmd) => {
|
|
255871
|
+
const name2 = (cmd.name ?? "").trim();
|
|
255872
|
+
if (!name2) {
|
|
255873
|
+
throw new Error("--name is required (see gcli cluster:nodes)");
|
|
255874
|
+
}
|
|
255875
|
+
const { clusterId } = await resolveClusterTarget(cmd);
|
|
255876
|
+
const node = await (0, import_rxjs19.lastValueFrom)(
|
|
255877
|
+
GraphqlClienAPI.setClusterNodePaused(clusterId, name2, paused)
|
|
255878
|
+
);
|
|
255879
|
+
Logger.log(
|
|
255880
|
+
paused ? `${node.name} is paused: nothing new runs there, running work stays. Undo with gcli cluster:resume.` : `${node.name} takes new work again.`
|
|
255881
|
+
);
|
|
255882
|
+
};
|
|
255883
|
+
pause = setPaused(true);
|
|
255884
|
+
resume = setPaused(false);
|
|
255885
|
+
}
|
|
255886
|
+
});
|
|
255887
|
+
|
|
255888
|
+
// src/commands/cluster/detach.ts
|
|
255889
|
+
var detach_exports = {};
|
|
255890
|
+
__export(detach_exports, {
|
|
255891
|
+
default: () => detach_default
|
|
255892
|
+
});
|
|
255893
|
+
var import_readline2, import_rxjs20, detach_default;
|
|
255894
|
+
var init_detach = __esm({
|
|
255895
|
+
"src/commands/cluster/detach.ts"() {
|
|
255896
|
+
import_readline2 = require("readline");
|
|
255897
|
+
import_rxjs20 = __toESM(require_cjs());
|
|
255898
|
+
init_gql_client();
|
|
255899
|
+
init_log();
|
|
255900
|
+
init_attach();
|
|
255901
|
+
init_cluster_change();
|
|
255902
|
+
detach_default = async (cmd) => {
|
|
255903
|
+
const name2 = (cmd.name ?? "").trim();
|
|
255904
|
+
if (!name2) {
|
|
255905
|
+
throw new Error("--name is required (see gcli cluster:nodes)");
|
|
255906
|
+
}
|
|
255907
|
+
const { clusterId } = await resolveClusterTarget(cmd);
|
|
255908
|
+
if (!cmd.yes) {
|
|
255909
|
+
const answer = await new Promise((resolve2) => {
|
|
255910
|
+
const rl = (0, import_readline2.createInterface)({
|
|
255911
|
+
input: process.stdin,
|
|
255912
|
+
output: process.stdout
|
|
255913
|
+
});
|
|
255914
|
+
rl.question(
|
|
255915
|
+
`Drain and remove ${name2} from the cluster? Its pods move to other nodes. [y/N] `,
|
|
255916
|
+
(a) => {
|
|
255917
|
+
rl.close();
|
|
255918
|
+
resolve2(a.trim().toLowerCase());
|
|
255919
|
+
}
|
|
255920
|
+
);
|
|
255921
|
+
});
|
|
255922
|
+
if (answer !== "y" && answer !== "yes") {
|
|
255923
|
+
Logger.warn("Cancelled - nothing was changed.");
|
|
255924
|
+
return;
|
|
255925
|
+
}
|
|
255926
|
+
}
|
|
255927
|
+
const node = await (0, import_rxjs20.lastValueFrom)(
|
|
255928
|
+
GraphqlClienAPI.detachClusterNode(clusterId, name2)
|
|
255929
|
+
);
|
|
255930
|
+
Logger.log(`${node.name} is detached.`);
|
|
255931
|
+
Logger.info(
|
|
255932
|
+
`The machine still runs Talos. To reuse it, reset it from its network: ${resetHint()}`
|
|
255933
|
+
);
|
|
255934
|
+
};
|
|
255935
|
+
}
|
|
255936
|
+
});
|
|
255937
|
+
|
|
255454
255938
|
// src/commands/cluster/health.ts
|
|
255455
255939
|
var health_exports = {};
|
|
255456
255940
|
__export(health_exports, {
|
|
255457
255941
|
default: () => health_default
|
|
255458
255942
|
});
|
|
255459
|
-
var
|
|
255943
|
+
var import_rxjs21, pct2, health_default;
|
|
255460
255944
|
var init_health = __esm({
|
|
255461
255945
|
"src/commands/cluster/health.ts"() {
|
|
255462
|
-
|
|
255946
|
+
import_rxjs21 = __toESM(require_cjs());
|
|
255463
255947
|
init_gql_client();
|
|
255464
255948
|
init_log();
|
|
255465
255949
|
init_cluster_change();
|
|
255466
255950
|
pct2 = (v) => v == null ? "-" : `${Math.round(v)}%`;
|
|
255467
255951
|
health_default = async (cmd) => {
|
|
255468
255952
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
255469
|
-
const [latest] = await (0,
|
|
255953
|
+
const [latest] = await (0, import_rxjs21.lastValueFrom)(
|
|
255470
255954
|
GraphqlClienAPI.clusterHealth(projectId, clusterId, 1)
|
|
255471
255955
|
);
|
|
255472
255956
|
Logger.log("-------------------");
|
|
@@ -255513,17 +255997,17 @@ var scale_events_exports = {};
|
|
|
255513
255997
|
__export(scale_events_exports, {
|
|
255514
255998
|
default: () => scale_events_default
|
|
255515
255999
|
});
|
|
255516
|
-
var
|
|
256000
|
+
var import_rxjs22, scale_events_default;
|
|
255517
256001
|
var init_scale_events = __esm({
|
|
255518
256002
|
"src/commands/cluster/scale-events.ts"() {
|
|
255519
|
-
|
|
256003
|
+
import_rxjs22 = __toESM(require_cjs());
|
|
255520
256004
|
init_gql_client();
|
|
255521
256005
|
init_log();
|
|
255522
256006
|
init_cluster_change();
|
|
255523
256007
|
scale_events_default = async (cmd) => {
|
|
255524
256008
|
const limit = cmd.limit === void 0 ? 20 : parseIntOption("limit", cmd.limit, 1, 200);
|
|
255525
256009
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
255526
|
-
const events = await (0,
|
|
256010
|
+
const events = await (0, import_rxjs22.lastValueFrom)(
|
|
255527
256011
|
GraphqlClienAPI.clusterScaleEvents(projectId, clusterId, limit)
|
|
255528
256012
|
);
|
|
255529
256013
|
Logger.log("-------------------");
|
|
@@ -255553,17 +256037,17 @@ var cost_exports = {};
|
|
|
255553
256037
|
__export(cost_exports, {
|
|
255554
256038
|
default: () => cost_default
|
|
255555
256039
|
});
|
|
255556
|
-
var
|
|
256040
|
+
var import_rxjs23, money, cost_default;
|
|
255557
256041
|
var init_cost = __esm({
|
|
255558
256042
|
"src/commands/cluster/cost.ts"() {
|
|
255559
|
-
|
|
256043
|
+
import_rxjs23 = __toESM(require_cjs());
|
|
255560
256044
|
init_helpers();
|
|
255561
256045
|
init_gql_client();
|
|
255562
256046
|
init_log();
|
|
255563
256047
|
money = (v, sign = "\u20AC") => v == null ? "-" : `${sign}${v.toFixed(2)}`;
|
|
255564
256048
|
cost_default = async (cmd) => {
|
|
255565
|
-
const projectId = await (0,
|
|
255566
|
-
const rows = await (0,
|
|
256049
|
+
const projectId = await (0, import_rxjs23.lastValueFrom)(parseProjectId(cmd.project));
|
|
256050
|
+
const rows = await (0, import_rxjs23.lastValueFrom)(
|
|
255567
256051
|
GraphqlClienAPI.projectClustersOverview(projectId)
|
|
255568
256052
|
);
|
|
255569
256053
|
Logger.log("-------------------");
|
|
@@ -255651,10 +256135,10 @@ __export(autoscale_exports, {
|
|
|
255651
256135
|
default: () => autoscale_default,
|
|
255652
256136
|
toAutoscaleInput: () => toAutoscaleInput
|
|
255653
256137
|
});
|
|
255654
|
-
var
|
|
256138
|
+
var import_rxjs24, toAutoscaleInput, autoscale_default;
|
|
255655
256139
|
var init_autoscale = __esm({
|
|
255656
256140
|
"src/commands/cluster/autoscale.ts"() {
|
|
255657
|
-
|
|
256141
|
+
import_rxjs24 = __toESM(require_cjs());
|
|
255658
256142
|
init_gql_client();
|
|
255659
256143
|
init_log();
|
|
255660
256144
|
init_cluster_change();
|
|
@@ -255695,7 +256179,7 @@ var init_autoscale = __esm({
|
|
|
255695
256179
|
autoscale_default = async (cmd) => {
|
|
255696
256180
|
const input = toAutoscaleInput(cmd);
|
|
255697
256181
|
const { projectId, clusterId } = await resolveClusterTarget(cmd);
|
|
255698
|
-
const cluster = await (0,
|
|
256182
|
+
const cluster = await (0, import_rxjs24.lastValueFrom)(
|
|
255699
256183
|
GraphqlClienAPI.updateProjectClusterAutoscale(projectId, clusterId, input)
|
|
255700
256184
|
);
|
|
255701
256185
|
const a = cluster.autoscale ?? {};
|
|
@@ -255803,15 +256287,15 @@ var list_environments_exports = {};
|
|
|
255803
256287
|
__export(list_environments_exports, {
|
|
255804
256288
|
default: () => list_environments_default
|
|
255805
256289
|
});
|
|
255806
|
-
var
|
|
256290
|
+
var import_rxjs25, import_operators12, list_environments_default;
|
|
255807
256291
|
var init_list_environments = __esm({
|
|
255808
256292
|
"src/commands/environment/list-environments.ts"() {
|
|
255809
|
-
|
|
256293
|
+
import_rxjs25 = __toESM(require_cjs());
|
|
255810
256294
|
import_operators12 = __toESM(require_operators());
|
|
255811
256295
|
init_helpers();
|
|
255812
256296
|
init_gql_client();
|
|
255813
256297
|
init_log();
|
|
255814
|
-
list_environments_default = (cmd) => (0,
|
|
256298
|
+
list_environments_default = (cmd) => (0, import_rxjs25.lastValueFrom)(
|
|
255815
256299
|
parseProjectId(cmd.project).pipe(
|
|
255816
256300
|
(0, import_operators12.switchMap)((projectId) => GraphqlClienAPI.listEnvironments(projectId)),
|
|
255817
256301
|
(0, import_operators12.tap)((data) => {
|
|
@@ -255844,10 +256328,10 @@ var create_environment_exports = {};
|
|
|
255844
256328
|
__export(create_environment_exports, {
|
|
255845
256329
|
default: () => create_environment_default
|
|
255846
256330
|
});
|
|
255847
|
-
var
|
|
256331
|
+
var import_rxjs26, import_operators13, create_environment_default;
|
|
255848
256332
|
var init_create_environment = __esm({
|
|
255849
256333
|
"src/commands/environment/create-environment.ts"() {
|
|
255850
|
-
|
|
256334
|
+
import_rxjs26 = __toESM(require_cjs());
|
|
255851
256335
|
import_operators13 = __toESM(require_operators());
|
|
255852
256336
|
init_helpers();
|
|
255853
256337
|
init_gql_client();
|
|
@@ -255855,7 +256339,7 @@ var init_create_environment = __esm({
|
|
|
255855
256339
|
init_load_spec();
|
|
255856
256340
|
create_environment_default = (cmd) => {
|
|
255857
256341
|
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
255858
|
-
return (0,
|
|
256342
|
+
return (0, import_rxjs26.lastValueFrom)(
|
|
255859
256343
|
parseProjectId(cmd.project).pipe(
|
|
255860
256344
|
(0, import_operators13.switchMap)(
|
|
255861
256345
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -255910,10 +256394,10 @@ var update_environment_exports = {};
|
|
|
255910
256394
|
__export(update_environment_exports, {
|
|
255911
256395
|
default: () => update_environment_default
|
|
255912
256396
|
});
|
|
255913
|
-
var
|
|
256397
|
+
var import_rxjs27, import_operators14, update_environment_default;
|
|
255914
256398
|
var init_update_environment = __esm({
|
|
255915
256399
|
"src/commands/environment/update-environment.ts"() {
|
|
255916
|
-
|
|
256400
|
+
import_rxjs27 = __toESM(require_cjs());
|
|
255917
256401
|
import_operators14 = __toESM(require_operators());
|
|
255918
256402
|
init_helpers();
|
|
255919
256403
|
init_gql_client();
|
|
@@ -255921,7 +256405,7 @@ var init_update_environment = __esm({
|
|
|
255921
256405
|
init_load_spec();
|
|
255922
256406
|
update_environment_default = (cmd) => {
|
|
255923
256407
|
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
255924
|
-
return (0,
|
|
256408
|
+
return (0, import_rxjs27.lastValueFrom)(
|
|
255925
256409
|
parseProjectId(cmd.project).pipe(
|
|
255926
256410
|
(0, import_operators14.switchMap)(
|
|
255927
256411
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -255977,16 +256461,16 @@ var delete_environment_exports = {};
|
|
|
255977
256461
|
__export(delete_environment_exports, {
|
|
255978
256462
|
default: () => delete_environment_default
|
|
255979
256463
|
});
|
|
255980
|
-
var
|
|
256464
|
+
var import_rxjs28, import_operators15, delete_environment_default;
|
|
255981
256465
|
var init_delete_environment = __esm({
|
|
255982
256466
|
"src/commands/environment/delete-environment.ts"() {
|
|
255983
|
-
|
|
256467
|
+
import_rxjs28 = __toESM(require_cjs());
|
|
255984
256468
|
import_operators15 = __toESM(require_operators());
|
|
255985
256469
|
init_helpers();
|
|
255986
256470
|
init_gql_client();
|
|
255987
256471
|
init_log();
|
|
255988
256472
|
init_load_spec();
|
|
255989
|
-
delete_environment_default = (cmd) => (0,
|
|
256473
|
+
delete_environment_default = (cmd) => (0, import_rxjs28.lastValueFrom)(
|
|
255990
256474
|
parseProjectId(cmd.project).pipe(
|
|
255991
256475
|
(0, import_operators15.switchMap)(
|
|
255992
256476
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -256039,16 +256523,16 @@ var get_environment_exports = {};
|
|
|
256039
256523
|
__export(get_environment_exports, {
|
|
256040
256524
|
default: () => get_environment_default
|
|
256041
256525
|
});
|
|
256042
|
-
var
|
|
256526
|
+
var import_rxjs29, import_operators16, get_environment_default;
|
|
256043
256527
|
var init_get_environment = __esm({
|
|
256044
256528
|
"src/commands/environment/get-environment.ts"() {
|
|
256045
|
-
|
|
256529
|
+
import_rxjs29 = __toESM(require_cjs());
|
|
256046
256530
|
import_operators16 = __toESM(require_operators());
|
|
256047
256531
|
init_helpers();
|
|
256048
256532
|
init_gql_client();
|
|
256049
256533
|
init_log();
|
|
256050
256534
|
init_load_spec();
|
|
256051
|
-
get_environment_default = (cmd) => (0,
|
|
256535
|
+
get_environment_default = (cmd) => (0, import_rxjs29.lastValueFrom)(
|
|
256052
256536
|
parseProjectId(cmd.project).pipe(
|
|
256053
256537
|
(0, import_operators16.switchMap)(
|
|
256054
256538
|
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
@@ -269757,8 +270241,8 @@ var require_graceful_fs = __commonJS({
|
|
|
269757
270241
|
}
|
|
269758
270242
|
}
|
|
269759
270243
|
var fs$writeFile = fs4.writeFile;
|
|
269760
|
-
fs4.writeFile =
|
|
269761
|
-
function
|
|
270244
|
+
fs4.writeFile = writeFile10;
|
|
270245
|
+
function writeFile10(path2, data, options, cb) {
|
|
269762
270246
|
if (typeof options === "function")
|
|
269763
270247
|
cb = options, options = null;
|
|
269764
270248
|
return go$writeFile(path2, data, options, cb);
|
|
@@ -270207,7 +270691,7 @@ var require_BufferList2 = __commonJS({
|
|
|
270207
270691
|
this.head = this.tail = null;
|
|
270208
270692
|
this.length = 0;
|
|
270209
270693
|
};
|
|
270210
|
-
BufferList.prototype.join = function
|
|
270694
|
+
BufferList.prototype.join = function join4(s2) {
|
|
270211
270695
|
if (this.length === 0) return "";
|
|
270212
270696
|
var p = this.head;
|
|
270213
270697
|
var ret = "" + p.data;
|
|
@@ -271551,11 +272035,11 @@ var require_stream_readable3 = __commonJS({
|
|
|
271551
272035
|
if (!state.flowing) {
|
|
271552
272036
|
debug("resume");
|
|
271553
272037
|
state.flowing = true;
|
|
271554
|
-
|
|
272038
|
+
resume2(this, state);
|
|
271555
272039
|
}
|
|
271556
272040
|
return this;
|
|
271557
272041
|
};
|
|
271558
|
-
function
|
|
272042
|
+
function resume2(stream, state) {
|
|
271559
272043
|
if (!state.resumeScheduled) {
|
|
271560
272044
|
state.resumeScheduled = true;
|
|
271561
272045
|
pna.nextTick(resume_, stream, state);
|
|
@@ -275007,7 +275491,7 @@ var require_buffer_list3 = __commonJS({
|
|
|
275007
275491
|
}
|
|
275008
275492
|
}, {
|
|
275009
275493
|
key: "join",
|
|
275010
|
-
value: function
|
|
275494
|
+
value: function join4(s2) {
|
|
275011
275495
|
if (this.length === 0) return "";
|
|
275012
275496
|
var p = this.head;
|
|
275013
275497
|
var ret = "" + p.data;
|
|
@@ -276829,12 +277313,12 @@ var require_stream_readable4 = __commonJS({
|
|
|
276829
277313
|
if (!state.flowing) {
|
|
276830
277314
|
debug("resume");
|
|
276831
277315
|
state.flowing = !state.readableListening;
|
|
276832
|
-
|
|
277316
|
+
resume2(this, state);
|
|
276833
277317
|
}
|
|
276834
277318
|
state.paused = false;
|
|
276835
277319
|
return this;
|
|
276836
277320
|
};
|
|
276837
|
-
function
|
|
277321
|
+
function resume2(stream, state) {
|
|
276838
277322
|
if (!state.resumeScheduled) {
|
|
276839
277323
|
state.resumeScheduled = true;
|
|
276840
277324
|
process.nextTick(resume_, stream, state);
|
|
@@ -278349,7 +278833,7 @@ var require_buffer_list4 = __commonJS({
|
|
|
278349
278833
|
}
|
|
278350
278834
|
}, {
|
|
278351
278835
|
key: "join",
|
|
278352
|
-
value: function
|
|
278836
|
+
value: function join4(s2) {
|
|
278353
278837
|
if (this.length === 0) return "";
|
|
278354
278838
|
var p = this.head;
|
|
278355
278839
|
var ret = "" + p.data;
|
|
@@ -280171,12 +280655,12 @@ var require_stream_readable5 = __commonJS({
|
|
|
280171
280655
|
if (!state.flowing) {
|
|
280172
280656
|
debug("resume");
|
|
280173
280657
|
state.flowing = !state.readableListening;
|
|
280174
|
-
|
|
280658
|
+
resume2(this, state);
|
|
280175
280659
|
}
|
|
280176
280660
|
state.paused = false;
|
|
280177
280661
|
return this;
|
|
280178
280662
|
};
|
|
280179
|
-
function
|
|
280663
|
+
function resume2(stream, state) {
|
|
280180
280664
|
if (!state.resumeScheduled) {
|
|
280181
280665
|
state.resumeScheduled = true;
|
|
280182
280666
|
process.nextTick(resume_, stream, state);
|
|
@@ -281121,7 +281605,7 @@ var require_buffer_list5 = __commonJS({
|
|
|
281121
281605
|
}
|
|
281122
281606
|
}, {
|
|
281123
281607
|
key: "join",
|
|
281124
|
-
value: function
|
|
281608
|
+
value: function join4(s2) {
|
|
281125
281609
|
if (this.length === 0) return "";
|
|
281126
281610
|
var p = this.head;
|
|
281127
281611
|
var ret = "" + p.data;
|
|
@@ -282943,12 +283427,12 @@ var require_stream_readable6 = __commonJS({
|
|
|
282943
283427
|
if (!state.flowing) {
|
|
282944
283428
|
debug("resume");
|
|
282945
283429
|
state.flowing = !state.readableListening;
|
|
282946
|
-
|
|
283430
|
+
resume2(this, state);
|
|
282947
283431
|
}
|
|
282948
283432
|
state.paused = false;
|
|
282949
283433
|
return this;
|
|
282950
283434
|
};
|
|
282951
|
-
function
|
|
283435
|
+
function resume2(stream, state) {
|
|
282952
283436
|
if (!state.resumeScheduled) {
|
|
282953
283437
|
state.resumeScheduled = true;
|
|
282954
283438
|
process.nextTick(resume_, stream, state);
|
|
@@ -284358,7 +284842,7 @@ var require_buffer_list6 = __commonJS({
|
|
|
284358
284842
|
}
|
|
284359
284843
|
}, {
|
|
284360
284844
|
key: "join",
|
|
284361
|
-
value: function
|
|
284845
|
+
value: function join4(s2) {
|
|
284362
284846
|
if (this.length === 0) return "";
|
|
284363
284847
|
var p = this.head;
|
|
284364
284848
|
var ret = "" + p.data;
|
|
@@ -286180,12 +286664,12 @@ var require_stream_readable7 = __commonJS({
|
|
|
286180
286664
|
if (!state.flowing) {
|
|
286181
286665
|
debug("resume");
|
|
286182
286666
|
state.flowing = !state.readableListening;
|
|
286183
|
-
|
|
286667
|
+
resume2(this, state);
|
|
286184
286668
|
}
|
|
286185
286669
|
state.paused = false;
|
|
286186
286670
|
return this;
|
|
286187
286671
|
};
|
|
286188
|
-
function
|
|
286672
|
+
function resume2(stream, state) {
|
|
286189
286673
|
if (!state.resumeScheduled) {
|
|
286190
286674
|
state.resumeScheduled = true;
|
|
286191
286675
|
process.nextTick(resume_, stream, state);
|
|
@@ -287306,22 +287790,22 @@ var package_exports = {};
|
|
|
287306
287790
|
__export(package_exports, {
|
|
287307
287791
|
default: () => package_default
|
|
287308
287792
|
});
|
|
287309
|
-
var import_archiver,
|
|
287793
|
+
var import_archiver, import_child_process2, import_fs3, import_rxjs30, import_operators17, import_util3, ReadFile, package_default;
|
|
287310
287794
|
var init_package = __esm({
|
|
287311
287795
|
"src/commands/lambda/package.ts"() {
|
|
287312
287796
|
import_archiver = __toESM(require_archiver());
|
|
287313
|
-
|
|
287797
|
+
import_child_process2 = require("child_process");
|
|
287314
287798
|
import_fs3 = require("fs");
|
|
287315
|
-
|
|
287799
|
+
import_rxjs30 = __toESM(require_cjs());
|
|
287316
287800
|
import_operators17 = __toESM(require_operators());
|
|
287317
287801
|
import_util3 = require("util");
|
|
287318
287802
|
init_helpers2();
|
|
287319
287803
|
init_load_spec();
|
|
287320
287804
|
init_parse_ignore();
|
|
287321
287805
|
init_read_file();
|
|
287322
|
-
ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0,
|
|
287806
|
+
ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0, import_rxjs30.of)("")));
|
|
287323
287807
|
package_default = (cmd) => {
|
|
287324
|
-
return (0,
|
|
287808
|
+
return (0, import_rxjs30.lastValueFrom)(
|
|
287325
287809
|
loadSpec(cmd.spec).pipe(
|
|
287326
287810
|
(0, import_operators17.map)((spec) => spec?.function ?? spec),
|
|
287327
287811
|
(0, import_operators17.switchMap)(async (data) => {
|
|
@@ -287329,8 +287813,8 @@ var init_package = __esm({
|
|
|
287329
287813
|
zlib: { level: 9 }
|
|
287330
287814
|
// Sets the compression level.
|
|
287331
287815
|
});
|
|
287332
|
-
await (0, import_util3.promisify)(
|
|
287333
|
-
const ignore = await (0,
|
|
287816
|
+
await (0, import_util3.promisify)(import_child_process2.exec)(["chmod", "+x", data.script].join(" "));
|
|
287817
|
+
const ignore = await (0, import_rxjs30.lastValueFrom)(
|
|
287334
287818
|
ReadFile(".gignore").pipe(
|
|
287335
287819
|
(0, import_operators17.map)((ignore2) => parseIgnoredFiles(ignore2))
|
|
287336
287820
|
)
|
|
@@ -287339,11 +287823,11 @@ var init_package = __esm({
|
|
|
287339
287823
|
ignore: [".gcache/**", ...ignore]
|
|
287340
287824
|
});
|
|
287341
287825
|
archive.finalize();
|
|
287342
|
-
return (0,
|
|
287343
|
-
(0,
|
|
287826
|
+
return (0, import_rxjs30.lastValueFrom)(
|
|
287827
|
+
(0, import_rxjs30.from)(streamToBufferPromise(archive)).pipe(
|
|
287344
287828
|
(0, import_operators17.switchMap)(
|
|
287345
|
-
(buffer) => (0,
|
|
287346
|
-
(0, import_operators17.catchError)(() => (0,
|
|
287829
|
+
(buffer) => (0, import_rxjs30.from)((0, import_util3.promisify)(import_fs3.mkdir)(".gcache")).pipe(
|
|
287830
|
+
(0, import_operators17.catchError)(() => (0, import_rxjs30.of)(true)),
|
|
287347
287831
|
(0, import_operators17.switchMap)(
|
|
287348
287832
|
() => (0, import_util3.promisify)(import_fs3.writeFile)(`.gcache/${data.name}.zip`, buffer)
|
|
287349
287833
|
)
|
|
@@ -287369,13 +287853,13 @@ function streamToBufferPromise(file2) {
|
|
|
287369
287853
|
});
|
|
287370
287854
|
});
|
|
287371
287855
|
}
|
|
287372
|
-
var import_form_data, import_fs4,
|
|
287856
|
+
var import_form_data, import_fs4, import_rxjs31, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, createCommand;
|
|
287373
287857
|
var init_helpers2 = __esm({
|
|
287374
287858
|
"src/commands/lambda/helpers/index.ts"() {
|
|
287375
287859
|
import_form_data = __toESM(require_form_data());
|
|
287376
287860
|
import_fs4 = require("fs");
|
|
287377
287861
|
init_src();
|
|
287378
|
-
|
|
287862
|
+
import_rxjs31 = __toESM(require_cjs());
|
|
287379
287863
|
import_operators18 = __toESM(require_operators());
|
|
287380
287864
|
import_stream_to_buffer = __toESM(require_stream_to_buffer());
|
|
287381
287865
|
init_helpers();
|
|
@@ -287384,14 +287868,14 @@ var init_helpers2 = __esm({
|
|
|
287384
287868
|
init_package();
|
|
287385
287869
|
init_load_spec();
|
|
287386
287870
|
init_read_file();
|
|
287387
|
-
ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0,
|
|
287388
|
-
createOrUpdateLambda = (cmd, type) => (0,
|
|
287871
|
+
ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0, import_rxjs31.of)("")));
|
|
287872
|
+
createOrUpdateLambda = (cmd, type) => (0, import_rxjs31.lastValueFrom)(
|
|
287389
287873
|
parseProjectId(cmd.project).pipe(
|
|
287390
287874
|
(0, import_operators18.switchMap)(
|
|
287391
287875
|
(projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators18.map)(() => projectId))
|
|
287392
287876
|
),
|
|
287393
287877
|
(0, import_operators18.switchMap)(async (projectId) => {
|
|
287394
|
-
const spec = await (0,
|
|
287878
|
+
const spec = await (0, import_rxjs31.lastValueFrom)(loadSpec(cmd.spec));
|
|
287395
287879
|
return {
|
|
287396
287880
|
projectId,
|
|
287397
287881
|
...spec?.function ?? spec
|
|
@@ -287406,9 +287890,9 @@ var init_helpers2 = __esm({
|
|
|
287406
287890
|
await package_default(cmd);
|
|
287407
287891
|
const body = new import_form_data.default();
|
|
287408
287892
|
body.append("file[]", (0, import_fs4.createReadStream)(`.gcache/${data.name}.zip`));
|
|
287409
|
-
const config2 = await (0,
|
|
287410
|
-
return (0,
|
|
287411
|
-
(0,
|
|
287893
|
+
const config2 = await (0, import_rxjs31.lastValueFrom)(GraphqlClienAPI.getConfig());
|
|
287894
|
+
return (0, import_rxjs31.lastValueFrom)(
|
|
287895
|
+
(0, import_rxjs31.from)(
|
|
287412
287896
|
fetch2(config2.uploadUrl, {
|
|
287413
287897
|
method: "POST",
|
|
287414
287898
|
body,
|
|
@@ -287429,23 +287913,23 @@ var init_helpers2 = __esm({
|
|
|
287429
287913
|
);
|
|
287430
287914
|
}),
|
|
287431
287915
|
(0, import_operators18.switchMap)(async (payload) => {
|
|
287432
|
-
const clusterId = await (0,
|
|
287916
|
+
const clusterId = await (0, import_rxjs31.lastValueFrom)(
|
|
287433
287917
|
resolveClusterId(payload.projectId, {
|
|
287434
287918
|
clusterId: cmd.clusterId || payload.clusterId,
|
|
287435
287919
|
clusterName: cmd.clusterName || payload.clusterName
|
|
287436
287920
|
})
|
|
287437
287921
|
);
|
|
287438
|
-
return (0,
|
|
287922
|
+
return (0, import_rxjs31.lastValueFrom)(
|
|
287439
287923
|
GraphqlClienAPI[type]({
|
|
287440
|
-
code: cmd.code || await (0,
|
|
287924
|
+
code: cmd.code || await (0, import_rxjs31.lastValueFrom)(ReadFile2(cmd.file || payload.file)) || "",
|
|
287441
287925
|
name: cmd.name || payload.name || "",
|
|
287442
287926
|
projectId: payload.projectId,
|
|
287443
287927
|
route: cmd.route || payload.route || "",
|
|
287444
|
-
buildBashScript: cmd.buildBashScript || await (0,
|
|
287928
|
+
buildBashScript: cmd.buildBashScript || await (0, import_rxjs31.lastValueFrom)(ReadFile2(cmd.script || payload.script)) || "",
|
|
287445
287929
|
configs: cmd.configs || payload.configs || [],
|
|
287446
287930
|
env: cmd.env || payload.env || "nodejs",
|
|
287447
287931
|
method: cmd.method || payload.method || ["GET"],
|
|
287448
|
-
packageJson: cmd.packageJson || await (0,
|
|
287932
|
+
packageJson: cmd.packageJson || await (0, import_rxjs31.lastValueFrom)(ReadFile2(cmd.package || payload.package)) || "{}",
|
|
287449
287933
|
params: cmd.params || payload.params || [],
|
|
287450
287934
|
secrets: cmd.secrets || payload.secrets || [],
|
|
287451
287935
|
envSecrets: cmd.envSecrets || payload.envSecrets || [],
|
|
@@ -287501,15 +287985,15 @@ var list_exports2 = {};
|
|
|
287501
287985
|
__export(list_exports2, {
|
|
287502
287986
|
default: () => list_default2
|
|
287503
287987
|
});
|
|
287504
|
-
var
|
|
287988
|
+
var import_rxjs32, import_operators19, list_default2;
|
|
287505
287989
|
var init_list2 = __esm({
|
|
287506
287990
|
"src/commands/lambda/list.ts"() {
|
|
287507
|
-
|
|
287991
|
+
import_rxjs32 = __toESM(require_cjs());
|
|
287508
287992
|
import_operators19 = __toESM(require_operators());
|
|
287509
287993
|
init_helpers();
|
|
287510
287994
|
init_gql_client();
|
|
287511
287995
|
init_log();
|
|
287512
|
-
list_default2 = (cmd) => (0,
|
|
287996
|
+
list_default2 = (cmd) => (0, import_rxjs32.lastValueFrom)(
|
|
287513
287997
|
parseProjectId(cmd.project).pipe(
|
|
287514
287998
|
(0, import_operators19.switchMap)(
|
|
287515
287999
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -287544,10 +288028,10 @@ var get_exports = {};
|
|
|
287544
288028
|
__export(get_exports, {
|
|
287545
288029
|
default: () => get_default
|
|
287546
288030
|
});
|
|
287547
|
-
var
|
|
288031
|
+
var import_rxjs33, import_operators20, get_default;
|
|
287548
288032
|
var init_get = __esm({
|
|
287549
288033
|
"src/commands/lambda/get.ts"() {
|
|
287550
|
-
|
|
288034
|
+
import_rxjs33 = __toESM(require_cjs());
|
|
287551
288035
|
import_operators20 = __toESM(require_operators());
|
|
287552
288036
|
init_helpers();
|
|
287553
288037
|
init_gql_client();
|
|
@@ -287569,26 +288053,26 @@ var init_get = __esm({
|
|
|
287569
288053
|
Logger.log("-------------------");
|
|
287570
288054
|
});
|
|
287571
288055
|
if (cmd.lambda) {
|
|
287572
|
-
return (0,
|
|
288056
|
+
return (0, import_rxjs33.lastValueFrom)(
|
|
287573
288057
|
isMongoId(cmd.lambda).pipe(
|
|
287574
288058
|
(0, import_operators20.switchMap)((id) => GraphqlClienAPI.getLambda(id)),
|
|
287575
288059
|
table
|
|
287576
288060
|
)
|
|
287577
288061
|
);
|
|
287578
288062
|
}
|
|
287579
|
-
const spec = await (0,
|
|
288063
|
+
const spec = await (0, import_rxjs33.lastValueFrom)(loadSpec(cmd.spec));
|
|
287580
288064
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
287581
288065
|
if (name2) {
|
|
287582
|
-
return (0,
|
|
288066
|
+
return (0, import_rxjs33.lastValueFrom)(
|
|
287583
288067
|
parseProjectId(cmd.project).pipe(
|
|
287584
288068
|
(0, import_operators20.catchError)((error48) => {
|
|
287585
288069
|
if (!cmd.project) {
|
|
287586
|
-
return (0,
|
|
288070
|
+
return (0, import_rxjs33.throwError)(
|
|
287587
288071
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
287588
288072
|
Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
|
|
287589
288073
|
);
|
|
287590
288074
|
}
|
|
287591
|
-
return (0,
|
|
288075
|
+
return (0, import_rxjs33.throwError)(() => error48);
|
|
287592
288076
|
}),
|
|
287593
288077
|
(0, import_operators20.switchMap)(
|
|
287594
288078
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -287645,22 +288129,22 @@ var delete_exports = {};
|
|
|
287645
288129
|
__export(delete_exports, {
|
|
287646
288130
|
default: () => delete_default
|
|
287647
288131
|
});
|
|
287648
|
-
var
|
|
288132
|
+
var import_rxjs34, import_operators21, delete_default;
|
|
287649
288133
|
var init_delete = __esm({
|
|
287650
288134
|
"src/commands/lambda/delete.ts"() {
|
|
287651
|
-
|
|
288135
|
+
import_rxjs34 = __toESM(require_cjs());
|
|
287652
288136
|
import_operators21 = __toESM(require_operators());
|
|
287653
288137
|
init_helpers();
|
|
287654
288138
|
init_gql_client();
|
|
287655
288139
|
init_log();
|
|
287656
288140
|
init_load_spec();
|
|
287657
288141
|
delete_default = async (cmd) => {
|
|
287658
|
-
const spec = await (0,
|
|
288142
|
+
const spec = await (0, import_rxjs34.lastValueFrom)(loadSpec(cmd.spec));
|
|
287659
288143
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
287660
288144
|
const env = cmd.env ?? spec.function?.env ?? spec.env;
|
|
287661
288145
|
const clusterIdHint = cmd.clusterId ?? spec.function?.clusterId ?? spec.clusterId;
|
|
287662
288146
|
const clusterNameHint = cmd.clusterName ?? spec.function?.clusterName ?? spec.clusterName;
|
|
287663
|
-
return (0,
|
|
288147
|
+
return (0, import_rxjs34.lastValueFrom)(
|
|
287664
288148
|
parseProjectId(cmd.project).pipe(
|
|
287665
288149
|
(0, import_operators21.switchMap)(
|
|
287666
288150
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -287695,10 +288179,10 @@ var logs_exports = {};
|
|
|
287695
288179
|
__export(logs_exports, {
|
|
287696
288180
|
default: () => logs_default
|
|
287697
288181
|
});
|
|
287698
|
-
var
|
|
288182
|
+
var import_rxjs35, import_operators22, logs_default;
|
|
287699
288183
|
var init_logs = __esm({
|
|
287700
288184
|
"src/commands/lambda/logs.ts"() {
|
|
287701
|
-
|
|
288185
|
+
import_rxjs35 = __toESM(require_cjs());
|
|
287702
288186
|
import_operators22 = __toESM(require_operators());
|
|
287703
288187
|
init_helpers();
|
|
287704
288188
|
init_gql_client();
|
|
@@ -287707,26 +288191,26 @@ var init_logs = __esm({
|
|
|
287707
288191
|
logs_default = async (cmd) => {
|
|
287708
288192
|
const result = (0, import_operators22.tap)(({ data }) => Logger.log(data));
|
|
287709
288193
|
if (cmd.lambda) {
|
|
287710
|
-
return (0,
|
|
288194
|
+
return (0, import_rxjs35.lastValueFrom)(
|
|
287711
288195
|
isMongoId(cmd.lambda).pipe(
|
|
287712
288196
|
(0, import_operators22.switchMap)((id) => GraphqlClienAPI.getLambdaLogs(id)),
|
|
287713
288197
|
result
|
|
287714
288198
|
)
|
|
287715
288199
|
);
|
|
287716
288200
|
}
|
|
287717
|
-
const spec = await (0,
|
|
288201
|
+
const spec = await (0, import_rxjs35.lastValueFrom)(loadSpec(cmd.spec));
|
|
287718
288202
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
287719
288203
|
if (name2) {
|
|
287720
|
-
return (0,
|
|
288204
|
+
return (0, import_rxjs35.lastValueFrom)(
|
|
287721
288205
|
parseProjectId(cmd.project).pipe(
|
|
287722
288206
|
(0, import_operators22.catchError)((error48) => {
|
|
287723
288207
|
if (!cmd.project) {
|
|
287724
|
-
return (0,
|
|
288208
|
+
return (0, import_rxjs35.throwError)(
|
|
287725
288209
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
287726
288210
|
Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
|
|
287727
288211
|
);
|
|
287728
288212
|
}
|
|
287729
|
-
return (0,
|
|
288213
|
+
return (0, import_rxjs35.throwError)(() => error48);
|
|
287730
288214
|
}),
|
|
287731
288215
|
(0, import_operators22.switchMap)(
|
|
287732
288216
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -287752,10 +288236,10 @@ var logs_builder_exports = {};
|
|
|
287752
288236
|
__export(logs_builder_exports, {
|
|
287753
288237
|
default: () => logs_builder_default
|
|
287754
288238
|
});
|
|
287755
|
-
var
|
|
288239
|
+
var import_rxjs36, import_operators23, logs_builder_default;
|
|
287756
288240
|
var init_logs_builder = __esm({
|
|
287757
288241
|
"src/commands/lambda/logs-builder.ts"() {
|
|
287758
|
-
|
|
288242
|
+
import_rxjs36 = __toESM(require_cjs());
|
|
287759
288243
|
import_operators23 = __toESM(require_operators());
|
|
287760
288244
|
init_helpers();
|
|
287761
288245
|
init_gql_client();
|
|
@@ -287764,26 +288248,26 @@ var init_logs_builder = __esm({
|
|
|
287764
288248
|
logs_builder_default = async (cmd) => {
|
|
287765
288249
|
const result = (0, import_operators23.tap)(({ data }) => Logger.log(data));
|
|
287766
288250
|
if (cmd.lambda) {
|
|
287767
|
-
return (0,
|
|
288251
|
+
return (0, import_rxjs36.lastValueFrom)(
|
|
287768
288252
|
isMongoId(cmd.lambda).pipe(
|
|
287769
288253
|
(0, import_operators23.switchMap)((id) => GraphqlClienAPI.getLambdaBuilderLogs(id)),
|
|
287770
288254
|
result
|
|
287771
288255
|
)
|
|
287772
288256
|
);
|
|
287773
288257
|
}
|
|
287774
|
-
const spec = await (0,
|
|
288258
|
+
const spec = await (0, import_rxjs36.lastValueFrom)(loadSpec(cmd.spec));
|
|
287775
288259
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
287776
288260
|
if (name2) {
|
|
287777
|
-
return (0,
|
|
288261
|
+
return (0, import_rxjs36.lastValueFrom)(
|
|
287778
288262
|
parseProjectId(cmd.project).pipe(
|
|
287779
288263
|
(0, import_operators23.catchError)((error48) => {
|
|
287780
288264
|
if (!cmd.project) {
|
|
287781
|
-
return (0,
|
|
288265
|
+
return (0, import_rxjs36.throwError)(
|
|
287782
288266
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
287783
288267
|
Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
|
|
287784
288268
|
);
|
|
287785
288269
|
}
|
|
287786
|
-
return (0,
|
|
288270
|
+
return (0, import_rxjs36.throwError)(() => error48);
|
|
287787
288271
|
}),
|
|
287788
288272
|
(0, import_operators23.switchMap)(
|
|
287789
288273
|
(projectId) => resolveClusterId(projectId, {
|
|
@@ -287813,18 +288297,18 @@ var test_exports = {};
|
|
|
287813
288297
|
__export(test_exports, {
|
|
287814
288298
|
default: () => test_default
|
|
287815
288299
|
});
|
|
287816
|
-
var
|
|
288300
|
+
var import_rxjs37, import_operators24, test_default;
|
|
287817
288301
|
var init_test = __esm({
|
|
287818
288302
|
"src/commands/lambda/test.ts"() {
|
|
287819
|
-
|
|
288303
|
+
import_rxjs37 = __toESM(require_cjs());
|
|
287820
288304
|
import_operators24 = __toESM(require_operators());
|
|
287821
288305
|
init_helpers();
|
|
287822
288306
|
init_gql_client();
|
|
287823
288307
|
init_log();
|
|
287824
288308
|
init_load_spec();
|
|
287825
288309
|
test_default = async (cmd) => {
|
|
287826
|
-
const spec = await (0,
|
|
287827
|
-
const processParameters = (lambda) => (0,
|
|
288310
|
+
const spec = await (0, import_rxjs37.lastValueFrom)(loadSpec(cmd.spec));
|
|
288311
|
+
const processParameters = (lambda) => (0, import_rxjs37.of)(lambda).pipe(
|
|
287828
288312
|
(0, import_operators24.map)((lambda2) => ({
|
|
287829
288313
|
...lambda2,
|
|
287830
288314
|
url: cmd.pathParams ? cmd.pathParams.split(";").map((param) => param.split("=")).reduce(
|
|
@@ -287838,7 +288322,7 @@ var init_test = __esm({
|
|
|
287838
288322
|
);
|
|
287839
288323
|
}),
|
|
287840
288324
|
(0, import_operators24.switchMap)(
|
|
287841
|
-
(lambda2) => (0,
|
|
288325
|
+
(lambda2) => (0, import_rxjs37.from)(
|
|
287842
288326
|
fetch([lambda2.url, cmd.queryParams].filter((i2) => !!i2).join(""), {
|
|
287843
288327
|
method: cmd?.method ?? "GET",
|
|
287844
288328
|
body: cmd.body
|
|
@@ -287854,7 +288338,7 @@ var init_test = __esm({
|
|
|
287854
288338
|
})
|
|
287855
288339
|
);
|
|
287856
288340
|
if (cmd.lambda) {
|
|
287857
|
-
return (0,
|
|
288341
|
+
return (0, import_rxjs37.lastValueFrom)(
|
|
287858
288342
|
isMongoId(cmd.lambda).pipe(
|
|
287859
288343
|
(0, import_operators24.switchMap)(
|
|
287860
288344
|
(id) => GraphqlClienAPI.getLambda(id, ["id", "url", "method", "params"])
|
|
@@ -287865,16 +288349,16 @@ var init_test = __esm({
|
|
|
287865
288349
|
}
|
|
287866
288350
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
287867
288351
|
if (name2) {
|
|
287868
|
-
return (0,
|
|
288352
|
+
return (0, import_rxjs37.lastValueFrom)(
|
|
287869
288353
|
parseProjectId(cmd.project).pipe(
|
|
287870
288354
|
(0, import_operators24.catchError)((error48) => {
|
|
287871
288355
|
if (!cmd.project) {
|
|
287872
|
-
return (0,
|
|
288356
|
+
return (0, import_rxjs37.throwError)(
|
|
287873
288357
|
() => `No project id try with "gcli use --project your-project-id" to specify one
|
|
287874
288358
|
Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
|
|
287875
288359
|
);
|
|
287876
288360
|
}
|
|
287877
|
-
return (0,
|
|
288361
|
+
return (0, import_rxjs37.throwError)(() => error48);
|
|
287878
288362
|
}),
|
|
287879
288363
|
(0, import_operators24.switchMap)(
|
|
287880
288364
|
(projectId) => GraphqlClienAPI.getLambdaByName(name2, projectId, [
|
|
@@ -287898,14 +288382,14 @@ var list_exports3 = {};
|
|
|
287898
288382
|
__export(list_exports3, {
|
|
287899
288383
|
default: () => list_default3
|
|
287900
288384
|
});
|
|
287901
|
-
var
|
|
288385
|
+
var import_rxjs38, import_operators25, list_default3;
|
|
287902
288386
|
var init_list3 = __esm({
|
|
287903
288387
|
"src/commands/plugin/list.ts"() {
|
|
287904
|
-
|
|
288388
|
+
import_rxjs38 = __toESM(require_cjs());
|
|
287905
288389
|
import_operators25 = __toESM(require_operators());
|
|
287906
288390
|
init_gql_client();
|
|
287907
288391
|
init_log();
|
|
287908
|
-
list_default3 = () => (0,
|
|
288392
|
+
list_default3 = () => (0, import_rxjs38.lastValueFrom)(
|
|
287909
288393
|
GraphqlClienAPI.listAvailablePlugins().pipe(
|
|
287910
288394
|
(0, import_operators25.tap)((plugins) => {
|
|
287911
288395
|
Logger.log("-------------------");
|
|
@@ -287930,15 +288414,15 @@ var installed_exports = {};
|
|
|
287930
288414
|
__export(installed_exports, {
|
|
287931
288415
|
default: () => installed_default
|
|
287932
288416
|
});
|
|
287933
|
-
var
|
|
288417
|
+
var import_rxjs39, import_operators26, installed_default;
|
|
287934
288418
|
var init_installed = __esm({
|
|
287935
288419
|
"src/commands/plugin/installed.ts"() {
|
|
287936
|
-
|
|
288420
|
+
import_rxjs39 = __toESM(require_cjs());
|
|
287937
288421
|
import_operators26 = __toESM(require_operators());
|
|
287938
288422
|
init_helpers();
|
|
287939
288423
|
init_gql_client();
|
|
287940
288424
|
init_log();
|
|
287941
|
-
installed_default = (cmd) => (0,
|
|
288425
|
+
installed_default = (cmd) => (0, import_rxjs39.lastValueFrom)(
|
|
287942
288426
|
parseProjectId(cmd.project).pipe(
|
|
287943
288427
|
(0, import_operators26.switchMap)((projectId) => GraphqlClienAPI.listInstalledPlugins(projectId)),
|
|
287944
288428
|
(0, import_operators26.tap)((installed) => {
|
|
@@ -287969,16 +288453,16 @@ var install_exports = {};
|
|
|
287969
288453
|
__export(install_exports, {
|
|
287970
288454
|
default: () => install_default
|
|
287971
288455
|
});
|
|
287972
|
-
var
|
|
288456
|
+
var import_rxjs40, import_operators27, install_default;
|
|
287973
288457
|
var init_install = __esm({
|
|
287974
288458
|
"src/commands/plugin/install.ts"() {
|
|
287975
|
-
|
|
288459
|
+
import_rxjs40 = __toESM(require_cjs());
|
|
287976
288460
|
import_operators27 = __toESM(require_operators());
|
|
287977
288461
|
init_helpers();
|
|
287978
288462
|
init_gql_client();
|
|
287979
288463
|
init_log();
|
|
287980
288464
|
init_load_spec();
|
|
287981
|
-
install_default = (cmd) => (0,
|
|
288465
|
+
install_default = (cmd) => (0, import_rxjs40.lastValueFrom)(
|
|
287982
288466
|
parseProjectId(cmd.project).pipe(
|
|
287983
288467
|
(0, import_operators27.switchMap)(
|
|
287984
288468
|
(projectId) => loadSpec(
|
|
@@ -287987,7 +288471,7 @@ var init_install = __esm({
|
|
|
287987
288471
|
// No spec file is required at all if --name/--cluster fully
|
|
287988
288472
|
// cover it (unlike every other resource here, a plugin install
|
|
287989
288473
|
// is often just "install this by name", no YAML needed).
|
|
287990
|
-
(0, import_operators27.catchError)(() => (0,
|
|
288474
|
+
(0, import_operators27.catchError)(() => (0, import_rxjs40.of)(void 0)),
|
|
287991
288475
|
(0, import_operators27.map)((data) => ({
|
|
287992
288476
|
projectId,
|
|
287993
288477
|
...data ? data.plugin ?? data : {}
|
|
@@ -288018,15 +288502,15 @@ var uninstall_exports = {};
|
|
|
288018
288502
|
__export(uninstall_exports, {
|
|
288019
288503
|
default: () => uninstall_default
|
|
288020
288504
|
});
|
|
288021
|
-
var
|
|
288505
|
+
var import_rxjs41, import_operators28, uninstall_default;
|
|
288022
288506
|
var init_uninstall = __esm({
|
|
288023
288507
|
"src/commands/plugin/uninstall.ts"() {
|
|
288024
|
-
|
|
288508
|
+
import_rxjs41 = __toESM(require_cjs());
|
|
288025
288509
|
import_operators28 = __toESM(require_operators());
|
|
288026
288510
|
init_helpers();
|
|
288027
288511
|
init_gql_client();
|
|
288028
288512
|
init_log();
|
|
288029
|
-
uninstall_default = (cmd) => (0,
|
|
288513
|
+
uninstall_default = (cmd) => (0, import_rxjs41.lastValueFrom)(
|
|
288030
288514
|
parseProjectId(cmd.project).pipe(
|
|
288031
288515
|
(0, import_operators28.switchMap)(
|
|
288032
288516
|
(projectId) => GraphqlClienAPI.uninstallPlugin(projectId, cmd.name, cmd.cluster)
|
|
@@ -288046,14 +288530,14 @@ var list_exports4 = {};
|
|
|
288046
288530
|
__export(list_exports4, {
|
|
288047
288531
|
default: () => list_default4
|
|
288048
288532
|
});
|
|
288049
|
-
var
|
|
288533
|
+
var import_rxjs42, import_operators29, list_default4;
|
|
288050
288534
|
var init_list4 = __esm({
|
|
288051
288535
|
"src/commands/project/list.ts"() {
|
|
288052
|
-
|
|
288536
|
+
import_rxjs42 = __toESM(require_cjs());
|
|
288053
288537
|
import_operators29 = __toESM(require_operators());
|
|
288054
288538
|
init_gql_client();
|
|
288055
288539
|
init_log();
|
|
288056
|
-
list_default4 = async () => (0,
|
|
288540
|
+
list_default4 = async () => (0, import_rxjs42.lastValueFrom)(
|
|
288057
288541
|
GraphqlClienAPI.listProjects().pipe(
|
|
288058
288542
|
(0, import_operators29.tap)((project) => {
|
|
288059
288543
|
const columns = ["id", "name"];
|
|
@@ -288072,24 +288556,24 @@ var use_exports = {};
|
|
|
288072
288556
|
__export(use_exports, {
|
|
288073
288557
|
default: () => use_default
|
|
288074
288558
|
});
|
|
288075
|
-
var import_fs5,
|
|
288559
|
+
var import_fs5, import_rxjs43, import_operators30, import_util4, use_default;
|
|
288076
288560
|
var init_use = __esm({
|
|
288077
288561
|
"src/commands/project/use.ts"() {
|
|
288078
288562
|
import_fs5 = require("fs");
|
|
288079
|
-
|
|
288563
|
+
import_rxjs43 = __toESM(require_cjs());
|
|
288080
288564
|
import_operators30 = __toESM(require_operators());
|
|
288081
288565
|
import_util4 = require("util");
|
|
288082
288566
|
init_helpers();
|
|
288083
288567
|
init_gql_client();
|
|
288084
288568
|
init_types();
|
|
288085
288569
|
use_default = async (cmd) => {
|
|
288086
|
-
return (0,
|
|
288570
|
+
return (0, import_rxjs43.lastValueFrom)(
|
|
288087
288571
|
parseProjectId(cmd).pipe(
|
|
288088
288572
|
(0, import_operators30.switchMap)(
|
|
288089
288573
|
(projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators30.map)(() => projectId))
|
|
288090
288574
|
),
|
|
288091
288575
|
(0, import_operators30.switchMap)(
|
|
288092
|
-
(projectId) => (0,
|
|
288576
|
+
(projectId) => (0, import_rxjs43.from)(
|
|
288093
288577
|
(0, import_util4.promisify)(import_fs5.writeFile)(projectDirectory, projectId, {
|
|
288094
288578
|
encoding: "utf-8"
|
|
288095
288579
|
})
|
|
@@ -318926,7 +319410,7 @@ __export(start_exports, {
|
|
|
318926
319410
|
default: () => startProxy
|
|
318927
319411
|
});
|
|
318928
319412
|
async function startProxy(cmd) {
|
|
318929
|
-
return (0,
|
|
319413
|
+
return (0, import_rxjs44.lastValueFrom)(
|
|
318930
319414
|
GraphqlClienAPI.getConfig().pipe(
|
|
318931
319415
|
(0, import_operators31.take)(1),
|
|
318932
319416
|
(0, import_operators31.map)((config2) => ({
|
|
@@ -318942,7 +319426,7 @@ async function startProxy(cmd) {
|
|
|
318942
319426
|
process.stderr.write("Retrieving config for auth...\n");
|
|
318943
319427
|
}),
|
|
318944
319428
|
(0, import_operators31.switchMap)(
|
|
318945
|
-
(config2) => config2?.token ? (0,
|
|
319429
|
+
(config2) => config2?.token ? (0, import_rxjs44.of)(config2) : (0, import_rxjs44.throwError)(
|
|
318946
319430
|
() => new Error("User is not authenticated (no token in config)")
|
|
318947
319431
|
)
|
|
318948
319432
|
),
|
|
@@ -318960,7 +319444,7 @@ async function startProxy(cmd) {
|
|
|
318960
319444
|
Authorization: config2.token
|
|
318961
319445
|
}
|
|
318962
319446
|
},
|
|
318963
|
-
fetch: (input, init) => (0,
|
|
319447
|
+
fetch: (input, init) => (0, import_rxjs44.lastValueFrom)(performFetch(input, init))
|
|
318964
319448
|
}),
|
|
318965
319449
|
client: new Client({
|
|
318966
319450
|
name: "gapi-proxy-client",
|
|
@@ -318971,7 +319455,7 @@ async function startProxy(cmd) {
|
|
|
318971
319455
|
process.stderr.write("Connecting to upstream...\n");
|
|
318972
319456
|
}),
|
|
318973
319457
|
(0, import_operators31.switchMap)(
|
|
318974
|
-
(config2) => (0,
|
|
319458
|
+
(config2) => (0, import_rxjs44.from)(config2.client.connect(config2.transport)).pipe((0, import_operators31.map)(() => config2))
|
|
318975
319459
|
),
|
|
318976
319460
|
(0, import_operators31.tap)(() => {
|
|
318977
319461
|
process.stderr.write("Connected to upstream MCP server\n");
|
|
@@ -318997,25 +319481,25 @@ async function startProxy(cmd) {
|
|
|
318997
319481
|
capabilities: config2.capabilities || {}
|
|
318998
319482
|
}
|
|
318999
319483
|
);
|
|
319000
|
-
server2.fallbackRequestHandler = async (request) => (0,
|
|
319001
|
-
(0,
|
|
319484
|
+
server2.fallbackRequestHandler = async (request) => (0, import_rxjs44.lastValueFrom)(
|
|
319485
|
+
(0, import_rxjs44.defer)(() => config2.client.request(request, external_exports3.any())).pipe(
|
|
319002
319486
|
(0, import_operators31.catchError)((e2) => {
|
|
319003
319487
|
process.stderr.write(`Upstream error: ${e2.message}
|
|
319004
319488
|
`);
|
|
319005
|
-
return (0,
|
|
319489
|
+
return (0, import_rxjs44.throwError)(() => e2);
|
|
319006
319490
|
})
|
|
319007
319491
|
)
|
|
319008
319492
|
);
|
|
319009
319493
|
server2.fallbackNotificationHandler = async (notification) => {
|
|
319010
|
-
await (0,
|
|
319011
|
-
(0,
|
|
319494
|
+
await (0, import_rxjs44.lastValueFrom)(
|
|
319495
|
+
(0, import_rxjs44.of)(notification).pipe(
|
|
319012
319496
|
(0, import_operators31.filter)((n) => n.method !== "notifications/initialized"),
|
|
319013
319497
|
(0, import_operators31.switchMap)(
|
|
319014
|
-
(n) => (0,
|
|
319498
|
+
(n) => (0, import_rxjs44.defer)(() => config2.client.notification(n)).pipe(
|
|
319015
319499
|
(0, import_operators31.catchError)((e2) => {
|
|
319016
319500
|
process.stderr.write(`Notification error: ${e2}
|
|
319017
319501
|
`);
|
|
319018
|
-
return
|
|
319502
|
+
return import_rxjs44.EMPTY;
|
|
319019
319503
|
})
|
|
319020
319504
|
)
|
|
319021
319505
|
),
|
|
@@ -319025,7 +319509,7 @@ async function startProxy(cmd) {
|
|
|
319025
319509
|
};
|
|
319026
319510
|
return server2;
|
|
319027
319511
|
}),
|
|
319028
|
-
(0, import_operators31.switchMap)((server2) => (0,
|
|
319512
|
+
(0, import_operators31.switchMap)((server2) => (0, import_rxjs44.from)(server2.connect(new StdioServerTransport()))),
|
|
319029
319513
|
(0, import_operators31.tap)(() => {
|
|
319030
319514
|
process.stderr.write("MCP stdio server ready\n");
|
|
319031
319515
|
}),
|
|
@@ -319035,20 +319519,20 @@ async function startProxy(cmd) {
|
|
|
319035
319519
|
)
|
|
319036
319520
|
);
|
|
319037
319521
|
}
|
|
319038
|
-
var
|
|
319522
|
+
var import_rxjs44, import_operators31, import_stream2, performFetch;
|
|
319039
319523
|
var init_start = __esm({
|
|
319040
319524
|
"src/commands/proxy/start.ts"() {
|
|
319041
319525
|
init_client2();
|
|
319042
319526
|
init_streamableHttp();
|
|
319043
319527
|
init_server2();
|
|
319044
319528
|
init_stdio2();
|
|
319045
|
-
|
|
319529
|
+
import_rxjs44 = __toESM(require_cjs());
|
|
319046
319530
|
import_operators31 = __toESM(require_operators());
|
|
319047
319531
|
import_stream2 = require("stream");
|
|
319048
319532
|
init_zod();
|
|
319049
319533
|
init_gql_client();
|
|
319050
319534
|
performFetch = (input, init) => {
|
|
319051
|
-
return (0,
|
|
319535
|
+
return (0, import_rxjs44.from)(fetch(input, init)).pipe(
|
|
319052
319536
|
(0, import_operators31.switchMap)((res) => {
|
|
319053
319537
|
if (res.status === 401 || res.status === 403) {
|
|
319054
319538
|
process.stderr.write(
|
|
@@ -319070,7 +319554,7 @@ var init_start = __esm({
|
|
|
319070
319554
|
})
|
|
319071
319555
|
);
|
|
319072
319556
|
}
|
|
319073
|
-
return (0,
|
|
319557
|
+
return (0, import_rxjs44.of)(res);
|
|
319074
319558
|
}),
|
|
319075
319559
|
(0, import_operators31.map)((res) => {
|
|
319076
319560
|
if (typeof res?.body?.pipeThrough !== "function") {
|
|
@@ -319089,7 +319573,7 @@ var init_start = __esm({
|
|
|
319089
319573
|
(0, import_operators31.catchError)((e2) => {
|
|
319090
319574
|
process.stderr.write(`[ERROR] Fetch error: ${e2.message}
|
|
319091
319575
|
`);
|
|
319092
|
-
return (0,
|
|
319576
|
+
return (0, import_rxjs44.throwError)(() => e2);
|
|
319093
319577
|
})
|
|
319094
319578
|
);
|
|
319095
319579
|
};
|
|
@@ -319101,16 +319585,16 @@ var create_exports3 = {};
|
|
|
319101
319585
|
__export(create_exports3, {
|
|
319102
319586
|
default: () => create_default3
|
|
319103
319587
|
});
|
|
319104
|
-
var
|
|
319588
|
+
var import_rxjs45, import_operators32, create_default3;
|
|
319105
319589
|
var init_create3 = __esm({
|
|
319106
319590
|
"src/commands/rabbitmq/create.ts"() {
|
|
319107
|
-
|
|
319591
|
+
import_rxjs45 = __toESM(require_cjs());
|
|
319108
319592
|
import_operators32 = __toESM(require_operators());
|
|
319109
319593
|
init_helpers();
|
|
319110
319594
|
init_gql_client();
|
|
319111
319595
|
init_log();
|
|
319112
319596
|
init_load_spec();
|
|
319113
|
-
create_default3 = (cmd) => (0,
|
|
319597
|
+
create_default3 = (cmd) => (0, import_rxjs45.lastValueFrom)(
|
|
319114
319598
|
parseProjectId(cmd.project).pipe(
|
|
319115
319599
|
(0, import_operators32.switchMap)(
|
|
319116
319600
|
(projectId) => loadSpec(
|
|
@@ -319149,15 +319633,15 @@ var list_exports5 = {};
|
|
|
319149
319633
|
__export(list_exports5, {
|
|
319150
319634
|
default: () => list_default5
|
|
319151
319635
|
});
|
|
319152
|
-
var
|
|
319636
|
+
var import_rxjs46, import_operators33, list_default5;
|
|
319153
319637
|
var init_list5 = __esm({
|
|
319154
319638
|
"src/commands/rabbitmq/list.ts"() {
|
|
319155
|
-
|
|
319639
|
+
import_rxjs46 = __toESM(require_cjs());
|
|
319156
319640
|
import_operators33 = __toESM(require_operators());
|
|
319157
319641
|
init_helpers();
|
|
319158
319642
|
init_gql_client();
|
|
319159
319643
|
init_log();
|
|
319160
|
-
list_default5 = (cmd) => (0,
|
|
319644
|
+
list_default5 = (cmd) => (0, import_rxjs46.lastValueFrom)(
|
|
319161
319645
|
parseProjectId(cmd.project).pipe(
|
|
319162
319646
|
(0, import_operators33.switchMap)(
|
|
319163
319647
|
(projectId) => GraphqlClienAPI.listRabbitMqInstances(projectId)
|
|
@@ -319192,15 +319676,15 @@ var delete_exports2 = {};
|
|
|
319192
319676
|
__export(delete_exports2, {
|
|
319193
319677
|
default: () => delete_default2
|
|
319194
319678
|
});
|
|
319195
|
-
var
|
|
319679
|
+
var import_rxjs47, import_operators34, delete_default2;
|
|
319196
319680
|
var init_delete2 = __esm({
|
|
319197
319681
|
"src/commands/rabbitmq/delete.ts"() {
|
|
319198
|
-
|
|
319682
|
+
import_rxjs47 = __toESM(require_cjs());
|
|
319199
319683
|
import_operators34 = __toESM(require_operators());
|
|
319200
319684
|
init_helpers();
|
|
319201
319685
|
init_gql_client();
|
|
319202
319686
|
init_log();
|
|
319203
|
-
delete_default2 = (cmd) => (0,
|
|
319687
|
+
delete_default2 = (cmd) => (0, import_rxjs47.lastValueFrom)(
|
|
319204
319688
|
parseProjectId(cmd.project).pipe(
|
|
319205
319689
|
(0, import_operators34.switchMap)(
|
|
319206
319690
|
(projectId) => GraphqlClienAPI.uninstallRabbitMq(cmd.id, projectId)
|
|
@@ -319217,10 +319701,10 @@ var init_delete2 = __esm({
|
|
|
319217
319701
|
});
|
|
319218
319702
|
|
|
319219
319703
|
// src/commands/runner/config.ts
|
|
319220
|
-
var
|
|
319704
|
+
var import_promises2, DEFAULT_WS_URL, deriveSubscriptionsUrl, readLoginApiUrl, readSavedRunner, saveRunner, forgetRunner;
|
|
319221
319705
|
var init_config = __esm({
|
|
319222
319706
|
"src/commands/runner/config.ts"() {
|
|
319223
|
-
|
|
319707
|
+
import_promises2 = require("fs/promises");
|
|
319224
319708
|
init_types();
|
|
319225
319709
|
DEFAULT_WS_URL = "wss://api.lambforge.com/subscriptions";
|
|
319226
319710
|
deriveSubscriptionsUrl = (apiUrl) => {
|
|
@@ -319236,21 +319720,21 @@ var init_config = __esm({
|
|
|
319236
319720
|
url2.search = "";
|
|
319237
319721
|
return url2.toString();
|
|
319238
319722
|
};
|
|
319239
|
-
readLoginApiUrl = () => (0,
|
|
319723
|
+
readLoginApiUrl = () => (0, import_promises2.readFile)(urlDirectory, "utf-8").catch(() => "");
|
|
319240
319724
|
readSavedRunner = async () => {
|
|
319241
319725
|
try {
|
|
319242
|
-
const saved = JSON.parse(await (0,
|
|
319726
|
+
const saved = JSON.parse(await (0, import_promises2.readFile)(runnerDirectory, "utf-8"));
|
|
319243
319727
|
return saved?.id && saved?.token ? saved : null;
|
|
319244
319728
|
} catch {
|
|
319245
319729
|
return null;
|
|
319246
319730
|
}
|
|
319247
319731
|
};
|
|
319248
319732
|
saveRunner = async (runner) => {
|
|
319249
|
-
await (0,
|
|
319250
|
-
await (0,
|
|
319251
|
-
await (0,
|
|
319733
|
+
await (0, import_promises2.mkdir)(mainDirectory, { recursive: true });
|
|
319734
|
+
await (0, import_promises2.writeFile)(runnerDirectory, JSON.stringify(runner, null, 2), "utf-8");
|
|
319735
|
+
await (0, import_promises2.chmod)(runnerDirectory, 384);
|
|
319252
319736
|
};
|
|
319253
|
-
forgetRunner = () => (0,
|
|
319737
|
+
forgetRunner = () => (0, import_promises2.rm)(runnerDirectory, { force: true });
|
|
319254
319738
|
}
|
|
319255
319739
|
});
|
|
319256
319740
|
|
|
@@ -319772,19 +320256,19 @@ var init_connection = __esm({
|
|
|
319772
320256
|
});
|
|
319773
320257
|
|
|
319774
320258
|
// src/commands/runner/daemon.ts
|
|
319775
|
-
var
|
|
320259
|
+
var import_child_process3, import_fs7, import_promises3, import_os3, import_path2, import_util11, DEFAULT_SERVICE_NAME, RUNNER_AUTH_EXIT_CODE, systemdQuote, unitPath, buildUnit, resolveGcliCommand, defaultExec, SystemdUserService, assertSystemdAvailable;
|
|
319776
320260
|
var init_daemon = __esm({
|
|
319777
320261
|
"src/commands/runner/daemon.ts"() {
|
|
319778
|
-
|
|
320262
|
+
import_child_process3 = require("child_process");
|
|
319779
320263
|
import_fs7 = require("fs");
|
|
319780
|
-
|
|
319781
|
-
|
|
319782
|
-
|
|
320264
|
+
import_promises3 = require("fs/promises");
|
|
320265
|
+
import_os3 = require("os");
|
|
320266
|
+
import_path2 = require("path");
|
|
319783
320267
|
import_util11 = require("util");
|
|
319784
320268
|
DEFAULT_SERVICE_NAME = "lambforge-runner";
|
|
319785
320269
|
RUNNER_AUTH_EXIT_CODE = 78;
|
|
319786
320270
|
systemdQuote = (word) => /^[A-Za-z0-9_@%+=:,./-]+$/.test(word) ? word : `"${word.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
319787
|
-
unitPath = (serviceName, home = (0,
|
|
320271
|
+
unitPath = (serviceName, home = (0, import_os3.homedir)()) => (0, import_path2.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
|
|
319788
320272
|
buildUnit = ({
|
|
319789
320273
|
serviceName,
|
|
319790
320274
|
execStart,
|
|
@@ -319832,9 +320316,9 @@ var init_daemon = __esm({
|
|
|
319832
320316
|
warning: ephemeral ? `gcli is running from the npx cache (${script}), which npm may clean up and break the service. Install it globally first: npm i -g @gapi/gcli, then re-run this command with \`gcli\`.` : void 0
|
|
319833
320317
|
};
|
|
319834
320318
|
};
|
|
319835
|
-
defaultExec = (file2, args) => (0, import_util11.promisify)(
|
|
320319
|
+
defaultExec = (file2, args) => (0, import_util11.promisify)(import_child_process3.execFile)(file2, args, { encoding: "utf8" });
|
|
319836
320320
|
SystemdUserService = class {
|
|
319837
|
-
constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0,
|
|
320321
|
+
constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0, import_os3.homedir)()) {
|
|
319838
320322
|
this.serviceName = serviceName;
|
|
319839
320323
|
this.exec = exec2;
|
|
319840
320324
|
this.home = home;
|
|
@@ -319845,8 +320329,8 @@ var init_daemon = __esm({
|
|
|
319845
320329
|
/** install -> daemon-reload -> enable -> restart (picks up a changed unit). */
|
|
319846
320330
|
async install(unitContent) {
|
|
319847
320331
|
const path2 = unitPath(this.serviceName, this.home);
|
|
319848
|
-
await (0,
|
|
319849
|
-
await (0,
|
|
320332
|
+
await (0, import_promises3.mkdir)((0, import_path2.join)(path2, ".."), { recursive: true });
|
|
320333
|
+
await (0, import_promises3.writeFile)(path2, unitContent, "utf-8");
|
|
319850
320334
|
await this.systemctl("daemon-reload");
|
|
319851
320335
|
await this.systemctl("enable", this.unit);
|
|
319852
320336
|
await this.systemctl("restart", this.unit);
|
|
@@ -319855,7 +320339,7 @@ var init_daemon = __esm({
|
|
|
319855
320339
|
async uninstall() {
|
|
319856
320340
|
await this.systemctl("disable", "--now", this.unit).catch(() => void 0);
|
|
319857
320341
|
const path2 = unitPath(this.serviceName, this.home);
|
|
319858
|
-
await (0,
|
|
320342
|
+
await (0, import_promises3.rm)(path2, { force: true });
|
|
319859
320343
|
await this.systemctl("daemon-reload");
|
|
319860
320344
|
return path2;
|
|
319861
320345
|
}
|
|
@@ -319925,11 +320409,11 @@ __export(start_exports2, {
|
|
|
319925
320409
|
default: () => start_default,
|
|
319926
320410
|
resolveRunner: () => resolveRunner
|
|
319927
320411
|
});
|
|
319928
|
-
var
|
|
320412
|
+
var import_os4, import_rxjs48, RUNNER_VERSION, resolveRunner, start_default;
|
|
319929
320413
|
var init_start2 = __esm({
|
|
319930
320414
|
"src/commands/runner/start.ts"() {
|
|
319931
|
-
|
|
319932
|
-
|
|
320415
|
+
import_os4 = require("os");
|
|
320416
|
+
import_rxjs48 = __toESM(require_cjs());
|
|
319933
320417
|
init_gql_client();
|
|
319934
320418
|
init_log();
|
|
319935
320419
|
init_config();
|
|
@@ -319948,9 +320432,9 @@ var init_start2 = __esm({
|
|
|
319948
320432
|
if (saved) {
|
|
319949
320433
|
return saved;
|
|
319950
320434
|
}
|
|
319951
|
-
const name2 = cmd.name || (0,
|
|
320435
|
+
const name2 = cmd.name || (0, import_os4.hostname)();
|
|
319952
320436
|
Logger.info(`Registering this machine as local runner "${name2}"...`);
|
|
319953
|
-
const { runner, token } = await (0,
|
|
320437
|
+
const { runner, token } = await (0, import_rxjs48.lastValueFrom)(
|
|
319954
320438
|
GraphqlClienAPI.createLocalRunner(name2)
|
|
319955
320439
|
).catch((e2) => {
|
|
319956
320440
|
throw new Error(
|
|
@@ -320011,10 +320495,10 @@ __export(daemon_commands_exports, {
|
|
|
320011
320495
|
stop: () => stop,
|
|
320012
320496
|
uninstall: () => uninstall
|
|
320013
320497
|
});
|
|
320014
|
-
var
|
|
320498
|
+
var import_child_process4, install, uninstall, installedService, reportStarted, start, restart, stop, status, logs;
|
|
320015
320499
|
var init_daemon_commands = __esm({
|
|
320016
320500
|
"src/commands/runner/daemon-commands.ts"() {
|
|
320017
|
-
|
|
320501
|
+
import_child_process4 = require("child_process");
|
|
320018
320502
|
init_log();
|
|
320019
320503
|
init_config();
|
|
320020
320504
|
init_daemon();
|
|
@@ -320130,7 +320614,7 @@ var init_daemon_commands = __esm({
|
|
|
320130
320614
|
assertSystemdAvailable();
|
|
320131
320615
|
const serviceName = cmd.service || DEFAULT_SERVICE_NAME;
|
|
320132
320616
|
return new Promise((resolve2) => {
|
|
320133
|
-
(0,
|
|
320617
|
+
(0, import_child_process4.spawn)(
|
|
320134
320618
|
"journalctl",
|
|
320135
320619
|
["--user", "-u", `${serviceName}.service`, "-f", "-n", cmd.lines || "50"],
|
|
320136
320620
|
{ stdio: "inherit" }
|
|
@@ -320145,14 +320629,14 @@ var list_exports6 = {};
|
|
|
320145
320629
|
__export(list_exports6, {
|
|
320146
320630
|
default: () => list_default6
|
|
320147
320631
|
});
|
|
320148
|
-
var
|
|
320632
|
+
var import_rxjs49, import_operators35, list_default6;
|
|
320149
320633
|
var init_list6 = __esm({
|
|
320150
320634
|
"src/commands/runner/list.ts"() {
|
|
320151
|
-
|
|
320635
|
+
import_rxjs49 = __toESM(require_cjs());
|
|
320152
320636
|
import_operators35 = __toESM(require_operators());
|
|
320153
320637
|
init_gql_client();
|
|
320154
320638
|
init_log();
|
|
320155
|
-
list_default6 = () => (0,
|
|
320639
|
+
list_default6 = () => (0, import_rxjs49.lastValueFrom)(
|
|
320156
320640
|
GraphqlClienAPI.listLocalRunners().pipe(
|
|
320157
320641
|
(0, import_operators35.tap)((runners) => {
|
|
320158
320642
|
Logger.log("-------------------");
|
|
@@ -320185,10 +320669,10 @@ __export(models_exports, {
|
|
|
320185
320669
|
default: () => models_default,
|
|
320186
320670
|
parseSelection: () => parseSelection
|
|
320187
320671
|
});
|
|
320188
|
-
var
|
|
320672
|
+
var import_rxjs50, isShown, parseSelection, models_default;
|
|
320189
320673
|
var init_models = __esm({
|
|
320190
320674
|
"src/commands/runner/models.ts"() {
|
|
320191
|
-
|
|
320675
|
+
import_rxjs50 = __toESM(require_cjs());
|
|
320192
320676
|
init_gql_client();
|
|
320193
320677
|
init_log();
|
|
320194
320678
|
init_config();
|
|
@@ -320218,11 +320702,11 @@ var init_models = __esm({
|
|
|
320218
320702
|
}
|
|
320219
320703
|
let runner;
|
|
320220
320704
|
if (selection) {
|
|
320221
|
-
runner = await (0,
|
|
320705
|
+
runner = await (0, import_rxjs50.lastValueFrom)(
|
|
320222
320706
|
GraphqlClienAPI.setLocalRunnerModels(runnerId, selection.models)
|
|
320223
320707
|
);
|
|
320224
320708
|
} else {
|
|
320225
|
-
const runners = await (0,
|
|
320709
|
+
const runners = await (0, import_rxjs50.lastValueFrom)(GraphqlClienAPI.listLocalRunners());
|
|
320226
320710
|
runner = runners.find((r2) => r2.id === runnerId);
|
|
320227
320711
|
}
|
|
320228
320712
|
if (!runner) {
|
|
@@ -320257,10 +320741,10 @@ var delete_exports3 = {};
|
|
|
320257
320741
|
__export(delete_exports3, {
|
|
320258
320742
|
default: () => delete_default3
|
|
320259
320743
|
});
|
|
320260
|
-
var
|
|
320744
|
+
var import_rxjs51, delete_default3;
|
|
320261
320745
|
var init_delete3 = __esm({
|
|
320262
320746
|
"src/commands/runner/delete.ts"() {
|
|
320263
|
-
|
|
320747
|
+
import_rxjs51 = __toESM(require_cjs());
|
|
320264
320748
|
init_gql_client();
|
|
320265
320749
|
init_log();
|
|
320266
320750
|
init_config();
|
|
@@ -320270,7 +320754,7 @@ var init_delete3 = __esm({
|
|
|
320270
320754
|
if (!runnerId) {
|
|
320271
320755
|
throw new Error("Specify the runner with --id (see `gcli runner:list`).");
|
|
320272
320756
|
}
|
|
320273
|
-
await (0,
|
|
320757
|
+
await (0, import_rxjs51.lastValueFrom)(GraphqlClienAPI.deleteLocalRunner(runnerId));
|
|
320274
320758
|
if (saved?.id === runnerId) {
|
|
320275
320759
|
await forgetRunner();
|
|
320276
320760
|
}
|
|
@@ -320286,10 +320770,10 @@ __export(start_exports3, {
|
|
|
320286
320770
|
});
|
|
320287
320771
|
async function start2(args) {
|
|
320288
320772
|
Logger.log("---------------------------------");
|
|
320289
|
-
return (0,
|
|
320773
|
+
return (0, import_rxjs52.lastValueFrom)(
|
|
320290
320774
|
loadSpec().pipe(
|
|
320291
320775
|
(0, import_operators36.switchMap)(
|
|
320292
|
-
(config2) => (0,
|
|
320776
|
+
(config2) => (0, import_rxjs52.of)({
|
|
320293
320777
|
watcher: (0, import_node_fs2.watch)(process.cwd(), {
|
|
320294
320778
|
recursive: true
|
|
320295
320779
|
}),
|
|
@@ -320318,7 +320802,7 @@ async function start2(args) {
|
|
|
320318
320802
|
outfile,
|
|
320319
320803
|
startCommand,
|
|
320320
320804
|
ignorelist
|
|
320321
|
-
}) => (0,
|
|
320805
|
+
}) => (0, import_rxjs52.from)(build_default(args)).pipe(
|
|
320322
320806
|
(0, import_operators36.tap)(() => {
|
|
320323
320807
|
Logger.warn(
|
|
320324
320808
|
`\u{1F4E2} Starting script "${startCommand} ${outfile}"`
|
|
@@ -320336,10 +320820,10 @@ async function start2(args) {
|
|
|
320336
320820
|
);
|
|
320337
320821
|
}),
|
|
320338
320822
|
(0, import_operators36.tap)(
|
|
320339
|
-
() => (0,
|
|
320340
|
-
(0,
|
|
320341
|
-
(0,
|
|
320342
|
-
(0,
|
|
320823
|
+
() => (0, import_rxjs52.merge)(
|
|
320824
|
+
(0, import_rxjs52.fromEvent)(process, "SIGINT"),
|
|
320825
|
+
(0, import_rxjs52.fromEvent)(process, "SIGTERM"),
|
|
320826
|
+
(0, import_rxjs52.fromEvent)(process, "exit")
|
|
320343
320827
|
).pipe(
|
|
320344
320828
|
(0, import_operators36.debounceTime)(100),
|
|
320345
320829
|
(0, import_operators36.tap)(() => {
|
|
@@ -320351,7 +320835,7 @@ async function start2(args) {
|
|
|
320351
320835
|
).subscribe()
|
|
320352
320836
|
),
|
|
320353
320837
|
(0, import_operators36.switchMap)(
|
|
320354
|
-
() => (0,
|
|
320838
|
+
() => (0, import_rxjs52.fromEvent)(watcher, "change").pipe(
|
|
320355
320839
|
(0, import_operators36.map)(([event, filename]) => ({
|
|
320356
320840
|
event,
|
|
320357
320841
|
filename
|
|
@@ -320400,12 +320884,12 @@ async function start2(args) {
|
|
|
320400
320884
|
)
|
|
320401
320885
|
);
|
|
320402
320886
|
}
|
|
320403
|
-
var import_node_child_process, import_node_fs2,
|
|
320887
|
+
var import_node_child_process, import_node_fs2, import_rxjs52, import_operators36;
|
|
320404
320888
|
var init_start3 = __esm({
|
|
320405
320889
|
"src/commands/start/start.ts"() {
|
|
320406
320890
|
import_node_child_process = require("node:child_process");
|
|
320407
320891
|
import_node_fs2 = require("node:fs");
|
|
320408
|
-
|
|
320892
|
+
import_rxjs52 = __toESM(require_cjs());
|
|
320409
320893
|
import_operators36 = __toESM(require_operators());
|
|
320410
320894
|
init_log();
|
|
320411
320895
|
init_build();
|
|
@@ -320418,16 +320902,16 @@ var create_cron_exports = {};
|
|
|
320418
320902
|
__export(create_cron_exports, {
|
|
320419
320903
|
default: () => create_cron_default
|
|
320420
320904
|
});
|
|
320421
|
-
var
|
|
320905
|
+
var import_rxjs53, import_operators37, create_cron_default;
|
|
320422
320906
|
var init_create_cron = __esm({
|
|
320423
320907
|
"src/commands/triggers/cron/create-cron.ts"() {
|
|
320424
|
-
|
|
320908
|
+
import_rxjs53 = __toESM(require_cjs());
|
|
320425
320909
|
import_operators37 = __toESM(require_operators());
|
|
320426
320910
|
init_helpers();
|
|
320427
320911
|
init_gql_client();
|
|
320428
320912
|
init_log();
|
|
320429
320913
|
init_load_spec();
|
|
320430
|
-
create_cron_default = (cmd) => (0,
|
|
320914
|
+
create_cron_default = (cmd) => (0, import_rxjs53.lastValueFrom)(
|
|
320431
320915
|
parseProjectId(cmd.project).pipe(
|
|
320432
320916
|
(0, import_operators37.switchMap)(
|
|
320433
320917
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
@@ -320450,7 +320934,7 @@ var init_create_cron = __esm({
|
|
|
320450
320934
|
)
|
|
320451
320935
|
),
|
|
320452
320936
|
(0, import_operators37.switchMap)(
|
|
320453
|
-
({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0,
|
|
320937
|
+
({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0, import_rxjs53.throwError)(
|
|
320454
320938
|
() => new Error(
|
|
320455
320939
|
"cron:create needs --cron and --triggerName (or triggers.time.cron / triggerName in lambforge.yaml)"
|
|
320456
320940
|
)
|
|
@@ -320483,16 +320967,16 @@ var delete_cron_exports = {};
|
|
|
320483
320967
|
__export(delete_cron_exports, {
|
|
320484
320968
|
default: () => delete_cron_default
|
|
320485
320969
|
});
|
|
320486
|
-
var
|
|
320970
|
+
var import_rxjs54, import_operators38, delete_cron_default;
|
|
320487
320971
|
var init_delete_cron = __esm({
|
|
320488
320972
|
"src/commands/triggers/cron/delete-cron.ts"() {
|
|
320489
|
-
|
|
320973
|
+
import_rxjs54 = __toESM(require_cjs());
|
|
320490
320974
|
import_operators38 = __toESM(require_operators());
|
|
320491
320975
|
init_helpers();
|
|
320492
320976
|
init_gql_client();
|
|
320493
320977
|
init_log();
|
|
320494
320978
|
init_load_spec();
|
|
320495
|
-
delete_cron_default = (cmd) => (0,
|
|
320979
|
+
delete_cron_default = (cmd) => (0, import_rxjs54.lastValueFrom)(
|
|
320496
320980
|
parseProjectId(cmd.project).pipe(
|
|
320497
320981
|
(0, import_operators38.switchMap)(
|
|
320498
320982
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
@@ -320536,18 +321020,18 @@ var list_crons_exports = {};
|
|
|
320536
321020
|
__export(list_crons_exports, {
|
|
320537
321021
|
default: () => list_crons_default
|
|
320538
321022
|
});
|
|
320539
|
-
var
|
|
321023
|
+
var import_rxjs55, import_operators39, list_crons_default;
|
|
320540
321024
|
var init_list_crons = __esm({
|
|
320541
321025
|
"src/commands/triggers/cron/list-crons.ts"() {
|
|
320542
|
-
|
|
321026
|
+
import_rxjs55 = __toESM(require_cjs());
|
|
320543
321027
|
import_operators39 = __toESM(require_operators());
|
|
320544
321028
|
init_helpers();
|
|
320545
321029
|
init_gql_client();
|
|
320546
321030
|
init_log();
|
|
320547
|
-
list_crons_default = (cmd) => (0,
|
|
321031
|
+
list_crons_default = (cmd) => (0, import_rxjs55.lastValueFrom)(
|
|
320548
321032
|
parseProjectId(cmd.project).pipe(
|
|
320549
321033
|
(0, import_operators39.switchMap)(
|
|
320550
|
-
(projectId) => (0,
|
|
321034
|
+
(projectId) => (0, import_rxjs55.combineLatest)([
|
|
320551
321035
|
GraphqlClienAPI.listProjectTimeTriggers(projectId),
|
|
320552
321036
|
GraphqlClienAPI.listLambdas(projectId)
|
|
320553
321037
|
])
|
|
@@ -320580,15 +321064,15 @@ var list_exports7 = {};
|
|
|
320580
321064
|
__export(list_exports7, {
|
|
320581
321065
|
default: () => list_default7
|
|
320582
321066
|
});
|
|
320583
|
-
var
|
|
321067
|
+
var import_rxjs56, import_operators40, list_default7;
|
|
320584
321068
|
var init_list7 = __esm({
|
|
320585
321069
|
"src/commands/triggers/message-queue/list.ts"() {
|
|
320586
|
-
|
|
321070
|
+
import_rxjs56 = __toESM(require_cjs());
|
|
320587
321071
|
import_operators40 = __toESM(require_operators());
|
|
320588
321072
|
init_helpers();
|
|
320589
321073
|
init_gql_client();
|
|
320590
321074
|
init_log();
|
|
320591
|
-
list_default7 = (cmd) => (0,
|
|
321075
|
+
list_default7 = (cmd) => (0, import_rxjs56.lastValueFrom)(
|
|
320592
321076
|
parseProjectId(cmd.project).pipe(
|
|
320593
321077
|
(0, import_operators40.switchMap)(
|
|
320594
321078
|
(projectId) => GraphqlClienAPI.listMessageQueueTriggers(projectId)
|
|
@@ -320624,10 +321108,10 @@ __export(save_exports, {
|
|
|
320624
321108
|
mergeOverExisting: () => mergeOverExisting,
|
|
320625
321109
|
toTriggerInput: () => toTriggerInput
|
|
320626
321110
|
});
|
|
320627
|
-
var
|
|
321111
|
+
var import_rxjs57, import_operators41, int2, toTriggerInput, mergeOverExisting, save_default;
|
|
320628
321112
|
var init_save = __esm({
|
|
320629
321113
|
"src/commands/triggers/message-queue/save.ts"() {
|
|
320630
|
-
|
|
321114
|
+
import_rxjs57 = __toESM(require_cjs());
|
|
320631
321115
|
import_operators41 = __toESM(require_operators());
|
|
320632
321116
|
init_helpers();
|
|
320633
321117
|
init_gql_client();
|
|
@@ -320690,11 +321174,11 @@ var init_save = __esm({
|
|
|
320690
321174
|
)
|
|
320691
321175
|
);
|
|
320692
321176
|
};
|
|
320693
|
-
save_default = (mode, cmd) => (0,
|
|
321177
|
+
save_default = (mode, cmd) => (0, import_rxjs57.lastValueFrom)(
|
|
320694
321178
|
parseProjectId(cmd.project).pipe(
|
|
320695
321179
|
(0, import_operators41.switchMap)((projectId) => {
|
|
320696
321180
|
const changes = toTriggerInput(mode, cmd);
|
|
320697
|
-
const payload$ = mode === "create" ? (0,
|
|
321181
|
+
const payload$ = mode === "create" ? (0, import_rxjs57.of)(changes) : GraphqlClienAPI.listMessageQueueTriggers(projectId).pipe(
|
|
320698
321182
|
(0, import_operators41.map)(
|
|
320699
321183
|
(triggers) => mergeOverExisting(
|
|
320700
321184
|
triggers.find((t2) => t2.name === cmd.name),
|
|
@@ -320732,15 +321216,15 @@ var delete_exports4 = {};
|
|
|
320732
321216
|
__export(delete_exports4, {
|
|
320733
321217
|
default: () => delete_default4
|
|
320734
321218
|
});
|
|
320735
|
-
var
|
|
321219
|
+
var import_rxjs58, import_operators42, delete_default4;
|
|
320736
321220
|
var init_delete4 = __esm({
|
|
320737
321221
|
"src/commands/triggers/message-queue/delete.ts"() {
|
|
320738
|
-
|
|
321222
|
+
import_rxjs58 = __toESM(require_cjs());
|
|
320739
321223
|
import_operators42 = __toESM(require_operators());
|
|
320740
321224
|
init_helpers();
|
|
320741
321225
|
init_gql_client();
|
|
320742
321226
|
init_log();
|
|
320743
|
-
delete_default4 = (cmd) => (0,
|
|
321227
|
+
delete_default4 = (cmd) => (0, import_rxjs58.lastValueFrom)(
|
|
320744
321228
|
parseProjectId(cmd.project).pipe(
|
|
320745
321229
|
(0, import_operators42.switchMap)(
|
|
320746
321230
|
(projectId) => GraphqlClienAPI.deleteMessageQueueTrigger(projectId, cmd.name)
|
|
@@ -320850,11 +321334,11 @@ var init_definition = __esm({
|
|
|
320850
321334
|
});
|
|
320851
321335
|
|
|
320852
321336
|
// src/commands/workflow/helpers.ts
|
|
320853
|
-
var
|
|
321337
|
+
var import_promises4, import_rxjs59, import_operators43, resolveWorkflow, withProject, readWorkflowFile, writeTextFile, POLL_MS, followRun, printRunResult;
|
|
320854
321338
|
var init_helpers4 = __esm({
|
|
320855
321339
|
"src/commands/workflow/helpers.ts"() {
|
|
320856
|
-
|
|
320857
|
-
|
|
321340
|
+
import_promises4 = require("fs/promises");
|
|
321341
|
+
import_rxjs59 = __toESM(require_cjs());
|
|
320858
321342
|
import_operators43 = __toESM(require_operators());
|
|
320859
321343
|
init_helpers();
|
|
320860
321344
|
init_gql_client();
|
|
@@ -320876,18 +321360,18 @@ var init_helpers4 = __esm({
|
|
|
320876
321360
|
})
|
|
320877
321361
|
);
|
|
320878
321362
|
};
|
|
320879
|
-
withProject = (project, fn) => (0,
|
|
321363
|
+
withProject = (project, fn) => (0, import_rxjs59.lastValueFrom)(parseProjectId(project).pipe((0, import_operators43.switchMap)(fn)));
|
|
320880
321364
|
readWorkflowFile = (path2) => {
|
|
320881
321365
|
if (!path2) {
|
|
320882
321366
|
throw new Error("--file is required (a workflow YAML or JSON file)");
|
|
320883
321367
|
}
|
|
320884
|
-
return (0,
|
|
321368
|
+
return (0, import_rxjs59.from)((0, import_promises4.readFile)(path2, "utf8")).pipe((0, import_operators43.map)(parseWorkflowFile));
|
|
320885
321369
|
};
|
|
320886
|
-
writeTextFile = (path2, text) => (0,
|
|
321370
|
+
writeTextFile = (path2, text) => (0, import_rxjs59.from)((0, import_promises4.writeFile)(path2, text, "utf8"));
|
|
320887
321371
|
POLL_MS = 2e3;
|
|
320888
321372
|
followRun = (projectId, workflowId, runName) => {
|
|
320889
321373
|
let printed = 0;
|
|
320890
|
-
return (0,
|
|
321374
|
+
return (0, import_rxjs59.timer)(0, POLL_MS).pipe(
|
|
320891
321375
|
(0, import_operators43.switchMap)(
|
|
320892
321376
|
() => GraphqlClienAPI.getWorkflowRun(projectId, workflowId, runName)
|
|
320893
321377
|
),
|
|
@@ -320960,10 +321444,10 @@ var get_exports2 = {};
|
|
|
320960
321444
|
__export(get_exports2, {
|
|
320961
321445
|
default: () => get_default2
|
|
320962
321446
|
});
|
|
320963
|
-
var
|
|
321447
|
+
var import_rxjs60, import_operators45, get_default2;
|
|
320964
321448
|
var init_get2 = __esm({
|
|
320965
321449
|
"src/commands/workflow/get.ts"() {
|
|
320966
|
-
|
|
321450
|
+
import_rxjs60 = __toESM(require_cjs());
|
|
320967
321451
|
import_operators45 = __toESM(require_operators());
|
|
320968
321452
|
init_log();
|
|
320969
321453
|
init_definition();
|
|
@@ -320979,7 +321463,7 @@ var init_get2 = __esm({
|
|
|
320979
321463
|
});
|
|
320980
321464
|
if (!cmd.out) {
|
|
320981
321465
|
Logger.log(text);
|
|
320982
|
-
return (0,
|
|
321466
|
+
return (0, import_rxjs60.of)(null);
|
|
320983
321467
|
}
|
|
320984
321468
|
return writeTextFile(cmd.out, text).pipe(
|
|
320985
321469
|
(0, import_operators45.tap)(() => Logger.info(`Wrote ${cmd.out}`))
|
|
@@ -321049,11 +321533,11 @@ var generate_exports = {};
|
|
|
321049
321533
|
__export(generate_exports, {
|
|
321050
321534
|
default: () => generate_default
|
|
321051
321535
|
});
|
|
321052
|
-
var
|
|
321536
|
+
var import_promises5, import_rxjs61, import_operators47, generate_default;
|
|
321053
321537
|
var init_generate = __esm({
|
|
321054
321538
|
"src/commands/workflow/generate.ts"() {
|
|
321055
|
-
|
|
321056
|
-
|
|
321539
|
+
import_promises5 = require("fs/promises");
|
|
321540
|
+
import_rxjs61 = __toESM(require_cjs());
|
|
321057
321541
|
import_operators47 = __toESM(require_operators());
|
|
321058
321542
|
init_gql_client();
|
|
321059
321543
|
init_log();
|
|
@@ -321066,7 +321550,7 @@ var init_generate = __esm({
|
|
|
321066
321550
|
'Describe the workflow: --description "charge the card with retries, then email the receipt"'
|
|
321067
321551
|
);
|
|
321068
321552
|
}
|
|
321069
|
-
const base$ = cmd.from ? (0,
|
|
321553
|
+
const base$ = cmd.from ? (0, import_rxjs61.from)((0, import_promises5.readFile)(cmd.from, "utf8")).pipe((0, import_operators47.map)(parseWorkflowFile)) : cmd.name ? GraphqlClienAPI.listWorkflows(projectId).pipe(
|
|
321070
321554
|
(0, import_operators47.switchMap)(
|
|
321071
321555
|
(workflows) => workflows.some((w) => w.name === cmd.name) ? resolveWorkflow(projectId, cmd.name).pipe(
|
|
321072
321556
|
(0, import_operators47.map)((w) => ({
|
|
@@ -321074,9 +321558,9 @@ var init_generate = __esm({
|
|
|
321074
321558
|
description: w.description ?? void 0,
|
|
321075
321559
|
definition: w.definition
|
|
321076
321560
|
}))
|
|
321077
|
-
) : (0,
|
|
321561
|
+
) : (0, import_rxjs61.of)(null)
|
|
321078
321562
|
)
|
|
321079
|
-
) : (0,
|
|
321563
|
+
) : (0, import_rxjs61.of)(null);
|
|
321080
321564
|
return base$.pipe(
|
|
321081
321565
|
(0, import_operators47.tap)(() => Logger.info("Asking the AI for a draft...")),
|
|
321082
321566
|
(0, import_operators47.switchMap)(
|
|
@@ -321103,10 +321587,10 @@ var init_generate = __esm({
|
|
|
321103
321587
|
const text = toWorkflowYaml(file2);
|
|
321104
321588
|
const written$ = cmd.out ? writeTextFile(cmd.out, text).pipe(
|
|
321105
321589
|
(0, import_operators47.tap)(() => Logger.info(`Wrote ${cmd.out}`))
|
|
321106
|
-
) : (0,
|
|
321590
|
+
) : (0, import_rxjs61.of)(null).pipe((0, import_operators47.tap)(() => !cmd.apply && Logger.log(text)));
|
|
321107
321591
|
return written$.pipe(
|
|
321108
321592
|
(0, import_operators47.switchMap)(
|
|
321109
|
-
() => cmd.apply ? applyWorkflow(projectId, file2) : (0,
|
|
321593
|
+
() => cmd.apply ? applyWorkflow(projectId, file2) : (0, import_rxjs61.of)(null).pipe(
|
|
321110
321594
|
(0, import_operators47.tap)(
|
|
321111
321595
|
() => Logger.info(
|
|
321112
321596
|
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>"
|
|
@@ -321180,11 +321664,11 @@ var run_exports = {};
|
|
|
321180
321664
|
__export(run_exports, {
|
|
321181
321665
|
default: () => run_default
|
|
321182
321666
|
});
|
|
321183
|
-
var
|
|
321667
|
+
var import_promises6, import_rxjs62, import_operators50, run_default;
|
|
321184
321668
|
var init_run = __esm({
|
|
321185
321669
|
"src/commands/workflow/run.ts"() {
|
|
321186
|
-
|
|
321187
|
-
|
|
321670
|
+
import_promises6 = require("fs/promises");
|
|
321671
|
+
import_rxjs62 = __toESM(require_cjs());
|
|
321188
321672
|
import_operators50 = __toESM(require_operators());
|
|
321189
321673
|
init_gql_client();
|
|
321190
321674
|
init_log();
|
|
@@ -321192,7 +321676,7 @@ var init_run = __esm({
|
|
|
321192
321676
|
init_helpers4();
|
|
321193
321677
|
run_default = (cmd) => withProject(
|
|
321194
321678
|
cmd.project,
|
|
321195
|
-
(projectId) => (cmd.inputFile ? (0,
|
|
321679
|
+
(projectId) => (cmd.inputFile ? (0, import_rxjs62.from)((0, import_promises6.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs62.of)(cmd.input)).pipe(
|
|
321196
321680
|
(0, import_operators50.map)(parseRunInput),
|
|
321197
321681
|
(0, import_operators50.switchMap)(
|
|
321198
321682
|
(input) => resolveWorkflow(projectId, cmd.name).pipe(
|
|
@@ -321200,7 +321684,7 @@ var init_run = __esm({
|
|
|
321200
321684
|
(w) => GraphqlClienAPI.startWorkflowRun(projectId, w.id, input).pipe(
|
|
321201
321685
|
(0, import_operators50.tap)((run2) => Logger.info(`Started run ${run2.name}`)),
|
|
321202
321686
|
(0, import_operators50.switchMap)(
|
|
321203
|
-
(run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0,
|
|
321687
|
+
(run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0, import_rxjs62.of)(run2).pipe(
|
|
321204
321688
|
(0, import_operators50.tap)(
|
|
321205
321689
|
() => Logger.info(
|
|
321206
321690
|
`Follow it: gcli workflow:status --name ${w.name} --run ${run2.name} --follow`
|
|
@@ -321374,11 +321858,11 @@ var trigger_add_exports = {};
|
|
|
321374
321858
|
__export(trigger_add_exports, {
|
|
321375
321859
|
default: () => trigger_add_default
|
|
321376
321860
|
});
|
|
321377
|
-
var
|
|
321861
|
+
var import_promises7, import_rxjs63, import_operators54, trigger_add_default;
|
|
321378
321862
|
var init_trigger_add = __esm({
|
|
321379
321863
|
"src/commands/workflow/trigger-add.ts"() {
|
|
321380
|
-
|
|
321381
|
-
|
|
321864
|
+
import_promises7 = require("fs/promises");
|
|
321865
|
+
import_rxjs63 = __toESM(require_cjs());
|
|
321382
321866
|
import_operators54 = __toESM(require_operators());
|
|
321383
321867
|
init_gql_client();
|
|
321384
321868
|
init_log();
|
|
@@ -321386,7 +321870,7 @@ var init_trigger_add = __esm({
|
|
|
321386
321870
|
init_triggers();
|
|
321387
321871
|
trigger_add_default = (cmd) => withProject(
|
|
321388
321872
|
cmd.project,
|
|
321389
|
-
(projectId) => (cmd.inputFile ? (0,
|
|
321873
|
+
(projectId) => (cmd.inputFile ? (0, import_rxjs63.from)((0, import_promises7.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs63.of)(void 0)).pipe(
|
|
321390
321874
|
(0, import_operators54.map)((inputText) => buildTriggerInput({ ...cmd, inputText })),
|
|
321391
321875
|
(0, import_operators54.switchMap)(
|
|
321392
321876
|
(trigger) => resolveWorkflow(projectId, cmd.name).pipe(
|
|
@@ -321475,10 +321959,10 @@ var init_trigger_remove = __esm({
|
|
|
321475
321959
|
});
|
|
321476
321960
|
|
|
321477
321961
|
// src/commands/workspace/approvals.ts
|
|
321478
|
-
var
|
|
321962
|
+
var import_readline3, APPROVAL_TIMEOUT_MS, TerminalPrompt, ApprovalGate;
|
|
321479
321963
|
var init_approvals = __esm({
|
|
321480
321964
|
"src/commands/workspace/approvals.ts"() {
|
|
321481
|
-
|
|
321965
|
+
import_readline3 = require("readline");
|
|
321482
321966
|
APPROVAL_TIMEOUT_MS = 5 * 6e4;
|
|
321483
321967
|
TerminalPrompt = class {
|
|
321484
321968
|
constructor() {
|
|
@@ -321492,7 +321976,7 @@ var init_approvals = __esm({
|
|
|
321492
321976
|
askNow(question, signal) {
|
|
321493
321977
|
if (signal.aborted) return Promise.resolve(null);
|
|
321494
321978
|
return new Promise((resolve2) => {
|
|
321495
|
-
const rl = (0,
|
|
321979
|
+
const rl = (0, import_readline3.createInterface)({
|
|
321496
321980
|
input: process.stdin,
|
|
321497
321981
|
output: process.stdout
|
|
321498
321982
|
});
|
|
@@ -321602,23 +322086,23 @@ var init_approvals = __esm({
|
|
|
321602
322086
|
});
|
|
321603
322087
|
|
|
321604
322088
|
// src/commands/workspace/config.ts
|
|
321605
|
-
var
|
|
322089
|
+
var import_promises8, readSavedWorkspaces, writeAll, readSavedWorkspace, saveWorkspace, forgetWorkspace;
|
|
321606
322090
|
var init_config2 = __esm({
|
|
321607
322091
|
"src/commands/workspace/config.ts"() {
|
|
321608
|
-
|
|
322092
|
+
import_promises8 = require("fs/promises");
|
|
321609
322093
|
init_types();
|
|
321610
322094
|
readSavedWorkspaces = async () => {
|
|
321611
322095
|
try {
|
|
321612
|
-
const saved = JSON.parse(await (0,
|
|
322096
|
+
const saved = JSON.parse(await (0, import_promises8.readFile)(workspacesDirectory, "utf-8"));
|
|
321613
322097
|
return saved && typeof saved === "object" ? saved : {};
|
|
321614
322098
|
} catch {
|
|
321615
322099
|
return {};
|
|
321616
322100
|
}
|
|
321617
322101
|
};
|
|
321618
322102
|
writeAll = async (all) => {
|
|
321619
|
-
await (0,
|
|
321620
|
-
await (0,
|
|
321621
|
-
await (0,
|
|
322103
|
+
await (0, import_promises8.mkdir)(mainDirectory, { recursive: true });
|
|
322104
|
+
await (0, import_promises8.writeFile)(workspacesDirectory, JSON.stringify(all, null, 2), "utf-8");
|
|
322105
|
+
await (0, import_promises8.chmod)(workspacesDirectory, 384);
|
|
321622
322106
|
};
|
|
321623
322107
|
readSavedWorkspace = async (root) => {
|
|
321624
322108
|
const saved = (await readSavedWorkspaces())[root];
|
|
@@ -321647,15 +322131,15 @@ var init_config2 = __esm({
|
|
|
321647
322131
|
});
|
|
321648
322132
|
|
|
321649
322133
|
// src/commands/workspace/files.ts
|
|
321650
|
-
var
|
|
322134
|
+
var import_child_process5, import_crypto, import_fs8, import_path3, 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;
|
|
321651
322135
|
var init_files = __esm({
|
|
321652
322136
|
"src/commands/workspace/files.ts"() {
|
|
321653
|
-
|
|
322137
|
+
import_child_process5 = require("child_process");
|
|
321654
322138
|
import_crypto = require("crypto");
|
|
321655
322139
|
import_fs8 = require("fs");
|
|
321656
|
-
|
|
322140
|
+
import_path3 = require("path");
|
|
321657
322141
|
import_util12 = require("util");
|
|
321658
|
-
run = (0, import_util12.promisify)(
|
|
322142
|
+
run = (0, import_util12.promisify)(import_child_process5.execFile);
|
|
321659
322143
|
WorkspaceError = class extends Error {
|
|
321660
322144
|
constructor(message, status2 = 400) {
|
|
321661
322145
|
super(message);
|
|
@@ -321673,11 +322157,11 @@ var init_files = __esm({
|
|
|
321673
322157
|
SECRET_FILE = /^(\.env(\..+)?|.*\.(pem|key|p12|pfx|keystore|jks)|id_(rsa|dsa|ecdsa|ed25519)(\.pub)?|\.npmrc|\.pypirc|\.netrc|credentials(\.json)?)$/i;
|
|
321674
322158
|
SECRET_TEMPLATE = /\.(example|sample|template|dist|defaults)$/i;
|
|
321675
322159
|
isSecretFile = (path2) => {
|
|
321676
|
-
const name2 = (0,
|
|
322160
|
+
const name2 = (0, import_path3.basename)(path2);
|
|
321677
322161
|
return SECRET_FILE.test(name2) && !SECRET_TEMPLATE.test(name2);
|
|
321678
322162
|
};
|
|
321679
322163
|
contentHash = (content) => (0, import_crypto.createHash)("sha256").update(content).digest("hex").slice(0, 16);
|
|
321680
|
-
toPosix = (p) => p.split(
|
|
322164
|
+
toPosix = (p) => p.split(import_path3.sep).join("/");
|
|
321681
322165
|
WorkspaceFiles = class {
|
|
321682
322166
|
constructor(root, options = {}) {
|
|
321683
322167
|
this.root = root;
|
|
@@ -321686,9 +322170,9 @@ var init_files = __esm({
|
|
|
321686
322170
|
/** Absolute path for a workspace-relative one, or a WorkspaceError. */
|
|
321687
322171
|
async resolvePath(input, { forWrite = false } = {}) {
|
|
321688
322172
|
const rel = (input ?? ".").trim() || ".";
|
|
321689
|
-
const abs = (0,
|
|
321690
|
-
const fromRoot = (0,
|
|
321691
|
-
if (fromRoot.startsWith("..") || (0,
|
|
322173
|
+
const abs = (0, import_path3.resolve)(this.root, rel);
|
|
322174
|
+
const fromRoot = (0, import_path3.relative)(this.root, abs);
|
|
322175
|
+
if (fromRoot.startsWith("..") || (0, import_path3.isAbsolute)(fromRoot)) {
|
|
321692
322176
|
throw new WorkspaceError(
|
|
321693
322177
|
`${input} is outside the workspace root - paths are relative to ${this.root}`,
|
|
321694
322178
|
403
|
|
@@ -321698,8 +322182,8 @@ var init_files = __esm({
|
|
|
321698
322182
|
for (; ; ) {
|
|
321699
322183
|
try {
|
|
321700
322184
|
const real = await import_fs8.promises.realpath(existing);
|
|
321701
|
-
const realFromRoot = (0,
|
|
321702
|
-
if (realFromRoot.startsWith("..") || (0,
|
|
322185
|
+
const realFromRoot = (0, import_path3.relative)(this.root, real);
|
|
322186
|
+
if (realFromRoot.startsWith("..") || (0, import_path3.isAbsolute)(realFromRoot)) {
|
|
321703
322187
|
throw new WorkspaceError(
|
|
321704
322188
|
`${input} resolves outside the workspace root (symlink)`,
|
|
321705
322189
|
403
|
|
@@ -321708,7 +322192,7 @@ var init_files = __esm({
|
|
|
321708
322192
|
break;
|
|
321709
322193
|
} catch (e2) {
|
|
321710
322194
|
if (e2 instanceof WorkspaceError) throw e2;
|
|
321711
|
-
const parent = (0,
|
|
322195
|
+
const parent = (0, import_path3.dirname)(existing);
|
|
321712
322196
|
if (parent === existing) break;
|
|
321713
322197
|
existing = parent;
|
|
321714
322198
|
}
|
|
@@ -321756,7 +322240,7 @@ var init_files = __esm({
|
|
|
321756
322240
|
const out = [];
|
|
321757
322241
|
const walk = async (relDir) => {
|
|
321758
322242
|
if (out.length > limit) return;
|
|
321759
|
-
const entries = await import_fs8.promises.readdir((0,
|
|
322243
|
+
const entries = await import_fs8.promises.readdir((0, import_path3.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
|
|
321760
322244
|
for (const entry of entries) {
|
|
321761
322245
|
if (SKIP_DIRS.has(entry.name)) continue;
|
|
321762
322246
|
const rel = relDir === "." ? entry.name : `${relDir}/${entry.name}`;
|
|
@@ -321799,7 +322283,7 @@ var init_files = __esm({
|
|
|
321799
322283
|
entries = entries.slice(0, limit);
|
|
321800
322284
|
await Promise.all(
|
|
321801
322285
|
entries.filter((e2) => e2.type === "file").map(async (e2) => {
|
|
321802
|
-
e2.size = await import_fs8.promises.stat((0,
|
|
322286
|
+
e2.size = await import_fs8.promises.stat((0, import_path3.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
|
|
321803
322287
|
})
|
|
321804
322288
|
);
|
|
321805
322289
|
return {
|
|
@@ -321865,7 +322349,7 @@ var init_files = __esm({
|
|
|
321865
322349
|
);
|
|
321866
322350
|
}
|
|
321867
322351
|
}
|
|
321868
|
-
await import_fs8.promises.mkdir((0,
|
|
322352
|
+
await import_fs8.promises.mkdir((0, import_path3.dirname)(abs), { recursive: true });
|
|
321869
322353
|
await import_fs8.promises.writeFile(abs, content, "utf-8");
|
|
321870
322354
|
return {
|
|
321871
322355
|
path: rel,
|
|
@@ -321968,7 +322452,7 @@ var init_files = __esm({
|
|
|
321968
322452
|
raw = [];
|
|
321969
322453
|
for (const file2 of await this.allFiles(rel, 2e4)) {
|
|
321970
322454
|
if (globRe && !globRe.test(file2)) continue;
|
|
321971
|
-
const text = await import_fs8.promises.readFile((0,
|
|
322455
|
+
const text = await import_fs8.promises.readFile((0, import_path3.join)(this.root, file2)).catch(() => null);
|
|
321972
322456
|
if (!text || text.subarray(0, 8e3).includes(0)) continue;
|
|
321973
322457
|
text.toString("utf-8").split("\n").forEach((line, i2) => {
|
|
321974
322458
|
if (raw.length <= max && re.test(line)) {
|
|
@@ -321989,10 +322473,10 @@ var init_files = __esm({
|
|
|
321989
322473
|
});
|
|
321990
322474
|
|
|
321991
322475
|
// src/commands/workspace/processes.ts
|
|
321992
|
-
var
|
|
322476
|
+
var import_child_process6, DEFAULT_TIMEOUT_S, MAX_TIMEOUT_S, MAX_STREAM_CHARS, MAX_PROCESS_LINES, MAX_PROCESSES, DEFAULT_WAIT_S, MAX_WAIT_S, KILL_GRACE_MS, ANSI, stripAnsi, BASE_ENV, buildEnv, shellOf, killTree, terminate, TailBuffer, runCommand, ProcessManager;
|
|
321993
322477
|
var init_processes = __esm({
|
|
321994
322478
|
"src/commands/workspace/processes.ts"() {
|
|
321995
|
-
|
|
322479
|
+
import_child_process6 = require("child_process");
|
|
321996
322480
|
init_files();
|
|
321997
322481
|
DEFAULT_TIMEOUT_S = 300;
|
|
321998
322482
|
MAX_TIMEOUT_S = 1800;
|
|
@@ -322075,7 +322559,7 @@ var init_processes = __esm({
|
|
|
322075
322559
|
if (!child.pid || child.exitCode !== null) return;
|
|
322076
322560
|
try {
|
|
322077
322561
|
if (process.platform === "win32") {
|
|
322078
|
-
(0,
|
|
322562
|
+
(0, import_child_process6.spawn)("taskkill", ["/pid", String(child.pid), "/T", "/F"]);
|
|
322079
322563
|
} else {
|
|
322080
322564
|
process.kill(-child.pid, signal);
|
|
322081
322565
|
}
|
|
@@ -322117,7 +322601,7 @@ ${this.text}` : this.text;
|
|
|
322117
322601
|
);
|
|
322118
322602
|
const started = Date.now();
|
|
322119
322603
|
const [shell, shellArgs] = shellOf(args.command);
|
|
322120
|
-
const child = (0,
|
|
322604
|
+
const child = (0, import_child_process6.spawn)(shell, shellArgs, {
|
|
322121
322605
|
cwd: args.cwd,
|
|
322122
322606
|
env: args.env,
|
|
322123
322607
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -322207,7 +322691,7 @@ ${this.text}` : this.text;
|
|
|
322207
322691
|
}
|
|
322208
322692
|
}
|
|
322209
322693
|
const [shell, shellArgs] = shellOf(args.command);
|
|
322210
|
-
const child = (0,
|
|
322694
|
+
const child = (0, import_child_process6.spawn)(shell, shellArgs, {
|
|
322211
322695
|
cwd: args.cwd,
|
|
322212
322696
|
env: args.env,
|
|
322213
322697
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -322363,10 +322847,10 @@ ${this.text}` : this.text;
|
|
|
322363
322847
|
});
|
|
322364
322848
|
|
|
322365
322849
|
// src/commands/workspace/connection.ts
|
|
322366
|
-
var
|
|
322850
|
+
var import_os5, WORKSPACE_PATH_PREFIX, WORKSPACE_OPS, HEARTBEAT_MUTATION2, REQUEST_APPROVAL_MUTATION, SETTLE_APPROVAL_MUTATION, str, num, short, WorkspaceConnection;
|
|
322367
322851
|
var init_connection2 = __esm({
|
|
322368
322852
|
"src/commands/workspace/connection.ts"() {
|
|
322369
|
-
|
|
322853
|
+
import_os5 = require("os");
|
|
322370
322854
|
init_tunnel();
|
|
322371
322855
|
init_approvals();
|
|
322372
322856
|
init_files();
|
|
@@ -322449,7 +322933,7 @@ var init_connection2 = __esm({
|
|
|
322449
322933
|
const data = await this.operation(HEARTBEAT_MUTATION2, {
|
|
322450
322934
|
info: {
|
|
322451
322935
|
root: this.options.root,
|
|
322452
|
-
hostname: (0,
|
|
322936
|
+
hostname: (0, import_os5.hostname)(),
|
|
322453
322937
|
platform: process.platform,
|
|
322454
322938
|
gitBranch: await this.files.gitBranch(),
|
|
322455
322939
|
clientVersion: this.options.version,
|
|
@@ -322761,12 +323245,12 @@ __export(start_exports4, {
|
|
|
322761
323245
|
WORKSPACE_VERSION: () => WORKSPACE_VERSION,
|
|
322762
323246
|
default: () => start_default2
|
|
322763
323247
|
});
|
|
322764
|
-
var
|
|
323248
|
+
var import_promises9, import_path4, import_rxjs64, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
|
|
322765
323249
|
var init_start4 = __esm({
|
|
322766
323250
|
"src/commands/workspace/start.ts"() {
|
|
322767
|
-
|
|
322768
|
-
|
|
322769
|
-
|
|
323251
|
+
import_promises9 = require("fs/promises");
|
|
323252
|
+
import_path4 = require("path");
|
|
323253
|
+
import_rxjs64 = __toESM(require_cjs());
|
|
322770
323254
|
init_helpers();
|
|
322771
323255
|
init_gql_client();
|
|
322772
323256
|
init_log();
|
|
@@ -322783,7 +323267,7 @@ var init_start4 = __esm({
|
|
|
322783
323267
|
if (cmd.token) {
|
|
322784
323268
|
return {
|
|
322785
323269
|
id: "(from --token)",
|
|
322786
|
-
name: cmd.name ?? (0,
|
|
323270
|
+
name: cmd.name ?? (0, import_path4.basename)(root),
|
|
322787
323271
|
token: cmd.token,
|
|
322788
323272
|
projectId: cmd.project ?? "",
|
|
322789
323273
|
root
|
|
@@ -322796,16 +323280,16 @@ var init_start4 = __esm({
|
|
|
322796
323280
|
if (saved && (!cmd.project || cmd.project === saved.projectId)) {
|
|
322797
323281
|
return saved;
|
|
322798
323282
|
}
|
|
322799
|
-
const projectId = await (0,
|
|
323283
|
+
const projectId = await (0, import_rxjs64.lastValueFrom)(parseProjectId(cmd.project)).catch(
|
|
322800
323284
|
() => {
|
|
322801
323285
|
throw new Error(
|
|
322802
323286
|
"No project selected. Pass --project <projectId> or run `gcli project:use <projectId>` first."
|
|
322803
323287
|
);
|
|
322804
323288
|
}
|
|
322805
323289
|
);
|
|
322806
|
-
const name2 = cmd.name || (0,
|
|
323290
|
+
const name2 = cmd.name || (0, import_path4.basename)(root);
|
|
322807
323291
|
Logger.info(`Registering ${root} as local workspace "${name2}"...`);
|
|
322808
|
-
const { workspace, token } = await (0,
|
|
323292
|
+
const { workspace, token } = await (0, import_rxjs64.lastValueFrom)(
|
|
322809
323293
|
GraphqlClienAPI.createLocalWorkspace(projectId, name2)
|
|
322810
323294
|
).catch((e2) => {
|
|
322811
323295
|
throw new Error(
|
|
@@ -322823,7 +323307,7 @@ var init_start4 = __esm({
|
|
|
322823
323307
|
return created;
|
|
322824
323308
|
};
|
|
322825
323309
|
start_default2 = async (cmd) => {
|
|
322826
|
-
const root = await (0,
|
|
323310
|
+
const root = await (0, import_promises9.realpath)(process.cwd());
|
|
322827
323311
|
const workspace = await resolveWorkspace(root, cmd);
|
|
322828
323312
|
const wsUrl = cmd.wsUrl || workspace.wsUrl || deriveSubscriptionsUrl(await readLoginApiUrl());
|
|
322829
323313
|
const policy = new CommandPolicy(
|
|
@@ -322896,16 +323380,16 @@ var list_exports9 = {};
|
|
|
322896
323380
|
__export(list_exports9, {
|
|
322897
323381
|
default: () => list_default9
|
|
322898
323382
|
});
|
|
322899
|
-
var
|
|
323383
|
+
var import_rxjs65, list_default9;
|
|
322900
323384
|
var init_list9 = __esm({
|
|
322901
323385
|
"src/commands/workspace/list.ts"() {
|
|
322902
|
-
|
|
323386
|
+
import_rxjs65 = __toESM(require_cjs());
|
|
322903
323387
|
init_gql_client();
|
|
322904
323388
|
init_log();
|
|
322905
323389
|
init_config2();
|
|
322906
323390
|
list_default9 = async (cmd) => {
|
|
322907
323391
|
const [workspaces, saved] = await Promise.all([
|
|
322908
|
-
(0,
|
|
323392
|
+
(0, import_rxjs65.lastValueFrom)(GraphqlClienAPI.listLocalWorkspaces(cmd.project)),
|
|
322909
323393
|
readSavedWorkspaces()
|
|
322910
323394
|
]);
|
|
322911
323395
|
const onThisMachine = new Set(Object.values(saved).map((w) => w.id));
|
|
@@ -322939,23 +323423,23 @@ var delete_exports6 = {};
|
|
|
322939
323423
|
__export(delete_exports6, {
|
|
322940
323424
|
default: () => delete_default6
|
|
322941
323425
|
});
|
|
322942
|
-
var
|
|
323426
|
+
var import_promises10, import_rxjs66, delete_default6;
|
|
322943
323427
|
var init_delete6 = __esm({
|
|
322944
323428
|
"src/commands/workspace/delete.ts"() {
|
|
322945
|
-
|
|
322946
|
-
|
|
323429
|
+
import_promises10 = require("fs/promises");
|
|
323430
|
+
import_rxjs66 = __toESM(require_cjs());
|
|
322947
323431
|
init_gql_client();
|
|
322948
323432
|
init_log();
|
|
322949
323433
|
init_config2();
|
|
322950
323434
|
delete_default6 = async (cmd) => {
|
|
322951
|
-
const root = await (0,
|
|
323435
|
+
const root = await (0, import_promises10.realpath)(process.cwd());
|
|
322952
323436
|
const workspaceId = cmd.id || (await readSavedWorkspace(root))?.id;
|
|
322953
323437
|
if (!workspaceId) {
|
|
322954
323438
|
throw new Error(
|
|
322955
323439
|
"No workspace registered for this directory - pass --id (see `gcli workspace:list`)."
|
|
322956
323440
|
);
|
|
322957
323441
|
}
|
|
322958
|
-
await (0,
|
|
323442
|
+
await (0, import_rxjs66.lastValueFrom)(GraphqlClienAPI.deleteLocalWorkspace(workspaceId));
|
|
322959
323443
|
await forgetWorkspace({ id: workspaceId });
|
|
322960
323444
|
Logger.log(
|
|
322961
323445
|
`Local workspace ${workspaceId} deleted; its token no longer works.`
|
|
@@ -323006,6 +323490,9 @@ function registerClusterCommands(program2) {
|
|
|
323006
323490
|
).option(
|
|
323007
323491
|
"--host <host>",
|
|
323008
323492
|
"With --virtual: name of a private cluster of this project to run on (default: the shared cluster)"
|
|
323493
|
+
).option(
|
|
323494
|
+
"--dedicated-lb",
|
|
323495
|
+
"With --virtual: give its router its own load balancer IP (billed per hour); without it lambdas are served on the platform subdomain"
|
|
323009
323496
|
).option("--wait", "Block until the cluster is ready (or errors)").action(lazy(() => Promise.resolve().then(() => (init_create(), create_exports)).then((m2) => m2.default)));
|
|
323010
323497
|
program2.command("cluster:apply").description(
|
|
323011
323498
|
"Make a private cluster match the `cluster:` section of lambforge.yaml: creates it if missing, then applies topology, workers, control planes, load balancer and autoscaling"
|
|
@@ -323034,6 +323521,32 @@ function registerClusterCommands(program2) {
|
|
|
323034
323521
|
"Every cluster's status, agent, nodes, CPU/memory load, autoscaling and open issues (or one with --cluster)"
|
|
323035
323522
|
)
|
|
323036
323523
|
).action(lazy(() => Promise.resolve().then(() => (init_status(), status_exports)).then((m2) => m2.default)));
|
|
323524
|
+
target(
|
|
323525
|
+
program2.command("cluster:attach").description(
|
|
323526
|
+
"Attach a machine you own (booted from the Talos ISO, on this network) to a Talos cluster as an extra worker - its install disk is WIPED"
|
|
323527
|
+
)
|
|
323528
|
+
).option("--node-ip <nodeIp>", "The machine's address on your network").option("-n, --name <name>", "Machine name = hostname, e.g. home-1").option("--pool <pool>", 'Pool label lambforge.io/pool (default "default")').option(
|
|
323529
|
+
"--reserved",
|
|
323530
|
+
"Only workloads that tolerate the pool run there (default: plain extra capacity)"
|
|
323531
|
+
).option("--disk <disk>", "Install disk, e.g. /dev/nvme0n1 (WIPED)").option("--yes", "Do not ask before wiping the disk").option("--no-wait", "Do not wait for the machine to join").option("--timeout <minutes>", "How long to wait for the join (default 10)").action(lazy(() => Promise.resolve().then(() => (init_attach2(), attach_exports)).then((m2) => m2.default)));
|
|
323532
|
+
target(
|
|
323533
|
+
program2.command("cluster:nodes").description(
|
|
323534
|
+
"Every node of a cluster: its Hetzner control planes and workers and the machines attached to it"
|
|
323535
|
+
)
|
|
323536
|
+
).action(lazy(() => Promise.resolve().then(() => (init_nodes(), nodes_exports)).then((m2) => m2.default)));
|
|
323537
|
+
target(
|
|
323538
|
+
program2.command("cluster:pause").description(
|
|
323539
|
+
"Pause an attached machine (cordon): nothing new runs there, running work stays"
|
|
323540
|
+
)
|
|
323541
|
+
).option("-n, --name <name>", "Machine name (see cluster:nodes)").action(lazy(() => Promise.resolve().then(() => (init_pause(), pause_exports)).then((m2) => m2.pause)));
|
|
323542
|
+
target(
|
|
323543
|
+
program2.command("cluster:resume").description("Let new work run on a paused machine again (uncordon)")
|
|
323544
|
+
).option("-n, --name <name>", "Machine name (see cluster:nodes)").action(lazy(() => Promise.resolve().then(() => (init_pause(), pause_exports)).then((m2) => m2.resume)));
|
|
323545
|
+
target(
|
|
323546
|
+
program2.command("cluster:detach").description(
|
|
323547
|
+
"Drain and remove an attached machine from a cluster (reset the machine afterwards)"
|
|
323548
|
+
)
|
|
323549
|
+
).option("-n, --name <name>", "Machine name (see cluster:nodes)").option("--yes", "Do not ask for confirmation").action(lazy(() => Promise.resolve().then(() => (init_detach(), detach_exports)).then((m2) => m2.default)));
|
|
323037
323550
|
target(
|
|
323038
323551
|
program2.command("cluster:health").description(
|
|
323039
323552
|
"The latest health report of a cluster's agent, with every node"
|
|
@@ -323072,7 +323585,7 @@ function registerClusterCommands(program2) {
|
|
|
323072
323585
|
).option("--wait", "Block until the cluster settles").action(lazy(() => Promise.resolve().then(() => (init_single_node(), single_node_exports)).then((m2) => m2.default)));
|
|
323073
323586
|
target(
|
|
323074
323587
|
program2.command("cluster:load-balancer").description(
|
|
323075
|
-
"Add or remove the cluster's load balancer (billed per hour while enabled)"
|
|
323588
|
+
"Add or remove the cluster's load balancer (billed per hour while enabled). On a virtual cluster this is its dedicated LB - its own IP; the platform subdomain keeps working either way"
|
|
323076
323589
|
)
|
|
323077
323590
|
).option("--enable", "Add the load balancer").option("--disable", "Remove the load balancer").option("--wait", "Block until the cluster settles").action(lazy(() => Promise.resolve().then(() => (init_load_balancer(), load_balancer_exports)).then((m2) => m2.default)));
|
|
323078
323591
|
}
|