@settlemint/sdk-cli 1.0.6-main215c686f → 1.0.6-main25fcf510

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/dist/cli.js CHANGED
@@ -59232,8 +59232,8 @@ ${lanes.join(`
59232
59232
  addDeclarationToSymbol(symbol, id, flags);
59233
59233
  return symbol;
59234
59234
  } else {
59235
- const table = parent3 ? parent3.exports : file.jsGlobalAugmentations || (file.jsGlobalAugmentations = createSymbolTable());
59236
- return declareSymbol(table, parent3, id, flags, excludeFlags);
59235
+ const table2 = parent3 ? parent3.exports : file.jsGlobalAugmentations || (file.jsGlobalAugmentations = createSymbolTable());
59236
+ return declareSymbol(table2, parent3, id, flags, excludeFlags);
59237
59237
  }
59238
59238
  });
59239
59239
  }
@@ -63732,13 +63732,13 @@ ${lanes.join(`
63732
63732
  case 263:
63733
63733
  case 231:
63734
63734
  case 264:
63735
- let table;
63735
+ let table2;
63736
63736
  (getSymbolOfDeclaration(location).members || emptySymbols).forEach((memberSymbol, key) => {
63737
63737
  if (memberSymbol.flags & (788968 & ~67108864)) {
63738
- (table || (table = createSymbolTable())).set(key, memberSymbol);
63738
+ (table2 || (table2 = createSymbolTable())).set(key, memberSymbol);
63739
63739
  }
63740
63740
  });
63741
- if (table && (result = callback(table, undefined, false, location))) {
63741
+ if (table2 && (result = callback(table2, undefined, false, location))) {
63742
63742
  return result;
63743
63743
  }
63744
63744
  break;
@@ -108969,11 +108969,11 @@ ${lanes.join(`
108969
108969
  state.labeledNonLocalContinues.set(labelText, labelMarker);
108970
108970
  }
108971
108971
  }
108972
- function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) {
108973
- if (!table) {
108972
+ function processLabeledJumps(table2, isBreak, loopResultName, outerLoop, caseClauses) {
108973
+ if (!table2) {
108974
108974
  return;
108975
108975
  }
108976
- table.forEach((labelMarker, labelText) => {
108976
+ table2.forEach((labelMarker, labelText) => {
108977
108977
  const statements = [];
108978
108978
  if (!outerLoop || outerLoop.labels && outerLoop.labels.get(labelText)) {
108979
108979
  const label = factory2.createIdentifier(labelText);
@@ -208234,7 +208234,7 @@ Could not find "${i7}"`);
208234
208234
  cwd: t7
208235
208235
  });
208236
208236
  }(function getPkgManager() {
208237
- var e10 = "bun/1.1.43 npm/? node/v22.6.0 linux x64";
208237
+ var e10 = "bun/1.1.45 npm/? node/v22.6.0 linux x64";
208238
208238
  if (e10.startsWith("yarn")) {
208239
208239
  return "yarn";
208240
208240
  }
@@ -209465,7 +209465,7 @@ ${Bt.cyan(Yt)}
209465
209465
  code: "ENOENT"
209466
209466
  }), getPathInfo = (e9, t7) => {
209467
209467
  var r6 = t7.colon || or;
209468
- var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.jf8M1yOAqp:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
209468
+ var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.kpv3hlJJp8:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
209469
209469
  var n6 = nr ? t7.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
209470
209470
  var a5 = nr ? n6.split(r6) : [""];
209471
209471
  if (nr) {
@@ -212602,7 +212602,7 @@ ${whileRunning(e9)}`;
212602
212602
  };
212603
212603
  ni = Object.assign(async function _main() {
212604
212604
  var e9 = new Cli({
212605
- binaryVersion: "1.0.6-main215c686f",
212605
+ binaryVersion: "1.0.6-main25fcf510",
212606
212606
  binaryLabel: "gql.tada CLI",
212607
212607
  binaryName: "gql.tada"
212608
212608
  });
@@ -220192,7 +220192,7 @@ var require_lib4 = __commonJS((exports, module) => {
220192
220192
  var rRel = new RegExp(`^\\.${rSlash.source}`);
220193
220193
  var getNotFoundError2 = (cmd2) => Object.assign(new Error(`not found: ${cmd2}`), { code: "ENOENT" });
220194
220194
  var getPathInfo2 = (cmd2, {
220195
- path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.jf8M1yOAqp:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
220195
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.kpv3hlJJp8:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
220196
220196
  pathExt: optPathExt = process.env.PATHEXT,
220197
220197
  delimiter: optDelimiter = delimiter
220198
220198
  }) => {
@@ -220396,7 +220396,7 @@ var require_lib5 = __commonJS((exports, module) => {
220396
220396
  let pathToInitial;
220397
220397
  try {
220398
220398
  pathToInitial = which.sync(initialCmd, {
220399
- path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.jf8M1yOAqp:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
220399
+ path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.kpv3hlJJp8:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
220400
220400
  pathext: options.env && findInObject(options.env, "PATHEXT") || process.env.PATHEXT
220401
220401
  }).toLowerCase();
220402
220402
  } catch (err) {
@@ -221113,7 +221113,7 @@ var require_lib6 = __commonJS((exports, module) => {
221113
221113
  var rRel = new RegExp(`^\\.${rSlash.source}`);
221114
221114
  var getNotFoundError2 = (cmd2) => Object.assign(new Error(`not found: ${cmd2}`), { code: "ENOENT" });
221115
221115
  var getPathInfo2 = (cmd2, {
221116
- path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.jf8M1yOAqp:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
221116
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.kpv3hlJJp8:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
221117
221117
  pathExt: optPathExt = process.env.PATHEXT,
221118
221118
  delimiter: optDelimiter = delimiter
221119
221119
  }) => {
@@ -234988,7 +234988,7 @@ var require_which2 = __commonJS((exports, module) => {
234988
234988
  const colon = opt2.colon || COLON;
234989
234989
  const pathEnv = cmd2.match(/\//) || isWindows2 && cmd2.match(/\\/) ? [""] : [
234990
234990
  ...isWindows2 ? [process.cwd()] : [],
234991
- ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.jf8M1yOAqp:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234991
+ ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.13.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.kpv3hlJJp8:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234992
234992
  ];
234993
234993
  const pathExtExe = isWindows2 ? opt2.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
234994
234994
  const pathExt = isWindows2 ? pathExtExe.split(colon) : [""];
@@ -256743,6 +256743,9 @@ function yoctoSpinner(options) {
256743
256743
  return new YoctoSpinner(options);
256744
256744
  }
256745
256745
 
256746
+ // ../utils/dist/environment.mjs
256747
+ import TTYTable from "tty-table";
256748
+
256746
256749
  // ../../node_modules/zod/lib/index.mjs
256747
256750
  var util;
256748
256751
  (function(util2) {
@@ -267466,6 +267469,7 @@ var {
267466
267469
 
267467
267470
  // ../utils/dist/terminal.mjs
267468
267471
  import { spawn } from "node:child_process";
267472
+ import TTYTable2 from "tty-table";
267469
267473
  var ascii = () => console.log(magentaBright(`
267470
267474
  _________ __ __ .__ _____ .__ __
267471
267475
  / _____/ _____/ |__/ |_| | ____ / \\ |__| _____/ |_
@@ -267530,14 +267534,15 @@ function list(title, items) {
267530
267534
  const formatItems = (items2) => {
267531
267535
  return items2.map((item) => {
267532
267536
  if (Array.isArray(item)) {
267533
- return item.map((subItem) => ` • ${subItem}`).join(`
267537
+ return item.map((subItem) => ` • ${subItem}`).join(`
267534
267538
  `);
267535
267539
  }
267536
- return `• ${item}`;
267540
+ return ` • ${item}`;
267537
267541
  }).join(`
267538
267542
  `);
267539
267543
  };
267540
267544
  return note(`${title}:
267545
+
267541
267546
  ${formatItems(items)}`);
267542
267547
  }
267543
267548
  var outro = (msg) => {
@@ -267562,11 +267567,40 @@ ${error.stack}`));
267562
267567
  process.exit(1);
267563
267568
  }
267564
267569
  };
267570
+ function capitalizeFirstLetter(val) {
267571
+ return String(val).charAt(0).toUpperCase() + String(val).slice(1);
267572
+ }
267573
+ function camelCaseToWords(s) {
267574
+ const result = s.replace(/([a-z])([A-Z])/g, "$1 $2");
267575
+ const withSpaces = result.replace(/([A-Z])([a-z])/g, " $1$2");
267576
+ const capitalized = capitalizeFirstLetter(withSpaces);
267577
+ return capitalized.replace(/\s+/g, " ").trim();
267578
+ }
267579
+ function table(title, data, compact = true) {
267580
+ note(title);
267581
+ if (!data || data.length === 0) {
267582
+ note("No data to display");
267583
+ return;
267584
+ }
267585
+ const columnKeys = Object.keys(data[0]);
267586
+ const headers = columnKeys.map((key) => ({
267587
+ value: key,
267588
+ alias: whiteBright(camelCaseToWords(key)),
267589
+ headerAlign: "left",
267590
+ headerColor: "",
267591
+ align: "left"
267592
+ }));
267593
+ const config3 = {
267594
+ compact
267595
+ };
267596
+ const ttyTable = TTYTable2(headers, data, config3);
267597
+ console.log(ttyTable.render());
267598
+ }
267565
267599
  // package.json
267566
267600
  var package_default = {
267567
267601
  name: "@settlemint/sdk-cli",
267568
267602
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
267569
- version: "1.0.6-main215c686f",
267603
+ version: "1.0.6-main25fcf510",
267570
267604
  type: "module",
267571
267605
  private: false,
267572
267606
  license: "FSL-1.1-MIT",
@@ -267607,7 +267641,8 @@ var package_default = {
267607
267641
  },
267608
267642
  dependencies: {
267609
267643
  hardhat: "2.22.18",
267610
- tinyexec: "0.3.2"
267644
+ tinyexec: "0.3.2",
267645
+ "tty-table": "4.2.3"
267611
267646
  },
267612
267647
  devDependencies: {
267613
267648
  "@types/semver": "7.5.8",
@@ -267621,10 +267656,11 @@ var package_default = {
267621
267656
  "@inquirer/input": "4.1.3",
267622
267657
  "@inquirer/password": "4.0.6",
267623
267658
  "@inquirer/select": "4.0.6",
267624
- "@settlemint/sdk-js": "1.0.6-main215c686f",
267625
- "@settlemint/sdk-utils": "1.0.6-main215c686f",
267659
+ "@settlemint/sdk-js": "1.0.6-main25fcf510",
267660
+ "@settlemint/sdk-utils": "1.0.6-main25fcf510",
267626
267661
  "get-tsconfig": "4.8.1",
267627
- giget: "1.2.3"
267662
+ giget: "1.2.3",
267663
+ yaml: "2.7.0"
267628
267664
  },
267629
267665
  peerDependencies: {},
267630
267666
  engines: {
@@ -267736,9 +267772,18 @@ async function retryWhenFailed(fn, maxRetries = 5, initialSleepTime = 1000, stop
267736
267772
  }
267737
267773
  throw new Error("Retry failed");
267738
267774
  }
267739
- function capitalizeFirstLetter(val) {
267775
+ function capitalizeFirstLetter2(val) {
267740
267776
  return String(val).charAt(0).toUpperCase() + String(val).slice(1);
267741
267777
  }
267778
+ function camelCaseToWords2(s) {
267779
+ const result = s.replace(/([a-z])([A-Z])/g, "$1 $2");
267780
+ const withSpaces = result.replace(/([A-Z])([a-z])/g, " $1$2");
267781
+ const capitalized = capitalizeFirstLetter2(withSpaces);
267782
+ return capitalized.replace(/\s+/g, " ").trim();
267783
+ }
267784
+ function replaceUnderscoresAndHyphensWithSpaces(s) {
267785
+ return s.replace(/[-_]/g, " ");
267786
+ }
267742
267787
 
267743
267788
  // src/utils/config.ts
267744
267789
  var CONFIG_DIR = join6(homedir(), ".config", "settlemint");
@@ -267770,9 +267815,6 @@ async function storeCredentials(token, instance) {
267770
267815
  personalAccessToken: token,
267771
267816
  lastUsed: new Date().toISOString()
267772
267817
  };
267773
- if (!config3.defaultInstance || Object.keys(config3.instances).length === 1) {
267774
- config3.defaultInstance = instance;
267775
- }
267776
267818
  await writeConfig(config3);
267777
267819
  }
267778
267820
  async function getInstanceCredentials(instance, throwOnMissingInstance = true) {
@@ -267793,24 +267835,9 @@ async function getInstances() {
267793
267835
  const config3 = await readConfig();
267794
267836
  return Object.keys(config3.instances);
267795
267837
  }
267796
- async function getDefaultInstance() {
267797
- const config3 = await readConfig();
267798
- return config3.defaultInstance;
267799
- }
267800
- async function setDefaultInstance(instance) {
267801
- const config3 = await readConfig();
267802
- if (!config3.instances[instance]) {
267803
- throw new Error(`Instance ${instance} is not configured`);
267804
- }
267805
- config3.defaultInstance = instance;
267806
- await writeConfig(config3);
267807
- }
267808
267838
  async function removeCredentials(instance) {
267809
267839
  const config3 = await readConfig();
267810
267840
  delete config3.instances[instance];
267811
- if (config3.defaultInstance === instance) {
267812
- config3.defaultInstance = undefined;
267813
- }
267814
267841
  await writeConfig(config3);
267815
267842
  }
267816
267843
 
@@ -267982,6 +268009,7 @@ async function installPackage(names, options = {}) {
267982
268009
  }
267983
268010
 
267984
268011
  // ../utils/dist/package-manager.mjs
268012
+ import TTYTable3 from "tty-table";
267985
268013
  var import_package_json = __toESM(require_lib12(), 1);
267986
268014
  var import_package_json2 = __toESM(require_lib12(), 1);
267987
268015
  async function projectRoot3(fallbackToCwd = false, cwd) {
@@ -268225,7 +268253,7 @@ async function codegenTheGraph(env2, subgraphNames) {
268225
268253
  "x-auth-token": accessToken
268226
268254
  }
268227
268255
  });
268228
- const nameSuffix = capitalizeFirstLetter(name2);
268256
+ const nameSuffix = capitalizeFirstLetter2(name2);
268229
268257
  const graphqlClientVariable = getVariableName(`theGraphClient${nameSuffix}`);
268230
268258
  const graphqlVariable = getVariableName(`theGraphGraphql${nameSuffix}`);
268231
268259
  template.push(...[
@@ -270331,9 +270359,9 @@ ${theme.style.description(selectedChoice.description)}` : ``;
270331
270359
  ${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes2.default.cursorHide}`;
270332
270360
  });
270333
270361
 
270334
- // src/commands/codegen/subgraph-name.prompt.ts
270362
+ // src/prompts/smart-contract-set/subgraph.prompt.ts
270335
270363
  var ALL = "All";
270336
- async function subgraphNamePrompt(env2, accept) {
270364
+ async function subgraphPrompt(env2, accept) {
270337
270365
  const autoAccept = is_in_ci_default || !!accept;
270338
270366
  const subgraphNames = env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS?.map((endpoint) => endpoint.split("/").pop()).filter(Boolean) ?? [];
270339
270367
  if (autoAccept) {
@@ -270359,6 +270387,19 @@ async function subgraphNamePrompt(env2, accept) {
270359
270387
  return subgraphName === ALL ? subgraphNames : [subgraphName];
270360
270388
  }
270361
270389
 
270390
+ // src/utils/commands/create-examples.ts
270391
+ function createExamples(examples) {
270392
+ return `
270393
+ Examples:
270394
+
270395
+ ${examples.map(({ description, command, commandPrefix }) => {
270396
+ return ` # ${description}
270397
+ $ ${commandPrefix ?? ""}settlemint ${command}`;
270398
+ }).join(`
270399
+
270400
+ `)}`;
270401
+ }
270402
+
270362
270403
  // src/commands/codegen/codegen-blockscout.ts
270363
270404
  import { rm as rm2, writeFile as writeFile6 } from "node:fs/promises";
270364
270405
  import { basename, resolve as resolve5 } from "node:path";
@@ -270579,19 +270620,6 @@ export const { client } = createServerMinioClient({
270579
270620
  }
270580
270621
  }
270581
270622
 
270582
- // src/commands/platform/utils/create-examples.ts
270583
- function createExamples(examples) {
270584
- return `
270585
- Examples:
270586
-
270587
- ${examples.map(({ description, command, commandPrefix }) => {
270588
- return ` # ${description}
270589
- $ ${commandPrefix ?? ""}settlemint ${command}`;
270590
- }).join(`
270591
-
270592
- `)}`;
270593
- }
270594
-
270595
270623
  // src/commands/codegen.ts
270596
270624
  function codegenCommand() {
270597
270625
  return new Command("codegen").option("--prod", "Connect to your production environment").option("--thegraph-subgraph-names <subgraph-names...>", "The name(s) of the TheGraph subgraph(s) to generate (skip if you want to generate all)").description("Generate GraphQL and REST types and queries").usage(createExamples([
@@ -270607,7 +270635,7 @@ function codegenCommand() {
270607
270635
  intro("Generating GraphQL types and queries for your dApp");
270608
270636
  const env2 = await loadEnv(true, !!prod);
270609
270637
  if (!Array.isArray(thegraphSubgraphNames)) {
270610
- thegraphSubgraphNames = await subgraphNamePrompt(env2, true);
270638
+ thegraphSubgraphNames = await subgraphPrompt(env2, true);
270611
270639
  }
270612
270640
  const { hasura, portal, thegraph, blockscout } = await spinner({
270613
270641
  startMessage: "Testing configured GraphQL schema",
@@ -270650,149 +270678,165 @@ function codegenCommand() {
270650
270678
  });
270651
270679
  }
270652
270680
 
270653
- // src/commands/connect/workspaces.spinner.ts
270654
- async function workspaceSpinner(settlemint) {
270655
- return spinner({
270656
- startMessage: "Loading your workspaces",
270657
- stopMessage: "Loaded your workspaces",
270658
- task: async () => {
270659
- return settlemint.workspace.list();
270660
- }
270661
- });
270681
+ // ../../node_modules/@inquirer/confirm/dist/esm/index.js
270682
+ function getBooleanValue(value4, defaultValue) {
270683
+ let answer = defaultValue !== false;
270684
+ if (/^(y|yes)/i.test(value4))
270685
+ answer = true;
270686
+ else if (/^(n|no)/i.test(value4))
270687
+ answer = false;
270688
+ return answer;
270662
270689
  }
270663
-
270664
- // src/commands/connect/write-env.spinner.ts
270665
- async function writeEnvSpinner(prod, env2) {
270666
- return spinner({
270667
- startMessage: "Saving .env and .env.local files",
270668
- stopMessage: "Written .env and .env.local file",
270669
- task: async () => {
270670
- const updatedSecrets = {
270671
- SETTLEMINT_ACCESS_TOKEN: env2.SETTLEMINT_ACCESS_TOKEN,
270672
- SETTLEMINT_HASURA_ADMIN_SECRET: env2.SETTLEMINT_HASURA_ADMIN_SECRET,
270673
- SETTLEMINT_MINIO_SECRET_KEY: env2.SETTLEMINT_MINIO_SECRET_KEY,
270674
- SETTLEMINT_HASURA_DATABASE_URL: env2.SETTLEMINT_HASURA_DATABASE_URL
270675
- };
270676
- await writeEnv({
270677
- prod,
270678
- env: updatedSecrets,
270679
- secrets: true
270680
- });
270681
- const updatedEnv = {
270682
- SETTLEMINT_INSTANCE: env2.SETTLEMINT_INSTANCE,
270683
- SETTLEMINT_WORKSPACE: env2.SETTLEMINT_WORKSPACE,
270684
- SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
270685
- SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
270686
- SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
270687
- SETTLEMINT_LOAD_BALANCER: env2.SETTLEMINT_LOAD_BALANCER,
270688
- SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
270689
- SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
270690
- SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
270691
- SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS,
270692
- SETTLEMINT_THEGRAPH_SUBGRAPH_NAME: env2.SETTLEMINT_THEGRAPH_SUBGRAPH_NAME,
270693
- SETTLEMINT_PORTAL: env2.SETTLEMINT_PORTAL,
270694
- SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT: env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT,
270695
- SETTLEMINT_PORTAL_REST_ENDPOINT: env2.SETTLEMINT_PORTAL_REST_ENDPOINT,
270696
- SETTLEMINT_HD_PRIVATE_KEY: env2.SETTLEMINT_HD_PRIVATE_KEY,
270697
- SETTLEMINT_ACCESSIBLE_PRIVATE_KEY: env2.SETTLEMINT_ACCESSIBLE_PRIVATE_KEY,
270698
- SETTLEMINT_MINIO: env2.SETTLEMINT_MINIO,
270699
- SETTLEMINT_MINIO_ENDPOINT: env2.SETTLEMINT_MINIO_ENDPOINT,
270700
- SETTLEMINT_MINIO_ACCESS_KEY: env2.SETTLEMINT_MINIO_ACCESS_KEY,
270701
- SETTLEMINT_IPFS: env2.SETTLEMINT_IPFS,
270702
- SETTLEMINT_IPFS_API_ENDPOINT: env2.SETTLEMINT_IPFS_API_ENDPOINT,
270703
- SETTLEMINT_IPFS_PINNING_ENDPOINT: env2.SETTLEMINT_IPFS_PINNING_ENDPOINT,
270704
- SETTLEMINT_IPFS_GATEWAY_ENDPOINT: env2.SETTLEMINT_IPFS_GATEWAY_ENDPOINT,
270705
- SETTLEMINT_CUSTOM_DEPLOYMENT: env2.SETTLEMINT_CUSTOM_DEPLOYMENT,
270706
- SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: env2.SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT,
270707
- SETTLEMINT_BLOCKSCOUT: env2.SETTLEMINT_BLOCKSCOUT,
270708
- SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT: env2.SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT,
270709
- SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT: env2.SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT,
270710
- SETTLEMINT_NEW_PROJECT_NAME: env2.SETTLEMINT_NEW_PROJECT_NAME,
270711
- SETTLEMINT_SMART_CONTRACT_ADDRESS: env2.SETTLEMINT_SMART_CONTRACT_ADDRESS,
270712
- SETTLEMINT_SMART_CONTRACT_DEPLOYMENT_ID: env2.SETTLEMINT_SMART_CONTRACT_DEPLOYMENT_ID
270713
- };
270714
- await writeEnv({
270715
- prod,
270716
- env: updatedEnv,
270717
- secrets: false
270718
- });
270690
+ function boolToString(value4) {
270691
+ return value4 ? "Yes" : "No";
270692
+ }
270693
+ var esm_default3 = createPrompt((config3, done) => {
270694
+ const { transformer = boolToString } = config3;
270695
+ const [status, setStatus] = useState("idle");
270696
+ const [value4, setValue] = useState("");
270697
+ const theme = makeTheme(config3.theme);
270698
+ const prefix = usePrefix({ status, theme });
270699
+ useKeypress((key2, rl) => {
270700
+ if (isEnterKey(key2)) {
270701
+ const answer = getBooleanValue(value4, config3.default);
270702
+ setValue(transformer(answer));
270703
+ setStatus("done");
270704
+ done(answer);
270705
+ } else if (key2.name === "tab") {
270706
+ const answer = boolToString(!getBooleanValue(value4, config3.default));
270707
+ rl.clearLine(0);
270708
+ rl.write(answer);
270709
+ setValue(answer);
270710
+ } else {
270711
+ setValue(rl.line);
270719
270712
  }
270720
270713
  });
270721
- }
270722
-
270723
- // src/utils/get-cluster-service-endpoint.ts
270724
- async function getGraphEndpoint(settlemint, service, graphName) {
270725
- if (!service || service.__typename !== "HAGraphMiddleware") {
270726
- return {};
270714
+ let formattedValue = value4;
270715
+ let defaultValue = "";
270716
+ if (status === "done") {
270717
+ formattedValue = theme.style.answer(value4);
270718
+ } else {
270719
+ defaultValue = ` ${theme.style.defaultAnswer(config3.default === false ? "y/N" : "Y/n")}`;
270727
270720
  }
270728
- const theGraphMiddleware = await spinner({
270729
- startMessage: "Fetching TheGraph subgraph endpoints",
270730
- stopMessage: "Fetched TheGraph subgraph endpoints",
270731
- task: () => retryWhenFailed(async () => {
270732
- const middleware = await settlemint.middleware.graphSubgraphs(service.uniqueName, !!graphName);
270733
- if (!middleware || middleware.__typename !== "HAGraphMiddleware") {
270734
- throw new Error(`Middleware '${service.uniqueName}' is not a graph middleware`);
270735
- }
270736
- if (graphName && !middleware.subgraphs.find(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.id.endsWith(graphName))) {
270737
- throw new Error(`Subgraph '${graphName}' not found in middleware '${service.uniqueName}'`);
270721
+ const message = theme.style.message(config3.message, status);
270722
+ return `${prefix} ${message}${defaultValue} ${formattedValue}`;
270723
+ });
270724
+
270725
+ // ../../node_modules/@inquirer/input/dist/esm/index.js
270726
+ var inputTheme = {
270727
+ validationFailureMode: "keep"
270728
+ };
270729
+ var esm_default4 = createPrompt((config3, done) => {
270730
+ const { required, validate: validate2 = () => true } = config3;
270731
+ const theme = makeTheme(inputTheme, config3.theme);
270732
+ const [status, setStatus] = useState("idle");
270733
+ const [defaultValue = "", setDefaultValue] = useState(config3.default);
270734
+ const [errorMsg, setError] = useState();
270735
+ const [value4, setValue] = useState("");
270736
+ const prefix = usePrefix({ status, theme });
270737
+ useKeypress(async (key2, rl) => {
270738
+ if (status !== "idle") {
270739
+ return;
270740
+ }
270741
+ if (isEnterKey(key2)) {
270742
+ const answer = value4 || defaultValue;
270743
+ setStatus("loading");
270744
+ const isValid2 = required && !answer ? "You must provide a value" : await validate2(answer);
270745
+ if (isValid2 === true) {
270746
+ setValue(answer);
270747
+ setStatus("done");
270748
+ done(answer);
270749
+ } else {
270750
+ if (theme.validationFailureMode === "clear") {
270751
+ setValue("");
270752
+ } else {
270753
+ rl.write(value4);
270754
+ }
270755
+ setError(isValid2 || "You must provide a valid value");
270756
+ setStatus("idle");
270738
270757
  }
270739
- return middleware;
270740
- })
270758
+ } else if (isBackspaceKey(key2) && !value4) {
270759
+ setDefaultValue(undefined);
270760
+ } else if (key2.name === "tab" && !value4) {
270761
+ setDefaultValue(undefined);
270762
+ rl.clearLine(0);
270763
+ rl.write(defaultValue);
270764
+ setValue(defaultValue);
270765
+ } else {
270766
+ setValue(rl.line);
270767
+ setError(undefined);
270768
+ }
270741
270769
  });
270742
- const endpoints = theGraphMiddleware.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue);
270743
- return {
270744
- SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: endpoints
270745
- };
270746
- }
270747
- function getIpfsEndpoints(service) {
270748
- if (!service || service.__typename !== "IPFSStorage") {
270749
- return {};
270770
+ const message = theme.style.message(config3.message, status);
270771
+ let formattedValue = value4;
270772
+ if (typeof config3.transformer === "function") {
270773
+ formattedValue = config3.transformer(value4, { isFinal: status === "done" });
270774
+ } else if (status === "done") {
270775
+ formattedValue = theme.style.answer(value4);
270750
270776
  }
270751
- return {
270752
- SETTLEMINT_IPFS_API_ENDPOINT: service?.endpoints.find((endpoint) => endpoint.id.includes("api"))?.displayValue,
270753
- SETTLEMINT_IPFS_PINNING_ENDPOINT: service?.endpoints.find((endpoint) => endpoint.id.includes("cluster-pinning-api"))?.displayValue,
270754
- SETTLEMINT_IPFS_GATEWAY_ENDPOINT: service?.endpoints.find((endpoint) => endpoint.id.includes("gateway"))?.displayValue
270755
- };
270756
- }
270757
- function getPortalEndpoints(service) {
270758
- if (!service || service.__typename !== "SmartContractPortalMiddleware") {
270759
- return {};
270777
+ let defaultStr;
270778
+ if (defaultValue && status !== "done" && !value4) {
270779
+ defaultStr = theme.style.defaultAnswer(defaultValue);
270760
270780
  }
270761
- return {
270762
- SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("graphql"))?.displayValue,
270763
- SETTLEMINT_PORTAL_REST_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("rest"))?.displayValue
270764
- };
270765
- }
270766
- function getHasuraEndpoints(service) {
270767
- if (!service || service.__typename !== "Hasura") {
270768
- return {};
270781
+ let error5 = "";
270782
+ if (errorMsg) {
270783
+ error5 = theme.style.error(errorMsg);
270769
270784
  }
270770
- return {
270771
- SETTLEMINT_HASURA_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("graphql"))?.displayValue,
270772
- SETTLEMINT_HASURA_ADMIN_SECRET: service.credentials.find((credential) => credential.id.includes("admin-secret"))?.displayValue,
270773
- SETTLEMINT_HASURA_DATABASE_URL: service.endpoints.find((endpoint) => endpoint.id.includes("postgresql"))?.displayValue
270774
- };
270775
- }
270776
- function getBlockscoutEndpoints(service) {
270777
- if (!service || service.__typename !== "BlockchainExplorer") {
270778
- return {};
270785
+ return [
270786
+ [prefix, message, defaultStr, formattedValue].filter((v7) => v7 !== undefined).join(" "),
270787
+ error5
270788
+ ];
270789
+ });
270790
+
270791
+ // ../../node_modules/@inquirer/password/dist/esm/index.js
270792
+ var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
270793
+ var esm_default5 = createPrompt((config3, done) => {
270794
+ const { validate: validate2 = () => true } = config3;
270795
+ const theme = makeTheme(config3.theme);
270796
+ const [status, setStatus] = useState("idle");
270797
+ const [errorMsg, setError] = useState();
270798
+ const [value4, setValue] = useState("");
270799
+ const prefix = usePrefix({ status, theme });
270800
+ useKeypress(async (key2, rl) => {
270801
+ if (status !== "idle") {
270802
+ return;
270803
+ }
270804
+ if (isEnterKey(key2)) {
270805
+ const answer = value4;
270806
+ setStatus("loading");
270807
+ const isValid2 = await validate2(answer);
270808
+ if (isValid2 === true) {
270809
+ setValue(answer);
270810
+ setStatus("done");
270811
+ done(answer);
270812
+ } else {
270813
+ rl.write(value4);
270814
+ setError(isValid2 || "You must provide a valid value");
270815
+ setStatus("idle");
270816
+ }
270817
+ } else {
270818
+ setValue(rl.line);
270819
+ setError(undefined);
270820
+ }
270821
+ });
270822
+ const message = theme.style.message(config3.message, status);
270823
+ let formattedValue = "";
270824
+ let helpTip;
270825
+ if (config3.mask) {
270826
+ const maskChar = typeof config3.mask === "string" ? config3.mask : "*";
270827
+ formattedValue = maskChar.repeat(value4.length);
270828
+ } else if (status !== "done") {
270829
+ helpTip = `${theme.style.help("[input is masked]")}${import_ansi_escapes3.default.cursorHide}`;
270779
270830
  }
270780
- const uiEndpoint = service.endpoints.find((endpoint) => endpoint.id.includes("interface"))?.displayValue;
270781
- return {
270782
- SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT: uiEndpoint ? `${new URL("/api/v1/graphql", uiEndpoint).toString()}` : undefined,
270783
- SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT: uiEndpoint
270784
- };
270785
- }
270786
- function getMinioEndpoints(service) {
270787
- if (!service || service.__typename !== "MinioStorage") {
270788
- return {};
270831
+ if (status === "done") {
270832
+ formattedValue = theme.style.answer(formattedValue);
270789
270833
  }
270790
- return {
270791
- SETTLEMINT_MINIO_ENDPOINT: service?.endpoints.find((endpoint) => endpoint.id.includes("s3-api"))?.displayValue,
270792
- SETTLEMINT_MINIO_ACCESS_KEY: service?.credentials.find((credential) => credential.id.includes("access-key"))?.displayValue,
270793
- SETTLEMINT_MINIO_SECRET_KEY: service?.credentials.find((credential) => credential.id.includes("secret-key"))?.displayValue
270794
- };
270795
- }
270834
+ let error5 = "";
270835
+ if (errorMsg) {
270836
+ error5 = theme.style.error(errorMsg);
270837
+ }
270838
+ return [[prefix, message, config3.mask ? formattedValue : helpTip].join(" "), error5];
270839
+ });
270796
270840
 
270797
270841
  // ../utils/dist/validation.mjs
270798
270842
  function validate2(schema, value4) {
@@ -270872,6 +270916,393 @@ var IdSchema2 = z.union([
270872
270916
  z.string().regex(/^[0-9a-fA-F]{24}$/)
270873
270917
  ]);
270874
270918
 
270919
+ // src/prompts/aat.prompt.ts
270920
+ async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
270921
+ const autoAccept = !!accept || is_in_ci_default;
270922
+ const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
270923
+ const defaultPossible = autoAccept && defaultAccessToken;
270924
+ if (defaultPossible || is_in_ci_default) {
270925
+ return defaultAccessToken;
270926
+ }
270927
+ if (defaultAccessToken) {
270928
+ const keep = await esm_default3({
270929
+ message: "Do you want to use the existing application access token?",
270930
+ default: true
270931
+ });
270932
+ if (keep) {
270933
+ return defaultAccessToken;
270934
+ }
270935
+ }
270936
+ const create2 = await esm_default3({
270937
+ message: "Do you want to create a new application access token?",
270938
+ default: false
270939
+ });
270940
+ if (create2) {
270941
+ const name2 = await esm_default4({
270942
+ message: "How would you like to name this application access token?",
270943
+ default: `SettleMint CLI (${Date.now()}${` ${"runner"}`})`,
270944
+ required: true,
270945
+ validate(value4) {
270946
+ try {
270947
+ validate2(z.string(), value4);
270948
+ return true;
270949
+ } catch (error5) {
270950
+ return "Invalid token name";
270951
+ }
270952
+ }
270953
+ });
270954
+ const aat = await settlemint.applicationAccessToken.create({
270955
+ applicationUniqueName: application.uniqueName,
270956
+ name: name2,
270957
+ blockchainNetworkScope: {
270958
+ type: "ALL",
270959
+ values: []
270960
+ },
270961
+ blockchainNodeScope: {
270962
+ type: "ALL",
270963
+ values: []
270964
+ },
270965
+ customDeploymentScope: {
270966
+ type: "ALL",
270967
+ values: []
270968
+ },
270969
+ insightsScope: {
270970
+ type: "ALL",
270971
+ values: []
270972
+ },
270973
+ integrationScope: {
270974
+ type: "ALL",
270975
+ values: []
270976
+ },
270977
+ loadBalancerScope: {
270978
+ type: "ALL",
270979
+ values: []
270980
+ },
270981
+ middlewareScope: {
270982
+ type: "ALL",
270983
+ values: []
270984
+ },
270985
+ privateKeyScope: {
270986
+ type: "ALL",
270987
+ values: []
270988
+ },
270989
+ smartContractSetScope: {
270990
+ type: "ALL",
270991
+ values: []
270992
+ },
270993
+ storageScope: {
270994
+ type: "ALL",
270995
+ values: []
270996
+ },
270997
+ validityPeriod: "NONE"
270998
+ });
270999
+ try {
271000
+ validate2(ApplicationAccessTokenSchema2, aat);
271001
+ return aat;
271002
+ } catch (error5) {
271003
+ }
271004
+ }
271005
+ return esm_default5({
271006
+ message: "What is the application access token for your application in SettleMint? (format: sm_aat_...)",
271007
+ validate(value4) {
271008
+ try {
271009
+ validate2(ApplicationAccessTokenSchema2, value4);
271010
+ return true;
271011
+ } catch (error5) {
271012
+ return "Invalid application access token, it should start with sm_aat_...";
271013
+ }
271014
+ }
271015
+ });
271016
+ }
271017
+
271018
+ // src/error/nothing-selected-error.ts
271019
+ function nothingSelectedError(type4) {
271020
+ return cancel2(`No ${type4} selected. Please select a ${type4} to continue.`);
271021
+ }
271022
+
271023
+ // src/prompts/application.prompt.ts
271024
+ async function applicationPrompt(env2, applications, accept) {
271025
+ const autoAccept = !!accept || is_in_ci_default;
271026
+ const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
271027
+ const defaultPossible = autoAccept && defaultApplication;
271028
+ if (defaultPossible) {
271029
+ return defaultApplication;
271030
+ }
271031
+ if (applications.length === 0) {
271032
+ cancel2("No applications found");
271033
+ }
271034
+ if (is_in_ci_default) {
271035
+ nothingSelectedError("application");
271036
+ }
271037
+ const application = await esm_default2({
271038
+ message: "Which application do you want to connect to?",
271039
+ choices: applications.map((applications2) => ({
271040
+ name: `${applications2.name} (${applications2.uniqueName})`,
271041
+ value: applications2
271042
+ })),
271043
+ default: defaultApplication
271044
+ });
271045
+ if (!application) {
271046
+ cancel2("No application selected");
271047
+ }
271048
+ return application;
271049
+ }
271050
+
271051
+ // src/prompts/cluster-service/service.prompt.ts
271052
+ async function servicePrompt({
271053
+ env: env2,
271054
+ services,
271055
+ accept,
271056
+ envKey,
271057
+ defaultHandler,
271058
+ isRequired = false,
271059
+ isCi = is_in_ci_default
271060
+ }) {
271061
+ if (services.length === 0) {
271062
+ return;
271063
+ }
271064
+ const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
271065
+ const autoAccept = isCi || accept;
271066
+ if (autoAccept && selectedService) {
271067
+ return selectedService;
271068
+ }
271069
+ if (isCi) {
271070
+ return;
271071
+ }
271072
+ if (isRequired && services.length === 1) {
271073
+ return services[0];
271074
+ }
271075
+ const choices = services.map((service) => ({
271076
+ name: `${service.name} (${service.uniqueName})`,
271077
+ value: service
271078
+ }));
271079
+ if (!isRequired) {
271080
+ choices.push({
271081
+ name: "None",
271082
+ value: undefined
271083
+ });
271084
+ }
271085
+ return defaultHandler({ defaultService: selectedService, choices });
271086
+ }
271087
+
271088
+ // src/prompts/cluster-service/blockchain-node.prompt.ts
271089
+ async function blockchainNodePrompt({
271090
+ env: env2,
271091
+ nodes,
271092
+ accept,
271093
+ filterRunningOnly = false,
271094
+ isRequired = false
271095
+ }) {
271096
+ return servicePrompt({
271097
+ env: env2,
271098
+ services: nodes,
271099
+ accept,
271100
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
271101
+ isRequired,
271102
+ defaultHandler: async ({ defaultService: defaultNode, choices }) => {
271103
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
271104
+ return esm_default2({
271105
+ message: "Which blockchain node do you want to connect to?",
271106
+ choices: filteredChoices,
271107
+ default: defaultNode
271108
+ });
271109
+ }
271110
+ });
271111
+ }
271112
+
271113
+ // src/prompts/cluster-service/blockscout.prompt.ts
271114
+ async function blockscoutPrompt({
271115
+ env: env2,
271116
+ insights,
271117
+ accept,
271118
+ isRequired = false
271119
+ }) {
271120
+ const possible = insights.filter((insight) => insight.insightsCategory === "BLOCKCHAIN_EXPLORER");
271121
+ return servicePrompt({
271122
+ env: env2,
271123
+ services: possible,
271124
+ accept,
271125
+ envKey: "SETTLEMINT_BLOCKSCOUT",
271126
+ isRequired,
271127
+ defaultHandler: async ({ defaultService: defaultBlockscout, choices }) => {
271128
+ return esm_default2({
271129
+ message: "Which blockscout instance do you want to connect to?",
271130
+ choices,
271131
+ default: defaultBlockscout
271132
+ });
271133
+ }
271134
+ });
271135
+ }
271136
+
271137
+ // src/prompts/cluster-service/custom-deployment.prompt.ts
271138
+ async function customDeploymentPrompt({
271139
+ env: env2,
271140
+ customDeployments,
271141
+ accept,
271142
+ isRequired = false
271143
+ }) {
271144
+ return servicePrompt({
271145
+ env: env2,
271146
+ services: customDeployments,
271147
+ accept,
271148
+ envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
271149
+ isRequired,
271150
+ defaultHandler: async ({ defaultService: defaultCustomDeployment, choices }) => {
271151
+ return esm_default2({
271152
+ message: "Which Custom Deployment do you want to connect to?",
271153
+ choices,
271154
+ default: defaultCustomDeployment
271155
+ });
271156
+ }
271157
+ });
271158
+ }
271159
+
271160
+ // src/prompts/cluster-service/hasura.prompt.ts
271161
+ async function hasuraPrompt({
271162
+ env: env2,
271163
+ integrations,
271164
+ accept,
271165
+ isRequired = false
271166
+ }) {
271167
+ const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
271168
+ return servicePrompt({
271169
+ env: env2,
271170
+ services: possible,
271171
+ accept,
271172
+ envKey: "SETTLEMINT_HASURA",
271173
+ isRequired,
271174
+ defaultHandler: async ({ defaultService: defaultHasura, choices }) => {
271175
+ return esm_default2({
271176
+ message: "Which Hasura instance do you want to connect to?",
271177
+ choices,
271178
+ default: defaultHasura
271179
+ });
271180
+ }
271181
+ });
271182
+ }
271183
+
271184
+ // src/prompts/cluster-service/hd-private-keys.prompt.ts
271185
+ async function hdPrivateKeyPrompt({
271186
+ env: env2,
271187
+ privateKeys,
271188
+ accept,
271189
+ isRequired = false
271190
+ }) {
271191
+ const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
271192
+ return servicePrompt({
271193
+ env: env2,
271194
+ services: possible,
271195
+ accept,
271196
+ envKey: "SETTLEMINT_HD_PRIVATE_KEY",
271197
+ isRequired,
271198
+ defaultHandler: async ({ defaultService: defaultPrivateKey, choices }) => {
271199
+ return esm_default2({
271200
+ message: "Which HD Private Key do you want to use?",
271201
+ choices,
271202
+ default: defaultPrivateKey
271203
+ });
271204
+ }
271205
+ });
271206
+ }
271207
+
271208
+ // src/prompts/cluster-service/ipfs.prompt.ts
271209
+ async function ipfsPrompt({
271210
+ env: env2,
271211
+ storages,
271212
+ accept,
271213
+ isRequired = false
271214
+ }) {
271215
+ const possible = storages.filter((storage) => storage.storageProtocol === "IPFS");
271216
+ return servicePrompt({
271217
+ env: env2,
271218
+ services: possible,
271219
+ accept,
271220
+ envKey: "SETTLEMINT_IPFS",
271221
+ isRequired,
271222
+ defaultHandler: async ({ defaultService: defaultStorage, choices }) => {
271223
+ return esm_default2({
271224
+ message: "Which IPFS instance do you want to connect to?",
271225
+ choices,
271226
+ default: defaultStorage
271227
+ });
271228
+ }
271229
+ });
271230
+ }
271231
+
271232
+ // src/prompts/cluster-service/minio.prompt.ts
271233
+ async function minioPrompt({
271234
+ env: env2,
271235
+ storages,
271236
+ accept,
271237
+ isRequired = false
271238
+ }) {
271239
+ const possible = storages.filter((storage) => storage.storageProtocol === "MINIO");
271240
+ return servicePrompt({
271241
+ env: env2,
271242
+ services: possible,
271243
+ accept,
271244
+ envKey: "SETTLEMINT_MINIO",
271245
+ isRequired,
271246
+ defaultHandler: async ({ defaultService: defaultStorage, choices }) => {
271247
+ return esm_default2({
271248
+ message: "Which MinIO instance do you want to connect to?",
271249
+ choices,
271250
+ default: defaultStorage
271251
+ });
271252
+ }
271253
+ });
271254
+ }
271255
+
271256
+ // src/prompts/cluster-service/portal.prompt.ts
271257
+ async function portalPrompt({
271258
+ env: env2,
271259
+ middlewares,
271260
+ accept,
271261
+ isRequired = false
271262
+ }) {
271263
+ const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
271264
+ return servicePrompt({
271265
+ env: env2,
271266
+ services: possible,
271267
+ accept,
271268
+ envKey: "SETTLEMINT_PORTAL",
271269
+ isRequired,
271270
+ defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
271271
+ return esm_default2({
271272
+ message: "Which Smart Contract Portal instance do you want to connect to?",
271273
+ choices,
271274
+ default: defaultMiddleware
271275
+ });
271276
+ }
271277
+ });
271278
+ }
271279
+
271280
+ // src/prompts/cluster-service/thegraph.prompt.ts
271281
+ async function theGraphPrompt({
271282
+ env: env2,
271283
+ middlewares,
271284
+ accept,
271285
+ filterRunningOnly = false,
271286
+ isRequired = false
271287
+ }) {
271288
+ const graphMiddlewares = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
271289
+ return servicePrompt({
271290
+ env: env2,
271291
+ services: graphMiddlewares,
271292
+ accept,
271293
+ envKey: "SETTLEMINT_THEGRAPH",
271294
+ isRequired,
271295
+ defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
271296
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => middleware === undefined || middleware?.status === "COMPLETED") : choices;
271297
+ return esm_default2({
271298
+ message: "Which The Graph instance do you want to connect to?",
271299
+ choices: filteredChoices,
271300
+ default: defaultMiddleware
271301
+ });
271302
+ }
271303
+ });
271304
+ }
271305
+
270875
271306
  // src/utils/instance-url-utils.ts
270876
271307
  function sanitizeInstanceUrl(url) {
270877
271308
  const instanceUrl = new URL(url);
@@ -270883,6 +271314,266 @@ function sanitizeAndValidateInstanceUrl(url) {
270883
271314
  return sanitizedUrl;
270884
271315
  }
270885
271316
 
271317
+ // src/prompts/instance.prompt.ts
271318
+ async function instancePrompt(env2, accept, freeTextInput = false, isCi = is_in_ci_default) {
271319
+ const knownInstances = await getInstances();
271320
+ const autoAccept = !!accept || isCi;
271321
+ const defaultInstance = env2.SETTLEMINT_INSTANCE;
271322
+ const defaultPossible = autoAccept && defaultInstance;
271323
+ if (defaultPossible) {
271324
+ return sanitizeInstanceUrl(defaultInstance);
271325
+ }
271326
+ const defaultPromptInstance = defaultInstance ?? (knownInstances.length > 0 ? knownInstances[0] : "https://console.settlemint.com");
271327
+ if (isCi) {
271328
+ return sanitizeInstanceUrl(defaultPromptInstance);
271329
+ }
271330
+ if (freeTextInput) {
271331
+ const instance = await esm_default4({
271332
+ message: "What is the URL of your SettleMint instance?",
271333
+ default: defaultPromptInstance,
271334
+ required: true,
271335
+ validate(value4) {
271336
+ try {
271337
+ validate2(UrlSchema2, value4);
271338
+ return true;
271339
+ } catch (error5) {
271340
+ return "Invalid URL";
271341
+ }
271342
+ },
271343
+ transformer: (value4) => value4.trim()
271344
+ });
271345
+ return sanitizeInstanceUrl(instance);
271346
+ }
271347
+ if (knownInstances.length === 0) {
271348
+ cancel2("No instances found. Please run `settlemint login` to configure an instance.");
271349
+ }
271350
+ if (knownInstances.length === 1) {
271351
+ return sanitizeInstanceUrl(knownInstances[0]);
271352
+ }
271353
+ return esm_default2({
271354
+ message: "What SettleMint instance do you want to connect to?",
271355
+ choices: [
271356
+ ...knownInstances.map((instance) => ({
271357
+ name: instance,
271358
+ value: sanitizeInstanceUrl(instance)
271359
+ }))
271360
+ ],
271361
+ default: sanitizeInstanceUrl(defaultPromptInstance)
271362
+ });
271363
+ }
271364
+
271365
+ // src/prompts/workspace.prompt.ts
271366
+ async function workspacePrompt(env2, workspaces, accept) {
271367
+ const autoAccept = !!accept || is_in_ci_default;
271368
+ const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
271369
+ const defaultPossible = autoAccept && defaultWorkspace;
271370
+ if (defaultPossible) {
271371
+ return defaultWorkspace;
271372
+ }
271373
+ if (workspaces.length === 0) {
271374
+ cancel2("No workspaces found");
271375
+ }
271376
+ if (is_in_ci_default) {
271377
+ nothingSelectedError("workspace");
271378
+ }
271379
+ const workspace = await esm_default2({
271380
+ message: "Which workspace do you want to connect to?",
271381
+ choices: workspaces.map((workspace2) => ({
271382
+ name: `${workspace2.name} (${workspace2.uniqueName})`,
271383
+ value: workspace2
271384
+ })),
271385
+ default: defaultWorkspace
271386
+ });
271387
+ if (!workspace) {
271388
+ cancel2("No workspace selected");
271389
+ }
271390
+ return workspace;
271391
+ }
271392
+
271393
+ // src/spinners/services.spinner.ts
271394
+ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
271395
+ return spinner({
271396
+ startMessage: "Loading your services",
271397
+ stopMessage: "Loaded your services",
271398
+ task: async () => {
271399
+ const shouldFetch = (type4) => !types2 || types2?.includes(type4);
271400
+ const [
271401
+ blockchainNetworks,
271402
+ blockchainNodes,
271403
+ middlewares,
271404
+ integrationTools,
271405
+ storages,
271406
+ privateKeys,
271407
+ insights,
271408
+ customDeployments
271409
+ ] = await Promise.all([
271410
+ shouldFetch("blockchain-network") ? settlemint.blockchainNetwork.list(applicationUniqueName) : Promise.resolve([]),
271411
+ shouldFetch("blockchain-node") ? settlemint.blockchainNode.list(applicationUniqueName) : Promise.resolve([]),
271412
+ shouldFetch("middleware") ? settlemint.middleware.list(applicationUniqueName) : Promise.resolve([]),
271413
+ shouldFetch("integration-tool") ? settlemint.integrationTool.list(applicationUniqueName) : Promise.resolve([]),
271414
+ shouldFetch("storage") ? settlemint.storage.list(applicationUniqueName) : Promise.resolve([]),
271415
+ shouldFetch("private-key") ? settlemint.privateKey.list(applicationUniqueName) : Promise.resolve([]),
271416
+ shouldFetch("insights") ? settlemint.insights.list(applicationUniqueName) : Promise.resolve([]),
271417
+ shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
271418
+ ]);
271419
+ return {
271420
+ blockchainNetworks,
271421
+ blockchainNodes,
271422
+ middlewares,
271423
+ integrationTools,
271424
+ storages,
271425
+ privateKeys,
271426
+ insights,
271427
+ customDeployments
271428
+ };
271429
+ }
271430
+ });
271431
+ }
271432
+
271433
+ // src/spinners/workspaces.spinner.ts
271434
+ async function workspaceSpinner(settlemint) {
271435
+ return spinner({
271436
+ startMessage: "Loading your workspaces",
271437
+ stopMessage: "Loaded your workspaces",
271438
+ task: async () => {
271439
+ return settlemint.workspace.list();
271440
+ }
271441
+ });
271442
+ }
271443
+
271444
+ // src/spinners/write-env.spinner.ts
271445
+ async function writeEnvSpinner(prod, env2) {
271446
+ return spinner({
271447
+ startMessage: "Saving .env and .env.local files",
271448
+ stopMessage: "Written .env and .env.local file",
271449
+ task: async () => {
271450
+ const updatedSecrets = {
271451
+ SETTLEMINT_ACCESS_TOKEN: env2.SETTLEMINT_ACCESS_TOKEN,
271452
+ SETTLEMINT_HASURA_ADMIN_SECRET: env2.SETTLEMINT_HASURA_ADMIN_SECRET,
271453
+ SETTLEMINT_MINIO_SECRET_KEY: env2.SETTLEMINT_MINIO_SECRET_KEY,
271454
+ SETTLEMINT_HASURA_DATABASE_URL: env2.SETTLEMINT_HASURA_DATABASE_URL
271455
+ };
271456
+ await writeEnv({
271457
+ prod,
271458
+ env: updatedSecrets,
271459
+ secrets: true
271460
+ });
271461
+ const updatedEnv = {
271462
+ SETTLEMINT_INSTANCE: env2.SETTLEMINT_INSTANCE,
271463
+ SETTLEMINT_WORKSPACE: env2.SETTLEMINT_WORKSPACE,
271464
+ SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
271465
+ SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
271466
+ SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
271467
+ SETTLEMINT_LOAD_BALANCER: env2.SETTLEMINT_LOAD_BALANCER,
271468
+ SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
271469
+ SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
271470
+ SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
271471
+ SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS,
271472
+ SETTLEMINT_THEGRAPH_SUBGRAPH_NAME: env2.SETTLEMINT_THEGRAPH_SUBGRAPH_NAME,
271473
+ SETTLEMINT_PORTAL: env2.SETTLEMINT_PORTAL,
271474
+ SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT: env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT,
271475
+ SETTLEMINT_PORTAL_REST_ENDPOINT: env2.SETTLEMINT_PORTAL_REST_ENDPOINT,
271476
+ SETTLEMINT_HD_PRIVATE_KEY: env2.SETTLEMINT_HD_PRIVATE_KEY,
271477
+ SETTLEMINT_ACCESSIBLE_PRIVATE_KEY: env2.SETTLEMINT_ACCESSIBLE_PRIVATE_KEY,
271478
+ SETTLEMINT_MINIO: env2.SETTLEMINT_MINIO,
271479
+ SETTLEMINT_MINIO_ENDPOINT: env2.SETTLEMINT_MINIO_ENDPOINT,
271480
+ SETTLEMINT_MINIO_ACCESS_KEY: env2.SETTLEMINT_MINIO_ACCESS_KEY,
271481
+ SETTLEMINT_IPFS: env2.SETTLEMINT_IPFS,
271482
+ SETTLEMINT_IPFS_API_ENDPOINT: env2.SETTLEMINT_IPFS_API_ENDPOINT,
271483
+ SETTLEMINT_IPFS_PINNING_ENDPOINT: env2.SETTLEMINT_IPFS_PINNING_ENDPOINT,
271484
+ SETTLEMINT_IPFS_GATEWAY_ENDPOINT: env2.SETTLEMINT_IPFS_GATEWAY_ENDPOINT,
271485
+ SETTLEMINT_CUSTOM_DEPLOYMENT: env2.SETTLEMINT_CUSTOM_DEPLOYMENT,
271486
+ SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT: env2.SETTLEMINT_CUSTOM_DEPLOYMENT_ENDPOINT,
271487
+ SETTLEMINT_BLOCKSCOUT: env2.SETTLEMINT_BLOCKSCOUT,
271488
+ SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT: env2.SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT,
271489
+ SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT: env2.SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT,
271490
+ SETTLEMINT_NEW_PROJECT_NAME: env2.SETTLEMINT_NEW_PROJECT_NAME,
271491
+ SETTLEMINT_SMART_CONTRACT_ADDRESS: env2.SETTLEMINT_SMART_CONTRACT_ADDRESS,
271492
+ SETTLEMINT_SMART_CONTRACT_DEPLOYMENT_ID: env2.SETTLEMINT_SMART_CONTRACT_DEPLOYMENT_ID
271493
+ };
271494
+ await writeEnv({
271495
+ prod,
271496
+ env: updatedEnv,
271497
+ secrets: false
271498
+ });
271499
+ }
271500
+ });
271501
+ }
271502
+
271503
+ // src/utils/get-cluster-service-endpoint.ts
271504
+ async function getGraphEndpoint(settlemint, service, graphName) {
271505
+ if (!service || service.__typename !== "HAGraphMiddleware") {
271506
+ return {};
271507
+ }
271508
+ const theGraphMiddleware = await spinner({
271509
+ startMessage: "Fetching TheGraph subgraph endpoints",
271510
+ stopMessage: "Fetched TheGraph subgraph endpoints",
271511
+ task: () => retryWhenFailed(async () => {
271512
+ const middleware = await settlemint.middleware.graphSubgraphs(service.uniqueName, !!graphName);
271513
+ if (!middleware || middleware.__typename !== "HAGraphMiddleware") {
271514
+ throw new Error(`Middleware '${service.uniqueName}' is not a graph middleware`);
271515
+ }
271516
+ if (graphName && !middleware.subgraphs.find(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.id.endsWith(graphName))) {
271517
+ throw new Error(`Subgraph '${graphName}' not found in middleware '${service.uniqueName}'`);
271518
+ }
271519
+ return middleware;
271520
+ })
271521
+ });
271522
+ const endpoints = theGraphMiddleware.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue);
271523
+ return {
271524
+ SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: endpoints
271525
+ };
271526
+ }
271527
+ function getIpfsEndpoints(service) {
271528
+ if (!service || service.__typename !== "IPFSStorage") {
271529
+ return {};
271530
+ }
271531
+ return {
271532
+ SETTLEMINT_IPFS_API_ENDPOINT: service?.endpoints.find((endpoint) => endpoint.id.includes("api"))?.displayValue,
271533
+ SETTLEMINT_IPFS_PINNING_ENDPOINT: service?.endpoints.find((endpoint) => endpoint.id.includes("cluster-pinning-api"))?.displayValue,
271534
+ SETTLEMINT_IPFS_GATEWAY_ENDPOINT: service?.endpoints.find((endpoint) => endpoint.id.includes("gateway"))?.displayValue
271535
+ };
271536
+ }
271537
+ function getPortalEndpoints(service) {
271538
+ if (!service || service.__typename !== "SmartContractPortalMiddleware") {
271539
+ return {};
271540
+ }
271541
+ return {
271542
+ SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("graphql"))?.displayValue,
271543
+ SETTLEMINT_PORTAL_REST_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("rest"))?.displayValue
271544
+ };
271545
+ }
271546
+ function getHasuraEndpoints(service) {
271547
+ if (!service || service.__typename !== "Hasura") {
271548
+ return {};
271549
+ }
271550
+ return {
271551
+ SETTLEMINT_HASURA_ENDPOINT: service.endpoints.find((endpoint) => endpoint.id.includes("graphql"))?.displayValue,
271552
+ SETTLEMINT_HASURA_ADMIN_SECRET: service.credentials.find((credential) => credential.id.includes("admin-secret"))?.displayValue,
271553
+ SETTLEMINT_HASURA_DATABASE_URL: service.endpoints.find((endpoint) => endpoint.id.includes("postgresql"))?.displayValue
271554
+ };
271555
+ }
271556
+ function getBlockscoutEndpoints(service) {
271557
+ if (!service || service.__typename !== "BlockchainExplorer") {
271558
+ return {};
271559
+ }
271560
+ const uiEndpoint = service.endpoints.find((endpoint) => endpoint.id.includes("interface"))?.displayValue;
271561
+ return {
271562
+ SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT: uiEndpoint ? `${new URL("/api/v1/graphql", uiEndpoint).toString()}` : undefined,
271563
+ SETTLEMINT_BLOCKSCOUT_UI_ENDPOINT: uiEndpoint
271564
+ };
271565
+ }
271566
+ function getMinioEndpoints(service) {
271567
+ if (!service || service.__typename !== "MinioStorage") {
271568
+ return {};
271569
+ }
271570
+ return {
271571
+ SETTLEMINT_MINIO_ENDPOINT: service?.endpoints.find((endpoint) => endpoint.id.includes("s3-api"))?.displayValue,
271572
+ SETTLEMINT_MINIO_ACCESS_KEY: service?.credentials.find((credential) => credential.id.includes("access-key"))?.displayValue,
271573
+ SETTLEMINT_MINIO_SECRET_KEY: service?.credentials.find((credential) => credential.id.includes("secret-key"))?.displayValue
271574
+ };
271575
+ }
271576
+
270886
271577
  // ../../node_modules/environment/index.js
270887
271578
  var isBrowser = globalThis.window?.document !== undefined;
270888
271579
  var isNode = globalThis.process?.versions?.node !== undefined;
@@ -271767,6 +272458,9 @@ var BlockchainNetworkFragment = graphql(`
271767
272458
  uniqueName
271768
272459
  name
271769
272460
  status
272461
+ healthStatus
272462
+ provider
272463
+ region
271770
272464
  blockchainNodes {
271771
272465
  ... on BlockchainNode {
271772
272466
  id
@@ -271914,6 +272608,9 @@ var BlockchainNodeFragment = graphql(`
271914
272608
  uniqueName
271915
272609
  name
271916
272610
  status
272611
+ healthStatus
272612
+ provider
272613
+ region
271917
272614
  isEvm
271918
272615
  endpoints {
271919
272616
  id
@@ -272035,6 +272732,9 @@ var CustomDeploymentFragment = graphql(`
272035
272732
  uniqueName
272036
272733
  name
272037
272734
  status
272735
+ healthStatus
272736
+ provider
272737
+ region
272038
272738
  endpoints {
272039
272739
  id
272040
272740
  label
@@ -272161,6 +272861,11 @@ var LoadBalancerFragment = graphql(`
272161
272861
  fragment LoadBalancer on LoadBalancer {
272162
272862
  id
272163
272863
  uniqueName
272864
+ name
272865
+ status
272866
+ healthStatus
272867
+ provider
272868
+ region
272164
272869
  }
272165
272870
  `);
272166
272871
  var getLoadBalancer = graphql(`
@@ -272185,6 +272890,9 @@ var InsightsFragment = graphql(`
272185
272890
  uniqueName
272186
272891
  name
272187
272892
  status
272893
+ healthStatus
272894
+ provider
272895
+ region
272188
272896
  insightsCategory
272189
272897
  endpoints {
272190
272898
  id
@@ -272292,6 +273000,9 @@ var IntegrationFragment = graphql(`
272292
273000
  uniqueName
272293
273001
  name
272294
273002
  status
273003
+ healthStatus
273004
+ provider
273005
+ region
272295
273006
  integrationType
272296
273007
  endpoints {
272297
273008
  id
@@ -272389,6 +273100,9 @@ var StorageFragment = graphql(`
272389
273100
  uniqueName
272390
273101
  name
272391
273102
  status
273103
+ healthStatus
273104
+ provider
273105
+ region
272392
273106
  storageProtocol
272393
273107
  endpoints {
272394
273108
  id
@@ -272486,6 +273200,9 @@ var MiddlewareFragment = graphql(`
272486
273200
  uniqueName
272487
273201
  name
272488
273202
  status
273203
+ healthStatus
273204
+ provider
273205
+ region
272489
273206
  interface
272490
273207
  entityVersion
272491
273208
  serviceUrl
@@ -272670,6 +273387,9 @@ var PrivateKeyFragment = graphql(`
272670
273387
  name
272671
273388
  privateKeyType
272672
273389
  status
273390
+ healthStatus
273391
+ provider
273392
+ region
272673
273393
  }
272674
273394
  `);
272675
273395
  var getPrivateKeys = graphql(`
@@ -272867,669 +273587,6 @@ function createSettleMintClient(options) {
272867
273587
  };
272868
273588
  }
272869
273589
 
272870
- // ../../node_modules/@inquirer/confirm/dist/esm/index.js
272871
- function getBooleanValue(value4, defaultValue) {
272872
- let answer = defaultValue !== false;
272873
- if (/^(y|yes)/i.test(value4))
272874
- answer = true;
272875
- else if (/^(n|no)/i.test(value4))
272876
- answer = false;
272877
- return answer;
272878
- }
272879
- function boolToString(value4) {
272880
- return value4 ? "Yes" : "No";
272881
- }
272882
- var esm_default3 = createPrompt((config3, done) => {
272883
- const { transformer = boolToString } = config3;
272884
- const [status, setStatus] = useState("idle");
272885
- const [value4, setValue] = useState("");
272886
- const theme = makeTheme(config3.theme);
272887
- const prefix = usePrefix({ status, theme });
272888
- useKeypress((key2, rl) => {
272889
- if (isEnterKey(key2)) {
272890
- const answer = getBooleanValue(value4, config3.default);
272891
- setValue(transformer(answer));
272892
- setStatus("done");
272893
- done(answer);
272894
- } else if (key2.name === "tab") {
272895
- const answer = boolToString(!getBooleanValue(value4, config3.default));
272896
- rl.clearLine(0);
272897
- rl.write(answer);
272898
- setValue(answer);
272899
- } else {
272900
- setValue(rl.line);
272901
- }
272902
- });
272903
- let formattedValue = value4;
272904
- let defaultValue = "";
272905
- if (status === "done") {
272906
- formattedValue = theme.style.answer(value4);
272907
- } else {
272908
- defaultValue = ` ${theme.style.defaultAnswer(config3.default === false ? "y/N" : "Y/n")}`;
272909
- }
272910
- const message = theme.style.message(config3.message, status);
272911
- return `${prefix} ${message}${defaultValue} ${formattedValue}`;
272912
- });
272913
-
272914
- // ../../node_modules/@inquirer/input/dist/esm/index.js
272915
- var inputTheme = {
272916
- validationFailureMode: "keep"
272917
- };
272918
- var esm_default4 = createPrompt((config3, done) => {
272919
- const { required, validate: validate3 = () => true } = config3;
272920
- const theme = makeTheme(inputTheme, config3.theme);
272921
- const [status, setStatus] = useState("idle");
272922
- const [defaultValue = "", setDefaultValue] = useState(config3.default);
272923
- const [errorMsg, setError] = useState();
272924
- const [value4, setValue] = useState("");
272925
- const prefix = usePrefix({ status, theme });
272926
- useKeypress(async (key2, rl) => {
272927
- if (status !== "idle") {
272928
- return;
272929
- }
272930
- if (isEnterKey(key2)) {
272931
- const answer = value4 || defaultValue;
272932
- setStatus("loading");
272933
- const isValid2 = required && !answer ? "You must provide a value" : await validate3(answer);
272934
- if (isValid2 === true) {
272935
- setValue(answer);
272936
- setStatus("done");
272937
- done(answer);
272938
- } else {
272939
- if (theme.validationFailureMode === "clear") {
272940
- setValue("");
272941
- } else {
272942
- rl.write(value4);
272943
- }
272944
- setError(isValid2 || "You must provide a valid value");
272945
- setStatus("idle");
272946
- }
272947
- } else if (isBackspaceKey(key2) && !value4) {
272948
- setDefaultValue(undefined);
272949
- } else if (key2.name === "tab" && !value4) {
272950
- setDefaultValue(undefined);
272951
- rl.clearLine(0);
272952
- rl.write(defaultValue);
272953
- setValue(defaultValue);
272954
- } else {
272955
- setValue(rl.line);
272956
- setError(undefined);
272957
- }
272958
- });
272959
- const message = theme.style.message(config3.message, status);
272960
- let formattedValue = value4;
272961
- if (typeof config3.transformer === "function") {
272962
- formattedValue = config3.transformer(value4, { isFinal: status === "done" });
272963
- } else if (status === "done") {
272964
- formattedValue = theme.style.answer(value4);
272965
- }
272966
- let defaultStr;
272967
- if (defaultValue && status !== "done" && !value4) {
272968
- defaultStr = theme.style.defaultAnswer(defaultValue);
272969
- }
272970
- let error5 = "";
272971
- if (errorMsg) {
272972
- error5 = theme.style.error(errorMsg);
272973
- }
272974
- return [
272975
- [prefix, message, defaultStr, formattedValue].filter((v7) => v7 !== undefined).join(" "),
272976
- error5
272977
- ];
272978
- });
272979
-
272980
- // ../../node_modules/@inquirer/password/dist/esm/index.js
272981
- var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
272982
- var esm_default5 = createPrompt((config3, done) => {
272983
- const { validate: validate3 = () => true } = config3;
272984
- const theme = makeTheme(config3.theme);
272985
- const [status, setStatus] = useState("idle");
272986
- const [errorMsg, setError] = useState();
272987
- const [value4, setValue] = useState("");
272988
- const prefix = usePrefix({ status, theme });
272989
- useKeypress(async (key2, rl) => {
272990
- if (status !== "idle") {
272991
- return;
272992
- }
272993
- if (isEnterKey(key2)) {
272994
- const answer = value4;
272995
- setStatus("loading");
272996
- const isValid2 = await validate3(answer);
272997
- if (isValid2 === true) {
272998
- setValue(answer);
272999
- setStatus("done");
273000
- done(answer);
273001
- } else {
273002
- rl.write(value4);
273003
- setError(isValid2 || "You must provide a valid value");
273004
- setStatus("idle");
273005
- }
273006
- } else {
273007
- setValue(rl.line);
273008
- setError(undefined);
273009
- }
273010
- });
273011
- const message = theme.style.message(config3.message, status);
273012
- let formattedValue = "";
273013
- let helpTip;
273014
- if (config3.mask) {
273015
- const maskChar = typeof config3.mask === "string" ? config3.mask : "*";
273016
- formattedValue = maskChar.repeat(value4.length);
273017
- } else if (status !== "done") {
273018
- helpTip = `${theme.style.help("[input is masked]")}${import_ansi_escapes3.default.cursorHide}`;
273019
- }
273020
- if (status === "done") {
273021
- formattedValue = theme.style.answer(formattedValue);
273022
- }
273023
- let error5 = "";
273024
- if (errorMsg) {
273025
- error5 = theme.style.error(errorMsg);
273026
- }
273027
- return [[prefix, message, config3.mask ? formattedValue : helpTip].join(" "), error5];
273028
- });
273029
-
273030
- // src/commands/connect/aat.prompt.ts
273031
- async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
273032
- const autoAccept = !!accept || is_in_ci_default;
273033
- const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
273034
- const defaultPossible = autoAccept && defaultAccessToken;
273035
- if (defaultPossible || is_in_ci_default) {
273036
- return defaultAccessToken;
273037
- }
273038
- if (defaultAccessToken) {
273039
- const keep = await esm_default3({
273040
- message: "Do you want to use the existing application access token?",
273041
- default: true
273042
- });
273043
- if (keep) {
273044
- return defaultAccessToken;
273045
- }
273046
- }
273047
- const create2 = await esm_default3({
273048
- message: "Do you want to create a new application access token?",
273049
- default: false
273050
- });
273051
- if (create2) {
273052
- const name2 = await esm_default4({
273053
- message: "How would you like to name this application access token?",
273054
- default: `SettleMint CLI (${Date.now()}${` ${"runner"}`})`,
273055
- required: true,
273056
- validate(value4) {
273057
- try {
273058
- validate2(z.string(), value4);
273059
- return true;
273060
- } catch (error5) {
273061
- return "Invalid token name";
273062
- }
273063
- }
273064
- });
273065
- const aat = await settlemint.applicationAccessToken.create({
273066
- applicationUniqueName: application.uniqueName,
273067
- name: name2,
273068
- blockchainNetworkScope: {
273069
- type: "ALL",
273070
- values: []
273071
- },
273072
- blockchainNodeScope: {
273073
- type: "ALL",
273074
- values: []
273075
- },
273076
- customDeploymentScope: {
273077
- type: "ALL",
273078
- values: []
273079
- },
273080
- insightsScope: {
273081
- type: "ALL",
273082
- values: []
273083
- },
273084
- integrationScope: {
273085
- type: "ALL",
273086
- values: []
273087
- },
273088
- loadBalancerScope: {
273089
- type: "ALL",
273090
- values: []
273091
- },
273092
- middlewareScope: {
273093
- type: "ALL",
273094
- values: []
273095
- },
273096
- privateKeyScope: {
273097
- type: "ALL",
273098
- values: []
273099
- },
273100
- smartContractSetScope: {
273101
- type: "ALL",
273102
- values: []
273103
- },
273104
- storageScope: {
273105
- type: "ALL",
273106
- values: []
273107
- },
273108
- validityPeriod: "NONE"
273109
- });
273110
- try {
273111
- validate2(ApplicationAccessTokenSchema2, aat);
273112
- return aat;
273113
- } catch (error5) {
273114
- }
273115
- }
273116
- return esm_default5({
273117
- message: "What is the application access token for your application in SettleMint? (format: sm_aat_...)",
273118
- validate(value4) {
273119
- try {
273120
- validate2(ApplicationAccessTokenSchema2, value4);
273121
- return true;
273122
- } catch (error5) {
273123
- return "Invalid application access token, it should start with sm_aat_...";
273124
- }
273125
- }
273126
- });
273127
- }
273128
-
273129
- // src/error/nothing-selected-error.ts
273130
- function nothingSelectedError(type4) {
273131
- return cancel2(`No ${type4} selected. Please select a ${type4} to continue.`);
273132
- }
273133
-
273134
- // src/commands/connect/application.prompt.ts
273135
- async function applicationPrompt(env2, applications, accept) {
273136
- const autoAccept = !!accept || is_in_ci_default;
273137
- const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
273138
- const defaultPossible = autoAccept && defaultApplication;
273139
- if (defaultPossible) {
273140
- return defaultApplication;
273141
- }
273142
- if (applications.length === 0) {
273143
- cancel2("No applications found");
273144
- }
273145
- if (is_in_ci_default) {
273146
- nothingSelectedError("application");
273147
- }
273148
- const application = await esm_default2({
273149
- message: "Which application do you want to connect to?",
273150
- choices: applications.map((applications2) => ({
273151
- name: `${applications2.name} (${applications2.uniqueName})`,
273152
- value: applications2
273153
- })),
273154
- default: defaultApplication
273155
- });
273156
- if (!application) {
273157
- cancel2("No application selected");
273158
- }
273159
- return application;
273160
- }
273161
-
273162
- // src/commands/connect/service.prompt.ts
273163
- async function servicePrompt({
273164
- env: env2,
273165
- services,
273166
- accept,
273167
- envKey,
273168
- defaultHandler,
273169
- isRequired = false,
273170
- isCi = is_in_ci_default
273171
- }) {
273172
- if (services.length === 0) {
273173
- return;
273174
- }
273175
- const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
273176
- const autoAccept = isCi || accept;
273177
- if (autoAccept && selectedService) {
273178
- return selectedService;
273179
- }
273180
- if (isCi) {
273181
- return;
273182
- }
273183
- if (isRequired && services.length === 1) {
273184
- return services[0];
273185
- }
273186
- const choices = services.map((service) => ({
273187
- name: `${service.name} (${service.uniqueName})`,
273188
- value: service
273189
- }));
273190
- if (!isRequired) {
273191
- choices.push({
273192
- name: "None",
273193
- value: undefined
273194
- });
273195
- }
273196
- return defaultHandler({ defaultService: selectedService, choices });
273197
- }
273198
-
273199
- // src/commands/connect/blockchain-node.prompt.ts
273200
- async function blockchainNodePrompt({
273201
- env: env2,
273202
- nodes,
273203
- accept,
273204
- filterRunningOnly = false,
273205
- isRequired = false
273206
- }) {
273207
- return servicePrompt({
273208
- env: env2,
273209
- services: nodes,
273210
- accept,
273211
- envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
273212
- isRequired,
273213
- defaultHandler: async ({ defaultService: defaultNode, choices }) => {
273214
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
273215
- return esm_default2({
273216
- message: "Which blockchain node do you want to connect to?",
273217
- choices: filteredChoices,
273218
- default: defaultNode
273219
- });
273220
- }
273221
- });
273222
- }
273223
-
273224
- // src/commands/connect/blockscout.prompt.ts
273225
- async function blockscoutPrompt({
273226
- env: env2,
273227
- insights,
273228
- accept,
273229
- isRequired = false
273230
- }) {
273231
- const possible = insights.filter((insight) => insight.insightsCategory === "BLOCKCHAIN_EXPLORER");
273232
- return servicePrompt({
273233
- env: env2,
273234
- services: possible,
273235
- accept,
273236
- envKey: "SETTLEMINT_BLOCKSCOUT",
273237
- isRequired,
273238
- defaultHandler: async ({ defaultService: defaultBlockscout, choices }) => {
273239
- return esm_default2({
273240
- message: "Which blockscout instance do you want to connect to?",
273241
- choices,
273242
- default: defaultBlockscout
273243
- });
273244
- }
273245
- });
273246
- }
273247
-
273248
- // src/commands/connect/custom-deployment.prompt.ts
273249
- async function customDeploymentPrompt({
273250
- env: env2,
273251
- customDeployments,
273252
- accept,
273253
- isRequired = false
273254
- }) {
273255
- return servicePrompt({
273256
- env: env2,
273257
- services: customDeployments,
273258
- accept,
273259
- envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
273260
- isRequired,
273261
- defaultHandler: async ({ defaultService: defaultCustomDeployment, choices }) => {
273262
- return esm_default2({
273263
- message: "Which Custom Deployment do you want to connect to?",
273264
- choices,
273265
- default: defaultCustomDeployment
273266
- });
273267
- }
273268
- });
273269
- }
273270
-
273271
- // src/commands/connect/hasura.prompt.ts
273272
- async function hasuraPrompt({
273273
- env: env2,
273274
- integrations,
273275
- accept,
273276
- isRequired = false
273277
- }) {
273278
- const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
273279
- return servicePrompt({
273280
- env: env2,
273281
- services: possible,
273282
- accept,
273283
- envKey: "SETTLEMINT_HASURA",
273284
- isRequired,
273285
- defaultHandler: async ({ defaultService: defaultHasura, choices }) => {
273286
- return esm_default2({
273287
- message: "Which Hasura instance do you want to connect to?",
273288
- choices,
273289
- default: defaultHasura
273290
- });
273291
- }
273292
- });
273293
- }
273294
-
273295
- // src/commands/connect/hd-private-keys.prompt.ts
273296
- async function hdPrivateKeyPrompt({
273297
- env: env2,
273298
- privateKeys,
273299
- accept,
273300
- isRequired = false
273301
- }) {
273302
- const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
273303
- return servicePrompt({
273304
- env: env2,
273305
- services: possible,
273306
- accept,
273307
- envKey: "SETTLEMINT_HD_PRIVATE_KEY",
273308
- isRequired,
273309
- defaultHandler: async ({ defaultService: defaultPrivateKey, choices }) => {
273310
- return esm_default2({
273311
- message: "Which HD Private Key do you want to use?",
273312
- choices,
273313
- default: defaultPrivateKey
273314
- });
273315
- }
273316
- });
273317
- }
273318
-
273319
- // src/commands/connect/instance.prompt.ts
273320
- async function instancePrompt(env2, accept, freeTextInput = false, isCi = is_in_ci_default) {
273321
- const knownInstances = await getInstances();
273322
- const autoAccept = !!accept || isCi;
273323
- const defaultInstance = env2.SETTLEMINT_INSTANCE;
273324
- const defaultPossible = autoAccept && defaultInstance;
273325
- if (defaultPossible) {
273326
- return sanitizeInstanceUrl(defaultInstance);
273327
- }
273328
- const defaultLoginInstance = await getDefaultInstance();
273329
- const defaultPromptInstance = defaultInstance ?? defaultLoginInstance ?? "https://console.settlemint.com";
273330
- if (isCi) {
273331
- return sanitizeInstanceUrl(defaultPromptInstance);
273332
- }
273333
- if (freeTextInput) {
273334
- const instance = await esm_default4({
273335
- message: "What is the URL of your SettleMint instance?",
273336
- default: defaultPromptInstance,
273337
- required: true,
273338
- validate(value4) {
273339
- try {
273340
- validate2(UrlSchema2, value4);
273341
- return true;
273342
- } catch (error5) {
273343
- return "Invalid URL";
273344
- }
273345
- },
273346
- transformer: (value4) => value4.trim()
273347
- });
273348
- return sanitizeInstanceUrl(instance);
273349
- }
273350
- if (knownInstances.length === 0) {
273351
- cancel2("No instances found. Please run `settlemint login` to configure an instance.");
273352
- }
273353
- if (knownInstances.length === 1) {
273354
- return sanitizeInstanceUrl(knownInstances[0]);
273355
- }
273356
- return esm_default2({
273357
- message: "What SettleMint instance do you want to connect to?",
273358
- choices: [
273359
- ...knownInstances.map((instance) => ({
273360
- name: instance,
273361
- value: sanitizeInstanceUrl(instance)
273362
- }))
273363
- ],
273364
- default: sanitizeInstanceUrl(defaultPromptInstance)
273365
- });
273366
- }
273367
-
273368
- // src/commands/connect/ipfs.prompt.ts
273369
- async function ipfsPrompt({
273370
- env: env2,
273371
- storages,
273372
- accept,
273373
- isRequired = false
273374
- }) {
273375
- const possible = storages.filter((storage) => storage.storageProtocol === "IPFS");
273376
- return servicePrompt({
273377
- env: env2,
273378
- services: possible,
273379
- accept,
273380
- envKey: "SETTLEMINT_IPFS",
273381
- isRequired,
273382
- defaultHandler: async ({ defaultService: defaultStorage, choices }) => {
273383
- return esm_default2({
273384
- message: "Which IPFS instance do you want to connect to?",
273385
- choices,
273386
- default: defaultStorage
273387
- });
273388
- }
273389
- });
273390
- }
273391
-
273392
- // src/commands/connect/minio.prompt.ts
273393
- async function minioPrompt({
273394
- env: env2,
273395
- storages,
273396
- accept,
273397
- isRequired = false
273398
- }) {
273399
- const possible = storages.filter((storage) => storage.storageProtocol === "MINIO");
273400
- return servicePrompt({
273401
- env: env2,
273402
- services: possible,
273403
- accept,
273404
- envKey: "SETTLEMINT_MINIO",
273405
- isRequired,
273406
- defaultHandler: async ({ defaultService: defaultStorage, choices }) => {
273407
- return esm_default2({
273408
- message: "Which MinIO instance do you want to connect to?",
273409
- choices,
273410
- default: defaultStorage
273411
- });
273412
- }
273413
- });
273414
- }
273415
-
273416
- // src/commands/connect/portal.prompt.ts
273417
- async function portalPrompt({
273418
- env: env2,
273419
- middlewares,
273420
- accept,
273421
- isRequired = false
273422
- }) {
273423
- const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
273424
- return servicePrompt({
273425
- env: env2,
273426
- services: possible,
273427
- accept,
273428
- envKey: "SETTLEMINT_PORTAL",
273429
- isRequired,
273430
- defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
273431
- return esm_default2({
273432
- message: "Which Smart Contract Portal instance do you want to connect to?",
273433
- choices,
273434
- default: defaultMiddleware
273435
- });
273436
- }
273437
- });
273438
- }
273439
-
273440
- // src/commands/connect/services.spinner.ts
273441
- async function servicesSpinner(settlemint, application) {
273442
- return spinner({
273443
- startMessage: "Loading your services",
273444
- stopMessage: "Loaded your services",
273445
- task: async () => {
273446
- const [
273447
- blockchainNetworks,
273448
- blockchainNodes,
273449
- middlewares,
273450
- integrationTools,
273451
- storages,
273452
- privateKeys,
273453
- insights,
273454
- customDeployments
273455
- ] = await Promise.all([
273456
- settlemint.blockchainNetwork.list(application.uniqueName),
273457
- settlemint.blockchainNode.list(application.uniqueName),
273458
- settlemint.middleware.list(application.uniqueName),
273459
- settlemint.integrationTool.list(application.uniqueName),
273460
- settlemint.storage.list(application.uniqueName),
273461
- settlemint.privateKey.list(application.uniqueName),
273462
- settlemint.insights.list(application.uniqueName),
273463
- settlemint.customDeployment.list(application.uniqueName)
273464
- ]);
273465
- return {
273466
- blockchainNetworks,
273467
- blockchainNodes,
273468
- middlewares,
273469
- integrationTools,
273470
- storages,
273471
- privateKeys,
273472
- insights,
273473
- customDeployments
273474
- };
273475
- }
273476
- });
273477
- }
273478
-
273479
- // src/commands/connect/thegraph.prompt.ts
273480
- async function theGraphPrompt({
273481
- env: env2,
273482
- middlewares,
273483
- accept,
273484
- filterRunningOnly = false,
273485
- isRequired = false
273486
- }) {
273487
- const graphMiddlewares = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
273488
- return servicePrompt({
273489
- env: env2,
273490
- services: graphMiddlewares,
273491
- accept,
273492
- envKey: "SETTLEMINT_THEGRAPH",
273493
- isRequired,
273494
- defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
273495
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => middleware === undefined || middleware?.status === "COMPLETED") : choices;
273496
- return esm_default2({
273497
- message: "Which The Graph instance do you want to connect to?",
273498
- choices: filteredChoices,
273499
- default: defaultMiddleware
273500
- });
273501
- }
273502
- });
273503
- }
273504
-
273505
- // src/commands/connect/workspace.prompt.ts
273506
- async function workspacePrompt(env2, workspaces, accept) {
273507
- const autoAccept = !!accept || is_in_ci_default;
273508
- const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
273509
- const defaultPossible = autoAccept && defaultWorkspace;
273510
- if (defaultPossible) {
273511
- return defaultWorkspace;
273512
- }
273513
- if (workspaces.length === 0) {
273514
- cancel2("No workspaces found");
273515
- }
273516
- if (is_in_ci_default) {
273517
- nothingSelectedError("workspace");
273518
- }
273519
- const workspace = await esm_default2({
273520
- message: "Which workspace do you want to connect to?",
273521
- choices: workspaces.map((workspace2) => ({
273522
- name: `${workspace2.name} (${workspace2.uniqueName})`,
273523
- value: workspace2
273524
- })),
273525
- default: defaultWorkspace
273526
- });
273527
- if (!workspace) {
273528
- cancel2("No workspace selected");
273529
- }
273530
- return workspace;
273531
- }
273532
-
273533
273590
  // src/commands/connect.ts
273534
273591
  function connectCommand() {
273535
273592
  return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod, instance }) => {
@@ -273549,7 +273606,7 @@ function connectCommand() {
273549
273606
  const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
273550
273607
  const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
273551
273608
  const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
273552
- const { middlewares, integrationTools, storages, privateKeys, insights, customDeployments, blockchainNodes } = await servicesSpinner(settlemint, application);
273609
+ const { middlewares, integrationTools, storages, privateKeys, insights, customDeployments, blockchainNodes } = await servicesSpinner(settlemint, application.uniqueName);
273553
273610
  const blockchainNode = await blockchainNodePrompt({
273554
273611
  env: env2,
273555
273612
  nodes: blockchainNodes,
@@ -273597,20 +273654,68 @@ function connectCommand() {
273597
273654
  });
273598
273655
  if (acceptDefaults) {
273599
273656
  const selectedServices = [
273600
- `Workspace: ${workspace.name} (${workspace.uniqueName})`,
273601
- `Application: ${application.name} (${application.uniqueName})`,
273602
- blockchainNode && `Blockchain Network: ${blockchainNode?.blockchainNetwork?.name} (${blockchainNode?.blockchainNetwork?.uniqueName})`,
273603
- blockchainNode && `Blockchain Node: ${blockchainNode?.name} (${blockchainNode?.uniqueName})`,
273604
- hasura && `Hasura: ${hasura?.name} (${hasura?.uniqueName})`,
273605
- thegraph && `TheGraph: ${thegraph?.name} (${thegraph?.uniqueName})`,
273606
- portal && `Portal: ${portal?.name} (${portal?.uniqueName})`,
273607
- ipfs && `IPFS: ${ipfs?.name} (${ipfs?.uniqueName})`,
273608
- minio && `MinIO: ${minio?.name} (${minio?.uniqueName})`,
273609
- hdPrivateKey && `HD Private Key: ${hdPrivateKey?.name} (${hdPrivateKey?.uniqueName})`,
273610
- cDeployment && `Custom Deployment: ${cDeployment?.name} (${cDeployment?.uniqueName})`,
273611
- blockscout && `Blockscout: ${blockscout?.name} (${blockscout?.uniqueName})`
273657
+ {
273658
+ type: "Workspace",
273659
+ name: workspace.name,
273660
+ uniqueName: workspace.uniqueName
273661
+ },
273662
+ {
273663
+ type: "Application",
273664
+ name: application.name,
273665
+ uniqueName: application.uniqueName
273666
+ },
273667
+ blockchainNode && {
273668
+ type: "Blockchain Network",
273669
+ name: blockchainNode.blockchainNetwork?.name,
273670
+ uniqueName: blockchainNode.blockchainNetwork?.uniqueName
273671
+ },
273672
+ blockchainNode && {
273673
+ type: "Blockchain Node",
273674
+ name: blockchainNode.name,
273675
+ uniqueName: blockchainNode.uniqueName
273676
+ },
273677
+ hasura && {
273678
+ type: "Hasura",
273679
+ name: hasura.name,
273680
+ uniqueName: hasura.uniqueName
273681
+ },
273682
+ thegraph && {
273683
+ type: "TheGraph",
273684
+ name: thegraph.name,
273685
+ uniqueName: thegraph.uniqueName
273686
+ },
273687
+ portal && {
273688
+ type: "Portal",
273689
+ name: portal.name,
273690
+ uniqueName: portal.uniqueName
273691
+ },
273692
+ ipfs && {
273693
+ type: "IPFS",
273694
+ name: ipfs.name,
273695
+ uniqueName: ipfs.uniqueName
273696
+ },
273697
+ minio && {
273698
+ type: "MinIO",
273699
+ name: minio.name,
273700
+ uniqueName: minio.uniqueName
273701
+ },
273702
+ hdPrivateKey && {
273703
+ type: "HD Private Key",
273704
+ name: hdPrivateKey.name,
273705
+ uniqueName: hdPrivateKey.uniqueName
273706
+ },
273707
+ cDeployment && {
273708
+ type: "Custom Deployment",
273709
+ name: cDeployment.name,
273710
+ uniqueName: cDeployment.uniqueName
273711
+ },
273712
+ blockscout && {
273713
+ type: "Blockscout",
273714
+ name: blockscout.name,
273715
+ uniqueName: blockscout.uniqueName
273716
+ }
273612
273717
  ].filter(Boolean);
273613
- list("Selected services", selectedServices);
273718
+ table("Selected services", selectedServices);
273614
273719
  }
273615
273720
  await writeEnvSpinner(!!prod, {
273616
273721
  SETTLEMINT_ACCESS_TOKEN: aatToken,
@@ -273643,8 +273748,8 @@ function connectCommand() {
273643
273748
  import { mkdir as mkdir6 } from "node:fs/promises";
273644
273749
  import { join as join9 } from "node:path";
273645
273750
 
273646
- // src/commands/create/name.prompt.ts
273647
- async function namePrompt(env2, argument) {
273751
+ // src/prompts/project-name.prompt.ts
273752
+ async function projectNamePrompt(env2, argument) {
273648
273753
  const defaultInstance = env2.SETTLEMINT_NEW_PROJECT_NAME ?? argument;
273649
273754
  if (defaultInstance) {
273650
273755
  return defaultInstance;
@@ -273664,7 +273769,7 @@ async function namePrompt(env2, argument) {
273664
273769
  });
273665
273770
  }
273666
273771
 
273667
- // src/commands/platform/utils/platform-utils.ts
273772
+ // src/utils/platform-utils.ts
273668
273773
  function getUseCases(platformConfig) {
273669
273774
  return platformConfig.smartContractSets.sets.filter((useCase) => !useCase.featureflagged && !useCase.id.startsWith("starterkit-"));
273670
273775
  }
@@ -273672,7 +273777,7 @@ function getStarterkits(platformConfig) {
273672
273777
  return platformConfig.smartContractSets.sets.filter((useCase) => useCase.id.startsWith("starterkit-"));
273673
273778
  }
273674
273779
 
273675
- // src/commands/create/template.prompt.ts
273780
+ // src/prompts/starter-kit/template.prompt.ts
273676
273781
  async function templatePrompt(platformConfig, argument) {
273677
273782
  const starterkits = getStarterkits(platformConfig);
273678
273783
  if (starterkits.length === 0) {
@@ -273698,7 +273803,7 @@ async function templatePrompt(platformConfig, argument) {
273698
273803
  return template;
273699
273804
  }
273700
273805
 
273701
- // src/commands/create/download-extract.ts
273806
+ // src/utils/download-extract.ts
273702
273807
  import { mkdir as mkdir5 } from "node:fs/promises";
273703
273808
 
273704
273809
  // ../../node_modules/giget/dist/index.mjs
@@ -274380,7 +274485,7 @@ async function downloadTemplate(input, options = {}) {
274380
274485
  };
274381
274486
  }
274382
274487
 
274383
- // src/commands/create/download-extract.ts
274488
+ // src/utils/download-extract.ts
274384
274489
  async function downloadAndExtractNpmPackage(template, targetDir) {
274385
274490
  await mkdir5(targetDir, { recursive: true });
274386
274491
  const response = await fetch(`https://registry.npmjs.org/${template}`);
@@ -274412,7 +274517,7 @@ function createCommand2() {
274412
274517
  if (!selectedTemplate) {
274413
274518
  return nothingSelectedError("template");
274414
274519
  }
274415
- const name2 = await namePrompt(env2, projectName);
274520
+ const name2 = await projectNamePrompt(env2, projectName);
274416
274521
  const targetDir = formatTargetDir(name2);
274417
274522
  const projectDir = join9(process.cwd(), targetDir);
274418
274523
  if (!await exists2(projectDir)) {
@@ -274440,18 +274545,7 @@ function createCommand2() {
274440
274545
  });
274441
274546
  }
274442
274547
 
274443
- // src/commands/connect/login.spinner.ts
274444
- async function loginSpinner(settlemint) {
274445
- return spinner({
274446
- startMessage: "Logging in to your SettleMint account",
274447
- stopMessage: "Connection successful",
274448
- task: async () => {
274449
- return settlemint.workspace.list();
274450
- }
274451
- });
274452
- }
274453
-
274454
- // src/commands/connect/pat.prompt.ts
274548
+ // src/prompts/pat.prompt.ts
274455
274549
  async function personalAccessTokenPrompt(env2, instance, accept) {
274456
274550
  const existingConfig = await getInstanceCredentials(instance, false);
274457
274551
  const defaultPersonalAccessToken = env2.SETTLEMINT_PERSONAL_ACCESS_TOKEN || existingConfig?.personalAccessToken;
@@ -274481,6 +274575,17 @@ async function personalAccessTokenPrompt(env2, instance, accept) {
274481
274575
  });
274482
274576
  }
274483
274577
 
274578
+ // src/spinners/login.spinner.ts
274579
+ async function loginSpinner(settlemint) {
274580
+ return spinner({
274581
+ startMessage: "Logging in to your SettleMint account",
274582
+ stopMessage: "Connection successful",
274583
+ task: async () => {
274584
+ return settlemint.workspace.list();
274585
+ }
274586
+ });
274587
+ }
274588
+
274484
274589
  // src/commands/login.ts
274485
274590
  function loginCommand() {
274486
274591
  return new Command("login").description("Login to your SettleMint account.").usage(createExamples([
@@ -274493,7 +274598,7 @@ function loginCommand() {
274493
274598
  command: "login --token-stdin --accept-defaults",
274494
274599
  commandPrefix: "cat ~/my_token.txt | "
274495
274600
  }
274496
- ])).option("-a, --accept-defaults", "Accept the default and previously set values").option("-d, --default", "Set this instance as the default").option("--token-stdin", "Provide a token using STDIN").option("-i, --instance <instance>", "The instance to login to (defaults to the instance in the .env file)").action(async ({ acceptDefaults, default: isDefault, tokenStdin, instance }, cmd2) => {
274601
+ ])).option("-a, --accept-defaults", "Accept the default and previously set values").option("--token-stdin", "Provide a token using STDIN").option("-i, --instance <instance>", "The instance to login to (defaults to the instance in the .env file)").action(async ({ acceptDefaults, tokenStdin, instance }, cmd2) => {
274497
274602
  intro("Login to your SettleMint account");
274498
274603
  const autoAccept = !!acceptDefaults || !!tokenStdin;
274499
274604
  const env2 = await loadEnv(false, false);
@@ -274531,9 +274636,6 @@ function loginCommand() {
274531
274636
  cancel2(`Invalid personal access token for instance ${selectedInstance}`);
274532
274637
  }
274533
274638
  await storeCredentials(personalAccessToken, selectedInstance);
274534
- if (isDefault) {
274535
- await setDefaultInstance(selectedInstance);
274536
- }
274537
274639
  outro("Successfully logged in to SettleMint!");
274538
274640
  });
274539
274641
  }
@@ -274558,13 +274660,14 @@ function logoutCommand() {
274558
274660
  outro(`Successfully logged out from ${instance2}`);
274559
274661
  return;
274560
274662
  }
274561
- const defaultInstance = await getDefaultInstance();
274663
+ const env2 = await loadEnv(false, false);
274664
+ const defaultInstance = env2.SETTLEMINT_INSTANCE;
274562
274665
  const instance = await esm_default2({
274563
274666
  message: "Select the instance to logout from:",
274564
274667
  choices: instances.map((instance2) => ({
274565
274668
  value: instance2,
274566
274669
  label: instance2,
274567
- description: instance2 === defaultInstance ? "(default)" : undefined
274670
+ description: defaultInstance && instance2 === defaultInstance ? "(default)" : undefined
274568
274671
  }))
274569
274672
  });
274570
274673
  await removeCredentials(instance);
@@ -274577,10 +274680,7 @@ function addClusterServiceArgs(cmd2) {
274577
274680
  return cmd2.option("--provider <provider>", "Network provider (run `settlemint platform config` to see available providers)").option("--region <region>", "Deployment region (run `settlemint platform config` to see available regions)").addOption(new Option("--size <size>", "Network size").choices(["CUSTOM", "LARGE", "MEDIUM", "SMALL"]).argParser((value4) => value4).default("SMALL")).addOption(new Option("--type <type>", "Network type").choices(["DEDICATED", "SHARED"]).argParser((value4) => value4).default("SHARED"));
274578
274681
  }
274579
274682
 
274580
- // src/utils/parse-number.ts
274581
- var parseNumber = (value4) => Number(value4);
274582
-
274583
- // src/commands/platform/common/resource-type.ts
274683
+ // src/constants/resource-type.ts
274584
274684
  var SETTLEMINT_CLIENT_MAP = {
274585
274685
  application: "application",
274586
274686
  workspace: "workspace",
@@ -274594,6 +274694,27 @@ var SETTLEMINT_CLIENT_MAP = {
274594
274694
  insights: "insights",
274595
274695
  "application access token": "applicationAccessToken"
274596
274696
  };
274697
+ var LABELS_MAP = {
274698
+ application: { singular: "application", plural: "applications", command: "app" },
274699
+ workspace: { singular: "workspace", plural: "workspaces", command: "workspace" },
274700
+ "blockchain network": {
274701
+ singular: "blockchain network",
274702
+ plural: "blockchain networks",
274703
+ command: "blockchain-network"
274704
+ },
274705
+ "blockchain node": { singular: "blockchain node", plural: "blockchain nodes", command: "blockchain-node" },
274706
+ "custom deployment": { singular: "custom deployment", plural: "custom deployments", command: "custom-deployment" },
274707
+ "private key": { singular: "private key", plural: "private keys", command: "private-key" },
274708
+ middleware: { singular: "middleware", plural: "middlewares", command: "middleware" },
274709
+ "integration tool": { singular: "integration tool", plural: "integration tools", command: "integration-tool" },
274710
+ storage: { singular: "storage", plural: "storage", command: "storage" },
274711
+ insights: { singular: "insight", plural: "insights", command: "insight" },
274712
+ "application access token": {
274713
+ singular: "application access token",
274714
+ plural: "application access tokens",
274715
+ command: "application-access-token"
274716
+ }
274717
+ };
274597
274718
 
274598
274719
  // src/commands/platform/utils/wait-for-completion.ts
274599
274720
  class TimeoutError extends Error {
@@ -274625,30 +274746,30 @@ async function waitForCompletion({
274625
274746
  const resource = await service.read(uniqueName);
274626
274747
  if (resource.status === "COMPLETED") {
274627
274748
  if (spinner2) {
274628
- spinner2.text = `${capitalizeFirstLetter(type4)} is ${getActionLabel(action)}`;
274749
+ spinner2.text = `${capitalizeFirstLetter2(type4)} is ${getActionLabel(action)}`;
274629
274750
  } else {
274630
- note(`${capitalizeFirstLetter(type4)} is ${getActionLabel(action)}`);
274751
+ note(`${capitalizeFirstLetter2(type4)} is ${getActionLabel(action)}`);
274631
274752
  }
274632
274753
  return true;
274633
274754
  }
274634
274755
  if (resource.status === "FAILED") {
274635
274756
  if (spinner2) {
274636
- spinner2.text = `${capitalizeFirstLetter(type4)} failed to ${getActionLabel(action)}`;
274757
+ spinner2.text = `${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`;
274637
274758
  } else {
274638
- note(`${capitalizeFirstLetter(type4)} failed to ${getActionLabel(action)}`);
274759
+ note(`${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`);
274639
274760
  }
274640
274761
  return true;
274641
274762
  }
274642
274763
  if (spinner2) {
274643
- spinner2.text = `${capitalizeFirstLetter(type4)} is not ready yet (status: ${resource.status})`;
274764
+ spinner2.text = `${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`;
274644
274765
  } else {
274645
- note(`${capitalizeFirstLetter(type4)} is not ready yet (status: ${resource.status})`);
274766
+ note(`${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`);
274646
274767
  }
274647
274768
  } catch (error5) {
274648
274769
  if (spinner2) {
274649
- spinner2.text = `${capitalizeFirstLetter(type4)} is not ready yet (status: UNKNOWN)`;
274770
+ spinner2.text = `${capitalizeFirstLetter2(type4)} is not ready yet (status: UNKNOWN)`;
274650
274771
  } else {
274651
- note(`${capitalizeFirstLetter(type4)} is not ready yet (status: UNKNOWN)`);
274772
+ note(`${capitalizeFirstLetter2(type4)} is not ready yet (status: UNKNOWN)`);
274652
274773
  }
274653
274774
  }
274654
274775
  if (Date.now() - startTime > maxTimeout) {
@@ -274663,7 +274784,7 @@ async function waitForCompletion({
274663
274784
  return await showSpinner();
274664
274785
  } catch (error5) {
274665
274786
  if (restartIfTimeout && error5 instanceof TimeoutError) {
274666
- note(`Restarting ${capitalizeFirstLetter(type4)}`);
274787
+ note(`Restarting ${capitalizeFirstLetter2(type4)}`);
274667
274788
  await service.restart(uniqueName);
274668
274789
  return showSpinner();
274669
274790
  }
@@ -274680,12 +274801,7 @@ function getActionLabel(action) {
274680
274801
  return "deployed";
274681
274802
  }
274682
274803
 
274683
- // src/utils/sanitize-command-name.ts
274684
- function sanitizeCommandName(name2) {
274685
- return name2.split(" ").join("-").toLowerCase();
274686
- }
274687
-
274688
- // src/commands/platform/prompts/provider.prompt.ts
274804
+ // src/prompts/provider.prompt.ts
274689
274805
  async function providerPrompt(platformConfig, argument) {
274690
274806
  const possibleProviders = platformConfig.deploymentEngineTargets.filter((target) => !target.disabled);
274691
274807
  if (possibleProviders.length === 0) {
@@ -274711,12 +274827,12 @@ async function providerPrompt(platformConfig, argument) {
274711
274827
  return platformConfig.deploymentEngineTargets.find((target) => target.id === provider);
274712
274828
  }
274713
274829
 
274714
- // src/commands/platform/utils/cluster-region.ts
274830
+ // src/utils/cluster-region.ts
274715
274831
  function getRegionId(regionId) {
274716
274832
  return regionId.split("-")[1];
274717
274833
  }
274718
274834
 
274719
- // src/commands/platform/prompts/region.prompt.ts
274835
+ // src/prompts/region.prompt.ts
274720
274836
  async function regionPrompt(provider, argument) {
274721
274837
  const possibleRegions = provider.clusters.filter((cluster) => !cluster.disabled).map((cluster) => ({ ...cluster, id: getRegionId(cluster.id) }));
274722
274838
  if (possibleRegions.length === 0) {
@@ -274742,6 +274858,11 @@ async function regionPrompt(provider, argument) {
274742
274858
  return provider.clusters.find((cluster) => cluster.id === region);
274743
274859
  }
274744
274860
 
274861
+ // src/utils/commands/sanitize-command-name.ts
274862
+ function sanitizeCommandName(name2) {
274863
+ return name2.split(" ").join("-").toLowerCase();
274864
+ }
274865
+
274745
274866
  // src/commands/platform/common/create-command.ts
274746
274867
  function getCreateCommand({
274747
274868
  name: name2,
@@ -274784,7 +274905,7 @@ function getCreateCommand({
274784
274905
  const showSpinner = (task) => spinner({
274785
274906
  startMessage: `Creating ${type4}`,
274786
274907
  task,
274787
- stopMessage: `${capitalizeFirstLetter(type4)} created`
274908
+ stopMessage: `${capitalizeFirstLetter2(type4)} created`
274788
274909
  });
274789
274910
  const { result, waitFor, mapDefaultEnv } = await createFunction(settlemint, env2, showSpinner);
274790
274911
  if (wait) {
@@ -274796,7 +274917,7 @@ function getCreateCommand({
274796
274917
  restartIfTimeout
274797
274918
  });
274798
274919
  if (waitFor) {
274799
- outro(`${capitalizeFirstLetter(waitFor.resourceType)} ${waitFor.name} created successfully`);
274920
+ outro(`${capitalizeFirstLetter2(waitFor.resourceType)} ${waitFor.name} created successfully`);
274800
274921
  }
274801
274922
  }
274802
274923
  if (isDefault && typeof mapDefaultEnv === "function") {
@@ -274818,13 +274939,16 @@ function getCreateCommand({
274818
274939
  newEnv.SETTLEMINT_BLOCKCHAIN_NETWORK = (await settlemint.blockchainNode.read(newEnv.SETTLEMINT_BLOCKCHAIN_NODE)).blockchainNetwork.uniqueName;
274819
274940
  }
274820
274941
  await writeEnvSpinner(!!prod, newEnv);
274821
- note(`${capitalizeFirstLetter(type4)} ${result.name} set as default`);
274942
+ note(`${capitalizeFirstLetter2(type4)} ${result.name} set as default`);
274822
274943
  }
274823
- outro(`${capitalizeFirstLetter(type4)} ${result.name} created successfully`);
274944
+ outro(`${capitalizeFirstLetter2(type4)} ${result.name} created successfully`);
274824
274945
  });
274825
274946
  return cmd2;
274826
274947
  }
274827
274948
 
274949
+ // src/utils/parse-number.ts
274950
+ var parseNumber = (value4) => Number(value4);
274951
+
274828
274952
  // src/commands/platform/blockchain-network/besu/create.ts
274829
274953
  function blockchainNetworkBesuCreateCommand() {
274830
274954
  return getCreateCommand({
@@ -275158,7 +275282,7 @@ function applicationCreateCommand() {
275158
275282
  }, async (settlemint, env2, showSpinner) => {
275159
275283
  let workspaceUniqueName = workspace;
275160
275284
  if (!workspaceUniqueName) {
275161
- const workspaces = await settlemint.workspace.list();
275285
+ const workspaces = await workspaceSpinner(settlemint);
275162
275286
  const workspace2 = await workspacePrompt(env2, workspaces, acceptDefaults);
275163
275287
  if (!workspace2) {
275164
275288
  return nothingSelectedError("workspace");
@@ -275198,7 +275322,7 @@ function applicationCreateCommand() {
275198
275322
  });
275199
275323
  }
275200
275324
 
275201
- // src/commands/connect/blockchain-network.prompt.ts
275325
+ // src/prompts/cluster-service/blockchain-network.prompt.ts
275202
275326
  async function blockchainNetworkPrompt({
275203
275327
  env: env2,
275204
275328
  networks,
@@ -275221,6 +275345,16 @@ async function blockchainNetworkPrompt({
275221
275345
  });
275222
275346
  }
275223
275347
 
275348
+ // src/spinners/service.spinner.ts
275349
+ async function serviceSpinner(type4, task) {
275350
+ const { plural } = LABELS_MAP[type4];
275351
+ return spinner({
275352
+ startMessage: `Loading ${plural} services`,
275353
+ stopMessage: `Loaded ${plural} services`,
275354
+ task
275355
+ });
275356
+ }
275357
+
275224
275358
  // src/commands/platform/blockchain-node/besu/create.ts
275225
275359
  function blockchainNodeBesuCreateCommand() {
275226
275360
  return getCreateCommand({
@@ -275253,7 +275387,7 @@ function blockchainNodeBesuCreateCommand() {
275253
275387
  }
275254
275388
  let networkUniqueName = blockchainNetwork;
275255
275389
  if (!networkUniqueName) {
275256
- const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
275390
+ const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
275257
275391
  const network = await blockchainNetworkPrompt({
275258
275392
  env: env2,
275259
275393
  networks,
@@ -275332,7 +275466,7 @@ function blockscoutInsightsCreateCommand() {
275332
275466
  let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275333
275467
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275334
275468
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275335
- const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275469
+ const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
275336
275470
  const node = await blockchainNodePrompt({
275337
275471
  env: env2,
275338
275472
  nodes: blockchainNodes,
@@ -275469,7 +275603,7 @@ function graphMiddlewareCreateCommand() {
275469
275603
  }
275470
275604
  let blockchainNodeUniqueName = blockchainNode;
275471
275605
  if (!blockchainNodeUniqueName) {
275472
- const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275606
+ const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
275473
275607
  const node = await blockchainNodePrompt({
275474
275608
  env: env2,
275475
275609
  nodes: blockchainNodes,
@@ -275553,7 +275687,7 @@ function smartContractPortalMiddlewareCreateCommand() {
275553
275687
  let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275554
275688
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275555
275689
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275556
- const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275690
+ const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
275557
275691
  const node = await blockchainNodePrompt({
275558
275692
  env: env2,
275559
275693
  nodes: blockchainNodes,
@@ -275649,7 +275783,7 @@ function privateKeyAccessibleCreateCommand() {
275649
275783
  }
275650
275784
  let blockchainNodeUniqueName = blockchainNode;
275651
275785
  if (!blockchainNodeUniqueName) {
275652
- const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275786
+ const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
275653
275787
  const node = await blockchainNodePrompt({
275654
275788
  env: env2,
275655
275789
  nodes: blockchainNodes,
@@ -275709,7 +275843,7 @@ function privateKeyHdCreateCommand() {
275709
275843
  }
275710
275844
  let blockchainNodeUniqueName = blockchainNode;
275711
275845
  if (!blockchainNodeUniqueName) {
275712
- const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275846
+ const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
275713
275847
  const node = await blockchainNodePrompt({
275714
275848
  env: env2,
275715
275849
  nodes: blockchainNodes,
@@ -275775,7 +275909,7 @@ function privateKeyHsmCreateCommand() {
275775
275909
  }
275776
275910
  let blockchainNodeUniqueName = blockchainNode;
275777
275911
  if (!blockchainNodeUniqueName) {
275778
- const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275912
+ const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
275779
275913
  const node = await blockchainNodePrompt({
275780
275914
  env: env2,
275781
275915
  nodes: blockchainNodes,
@@ -275937,7 +276071,7 @@ function createCommand3() {
275937
276071
  return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand());
275938
276072
  }
275939
276073
 
275940
- // src/commands/platform/prompts/delete-confirmation.prompt.ts
276074
+ // src/prompts/delete-confirmation.prompt.ts
275941
276075
  async function deleteConfirmationPrompt(itemDescription) {
275942
276076
  const confirmation = await esm_default4({
275943
276077
  message: `Are you sure you want to delete ${itemDescription}? (yes/no)`,
@@ -276006,7 +276140,7 @@ function getDeleteCommand({
276006
276140
  task: async () => {
276007
276141
  return deleteFunction(settlemint, serviceUniqueName);
276008
276142
  },
276009
- stopMessage: `${capitalizeFirstLetter(type4)} deleted`
276143
+ stopMessage: `${capitalizeFirstLetter2(type4)} deleted`
276010
276144
  });
276011
276145
  if (isDefaultUniqueName) {
276012
276146
  const newEnv = {
@@ -276015,9 +276149,9 @@ function getDeleteCommand({
276015
276149
  ...mapDefaultEnv(env2)
276016
276150
  };
276017
276151
  await writeEnvSpinner(!!prod, newEnv);
276018
- note(`${capitalizeFirstLetter(type4)} removed as default`);
276152
+ note(`${capitalizeFirstLetter2(type4)} removed as default`);
276019
276153
  }
276020
- outro(`${capitalizeFirstLetter(type4)} ${result.name} deleted successfully`);
276154
+ outro(`${capitalizeFirstLetter2(type4)} ${result.name} deleted successfully`);
276021
276155
  });
276022
276156
  }
276023
276157
 
@@ -276100,12 +276234,12 @@ function getRestartCommand({
276100
276234
  task: async () => {
276101
276235
  return restartFunction(settlemint, serviceUniqueName);
276102
276236
  },
276103
- stopMessage: `${capitalizeFirstLetter(type4)} restart initiated`
276237
+ stopMessage: `${capitalizeFirstLetter2(type4)} restart initiated`
276104
276238
  });
276105
276239
  if (wait) {
276106
276240
  await waitForCompletion({ settlemint, type: type4, uniqueName: serviceUniqueName, action: "restart" });
276107
276241
  }
276108
- outro(`${capitalizeFirstLetter(type4)} ${result.name} restart initiated successfully`);
276242
+ outro(`${capitalizeFirstLetter2(type4)} ${result.name} restart initiated successfully`);
276109
276243
  });
276110
276244
  }
276111
276245
 
@@ -276301,28 +276435,327 @@ function configCommand() {
276301
276435
  const platformConfig = await settlemint.platform.config();
276302
276436
  const useCases = getUseCases(platformConfig);
276303
276437
  const starterkits = getStarterkits(platformConfig);
276304
- list("Templates (Starterkits)", starterkits.map((starterkit) => starterkit.id).sort());
276305
- list("Use cases (Smart Contract Sets)", useCases.map((useCase) => useCase.id).sort());
276306
- list("Providers and regions", platformConfig.deploymentEngineTargets.filter((provider) => !provider.disabled).sort((a8, b4) => a8.id.localeCompare(b4.id)).reduce((acc, provider) => {
276307
- acc.push(provider.id);
276308
- acc.push(provider.clusters.filter((cluster) => !cluster.disabled).map((region) => getRegionId(region.id)).sort());
276309
- return acc;
276310
- }, []));
276438
+ table("Templates (Starterkits)", starterkits.map((starterkit) => ({
276439
+ id: starterkit.id,
276440
+ name: starterkit.name
276441
+ })).sort((a8, b4) => a8.name.localeCompare(b4.name)));
276442
+ table("Use cases (Smart Contract Sets)", useCases.map((useCase) => ({
276443
+ id: useCase.id,
276444
+ name: useCase.name
276445
+ })).sort((a8, b4) => a8.name.localeCompare(b4.name)));
276446
+ table("Providers and regions", platformConfig.deploymentEngineTargets.filter((provider) => !provider.disabled).flatMap((provider) => provider.clusters.filter((cluster) => !cluster.disabled).map((region) => ({
276447
+ providerId: provider.id,
276448
+ regionId: getRegionId(region.id),
276449
+ providerName: provider.name,
276450
+ regionName: region.name
276451
+ }))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)));
276311
276452
  list("Pre-deployed abis (Smart Contract Portal)", platformConfig.preDeployedContracts.sort());
276312
276453
  outro("Platform configuration retrieved");
276313
276454
  });
276314
276455
  }
276315
276456
 
276457
+ // src/commands/platform/utils/formatting/format-service-sub-type.ts
276458
+ function formatServiceSubType(service, printToTerminal = true) {
276459
+ if ("__typename" in service && typeof service.__typename === "string") {
276460
+ return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
276461
+ }
276462
+ return printToTerminal ? "Unknown" : "Unknown";
276463
+ }
276464
+
276465
+ // src/spinners/applications.spinner.ts
276466
+ async function applicationsSpinner(settlemint, workspaceUniqueName) {
276467
+ return spinner({
276468
+ startMessage: "Loading your applications",
276469
+ stopMessage: "Loaded your applications",
276470
+ task: async () => {
276471
+ return settlemint.application.list(workspaceUniqueName);
276472
+ }
276473
+ });
276474
+ }
276475
+
276476
+ // src/utils/get-cluster-service-platform-url.ts
276477
+ function getClusterServicePlatformUrl(instance, application, service, serviceType) {
276478
+ return new URL(`workspaces/${encodeURIComponent(application.workspace.id)}/applications/${encodeURIComponent(application.id)}/${getUrlPathForService(service, serviceType)}`, instance).toString();
276479
+ }
276480
+ function getUrlPathForService(service, serviceType) {
276481
+ if (serviceType === "blockchain-network") {
276482
+ return `networks/${encodeURIComponent(service.id)}/details`;
276483
+ }
276484
+ if (serviceType === "blockchain-node") {
276485
+ return `nodes/${encodeURIComponent(service.id)}/details`;
276486
+ }
276487
+ if (serviceType === "middleware") {
276488
+ return `middlewares/${encodeURIComponent(service.id)}/details`;
276489
+ }
276490
+ if (serviceType === "integration-tool") {
276491
+ return `integration/${encodeURIComponent(service.id)}/details`;
276492
+ }
276493
+ if (serviceType === "private-key") {
276494
+ return `keyvault/${encodeURIComponent(service.id)}/details`;
276495
+ }
276496
+ if (serviceType === "storage") {
276497
+ return `storage/${encodeURIComponent(service.id)}/details`;
276498
+ }
276499
+ if (serviceType === "insights") {
276500
+ return `insights/${encodeURIComponent(service.id)}/details`;
276501
+ }
276502
+ return "";
276503
+ }
276504
+
276505
+ // ../../node_modules/yaml/dist/index.js
276506
+ var composer = require_composer();
276507
+ var Document = require_Document();
276508
+ var Schema = require_Schema();
276509
+ var errors2 = require_errors3();
276510
+ var Alias = require_Alias();
276511
+ var identity3 = require_identity();
276512
+ var Pair = require_Pair();
276513
+ var Scalar = require_Scalar();
276514
+ var YAMLMap = require_YAMLMap();
276515
+ var YAMLSeq = require_YAMLSeq();
276516
+ var cst = require_cst();
276517
+ var lexer = require_lexer2();
276518
+ var lineCounter = require_line_counter();
276519
+ var parser = require_parser2();
276520
+ var publicApi = require_public_api();
276521
+ var visit2 = require_visit();
276522
+ var $Composer = composer.Composer;
276523
+ var $Document = Document.Document;
276524
+ var $Schema = Schema.Schema;
276525
+ var $YAMLError = errors2.YAMLError;
276526
+ var $YAMLParseError = errors2.YAMLParseError;
276527
+ var $YAMLWarning = errors2.YAMLWarning;
276528
+ var $Alias = Alias.Alias;
276529
+ var $isAlias = identity3.isAlias;
276530
+ var $isCollection = identity3.isCollection;
276531
+ var $isDocument = identity3.isDocument;
276532
+ var $isMap = identity3.isMap;
276533
+ var $isNode = identity3.isNode;
276534
+ var $isPair = identity3.isPair;
276535
+ var $isScalar = identity3.isScalar;
276536
+ var $isSeq = identity3.isSeq;
276537
+ var $Pair = Pair.Pair;
276538
+ var $Scalar = Scalar.Scalar;
276539
+ var $YAMLMap = YAMLMap.YAMLMap;
276540
+ var $YAMLSeq = YAMLSeq.YAMLSeq;
276541
+ var $Lexer = lexer.Lexer;
276542
+ var $LineCounter = lineCounter.LineCounter;
276543
+ var $Parser = parser.Parser;
276544
+ var $parse = publicApi.parse;
276545
+ var $parseAllDocuments = publicApi.parseAllDocuments;
276546
+ var $parseDocument = publicApi.parseDocument;
276547
+ var $stringify = publicApi.stringify;
276548
+ var $visit = visit2.visit;
276549
+ var $visitAsync = visit2.visitAsync;
276550
+
276551
+ // src/commands/platform/utils/formatting/format-health-status.ts
276552
+ function formatHealthStatus(healthStatus, printToTerminal = true) {
276553
+ if (healthStatus === "HEALTHY") {
276554
+ return printToTerminal ? greenBright("Healthy") : "Healthy";
276555
+ }
276556
+ const label = `Unhealthy (${camelCaseToWords2(replaceUnderscoresAndHyphensWithSpaces(healthStatus))})`;
276557
+ return printToTerminal ? yellowBright(label) : label;
276558
+ }
276559
+
276560
+ // src/commands/platform/utils/formatting/format-status.ts
276561
+ function formatStatus(status, printToTerminal = true) {
276562
+ const label = camelCaseToWords2(status.toLowerCase());
276563
+ if (status === "FAILED") {
276564
+ return printToTerminal ? redBright(label) : label;
276565
+ }
276566
+ if (status === "PAUSED" || status === "AUTO_PAUSED" || status === "PAUSING" || status === "AUTO_PAUSING") {
276567
+ return printToTerminal ? gray(label) : label;
276568
+ }
276569
+ if (status === "COMPLETED") {
276570
+ return printToTerminal ? greenBright(label) : label;
276571
+ }
276572
+ return printToTerminal ? yellowBright(label) : label;
276573
+ }
276574
+
276575
+ // src/commands/platform/application/services.ts
276576
+ var SERVICE_TYPES = [
276577
+ "blockchain-network",
276578
+ "blockchain-node",
276579
+ "custom-deployment",
276580
+ "insights",
276581
+ "integration-tool",
276582
+ "middleware",
276583
+ "private-key",
276584
+ "storage"
276585
+ ];
276586
+ function servicesCommand() {
276587
+ return new Command("services").alias("s").description("List the application services").usage(createExamples([
276588
+ {
276589
+ description: "List the application services",
276590
+ command: "platform list services"
276591
+ },
276592
+ {
276593
+ description: "List the application services in wide format with more information (such as console url)",
276594
+ command: "platform list services -o wide"
276595
+ },
276596
+ {
276597
+ description: "List the application services in JSON format",
276598
+ command: "platform list services -o json > services.json"
276599
+ },
276600
+ {
276601
+ description: "List the application services in YAML format",
276602
+ command: "platform list services -o yaml > services.yaml"
276603
+ },
276604
+ {
276605
+ description: "List the application services for a specific application",
276606
+ command: "platform list services --application my-app"
276607
+ },
276608
+ {
276609
+ description: "List the application services for a specific application and type",
276610
+ command: "platform list services --application my-app --type middleware"
276611
+ },
276612
+ {
276613
+ description: "List the application services for multiple types",
276614
+ command: "platform list services --type blockchain-network blockchain-node middleware"
276615
+ }
276616
+ ])).option("-app, --application <application>", "The application unique name to list the services in (defaults to application from env)").addOption(new Option("-t, --type <type...>", "The type(s) of service to list").choices(SERVICE_TYPES)).addOption(new Option("-o, --output <output>", "The output format").choices(["wide", "json", "yaml"])).action(async ({ application, type: type4, output }) => {
276617
+ const printToTerminal = !output || output === "wide";
276618
+ if (printToTerminal) {
276619
+ intro("Listing application services");
276620
+ }
276621
+ const env2 = await loadEnv(false, false);
276622
+ const selectedInstance = await instancePrompt(env2, true);
276623
+ const personalAccessToken = await getInstanceCredentials(selectedInstance);
276624
+ if (!personalAccessToken) {
276625
+ return missingPersonalAccessTokenError();
276626
+ }
276627
+ const accessToken = personalAccessToken.personalAccessToken;
276628
+ const settlemint = createSettleMintClient({
276629
+ accessToken,
276630
+ instance: selectedInstance
276631
+ });
276632
+ const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
276633
+ if (!applicationUniqueName) {
276634
+ return nothingSelectedError("application");
276635
+ }
276636
+ const wide = output === "wide";
276637
+ const servicesToShow = await getServicesAndMapResults({
276638
+ instance: selectedInstance,
276639
+ settlemint,
276640
+ applicationUniqueName,
276641
+ types: type4,
276642
+ printToTerminal,
276643
+ wide
276644
+ });
276645
+ if (printToTerminal) {
276646
+ for (const service of servicesToShow) {
276647
+ table(service.label, service.items, !wide);
276648
+ }
276649
+ } else if (output === "json") {
276650
+ console.log(JSON.stringify(servicesToShow, null, 2));
276651
+ } else if (output === "yaml") {
276652
+ console.log($stringify(servicesToShow));
276653
+ }
276654
+ if (printToTerminal) {
276655
+ outro("Application services listed");
276656
+ }
276657
+ });
276658
+ }
276659
+ async function selectApplication(settlemint, env2) {
276660
+ const workspaces = await workspaceSpinner(settlemint);
276661
+ const workspace = await workspacePrompt(env2, workspaces, true);
276662
+ const applications = await applicationsSpinner(settlemint, workspace.uniqueName);
276663
+ const selectedApplication = await applicationPrompt(env2, applications, true);
276664
+ return selectedApplication.uniqueName;
276665
+ }
276666
+ async function getServicesAndMapResults({
276667
+ instance,
276668
+ settlemint,
276669
+ applicationUniqueName,
276670
+ types: types2,
276671
+ printToTerminal,
276672
+ wide
276673
+ }) {
276674
+ const application = await settlemint.application.read(applicationUniqueName);
276675
+ const services = await servicesSpinner(settlemint, applicationUniqueName, types2);
276676
+ const results = (types2 ?? SERVICE_TYPES).filter((serviceType) => !types2 || types2.includes(serviceType)).map((serviceType) => {
276677
+ const [_5, labels] = Object.entries(LABELS_MAP).find(([key2, value4]) => value4.command === serviceType) ?? [
276678
+ null,
276679
+ { plural: serviceType }
276680
+ ];
276681
+ const serviceItems = getItemsForServiceType(services, serviceType);
276682
+ if (serviceItems.length === 0 && !types2) {
276683
+ return null;
276684
+ }
276685
+ return {
276686
+ label: capitalizeFirstLetter2(labels.plural),
276687
+ items: serviceItems.map((s8) => {
276688
+ const basicFields = {
276689
+ status: formatStatus(s8.status, printToTerminal),
276690
+ healthSatus: formatHealthStatus(s8.healthStatus, printToTerminal),
276691
+ type: formatServiceSubType(s8, printToTerminal),
276692
+ provider: s8.provider,
276693
+ region: s8.region
276694
+ };
276695
+ if (wide) {
276696
+ return {
276697
+ nameAndUniqueName: `${s8.name}
276698
+ ${s8.uniqueName}`,
276699
+ url: getClusterServicePlatformUrl(instance, application, s8, serviceType),
276700
+ ...basicFields
276701
+ };
276702
+ }
276703
+ if (!printToTerminal) {
276704
+ return {
276705
+ name: s8.name,
276706
+ uniqueName: s8.uniqueName,
276707
+ ...basicFields,
276708
+ url: getClusterServicePlatformUrl(instance, application, s8, serviceType)
276709
+ };
276710
+ }
276711
+ return {
276712
+ name: s8.name,
276713
+ uniqueName: s8.uniqueName,
276714
+ ...basicFields
276715
+ };
276716
+ })
276717
+ };
276718
+ }).filter((result) => result !== null);
276719
+ return results;
276720
+ }
276721
+ function getItemsForServiceType(services, serviceType) {
276722
+ switch (serviceType) {
276723
+ case "middleware":
276724
+ return services.middlewares;
276725
+ case "integration-tool":
276726
+ return services.integrationTools;
276727
+ case "storage":
276728
+ return services.storages;
276729
+ case "private-key":
276730
+ return services.privateKeys;
276731
+ case "insights":
276732
+ return services.insights;
276733
+ case "custom-deployment":
276734
+ return services.customDeployments;
276735
+ case "blockchain-network":
276736
+ return services.blockchainNetworks;
276737
+ case "blockchain-node":
276738
+ return services.blockchainNodes;
276739
+ default:
276740
+ return [];
276741
+ }
276742
+ }
276743
+
276744
+ // src/commands/platform/list.ts
276745
+ function listCommand() {
276746
+ return new Command("list").alias("ls").description("List resources in the SettleMint platform").addCommand(servicesCommand());
276747
+ }
276748
+
276316
276749
  // src/commands/platform.ts
276317
276750
  function platformCommand() {
276318
- return new Command("platform").description("Manage SettleMint platform resources").addCommand(configCommand()).addCommand(createCommand3()).addCommand(updateCommand()).addCommand(deleteCommand()).addCommand(restartCommand());
276751
+ return new Command("platform").description("Manage SettleMint platform resources").addCommand(configCommand()).addCommand(createCommand3()).addCommand(updateCommand()).addCommand(deleteCommand()).addCommand(restartCommand()).addCommand(listCommand());
276319
276752
  }
276320
276753
 
276321
276754
  // src/commands/smart-contract-set/create.ts
276322
276755
  import { rmdir } from "node:fs/promises";
276323
276756
  import { join as join10 } from "node:path";
276324
276757
 
276325
- // src/commands/smart-contract-set/prompts/use-case.prompt.ts
276758
+ // src/prompts/smart-contract-set/use-case.prompt.ts
276326
276759
  async function useCasePrompt(platformConfig, argument) {
276327
276760
  if (platformConfig.smartContractSets.sets.length === 0) {
276328
276761
  cancel2("No use cases found");
@@ -276365,7 +276798,7 @@ function createCommand4() {
276365
276798
  return new Command("create").description("Bootstrap your smart contract set").option("-n, --project-name <name>", "The name for your smart contract set project").option("--use-case <useCase>", "Use case for the smart contract set (run `settlemint platform config` to see available use cases)").option("-i, --instance <instance>", "The instance to connect to").action(async ({ projectName, useCase, instance }) => {
276366
276799
  intro("Creating a new smart contract set");
276367
276800
  const env2 = await loadEnv(false, false);
276368
- const name2 = await namePrompt(env2, projectName);
276801
+ const name2 = await projectNamePrompt(env2, projectName);
276369
276802
  const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
276370
276803
  const settlemint = createSettleMintClient({
276371
276804
  instance: selectedInstance,
@@ -276408,7 +276841,7 @@ function createCommand4() {
276408
276841
  });
276409
276842
  }
276410
276843
 
276411
- // src/utils/passthrough-options.ts
276844
+ // src/utils/commands/passthrough-options.ts
276412
276845
  function mapPassthroughOptions(options, command) {
276413
276846
  const optionArgs = Object.entries(options).map(([key2, value4]) => {
276414
276847
  if (value4 === true) {
@@ -276588,7 +277021,7 @@ async function selectTargetNode({
276588
277021
  if (!env2.SETTLEMINT_APPLICATION) {
276589
277022
  return missingApplication();
276590
277023
  }
276591
- const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
277024
+ const nodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION));
276592
277025
  const evmNodes = nodes.filter((node2) => node2.isEvm);
276593
277026
  if (evmNodes.length === 0) {
276594
277027
  cancel2("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
@@ -276611,7 +277044,7 @@ async function selectTargetNode({
276611
277044
  } else {
276612
277045
  node = await settlemint.blockchainNode.read(nodeUniqueName);
276613
277046
  if (!node.isEvm) {
276614
- cancel2("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
277047
+ cancel2(`The specified blockchain node '${nodeUniqueName}' is not an EVM blockchain node. Please specify an EVM blockchain node to continue.`);
276615
277048
  }
276616
277049
  }
276617
277050
  if (node.status !== "COMPLETED") {
@@ -276620,7 +277053,7 @@ async function selectTargetNode({
276620
277053
  return node;
276621
277054
  }
276622
277055
 
276623
- // src/commands/smart-contract-set/prompts/address.prompt.ts
277056
+ // src/prompts/smart-contract-set/address.prompt.ts
276624
277057
  async function addressPrompt({
276625
277058
  env: env2,
276626
277059
  accept,
@@ -276631,11 +277064,15 @@ async function addressPrompt({
276631
277064
  const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => privateKey.privateKeyType !== "HD_ECDSA_P256") ?? [];
276632
277065
  const defaultAddress = env2.SETTLEMINT_SMART_CONTRACT_ADDRESS ?? hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
276633
277066
  const defaultPossible = accept && defaultAddress;
276634
- if (defaultPossible) {
276635
- return defaultAddress;
277067
+ if (!node.privateKeys || node.privateKeys.length === 0) {
277068
+ cancel2(`No ECDSA P256 or HSM ECDSA P256 private key is activated on the node '${node.uniqueName}'. Please activate a private key on this node or specify a different node.`);
276636
277069
  }
276637
- if (possiblePrivateKeys.length === 0) {
276638
- cancel2("No ECDSA P256 or HSM ECDSA P256 private key is activated on the node to sign the transaction.");
277070
+ if (defaultPossible) {
277071
+ if (node.privateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
277072
+ return defaultAddress;
277073
+ }
277074
+ note(`Private key with address '${defaultAddress}' not activated on the node '${node.uniqueName}'.
277075
+ Please select another key or activate this key on the node and try again.`, "warn");
276639
277076
  }
276640
277077
  const address = await esm_default2({
276641
277078
  message: "Which private key do you want to deploy from?",
@@ -276654,7 +277091,7 @@ async function addressPrompt({
276654
277091
  return address;
276655
277092
  }
276656
277093
 
276657
- // src/utils/hardhat-config.ts
277094
+ // src/utils/smart-contract-set/hardhat-config.ts
276658
277095
  async function getHardhatConfigData(envConfig) {
276659
277096
  try {
276660
277097
  const { command, args } = await getPackageManagerExecutable();
@@ -276870,60 +277307,24 @@ function hardhatTestCommand() {
276870
277307
  // src/commands/smart-contract-set/subgraph/build.ts
276871
277308
  import { dirname as dirname10 } from "node:path";
276872
277309
 
276873
- // src/commands/smart-contract-set/subgraph/utils/setup.ts
277310
+ // src/utils/subgraph/setup.ts
276874
277311
  import { rm as rm4 } from "node:fs/promises";
277312
+ var import_semver = __toESM(require_semver2(), 1);
277313
+
277314
+ // src/utils/subgraph/sanitize-name.ts
277315
+ var import_slugify = __toESM(require_slugify(), 1);
277316
+ function sanitizeName(value4, length = 35) {
277317
+ return import_slugify.default(value4, {
277318
+ strict: true,
277319
+ remove: /[!"'()*+.:@~]/g,
277320
+ replacement: "-",
277321
+ lower: true
277322
+ }).slice(0, length).replaceAll(/(^\d*)/g, "").replaceAll(/(-$)/g, "").replaceAll(/(^-)/g, "");
277323
+ }
276875
277324
 
276876
- // src/commands/smart-contract-set/subgraph/utils/subgraph-config.ts
277325
+ // src/utils/subgraph/subgraph-config.ts
276877
277326
  import { readFile as readFile7, writeFile as writeFile8 } from "node:fs/promises";
276878
277327
  import { basename as basename4, join as join11 } from "node:path";
276879
-
276880
- // ../../node_modules/yaml/dist/index.js
276881
- var composer = require_composer();
276882
- var Document = require_Document();
276883
- var Schema = require_Schema();
276884
- var errors2 = require_errors3();
276885
- var Alias = require_Alias();
276886
- var identity3 = require_identity();
276887
- var Pair = require_Pair();
276888
- var Scalar = require_Scalar();
276889
- var YAMLMap = require_YAMLMap();
276890
- var YAMLSeq = require_YAMLSeq();
276891
- var cst = require_cst();
276892
- var lexer = require_lexer2();
276893
- var lineCounter = require_line_counter();
276894
- var parser = require_parser2();
276895
- var publicApi = require_public_api();
276896
- var visit2 = require_visit();
276897
- var $Composer = composer.Composer;
276898
- var $Document = Document.Document;
276899
- var $Schema = Schema.Schema;
276900
- var $YAMLError = errors2.YAMLError;
276901
- var $YAMLParseError = errors2.YAMLParseError;
276902
- var $YAMLWarning = errors2.YAMLWarning;
276903
- var $Alias = Alias.Alias;
276904
- var $isAlias = identity3.isAlias;
276905
- var $isCollection = identity3.isCollection;
276906
- var $isDocument = identity3.isDocument;
276907
- var $isMap = identity3.isMap;
276908
- var $isNode = identity3.isNode;
276909
- var $isPair = identity3.isPair;
276910
- var $isScalar = identity3.isScalar;
276911
- var $isSeq = identity3.isSeq;
276912
- var $Pair = Pair.Pair;
276913
- var $Scalar = Scalar.Scalar;
276914
- var $YAMLMap = YAMLMap.YAMLMap;
276915
- var $YAMLSeq = YAMLSeq.YAMLSeq;
276916
- var $Lexer = lexer.Lexer;
276917
- var $LineCounter = lineCounter.LineCounter;
276918
- var $Parser = parser.Parser;
276919
- var $parse = publicApi.parse;
276920
- var $parseAllDocuments = publicApi.parseAllDocuments;
276921
- var $parseDocument = publicApi.parseDocument;
276922
- var $stringify = publicApi.stringify;
276923
- var $visit = visit2.visit;
276924
- var $visitAsync = visit2.visitAsync;
276925
-
276926
- // src/commands/smart-contract-set/subgraph/utils/subgraph-config.ts
276927
277328
  var CONFIG_FILE_PATH = "./subgraph/subgraph.config.json";
276928
277329
  var isGenerated = (path8 = process.cwd()) => exists2(join11(path8, CONFIG_FILE_PATH));
276929
277330
  var getSubgraphYamlFile = async (path8 = process.cwd()) => {
@@ -276960,21 +277361,7 @@ var getSubgraphConfig = async (path8 = process.cwd()) => {
276960
277361
  }
276961
277362
  };
276962
277363
 
276963
- // src/commands/smart-contract-set/subgraph/utils/setup.ts
276964
- var import_semver = __toESM(require_semver2(), 1);
276965
-
276966
- // src/commands/smart-contract-set/subgraph/utils/sanitize-name.ts
276967
- var import_slugify = __toESM(require_slugify(), 1);
276968
- function sanitizeName(value4, length = 35) {
276969
- return import_slugify.default(value4, {
276970
- strict: true,
276971
- remove: /[!"'()*+.:@~]/g,
276972
- replacement: "-",
276973
- lower: true
276974
- }).slice(0, length).replaceAll(/(^\d*)/g, "").replaceAll(/(-$)/g, "").replaceAll(/(^-)/g, "");
276975
- }
276976
-
276977
- // src/commands/smart-contract-set/subgraph/utils/setup.ts
277364
+ // src/utils/subgraph/setup.ts
276978
277365
  var SETTLEMINT_NETWORK = "settlemint";
276979
277366
  async function subgraphSetup({ network }) {
276980
277367
  const generated = await isGenerated();
@@ -277046,7 +277433,7 @@ async function getTheGraphMiddleware({
277046
277433
  if (!env2.SETTLEMINT_APPLICATION) {
277047
277434
  return missingApplication();
277048
277435
  }
277049
- const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
277436
+ const middlewares = await serviceSpinner("middleware", () => settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION));
277050
277437
  return theGraphPrompt({
277051
277438
  env: env2,
277052
277439
  middlewares,
@@ -277111,8 +277498,8 @@ function subgraphCodegenCommand() {
277111
277498
  // src/commands/smart-contract-set/subgraph/deploy.ts
277112
277499
  import { dirname as dirname12 } from "node:path";
277113
277500
 
277114
- // src/commands/smart-contract-set/prompts/subgraph-name.prompt.ts
277115
- async function subgraphNamePrompt2(defaultName, env2, accept, prod) {
277501
+ // src/prompts/smart-contract-set/subgraph-name.prompt.ts
277502
+ async function subgraphNamePrompt(defaultName, env2, accept, prod) {
277116
277503
  const defaultSubgraphName = defaultName ? sanitizeName(defaultName) : env2.SETTLEMINT_THEGRAPH_SUBGRAPH_NAME;
277117
277504
  if (accept) {
277118
277505
  if (defaultSubgraphName && env2.SETTLEMINT_THEGRAPH_SUBGRAPH_NAME !== defaultSubgraphName) {
@@ -277182,7 +277569,7 @@ function subgraphDeployCommand() {
277182
277569
  cancel2('The "subgraph/subgraph.config.json" config has not been set, ensure all the contracts listed have an address added');
277183
277570
  }
277184
277571
  }
277185
- const graphName = await subgraphNamePrompt2(subgraphName, env2, autoAccept, !!prod);
277572
+ const graphName = await subgraphNamePrompt(subgraphName, env2, autoAccept, !!prod);
277186
277573
  if (!graphName) {
277187
277574
  cancel2("No graph name provided. Please provide a graph name to continue.");
277188
277575
  }
@@ -277252,14 +277639,24 @@ function getCommandPath(command) {
277252
277639
  }
277253
277640
  return parts.join(" ");
277254
277641
  }
277642
+ function isLeafCommand(command) {
277643
+ return command.commands.length === 0;
277644
+ }
277645
+ function isJsonOrYamlOutput(command) {
277646
+ const options = command.opts();
277647
+ return typeof options.output === "string" && (options.output === "json" || options.output === "yaml");
277648
+ }
277255
277649
  function addHooksToCommand(cmd2, rootCmd) {
277256
277650
  const extendedCmd = cmd2;
277257
277651
  extendedCmd.hook("preAction", async (thisCommand) => {
277652
+ if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
277653
+ ascii();
277654
+ }
277258
277655
  const commandPath = getCommandPath(thisCommand);
277259
277656
  rootCmd._lastCommand = thisCommand;
277260
277657
  rootCmd._lastCommand._commandPath = commandPath;
277261
277658
  }).hook("postAction", async (thisCommand) => {
277262
- if (thisCommand.commands.length === 0) {
277659
+ if (isLeafCommand(thisCommand)) {
277263
277660
  const commandPath = getCommandPath(thisCommand);
277264
277661
  if (commandPath) {
277265
277662
  await telemetry({
@@ -277306,7 +277703,6 @@ function sdkCliCommand(exitOverride = undefined) {
277306
277703
  }
277307
277704
 
277308
277705
  // src/cli.ts
277309
- ascii();
277310
277706
  sdkCliCommand();
277311
277707
 
277312
- //# debugId=FD5906A0C473EB7164756E2164756E21
277708
+ //# debugId=80E485E986A8D62164756E2164756E21