@settlemint/sdk-cli 2.1.4-pr89803ad8 → 2.1.4-pr8b7e4fdd

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
@@ -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-pr89803ad8",
245343
+ version: "2.1.4-pr8b7e4fdd",
245344
245344
  type: "module",
245345
245345
  private: false,
245346
245346
  license: "FSL-1.1-MIT",
@@ -245389,8 +245389,8 @@ var package_default = {
245389
245389
  "@inquirer/input": "4.1.9",
245390
245390
  "@inquirer/password": "4.0.12",
245391
245391
  "@inquirer/select": "4.1.1",
245392
- "@settlemint/sdk-js": "2.1.4-pr89803ad8",
245393
- "@settlemint/sdk-utils": "2.1.4-pr89803ad8",
245392
+ "@settlemint/sdk-js": "2.1.4-pr8b7e4fdd",
245393
+ "@settlemint/sdk-utils": "2.1.4-pr8b7e4fdd",
245394
245394
  "@types/node": "22.14.1",
245395
245395
  "@types/semver": "7.7.0",
245396
245396
  "@types/which": "3.0.4",
@@ -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
  };
@@ -246604,11 +246612,17 @@ async function executeCommand(command, args, options) {
246604
246612
  });
246605
246613
  }
246606
246614
  var intro = (msg) => {
246615
+ if (!shouldPrint()) {
246616
+ return;
246617
+ }
246607
246618
  console.log("");
246608
246619
  console.log(magentaBright(maskTokens2(msg)));
246609
246620
  console.log("");
246610
246621
  };
246611
246622
  var note = (message, level = "info") => {
246623
+ if (!shouldPrint()) {
246624
+ return;
246625
+ }
246612
246626
  const maskedMessage = maskTokens2(message);
246613
246627
  console.log("");
246614
246628
  if (level === "warn") {
@@ -246633,6 +246647,9 @@ function list(title, items) {
246633
246647
  ${formatItems(items)}`);
246634
246648
  }
246635
246649
  var outro = (msg) => {
246650
+ if (!shouldPrint()) {
246651
+ return;
246652
+ }
246636
246653
  console.log("");
246637
246654
  console.log(inverse(greenBright(maskTokens2(msg))));
246638
246655
  console.log("");
@@ -246652,7 +246669,7 @@ var spinner = async (options) => {
246652
246669
  ${error.stack}`));
246653
246670
  throw new SpinnerError(errorMessage, error);
246654
246671
  };
246655
- if (is_in_ci_default) {
246672
+ if (is_in_ci_default || !shouldPrint()) {
246656
246673
  try {
246657
246674
  return await options.task();
246658
246675
  } catch (err) {
@@ -246680,6 +246697,9 @@ function camelCaseToWords(s) {
246680
246697
  return capitalized.replace(/\s+/g, " ").trim();
246681
246698
  }
246682
246699
  function table(title, data) {
246700
+ if (!shouldPrint()) {
246701
+ return;
246702
+ }
246683
246703
  note(title);
246684
246704
  if (!data || data.length === 0) {
246685
246705
  note("No data to display");
@@ -248210,6 +248230,7 @@ var getEnv = (gqlClient) => {
248210
248230
  };
248211
248231
  var LoadBalancerFragment = graphql(`
248212
248232
  fragment LoadBalancer on LoadBalancer {
248233
+ __typename
248213
248234
  id
248214
248235
  uniqueName
248215
248236
  name
@@ -250037,10 +250058,16 @@ async function getPackageManagerExecutable(targetDir) {
250037
250058
  }
250038
250059
  return { command: "npx", args: [] };
250039
250060
  }
250061
+ function shouldPrint2() {
250062
+ return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
250063
+ }
250040
250064
  var maskTokens3 = (output) => {
250041
250065
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
250042
250066
  };
250043
250067
  var note2 = (message, level = "info") => {
250068
+ if (!shouldPrint2()) {
250069
+ return;
250070
+ }
250044
250071
  const maskedMessage = maskTokens3(message);
250045
250072
  console.log("");
250046
250073
  if (level === "warn") {
@@ -250093,6 +250120,9 @@ function tryParseJson3(value2, defaultValue = null) {
250093
250120
  }
250094
250121
  }
250095
250122
  function extractJsonObject(value2) {
250123
+ if (value2.length > 5000) {
250124
+ throw new Error("Input too long");
250125
+ }
250096
250126
  const result = /\{([\s\S]*)\}/.exec(value2);
250097
250127
  if (!result) {
250098
250128
  return null;
@@ -251862,7 +251892,13 @@ async function subgraphPrompt({
251862
251892
  if (env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH) {
251863
251893
  return [env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
251864
251894
  }
251865
- return subgraphNames.length === 1 ? subgraphNames : [];
251895
+ if (subgraphNames.length === 1) {
251896
+ return subgraphNames;
251897
+ }
251898
+ if (subgraphNames.includes("kit")) {
251899
+ return ["kit"];
251900
+ }
251901
+ return [];
251866
251902
  }
251867
251903
  if (!allowNew) {
251868
251904
  if (subgraphNames.length === 0) {
@@ -252815,7 +252851,7 @@ async function theGraphPrompt({
252815
252851
  envKey: "SETTLEMINT_THEGRAPH",
252816
252852
  isRequired,
252817
252853
  defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
252818
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => middleware === undefined || middleware?.status === "COMPLETED") : choices;
252854
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => isRunning(middleware)) : choices;
252819
252855
  return esm_default3({
252820
252856
  message: "Which The Graph instance do you want to connect to?",
252821
252857
  choices: filteredChoices,
@@ -253143,7 +253179,7 @@ async function blockchainNodeOrLoadBalancerPrompt({
253143
253179
  envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
253144
253180
  isRequired,
253145
253181
  defaultHandler: async ({ defaultService: defaultNode, choices }) => {
253146
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
253182
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
253147
253183
  return esm_default3({
253148
253184
  message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
253149
253185
  choices: filteredChoices,
@@ -257788,22 +257824,26 @@ function blockscoutInsightsCreateCommand() {
257788
257824
  if (!applicationUniqueName) {
257789
257825
  return missingApplication();
257790
257826
  }
257791
- let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257792
- const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257827
+ let blockchainNodeUniqueName = blockchainNode;
257828
+ let loadBalancerUniqueName = loadBalancer;
257793
257829
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257794
257830
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257795
257831
  const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
257796
- const node = await blockchainNodeOrLoadBalancerPrompt({
257832
+ const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
257797
257833
  env: env2,
257798
257834
  nodes: blockchainNodes,
257799
257835
  loadBalancers,
257800
257836
  accept: acceptDefaults,
257801
257837
  isRequired: true
257802
257838
  });
257803
- if (!node) {
257839
+ if (!nodeOrLoadbalancer) {
257804
257840
  return nothingSelectedError("blockchain node");
257805
257841
  }
257806
- blockchainNodeUniqueName = node.uniqueName;
257842
+ if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
257843
+ loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
257844
+ } else {
257845
+ blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
257846
+ }
257807
257847
  }
257808
257848
  const result = await showSpinner(() => settlemint.insights.create({
257809
257849
  name: name3,
@@ -257916,7 +257956,7 @@ function loadBalancerEvmCreateCommand() {
257916
257956
  type: "load balancer",
257917
257957
  subType: "EVM",
257918
257958
  execute: (cmd2, baseAction) => {
257919
- 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").action(async (name3, {
257959
+ 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, {
257920
257960
  application,
257921
257961
  provider,
257922
257962
  region,
@@ -257990,7 +258030,8 @@ function loadBalancerEvmCreateCommand() {
257990
258030
  mapDefaultEnv: () => {
257991
258031
  return {
257992
258032
  SETTLEMINT_APPLICATION: applicationUniqueName,
257993
- SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
258033
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName,
258034
+ ...getBlockchainNodeOrLoadBalancerEndpoints(result)
257994
258035
  };
257995
258036
  }
257996
258037
  };
@@ -258938,10 +258979,7 @@ function yamlOutput(data) {
258938
258979
  // src/commands/platform/config.ts
258939
258980
  function configCommand() {
258940
258981
  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 }) => {
258941
- const printToTerminal = !output;
258942
- if (printToTerminal) {
258943
- intro("Getting platform configuration");
258944
- }
258982
+ intro("Getting platform configuration");
258945
258983
  const env2 = await loadEnv(false, !!prod);
258946
258984
  const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
258947
258985
  const settlemint = createSettleMintClient({
@@ -258971,19 +259009,17 @@ function configCommand() {
258971
259009
  }))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
258972
259010
  preDeployedContracts: platformConfig.preDeployedContracts.sort()
258973
259011
  };
258974
- if (printToTerminal) {
259012
+ if (output === "json") {
259013
+ jsonOutput(platformConfigData);
259014
+ } else if (output === "yaml") {
259015
+ yamlOutput(platformConfigData);
259016
+ } else {
258975
259017
  table("Templates (Kits)", platformConfigData.kits);
258976
259018
  table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
258977
259019
  table("Providers and regions", platformConfigData.deploymentEngineTargets);
258978
259020
  list("Pre-deployed abis (Smart Contract Portal)", platformConfigData.preDeployedContracts);
258979
- } else if (output === "json") {
258980
- jsonOutput(platformConfigData);
258981
- } else if (output === "yaml") {
258982
- yamlOutput(platformConfigData);
258983
- }
258984
- if (printToTerminal) {
258985
- outro("Platform configuration retrieved");
258986
259021
  }
259022
+ outro("Platform configuration retrieved");
258987
259023
  });
258988
259024
  }
258989
259025
 
@@ -259059,10 +259095,7 @@ function applicationsListCommand() {
259059
259095
  command: "platform list applications -o yaml > applications.yaml"
259060
259096
  }
259061
259097
  ])).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 }) => {
259062
- const printToTerminal = !output || output === "wide";
259063
- if (printToTerminal) {
259064
- intro("Listing applications");
259065
- }
259098
+ intro("Listing applications");
259066
259099
  const env2 = await loadEnv(false, false);
259067
259100
  const selectedInstance = await instancePrompt(env2, true);
259068
259101
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259075,13 +259108,12 @@ function applicationsListCommand() {
259075
259108
  });
259076
259109
  const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
259077
259110
  const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
259078
- const wide = output === "wide";
259079
259111
  const applicationsData = applications.map((application) => {
259080
259112
  const basicFields = {
259081
259113
  name: application.name,
259082
259114
  uniqueName: application.uniqueName
259083
259115
  };
259084
- if (wide || !printToTerminal) {
259116
+ if (output) {
259085
259117
  return {
259086
259118
  ...basicFields,
259087
259119
  url: getApplicationUrl(selectedInstance, application)
@@ -259089,17 +259121,15 @@ function applicationsListCommand() {
259089
259121
  }
259090
259122
  return basicFields;
259091
259123
  });
259092
- if (printToTerminal) {
259093
- const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259094
- table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259095
- } else if (output === "json") {
259124
+ const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259125
+ if (output === "json") {
259096
259126
  jsonOutput(applicationsData);
259097
259127
  } else if (output === "yaml") {
259098
259128
  yamlOutput(applicationsData);
259129
+ } else {
259130
+ table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259099
259131
  }
259100
- if (printToTerminal) {
259101
- outro("Applications listed");
259102
- }
259132
+ outro("Applications listed");
259103
259133
  });
259104
259134
  }
259105
259135
  async function selectWorkspace(settlemint, env2) {
@@ -259113,7 +259143,7 @@ function formatServiceSubType(service, printToTerminal = true) {
259113
259143
  if ("__typename" in service && typeof service.__typename === "string") {
259114
259144
  return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
259115
259145
  }
259116
- return printToTerminal ? "Unknown" : "Unknown";
259146
+ return "Unknown";
259117
259147
  }
259118
259148
 
259119
259149
  // src/commands/platform/utils/formatting/format-health-status.ts
@@ -259144,6 +259174,7 @@ function formatStatus(status, printToTerminal = true) {
259144
259174
  var SERVICE_TYPES = [
259145
259175
  "blockchain-network",
259146
259176
  "blockchain-node",
259177
+ "load-balancer",
259147
259178
  "custom-deployment",
259148
259179
  "insights",
259149
259180
  "integration-tool",
@@ -259182,10 +259213,7 @@ function servicesCommand() {
259182
259213
  command: "platform list services --type blockchain-network blockchain-node middleware"
259183
259214
  }
259184
259215
  ])).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 }) => {
259185
- const printToTerminal = !output || output === "wide";
259186
- if (printToTerminal) {
259187
- intro("Listing application services");
259188
- }
259216
+ intro("Listing application services");
259189
259217
  const env2 = await loadEnv(false, false);
259190
259218
  const selectedInstance = await instancePrompt(env2, true);
259191
259219
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259197,6 +259225,7 @@ function servicesCommand() {
259197
259225
  accessToken,
259198
259226
  instance: selectedInstance
259199
259227
  });
259228
+ const printToTerminal = !output || output === "wide";
259200
259229
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
259201
259230
  if (!applicationUniqueName) {
259202
259231
  return nothingSelectedError("application");
@@ -259224,16 +259253,14 @@ function servicesCommand() {
259224
259253
  },
259225
259254
  services: servicesToShow
259226
259255
  };
259227
- if (printToTerminal) {
259228
- table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259229
- } else if (output === "json") {
259256
+ if (output === "json") {
259230
259257
  jsonOutput(data);
259231
259258
  } else if (output === "yaml") {
259232
259259
  yamlOutput(data);
259260
+ } else {
259261
+ table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259233
259262
  }
259234
- if (printToTerminal) {
259235
- outro("Application services listed");
259236
- }
259263
+ outro("Application services listed");
259237
259264
  });
259238
259265
  }
259239
259266
  async function selectApplication(settlemint, env2) {
@@ -259302,6 +259329,8 @@ function getItemsForServiceType(services, serviceType) {
259302
259329
  return services.blockchainNetworks;
259303
259330
  case "blockchain-node":
259304
259331
  return services.blockchainNodes;
259332
+ case "load-balancer":
259333
+ return services.loadBalancers;
259305
259334
  default:
259306
259335
  return [];
259307
259336
  }
@@ -259784,12 +259813,10 @@ console.log(JSON.stringify(hardhat.userConfig));`,
259784
259813
  if (isHardhatConfig(config3)) {
259785
259814
  return config3;
259786
259815
  }
259787
- throw new Error(`Invalid hardhat config: ${output.join(`
259788
- `)}`);
259816
+ throw new Error("Invalid hardhat config");
259789
259817
  } catch (err) {
259790
259818
  const error5 = err;
259791
- note(`Error reading hardhat.config.ts: ${error5.output?.join(`
259792
- `) ?? error5.message}`);
259819
+ note(`Error reading hardhat.config.ts: ${error5.message}`);
259793
259820
  return {};
259794
259821
  }
259795
259822
  }
@@ -260421,7 +260448,10 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
260421
260448
  rootCmd._lastCommand = thisCommand;
260422
260449
  rootCmd._lastCommand._commandPath = commandPath;
260423
260450
  }
260424
- if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
260451
+ if (isJsonOrYamlOutput(thisCommand)) {
260452
+ process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
260453
+ }
260454
+ if (isLeafCommand(thisCommand)) {
260425
260455
  ascii();
260426
260456
  await validateSdkVersionFromCommand(thisCommand);
260427
260457
  }
@@ -260505,4 +260535,4 @@ async function sdkCliCommand(argv = process.argv) {
260505
260535
  // src/cli.ts
260506
260536
  sdkCliCommand();
260507
260537
 
260508
- //# debugId=F27C3775F46A524E64756E2164756E21
260538
+ //# debugId=6B9DFB951DB1003264756E2164756E21