@settlemint/sdk-cli 2.3.2-pr90f9d5ad → 2.3.2-pr9af086a1

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 CHANGED
@@ -54139,8 +54139,8 @@ ${lanes.join(`
54139
54139
  function sysLog(s) {
54140
54140
  return curSysLog(s);
54141
54141
  }
54142
- function setSysLog(logger) {
54143
- curSysLog = logger;
54142
+ function setSysLog(logger3) {
54143
+ curSysLog = logger3;
54144
54144
  }
54145
54145
  function createDirectoryWatcherSupportingRecursive({
54146
54146
  watchDirectory,
@@ -204833,10 +204833,10 @@ ${options.prefix}` : `
204833
204833
  return [];
204834
204834
  }
204835
204835
  var ThrottledOperations = class _ThrottledOperations {
204836
- constructor(host, logger) {
204836
+ constructor(host, logger3) {
204837
204837
  this.host = host;
204838
204838
  this.pendingTimeouts = /* @__PURE__ */ new Map;
204839
- this.logger = logger.hasLevel(3) ? logger : undefined;
204839
+ this.logger = logger3.hasLevel(3) ? logger3 : undefined;
204840
204840
  }
204841
204841
  schedule(operationId, delay, cb) {
204842
204842
  const pendingTimeout = this.pendingTimeouts.get(operationId);
@@ -204864,10 +204864,10 @@ ${options.prefix}` : `
204864
204864
  }
204865
204865
  };
204866
204866
  var GcTimer = class _GcTimer {
204867
- constructor(host, delay, logger) {
204867
+ constructor(host, delay, logger3) {
204868
204868
  this.host = host;
204869
204869
  this.delay = delay;
204870
- this.logger = logger;
204870
+ this.logger = logger3;
204871
204871
  }
204872
204872
  scheduleCollect() {
204873
204873
  if (!this.host.gc || this.timerId !== undefined) {
@@ -210796,11 +210796,11 @@ Dynamic files must always be opened with service's current directory or service
210796
210796
  return edits.every((edit) => textSpanEnd(edit.span) < pos);
210797
210797
  }
210798
210798
  var CommandNames = CommandTypes;
210799
- function formatMessage2(msg, logger, byteLength, newLine) {
210800
- const verboseLogging = logger.hasLevel(3);
210799
+ function formatMessage2(msg, logger3, byteLength, newLine) {
210800
+ const verboseLogging = logger3.hasLevel(3);
210801
210801
  const json2 = JSON.stringify(msg);
210802
210802
  if (verboseLogging) {
210803
- logger.info(`${msg.type}:${stringifyIndented(msg)}`);
210803
+ logger3.info(`${msg.type}:${stringifyIndented(msg)}`);
210804
210804
  }
210805
210805
  const len = byteLength(json2, "utf8");
210806
210806
  return `Content-Length: ${1 + len}\r
@@ -210927,10 +210927,10 @@ ${json2}${newLine}`;
210927
210927
  const info = infos && firstOrUndefined(infos);
210928
210928
  return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
210929
210929
  }
210930
- function getReferencesWorker(projects, defaultProject, initialLocation, useCaseSensitiveFileNames2, logger) {
210930
+ function getReferencesWorker(projects, defaultProject, initialLocation, useCaseSensitiveFileNames2, logger3) {
210931
210931
  var _a, _b;
210932
210932
  const perProjectResults = getPerProjectReferences(projects, defaultProject, initialLocation, getDefinitionLocation(defaultProject, initialLocation, false), mapDefinitionInProject, (project, position) => {
210933
- logger.info(`Finding references to ${position.fileName} position ${position.pos} in project ${project.getProjectName()}`);
210933
+ logger3.info(`Finding references to ${position.fileName} position ${position.pos} in project ${project.getProjectName()}`);
210934
210934
  return project.getLanguageService().findReferences(position.fileName, position.pos);
210935
210935
  }, (referencedSymbol, cb) => {
210936
210936
  cb(documentSpanLocation(referencedSymbol.definition));
@@ -214310,9 +214310,9 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
214310
214310
  }
214311
214311
  };
214312
214312
  var _TypingsInstallerAdapter = class _TypingsInstallerAdapter2 {
214313
- constructor(telemetryEnabled, logger, host, globalTypingsCacheLocation, event, maxActiveRequestCount) {
214313
+ constructor(telemetryEnabled, logger3, host, globalTypingsCacheLocation, event, maxActiveRequestCount) {
214314
214314
  this.telemetryEnabled = telemetryEnabled;
214315
- this.logger = logger;
214315
+ this.logger = logger3;
214316
214316
  this.host = host;
214317
214317
  this.globalTypingsCacheLocation = globalTypingsCacheLocation;
214318
214318
  this.event = event;
@@ -254078,7 +254078,7 @@ function pruneCurrentEnv(currentEnv, env2) {
254078
254078
  var package_default = {
254079
254079
  name: "@settlemint/sdk-cli",
254080
254080
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
254081
- version: "2.3.2-pr90f9d5ad",
254081
+ version: "2.3.2-pr9af086a1",
254082
254082
  type: "module",
254083
254083
  private: false,
254084
254084
  license: "FSL-1.1-MIT",
@@ -254127,8 +254127,8 @@ var package_default = {
254127
254127
  "@inquirer/input": "4.1.10",
254128
254128
  "@inquirer/password": "4.0.13",
254129
254129
  "@inquirer/select": "4.2.1",
254130
- "@settlemint/sdk-js": "2.3.2-pr90f9d5ad",
254131
- "@settlemint/sdk-utils": "2.3.2-pr90f9d5ad",
254130
+ "@settlemint/sdk-js": "2.3.2-pr9af086a1",
254131
+ "@settlemint/sdk-utils": "2.3.2-pr9af086a1",
254132
254132
  "@types/node": "22.15.21",
254133
254133
  "@types/semver": "7.7.0",
254134
254134
  "@types/which": "3.0.4",
@@ -255460,24 +255460,83 @@ function table(title, data) {
255460
255460
  }
255461
255461
 
255462
255462
  // ../utils/dist/http.mjs
255463
+ var maskTokens3 = (output) => {
255464
+ return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
255465
+ };
255466
+ function createLogger(options = {}) {
255467
+ const { level = "warn", prefix = "" } = options;
255468
+ const logLevels = {
255469
+ debug: 0,
255470
+ info: 1,
255471
+ warn: 2,
255472
+ error: 3,
255473
+ none: 4
255474
+ };
255475
+ const currentLevelValue = logLevels[level];
255476
+ const formatArgs = (args) => {
255477
+ if (args.length === 0 || args.every((arg) => arg === undefined || arg === null)) {
255478
+ return "";
255479
+ }
255480
+ const formatted = args.map((arg) => {
255481
+ if (arg instanceof Error) {
255482
+ return `
255483
+ ${arg.stack || arg.message}`;
255484
+ }
255485
+ if (typeof arg === "object" && arg !== null) {
255486
+ return `
255487
+ ${JSON.stringify(arg, null, 2)}`;
255488
+ }
255489
+ return ` ${String(arg)}`;
255490
+ }).join("");
255491
+ return `, args:${formatted}`;
255492
+ };
255493
+ const shouldLog = (level2) => {
255494
+ return logLevels[level2] >= currentLevelValue;
255495
+ };
255496
+ return {
255497
+ debug: (message, ...args) => {
255498
+ if (shouldLog("debug")) {
255499
+ console.debug(`\x1B[32m${prefix}[DEBUG] ${maskTokens3(message)}${maskTokens3(formatArgs(args))}\x1B[0m`);
255500
+ }
255501
+ },
255502
+ info: (message, ...args) => {
255503
+ if (shouldLog("info")) {
255504
+ console.info(`\x1B[34m${prefix}[INFO] ${maskTokens3(message)}${maskTokens3(formatArgs(args))}\x1B[0m`);
255505
+ }
255506
+ },
255507
+ warn: (message, ...args) => {
255508
+ if (shouldLog("warn")) {
255509
+ console.warn(`\x1B[33m${prefix}[WARN] ${maskTokens3(message)}${maskTokens3(formatArgs(args))}\x1B[0m`);
255510
+ }
255511
+ },
255512
+ error: (message, ...args) => {
255513
+ if (shouldLog("error")) {
255514
+ console.error(`\x1B[31m${prefix}[ERROR] ${maskTokens3(message)}${maskTokens3(formatArgs(args))}\x1B[0m`);
255515
+ }
255516
+ }
255517
+ };
255518
+ }
255519
+ var logger = createLogger();
255463
255520
  async function retryWhenFailed(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
255464
255521
  let attempt = 0;
255465
- while (attempt < maxRetries) {
255522
+ while (attempt < maxRetries + 1) {
255466
255523
  try {
255467
255524
  return await fn();
255468
255525
  } catch (e) {
255526
+ const error35 = e;
255469
255527
  if (typeof stopOnError === "function") {
255470
- const error35 = e;
255471
255528
  if (stopOnError(error35)) {
255472
255529
  throw error35;
255473
255530
  }
255474
255531
  }
255475
- attempt += 1;
255476
255532
  if (attempt >= maxRetries) {
255477
255533
  throw e;
255478
255534
  }
255479
- const jitter = Math.random();
255480
- const delay = 2 ** attempt * initialSleepTime * jitter;
255535
+ const baseDelay = 2 ** attempt * initialSleepTime;
255536
+ const jitterAmount = initialSleepTime * (Math.random() / 10);
255537
+ const delay = baseDelay + jitterAmount;
255538
+ attempt += 1;
255539
+ logger.warn(`An error occurred ${error35.message}, retrying in ${delay.toFixed(0)}ms...`);
255481
255540
  await new Promise((resolve) => setTimeout(resolve, delay));
255482
255541
  }
255483
255542
  }
@@ -258650,14 +258709,14 @@ async function getPackageManagerExecutable(targetDir) {
258650
258709
  function shouldPrint2() {
258651
258710
  return process.env.SETTLEMINT_DISABLE_TERMINAL !== "true";
258652
258711
  }
258653
- var maskTokens3 = (output) => {
258712
+ var maskTokens4 = (output) => {
258654
258713
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
258655
258714
  };
258656
258715
  var note2 = (message, level = "info") => {
258657
258716
  if (!shouldPrint2()) {
258658
258717
  return;
258659
258718
  }
258660
- const maskedMessage = maskTokens3(message);
258719
+ const maskedMessage = maskTokens4(message);
258661
258720
  console.log("");
258662
258721
  if (level === "warn") {
258663
258722
  console.warn(yellowBright(maskedMessage));
@@ -258718,24 +258777,83 @@ function extractJsonObject(value2) {
258718
258777
  }
258719
258778
  return tryParseJson3(result[0]);
258720
258779
  }
258780
+ var maskTokens5 = (output) => {
258781
+ return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
258782
+ };
258783
+ function createLogger2(options = {}) {
258784
+ const { level = "warn", prefix = "" } = options;
258785
+ const logLevels = {
258786
+ debug: 0,
258787
+ info: 1,
258788
+ warn: 2,
258789
+ error: 3,
258790
+ none: 4
258791
+ };
258792
+ const currentLevelValue = logLevels[level];
258793
+ const formatArgs = (args) => {
258794
+ if (args.length === 0 || args.every((arg) => arg === undefined || arg === null)) {
258795
+ return "";
258796
+ }
258797
+ const formatted = args.map((arg) => {
258798
+ if (arg instanceof Error) {
258799
+ return `
258800
+ ${arg.stack || arg.message}`;
258801
+ }
258802
+ if (typeof arg === "object" && arg !== null) {
258803
+ return `
258804
+ ${JSON.stringify(arg, null, 2)}`;
258805
+ }
258806
+ return ` ${String(arg)}`;
258807
+ }).join("");
258808
+ return `, args:${formatted}`;
258809
+ };
258810
+ const shouldLog = (level2) => {
258811
+ return logLevels[level2] >= currentLevelValue;
258812
+ };
258813
+ return {
258814
+ debug: (message, ...args) => {
258815
+ if (shouldLog("debug")) {
258816
+ console.debug(`\x1B[32m${prefix}[DEBUG] ${maskTokens5(message)}${maskTokens5(formatArgs(args))}\x1B[0m`);
258817
+ }
258818
+ },
258819
+ info: (message, ...args) => {
258820
+ if (shouldLog("info")) {
258821
+ console.info(`\x1B[34m${prefix}[INFO] ${maskTokens5(message)}${maskTokens5(formatArgs(args))}\x1B[0m`);
258822
+ }
258823
+ },
258824
+ warn: (message, ...args) => {
258825
+ if (shouldLog("warn")) {
258826
+ console.warn(`\x1B[33m${prefix}[WARN] ${maskTokens5(message)}${maskTokens5(formatArgs(args))}\x1B[0m`);
258827
+ }
258828
+ },
258829
+ error: (message, ...args) => {
258830
+ if (shouldLog("error")) {
258831
+ console.error(`\x1B[31m${prefix}[ERROR] ${maskTokens5(message)}${maskTokens5(formatArgs(args))}\x1B[0m`);
258832
+ }
258833
+ }
258834
+ };
258835
+ }
258836
+ var logger2 = createLogger2();
258721
258837
  async function retryWhenFailed2(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
258722
258838
  let attempt = 0;
258723
- while (attempt < maxRetries) {
258839
+ while (attempt < maxRetries + 1) {
258724
258840
  try {
258725
258841
  return await fn();
258726
258842
  } catch (e3) {
258843
+ const error36 = e3;
258727
258844
  if (typeof stopOnError === "function") {
258728
- const error36 = e3;
258729
258845
  if (stopOnError(error36)) {
258730
258846
  throw error36;
258731
258847
  }
258732
258848
  }
258733
- attempt += 1;
258734
258849
  if (attempt >= maxRetries) {
258735
258850
  throw e3;
258736
258851
  }
258737
- const jitter = Math.random();
258738
- const delay = 2 ** attempt * initialSleepTime * jitter;
258852
+ const baseDelay = 2 ** attempt * initialSleepTime;
258853
+ const jitterAmount = initialSleepTime * (Math.random() / 10);
258854
+ const delay = baseDelay + jitterAmount;
258855
+ attempt += 1;
258856
+ logger2.warn(`An error occurred ${error36.message}, retrying in ${delay.toFixed(0)}ms...`);
258739
258857
  await new Promise((resolve3) => setTimeout(resolve3, delay));
258740
258858
  }
258741
258859
  }
@@ -269849,4 +269967,4 @@ async function sdkCliCommand(argv = process.argv) {
269849
269967
  // src/cli.ts
269850
269968
  sdkCliCommand();
269851
269969
 
269852
- //# debugId=9EA2F3D19998A85F64756E2164756E21
269970
+ //# debugId=BFF164B365FE900A64756E2164756E21