@volontariapp/database 1.9.0 → 1.10.0-snap-2fc7103

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 (30) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/outbox/index.d.ts +2 -1
  3. package/dist/outbox/index.d.ts.map +1 -1
  4. package/dist/outbox/index.js +2 -1
  5. package/dist/outbox/index.js.map +1 -1
  6. package/dist/outbox/runners/outbox.runner.d.ts +15 -0
  7. package/dist/outbox/runners/outbox.runner.d.ts.map +1 -0
  8. package/dist/outbox/runners/outbox.runner.js +40 -0
  9. package/dist/outbox/runners/outbox.runner.js.map +1 -0
  10. package/dist/test/outbox/outbox.runner.int.spec.d.ts +2 -0
  11. package/dist/test/outbox/outbox.runner.int.spec.d.ts.map +1 -0
  12. package/dist/test/outbox/outbox.runner.int.spec.js +100 -0
  13. package/dist/test/outbox/outbox.runner.int.spec.js.map +1 -0
  14. package/dist/test/outbox/outbox.runner.unit.spec.d.ts +2 -0
  15. package/dist/test/outbox/outbox.runner.unit.spec.d.ts.map +1 -0
  16. package/dist/test/outbox/outbox.runner.unit.spec.js +76 -0
  17. package/dist/test/outbox/outbox.runner.unit.spec.js.map +1 -0
  18. package/dist/test/utils/helpers/outbox-event.helper.d.ts +3 -1
  19. package/dist/test/utils/helpers/outbox-event.helper.d.ts.map +1 -1
  20. package/dist/test/utils/helpers/outbox-event.helper.js +2 -2
  21. package/dist/test/utils/helpers/outbox-event.helper.js.map +1 -1
  22. package/dist/test/utils/index.d.ts +1 -0
  23. package/dist/test/utils/index.d.ts.map +1 -1
  24. package/dist/test/utils/index.js +1 -0
  25. package/dist/test/utils/index.js.map +1 -1
  26. package/dist/test/utils/repositories/event-queue-test.repository.d.ts +8 -0
  27. package/dist/test/utils/repositories/event-queue-test.repository.d.ts.map +1 -0
  28. package/dist/test/utils/repositories/event-queue-test.repository.js +11 -0
  29. package/dist/test/utils/repositories/event-queue-test.repository.js.map +1 -0
  30. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added outbox-runner first implementation
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - @volontariapp/bridge@0.2.10
13
+
3
14
  ## 1.9.0
4
15
 
5
16
  ### Minor Changes
@@ -1,3 +1,4 @@
1
+ export * from './types/outbox.status.js';
1
2
  export * from './entities/event-queue.entity.js';
2
3
  export * from './entities/jobs-outbox.entity.js';
3
4
  export * from './entities/outbox.entity.js';
@@ -5,6 +6,6 @@ export * from './models/event-queue.model.js';
5
6
  export * from './models/jobs-outbox.model.js';
6
7
  export * from './models/outbox.model.js';
7
8
  export * from './writers/outbox.writer.js';
8
- export * from './types/outbox.status.js';
9
9
  export * from './consumers/outbox.consumer.js';
10
+ export * from './runners/outbox.runner.js';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/outbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAE5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/outbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAE5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,gCAAgC,CAAC;AAE/C,cAAc,4BAA4B,CAAC"}
@@ -1,3 +1,4 @@
1
+ export * from './types/outbox.status.js';
1
2
  export * from './entities/event-queue.entity.js';
2
3
  export * from './entities/jobs-outbox.entity.js';
3
4
  export * from './entities/outbox.entity.js';
@@ -5,6 +6,6 @@ export * from './models/event-queue.model.js';
5
6
  export * from './models/jobs-outbox.model.js';
6
7
  export * from './models/outbox.model.js';
7
8
  export * from './writers/outbox.writer.js';
8
- export * from './types/outbox.status.js';
9
9
  export * from './consumers/outbox.consumer.js';
10
+ export * from './runners/outbox.runner.js';
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/outbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAE5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/outbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AAEzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAE5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,gCAAgC,CAAC;AAE/C,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { OutboxEntity, OutboxModel } from '../index.js';
2
+ import type { OutboxRunnerConfig } from '@volontariapp/config';
3
+ import type { BaseRepository } from '../../core/base.repository.js';
4
+ export declare class OutboxRunner<TOutboxModel extends OutboxModel, TOutboxEntity extends OutboxEntity> {
5
+ private readonly repository;
6
+ private readonly config;
7
+ private running;
8
+ private readonly logger;
9
+ private readonly consumer;
10
+ constructor(repository: BaseRepository<TOutboxModel, TOutboxEntity, string>, config: OutboxRunnerConfig);
11
+ runCycle(): Promise<void>;
12
+ start(): Promise<void>;
13
+ stop(): void;
14
+ }
15
+ //# sourceMappingURL=outbox.runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.runner.d.ts","sourceRoot":"","sources":["../../../src/outbox/runners/outbox.runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,qBAAa,YAAY,CAAC,YAAY,SAAS,WAAW,EAAE,aAAa,SAAS,YAAY;IAO1F,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPzB,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8C;gBAGpD,UAAU,EAAE,cAAc,CAAC,YAAY,EAAE,aAAa,EAAE,MAAM,CAAC,EAC/D,MAAM,EAAE,kBAAkB;IAUvC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAQzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB5B,IAAI,IAAI,IAAI;CAIb"}
@@ -0,0 +1,40 @@
1
+ import { OutboxConsumer } from '../consumers/outbox.consumer.js';
2
+ import { Logger } from '@volontariapp/logger';
3
+ export class OutboxRunner {
4
+ repository;
5
+ config;
6
+ running = false;
7
+ logger;
8
+ consumer;
9
+ constructor(repository, config) {
10
+ this.repository = repository;
11
+ this.config = config;
12
+ this.logger = new Logger(config.logger);
13
+ this.consumer = new OutboxConsumer(this.logger, this.repository, config.batchSize);
14
+ }
15
+ async runCycle() {
16
+ try {
17
+ await this.consumer.fetchPendingItems();
18
+ }
19
+ catch (error) {
20
+ this.logger.error('Error during outbox run cycle', { error });
21
+ }
22
+ }
23
+ async start() {
24
+ if (this.running) {
25
+ this.logger.warn('Outbox runner is already running');
26
+ return;
27
+ }
28
+ this.logger.info('Starting outbox runner');
29
+ this.running = true;
30
+ while (this.running) {
31
+ await this.runCycle();
32
+ await new Promise((resolve) => setTimeout(resolve, this.config.batchIntervalMs));
33
+ }
34
+ }
35
+ stop() {
36
+ this.logger.info('Stopping outbox runner');
37
+ this.running = false;
38
+ }
39
+ }
40
+ //# sourceMappingURL=outbox.runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.runner.js","sourceRoot":"","sources":["../../../src/outbox/runners/outbox.runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,MAAM,OAAO,YAAY;IAOJ;IACA;IAPX,OAAO,GAAG,KAAK,CAAC;IAEP,MAAM,CAAS;IACf,QAAQ,CAA8C;IAEvE,YACmB,UAA+D,EAC/D,MAA0B;QAD1B,eAAU,GAAV,UAAU,CAAqD;QAC/D,WAAM,GAAN,MAAM,CAAoB;QAE3C,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,cAAc,CAChC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU,EACf,MAAM,CAAC,SAAS,CACjB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;YACrD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAGpB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;IAED,IAAI;QACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=outbox.runner.int.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.runner.int.spec.d.ts","sourceRoot":"","sources":["../../../src/test/outbox/outbox.runner.int.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,100 @@
1
+ import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
2
+ import { testDataSource, setupIntegrationTest } from '../utils/index.js';
3
+ import { EventQueueModel } from '../../outbox/models/event-queue.model.js';
4
+ import { EventQueueEntity } from '../../outbox/entities/event-queue.entity.js';
5
+ import { OutboxRunner } from '../../outbox/runners/outbox.runner.js';
6
+ import { OutboxWriter } from '../../outbox/writers/outbox.writer.js';
7
+ import { OutboxStatus } from '../../outbox/types/outbox.status.js';
8
+ import { EventQueueTestRepository } from '../utils/repositories/event-queue-test.repository.js';
9
+ import { makeLoggerMock } from '../utils/helpers/logger-mock.helper.js';
10
+ import { makeOutboxEvent } from '../utils/helpers/outbox-event.helper.js';
11
+ import { OutboxRunnerConfig, LoggerConfig, LoggerFormat } from '@volontariapp/config';
12
+ describe('Outbox Flow (Integration)', () => {
13
+ let repository;
14
+ let loggerMock;
15
+ let writer;
16
+ let runner;
17
+ setupIntegrationTest([EventQueueModel]);
18
+ beforeAll(() => {
19
+ loggerMock = makeLoggerMock();
20
+ repository = new EventQueueTestRepository(testDataSource.getRepository(EventQueueModel));
21
+ writer = new OutboxWriter(loggerMock, repository);
22
+ const config = new OutboxRunnerConfig();
23
+ config.batchIntervalMs = 50;
24
+ config.batchSize = 10;
25
+ config.logger = new LoggerConfig();
26
+ config.logger.format = LoggerFormat.JSON;
27
+ config.logger.level = 'debug';
28
+ runner = new OutboxRunner(repository, config);
29
+ });
30
+ afterAll(() => {
31
+ runner.stop();
32
+ });
33
+ it('should complete the whole flow for EventQueue: write -> run cycle -> mark as processing', async () => {
34
+ const repo = testDataSource.getRepository(EventQueueModel);
35
+ const event = makeOutboxEvent({
36
+ id: '00000000-0000-0000-0000-000000000001',
37
+ type: 'test.event',
38
+ emitter: 'test-suite',
39
+ status: OutboxStatus.PENDING,
40
+ attempts: 0,
41
+ createdAt: new Date(),
42
+ updatedAt: new Date(),
43
+ version: 1,
44
+ payload: { after: { foo: 'bar' } },
45
+ }, () => new EventQueueEntity());
46
+ await writer.create(event);
47
+ let dbItem = await repo.findOneBy({ id: event.id });
48
+ expect(dbItem).toBeDefined();
49
+ expect(dbItem?.status).toBe(OutboxStatus.PENDING);
50
+ expect(dbItem?.payload).toEqual({ after: { foo: 'bar' } });
51
+ void runner.start();
52
+ const maxAttempts = 10;
53
+ let attempts = 0;
54
+ let processed = false;
55
+ while (attempts < maxAttempts && !processed) {
56
+ await new Promise((resolve) => setTimeout(resolve, 100));
57
+ dbItem = await repo.findOneBy({ id: event.id });
58
+ if (dbItem?.status === OutboxStatus.PROCESSING) {
59
+ processed = true;
60
+ }
61
+ attempts++;
62
+ }
63
+ expect(dbItem?.status).toBe(OutboxStatus.PROCESSING);
64
+ runner.stop();
65
+ });
66
+ it('should process multiple EventQueue items in the flow', async () => {
67
+ const repo = testDataSource.getRepository(EventQueueModel);
68
+ const events = [2, 3, 4].map((i) => makeOutboxEvent({
69
+ id: `00000000-0000-0000-0000-00000000000${i.toString()}`,
70
+ type: 'test.event',
71
+ emitter: 'test-suite',
72
+ status: OutboxStatus.PENDING,
73
+ attempts: 0,
74
+ createdAt: new Date(),
75
+ updatedAt: new Date(),
76
+ version: 1,
77
+ payload: { after: { index: i } },
78
+ }, () => new EventQueueEntity()));
79
+ await writer.createMany(events);
80
+ void runner.start();
81
+ const maxAttempts = 10;
82
+ let attempts = 0;
83
+ let allProcessed = false;
84
+ while (attempts < maxAttempts && !allProcessed) {
85
+ await new Promise((resolve) => setTimeout(resolve, 100));
86
+ const count = await repo.countBy({ status: OutboxStatus.PROCESSING });
87
+ if (count >= 4) {
88
+ allProcessed = true;
89
+ }
90
+ attempts++;
91
+ }
92
+ const processedItems = await repo.findBy({ status: OutboxStatus.PROCESSING });
93
+ const processedIds = processedItems.map((i) => i.id);
94
+ expect(processedIds).toContain(events[0].id);
95
+ expect(processedIds).toContain(events[1].id);
96
+ expect(processedIds).toContain(events[2].id);
97
+ runner.stop();
98
+ });
99
+ });
100
+ //# sourceMappingURL=outbox.runner.int.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.runner.int.spec.js","sourceRoot":"","sources":["../../../src/test/outbox/outbox.runner.int.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,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AAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=outbox.runner.unit.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.runner.unit.spec.d.ts","sourceRoot":"","sources":["../../../src/test/outbox/outbox.runner.unit.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import { describe, expect, it, beforeEach, jest, afterEach } from '@jest/globals';
2
+ import { OutboxRunner } from '../../outbox/runners/outbox.runner.js';
3
+ import { OutboxConsumer } from '../../outbox/consumers/outbox.consumer.js';
4
+ import { OutboxRunnerConfig, LoggerConfig, LoggerFormat } from '@volontariapp/config';
5
+ import { Logger } from '@volontariapp/logger';
6
+ jest.mock('@volontariapp/logger');
7
+ describe('OutboxRunner (Unit)', () => {
8
+ let runner;
9
+ let repositoryMock;
10
+ let fetchPendingItemsSpy;
11
+ let loggerErrorSpy;
12
+ let loggerWarnSpy;
13
+ const config = new OutboxRunnerConfig();
14
+ config.batchIntervalMs = 200;
15
+ config.batchSize = 10;
16
+ config.logger = new LoggerConfig();
17
+ config.logger.format = LoggerFormat.JSON;
18
+ config.logger.level = 'info';
19
+ beforeEach(() => {
20
+ jest.useFakeTimers();
21
+ repositoryMock = {
22
+ metadata: { tableName: 'outbox' },
23
+ };
24
+ fetchPendingItemsSpy = jest.spyOn(OutboxConsumer.prototype, 'fetchPendingItems');
25
+ loggerErrorSpy = jest.spyOn(Logger.prototype, 'error');
26
+ loggerWarnSpy = jest.spyOn(Logger.prototype, 'warn');
27
+ runner = new OutboxRunner(repositoryMock, config);
28
+ });
29
+ afterEach(() => {
30
+ runner.stop();
31
+ jest.useRealTimers();
32
+ jest.restoreAllMocks();
33
+ });
34
+ it('should call fetchPendingItems periodically after start', async () => {
35
+ fetchPendingItemsSpy.mockResolvedValue([]);
36
+ void runner.start();
37
+ await jest.advanceTimersByTimeAsync(0);
38
+ expect(fetchPendingItemsSpy).toHaveBeenCalledTimes(1);
39
+ await jest.advanceTimersByTimeAsync(200);
40
+ expect(fetchPendingItemsSpy).toHaveBeenCalledTimes(2);
41
+ await jest.advanceTimersByTimeAsync(200);
42
+ expect(fetchPendingItemsSpy).toHaveBeenCalledTimes(3);
43
+ });
44
+ it('runCycle() should execute a single fetch and return', async () => {
45
+ fetchPendingItemsSpy.mockResolvedValue([]);
46
+ await runner.runCycle();
47
+ expect(fetchPendingItemsSpy).toHaveBeenCalledTimes(1);
48
+ expect(jest.getTimerCount()).toBe(0);
49
+ });
50
+ it('should log error if runCycle fails but continue running in start loop', async () => {
51
+ const error = new Error('Fetch failed');
52
+ fetchPendingItemsSpy.mockRejectedValueOnce(error);
53
+ fetchPendingItemsSpy.mockResolvedValue([]);
54
+ void runner.start();
55
+ await jest.advanceTimersByTimeAsync(0);
56
+ expect(loggerErrorSpy).toHaveBeenCalledWith('Error during outbox run cycle', { error });
57
+ expect(fetchPendingItemsSpy).toHaveBeenCalledTimes(1);
58
+ await jest.advanceTimersByTimeAsync(200);
59
+ expect(fetchPendingItemsSpy).toHaveBeenCalledTimes(2);
60
+ });
61
+ it('should stop running when stop is called', async () => {
62
+ fetchPendingItemsSpy.mockResolvedValue([]);
63
+ void runner.start();
64
+ await jest.advanceTimersByTimeAsync(0);
65
+ expect(fetchPendingItemsSpy).toHaveBeenCalledTimes(1);
66
+ runner.stop();
67
+ await jest.advanceTimersByTimeAsync(200);
68
+ expect(fetchPendingItemsSpy).toHaveBeenCalledTimes(1);
69
+ });
70
+ it('should not start multiple times', () => {
71
+ void runner.start();
72
+ void runner.start();
73
+ expect(loggerWarnSpy).toHaveBeenCalledWith('Outbox runner is already running');
74
+ });
75
+ });
76
+ //# sourceMappingURL=outbox.runner.unit.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outbox.runner.unit.spec.js","sourceRoot":"","sources":["../../../src/test/outbox/outbox.runner.unit.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU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,CAAC,CAAC"}
@@ -1,3 +1,5 @@
1
1
  import { OutboxModel } from '../../../outbox/models/outbox.model.js';
2
- export declare const makeOutboxEvent: (overrides?: Partial<OutboxModel>) => OutboxModel;
2
+ type OutboxFactory<TEvent extends OutboxModel> = () => TEvent;
3
+ export declare const makeOutboxEvent: <TEvent extends OutboxModel = OutboxModel>(overrides?: Partial<TEvent>, factory?: OutboxFactory<TEvent>) => TEvent;
4
+ export {};
3
5
  //# sourceMappingURL=outbox-event.helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"outbox-event.helper.d.ts","sourceRoot":"","sources":["../../../../src/test/utils/helpers/outbox-event.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,eAAO,MAAM,eAAe,eAAe,OAAO,CAAC,WAAW,CAAC,KAAQ,WAMtE,CAAC"}
1
+ {"version":3,"file":"outbox-event.helper.d.ts","sourceRoot":"","sources":["../../../../src/test/utils/helpers/outbox-event.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,KAAK,aAAa,CAAC,MAAM,SAAS,WAAW,IAAI,MAAM,MAAM,CAAC;AAE9D,eAAO,MAAM,eAAe,GAAI,MAAM,SAAS,WAAW,4BAC7C,OAAO,CAAC,MAAM,CAAC,YACjB,aAAa,CAAC,MAAM,CAAC,KAC7B,MAMF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { OutboxModel } from '../../../outbox/models/outbox.model.js';
2
- export const makeOutboxEvent = (overrides = {}) => {
3
- const event = new OutboxModel();
2
+ export const makeOutboxEvent = (overrides = {}, factory = () => new OutboxModel()) => {
3
+ const event = factory();
4
4
  event.type = 'user.created';
5
5
  event.emitter = 'database-tests';
6
6
  event.updatedAt = new Date();
@@ -1 +1 @@
1
- {"version":3,"file":"outbox-event.helper.js","sourceRoot":"","sources":["../../../../src/test/utils/helpers/outbox-event.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,YAAkC,EAAE,EAAe,EAAE;IACnF,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC;IAChC,KAAK,CAAC,IAAI,GAAG,cAAc,CAAC;IAC5B,KAAK,CAAC,OAAO,GAAG,gBAAgB,CAAC;IACjC,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC,CAAC"}
1
+ {"version":3,"file":"outbox-event.helper.js","sourceRoot":"","sources":["../../../../src/test/utils/helpers/outbox-event.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAIrE,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,YAA6B,EAAE,EAC/B,UAAiC,GAAG,EAAE,CAAC,IAAI,WAAW,EAAY,EAC1D,EAAE;IACV,MAAM,KAAK,GAAG,OAAO,EAAE,CAAC;IACxB,KAAK,CAAC,IAAI,GAAG,cAAc,CAAC;IAC5B,KAAK,CAAC,OAAO,GAAG,gBAAgB,CAAC;IACjC,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACzC,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export * from './helpers/extended-outbox-event.helper.js';
2
2
  export * from './helpers/logger-mock.helper.js';
3
3
  export * from './helpers/outbox-writer-mock.helper.js';
4
+ export * from './repositories/event-queue-test.repository.js';
4
5
  export * from './repositories/outbox-extended-test.repository.js';
5
6
  export * from './repositories/outbox-test.repository.js';
6
7
  export * from './integration.helper.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AAEvD,cAAc,mDAAmD,CAAC;AAClE,cAAc,0CAA0C,CAAC;AAEzD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AAEvD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mDAAmD,CAAC;AAClE,cAAc,0CAA0C,CAAC;AAEzD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export * from './helpers/extended-outbox-event.helper.js';
2
2
  export * from './helpers/logger-mock.helper.js';
3
3
  export * from './helpers/outbox-writer-mock.helper.js';
4
+ export * from './repositories/event-queue-test.repository.js';
4
5
  export * from './repositories/outbox-extended-test.repository.js';
5
6
  export * from './repositories/outbox-test.repository.js';
6
7
  export * from './integration.helper.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/test/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AAEvD,cAAc,mDAAmD,CAAC;AAClE,cAAc,0CAA0C,CAAC;AAEzD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/test/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AAEvD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mDAAmD,CAAC;AAClE,cAAc,0CAA0C,CAAC;AAEzD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Repository } from 'typeorm';
2
+ import { EventQueueEntity } from '../../../outbox/entities/event-queue.entity.js';
3
+ import { EventQueueModel } from '../../../outbox/models/event-queue.model.js';
4
+ import { BaseRepository } from '../../../core/base.repository.js';
5
+ export declare class EventQueueTestRepository extends BaseRepository<EventQueueModel, EventQueueEntity, string> {
6
+ constructor(repository: Repository<EventQueueModel>);
7
+ }
8
+ //# 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,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAKlE,qBAAa,wBAAyB,SAAQ,cAAc,CAC1D,eAAe,EACf,gBAAgB,EAChB,MAAM,CACP;gBACa,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC;CAGpD"}
@@ -0,0 +1,11 @@
1
+ import { EventQueueEntity } from '../../../outbox/entities/event-queue.entity.js';
2
+ import { EventQueueModel } from '../../../outbox/models/event-queue.model.js';
3
+ import { BaseRepository } from '../../../core/base.repository.js';
4
+ import { databaseMapper } from '../../../core/mapper.service.js';
5
+ databaseMapper.registerBidirectional(EventQueueModel, EventQueueEntity);
6
+ export class EventQueueTestRepository extends BaseRepository {
7
+ constructor(repository) {
8
+ super(repository, EventQueueEntity, EventQueueModel);
9
+ }
10
+ }
11
+ //# 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":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,cAAc,CAAC,qBAAqB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAExE,MAAM,OAAO,wBAAyB,SAAQ,cAI7C;IACC,YAAY,UAAuC;QACjD,KAAK,CAAC,UAAU,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC;IACvD,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volontariapp/database",
3
- "version": "1.9.0",
3
+ "version": "1.10.0-snap-2fc7103",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -36,7 +36,8 @@
36
36
  "db:down": "docker-compose -f ../../docker-compose.test.yml down"
37
37
  },
38
38
  "dependencies": {
39
- "@volontariapp/bridge": "0.2.9",
39
+ "@volontariapp/bridge": "0.2.10-snap-2fc7103",
40
+ "@volontariapp/config": "2.1.0-snap-2fc7103",
40
41
  "@volontariapp/errors": "0.5.0",
41
42
  "@volontariapp/logger": "0.2.3",
42
43
  "class-transformer": "^0.5.1",