@settlemint/sdk-cli 2.1.4-main7bf5b550 → 2.1.4-main88dfaf91
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 +91 -56
- package/dist/cli.js.map +20 -19
- package/package.json +5 -5
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-main88dfaf91",
|
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.
|
245392
|
-
"@settlemint/sdk-js": "2.1.4-
|
245393
|
-
"@settlemint/sdk-utils": "2.1.4-
|
245394
|
-
"@types/node": "22.
|
245391
|
+
"@inquirer/select": "4.2.0",
|
245392
|
+
"@settlemint/sdk-js": "2.1.4-main88dfaf91",
|
245393
|
+
"@settlemint/sdk-utils": "2.1.4-main88dfaf91",
|
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,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");
|
@@ -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") {
|
@@ -251604,6 +251630,9 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
|
|
251604
251630
|
};
|
251605
251631
|
}
|
251606
251632
|
|
251633
|
+
// src/constants/default-subgraph.ts
|
251634
|
+
var DEFAULT_SUBGRAPH_NAME = "kit";
|
251635
|
+
|
251607
251636
|
// src/utils/subgraph/sanitize-name.ts
|
251608
251637
|
var import_slugify = __toESM(require_slugify(), 1);
|
251609
251638
|
function sanitizeName(value4, length = 35) {
|
@@ -251813,9 +251842,9 @@ var esm_default3 = createPrompt((config3, done) => {
|
|
251813
251842
|
firstRender.current = false;
|
251814
251843
|
if (items.length > pageSize) {
|
251815
251844
|
helpTipBottom = `
|
251816
|
-
${theme.style.help("
|
251845
|
+
${theme.style.help(`(${config3.instructions?.pager ?? "Use arrow keys to reveal more choices"})`)}`;
|
251817
251846
|
} else {
|
251818
|
-
helpTipTop = theme.style.help("
|
251847
|
+
helpTipTop = theme.style.help(`(${config3.instructions?.navigation ?? "Use arrow keys"})`);
|
251819
251848
|
}
|
251820
251849
|
}
|
251821
251850
|
const page = usePagination({
|
@@ -251869,8 +251898,8 @@ async function subgraphPrompt({
|
|
251869
251898
|
if (subgraphNames.length === 1) {
|
251870
251899
|
return subgraphNames;
|
251871
251900
|
}
|
251872
|
-
if (subgraphNames.includes(
|
251873
|
-
return [
|
251901
|
+
if (subgraphNames.includes(DEFAULT_SUBGRAPH_NAME)) {
|
251902
|
+
return [DEFAULT_SUBGRAPH_NAME];
|
251874
251903
|
}
|
251875
251904
|
return [];
|
251876
251905
|
}
|
@@ -253065,8 +253094,10 @@ async function getGraphEndpoint(settlemint, service, graphName) {
|
|
253065
253094
|
})
|
253066
253095
|
});
|
253067
253096
|
const endpoints = theGraphMiddleware.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue);
|
253097
|
+
const hasKitSubgraph = endpoints.map((endpoint) => endpoint.split("/").pop()).some((endpoint) => endpoint === DEFAULT_SUBGRAPH_NAME);
|
253068
253098
|
return {
|
253069
|
-
SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: endpoints
|
253099
|
+
SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: endpoints,
|
253100
|
+
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: hasKitSubgraph ? DEFAULT_SUBGRAPH_NAME : undefined
|
253070
253101
|
};
|
253071
253102
|
}
|
253072
253103
|
function getIpfsEndpoints(service) {
|
@@ -253223,7 +253254,7 @@ function connectCommand() {
|
|
253223
253254
|
env: { ...env2, ...graphEndpoints },
|
253224
253255
|
accept: acceptDefaults,
|
253225
253256
|
message: "Which The Graph subgraph do you want to use as the default?"
|
253226
|
-
}) : [];
|
253257
|
+
}) : [graphEndpoints.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
|
253227
253258
|
const portal = await portalPrompt({
|
253228
253259
|
env: env2,
|
253229
253260
|
middlewares,
|
@@ -257247,13 +257278,16 @@ function getCreateCommand({
|
|
257247
257278
|
region: selectedRegion?.id ?? ""
|
257248
257279
|
});
|
257249
257280
|
if (wait) {
|
257250
|
-
await waitForCompletion({
|
257281
|
+
const isDeployed = await waitForCompletion({
|
257251
257282
|
settlemint,
|
257252
257283
|
type: waitFor?.resourceType ?? type4,
|
257253
257284
|
uniqueName: waitFor?.uniqueName ?? result.uniqueName,
|
257254
257285
|
action: "deploy",
|
257255
257286
|
restartIfTimeout
|
257256
257287
|
});
|
257288
|
+
if (!isDeployed) {
|
257289
|
+
throw new Error(`Failed to deploy ${waitFor?.resourceType ?? type4} ${waitFor?.uniqueName ?? result.uniqueName}`);
|
257290
|
+
}
|
257257
257291
|
if (waitFor) {
|
257258
257292
|
outro(`${capitalizeFirstLetter2(waitFor.resourceType)} ${waitFor.name} created successfully`);
|
257259
257293
|
}
|
@@ -258697,7 +258731,15 @@ function getRestartCommand({
|
|
258697
258731
|
stopMessage: `${capitalizeFirstLetter2(type4)} restart initiated`
|
258698
258732
|
});
|
258699
258733
|
if (wait) {
|
258700
|
-
await waitForCompletion({
|
258734
|
+
const isRestarted = await waitForCompletion({
|
258735
|
+
settlemint,
|
258736
|
+
type: type4,
|
258737
|
+
uniqueName: serviceUniqueName,
|
258738
|
+
action: "restart"
|
258739
|
+
});
|
258740
|
+
if (!isRestarted) {
|
258741
|
+
throw new Error(`Failed to restart ${type4} ${uniqueName}`);
|
258742
|
+
}
|
258701
258743
|
}
|
258702
258744
|
outro(`${capitalizeFirstLetter2(type4)} ${result.name} restart initiated successfully`);
|
258703
258745
|
});
|
@@ -258953,10 +258995,7 @@ function yamlOutput(data) {
|
|
258953
258995
|
// src/commands/platform/config.ts
|
258954
258996
|
function configCommand() {
|
258955
258997
|
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 }) => {
|
258956
|
-
|
258957
|
-
if (printToTerminal) {
|
258958
|
-
intro("Getting platform configuration");
|
258959
|
-
}
|
258998
|
+
intro("Getting platform configuration");
|
258960
258999
|
const env2 = await loadEnv(false, !!prod);
|
258961
259000
|
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
|
258962
259001
|
const settlemint = createSettleMintClient({
|
@@ -258986,19 +259025,17 @@ function configCommand() {
|
|
258986
259025
|
}))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
|
258987
259026
|
preDeployedContracts: platformConfig.preDeployedContracts.sort()
|
258988
259027
|
};
|
258989
|
-
if (
|
259028
|
+
if (output === "json") {
|
259029
|
+
jsonOutput(platformConfigData);
|
259030
|
+
} else if (output === "yaml") {
|
259031
|
+
yamlOutput(platformConfigData);
|
259032
|
+
} else {
|
258990
259033
|
table("Templates (Kits)", platformConfigData.kits);
|
258991
259034
|
table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
|
258992
259035
|
table("Providers and regions", platformConfigData.deploymentEngineTargets);
|
258993
259036
|
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");
|
259001
259037
|
}
|
259038
|
+
outro("Platform configuration retrieved");
|
259002
259039
|
});
|
259003
259040
|
}
|
259004
259041
|
|
@@ -259045,6 +259082,9 @@ function getUrlPathForService(service, serviceType) {
|
|
259045
259082
|
if (serviceType === "insights") {
|
259046
259083
|
return `insights/${encodeURIComponent(service.id)}/details`;
|
259047
259084
|
}
|
259085
|
+
if (serviceType === "load-balancer") {
|
259086
|
+
return `loadbalancers/${encodeURIComponent(service.id)}/details`;
|
259087
|
+
}
|
259048
259088
|
return "";
|
259049
259089
|
}
|
259050
259090
|
function getWorkspaceUrlPath(workspace) {
|
@@ -259074,10 +259114,7 @@ function applicationsListCommand() {
|
|
259074
259114
|
command: "platform list applications -o yaml > applications.yaml"
|
259075
259115
|
}
|
259076
259116
|
])).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 }) => {
|
259077
|
-
|
259078
|
-
if (printToTerminal) {
|
259079
|
-
intro("Listing applications");
|
259080
|
-
}
|
259117
|
+
intro("Listing applications");
|
259081
259118
|
const env2 = await loadEnv(false, false);
|
259082
259119
|
const selectedInstance = await instancePrompt(env2, true);
|
259083
259120
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
@@ -259090,13 +259127,12 @@ function applicationsListCommand() {
|
|
259090
259127
|
});
|
259091
259128
|
const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
|
259092
259129
|
const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
|
259093
|
-
const wide = output === "wide";
|
259094
259130
|
const applicationsData = applications.map((application) => {
|
259095
259131
|
const basicFields = {
|
259096
259132
|
name: application.name,
|
259097
259133
|
uniqueName: application.uniqueName
|
259098
259134
|
};
|
259099
|
-
if (
|
259135
|
+
if (output) {
|
259100
259136
|
return {
|
259101
259137
|
...basicFields,
|
259102
259138
|
url: getApplicationUrl(selectedInstance, application)
|
@@ -259104,17 +259140,15 @@ function applicationsListCommand() {
|
|
259104
259140
|
}
|
259105
259141
|
return basicFields;
|
259106
259142
|
});
|
259107
|
-
|
259108
|
-
|
259109
|
-
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
|
259110
|
-
} else if (output === "json") {
|
259143
|
+
const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
|
259144
|
+
if (output === "json") {
|
259111
259145
|
jsonOutput(applicationsData);
|
259112
259146
|
} else if (output === "yaml") {
|
259113
259147
|
yamlOutput(applicationsData);
|
259148
|
+
} else {
|
259149
|
+
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
|
259114
259150
|
}
|
259115
|
-
|
259116
|
-
outro("Applications listed");
|
259117
|
-
}
|
259151
|
+
outro("Applications listed");
|
259118
259152
|
});
|
259119
259153
|
}
|
259120
259154
|
async function selectWorkspace(settlemint, env2) {
|
@@ -259128,7 +259162,7 @@ function formatServiceSubType(service, printToTerminal = true) {
|
|
259128
259162
|
if ("__typename" in service && typeof service.__typename === "string") {
|
259129
259163
|
return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
|
259130
259164
|
}
|
259131
|
-
return
|
259165
|
+
return "Unknown";
|
259132
259166
|
}
|
259133
259167
|
|
259134
259168
|
// src/commands/platform/utils/formatting/format-health-status.ts
|
@@ -259159,6 +259193,7 @@ function formatStatus(status, printToTerminal = true) {
|
|
259159
259193
|
var SERVICE_TYPES = [
|
259160
259194
|
"blockchain-network",
|
259161
259195
|
"blockchain-node",
|
259196
|
+
"load-balancer",
|
259162
259197
|
"custom-deployment",
|
259163
259198
|
"insights",
|
259164
259199
|
"integration-tool",
|
@@ -259197,10 +259232,7 @@ function servicesCommand() {
|
|
259197
259232
|
command: "platform list services --type blockchain-network blockchain-node middleware"
|
259198
259233
|
}
|
259199
259234
|
])).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 }) => {
|
259200
|
-
|
259201
|
-
if (printToTerminal) {
|
259202
|
-
intro("Listing application services");
|
259203
|
-
}
|
259235
|
+
intro("Listing application services");
|
259204
259236
|
const env2 = await loadEnv(false, false);
|
259205
259237
|
const selectedInstance = await instancePrompt(env2, true);
|
259206
259238
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
@@ -259212,6 +259244,7 @@ function servicesCommand() {
|
|
259212
259244
|
accessToken,
|
259213
259245
|
instance: selectedInstance
|
259214
259246
|
});
|
259247
|
+
const printToTerminal = !output || output === "wide";
|
259215
259248
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
|
259216
259249
|
if (!applicationUniqueName) {
|
259217
259250
|
return nothingSelectedError("application");
|
@@ -259239,16 +259272,14 @@ function servicesCommand() {
|
|
259239
259272
|
},
|
259240
259273
|
services: servicesToShow
|
259241
259274
|
};
|
259242
|
-
if (
|
259243
|
-
table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
|
259244
|
-
} else if (output === "json") {
|
259275
|
+
if (output === "json") {
|
259245
259276
|
jsonOutput(data);
|
259246
259277
|
} else if (output === "yaml") {
|
259247
259278
|
yamlOutput(data);
|
259279
|
+
} else {
|
259280
|
+
table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
|
259248
259281
|
}
|
259249
|
-
|
259250
|
-
outro("Application services listed");
|
259251
|
-
}
|
259282
|
+
outro("Application services listed");
|
259252
259283
|
});
|
259253
259284
|
}
|
259254
259285
|
async function selectApplication(settlemint, env2) {
|
@@ -260303,7 +260334,8 @@ function subgraphDeployCommand() {
|
|
260303
260334
|
await writeEnvSpinner(!!prod, {
|
260304
260335
|
...env2,
|
260305
260336
|
SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
|
260306
|
-
...graphEndpoints
|
260337
|
+
...graphEndpoints,
|
260338
|
+
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH ?? graphName
|
260307
260339
|
});
|
260308
260340
|
outro(`Subgraph ${graphName} deployed successfully`);
|
260309
260341
|
});
|
@@ -260373,8 +260405,8 @@ function subgraphRemoveCommand() {
|
|
260373
260405
|
await writeEnvSpinner(!!prod, {
|
260374
260406
|
...env2,
|
260375
260407
|
SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
|
260376
|
-
|
260377
|
-
|
260408
|
+
...graphEndpoints,
|
260409
|
+
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH === graphName ? undefined : env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH
|
260378
260410
|
});
|
260379
260411
|
outro(`Subgraph ${graphName} removed successfully`);
|
260380
260412
|
});
|
@@ -260436,7 +260468,10 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
|
|
260436
260468
|
rootCmd._lastCommand = thisCommand;
|
260437
260469
|
rootCmd._lastCommand._commandPath = commandPath;
|
260438
260470
|
}
|
260439
|
-
if (
|
260471
|
+
if (isJsonOrYamlOutput(thisCommand)) {
|
260472
|
+
process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
|
260473
|
+
}
|
260474
|
+
if (isLeafCommand(thisCommand)) {
|
260440
260475
|
ascii();
|
260441
260476
|
await validateSdkVersionFromCommand(thisCommand);
|
260442
260477
|
}
|
@@ -260520,4 +260555,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
260520
260555
|
// src/cli.ts
|
260521
260556
|
sdkCliCommand();
|
260522
260557
|
|
260523
|
-
//# debugId=
|
260558
|
+
//# debugId=10E3F6CDAC5C93AA64756E2164756E21
|