@settlemint/sdk-cli 2.1.4-pr68f9f950 → 2.1.4-pr69e964c7
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 +71 -44
- package/dist/cli.js.map +12 -12
- package/package.json +3 -3
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-
|
245343
|
+
version: "2.1.4-pr69e964c7",
|
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-
|
245393
|
-
"@settlemint/sdk-utils": "2.1.4-
|
245392
|
+
"@settlemint/sdk-js": "2.1.4-pr69e964c7",
|
245393
|
+
"@settlemint/sdk-utils": "2.1.4-pr69e964c7",
|
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
|
-
|
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") {
|
@@ -251865,7 +251892,13 @@ async function subgraphPrompt({
|
|
251865
251892
|
if (env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH) {
|
251866
251893
|
return [env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
|
251867
251894
|
}
|
251868
|
-
|
251895
|
+
if (subgraphNames.length === 1) {
|
251896
|
+
return subgraphNames;
|
251897
|
+
}
|
251898
|
+
if (subgraphNames.includes("kit")) {
|
251899
|
+
return ["kit"];
|
251900
|
+
}
|
251901
|
+
return [];
|
251869
251902
|
}
|
251870
251903
|
if (!allowNew) {
|
251871
251904
|
if (subgraphNames.length === 0) {
|
@@ -258946,10 +258979,7 @@ function yamlOutput(data) {
|
|
258946
258979
|
// src/commands/platform/config.ts
|
258947
258980
|
function configCommand() {
|
258948
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 }) => {
|
258949
|
-
|
258950
|
-
if (printToTerminal) {
|
258951
|
-
intro("Getting platform configuration");
|
258952
|
-
}
|
258982
|
+
intro("Getting platform configuration");
|
258953
258983
|
const env2 = await loadEnv(false, !!prod);
|
258954
258984
|
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
|
258955
258985
|
const settlemint = createSettleMintClient({
|
@@ -258979,19 +259009,17 @@ function configCommand() {
|
|
258979
259009
|
}))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
|
258980
259010
|
preDeployedContracts: platformConfig.preDeployedContracts.sort()
|
258981
259011
|
};
|
258982
|
-
if (
|
259012
|
+
if (output === "json") {
|
259013
|
+
jsonOutput(platformConfigData);
|
259014
|
+
} else if (output === "yaml") {
|
259015
|
+
yamlOutput(platformConfigData);
|
259016
|
+
} else {
|
258983
259017
|
table("Templates (Kits)", platformConfigData.kits);
|
258984
259018
|
table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
|
258985
259019
|
table("Providers and regions", platformConfigData.deploymentEngineTargets);
|
258986
259020
|
list("Pre-deployed abis (Smart Contract Portal)", platformConfigData.preDeployedContracts);
|
258987
|
-
} else if (output === "json") {
|
258988
|
-
jsonOutput(platformConfigData);
|
258989
|
-
} else if (output === "yaml") {
|
258990
|
-
yamlOutput(platformConfigData);
|
258991
|
-
}
|
258992
|
-
if (printToTerminal) {
|
258993
|
-
outro("Platform configuration retrieved");
|
258994
259021
|
}
|
259022
|
+
outro("Platform configuration retrieved");
|
258995
259023
|
});
|
258996
259024
|
}
|
258997
259025
|
|
@@ -259038,6 +259066,9 @@ function getUrlPathForService(service, serviceType) {
|
|
259038
259066
|
if (serviceType === "insights") {
|
259039
259067
|
return `insights/${encodeURIComponent(service.id)}/details`;
|
259040
259068
|
}
|
259069
|
+
if (serviceType === "load-balancer") {
|
259070
|
+
return `loadbalancers/${encodeURIComponent(service.id)}/details`;
|
259071
|
+
}
|
259041
259072
|
return "";
|
259042
259073
|
}
|
259043
259074
|
function getWorkspaceUrlPath(workspace) {
|
@@ -259067,10 +259098,7 @@ function applicationsListCommand() {
|
|
259067
259098
|
command: "platform list applications -o yaml > applications.yaml"
|
259068
259099
|
}
|
259069
259100
|
])).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 }) => {
|
259070
|
-
|
259071
|
-
if (printToTerminal) {
|
259072
|
-
intro("Listing applications");
|
259073
|
-
}
|
259101
|
+
intro("Listing applications");
|
259074
259102
|
const env2 = await loadEnv(false, false);
|
259075
259103
|
const selectedInstance = await instancePrompt(env2, true);
|
259076
259104
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
@@ -259083,13 +259111,12 @@ function applicationsListCommand() {
|
|
259083
259111
|
});
|
259084
259112
|
const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
|
259085
259113
|
const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
|
259086
|
-
const wide = output === "wide";
|
259087
259114
|
const applicationsData = applications.map((application) => {
|
259088
259115
|
const basicFields = {
|
259089
259116
|
name: application.name,
|
259090
259117
|
uniqueName: application.uniqueName
|
259091
259118
|
};
|
259092
|
-
if (
|
259119
|
+
if (output) {
|
259093
259120
|
return {
|
259094
259121
|
...basicFields,
|
259095
259122
|
url: getApplicationUrl(selectedInstance, application)
|
@@ -259097,17 +259124,15 @@ function applicationsListCommand() {
|
|
259097
259124
|
}
|
259098
259125
|
return basicFields;
|
259099
259126
|
});
|
259100
|
-
|
259101
|
-
|
259102
|
-
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
|
259103
|
-
} else if (output === "json") {
|
259127
|
+
const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
|
259128
|
+
if (output === "json") {
|
259104
259129
|
jsonOutput(applicationsData);
|
259105
259130
|
} else if (output === "yaml") {
|
259106
259131
|
yamlOutput(applicationsData);
|
259132
|
+
} else {
|
259133
|
+
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
|
259107
259134
|
}
|
259108
|
-
|
259109
|
-
outro("Applications listed");
|
259110
|
-
}
|
259135
|
+
outro("Applications listed");
|
259111
259136
|
});
|
259112
259137
|
}
|
259113
259138
|
async function selectWorkspace(settlemint, env2) {
|
@@ -259121,7 +259146,7 @@ function formatServiceSubType(service, printToTerminal = true) {
|
|
259121
259146
|
if ("__typename" in service && typeof service.__typename === "string") {
|
259122
259147
|
return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
|
259123
259148
|
}
|
259124
|
-
return
|
259149
|
+
return "Unknown";
|
259125
259150
|
}
|
259126
259151
|
|
259127
259152
|
// src/commands/platform/utils/formatting/format-health-status.ts
|
@@ -259152,6 +259177,7 @@ function formatStatus(status, printToTerminal = true) {
|
|
259152
259177
|
var SERVICE_TYPES = [
|
259153
259178
|
"blockchain-network",
|
259154
259179
|
"blockchain-node",
|
259180
|
+
"load-balancer",
|
259155
259181
|
"custom-deployment",
|
259156
259182
|
"insights",
|
259157
259183
|
"integration-tool",
|
@@ -259190,10 +259216,7 @@ function servicesCommand() {
|
|
259190
259216
|
command: "platform list services --type blockchain-network blockchain-node middleware"
|
259191
259217
|
}
|
259192
259218
|
])).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 }) => {
|
259193
|
-
|
259194
|
-
if (printToTerminal) {
|
259195
|
-
intro("Listing application services");
|
259196
|
-
}
|
259219
|
+
intro("Listing application services");
|
259197
259220
|
const env2 = await loadEnv(false, false);
|
259198
259221
|
const selectedInstance = await instancePrompt(env2, true);
|
259199
259222
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
@@ -259205,6 +259228,7 @@ function servicesCommand() {
|
|
259205
259228
|
accessToken,
|
259206
259229
|
instance: selectedInstance
|
259207
259230
|
});
|
259231
|
+
const printToTerminal = !output || output === "wide";
|
259208
259232
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
|
259209
259233
|
if (!applicationUniqueName) {
|
259210
259234
|
return nothingSelectedError("application");
|
@@ -259232,16 +259256,14 @@ function servicesCommand() {
|
|
259232
259256
|
},
|
259233
259257
|
services: servicesToShow
|
259234
259258
|
};
|
259235
|
-
if (
|
259236
|
-
table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
|
259237
|
-
} else if (output === "json") {
|
259259
|
+
if (output === "json") {
|
259238
259260
|
jsonOutput(data);
|
259239
259261
|
} else if (output === "yaml") {
|
259240
259262
|
yamlOutput(data);
|
259263
|
+
} else {
|
259264
|
+
table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
|
259241
259265
|
}
|
259242
|
-
|
259243
|
-
outro("Application services listed");
|
259244
|
-
}
|
259266
|
+
outro("Application services listed");
|
259245
259267
|
});
|
259246
259268
|
}
|
259247
259269
|
async function selectApplication(settlemint, env2) {
|
@@ -259310,6 +259332,8 @@ function getItemsForServiceType(services, serviceType) {
|
|
259310
259332
|
return services.blockchainNetworks;
|
259311
259333
|
case "blockchain-node":
|
259312
259334
|
return services.blockchainNodes;
|
259335
|
+
case "load-balancer":
|
259336
|
+
return services.loadBalancers;
|
259313
259337
|
default:
|
259314
259338
|
return [];
|
259315
259339
|
}
|
@@ -260427,7 +260451,10 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
|
|
260427
260451
|
rootCmd._lastCommand = thisCommand;
|
260428
260452
|
rootCmd._lastCommand._commandPath = commandPath;
|
260429
260453
|
}
|
260430
|
-
if (
|
260454
|
+
if (isJsonOrYamlOutput(thisCommand)) {
|
260455
|
+
process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
|
260456
|
+
}
|
260457
|
+
if (isLeafCommand(thisCommand)) {
|
260431
260458
|
ascii();
|
260432
260459
|
await validateSdkVersionFromCommand(thisCommand);
|
260433
260460
|
}
|
@@ -260511,4 +260538,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
260511
260538
|
// src/cli.ts
|
260512
260539
|
sdkCliCommand();
|
260513
260540
|
|
260514
|
-
//# debugId=
|
260541
|
+
//# debugId=7E6A316C5FD8D9E064756E2164756E21
|