@settlemint/sdk-cli 2.1.4-pr8b3a2eba → 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-pr8b3a2eba",
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-pr8b3a2eba",
245393
- "@settlemint/sdk-utils": "2.1.4-pr8b3a2eba",
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");
@@ -250038,10 +250058,16 @@ async function getPackageManagerExecutable(targetDir) {
250038
250058
  }
250039
250059
  return { command: "npx", args: [] };
250040
250060
  }
250061
+ function shouldPrint2() {
250062
+ return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
250063
+ }
250041
250064
  var maskTokens3 = (output) => {
250042
250065
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
250043
250066
  };
250044
250067
  var note2 = (message, level = "info") => {
250068
+ if (!shouldPrint2()) {
250069
+ return;
250070
+ }
250045
250071
  const maskedMessage = maskTokens3(message);
250046
250072
  console.log("");
250047
250073
  if (level === "warn") {
@@ -251866,7 +251892,13 @@ async function subgraphPrompt({
251866
251892
  if (env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH) {
251867
251893
  return [env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
251868
251894
  }
251869
- 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 [];
251870
251902
  }
251871
251903
  if (!allowNew) {
251872
251904
  if (subgraphNames.length === 0) {
@@ -258947,10 +258979,7 @@ function yamlOutput(data) {
258947
258979
  // src/commands/platform/config.ts
258948
258980
  function configCommand() {
258949
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 }) => {
258950
- const printToTerminal = !output;
258951
- if (printToTerminal) {
258952
- intro("Getting platform configuration");
258953
- }
258982
+ intro("Getting platform configuration");
258954
258983
  const env2 = await loadEnv(false, !!prod);
258955
258984
  const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
258956
258985
  const settlemint = createSettleMintClient({
@@ -258980,19 +259009,17 @@ function configCommand() {
258980
259009
  }))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
258981
259010
  preDeployedContracts: platformConfig.preDeployedContracts.sort()
258982
259011
  };
258983
- if (printToTerminal) {
259012
+ if (output === "json") {
259013
+ jsonOutput(platformConfigData);
259014
+ } else if (output === "yaml") {
259015
+ yamlOutput(platformConfigData);
259016
+ } else {
258984
259017
  table("Templates (Kits)", platformConfigData.kits);
258985
259018
  table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
258986
259019
  table("Providers and regions", platformConfigData.deploymentEngineTargets);
258987
259020
  list("Pre-deployed abis (Smart Contract Portal)", platformConfigData.preDeployedContracts);
258988
- } else if (output === "json") {
258989
- jsonOutput(platformConfigData);
258990
- } else if (output === "yaml") {
258991
- yamlOutput(platformConfigData);
258992
- }
258993
- if (printToTerminal) {
258994
- outro("Platform configuration retrieved");
258995
259021
  }
259022
+ outro("Platform configuration retrieved");
258996
259023
  });
258997
259024
  }
258998
259025
 
@@ -259068,10 +259095,7 @@ function applicationsListCommand() {
259068
259095
  command: "platform list applications -o yaml > applications.yaml"
259069
259096
  }
259070
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 }) => {
259071
- const printToTerminal = !output || output === "wide";
259072
- if (printToTerminal) {
259073
- intro("Listing applications");
259074
- }
259098
+ intro("Listing applications");
259075
259099
  const env2 = await loadEnv(false, false);
259076
259100
  const selectedInstance = await instancePrompt(env2, true);
259077
259101
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259084,13 +259108,12 @@ function applicationsListCommand() {
259084
259108
  });
259085
259109
  const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
259086
259110
  const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
259087
- const wide = output === "wide";
259088
259111
  const applicationsData = applications.map((application) => {
259089
259112
  const basicFields = {
259090
259113
  name: application.name,
259091
259114
  uniqueName: application.uniqueName
259092
259115
  };
259093
- if (wide || !printToTerminal) {
259116
+ if (output) {
259094
259117
  return {
259095
259118
  ...basicFields,
259096
259119
  url: getApplicationUrl(selectedInstance, application)
@@ -259098,17 +259121,15 @@ function applicationsListCommand() {
259098
259121
  }
259099
259122
  return basicFields;
259100
259123
  });
259101
- if (printToTerminal) {
259102
- const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259103
- table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259104
- } else if (output === "json") {
259124
+ const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259125
+ if (output === "json") {
259105
259126
  jsonOutput(applicationsData);
259106
259127
  } else if (output === "yaml") {
259107
259128
  yamlOutput(applicationsData);
259129
+ } else {
259130
+ table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259108
259131
  }
259109
- if (printToTerminal) {
259110
- outro("Applications listed");
259111
- }
259132
+ outro("Applications listed");
259112
259133
  });
259113
259134
  }
259114
259135
  async function selectWorkspace(settlemint, env2) {
@@ -259122,7 +259143,7 @@ function formatServiceSubType(service, printToTerminal = true) {
259122
259143
  if ("__typename" in service && typeof service.__typename === "string") {
259123
259144
  return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
259124
259145
  }
259125
- return printToTerminal ? "Unknown" : "Unknown";
259146
+ return "Unknown";
259126
259147
  }
259127
259148
 
259128
259149
  // src/commands/platform/utils/formatting/format-health-status.ts
@@ -259153,6 +259174,7 @@ function formatStatus(status, printToTerminal = true) {
259153
259174
  var SERVICE_TYPES = [
259154
259175
  "blockchain-network",
259155
259176
  "blockchain-node",
259177
+ "load-balancer",
259156
259178
  "custom-deployment",
259157
259179
  "insights",
259158
259180
  "integration-tool",
@@ -259191,10 +259213,7 @@ function servicesCommand() {
259191
259213
  command: "platform list services --type blockchain-network blockchain-node middleware"
259192
259214
  }
259193
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 }) => {
259194
- const printToTerminal = !output || output === "wide";
259195
- if (printToTerminal) {
259196
- intro("Listing application services");
259197
- }
259216
+ intro("Listing application services");
259198
259217
  const env2 = await loadEnv(false, false);
259199
259218
  const selectedInstance = await instancePrompt(env2, true);
259200
259219
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259206,6 +259225,7 @@ function servicesCommand() {
259206
259225
  accessToken,
259207
259226
  instance: selectedInstance
259208
259227
  });
259228
+ const printToTerminal = !output || output === "wide";
259209
259229
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
259210
259230
  if (!applicationUniqueName) {
259211
259231
  return nothingSelectedError("application");
@@ -259233,16 +259253,14 @@ function servicesCommand() {
259233
259253
  },
259234
259254
  services: servicesToShow
259235
259255
  };
259236
- if (printToTerminal) {
259237
- table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259238
- } else if (output === "json") {
259256
+ if (output === "json") {
259239
259257
  jsonOutput(data);
259240
259258
  } else if (output === "yaml") {
259241
259259
  yamlOutput(data);
259260
+ } else {
259261
+ table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259242
259262
  }
259243
- if (printToTerminal) {
259244
- outro("Application services listed");
259245
- }
259263
+ outro("Application services listed");
259246
259264
  });
259247
259265
  }
259248
259266
  async function selectApplication(settlemint, env2) {
@@ -259311,6 +259329,8 @@ function getItemsForServiceType(services, serviceType) {
259311
259329
  return services.blockchainNetworks;
259312
259330
  case "blockchain-node":
259313
259331
  return services.blockchainNodes;
259332
+ case "load-balancer":
259333
+ return services.loadBalancers;
259314
259334
  default:
259315
259335
  return [];
259316
259336
  }
@@ -260428,7 +260448,10 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
260428
260448
  rootCmd._lastCommand = thisCommand;
260429
260449
  rootCmd._lastCommand._commandPath = commandPath;
260430
260450
  }
260431
- if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
260451
+ if (isJsonOrYamlOutput(thisCommand)) {
260452
+ process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
260453
+ }
260454
+ if (isLeafCommand(thisCommand)) {
260432
260455
  ascii();
260433
260456
  await validateSdkVersionFromCommand(thisCommand);
260434
260457
  }
@@ -260512,4 +260535,4 @@ async function sdkCliCommand(argv = process.argv) {
260512
260535
  // src/cli.ts
260513
260536
  sdkCliCommand();
260514
260537
 
260515
- //# debugId=36A9A5528CCEC94864756E2164756E21
260538
+ //# debugId=6B9DFB951DB1003264756E2164756E21