@gapi/gcli 1.8.236 → 1.8.237

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/release/index.js +516 -304
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gapi/gcli",
3
- "version": "1.8.236",
3
+ "version": "1.8.237",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Stradivario/gapi.git"
package/release/index.js CHANGED
@@ -9498,19 +9498,19 @@ var require_Observable = __commonJS({
9498
9498
  var config_1 = require_config();
9499
9499
  var isFunction_1 = require_isFunction();
9500
9500
  var errorContext_1 = require_errorContext();
9501
- var Observable3 = (function() {
9502
- function Observable4(subscribe) {
9501
+ var Observable4 = (function() {
9502
+ function Observable5(subscribe) {
9503
9503
  if (subscribe) {
9504
9504
  this._subscribe = subscribe;
9505
9505
  }
9506
9506
  }
9507
- Observable4.prototype.lift = function(operator) {
9508
- var observable = new Observable4();
9507
+ Observable5.prototype.lift = function(operator) {
9508
+ var observable = new Observable5();
9509
9509
  observable.source = this;
9510
9510
  observable.operator = operator;
9511
9511
  return observable;
9512
9512
  };
9513
- Observable4.prototype.subscribe = function(observerOrNext, error48, complete) {
9513
+ Observable5.prototype.subscribe = function(observerOrNext, error48, complete) {
9514
9514
  var _this = this;
9515
9515
  var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new Subscriber_1.SafeSubscriber(observerOrNext, error48, complete);
9516
9516
  errorContext_1.errorContext(function() {
@@ -9519,14 +9519,14 @@ var require_Observable = __commonJS({
9519
9519
  });
9520
9520
  return subscriber;
9521
9521
  };
9522
- Observable4.prototype._trySubscribe = function(sink) {
9522
+ Observable5.prototype._trySubscribe = function(sink) {
9523
9523
  try {
9524
9524
  return this._subscribe(sink);
9525
9525
  } catch (err) {
9526
9526
  sink.error(err);
9527
9527
  }
9528
9528
  };
9529
- Observable4.prototype.forEach = function(next, promiseCtor) {
9529
+ Observable5.prototype.forEach = function(next, promiseCtor) {
9530
9530
  var _this = this;
9531
9531
  promiseCtor = getPromiseCtor(promiseCtor);
9532
9532
  return new promiseCtor(function(resolve, reject) {
@@ -9545,21 +9545,21 @@ var require_Observable = __commonJS({
9545
9545
  _this.subscribe(subscriber);
9546
9546
  });
9547
9547
  };
9548
- Observable4.prototype._subscribe = function(subscriber) {
9548
+ Observable5.prototype._subscribe = function(subscriber) {
9549
9549
  var _a2;
9550
9550
  return (_a2 = this.source) === null || _a2 === void 0 ? void 0 : _a2.subscribe(subscriber);
9551
9551
  };
9552
- Observable4.prototype[observable_1.observable] = function() {
9552
+ Observable5.prototype[observable_1.observable] = function() {
9553
9553
  return this;
9554
9554
  };
9555
- Observable4.prototype.pipe = function() {
9555
+ Observable5.prototype.pipe = function() {
9556
9556
  var operations = [];
9557
9557
  for (var _i = 0; _i < arguments.length; _i++) {
9558
9558
  operations[_i] = arguments[_i];
9559
9559
  }
9560
9560
  return pipe_1.pipeFromArray(operations)(this);
9561
9561
  };
9562
- Observable4.prototype.toPromise = function(promiseCtor) {
9562
+ Observable5.prototype.toPromise = function(promiseCtor) {
9563
9563
  var _this = this;
9564
9564
  promiseCtor = getPromiseCtor(promiseCtor);
9565
9565
  return new promiseCtor(function(resolve, reject) {
@@ -9573,12 +9573,12 @@ var require_Observable = __commonJS({
9573
9573
  });
9574
9574
  });
9575
9575
  };
9576
- Observable4.create = function(subscribe) {
9577
- return new Observable4(subscribe);
9576
+ Observable5.create = function(subscribe) {
9577
+ return new Observable5(subscribe);
9578
9578
  };
9579
- return Observable4;
9579
+ return Observable5;
9580
9580
  })();
9581
- exports2.Observable = Observable3;
9581
+ exports2.Observable = Observable4;
9582
9582
  function getPromiseCtor(promiseCtor) {
9583
9583
  var _a2;
9584
9584
  return (_a2 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config_1.config.Promise) !== null && _a2 !== void 0 ? _a2 : Promise;
@@ -18746,121 +18746,6 @@ var init_read_file = __esm({
18746
18746
  }
18747
18747
  });
18748
18748
 
18749
- // src/services/log.ts
18750
- var Logger;
18751
- var init_log = __esm({
18752
- "src/services/log.ts"() {
18753
- Logger = class {
18754
- static log(...data) {
18755
- console.log("\x1B[32m%s\x1B[0m", ...data);
18756
- }
18757
- static error(...data) {
18758
- console.error("\x1B[31m%s\x1B[0m", ...data);
18759
- }
18760
- static info(...data) {
18761
- console.info("\x1B[36m%s\x1B[0m", ...data);
18762
- }
18763
- static warn(...data) {
18764
- console.warn("\x1B[33m%s\x1B[0m", ...data);
18765
- }
18766
- static table(...data) {
18767
- console.table(...data);
18768
- }
18769
- };
18770
- }
18771
- });
18772
-
18773
- // src/types.ts
18774
- var import_os, mainDirectory, tokenDirectory, refreshTokenDirectory, urlDirectory, keyDirectory, projectDirectory, generationTimeDirectory, uploadUrlDirectory;
18775
- var init_types = __esm({
18776
- "src/types.ts"() {
18777
- import_os = require("os");
18778
- mainDirectory = [(0, import_os.homedir)(), ".graphql-server"].join("/");
18779
- tokenDirectory = [mainDirectory, "token"].join("/");
18780
- refreshTokenDirectory = [mainDirectory, "refresh"].join("/");
18781
- urlDirectory = [mainDirectory, "url"].join("/");
18782
- keyDirectory = [mainDirectory, "key"].join("/");
18783
- projectDirectory = [mainDirectory, "project"].join("/");
18784
- generationTimeDirectory = [mainDirectory, "generation-time"].join(
18785
- "/"
18786
- );
18787
- uploadUrlDirectory = [mainDirectory, "upload-url"].join("/");
18788
- }
18789
- });
18790
-
18791
- // src/helpers.ts
18792
- function exitWithError(error48) {
18793
- if (error48 instanceof ExitCodeError) {
18794
- Logger.error(error48.message);
18795
- process.exit(error48.code);
18796
- } else {
18797
- Logger.error(error48);
18798
- process.exit(1);
18799
- }
18800
- }
18801
- function lazy(getActionFunc) {
18802
- return async (...args) => {
18803
- try {
18804
- const actionFunc = await getActionFunc();
18805
- await actionFunc(...args);
18806
- process.exit(0);
18807
- } catch (error48) {
18808
- exitWithError(error48);
18809
- }
18810
- };
18811
- }
18812
- function parseProjectId(projectId) {
18813
- return readFileAsObservable(projectDirectory).pipe(
18814
- (0, import_operators.catchError)(() => (0, import_rxjs2.of)("")),
18815
- (0, import_operators.map)((currentProjectId) => projectId ? projectId : currentProjectId),
18816
- (0, import_operators.switchMap)(
18817
- (id) => typeof id !== "string" ? (0, import_rxjs2.throwError)(() => "no-id-provided") : (0, import_rxjs2.of)(id)
18818
- ),
18819
- (0, import_operators.switchMap)((id) => isMongoId(id))
18820
- );
18821
- }
18822
- function outputAllHelp(cmd) {
18823
- cmd.outputHelp();
18824
- cmd.commands.forEach((subCmd) => {
18825
- Logger.info("\n--- Subcommand: " + subCmd.name() + " ---");
18826
- outputAllHelp(subCmd);
18827
- });
18828
- }
18829
- var import_rxjs2, import_operators, CustomError, ExitCodeError, isMongoId;
18830
- var init_helpers = __esm({
18831
- "src/helpers.ts"() {
18832
- import_rxjs2 = __toESM(require_cjs());
18833
- import_operators = __toESM(require_operators());
18834
- init_read_file();
18835
- init_log();
18836
- init_types();
18837
- CustomError = class extends Error {
18838
- get name() {
18839
- return this.constructor.name;
18840
- }
18841
- };
18842
- ExitCodeError = class extends CustomError {
18843
- constructor(code, command) {
18844
- if (command) {
18845
- super(`Command '${command}' exited with code ${code}`);
18846
- } else {
18847
- super(`Child exited with code ${code}`);
18848
- }
18849
- this.code = code;
18850
- }
18851
- };
18852
- isMongoId = (mongoId) => (0, import_rxjs2.of)(mongoId.trim()).pipe(
18853
- (0, import_operators.switchMap)(
18854
- (id) => (0, import_rxjs2.of)(new RegExp("^[0-9a-fA-F]{24}$").test(id)).pipe(
18855
- (0, import_operators.switchMap)(
18856
- (isMongoId2) => isMongoId2 ? (0, import_rxjs2.of)(id) : (0, import_rxjs2.throwError)(() => `not-valid-id`)
18857
- )
18858
- )
18859
- )
18860
- );
18861
- }
18862
- });
18863
-
18864
18749
  // ../../node_modules/@firebase/app/node_modules/tslib/tslib.js
18865
18750
  var require_tslib = __commonJS({
18866
18751
  "../../node_modules/@firebase/app/node_modules/tslib/tslib.js"(exports2, module2) {
@@ -36109,6 +35994,24 @@ var require_index_cjs3 = __commonJS({
36109
35994
  }
36110
35995
  });
36111
35996
 
35997
+ // src/types.ts
35998
+ var import_os, mainDirectory, tokenDirectory, refreshTokenDirectory, urlDirectory, keyDirectory, projectDirectory, generationTimeDirectory, uploadUrlDirectory;
35999
+ var init_types = __esm({
36000
+ "src/types.ts"() {
36001
+ import_os = require("os");
36002
+ mainDirectory = [(0, import_os.homedir)(), ".graphql-server"].join("/");
36003
+ tokenDirectory = [mainDirectory, "token"].join("/");
36004
+ refreshTokenDirectory = [mainDirectory, "refresh"].join("/");
36005
+ urlDirectory = [mainDirectory, "url"].join("/");
36006
+ keyDirectory = [mainDirectory, "key"].join("/");
36007
+ projectDirectory = [mainDirectory, "project"].join("/");
36008
+ generationTimeDirectory = [mainDirectory, "generation-time"].join(
36009
+ "/"
36010
+ );
36011
+ uploadUrlDirectory = [mainDirectory, "upload-url"].join("/");
36012
+ }
36013
+ });
36014
+
36112
36015
  // src/services/types/cluster.fragment.ts
36113
36016
  var ClusterFragment;
36114
36017
  var init_cluster_fragment = __esm({
@@ -36199,6 +36102,8 @@ configs {
36199
36102
  type
36200
36103
  }
36201
36104
  env
36105
+ clusterId
36106
+ clusterName
36202
36107
  method
36203
36108
  createdBy
36204
36109
  createdAt
@@ -36339,14 +36244,14 @@ function gql(...args) {
36339
36244
  }
36340
36245
  return result;
36341
36246
  }
36342
- var import_compressor, firebase, import_rxjs3, import_operators2, GraphqlClienAPI;
36247
+ var import_compressor, firebase, import_rxjs2, import_operators, GraphqlClienAPI;
36343
36248
  var init_gql_client = __esm({
36344
36249
  "src/services/gql-client.ts"() {
36345
36250
  init_index_cjs();
36346
36251
  import_compressor = __toESM(require_dist());
36347
36252
  firebase = __toESM(require_index_cjs3());
36348
- import_rxjs3 = __toESM(require_cjs());
36349
- import_operators2 = __toESM(require_operators());
36253
+ import_rxjs2 = __toESM(require_cjs());
36254
+ import_operators = __toESM(require_operators());
36350
36255
  init_read_file();
36351
36256
  init_types();
36352
36257
  init_cluster_fragment();
@@ -36362,8 +36267,8 @@ var init_gql_client = __esm({
36362
36267
  variables
36363
36268
  }) {
36364
36269
  return this.getConfig().pipe(
36365
- (0, import_operators2.switchMap)(
36366
- ({ token, url: url2 }) => (0, import_rxjs3.from)(
36270
+ (0, import_operators.switchMap)(
36271
+ ({ token, url: url2 }) => (0, import_rxjs2.from)(
36367
36272
  fetch(url2, {
36368
36273
  method: "POST",
36369
36274
  headers: {
@@ -36374,8 +36279,8 @@ var init_gql_client = __esm({
36374
36279
  body: JSON.stringify({ query, variables })
36375
36280
  })
36376
36281
  ).pipe(
36377
- (0, import_operators2.switchMap)((res) => res.json()),
36378
- (0, import_operators2.map)(({ data, errors }) => {
36282
+ (0, import_operators.switchMap)((res) => res.json()),
36283
+ (0, import_operators.map)(({ data, errors }) => {
36379
36284
  if (errors?.length) {
36380
36285
  throw new Error(JSON.stringify(errors, null, 2));
36381
36286
  }
@@ -36397,45 +36302,47 @@ var init_gql_client = __esm({
36397
36302
  }`,
36398
36303
  variables: { lambdaId }
36399
36304
  }).pipe(
36400
- (0, import_operators2.switchMap)((res) => {
36305
+ (0, import_operators.switchMap)((res) => {
36401
36306
  if (!res.getLambda) {
36402
- return (0, import_rxjs3.throwError)(() => "missing-lambda");
36307
+ return (0, import_rxjs2.throwError)(() => "missing-lambda");
36403
36308
  }
36404
- return (0, import_rxjs3.of)(res.getLambda);
36309
+ return (0, import_rxjs2.of)(res.getLambda);
36405
36310
  })
36406
36311
  );
36407
36312
  }
36408
- static getLambdaByName(name2, projectId, fragments) {
36313
+ static getLambdaByName(name2, projectId, fragments, clusterId) {
36409
36314
  return this.query({
36410
- query: gql`query getLambdaByName($projectId: String!, $name: String!) {
36411
- getLambdaByName(projectId: $projectId, name: $name) {
36315
+ query: gql`query getLambdaByName($projectId: String!, $name: String!, $clusterId: String) {
36316
+ getLambdaByName(projectId: $projectId, name: $name, clusterId: $clusterId) {
36412
36317
  ${fragments?.join(" ") || LambdaFragment}
36413
36318
  }
36414
36319
  }`,
36415
36320
  variables: {
36416
36321
  name: name2,
36417
- projectId
36322
+ projectId,
36323
+ clusterId
36418
36324
  }
36419
36325
  }).pipe(
36420
- (0, import_operators2.switchMap)((res) => {
36326
+ (0, import_operators.switchMap)((res) => {
36421
36327
  if (!res.getLambdaByName) {
36422
- return (0, import_rxjs3.throwError)(() => "missing-lambda");
36328
+ return (0, import_rxjs2.throwError)(() => "missing-lambda");
36423
36329
  }
36424
- return (0, import_rxjs3.of)(res.getLambdaByName);
36330
+ return (0, import_rxjs2.of)(res.getLambdaByName);
36425
36331
  })
36426
36332
  );
36427
36333
  }
36428
- static listLambdas(projectId) {
36334
+ static listLambdas(projectId, clusterId) {
36429
36335
  return this.query({
36430
- query: gql`query listProjectLambdas($projectId: String!){
36431
- listProjectLambdas(projectId: $projectId) {
36336
+ query: gql`query listProjectLambdas($projectId: String!, $clusterId: String){
36337
+ listProjectLambdas(projectId: $projectId, clusterId: $clusterId) {
36432
36338
  ${LambdaFragment}
36433
36339
  }
36434
36340
  }`,
36435
36341
  variables: {
36436
- projectId
36342
+ projectId,
36343
+ clusterId
36437
36344
  }
36438
- }).pipe((0, import_operators2.map)((res) => res.listProjectLambdas));
36345
+ }).pipe((0, import_operators.map)((res) => res.listProjectLambdas));
36439
36346
  }
36440
36347
  static createLambda(payload) {
36441
36348
  return this.query({
@@ -36445,7 +36352,7 @@ var init_gql_client = __esm({
36445
36352
  }
36446
36353
  }`,
36447
36354
  variables: { payload }
36448
- }).pipe((0, import_operators2.map)((res) => res.createLambda));
36355
+ }).pipe((0, import_operators.map)((res) => res.createLambda));
36449
36356
  }
36450
36357
  static updateLambda(payload) {
36451
36358
  return this.query({
@@ -36455,7 +36362,7 @@ var init_gql_client = __esm({
36455
36362
  }
36456
36363
  }`,
36457
36364
  variables: { payload }
36458
- }).pipe((0, import_operators2.map)((res) => res.updateLambda));
36365
+ }).pipe((0, import_operators.map)((res) => res.updateLambda));
36459
36366
  }
36460
36367
  static getLambdaLogs(lambdaId) {
36461
36368
  return this.query({
@@ -36468,8 +36375,8 @@ var init_gql_client = __esm({
36468
36375
  `,
36469
36376
  variables: { lambdaId }
36470
36377
  }).pipe(
36471
- (0, import_operators2.map)((res) => res.getLambdaLogs),
36472
- (0, import_operators2.map)(
36378
+ (0, import_operators.map)((res) => res.getLambdaLogs),
36379
+ (0, import_operators.map)(
36473
36380
  (logs) => ({
36474
36381
  ...logs,
36475
36382
  data: import_compressor.LZWService.decompress(logs.data)
@@ -36477,19 +36384,27 @@ var init_gql_client = __esm({
36477
36384
  )
36478
36385
  );
36479
36386
  }
36480
- static getLambdaLogsByName(name2, projectId) {
36387
+ static getLambdaLogsByName(name2, projectId, clusterId) {
36481
36388
  return this.query({
36482
36389
  query: gql`
36483
- query getLambdaLogsByName($projectId: String!, $name: String!) {
36484
- getLambdaLogsByName(projectId: $projectId, name: $name) {
36390
+ query getLambdaLogsByName(
36391
+ $projectId: String!
36392
+ $name: String!
36393
+ $clusterId: String
36394
+ ) {
36395
+ getLambdaLogsByName(
36396
+ projectId: $projectId
36397
+ name: $name
36398
+ clusterId: $clusterId
36399
+ ) {
36485
36400
  data
36486
36401
  }
36487
36402
  }
36488
36403
  `,
36489
- variables: { name: name2, projectId }
36404
+ variables: { name: name2, projectId, clusterId }
36490
36405
  }).pipe(
36491
- (0, import_operators2.map)((res) => res.getLambdaLogsByName),
36492
- (0, import_operators2.map)(
36406
+ (0, import_operators.map)((res) => res.getLambdaLogsByName),
36407
+ (0, import_operators.map)(
36493
36408
  (logs) => ({
36494
36409
  ...logs,
36495
36410
  data: import_compressor.LZWService.decompress(logs.data)
@@ -36508,8 +36423,8 @@ var init_gql_client = __esm({
36508
36423
  `,
36509
36424
  variables: { lambdaId }
36510
36425
  }).pipe(
36511
- (0, import_operators2.map)((res) => res.getLambdaBuilderLogs),
36512
- (0, import_operators2.map)(
36426
+ (0, import_operators.map)((res) => res.getLambdaBuilderLogs),
36427
+ (0, import_operators.map)(
36513
36428
  (logs) => ({
36514
36429
  ...logs,
36515
36430
  data: import_compressor.LZWService.decompress(logs.data)
@@ -36517,19 +36432,27 @@ var init_gql_client = __esm({
36517
36432
  )
36518
36433
  );
36519
36434
  }
36520
- static getLambdaBuilderLogsByName(name2, projectId) {
36435
+ static getLambdaBuilderLogsByName(name2, projectId, clusterId) {
36521
36436
  return this.query({
36522
36437
  query: gql`
36523
- query getLambdaBuilderLogsByName($projectId: String!, $name: String!) {
36524
- getLambdaBuilderLogsByName(projectId: $projectId, name: $name) {
36438
+ query getLambdaBuilderLogsByName(
36439
+ $projectId: String!
36440
+ $name: String!
36441
+ $clusterId: String
36442
+ ) {
36443
+ getLambdaBuilderLogsByName(
36444
+ projectId: $projectId
36445
+ name: $name
36446
+ clusterId: $clusterId
36447
+ ) {
36525
36448
  data
36526
36449
  }
36527
36450
  }
36528
36451
  `,
36529
- variables: { name: name2, projectId }
36452
+ variables: { name: name2, projectId, clusterId }
36530
36453
  }).pipe(
36531
- (0, import_operators2.map)((res) => res.getLambdaBuilderLogsByName),
36532
- (0, import_operators2.map)(
36454
+ (0, import_operators.map)((res) => res.getLambdaBuilderLogsByName),
36455
+ (0, import_operators.map)(
36533
36456
  (logs) => ({
36534
36457
  ...logs,
36535
36458
  data: import_compressor.LZWService.decompress(logs.data)
@@ -36547,7 +36470,7 @@ var init_gql_client = __esm({
36547
36470
  }
36548
36471
  `,
36549
36472
  variables: { payload }
36550
- }).pipe((0, import_operators2.map)((res) => res.deleteLambda));
36473
+ }).pipe((0, import_operators.map)((res) => res.deleteLambda));
36551
36474
  }
36552
36475
  static listProjects() {
36553
36476
  return this.query({
@@ -36556,7 +36479,7 @@ var init_gql_client = __esm({
36556
36479
  ${ProjectFragment}
36557
36480
  }
36558
36481
  }`
36559
- }).pipe((0, import_operators2.map)((res) => res.listProjects));
36482
+ }).pipe((0, import_operators.map)((res) => res.listProjects));
36560
36483
  }
36561
36484
  static getProject(id) {
36562
36485
  return this.query({
@@ -36568,7 +36491,7 @@ var init_gql_client = __esm({
36568
36491
  variables: {
36569
36492
  id
36570
36493
  }
36571
- }).pipe((0, import_operators2.map)((res) => res.listProjects));
36494
+ }).pipe((0, import_operators.map)((res) => res.listProjects));
36572
36495
  }
36573
36496
  static listEnvironments(projectId) {
36574
36497
  return this.query({
@@ -36580,20 +36503,21 @@ var init_gql_client = __esm({
36580
36503
  variables: {
36581
36504
  projectId
36582
36505
  }
36583
- }).pipe((0, import_operators2.map)((res) => res.listEnvironmentsByProjectId));
36506
+ }).pipe((0, import_operators.map)((res) => res.listEnvironmentsByProjectId));
36584
36507
  }
36585
- static getEnvironment(name2, projectId) {
36508
+ static getEnvironment(name2, projectId, clusterId) {
36586
36509
  return this.query({
36587
- query: gql`query getEnvironment($name: String!, $projectId: String!) {
36588
- getEnvironment(name: $name, projectId: $projectId) {
36510
+ query: gql`query getEnvironment($name: String!, $projectId: String!, $clusterId: String) {
36511
+ getEnvironment(name: $name, projectId: $projectId, clusterId: $clusterId) {
36589
36512
  ${EnvironmentFragment}
36590
36513
  }
36591
36514
  }`,
36592
36515
  variables: {
36593
36516
  name: name2,
36594
- projectId
36517
+ projectId,
36518
+ clusterId
36595
36519
  }
36596
- }).pipe((0, import_operators2.map)((res) => res.getEnvironment));
36520
+ }).pipe((0, import_operators.map)((res) => res.getEnvironment));
36597
36521
  }
36598
36522
  static createEnvironment(projectId, payload) {
36599
36523
  return this.query({
@@ -36611,17 +36535,18 @@ var init_gql_client = __esm({
36611
36535
  projectId,
36612
36536
  payload
36613
36537
  }
36614
- }).pipe((0, import_operators2.map)((res) => res.createEnvironment));
36538
+ }).pipe((0, import_operators.map)((res) => res.createEnvironment));
36615
36539
  }
36616
- static deleteEnvironment(name2, projectId, force) {
36540
+ static deleteEnvironment(name2, projectId, force, clusterId) {
36617
36541
  return this.query({
36618
36542
  query: gql`
36619
36543
  mutation deleteEnvironmentByName(
36620
36544
  $name: String!
36621
36545
  $projectId: String!
36622
36546
  $force: Boolean
36547
+ $clusterId: String
36623
36548
  ) {
36624
- deleteEnvironmentByName(name: $name, projectId: $projectId, force: $force) {
36549
+ deleteEnvironmentByName(name: $name, projectId: $projectId, force: $force, clusterId: $clusterId) {
36625
36550
  ${EnvironmentFragment}
36626
36551
  }
36627
36552
  }
@@ -36629,9 +36554,10 @@ var init_gql_client = __esm({
36629
36554
  variables: {
36630
36555
  name: name2,
36631
36556
  projectId,
36632
- force
36557
+ force,
36558
+ clusterId
36633
36559
  }
36634
- }).pipe((0, import_operators2.map)((res) => res.deleteEnvironmentByName));
36560
+ }).pipe((0, import_operators.map)((res) => res.deleteEnvironmentByName));
36635
36561
  }
36636
36562
  static updateEnvironment(projectId, payload) {
36637
36563
  return this.query({
@@ -36649,7 +36575,7 @@ var init_gql_client = __esm({
36649
36575
  projectId,
36650
36576
  payload
36651
36577
  }
36652
- }).pipe((0, import_operators2.map)((res) => res.updateEnvironmentByName));
36578
+ }).pipe((0, import_operators.map)((res) => res.updateEnvironmentByName));
36653
36579
  }
36654
36580
  static listProjectTimeTriggers(projectId) {
36655
36581
  return this.query({
@@ -36663,7 +36589,7 @@ var init_gql_client = __esm({
36663
36589
  variables: {
36664
36590
  projectId
36665
36591
  }
36666
- }).pipe((0, import_operators2.map)((res) => res.listProjectTimeTriggers));
36592
+ }).pipe((0, import_operators.map)((res) => res.listProjectTimeTriggers));
36667
36593
  }
36668
36594
  static createTimeTrigger(payload) {
36669
36595
  return this.query({
@@ -36677,7 +36603,7 @@ var init_gql_client = __esm({
36677
36603
  variables: {
36678
36604
  payload
36679
36605
  }
36680
- }).pipe((0, import_operators2.map)((res) => res.createLambdaTimeTrigger));
36606
+ }).pipe((0, import_operators.map)((res) => res.createLambdaTimeTrigger));
36681
36607
  }
36682
36608
  static deleteLambdaTimeTrigger(lambdaId) {
36683
36609
  return this.query({
@@ -36691,7 +36617,7 @@ var init_gql_client = __esm({
36691
36617
  variables: {
36692
36618
  lambdaId
36693
36619
  }
36694
- }).pipe((0, import_operators2.map)((res) => res.deleteLambdaTimeTrigger));
36620
+ }).pipe((0, import_operators.map)((res) => res.deleteLambdaTimeTrigger));
36695
36621
  }
36696
36622
  // --------------------------------------------------------------------
36697
36623
  // Cluster (project-level; resolved by cluster-provisioner via the
@@ -36724,7 +36650,7 @@ var init_gql_client = __esm({
36724
36650
  }
36725
36651
  `,
36726
36652
  variables: { projectId, ...input }
36727
- }).pipe((0, import_operators2.map)((res) => res.provisionProjectCluster));
36653
+ }).pipe((0, import_operators.map)((res) => res.provisionProjectCluster));
36728
36654
  }
36729
36655
  static projectClusters(projectId) {
36730
36656
  return this.query({
@@ -36736,7 +36662,7 @@ var init_gql_client = __esm({
36736
36662
  }
36737
36663
  `,
36738
36664
  variables: { projectId }
36739
- }).pipe((0, import_operators2.map)((res) => res.projectClusters));
36665
+ }).pipe((0, import_operators.map)((res) => res.projectClusters));
36740
36666
  }
36741
36667
  static teardownProjectCluster(projectId, clusterId) {
36742
36668
  return this.query({
@@ -36751,7 +36677,7 @@ var init_gql_client = __esm({
36751
36677
  }
36752
36678
  `,
36753
36679
  variables: { projectId, clusterId }
36754
- }).pipe((0, import_operators2.map)((res) => res.teardownProjectCluster));
36680
+ }).pipe((0, import_operators.map)((res) => res.teardownProjectCluster));
36755
36681
  }
36756
36682
  static clusterKubeconfig(projectId, clusterId) {
36757
36683
  return this.query({
@@ -36761,7 +36687,7 @@ var init_gql_client = __esm({
36761
36687
  }
36762
36688
  `,
36763
36689
  variables: { projectId, clusterId }
36764
- }).pipe((0, import_operators2.map)((res) => res.clusterKubeconfig));
36690
+ }).pipe((0, import_operators.map)((res) => res.clusterKubeconfig));
36765
36691
  }
36766
36692
  // --------------------------------------------------------------------
36767
36693
  // RabbitMQ brokers (graphql-server-lambdas) - a project may have
@@ -36780,7 +36706,7 @@ var init_gql_client = __esm({
36780
36706
  }
36781
36707
  `,
36782
36708
  variables: { projectId, payload }
36783
- }).pipe((0, import_operators2.map)((res) => res.installRabbitMq));
36709
+ }).pipe((0, import_operators.map)((res) => res.installRabbitMq));
36784
36710
  }
36785
36711
  static listRabbitMqInstances(projectId) {
36786
36712
  return this.query({
@@ -36792,7 +36718,7 @@ var init_gql_client = __esm({
36792
36718
  }
36793
36719
  `,
36794
36720
  variables: { projectId }
36795
- }).pipe((0, import_operators2.map)((res) => res.listRabbitMqInstances));
36721
+ }).pipe((0, import_operators.map)((res) => res.listRabbitMqInstances));
36796
36722
  }
36797
36723
  static uninstallRabbitMq(id, projectId) {
36798
36724
  return this.query({
@@ -36804,7 +36730,7 @@ var init_gql_client = __esm({
36804
36730
  }
36805
36731
  `,
36806
36732
  variables: { id, projectId }
36807
- }).pipe((0, import_operators2.map)((res) => res.uninstallRabbitMq));
36733
+ }).pipe((0, import_operators.map)((res) => res.uninstallRabbitMq));
36808
36734
  }
36809
36735
  // --------------------------------------------------------------------
36810
36736
  // Marketplace plugins (graphql-server-lambdas) - a project may have the
@@ -36820,7 +36746,7 @@ var init_gql_client = __esm({
36820
36746
  }
36821
36747
  `,
36822
36748
  variables: {}
36823
- }).pipe((0, import_operators2.map)((res) => res.listAvailablePlugins));
36749
+ }).pipe((0, import_operators.map)((res) => res.listAvailablePlugins));
36824
36750
  }
36825
36751
  static listInstalledPlugins(projectId) {
36826
36752
  return this.query({
@@ -36832,7 +36758,7 @@ var init_gql_client = __esm({
36832
36758
  }
36833
36759
  `,
36834
36760
  variables: { projectId }
36835
- }).pipe((0, import_operators2.map)((res) => res.listInstalledPlugins));
36761
+ }).pipe((0, import_operators.map)((res) => res.listInstalledPlugins));
36836
36762
  }
36837
36763
  static installPlugin(projectId, pluginName, config2, clusterId) {
36838
36764
  return this.query({
@@ -36854,7 +36780,7 @@ var init_gql_client = __esm({
36854
36780
  }
36855
36781
  `,
36856
36782
  variables: { projectId, pluginName, config: config2, clusterId }
36857
- }).pipe((0, import_operators2.map)((res) => res.installPlugin));
36783
+ }).pipe((0, import_operators.map)((res) => res.installPlugin));
36858
36784
  }
36859
36785
  static uninstallPlugin(projectId, pluginName, clusterId) {
36860
36786
  return this.query({
@@ -36872,20 +36798,20 @@ var init_gql_client = __esm({
36872
36798
  }
36873
36799
  `,
36874
36800
  variables: { projectId, pluginName, clusterId }
36875
- }).pipe((0, import_operators2.map)((res) => res.uninstallPlugin));
36801
+ }).pipe((0, import_operators.map)((res) => res.uninstallPlugin));
36876
36802
  }
36877
36803
  static getConfig(force = false) {
36878
- return (0, import_rxjs3.combineLatest)([
36804
+ return (0, import_rxjs2.combineLatest)([
36879
36805
  readFileAsObservable(tokenDirectory),
36880
36806
  readFileAsObservable(urlDirectory),
36881
36807
  readFileAsObservable(refreshTokenDirectory),
36882
36808
  readFileAsObservable(keyDirectory),
36883
36809
  readFileAsObservable(generationTimeDirectory).pipe(
36884
- (0, import_operators2.map)((date5) => Number(date5))
36810
+ (0, import_operators.map)((date5) => Number(date5))
36885
36811
  ),
36886
36812
  readFileAsObservable(uploadUrlDirectory)
36887
36813
  ]).pipe(
36888
- (0, import_operators2.map)(([token, url2, refresh, key, timeGenerated, uploadUrl]) => ({
36814
+ (0, import_operators.map)(([token, url2, refresh, key, timeGenerated, uploadUrl]) => ({
36889
36815
  token,
36890
36816
  url: url2,
36891
36817
  refresh,
@@ -36894,15 +36820,15 @@ var init_gql_client = __esm({
36894
36820
  expired: force || (Date.now() - timeGenerated) / 1e3 > 1800,
36895
36821
  uploadUrl
36896
36822
  })),
36897
- (0, import_operators2.switchMap)(
36823
+ (0, import_operators.switchMap)(
36898
36824
  (config2) => config2.expired ? this.refreshToken(config2.key, config2.refresh).pipe(
36899
- (0, import_operators2.map)(({ id_token }) => ({ ...config2, token: id_token }))
36900
- ) : (0, import_rxjs3.of)(config2)
36825
+ (0, import_operators.map)(({ id_token }) => ({ ...config2, token: id_token }))
36826
+ ) : (0, import_rxjs2.of)(config2)
36901
36827
  )
36902
36828
  );
36903
36829
  }
36904
36830
  static refreshToken(key, refresh_token) {
36905
- return (0, import_rxjs3.from)(
36831
+ return (0, import_rxjs2.from)(
36906
36832
  fetch(`https://securetoken.googleapis.com/v1/token?key=${key}`, {
36907
36833
  method: "POST",
36908
36834
  body: JSON.stringify({
@@ -36911,23 +36837,23 @@ var init_gql_client = __esm({
36911
36837
  })
36912
36838
  })
36913
36839
  ).pipe(
36914
- (0, import_operators2.switchMap)(
36840
+ (0, import_operators.switchMap)(
36915
36841
  (res) => res.json()
36916
36842
  ),
36917
- (0, import_operators2.switchMap)(
36918
- (cfg) => (0, import_rxjs3.combineLatest)([
36843
+ (0, import_operators.switchMap)(
36844
+ (cfg) => (0, import_rxjs2.combineLatest)([
36919
36845
  writeFileAsObservable(tokenDirectory, cfg.id_token),
36920
36846
  writeFileAsObservable(refreshTokenDirectory, cfg.refresh_token),
36921
36847
  writeFileAsObservable(generationTimeDirectory, Date.now().toString())
36922
- ]).pipe((0, import_operators2.map)(() => cfg))
36848
+ ]).pipe((0, import_operators.map)(() => cfg))
36923
36849
  )
36924
36850
  );
36925
36851
  }
36926
36852
  static signIn(customToken) {
36927
- return (0, import_rxjs3.from)(firebase.auth().signInWithCustomToken(customToken)).pipe(
36928
- (0, import_operators2.switchMap)(
36929
- ({ user }) => (0, import_rxjs3.combineLatest)([user.getIdToken(), (0, import_rxjs3.of)(user.refreshToken)]).pipe(
36930
- (0, import_operators2.map)(([token, refresh]) => ({ user, token, refresh }))
36853
+ return (0, import_rxjs2.from)(firebase.auth().signInWithCustomToken(customToken)).pipe(
36854
+ (0, import_operators.switchMap)(
36855
+ ({ user }) => (0, import_rxjs2.combineLatest)([user.getIdToken(), (0, import_rxjs2.of)(user.refreshToken)]).pipe(
36856
+ (0, import_operators.map)(([token, refresh]) => ({ user, token, refresh }))
36931
36857
  )
36932
36858
  )
36933
36859
  );
@@ -36941,6 +36867,121 @@ var init_gql_client = __esm({
36941
36867
  }
36942
36868
  });
36943
36869
 
36870
+ // src/services/log.ts
36871
+ var Logger;
36872
+ var init_log = __esm({
36873
+ "src/services/log.ts"() {
36874
+ Logger = class {
36875
+ static log(...data) {
36876
+ console.log("\x1B[32m%s\x1B[0m", ...data);
36877
+ }
36878
+ static error(...data) {
36879
+ console.error("\x1B[31m%s\x1B[0m", ...data);
36880
+ }
36881
+ static info(...data) {
36882
+ console.info("\x1B[36m%s\x1B[0m", ...data);
36883
+ }
36884
+ static warn(...data) {
36885
+ console.warn("\x1B[33m%s\x1B[0m", ...data);
36886
+ }
36887
+ static table(...data) {
36888
+ console.table(...data);
36889
+ }
36890
+ };
36891
+ }
36892
+ });
36893
+
36894
+ // src/helpers.ts
36895
+ function exitWithError(error48) {
36896
+ if (error48 instanceof ExitCodeError) {
36897
+ Logger.error(error48.message);
36898
+ process.exit(error48.code);
36899
+ } else {
36900
+ Logger.error(error48);
36901
+ process.exit(1);
36902
+ }
36903
+ }
36904
+ function lazy(getActionFunc) {
36905
+ return async (...args) => {
36906
+ try {
36907
+ const actionFunc = await getActionFunc();
36908
+ await actionFunc(...args);
36909
+ process.exit(0);
36910
+ } catch (e2) {
36911
+ const error48 = e2;
36912
+ exitWithError(error48);
36913
+ }
36914
+ };
36915
+ }
36916
+ function parseProjectId(projectId) {
36917
+ return readFileAsObservable(projectDirectory).pipe(
36918
+ (0, import_operators2.catchError)(() => (0, import_rxjs3.of)("")),
36919
+ (0, import_operators2.map)((currentProjectId) => projectId ? projectId : currentProjectId),
36920
+ (0, import_operators2.switchMap)(
36921
+ (id) => typeof id !== "string" ? (0, import_rxjs3.throwError)(() => "no-id-provided") : (0, import_rxjs3.of)(id)
36922
+ ),
36923
+ (0, import_operators2.switchMap)((id) => isMongoId(id))
36924
+ );
36925
+ }
36926
+ function resolveClusterId(projectId, hint) {
36927
+ if (hint.clusterId != null) {
36928
+ return (0, import_rxjs3.of)(hint.clusterId);
36929
+ }
36930
+ if (!hint.clusterName) {
36931
+ return (0, import_rxjs3.of)(void 0);
36932
+ }
36933
+ return GraphqlClienAPI.projectClusters(projectId).pipe(
36934
+ (0, import_operators2.map)((clusters) => clusters.find((c) => c.name === hint.clusterName)),
36935
+ (0, import_operators2.switchMap)(
36936
+ (cluster) => cluster?.id ? (0, import_rxjs3.of)(cluster.id) : (0, import_rxjs3.throwError)(
36937
+ () => `No cluster named "${hint.clusterName}" found in this project - run "gcli cluster:list --project ${projectId}" to see available clusters.`
36938
+ )
36939
+ )
36940
+ );
36941
+ }
36942
+ function outputAllHelp(cmd) {
36943
+ cmd.outputHelp();
36944
+ cmd.commands.forEach((subCmd) => {
36945
+ Logger.info("\n--- Subcommand: " + subCmd.name() + " ---");
36946
+ outputAllHelp(subCmd);
36947
+ });
36948
+ }
36949
+ var import_rxjs3, import_operators2, CustomError, ExitCodeError, isMongoId;
36950
+ var init_helpers = __esm({
36951
+ "src/helpers.ts"() {
36952
+ import_rxjs3 = __toESM(require_cjs());
36953
+ import_operators2 = __toESM(require_operators());
36954
+ init_read_file();
36955
+ init_gql_client();
36956
+ init_log();
36957
+ init_types();
36958
+ CustomError = class extends Error {
36959
+ get name() {
36960
+ return this.constructor.name;
36961
+ }
36962
+ };
36963
+ ExitCodeError = class extends CustomError {
36964
+ constructor(code, command) {
36965
+ if (command) {
36966
+ super(`Command '${command}' exited with code ${code}`);
36967
+ } else {
36968
+ super(`Child exited with code ${code}`);
36969
+ }
36970
+ this.code = code;
36971
+ }
36972
+ };
36973
+ isMongoId = (mongoId) => (0, import_rxjs3.of)(mongoId.trim()).pipe(
36974
+ (0, import_operators2.switchMap)(
36975
+ (id) => (0, import_rxjs3.of)(new RegExp("^[0-9a-fA-F]{24}$").test(id)).pipe(
36976
+ (0, import_operators2.switchMap)(
36977
+ (isMongoId2) => isMongoId2 ? (0, import_rxjs3.of)(id) : (0, import_rxjs3.throwError)(() => `not-valid-id`)
36978
+ )
36979
+ )
36980
+ )
36981
+ );
36982
+ }
36983
+ });
36984
+
36944
36985
  // src/commands/auth/login.ts
36945
36986
  var login_exports = {};
36946
36987
  __export(login_exports, {
@@ -253462,44 +253503,55 @@ var init_create_environment = __esm({
253462
253503
  init_gql_client();
253463
253504
  init_log();
253464
253505
  init_load_spec();
253465
- create_environment_default = (cmd) => (0, import_rxjs13.lastValueFrom)(
253466
- parseProjectId(cmd.project).pipe(
253467
- (0, import_operators12.switchMap)(
253468
- (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
253469
- (0, import_operators12.map)((data) => ({
253470
- projectId,
253471
- ...data?.environment ?? data
253472
- }))
253473
- )
253474
- ),
253475
- (0, import_operators12.switchMap)(
253476
- ({ projectId, ...data }) => GraphqlClienAPI.createEnvironment(projectId, {
253477
- ...data,
253478
- ...cmd
253506
+ create_environment_default = (cmd) => {
253507
+ const { clusterName: cmdClusterName, ...cmdRest } = cmd;
253508
+ return (0, import_rxjs13.lastValueFrom)(
253509
+ parseProjectId(cmd.project).pipe(
253510
+ (0, import_operators12.switchMap)(
253511
+ (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
253512
+ (0, import_operators12.map)((data) => ({
253513
+ projectId,
253514
+ ...data?.environment ?? data
253515
+ }))
253516
+ )
253517
+ ),
253518
+ (0, import_operators12.switchMap)(
253519
+ ({ projectId, clusterName: dataClusterName, ...data }) => resolveClusterId(projectId, {
253520
+ clusterId: cmdRest.clusterId || data.clusterId,
253521
+ clusterName: cmdClusterName || dataClusterName
253522
+ }).pipe(
253523
+ (0, import_operators12.switchMap)(
253524
+ (clusterId) => GraphqlClienAPI.createEnvironment(projectId, {
253525
+ ...data,
253526
+ ...cmdRest,
253527
+ clusterId
253528
+ })
253529
+ )
253530
+ )
253531
+ ),
253532
+ (0, import_operators12.tap)((data) => {
253533
+ const columns = [
253534
+ "id",
253535
+ "name",
253536
+ "image",
253537
+ "builder",
253538
+ "poolSize",
253539
+ "minCpu",
253540
+ "maxCpu",
253541
+ "minMemory",
253542
+ "maxMemory",
253543
+ "region",
253544
+ "clusterId",
253545
+ "clusterName"
253546
+ ];
253547
+ Logger.log("-------------------");
253548
+ Logger.log("[Action][createEnvironment]");
253549
+ Logger.table([data], columns);
253550
+ Logger.log("-------------------");
253479
253551
  })
253480
- ),
253481
- (0, import_operators12.tap)((data) => {
253482
- const columns = [
253483
- "id",
253484
- "name",
253485
- "image",
253486
- "builder",
253487
- "poolSize",
253488
- "minCpu",
253489
- "maxCpu",
253490
- "minMemory",
253491
- "maxMemory",
253492
- "region",
253493
- "clusterId",
253494
- "clusterName"
253495
- ];
253496
- Logger.log("-------------------");
253497
- Logger.log("[Action][createEnvironment]");
253498
- Logger.table([data], columns);
253499
- Logger.log("-------------------");
253500
- })
253501
- )
253502
- );
253552
+ )
253553
+ );
253554
+ };
253503
253555
  }
253504
253556
  });
253505
253557
 
@@ -253517,45 +253569,56 @@ var init_update_environment = __esm({
253517
253569
  init_gql_client();
253518
253570
  init_log();
253519
253571
  init_load_spec();
253520
- update_environment_default = (cmd) => (0, import_rxjs14.lastValueFrom)(
253521
- parseProjectId(cmd.project).pipe(
253522
- (0, import_operators13.switchMap)(
253523
- (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
253524
- (0, import_operators13.map)((data) => ({
253525
- projectId,
253526
- ...data?.environment ?? data
253527
- }))
253528
- )
253529
- ),
253530
- (0, import_operators13.tap)(Logger.log),
253531
- (0, import_operators13.switchMap)(
253532
- ({ projectId, ...data }) => GraphqlClienAPI.updateEnvironment(projectId, {
253533
- ...data,
253534
- ...cmd
253572
+ update_environment_default = (cmd) => {
253573
+ const { clusterName: cmdClusterName, ...cmdRest } = cmd;
253574
+ return (0, import_rxjs14.lastValueFrom)(
253575
+ parseProjectId(cmd.project).pipe(
253576
+ (0, import_operators13.switchMap)(
253577
+ (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
253578
+ (0, import_operators13.map)((data) => ({
253579
+ projectId,
253580
+ ...data?.environment ?? data
253581
+ }))
253582
+ )
253583
+ ),
253584
+ (0, import_operators13.tap)(Logger.log),
253585
+ (0, import_operators13.switchMap)(
253586
+ ({ projectId, clusterName: dataClusterName, ...data }) => resolveClusterId(projectId, {
253587
+ clusterId: cmdRest.clusterId || data.clusterId,
253588
+ clusterName: cmdClusterName || dataClusterName
253589
+ }).pipe(
253590
+ (0, import_operators13.switchMap)(
253591
+ (clusterId) => GraphqlClienAPI.updateEnvironment(projectId, {
253592
+ ...data,
253593
+ ...cmdRest,
253594
+ clusterId
253595
+ })
253596
+ )
253597
+ )
253598
+ ),
253599
+ (0, import_operators13.tap)((data) => {
253600
+ const columns = [
253601
+ "id",
253602
+ "name",
253603
+ "image",
253604
+ "builder",
253605
+ "poolSize",
253606
+ "minCpu",
253607
+ "maxCpu",
253608
+ "minMemory",
253609
+ "maxMemory",
253610
+ "region",
253611
+ "clusterId",
253612
+ "clusterName"
253613
+ ];
253614
+ Logger.log("-------------------");
253615
+ Logger.log("[Action][updateEnvironment]");
253616
+ Logger.table([data], columns);
253617
+ Logger.log("-------------------");
253535
253618
  })
253536
- ),
253537
- (0, import_operators13.tap)((data) => {
253538
- const columns = [
253539
- "id",
253540
- "name",
253541
- "image",
253542
- "builder",
253543
- "poolSize",
253544
- "minCpu",
253545
- "maxCpu",
253546
- "minMemory",
253547
- "maxMemory",
253548
- "region",
253549
- "clusterId",
253550
- "clusterName"
253551
- ];
253552
- Logger.log("-------------------");
253553
- Logger.log("[Action][updateEnvironment]");
253554
- Logger.table([data], columns);
253555
- Logger.log("-------------------");
253556
- })
253557
- )
253558
- );
253619
+ )
253620
+ );
253621
+ };
253559
253622
  }
253560
253623
  });
253561
253624
 
@@ -253584,7 +253647,19 @@ var init_delete_environment = __esm({
253584
253647
  )
253585
253648
  ),
253586
253649
  (0, import_operators14.switchMap)(
253587
- ({ projectId, name: name2 }) => GraphqlClienAPI.deleteEnvironment(name2, projectId, cmd.force)
253650
+ ({ projectId, name: name2 }) => resolveClusterId(projectId, {
253651
+ clusterId: cmd.clusterId,
253652
+ clusterName: cmd.clusterName
253653
+ }).pipe(
253654
+ (0, import_operators14.switchMap)(
253655
+ (clusterId) => GraphqlClienAPI.deleteEnvironment(
253656
+ name2,
253657
+ projectId,
253658
+ cmd.force,
253659
+ clusterId
253660
+ )
253661
+ )
253662
+ )
253588
253663
  ),
253589
253664
  (0, import_operators14.tap)((data) => {
253590
253665
  const columns = [
@@ -253634,7 +253709,18 @@ var init_get_environment = __esm({
253634
253709
  )
253635
253710
  ),
253636
253711
  (0, import_operators15.switchMap)(
253637
- ({ projectId, name: name2 }) => GraphqlClienAPI.getEnvironment(cmd.name ?? name2, projectId)
253712
+ ({ projectId, name: name2 }) => resolveClusterId(projectId, {
253713
+ clusterId: cmd.clusterId,
253714
+ clusterName: cmd.clusterName
253715
+ }).pipe(
253716
+ (0, import_operators15.switchMap)(
253717
+ (clusterId) => GraphqlClienAPI.getEnvironment(
253718
+ cmd.name ?? name2,
253719
+ projectId,
253720
+ clusterId
253721
+ )
253722
+ )
253723
+ )
253638
253724
  ),
253639
253725
  (0, import_operators15.tap)((data) => {
253640
253726
  const columns = [
@@ -284993,6 +285079,12 @@ var init_helpers2 = __esm({
284993
285079
  );
284994
285080
  }),
284995
285081
  (0, import_operators17.switchMap)(async (payload) => {
285082
+ const clusterId = await (0, import_rxjs18.lastValueFrom)(
285083
+ resolveClusterId(payload.projectId, {
285084
+ clusterId: cmd.clusterId || payload.clusterId,
285085
+ clusterName: cmd.clusterName || payload.clusterName
285086
+ })
285087
+ );
284996
285088
  return (0, import_rxjs18.lastValueFrom)(
284997
285089
  GraphqlClienAPI[type]({
284998
285090
  code: cmd.code || await (0, import_rxjs18.lastValueFrom)(ReadFile2(cmd.file || payload.file)) || "",
@@ -285007,6 +285099,7 @@ var init_helpers2 = __esm({
285007
285099
  params: cmd.params || payload.params || [],
285008
285100
  secrets: cmd.secrets || payload.secrets || [],
285009
285101
  envSecrets: cmd.envSecrets || payload.envSecrets || [],
285102
+ clusterId,
285010
285103
  network: cmd.network || payload.network || ["public", "private"],
285011
285104
  federation: cmd.federation ?? !!payload.federation,
285012
285105
  subgraphs: cmd.subgraphs || payload.subgraphs || [],
@@ -285065,9 +285158,24 @@ var init_list2 = __esm({
285065
285158
  init_log();
285066
285159
  list_default2 = (cmd) => (0, import_rxjs19.lastValueFrom)(
285067
285160
  parseProjectId(cmd.project).pipe(
285068
- (0, import_operators18.switchMap)((projectId) => GraphqlClienAPI.listLambdas(projectId)),
285161
+ (0, import_operators18.switchMap)(
285162
+ (projectId) => resolveClusterId(projectId, {
285163
+ clusterId: cmd.clusterId,
285164
+ clusterName: cmd.clusterName
285165
+ }).pipe(
285166
+ (0, import_operators18.switchMap)(
285167
+ (clusterId) => GraphqlClienAPI.listLambdas(projectId, clusterId)
285168
+ )
285169
+ )
285170
+ ),
285069
285171
  (0, import_operators18.tap)((data) => {
285070
- const columns = ["id", "name", "url"];
285172
+ const columns = [
285173
+ "id",
285174
+ "name",
285175
+ "url",
285176
+ "clusterId",
285177
+ "clusterName"
285178
+ ];
285071
285179
  Logger.log("-------------------");
285072
285180
  Logger.log("[Action][listLambdas]");
285073
285181
  Logger.table(data, columns);
@@ -285098,7 +285206,9 @@ var init_get = __esm({
285098
285206
  "name",
285099
285207
  "projectId",
285100
285208
  "url",
285101
- "method"
285209
+ "method",
285210
+ "clusterId",
285211
+ "clusterName"
285102
285212
  ];
285103
285213
  Logger.log("-------------------");
285104
285214
  Logger.log("[Action][getLambda]");
@@ -285128,7 +285238,19 @@ var init_get = __esm({
285128
285238
  return (0, import_rxjs20.throwError)(() => error48);
285129
285239
  }),
285130
285240
  (0, import_operators19.switchMap)(
285131
- (projectId) => GraphqlClienAPI.getLambdaByName(name2, projectId)
285241
+ (projectId) => resolveClusterId(projectId, {
285242
+ clusterId: cmd.clusterId,
285243
+ clusterName: cmd.clusterName
285244
+ }).pipe(
285245
+ (0, import_operators19.switchMap)(
285246
+ (clusterId) => GraphqlClienAPI.getLambdaByName(
285247
+ name2,
285248
+ projectId,
285249
+ void 0,
285250
+ clusterId
285251
+ )
285252
+ )
285253
+ )
285132
285254
  ),
285133
285255
  table
285134
285256
  )
@@ -285182,10 +285304,20 @@ var init_delete = __esm({
285182
285304
  delete_default = async (cmd) => {
285183
285305
  const spec = await (0, import_rxjs21.lastValueFrom)(loadSpec(cmd.spec));
285184
285306
  const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
285307
+ const env = cmd.env ?? spec.function?.env ?? spec.env;
285308
+ const clusterIdHint = cmd.clusterId ?? spec.function?.clusterId ?? spec.clusterId;
285309
+ const clusterNameHint = cmd.clusterName ?? spec.function?.clusterName ?? spec.clusterName;
285185
285310
  return (0, import_rxjs21.lastValueFrom)(
285186
285311
  parseProjectId(cmd.project).pipe(
285187
285312
  (0, import_operators20.switchMap)(
285188
- (projectId) => GraphqlClienAPI.deleteLambda({ name: name2, projectId })
285313
+ (projectId) => resolveClusterId(projectId, {
285314
+ clusterId: clusterIdHint,
285315
+ clusterName: clusterNameHint
285316
+ }).pipe(
285317
+ (0, import_operators20.switchMap)(
285318
+ (clusterId) => GraphqlClienAPI.deleteLambda({ name: name2, projectId, env, clusterId })
285319
+ )
285320
+ )
285189
285321
  ),
285190
285322
  (0, import_operators20.tap)((data) => {
285191
285323
  const columns = [
@@ -285244,7 +285376,14 @@ var init_logs = __esm({
285244
285376
  return (0, import_rxjs22.throwError)(() => error48);
285245
285377
  }),
285246
285378
  (0, import_operators21.switchMap)(
285247
- (projectId) => GraphqlClienAPI.getLambdaLogsByName(name2, projectId)
285379
+ (projectId) => resolveClusterId(projectId, {
285380
+ clusterId: cmd.clusterId,
285381
+ clusterName: cmd.clusterName
285382
+ }).pipe(
285383
+ (0, import_operators21.switchMap)(
285384
+ (clusterId) => GraphqlClienAPI.getLambdaLogsByName(name2, projectId, clusterId)
285385
+ )
285386
+ )
285248
285387
  ),
285249
285388
  result
285250
285389
  )
@@ -285294,7 +285433,18 @@ var init_logs_builder = __esm({
285294
285433
  return (0, import_rxjs23.throwError)(() => error48);
285295
285434
  }),
285296
285435
  (0, import_operators22.switchMap)(
285297
- (projectId) => GraphqlClienAPI.getLambdaBuilderLogsByName(name2, projectId)
285436
+ (projectId) => resolveClusterId(projectId, {
285437
+ clusterId: cmd.clusterId,
285438
+ clusterName: cmd.clusterName
285439
+ }).pipe(
285440
+ (0, import_operators22.switchMap)(
285441
+ (clusterId) => GraphqlClienAPI.getLambdaBuilderLogsByName(
285442
+ name2,
285443
+ projectId,
285444
+ clusterId
285445
+ )
285446
+ )
285447
+ )
285298
285448
  ),
285299
285449
  result
285300
285450
  )
@@ -317057,13 +317207,34 @@ function registerEnvironmentCommands(program2) {
317057
317207
  ).option(
317058
317208
  "-cid, --clusterId <clusterId>",
317059
317209
  "Private cluster this environment should run on (see cluster:list); omit for the shared cluster. Immutable after creation."
317210
+ ).option(
317211
+ "-cn, --clusterName <clusterName>",
317212
+ "Same as --clusterId but by the cluster's human-readable name; --clusterId wins if both are given. Can also be set as `clusterName` in env.yaml."
317060
317213
  ).action(lazy(() => Promise.resolve().then(() => (init_create_environment(), create_environment_exports)).then((m2) => m2.default)));
317061
317214
  program2.command("environment:update").description("Update environment for project").option("-p, --project <project>").option("-minCpu, --minCpu <minCpu>").option("-maxCpu, --maxCpu <maxCpu>").option("-minMemory, --minMemory <minMemory>").option("-maxMemory, --maxMemory <maxMemory>").option("-poolSize, --poolSize <poolSize>").option("-builder, --builder <builder>").option("-image, --image <image>").option("-name, --name <name>").option("-spec, --spec <spec>").option(
317062
317215
  "-r, --region <region>",
317063
317216
  "Default region is eu-central 'DEFAULT' | 'EU_BALKANS' | 'EU_CENTRAL'"
317217
+ ).option(
317218
+ "-cid, --clusterId <clusterId>",
317219
+ "Disambiguates which environment to update when --name matches more than one across different clusters (clusterId itself is immutable and never changed by this command)."
317220
+ ).option(
317221
+ "-cn, --clusterName <clusterName>",
317222
+ "Same as --clusterId but by the cluster's human-readable name; --clusterId wins if both are given"
317064
317223
  ).action(lazy(() => Promise.resolve().then(() => (init_update_environment(), update_environment_exports)).then((m2) => m2.default)));
317065
- program2.command("environment:delete").description("Delete environment for project").option("-p, --project <project>").option("-n, --name <name>").option("-f, --force").option("-spec, --spec <spec>").action(lazy(() => Promise.resolve().then(() => (init_delete_environment(), delete_environment_exports)).then((m2) => m2.default)));
317066
- program2.command("environment:get").description("Get environment for project").option("-p, --project <project>").option("-n, --name <name>").action(lazy(() => Promise.resolve().then(() => (init_get_environment(), get_environment_exports)).then((m2) => m2.default)));
317224
+ program2.command("environment:delete").description("Delete environment for project").option("-p, --project <project>").option("-n, --name <name>").option("-f, --force").option("-spec, --spec <spec>").option(
317225
+ "-cid, --clusterId <clusterId>",
317226
+ "Disambiguates which environment to delete when --name matches more than one across different clusters"
317227
+ ).option(
317228
+ "-cn, --clusterName <clusterName>",
317229
+ "Same as --clusterId but by the cluster's human-readable name; --clusterId wins if both are given"
317230
+ ).action(lazy(() => Promise.resolve().then(() => (init_delete_environment(), delete_environment_exports)).then((m2) => m2.default)));
317231
+ program2.command("environment:get").description("Get environment for project").option("-p, --project <project>").option("-n, --name <name>").option(
317232
+ "-cid, --clusterId <clusterId>",
317233
+ "Disambiguates which environment to fetch when --name matches more than one across different clusters"
317234
+ ).option(
317235
+ "-cn, --clusterName <clusterName>",
317236
+ "Same as --clusterId but by the cluster's human-readable name; --clusterId wins if both are given"
317237
+ ).action(lazy(() => Promise.resolve().then(() => (init_get_environment(), get_environment_exports)).then((m2) => m2.default)));
317067
317238
  }
317068
317239
 
317069
317240
  // src/commands/lambda/index.ts
@@ -317073,12 +317244,32 @@ function registerLambdaCommands(program2) {
317073
317244
  program2.command("lambda:list").description("List of all lambdas for project").option(
317074
317245
  "-p, --project <project>",
317075
317246
  "Specify custom token generated from the website"
317247
+ ).option(
317248
+ "-cid, --clusterId <clusterId>",
317249
+ "Only lambdas whose environment targets this cluster (empty string for shared-cluster-only; omit for all)"
317250
+ ).option(
317251
+ "-cn, --clusterName <clusterName>",
317252
+ "Same as --clusterId but by the cluster's human-readable name (see cluster:list) - resolved to its id before the request; --clusterId wins if both are given"
317076
317253
  ).action(lazy(() => Promise.resolve().then(() => (init_list2(), list_exports2)).then((m2) => m2.default)));
317077
- program2.command("lambda:get").description("Get lambda by id").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-p, --spec <spec>", "get by lambda name").action(lazy(() => Promise.resolve().then(() => (init_get(), get_exports)).then((m2) => m2.default)));
317254
+ program2.command("lambda:get").description("Get lambda by id").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-p, --spec <spec>", "get by lambda name").option(
317255
+ "-cid, --clusterId <clusterId>",
317256
+ "Disambiguates which lambda to fetch when --name matches more than one across different clusters"
317257
+ ).option(
317258
+ "-cn, --clusterName <clusterName>",
317259
+ "Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given"
317260
+ ).action(lazy(() => Promise.resolve().then(() => (init_get(), get_exports)).then((m2) => m2.default)));
317078
317261
  const createOrUpdateOptions = [
317079
317262
  ["--name <name>", "Function name"],
317080
317263
  ["--project <project>", "Project in which this lambda is defined"],
317081
317264
  ["--env <env>", "Environment name for function can be NODEJS"],
317265
+ [
317266
+ "--clusterId <clusterId>",
317267
+ "Disambiguation hint: which of the project's clusters --env lives on (see cluster:list); omit for the shared cluster. Only needed once a project has private clusters and a duplicate-named environment across them."
317268
+ ],
317269
+ [
317270
+ "--clusterName <clusterName>",
317271
+ "Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given. Can also be set as `clusterName` in the lambforge.yaml spec's function block."
317272
+ ],
317082
317273
  [
317083
317274
  "--method <method...>",
317084
317275
  "HTTP Methods: GET,POST,PUT,DELETE,HEAD. To mention single method"
@@ -317180,9 +317371,30 @@ function registerLambdaCommands(program2) {
317180
317371
  createCommand("lambda:update")(createOrUpdateOptions)(program2).action(
317181
317372
  lazy(() => Promise.resolve().then(() => (init_update(), update_exports)).then((m2) => m2.default))
317182
317373
  );
317183
- program2.command("lambda:delete").description("Get lambda by id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").action(lazy(() => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m2) => m2.default)));
317184
- program2.command("lambda:log").description("Get lambda log").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").action(lazy(() => Promise.resolve().then(() => (init_logs(), logs_exports)).then((m2) => m2.default)));
317185
- program2.command("lambda:build:log").description("Get build log").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda project").option("-s, --spec <spec>", "use configuration").action(lazy(() => Promise.resolve().then(() => (init_logs_builder(), logs_builder_exports)).then((m2) => m2.default)));
317374
+ program2.command("lambda:delete").description("Get lambda by id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").option(
317375
+ "-e, --env <env>",
317376
+ "disambiguates which lambda to delete when --name matches more than one across environments/clusters"
317377
+ ).option(
317378
+ "-cid, --clusterId <clusterId>",
317379
+ "disambiguates which lambda to delete when --name matches more than one across different clusters"
317380
+ ).option(
317381
+ "-cn, --clusterName <clusterName>",
317382
+ "Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given"
317383
+ ).action(lazy(() => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m2) => m2.default)));
317384
+ program2.command("lambda:log").description("Get lambda log").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").option(
317385
+ "-cid, --clusterId <clusterId>",
317386
+ "disambiguates which lambda to fetch logs for when --name matches more than one across different clusters"
317387
+ ).option(
317388
+ "-cn, --clusterName <clusterName>",
317389
+ "Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given"
317390
+ ).action(lazy(() => Promise.resolve().then(() => (init_logs(), logs_exports)).then((m2) => m2.default)));
317391
+ program2.command("lambda:build:log").description("Get build log").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda project").option("-s, --spec <spec>", "use configuration").option(
317392
+ "-cid, --clusterId <clusterId>",
317393
+ "disambiguates which lambda to fetch build logs for when --name matches more than one across different clusters"
317394
+ ).option(
317395
+ "-cn, --clusterName <clusterName>",
317396
+ "Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given"
317397
+ ).action(lazy(() => Promise.resolve().then(() => (init_logs_builder(), logs_builder_exports)).then((m2) => m2.default)));
317186
317398
  program2.command("lambda:test").description("Test lambda").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").option("-qp, --queryParams <queryParams>", "Adds query params to request").option("-pp, --pathParams <pathParams>", "Adds query params to request").option("-b, --body <body>", "Add body to request").option(
317187
317399
  "-m, --method <method>",
317188
317400
  "HTTP Methods: GET,POST,PUT,DELETE,HEAD. To mention single method"