@settlemint/sdk-cli 2.4.1-pr558bfd18 → 2.4.1-pr7eaa1e59

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.
Files changed (3) hide show
  1. package/dist/cli.js +248 -217
  2. package/dist/cli.js.map +16 -16
  3. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -265083,7 +265083,7 @@ function pruneCurrentEnv(currentEnv, env2) {
265083
265083
  var package_default = {
265084
265084
  name: "@settlemint/sdk-cli",
265085
265085
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
265086
- version: "2.4.1-pr558bfd18",
265086
+ version: "2.4.1-pr7eaa1e59",
265087
265087
  type: "module",
265088
265088
  private: false,
265089
265089
  license: "FSL-1.1-MIT",
@@ -265134,10 +265134,10 @@ var package_default = {
265134
265134
  "@inquirer/input": "4.2.0",
265135
265135
  "@inquirer/password": "4.0.16",
265136
265136
  "@inquirer/select": "4.2.4",
265137
- "@settlemint/sdk-hasura": "2.4.1-pr558bfd18",
265138
- "@settlemint/sdk-js": "2.4.1-pr558bfd18",
265139
- "@settlemint/sdk-utils": "2.4.1-pr558bfd18",
265140
- "@settlemint/sdk-viem": "2.4.1-pr558bfd18",
265137
+ "@settlemint/sdk-hasura": "2.4.1-pr7eaa1e59",
265138
+ "@settlemint/sdk-js": "2.4.1-pr7eaa1e59",
265139
+ "@settlemint/sdk-utils": "2.4.1-pr7eaa1e59",
265140
+ "@settlemint/sdk-viem": "2.4.1-pr7eaa1e59",
265141
265141
  "@types/node": "24.0.12",
265142
265142
  "@types/semver": "7.7.0",
265143
265143
  "@types/which": "3.0.4",
@@ -301868,7 +301868,7 @@ async function codegenHasura(env2) {
301868
301868
  ...accessToken ? { "x-auth-token": accessToken } : {}
301869
301869
  }
301870
301870
  });
301871
- const hasuraTemplate = `import { createHasuraClient } from "${PACKAGE_NAME}";
301871
+ const hasuraTemplate = `import { createHasuraClient, createHasuraMetadataClient } from "${PACKAGE_NAME}";
301872
301872
  import type { introspection } from "@schemas/hasura-env";
301873
301873
  import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-utils/logging';
301874
301874
 
@@ -301975,16 +301975,6 @@ export const portalWebsocketClient = getWebsocketClient({
301975
301975
  }
301976
301976
  }
301977
301977
 
301978
- // src/commands/codegen/utils/get-variable-name.ts
301979
- function getVariableName(name3) {
301980
- return name3.split(/[^a-zA-Z0-9]/g).map((word2, index) => (index === 0 ? word2.charAt(0).toLowerCase() : word2.charAt(0).toUpperCase()) + word2.slice(1)).join("");
301981
- }
301982
-
301983
- // src/utils/subgraph/subgraph-name.ts
301984
- function getSubgraphName(endpoint) {
301985
- return endpoint.split("/").pop();
301986
- }
301987
-
301988
301978
  // ../utils/dist/index.js
301989
301979
  var maskTokens5 = (output) => {
301990
301980
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
@@ -302083,10 +302073,26 @@ function replaceUnderscoresAndHyphensWithSpaces(s6) {
302083
302073
  }
302084
302074
  function extractBaseUrlBeforeSegment(baseUrl, pathSegment) {
302085
302075
  const url4 = new URL(baseUrl);
302076
+ if (pathSegment.trim() === "") {
302077
+ return url4.toString();
302078
+ }
302086
302079
  const segmentIndex = url4.pathname.indexOf(pathSegment);
302087
302080
  return url4.origin + (segmentIndex >= 0 ? url4.pathname.substring(0, segmentIndex) : url4.pathname);
302088
302081
  }
302089
302082
 
302083
+ // src/commands/codegen/utils/get-variable-name.ts
302084
+ function getVariableName(name3) {
302085
+ return name3.split(/[^a-zA-Z0-9]/g).map((word2, index) => (index === 0 ? word2.charAt(0).toLowerCase() : word2.charAt(0).toUpperCase()) + word2.slice(1)).join("");
302086
+ }
302087
+
302088
+ // src/utils/subgraph/subgraph-name.ts
302089
+ function getSubgraphName(endpoint) {
302090
+ if (endpoint.toLowerCase().includes("/subgraphs/")) {
302091
+ return endpoint.split("/").pop();
302092
+ }
302093
+ return;
302094
+ }
302095
+
302090
302096
  // src/commands/codegen/codegen-the-graph.ts
302091
302097
  var PACKAGE_NAME3 = "@settlemint/sdk-thegraph";
302092
302098
  async function codegenTheGraph(env2, subgraphNames) {
@@ -302120,6 +302126,9 @@ async function codegenTheGraph(env2, subgraphNames) {
302120
302126
  template.push("", "const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });");
302121
302127
  for (const gqlEndpoint of toGenerate) {
302122
302128
  const name3 = getSubgraphName(gqlEndpoint);
302129
+ if (!name3) {
302130
+ continue;
302131
+ }
302123
302132
  const introspectionVariable = getVariableName(`${name3}Introspection`);
302124
302133
  note(`Generating TheGraph subgraph ${name3}`);
302125
302134
  await generateSchema({
@@ -302182,45 +302191,6 @@ export const theGraphGraphql = ${graphqlVariable};
302182
302191
  // src/commands/codegen/codegen-tsconfig.ts
302183
302192
  import { writeFile as writeFile5 } from "node:fs/promises";
302184
302193
 
302185
- // src/commands/codegen/utils/test-gql-endpoint.ts
302186
- async function testGqlEndpoint({
302187
- accessToken,
302188
- hasuraAdminSecret,
302189
- gqlEndpoint,
302190
- isHasura = false
302191
- }) {
302192
- if (!gqlEndpoint) {
302193
- return false;
302194
- }
302195
- try {
302196
- await graphqlFetchWithRetry(gqlEndpoint, {
302197
- method: "POST",
302198
- headers: appendHeaders({
302199
- "Content-Type": "application/json",
302200
- ...isHasura ? { "x-hasura-admin-secret": hasuraAdminSecret ?? "" } : {}
302201
- }, {
302202
- "x-auth-token": accessToken
302203
- }),
302204
- body: JSON.stringify({
302205
- query: `
302206
- query {
302207
- __schema {
302208
- types {
302209
- name
302210
- }
302211
- }
302212
- }
302213
- `
302214
- })
302215
- });
302216
- return true;
302217
- } catch (err) {
302218
- const error44 = err;
302219
- note(`GraphQL endpoint '${gqlEndpoint}' is not reachable: ${error44.message}`, "warn");
302220
- return false;
302221
- }
302222
- }
302223
-
302224
302194
  // ../../node_modules/get-tsconfig/dist/index.mjs
302225
302195
  import m6 from "node:path";
302226
302196
  import te3 from "node:fs";
@@ -303112,6 +303082,45 @@ var Xe2 = o7(({ config: e10, path: t8 }, s7 = Oe2()) => {
303112
303082
  };
303113
303083
  }, "createFilesMatcher");
303114
303084
 
303085
+ // src/commands/codegen/utils/test-gql-endpoint.ts
303086
+ async function testGqlEndpoint({
303087
+ accessToken,
303088
+ hasuraAdminSecret,
303089
+ gqlEndpoint,
303090
+ isHasura = false
303091
+ }) {
303092
+ if (!gqlEndpoint) {
303093
+ return false;
303094
+ }
303095
+ try {
303096
+ await graphqlFetchWithRetry(gqlEndpoint, {
303097
+ method: "POST",
303098
+ headers: appendHeaders({
303099
+ "Content-Type": "application/json",
303100
+ ...isHasura ? { "x-hasura-admin-secret": hasuraAdminSecret ?? "" } : {}
303101
+ }, {
303102
+ "x-auth-token": accessToken
303103
+ }),
303104
+ body: JSON.stringify({
303105
+ query: `
303106
+ query {
303107
+ __schema {
303108
+ types {
303109
+ name
303110
+ }
303111
+ }
303112
+ }
303113
+ `
303114
+ })
303115
+ });
303116
+ return true;
303117
+ } catch (err) {
303118
+ const error44 = err;
303119
+ note(`GraphQL endpoint '${gqlEndpoint}' is not reachable: ${error44.message}`, "warn");
303120
+ return false;
303121
+ }
303122
+ }
303123
+
303115
303124
  // src/commands/codegen/codegen-tsconfig.ts
303116
303125
  async function codegenTsconfig(env2, thegraphSubgraphNames) {
303117
303126
  const tsconfig = he4();
@@ -303189,13 +303198,16 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
303189
303198
  ] : [],
303190
303199
  ...thegraph.filter((endpoint) => endpoint.success).map(({ endpoint }) => {
303191
303200
  const name3 = getSubgraphName(endpoint);
303201
+ if (!name3) {
303202
+ return;
303203
+ }
303192
303204
  return {
303193
303205
  name: `thegraph-${name3}`,
303194
303206
  schema: `the-graph-schema-${name3}.graphql`,
303195
303207
  tadaOutputLocation: `the-graph-env-${name3}.d.ts`,
303196
303208
  tadaTurboLocation: `the-graph-cache-${name3}.d.ts`
303197
303209
  };
303198
- }),
303210
+ }).filter((schema) => schema !== undefined),
303199
303211
  ...portal ? [
303200
303212
  {
303201
303213
  name: "portal",
@@ -320674,6 +320686,118 @@ function codegenCommand() {
320674
320686
  });
320675
320687
  }
320676
320688
 
320689
+ // ../utils/dist/logging.js
320690
+ var maskTokens6 = (output) => {
320691
+ return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
320692
+ };
320693
+ function createLogger3(options = {}) {
320694
+ const { level = "warn", prefix = "" } = options;
320695
+ const logLevels = {
320696
+ debug: 0,
320697
+ info: 1,
320698
+ warn: 2,
320699
+ error: 3,
320700
+ none: 4
320701
+ };
320702
+ const currentLevelValue = logLevels[level];
320703
+ const formatArgs = (args) => {
320704
+ if (args.length === 0 || args.every((arg) => arg === undefined || arg === null)) {
320705
+ return "";
320706
+ }
320707
+ const formatted = args.map((arg) => {
320708
+ if (arg instanceof Error) {
320709
+ return `
320710
+ ${arg.stack || arg.message}`;
320711
+ }
320712
+ if (typeof arg === "object" && arg !== null) {
320713
+ return `
320714
+ ${JSON.stringify(arg, null, 2)}`;
320715
+ }
320716
+ return ` ${String(arg)}`;
320717
+ }).join("");
320718
+ return `, args:${formatted}`;
320719
+ };
320720
+ const shouldLog = (level$1) => {
320721
+ return logLevels[level$1] >= currentLevelValue;
320722
+ };
320723
+ return {
320724
+ debug: (message, ...args) => {
320725
+ if (shouldLog("debug")) {
320726
+ console.debug(`\x1B[32m${prefix}[DEBUG] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
320727
+ }
320728
+ },
320729
+ info: (message, ...args) => {
320730
+ if (shouldLog("info")) {
320731
+ console.info(`\x1B[34m${prefix}[INFO] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
320732
+ }
320733
+ },
320734
+ warn: (message, ...args) => {
320735
+ if (shouldLog("warn")) {
320736
+ console.warn(`\x1B[33m${prefix}[WARN] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
320737
+ }
320738
+ },
320739
+ error: (message, ...args) => {
320740
+ if (shouldLog("error")) {
320741
+ console.error(`\x1B[31m${prefix}[ERROR] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
320742
+ }
320743
+ }
320744
+ };
320745
+ }
320746
+ var logger3 = createLogger3();
320747
+ function truncate(value4, maxLength) {
320748
+ if (value4.length <= maxLength) {
320749
+ return value4;
320750
+ }
320751
+ return `${value4.slice(0, maxLength)}...`;
320752
+ }
320753
+ var WARNING_THRESHOLD = 500;
320754
+ var TRUNCATE_LENGTH = 50;
320755
+ function requestLogger(logger$1, name3, fn) {
320756
+ return async (...args) => {
320757
+ const start3 = Date.now();
320758
+ try {
320759
+ return await fn(...args);
320760
+ } finally {
320761
+ const end = Date.now();
320762
+ const duration6 = end - start3;
320763
+ const body = extractInfoFromBody(args[1]?.body ?? "{}");
320764
+ const message = `${name3} path: ${args[0]}, took ${formatDuration(duration6)}`;
320765
+ if (duration6 > WARNING_THRESHOLD) {
320766
+ logger$1.warn(message, body);
320767
+ } else {
320768
+ logger$1.info(message, body);
320769
+ }
320770
+ }
320771
+ };
320772
+ }
320773
+ function formatDuration(duration6) {
320774
+ return duration6 < 1000 ? `${duration6}ms` : `${(duration6 / 1000).toFixed(3)}s`;
320775
+ }
320776
+ function extractInfoFromBody(body) {
320777
+ try {
320778
+ const parsedBody = typeof body === "string" ? JSON.parse(body) : body;
320779
+ if (parsedBody === null || parsedBody === undefined || Object.keys(parsedBody).length === 0) {
320780
+ return null;
320781
+ }
320782
+ const dataToKeep = {};
320783
+ if ("query" in parsedBody) {
320784
+ dataToKeep.query = truncate(parsedBody.query, TRUNCATE_LENGTH);
320785
+ }
320786
+ if ("variables" in parsedBody) {
320787
+ dataToKeep.variables = truncate(JSON.stringify(parsedBody.variables), TRUNCATE_LENGTH);
320788
+ }
320789
+ if ("operationName" in parsedBody) {
320790
+ dataToKeep.operationName = truncate(parsedBody.operationName, TRUNCATE_LENGTH);
320791
+ }
320792
+ if (Object.keys(dataToKeep).length > 0) {
320793
+ return JSON.stringify(dataToKeep);
320794
+ }
320795
+ return truncate(JSON.stringify(parsedBody || "{}"), TRUNCATE_LENGTH);
320796
+ } catch {
320797
+ return "{}";
320798
+ }
320799
+ }
320800
+
320677
320801
  // ../../node_modules/@inquirer/confirm/dist/esm/index.js
320678
320802
  function getBooleanValue(value4, defaultValue) {
320679
320803
  let answer = defaultValue !== false;
@@ -320970,35 +321094,6 @@ function isRunning(service) {
320970
321094
  return service === undefined || service?.status === "COMPLETED";
320971
321095
  }
320972
321096
 
320973
- // src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
320974
- async function blockchainNodeOrLoadBalancerPrompt({
320975
- env: env2,
320976
- nodes,
320977
- loadBalancers,
320978
- accept,
320979
- singleOptionMessage,
320980
- promptMessage,
320981
- filterRunningOnly = false,
320982
- isRequired = false
320983
- }) {
320984
- return servicePrompt({
320985
- env: env2,
320986
- services: [...loadBalancers, ...nodes],
320987
- accept,
320988
- envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
320989
- isRequired,
320990
- defaultHandler: async ({ defaultService: defaultNode, choices }) => {
320991
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
320992
- return esm_default3({
320993
- message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
320994
- choices: filteredChoices,
320995
- default: defaultNode
320996
- });
320997
- },
320998
- singleOptionMessage
320999
- });
321000
- }
321001
-
321002
321097
  // src/prompts/cluster-service/blockchain-node.prompt.ts
321003
321098
  async function blockchainNodePrompt({
321004
321099
  env: env2,
@@ -321039,6 +321134,35 @@ async function blockchainNodePrompt({
321039
321134
  });
321040
321135
  }
321041
321136
 
321137
+ // src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
321138
+ async function blockchainNodeOrLoadBalancerPrompt({
321139
+ env: env2,
321140
+ nodes,
321141
+ loadBalancers,
321142
+ accept,
321143
+ singleOptionMessage,
321144
+ promptMessage,
321145
+ filterRunningOnly = false,
321146
+ isRequired = false
321147
+ }) {
321148
+ return servicePrompt({
321149
+ env: env2,
321150
+ services: [...loadBalancers, ...nodes],
321151
+ accept,
321152
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
321153
+ isRequired,
321154
+ defaultHandler: async ({ defaultService: defaultNode, choices }) => {
321155
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
321156
+ return esm_default3({
321157
+ message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
321158
+ choices: filteredChoices,
321159
+ default: defaultNode
321160
+ });
321161
+ },
321162
+ singleOptionMessage
321163
+ });
321164
+ }
321165
+
321042
321166
  // src/prompts/cluster-service/blockscout.prompt.ts
321043
321167
  async function blockscoutPrompt({
321044
321168
  env: env2,
@@ -321512,10 +321636,10 @@ function getBlockchainNetworkChainId(blockchainNetwork) {
321512
321636
  }
321513
321637
 
321514
321638
  // ../utils/dist/retry.js
321515
- var maskTokens6 = (output) => {
321639
+ var maskTokens7 = (output) => {
321516
321640
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
321517
321641
  };
321518
- function createLogger3(options = {}) {
321642
+ function createLogger4(options = {}) {
321519
321643
  const { level = "warn", prefix = "" } = options;
321520
321644
  const logLevels = {
321521
321645
  debug: 0,
@@ -321548,27 +321672,27 @@ ${JSON.stringify(arg, null, 2)}`;
321548
321672
  return {
321549
321673
  debug: (message, ...args) => {
321550
321674
  if (shouldLog("debug")) {
321551
- console.debug(`\x1B[32m${prefix}[DEBUG] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
321675
+ console.debug(`\x1B[32m${prefix}[DEBUG] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321552
321676
  }
321553
321677
  },
321554
321678
  info: (message, ...args) => {
321555
321679
  if (shouldLog("info")) {
321556
- console.info(`\x1B[34m${prefix}[INFO] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
321680
+ console.info(`\x1B[34m${prefix}[INFO] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321557
321681
  }
321558
321682
  },
321559
321683
  warn: (message, ...args) => {
321560
321684
  if (shouldLog("warn")) {
321561
- console.warn(`\x1B[33m${prefix}[WARN] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
321685
+ console.warn(`\x1B[33m${prefix}[WARN] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321562
321686
  }
321563
321687
  },
321564
321688
  error: (message, ...args) => {
321565
321689
  if (shouldLog("error")) {
321566
- console.error(`\x1B[31m${prefix}[ERROR] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
321690
+ console.error(`\x1B[31m${prefix}[ERROR] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321567
321691
  }
321568
321692
  }
321569
321693
  };
321570
321694
  }
321571
- var logger3 = createLogger3();
321695
+ var logger4 = createLogger4();
321572
321696
  async function retryWhenFailed3(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
321573
321697
  let retries = 0;
321574
321698
  const maxAttempts = maxRetries + 1;
@@ -321589,7 +321713,7 @@ async function retryWhenFailed3(fn, maxRetries = 5, initialSleepTime = 1000, sto
321589
321713
  const jitterAmount = initialSleepTime * (Math.random() / 10);
321590
321714
  const delay2 = baseDelay + jitterAmount;
321591
321715
  retries += 1;
321592
- logger3.warn(`An error occurred ${error45.message}, retrying in ${delay2.toFixed(0)}ms (retry ${retries} of ${maxRetries})...`);
321716
+ logger4.warn(`An error occurred ${error45.message}, retrying in ${delay2.toFixed(0)}ms (retry ${retries} of ${maxRetries})...`);
321593
321717
  await new Promise((resolve6) => setTimeout(resolve6, delay2));
321594
321718
  }
321595
321719
  }
@@ -321708,6 +321832,9 @@ function getHdPrivateKeyEnv(service) {
321708
321832
  // ../utils/dist/url.js
321709
321833
  function extractBaseUrlBeforeSegment2(baseUrl, pathSegment) {
321710
321834
  const url5 = new URL(baseUrl);
321835
+ if (pathSegment.trim() === "") {
321836
+ return url5.toString();
321837
+ }
321711
321838
  const segmentIndex = url5.pathname.indexOf(pathSegment);
321712
321839
  return url5.origin + (segmentIndex >= 0 ? url5.pathname.substring(0, segmentIndex) : url5.pathname);
321713
321840
  }
@@ -321744,7 +321871,7 @@ function getTheGraphUrl(subgraphUrls) {
321744
321871
  }
321745
321872
  function getTheGraphSubgraphNames(subgraphUrls) {
321746
321873
  if (Array.isArray(subgraphUrls) && subgraphUrls.length > 0) {
321747
- return subgraphUrls.map((url5) => getSubgraphName(url5));
321874
+ return subgraphUrls.map((url5) => getSubgraphName(url5)).filter((name3) => name3 !== undefined);
321748
321875
  }
321749
321876
  return [];
321750
321877
  }
@@ -321757,128 +321884,17 @@ function getTheGraphSubgraphUrl(theGraphUrl, subgraphName) {
321757
321884
  return url5.toString();
321758
321885
  }
321759
321886
 
321760
- // ../utils/dist/logging.js
321761
- var maskTokens7 = (output) => {
321762
- return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
321763
- };
321764
- function createLogger4(options = {}) {
321765
- const { level = "warn", prefix = "" } = options;
321766
- const logLevels = {
321767
- debug: 0,
321768
- info: 1,
321769
- warn: 2,
321770
- error: 3,
321771
- none: 4
321772
- };
321773
- const currentLevelValue = logLevels[level];
321774
- const formatArgs = (args) => {
321775
- if (args.length === 0 || args.every((arg) => arg === undefined || arg === null)) {
321776
- return "";
321777
- }
321778
- const formatted = args.map((arg) => {
321779
- if (arg instanceof Error) {
321780
- return `
321781
- ${arg.stack || arg.message}`;
321782
- }
321783
- if (typeof arg === "object" && arg !== null) {
321784
- return `
321785
- ${JSON.stringify(arg, null, 2)}`;
321786
- }
321787
- return ` ${String(arg)}`;
321788
- }).join("");
321789
- return `, args:${formatted}`;
321790
- };
321791
- const shouldLog = (level$1) => {
321792
- return logLevels[level$1] >= currentLevelValue;
321793
- };
321794
- return {
321795
- debug: (message, ...args) => {
321796
- if (shouldLog("debug")) {
321797
- console.debug(`\x1B[32m${prefix}[DEBUG] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321798
- }
321799
- },
321800
- info: (message, ...args) => {
321801
- if (shouldLog("info")) {
321802
- console.info(`\x1B[34m${prefix}[INFO] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321803
- }
321804
- },
321805
- warn: (message, ...args) => {
321806
- if (shouldLog("warn")) {
321807
- console.warn(`\x1B[33m${prefix}[WARN] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321808
- }
321809
- },
321810
- error: (message, ...args) => {
321811
- if (shouldLog("error")) {
321812
- console.error(`\x1B[31m${prefix}[ERROR] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321813
- }
321814
- }
321815
- };
321816
- }
321817
- var logger4 = createLogger4();
321818
- function truncate(value4, maxLength) {
321819
- if (value4.length <= maxLength) {
321820
- return value4;
321821
- }
321822
- return `${value4.slice(0, maxLength)}...`;
321823
- }
321824
- var WARNING_THRESHOLD = 500;
321825
- var TRUNCATE_LENGTH = 50;
321826
- function requestLogger(logger$1, name3, fn) {
321827
- return async (...args) => {
321828
- const start3 = Date.now();
321829
- try {
321830
- return await fn(...args);
321831
- } finally {
321832
- const end = Date.now();
321833
- const duration6 = end - start3;
321834
- const body = extractInfoFromBody(args[1]?.body ?? "{}");
321835
- const message = `${name3} path: ${args[0]}, took ${formatDuration(duration6)}`;
321836
- if (duration6 > WARNING_THRESHOLD) {
321837
- logger$1.warn(message, body);
321838
- } else {
321839
- logger$1.info(message, body);
321840
- }
321841
- }
321842
- };
321843
- }
321844
- function formatDuration(duration6) {
321845
- return duration6 < 1000 ? `${duration6}ms` : `${(duration6 / 1000).toFixed(3)}s`;
321846
- }
321847
- function extractInfoFromBody(body) {
321848
- try {
321849
- const parsedBody = typeof body === "string" ? JSON.parse(body) : body;
321850
- if (parsedBody === null || parsedBody === undefined || Object.keys(parsedBody).length === 0) {
321851
- return null;
321852
- }
321853
- const dataToKeep = {};
321854
- if ("query" in parsedBody) {
321855
- dataToKeep.query = truncate(parsedBody.query, TRUNCATE_LENGTH);
321856
- }
321857
- if ("variables" in parsedBody) {
321858
- dataToKeep.variables = truncate(JSON.stringify(parsedBody.variables), TRUNCATE_LENGTH);
321859
- }
321860
- if ("operationName" in parsedBody) {
321861
- dataToKeep.operationName = truncate(parsedBody.operationName, TRUNCATE_LENGTH);
321862
- }
321863
- if (Object.keys(dataToKeep).length > 0) {
321864
- return JSON.stringify(dataToKeep);
321865
- }
321866
- return truncate(JSON.stringify(parsedBody || "{}"), TRUNCATE_LENGTH);
321867
- } catch {
321868
- return "{}";
321869
- }
321870
- }
321871
-
321872
321887
  // src/prompts/standalone/service-value.prompt.ts
321873
321888
  async function serviceValuePrompt({
321874
321889
  defaultValue,
321875
321890
  example,
321876
321891
  message = "Enter service value:",
321877
321892
  accept = false,
321878
- isCi = is_in_ci_default
321893
+ isCi = is_in_ci_default,
321894
+ required: required5 = true
321879
321895
  }) {
321880
321896
  const autoAccept = !!accept || isCi;
321881
- if (autoAccept && defaultValue) {
321897
+ if (autoAccept && (defaultValue || !required5)) {
321882
321898
  return defaultValue;
321883
321899
  }
321884
321900
  if (isCi) {
@@ -322190,7 +322206,8 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
322190
322206
  message: "What are the names of the subgraphs you want to connect to (separated by commas)?",
322191
322207
  example: "subgraph-1,subgraph-2",
322192
322208
  defaultValue: getTheGraphSubgraphNames(env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS).join(","),
322193
- type: "value"
322209
+ type: "value",
322210
+ required: false
322194
322211
  },
322195
322212
  {
322196
322213
  id: "portalGraphqlEndpoint",
@@ -322258,7 +322275,8 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
322258
322275
  message,
322259
322276
  example,
322260
322277
  defaultValue,
322261
- accept: acceptDefaults
322278
+ accept: acceptDefaults,
322279
+ required: prompt.required
322262
322280
  });
322263
322281
  selectedServices[id] = {
322264
322282
  label: prompt.label,
@@ -322270,7 +322288,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
322270
322288
  table("Configuration", Object.values(selectedServices).filter((item) => !item.isSecret).map((item) => {
322271
322289
  return {
322272
322290
  name: item.label,
322273
- value: item.result ? maskTokens7(item.result) : undefined
322291
+ value: item.result ? maskTokens6(item.result) : undefined
322274
322292
  };
322275
322293
  }).filter(Boolean));
322276
322294
  }
@@ -322283,7 +322301,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
322283
322301
  SETTLEMINT_HASURA_ENDPOINT: selectedServices.hasuraEndpoint?.result,
322284
322302
  SETTLEMINT_HASURA_ADMIN_SECRET: selectedServices.hasuraAdminSecret?.result,
322285
322303
  SETTLEMINT_HASURA_DATABASE_URL: selectedServices.hasuraDatabaseUrl?.result,
322286
- SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: theGraphUrl && theGraphSubgraphNames ? theGraphSubgraphNames.split(",").map((name3) => getTheGraphSubgraphUrl(theGraphUrl, name3)) : [],
322304
+ SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: theGraphUrl && theGraphSubgraphNames ? theGraphSubgraphNames.split(",").map((name3) => getTheGraphSubgraphUrl(theGraphUrl, name3)) : theGraphUrl ? [theGraphUrl] : [],
322287
322305
  SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: theGraphSubgraphNames ? theGraphSubgraphNames.split(",")[0] : undefined,
322288
322306
  SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT: selectedServices.portalGraphqlEndpoint?.result,
322289
322307
  SETTLEMINT_MINIO_ENDPOINT: selectedServices.minioEndpoint?.result,
@@ -326132,8 +326150,12 @@ function createCommand2() {
326132
326150
  }
326133
326151
 
326134
326152
  // ../hasura/dist/hasura.js
326135
- async function trackAllTables(databaseName, client) {
326153
+ async function trackAllTables(databaseName, client, tableOptions = {
326154
+ includeSchemas: undefined,
326155
+ excludeSchemas: undefined
326156
+ }) {
326136
326157
  const messages = [];
326158
+ const { includeSchemas, excludeSchemas } = tableOptions;
326137
326159
  const getTablesResult = await client({
326138
326160
  type: "pg_get_source_tables",
326139
326161
  args: { source: databaseName }
@@ -326152,21 +326174,30 @@ async function trackAllTables(databaseName, client) {
326152
326174
  await client({
326153
326175
  type: "pg_untrack_tables",
326154
326176
  args: {
326155
- tables: tables.map((table2) => ({ table: table2.name })),
326177
+ tables: tables.map((table2) => ({ table: table2 })),
326156
326178
  allow_warnings: true
326157
326179
  }
326158
326180
  });
326181
+ const tablesToTrack = tables.filter((table2) => {
326182
+ if (Array.isArray(includeSchemas)) {
326183
+ return includeSchemas.includes(table2.schema);
326184
+ }
326185
+ if (Array.isArray(excludeSchemas)) {
326186
+ return !excludeSchemas.includes(table2.schema);
326187
+ }
326188
+ return true;
326189
+ });
326159
326190
  const trackResult = await client({
326160
326191
  type: "pg_track_tables",
326161
326192
  args: {
326162
- tables: tables.map((table2) => ({ table: table2.name })),
326193
+ tables: tablesToTrack.map((table2) => ({ table: table2 })),
326163
326194
  allow_warnings: true
326164
326195
  }
326165
326196
  });
326166
326197
  if (!trackResult.ok) {
326167
326198
  throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
326168
326199
  }
326169
- messages.push(`Successfully tracked ${tables.length} tables`);
326200
+ messages.push(`Successfully tracked ${tablesToTrack.length} tables`);
326170
326201
  return {
326171
326202
  result: "success",
326172
326203
  messages
@@ -330898,4 +330929,4 @@ async function sdkCliCommand(argv = process.argv) {
330898
330929
  // src/cli.ts
330899
330930
  sdkCliCommand();
330900
330931
 
330901
- //# debugId=78429EBA4B7E2D6064756E2164756E21
330932
+ //# debugId=651F00D66F15F8EF64756E2164756E21