@zdavison/matador 2.0.8 → 2.0.10

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 (77) hide show
  1. package/dist/index.d.cts +1 -1
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/package.json +6 -2
  5. package/examples/config.ts +0 -126
  6. package/examples/event.ts +0 -26
  7. package/examples/order-event.json +0 -19
  8. package/src/checkpoint/context.test.ts +0 -510
  9. package/src/checkpoint/context.ts +0 -213
  10. package/src/checkpoint/index.ts +0 -30
  11. package/src/checkpoint/stores/memory.ts +0 -47
  12. package/src/checkpoint/stores/noop.ts +0 -22
  13. package/src/checkpoint/stores/stores.test.ts +0 -177
  14. package/src/checkpoint/types.ts +0 -147
  15. package/src/codec/codec.ts +0 -42
  16. package/src/codec/header-aware-codec.ts +0 -41
  17. package/src/codec/index.ts +0 -11
  18. package/src/codec/json-codec.ts +0 -69
  19. package/src/codec/rabbitmq-codec.test.ts +0 -516
  20. package/src/codec/rabbitmq-codec.ts +0 -336
  21. package/src/core/fanout.test.ts +0 -1350
  22. package/src/core/fanout.ts +0 -184
  23. package/src/core/index.ts +0 -12
  24. package/src/core/matador.test.ts +0 -575
  25. package/src/core/matador.ts +0 -357
  26. package/src/core/shutdown.test.ts +0 -853
  27. package/src/core/shutdown.ts +0 -165
  28. package/src/errors/checkpoint-errors.ts +0 -62
  29. package/src/errors/has-description.ts +0 -25
  30. package/src/errors/index.ts +0 -58
  31. package/src/errors/matador-errors.ts +0 -477
  32. package/src/errors/retry-errors.test.ts +0 -175
  33. package/src/errors/retry-errors.ts +0 -188
  34. package/src/hooks/index.ts +0 -14
  35. package/src/hooks/safe-hooks.ts +0 -200
  36. package/src/hooks/types.ts +0 -226
  37. package/src/index.ts +0 -241
  38. package/src/pipeline/index.ts +0 -2
  39. package/src/pipeline/pipeline.test.ts +0 -1377
  40. package/src/pipeline/pipeline.ts +0 -393
  41. package/src/retry/index.ts +0 -4
  42. package/src/retry/policy.ts +0 -46
  43. package/src/retry/standard-policy.test.ts +0 -290
  44. package/src/retry/standard-policy.ts +0 -156
  45. package/src/schema/index.ts +0 -16
  46. package/src/schema/registry.test.ts +0 -339
  47. package/src/schema/registry.ts +0 -229
  48. package/src/schema/types.test.ts +0 -280
  49. package/src/schema/types.ts +0 -217
  50. package/src/topology/builder.test.ts +0 -451
  51. package/src/topology/builder.ts +0 -238
  52. package/src/topology/index.ts +0 -19
  53. package/src/topology/types.ts +0 -183
  54. package/src/transport/capabilities.ts +0 -88
  55. package/src/transport/connection-manager.ts +0 -218
  56. package/src/transport/index.ts +0 -42
  57. package/src/transport/local/local-transport.test.ts +0 -262
  58. package/src/transport/local/local-transport.ts +0 -330
  59. package/src/transport/multi/multi-transport.test.ts +0 -320
  60. package/src/transport/multi/multi-transport.ts +0 -294
  61. package/src/transport/rabbitmq/rabbitmq-transport.test.ts +0 -120
  62. package/src/transport/rabbitmq/rabbitmq-transport.ts +0 -782
  63. package/src/transport/transport.ts +0 -200
  64. package/src/types/common.ts +0 -53
  65. package/src/types/dispatcher.ts +0 -18
  66. package/src/types/envelope.ts +0 -244
  67. package/src/types/event.test.ts +0 -157
  68. package/src/types/event.ts +0 -112
  69. package/src/types/index.ts +0 -62
  70. package/src/types/subscriber.ts +0 -333
  71. package/test/e2e/multi-transport.e2e.test.ts +0 -237
  72. package/test/e2e/rabbitmq-transport.e2e.test.ts +0 -618
  73. package/test/e2e/transport-compliance.e2e.test.ts +0 -506
  74. package/test/integration/matador.integration.test.ts +0 -634
  75. package/tsconfig.json +0 -29
  76. package/tsconfig.tsbuildinfo +0 -1
  77. package/tsup.config.ts +0 -13
@@ -1,120 +0,0 @@
1
- import { describe, expect, it, mock } from 'bun:test';
2
- import type { Logger } from '../../hooks/index.js';
3
- import { RabbitMQTransport, redactAmqpUrl } from './rabbitmq-transport.js';
4
-
5
- describe('redactAmqpUrl', () => {
6
- it('should redact username and password with 4 asterisks', () => {
7
- const url = 'amqp://myuser:mypassword@localhost:5672';
8
- const redacted = redactAmqpUrl(url);
9
- expect(redacted).toBe('amqp://****:****@localhost:5672');
10
- });
11
-
12
- it('should redact credentials in amqps URLs', () => {
13
- const url = 'amqps://admin:secret123@rabbitmq.example.com:5671';
14
- const redacted = redactAmqpUrl(url);
15
- expect(redacted).toBe('amqps://****:****@rabbitmq.example.com:5671');
16
- });
17
-
18
- it('should redact long credentials to exactly 4 asterisks', () => {
19
- const url =
20
- 'amqp://verylongusername:verylongpassword@rabbitmq-cluster.svc.local:5672';
21
- const redacted = redactAmqpUrl(url);
22
- expect(redacted).toBe('amqp://****:****@rabbitmq-cluster.svc.local:5672');
23
- });
24
-
25
- it('should redact short credentials to exactly 4 asterisks', () => {
26
- const url = 'amqp://a:b@host:5672';
27
- const redacted = redactAmqpUrl(url);
28
- expect(redacted).toBe('amqp://****:****@host:5672');
29
- });
30
-
31
- it('should preserve vhost in URL', () => {
32
- const url = 'amqp://user:pass@host:5672/myvhost';
33
- const redacted = redactAmqpUrl(url);
34
- expect(redacted).toBe('amqp://****:****@host:5672/myvhost');
35
- });
36
-
37
- it('should not modify URL without credentials', () => {
38
- const url = 'amqp://localhost:5672';
39
- const redacted = redactAmqpUrl(url);
40
- expect(redacted).toBe('amqp://localhost:5672');
41
- });
42
-
43
- it('should not modify URL with only username (no password)', () => {
44
- const url = 'amqp://guest@localhost:5672';
45
- const redacted = redactAmqpUrl(url);
46
- expect(redacted).toBe('amqp://guest@localhost:5672');
47
- });
48
-
49
- it('should handle URL-encoded credentials', () => {
50
- // URL-encoded @ in password: p%40ssword
51
- const url = 'amqp://user:p%40ssword@host:5672';
52
- const redacted = redactAmqpUrl(url);
53
- expect(redacted).toBe('amqp://****:****@host:5672');
54
- });
55
- });
56
-
57
- describe('RabbitMQTransport', () => {
58
- describe('connection logging', () => {
59
- it('should log redacted connection URL when connecting', async () => {
60
- const mockLogger: Logger = {
61
- debug: mock(() => {}),
62
- info: mock(() => {}),
63
- warn: mock(() => {}),
64
- error: mock(() => {}),
65
- };
66
-
67
- const transport = new RabbitMQTransport({
68
- url: 'amqp://testuser:testpass@localhost:5672',
69
- connectionName: 'test-connection',
70
- logger: mockLogger,
71
- connection: {
72
- maxReconnectAttempts: 1, // Only try once to avoid long retries
73
- initialReconnectDelay: 10,
74
- },
75
- });
76
-
77
- // Attempt to connect - it will fail since there's no RabbitMQ server
78
- // but the log should still be emitted before the connection attempt
79
- try {
80
- await transport.connect();
81
- } catch {
82
- // Expected to fail - no RabbitMQ server running
83
- }
84
-
85
- // Verify the log was called with the redacted URL
86
- expect(mockLogger.info).toHaveBeenCalledWith(
87
- "[Matador] \u23F3 Connecting to RabbitMQ at 'amqp://****:****@localhost:5672'.",
88
- );
89
- });
90
-
91
- it('should log connection URL as-is when no credentials provided', async () => {
92
- const mockLogger: Logger = {
93
- debug: mock(() => {}),
94
- info: mock(() => {}),
95
- warn: mock(() => {}),
96
- error: mock(() => {}),
97
- };
98
-
99
- const transport = new RabbitMQTransport({
100
- url: 'amqp://localhost:5672',
101
- connectionName: 'test-connection',
102
- logger: mockLogger,
103
- connection: {
104
- maxReconnectAttempts: 1,
105
- initialReconnectDelay: 10,
106
- },
107
- });
108
-
109
- try {
110
- await transport.connect();
111
- } catch {
112
- // Expected to fail
113
- }
114
-
115
- expect(mockLogger.info).toHaveBeenCalledWith(
116
- "[Matador] \u23F3 Connecting to RabbitMQ at 'amqp://localhost:5672'.",
117
- );
118
- });
119
- });
120
- });