@settlemint/sdk-cli 2.1.4-pr69e964c7 → 2.1.4-pr6bd6160a

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-pr69e964c7",
245343
+ version: "2.1.4-pr6bd6160a",
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-pr69e964c7",
245393
- "@settlemint/sdk-utils": "2.1.4-pr69e964c7",
245394
- "@types/node": "22.14.1",
245391
+ "@inquirer/select": "4.2.0",
245392
+ "@settlemint/sdk-js": "2.1.4-pr6bd6160a",
245393
+ "@settlemint/sdk-utils": "2.1.4-pr6bd6160a",
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,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
  };
@@ -246612,17 +246604,11 @@ async function executeCommand(command, args, options) {
246612
246604
  });
246613
246605
  }
246614
246606
  var intro = (msg) => {
246615
- if (!shouldPrint()) {
246616
- return;
246617
- }
246618
246607
  console.log("");
246619
246608
  console.log(magentaBright(maskTokens2(msg)));
246620
246609
  console.log("");
246621
246610
  };
246622
246611
  var note = (message, level = "info") => {
246623
- if (!shouldPrint()) {
246624
- return;
246625
- }
246626
246612
  const maskedMessage = maskTokens2(message);
246627
246613
  console.log("");
246628
246614
  if (level === "warn") {
@@ -246647,9 +246633,6 @@ function list(title, items) {
246647
246633
  ${formatItems(items)}`);
246648
246634
  }
246649
246635
  var outro = (msg) => {
246650
- if (!shouldPrint()) {
246651
- return;
246652
- }
246653
246636
  console.log("");
246654
246637
  console.log(inverse(greenBright(maskTokens2(msg))));
246655
246638
  console.log("");
@@ -246669,7 +246652,7 @@ var spinner = async (options) => {
246669
246652
  ${error.stack}`));
246670
246653
  throw new SpinnerError(errorMessage, error);
246671
246654
  };
246672
- if (is_in_ci_default || !shouldPrint()) {
246655
+ if (is_in_ci_default) {
246673
246656
  try {
246674
246657
  return await options.task();
246675
246658
  } catch (err) {
@@ -246697,9 +246680,6 @@ function camelCaseToWords(s) {
246697
246680
  return capitalized.replace(/\s+/g, " ").trim();
246698
246681
  }
246699
246682
  function table(title, data) {
246700
- if (!shouldPrint()) {
246701
- return;
246702
- }
246703
246683
  note(title);
246704
246684
  if (!data || data.length === 0) {
246705
246685
  note("No data to display");
@@ -250058,16 +250038,10 @@ async function getPackageManagerExecutable(targetDir) {
250058
250038
  }
250059
250039
  return { command: "npx", args: [] };
250060
250040
  }
250061
- function shouldPrint2() {
250062
- return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
250063
- }
250064
250041
  var maskTokens3 = (output) => {
250065
250042
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
250066
250043
  };
250067
250044
  var note2 = (message, level = "info") => {
250068
- if (!shouldPrint2()) {
250069
- return;
250070
- }
250071
250045
  const maskedMessage = maskTokens3(message);
250072
250046
  console.log("");
250073
250047
  if (level === "warn") {
@@ -251839,9 +251813,9 @@ var esm_default3 = createPrompt((config3, done) => {
251839
251813
  firstRender.current = false;
251840
251814
  if (items.length > pageSize) {
251841
251815
  helpTipBottom = `
251842
- ${theme.style.help("(Use arrow keys to reveal more choices)")}`;
251816
+ ${theme.style.help(`(${config3.instructions?.pager ?? "Use arrow keys to reveal more choices"})`)}`;
251843
251817
  } else {
251844
- helpTipTop = theme.style.help("(Use arrow keys)");
251818
+ helpTipTop = theme.style.help(`(${config3.instructions?.navigation ?? "Use arrow keys"})`);
251845
251819
  }
251846
251820
  }
251847
251821
  const page = usePagination({
@@ -258979,7 +258953,10 @@ function yamlOutput(data) {
258979
258953
  // src/commands/platform/config.ts
258980
258954
  function configCommand() {
258981
258955
  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 }) => {
258982
- intro("Getting platform configuration");
258956
+ const printToTerminal = !output;
258957
+ if (printToTerminal) {
258958
+ intro("Getting platform configuration");
258959
+ }
258983
258960
  const env2 = await loadEnv(false, !!prod);
258984
258961
  const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
258985
258962
  const settlemint = createSettleMintClient({
@@ -259009,17 +258986,19 @@ function configCommand() {
259009
258986
  }))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
259010
258987
  preDeployedContracts: platformConfig.preDeployedContracts.sort()
259011
258988
  };
259012
- if (output === "json") {
259013
- jsonOutput(platformConfigData);
259014
- } else if (output === "yaml") {
259015
- yamlOutput(platformConfigData);
259016
- } else {
258989
+ if (printToTerminal) {
259017
258990
  table("Templates (Kits)", platformConfigData.kits);
259018
258991
  table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
259019
258992
  table("Providers and regions", platformConfigData.deploymentEngineTargets);
259020
258993
  list("Pre-deployed abis (Smart Contract Portal)", platformConfigData.preDeployedContracts);
258994
+ } else if (output === "json") {
258995
+ jsonOutput(platformConfigData);
258996
+ } else if (output === "yaml") {
258997
+ yamlOutput(platformConfigData);
258998
+ }
258999
+ if (printToTerminal) {
259000
+ outro("Platform configuration retrieved");
259021
259001
  }
259022
- outro("Platform configuration retrieved");
259023
259002
  });
259024
259003
  }
259025
259004
 
@@ -259066,9 +259045,6 @@ function getUrlPathForService(service, serviceType) {
259066
259045
  if (serviceType === "insights") {
259067
259046
  return `insights/${encodeURIComponent(service.id)}/details`;
259068
259047
  }
259069
- if (serviceType === "load-balancer") {
259070
- return `loadbalancers/${encodeURIComponent(service.id)}/details`;
259071
- }
259072
259048
  return "";
259073
259049
  }
259074
259050
  function getWorkspaceUrlPath(workspace) {
@@ -259098,7 +259074,10 @@ function applicationsListCommand() {
259098
259074
  command: "platform list applications -o yaml > applications.yaml"
259099
259075
  }
259100
259076
  ])).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 }) => {
259101
- intro("Listing applications");
259077
+ const printToTerminal = !output || output === "wide";
259078
+ if (printToTerminal) {
259079
+ intro("Listing applications");
259080
+ }
259102
259081
  const env2 = await loadEnv(false, false);
259103
259082
  const selectedInstance = await instancePrompt(env2, true);
259104
259083
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259111,12 +259090,13 @@ function applicationsListCommand() {
259111
259090
  });
259112
259091
  const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
259113
259092
  const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
259093
+ const wide = output === "wide";
259114
259094
  const applicationsData = applications.map((application) => {
259115
259095
  const basicFields = {
259116
259096
  name: application.name,
259117
259097
  uniqueName: application.uniqueName
259118
259098
  };
259119
- if (output) {
259099
+ if (wide || !printToTerminal) {
259120
259100
  return {
259121
259101
  ...basicFields,
259122
259102
  url: getApplicationUrl(selectedInstance, application)
@@ -259124,15 +259104,17 @@ function applicationsListCommand() {
259124
259104
  }
259125
259105
  return basicFields;
259126
259106
  });
259127
- const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259128
- if (output === "json") {
259107
+ if (printToTerminal) {
259108
+ const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
259109
+ table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259110
+ } else if (output === "json") {
259129
259111
  jsonOutput(applicationsData);
259130
259112
  } else if (output === "yaml") {
259131
259113
  yamlOutput(applicationsData);
259132
- } else {
259133
- table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
259134
259114
  }
259135
- outro("Applications listed");
259115
+ if (printToTerminal) {
259116
+ outro("Applications listed");
259117
+ }
259136
259118
  });
259137
259119
  }
259138
259120
  async function selectWorkspace(settlemint, env2) {
@@ -259146,7 +259128,7 @@ function formatServiceSubType(service, printToTerminal = true) {
259146
259128
  if ("__typename" in service && typeof service.__typename === "string") {
259147
259129
  return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
259148
259130
  }
259149
- return "Unknown";
259131
+ return printToTerminal ? "Unknown" : "Unknown";
259150
259132
  }
259151
259133
 
259152
259134
  // src/commands/platform/utils/formatting/format-health-status.ts
@@ -259177,7 +259159,6 @@ function formatStatus(status, printToTerminal = true) {
259177
259159
  var SERVICE_TYPES = [
259178
259160
  "blockchain-network",
259179
259161
  "blockchain-node",
259180
- "load-balancer",
259181
259162
  "custom-deployment",
259182
259163
  "insights",
259183
259164
  "integration-tool",
@@ -259216,7 +259197,10 @@ function servicesCommand() {
259216
259197
  command: "platform list services --type blockchain-network blockchain-node middleware"
259217
259198
  }
259218
259199
  ])).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 }) => {
259219
- intro("Listing application services");
259200
+ const printToTerminal = !output || output === "wide";
259201
+ if (printToTerminal) {
259202
+ intro("Listing application services");
259203
+ }
259220
259204
  const env2 = await loadEnv(false, false);
259221
259205
  const selectedInstance = await instancePrompt(env2, true);
259222
259206
  const personalAccessToken = await getInstanceCredentials(selectedInstance);
@@ -259228,7 +259212,6 @@ function servicesCommand() {
259228
259212
  accessToken,
259229
259213
  instance: selectedInstance
259230
259214
  });
259231
- const printToTerminal = !output || output === "wide";
259232
259215
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
259233
259216
  if (!applicationUniqueName) {
259234
259217
  return nothingSelectedError("application");
@@ -259256,14 +259239,16 @@ function servicesCommand() {
259256
259239
  },
259257
259240
  services: servicesToShow
259258
259241
  };
259259
- if (output === "json") {
259242
+ if (printToTerminal) {
259243
+ table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259244
+ } else if (output === "json") {
259260
259245
  jsonOutput(data);
259261
259246
  } else if (output === "yaml") {
259262
259247
  yamlOutput(data);
259263
- } else {
259264
- table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
259265
259248
  }
259266
- outro("Application services listed");
259249
+ if (printToTerminal) {
259250
+ outro("Application services listed");
259251
+ }
259267
259252
  });
259268
259253
  }
259269
259254
  async function selectApplication(settlemint, env2) {
@@ -260451,10 +260436,7 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
260451
260436
  rootCmd._lastCommand = thisCommand;
260452
260437
  rootCmd._lastCommand._commandPath = commandPath;
260453
260438
  }
260454
- if (isJsonOrYamlOutput(thisCommand)) {
260455
- process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
260456
- }
260457
- if (isLeafCommand(thisCommand)) {
260439
+ if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
260458
260440
  ascii();
260459
260441
  await validateSdkVersionFromCommand(thisCommand);
260460
260442
  }
@@ -260538,4 +260520,4 @@ async function sdkCliCommand(argv = process.argv) {
260538
260520
  // src/cli.ts
260539
260521
  sdkCliCommand();
260540
260522
 
260541
- //# debugId=7E6A316C5FD8D9E064756E2164756E21
260523
+ //# debugId=4ABBF5E1037EB49C64756E2164756E21