postchain-client 1.3.0 → 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.
@@ -1056,6 +1056,9 @@ BinaryTreeFactory$1.prototype.innerHandleLeaf = function (leaf, paths) {
1056
1056
  if (typeof leaf === 'number') {
1057
1057
  return this.handlePrimitiveLeaf(leaf, paths);
1058
1058
  }
1059
+ if (typeof leaf === 'bigint') {
1060
+ return this.handlePrimitiveLeaf(leaf, paths);
1061
+ }
1059
1062
  if (typeof leaf === 'boolean') {
1060
1063
  return this.handlePrimitiveLeaf(leaf ? 1 : 0, paths);
1061
1064
  }
@@ -2148,9 +2151,21 @@ function nextEndpoint(endpointPool) {
2148
2151
  return endpointPool[Math.floor(Math.random() * endpointPool.length)];
2149
2152
  }
2150
2153
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
2154
+ function convertToPrintable(responseObject) {
2155
+ if (typeof responseObject === "bigint") {
2156
+ return responseObject + "n";
2157
+ }
2158
+ else if (typeof responseObject === "object") {
2159
+ return JSON.stringify(responseObject, (key, value) => typeof value === "bigint" ? value + "n" : value);
2160
+ }
2161
+ else {
2162
+ return responseObject;
2163
+ }
2164
+ }
2151
2165
 
2152
2166
  var restclientutil = /*#__PURE__*/Object.freeze({
2153
2167
  __proto__: null,
2168
+ convertToPrintable: convertToPrintable,
2154
2169
  getBrid: getBrid,
2155
2170
  nextEndpoint: nextEndpoint,
2156
2171
  requestWithRetry: requestWithRetry,
@@ -2304,9 +2319,7 @@ function validateInput(endpointPool, failOverConfig) {
2304
2319
  */
2305
2320
  function handleGetResponse(error$1, statusCode, responseObject, callback) {
2306
2321
  try {
2307
- const responseObjectPrintable = typeof responseObject === "object"
2308
- ? JSON.stringify(responseObject)
2309
- : responseObject;
2322
+ const responseObjectPrintable = convertToPrintable(responseObject);
2310
2323
  debug(`error: ${error$1}, status code: ${statusCode}, response body: ${responseObjectPrintable}`);
2311
2324
  if (error$1) {
2312
2325
  callback(error$1, null);
@@ -2335,9 +2348,7 @@ function handleGetResponse(error$1, statusCode, responseObject, callback) {
2335
2348
  * @param callback the callback function to propagate the error and response back to the caller
2336
2349
  */
2337
2350
  function handlePostResponse(error$1, statusCode, responseObject, callback) {
2338
- const responseObjectPrintable = typeof responseObject === "object"
2339
- ? JSON.stringify(responseObject)
2340
- : responseObject;
2351
+ const responseObjectPrintable = convertToPrintable(responseObject);
2341
2352
  debug(`error: ${error$1}, status code: ${statusCode}, response body: ${responseObjectPrintable}`);
2342
2353
  try {
2343
2354
  if (error$1) {