@settlemint/sdk-cli 2.1.4-pr2c3c56a2 → 2.1.4-pr3684fc8b
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 +365 -71
- 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-pr3684fc8b",
|
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-pr3684fc8b",
|
245331
|
+
"@settlemint/sdk-utils": "2.1.4-pr3684fc8b",
|
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
|
-
default: defaultNode
|
252365
|
+
default: allowAll ? nodes : 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
|
@@ -256734,7 +256905,10 @@ function getCreateCommand({
|
|
256734
256905
|
usePersonalAccessToken = true,
|
256735
256906
|
requiresDeployment = true
|
256736
256907
|
}) {
|
256737
|
-
const cmd2 = new Command(sanitizeCommandName(name3)).
|
256908
|
+
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");
|
256909
|
+
if (alias) {
|
256910
|
+
cmd2.alias(alias);
|
256911
|
+
}
|
256738
256912
|
if (requiresDeployment) {
|
256739
256913
|
cmd2.option("-w, --wait", "Wait until deployed").option("-r, --restart-if-timeout", "Restart if wait time is exceeded");
|
256740
256914
|
}
|
@@ -257322,12 +257496,14 @@ function blockscoutInsightsCreateCommand() {
|
|
257322
257496
|
return missingApplication();
|
257323
257497
|
}
|
257324
257498
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257325
|
-
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.
|
257499
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
|
257326
257500
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257327
257501
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257328
|
-
const
|
257502
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257503
|
+
const node = await blockchainNodeOrLoadBalancerPrompt({
|
257329
257504
|
env: env2,
|
257330
257505
|
nodes: blockchainNodes,
|
257506
|
+
loadBalancers,
|
257331
257507
|
accept: acceptDefaults,
|
257332
257508
|
isRequired: true
|
257333
257509
|
});
|
@@ -257440,6 +257616,107 @@ function integrationToolCreateCommand() {
|
|
257440
257616
|
return cmd2;
|
257441
257617
|
}
|
257442
257618
|
|
257619
|
+
// src/commands/platform/load-balancer/evm/create.ts
|
257620
|
+
function loadBalancerEvmCreateCommand() {
|
257621
|
+
return getCreateCommand({
|
257622
|
+
name: "evm",
|
257623
|
+
type: "load balancer",
|
257624
|
+
subType: "EVM",
|
257625
|
+
execute: (cmd2, baseAction) => {
|
257626
|
+
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 }) => {
|
257627
|
+
return baseAction({
|
257628
|
+
...defaultArgs,
|
257629
|
+
acceptDefaults,
|
257630
|
+
provider,
|
257631
|
+
region
|
257632
|
+
}, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
|
257633
|
+
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
257634
|
+
if (!applicationUniqueName) {
|
257635
|
+
return missingApplication();
|
257636
|
+
}
|
257637
|
+
let networkUniqueName;
|
257638
|
+
let connectedNodesUniqueNames = blockchainNodes;
|
257639
|
+
if (!connectedNodesUniqueNames) {
|
257640
|
+
const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
|
257641
|
+
const network = await blockchainNetworkPrompt({
|
257642
|
+
env: env2,
|
257643
|
+
networks,
|
257644
|
+
accept: acceptDefaults,
|
257645
|
+
isRequired: true
|
257646
|
+
});
|
257647
|
+
if (!network) {
|
257648
|
+
return nothingSelectedError("blockchain network");
|
257649
|
+
}
|
257650
|
+
networkUniqueName = network.uniqueName;
|
257651
|
+
const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257652
|
+
const connectedNodes = await blockchainNodePrompt({
|
257653
|
+
env: env2,
|
257654
|
+
nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
|
257655
|
+
accept: acceptDefaults,
|
257656
|
+
promptMessage: "Which blockchain node do you want to connect the load balancer to?",
|
257657
|
+
allowAll: true
|
257658
|
+
});
|
257659
|
+
connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
|
257660
|
+
}
|
257661
|
+
if (connectedNodesUniqueNames.length === 0) {
|
257662
|
+
return cancel2("A load balancer must connect to at least one blockchain node");
|
257663
|
+
}
|
257664
|
+
if (!networkUniqueName) {
|
257665
|
+
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257666
|
+
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257667
|
+
if (selectedBlockchainNodes.length === 0) {
|
257668
|
+
return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
|
257669
|
+
}
|
257670
|
+
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
|
257671
|
+
if (!onTheSameNetwork) {
|
257672
|
+
return cancel2("Blockchain nodes must be on the same network");
|
257673
|
+
}
|
257674
|
+
networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
|
257675
|
+
}
|
257676
|
+
const result = await showSpinner(() => settlemint.loadBalancer.create({
|
257677
|
+
applicationUniqueName,
|
257678
|
+
name: name3,
|
257679
|
+
blockchainNetworkUniqueName: networkUniqueName,
|
257680
|
+
provider: provider2,
|
257681
|
+
region: region2,
|
257682
|
+
size,
|
257683
|
+
type: type4,
|
257684
|
+
connectedNodesUniqueNames
|
257685
|
+
}));
|
257686
|
+
return {
|
257687
|
+
result,
|
257688
|
+
mapDefaultEnv: () => {
|
257689
|
+
return {
|
257690
|
+
SETTLEMINT_APPLICATION: applicationUniqueName,
|
257691
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
|
257692
|
+
};
|
257693
|
+
}
|
257694
|
+
};
|
257695
|
+
});
|
257696
|
+
});
|
257697
|
+
},
|
257698
|
+
examples: [
|
257699
|
+
{
|
257700
|
+
description: "Create an EVM load balancer and save as default",
|
257701
|
+
command: "platform create load-balancer evm my-lb --accept-defaults -d"
|
257702
|
+
},
|
257703
|
+
{
|
257704
|
+
description: "Create an EVM load balancer and connect to specific blockchain nodes",
|
257705
|
+
command: "platform create load-balancer evm my-lb --blockchain-network my-network --accept-defaults"
|
257706
|
+
},
|
257707
|
+
{
|
257708
|
+
description: "Create an EVM load balancer in a different application",
|
257709
|
+
command: "platform create load-balancer evm my-lb --application my-app --accept-defaults"
|
257710
|
+
}
|
257711
|
+
]
|
257712
|
+
});
|
257713
|
+
}
|
257714
|
+
|
257715
|
+
// src/commands/platform/load-balancer/create.ts
|
257716
|
+
function loadBalancerCreateCommand() {
|
257717
|
+
return new Command("load-balancer").alias("lb").description("Create a load balancer in the SettleMint platform").addCommand(loadBalancerEvmCreateCommand());
|
257718
|
+
}
|
257719
|
+
|
257443
257720
|
// src/commands/platform/middleware/graph/create.ts
|
257444
257721
|
function graphMiddlewareCreateCommand() {
|
257445
257722
|
return getCreateCommand({
|
@@ -257448,7 +257725,7 @@ function graphMiddlewareCreateCommand() {
|
|
257448
257725
|
subType: "The Graph",
|
257449
257726
|
alias: "gr",
|
257450
257727
|
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 }) => {
|
257728
|
+
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
257729
|
return baseAction({
|
257453
257730
|
...defaultArgs,
|
257454
257731
|
acceptDefaults,
|
@@ -257460,24 +257737,32 @@ function graphMiddlewareCreateCommand() {
|
|
257460
257737
|
return missingApplication();
|
257461
257738
|
}
|
257462
257739
|
let blockchainNodeUniqueName = blockchainNode;
|
257463
|
-
|
257740
|
+
let loadBalancerUniqueName = loadBalancer;
|
257741
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257464
257742
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257465
|
-
const
|
257743
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257744
|
+
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257466
257745
|
env: env2,
|
257467
257746
|
nodes: blockchainNodes,
|
257747
|
+
loadBalancers,
|
257468
257748
|
accept: acceptDefaults,
|
257469
257749
|
isRequired: true
|
257470
257750
|
});
|
257471
|
-
if (!
|
257472
|
-
return nothingSelectedError("blockchain node");
|
257751
|
+
if (!nodeOrLoadbalancer) {
|
257752
|
+
return nothingSelectedError("blockchain node or load balancer");
|
257753
|
+
}
|
257754
|
+
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257755
|
+
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257756
|
+
} else {
|
257757
|
+
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257473
257758
|
}
|
257474
|
-
blockchainNodeUniqueName = node.uniqueName;
|
257475
257759
|
}
|
257476
257760
|
const result = await showSpinner(() => settlemint.middleware.create({
|
257477
257761
|
name: name3,
|
257478
257762
|
applicationUniqueName,
|
257479
257763
|
interface: "HA_GRAPH",
|
257480
257764
|
blockchainNodeUniqueName,
|
257765
|
+
loadBalancerUniqueName,
|
257481
257766
|
provider: provider2,
|
257482
257767
|
region: region2,
|
257483
257768
|
size,
|
@@ -257543,12 +257828,12 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
257543
257828
|
return missingApplication();
|
257544
257829
|
}
|
257545
257830
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257546
|
-
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.
|
257831
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
|
257547
257832
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257548
257833
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257549
257834
|
const node = await blockchainNodePrompt({
|
257550
257835
|
env: env2,
|
257551
|
-
nodes: blockchainNodes,
|
257836
|
+
nodes: blockchainNodes.filter(hasValidPrivateKey),
|
257552
257837
|
accept: acceptDefaults,
|
257553
257838
|
isRequired: true
|
257554
257839
|
});
|
@@ -257926,7 +258211,7 @@ function storageCreateCommand() {
|
|
257926
258211
|
|
257927
258212
|
// src/commands/platform/create.ts
|
257928
258213
|
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());
|
258214
|
+
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
258215
|
}
|
257931
258216
|
|
257932
258217
|
// src/prompts/delete-confirmation.prompt.ts
|
@@ -258166,6 +258451,19 @@ function integrationToolRestartCommand() {
|
|
258166
258451
|
return new Command("integration-tool").alias("it").description("Restart an integration tool service in the SettleMint platform").addCommand(hasuraRestartCommand());
|
258167
258452
|
}
|
258168
258453
|
|
258454
|
+
// src/commands/platform/load-balancer/restart.ts
|
258455
|
+
function loadBalancerRestartCommand() {
|
258456
|
+
return getRestartCommand({
|
258457
|
+
name: "load-balancer",
|
258458
|
+
type: "load balancer",
|
258459
|
+
alias: "lb",
|
258460
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
258461
|
+
restartFunction: async (settlemint, id) => {
|
258462
|
+
return settlemint.loadBalancer.restart(id);
|
258463
|
+
}
|
258464
|
+
});
|
258465
|
+
}
|
258466
|
+
|
258169
258467
|
// src/commands/platform/middleware/graph/restart.ts
|
258170
258468
|
function graphRestartCommand() {
|
258171
258469
|
return getRestartCommand({
|
@@ -258232,7 +258530,7 @@ function storageRestartCommand() {
|
|
258232
258530
|
|
258233
258531
|
// src/commands/platform/restart.ts
|
258234
258532
|
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());
|
258533
|
+
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
258534
|
return cmd2;
|
258237
258535
|
}
|
258238
258536
|
|
@@ -259075,38 +259373,6 @@ function getStatusAction(status) {
|
|
259075
259373
|
return "Please try again later.";
|
259076
259374
|
}
|
259077
259375
|
|
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
259376
|
// src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
|
259111
259377
|
async function selectTargetNode({
|
259112
259378
|
env: env2,
|
@@ -259130,6 +259396,7 @@ async function selectTargetNode({
|
|
259130
259396
|
nodes: validNodes,
|
259131
259397
|
accept: autoAccept,
|
259132
259398
|
isRequired: true,
|
259399
|
+
filterRunningOnly: true,
|
259133
259400
|
promptMessage: "Which blockchain node do you want to connect to? (Only nodes with private keys activated are shown)",
|
259134
259401
|
singleOptionMessage: (node2) => `Using '${node2}' - the only node with active private keys. To use a different node, ensure it has a private key activated.`
|
259135
259402
|
});
|
@@ -259151,7 +259418,7 @@ function validateNode(node, cancelOnError = true) {
|
|
259151
259418
|
}
|
259152
259419
|
return false;
|
259153
259420
|
}
|
259154
|
-
if (node
|
259421
|
+
if (!hasValidPrivateKey(node)) {
|
259155
259422
|
if (cancelOnError) {
|
259156
259423
|
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
259424
|
}
|
@@ -259166,6 +259433,33 @@ function validateNode(node, cancelOnError = true) {
|
|
259166
259433
|
return true;
|
259167
259434
|
}
|
259168
259435
|
|
259436
|
+
// src/prompts/smart-contract-set/address.prompt.ts
|
259437
|
+
async function addressPrompt({
|
259438
|
+
accept,
|
259439
|
+
node,
|
259440
|
+
hardhatConfig
|
259441
|
+
}) {
|
259442
|
+
const possiblePrivateKeys = node.privateKeys?.filter(isValidPrivateKey) ?? [];
|
259443
|
+
const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
|
259444
|
+
const defaultPossible = accept && defaultAddress;
|
259445
|
+
if (defaultPossible) {
|
259446
|
+
if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
|
259447
|
+
return defaultAddress;
|
259448
|
+
}
|
259449
|
+
note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
|
259450
|
+
Please select another key or activate this key on the node and try again.`, "warn");
|
259451
|
+
}
|
259452
|
+
const address = await esm_default3({
|
259453
|
+
message: "Which private key do you want to deploy from?",
|
259454
|
+
choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
|
259455
|
+
name: name3,
|
259456
|
+
value: address2
|
259457
|
+
})),
|
259458
|
+
default: defaultAddress
|
259459
|
+
});
|
259460
|
+
return address;
|
259461
|
+
}
|
259462
|
+
|
259169
259463
|
// src/utils/smart-contract-set/hardhat-config.ts
|
259170
259464
|
async function getHardhatConfigData(envConfig) {
|
259171
259465
|
try {
|
@@ -259255,7 +259549,7 @@ function hardhatDeployRemoteCommand() {
|
|
259255
259549
|
}
|
259256
259550
|
let address = defaultSender ?? null;
|
259257
259551
|
if (!defaultSender) {
|
259258
|
-
address = await addressPrompt({
|
259552
|
+
address = await addressPrompt({ accept: autoAccept, node, hardhatConfig });
|
259259
259553
|
}
|
259260
259554
|
if (!address) {
|
259261
259555
|
return nothingSelectedError("private key");
|
@@ -259901,4 +260195,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
259901
260195
|
// src/cli.ts
|
259902
260196
|
sdkCliCommand();
|
259903
260197
|
|
259904
|
-
//# debugId=
|
260198
|
+
//# debugId=AE33F8D2DF044D0964756E2164756E21
|