infront-logger 1.1.22 → 1.1.23

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/index.es.js CHANGED
@@ -2681,14 +2681,26 @@ const TOKEN_STRING_RE = /"(access_token|refresh_token|id_token|bearer|authorizat
2681
2681
  function redactString(str) {
2682
2682
  return str.replace(JWT_RE, "*****").replace(TOKEN_STRING_RE, (_, key) => `"${key}":"*****"`);
2683
2683
  }
2684
+ function toSerializable(value) {
2685
+ if (typeof value.toJSON !== "function") return value;
2686
+ try {
2687
+ return value.toJSON();
2688
+ } catch (err) {
2689
+ return value;
2690
+ }
2691
+ }
2684
2692
  function redact$3(value, seen = /* @__PURE__ */ new WeakSet()) {
2685
2693
  if (value === null || value === void 0) return value;
2686
2694
  if (typeof value === "string") return redactString(value);
2695
+ if (typeof value === "function") return void 0;
2687
2696
  if (typeof value !== "object") return value;
2688
2697
  if (seen.has(value)) return "[Circular]";
2689
2698
  seen.add(value);
2690
2699
  let out;
2691
- if (Array.isArray(value)) {
2700
+ const serializable = toSerializable(value);
2701
+ if (serializable !== value) {
2702
+ out = redact$3(serializable, seen);
2703
+ } else if (Array.isArray(value)) {
2692
2704
  out = value.map((item) => redact$3(item, seen));
2693
2705
  } else {
2694
2706
  out = {};
package/dist/index.umd.js CHANGED
@@ -2682,14 +2682,26 @@
2682
2682
  function redactString(str) {
2683
2683
  return str.replace(JWT_RE, "*****").replace(TOKEN_STRING_RE, (_, key) => `"${key}":"*****"`);
2684
2684
  }
2685
+ function toSerializable(value) {
2686
+ if (typeof value.toJSON !== "function") return value;
2687
+ try {
2688
+ return value.toJSON();
2689
+ } catch (err) {
2690
+ return value;
2691
+ }
2692
+ }
2685
2693
  function redact$3(value, seen = /* @__PURE__ */ new WeakSet()) {
2686
2694
  if (value === null || value === void 0) return value;
2687
2695
  if (typeof value === "string") return redactString(value);
2696
+ if (typeof value === "function") return void 0;
2688
2697
  if (typeof value !== "object") return value;
2689
2698
  if (seen.has(value)) return "[Circular]";
2690
2699
  seen.add(value);
2691
2700
  let out;
2692
- if (Array.isArray(value)) {
2701
+ const serializable = toSerializable(value);
2702
+ if (serializable !== value) {
2703
+ out = redact$3(serializable, seen);
2704
+ } else if (Array.isArray(value)) {
2693
2705
  out = value.map((item) => redact$3(item, seen));
2694
2706
  } else {
2695
2707
  out = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infront-logger",
3
- "version": "1.1.22",
3
+ "version": "1.1.23",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist"