autotel 6.5.0 → 7.0.1

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.
Files changed (166) hide show
  1. package/README.md +30 -23
  2. package/dist/{attribute-redacting-processor-Pk7lAzWd.d.cts → attribute-redacting-processor-CvBE0z1p.d.cts} +33 -1
  3. package/dist/{attribute-redacting-processor-Pk7lAzWd.d.ts → attribute-redacting-processor-CvBE0z1p.d.ts} +33 -1
  4. package/dist/attribute-redacting-processor.cjs +34 -32
  5. package/dist/attribute-redacting-processor.d.cts +1 -1
  6. package/dist/attribute-redacting-processor.d.ts +1 -1
  7. package/dist/attribute-redacting-processor.js +35 -32
  8. package/dist/{attributes-aDmJYral.cjs → attributes-Cxys8tgr.cjs} +34 -35
  9. package/dist/{attributes-B7wix2VG.js → attributes-Dt4YUYbP.js} +34 -35
  10. package/dist/attributes.cjs +1 -1
  11. package/dist/attributes.d.cts +1 -1
  12. package/dist/attributes.d.ts +1 -1
  13. package/dist/attributes.js +1 -1
  14. package/dist/auto.cjs +1 -1
  15. package/dist/auto.js +1 -1
  16. package/dist/business-baggage.cjs +19 -12
  17. package/dist/business-baggage.d.cts +8 -3
  18. package/dist/business-baggage.d.ts +8 -3
  19. package/dist/business-baggage.js +19 -12
  20. package/dist/{canonical-log-line-processor-DxtBGZIi.cjs → canonical-log-line-processor-DolzdawH.cjs} +43 -32
  21. package/dist/{canonical-log-line-processor-B4WgG-VS.d.cts → canonical-log-line-processor-cPB4Axk-.d.ts} +4 -3
  22. package/dist/{canonical-log-line-processor-B0vq_QR6.js → canonical-log-line-processor-hFUmS__K.js} +43 -32
  23. package/dist/{canonical-log-line-processor-CL_J7gb5.d.ts → canonical-log-line-processor-l0Aqe6yp.d.cts} +4 -3
  24. package/dist/config.d.cts +1 -1
  25. package/dist/config.d.ts +1 -1
  26. package/dist/{correlated-events-kSwLo3mi.cjs → correlated-events-CcuknWnU.cjs} +2 -1
  27. package/dist/{correlated-events-Bzh5y-UB.js → correlated-events-DwMMbItg.js} +3 -1
  28. package/dist/correlation-id.cjs +1 -1
  29. package/dist/correlation-id.js +1 -1
  30. package/dist/db.cjs +34 -19
  31. package/dist/db.js +34 -19
  32. package/dist/decorators.cjs +4 -2
  33. package/dist/decorators.d.cts +16 -11
  34. package/dist/decorators.d.ts +16 -11
  35. package/dist/decorators.js +4 -2
  36. package/dist/{define-event-CGG048HE.d.cts → define-event-BNeuKUPv.d.cts} +1 -1
  37. package/dist/{define-event-B2z1SBe7.d.ts → define-event-Bd8f8mST.d.ts} +1 -1
  38. package/dist/diagnostics.cjs +18 -16
  39. package/dist/diagnostics.d.cts +14 -10
  40. package/dist/diagnostics.d.ts +14 -10
  41. package/dist/diagnostics.js +18 -16
  42. package/dist/{event-subscriber-CWh8sTGh.d.cts → event-subscriber-DMACQA-1.d.cts} +19 -9
  43. package/dist/{event-subscriber-CWh8sTGh.d.ts → event-subscriber-DMACQA-1.d.ts} +19 -9
  44. package/dist/event-subscriber.d.cts +2 -2
  45. package/dist/event-subscriber.d.ts +2 -2
  46. package/dist/{event-testing-D0qWfqAy.d.cts → event-testing-CBtnJXE5.d.cts} +1 -1
  47. package/dist/{event-testing-CA2mIx1E.d.ts → event-testing-CkPgV3Ii.d.ts} +1 -1
  48. package/dist/event-testing.d.cts +1 -1
  49. package/dist/event-testing.d.ts +1 -1
  50. package/dist/event.cjs +1 -1
  51. package/dist/event.d.cts +5 -5
  52. package/dist/event.d.ts +5 -5
  53. package/dist/event.js +1 -1
  54. package/dist/exception-fingerprint.cjs +133 -0
  55. package/dist/exception-fingerprint.d.cts +51 -0
  56. package/dist/exception-fingerprint.d.ts +51 -0
  57. package/dist/exception-fingerprint.js +126 -0
  58. package/dist/{functional-C0uAZq2X.cjs → functional-C2ONG9PK.cjs} +27 -15
  59. package/dist/{functional-e6jw5zQj.d.cts → functional-CJn2zY4o.d.cts} +96 -39
  60. package/dist/{functional-AT22vCw6.d.ts → functional-DXy1cHFF.d.ts} +96 -39
  61. package/dist/{functional-DX7Zvag0.js → functional-nS5U4KCQ.js} +27 -15
  62. package/dist/functional.cjs +1 -1
  63. package/dist/functional.d.cts +2 -2
  64. package/dist/functional.d.ts +2 -2
  65. package/dist/functional.js +1 -1
  66. package/dist/http.cjs +11 -8
  67. package/dist/http.js +11 -8
  68. package/dist/{index-DolOVX6F.d.ts → index-CwrNAsgk.d.ts} +22 -26
  69. package/dist/{index-BPcxVucm.d.cts → index-DQHf4cNl.d.cts} +22 -26
  70. package/dist/index.cjs +41 -35
  71. package/dist/index.d.cts +45 -30
  72. package/dist/index.d.ts +45 -30
  73. package/dist/index.js +41 -35
  74. package/dist/{init-pPI3JRRf.d.ts → init-BgnYi2sm.d.ts} +6 -6
  75. package/dist/{init-CTtHITlX.cjs → init-C5aHRqi2.cjs} +111 -85
  76. package/dist/{init-WHYwyItd.js → init-DDyaLzeg.js} +106 -86
  77. package/dist/{init-ncTMKZ-s.d.cts → init-DrlL1eis.d.cts} +6 -6
  78. package/dist/instrumentation.cjs +2 -2
  79. package/dist/instrumentation.js +2 -2
  80. package/dist/{logger-D3Ej3DII.js → logger-DdPp__xW.js} +63 -54
  81. package/dist/{logger-CN4xpzMd.d.cts → logger-S1Fgl0g3.d.cts} +0 -20
  82. package/dist/{logger-CN4xpzMd.d.ts → logger-S1Fgl0g3.d.ts} +0 -20
  83. package/dist/{logger-thMPLpOG.cjs → logger-Sm66cjKl.cjs} +63 -54
  84. package/dist/logger.cjs +1 -1
  85. package/dist/logger.d.cts +1 -1
  86. package/dist/logger.d.ts +1 -1
  87. package/dist/logger.js +1 -1
  88. package/dist/messaging-adapters.cjs +26 -12
  89. package/dist/messaging-adapters.d.cts +0 -30
  90. package/dist/messaging-adapters.d.ts +0 -30
  91. package/dist/messaging-adapters.js +26 -12
  92. package/dist/messaging.cjs +37 -34
  93. package/dist/messaging.d.cts +21 -62
  94. package/dist/messaging.d.ts +21 -62
  95. package/dist/messaging.js +37 -34
  96. package/dist/{metric-testing-CpvP3ZIa.d.cts → metric-testing-86WO1wan.d.cts} +1 -1
  97. package/dist/{metric-testing-CWm6UhaR.d.ts → metric-testing-CbCxdPBp.d.ts} +1 -1
  98. package/dist/metric-testing.d.cts +1 -1
  99. package/dist/metric-testing.d.ts +1 -1
  100. package/dist/metric.d.cts +3 -3
  101. package/dist/metric.d.ts +3 -3
  102. package/dist/{node-require-vROmTeJ8.js → node-require-DSPjaw_l.js} +3 -2
  103. package/dist/{node-require-PFqDihze.cjs → node-require-EifOMikz.cjs} +3 -2
  104. package/dist/parse-error.cjs +18 -12
  105. package/dist/parse-error.d.cts +2 -1
  106. package/dist/parse-error.d.ts +2 -1
  107. package/dist/parse-error.js +19 -12
  108. package/dist/policy.cjs +0 -0
  109. package/dist/policy.js +0 -0
  110. package/dist/processors.cjs +1 -1
  111. package/dist/processors.d.cts +1 -1
  112. package/dist/processors.d.ts +1 -1
  113. package/dist/processors.js +1 -1
  114. package/dist/{sampling-BR9fkSwx.d.cts → sampling-CM5S2Lp3.d.ts} +5 -6
  115. package/dist/{sampling-CP3e7-Yr.d.ts → sampling-CmRdnXUi.d.cts} +5 -6
  116. package/dist/sampling.cjs +3 -2
  117. package/dist/sampling.d.cts +1 -1
  118. package/dist/sampling.d.ts +1 -1
  119. package/dist/sampling.js +3 -2
  120. package/dist/semantic-helpers.cjs +9 -9
  121. package/dist/semantic-helpers.d.cts +1 -1
  122. package/dist/semantic-helpers.d.ts +1 -1
  123. package/dist/semantic-helpers.js +9 -9
  124. package/dist/{stable-hash-ChFBIhNt.js → stable-hash-BkoAYVks.js} +4 -3
  125. package/dist/{stable-hash-CS9BxvVQ.cjs → stable-hash-C0pOegH_.cjs} +4 -3
  126. package/dist/{structured-error-CHg7DoIQ.cjs → structured-error--_wXpd_C.cjs} +34 -25
  127. package/dist/{structured-error-9--cxBay.js → structured-error-YIuka-FE.js} +34 -25
  128. package/dist/test-span-collector.cjs +15 -8
  129. package/dist/test-span-collector.js +15 -8
  130. package/dist/testing.cjs +16 -18
  131. package/dist/testing.d.cts +7 -6
  132. package/dist/testing.d.ts +7 -6
  133. package/dist/testing.js +16 -18
  134. package/dist/{trace-context-IuyoPyNq.d.cts → trace-context-C1Cn1q0y.d.cts} +8 -7
  135. package/dist/{trace-context-IuyoPyNq.d.ts → trace-context-f89xPJbK.d.ts} +8 -7
  136. package/dist/trace-helpers.cjs +16 -13
  137. package/dist/trace-helpers.d.cts +9 -4
  138. package/dist/trace-helpers.d.ts +9 -4
  139. package/dist/trace-helpers.js +16 -13
  140. package/dist/tracer-provider.cjs +8 -12
  141. package/dist/tracer-provider.js +8 -12
  142. package/dist/validate.cjs +22 -20
  143. package/dist/validate.d.cts +3 -2
  144. package/dist/validate.d.ts +3 -2
  145. package/dist/validate.js +22 -20
  146. package/dist/values-BenyvWKz.js +141 -0
  147. package/dist/values-CeMH-mYG.d.cts +8 -0
  148. package/dist/values-CeMH-mYG.d.ts +8 -0
  149. package/dist/values-DApyq53y.cjs +267 -0
  150. package/dist/webhook.cjs +3 -3
  151. package/dist/webhook.d.cts +1 -1
  152. package/dist/webhook.d.ts +1 -1
  153. package/dist/webhook.js +3 -3
  154. package/dist/workflow-distributed.cjs +9 -7
  155. package/dist/workflow-distributed.d.cts +9 -8
  156. package/dist/workflow-distributed.d.ts +9 -8
  157. package/dist/workflow-distributed.js +9 -7
  158. package/dist/workflow.cjs +26 -17
  159. package/dist/workflow.d.cts +1 -28
  160. package/dist/workflow.d.ts +1 -28
  161. package/dist/workflow.js +26 -17
  162. package/dist/yaml-config.cjs +26 -11
  163. package/dist/yaml-config.d.cts +9 -3
  164. package/dist/yaml-config.d.ts +9 -3
  165. package/dist/yaml-config.js +26 -11
  166. package/package.json +6 -1
@@ -1,3 +1,4 @@
1
+ import { l as asString } from "./values-BenyvWKz.js";
1
2
  import { REDACTOR_PATTERNS } from "./attribute-redacting-processor.js";
2
3
  import { C as URLAttributes, S as ThreadAttributes, _ as RPCAttributes, a as DeviceAttributes, b as SessionAttributes, c as FaaSAttributes, d as HTTPAttributes, f as K8sAttributes, g as ProcessAttributes, h as OTelAttributes, i as DBAttributes, l as FeatureFlagAttributes, m as NetworkAttributes, n as CodeAttributes, o as ErrorAttributes, p as MessagingAttributes, r as ContainerAttributes, s as ExceptionAttributes, t as CloudAttributes, u as GraphQLAttributes, v as ServerAddressAttributes, w as UserAttributes, x as TLSAttributes, y as ServiceAttributes } from "./registry-DVSmWg6Y.js";
3
4
  import { resourceFromAttributes } from "@opentelemetry/resources";
@@ -330,34 +331,34 @@ const attrs = {
330
331
  //#endregion
331
332
  //#region src/attributes/validators.ts
332
333
  /**
333
- * Attribute validation, PII detection, and guardrails
334
- * Provides safe-by-default attribute handling with configurable policies
334
+ * Attributes OpenTelemetry has renamed, mapped to their replacement - or to
335
+ * `null` where the convention dropped them outright.
335
336
  */
336
- const DEPRECATED_ATTRIBUTES = {
337
- "enduser.id": "user.id",
338
- "enduser.role": "user.roles",
339
- "enduser.scope": void 0,
340
- "http.method": "http.request.method",
341
- "http.host": "server.address",
342
- "http.status_code": "http.response.status_code",
343
- "http.target": "url.path",
344
- "http.url": "url.full",
345
- "http.user_agent": "user_agent.original",
346
- "http.flavor": "network.protocol.name",
347
- "http.scheme": "url.scheme",
348
- "http.server_name": "server.address",
349
- "db.name": "db.namespace",
350
- "db.operation": "db.operation.name",
351
- "db.statement": "db.query.text",
352
- "db.system": "db.system.name",
353
- "db.collection": "db.collection.name",
354
- "db.instance.id": void 0,
355
- "db.jdbc.driver_classname": void 0,
356
- "db.mssql.instance_name": "mssql.instance.name",
357
- "db.sql.table": "db.collection.name",
358
- "http.client_ip": "client.address",
359
- "user_agent.original": "user_agent.original"
360
- };
337
+ const DEPRECATED_ATTRIBUTES = /* @__PURE__ */ new Map([
338
+ ["enduser.id", "user.id"],
339
+ ["enduser.role", "user.roles"],
340
+ ["enduser.scope", null],
341
+ ["http.method", "http.request.method"],
342
+ ["http.host", "server.address"],
343
+ ["http.status_code", "http.response.status_code"],
344
+ ["http.target", "url.path"],
345
+ ["http.url", "url.full"],
346
+ ["http.user_agent", "user_agent.original"],
347
+ ["http.flavor", "network.protocol.name"],
348
+ ["http.scheme", "url.scheme"],
349
+ ["http.server_name", "server.address"],
350
+ ["db.name", "db.namespace"],
351
+ ["db.operation", "db.operation.name"],
352
+ ["db.statement", "db.query.text"],
353
+ ["db.system", "db.system.name"],
354
+ ["db.collection", "db.collection.name"],
355
+ ["db.instance.id", null],
356
+ ["db.jdbc.driver_classname", null],
357
+ ["db.mssql.instance_name", "mssql.instance.name"],
358
+ ["db.sql.table", "db.collection.name"],
359
+ ["http.client_ip", "client.address"],
360
+ ["user_agent.original", "user_agent.original"]
361
+ ]);
361
362
  const HTTP_METHODS = /* @__PURE__ */ new Set([
362
363
  "GET",
363
364
  "POST",
@@ -373,8 +374,8 @@ const HTTP_METHODS = /* @__PURE__ */ new Set([
373
374
  function validateAttribute(key, value, policy = {}) {
374
375
  const { guardrails = {} } = policy;
375
376
  if (value === void 0 || value === null) return;
376
- if (typeof value !== "string") return value;
377
- const stringValue = value;
377
+ const stringValue = asString(value);
378
+ if (stringValue === void 0) return value;
378
379
  if (guardrails.pii) {
379
380
  const piiResult = applyPIIPolicy(key, stringValue, guardrails.pii);
380
381
  if (piiResult !== stringValue) return piiResult;
@@ -443,13 +444,11 @@ function checkDeprecatedAttribute(key, policy = {}) {
443
444
  const { guardrails = {}, deprecatedWarnings = {} } = policy;
444
445
  const { warnDeprecated = true } = guardrails;
445
446
  if (!warnDeprecated) return null;
446
- if (key in DEPRECATED_ATTRIBUTES) {
447
- const replacement = DEPRECATED_ATTRIBUTES[key];
448
- if (replacement === void 0) console.warn(`[autotel/attributes] Attribute "${key}" is deprecated and has no replacement. Remove or find a replacement in OpenTelemetry semantic conventions.`);
449
- else console.warn(`[autotel/attributes] Attribute "${key}" is deprecated. Use "${replacement}" instead.`);
450
- }
447
+ const replacement = DEPRECATED_ATTRIBUTES.get(key) ?? null;
448
+ if (DEPRECATED_ATTRIBUTES.has(key)) if (replacement === null) console.warn(`[autotel/attributes] Attribute "${key}" is deprecated and has no replacement. Remove or find a replacement in OpenTelemetry semantic conventions.`);
449
+ else console.warn(`[autotel/attributes] Attribute "${key}" is deprecated. Use "${replacement}" instead.`);
451
450
  if (deprecatedWarnings[key]) console.warn(`[autotel/attributes] ${deprecatedWarnings[key]}`);
452
- return DEPRECATED_ATTRIBUTES[key] ?? null;
451
+ return replacement;
453
452
  }
454
453
  function autoRedactPII(attributes, policy = {}) {
455
454
  const { guardrails = { pii: "redact" } } = policy;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_attributes = require('./attributes-aDmJYral.cjs');
2
+ const require_attributes = require('./attributes-Cxys8tgr.cjs');
3
3
 
4
4
  exports.attrs = require_attributes.attrs;
5
5
  exports.autoRedactPII = require_attributes.autoRedactPII;
@@ -1,2 +1,2 @@
1
- import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, r as transaction, s as identify, t as mergeAttrs, u as setDevice, v as checkDeprecatedAttribute, w as CodeAttrs, x as attrs, y as defaultGuardrails, z as OTelAttrs } from "./index-BPcxVucm.cjs";
1
+ import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, r as transaction, s as identify, t as mergeAttrs, u as setDevice, v as checkDeprecatedAttribute, w as CodeAttrs, x as attrs, y as defaultGuardrails, z as OTelAttrs } from "./index-DQHf4cNl.cjs";
2
2
  export { type AttributeGuardrails, type AttributePolicy, type ClientAttrs, type CloudAttrs, type CodeAttrs, type ContainerAttrs, type DBAttrs, type DeploymentAttrs, type DeviceAttrs, type ErrorAttrs, type ExceptionAttrs, type FaaSAttrs, type FeatureFlagAttrs, type GraphQLAttrs, type HTTPClientAttrs, type HTTPServerAttrs, type K8sAttrs, type MessagingAttrs, type NetworkAttrs, type OTelAttrs, type PeerAttrs, type ProcessAttrs, type RPCAttrs, type ServerAddressAttrs, type ServiceAttrs, type SessionAttrs, type TLSAttrs, type ThreadAttrs, type URLAttrs, type UserAttrs, attrs, autoRedactPII, checkDeprecatedAttribute, dbClient, defaultGuardrails, httpClient, httpServer, identify, mergeAttrs, mergeServiceResource, request, safeSetAttributes, setDevice, setError, setException, setSession, setUser, transaction, validateAttribute };
@@ -1,2 +1,2 @@
1
- import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, r as transaction, s as identify, t as mergeAttrs, u as setDevice, v as checkDeprecatedAttribute, w as CodeAttrs, x as attrs, y as defaultGuardrails, z as OTelAttrs } from "./index-DolOVX6F.js";
1
+ import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, r as transaction, s as identify, t as mergeAttrs, u as setDevice, v as checkDeprecatedAttribute, w as CodeAttrs, x as attrs, y as defaultGuardrails, z as OTelAttrs } from "./index-CwrNAsgk.js";
2
2
  export { type AttributeGuardrails, type AttributePolicy, type ClientAttrs, type CloudAttrs, type CodeAttrs, type ContainerAttrs, type DBAttrs, type DeploymentAttrs, type DeviceAttrs, type ErrorAttrs, type ExceptionAttrs, type FaaSAttrs, type FeatureFlagAttrs, type GraphQLAttrs, type HTTPClientAttrs, type HTTPServerAttrs, type K8sAttrs, type MessagingAttrs, type NetworkAttrs, type OTelAttrs, type PeerAttrs, type ProcessAttrs, type RPCAttrs, type ServerAddressAttrs, type ServiceAttrs, type SessionAttrs, type TLSAttrs, type ThreadAttrs, type URLAttrs, type UserAttrs, attrs, autoRedactPII, checkDeprecatedAttribute, dbClient, defaultGuardrails, httpClient, httpServer, identify, mergeAttrs, mergeServiceResource, request, safeSetAttributes, setDevice, setError, setException, setSession, setUser, transaction, validateAttribute };
@@ -1,3 +1,3 @@
1
- import { _ as defaultGuardrails, a as identify, c as setDevice, d as setSession, f as setUser, g as checkDeprecatedAttribute, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, t as transaction, u as setException, v as validateAttribute, y as attrs } from "./attributes-B7wix2VG.js";
1
+ import { _ as defaultGuardrails, a as identify, c as setDevice, d as setSession, f as setUser, g as checkDeprecatedAttribute, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, t as transaction, u as setException, v as validateAttribute, y as attrs } from "./attributes-Dt4YUYbP.js";
2
2
 
3
3
  export { attrs, autoRedactPII, checkDeprecatedAttribute, dbClient, defaultGuardrails, httpClient, httpServer, identify, mergeAttrs, mergeServiceResource, request, safeSetAttributes, setDevice, setError, setException, setSession, setUser, transaction, validateAttribute };
package/dist/auto.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
2
- const require_init = require('./init-CTtHITlX.cjs');
2
+ const require_init = require('./init-C5aHRqi2.cjs');
3
3
  const require_yaml_config = require('./yaml-config.cjs');
4
4
  let node_module = require("node:module");
5
5
  node_module = require_rolldown_runtime.__toESM(node_module, 1);
package/dist/auto.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as init } from "./init-WHYwyItd.js";
1
+ import { i as init } from "./init-DDyaLzeg.js";
2
2
  import { loadYamlConfig } from "./yaml-config.js";
3
3
  import * as nodeModule from "node:module";
4
4
  import { createAddHookMessageChannel } from "import-in-the-middle";
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_values = require('./values-DApyq53y.cjs');
2
3
  let _opentelemetry_api = require("@opentelemetry/api");
3
4
 
4
5
  //#region src/business-baggage.ts
@@ -107,42 +108,48 @@ function createSafeBaggageSchema(schema, options = {}) {
107
108
  }
108
109
  let stringValue;
109
110
  switch (fieldDef.type) {
110
- case "string":
111
- if (typeof value !== "string") {
111
+ case "string": {
112
+ const text = require_values.asString(value);
113
+ if (text === void 0) {
112
114
  onError?.({
113
115
  type: "validation",
114
116
  key,
115
- message: `Field "${key}" expected string, got ${typeof value}`,
117
+ message: `Field "${key}" expected string, got ${require_values.describeValue(value)}`,
116
118
  value
117
119
  });
118
120
  return null;
119
121
  }
120
- stringValue = value;
122
+ stringValue = text;
121
123
  break;
122
- case "number":
123
- if (typeof value !== "number" || Number.isNaN(value)) {
124
+ }
125
+ case "number": {
126
+ const numeric = require_values.asNumber(value);
127
+ if (numeric === void 0) {
124
128
  onError?.({
125
129
  type: "validation",
126
130
  key,
127
- message: `Field "${key}" expected number, got ${typeof value}`,
131
+ message: `Field "${key}" expected number, got ${require_values.describeValue(value)}`,
128
132
  value
129
133
  });
130
134
  return null;
131
135
  }
132
- stringValue = String(value);
136
+ stringValue = String(numeric);
133
137
  break;
134
- case "boolean":
135
- if (typeof value !== "boolean") {
138
+ }
139
+ case "boolean": {
140
+ const flag = require_values.asBoolean(value);
141
+ if (flag === void 0) {
136
142
  onError?.({
137
143
  type: "validation",
138
144
  key,
139
- message: `Field "${key}" expected boolean, got ${typeof value}`,
145
+ message: `Field "${key}" expected boolean, got ${require_values.describeValue(value)}`,
140
146
  value
141
147
  });
142
148
  return null;
143
149
  }
144
- stringValue = String(value);
150
+ stringValue = String(flag);
145
151
  break;
152
+ }
146
153
  case "enum":
147
154
  if (!fieldDef.values?.includes(String(value))) {
148
155
  onError?.({
@@ -1,9 +1,14 @@
1
- import { n as TraceContext } from "./trace-context-IuyoPyNq.cjs";
1
+ import { n as TraceContext } from "./trace-context-C1Cn1q0y.cjs";
2
2
  //#region src/business-baggage.d.ts
3
3
  /**
4
4
  * Supported field types in baggage schema
5
5
  */
6
6
  type BaggageFieldType = 'string' | 'number' | 'boolean' | 'enum';
7
+ /**
8
+ * What a caller may put in a baggage field: one of the scalars baggage can
9
+ * carry, or nothing - a field left out, or one waiting for its default.
10
+ */
11
+ type BaggageFieldValue = string | number | boolean | null | undefined;
7
12
  /**
8
13
  * Field definition in a baggage schema
9
14
  */
@@ -21,7 +26,7 @@ interface BaggageFieldDefinition {
21
26
  /** Whether field is required */
22
27
  required?: boolean;
23
28
  /** Custom validation function */
24
- validate?: (value: unknown) => boolean;
29
+ validate?: (value: BaggageFieldValue) => boolean;
25
30
  }
26
31
  /**
27
32
  * Options for creating a safe baggage schema
@@ -185,4 +190,4 @@ type BusinessBaggageValues = {
185
190
  channel?: 'web' | 'mobile' | 'api' | 'internal' | 'webhook' | 'scheduled';
186
191
  };
187
192
  //#endregion
188
- export { BaggageError, BaggageFieldDefinition, BaggageFieldType, BaggageSchemaDefinition, BusinessBaggage, BusinessBaggageValues, InferBaggageType, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema };
193
+ export { BaggageError, BaggageFieldDefinition, BaggageFieldType, BaggageFieldValue, BaggageSchemaDefinition, BusinessBaggage, BusinessBaggageValues, InferBaggageType, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema };
@@ -1,9 +1,14 @@
1
- import { n as TraceContext } from "./trace-context-IuyoPyNq.js";
1
+ import { n as TraceContext } from "./trace-context-f89xPJbK.js";
2
2
  //#region src/business-baggage.d.ts
3
3
  /**
4
4
  * Supported field types in baggage schema
5
5
  */
6
6
  type BaggageFieldType = 'string' | 'number' | 'boolean' | 'enum';
7
+ /**
8
+ * What a caller may put in a baggage field: one of the scalars baggage can
9
+ * carry, or nothing - a field left out, or one waiting for its default.
10
+ */
11
+ type BaggageFieldValue = string | number | boolean | null | undefined;
7
12
  /**
8
13
  * Field definition in a baggage schema
9
14
  */
@@ -21,7 +26,7 @@ interface BaggageFieldDefinition {
21
26
  /** Whether field is required */
22
27
  required?: boolean;
23
28
  /** Custom validation function */
24
- validate?: (value: unknown) => boolean;
29
+ validate?: (value: BaggageFieldValue) => boolean;
25
30
  }
26
31
  /**
27
32
  * Options for creating a safe baggage schema
@@ -185,4 +190,4 @@ type BusinessBaggageValues = {
185
190
  channel?: 'web' | 'mobile' | 'api' | 'internal' | 'webhook' | 'scheduled';
186
191
  };
187
192
  //#endregion
188
- export { BaggageError, BaggageFieldDefinition, BaggageFieldType, BaggageSchemaDefinition, BusinessBaggage, BusinessBaggageValues, InferBaggageType, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema };
193
+ export { BaggageError, BaggageFieldDefinition, BaggageFieldType, BaggageFieldValue, BaggageSchemaDefinition, BusinessBaggage, BusinessBaggageValues, InferBaggageType, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema };
@@ -1,3 +1,4 @@
1
+ import { f as describeValue, i as asNumber, l as asString, t as asBoolean } from "./values-BenyvWKz.js";
1
2
  import { context, propagation } from "@opentelemetry/api";
2
3
 
3
4
  //#region src/business-baggage.ts
@@ -106,42 +107,48 @@ function createSafeBaggageSchema(schema, options = {}) {
106
107
  }
107
108
  let stringValue;
108
109
  switch (fieldDef.type) {
109
- case "string":
110
- if (typeof value !== "string") {
110
+ case "string": {
111
+ const text = asString(value);
112
+ if (text === void 0) {
111
113
  onError?.({
112
114
  type: "validation",
113
115
  key,
114
- message: `Field "${key}" expected string, got ${typeof value}`,
116
+ message: `Field "${key}" expected string, got ${describeValue(value)}`,
115
117
  value
116
118
  });
117
119
  return null;
118
120
  }
119
- stringValue = value;
121
+ stringValue = text;
120
122
  break;
121
- case "number":
122
- if (typeof value !== "number" || Number.isNaN(value)) {
123
+ }
124
+ case "number": {
125
+ const numeric = asNumber(value);
126
+ if (numeric === void 0) {
123
127
  onError?.({
124
128
  type: "validation",
125
129
  key,
126
- message: `Field "${key}" expected number, got ${typeof value}`,
130
+ message: `Field "${key}" expected number, got ${describeValue(value)}`,
127
131
  value
128
132
  });
129
133
  return null;
130
134
  }
131
- stringValue = String(value);
135
+ stringValue = String(numeric);
132
136
  break;
133
- case "boolean":
134
- if (typeof value !== "boolean") {
137
+ }
138
+ case "boolean": {
139
+ const flag = asBoolean(value);
140
+ if (flag === void 0) {
135
141
  onError?.({
136
142
  type: "validation",
137
143
  key,
138
- message: `Field "${key}" expected boolean, got ${typeof value}`,
144
+ message: `Field "${key}" expected boolean, got ${describeValue(value)}`,
139
145
  value
140
146
  });
141
147
  return null;
142
148
  }
143
- stringValue = String(value);
149
+ stringValue = String(flag);
144
150
  break;
151
+ }
145
152
  case "enum":
146
153
  if (!fieldDef.values?.includes(String(value))) {
147
154
  onError?.({
@@ -1,3 +1,4 @@
1
+ const require_values = require('./values-DApyq53y.cjs');
1
2
  let _opentelemetry_api_logs = require("@opentelemetry/api-logs");
2
3
 
3
4
  //#region src/pretty-log-formatter.ts
@@ -8,12 +9,12 @@ const RED = "\x1B[31m";
8
9
  const YELLOW = "\x1B[33m";
9
10
  const GREEN = "\x1B[32m";
10
11
  const CYAN = "\x1B[36m";
11
- const LEVEL_COLORS = {
12
- debug: "\x1B[90m",
13
- info: GREEN,
14
- warn: YELLOW,
15
- error: RED
16
- };
12
+ const LEVEL_COLORS = /* @__PURE__ */ new Map([
13
+ ["debug", "\x1B[90m"],
14
+ ["info", GREEN],
15
+ ["warn", YELLOW],
16
+ ["error", RED]
17
+ ]);
17
18
  /** Internal OTel attributes to skip in pretty output. */
18
19
  const SKIP_PREFIXES = [
19
20
  "telemetry.",
@@ -40,12 +41,10 @@ const SKIP_KEYS = /* @__PURE__ */ new Set([
40
41
  "http.response.status_code"
41
42
  ]);
42
43
  function useColor() {
43
- if (typeof process !== "undefined") {
44
- if (process.env.NO_COLOR) return false;
45
- if (process.env.FORCE_COLOR) return true;
46
- if (process.stdout?.isTTY) return true;
47
- }
48
- return false;
44
+ if (!require_values.hasProcess()) return false;
45
+ if (process.env.NO_COLOR) return false;
46
+ if (process.env.FORCE_COLOR) return true;
47
+ return process.stdout?.isTTY === true;
49
48
  }
50
49
  function c(color, text) {
51
50
  return useColor() ? `${color}${text}${RESET}` : text;
@@ -76,8 +75,10 @@ function formatTime(iso) {
76
75
  }
77
76
  }
78
77
  function formatValue(value) {
79
- if (typeof value === "string") return value;
80
- if (typeof value === "number" || typeof value === "boolean") return String(value);
78
+ const text = require_values.asString(value);
79
+ if (text !== void 0) return text;
80
+ const scalar = require_values.asNumber(value) ?? require_values.asBoolean(value);
81
+ if (scalar !== void 0) return String(scalar);
81
82
  if (value == null) return "";
82
83
  try {
83
84
  return JSON.stringify(value);
@@ -101,8 +102,13 @@ function groupAttributes(event) {
101
102
  let current = tree;
102
103
  for (let i = 0; i < parts.length - 1; i++) {
103
104
  const part = parts[i];
104
- if (!(part in current) || typeof current[part] !== "object") current[part] = {};
105
- current = current[part];
105
+ const branch = require_values.asRecord(current[part]);
106
+ if (branch) current = branch;
107
+ else {
108
+ const created = {};
109
+ current[part] = created;
110
+ current = created;
111
+ }
106
112
  }
107
113
  current[parts.at(-1)] = value;
108
114
  }
@@ -115,10 +121,11 @@ function renderTree(obj, indent, isLast) {
115
121
  for (const [idx, [key, value]] of entries.entries()) {
116
122
  const last = idx === entries.length - 1;
117
123
  const prefix = indent + (last ? "└─" : "├─") + " ";
118
- if (value && typeof value === "object" && !Array.isArray(value)) {
119
- const nested = value;
120
- const flatValues = Object.entries(nested).filter(([, v]) => typeof v !== "object" || v === null);
121
- if (Object.entries(nested).filter(([, v]) => typeof v === "object" && v !== null && !Array.isArray(v)).length === 0) {
124
+ const nested = require_values.asRecord(value);
125
+ if (nested) {
126
+ const nestedObjs = Object.entries(nested).filter(([, v]) => require_values.asRecord(v));
127
+ const flatValues = Object.entries(nested).filter(([, v]) => require_values.asRecord(v) === void 0);
128
+ if (nestedObjs.length === 0) {
122
129
  const inline = flatValues.map(([k, v]) => `${c(CYAN, k)}=${formatValue(v)}`).join(" ");
123
130
  lines.push(`${prefix}${c(BOLD, key)}: ${inline}`);
124
131
  } else {
@@ -141,7 +148,7 @@ function formatPrettyLogLine(ctx) {
141
148
  const path = event["http.route"] || event["url.path"] || "";
142
149
  const status = event["http.response.status_code"] || "";
143
150
  const duration = formatDuration(Number(event.duration_ms ?? 0));
144
- const levelStr = c(LEVEL_COLORS[level] ?? "", level.toUpperCase().padEnd(5));
151
+ const levelStr = c(LEVEL_COLORS.get(level) ?? "", level.toUpperCase().padEnd(5));
145
152
  const parts = [c(DIM, timestamp), levelStr];
146
153
  if (service) parts.push(c(DIM, `[${service}]`));
147
154
  if (method) parts.push(c(BOLD, String(method)));
@@ -162,6 +169,12 @@ function formatPrettyLogLine(ctx) {
162
169
 
163
170
  //#endregion
164
171
  //#region src/processors/canonical-log-line-processor.ts
172
+ const SEVERITY_NUMBERS = /* @__PURE__ */ new Map([
173
+ ["debug", _opentelemetry_api_logs.SeverityNumber.DEBUG],
174
+ ["info", _opentelemetry_api_logs.SeverityNumber.INFO],
175
+ ["warn", _opentelemetry_api_logs.SeverityNumber.WARN],
176
+ ["error", _opentelemetry_api_logs.SeverityNumber.ERROR]
177
+ ]);
165
178
  /**
166
179
  * Span processor that automatically emits spans as canonical log lines
167
180
  *
@@ -241,7 +254,7 @@ var CanonicalLogLineProcessor = class {
241
254
  this.shouldEmit = options.shouldEmit ?? this.buildKeepPredicate(options.keep);
242
255
  this.drain = options.drain;
243
256
  this.onDrainError = options.onDrainError;
244
- this.pretty = options.pretty ?? (typeof process !== "undefined" && process.env.NODE_ENV === "development");
257
+ this.pretty = options.pretty ?? (require_values.hasProcess() && process.env.NODE_ENV === "development");
245
258
  if (!this.logger) this.getOTelLogger = () => _opentelemetry_api_logs.logs.getLogger("autotel.canonical-log-line");
246
259
  }
247
260
  buildKeepPredicate(keep) {
@@ -319,8 +332,11 @@ var CanonicalLogLineProcessor = class {
319
332
  }
320
333
  emitViaOTel(level, message, canonicalLogLine, otelLogger) {
321
334
  const otelAttributes = {};
322
- for (const [key, value] of Object.entries(canonicalLogLine)) if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") otelAttributes[key] = value;
323
- else if (value !== null && value !== void 0) otelAttributes[key] = String(value);
335
+ for (const [key, value] of Object.entries(canonicalLogLine)) {
336
+ const scalar = require_values.asString(value) ?? require_values.asNumber(value) ?? require_values.asBoolean(value);
337
+ if (scalar !== void 0) otelAttributes[key] = scalar;
338
+ else if (value !== null && value !== void 0) otelAttributes[key] = String(value);
339
+ }
324
340
  otelLogger.emit({
325
341
  severityNumber: this.getSeverityNumber(level),
326
342
  severityText: level.toUpperCase(),
@@ -344,15 +360,10 @@ var CanonicalLogLineProcessor = class {
344
360
  return levels.indexOf(level) >= levels.indexOf(this.minLevel);
345
361
  }
346
362
  getSeverityNumber(level) {
347
- return {
348
- debug: _opentelemetry_api_logs.SeverityNumber.DEBUG,
349
- info: _opentelemetry_api_logs.SeverityNumber.INFO,
350
- warn: _opentelemetry_api_logs.SeverityNumber.WARN,
351
- error: _opentelemetry_api_logs.SeverityNumber.ERROR
352
- }[level] ?? _opentelemetry_api_logs.SeverityNumber.INFO;
363
+ return SEVERITY_NUMBERS.get(level) ?? _opentelemetry_api_logs.SeverityNumber.INFO;
353
364
  }
354
- reportInternalWarning(message, error) {
355
- const err = error instanceof Error ? error.message : String(error ?? "unknown error");
365
+ reportInternalWarning(message, cause) {
366
+ const err = cause === void 0 ? "unknown error" : require_values.toError(cause).message;
356
367
  if (this.logger) {
357
368
  this.logger.warn({ error: err }, `[autotel] ${message}`);
358
369
  return;
@@ -1,4 +1,5 @@
1
- import { s as Logger } from "./logger-CN4xpzMd.cjs";
1
+ import { t as UnknownRecord } from "./values-CeMH-mYG.js";
2
+ import { s as Logger } from "./logger-S1Fgl0g3.js";
2
3
  import { ReadableSpan, SpanProcessor } from "@opentelemetry/sdk-trace-base";
3
4
  import { AttributeValue } from "@opentelemetry/api";
4
5
  //#region src/processors/canonical-log-line-processor.d.ts
@@ -10,7 +11,7 @@ interface CanonicalLogLineEvent {
10
11
  span: ReadableSpan;
11
12
  level: 'debug' | 'info' | 'warn' | 'error';
12
13
  message: string;
13
- event: Record<string, unknown>;
14
+ event: UnknownRecord;
14
15
  }
15
16
  interface KeepCondition {
16
17
  /** Keep events where HTTP status >= this value. */
@@ -50,7 +51,7 @@ interface CanonicalLogLineOptions {
50
51
  /** Callback invoked after emit for custom fan-out. */
51
52
  drain?: (ctx: CanonicalLogLineEvent) => void | Promise<void>;
52
53
  /** Handler for drain failures. */
53
- onDrainError?: (error: unknown, ctx: CanonicalLogLineEvent) => void;
54
+ onDrainError?: (cause: unknown, ctx: CanonicalLogLineEvent) => void;
54
55
  /**
55
56
  * Pretty-print canonical log lines to console in a tree format.
56
57
  * Defaults to true when NODE_ENV is 'development'.