evlog 2.19.0 → 2.19.2
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/README.md +14 -16
- package/dist/adapters/axiom.d.mts +3 -3
- package/dist/adapters/axiom.d.mts.map +1 -1
- package/dist/adapters/axiom.mjs +10 -14
- package/dist/adapters/axiom.mjs.map +1 -1
- package/dist/adapters/better-stack.d.mts +2 -2
- package/dist/adapters/better-stack.d.mts.map +1 -1
- package/dist/adapters/better-stack.mjs +9 -13
- package/dist/adapters/better-stack.mjs.map +1 -1
- package/dist/adapters/datadog.d.mts +3 -3
- package/dist/adapters/datadog.mjs +9 -5
- package/dist/adapters/datadog.mjs.map +1 -1
- package/dist/adapters/fs.d.mts +1 -1
- package/dist/adapters/fs.d.mts.map +1 -1
- package/dist/adapters/fs.mjs +14 -1
- package/dist/adapters/fs.mjs.map +1 -1
- package/dist/adapters/hyperdx.d.mts +2 -2
- package/dist/adapters/hyperdx.mjs +3 -3
- package/dist/adapters/hyperdx.mjs.map +1 -1
- package/dist/adapters/memory.d.mts +2 -3
- package/dist/adapters/memory.d.mts.map +1 -1
- package/dist/adapters/memory.mjs +2 -3
- package/dist/adapters/memory.mjs.map +1 -1
- package/dist/adapters/otlp.d.mts +4 -4
- package/dist/adapters/otlp.mjs +17 -9
- package/dist/adapters/otlp.mjs.map +1 -1
- package/dist/adapters/posthog.d.mts +2 -2
- package/dist/adapters/posthog.mjs +5 -5
- package/dist/adapters/posthog.mjs.map +1 -1
- package/dist/adapters/sentry.d.mts +3 -3
- package/dist/adapters/sentry.mjs +5 -5
- package/dist/adapters/sentry.mjs.map +1 -1
- package/dist/ai/index.d.mts +1 -1
- package/dist/{audit-BUAajsPU.d.mts → audit-CBfv3rl1.d.mts} +77 -53
- package/dist/audit-CBfv3rl1.d.mts.map +1 -0
- package/dist/{audit-BFwTUxBJ.mjs → audit-CL0q7GJU.mjs} +37 -110
- package/dist/audit-CL0q7GJU.mjs.map +1 -0
- package/dist/audit-action.d.mts +2 -0
- package/dist/audit-action.mjs +74 -0
- package/dist/audit-action.mjs.map +1 -0
- package/dist/audit.d.mts +2 -0
- package/dist/audit.mjs +3 -0
- package/dist/better-auth/index.d.mts +1 -1
- package/dist/browser.d.mts +1 -1
- package/dist/{index-CE7kH0II.d.mts → catalog-CyemiLYG.d.mts} +4 -3
- package/dist/catalog-CyemiLYG.d.mts.map +1 -0
- package/dist/catalog.d.mts +2 -0
- package/dist/catalog.mjs +205 -0
- package/dist/catalog.mjs.map +1 -0
- package/dist/deferred-drain-jeajC8QF.mjs +36 -0
- package/dist/deferred-drain-jeajC8QF.mjs.map +1 -0
- package/dist/{define-DGwZkZ7x.d.mts → define-BuDJpV2b.d.mts} +3 -3
- package/dist/{define-DGwZkZ7x.d.mts.map → define-BuDJpV2b.d.mts.map} +1 -1
- package/dist/{drain-D_fy7m0n.mjs → drain-6lV-g7JB.mjs} +34 -3
- package/dist/drain-6lV-g7JB.mjs.map +1 -0
- package/dist/elysia/index.d.mts +4 -4
- package/dist/elysia/index.d.mts.map +1 -1
- package/dist/elysia/index.mjs +2 -2
- package/dist/elysia/index.mjs.map +1 -1
- package/dist/enrich-error-stack-next.node-BecxSKUc.mjs +120 -0
- package/dist/enrich-error-stack-next.node-BecxSKUc.mjs.map +1 -0
- package/dist/{enricher-CuMbbdqp.d.mts → enricher-VdBVX4oT.d.mts} +2 -2
- package/dist/{enricher-CuMbbdqp.d.mts.map → enricher-VdBVX4oT.d.mts.map} +1 -1
- package/dist/enrichers.d.mts +2 -2
- package/dist/{error-DwajXSKM.d.mts → error-CPCM5a1D.d.mts} +2 -2
- package/dist/{error-DwajXSKM.d.mts.map → error-CPCM5a1D.d.mts.map} +1 -1
- package/dist/error.d.mts +1 -1
- package/dist/{errors-CAq8pYpW.d.mts → errors-ZdY6Ohi6.d.mts} +2 -2
- package/dist/{errors-CAq8pYpW.d.mts.map → errors-ZdY6Ohi6.d.mts.map} +1 -1
- package/dist/express/index.d.mts +4 -4
- package/dist/express/index.d.mts.map +1 -1
- package/dist/express/index.mjs +3 -3
- package/dist/express/index.mjs.map +1 -1
- package/dist/fastify/index.d.mts +4 -4
- package/dist/fastify/index.d.mts.map +1 -1
- package/dist/fastify/index.mjs +4 -2
- package/dist/fastify/index.mjs.map +1 -1
- package/dist/{fork-CYm453dq.mjs → fork-Di44utlp.mjs} +2 -2
- package/dist/fork-Di44utlp.mjs.map +1 -0
- package/dist/hono/index.d.mts +3 -3
- package/dist/hono/index.d.mts.map +1 -1
- package/dist/hono/index.mjs +3 -6
- package/dist/hono/index.mjs.map +1 -1
- package/dist/{http-Bept5EIC.mjs → http-DA3RWQrm.mjs} +2 -2
- package/dist/{http-Bept5EIC.mjs.map → http-DA3RWQrm.mjs.map} +1 -1
- package/dist/http.d.mts +1 -1
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +3 -203
- package/dist/instrumentation-create-STGmQGQt.d.mts +115 -0
- package/dist/instrumentation-create-STGmQGQt.d.mts.map +1 -0
- package/dist/{integration-CR601uyW.mjs → integration-2PpI-bCm.mjs} +2 -2
- package/dist/{integration-CR601uyW.mjs.map → integration-2PpI-bCm.mjs.map} +1 -1
- package/dist/{logger-BccCJUyD.d.mts → logger-DWTPZ0c1.d.mts} +7 -3
- package/dist/logger-DWTPZ0c1.d.mts.map +1 -0
- package/dist/logger.d.mts +2 -2
- package/dist/logger.mjs +1 -1
- package/dist/{middleware-DQ6-h8h0.d.mts → middleware-CjVyGyrG.d.mts} +3 -3
- package/dist/middleware-CjVyGyrG.d.mts.map +1 -0
- package/dist/nestjs/index.d.mts +5 -5
- package/dist/nestjs/index.d.mts.map +1 -1
- package/dist/nestjs/index.mjs +3 -3
- package/dist/nestjs/index.mjs.map +1 -1
- package/dist/next/client.d.mts +1 -1
- package/dist/next/index.d.mts +5 -5
- package/dist/next/index.d.mts.map +1 -1
- package/dist/next/index.mjs +16 -3
- package/dist/next/index.mjs.map +1 -1
- package/dist/next/instrumentation/create.d.mts +2 -0
- package/dist/next/instrumentation/create.mjs +157 -0
- package/dist/next/instrumentation/create.mjs.map +1 -0
- package/dist/next/instrumentation.d.mts +2 -77
- package/dist/next/instrumentation.mjs +32 -81
- package/dist/next/instrumentation.mjs.map +1 -1
- package/dist/next/stream.d.mts +1 -1
- package/dist/next/stream.mjs +2 -2
- package/dist/next/stream.mjs.map +1 -1
- package/dist/nitro/errorHandler.mjs +23 -7
- package/dist/nitro/errorHandler.mjs.map +1 -1
- package/dist/nitro/module.d.mts +2 -2
- package/dist/nitro/module.mjs +1 -1
- package/dist/nitro/plugin.mjs +89 -4
- package/dist/nitro/plugin.mjs.map +1 -1
- package/dist/nitro/v3/errorHandler.d.mts +0 -10
- package/dist/nitro/v3/errorHandler.mjs +13 -3
- package/dist/nitro/v3/errorHandler.mjs.map +1 -1
- package/dist/nitro/v3/index.d.mts +2 -2
- package/dist/nitro/v3/module.d.mts +1 -1
- package/dist/nitro/v3/module.mjs +1 -1
- package/dist/nitro/v3/plugin.mjs +4 -4
- package/dist/nitro/v3/plugin.mjs.map +1 -1
- package/dist/nitro/v3/useLogger.d.mts +2 -2
- package/dist/nitro/v3/useLogger.d.mts.map +1 -1
- package/dist/nitro/v3/useLogger.mjs.map +1 -1
- package/dist/{nitro-zCXTylj4.d.mts → nitro--E4op34w.d.mts} +2 -2
- package/dist/{nitro-zCXTylj4.d.mts.map → nitro--E4op34w.d.mts.map} +1 -1
- package/dist/{nitro-ClRZLD1g.mjs → nitro-ClHmVj1H.mjs} +29 -2
- package/dist/nitro-ClHmVj1H.mjs.map +1 -0
- package/dist/{nodeResponse-CIEEbrNE.mjs → nodeResponse-DKrYWrxk.mjs} +1 -1
- package/dist/{nodeResponse-CIEEbrNE.mjs.map → nodeResponse-DKrYWrxk.mjs.map} +1 -1
- package/dist/nuxt/module.d.mts +1 -1
- package/dist/nuxt/module.mjs +3 -3
- package/dist/orpc/index.d.mts +4 -4
- package/dist/orpc/index.d.mts.map +1 -1
- package/dist/orpc/index.mjs +2 -2
- package/dist/orpc/index.mjs.map +1 -1
- package/dist/{package-CUhII9DA.mjs → package-Bgs0VSDF.mjs} +2 -2
- package/dist/package-Bgs0VSDF.mjs.map +1 -0
- package/dist/{parseError-Cagr-Ctc.d.mts → parseError-BwBg-iW4.d.mts} +2 -2
- package/dist/parseError-BwBg-iW4.d.mts.map +1 -0
- package/dist/pipeline.d.mts +0 -19
- package/dist/pipeline.d.mts.map +1 -1
- package/dist/pipeline.mjs +12 -0
- package/dist/pipeline.mjs.map +1 -1
- package/dist/{pretty-error-CVVgwlTn.mjs → pretty-error-THg0U0w9.mjs} +37 -27
- package/dist/pretty-error-THg0U0w9.mjs.map +1 -0
- package/dist/{pretty-error-snippet.node-c_bzjg7g.mjs → pretty-error-snippet.node-itfCajBM.mjs} +3 -2
- package/dist/{pretty-error-snippet.node-c_bzjg7g.mjs.map → pretty-error-snippet.node-itfCajBM.mjs.map} +1 -1
- package/dist/react-router/index.d.mts +4 -4
- package/dist/react-router/index.d.mts.map +1 -1
- package/dist/react-router/index.mjs +2 -2
- package/dist/react-router/index.mjs.map +1 -1
- package/dist/register-disk-snippet-B_JyhodL.mjs +21 -0
- package/dist/register-disk-snippet-B_JyhodL.mjs.map +1 -0
- package/dist/runtime/client/log.d.mts +1 -1
- package/dist/runtime/server/routes/_evlog/ingest.post.d.mts +7 -0
- package/dist/runtime/server/routes/_evlog/ingest.post.mjs +39 -3
- package/dist/runtime/server/routes/_evlog/ingest.post.mjs.map +1 -1
- package/dist/runtime/server/useLogger.d.mts +1 -1
- package/dist/runtime/server/useLogger.mjs.map +1 -1
- package/dist/runtime/utils/parseError.d.mts +2 -2
- package/dist/{source-location-xkDGiERl.mjs → source-location-CHOPF2nd.mjs} +2 -1
- package/dist/{source-location-xkDGiERl.mjs.map → source-location-CHOPF2nd.mjs.map} +1 -1
- package/dist/{storage-7X37OToT.mjs → storage-D4sBVffQ.mjs} +1 -1
- package/dist/storage-D4sBVffQ.mjs.map +1 -0
- package/dist/stream.d.mts +1 -1
- package/dist/stream.mjs +1 -1
- package/dist/sveltekit/index.d.mts +3 -4
- package/dist/sveltekit/index.d.mts.map +1 -1
- package/dist/sveltekit/index.mjs +5 -3
- package/dist/sveltekit/index.mjs.map +1 -1
- package/dist/toolkit.d.mts +22 -8
- package/dist/toolkit.d.mts.map +1 -1
- package/dist/toolkit.mjs +7 -7
- package/dist/types.d.mts +1 -1
- package/dist/{useLogger-Dv52PDpH.d.mts → useLogger-DiRWGD33.d.mts} +3 -3
- package/dist/useLogger-DiRWGD33.d.mts.map +1 -0
- package/dist/{utils-DmNbZwBZ.d.mts → utils-XPMPENUK.d.mts} +2 -2
- package/dist/{utils-DmNbZwBZ.d.mts.map → utils-XPMPENUK.d.mts.map} +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.mjs +2 -1
- package/dist/utils.mjs.map +1 -1
- package/dist/vite/index.d.mts +1 -1
- package/dist/vite/index.mjs +1 -1
- package/dist/workers.d.mts +3 -3
- package/dist/workers.d.mts.map +1 -1
- package/dist/workers.mjs +1 -1
- package/dist/workers.mjs.map +1 -1
- package/package.json +20 -1
- package/dist/audit-BFwTUxBJ.mjs.map +0 -1
- package/dist/audit-BUAajsPU.d.mts.map +0 -1
- package/dist/drain-D_fy7m0n.mjs.map +0 -1
- package/dist/enrich-drain-CG_2Nix-.mjs +0 -122
- package/dist/enrich-drain-CG_2Nix-.mjs.map +0 -1
- package/dist/fork-CYm453dq.mjs.map +0 -1
- package/dist/index-CE7kH0II.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/logger-BccCJUyD.d.mts.map +0 -1
- package/dist/middleware-DQ6-h8h0.d.mts.map +0 -1
- package/dist/next/instrumentation.d.mts.map +0 -1
- package/dist/nitro-ClRZLD1g.mjs.map +0 -1
- package/dist/package-CUhII9DA.mjs.map +0 -1
- package/dist/parseError-Cagr-Ctc.d.mts.map +0 -1
- package/dist/pretty-error-CVVgwlTn.mjs.map +0 -1
- package/dist/storage-7X37OToT.mjs.map +0 -1
- package/dist/useLogger-Dv52PDpH.d.mts.map +0 -1
|
@@ -244,6 +244,13 @@ interface RedactConfig {
|
|
|
244
244
|
replacement?: string;
|
|
245
245
|
/** @internal Resolved masker functions from built-in patterns. Not user-facing. */
|
|
246
246
|
_maskers?: Array<[RegExp, (match: string) => string]>;
|
|
247
|
+
/** @internal Precompiled matchers for `paths`, built once by `resolveRedactConfig`. Not user-facing. */
|
|
248
|
+
_pathMatchers?: {
|
|
249
|
+
exactPaths: Set<string>;
|
|
250
|
+
pathGlobs: RegExp[];
|
|
251
|
+
keyGlobs: RegExp[];
|
|
252
|
+
caseInsensitiveLeaves: Set<string>;
|
|
253
|
+
};
|
|
247
254
|
}
|
|
248
255
|
/**
|
|
249
256
|
* Sampling rates per log level (0-100 percentage)
|
|
@@ -823,6 +830,9 @@ interface RequestLogger<T extends object = Record<string, unknown>> {
|
|
|
823
830
|
* Available on every logger returned by `createLogger()` / `createRequestLogger()`
|
|
824
831
|
* and on framework loggers exposed via `useLogger()` / `c.get('log')` etc.
|
|
825
832
|
*
|
|
833
|
+
* Optional on the base {@link RequestLogger} interface for structural typing;
|
|
834
|
+
* always present (required) on {@link import('./audit').AuditableLogger}.
|
|
835
|
+
*
|
|
826
836
|
* @example
|
|
827
837
|
* ```ts
|
|
828
838
|
* log.audit({
|
|
@@ -982,7 +992,7 @@ interface RequestLoggerOptions {
|
|
|
982
992
|
* H3 event context with evlog logger attached
|
|
983
993
|
*/
|
|
984
994
|
interface H3EventContext {
|
|
985
|
-
log?:
|
|
995
|
+
log?: AuditableLogger;
|
|
986
996
|
requestId?: string;
|
|
987
997
|
status?: number;
|
|
988
998
|
/** Internal: start time for duration calculation in tail sampling */
|
|
@@ -1036,12 +1046,7 @@ interface ParsedError {
|
|
|
1036
1046
|
raw: unknown;
|
|
1037
1047
|
}
|
|
1038
1048
|
//#endregion
|
|
1039
|
-
//#region src/audit.d.ts
|
|
1040
|
-
/**
|
|
1041
|
-
* Current version of the audit envelope. Bumped when `AuditFields` evolves
|
|
1042
|
-
* in a backward-incompatible way so downstream pipelines can branch on it.
|
|
1043
|
-
*/
|
|
1044
|
-
declare const AUDIT_SCHEMA_VERSION = 1;
|
|
1049
|
+
//#region src/audit-action.d.ts
|
|
1045
1050
|
/**
|
|
1046
1051
|
* Input accepted by `log.audit()`, `audit()`, and `withAudit()`.
|
|
1047
1052
|
*
|
|
@@ -1060,6 +1065,57 @@ interface AuditInput {
|
|
|
1060
1065
|
correlationId?: string;
|
|
1061
1066
|
version?: number;
|
|
1062
1067
|
}
|
|
1068
|
+
/** Options for {@link defineAuditAction}. Same shape as {@link AuditActionDefinition}. */
|
|
1069
|
+
type DefineAuditActionOptions = AuditActionDefinition;
|
|
1070
|
+
/**
|
|
1071
|
+
* Define a typed audit action with optional fixed target type and catalog metadata.
|
|
1072
|
+
*
|
|
1073
|
+
* Returns a curried helper that fills in the action name (and target shape
|
|
1074
|
+
* if provided) so call sites stay terse and the action set is discoverable
|
|
1075
|
+
* in one place. Metadata (`description`, `severity`, `requiresChanges`, …)
|
|
1076
|
+
* is exposed on the factory for introspection, docs, and review tooling.
|
|
1077
|
+
*
|
|
1078
|
+
* @example
|
|
1079
|
+
* ```ts
|
|
1080
|
+
* const refund = defineAuditAction('invoice.refund', {
|
|
1081
|
+
* target: 'invoice',
|
|
1082
|
+
* severity: 'high',
|
|
1083
|
+
* requiresChanges: true,
|
|
1084
|
+
* redactPaths: ['cardNumber'],
|
|
1085
|
+
* })
|
|
1086
|
+
*
|
|
1087
|
+
* log.audit(refund({
|
|
1088
|
+
* actor: { type: 'user', id: user.id },
|
|
1089
|
+
* target: { id: 'inv_889' }, // type inferred as 'invoice'
|
|
1090
|
+
* outcome: 'success',
|
|
1091
|
+
* }))
|
|
1092
|
+
* ```
|
|
1093
|
+
*/
|
|
1094
|
+
declare function defineAuditAction<const TAction extends string, const TOptions extends DefineAuditActionOptions = DefineAuditActionOptions>(action: TAction, options?: TOptions): DefinedAuditAction<TAction, TOptions>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Return type of {@link defineAuditAction}. Accepts a partial input (no
|
|
1097
|
+
* `action`, target type pre-filled when provided).
|
|
1098
|
+
*/
|
|
1099
|
+
type DefinedAuditAction<TAction extends string = string, TOptions extends DefineAuditActionOptions = DefineAuditActionOptions> = ((input: TOptions['target'] extends string ? Omit<AuditInput, 'action' | 'target'> & {
|
|
1100
|
+
target?: Omit<AuditTarget, 'type'> & {
|
|
1101
|
+
type?: TOptions['target'];
|
|
1102
|
+
};
|
|
1103
|
+
} : Omit<AuditInput, 'action'>) => AuditInput) & {
|
|
1104
|
+
readonly action: TAction;
|
|
1105
|
+
readonly target: TOptions['target'];
|
|
1106
|
+
readonly description: TOptions['description'];
|
|
1107
|
+
readonly severity: TOptions['severity'];
|
|
1108
|
+
readonly requiresChanges: TOptions['requiresChanges'];
|
|
1109
|
+
readonly requiresReason: TOptions['requiresReason'];
|
|
1110
|
+
readonly redactPaths: TOptions['redactPaths'];
|
|
1111
|
+
};
|
|
1112
|
+
//#endregion
|
|
1113
|
+
//#region src/audit.d.ts
|
|
1114
|
+
/**
|
|
1115
|
+
* Current version of the audit envelope. Bumped when `AuditFields` evolves
|
|
1116
|
+
* in a backward-incompatible way so downstream pipelines can branch on it.
|
|
1117
|
+
*/
|
|
1118
|
+
declare const AUDIT_SCHEMA_VERSION = 1;
|
|
1063
1119
|
/**
|
|
1064
1120
|
* Build a normalised {@link AuditFields} from caller input. Defaults:
|
|
1065
1121
|
* - `outcome` → `'success'`
|
|
@@ -1206,50 +1262,6 @@ interface AuditDiffOptions {
|
|
|
1206
1262
|
/** Include the full redacted `after` snapshot alongside the patch. */
|
|
1207
1263
|
includeAfter?: boolean;
|
|
1208
1264
|
}
|
|
1209
|
-
/** Options for {@link defineAuditAction}. Same shape as {@link AuditCatalogEntry}. */
|
|
1210
|
-
type DefineAuditActionOptions = AuditActionDefinition;
|
|
1211
|
-
/**
|
|
1212
|
-
* Define a typed audit action with optional fixed target type and catalog metadata.
|
|
1213
|
-
*
|
|
1214
|
-
* Returns a curried helper that fills in the action name (and target shape
|
|
1215
|
-
* if provided) so call sites stay terse and the action set is discoverable
|
|
1216
|
-
* in one place. Metadata (`description`, `severity`, `requiresChanges`, …)
|
|
1217
|
-
* is exposed on the factory for introspection, docs, and review tooling.
|
|
1218
|
-
*
|
|
1219
|
-
* @example
|
|
1220
|
-
* ```ts
|
|
1221
|
-
* const refund = defineAuditAction('invoice.refund', {
|
|
1222
|
-
* target: 'invoice',
|
|
1223
|
-
* severity: 'high',
|
|
1224
|
-
* requiresChanges: true,
|
|
1225
|
-
* redactPaths: ['cardNumber'],
|
|
1226
|
-
* })
|
|
1227
|
-
*
|
|
1228
|
-
* log.audit(refund({
|
|
1229
|
-
* actor: { type: 'user', id: user.id },
|
|
1230
|
-
* target: { id: 'inv_889' }, // type inferred as 'invoice'
|
|
1231
|
-
* outcome: 'success',
|
|
1232
|
-
* }))
|
|
1233
|
-
* ```
|
|
1234
|
-
*/
|
|
1235
|
-
declare function defineAuditAction<const TAction extends string, const TOptions extends DefineAuditActionOptions = DefineAuditActionOptions>(action: TAction, options?: TOptions): DefinedAuditAction<TAction, TOptions>;
|
|
1236
|
-
/**
|
|
1237
|
-
* Return type of {@link defineAuditAction}. Accepts a partial input (no
|
|
1238
|
-
* `action`, target type pre-filled when provided).
|
|
1239
|
-
*/
|
|
1240
|
-
type DefinedAuditAction<TAction extends string = string, TOptions extends DefineAuditActionOptions = DefineAuditActionOptions> = ((input: TOptions['target'] extends string ? Omit<AuditInput, 'action' | 'target'> & {
|
|
1241
|
-
target?: Omit<AuditTarget, 'type'> & {
|
|
1242
|
-
type?: TOptions['target'];
|
|
1243
|
-
};
|
|
1244
|
-
} : Omit<AuditInput, 'action'>) => AuditInput) & {
|
|
1245
|
-
readonly action: TAction;
|
|
1246
|
-
readonly target: TOptions['target'];
|
|
1247
|
-
readonly description: TOptions['description'];
|
|
1248
|
-
readonly severity: TOptions['severity'];
|
|
1249
|
-
readonly requiresChanges: TOptions['requiresChanges'];
|
|
1250
|
-
readonly requiresReason: TOptions['requiresReason'];
|
|
1251
|
-
readonly redactPaths: TOptions['redactPaths'];
|
|
1252
|
-
};
|
|
1253
1265
|
/**
|
|
1254
1266
|
* Test helper that captures every audit event emitted while it is active.
|
|
1255
1267
|
*
|
|
@@ -1287,6 +1299,18 @@ interface AuditMatcher {
|
|
|
1287
1299
|
actor?: Partial<AuditActor>;
|
|
1288
1300
|
target?: Partial<AuditTarget>;
|
|
1289
1301
|
}
|
|
1302
|
+
/**
|
|
1303
|
+
* @internal Hook used by `RequestLogger.emit()` to detect audit-driven
|
|
1304
|
+
* force-keep flags on the accumulated context. Returns whether the event was
|
|
1305
|
+
* marked by `log.audit()` and clears the flag.
|
|
1306
|
+
*/
|
|
1307
|
+
declare function consumeAuditForceKeep(context: Record<string, unknown>): boolean;
|
|
1308
|
+
/**
|
|
1309
|
+
* @internal Decorate the audit field on an event right before drain — fills
|
|
1310
|
+
* in the deterministic idempotency key. Called by the logger pipeline so
|
|
1311
|
+
* it works for both `log.audit()` and direct `log.set({ audit })` paths.
|
|
1312
|
+
*/
|
|
1313
|
+
declare function finalizeAudit(event: WideEvent): void;
|
|
1290
1314
|
/** Shape of the optional better-auth bridge for the audit enricher. */
|
|
1291
1315
|
interface AuditEnricherBetterAuthBridge {
|
|
1292
1316
|
/** Read the current authenticated session for this request, if any. */
|
|
@@ -1421,5 +1445,5 @@ declare function signed(drain: DrainFn, options: SignedOptions): DrainFn;
|
|
|
1421
1445
|
*/
|
|
1422
1446
|
declare const auditRedactPreset: RedactConfig;
|
|
1423
1447
|
//#endregion
|
|
1424
|
-
export {
|
|
1425
|
-
//# sourceMappingURL=audit-
|
|
1448
|
+
export { LogLevel as $, DefinedAuditAction as A, AuditTarget as B, finalizeAudit as C, createPluginRunner as Ct, withAuditMethods as D, getEmptyPluginRunner as Dt, withAudit as E, enricherPlugin as Et, AuditChanges as F, EnvironmentContext as G, DeepPartial as H, AuditFields as I, FieldContext as J, ErrorCode as K, AuditLoggerMethod as L, AuditAction as M, AuditActionDefinition as N, AuditInput as O, AuditActor as P, Log as Q, AuditPatchOp as R, consumeAuditForceKeep as S, RequestLifecycleContext as St, signed as T, drainPlugin as Tt, DrainContext as U, BaseWideEvent as V, EnrichContext as W, IngestPayload as X, H3EventContext as Y, InternalFields as Z, auditDiff as _, ClientLogContext as _t, AuditEnricherOptions as a, RequestLogEntry as at, auditRedactPreset as b, PluginSetupContext as bt, AuditOnlyOptions as c, RouteConfig as ct, MockAudit as d, ServerEvent as dt, LoggerConfig as et, SignedChainState as f, TailSamplingCondition as ft, audit as g, DevTerminalInput as gt, WithAuditOptions as h, WideEvent as ht, AuditEnricherBetterAuthBridge as i, RegisteredErrorCatalogs as it, defineAuditAction as j, DefineAuditActionOptions as k, AuditableLogger as l, SamplingConfig as lt, WithAuditContext as m, TransportConfig as mt, AuditDeniedError as n, RedactConfig as nt, AuditMatcher as o, RequestLogger as ot, SignedOptions as p, TailSamplingContext as pt, ErrorOptions as q, AuditDiffOptions as r, RegisteredAuditCatalogs as rt, AuditMethod as s, RequestLoggerOptions as st, AUDIT_SCHEMA_VERSION as t, ParsedError as tt, DrainFn as u, SamplingRates as ut, auditEnricher as v, EvlogPlugin as vt, mockAudit as w, definePlugin as wt, buildAuditFields as x, RequestFinishContext as xt, auditOnly as y, PluginRunner as yt, AuditSeverity as z };
|
|
1449
|
+
//# sourceMappingURL=audit-CBfv3rl1.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-CBfv3rl1.d.mts","names":[],"sources":["../src/shared/plugin.ts","../src/shared/dev-terminal.ts","../src/types.ts","../src/audit-action.ts","../src/audit.ts"],"mappings":";AAGA;AAAA,UAAiB,kBAAA;EACf,GAAA,EAAK,kBAAA;AAAA;;UAIU,uBAAA;EACf,MAAA,EAAQ,aAAA;EACR,OAAA;IACE,MAAA;IACA,IAAA;IACA,SAAA;EAAA;EAFA;EAKF,OAAA,GAAU,MA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;;;;;AJ1O/C;iBIwPgB,aAAA,CAAc,KAAA,EAAO,SAAA;;UASpB,6BAAA;EJjQmC;EImQlD,UAAA,GAAa,GAAA,EAAK,aAAA,KAAkB,OAAA,CAAQ,UAAA,uBAAiC,UAAA;AAAA;;UAI9D,oBAAA;EHhfY;;;;EGqf3B,QAAA,IAAY,GAAA,EAAK,aAAA;EHlfa;;;;EGuf9B,MAAA,GAAS,6BAAA;EHpf0B;EGsfnC,SAAA;AAAA;;;;;;;;AH3eF;;;;;;;;iBG6fgB,aAAA,CAAc,OAAA,GAAS,oBAAA,IAA6B,GAAA,EAAK,aAAA,YAAyB,OAAA;AHtflG;AAAA,UG8hBiB,gBAAA;;;;;;EAMf,KAAA;AAAA;;KAIU,OAAA,IAAW,GAAA,EAAK,YAAA,YAAwB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BpC,SAAA,CAAU,KAAA,EAAO,OAAA,EAAS,OAAA,GAAS,gBAAA,GAAwB,OAAA;;UAY1D,gBAAA;EFljBY;EEojB3B,IAAA,QAAY,OAAA;EFnjBY;EEqjBxB,IAAA,GAAO,IAAA,aAAiB,OAAA;AAAA;;KAId,aAAA;EACN,QAAA;EAAkB,MAAA;EAAgB,SAAA;AAAA;EAClC,QAAA;EAAwB,KAAA,GAAQ,gBAAA;EAAkB,SAAA;AAAA;;;;;;;;;;AFnjBxD;;;;;;;;;;AAuBA;;;;;;;iBEwjBgB,MAAA,CAAO,KAAA,EAAO,OAAA,EAAS,OAAA,EAAS,aAAA,GAAgB,OAAA;;AF3iBhE;;;;;;;;;;;;;;;cEoqBa,iBAAA,EAAmB,YAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { colors, cssColors, detectEnvironment, escapeFormatString, formatDuration, getConsoleMethod, getCssLevelColor, getLevelColor, globToRegExp, isBrowser, isDev, isLevelEnabled, matchesPattern } from "./utils.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { n as buildErrorEntries, r as compactStackForStorage } from "./pretty-error-THg0U0w9.mjs";
|
|
3
3
|
import { t as resolveDevTerminal } from "./dev-terminal-D4UaEm17.mjs";
|
|
4
4
|
import { EvlogError } from "./error.mjs";
|
|
5
5
|
import { r as getHeader$1 } from "./headers-VtmnWcfn.mjs";
|
|
@@ -46,7 +46,7 @@ function addPathGlobPattern(pattern, exactPaths, pathGlobs, caseInsensitiveLeave
|
|
|
46
46
|
const leaf = pattern.match(/^\*\*\.([^.?*]+)$/);
|
|
47
47
|
if (leaf) {
|
|
48
48
|
exactPaths.add(leaf[1]);
|
|
49
|
-
caseInsensitiveLeaves.add(leaf[1]);
|
|
49
|
+
caseInsensitiveLeaves.add(leaf[1].toLowerCase());
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -55,8 +55,7 @@ function addPathGlobPattern(pattern, exactPaths, pathGlobs, caseInsensitiveLeave
|
|
|
55
55
|
*/
|
|
56
56
|
function matchesRedactPath(fullPath, leafKey, matchers) {
|
|
57
57
|
if (matchers.exactPaths.has(fullPath)) return true;
|
|
58
|
-
|
|
59
|
-
for (const name of matchers.caseInsensitiveLeaves) if (leafLower === name.toLowerCase()) return true;
|
|
58
|
+
if (matchers.caseInsensitiveLeaves.has(leafKey.toLowerCase())) return true;
|
|
60
59
|
for (const glob of matchers.pathGlobs) {
|
|
61
60
|
glob.lastIndex = 0;
|
|
62
61
|
if (glob.test(fullPath)) return true;
|
|
@@ -186,11 +185,15 @@ const builtinPatterns = {
|
|
|
186
185
|
function resolveRedactConfig(input) {
|
|
187
186
|
if (input === void 0 || input === false) return void 0;
|
|
188
187
|
if (input === true) return { _maskers: allBuiltinMaskers() };
|
|
189
|
-
if (input.builtins === false) return
|
|
188
|
+
if (input.builtins === false) return {
|
|
189
|
+
...input,
|
|
190
|
+
_pathMatchers: compileRedactPathMatchers(input.paths)
|
|
191
|
+
};
|
|
190
192
|
const maskers = Array.isArray(input.builtins) ? input.builtins.map((name) => builtinPatterns[name]).filter(Boolean).map((b) => [cloneRegex(b.pattern), b.mask]) : allBuiltinMaskers();
|
|
191
193
|
return {
|
|
192
194
|
...input,
|
|
193
|
-
_maskers: maskers
|
|
195
|
+
_maskers: maskers,
|
|
196
|
+
_pathMatchers: compileRedactPathMatchers(input.paths)
|
|
194
197
|
};
|
|
195
198
|
}
|
|
196
199
|
function allBuiltinMaskers() {
|
|
@@ -244,7 +247,7 @@ function cloneForRedaction(event) {
|
|
|
244
247
|
function redactEvent(event, config) {
|
|
245
248
|
const clone = cloneForRedaction(event);
|
|
246
249
|
const replacement = config.replacement ?? DEFAULT_REPLACEMENT;
|
|
247
|
-
const pathMatchers = compileRedactPathMatchers(config.paths);
|
|
250
|
+
const pathMatchers = config._pathMatchers ?? compileRedactPathMatchers(config.paths);
|
|
248
251
|
if (pathMatchers) redactPathsInTree(clone, pathMatchers, replacement);
|
|
249
252
|
if (config._maskers?.length) applyMaskersToTree(clone, config._maskers);
|
|
250
253
|
if (config.patterns?.length) redactPatterns(clone, config.patterns, replacement);
|
|
@@ -268,10 +271,7 @@ function redactPatterns(obj, patterns, replacement) {
|
|
|
268
271
|
}
|
|
269
272
|
function applyPatterns(value, patterns, replacement) {
|
|
270
273
|
let result = value;
|
|
271
|
-
for (const pattern of patterns)
|
|
272
|
-
pattern.lastIndex = 0;
|
|
273
|
-
result = result.replace(pattern, replacement);
|
|
274
|
-
}
|
|
274
|
+
for (const pattern of patterns) result = result.replace(pattern, replacement);
|
|
275
275
|
return result;
|
|
276
276
|
}
|
|
277
277
|
function applyMaskersToTree(obj, maskers) {
|
|
@@ -292,10 +292,7 @@ function applyMaskersToTree(obj, maskers) {
|
|
|
292
292
|
}
|
|
293
293
|
function applyMaskers(value, maskers) {
|
|
294
294
|
let result = value;
|
|
295
|
-
for (const [pattern, mask] of maskers)
|
|
296
|
-
pattern.lastIndex = 0;
|
|
297
|
-
result = result.replace(pattern, mask);
|
|
298
|
-
}
|
|
295
|
+
for (const [pattern, mask] of maskers) result = result.replace(pattern, mask);
|
|
299
296
|
return result;
|
|
300
297
|
}
|
|
301
298
|
/**
|
|
@@ -465,6 +462,10 @@ function getEmptyPluginRunner() {
|
|
|
465
462
|
}
|
|
466
463
|
//#endregion
|
|
467
464
|
//#region src/logger.ts
|
|
465
|
+
const nativeStdoutWrite = typeof process !== "undefined" && typeof process.stdout?.write === "function" ? process.stdout.write.bind(process.stdout) : void 0;
|
|
466
|
+
function writePrettyStdout(text) {
|
|
467
|
+
(globalThis.__evlogNativeStdoutWrite ?? nativeStdoutWrite)?.(text);
|
|
468
|
+
}
|
|
468
469
|
function isPlainObject$1(val) {
|
|
469
470
|
return val !== null && typeof val === "object" && !Array.isArray(val);
|
|
470
471
|
}
|
|
@@ -549,11 +550,6 @@ function initLogger(config = {}) {
|
|
|
549
550
|
globalMinLevel = config.minLevel ?? "debug";
|
|
550
551
|
globalPluginRunner = config.plugins?.length ? createPluginRunner(config.plugins) : getEmptyPluginRunner();
|
|
551
552
|
if (globalPluginRunner.plugins.length > 0) globalPluginRunner.runSetup({ env: { ...globalEnv } });
|
|
552
|
-
if (!isBrowser() && typeof process !== "undefined" && process.versions?.node) import("./pretty-error-snippet.node-c_bzjg7g.mjs").then((n) => n.t).then((mod) => {
|
|
553
|
-
registerPrettyErrorSnippetReader(mod.readCodeSnippetFromDisk);
|
|
554
|
-
}).catch(() => {
|
|
555
|
-
registerPrettyErrorSnippetReader(null);
|
|
556
|
-
});
|
|
557
553
|
const hasAnyDrain = !!globalDrain || globalPluginRunner.hasDrain;
|
|
558
554
|
if (globalSilent && !hasAnyDrain && !config._suppressDrainWarning) console.warn("[evlog] silent mode is enabled but no drain is configured. Events will be built and sampled but not output anywhere. Set a drain via initLogger({ drain }) or a framework hook (evlog:drain).");
|
|
559
555
|
}
|
|
@@ -883,8 +879,8 @@ function buildAIEntries(ai) {
|
|
|
883
879
|
function flushPrettyLines(lines) {
|
|
884
880
|
if (lines.length === 0) return;
|
|
885
881
|
const text = `${lines.join("\n")}\n`;
|
|
886
|
-
if (
|
|
887
|
-
|
|
882
|
+
if (nativeStdoutWrite && !isBrowser() && process.env.VITEST !== "true") {
|
|
883
|
+
writePrettyStdout(text);
|
|
888
884
|
return;
|
|
889
885
|
}
|
|
890
886
|
console.log(lines.join("\n"));
|
|
@@ -1104,7 +1100,7 @@ function createLogger(initialContext = {}, internalOptions) {
|
|
|
1104
1100
|
const errorObj = {
|
|
1105
1101
|
name: err.name,
|
|
1106
1102
|
message: err.message,
|
|
1107
|
-
stack: err.stack
|
|
1103
|
+
stack: isDev() ? compactStackForStorage(err.stack) : err.stack
|
|
1108
1104
|
};
|
|
1109
1105
|
const errRecord = err;
|
|
1110
1106
|
for (const k of [
|
|
@@ -1254,11 +1250,14 @@ function isPlainObject(value) {
|
|
|
1254
1250
|
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
|
1255
1251
|
return Object.getPrototypeOf(value) === Object.prototype || value.constructor === Object;
|
|
1256
1252
|
}
|
|
1257
|
-
function stableStringify(value) {
|
|
1253
|
+
function stableStringify(value, ancestors = /* @__PURE__ */ new WeakSet()) {
|
|
1258
1254
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
1259
|
-
if (
|
|
1260
|
-
if (!isPlainObject(value)) return JSON.stringify(value);
|
|
1261
|
-
|
|
1255
|
+
if (ancestors.has(value)) return "\"[Circular]\"";
|
|
1256
|
+
if (!Array.isArray(value) && !isPlainObject(value)) return JSON.stringify(value);
|
|
1257
|
+
ancestors.add(value);
|
|
1258
|
+
const out = Array.isArray(value) ? `[${value.map((v) => stableStringify(v, ancestors)).join(",")}]` : `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${stableStringify(value[k], ancestors)}`).join(",")}}`;
|
|
1259
|
+
ancestors.delete(value);
|
|
1260
|
+
return out;
|
|
1262
1261
|
}
|
|
1263
1262
|
/**
|
|
1264
1263
|
* @internal Sync, isomorphic 32-bit FNV-1a. Used to derive the idempotency
|
|
@@ -1538,75 +1537,6 @@ function auditDiff(before, after, options = {}) {
|
|
|
1538
1537
|
return result;
|
|
1539
1538
|
}
|
|
1540
1539
|
/**
|
|
1541
|
-
* Define a typed audit action with optional fixed target type and catalog metadata.
|
|
1542
|
-
*
|
|
1543
|
-
* Returns a curried helper that fills in the action name (and target shape
|
|
1544
|
-
* if provided) so call sites stay terse and the action set is discoverable
|
|
1545
|
-
* in one place. Metadata (`description`, `severity`, `requiresChanges`, …)
|
|
1546
|
-
* is exposed on the factory for introspection, docs, and review tooling.
|
|
1547
|
-
*
|
|
1548
|
-
* @example
|
|
1549
|
-
* ```ts
|
|
1550
|
-
* const refund = defineAuditAction('invoice.refund', {
|
|
1551
|
-
* target: 'invoice',
|
|
1552
|
-
* severity: 'high',
|
|
1553
|
-
* requiresChanges: true,
|
|
1554
|
-
* redactPaths: ['cardNumber'],
|
|
1555
|
-
* })
|
|
1556
|
-
*
|
|
1557
|
-
* log.audit(refund({
|
|
1558
|
-
* actor: { type: 'user', id: user.id },
|
|
1559
|
-
* target: { id: 'inv_889' }, // type inferred as 'invoice'
|
|
1560
|
-
* outcome: 'success',
|
|
1561
|
-
* }))
|
|
1562
|
-
* ```
|
|
1563
|
-
*/
|
|
1564
|
-
function defineAuditAction(action, options) {
|
|
1565
|
-
const targetType = options?.target;
|
|
1566
|
-
const factory = ((input) => {
|
|
1567
|
-
const merged = {
|
|
1568
|
-
...input,
|
|
1569
|
-
action
|
|
1570
|
-
};
|
|
1571
|
-
if (targetType && input.target && !input.target.type) merged.target = {
|
|
1572
|
-
...input.target,
|
|
1573
|
-
type: targetType
|
|
1574
|
-
};
|
|
1575
|
-
return merged;
|
|
1576
|
-
});
|
|
1577
|
-
Object.defineProperties(factory, {
|
|
1578
|
-
action: {
|
|
1579
|
-
value: action,
|
|
1580
|
-
enumerable: true
|
|
1581
|
-
},
|
|
1582
|
-
target: {
|
|
1583
|
-
value: options?.target,
|
|
1584
|
-
enumerable: true
|
|
1585
|
-
},
|
|
1586
|
-
description: {
|
|
1587
|
-
value: options?.description,
|
|
1588
|
-
enumerable: true
|
|
1589
|
-
},
|
|
1590
|
-
severity: {
|
|
1591
|
-
value: options?.severity,
|
|
1592
|
-
enumerable: true
|
|
1593
|
-
},
|
|
1594
|
-
requiresChanges: {
|
|
1595
|
-
value: options?.requiresChanges,
|
|
1596
|
-
enumerable: true
|
|
1597
|
-
},
|
|
1598
|
-
requiresReason: {
|
|
1599
|
-
value: options?.requiresReason,
|
|
1600
|
-
enumerable: true
|
|
1601
|
-
},
|
|
1602
|
-
redactPaths: {
|
|
1603
|
-
value: options?.redactPaths,
|
|
1604
|
-
enumerable: true
|
|
1605
|
-
}
|
|
1606
|
-
});
|
|
1607
|
-
return factory;
|
|
1608
|
-
}
|
|
1609
|
-
/**
|
|
1610
1540
|
* Test helper that captures every audit event emitted while it is active.
|
|
1611
1541
|
*
|
|
1612
1542
|
* Returns `{ events, restore, toIncludeAuditOf, assertAudit }`:
|
|
@@ -1858,17 +1788,14 @@ function signed(drain, options) {
|
|
|
1858
1788
|
}
|
|
1859
1789
|
/**
|
|
1860
1790
|
* @internal Resolve the Web Crypto SubtleCrypto interface. Available natively
|
|
1861
|
-
* in browsers, Node 19+, Bun, Deno,
|
|
1862
|
-
*
|
|
1863
|
-
*
|
|
1791
|
+
* in browsers, Node 19+, Bun, Deno, Cloudflare Workers, and Convex. Requires
|
|
1792
|
+
* `globalThis.crypto.subtle` — no `node:crypto` fallback so non-Node bundlers
|
|
1793
|
+
* can import the main entrypoint without resolving Node built-ins (#387).
|
|
1864
1794
|
*/
|
|
1865
|
-
|
|
1866
|
-
const
|
|
1867
|
-
if (
|
|
1868
|
-
|
|
1869
|
-
/* @vite-ignore */
|
|
1870
|
-
"node:crypto"
|
|
1871
|
-
)).webcrypto.subtle;
|
|
1795
|
+
function getSubtle() {
|
|
1796
|
+
const subtle = globalThis.crypto?.subtle;
|
|
1797
|
+
if (subtle) return subtle;
|
|
1798
|
+
throw new Error("[evlog/audit] Web Crypto is not available. signed() requires globalThis.crypto.subtle (Node 19+, modern browsers, Cloudflare Workers, Convex, Bun, Deno).");
|
|
1872
1799
|
}
|
|
1873
1800
|
function normalizeAlgo(algorithm) {
|
|
1874
1801
|
switch (algorithm.toLowerCase()) {
|
|
@@ -1889,10 +1816,10 @@ function bufToHex(buf) {
|
|
|
1889
1816
|
return out;
|
|
1890
1817
|
}
|
|
1891
1818
|
async function digestHex(algorithm, data) {
|
|
1892
|
-
return bufToHex(await
|
|
1819
|
+
return bufToHex(await getSubtle().digest(normalizeAlgo(algorithm), new TextEncoder().encode(data)));
|
|
1893
1820
|
}
|
|
1894
1821
|
async function hmacHex(algorithm, secret, data) {
|
|
1895
|
-
const subtle =
|
|
1822
|
+
const subtle = getSubtle();
|
|
1896
1823
|
const hash = normalizeAlgo(algorithm);
|
|
1897
1824
|
const key = await subtle.importKey("raw", new TextEncoder().encode(secret), {
|
|
1898
1825
|
name: "HMAC",
|
|
@@ -1942,6 +1869,6 @@ const auditRedactPreset = { paths: [
|
|
|
1942
1869
|
"set-cookie"
|
|
1943
1870
|
] };
|
|
1944
1871
|
//#endregion
|
|
1945
|
-
export {
|
|
1872
|
+
export { drainPlugin as A, isLoggerLocked as C, shouldKeep as D, mergeInto as E, redactEvent as F, resolveRedactConfig as I, getEmptyPluginRunner as M, isGloballyRedacted as N, createPluginRunner as O, normalizeRedactConfig as P, isEnabled as S, markWideEventDrainStarted as T, createRequestLogger as _, auditEnricher as a, getGlobalPluginRunner as b, buildAuditFields as c, mockAudit as d, signed as f, createLogger as g, _log as h, auditDiff as i, enricherPlugin as j, definePlugin as k, consumeAuditForceKeep as l, withAuditMethods as m, AuditDeniedError as n, auditOnly as o, withAudit as p, audit as r, auditRedactPreset as s, AUDIT_SCHEMA_VERSION as t, finalizeAudit as u, getEnvironment as v, lockLogger as w, initLogger as x, getGlobalDrain as y };
|
|
1946
1873
|
|
|
1947
|
-
//# sourceMappingURL=audit-
|
|
1874
|
+
//# sourceMappingURL=audit-CL0q7GJU.mjs.map
|