@settlemint/sdk-cli 2.1.4-pr3b65e859 → 2.1.4-pr66a97677
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 +209 -17
- package/dist/cli.js.map +25 -22
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -245278,7 +245278,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
245278
245278
|
var package_default = {
|
245279
245279
|
name: "@settlemint/sdk-cli",
|
245280
245280
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
245281
|
-
version: "2.1.4-
|
245281
|
+
version: "2.1.4-pr66a97677",
|
245282
245282
|
type: "module",
|
245283
245283
|
private: false,
|
245284
245284
|
license: "FSL-1.1-MIT",
|
@@ -245327,8 +245327,8 @@ var package_default = {
|
|
245327
245327
|
"@inquirer/input": "4.1.9",
|
245328
245328
|
"@inquirer/password": "4.0.12",
|
245329
245329
|
"@inquirer/select": "4.1.1",
|
245330
|
-
"@settlemint/sdk-js": "2.1.4-
|
245331
|
-
"@settlemint/sdk-utils": "2.1.4-
|
245330
|
+
"@settlemint/sdk-js": "2.1.4-pr66a97677",
|
245331
|
+
"@settlemint/sdk-utils": "2.1.4-pr66a97677",
|
245332
245332
|
"@types/node": "22.14.1",
|
245333
245333
|
"@types/semver": "7.7.0",
|
245334
245334
|
"@types/which": "3.0.4",
|
@@ -248068,6 +248068,38 @@ var getLoadBalancers = graphql(`
|
|
248068
248068
|
}
|
248069
248069
|
}
|
248070
248070
|
`, [LoadBalancerFragment]);
|
248071
|
+
var createLoadBalancer = graphql(`
|
248072
|
+
mutation createLoadBalancer(
|
248073
|
+
$applicationId: ID!
|
248074
|
+
$blockchainNetworkId: ID!
|
248075
|
+
$name: String!
|
248076
|
+
$provider: String!
|
248077
|
+
$region: String!
|
248078
|
+
$size: ClusterServiceSize
|
248079
|
+
$type: ClusterServiceType
|
248080
|
+
$connectedNodes: [ID!]!
|
248081
|
+
) {
|
248082
|
+
createLoadBalancer(
|
248083
|
+
applicationId: $applicationId
|
248084
|
+
blockchainNetworkId: $blockchainNetworkId
|
248085
|
+
name: $name
|
248086
|
+
provider: $provider
|
248087
|
+
region: $region
|
248088
|
+
size: $size
|
248089
|
+
type: $type
|
248090
|
+
connectedNodes: $connectedNodes
|
248091
|
+
) {
|
248092
|
+
...LoadBalancer
|
248093
|
+
}
|
248094
|
+
}
|
248095
|
+
`, [LoadBalancerFragment]);
|
248096
|
+
var restartLoadBalancer = graphql(`
|
248097
|
+
mutation RestartLoadBalancer($uniqueName: String!) {
|
248098
|
+
restartLoadBalancerByUniqueName(uniqueName: $uniqueName) {
|
248099
|
+
...LoadBalancer
|
248100
|
+
}
|
248101
|
+
}
|
248102
|
+
`, [LoadBalancerFragment]);
|
248071
248103
|
var loadBalancerRead = (gqlClient) => {
|
248072
248104
|
return async (loadBalancerUniqueName) => {
|
248073
248105
|
const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, {
|
@@ -248084,6 +248116,29 @@ var loadBalancerList = (gqlClient) => {
|
|
248084
248116
|
return items;
|
248085
248117
|
};
|
248086
248118
|
};
|
248119
|
+
var loadBalancerCreate = (gqlClient) => {
|
248120
|
+
return async (args) => {
|
248121
|
+
const { applicationUniqueName, blockchainNetworkUniqueName, connectedNodesUniqueNames, ...otherArgs } = args;
|
248122
|
+
const [application, blockchainNetwork, connectedNodes] = await Promise.all([
|
248123
|
+
applicationRead(gqlClient)(applicationUniqueName),
|
248124
|
+
blockchainNetworkRead(gqlClient)(blockchainNetworkUniqueName),
|
248125
|
+
Promise.all(connectedNodesUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName)))
|
248126
|
+
]);
|
248127
|
+
const { createLoadBalancer: loadBalancer } = await gqlClient.request(createLoadBalancer, {
|
248128
|
+
...otherArgs,
|
248129
|
+
applicationId: application.id,
|
248130
|
+
blockchainNetworkId: blockchainNetwork.id,
|
248131
|
+
connectedNodes: connectedNodes.map((node) => node.id)
|
248132
|
+
});
|
248133
|
+
return loadBalancer;
|
248134
|
+
};
|
248135
|
+
};
|
248136
|
+
var loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
|
248137
|
+
const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, {
|
248138
|
+
uniqueName: loadBalancerUniqueName
|
248139
|
+
});
|
248140
|
+
return loadBalancer;
|
248141
|
+
};
|
248087
248142
|
var InsightsFragment = graphql(`
|
248088
248143
|
fragment Insights on Insights {
|
248089
248144
|
__typename
|
@@ -248786,7 +248841,9 @@ function createSettleMintClient(options) {
|
|
248786
248841
|
},
|
248787
248842
|
loadBalancer: {
|
248788
248843
|
list: loadBalancerList(gqlClient),
|
248789
|
-
read: loadBalancerRead(gqlClient)
|
248844
|
+
read: loadBalancerRead(gqlClient),
|
248845
|
+
create: loadBalancerCreate(gqlClient),
|
248846
|
+
restart: loadBalancerRestart(gqlClient)
|
248790
248847
|
},
|
248791
248848
|
middleware: {
|
248792
248849
|
list: middlewareList(gqlClient),
|
@@ -252211,6 +252268,7 @@ async function applicationPrompt(env2, applications, accept) {
|
|
252211
252268
|
}
|
252212
252269
|
|
252213
252270
|
// src/prompts/cluster-service/service.prompt.ts
|
252271
|
+
var ALL2 = "All";
|
252214
252272
|
async function servicePrompt({
|
252215
252273
|
env: env2,
|
252216
252274
|
services,
|
@@ -252219,12 +252277,13 @@ async function servicePrompt({
|
|
252219
252277
|
defaultHandler,
|
252220
252278
|
isRequired = false,
|
252221
252279
|
isCi = is_in_ci_default,
|
252222
|
-
singleOptionMessage
|
252280
|
+
singleOptionMessage,
|
252281
|
+
allowAll = false
|
252223
252282
|
}) {
|
252224
252283
|
if (services.length === 0) {
|
252225
252284
|
return;
|
252226
252285
|
}
|
252227
|
-
const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
|
252286
|
+
const selectedService = services.find((service) => Array.isArray(service) ? false : service.uniqueName === env2[envKey]);
|
252228
252287
|
const autoAccept = isCi || accept;
|
252229
252288
|
if (autoAccept && selectedService) {
|
252230
252289
|
return selectedService;
|
@@ -252233,7 +252292,7 @@ async function servicePrompt({
|
|
252233
252292
|
return;
|
252234
252293
|
}
|
252235
252294
|
if (isRequired && services.length === 1) {
|
252236
|
-
if (singleOptionMessage) {
|
252295
|
+
if (singleOptionMessage && !Array.isArray(services[0])) {
|
252237
252296
|
note(singleOptionMessage(services[0].uniqueName));
|
252238
252297
|
}
|
252239
252298
|
return services[0];
|
@@ -252242,13 +252301,22 @@ async function servicePrompt({
|
|
252242
252301
|
name: `${service.name} (${service.uniqueName})`,
|
252243
252302
|
value: service
|
252244
252303
|
}));
|
252304
|
+
if (allowAll) {
|
252305
|
+
choices.unshift({
|
252306
|
+
name: ALL2,
|
252307
|
+
value: services
|
252308
|
+
});
|
252309
|
+
}
|
252245
252310
|
if (!isRequired) {
|
252246
252311
|
choices.push({
|
252247
252312
|
name: "None",
|
252248
252313
|
value: undefined
|
252249
252314
|
});
|
252250
252315
|
}
|
252251
|
-
return defaultHandler({
|
252316
|
+
return defaultHandler({
|
252317
|
+
defaultService: selectedService,
|
252318
|
+
choices
|
252319
|
+
});
|
252252
252320
|
}
|
252253
252321
|
|
252254
252322
|
// src/prompts/cluster-service/blockchain-node.prompt.ts
|
@@ -252259,7 +252327,8 @@ async function blockchainNodePrompt({
|
|
252259
252327
|
singleOptionMessage,
|
252260
252328
|
promptMessage,
|
252261
252329
|
filterRunningOnly = false,
|
252262
|
-
isRequired = false
|
252330
|
+
isRequired = false,
|
252331
|
+
allowAll = false
|
252263
252332
|
}) {
|
252264
252333
|
return servicePrompt({
|
252265
252334
|
env: env2,
|
@@ -252268,14 +252337,25 @@ async function blockchainNodePrompt({
|
|
252268
252337
|
envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
|
252269
252338
|
isRequired,
|
252270
252339
|
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
252271
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) =>
|
252340
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
|
252341
|
+
return Array.isArray(node) ? true : node === undefined || node?.status === "COMPLETED";
|
252342
|
+
}).map((item) => {
|
252343
|
+
if (Array.isArray(item.value)) {
|
252344
|
+
return {
|
252345
|
+
...item,
|
252346
|
+
value: item.value.filter((n6) => n6 === undefined || n6.status === "COMPLETED")
|
252347
|
+
};
|
252348
|
+
}
|
252349
|
+
return item;
|
252350
|
+
}) : choices;
|
252272
252351
|
return esm_default3({
|
252273
252352
|
message: promptMessage ?? "Which blockchain node do you want to connect to?",
|
252274
252353
|
choices: filteredChoices,
|
252275
252354
|
default: defaultNode
|
252276
252355
|
});
|
252277
252356
|
},
|
252278
|
-
singleOptionMessage
|
252357
|
+
singleOptionMessage,
|
252358
|
+
allowAll
|
252279
252359
|
});
|
252280
252360
|
}
|
252281
252361
|
|
@@ -252809,16 +252889,17 @@ function connectCommand() {
|
|
252809
252889
|
blockchainNodes,
|
252810
252890
|
loadBalancers
|
252811
252891
|
} = await servicesSpinner(settlemint, application.uniqueName);
|
252892
|
+
const nodesWithPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? Array.isArray(node?.privateKeys) && node?.privateKeys?.length > 0 : false);
|
252812
252893
|
const blockchainNode = await blockchainNodePrompt({
|
252813
252894
|
env: env2,
|
252814
|
-
nodes:
|
252895
|
+
nodes: nodesWithPrivateKey,
|
252815
252896
|
accept: acceptDefaults,
|
252816
252897
|
promptMessage: "Which blockchain node do you want to SEND unsigned transactions from?"
|
252817
252898
|
});
|
252818
|
-
const
|
252899
|
+
const nodesWithoutPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? !Array.isArray(node?.privateKeys) || node?.privateKeys?.length === 0 : true);
|
252819
252900
|
const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
|
252820
252901
|
env: env2,
|
252821
|
-
nodes:
|
252902
|
+
nodes: nodesWithoutPrivateKey,
|
252822
252903
|
loadBalancers,
|
252823
252904
|
accept: acceptDefaults,
|
252824
252905
|
promptMessage: "Which blockchain node or load balancer do you want to READ/WRITE from/to? Transactions should be signed before sending to this node or load balancer"
|
@@ -257521,6 +257602,104 @@ function integrationToolCreateCommand() {
|
|
257521
257602
|
return cmd2;
|
257522
257603
|
}
|
257523
257604
|
|
257605
|
+
// src/commands/platform/load-balancer/evm/create.ts
|
257606
|
+
function loadBalancerEvmCreateCommand() {
|
257607
|
+
return getCreateCommand({
|
257608
|
+
name: "evm",
|
257609
|
+
type: "load balancer",
|
257610
|
+
subType: "EVM",
|
257611
|
+
alias: "e",
|
257612
|
+
execute: (cmd2, baseAction) => {
|
257613
|
+
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)").action(async (name3, { application, provider, region, size, type: type4, blockchainNodes, acceptDefaults, ...defaultArgs }) => {
|
257614
|
+
return baseAction({
|
257615
|
+
...defaultArgs,
|
257616
|
+
acceptDefaults,
|
257617
|
+
provider,
|
257618
|
+
region
|
257619
|
+
}, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
|
257620
|
+
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
257621
|
+
if (!applicationUniqueName) {
|
257622
|
+
return missingApplication();
|
257623
|
+
}
|
257624
|
+
let networkUniqueName;
|
257625
|
+
let connectedNodesUniqueNames = blockchainNodes;
|
257626
|
+
if (!connectedNodesUniqueNames) {
|
257627
|
+
const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
|
257628
|
+
const network = await blockchainNetworkPrompt({
|
257629
|
+
env: env2,
|
257630
|
+
networks,
|
257631
|
+
accept: acceptDefaults,
|
257632
|
+
isRequired: true
|
257633
|
+
});
|
257634
|
+
if (!network) {
|
257635
|
+
return nothingSelectedError("blockchain network");
|
257636
|
+
}
|
257637
|
+
const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257638
|
+
const connectedNodes = await blockchainNodePrompt({
|
257639
|
+
env: env2,
|
257640
|
+
nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === networkUniqueName),
|
257641
|
+
accept: acceptDefaults,
|
257642
|
+
promptMessage: "Which blockchain node do you want to connect the load balancer to?",
|
257643
|
+
allowAll: true
|
257644
|
+
});
|
257645
|
+
connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
|
257646
|
+
}
|
257647
|
+
if (!networkUniqueName) {
|
257648
|
+
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257649
|
+
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257650
|
+
if (selectedBlockchainNodes.length === 0) {
|
257651
|
+
return cancel2("blockchain network");
|
257652
|
+
}
|
257653
|
+
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
|
257654
|
+
if (!onTheSameNetwork) {
|
257655
|
+
return cancel2("Blockchain nodes must be on the same network");
|
257656
|
+
}
|
257657
|
+
networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
|
257658
|
+
}
|
257659
|
+
const result = await showSpinner(() => settlemint.loadBalancer.create({
|
257660
|
+
applicationUniqueName,
|
257661
|
+
name: name3,
|
257662
|
+
blockchainNetworkUniqueName: networkUniqueName,
|
257663
|
+
provider: provider2,
|
257664
|
+
region: region2,
|
257665
|
+
size,
|
257666
|
+
type: type4,
|
257667
|
+
connectedNodesUniqueNames
|
257668
|
+
}));
|
257669
|
+
return {
|
257670
|
+
result,
|
257671
|
+
mapDefaultEnv: () => {
|
257672
|
+
return {
|
257673
|
+
SETTLEMINT_APPLICATION: applicationUniqueName,
|
257674
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
|
257675
|
+
};
|
257676
|
+
}
|
257677
|
+
};
|
257678
|
+
});
|
257679
|
+
});
|
257680
|
+
},
|
257681
|
+
examples: [
|
257682
|
+
{
|
257683
|
+
description: "Create an EVM load balancer and save as default",
|
257684
|
+
command: "platform create load-balancer evm my-lb --accept-defaults -d"
|
257685
|
+
},
|
257686
|
+
{
|
257687
|
+
description: "Create an EVM load balancer and connect to specific blockchain nodes",
|
257688
|
+
command: "platform create load-balancer evm my-lb --blockchain-nodes my-node1 my-node2 --accept-defaults"
|
257689
|
+
},
|
257690
|
+
{
|
257691
|
+
description: "Create an EVM load balancer in a different application",
|
257692
|
+
command: "platform create load-balancer evm my-lb --application my-app --accept-defaults"
|
257693
|
+
}
|
257694
|
+
]
|
257695
|
+
});
|
257696
|
+
}
|
257697
|
+
|
257698
|
+
// src/commands/platform/load-balancer/create.ts
|
257699
|
+
function loadBalancerCreateCommand() {
|
257700
|
+
return new Command("load-balancer").alias("lb").description("Create a load balancer in the SettleMint platform").addCommand(loadBalancerEvmCreateCommand());
|
257701
|
+
}
|
257702
|
+
|
257524
257703
|
// src/commands/platform/middleware/graph/create.ts
|
257525
257704
|
function graphMiddlewareCreateCommand() {
|
257526
257705
|
return getCreateCommand({
|
@@ -258021,7 +258200,7 @@ function storageCreateCommand() {
|
|
258021
258200
|
|
258022
258201
|
// src/commands/platform/create.ts
|
258023
258202
|
function createCommand3() {
|
258024
|
-
return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand());
|
258203
|
+
return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand()).addCommand(loadBalancerCreateCommand());
|
258025
258204
|
}
|
258026
258205
|
|
258027
258206
|
// src/prompts/delete-confirmation.prompt.ts
|
@@ -258261,6 +258440,19 @@ function integrationToolRestartCommand() {
|
|
258261
258440
|
return new Command("integration-tool").alias("it").description("Restart an integration tool service in the SettleMint platform").addCommand(hasuraRestartCommand());
|
258262
258441
|
}
|
258263
258442
|
|
258443
|
+
// src/commands/platform/load-balancer/restart.ts
|
258444
|
+
function loadBalancerRestartCommand() {
|
258445
|
+
return getRestartCommand({
|
258446
|
+
name: "load-balancer",
|
258447
|
+
type: "load balancer",
|
258448
|
+
alias: "lb",
|
258449
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
258450
|
+
restartFunction: async (settlemint, id) => {
|
258451
|
+
return settlemint.loadBalancer.restart(id);
|
258452
|
+
}
|
258453
|
+
});
|
258454
|
+
}
|
258455
|
+
|
258264
258456
|
// src/commands/platform/middleware/graph/restart.ts
|
258265
258457
|
function graphRestartCommand() {
|
258266
258458
|
return getRestartCommand({
|
@@ -258327,7 +258519,7 @@ function storageRestartCommand() {
|
|
258327
258519
|
|
258328
258520
|
// src/commands/platform/restart.ts
|
258329
258521
|
function restartCommand() {
|
258330
|
-
const cmd2 = new Command("restart").description("Restart a resource in the SettleMint platform").addCommand(blockchainNetworkRestartCommand()).addCommand(customDeploymentRestartCommand()).addCommand(insightsRestartCommand()).addCommand(integrationToolRestartCommand()).addCommand(middlewareRestartCommand()).addCommand(storageRestartCommand());
|
258522
|
+
const cmd2 = new Command("restart").description("Restart a resource in the SettleMint platform").addCommand(blockchainNetworkRestartCommand()).addCommand(customDeploymentRestartCommand()).addCommand(insightsRestartCommand()).addCommand(integrationToolRestartCommand()).addCommand(middlewareRestartCommand()).addCommand(storageRestartCommand()).addCommand(loadBalancerRestartCommand());
|
258331
258523
|
return cmd2;
|
258332
258524
|
}
|
258333
258525
|
|
@@ -259997,4 +260189,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
259997
260189
|
// src/cli.ts
|
259998
260190
|
sdkCliCommand();
|
259999
260191
|
|
260000
|
-
//# debugId=
|
260192
|
+
//# debugId=D101F2647E41002564756E2164756E21
|