@axinom/mosaic-message-bus 0.48.0-rc.13 → 0.48.0-rc.16
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/package.json +15 -12
- package/src/middleware/validate-signed-event-middleware.spec.ts +19 -8
- package/src/publication.spec.ts +2 -2
- package/src/rascal-config-builder.spec.ts +2 -2
- package/src/setup-messaging-broker.spec.ts +1 -1
- package/src/signing/register-public-signing-key.spec.ts +18 -7
- package/src/subscription.spec.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-message-bus",
|
|
3
|
-
"version": "0.48.0-rc.
|
|
3
|
+
"version": "0.48.0-rc.16",
|
|
4
4
|
"description": "Messaging library for Axinom Mosaic services",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
"build": "yarn clean && tsc",
|
|
21
21
|
"build:ci": "yarn workspaces focus && yarn build",
|
|
22
22
|
"dev": "tsc-watch --onSuccess \"node dist/index.js\"",
|
|
23
|
-
"test": "
|
|
24
|
-
"test:watch": "
|
|
25
|
-
"test:cov": "
|
|
23
|
+
"test": "vitest run --silent",
|
|
24
|
+
"test:watch": "vitest watch",
|
|
25
|
+
"test:cov": "vitest run --coverage --silent && yarn posttest:cov",
|
|
26
26
|
"posttest:cov": "ts-node ../../scripts/open-test-coverage.ts -- libs/message-bus",
|
|
27
|
-
"test:debug": "
|
|
28
|
-
"test:ci": "
|
|
27
|
+
"test:debug": "vitest run --inspect-brk --no-file-parallelism",
|
|
28
|
+
"test:ci": "vitest run --reporter=default --reporter=junit --coverage --coverage.reporter=cobertura --coverage.reporter=html",
|
|
29
|
+
"test:ui": "vitest --ui",
|
|
29
30
|
"lint": "eslint . --ext .ts,.tsx,.js --color --cache",
|
|
30
31
|
"codegen": "yarn util:load-vars graphql-codegen --config codegen.yml",
|
|
31
32
|
"util:load-vars": "env-cmd --silent -f ../../../.env env-cmd --silent -f ../../../.env.dev env-cmd --silent -f .env env-cmd --silent -f .env.dev"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@axinom/mosaic-message-bus-abstractions": "^0.24.1-rc.
|
|
35
|
-
"@axinom/mosaic-service-common": "^0.67.0-rc.
|
|
35
|
+
"@axinom/mosaic-message-bus-abstractions": "^0.24.1-rc.8",
|
|
36
|
+
"@axinom/mosaic-service-common": "^0.67.0-rc.16",
|
|
36
37
|
"amqplib": "^0.10.3",
|
|
37
38
|
"dotenv": "^8.2.0",
|
|
38
39
|
"graphql": "^15.4.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"uuid": "^8.3.2"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@axinom/mosaic-dev-be-common": "^0.
|
|
49
|
+
"@axinom/mosaic-dev-be-common": "^0.16.0-rc.1",
|
|
49
50
|
"@graphql-codegen/cli": "^4.0.1",
|
|
50
51
|
"@graphql-codegen/typescript": "^2.7.3",
|
|
51
52
|
"@graphql-codegen/typescript-graphql-request": "^4.5.5",
|
|
@@ -54,16 +55,18 @@
|
|
|
54
55
|
"@types/ramda": "^0.31.1",
|
|
55
56
|
"@types/rascal": "^10.0.5",
|
|
56
57
|
"@types/uuid": "^8.0.0",
|
|
58
|
+
"@vitest/ui": "^4.0.18",
|
|
57
59
|
"env-cmd": "^10.1.0",
|
|
58
60
|
"eslint": "^8.35.0",
|
|
59
|
-
"jest": "^
|
|
61
|
+
"jest-extended": "^7.0.0",
|
|
60
62
|
"rimraf": "^3.0.2",
|
|
61
63
|
"ts-node": "^10.9.1",
|
|
62
64
|
"tsc-watch": "^6.0.0",
|
|
63
|
-
"typescript": "^5.9.3"
|
|
65
|
+
"typescript": "^5.9.3",
|
|
66
|
+
"vitest": "^4.0.18"
|
|
64
67
|
},
|
|
65
68
|
"publishConfig": {
|
|
66
69
|
"access": "public"
|
|
67
70
|
},
|
|
68
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "61cc0e626bb816beee81d16b31c46f1d2a13844d"
|
|
69
72
|
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { stub } from '@axinom/mosaic-dev-be-common';
|
|
2
|
+
import { stub } from '@axinom/mosaic-dev-be-common/vitest';
|
|
3
3
|
import { generateSignature, rejectionOf } from '@axinom/mosaic-service-common';
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
|
+
afterAll,
|
|
6
|
+
afterEach,
|
|
7
|
+
beforeAll,
|
|
8
|
+
describe,
|
|
9
|
+
expect,
|
|
10
|
+
it,
|
|
11
|
+
vi,
|
|
12
|
+
} from 'vitest';
|
|
5
13
|
import {
|
|
6
14
|
MOSAIC_SIGNING_SIGNATURE,
|
|
7
15
|
MOSAIC_SIGNING_SIGNATURE_KEY_VERSION,
|
|
@@ -30,9 +38,9 @@ describe('validateSignedEventMiddleware', () => {
|
|
|
30
38
|
'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr6hjEsxp5nIfgQTXfPcYSTMAAhYFLkygyCQHI4aIiTL1fddWs9nIBomiIsTjapggQGqRn7GdmztRSRaYuHS5ll6for6j5UbP5S6FKP9wRZomE952Uet+qIMOicvFgk/YB8OAHyOcZ8dZSYqMpR0BMRHxLjpj+FS3FPdiIpb5Dj10lXcUP0I8jatbpp9iqCFDQaY7hxSFE2p5XJKPYoA0/9nLZiRX5LJF5QsOx1eAZwT0qgS4Q5SkGnzYT4/V5/d4eLBofOU3DwZPdBnmf10NyyeTpn9ae6QXWv7kouYIOhcmZaxWCo4loJpAd4Iv+zL7JwijJqcNcLHr0SlaRmaUNQIDAQAB';
|
|
31
39
|
|
|
32
40
|
const messageType = 'TestMessage';
|
|
33
|
-
const ackOrNack =
|
|
34
|
-
const next =
|
|
35
|
-
const handler =
|
|
41
|
+
const ackOrNack = vi.fn();
|
|
42
|
+
const next = vi.fn();
|
|
43
|
+
const handler = vi.fn();
|
|
36
44
|
const getTokenCallback: GetEventSigningTokenFunc = async () => ({
|
|
37
45
|
accessToken: 'SGVsbG8gVGhlcmUh',
|
|
38
46
|
expiresInSeconds: 86400,
|
|
@@ -60,12 +68,12 @@ describe('validateSignedEventMiddleware', () => {
|
|
|
60
68
|
properties: { headers },
|
|
61
69
|
});
|
|
62
70
|
|
|
63
|
-
let keyServiceSpy:
|
|
71
|
+
let keyServiceSpy: ReturnType<typeof vi.spyOn>;
|
|
64
72
|
let getRegisteredPublicKeys = () => ({});
|
|
65
73
|
let getRegistrationResponse = () => ({});
|
|
66
74
|
|
|
67
75
|
beforeAll(() => {
|
|
68
|
-
keyServiceSpy =
|
|
76
|
+
keyServiceSpy = vi.spyOn(keyService, 'getSdk').mockImplementation(() =>
|
|
69
77
|
stub<keyService.Sdk>({
|
|
70
78
|
GetPublicSigningKeys: () => ({ data: getRegisteredPublicKeys() }),
|
|
71
79
|
RegisterPublicSigningKey: () => ({ data: getRegistrationResponse() }),
|
|
@@ -73,8 +81,11 @@ describe('validateSignedEventMiddleware', () => {
|
|
|
73
81
|
);
|
|
74
82
|
});
|
|
75
83
|
|
|
84
|
+
afterAll(() => {
|
|
85
|
+
vi.restoreAllMocks();
|
|
86
|
+
});
|
|
87
|
+
|
|
76
88
|
afterEach(() => {
|
|
77
|
-
jest.clearAllMocks();
|
|
78
89
|
getRegisteredPublicKeys = () => ({});
|
|
79
90
|
getRegistrationResponse = () => ({});
|
|
80
91
|
exportedForTesting.clearSigningCache();
|
package/src/publication.spec.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { stub } from '@axinom/mosaic-dev-be-common';
|
|
2
|
+
import { stub } from '@axinom/mosaic-dev-be-common/vitest';
|
|
3
3
|
import { Logger } from '@axinom/mosaic-service-common';
|
|
4
|
-
import 'jest-extended';
|
|
5
4
|
import { BrokerAsPromised, PublicationSession } from 'rascal';
|
|
5
|
+
import { afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
6
6
|
import Publication from './publication';
|
|
7
7
|
import { MessageEnvelope, MessagePublicationConfig } from './types';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { stub } from '@axinom/mosaic-dev-be-common';
|
|
3
|
-
import '
|
|
2
|
+
import { stub } from '@axinom/mosaic-dev-be-common/vitest';
|
|
3
|
+
import { beforeEach, describe, expect, it } from 'vitest';
|
|
4
4
|
import { BrokerProxy } from './broker';
|
|
5
5
|
import { MessageHandler } from './message-handler';
|
|
6
6
|
import { RascalConfigBuilder } from './rascal-config-builder';
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { stub } from '@axinom/mosaic-dev-be-common';
|
|
3
|
-
import
|
|
2
|
+
import { stub } from '@axinom/mosaic-dev-be-common/vitest';
|
|
3
|
+
import {
|
|
4
|
+
afterAll,
|
|
5
|
+
afterEach,
|
|
6
|
+
beforeAll,
|
|
7
|
+
describe,
|
|
8
|
+
expect,
|
|
9
|
+
it,
|
|
10
|
+
vi,
|
|
11
|
+
} from 'vitest';
|
|
4
12
|
import * as keyService from '../generated/key-service';
|
|
5
13
|
import { GetEventSigningTokenFunc } from '../types';
|
|
6
14
|
import { registerPublicSigningKey } from './register-public-signing-key';
|
|
@@ -22,23 +30,26 @@ describe('registerPublicSigningKey', () => {
|
|
|
22
30
|
tokenType: 'ManagedServiceAccount',
|
|
23
31
|
});
|
|
24
32
|
|
|
25
|
-
let keyServiceSpy:
|
|
26
|
-
let consoleSpy:
|
|
33
|
+
let keyServiceSpy: ReturnType<typeof vi.spyOn>;
|
|
34
|
+
let consoleSpy: ReturnType<typeof vi.spyOn>;
|
|
27
35
|
let registerKeyResponse = () => ({});
|
|
28
36
|
|
|
29
37
|
beforeAll(() => {
|
|
30
|
-
keyServiceSpy =
|
|
38
|
+
keyServiceSpy = vi.spyOn(keyService, 'getSdk').mockImplementation(() =>
|
|
31
39
|
stub<keyService.Sdk>({
|
|
32
40
|
RegisterPublicSigningKey: () => ({ data: registerKeyResponse() }),
|
|
33
41
|
}),
|
|
34
42
|
);
|
|
35
|
-
consoleSpy =
|
|
43
|
+
consoleSpy = vi
|
|
36
44
|
.spyOn(console, 'log')
|
|
37
45
|
.mockImplementation((obj) => JSON.parse(obj));
|
|
38
46
|
});
|
|
39
47
|
|
|
48
|
+
afterAll(() => {
|
|
49
|
+
vi.restoreAllMocks();
|
|
50
|
+
});
|
|
51
|
+
|
|
40
52
|
afterEach(() => {
|
|
41
|
-
jest.clearAllMocks();
|
|
42
53
|
registerKeyResponse = () => ({});
|
|
43
54
|
exportedForTesting.clearSigningCache();
|
|
44
55
|
});
|
package/src/subscription.spec.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { stub } from '@axinom/mosaic-dev-be-common';
|
|
2
|
+
import { stub } from '@axinom/mosaic-dev-be-common/vitest';
|
|
3
3
|
import { LogMessage, Logger } from '@axinom/mosaic-service-common';
|
|
4
4
|
import { Message } from 'amqplib';
|
|
5
|
-
import 'jest-extended';
|
|
6
5
|
import { BrokerAsPromised } from 'rascal';
|
|
6
|
+
import { afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
7
7
|
import { MosaicFinalRedeliveryError } from './common';
|
|
8
8
|
import { MessageHandler } from './message-handler';
|
|
9
9
|
import Subscription from './subscription';
|