@volontariapp/workers 0.1.0-snap-2348d76 → 0.1.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/core/base.worker.d.ts +0 -6
- package/dist/core/base.worker.d.ts.map +1 -1
- package/dist/core/base.worker.js +0 -79
- package/dist/core/base.worker.js.map +1 -1
- package/package.json +2 -10
- package/dist/data/entities/job-audit.entity.d.ts +0 -15
- package/dist/data/entities/job-audit.entity.d.ts.map +0 -1
- package/dist/data/entities/job-audit.entity.js +0 -14
- package/dist/data/entities/job-audit.entity.js.map +0 -1
- package/dist/data/index.d.ts +0 -5
- package/dist/data/index.d.ts.map +0 -1
- package/dist/data/index.js +0 -5
- package/dist/data/index.js.map +0 -1
- package/dist/data/models/job-audit.model.d.ts +0 -15
- package/dist/data/models/job-audit.model.d.ts.map +0 -1
- package/dist/data/models/job-audit.model.js +0 -73
- package/dist/data/models/job-audit.model.js.map +0 -1
- package/dist/data/repositories/job-audit.repository.d.ts +0 -9
- package/dist/data/repositories/job-audit.repository.d.ts.map +0 -1
- package/dist/data/repositories/job-audit.repository.js +0 -33
- package/dist/data/repositories/job-audit.repository.js.map +0 -1
- package/dist/data/types/job-audit.status.d.ts +0 -7
- package/dist/data/types/job-audit.status.d.ts.map +0 -1
- package/dist/data/types/job-audit.status.js +0 -8
- package/dist/data/types/job-audit.status.js.map +0 -1
- package/dist/test/data-source.d.ts +0 -5
- package/dist/test/data-source.d.ts.map +0 -1
- package/dist/test/data-source.js +0 -35
- package/dist/test/data-source.js.map +0 -1
- package/dist/test/global-setup.d.ts +0 -3
- package/dist/test/global-setup.d.ts.map +0 -1
- package/dist/test/global-setup.js +0 -46
- package/dist/test/global-setup.js.map +0 -1
- package/dist/test/migrations/1778328780881-InitialSchemaJobAudit.d.ts +0 -6
- package/dist/test/migrations/1778328780881-InitialSchemaJobAudit.d.ts.map +0 -1
- package/dist/test/migrations/1778328780881-InitialSchemaJobAudit.js +0 -92
- package/dist/test/migrations/1778328780881-InitialSchemaJobAudit.js.map +0 -1
- package/dist/test/redis-config.d.ts +0 -3
- package/dist/test/redis-config.d.ts.map +0 -1
- package/dist/test/redis-config.js +0 -8
- package/dist/test/redis-config.js.map +0 -1
- package/dist/test/setup.d.ts +0 -2
- package/dist/test/setup.d.ts.map +0 -1
- package/dist/test/setup.js +0 -2
- package/dist/test/setup.js.map +0 -1
- package/dist/test/specs/base-worker/base.worker.int.spec.d.ts +0 -2
- package/dist/test/specs/base-worker/base.worker.int.spec.d.ts.map +0 -1
- package/dist/test/specs/base-worker/base.worker.int.spec.js +0 -170
- package/dist/test/specs/base-worker/base.worker.int.spec.js.map +0 -1
- package/dist/test/specs/base-worker/base.worker.unit.spec.d.ts +0 -2
- package/dist/test/specs/base-worker/base.worker.unit.spec.d.ts.map +0 -1
- package/dist/test/specs/base-worker/base.worker.unit.spec.js +0 -89
- package/dist/test/specs/base-worker/base.worker.unit.spec.js.map +0 -1
- package/dist/test/utils/helpers/index.d.ts +0 -3
- package/dist/test/utils/helpers/index.d.ts.map +0 -1
- package/dist/test/utils/helpers/index.js +0 -3
- package/dist/test/utils/helpers/index.js.map +0 -1
- package/dist/test/utils/helpers/job/index.d.ts +0 -3
- package/dist/test/utils/helpers/job/index.d.ts.map +0 -1
- package/dist/test/utils/helpers/job/index.js +0 -3
- package/dist/test/utils/helpers/job/index.js.map +0 -1
- package/dist/test/utils/helpers/job/test-job.utils.d.ts +0 -6
- package/dist/test/utils/helpers/job/test-job.utils.d.ts.map +0 -1
- package/dist/test/utils/helpers/job/test-job.utils.js +0 -7
- package/dist/test/utils/helpers/job/test-job.utils.js.map +0 -1
- package/dist/test/utils/helpers/job/test-worker.utils.d.ts +0 -12
- package/dist/test/utils/helpers/job/test-worker.utils.d.ts.map +0 -1
- package/dist/test/utils/helpers/job/test-worker.utils.js +0 -14
- package/dist/test/utils/helpers/job/test-worker.utils.js.map +0 -1
- package/dist/test/utils/helpers/shared/database-cleanup.helper.d.ts +0 -4
- package/dist/test/utils/helpers/shared/database-cleanup.helper.d.ts.map +0 -1
- package/dist/test/utils/helpers/shared/database-cleanup.helper.js +0 -14
- package/dist/test/utils/helpers/shared/database-cleanup.helper.js.map +0 -1
- package/dist/test/utils/helpers/shared/index.d.ts +0 -3
- package/dist/test/utils/helpers/shared/index.d.ts.map +0 -1
- package/dist/test/utils/helpers/shared/index.js +0 -3
- package/dist/test/utils/helpers/shared/index.js.map +0 -1
- package/dist/test/utils/helpers/shared/redis-cleanup.helper.d.ts +0 -2
- package/dist/test/utils/helpers/shared/redis-cleanup.helper.d.ts.map +0 -1
- package/dist/test/utils/helpers/shared/redis-cleanup.helper.js +0 -12
- package/dist/test/utils/helpers/shared/redis-cleanup.helper.js.map +0 -1
- package/dist/test/utils/index.d.ts +0 -3
- package/dist/test/utils/index.d.ts.map +0 -1
- package/dist/test/utils/index.js +0 -3
- package/dist/test/utils/index.js.map +0 -1
- package/dist/test/utils/repositories/index.d.ts +0 -2
- package/dist/test/utils/repositories/index.d.ts.map +0 -1
- package/dist/test/utils/repositories/index.js +0 -2
- package/dist/test/utils/repositories/index.js.map +0 -1
- package/dist/test/utils/repositories/job-audit-test.repository.d.ts +0 -7
- package/dist/test/utils/repositories/job-audit-test.repository.d.ts.map +0 -1
- package/dist/test/utils/repositories/job-audit-test.repository.js +0 -9
- package/dist/test/utils/repositories/job-audit-test.repository.js.map +0 -1
|
@@ -2,16 +2,10 @@ import { WorkerHost } from '@nestjs/bullmq';
|
|
|
2
2
|
import { Logger } from '@volontariapp/logger';
|
|
3
3
|
import type { Job } from 'bullmq';
|
|
4
4
|
import type { JobMessagingType, JobRegistry } from '@volontariapp/messaging';
|
|
5
|
-
import type { JobAuditRepository } from '../data/index.js';
|
|
6
5
|
export declare abstract class BaseWorker<K extends JobMessagingType> extends WorkerHost {
|
|
7
|
-
protected readonly auditRepo?: JobAuditRepository | undefined;
|
|
8
6
|
protected readonly logger: Logger;
|
|
9
7
|
protected readonly workerId: string;
|
|
10
|
-
constructor(auditRepo?: JobAuditRepository | undefined);
|
|
11
8
|
process(job: Job<JobRegistry[K], void, K>, _token?: string): Promise<void>;
|
|
12
9
|
protected abstract processJob(job: Job<JobRegistry[K], void, K>): Promise<void>;
|
|
13
|
-
private recordAuditStart;
|
|
14
|
-
private recordAuditSuccess;
|
|
15
|
-
private recordAuditFailure;
|
|
16
10
|
}
|
|
17
11
|
//# sourceMappingURL=base.worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.worker.d.ts","sourceRoot":"","sources":["../../src/core/base.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"base.worker.d.ts","sourceRoot":"","sources":["../../src/core/base.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE7E,8BAAsB,UAAU,CAAC,CAAC,SAAS,gBAAgB,CAAE,SAAQ,UAAU;IAC7E,SAAS,CAAC,QAAQ,CAAC,MAAM,SAAkD;IAC3E,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAc;IAE3C,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBhF,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAChF"}
|
package/dist/core/base.worker.js
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import { WorkerHost } from '@nestjs/bullmq';
|
|
2
2
|
import { Logger } from '@volontariapp/logger';
|
|
3
3
|
import { hostname } from 'node:os';
|
|
4
|
-
import { JobAuditStatus } from '../data/index.js';
|
|
5
4
|
export class BaseWorker extends WorkerHost {
|
|
6
|
-
auditRepo;
|
|
7
5
|
logger = new Logger({ context: this.constructor.name });
|
|
8
6
|
workerId = hostname();
|
|
9
|
-
constructor(auditRepo) {
|
|
10
|
-
super();
|
|
11
|
-
this.auditRepo = auditRepo;
|
|
12
|
-
}
|
|
13
7
|
async process(job, _token) {
|
|
14
8
|
this.logger.info('Processing job', {
|
|
15
9
|
jobId: job.id,
|
|
16
10
|
type: job.name,
|
|
17
11
|
workerId: this.workerId,
|
|
18
12
|
});
|
|
19
|
-
const startedAt = new Date();
|
|
20
|
-
await this.recordAuditStart(job, startedAt);
|
|
21
13
|
try {
|
|
22
14
|
await this.processJob(job);
|
|
23
15
|
this.logger.info('Job completed', {
|
|
@@ -25,7 +17,6 @@ export class BaseWorker extends WorkerHost {
|
|
|
25
17
|
type: job.name,
|
|
26
18
|
workerId: this.workerId,
|
|
27
19
|
});
|
|
28
|
-
await this.recordAuditSuccess(job);
|
|
29
20
|
}
|
|
30
21
|
catch (error) {
|
|
31
22
|
this.logger.error('Job failed', {
|
|
@@ -34,78 +25,8 @@ export class BaseWorker extends WorkerHost {
|
|
|
34
25
|
workerId: this.workerId,
|
|
35
26
|
error,
|
|
36
27
|
});
|
|
37
|
-
await this.recordAuditFailure(job, error);
|
|
38
28
|
throw error;
|
|
39
29
|
}
|
|
40
30
|
}
|
|
41
|
-
async recordAuditStart(job, startedAt) {
|
|
42
|
-
if (!this.auditRepo || !job.id)
|
|
43
|
-
return;
|
|
44
|
-
try {
|
|
45
|
-
await this.auditRepo.upsert({
|
|
46
|
-
jobId: job.id,
|
|
47
|
-
jobType: job.name,
|
|
48
|
-
status: JobAuditStatus.PROCESSING,
|
|
49
|
-
workerId: this.workerId,
|
|
50
|
-
currentAttempt: job.attemptsMade + 1,
|
|
51
|
-
startedAt,
|
|
52
|
-
}, ['jobId']);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
this.logger.error('Failed to record audit start', {
|
|
56
|
-
jobId: job.id,
|
|
57
|
-
error,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async recordAuditSuccess(job) {
|
|
62
|
-
if (!this.auditRepo || !job.id) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
await this.auditRepo
|
|
67
|
-
.createQueryBuilder()
|
|
68
|
-
.update()
|
|
69
|
-
.set({
|
|
70
|
-
status: JobAuditStatus.COMPLETED,
|
|
71
|
-
finishedAt: new Date(),
|
|
72
|
-
})
|
|
73
|
-
.where('jobId = :jobId', { jobId: job.id })
|
|
74
|
-
.execute();
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
this.logger.error('Failed to record audit success', {
|
|
78
|
-
jobId: job.id,
|
|
79
|
-
error,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
async recordAuditFailure(job, error) {
|
|
84
|
-
if (!this.auditRepo || !job.id) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
89
|
-
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
90
|
-
await this.auditRepo
|
|
91
|
-
.createQueryBuilder()
|
|
92
|
-
.update()
|
|
93
|
-
.set({
|
|
94
|
-
status: JobAuditStatus.FAILED,
|
|
95
|
-
errorMessage,
|
|
96
|
-
errorStack,
|
|
97
|
-
finishedAt: new Date(),
|
|
98
|
-
currentAttempt: job.attemptsMade + 1,
|
|
99
|
-
})
|
|
100
|
-
.where('jobId = :jobId', { jobId: job.id })
|
|
101
|
-
.execute();
|
|
102
|
-
}
|
|
103
|
-
catch (auditError) {
|
|
104
|
-
this.logger.error('Failed to record audit failure', {
|
|
105
|
-
jobId: job.id,
|
|
106
|
-
error: auditError,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
31
|
}
|
|
111
32
|
//# sourceMappingURL=base.worker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.worker.js","sourceRoot":"","sources":["../../src/core/base.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,
|
|
1
|
+
{"version":3,"file":"base.worker.js","sourceRoot":"","sources":["../../src/core/base.worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,MAAM,OAAgB,UAAuC,SAAQ,UAAU;IAC1D,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,QAAQ,GAAW,QAAQ,EAAE,CAAC;IAEjD,KAAK,CAAC,OAAO,CAAC,GAAiC,EAAE,MAAe;QAC9D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACjC,KAAK,EAAE,GAAG,CAAC,EAAE;YACb,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE;gBAChC,KAAK,EAAE,GAAG,CAAC,EAAE;gBACb,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE;gBAC9B,KAAK,EAAE,GAAG,CAAC,EAAE;gBACb,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK;aACN,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAGF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volontariapp/workers",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -32,11 +32,7 @@
|
|
|
32
32
|
"lint": "eslint src/",
|
|
33
33
|
"test": "node --experimental-vm-modules $(yarn bin jest)",
|
|
34
34
|
"test:coverage": "node --experimental-vm-modules $(yarn bin jest) --coverage --coverageReporters=\"text\" --coverageReporters=\"json-summary\" --coverageReporters=\"lcov\"",
|
|
35
|
-
"test:watch": "node --experimental-vm-modules $(yarn bin jest) --watch"
|
|
36
|
-
"test:int": "INTEGRATION=true node --experimental-vm-modules $(yarn bin jest)",
|
|
37
|
-
"test:int:watch": "INTEGRATION=true node --experimental-vm-modules $(yarn bin jest) --watch",
|
|
38
|
-
"db:up": "docker compose -f ../../ci-tools/testing/docker-compose.yml --profile test up -d test-db redis",
|
|
39
|
-
"db:down": "docker compose -f ../../ci-tools/testing/docker-compose.yml --profile test stop test-db redis"
|
|
35
|
+
"test:watch": "node --experimental-vm-modules $(yarn bin jest) --watch"
|
|
40
36
|
},
|
|
41
37
|
"dependencies": {
|
|
42
38
|
"@volontariapp/config": "3.0.1",
|
|
@@ -54,14 +50,10 @@
|
|
|
54
50
|
"@nestjs/common": "^11.0.0",
|
|
55
51
|
"@types/jest": "^30.0.0",
|
|
56
52
|
"@types/node": "^24.0.0",
|
|
57
|
-
"@volontariapp/database": "1.15.1",
|
|
58
53
|
"@volontariapp/testing": "1.0.0",
|
|
59
54
|
"bullmq": "^5.76.5",
|
|
60
|
-
"ioredis": "^5.3.7",
|
|
61
55
|
"jest": "^30.3.0",
|
|
62
|
-
"pg": "^8.11.5",
|
|
63
56
|
"ts-jest": "^29.4.6",
|
|
64
|
-
"typeorm": "^0.3.21",
|
|
65
57
|
"typescript": "5.7.3"
|
|
66
58
|
}
|
|
67
59
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from '@volontariapp/database';
|
|
2
|
-
import type { JobAuditStatus } from '../types/job-audit.status.js';
|
|
3
|
-
export declare class JobAuditEntity extends BaseEntity {
|
|
4
|
-
jobId: string;
|
|
5
|
-
jobType: string;
|
|
6
|
-
status: JobAuditStatus;
|
|
7
|
-
workerId: string;
|
|
8
|
-
currentAttempt: number;
|
|
9
|
-
startedAt?: Date;
|
|
10
|
-
finishedAt?: Date;
|
|
11
|
-
resultPayload?: Record<string, unknown>;
|
|
12
|
-
errorMessage?: string;
|
|
13
|
-
errorStack?: string;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=job-audit.entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-audit.entity.d.ts","sourceRoot":"","sources":["../../../src/data/entities/job-audit.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,qBAAa,cAAe,SAAQ,UAAU;IAC5C,KAAK,EAAG,MAAM,CAAC;IAEf,OAAO,EAAG,MAAM,CAAC;IAEjB,MAAM,EAAG,cAAc,CAAC;IAExB,QAAQ,EAAG,MAAM,CAAC;IAElB,cAAc,EAAG,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE,IAAI,CAAC;IAEjB,UAAU,CAAC,EAAE,IAAI,CAAC;IAElB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from '@volontariapp/database';
|
|
2
|
-
export class JobAuditEntity extends BaseEntity {
|
|
3
|
-
jobId;
|
|
4
|
-
jobType;
|
|
5
|
-
status;
|
|
6
|
-
workerId;
|
|
7
|
-
currentAttempt;
|
|
8
|
-
startedAt;
|
|
9
|
-
finishedAt;
|
|
10
|
-
resultPayload;
|
|
11
|
-
errorMessage;
|
|
12
|
-
errorStack;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=job-audit.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-audit.entity.js","sourceRoot":"","sources":["../../../src/data/entities/job-audit.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,KAAK,CAAU;IAEf,OAAO,CAAU;IAEjB,MAAM,CAAkB;IAExB,QAAQ,CAAU;IAElB,cAAc,CAAU;IAExB,SAAS,CAAQ;IAEjB,UAAU,CAAQ;IAElB,aAAa,CAA2B;IAExC,YAAY,CAAU;IAEtB,UAAU,CAAU;CACrB"}
|
package/dist/data/index.d.ts
DELETED
package/dist/data/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,6BAA6B,CAAC"}
|
package/dist/data/index.js
DELETED
package/dist/data/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,6BAA6B,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseModel } from '@volontariapp/database';
|
|
2
|
-
import { JobAuditStatus } from '../types/job-audit.status.js';
|
|
3
|
-
export declare class JobAuditModel extends BaseModel {
|
|
4
|
-
jobId: string;
|
|
5
|
-
jobType: string;
|
|
6
|
-
status: JobAuditStatus;
|
|
7
|
-
workerId: string;
|
|
8
|
-
currentAttempt: number;
|
|
9
|
-
startedAt?: Date;
|
|
10
|
-
finishedAt?: Date;
|
|
11
|
-
resultPayload?: Record<string, unknown>;
|
|
12
|
-
errorMessage?: string;
|
|
13
|
-
errorStack?: string;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=job-audit.model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-audit.model.d.ts","sourceRoot":"","sources":["../../../src/data/models/job-audit.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qBAKa,aAAc,SAAQ,SAAS;IAE1C,KAAK,EAAG,MAAM,CAAC;IAGf,OAAO,EAAG,MAAM,CAAC;IAGjB,MAAM,EAAE,cAAc,CAA0B;IAGhD,QAAQ,EAAG,MAAM,CAAC;IAGlB,cAAc,EAAE,MAAM,CAAK;IAG3B,SAAS,CAAC,EAAE,IAAI,CAAC;IAGjB,UAAU,CAAC,EAAE,IAAI,CAAC;IAGlB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGxC,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { Column, Entity, Index } from 'typeorm';
|
|
11
|
-
import { BaseModel } from '@volontariapp/database';
|
|
12
|
-
import { JobAuditStatus } from '../types/job-audit.status.js';
|
|
13
|
-
let JobAuditModel = class JobAuditModel extends BaseModel {
|
|
14
|
-
jobId;
|
|
15
|
-
jobType;
|
|
16
|
-
status = JobAuditStatus.PENDING;
|
|
17
|
-
workerId;
|
|
18
|
-
currentAttempt = 1;
|
|
19
|
-
startedAt;
|
|
20
|
-
finishedAt;
|
|
21
|
-
resultPayload;
|
|
22
|
-
errorMessage;
|
|
23
|
-
errorStack;
|
|
24
|
-
};
|
|
25
|
-
__decorate([
|
|
26
|
-
Column({ type: 'varchar', length: 100, name: 'job_id', unique: true }),
|
|
27
|
-
__metadata("design:type", String)
|
|
28
|
-
], JobAuditModel.prototype, "jobId", void 0);
|
|
29
|
-
__decorate([
|
|
30
|
-
Column({ type: 'varchar', length: 255, name: 'job_type' }),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], JobAuditModel.prototype, "jobType", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
Column({ type: 'varchar', length: 20, default: JobAuditStatus.PENDING }),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], JobAuditModel.prototype, "status", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
Column({ type: 'varchar', length: 255, name: 'worker_id' }),
|
|
39
|
-
__metadata("design:type", String)
|
|
40
|
-
], JobAuditModel.prototype, "workerId", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
Column({ name: 'current_attempt', type: 'int', default: 1 }),
|
|
43
|
-
__metadata("design:type", Number)
|
|
44
|
-
], JobAuditModel.prototype, "currentAttempt", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
Column({ name: 'started_at', type: 'timestamp', nullable: true }),
|
|
47
|
-
__metadata("design:type", Date)
|
|
48
|
-
], JobAuditModel.prototype, "startedAt", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
Column({ name: 'finished_at', type: 'timestamp', nullable: true }),
|
|
51
|
-
__metadata("design:type", Date)
|
|
52
|
-
], JobAuditModel.prototype, "finishedAt", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
Column({ name: 'result_payload', type: 'jsonb', nullable: true }),
|
|
55
|
-
__metadata("design:type", Object)
|
|
56
|
-
], JobAuditModel.prototype, "resultPayload", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
Column({ name: 'error_message', type: 'text', nullable: true }),
|
|
59
|
-
__metadata("design:type", String)
|
|
60
|
-
], JobAuditModel.prototype, "errorMessage", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
Column({ name: 'error_stack', type: 'text', nullable: true }),
|
|
63
|
-
__metadata("design:type", String)
|
|
64
|
-
], JobAuditModel.prototype, "errorStack", void 0);
|
|
65
|
-
JobAuditModel = __decorate([
|
|
66
|
-
Entity('job_audit'),
|
|
67
|
-
Index(['jobId'], { unique: true }),
|
|
68
|
-
Index(['jobType']),
|
|
69
|
-
Index(['workerId']),
|
|
70
|
-
Index(['status'])
|
|
71
|
-
], JobAuditModel);
|
|
72
|
-
export { JobAuditModel };
|
|
73
|
-
//# sourceMappingURL=job-audit.model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-audit.model.js","sourceRoot":"","sources":["../../../src/data/models/job-audit.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAOvD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,SAAS;IAE1C,KAAK,CAAU;IAGf,OAAO,CAAU;IAGjB,MAAM,GAAmB,cAAc,CAAC,OAAO,CAAC;IAGhD,QAAQ,CAAU;IAGlB,cAAc,GAAW,CAAC,CAAC;IAG3B,SAAS,CAAQ;IAGjB,UAAU,CAAQ;IAGlB,aAAa,CAA2B;IAGxC,YAAY,CAAU;IAGtB,UAAU,CAAU;CACrB,CAAA;AA5BC;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;4CACxD;AAGf;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;;8CAC1C;AAGjB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC;;6CACzB;AAGhD;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;;+CAC1C;AAGlB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDAClC;AAG3B;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACtD,IAAI;gDAAC;AAGjB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACtD,IAAI;iDAAC;AAGlB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDAC1B;AAGxC;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC1C;AAGtB;IADC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDAC1C;AA7BT,aAAa;IALzB,MAAM,CAAC,WAAW,CAAC;IACnB,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAClC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC;IAClB,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC;IACnB,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;GACL,aAAa,CA8BzB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
|
-
import { BaseRepository } from '@volontariapp/database';
|
|
3
|
-
import { JobAuditEntity } from '../entities/job-audit.entity.js';
|
|
4
|
-
import { JobAuditModel } from '../models/job-audit.model.js';
|
|
5
|
-
export declare class JobAuditRepository extends BaseRepository<JobAuditModel, JobAuditEntity> {
|
|
6
|
-
constructor(repository: Repository<JobAuditModel>);
|
|
7
|
-
findByJobId(jobId: string): Promise<JobAuditEntity | null>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=job-audit.repository.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-audit.repository.d.ts","sourceRoot":"","sources":["../../../src/data/repositories/job-audit.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,qBACa,kBAAmB,SAAQ,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC;gBAGjF,UAAU,EAAE,UAAU,CAAC,aAAa,CAAC;IAKjC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAGjE"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { Injectable } from '@nestjs/common';
|
|
14
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
15
|
-
import { Repository } from 'typeorm';
|
|
16
|
-
import { BaseRepository } from '@volontariapp/database';
|
|
17
|
-
import { JobAuditEntity } from '../entities/job-audit.entity.js';
|
|
18
|
-
import { JobAuditModel } from '../models/job-audit.model.js';
|
|
19
|
-
let JobAuditRepository = class JobAuditRepository extends BaseRepository {
|
|
20
|
-
constructor(repository) {
|
|
21
|
-
super(repository, JobAuditEntity, JobAuditModel);
|
|
22
|
-
}
|
|
23
|
-
async findByJobId(jobId) {
|
|
24
|
-
return this.findOne({ jobId });
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
JobAuditRepository = __decorate([
|
|
28
|
-
Injectable(),
|
|
29
|
-
__param(0, InjectRepository(JobAuditModel)),
|
|
30
|
-
__metadata("design:paramtypes", [Repository])
|
|
31
|
-
], JobAuditRepository);
|
|
32
|
-
export { JobAuditRepository };
|
|
33
|
-
//# sourceMappingURL=job-audit.repository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-audit.repository.js","sourceRoot":"","sources":["../../../src/data/repositories/job-audit.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGtD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,cAA6C;IACnF,YAEE,UAAqC;QAErC,KAAK,CAAC,UAAU,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACjC,CAAC;CACF,CAAA;AAXY,kBAAkB;IAD9B,UAAU,EAAE;IAGR,WAAA,gBAAgB,CAAC,aAAa,CAAC,CAAA;qCACpB,UAAU;GAHb,kBAAkB,CAW9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-audit.status.d.ts","sourceRoot":"","sources":["../../../src/data/types/job-audit.status.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var JobAuditStatus;
|
|
2
|
-
(function (JobAuditStatus) {
|
|
3
|
-
JobAuditStatus["PENDING"] = "PENDING";
|
|
4
|
-
JobAuditStatus["PROCESSING"] = "PROCESSING";
|
|
5
|
-
JobAuditStatus["COMPLETED"] = "COMPLETED";
|
|
6
|
-
JobAuditStatus["FAILED"] = "FAILED";
|
|
7
|
-
})(JobAuditStatus || (JobAuditStatus = {}));
|
|
8
|
-
//# sourceMappingURL=job-audit.status.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-audit.status.js","sourceRoot":"","sources":["../../../src/data/types/job-audit.status.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;IACzB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB"}
|
|
@@ -1 +0,0 @@
|
|
|
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;AAIrC,eAAO,MAAM,cAAc,YAWzB,CAAC;AAEH,eAAO,MAAM,gBAAgB,qBAa5B,CAAC;AAEF,eAAO,MAAM,WAAW,qBAIvB,CAAC"}
|
package/dist/test/data-source.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { DataSource } from 'typeorm';
|
|
2
|
-
import { JobAuditModel } from '../data/models/job-audit.model.js';
|
|
3
|
-
import { InitialSchemaJobAudit1778328780881 } from './migrations/1778328780881-InitialSchemaJobAudit.js';
|
|
4
|
-
export const testDataSource = new DataSource({
|
|
5
|
-
type: 'postgres',
|
|
6
|
-
host: '127.0.0.1',
|
|
7
|
-
port: 5433,
|
|
8
|
-
username: 'testuser',
|
|
9
|
-
password: 'testpassword',
|
|
10
|
-
database: 'volontariapp_test',
|
|
11
|
-
entities: [JobAuditModel],
|
|
12
|
-
migrations: [InitialSchemaJobAudit1778328780881],
|
|
13
|
-
synchronize: false,
|
|
14
|
-
logging: false,
|
|
15
|
-
});
|
|
16
|
-
export const initializeTestDb = async () => {
|
|
17
|
-
if (!testDataSource.isInitialized) {
|
|
18
|
-
await testDataSource.initialize();
|
|
19
|
-
const queryRunner = testDataSource.createQueryRunner();
|
|
20
|
-
await queryRunner.dropTable('job_audit', true);
|
|
21
|
-
await queryRunner.release();
|
|
22
|
-
const migrations = await testDataSource.runMigrations();
|
|
23
|
-
console.log('[initDb] Migrations executed:', migrations.length);
|
|
24
|
-
if (migrations.length === 0) {
|
|
25
|
-
console.error('[initDb] No migrations! Loading manually...');
|
|
26
|
-
await testDataSource.synchronize();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
export const closeTestDb = async () => {
|
|
31
|
-
if (testDataSource.isInitialized) {
|
|
32
|
-
await testDataSource.destroy();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=data-source.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,kCAAkC,EAAE,MAAM,qDAAqD,CAAC;AAEzG,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,aAAa,CAAC;IACzB,UAAU,EAAE,CAAC,kCAAkC,CAAC;IAChD,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK;CACf,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;QAClC,MAAM,WAAW,GAAG,cAAc,CAAC,iBAAiB,EAAE,CAAC;QACvD,MAAM,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAChE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;YAC7D,MAAM,cAAc,CAAC,WAAW,EAAE,CAAC;QACrC,CAAC;IACH,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-setup.d.ts","sourceRoot":"","sources":["../../src/test/global-setup.ts"],"names":[],"mappings":";AAKA,wBAgDE"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { PostgresProvider } from '@volontariapp/bridge';
|
|
2
|
-
import { Redis } from 'ioredis';
|
|
3
|
-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
|
-
export default async () => {
|
|
5
|
-
const provider = new PostgresProvider({
|
|
6
|
-
host: '127.0.0.1',
|
|
7
|
-
port: 5433,
|
|
8
|
-
username: 'testuser',
|
|
9
|
-
password: 'testpassword',
|
|
10
|
-
database: 'volontariapp_test',
|
|
11
|
-
});
|
|
12
|
-
const maxAttempts = 20;
|
|
13
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
14
|
-
try {
|
|
15
|
-
await provider.connect();
|
|
16
|
-
const dataSource = provider.getDriver();
|
|
17
|
-
await dataSource.query('SELECT 1');
|
|
18
|
-
await provider.disconnect();
|
|
19
|
-
const redis = new Redis({
|
|
20
|
-
host: '127.0.0.1',
|
|
21
|
-
port: 6379,
|
|
22
|
-
password: 'password',
|
|
23
|
-
connectTimeout: 1000,
|
|
24
|
-
retryStrategy: () => null,
|
|
25
|
-
});
|
|
26
|
-
redis.on('error', () => { });
|
|
27
|
-
try {
|
|
28
|
-
await redis.ping();
|
|
29
|
-
await redis.quit();
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
await redis.quit().catch(() => undefined);
|
|
33
|
-
throw err;
|
|
34
|
-
}
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
await provider.disconnect().catch(() => undefined);
|
|
39
|
-
if (attempt === maxAttempts) {
|
|
40
|
-
throw new Error('Test database or Redis is not reachable. Start them before running tests.');
|
|
41
|
-
}
|
|
42
|
-
await sleep(500);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=global-setup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-setup.js","sourceRoot":"","sources":["../../src/test/global-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,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;YAEH,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;YAG5B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;gBACtB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,UAAU;gBACpB,cAAc,EAAE,IAAI;gBACpB,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI;aAC1B,CAAC,CAAC;YACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAE5B,IAAI,CAAC;gBACH,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;gBACnB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;YACrB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;gBAC1C,MAAM,GAAG,CAAC;YACZ,CAAC;YAED,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,CACb,2EAA2E,CAC5E,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type MigrationInterface, type QueryRunner } from 'typeorm';
|
|
2
|
-
export declare class InitialSchemaJobAudit1778328780881 implements MigrationInterface {
|
|
3
|
-
up(queryRunner: QueryRunner): Promise<void>;
|
|
4
|
-
down(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=1778328780881-InitialSchemaJobAudit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1778328780881-InitialSchemaJobAudit.d.ts","sourceRoot":"","sources":["../../../src/test/migrations/1778328780881-InitialSchemaJobAudit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAEvF,qBAAa,kCAAmC,YAAW,kBAAkB;IAC9D,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA0F3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
|