@settlemint/sdk-cli 2.1.4-prf0b81bca → 2.1.4-prfa991a9d

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-prf0b81bca",
245343
+ version: "2.1.4-prfa991a9d",
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-prf0b81bca",
245393
- "@settlemint/sdk-utils": "2.1.4-prf0b81bca",
245392
+ "@settlemint/sdk-js": "2.1.4-prfa991a9d",
245393
+ "@settlemint/sdk-utils": "2.1.4-prfa991a9d",
245394
245394
  "@types/node": "22.14.1",
245395
245395
  "@types/semver": "7.7.0",
245396
245396
  "@types/which": "3.0.4",
@@ -246548,21 +246548,13 @@ 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
- function shouldPrint() {
246552
- return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
246553
- }
246554
- var ascii = () => {
246555
- if (!shouldPrint()) {
246556
- return;
246557
- }
246558
- console.log(magentaBright(`
246551
+ var ascii = () => console.log(magentaBright(`
246559
246552
  _________ __ __ .__ _____ .__ __
246560
246553
  / _____/ _____/ |__/ |_| | ____ / \\ |__| _____/ |_
246561
246554
  \\_____ \\_/ __ \\ __\\ __\\ | _/ __ \\ / \\ / \\| |/ \\ __\\
246562
246555
  / \\ ___/| | | | | |_\\ ___// Y \\ | | \\ |
246563
246556
  /_________/\\_____>__| |__| |____/\\_____>____|____/__|___|__/__|
246564
246557
  `));
246565
- };
246566
246558
  var maskTokens2 = (output) => {
246567
246559
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
246568
246560
  };
@@ -246605,17 +246597,11 @@ async function executeCommand(command, args, options) {
246605
246597
  });
246606
246598
  }
246607
246599
  var intro = (msg) => {
246608
- if (!shouldPrint()) {
246609
- return;
246610
- }
246611
246600
  console.log("");
246612
246601
  console.log(magentaBright(maskTokens2(msg)));
246613
246602
  console.log("");
246614
246603
  };
246615
246604
  var note = (message, level = "info") => {
246616
- if (!shouldPrint()) {
246617
- return;
246618
- }
246619
246605
  const maskedMessage = maskTokens2(message);
246620
246606
  console.log("");
246621
246607
  if (level === "warn") {
@@ -246640,9 +246626,6 @@ function list(title, items) {
246640
246626
  ${formatItems(items)}`);
246641
246627
  }
246642
246628
  var outro = (msg) => {
246643
- if (!shouldPrint()) {
246644
- return;
246645
- }
246646
246629
  console.log("");
246647
246630
  console.log(inverse(greenBright(maskTokens2(msg))));
246648
246631
  console.log("");
@@ -246662,7 +246645,7 @@ var spinner = async (options) => {
246662
246645
  ${error.stack}`));
246663
246646
  throw new SpinnerError(errorMessage, error);
246664
246647
  };
246665
- if (is_in_ci_default || !shouldPrint()) {
246648
+ if (is_in_ci_default) {
246666
246649
  try {
246667
246650
  return await options.task();
246668
246651
  } catch (err) {
@@ -246690,9 +246673,6 @@ function camelCaseToWords(s) {
246690
246673
  return capitalized.replace(/\s+/g, " ").trim();
246691
246674
  }
246692
246675
  function table(title, data) {
246693
- if (!shouldPrint()) {
246694
- return;
246695
- }
246696
246676
  note(title);
246697
246677
  if (!data || data.length === 0) {
246698
246678
  note("No data to display");
@@ -250050,16 +250030,10 @@ async function getPackageManagerExecutable(targetDir) {
250050
250030
  }
250051
250031
  return { command: "npx", args: [] };
250052
250032
  }
250053
- function shouldPrint2() {
250054
- return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
250055
- }
250056
250033
  var maskTokens3 = (output) => {
250057
250034
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
250058
250035
  };
250059
250036
  var note2 = (message, level = "info") => {
250060
- if (!shouldPrint2()) {
250061
- return;
250062
- }
250063
250037
  const maskedMessage = maskTokens3(message);
250064
250038
  console.log("");
250065
250039
  if (level === "warn") {
@@ -258940,7 +258914,10 @@ function yamlOutput(data) {
258940
258914
  // src/commands/platform/config.ts
258941
258915
  function configCommand() {
258942
258916
  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 }) => {
258943
- intro("Getting platform configuration");
258917
+ const printToTerminal = !output;
258918
+ if (printToTerminal) {
258919
+ intro("Getting platform configuration");
258920
+ }
258944
258921
  const env2 = await loadEnv(false, !!prod);
258945
258922
  const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
258946
258923
  const settlemint = createSettleMintClient({
@@ -258970,17 +258947,19 @@ function configCommand() {
258970
258947
  }))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
258971
258948
  preDeployedContracts: platformConfig.preDeployedContracts.sort()
258972
258949
  };
258973
- if (output === "json") {
258974
- jsonOutput(platformConfigData);
258975
- } else if (output === "yaml") {
258976
- yamlOutput(platformConfigData);
258977
- } else {
258950
+ if (printToTerminal) {
258978
258951
  table("Templates (Kits)", platformConfigData.kits);
258979
258952
  table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
258980
258953
  table("Providers and regions", platformConfigData.deploymentEngineTargets);
258981
258954
  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");
258982
258962
  }
258983
- outro("Platform configuration retrieved");
258984
258963
  });
258985
258964
  }
258986
258965
 
@@ -259056,7 +259035,10 @@ function applicationsListCommand() {
259056
259035
  command: "platform list applications -o yaml > applications.yaml"
259057
259036
  }
259058
259037
  ])).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 }) => {
259059
- intro("Listing applications");
259038
+ const printToTerminal = !output || output === "wide";
259039
+ if (printToTerminal) {
259040
+ intro("Listing applications");
259041
+ }
259060
259042
  const env2 = await loadEnv(false, false);
259061
259043
  const selectedInstance = await instancePrompt(env2, true);
259062
259044
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259069,12 +259051,13 @@ function applicationsListCommand() {
259069
259051
  });
259070
259052
  const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
259071
259053
  const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
259054
+ const wide = output === "wide";
259072
259055
  const applicationsData = applications.map((application) => {
259073
259056
  const basicFields = {
259074
259057
  name: application.name,
259075
259058
  uniqueName: application.uniqueName
259076
259059
  };
259077
- if (output) {
259060
+ if (wide || !printToTerminal) {
259078
259061
  return {
259079
259062
  ...basicFields,
259080
259063
  url: getApplicationUrl(selectedInstance, application)
@@ -259082,15 +259065,17 @@ function applicationsListCommand() {
259082
259065
  }
259083
259066
  return basicFields;
259084
259067
  });
259085
- const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259086
- if (output === "json") {
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") {
259087
259072
  jsonOutput(applicationsData);
259088
259073
  } else if (output === "yaml") {
259089
259074
  yamlOutput(applicationsData);
259090
- } else {
259091
- table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259092
259075
  }
259093
- outro("Applications listed");
259076
+ if (printToTerminal) {
259077
+ outro("Applications listed");
259078
+ }
259094
259079
  });
259095
259080
  }
259096
259081
  async function selectWorkspace(settlemint, env2) {
@@ -259104,7 +259089,7 @@ function formatServiceSubType(service, printToTerminal = true) {
259104
259089
  if ("__typename" in service && typeof service.__typename === "string") {
259105
259090
  return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
259106
259091
  }
259107
- return "Unknown";
259092
+ return printToTerminal ? "Unknown" : "Unknown";
259108
259093
  }
259109
259094
 
259110
259095
  // src/commands/platform/utils/formatting/format-health-status.ts
@@ -259135,7 +259120,6 @@ function formatStatus(status, printToTerminal = true) {
259135
259120
  var SERVICE_TYPES = [
259136
259121
  "blockchain-network",
259137
259122
  "blockchain-node",
259138
- "load-balancer",
259139
259123
  "custom-deployment",
259140
259124
  "insights",
259141
259125
  "integration-tool",
@@ -259174,7 +259158,10 @@ function servicesCommand() {
259174
259158
  command: "platform list services --type blockchain-network blockchain-node middleware"
259175
259159
  }
259176
259160
  ])).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 }) => {
259177
- intro("Listing application services");
259161
+ const printToTerminal = !output || output === "wide";
259162
+ if (printToTerminal) {
259163
+ intro("Listing application services");
259164
+ }
259178
259165
  const env2 = await loadEnv(false, false);
259179
259166
  const selectedInstance = await instancePrompt(env2, true);
259180
259167
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259186,7 +259173,6 @@ function servicesCommand() {
259186
259173
  accessToken,
259187
259174
  instance: selectedInstance
259188
259175
  });
259189
- const printToTerminal = !output || output === "wide";
259190
259176
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
259191
259177
  if (!applicationUniqueName) {
259192
259178
  return nothingSelectedError("application");
@@ -259214,14 +259200,16 @@ function servicesCommand() {
259214
259200
  },
259215
259201
  services: servicesToShow
259216
259202
  };
259217
- if (output === "json") {
259203
+ if (printToTerminal) {
259204
+ table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259205
+ } else if (output === "json") {
259218
259206
  jsonOutput(data);
259219
259207
  } else if (output === "yaml") {
259220
259208
  yamlOutput(data);
259221
- } else {
259222
- table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259223
259209
  }
259224
- outro("Application services listed");
259210
+ if (printToTerminal) {
259211
+ outro("Application services listed");
259212
+ }
259225
259213
  });
259226
259214
  }
259227
259215
  async function selectApplication(settlemint, env2) {
@@ -259290,8 +259278,6 @@ function getItemsForServiceType(services, serviceType) {
259290
259278
  return services.blockchainNetworks;
259291
259279
  case "blockchain-node":
259292
259280
  return services.blockchainNodes;
259293
- case "load-balancer":
259294
- return services.loadBalancers;
259295
259281
  default:
259296
259282
  return [];
259297
259283
  }
@@ -260403,10 +260389,7 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
260403
260389
  rootCmd._lastCommand = thisCommand;
260404
260390
  rootCmd._lastCommand._commandPath = commandPath;
260405
260391
  }
260406
- if (isJsonOrYamlOutput(thisCommand)) {
260407
- process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
260408
- }
260409
- if (isLeafCommand(thisCommand)) {
260392
+ if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
260410
260393
  ascii();
260411
260394
  await validateSdkVersionFromCommand(thisCommand);
260412
260395
  }
@@ -260490,4 +260473,4 @@ async function sdkCliCommand(argv = process.argv) {
260490
260473
  // src/cli.ts
260491
260474
  sdkCliCommand();
260492
260475
 
260493
- //# debugId=3B85CBD648A9BF9064756E2164756E21
260476
+ //# debugId=802596FD48A8DC2864756E2164756E21