logixia 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{async-context-CoPhbRG0.js → async-context-BqjwNzgS.js} +2 -2
- package/dist/{async-context-CoPhbRG0.js.map → async-context-BqjwNzgS.js.map} +1 -1
- package/dist/{async-context-1YMPGgJZ.mjs → async-context-DJdxbbCU.mjs} +2 -2
- package/dist/{async-context-1YMPGgJZ.mjs.map → async-context-DJdxbbCU.mjs.map} +1 -1
- package/dist/{azure-monitor.transport-C5VjvREZ.d.mts → azure-monitor.transport-BZDaQjy8.d.mts} +2 -2
- package/dist/{azure-monitor.transport-C5VjvREZ.d.mts.map → azure-monitor.transport-BZDaQjy8.d.mts.map} +1 -1
- package/dist/{azure-monitor.transport-CyHDjHS-.d.ts → azure-monitor.transport-MDigkKsS.d.ts} +2 -2
- package/dist/{azure-monitor.transport-CyHDjHS-.d.ts.map → azure-monitor.transport-MDigkKsS.d.ts.map} +1 -1
- package/dist/azure.d.mts +1 -1
- package/dist/azure.d.ts +1 -1
- package/dist/{builder-Ck1tsC5d.js → builder-CC48eDJ3.js} +5 -5
- package/dist/builder-CC48eDJ3.js.map +1 -0
- package/dist/{builder-CbttbixM.mjs → builder-CoisL7S7.mjs} +5 -5
- package/dist/builder-CoisL7S7.mjs.map +1 -0
- package/dist/cloudwatch.d.mts +1 -1
- package/dist/cloudwatch.d.ts +1 -1
- package/dist/{cloudwatch.transport-_hS7Mcc5.d.mts → cloudwatch.transport-CqXAGHPH.d.mts} +2 -2
- package/dist/{cloudwatch.transport-_hS7Mcc5.d.mts.map → cloudwatch.transport-CqXAGHPH.d.mts.map} +1 -1
- package/dist/{cloudwatch.transport-DdSjUWvu.d.ts → cloudwatch.transport-pY96iAfO.d.ts} +2 -2
- package/dist/{cloudwatch.transport-DdSjUWvu.d.ts.map → cloudwatch.transport-pY96iAfO.d.ts.map} +1 -1
- package/dist/correlation.js +2 -2
- package/dist/correlation.mjs +2 -2
- package/dist/fastify.d.mts +1 -1
- package/dist/fastify.d.ts +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fastify.mjs +1 -1
- package/dist/gcp.d.mts +1 -1
- package/dist/gcp.d.ts +1 -1
- package/dist/{gcp.transport-C8VJiEM7.d.mts → gcp.transport-BFlvl8uy.d.mts} +2 -2
- package/dist/{gcp.transport-C8VJiEM7.d.mts.map → gcp.transport-BFlvl8uy.d.mts.map} +1 -1
- package/dist/{gcp.transport-Ct0BtKFo.d.ts → gcp.transport-Bo60F-_3.d.ts} +2 -2
- package/dist/{gcp.transport-Ct0BtKFo.d.ts.map → gcp.transport-Bo60F-_3.d.ts.map} +1 -1
- package/dist/hono.js +1 -1
- package/dist/hono.js.map +1 -1
- package/dist/hono.mjs +1 -1
- package/dist/hono.mjs.map +1 -1
- package/dist/{index-B3ajtXJd.d.mts → index-0X_XpQ_f.d.mts} +2 -2
- package/dist/{index-B3ajtXJd.d.mts.map → index-0X_XpQ_f.d.mts.map} +1 -1
- package/dist/{index-oqD3WNxf.d.ts → index-BnbqeNl6.d.ts} +2 -2
- package/dist/{index-oqD3WNxf.d.ts.map → index-BnbqeNl6.d.ts.map} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{logitron-logger-fMOkXr8H.d.mts → logixia-logger-DcvASx5B.d.mts} +2 -2
- package/dist/logixia-logger-DcvASx5B.d.mts.map +1 -0
- package/dist/{logitron-logger-Csn3e6Qu.d.ts → logixia-logger-cLi5x5I2.d.ts} +2 -2
- package/dist/logixia-logger-cLi5x5I2.d.ts.map +1 -0
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/middleware.js +1 -1
- package/dist/middleware.mjs +1 -1
- package/dist/nest.d.mts +2 -2
- package/dist/nest.d.mts.map +1 -1
- package/dist/nest.d.ts +2 -2
- package/dist/nest.d.ts.map +1 -1
- package/dist/nest.js +4 -4
- package/dist/nest.js.map +1 -1
- package/dist/nest.mjs +4 -4
- package/dist/nest.mjs.map +1 -1
- package/dist/{otel-BrgvxLDW.js → otel-D4SdNYhR.js} +3 -5
- package/dist/otel-D4SdNYhR.js.map +1 -0
- package/dist/{otel-C5jBV_l_.mjs → otel-LeATAHbW.mjs} +3 -5
- package/dist/otel-LeATAHbW.mjs.map +1 -0
- package/dist/{request-trace-txUhyyre.mjs → request-trace-B-S5-LVk.mjs} +2 -2
- package/dist/request-trace-B-S5-LVk.mjs.map +1 -0
- package/dist/{request-trace-6NBSw5lt.js → request-trace-BqU7ARjg.js} +2 -2
- package/dist/request-trace-BqU7ARjg.js.map +1 -0
- package/dist/{search-BlKBLm5D.d.ts → search-B9fKizkh.d.ts} +2 -2
- package/dist/{search-BlKBLm5D.d.ts.map → search-B9fKizkh.d.ts.map} +1 -1
- package/dist/{search-B-hJe2N-.d.mts → search-CdTwNSQm.d.mts} +2 -2
- package/dist/{search-B-hJe2N-.d.mts.map → search-CdTwNSQm.d.mts.map} +1 -1
- package/dist/search.d.mts +1 -1
- package/dist/search.d.ts +1 -1
- package/dist/{slack.transport-Ci0swStG.js → slack.transport-B-IsNaB8.js} +2 -2
- package/dist/{slack.transport-Ci0swStG.js.map → slack.transport-B-IsNaB8.js.map} +1 -1
- package/dist/{slack.transport-C6dzPJHX.mjs → slack.transport-BXmDHthx.mjs} +2 -2
- package/dist/{slack.transport-C6dzPJHX.mjs.map → slack.transport-BXmDHthx.mjs.map} +1 -1
- package/dist/{slack.transport-5OPL7H3u.d.mts → slack.transport-DAGuMvm7.d.mts} +2 -2
- package/dist/{slack.transport-5OPL7H3u.d.mts.map → slack.transport-DAGuMvm7.d.mts.map} +1 -1
- package/dist/{slack.transport-BFpBD_Ri.d.ts → slack.transport-LvYsOoFZ.d.ts} +2 -2
- package/dist/{slack.transport-BFpBD_Ri.d.ts.map → slack.transport-LvYsOoFZ.d.ts.map} +1 -1
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{transport.types-B1ejJJP6.d.mts → transport.types-MjMDjOQ7.d.mts} +6 -1
- package/dist/{transport.types-B1ejJJP6.d.mts.map → transport.types-MjMDjOQ7.d.mts.map} +1 -1
- package/dist/{transport.types-B1ejJJP6.d.ts → transport.types-MjMDjOQ7.d.ts} +6 -1
- package/dist/{transport.types-B1ejJJP6.d.ts.map → transport.types-MjMDjOQ7.d.ts.map} +1 -1
- package/dist/transports.d.mts +8 -10
- package/dist/transports.d.mts.map +1 -1
- package/dist/transports.d.ts +8 -10
- package/dist/transports.d.ts.map +1 -1
- package/dist/transports.js +2 -2
- package/dist/transports.mjs +2 -2
- package/dist/worker.d.mts +1 -1
- package/dist/worker.d.ts +1 -1
- package/dist/{worker.transport-B7olL1Uh.d.ts → worker.transport-ByBBDx7U.d.ts} +2 -2
- package/dist/{worker.transport-B7olL1Uh.d.ts.map → worker.transport-ByBBDx7U.d.ts.map} +1 -1
- package/dist/{worker.transport-DnU0_9Bd.d.mts → worker.transport-DWyyRVJW.d.mts} +2 -2
- package/dist/{worker.transport-DnU0_9Bd.d.mts.map → worker.transport-DWyyRVJW.d.mts.map} +1 -1
- package/package.json +1 -1
- package/dist/builder-CbttbixM.mjs.map +0 -1
- package/dist/builder-Ck1tsC5d.js.map +0 -1
- package/dist/logitron-logger-Csn3e6Qu.d.ts.map +0 -1
- package/dist/logitron-logger-fMOkXr8H.d.mts.map +0 -1
- package/dist/otel-BrgvxLDW.js.map +0 -1
- package/dist/otel-C5jBV_l_.mjs.map +0 -1
- package/dist/request-trace-6NBSw5lt.js.map +0 -1
- package/dist/request-trace-txUhyyre.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_own_property = require("./own-property-BWkibepN.js");
|
|
2
|
-
const require_request_trace = require("./request-trace-
|
|
2
|
+
const require_request_trace = require("./request-trace-BqU7ARjg.js");
|
|
3
3
|
// src/context/async-context.ts
|
|
4
4
|
/**
|
|
5
5
|
* LogixiaContext — Zero-boilerplate AsyncLocalStorage context propagation.
|
|
@@ -145,4 +145,4 @@ Object.defineProperty(exports, "createFastifyContextHook", {
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
//# sourceMappingURL=async-context-
|
|
148
|
+
//# sourceMappingURL=async-context-BqjwNzgS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-context-
|
|
1
|
+
{"version":3,"file":"async-context-BqjwNzgS.js","names":["AsyncLocalStorage","TraceContext","resolveRequestTraceId","resolveTraceHeaders"],"sources":["../src/context/async-context.ts"],"sourcesContent":["/**\n * LogixiaContext — Zero-boilerplate AsyncLocalStorage context propagation.\n *\n * Lets every `logger.info()` call inside a context automatically pick up stored\n * fields (requestId, userId, tenantId, …) without passing them through every function.\n *\n * Works across `Promise.all`, `setTimeout`, and event emitters — anything that\n * inherits the async execution context.\n *\n * @example\n * ```ts\n * import { LogixiaContext } from 'logixia';\n *\n * // Wrap a request handler:\n * app.use((req, res, next) => {\n * LogixiaContext.run({ requestId: req.id, userId: req.user?.id }, next);\n * });\n *\n * // Anywhere deeper in the call tree:\n * async function processOrder(orderId: string) {\n * const ctx = LogixiaContext.get(); // { requestId, userId, orderId }\n * logger.info('Processing order', { orderId, ...ctx });\n * }\n * ```\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { assignOwn } from '../utils/own-property';\nimport {\n type ContextRequestLike,\n resolveRequestTraceId,\n resolveTraceHeaders,\n type TraceHeaderOption,\n} from '../utils/request-trace';\nimport { TraceContext } from '../utils/trace.utils';\n\nexport interface LogContext {\n traceId?: string;\n spanId?: string;\n userId?: string;\n tenantId?: string;\n sessionId?: string;\n [key: string]: unknown;\n}\n\n// Module-level singleton so all loggers share the same ALS store.\nconst _storage = new AsyncLocalStorage<LogContext>();\n\nexport const LogixiaContext = {\n /**\n * Run `callback` inside an async context that carries `store` fields.\n * All loggers queried within `callback` (and its async descendants) will\n * automatically see these fields.\n *\n * @example\n * ```ts\n * LogixiaContext.run({ requestId: 'abc', userId: '42' }, async () => {\n * await processOrder(); // sees requestId + userId in every log\n * });\n * ```\n */\n run<T>(store: LogContext, callback: () => T): T {\n const parent = _storage.getStore() ?? {};\n const scoped = (): T => _storage.run({ ...parent, ...store }, callback);\n const traceId = store.traceId;\n if (typeof traceId !== 'string' || traceId === '') return scoped();\n // An explicit traceId also becomes the TraceContext ID, so getCurrentTraceId(),\n // the logger, outbound propagation and the OTel bridge all see the same value.\n const trace = TraceContext.instance;\n return trace.storage.run({ ...trace.storage.getStore(), [trace.contextKey]: traceId }, scoped);\n },\n\n /**\n * Return the context fields active in the current async scope.\n * Returns `undefined` when called outside any `LogixiaContext.run()`.\n */\n get(): LogContext | undefined {\n return _storage.getStore();\n },\n\n /**\n * Merge `fields` into the **existing** context for the current scope.\n * If called outside a `run()` context this is a no-op (logs a dev warning).\n */\n set(fields: Partial<LogContext>): void {\n const store = _storage.getStore();\n if (!store) {\n // Silently ignore — avoids crashing in code that may call setContext\n // before a request context is established (e.g. background jobs).\n return;\n }\n for (const key of Object.keys(fields)) {\n assignOwn(store, key, fields[key]);\n }\n },\n\n /**\n * Retrieve the underlying `AsyncLocalStorage` instance.\n * Useful for advanced use-cases like custom middleware.\n */\n getStorage(): AsyncLocalStorage<LogContext> {\n return _storage;\n },\n};\n\nexport type { ContextRequestLike };\n\ninterface ContextHelperOptions<Req extends ContextRequestLike> {\n /**\n * Extract additional fields from the request. A `traceId` returned here is ignored:\n * the resolved request trace ID always wins.\n */\n enrich?: (request: Req & Record<string, unknown>) => Partial<LogContext>;\n /**\n * Header name, or list of names tried in order, to read the trace ID from.\n * Default: `DEFAULT_TRACE_HEADERS` (traceparent is parsed to its 32-hex trace id).\n */\n traceIdHeader?: TraceHeaderOption;\n /**\n * Echo the resolved trace ID on the response under this header name.\n * Default: `false` (no response header is set).\n */\n responseHeader?: string | false;\n}\n\nfunction buildScope<Req extends ContextRequestLike>(\n request: Req,\n options: ContextHelperOptions<Req>,\n headers: readonly string[]\n): LogContext {\n const extra = options.enrich ? options.enrich(request as Req & Record<string, unknown>) : {};\n return { ...extra, traceId: resolveRequestTraceId(request, headers) };\n}\n\n/**\n * Create an Express/Connect-compatible middleware that wraps each request in\n * a `LogixiaContext.run()` scope populated with common request fields.\n *\n * Trace ID: the first present header of `traceIdHeader` (default\n * `DEFAULT_TRACE_HEADERS`, `traceparent` parsed), else `request.id`, else a\n * generated UUID. It is available via `getCurrentTraceId()` and is the logger's\n * top-level `traceId` inside the request. No response header is set unless\n * `responseHeader` is given.\n *\n * @example\n * ```ts\n * import { createExpressContextMiddleware } from 'logixia';\n * app.use(createExpressContextMiddleware({ responseHeader: 'x-trace-id' }));\n * ```\n */\nexport function createExpressContextMiddleware<Req extends ContextRequestLike = ContextRequestLike>(\n options: ContextHelperOptions<Req> = {}\n) {\n const headers = resolveTraceHeaders(options.traceIdHeader);\n\n return function logixiaContextMiddleware(\n req: Req,\n res: { setHeader?: (name: string, value: string) => unknown },\n next: () => void\n ): void {\n const scope = buildScope(req, options, headers);\n if (options.responseHeader) res.setHeader?.(options.responseHeader, scope.traceId as string);\n LogixiaContext.run(scope, next);\n };\n}\n\n/**\n * Create a Fastify lifecycle hook that wraps each request in a context scope.\n *\n * Register with `fastify.addHook('onRequest', createFastifyContextHook())`.\n * Resolves the trace ID exactly like {@link createExpressContextMiddleware} and\n * shares it with `createFastifyPlugin()` from `logixia/middleware`. Fastify's\n * default counter `request.id` (`req-1`, ...) is never used as a trace ID.\n */\nexport function createFastifyContextHook<Req extends ContextRequestLike = ContextRequestLike>(\n options: ContextHelperOptions<Req> = {}\n) {\n const headers = resolveTraceHeaders(options.traceIdHeader);\n\n return function logixiaFastifyHook(\n request: Req,\n reply: { header?: (name: string, value: string) => unknown },\n done: () => void\n ): void {\n const scope = buildScope(request, options, headers);\n if (options.responseHeader) reply.header?.(options.responseHeader, scope.traceId as string);\n LogixiaContext.run(scope, done);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAM,WAAW,K,0BAAIA,EAAAA,CAAAA,kBAA8B;AAEnD,MAAa,iBAAiB;;;;;;;;;;;;;CAa5B,IAAO,OAAmB,UAAsB;EAC9C,MAAM,SAAS,SAAS,SAAS,KAAK,CAAC;EACvC,MAAM,eAAkB,SAAS,IAAI;GAAE,GAAG;GAAQ,GAAG;EAAM,GAAG,QAAQ;EACtE,MAAM,UAAU,MAAM;EACtB,IAAI,OAAO,YAAY,YAAY,YAAY,IAAI,OAAO,OAAO;EAGjE,MAAM,QAAQC,sBAAAA,aAAa;EAC3B,OAAO,MAAM,QAAQ,IAAI;GAAE,GAAG,MAAM,QAAQ,SAAS;IAAI,MAAM,aAAa;EAAQ,GAAG,MAAM;CAC/F;;;;;CAMA,MAA8B;EAC5B,OAAO,SAAS,SAAS;CAC3B;;;;;CAMA,IAAI,QAAmC;EACrC,MAAM,QAAQ,SAAS,SAAS;EAChC,IAAI,CAAC,OAGH;EAEF,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAClC,qBAAA,UAAU,OAAO,KAAK,OAAO,IAAI;CAErC;;;;;CAMA,aAA4C;EAC1C,OAAO;CACT;AACF;AAsBA,SAAS,WACP,SACA,SACA,SACY;CAEZ,OAAO;EAAE,GADK,QAAQ,SAAS,QAAQ,OAAO,OAAwC,IAAI,CAAC;EACxE,SAASC,sBAAAA,sBAAsB,SAAS,OAAO;CAAE;AACtE;;;;;;;;;;;;;;;;;AAkBA,SAAgB,+BACd,UAAqC,CAAC,GACtC;CACA,MAAM,UAAUC,sBAAAA,oBAAoB,QAAQ,aAAa;CAEzD,OAAO,SAAS,yBACd,KACA,KACA,MACM;;EACN,MAAM,QAAQ,WAAW,KAAK,SAAS,OAAO;EAC9C,IAAI,QAAQ,gBAAgB,CAAA,iBAAA,IAAI,eAAA,QAAA,mBAAA,KAAA,KAAA,eAAA,KAAA,KAAY,QAAQ,gBAAgB,MAAM,OAAiB;EAC3F,eAAe,IAAI,OAAO,IAAI;CAChC;AACF;;;;;;;;;AAUA,SAAgB,yBACd,UAAqC,CAAC,GACtC;CACA,MAAM,UAAUA,sBAAAA,oBAAoB,QAAQ,aAAa;CAEzD,OAAO,SAAS,mBACd,SACA,OACA,MACM;;EACN,MAAM,QAAQ,WAAW,SAAS,SAAS,OAAO;EAClD,IAAI,QAAQ,gBAAgB,CAAA,gBAAA,MAAM,YAAA,QAAA,kBAAA,KAAA,KAAA,cAAA,KAAA,OAAS,QAAQ,gBAAgB,MAAM,OAAiB;EAC1F,eAAe,IAAI,OAAO,IAAI;CAChC;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as assignOwn } from "./own-property-CjFw9qwZ.mjs";
|
|
2
|
-
import { n as resolveTraceHeaders, s as TraceContext, t as resolveRequestTraceId } from "./request-trace-
|
|
2
|
+
import { n as resolveTraceHeaders, s as TraceContext, t as resolveRequestTraceId } from "./request-trace-B-S5-LVk.mjs";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
// src/context/async-context.ts
|
|
5
5
|
/**
|
|
@@ -129,4 +129,4 @@ function createFastifyContextHook(options = {}) {
|
|
|
129
129
|
}
|
|
130
130
|
export { createExpressContextMiddleware as n, createFastifyContextHook as r, LogixiaContext as t };
|
|
131
131
|
|
|
132
|
-
//# sourceMappingURL=async-context-
|
|
132
|
+
//# sourceMappingURL=async-context-DJdxbbCU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-context-
|
|
1
|
+
{"version":3,"file":"async-context-DJdxbbCU.mjs","names":[],"sources":["../src/context/async-context.ts"],"sourcesContent":["/**\n * LogixiaContext — Zero-boilerplate AsyncLocalStorage context propagation.\n *\n * Lets every `logger.info()` call inside a context automatically pick up stored\n * fields (requestId, userId, tenantId, …) without passing them through every function.\n *\n * Works across `Promise.all`, `setTimeout`, and event emitters — anything that\n * inherits the async execution context.\n *\n * @example\n * ```ts\n * import { LogixiaContext } from 'logixia';\n *\n * // Wrap a request handler:\n * app.use((req, res, next) => {\n * LogixiaContext.run({ requestId: req.id, userId: req.user?.id }, next);\n * });\n *\n * // Anywhere deeper in the call tree:\n * async function processOrder(orderId: string) {\n * const ctx = LogixiaContext.get(); // { requestId, userId, orderId }\n * logger.info('Processing order', { orderId, ...ctx });\n * }\n * ```\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { assignOwn } from '../utils/own-property';\nimport {\n type ContextRequestLike,\n resolveRequestTraceId,\n resolveTraceHeaders,\n type TraceHeaderOption,\n} from '../utils/request-trace';\nimport { TraceContext } from '../utils/trace.utils';\n\nexport interface LogContext {\n traceId?: string;\n spanId?: string;\n userId?: string;\n tenantId?: string;\n sessionId?: string;\n [key: string]: unknown;\n}\n\n// Module-level singleton so all loggers share the same ALS store.\nconst _storage = new AsyncLocalStorage<LogContext>();\n\nexport const LogixiaContext = {\n /**\n * Run `callback` inside an async context that carries `store` fields.\n * All loggers queried within `callback` (and its async descendants) will\n * automatically see these fields.\n *\n * @example\n * ```ts\n * LogixiaContext.run({ requestId: 'abc', userId: '42' }, async () => {\n * await processOrder(); // sees requestId + userId in every log\n * });\n * ```\n */\n run<T>(store: LogContext, callback: () => T): T {\n const parent = _storage.getStore() ?? {};\n const scoped = (): T => _storage.run({ ...parent, ...store }, callback);\n const traceId = store.traceId;\n if (typeof traceId !== 'string' || traceId === '') return scoped();\n // An explicit traceId also becomes the TraceContext ID, so getCurrentTraceId(),\n // the logger, outbound propagation and the OTel bridge all see the same value.\n const trace = TraceContext.instance;\n return trace.storage.run({ ...trace.storage.getStore(), [trace.contextKey]: traceId }, scoped);\n },\n\n /**\n * Return the context fields active in the current async scope.\n * Returns `undefined` when called outside any `LogixiaContext.run()`.\n */\n get(): LogContext | undefined {\n return _storage.getStore();\n },\n\n /**\n * Merge `fields` into the **existing** context for the current scope.\n * If called outside a `run()` context this is a no-op (logs a dev warning).\n */\n set(fields: Partial<LogContext>): void {\n const store = _storage.getStore();\n if (!store) {\n // Silently ignore — avoids crashing in code that may call setContext\n // before a request context is established (e.g. background jobs).\n return;\n }\n for (const key of Object.keys(fields)) {\n assignOwn(store, key, fields[key]);\n }\n },\n\n /**\n * Retrieve the underlying `AsyncLocalStorage` instance.\n * Useful for advanced use-cases like custom middleware.\n */\n getStorage(): AsyncLocalStorage<LogContext> {\n return _storage;\n },\n};\n\nexport type { ContextRequestLike };\n\ninterface ContextHelperOptions<Req extends ContextRequestLike> {\n /**\n * Extract additional fields from the request. A `traceId` returned here is ignored:\n * the resolved request trace ID always wins.\n */\n enrich?: (request: Req & Record<string, unknown>) => Partial<LogContext>;\n /**\n * Header name, or list of names tried in order, to read the trace ID from.\n * Default: `DEFAULT_TRACE_HEADERS` (traceparent is parsed to its 32-hex trace id).\n */\n traceIdHeader?: TraceHeaderOption;\n /**\n * Echo the resolved trace ID on the response under this header name.\n * Default: `false` (no response header is set).\n */\n responseHeader?: string | false;\n}\n\nfunction buildScope<Req extends ContextRequestLike>(\n request: Req,\n options: ContextHelperOptions<Req>,\n headers: readonly string[]\n): LogContext {\n const extra = options.enrich ? options.enrich(request as Req & Record<string, unknown>) : {};\n return { ...extra, traceId: resolveRequestTraceId(request, headers) };\n}\n\n/**\n * Create an Express/Connect-compatible middleware that wraps each request in\n * a `LogixiaContext.run()` scope populated with common request fields.\n *\n * Trace ID: the first present header of `traceIdHeader` (default\n * `DEFAULT_TRACE_HEADERS`, `traceparent` parsed), else `request.id`, else a\n * generated UUID. It is available via `getCurrentTraceId()` and is the logger's\n * top-level `traceId` inside the request. No response header is set unless\n * `responseHeader` is given.\n *\n * @example\n * ```ts\n * import { createExpressContextMiddleware } from 'logixia';\n * app.use(createExpressContextMiddleware({ responseHeader: 'x-trace-id' }));\n * ```\n */\nexport function createExpressContextMiddleware<Req extends ContextRequestLike = ContextRequestLike>(\n options: ContextHelperOptions<Req> = {}\n) {\n const headers = resolveTraceHeaders(options.traceIdHeader);\n\n return function logixiaContextMiddleware(\n req: Req,\n res: { setHeader?: (name: string, value: string) => unknown },\n next: () => void\n ): void {\n const scope = buildScope(req, options, headers);\n if (options.responseHeader) res.setHeader?.(options.responseHeader, scope.traceId as string);\n LogixiaContext.run(scope, next);\n };\n}\n\n/**\n * Create a Fastify lifecycle hook that wraps each request in a context scope.\n *\n * Register with `fastify.addHook('onRequest', createFastifyContextHook())`.\n * Resolves the trace ID exactly like {@link createExpressContextMiddleware} and\n * shares it with `createFastifyPlugin()` from `logixia/middleware`. Fastify's\n * default counter `request.id` (`req-1`, ...) is never used as a trace ID.\n */\nexport function createFastifyContextHook<Req extends ContextRequestLike = ContextRequestLike>(\n options: ContextHelperOptions<Req> = {}\n) {\n const headers = resolveTraceHeaders(options.traceIdHeader);\n\n return function logixiaFastifyHook(\n request: Req,\n reply: { header?: (name: string, value: string) => unknown },\n done: () => void\n ): void {\n const scope = buildScope(request, options, headers);\n if (options.responseHeader) reply.header?.(options.responseHeader, scope.traceId as string);\n LogixiaContext.run(scope, done);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAM,WAAW,IAAI,kBAA8B;AAEnD,MAAa,iBAAiB;;;;;;;;;;;;;CAa5B,IAAO,OAAmB,UAAsB;EAC9C,MAAM,SAAS,SAAS,SAAS,KAAK,CAAC;EACvC,MAAM,eAAkB,SAAS,IAAI;GAAE,GAAG;GAAQ,GAAG;EAAM,GAAG,QAAQ;EACtE,MAAM,UAAU,MAAM;EACtB,IAAI,OAAO,YAAY,YAAY,YAAY,IAAI,OAAO,OAAO;EAGjE,MAAM,QAAQ,aAAa;EAC3B,OAAO,MAAM,QAAQ,IAAI;GAAE,GAAG,MAAM,QAAQ,SAAS;IAAI,MAAM,aAAa;EAAQ,GAAG,MAAM;CAC/F;;;;;CAMA,MAA8B;EAC5B,OAAO,SAAS,SAAS;CAC3B;;;;;CAMA,IAAI,QAAmC;EACrC,MAAM,QAAQ,SAAS,SAAS;EAChC,IAAI,CAAC,OAGH;EAEF,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAClC,UAAU,OAAO,KAAK,OAAO,IAAI;CAErC;;;;;CAMA,aAA4C;EAC1C,OAAO;CACT;AACF;AAsBA,SAAS,WACP,SACA,SACA,SACY;CAEZ,OAAO;EAAE,GADK,QAAQ,SAAS,QAAQ,OAAO,OAAwC,IAAI,CAAC;EACxE,SAAS,sBAAsB,SAAS,OAAO;CAAE;AACtE;;;;;;;;;;;;;;;;;AAkBA,SAAgB,+BACd,UAAqC,CAAC,GACtC;CACA,MAAM,UAAU,oBAAoB,QAAQ,aAAa;CAEzD,OAAO,SAAS,yBACd,KACA,KACA,MACM;;EACN,MAAM,QAAQ,WAAW,KAAK,SAAS,OAAO;EAC9C,IAAI,QAAQ,gBAAgB,CAAA,iBAAA,IAAI,eAAA,QAAA,mBAAA,KAAA,KAAA,eAAA,KAAA,KAAY,QAAQ,gBAAgB,MAAM,OAAiB;EAC3F,eAAe,IAAI,OAAO,IAAI;CAChC;AACF;;;;;;;;;AAUA,SAAgB,yBACd,UAAqC,CAAC,GACtC;CACA,MAAM,UAAU,oBAAoB,QAAQ,aAAa;CAEzD,OAAO,SAAS,mBACd,SACA,OACA,MACM;;EACN,MAAM,QAAQ,WAAW,SAAS,SAAS,OAAO;EAClD,IAAI,QAAQ,gBAAgB,CAAA,gBAAA,MAAM,YAAA,QAAA,kBAAA,KAAA,KAAA,cAAA,KAAA,OAAS,QAAQ,gBAAgB,MAAM,OAAiB;EAC1F,eAAe,IAAI,OAAO,IAAI;CAChC;AACF"}
|
package/dist/{azure-monitor.transport-C5VjvREZ.d.mts → azure-monitor.transport-BZDaQjy8.d.mts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as TransportLogEntry, l as IAsyncTransport } from "./transport.types-
|
|
1
|
+
import { _ as TransportLogEntry, l as IAsyncTransport } from "./transport.types-MjMDjOQ7.mjs";
|
|
2
2
|
interface AzureMonitorTransportConfig {
|
|
3
3
|
/** DCE (Data Collection Endpoint) URL, e.g. `https://<name>.ingest.monitor.azure.com`. */
|
|
4
4
|
endpoint: string;
|
|
@@ -56,4 +56,4 @@ declare class AzureMonitorTransport implements IAsyncTransport {
|
|
|
56
56
|
private sendEntries;
|
|
57
57
|
}
|
|
58
58
|
export { AzureMonitorTransportConfig as n, AzureMonitorTransport as t };
|
|
59
|
-
//# sourceMappingURL=azure-monitor.transport-
|
|
59
|
+
//# sourceMappingURL=azure-monitor.transport-BZDaQjy8.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azure-monitor.transport-
|
|
1
|
+
{"version":3,"file":"azure-monitor.transport-BZDaQjy8.d.mts","names":[],"sources":["../src/transports/azure-monitor.transport.ts"],"mappings":";UAsDiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;;;;;cAmBW,iCAAiC;WAC5B;WACA;WACA;WACA;mBAEC;mBACA;UACT;UACA;UACA;mBAES;mBACA;mBACA;mBACA;mBACA;mBACA;EAEL,YAAA,QAAQ;EA0BpB,MAAM,OAAO;EAKb,SAAS;;;;;;EASH,SAAS;UAQP;UAYA;UAIM;UAgDA"}
|
package/dist/{azure-monitor.transport-CyHDjHS-.d.ts → azure-monitor.transport-MDigkKsS.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as TransportLogEntry, l as IAsyncTransport } from "./transport.types-
|
|
1
|
+
import { _ as TransportLogEntry, l as IAsyncTransport } from "./transport.types-MjMDjOQ7.js";
|
|
2
2
|
interface AzureMonitorTransportConfig {
|
|
3
3
|
/** DCE (Data Collection Endpoint) URL, e.g. `https://<name>.ingest.monitor.azure.com`. */
|
|
4
4
|
endpoint: string;
|
|
@@ -56,4 +56,4 @@ declare class AzureMonitorTransport implements IAsyncTransport {
|
|
|
56
56
|
private sendEntries;
|
|
57
57
|
}
|
|
58
58
|
export { AzureMonitorTransportConfig as n, AzureMonitorTransport as t };
|
|
59
|
-
//# sourceMappingURL=azure-monitor.transport-
|
|
59
|
+
//# sourceMappingURL=azure-monitor.transport-MDigkKsS.d.ts.map
|
package/dist/{azure-monitor.transport-CyHDjHS-.d.ts.map → azure-monitor.transport-MDigkKsS.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"azure-monitor.transport-
|
|
1
|
+
{"version":3,"file":"azure-monitor.transport-MDigkKsS.d.ts","names":[],"sources":["../src/transports/azure-monitor.transport.ts"],"mappings":";UAsDiB;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;;;;;cAmBW,iCAAiC;WAC5B;WACA;WACA;WACA;mBAEC;mBACA;UACT;UACA;UACA;mBAES;mBACA;mBACA;mBACA;mBACA;mBACA;EAEL,YAAA,QAAQ;EA0BpB,MAAM,OAAO;EAKb,SAAS;;;;;;EASH,SAAS;UAQP;UAYA;UAIM;UAgDA"}
|
package/dist/azure.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AzureMonitorTransportConfig, t as AzureMonitorTransport } from "./azure-monitor.transport-
|
|
1
|
+
import { n as AzureMonitorTransportConfig, t as AzureMonitorTransport } from "./azure-monitor.transport-BZDaQjy8.mjs";
|
|
2
2
|
export { AzureMonitorTransport, AzureMonitorTransportConfig };
|
package/dist/azure.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AzureMonitorTransportConfig, t as AzureMonitorTransport } from "./azure-monitor.transport-
|
|
1
|
+
import { n as AzureMonitorTransportConfig, t as AzureMonitorTransport } from "./azure-monitor.transport-MDigkKsS.js";
|
|
2
2
|
export { AzureMonitorTransport, AzureMonitorTransportConfig };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_secret_config = require("./secret-config-OqmIPmpV.js");
|
|
2
2
|
const require_own_property = require("./own-property-BWkibepN.js");
|
|
3
|
-
const require_request_trace = require("./request-trace-
|
|
4
|
-
const require_async_context = require("./async-context-
|
|
3
|
+
const require_request_trace = require("./request-trace-BqU7ARjg.js");
|
|
4
|
+
const require_async_context = require("./async-context-BqjwNzgS.js");
|
|
5
5
|
const require_sensitive_names = require("./sensitive-names-NiKIRhp5.js");
|
|
6
6
|
const require_internal_log = require("./internal-log-DwqTjhpb.js");
|
|
7
7
|
const require_safe_stringify = require("./safe-stringify-J3sh-7YM.js");
|
|
8
8
|
const require_csv_utils = require("./csv.utils-CbVHY1pd.js");
|
|
9
|
-
const require_otel = require("./otel-
|
|
9
|
+
const require_otel = require("./otel-D4SdNYhR.js");
|
|
10
10
|
const require_error_utils = require("./error.utils-fZkRExam.js");
|
|
11
11
|
let node_os = require("node:os");
|
|
12
12
|
// src/types/index.ts
|
|
@@ -918,7 +918,7 @@ function warnOnReservedLevelNames(levels) {
|
|
|
918
918
|
if (clashes.length > 0) require_internal_log.internalWarn(`levelOptions.levels uses reserved logger method name(s): ${clashes.join(", ")}. No level shortcut is created for them; use logger.logLevel(name, ...) or rename the level.`);
|
|
919
919
|
return clashes;
|
|
920
920
|
}
|
|
921
|
-
// src/core/
|
|
921
|
+
// src/core/logixia-logger.ts
|
|
922
922
|
/**
|
|
923
923
|
* Core Logixia Logger implementation
|
|
924
924
|
*
|
|
@@ -2287,4 +2287,4 @@ Object.defineProperty(exports, "usePlugin", {
|
|
|
2287
2287
|
}
|
|
2288
2288
|
});
|
|
2289
2289
|
|
|
2290
|
-
//# sourceMappingURL=builder-
|
|
2290
|
+
//# sourceMappingURL=builder-CC48eDJ3.js.map
|