@settlemint/sdk-cli 1.2.3 → 1.2.4-main957a32df

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.3/sdk/cli/docs/settlemint.md) for available commands.
252
+ See the [documentation](https://github.com/settlemint/sdk/tree/v1.2.4/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.3",
259520
+ version: "1.2.4-main957a32df",
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.3",
259570
- "@settlemint/sdk-utils": "1.2.3",
259569
+ "@settlemint/sdk-js": "1.2.4-main957a32df",
259570
+ "@settlemint/sdk-utils": "1.2.4-main957a32df",
259571
259571
  "@types/node": "22.13.10",
259572
259572
  "@types/semver": "7.5.8",
259573
259573
  "@types/which": "3.0.4",
@@ -265988,16 +265988,19 @@ 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
+ }
265991
265994
  async function hasuraPrompt({
265992
265995
  env: env2,
265993
265996
  integrations,
265994
265997
  accept,
265995
265998
  isRequired = false
265996
265999
  }) {
265997
- const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
266000
+ const hasuras = integrations.filter(isHasura);
265998
266001
  return servicePrompt({
265999
266002
  env: env2,
266000
- services: possible,
266003
+ services: hasuras,
266001
266004
  accept,
266002
266005
  envKey: "SETTLEMINT_HASURA",
266003
266006
  isRequired,
@@ -269881,6 +269884,172 @@ function createCommand2() {
269881
269884
  });
269882
269885
  }
269883
269886
 
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 of the default database",
269938
+ command: "hasura track"
269939
+ },
269940
+ {
269941
+ description: "Track all tables of a specific database",
269942
+ command: "hasura track --database my-database"
269943
+ }
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
+ 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
+ const { result } = await spinner({
269981
+ startMessage: `Tracking all tables in Hasura from database "${database}"`,
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 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)}`);
270033
+ }
270034
+ messages.push(`Successfully tracked ${tables.length} tables`);
270035
+ return { result: "success" };
270036
+ }
270037
+ });
270038
+ for (const message of messages) {
270039
+ note(message);
270040
+ }
270041
+ if (result === "no-tables") {
270042
+ outro(`No tables found in database "${database}"`);
270043
+ }
270044
+ outro("Table tracking completed successfully");
270045
+ });
270046
+ }
270047
+
270048
+ // src/commands/hasura/index.ts
270049
+ function hasuraCommand() {
270050
+ return new Command("hasura").alias("ha").description("Manage Hasura service in the SettleMint platform").addCommand(hasuraTrackCommand());
270051
+ }
270052
+
269884
270053
  // src/prompts/pat.prompt.ts
269885
270054
  async function personalAccessTokenPrompt(env2, instance, accept) {
269886
270055
  const existingConfig = await getInstanceCredentials(instance, false);
@@ -270011,52 +270180,6 @@ function logoutCommand() {
270011
270180
  });
270012
270181
  }
270013
270182
 
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
-
270060
270183
  // src/commands/pincode-verification-response.ts
270061
270184
  function pincodeVerificationResponseCommand() {
270062
270185
  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 }) => {
@@ -272651,6 +272774,9 @@ async function selectTargetNode({
272651
272774
  }
272652
272775
  const nodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION));
272653
272776
  const validNodes = nodes.filter((node2) => validateNode(node2, false));
272777
+ if (validNodes.length === 0) {
272778
+ cancel2("No valid blockchain nodes found for deployment. A valid node must be an EVM blockchain node with an activated ECDSA P256 or HSM ECDSA P256 private key, and be running.");
272779
+ }
272654
272780
  const blockchainNode = await blockchainNodePrompt({
272655
272781
  env: env2,
272656
272782
  nodes: validNodes,
@@ -273407,6 +273533,7 @@ function registerCommands() {
273407
273533
  sdkcli.addCommand(loginCommand());
273408
273534
  sdkcli.addCommand(logoutCommand());
273409
273535
  sdkcli.addCommand(pincodeVerificationResponseCommand());
273536
+ sdkcli.addCommand(hasuraCommand());
273410
273537
  return sdkcli;
273411
273538
  }
273412
273539
  async function sdkCliCommand(argv = process.argv) {
@@ -273426,4 +273553,4 @@ async function sdkCliCommand(argv = process.argv) {
273426
273553
  // src/cli.ts
273427
273554
  sdkCliCommand();
273428
273555
 
273429
- //# debugId=78E96CBACEF449D264756E2164756E21
273556
+ //# debugId=6B4BAD00256D619264756E2164756E21