unnbound-logger-sdk 3.1.0-beta.0 → 3.1.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/axios.d.ts +4 -2
- package/dist/axios.js +8 -2
- package/dist/logger.js +0 -2
- package/dist/types.d.ts +8 -3
- package/package.json +1 -1
package/dist/axios.d.ts
CHANGED
|
@@ -17,8 +17,10 @@ interface HttpClientOptions extends HttpOptions<GetPayload> {
|
|
|
17
17
|
silent?: boolean;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Wraps an axios instance to add tracing and span tracking
|
|
21
|
-
*
|
|
20
|
+
* Wraps an axios instance to add tracing and span tracking.
|
|
21
|
+
*
|
|
22
|
+
* Repeated calls for the same instance are no-ops; the first call's options remain active.
|
|
23
|
+
* @param client - The axios instance to wrap
|
|
22
24
|
* @param options - Configuration options for HTTP tracing
|
|
23
25
|
* @returns The wrapped axios instance with span tracking
|
|
24
26
|
*/
|
package/dist/axios.js
CHANGED
|
@@ -37,9 +37,12 @@ const buildOutgoingHttpPayload = (config, res, redact) => ({
|
|
|
37
37
|
});
|
|
38
38
|
const getNoopPayload = () => ({});
|
|
39
39
|
const onNoopRequest = (config, callback) => callback(config);
|
|
40
|
+
const tracedMarker = Symbol.for('unnbound-logger-sdk.traceAxios.traced');
|
|
40
41
|
/**
|
|
41
|
-
* Wraps an axios instance to add tracing and span tracking
|
|
42
|
-
*
|
|
42
|
+
* Wraps an axios instance to add tracing and span tracking.
|
|
43
|
+
*
|
|
44
|
+
* Repeated calls for the same instance are no-ops; the first call's options remain active.
|
|
45
|
+
* @param client - The axios instance to wrap
|
|
43
46
|
* @param options - Configuration options for HTTP tracing
|
|
44
47
|
* @returns The wrapped axios instance with span tracking
|
|
45
48
|
*/
|
|
@@ -49,6 +52,8 @@ const traceAxios = (client, { ignoreTraceRoutes = types_1.defaultIgnoreTraceRout
|
|
|
49
52
|
getPayload: getNoopPayload,
|
|
50
53
|
onRequest: onNoopRequest,
|
|
51
54
|
}) => {
|
|
55
|
+
if (tracedMarker in client)
|
|
56
|
+
return client;
|
|
52
57
|
const redact = typeof redactOptions === 'boolean' ? { response: redactOptions } : redactOptions;
|
|
53
58
|
const createSpanWrappedRequest = (originalMethod, method) => {
|
|
54
59
|
const { headers: defaultHeaders, ...partialDefaultConfig } = client.defaults;
|
|
@@ -93,6 +98,7 @@ const traceAxios = (client, { ignoreTraceRoutes = types_1.defaultIgnoreTraceRout
|
|
|
93
98
|
const func = createSpanWrappedRequest(request, method);
|
|
94
99
|
client[method] = (url, config) => func({ ...config, method, url });
|
|
95
100
|
});
|
|
101
|
+
Object.defineProperty(client, tracedMarker, { value: true });
|
|
96
102
|
return client;
|
|
97
103
|
};
|
|
98
104
|
exports.traceAxios = traceAxios;
|
package/dist/logger.js
CHANGED
|
@@ -11,7 +11,6 @@ const internal_1 = require("./internal");
|
|
|
11
11
|
const storage_1 = require("./storage");
|
|
12
12
|
const levels = new Set(['debug', 'info', 'warn', 'error']);
|
|
13
13
|
const workflowEnvironment = process.env.WORKFLOW_ENV ?? process.env.UNNBOUND_ENVIRONMENT ?? process.env.ENVIRONMENT;
|
|
14
|
-
const stackEnvironment = process.env.ENVIRONMENT ?? process.env.APP_ENV;
|
|
15
14
|
const formatLevel = (level) => ({ level });
|
|
16
15
|
const formatLog = (log, visited = new WeakSet()) => {
|
|
17
16
|
// Prevent infinite loops from circular references
|
|
@@ -56,7 +55,6 @@ const loggerOptions = {
|
|
|
56
55
|
level: process.env.LOG_LEVEL ?? 'debug',
|
|
57
56
|
base: {
|
|
58
57
|
environment: workflowEnvironment,
|
|
59
|
-
stack: stackEnvironment,
|
|
60
58
|
workflowId: process.env.UNNBOUND_WORKFLOW_ID,
|
|
61
59
|
serviceId: process.env.UNNBOUND_SERVICE_ID,
|
|
62
60
|
deploymentId: process.env.UNNBOUND_DEPLOYMENT_ID,
|
package/dist/types.d.ts
CHANGED
|
@@ -67,9 +67,10 @@ export interface EdiPayload {
|
|
|
67
67
|
export type As2Operation = 'send' | 'deliver' | 'receive' | 'acknowledge' | 'mdn-generate' | 'mdn-deliver' | 'mdn-verify';
|
|
68
68
|
export type As2Outcome = 'confirmed' | 'failed' | 'pending' | 'received' | 'duplicate' | 'inFlight' | 'parked' | 'delivered' | 'generated' | 'verified';
|
|
69
69
|
/**
|
|
70
|
-
* Customer-visible AS2 protocol milestone.
|
|
71
|
-
*
|
|
72
|
-
*
|
|
70
|
+
* Customer-visible AS2 protocol milestone. `payload` carries the cleartext business
|
|
71
|
+
* document (send/receive) and `mdn` the complete receipt (mdn-generate/mdn-verify) —
|
|
72
|
+
* the same user-queryable content contract as http/sftp body logging (T-3258). Sealed
|
|
73
|
+
* envelopes, full URLs, delivery tokens, and certificate material stay excluded.
|
|
73
74
|
*/
|
|
74
75
|
export interface As2Payload {
|
|
75
76
|
operation: As2Operation;
|
|
@@ -96,6 +97,10 @@ export interface As2Payload {
|
|
|
96
97
|
micMatched?: boolean;
|
|
97
98
|
/** Normalized safe error code (As2SdkError.code), never a stack trace. */
|
|
98
99
|
errorCode?: string;
|
|
100
|
+
/** Complete cleartext business document (send/receive milestones). */
|
|
101
|
+
payload?: string;
|
|
102
|
+
/** Complete MDN receipt as MIME text (mdn-generate/mdn-verify milestones). */
|
|
103
|
+
mdn?: string;
|
|
99
104
|
}
|
|
100
105
|
export interface HttpOptions<G extends Function> {
|
|
101
106
|
ignoreTraceRoutes?: string[];
|
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.1.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"keywords": [
|