@servicelabsco/nestjs-utility-services 1.2.107 → 1.2.109
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/config/entity.constants.d.ts +2 -0
- package/dist/config/entity.constants.js +2 -0
- package/dist/config/entity.constants.js.map +1 -1
- package/dist/config/source.hash.d.ts +2 -0
- package/dist/config/source.hash.js +2 -0
- package/dist/config/source.hash.js.map +1 -1
- package/dist/migrations/1734632235444-CreateRecurringQueryTable.d.ts +5 -0
- package/dist/migrations/1734632235444-CreateRecurringQueryTable.js +22 -0
- package/dist/migrations/1734632235444-CreateRecurringQueryTable.js.map +1 -0
- package/dist/system/dtos/index.d.ts +1 -0
- package/dist/system/dtos/index.js +1 -0
- package/dist/system/dtos/index.js.map +1 -1
- package/dist/system/dtos/recurring.query.attributes.dto.d.ts +3 -0
- package/dist/system/dtos/recurring.query.attributes.dto.js +8 -0
- package/dist/system/dtos/recurring.query.attributes.dto.js.map +1 -0
- package/dist/system/entities/index.d.ts +1 -0
- package/dist/system/entities/index.js +1 -0
- package/dist/system/entities/index.js.map +1 -1
- package/dist/system/entities/recurring.query.entity.d.ts +10 -0
- package/dist/system/entities/recurring.query.entity.js +46 -0
- package/dist/system/entities/recurring.query.entity.js.map +1 -0
- package/dist/system/es6.classes.d.ts +10 -5
- package/dist/system/es6.classes.js +14 -2
- package/dist/system/es6.classes.js.map +1 -1
- package/dist/system/jobs/execute.recurring.query.job.d.ts +10 -0
- package/dist/system/jobs/{clean.scheduled.event.job.js → execute.recurring.query.job.js} +19 -16
- package/dist/system/jobs/execute.recurring.query.job.js.map +1 -0
- package/dist/system/jobs/index.d.ts +3 -1
- package/dist/system/jobs/index.js +3 -1
- package/dist/system/jobs/index.js.map +1 -1
- package/dist/system/jobs/recurring.query.job.d.ts +15 -0
- package/dist/system/jobs/recurring.query.job.js +52 -0
- package/dist/system/jobs/recurring.query.job.js.map +1 -0
- package/dist/system/jobs/scheduled.event.job.d.ts +3 -3
- package/dist/system/jobs/scheduled.event.job.js +14 -12
- package/dist/system/jobs/scheduled.event.job.js.map +1 -1
- package/dist/system/jobs/{clean.scheduled.event.job.d.ts → set.recurring.query.event.job.d.ts} +8 -5
- package/dist/system/jobs/set.recurring.query.event.job.js +81 -0
- package/dist/system/jobs/set.recurring.query.event.job.js.map +1 -0
- package/dist/system/jobs/set.scheduled.event.job.d.ts +3 -0
- package/dist/system/jobs/set.scheduled.event.job.js +42 -2
- package/dist/system/jobs/set.scheduled.event.job.js.map +1 -1
- package/dist/system/libraries/code.evaluator.d.ts +9 -0
- package/dist/system/libraries/code.evaluator.js +33 -0
- package/dist/system/libraries/code.evaluator.js.map +1 -0
- package/dist/system/libraries/index.d.ts +1 -0
- package/dist/system/libraries/index.js +1 -0
- package/dist/system/libraries/index.js.map +1 -1
- package/dist/system/services/es6.jobs.service.d.ts +7 -3
- package/dist/system/services/es6.jobs.service.js +14 -6
- package/dist/system/services/es6.jobs.service.js.map +1 -1
- package/dist/system/services/scheduled.event.service.d.ts +4 -6
- package/dist/system/services/scheduled.event.service.js +21 -58
- package/dist/system/services/scheduled.event.service.js.map +1 -1
- package/dist/system/subscribers/index.d.ts +1 -0
- package/dist/system/subscribers/index.js +1 -0
- package/dist/system/subscribers/index.js.map +1 -1
- package/dist/system/subscribers/recurring.query.subscriber.d.ts +12 -0
- package/dist/system/subscribers/recurring.query.subscriber.js +47 -0
- package/dist/system/subscribers/recurring.query.subscriber.js.map +1 -0
- package/dist/system/subscribers/scheduled.event.subscriber.d.ts +2 -1
- package/dist/system/subscribers/scheduled.event.subscriber.js +7 -0
- package/dist/system/subscribers/scheduled.event.subscriber.js.map +1 -1
- package/package.json +1 -1
- package/dist/system/jobs/clean.scheduled.event.job.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"es6.jobs.service.js","sourceRoot":"","sources":["../../../src/system/services/es6.jobs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,
|
1
|
+
{"version":3,"file":"es6.jobs.service.js","sourceRoot":"","sources":["../../../src/system/services/es6.jobs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,yEAAoE;AACpE,mDAA+C;AAC/C,+DAAyD;AACzD,qEAA+D;AAC/D,iEAA4D;AAC5D,qDAAiD;AACjD,iEAA4D;AAC5D,uDAAmD;AACnD,uEAAiE;AACjE,qFAA+E;AAC/E,2DAAsD;AACtD,mEAA8D;AAC9D,qEAAgE;AAChE,yEAAoE;AACpE,iEAA4D;AAC5D,uDAAmD;AACnD,qEAAgE;AAChE,mFAA6E;AAC7E,6EAAwE;AACxE,2EAAqE;AACrE,qEAAgE;AAChE,qEAA+D;AAC/D,yFAAkF;AAClF,6EAAuE;AACvE,6DAAwD;AACxD,6DAAwD;AACxD,iEAA2D;AAC3D,yEAAmE;AACnE,iFAA2E;AAC3E,qEAA+D;AAC/D,8EAA0E;AAQnE,IAAM,cAAc,GAApB,MAAM,cAAc;IAGvB,YACqB,mBAAwC,EACxC,SAAoB,EACpB,aAA4B,EAC5B,gBAAkC,EAClC,eAAgC,EAChC,UAAsB,EACtB,eAAgC,EAChC,WAAwB,EACxB,iBAAoC,EACpC,wBAAkD,EAClD,YAA0B,EAC1B,gBAAkC,EAClC,iBAAoC,EACpC,mBAAwC,EACxC,eAAgC,EAChC,WAAwB,EACxB,iBAAoC,EACpC,uBAAgD,EAChD,qBAA4C,EAC5C,mBAAwC,EACxC,iBAAoC,EACpC,gBAAkC,EAClC,yBAAoD,EACpD,oBAA0C,EAC1C,aAA4B,EAC5B,aAA4B,EAC5B,cAA8B,EAC9B,kBAAsC,EACtC,sBAA8C,EAC9C,gBAAkC;QA7BlC,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,cAAS,GAAT,SAAS,CAAW;QACpB,kBAAa,GAAb,aAAa,CAAe;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,oBAAe,GAAf,eAAe,CAAiB;Q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gCAAa;QACV,sCAAgB;QACjB,mCAAe;QACpB,wBAAU;QACL,mCAAe;QACnB,0BAAW;QACL,wCAAiB;QACV,sDAAwB;QACpC,6BAAY;QACR,qCAAgB;QACf,uCAAiB;QACf,2CAAmB;QACvB,mCAAe;QACnB,0BAAW;QACL,uCAAiB;QACX,oDAAuB;QACzB,+CAAqB;QACvB,4CAAmB;QACrB,uCAAiB;QAClB,sCAAgB;QACP,yDAAyB;QAC9B,8CAAoB;QAC3B,+BAAa;QACb,+BAAa;QACZ,kCAAc;QACV,0CAAkB;QACd,kDAAsB;QAC5B,sCAAgB;GAjC9C,cAAc,CAqF1B"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { SourceColumnDto } from '../../platformUtility/dtos/source.column.dto';
|
1
2
|
import { SqlService } from '../../platformUtility/services/sql.service';
|
2
3
|
import { EventQueueEntity } from '../entities/event.queue.entity';
|
3
4
|
import { ScheduledEventEntity } from '../entities/scheduled.event.entity';
|
@@ -6,12 +7,9 @@ export declare class ScheduledEventService {
|
|
6
7
|
private readonly propertyService;
|
7
8
|
protected readonly sqlService: SqlService;
|
8
9
|
constructor(propertyService: PropertyService, sqlService: SqlService);
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
deleteActiveEvents(id: number): Promise<EventQueueEntity[]>;
|
13
|
-
setNewEvent(job: ScheduledEventEntity, scheduledTime: Date): Promise<EventQueueEntity>;
|
14
|
-
createEventsForJob(job: ScheduledEventEntity): Promise<ScheduledEventEntity>;
|
10
|
+
getActiveEventsSummary(source: SourceColumnDto): Promise<any>;
|
11
|
+
deleteActiveEvents(source: SourceColumnDto): Promise<EventQueueEntity[]>;
|
12
|
+
getSchedules(source: SourceColumnDto, timing: string, startDate: Date, endDate: Date): Promise<any[]>;
|
15
13
|
getActiveSchedules(): Promise<ScheduledEventEntity[]>;
|
16
14
|
private getScheduleStartTime;
|
17
15
|
private withTimezoneOffset;
|
@@ -19,96 +19,59 @@ const sql_service_1 = require("../../platformUtility/services/sql.service");
|
|
19
19
|
const event_queue_entity_1 = require("../entities/event.queue.entity");
|
20
20
|
const scheduled_event_entity_1 = require("../entities/scheduled.event.entity");
|
21
21
|
const property_service_1 = require("./property.service");
|
22
|
-
const SourceHash = require("../../config/source.hash");
|
23
22
|
let ScheduledEventService = class ScheduledEventService {
|
24
23
|
constructor(propertyService, sqlService) {
|
25
24
|
this.propertyService = propertyService;
|
26
25
|
this.sqlService = sqlService;
|
27
26
|
}
|
28
|
-
async
|
29
|
-
|
30
|
-
|
31
|
-
source_type: SourceHash.scheduledEvent,
|
32
|
-
source_id: id,
|
33
|
-
start_time: (0, typeorm_1.IsNull)(),
|
34
|
-
},
|
35
|
-
order: {
|
36
|
-
scheduled_start_time: 'ASC',
|
37
|
-
},
|
38
|
-
});
|
39
|
-
}
|
40
|
-
async getActiveEventsSummary(id) {
|
41
|
-
const sql = `select count(1) count, max(a.scheduled_start_time) scheduled_start_time from sys_event_queues a where a.deleted_at is null and a.start_time is null and a.source_type = '${SourceHash.scheduledEvent}' and a.source_id = ${id}`;
|
27
|
+
async getActiveEventsSummary(source) {
|
28
|
+
const { source_type, source_id } = source;
|
29
|
+
const sql = `select count(1) count, max(a.scheduled_start_time) scheduled_start_time from sys_event_queues a where a.deleted_at is null and a.start_time is null and a.source_type = '${source_type}' and a.source_id = ${source_id}`;
|
42
30
|
return this.sqlService.readFirst(sql);
|
43
31
|
}
|
44
|
-
async
|
45
|
-
|
46
|
-
where: {
|
47
|
-
source_type: SourceHash.scheduledEvent,
|
48
|
-
source_id: id,
|
49
|
-
start_time: (0, typeorm_1.Not)((0, typeorm_1.IsNull)()),
|
50
|
-
},
|
51
|
-
take: 10,
|
52
|
-
order: {
|
53
|
-
scheduled_start_time: 'DESC',
|
54
|
-
},
|
55
|
-
});
|
56
|
-
}
|
57
|
-
async deleteActiveEvents(id) {
|
32
|
+
async deleteActiveEvents(source) {
|
33
|
+
const { source_type, source_id } = source;
|
58
34
|
return event_queue_entity_1.EventQueueEntity.softDelete({
|
59
|
-
source_type
|
60
|
-
source_id
|
35
|
+
source_type,
|
36
|
+
source_id,
|
61
37
|
start_time: (0, typeorm_1.IsNull)(),
|
62
38
|
});
|
63
39
|
}
|
64
|
-
async
|
65
|
-
const record = new event_queue_entity_1.EventQueueEntity();
|
66
|
-
record.name = job.event.name;
|
67
|
-
record.event_id = job.event_id;
|
68
|
-
record.parameter = job.parameter;
|
69
|
-
record.payload = job.payload || {};
|
70
|
-
record.scheduled_start_time = scheduledTime;
|
71
|
-
record.source_type = SourceHash.scheduledEvent;
|
72
|
-
record.source_id = job.id;
|
73
|
-
await record.save();
|
74
|
-
return record;
|
75
|
-
}
|
76
|
-
async createEventsForJob(job) {
|
40
|
+
async getSchedules(source, timing, startDate, endDate) {
|
77
41
|
const now = new Date();
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
let inQueueCount = summary.count;
|
42
|
+
const dates = [];
|
43
|
+
const summary = await this.getActiveEventsSummary(source);
|
44
|
+
let inQueueCount = summary?.count || 0;
|
82
45
|
if (inQueueCount > 100)
|
83
|
-
return
|
46
|
+
return;
|
84
47
|
let lastRunTime = await this.getScheduleStartTime(summary);
|
85
|
-
lastRunTime = lastRunTime <
|
86
|
-
if (lastRunTime >
|
48
|
+
lastRunTime = lastRunTime < startDate ? startDate : lastRunTime;
|
49
|
+
if (lastRunTime > endDate)
|
87
50
|
return;
|
88
|
-
const nextTime = parser.parseExpression(
|
51
|
+
const nextTime = parser.parseExpression(timing, {
|
89
52
|
currentDate: lastRunTime,
|
90
|
-
endDate
|
53
|
+
endDate,
|
91
54
|
});
|
92
|
-
while (inQueueCount <=
|
55
|
+
while (inQueueCount <= 100) {
|
93
56
|
if (!nextTime.hasNext())
|
94
57
|
return;
|
95
58
|
const next = nextTime.next().toDate();
|
96
59
|
const date = await this.withTimezoneOffset(next);
|
60
|
+
dates.push(date);
|
97
61
|
if (date < now)
|
98
62
|
continue;
|
99
|
-
await this.setNewEvent(job, date);
|
100
|
-
job.last_scheduled_time = date;
|
101
63
|
++inQueueCount;
|
102
64
|
}
|
103
|
-
|
104
|
-
return job;
|
65
|
+
return dates;
|
105
66
|
}
|
106
67
|
async getActiveSchedules() {
|
68
|
+
const d = (0, date_fns_1.addMinutes)(new Date(), 15);
|
107
69
|
return scheduled_event_entity_1.ScheduledEventEntity.find({
|
108
70
|
relations: ['event'],
|
109
71
|
where: {
|
110
72
|
active: true,
|
111
73
|
end_time: (0, typeorm_1.Not)((0, typeorm_1.LessThan)(date_util_1.DateUtil.getDateTime())),
|
74
|
+
last_scheduled_time: (0, typeorm_1.LessThanOrEqual)(d),
|
112
75
|
},
|
113
76
|
});
|
114
77
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scheduled.event.service.js","sourceRoot":"","sources":["../../../src/system/services/scheduled.event.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,sCAAsC;AACtC,uCAAkD;AAClD,
|
1
|
+
{"version":3,"file":"scheduled.event.service.js","sourceRoot":"","sources":["../../../src/system/services/scheduled.event.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,sCAAsC;AACtC,uCAAkD;AAClD,qCAAiE;AACjE,gEAA4D;AAE5D,4EAAwE;AACxE,uEAAkE;AAClE,+EAA0E;AAC1E,yDAAqD;AAS9C,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAM9B,YACqB,eAAgC,EAC9B,UAAsB;QADxB,oBAAe,GAAf,eAAe,CAAiB;QAC9B,eAAU,GAAV,UAAU,CAAY;IAC1C,CAAC;IAEJ,KAAK,CAAC,sBAAsB,CAAC,MAAuB;QAChD,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAE1C,MAAM,GAAG,GAAG,4KAA4K,WAAW,uBAAuB,SAAS,EAAE,CAAC;QAEtO,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IAOD,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AI,EAAE,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACJ,CAAA;AAzIY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAQ6B,kCAAe;QAClB,wBAAU;GARpC,qBAAqB,CAyIjC"}
|
@@ -11,6 +11,7 @@ export * from './mail.recipient.subscriber';
|
|
11
11
|
export * from './mail.validation.subscriber';
|
12
12
|
export * from './mobile.validation.subscriber';
|
13
13
|
export * from './property.subscriber';
|
14
|
+
export * from './recurring.query.subscriber';
|
14
15
|
export * from './relationship.subscriber';
|
15
16
|
export * from './scheduled.event.subscriber';
|
16
17
|
export * from './sms.message.subscriber';
|
@@ -27,6 +27,7 @@ __exportStar(require("./mail.recipient.subscriber"), exports);
|
|
27
27
|
__exportStar(require("./mail.validation.subscriber"), exports);
|
28
28
|
__exportStar(require("./mobile.validation.subscriber"), exports);
|
29
29
|
__exportStar(require("./property.subscriber"), exports);
|
30
|
+
__exportStar(require("./recurring.query.subscriber"), exports);
|
30
31
|
__exportStar(require("./relationship.subscriber"), exports);
|
31
32
|
__exportStar(require("./scheduled.event.subscriber"), exports);
|
32
33
|
__exportStar(require("./sms.message.subscriber"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/subscribers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAAA,sDAAoC;AAAA,4DAA0C;AAAA,+DAA6C;AAAA,sDAAoC;AAAA,uDAAqC;AAAA,6DAA2C;AAAA,wDAAsC;AAAA,0DAAwC;AAAA,8DAA4C;AAAA,+DAA6C;AAAA,iEAA+C;AAAA,wDAAsC;AAAA,4DAA0C;AAAA,+DAA6C;AAAA,2DAAyC;AAAA,iEAA+C;AAAA,qEAAmD;AAAA,+DAA4C"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/subscribers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAAA,sDAAoC;AAAA,4DAA0C;AAAA,+DAA6C;AAAA,sDAAoC;AAAA,uDAAqC;AAAA,6DAA2C;AAAA,wDAAsC;AAAA,0DAAwC;AAAA,8DAA4C;AAAA,+DAA6C;AAAA,iEAA+C;AAAA,wDAAsC;AAAA,+DAA6C;AAAA,4DAA0C;AAAA,+DAA6C;AAAA,2DAAyC;AAAA,iEAA+C;AAAA,qEAAmD;AAAA,+DAA4C"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { DataSource, InsertEvent, UpdateEvent } from 'typeorm';
|
2
|
+
import { CommonSubscriber } from '../../common/libraries/common.subscriber';
|
3
|
+
import { RecurringQueryEntity } from '../entities/recurring.query.entity';
|
4
|
+
import { RecurringQueryJob } from '../jobs/recurring.query.job';
|
5
|
+
export declare class RecurringQuerySubscriber extends CommonSubscriber<RecurringQueryEntity> {
|
6
|
+
private readonly dataSource;
|
7
|
+
protected readonly entityJob: RecurringQueryJob;
|
8
|
+
constructor(dataSource: DataSource, entityJob: RecurringQueryJob);
|
9
|
+
listenTo(): typeof RecurringQueryEntity;
|
10
|
+
beforeInsert(event: InsertEvent<RecurringQueryEntity>): Promise<void>;
|
11
|
+
beforeUpdate(event: UpdateEvent<RecurringQueryEntity>): Promise<void>;
|
12
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
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;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.RecurringQuerySubscriber = void 0;
|
13
|
+
const date_fns_1 = require("date-fns");
|
14
|
+
const typeorm_1 = require("typeorm");
|
15
|
+
const common_subscriber_1 = require("../../common/libraries/common.subscriber");
|
16
|
+
const recurring_query_entity_1 = require("../entities/recurring.query.entity");
|
17
|
+
const recurring_query_job_1 = require("../jobs/recurring.query.job");
|
18
|
+
let RecurringQuerySubscriber = class RecurringQuerySubscriber extends common_subscriber_1.CommonSubscriber {
|
19
|
+
constructor(dataSource, entityJob) {
|
20
|
+
super();
|
21
|
+
this.dataSource = dataSource;
|
22
|
+
this.entityJob = entityJob;
|
23
|
+
dataSource.subscribers.push(this);
|
24
|
+
}
|
25
|
+
listenTo() {
|
26
|
+
return recurring_query_entity_1.RecurringQueryEntity;
|
27
|
+
}
|
28
|
+
async beforeInsert(event) {
|
29
|
+
event.entity.attributes = {
|
30
|
+
...event.entity.attributes,
|
31
|
+
...{},
|
32
|
+
};
|
33
|
+
if (event.entity.last_scheduled_time)
|
34
|
+
event.entity.last_scheduled_time = (0, date_fns_1.subMinutes)(new Date(), 15);
|
35
|
+
}
|
36
|
+
async beforeUpdate(event) {
|
37
|
+
if (event.entity.last_scheduled_time)
|
38
|
+
event.entity.last_scheduled_time = (0, date_fns_1.subMinutes)(new Date(), 15);
|
39
|
+
}
|
40
|
+
};
|
41
|
+
exports.RecurringQuerySubscriber = RecurringQuerySubscriber;
|
42
|
+
exports.RecurringQuerySubscriber = RecurringQuerySubscriber = __decorate([
|
43
|
+
(0, typeorm_1.EventSubscriber)(),
|
44
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource,
|
45
|
+
recurring_query_job_1.RecurringQueryJob])
|
46
|
+
], RecurringQuerySubscriber);
|
47
|
+
//# sourceMappingURL=recurring.query.subscriber.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"recurring.query.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/recurring.query.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsC;AACtC,qCAAgF;AAChF,gFAA4E;AAC5E,+EAA0E;AAC1E,qEAAgE;AAGzD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,oCAAsC;IAChF,YACqB,UAAsB,EACpB,SAA4B;QAE/C,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAY;QACpB,cAAS,GAAT,SAAS,CAAmB;QAG/C,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,QAAQ;QACJ,OAAO,6CAAoB,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAwC;QACvD,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG;YACtB,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU;YAC1B,GAAG,EAAE;SACR,CAAC;QAEF,IAAI,KAAK,CAAC,MAAM,CAAC,mBAAmB;YAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB,GAAG,IAAA,qBAAU,EAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACxG,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAwC;QACvD,IAAI,KAAK,CAAC,MAAM,CAAC,mBAAmB;YAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB,GAAG,IAAA,qBAAU,EAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACxG,CAAC;CACJ,CAAA;AAxBY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,yBAAe,GAAE;qCAGmB,oBAAU;QACT,uCAAiB;GAH1C,wBAAwB,CAwBpC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataSource, InsertEvent } from 'typeorm';
|
1
|
+
import { DataSource, InsertEvent, UpdateEvent } from 'typeorm';
|
2
2
|
import { CommonSubscriber } from '../../common/libraries/common.subscriber';
|
3
3
|
import { ScheduledEventEntity } from '../entities/scheduled.event.entity';
|
4
4
|
import { ScheduledEventJob } from '../jobs/scheduled.event.job';
|
@@ -8,4 +8,5 @@ export declare class ScheduledEventSubscriber extends CommonSubscriber<Scheduled
|
|
8
8
|
constructor(dataSource: DataSource, entityJob: ScheduledEventJob);
|
9
9
|
listenTo(): typeof ScheduledEventEntity;
|
10
10
|
beforeInsert(event: InsertEvent<ScheduledEventEntity>): Promise<void>;
|
11
|
+
beforeUpdate(event: UpdateEvent<ScheduledEventEntity>): Promise<void>;
|
11
12
|
}
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.ScheduledEventSubscriber = void 0;
|
13
|
+
const date_fns_1 = require("date-fns");
|
13
14
|
const typeorm_1 = require("typeorm");
|
14
15
|
const common_subscriber_1 = require("../../common/libraries/common.subscriber");
|
15
16
|
const scheduled_event_entity_1 = require("../entities/scheduled.event.entity");
|
@@ -29,6 +30,12 @@ let ScheduledEventSubscriber = class ScheduledEventSubscriber extends common_sub
|
|
29
30
|
...event.entity.attributes,
|
30
31
|
...{},
|
31
32
|
};
|
33
|
+
if (event.entity.last_scheduled_time)
|
34
|
+
event.entity.last_scheduled_time = (0, date_fns_1.subMinutes)(new Date(), 15);
|
35
|
+
}
|
36
|
+
async beforeUpdate(event) {
|
37
|
+
if (event.entity.last_scheduled_time)
|
38
|
+
event.entity.last_scheduled_time = (0, date_fns_1.subMinutes)(new Date(), 15);
|
32
39
|
}
|
33
40
|
};
|
34
41
|
exports.ScheduledEventSubscriber = ScheduledEventSubscriber;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scheduled.event.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/scheduled.event.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"scheduled.event.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/scheduled.event.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAsC;AACtC,qCAAgF;AAChF,gFAA4E;AAC5E,+EAA0E;AAC1E,qEAAgE;AAGzD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,oCAAsC;IAChF,YACqB,UAAsB,EACpB,SAA4B;QAE/C,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAY;QACpB,cAAS,GAAT,SAAS,CAAmB;QAG/C,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,QAAQ;QACJ,OAAO,6CAAoB,CAAC;IAChC,CAAC;IACD,KAAK,CAAC,YAAY,CAAC,KAAwC;QACvD,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG;YACtB,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU;YAC1B,GAAG,EAAE;SACR,CAAC;QAEF,IAAI,KAAK,CAAC,MAAM,CAAC,mBAAmB;YAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB,GAAG,IAAA,qBAAU,EAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACxG,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAwC;QACvD,IAAI,KAAK,CAAC,MAAM,CAAC,mBAAmB;YAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB,GAAG,IAAA,qBAAU,EAAC,IAAI,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACxG,CAAC;CACJ,CAAA;AAvBY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,yBAAe,GAAE;qCAGmB,oBAAU;QACT,uCAAiB;GAH1C,wBAAwB,CAuBpC"}
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"clean.scheduled.event.job.js","sourceRoot":"","sources":["../../../src/system/jobs/clean.scheduled.event.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,kEAA8D;AAC9D,gFAA4E;AAC5E,iFAA4E;AAC5E,uEAAiE;AAG1D,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,sBAAS;IACjD,YACuB,YAA0B,EAC5B,qBAA4C,EAC5C,oBAA0C;QAE3D,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAJvB,iBAAY,GAAZ,YAAY,CAAc;QAC5B,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,yBAAoB,GAApB,oBAAoB,CAAsB;IAG/D,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,EAAU;QACnB,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACxD,MAAM,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;CACJ,CAAA;AAZY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;qCAG4B,4BAAY;QACL,+CAAqB;QACtB,8CAAoB;GAJtD,sBAAsB,CAYlC"}
|