postchain-client 1.3.1 → 1.3.2

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.
@@ -50224,9 +50224,21 @@ function nextEndpoint(endpointPool) {
50224
50224
  return endpointPool[Math.floor(Math.random() * endpointPool.length)];
50225
50225
  }
50226
50226
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
50227
+ function convertToPrintable(responseObject) {
50228
+ if (typeof responseObject === "bigint") {
50229
+ return responseObject + "n";
50230
+ }
50231
+ else if (typeof responseObject === "object") {
50232
+ return JSON.stringify(responseObject, (key, value) => typeof value === "bigint" ? value + "n" : value);
50233
+ }
50234
+ else {
50235
+ return responseObject;
50236
+ }
50237
+ }
50227
50238
 
50228
50239
  var restclientutil = /*#__PURE__*/Object.freeze({
50229
50240
  __proto__: null,
50241
+ convertToPrintable: convertToPrintable,
50230
50242
  getBrid: getBrid,
50231
50243
  nextEndpoint: nextEndpoint,
50232
50244
  requestWithRetry: requestWithRetry,
@@ -50380,9 +50392,7 @@ function validateInput(endpointPool, failOverConfig) {
50380
50392
  */
50381
50393
  function handleGetResponse(error$1, statusCode, responseObject, callback) {
50382
50394
  try {
50383
- const responseObjectPrintable = typeof responseObject === "object"
50384
- ? JSON.stringify(responseObject)
50385
- : responseObject;
50395
+ const responseObjectPrintable = convertToPrintable(responseObject);
50386
50396
  debug(`error: ${error$1}, status code: ${statusCode}, response body: ${responseObjectPrintable}`);
50387
50397
  if (error$1) {
50388
50398
  callback(error$1, null);
@@ -50411,9 +50421,7 @@ function handleGetResponse(error$1, statusCode, responseObject, callback) {
50411
50421
  * @param callback the callback function to propagate the error and response back to the caller
50412
50422
  */
50413
50423
  function handlePostResponse(error$1, statusCode, responseObject, callback) {
50414
- const responseObjectPrintable = typeof responseObject === "object"
50415
- ? JSON.stringify(responseObject)
50416
- : responseObject;
50424
+ const responseObjectPrintable = convertToPrintable(responseObject);
50417
50425
  debug(`error: ${error$1}, status code: ${statusCode}, response body: ${responseObjectPrintable}`);
50418
50426
  try {
50419
50427
  if (error$1) {