@visulima/pail 4.0.2 → 4.1.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 (83) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE.md +346 -0
  3. package/README.md +17 -0
  4. package/dist/error.d.ts +69 -69
  5. package/dist/index.browser.d.ts +446 -445
  6. package/dist/index.browser.js +17 -17
  7. package/dist/index.server.d.ts +582 -582
  8. package/dist/index.server.js +27 -27
  9. package/dist/middleware/elysia.d.ts +44 -42
  10. package/dist/middleware/elysia.js +1 -1
  11. package/dist/middleware/express.d.ts +58 -59
  12. package/dist/middleware/express.js +1 -1
  13. package/dist/middleware/fastify.d.ts +55 -56
  14. package/dist/middleware/fastify.js +1 -1
  15. package/dist/middleware/hono.d.ts +56 -57
  16. package/dist/middleware/hono.js +1 -1
  17. package/dist/middleware/next/handler.d.ts +67 -68
  18. package/dist/middleware/next/handler.js +1 -1
  19. package/dist/middleware/sveltekit.d.ts +72 -73
  20. package/dist/middleware/sveltekit.js +1 -1
  21. package/dist/object-tree.d.ts +44 -44
  22. package/dist/packem_shared/AbstractJsonReporter-BpWRnN0L.js +1 -0
  23. package/dist/packem_shared/AbstractJsonReporter-DxZwImm5.js +1 -0
  24. package/dist/packem_shared/JsonReporter-9IcELa1m.js +2 -0
  25. package/dist/packem_shared/JsonReporter-Dd3kuj8X.js +1 -0
  26. package/dist/packem_shared/{PrettyReporter-DsHfKOU7.js → PrettyReporter-BUWNEg3_.js} +1 -1
  27. package/dist/packem_shared/{PrettyReporter-CcDdPQSt.js → PrettyReporter-DbgD89ck.js} +56 -30
  28. package/dist/packem_shared/abstract-json-reporter.d-B6NoO-hG.d.ts +61 -0
  29. package/dist/packem_shared/{abstract-pretty-reporter-DrLBJ6ds.js → abstract-pretty-reporter-CyfTvmKf.js} +41 -39
  30. package/dist/packem_shared/create-middleware-logger.d-BRkkBMlk.d.ts +47 -0
  31. package/dist/packem_shared/headers-DI58djdG.js +1 -0
  32. package/dist/packem_shared/index-CbkPnylC.js +1 -0
  33. package/dist/packem_shared/serializeError-52C4oiKx-CrnRcq9R.js +1 -0
  34. package/dist/packem_shared/storage-DVcJumyk.js +1 -0
  35. package/dist/packem_shared/types.d-4ge_rME4.d.ts +246 -0
  36. package/dist/packem_shared/{types.d-Cz9S7jZh.d.ts → types.d-BW8kAXUv.d.ts} +95 -95
  37. package/dist/packem_shared/types.d-DGHeA2iJ.d.ts +194 -0
  38. package/dist/packem_shared/useLogger-7p55yvvc.js +1 -0
  39. package/dist/packem_shared/wide-event.d-BMLastMR.d.ts +716 -0
  40. package/dist/packem_shared/write-stream-ytl_vhg_.js +1 -0
  41. package/dist/processor/caller/caller-processor.d.ts +32 -33
  42. package/dist/processor/environment-processor.d.ts +83 -84
  43. package/dist/processor/message-formatter-processor.d.ts +40 -45
  44. package/dist/processor/message-formatter-processor.js +1 -1
  45. package/dist/processor/opentelemetry-processor.d.ts +51 -52
  46. package/dist/processor/redact-processor.d.ts +57 -65
  47. package/dist/processor/sampling-processor.d.ts +90 -91
  48. package/dist/reporter/file/json-file-reporter.d.ts +77 -78
  49. package/dist/reporter/file/json-file-reporter.js +1 -1
  50. package/dist/reporter/http/abstract-http-reporter.d.ts +125 -121
  51. package/dist/reporter/http/abstract-http-reporter.js +2 -2
  52. package/dist/reporter/http/http-reporter.d.ts +33 -34
  53. package/dist/reporter/http/http-reporter.edge-light.d.ts +235 -230
  54. package/dist/reporter/http/http-reporter.edge-light.js +2 -2
  55. package/dist/reporter/json/index.browser.d.ts +62 -61
  56. package/dist/reporter/json/index.browser.js +1 -1
  57. package/dist/reporter/json/index.d.ts +36 -37
  58. package/dist/reporter/json/index.js +1 -1
  59. package/dist/reporter/pretty/index.browser.d.ts +57 -56
  60. package/dist/reporter/pretty/index.browser.js +1 -1
  61. package/dist/reporter/pretty/index.d.ts +133 -133
  62. package/dist/reporter/pretty/index.js +1 -1
  63. package/dist/reporter/simple/simple-reporter.server.d.ts +91 -90
  64. package/dist/reporter/simple/simple-reporter.server.js +7 -7
  65. package/dist/wide-event.d.ts +2 -3
  66. package/dist/wide-event.js +1 -1
  67. package/package.json +58 -37
  68. package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +0 -1
  69. package/dist/packem_shared/AbstractJsonReporter-w_bGGiD-.js +0 -1
  70. package/dist/packem_shared/JsonReporter-Sd_lJGS-.js +0 -2
  71. package/dist/packem_shared/JsonReporter-bmem9lcg.js +0 -1
  72. package/dist/packem_shared/abstract-json-reporter.d-wfESoEa-.d.ts +0 -62
  73. package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js +0 -25
  74. package/dist/packem_shared/create-middleware-logger.d-B-JmQ1Sl.d.ts +0 -47
  75. package/dist/packem_shared/headers-DH0H2s8W.js +0 -1
  76. package/dist/packem_shared/index-Q1764hvO.js +0 -1
  77. package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +0 -1
  78. package/dist/packem_shared/storage-DaXAlpiO.js +0 -1
  79. package/dist/packem_shared/types.d-bWnqHJKL.d.ts +0 -211
  80. package/dist/packem_shared/types.d-xxE3FOD3.d.ts +0 -229
  81. package/dist/packem_shared/useLogger-DB34CuU5.js +0 -1
  82. package/dist/packem_shared/wide-event.d-D3ATYpoK.d.ts +0 -717
  83. package/dist/packem_shared/write-stream-C7jxLxIT.js +0 -1
@@ -1,6 +1,5 @@
1
- export { R as RequestLogEntry, S as SerializedError, W as WideEvent, a as WideEventFinishOptions, b as WideEventLevel, c as WideEventOptions, d as createWideEvent } from "./packem_shared/wide-event.d-D3ATYpoK.js";
2
- import "./packem_shared/types.d-bWnqHJKL.js";
1
+ export { R as RequestLogEntry, S as SerializedError, W as WideEvent, a as WideEventFinishOptions, b as WideEventLevel, c as WideEventOptions, d as createWideEvent } from "./packem_shared/wide-event.d-BMLastMR.js";
2
+ import "./packem_shared/types.d-4ge_rME4.js";
3
3
  import "./packem_shared/index.d-T71KjNAr.js";
4
- import 'type-fest';
5
4
  import '@visulima/colorize';
6
5
  import '@visulima/interactive-manager';
@@ -1 +1 @@
1
- import"./packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js";import{O as c}from"./packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js";const m=8,h={debug:0,error:3,info:1,warn:2},l={debug:"debug",error:"error",info:"info",warn:"warn"},u=(s,t)=>{const e={...s},r=Object.keys(t);for(let i=0;i<r.length;i+=1){const a=r[i],o=t[a],n=e[a];o!==null&&typeof o=="object"&&!Array.isArray(o)&&n!==null&&typeof n=="object"&&!Array.isArray(n)?e[a]=u(n,o):e[a]=o}return e},g=s=>s<1e3?`${String(s)}ms`:`${(s/1e3).toFixed(2)}s`,d=(s,t)=>{const e={message:typeof s.message=="string"?s.message:"",name:typeof s.name=="string"?s.name:"Error"};if(s.stack&&(e.stack=s.stack),s.status!==void 0?e.status=s.status:s.statusCode!==void 0&&(e.status=s.statusCode),s.data!==void 0&&(e.data=s.data),t.cause instanceof Error){const{cause:r}=s;r==="[Circular]"?e.cause="[Circular]":r!==null&&typeof r=="object"&&(e.cause=d(r,t.cause))}return e},p=s=>d(c(s,{maxDepth:m}),s);class v{name;autoEmit;data;emitted;attachedError;level;pail;requestLogs;service;startTime;status;timestamp;_type;constructor(t){this.name=t.name,this.pail=t.pail,this.data={},this.startTime=performance.now(),this.timestamp=new Date().toISOString(),this.emitted=!1,this.autoEmit=t.autoEmit??!0,this._type=t.type??"info",this.level="info",this.requestLogs=[],this.service=t.service}debug(t,e){return this.addLogEntry("debug",t,e)}emit(t){if(this.emitted)return;this.emitted=!0;const e=Math.round(performance.now()-this.startTime),r=this.attachedError?"error":this.level,i=t??l[r],a={duration:g(e),duration_ms:e,event:this.name,timestamp:this.timestamp,...this.data};this.service&&(a.service=this.service),this.status!==void 0&&(a.status=this.status),this.attachedError&&(a.error=p(this.attachedError)),this.requestLogs.length>0&&(a.requestLogs=this.requestLogs);const o=this.pail[i];o({message:a})}error(t,e,r){return e&&(this.attachedError=e),this.addLogEntry("error",t,r)}finish(t){t?.status!==void 0&&(this.status=t.status),t?.error&&(this.attachedError=t.error),this.emit()}getData(){return this.data}getLevel(){return this.attachedError?"error":this.level}getRequestLogs(){return this.requestLogs}info(t,e){return this.addLogEntry("info",t,e)}set(t){return this.data=u(this.data,t),this}setError(t){return this.attachedError=t,this}setStatus(t){return this.status=t,this}warn(t,e){return this.addLogEntry("warn",t,e)}[Symbol.dispose](){this.autoEmit&&!this.emitted&&this.emit()}addLogEntry(t,e,r){const i={level:t,message:e,timestamp:new Date().toISOString()};return r&&(i.context=r),this.requestLogs.push(i),this.escalateLevel(t),this}escalateLevel(t){(h[t]??0)>(h[this.level]??0)&&(this.level=t)}}const y=s=>new v(s);export{v as WideEvent,y as createWideEvent};
1
+ import{d as c}from"./packem_shared/serializeError-52C4oiKx-CrnRcq9R.js";const m=8,h={debug:0,error:3,info:1,warn:2},l={debug:"debug",error:"error",info:"info",warn:"warn"},u=(s,t)=>{const e={...s},r=Object.keys(t);for(let i=0;i<r.length;i+=1){const a=r[i],o=t[a],n=e[a];o!==null&&typeof o=="object"&&!Array.isArray(o)&&n!==null&&typeof n=="object"&&!Array.isArray(n)?e[a]=u(n,o):e[a]=o}return e},g=s=>s<1e3?`${String(s)}ms`:`${(s/1e3).toFixed(2)}s`,d=(s,t)=>{const e={message:typeof s.message=="string"?s.message:"",name:typeof s.name=="string"?s.name:"Error"};if(s.stack&&(e.stack=s.stack),s.status!==void 0?e.status=s.status:s.statusCode!==void 0&&(e.status=s.statusCode),s.data!==void 0&&(e.data=s.data),t.cause instanceof Error){const{cause:r}=s;r==="[Circular]"?e.cause="[Circular]":r!==null&&typeof r=="object"&&(e.cause=d(r,t.cause))}return e},p=s=>d(c(s,{maxDepth:m}),s);class v{name;autoEmit;data;emitted;attachedError;level;pail;requestLogs;service;startTime;status;timestamp;_type;constructor(t){this.name=t.name,this.pail=t.pail,this.data={},this.startTime=performance.now(),this.timestamp=new Date().toISOString(),this.emitted=!1,this.autoEmit=t.autoEmit??!0,this._type=t.type??"info",this.level="info",this.requestLogs=[],this.service=t.service}debug(t,e){return this.addLogEntry("debug",t,e)}emit(t){if(this.emitted)return;this.emitted=!0;const e=Math.round(performance.now()-this.startTime),r=this.attachedError?"error":this.level,i=t??l[r],a={duration:g(e),duration_ms:e,event:this.name,timestamp:this.timestamp,...this.data};this.service&&(a.service=this.service),this.status!==void 0&&(a.status=this.status),this.attachedError&&(a.error=p(this.attachedError)),this.requestLogs.length>0&&(a.requestLogs=this.requestLogs);const o=this.pail[i];o({message:a})}error(t,e,r){return e&&(this.attachedError=e),this.addLogEntry("error",t,r)}finish(t){t?.status!==void 0&&(this.status=t.status),t?.error&&(this.attachedError=t.error),this.emit()}getData(){return this.data}getLevel(){return this.attachedError?"error":this.level}getRequestLogs(){return this.requestLogs}info(t,e){return this.addLogEntry("info",t,e)}set(t){return this.data=u(this.data,t),this}setError(t){return this.attachedError=t,this}setStatus(t){return this.status=t,this}warn(t,e){return this.addLogEntry("warn",t,e)}[Symbol.dispose](){this.autoEmit&&!this.emitted&&this.emit()}addLogEntry(t,e,r){const i={level:t,message:e,timestamp:new Date().toISOString()};return r&&(i.context=r),this.requestLogs.push(i),this.escalateLevel(t),this}escalateLevel(t){(h[t]??0)>(h[this.level]??0)&&(this.level=t)}}const f=s=>new v(s);export{v as WideEvent,f as createWideEvent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/pail",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Highly configurable Logger for Node.js, Edge and Browser.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -57,12 +57,6 @@
57
57
  ],
58
58
  "homepage": "https://visulima.com/packages/pail/",
59
59
  "bugs": "https://github.com/visulima/visulima/issues",
60
- "license": "MIT",
61
- "author": {
62
- "name": "Daniel Bannert",
63
- "email": "d.bannert@anolilab.de",
64
- "url": "https://danielbannert.com"
65
- },
66
60
  "repository": {
67
61
  "type": "git",
68
62
  "url": "git+https://github.com/visulima/visulima.git",
@@ -78,27 +72,32 @@
78
72
  "url": "https://anolilab.com/support"
79
73
  }
80
74
  ],
81
- "files": [
82
- "dist/**",
83
- "README.md",
84
- "CHANGELOG.md",
85
- "LICENSE.md",
86
- "MIGRATION-GUIDE.md"
87
- ],
88
- "os": [
89
- "darwin",
90
- "linux",
91
- "win32"
92
- ],
93
- "type": "module",
75
+ "license": "MIT",
76
+ "author": {
77
+ "name": "Daniel Bannert",
78
+ "email": "d.bannert@anolilab.de",
79
+ "url": "https://danielbannert.com"
80
+ },
94
81
  "sideEffects": false,
82
+ "type": "module",
95
83
  "exports": {
96
84
  ".": {
85
+ "edge-light": {
86
+ "types": "./dist/index.browser.d.ts",
87
+ "default": "./dist/index.browser.js"
88
+ },
89
+ "workerd": {
90
+ "types": "./dist/index.browser.d.ts",
91
+ "default": "./dist/index.browser.js"
92
+ },
93
+ "browser": {
94
+ "types": "./dist/index.browser.d.ts",
95
+ "default": "./dist/index.browser.js"
96
+ },
97
97
  "import": {
98
98
  "types": "./dist/index.server.d.ts",
99
99
  "default": "./dist/index.server.js"
100
- },
101
- "browser": "./dist/index.browser.js"
100
+ }
102
101
  },
103
102
  "./browser": {
104
103
  "types": "./dist/index.browser.d.ts",
@@ -153,11 +152,14 @@
153
152
  }
154
153
  },
155
154
  "./reporter/json": {
155
+ "browser": {
156
+ "types": "./dist/reporter/json/index.browser.d.ts",
157
+ "default": "./dist/reporter/json/index.browser.js"
158
+ },
156
159
  "import": {
157
160
  "types": "./dist/reporter/json/index.d.ts",
158
161
  "default": "./dist/reporter/json/index.js"
159
- },
160
- "browser": "./dist/reporter/json/index.browser.js"
162
+ }
161
163
  },
162
164
  "./server/reporter/pretty": {
163
165
  "import": {
@@ -172,11 +174,14 @@
172
174
  }
173
175
  },
174
176
  "./reporter/pretty": {
177
+ "browser": {
178
+ "types": "./dist/reporter/pretty/index.browser.d.ts",
179
+ "default": "./dist/reporter/pretty/index.browser.js"
180
+ },
175
181
  "import": {
176
182
  "types": "./dist/reporter/pretty/index.d.ts",
177
183
  "default": "./dist/reporter/pretty/index.js"
178
- },
179
- "browser": "./dist/reporter/pretty/index.browser.js"
184
+ }
180
185
  },
181
186
  "./reporter/simple": {
182
187
  "types": "./dist/reporter/simple/simple-reporter.server.d.ts",
@@ -187,17 +192,21 @@
187
192
  "default": "./dist/reporter/http/abstract-http-reporter.js"
188
193
  },
189
194
  "./reporter/http": {
190
- "import": {
191
- "types": "./dist/reporter/http/http-reporter.d.ts",
192
- "default": "./dist/reporter/http/http-reporter.js"
193
- },
194
195
  "edge-light": {
195
196
  "types": "./dist/reporter/http/http-reporter.edge-light.d.ts",
196
197
  "default": "./dist/reporter/http/http-reporter.edge-light.js"
197
198
  },
199
+ "workerd": {
200
+ "types": "./dist/reporter/http/http-reporter.edge-light.d.ts",
201
+ "default": "./dist/reporter/http/http-reporter.edge-light.js"
202
+ },
198
203
  "browser": {
199
204
  "types": "./dist/reporter/http/http-reporter.d.ts",
200
205
  "default": "./dist/reporter/http/http-reporter.js"
206
+ },
207
+ "import": {
208
+ "types": "./dist/reporter/http/http-reporter.d.ts",
209
+ "default": "./dist/reporter/http/http-reporter.js"
201
210
  }
202
211
  },
203
212
  "./object-tree": {
@@ -234,18 +243,21 @@
234
243
  },
235
244
  "./package.json": "./package.json"
236
245
  },
237
- "publishConfig": {
238
- "access": "public",
239
- "provenance": true
240
- },
246
+ "files": [
247
+ "dist/**",
248
+ "README.md",
249
+ "CHANGELOG.md",
250
+ "LICENSE.md",
251
+ "MIGRATION-GUIDE.md"
252
+ ],
241
253
  "dependencies": {
242
- "@visulima/colorize": "2.0.1",
243
- "@visulima/interactive-manager": "1.0.0"
254
+ "@visulima/colorize": "2.1.0",
255
+ "@visulima/interactive-manager": "1.0.1"
244
256
  },
245
257
  "peerDependencies": {
246
258
  "@opentelemetry/api": "^1.9.1",
247
259
  "@sveltejs/kit": ">=2.0",
248
- "@visulima/redact": "3.0.0",
260
+ "@visulima/redact": "3.1.0",
249
261
  "elysia": ">=1.0",
250
262
  "express": ">=4.0",
251
263
  "fastify": ">=4.0",
@@ -284,5 +296,14 @@
284
296
  },
285
297
  "engines": {
286
298
  "node": "^22.14.0 || >=24.10.0"
299
+ },
300
+ "os": [
301
+ "darwin",
302
+ "linux",
303
+ "win32"
304
+ ],
305
+ "publishConfig": {
306
+ "access": "public",
307
+ "provenance": true
287
308
  }
288
309
  }
@@ -1 +0,0 @@
1
- import{createRequire as E}from"node:module";import{E as O}from"./constants-DKfCaSUR.js";const S=E(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[r,t]=c.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return c.getBuiltinModule(e)}return S(e)},{createRequire:h}=w("node:module"),T=h(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=e=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[r,t]=f.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return f.getBuiltinModule(e)}return T(e)};N("node:util");const P=h(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=e=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[r,t]=p.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return p.getBuiltinModule(e)}return P(e)};d("node:fs");d("node:path");d("node:url");const _=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&_.set("AggregateError",AggregateError);const x=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}}),A=e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},y=new WeakSet,j=e=>{const r=Object.getOwnPropertyNames(e);for(const t of r){const o=Object.getOwnPropertyDescriptor(e,t);o&&(o.enumerable||Object.defineProperty(e,t,{...o,enumerable:!0}),o.value&&typeof o.value=="object"&&!Array.isArray(o.value)&&(Object.getPrototypeOf(o.value)===Object.prototype||Object.getPrototypeOf(o.value)===null)&&j(o.value))}},I=e=>{y.add(e);const r=e.toJSON();return y.delete(e),Object.isExtensible(r)&&j(r),r},a=(e,r,t,o,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]":(t+=1,m(e,o,r,t));if(o.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 s=[];for(const[u,i]of e.entries())s.push([a(u,r,t,o,n),a(i,r,t,o,n)]);return{__dataType:"Map",value:s}}if(e instanceof Set){const s=[];for(const u of e.values())s.push(a(u,r,t,o,n));return{__dataType:"Set",value:s}}if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(A(e)){if(n.has(e))return"[Circular]";if(o.maxDepth!==void 0&&o.maxDepth!==Number.POSITIVE_INFINITY&&t+1>=o.maxDepth)return{};t+=1,n.add(e);const s={};for(const u in e)s[u]=a(e[u],r,t,o,n);return n.delete(e),s}try{return e}catch{return"[Not Available]"}},m=(e,r,t,o)=>{if(t.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!y.has(e))return I(e);const n=Object.create(x);if(Object.defineProperty(n,"name",{configurable:!0,enumerable:!0,value:Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,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 u=[];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(t.has(i))return Object.defineProperty(n,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),n;u.push(m(i,r,t,o))}Object.defineProperty(n,"errors",{configurable:!0,enumerable:!0,value:u,writable:!0})}const s=e.cause;if(s!=null)if(s instanceof Error)t.has(s)?Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:m(s,r,t,o),writable:!0});else{const u=a(s,t,o,r);Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:u,writable:!0})}for(const u in e){if(u==="name"||u==="message"||u==="stack"||u==="cause"||u==="errors")continue;const i=e[u],l=a(i,t,o,r);Object.defineProperty(n,u,{configurable:!0,enumerable:!0,value:l,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const u of r.exclude)try{delete n[u]}catch{}return n},v=(e,r={})=>m(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0);class M{stringify;errorOptions;constructor(r={}){this.errorOptions=r.error??{}}setStringify(r){this.stringify=r}log(r){const{context:t,error:o,file:n,message:s,type:u,...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=s===O?void 0:s,o&&(i.error=v(o,this.errorOptions)),t){const l=[];for(let g=0;g<t.length;g+=1){const b=t[g];b!==O&&(b instanceof Error?l.push(v(b,this.errorOptions)):l.push(b))}i.context=l}this._log(this.stringify(i),u.level)}}export{M as AbstractJsonReporter};
@@ -1 +0,0 @@
1
- import"./addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js";import{O as g}from"./serializeError-C-NFvZ8_-D0CA_Qlx.js";import{E as p}from"./constants-ep2nsfdy.js";class u{stringify;errorOptions;constructor(t={}){this.errorOptions=t.error??{}}setStringify(t){this.stringify=t}log(t){const{context:i,error:l,file:o,message:c,type:a,...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===p?void 0:c,l&&(r.error=g(l,this.errorOptions)),i){const s=[];for(let n=0;n<i.length;n+=1){const e=i[n];e!==p&&(e instanceof Error?s.push(g(e,this.errorOptions)):s.push(e))}r.context=s}this._log(this.stringify(r),a.level)}}export{u as AbstractJsonReporter};
@@ -1,2 +0,0 @@
1
- import{createRequire as r}from"node:module";import{r as a,a as p}from"./write-stream-C7jxLxIT.js";import{AbstractJsonReporter as d}from"./AbstractJsonReporter-w_bGGiD-.js";const l=r(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:i,stderr:c}=o;class f extends d{#s;#t;constructor(s={}){super(s),this.#s=i,this.#t=c}setStdout(s){this.#s=s}setStderr(s){this.#t=s}_log(s,t){const e=a(t)?this.#t:this.#s;p(`${s}
2
- `,e)}}export{f as default};
@@ -1 +0,0 @@
1
- import{t as o}from"./write-console-log-based-on-level-BqjxV016.js";import{AbstractJsonReporter as s}from"./AbstractJsonReporter-Bp_JCrMQ.js";class c extends s{constructor(r={}){super(r)}_log(r,t){o(t)(r)}}export{c as default};
@@ -1,62 +0,0 @@
1
- import { s as stringify } from "./index.d-T71KjNAr.js";
2
- import { LiteralUnion } from 'type-fest';
3
- import { R as ReadonlyMeta, E as ExtendedRfc5424LogLevels, S as StringifyAwareReporter } from "./types.d-bWnqHJKL.js";
4
- /**
5
- * Options for configuring JSON reporters.
6
- */
7
- type AbstractJsonReporterOptions = {
8
- /** Error serialization options */
9
- error: Partial<{
10
- /** Properties to exclude from error serialization */
11
- exclude?: string[];
12
- /** Maximum depth for error object serialization */
13
- maxDepth?: number;
14
- /** Whether to use toJSON methods during serialization */
15
- useToJSON?: boolean;
16
- }>;
17
- };
18
- /**
19
- * Abstract JSON Reporter.
20
- *
21
- * Base class for JSON-based reporters that provides common functionality
22
- * for serializing log metadata to JSON format. Handles error serialization,
23
- * context processing, and provides a template method for actual output.
24
- * @template L - The log level type
25
- * @example
26
- * ```typescript
27
- * class CustomJsonReporter extends AbstractJsonReporter {
28
- * protected _log(message: string): void {
29
- * console.log(message);
30
- * }
31
- * }
32
- * ```
33
- */
34
- declare abstract class AbstractJsonReporter<L extends string = string> implements StringifyAwareReporter<L> {
35
- /** Custom stringify function for object serialization */
36
- protected stringify: typeof stringify | undefined;
37
- /** Error serialization options */
38
- protected errorOptions: AbstractJsonReporterOptions["error"];
39
- /**
40
- * Creates a new AbstractJsonReporter instance.
41
- * @param options Configuration options for JSON formatting and error handling
42
- */
43
- constructor(options?: Partial<AbstractJsonReporterOptions>);
44
- /**
45
- * Sets a custom stringify function for object serialization.
46
- * @param function_ The stringify function to use for serialization
47
- */
48
- setStringify(function_: typeof stringify): void;
49
- log(meta: ReadonlyMeta<L>): void;
50
- /**
51
- * Template method for outputting the JSON log message.
52
- *
53
- * Subclasses must implement this method to define how the JSON message
54
- * is actually written (to console, file, network, etc.).
55
- * @param message The JSON-formatted log message
56
- * @param logLevel The log level of the message
57
- * @protected
58
- * @abstract
59
- */
60
- protected abstract _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
61
- }
62
- export { AbstractJsonReporterOptions as A, AbstractJsonReporter as a };
@@ -1,25 +0,0 @@
1
- import{createRequire as H}from"node:module";const K=H(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Q=r=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,i]=w.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return w.getBuiltinModule(r)}return K(r)},{createRequire:j}=Q("node:module"),X=j(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Z=r=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[e,i]=b.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return b.getBuiltinModule(r)}return X(r)};Z("node:util");const ee=globalThis.process??Object.create(null),T={versions:{}},A=new Proxy(ee,{get(r,e){if(e in r)return r[e];if(e in T)return T[e]}}),re=r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
- `),ie=(r,e,i,t)=>{const s={column:0,line:-1,...r.start},n={...s,...r.end},o=s.line,d=s.column,l=n.line,c=n.column;let a=Math.max(o-(i+1),0),m=Math.min(e.length,l+t);o===-1&&(a=0),l===-1&&(m=e.length);const p=l-o,f={};if(p)for(let u=0;u<=p;u++){const h=u+o;if(!d)f[h]=!0;else if(u===0){const v=e[h-1]?.length;f[h]=[d,(v??0)-d+1]}else if(u===p)f[h]=[0,c];else{const v=e[h-u]?.length;f[h]=[0,v]}}else d===c?f[o]=d?[d,0]:!0:f[o]=[d,(c??0)-(d??0)];return{end:m,markerLines:f,start:a}},te=A.platform==="win32"&&!A.env?.WT_SESSION?">":"❯",ne=(r,e,i)=>{const t={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...i,color:{gutter:u=>u,marker:u=>u,message:u=>u,...i?.color}},s=typeof e.start.column=="number";let n=(r.includes("\r")?re(r):r).split(`
3
- `);typeof t.tabWidth=="number"&&r.includes(" ")&&(n=n.map(u=>u.replaceAll(" "," ".repeat(t.tabWidth))));const{end:o,markerLines:d,start:l}=ie(e,n,t.linesAbove,t.linesBelow),c=String(o).length,{gutter:a,marker:m,message:p}=t.color;let f=n.slice(l,o).map((u,h)=>{const v=l+1+h,E=d[v],U=String(v).padStart(c),z=!d[v+1],N=` ${U}${t.showGutter?" |":""}`;if(E){let S="";if(Array.isArray(E)){const D=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(E[0]-1,0)),Y=E[1]||1;S=[`
4
- `,t.prefix+a(N.replaceAll(/\d/g," "))," ",D,m("^").repeat(Y)].join(""),z&&t.message&&(S+=` ${p(t.message)}`)}return[t.prefix+m(te),a(N),u.length>0?` ${u}`:"",S].join("")}return`${t.prefix} ${a(N)}${u.length>0?` ${u}`:""}`}).join(`
5
- `);return t.message&&!s&&(f=`${t.prefix+" ".repeat(c+1)+t.message}
6
- ${f}`),f},oe=()=>A.env?.DEBUG==="true",$=(r,...e)=>{if(oe()){const i=e.map(t=>typeof t=="function"?t():t);console.debug(`error:parse-stacktrace: ${r}`,...i)}},g="<unknown>",se=/^(?:node:internal\/|node:|internal\/)/,le=r=>r!==void 0&&se.test(r),ae=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ce=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,de=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,ue=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,fe=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,me=/in\s(.*)\s\(at\s(.+)\)\sat/,pe=/^(?:.*@)?(.*):(\d+):(\d+)$/,he=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ve=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$e=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,L=/\(error: ([^)]*)\)/,ge=/at\s/,ye=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,xe=/Error: |AggregateError:/,_=/^Anonymous function$/,we=/^\s*in\s.*/,be=/^.*?\s*at\s.*/,Ee=/^.*?\s*@.*|\[native code\]/,C=(r,e)=>{const i=r.includes("safari-extension"),t=r.includes("safari-web-extension");return i||t?[r.includes("@")?r.split("@")[0]:g,i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},B=(r,e)=>{const i=de.exec(e);i&&(r.file=i[1],r.line=+i[2],r.column=+i[3])},Ne=r=>{const e=me.exec(r);if(e){$(`parse nested node error stack line: "${r}"`,()=>`found: ${JSON.stringify(e)}`);const t=e[2].split(":");return{column:t[2]?+t[2]:void 0,file:t[0],line:t[1]?+t[1]:void 0,methodName:e[1]??g,raw:r,type:void 0}}const i=fe.exec(r);if(i){$(`parse node error stack line: "${r}"`,()=>`found: ${JSON.stringify(i)}`);const t={column:i[4]?+i[4]:void 0,file:i[2]?i[2].replace(ge,""):void 0,line:i[3]?+i[3]:void 0,methodName:i[1]??g,raw:r,type:r.startsWith("internal")?"internal":void 0};return B(t,`${i[2]}:${i[3]}:${i[4]}`),t}},Se=r=>{const e=ae.exec(r);if(e){$(`parse chrome error stack line: "${r}"`,()=>`found: ${JSON.stringify(e)}`);const i=e[2]?.startsWith("native"),t=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,n;if(t){const c=ce.exec(r);if(c){const a=ye.exec(c[1]);a?(e[2]=a[4]??a[1],e[3]=a[5]??a[2],e[4]=a[3]):c[2]&&(e[2]=c[1]),c[2]&&(s={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0,methodName:"eval",raw:r,type:"eval"})}else{const a=ue.exec(r);a&&(n={column:a[4]?+a[4]:void 0,file:a[2],line:a[3]?+a[3]:void 0},s={column:a[6]?+a[6]:void 0,file:a[1],line:a[5]?+a[5]:void 0,methodName:"eval",raw:a[0],type:"eval"})}}const[o,d]=C(e[1]?e[1].replace(_,"<anonymous>"):g,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:s,file:d,line:e[3]?+e[3]:void 0,methodName:o,raw:r,type:t?"eval":i?"native":le(d)?"internal":void 0};return n?(l.column=n.column,l.file=n.file,l.line=n.line):B(l,`${d}:${e[3]}:${e[4]}`),l}},Ae=(r,e)=>{const i=he.exec(r);if(i){$(`parse gecko error stack line: "${r}"`,()=>`found: ${JSON.stringify(i)}`);const t=i[3]?.includes(" > eval"),s=t&&i[3]&&ve.exec(i[3]);let n;t&&s&&(i[3]=s[1],n={column:i[5]?+i[5]:void 0,file:i[3],line:i[4]?+i[4]:void 0,methodName:"eval",raw:r,type:"eval"},i[4]=s[2]);const[o,d]=C(i[1]?i[1].replace(_,"<anonymous>"):g,i[3]);let l;(e?.type==="safari"||!t&&e?.type==="firefox")&&e.column?l=e.column:!t&&i[5]&&(l=+i[5]);let c;return(e?.type==="safari"||!t&&e?.type==="firefox")&&e.line?c=e.line:i[4]&&(c=+i[4]),{column:l,evalOrigin:n,file:d,line:c,methodName:o,raw:r,type:t?"eval":d.includes("[native code]")?"native":void 0}}},ke=(r,e)=>{const i=$e.exec(r);if(!(i&&i[2].includes(" > eval"))&&i)return $(`parse firefox error stack line: "${r}"`,()=>`found: ${JSON.stringify(i)}`),{column:i[4]?+i[4]:e?.column??void 0,file:i[2],line:i[3]?+i[3]:e?.line??void 0,methodName:i[1]||g,raw:r,type:void 0}},Me=r=>{const e=pe.exec(r);if(e)return $(`parse react android native error stack line: "${r}"`,()=>`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:g,raw:r,type:void 0}},O=(r,{filter:e,frameLimit:i=50}={})=>{const t=r;let s=(typeof t.stacktrace=="string"?t.stacktrace:r.stack??"").split(`
7
- `).map(n=>(L.test(n)?n.replace(L,"$1"):n).trim()).filter(n=>!xe.test(n)&&n!=="eval code");return e&&(s=s.filter(n=>e(n))),s=s.slice(0,i),s.reduce((n,o,d)=>{if(!o||o.length>1024)return n;let l;if(we.test(o))l=Ne(o);else if(be.test(o))l=Se(o);else if(Ee.test(o)){let c;if(d===0){const a=r,m=a.columnNumber,p=a.lineNumber,f=a.line,u=a.column;m||p?c={column:m,line:p,type:"firefox"}:(f||u)&&(c={column:u,line:f,type:"safari"})}l=ke(o,c)??Ae(o,c)}else l=Me(o);return l?n.push(l):$(`parse error stack line: "${o}"`,"not parser found"),n},[])},Te=j(import.meta.url),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=r=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[e,i]=x.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return x.getBuiltinModule(r)}return Te(r)},{existsSync:Le,readFileSync:We}=k("node:fs"),{relative:je,resolve:W,sep:_e}=k("node:path"),{cwd:Ce}=x,{fileURLToPath:Be}=k("node:url"),y=(r,e,i)=>i===0?r:e===" "?r+" ".repeat(i):r+" ".repeat(e*i),R=r=>r.replaceAll("\\","/"),Oe=(r,e)=>{const i=r.replace("async file:","file:");return R(je(e,i.startsWith("file:")?Be(i):i))},Re=(r,e,i)=>{if(e)return i.title(r.message);const t=r.message?`: ${r.message}`:"";return i.title(r.name+t)},I=(r,{color:e,hideErrorTitle:i,indentation:t,prefix:s},n)=>`${y(s,t,n)}${Re(r,i,e)}
8
- `,P=(r,{color:e,indentation:i,prefix:t},s)=>{if(r.hint===void 0)return;const n=y(t,i,s);let o="";if(Array.isArray(r.hint))for(const d of r.hint)o+=`${n+d}
9
- `;else o+=n+r.hint;return e.hint(o)},V=(r,e)=>{if(!e||r.file===void 0||r.line===void 0)return{trace:r};try{const i=e({column:r.column,file:r.file,line:r.line});return i?{source:i.source,trace:{...r,column:i.column??r.column,file:i.file??r.file,line:i.line??r.line}}:{trace:r}}catch{return{trace:r}}},M=(r,e,i=0)=>{const{color:t,cwd:s,displayShortPath:n,indentation:o,prefix:d}=e,{trace:l}=V(r,e.sourceMap),c=n?Oe(l.file,s):R(l.file),{fileLine:a,method:m}=t;return`${y(d,o,i)}at ${l.methodName?`${m(l.methodName)} `:""}${a(c)}:${a(l.line?.toString()??"")}`},Ie=(r,e)=>{if(e.allowAllFilePaths)return!0;const i=W(e.cwd),t=W(i,r);return t===i||t.startsWith(i+_e)},G=(r,e,i)=>{const{color:t,indentation:s,linesAbove:n,linesBelow:o,prefix:d,showGutter:l,showLineNumbers:c,tabWidth:a}=e,{source:m,trace:p}=V(r,e.sourceMap);if(p.file===void 0)return;let f;if(m===void 0){const u=p.file.replace("file://","");if(!Ie(u,e)||!Le(u))return;f=We(u,"utf8")}else f=m;return ne(f,{start:{column:p.column,line:p.line}},{color:t,linesAbove:n,linesBelow:o,prefix:y(d,s,i),showGutter:l,showLineNumbers:c,tabWidth:a})},J=(r,e,i)=>{if(r.errors.length===0)return;let t=`${y(e.prefix,e.indentation,i)}Errors:
10
-
11
- `,s=!0;for(const n of r.errors)s?s=!1:t+=`
12
-
13
- `,t+=F(n,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},i+1);return`
14
- ${t}`},q=(r,e,i,t=new Set)=>{t.add(r);let s=`${y(e.prefix,e.indentation,i)}Caused by:
15
-
16
- `;const n=r.cause;s+=I(n,e,i);const o=O(n).shift(),d=P(n,e,i);if(d&&(s+=`${d}
17
- `),o&&(s+=M(o,e,i),!e.hideErrorCauseCodeView)){const l=G(o,e,i);l!==void 0&&(s+=`
18
- ${l}`)}if(n instanceof AggregateError){const l=J(n,e,i);l!==void 0&&(s+=`
19
- ${l}`)}return n.cause&&(s+=t.has(n)?`
20
- ${y(e.prefix,e.indentation,i+1)}Caused by: [Circular]`:`
21
- ${q(n,e,i+1,t)}`),`
22
- ${s}`},Pe=(r,e)=>(r.length>0?`
23
- `:"")+r.map(i=>M(i,e)).join(`
24
- `),F=(r,e,i)=>{const t={allowAllFilePaths:!1,cwd:Ce(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:o=>o,gutter:o=>o,hint:o=>o,marker:o=>o,message:o=>o,method:o=>o,title:o=>o,...e.color}},s=O(r,{filter:e.filterStacktrace,frameLimit:t.framesMaxLimit}),n=s.shift();return[e.hideMessage?void 0:I(r,t,i),P(r,t,i),n?M(n,t,i):void 0,n&&!t.hideErrorCodeView?G(n,t,i):void 0,r instanceof AggregateError?J(r,t,i):void 0,r.cause===void 0?void 0:q(r,t,i),s.length>0?Pe(s,t):void 0].filter(Boolean).join(`
25
- `)},Je=(r,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return F(r,e,0)},Ve=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&Ve.set("AggregateError",AggregateError);export{Je as U};
@@ -1,47 +0,0 @@
1
- import { P as PailBrowserImpl } from "./wide-event.d-D3ATYpoK.js";
2
- import { D as DefaultLogTypes, L as LoggerFunction } from "./types.d-bWnqHJKL.js";
3
- /**
4
- * Route configuration for a specific path pattern.
5
- */
6
- interface RouteConfig {
7
- /** Override the service name for requests matching this route. */
8
- service?: string;
9
- }
10
- /**
11
- * A pail instance with dynamically generated log methods.
12
- */
13
- type PailLike<T extends string = string> = PailBrowserImpl<T> & Record<DefaultLogTypes | T, LoggerFunction>;
14
- /**
15
- * Base options shared by all framework middleware adapters.
16
- * @template T - Custom logger type names from the pail instance
17
- */
18
- interface PailMiddlewareOptions<T extends string = string> {
19
- /**
20
- * Glob patterns for paths to exclude from logging.
21
- * Exclusions take precedence over inclusions.
22
- * @example ["/health", "/api/_internal/**"]
23
- */
24
- exclude?: string[];
25
- /**
26
- * Glob patterns for paths to include in logging.
27
- * If not set, all non-excluded paths are logged.
28
- * @example ["/api/**"]
29
- */
30
- include?: string[];
31
- /**
32
- * The pail logger instance to use for wide event emission.
33
- */
34
- pail: PailLike<T>;
35
- /**
36
- * Route-specific configuration. Maps glob patterns to config.
37
- * First matching route wins.
38
- * @example { "/api/auth/**": { service: "auth-service" } }
39
- */
40
- routes?: Record<string, RouteConfig>;
41
- /**
42
- * Default service name for all wide events.
43
- * Can be overridden per-route via `routes`.
44
- */
45
- service?: string;
46
- }
47
- export { PailMiddlewareOptions as P };
@@ -1 +0,0 @@
1
- import{WideEvent as u}from"../wide-event.js";const m=s=>{let e="^",t=0;for(;t<s.length;){const r=s[t];if(r==="*"&&s[t+1]==="*")t+=2,s[t]==="/"&&(t+=1),t>=s.length&&e.endsWith("/")?e=`${e.slice(0,-1)}(/.*)?`:t>=s.length?e+=".*":e+="(.*/)?";else switch(r){case"*":{e+="[^/]*",t+=1;break}case".":{e+=String.raw`\.`,t+=1;break}case"?":{e+="[^/]",t+=1;break}default:e+=r,t+=1}}return e+="$",new RegExp(e)},l=(s,e)=>m(e).test(s),k=(s,e,t)=>t?.some(r=>l(s,r))?!1:e?.length?e.some(r=>l(s,r)):!0,x=(s,e)=>{if(!e)return;const t=Object.entries(e);for(let r=0;r<t.length;r+=1){const[a,o]=t[r];if(l(s,a))return o.service}},L=(s,e)=>{const{exclude:t,include:r,pail:a,routes:o,service:g}=s,{headers:d,method:n,path:i,requestId:p}=e;if(!k(i,r,t)){const h=new u({autoEmit:!1,name:`${n} ${i}`,pail:a});return{finish:()=>{},logger:h,skipped:!0}}const w=x(i,o)??g,c=new u({name:`${n} ${i}`,pail:a,service:w});return c.set({method:n,path:i,requestId:p,...d?{headers:d}:{}}),{finish:h=>{c.finish(h)},logger:c,skipped:!1}},f=new Set(["authorization","cookie","proxy-authorization","set-cookie","x-api-key","x-auth-token"]),$=s=>{const e={};return s.forEach((t,r)=>{f.has(r.toLowerCase())||(e[r.toLowerCase()]=t)}),e},b=s=>{const e={},t=Object.entries(s);for(let r=0;r<t.length;r+=1){const[a,o]=t[r];!f.has(a.toLowerCase())&&o!==void 0&&(e[a.toLowerCase()]=Array.isArray(o)?o.join(", "):o)}return e};export{b as a,L as c,$ as e};
@@ -1 +0,0 @@
1
- const O=e=>{const t=Object.keys(e).map(o=>e[o].label??"");return t.length===0?"":t.reduce((o,a)=>o.length>a.length?o:a,"")};let h;const B=()=>(h!==void 0||(h=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]])),h),$=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,A=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,v=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,S=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,x=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),y=/\s+/,m=e=>{const t=B();t.has(e)&&(e=t.get(e));const o=$.exec(e);if(o)return[Number.parseInt(o[1],16),Number.parseInt(o[2],16),Number.parseInt(o[3],16)];const a=A.exec(e);if(a)return[Number.parseInt(`${a[1]}${a[1]}`,16),Number.parseInt(`${a[2]}${a[2]}`,16),Number.parseInt(`${a[3]}${a[3]}`,16)];const c=v.exec(e);if(c)return[Math.round(Math.max(0,Math.min(255,Number(c[1])))),Math.round(Math.max(0,Math.min(255,Number(c[2])))),Math.round(Math.max(0,Math.min(255,Number(c[3]))))];const r=S.exec(e);if(r){let i=Number(r[1])%360;i<0&&(i+=360);const l=Math.max(0,Math.min(100,Number(r[2])))/100,d=Math.max(0,Math.min(100,Number(r[3])))/100,u=(1-Math.abs(2*d-1))*l,b=u*(1-Math.abs(i/60%2-1)),n=d-u/2;let s,f,g;return i<60?{0:s,1:f,2:g}=[u,b,0]:i<120?{0:s,1:f,2:g}=[b,u,0]:i<180?{0:s,1:f,2:g}=[0,u,b]:i<240?{0:s,1:f,2:g}=[0,b,u]:i<300?{0:s,1:f,2:g}=[b,0,u]:{0:s,1:f,2:g}=[u,0,b],[Math.round((s+n)*255),Math.round((f+n)*255),Math.round((g+n)*255)]}return null},k=(e,t)=>e?.[0]===t?.[0]&&e?.[1]===t?.[1]&&e?.[2]===t?.[2],D=e=>{if(typeof e!="string")return x();const t=x(),o=[];let a=!1,c=null,r=0,i="";for(const l of e){if(l==="(")r+=1;else if(r>0)l===")"&&(r-=1);else if(a){if(l===";"){const d=i.trim();d!==""&&o.push([c,d]),c=null,i="",a=!1;continue}}else if(l===":"){c=i.trim(),i="",a=!0;continue}i+=l}if(a&&r===0){const l=i.trim();l!==""&&o.push([c,l]),c=null,i=""}for(const{0:l,1:d}of o)switch(l){case"background-color":{d!=null&&(t.backgroundColor=d);break}case"color":{d!=null&&(t.color=d);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(d)&&(t.fontStyle="italic");break}case"font-weight":{d==="bold"&&(t.fontWeight=d);break}case"text-decoration":{t.textDecorationColor=null,t.textDecorationLine=[];const u=d.split(y);for(const b of u){const n=m(b);n!=null?t.textDecorationColor=n:["line-through","overline","underline"].includes(b)&&t.textDecorationLine.push(b)}break}case"text-decoration-color":{const u=m(d);u!=null&&(t.textDecorationColor=u);break}case"text-decoration-line":{t.textDecorationLine=[];const u=d.split(y);for(const b of u)["line-through","overline","underline"].includes(b)&&t.textDecorationLine.push(b);break}}return t},M=(e,t)=>{t=t??x();let o="";if(!k(e.backgroundColor,t.backgroundColor))if(e.backgroundColor==null)o+="\x1B[49m";else switch(e.backgroundColor){case"black":{o+="\x1B[40m";break}case"blue":{o+="\x1B[44m";break}case"cyan":{o+="\x1B[46m";break}case"green":{o+="\x1B[42m";break}case"magenta":{o+="\x1B[45m";break}case"red":{o+="\x1B[41m";break}case"white":{o+="\x1B[47m";break}case"yellow":{o+="\x1B[43m";break}default:if(Array.isArray(e.backgroundColor)){const{0:a,1:c,2:r}=e.backgroundColor;o+=`\x1B[48;2;${String(a)};${String(c)};${String(r)}m`}else{const a=m(e.backgroundColor);if(a===null)o+="\x1B[49m";else{const{0:c,1:r,2:i}=a;o+=`\x1B[48;2;${String(c)};${String(r)};${String(i)}m`}}}if(!k(e.color,t.color))if(e.color==null)o+="\x1B[39m";else switch(e.color){case"black":{o+="\x1B[30m";break}case"blue":{o+="\x1B[34m";break}case"cyan":{o+="\x1B[36m";break}case"green":{o+="\x1B[32m";break}case"magenta":{o+="\x1B[35m";break}case"red":{o+="\x1B[31m";break}case"white":{o+="\x1B[37m";break}case"yellow":{o+="\x1B[33m";break}default:if(Array.isArray(e.color)){const{0:a,1:c,2:r}=e.color;o+=`\x1B[38;2;${String(a)};${String(c)};${String(r)}m`}else{const a=m(e.color);if(a===null)o+="\x1B[39m";else{const{0:c,1:r,2:i}=a;o+=`\x1B[38;2;${String(c)};${String(r)};${String(i)}m`}}}if(e.fontWeight!==t.fontWeight&&(o+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==t.fontStyle&&(o+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!k(e.textDecorationColor,t.textDecorationColor))if(e.textDecorationColor==null)o+="\x1B[59m";else{const{0:a,1:c,2:r}=e.textDecorationColor;o+=`\x1B[58;2;${String(a)};${String(c)};${String(r)}m`}return e.textDecorationLine.includes("line-through")!==t.textDecorationLine.includes("line-through")&&(o+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==t.textDecorationLine.includes("overline")&&(o+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==t.textDecorationLine.includes("underline")&&(o+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),o},N=e=>{try{return JSON.stringify(e)}catch{return'"[Circular]"'}},p="%".codePointAt(0),C="s".codePointAt(0),L="d".codePointAt(0),F="f".codePointAt(0),P="i".codePointAt(0),j="O".codePointAt(0),q="o".codePointAt(0),E="j".codePointAt(0),I="c".codePointAt(0),w=(e,t=[],o={})=>{if(typeof e!="string"&&typeof e!="object"||e===null)throw new TypeError(`fmt must be a string or object, got ${e===null?"null":typeof e}`);const a=o.stringify??N,c=1;if(typeof e=="object"){const n=t.length+c;if(n===1)return"{}";const s=Array.from({length:n});s[0]=a(e);for(let f=1;f<n;f+=1)s[f]=a(t[f-c]);return s.join(" ")}if(t.length===0)return e;let r="",i=1-c,l=-1,d=!1,u;const b=o.colors??globalThis.window===void 0;for(let n=0;n<e.length;){if(e.codePointAt(n)===p&&n+1<e.length){l=l>-1?l:0;const s=e.codePointAt(n+1);switch(s){case I:{if(b){const f=D(t[i]);l<n&&(r+=e.slice(l,n));const g=M(f,u);r+=g,g!==""&&(d=!0,u=f)}l=n+2,n+=1;break}case L:case F:{const f=t[i];if(i>=t.length||f==null)break;l<n&&(r+=e.slice(l,n)),r+=(typeof f=="symbol"?Number.NaN:Number(f)).toString(),l=n+2,n+=1;break}case P:{const f=t[i];if(i>=t.length||f==null)break;l<n&&(r+=e.slice(l,n)),r+=Math.floor(typeof f=="symbol"?Number.NaN:Number(f)).toString(),l=n+2,n+=1;break}case E:case j:case q:{if(i>=t.length||t[i]===void 0)break;l<n&&(r+=e.slice(l,n));const f=t[i],g=typeof f;if(g==="string"){r+=`'${f}'`,l=n+2,n+=1;break}if(g==="function"){r+=f.name?`[Function: ${f.name}]`:"[Function: <anonymous>]",l=n+2,n+=1;break}r+=a(f),l=n+2,n+=1;break}case p:{l<n&&(r+=e.slice(l,n)),r+="%",l=n+2,n+=1,i-=1;break}case C:{if(i>=t.length)break;l<n&&(r+=e.slice(l,n));const f=t[i];r+=typeof f=="object"&&f!==null?a(f):String(f),l=n+2,n+=1;break}default:typeof o.formatters?.[s]=="function"?(l<n&&(r+=e.slice(l,n)),r+=o.formatters[s](t[i]),l=n+2,n+=1):i-=1}i+=1}n+=1}if(l===-1&&!(o.appendExtraArguments&&i<t.length))return e;if(l===-1?r=e:l<e.length&&(r+=e.slice(l)),l!==-1&&d&&(r+="\x1B[0m"),o.appendExtraArguments&&i<t.length)for(let n=Math.max(i,0);n<t.length;n+=1){const s=t[n];r+=` ${typeof s=="object"&&s!==null?a(s):String(s)}`}return r},W=(e={})=>{const t={};typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([a,c])=>{if(a.length===0)throw new Error(`Formatter %${a} has no characters`);if(a.length>1)throw new Error(`Formatter %${a} has more than one character`);if(typeof c!="function")throw new TypeError(`Formatter for %${a} is not a function`);const r=a.codePointAt(0);if(r===void 0)throw new Error(`${a}.codePointAt(0) failed to return a value, please report this issue`);t[r]=c});const o=Object.freeze({formatters:t});return(a,c=[],r)=>r===void 0?w(a,c,o):w(a,c,{...r,formatters:t})};export{W as O,O as g,w as y};
@@ -1 +0,0 @@
1
- const p=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}}),y=e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},f=new WeakSet,s=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)&&s(t.value))}},m=e=>{f.add(e);const r=e.toJSON();return f.delete(e),Object.isExtensible(r)&&s(r),r},c=(e,r,a,t,u=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,l(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 o=[];for(const[n,i]of e.entries())o.push([c(n,r,a,t,u),c(i,r,a,t,u)]);return{__dataType:"Map",value:o}}if(e instanceof Set){const o=[];for(const n of e.values())o.push(c(n,r,a,t,u));return{__dataType:"Set",value:o}}if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(y(e)){if(u.has(e))return"[Circular]";if(t.maxDepth!==void 0&&t.maxDepth!==Number.POSITIVE_INFINITY&&a+1>=t.maxDepth)return{};a+=1,u.add(e);const o={};for(const n in e)o[n]=c(e[n],r,a,t,u);return u.delete(e),o}try{return e}catch{return"[Not Available]"}},l=(e,r,a,t)=>{if(a.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!f.has(e))return m(e);const u=Object.create(p);if(Object.defineProperty(u,"name",{configurable:!0,enumerable:!0,value:Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,writable:!0}),Object.defineProperty(u,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(u,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const n=[];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(u,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),u;n.push(l(i,r,a,t))}Object.defineProperty(u,"errors",{configurable:!0,enumerable:!0,value:n,writable:!0})}const o=e.cause;if(o!=null)if(o instanceof Error)a.has(o)?Object.defineProperty(u,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(u,"cause",{configurable:!0,enumerable:!0,value:l(o,r,a,t),writable:!0});else{const n=c(o,a,t,r);Object.defineProperty(u,"cause",{configurable:!0,enumerable:!0,value:n,writable:!0})}for(const n in e){if(n==="name"||n==="message"||n==="stack"||n==="cause"||n==="errors")continue;const i=e[n],b=c(i,a,t,r);Object.defineProperty(u,n,{configurable:!0,enumerable:!0,value:b,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const n of r.exclude)try{delete u[n]}catch{}return u},O=(e,r={})=>l(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0);export{O};
@@ -1 +0,0 @@
1
- import{createRequire as t}from"node:module";const n=t(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=s=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,o]=r.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return r.getBuiltinModule(s)}return n(s)},{AsyncLocalStorage:c}=i("node:async_hooks"),u=s=>{const e=new c;return{storage:e,useLogger:()=>{const o=e.getStore();if(!o)throw new Error(`[pail] useLogger() called outside of ${s}`);return o}}};export{u as c};