@settlemint/sdk-cli 1.2.4-pr8c2d229d → 1.2.4-pref7d4865
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 +40 -35
- package/dist/cli.js.map +3 -3
- 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-pref7d4865",
|
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-pref7d4865",
|
259570
|
+
"@settlemint/sdk-utils": "1.2.4-pref7d4865",
|
259571
259571
|
"@types/node": "22.13.10",
|
259572
259572
|
"@types/semver": "7.5.8",
|
259573
259573
|
"@types/which": "3.0.4",
|
@@ -269934,14 +269934,14 @@ async function serviceSpinner(type4, task) {
|
|
269934
269934
|
function hasuraTrackCommand() {
|
269935
269935
|
return new Command("track").alias("t").description("Track all tables in Hasura").usage(createExamples([
|
269936
269936
|
{
|
269937
|
-
description: "Track all tables
|
269937
|
+
description: "Track all tables",
|
269938
269938
|
command: "hasura track"
|
269939
269939
|
},
|
269940
269940
|
{
|
269941
|
-
description: "Track all tables
|
269942
|
-
command: "hasura track --
|
269941
|
+
description: "Track all tables and accept default values",
|
269942
|
+
command: "hasura track --accept-defaults"
|
269943
269943
|
}
|
269944
|
-
])).option("-a, --accept-defaults", "Accept the default and previously set values").
|
269944
|
+
])).option("-a, --accept-defaults", "Accept the default and previously set values").action(async ({ acceptDefaults }) => {
|
269945
269945
|
intro("Tracking all tables in Hasura");
|
269946
269946
|
const env2 = await loadEnv(false, false);
|
269947
269947
|
const applicationUniqueName = env2.SETTLEMINT_APPLICATION;
|
@@ -269977,8 +269977,8 @@ function hasuraTrackCommand() {
|
|
269977
269977
|
const baseUrl = new URL(hasuraGraphqlEndpoint);
|
269978
269978
|
const queryEndpoint = new URL("/v1/metadata", baseUrl.origin).toString();
|
269979
269979
|
const messages = [];
|
269980
|
-
|
269981
|
-
startMessage:
|
269980
|
+
await spinner({
|
269981
|
+
startMessage: "Tracking all tables in Hasura",
|
269982
269982
|
stopMessage: "Successfully tracked all tables in Hasura",
|
269983
269983
|
task: async () => {
|
269984
269984
|
const executeHasuraQuery = async (query) => {
|
@@ -269996,51 +269996,56 @@ function hasuraTrackCommand() {
|
|
269996
269996
|
}
|
269997
269997
|
return { ok: true, data: await response.json() };
|
269998
269998
|
};
|
269999
|
-
const
|
270000
|
-
|
270001
|
-
|
270002
|
-
|
270003
|
-
|
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
|
+
});
|
270004
270020
|
});
|
270005
|
-
|
270006
|
-
|
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({
|
270021
|
+
messages.push(`Found ${allTables.length} tables in the database`);
|
270022
|
+
const untrackResult = await executeHasuraQuery({
|
270014
270023
|
type: "pg_untrack_tables",
|
270015
270024
|
args: {
|
270016
|
-
tables:
|
270017
|
-
table: table2.name
|
270018
|
-
})),
|
270025
|
+
tables: allTables.map(({ source, table: table2 }) => ({ source, table: table2 })),
|
270019
270026
|
allow_warnings: true
|
270020
270027
|
}
|
270021
270028
|
});
|
270029
|
+
if (!untrackResult.ok) {
|
270030
|
+
throw new Error(`Failed to untrack tables: ${JSON.stringify(untrackResult.data)}`);
|
270031
|
+
}
|
270022
270032
|
const trackResult = await executeHasuraQuery({
|
270023
270033
|
type: "pg_track_tables",
|
270024
270034
|
args: {
|
270025
|
-
tables:
|
270026
|
-
table: table2.name
|
270027
|
-
})),
|
270035
|
+
tables: allTables.map(({ source, table: table2 }) => ({ source, table: table2 })),
|
270028
270036
|
allow_warnings: true
|
270029
270037
|
}
|
270030
270038
|
});
|
270031
270039
|
if (!trackResult.ok) {
|
270032
270040
|
throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
|
270033
270041
|
}
|
270034
|
-
messages.push(`Successfully tracked ${
|
270035
|
-
return {
|
270042
|
+
messages.push(`Successfully tracked ${allTables.length} tables`);
|
270043
|
+
return { data: "success" };
|
270036
270044
|
}
|
270037
270045
|
});
|
270038
270046
|
for (const message of messages) {
|
270039
270047
|
note(message);
|
270040
270048
|
}
|
270041
|
-
if (result === "no-tables") {
|
270042
|
-
outro(`No tables found in database "${database}"`);
|
270043
|
-
}
|
270044
270049
|
outro("Table tracking completed successfully");
|
270045
270050
|
});
|
270046
270051
|
}
|
@@ -273553,4 +273558,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
273553
273558
|
// src/cli.ts
|
273554
273559
|
sdkCliCommand();
|
273555
273560
|
|
273556
|
-
//# debugId=
|
273561
|
+
//# debugId=7CABD6FFB7CB3EBE64756E2164756E21
|