@visulima/pail 4.1.1 → 5.0.0

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE.md +5 -811
  3. package/dist/error.js +3 -3
  4. package/dist/index.browser.d.ts +2 -4
  5. package/dist/index.browser.js +19 -19
  6. package/dist/index.server.d.ts +2 -3
  7. package/dist/index.server.js +27 -28
  8. package/dist/middleware/elysia.js +1 -1
  9. package/dist/middleware/express.js +1 -1
  10. package/dist/middleware/fastify.js +1 -1
  11. package/dist/middleware/hono.js +1 -1
  12. package/dist/middleware/next/handler.d.ts +0 -1
  13. package/dist/middleware/next/handler.js +1 -1
  14. package/dist/middleware/sveltekit.js +1 -1
  15. package/dist/object-tree.js +2 -2
  16. package/dist/packem_shared/AbstractJsonReporter-DPsVS6w5.js +1 -0
  17. package/dist/packem_shared/AbstractJsonReporter-elZG6xkO.js +1 -0
  18. package/dist/packem_shared/JsonReporter-CY90KVxK.js +2 -0
  19. package/dist/packem_shared/JsonReporter-DX9fJfwQ.js +1 -0
  20. package/dist/packem_shared/{PailError-CbU1Ogfa.js → PailError-BgUh0gyX.js} +3 -3
  21. package/dist/packem_shared/PrettyReporter-B3yHM4Cb.js +47 -0
  22. package/dist/packem_shared/PrettyReporter-ClyBiPyQ.js +5 -0
  23. package/dist/packem_shared/abstract-pretty-reporter-C1W1vIw-.js +36 -0
  24. package/dist/packem_shared/headers-BjUW0cAm.js +1 -0
  25. package/dist/packem_shared/{index-CbkPnylC.js → index-pjyHJq0E.js} +1 -1
  26. package/dist/packem_shared/pailMiddleware-lhLj-hzE.js +1 -0
  27. package/dist/packem_shared/serializeError-Kr3JL9UN-zwOuO-gY.js +1 -0
  28. package/dist/packem_shared/storage-DP9QMOmG.js +1 -0
  29. package/dist/packem_shared/{types.d-DGHeA2iJ.d.ts → types.d-DNoig6eq.d.ts} +37 -3
  30. package/dist/packem_shared/{types.d-BW8kAXUv.d.ts → types.d-OiMbrp8C.d.ts} +37 -2
  31. package/dist/packem_shared/{useLogger-7p55yvvc.js → useLogger-HtOIBW7n.js} +1 -1
  32. package/dist/packem_shared/write-console-log-based-on-level-CG0mniaO.js +1 -0
  33. package/dist/packem_shared/write-stream-D2XwCKdN.js +1 -0
  34. package/dist/processor/caller/caller-processor.js +1 -1
  35. package/dist/processor/environment-processor.js +1 -1
  36. package/dist/processor/message-formatter-processor.js +1 -1
  37. package/dist/processor/opentelemetry-processor.js +1 -1
  38. package/dist/processor/redact-processor.d.ts +58 -0
  39. package/dist/processor/redact-processor.js +1 -1
  40. package/dist/processor/sampling-processor.js +1 -1
  41. package/dist/reporter/file/json-file-reporter.js +2 -2
  42. package/dist/reporter/http/abstract-http-reporter.js +2 -2
  43. package/dist/reporter/http/http-reporter.edge-light.d.ts +0 -2
  44. package/dist/reporter/http/http-reporter.edge-light.js +2 -2
  45. package/dist/reporter/http/http-reporter.js +1 -1
  46. package/dist/reporter/json/index.browser.d.ts +1 -3
  47. package/dist/reporter/json/index.browser.js +1 -1
  48. package/dist/reporter/json/index.js +1 -1
  49. package/dist/reporter/pretty/index.browser.d.ts +1 -3
  50. package/dist/reporter/pretty/index.browser.js +1 -1
  51. package/dist/reporter/pretty/index.d.ts +41 -5
  52. package/dist/reporter/pretty/index.js +1 -1
  53. package/dist/reporter/simple/simple-reporter.server.d.ts +40 -5
  54. package/dist/reporter/simple/simple-reporter.server.js +7 -7
  55. package/dist/wide-event.js +1 -1
  56. package/package.json +2 -2
  57. package/dist/packem_shared/AbstractJsonReporter-BpWRnN0L.js +0 -1
  58. package/dist/packem_shared/AbstractJsonReporter-DxZwImm5.js +0 -1
  59. package/dist/packem_shared/JsonReporter-9IcELa1m.js +0 -2
  60. package/dist/packem_shared/JsonReporter-Dd3kuj8X.js +0 -1
  61. package/dist/packem_shared/PrettyReporter-BUWNEg3_.js +0 -5
  62. package/dist/packem_shared/PrettyReporter-DbgD89ck.js +0 -70
  63. package/dist/packem_shared/abstract-pretty-reporter-CyfTvmKf.js +0 -59
  64. package/dist/packem_shared/headers-DI58djdG.js +0 -1
  65. package/dist/packem_shared/pailMiddleware-B5DJoBYl.js +0 -1
  66. package/dist/packem_shared/serializeError-52C4oiKx-CrnRcq9R.js +0 -1
  67. package/dist/packem_shared/storage-DVcJumyk.js +0 -1
  68. package/dist/packem_shared/write-console-log-based-on-level-BqjxV016.js +0 -1
  69. package/dist/packem_shared/write-stream-ytl_vhg_.js +0 -1
@@ -1 +0,0 @@
1
- import{E as m}from"./constants-DKfCaSUR.js";const g=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}}),d=e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},p=new WeakSet,v=e=>{if(Object.hasOwn(e,"name")&&typeof e.name=="string"&&e.name!=="")return e.name;const r=e.constructor?.name;return typeof r=="string"&&r!==""?r:e.name},O=e=>{const r=Object.getOwnPropertyNames(e);for(const a of r){const t=Object.getOwnPropertyDescriptor(e,a);t&&(t.enumerable||Object.defineProperty(e,a,{...t,enumerable:!0}),t.value&&typeof t.value=="object"&&!Array.isArray(t.value)&&(Object.getPrototypeOf(t.value)===Object.prototype||Object.getPrototypeOf(t.value)===null)&&O(t.value))}},h=e=>{p.add(e);const r=e.toJSON();return p.delete(e),Object.isExtensible(r)&&O(r),r},s=(e,r,a,t,n=new Set)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&"pipe"in e&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return r.has(e)?"[Circular]":(a+=1,f(e,t,r,a));if(t.useToJSON&&e!==null&&typeof e=="object"&&"toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(typeof URL<"u"&&e instanceof URL)return e.href;if(e instanceof Map){const u=[];for(const[o,i]of e.entries())u.push([s(o,r,a,t,n),s(i,r,a,t,n)]);return{__dataType:"Map",value:u}}if(e instanceof Set){const u=[];for(const o of e.values())u.push(s(o,r,a,t,n));return{__dataType:"Set",value:u}}if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(d(e)){if(n.has(e))return"[Circular]";if(t.maxDepth!==void 0&&t.maxDepth!==Number.POSITIVE_INFINITY&&a+1>=t.maxDepth)return{};a+=1,n.add(e);const u={};for(const o in e)u[o]=s(e[o],r,a,t,n);return n.delete(e),u}try{return e}catch{return"[Not Available]"}},f=(e,r,a,t)=>{if(a.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!p.has(e))return h(e);const n=Object.create(g);if(Object.defineProperty(n,"name",{configurable:!0,enumerable:!0,value:v(e),writable:!0}),Object.defineProperty(n,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(n,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const o=[];for(const i of e.errors){if(!(i instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(a.has(i))return Object.defineProperty(n,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),n;o.push(f(i,r,a,t))}Object.defineProperty(n,"errors",{configurable:!0,enumerable:!0,value:o,writable:!0})}const u=e.cause;if(u!=null)if(u instanceof Error)a.has(u)?Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:f(u,r,a,t),writable:!0});else{const o=s(u,a,t,r);Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:o,writable:!0})}for(const o in e){if(o==="name"||o==="message"||o==="stack"||o==="cause"||o==="errors")continue;const i=e[o],l=s(i,a,t,r);Object.defineProperty(n,o,{configurable:!0,enumerable:!0,value:l,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const o of r.exclude)try{delete n[o]}catch{}return n},y=(e,r={})=>f(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0);class S{stringify;errorOptions;constructor(r={}){this.errorOptions=r.error??{}}setStringify(r){this.stringify=r}log(r){const{context:a,error:t,file:n,message:u,type:o,...i}=r;if(i.label&&(i.label=i.label.trim()),n&&(i.file=`${n.name??""}:${String(n.line)}${n.column?`:${String(n.column)}`:""}`),i.message=u===m?void 0:u,t&&(i.error=y(t,this.errorOptions)),a){const l=[];for(let b=0;b<a.length;b+=1){const c=a[b];c!==m&&(c instanceof Error?l.push(y(c,this.errorOptions)):l.push(c))}i.context=l}this._log(this.stringify(i),o.level)}}export{S as AbstractJsonReporter};
@@ -1 +0,0 @@
1
- import{d as g}from"./serializeError-52C4oiKx-CrnRcq9R.js";import{E as a}from"./constants-ep2nsfdy.js";class u{stringify;errorOptions;constructor(t={}){this.errorOptions=t.error??{}}setStringify(t){this.stringify=t}log(t){const{context:s,error:l,file:o,message:c,type:f,...r}=t;if(r.label&&(r.label=r.label.trim()),o&&(r.file=`${o.name??""}:${String(o.line)}${o.column?`:${String(o.column)}`:""}`),r.message=c===a?void 0:c,l&&(r.error=g(l,this.errorOptions)),s){const i=[];for(let n=0;n<s.length;n+=1){const e=s[n];e!==a&&(e instanceof Error?i.push(g(e,this.errorOptions)):i.push(e))}r.context=i}this._log(this.stringify(r),f.level)}}export{u as AbstractJsonReporter};
@@ -1,2 +0,0 @@
1
- import{createRequire as n}from"node:module";import{r as i,a}from"./write-stream-ytl_vhg_.js";import{AbstractJsonReporter as u}from"./AbstractJsonReporter-DxZwImm5.js";const r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:o,stderr:c}=r;class h extends u{#e;#s;constructor(e={}){super(e),this.#e=o,this.#s=c}setStdout(e){this.#e=e}setStderr(e){this.#s=e}_log(e,s){const t=i(s)?this.#s:this.#e;a(`${e}
2
- `,t)}}export{h as default};
@@ -1 +0,0 @@
1
- import{AbstractJsonReporter as o}from"./AbstractJsonReporter-BpWRnN0L.js";import{t as s}from"./write-console-log-based-on-level-BqjxV016.js";class c extends o{constructor(r={}){super(r)}_log(r,t){s(t)(r)}}export{c as default};
@@ -1,5 +0,0 @@
1
- import O,{grey as n,white as P,underline as T,bold as Y}from"@visulima/colorize/browser";import{y as r,g as k}from"./index-CbkPnylC.js";import{L as B,E as C}from"./constants-DKfCaSUR.js";import{t as F}from"./write-console-log-based-on-level-BqjxV016.js";const _=p=>{const l=Object.keys(p).map(t=>p[t].badge??"");return l.length===0?"":l.reduce((t,a)=>t.length>a.length?t:a,"")},v=p=>[p.getHours(),p.getMinutes(),p.getSeconds()].map(l=>String(l).padStart(2,"0")).join(":");class D{styles;loggerTypes;constructor(l){this.styles={bold:{label:!1},dateFormatter:v,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...l},this.loggerTypes=B}setLoggerTypes(l){this.loggerTypes=l}}class q extends D{constructor(l={}){super({uppercase:{label:!0,...l.uppercase},...l})}log(l){const t=typeof globalThis.window<"u"&&typeof globalThis.document<"u",a=F(l.type.level),{badge:x,context:S,date:u,error:A,groups:f,label:y,message:w,prefix:d,repeated:g,scope:h,suffix:m,type:E}=l,{color:L}=this.loggerTypes[E.name],j=L?O[L]:P,s=[];if(t&&f.length>0){const e=f.map(()=>" ").join(""),i=n(`[${f.at(-1)}]`);s.push(r(e+i[0],i.slice(1)))}if(u){const e=n(this.styles.dateFormatter(typeof u=="string"?new Date(u):u));t?s.push(r(e[0],e.slice(1))):s.push([`${e[0]} `,...e.slice(1)])}if(x){const e=j(x);t?s.push(r(e[0],e.slice(1))):s.push([`${e[0]} `,...e.slice(1)])}else{const e=_(this.loggerTypes);if(e.length>0){const i=n(".".repeat(e.length));t?s.push(r(`${i[0]} `,i.slice(1))):s.push([`${i[0]} `,...i.slice(1)])}}const M=k(this.loggerTypes);let b;if(g){const e=P(`[${g}x]`);b=t?r(e[0],e.slice(1)):[e[0],...e.slice(1)]}if(y){const e=j(this.#e(y));t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)]),b&&s.push(b);let i=M.length-y.length;if(g?i-=String(g).length+3:i+=1,i>0){const o=n(".".repeat(i));t?s.push(r(o[0],o.slice(1))):s.push([` ${o[0]}`,...o.slice(1)])}}else{const e=n(".".repeat(M.length+1));t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(Array.isArray(h)&&h.length>0){const e=n(`[${h.join(" > ")}]`);t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(d){const e=n(`${Array.isArray(h)&&h.length>0?". ":" "}[${this.styles.underline.prefix?T(d):d}] `);t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(w!==C&&s.push(w),S&&s.push(...S),A&&s.push(A,`
2
-
3
- `),m){const e=n(this.styles.underline.suffix?T(m):m);t?s.push(r(`
4
- ${e[0]}`,e.slice(1))):s.push([`
5
- ${e[0]}`,...e.slice(1)])}if(t)a(...s);else{let e="";const i=[],o=[];for(let $=0;$<s.length;$+=1){const c=s[$];Array.isArray(c)&&c.length>1&&c[0].includes("%c")?(e+=String(c[0]),i.push(...c.slice(1))):o.push(c)}a(`${e}%c`,...i,"",...o)}}#e(l){let t=this.styles.uppercase.label?l.toUpperCase():l;return t=this.styles.underline.label?T(t):t,this.styles.bold.label&&(t=Y(t)),t}}export{q as default};