@visulima/pail 4.0.0-alpha.20 → 4.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/LICENSE.md +841 -6
- package/README.md +53 -24
- package/dist/error.js +2 -2
- package/dist/index.browser.d.ts +16 -5
- package/dist/index.browser.js +19 -19
- package/dist/index.server.d.ts +30 -5
- package/dist/index.server.js +28 -27
- package/dist/middleware/elysia.d.ts +5 -4
- package/dist/middleware/elysia.js +1 -1
- package/dist/middleware/express.d.ts +5 -4
- package/dist/middleware/express.js +1 -1
- package/dist/middleware/fastify.d.ts +5 -4
- package/dist/middleware/fastify.js +1 -1
- package/dist/middleware/hono.d.ts +5 -4
- package/dist/middleware/hono.js +1 -1
- package/dist/middleware/next/handler.d.ts +5 -4
- package/dist/middleware/next/handler.js +1 -1
- package/dist/middleware/sveltekit.d.ts +5 -4
- package/dist/middleware/sveltekit.js +1 -1
- package/dist/object-tree.js +2 -2
- package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +1 -0
- package/dist/packem_shared/AbstractJsonReporter-C6iu_u9-.js +1 -0
- package/dist/packem_shared/JsonReporter-BXktpC__.js +2 -0
- package/dist/packem_shared/JsonReporter-bmem9lcg.js +1 -0
- package/dist/packem_shared/PailError-CbU1Ogfa.js +5 -0
- package/dist/packem_shared/PrettyReporter-DNNseeLK.js +44 -0
- package/dist/packem_shared/PrettyReporter-DsHfKOU7.js +5 -0
- package/dist/packem_shared/{abstract-json-reporter.d-BAgznjyU.d.ts → abstract-json-reporter.d-wfESoEa-.d.ts} +3 -2
- package/dist/packem_shared/abstract-pretty-reporter-Bczvp2Zh.js +57 -0
- package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-f9no2VNI.js +25 -0
- package/dist/packem_shared/{create-middleware-logger.d-CR3o6VDh.d.ts → create-middleware-logger.d-B-JmQ1Sl.d.ts} +2 -2
- package/dist/packem_shared/headers-DH0H2s8W.js +1 -0
- package/dist/packem_shared/index-Q1764hvO.js +1 -0
- package/dist/packem_shared/index.d-T71KjNAr.d.ts +16 -0
- package/dist/packem_shared/pailMiddleware-B5DJoBYl.js +1 -0
- package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +1 -0
- package/dist/packem_shared/storage-DaXAlpiO.js +1 -0
- package/dist/packem_shared/{types.d-BeLumqgD.d.ts → types.d-bWnqHJKL.d.ts} +2 -37
- package/dist/packem_shared/useLogger-DB34CuU5.js +1 -0
- package/dist/packem_shared/{wide-event.d-gb2-ks5w.d.ts → wide-event.d-D3ATYpoK.d.ts} +17 -5
- package/dist/packem_shared/write-console-log-based-on-level-BqjxV016.js +1 -0
- package/dist/packem_shared/write-stream-C7jxLxIT.js +1 -0
- package/dist/processor/caller/caller-processor.d.ts +2 -1
- package/dist/processor/caller/caller-processor.js +1 -1
- package/dist/processor/environment-processor.d.ts +2 -1
- package/dist/processor/environment-processor.js +1 -1
- package/dist/processor/message-formatter-processor.d.ts +9 -1
- package/dist/processor/message-formatter-processor.js +1 -1
- package/dist/processor/opentelemetry-processor.d.ts +2 -1
- package/dist/processor/opentelemetry-processor.js +1 -1
- package/dist/processor/redact-processor.d.ts +41 -2
- package/dist/processor/redact-processor.js +1 -1
- package/dist/processor/sampling-processor.d.ts +2 -1
- package/dist/processor/sampling-processor.js +1 -1
- package/dist/reporter/file/json-file-reporter.d.ts +21 -3
- package/dist/reporter/file/json-file-reporter.js +2 -2
- package/dist/reporter/http/abstract-http-reporter.d.ts +46 -3
- package/dist/reporter/http/abstract-http-reporter.js +2 -2
- package/dist/reporter/http/http-reporter.d.ts +4 -3
- package/dist/reporter/http/http-reporter.edge-light.d.ts +57 -1
- package/dist/reporter/http/http-reporter.edge-light.js +2 -2
- package/dist/reporter/http/http-reporter.js +1 -1
- package/dist/reporter/json/index.browser.d.ts +1 -1
- package/dist/reporter/json/index.browser.js +1 -1
- package/dist/reporter/json/index.d.ts +6 -4
- package/dist/reporter/json/index.js +1 -1
- package/dist/reporter/pretty/index.browser.js +1 -1
- package/dist/reporter/pretty/index.d.ts +125 -5
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.d.ts +87 -5
- package/dist/reporter/simple/simple-reporter.server.js +8 -8
- package/dist/wide-event.d.ts +4 -3
- package/dist/wide-event.js +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/AbstractJsonReporter-D_Pb6kpB.js +0 -1
- package/dist/packem_shared/AbstractJsonReporter-PVC4ONf2.js +0 -1
- package/dist/packem_shared/JsonReporter-BEEmb0W4.js +0 -2
- package/dist/packem_shared/JsonReporter-CE-lw7R0.js +0 -1
- package/dist/packem_shared/PrettyReporter-CDv9n1Fy.js +0 -5
- package/dist/packem_shared/PrettyReporter-CuFxJm_o.js +0 -44
- package/dist/packem_shared/abstract-pretty-reporter-BpyhtAoN.js +0 -33
- package/dist/packem_shared/createPailError-53jAfQ-T.js +0 -5
- package/dist/packem_shared/headers-S8WyX-2m.js +0 -1
- package/dist/packem_shared/index-Dwp5v97D.js +0 -1
- package/dist/packem_shared/pailMiddleware-CWOJRmJq.js +0 -1
- package/dist/packem_shared/storage-DHM1EP2P.js +0 -1
- package/dist/packem_shared/useLogger-qyZrjy4D.js +0 -1
- package/dist/packem_shared/write-console-log-based-on-level-DfD64owL.js +0 -1
- package/dist/packem_shared/write-stream-Dd4_PTcm.js +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
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],S=` ${U}${t.showGutter?" |":""}`;if(E){let N="";if(Array.isArray(E)){const D=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(E[0]-1,0)),Y=E[1]||1;N=[`
|
|
4
|
+
`,t.prefix+a(S.replaceAll(/\d/g," "))," ",D,m("^").repeat(Y)].join(""),z&&t.message&&(N+=` ${p(t.message)}`)}return[t.prefix+m(te),a(S),u.length>0?` ${u}`:"",N].join("")}return`${t.prefix} ${a(S)}${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=/\S*(?: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])},Se=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}},Ne=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=Se(o);else if(be.test(o))l=Ne(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,5 +1,5 @@
|
|
|
1
|
-
import { P as PailBrowserImpl } from "./wide-event.d-
|
|
2
|
-
import { D as DefaultLogTypes,
|
|
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
3
|
/**
|
|
4
4
|
* Route configuration for a specific path pattern.
|
|
5
5
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object);
|
|
2
|
+
declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined;
|
|
3
|
+
declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string;
|
|
4
|
+
declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined;
|
|
5
|
+
declare namespace stringify {
|
|
6
|
+
export function configure(options: StringifyOptions): typeof stringify;
|
|
7
|
+
}
|
|
8
|
+
interface StringifyOptions {
|
|
9
|
+
bigint?: boolean;
|
|
10
|
+
circularValue?: string | null | TypeErrorConstructor | ErrorConstructor;
|
|
11
|
+
deterministic?: boolean | ((a: string, b: string) => number);
|
|
12
|
+
maximumBreadth?: number;
|
|
13
|
+
maximumDepth?: number;
|
|
14
|
+
strict?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export { stringify as s };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=/\*+/g,u=(s,c)=>{const{exclude:i,include:n}=c??{};return e=>{const a=e.nextUrl.pathname;if(i?.some(r=>a.startsWith(r.replaceAll(o,"")))||n?.length&&!n.some(r=>a.startsWith(r.replaceAll(o,""))))return s.next();const d=e.headers.get("x-request-id")??crypto.randomUUID(),t=new Headers(e.headers);t.set("x-request-id",d),t.set("x-pail-start",String(Date.now()));const l=s.next({request:{headers:t}});return l.headers.set("x-request-id",d),l}};export{u as pailMiddleware};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -1,41 +1,6 @@
|
|
|
1
1
|
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
import { InteractiveManager } from '@visulima/interactive-manager';
|
|
3
|
-
|
|
4
|
-
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
5
|
-
|
|
6
|
-
@category Type
|
|
7
|
-
*/
|
|
8
|
-
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
9
|
-
/**
|
|
10
|
-
Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
11
|
-
|
|
12
|
-
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
|
13
|
-
|
|
14
|
-
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
|
15
|
-
|
|
16
|
-
@example
|
|
17
|
-
```
|
|
18
|
-
import type {LiteralUnion} from 'type-fest';
|
|
19
|
-
|
|
20
|
-
// Before
|
|
21
|
-
|
|
22
|
-
type Pet = 'dog' | 'cat' | string;
|
|
23
|
-
|
|
24
|
-
const petWithoutAutocomplete: Pet = '';
|
|
25
|
-
// Start typing in your TypeScript-enabled IDE.
|
|
26
|
-
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
27
|
-
|
|
28
|
-
// After
|
|
29
|
-
|
|
30
|
-
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
31
|
-
|
|
32
|
-
const petWithAutoComplete: Pet2 = '';
|
|
33
|
-
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
@category Type
|
|
37
|
-
*/
|
|
38
|
-
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
3
|
+
import { Primitive, LiteralUnion } from 'type-fest';
|
|
39
4
|
/**
|
|
40
5
|
* Global namespace for extending Pail's metadata interface.
|
|
41
6
|
*
|
|
@@ -243,4 +208,4 @@ type Message = {
|
|
|
243
208
|
prefix?: string;
|
|
244
209
|
suffix?: string;
|
|
245
210
|
};
|
|
246
|
-
export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E, InteractiveStreamReporter as I,
|
|
211
|
+
export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E, InteractiveStreamReporter as I, LoggerFunction as L, Meta as M, Processor as P, ReadonlyMeta as R, StringifyAwareReporter as S, StreamAwareReporter as a, StringifyAwareProcessor as b, LoggerTypesConfig as c, Reporter as d, LoggerTypesAwareReporter as e };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as s}from"node:module";const i=s(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,n=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,t]=o.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return o.getBuiltinModule(e)}return i(e)},{AsyncLocalStorage:c}=n("node:async_hooks"),a=new c,u=()=>{const e=a.getStore();if(!e)throw new Error("[pail] useLogger() called outside of withPail() context. Wrap your route handler or server action with withPail().");return e};export{a as pailStorage,u as useLogger};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { stringify } from
|
|
2
|
-
import {
|
|
1
|
+
import { s as stringify } from "./index.d-T71KjNAr.js";
|
|
2
|
+
import { LiteralUnion } from 'type-fest';
|
|
3
|
+
import { M as Meta, D as DefaultLogTypes, c as LoggerTypesConfig, P as Processor, E as ExtendedRfc5424LogLevels, d as Reporter, L as LoggerFunction, C as ConstructorOptions } from "./types.d-bWnqHJKL.js";
|
|
3
4
|
/**
|
|
4
5
|
* Pail Browser Implementation.
|
|
5
6
|
*
|
|
@@ -25,9 +26,6 @@ import { M as Meta, D as DefaultLogTypes, L as LiteralUnion, c as LoggerTypesCon
|
|
|
25
26
|
*/
|
|
26
27
|
declare class PailBrowserImpl<T extends string = string, L extends string = string> {
|
|
27
28
|
#private;
|
|
28
|
-
protected timersMap: Map<string, number>;
|
|
29
|
-
protected countMap: Map<string, number>;
|
|
30
|
-
protected seqTimers: Set<string>;
|
|
31
29
|
protected readonly lastLog: {
|
|
32
30
|
count?: number;
|
|
33
31
|
object?: Meta<L>;
|
|
@@ -116,6 +114,20 @@ declare class PailBrowserImpl<T extends string = string, L extends string = stri
|
|
|
116
114
|
*/
|
|
117
115
|
wrapException(): void;
|
|
118
116
|
/**
|
|
117
|
+
* Removes the global exception/rejection handlers installed by {@link wrapException}.
|
|
118
|
+
*
|
|
119
|
+
* Counterpart to `wrapException()` (mirrors `wrapConsole()`/`restoreConsole()`).
|
|
120
|
+
* Safe to call when no handlers are installed.
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const logger = createPail();
|
|
124
|
+
* logger.wrapException();
|
|
125
|
+
* // ... later ...
|
|
126
|
+
* logger.restoreException(); // global handlers removed
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
restoreException(): void;
|
|
130
|
+
/**
|
|
119
131
|
* Disables all logging output.
|
|
120
132
|
*
|
|
121
133
|
* When disabled, all log calls will be silently ignored and no output
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=new Set(["alert","critical","emergency","error"]),n=r=>{const e=console;return o.has(r)?e.__error??console.error:r==="warning"?e.__warn??console.warn:r==="trace"?e.__trace??console.trace:e.__log??console.log};export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=new Set(["alert","critical","emergency","error","trace","warning"]),e=t=>a.has(t),c=(t,r)=>(r.__write??r.write.bind(r)).call(r,t);export{c as a,e as r};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { M as Meta, P as Processor } from "../../packem_shared/types.d-
|
|
1
|
+
import { M as Meta, P as Processor } from "../../packem_shared/types.d-bWnqHJKL.js";
|
|
2
2
|
import '@visulima/colorize';
|
|
3
3
|
import '@visulima/interactive-manager';
|
|
4
|
+
import 'type-fest';
|
|
4
5
|
/**
|
|
5
6
|
* Global namespace extension for caller file metadata.
|
|
6
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const u=()=>{const i=Error.prepareStackTrace;try{let l=[];Error.prepareStackTrace=(n,e)=>{const m=e.slice(1);return l=m,m};const r=l.reduce((n,e)=>(e.isNative()||e.getFileName()?.includes("pail/dist")||n.push({columnNumber:e.getColumnNumber(),fileName:e.getFileName()??void 0,lineNumber:e.getLineNumber()}),n),[]).at(0);return r?{columnNumber:r.columnNumber??void 0,fileName:r.fileName,lineNumber:r.lineNumber??void 0}:{fileName:"anonymous",lineNumber:void 0}}finally{Error.prepareStackTrace=i}};class a{process(l){const{columnNumber:r,fileName:n,lineNumber:e}=u();return l.file={column:r,line:e,name:n},l}}export{a as default};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { M as Meta, P as Processor } from "../packem_shared/types.d-
|
|
1
|
+
import { M as Meta, P as Processor } from "../packem_shared/types.d-bWnqHJKL.js";
|
|
2
2
|
import '@visulima/colorize';
|
|
3
3
|
import '@visulima/interactive-manager';
|
|
4
|
+
import 'type-fest';
|
|
4
5
|
/**
|
|
5
6
|
* Detected environment information.
|
|
6
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const O=()=>{if(!process.env)return{};const{env:e}=process,E={commit:e.COMMIT_SHA||e.GIT_COMMIT||e.VERCEL_GIT_COMMIT_SHA?.slice(0,7)||e.RAILWAY_GIT_COMMIT_SHA?.slice(0,7)||e.RENDER_GIT_COMMIT?.slice(0,7)||e.HEROKU_SLUG_COMMIT?.slice(0,7)||e.CF_PAGES_COMMIT_SHA?.slice(0,7)||void 0,environment:e.NODE_ENV||e.ENVIRONMENT||e.APP_ENV||void 0,hostname:e.HOSTNAME||e.HOST||void 0,pid:process.pid,region:e.AWS_REGION||e.VERCEL_REGION||e.FLY_REGION||e.RENDER_REGION||e.CF_REGION||e.GOOGLE_CLOUD_REGION||e.FUNCTION_REGION||void 0,service:e.SERVICE_NAME||e.APP_NAME||e.K_SERVICE||e.GAE_SERVICE||e.FUNCTION_TARGET||e.VERCEL_PROJECT_PRODUCTION_URL||e.FLY_APP_NAME||e.RAILWAY_SERVICE_NAME||e.RENDER_SERVICE_NAME||e.HEROKU_APP_NAME||void 0,version:e.APP_VERSION||e.npm_package_version||e.K_REVISION||e.GAE_VERSION||e.RAILWAY_GIT_COMMIT_SHA?.slice(0,7)||e.RENDER_GIT_COMMIT?.slice(0,7)||void 0};return Object.fromEntries(Object.entries(E).filter(([,i])=>i!==void 0))};class R{#e;constructor(E={}){const i=O(),_={};if(E.overrides){const t=Object.entries(E.overrides);for(let o=0;o<t.length;o+=1){const[n,I]=t[o];I!==void 0&&(_[n]=I)}}const s={...i,..._};!E.includePid&&_.pid===void 0&&delete s.pid,!E.includeHostname&&_.hostname===void 0&&delete s.hostname,this.#e=s}process(E){return{...E,envStorage:{...this.#e}}}getEnvironmentInfo(){return{...this.#e}}}export{R as default,O as detectEnvironment};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { M as Meta, b as StringifyAwareProcessor } from "../packem_shared/types.d-
|
|
1
|
+
import { M as Meta, b as StringifyAwareProcessor } from "../packem_shared/types.d-bWnqHJKL.js";
|
|
2
2
|
import '@visulima/colorize';
|
|
3
3
|
import '@visulima/interactive-manager';
|
|
4
|
+
import 'type-fest';
|
|
5
|
+
/**
|
|
6
|
+
* A custom specifier formatter: receives the matched argument and returns its string form.
|
|
7
|
+
*/
|
|
4
8
|
type FormatterFunction = (argument: any) => string;
|
|
5
9
|
/**
|
|
10
|
+
* Internal map of custom formatters keyed by the specifier character's codepoint, as produced by
|
|
11
|
+
* {@link build}.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
6
14
|
* Message Formatter Processor.
|
|
7
15
|
*
|
|
8
16
|
* A processor that formats log messages using the {@link https://visulima.com/packages/fmt/|@visulima/fmt} library.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var A=Object.defineProperty;var m=(e,t)=>A(e,"name",{value:t,configurable:!0});var S=Object.defineProperty,D=m((e,t)=>S(e,"name",{value:t,configurable:!0}),"x"),C=Object.defineProperty,$=D((e,t)=>C(e,"name",{value:t,configurable:!0}),"h"),N=Object.defineProperty,g=$((e,t)=>N(e,"name",{value:t,configurable:!0}),"g$1");const p=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"]]),M=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,P=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,j=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,F=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,k=g(()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),"getDefaultCss"),w=/\s+/,h=g(e=>{p.has(e)&&(e=p.get(e));const t=M.exec(e);if(t)return[Number.parseInt(t[1],16),Number.parseInt(t[2],16),Number.parseInt(t[3],16)];const r=P.exec(e);if(r)return[Number.parseInt(`${r[1]}${r[1]}`,16),Number.parseInt(`${r[2]}${r[2]}`,16),Number.parseInt(`${r[3]}${r[3]}`,16)];const i=j.exec(e);if(i)return[Math.round(Math.max(0,Math.min(255,Number(i[1])))),Math.round(Math.max(0,Math.min(255,Number(i[2])))),Math.round(Math.max(0,Math.min(255,Number(i[3]))))];const l=F.exec(e);if(l){let a=Number(l[1])%360;a<0&&(a+=360);const f=Math.max(0,Math.min(100,Number(l[2])))/100,n=Math.max(0,Math.min(100,Number(l[3])))/100,c=(1-Math.abs(2*n-1))*f,u=c*(1-Math.abs(a/60%2-1)),o=n-c/2;let d,s,b;return a<60?{0:d,1:s,2:b}=[c,u,0]:a<120?{0:d,1:s,2:b}=[u,c,0]:a<180?{0:d,1:s,2:b}=[0,c,u]:a<240?{0:d,1:s,2:b}=[0,u,c]:a<300?{0:d,1:s,2:b}=[u,0,c]:{0:d,1:s,2:b}=[c,0,u],[Math.round((d+o)*255),Math.round((s+o)*255),Math.round((b+o)*255)]}return null},"parseCssColor"),y=g((e,t)=>e?.[0]===t?.[0]&&e?.[1]===t?.[1]&&e?.[2]===t?.[2],"colorEquals"),L=g(e=>{if(typeof e!="string")return k();const t=k(),r=[];let i=!1,l=null,a=0,f="";for(const n of e){if(n==="(")a+=1;else if(a>0)n===")"&&(a-=1);else if(i){if(n===";"){const c=f.trim();c!==""&&r.push([l,c]),l=null,f="",i=!1;continue}}else if(n===":"){l=f.trim(),f="",i=!0;continue}f+=n}if(i&&a===0){const n=f.trim();n!==""&&r.push([l,n]),l=null,f=""}for(const{0:n,1:c}of r)switch(n){case"background-color":{c!=null&&(t.backgroundColor=c);break}case"color":{c!=null&&(t.color=c);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(c)&&(t.fontStyle="italic");break}case"font-weight":{c==="bold"&&(t.fontWeight=c);break}case"text-decoration":{t.textDecorationColor=null,t.textDecorationLine=[];const u=c.split(w);for(const o of u){const d=h(o);d!=null?t.textDecorationColor=d:["line-through","overline","underline"].includes(o)&&t.textDecorationLine.push(o)}break}case"text-decoration-color":{const u=h(c);u!=null&&(t.textDecorationColor=u);break}case"text-decoration-line":{t.textDecorationLine=[];const u=c.split(w);for(const o of u)["line-through","overline","underline"].includes(o)&&t.textDecorationLine.push(o);break}}return t},"parseCss"),q=g((e,t)=>{t=t??k();let r="";if(!y(e.backgroundColor,t.backgroundColor))if(e.backgroundColor==null)r+="\x1B[49m";else switch(e.backgroundColor){case"black":{r+="\x1B[40m";break}case"blue":{r+="\x1B[44m";break}case"cyan":{r+="\x1B[46m";break}case"green":{r+="\x1B[42m";break}case"magenta":{r+="\x1B[45m";break}case"red":{r+="\x1B[41m";break}case"white":{r+="\x1B[47m";break}case"yellow":{r+="\x1B[43m";break}default:if(Array.isArray(e.backgroundColor)){const{0:i,1:l,2:a}=e.backgroundColor;r+=`\x1B[48;2;${String(i)};${String(l)};${String(a)}m`}else{const i=h(e.backgroundColor);if(i===null)r+="\x1B[49m";else{const{0:l,1:a,2:f}=i;r+=`\x1B[48;2;${String(l)};${String(a)};${String(f)}m`}}}if(!y(e.color,t.color))if(e.color==null)r+="\x1B[39m";else switch(e.color){case"black":{r+="\x1B[30m";break}case"blue":{r+="\x1B[34m";break}case"cyan":{r+="\x1B[36m";break}case"green":{r+="\x1B[32m";break}case"magenta":{r+="\x1B[35m";break}case"red":{r+="\x1B[31m";break}case"white":{r+="\x1B[37m";break}case"yellow":{r+="\x1B[33m";break}default:if(Array.isArray(e.color)){const{0:i,1:l,2:a}=e.color;r+=`\x1B[38;2;${String(i)};${String(l)};${String(a)}m`}else{const i=h(e.color);if(i===null)r+="\x1B[39m";else{const{0:l,1:a,2:f}=i;r+=`\x1B[38;2;${String(l)};${String(a)};${String(f)}m`}}}if(e.fontWeight!==t.fontWeight&&(r+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==t.fontStyle&&(r+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!y(e.textDecorationColor,t.textDecorationColor))if(e.textDecorationColor==null)r+="\x1B[59m";else{const{0:i,1:l,2:a}=e.textDecorationColor;r+=`\x1B[58;2;${String(i)};${String(l)};${String(a)}m`}return e.textDecorationLine.includes("line-through")!==t.textDecorationLine.includes("line-through")&&(r+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==t.textDecorationLine.includes("overline")&&(r+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==t.textDecorationLine.includes("underline")&&(r+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),r},"cssToAnsi");var O=Object.defineProperty,x=$((e,t)=>O(e,"name",{value:t,configurable:!0}),"u");const E=x(e=>{try{return JSON.stringify(e)}catch{return'"[Circular]"'}},"tryStringify"),v="%".codePointAt(0),I="s".codePointAt(0),W="d".codePointAt(0),T="f".codePointAt(0),_="i".codePointAt(0),J="O".codePointAt(0),z="o".codePointAt(0),G="j".codePointAt(0),H="c".codePointAt(0),K=x((e,t=[],r={})=>{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 i=r.stringify??E,l=1;if(typeof e=="object"){const o=t.length+l;if(o===1)return"{}";const d=Array.from({length:o});d[0]=i(e);for(let s=1;s<o;s+=1)d[s]=i(t[s-l]);return d.join(" ")}if(t.length===0)return e;let a="",f=1-l,n=-1,c=!1,u;for(let o=0;o<e.length;){if(e.codePointAt(o)===v&&o+1<e.length){n=n>-1?n:0;const d=e.codePointAt(o+1);if(d===void 0){f+=1;break}switch(d){case H:{if(globalThis.window===void 0){const s=L(t[f]);n<o&&(a+=e.slice(n,o));const b=q(s,u);a+=b,b!==""&&(c=!0,u=s)}n=o+2,o+=1;break}case W:case T:{if(f>=t.length||t[f]==null)break;n<o&&(a+=e.slice(n,o));const s=t[f];a+=(typeof s=="symbol"?Number.NaN:Number(s)).toString(),n=o+2,o+=1;break}case _:{if(f>=t.length||t[f]==null)break;n<o&&(a+=e.slice(n,o));const s=t[f];a+=Math.floor(typeof s=="symbol"?Number.NaN:Number(s)).toString(),n=o+2,o+=1;break}case G:case J:case z:{if(f>=t.length||t[f]===void 0)break;n<o&&(a+=e.slice(n,o));const s=t[f],b=typeof s;if(b==="string"){a+=`'${s}'`,n=o+2,o+=1;break}if(b==="function"){a+=s.name?`[Function: ${s.name}]`:"[Function: <anonymous>]",n=o+2,o+=1;break}a+=i(s),n=o+2,o+=1;break}case v:{n<o&&(a+=e.slice(n,o)),a+="%",n=o+2,o+=1,f-=1;break}case I:{if(f>=t.length)break;n<o&&(a+=e.slice(n,o)),a+=typeof t[f]=="object"?i(t[f]):String(t[f]),n=o+2,o+=1;break}default:typeof r.formatters?.[d]=="function"&&(n<o&&(a+=e.slice(n,o)),a+=r.formatters[d](t[f]),n=o+2,o+=1)}f+=1}o+=1}return n===-1?e:(n<e.length&&(a+=e.slice(n)),c&&(a+="\x1B[0m"),a)},"format"),Q=x((e={})=>{const t={};return typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([r,i])=>{if(r.length===0)throw new Error(`Formatter %${r} has no characters`);if(r.length>1)throw new Error(`Formatter %${r} has more than one character`);if(typeof i!="function")throw new TypeError(`Formatter for %${r} is not a function`);const l=r.codePointAt(0);if(l===void 0)throw new Error(`${r}.codePointAt(0) failed to return a value, please report this issue`);t[l]=i}),(r,i=[],l={})=>K(r,i,{...l,formatters:t})},"build");var R=Object.defineProperty,B=m((e,t)=>R(e,"name",{value:t,configurable:!0}),"s");class V{static{m(this,"p")}static{B(this,"MessageFormatterProcessor")}#e;#r;#t;constructor(t={}){this.#r=t.formatters}setStringify(t){this.#e=t}process(t){this.#t===void 0&&(this.#t=Q({formatters:this.#r,stringify:B(i=>this.#e?this.#e(i):JSON.stringify(i),"stringify")}));const r=this.#t;return t.message!==void 0&&(t.message=this.#o(r,t.message,t.context??[])),t}#o(t,r,i=[]){if(typeof r=="string")return t(r,i);if(typeof r=="object"&&r!==null){const l=r,a=Object.keys(l);for(let f=0;f<a.length;f+=1){const n=a[f],c=l[n];(typeof c=="string"||Array.isArray(c)||typeof c=="object")&&(l[n]=this.#o(t,c,i))}}return r}}export{V as default};
|
|
1
|
+
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*)?\)$/,y=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),x=/\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 i=A.exec(e);if(i)return[Number.parseInt(`${i[1]}${i[1]}`,16),Number.parseInt(`${i[2]}${i[2]}`,16),Number.parseInt(`${i[3]}${i[3]}`,16)];const f=v.exec(e);if(f)return[Math.round(Math.max(0,Math.min(255,Number(f[1])))),Math.round(Math.max(0,Math.min(255,Number(f[2])))),Math.round(Math.max(0,Math.min(255,Number(f[3]))))];const n=S.exec(e);if(n){let l=Number(n[1])%360;l<0&&(l+=360);const a=Math.max(0,Math.min(100,Number(n[2])))/100,s=Math.max(0,Math.min(100,Number(n[3])))/100,u=(1-Math.abs(2*s-1))*a,b=u*(1-Math.abs(l/60%2-1)),r=s-u/2;let d,c,g;return l<60?{0:d,1:c,2:g}=[u,b,0]:l<120?{0:d,1:c,2:g}=[b,u,0]:l<180?{0:d,1:c,2:g}=[0,u,b]:l<240?{0:d,1:c,2:g}=[0,b,u]:l<300?{0:d,1:c,2:g}=[b,0,u]:{0:d,1:c,2:g}=[u,0,b],[Math.round((d+r)*255),Math.round((c+r)*255),Math.round((g+r)*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 y();const t=y(),o=[];let i=!1,f=null,n=0,l="";for(const a of e){if(a==="(")n+=1;else if(n>0)a===")"&&(n-=1);else if(i){if(a===";"){const s=l.trim();s!==""&&o.push([f,s]),f=null,l="",i=!1;continue}}else if(a===":"){f=l.trim(),l="",i=!0;continue}l+=a}if(i&&n===0){const a=l.trim();a!==""&&o.push([f,a]),f=null,l=""}for(const{0:a,1:s}of o)switch(a){case"background-color":{s!=null&&(t.backgroundColor=s);break}case"color":{s!=null&&(t.color=s);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(s)&&(t.fontStyle="italic");break}case"font-weight":{s==="bold"&&(t.fontWeight=s);break}case"text-decoration":{t.textDecorationColor=null,t.textDecorationLine=[];const u=s.split(x);for(const b of u){const r=m(b);r!=null?t.textDecorationColor=r:["line-through","overline","underline"].includes(b)&&t.textDecorationLine.push(b)}break}case"text-decoration-color":{const u=m(s);u!=null&&(t.textDecorationColor=u);break}case"text-decoration-line":{t.textDecorationLine=[];const u=s.split(x);for(const b of u)["line-through","overline","underline"].includes(b)&&t.textDecorationLine.push(b);break}}return t},M=(e,t)=>{t=t??y();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:i,1:f,2:n}=e.backgroundColor;o+=`\x1B[48;2;${String(i)};${String(f)};${String(n)}m`}else{const i=m(e.backgroundColor);if(i===null)o+="\x1B[49m";else{const{0:f,1:n,2:l}=i;o+=`\x1B[48;2;${String(f)};${String(n)};${String(l)}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:i,1:f,2:n}=e.color;o+=`\x1B[38;2;${String(i)};${String(f)};${String(n)}m`}else{const i=m(e.color);if(i===null)o+="\x1B[39m";else{const{0:f,1:n,2:l}=i;o+=`\x1B[38;2;${String(f)};${String(n)};${String(l)}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:i,1:f,2:n}=e.textDecorationColor;o+=`\x1B[58;2;${String(i)};${String(f)};${String(n)}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),j="d".codePointAt(0),L="f".codePointAt(0),F="i".codePointAt(0),P="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 i=o.stringify??N,f=1;if(typeof e=="object"){const r=t.length+f;if(r===1)return"{}";const d=Array.from({length:r});d[0]=i(e);for(let c=1;c<r;c+=1)d[c]=i(t[c-f]);return d.join(" ")}if(t.length===0)return e;let n="",l=1-f,a=-1,s=!1,u;const b=o.colors??globalThis.window===void 0;for(let r=0;r<e.length;){if(e.codePointAt(r)===p&&r+1<e.length){a=a>-1?a:0;const d=e.codePointAt(r+1);switch(d){case I:{if(b){const c=D(t[l]);a<r&&(n+=e.slice(a,r));const g=M(c,u);n+=g,g!==""&&(s=!0,u=c)}a=r+2,r+=1;break}case j:case L:{const c=t[l];if(l>=t.length||c==null)break;a<r&&(n+=e.slice(a,r)),n+=(typeof c=="symbol"?Number.NaN:Number(c)).toString(),a=r+2,r+=1;break}case F:{const c=t[l];if(l>=t.length||c==null)break;a<r&&(n+=e.slice(a,r)),n+=Math.floor(typeof c=="symbol"?Number.NaN:Number(c)).toString(),a=r+2,r+=1;break}case E:case P:case q:{if(l>=t.length||t[l]===void 0)break;a<r&&(n+=e.slice(a,r));const c=t[l],g=typeof c;if(g==="string"){n+=`'${c}'`,a=r+2,r+=1;break}if(g==="function"){n+=c.name?`[Function: ${c.name}]`:"[Function: <anonymous>]",a=r+2,r+=1;break}n+=i(c),a=r+2,r+=1;break}case p:{a<r&&(n+=e.slice(a,r)),n+="%",a=r+2,r+=1,l-=1;break}case C:{if(l>=t.length)break;a<r&&(n+=e.slice(a,r));const c=t[l];n+=typeof c=="object"&&c!==null?i(c):String(c),a=r+2,r+=1;break}default:typeof o.formatters?.[d]=="function"?(a<r&&(n+=e.slice(a,r)),n+=o.formatters[d](t[l]),a=r+2,r+=1):l-=1}l+=1}r+=1}if(a===-1&&!(o.appendExtraArguments&&l<t.length))return e;if(a===-1?n=e:a<e.length&&(n+=e.slice(a)),a!==-1&&s&&(n+="\x1B[0m"),o.appendExtraArguments&&l<t.length)for(let r=Math.max(l,0);r<t.length;r+=1){const d=t[r];n+=` ${typeof d=="object"&&d!==null?i(d):String(d)}`}return n},O=(e={})=>{const t={};typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([i,f])=>{if(i.length===0)throw new Error(`Formatter %${i} has no characters`);if(i.length>1)throw new Error(`Formatter %${i} has more than one character`);if(typeof f!="function")throw new TypeError(`Formatter for %${i} is not a function`);const n=i.codePointAt(0);if(n===void 0)throw new Error(`${i}.codePointAt(0) failed to return a value, please report this issue`);t[n]=f});const o=Object.freeze({formatters:t});return(i,f=[],n)=>n===void 0?w(i,f,o):w(i,f,{...n,formatters:t})};class W{#r;#t;#e;constructor(t={}){this.#t=t.formatters}setStringify(t){this.#r=t}process(t){this.#e===void 0&&(this.#e=O({formatters:this.#t}));const o=this.#e;return t.message!==void 0&&(t.message=this.#o(o,t.message,t.context??[])),t}#o(t,o,i=[]){if(typeof o=="string")return t(o,i);if(typeof o=="object"&&o!==null){const f=o,n=Object.keys(f);for(let l=0;l<n.length;l+=1){const a=n[l],s=f[a];(typeof s=="string"||Array.isArray(s)||typeof s=="object")&&(f[a]=this.#o(t,s,i))}}return o}}export{W as default};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { M as Meta, P as Processor } from "../packem_shared/types.d-
|
|
1
|
+
import { M as Meta, P as Processor } from "../packem_shared/types.d-bWnqHJKL.js";
|
|
2
2
|
import '@visulima/colorize';
|
|
3
3
|
import '@visulima/interactive-manager';
|
|
4
|
+
import 'type-fest';
|
|
4
5
|
/**
|
|
5
6
|
* Configuration options for the OpenTelemetry processor.
|
|
6
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{trace as i,context as c,isSpanContextValid as n}from"@opentelemetry/api";class l{#s;#e;#r;#t;constructor(t={}){this.#s=t.traceIdFieldName??"trace_id",this.#e=t.spanIdFieldName??"span_id",this.#r=t.traceFlagsFieldName??"trace_flags",this.#t=t.traceFieldName}process(t){const e=i.getSpan(c.active());if(!e)return t;const s=e.spanContext();if(!n(s))return t;const r={[this.#e]:s.spanId,[this.#r]:`0${s.traceFlags.toString(16)}`,[this.#s]:s.traceId},a=this.#t?{[this.#t]:r}:r;return t.context=[...t.context??[],a],t}}export{l as OpenTelemetryProcessor};
|
|
@@ -1,15 +1,47 @@
|
|
|
1
|
-
import { M as Meta, P as Processor } from "../packem_shared/types.d-
|
|
1
|
+
import { M as Meta, P as Processor } from "../packem_shared/types.d-bWnqHJKL.js";
|
|
2
2
|
import '@visulima/colorize';
|
|
3
3
|
import '@visulima/interactive-manager';
|
|
4
|
+
import 'type-fest';
|
|
5
|
+
/**
|
|
6
|
+
* A censor function receives the original value being redacted plus the dot-path
|
|
7
|
+
* identifier of where it was found, and returns the value to store in its place.
|
|
8
|
+
*
|
|
9
|
+
* Use it for partial masking — e.g. keep the last four digits of a card number, or
|
|
10
|
+
* mask the local part of an email — instead of a static replacement string.
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const keepLast4: Censor = (value) =>
|
|
14
|
+
* typeof value === "string" ? "****" + value.slice(-4) : value;
|
|
15
|
+
* ```
|
|
16
|
+
* @param value The original value matched by the rule.
|
|
17
|
+
* @param path The dot-path of the matched key (e.g. `user.card`), or `undefined`
|
|
18
|
+
* for matches that have no key path (string-anonymizer / array-index matches).
|
|
19
|
+
*/
|
|
20
|
+
type Censor = (value: unknown, path: string | undefined) => unknown;
|
|
4
21
|
type StringAnonymize = {
|
|
5
22
|
key: string;
|
|
6
23
|
pattern: RegExp | string;
|
|
7
|
-
replacement?: string;
|
|
24
|
+
replacement?: Censor | string;
|
|
8
25
|
};
|
|
9
26
|
type Anonymize = {
|
|
27
|
+
/**
|
|
28
|
+
* When `true`, the rule is also applied to nested string values (NLP / regex based),
|
|
29
|
+
* not just to matching object keys.
|
|
30
|
+
*/
|
|
10
31
|
deep?: boolean;
|
|
32
|
+
/** The key (or wildcard pattern, or NLP type) to match. Case-insensitive. */
|
|
11
33
|
key: string;
|
|
34
|
+
/** Optional regular expression matched against nested string values. */
|
|
12
35
|
pattern?: RegExp | string;
|
|
36
|
+
/**
|
|
37
|
+
* When `true`, the matching key is deleted from the output object instead of being
|
|
38
|
+
* replaced with `replacement`. Ignored for array elements and string-anonymizer matches.
|
|
39
|
+
*/
|
|
40
|
+
remove?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The value (or {@link Censor} function) to put in place of a match. Defaults to
|
|
43
|
+
* the `<KEY>` placeholder when omitted.
|
|
44
|
+
*/
|
|
13
45
|
replacement?: unknown;
|
|
14
46
|
};
|
|
15
47
|
type Rules = (Anonymize | StringAnonymize | number | string)[];
|
|
@@ -20,6 +52,13 @@ type RedactOptions = {
|
|
|
20
52
|
};
|
|
21
53
|
};
|
|
22
54
|
/**
|
|
55
|
+
* Credential / secret rules: API keys, AWS keys, bearer/JWT/Slack tokens, crypto wallets,
|
|
56
|
+
* basic-auth strings, and the broad key-name rules (`auth`, `password`, `secret`, ...).
|
|
57
|
+
*
|
|
58
|
+
* These are the safest default rules — they target high-entropy or unambiguous shapes — and are
|
|
59
|
+
* what most logger-scrubbing use cases need.
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
23
62
|
* Redact Processor.
|
|
24
63
|
*
|
|
25
64
|
* A processor that redacts sensitive information from log messages and metadata.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{redact as e,standardRules as a}from"@visulima/redact";class n{#t;constructor(t,s){const r=t??a;this.#t=o=>e(o,r,s)}process(t){return t.message=this.#t(t.message),t.context=this.#t(t.context),t.error=this.#t(t.error),t}}export{n as default};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { M as Meta, P as Processor } from "../packem_shared/types.d-
|
|
1
|
+
import { M as Meta, P as Processor } from "../packem_shared/types.d-bWnqHJKL.js";
|
|
2
2
|
import '@visulima/colorize';
|
|
3
3
|
import '@visulima/interactive-manager';
|
|
4
|
+
import 'type-fest';
|
|
4
5
|
/**
|
|
5
6
|
* Head sampling configuration.
|
|
6
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
class e{#r;#t;constructor(t={}){this.#r=t.head??{},this.#t=t.tail??[]}process(t){const r=t.type.level;return this.#s(r)&&!this.#e(t)?{...t,dropped:!0}:t}#s(t){const r=this.#r[t];return r===void 0?!1:r<=0?!0:r>=100?!1:Math.random()*100>=r}#e(t){for(let r=0;r<this.#t.length;r+=1)if(this.#t[r](t))return!0;return!1}}export{e as default};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Options } from 'rotating-file-stream';
|
|
2
|
-
import { A as AbstractJsonReporterOptions, a as AbstractJsonReporter } from "../../packem_shared/abstract-json-reporter.d-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { A as AbstractJsonReporterOptions, a as AbstractJsonReporter } from "../../packem_shared/abstract-json-reporter.d-wfESoEa-.js";
|
|
3
|
+
import "../../packem_shared/index.d-T71KjNAr.js";
|
|
4
|
+
import 'type-fest';
|
|
5
|
+
import "../../packem_shared/types.d-bWnqHJKL.js";
|
|
5
6
|
import '@visulima/colorize';
|
|
6
7
|
import '@visulima/interactive-manager';
|
|
7
8
|
/**
|
|
@@ -86,6 +87,23 @@ declare class JsonFileReporter<L extends string = string> extends AbstractJsonRe
|
|
|
86
87
|
*/
|
|
87
88
|
constructor(options: FileReporterOptions);
|
|
88
89
|
/**
|
|
90
|
+
* Closes the underlying rotating file stream.
|
|
91
|
+
*
|
|
92
|
+
* Ends the buffered stream so any queued writes are flushed to disk before the
|
|
93
|
+
* process exits. Without this the tail of the log can be lost on a short-lived
|
|
94
|
+
* process. After calling `close()` no further writes should be made (unless
|
|
95
|
+
* `writeImmediately` was enabled, in which case each write owns its own stream).
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* process.on("beforeExit", () => reporter.close());
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
close(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Alias for {@link close} to match common transport `dispose` conventions.
|
|
104
|
+
*/
|
|
105
|
+
dispose(): void;
|
|
106
|
+
/**
|
|
89
107
|
* Writes a JSON message to the rotating file stream.
|
|
90
108
|
* @param message The JSON-formatted log message to write
|
|
91
109
|
* @protected
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
`)}}export{
|
|
1
|
+
import{AbstractJsonReporter as a}from"../../packem_shared/AbstractJsonReporter-C6iu_u9-.js";class r{#t=!0;#s;#e;constructor(t,e){this.#s=t,this.#e=e,this.#s.on("error",s=>{throw s}),this.#s.on("drain",()=>{this.#t=!0}),this.#s.on("finish",()=>{this.#t=!0})}write(t){this.writeStream(t)}end(...t){this.#s.end(...t)}get isReady(){return this.#t}writeStream(t){if(!this.#t){console.warn(`Stream busy: ${this.#e}. Write will be dropped: "${t}"`);return}this.#t=!1,this.#t=this.#s.write(t,()=>{})}}class o{#t;#s;#e;#r;#i;#h;constructor(t,e=!1,s={}){this.#t=t,this.#s=e,this.#r=s;try{this.#i=require("rotating-file-stream").createStream}catch{throw new Error("The 'rotating-file-stream' package is missing. Make sure to install the 'rotating-file-stream' package.")}this.#s||(this.#e=this.#i(this.#t,s),this.#h=new r(this.#e,this.#t))}write(t){if(this.#s){const e=this.#i(this.#t,this.#r),s=new r(e,this.#t);s.write(t),s.end();return}this.#h.write(t)}end(){this.#e!==void 0&&this.#e.end()}}class c extends a{stream;constructor(t){super();const{filePath:e,writeImmediately:s=!1,...h}=t;this.stream=new o(e,s,{compress:"gzip",interval:"1d",size:"10M",...h})}close(){this.stream.end()}dispose(){this.close()}_log(t){this.stream.write(`${t}
|
|
2
|
+
`)}}export{c as JsonFileReporter};
|