@settlemint/sdk-cli 1.2.4-pr09e9ca2d → 1.2.4-pr1b64bb2f
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 +59 -50
- package/dist/cli.js.map +5 -5
- package/package.json +4 -4
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-pr1b64bb2f",
|
259521
259521
|
type: "module",
|
259522
259522
|
private: false,
|
259523
259523
|
license: "FSL-1.1-MIT",
|
@@ -259566,9 +259566,9 @@ 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-
|
259571
|
-
"@types/node": "22.13.
|
259569
|
+
"@settlemint/sdk-js": "1.2.4-pr1b64bb2f",
|
259570
|
+
"@settlemint/sdk-utils": "1.2.4-pr1b64bb2f",
|
259571
|
+
"@types/node": "22.13.11",
|
259572
259572
|
"@types/semver": "7.5.8",
|
259573
259573
|
"@types/which": "3.0.4",
|
259574
259574
|
"get-tsconfig": "4.10.0",
|
@@ -269930,19 +269930,19 @@ async function serviceSpinner(type4, task) {
|
|
269930
269930
|
});
|
269931
269931
|
}
|
269932
269932
|
|
269933
|
-
// src/commands/hasura/track
|
269934
|
-
function
|
269935
|
-
return new Command("track
|
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
269936
|
{
|
269937
|
-
description: "Track
|
269938
|
-
command: "hasura track
|
269937
|
+
description: "Track all tables of the default database",
|
269938
|
+
command: "hasura track"
|
269939
269939
|
},
|
269940
269940
|
{
|
269941
|
-
description: "Track
|
269942
|
-
command: "hasura track
|
269941
|
+
description: "Track all tables of a specific database",
|
269942
|
+
command: "hasura track --database my-database"
|
269943
269943
|
}
|
269944
|
-
])).
|
269945
|
-
intro("Tracking
|
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
269946
|
const env2 = await loadEnv(false, false);
|
269947
269947
|
const applicationUniqueName = env2.SETTLEMINT_APPLICATION;
|
269948
269948
|
if (!applicationUniqueName) {
|
@@ -269975,11 +269975,11 @@ function hasuraTrackTableCommand() {
|
|
269975
269975
|
return note("Could not retrieve Hasura endpoint or admin secret. Please check your configuration.");
|
269976
269976
|
}
|
269977
269977
|
const baseUrl = new URL(hasuraGraphqlEndpoint);
|
269978
|
-
const queryEndpoint = new URL("/v1/
|
269978
|
+
const queryEndpoint = new URL("/v1/metadata", baseUrl.origin).toString();
|
269979
269979
|
const messages = [];
|
269980
|
-
await spinner({
|
269981
|
-
startMessage: `Tracking
|
269982
|
-
stopMessage:
|
269980
|
+
const { result } = await spinner({
|
269981
|
+
startMessage: `Tracking all tables in Hasura from database "${database}"`,
|
269982
|
+
stopMessage: "Successfully tracked all tables in Hasura",
|
269983
269983
|
task: async () => {
|
269984
269984
|
const executeHasuraQuery = async (query) => {
|
269985
269985
|
const response = await fetch(queryEndpoint, {
|
@@ -269996,49 +269996,58 @@ function hasuraTrackTableCommand() {
|
|
269996
269996
|
}
|
269997
269997
|
return { ok: true, data: await response.json() };
|
269998
269998
|
};
|
269999
|
-
const
|
270000
|
-
|
270001
|
-
|
270002
|
-
|
270003
|
-
}
|
270004
|
-
};
|
270005
|
-
|
270006
|
-
|
270007
|
-
|
270008
|
-
|
270009
|
-
|
270010
|
-
|
270011
|
-
|
270012
|
-
|
270013
|
-
|
270014
|
-
|
270015
|
-
|
270016
|
-
|
270017
|
-
|
270018
|
-
|
270019
|
-
|
270020
|
-
|
270021
|
-
|
270022
|
-
|
270023
|
-
|
270024
|
-
|
270025
|
-
|
270026
|
-
|
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)}`);
|
270027
270033
|
}
|
270028
|
-
messages.push(`Successfully
|
270029
|
-
return {
|
270034
|
+
messages.push(`Successfully tracked ${tables.length} tables`);
|
270035
|
+
return { result: "success" };
|
270030
270036
|
}
|
270031
270037
|
});
|
270032
270038
|
for (const message of messages) {
|
270033
270039
|
note(message);
|
270034
270040
|
}
|
270035
|
-
|
270041
|
+
if (result === "no-tables") {
|
270042
|
+
outro(`No tables found in database "${database}"`);
|
270043
|
+
}
|
270044
|
+
outro("Table tracking completed successfully");
|
270036
270045
|
});
|
270037
270046
|
}
|
270038
270047
|
|
270039
270048
|
// src/commands/hasura/index.ts
|
270040
270049
|
function hasuraCommand() {
|
270041
|
-
return new Command("hasura").alias("ha").description("Manage Hasura service in the SettleMint platform").addCommand(
|
270050
|
+
return new Command("hasura").alias("ha").description("Manage Hasura service in the SettleMint platform").addCommand(hasuraTrackCommand());
|
270042
270051
|
}
|
270043
270052
|
|
270044
270053
|
// src/prompts/pat.prompt.ts
|
@@ -273544,4 +273553,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
273544
273553
|
// src/cli.ts
|
273545
273554
|
sdkCliCommand();
|
273546
273555
|
|
273547
|
-
//# debugId=
|
273556
|
+
//# debugId=A0FFEEA7DBEC221C64756E2164756E21
|