@settlemint/sdk-cli 1.2.4-pr8c2d229d → 1.2.4
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 +52 -176
- package/dist/cli.js.map +7 -9
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -259517,7 +259517,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
259517
259517
|
var package_default = {
|
259518
259518
|
name: "@settlemint/sdk-cli",
|
259519
259519
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
259520
|
-
version: "1.2.4
|
259520
|
+
version: "1.2.4",
|
259521
259521
|
type: "module",
|
259522
259522
|
private: false,
|
259523
259523
|
license: "FSL-1.1-MIT",
|
@@ -259566,8 +259566,8 @@ var package_default = {
|
|
259566
259566
|
"@inquirer/input": "4.1.8",
|
259567
259567
|
"@inquirer/password": "4.0.11",
|
259568
259568
|
"@inquirer/select": "4.1.0",
|
259569
|
-
"@settlemint/sdk-js": "1.2.4
|
259570
|
-
"@settlemint/sdk-utils": "1.2.4
|
259569
|
+
"@settlemint/sdk-js": "1.2.4",
|
259570
|
+
"@settlemint/sdk-utils": "1.2.4",
|
259571
259571
|
"@types/node": "22.13.10",
|
259572
259572
|
"@types/semver": "7.5.8",
|
259573
259573
|
"@types/which": "3.0.4",
|
@@ -265988,19 +265988,16 @@ async function customDeploymentPrompt({
|
|
265988
265988
|
}
|
265989
265989
|
|
265990
265990
|
// src/prompts/cluster-service/hasura.prompt.ts
|
265991
|
-
function isHasura(integration) {
|
265992
|
-
return integration.__typename === "Hasura";
|
265993
|
-
}
|
265994
265991
|
async function hasuraPrompt({
|
265995
265992
|
env: env2,
|
265996
265993
|
integrations,
|
265997
265994
|
accept,
|
265998
265995
|
isRequired = false
|
265999
265996
|
}) {
|
266000
|
-
const
|
265997
|
+
const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
|
266001
265998
|
return servicePrompt({
|
266002
265999
|
env: env2,
|
266003
|
-
services:
|
266000
|
+
services: possible,
|
266004
266001
|
accept,
|
266005
266002
|
envKey: "SETTLEMINT_HASURA",
|
266006
266003
|
isRequired,
|
@@ -269884,172 +269881,6 @@ function createCommand2() {
|
|
269884
269881
|
});
|
269885
269882
|
}
|
269886
269883
|
|
269887
|
-
// src/constants/resource-type.ts
|
269888
|
-
var SETTLEMINT_CLIENT_MAP = {
|
269889
|
-
application: "application",
|
269890
|
-
workspace: "workspace",
|
269891
|
-
"blockchain network": "blockchainNetwork",
|
269892
|
-
"blockchain node": "blockchainNode",
|
269893
|
-
"custom deployment": "customDeployment",
|
269894
|
-
"private key": "privateKey",
|
269895
|
-
middleware: "middleware",
|
269896
|
-
"integration tool": "integrationTool",
|
269897
|
-
storage: "storage",
|
269898
|
-
insights: "insights",
|
269899
|
-
"application access token": "applicationAccessToken"
|
269900
|
-
};
|
269901
|
-
var LABELS_MAP = {
|
269902
|
-
application: { singular: "application", plural: "applications", command: "app" },
|
269903
|
-
workspace: { singular: "workspace", plural: "workspaces", command: "workspace" },
|
269904
|
-
"blockchain network": {
|
269905
|
-
singular: "blockchain network",
|
269906
|
-
plural: "blockchain networks",
|
269907
|
-
command: "blockchain-network"
|
269908
|
-
},
|
269909
|
-
"blockchain node": { singular: "blockchain node", plural: "blockchain nodes", command: "blockchain-node" },
|
269910
|
-
"custom deployment": { singular: "custom deployment", plural: "custom deployments", command: "custom-deployment" },
|
269911
|
-
"private key": { singular: "private key", plural: "private keys", command: "private-key" },
|
269912
|
-
middleware: { singular: "middleware", plural: "middlewares", command: "middleware" },
|
269913
|
-
"integration tool": { singular: "integration tool", plural: "integration tools", command: "integration-tool" },
|
269914
|
-
storage: { singular: "storage", plural: "storage", command: "storage" },
|
269915
|
-
insights: { singular: "insight", plural: "insights", command: "insight" },
|
269916
|
-
"application access token": {
|
269917
|
-
singular: "application access token",
|
269918
|
-
plural: "application access tokens",
|
269919
|
-
command: "application-access-token"
|
269920
|
-
}
|
269921
|
-
};
|
269922
|
-
|
269923
|
-
// src/spinners/service.spinner.ts
|
269924
|
-
async function serviceSpinner(type4, task) {
|
269925
|
-
const { plural } = LABELS_MAP[type4];
|
269926
|
-
return spinner({
|
269927
|
-
startMessage: `Loading ${plural} services`,
|
269928
|
-
stopMessage: `Loaded ${plural} services`,
|
269929
|
-
task
|
269930
|
-
});
|
269931
|
-
}
|
269932
|
-
|
269933
|
-
// src/commands/hasura/track.ts
|
269934
|
-
function hasuraTrackCommand() {
|
269935
|
-
return new Command("track").alias("t").description("Track all tables in Hasura").usage(createExamples([
|
269936
|
-
{
|
269937
|
-
description: "Track all tables of the default database",
|
269938
|
-
command: "hasura track"
|
269939
|
-
},
|
269940
|
-
{
|
269941
|
-
description: "Track all tables of a specific database",
|
269942
|
-
command: "hasura track --database my-database"
|
269943
|
-
}
|
269944
|
-
])).option("-a, --accept-defaults", "Accept the default and previously set values").option("-db, --database <database>", "Database name", "default").action(async ({ acceptDefaults, database }) => {
|
269945
|
-
intro("Tracking all tables in Hasura");
|
269946
|
-
const env2 = await loadEnv(false, false);
|
269947
|
-
const applicationUniqueName = env2.SETTLEMINT_APPLICATION;
|
269948
|
-
if (!applicationUniqueName) {
|
269949
|
-
return missingApplication();
|
269950
|
-
}
|
269951
|
-
const selectedInstance = await instancePrompt(env2, true);
|
269952
|
-
const accessToken = await getApplicationOrPersonalAccessToken({
|
269953
|
-
env: env2,
|
269954
|
-
instance: selectedInstance,
|
269955
|
-
prefer: "application"
|
269956
|
-
});
|
269957
|
-
const settlemint = createSettleMintClient({
|
269958
|
-
accessToken,
|
269959
|
-
instance: selectedInstance
|
269960
|
-
});
|
269961
|
-
const integrationTools = await serviceSpinner("integration tool", () => settlemint.integrationTool.list(applicationUniqueName));
|
269962
|
-
const hasura = await hasuraPrompt({
|
269963
|
-
env: env2,
|
269964
|
-
integrations: integrationTools,
|
269965
|
-
accept: acceptDefaults,
|
269966
|
-
isRequired: true
|
269967
|
-
});
|
269968
|
-
if (!hasura) {
|
269969
|
-
return nothingSelectedError("Hasura instance");
|
269970
|
-
}
|
269971
|
-
const hasuraEndpoints = getHasuraEndpoints(hasura);
|
269972
|
-
const hasuraGraphqlEndpoint = hasuraEndpoints.SETTLEMINT_HASURA_ENDPOINT;
|
269973
|
-
const hasuraAdminSecret = hasuraEndpoints.SETTLEMINT_HASURA_ADMIN_SECRET;
|
269974
|
-
if (!hasuraGraphqlEndpoint || !hasuraAdminSecret) {
|
269975
|
-
return note("Could not retrieve Hasura endpoint or admin secret. Please check your configuration.");
|
269976
|
-
}
|
269977
|
-
const baseUrl = new URL(hasuraGraphqlEndpoint);
|
269978
|
-
const queryEndpoint = new URL("/v1/metadata", baseUrl.origin).toString();
|
269979
|
-
const messages = [];
|
269980
|
-
const { result } = await spinner({
|
269981
|
-
startMessage: `Tracking all tables in Hasura from database "${database}"`,
|
269982
|
-
stopMessage: "Successfully tracked all tables in Hasura",
|
269983
|
-
task: async () => {
|
269984
|
-
const executeHasuraQuery = async (query) => {
|
269985
|
-
const response = await fetch(queryEndpoint, {
|
269986
|
-
method: "POST",
|
269987
|
-
headers: {
|
269988
|
-
"Content-Type": "application/json",
|
269989
|
-
"X-Hasura-Admin-Secret": hasuraAdminSecret,
|
269990
|
-
"x-auth-token": accessToken
|
269991
|
-
},
|
269992
|
-
body: JSON.stringify(query)
|
269993
|
-
});
|
269994
|
-
if (!response.ok) {
|
269995
|
-
return { ok: false, data: await response.json() };
|
269996
|
-
}
|
269997
|
-
return { ok: true, data: await response.json() };
|
269998
|
-
};
|
269999
|
-
const getTablesResult = await executeHasuraQuery({
|
270000
|
-
type: "pg_get_source_tables",
|
270001
|
-
args: {
|
270002
|
-
source: database
|
270003
|
-
}
|
270004
|
-
});
|
270005
|
-
if (!getTablesResult.ok) {
|
270006
|
-
throw new Error(`Failed to get tables: ${JSON.stringify(getTablesResult.data)}`);
|
270007
|
-
}
|
270008
|
-
const tables = getTablesResult.data;
|
270009
|
-
if (tables.length === 0) {
|
270010
|
-
return { result: "no-tables" };
|
270011
|
-
}
|
270012
|
-
messages.push(`Found ${tables.length} tables in database "${database}"`);
|
270013
|
-
await executeHasuraQuery({
|
270014
|
-
type: "pg_untrack_tables",
|
270015
|
-
args: {
|
270016
|
-
tables: tables.map((table2) => ({
|
270017
|
-
table: table2.name
|
270018
|
-
})),
|
270019
|
-
allow_warnings: true
|
270020
|
-
}
|
270021
|
-
});
|
270022
|
-
const trackResult = await executeHasuraQuery({
|
270023
|
-
type: "pg_track_tables",
|
270024
|
-
args: {
|
270025
|
-
tables: tables.map((table2) => ({
|
270026
|
-
table: table2.name
|
270027
|
-
})),
|
270028
|
-
allow_warnings: true
|
270029
|
-
}
|
270030
|
-
});
|
270031
|
-
if (!trackResult.ok) {
|
270032
|
-
throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
|
270033
|
-
}
|
270034
|
-
messages.push(`Successfully tracked ${tables.length} tables`);
|
270035
|
-
return { result: "success" };
|
270036
|
-
}
|
270037
|
-
});
|
270038
|
-
for (const message of messages) {
|
270039
|
-
note(message);
|
270040
|
-
}
|
270041
|
-
if (result === "no-tables") {
|
270042
|
-
outro(`No tables found in database "${database}"`);
|
270043
|
-
}
|
270044
|
-
outro("Table tracking completed successfully");
|
270045
|
-
});
|
270046
|
-
}
|
270047
|
-
|
270048
|
-
// src/commands/hasura/index.ts
|
270049
|
-
function hasuraCommand() {
|
270050
|
-
return new Command("hasura").alias("ha").description("Manage Hasura service in the SettleMint platform").addCommand(hasuraTrackCommand());
|
270051
|
-
}
|
270052
|
-
|
270053
269884
|
// src/prompts/pat.prompt.ts
|
270054
269885
|
async function personalAccessTokenPrompt(env2, instance, accept) {
|
270055
269886
|
const existingConfig = await getInstanceCredentials(instance, false);
|
@@ -270180,6 +270011,52 @@ function logoutCommand() {
|
|
270180
270011
|
});
|
270181
270012
|
}
|
270182
270013
|
|
270014
|
+
// src/constants/resource-type.ts
|
270015
|
+
var SETTLEMINT_CLIENT_MAP = {
|
270016
|
+
application: "application",
|
270017
|
+
workspace: "workspace",
|
270018
|
+
"blockchain network": "blockchainNetwork",
|
270019
|
+
"blockchain node": "blockchainNode",
|
270020
|
+
"custom deployment": "customDeployment",
|
270021
|
+
"private key": "privateKey",
|
270022
|
+
middleware: "middleware",
|
270023
|
+
"integration tool": "integrationTool",
|
270024
|
+
storage: "storage",
|
270025
|
+
insights: "insights",
|
270026
|
+
"application access token": "applicationAccessToken"
|
270027
|
+
};
|
270028
|
+
var LABELS_MAP = {
|
270029
|
+
application: { singular: "application", plural: "applications", command: "app" },
|
270030
|
+
workspace: { singular: "workspace", plural: "workspaces", command: "workspace" },
|
270031
|
+
"blockchain network": {
|
270032
|
+
singular: "blockchain network",
|
270033
|
+
plural: "blockchain networks",
|
270034
|
+
command: "blockchain-network"
|
270035
|
+
},
|
270036
|
+
"blockchain node": { singular: "blockchain node", plural: "blockchain nodes", command: "blockchain-node" },
|
270037
|
+
"custom deployment": { singular: "custom deployment", plural: "custom deployments", command: "custom-deployment" },
|
270038
|
+
"private key": { singular: "private key", plural: "private keys", command: "private-key" },
|
270039
|
+
middleware: { singular: "middleware", plural: "middlewares", command: "middleware" },
|
270040
|
+
"integration tool": { singular: "integration tool", plural: "integration tools", command: "integration-tool" },
|
270041
|
+
storage: { singular: "storage", plural: "storage", command: "storage" },
|
270042
|
+
insights: { singular: "insight", plural: "insights", command: "insight" },
|
270043
|
+
"application access token": {
|
270044
|
+
singular: "application access token",
|
270045
|
+
plural: "application access tokens",
|
270046
|
+
command: "application-access-token"
|
270047
|
+
}
|
270048
|
+
};
|
270049
|
+
|
270050
|
+
// src/spinners/service.spinner.ts
|
270051
|
+
async function serviceSpinner(type4, task) {
|
270052
|
+
const { plural } = LABELS_MAP[type4];
|
270053
|
+
return spinner({
|
270054
|
+
startMessage: `Loading ${plural} services`,
|
270055
|
+
stopMessage: `Loaded ${plural} services`,
|
270056
|
+
task
|
270057
|
+
});
|
270058
|
+
}
|
270059
|
+
|
270183
270060
|
// src/commands/pincode-verification-response.ts
|
270184
270061
|
function pincodeVerificationResponseCommand() {
|
270185
270062
|
return new Command("pincode-verification-response").alias("pvr").description("Get pincode verification response for a blockchain node").requiredOption("--wallet-address <walletAddress>", "The wallet address to get pincode verification response for").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name to get pincode verification response for").action(async ({ instance, blockchainNode, walletAddress }) => {
|
@@ -273533,7 +273410,6 @@ function registerCommands() {
|
|
273533
273410
|
sdkcli.addCommand(loginCommand());
|
273534
273411
|
sdkcli.addCommand(logoutCommand());
|
273535
273412
|
sdkcli.addCommand(pincodeVerificationResponseCommand());
|
273536
|
-
sdkcli.addCommand(hasuraCommand());
|
273537
273413
|
return sdkcli;
|
273538
273414
|
}
|
273539
273415
|
async function sdkCliCommand(argv = process.argv) {
|
@@ -273553,4 +273429,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
273553
273429
|
// src/cli.ts
|
273554
273430
|
sdkCliCommand();
|
273555
273431
|
|
273556
|
-
//# debugId=
|
273432
|
+
//# debugId=D1C3060E222029FC64756E2164756E21
|