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

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 +217 -248
  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-pr7eaa1e59",
265086
+ version: "2.4.1-pr919979d8",
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-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",
265137
+ "@settlemint/sdk-hasura": "2.4.1-pr919979d8",
265138
+ "@settlemint/sdk-js": "2.4.1-pr919979d8",
265139
+ "@settlemint/sdk-utils": "2.4.1-pr919979d8",
265140
+ "@settlemint/sdk-viem": "2.4.1-pr919979d8",
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, createHasuraMetadataClient } from "${PACKAGE_NAME}";
301871
+ const hasuraTemplate = `import { createHasuraClient } 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,6 +301975,16 @@ 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
+
301978
301988
  // ../utils/dist/index.js
301979
301989
  var maskTokens5 = (output) => {
301980
301990
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
@@ -302073,26 +302083,10 @@ function replaceUnderscoresAndHyphensWithSpaces(s6) {
302073
302083
  }
302074
302084
  function extractBaseUrlBeforeSegment(baseUrl, pathSegment) {
302075
302085
  const url4 = new URL(baseUrl);
302076
- if (pathSegment.trim() === "") {
302077
- return url4.toString();
302078
- }
302079
302086
  const segmentIndex = url4.pathname.indexOf(pathSegment);
302080
302087
  return url4.origin + (segmentIndex >= 0 ? url4.pathname.substring(0, segmentIndex) : url4.pathname);
302081
302088
  }
302082
302089
 
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
-
302096
302090
  // src/commands/codegen/codegen-the-graph.ts
302097
302091
  var PACKAGE_NAME3 = "@settlemint/sdk-thegraph";
302098
302092
  async function codegenTheGraph(env2, subgraphNames) {
@@ -302126,9 +302120,6 @@ async function codegenTheGraph(env2, subgraphNames) {
302126
302120
  template.push("", "const logger = createLogger({ level: process.env.SETTLEMINT_LOG_LEVEL as LogLevel });");
302127
302121
  for (const gqlEndpoint of toGenerate) {
302128
302122
  const name3 = getSubgraphName(gqlEndpoint);
302129
- if (!name3) {
302130
- continue;
302131
- }
302132
302123
  const introspectionVariable = getVariableName(`${name3}Introspection`);
302133
302124
  note(`Generating TheGraph subgraph ${name3}`);
302134
302125
  await generateSchema({
@@ -302191,6 +302182,45 @@ export const theGraphGraphql = ${graphqlVariable};
302191
302182
  // src/commands/codegen/codegen-tsconfig.ts
302192
302183
  import { writeFile as writeFile5 } from "node:fs/promises";
302193
302184
 
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
+
302194
302224
  // ../../node_modules/get-tsconfig/dist/index.mjs
302195
302225
  import m6 from "node:path";
302196
302226
  import te3 from "node:fs";
@@ -303082,45 +303112,6 @@ var Xe2 = o7(({ config: e10, path: t8 }, s7 = Oe2()) => {
303082
303112
  };
303083
303113
  }, "createFilesMatcher");
303084
303114
 
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
-
303124
303115
  // src/commands/codegen/codegen-tsconfig.ts
303125
303116
  async function codegenTsconfig(env2, thegraphSubgraphNames) {
303126
303117
  const tsconfig = he4();
@@ -303198,16 +303189,13 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
303198
303189
  ] : [],
303199
303190
  ...thegraph.filter((endpoint) => endpoint.success).map(({ endpoint }) => {
303200
303191
  const name3 = getSubgraphName(endpoint);
303201
- if (!name3) {
303202
- return;
303203
- }
303204
303192
  return {
303205
303193
  name: `thegraph-${name3}`,
303206
303194
  schema: `the-graph-schema-${name3}.graphql`,
303207
303195
  tadaOutputLocation: `the-graph-env-${name3}.d.ts`,
303208
303196
  tadaTurboLocation: `the-graph-cache-${name3}.d.ts`
303209
303197
  };
303210
- }).filter((schema) => schema !== undefined),
303198
+ }),
303211
303199
  ...portal ? [
303212
303200
  {
303213
303201
  name: "portal",
@@ -320686,118 +320674,6 @@ function codegenCommand() {
320686
320674
  });
320687
320675
  }
320688
320676
 
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
-
320801
320677
  // ../../node_modules/@inquirer/confirm/dist/esm/index.js
320802
320678
  function getBooleanValue(value4, defaultValue) {
320803
320679
  let answer = defaultValue !== false;
@@ -321094,72 +320970,72 @@ function isRunning(service) {
321094
320970
  return service === undefined || service?.status === "COMPLETED";
321095
320971
  }
321096
320972
 
321097
- // src/prompts/cluster-service/blockchain-node.prompt.ts
321098
- async function blockchainNodePrompt({
320973
+ // src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
320974
+ async function blockchainNodeOrLoadBalancerPrompt({
321099
320975
  env: env2,
321100
320976
  nodes,
320977
+ loadBalancers,
321101
320978
  accept,
321102
320979
  singleOptionMessage,
321103
320980
  promptMessage,
321104
320981
  filterRunningOnly = false,
321105
- isRequired = false,
321106
- allowAll = false
320982
+ isRequired = false
321107
320983
  }) {
321108
320984
  return servicePrompt({
321109
320985
  env: env2,
321110
- services: nodes,
320986
+ services: [...loadBalancers, ...nodes],
321111
320987
  accept,
321112
- envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
320988
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
321113
320989
  isRequired,
321114
320990
  defaultHandler: async ({ defaultService: defaultNode, choices }) => {
321115
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
321116
- return Array.isArray(node) ? true : isRunning(node);
321117
- }).map((item) => {
321118
- if (Array.isArray(item.value)) {
321119
- return {
321120
- ...item,
321121
- value: item.value.filter(isRunning)
321122
- };
321123
- }
321124
- return item;
321125
- }) : choices;
320991
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
321126
320992
  return esm_default3({
321127
- message: promptMessage ?? "Which blockchain node do you want to connect to?",
320993
+ message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
321128
320994
  choices: filteredChoices,
321129
320995
  default: defaultNode
321130
320996
  });
321131
320997
  },
321132
- singleOptionMessage,
321133
- allowAll
320998
+ singleOptionMessage
321134
320999
  });
321135
321000
  }
321136
321001
 
321137
- // src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
321138
- async function blockchainNodeOrLoadBalancerPrompt({
321002
+ // src/prompts/cluster-service/blockchain-node.prompt.ts
321003
+ async function blockchainNodePrompt({
321139
321004
  env: env2,
321140
321005
  nodes,
321141
- loadBalancers,
321142
321006
  accept,
321143
321007
  singleOptionMessage,
321144
321008
  promptMessage,
321145
321009
  filterRunningOnly = false,
321146
- isRequired = false
321010
+ isRequired = false,
321011
+ allowAll = false
321147
321012
  }) {
321148
321013
  return servicePrompt({
321149
321014
  env: env2,
321150
- services: [...loadBalancers, ...nodes],
321015
+ services: nodes,
321151
321016
  accept,
321152
- envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
321017
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
321153
321018
  isRequired,
321154
321019
  defaultHandler: async ({ defaultService: defaultNode, choices }) => {
321155
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
321020
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
321021
+ return Array.isArray(node) ? true : isRunning(node);
321022
+ }).map((item) => {
321023
+ if (Array.isArray(item.value)) {
321024
+ return {
321025
+ ...item,
321026
+ value: item.value.filter(isRunning)
321027
+ };
321028
+ }
321029
+ return item;
321030
+ }) : choices;
321156
321031
  return esm_default3({
321157
- message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
321032
+ message: promptMessage ?? "Which blockchain node do you want to connect to?",
321158
321033
  choices: filteredChoices,
321159
321034
  default: defaultNode
321160
321035
  });
321161
321036
  },
321162
- singleOptionMessage
321037
+ singleOptionMessage,
321038
+ allowAll
321163
321039
  });
321164
321040
  }
321165
321041
 
@@ -321636,10 +321512,10 @@ function getBlockchainNetworkChainId(blockchainNetwork) {
321636
321512
  }
321637
321513
 
321638
321514
  // ../utils/dist/retry.js
321639
- var maskTokens7 = (output) => {
321515
+ var maskTokens6 = (output) => {
321640
321516
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
321641
321517
  };
321642
- function createLogger4(options = {}) {
321518
+ function createLogger3(options = {}) {
321643
321519
  const { level = "warn", prefix = "" } = options;
321644
321520
  const logLevels = {
321645
321521
  debug: 0,
@@ -321672,27 +321548,27 @@ ${JSON.stringify(arg, null, 2)}`;
321672
321548
  return {
321673
321549
  debug: (message, ...args) => {
321674
321550
  if (shouldLog("debug")) {
321675
- console.debug(`\x1B[32m${prefix}[DEBUG] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321551
+ console.debug(`\x1B[32m${prefix}[DEBUG] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
321676
321552
  }
321677
321553
  },
321678
321554
  info: (message, ...args) => {
321679
321555
  if (shouldLog("info")) {
321680
- console.info(`\x1B[34m${prefix}[INFO] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321556
+ console.info(`\x1B[34m${prefix}[INFO] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
321681
321557
  }
321682
321558
  },
321683
321559
  warn: (message, ...args) => {
321684
321560
  if (shouldLog("warn")) {
321685
- console.warn(`\x1B[33m${prefix}[WARN] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321561
+ console.warn(`\x1B[33m${prefix}[WARN] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
321686
321562
  }
321687
321563
  },
321688
321564
  error: (message, ...args) => {
321689
321565
  if (shouldLog("error")) {
321690
- console.error(`\x1B[31m${prefix}[ERROR] ${maskTokens7(message)}${maskTokens7(formatArgs(args))}\x1B[0m`);
321566
+ console.error(`\x1B[31m${prefix}[ERROR] ${maskTokens6(message)}${maskTokens6(formatArgs(args))}\x1B[0m`);
321691
321567
  }
321692
321568
  }
321693
321569
  };
321694
321570
  }
321695
- var logger4 = createLogger4();
321571
+ var logger3 = createLogger3();
321696
321572
  async function retryWhenFailed3(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
321697
321573
  let retries = 0;
321698
321574
  const maxAttempts = maxRetries + 1;
@@ -321713,7 +321589,7 @@ async function retryWhenFailed3(fn, maxRetries = 5, initialSleepTime = 1000, sto
321713
321589
  const jitterAmount = initialSleepTime * (Math.random() / 10);
321714
321590
  const delay2 = baseDelay + jitterAmount;
321715
321591
  retries += 1;
321716
- logger4.warn(`An error occurred ${error45.message}, retrying in ${delay2.toFixed(0)}ms (retry ${retries} of ${maxRetries})...`);
321592
+ logger3.warn(`An error occurred ${error45.message}, retrying in ${delay2.toFixed(0)}ms (retry ${retries} of ${maxRetries})...`);
321717
321593
  await new Promise((resolve6) => setTimeout(resolve6, delay2));
321718
321594
  }
321719
321595
  }
@@ -321832,9 +321708,6 @@ function getHdPrivateKeyEnv(service) {
321832
321708
  // ../utils/dist/url.js
321833
321709
  function extractBaseUrlBeforeSegment2(baseUrl, pathSegment) {
321834
321710
  const url5 = new URL(baseUrl);
321835
- if (pathSegment.trim() === "") {
321836
- return url5.toString();
321837
- }
321838
321711
  const segmentIndex = url5.pathname.indexOf(pathSegment);
321839
321712
  return url5.origin + (segmentIndex >= 0 ? url5.pathname.substring(0, segmentIndex) : url5.pathname);
321840
321713
  }
@@ -321871,7 +321744,7 @@ function getTheGraphUrl(subgraphUrls) {
321871
321744
  }
321872
321745
  function getTheGraphSubgraphNames(subgraphUrls) {
321873
321746
  if (Array.isArray(subgraphUrls) && subgraphUrls.length > 0) {
321874
- return subgraphUrls.map((url5) => getSubgraphName(url5)).filter((name3) => name3 !== undefined);
321747
+ return subgraphUrls.map((url5) => getSubgraphName(url5));
321875
321748
  }
321876
321749
  return [];
321877
321750
  }
@@ -321884,17 +321757,128 @@ function getTheGraphSubgraphUrl(theGraphUrl, subgraphName) {
321884
321757
  return url5.toString();
321885
321758
  }
321886
321759
 
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
+
321887
321872
  // src/prompts/standalone/service-value.prompt.ts
321888
321873
  async function serviceValuePrompt({
321889
321874
  defaultValue,
321890
321875
  example,
321891
321876
  message = "Enter service value:",
321892
321877
  accept = false,
321893
- isCi = is_in_ci_default,
321894
- required: required5 = true
321878
+ isCi = is_in_ci_default
321895
321879
  }) {
321896
321880
  const autoAccept = !!accept || isCi;
321897
- if (autoAccept && (defaultValue || !required5)) {
321881
+ if (autoAccept && defaultValue) {
321898
321882
  return defaultValue;
321899
321883
  }
321900
321884
  if (isCi) {
@@ -322206,8 +322190,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
322206
322190
  message: "What are the names of the subgraphs you want to connect to (separated by commas)?",
322207
322191
  example: "subgraph-1,subgraph-2",
322208
322192
  defaultValue: getTheGraphSubgraphNames(env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS).join(","),
322209
- type: "value",
322210
- required: false
322193
+ type: "value"
322211
322194
  },
322212
322195
  {
322213
322196
  id: "portalGraphqlEndpoint",
@@ -322275,8 +322258,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
322275
322258
  message,
322276
322259
  example,
322277
322260
  defaultValue,
322278
- accept: acceptDefaults,
322279
- required: prompt.required
322261
+ accept: acceptDefaults
322280
322262
  });
322281
322263
  selectedServices[id] = {
322282
322264
  label: prompt.label,
@@ -322288,7 +322270,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
322288
322270
  table("Configuration", Object.values(selectedServices).filter((item) => !item.isSecret).map((item) => {
322289
322271
  return {
322290
322272
  name: item.label,
322291
- value: item.result ? maskTokens6(item.result) : undefined
322273
+ value: item.result ? maskTokens7(item.result) : undefined
322292
322274
  };
322293
322275
  }).filter(Boolean));
322294
322276
  }
@@ -322301,7 +322283,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
322301
322283
  SETTLEMINT_HASURA_ENDPOINT: selectedServices.hasuraEndpoint?.result,
322302
322284
  SETTLEMINT_HASURA_ADMIN_SECRET: selectedServices.hasuraAdminSecret?.result,
322303
322285
  SETTLEMINT_HASURA_DATABASE_URL: selectedServices.hasuraDatabaseUrl?.result,
322304
- SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: theGraphUrl && theGraphSubgraphNames ? theGraphSubgraphNames.split(",").map((name3) => getTheGraphSubgraphUrl(theGraphUrl, name3)) : theGraphUrl ? [theGraphUrl] : [],
322286
+ SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: theGraphUrl && theGraphSubgraphNames ? theGraphSubgraphNames.split(",").map((name3) => getTheGraphSubgraphUrl(theGraphUrl, name3)) : [],
322305
322287
  SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: theGraphSubgraphNames ? theGraphSubgraphNames.split(",")[0] : undefined,
322306
322288
  SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT: selectedServices.portalGraphqlEndpoint?.result,
322307
322289
  SETTLEMINT_MINIO_ENDPOINT: selectedServices.minioEndpoint?.result,
@@ -326150,12 +326132,8 @@ function createCommand2() {
326150
326132
  }
326151
326133
 
326152
326134
  // ../hasura/dist/hasura.js
326153
- async function trackAllTables(databaseName, client, tableOptions = {
326154
- includeSchemas: undefined,
326155
- excludeSchemas: undefined
326156
- }) {
326135
+ async function trackAllTables(databaseName, client) {
326157
326136
  const messages = [];
326158
- const { includeSchemas, excludeSchemas } = tableOptions;
326159
326137
  const getTablesResult = await client({
326160
326138
  type: "pg_get_source_tables",
326161
326139
  args: { source: databaseName }
@@ -326174,30 +326152,21 @@ async function trackAllTables(databaseName, client, tableOptions = {
326174
326152
  await client({
326175
326153
  type: "pg_untrack_tables",
326176
326154
  args: {
326177
- tables: tables.map((table2) => ({ table: table2 })),
326155
+ tables: tables.map((table2) => ({ table: table2.name })),
326178
326156
  allow_warnings: true
326179
326157
  }
326180
326158
  });
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
- });
326190
326159
  const trackResult = await client({
326191
326160
  type: "pg_track_tables",
326192
326161
  args: {
326193
- tables: tablesToTrack.map((table2) => ({ table: table2 })),
326162
+ tables: tables.map((table2) => ({ table: table2.name })),
326194
326163
  allow_warnings: true
326195
326164
  }
326196
326165
  });
326197
326166
  if (!trackResult.ok) {
326198
326167
  throw new Error(`Failed to track tables: ${JSON.stringify(trackResult.data)}`);
326199
326168
  }
326200
- messages.push(`Successfully tracked ${tablesToTrack.length} tables`);
326169
+ messages.push(`Successfully tracked ${tables.length} tables`);
326201
326170
  return {
326202
326171
  result: "success",
326203
326172
  messages
@@ -330929,4 +330898,4 @@ async function sdkCliCommand(argv = process.argv) {
330929
330898
  // src/cli.ts
330930
330899
  sdkCliCommand();
330931
330900
 
330932
- //# debugId=651F00D66F15F8EF64756E2164756E21
330901
+ //# debugId=CD4D5DE3B550511A64756E2164756E21