autotel 6.4.1 → 7.0.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.
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-AT22vCw6.d.ts → functional-CJn2zY4o.d.cts} +96 -39
  59. package/dist/{functional-e6jw5zQj.d.cts → functional-DXy1cHFF.d.ts} +96 -39
  60. package/dist/{functional-qZxRcIBp.cjs → functional-Da6Yv64r.cjs} +27 -15
  61. package/dist/{functional-0o9xSedq.js → functional-uSbNnnxK.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-CsODvlau.d.ts → init-BgnYi2sm.d.ts} +94 -90
  75. package/dist/{init-BnxHAi2M.cjs → init-D4m5rCmD.cjs} +142 -123
  76. package/dist/{init-Cc7-vvzj.d.cts → init-DrlL1eis.d.cts} +94 -90
  77. package/dist/{init-BxfZ3Vbw.js → init-JtX-KKz_.js} +137 -124
  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,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_node_require = require('./node-require-PFqDihze.cjs');
2
+ const require_values = require('./values-DApyq53y.cjs');
3
+ const require_node_require = require('./node-require-EifOMikz.cjs');
3
4
  let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
4
5
  let _opentelemetry_api = require("@opentelemetry/api");
5
6
  let _opentelemetry_api_logs = require("@opentelemetry/api-logs");
@@ -37,12 +38,13 @@ function diagnosticsChannelAvailable() {
37
38
  function subscribeChannel(name, handler) {
38
39
  const dc = loadDiagnosticsChannel();
39
40
  if (!dc?.subscribe) return () => {};
40
- dc.subscribe(name, handler);
41
+ const listener = handler;
42
+ dc.subscribe(name, listener);
41
43
  let active = true;
42
44
  return () => {
43
45
  if (!active) return;
44
46
  active = false;
45
- dc.unsubscribe?.(name, handler);
47
+ dc.unsubscribe?.(name, listener);
46
48
  };
47
49
  }
48
50
  /**
@@ -53,12 +55,13 @@ function subscribeChannel(name, handler) {
53
55
  function subscribeTracingChannel(name, handlers) {
54
56
  const channel = loadDiagnosticsChannel()?.tracingChannel?.(name);
55
57
  if (!channel) return () => {};
56
- channel.subscribe(handlers);
58
+ const subset = handlers;
59
+ channel.subscribe(subset);
57
60
  let active = true;
58
61
  return () => {
59
62
  if (!active) return;
60
63
  active = false;
61
- channel.unsubscribe(handlers);
64
+ channel.unsubscribe(subset);
62
65
  };
63
66
  }
64
67
 
@@ -93,27 +96,26 @@ const ALL_LEVELS = [
93
96
  "warn",
94
97
  "error"
95
98
  ];
96
- const SEVERITY = {
97
- debug: _opentelemetry_api_logs.SeverityNumber.DEBUG,
98
- log: _opentelemetry_api_logs.SeverityNumber.INFO,
99
- info: _opentelemetry_api_logs.SeverityNumber.INFO,
100
- warn: _opentelemetry_api_logs.SeverityNumber.WARN,
101
- error: _opentelemetry_api_logs.SeverityNumber.ERROR
102
- };
99
+ const SEVERITY = /* @__PURE__ */ new Map([
100
+ ["debug", _opentelemetry_api_logs.SeverityNumber.DEBUG],
101
+ ["log", _opentelemetry_api_logs.SeverityNumber.INFO],
102
+ ["info", _opentelemetry_api_logs.SeverityNumber.INFO],
103
+ ["warn", _opentelemetry_api_logs.SeverityNumber.WARN],
104
+ ["error", _opentelemetry_api_logs.SeverityNumber.ERROR]
105
+ ]);
103
106
  /**
104
107
  * Node publishes `console.*` channel messages as the raw argument array
105
108
  * (e.g. `console.warn('a', 1)` → `['a', 1]`); some publishers use the
106
109
  * `{ args: [...] }` object shape instead. Accept both.
107
110
  */
108
111
  function messageArgs(message) {
109
- if (Array.isArray(message)) return message;
110
- return message?.args ?? [];
112
+ return Array.isArray(message) ? message : message?.args ?? [];
111
113
  }
112
114
  const nodeUtil = require_node_require.safeRequire("node:util");
113
115
  /** Format console arguments the way `console` itself would (printf + inspect). */
114
116
  function formatArgs(args) {
115
117
  if (nodeUtil?.format) return nodeUtil.format(...args);
116
- return args.map((a) => typeof a === "string" ? a : safeStringify(a)).join(" ");
118
+ return args.map((a) => require_values.asString(a) ?? safeStringify(a)).join(" ");
117
119
  }
118
120
  function safeStringify(value) {
119
121
  try {
@@ -144,7 +146,7 @@ function captureConsole(options = {}) {
144
146
  ...options.attributes
145
147
  };
146
148
  if (toLog) logger.emit({
147
- severityNumber: SEVERITY[level],
149
+ severityNumber: SEVERITY.get(level),
148
150
  severityText: level.toUpperCase(),
149
151
  body,
150
152
  attributes
@@ -17,27 +17,31 @@ import { Attributes, Tracer } from "@opentelemetry/api";
17
17
  */
18
18
  /** Whether Node's `diagnostics_channel` is available in this runtime. */
19
19
  declare function diagnosticsChannelAvailable(): boolean;
20
- /** Handler for a plain named channel. */
21
- type ChannelMessageHandler = (message: unknown, name: string | symbol) => void;
20
+ /**
21
+ * Handler for a plain named channel. `TMessage` is whatever the publisher on
22
+ * that channel sends - a subscriber that knows the channel says so; one that
23
+ * does not gets `unknown` and decodes it itself.
24
+ */
25
+ type ChannelMessageHandler<TMessage = unknown> = (message: TMessage, name: string | symbol) => void;
22
26
  /**
23
27
  * Subscribe to a named diagnostics channel. Returns an idempotent unsubscribe
24
28
  * function; a no-op (that still returns a disposer) on unsupported runtimes.
25
29
  */
26
- declare function subscribeChannel(name: string, handler: ChannelMessageHandler): () => void;
30
+ declare function subscribeChannel<TMessage = unknown>(name: string, handler: ChannelMessageHandler<TMessage>): () => void;
27
31
  /** Subscriber set for a {@link https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel TracingChannel}. */
28
- interface TracingChannelHandlers {
29
- start?(message: unknown): void;
30
- end?(message: unknown): void;
31
- asyncStart?(message: unknown): void;
32
- asyncEnd?(message: unknown): void;
33
- error?(message: unknown): void;
32
+ interface TracingChannelHandlers<TMessage = unknown> {
33
+ start?(message: TMessage): void;
34
+ end?(message: TMessage): void;
35
+ asyncStart?(message: TMessage): void;
36
+ asyncEnd?(message: TMessage): void;
37
+ error?(message: TMessage): void;
34
38
  }
35
39
  /**
36
40
  * Subscribe to a `tracingChannel` (the `tracing:${name}:{start,end,…}` set).
37
41
  * Returns an idempotent unsubscribe; a no-op on runtimes without
38
42
  * `tracingChannel` support.
39
43
  */
40
- declare function subscribeTracingChannel(name: string, handlers: TracingChannelHandlers): () => void;
44
+ declare function subscribeTracingChannel<TMessage = unknown>(name: string, handlers: TracingChannelHandlers<TMessage>): () => void;
41
45
  //#endregion
42
46
  //#region src/diagnostics/console.d.ts
43
47
  /** Console methods that publish a diagnostics channel. */
@@ -17,27 +17,31 @@ import { Attributes, Tracer } from "@opentelemetry/api";
17
17
  */
18
18
  /** Whether Node's `diagnostics_channel` is available in this runtime. */
19
19
  declare function diagnosticsChannelAvailable(): boolean;
20
- /** Handler for a plain named channel. */
21
- type ChannelMessageHandler = (message: unknown, name: string | symbol) => void;
20
+ /**
21
+ * Handler for a plain named channel. `TMessage` is whatever the publisher on
22
+ * that channel sends - a subscriber that knows the channel says so; one that
23
+ * does not gets `unknown` and decodes it itself.
24
+ */
25
+ type ChannelMessageHandler<TMessage = unknown> = (message: TMessage, name: string | symbol) => void;
22
26
  /**
23
27
  * Subscribe to a named diagnostics channel. Returns an idempotent unsubscribe
24
28
  * function; a no-op (that still returns a disposer) on unsupported runtimes.
25
29
  */
26
- declare function subscribeChannel(name: string, handler: ChannelMessageHandler): () => void;
30
+ declare function subscribeChannel<TMessage = unknown>(name: string, handler: ChannelMessageHandler<TMessage>): () => void;
27
31
  /** Subscriber set for a {@link https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel TracingChannel}. */
28
- interface TracingChannelHandlers {
29
- start?(message: unknown): void;
30
- end?(message: unknown): void;
31
- asyncStart?(message: unknown): void;
32
- asyncEnd?(message: unknown): void;
33
- error?(message: unknown): void;
32
+ interface TracingChannelHandlers<TMessage = unknown> {
33
+ start?(message: TMessage): void;
34
+ end?(message: TMessage): void;
35
+ asyncStart?(message: TMessage): void;
36
+ asyncEnd?(message: TMessage): void;
37
+ error?(message: TMessage): void;
34
38
  }
35
39
  /**
36
40
  * Subscribe to a `tracingChannel` (the `tracing:${name}:{start,end,…}` set).
37
41
  * Returns an idempotent unsubscribe; a no-op on runtimes without
38
42
  * `tracingChannel` support.
39
43
  */
40
- declare function subscribeTracingChannel(name: string, handlers: TracingChannelHandlers): () => void;
44
+ declare function subscribeTracingChannel<TMessage = unknown>(name: string, handlers: TracingChannelHandlers<TMessage>): () => void;
41
45
  //#endregion
42
46
  //#region src/diagnostics/console.d.ts
43
47
  /** Console methods that publish a diagnostics channel. */
@@ -1,4 +1,5 @@
1
- import { n as safeRequire } from "./node-require-vROmTeJ8.js";
1
+ import { l as asString } from "./values-BenyvWKz.js";
2
+ import { n as safeRequire } from "./node-require-DSPjaw_l.js";
2
3
  import { ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_NETWORK_PROTOCOL_VERSION, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_URL_FULL, ATTR_URL_PATH, ATTR_URL_SCHEME, ATTR_USER_AGENT_ORIGINAL } from "@opentelemetry/semantic-conventions";
3
4
  import { SpanKind, SpanStatusCode, context, defaultTextMapGetter, defaultTextMapSetter, propagation, trace } from "@opentelemetry/api";
4
5
  import { SeverityNumber, logs } from "@opentelemetry/api-logs";
@@ -36,12 +37,13 @@ function diagnosticsChannelAvailable() {
36
37
  function subscribeChannel(name, handler) {
37
38
  const dc = loadDiagnosticsChannel();
38
39
  if (!dc?.subscribe) return () => {};
39
- dc.subscribe(name, handler);
40
+ const listener = handler;
41
+ dc.subscribe(name, listener);
40
42
  let active = true;
41
43
  return () => {
42
44
  if (!active) return;
43
45
  active = false;
44
- dc.unsubscribe?.(name, handler);
46
+ dc.unsubscribe?.(name, listener);
45
47
  };
46
48
  }
47
49
  /**
@@ -52,12 +54,13 @@ function subscribeChannel(name, handler) {
52
54
  function subscribeTracingChannel(name, handlers) {
53
55
  const channel = loadDiagnosticsChannel()?.tracingChannel?.(name);
54
56
  if (!channel) return () => {};
55
- channel.subscribe(handlers);
57
+ const subset = handlers;
58
+ channel.subscribe(subset);
56
59
  let active = true;
57
60
  return () => {
58
61
  if (!active) return;
59
62
  active = false;
60
- channel.unsubscribe(handlers);
63
+ channel.unsubscribe(subset);
61
64
  };
62
65
  }
63
66
 
@@ -92,27 +95,26 @@ const ALL_LEVELS = [
92
95
  "warn",
93
96
  "error"
94
97
  ];
95
- const SEVERITY = {
96
- debug: SeverityNumber.DEBUG,
97
- log: SeverityNumber.INFO,
98
- info: SeverityNumber.INFO,
99
- warn: SeverityNumber.WARN,
100
- error: SeverityNumber.ERROR
101
- };
98
+ const SEVERITY = /* @__PURE__ */ new Map([
99
+ ["debug", SeverityNumber.DEBUG],
100
+ ["log", SeverityNumber.INFO],
101
+ ["info", SeverityNumber.INFO],
102
+ ["warn", SeverityNumber.WARN],
103
+ ["error", SeverityNumber.ERROR]
104
+ ]);
102
105
  /**
103
106
  * Node publishes `console.*` channel messages as the raw argument array
104
107
  * (e.g. `console.warn('a', 1)` → `['a', 1]`); some publishers use the
105
108
  * `{ args: [...] }` object shape instead. Accept both.
106
109
  */
107
110
  function messageArgs(message) {
108
- if (Array.isArray(message)) return message;
109
- return message?.args ?? [];
111
+ return Array.isArray(message) ? message : message?.args ?? [];
110
112
  }
111
113
  const nodeUtil = safeRequire("node:util");
112
114
  /** Format console arguments the way `console` itself would (printf + inspect). */
113
115
  function formatArgs(args) {
114
116
  if (nodeUtil?.format) return nodeUtil.format(...args);
115
- return args.map((a) => typeof a === "string" ? a : safeStringify(a)).join(" ");
117
+ return args.map((a) => asString(a) ?? safeStringify(a)).join(" ");
116
118
  }
117
119
  function safeStringify(value) {
118
120
  try {
@@ -143,7 +145,7 @@ function captureConsole(options = {}) {
143
145
  ...options.attributes
144
146
  };
145
147
  if (toLog) logger.emit({
146
- severityNumber: SEVERITY[level],
148
+ severityNumber: SEVERITY.get(level),
147
149
  severityText: level.toUpperCase(),
148
150
  body,
149
151
  attributes
@@ -23,7 +23,7 @@
23
23
  * @example Use pre-built subscribers
24
24
  * ```typescript
25
25
  * import { Event } from 'autotel/event';
26
- * import { PostHogSubscriber } from 'autotel-subscribers/posthog';
26
+ * import { PostHogSubscriber } from 'autotel-posthog/subscriber';
27
27
  * import { MixpanelSubscriber } from 'autotel-subscribers/mixpanel';
28
28
  *
29
29
  * const event =new Event('checkout', {
@@ -35,13 +35,23 @@
35
35
  * ```
36
36
  */
37
37
  /**
38
- * Event attributes (supports any JSON-serializable values)
38
+ * A JSON-serializable value: what an event attribute can hold.
39
39
  *
40
- * Allows primitive types for flat attributes and unknown for flexibility
41
- * with nested objects when using subscribers that support JSON payloads
42
- * (e.g., WebhookSubscriber).
40
+ * Attributes are serialized by every subscriber - to a webhook body, a Loki
41
+ * line, a Mixpanel property - so a value that cannot survive JSON has no
42
+ * meaning here. Naming that is what lets a subscriber read an attribute
43
+ * without asserting its shape first.
43
44
  */
44
- type EventAttributes = Record<string, unknown>;
45
+ type EventAttributeValue = string | number | boolean | null | undefined | Date | Array<EventAttributeValue> | {
46
+ [key: string]: EventAttributeValue;
47
+ };
48
+ /**
49
+ * Event attributes (any JSON-serializable values)
50
+ *
51
+ * Flat primitives for most events; nested objects and arrays for subscribers
52
+ * that send JSON payloads (e.g., WebhookSubscriber).
53
+ */
54
+ type EventAttributes = Record<string, EventAttributeValue>;
45
55
  /**
46
56
  * Permissive input type for event attributes
47
57
  *
@@ -73,7 +83,7 @@ type OutcomeStatus = 'success' | 'failure' | 'partial';
73
83
  * This structured object contains trace context and correlation IDs.
74
84
  * Subscribers decide how to map/flatten these for their platform.
75
85
  */
76
- interface AutotelEventContext {
86
+ type AutotelEventContext = {
77
87
  /** Trace ID (32 hex chars) - present when inside a trace */
78
88
  trace_id?: string;
79
89
  /** Span ID (16 hex chars) - present when inside a span */
@@ -92,7 +102,7 @@ interface AutotelEventContext {
92
102
  linked_trace_id_hash?: string;
93
103
  /** Full array of linked trace IDs (only if includeLinkedTraceIds: true) */
94
104
  linked_trace_ids?: string[];
95
- }
105
+ };
96
106
  /**
97
107
  * Optional machine-readable schema metadata attached to an event payload.
98
108
  * Intended for contract-aware subscribers (e.g. architecture snapshot capture).
@@ -219,4 +229,4 @@ interface EventSubscriber {
219
229
  readonly version?: string;
220
230
  }
221
231
  //#endregion
222
- export { EventSubscriber as a, OutcomeStatus as c, EventSchemaMetadata as i, EventAttributes as n, EventTrackingOptions as o, EventAttributesInput as r, FunnelStatus as s, AutotelEventContext as t };
232
+ export { EventSchemaMetadata as a, FunnelStatus as c, EventAttributesInput as i, OutcomeStatus as l, EventAttributeValue as n, EventSubscriber as o, EventAttributes as r, EventTrackingOptions as s, AutotelEventContext as t };
@@ -23,7 +23,7 @@
23
23
  * @example Use pre-built subscribers
24
24
  * ```typescript
25
25
  * import { Event } from 'autotel/event';
26
- * import { PostHogSubscriber } from 'autotel-subscribers/posthog';
26
+ * import { PostHogSubscriber } from 'autotel-posthog/subscriber';
27
27
  * import { MixpanelSubscriber } from 'autotel-subscribers/mixpanel';
28
28
  *
29
29
  * const event =new Event('checkout', {
@@ -35,13 +35,23 @@
35
35
  * ```
36
36
  */
37
37
  /**
38
- * Event attributes (supports any JSON-serializable values)
38
+ * A JSON-serializable value: what an event attribute can hold.
39
39
  *
40
- * Allows primitive types for flat attributes and unknown for flexibility
41
- * with nested objects when using subscribers that support JSON payloads
42
- * (e.g., WebhookSubscriber).
40
+ * Attributes are serialized by every subscriber - to a webhook body, a Loki
41
+ * line, a Mixpanel property - so a value that cannot survive JSON has no
42
+ * meaning here. Naming that is what lets a subscriber read an attribute
43
+ * without asserting its shape first.
43
44
  */
44
- type EventAttributes = Record<string, unknown>;
45
+ type EventAttributeValue = string | number | boolean | null | undefined | Date | Array<EventAttributeValue> | {
46
+ [key: string]: EventAttributeValue;
47
+ };
48
+ /**
49
+ * Event attributes (any JSON-serializable values)
50
+ *
51
+ * Flat primitives for most events; nested objects and arrays for subscribers
52
+ * that send JSON payloads (e.g., WebhookSubscriber).
53
+ */
54
+ type EventAttributes = Record<string, EventAttributeValue>;
45
55
  /**
46
56
  * Permissive input type for event attributes
47
57
  *
@@ -73,7 +83,7 @@ type OutcomeStatus = 'success' | 'failure' | 'partial';
73
83
  * This structured object contains trace context and correlation IDs.
74
84
  * Subscribers decide how to map/flatten these for their platform.
75
85
  */
76
- interface AutotelEventContext {
86
+ type AutotelEventContext = {
77
87
  /** Trace ID (32 hex chars) - present when inside a trace */
78
88
  trace_id?: string;
79
89
  /** Span ID (16 hex chars) - present when inside a span */
@@ -92,7 +102,7 @@ interface AutotelEventContext {
92
102
  linked_trace_id_hash?: string;
93
103
  /** Full array of linked trace IDs (only if includeLinkedTraceIds: true) */
94
104
  linked_trace_ids?: string[];
95
- }
105
+ };
96
106
  /**
97
107
  * Optional machine-readable schema metadata attached to an event payload.
98
108
  * Intended for contract-aware subscribers (e.g. architecture snapshot capture).
@@ -219,4 +229,4 @@ interface EventSubscriber {
219
229
  readonly version?: string;
220
230
  }
221
231
  //#endregion
222
- export { EventSubscriber as a, OutcomeStatus as c, EventSchemaMetadata as i, EventAttributes as n, EventTrackingOptions as o, EventAttributesInput as r, FunnelStatus as s, AutotelEventContext as t };
232
+ export { EventSchemaMetadata as a, FunnelStatus as c, EventAttributesInput as i, OutcomeStatus as l, EventAttributeValue as n, EventSubscriber as o, EventAttributes as r, EventTrackingOptions as s, AutotelEventContext as t };
@@ -1,2 +1,2 @@
1
- import { a as EventSubscriber, c as OutcomeStatus, i as EventSchemaMetadata, n as EventAttributes, o as EventTrackingOptions, r as EventAttributesInput, s as FunnelStatus, t as AutotelEventContext } from "./event-subscriber-CWh8sTGh.cjs";
2
- export { AutotelEventContext, EventAttributes, EventAttributesInput, EventSchemaMetadata, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus };
1
+ import { a as EventSchemaMetadata, c as FunnelStatus, i as EventAttributesInput, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.cjs";
2
+ export { AutotelEventContext, EventAttributeValue, EventAttributes, EventAttributesInput, EventSchemaMetadata, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus };
@@ -1,2 +1,2 @@
1
- import { a as EventSubscriber, c as OutcomeStatus, i as EventSchemaMetadata, n as EventAttributes, o as EventTrackingOptions, r as EventAttributesInput, s as FunnelStatus, t as AutotelEventContext } from "./event-subscriber-CWh8sTGh.js";
2
- export { AutotelEventContext, EventAttributes, EventAttributesInput, EventSchemaMetadata, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus };
1
+ import { a as EventSchemaMetadata, c as FunnelStatus, i as EventAttributesInput, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.js";
2
+ export { AutotelEventContext, EventAttributeValue, EventAttributes, EventAttributesInput, EventSchemaMetadata, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus };
@@ -1,4 +1,4 @@
1
- import { c as OutcomeStatus, n as EventAttributes, s as FunnelStatus } from "./event-subscriber-CWh8sTGh.cjs";
1
+ import { c as FunnelStatus, l as OutcomeStatus, r as EventAttributes } from "./event-subscriber-DMACQA-1.cjs";
2
2
  //#region src/event-testing.d.ts
3
3
  interface EventData {
4
4
  event: string;
@@ -1,4 +1,4 @@
1
- import { c as OutcomeStatus, n as EventAttributes, s as FunnelStatus } from "./event-subscriber-CWh8sTGh.js";
1
+ import { c as FunnelStatus, l as OutcomeStatus, r as EventAttributes } from "./event-subscriber-DMACQA-1.js";
2
2
  //#region src/event-testing.d.ts
3
3
  interface EventData {
4
4
  event: string;
@@ -1,2 +1,2 @@
1
- import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-D0qWfqAy.cjs";
1
+ import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-CBtnJXE5.cjs";
2
2
  export { EventCollector, EventData, EventsFunnelStep, EventsOutcome, EventsValue, assertEventTracked, assertOutcomeTracked, createEventCollector };
@@ -1,2 +1,2 @@
1
- import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-CA2mIx1E.js";
1
+ import { a as EventsValue, c as createEventCollector, i as EventsOutcome, n as EventData, o as assertEventTracked, r as EventsFunnelStep, s as assertOutcomeTracked, t as EventCollector } from "./event-testing-CkPgV3Ii.js";
2
2
  export { EventCollector, EventData, EventsFunnelStep, EventsOutcome, EventsValue, assertEventTracked, assertOutcomeTracked, createEventCollector };
package/dist/event.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_init = require('./init-BnxHAi2M.cjs');
2
+ const require_init = require('./init-D4m5rCmD.cjs');
3
3
 
4
4
  exports.Event = require_init.Event;
5
5
  exports.getEvents = require_init.getEvents;
package/dist/event.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { s as Logger } from "./logger-CN4xpzMd.cjs";
2
- import { a as EventSubscriber, c as OutcomeStatus, n as EventAttributes, r as EventAttributesInput, s as FunnelStatus } from "./event-subscriber-CWh8sTGh.cjs";
3
- import { t as EventCollector } from "./event-testing-D0qWfqAy.cjs";
1
+ import { s as Logger } from "./logger-S1Fgl0g3.cjs";
2
+ import { c as FunnelStatus, i as EventAttributesInput, l as OutcomeStatus, o as EventSubscriber, r as EventAttributes } from "./event-subscriber-DMACQA-1.cjs";
3
+ import { t as EventCollector } from "./event-testing-CBtnJXE5.cjs";
4
4
  //#region src/event.d.ts
5
5
  /**
6
6
  * Events class for tracking user behavior and product events
@@ -58,7 +58,7 @@ declare class Event {
58
58
  * @example Recommended: Use track() with init()
59
59
  * ```typescript
60
60
  * import { init, track } from 'autotel';
61
- * import { PostHogSubscriber } from 'autotel-subscribers/posthog';
61
+ * import { PostHogSubscriber } from 'autotel-posthog/subscriber';
62
62
  *
63
63
  * init({
64
64
  * service: 'checkout',
@@ -78,7 +78,7 @@ declare class Event {
78
78
  * @example Override subscribers for this instance
79
79
  * ```typescript
80
80
  * import { Event } from 'autotel/event';
81
- * import { PostHogSubscriber } from 'autotel-subscribers/posthog';
81
+ * import { PostHogSubscriber } from 'autotel-posthog/subscriber';
82
82
  *
83
83
  * // Override: use different subscribers for this instance only
84
84
  * const event = new Event('checkout', {
package/dist/event.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { s as Logger } from "./logger-CN4xpzMd.js";
2
- import { a as EventSubscriber, c as OutcomeStatus, n as EventAttributes, r as EventAttributesInput, s as FunnelStatus } from "./event-subscriber-CWh8sTGh.js";
3
- import { t as EventCollector } from "./event-testing-CA2mIx1E.js";
1
+ import { s as Logger } from "./logger-S1Fgl0g3.js";
2
+ import { c as FunnelStatus, i as EventAttributesInput, l as OutcomeStatus, o as EventSubscriber, r as EventAttributes } from "./event-subscriber-DMACQA-1.js";
3
+ import { t as EventCollector } from "./event-testing-CkPgV3Ii.js";
4
4
  //#region src/event.d.ts
5
5
  /**
6
6
  * Events class for tracking user behavior and product events
@@ -58,7 +58,7 @@ declare class Event {
58
58
  * @example Recommended: Use track() with init()
59
59
  * ```typescript
60
60
  * import { init, track } from 'autotel';
61
- * import { PostHogSubscriber } from 'autotel-subscribers/posthog';
61
+ * import { PostHogSubscriber } from 'autotel-posthog/subscriber';
62
62
  *
63
63
  * init({
64
64
  * service: 'checkout',
@@ -78,7 +78,7 @@ declare class Event {
78
78
  * @example Override subscribers for this instance
79
79
  * ```typescript
80
80
  * import { Event } from 'autotel/event';
81
- * import { PostHogSubscriber } from 'autotel-subscribers/posthog';
81
+ * import { PostHogSubscriber } from 'autotel-posthog/subscriber';
82
82
  *
83
83
  * // Override: use different subscribers for this instance only
84
84
  * const event = new Event('checkout', {
package/dist/event.js CHANGED
@@ -1,3 +1,3 @@
1
- import { d as getEvents, f as resetEvents, u as Event } from "./init-BxfZ3Vbw.js";
1
+ import { d as getEvents, f as resetEvents, u as Event } from "./init-JtX-KKz_.js";
2
2
 
3
3
  export { Event, getEvents, resetEvents };
@@ -0,0 +1,133 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_values = require('./values-DApyq53y.cjs');
3
+
4
+ //#region src/exception-fingerprint.ts
5
+ /** Attribute the fingerprint is written to. */
6
+ const EXCEPTION_FINGERPRINT_ATTRIBUTE = "exception.fingerprint";
7
+ /**
8
+ * Frames deep enough to separate two different bugs, shallow enough that the
9
+ * same bug reached through different callers still groups.
10
+ */
11
+ const DEFAULT_FRAMES = 5;
12
+ const NODE_FRAME = /^at\s+(.+?)\s+\((.+?):(\d+):\d+\)$/;
13
+ const ANON_FRAME = /^at\s+(.+?):(\d+):\d+$/;
14
+ const BROWSER_FRAME = /^(.+?)@(.+?):(\d+):\d+$/;
15
+ /**
16
+ * Collapse a path to the part that identifies the code rather than the machine
17
+ * it ran on: a dependency becomes its package name, and an absolute path
18
+ * becomes the project-relative one. Without this, the same error fingerprints
19
+ * differently in CI, in Docker, and on a laptop.
20
+ */
21
+ function normalizeFilePath(filePath) {
22
+ const nodeModulesMatch = filePath.match(/node_modules\/(@[^/]+\/[^/]+|[^/]+)/);
23
+ if (nodeModulesMatch) return `[npm]/${nodeModulesMatch[1]}`;
24
+ return filePath.replace(/^.*?\/src\//, "src/").replace(/^.*?\/dist\//, "dist/").replace(/^.*?\/lib\//, "lib/").replace(/^file:\/\//, "");
25
+ }
26
+ /**
27
+ * Strip the parts of a message that change on every occurrence, so
28
+ * `timeout after 341ms` and `timeout after 78ms` are one issue rather than two.
29
+ */
30
+ function normalizeMessage(message) {
31
+ return message.replaceAll(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, "[UUID]").replaceAll(/\b[0-9a-f]{16,}\b/gi, "[ID]").replaceAll(/\d+/g, "[N]").replaceAll(/"[^"]*"/g, "\"[STR]\"").replaceAll(/'[^']*'/g, "'[STR]'").slice(0, 200);
32
+ }
33
+ /**
34
+ * `function@normalized-path` for the top N frames. Line and column are
35
+ * deliberately dropped: an edit one line above the throw is the same bug.
36
+ */
37
+ function normalizeStackFrames(stack, count) {
38
+ const frames = [];
39
+ for (const line of stack.split("\n")) {
40
+ if (frames.length >= count) break;
41
+ const trimmed = line.trim();
42
+ const node = NODE_FRAME.exec(trimmed);
43
+ if (node) {
44
+ frames.push(`${node[1] ?? "anonymous"}@${normalizeFilePath(node[2] ?? "")}`);
45
+ continue;
46
+ }
47
+ const anon = ANON_FRAME.exec(trimmed);
48
+ if (anon) {
49
+ frames.push(`anonymous@${normalizeFilePath(anon[1] ?? "")}`);
50
+ continue;
51
+ }
52
+ const browser = BROWSER_FRAME.exec(trimmed);
53
+ if (browser) frames.push(`${browser[1] ?? "anonymous"}@${normalizeFilePath(browser[2] ?? "")}`);
54
+ }
55
+ return frames;
56
+ }
57
+ /** 32-bit djb2-style hash, rendered as 8 hex characters. */
58
+ function hashFingerprintParts(parts) {
59
+ const value = parts.join("|");
60
+ let hash = 0;
61
+ for (let index = 0; index < value.length; index++) {
62
+ hash = (hash << 5) - hash + value.charCodeAt(index);
63
+ hash = hash & hash;
64
+ }
65
+ return Math.abs(hash).toString(16).padStart(8, "0");
66
+ }
67
+ /**
68
+ * Group key for an exception. Returns `undefined` when there is nothing to
69
+ * group on, so callers never write an attribute that means "no information".
70
+ */
71
+ function fingerprintException(input, frames = DEFAULT_FRAMES) {
72
+ const stackFrames = input.stack ? normalizeStackFrames(input.stack, frames) : [];
73
+ if (stackFrames.length === 0 && !input.message && !input.type) return;
74
+ const parts = [input.type || "Error"];
75
+ if (stackFrames.length > 0) parts.push(...stackFrames);
76
+ else if (input.message) parts.push(normalizeMessage(input.message));
77
+ return hashFingerprintParts(parts);
78
+ }
79
+ /**
80
+ * Read the error off a finished span, wherever it was recorded: the OTel
81
+ * `exception` event, the `exception.*` attributes autotel-web sets, or the
82
+ * `error.*` attributes structured errors write instead of an event.
83
+ */
84
+ function readException(span) {
85
+ const { attributes } = span;
86
+ const event = span.events?.find((e) => e.name === "exception");
87
+ const eventAttributes = event?.attributes ?? {};
88
+ const type = require_values.nonEmptyString(attributes["exception.type"]) ?? require_values.nonEmptyString(attributes["error.type"]) ?? require_values.nonEmptyString(eventAttributes["exception.type"]);
89
+ const stack = require_values.nonEmptyString(attributes["exception.stacktrace"]) ?? require_values.nonEmptyString(attributes["exception.stack"]) ?? require_values.nonEmptyString(attributes["error.stack"]) ?? require_values.nonEmptyString(eventAttributes["exception.stacktrace"]) ?? require_values.nonEmptyString(eventAttributes["exception.stack"]);
90
+ if (!type && !stack && !event) return void 0;
91
+ return {
92
+ type,
93
+ message: require_values.nonEmptyString(attributes["exception.message"]) ?? require_values.nonEmptyString(attributes["error.message"]) ?? require_values.nonEmptyString(eventAttributes["exception.message"]) ?? require_values.nonEmptyString(span.status.message),
94
+ stack
95
+ };
96
+ }
97
+ /**
98
+ * Span enricher that stamps {@link EXCEPTION_FINGERPRINT_ATTRIBUTE} on every
99
+ * span that recorded an exception.
100
+ *
101
+ * Pass it to `init({ spanEnrichers: [...] })` rather than `spanProcessors`:
102
+ * enrichers add to the pipeline instead of replacing it, and sit outside the
103
+ * redaction wrapper so the attribute reaches every exporter.
104
+ */
105
+ function exceptionFingerprint(options = {}) {
106
+ const frames = options.frames ?? DEFAULT_FRAMES;
107
+ return {
108
+ onStart(_span, _context) {},
109
+ onEnd(span) {
110
+ const { attributes } = span;
111
+ if (attributes["exception.fingerprint"] !== void 0) return;
112
+ const exception = readException(span);
113
+ if (!exception) return;
114
+ const fingerprint = fingerprintException(exception, frames);
115
+ if (fingerprint) attributes[EXCEPTION_FINGERPRINT_ATTRIBUTE] = fingerprint;
116
+ },
117
+ forceFlush() {
118
+ return Promise.resolve();
119
+ },
120
+ shutdown() {
121
+ return Promise.resolve();
122
+ }
123
+ };
124
+ }
125
+
126
+ //#endregion
127
+ exports.EXCEPTION_FINGERPRINT_ATTRIBUTE = EXCEPTION_FINGERPRINT_ATTRIBUTE;
128
+ exports.exceptionFingerprint = exceptionFingerprint;
129
+ exports.fingerprintException = fingerprintException;
130
+ exports.hashFingerprintParts = hashFingerprintParts;
131
+ exports.normalizeFilePath = normalizeFilePath;
132
+ exports.normalizeMessage = normalizeMessage;
133
+ exports.normalizeStackFrames = normalizeStackFrames;