apitally 0.18.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/README.md +71 -44
  2. package/dist/adonisjs/configure.cjs +2 -2
  3. package/dist/adonisjs/configure.cjs.map +1 -1
  4. package/dist/adonisjs/configure.js.map +1 -1
  5. package/dist/adonisjs/index.cjs +2 -2
  6. package/dist/adonisjs/index.cjs.map +1 -1
  7. package/dist/adonisjs/index.d.cts +2 -2
  8. package/dist/adonisjs/index.d.ts +2 -2
  9. package/dist/adonisjs/index.js.map +1 -1
  10. package/dist/adonisjs/middleware.cjs +107 -84
  11. package/dist/adonisjs/middleware.cjs.map +1 -1
  12. package/dist/adonisjs/middleware.d.cts +2 -2
  13. package/dist/adonisjs/middleware.d.ts +2 -2
  14. package/dist/adonisjs/middleware.js +106 -83
  15. package/dist/adonisjs/middleware.js.map +1 -1
  16. package/dist/adonisjs/provider.cjs +4765 -62
  17. package/dist/adonisjs/provider.cjs.map +1 -1
  18. package/dist/adonisjs/provider.d.cts +7 -4
  19. package/dist/adonisjs/provider.d.ts +7 -4
  20. package/dist/adonisjs/provider.js +4743 -17
  21. package/dist/adonisjs/provider.js.map +1 -1
  22. package/dist/common/client.cjs +64 -42
  23. package/dist/common/client.cjs.map +1 -1
  24. package/dist/common/client.d.cts +2 -2
  25. package/dist/common/client.d.ts +2 -2
  26. package/dist/common/client.js +33 -11
  27. package/dist/common/client.js.map +1 -1
  28. package/dist/common/consumerRegistry.d.cts +2 -2
  29. package/dist/common/consumerRegistry.d.ts +2 -2
  30. package/dist/common/headers.cjs.map +1 -1
  31. package/dist/common/headers.d.cts +1 -1
  32. package/dist/common/headers.d.ts +1 -1
  33. package/dist/common/headers.js.map +1 -1
  34. package/dist/common/logging.cjs +3 -2
  35. package/dist/common/logging.cjs.map +1 -1
  36. package/dist/common/logging.d.cts +1 -1
  37. package/dist/common/logging.d.ts +1 -1
  38. package/dist/common/logging.js +3 -2
  39. package/dist/common/logging.js.map +1 -1
  40. package/dist/common/packageVersions.cjs +2 -2
  41. package/dist/common/packageVersions.cjs.map +1 -1
  42. package/dist/common/packageVersions.js.map +1 -1
  43. package/dist/common/requestCounter.d.cts +2 -2
  44. package/dist/common/requestCounter.d.ts +2 -2
  45. package/dist/common/requestLogger.cjs +57 -33
  46. package/dist/common/requestLogger.cjs.map +1 -1
  47. package/dist/common/requestLogger.d.cts +12 -5
  48. package/dist/common/requestLogger.d.ts +12 -5
  49. package/dist/common/requestLogger.js +30 -6
  50. package/dist/common/requestLogger.js.map +1 -1
  51. package/dist/common/response.cjs +12 -6
  52. package/dist/common/response.cjs.map +1 -1
  53. package/dist/common/response.d.cts +3 -3
  54. package/dist/common/response.d.ts +3 -3
  55. package/dist/common/response.js +12 -6
  56. package/dist/common/response.js.map +1 -1
  57. package/dist/common/serverErrorCounter.cjs +3 -2
  58. package/dist/common/serverErrorCounter.cjs.map +1 -1
  59. package/dist/common/serverErrorCounter.d.cts +2 -2
  60. package/dist/common/serverErrorCounter.d.ts +2 -2
  61. package/dist/common/serverErrorCounter.js +1 -0
  62. package/dist/common/serverErrorCounter.js.map +1 -1
  63. package/dist/common/tempGzipFile.cjs +15 -14
  64. package/dist/common/tempGzipFile.cjs.map +1 -1
  65. package/dist/common/tempGzipFile.d.cts +1 -1
  66. package/dist/common/tempGzipFile.d.ts +1 -1
  67. package/dist/common/tempGzipFile.js +3 -2
  68. package/dist/common/tempGzipFile.js.map +1 -1
  69. package/dist/common/types.d.cts +2 -2
  70. package/dist/common/types.d.ts +2 -2
  71. package/dist/common/validationErrorCounter.cjs +4 -4
  72. package/dist/common/validationErrorCounter.cjs.map +1 -1
  73. package/dist/common/validationErrorCounter.d.cts +2 -2
  74. package/dist/common/validationErrorCounter.d.ts +2 -2
  75. package/dist/common/validationErrorCounter.js +2 -2
  76. package/dist/common/validationErrorCounter.js.map +1 -1
  77. package/dist/elysia/index.cjs +1582 -0
  78. package/dist/elysia/index.cjs.map +1 -0
  79. package/dist/elysia/index.d.cts +9 -0
  80. package/dist/elysia/index.d.ts +9 -0
  81. package/dist/elysia/index.js +1552 -0
  82. package/dist/elysia/index.js.map +1 -0
  83. package/dist/elysia/plugin.cjs +1576 -0
  84. package/dist/elysia/plugin.cjs.map +1 -0
  85. package/dist/elysia/plugin.d.cts +53 -0
  86. package/dist/elysia/plugin.d.ts +53 -0
  87. package/dist/elysia/plugin.js +1552 -0
  88. package/dist/elysia/plugin.js.map +1 -0
  89. package/dist/elysia/utils.cjs +98 -0
  90. package/dist/elysia/utils.cjs.map +1 -0
  91. package/dist/elysia/utils.d.cts +12 -0
  92. package/dist/elysia/utils.d.ts +12 -0
  93. package/dist/elysia/utils.js +78 -0
  94. package/dist/elysia/utils.js.map +1 -0
  95. package/dist/express/index.cjs +4997 -169
  96. package/dist/express/index.cjs.map +1 -1
  97. package/dist/express/index.d.cts +2 -2
  98. package/dist/express/index.d.ts +2 -2
  99. package/dist/express/index.js +4969 -120
  100. package/dist/express/index.js.map +1 -1
  101. package/dist/express/middleware.cjs +4997 -169
  102. package/dist/express/middleware.cjs.map +1 -1
  103. package/dist/express/middleware.d.cts +2 -2
  104. package/dist/express/middleware.d.ts +2 -2
  105. package/dist/express/middleware.js +4969 -120
  106. package/dist/express/middleware.js.map +1 -1
  107. package/dist/fastify/index.cjs +4926 -72
  108. package/dist/fastify/index.cjs.map +1 -1
  109. package/dist/fastify/index.d.cts +3 -2
  110. package/dist/fastify/index.d.ts +3 -2
  111. package/dist/fastify/index.js +4899 -24
  112. package/dist/fastify/index.js.map +1 -1
  113. package/dist/fastify/plugin.cjs +4926 -72
  114. package/dist/fastify/plugin.cjs.map +1 -1
  115. package/dist/fastify/plugin.d.cts +8 -3
  116. package/dist/fastify/plugin.d.ts +8 -3
  117. package/dist/fastify/plugin.js +4899 -24
  118. package/dist/fastify/plugin.js.map +1 -1
  119. package/dist/h3/index.cjs +235 -57
  120. package/dist/h3/index.cjs.map +1 -1
  121. package/dist/h3/index.d.cts +2 -2
  122. package/dist/h3/index.d.ts +2 -2
  123. package/dist/h3/index.js +200 -22
  124. package/dist/h3/index.js.map +1 -1
  125. package/dist/h3/plugin.cjs +235 -57
  126. package/dist/h3/plugin.cjs.map +1 -1
  127. package/dist/h3/plugin.d.cts +6 -4
  128. package/dist/h3/plugin.d.ts +6 -4
  129. package/dist/h3/plugin.js +200 -22
  130. package/dist/h3/plugin.js.map +1 -1
  131. package/dist/h3/utils.cjs +2 -2
  132. package/dist/h3/utils.cjs.map +1 -1
  133. package/dist/h3/utils.js.map +1 -1
  134. package/dist/hono/index.cjs +295 -118
  135. package/dist/hono/index.cjs.map +1 -1
  136. package/dist/hono/index.d.cts +2 -2
  137. package/dist/hono/index.d.ts +2 -2
  138. package/dist/hono/index.js +261 -84
  139. package/dist/hono/index.js.map +1 -1
  140. package/dist/hono/middleware.cjs +295 -118
  141. package/dist/hono/middleware.cjs.map +1 -1
  142. package/dist/hono/middleware.d.cts +2 -2
  143. package/dist/hono/middleware.d.ts +2 -2
  144. package/dist/hono/middleware.js +261 -84
  145. package/dist/hono/middleware.js.map +1 -1
  146. package/dist/hono/utils.cjs +2 -2
  147. package/dist/hono/utils.cjs.map +1 -1
  148. package/dist/hono/utils.d.cts +2 -2
  149. package/dist/hono/utils.d.ts +2 -2
  150. package/dist/hono/utils.js.map +1 -1
  151. package/dist/koa/index.cjs +280 -107
  152. package/dist/koa/index.cjs.map +1 -1
  153. package/dist/koa/index.d.cts +2 -2
  154. package/dist/koa/index.d.ts +2 -2
  155. package/dist/koa/index.js +244 -71
  156. package/dist/koa/index.js.map +1 -1
  157. package/dist/koa/middleware.cjs +278 -107
  158. package/dist/koa/middleware.cjs.map +1 -1
  159. package/dist/koa/middleware.d.cts +2 -2
  160. package/dist/koa/middleware.d.ts +2 -2
  161. package/dist/koa/middleware.js +244 -71
  162. package/dist/koa/middleware.js.map +1 -1
  163. package/dist/loggers/console.cjs +69 -0
  164. package/dist/loggers/console.cjs.map +1 -0
  165. package/dist/loggers/console.d.cts +9 -0
  166. package/dist/loggers/console.d.ts +9 -0
  167. package/dist/loggers/console.js +46 -0
  168. package/dist/loggers/console.js.map +1 -0
  169. package/dist/loggers/index.cjs +4837 -0
  170. package/dist/loggers/index.cjs.map +1 -0
  171. package/dist/loggers/index.d.cts +9 -0
  172. package/dist/loggers/index.d.ts +9 -0
  173. package/dist/loggers/index.js +4826 -0
  174. package/dist/loggers/index.js.map +1 -0
  175. package/dist/loggers/nestjs.cjs +135 -0
  176. package/dist/loggers/nestjs.cjs.map +1 -0
  177. package/dist/loggers/nestjs.d.cts +9 -0
  178. package/dist/loggers/nestjs.d.ts +9 -0
  179. package/dist/loggers/nestjs.js +100 -0
  180. package/dist/loggers/nestjs.js.map +1 -0
  181. package/dist/loggers/pino.cjs +4669 -0
  182. package/dist/loggers/pino.cjs.map +1 -0
  183. package/dist/loggers/pino.d.cts +9 -0
  184. package/dist/loggers/pino.d.ts +9 -0
  185. package/dist/loggers/pino.js +4661 -0
  186. package/dist/loggers/pino.js.map +1 -0
  187. package/dist/loggers/utils.cjs +66 -0
  188. package/dist/loggers/utils.cjs.map +1 -0
  189. package/dist/loggers/utils.d.cts +6 -0
  190. package/dist/loggers/utils.d.ts +6 -0
  191. package/dist/loggers/utils.js +42 -0
  192. package/dist/loggers/utils.js.map +1 -0
  193. package/dist/loggers/winston.cjs +135 -0
  194. package/dist/loggers/winston.cjs.map +1 -0
  195. package/dist/loggers/winston.d.cts +9 -0
  196. package/dist/loggers/winston.d.ts +9 -0
  197. package/dist/loggers/winston.js +100 -0
  198. package/dist/loggers/winston.js.map +1 -0
  199. package/dist/nestjs/index.cjs +5448 -542
  200. package/dist/nestjs/index.cjs.map +1 -1
  201. package/dist/nestjs/index.d.cts +2 -2
  202. package/dist/nestjs/index.d.ts +2 -2
  203. package/dist/nestjs/index.js +5364 -460
  204. package/dist/nestjs/index.js.map +1 -1
  205. package/package.json +26 -4
@@ -1,4 +1,9 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
2
7
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
8
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
9
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
@@ -7,11 +12,4525 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
7
12
  if (typeof require !== "undefined") return require.apply(this, arguments);
8
13
  throw Error('Dynamic require of "' + x + '" is not supported');
9
14
  });
15
+ var __commonJS = (cb, mod) => function __require2() {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
10
34
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
35
 
36
+ // node_modules/pino-std-serializers/lib/err-helpers.js
37
+ var require_err_helpers = __commonJS({
38
+ "node_modules/pino-std-serializers/lib/err-helpers.js"(exports, module) {
39
+ "use strict";
40
+ var isErrorLike = /* @__PURE__ */ __name((err) => {
41
+ return err && typeof err.message === "string";
42
+ }, "isErrorLike");
43
+ var getErrorCause = /* @__PURE__ */ __name((err) => {
44
+ if (!err) return;
45
+ const cause = err.cause;
46
+ if (typeof cause === "function") {
47
+ const causeResult = err.cause();
48
+ return isErrorLike(causeResult) ? causeResult : void 0;
49
+ } else {
50
+ return isErrorLike(cause) ? cause : void 0;
51
+ }
52
+ }, "getErrorCause");
53
+ var _stackWithCauses = /* @__PURE__ */ __name((err, seen) => {
54
+ if (!isErrorLike(err)) return "";
55
+ const stack = err.stack || "";
56
+ if (seen.has(err)) {
57
+ return stack + "\ncauses have become circular...";
58
+ }
59
+ const cause = getErrorCause(err);
60
+ if (cause) {
61
+ seen.add(err);
62
+ return stack + "\ncaused by: " + _stackWithCauses(cause, seen);
63
+ } else {
64
+ return stack;
65
+ }
66
+ }, "_stackWithCauses");
67
+ var stackWithCauses = /* @__PURE__ */ __name((err) => _stackWithCauses(err, /* @__PURE__ */ new Set()), "stackWithCauses");
68
+ var _messageWithCauses = /* @__PURE__ */ __name((err, seen, skip) => {
69
+ if (!isErrorLike(err)) return "";
70
+ const message = skip ? "" : err.message || "";
71
+ if (seen.has(err)) {
72
+ return message + ": ...";
73
+ }
74
+ const cause = getErrorCause(err);
75
+ if (cause) {
76
+ seen.add(err);
77
+ const skipIfVErrorStyleCause = typeof err.cause === "function";
78
+ return message + (skipIfVErrorStyleCause ? "" : ": ") + _messageWithCauses(cause, seen, skipIfVErrorStyleCause);
79
+ } else {
80
+ return message;
81
+ }
82
+ }, "_messageWithCauses");
83
+ var messageWithCauses = /* @__PURE__ */ __name((err) => _messageWithCauses(err, /* @__PURE__ */ new Set()), "messageWithCauses");
84
+ module.exports = {
85
+ isErrorLike,
86
+ getErrorCause,
87
+ stackWithCauses,
88
+ messageWithCauses
89
+ };
90
+ }
91
+ });
92
+
93
+ // node_modules/pino-std-serializers/lib/err-proto.js
94
+ var require_err_proto = __commonJS({
95
+ "node_modules/pino-std-serializers/lib/err-proto.js"(exports, module) {
96
+ "use strict";
97
+ var seen = Symbol("circular-ref-tag");
98
+ var rawSymbol = Symbol("pino-raw-err-ref");
99
+ var pinoErrProto = Object.create({}, {
100
+ type: {
101
+ enumerable: true,
102
+ writable: true,
103
+ value: void 0
104
+ },
105
+ message: {
106
+ enumerable: true,
107
+ writable: true,
108
+ value: void 0
109
+ },
110
+ stack: {
111
+ enumerable: true,
112
+ writable: true,
113
+ value: void 0
114
+ },
115
+ aggregateErrors: {
116
+ enumerable: true,
117
+ writable: true,
118
+ value: void 0
119
+ },
120
+ raw: {
121
+ enumerable: false,
122
+ get: /* @__PURE__ */ __name(function() {
123
+ return this[rawSymbol];
124
+ }, "get"),
125
+ set: /* @__PURE__ */ __name(function(val) {
126
+ this[rawSymbol] = val;
127
+ }, "set")
128
+ }
129
+ });
130
+ Object.defineProperty(pinoErrProto, rawSymbol, {
131
+ writable: true,
132
+ value: {}
133
+ });
134
+ module.exports = {
135
+ pinoErrProto,
136
+ pinoErrorSymbols: {
137
+ seen,
138
+ rawSymbol
139
+ }
140
+ };
141
+ }
142
+ });
143
+
144
+ // node_modules/pino-std-serializers/lib/err.js
145
+ var require_err = __commonJS({
146
+ "node_modules/pino-std-serializers/lib/err.js"(exports, module) {
147
+ "use strict";
148
+ module.exports = errSerializer;
149
+ var { messageWithCauses, stackWithCauses, isErrorLike } = require_err_helpers();
150
+ var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
151
+ var { seen } = pinoErrorSymbols;
152
+ var { toString } = Object.prototype;
153
+ function errSerializer(err) {
154
+ if (!isErrorLike(err)) {
155
+ return err;
156
+ }
157
+ err[seen] = void 0;
158
+ const _err = Object.create(pinoErrProto);
159
+ _err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
160
+ _err.message = messageWithCauses(err);
161
+ _err.stack = stackWithCauses(err);
162
+ if (Array.isArray(err.errors)) {
163
+ _err.aggregateErrors = err.errors.map((err2) => errSerializer(err2));
164
+ }
165
+ for (const key in err) {
166
+ if (_err[key] === void 0) {
167
+ const val = err[key];
168
+ if (isErrorLike(val)) {
169
+ if (key !== "cause" && !Object.prototype.hasOwnProperty.call(val, seen)) {
170
+ _err[key] = errSerializer(val);
171
+ }
172
+ } else {
173
+ _err[key] = val;
174
+ }
175
+ }
176
+ }
177
+ delete err[seen];
178
+ _err.raw = err;
179
+ return _err;
180
+ }
181
+ __name(errSerializer, "errSerializer");
182
+ }
183
+ });
184
+
185
+ // node_modules/pino-std-serializers/lib/err-with-cause.js
186
+ var require_err_with_cause = __commonJS({
187
+ "node_modules/pino-std-serializers/lib/err-with-cause.js"(exports, module) {
188
+ "use strict";
189
+ module.exports = errWithCauseSerializer;
190
+ var { isErrorLike } = require_err_helpers();
191
+ var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
192
+ var { seen } = pinoErrorSymbols;
193
+ var { toString } = Object.prototype;
194
+ function errWithCauseSerializer(err) {
195
+ if (!isErrorLike(err)) {
196
+ return err;
197
+ }
198
+ err[seen] = void 0;
199
+ const _err = Object.create(pinoErrProto);
200
+ _err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
201
+ _err.message = err.message;
202
+ _err.stack = err.stack;
203
+ if (Array.isArray(err.errors)) {
204
+ _err.aggregateErrors = err.errors.map((err2) => errWithCauseSerializer(err2));
205
+ }
206
+ if (isErrorLike(err.cause) && !Object.prototype.hasOwnProperty.call(err.cause, seen)) {
207
+ _err.cause = errWithCauseSerializer(err.cause);
208
+ }
209
+ for (const key in err) {
210
+ if (_err[key] === void 0) {
211
+ const val = err[key];
212
+ if (isErrorLike(val)) {
213
+ if (!Object.prototype.hasOwnProperty.call(val, seen)) {
214
+ _err[key] = errWithCauseSerializer(val);
215
+ }
216
+ } else {
217
+ _err[key] = val;
218
+ }
219
+ }
220
+ }
221
+ delete err[seen];
222
+ _err.raw = err;
223
+ return _err;
224
+ }
225
+ __name(errWithCauseSerializer, "errWithCauseSerializer");
226
+ }
227
+ });
228
+
229
+ // node_modules/pino-std-serializers/lib/req.js
230
+ var require_req = __commonJS({
231
+ "node_modules/pino-std-serializers/lib/req.js"(exports, module) {
232
+ "use strict";
233
+ module.exports = {
234
+ mapHttpRequest,
235
+ reqSerializer
236
+ };
237
+ var rawSymbol = Symbol("pino-raw-req-ref");
238
+ var pinoReqProto = Object.create({}, {
239
+ id: {
240
+ enumerable: true,
241
+ writable: true,
242
+ value: ""
243
+ },
244
+ method: {
245
+ enumerable: true,
246
+ writable: true,
247
+ value: ""
248
+ },
249
+ url: {
250
+ enumerable: true,
251
+ writable: true,
252
+ value: ""
253
+ },
254
+ query: {
255
+ enumerable: true,
256
+ writable: true,
257
+ value: ""
258
+ },
259
+ params: {
260
+ enumerable: true,
261
+ writable: true,
262
+ value: ""
263
+ },
264
+ headers: {
265
+ enumerable: true,
266
+ writable: true,
267
+ value: {}
268
+ },
269
+ remoteAddress: {
270
+ enumerable: true,
271
+ writable: true,
272
+ value: ""
273
+ },
274
+ remotePort: {
275
+ enumerable: true,
276
+ writable: true,
277
+ value: ""
278
+ },
279
+ raw: {
280
+ enumerable: false,
281
+ get: /* @__PURE__ */ __name(function() {
282
+ return this[rawSymbol];
283
+ }, "get"),
284
+ set: /* @__PURE__ */ __name(function(val) {
285
+ this[rawSymbol] = val;
286
+ }, "set")
287
+ }
288
+ });
289
+ Object.defineProperty(pinoReqProto, rawSymbol, {
290
+ writable: true,
291
+ value: {}
292
+ });
293
+ function reqSerializer(req) {
294
+ const connection = req.info || req.socket;
295
+ const _req = Object.create(pinoReqProto);
296
+ _req.id = typeof req.id === "function" ? req.id() : req.id || (req.info ? req.info.id : void 0);
297
+ _req.method = req.method;
298
+ if (req.originalUrl) {
299
+ _req.url = req.originalUrl;
300
+ } else {
301
+ const path = req.path;
302
+ _req.url = typeof path === "string" ? path : req.url ? req.url.path || req.url : void 0;
303
+ }
304
+ if (req.query) {
305
+ _req.query = req.query;
306
+ }
307
+ if (req.params) {
308
+ _req.params = req.params;
309
+ }
310
+ _req.headers = req.headers;
311
+ _req.remoteAddress = connection && connection.remoteAddress;
312
+ _req.remotePort = connection && connection.remotePort;
313
+ _req.raw = req.raw || req;
314
+ return _req;
315
+ }
316
+ __name(reqSerializer, "reqSerializer");
317
+ function mapHttpRequest(req) {
318
+ return {
319
+ req: reqSerializer(req)
320
+ };
321
+ }
322
+ __name(mapHttpRequest, "mapHttpRequest");
323
+ }
324
+ });
325
+
326
+ // node_modules/pino-std-serializers/lib/res.js
327
+ var require_res = __commonJS({
328
+ "node_modules/pino-std-serializers/lib/res.js"(exports, module) {
329
+ "use strict";
330
+ module.exports = {
331
+ mapHttpResponse,
332
+ resSerializer
333
+ };
334
+ var rawSymbol = Symbol("pino-raw-res-ref");
335
+ var pinoResProto = Object.create({}, {
336
+ statusCode: {
337
+ enumerable: true,
338
+ writable: true,
339
+ value: 0
340
+ },
341
+ headers: {
342
+ enumerable: true,
343
+ writable: true,
344
+ value: ""
345
+ },
346
+ raw: {
347
+ enumerable: false,
348
+ get: /* @__PURE__ */ __name(function() {
349
+ return this[rawSymbol];
350
+ }, "get"),
351
+ set: /* @__PURE__ */ __name(function(val) {
352
+ this[rawSymbol] = val;
353
+ }, "set")
354
+ }
355
+ });
356
+ Object.defineProperty(pinoResProto, rawSymbol, {
357
+ writable: true,
358
+ value: {}
359
+ });
360
+ function resSerializer(res) {
361
+ const _res = Object.create(pinoResProto);
362
+ _res.statusCode = res.headersSent ? res.statusCode : null;
363
+ _res.headers = res.getHeaders ? res.getHeaders() : res._headers;
364
+ _res.raw = res;
365
+ return _res;
366
+ }
367
+ __name(resSerializer, "resSerializer");
368
+ function mapHttpResponse(res) {
369
+ return {
370
+ res: resSerializer(res)
371
+ };
372
+ }
373
+ __name(mapHttpResponse, "mapHttpResponse");
374
+ }
375
+ });
376
+
377
+ // node_modules/pino-std-serializers/index.js
378
+ var require_pino_std_serializers = __commonJS({
379
+ "node_modules/pino-std-serializers/index.js"(exports, module) {
380
+ "use strict";
381
+ var errSerializer = require_err();
382
+ var errWithCauseSerializer = require_err_with_cause();
383
+ var reqSerializers = require_req();
384
+ var resSerializers = require_res();
385
+ module.exports = {
386
+ err: errSerializer,
387
+ errWithCause: errWithCauseSerializer,
388
+ mapHttpRequest: reqSerializers.mapHttpRequest,
389
+ mapHttpResponse: resSerializers.mapHttpResponse,
390
+ req: reqSerializers.reqSerializer,
391
+ res: resSerializers.resSerializer,
392
+ wrapErrorSerializer: /* @__PURE__ */ __name(function wrapErrorSerializer(customSerializer) {
393
+ if (customSerializer === errSerializer) return customSerializer;
394
+ return /* @__PURE__ */ __name(function wrapErrSerializer(err) {
395
+ return customSerializer(errSerializer(err));
396
+ }, "wrapErrSerializer");
397
+ }, "wrapErrorSerializer"),
398
+ wrapRequestSerializer: /* @__PURE__ */ __name(function wrapRequestSerializer(customSerializer) {
399
+ if (customSerializer === reqSerializers.reqSerializer) return customSerializer;
400
+ return /* @__PURE__ */ __name(function wrappedReqSerializer(req) {
401
+ return customSerializer(reqSerializers.reqSerializer(req));
402
+ }, "wrappedReqSerializer");
403
+ }, "wrapRequestSerializer"),
404
+ wrapResponseSerializer: /* @__PURE__ */ __name(function wrapResponseSerializer(customSerializer) {
405
+ if (customSerializer === resSerializers.resSerializer) return customSerializer;
406
+ return /* @__PURE__ */ __name(function wrappedResSerializer(res) {
407
+ return customSerializer(resSerializers.resSerializer(res));
408
+ }, "wrappedResSerializer");
409
+ }, "wrapResponseSerializer")
410
+ };
411
+ }
412
+ });
413
+
414
+ // node_modules/pino/lib/caller.js
415
+ var require_caller = __commonJS({
416
+ "node_modules/pino/lib/caller.js"(exports, module) {
417
+ "use strict";
418
+ function noOpPrepareStackTrace(_, stack) {
419
+ return stack;
420
+ }
421
+ __name(noOpPrepareStackTrace, "noOpPrepareStackTrace");
422
+ module.exports = /* @__PURE__ */ __name(function getCallers() {
423
+ const originalPrepare = Error.prepareStackTrace;
424
+ Error.prepareStackTrace = noOpPrepareStackTrace;
425
+ const stack = new Error().stack;
426
+ Error.prepareStackTrace = originalPrepare;
427
+ if (!Array.isArray(stack)) {
428
+ return void 0;
429
+ }
430
+ const entries = stack.slice(2);
431
+ const fileNames = [];
432
+ for (const entry of entries) {
433
+ if (!entry) {
434
+ continue;
435
+ }
436
+ fileNames.push(entry.getFileName());
437
+ }
438
+ return fileNames;
439
+ }, "getCallers");
440
+ }
441
+ });
442
+
443
+ // node_modules/fast-redact/lib/validator.js
444
+ var require_validator = __commonJS({
445
+ "node_modules/fast-redact/lib/validator.js"(exports, module) {
446
+ "use strict";
447
+ module.exports = validator;
448
+ function validator(opts = {}) {
449
+ const { ERR_PATHS_MUST_BE_STRINGS = /* @__PURE__ */ __name(() => "fast-redact - Paths must be (non-empty) strings", "ERR_PATHS_MUST_BE_STRINGS"), ERR_INVALID_PATH = /* @__PURE__ */ __name((s) => `fast-redact \u2013 Invalid path (${s})`, "ERR_INVALID_PATH") } = opts;
450
+ return /* @__PURE__ */ __name(function validate({ paths }) {
451
+ paths.forEach((s) => {
452
+ if (typeof s !== "string") {
453
+ throw Error(ERR_PATHS_MUST_BE_STRINGS());
454
+ }
455
+ try {
456
+ if (/〇/.test(s)) throw Error();
457
+ const expr = (s[0] === "[" ? "" : ".") + s.replace(/^\*/, "\u3007").replace(/\.\*/g, ".\u3007").replace(/\[\*\]/g, "[\u3007]");
458
+ if (/\n|\r|;/.test(expr)) throw Error();
459
+ if (/\/\*/.test(expr)) throw Error();
460
+ Function(`
461
+ 'use strict'
462
+ const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
463
+ const \u3007 = null;
464
+ o${expr}
465
+ if ([o${expr}].length !== 1) throw Error()`)();
466
+ } catch (e) {
467
+ throw Error(ERR_INVALID_PATH(s));
468
+ }
469
+ });
470
+ }, "validate");
471
+ }
472
+ __name(validator, "validator");
473
+ }
474
+ });
475
+
476
+ // node_modules/fast-redact/lib/rx.js
477
+ var require_rx = __commonJS({
478
+ "node_modules/fast-redact/lib/rx.js"(exports, module) {
479
+ "use strict";
480
+ module.exports = /[^.[\]]+|\[((?:.)*?)\]/g;
481
+ }
482
+ });
483
+
484
+ // node_modules/fast-redact/lib/parse.js
485
+ var require_parse = __commonJS({
486
+ "node_modules/fast-redact/lib/parse.js"(exports, module) {
487
+ "use strict";
488
+ var rx = require_rx();
489
+ module.exports = parse;
490
+ function parse({ paths }) {
491
+ const wildcards = [];
492
+ var wcLen = 0;
493
+ const secret = paths.reduce(function(o, strPath, ix) {
494
+ var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
495
+ const leadingBracket = strPath[0] === "[";
496
+ path = path.map((p) => {
497
+ if (p[0] === "[") return p.substr(1, p.length - 2);
498
+ else return p;
499
+ });
500
+ const star = path.indexOf("*");
501
+ if (star > -1) {
502
+ const before = path.slice(0, star);
503
+ const beforeStr = before.join(".");
504
+ const after = path.slice(star + 1, path.length);
505
+ const nested = after.length > 0;
506
+ wcLen++;
507
+ wildcards.push({
508
+ before,
509
+ beforeStr,
510
+ after,
511
+ nested
512
+ });
513
+ } else {
514
+ o[strPath] = {
515
+ path,
516
+ val: void 0,
517
+ precensored: false,
518
+ circle: "",
519
+ escPath: JSON.stringify(strPath),
520
+ leadingBracket
521
+ };
522
+ }
523
+ return o;
524
+ }, {});
525
+ return {
526
+ wildcards,
527
+ wcLen,
528
+ secret
529
+ };
530
+ }
531
+ __name(parse, "parse");
532
+ }
533
+ });
534
+
535
+ // node_modules/fast-redact/lib/redactor.js
536
+ var require_redactor = __commonJS({
537
+ "node_modules/fast-redact/lib/redactor.js"(exports, module) {
538
+ "use strict";
539
+ var rx = require_rx();
540
+ module.exports = redactor;
541
+ function redactor({ secret, serialize, wcLen, strict, isCensorFct, censorFctTakesPath }, state) {
542
+ const redact = Function("o", `
543
+ if (typeof o !== 'object' || o == null) {
544
+ ${strictImpl(strict, serialize)}
545
+ }
546
+ const { censor, secret } = this
547
+ const originalSecret = {}
548
+ const secretKeys = Object.keys(secret)
549
+ for (var i = 0; i < secretKeys.length; i++) {
550
+ originalSecret[secretKeys[i]] = secret[secretKeys[i]]
551
+ }
552
+
553
+ ${redactTmpl(secret, isCensorFct, censorFctTakesPath)}
554
+ this.compileRestore()
555
+ ${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)}
556
+ this.secret = originalSecret
557
+ ${resultTmpl(serialize)}
558
+ `).bind(state);
559
+ redact.state = state;
560
+ if (serialize === false) {
561
+ redact.restore = (o) => state.restore(o);
562
+ }
563
+ return redact;
564
+ }
565
+ __name(redactor, "redactor");
566
+ function redactTmpl(secret, isCensorFct, censorFctTakesPath) {
567
+ return Object.keys(secret).map((path) => {
568
+ const { escPath, leadingBracket, path: arrPath } = secret[path];
569
+ const skip = leadingBracket ? 1 : 0;
570
+ const delim = leadingBracket ? "" : ".";
571
+ const hops = [];
572
+ var match;
573
+ while ((match = rx.exec(path)) !== null) {
574
+ const [, ix] = match;
575
+ const { index, input } = match;
576
+ if (index > skip) hops.push(input.substring(0, index - (ix ? 0 : 1)));
577
+ }
578
+ var existence = hops.map((p) => `o${delim}${p}`).join(" && ");
579
+ if (existence.length === 0) existence += `o${delim}${path} != null`;
580
+ else existence += ` && o${delim}${path} != null`;
581
+ const circularDetection = `
582
+ switch (true) {
583
+ ${hops.reverse().map((p) => `
584
+ case o${delim}${p} === censor:
585
+ secret[${escPath}].circle = ${JSON.stringify(p)}
586
+ break
587
+ `).join("\n")}
588
+ }
589
+ `;
590
+ const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`;
591
+ return `
592
+ if (${existence}) {
593
+ const val = o${delim}${path}
594
+ if (val === censor) {
595
+ secret[${escPath}].precensored = true
596
+ } else {
597
+ secret[${escPath}].val = val
598
+ o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
599
+ ${circularDetection}
600
+ }
601
+ }
602
+ `;
603
+ }).join("\n");
604
+ }
605
+ __name(redactTmpl, "redactTmpl");
606
+ function dynamicRedactTmpl(hasWildcards, isCensorFct, censorFctTakesPath) {
607
+ return hasWildcards === true ? `
608
+ {
609
+ const { wildcards, wcLen, groupRedact, nestedRedact } = this
610
+ for (var i = 0; i < wcLen; i++) {
611
+ const { before, beforeStr, after, nested } = wildcards[i]
612
+ if (nested === true) {
613
+ secret[beforeStr] = secret[beforeStr] || []
614
+ nestedRedact(secret[beforeStr], o, before, after, censor, ${isCensorFct}, ${censorFctTakesPath})
615
+ } else secret[beforeStr] = groupRedact(o, before, censor, ${isCensorFct}, ${censorFctTakesPath})
616
+ }
617
+ }
618
+ ` : "";
619
+ }
620
+ __name(dynamicRedactTmpl, "dynamicRedactTmpl");
621
+ function resultTmpl(serialize) {
622
+ return serialize === false ? `return o` : `
623
+ var s = this.serialize(o)
624
+ this.restore(o)
625
+ return s
626
+ `;
627
+ }
628
+ __name(resultTmpl, "resultTmpl");
629
+ function strictImpl(strict, serialize) {
630
+ return strict === true ? `throw Error('fast-redact: primitives cannot be redacted')` : serialize === false ? `return o` : `return this.serialize(o)`;
631
+ }
632
+ __name(strictImpl, "strictImpl");
633
+ }
634
+ });
635
+
636
+ // node_modules/fast-redact/lib/modifiers.js
637
+ var require_modifiers = __commonJS({
638
+ "node_modules/fast-redact/lib/modifiers.js"(exports, module) {
639
+ "use strict";
640
+ module.exports = {
641
+ groupRedact,
642
+ groupRestore,
643
+ nestedRedact,
644
+ nestedRestore
645
+ };
646
+ function groupRestore({ keys, values, target }) {
647
+ if (target == null || typeof target === "string") return;
648
+ const length = keys.length;
649
+ for (var i = 0; i < length; i++) {
650
+ const k = keys[i];
651
+ target[k] = values[i];
652
+ }
653
+ }
654
+ __name(groupRestore, "groupRestore");
655
+ function groupRedact(o, path, censor, isCensorFct, censorFctTakesPath) {
656
+ const target = get(o, path);
657
+ if (target == null || typeof target === "string") return {
658
+ keys: null,
659
+ values: null,
660
+ target,
661
+ flat: true
662
+ };
663
+ const keys = Object.keys(target);
664
+ const keysLength = keys.length;
665
+ const pathLength = path.length;
666
+ const pathWithKey = censorFctTakesPath ? [
667
+ ...path
668
+ ] : void 0;
669
+ const values = new Array(keysLength);
670
+ for (var i = 0; i < keysLength; i++) {
671
+ const key = keys[i];
672
+ values[i] = target[key];
673
+ if (censorFctTakesPath) {
674
+ pathWithKey[pathLength] = key;
675
+ target[key] = censor(target[key], pathWithKey);
676
+ } else if (isCensorFct) {
677
+ target[key] = censor(target[key]);
678
+ } else {
679
+ target[key] = censor;
680
+ }
681
+ }
682
+ return {
683
+ keys,
684
+ values,
685
+ target,
686
+ flat: true
687
+ };
688
+ }
689
+ __name(groupRedact, "groupRedact");
690
+ function nestedRestore(instructions) {
691
+ for (let i = 0; i < instructions.length; i++) {
692
+ const { target, path, value } = instructions[i];
693
+ let current = target;
694
+ for (let i2 = path.length - 1; i2 > 0; i2--) {
695
+ current = current[path[i2]];
696
+ }
697
+ current[path[0]] = value;
698
+ }
699
+ }
700
+ __name(nestedRestore, "nestedRestore");
701
+ function nestedRedact(store, o, path, ns, censor, isCensorFct, censorFctTakesPath) {
702
+ const target = get(o, path);
703
+ if (target == null) return;
704
+ const keys = Object.keys(target);
705
+ const keysLength = keys.length;
706
+ for (var i = 0; i < keysLength; i++) {
707
+ const key = keys[i];
708
+ specialSet(store, target, key, path, ns, censor, isCensorFct, censorFctTakesPath);
709
+ }
710
+ return store;
711
+ }
712
+ __name(nestedRedact, "nestedRedact");
713
+ function has(obj, prop) {
714
+ return obj !== void 0 && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false;
715
+ }
716
+ __name(has, "has");
717
+ function specialSet(store, o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) {
718
+ const afterPathLen = afterPath.length;
719
+ const lastPathIndex = afterPathLen - 1;
720
+ const originalKey = k;
721
+ var i = -1;
722
+ var n;
723
+ var nv;
724
+ var ov;
725
+ var oov = null;
726
+ var wc = null;
727
+ var kIsWc;
728
+ var wcov;
729
+ var consecutive = false;
730
+ var level = 0;
731
+ var depth = 0;
732
+ var redactPathCurrent = tree();
733
+ ov = n = o[k];
734
+ if (typeof n !== "object") return;
735
+ while (n != null && ++i < afterPathLen) {
736
+ depth += 1;
737
+ k = afterPath[i];
738
+ oov = ov;
739
+ if (k !== "*" && !wc && !(typeof n === "object" && k in n)) {
740
+ break;
741
+ }
742
+ if (k === "*") {
743
+ if (wc === "*") {
744
+ consecutive = true;
745
+ }
746
+ wc = k;
747
+ if (i !== lastPathIndex) {
748
+ continue;
749
+ }
750
+ }
751
+ if (wc) {
752
+ const wcKeys = Object.keys(n);
753
+ for (var j = 0; j < wcKeys.length; j++) {
754
+ const wck = wcKeys[j];
755
+ wcov = n[wck];
756
+ kIsWc = k === "*";
757
+ if (consecutive) {
758
+ redactPathCurrent = node(redactPathCurrent, wck, depth);
759
+ level = i;
760
+ ov = iterateNthLevel(wcov, level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, o[originalKey], depth + 1);
761
+ } else {
762
+ if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
763
+ if (kIsWc) {
764
+ ov = wcov;
765
+ } else {
766
+ ov = wcov[k];
767
+ }
768
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [
769
+ ...path,
770
+ originalKey,
771
+ ...afterPath
772
+ ]) : censor(ov) : censor;
773
+ if (kIsWc) {
774
+ const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]);
775
+ store.push(rv);
776
+ n[wck] = nv;
777
+ } else {
778
+ if (wcov[k] === nv) {
779
+ } else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
780
+ redactPathCurrent = node(redactPathCurrent, wck, depth);
781
+ } else {
782
+ redactPathCurrent = node(redactPathCurrent, wck, depth);
783
+ const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, o[originalKey]);
784
+ store.push(rv);
785
+ wcov[k] = nv;
786
+ }
787
+ }
788
+ }
789
+ }
790
+ }
791
+ wc = null;
792
+ } else {
793
+ ov = n[k];
794
+ redactPathCurrent = node(redactPathCurrent, k, depth);
795
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [
796
+ ...path,
797
+ originalKey,
798
+ ...afterPath
799
+ ]) : censor(ov) : censor;
800
+ if (has(n, k) && nv === ov || nv === void 0 && censor !== void 0) {
801
+ } else {
802
+ const rv = restoreInstr(redactPathCurrent, ov, o[originalKey]);
803
+ store.push(rv);
804
+ n[k] = nv;
805
+ }
806
+ n = n[k];
807
+ }
808
+ if (typeof n !== "object") break;
809
+ if (ov === oov || typeof ov === "undefined") {
810
+ }
811
+ }
812
+ }
813
+ __name(specialSet, "specialSet");
814
+ function get(o, p) {
815
+ var i = -1;
816
+ var l = p.length;
817
+ var n = o;
818
+ while (n != null && ++i < l) {
819
+ n = n[p[i]];
820
+ }
821
+ return n;
822
+ }
823
+ __name(get, "get");
824
+ function iterateNthLevel(wcov, level, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth) {
825
+ if (level === 0) {
826
+ if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
827
+ if (kIsWc) {
828
+ ov = wcov;
829
+ } else {
830
+ ov = wcov[k];
831
+ }
832
+ nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [
833
+ ...path,
834
+ originalKey,
835
+ ...afterPath
836
+ ]) : censor(ov) : censor;
837
+ if (kIsWc) {
838
+ const rv = restoreInstr(redactPathCurrent, ov, parent);
839
+ store.push(rv);
840
+ n[wck] = nv;
841
+ } else {
842
+ if (wcov[k] === nv) {
843
+ } else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
844
+ } else {
845
+ const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, parent);
846
+ store.push(rv);
847
+ wcov[k] = nv;
848
+ }
849
+ }
850
+ }
851
+ }
852
+ for (const key in wcov) {
853
+ if (typeof wcov[key] === "object") {
854
+ redactPathCurrent = node(redactPathCurrent, key, depth);
855
+ iterateNthLevel(wcov[key], level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, redactPathCurrent, store, parent, depth + 1);
856
+ }
857
+ }
858
+ }
859
+ __name(iterateNthLevel, "iterateNthLevel");
860
+ function tree() {
861
+ return {
862
+ parent: null,
863
+ key: null,
864
+ children: [],
865
+ depth: 0
866
+ };
867
+ }
868
+ __name(tree, "tree");
869
+ function node(parent, key, depth) {
870
+ if (parent.depth === depth) {
871
+ return node(parent.parent, key, depth);
872
+ }
873
+ var child = {
874
+ parent,
875
+ key,
876
+ depth,
877
+ children: []
878
+ };
879
+ parent.children.push(child);
880
+ return child;
881
+ }
882
+ __name(node, "node");
883
+ function restoreInstr(node2, value, target) {
884
+ let current = node2;
885
+ const path = [];
886
+ do {
887
+ path.push(current.key);
888
+ current = current.parent;
889
+ } while (current.parent != null);
890
+ return {
891
+ path,
892
+ value,
893
+ target
894
+ };
895
+ }
896
+ __name(restoreInstr, "restoreInstr");
897
+ }
898
+ });
899
+
900
+ // node_modules/fast-redact/lib/restorer.js
901
+ var require_restorer = __commonJS({
902
+ "node_modules/fast-redact/lib/restorer.js"(exports, module) {
903
+ "use strict";
904
+ var { groupRestore, nestedRestore } = require_modifiers();
905
+ module.exports = restorer;
906
+ function restorer() {
907
+ return /* @__PURE__ */ __name(function compileRestore() {
908
+ if (this.restore) {
909
+ this.restore.state.secret = this.secret;
910
+ return;
911
+ }
912
+ const { secret, wcLen } = this;
913
+ const paths = Object.keys(secret);
914
+ const resetters = resetTmpl(secret, paths);
915
+ const hasWildcards = wcLen > 0;
916
+ const state = hasWildcards ? {
917
+ secret,
918
+ groupRestore,
919
+ nestedRestore
920
+ } : {
921
+ secret
922
+ };
923
+ this.restore = Function("o", restoreTmpl(resetters, paths, hasWildcards)).bind(state);
924
+ this.restore.state = state;
925
+ }, "compileRestore");
926
+ }
927
+ __name(restorer, "restorer");
928
+ function resetTmpl(secret, paths) {
929
+ return paths.map((path) => {
930
+ const { circle, escPath, leadingBracket } = secret[path];
931
+ const delim = leadingBracket ? "" : ".";
932
+ const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`;
933
+ const clear = `secret[${escPath}].val = undefined`;
934
+ return `
935
+ if (secret[${escPath}].val !== undefined) {
936
+ try { ${reset} } catch (e) {}
937
+ ${clear}
938
+ }
939
+ `;
940
+ }).join("");
941
+ }
942
+ __name(resetTmpl, "resetTmpl");
943
+ function restoreTmpl(resetters, paths, hasWildcards) {
944
+ const dynamicReset = hasWildcards === true ? `
945
+ const keys = Object.keys(secret)
946
+ const len = keys.length
947
+ for (var i = len - 1; i >= ${paths.length}; i--) {
948
+ const k = keys[i]
949
+ const o = secret[k]
950
+ if (o) {
951
+ if (o.flat === true) this.groupRestore(o)
952
+ else this.nestedRestore(o)
953
+ secret[k] = null
954
+ }
955
+ }
956
+ ` : "";
957
+ return `
958
+ const secret = this.secret
959
+ ${dynamicReset}
960
+ ${resetters}
961
+ return o
962
+ `;
963
+ }
964
+ __name(restoreTmpl, "restoreTmpl");
965
+ }
966
+ });
967
+
968
+ // node_modules/fast-redact/lib/state.js
969
+ var require_state = __commonJS({
970
+ "node_modules/fast-redact/lib/state.js"(exports, module) {
971
+ "use strict";
972
+ module.exports = state;
973
+ function state(o) {
974
+ const { secret, censor, compileRestore, serialize, groupRedact, nestedRedact, wildcards, wcLen } = o;
975
+ const builder = [
976
+ {
977
+ secret,
978
+ censor,
979
+ compileRestore
980
+ }
981
+ ];
982
+ if (serialize !== false) builder.push({
983
+ serialize
984
+ });
985
+ if (wcLen > 0) builder.push({
986
+ groupRedact,
987
+ nestedRedact,
988
+ wildcards,
989
+ wcLen
990
+ });
991
+ return Object.assign(...builder);
992
+ }
993
+ __name(state, "state");
994
+ }
995
+ });
996
+
997
+ // node_modules/fast-redact/index.js
998
+ var require_fast_redact = __commonJS({
999
+ "node_modules/fast-redact/index.js"(exports, module) {
1000
+ "use strict";
1001
+ var validator = require_validator();
1002
+ var parse = require_parse();
1003
+ var redactor = require_redactor();
1004
+ var restorer = require_restorer();
1005
+ var { groupRedact, nestedRedact } = require_modifiers();
1006
+ var state = require_state();
1007
+ var rx = require_rx();
1008
+ var validate = validator();
1009
+ var noop = /* @__PURE__ */ __name((o) => o, "noop");
1010
+ noop.restore = noop;
1011
+ var DEFAULT_CENSOR = "[REDACTED]";
1012
+ fastRedact.rx = rx;
1013
+ fastRedact.validator = validator;
1014
+ module.exports = fastRedact;
1015
+ function fastRedact(opts = {}) {
1016
+ const paths = Array.from(new Set(opts.paths || []));
1017
+ const serialize = "serialize" in opts ? opts.serialize === false ? opts.serialize : typeof opts.serialize === "function" ? opts.serialize : JSON.stringify : JSON.stringify;
1018
+ const remove = opts.remove;
1019
+ if (remove === true && serialize !== JSON.stringify) {
1020
+ throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");
1021
+ }
1022
+ const censor = remove === true ? void 0 : "censor" in opts ? opts.censor : DEFAULT_CENSOR;
1023
+ const isCensorFct = typeof censor === "function";
1024
+ const censorFctTakesPath = isCensorFct && censor.length > 1;
1025
+ if (paths.length === 0) return serialize || noop;
1026
+ validate({
1027
+ paths,
1028
+ serialize,
1029
+ censor
1030
+ });
1031
+ const { wildcards, wcLen, secret } = parse({
1032
+ paths,
1033
+ censor
1034
+ });
1035
+ const compileRestore = restorer();
1036
+ const strict = "strict" in opts ? opts.strict : true;
1037
+ return redactor({
1038
+ secret,
1039
+ wcLen,
1040
+ serialize,
1041
+ strict,
1042
+ isCensorFct,
1043
+ censorFctTakesPath
1044
+ }, state({
1045
+ secret,
1046
+ censor,
1047
+ compileRestore,
1048
+ serialize,
1049
+ groupRedact,
1050
+ nestedRedact,
1051
+ wildcards,
1052
+ wcLen
1053
+ }));
1054
+ }
1055
+ __name(fastRedact, "fastRedact");
1056
+ }
1057
+ });
1058
+
1059
+ // node_modules/pino/lib/symbols.js
1060
+ var require_symbols = __commonJS({
1061
+ "node_modules/pino/lib/symbols.js"(exports, module) {
1062
+ "use strict";
1063
+ var setLevelSym = Symbol("pino.setLevel");
1064
+ var getLevelSym = Symbol("pino.getLevel");
1065
+ var levelValSym = Symbol("pino.levelVal");
1066
+ var levelCompSym = Symbol("pino.levelComp");
1067
+ var useLevelLabelsSym = Symbol("pino.useLevelLabels");
1068
+ var useOnlyCustomLevelsSym = Symbol("pino.useOnlyCustomLevels");
1069
+ var mixinSym = Symbol("pino.mixin");
1070
+ var lsCacheSym = Symbol("pino.lsCache");
1071
+ var chindingsSym = Symbol("pino.chindings");
1072
+ var asJsonSym = Symbol("pino.asJson");
1073
+ var writeSym = Symbol("pino.write");
1074
+ var redactFmtSym = Symbol("pino.redactFmt");
1075
+ var timeSym = Symbol("pino.time");
1076
+ var timeSliceIndexSym = Symbol("pino.timeSliceIndex");
1077
+ var streamSym = Symbol("pino.stream");
1078
+ var stringifySym = Symbol("pino.stringify");
1079
+ var stringifySafeSym = Symbol("pino.stringifySafe");
1080
+ var stringifiersSym = Symbol("pino.stringifiers");
1081
+ var endSym = Symbol("pino.end");
1082
+ var formatOptsSym = Symbol("pino.formatOpts");
1083
+ var messageKeySym = Symbol("pino.messageKey");
1084
+ var errorKeySym = Symbol("pino.errorKey");
1085
+ var nestedKeySym = Symbol("pino.nestedKey");
1086
+ var nestedKeyStrSym = Symbol("pino.nestedKeyStr");
1087
+ var mixinMergeStrategySym = Symbol("pino.mixinMergeStrategy");
1088
+ var msgPrefixSym = Symbol("pino.msgPrefix");
1089
+ var wildcardFirstSym = Symbol("pino.wildcardFirst");
1090
+ var serializersSym = Symbol.for("pino.serializers");
1091
+ var formattersSym = Symbol.for("pino.formatters");
1092
+ var hooksSym = Symbol.for("pino.hooks");
1093
+ var needsMetadataGsym = Symbol.for("pino.metadata");
1094
+ module.exports = {
1095
+ setLevelSym,
1096
+ getLevelSym,
1097
+ levelValSym,
1098
+ levelCompSym,
1099
+ useLevelLabelsSym,
1100
+ mixinSym,
1101
+ lsCacheSym,
1102
+ chindingsSym,
1103
+ asJsonSym,
1104
+ writeSym,
1105
+ serializersSym,
1106
+ redactFmtSym,
1107
+ timeSym,
1108
+ timeSliceIndexSym,
1109
+ streamSym,
1110
+ stringifySym,
1111
+ stringifySafeSym,
1112
+ stringifiersSym,
1113
+ endSym,
1114
+ formatOptsSym,
1115
+ messageKeySym,
1116
+ errorKeySym,
1117
+ nestedKeySym,
1118
+ wildcardFirstSym,
1119
+ needsMetadataGsym,
1120
+ useOnlyCustomLevelsSym,
1121
+ formattersSym,
1122
+ hooksSym,
1123
+ nestedKeyStrSym,
1124
+ mixinMergeStrategySym,
1125
+ msgPrefixSym
1126
+ };
1127
+ }
1128
+ });
1129
+
1130
+ // node_modules/pino/lib/redaction.js
1131
+ var require_redaction = __commonJS({
1132
+ "node_modules/pino/lib/redaction.js"(exports, module) {
1133
+ "use strict";
1134
+ var fastRedact = require_fast_redact();
1135
+ var { redactFmtSym, wildcardFirstSym } = require_symbols();
1136
+ var { rx, validator } = fastRedact;
1137
+ var validate = validator({
1138
+ ERR_PATHS_MUST_BE_STRINGS: /* @__PURE__ */ __name(() => "pino \u2013 redacted paths must be strings", "ERR_PATHS_MUST_BE_STRINGS"),
1139
+ ERR_INVALID_PATH: /* @__PURE__ */ __name((s) => `pino \u2013 redact paths array contains an invalid path (${s})`, "ERR_INVALID_PATH")
1140
+ });
1141
+ var CENSOR = "[Redacted]";
1142
+ var strict = false;
1143
+ function redaction(opts, serialize) {
1144
+ const { paths, censor } = handle(opts);
1145
+ const shape = paths.reduce((o, str) => {
1146
+ rx.lastIndex = 0;
1147
+ const first = rx.exec(str);
1148
+ const next = rx.exec(str);
1149
+ let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
1150
+ if (ns === "*") {
1151
+ ns = wildcardFirstSym;
1152
+ }
1153
+ if (next === null) {
1154
+ o[ns] = null;
1155
+ return o;
1156
+ }
1157
+ if (o[ns] === null) {
1158
+ return o;
1159
+ }
1160
+ const { index } = next;
1161
+ const nextPath = `${str.substr(index, str.length - 1)}`;
1162
+ o[ns] = o[ns] || [];
1163
+ if (ns !== wildcardFirstSym && o[ns].length === 0) {
1164
+ o[ns].push(...o[wildcardFirstSym] || []);
1165
+ }
1166
+ if (ns === wildcardFirstSym) {
1167
+ Object.keys(o).forEach(function(k) {
1168
+ if (o[k]) {
1169
+ o[k].push(nextPath);
1170
+ }
1171
+ });
1172
+ }
1173
+ o[ns].push(nextPath);
1174
+ return o;
1175
+ }, {});
1176
+ const result = {
1177
+ [redactFmtSym]: fastRedact({
1178
+ paths,
1179
+ censor,
1180
+ serialize,
1181
+ strict
1182
+ })
1183
+ };
1184
+ const topCensor = /* @__PURE__ */ __name((...args) => {
1185
+ return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
1186
+ }, "topCensor");
1187
+ return [
1188
+ ...Object.keys(shape),
1189
+ ...Object.getOwnPropertySymbols(shape)
1190
+ ].reduce((o, k) => {
1191
+ if (shape[k] === null) {
1192
+ o[k] = (value) => topCensor(value, [
1193
+ k
1194
+ ]);
1195
+ } else {
1196
+ const wrappedCensor = typeof censor === "function" ? (value, path) => {
1197
+ return censor(value, [
1198
+ k,
1199
+ ...path
1200
+ ]);
1201
+ } : censor;
1202
+ o[k] = fastRedact({
1203
+ paths: shape[k],
1204
+ censor: wrappedCensor,
1205
+ serialize,
1206
+ strict
1207
+ });
1208
+ }
1209
+ return o;
1210
+ }, result);
1211
+ }
1212
+ __name(redaction, "redaction");
1213
+ function handle(opts) {
1214
+ if (Array.isArray(opts)) {
1215
+ opts = {
1216
+ paths: opts,
1217
+ censor: CENSOR
1218
+ };
1219
+ validate(opts);
1220
+ return opts;
1221
+ }
1222
+ let { paths, censor = CENSOR, remove } = opts;
1223
+ if (Array.isArray(paths) === false) {
1224
+ throw Error("pino \u2013 redact must contain an array of strings");
1225
+ }
1226
+ if (remove === true) censor = void 0;
1227
+ validate({
1228
+ paths,
1229
+ censor
1230
+ });
1231
+ return {
1232
+ paths,
1233
+ censor
1234
+ };
1235
+ }
1236
+ __name(handle, "handle");
1237
+ module.exports = redaction;
1238
+ }
1239
+ });
1240
+
1241
+ // node_modules/pino/lib/time.js
1242
+ var require_time = __commonJS({
1243
+ "node_modules/pino/lib/time.js"(exports, module) {
1244
+ "use strict";
1245
+ var nullTime = /* @__PURE__ */ __name(() => "", "nullTime");
1246
+ var epochTime = /* @__PURE__ */ __name(() => `,"time":${Date.now()}`, "epochTime");
1247
+ var unixTime = /* @__PURE__ */ __name(() => `,"time":${Math.round(Date.now() / 1e3)}`, "unixTime");
1248
+ var isoTime = /* @__PURE__ */ __name(() => `,"time":"${new Date(Date.now()).toISOString()}"`, "isoTime");
1249
+ module.exports = {
1250
+ nullTime,
1251
+ epochTime,
1252
+ unixTime,
1253
+ isoTime
1254
+ };
1255
+ }
1256
+ });
1257
+
1258
+ // node_modules/quick-format-unescaped/index.js
1259
+ var require_quick_format_unescaped = __commonJS({
1260
+ "node_modules/quick-format-unescaped/index.js"(exports, module) {
1261
+ "use strict";
1262
+ function tryStringify(o) {
1263
+ try {
1264
+ return JSON.stringify(o);
1265
+ } catch (e) {
1266
+ return '"[Circular]"';
1267
+ }
1268
+ }
1269
+ __name(tryStringify, "tryStringify");
1270
+ module.exports = format4;
1271
+ function format4(f, args, opts) {
1272
+ var ss = opts && opts.stringify || tryStringify;
1273
+ var offset = 1;
1274
+ if (typeof f === "object" && f !== null) {
1275
+ var len = args.length + offset;
1276
+ if (len === 1) return f;
1277
+ var objects = new Array(len);
1278
+ objects[0] = ss(f);
1279
+ for (var index = 1; index < len; index++) {
1280
+ objects[index] = ss(args[index]);
1281
+ }
1282
+ return objects.join(" ");
1283
+ }
1284
+ if (typeof f !== "string") {
1285
+ return f;
1286
+ }
1287
+ var argLen = args.length;
1288
+ if (argLen === 0) return f;
1289
+ var str = "";
1290
+ var a = 1 - offset;
1291
+ var lastPos = -1;
1292
+ var flen = f && f.length || 0;
1293
+ for (var i = 0; i < flen; ) {
1294
+ if (f.charCodeAt(i) === 37 && i + 1 < flen) {
1295
+ lastPos = lastPos > -1 ? lastPos : 0;
1296
+ switch (f.charCodeAt(i + 1)) {
1297
+ case 100:
1298
+ case 102:
1299
+ if (a >= argLen) break;
1300
+ if (args[a] == null) break;
1301
+ if (lastPos < i) str += f.slice(lastPos, i);
1302
+ str += Number(args[a]);
1303
+ lastPos = i + 2;
1304
+ i++;
1305
+ break;
1306
+ case 105:
1307
+ if (a >= argLen) break;
1308
+ if (args[a] == null) break;
1309
+ if (lastPos < i) str += f.slice(lastPos, i);
1310
+ str += Math.floor(Number(args[a]));
1311
+ lastPos = i + 2;
1312
+ i++;
1313
+ break;
1314
+ case 79:
1315
+ case 111:
1316
+ case 106:
1317
+ if (a >= argLen) break;
1318
+ if (args[a] === void 0) break;
1319
+ if (lastPos < i) str += f.slice(lastPos, i);
1320
+ var type = typeof args[a];
1321
+ if (type === "string") {
1322
+ str += "'" + args[a] + "'";
1323
+ lastPos = i + 2;
1324
+ i++;
1325
+ break;
1326
+ }
1327
+ if (type === "function") {
1328
+ str += args[a].name || "<anonymous>";
1329
+ lastPos = i + 2;
1330
+ i++;
1331
+ break;
1332
+ }
1333
+ str += ss(args[a]);
1334
+ lastPos = i + 2;
1335
+ i++;
1336
+ break;
1337
+ case 115:
1338
+ if (a >= argLen) break;
1339
+ if (lastPos < i) str += f.slice(lastPos, i);
1340
+ str += String(args[a]);
1341
+ lastPos = i + 2;
1342
+ i++;
1343
+ break;
1344
+ case 37:
1345
+ if (lastPos < i) str += f.slice(lastPos, i);
1346
+ str += "%";
1347
+ lastPos = i + 2;
1348
+ i++;
1349
+ a--;
1350
+ break;
1351
+ }
1352
+ ++a;
1353
+ }
1354
+ ++i;
1355
+ }
1356
+ if (lastPos === -1) return f;
1357
+ else if (lastPos < flen) {
1358
+ str += f.slice(lastPos);
1359
+ }
1360
+ return str;
1361
+ }
1362
+ __name(format4, "format");
1363
+ }
1364
+ });
1365
+
1366
+ // node_modules/atomic-sleep/index.js
1367
+ var require_atomic_sleep = __commonJS({
1368
+ "node_modules/atomic-sleep/index.js"(exports, module) {
1369
+ "use strict";
1370
+ if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
1371
+ let sleep = function(ms) {
1372
+ const valid = ms > 0 && ms < Infinity;
1373
+ if (valid === false) {
1374
+ if (typeof ms !== "number" && typeof ms !== "bigint") {
1375
+ throw TypeError("sleep: ms must be a number");
1376
+ }
1377
+ throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
1378
+ }
1379
+ Atomics.wait(nil, 0, 0, Number(ms));
1380
+ };
1381
+ __name(sleep, "sleep");
1382
+ const nil = new Int32Array(new SharedArrayBuffer(4));
1383
+ module.exports = sleep;
1384
+ } else {
1385
+ let sleep1 = function(ms) {
1386
+ const valid = ms > 0 && ms < Infinity;
1387
+ if (valid === false) {
1388
+ if (typeof ms !== "number" && typeof ms !== "bigint") {
1389
+ throw TypeError("sleep: ms must be a number");
1390
+ }
1391
+ throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
1392
+ }
1393
+ const target = Date.now() + Number(ms);
1394
+ while (target > Date.now()) {
1395
+ }
1396
+ };
1397
+ __name(sleep1, "sleep1");
1398
+ module.exports = sleep1;
1399
+ }
1400
+ }
1401
+ });
1402
+
1403
+ // node_modules/sonic-boom/index.js
1404
+ var require_sonic_boom = __commonJS({
1405
+ "node_modules/sonic-boom/index.js"(exports, module) {
1406
+ "use strict";
1407
+ var fs = __require("fs");
1408
+ var EventEmitter = __require("events");
1409
+ var inherits = __require("util").inherits;
1410
+ var path = __require("path");
1411
+ var sleep = require_atomic_sleep();
1412
+ var assert = __require("assert");
1413
+ var BUSY_WRITE_TIMEOUT = 100;
1414
+ var kEmptyBuffer = Buffer.allocUnsafe(0);
1415
+ var MAX_WRITE = 16 * 1024;
1416
+ var kContentModeBuffer = "buffer";
1417
+ var kContentModeUtf8 = "utf8";
1418
+ var [major, minor] = (process.versions.node || "0.0").split(".").map(Number);
1419
+ var kCopyBuffer = major >= 22 && minor >= 7;
1420
+ function openFile(file, sonic) {
1421
+ sonic._opening = true;
1422
+ sonic._writing = true;
1423
+ sonic._asyncDrainScheduled = false;
1424
+ function fileOpened(err, fd) {
1425
+ if (err) {
1426
+ sonic._reopening = false;
1427
+ sonic._writing = false;
1428
+ sonic._opening = false;
1429
+ if (sonic.sync) {
1430
+ process.nextTick(() => {
1431
+ if (sonic.listenerCount("error") > 0) {
1432
+ sonic.emit("error", err);
1433
+ }
1434
+ });
1435
+ } else {
1436
+ sonic.emit("error", err);
1437
+ }
1438
+ return;
1439
+ }
1440
+ const reopening = sonic._reopening;
1441
+ sonic.fd = fd;
1442
+ sonic.file = file;
1443
+ sonic._reopening = false;
1444
+ sonic._opening = false;
1445
+ sonic._writing = false;
1446
+ if (sonic.sync) {
1447
+ process.nextTick(() => sonic.emit("ready"));
1448
+ } else {
1449
+ sonic.emit("ready");
1450
+ }
1451
+ if (sonic.destroyed) {
1452
+ return;
1453
+ }
1454
+ if (!sonic._writing && sonic._len > sonic.minLength || sonic._flushPending) {
1455
+ sonic._actualWrite();
1456
+ } else if (reopening) {
1457
+ process.nextTick(() => sonic.emit("drain"));
1458
+ }
1459
+ }
1460
+ __name(fileOpened, "fileOpened");
1461
+ const flags = sonic.append ? "a" : "w";
1462
+ const mode = sonic.mode;
1463
+ if (sonic.sync) {
1464
+ try {
1465
+ if (sonic.mkdir) fs.mkdirSync(path.dirname(file), {
1466
+ recursive: true
1467
+ });
1468
+ const fd = fs.openSync(file, flags, mode);
1469
+ fileOpened(null, fd);
1470
+ } catch (err) {
1471
+ fileOpened(err);
1472
+ throw err;
1473
+ }
1474
+ } else if (sonic.mkdir) {
1475
+ fs.mkdir(path.dirname(file), {
1476
+ recursive: true
1477
+ }, (err) => {
1478
+ if (err) return fileOpened(err);
1479
+ fs.open(file, flags, mode, fileOpened);
1480
+ });
1481
+ } else {
1482
+ fs.open(file, flags, mode, fileOpened);
1483
+ }
1484
+ }
1485
+ __name(openFile, "openFile");
1486
+ function SonicBoom(opts) {
1487
+ if (!(this instanceof SonicBoom)) {
1488
+ return new SonicBoom(opts);
1489
+ }
1490
+ let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {};
1491
+ fd = fd || dest;
1492
+ this._len = 0;
1493
+ this.fd = -1;
1494
+ this._bufs = [];
1495
+ this._lens = [];
1496
+ this._writing = false;
1497
+ this._ending = false;
1498
+ this._reopening = false;
1499
+ this._asyncDrainScheduled = false;
1500
+ this._flushPending = false;
1501
+ this._hwm = Math.max(minLength || 0, 16387);
1502
+ this.file = null;
1503
+ this.destroyed = false;
1504
+ this.minLength = minLength || 0;
1505
+ this.maxLength = maxLength || 0;
1506
+ this.maxWrite = maxWrite || MAX_WRITE;
1507
+ this._periodicFlush = periodicFlush || 0;
1508
+ this._periodicFlushTimer = void 0;
1509
+ this.sync = sync || false;
1510
+ this.writable = true;
1511
+ this._fsync = fsync || false;
1512
+ this.append = append || false;
1513
+ this.mode = mode;
1514
+ this.retryEAGAIN = retryEAGAIN || (() => true);
1515
+ this.mkdir = mkdir || false;
1516
+ let fsWriteSync;
1517
+ let fsWrite;
1518
+ if (contentMode === kContentModeBuffer) {
1519
+ this._writingBuf = kEmptyBuffer;
1520
+ this.write = writeBuffer;
1521
+ this.flush = flushBuffer;
1522
+ this.flushSync = flushBufferSync;
1523
+ this._actualWrite = actualWriteBuffer;
1524
+ fsWriteSync = /* @__PURE__ */ __name(() => fs.writeSync(this.fd, this._writingBuf), "fsWriteSync");
1525
+ fsWrite = /* @__PURE__ */ __name(() => fs.write(this.fd, this._writingBuf, this.release), "fsWrite");
1526
+ } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
1527
+ this._writingBuf = "";
1528
+ this.write = write;
1529
+ this.flush = flush;
1530
+ this.flushSync = flushSync;
1531
+ this._actualWrite = actualWrite;
1532
+ fsWriteSync = /* @__PURE__ */ __name(() => fs.writeSync(this.fd, this._writingBuf, "utf8"), "fsWriteSync");
1533
+ fsWrite = /* @__PURE__ */ __name(() => fs.write(this.fd, this._writingBuf, "utf8", this.release), "fsWrite");
1534
+ } else {
1535
+ throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
1536
+ }
1537
+ if (typeof fd === "number") {
1538
+ this.fd = fd;
1539
+ process.nextTick(() => this.emit("ready"));
1540
+ } else if (typeof fd === "string") {
1541
+ openFile(fd, this);
1542
+ } else {
1543
+ throw new Error("SonicBoom supports only file descriptors and files");
1544
+ }
1545
+ if (this.minLength >= this.maxWrite) {
1546
+ throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);
1547
+ }
1548
+ this.release = (err, n) => {
1549
+ if (err) {
1550
+ if ((err.code === "EAGAIN" || err.code === "EBUSY") && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) {
1551
+ if (this.sync) {
1552
+ try {
1553
+ sleep(BUSY_WRITE_TIMEOUT);
1554
+ this.release(void 0, 0);
1555
+ } catch (err2) {
1556
+ this.release(err2);
1557
+ }
1558
+ } else {
1559
+ setTimeout(fsWrite, BUSY_WRITE_TIMEOUT);
1560
+ }
1561
+ } else {
1562
+ this._writing = false;
1563
+ this.emit("error", err);
1564
+ }
1565
+ return;
1566
+ }
1567
+ this.emit("write", n);
1568
+ const releasedBufObj = releaseWritingBuf(this._writingBuf, this._len, n);
1569
+ this._len = releasedBufObj.len;
1570
+ this._writingBuf = releasedBufObj.writingBuf;
1571
+ if (this._writingBuf.length) {
1572
+ if (!this.sync) {
1573
+ fsWrite();
1574
+ return;
1575
+ }
1576
+ try {
1577
+ do {
1578
+ const n2 = fsWriteSync();
1579
+ const releasedBufObj2 = releaseWritingBuf(this._writingBuf, this._len, n2);
1580
+ this._len = releasedBufObj2.len;
1581
+ this._writingBuf = releasedBufObj2.writingBuf;
1582
+ } while (this._writingBuf.length);
1583
+ } catch (err2) {
1584
+ this.release(err2);
1585
+ return;
1586
+ }
1587
+ }
1588
+ if (this._fsync) {
1589
+ fs.fsyncSync(this.fd);
1590
+ }
1591
+ const len = this._len;
1592
+ if (this._reopening) {
1593
+ this._writing = false;
1594
+ this._reopening = false;
1595
+ this.reopen();
1596
+ } else if (len > this.minLength) {
1597
+ this._actualWrite();
1598
+ } else if (this._ending) {
1599
+ if (len > 0) {
1600
+ this._actualWrite();
1601
+ } else {
1602
+ this._writing = false;
1603
+ actualClose(this);
1604
+ }
1605
+ } else {
1606
+ this._writing = false;
1607
+ if (this.sync) {
1608
+ if (!this._asyncDrainScheduled) {
1609
+ this._asyncDrainScheduled = true;
1610
+ process.nextTick(emitDrain, this);
1611
+ }
1612
+ } else {
1613
+ this.emit("drain");
1614
+ }
1615
+ }
1616
+ };
1617
+ this.on("newListener", function(name) {
1618
+ if (name === "drain") {
1619
+ this._asyncDrainScheduled = false;
1620
+ }
1621
+ });
1622
+ if (this._periodicFlush !== 0) {
1623
+ this._periodicFlushTimer = setInterval(() => this.flush(null), this._periodicFlush);
1624
+ this._periodicFlushTimer.unref();
1625
+ }
1626
+ }
1627
+ __name(SonicBoom, "SonicBoom");
1628
+ function releaseWritingBuf(writingBuf, len, n) {
1629
+ if (typeof writingBuf === "string" && Buffer.byteLength(writingBuf) !== n) {
1630
+ n = Buffer.from(writingBuf).subarray(0, n).toString().length;
1631
+ }
1632
+ len = Math.max(len - n, 0);
1633
+ writingBuf = writingBuf.slice(n);
1634
+ return {
1635
+ writingBuf,
1636
+ len
1637
+ };
1638
+ }
1639
+ __name(releaseWritingBuf, "releaseWritingBuf");
1640
+ function emitDrain(sonic) {
1641
+ const hasListeners = sonic.listenerCount("drain") > 0;
1642
+ if (!hasListeners) return;
1643
+ sonic._asyncDrainScheduled = false;
1644
+ sonic.emit("drain");
1645
+ }
1646
+ __name(emitDrain, "emitDrain");
1647
+ inherits(SonicBoom, EventEmitter);
1648
+ function mergeBuf(bufs, len) {
1649
+ if (bufs.length === 0) {
1650
+ return kEmptyBuffer;
1651
+ }
1652
+ if (bufs.length === 1) {
1653
+ return bufs[0];
1654
+ }
1655
+ return Buffer.concat(bufs, len);
1656
+ }
1657
+ __name(mergeBuf, "mergeBuf");
1658
+ function write(data) {
1659
+ if (this.destroyed) {
1660
+ throw new Error("SonicBoom destroyed");
1661
+ }
1662
+ const len = this._len + data.length;
1663
+ const bufs = this._bufs;
1664
+ if (this.maxLength && len > this.maxLength) {
1665
+ this.emit("drop", data);
1666
+ return this._len < this._hwm;
1667
+ }
1668
+ if (bufs.length === 0 || bufs[bufs.length - 1].length + data.length > this.maxWrite) {
1669
+ bufs.push("" + data);
1670
+ } else {
1671
+ bufs[bufs.length - 1] += data;
1672
+ }
1673
+ this._len = len;
1674
+ if (!this._writing && this._len >= this.minLength) {
1675
+ this._actualWrite();
1676
+ }
1677
+ return this._len < this._hwm;
1678
+ }
1679
+ __name(write, "write");
1680
+ function writeBuffer(data) {
1681
+ if (this.destroyed) {
1682
+ throw new Error("SonicBoom destroyed");
1683
+ }
1684
+ const len = this._len + data.length;
1685
+ const bufs = this._bufs;
1686
+ const lens = this._lens;
1687
+ if (this.maxLength && len > this.maxLength) {
1688
+ this.emit("drop", data);
1689
+ return this._len < this._hwm;
1690
+ }
1691
+ if (bufs.length === 0 || lens[lens.length - 1] + data.length > this.maxWrite) {
1692
+ bufs.push([
1693
+ data
1694
+ ]);
1695
+ lens.push(data.length);
1696
+ } else {
1697
+ bufs[bufs.length - 1].push(data);
1698
+ lens[lens.length - 1] += data.length;
1699
+ }
1700
+ this._len = len;
1701
+ if (!this._writing && this._len >= this.minLength) {
1702
+ this._actualWrite();
1703
+ }
1704
+ return this._len < this._hwm;
1705
+ }
1706
+ __name(writeBuffer, "writeBuffer");
1707
+ function callFlushCallbackOnDrain(cb) {
1708
+ this._flushPending = true;
1709
+ const onDrain = /* @__PURE__ */ __name(() => {
1710
+ if (!this._fsync) {
1711
+ try {
1712
+ fs.fsync(this.fd, (err) => {
1713
+ this._flushPending = false;
1714
+ cb(err);
1715
+ });
1716
+ } catch (err) {
1717
+ cb(err);
1718
+ }
1719
+ } else {
1720
+ this._flushPending = false;
1721
+ cb();
1722
+ }
1723
+ this.off("error", onError);
1724
+ }, "onDrain");
1725
+ const onError = /* @__PURE__ */ __name((err) => {
1726
+ this._flushPending = false;
1727
+ cb(err);
1728
+ this.off("drain", onDrain);
1729
+ }, "onError");
1730
+ this.once("drain", onDrain);
1731
+ this.once("error", onError);
1732
+ }
1733
+ __name(callFlushCallbackOnDrain, "callFlushCallbackOnDrain");
1734
+ function flush(cb) {
1735
+ if (cb != null && typeof cb !== "function") {
1736
+ throw new Error("flush cb must be a function");
1737
+ }
1738
+ if (this.destroyed) {
1739
+ const error = new Error("SonicBoom destroyed");
1740
+ if (cb) {
1741
+ cb(error);
1742
+ return;
1743
+ }
1744
+ throw error;
1745
+ }
1746
+ if (this.minLength <= 0) {
1747
+ cb == null ? void 0 : cb();
1748
+ return;
1749
+ }
1750
+ if (cb) {
1751
+ callFlushCallbackOnDrain.call(this, cb);
1752
+ }
1753
+ if (this._writing) {
1754
+ return;
1755
+ }
1756
+ if (this._bufs.length === 0) {
1757
+ this._bufs.push("");
1758
+ }
1759
+ this._actualWrite();
1760
+ }
1761
+ __name(flush, "flush");
1762
+ function flushBuffer(cb) {
1763
+ if (cb != null && typeof cb !== "function") {
1764
+ throw new Error("flush cb must be a function");
1765
+ }
1766
+ if (this.destroyed) {
1767
+ const error = new Error("SonicBoom destroyed");
1768
+ if (cb) {
1769
+ cb(error);
1770
+ return;
1771
+ }
1772
+ throw error;
1773
+ }
1774
+ if (this.minLength <= 0) {
1775
+ cb == null ? void 0 : cb();
1776
+ return;
1777
+ }
1778
+ if (cb) {
1779
+ callFlushCallbackOnDrain.call(this, cb);
1780
+ }
1781
+ if (this._writing) {
1782
+ return;
1783
+ }
1784
+ if (this._bufs.length === 0) {
1785
+ this._bufs.push([]);
1786
+ this._lens.push(0);
1787
+ }
1788
+ this._actualWrite();
1789
+ }
1790
+ __name(flushBuffer, "flushBuffer");
1791
+ SonicBoom.prototype.reopen = function(file) {
1792
+ if (this.destroyed) {
1793
+ throw new Error("SonicBoom destroyed");
1794
+ }
1795
+ if (this._opening) {
1796
+ this.once("ready", () => {
1797
+ this.reopen(file);
1798
+ });
1799
+ return;
1800
+ }
1801
+ if (this._ending) {
1802
+ return;
1803
+ }
1804
+ if (!this.file) {
1805
+ throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");
1806
+ }
1807
+ if (file) {
1808
+ this.file = file;
1809
+ }
1810
+ this._reopening = true;
1811
+ if (this._writing) {
1812
+ return;
1813
+ }
1814
+ const fd = this.fd;
1815
+ this.once("ready", () => {
1816
+ if (fd !== this.fd) {
1817
+ fs.close(fd, (err) => {
1818
+ if (err) {
1819
+ return this.emit("error", err);
1820
+ }
1821
+ });
1822
+ }
1823
+ });
1824
+ openFile(this.file, this);
1825
+ };
1826
+ SonicBoom.prototype.end = function() {
1827
+ if (this.destroyed) {
1828
+ throw new Error("SonicBoom destroyed");
1829
+ }
1830
+ if (this._opening) {
1831
+ this.once("ready", () => {
1832
+ this.end();
1833
+ });
1834
+ return;
1835
+ }
1836
+ if (this._ending) {
1837
+ return;
1838
+ }
1839
+ this._ending = true;
1840
+ if (this._writing) {
1841
+ return;
1842
+ }
1843
+ if (this._len > 0 && this.fd >= 0) {
1844
+ this._actualWrite();
1845
+ } else {
1846
+ actualClose(this);
1847
+ }
1848
+ };
1849
+ function flushSync() {
1850
+ if (this.destroyed) {
1851
+ throw new Error("SonicBoom destroyed");
1852
+ }
1853
+ if (this.fd < 0) {
1854
+ throw new Error("sonic boom is not ready yet");
1855
+ }
1856
+ if (!this._writing && this._writingBuf.length > 0) {
1857
+ this._bufs.unshift(this._writingBuf);
1858
+ this._writingBuf = "";
1859
+ }
1860
+ let buf = "";
1861
+ while (this._bufs.length || buf) {
1862
+ if (buf.length <= 0) {
1863
+ buf = this._bufs[0];
1864
+ }
1865
+ try {
1866
+ const n = fs.writeSync(this.fd, buf, "utf8");
1867
+ const releasedBufObj = releaseWritingBuf(buf, this._len, n);
1868
+ buf = releasedBufObj.writingBuf;
1869
+ this._len = releasedBufObj.len;
1870
+ if (buf.length <= 0) {
1871
+ this._bufs.shift();
1872
+ }
1873
+ } catch (err) {
1874
+ const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY";
1875
+ if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
1876
+ throw err;
1877
+ }
1878
+ sleep(BUSY_WRITE_TIMEOUT);
1879
+ }
1880
+ }
1881
+ try {
1882
+ fs.fsyncSync(this.fd);
1883
+ } catch {
1884
+ }
1885
+ }
1886
+ __name(flushSync, "flushSync");
1887
+ function flushBufferSync() {
1888
+ if (this.destroyed) {
1889
+ throw new Error("SonicBoom destroyed");
1890
+ }
1891
+ if (this.fd < 0) {
1892
+ throw new Error("sonic boom is not ready yet");
1893
+ }
1894
+ if (!this._writing && this._writingBuf.length > 0) {
1895
+ this._bufs.unshift([
1896
+ this._writingBuf
1897
+ ]);
1898
+ this._writingBuf = kEmptyBuffer;
1899
+ }
1900
+ let buf = kEmptyBuffer;
1901
+ while (this._bufs.length || buf.length) {
1902
+ if (buf.length <= 0) {
1903
+ buf = mergeBuf(this._bufs[0], this._lens[0]);
1904
+ }
1905
+ try {
1906
+ const n = fs.writeSync(this.fd, buf);
1907
+ buf = buf.subarray(n);
1908
+ this._len = Math.max(this._len - n, 0);
1909
+ if (buf.length <= 0) {
1910
+ this._bufs.shift();
1911
+ this._lens.shift();
1912
+ }
1913
+ } catch (err) {
1914
+ const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY";
1915
+ if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
1916
+ throw err;
1917
+ }
1918
+ sleep(BUSY_WRITE_TIMEOUT);
1919
+ }
1920
+ }
1921
+ }
1922
+ __name(flushBufferSync, "flushBufferSync");
1923
+ SonicBoom.prototype.destroy = function() {
1924
+ if (this.destroyed) {
1925
+ return;
1926
+ }
1927
+ actualClose(this);
1928
+ };
1929
+ function actualWrite() {
1930
+ const release = this.release;
1931
+ this._writing = true;
1932
+ this._writingBuf = this._writingBuf || this._bufs.shift() || "";
1933
+ if (this.sync) {
1934
+ try {
1935
+ const written = fs.writeSync(this.fd, this._writingBuf, "utf8");
1936
+ release(null, written);
1937
+ } catch (err) {
1938
+ release(err);
1939
+ }
1940
+ } else {
1941
+ fs.write(this.fd, this._writingBuf, "utf8", release);
1942
+ }
1943
+ }
1944
+ __name(actualWrite, "actualWrite");
1945
+ function actualWriteBuffer() {
1946
+ const release = this.release;
1947
+ this._writing = true;
1948
+ this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
1949
+ if (this.sync) {
1950
+ try {
1951
+ const written = fs.writeSync(this.fd, this._writingBuf);
1952
+ release(null, written);
1953
+ } catch (err) {
1954
+ release(err);
1955
+ }
1956
+ } else {
1957
+ if (kCopyBuffer) {
1958
+ this._writingBuf = Buffer.from(this._writingBuf);
1959
+ }
1960
+ fs.write(this.fd, this._writingBuf, release);
1961
+ }
1962
+ }
1963
+ __name(actualWriteBuffer, "actualWriteBuffer");
1964
+ function actualClose(sonic) {
1965
+ if (sonic.fd === -1) {
1966
+ sonic.once("ready", actualClose.bind(null, sonic));
1967
+ return;
1968
+ }
1969
+ if (sonic._periodicFlushTimer !== void 0) {
1970
+ clearInterval(sonic._periodicFlushTimer);
1971
+ }
1972
+ sonic.destroyed = true;
1973
+ sonic._bufs = [];
1974
+ sonic._lens = [];
1975
+ assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
1976
+ try {
1977
+ fs.fsync(sonic.fd, closeWrapped);
1978
+ } catch {
1979
+ }
1980
+ function closeWrapped() {
1981
+ if (sonic.fd !== 1 && sonic.fd !== 2) {
1982
+ fs.close(sonic.fd, done);
1983
+ } else {
1984
+ done();
1985
+ }
1986
+ }
1987
+ __name(closeWrapped, "closeWrapped");
1988
+ function done(err) {
1989
+ if (err) {
1990
+ sonic.emit("error", err);
1991
+ return;
1992
+ }
1993
+ if (sonic._ending && !sonic._writing) {
1994
+ sonic.emit("finish");
1995
+ }
1996
+ sonic.emit("close");
1997
+ }
1998
+ __name(done, "done");
1999
+ }
2000
+ __name(actualClose, "actualClose");
2001
+ SonicBoom.SonicBoom = SonicBoom;
2002
+ SonicBoom.default = SonicBoom;
2003
+ module.exports = SonicBoom;
2004
+ }
2005
+ });
2006
+
2007
+ // node_modules/on-exit-leak-free/index.js
2008
+ var require_on_exit_leak_free = __commonJS({
2009
+ "node_modules/on-exit-leak-free/index.js"(exports, module) {
2010
+ "use strict";
2011
+ var refs = {
2012
+ exit: [],
2013
+ beforeExit: []
2014
+ };
2015
+ var functions = {
2016
+ exit: onExit,
2017
+ beforeExit: onBeforeExit
2018
+ };
2019
+ var registry;
2020
+ function ensureRegistry() {
2021
+ if (registry === void 0) {
2022
+ registry = new FinalizationRegistry(clear);
2023
+ }
2024
+ }
2025
+ __name(ensureRegistry, "ensureRegistry");
2026
+ function install(event) {
2027
+ if (refs[event].length > 0) {
2028
+ return;
2029
+ }
2030
+ process.on(event, functions[event]);
2031
+ }
2032
+ __name(install, "install");
2033
+ function uninstall(event) {
2034
+ if (refs[event].length > 0) {
2035
+ return;
2036
+ }
2037
+ process.removeListener(event, functions[event]);
2038
+ if (refs.exit.length === 0 && refs.beforeExit.length === 0) {
2039
+ registry = void 0;
2040
+ }
2041
+ }
2042
+ __name(uninstall, "uninstall");
2043
+ function onExit() {
2044
+ callRefs("exit");
2045
+ }
2046
+ __name(onExit, "onExit");
2047
+ function onBeforeExit() {
2048
+ callRefs("beforeExit");
2049
+ }
2050
+ __name(onBeforeExit, "onBeforeExit");
2051
+ function callRefs(event) {
2052
+ for (const ref of refs[event]) {
2053
+ const obj = ref.deref();
2054
+ const fn = ref.fn;
2055
+ if (obj !== void 0) {
2056
+ fn(obj, event);
2057
+ }
2058
+ }
2059
+ refs[event] = [];
2060
+ }
2061
+ __name(callRefs, "callRefs");
2062
+ function clear(ref) {
2063
+ for (const event of [
2064
+ "exit",
2065
+ "beforeExit"
2066
+ ]) {
2067
+ const index = refs[event].indexOf(ref);
2068
+ refs[event].splice(index, index + 1);
2069
+ uninstall(event);
2070
+ }
2071
+ }
2072
+ __name(clear, "clear");
2073
+ function _register(event, obj, fn) {
2074
+ if (obj === void 0) {
2075
+ throw new Error("the object can't be undefined");
2076
+ }
2077
+ install(event);
2078
+ const ref = new WeakRef(obj);
2079
+ ref.fn = fn;
2080
+ ensureRegistry();
2081
+ registry.register(obj, ref);
2082
+ refs[event].push(ref);
2083
+ }
2084
+ __name(_register, "_register");
2085
+ function register(obj, fn) {
2086
+ _register("exit", obj, fn);
2087
+ }
2088
+ __name(register, "register");
2089
+ function registerBeforeExit(obj, fn) {
2090
+ _register("beforeExit", obj, fn);
2091
+ }
2092
+ __name(registerBeforeExit, "registerBeforeExit");
2093
+ function unregister(obj) {
2094
+ if (registry === void 0) {
2095
+ return;
2096
+ }
2097
+ registry.unregister(obj);
2098
+ for (const event of [
2099
+ "exit",
2100
+ "beforeExit"
2101
+ ]) {
2102
+ refs[event] = refs[event].filter((ref) => {
2103
+ const _obj = ref.deref();
2104
+ return _obj && _obj !== obj;
2105
+ });
2106
+ uninstall(event);
2107
+ }
2108
+ }
2109
+ __name(unregister, "unregister");
2110
+ module.exports = {
2111
+ register,
2112
+ registerBeforeExit,
2113
+ unregister
2114
+ };
2115
+ }
2116
+ });
2117
+
2118
+ // node_modules/thread-stream/package.json
2119
+ var require_package = __commonJS({
2120
+ "node_modules/thread-stream/package.json"(exports, module) {
2121
+ module.exports = {
2122
+ name: "thread-stream",
2123
+ version: "3.1.0",
2124
+ description: "A streaming way to send data to a Node.js Worker Thread",
2125
+ main: "index.js",
2126
+ types: "index.d.ts",
2127
+ dependencies: {
2128
+ "real-require": "^0.2.0"
2129
+ },
2130
+ devDependencies: {
2131
+ "@types/node": "^20.1.0",
2132
+ "@types/tap": "^15.0.0",
2133
+ "@yao-pkg/pkg": "^5.11.5",
2134
+ desm: "^1.3.0",
2135
+ fastbench: "^1.0.1",
2136
+ husky: "^9.0.6",
2137
+ "pino-elasticsearch": "^8.0.0",
2138
+ "sonic-boom": "^4.0.1",
2139
+ standard: "^17.0.0",
2140
+ tap: "^16.2.0",
2141
+ "ts-node": "^10.8.0",
2142
+ typescript: "^5.3.2",
2143
+ "why-is-node-running": "^2.2.2"
2144
+ },
2145
+ scripts: {
2146
+ build: "tsc --noEmit",
2147
+ test: 'standard && npm run build && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',
2148
+ "test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts",
2149
+ "test:ci:js": 'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',
2150
+ "test:ci:ts": 'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',
2151
+ "test:yarn": 'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',
2152
+ transpile: "sh ./test/ts/transpile.sh",
2153
+ prepare: "husky install"
2154
+ },
2155
+ standard: {
2156
+ ignore: [
2157
+ "test/ts/**/*",
2158
+ "test/syntax-error.mjs"
2159
+ ]
2160
+ },
2161
+ repository: {
2162
+ type: "git",
2163
+ url: "git+https://github.com/mcollina/thread-stream.git"
2164
+ },
2165
+ keywords: [
2166
+ "worker",
2167
+ "thread",
2168
+ "threads",
2169
+ "stream"
2170
+ ],
2171
+ author: "Matteo Collina <hello@matteocollina.com>",
2172
+ license: "MIT",
2173
+ bugs: {
2174
+ url: "https://github.com/mcollina/thread-stream/issues"
2175
+ },
2176
+ homepage: "https://github.com/mcollina/thread-stream#readme"
2177
+ };
2178
+ }
2179
+ });
2180
+
2181
+ // node_modules/thread-stream/lib/wait.js
2182
+ var require_wait = __commonJS({
2183
+ "node_modules/thread-stream/lib/wait.js"(exports, module) {
2184
+ "use strict";
2185
+ var MAX_TIMEOUT = 1e3;
2186
+ function wait(state, index, expected, timeout, done) {
2187
+ const max = Date.now() + timeout;
2188
+ let current = Atomics.load(state, index);
2189
+ if (current === expected) {
2190
+ done(null, "ok");
2191
+ return;
2192
+ }
2193
+ let prior = current;
2194
+ const check = /* @__PURE__ */ __name((backoff) => {
2195
+ if (Date.now() > max) {
2196
+ done(null, "timed-out");
2197
+ } else {
2198
+ setTimeout(() => {
2199
+ prior = current;
2200
+ current = Atomics.load(state, index);
2201
+ if (current === prior) {
2202
+ check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
2203
+ } else {
2204
+ if (current === expected) done(null, "ok");
2205
+ else done(null, "not-equal");
2206
+ }
2207
+ }, backoff);
2208
+ }
2209
+ }, "check");
2210
+ check(1);
2211
+ }
2212
+ __name(wait, "wait");
2213
+ function waitDiff(state, index, expected, timeout, done) {
2214
+ const max = Date.now() + timeout;
2215
+ let current = Atomics.load(state, index);
2216
+ if (current !== expected) {
2217
+ done(null, "ok");
2218
+ return;
2219
+ }
2220
+ const check = /* @__PURE__ */ __name((backoff) => {
2221
+ if (Date.now() > max) {
2222
+ done(null, "timed-out");
2223
+ } else {
2224
+ setTimeout(() => {
2225
+ current = Atomics.load(state, index);
2226
+ if (current !== expected) {
2227
+ done(null, "ok");
2228
+ } else {
2229
+ check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
2230
+ }
2231
+ }, backoff);
2232
+ }
2233
+ }, "check");
2234
+ check(1);
2235
+ }
2236
+ __name(waitDiff, "waitDiff");
2237
+ module.exports = {
2238
+ wait,
2239
+ waitDiff
2240
+ };
2241
+ }
2242
+ });
2243
+
2244
+ // node_modules/thread-stream/lib/indexes.js
2245
+ var require_indexes = __commonJS({
2246
+ "node_modules/thread-stream/lib/indexes.js"(exports, module) {
2247
+ "use strict";
2248
+ var WRITE_INDEX = 4;
2249
+ var READ_INDEX = 8;
2250
+ module.exports = {
2251
+ WRITE_INDEX,
2252
+ READ_INDEX
2253
+ };
2254
+ }
2255
+ });
2256
+
2257
+ // node_modules/thread-stream/index.js
2258
+ var require_thread_stream = __commonJS({
2259
+ "node_modules/thread-stream/index.js"(exports, module) {
2260
+ "use strict";
2261
+ var { version } = require_package();
2262
+ var { EventEmitter } = __require("events");
2263
+ var { Worker } = __require("worker_threads");
2264
+ var { join: join3 } = __require("path");
2265
+ var { pathToFileURL } = __require("url");
2266
+ var { wait } = require_wait();
2267
+ var { WRITE_INDEX, READ_INDEX } = require_indexes();
2268
+ var buffer = __require("buffer");
2269
+ var assert = __require("assert");
2270
+ var kImpl = Symbol("kImpl");
2271
+ var MAX_STRING = buffer.constants.MAX_STRING_LENGTH;
2272
+ var _a3;
2273
+ var FakeWeakRef = (_a3 = class {
2274
+ constructor(value) {
2275
+ this._value = value;
2276
+ }
2277
+ deref() {
2278
+ return this._value;
2279
+ }
2280
+ }, __name(_a3, "FakeWeakRef"), _a3);
2281
+ var _a4;
2282
+ var FakeFinalizationRegistry = (_a4 = class {
2283
+ register() {
2284
+ }
2285
+ unregister() {
2286
+ }
2287
+ }, __name(_a4, "FakeFinalizationRegistry"), _a4);
2288
+ var FinalizationRegistry2 = process.env.NODE_V8_COVERAGE ? FakeFinalizationRegistry : global.FinalizationRegistry || FakeFinalizationRegistry;
2289
+ var WeakRef2 = process.env.NODE_V8_COVERAGE ? FakeWeakRef : global.WeakRef || FakeWeakRef;
2290
+ var registry = new FinalizationRegistry2((worker) => {
2291
+ if (worker.exited) {
2292
+ return;
2293
+ }
2294
+ worker.terminate();
2295
+ });
2296
+ function createWorker(stream, opts) {
2297
+ const { filename, workerData } = opts;
2298
+ const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
2299
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join3(__dirname, "lib", "worker.js");
2300
+ const worker = new Worker(toExecute, {
2301
+ ...opts.workerOpts,
2302
+ trackUnmanagedFds: false,
2303
+ workerData: {
2304
+ filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href,
2305
+ dataBuf: stream[kImpl].dataBuf,
2306
+ stateBuf: stream[kImpl].stateBuf,
2307
+ workerData: {
2308
+ $context: {
2309
+ threadStreamVersion: version
2310
+ },
2311
+ ...workerData
2312
+ }
2313
+ }
2314
+ });
2315
+ worker.stream = new FakeWeakRef(stream);
2316
+ worker.on("message", onWorkerMessage);
2317
+ worker.on("exit", onWorkerExit);
2318
+ registry.register(stream, worker);
2319
+ return worker;
2320
+ }
2321
+ __name(createWorker, "createWorker");
2322
+ function drain(stream) {
2323
+ assert(!stream[kImpl].sync);
2324
+ if (stream[kImpl].needDrain) {
2325
+ stream[kImpl].needDrain = false;
2326
+ stream.emit("drain");
2327
+ }
2328
+ }
2329
+ __name(drain, "drain");
2330
+ function nextFlush(stream) {
2331
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
2332
+ let leftover = stream[kImpl].data.length - writeIndex;
2333
+ if (leftover > 0) {
2334
+ if (stream[kImpl].buf.length === 0) {
2335
+ stream[kImpl].flushing = false;
2336
+ if (stream[kImpl].ending) {
2337
+ end(stream);
2338
+ } else if (stream[kImpl].needDrain) {
2339
+ process.nextTick(drain, stream);
2340
+ }
2341
+ return;
2342
+ }
2343
+ let toWrite = stream[kImpl].buf.slice(0, leftover);
2344
+ let toWriteBytes = Buffer.byteLength(toWrite);
2345
+ if (toWriteBytes <= leftover) {
2346
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
2347
+ write(stream, toWrite, nextFlush.bind(null, stream));
2348
+ } else {
2349
+ stream.flush(() => {
2350
+ if (stream.destroyed) {
2351
+ return;
2352
+ }
2353
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
2354
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
2355
+ while (toWriteBytes > stream[kImpl].data.length) {
2356
+ leftover = leftover / 2;
2357
+ toWrite = stream[kImpl].buf.slice(0, leftover);
2358
+ toWriteBytes = Buffer.byteLength(toWrite);
2359
+ }
2360
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
2361
+ write(stream, toWrite, nextFlush.bind(null, stream));
2362
+ });
2363
+ }
2364
+ } else if (leftover === 0) {
2365
+ if (writeIndex === 0 && stream[kImpl].buf.length === 0) {
2366
+ return;
2367
+ }
2368
+ stream.flush(() => {
2369
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
2370
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
2371
+ nextFlush(stream);
2372
+ });
2373
+ } else {
2374
+ destroy(stream, new Error("overwritten"));
2375
+ }
2376
+ }
2377
+ __name(nextFlush, "nextFlush");
2378
+ function onWorkerMessage(msg) {
2379
+ const stream = this.stream.deref();
2380
+ if (stream === void 0) {
2381
+ this.exited = true;
2382
+ this.terminate();
2383
+ return;
2384
+ }
2385
+ switch (msg.code) {
2386
+ case "READY":
2387
+ this.stream = new WeakRef2(stream);
2388
+ stream.flush(() => {
2389
+ stream[kImpl].ready = true;
2390
+ stream.emit("ready");
2391
+ });
2392
+ break;
2393
+ case "ERROR":
2394
+ destroy(stream, msg.err);
2395
+ break;
2396
+ case "EVENT":
2397
+ if (Array.isArray(msg.args)) {
2398
+ stream.emit(msg.name, ...msg.args);
2399
+ } else {
2400
+ stream.emit(msg.name, msg.args);
2401
+ }
2402
+ break;
2403
+ case "WARNING":
2404
+ process.emitWarning(msg.err);
2405
+ break;
2406
+ default:
2407
+ destroy(stream, new Error("this should not happen: " + msg.code));
2408
+ }
2409
+ }
2410
+ __name(onWorkerMessage, "onWorkerMessage");
2411
+ function onWorkerExit(code) {
2412
+ const stream = this.stream.deref();
2413
+ if (stream === void 0) {
2414
+ return;
2415
+ }
2416
+ registry.unregister(stream);
2417
+ stream.worker.exited = true;
2418
+ stream.worker.off("exit", onWorkerExit);
2419
+ destroy(stream, code !== 0 ? new Error("the worker thread exited") : null);
2420
+ }
2421
+ __name(onWorkerExit, "onWorkerExit");
2422
+ var _a5;
2423
+ var ThreadStream = (_a5 = class extends EventEmitter {
2424
+ constructor(opts = {}) {
2425
+ super();
2426
+ if (opts.bufferSize < 4) {
2427
+ throw new Error("bufferSize must at least fit a 4-byte utf-8 char");
2428
+ }
2429
+ this[kImpl] = {};
2430
+ this[kImpl].stateBuf = new SharedArrayBuffer(128);
2431
+ this[kImpl].state = new Int32Array(this[kImpl].stateBuf);
2432
+ this[kImpl].dataBuf = new SharedArrayBuffer(opts.bufferSize || 4 * 1024 * 1024);
2433
+ this[kImpl].data = Buffer.from(this[kImpl].dataBuf);
2434
+ this[kImpl].sync = opts.sync || false;
2435
+ this[kImpl].ending = false;
2436
+ this[kImpl].ended = false;
2437
+ this[kImpl].needDrain = false;
2438
+ this[kImpl].destroyed = false;
2439
+ this[kImpl].flushing = false;
2440
+ this[kImpl].ready = false;
2441
+ this[kImpl].finished = false;
2442
+ this[kImpl].errored = null;
2443
+ this[kImpl].closed = false;
2444
+ this[kImpl].buf = "";
2445
+ this.worker = createWorker(this, opts);
2446
+ this.on("message", (message, transferList) => {
2447
+ this.worker.postMessage(message, transferList);
2448
+ });
2449
+ }
2450
+ write(data) {
2451
+ if (this[kImpl].destroyed) {
2452
+ error(this, new Error("the worker has exited"));
2453
+ return false;
2454
+ }
2455
+ if (this[kImpl].ending) {
2456
+ error(this, new Error("the worker is ending"));
2457
+ return false;
2458
+ }
2459
+ if (this[kImpl].flushing && this[kImpl].buf.length + data.length >= MAX_STRING) {
2460
+ try {
2461
+ writeSync(this);
2462
+ this[kImpl].flushing = true;
2463
+ } catch (err) {
2464
+ destroy(this, err);
2465
+ return false;
2466
+ }
2467
+ }
2468
+ this[kImpl].buf += data;
2469
+ if (this[kImpl].sync) {
2470
+ try {
2471
+ writeSync(this);
2472
+ return true;
2473
+ } catch (err) {
2474
+ destroy(this, err);
2475
+ return false;
2476
+ }
2477
+ }
2478
+ if (!this[kImpl].flushing) {
2479
+ this[kImpl].flushing = true;
2480
+ setImmediate(nextFlush, this);
2481
+ }
2482
+ this[kImpl].needDrain = this[kImpl].data.length - this[kImpl].buf.length - Atomics.load(this[kImpl].state, WRITE_INDEX) <= 0;
2483
+ return !this[kImpl].needDrain;
2484
+ }
2485
+ end() {
2486
+ if (this[kImpl].destroyed) {
2487
+ return;
2488
+ }
2489
+ this[kImpl].ending = true;
2490
+ end(this);
2491
+ }
2492
+ flush(cb) {
2493
+ if (this[kImpl].destroyed) {
2494
+ if (typeof cb === "function") {
2495
+ process.nextTick(cb, new Error("the worker has exited"));
2496
+ }
2497
+ return;
2498
+ }
2499
+ const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX);
2500
+ wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
2501
+ if (err) {
2502
+ destroy(this, err);
2503
+ process.nextTick(cb, err);
2504
+ return;
2505
+ }
2506
+ if (res === "not-equal") {
2507
+ this.flush(cb);
2508
+ return;
2509
+ }
2510
+ process.nextTick(cb);
2511
+ });
2512
+ }
2513
+ flushSync() {
2514
+ if (this[kImpl].destroyed) {
2515
+ return;
2516
+ }
2517
+ writeSync(this);
2518
+ flushSync(this);
2519
+ }
2520
+ unref() {
2521
+ this.worker.unref();
2522
+ }
2523
+ ref() {
2524
+ this.worker.ref();
2525
+ }
2526
+ get ready() {
2527
+ return this[kImpl].ready;
2528
+ }
2529
+ get destroyed() {
2530
+ return this[kImpl].destroyed;
2531
+ }
2532
+ get closed() {
2533
+ return this[kImpl].closed;
2534
+ }
2535
+ get writable() {
2536
+ return !this[kImpl].destroyed && !this[kImpl].ending;
2537
+ }
2538
+ get writableEnded() {
2539
+ return this[kImpl].ending;
2540
+ }
2541
+ get writableFinished() {
2542
+ return this[kImpl].finished;
2543
+ }
2544
+ get writableNeedDrain() {
2545
+ return this[kImpl].needDrain;
2546
+ }
2547
+ get writableObjectMode() {
2548
+ return false;
2549
+ }
2550
+ get writableErrored() {
2551
+ return this[kImpl].errored;
2552
+ }
2553
+ }, __name(_a5, "ThreadStream"), _a5);
2554
+ function error(stream, err) {
2555
+ setImmediate(() => {
2556
+ stream.emit("error", err);
2557
+ });
2558
+ }
2559
+ __name(error, "error");
2560
+ function destroy(stream, err) {
2561
+ if (stream[kImpl].destroyed) {
2562
+ return;
2563
+ }
2564
+ stream[kImpl].destroyed = true;
2565
+ if (err) {
2566
+ stream[kImpl].errored = err;
2567
+ error(stream, err);
2568
+ }
2569
+ if (!stream.worker.exited) {
2570
+ stream.worker.terminate().catch(() => {
2571
+ }).then(() => {
2572
+ stream[kImpl].closed = true;
2573
+ stream.emit("close");
2574
+ });
2575
+ } else {
2576
+ setImmediate(() => {
2577
+ stream[kImpl].closed = true;
2578
+ stream.emit("close");
2579
+ });
2580
+ }
2581
+ }
2582
+ __name(destroy, "destroy");
2583
+ function write(stream, data, cb) {
2584
+ const current = Atomics.load(stream[kImpl].state, WRITE_INDEX);
2585
+ const length = Buffer.byteLength(data);
2586
+ stream[kImpl].data.write(data, current);
2587
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, current + length);
2588
+ Atomics.notify(stream[kImpl].state, WRITE_INDEX);
2589
+ cb();
2590
+ return true;
2591
+ }
2592
+ __name(write, "write");
2593
+ function end(stream) {
2594
+ if (stream[kImpl].ended || !stream[kImpl].ending || stream[kImpl].flushing) {
2595
+ return;
2596
+ }
2597
+ stream[kImpl].ended = true;
2598
+ try {
2599
+ stream.flushSync();
2600
+ let readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
2601
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, -1);
2602
+ Atomics.notify(stream[kImpl].state, WRITE_INDEX);
2603
+ let spins = 0;
2604
+ while (readIndex !== -1) {
2605
+ Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
2606
+ readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
2607
+ if (readIndex === -2) {
2608
+ destroy(stream, new Error("end() failed"));
2609
+ return;
2610
+ }
2611
+ if (++spins === 10) {
2612
+ destroy(stream, new Error("end() took too long (10s)"));
2613
+ return;
2614
+ }
2615
+ }
2616
+ process.nextTick(() => {
2617
+ stream[kImpl].finished = true;
2618
+ stream.emit("finish");
2619
+ });
2620
+ } catch (err) {
2621
+ destroy(stream, err);
2622
+ }
2623
+ }
2624
+ __name(end, "end");
2625
+ function writeSync(stream) {
2626
+ const cb = /* @__PURE__ */ __name(() => {
2627
+ if (stream[kImpl].ending) {
2628
+ end(stream);
2629
+ } else if (stream[kImpl].needDrain) {
2630
+ process.nextTick(drain, stream);
2631
+ }
2632
+ }, "cb");
2633
+ stream[kImpl].flushing = false;
2634
+ while (stream[kImpl].buf.length !== 0) {
2635
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
2636
+ let leftover = stream[kImpl].data.length - writeIndex;
2637
+ if (leftover === 0) {
2638
+ flushSync(stream);
2639
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
2640
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
2641
+ continue;
2642
+ } else if (leftover < 0) {
2643
+ throw new Error("overwritten");
2644
+ }
2645
+ let toWrite = stream[kImpl].buf.slice(0, leftover);
2646
+ let toWriteBytes = Buffer.byteLength(toWrite);
2647
+ if (toWriteBytes <= leftover) {
2648
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
2649
+ write(stream, toWrite, cb);
2650
+ } else {
2651
+ flushSync(stream);
2652
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
2653
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
2654
+ while (toWriteBytes > stream[kImpl].buf.length) {
2655
+ leftover = leftover / 2;
2656
+ toWrite = stream[kImpl].buf.slice(0, leftover);
2657
+ toWriteBytes = Buffer.byteLength(toWrite);
2658
+ }
2659
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
2660
+ write(stream, toWrite, cb);
2661
+ }
2662
+ }
2663
+ }
2664
+ __name(writeSync, "writeSync");
2665
+ function flushSync(stream) {
2666
+ if (stream[kImpl].flushing) {
2667
+ throw new Error("unable to flush while flushing");
2668
+ }
2669
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
2670
+ let spins = 0;
2671
+ while (true) {
2672
+ const readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
2673
+ if (readIndex === -2) {
2674
+ throw Error("_flushSync failed");
2675
+ }
2676
+ if (readIndex !== writeIndex) {
2677
+ Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
2678
+ } else {
2679
+ break;
2680
+ }
2681
+ if (++spins === 10) {
2682
+ throw new Error("_flushSync took too long (10s)");
2683
+ }
2684
+ }
2685
+ }
2686
+ __name(flushSync, "flushSync");
2687
+ module.exports = ThreadStream;
2688
+ }
2689
+ });
2690
+
2691
+ // node_modules/pino/lib/transport.js
2692
+ var require_transport = __commonJS({
2693
+ "node_modules/pino/lib/transport.js"(exports, module) {
2694
+ "use strict";
2695
+ var { createRequire: createRequire2 } = __require("module");
2696
+ var getCallers = require_caller();
2697
+ var { join: join3, isAbsolute, sep } = __require("path");
2698
+ var sleep = require_atomic_sleep();
2699
+ var onExit = require_on_exit_leak_free();
2700
+ var ThreadStream = require_thread_stream();
2701
+ function setupOnExit(stream) {
2702
+ onExit.register(stream, autoEnd);
2703
+ onExit.registerBeforeExit(stream, flush);
2704
+ stream.on("close", function() {
2705
+ onExit.unregister(stream);
2706
+ });
2707
+ }
2708
+ __name(setupOnExit, "setupOnExit");
2709
+ function buildStream(filename, workerData, workerOpts, sync) {
2710
+ const stream = new ThreadStream({
2711
+ filename,
2712
+ workerData,
2713
+ workerOpts,
2714
+ sync
2715
+ });
2716
+ stream.on("ready", onReady);
2717
+ stream.on("close", function() {
2718
+ process.removeListener("exit", onExit2);
2719
+ });
2720
+ process.on("exit", onExit2);
2721
+ function onReady() {
2722
+ process.removeListener("exit", onExit2);
2723
+ stream.unref();
2724
+ if (workerOpts.autoEnd !== false) {
2725
+ setupOnExit(stream);
2726
+ }
2727
+ }
2728
+ __name(onReady, "onReady");
2729
+ function onExit2() {
2730
+ if (stream.closed) {
2731
+ return;
2732
+ }
2733
+ stream.flushSync();
2734
+ sleep(100);
2735
+ stream.end();
2736
+ }
2737
+ __name(onExit2, "onExit");
2738
+ return stream;
2739
+ }
2740
+ __name(buildStream, "buildStream");
2741
+ function autoEnd(stream) {
2742
+ stream.ref();
2743
+ stream.flushSync();
2744
+ stream.end();
2745
+ stream.once("close", function() {
2746
+ stream.unref();
2747
+ });
2748
+ }
2749
+ __name(autoEnd, "autoEnd");
2750
+ function flush(stream) {
2751
+ stream.flushSync();
2752
+ }
2753
+ __name(flush, "flush");
2754
+ function transport(fullOptions) {
2755
+ const { pipeline, targets, levels, dedupe, worker = {}, caller = getCallers(), sync = false } = fullOptions;
2756
+ const options = {
2757
+ ...fullOptions.options
2758
+ };
2759
+ const callers = typeof caller === "string" ? [
2760
+ caller
2761
+ ] : caller;
2762
+ const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
2763
+ let target = fullOptions.target;
2764
+ if (target && targets) {
2765
+ throw new Error("only one of target or targets can be specified");
2766
+ }
2767
+ if (targets) {
2768
+ target = bundlerOverrides["pino-worker"] || join3(__dirname, "worker.js");
2769
+ options.targets = targets.filter((dest) => dest.target).map((dest) => {
2770
+ return {
2771
+ ...dest,
2772
+ target: fixTarget(dest.target)
2773
+ };
2774
+ });
2775
+ options.pipelines = targets.filter((dest) => dest.pipeline).map((dest) => {
2776
+ return dest.pipeline.map((t) => {
2777
+ return {
2778
+ ...t,
2779
+ level: dest.level,
2780
+ target: fixTarget(t.target)
2781
+ };
2782
+ });
2783
+ });
2784
+ } else if (pipeline) {
2785
+ target = bundlerOverrides["pino-worker"] || join3(__dirname, "worker.js");
2786
+ options.pipelines = [
2787
+ pipeline.map((dest) => {
2788
+ return {
2789
+ ...dest,
2790
+ target: fixTarget(dest.target)
2791
+ };
2792
+ })
2793
+ ];
2794
+ }
2795
+ if (levels) {
2796
+ options.levels = levels;
2797
+ }
2798
+ if (dedupe) {
2799
+ options.dedupe = dedupe;
2800
+ }
2801
+ options.pinoWillSendConfig = true;
2802
+ return buildStream(fixTarget(target), options, worker, sync);
2803
+ function fixTarget(origin) {
2804
+ origin = bundlerOverrides[origin] || origin;
2805
+ if (isAbsolute(origin) || origin.indexOf("file://") === 0) {
2806
+ return origin;
2807
+ }
2808
+ if (origin === "pino/file") {
2809
+ return join3(__dirname, "..", "file.js");
2810
+ }
2811
+ let fixTarget2;
2812
+ for (const filePath of callers) {
2813
+ try {
2814
+ const context = filePath === "node:repl" ? process.cwd() + sep : filePath;
2815
+ fixTarget2 = createRequire2(context).resolve(origin);
2816
+ break;
2817
+ } catch (err) {
2818
+ continue;
2819
+ }
2820
+ }
2821
+ if (!fixTarget2) {
2822
+ throw new Error(`unable to determine transport target for "${origin}"`);
2823
+ }
2824
+ return fixTarget2;
2825
+ }
2826
+ __name(fixTarget, "fixTarget");
2827
+ }
2828
+ __name(transport, "transport");
2829
+ module.exports = transport;
2830
+ }
2831
+ });
2832
+
2833
+ // node_modules/pino/lib/tools.js
2834
+ var require_tools = __commonJS({
2835
+ "node_modules/pino/lib/tools.js"(exports, module) {
2836
+ "use strict";
2837
+ var format4 = require_quick_format_unescaped();
2838
+ var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
2839
+ var SonicBoom = require_sonic_boom();
2840
+ var onExit = require_on_exit_leak_free();
2841
+ var { lsCacheSym, chindingsSym, writeSym, serializersSym, formatOptsSym, endSym, stringifiersSym, stringifySym, stringifySafeSym, wildcardFirstSym, nestedKeySym, formattersSym, messageKeySym, errorKeySym, nestedKeyStrSym, msgPrefixSym } = require_symbols();
2842
+ var { isMainThread } = __require("worker_threads");
2843
+ var transport = require_transport();
2844
+ function noop() {
2845
+ }
2846
+ __name(noop, "noop");
2847
+ function genLog(level, hook) {
2848
+ if (!hook) return LOG;
2849
+ return /* @__PURE__ */ __name(function hookWrappedLog(...args) {
2850
+ hook.call(this, args, LOG, level);
2851
+ }, "hookWrappedLog");
2852
+ function LOG(o, ...n) {
2853
+ if (typeof o === "object") {
2854
+ let msg = o;
2855
+ if (o !== null) {
2856
+ if (o.method && o.headers && o.socket) {
2857
+ o = mapHttpRequest(o);
2858
+ } else if (typeof o.setHeader === "function") {
2859
+ o = mapHttpResponse(o);
2860
+ }
2861
+ }
2862
+ let formatParams;
2863
+ if (msg === null && n.length === 0) {
2864
+ formatParams = [
2865
+ null
2866
+ ];
2867
+ } else {
2868
+ msg = n.shift();
2869
+ formatParams = n;
2870
+ }
2871
+ if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) {
2872
+ msg = this[msgPrefixSym] + msg;
2873
+ }
2874
+ this[writeSym](o, format4(msg, formatParams, this[formatOptsSym]), level);
2875
+ } else {
2876
+ let msg = o === void 0 ? n.shift() : o;
2877
+ if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) {
2878
+ msg = this[msgPrefixSym] + msg;
2879
+ }
2880
+ this[writeSym](null, format4(msg, n, this[formatOptsSym]), level);
2881
+ }
2882
+ }
2883
+ __name(LOG, "LOG");
2884
+ }
2885
+ __name(genLog, "genLog");
2886
+ function asString(str) {
2887
+ let result = "";
2888
+ let last = 0;
2889
+ let found = false;
2890
+ let point = 255;
2891
+ const l = str.length;
2892
+ if (l > 100) {
2893
+ return JSON.stringify(str);
2894
+ }
2895
+ for (var i = 0; i < l && point >= 32; i++) {
2896
+ point = str.charCodeAt(i);
2897
+ if (point === 34 || point === 92) {
2898
+ result += str.slice(last, i) + "\\";
2899
+ last = i;
2900
+ found = true;
2901
+ }
2902
+ }
2903
+ if (!found) {
2904
+ result = str;
2905
+ } else {
2906
+ result += str.slice(last);
2907
+ }
2908
+ return point < 32 ? JSON.stringify(str) : '"' + result + '"';
2909
+ }
2910
+ __name(asString, "asString");
2911
+ function asJson(obj, msg, num, time) {
2912
+ const stringify2 = this[stringifySym];
2913
+ const stringifySafe = this[stringifySafeSym];
2914
+ const stringifiers = this[stringifiersSym];
2915
+ const end = this[endSym];
2916
+ const chindings = this[chindingsSym];
2917
+ const serializers = this[serializersSym];
2918
+ const formatters = this[formattersSym];
2919
+ const messageKey = this[messageKeySym];
2920
+ const errorKey = this[errorKeySym];
2921
+ let data = this[lsCacheSym][num] + time;
2922
+ data = data + chindings;
2923
+ let value;
2924
+ if (formatters.log) {
2925
+ obj = formatters.log(obj);
2926
+ }
2927
+ const wildcardStringifier = stringifiers[wildcardFirstSym];
2928
+ let propStr = "";
2929
+ for (const key in obj) {
2930
+ value = obj[key];
2931
+ if (Object.prototype.hasOwnProperty.call(obj, key) && value !== void 0) {
2932
+ if (serializers[key]) {
2933
+ value = serializers[key](value);
2934
+ } else if (key === errorKey && serializers.err) {
2935
+ value = serializers.err(value);
2936
+ }
2937
+ const stringifier = stringifiers[key] || wildcardStringifier;
2938
+ switch (typeof value) {
2939
+ case "undefined":
2940
+ case "function":
2941
+ continue;
2942
+ case "number":
2943
+ if (Number.isFinite(value) === false) {
2944
+ value = null;
2945
+ }
2946
+ // this case explicitly falls through to the next one
2947
+ case "boolean":
2948
+ if (stringifier) value = stringifier(value);
2949
+ break;
2950
+ case "string":
2951
+ value = (stringifier || asString)(value);
2952
+ break;
2953
+ default:
2954
+ value = (stringifier || stringify2)(value, stringifySafe);
2955
+ }
2956
+ if (value === void 0) continue;
2957
+ const strKey = asString(key);
2958
+ propStr += "," + strKey + ":" + value;
2959
+ }
2960
+ }
2961
+ let msgStr = "";
2962
+ if (msg !== void 0) {
2963
+ value = serializers[messageKey] ? serializers[messageKey](msg) : msg;
2964
+ const stringifier = stringifiers[messageKey] || wildcardStringifier;
2965
+ switch (typeof value) {
2966
+ case "function":
2967
+ break;
2968
+ case "number":
2969
+ if (Number.isFinite(value) === false) {
2970
+ value = null;
2971
+ }
2972
+ // this case explicitly falls through to the next one
2973
+ case "boolean":
2974
+ if (stringifier) value = stringifier(value);
2975
+ msgStr = ',"' + messageKey + '":' + value;
2976
+ break;
2977
+ case "string":
2978
+ value = (stringifier || asString)(value);
2979
+ msgStr = ',"' + messageKey + '":' + value;
2980
+ break;
2981
+ default:
2982
+ value = (stringifier || stringify2)(value, stringifySafe);
2983
+ msgStr = ',"' + messageKey + '":' + value;
2984
+ }
2985
+ }
2986
+ if (this[nestedKeySym] && propStr) {
2987
+ return data + this[nestedKeyStrSym] + propStr.slice(1) + "}" + msgStr + end;
2988
+ } else {
2989
+ return data + propStr + msgStr + end;
2990
+ }
2991
+ }
2992
+ __name(asJson, "asJson");
2993
+ function asChindings(instance, bindings) {
2994
+ let value;
2995
+ let data = instance[chindingsSym];
2996
+ const stringify2 = instance[stringifySym];
2997
+ const stringifySafe = instance[stringifySafeSym];
2998
+ const stringifiers = instance[stringifiersSym];
2999
+ const wildcardStringifier = stringifiers[wildcardFirstSym];
3000
+ const serializers = instance[serializersSym];
3001
+ const formatter = instance[formattersSym].bindings;
3002
+ bindings = formatter(bindings);
3003
+ for (const key in bindings) {
3004
+ value = bindings[key];
3005
+ const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
3006
+ if (valid === true) {
3007
+ value = serializers[key] ? serializers[key](value) : value;
3008
+ value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
3009
+ if (value === void 0) continue;
3010
+ data += ',"' + key + '":' + value;
3011
+ }
3012
+ }
3013
+ return data;
3014
+ }
3015
+ __name(asChindings, "asChindings");
3016
+ function hasBeenTampered(stream) {
3017
+ return stream.write !== stream.constructor.prototype.write;
3018
+ }
3019
+ __name(hasBeenTampered, "hasBeenTampered");
3020
+ function buildSafeSonicBoom(opts) {
3021
+ const stream = new SonicBoom(opts);
3022
+ stream.on("error", filterBrokenPipe);
3023
+ if (!opts.sync && isMainThread) {
3024
+ onExit.register(stream, autoEnd);
3025
+ stream.on("close", function() {
3026
+ onExit.unregister(stream);
3027
+ });
3028
+ }
3029
+ return stream;
3030
+ function filterBrokenPipe(err) {
3031
+ if (err.code === "EPIPE") {
3032
+ stream.write = noop;
3033
+ stream.end = noop;
3034
+ stream.flushSync = noop;
3035
+ stream.destroy = noop;
3036
+ return;
3037
+ }
3038
+ stream.removeListener("error", filterBrokenPipe);
3039
+ stream.emit("error", err);
3040
+ }
3041
+ __name(filterBrokenPipe, "filterBrokenPipe");
3042
+ }
3043
+ __name(buildSafeSonicBoom, "buildSafeSonicBoom");
3044
+ function autoEnd(stream, eventName) {
3045
+ if (stream.destroyed) {
3046
+ return;
3047
+ }
3048
+ if (eventName === "beforeExit") {
3049
+ stream.flush();
3050
+ stream.on("drain", function() {
3051
+ stream.end();
3052
+ });
3053
+ } else {
3054
+ stream.flushSync();
3055
+ }
3056
+ }
3057
+ __name(autoEnd, "autoEnd");
3058
+ function createArgsNormalizer(defaultOptions) {
3059
+ return /* @__PURE__ */ __name(function normalizeArgs(instance, caller, opts = {}, stream) {
3060
+ if (typeof opts === "string") {
3061
+ stream = buildSafeSonicBoom({
3062
+ dest: opts
3063
+ });
3064
+ opts = {};
3065
+ } else if (typeof stream === "string") {
3066
+ if (opts && opts.transport) {
3067
+ throw Error("only one of option.transport or stream can be specified");
3068
+ }
3069
+ stream = buildSafeSonicBoom({
3070
+ dest: stream
3071
+ });
3072
+ } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
3073
+ stream = opts;
3074
+ opts = {};
3075
+ } else if (opts.transport) {
3076
+ if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) {
3077
+ throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");
3078
+ }
3079
+ if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === "function") {
3080
+ throw Error("option.transport.targets do not allow custom level formatters");
3081
+ }
3082
+ let customLevels;
3083
+ if (opts.customLevels) {
3084
+ customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels);
3085
+ }
3086
+ stream = transport({
3087
+ caller,
3088
+ ...opts.transport,
3089
+ levels: customLevels
3090
+ });
3091
+ }
3092
+ opts = Object.assign({}, defaultOptions, opts);
3093
+ opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers);
3094
+ opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters);
3095
+ if (opts.prettyPrint) {
3096
+ throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");
3097
+ }
3098
+ const { enabled, onChild } = opts;
3099
+ if (enabled === false) opts.level = "silent";
3100
+ if (!onChild) opts.onChild = noop;
3101
+ if (!stream) {
3102
+ if (!hasBeenTampered(process.stdout)) {
3103
+ stream = buildSafeSonicBoom({
3104
+ fd: process.stdout.fd || 1
3105
+ });
3106
+ } else {
3107
+ stream = process.stdout;
3108
+ }
3109
+ }
3110
+ return {
3111
+ opts,
3112
+ stream
3113
+ };
3114
+ }, "normalizeArgs");
3115
+ }
3116
+ __name(createArgsNormalizer, "createArgsNormalizer");
3117
+ function stringify(obj, stringifySafeFn) {
3118
+ try {
3119
+ return JSON.stringify(obj);
3120
+ } catch (_) {
3121
+ try {
3122
+ const stringify2 = stringifySafeFn || this[stringifySafeSym];
3123
+ return stringify2(obj);
3124
+ } catch (_2) {
3125
+ return '"[unable to serialize, circular reference is too complex to analyze]"';
3126
+ }
3127
+ }
3128
+ }
3129
+ __name(stringify, "stringify");
3130
+ function buildFormatters(level, bindings, log) {
3131
+ return {
3132
+ level,
3133
+ bindings,
3134
+ log
3135
+ };
3136
+ }
3137
+ __name(buildFormatters, "buildFormatters");
3138
+ function normalizeDestFileDescriptor(destination) {
3139
+ const fd = Number(destination);
3140
+ if (typeof destination === "string" && Number.isFinite(fd)) {
3141
+ return fd;
3142
+ }
3143
+ if (destination === void 0) {
3144
+ return 1;
3145
+ }
3146
+ return destination;
3147
+ }
3148
+ __name(normalizeDestFileDescriptor, "normalizeDestFileDescriptor");
3149
+ module.exports = {
3150
+ noop,
3151
+ buildSafeSonicBoom,
3152
+ asChindings,
3153
+ asJson,
3154
+ genLog,
3155
+ createArgsNormalizer,
3156
+ stringify,
3157
+ buildFormatters,
3158
+ normalizeDestFileDescriptor
3159
+ };
3160
+ }
3161
+ });
3162
+
3163
+ // node_modules/pino/lib/constants.js
3164
+ var require_constants = __commonJS({
3165
+ "node_modules/pino/lib/constants.js"(exports, module) {
3166
+ "use strict";
3167
+ var DEFAULT_LEVELS = {
3168
+ trace: 10,
3169
+ debug: 20,
3170
+ info: 30,
3171
+ warn: 40,
3172
+ error: 50,
3173
+ fatal: 60
3174
+ };
3175
+ var SORTING_ORDER = {
3176
+ ASC: "ASC",
3177
+ DESC: "DESC"
3178
+ };
3179
+ module.exports = {
3180
+ DEFAULT_LEVELS,
3181
+ SORTING_ORDER
3182
+ };
3183
+ }
3184
+ });
3185
+
3186
+ // node_modules/pino/lib/levels.js
3187
+ var require_levels = __commonJS({
3188
+ "node_modules/pino/lib/levels.js"(exports, module) {
3189
+ "use strict";
3190
+ var { lsCacheSym, levelValSym, useOnlyCustomLevelsSym, streamSym, formattersSym, hooksSym, levelCompSym } = require_symbols();
3191
+ var { noop, genLog } = require_tools();
3192
+ var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
3193
+ var levelMethods = {
3194
+ fatal: /* @__PURE__ */ __name((hook) => {
3195
+ const logFatal = genLog(DEFAULT_LEVELS.fatal, hook);
3196
+ return function(...args) {
3197
+ const stream = this[streamSym];
3198
+ logFatal.call(this, ...args);
3199
+ if (typeof stream.flushSync === "function") {
3200
+ try {
3201
+ stream.flushSync();
3202
+ } catch (e) {
3203
+ }
3204
+ }
3205
+ };
3206
+ }, "fatal"),
3207
+ error: /* @__PURE__ */ __name((hook) => genLog(DEFAULT_LEVELS.error, hook), "error"),
3208
+ warn: /* @__PURE__ */ __name((hook) => genLog(DEFAULT_LEVELS.warn, hook), "warn"),
3209
+ info: /* @__PURE__ */ __name((hook) => genLog(DEFAULT_LEVELS.info, hook), "info"),
3210
+ debug: /* @__PURE__ */ __name((hook) => genLog(DEFAULT_LEVELS.debug, hook), "debug"),
3211
+ trace: /* @__PURE__ */ __name((hook) => genLog(DEFAULT_LEVELS.trace, hook), "trace")
3212
+ };
3213
+ var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => {
3214
+ o[DEFAULT_LEVELS[k]] = k;
3215
+ return o;
3216
+ }, {});
3217
+ var initialLsCache = Object.keys(nums).reduce((o, k) => {
3218
+ o[k] = '{"level":' + Number(k);
3219
+ return o;
3220
+ }, {});
3221
+ function genLsCache(instance) {
3222
+ const formatter = instance[formattersSym].level;
3223
+ const { labels } = instance.levels;
3224
+ const cache = {};
3225
+ for (const label in labels) {
3226
+ const level = formatter(labels[label], Number(label));
3227
+ cache[label] = JSON.stringify(level).slice(0, -1);
3228
+ }
3229
+ instance[lsCacheSym] = cache;
3230
+ return instance;
3231
+ }
3232
+ __name(genLsCache, "genLsCache");
3233
+ function isStandardLevel(level, useOnlyCustomLevels) {
3234
+ if (useOnlyCustomLevels) {
3235
+ return false;
3236
+ }
3237
+ switch (level) {
3238
+ case "fatal":
3239
+ case "error":
3240
+ case "warn":
3241
+ case "info":
3242
+ case "debug":
3243
+ case "trace":
3244
+ return true;
3245
+ default:
3246
+ return false;
3247
+ }
3248
+ }
3249
+ __name(isStandardLevel, "isStandardLevel");
3250
+ function setLevel(level) {
3251
+ const { labels, values } = this.levels;
3252
+ if (typeof level === "number") {
3253
+ if (labels[level] === void 0) throw Error("unknown level value" + level);
3254
+ level = labels[level];
3255
+ }
3256
+ if (values[level] === void 0) throw Error("unknown level " + level);
3257
+ const preLevelVal = this[levelValSym];
3258
+ const levelVal = this[levelValSym] = values[level];
3259
+ const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym];
3260
+ const levelComparison = this[levelCompSym];
3261
+ const hook = this[hooksSym].logMethod;
3262
+ for (const key in values) {
3263
+ if (levelComparison(values[key], levelVal) === false) {
3264
+ this[key] = noop;
3265
+ continue;
3266
+ }
3267
+ this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key](hook) : genLog(values[key], hook);
3268
+ }
3269
+ this.emit("level-change", level, levelVal, labels[preLevelVal], preLevelVal, this);
3270
+ }
3271
+ __name(setLevel, "setLevel");
3272
+ function getLevel(level) {
3273
+ const { levels, levelVal } = this;
3274
+ return levels && levels.labels ? levels.labels[levelVal] : "";
3275
+ }
3276
+ __name(getLevel, "getLevel");
3277
+ function isLevelEnabled(logLevel) {
3278
+ const { values } = this.levels;
3279
+ const logLevelVal = values[logLevel];
3280
+ return logLevelVal !== void 0 && this[levelCompSym](logLevelVal, this[levelValSym]);
3281
+ }
3282
+ __name(isLevelEnabled, "isLevelEnabled");
3283
+ function compareLevel(direction, current, expected) {
3284
+ if (direction === SORTING_ORDER.DESC) {
3285
+ return current <= expected;
3286
+ }
3287
+ return current >= expected;
3288
+ }
3289
+ __name(compareLevel, "compareLevel");
3290
+ function genLevelComparison(levelComparison) {
3291
+ if (typeof levelComparison === "string") {
3292
+ return compareLevel.bind(null, levelComparison);
3293
+ }
3294
+ return levelComparison;
3295
+ }
3296
+ __name(genLevelComparison, "genLevelComparison");
3297
+ function mappings(customLevels = null, useOnlyCustomLevels = false) {
3298
+ const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => {
3299
+ o[customLevels[k]] = k;
3300
+ return o;
3301
+ }, {}) : null;
3302
+ const labels = Object.assign(Object.create(Object.prototype, {
3303
+ Infinity: {
3304
+ value: "silent"
3305
+ }
3306
+ }), useOnlyCustomLevels ? null : nums, customNums);
3307
+ const values = Object.assign(Object.create(Object.prototype, {
3308
+ silent: {
3309
+ value: Infinity
3310
+ }
3311
+ }), useOnlyCustomLevels ? null : DEFAULT_LEVELS, customLevels);
3312
+ return {
3313
+ labels,
3314
+ values
3315
+ };
3316
+ }
3317
+ __name(mappings, "mappings");
3318
+ function assertDefaultLevelFound(defaultLevel, customLevels, useOnlyCustomLevels) {
3319
+ if (typeof defaultLevel === "number") {
3320
+ const values = [].concat(Object.keys(customLevels || {}).map((key) => customLevels[key]), useOnlyCustomLevels ? [] : Object.keys(nums).map((level) => +level), Infinity);
3321
+ if (!values.includes(defaultLevel)) {
3322
+ throw Error(`default level:${defaultLevel} must be included in custom levels`);
3323
+ }
3324
+ return;
3325
+ }
3326
+ const labels = Object.assign(Object.create(Object.prototype, {
3327
+ silent: {
3328
+ value: Infinity
3329
+ }
3330
+ }), useOnlyCustomLevels ? null : DEFAULT_LEVELS, customLevels);
3331
+ if (!(defaultLevel in labels)) {
3332
+ throw Error(`default level:${defaultLevel} must be included in custom levels`);
3333
+ }
3334
+ }
3335
+ __name(assertDefaultLevelFound, "assertDefaultLevelFound");
3336
+ function assertNoLevelCollisions(levels, customLevels) {
3337
+ const { labels, values } = levels;
3338
+ for (const k in customLevels) {
3339
+ if (k in values) {
3340
+ throw Error("levels cannot be overridden");
3341
+ }
3342
+ if (customLevels[k] in labels) {
3343
+ throw Error("pre-existing level values cannot be used for new levels");
3344
+ }
3345
+ }
3346
+ }
3347
+ __name(assertNoLevelCollisions, "assertNoLevelCollisions");
3348
+ function assertLevelComparison(levelComparison) {
3349
+ if (typeof levelComparison === "function") {
3350
+ return;
3351
+ }
3352
+ if (typeof levelComparison === "string" && Object.values(SORTING_ORDER).includes(levelComparison)) {
3353
+ return;
3354
+ }
3355
+ throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type');
3356
+ }
3357
+ __name(assertLevelComparison, "assertLevelComparison");
3358
+ module.exports = {
3359
+ initialLsCache,
3360
+ genLsCache,
3361
+ levelMethods,
3362
+ getLevel,
3363
+ setLevel,
3364
+ isLevelEnabled,
3365
+ mappings,
3366
+ assertNoLevelCollisions,
3367
+ assertDefaultLevelFound,
3368
+ genLevelComparison,
3369
+ assertLevelComparison
3370
+ };
3371
+ }
3372
+ });
3373
+
3374
+ // node_modules/pino/lib/meta.js
3375
+ var require_meta = __commonJS({
3376
+ "node_modules/pino/lib/meta.js"(exports, module) {
3377
+ "use strict";
3378
+ module.exports = {
3379
+ version: "9.9.0"
3380
+ };
3381
+ }
3382
+ });
3383
+
3384
+ // node_modules/pino/lib/proto.js
3385
+ var require_proto = __commonJS({
3386
+ "node_modules/pino/lib/proto.js"(exports, module) {
3387
+ "use strict";
3388
+ var { EventEmitter } = __require("events");
3389
+ var { lsCacheSym, levelValSym, setLevelSym, getLevelSym, chindingsSym, parsedChindingsSym, mixinSym, asJsonSym, writeSym, mixinMergeStrategySym, timeSym, timeSliceIndexSym, streamSym, serializersSym, formattersSym, errorKeySym, messageKeySym, useOnlyCustomLevelsSym, needsMetadataGsym, redactFmtSym, stringifySym, formatOptsSym, stringifiersSym, msgPrefixSym, hooksSym } = require_symbols();
3390
+ var { getLevel, setLevel, isLevelEnabled, mappings, initialLsCache, genLsCache, assertNoLevelCollisions } = require_levels();
3391
+ var { asChindings, asJson, buildFormatters, stringify } = require_tools();
3392
+ var { version } = require_meta();
3393
+ var redaction = require_redaction();
3394
+ var _a3;
3395
+ var constructor = (_a3 = class {
3396
+ }, __name(_a3, "Pino"), _a3);
3397
+ var prototype = {
3398
+ constructor,
3399
+ child,
3400
+ bindings,
3401
+ setBindings,
3402
+ flush,
3403
+ isLevelEnabled,
3404
+ version,
3405
+ get level() {
3406
+ return this[getLevelSym]();
3407
+ },
3408
+ set level(lvl) {
3409
+ this[setLevelSym](lvl);
3410
+ },
3411
+ get levelVal() {
3412
+ return this[levelValSym];
3413
+ },
3414
+ set levelVal(n) {
3415
+ throw Error("levelVal is read-only");
3416
+ },
3417
+ get msgPrefix() {
3418
+ return this[msgPrefixSym];
3419
+ },
3420
+ [lsCacheSym]: initialLsCache,
3421
+ [writeSym]: write,
3422
+ [asJsonSym]: asJson,
3423
+ [getLevelSym]: getLevel,
3424
+ [setLevelSym]: setLevel
3425
+ };
3426
+ Object.setPrototypeOf(prototype, EventEmitter.prototype);
3427
+ module.exports = function() {
3428
+ return Object.create(prototype);
3429
+ };
3430
+ var resetChildingsFormatter = /* @__PURE__ */ __name((bindings2) => bindings2, "resetChildingsFormatter");
3431
+ function child(bindings2, options) {
3432
+ if (!bindings2) {
3433
+ throw Error("missing bindings for child Pino");
3434
+ }
3435
+ options = options || {};
3436
+ const serializers = this[serializersSym];
3437
+ const formatters = this[formattersSym];
3438
+ const instance = Object.create(this);
3439
+ if (options.hasOwnProperty("serializers") === true) {
3440
+ instance[serializersSym] = /* @__PURE__ */ Object.create(null);
3441
+ for (const k in serializers) {
3442
+ instance[serializersSym][k] = serializers[k];
3443
+ }
3444
+ const parentSymbols = Object.getOwnPropertySymbols(serializers);
3445
+ for (var i = 0; i < parentSymbols.length; i++) {
3446
+ const ks = parentSymbols[i];
3447
+ instance[serializersSym][ks] = serializers[ks];
3448
+ }
3449
+ for (const bk in options.serializers) {
3450
+ instance[serializersSym][bk] = options.serializers[bk];
3451
+ }
3452
+ const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers);
3453
+ for (var bi = 0; bi < bindingsSymbols.length; bi++) {
3454
+ const bks = bindingsSymbols[bi];
3455
+ instance[serializersSym][bks] = options.serializers[bks];
3456
+ }
3457
+ } else instance[serializersSym] = serializers;
3458
+ if (options.hasOwnProperty("formatters")) {
3459
+ const { level, bindings: chindings, log } = options.formatters;
3460
+ instance[formattersSym] = buildFormatters(level || formatters.level, chindings || resetChildingsFormatter, log || formatters.log);
3461
+ } else {
3462
+ instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
3463
+ }
3464
+ if (options.hasOwnProperty("customLevels") === true) {
3465
+ assertNoLevelCollisions(this.levels, options.customLevels);
3466
+ instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]);
3467
+ genLsCache(instance);
3468
+ }
3469
+ if (typeof options.redact === "object" && options.redact !== null || Array.isArray(options.redact)) {
3470
+ instance.redact = options.redact;
3471
+ const stringifiers = redaction(instance.redact, stringify);
3472
+ const formatOpts = {
3473
+ stringify: stringifiers[redactFmtSym]
3474
+ };
3475
+ instance[stringifySym] = stringify;
3476
+ instance[stringifiersSym] = stringifiers;
3477
+ instance[formatOptsSym] = formatOpts;
3478
+ }
3479
+ if (typeof options.msgPrefix === "string") {
3480
+ instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
3481
+ }
3482
+ instance[chindingsSym] = asChindings(instance, bindings2);
3483
+ const childLevel = options.level || this.level;
3484
+ instance[setLevelSym](childLevel);
3485
+ this.onChild(instance);
3486
+ return instance;
3487
+ }
3488
+ __name(child, "child");
3489
+ function bindings() {
3490
+ const chindings = this[chindingsSym];
3491
+ const chindingsJson = `{${chindings.substr(1)}}`;
3492
+ const bindingsFromJson = JSON.parse(chindingsJson);
3493
+ delete bindingsFromJson.pid;
3494
+ delete bindingsFromJson.hostname;
3495
+ return bindingsFromJson;
3496
+ }
3497
+ __name(bindings, "bindings");
3498
+ function setBindings(newBindings) {
3499
+ const chindings = asChindings(this, newBindings);
3500
+ this[chindingsSym] = chindings;
3501
+ delete this[parsedChindingsSym];
3502
+ }
3503
+ __name(setBindings, "setBindings");
3504
+ function defaultMixinMergeStrategy(mergeObject, mixinObject) {
3505
+ return Object.assign(mixinObject, mergeObject);
3506
+ }
3507
+ __name(defaultMixinMergeStrategy, "defaultMixinMergeStrategy");
3508
+ function write(_obj, msg, num) {
3509
+ const t = this[timeSym]();
3510
+ const mixin = this[mixinSym];
3511
+ const errorKey = this[errorKeySym];
3512
+ const messageKey = this[messageKeySym];
3513
+ const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy;
3514
+ let obj;
3515
+ const streamWriteHook = this[hooksSym].streamWrite;
3516
+ if (_obj === void 0 || _obj === null) {
3517
+ obj = {};
3518
+ } else if (_obj instanceof Error) {
3519
+ obj = {
3520
+ [errorKey]: _obj
3521
+ };
3522
+ if (msg === void 0) {
3523
+ msg = _obj.message;
3524
+ }
3525
+ } else {
3526
+ obj = _obj;
3527
+ if (msg === void 0 && _obj[messageKey] === void 0 && _obj[errorKey]) {
3528
+ msg = _obj[errorKey].message;
3529
+ }
3530
+ }
3531
+ if (mixin) {
3532
+ obj = mixinMergeStrategy(obj, mixin(obj, num, this));
3533
+ }
3534
+ const s = this[asJsonSym](obj, msg, num, t);
3535
+ const stream = this[streamSym];
3536
+ if (stream[needsMetadataGsym] === true) {
3537
+ stream.lastLevel = num;
3538
+ stream.lastObj = obj;
3539
+ stream.lastMsg = msg;
3540
+ stream.lastTime = t.slice(this[timeSliceIndexSym]);
3541
+ stream.lastLogger = this;
3542
+ }
3543
+ stream.write(streamWriteHook ? streamWriteHook(s) : s);
3544
+ }
3545
+ __name(write, "write");
3546
+ function noop() {
3547
+ }
3548
+ __name(noop, "noop");
3549
+ function flush(cb) {
3550
+ if (cb != null && typeof cb !== "function") {
3551
+ throw Error("callback must be a function");
3552
+ }
3553
+ const stream = this[streamSym];
3554
+ if (typeof stream.flush === "function") {
3555
+ stream.flush(cb || noop);
3556
+ } else if (cb) cb();
3557
+ }
3558
+ __name(flush, "flush");
3559
+ }
3560
+ });
3561
+
3562
+ // node_modules/safe-stable-stringify/index.js
3563
+ var require_safe_stable_stringify = __commonJS({
3564
+ "node_modules/safe-stable-stringify/index.js"(exports, module) {
3565
+ "use strict";
3566
+ var { hasOwnProperty } = Object.prototype;
3567
+ var stringify = configure();
3568
+ stringify.configure = configure;
3569
+ stringify.stringify = stringify;
3570
+ stringify.default = stringify;
3571
+ exports.stringify = stringify;
3572
+ exports.configure = configure;
3573
+ module.exports = stringify;
3574
+ var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
3575
+ function strEscape(str) {
3576
+ if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) {
3577
+ return `"${str}"`;
3578
+ }
3579
+ return JSON.stringify(str);
3580
+ }
3581
+ __name(strEscape, "strEscape");
3582
+ function sort(array, comparator) {
3583
+ if (array.length > 200 || comparator) {
3584
+ return array.sort(comparator);
3585
+ }
3586
+ for (let i = 1; i < array.length; i++) {
3587
+ const currentValue = array[i];
3588
+ let position = i;
3589
+ while (position !== 0 && array[position - 1] > currentValue) {
3590
+ array[position] = array[position - 1];
3591
+ position--;
3592
+ }
3593
+ array[position] = currentValue;
3594
+ }
3595
+ return array;
3596
+ }
3597
+ __name(sort, "sort");
3598
+ var typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array())), Symbol.toStringTag).get;
3599
+ function isTypedArrayWithEntries(value) {
3600
+ return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0;
3601
+ }
3602
+ __name(isTypedArrayWithEntries, "isTypedArrayWithEntries");
3603
+ function stringifyTypedArray(array, separator, maximumBreadth) {
3604
+ if (array.length < maximumBreadth) {
3605
+ maximumBreadth = array.length;
3606
+ }
3607
+ const whitespace = separator === "," ? "" : " ";
3608
+ let res = `"0":${whitespace}${array[0]}`;
3609
+ for (let i = 1; i < maximumBreadth; i++) {
3610
+ res += `${separator}"${i}":${whitespace}${array[i]}`;
3611
+ }
3612
+ return res;
3613
+ }
3614
+ __name(stringifyTypedArray, "stringifyTypedArray");
3615
+ function getCircularValueOption(options) {
3616
+ if (hasOwnProperty.call(options, "circularValue")) {
3617
+ const circularValue = options.circularValue;
3618
+ if (typeof circularValue === "string") {
3619
+ return `"${circularValue}"`;
3620
+ }
3621
+ if (circularValue == null) {
3622
+ return circularValue;
3623
+ }
3624
+ if (circularValue === Error || circularValue === TypeError) {
3625
+ return {
3626
+ toString() {
3627
+ throw new TypeError("Converting circular structure to JSON");
3628
+ }
3629
+ };
3630
+ }
3631
+ throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
3632
+ }
3633
+ return '"[Circular]"';
3634
+ }
3635
+ __name(getCircularValueOption, "getCircularValueOption");
3636
+ function getDeterministicOption(options) {
3637
+ let value;
3638
+ if (hasOwnProperty.call(options, "deterministic")) {
3639
+ value = options.deterministic;
3640
+ if (typeof value !== "boolean" && typeof value !== "function") {
3641
+ throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');
3642
+ }
3643
+ }
3644
+ return value === void 0 ? true : value;
3645
+ }
3646
+ __name(getDeterministicOption, "getDeterministicOption");
3647
+ function getBooleanOption(options, key) {
3648
+ let value;
3649
+ if (hasOwnProperty.call(options, key)) {
3650
+ value = options[key];
3651
+ if (typeof value !== "boolean") {
3652
+ throw new TypeError(`The "${key}" argument must be of type boolean`);
3653
+ }
3654
+ }
3655
+ return value === void 0 ? true : value;
3656
+ }
3657
+ __name(getBooleanOption, "getBooleanOption");
3658
+ function getPositiveIntegerOption(options, key) {
3659
+ let value;
3660
+ if (hasOwnProperty.call(options, key)) {
3661
+ value = options[key];
3662
+ if (typeof value !== "number") {
3663
+ throw new TypeError(`The "${key}" argument must be of type number`);
3664
+ }
3665
+ if (!Number.isInteger(value)) {
3666
+ throw new TypeError(`The "${key}" argument must be an integer`);
3667
+ }
3668
+ if (value < 1) {
3669
+ throw new RangeError(`The "${key}" argument must be >= 1`);
3670
+ }
3671
+ }
3672
+ return value === void 0 ? Infinity : value;
3673
+ }
3674
+ __name(getPositiveIntegerOption, "getPositiveIntegerOption");
3675
+ function getItemCount(number) {
3676
+ if (number === 1) {
3677
+ return "1 item";
3678
+ }
3679
+ return `${number} items`;
3680
+ }
3681
+ __name(getItemCount, "getItemCount");
3682
+ function getUniqueReplacerSet(replacerArray) {
3683
+ const replacerSet = /* @__PURE__ */ new Set();
3684
+ for (const value of replacerArray) {
3685
+ if (typeof value === "string" || typeof value === "number") {
3686
+ replacerSet.add(String(value));
3687
+ }
3688
+ }
3689
+ return replacerSet;
3690
+ }
3691
+ __name(getUniqueReplacerSet, "getUniqueReplacerSet");
3692
+ function getStrictOption(options) {
3693
+ if (hasOwnProperty.call(options, "strict")) {
3694
+ const value = options.strict;
3695
+ if (typeof value !== "boolean") {
3696
+ throw new TypeError('The "strict" argument must be of type boolean');
3697
+ }
3698
+ if (value) {
3699
+ return (value2) => {
3700
+ let message = `Object can not safely be stringified. Received type ${typeof value2}`;
3701
+ if (typeof value2 !== "function") message += ` (${value2.toString()})`;
3702
+ throw new Error(message);
3703
+ };
3704
+ }
3705
+ }
3706
+ }
3707
+ __name(getStrictOption, "getStrictOption");
3708
+ function configure(options) {
3709
+ options = {
3710
+ ...options
3711
+ };
3712
+ const fail = getStrictOption(options);
3713
+ if (fail) {
3714
+ if (options.bigint === void 0) {
3715
+ options.bigint = false;
3716
+ }
3717
+ if (!("circularValue" in options)) {
3718
+ options.circularValue = Error;
3719
+ }
3720
+ }
3721
+ const circularValue = getCircularValueOption(options);
3722
+ const bigint = getBooleanOption(options, "bigint");
3723
+ const deterministic = getDeterministicOption(options);
3724
+ const comparator = typeof deterministic === "function" ? deterministic : void 0;
3725
+ const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
3726
+ const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
3727
+ function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
3728
+ let value = parent[key];
3729
+ if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
3730
+ value = value.toJSON(key);
3731
+ }
3732
+ value = replacer.call(parent, key, value);
3733
+ switch (typeof value) {
3734
+ case "string":
3735
+ return strEscape(value);
3736
+ case "object": {
3737
+ if (value === null) {
3738
+ return "null";
3739
+ }
3740
+ if (stack.indexOf(value) !== -1) {
3741
+ return circularValue;
3742
+ }
3743
+ let res = "";
3744
+ let join3 = ",";
3745
+ const originalIndentation = indentation;
3746
+ if (Array.isArray(value)) {
3747
+ if (value.length === 0) {
3748
+ return "[]";
3749
+ }
3750
+ if (maximumDepth < stack.length + 1) {
3751
+ return '"[Array]"';
3752
+ }
3753
+ stack.push(value);
3754
+ if (spacer !== "") {
3755
+ indentation += spacer;
3756
+ res += `
3757
+ ${indentation}`;
3758
+ join3 = `,
3759
+ ${indentation}`;
3760
+ }
3761
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3762
+ let i = 0;
3763
+ for (; i < maximumValuesToStringify - 1; i++) {
3764
+ const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3765
+ res += tmp2 !== void 0 ? tmp2 : "null";
3766
+ res += join3;
3767
+ }
3768
+ const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3769
+ res += tmp !== void 0 ? tmp : "null";
3770
+ if (value.length - 1 > maximumBreadth) {
3771
+ const removedKeys = value.length - maximumBreadth - 1;
3772
+ res += `${join3}"... ${getItemCount(removedKeys)} not stringified"`;
3773
+ }
3774
+ if (spacer !== "") {
3775
+ res += `
3776
+ ${originalIndentation}`;
3777
+ }
3778
+ stack.pop();
3779
+ return `[${res}]`;
3780
+ }
3781
+ let keys = Object.keys(value);
3782
+ const keyLength = keys.length;
3783
+ if (keyLength === 0) {
3784
+ return "{}";
3785
+ }
3786
+ if (maximumDepth < stack.length + 1) {
3787
+ return '"[Object]"';
3788
+ }
3789
+ let whitespace = "";
3790
+ let separator = "";
3791
+ if (spacer !== "") {
3792
+ indentation += spacer;
3793
+ join3 = `,
3794
+ ${indentation}`;
3795
+ whitespace = " ";
3796
+ }
3797
+ const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3798
+ if (deterministic && !isTypedArrayWithEntries(value)) {
3799
+ keys = sort(keys, comparator);
3800
+ }
3801
+ stack.push(value);
3802
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
3803
+ const key2 = keys[i];
3804
+ const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
3805
+ if (tmp !== void 0) {
3806
+ res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3807
+ separator = join3;
3808
+ }
3809
+ }
3810
+ if (keyLength > maximumBreadth) {
3811
+ const removedKeys = keyLength - maximumBreadth;
3812
+ res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
3813
+ separator = join3;
3814
+ }
3815
+ if (spacer !== "" && separator.length > 1) {
3816
+ res = `
3817
+ ${indentation}${res}
3818
+ ${originalIndentation}`;
3819
+ }
3820
+ stack.pop();
3821
+ return `{${res}}`;
3822
+ }
3823
+ case "number":
3824
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
3825
+ case "boolean":
3826
+ return value === true ? "true" : "false";
3827
+ case "undefined":
3828
+ return void 0;
3829
+ case "bigint":
3830
+ if (bigint) {
3831
+ return String(value);
3832
+ }
3833
+ // fallthrough
3834
+ default:
3835
+ return fail ? fail(value) : void 0;
3836
+ }
3837
+ }
3838
+ __name(stringifyFnReplacer, "stringifyFnReplacer");
3839
+ function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
3840
+ if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
3841
+ value = value.toJSON(key);
3842
+ }
3843
+ switch (typeof value) {
3844
+ case "string":
3845
+ return strEscape(value);
3846
+ case "object": {
3847
+ if (value === null) {
3848
+ return "null";
3849
+ }
3850
+ if (stack.indexOf(value) !== -1) {
3851
+ return circularValue;
3852
+ }
3853
+ const originalIndentation = indentation;
3854
+ let res = "";
3855
+ let join3 = ",";
3856
+ if (Array.isArray(value)) {
3857
+ if (value.length === 0) {
3858
+ return "[]";
3859
+ }
3860
+ if (maximumDepth < stack.length + 1) {
3861
+ return '"[Array]"';
3862
+ }
3863
+ stack.push(value);
3864
+ if (spacer !== "") {
3865
+ indentation += spacer;
3866
+ res += `
3867
+ ${indentation}`;
3868
+ join3 = `,
3869
+ ${indentation}`;
3870
+ }
3871
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3872
+ let i = 0;
3873
+ for (; i < maximumValuesToStringify - 1; i++) {
3874
+ const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3875
+ res += tmp2 !== void 0 ? tmp2 : "null";
3876
+ res += join3;
3877
+ }
3878
+ const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3879
+ res += tmp !== void 0 ? tmp : "null";
3880
+ if (value.length - 1 > maximumBreadth) {
3881
+ const removedKeys = value.length - maximumBreadth - 1;
3882
+ res += `${join3}"... ${getItemCount(removedKeys)} not stringified"`;
3883
+ }
3884
+ if (spacer !== "") {
3885
+ res += `
3886
+ ${originalIndentation}`;
3887
+ }
3888
+ stack.pop();
3889
+ return `[${res}]`;
3890
+ }
3891
+ stack.push(value);
3892
+ let whitespace = "";
3893
+ if (spacer !== "") {
3894
+ indentation += spacer;
3895
+ join3 = `,
3896
+ ${indentation}`;
3897
+ whitespace = " ";
3898
+ }
3899
+ let separator = "";
3900
+ for (const key2 of replacer) {
3901
+ const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
3902
+ if (tmp !== void 0) {
3903
+ res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3904
+ separator = join3;
3905
+ }
3906
+ }
3907
+ if (spacer !== "" && separator.length > 1) {
3908
+ res = `
3909
+ ${indentation}${res}
3910
+ ${originalIndentation}`;
3911
+ }
3912
+ stack.pop();
3913
+ return `{${res}}`;
3914
+ }
3915
+ case "number":
3916
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
3917
+ case "boolean":
3918
+ return value === true ? "true" : "false";
3919
+ case "undefined":
3920
+ return void 0;
3921
+ case "bigint":
3922
+ if (bigint) {
3923
+ return String(value);
3924
+ }
3925
+ // fallthrough
3926
+ default:
3927
+ return fail ? fail(value) : void 0;
3928
+ }
3929
+ }
3930
+ __name(stringifyArrayReplacer, "stringifyArrayReplacer");
3931
+ function stringifyIndent(key, value, stack, spacer, indentation) {
3932
+ switch (typeof value) {
3933
+ case "string":
3934
+ return strEscape(value);
3935
+ case "object": {
3936
+ if (value === null) {
3937
+ return "null";
3938
+ }
3939
+ if (typeof value.toJSON === "function") {
3940
+ value = value.toJSON(key);
3941
+ if (typeof value !== "object") {
3942
+ return stringifyIndent(key, value, stack, spacer, indentation);
3943
+ }
3944
+ if (value === null) {
3945
+ return "null";
3946
+ }
3947
+ }
3948
+ if (stack.indexOf(value) !== -1) {
3949
+ return circularValue;
3950
+ }
3951
+ const originalIndentation = indentation;
3952
+ if (Array.isArray(value)) {
3953
+ if (value.length === 0) {
3954
+ return "[]";
3955
+ }
3956
+ if (maximumDepth < stack.length + 1) {
3957
+ return '"[Array]"';
3958
+ }
3959
+ stack.push(value);
3960
+ indentation += spacer;
3961
+ let res2 = `
3962
+ ${indentation}`;
3963
+ const join4 = `,
3964
+ ${indentation}`;
3965
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3966
+ let i = 0;
3967
+ for (; i < maximumValuesToStringify - 1; i++) {
3968
+ const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3969
+ res2 += tmp2 !== void 0 ? tmp2 : "null";
3970
+ res2 += join4;
3971
+ }
3972
+ const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3973
+ res2 += tmp !== void 0 ? tmp : "null";
3974
+ if (value.length - 1 > maximumBreadth) {
3975
+ const removedKeys = value.length - maximumBreadth - 1;
3976
+ res2 += `${join4}"... ${getItemCount(removedKeys)} not stringified"`;
3977
+ }
3978
+ res2 += `
3979
+ ${originalIndentation}`;
3980
+ stack.pop();
3981
+ return `[${res2}]`;
3982
+ }
3983
+ let keys = Object.keys(value);
3984
+ const keyLength = keys.length;
3985
+ if (keyLength === 0) {
3986
+ return "{}";
3987
+ }
3988
+ if (maximumDepth < stack.length + 1) {
3989
+ return '"[Object]"';
3990
+ }
3991
+ indentation += spacer;
3992
+ const join3 = `,
3993
+ ${indentation}`;
3994
+ let res = "";
3995
+ let separator = "";
3996
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3997
+ if (isTypedArrayWithEntries(value)) {
3998
+ res += stringifyTypedArray(value, join3, maximumBreadth);
3999
+ keys = keys.slice(value.length);
4000
+ maximumPropertiesToStringify -= value.length;
4001
+ separator = join3;
4002
+ }
4003
+ if (deterministic) {
4004
+ keys = sort(keys, comparator);
4005
+ }
4006
+ stack.push(value);
4007
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
4008
+ const key2 = keys[i];
4009
+ const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
4010
+ if (tmp !== void 0) {
4011
+ res += `${separator}${strEscape(key2)}: ${tmp}`;
4012
+ separator = join3;
4013
+ }
4014
+ }
4015
+ if (keyLength > maximumBreadth) {
4016
+ const removedKeys = keyLength - maximumBreadth;
4017
+ res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
4018
+ separator = join3;
4019
+ }
4020
+ if (separator !== "") {
4021
+ res = `
4022
+ ${indentation}${res}
4023
+ ${originalIndentation}`;
4024
+ }
4025
+ stack.pop();
4026
+ return `{${res}}`;
4027
+ }
4028
+ case "number":
4029
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
4030
+ case "boolean":
4031
+ return value === true ? "true" : "false";
4032
+ case "undefined":
4033
+ return void 0;
4034
+ case "bigint":
4035
+ if (bigint) {
4036
+ return String(value);
4037
+ }
4038
+ // fallthrough
4039
+ default:
4040
+ return fail ? fail(value) : void 0;
4041
+ }
4042
+ }
4043
+ __name(stringifyIndent, "stringifyIndent");
4044
+ function stringifySimple(key, value, stack) {
4045
+ switch (typeof value) {
4046
+ case "string":
4047
+ return strEscape(value);
4048
+ case "object": {
4049
+ if (value === null) {
4050
+ return "null";
4051
+ }
4052
+ if (typeof value.toJSON === "function") {
4053
+ value = value.toJSON(key);
4054
+ if (typeof value !== "object") {
4055
+ return stringifySimple(key, value, stack);
4056
+ }
4057
+ if (value === null) {
4058
+ return "null";
4059
+ }
4060
+ }
4061
+ if (stack.indexOf(value) !== -1) {
4062
+ return circularValue;
4063
+ }
4064
+ let res = "";
4065
+ const hasLength = value.length !== void 0;
4066
+ if (hasLength && Array.isArray(value)) {
4067
+ if (value.length === 0) {
4068
+ return "[]";
4069
+ }
4070
+ if (maximumDepth < stack.length + 1) {
4071
+ return '"[Array]"';
4072
+ }
4073
+ stack.push(value);
4074
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
4075
+ let i = 0;
4076
+ for (; i < maximumValuesToStringify - 1; i++) {
4077
+ const tmp2 = stringifySimple(String(i), value[i], stack);
4078
+ res += tmp2 !== void 0 ? tmp2 : "null";
4079
+ res += ",";
4080
+ }
4081
+ const tmp = stringifySimple(String(i), value[i], stack);
4082
+ res += tmp !== void 0 ? tmp : "null";
4083
+ if (value.length - 1 > maximumBreadth) {
4084
+ const removedKeys = value.length - maximumBreadth - 1;
4085
+ res += `,"... ${getItemCount(removedKeys)} not stringified"`;
4086
+ }
4087
+ stack.pop();
4088
+ return `[${res}]`;
4089
+ }
4090
+ let keys = Object.keys(value);
4091
+ const keyLength = keys.length;
4092
+ if (keyLength === 0) {
4093
+ return "{}";
4094
+ }
4095
+ if (maximumDepth < stack.length + 1) {
4096
+ return '"[Object]"';
4097
+ }
4098
+ let separator = "";
4099
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
4100
+ if (hasLength && isTypedArrayWithEntries(value)) {
4101
+ res += stringifyTypedArray(value, ",", maximumBreadth);
4102
+ keys = keys.slice(value.length);
4103
+ maximumPropertiesToStringify -= value.length;
4104
+ separator = ",";
4105
+ }
4106
+ if (deterministic) {
4107
+ keys = sort(keys, comparator);
4108
+ }
4109
+ stack.push(value);
4110
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
4111
+ const key2 = keys[i];
4112
+ const tmp = stringifySimple(key2, value[key2], stack);
4113
+ if (tmp !== void 0) {
4114
+ res += `${separator}${strEscape(key2)}:${tmp}`;
4115
+ separator = ",";
4116
+ }
4117
+ }
4118
+ if (keyLength > maximumBreadth) {
4119
+ const removedKeys = keyLength - maximumBreadth;
4120
+ res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
4121
+ }
4122
+ stack.pop();
4123
+ return `{${res}}`;
4124
+ }
4125
+ case "number":
4126
+ return isFinite(value) ? String(value) : fail ? fail(value) : "null";
4127
+ case "boolean":
4128
+ return value === true ? "true" : "false";
4129
+ case "undefined":
4130
+ return void 0;
4131
+ case "bigint":
4132
+ if (bigint) {
4133
+ return String(value);
4134
+ }
4135
+ // fallthrough
4136
+ default:
4137
+ return fail ? fail(value) : void 0;
4138
+ }
4139
+ }
4140
+ __name(stringifySimple, "stringifySimple");
4141
+ function stringify2(value, replacer, space) {
4142
+ if (arguments.length > 1) {
4143
+ let spacer = "";
4144
+ if (typeof space === "number") {
4145
+ spacer = " ".repeat(Math.min(space, 10));
4146
+ } else if (typeof space === "string") {
4147
+ spacer = space.slice(0, 10);
4148
+ }
4149
+ if (replacer != null) {
4150
+ if (typeof replacer === "function") {
4151
+ return stringifyFnReplacer("", {
4152
+ "": value
4153
+ }, [], replacer, spacer, "");
4154
+ }
4155
+ if (Array.isArray(replacer)) {
4156
+ return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
4157
+ }
4158
+ }
4159
+ if (spacer.length !== 0) {
4160
+ return stringifyIndent("", value, [], spacer, "");
4161
+ }
4162
+ }
4163
+ return stringifySimple("", value, []);
4164
+ }
4165
+ __name(stringify2, "stringify");
4166
+ return stringify2;
4167
+ }
4168
+ __name(configure, "configure");
4169
+ }
4170
+ });
4171
+
4172
+ // node_modules/pino/lib/multistream.js
4173
+ var require_multistream = __commonJS({
4174
+ "node_modules/pino/lib/multistream.js"(exports, module) {
4175
+ "use strict";
4176
+ var metadata = Symbol.for("pino.metadata");
4177
+ var { DEFAULT_LEVELS } = require_constants();
4178
+ var DEFAULT_INFO_LEVEL = DEFAULT_LEVELS.info;
4179
+ function multistream(streamsArray, opts) {
4180
+ streamsArray = streamsArray || [];
4181
+ opts = opts || {
4182
+ dedupe: false
4183
+ };
4184
+ const streamLevels = Object.create(DEFAULT_LEVELS);
4185
+ streamLevels.silent = Infinity;
4186
+ if (opts.levels && typeof opts.levels === "object") {
4187
+ Object.keys(opts.levels).forEach((i) => {
4188
+ streamLevels[i] = opts.levels[i];
4189
+ });
4190
+ }
4191
+ const res = {
4192
+ write,
4193
+ add,
4194
+ remove,
4195
+ emit,
4196
+ flushSync,
4197
+ end,
4198
+ minLevel: 0,
4199
+ lastId: 0,
4200
+ streams: [],
4201
+ clone,
4202
+ [metadata]: true,
4203
+ streamLevels
4204
+ };
4205
+ if (Array.isArray(streamsArray)) {
4206
+ streamsArray.forEach(add, res);
4207
+ } else {
4208
+ add.call(res, streamsArray);
4209
+ }
4210
+ streamsArray = null;
4211
+ return res;
4212
+ function write(data) {
4213
+ let dest;
4214
+ const level = this.lastLevel;
4215
+ const { streams } = this;
4216
+ let recordedLevel = 0;
4217
+ let stream;
4218
+ for (let i = initLoopVar(streams.length, opts.dedupe); checkLoopVar(i, streams.length, opts.dedupe); i = adjustLoopVar(i, opts.dedupe)) {
4219
+ dest = streams[i];
4220
+ if (dest.level <= level) {
4221
+ if (recordedLevel !== 0 && recordedLevel !== dest.level) {
4222
+ break;
4223
+ }
4224
+ stream = dest.stream;
4225
+ if (stream[metadata]) {
4226
+ const { lastTime, lastMsg, lastObj, lastLogger } = this;
4227
+ stream.lastLevel = level;
4228
+ stream.lastTime = lastTime;
4229
+ stream.lastMsg = lastMsg;
4230
+ stream.lastObj = lastObj;
4231
+ stream.lastLogger = lastLogger;
4232
+ }
4233
+ stream.write(data);
4234
+ if (opts.dedupe) {
4235
+ recordedLevel = dest.level;
4236
+ }
4237
+ } else if (!opts.dedupe) {
4238
+ break;
4239
+ }
4240
+ }
4241
+ }
4242
+ __name(write, "write");
4243
+ function emit(...args) {
4244
+ for (const { stream } of this.streams) {
4245
+ if (typeof stream.emit === "function") {
4246
+ stream.emit(...args);
4247
+ }
4248
+ }
4249
+ }
4250
+ __name(emit, "emit");
4251
+ function flushSync() {
4252
+ for (const { stream } of this.streams) {
4253
+ if (typeof stream.flushSync === "function") {
4254
+ stream.flushSync();
4255
+ }
4256
+ }
4257
+ }
4258
+ __name(flushSync, "flushSync");
4259
+ function add(dest) {
4260
+ if (!dest) {
4261
+ return res;
4262
+ }
4263
+ const isStream = typeof dest.write === "function" || dest.stream;
4264
+ const stream_ = dest.write ? dest : dest.stream;
4265
+ if (!isStream) {
4266
+ throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");
4267
+ }
4268
+ const { streams, streamLevels: streamLevels2 } = this;
4269
+ let level;
4270
+ if (typeof dest.levelVal === "number") {
4271
+ level = dest.levelVal;
4272
+ } else if (typeof dest.level === "string") {
4273
+ level = streamLevels2[dest.level];
4274
+ } else if (typeof dest.level === "number") {
4275
+ level = dest.level;
4276
+ } else {
4277
+ level = DEFAULT_INFO_LEVEL;
4278
+ }
4279
+ const dest_ = {
4280
+ stream: stream_,
4281
+ level,
4282
+ levelVal: void 0,
4283
+ id: ++res.lastId
4284
+ };
4285
+ streams.unshift(dest_);
4286
+ streams.sort(compareByLevel);
4287
+ this.minLevel = streams[0].level;
4288
+ return res;
4289
+ }
4290
+ __name(add, "add");
4291
+ function remove(id) {
4292
+ const { streams } = this;
4293
+ const index = streams.findIndex((s) => s.id === id);
4294
+ if (index >= 0) {
4295
+ streams.splice(index, 1);
4296
+ streams.sort(compareByLevel);
4297
+ this.minLevel = streams.length > 0 ? streams[0].level : -1;
4298
+ }
4299
+ return res;
4300
+ }
4301
+ __name(remove, "remove");
4302
+ function end() {
4303
+ for (const { stream } of this.streams) {
4304
+ if (typeof stream.flushSync === "function") {
4305
+ stream.flushSync();
4306
+ }
4307
+ stream.end();
4308
+ }
4309
+ }
4310
+ __name(end, "end");
4311
+ function clone(level) {
4312
+ const streams = new Array(this.streams.length);
4313
+ for (let i = 0; i < streams.length; i++) {
4314
+ streams[i] = {
4315
+ level,
4316
+ stream: this.streams[i].stream
4317
+ };
4318
+ }
4319
+ return {
4320
+ write,
4321
+ add,
4322
+ remove,
4323
+ minLevel: level,
4324
+ streams,
4325
+ clone,
4326
+ emit,
4327
+ flushSync,
4328
+ [metadata]: true
4329
+ };
4330
+ }
4331
+ __name(clone, "clone");
4332
+ }
4333
+ __name(multistream, "multistream");
4334
+ function compareByLevel(a, b) {
4335
+ return a.level - b.level;
4336
+ }
4337
+ __name(compareByLevel, "compareByLevel");
4338
+ function initLoopVar(length, dedupe) {
4339
+ return dedupe ? length - 1 : 0;
4340
+ }
4341
+ __name(initLoopVar, "initLoopVar");
4342
+ function adjustLoopVar(i, dedupe) {
4343
+ return dedupe ? i - 1 : i + 1;
4344
+ }
4345
+ __name(adjustLoopVar, "adjustLoopVar");
4346
+ function checkLoopVar(i, length, dedupe) {
4347
+ return dedupe ? i >= 0 : i < length;
4348
+ }
4349
+ __name(checkLoopVar, "checkLoopVar");
4350
+ module.exports = multistream;
4351
+ }
4352
+ });
4353
+
4354
+ // node_modules/pino/pino.js
4355
+ var require_pino = __commonJS({
4356
+ "node_modules/pino/pino.js"(exports, module) {
4357
+ "use strict";
4358
+ var os = __require("os");
4359
+ var stdSerializers = require_pino_std_serializers();
4360
+ var caller = require_caller();
4361
+ var redaction = require_redaction();
4362
+ var time = require_time();
4363
+ var proto = require_proto();
4364
+ var symbols = require_symbols();
4365
+ var { configure } = require_safe_stable_stringify();
4366
+ var { assertDefaultLevelFound, mappings, genLsCache, genLevelComparison, assertLevelComparison } = require_levels();
4367
+ var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
4368
+ var { createArgsNormalizer, asChindings, buildSafeSonicBoom, buildFormatters, stringify, normalizeDestFileDescriptor, noop } = require_tools();
4369
+ var { version } = require_meta();
4370
+ var { chindingsSym, redactFmtSym, serializersSym, timeSym, timeSliceIndexSym, streamSym, stringifySym, stringifySafeSym, stringifiersSym, setLevelSym, endSym, formatOptsSym, messageKeySym, errorKeySym, nestedKeySym, mixinSym, levelCompSym, useOnlyCustomLevelsSym, formattersSym, hooksSym, nestedKeyStrSym, mixinMergeStrategySym, msgPrefixSym } = symbols;
4371
+ var { epochTime, nullTime } = time;
4372
+ var { pid } = process;
4373
+ var hostname = os.hostname();
4374
+ var defaultErrorSerializer = stdSerializers.err;
4375
+ var defaultOptions = {
4376
+ level: "info",
4377
+ levelComparison: SORTING_ORDER.ASC,
4378
+ levels: DEFAULT_LEVELS,
4379
+ messageKey: "msg",
4380
+ errorKey: "err",
4381
+ nestedKey: null,
4382
+ enabled: true,
4383
+ base: {
4384
+ pid,
4385
+ hostname
4386
+ },
4387
+ serializers: Object.assign(/* @__PURE__ */ Object.create(null), {
4388
+ err: defaultErrorSerializer
4389
+ }),
4390
+ formatters: Object.assign(/* @__PURE__ */ Object.create(null), {
4391
+ bindings(bindings) {
4392
+ return bindings;
4393
+ },
4394
+ level(label, number) {
4395
+ return {
4396
+ level: number
4397
+ };
4398
+ }
4399
+ }),
4400
+ hooks: {
4401
+ logMethod: void 0,
4402
+ streamWrite: void 0
4403
+ },
4404
+ timestamp: epochTime,
4405
+ name: void 0,
4406
+ redact: null,
4407
+ customLevels: null,
4408
+ useOnlyCustomLevels: false,
4409
+ depthLimit: 5,
4410
+ edgeLimit: 100
4411
+ };
4412
+ var normalize = createArgsNormalizer(defaultOptions);
4413
+ var serializers = Object.assign(/* @__PURE__ */ Object.create(null), stdSerializers);
4414
+ function pino(...args) {
4415
+ const instance = {};
4416
+ const { opts, stream } = normalize(instance, caller(), ...args);
4417
+ if (opts.level && typeof opts.level === "string" && DEFAULT_LEVELS[opts.level.toLowerCase()] !== void 0) opts.level = opts.level.toLowerCase();
4418
+ const { redact, crlf, serializers: serializers2, timestamp, messageKey, errorKey, nestedKey, base, name, level, customLevels, levelComparison, mixin, mixinMergeStrategy, useOnlyCustomLevels, formatters, hooks, depthLimit, edgeLimit, onChild, msgPrefix } = opts;
4419
+ const stringifySafe = configure({
4420
+ maximumDepth: depthLimit,
4421
+ maximumBreadth: edgeLimit
4422
+ });
4423
+ const allFormatters = buildFormatters(formatters.level, formatters.bindings, formatters.log);
4424
+ const stringifyFn = stringify.bind({
4425
+ [stringifySafeSym]: stringifySafe
4426
+ });
4427
+ const stringifiers = redact ? redaction(redact, stringifyFn) : {};
4428
+ const formatOpts = redact ? {
4429
+ stringify: stringifiers[redactFmtSym]
4430
+ } : {
4431
+ stringify: stringifyFn
4432
+ };
4433
+ const end = "}" + (crlf ? "\r\n" : "\n");
4434
+ const coreChindings = asChindings.bind(null, {
4435
+ [chindingsSym]: "",
4436
+ [serializersSym]: serializers2,
4437
+ [stringifiersSym]: stringifiers,
4438
+ [stringifySym]: stringify,
4439
+ [stringifySafeSym]: stringifySafe,
4440
+ [formattersSym]: allFormatters
4441
+ });
4442
+ let chindings = "";
4443
+ if (base !== null) {
4444
+ if (name === void 0) {
4445
+ chindings = coreChindings(base);
4446
+ } else {
4447
+ chindings = coreChindings(Object.assign({}, base, {
4448
+ name
4449
+ }));
4450
+ }
4451
+ }
4452
+ const time2 = timestamp instanceof Function ? timestamp : timestamp ? epochTime : nullTime;
4453
+ const timeSliceIndex = time2().indexOf(":") + 1;
4454
+ if (useOnlyCustomLevels && !customLevels) throw Error("customLevels is required if useOnlyCustomLevels is set true");
4455
+ if (mixin && typeof mixin !== "function") throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`);
4456
+ if (msgPrefix && typeof msgPrefix !== "string") throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`);
4457
+ assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels);
4458
+ const levels = mappings(customLevels, useOnlyCustomLevels);
4459
+ if (typeof stream.emit === "function") {
4460
+ stream.emit("message", {
4461
+ code: "PINO_CONFIG",
4462
+ config: {
4463
+ levels,
4464
+ messageKey,
4465
+ errorKey
4466
+ }
4467
+ });
4468
+ }
4469
+ assertLevelComparison(levelComparison);
4470
+ const levelCompFunc = genLevelComparison(levelComparison);
4471
+ Object.assign(instance, {
4472
+ levels,
4473
+ [levelCompSym]: levelCompFunc,
4474
+ [useOnlyCustomLevelsSym]: useOnlyCustomLevels,
4475
+ [streamSym]: stream,
4476
+ [timeSym]: time2,
4477
+ [timeSliceIndexSym]: timeSliceIndex,
4478
+ [stringifySym]: stringify,
4479
+ [stringifySafeSym]: stringifySafe,
4480
+ [stringifiersSym]: stringifiers,
4481
+ [endSym]: end,
4482
+ [formatOptsSym]: formatOpts,
4483
+ [messageKeySym]: messageKey,
4484
+ [errorKeySym]: errorKey,
4485
+ [nestedKeySym]: nestedKey,
4486
+ // protect against injection
4487
+ [nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : "",
4488
+ [serializersSym]: serializers2,
4489
+ [mixinSym]: mixin,
4490
+ [mixinMergeStrategySym]: mixinMergeStrategy,
4491
+ [chindingsSym]: chindings,
4492
+ [formattersSym]: allFormatters,
4493
+ [hooksSym]: hooks,
4494
+ silent: noop,
4495
+ onChild,
4496
+ [msgPrefixSym]: msgPrefix
4497
+ });
4498
+ Object.setPrototypeOf(instance, proto());
4499
+ genLsCache(instance);
4500
+ instance[setLevelSym](level);
4501
+ return instance;
4502
+ }
4503
+ __name(pino, "pino");
4504
+ module.exports = pino;
4505
+ module.exports.destination = (dest = process.stdout.fd) => {
4506
+ if (typeof dest === "object") {
4507
+ dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd);
4508
+ return buildSafeSonicBoom(dest);
4509
+ } else {
4510
+ return buildSafeSonicBoom({
4511
+ dest: normalizeDestFileDescriptor(dest),
4512
+ minLength: 0
4513
+ });
4514
+ }
4515
+ };
4516
+ module.exports.transport = require_transport();
4517
+ module.exports.multistream = require_multistream();
4518
+ module.exports.levels = mappings();
4519
+ module.exports.stdSerializers = serializers;
4520
+ module.exports.stdTimeFunctions = Object.assign({}, time);
4521
+ module.exports.symbols = symbols;
4522
+ module.exports.version = version;
4523
+ module.exports.default = pino;
4524
+ module.exports.pino = pino;
4525
+ }
4526
+ });
4527
+
4528
+ // src/adonisjs/provider.ts
4529
+ import { AsyncLocalStorage } from "async_hooks";
4530
+
12
4531
  // src/common/client.ts
13
- import { randomUUID as randomUUID3 } from "crypto";
14
4532
  import fetchRetry from "fetch-retry";
4533
+ import { randomUUID as randomUUID3 } from "crypto";
15
4534
 
16
4535
  // src/common/consumerRegistry.ts
17
4536
  var _ConsumerRegistry = class _ConsumerRegistry {
@@ -57,7 +4576,7 @@ var ConsumerRegistry = _ConsumerRegistry;
57
4576
 
58
4577
  // src/common/logging.ts
59
4578
  import { createLogger, format, transports } from "winston";
60
- var getLogger = /* @__PURE__ */ __name(() => {
4579
+ function getLogger() {
61
4580
  return createLogger({
62
4581
  level: process.env.APITALLY_DEBUG ? "debug" : "warn",
63
4582
  format: format.combine(format.colorize(), format.timestamp(), format.printf((info) => `${info.timestamp} ${info.level}: ${info.message}`)),
@@ -65,7 +4584,8 @@ var getLogger = /* @__PURE__ */ __name(() => {
65
4584
  new transports.Console()
66
4585
  ]
67
4586
  });
68
- }, "getLogger");
4587
+ }
4588
+ __name(getLogger, "getLogger");
69
4589
 
70
4590
  // src/common/paramValidation.ts
71
4591
  function isValidClientId(clientId) {
@@ -169,7 +4689,7 @@ var RequestCounter = _RequestCounter;
169
4689
  import AsyncLock from "async-lock";
170
4690
  import { Buffer as Buffer3 } from "buffer";
171
4691
  import { randomUUID as randomUUID2 } from "crypto";
172
- import { unlinkSync as unlinkSync2, writeFileSync } from "fs";
4692
+ import { unlinkSync, writeFileSync } from "fs";
173
4693
  import { tmpdir as tmpdir2 } from "os";
174
4694
  import { join as join2 } from "path";
175
4695
 
@@ -232,6 +4752,7 @@ var _ServerErrorCounter = class _ServerErrorCounter {
232
4752
  });
233
4753
  this.errorCounts.clear();
234
4754
  this.errorDetails.clear();
4755
+ this.sentryEventIds.clear();
235
4756
  return data;
236
4757
  }
237
4758
  getKey(serverError) {
@@ -278,7 +4799,8 @@ __name(truncateExceptionStackTrace, "truncateExceptionStackTrace");
278
4799
  // src/common/tempGzipFile.ts
279
4800
  import { Buffer as Buffer2 } from "buffer";
280
4801
  import { randomUUID } from "crypto";
281
- import { createWriteStream, readFile, unlinkSync } from "fs";
4802
+ import { createWriteStream, readFile } from "fs";
4803
+ import { unlink } from "fs/promises";
282
4804
  import { tmpdir } from "os";
283
4805
  import { join } from "path";
284
4806
  import { createGzip } from "zlib";
@@ -343,7 +4865,7 @@ var _TempGzipFile = class _TempGzipFile {
343
4865
  }
344
4866
  async delete() {
345
4867
  await this.close();
346
- unlinkSync(this.filePath);
4868
+ await unlink(this.filePath);
347
4869
  }
348
4870
  };
349
4871
  __name(_TempGzipFile, "TempGzipFile");
@@ -354,6 +4876,7 @@ var MAX_BODY_SIZE = 5e4;
354
4876
  var MAX_FILE_SIZE = 1e6;
355
4877
  var MAX_FILES = 50;
356
4878
  var MAX_PENDING_WRITES = 100;
4879
+ var MAX_LOG_MSG_LENGTH = 2048;
357
4880
  var BODY_TOO_LARGE = Buffer3.from("<body too large>");
358
4881
  var BODY_MASKED = Buffer3.from("<masked>");
359
4882
  var MASKED = "******";
@@ -410,6 +4933,7 @@ var DEFAULT_CONFIG = {
410
4933
  logResponseHeaders: true,
411
4934
  logResponseBody: false,
412
4935
  logException: true,
4936
+ captureLogs: false,
413
4937
  maskQueryParams: [],
414
4938
  maskHeaders: [],
415
4939
  maskBodyFields: [],
@@ -471,13 +4995,13 @@ var _RequestLogger = class _RequestLogger {
471
4995
  return matchPatterns(name, patterns);
472
4996
  }
473
4997
  hasSupportedContentType(headers) {
474
- var _a2;
475
- const contentType = (_a2 = headers.find(([k]) => k.toLowerCase() === "content-type")) == null ? void 0 : _a2[1];
4998
+ var _a3;
4999
+ const contentType = (_a3 = headers.find(([k]) => k.toLowerCase() === "content-type")) == null ? void 0 : _a3[1];
476
5000
  return this.isSupportedContentType(contentType);
477
5001
  }
478
5002
  hasJsonContentType(headers) {
479
- var _a2;
480
- const contentType = (_a2 = headers.find(([k]) => k.toLowerCase() === "content-type")) == null ? void 0 : _a2[1];
5003
+ var _a3;
5004
+ const contentType = (_a3 = headers.find(([k]) => k.toLowerCase() === "content-type")) == null ? void 0 : _a3[1];
481
5005
  return contentType ? /\bjson\b/i.test(contentType) : null;
482
5006
  }
483
5007
  isSupportedContentType(contentType) {
@@ -564,12 +5088,12 @@ var _RequestLogger = class _RequestLogger {
564
5088
  item.request.url = url.toString();
565
5089
  return item;
566
5090
  }
567
- logRequest(request, response, error) {
568
- var _a2, _b, _c;
5091
+ logRequest(request, response, error, logs) {
5092
+ var _a3, _b, _c;
569
5093
  if (!this.enabled || this.suspendUntil !== null) return;
570
5094
  const url = new URL(request.url);
571
5095
  const path = request.path ?? url.pathname;
572
- const userAgent = (_a2 = request.headers.find(([k]) => k.toLowerCase() === "user-agent")) == null ? void 0 : _a2[1];
5096
+ const userAgent = (_a3 = request.headers.find(([k]) => k.toLowerCase() === "user-agent")) == null ? void 0 : _a3[1];
573
5097
  if (this.shouldExcludePath(path) || this.shouldExcludeUserAgent(userAgent) || (((_c = (_b = this.config).excludeCallback) == null ? void 0 : _c.call(_b, request, response)) ?? false)) {
574
5098
  return;
575
5099
  }
@@ -596,6 +5120,14 @@ var _RequestLogger = class _RequestLogger {
596
5120
  sentryEventId: getSentryEventId()
597
5121
  } : void 0
598
5122
  };
5123
+ if (logs && logs.length > 0) {
5124
+ item.logs = logs.map((log) => ({
5125
+ timestamp: log.timestamp,
5126
+ logger: log.logger,
5127
+ level: log.level,
5128
+ message: truncateLogMessage(log.message)
5129
+ }));
5130
+ }
599
5131
  this.pendingWrites.push(item);
600
5132
  if (this.pendingWrites.length > MAX_PENDING_WRITES) {
601
5133
  this.pendingWrites.shift();
@@ -617,7 +5149,8 @@ var _RequestLogger = class _RequestLogger {
617
5149
  uuid: item.uuid,
618
5150
  request: skipEmptyValues(item.request),
619
5151
  response: skipEmptyValues(item.response),
620
- exception: item.exception
5152
+ exception: item.exception,
5153
+ logs: item.logs
621
5154
  };
622
5155
  [
623
5156
  finalItem.request.body,
@@ -696,11 +5229,19 @@ function skipEmptyValues(data) {
696
5229
  }));
697
5230
  }
698
5231
  __name(skipEmptyValues, "skipEmptyValues");
5232
+ function truncateLogMessage(msg) {
5233
+ if (msg.length > MAX_LOG_MSG_LENGTH) {
5234
+ const suffix = "... (truncated)";
5235
+ return msg.slice(0, MAX_LOG_MSG_LENGTH - suffix.length) + suffix;
5236
+ }
5237
+ return msg;
5238
+ }
5239
+ __name(truncateLogMessage, "truncateLogMessage");
699
5240
  function checkWritableFs() {
700
5241
  try {
701
5242
  const testPath = join2(tmpdir2(), `apitally-${randomUUID2()}`);
702
5243
  writeFileSync(testPath, "test");
703
- unlinkSync2(testPath);
5244
+ unlinkSync(testPath);
704
5245
  return true;
705
5246
  } catch (error) {
706
5247
  return false;
@@ -733,7 +5274,7 @@ var _ValidationErrorCounter = class _ValidationErrorCounter {
733
5274
  consumer: validationError.consumer || null,
734
5275
  method: validationError.method,
735
5276
  path: validationError.path,
736
- loc: validationError.loc.split("."),
5277
+ loc: validationError.loc.split(".").filter(Boolean),
737
5278
  msg: validationError.msg,
738
5279
  type: validationError.type,
739
5280
  error_count: count
@@ -749,7 +5290,7 @@ var _ValidationErrorCounter = class _ValidationErrorCounter {
749
5290
  validationError.consumer || "",
750
5291
  validationError.method.toUpperCase(),
751
5292
  validationError.path,
752
- validationError.loc,
5293
+ validationError.loc.split(".").filter(Boolean),
753
5294
  validationError.msg.trim(),
754
5295
  validationError.type
755
5296
  ].join("|");
@@ -1051,6 +5592,179 @@ function getPackageVersion(name) {
1051
5592
  }
1052
5593
  __name(getPackageVersion, "getPackageVersion");
1053
5594
 
5595
+ // src/loggers/console.ts
5596
+ import { format as format2 } from "util";
5597
+ var MAX_BUFFER_SIZE = 1e3;
5598
+ var isPatched = false;
5599
+ var globalLogsContext;
5600
+ function patchConsole(logsContext) {
5601
+ globalLogsContext = logsContext;
5602
+ if (isPatched) {
5603
+ return;
5604
+ }
5605
+ const logMethods = [
5606
+ "log",
5607
+ "warn",
5608
+ "error",
5609
+ "info",
5610
+ "debug"
5611
+ ];
5612
+ logMethods.forEach((method) => {
5613
+ const originalMethod = console[method];
5614
+ console[method] = function(...args) {
5615
+ captureLog(method, args);
5616
+ return originalMethod.apply(console, args);
5617
+ };
5618
+ });
5619
+ isPatched = true;
5620
+ }
5621
+ __name(patchConsole, "patchConsole");
5622
+ function captureLog(level, args) {
5623
+ const logs = globalLogsContext == null ? void 0 : globalLogsContext.getStore();
5624
+ if (logs && logs.length < MAX_BUFFER_SIZE) {
5625
+ logs.push({
5626
+ timestamp: Date.now() / 1e3,
5627
+ logger: "console",
5628
+ level,
5629
+ message: format2(...args)
5630
+ });
5631
+ }
5632
+ }
5633
+ __name(captureLog, "captureLog");
5634
+
5635
+ // src/loggers/utils.ts
5636
+ import { format as format3 } from "util";
5637
+ function formatMessage(message, ...args) {
5638
+ return [
5639
+ message,
5640
+ ...args
5641
+ ].map(formatArg).filter((arg) => arg !== "").join("\n");
5642
+ }
5643
+ __name(formatMessage, "formatMessage");
5644
+ function removeKeys(obj, keys) {
5645
+ return Object.fromEntries(Object.entries(obj).filter(([key]) => !keys.includes(key)));
5646
+ }
5647
+ __name(removeKeys, "removeKeys");
5648
+ function formatArg(arg) {
5649
+ if (typeof arg === "string") {
5650
+ return arg.trim();
5651
+ }
5652
+ if (arg instanceof Error) {
5653
+ return format3(arg).trim();
5654
+ }
5655
+ if (arg === void 0 || arg === null || isEmptyObject(arg)) {
5656
+ return "";
5657
+ }
5658
+ try {
5659
+ return JSON.stringify(arg);
5660
+ } catch {
5661
+ return format3(arg).trim();
5662
+ }
5663
+ }
5664
+ __name(formatArg, "formatArg");
5665
+ function isEmptyObject(obj) {
5666
+ return obj !== null && typeof obj === "object" && Object.getPrototypeOf(obj) === Object.prototype && Object.keys(obj).length === 0;
5667
+ }
5668
+ __name(isEmptyObject, "isEmptyObject");
5669
+
5670
+ // src/loggers/pino.ts
5671
+ var MAX_BUFFER_SIZE2 = 1e3;
5672
+ var originalStreamSym = Symbol.for("apitally.originalStream");
5673
+ var logLevelMap = {
5674
+ 10: "trace",
5675
+ 20: "debug",
5676
+ 30: "info",
5677
+ 40: "warn",
5678
+ 50: "error",
5679
+ 60: "fatal"
5680
+ };
5681
+ async function patchPinoLogger(logger, logsContext) {
5682
+ try {
5683
+ const pino = await Promise.resolve().then(() => __toESM(require_pino(), 1));
5684
+ if (!(pino.default.symbols.streamSym in logger)) {
5685
+ return;
5686
+ }
5687
+ if (!(originalStreamSym in logger)) {
5688
+ logger[originalStreamSym] = logger[pino.default.symbols.streamSym];
5689
+ }
5690
+ const originalStream = logger[originalStreamSym];
5691
+ if (originalStream) {
5692
+ const messageKey = logger[pino.default.symbols.messageKeySym];
5693
+ const captureStream = new ApitallyLogCaptureStream(logsContext, messageKey);
5694
+ logger[pino.default.symbols.streamSym] = pino.default.multistream([
5695
+ {
5696
+ level: 0,
5697
+ stream: originalStream
5698
+ },
5699
+ {
5700
+ level: 0,
5701
+ stream: captureStream
5702
+ }
5703
+ ], {
5704
+ levels: logger.levels
5705
+ });
5706
+ }
5707
+ } catch {
5708
+ }
5709
+ }
5710
+ __name(patchPinoLogger, "patchPinoLogger");
5711
+ function filterLogs(obj, messageKey) {
5712
+ return obj[messageKey] !== "request completed";
5713
+ }
5714
+ __name(filterLogs, "filterLogs");
5715
+ var _a2;
5716
+ var ApitallyLogCaptureStream = (_a2 = class {
5717
+ logsContext;
5718
+ messageKey;
5719
+ constructor(logsContext, messageKey) {
5720
+ this.logsContext = logsContext;
5721
+ this.messageKey = messageKey;
5722
+ }
5723
+ write(msg) {
5724
+ const logs = this.logsContext.getStore();
5725
+ if (!logs || !msg || logs.length >= MAX_BUFFER_SIZE2) {
5726
+ return;
5727
+ }
5728
+ let obj;
5729
+ try {
5730
+ obj = JSON.parse(msg);
5731
+ } catch (e) {
5732
+ return;
5733
+ }
5734
+ if (obj === null || typeof obj !== "object" || !filterLogs(obj, this.messageKey)) {
5735
+ return;
5736
+ }
5737
+ try {
5738
+ const message = obj[this.messageKey];
5739
+ const rest = removeKeys(obj, [
5740
+ "hostname",
5741
+ "level",
5742
+ this.messageKey,
5743
+ "pid",
5744
+ "time",
5745
+ "reqId",
5746
+ "req",
5747
+ "res"
5748
+ ]);
5749
+ const formattedMessage = formatMessage(message, rest);
5750
+ if (formattedMessage) {
5751
+ logs.push({
5752
+ timestamp: this.convertTime(obj.time),
5753
+ level: logLevelMap[obj.level] || "info",
5754
+ message: formattedMessage
5755
+ });
5756
+ }
5757
+ } catch (e) {
5758
+ }
5759
+ }
5760
+ convertTime(time) {
5761
+ if (typeof time === "number" && !isNaN(time)) {
5762
+ return time / 1e3;
5763
+ }
5764
+ return Date.now() / 1e3;
5765
+ }
5766
+ }, __name(_a2, "ApitallyLogCaptureStream"), _a2);
5767
+
1054
5768
  // src/adonisjs/provider.ts
1055
5769
  var _ApitallyProvider = class _ApitallyProvider {
1056
5770
  app;
@@ -1062,6 +5776,18 @@ var _ApitallyProvider = class _ApitallyProvider {
1062
5776
  const config = this.app.config.get("apitally");
1063
5777
  return new ApitallyClient(config);
1064
5778
  });
5779
+ this.app.container.singleton("apitallyLogsContext", () => {
5780
+ return new AsyncLocalStorage();
5781
+ });
5782
+ }
5783
+ async start() {
5784
+ const client = await this.app.container.make("apitallyClient");
5785
+ if (client.requestLogger.config.captureLogs) {
5786
+ const logsContext = await this.app.container.make("apitallyLogsContext");
5787
+ const logger = await this.app.container.make("logger");
5788
+ patchPinoLogger(logger.pino, logsContext);
5789
+ patchConsole(logsContext);
5790
+ }
1065
5791
  }
1066
5792
  async ready() {
1067
5793
  const client = await this.app.container.make("apitallyClient");