@settlemint/sdk-cli 1.2.4-main957a32df → 1.2.4-pr09e9ca2d
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 +49 -58
- package/dist/cli.js.map +5 -5
- 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-pr09e9ca2d",
|
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-pr09e9ca2d",
|
259570
|
+
"@settlemint/sdk-utils": "1.2.4-pr09e9ca2d",
|
259571
259571
|
"@types/node": "22.13.10",
|
259572
259572
|
"@types/semver": "7.5.8",
|
259573
259573
|
"@types/which": "3.0.4",
|
@@ -269930,19 +269930,19 @@ async function serviceSpinner(type4, task) {
|
|
269930
269930
|
});
|
269931
269931
|
}
|
269932
269932
|
|
269933
|
-
// src/commands/hasura/track.ts
|
269934
|
-
function
|
269935
|
-
return new Command("track").alias("
|
269933
|
+
// src/commands/hasura/track-table.ts
|
269934
|
+
function hasuraTrackTableCommand() {
|
269935
|
+
return new Command("track-table").alias("tt").description("Track a table in Hasura").usage(createExamples([
|
269936
269936
|
{
|
269937
|
-
description: "Track
|
269938
|
-
command: "hasura track"
|
269937
|
+
description: "Track a table in the public schema",
|
269938
|
+
command: "hasura track-table --schema public --table user"
|
269939
269939
|
},
|
269940
269940
|
{
|
269941
|
-
description: "Track
|
269942
|
-
command: "hasura track --
|
269941
|
+
description: "Track a table and accept default values",
|
269942
|
+
command: "hasura track-table --schema public --table payments --accept-defaults"
|
269943
269943
|
}
|
269944
|
-
])).
|
269945
|
-
intro("Tracking
|
269944
|
+
])).requiredOption("--schema <schema>", "Schema name of the table (e.g., public)").requiredOption("--table <table>", "Name of the table to track").option("-a, --accept-defaults", "Accept the default and previously set values").action(async ({ schema, table: table2, acceptDefaults }) => {
|
269945
|
+
intro("Tracking table 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 hasuraTrackCommand() {
|
|
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/query", baseUrl.origin).toString();
|
269979
269979
|
const messages = [];
|
269980
|
-
|
269981
|
-
startMessage: `Tracking
|
269982
|
-
stopMessage:
|
269980
|
+
await spinner({
|
269981
|
+
startMessage: `Tracking table '${schema}.${table2}' in Hasura`,
|
269982
|
+
stopMessage: `Successfully tracked table '${schema}.${table2}' in Hasura`,
|
269983
269983
|
task: async () => {
|
269984
269984
|
const executeHasuraQuery = async (query) => {
|
269985
269985
|
const response = await fetch(queryEndpoint, {
|
@@ -269996,58 +269996,49 @@ function hasuraTrackCommand() {
|
|
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
|
-
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)}`);
|
269999
|
+
const trackTable = async () => {
|
270000
|
+
return executeHasuraQuery({
|
270001
|
+
type: "track_table",
|
270002
|
+
args: { schema, table: table2 }
|
270003
|
+
});
|
270004
|
+
};
|
270005
|
+
const untrackTable = async () => {
|
270006
|
+
return executeHasuraQuery({
|
270007
|
+
type: "untrack_table",
|
270008
|
+
args: { schema, table: table2 }
|
270009
|
+
});
|
270010
|
+
};
|
270011
|
+
const trackResult = await trackTable();
|
270012
|
+
if (trackResult.ok) {
|
270013
|
+
return { data: trackResult.data };
|
270014
|
+
}
|
270015
|
+
if (trackResult.data.code !== "already-tracked") {
|
270016
|
+
throw new Error(`Failed to track table: ${JSON.stringify(trackResult.data)}`);
|
270033
270017
|
}
|
270034
|
-
messages.push(`
|
270035
|
-
|
270018
|
+
messages.push(`Table '${schema}.${table2}' is already tracked. Untracking and retracking...`);
|
270019
|
+
const untrackResult = await untrackTable();
|
270020
|
+
if (!untrackResult.ok) {
|
270021
|
+
throw new Error(`Failed to untrack table: ${JSON.stringify(untrackResult.data)}`);
|
270022
|
+
}
|
270023
|
+
messages.push(`Successfully untracked table '${schema}.${table2}'.`);
|
270024
|
+
const retrackResult = await trackTable();
|
270025
|
+
if (!retrackResult.ok) {
|
270026
|
+
throw new Error(`Failed to re-track table: ${JSON.stringify(retrackResult.data)}`);
|
270027
|
+
}
|
270028
|
+
messages.push(`Successfully re-tracked table '${schema}.${table2}'.`);
|
270029
|
+
return { data: retrackResult.data };
|
270036
270030
|
}
|
270037
270031
|
});
|
270038
270032
|
for (const message of messages) {
|
270039
270033
|
note(message);
|
270040
270034
|
}
|
270041
|
-
|
270042
|
-
outro(`No tables found in database "${database}"`);
|
270043
|
-
}
|
270044
|
-
outro("Table tracking completed successfully");
|
270035
|
+
outro("Table tracking completed");
|
270045
270036
|
});
|
270046
270037
|
}
|
270047
270038
|
|
270048
270039
|
// src/commands/hasura/index.ts
|
270049
270040
|
function hasuraCommand() {
|
270050
|
-
return new Command("hasura").alias("ha").description("Manage Hasura service in the SettleMint platform").addCommand(
|
270041
|
+
return new Command("hasura").alias("ha").description("Manage Hasura service in the SettleMint platform").addCommand(hasuraTrackTableCommand());
|
270051
270042
|
}
|
270052
270043
|
|
270053
270044
|
// src/prompts/pat.prompt.ts
|
@@ -273553,4 +273544,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
273553
273544
|
// src/cli.ts
|
273554
273545
|
sdkCliCommand();
|
273555
273546
|
|
273556
|
-
//# debugId=
|
273547
|
+
//# debugId=849E2F1F2C47692F64756E2164756E21
|