autotel 2.26.0 → 2.26.2

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 (121) hide show
  1. package/dist/attribute-redacting-processor.cjs +14 -6
  2. package/dist/attribute-redacting-processor.d.cts +63 -1
  3. package/dist/attribute-redacting-processor.d.ts +63 -1
  4. package/dist/attribute-redacting-processor.js +1 -1
  5. package/dist/attributes.cjs +21 -21
  6. package/dist/attributes.js +2 -2
  7. package/dist/auto.cjs +8 -8
  8. package/dist/auto.js +6 -6
  9. package/dist/{chunk-RUD7KS4R.js → chunk-3SDILILG.js} +3 -3
  10. package/dist/{chunk-RUD7KS4R.js.map → chunk-3SDILILG.js.map} +1 -1
  11. package/dist/{chunk-B33XPEKY.js → chunk-55ER2KD5.js} +4 -4
  12. package/dist/chunk-55ER2KD5.js.map +1 -0
  13. package/dist/{chunk-UJJPTSEI.cjs → chunk-563EL6O6.cjs} +81 -14
  14. package/dist/chunk-563EL6O6.cjs.map +1 -0
  15. package/dist/{chunk-TS7IHIRW.cjs → chunk-6YGUN7IY.cjs} +5 -5
  16. package/dist/{chunk-TS7IHIRW.cjs.map → chunk-6YGUN7IY.cjs.map} +1 -1
  17. package/dist/{chunk-XDKK53OL.js → chunk-A4E5AQFK.js} +3 -3
  18. package/dist/{chunk-XDKK53OL.js.map → chunk-A4E5AQFK.js.map} +1 -1
  19. package/dist/{chunk-WAB4CHBU.js → chunk-BJ2XPN77.js} +3 -3
  20. package/dist/{chunk-WAB4CHBU.js.map → chunk-BJ2XPN77.js.map} +1 -1
  21. package/dist/{chunk-KZEC4CHV.cjs → chunk-CEAQK2QY.cjs} +5 -5
  22. package/dist/{chunk-KZEC4CHV.cjs.map → chunk-CEAQK2QY.cjs.map} +1 -1
  23. package/dist/chunk-CMNGGTQL.cjs +349 -0
  24. package/dist/chunk-CMNGGTQL.cjs.map +1 -0
  25. package/dist/{chunk-VYA6QDNA.js → chunk-DPSA4QLA.js} +4 -2
  26. package/dist/chunk-DPSA4QLA.js.map +1 -0
  27. package/dist/{chunk-M4US3P4K.js → chunk-ER43K7ES.js} +3 -3
  28. package/dist/{chunk-M4US3P4K.js.map → chunk-ER43K7ES.js.map} +1 -1
  29. package/dist/{chunk-AZ24DJAG.cjs → chunk-FU6R566Y.cjs} +4 -4
  30. package/dist/chunk-FU6R566Y.cjs.map +1 -0
  31. package/dist/{chunk-4PTCDOZY.js → chunk-HPUGKUMZ.js} +4 -4
  32. package/dist/{chunk-4PTCDOZY.js.map → chunk-HPUGKUMZ.js.map} +1 -1
  33. package/dist/{chunk-XRBP4RYL.cjs → chunk-JKIMEPI2.cjs} +4 -4
  34. package/dist/{chunk-XRBP4RYL.cjs.map → chunk-JKIMEPI2.cjs.map} +1 -1
  35. package/dist/{chunk-N344PVE5.cjs → chunk-OBWXM4NN.cjs} +9 -9
  36. package/dist/{chunk-N344PVE5.cjs.map → chunk-OBWXM4NN.cjs.map} +1 -1
  37. package/dist/{chunk-OFPZULMQ.cjs → chunk-OC6X2VIN.cjs} +8 -8
  38. package/dist/{chunk-OFPZULMQ.cjs.map → chunk-OC6X2VIN.cjs.map} +1 -1
  39. package/dist/{chunk-GTD3NXOS.js → chunk-QC5MNKVF.js} +4 -4
  40. package/dist/{chunk-GTD3NXOS.js.map → chunk-QC5MNKVF.js.map} +1 -1
  41. package/dist/chunk-TDNKIHKT.js +341 -0
  42. package/dist/chunk-TDNKIHKT.js.map +1 -0
  43. package/dist/{chunk-DGPUZ6TE.js → chunk-U54FTVFH.js} +3 -3
  44. package/dist/{chunk-DGPUZ6TE.js.map → chunk-U54FTVFH.js.map} +1 -1
  45. package/dist/{chunk-ZJ5GXCOT.cjs → chunk-UTZR7P7E.cjs} +36 -36
  46. package/dist/{chunk-ZJ5GXCOT.cjs.map → chunk-UTZR7P7E.cjs.map} +1 -1
  47. package/dist/{chunk-7FIGORWI.cjs → chunk-VH77IPJN.cjs} +4 -2
  48. package/dist/chunk-VH77IPJN.cjs.map +1 -0
  49. package/dist/{chunk-EXOXDI5A.js → chunk-W35FVJBC.js} +73 -8
  50. package/dist/chunk-W35FVJBC.js.map +1 -0
  51. package/dist/{chunk-II7GFVAF.cjs → chunk-WZOKY3PW.cjs} +13 -13
  52. package/dist/{chunk-II7GFVAF.cjs.map → chunk-WZOKY3PW.cjs.map} +1 -1
  53. package/dist/{chunk-CMADDTHY.cjs → chunk-YEVCD6DR.cjs} +7 -7
  54. package/dist/{chunk-CMADDTHY.cjs.map → chunk-YEVCD6DR.cjs.map} +1 -1
  55. package/dist/{chunk-RXFZKLRQ.js → chunk-YN7USLHW.js} +3 -3
  56. package/dist/{chunk-RXFZKLRQ.js.map → chunk-YN7USLHW.js.map} +1 -1
  57. package/dist/decorators.cjs +7 -7
  58. package/dist/decorators.js +7 -7
  59. package/dist/event.cjs +10 -10
  60. package/dist/event.js +7 -7
  61. package/dist/functional.cjs +14 -14
  62. package/dist/functional.js +7 -7
  63. package/dist/index.cjs +340 -97
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.d.cts +205 -3
  66. package/dist/index.d.ts +205 -3
  67. package/dist/index.js +257 -33
  68. package/dist/index.js.map +1 -1
  69. package/dist/{init-QSj7X6zU.d.cts → init-CMuTaFAV.d.cts} +26 -1
  70. package/dist/{init-FiR_glVc.d.ts → init-D6JfWEjL.d.ts} +26 -1
  71. package/dist/instrumentation.cjs +14 -14
  72. package/dist/instrumentation.js +6 -6
  73. package/dist/logger.cjs +8 -8
  74. package/dist/logger.js +1 -1
  75. package/dist/messaging.cjs +11 -11
  76. package/dist/messaging.js +8 -8
  77. package/dist/metric.cjs +1 -1
  78. package/dist/metric.js +1 -1
  79. package/dist/sampling.cjs +15 -15
  80. package/dist/sampling.js +2 -2
  81. package/dist/semantic-helpers.cjs +12 -12
  82. package/dist/semantic-helpers.js +8 -8
  83. package/dist/tail-sampling-processor.cjs +4 -4
  84. package/dist/tail-sampling-processor.js +3 -3
  85. package/dist/testing.cjs +1 -1
  86. package/dist/testing.js +1 -1
  87. package/dist/webhook.cjs +9 -8
  88. package/dist/webhook.cjs.map +1 -1
  89. package/dist/webhook.js +8 -7
  90. package/dist/webhook.js.map +1 -1
  91. package/dist/workflow-distributed.cjs +9 -9
  92. package/dist/workflow-distributed.js +7 -7
  93. package/dist/workflow.cjs +12 -12
  94. package/dist/workflow.js +8 -8
  95. package/dist/yaml-config.cjs +6 -6
  96. package/dist/yaml-config.d.cts +1 -1
  97. package/dist/yaml-config.d.ts +1 -1
  98. package/dist/yaml-config.js +3 -3
  99. package/package.json +1 -1
  100. package/src/attribute-redacting-processor.test.ts +81 -16
  101. package/src/attribute-redacting-processor.ts +278 -24
  102. package/src/autotel-logger.ts +2 -2
  103. package/src/gen-ai-events.test.ts +135 -0
  104. package/src/gen-ai-events.ts +199 -0
  105. package/src/gen-ai-metrics.test.ts +96 -0
  106. package/src/gen-ai-metrics.ts +128 -0
  107. package/src/index.ts +28 -1
  108. package/src/init.ts +117 -2
  109. package/src/request-logger.test.ts +266 -1
  110. package/src/request-logger.ts +115 -16
  111. package/src/structured-error.ts +54 -1
  112. package/dist/chunk-7FIGORWI.cjs.map +0 -1
  113. package/dist/chunk-AZ24DJAG.cjs.map +0 -1
  114. package/dist/chunk-B33XPEKY.js.map +0 -1
  115. package/dist/chunk-ELW34S4C.cjs +0 -173
  116. package/dist/chunk-ELW34S4C.cjs.map +0 -1
  117. package/dist/chunk-EXOXDI5A.js.map +0 -1
  118. package/dist/chunk-SNINLBEE.js +0 -167
  119. package/dist/chunk-SNINLBEE.js.map +0 -1
  120. package/dist/chunk-UJJPTSEI.cjs.map +0 -1
  121. package/dist/chunk-VYA6QDNA.js.map +0 -1
package/dist/workflow.js CHANGED
@@ -1,20 +1,20 @@
1
- export { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from './chunk-RXFZKLRQ.js';
2
- import './chunk-4PTCDOZY.js';
1
+ export { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from './chunk-YN7USLHW.js';
2
+ import './chunk-HPUGKUMZ.js';
3
3
  import './chunk-B3ZHLLMP.js';
4
4
  import './chunk-WD4RP6IV.js';
5
5
  import './chunk-S4OFEXLA.js';
6
6
  import './chunk-BBBWDIYQ.js';
7
- import './chunk-EXOXDI5A.js';
8
- import './chunk-RUD7KS4R.js';
9
- import './chunk-XDKK53OL.js';
7
+ import './chunk-W35FVJBC.js';
8
+ import './chunk-3SDILILG.js';
9
+ import './chunk-A4E5AQFK.js';
10
10
  import './chunk-WGWSHJ2N.js';
11
11
  import './chunk-GYR5K654.js';
12
- import './chunk-SNINLBEE.js';
12
+ import './chunk-TDNKIHKT.js';
13
13
  import './chunk-6UQRVUN3.js';
14
14
  import './chunk-3QXBFGKP.js';
15
15
  import './chunk-33WTKH7X.js';
16
- import './chunk-VYA6QDNA.js';
17
- import './chunk-B33XPEKY.js';
16
+ import './chunk-DPSA4QLA.js';
17
+ import './chunk-55ER2KD5.js';
18
18
  import './chunk-J5QENANM.js';
19
19
  import './chunk-HA2WBOGQ.js';
20
20
  import './chunk-DGUM43GV.js';
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkOFPZULMQ_cjs = require('./chunk-OFPZULMQ.cjs');
3
+ var chunkOC6X2VIN_cjs = require('./chunk-OC6X2VIN.cjs');
4
4
  require('./chunk-YS6C2YJE.cjs');
5
- require('./chunk-7FIGORWI.cjs');
6
- require('./chunk-AZ24DJAG.cjs');
5
+ require('./chunk-VH77IPJN.cjs');
6
+ require('./chunk-FU6R566Y.cjs');
7
7
  require('./chunk-ESLWRGAG.cjs');
8
8
  require('./chunk-YREV3LGG.cjs');
9
9
  require('./chunk-JEQ2X3Z6.cjs');
@@ -12,15 +12,15 @@ require('./chunk-JEQ2X3Z6.cjs');
12
12
 
13
13
  Object.defineProperty(exports, "hasYamlConfig", {
14
14
  enumerable: true,
15
- get: function () { return chunkOFPZULMQ_cjs.hasYamlConfig; }
15
+ get: function () { return chunkOC6X2VIN_cjs.hasYamlConfig; }
16
16
  });
17
17
  Object.defineProperty(exports, "loadYamlConfig", {
18
18
  enumerable: true,
19
- get: function () { return chunkOFPZULMQ_cjs.loadYamlConfig; }
19
+ get: function () { return chunkOC6X2VIN_cjs.loadYamlConfig; }
20
20
  });
21
21
  Object.defineProperty(exports, "loadYamlConfigFromFile", {
22
22
  enumerable: true,
23
- get: function () { return chunkOFPZULMQ_cjs.loadYamlConfigFromFile; }
23
+ get: function () { return chunkOC6X2VIN_cjs.loadYamlConfigFromFile; }
24
24
  });
25
25
  //# sourceMappingURL=yaml-config.cjs.map
26
26
  //# sourceMappingURL=yaml-config.cjs.map
@@ -1,4 +1,4 @@
1
- import { A as AutotelConfig } from './init-QSj7X6zU.cjs';
1
+ import { A as AutotelConfig } from './init-CMuTaFAV.cjs';
2
2
  import { SamplingPreset } from './sampling.cjs';
3
3
  import '@opentelemetry/sdk-trace-base';
4
4
  import '@opentelemetry/sdk-node';
@@ -1,4 +1,4 @@
1
- import { A as AutotelConfig } from './init-FiR_glVc.js';
1
+ import { A as AutotelConfig } from './init-D6JfWEjL.js';
2
2
  import { SamplingPreset } from './sampling.js';
3
3
  import '@opentelemetry/sdk-trace-base';
4
4
  import '@opentelemetry/sdk-node';
@@ -1,7 +1,7 @@
1
- export { hasYamlConfig, loadYamlConfig, loadYamlConfigFromFile } from './chunk-RUD7KS4R.js';
1
+ export { hasYamlConfig, loadYamlConfig, loadYamlConfigFromFile } from './chunk-3SDILILG.js';
2
2
  import './chunk-33WTKH7X.js';
3
- import './chunk-VYA6QDNA.js';
4
- import './chunk-B33XPEKY.js';
3
+ import './chunk-DPSA4QLA.js';
4
+ import './chunk-55ER2KD5.js';
5
5
  import './chunk-J5QENANM.js';
6
6
  import './chunk-HA2WBOGQ.js';
7
7
  import './chunk-DGUM43GV.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel",
3
- "version": "2.26.0",
3
+ "version": "2.26.2",
4
4
  "description": "Write Once, Observe Anywhere",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -8,6 +8,7 @@ import {
8
8
  REDACTOR_PATTERNS,
9
9
  REDACTOR_PRESETS,
10
10
  createRedactedSpan,
11
+ normalizeAttributeRedactorConfig,
11
12
  type AttributeRedactorFn,
12
13
  type AttributeRedactorConfig,
13
14
  } from './attribute-redacting-processor';
@@ -143,7 +144,7 @@ describe('AttributeRedactingProcessor', () => {
143
144
 
144
145
  describe('built-in presets', () => {
145
146
  describe('default preset', () => {
146
- it('should redact email addresses', () => {
147
+ it('should redact email addresses with smart masking', () => {
147
148
  const processor = new AttributeRedactingProcessor(mockProcessor, {
148
149
  redactor: 'default',
149
150
  });
@@ -154,11 +155,11 @@ describe('AttributeRedactingProcessor', () => {
154
155
  processor.onEnd(span);
155
156
 
156
157
  expect(mockProcessor.endedSpans[0]!.attributes['user.email']).toBe(
157
- '[REDACTED]',
158
+ 'j***@***.com',
158
159
  );
159
160
  });
160
161
 
161
- it('should redact phone numbers', () => {
162
+ it('should redact phone numbers with smart masking', () => {
162
163
  const processor = new AttributeRedactingProcessor(mockProcessor, {
163
164
  redactor: 'default',
164
165
  });
@@ -169,7 +170,7 @@ describe('AttributeRedactingProcessor', () => {
169
170
  processor.onEnd(span);
170
171
 
171
172
  expect(mockProcessor.endedSpans[0]!.attributes['user.phone']).toBe(
172
- '[REDACTED]',
173
+ '********67',
173
174
  );
174
175
  });
175
176
 
@@ -184,11 +185,11 @@ describe('AttributeRedactingProcessor', () => {
184
185
  processor.onEnd(span);
185
186
 
186
187
  expect(mockProcessor.endedSpans[0]!.attributes['user.ssn']).toBe(
187
- '[REDACTED]',
188
+ '*******89',
188
189
  );
189
190
  });
190
191
 
191
- it('should redact credit card numbers', () => {
192
+ it('should redact credit card numbers with smart masking', () => {
192
193
  const processor = new AttributeRedactingProcessor(mockProcessor, {
193
194
  redactor: 'default',
194
195
  });
@@ -199,7 +200,7 @@ describe('AttributeRedactingProcessor', () => {
199
200
  processor.onEnd(span);
200
201
 
201
202
  expect(mockProcessor.endedSpans[0]!.attributes['payment.card']).toBe(
202
- '[REDACTED]',
203
+ '**************11',
203
204
  );
204
205
  });
205
206
 
@@ -260,7 +261,7 @@ describe('AttributeRedactingProcessor', () => {
260
261
  });
261
262
 
262
263
  describe('strict preset', () => {
263
- it('should redact Bearer tokens', () => {
264
+ it('should redact Bearer tokens with smart masking', () => {
264
265
  const processor = new AttributeRedactingProcessor(mockProcessor, {
265
266
  redactor: 'strict',
266
267
  });
@@ -273,10 +274,10 @@ describe('AttributeRedactingProcessor', () => {
273
274
 
274
275
  expect(
275
276
  mockProcessor.endedSpans[0]!.attributes['http.header.authorization'],
276
- ).toBe('[REDACTED]');
277
+ ).toBe('Bearer ***');
277
278
  });
278
279
 
279
- it('should redact JWTs', () => {
280
+ it('should redact JWTs with smart masking', () => {
280
281
  const processor = new AttributeRedactingProcessor(mockProcessor, {
281
282
  redactor: 'strict',
282
283
  });
@@ -288,7 +289,7 @@ describe('AttributeRedactingProcessor', () => {
288
289
  processor.onEnd(span);
289
290
 
290
291
  expect(mockProcessor.endedSpans[0]!.attributes['auth.token']).toBe(
291
- '[REDACTED]',
292
+ 'eyJ***.***',
292
293
  );
293
294
  });
294
295
 
@@ -369,6 +370,7 @@ describe('AttributeRedactingProcessor', () => {
369
370
 
370
371
  it('should use custom value patterns', () => {
371
372
  const config: AttributeRedactorConfig = {
373
+ builtins: false,
372
374
  valuePatterns: [
373
375
  {
374
376
  name: 'customerId',
@@ -407,10 +409,33 @@ describe('AttributeRedactingProcessor', () => {
407
409
 
408
410
  expect(mockProcessor.endedSpans[0]!.attributes.secret).toBe('<<HIDDEN>>');
409
411
  });
412
+
413
+ it('should redact exact dot-path matches from paths config', () => {
414
+ const config: AttributeRedactorConfig = {
415
+ builtins: false,
416
+ paths: ['user.password'],
417
+ };
418
+ const processor = new AttributeRedactingProcessor(mockProcessor, {
419
+ redactor: config,
420
+ });
421
+
422
+ const span = createMockReadableSpan({
423
+ 'user.password': 'super-secret',
424
+ 'billing.password': 'keep-this',
425
+ });
426
+ processor.onEnd(span);
427
+
428
+ expect(mockProcessor.endedSpans[0]!.attributes['user.password']).toBe(
429
+ '[REDACTED]',
430
+ );
431
+ expect(mockProcessor.endedSpans[0]!.attributes['billing.password']).toBe(
432
+ 'keep-this',
433
+ );
434
+ });
410
435
  });
411
436
 
412
437
  describe('array handling', () => {
413
- it('should redact PII in string arrays', () => {
438
+ it('should redact PII in string arrays with smart masking', () => {
414
439
  const processor = new AttributeRedactingProcessor(mockProcessor, {
415
440
  redactor: 'default',
416
441
  });
@@ -423,8 +448,8 @@ describe('AttributeRedactingProcessor', () => {
423
448
  const redactedEmails = mockProcessor.endedSpans[0]!.attributes[
424
449
  'user.emails'
425
450
  ] as string[];
426
- expect(redactedEmails[0]).toBe('[REDACTED]');
427
- expect(redactedEmails[1]).toBe('[REDACTED]');
451
+ expect(redactedEmails[0]).toBe('j***@***.com');
452
+ expect(redactedEmails[1]).toBe('j***@***.org');
428
453
  });
429
454
 
430
455
  it('should preserve non-string array elements', () => {
@@ -675,7 +700,7 @@ describe('edge cases', () => {
675
700
  processor.onEnd(span);
676
701
 
677
702
  expect(mockProcessor.endedSpans[0]!.attributes.message).toBe(
678
- 'User [REDACTED] signed up',
703
+ 'User j***@***.com signed up',
679
704
  );
680
705
  });
681
706
 
@@ -690,7 +715,47 @@ describe('edge cases', () => {
690
715
  processor.onEnd(span);
691
716
 
692
717
  expect(mockProcessor.endedSpans[0]!.attributes.contacts).toBe(
693
- 'Email: [REDACTED], Phone: [REDACTED]',
718
+ 'Email: j***@***.com, Phone: ********67',
694
719
  );
695
720
  });
696
721
  });
722
+
723
+ describe('normalizeAttributeRedactorConfig', () => {
724
+ it('should preserve preset strings', () => {
725
+ expect(normalizeAttributeRedactorConfig('default')).toBe('default');
726
+ });
727
+
728
+ it('should normalize regex-like values from serialized config', () => {
729
+ const normalized = normalizeAttributeRedactorConfig({
730
+ keyPatterns: ['password'],
731
+ patterns: [{ source: 'Bearer\\s+\\w+', flags: 'gi' }],
732
+ valuePatterns: [
733
+ {
734
+ name: 'customerId',
735
+ pattern: { source: 'CUST-\\d{4}', flags: 'g' },
736
+ replacement: 'CUST-***',
737
+ },
738
+ ],
739
+ paths: ['user.token'],
740
+ builtins: ['email', 'jwt'],
741
+ replacement: '[MASKED]',
742
+ });
743
+
744
+ expect(typeof normalized).toBe('object');
745
+ if (!normalized || typeof normalized === 'string') {
746
+ throw new Error('Expected object config');
747
+ }
748
+
749
+ expect(normalized.keyPatterns?.[0]).toBeInstanceOf(RegExp);
750
+ expect(normalized.patterns?.[0]).toBeInstanceOf(RegExp);
751
+ expect(normalized.valuePatterns?.[0]?.pattern).toBeInstanceOf(RegExp);
752
+ expect(normalized.paths).toEqual(['user.token']);
753
+ expect(normalized.builtins).toEqual(['email', 'jwt']);
754
+ expect(normalized.replacement).toBe('[MASKED]');
755
+ });
756
+
757
+ it('should return undefined for unsupported raw values', () => {
758
+ expect(normalizeAttributeRedactorConfig(42)).toBeUndefined();
759
+ expect(normalizeAttributeRedactorConfig(null)).toBeUndefined();
760
+ });
761
+ });