@settlemint/sdk-cli 2.1.4-prf0b81bca → 2.1.4-prf73197fc
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 +122 -92
- package/dist/cli.js.map +20 -20
- 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-prf73197fc",
|
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-prf73197fc",
|
245393
|
+
"@settlemint/sdk-utils": "2.1.4-prf73197fc",
|
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
|
-
|
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
|
};
|
@@ -246574,6 +246566,13 @@ var cancel2 = (msg) => {
|
|
246574
246566
|
console.log("");
|
246575
246567
|
throw new CancelError2(msg);
|
246576
246568
|
};
|
246569
|
+
var CommandError = class extends Error {
|
246570
|
+
constructor(message, code, output) {
|
246571
|
+
super(message);
|
246572
|
+
this.code = code;
|
246573
|
+
this.output = output;
|
246574
|
+
}
|
246575
|
+
};
|
246577
246576
|
async function executeCommand(command, args, options) {
|
246578
246577
|
const child = spawn(command, args, { env: { ...process.env, ...options?.env } });
|
246579
246578
|
process.stdin.pipe(child.stdin);
|
@@ -246593,29 +246592,23 @@ async function executeCommand(command, args, options) {
|
|
246593
246592
|
}
|
246594
246593
|
output.push(maskedData);
|
246595
246594
|
});
|
246596
|
-
child.on("error", (err) => reject(err));
|
246595
|
+
child.on("error", (err) => reject(new CommandError(err.message, "code" in err && typeof err.code === "number" ? err.code : 1, output)));
|
246597
246596
|
child.on("close", (code) => {
|
246598
246597
|
if (code === 0 || code === null || code === 143) {
|
246599
246598
|
process.stdin.unpipe(child.stdin);
|
246600
246599
|
resolve(output);
|
246601
246600
|
return;
|
246602
246601
|
}
|
246603
|
-
reject(new
|
246602
|
+
reject(new CommandError(`Command "${command}" exited with code ${code}`, code, output));
|
246604
246603
|
});
|
246605
246604
|
});
|
246606
246605
|
}
|
246607
246606
|
var intro = (msg) => {
|
246608
|
-
if (!shouldPrint()) {
|
246609
|
-
return;
|
246610
|
-
}
|
246611
246607
|
console.log("");
|
246612
246608
|
console.log(magentaBright(maskTokens2(msg)));
|
246613
246609
|
console.log("");
|
246614
246610
|
};
|
246615
246611
|
var note = (message, level = "info") => {
|
246616
|
-
if (!shouldPrint()) {
|
246617
|
-
return;
|
246618
|
-
}
|
246619
246612
|
const maskedMessage = maskTokens2(message);
|
246620
246613
|
console.log("");
|
246621
246614
|
if (level === "warn") {
|
@@ -246640,9 +246633,6 @@ function list(title, items) {
|
|
246640
246633
|
${formatItems(items)}`);
|
246641
246634
|
}
|
246642
246635
|
var outro = (msg) => {
|
246643
|
-
if (!shouldPrint()) {
|
246644
|
-
return;
|
246645
|
-
}
|
246646
246636
|
console.log("");
|
246647
246637
|
console.log(inverse(greenBright(maskTokens2(msg))));
|
246648
246638
|
console.log("");
|
@@ -246662,7 +246652,7 @@ var spinner = async (options) => {
|
|
246662
246652
|
${error.stack}`));
|
246663
246653
|
throw new SpinnerError(errorMessage, error);
|
246664
246654
|
};
|
246665
|
-
if (is_in_ci_default
|
246655
|
+
if (is_in_ci_default) {
|
246666
246656
|
try {
|
246667
246657
|
return await options.task();
|
246668
246658
|
} catch (err) {
|
@@ -246690,9 +246680,6 @@ function camelCaseToWords(s) {
|
|
246690
246680
|
return capitalized.replace(/\s+/g, " ").trim();
|
246691
246681
|
}
|
246692
246682
|
function table(title, data) {
|
246693
|
-
if (!shouldPrint()) {
|
246694
|
-
return;
|
246695
|
-
}
|
246696
246683
|
note(title);
|
246697
246684
|
if (!data || data.length === 0) {
|
246698
246685
|
note("No data to display");
|
@@ -248223,6 +248210,7 @@ var getEnv = (gqlClient) => {
|
|
248223
248210
|
};
|
248224
248211
|
var LoadBalancerFragment = graphql(`
|
248225
248212
|
fragment LoadBalancer on LoadBalancer {
|
248213
|
+
__typename
|
248226
248214
|
id
|
248227
248215
|
uniqueName
|
248228
248216
|
name
|
@@ -250050,16 +250038,10 @@ async function getPackageManagerExecutable(targetDir) {
|
|
250050
250038
|
}
|
250051
250039
|
return { command: "npx", args: [] };
|
250052
250040
|
}
|
250053
|
-
function shouldPrint2() {
|
250054
|
-
return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
|
250055
|
-
}
|
250056
250041
|
var maskTokens3 = (output) => {
|
250057
250042
|
return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
|
250058
250043
|
};
|
250059
250044
|
var note2 = (message, level = "info") => {
|
250060
|
-
if (!shouldPrint2()) {
|
250061
|
-
return;
|
250062
|
-
}
|
250063
250045
|
const maskedMessage = maskTokens3(message);
|
250064
250046
|
console.log("");
|
250065
250047
|
if (level === "warn") {
|
@@ -250111,6 +250093,16 @@ function tryParseJson3(value2, defaultValue = null) {
|
|
250111
250093
|
return defaultValue;
|
250112
250094
|
}
|
250113
250095
|
}
|
250096
|
+
function extractJsonObject(value2) {
|
250097
|
+
if (value2.length > 5000) {
|
250098
|
+
throw new Error("Input too long");
|
250099
|
+
}
|
250100
|
+
const result = /\{([\s\S]*)\}/.exec(value2);
|
250101
|
+
if (!result) {
|
250102
|
+
return null;
|
250103
|
+
}
|
250104
|
+
return tryParseJson3(result[0]);
|
250105
|
+
}
|
250114
250106
|
async function retryWhenFailed2(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
|
250115
250107
|
let attempt = 0;
|
250116
250108
|
while (attempt < maxRetries) {
|
@@ -251821,9 +251813,9 @@ var esm_default3 = createPrompt((config3, done) => {
|
|
251821
251813
|
firstRender.current = false;
|
251822
251814
|
if (items.length > pageSize) {
|
251823
251815
|
helpTipBottom = `
|
251824
|
-
${theme.style.help("
|
251816
|
+
${theme.style.help(`(${config3.instructions?.pager ?? "Use arrow keys to reveal more choices"})`)}`;
|
251825
251817
|
} else {
|
251826
|
-
helpTipTop = theme.style.help("
|
251818
|
+
helpTipTop = theme.style.help(`(${config3.instructions?.navigation ?? "Use arrow keys"})`);
|
251827
251819
|
}
|
251828
251820
|
}
|
251829
251821
|
const page = usePagination({
|
@@ -251874,7 +251866,13 @@ async function subgraphPrompt({
|
|
251874
251866
|
if (env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH) {
|
251875
251867
|
return [env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
|
251876
251868
|
}
|
251877
|
-
|
251869
|
+
if (subgraphNames.length === 1) {
|
251870
|
+
return subgraphNames;
|
251871
|
+
}
|
251872
|
+
if (subgraphNames.includes("kit")) {
|
251873
|
+
return ["kit"];
|
251874
|
+
}
|
251875
|
+
return [];
|
251878
251876
|
}
|
251879
251877
|
if (!allowNew) {
|
251880
251878
|
if (subgraphNames.length === 0) {
|
@@ -252059,7 +252057,8 @@ async function codegenBlockscout(env2) {
|
|
252059
252057
|
}
|
252060
252058
|
}
|
252061
252059
|
}
|
252062
|
-
|
252060
|
+
`,
|
252061
|
+
operationName: "IntrospectionQuery"
|
252063
252062
|
})
|
252064
252063
|
});
|
252065
252064
|
await writeFile6(introspectionJsonPath, JSON.stringify(data));
|
@@ -252826,7 +252825,7 @@ async function theGraphPrompt({
|
|
252826
252825
|
envKey: "SETTLEMINT_THEGRAPH",
|
252827
252826
|
isRequired,
|
252828
252827
|
defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
|
252829
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => middleware
|
252828
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => isRunning(middleware)) : choices;
|
252830
252829
|
return esm_default3({
|
252831
252830
|
message: "Which The Graph instance do you want to connect to?",
|
252832
252831
|
choices: filteredChoices,
|
@@ -253154,7 +253153,7 @@ async function blockchainNodeOrLoadBalancerPrompt({
|
|
253154
253153
|
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
253155
253154
|
isRequired,
|
253156
253155
|
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
253157
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node
|
253156
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
|
253158
253157
|
return esm_default3({
|
253159
253158
|
message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
|
253160
253159
|
choices: filteredChoices,
|
@@ -257799,22 +257798,26 @@ function blockscoutInsightsCreateCommand() {
|
|
257799
257798
|
if (!applicationUniqueName) {
|
257800
257799
|
return missingApplication();
|
257801
257800
|
}
|
257802
|
-
let blockchainNodeUniqueName =
|
257803
|
-
|
257801
|
+
let blockchainNodeUniqueName = blockchainNode;
|
257802
|
+
let loadBalancerUniqueName = loadBalancer;
|
257804
257803
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257805
257804
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257806
257805
|
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257807
|
-
const
|
257806
|
+
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257808
257807
|
env: env2,
|
257809
257808
|
nodes: blockchainNodes,
|
257810
257809
|
loadBalancers,
|
257811
257810
|
accept: acceptDefaults,
|
257812
257811
|
isRequired: true
|
257813
257812
|
});
|
257814
|
-
if (!
|
257813
|
+
if (!nodeOrLoadbalancer) {
|
257815
257814
|
return nothingSelectedError("blockchain node");
|
257816
257815
|
}
|
257817
|
-
|
257816
|
+
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257817
|
+
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257818
|
+
} else {
|
257819
|
+
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257820
|
+
}
|
257818
257821
|
}
|
257819
257822
|
const result = await showSpinner(() => settlemint.insights.create({
|
257820
257823
|
name: name3,
|
@@ -257927,7 +257930,17 @@ function loadBalancerEvmCreateCommand() {
|
|
257927
257930
|
type: "load balancer",
|
257928
257931
|
subType: "EVM",
|
257929
257932
|
execute: (cmd2, baseAction) => {
|
257930
|
-
addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").
|
257933
|
+
addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").option("--blockchain-network <blockchainNetwork>", "Blockchain network unique name where the load balancer connects to, can be skipped if the --blockchain-nodes option is used (defaults to network from env)").action(async (name3, {
|
257934
|
+
application,
|
257935
|
+
provider,
|
257936
|
+
region,
|
257937
|
+
size,
|
257938
|
+
type: type4,
|
257939
|
+
blockchainNodes,
|
257940
|
+
blockchainNetwork,
|
257941
|
+
acceptDefaults,
|
257942
|
+
...defaultArgs
|
257943
|
+
}) => {
|
257931
257944
|
return baseAction({
|
257932
257945
|
...defaultArgs,
|
257933
257946
|
acceptDefaults,
|
@@ -257938,11 +257951,12 @@ function loadBalancerEvmCreateCommand() {
|
|
257938
257951
|
if (!applicationUniqueName) {
|
257939
257952
|
return missingApplication();
|
257940
257953
|
}
|
257941
|
-
|
257954
|
+
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257955
|
+
let networkUniqueName = blockchainNetwork;
|
257942
257956
|
let connectedNodesUniqueNames = blockchainNodes;
|
257943
257957
|
if (!connectedNodesUniqueNames) {
|
257944
257958
|
const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
|
257945
|
-
const network = await blockchainNetworkPrompt({
|
257959
|
+
const network = networkUniqueName ? networks.find((network2) => network2.uniqueName === networkUniqueName) : await blockchainNetworkPrompt({
|
257946
257960
|
env: env2,
|
257947
257961
|
networks,
|
257948
257962
|
accept: acceptDefaults,
|
@@ -257952,31 +257966,29 @@ function loadBalancerEvmCreateCommand() {
|
|
257952
257966
|
return nothingSelectedError("blockchain network");
|
257953
257967
|
}
|
257954
257968
|
networkUniqueName = network.uniqueName;
|
257955
|
-
const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257956
257969
|
const connectedNodes = await blockchainNodePrompt({
|
257957
257970
|
env: env2,
|
257958
|
-
nodes:
|
257971
|
+
nodes: applicationBlockchainNodes.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
|
257959
257972
|
accept: acceptDefaults,
|
257960
257973
|
promptMessage: "Which blockchain node do you want to connect the load balancer to?",
|
257961
257974
|
allowAll: true
|
257962
257975
|
});
|
257963
|
-
connectedNodesUniqueNames = Array.isArray(connectedNodes) ?
|
257976
|
+
connectedNodesUniqueNames = Array.isArray(connectedNodes) ? applicationBlockchainNodes.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
|
257964
257977
|
}
|
257965
257978
|
if (connectedNodesUniqueNames.length === 0) {
|
257966
257979
|
return cancel2("A load balancer must connect to at least one blockchain node");
|
257967
257980
|
}
|
257981
|
+
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257982
|
+
if (selectedBlockchainNodes.length === 0) {
|
257983
|
+
return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
|
257984
|
+
}
|
257968
257985
|
if (!networkUniqueName) {
|
257969
|
-
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257970
|
-
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257971
|
-
if (selectedBlockchainNodes.length === 0) {
|
257972
|
-
return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
|
257973
|
-
}
|
257974
|
-
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
|
257975
|
-
if (!onTheSameNetwork) {
|
257976
|
-
return cancel2("Blockchain nodes must be on the same network");
|
257977
|
-
}
|
257978
257986
|
networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
|
257979
257987
|
}
|
257988
|
+
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === networkUniqueName);
|
257989
|
+
if (!onTheSameNetwork) {
|
257990
|
+
return cancel2("Blockchain nodes must be on the same network");
|
257991
|
+
}
|
257980
257992
|
const result = await showSpinner(() => settlemint.loadBalancer.create({
|
257981
257993
|
applicationUniqueName,
|
257982
257994
|
name: name3,
|
@@ -257992,7 +258004,8 @@ function loadBalancerEvmCreateCommand() {
|
|
257992
258004
|
mapDefaultEnv: () => {
|
257993
258005
|
return {
|
257994
258006
|
SETTLEMINT_APPLICATION: applicationUniqueName,
|
257995
|
-
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
|
258007
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName,
|
258008
|
+
...getBlockchainNodeOrLoadBalancerEndpoints(result)
|
257996
258009
|
};
|
257997
258010
|
}
|
257998
258011
|
};
|
@@ -258940,7 +258953,10 @@ function yamlOutput(data) {
|
|
258940
258953
|
// src/commands/platform/config.ts
|
258941
258954
|
function configCommand() {
|
258942
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 }) => {
|
258943
|
-
|
258956
|
+
const printToTerminal = !output;
|
258957
|
+
if (printToTerminal) {
|
258958
|
+
intro("Getting platform configuration");
|
258959
|
+
}
|
258944
258960
|
const env2 = await loadEnv(false, !!prod);
|
258945
258961
|
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
|
258946
258962
|
const settlemint = createSettleMintClient({
|
@@ -258970,17 +258986,19 @@ function configCommand() {
|
|
258970
258986
|
}))).sort((a8, b4) => a8.providerId.localeCompare(b4.providerId) || a8.regionId.localeCompare(b4.regionId)),
|
258971
258987
|
preDeployedContracts: platformConfig.preDeployedContracts.sort()
|
258972
258988
|
};
|
258973
|
-
if (
|
258974
|
-
jsonOutput(platformConfigData);
|
258975
|
-
} else if (output === "yaml") {
|
258976
|
-
yamlOutput(platformConfigData);
|
258977
|
-
} else {
|
258989
|
+
if (printToTerminal) {
|
258978
258990
|
table("Templates (Kits)", platformConfigData.kits);
|
258979
258991
|
table("Use cases (Smart Contract Sets)", platformConfigData.useCases);
|
258980
258992
|
table("Providers and regions", platformConfigData.deploymentEngineTargets);
|
258981
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");
|
258982
259001
|
}
|
258983
|
-
outro("Platform configuration retrieved");
|
258984
259002
|
});
|
258985
259003
|
}
|
258986
259004
|
|
@@ -259056,7 +259074,10 @@ function applicationsListCommand() {
|
|
259056
259074
|
command: "platform list applications -o yaml > applications.yaml"
|
259057
259075
|
}
|
259058
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 }) => {
|
259059
|
-
|
259077
|
+
const printToTerminal = !output || output === "wide";
|
259078
|
+
if (printToTerminal) {
|
259079
|
+
intro("Listing applications");
|
259080
|
+
}
|
259060
259081
|
const env2 = await loadEnv(false, false);
|
259061
259082
|
const selectedInstance = await instancePrompt(env2, true);
|
259062
259083
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
@@ -259069,12 +259090,13 @@ function applicationsListCommand() {
|
|
259069
259090
|
});
|
259070
259091
|
const workspaceUniqueName = workspace ?? env2.SETTLEMINT_WORKSPACE ?? await selectWorkspace(settlemint, env2);
|
259071
259092
|
const applications = await applicationsSpinner(settlemint, workspaceUniqueName);
|
259093
|
+
const wide = output === "wide";
|
259072
259094
|
const applicationsData = applications.map((application) => {
|
259073
259095
|
const basicFields = {
|
259074
259096
|
name: application.name,
|
259075
259097
|
uniqueName: application.uniqueName
|
259076
259098
|
};
|
259077
|
-
if (
|
259099
|
+
if (wide || !printToTerminal) {
|
259078
259100
|
return {
|
259079
259101
|
...basicFields,
|
259080
259102
|
url: getApplicationUrl(selectedInstance, application)
|
@@ -259082,15 +259104,17 @@ function applicationsListCommand() {
|
|
259082
259104
|
}
|
259083
259105
|
return basicFields;
|
259084
259106
|
});
|
259085
|
-
|
259086
|
-
|
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") {
|
259087
259111
|
jsonOutput(applicationsData);
|
259088
259112
|
} else if (output === "yaml") {
|
259089
259113
|
yamlOutput(applicationsData);
|
259090
|
-
} else {
|
259091
|
-
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
|
259092
259114
|
}
|
259093
|
-
|
259115
|
+
if (printToTerminal) {
|
259116
|
+
outro("Applications listed");
|
259117
|
+
}
|
259094
259118
|
});
|
259095
259119
|
}
|
259096
259120
|
async function selectWorkspace(settlemint, env2) {
|
@@ -259104,7 +259128,7 @@ function formatServiceSubType(service, printToTerminal = true) {
|
|
259104
259128
|
if ("__typename" in service && typeof service.__typename === "string") {
|
259105
259129
|
return printToTerminal ? camelCaseToWords2(service.__typename) : service.__typename;
|
259106
259130
|
}
|
259107
|
-
return "Unknown";
|
259131
|
+
return printToTerminal ? "Unknown" : "Unknown";
|
259108
259132
|
}
|
259109
259133
|
|
259110
259134
|
// src/commands/platform/utils/formatting/format-health-status.ts
|
@@ -259135,7 +259159,6 @@ function formatStatus(status, printToTerminal = true) {
|
|
259135
259159
|
var SERVICE_TYPES = [
|
259136
259160
|
"blockchain-network",
|
259137
259161
|
"blockchain-node",
|
259138
|
-
"load-balancer",
|
259139
259162
|
"custom-deployment",
|
259140
259163
|
"insights",
|
259141
259164
|
"integration-tool",
|
@@ -259174,7 +259197,10 @@ function servicesCommand() {
|
|
259174
259197
|
command: "platform list services --type blockchain-network blockchain-node middleware"
|
259175
259198
|
}
|
259176
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 }) => {
|
259177
|
-
|
259200
|
+
const printToTerminal = !output || output === "wide";
|
259201
|
+
if (printToTerminal) {
|
259202
|
+
intro("Listing application services");
|
259203
|
+
}
|
259178
259204
|
const env2 = await loadEnv(false, false);
|
259179
259205
|
const selectedInstance = await instancePrompt(env2, true);
|
259180
259206
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
@@ -259186,7 +259212,6 @@ function servicesCommand() {
|
|
259186
259212
|
accessToken,
|
259187
259213
|
instance: selectedInstance
|
259188
259214
|
});
|
259189
|
-
const printToTerminal = !output || output === "wide";
|
259190
259215
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION ?? (printToTerminal ? await selectApplication(settlemint, env2) : null);
|
259191
259216
|
if (!applicationUniqueName) {
|
259192
259217
|
return nothingSelectedError("application");
|
@@ -259214,14 +259239,16 @@ function servicesCommand() {
|
|
259214
259239
|
},
|
259215
259240
|
services: servicesToShow
|
259216
259241
|
};
|
259217
|
-
if (
|
259242
|
+
if (printToTerminal) {
|
259243
|
+
table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
|
259244
|
+
} else if (output === "json") {
|
259218
259245
|
jsonOutput(data);
|
259219
259246
|
} else if (output === "yaml") {
|
259220
259247
|
yamlOutput(data);
|
259221
|
-
} else {
|
259222
|
-
table(`Services for ${selectedApplication.name} (${applicationUniqueName}) - ${getApplicationUrl(selectedInstance, selectedApplication)}`, servicesToShow);
|
259223
259248
|
}
|
259224
|
-
|
259249
|
+
if (printToTerminal) {
|
259250
|
+
outro("Application services listed");
|
259251
|
+
}
|
259225
259252
|
});
|
259226
259253
|
}
|
259227
259254
|
async function selectApplication(settlemint, env2) {
|
@@ -259756,15 +259783,21 @@ Please select another key or activate this key on the node and try again.`, "war
|
|
259756
259783
|
async function getHardhatConfigData(envConfig) {
|
259757
259784
|
try {
|
259758
259785
|
const { command, args } = await getPackageManagerExecutable();
|
259759
|
-
const output = await executeCommand(command, [
|
259760
|
-
|
259786
|
+
const output = await executeCommand(command, [
|
259787
|
+
...args,
|
259788
|
+
"ts-node",
|
259789
|
+
"-e",
|
259790
|
+
`import hardhat from "hardhat";
|
259791
|
+
console.log(JSON.stringify(hardhat.userConfig));`,
|
259792
|
+
"--transpileOnly"
|
259793
|
+
], {
|
259761
259794
|
env: {
|
259762
259795
|
...process.env,
|
259763
259796
|
...envConfig
|
259764
259797
|
},
|
259765
259798
|
silent: true
|
259766
259799
|
});
|
259767
|
-
const config3 =
|
259800
|
+
const config3 = extractJsonObject(output.join(" "));
|
259768
259801
|
if (isHardhatConfig(config3)) {
|
259769
259802
|
return config3;
|
259770
259803
|
}
|
@@ -260403,10 +260436,7 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
|
|
260403
260436
|
rootCmd._lastCommand = thisCommand;
|
260404
260437
|
rootCmd._lastCommand._commandPath = commandPath;
|
260405
260438
|
}
|
260406
|
-
if (isJsonOrYamlOutput(thisCommand)) {
|
260407
|
-
process.env.SETTLEMINT_DISABLE_TERMINAL = "true";
|
260408
|
-
}
|
260409
|
-
if (isLeafCommand(thisCommand)) {
|
260439
|
+
if (isLeafCommand(thisCommand) && !isJsonOrYamlOutput(thisCommand)) {
|
260410
260440
|
ascii();
|
260411
260441
|
await validateSdkVersionFromCommand(thisCommand);
|
260412
260442
|
}
|
@@ -260490,4 +260520,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
260490
260520
|
// src/cli.ts
|
260491
260521
|
sdkCliCommand();
|
260492
260522
|
|
260493
|
-
//# debugId=
|
260523
|
+
//# debugId=BABC6551FCC6934764756E2164756E21
|