@settlemint/sdk-cli 2.1.4-prfa991a9d → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -249,7 +249,7 @@ settlemint scs subgraph deploy --accept-defaults <subgraph-name>
249
249
 
250
250
  ## API Reference
251
251
 
252
- See the [documentation](https://github.com/settlemint/sdk/tree/v2.1.4/sdk/cli/docs/settlemint.md) for available commands.
252
+ See the [documentation](https://github.com/settlemint/sdk/tree/v2.1.5/sdk/cli/docs/settlemint.md) for available commands.
253
253
 
254
254
  ## Contributing
255
255
 
package/dist/cli.js CHANGED
@@ -245340,7 +245340,7 @@ function pruneCurrentEnv(currentEnv, env2) {
245340
245340
  var package_default = {
245341
245341
  name: "@settlemint/sdk-cli",
245342
245342
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
245343
- version: "2.1.4-prfa991a9d",
245343
+ version: "2.1.5",
245344
245344
  type: "module",
245345
245345
  private: false,
245346
245346
  license: "FSL-1.1-MIT",
@@ -245388,10 +245388,10 @@ var package_default = {
245388
245388
  "@inquirer/confirm": "5.1.9",
245389
245389
  "@inquirer/input": "4.1.9",
245390
245390
  "@inquirer/password": "4.0.12",
245391
- "@inquirer/select": "4.1.1",
245392
- "@settlemint/sdk-js": "2.1.4-prfa991a9d",
245393
- "@settlemint/sdk-utils": "2.1.4-prfa991a9d",
245394
- "@types/node": "22.14.1",
245391
+ "@inquirer/select": "4.2.0",
245392
+ "@settlemint/sdk-js": "2.1.5",
245393
+ "@settlemint/sdk-utils": "2.1.5",
245394
+ "@types/node": "22.15.1",
245395
245395
  "@types/semver": "7.7.0",
245396
245396
  "@types/which": "3.0.4",
245397
245397
  "get-tsconfig": "4.10.0",
@@ -246548,13 +246548,21 @@ class Separator {
246548
246548
  // ../utils/dist/terminal.mjs
246549
246549
  import { spawn } from "node:child_process";
246550
246550
  var import_console_table_printer2 = __toESM(require_dist2(), 1);
246551
- var ascii = () => console.log(magentaBright(`
246551
+ function shouldPrint() {
246552
+ return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
246553
+ }
246554
+ var ascii = () => {
246555
+ if (!shouldPrint()) {
246556
+ return;
246557
+ }
246558
+ console.log(magentaBright(`
246552
246559
  _________ __ __ .__ _____ .__ __
246553
246560
  / _____/ _____/ |__/ |_| | ____ / \\ |__| _____/ |_
246554
246561
  \\_____ \\_/ __ \\ __\\ __\\ | _/ __ \\ / \\ / \\| |/ \\ __\\
246555
246562
  / \\ ___/| | | | | |_\\ ___// Y \\ | | \\ |
246556
246563
  /_________/\\_____>__| |__| |____/\\_____>____|____/__|___|__/__|
246557
246564
  `));
246565
+ };
246558
246566
  var maskTokens2 = (output) => {
246559
246567
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
246560
246568
  };
@@ -246566,6 +246574,13 @@ var cancel2 = (msg) => {
246566
246574
  console.log("");
246567
246575
  throw new CancelError2(msg);
246568
246576
  };
246577
+ var CommandError = class extends Error {
246578
+ constructor(message, code, output) {
246579
+ super(message);
246580
+ this.code = code;
246581
+ this.output = output;
246582
+ }
246583
+ };
246569
246584
  async function executeCommand(command, args, options) {
246570
246585
  const child = spawn(command, args, { env: { ...process.env, ...options?.env } });
246571
246586
  process.stdin.pipe(child.stdin);
@@ -246585,23 +246600,29 @@ async function executeCommand(command, args, options) {
246585
246600
  }
246586
246601
  output.push(maskedData);
246587
246602
  });
246588
- child.on("error", (err) => reject(err));
246603
+ child.on("error", (err) => reject(new CommandError(err.message, "code" in err && typeof err.code === "number" ? err.code : 1, output)));
246589
246604
  child.on("close", (code) => {
246590
246605
  if (code === 0 || code === null || code === 143) {
246591
246606
  process.stdin.unpipe(child.stdin);
246592
246607
  resolve(output);
246593
246608
  return;
246594
246609
  }
246595
- reject(new Error(`Command "${command}" exited with code ${code}`));
246610
+ reject(new CommandError(`Command "${command}" exited with code ${code}`, code, output));
246596
246611
  });
246597
246612
  });
246598
246613
  }
246599
246614
  var intro = (msg) => {
246615
+ if (!shouldPrint()) {
246616
+ return;
246617
+ }
246600
246618
  console.log("");
246601
246619
  console.log(magentaBright(maskTokens2(msg)));
246602
246620
  console.log("");
246603
246621
  };
246604
246622
  var note = (message, level = "info") => {
246623
+ if (!shouldPrint()) {
246624
+ return;
246625
+ }
246605
246626
  const maskedMessage = maskTokens2(message);
246606
246627
  console.log("");
246607
246628
  if (level === "warn") {
@@ -246626,6 +246647,9 @@ function list(title, items) {
246626
246647
  ${formatItems(items)}`);
246627
246648
  }
246628
246649
  var outro = (msg) => {
246650
+ if (!shouldPrint()) {
246651
+ return;
246652
+ }
246629
246653
  console.log("");
246630
246654
  console.log(inverse(greenBright(maskTokens2(msg))));
246631
246655
  console.log("");
@@ -246645,7 +246669,7 @@ var spinner = async (options) => {
246645
246669
  ${error.stack}`));
246646
246670
  throw new SpinnerError(errorMessage, error);
246647
246671
  };
246648
- if (is_in_ci_default) {
246672
+ if (is_in_ci_default || !shouldPrint()) {
246649
246673
  try {
246650
246674
  return await options.task();
246651
246675
  } catch (err) {
@@ -246673,6 +246697,9 @@ function camelCaseToWords(s) {
246673
246697
  return capitalized.replace(/\s+/g, " ").trim();
246674
246698
  }
246675
246699
  function table(title, data) {
246700
+ if (!shouldPrint()) {
246701
+ return;
246702
+ }
246676
246703
  note(title);
246677
246704
  if (!data || data.length === 0) {
246678
246705
  note("No data to display");
@@ -248203,6 +248230,7 @@ var getEnv = (gqlClient) => {
248203
248230
  };
248204
248231
  var LoadBalancerFragment = graphql(`
248205
248232
  fragment LoadBalancer on LoadBalancer {
248233
+ __typename
248206
248234
  id
248207
248235
  uniqueName
248208
248236
  name
@@ -250030,10 +250058,16 @@ async function getPackageManagerExecutable(targetDir) {
250030
250058
  }
250031
250059
  return { command: "npx", args: [] };
250032
250060
  }
250061
+ function shouldPrint2() {
250062
+ return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
250063
+ }
250033
250064
  var maskTokens3 = (output) => {
250034
250065
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
250035
250066
  };
250036
250067
  var note2 = (message, level = "info") => {
250068
+ if (!shouldPrint2()) {
250069
+ return;
250070
+ }
250037
250071
  const maskedMessage = maskTokens3(message);
250038
250072
  console.log("");
250039
250073
  if (level === "warn") {
@@ -250085,6 +250119,16 @@ function tryParseJson3(value2, defaultValue = null) {
250085
250119
  return defaultValue;
250086
250120
  }
250087
250121
  }
250122
+ function extractJsonObject(value2) {
250123
+ if (value2.length > 5000) {
250124
+ throw new Error("Input too long");
250125
+ }
250126
+ const result = /\{([\s\S]*)\}/.exec(value2);
250127
+ if (!result) {
250128
+ return null;
250129
+ }
250130
+ return tryParseJson3(result[0]);
250131
+ }
250088
250132
  async function retryWhenFailed2(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
250089
250133
  let attempt = 0;
250090
250134
  while (attempt < maxRetries) {
@@ -251586,6 +251630,9 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
251586
251630
  };
251587
251631
  }
251588
251632
 
251633
+ // src/constants/default-subgraph.ts
251634
+ var DEFAULT_SUBGRAPH_NAME = "kit";
251635
+
251589
251636
  // src/utils/subgraph/sanitize-name.ts
251590
251637
  var import_slugify = __toESM(require_slugify(), 1);
251591
251638
  function sanitizeName(value4, length = 35) {
@@ -251795,9 +251842,9 @@ var esm_default3 = createPrompt((config3, done) => {
251795
251842
  firstRender.current = false;
251796
251843
  if (items.length > pageSize) {
251797
251844
  helpTipBottom = `
251798
- ${theme.style.help("(Use arrow keys to reveal more choices)")}`;
251845
+ ${theme.style.help(`(${config3.instructions?.pager ?? "Use arrow keys to reveal more choices"})`)}`;
251799
251846
  } else {
251800
- helpTipTop = theme.style.help("(Use arrow keys)");
251847
+ helpTipTop = theme.style.help(`(${config3.instructions?.navigation ?? "Use arrow keys"})`);
251801
251848
  }
251802
251849
  }
251803
251850
  const page = usePagination({
@@ -251848,7 +251895,13 @@ async function subgraphPrompt({
251848
251895
  if (env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH) {
251849
251896
  return [env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
251850
251897
  }
251851
- return subgraphNames.length === 1 ? subgraphNames : [];
251898
+ if (subgraphNames.length === 1) {
251899
+ return subgraphNames;
251900
+ }
251901
+ if (subgraphNames.includes(DEFAULT_SUBGRAPH_NAME)) {
251902
+ return [DEFAULT_SUBGRAPH_NAME];
251903
+ }
251904
+ return [];
251852
251905
  }
251853
251906
  if (!allowNew) {
251854
251907
  if (subgraphNames.length === 0) {
@@ -252033,7 +252086,8 @@ async function codegenBlockscout(env2) {
252033
252086
  }
252034
252087
  }
252035
252088
  }
252036
- `
252089
+ `,
252090
+ operationName: "IntrospectionQuery"
252037
252091
  })
252038
252092
  });
252039
252093
  await writeFile6(introspectionJsonPath, JSON.stringify(data));
@@ -252800,7 +252854,7 @@ async function theGraphPrompt({
252800
252854
  envKey: "SETTLEMINT_THEGRAPH",
252801
252855
  isRequired,
252802
252856
  defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
252803
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => middleware === undefined || middleware?.status === "COMPLETED") : choices;
252857
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => isRunning(middleware)) : choices;
252804
252858
  return esm_default3({
252805
252859
  message: "Which The Graph instance do you want to connect to?",
252806
252860
  choices: filteredChoices,
@@ -253040,8 +253094,10 @@ async function getGraphEndpoint(settlemint, service, graphName) {
253040
253094
  })
253041
253095
  });
253042
253096
  const endpoints = theGraphMiddleware.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue);
253097
+ const hasKitSubgraph = endpoints.map((endpoint) => endpoint.split("/").pop()).some((endpoint) => endpoint === DEFAULT_SUBGRAPH_NAME);
253043
253098
  return {
253044
- SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: endpoints
253099
+ SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: endpoints,
253100
+ SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: hasKitSubgraph ? DEFAULT_SUBGRAPH_NAME : undefined
253045
253101
  };
253046
253102
  }
253047
253103
  function getIpfsEndpoints(service) {
@@ -253128,7 +253184,7 @@ async function blockchainNodeOrLoadBalancerPrompt({
253128
253184
  envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
253129
253185
  isRequired,
253130
253186
  defaultHandler: async ({ defaultService: defaultNode, choices }) => {
253131
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
253187
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
253132
253188
  return esm_default3({
253133
253189
  message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
253134
253190
  choices: filteredChoices,
@@ -253198,7 +253254,7 @@ function connectCommand() {
253198
253254
  env: { ...env2, ...graphEndpoints },
253199
253255
  accept: acceptDefaults,
253200
253256
  message: "Which The Graph subgraph do you want to use as the default?"
253201
- }) : [];
253257
+ }) : [graphEndpoints.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
253202
253258
  const portal = await portalPrompt({
253203
253259
  env: env2,
253204
253260
  middlewares,
@@ -257222,13 +257278,16 @@ function getCreateCommand({
257222
257278
  region: selectedRegion?.id ?? ""
257223
257279
  });
257224
257280
  if (wait) {
257225
- await waitForCompletion({
257281
+ const isDeployed = await waitForCompletion({
257226
257282
  settlemint,
257227
257283
  type: waitFor?.resourceType ?? type4,
257228
257284
  uniqueName: waitFor?.uniqueName ?? result.uniqueName,
257229
257285
  action: "deploy",
257230
257286
  restartIfTimeout
257231
257287
  });
257288
+ if (!isDeployed) {
257289
+ throw new Error(`Failed to deploy ${waitFor?.resourceType ?? type4} ${waitFor?.uniqueName ?? result.uniqueName}`);
257290
+ }
257232
257291
  if (waitFor) {
257233
257292
  outro(`${capitalizeFirstLetter2(waitFor.resourceType)} ${waitFor.name} created successfully`);
257234
257293
  }
@@ -257773,22 +257832,26 @@ function blockscoutInsightsCreateCommand() {
257773
257832
  if (!applicationUniqueName) {
257774
257833
  return missingApplication();
257775
257834
  }
257776
- let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257777
- const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257835
+ let blockchainNodeUniqueName = blockchainNode;
257836
+ let loadBalancerUniqueName = loadBalancer;
257778
257837
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257779
257838
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257780
257839
  const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
257781
- const node = await blockchainNodeOrLoadBalancerPrompt({
257840
+ const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
257782
257841
  env: env2,
257783
257842
  nodes: blockchainNodes,
257784
257843
  loadBalancers,
257785
257844
  accept: acceptDefaults,
257786
257845
  isRequired: true
257787
257846
  });
257788
- if (!node) {
257847
+ if (!nodeOrLoadbalancer) {
257789
257848
  return nothingSelectedError("blockchain node");
257790
257849
  }
257791
- blockchainNodeUniqueName = node.uniqueName;
257850
+ if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
257851
+ loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
257852
+ } else {
257853
+ blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
257854
+ }
257792
257855
  }
257793
257856
  const result = await showSpinner(() => settlemint.insights.create({
257794
257857
  name: name3,
@@ -257901,7 +257964,17 @@ function loadBalancerEvmCreateCommand() {
257901
257964
  type: "load balancer",
257902
257965
  subType: "EVM",
257903
257966
  execute: (cmd2, baseAction) => {
257904
- addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").action(async (name3, { application, provider, region, size, type: type4, blockchainNodes, acceptDefaults, ...defaultArgs }) => {
257967
+ addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").option("--blockchain-network <blockchainNetwork>", "Blockchain network unique name where the load balancer connects to, can be skipped if the --blockchain-nodes option is used (defaults to network from env)").action(async (name3, {
257968
+ application,
257969
+ provider,
257970
+ region,
257971
+ size,
257972
+ type: type4,
257973
+ blockchainNodes,
257974
+ blockchainNetwork,
257975
+ acceptDefaults,
257976
+ ...defaultArgs
257977
+ }) => {
257905
257978
  return baseAction({
257906
257979
  ...defaultArgs,
257907
257980
  acceptDefaults,
@@ -257912,11 +257985,12 @@ function loadBalancerEvmCreateCommand() {
257912
257985
  if (!applicationUniqueName) {
257913
257986
  return missingApplication();
257914
257987
  }
257915
- let networkUniqueName;
257988
+ const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257989
+ let networkUniqueName = blockchainNetwork;
257916
257990
  let connectedNodesUniqueNames = blockchainNodes;
257917
257991
  if (!connectedNodesUniqueNames) {
257918
257992
  const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
257919
- const network = await blockchainNetworkPrompt({
257993
+ const network = networkUniqueName ? networks.find((network2) => network2.uniqueName === networkUniqueName) : await blockchainNetworkPrompt({
257920
257994
  env: env2,
257921
257995
  networks,
257922
257996
  accept: acceptDefaults,
@@ -257926,31 +258000,29 @@ function loadBalancerEvmCreateCommand() {
257926
258000
  return nothingSelectedError("blockchain network");
257927
258001
  }
257928
258002
  networkUniqueName = network.uniqueName;
257929
- const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257930
258003
  const connectedNodes = await blockchainNodePrompt({
257931
258004
  env: env2,
257932
- nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
258005
+ nodes: applicationBlockchainNodes.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
257933
258006
  accept: acceptDefaults,
257934
258007
  promptMessage: "Which blockchain node do you want to connect the load balancer to?",
257935
258008
  allowAll: true
257936
258009
  });
257937
- connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
258010
+ connectedNodesUniqueNames = Array.isArray(connectedNodes) ? applicationBlockchainNodes.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
257938
258011
  }
257939
258012
  if (connectedNodesUniqueNames.length === 0) {
257940
258013
  return cancel2("A load balancer must connect to at least one blockchain node");
257941
258014
  }
258015
+ const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
258016
+ if (selectedBlockchainNodes.length === 0) {
258017
+ return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
258018
+ }
257942
258019
  if (!networkUniqueName) {
257943
- const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257944
- const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
257945
- if (selectedBlockchainNodes.length === 0) {
257946
- return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
257947
- }
257948
- const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
257949
- if (!onTheSameNetwork) {
257950
- return cancel2("Blockchain nodes must be on the same network");
257951
- }
257952
258020
  networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
257953
258021
  }
258022
+ const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === networkUniqueName);
258023
+ if (!onTheSameNetwork) {
258024
+ return cancel2("Blockchain nodes must be on the same network");
258025
+ }
257954
258026
  const result = await showSpinner(() => settlemint.loadBalancer.create({
257955
258027
  applicationUniqueName,
257956
258028
  name: name3,
@@ -257966,7 +258038,8 @@ function loadBalancerEvmCreateCommand() {
257966
258038
  mapDefaultEnv: () => {
257967
258039
  return {
257968
258040
  SETTLEMINT_APPLICATION: applicationUniqueName,
257969
- SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
258041
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName,
258042
+ ...getBlockchainNodeOrLoadBalancerEndpoints(result)
257970
258043
  };
257971
258044
  }
257972
258045
  };
@@ -258658,7 +258731,15 @@ function getRestartCommand({
258658
258731
  stopMessage: `${capitalizeFirstLetter2(type4)} restart initiated`
258659
258732
  });
258660
258733
  if (wait) {
258661
- await waitForCompletion({ settlemint, type: type4, uniqueName: serviceUniqueName, action: "restart" });
258734
+ const isRestarted = await waitForCompletion({
258735
+ settlemint,
258736
+ type: type4,
258737
+ uniqueName: serviceUniqueName,
258738
+ action: "restart"
258739
+ });
258740
+ if (!isRestarted) {
258741
+ throw new Error(`Failed to restart ${type4} ${uniqueName}`);
258742
+ }
258662
258743
  }
258663
258744
  outro(`${capitalizeFirstLetter2(type4)} ${result.name} restart initiated successfully`);
258664
258745
  });
@@ -258914,10 +258995,7 @@ function yamlOutput(data) {
258914
258995
  // src/commands/platform/config.ts
258915
258996
  function configCommand() {
258916
258997
  return new Command("config").alias("cfg").description("Get platform configuration").option("--prod", "Connect to your production environment").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").addOption(new Option("-o, --output <output>", "The output format").choices(["json", "yaml"])).action(async ({ prod, instance, output }) => {
258917
- const printToTerminal = !output;
258918
- if (printToTerminal) {
258919
- intro("Getting platform configuration");
258920
- }
258998
+ intro("Getting platform configuration");
258921
258999
  const env2 = await loadEnv(false, !!prod);
258922
259000
  const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
258923
259001
  const settlemint = createSettleMintClient({
@@ -258947,19 +259025,17 @@ function configCommand() {
258947
259025
  }))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
258948
259026
  preDeployedContracts: platformConfig.preDeployedContracts.sort()
258949
259027
  };
258950
- if (printToTerminal) {
259028
+ if (output === "json") {
259029
+ jsonOutput(platformConfigData);
259030
+ } else if (output === "yaml") {
259031
+ yamlOutput(platformConfigData);
259032
+ } else {
258951
259033
  table("Templates (Kits)", platformConfigData.kits);
258952
259034
  table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
258953
259035
  table("Providers and regions", platformConfigData.deploymentEngineTargets);
258954
259036
  list("Pre-deployed abis (Smart Contract Portal)", platformConfigData.preDeployedContracts);
258955
- } else if (output === "json") {
258956
- jsonOutput(platformConfigData);
258957
- } else if (output === "yaml") {
258958
- yamlOutput(platformConfigData);
258959
- }
258960
- if (printToTerminal) {
258961
- outro("Platform configuration retrieved");
258962
259037
  }
259038
+ outro("Platform configuration retrieved");
258963
259039
  });
258964
259040
  }
258965
259041
 
@@ -259006,6 +259082,9 @@ function getUrlPathForService(service, serviceType) {
259006
259082
  if (serviceType === "insights") {
259007
259083
  return `insights/${encodeURIComponent(service.id)}/details`;
259008
259084
  }
259085
+ if (serviceType === "load-balancer") {
259086
+ return `loadbalancers/${encodeURIComponent(service.id)}/details`;
259087
+ }
259009
259088
  return "";
259010
259089
  }
259011
259090
  function getWorkspaceUrlPath(workspace) {
@@ -259035,10 +259114,7 @@ function applicationsListCommand() {
259035
259114
  command: "platform list applications -o yaml > applications.yaml"
259036
259115
  }
259037
259116
  ])).option("-w, --workspace <workspace>", "The workspace unique name to list applications for (defaults to workspace from env)").addOption(new Option("-o, --output <output>", "The output format").choices(["wide", "json", "yaml"])).action(async ({ workspace, output }) => {
259038
- const printToTerminal = !output || output === "wide";
259039
- if (printToTerminal) {
259040
- intro("Listing applications");
259041
- }
259117
+ intro("Listing applications");
259042
259118
  const env2 = await loadEnv(false, false);
259043
259119
  const selectedInstance = await instancePrompt(env2, true);
259044
259120
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259051,13 +259127,12 @@ function applicationsListCommand() {
259051
259127
  });
259052
259128
  const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
259053
259129
  const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
259054
- const wide = output === "wide";
259055
259130
  const applicationsData = applications.map((application) => {
259056
259131
  const basicFields = {
259057
259132
  name: application.name,
259058
259133
  uniqueName: application.uniqueName
259059
259134
  };
259060
- if (wide || !printToTerminal) {
259135
+ if (output) {
259061
259136
  return {
259062
259137
  ...basicFields,
259063
259138
  url: getApplicationUrl(selectedInstance, application)
@@ -259065,17 +259140,15 @@ function applicationsListCommand() {
259065
259140
  }
259066
259141
  return basicFields;
259067
259142
  });
259068
- if (printToTerminal) {
259069
- const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259070
- table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259071
- } else if (output === "json") {
259143
+ const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259144
+ if (output === "json") {
259072
259145
  jsonOutput(applicationsData);
259073
259146
  } else if (output === "yaml") {
259074
259147
  yamlOutput(applicationsData);
259148
+ } else {
259149
+ table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259075
259150
  }
259076
- if (printToTerminal) {
259077
- outro("Applications listed");
259078
- }
259151
+ outro("Applications listed");
259079
259152
  });
259080
259153
  }
259081
259154
  async function selectWorkspace(settlemint, env2) {
@@ -259089,7 +259162,7 @@ function formatServiceSubType(service, printToTerminal = true) {
259089
259162
  if ("__typename" in service && typeof service.__typename === "string") {
259090
259163
  return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
259091
259164
  }
259092
- return printToTerminal ? "Unknown" : "Unknown";
259165
+ return "Unknown";
259093
259166
  }
259094
259167
 
259095
259168
  // src/commands/platform/utils/formatting/format-health-status.ts
@@ -259120,6 +259193,7 @@ function formatStatus(status, printToTerminal = true) {
259120
259193
  var SERVICE_TYPES = [
259121
259194
  "blockchain-network",
259122
259195
  "blockchain-node",
259196
+ "load-balancer",
259123
259197
  "custom-deployment",
259124
259198
  "insights",
259125
259199
  "integration-tool",
@@ -259158,10 +259232,7 @@ function servicesCommand() {
259158
259232
  command: "platform list services --type blockchain-network blockchain-node middleware"
259159
259233
  }
259160
259234
  ])).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 }) => {
259161
- const printToTerminal = !output || output === "wide";
259162
- if (printToTerminal) {
259163
- intro("Listing application services");
259164
- }
259235
+ intro("Listing application services");
259165
259236
  const env2 = await loadEnv(false, false);
259166
259237
  const selectedInstance = await instancePrompt(env2, true);
259167
259238
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259173,6 +259244,7 @@ function servicesCommand() {
259173
259244
  accessToken,
259174
259245
  instance: selectedInstance
259175
259246
  });
259247
+ const printToTerminal = !output || output === "wide";
259176
259248
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
259177
259249
  if (!applicationUniqueName) {
259178
259250
  return nothingSelectedError("application");
@@ -259200,16 +259272,14 @@ function servicesCommand() {
259200
259272
  },
259201
259273
  services: servicesToShow
259202
259274
  };
259203
- if (printToTerminal) {
259204
- table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259205
- } else if (output === "json") {
259275
+ if (output === "json") {
259206
259276
  jsonOutput(data);
259207
259277
  } else if (output === "yaml") {
259208
259278
  yamlOutput(data);
259279
+ } else {
259280
+ table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259209
259281
  }
259210
- if (printToTerminal) {
259211
- outro("Application services listed");
259212
- }
259282
+ outro("Application services listed");
259213
259283
  });
259214
259284
  }
259215
259285
  async function selectApplication(settlemint, env2) {
@@ -259278,6 +259348,8 @@ function getItemsForServiceType(services, serviceType) {
259278
259348
  return services.blockchainNetworks;
259279
259349
  case "blockchain-node":
259280
259350
  return services.blockchainNodes;
259351
+ case "load-balancer":
259352
+ return services.loadBalancers;
259281
259353
  default:
259282
259354
  return [];
259283
259355
  }
@@ -259742,15 +259814,21 @@ Please select another key or activate this key on the node and try again.`, "war
259742
259814
  async function getHardhatConfigData(envConfig) {
259743
259815
  try {
259744
259816
  const { command, args } = await getPackageManagerExecutable();
259745
- const output = await executeCommand(command, [...args, "ts-node", "-e", `import hardhat from "hardhat";
259746
- console.log(JSON.stringify(hardhat.userConfig));`], {
259817
+ const output = await executeCommand(command, [
259818
+ ...args,
259819
+ "ts-node",
259820
+ "-e",
259821
+ `import hardhat from "hardhat";
259822
+ console.log(JSON.stringify(hardhat.userConfig));`,
259823
+ "--transpileOnly"
259824
+ ], {
259747
259825
  env: {
259748
259826
  ...process.env,
259749
259827
  ...envConfig
259750
259828
  },
259751
259829
  silent: true
259752
259830
  });
259753
- const config3 = tryParseJson3(output.join(" "));
259831
+ const config3 = extractJsonObject(output.join(" "));
259754
259832
  if (isHardhatConfig(config3)) {
259755
259833
  return config3;
259756
259834
  }
@@ -260256,7 +260334,8 @@ function subgraphDeployCommand() {
260256
260334
  await writeEnvSpinner(!!prod, {
260257
260335
  ...env2,
260258
260336
  SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
260259
- ...graphEndpoints
260337
+ ...graphEndpoints,
260338
+ SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH ?? graphName
260260
260339
  });
260261
260340
  outro(`Subgraph ${graphName} deployed successfully`);
260262
260341
  });
@@ -260326,8 +260405,8 @@ function subgraphRemoveCommand() {
260326
260405
  await writeEnvSpinner(!!prod, {
260327
260406
  ...env2,
260328
260407
  SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
260329
- SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH === graphName ? undefined : env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH,
260330
- ...graphEndpoints
260408
+ ...graphEndpoints,
260409
+ SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH === graphName ? undefined : env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH
260331
260410
  });
260332
260411
  outro(`Subgraph ${graphName} removed successfully`);
260333
260412
  });
@@ -260389,7 +260468,10 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
260389
260468
  rootCmd._lastCommand = thisCommand;
260390
260469
  rootCmd._lastCommand._commandPath = commandPath;
260391
260470
  }
260392
- if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
260471
+ if (isJsonOrYamlOutput(thisCommand)) {
260472
+ process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
260473
+ }
260474
+ if (isLeafCommand(thisCommand)) {
260393
260475
  ascii();
260394
260476
  await validateSdkVersionFromCommand(thisCommand);
260395
260477
  }
@@ -260473,4 +260555,4 @@ async function sdkCliCommand(argv = process.argv) {
260473
260555
  // src/cli.ts
260474
260556
  sdkCliCommand();
260475
260557
 
260476
- //# debugId=802596FD48A8DC2864756E2164756E21
260558
+ //# debugId=42FD06C642869A5B64756E2164756E21