@settlemint/sdk-cli 2.1.4-pr75b87279 → 2.1.4-pr9dd5ccc8
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 +367 -70
- package/dist/cli.js.map +35 -30
- 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-pr9dd5ccc8",
|
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-pr9dd5ccc8",
|
245331
|
+
"@settlemint/sdk-utils": "2.1.4-pr9dd5ccc8",
|
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,13 +252277,17 @@ 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;
|
252288
|
+
if (autoAccept && allowAll) {
|
252289
|
+
return services;
|
252290
|
+
}
|
252208
252291
|
if (autoAccept && selectedService) {
|
252209
252292
|
return selectedService;
|
252210
252293
|
}
|
@@ -252212,7 +252295,7 @@ async function servicePrompt({
|
|
252212
252295
|
return;
|
252213
252296
|
}
|
252214
252297
|
if (isRequired && services.length === 1) {
|
252215
|
-
if (singleOptionMessage) {
|
252298
|
+
if (singleOptionMessage && !Array.isArray(services[0])) {
|
252216
252299
|
note(singleOptionMessage(services[0].uniqueName));
|
252217
252300
|
}
|
252218
252301
|
return services[0];
|
@@ -252221,13 +252304,33 @@ async function servicePrompt({
|
|
252221
252304
|
name: `${service.name} (${service.uniqueName})`,
|
252222
252305
|
value: service
|
252223
252306
|
}));
|
252307
|
+
if (allowAll) {
|
252308
|
+
choices.unshift({
|
252309
|
+
name: ALL2,
|
252310
|
+
value: services
|
252311
|
+
});
|
252312
|
+
}
|
252224
252313
|
if (!isRequired) {
|
252225
252314
|
choices.push({
|
252226
252315
|
name: "None",
|
252227
252316
|
value: undefined
|
252228
252317
|
});
|
252229
252318
|
}
|
252230
|
-
return defaultHandler({
|
252319
|
+
return defaultHandler({
|
252320
|
+
defaultService: selectedService,
|
252321
|
+
choices
|
252322
|
+
});
|
252323
|
+
}
|
252324
|
+
|
252325
|
+
// src/utils/cluster-service.ts
|
252326
|
+
function isValidPrivateKey(privateKey) {
|
252327
|
+
return privateKey.privateKeyType !== "HD_ECDSA_P256";
|
252328
|
+
}
|
252329
|
+
function hasValidPrivateKey(service) {
|
252330
|
+
return (service.privateKeys ?? []).some(isValidPrivateKey);
|
252331
|
+
}
|
252332
|
+
function isRunning(service) {
|
252333
|
+
return service === undefined || service?.status === "COMPLETED";
|
252231
252334
|
}
|
252232
252335
|
|
252233
252336
|
// src/prompts/cluster-service/blockchain-node.prompt.ts
|
@@ -252238,7 +252341,8 @@ async function blockchainNodePrompt({
|
|
252238
252341
|
singleOptionMessage,
|
252239
252342
|
promptMessage,
|
252240
252343
|
filterRunningOnly = false,
|
252241
|
-
isRequired = false
|
252344
|
+
isRequired = false,
|
252345
|
+
allowAll = false
|
252242
252346
|
}) {
|
252243
252347
|
return servicePrompt({
|
252244
252348
|
env: env2,
|
@@ -252247,14 +252351,25 @@ async function blockchainNodePrompt({
|
|
252247
252351
|
envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
|
252248
252352
|
isRequired,
|
252249
252353
|
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
252250
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) =>
|
252354
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
|
252355
|
+
return Array.isArray(node) ? true : isRunning(node);
|
252356
|
+
}).map((item) => {
|
252357
|
+
if (Array.isArray(item.value)) {
|
252358
|
+
return {
|
252359
|
+
...item,
|
252360
|
+
value: item.value.filter(isRunning)
|
252361
|
+
};
|
252362
|
+
}
|
252363
|
+
return item;
|
252364
|
+
}) : choices;
|
252251
252365
|
return esm_default3({
|
252252
252366
|
message: promptMessage ?? "Which blockchain node do you want to connect to?",
|
252253
252367
|
choices: filteredChoices,
|
252254
252368
|
default: defaultNode
|
252255
252369
|
});
|
252256
252370
|
},
|
252257
|
-
singleOptionMessage
|
252371
|
+
singleOptionMessage,
|
252372
|
+
allowAll
|
252258
252373
|
});
|
252259
252374
|
}
|
252260
252375
|
|
@@ -252559,7 +252674,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252559
252674
|
storages,
|
252560
252675
|
privateKeys,
|
252561
252676
|
insights,
|
252562
|
-
customDeployments
|
252677
|
+
customDeployments,
|
252678
|
+
loadBalancers
|
252563
252679
|
] = await Promise.all([
|
252564
252680
|
shouldFetch("blockchain-network") ? settlemint.blockchainNetwork.list(applicationUniqueName) : Promise.resolve([]),
|
252565
252681
|
shouldFetch("blockchain-node") ? settlemint.blockchainNode.list(applicationUniqueName) : Promise.resolve([]),
|
@@ -252568,7 +252684,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252568
252684
|
shouldFetch("storage") ? settlemint.storage.list(applicationUniqueName) : Promise.resolve([]),
|
252569
252685
|
shouldFetch("private-key") ? settlemint.privateKey.list(applicationUniqueName) : Promise.resolve([]),
|
252570
252686
|
shouldFetch("insights") ? settlemint.insights.list(applicationUniqueName) : Promise.resolve([]),
|
252571
|
-
shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
|
252687
|
+
shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([]),
|
252688
|
+
shouldFetch("load-balancer") ? settlemint.loadBalancer.list(applicationUniqueName) : Promise.resolve([])
|
252572
252689
|
]);
|
252573
252690
|
return {
|
252574
252691
|
blockchainNetworks,
|
@@ -252578,7 +252695,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252578
252695
|
storages,
|
252579
252696
|
privateKeys,
|
252580
252697
|
insights,
|
252581
|
-
customDeployments
|
252698
|
+
customDeployments,
|
252699
|
+
loadBalancers
|
252582
252700
|
};
|
252583
252701
|
}
|
252584
252702
|
});
|
@@ -252618,7 +252736,7 @@ async function writeEnvSpinner(prod, env2) {
|
|
252618
252736
|
SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
|
252619
252737
|
SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
|
252620
252738
|
SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
|
252621
|
-
|
252739
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER,
|
252622
252740
|
SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
|
252623
252741
|
SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
|
252624
252742
|
SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
|
@@ -252727,6 +252845,35 @@ function getMinioEndpoints(service) {
|
|
252727
252845
|
};
|
252728
252846
|
}
|
252729
252847
|
|
252848
|
+
// src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
|
252849
|
+
async function blockchainNodeOrLoadBalancerPrompt({
|
252850
|
+
env: env2,
|
252851
|
+
nodes,
|
252852
|
+
loadBalancers,
|
252853
|
+
accept,
|
252854
|
+
singleOptionMessage,
|
252855
|
+
promptMessage,
|
252856
|
+
filterRunningOnly = false,
|
252857
|
+
isRequired = false
|
252858
|
+
}) {
|
252859
|
+
return servicePrompt({
|
252860
|
+
env: env2,
|
252861
|
+
services: [...loadBalancers, ...nodes],
|
252862
|
+
accept,
|
252863
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
252864
|
+
isRequired,
|
252865
|
+
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
252866
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
|
252867
|
+
return esm_default3({
|
252868
|
+
message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
|
252869
|
+
choices: filteredChoices,
|
252870
|
+
default: defaultNode
|
252871
|
+
});
|
252872
|
+
},
|
252873
|
+
singleOptionMessage
|
252874
|
+
});
|
252875
|
+
}
|
252876
|
+
|
252730
252877
|
// src/commands/connect.ts
|
252731
252878
|
function connectCommand() {
|
252732
252879
|
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 +252893,30 @@ function connectCommand() {
|
|
252746
252893
|
const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
|
252747
252894
|
const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
|
252748
252895
|
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
|
252749
|
-
const {
|
252896
|
+
const {
|
252897
|
+
middlewares,
|
252898
|
+
integrationTools,
|
252899
|
+
storages,
|
252900
|
+
privateKeys,
|
252901
|
+
insights,
|
252902
|
+
customDeployments,
|
252903
|
+
blockchainNodes,
|
252904
|
+
loadBalancers
|
252905
|
+
} = await servicesSpinner(settlemint, application.uniqueName);
|
252906
|
+
const nodesWithPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? Array.isArray(node?.privateKeys) && node?.privateKeys?.length > 0 : false);
|
252750
252907
|
const blockchainNode = await blockchainNodePrompt({
|
252751
252908
|
env: env2,
|
252752
|
-
nodes:
|
252753
|
-
accept: acceptDefaults
|
252909
|
+
nodes: nodesWithPrivateKey,
|
252910
|
+
accept: acceptDefaults,
|
252911
|
+
promptMessage: "Which blockchain node do you want to use for sending transactions?"
|
252912
|
+
});
|
252913
|
+
const nodesWithoutPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? !Array.isArray(node?.privateKeys) || node?.privateKeys?.length === 0 : true);
|
252914
|
+
const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
|
252915
|
+
env: env2,
|
252916
|
+
nodes: nodesWithoutPrivateKey,
|
252917
|
+
loadBalancers,
|
252918
|
+
accept: acceptDefaults,
|
252919
|
+
promptMessage: "Which blockchain node or load balancer do you want to use for read operations?"
|
252754
252920
|
});
|
252755
252921
|
const hasura = await hasuraPrompt({
|
252756
252922
|
env: env2,
|
@@ -252816,10 +252982,15 @@ function connectCommand() {
|
|
252816
252982
|
uniqueName: blockchainNode.blockchainNetwork?.uniqueName
|
252817
252983
|
},
|
252818
252984
|
blockchainNode && {
|
252819
|
-
type: "Blockchain Node",
|
252985
|
+
type: "Blockchain Node (with private key, use for sending transactions)",
|
252820
252986
|
name: blockchainNode.name,
|
252821
252987
|
uniqueName: blockchainNode.uniqueName
|
252822
252988
|
},
|
252989
|
+
loadBalancerOrBlockchainNode && {
|
252990
|
+
type: "Blockchain Node or Load Balancer (without private key, use for read operations)",
|
252991
|
+
name: loadBalancerOrBlockchainNode.name,
|
252992
|
+
uniqueName: loadBalancerOrBlockchainNode.uniqueName
|
252993
|
+
},
|
252823
252994
|
hasura && {
|
252824
252995
|
type: "Hasura",
|
252825
252996
|
name: hasura.name,
|
@@ -252870,6 +253041,7 @@ function connectCommand() {
|
|
252870
253041
|
SETTLEMINT_APPLICATION: application.uniqueName,
|
252871
253042
|
SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
|
252872
253043
|
SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
|
253044
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: loadBalancerOrBlockchainNode?.uniqueName,
|
252873
253045
|
SETTLEMINT_HASURA: hasura?.uniqueName,
|
252874
253046
|
...getHasuraEndpoints(hasura),
|
252875
253047
|
SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
|
@@ -256211,7 +256383,8 @@ var SETTLEMINT_CLIENT_MAP = {
|
|
256211
256383
|
"integration tool": "integrationTool",
|
256212
256384
|
storage: "storage",
|
256213
256385
|
insights: "insights",
|
256214
|
-
"application access token": "applicationAccessToken"
|
256386
|
+
"application access token": "applicationAccessToken",
|
256387
|
+
"load balancer": "loadBalancer"
|
256215
256388
|
};
|
256216
256389
|
var LABELS_MAP = {
|
256217
256390
|
application: { singular: "application", plural: "applications", command: "app" },
|
@@ -256232,7 +256405,8 @@ var LABELS_MAP = {
|
|
256232
256405
|
singular: "application access token",
|
256233
256406
|
plural: "application access tokens",
|
256234
256407
|
command: "application-access-token"
|
256235
|
-
}
|
256408
|
+
},
|
256409
|
+
"load balancer": { singular: "load balancer", plural: "load balancers", command: "load-balancer" }
|
256236
256410
|
};
|
256237
256411
|
|
256238
256412
|
// src/spinners/service.spinner.ts
|
@@ -256734,7 +256908,10 @@ function getCreateCommand({
|
|
256734
256908
|
usePersonalAccessToken = true,
|
256735
256909
|
requiresDeployment = true
|
256736
256910
|
}) {
|
256737
|
-
const cmd2 = new Command(sanitizeCommandName(name3)).
|
256911
|
+
const cmd2 = new Command(sanitizeCommandName(name3)).description(`Create a new ${subType ? `${subType} ${type4}` : type4} in the SettleMint platform.`).usage(createExamples(examples)).argument("<name>", `The ${subType ? `${subType} ${type4}` : type4} name`).option("-a, --accept-defaults", "Accept the default values").option("-d, --default", `Save as default ${type4}`).option("--prod", "Connect to production environment");
|
256912
|
+
if (alias) {
|
256913
|
+
cmd2.alias(alias);
|
256914
|
+
}
|
256738
256915
|
if (requiresDeployment) {
|
256739
256916
|
cmd2.option("-w, --wait", "Wait until deployed").option("-r, --restart-if-timeout", "Restart if wait time is exceeded");
|
256740
256917
|
}
|
@@ -257322,12 +257499,14 @@ function blockscoutInsightsCreateCommand() {
|
|
257322
257499
|
return missingApplication();
|
257323
257500
|
}
|
257324
257501
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257325
|
-
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.
|
257502
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
|
257326
257503
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257327
257504
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257328
|
-
const
|
257505
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257506
|
+
const node = await blockchainNodeOrLoadBalancerPrompt({
|
257329
257507
|
env: env2,
|
257330
257508
|
nodes: blockchainNodes,
|
257509
|
+
loadBalancers,
|
257331
257510
|
accept: acceptDefaults,
|
257332
257511
|
isRequired: true
|
257333
257512
|
});
|
@@ -257440,6 +257619,107 @@ function integrationToolCreateCommand() {
|
|
257440
257619
|
return cmd2;
|
257441
257620
|
}
|
257442
257621
|
|
257622
|
+
// src/commands/platform/load-balancer/evm/create.ts
|
257623
|
+
function loadBalancerEvmCreateCommand() {
|
257624
|
+
return getCreateCommand({
|
257625
|
+
name: "evm",
|
257626
|
+
type: "load balancer",
|
257627
|
+
subType: "EVM",
|
257628
|
+
execute: (cmd2, baseAction) => {
|
257629
|
+
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 }) => {
|
257630
|
+
return baseAction({
|
257631
|
+
...defaultArgs,
|
257632
|
+
acceptDefaults,
|
257633
|
+
provider,
|
257634
|
+
region
|
257635
|
+
}, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
|
257636
|
+
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
257637
|
+
if (!applicationUniqueName) {
|
257638
|
+
return missingApplication();
|
257639
|
+
}
|
257640
|
+
let networkUniqueName;
|
257641
|
+
let connectedNodesUniqueNames = blockchainNodes;
|
257642
|
+
if (!connectedNodesUniqueNames) {
|
257643
|
+
const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
|
257644
|
+
const network = await blockchainNetworkPrompt({
|
257645
|
+
env: env2,
|
257646
|
+
networks,
|
257647
|
+
accept: acceptDefaults,
|
257648
|
+
isRequired: true
|
257649
|
+
});
|
257650
|
+
if (!network) {
|
257651
|
+
return nothingSelectedError("blockchain network");
|
257652
|
+
}
|
257653
|
+
networkUniqueName = network.uniqueName;
|
257654
|
+
const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257655
|
+
const connectedNodes = await blockchainNodePrompt({
|
257656
|
+
env: env2,
|
257657
|
+
nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
|
257658
|
+
accept: acceptDefaults,
|
257659
|
+
promptMessage: "Which blockchain node do you want to connect the load balancer to?",
|
257660
|
+
allowAll: true
|
257661
|
+
});
|
257662
|
+
connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
|
257663
|
+
}
|
257664
|
+
if (connectedNodesUniqueNames.length === 0) {
|
257665
|
+
return cancel2("A load balancer must connect to at least one blockchain node");
|
257666
|
+
}
|
257667
|
+
if (!networkUniqueName) {
|
257668
|
+
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257669
|
+
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257670
|
+
if (selectedBlockchainNodes.length === 0) {
|
257671
|
+
return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
|
257672
|
+
}
|
257673
|
+
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
|
257674
|
+
if (!onTheSameNetwork) {
|
257675
|
+
return cancel2("Blockchain nodes must be on the same network");
|
257676
|
+
}
|
257677
|
+
networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
|
257678
|
+
}
|
257679
|
+
const result = await showSpinner(() => settlemint.loadBalancer.create({
|
257680
|
+
applicationUniqueName,
|
257681
|
+
name: name3,
|
257682
|
+
blockchainNetworkUniqueName: networkUniqueName,
|
257683
|
+
provider: provider2,
|
257684
|
+
region: region2,
|
257685
|
+
size,
|
257686
|
+
type: type4,
|
257687
|
+
connectedNodesUniqueNames
|
257688
|
+
}));
|
257689
|
+
return {
|
257690
|
+
result,
|
257691
|
+
mapDefaultEnv: () => {
|
257692
|
+
return {
|
257693
|
+
SETTLEMINT_APPLICATION: applicationUniqueName,
|
257694
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
|
257695
|
+
};
|
257696
|
+
}
|
257697
|
+
};
|
257698
|
+
});
|
257699
|
+
});
|
257700
|
+
},
|
257701
|
+
examples: [
|
257702
|
+
{
|
257703
|
+
description: "Create an EVM load balancer and save as default",
|
257704
|
+
command: "platform create load-balancer evm my-lb --accept-defaults -d"
|
257705
|
+
},
|
257706
|
+
{
|
257707
|
+
description: "Create an EVM load balancer and connect to specific blockchain nodes",
|
257708
|
+
command: "platform create load-balancer evm my-lb --blockchain-network my-network --accept-defaults"
|
257709
|
+
},
|
257710
|
+
{
|
257711
|
+
description: "Create an EVM load balancer in a different application",
|
257712
|
+
command: "platform create load-balancer evm my-lb --application my-app --accept-defaults"
|
257713
|
+
}
|
257714
|
+
]
|
257715
|
+
});
|
257716
|
+
}
|
257717
|
+
|
257718
|
+
// src/commands/platform/load-balancer/create.ts
|
257719
|
+
function loadBalancerCreateCommand() {
|
257720
|
+
return new Command("load-balancer").alias("lb").description("Create a load balancer in the SettleMint platform").addCommand(loadBalancerEvmCreateCommand());
|
257721
|
+
}
|
257722
|
+
|
257443
257723
|
// src/commands/platform/middleware/graph/create.ts
|
257444
257724
|
function graphMiddlewareCreateCommand() {
|
257445
257725
|
return getCreateCommand({
|
@@ -257448,7 +257728,7 @@ function graphMiddlewareCreateCommand() {
|
|
257448
257728
|
subType: "The Graph",
|
257449
257729
|
alias: "gr",
|
257450
257730
|
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 }) => {
|
257731
|
+
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
257732
|
return baseAction({
|
257453
257733
|
...defaultArgs,
|
257454
257734
|
acceptDefaults,
|
@@ -257460,24 +257740,32 @@ function graphMiddlewareCreateCommand() {
|
|
257460
257740
|
return missingApplication();
|
257461
257741
|
}
|
257462
257742
|
let blockchainNodeUniqueName = blockchainNode;
|
257463
|
-
|
257743
|
+
let loadBalancerUniqueName = loadBalancer;
|
257744
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257464
257745
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257465
|
-
const
|
257746
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257747
|
+
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257466
257748
|
env: env2,
|
257467
257749
|
nodes: blockchainNodes,
|
257750
|
+
loadBalancers,
|
257468
257751
|
accept: acceptDefaults,
|
257469
257752
|
isRequired: true
|
257470
257753
|
});
|
257471
|
-
if (!
|
257472
|
-
return nothingSelectedError("blockchain node");
|
257754
|
+
if (!nodeOrLoadbalancer) {
|
257755
|
+
return nothingSelectedError("blockchain node or load balancer");
|
257756
|
+
}
|
257757
|
+
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257758
|
+
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257759
|
+
} else {
|
257760
|
+
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257473
257761
|
}
|
257474
|
-
blockchainNodeUniqueName = node.uniqueName;
|
257475
257762
|
}
|
257476
257763
|
const result = await showSpinner(() => settlemint.middleware.create({
|
257477
257764
|
name: name3,
|
257478
257765
|
applicationUniqueName,
|
257479
257766
|
interface: "HA_GRAPH",
|
257480
257767
|
blockchainNodeUniqueName,
|
257768
|
+
loadBalancerUniqueName,
|
257481
257769
|
provider: provider2,
|
257482
257770
|
region: region2,
|
257483
257771
|
size,
|
@@ -257543,12 +257831,12 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
257543
257831
|
return missingApplication();
|
257544
257832
|
}
|
257545
257833
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257546
|
-
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.
|
257834
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
|
257547
257835
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257548
257836
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257549
257837
|
const node = await blockchainNodePrompt({
|
257550
257838
|
env: env2,
|
257551
|
-
nodes: blockchainNodes,
|
257839
|
+
nodes: blockchainNodes.filter(hasValidPrivateKey),
|
257552
257840
|
accept: acceptDefaults,
|
257553
257841
|
isRequired: true
|
257554
257842
|
});
|
@@ -257926,7 +258214,7 @@ function storageCreateCommand() {
|
|
257926
258214
|
|
257927
258215
|
// src/commands/platform/create.ts
|
257928
258216
|
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());
|
258217
|
+
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
258218
|
}
|
257931
258219
|
|
257932
258220
|
// src/prompts/delete-confirmation.prompt.ts
|
@@ -258166,6 +258454,19 @@ function integrationToolRestartCommand() {
|
|
258166
258454
|
return new Command("integration-tool").alias("it").description("Restart an integration tool service in the SettleMint platform").addCommand(hasuraRestartCommand());
|
258167
258455
|
}
|
258168
258456
|
|
258457
|
+
// src/commands/platform/load-balancer/restart.ts
|
258458
|
+
function loadBalancerRestartCommand() {
|
258459
|
+
return getRestartCommand({
|
258460
|
+
name: "load-balancer",
|
258461
|
+
type: "load balancer",
|
258462
|
+
alias: "lb",
|
258463
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
258464
|
+
restartFunction: async (settlemint, id) => {
|
258465
|
+
return settlemint.loadBalancer.restart(id);
|
258466
|
+
}
|
258467
|
+
});
|
258468
|
+
}
|
258469
|
+
|
258169
258470
|
// src/commands/platform/middleware/graph/restart.ts
|
258170
258471
|
function graphRestartCommand() {
|
258171
258472
|
return getRestartCommand({
|
@@ -258232,7 +258533,7 @@ function storageRestartCommand() {
|
|
258232
258533
|
|
258233
258534
|
// src/commands/platform/restart.ts
|
258234
258535
|
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());
|
258536
|
+
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
258537
|
return cmd2;
|
258237
258538
|
}
|
258238
258539
|
|
@@ -259075,38 +259376,6 @@ function getStatusAction(status) {
|
|
259075
259376
|
return "Please try again later.";
|
259076
259377
|
}
|
259077
259378
|
|
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
259379
|
// src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
|
259111
259380
|
async function selectTargetNode({
|
259112
259381
|
env: env2,
|
@@ -259130,6 +259399,7 @@ async function selectTargetNode({
|
|
259130
259399
|
nodes: validNodes,
|
259131
259400
|
accept: autoAccept,
|
259132
259401
|
isRequired: true,
|
259402
|
+
filterRunningOnly: true,
|
259133
259403
|
promptMessage: "Which blockchain node do you want to connect to? (Only nodes with private keys activated are shown)",
|
259134
259404
|
singleOptionMessage: (node2) => `Using '${node2}' - the only node with active private keys. To use a different node, ensure it has a private key activated.`
|
259135
259405
|
});
|
@@ -259151,7 +259421,7 @@ function validateNode(node, cancelOnError = true) {
|
|
259151
259421
|
}
|
259152
259422
|
return false;
|
259153
259423
|
}
|
259154
|
-
if (node
|
259424
|
+
if (!hasValidPrivateKey(node)) {
|
259155
259425
|
if (cancelOnError) {
|
259156
259426
|
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
259427
|
}
|
@@ -259166,6 +259436,33 @@ function validateNode(node, cancelOnError = true) {
|
|
259166
259436
|
return true;
|
259167
259437
|
}
|
259168
259438
|
|
259439
|
+
// src/prompts/smart-contract-set/address.prompt.ts
|
259440
|
+
async function addressPrompt({
|
259441
|
+
accept,
|
259442
|
+
node,
|
259443
|
+
hardhatConfig
|
259444
|
+
}) {
|
259445
|
+
const possiblePrivateKeys = node.privateKeys?.filter(isValidPrivateKey) ?? [];
|
259446
|
+
const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
|
259447
|
+
const defaultPossible = accept && defaultAddress;
|
259448
|
+
if (defaultPossible) {
|
259449
|
+
if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
|
259450
|
+
return defaultAddress;
|
259451
|
+
}
|
259452
|
+
note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
|
259453
|
+
Please select another key or activate this key on the node and try again.`, "warn");
|
259454
|
+
}
|
259455
|
+
const address = await esm_default3({
|
259456
|
+
message: "Which private key do you want to deploy from?",
|
259457
|
+
choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
|
259458
|
+
name: name3,
|
259459
|
+
value: address2
|
259460
|
+
})),
|
259461
|
+
default: defaultAddress
|
259462
|
+
});
|
259463
|
+
return address;
|
259464
|
+
}
|
259465
|
+
|
259169
259466
|
// src/utils/smart-contract-set/hardhat-config.ts
|
259170
259467
|
async function getHardhatConfigData(envConfig) {
|
259171
259468
|
try {
|
@@ -259255,7 +259552,7 @@ function hardhatDeployRemoteCommand() {
|
|
259255
259552
|
}
|
259256
259553
|
let address = defaultSender ?? null;
|
259257
259554
|
if (!defaultSender) {
|
259258
|
-
address = await addressPrompt({
|
259555
|
+
address = await addressPrompt({ accept: autoAccept, node, hardhatConfig });
|
259259
259556
|
}
|
259260
259557
|
if (!address) {
|
259261
259558
|
return nothingSelectedError("private key");
|
@@ -259901,4 +260198,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
259901
260198
|
// src/cli.ts
|
259902
260199
|
sdkCliCommand();
|
259903
260200
|
|
259904
|
-
//# debugId=
|
260201
|
+
//# debugId=E041458A71857F8B64756E2164756E21
|