@punks/backend-core 0.0.79 → 0.0.81
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 +28 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/logging/service.d.ts +1 -0
- package/dist/cjs/types/utils/index.d.ts +1 -1
- package/dist/cjs/types/utils/objects/index.d.ts +2 -0
- package/dist/cjs/types/utils/objects/types.d.ts +3 -0
- package/dist/cjs/types/utils/strings.d.ts +1 -0
- package/dist/esm/index.js +27 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/logging/service.d.ts +1 -0
- package/dist/esm/types/utils/index.d.ts +1 -1
- package/dist/esm/types/utils/objects/index.d.ts +2 -0
- package/dist/esm/types/utils/objects/types.d.ts +3 -0
- package/dist/esm/types/utils/strings.d.ts +1 -0
- package/dist/index.d.ts +8 -1
- package/package.json +1 -1
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;
|
|
@@ -439,6 +440,24 @@ const jsonSerialize = (obj, options) => {
|
|
|
439
440
|
const spaces = prettify ? 2 : undefined;
|
|
440
441
|
return JSON.stringify(obj, replacer, spaces);
|
|
441
442
|
};
|
|
443
|
+
function replaceUndefinedWithNull(obj) {
|
|
444
|
+
if (obj === undefined) {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
if (typeof obj !== "object" || obj === null) {
|
|
448
|
+
return obj;
|
|
449
|
+
}
|
|
450
|
+
if (Array.isArray(obj)) {
|
|
451
|
+
return obj.map(replaceUndefinedWithNull);
|
|
452
|
+
}
|
|
453
|
+
const newObj = {};
|
|
454
|
+
for (const key in obj) {
|
|
455
|
+
if (obj.hasOwnProperty(key)) {
|
|
456
|
+
newObj[key] = replaceUndefinedWithNull(obj[key]);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return newObj;
|
|
460
|
+
}
|
|
442
461
|
|
|
443
462
|
const encodeUtf8 = (value) => Buffer.from(value).toString("utf-8");
|
|
444
463
|
const decodeUtf8 = (value) => Buffer.from(value, "utf-8");
|
|
@@ -31256,15 +31275,15 @@ class InternalLogger {
|
|
|
31256
31275
|
if (meta && typeof meta === "string") {
|
|
31257
31276
|
return meta;
|
|
31258
31277
|
}
|
|
31259
|
-
const serializedMeta = meta
|
|
31260
|
-
|
|
31261
|
-
|
|
31262
|
-
|
|
31263
|
-
})
|
|
31264
|
-
: undefined;
|
|
31278
|
+
const serializedMeta = jsonSerialize(meta, {
|
|
31279
|
+
prettify: true,
|
|
31280
|
+
stripBinaryData: true,
|
|
31281
|
+
});
|
|
31265
31282
|
switch (options.serialization) {
|
|
31266
31283
|
case exports.MetaSerializationType.JSON:
|
|
31267
|
-
return
|
|
31284
|
+
return options.maxMetaLength
|
|
31285
|
+
? truncateString(serializedMeta, options.maxMetaLength, "...")
|
|
31286
|
+
: serializedMeta;
|
|
31268
31287
|
case exports.MetaSerializationType.None:
|
|
31269
31288
|
default:
|
|
31270
31289
|
return serializedMeta ? JSON.parse(serializedMeta) : undefined;
|
|
@@ -31533,6 +31552,7 @@ exports.processArrayDifferences = processArrayDifferences;
|
|
|
31533
31552
|
exports.processArrayItemMove = processArrayItemMove;
|
|
31534
31553
|
exports.range = range;
|
|
31535
31554
|
exports.removeUndefinedProps = removeUndefinedProps;
|
|
31555
|
+
exports.replaceUndefinedWithNull = replaceUndefinedWithNull;
|
|
31536
31556
|
exports.selectMany = selectMany;
|
|
31537
31557
|
exports.serializeQueryString = serializeQueryString;
|
|
31538
31558
|
exports.sleep = sleep;
|
|
@@ -31552,5 +31572,6 @@ exports.toTitleCase = toTitleCase;
|
|
|
31552
31572
|
exports.trim = trim$1;
|
|
31553
31573
|
exports.trimEnd = trimEnd;
|
|
31554
31574
|
exports.trimStart = trimStart;
|
|
31575
|
+
exports.truncateString = truncateString;
|
|
31555
31576
|
exports.updateQueryParameters = updateQueryParameters;
|
|
31556
31577
|
//# sourceMappingURL=index.js.map
|