@walletconnect/logger
Advanced tools
Comparing version 2.1.0-b750420 to 2.1.0-cab1ccc
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("pino"),w=require("stream");function C(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var u=C(s);const c={level:"info"},l="custom_context",a=1e3*1024;class h{constructor(e){this.capacityInBytes=e,this.currentSizeInBytes=0,this.head=0,this.array=[]}calculateStringSize(e){return new TextEncoder().encode(e).length}enqueue(e){const t=this.calculateStringSize(e);if(t>this.capacityInBytes)throw new Error("Item size exceeds total capacity.");let o=this.array.length;for(;this.currentSizeInBytes+t>this.capacityInBytes;){const n=this.array[this.head];this.currentSizeInBytes-=this.calculateStringSize(n),o=this.head,this.array[this.head]="",this.head=(this.head+1)%Math.max(this.array.length,1)}o>=this.array.length?this.array.push(e):this.array[o]=e,this.currentSizeInBytes+=t}get(e){if(e<0||e>=this.array.length)throw new Error("Index out of bounds");return this.array[(this.head+e)%this.array.length]}[Symbol.iterator](){let e=0;const t=()=>{if(e>=this.array.length)return{done:!0,value:null};const o=this.get(e);return e++,o?{done:!1,value:o}:t()};return{next:t}}}class L{constructor(e,t=a){this.level=e??"error",this.levelValue=s.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new h(t)}forwardToConsole(e,t){t===s.levels.values.error?console.error(e):t===s.levels.values.warn?console.warn(e):t===s.levels.values.debug?console.debug(e):t===s.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.enqueue(JSON.stringify({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new h(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){return this.logs.enqueue(JSON.stringify({extraMetadata:e})),new Blob(this.getLogArray(),{type:"application/json"})}}class S{constructor(e,t=a){this.baseChunkLogger=new L(e,t),window&&(window.downloadLogsBlob=o=>{this.downloadLogsBlobInBrowser(o??{clientId:"N/A"}),this.clearLogs()})}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class _ extends w.Writable{constructor(e,t=a){super({objectMode:!0}),this.baseChunkLogger=new L(e,t)}_write(e,t,o){try{this.baseChunkLogger.appendToLogs(e),o()}catch(n){o(n)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var O=Object.defineProperty,B=Object.defineProperties,I=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,y=(r,e,t)=>e in r?O(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))T.call(e,t)&&y(r,t,e[t]);if(d)for(var t of d(e))E.call(e,t)&&y(r,t,e[t]);return r},i=(r,e)=>B(r,I(e));function m(r){return i(g({},r),{level:r?.level||c.level})}function b(r,e=l){return r[e]||""}function v(r,e,t=l){return r[t]=e,r}function f(r,e=l){let t="";return typeof r.bindings>"u"?t=b(r,e):t=r.bindings().context||"",t}function p(r,e,t=l){const o=f(r,t);return o.trim()?`${o}/${e}`:e}function x(r,e,t=l){const o=p(r,e,t),n=r.child({context:o});return v(n,o,t)}function k(r){var e,t;const o=new S((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(i(g({},r.opts),{level:"trace",browser:i(g({},(t=r.opts)==null?void 0:t.browser),{write:n=>o.write(n)})})),chunkLoggerController:o}}function A(r){var e;const t=new _((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(i(g({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}Object.defineProperty(exports,"pino",{enumerable:!0,get:function(){return u.default}}),exports.MAX_LOG_SIZE_IN_BYTES_DEFAULT=a,exports.PINO_CUSTOM_CONTEXT_KEY=l,exports.PINO_LOGGER_DEFAULTS=c,exports.formatChildLoggerContext=p,exports.generateChildLogger=x,exports.generateClientLogger=k,exports.generateServerLogger=A,exports.getBrowserLoggerContext=b,exports.getDefaultLoggerOptions=m,exports.getLoggerContext=f,exports.setBrowserLoggerContext=v; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("pino"),w=require("stream");function C(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var u=C(n);const h={level:"info"},s="custom_context",i=1e3*1024;class I{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class c{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new I(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class d{constructor(e,t=i){this.level=e??"error",this.levelValue=n.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new c(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===n.levels.values.error?console.error(e):t===n.levels.values.warn?console.warn(e):t===n.levels.values.debug?console.debug(e):t===n.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(JSON.stringify({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new c(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){return this.logs.append(JSON.stringify({extraMetadata:e})),new Blob(this.getLogArray(),{type:"application/json"})}}class S{constructor(e,t=i){this.baseChunkLogger=new d(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class B extends w.Writable{constructor(e,t=i){super({objectMode:!0}),this.baseChunkLogger=new d(e,t)}_write(e,t,o){try{this.baseChunkLogger.appendToLogs(e),o()}catch(l){o(l)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var x=Object.defineProperty,T=Object.defineProperties,m=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,f=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))E.call(e,t)&&f(r,t,e[t]);if(L)for(var t of L(e))z.call(e,t)&&f(r,t,e[t]);return r},a=(r,e)=>T(r,m(e));function A(r){return a(g({},r),{level:r?.level||h.level})}function v(r,e=s){return r[e]||""}function p(r,e,t=s){return r[t]=e,r}function b(r,e=s){let t="";return typeof r.bindings>"u"?t=v(r,e):t=r.bindings().context||"",t}function y(r,e,t=s){const o=b(r,t);return o.trim()?`${o}/${e}`:e}function k(r,e,t=s){const o=y(r,e,t),l=r.child({context:o});return p(l,o,t)}function O(r){var e,t;const o=new S((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(a(g({},r.opts),{level:"trace",browser:a(g({},(t=r.opts)==null?void 0:t.browser),{write:l=>o.write(l)})})),chunkLoggerController:o}}function _(r){var e;const t=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:u.default(a(g({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function N(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?_(r):O(r)}Object.defineProperty(exports,"pino",{enumerable:!0,get:function(){return u.default}}),exports.MAX_LOG_SIZE_IN_BYTES_DEFAULT=i,exports.PINO_CUSTOM_CONTEXT_KEY=s,exports.PINO_LOGGER_DEFAULTS=h,exports.formatChildLoggerContext=y,exports.generateChildLogger=k,exports.generateClientLogger=O,exports.generateServerLogger=_,exports.getBrowserLoggerContext=v,exports.getDefaultLoggerOptions=A,exports.getLoggerContext=b,exports.getPlatformLogger=N,exports.setBrowserLoggerContext=p; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import c,{levels as l}from"pino";import{default as M}from"pino";import{Writable as f}from"stream";const h={level:"info"},s="custom_context",a=1e3*1024;class u{constructor(e){this.capacityInBytes=e,this.currentSizeInBytes=0,this.head=0,this.array=[]}calculateStringSize(e){return new TextEncoder().encode(e).length}enqueue(e){const t=this.calculateStringSize(e);if(t>this.capacityInBytes)throw new Error("Item size exceeds total capacity.");let o=this.array.length;for(;this.currentSizeInBytes+t>this.capacityInBytes;){const n=this.array[this.head];this.currentSizeInBytes-=this.calculateStringSize(n),o=this.head,this.array[this.head]="",this.head=(this.head+1)%Math.max(this.array.length,1)}o>=this.array.length?this.array.push(e):this.array[o]=e,this.currentSizeInBytes+=t}get(e){if(e<0||e>=this.array.length)throw new Error("Index out of bounds");return this.array[(this.head+e)%this.array.length]}[Symbol.iterator](){let e=0;const t=()=>{if(e>=this.array.length)return{done:!0,value:null};const o=this.get(e);return e++,o?{done:!1,value:o}:t()};return{next:t}}}class d{constructor(e,t=a){this.level=e??"error",this.levelValue=l.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new u(t)}forwardToConsole(e,t){t===l.values.error?console.error(e):t===l.values.warn?console.warn(e):t===l.values.debug?console.debug(e):t===l.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.enqueue(JSON.stringify({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new u(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){return this.logs.enqueue(JSON.stringify({extraMetadata:e})),new Blob(this.getLogArray(),{type:"application/json"})}}class S{constructor(e,t=a){this.baseChunkLogger=new d(e,t),window&&(window.downloadLogsBlob=o=>{this.downloadLogsBlobInBrowser(o??{clientId:"N/A"}),this.clearLogs()})}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class C extends f{constructor(e,t=a){super({objectMode:!0}),this.baseChunkLogger=new d(e,t)}_write(e,t,o){try{this.baseChunkLogger.appendToLogs(e),o()}catch(n){o(n)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var B=Object.defineProperty,I=Object.defineProperties,O=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,y=(r,e,t)=>e in r?B(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,i=(r,e)=>{for(var t in e||(e={}))m.call(e,t)&&y(r,t,e[t]);if(L)for(var t of L(e))x.call(e,t)&&y(r,t,e[t]);return r},g=(r,e)=>I(r,O(e));function T(r){return g(i({},r),{level:r?.level||h.level})}function b(r,e=s){return r[e]||""}function p(r,e,t=s){return r[t]=e,r}function w(r,e=s){let t="";return typeof r.bindings>"u"?t=b(r,e):t=r.bindings().context||"",t}function v(r,e,t=s){const o=w(r,t);return o.trim()?`${o}/${e}`:e}function _(r,e,t=s){const o=v(r,e,t),n=r.child({context:o});return p(n,o,t)}function k(r){var e,t;const o=new S((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:c(g(i({},r.opts),{level:"trace",browser:g(i({},(t=r.opts)==null?void 0:t.browser),{write:n=>o.write(n)})})),chunkLoggerController:o}}function E(r){var e;const t=new C((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:c(g(i({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}export{a as MAX_LOG_SIZE_IN_BYTES_DEFAULT,s as PINO_CUSTOM_CONTEXT_KEY,h as PINO_LOGGER_DEFAULTS,v as formatChildLoggerContext,_ as generateChildLogger,k as generateClientLogger,E as generateServerLogger,b as getBrowserLoggerContext,T as getDefaultLoggerOptions,w as getLoggerContext,M as pino,p as setBrowserLoggerContext}; | ||
import h,{levels as i}from"pino";import{default as M}from"pino";import{Writable as C}from"stream";const u={level:"info"},n="custom_context",l=1e3*1024;class I{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class c{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new I(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class d{constructor(e,t=l){this.level=e??"error",this.levelValue=i.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new c(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===i.values.error?console.error(e):t===i.values.warn?console.warn(e):t===i.values.debug?console.debug(e):t===i.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(JSON.stringify({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new c(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){return this.logs.append(JSON.stringify({extraMetadata:e})),new Blob(this.getLogArray(),{type:"application/json"})}}class m{constructor(e,t=l){this.baseChunkLogger=new d(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t)}}class B extends C{constructor(e,t=l){super({objectMode:!0}),this.baseChunkLogger=new d(e,t)}_write(e,t,o){try{this.baseChunkLogger.appendToLogs(e),o()}catch(s){o(s)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var x=Object.defineProperty,S=Object.defineProperties,_=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,p=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))T.call(e,t)&&p(r,t,e[t]);if(L)for(var t of L(e))z.call(e,t)&&p(r,t,e[t]);return r},a=(r,e)=>S(r,_(e));function k(r){return a(g({},r),{level:r?.level||u.level})}function f(r,e=n){return r[e]||""}function b(r,e,t=n){return r[t]=e,r}function v(r,e=n){let t="";return typeof r.bindings>"u"?t=f(r,e):t=r.bindings().context||"",t}function y(r,e,t=n){const o=v(r,t);return o.trim()?`${o}/${e}`:e}function E(r,e,t=n){const o=y(r,e,t),s=r.child({context:o});return b(s,o,t)}function w(r){var e,t;const o=new m((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:h(a(g({},r.opts),{level:"trace",browser:a(g({},(t=r.opts)==null?void 0:t.browser),{write:s=>o.write(s)})})),chunkLoggerController:o}}function O(r){var e;const t=new B((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:h(a(g({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function A(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?O(r):w(r)}export{l as MAX_LOG_SIZE_IN_BYTES_DEFAULT,n as PINO_CUSTOM_CONTEXT_KEY,u as PINO_LOGGER_DEFAULTS,y as formatChildLoggerContext,E as generateChildLogger,w as generateClientLogger,O as generateServerLogger,f as getBrowserLoggerContext,k as getDefaultLoggerOptions,v as getLoggerContext,A as getPlatformLogger,M as pino,b as setBrowserLoggerContext}; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
(function(g,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("stream")):typeof define=="function"&&define.amd?define(["exports","stream"],O):(g=typeof globalThis<"u"?globalThis:g||self,O(g["@walletconnect/logger"]={},g.stream))})(this,function(g,O){"use strict";function Z(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var H=K;function K(e,t,r){var n=r&&r.stringify||Z,i=1;if(typeof e=="object"&&e!==null){var a=t.length+i;if(a===1)return e;var u=new Array(a);u[0]=n(e);for(var d=1;d<a;d++)u[d]=n(t[d]);return u.join(" ")}if(typeof e!="string")return e;var s=t.length;if(s===0)return e;for(var c="",f=1-i,l=-1,S=e&&e.length||0,o=0;o<S;){if(e.charCodeAt(o)===37&&o+1<S){switch(l=l>-1?l:0,e.charCodeAt(o+1)){case 100:case 102:if(f>=s||t[f]==null)break;l<o&&(c+=e.slice(l,o)),c+=Number(t[f]),l=o+2,o++;break;case 105:if(f>=s||t[f]==null)break;l<o&&(c+=e.slice(l,o)),c+=Math.floor(Number(t[f])),l=o+2,o++;break;case 79:case 111:case 106:if(f>=s||t[f]===void 0)break;l<o&&(c+=e.slice(l,o));var h=typeof t[f];if(h==="string"){c+="'"+t[f]+"'",l=o+2,o++;break}if(h==="function"){c+=t[f].name||"<anonymous>",l=o+2,o++;break}c+=n(t[f]),l=o+2,o++;break;case 115:if(f>=s)break;l<o&&(c+=e.slice(l,o)),c+=String(t[f]),l=o+2,o++;break;case 37:l<o&&(c+=e.slice(l,o)),c+="%",l=o+2,o++,f--;break}++f}++o}return l===-1?e:(l<S&&(c+=e.slice(l)),c)}const N=H;var b=v;const _=le().console||{},W={mapHttpRequest:z,mapHttpResponse:z,wrapRequestSerializer:A,wrapResponseSerializer:A,wrapErrorSerializer:A,req:z,res:z,err:ne};function Q(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function v(e){e=e||{},e.browser=e.browser||{};const t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const r=e.browser.write||_;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},i=Q(e.browser.serialize,n);let a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);const u=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),e.enabled===!1&&(e.level="silent");const d=e.level||"info",s=Object.create(r);s.log||(s.log=p),Object.defineProperty(s,"levelVal",{get:f}),Object.defineProperty(s,"level",{get:l,set:S});const c={transmit:t,serialize:i,asObject:e.browser.asObject,levels:u,timestamp:se(e)};s.levels=v.levels,s.level=d,s.setMaxListeners=s.getMaxListeners=s.emit=s.addListener=s.on=s.prependListener=s.once=s.prependOnceListener=s.removeListener=s.removeAllListeners=s.listeners=s.listenerCount=s.eventNames=s.write=s.flush=p,s.serializers=n,s._serialize=i,s._stdErrSerialize=a,s.child=o,t&&(s._logEvent=B());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function l(){return this._level}function S(h){if(h!=="silent"&&!this.levels.values[h])throw Error("unknown level "+h);this._level=h,L(c,s,"error","log"),L(c,s,"fatal","error"),L(c,s,"warn","error"),L(c,s,"info","log"),L(c,s,"debug","log"),L(c,s,"trace","log")}function o(h,j){if(!h)throw new Error("missing bindings for child Pino");j=j||{},i&&h.serializers&&(j.serializers=h.serializers);const Y=j.serializers;if(i&&Y){var I=Object.assign({},n,Y),$=e.browser.serialize===!0?Object.keys(I):i;delete h.serializers,E([h],$,I,this._stdErrSerialize)}function J(y){this._childLevel=(y._childLevel|0)+1,this.error=m(y,h,"error"),this.fatal=m(y,h,"fatal"),this.warn=m(y,h,"warn"),this.info=m(y,h,"info"),this.debug=m(y,h,"debug"),this.trace=m(y,h,"trace"),I&&(this.serializers=I,this._serialize=$),t&&(this._logEvent=B([].concat(y._logEvent.bindings,h)))}return J.prototype=this,new J(this)}return s}v.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},v.stdSerializers=W,v.stdTimeFunctions=Object.assign({},{nullTime:P,epochTime:x,unixTime:ie,isoTime:oe});function L(e,t,r,n){const i=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?p:i[r]?i[r]:_[r]||_[n]||p,ee(e,t,r)}function ee(e,t,r){!e.transmit&&t[r]===p||(t[r]=function(n){return function(){const a=e.timestamp(),u=new Array(arguments.length),d=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_?_:this;for(var s=0;s<u.length;s++)u[s]=arguments[s];if(e.serialize&&!e.asObject&&E(u,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(d,te(this,r,u,a)):n.apply(d,u),e.transmit){const c=e.transmit.level||t.level,f=v.levels.values[c],l=v.levels.values[r];if(l<f)return;re(this,{ts:a,methodLevel:r,methodValue:l,transmitLevel:c,transmitValue:v.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},u)}}}(t[r]))}function te(e,t,r,n){e._serialize&&E(r,e._serialize,e.serializers,e._stdErrSerialize);const i=r.slice();let a=i[0];const u={};n&&(u.time=n),u.level=v.levels.values[t];let d=(e._childLevel|0)+1;if(d<1&&(d=1),a!==null&&typeof a=="object"){for(;d--&&typeof i[0]=="object";)Object.assign(u,i.shift());a=i.length?N(i.shift(),i):void 0}else typeof a=="string"&&(a=N(i.shift(),i));return a!==void 0&&(u.msg=a),u}function E(e,t,r,n){for(const i in e)if(n&&e[i]instanceof Error)e[i]=v.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i]))for(const a in e[i])t&&t.indexOf(a)>-1&&a in r&&(e[i][a]=r[a](e[i][a]))}function m(e,t,r){return function(){const n=new Array(1+arguments.length);n[0]=t;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return e[r].apply(this,n)}}function re(e,t,r){const n=t.send,i=t.ts,a=t.methodLevel,u=t.methodValue,d=t.val,s=e._logEvent.bindings;E(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(c){return s.indexOf(c)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=u,n(a,e._logEvent,d),e._logEvent=B(s)}function B(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function ne(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)t[r]===void 0&&(t[r]=e[r]);return t}function se(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?P:x}function z(){return{}}function A(e){return e}function p(){}function P(){return!1}function x(){return Date.now()}function ie(){return Math.round(Date.now()/1e3)}function oe(){return new Date(Date.now()).toISOString()}function le(){function e(t){return typeof t<"u"&&t}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}const M={level:"info"},w="custom_context",C=1e3*1024;class D{constructor(t){this.capacityInBytes=t,this.currentSizeInBytes=0,this.head=0,this.array=[]}calculateStringSize(t){return new TextEncoder().encode(t).length}enqueue(t){const r=this.calculateStringSize(t);if(r>this.capacityInBytes)throw new Error("Item size exceeds total capacity.");let n=this.array.length;for(;this.currentSizeInBytes+r>this.capacityInBytes;){const i=this.array[this.head];this.currentSizeInBytes-=this.calculateStringSize(i),n=this.head,this.array[this.head]="",this.head=(this.head+1)%Math.max(this.array.length,1)}n>=this.array.length?this.array.push(t):this.array[n]=t,this.currentSizeInBytes+=r}get(t){if(t<0||t>=this.array.length)throw new Error("Index out of bounds");return this.array[(this.head+t)%this.array.length]}[Symbol.iterator](){let t=0;const r=()=>{if(t>=this.array.length)return{done:!0,value:null};const n=this.get(t);return t++,n?{done:!1,value:n}:r()};return{next:r}}}class V{constructor(t,r=C){this.level=t??"error",this.levelValue=b.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new D(r)}forwardToConsole(t,r){r===b.levels.values.error?console.error(t):r===b.levels.values.warn?console.warn(t):r===b.levels.values.debug?console.debug(t):r===b.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.enqueue(JSON.stringify({timestamp:new Date().toISOString(),log:t}));const r=typeof t=="string"?JSON.parse(t).level:t.level;r>=this.levelValue&&this.forwardToConsole(t,r)}getLogs(){return this.logs}clearLogs(){this.logs=new D(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){return this.logs.enqueue(JSON.stringify({extraMetadata:t})),new Blob(this.getLogArray(),{type:"application/json"})}}class ae{constructor(t,r=C){this.baseChunkLogger=new V(t,r),window&&(window.downloadLogsBlob=n=>{this.downloadLogsBlobInBrowser(n??{clientId:"N/A"}),this.clearLogs()})}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const r=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=r,n.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}}class ce extends O.Writable{constructor(t,r=C){super({objectMode:!0}),this.baseChunkLogger=new V(t,r)}_write(t,r,n){try{this.baseChunkLogger.appendToLogs(t),n()}catch(i){n(i)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}}var ue=Object.defineProperty,fe=Object.defineProperties,he=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,F=(e,t,r)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))ge.call(t,r)&&F(e,r,t[r]);if(U)for(var r of U(t))de.call(t,r)&&F(e,r,t[r]);return e},k=(e,t)=>fe(e,he(t));function ve(e){return k(T({},e),{level:e?.level||M.level})}function G(e,t=w){return e[t]||""}function R(e,t,r=w){return e[r]=t,e}function q(e,t=w){let r="";return typeof e.bindings>"u"?r=G(e,t):r=e.bindings().context||"",r}function X(e,t,r=w){const n=q(e,r);return n.trim()?`${n}/${t}`:t}function be(e,t,r=w){const n=X(e,t,r),i=e.child({context:n});return R(i,n,r)}function ye(e){var t,r;const n=new ae((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace",browser:k(T({},(r=e.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function Le(e){var t;const r=new ce((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace"})),chunkLoggerController:r}}g.MAX_LOG_SIZE_IN_BYTES_DEFAULT=C,g.PINO_CUSTOM_CONTEXT_KEY=w,g.PINO_LOGGER_DEFAULTS=M,g.formatChildLoggerContext=X,g.generateChildLogger=be,g.generateClientLogger=ye,g.generateServerLogger=Le,g.getBrowserLoggerContext=G,g.getDefaultLoggerOptions=ve,g.getLoggerContext=q,g.pino=b,g.setBrowserLoggerContext=R,Object.defineProperty(g,"__esModule",{value:!0})}); | ||
(function(g,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("stream")):typeof define=="function"&&define.amd?define(["exports","stream"],O):(g=typeof globalThis<"u"?globalThis:g||self,O(g["@walletconnect/logger"]={},g.stream))})(this,function(g,O){"use strict";function K(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var W=Q;function Q(e,t,r){var s=r&&r.stringify||K,i=1;if(typeof e=="object"&&e!==null){var a=t.length+i;if(a===1)return e;var c=new Array(a);c[0]=s(e);for(var d=1;d<a;d++)c[d]=s(t[d]);return c.join(" ")}if(typeof e!="string")return e;var n=t.length;if(n===0)return e;for(var u="",f=1-i,l=-1,z=e&&e.length||0,o=0;o<z;){if(e.charCodeAt(o)===37&&o+1<z){switch(l=l>-1?l:0,e.charCodeAt(o+1)){case 100:case 102:if(f>=n||t[f]==null)break;l<o&&(u+=e.slice(l,o)),u+=Number(t[f]),l=o+2,o++;break;case 105:if(f>=n||t[f]==null)break;l<o&&(u+=e.slice(l,o)),u+=Math.floor(Number(t[f])),l=o+2,o++;break;case 79:case 111:case 106:if(f>=n||t[f]===void 0)break;l<o&&(u+=e.slice(l,o));var h=typeof t[f];if(h==="string"){u+="'"+t[f]+"'",l=o+2,o++;break}if(h==="function"){u+=t[f].name||"<anonymous>",l=o+2,o++;break}u+=s(t[f]),l=o+2,o++;break;case 115:if(f>=n)break;l<o&&(u+=e.slice(l,o)),u+=String(t[f]),l=o+2,o++;break;case 37:l<o&&(u+=e.slice(l,o)),u+="%",l=o+2,o++,f--;break}++f}++o}return l===-1?e:(l<z&&(u+=e.slice(l)),u)}const N=W;var b=v;const _=ue().console||{},ee={mapHttpRequest:E,mapHttpResponse:E,wrapRequestSerializer:B,wrapResponseSerializer:B,wrapErrorSerializer:B,req:E,res:E,err:ie};function te(e,t){return Array.isArray(e)?e.filter(function(s){return s!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function v(e){e=e||{},e.browser=e.browser||{};const t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const r=e.browser.write||_;e.browser.write&&(e.browser.asObject=!0);const s=e.serializers||{},i=te(e.browser.serialize,s);let a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);const c=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),e.enabled===!1&&(e.level="silent");const d=e.level||"info",n=Object.create(r);n.log||(n.log=p),Object.defineProperty(n,"levelVal",{get:f}),Object.defineProperty(n,"level",{get:l,set:z});const u={transmit:t,serialize:i,asObject:e.browser.asObject,levels:c,timestamp:oe(e)};n.levels=v.levels,n.level=d,n.setMaxListeners=n.getMaxListeners=n.emit=n.addListener=n.on=n.prependListener=n.once=n.prependOnceListener=n.removeListener=n.removeAllListeners=n.listeners=n.listenerCount=n.eventNames=n.write=n.flush=p,n.serializers=s,n._serialize=i,n._stdErrSerialize=a,n.child=o,t&&(n._logEvent=A());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function l(){return this._level}function z(h){if(h!=="silent"&&!this.levels.values[h])throw Error("unknown level "+h);this._level=h,L(u,n,"error","log"),L(u,n,"fatal","error"),L(u,n,"warn","error"),L(u,n,"info","log"),L(u,n,"debug","log"),L(u,n,"trace","log")}function o(h,j){if(!h)throw new Error("missing bindings for child Pino");j=j||{},i&&h.serializers&&(j.serializers=h.serializers);const Z=j.serializers;if(i&&Z){var I=Object.assign({},s,Z),J=e.browser.serialize===!0?Object.keys(I):i;delete h.serializers,S([h],J,I,this._stdErrSerialize)}function H(m){this._childLevel=(m._childLevel|0)+1,this.error=y(m,h,"error"),this.fatal=y(m,h,"fatal"),this.warn=y(m,h,"warn"),this.info=y(m,h,"info"),this.debug=y(m,h,"debug"),this.trace=y(m,h,"trace"),I&&(this.serializers=I,this._serialize=J),t&&(this._logEvent=A([].concat(m._logEvent.bindings,h)))}return H.prototype=this,new H(this)}return n}v.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},v.stdSerializers=ee,v.stdTimeFunctions=Object.assign({},{nullTime:x,epochTime:P,unixTime:le,isoTime:ae});function L(e,t,r,s){const i=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?p:i[r]?i[r]:_[r]||_[s]||p,re(e,t,r)}function re(e,t,r){!e.transmit&&t[r]===p||(t[r]=function(s){return function(){const a=e.timestamp(),c=new Array(arguments.length),d=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_?_:this;for(var n=0;n<c.length;n++)c[n]=arguments[n];if(e.serialize&&!e.asObject&&S(c,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?s.call(d,ne(this,r,c,a)):s.apply(d,c),e.transmit){const u=e.transmit.level||t.level,f=v.levels.values[u],l=v.levels.values[r];if(l<f)return;se(this,{ts:a,methodLevel:r,methodValue:l,transmitLevel:u,transmitValue:v.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},c)}}}(t[r]))}function ne(e,t,r,s){e._serialize&&S(r,e._serialize,e.serializers,e._stdErrSerialize);const i=r.slice();let a=i[0];const c={};s&&(c.time=s),c.level=v.levels.values[t];let d=(e._childLevel|0)+1;if(d<1&&(d=1),a!==null&&typeof a=="object"){for(;d--&&typeof i[0]=="object";)Object.assign(c,i.shift());a=i.length?N(i.shift(),i):void 0}else typeof a=="string"&&(a=N(i.shift(),i));return a!==void 0&&(c.msg=a),c}function S(e,t,r,s){for(const i in e)if(s&&e[i]instanceof Error)e[i]=v.stdSerializers.err(e[i]);else if(typeof e[i]=="object"&&!Array.isArray(e[i]))for(const a in e[i])t&&t.indexOf(a)>-1&&a in r&&(e[i][a]=r[a](e[i][a]))}function y(e,t,r){return function(){const s=new Array(1+arguments.length);s[0]=t;for(var i=1;i<s.length;i++)s[i]=arguments[i-1];return e[r].apply(this,s)}}function se(e,t,r){const s=t.send,i=t.ts,a=t.methodLevel,c=t.methodValue,d=t.val,n=e._logEvent.bindings;S(r,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter(function(u){return n.indexOf(u)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=c,s(a,e._logEvent,d),e._logEvent=A(n)}function A(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function ie(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)t[r]===void 0&&(t[r]=e[r]);return t}function oe(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?x:P}function E(){return{}}function B(e){return e}function p(){}function x(){return!1}function P(){return Date.now()}function le(){return Math.round(Date.now()/1e3)}function ae(){return new Date(Date.now()).toISOString()}function ue(){function e(t){return typeof t<"u"&&t}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}const V={level:"info"},w="custom_context",C=1e3*1024;class ce{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class M{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const r=new ce(t);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let r=this.head;for(;r!==null;)t.push(r.value),r=r.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const r=t.value;return t=t.next,{done:!1,value:r}}}}}class D{constructor(t,r=C){this.level=t??"error",this.levelValue=b.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new M(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,r){r===b.levels.values.error?console.error(t):r===b.levels.values.warn?console.warn(t):r===b.levels.values.debug?console.debug(t):r===b.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(JSON.stringify({timestamp:new Date().toISOString(),log:t}));const r=typeof t=="string"?JSON.parse(t).level:t.level;r>=this.levelValue&&this.forwardToConsole(t,r)}getLogs(){return this.logs}clearLogs(){this.logs=new M(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){return this.logs.append(JSON.stringify({extraMetadata:t})),new Blob(this.getLogArray(),{type:"application/json"})}}class fe{constructor(t,r=C){this.baseChunkLogger=new D(t,r)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const r=URL.createObjectURL(this.logsToBlob(t)),s=document.createElement("a");s.href=r,s.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}}class he extends O.Writable{constructor(t,r=C){super({objectMode:!0}),this.baseChunkLogger=new D(t,r)}_write(t,r,s){try{this.baseChunkLogger.appendToLogs(t),s()}catch(i){s(i)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}}var ge=Object.defineProperty,de=Object.defineProperties,ve=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,U=(e,t,r)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))be.call(t,r)&&U(e,r,t[r]);if(G)for(var r of G(t))me.call(t,r)&&U(e,r,t[r]);return e},k=(e,t)=>de(e,ve(t));function Le(e){return k(T({},e),{level:e?.level||V.level})}function F(e,t=w){return e[t]||""}function R(e,t,r=w){return e[r]=t,e}function $(e,t=w){let r="";return typeof e.bindings>"u"?r=F(e,t):r=e.bindings().context||"",r}function X(e,t,r=w){const s=$(e,r);return s.trim()?`${s}/${t}`:t}function ye(e,t,r=w){const s=X(e,t,r),i=e.child({context:s});return R(i,s,r)}function Y(e){var t,r;const s=new fe((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace",browser:k(T({},(r=e.opts)==null?void 0:r.browser),{write:i=>s.write(i)})})),chunkLoggerController:s}}function q(e){var t;const r=new he((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:b(k(T({},e.opts),{level:"trace"})),chunkLoggerController:r}}function we(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?q(e):Y(e)}g.MAX_LOG_SIZE_IN_BYTES_DEFAULT=C,g.PINO_CUSTOM_CONTEXT_KEY=w,g.PINO_LOGGER_DEFAULTS=V,g.formatChildLoggerContext=X,g.generateChildLogger=ye,g.generateClientLogger=Y,g.generateServerLogger=q,g.getBrowserLoggerContext=F,g.getDefaultLoggerOptions=Le,g.getLoggerContext=$,g.getPlatformLogger=we,g.pino=b,g.setBrowserLoggerContext=R,Object.defineProperty(g,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.umd.js.map |
import type { LoggerOptions } from "pino"; | ||
import CircularArray from "./circularArray"; | ||
import LinkedList from "./linkedList"; | ||
export default class BaseChunkLogger { | ||
@@ -11,3 +11,3 @@ private logs; | ||
appendToLogs(chunk: any): void; | ||
getLogs(): CircularArray; | ||
getLogs(): LinkedList; | ||
clearLogs(): void; | ||
@@ -14,0 +14,0 @@ getLogArray(): string[]; |
@@ -6,3 +6,3 @@ import type { LoggerOptions } from "pino"; | ||
write(chunk: any): void; | ||
getLogs(): import("./circularArray").default; | ||
getLogs(): import("./linkedList").default; | ||
clearLogs(): void; | ||
@@ -9,0 +9,0 @@ getLogArray(): string[]; |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
_write(chunk: any, _encoding: string, callback: (error?: Error | null) => void): void; | ||
getLogs(): import("./circularArray").default; | ||
getLogs(): import("./linkedList").default; | ||
clearLogs(): void; | ||
@@ -11,0 +11,0 @@ getLogArray(): string[]; |
import { Logger, LoggerOptions } from "pino"; | ||
import ClientChunkLogger from "./clientChunkLogger"; | ||
import ServerChunkLogger from "./serverChunkLogger"; | ||
import BaseChunkLogger from "./baseChunkLogger"; | ||
export interface ChunkLoggerController { | ||
logsToBlob: BaseChunkLogger["logsToBlob"]; | ||
getLogArray: () => string[]; | ||
clearLogs: () => void; | ||
downloadLogsBlobInBrowser?: ClientChunkLogger["downloadLogsBlobInBrowser"]; | ||
} | ||
export declare function getDefaultLoggerOptions(opts?: LoggerOptions): LoggerOptions; | ||
@@ -24,2 +31,10 @@ export declare function getBrowserLoggerContext(logger: Logger, customContextKey?: string): string; | ||
}; | ||
export declare function getPlatformLogger(params: { | ||
maxSizeInBytes?: number; | ||
opts?: LoggerOptions; | ||
loggerOverride: string | Logger<any>; | ||
}): { | ||
logger: Logger<any>; | ||
chunkLoggerController: ChunkLoggerController | null; | ||
}; | ||
//# sourceMappingURL=utils.d.ts.map |
{ | ||
"name": "@walletconnect/logger", | ||
"description": "Logger Utils", | ||
"version": "2.1.0-b750420", | ||
"version": "2.1.0-cab1ccc", | ||
"author": "WalletConnect, Inc. <walletconnect.com>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
123142
185
1