@punks/backend-core 0.0.80 → 0.0.82

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/cjs/index.js CHANGED
@@ -333,6 +333,7 @@ const multipleSplit = (str, separators) => {
333
333
  .join("|");
334
334
  return str.split(new RegExp(regexPattern));
335
335
  };
336
+ const truncateString = (str, maxLength, filler = "...") => (str.length > maxLength ? str.substring(0, maxLength) + filler : str);
336
337
 
337
338
  const removeUndefinedProps = (obj, options = { recursive: false }) => {
338
339
  const { recursive } = options;
@@ -31274,15 +31275,15 @@ class InternalLogger {
31274
31275
  if (meta && typeof meta === "string") {
31275
31276
  return meta;
31276
31277
  }
31277
- const serializedMeta = meta
31278
- ? jsonSerialize(meta, {
31279
- prettify: true,
31280
- stripBinaryData: true,
31281
- })
31282
- : undefined;
31278
+ const serializedMeta = jsonSerialize(meta, {
31279
+ prettify: true,
31280
+ stripBinaryData: true,
31281
+ });
31283
31282
  switch (options.serialization) {
31284
31283
  case exports.MetaSerializationType.JSON:
31285
- return serializedMeta;
31284
+ return serializedMeta && options.maxMetaLength
31285
+ ? truncateString(serializedMeta, options.maxMetaLength, "...")
31286
+ : serializedMeta;
31286
31287
  case exports.MetaSerializationType.None:
31287
31288
  default:
31288
31289
  return serializedMeta ? JSON.parse(serializedMeta) : undefined;
@@ -31571,5 +31572,6 @@ exports.toTitleCase = toTitleCase;
31571
31572
  exports.trim = trim$1;
31572
31573
  exports.trimEnd = trimEnd;
31573
31574
  exports.trimStart = trimStart;
31575
+ exports.truncateString = truncateString;
31574
31576
  exports.updateQueryParameters = updateQueryParameters;
31575
31577
  //# sourceMappingURL=index.js.map