@autofleet/rabbit 4.0.0-beta.0 → 4.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.
- package/dist/index.d.ts +24 -17
- package/dist/index.js +303 -180
- package/dist/index.js.map +1 -0
- package/dist/lib/celery.js +1 -0
- package/dist/lib/celery.js.map +1 -0
- package/dist/lib/consts.d.ts +0 -2
- package/dist/lib/consts.js +2 -3
- package/dist/lib/consts.js.map +1 -0
- package/dist/lib/rabbitError.js +1 -0
- package/dist/lib/rabbitError.js.map +1 -0
- package/dist/lib/redis.js +1 -0
- package/dist/lib/redis.js.map +1 -0
- package/dist/lib/types.d.ts +8 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.js +1 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/logger.js +1 -0
- package/dist/logger.js.map +1 -0
- package/dist/{mock.d.ts → mock/index.d.ts} +1 -1
- package/dist/{mock.js → mock/index.js} +2 -1
- package/dist/mock/index.js.map +1 -0
- package/dist/mock/vitest.d.ts +13 -0
- package/dist/mock/vitest.js +18 -0
- package/dist/mock/vitest.js.map +1 -0
- package/package.json +22 -16
- package/src/index.ts +359 -203
- package/src/lib/consts.ts +0 -2
- package/src/lib/types.ts +10 -0
- package/src/{mock.ts → mock/index.ts} +2 -2
- package/src/mock/vitest.ts +24 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +2 -2
- package/vitest.config.ts +17 -0
- package/coverage/clover.xml +0 -669
- package/coverage/coverage-final.json +0 -9
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/index.html +0 -131
- package/coverage/lcov-report/src/index.ts.html +0 -3826
- package/coverage/lcov-report/src/lib/celery.ts.html +0 -352
- package/coverage/lcov-report/src/lib/consts.ts.html +0 -142
- package/coverage/lcov-report/src/lib/index.html +0 -191
- package/coverage/lcov-report/src/lib/rabbitError.ts.html +0 -103
- package/coverage/lcov-report/src/lib/redis.ts.html +0 -133
- package/coverage/lcov-report/src/lib/types.ts.html +0 -268
- package/coverage/lcov-report/src/lib/utils.ts.html +0 -142
- package/coverage/lcov-report/src/logger.ts.html +0 -100
- package/coverage/lcov.info +0 -1076
package/src/lib/consts.ts
CHANGED
|
@@ -6,8 +6,6 @@ export const USER_TRACING_HEADER = 'x-af-user-id';
|
|
|
6
6
|
export const AUTOMATION_ID_HEADER = 'x-af-automation-id';
|
|
7
7
|
export const USER_OBJECT = 'userObject';
|
|
8
8
|
export const DEFAULT_USE_CONSUME_WITH_LOCK = false;
|
|
9
|
-
export const CONNECTION_CREATED_CONST = 'connectionCreated';
|
|
10
|
-
export const CONNECTION_FAILED_CONST = 'connectionFailed';
|
|
11
9
|
export const DEFAULT_OPTIONS = {
|
|
12
10
|
limit: 1,
|
|
13
11
|
retries: 1,
|
package/src/lib/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AmqpConnectionManager } from 'amqp-connection-manager';
|
|
1
2
|
import { ConsumeMessage, Options, Replies } from 'amqplib';
|
|
2
3
|
|
|
3
4
|
export interface ExchangesCache {
|
|
@@ -31,6 +32,7 @@ export interface ConsumeOptions {
|
|
|
31
32
|
useConsumeWithLock?: boolean;
|
|
32
33
|
auditContext?: any;
|
|
33
34
|
enableRabbitTrace?: boolean;
|
|
35
|
+
// TODO: [QUORUM-PHASE-3] Redundant because all the queues are quorum queues
|
|
34
36
|
isQuorumQueue?: boolean;
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -60,3 +62,11 @@ export const CONSUMER_DEFAULT_OPTIONS: Options.Consume = {
|
|
|
60
62
|
[HA_PROMOTE_ON_SHUTDOWN]: 'always',
|
|
61
63
|
},
|
|
62
64
|
};
|
|
65
|
+
|
|
66
|
+
export type ConnectionData = {
|
|
67
|
+
amqpConnection: AmqpConnectionManager | null;
|
|
68
|
+
creatingConnection: boolean;
|
|
69
|
+
connectionCreatedEventName: string;
|
|
70
|
+
connectionFailedEventName: string;
|
|
71
|
+
blockReconnect: boolean;
|
|
72
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-
|
|
1
|
+
// eslint-disable-next-line import/no-unresolved
|
|
2
2
|
import 'jest';
|
|
3
|
-
import { IAfRabbitMq } from '
|
|
3
|
+
import type { IAfRabbitMq } from '../index';
|
|
4
4
|
|
|
5
5
|
class RabbitMq implements IAfRabbitMq {
|
|
6
6
|
ack: any = jest.fn();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import { IAfRabbitMq } from '../index';
|
|
3
|
+
|
|
4
|
+
class RabbitMq implements IAfRabbitMq {
|
|
5
|
+
ack = vi.fn();
|
|
6
|
+
|
|
7
|
+
nack = vi.fn();
|
|
8
|
+
|
|
9
|
+
assertChannel = vi.fn();
|
|
10
|
+
|
|
11
|
+
assertExchange = vi.fn();
|
|
12
|
+
|
|
13
|
+
assertQueue = vi.fn();
|
|
14
|
+
|
|
15
|
+
consume = vi.fn();
|
|
16
|
+
|
|
17
|
+
consumeFromExchange = vi.fn();
|
|
18
|
+
|
|
19
|
+
publish = vi.fn();
|
|
20
|
+
|
|
21
|
+
sendToQueue = vi.fn();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default RabbitMq;
|
package/tsconfig.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"experimentalDecorators": true,
|
|
10
10
|
"emitDecoratorMetadata": true,
|
|
11
11
|
"skipLibCheck": true,
|
|
12
|
-
"
|
|
12
|
+
"sourceMap": true,
|
|
13
13
|
},
|
|
14
14
|
"exclude": ["node_modules"],
|
|
15
|
-
"include": ["src
|
|
15
|
+
"include": ["src/", "vitest.config.ts"],
|
|
16
16
|
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-unresolved
|
|
2
|
+
import { defineConfig } from 'vitest/config';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
test: {
|
|
6
|
+
coverage: {
|
|
7
|
+
provider: 'v8',
|
|
8
|
+
include: ['src/**/*.ts'],
|
|
9
|
+
exclude: ['src/example.ts', 'src/mock/*.ts'],
|
|
10
|
+
reporter: 'text',
|
|
11
|
+
thresholds: {
|
|
12
|
+
// TO DO: Increase the coverage threshold back to 75 in phase 3
|
|
13
|
+
lines: 65,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|