@settlemint/sdk-cli 2.1.4-pr75b87279 → 2.1.4-pr86a1f4ed
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 +357 -69
- package/dist/cli.js.map +34 -29
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -245085,7 +245085,7 @@ var DotEnvSchema = z.object({
|
|
245085
245085
|
SETTLEMINT_APPLICATION: UniqueNameSchema.optional(),
|
245086
245086
|
SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema.optional(),
|
245087
245087
|
SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema.optional(),
|
245088
|
-
|
245088
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema.optional(),
|
245089
245089
|
SETTLEMINT_HASURA: UniqueNameSchema.optional(),
|
245090
245090
|
SETTLEMINT_HASURA_ENDPOINT: UrlSchema.optional(),
|
245091
245091
|
SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
|
@@ -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-pr86a1f4ed",
|
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-pr86a1f4ed",
|
245331
|
+
"@settlemint/sdk-utils": "2.1.4-pr86a1f4ed",
|
245332
245332
|
"@types/node": "22.14.1",
|
245333
245333
|
"@types/semver": "7.7.0",
|
245334
245334
|
"@types/which": "3.0.4",
|
@@ -246742,7 +246742,7 @@ var DotEnvSchema2 = z.object({
|
|
246742
246742
|
SETTLEMINT_APPLICATION: UniqueNameSchema2.optional(),
|
246743
246743
|
SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema2.optional(),
|
246744
246744
|
SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema2.optional(),
|
246745
|
-
|
246745
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema2.optional(),
|
246746
246746
|
SETTLEMINT_HASURA: UniqueNameSchema2.optional(),
|
246747
246747
|
SETTLEMINT_HASURA_ENDPOINT: UrlSchema2.optional(),
|
246748
246748
|
SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
|
@@ -248059,6 +248059,47 @@ var getLoadBalancer = graphql(`
|
|
248059
248059
|
}
|
248060
248060
|
}
|
248061
248061
|
`, [LoadBalancerFragment]);
|
248062
|
+
var getLoadBalancers = graphql(`
|
248063
|
+
query getLoadBalancers($applicationUniqueName: String!) {
|
248064
|
+
loadBalancersByUniqueName(applicationUniqueName: $applicationUniqueName) {
|
248065
|
+
items {
|
248066
|
+
...LoadBalancer
|
248067
|
+
}
|
248068
|
+
}
|
248069
|
+
}
|
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]);
|
248062
248103
|
var loadBalancerRead = (gqlClient) => {
|
248063
248104
|
return async (loadBalancerUniqueName) => {
|
248064
248105
|
const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, {
|
@@ -248067,6 +248108,37 @@ var loadBalancerRead = (gqlClient) => {
|
|
248067
248108
|
return loadBalancer;
|
248068
248109
|
};
|
248069
248110
|
};
|
248111
|
+
var loadBalancerList = (gqlClient) => {
|
248112
|
+
return async (applicationUniqueName) => {
|
248113
|
+
const {
|
248114
|
+
loadBalancersByUniqueName: { items }
|
248115
|
+
} = await gqlClient.request(getLoadBalancers, { applicationUniqueName });
|
248116
|
+
return items;
|
248117
|
+
};
|
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
|
+
};
|
248070
248142
|
var InsightsFragment = graphql(`
|
248071
248143
|
fragment Insights on Insights {
|
248072
248144
|
__typename
|
@@ -248767,6 +248839,12 @@ function createSettleMintClient(options) {
|
|
248767
248839
|
create: blockchainNodeCreate(gqlClient),
|
248768
248840
|
restart: blockchainNodeRestart(gqlClient)
|
248769
248841
|
},
|
248842
|
+
loadBalancer: {
|
248843
|
+
list: loadBalancerList(gqlClient),
|
248844
|
+
read: loadBalancerRead(gqlClient),
|
248845
|
+
create: loadBalancerCreate(gqlClient),
|
248846
|
+
restart: loadBalancerRestart(gqlClient)
|
248847
|
+
},
|
248770
248848
|
middleware: {
|
248771
248849
|
list: middlewareList(gqlClient),
|
248772
248850
|
read: middlewareRead(gqlClient),
|
@@ -252190,6 +252268,7 @@ async function applicationPrompt(env2, applications, accept) {
|
|
252190
252268
|
}
|
252191
252269
|
|
252192
252270
|
// src/prompts/cluster-service/service.prompt.ts
|
252271
|
+
var ALL2 = "All";
|
252193
252272
|
async function servicePrompt({
|
252194
252273
|
env: env2,
|
252195
252274
|
services,
|
@@ -252198,12 +252277,13 @@ async function servicePrompt({
|
|
252198
252277
|
defaultHandler,
|
252199
252278
|
isRequired = false,
|
252200
252279
|
isCi = is_in_ci_default,
|
252201
|
-
singleOptionMessage
|
252280
|
+
singleOptionMessage,
|
252281
|
+
allowAll = false
|
252202
252282
|
}) {
|
252203
252283
|
if (services.length === 0) {
|
252204
252284
|
return;
|
252205
252285
|
}
|
252206
|
-
const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
|
252286
|
+
const selectedService = services.find((service) => Array.isArray(service) ? false : service.uniqueName === env2[envKey]);
|
252207
252287
|
const autoAccept = isCi || accept;
|
252208
252288
|
if (autoAccept && selectedService) {
|
252209
252289
|
return selectedService;
|
@@ -252212,7 +252292,7 @@ async function servicePrompt({
|
|
252212
252292
|
return;
|
252213
252293
|
}
|
252214
252294
|
if (isRequired && services.length === 1) {
|
252215
|
-
if (singleOptionMessage) {
|
252295
|
+
if (singleOptionMessage && !Array.isArray(services[0])) {
|
252216
252296
|
note(singleOptionMessage(services[0].uniqueName));
|
252217
252297
|
}
|
252218
252298
|
return services[0];
|
@@ -252221,13 +252301,33 @@ async function servicePrompt({
|
|
252221
252301
|
name: `${service.name} (${service.uniqueName})`,
|
252222
252302
|
value: service
|
252223
252303
|
}));
|
252304
|
+
if (allowAll) {
|
252305
|
+
choices.unshift({
|
252306
|
+
name: ALL2,
|
252307
|
+
value: services
|
252308
|
+
});
|
252309
|
+
}
|
252224
252310
|
if (!isRequired) {
|
252225
252311
|
choices.push({
|
252226
252312
|
name: "None",
|
252227
252313
|
value: undefined
|
252228
252314
|
});
|
252229
252315
|
}
|
252230
|
-
return defaultHandler({
|
252316
|
+
return defaultHandler({
|
252317
|
+
defaultService: selectedService,
|
252318
|
+
choices
|
252319
|
+
});
|
252320
|
+
}
|
252321
|
+
|
252322
|
+
// src/utils/cluster-service.ts
|
252323
|
+
function isValidPrivateKey(privateKey) {
|
252324
|
+
return privateKey.privateKeyType !== "HD_ECDSA_P256";
|
252325
|
+
}
|
252326
|
+
function hasValidPrivateKey(service) {
|
252327
|
+
return (service.privateKeys ?? []).some(isValidPrivateKey);
|
252328
|
+
}
|
252329
|
+
function isRunning(service) {
|
252330
|
+
return service === undefined || service?.status === "COMPLETED";
|
252231
252331
|
}
|
252232
252332
|
|
252233
252333
|
// src/prompts/cluster-service/blockchain-node.prompt.ts
|
@@ -252238,7 +252338,8 @@ async function blockchainNodePrompt({
|
|
252238
252338
|
singleOptionMessage,
|
252239
252339
|
promptMessage,
|
252240
252340
|
filterRunningOnly = false,
|
252241
|
-
isRequired = false
|
252341
|
+
isRequired = false,
|
252342
|
+
allowAll = false
|
252242
252343
|
}) {
|
252243
252344
|
return servicePrompt({
|
252244
252345
|
env: env2,
|
@@ -252247,14 +252348,25 @@ async function blockchainNodePrompt({
|
|
252247
252348
|
envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
|
252248
252349
|
isRequired,
|
252249
252350
|
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
252250
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) =>
|
252351
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
|
252352
|
+
return Array.isArray(node) ? true : isRunning(node);
|
252353
|
+
}).map((item) => {
|
252354
|
+
if (Array.isArray(item.value)) {
|
252355
|
+
return {
|
252356
|
+
...item,
|
252357
|
+
value: item.value.filter(isRunning)
|
252358
|
+
};
|
252359
|
+
}
|
252360
|
+
return item;
|
252361
|
+
}) : choices;
|
252251
252362
|
return esm_default3({
|
252252
252363
|
message: promptMessage ?? "Which blockchain node do you want to connect to?",
|
252253
252364
|
choices: filteredChoices,
|
252254
252365
|
default: defaultNode
|
252255
252366
|
});
|
252256
252367
|
},
|
252257
|
-
singleOptionMessage
|
252368
|
+
singleOptionMessage,
|
252369
|
+
allowAll
|
252258
252370
|
});
|
252259
252371
|
}
|
252260
252372
|
|
@@ -252559,7 +252671,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252559
252671
|
storages,
|
252560
252672
|
privateKeys,
|
252561
252673
|
insights,
|
252562
|
-
customDeployments
|
252674
|
+
customDeployments,
|
252675
|
+
loadBalancers
|
252563
252676
|
] = await Promise.all([
|
252564
252677
|
shouldFetch("blockchain-network") ? settlemint.blockchainNetwork.list(applicationUniqueName) : Promise.resolve([]),
|
252565
252678
|
shouldFetch("blockchain-node") ? settlemint.blockchainNode.list(applicationUniqueName) : Promise.resolve([]),
|
@@ -252568,7 +252681,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252568
252681
|
shouldFetch("storage") ? settlemint.storage.list(applicationUniqueName) : Promise.resolve([]),
|
252569
252682
|
shouldFetch("private-key") ? settlemint.privateKey.list(applicationUniqueName) : Promise.resolve([]),
|
252570
252683
|
shouldFetch("insights") ? settlemint.insights.list(applicationUniqueName) : Promise.resolve([]),
|
252571
|
-
shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
|
252684
|
+
shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([]),
|
252685
|
+
shouldFetch("load-balancer") ? settlemint.loadBalancer.list(applicationUniqueName) : Promise.resolve([])
|
252572
252686
|
]);
|
252573
252687
|
return {
|
252574
252688
|
blockchainNetworks,
|
@@ -252578,7 +252692,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252578
252692
|
storages,
|
252579
252693
|
privateKeys,
|
252580
252694
|
insights,
|
252581
|
-
customDeployments
|
252695
|
+
customDeployments,
|
252696
|
+
loadBalancers
|
252582
252697
|
};
|
252583
252698
|
}
|
252584
252699
|
});
|
@@ -252618,7 +252733,7 @@ async function writeEnvSpinner(prod, env2) {
|
|
252618
252733
|
SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
|
252619
252734
|
SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
|
252620
252735
|
SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
|
252621
|
-
|
252736
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER,
|
252622
252737
|
SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
|
252623
252738
|
SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
|
252624
252739
|
SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
|
@@ -252727,6 +252842,35 @@ function getMinioEndpoints(service) {
|
|
252727
252842
|
};
|
252728
252843
|
}
|
252729
252844
|
|
252845
|
+
// src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
|
252846
|
+
async function blockchainNodeOrLoadBalancerPrompt({
|
252847
|
+
env: env2,
|
252848
|
+
nodes,
|
252849
|
+
loadBalancers,
|
252850
|
+
accept,
|
252851
|
+
singleOptionMessage,
|
252852
|
+
promptMessage,
|
252853
|
+
filterRunningOnly = false,
|
252854
|
+
isRequired = false
|
252855
|
+
}) {
|
252856
|
+
return servicePrompt({
|
252857
|
+
env: env2,
|
252858
|
+
services: [...loadBalancers, ...nodes],
|
252859
|
+
accept,
|
252860
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
252861
|
+
isRequired,
|
252862
|
+
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
252863
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
|
252864
|
+
return esm_default3({
|
252865
|
+
message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
|
252866
|
+
choices: filteredChoices,
|
252867
|
+
default: defaultNode
|
252868
|
+
});
|
252869
|
+
},
|
252870
|
+
singleOptionMessage
|
252871
|
+
});
|
252872
|
+
}
|
252873
|
+
|
252730
252874
|
// src/commands/connect.ts
|
252731
252875
|
function connectCommand() {
|
252732
252876
|
return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod, instance }) => {
|
@@ -252746,11 +252890,30 @@ function connectCommand() {
|
|
252746
252890
|
const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
|
252747
252891
|
const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
|
252748
252892
|
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
|
252749
|
-
const {
|
252893
|
+
const {
|
252894
|
+
middlewares,
|
252895
|
+
integrationTools,
|
252896
|
+
storages,
|
252897
|
+
privateKeys,
|
252898
|
+
insights,
|
252899
|
+
customDeployments,
|
252900
|
+
blockchainNodes,
|
252901
|
+
loadBalancers
|
252902
|
+
} = await servicesSpinner(settlemint, application.uniqueName);
|
252903
|
+
const nodesWithPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? Array.isArray(node?.privateKeys) && node?.privateKeys?.length > 0 : false);
|
252750
252904
|
const blockchainNode = await blockchainNodePrompt({
|
252751
252905
|
env: env2,
|
252752
|
-
nodes:
|
252753
|
-
accept: acceptDefaults
|
252906
|
+
nodes: nodesWithPrivateKey,
|
252907
|
+
accept: acceptDefaults,
|
252908
|
+
promptMessage: "Which blockchain node do you want to use for sending transactions?"
|
252909
|
+
});
|
252910
|
+
const nodesWithoutPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? !Array.isArray(node?.privateKeys) || node?.privateKeys?.length === 0 : true);
|
252911
|
+
const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
|
252912
|
+
env: env2,
|
252913
|
+
nodes: nodesWithoutPrivateKey,
|
252914
|
+
loadBalancers,
|
252915
|
+
accept: acceptDefaults,
|
252916
|
+
promptMessage: "Which blockchain node or load balancer do you want to use for read operations?"
|
252754
252917
|
});
|
252755
252918
|
const hasura = await hasuraPrompt({
|
252756
252919
|
env: env2,
|
@@ -252816,10 +252979,15 @@ function connectCommand() {
|
|
252816
252979
|
uniqueName: blockchainNode.blockchainNetwork?.uniqueName
|
252817
252980
|
},
|
252818
252981
|
blockchainNode && {
|
252819
|
-
type: "Blockchain Node",
|
252982
|
+
type: "Blockchain Node (with private key, use for sending transactions)",
|
252820
252983
|
name: blockchainNode.name,
|
252821
252984
|
uniqueName: blockchainNode.uniqueName
|
252822
252985
|
},
|
252986
|
+
loadBalancerOrBlockchainNode && {
|
252987
|
+
type: "Blockchain Node or Load Balancer (without private key, use for read operations)",
|
252988
|
+
name: loadBalancerOrBlockchainNode.name,
|
252989
|
+
uniqueName: loadBalancerOrBlockchainNode.uniqueName
|
252990
|
+
},
|
252823
252991
|
hasura && {
|
252824
252992
|
type: "Hasura",
|
252825
252993
|
name: hasura.name,
|
@@ -252870,6 +253038,7 @@ function connectCommand() {
|
|
252870
253038
|
SETTLEMINT_APPLICATION: application.uniqueName,
|
252871
253039
|
SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
|
252872
253040
|
SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
|
253041
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: loadBalancerOrBlockchainNode?.uniqueName,
|
252873
253042
|
SETTLEMINT_HASURA: hasura?.uniqueName,
|
252874
253043
|
...getHasuraEndpoints(hasura),
|
252875
253044
|
SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
|
@@ -256211,7 +256380,8 @@ var SETTLEMINT_CLIENT_MAP = {
|
|
256211
256380
|
"integration tool": "integrationTool",
|
256212
256381
|
storage: "storage",
|
256213
256382
|
insights: "insights",
|
256214
|
-
"application access token": "applicationAccessToken"
|
256383
|
+
"application access token": "applicationAccessToken",
|
256384
|
+
"load balancer": "loadBalancer"
|
256215
256385
|
};
|
256216
256386
|
var LABELS_MAP = {
|
256217
256387
|
application: { singular: "application", plural: "applications", command: "app" },
|
@@ -256232,7 +256402,8 @@ var LABELS_MAP = {
|
|
256232
256402
|
singular: "application access token",
|
256233
256403
|
plural: "application access tokens",
|
256234
256404
|
command: "application-access-token"
|
256235
|
-
}
|
256405
|
+
},
|
256406
|
+
"load balancer": { singular: "load balancer", plural: "load balancers", command: "load-balancer" }
|
256236
256407
|
};
|
256237
256408
|
|
256238
256409
|
// src/spinners/service.spinner.ts
|
@@ -257322,12 +257493,14 @@ function blockscoutInsightsCreateCommand() {
|
|
257322
257493
|
return missingApplication();
|
257323
257494
|
}
|
257324
257495
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257325
|
-
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.
|
257496
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
|
257326
257497
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257327
257498
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257328
|
-
const
|
257499
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257500
|
+
const node = await blockchainNodeOrLoadBalancerPrompt({
|
257329
257501
|
env: env2,
|
257330
257502
|
nodes: blockchainNodes,
|
257503
|
+
loadBalancers,
|
257331
257504
|
accept: acceptDefaults,
|
257332
257505
|
isRequired: true
|
257333
257506
|
});
|
@@ -257440,6 +257613,104 @@ function integrationToolCreateCommand() {
|
|
257440
257613
|
return cmd2;
|
257441
257614
|
}
|
257442
257615
|
|
257616
|
+
// src/commands/platform/load-balancer/evm/create.ts
|
257617
|
+
function loadBalancerEvmCreateCommand() {
|
257618
|
+
return getCreateCommand({
|
257619
|
+
name: "evm",
|
257620
|
+
type: "load balancer",
|
257621
|
+
subType: "EVM",
|
257622
|
+
alias: "e",
|
257623
|
+
execute: (cmd2, baseAction) => {
|
257624
|
+
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 }) => {
|
257625
|
+
return baseAction({
|
257626
|
+
...defaultArgs,
|
257627
|
+
acceptDefaults,
|
257628
|
+
provider,
|
257629
|
+
region
|
257630
|
+
}, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
|
257631
|
+
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
257632
|
+
if (!applicationUniqueName) {
|
257633
|
+
return missingApplication();
|
257634
|
+
}
|
257635
|
+
let networkUniqueName;
|
257636
|
+
let connectedNodesUniqueNames = blockchainNodes;
|
257637
|
+
if (!connectedNodesUniqueNames) {
|
257638
|
+
const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
|
257639
|
+
const network = await blockchainNetworkPrompt({
|
257640
|
+
env: env2,
|
257641
|
+
networks,
|
257642
|
+
accept: acceptDefaults,
|
257643
|
+
isRequired: true
|
257644
|
+
});
|
257645
|
+
if (!network) {
|
257646
|
+
return nothingSelectedError("blockchain network");
|
257647
|
+
}
|
257648
|
+
const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257649
|
+
const connectedNodes = await blockchainNodePrompt({
|
257650
|
+
env: env2,
|
257651
|
+
nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === networkUniqueName),
|
257652
|
+
accept: acceptDefaults,
|
257653
|
+
promptMessage: "Which blockchain node do you want to connect the load balancer to?",
|
257654
|
+
allowAll: true
|
257655
|
+
});
|
257656
|
+
connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
|
257657
|
+
}
|
257658
|
+
if (!networkUniqueName) {
|
257659
|
+
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257660
|
+
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257661
|
+
if (selectedBlockchainNodes.length === 0) {
|
257662
|
+
return cancel2("blockchain network");
|
257663
|
+
}
|
257664
|
+
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
|
257665
|
+
if (!onTheSameNetwork) {
|
257666
|
+
return cancel2("Blockchain nodes must be on the same network");
|
257667
|
+
}
|
257668
|
+
networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
|
257669
|
+
}
|
257670
|
+
const result = await showSpinner(() => settlemint.loadBalancer.create({
|
257671
|
+
applicationUniqueName,
|
257672
|
+
name: name3,
|
257673
|
+
blockchainNetworkUniqueName: networkUniqueName,
|
257674
|
+
provider: provider2,
|
257675
|
+
region: region2,
|
257676
|
+
size,
|
257677
|
+
type: type4,
|
257678
|
+
connectedNodesUniqueNames
|
257679
|
+
}));
|
257680
|
+
return {
|
257681
|
+
result,
|
257682
|
+
mapDefaultEnv: () => {
|
257683
|
+
return {
|
257684
|
+
SETTLEMINT_APPLICATION: applicationUniqueName,
|
257685
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
|
257686
|
+
};
|
257687
|
+
}
|
257688
|
+
};
|
257689
|
+
});
|
257690
|
+
});
|
257691
|
+
},
|
257692
|
+
examples: [
|
257693
|
+
{
|
257694
|
+
description: "Create an EVM load balancer and save as default",
|
257695
|
+
command: "platform create load-balancer evm my-lb --accept-defaults -d"
|
257696
|
+
},
|
257697
|
+
{
|
257698
|
+
description: "Create an EVM load balancer and connect to specific blockchain nodes",
|
257699
|
+
command: "platform create load-balancer evm my-lb --blockchain-nodes my-node1 my-node2 --accept-defaults"
|
257700
|
+
},
|
257701
|
+
{
|
257702
|
+
description: "Create an EVM load balancer in a different application",
|
257703
|
+
command: "platform create load-balancer evm my-lb --application my-app --accept-defaults"
|
257704
|
+
}
|
257705
|
+
]
|
257706
|
+
});
|
257707
|
+
}
|
257708
|
+
|
257709
|
+
// src/commands/platform/load-balancer/create.ts
|
257710
|
+
function loadBalancerCreateCommand() {
|
257711
|
+
return new Command("load-balancer").alias("lb").description("Create a load balancer in the SettleMint platform").addCommand(loadBalancerEvmCreateCommand());
|
257712
|
+
}
|
257713
|
+
|
257443
257714
|
// src/commands/platform/middleware/graph/create.ts
|
257444
257715
|
function graphMiddlewareCreateCommand() {
|
257445
257716
|
return getCreateCommand({
|
@@ -257448,7 +257719,7 @@ function graphMiddlewareCreateCommand() {
|
|
257448
257719
|
subType: "The Graph",
|
257449
257720
|
alias: "gr",
|
257450
257721
|
execute: (cmd2, baseAction) => {
|
257451
|
-
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name3, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
|
257722
|
+
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").action(async (name3, { application, blockchainNode, loadBalancer, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
|
257452
257723
|
return baseAction({
|
257453
257724
|
...defaultArgs,
|
257454
257725
|
acceptDefaults,
|
@@ -257460,24 +257731,32 @@ function graphMiddlewareCreateCommand() {
|
|
257460
257731
|
return missingApplication();
|
257461
257732
|
}
|
257462
257733
|
let blockchainNodeUniqueName = blockchainNode;
|
257463
|
-
|
257734
|
+
let loadBalancerUniqueName = loadBalancer;
|
257735
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257464
257736
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257465
|
-
const
|
257737
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257738
|
+
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257466
257739
|
env: env2,
|
257467
257740
|
nodes: blockchainNodes,
|
257741
|
+
loadBalancers,
|
257468
257742
|
accept: acceptDefaults,
|
257469
257743
|
isRequired: true
|
257470
257744
|
});
|
257471
|
-
if (!
|
257472
|
-
return nothingSelectedError("blockchain node");
|
257745
|
+
if (!nodeOrLoadbalancer) {
|
257746
|
+
return nothingSelectedError("blockchain node or load balancer");
|
257747
|
+
}
|
257748
|
+
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257749
|
+
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257750
|
+
} else {
|
257751
|
+
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257473
257752
|
}
|
257474
|
-
blockchainNodeUniqueName = node.uniqueName;
|
257475
257753
|
}
|
257476
257754
|
const result = await showSpinner(() => settlemint.middleware.create({
|
257477
257755
|
name: name3,
|
257478
257756
|
applicationUniqueName,
|
257479
257757
|
interface: "HA_GRAPH",
|
257480
257758
|
blockchainNodeUniqueName,
|
257759
|
+
loadBalancerUniqueName,
|
257481
257760
|
provider: provider2,
|
257482
257761
|
region: region2,
|
257483
257762
|
size,
|
@@ -257543,12 +257822,12 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
257543
257822
|
return missingApplication();
|
257544
257823
|
}
|
257545
257824
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257546
|
-
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.
|
257825
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
|
257547
257826
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257548
257827
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257549
257828
|
const node = await blockchainNodePrompt({
|
257550
257829
|
env: env2,
|
257551
|
-
nodes: blockchainNodes,
|
257830
|
+
nodes: blockchainNodes.filter(hasValidPrivateKey),
|
257552
257831
|
accept: acceptDefaults,
|
257553
257832
|
isRequired: true
|
257554
257833
|
});
|
@@ -257926,7 +258205,7 @@ function storageCreateCommand() {
|
|
257926
258205
|
|
257927
258206
|
// src/commands/platform/create.ts
|
257928
258207
|
function createCommand3() {
|
257929
|
-
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());
|
258208
|
+
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());
|
257930
258209
|
}
|
257931
258210
|
|
257932
258211
|
// src/prompts/delete-confirmation.prompt.ts
|
@@ -258166,6 +258445,19 @@ function integrationToolRestartCommand() {
|
|
258166
258445
|
return new Command("integration-tool").alias("it").description("Restart an integration tool service in the SettleMint platform").addCommand(hasuraRestartCommand());
|
258167
258446
|
}
|
258168
258447
|
|
258448
|
+
// src/commands/platform/load-balancer/restart.ts
|
258449
|
+
function loadBalancerRestartCommand() {
|
258450
|
+
return getRestartCommand({
|
258451
|
+
name: "load-balancer",
|
258452
|
+
type: "load balancer",
|
258453
|
+
alias: "lb",
|
258454
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
258455
|
+
restartFunction: async (settlemint, id) => {
|
258456
|
+
return settlemint.loadBalancer.restart(id);
|
258457
|
+
}
|
258458
|
+
});
|
258459
|
+
}
|
258460
|
+
|
258169
258461
|
// src/commands/platform/middleware/graph/restart.ts
|
258170
258462
|
function graphRestartCommand() {
|
258171
258463
|
return getRestartCommand({
|
@@ -258232,7 +258524,7 @@ function storageRestartCommand() {
|
|
258232
258524
|
|
258233
258525
|
// src/commands/platform/restart.ts
|
258234
258526
|
function restartCommand() {
|
258235
|
-
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());
|
258527
|
+
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());
|
258236
258528
|
return cmd2;
|
258237
258529
|
}
|
258238
258530
|
|
@@ -259075,38 +259367,6 @@ function getStatusAction(status) {
|
|
259075
259367
|
return "Please try again later.";
|
259076
259368
|
}
|
259077
259369
|
|
259078
|
-
// src/prompts/smart-contract-set/address.prompt.ts
|
259079
|
-
async function addressPrompt({
|
259080
|
-
env: env2,
|
259081
|
-
accept,
|
259082
|
-
prod,
|
259083
|
-
node,
|
259084
|
-
hardhatConfig
|
259085
|
-
}) {
|
259086
|
-
const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)) ?? [];
|
259087
|
-
const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
|
259088
|
-
const defaultPossible = accept && defaultAddress;
|
259089
|
-
if (defaultPossible) {
|
259090
|
-
if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
|
259091
|
-
return defaultAddress;
|
259092
|
-
}
|
259093
|
-
note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
|
259094
|
-
Please select another key or activate this key on the node and try again.`, "warn");
|
259095
|
-
}
|
259096
|
-
const address = await esm_default3({
|
259097
|
-
message: "Which private key do you want to deploy from?",
|
259098
|
-
choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
|
259099
|
-
name: name3,
|
259100
|
-
value: address2
|
259101
|
-
})),
|
259102
|
-
default: defaultAddress ?? possiblePrivateKeys[0]?.address
|
259103
|
-
});
|
259104
|
-
return address;
|
259105
|
-
}
|
259106
|
-
function validPrivateKey(privateKey) {
|
259107
|
-
return privateKey.privateKeyType !== "HD_ECDSA_P256";
|
259108
|
-
}
|
259109
|
-
|
259110
259370
|
// src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
|
259111
259371
|
async function selectTargetNode({
|
259112
259372
|
env: env2,
|
@@ -259130,6 +259390,7 @@ async function selectTargetNode({
|
|
259130
259390
|
nodes: validNodes,
|
259131
259391
|
accept: autoAccept,
|
259132
259392
|
isRequired: true,
|
259393
|
+
filterRunningOnly: true,
|
259133
259394
|
promptMessage: "Which blockchain node do you want to connect to? (Only nodes with private keys activated are shown)",
|
259134
259395
|
singleOptionMessage: (node2) => `Using '${node2}' - the only node with active private keys. To use a different node, ensure it has a private key activated.`
|
259135
259396
|
});
|
@@ -259151,7 +259412,7 @@ function validateNode(node, cancelOnError = true) {
|
|
259151
259412
|
}
|
259152
259413
|
return false;
|
259153
259414
|
}
|
259154
|
-
if (node
|
259415
|
+
if (!hasValidPrivateKey(node)) {
|
259155
259416
|
if (cancelOnError) {
|
259156
259417
|
cancel2(`The specified blockchain node '${node.uniqueName}' does not have an ECDSA P256 or HSM ECDSA P256 private key activated. Please activate an ECDSA P256 or HSM ECDSA P256 private key on your node and try again.`);
|
259157
259418
|
}
|
@@ -259166,6 +259427,33 @@ function validateNode(node, cancelOnError = true) {
|
|
259166
259427
|
return true;
|
259167
259428
|
}
|
259168
259429
|
|
259430
|
+
// src/prompts/smart-contract-set/address.prompt.ts
|
259431
|
+
async function addressPrompt({
|
259432
|
+
accept,
|
259433
|
+
node,
|
259434
|
+
hardhatConfig
|
259435
|
+
}) {
|
259436
|
+
const possiblePrivateKeys = node.privateKeys?.filter(isValidPrivateKey) ?? [];
|
259437
|
+
const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
|
259438
|
+
const defaultPossible = accept && defaultAddress;
|
259439
|
+
if (defaultPossible) {
|
259440
|
+
if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
|
259441
|
+
return defaultAddress;
|
259442
|
+
}
|
259443
|
+
note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
|
259444
|
+
Please select another key or activate this key on the node and try again.`, "warn");
|
259445
|
+
}
|
259446
|
+
const address = await esm_default3({
|
259447
|
+
message: "Which private key do you want to deploy from?",
|
259448
|
+
choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
|
259449
|
+
name: name3,
|
259450
|
+
value: address2
|
259451
|
+
})),
|
259452
|
+
default: defaultAddress
|
259453
|
+
});
|
259454
|
+
return address;
|
259455
|
+
}
|
259456
|
+
|
259169
259457
|
// src/utils/smart-contract-set/hardhat-config.ts
|
259170
259458
|
async function getHardhatConfigData(envConfig) {
|
259171
259459
|
try {
|
@@ -259255,7 +259543,7 @@ function hardhatDeployRemoteCommand() {
|
|
259255
259543
|
}
|
259256
259544
|
let address = defaultSender ?? null;
|
259257
259545
|
if (!defaultSender) {
|
259258
|
-
address = await addressPrompt({
|
259546
|
+
address = await addressPrompt({ accept: autoAccept, node, hardhatConfig });
|
259259
259547
|
}
|
259260
259548
|
if (!address) {
|
259261
259549
|
return nothingSelectedError("private key");
|
@@ -259901,4 +260189,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
259901
260189
|
// src/cli.ts
|
259902
260190
|
sdkCliCommand();
|
259903
260191
|
|
259904
|
-
//# debugId=
|
260192
|
+
//# debugId=C55F9514E9EDA97B64756E2164756E21
|