voltlog-io 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client.d.mts → browser/client.d.mts} +1 -9
- package/dist/{client.d.ts → browser/client.d.ts} +1 -9
- package/dist/{chunk-4WQ4K5BM.js → browser/client.js} +37 -64
- package/dist/{chunk-DAFMRCAN.mjs → browser/client.mjs} +26 -59
- package/dist/index.d.mts +1220 -3
- package/dist/index.d.ts +1220 -3
- package/dist/index.js +1670 -38
- package/dist/index.mjs +1672 -40
- package/package.json +7 -6
- package/dist/chunk-4WQ4K5BM.js.map +0 -1
- package/dist/chunk-DAFMRCAN.mjs.map +0 -1
- package/dist/client.js +0 -75
- package/dist/client.js.map +0 -1
- package/dist/client.mjs +0 -75
- package/dist/client.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -476,14 +476,6 @@ interface HttpLoggerOptions<TReq = any, TRes = any> {
|
|
|
476
476
|
/** Function to skip logging certain requests (e.g., /health) */
|
|
477
477
|
skip?: (req: TReq) => boolean;
|
|
478
478
|
}
|
|
479
|
-
/**
|
|
480
|
-
* Common mappers for the raw Node.js `http.IncomingMessage` and `http.ServerResponse`.
|
|
481
|
-
* Since Express and many others extend these objects, they work universally.
|
|
482
|
-
*/
|
|
483
|
-
declare const nodeHttpMappers: {
|
|
484
|
-
req: HttpRequestMapper;
|
|
485
|
-
res: HttpResponseMapper;
|
|
486
|
-
};
|
|
487
479
|
/**
|
|
488
480
|
* Creates a generic HTTP logging middleware function.
|
|
489
481
|
* Use this inside Express, Fastify, or custom routers.
|
|
@@ -1244,4 +1236,4 @@ interface WebhookTransportOptions {
|
|
|
1244
1236
|
*/
|
|
1245
1237
|
declare function webhookTransport(options: WebhookTransportOptions): Transport;
|
|
1246
1238
|
|
|
1247
|
-
export { type AiEnrichmentOptions, type AlertRule, type BatchTransportOptions, type BrowserJsonStreamTransportOptions, type ConsoleTransportOptions, type DatadogTransportOptions, type DeduplicationOptions, type DiscordTransportOptions, type HttpLoggerOptions, type HttpRequestMapper, type HttpResponseMapper, type LevelOverrideOptions, type LogEntry, type LogError, LogLevel, type LogLevelName, LogLevelNameMap, type LogLevelValue, LogLevelValueMap, type LogMiddleware, type Logger, type LoggerOptions, type LokiTransportOptions, type OcppExchangeMeta, type OcppMiddlewareOptions, type OtelTraceMiddlewareOptions, type OtelTransportOptions, type PrettyTransportOptions, type RedactionOptions, type RingBufferQueryOptions, type RingBufferTransport, type RingBufferTransportOptions, type SamplingOptions, type SentryInstance, type SentryTransportOptions, type SlackTransportOptions, type TimerResult, type Transport, type UserAgentOptions, type WebhookTransportOptions, aiEnrichmentMiddleware, alertMiddleware, batchTransport, browserJsonStreamTransport, consoleTransport, createHttpLogger, createLogger, createMiddleware, createOpenAiErrorAnalyzer, createTransport, datadogTransport, deduplicationMiddleware, discordTransport, heapUsageMiddleware, ipMiddleware, levelOverrideMiddleware, lokiTransport,
|
|
1239
|
+
export { type AiEnrichmentOptions, type AlertRule, type BatchTransportOptions, type BrowserJsonStreamTransportOptions, type ConsoleTransportOptions, type DatadogTransportOptions, type DeduplicationOptions, type DiscordTransportOptions, type HttpLoggerOptions, type HttpRequestMapper, type HttpResponseMapper, type LevelOverrideOptions, type LogEntry, type LogError, LogLevel, type LogLevelName, LogLevelNameMap, type LogLevelValue, LogLevelValueMap, type LogMiddleware, type Logger, type LoggerOptions, type LokiTransportOptions, type OcppExchangeMeta, type OcppMiddlewareOptions, type OtelTraceMiddlewareOptions, type OtelTransportOptions, type PrettyTransportOptions, type RedactionOptions, type RingBufferQueryOptions, type RingBufferTransport, type RingBufferTransportOptions, type SamplingOptions, type SentryInstance, type SentryTransportOptions, type SlackTransportOptions, type TimerResult, type Transport, type UserAgentOptions, type WebhookTransportOptions, aiEnrichmentMiddleware, alertMiddleware, batchTransport, browserJsonStreamTransport, consoleTransport, createHttpLogger, createLogger, createMiddleware, createOpenAiErrorAnalyzer, createTransport, datadogTransport, deduplicationMiddleware, discordTransport, heapUsageMiddleware, ipMiddleware, levelOverrideMiddleware, lokiTransport, ocppMiddleware, otelTraceMiddleware, otelTransport, prettyTransport, redactionMiddleware, resolveLevel, ringBufferTransport, samplingMiddleware, sentryTransport, shouldIncludeStack, shouldLog, slackTransport, userAgentMiddleware, webhookTransport };
|
|
@@ -476,14 +476,6 @@ interface HttpLoggerOptions<TReq = any, TRes = any> {
|
|
|
476
476
|
/** Function to skip logging certain requests (e.g., /health) */
|
|
477
477
|
skip?: (req: TReq) => boolean;
|
|
478
478
|
}
|
|
479
|
-
/**
|
|
480
|
-
* Common mappers for the raw Node.js `http.IncomingMessage` and `http.ServerResponse`.
|
|
481
|
-
* Since Express and many others extend these objects, they work universally.
|
|
482
|
-
*/
|
|
483
|
-
declare const nodeHttpMappers: {
|
|
484
|
-
req: HttpRequestMapper;
|
|
485
|
-
res: HttpResponseMapper;
|
|
486
|
-
};
|
|
487
479
|
/**
|
|
488
480
|
* Creates a generic HTTP logging middleware function.
|
|
489
481
|
* Use this inside Express, Fastify, or custom routers.
|
|
@@ -1244,4 +1236,4 @@ interface WebhookTransportOptions {
|
|
|
1244
1236
|
*/
|
|
1245
1237
|
declare function webhookTransport(options: WebhookTransportOptions): Transport;
|
|
1246
1238
|
|
|
1247
|
-
export { type AiEnrichmentOptions, type AlertRule, type BatchTransportOptions, type BrowserJsonStreamTransportOptions, type ConsoleTransportOptions, type DatadogTransportOptions, type DeduplicationOptions, type DiscordTransportOptions, type HttpLoggerOptions, type HttpRequestMapper, type HttpResponseMapper, type LevelOverrideOptions, type LogEntry, type LogError, LogLevel, type LogLevelName, LogLevelNameMap, type LogLevelValue, LogLevelValueMap, type LogMiddleware, type Logger, type LoggerOptions, type LokiTransportOptions, type OcppExchangeMeta, type OcppMiddlewareOptions, type OtelTraceMiddlewareOptions, type OtelTransportOptions, type PrettyTransportOptions, type RedactionOptions, type RingBufferQueryOptions, type RingBufferTransport, type RingBufferTransportOptions, type SamplingOptions, type SentryInstance, type SentryTransportOptions, type SlackTransportOptions, type TimerResult, type Transport, type UserAgentOptions, type WebhookTransportOptions, aiEnrichmentMiddleware, alertMiddleware, batchTransport, browserJsonStreamTransport, consoleTransport, createHttpLogger, createLogger, createMiddleware, createOpenAiErrorAnalyzer, createTransport, datadogTransport, deduplicationMiddleware, discordTransport, heapUsageMiddleware, ipMiddleware, levelOverrideMiddleware, lokiTransport,
|
|
1239
|
+
export { type AiEnrichmentOptions, type AlertRule, type BatchTransportOptions, type BrowserJsonStreamTransportOptions, type ConsoleTransportOptions, type DatadogTransportOptions, type DeduplicationOptions, type DiscordTransportOptions, type HttpLoggerOptions, type HttpRequestMapper, type HttpResponseMapper, type LevelOverrideOptions, type LogEntry, type LogError, LogLevel, type LogLevelName, LogLevelNameMap, type LogLevelValue, LogLevelValueMap, type LogMiddleware, type Logger, type LoggerOptions, type LokiTransportOptions, type OcppExchangeMeta, type OcppMiddlewareOptions, type OtelTraceMiddlewareOptions, type OtelTransportOptions, type PrettyTransportOptions, type RedactionOptions, type RingBufferQueryOptions, type RingBufferTransport, type RingBufferTransportOptions, type SamplingOptions, type SentryInstance, type SentryTransportOptions, type SlackTransportOptions, type TimerResult, type Transport, type UserAgentOptions, type WebhookTransportOptions, aiEnrichmentMiddleware, alertMiddleware, batchTransport, browserJsonStreamTransport, consoleTransport, createHttpLogger, createLogger, createMiddleware, createOpenAiErrorAnalyzer, createTransport, datadogTransport, deduplicationMiddleware, discordTransport, heapUsageMiddleware, ipMiddleware, levelOverrideMiddleware, lokiTransport, ocppMiddleware, otelTraceMiddleware, otelTransport, prettyTransport, redactionMiddleware, resolveLevel, ringBufferTransport, samplingMiddleware, sentryTransport, shouldIncludeStack, shouldLog, slackTransport, userAgentMiddleware, webhookTransport };
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
// src/core/types.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/core/types.ts
|
|
9
2
|
var LogLevel = {
|
|
10
3
|
TRACE: 10,
|
|
11
4
|
DEBUG: 20,
|
|
@@ -479,26 +472,6 @@ function heapUsageMiddleware(options = {}) {
|
|
|
479
472
|
}
|
|
480
473
|
|
|
481
474
|
// src/middleware/http.ts
|
|
482
|
-
var nodeHttpMappers = {
|
|
483
|
-
req: {
|
|
484
|
-
getMethod: (req) => req.method || "UNKNOWN",
|
|
485
|
-
getUrl: (req) => req.originalUrl || req.url || "/",
|
|
486
|
-
getIp: (req) => req.ip || _optionalChain([req, 'access', _14 => _14.socket, 'optionalAccess', _15 => _15.remoteAddress]) || _optionalChain([req, 'access', _16 => _16.headers, 'optionalAccess', _17 => _17["x-forwarded-for"]]) || void 0,
|
|
487
|
-
getUserAgent: (req) => _optionalChain([req, 'access', _18 => _18.headers, 'optionalAccess', _19 => _19["user-agent"]]) || void 0,
|
|
488
|
-
getHeader: (req, name) => _optionalChain([req, 'access', _20 => _20.headers, 'optionalAccess', _21 => _21[name]]) || void 0
|
|
489
|
-
},
|
|
490
|
-
res: {
|
|
491
|
-
getStatusCode: (res) => res.statusCode || 200,
|
|
492
|
-
onFinish: (res, callback) => {
|
|
493
|
-
if (typeof res.on === "function") {
|
|
494
|
-
res.on("finish", callback);
|
|
495
|
-
res.on("close", callback);
|
|
496
|
-
} else {
|
|
497
|
-
callback();
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
475
|
function createHttpLogger(logger, options) {
|
|
503
476
|
const {
|
|
504
477
|
reqMapper,
|
|
@@ -508,7 +481,7 @@ function createHttpLogger(logger, options) {
|
|
|
508
481
|
extractContext
|
|
509
482
|
} = options;
|
|
510
483
|
return (req, res) => {
|
|
511
|
-
if (_optionalChain([skip, 'optionalCall',
|
|
484
|
+
if (_optionalChain([skip, 'optionalCall', _14 => _14(req)])) {
|
|
512
485
|
return;
|
|
513
486
|
}
|
|
514
487
|
const startTime = performance.now();
|
|
@@ -594,7 +567,7 @@ function levelOverrideMiddleware(options = {}) {
|
|
|
594
567
|
return (entry, next) => {
|
|
595
568
|
const meta = entry.meta;
|
|
596
569
|
const context = entry.context;
|
|
597
|
-
const levelName = meta[key] || _optionalChain([context, 'optionalAccess',
|
|
570
|
+
const levelName = meta[key] || _optionalChain([context, 'optionalAccess', _15 => _15[key]]) || _optionalChain([meta, 'access', _16 => _16.headers, 'optionalAccess', _17 => _17[key]]);
|
|
598
571
|
if (levelName && typeof levelName === "string") {
|
|
599
572
|
const upperName = levelName.toUpperCase();
|
|
600
573
|
if (LogLevel[upperName]) {
|
|
@@ -635,22 +608,25 @@ function ocppMiddleware(options = {}) {
|
|
|
635
608
|
function otelTraceMiddleware(options = {}) {
|
|
636
609
|
let traceApi = _nullishCoalesce(options.traceApi, () => ( null));
|
|
637
610
|
let resolved = !!traceApi;
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
const api = dynamicRequire("@opentelemetry/api");
|
|
611
|
+
let resolvePromise = null;
|
|
612
|
+
function ensureResolved() {
|
|
613
|
+
if (resolved || resolvePromise) return _nullishCoalesce(resolvePromise, () => ( Promise.resolve()));
|
|
614
|
+
resolvePromise = Promise.resolve().then(() => _interopRequireWildcard(require("@opentelemetry/api"))).then((api) => {
|
|
643
615
|
traceApi = api;
|
|
644
616
|
resolved = true;
|
|
645
|
-
}
|
|
646
|
-
|
|
617
|
+
}).catch(() => {
|
|
618
|
+
resolved = true;
|
|
619
|
+
});
|
|
620
|
+
return resolvePromise;
|
|
647
621
|
}
|
|
648
622
|
return (entry, next) => {
|
|
649
|
-
|
|
623
|
+
ensureResolved().catch(() => {
|
|
624
|
+
});
|
|
625
|
+
if (resolved && _optionalChain([traceApi, 'optionalAccess', _18 => _18.trace])) {
|
|
650
626
|
try {
|
|
651
|
-
const activeSpan = _optionalChain([traceApi, 'access',
|
|
627
|
+
const activeSpan = _optionalChain([traceApi, 'access', _19 => _19.trace, 'access', _20 => _20.getActiveSpan, 'optionalCall', _21 => _21()]);
|
|
652
628
|
if (activeSpan) {
|
|
653
|
-
const spanContext = _optionalChain([activeSpan, 'access',
|
|
629
|
+
const spanContext = _optionalChain([activeSpan, 'access', _22 => _22.spanContext, 'optionalCall', _23 => _23()]);
|
|
654
630
|
if (spanContext) {
|
|
655
631
|
const meta = entry.meta;
|
|
656
632
|
meta.traceId = spanContext.traceId;
|
|
@@ -661,7 +637,7 @@ function otelTraceMiddleware(options = {}) {
|
|
|
661
637
|
}
|
|
662
638
|
}
|
|
663
639
|
}
|
|
664
|
-
} catch (
|
|
640
|
+
} catch (e6) {
|
|
665
641
|
}
|
|
666
642
|
}
|
|
667
643
|
next(entry);
|
|
@@ -745,7 +721,7 @@ function userAgentMiddleware(options = {}) {
|
|
|
745
721
|
return (entry, next) => {
|
|
746
722
|
const meta = entry.meta;
|
|
747
723
|
const context = entry.context;
|
|
748
|
-
const ua = (sourceField ? meta[sourceField] : void 0) || meta.userAgent || meta["user-agent"] || _optionalChain([context, 'optionalAccess',
|
|
724
|
+
const ua = (sourceField ? meta[sourceField] : void 0) || meta.userAgent || meta["user-agent"] || _optionalChain([context, 'optionalAccess', _24 => _24.userAgent]) || _optionalChain([context, 'optionalAccess', _25 => _25["user-agent"]]);
|
|
749
725
|
if (ua) {
|
|
750
726
|
const info = parseUserAgent(ua);
|
|
751
727
|
entry.meta = {
|
|
@@ -800,7 +776,7 @@ function batchTransport(inner, options = {}) {
|
|
|
800
776
|
result.catch(() => {
|
|
801
777
|
});
|
|
802
778
|
}
|
|
803
|
-
} catch (
|
|
779
|
+
} catch (e7) {
|
|
804
780
|
}
|
|
805
781
|
}
|
|
806
782
|
}
|
|
@@ -821,11 +797,11 @@ function batchTransport(inner, options = {}) {
|
|
|
821
797
|
flushTimer = null;
|
|
822
798
|
}
|
|
823
799
|
doFlush();
|
|
824
|
-
await _optionalChain([inner, 'access',
|
|
800
|
+
await _optionalChain([inner, 'access', _26 => _26.flush, 'optionalCall', _27 => _27()]);
|
|
825
801
|
},
|
|
826
802
|
async close() {
|
|
827
|
-
await _optionalChain([this, 'access',
|
|
828
|
-
await _optionalChain([inner, 'access',
|
|
803
|
+
await _optionalChain([this, 'access', _28 => _28.flush, 'optionalCall', _29 => _29()]);
|
|
804
|
+
await _optionalChain([inner, 'access', _30 => _30.close, 'optionalCall', _31 => _31()]);
|
|
829
805
|
}
|
|
830
806
|
};
|
|
831
807
|
}
|
|
@@ -980,7 +956,7 @@ ${JSON.stringify(entry.meta, null, 2).slice(
|
|
|
980
956
|
)}
|
|
981
957
|
\`\`\``
|
|
982
958
|
},
|
|
983
|
-
_optionalChain([entry, 'access',
|
|
959
|
+
_optionalChain([entry, 'access', _32 => _32.error, 'optionalAccess', _33 => _33.stack]) ? {
|
|
984
960
|
name: "Stack",
|
|
985
961
|
value: `\`\`\`js
|
|
986
962
|
${entry.error.stack.slice(0, 1e3)}
|
|
@@ -1129,7 +1105,7 @@ function lokiTransport(options) {
|
|
|
1129
1105
|
await doFlush();
|
|
1130
1106
|
},
|
|
1131
1107
|
async close() {
|
|
1132
|
-
await _optionalChain([this, 'access',
|
|
1108
|
+
await _optionalChain([this, 'access', _34 => _34.flush, 'optionalCall', _35 => _35()]);
|
|
1133
1109
|
}
|
|
1134
1110
|
};
|
|
1135
1111
|
}
|
|
@@ -1207,19 +1183,19 @@ function otelTransport(options) {
|
|
|
1207
1183
|
const record = {
|
|
1208
1184
|
timeUnixNano: String(entry.timestamp * 1e6),
|
|
1209
1185
|
// ms → ns
|
|
1210
|
-
severityNumber: _optionalChain([severity, 'optionalAccess',
|
|
1211
|
-
severityText: _optionalChain([severity, 'optionalAccess',
|
|
1186
|
+
severityNumber: _optionalChain([severity, 'optionalAccess', _36 => _36.number]),
|
|
1187
|
+
severityText: _optionalChain([severity, 'optionalAccess', _37 => _37.text]),
|
|
1212
1188
|
body: { stringValue: entry.message },
|
|
1213
1189
|
attributes
|
|
1214
1190
|
};
|
|
1215
1191
|
const meta = entry.meta;
|
|
1216
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
1192
|
+
if (_optionalChain([meta, 'optionalAccess', _38 => _38.traceId])) {
|
|
1217
1193
|
record.traceId = meta.traceId;
|
|
1218
1194
|
}
|
|
1219
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
1195
|
+
if (_optionalChain([meta, 'optionalAccess', _39 => _39.spanId])) {
|
|
1220
1196
|
record.spanId = meta.spanId;
|
|
1221
1197
|
}
|
|
1222
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
1198
|
+
if (_optionalChain([meta, 'optionalAccess', _40 => _40.traceFlags]) !== void 0) {
|
|
1223
1199
|
record.flags = meta.traceFlags;
|
|
1224
1200
|
}
|
|
1225
1201
|
return record;
|
|
@@ -1290,7 +1266,7 @@ function otelTransport(options) {
|
|
|
1290
1266
|
await sendBatch(batch);
|
|
1291
1267
|
},
|
|
1292
1268
|
async close() {
|
|
1293
|
-
await _optionalChain([this, 'access',
|
|
1269
|
+
await _optionalChain([this, 'access', _41 => _41.flush, 'optionalCall', _42 => _42()]);
|
|
1294
1270
|
}
|
|
1295
1271
|
};
|
|
1296
1272
|
}
|
|
@@ -1448,15 +1424,15 @@ function ringBufferTransport(options = {}) {
|
|
|
1448
1424
|
} else {
|
|
1449
1425
|
entries = [...buffer.slice(head), ...buffer.slice(0, head)];
|
|
1450
1426
|
}
|
|
1451
|
-
if (_optionalChain([query, 'optionalAccess',
|
|
1427
|
+
if (_optionalChain([query, 'optionalAccess', _43 => _43.level])) {
|
|
1452
1428
|
const minLevel = resolveLevel(query.level);
|
|
1453
1429
|
entries = entries.filter((e) => e.level >= minLevel);
|
|
1454
1430
|
}
|
|
1455
|
-
if (_optionalChain([query, 'optionalAccess',
|
|
1431
|
+
if (_optionalChain([query, 'optionalAccess', _44 => _44.since])) {
|
|
1456
1432
|
const since = query.since;
|
|
1457
1433
|
entries = entries.filter((e) => e.timestamp >= since);
|
|
1458
1434
|
}
|
|
1459
|
-
if (_optionalChain([query, 'optionalAccess',
|
|
1435
|
+
if (_optionalChain([query, 'optionalAccess', _45 => _45.limit])) {
|
|
1460
1436
|
entries = entries.slice(-query.limit);
|
|
1461
1437
|
}
|
|
1462
1438
|
return entries;
|
|
@@ -1578,7 +1554,7 @@ function formatSlackMessage(entry, username, icon_emoji) {
|
|
|
1578
1554
|
}
|
|
1579
1555
|
});
|
|
1580
1556
|
}
|
|
1581
|
-
if (_optionalChain([entry, 'access',
|
|
1557
|
+
if (_optionalChain([entry, 'access', _46 => _46.error, 'optionalAccess', _47 => _47.stack])) {
|
|
1582
1558
|
blocks.push({
|
|
1583
1559
|
type: "section",
|
|
1584
1560
|
text: {
|
|
@@ -1650,7 +1626,7 @@ function webhookTransport(options) {
|
|
|
1650
1626
|
await new Promise((r) => setTimeout(r, delay));
|
|
1651
1627
|
return sendBatch(entries, attempt + 1);
|
|
1652
1628
|
}
|
|
1653
|
-
} catch (
|
|
1629
|
+
} catch (e8) {
|
|
1654
1630
|
if (retry && attempt < maxRetries) {
|
|
1655
1631
|
const delay = Math.min(1e3 * 2 ** attempt, 3e4);
|
|
1656
1632
|
await new Promise((r) => setTimeout(r, delay));
|
|
@@ -1695,7 +1671,7 @@ function webhookTransport(options) {
|
|
|
1695
1671
|
}
|
|
1696
1672
|
},
|
|
1697
1673
|
async close() {
|
|
1698
|
-
await _optionalChain([this, 'access',
|
|
1674
|
+
await _optionalChain([this, 'access', _48 => _48.flush, 'optionalCall', _49 => _49()]);
|
|
1699
1675
|
}
|
|
1700
1676
|
};
|
|
1701
1677
|
}
|
|
@@ -1734,7 +1710,4 @@ function webhookTransport(options) {
|
|
|
1734
1710
|
|
|
1735
1711
|
|
|
1736
1712
|
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
exports.LogLevel = LogLevel; exports.LogLevelNameMap = LogLevelNameMap; exports.LogLevelValueMap = LogLevelValueMap; exports.resolveLevel = resolveLevel; exports.shouldLog = shouldLog; exports.shouldIncludeStack = shouldIncludeStack; exports.createLogger = createLogger; exports.aiEnrichmentMiddleware = aiEnrichmentMiddleware; exports.createOpenAiErrorAnalyzer = createOpenAiErrorAnalyzer; exports.alertMiddleware = alertMiddleware; exports.createMiddleware = createMiddleware; exports.deduplicationMiddleware = deduplicationMiddleware; exports.heapUsageMiddleware = heapUsageMiddleware; exports.nodeHttpMappers = nodeHttpMappers; exports.createHttpLogger = createHttpLogger; exports.ipMiddleware = ipMiddleware; exports.levelOverrideMiddleware = levelOverrideMiddleware; exports.ocppMiddleware = ocppMiddleware; exports.otelTraceMiddleware = otelTraceMiddleware; exports.redactionMiddleware = redactionMiddleware; exports.samplingMiddleware = samplingMiddleware; exports.userAgentMiddleware = userAgentMiddleware; exports.batchTransport = batchTransport; exports.browserJsonStreamTransport = browserJsonStreamTransport; exports.consoleTransport = consoleTransport; exports.createTransport = createTransport; exports.datadogTransport = datadogTransport; exports.discordTransport = discordTransport; exports.lokiTransport = lokiTransport; exports.otelTransport = otelTransport; exports.prettyTransport = prettyTransport; exports.ringBufferTransport = ringBufferTransport; exports.sentryTransport = sentryTransport; exports.slackTransport = slackTransport; exports.webhookTransport = webhookTransport;
|
|
1740
|
-
//# sourceMappingURL=chunk-4WQ4K5BM.js.map
|
|
1713
|
+
exports.LogLevel = LogLevel; exports.LogLevelNameMap = LogLevelNameMap; exports.LogLevelValueMap = LogLevelValueMap; exports.aiEnrichmentMiddleware = aiEnrichmentMiddleware; exports.alertMiddleware = alertMiddleware; exports.batchTransport = batchTransport; exports.browserJsonStreamTransport = browserJsonStreamTransport; exports.consoleTransport = consoleTransport; exports.createHttpLogger = createHttpLogger; exports.createLogger = createLogger; exports.createMiddleware = createMiddleware; exports.createOpenAiErrorAnalyzer = createOpenAiErrorAnalyzer; exports.createTransport = createTransport; exports.datadogTransport = datadogTransport; exports.deduplicationMiddleware = deduplicationMiddleware; exports.discordTransport = discordTransport; exports.heapUsageMiddleware = heapUsageMiddleware; exports.ipMiddleware = ipMiddleware; exports.levelOverrideMiddleware = levelOverrideMiddleware; exports.lokiTransport = lokiTransport; exports.ocppMiddleware = ocppMiddleware; exports.otelTraceMiddleware = otelTraceMiddleware; exports.otelTransport = otelTransport; exports.prettyTransport = prettyTransport; exports.redactionMiddleware = redactionMiddleware; exports.resolveLevel = resolveLevel; exports.ringBufferTransport = ringBufferTransport; exports.samplingMiddleware = samplingMiddleware; exports.sentryTransport = sentryTransport; exports.shouldIncludeStack = shouldIncludeStack; exports.shouldLog = shouldLog; exports.slackTransport = slackTransport; exports.userAgentMiddleware = userAgentMiddleware; exports.webhookTransport = webhookTransport;
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
// node_modules/tsup/assets/esm_shims.js
|
|
9
|
-
import path from "path";
|
|
10
|
-
import { fileURLToPath } from "url";
|
|
11
|
-
var getFilename = () => fileURLToPath(import.meta.url);
|
|
12
|
-
var __filename = /* @__PURE__ */ getFilename();
|
|
13
|
-
|
|
14
1
|
// src/core/types.ts
|
|
15
2
|
var LogLevel = {
|
|
16
3
|
TRACE: 10,
|
|
@@ -485,26 +472,6 @@ function heapUsageMiddleware(options = {}) {
|
|
|
485
472
|
}
|
|
486
473
|
|
|
487
474
|
// src/middleware/http.ts
|
|
488
|
-
var nodeHttpMappers = {
|
|
489
|
-
req: {
|
|
490
|
-
getMethod: (req) => req.method || "UNKNOWN",
|
|
491
|
-
getUrl: (req) => req.originalUrl || req.url || "/",
|
|
492
|
-
getIp: (req) => req.ip || req.socket?.remoteAddress || req.headers?.["x-forwarded-for"] || void 0,
|
|
493
|
-
getUserAgent: (req) => req.headers?.["user-agent"] || void 0,
|
|
494
|
-
getHeader: (req, name) => req.headers?.[name] || void 0
|
|
495
|
-
},
|
|
496
|
-
res: {
|
|
497
|
-
getStatusCode: (res) => res.statusCode || 200,
|
|
498
|
-
onFinish: (res, callback) => {
|
|
499
|
-
if (typeof res.on === "function") {
|
|
500
|
-
res.on("finish", callback);
|
|
501
|
-
res.on("close", callback);
|
|
502
|
-
} else {
|
|
503
|
-
callback();
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
475
|
function createHttpLogger(logger, options) {
|
|
509
476
|
const {
|
|
510
477
|
reqMapper,
|
|
@@ -641,17 +608,20 @@ function ocppMiddleware(options = {}) {
|
|
|
641
608
|
function otelTraceMiddleware(options = {}) {
|
|
642
609
|
let traceApi = options.traceApi ?? null;
|
|
643
610
|
let resolved = !!traceApi;
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
const api = dynamicRequire("@opentelemetry/api");
|
|
611
|
+
let resolvePromise = null;
|
|
612
|
+
function ensureResolved() {
|
|
613
|
+
if (resolved || resolvePromise) return resolvePromise ?? Promise.resolve();
|
|
614
|
+
resolvePromise = import("@opentelemetry/api").then((api) => {
|
|
649
615
|
traceApi = api;
|
|
650
616
|
resolved = true;
|
|
651
|
-
}
|
|
652
|
-
|
|
617
|
+
}).catch(() => {
|
|
618
|
+
resolved = true;
|
|
619
|
+
});
|
|
620
|
+
return resolvePromise;
|
|
653
621
|
}
|
|
654
622
|
return (entry, next) => {
|
|
623
|
+
ensureResolved().catch(() => {
|
|
624
|
+
});
|
|
655
625
|
if (resolved && traceApi?.trace) {
|
|
656
626
|
try {
|
|
657
627
|
const activeSpan = traceApi.trace.getActiveSpan?.();
|
|
@@ -1705,42 +1675,39 @@ function webhookTransport(options) {
|
|
|
1705
1675
|
}
|
|
1706
1676
|
};
|
|
1707
1677
|
}
|
|
1708
|
-
|
|
1709
1678
|
export {
|
|
1710
1679
|
LogLevel,
|
|
1711
1680
|
LogLevelNameMap,
|
|
1712
1681
|
LogLevelValueMap,
|
|
1713
|
-
resolveLevel,
|
|
1714
|
-
shouldLog,
|
|
1715
|
-
shouldIncludeStack,
|
|
1716
|
-
createLogger,
|
|
1717
1682
|
aiEnrichmentMiddleware,
|
|
1718
|
-
createOpenAiErrorAnalyzer,
|
|
1719
1683
|
alertMiddleware,
|
|
1720
|
-
createMiddleware,
|
|
1721
|
-
deduplicationMiddleware,
|
|
1722
|
-
heapUsageMiddleware,
|
|
1723
|
-
nodeHttpMappers,
|
|
1724
|
-
createHttpLogger,
|
|
1725
|
-
ipMiddleware,
|
|
1726
|
-
levelOverrideMiddleware,
|
|
1727
|
-
ocppMiddleware,
|
|
1728
|
-
otelTraceMiddleware,
|
|
1729
|
-
redactionMiddleware,
|
|
1730
|
-
samplingMiddleware,
|
|
1731
|
-
userAgentMiddleware,
|
|
1732
1684
|
batchTransport,
|
|
1733
1685
|
browserJsonStreamTransport,
|
|
1734
1686
|
consoleTransport,
|
|
1687
|
+
createHttpLogger,
|
|
1688
|
+
createLogger,
|
|
1689
|
+
createMiddleware,
|
|
1690
|
+
createOpenAiErrorAnalyzer,
|
|
1735
1691
|
createTransport,
|
|
1736
1692
|
datadogTransport,
|
|
1693
|
+
deduplicationMiddleware,
|
|
1737
1694
|
discordTransport,
|
|
1695
|
+
heapUsageMiddleware,
|
|
1696
|
+
ipMiddleware,
|
|
1697
|
+
levelOverrideMiddleware,
|
|
1738
1698
|
lokiTransport,
|
|
1699
|
+
ocppMiddleware,
|
|
1700
|
+
otelTraceMiddleware,
|
|
1739
1701
|
otelTransport,
|
|
1740
1702
|
prettyTransport,
|
|
1703
|
+
redactionMiddleware,
|
|
1704
|
+
resolveLevel,
|
|
1741
1705
|
ringBufferTransport,
|
|
1706
|
+
samplingMiddleware,
|
|
1742
1707
|
sentryTransport,
|
|
1708
|
+
shouldIncludeStack,
|
|
1709
|
+
shouldLog,
|
|
1743
1710
|
slackTransport,
|
|
1711
|
+
userAgentMiddleware,
|
|
1744
1712
|
webhookTransport
|
|
1745
1713
|
};
|
|
1746
|
-
//# sourceMappingURL=chunk-DAFMRCAN.mjs.map
|