@settlemint/sdk-cli 1.2.4-pref7d4865 → 1.2.5

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/README.md CHANGED
@@ -249,7 +249,7 @@ settlemint scs subgraph deploy --accept-defaults <subgraph-name>
249
249
 
250
250
  ## API Reference
251
251
 
252
- See the [documentation](https://github.com/settlemint/sdk/tree/v1.2.4/sdk/cli/docs/settlemint.md) for available commands.
252
+ See the [documentation](https://github.com/settlemint/sdk/tree/v1.2.5/sdk/cli/docs/settlemint.md) for available commands.
253
253
 
254
254
  ## Contributing
255
255
 
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-pref7d4865",
259520
+ version: "1.2.5",
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-pref7d4865",
259570
- "@settlemint/sdk-utils": "1.2.4-pref7d4865",
259571
- "@types/node": "22.13.10",
259569
+ "@settlemint/sdk-js": "1.2.5",
259570
+ "@settlemint/sdk-utils": "1.2.5",
259571
+ "@types/node": "22.13.13",
259572
259572
  "@types/semver": "7.5.8",
259573
259573
  "@types/which": "3.0.4",
259574
259574
  "get-tsconfig": "4.10.0",
@@ -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 of the default database",
269938
269938
  command: "hasura track"
269939
269939
  },
269940
269940
  {
269941
- description: "Track all tables and accept default values",
269942
- command: "hasura track --accept-defaults"
269941
+ description: "Track all tables of a specific database",
269942
+ command: "hasura track --database my-database"
269943
269943
  }
269944
- ])).option("-a, --accept-defaults", "Accept the default and previously set values").action(async ({ acceptDefaults }) => {
269944
+ ])).option("-a, --accept-defaults", "Accept the default and previously set values").option("-db, --database <database>", "Database name", "default").action(async ({ acceptDefaults, database }) => {
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
- await spinner({
269981
- startMessage: "Tracking all tables in Hasura",
269980
+ const { result } = await spinner({
269981
+ startMessage: `Tracking all tables in Hasura from database "${database}"`,
269982
269982
  stopMessage: "Successfully tracked all tables in Hasura",
269983
269983
  task: async () => {
269984
269984
  const executeHasuraQuery = async (query) => {
@@ -269996,56 +269996,51 @@ function hasuraTrackCommand() {
269996
269996
  }
269997
269997
  return { ok: true, data: await response.json() };
269998
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
- });
269999
+ const getTablesResult = await executeHasuraQuery({
270000
+ type: "pg_get_source_tables",
270001
+ args: {
270002
+ source: database
270003
+ }
270020
270004
  });
270021
- messages.push(`Found ${allTables.length} tables in the database`);
270022
- const untrackResult = await executeHasuraQuery({
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({
270023
270014
  type: "pg_untrack_tables",
270024
270015
  args: {
270025
- tables: allTables.map(({ source, table: table2 }) => ({ source, table: table2 })),
270016
+ tables: tables.map((table2) => ({
270017
+ table: table2.name
270018
+ })),
270026
270019
  allow_warnings: true
270027
270020
  }
270028
270021
  });
270029
- if (!untrackResult.ok) {
270030
- throw new Error(`Failed to untrack tables: ${JSON.stringify(untrackResult.data)}`);
270031
- }
270032
270022
  const trackResult = await executeHasuraQuery({
270033
270023
  type: "pg_track_tables",
270034
270024
  args: {
270035
- tables: allTables.map(({ source, table: table2 }) => ({ source, table: table2 })),
270025
+ tables: tables.map((table2) => ({
270026
+ table: table2.name
270027
+ })),
270036
270028
  allow_warnings: true
270037
270029
  }
270038
270030
  });
270039
270031
  if (!trackResult.ok) {
270040
270032
  throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
270041
270033
  }
270042
- messages.push(`Successfully tracked ${allTables.length} tables`);
270043
- return { data: "success" };
270034
+ messages.push(`Successfully tracked ${tables.length} tables`);
270035
+ return { result: "success" };
270044
270036
  }
270045
270037
  });
270046
270038
  for (const message of messages) {
270047
270039
  note(message);
270048
270040
  }
270041
+ if (result === "no-tables") {
270042
+ outro(`No tables found in database "${database}"`);
270043
+ }
270049
270044
  outro("Table tracking completed successfully");
270050
270045
  });
270051
270046
  }
@@ -273558,4 +273553,4 @@ async function sdkCliCommand(argv = process.argv) {
273558
273553
  // src/cli.ts
273559
273554
  sdkCliCommand();
273560
273555
 
273561
- //# debugId=7CABD6FFB7CB3EBE64756E2164756E21
273556
+ //# debugId=4D6BE489822E18C364756E2164756E21