@settlemint/sdk-cli 1.2.4-pref7d4865 → 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 -181
- 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,177 +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",
|
269938
|
-
command: "hasura track"
|
269939
|
-
},
|
269940
|
-
{
|
269941
|
-
description: "Track all tables and accept default values",
|
269942
|
-
command: "hasura track --accept-defaults"
|
269943
|
-
}
|
269944
|
-
])).option("-a, --accept-defaults", "Accept the default and previously set values").action(async ({ acceptDefaults }) => {
|
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
|
-
await spinner({
|
269981
|
-
startMessage: "Tracking all tables in Hasura",
|
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 exportMetadata = async () => {
|
270000
|
-
return executeHasuraQuery({
|
270001
|
-
type: "export_metadata",
|
270002
|
-
version: 2,
|
270003
|
-
args: {}
|
270004
|
-
});
|
270005
|
-
};
|
270006
|
-
const metadataResult = await exportMetadata();
|
270007
|
-
if (!metadataResult.ok) {
|
270008
|
-
throw new Error(`Failed to export metadata: ${JSON.stringify(metadataResult.data)}`);
|
270009
|
-
}
|
270010
|
-
const metadata = metadataResult.data;
|
270011
|
-
const allTables = [];
|
270012
|
-
metadata.metadata.sources.map((source) => {
|
270013
|
-
source.tables.map((tableInfo) => {
|
270014
|
-
allTables.push({
|
270015
|
-
source: source.name,
|
270016
|
-
schema: tableInfo.table.schema,
|
270017
|
-
table: tableInfo.table.name
|
270018
|
-
});
|
270019
|
-
});
|
270020
|
-
});
|
270021
|
-
messages.push(`Found ${allTables.length} tables in the database`);
|
270022
|
-
const untrackResult = await executeHasuraQuery({
|
270023
|
-
type: "pg_untrack_tables",
|
270024
|
-
args: {
|
270025
|
-
tables: allTables.map(({ source, table: table2 }) => ({ source, table: table2 })),
|
270026
|
-
allow_warnings: true
|
270027
|
-
}
|
270028
|
-
});
|
270029
|
-
if (!untrackResult.ok) {
|
270030
|
-
throw new Error(`Failed to untrack tables: ${JSON.stringify(untrackResult.data)}`);
|
270031
|
-
}
|
270032
|
-
const trackResult = await executeHasuraQuery({
|
270033
|
-
type: "pg_track_tables",
|
270034
|
-
args: {
|
270035
|
-
tables: allTables.map(({ source, table: table2 }) => ({ source, table: table2 })),
|
270036
|
-
allow_warnings: true
|
270037
|
-
}
|
270038
|
-
});
|
270039
|
-
if (!trackResult.ok) {
|
270040
|
-
throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
|
270041
|
-
}
|
270042
|
-
messages.push(`Successfully tracked ${allTables.length} tables`);
|
270043
|
-
return { data: "success" };
|
270044
|
-
}
|
270045
|
-
});
|
270046
|
-
for (const message of messages) {
|
270047
|
-
note(message);
|
270048
|
-
}
|
270049
|
-
outro("Table tracking completed successfully");
|
270050
|
-
});
|
270051
|
-
}
|
270052
|
-
|
270053
|
-
// src/commands/hasura/index.ts
|
270054
|
-
function hasuraCommand() {
|
270055
|
-
return new Command("hasura").alias("ha").description("Manage Hasura service in the SettleMint platform").addCommand(hasuraTrackCommand());
|
270056
|
-
}
|
270057
|
-
|
270058
269884
|
// src/prompts/pat.prompt.ts
|
270059
269885
|
async function personalAccessTokenPrompt(env2, instance, accept) {
|
270060
269886
|
const existingConfig = await getInstanceCredentials(instance, false);
|
@@ -270185,6 +270011,52 @@ function logoutCommand() {
|
|
270185
270011
|
});
|
270186
270012
|
}
|
270187
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
|
+
|
270188
270060
|
// src/commands/pincode-verification-response.ts
|
270189
270061
|
function pincodeVerificationResponseCommand() {
|
270190
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 }) => {
|
@@ -273538,7 +273410,6 @@ function registerCommands() {
|
|
273538
273410
|
sdkcli.addCommand(loginCommand());
|
273539
273411
|
sdkcli.addCommand(logoutCommand());
|
273540
273412
|
sdkcli.addCommand(pincodeVerificationResponseCommand());
|
273541
|
-
sdkcli.addCommand(hasuraCommand());
|
273542
273413
|
return sdkcli;
|
273543
273414
|
}
|
273544
273415
|
async function sdkCliCommand(argv = process.argv) {
|
@@ -273558,4 +273429,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
273558
273429
|
// src/cli.ts
|
273559
273430
|
sdkCliCommand();
|
273560
273431
|
|
273561
|
-
//# debugId=
|
273432
|
+
//# debugId=D1C3060E222029FC64756E2164756E21
|