@volontariapp/outbox 0.1.0-snap-1f9d6ff
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/CHANGELOG.md +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/outbox/index.d.ts +3 -0
- package/dist/outbox/index.d.ts.map +1 -0
- package/dist/outbox/index.js +3 -0
- package/dist/outbox/index.js.map +1 -0
- package/dist/outbox/writer/event-queue.writer.d.ts +4 -0
- package/dist/outbox/writer/event-queue.writer.d.ts.map +1 -0
- package/dist/outbox/writer/event-queue.writer.js +4 -0
- package/dist/outbox/writer/event-queue.writer.js.map +1 -0
- package/dist/outbox/writer/jobs-outbox.writer.d.ts +4 -0
- package/dist/outbox/writer/jobs-outbox.writer.d.ts.map +1 -0
- package/dist/outbox/writer/jobs-outbox.writer.js +4 -0
- package/dist/outbox/writer/jobs-outbox.writer.js.map +1 -0
- package/dist/test/data-source.d.ts +5 -0
- package/dist/test/data-source.d.ts.map +1 -0
- package/dist/test/data-source.js +25 -0
- package/dist/test/data-source.js.map +1 -0
- package/dist/test/global-setup.d.ts +3 -0
- package/dist/test/global-setup.d.ts.map +1 -0
- package/dist/test/global-setup.js +29 -0
- package/dist/test/global-setup.js.map +1 -0
- package/dist/test/outbox/event/event-queue.writer.int.spec.d.ts +2 -0
- package/dist/test/outbox/event/event-queue.writer.int.spec.d.ts.map +1 -0
- package/dist/test/outbox/event/event-queue.writer.int.spec.js +60 -0
- package/dist/test/outbox/event/event-queue.writer.int.spec.js.map +1 -0
- package/dist/test/outbox/event/event-queue.writer.unit.spec.d.ts +2 -0
- package/dist/test/outbox/event/event-queue.writer.unit.spec.d.ts.map +1 -0
- package/dist/test/outbox/event/event-queue.writer.unit.spec.js +48 -0
- package/dist/test/outbox/event/event-queue.writer.unit.spec.js.map +1 -0
- package/dist/test/outbox/jobs/jobs-outbox.writer.int.spec.d.ts +2 -0
- package/dist/test/outbox/jobs/jobs-outbox.writer.int.spec.d.ts.map +1 -0
- package/dist/test/outbox/jobs/jobs-outbox.writer.int.spec.js +57 -0
- package/dist/test/outbox/jobs/jobs-outbox.writer.int.spec.js.map +1 -0
- package/dist/test/outbox/jobs/jobs-outbox.writer.unit.spec.d.ts +2 -0
- package/dist/test/outbox/jobs/jobs-outbox.writer.unit.spec.d.ts.map +1 -0
- package/dist/test/outbox/jobs/jobs-outbox.writer.unit.spec.js +42 -0
- package/dist/test/outbox/jobs/jobs-outbox.writer.unit.spec.js.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +2 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/test/utils/helpers/event-queue-event.helper.d.ts +3 -0
- package/dist/test/utils/helpers/event-queue-event.helper.d.ts.map +1 -0
- package/dist/test/utils/helpers/event-queue-event.helper.js +17 -0
- package/dist/test/utils/helpers/event-queue-event.helper.js.map +1 -0
- package/dist/test/utils/helpers/jobs-outbox-event.helper.d.ts +3 -0
- package/dist/test/utils/helpers/jobs-outbox-event.helper.d.ts.map +1 -0
- package/dist/test/utils/helpers/jobs-outbox-event.helper.js +16 -0
- package/dist/test/utils/helpers/jobs-outbox-event.helper.js.map +1 -0
- package/dist/test/utils/helpers/logger-mock.helper.d.ts +10 -0
- package/dist/test/utils/helpers/logger-mock.helper.d.ts.map +1 -0
- package/dist/test/utils/helpers/logger-mock.helper.js +9 -0
- package/dist/test/utils/helpers/logger-mock.helper.js.map +1 -0
- package/dist/test/utils/helpers/outbox-writer-mock.helper.d.ts +5 -0
- package/dist/test/utils/helpers/outbox-writer-mock.helper.d.ts.map +1 -0
- package/dist/test/utils/helpers/outbox-writer-mock.helper.js +10 -0
- package/dist/test/utils/helpers/outbox-writer-mock.helper.js.map +1 -0
- package/dist/test/utils/repositories/event-queue-test.repository.d.ts +5 -0
- package/dist/test/utils/repositories/event-queue-test.repository.d.ts.map +1 -0
- package/dist/test/utils/repositories/event-queue-test.repository.js +7 -0
- package/dist/test/utils/repositories/event-queue-test.repository.js.map +1 -0
- package/dist/test/utils/repositories/jobs-outbox-test.repository.d.ts +5 -0
- package/dist/test/utils/repositories/jobs-outbox-test.repository.d.ts.map +1 -0
- package/dist/test/utils/repositories/jobs-outbox-test.repository.js +7 -0
- package/dist/test/utils/repositories/jobs-outbox-test.repository.js.map +1 -0
- package/package.json +54 -0
package/CHANGELOG.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/outbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/outbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue.writer.d.ts","sourceRoot":"","sources":["../../../src/outbox/writer/event-queue.writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF,qBAAa,gBAAiB,SAAQ,YAAY,CAAC,eAAe,EAAE,gBAAgB,CAAC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue.writer.js","sourceRoot":"","sources":["../../../src/outbox/writer/event-queue.writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF,MAAM,OAAO,gBAAiB,SAAQ,YAA+C;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox.writer.d.ts","sourceRoot":"","sources":["../../../src/outbox/writer/jobs-outbox.writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF,qBAAa,gBAAiB,SAAQ,YAAY,CAAC,eAAe,EAAE,gBAAgB,CAAC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox.writer.js","sourceRoot":"","sources":["../../../src/outbox/writer/jobs-outbox.writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF,MAAM,OAAO,gBAAiB,SAAQ,YAA+C;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../src/test/data-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,eAAO,MAAM,cAAc,YAWzB,CAAC;AAEH,eAAO,MAAM,gBAAgB,qBAI5B,CAAC;AAEF,eAAO,MAAM,WAAW,qBAIvB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
import { EventQueueModel, JobsOutboxModel } from '@volontariapp/database';
|
|
3
|
+
export const testDataSource = new DataSource({
|
|
4
|
+
type: 'postgres',
|
|
5
|
+
host: 'localhost',
|
|
6
|
+
port: 5433,
|
|
7
|
+
username: 'testuser',
|
|
8
|
+
password: 'testpassword',
|
|
9
|
+
database: 'volontariapp_test',
|
|
10
|
+
entities: [JobsOutboxModel, EventQueueModel],
|
|
11
|
+
synchronize: true,
|
|
12
|
+
logging: false,
|
|
13
|
+
dropSchema: true,
|
|
14
|
+
});
|
|
15
|
+
export const initializeTestDb = async () => {
|
|
16
|
+
if (!testDataSource.isInitialized) {
|
|
17
|
+
await testDataSource.initialize();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export const closeTestDb = async () => {
|
|
21
|
+
if (testDataSource.isInitialized) {
|
|
22
|
+
await testDataSource.destroy();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=data-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-source.js","sourceRoot":"","sources":["../../src/test/data-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE1E,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC;IAC3C,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IAC5C,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,IAAI;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,IAAI,EAAE;IACzC,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;QAClC,MAAM,cAAc,CAAC,UAAU,EAAE,CAAC;IACpC,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;IACpC,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,cAAc,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-setup.d.ts","sourceRoot":"","sources":["../../src/test/global-setup.ts"],"names":[],"mappings":";AAIA,wBA0BE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PostgresProvider } from '@volontariapp/bridge';
|
|
2
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3
|
+
export default async () => {
|
|
4
|
+
const provider = new PostgresProvider({
|
|
5
|
+
host: 'localhost',
|
|
6
|
+
port: 5433,
|
|
7
|
+
username: 'testuser',
|
|
8
|
+
password: 'testpassword',
|
|
9
|
+
database: 'volontariapp_test',
|
|
10
|
+
});
|
|
11
|
+
const maxAttempts = 20;
|
|
12
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
13
|
+
try {
|
|
14
|
+
await provider.connect();
|
|
15
|
+
const dataSource = provider.getDriver();
|
|
16
|
+
await dataSource.query('SELECT 1');
|
|
17
|
+
await provider.disconnect();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
await provider.disconnect().catch(() => undefined);
|
|
22
|
+
if (attempt === maxAttempts) {
|
|
23
|
+
throw new Error('Test database is not reachable. Start it before running tests.');
|
|
24
|
+
}
|
|
25
|
+
await sleep(500);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=global-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-setup.js","sourceRoot":"","sources":["../../src/test/global-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAEhF,eAAe,KAAK,IAAI,EAAE;IACxB,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC;QACpC,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,cAAc;QACxB,QAAQ,EAAE,mBAAmB;KAC9B,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,EAAE,CAAC;IAEvB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QAC3D,IAAI,CAAC;YACH,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YACzB,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;YACxC,MAAM,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACnC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;YAC5B,OAAO;QACT,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACnD,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;YACpF,CAAC;YACD,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue.writer.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/test/outbox/event/event-queue.writer.int.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { describe, expect, it, beforeAll, afterAll, beforeEach } from '@jest/globals';
|
|
2
|
+
import { databaseMapper, EventQueueModel, EventQueueEntity, OutboxStatus, } from '@volontariapp/database';
|
|
3
|
+
import { testDataSource, initializeTestDb, closeTestDb } from '../../data-source.js';
|
|
4
|
+
import { EventQueueWriter } from '../../../outbox/writer/event-queue.writer.js';
|
|
5
|
+
import { makeEventQueueEvent } from '../../utils/helpers/event-queue-event.helper.js';
|
|
6
|
+
import { TestEventQueueWriterRepository } from '../../utils/repositories/event-queue-test.repository.js';
|
|
7
|
+
describe('EventQueueWriter (Full Integration)', () => {
|
|
8
|
+
let writer;
|
|
9
|
+
const logger = {
|
|
10
|
+
info: () => undefined,
|
|
11
|
+
warn: () => undefined,
|
|
12
|
+
error: () => undefined,
|
|
13
|
+
};
|
|
14
|
+
beforeAll(async () => {
|
|
15
|
+
await initializeTestDb();
|
|
16
|
+
databaseMapper.registerBidirectional(EventQueueModel, EventQueueEntity);
|
|
17
|
+
writer = new EventQueueWriter(logger, new TestEventQueueWriterRepository(testDataSource.getRepository(EventQueueModel)));
|
|
18
|
+
});
|
|
19
|
+
afterAll(async () => {
|
|
20
|
+
await closeTestDb();
|
|
21
|
+
});
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
await testDataSource.getRepository(EventQueueModel).createQueryBuilder().delete().execute();
|
|
24
|
+
});
|
|
25
|
+
it('create() should persist default values when not overridden', async () => {
|
|
26
|
+
const event = makeEventQueueEvent();
|
|
27
|
+
await writer.create(event);
|
|
28
|
+
const row = await testDataSource
|
|
29
|
+
.getRepository(EventQueueModel)
|
|
30
|
+
.findOneByOrFail({ type: 'event.entity.updated' });
|
|
31
|
+
expect(row.status).toBe(OutboxStatus.PENDING);
|
|
32
|
+
expect(row.attempts).toBe(0);
|
|
33
|
+
expect(row.version).toBe(1);
|
|
34
|
+
expect(row.payload).toEqual({ after: { id: 'entity-1', state: 'created' } });
|
|
35
|
+
});
|
|
36
|
+
it('create() should persist overridden values', async () => {
|
|
37
|
+
const event = makeEventQueueEvent({
|
|
38
|
+
type: 'event.entity.published',
|
|
39
|
+
status: OutboxStatus.FAILED,
|
|
40
|
+
attempts: 2,
|
|
41
|
+
version: 8,
|
|
42
|
+
payload: {
|
|
43
|
+
before: { id: 'entity-1', state: 'draft' },
|
|
44
|
+
after: { id: 'entity-1', state: 'published' },
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
await writer.create(event);
|
|
48
|
+
const row = await testDataSource
|
|
49
|
+
.getRepository(EventQueueModel)
|
|
50
|
+
.findOneByOrFail({ type: 'event.entity.published' });
|
|
51
|
+
expect(row.status).toBe(OutboxStatus.FAILED);
|
|
52
|
+
expect(row.attempts).toBe(2);
|
|
53
|
+
expect(row.version).toBe(8);
|
|
54
|
+
expect(row.payload).toEqual({
|
|
55
|
+
before: { id: 'entity-1', state: 'draft' },
|
|
56
|
+
after: { id: 'entity-1', state: 'published' },
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=event-queue.writer.int.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue.writer.int.spec.js","sourceRoot":"","sources":["../../../../src/test/outbox/event/event-queue.writer.int.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,YAAY,GAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yDAAyD,CAAC;AAEzG,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,IAAI,MAAwB,CAAC;IAE7B,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,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 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue.writer.unit.spec.d.ts","sourceRoot":"","sources":["../../../../src/test/outbox/event/event-queue.writer.unit.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { describe, expect, it, beforeEach } from '@jest/globals';
|
|
2
|
+
import { OutboxStatus, } from '@volontariapp/database';
|
|
3
|
+
import { EventQueueWriter } from '../../../outbox/writer/event-queue.writer.js';
|
|
4
|
+
import { makeEventQueueEvent } from '../../utils/helpers/event-queue-event.helper.js';
|
|
5
|
+
import { makeLoggerMock } from '../../utils/helpers/logger-mock.helper.js';
|
|
6
|
+
import { makeOutboxWriterRepositoryMock, } from '../../utils/helpers/outbox-writer-mock.helper.js';
|
|
7
|
+
describe('EventQueueWriter (Unit)', () => {
|
|
8
|
+
let writer;
|
|
9
|
+
let repository;
|
|
10
|
+
let logger;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
repository = makeOutboxWriterRepositoryMock();
|
|
13
|
+
logger = makeLoggerMock();
|
|
14
|
+
writer = new EventQueueWriter(logger, repository);
|
|
15
|
+
});
|
|
16
|
+
it('create() should pass default values when not overridden', async () => {
|
|
17
|
+
const event = makeEventQueueEvent();
|
|
18
|
+
await writer.create(event);
|
|
19
|
+
expect(repository.create).toHaveBeenCalledTimes(1);
|
|
20
|
+
const created = repository.create.mock.calls[0][0];
|
|
21
|
+
expect(created.status).toBe(OutboxStatus.PENDING);
|
|
22
|
+
expect(created.attempts).toBe(0);
|
|
23
|
+
expect(created.version).toBe(1);
|
|
24
|
+
expect(created.payload).toEqual({ after: { id: 'entity-1', state: 'created' } });
|
|
25
|
+
});
|
|
26
|
+
it('create() should keep overridden values when provided', async () => {
|
|
27
|
+
const event = makeEventQueueEvent({
|
|
28
|
+
status: OutboxStatus.FAILED,
|
|
29
|
+
attempts: 2,
|
|
30
|
+
version: 7,
|
|
31
|
+
payload: {
|
|
32
|
+
before: { id: 'entity-1', state: 'draft' },
|
|
33
|
+
after: { id: 'entity-1', state: 'published' },
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
await writer.create(event);
|
|
37
|
+
expect(repository.create).toHaveBeenCalledTimes(1);
|
|
38
|
+
const created = repository.create.mock.calls[0][0];
|
|
39
|
+
expect(created.status).toBe(OutboxStatus.FAILED);
|
|
40
|
+
expect(created.attempts).toBe(2);
|
|
41
|
+
expect(created.version).toBe(7);
|
|
42
|
+
expect(created.payload).toEqual({
|
|
43
|
+
before: { id: 'entity-1', state: 'draft' },
|
|
44
|
+
after: { id: 'entity-1', state: 'published' },
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=event-queue.writer.unit.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue.writer.unit.spec.js","sourceRoot":"","sources":["../../../../src/test/outbox/event/event-queue.writer.unit.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAIL,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,cAAc,EAAuB,MAAM,2CAA2C,CAAC;AAChG,OAAO,EACL,8BAA8B,GAE/B,MAAM,kDAAkD,CAAC;AAE1D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,IAAI,MAAwB,CAAC;IAC7B,IAAI,UAAyE,CAAC;IAC9E,IAAI,MAAsB,CAAC;IAE3B,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG,8BAA8B,EAAqC,CAAC;QACjF,MAAM,GAAG,cAAc,EAAE,CAAC;QAC1B,MAAM,GAAG,IAAI,gBAAgB,CAC3B,MAAe,EACf,UAAkF,CACnF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AU,CAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACjD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;YAC9B,MAAM,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE;YAC1C,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE;SAC9C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox.writer.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/test/outbox/jobs/jobs-outbox.writer.int.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, expect, it, beforeAll, afterAll, beforeEach } from '@jest/globals';
|
|
2
|
+
import { databaseMapper, JobsOutboxModel, JobsOutboxEntity, OutboxStatus, } from '@volontariapp/database';
|
|
3
|
+
import { testDataSource, initializeTestDb, closeTestDb } from '../../data-source.js';
|
|
4
|
+
import { JobsOutboxWriter } from '../../../outbox/writer/jobs-outbox.writer.js';
|
|
5
|
+
import { makeJobsOutboxEvent } from '../../utils/helpers/jobs-outbox-event.helper.js';
|
|
6
|
+
import { TestJobsOutboxWriterRepository } from '../../utils/repositories/jobs-outbox-test.repository.js';
|
|
7
|
+
describe('JobsOutboxWriter (Full Integration)', () => {
|
|
8
|
+
let writer;
|
|
9
|
+
const logger = {
|
|
10
|
+
info: () => undefined,
|
|
11
|
+
warn: () => undefined,
|
|
12
|
+
error: () => undefined,
|
|
13
|
+
};
|
|
14
|
+
beforeAll(async () => {
|
|
15
|
+
await initializeTestDb();
|
|
16
|
+
databaseMapper.registerBidirectional(JobsOutboxModel, JobsOutboxEntity);
|
|
17
|
+
writer = new JobsOutboxWriter(logger, new TestJobsOutboxWriterRepository(testDataSource.getRepository(JobsOutboxModel)));
|
|
18
|
+
});
|
|
19
|
+
afterAll(async () => {
|
|
20
|
+
await closeTestDb();
|
|
21
|
+
});
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
await testDataSource.getRepository(JobsOutboxModel).createQueryBuilder().delete().execute();
|
|
24
|
+
});
|
|
25
|
+
it('create() should persist default values when not overridden', async () => {
|
|
26
|
+
const event = makeJobsOutboxEvent();
|
|
27
|
+
await writer.create(event);
|
|
28
|
+
const row = await testDataSource
|
|
29
|
+
.getRepository(JobsOutboxModel)
|
|
30
|
+
.findOneByOrFail({ type: 'jobs.process' });
|
|
31
|
+
expect(row.status).toBe(OutboxStatus.PENDING);
|
|
32
|
+
expect(row.attempts).toBe(0);
|
|
33
|
+
expect(row.target).toBe('queue:default');
|
|
34
|
+
expect(row.payload).toEqual({ action: 'process-user', data: { userId: 'u-1' } });
|
|
35
|
+
expect(row.scheduledAt).toEqual(event.scheduledAt);
|
|
36
|
+
});
|
|
37
|
+
it('create() should persist overridden values', async () => {
|
|
38
|
+
const event = makeJobsOutboxEvent({
|
|
39
|
+
type: 'jobs.retry',
|
|
40
|
+
status: OutboxStatus.PROCESSING,
|
|
41
|
+
attempts: 4,
|
|
42
|
+
target: 'queue:critical',
|
|
43
|
+
payload: { action: 'retry-job', data: { userId: 'u-99' } },
|
|
44
|
+
scheduledAt: new Date('2030-01-02T00:00:00.000Z'),
|
|
45
|
+
});
|
|
46
|
+
await writer.create(event);
|
|
47
|
+
const row = await testDataSource
|
|
48
|
+
.getRepository(JobsOutboxModel)
|
|
49
|
+
.findOneByOrFail({ type: 'jobs.retry' });
|
|
50
|
+
expect(row.status).toBe(OutboxStatus.PROCESSING);
|
|
51
|
+
expect(row.attempts).toBe(4);
|
|
52
|
+
expect(row.target).toBe('queue:critical');
|
|
53
|
+
expect(row.payload).toEqual({ action: 'retry-job', data: { userId: 'u-99' } });
|
|
54
|
+
expect(row.scheduledAt).toEqual(event.scheduledAt);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=jobs-outbox.writer.int.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox.writer.int.spec.js","sourceRoot":"","sources":["../../../../src/test/outbox/jobs/jobs-outbox.writer.int.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,YAAY,GAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yDAAyD,CAAC;AAEzG,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,IAAI,MAAwB,CAAC;IAE7B,MAAM,MAAM,GAAG;QACb,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;KACvB,CAAC;IAEF,SAAS,CAAC,KAAK,IAA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-outbox.writer.unit.spec.d.ts","sourceRoot":"","sources":["../../../../src/test/outbox/jobs/jobs-outbox.writer.unit.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it, beforeEach } from '@jest/globals';
|
|
2
|
+
import { OutboxStatus, } from '@volontariapp/database';
|
|
3
|
+
import { JobsOutboxWriter } from '../../../outbox/writer/jobs-outbox.writer.js';
|
|
4
|
+
import { makeJobsOutboxEvent } from '../../utils/helpers/jobs-outbox-event.helper.js';
|
|
5
|
+
import { makeLoggerMock } from '../../utils/helpers/logger-mock.helper.js';
|
|
6
|
+
import { makeOutboxWriterRepositoryMock, } from '../../utils/helpers/outbox-writer-mock.helper.js';
|
|
7
|
+
describe('JobsOutboxWriter (Unit)', () => {
|
|
8
|
+
let writer;
|
|
9
|
+
let repository;
|
|
10
|
+
let logger;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
repository = makeOutboxWriterRepositoryMock();
|
|
13
|
+
logger = makeLoggerMock();
|
|
14
|
+
writer = new JobsOutboxWriter(logger, repository);
|
|
15
|
+
});
|
|
16
|
+
it('create() should pass default values when not overridden', async () => {
|
|
17
|
+
const event = makeJobsOutboxEvent();
|
|
18
|
+
await writer.create(event);
|
|
19
|
+
expect(repository.create).toHaveBeenCalledTimes(1);
|
|
20
|
+
const created = repository.create.mock.calls[0][0];
|
|
21
|
+
expect(created.status).toBe(OutboxStatus.PENDING);
|
|
22
|
+
expect(created.attempts).toBe(0);
|
|
23
|
+
expect(created.target).toBe('queue:default');
|
|
24
|
+
expect(created.payload).toEqual({ action: 'process-user', data: { userId: 'u-1' } });
|
|
25
|
+
});
|
|
26
|
+
it('create() should keep overridden values when provided', async () => {
|
|
27
|
+
const event = makeJobsOutboxEvent({
|
|
28
|
+
status: OutboxStatus.PROCESSING,
|
|
29
|
+
attempts: 3,
|
|
30
|
+
target: 'queue:high-priority',
|
|
31
|
+
payload: { action: 'retry-job', data: { userId: 'u-42' } },
|
|
32
|
+
});
|
|
33
|
+
await writer.create(event);
|
|
34
|
+
expect(repository.create).toHaveBeenCalledTimes(1);
|
|
35
|
+
const created = repository.create.mock.calls[0][0];
|
|
36
|
+
expect(created.status).toBe(OutboxStatus.PROCESSING);
|
|
37
|
+
expect(created.attempts).toBe(3);
|
|
38
|
+
expect(created.target).toBe('queue:high-priority');
|
|
39
|
+
expect(created.payload).toEqual({ action: 'retry-job', data: { userId: 'u-42' } });
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=jobs-outbox.writer.unit.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox.writer.unit.spec.js","sourceRoot":"","sources":["../../../../src/test/outbox/jobs/jobs-outbox.writer.unit.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAIL,YAAY,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,cAAc,EAAuB,MAAM,2CAA2C,CAAC;AAChG,OAAO,EACL,8BAA8B,GAE/B,MAAM,kDAAkD,CAAC;AAE1D,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,IAAI,MAAwB,CAAC;IAC7B,IAAI,UAAyE,CAAC;IAC9E,IAAI,MAAsB,CAAC;IAE3B,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG,8BAA8B,EAAqC,CAAC;QACjF,MAAM,GAAG,cAAc,EAAE,CAAC;QAC1B,MAAM,GAAG,IAAI,gBAAgB,CAC3B,MAAe,EACf,UAAkF,CACnF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;QACvE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C,CAAC,CAAC;QACnD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACrD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACnD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/test/setup.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/test/setup.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue-event.helper.d.ts","sourceRoot":"","sources":["../../../../src/test/utils/helpers/event-queue-event.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAExE,eAAO,MAAM,mBAAmB,eACnB,OAAO,CAAC,gBAAgB,CAAC,KACnC,gBAcF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OutboxStatus, EventQueueEntity } from '@volontariapp/database';
|
|
2
|
+
export const makeEventQueueEvent = (overrides = {}) => {
|
|
3
|
+
return Object.assign(new EventQueueEntity(), {
|
|
4
|
+
type: 'event.entity.updated',
|
|
5
|
+
emitter: 'database-tests',
|
|
6
|
+
version: 1,
|
|
7
|
+
payload: {
|
|
8
|
+
after: { id: 'entity-1', state: 'created' },
|
|
9
|
+
},
|
|
10
|
+
status: OutboxStatus.PENDING,
|
|
11
|
+
attempts: 0,
|
|
12
|
+
createdAt: new Date(Date.now() - 60_000),
|
|
13
|
+
updatedAt: new Date(),
|
|
14
|
+
...overrides,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=event-queue-event.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue-event.helper.js","sourceRoot":"","sources":["../../../../src/test/utils/helpers/event-queue-event.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAExE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,YAAuC,EAAE,EACvB,EAAE;IACpB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,gBAAgB,EAAE,EAAE;QAC3C,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,gBAAgB;QACzB,OAAO,EAAE,CAAC;QACV,OAAO,EAAE;YACP,KAAK,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE;SAC5C;QACD,MAAM,EAAE,YAAY,CAAC,OAAO;QAC5B,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;QACxC,SAAS,EAAE,IAAI,IAAI,EAAE;QACrB,GAAG,SAAS;KACb,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox-event.helper.d.ts","sourceRoot":"","sources":["../../../../src/test/utils/helpers/jobs-outbox-event.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAExE,eAAO,MAAM,mBAAmB,eACnB,OAAO,CAAC,gBAAgB,CAAC,KACnC,gBAaF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OutboxStatus, JobsOutboxEntity } from '@volontariapp/database';
|
|
2
|
+
export const makeJobsOutboxEvent = (overrides = {}) => {
|
|
3
|
+
return Object.assign(new JobsOutboxEntity(), {
|
|
4
|
+
type: 'jobs.process',
|
|
5
|
+
emitter: 'database-tests',
|
|
6
|
+
target: 'queue:default',
|
|
7
|
+
payload: { action: 'process-user', data: { userId: 'u-1' } },
|
|
8
|
+
status: OutboxStatus.PENDING,
|
|
9
|
+
attempts: 0,
|
|
10
|
+
scheduledAt: new Date('2030-01-01T00:00:00.000Z'),
|
|
11
|
+
createdAt: new Date(Date.now() - 60_000),
|
|
12
|
+
updatedAt: new Date(),
|
|
13
|
+
...overrides,
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=jobs-outbox-event.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox-event.helper.js","sourceRoot":"","sources":["../../../../src/test/utils/helpers/jobs-outbox-event.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAExE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,YAAuC,EAAE,EACvB,EAAE;IACpB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,gBAAgB,EAAE,EAAE;QAC3C,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,gBAAgB;QACzB,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;QAC5D,MAAM,EAAE,YAAY,CAAC,OAAO;QAC5B,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,IAAI,IAAI,CAAC,0BAA0B,CAAC;QACjD,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;QACxC,SAAS,EAAE,IAAI,IAAI,EAAE;QACrB,GAAG,SAAS;KACb,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
type LoggerLike = {
|
|
3
|
+
info: (...args: unknown[]) => void;
|
|
4
|
+
warn: (...args: unknown[]) => void;
|
|
5
|
+
error: (...args: unknown[]) => void;
|
|
6
|
+
};
|
|
7
|
+
export type TestLoggerMock = LoggerLike & jest.Mocked<Pick<LoggerLike, 'info' | 'warn' | 'error'>>;
|
|
8
|
+
export declare const makeLoggerMock: () => TestLoggerMock;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=logger-mock.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-mock.helper.d.ts","sourceRoot":"","sources":["../../../../src/test/utils/helpers/logger-mock.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;AAEnG,eAAO,MAAM,cAAc,QAAO,cAMjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-mock.helper.js","sourceRoot":"","sources":["../../../../src/test/utils/helpers/logger-mock.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAUrC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAmB,EAAE;IACjD,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;QACf,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;QACf,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;KACY,CAAC;AACjC,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { OutboxEntity, OutboxModel, type BaseRepository } from '@volontariapp/database';
|
|
3
|
+
export type OutboxWriterRepositoryMock<TModel extends OutboxModel, TEntity extends OutboxEntity> = jest.Mocked<Pick<BaseRepository<TModel, TEntity, string>, 'create' | 'createMany' | 'update' | 'delete'>>;
|
|
4
|
+
export declare const makeOutboxWriterRepositoryMock: <TModel extends OutboxModel, TEntity extends OutboxEntity>() => OutboxWriterRepositoryMock<TModel, TEntity>;
|
|
5
|
+
//# sourceMappingURL=outbox-writer-mock.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-writer-mock.helper.d.ts","sourceRoot":"","sources":["../../../../src/test/utils/helpers/outbox-writer-mock.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExF,MAAM,MAAM,0BAA0B,CACpC,MAAM,SAAS,WAAW,EAC1B,OAAO,SAAS,YAAY,IAC1B,IAAI,CAAC,MAAM,CACb,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAC7F,CAAC;AAEF,eAAO,MAAM,8BAA8B,GACzC,MAAM,SAAS,WAAW,EAC1B,OAAO,SAAS,YAAY,OACzB,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAO9C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
export const makeOutboxWriterRepositoryMock = () => {
|
|
3
|
+
return {
|
|
4
|
+
create: jest.fn(async () => ({})),
|
|
5
|
+
createMany: jest.fn(async () => []),
|
|
6
|
+
update: jest.fn(async () => ({})),
|
|
7
|
+
delete: jest.fn(async () => true),
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=outbox-writer-mock.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-writer-mock.helper.js","sourceRoot":"","sources":["../../../../src/test/utils/helpers/outbox-writer-mock.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAUrC,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAGG,EAAE;IACjD,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,CAAY,CAAC;QAC5C,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,EAAe,CAAC;QAChD,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,CAAY,CAAC;QAC5C,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC;KACwB,CAAC;AAC9D,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseRepository, EventQueueEntity, EventQueueModel, type Repository } from '@volontariapp/database';
|
|
2
|
+
export declare class TestEventQueueWriterRepository extends BaseRepository<EventQueueModel, EventQueueEntity, string> {
|
|
3
|
+
constructor(repository: Repository<EventQueueModel>);
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=event-queue-test.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue-test.repository.d.ts","sourceRoot":"","sources":["../../../../src/test/utils/repositories/event-queue-test.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE5G,qBAAa,8BAA+B,SAAQ,cAAc,CAChE,eAAe,EACf,gBAAgB,EAChB,MAAM,CACP;gBACa,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC;CAGpD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseRepository, EventQueueEntity, EventQueueModel } from '@volontariapp/database';
|
|
2
|
+
export class TestEventQueueWriterRepository extends BaseRepository {
|
|
3
|
+
constructor(repository) {
|
|
4
|
+
super(repository, EventQueueEntity, EventQueueModel);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=event-queue-test.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-queue-test.repository.js","sourceRoot":"","sources":["../../../../src/test/utils/repositories/event-queue-test.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAmB,MAAM,wBAAwB,CAAC;AAE5G,MAAM,OAAO,8BAA+B,SAAQ,cAInD;IACC,YAAY,UAAuC;QACjD,KAAK,CAAC,UAAmB,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseRepository, JobsOutboxEntity, JobsOutboxModel, type Repository } from '@volontariapp/database';
|
|
2
|
+
export declare class TestJobsOutboxWriterRepository extends BaseRepository<JobsOutboxModel, JobsOutboxEntity, string> {
|
|
3
|
+
constructor(repository: Repository<JobsOutboxModel>);
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=jobs-outbox-test.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox-test.repository.d.ts","sourceRoot":"","sources":["../../../../src/test/utils/repositories/jobs-outbox-test.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE5G,qBAAa,8BAA+B,SAAQ,cAAc,CAChE,eAAe,EACf,gBAAgB,EAChB,MAAM,CACP;gBACa,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC;CAGpD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseRepository, JobsOutboxEntity, JobsOutboxModel } from '@volontariapp/database';
|
|
2
|
+
export class TestJobsOutboxWriterRepository extends BaseRepository {
|
|
3
|
+
constructor(repository) {
|
|
4
|
+
super(repository, JobsOutboxEntity, JobsOutboxModel);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=jobs-outbox-test.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs-outbox-test.repository.js","sourceRoot":"","sources":["../../../../src/test/utils/repositories/jobs-outbox-test.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAmB,MAAM,wBAAwB,CAAC;AAE5G,MAAM,OAAO,8BAA+B,SAAQ,cAInD;IACC,YAAY,UAAuC;QACjD,KAAK,CAAC,UAAmB,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC;IAChE,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@volontariapp/outbox",
|
|
3
|
+
"version": "0.1.0-snap-1f9d6ff",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public",
|
|
6
|
+
"provenance": true
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Volontariapp/npm-packages.git"
|
|
11
|
+
},
|
|
12
|
+
"description": "",
|
|
13
|
+
"license": "UNLICENSED",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=24.14.0"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"prepublishOnly": "yarn build",
|
|
31
|
+
"build": "tsc -p tsconfig.json",
|
|
32
|
+
"lint": "eslint src/",
|
|
33
|
+
"test": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js",
|
|
34
|
+
"test:watch": "node --experimental-vm-modules ../../node_modules/jest/bin/jest.js --watch",
|
|
35
|
+
"db:up": "docker-compose -f ../../docker-compose.test.yml up -d",
|
|
36
|
+
"db:down": "docker-compose -f ../../docker-compose.test.yml down"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@volontariapp/database": "1.7.0-snap-1f9d6ff",
|
|
40
|
+
"@volontariapp/errors": "0.4.4",
|
|
41
|
+
"@volontariapp/logger": "0.2.3"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@jest/globals": "^30.3.0",
|
|
45
|
+
"@types/jest": "^30.0.0",
|
|
46
|
+
"@types/node": "^22.10.7",
|
|
47
|
+
"@types/pg": "^8",
|
|
48
|
+
"jest": "^30.3.0",
|
|
49
|
+
"ts-jest": "^29.4.6",
|
|
50
|
+
"ts-node": "^10.9.2",
|
|
51
|
+
"typeorm": "^0.3.28",
|
|
52
|
+
"typescript": "5.7.3"
|
|
53
|
+
}
|
|
54
|
+
}
|