unnbound-logger-sdk 3.0.14 → 3.0.15

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/storage.d.ts CHANGED
@@ -2,5 +2,6 @@ import { AsyncLocalStorage } from 'async_hooks';
2
2
  export interface Context {
3
3
  traceId?: string;
4
4
  spanId?: string;
5
+ messageId?: string;
5
6
  }
6
7
  export declare const storage: AsyncLocalStorage<Context>;
package/dist/trace.d.ts CHANGED
@@ -11,4 +11,5 @@ export declare const getTraceId: () => string;
11
11
  */
12
12
  export declare const withTrace: <T, E extends {
13
13
  traceId?: string;
14
+ messageId?: string;
14
15
  }>(callback: () => T, extra?: E) => T;
package/dist/trace.js CHANGED
@@ -16,6 +16,8 @@ exports.getTraceId = getTraceId;
16
16
  * @returns The result of the callback
17
17
  */
18
18
  const withTrace = (callback, extra) => {
19
- return storage_1.storage.run({ ...storage_1.storage.getStore(), ...extra, traceId: extra?.traceId ?? (0, exports.getTraceId)() }, callback);
19
+ const previous = storage_1.storage.getStore();
20
+ const traceId = extra?.traceId ?? previous?.traceId ?? (0, exports.getTraceId)();
21
+ return storage_1.storage.run({ ...previous, ...extra, traceId }, callback);
20
22
  };
21
23
  exports.withTrace = withTrace;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unnbound-logger-sdk",
3
3
  "description": "A structured logging library with TypeScript support using Pino. Provides consistent, well-typed logging with automatic logId, workflowId, traceId, and deploymentId tracking across operational contexts.",
4
- "version": "3.0.14",
4
+ "version": "3.0.15",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {