@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.
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +6 -2
- package/examples/config.ts +0 -126
- package/examples/event.ts +0 -26
- package/examples/order-event.json +0 -19
- package/src/checkpoint/context.test.ts +0 -510
- package/src/checkpoint/context.ts +0 -213
- package/src/checkpoint/index.ts +0 -30
- package/src/checkpoint/stores/memory.ts +0 -47
- package/src/checkpoint/stores/noop.ts +0 -22
- package/src/checkpoint/stores/stores.test.ts +0 -177
- package/src/checkpoint/types.ts +0 -147
- package/src/codec/codec.ts +0 -42
- package/src/codec/header-aware-codec.ts +0 -41
- package/src/codec/index.ts +0 -11
- package/src/codec/json-codec.ts +0 -69
- package/src/codec/rabbitmq-codec.test.ts +0 -516
- package/src/codec/rabbitmq-codec.ts +0 -336
- package/src/core/fanout.test.ts +0 -1350
- package/src/core/fanout.ts +0 -184
- package/src/core/index.ts +0 -12
- package/src/core/matador.test.ts +0 -575
- package/src/core/matador.ts +0 -357
- package/src/core/shutdown.test.ts +0 -853
- package/src/core/shutdown.ts +0 -165
- package/src/errors/checkpoint-errors.ts +0 -62
- package/src/errors/has-description.ts +0 -25
- package/src/errors/index.ts +0 -58
- package/src/errors/matador-errors.ts +0 -477
- package/src/errors/retry-errors.test.ts +0 -175
- package/src/errors/retry-errors.ts +0 -188
- package/src/hooks/index.ts +0 -14
- package/src/hooks/safe-hooks.ts +0 -200
- package/src/hooks/types.ts +0 -226
- package/src/index.ts +0 -241
- package/src/pipeline/index.ts +0 -2
- package/src/pipeline/pipeline.test.ts +0 -1377
- package/src/pipeline/pipeline.ts +0 -393
- package/src/retry/index.ts +0 -4
- package/src/retry/policy.ts +0 -46
- package/src/retry/standard-policy.test.ts +0 -290
- package/src/retry/standard-policy.ts +0 -156
- package/src/schema/index.ts +0 -16
- package/src/schema/registry.test.ts +0 -339
- package/src/schema/registry.ts +0 -229
- package/src/schema/types.test.ts +0 -280
- package/src/schema/types.ts +0 -217
- package/src/topology/builder.test.ts +0 -451
- package/src/topology/builder.ts +0 -238
- package/src/topology/index.ts +0 -19
- package/src/topology/types.ts +0 -183
- package/src/transport/capabilities.ts +0 -88
- package/src/transport/connection-manager.ts +0 -218
- package/src/transport/index.ts +0 -42
- package/src/transport/local/local-transport.test.ts +0 -262
- package/src/transport/local/local-transport.ts +0 -330
- package/src/transport/multi/multi-transport.test.ts +0 -320
- package/src/transport/multi/multi-transport.ts +0 -294
- package/src/transport/rabbitmq/rabbitmq-transport.test.ts +0 -120
- package/src/transport/rabbitmq/rabbitmq-transport.ts +0 -782
- package/src/transport/transport.ts +0 -200
- package/src/types/common.ts +0 -53
- package/src/types/dispatcher.ts +0 -18
- package/src/types/envelope.ts +0 -244
- package/src/types/event.test.ts +0 -157
- package/src/types/event.ts +0 -112
- package/src/types/index.ts +0 -62
- package/src/types/subscriber.ts +0 -333
- package/test/e2e/multi-transport.e2e.test.ts +0 -237
- package/test/e2e/rabbitmq-transport.e2e.test.ts +0 -618
- package/test/e2e/transport-compliance.e2e.test.ts +0 -506
- package/test/integration/matador.integration.test.ts +0 -634
- package/tsconfig.json +0 -29
- package/tsconfig.tsbuildinfo +0 -1
- 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
|
-
});
|