@servicelabsco/nestjs-utility-services 1.2.29 → 1.2.31

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 (143) hide show
  1. package/dist/app.controller.d.ts +1 -1
  2. package/dist/app.controller.js +8 -8
  3. package/dist/app.controller.js.map +1 -1
  4. package/dist/auth/middlewares/jwt.middleware.js +2 -1
  5. package/dist/auth/middlewares/jwt.middleware.js.map +1 -1
  6. package/dist/common/libraries/date.util.js +6 -6
  7. package/dist/common/libraries/date.util.js.map +1 -1
  8. package/dist/common/libraries/list.manager.js +2 -2
  9. package/dist/common/libraries/platform.utility.d.ts +3 -0
  10. package/dist/common/libraries/platform.utility.js +6 -0
  11. package/dist/common/libraries/platform.utility.js.map +1 -1
  12. package/dist/common/libraries/record.manager.js +4 -4
  13. package/dist/common/libraries/report.data.manager.js +2 -2
  14. package/dist/common/libraries/report.list.manager.js +2 -2
  15. package/dist/config/entity.constants.d.ts +4 -0
  16. package/dist/config/entity.constants.js +4 -0
  17. package/dist/config/entity.constants.js.map +1 -1
  18. package/dist/config/sentry.config.d.ts +7 -0
  19. package/dist/config/sentry.config.js +9 -0
  20. package/dist/config/sentry.config.js.map +1 -0
  21. package/dist/config/source.hash.d.ts +2 -2
  22. package/dist/config/source.hash.js +2 -2
  23. package/dist/main.js +8 -0
  24. package/dist/main.js.map +1 -1
  25. package/dist/migrations/1699364212491-AddSchemaValidationDataSeederTable.d.ts +5 -0
  26. package/dist/migrations/1699364212491-AddSchemaValidationDataSeederTable.js +21 -0
  27. package/dist/migrations/1699364212491-AddSchemaValidationDataSeederTable.js.map +1 -0
  28. package/dist/migrations/1700392547578-CreateMailRecipientTable.d.ts +5 -0
  29. package/dist/migrations/1700392547578-CreateMailRecipientTable.js +20 -0
  30. package/dist/migrations/1700392547578-CreateMailRecipientTable.js.map +1 -0
  31. package/dist/migrations/1700393526749-AddBodySysMailLogsTable.ts.d.ts +5 -0
  32. package/dist/migrations/1700393526749-AddBodySysMailLogsTable.ts.js +16 -0
  33. package/dist/migrations/1700393526749-AddBodySysMailLogsTable.ts.js.map +1 -0
  34. package/dist/migrations/1700394466332-CreateMailEventTable.d.ts +5 -0
  35. package/dist/migrations/1700394466332-CreateMailEventTable.js +22 -0
  36. package/dist/migrations/1700394466332-CreateMailEventTable.js.map +1 -0
  37. package/dist/migrations/1700401846961-RemoveToColumnSysMailLogsTable.ts.d.ts +5 -0
  38. package/dist/migrations/1700401846961-RemoveToColumnSysMailLogsTable.ts.js +15 -0
  39. package/dist/migrations/1700401846961-RemoveToColumnSysMailLogsTable.ts.js.map +1 -0
  40. package/dist/platformUtility/consumers/job.consumer.js.map +1 -1
  41. package/dist/platformUtility/es6.classes.d.ts +1 -1
  42. package/dist/platformUtility/libraries/process.audit.log.data.js +2 -2
  43. package/dist/platformUtility/libraries/process.smtp.mail.d.ts +6 -1
  44. package/dist/platformUtility/libraries/process.smtp.mail.js +8 -7
  45. package/dist/platformUtility/libraries/process.smtp.mail.js.map +1 -1
  46. package/dist/platformUtility/services/mail.service.d.ts +6 -6
  47. package/dist/platformUtility/services/mail.service.js +33 -25
  48. package/dist/platformUtility/services/mail.service.js.map +1 -1
  49. package/dist/system/commands/db.scanner.command.js +6 -6
  50. package/dist/system/commands/index.d.ts +1 -0
  51. package/dist/system/commands/index.js +1 -0
  52. package/dist/system/commands/index.js.map +1 -1
  53. package/dist/system/commands/ses.event.tracking.command.d.ts +12 -0
  54. package/dist/system/commands/ses.event.tracking.command.js +70 -0
  55. package/dist/system/commands/ses.event.tracking.command.js.map +1 -0
  56. package/dist/system/controllers/form.controller.js +3 -3
  57. package/dist/system/controllers/preference.controller.js +4 -4
  58. package/dist/system/controllers/report.controller.js +2 -2
  59. package/dist/system/dtos/index.d.ts +2 -0
  60. package/dist/system/dtos/index.js +2 -0
  61. package/dist/system/dtos/index.js.map +1 -1
  62. package/dist/system/dtos/mail.event.attributes.dto.d.ts +3 -0
  63. package/dist/system/dtos/mail.event.attributes.dto.js +8 -0
  64. package/dist/system/dtos/mail.event.attributes.dto.js.map +1 -0
  65. package/dist/system/dtos/mail.recipient.attributes.dto.d.ts +3 -0
  66. package/dist/system/dtos/mail.recipient.attributes.dto.js +8 -0
  67. package/dist/system/dtos/mail.recipient.attributes.dto.js.map +1 -0
  68. package/dist/system/entities/index.d.ts +2 -0
  69. package/dist/system/entities/index.js +2 -0
  70. package/dist/system/entities/index.js.map +1 -1
  71. package/dist/system/entities/mail.event.entity.d.ts +11 -0
  72. package/dist/system/entities/mail.event.entity.js +48 -0
  73. package/dist/system/entities/mail.event.entity.js.map +1 -0
  74. package/dist/system/entities/mail.log.entity.d.ts +2 -1
  75. package/dist/system/entities/mail.log.entity.js +6 -2
  76. package/dist/system/entities/mail.log.entity.js.map +1 -1
  77. package/dist/system/entities/mail.recipient.entity.d.ts +10 -0
  78. package/dist/system/entities/mail.recipient.entity.js +44 -0
  79. package/dist/system/entities/mail.recipient.entity.js.map +1 -0
  80. package/dist/system/es6.classes.d.ts +14 -5
  81. package/dist/system/es6.classes.js +22 -2
  82. package/dist/system/es6.classes.js.map +1 -1
  83. package/dist/system/index.d.ts +1 -0
  84. package/dist/system/index.js +1 -0
  85. package/dist/system/index.js.map +1 -1
  86. package/dist/system/interceptors/index.d.ts +1 -0
  87. package/dist/system/interceptors/index.js +18 -0
  88. package/dist/system/interceptors/index.js.map +1 -0
  89. package/dist/system/interceptors/sentry.interceptor.d.ts +5 -0
  90. package/dist/system/interceptors/sentry.interceptor.js +33 -0
  91. package/dist/system/interceptors/sentry.interceptor.js.map +1 -0
  92. package/dist/system/jobs/clean.scheduled.event.job.d.ts +4 -5
  93. package/dist/system/jobs/clean.scheduled.event.job.js +7 -7
  94. package/dist/system/jobs/clean.scheduled.event.job.js.map +1 -1
  95. package/dist/system/jobs/index.d.ts +3 -1
  96. package/dist/system/jobs/index.js +3 -1
  97. package/dist/system/jobs/index.js.map +1 -1
  98. package/dist/system/jobs/mail.event.job.d.ts +9 -0
  99. package/dist/system/jobs/mail.event.job.js +30 -0
  100. package/dist/system/jobs/mail.event.job.js.map +1 -0
  101. package/dist/system/jobs/mail.recipient.job.d.ts +9 -0
  102. package/dist/system/jobs/mail.recipient.job.js +30 -0
  103. package/dist/system/jobs/mail.recipient.job.js.map +1 -0
  104. package/dist/system/jobs/model.scanner.job.js +6 -6
  105. package/dist/system/jobs/report.column.sync.job.js +3 -3
  106. package/dist/system/jobs/scheduled.event.job.d.ts +9 -5
  107. package/dist/system/jobs/scheduled.event.job.js +22 -21
  108. package/dist/system/jobs/scheduled.event.job.js.map +1 -1
  109. package/dist/system/jobs/{scheduled.events.job.d.ts → set.scheduled.event.job.d.ts} +3 -3
  110. package/dist/system/jobs/{scheduled.events.job.js → set.scheduled.event.job.js} +20 -19
  111. package/dist/system/jobs/set.scheduled.event.job.js.map +1 -0
  112. package/dist/system/jobs/user.group.member.job.js +5 -5
  113. package/dist/system/jobs/user.group.permission.job.js +3 -3
  114. package/dist/system/jobs/user.group.role.job.js +3 -3
  115. package/dist/system/libraries/model.sync.js +2 -2
  116. package/dist/system/services/column.service.js +2 -2
  117. package/dist/system/services/es6.jobs.service.d.ts +7 -3
  118. package/dist/system/services/es6.jobs.service.js +13 -5
  119. package/dist/system/services/es6.jobs.service.js.map +1 -1
  120. package/dist/system/services/form.service.js +2 -2
  121. package/dist/system/services/menu.service.js +2 -2
  122. package/dist/system/services/model.service.js +3 -3
  123. package/dist/system/services/preference.service.js +5 -5
  124. package/dist/system/services/report.service.js +4 -4
  125. package/dist/system/services/scheduled.event.service.d.ts +8 -2
  126. package/dist/system/services/scheduled.event.service.js +46 -21
  127. package/dist/system/services/scheduled.event.service.js.map +1 -1
  128. package/dist/system/services/security.rule.service.js +3 -3
  129. package/dist/system/subscribers/index.d.ts +2 -0
  130. package/dist/system/subscribers/index.js +2 -0
  131. package/dist/system/subscribers/index.js.map +1 -1
  132. package/dist/system/subscribers/mail.event.subscriber.d.ts +12 -0
  133. package/dist/system/subscribers/mail.event.subscriber.js +40 -0
  134. package/dist/system/subscribers/mail.event.subscriber.js.map +1 -0
  135. package/dist/system/subscribers/mail.recipient.subscriber.d.ts +12 -0
  136. package/dist/system/subscribers/mail.recipient.subscriber.js +40 -0
  137. package/dist/system/subscribers/mail.recipient.subscriber.js.map +1 -0
  138. package/dist/system/subscribers/scheduled.event.subscriber.d.ts +2 -3
  139. package/dist/system/subscribers/scheduled.event.subscriber.js +10 -9
  140. package/dist/system/subscribers/scheduled.event.subscriber.js.map +1 -1
  141. package/dist/tsconfig.build.tsbuildinfo +1 -1
  142. package/package.json +3 -1
  143. package/dist/system/jobs/scheduled.events.job.js.map +0 -1
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.FormService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
- const SOURCEHASH = require("../../config/source.hash");
14
+ const SourceHash = require("../../config/source.hash");
15
15
  const column_manager_1 = require("../libraries/column.manager");
16
16
  const security_rule_service_1 = require("./security.rule.service");
17
17
  let FormService = class FormService {
@@ -21,7 +21,7 @@ let FormService = class FormService {
21
21
  async getDictionary(form) {
22
22
  const rules = await this.securityRuleService.getFormSecurityRules(form);
23
23
  const columnManager = new column_manager_1.ColumnManager();
24
- await columnManager.process(SOURCEHASH.form, form.id, {
24
+ await columnManager.process(SourceHash.form, form.id, {
25
25
  rules,
26
26
  });
27
27
  return columnManager.allowed;
@@ -24,7 +24,7 @@ const menu_list_modifier_1 = require("../modifiers/menu.list.modifier");
24
24
  const module_list_modifier_1 = require("../modifiers/module.list.modifier");
25
25
  const preference_service_1 = require("./preference.service");
26
26
  const ui_action_service_1 = require("./ui.action.service");
27
- const SOURCEHASH = require("../../config/source.hash");
27
+ const SourceHash = require("../../config/source.hash");
28
28
  let MenuService = class MenuService {
29
29
  constructor(accessManager, preferenceService, uiActionService) {
30
30
  this.accessManager = accessManager;
@@ -42,7 +42,7 @@ let MenuService = class MenuService {
42
42
  if (!menu)
43
43
  throw new operation_exception_1.OperationException('Menu doesnot exist');
44
44
  menu.list_layouts = await this.preferenceService.getMenuListPreferences(id);
45
- menu.ui_actions = await this.uiActionService.getUiActions(SOURCEHASH.menu, id);
45
+ menu.ui_actions = await this.uiActionService.getUiActions(SourceHash.menu, id);
46
46
  return menu;
47
47
  }
48
48
  async getPageDefinitions() {
@@ -22,7 +22,7 @@ const ui_action_entity_1 = require("../entities/ui.action.entity");
22
22
  const column_manager_1 = require("../libraries/column.manager");
23
23
  const security_rule_service_1 = require("./security.rule.service");
24
24
  const ui_action_service_1 = require("./ui.action.service");
25
- const SOURCEHASH = require("../../config/source.hash");
25
+ const SourceHash = require("../../config/source.hash");
26
26
  const ROLEMAPPING = require("../../config/role.mapping");
27
27
  let ModelService = class ModelService {
28
28
  constructor(uiActionService, accessManager, securityRuleService, propertyService) {
@@ -46,7 +46,7 @@ let ModelService = class ModelService {
46
46
  const enableAuditLog = await this.propertyService.get('system.audit.enable', true);
47
47
  if (enableAuditLog && actions.length)
48
48
  actions.push(await ui_action_entity_1.UiActionEntity.first(4));
49
- const customActions = await this.uiActionService.getUiActions(SOURCEHASH.model, model.id);
49
+ const customActions = await this.uiActionService.getUiActions(SourceHash.model, model.id);
50
50
  return class_mapper_1.ClassMapper.removeArrayWhoColumns(actions.concat(customActions));
51
51
  }
52
52
  async validateHashAccess(hash, operation) {
@@ -81,7 +81,7 @@ let ModelService = class ModelService {
81
81
  async getDictionary(model, operation, data) {
82
82
  const rules = await this.securityRuleService.getModelSecurityRules(model, operation);
83
83
  const columnManager = new column_manager_1.ColumnManager();
84
- await columnManager.process(SOURCEHASH.model, model.id, { rules, data });
84
+ await columnManager.process(SourceHash.model, model.id, { rules, data });
85
85
  return columnManager;
86
86
  }
87
87
  async validateModelAccess(model, operation) {
@@ -13,16 +13,16 @@ const auth_1 = require("../../common/libraries/auth");
13
13
  const class_mapper_1 = require("../../common/libraries/class.mapper");
14
14
  const list_preference_entity_1 = require("../entities/list.preference.entity");
15
15
  const form_preference_entity_1 = require("../entities/form.preference.entity");
16
- const SOURCEHASH = require("../../config/source.hash");
16
+ const SourceHash = require("../../config/source.hash");
17
17
  let PreferenceService = class PreferenceService {
18
18
  async getMenuListPreferences(id) {
19
- return this.getListPreferences(SOURCEHASH.menu, id);
19
+ return this.getListPreferences(SourceHash.menu, id);
20
20
  }
21
21
  async getTabListPreferences(id) {
22
- return this.getListPreferences(SOURCEHASH.relationship, id);
22
+ return this.getListPreferences(SourceHash.relationship, id);
23
23
  }
24
24
  async getTabFormPreferences(id) {
25
- return this.getFormPreferences(SOURCEHASH.relationship, id);
25
+ return this.getFormPreferences(SourceHash.relationship, id);
26
26
  }
27
27
  async getListPreferences(source_type, source_id) {
28
28
  const user = auth_1.Auth.user();
@@ -50,7 +50,7 @@ let PreferenceService = class PreferenceService {
50
50
  async getModelFormPreferences(id) {
51
51
  const preferences = await form_preference_entity_1.FormPreferenceEntity.find({
52
52
  where: {
53
- source_type: SOURCEHASH.model,
53
+ source_type: SourceHash.model,
54
54
  source_id: id,
55
55
  },
56
56
  });
@@ -19,7 +19,7 @@ const report_role_entity_1 = require("../entities/report.role.entity");
19
19
  const preference_service_1 = require("./preference.service");
20
20
  const ui_action_service_1 = require("./ui.action.service");
21
21
  const ROLEMAPPING = require("../../config/role.mapping");
22
- const SOURCEHASH = require("../../config/source.hash");
22
+ const SourceHash = require("../../config/source.hash");
23
23
  let ReportService = class ReportService {
24
24
  constructor(accessManager, preferenceService, uiActionService) {
25
25
  this.accessManager = accessManager;
@@ -42,11 +42,11 @@ let ReportService = class ReportService {
42
42
  if (!report)
43
43
  throw new operation_exception_1.OperationException('Report doesnot exist');
44
44
  report.charts = await chart_entity_1.ChartEntity.find({
45
- where: { source_type: SOURCEHASH.report, source_id: id },
45
+ where: { source_type: SourceHash.report, source_id: id },
46
46
  relations: ['primary_axis', 'secondary_axis'],
47
47
  });
48
- report.list_layouts = await this.preferenceService.getListPreferences(SOURCEHASH.report, id);
49
- report.ui_actions = await this.uiActionService.getUiActions(SOURCEHASH.report, id);
48
+ report.list_layouts = await this.preferenceService.getListPreferences(SourceHash.report, id);
49
+ report.ui_actions = await this.uiActionService.getUiActions(SourceHash.report, id);
50
50
  return report;
51
51
  }
52
52
  };
@@ -1,10 +1,16 @@
1
1
  import { EventQueueEntity } from '../entities/event.queue.entity';
2
2
  import { ScheduledEventEntity } from '../entities/scheduled.event.entity';
3
+ import { PropertyService } from './property.service';
3
4
  export declare class ScheduledEventService {
5
+ private readonly propertyService;
6
+ constructor(propertyService: PropertyService);
4
7
  getActiveEvents(id: number): Promise<EventQueueEntity[]>;
5
8
  getCompletedEvents(id: number): Promise<EventQueueEntity[]>;
6
- deleteActiveEvents(id: number): Promise<void>;
7
- setNewEvent(job: ScheduledEventEntity, scheduledTime?: Date): Promise<EventQueueEntity>;
9
+ deleteActiveEvents(id: number): Promise<EventQueueEntity[]>;
10
+ setNewEvent(job: ScheduledEventEntity, scheduledTime: Date): Promise<EventQueueEntity>;
8
11
  createEventsForJob(job: ScheduledEventEntity): Promise<ScheduledEventEntity>;
9
12
  getActiveSchedules(): Promise<ScheduledEventEntity[]>;
13
+ private getLastScheduledJob;
14
+ private withTimezoneOffset;
15
+ private reverseTimezoneOffset;
10
16
  }
@@ -5,20 +5,28 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
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
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
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
+ };
8
11
  Object.defineProperty(exports, "__esModule", { value: true });
9
12
  exports.ScheduledEventService = void 0;
10
13
  const common_1 = require("@nestjs/common");
11
14
  const parser = require("cron-parser");
15
+ const date_fns_1 = require("date-fns");
12
16
  const typeorm_1 = require("typeorm");
13
17
  const date_util_1 = require("../../common/libraries/date.util");
14
18
  const event_queue_entity_1 = require("../entities/event.queue.entity");
15
19
  const scheduled_event_entity_1 = require("../entities/scheduled.event.entity");
16
- const SOURCEHASH = require("../../config/source.hash");
20
+ const property_service_1 = require("./property.service");
21
+ const SourceHash = require("../../config/source.hash");
17
22
  let ScheduledEventService = class ScheduledEventService {
23
+ constructor(propertyService) {
24
+ this.propertyService = propertyService;
25
+ }
18
26
  async getActiveEvents(id) {
19
27
  return event_queue_entity_1.EventQueueEntity.find({
20
28
  where: {
21
- source_type: SOURCEHASH.scheduledEvent,
29
+ source_type: SourceHash.scheduledEvent,
22
30
  source_id: id,
23
31
  start_time: (0, typeorm_1.IsNull)(),
24
32
  },
@@ -30,7 +38,7 @@ let ScheduledEventService = class ScheduledEventService {
30
38
  async getCompletedEvents(id) {
31
39
  return event_queue_entity_1.EventQueueEntity.find({
32
40
  where: {
33
- source_type: SOURCEHASH.scheduledEvent,
41
+ source_type: SourceHash.scheduledEvent,
34
42
  source_id: id,
35
43
  start_time: (0, typeorm_1.Not)((0, typeorm_1.IsNull)()),
36
44
  },
@@ -41,22 +49,19 @@ let ScheduledEventService = class ScheduledEventService {
41
49
  });
42
50
  }
43
51
  async deleteActiveEvents(id) {
44
- const records = await this.getActiveEvents(id);
45
- const promises = [];
46
- records.forEach((record) => {
47
- promises.push(record.softRemove());
48
- });
49
- Promise.all(promises).then(() => {
50
- return;
52
+ return event_queue_entity_1.EventQueueEntity.softDelete({
53
+ source_type: SourceHash.scheduledEvent,
54
+ source_id: id,
55
+ start_time: (0, typeorm_1.IsNull)(),
51
56
  });
52
57
  }
53
- async setNewEvent(job, scheduledTime = new Date()) {
58
+ async setNewEvent(job, scheduledTime) {
54
59
  const record = new event_queue_entity_1.EventQueueEntity();
55
60
  record.name = job.event.name;
56
61
  record.event_id = job.event_id;
57
62
  record.parameter = job.parameter;
58
63
  record.scheduled_start_time = scheduledTime;
59
- record.source_type = SOURCEHASH.scheduledEvent;
64
+ record.source_type = SourceHash.scheduledEvent;
60
65
  record.source_id = job.id;
61
66
  await record.save();
62
67
  return record;
@@ -65,10 +70,10 @@ let ScheduledEventService = class ScheduledEventService {
65
70
  if (!(job && job.event))
66
71
  return job;
67
72
  const events = await this.getActiveEvents(job.id);
68
- let inQueue = events.length;
69
- if (inQueue > 6)
73
+ let inQueueCount = events.length;
74
+ if (inQueueCount > 6)
70
75
  return job;
71
- let lastRunTime = inQueue ? events.slice(-1)[0].scheduled_start_time : date_util_1.DateUtil.getDateTime();
76
+ let lastRunTime = await this.getLastScheduledJob(events);
72
77
  lastRunTime = lastRunTime < job.start_time ? job.start_time : lastRunTime;
73
78
  if (lastRunTime > job.end_time)
74
79
  return;
@@ -76,12 +81,14 @@ let ScheduledEventService = class ScheduledEventService {
76
81
  currentDate: lastRunTime,
77
82
  endDate: job.end_time,
78
83
  });
79
- while (inQueue <= 10) {
84
+ while (inQueueCount <= 10) {
80
85
  if (!nextTime.hasNext())
81
86
  return;
82
- const event = await this.setNewEvent(job, nextTime.next().toDate());
83
- job.last_scheduled_time = event.scheduled_start_time;
84
- ++inQueue;
87
+ const next = nextTime.next().toDate();
88
+ const date = await this.withTimezoneOffset(next);
89
+ await this.setNewEvent(job, date);
90
+ job.last_scheduled_time = date;
91
+ ++inQueueCount;
85
92
  }
86
93
  await job.save();
87
94
  return job;
@@ -92,13 +99,31 @@ let ScheduledEventService = class ScheduledEventService {
92
99
  where: {
93
100
  active: true,
94
101
  end_time: (0, typeorm_1.Not)((0, typeorm_1.LessThan)(date_util_1.DateUtil.getDateTime())),
95
- last_scheduled_time: (0, typeorm_1.LessThan)(date_util_1.DateUtil.getFutureDateTime(10)),
96
102
  },
97
103
  });
98
104
  }
105
+ async getLastScheduledJob(events) {
106
+ if (!events.length)
107
+ return new Date();
108
+ const lastEvent = events.pop();
109
+ return this.reverseTimezoneOffset(lastEvent.scheduled_start_time);
110
+ }
111
+ async withTimezoneOffset(date) {
112
+ const offset = await this.propertyService.get(`scheduled.job.timezone.offset`, 0);
113
+ if (!offset)
114
+ return date;
115
+ return (0, date_fns_1.subMinutes)(date, +offset);
116
+ }
117
+ async reverseTimezoneOffset(date) {
118
+ const offset = await this.propertyService.get(`scheduled.job.timezone.offset`, 0);
119
+ if (!offset)
120
+ return date;
121
+ return (0, date_fns_1.addMinutes)(date, +offset);
122
+ }
99
123
  };
100
124
  exports.ScheduledEventService = ScheduledEventService;
101
125
  exports.ScheduledEventService = ScheduledEventService = __decorate([
102
- (0, common_1.Injectable)()
126
+ (0, common_1.Injectable)(),
127
+ __metadata("design:paramtypes", [property_service_1.PropertyService])
103
128
  ], ScheduledEventService);
104
129
  //# sourceMappingURL=scheduled.event.service.js.map
@@ -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,qCAAgD;AAChD,gEAA4D;AAC5D,uEAAkE;AAClE,+EAA0E;AAC1E,uDAAwD;AAQjD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAO9B,KAAK,CAAC,eAAe,CAAC,EAAU;QAC5B,OAAO,qCAAgB,CAAC,IAAI,CAAC;YACzB,KAAK,EAAE;gBACH,WAAW,EAAE,UAAU,CAAC,cAAc;gBACtC,SAAS,EAAE,EAAE;gBACb,UAAU,EAAE,IAAA,gBAAM,GAAE;aACvB;YACD,KAAK,EAAE;gBACH,oBAAoB,EAAE,KAAK;aAC9B;SACJ,CAAC,CAAC;IACP,CAAC;IAQD,KAAK,CAAC,kBAAkB,CAAC,EAAU;QAC/B,OAAO,qCAAgB,CAAC,IAAI,CAAC;YACzB,KAAK,EAAE;gBACH,WAAW,EAAE,UAAU,CAAC,cAAc;gBACtC,SAAS,EAAE,EAAE;gBACb,UAAU,EAAE,IAAA,aAAG,EAAC,IAAA,gBAAM,GAAE,CAAC;aAC5B;YACD,IAAI,EAAE,EA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AC,CAAC;gBAC/C,mBAAmB,EAAE,IAAA,kBAAQ,EAAC,oBAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;aAChE;SACJ,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AApJY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;GACA,qBAAqB,CAoJjC"}
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,qCAAgD;AAChD,gEAA4D;AAC5D,uEAAkE;AAClE,+EAA0E;AAC1E,yDAAqD;AACrD,uDAAwD;AAQjD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAM9B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAOjE,KAAK,CAAC,eAAe,CAAC,EAAU;QAC5B,OAAO,qCAAgB,CAAC,IAAI,CAAC;YACzB,KAAK,EAAE;gBACH,WAAW,EAAE,UAAU,CAAC,cAAc;gBACtC,SAAS,EAAE,EAAE;gBACb,UAAU,EAAE,IAAA,gBAAM,GAAE;aACvB;YACD,KAAK,EAAE;gBACH,oBAAoB,EAAE,KAAK;aAC9B;SACJ,CAAC,CAAC;IACP,CAAC;IAQD,KAAK,CAAC,kBAAkB,CAAC,EAAU;QAC/B,OAAO,qCAAgB,CAAC,IAAI,CAAC;YACzB,KAAK,EAAE;gBACH,WAAW,EAAE,UAAU,CAAC,cAAc;gBACtC,SAAS,EAAE,EAAE;gBACb,UAAU,EAAE,IAAA,aAAG,EAAC,IAAA,gBAAM,GAAE,CAAC;aAC5B;YACD,IAAI,EAAE,EAAE;YACR,KAAK,EAAE;gBACH,oBAAoB,EAAE,MAAM;aAC/B;SACJ,CAAC,CAAC;IACP,CAAC;IAOD,KAAK,CAAC,kBAAkB,CAAC,EAAU;QAC/B,OAAO,qCA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GAAG,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAEzB,OAAO,IAAA,qBAAU,EAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IASO,KAAK,CAAC,qBAAqB,CAAC,IAAU;QAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAC;QAClF,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAEzB,OAAO,IAAA,qBAAU,EAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACJ,CAAA;AAjMY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAOqC,kCAAe;GANpD,qBAAqB,CAiMjC"}
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SecurityRuleService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
- const SOURCEHASH = require("../../config/source.hash");
14
+ const SourceHash = require("../../config/source.hash");
15
15
  const sql_service_1 = require("../../platformUtility/services/sql.service");
16
16
  const system_script_entity_1 = require("../entities/system.script.entity");
17
17
  let SecurityRuleService = class SecurityRuleService {
@@ -19,10 +19,10 @@ let SecurityRuleService = class SecurityRuleService {
19
19
  this.sqlService = sqlService;
20
20
  }
21
21
  async getModelSecurityRules(model, operation) {
22
- return this.getSecurityRules(model.id, model.table_name, operation, SOURCEHASH.model);
22
+ return this.getSecurityRules(model.id, model.table_name, operation, SourceHash.model);
23
23
  }
24
24
  async getFormSecurityRules(form) {
25
- return this.getSecurityRules(form.id, form.identifier, '-', SOURCEHASH.form);
25
+ return this.getSecurityRules(form.id, form.identifier, '-', SourceHash.form);
26
26
  }
27
27
  getSecurityObjectNotation(identifier, name) {
28
28
  if (name === identifier || name === `${identifier}.*`)
@@ -4,6 +4,8 @@ export * from './column.subscriber';
4
4
  export * from './comment.subscriber';
5
5
  export * from './credential.ip.subscriber';
6
6
  export * from './document.subscriber';
7
+ export * from './mail.event.subscriber';
8
+ export * from './mail.recipient.subscriber';
7
9
  export * from './mail.validation.subscriber';
8
10
  export * from './mobile.validation.subscriber';
9
11
  export * from './property.subscriber';
@@ -20,6 +20,8 @@ __exportStar(require("./column.subscriber"), exports);
20
20
  __exportStar(require("./comment.subscriber"), exports);
21
21
  __exportStar(require("./credential.ip.subscriber"), exports);
22
22
  __exportStar(require("./document.subscriber"), exports);
23
+ __exportStar(require("./mail.event.subscriber"), exports);
24
+ __exportStar(require("./mail.recipient.subscriber"), exports);
23
25
  __exportStar(require("./mail.validation.subscriber"), exports);
24
26
  __exportStar(require("./mobile.validation.subscriber"), exports);
25
27
  __exportStar(require("./property.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,sDAAoC;AAAA,uDAAqC;AAAA,6DAA2C;AAAA,wDAAsC;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,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"}
@@ -0,0 +1,12 @@
1
+ import { DataSource, InsertEvent, UpdateEvent } from 'typeorm';
2
+ import { MailEventEntity } from '../entities/mail.event.entity';
3
+ import { MailEventJob } from '../jobs/mail.event.job';
4
+ import { CommonSubscriber } from '../../common/libraries/common.subscriber';
5
+ export declare class MailEventSubscriber extends CommonSubscriber<MailEventEntity> {
6
+ private readonly dataSource;
7
+ private readonly mailEventJob;
8
+ constructor(dataSource: DataSource, mailEventJob: MailEventJob);
9
+ listenTo(): typeof MailEventEntity;
10
+ afterInsert(evt: InsertEvent<MailEventEntity>): Promise<void>;
11
+ afterUpdate(evt: UpdateEvent<MailEventEntity>): Promise<void>;
12
+ }
@@ -0,0 +1,40 @@
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.MailEventSubscriber = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const mail_event_entity_1 = require("../entities/mail.event.entity");
15
+ const mail_event_job_1 = require("../jobs/mail.event.job");
16
+ const common_subscriber_1 = require("../../common/libraries/common.subscriber");
17
+ let MailEventSubscriber = class MailEventSubscriber extends common_subscriber_1.CommonSubscriber {
18
+ constructor(dataSource, mailEventJob) {
19
+ super();
20
+ this.dataSource = dataSource;
21
+ this.mailEventJob = mailEventJob;
22
+ dataSource.subscribers.push(this);
23
+ }
24
+ listenTo() {
25
+ return mail_event_entity_1.MailEventEntity;
26
+ }
27
+ async afterInsert(evt) {
28
+ await this.mailEventJob.delayedDispatch(this.getEventData(evt));
29
+ }
30
+ async afterUpdate(evt) {
31
+ await this.mailEventJob.delayedDispatch(this.getEventData(evt));
32
+ }
33
+ };
34
+ exports.MailEventSubscriber = MailEventSubscriber;
35
+ exports.MailEventSubscriber = MailEventSubscriber = __decorate([
36
+ (0, typeorm_1.EventSubscriber)(),
37
+ __metadata("design:paramtypes", [typeorm_1.DataSource,
38
+ mail_event_job_1.MailEventJob])
39
+ ], MailEventSubscriber);
40
+ //# sourceMappingURL=mail.event.subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail.event.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/mail.event.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgF;AAChF,qEAAgE;AAChE,2DAAsD;AACtD,gFAA4E;AAGrE,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,oCAAiC;IACtE,YACqB,UAAsB,EACtB,YAA0B;QAE3C,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAY;QACtB,iBAAY,GAAZ,YAAY,CAAc;QAG3C,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,QAAQ;QACJ,OAAO,mCAAe,CAAC;IAC3B,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,GAAiC;QAC/C,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAAiC;QAC/C,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,CAAC;CACJ,CAAA;AAlBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,yBAAe,GAAE;qCAGmB,oBAAU;QACR,6BAAY;GAHtC,mBAAmB,CAkB/B"}
@@ -0,0 +1,12 @@
1
+ import { DataSource, InsertEvent, UpdateEvent } from 'typeorm';
2
+ import { CommonSubscriber } from '../../common/libraries/common.subscriber';
3
+ import { MailRecipientEntity } from '../entities/mail.recipient.entity';
4
+ import { MailRecipientJob } from '../jobs/mail.recipient.job';
5
+ export declare class MailRecipientSubscriber extends CommonSubscriber<MailRecipientEntity> {
6
+ private readonly dataSource;
7
+ private readonly mailRecipientJob;
8
+ constructor(dataSource: DataSource, mailRecipientJob: MailRecipientJob);
9
+ listenTo(): typeof MailRecipientEntity;
10
+ afterInsert(evt: InsertEvent<MailRecipientEntity>): Promise<void>;
11
+ afterUpdate(evt: UpdateEvent<MailRecipientEntity>): Promise<void>;
12
+ }
@@ -0,0 +1,40 @@
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.MailRecipientSubscriber = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_subscriber_1 = require("../../common/libraries/common.subscriber");
15
+ const mail_recipient_entity_1 = require("../entities/mail.recipient.entity");
16
+ const mail_recipient_job_1 = require("../jobs/mail.recipient.job");
17
+ let MailRecipientSubscriber = class MailRecipientSubscriber extends common_subscriber_1.CommonSubscriber {
18
+ constructor(dataSource, mailRecipientJob) {
19
+ super();
20
+ this.dataSource = dataSource;
21
+ this.mailRecipientJob = mailRecipientJob;
22
+ dataSource.subscribers.push(this);
23
+ }
24
+ listenTo() {
25
+ return mail_recipient_entity_1.MailRecipientEntity;
26
+ }
27
+ async afterInsert(evt) {
28
+ await this.mailRecipientJob.delayedDispatch(this.getEventData(evt));
29
+ }
30
+ async afterUpdate(evt) {
31
+ await this.mailRecipientJob.delayedDispatch(this.getEventData(evt));
32
+ }
33
+ };
34
+ exports.MailRecipientSubscriber = MailRecipientSubscriber;
35
+ exports.MailRecipientSubscriber = MailRecipientSubscriber = __decorate([
36
+ (0, typeorm_1.EventSubscriber)(),
37
+ __metadata("design:paramtypes", [typeorm_1.DataSource,
38
+ mail_recipient_job_1.MailRecipientJob])
39
+ ], MailRecipientSubscriber);
40
+ //# sourceMappingURL=mail.recipient.subscriber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail.recipient.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/mail.recipient.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgF;AAChF,gFAA4E;AAC5E,6EAAwE;AACxE,mEAA8D;AAGvD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,oCAAqC;IAC9E,YACqB,UAAsB,EACtB,gBAAkC;QAEnD,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAY;QACtB,qBAAgB,GAAhB,gBAAgB,CAAkB;QAGnD,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,QAAQ;QACJ,OAAO,2CAAmB,CAAC;IAC/B,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,GAAqC;QACnD,MAAM,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAAqC;QACnD,MAAM,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;AAlBY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,yBAAe,GAAE;qCAGmB,oBAAU;QACJ,qCAAgB;GAH9C,uBAAuB,CAkBnC"}
@@ -1,14 +1,13 @@
1
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
- import { CleanScheduledEventJob } from '../jobs/clean.scheduled.event.job';
5
4
  import { ScheduledEventJob } from '../jobs/scheduled.event.job';
6
5
  export declare class ScheduledEventSubscriber extends CommonSubscriber<ScheduledEventEntity> {
7
6
  private readonly dataSource;
8
7
  private readonly scheduledEventJob;
9
- private readonly cleanScheduledEventJob;
10
- constructor(dataSource: DataSource, scheduledEventJob: ScheduledEventJob, cleanScheduledEventJob: CleanScheduledEventJob);
8
+ constructor(dataSource: DataSource, scheduledEventJob: ScheduledEventJob);
11
9
  listenTo(): typeof ScheduledEventEntity;
10
+ beforeInsert(event: InsertEvent<ScheduledEventEntity>): Promise<void>;
12
11
  afterInsert(event: InsertEvent<ScheduledEventEntity>): Promise<void>;
13
12
  afterUpdate(event: UpdateEvent<ScheduledEventEntity>): Promise<void>;
14
13
  }
@@ -13,33 +13,34 @@ exports.ScheduledEventSubscriber = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const common_subscriber_1 = require("../../common/libraries/common.subscriber");
15
15
  const scheduled_event_entity_1 = require("../entities/scheduled.event.entity");
16
- const clean_scheduled_event_job_1 = require("../jobs/clean.scheduled.event.job");
17
16
  const scheduled_event_job_1 = require("../jobs/scheduled.event.job");
18
17
  let ScheduledEventSubscriber = class ScheduledEventSubscriber extends common_subscriber_1.CommonSubscriber {
19
- constructor(dataSource, scheduledEventJob, cleanScheduledEventJob) {
18
+ constructor(dataSource, scheduledEventJob) {
20
19
  super();
21
20
  this.dataSource = dataSource;
22
21
  this.scheduledEventJob = scheduledEventJob;
23
- this.cleanScheduledEventJob = cleanScheduledEventJob;
24
22
  dataSource.subscribers.push(this);
25
23
  }
26
24
  listenTo() {
27
25
  return scheduled_event_entity_1.ScheduledEventEntity;
28
26
  }
27
+ async beforeInsert(event) {
28
+ event.entity.attributes = {
29
+ ...event.entity.attributes,
30
+ ...{},
31
+ };
32
+ }
29
33
  async afterInsert(event) {
30
- await this.scheduledEventJob.dispatch(event.entity.id);
34
+ await this.scheduledEventJob.dispatch(this.getEventData(event));
31
35
  }
32
36
  async afterUpdate(event) {
33
- const trackingColumns = ['event_id', 'parameter', 'timing', 'active', 'start_time', 'end_time'];
34
- if (this.isColumnUpdated(event, trackingColumns))
35
- await this.cleanScheduledEventJob.dispatch(event.entity);
37
+ await this.scheduledEventJob.dispatch(this.getEventData(event));
36
38
  }
37
39
  };
38
40
  exports.ScheduledEventSubscriber = ScheduledEventSubscriber;
39
41
  exports.ScheduledEventSubscriber = ScheduledEventSubscriber = __decorate([
40
42
  (0, typeorm_1.EventSubscriber)(),
41
43
  __metadata("design:paramtypes", [typeorm_1.DataSource,
42
- scheduled_event_job_1.ScheduledEventJob,
43
- clean_scheduled_event_job_1.CleanScheduledEventJob])
44
+ scheduled_event_job_1.ScheduledEventJob])
44
45
  ], ScheduledEventSubscriber);
45
46
  //# sourceMappingURL=scheduled.event.subscriber.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scheduled.event.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/scheduled.event.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgF;AAChF,gFAA4E;AAC5E,+EAA0E;AAC1E,iFAA2E;AAC3E,qEAAgE;AAGzD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,oCAAsC;IAChF,YACqB,UAAsB,EACtB,iBAAoC,EACpC,sBAA8C;QAE/D,KAAK,EAAE,CAAC;QAJS,eAAU,GAAV,UAAU,CAAY;QACtB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAG/D,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,QAAQ;QACJ,OAAO,6CAAoB,CAAC;IAChC,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,KAAwC;QACtD,MAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,KAAwC;QACtD,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QAEhG,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC;YAAE,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/G,CAAC;CACJ,CAAA;AApBY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,yBAAe,GAAE;qCAGmB,oBAAU;QACH,uCAAiB;QACZ,kDAAsB;GAJ1D,wBAAwB,CAoBpC"}
1
+ {"version":3,"file":"scheduled.event.subscriber.js","sourceRoot":"","sources":["../../../src/system/subscribers/scheduled.event.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgF;AAChF,gFAA4E;AAC5E,+EAA0E;AAC1E,qEAAgE;AAGzD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,oCAAsC;IAChF,YACqB,UAAsB,EACtB,iBAAoC;QAErD,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAY;QACtB,sBAAiB,GAAjB,iBAAiB,CAAmB;QAGrD,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;IACN,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAwC;QACtD,MAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,KAAwC;QACtD,MAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC;CACJ,CAAA;AAxBY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,yBAAe,GAAE;qCAGmB,oBAAU;QACH,uCAAiB;GAHhD,wBAAwB,CAwBpC"}