@resolveio/server-lib 9.2.18 → 9.2.19

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 (221) hide show
  1. package/client-server-app.js +1 -55
  2. package/client-server-app.js.map +1 -1
  3. package/collections/app-status.collection.js +1 -40
  4. package/collections/app-status.collection.js.map +1 -1
  5. package/collections/app-version.collection.js +1 -40
  6. package/collections/app-version.collection.js.map +1 -1
  7. package/collections/counter.collection.js +1 -43
  8. package/collections/counter.collection.js.map +1 -1
  9. package/collections/cron-job-history.collection.js +1 -71
  10. package/collections/cron-job-history.collection.js.map +1 -1
  11. package/collections/cron-job.collection.js +1 -74
  12. package/collections/cron-job.collection.js.map +1 -1
  13. package/collections/email-history.collection.js +1 -55
  14. package/collections/email-history.collection.js.map +1 -1
  15. package/collections/email-verified.collection.js +1 -50
  16. package/collections/email-verified.collection.js.map +1 -1
  17. package/collections/file.collection.js +1 -62
  18. package/collections/file.collection.js.map +1 -1
  19. package/collections/flag.collection.js +1 -44
  20. package/collections/flag.collection.js.map +1 -1
  21. package/collections/log-method-latency.collection.js +1 -53
  22. package/collections/log-method-latency.collection.js.map +1 -1
  23. package/collections/log-subscription.collection.js +1 -57
  24. package/collections/log-subscription.collection.js.map +1 -1
  25. package/collections/log.collection.js +1 -72
  26. package/collections/log.collection.js.map +1 -1
  27. package/collections/logged-in-users.collection.js +1 -58
  28. package/collections/logged-in-users.collection.js.map +1 -1
  29. package/collections/method-call.collection.js +1 -51
  30. package/collections/method-call.collection.js.map +1 -1
  31. package/collections/method-response.collection.js +1 -55
  32. package/collections/method-response.collection.js.map +1 -1
  33. package/collections/monitor-cpu.collection.js +1 -57
  34. package/collections/monitor-cpu.collection.js.map +1 -1
  35. package/collections/monitor-https-inbound.collection.js +1 -66
  36. package/collections/monitor-https-inbound.collection.js.map +1 -1
  37. package/collections/monitor-https-outbound.collection.js +1 -74
  38. package/collections/monitor-https-outbound.collection.js.map +1 -1
  39. package/collections/monitor-memory.collection.js +1 -68
  40. package/collections/monitor-memory.collection.js.map +1 -1
  41. package/collections/monitor-mongo.collection.js +1 -62
  42. package/collections/monitor-mongo.collection.js.map +1 -1
  43. package/collections/notification.collection.js +1 -40
  44. package/collections/notification.collection.js.map +1 -1
  45. package/collections/report-builder-dashboard-builder.collection.js +1 -93
  46. package/collections/report-builder-dashboard-builder.collection.js.map +1 -1
  47. package/collections/report-builder-library.collection.js +1 -76
  48. package/collections/report-builder-library.collection.js.map +1 -1
  49. package/collections/report-builder-report.collection.js +1 -138
  50. package/collections/report-builder-report.collection.js.map +1 -1
  51. package/collections/user-group.collection.js +1 -79
  52. package/collections/user-group.collection.js.map +1 -1
  53. package/collections/user-guide.collection.js +1 -46
  54. package/collections/user-guide.collection.js.map +1 -1
  55. package/collections/user.collection.js +1 -248
  56. package/collections/user.collection.js.map +1 -1
  57. package/cron/cron.js +1 -161
  58. package/cron/cron.js.map +1 -1
  59. package/fixtures/cron-jobs.js +1 -72
  60. package/fixtures/cron-jobs.js.map +1 -1
  61. package/fixtures/init.js +1 -62
  62. package/fixtures/init.js.map +1 -1
  63. package/http/auth.js +1 -697
  64. package/http/auth.js.map +1 -1
  65. package/http/health.js +1 -10
  66. package/http/health.js.map +1 -1
  67. package/http/home.js +1 -64
  68. package/http/home.js.map +1 -1
  69. package/index.js +1 -123
  70. package/index.js.map +1 -1
  71. package/managers/cron.manager.js +1 -205
  72. package/managers/cron.manager.js.map +1 -1
  73. package/managers/method.manager.js +1 -599
  74. package/managers/method.manager.js.map +1 -1
  75. package/managers/mongo.manager.js +1 -1682
  76. package/managers/mongo.manager.js.map +1 -1
  77. package/managers/monitor.manager.js +1 -334
  78. package/managers/monitor.manager.js.map +1 -1
  79. package/managers/subscription.manager.js +1 -867
  80. package/managers/subscription.manager.js.map +1 -1
  81. package/managers/subscription.performance.js +1 -100
  82. package/managers/subscription.performance.js.map +1 -1
  83. package/methods/accounts.js +1 -224
  84. package/methods/accounts.js.map +1 -1
  85. package/methods/aws.js +1 -449
  86. package/methods/aws.js.map +1 -1
  87. package/methods/cloudconvert.js +1 -214
  88. package/methods/cloudconvert.js.map +1 -1
  89. package/methods/collections.js +1 -526
  90. package/methods/collections.js.map +1 -1
  91. package/methods/counters.js +1 -121
  92. package/methods/counters.js.map +1 -1
  93. package/methods/cron-jobs.js +1 -1284
  94. package/methods/cron-jobs.js.map +1 -1
  95. package/methods/flags.js +1 -8
  96. package/methods/flags.js.map +1 -1
  97. package/methods/logs.js +1 -370
  98. package/methods/logs.js.map +1 -1
  99. package/methods/monitor.js +1 -384
  100. package/methods/monitor.js.map +1 -1
  101. package/methods/pdf.js +1 -685
  102. package/methods/pdf.js.map +1 -1
  103. package/methods/report-builder.js +1 -826
  104. package/methods/report-builder.js.map +1 -1
  105. package/methods/support.js +1 -263
  106. package/methods/support.js.map +1 -1
  107. package/models/app-status.model.js +1 -3
  108. package/models/app-status.model.js.map +1 -1
  109. package/models/app-version.model.js +1 -3
  110. package/models/app-version.model.js.map +1 -1
  111. package/models/billing-logged-in-users.model.js +1 -3
  112. package/models/billing-logged-in-users.model.js.map +1 -1
  113. package/models/collection-document.model.js +1 -3
  114. package/models/collection-document.model.js.map +1 -1
  115. package/models/counter.model.js +1 -3
  116. package/models/counter.model.js.map +1 -1
  117. package/models/cron-job-history.model.js +1 -3
  118. package/models/cron-job-history.model.js.map +1 -1
  119. package/models/cron-job.model.js +1 -3
  120. package/models/cron-job.model.js.map +1 -1
  121. package/models/dialog.model.js +1 -3
  122. package/models/dialog.model.js.map +1 -1
  123. package/models/email-history.model.js +1 -3
  124. package/models/email-history.model.js.map +1 -1
  125. package/models/email-verified.model.js +1 -3
  126. package/models/email-verified.model.js.map +1 -1
  127. package/models/file.model.js +1 -3
  128. package/models/file.model.js.map +1 -1
  129. package/models/flag.model.js +1 -3
  130. package/models/flag.model.js.map +1 -1
  131. package/models/log-method-latency.model.js +1 -3
  132. package/models/log-method-latency.model.js.map +1 -1
  133. package/models/log-subscription.model.js +1 -3
  134. package/models/log-subscription.model.js.map +1 -1
  135. package/models/log.model.js +1 -3
  136. package/models/log.model.js.map +1 -1
  137. package/models/logged-in-users.model.js +1 -3
  138. package/models/logged-in-users.model.js.map +1 -1
  139. package/models/method-call.model.js +1 -3
  140. package/models/method-call.model.js.map +1 -1
  141. package/models/method-response.model.js +1 -3
  142. package/models/method-response.model.js.map +1 -1
  143. package/models/method.model.js +1 -3
  144. package/models/method.model.js.map +1 -1
  145. package/models/monitor-cpu.model.js +1 -3
  146. package/models/monitor-cpu.model.js.map +1 -1
  147. package/models/monitor-https-inbound.model.js +1 -3
  148. package/models/monitor-https-inbound.model.js.map +1 -1
  149. package/models/monitor-https-outbound.model.js +1 -3
  150. package/models/monitor-https-outbound.model.js.map +1 -1
  151. package/models/monitor-memory.model.js +1 -3
  152. package/models/monitor-memory.model.js.map +1 -1
  153. package/models/monitor-mongo.model.js +1 -3
  154. package/models/monitor-mongo.model.js.map +1 -1
  155. package/models/notification.model.js +1 -3
  156. package/models/notification.model.js.map +1 -1
  157. package/models/pagination.model.js +1 -23
  158. package/models/pagination.model.js.map +1 -1
  159. package/models/permission.model.js +1 -3
  160. package/models/permission.model.js.map +1 -1
  161. package/models/report-builder-dashboard-builder.model.js +1 -3
  162. package/models/report-builder-dashboard-builder.model.js.map +1 -1
  163. package/models/report-builder-library.model.js +1 -3
  164. package/models/report-builder-library.model.js.map +1 -1
  165. package/models/report-builder-report.model.js +1 -3
  166. package/models/report-builder-report.model.js.map +1 -1
  167. package/models/report-builder.model.js +1 -3
  168. package/models/report-builder.model.js.map +1 -1
  169. package/models/select-data-label.model.js +1 -3
  170. package/models/select-data-label.model.js.map +1 -1
  171. package/models/server-response.model.js +1 -3
  172. package/models/server-response.model.js.map +1 -1
  173. package/models/subscription.model.js +1 -3
  174. package/models/subscription.model.js.map +1 -1
  175. package/models/support-ticket.model.js +1 -3
  176. package/models/support-ticket.model.js.map +1 -1
  177. package/models/user-group.model.js +1 -3
  178. package/models/user-group.model.js.map +1 -1
  179. package/models/user-guide.model.js +1 -3
  180. package/models/user-guide.model.js.map +1 -1
  181. package/models/user.model.js +1 -3
  182. package/models/user.model.js.map +1 -1
  183. package/package.json +2 -1
  184. package/public_api.js +1 -78
  185. package/public_api.js.map +1 -1
  186. package/publications/app-status.js +1 -16
  187. package/publications/app-status.js.map +1 -1
  188. package/publications/app-version.js +1 -16
  189. package/publications/app-version.js.map +1 -1
  190. package/publications/cron-jobs.js +1 -32
  191. package/publications/cron-jobs.js.map +1 -1
  192. package/publications/files.js +1 -36
  193. package/publications/files.js.map +1 -1
  194. package/publications/flags.js +1 -22
  195. package/publications/flags.js.map +1 -1
  196. package/publications/logs.js +1 -90
  197. package/publications/logs.js.map +1 -1
  198. package/publications/method-calls.js +1 -16
  199. package/publications/method-calls.js.map +1 -1
  200. package/publications/method-responses.js +1 -16
  201. package/publications/method-responses.js.map +1 -1
  202. package/publications/notifications.js +1 -16
  203. package/publications/notifications.js.map +1 -1
  204. package/publications/report-builder-dashboard-builders.js +1 -42
  205. package/publications/report-builder-dashboard-builders.js.map +1 -1
  206. package/publications/report-builder-libraries.js +1 -89
  207. package/publications/report-builder-libraries.js.map +1 -1
  208. package/publications/report-builder-reports.js +1 -50
  209. package/publications/report-builder-reports.js.map +1 -1
  210. package/publications/super-admin.js +1 -16
  211. package/publications/super-admin.js.map +1 -1
  212. package/publications/user-groups.js +1 -16
  213. package/publications/user-groups.js.map +1 -1
  214. package/publications/user-guides.js +1 -16
  215. package/publications/user-guides.js.map +1 -1
  216. package/server-app.js +1 -682
  217. package/server-app.js.map +1 -1
  218. package/util/common.js +1 -498
  219. package/util/common.js.map +1 -1
  220. package/util/schema-report-builder.js +1 -452
  221. package/util/schema-report-builder.js.map +1 -1
@@ -1,249 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserVersions = exports.Users = void 0;
4
- var index_1 = require("../index");
5
- var mongo_manager_1 = require("../managers/mongo.manager");
6
- var schema = {
7
- _id: {
8
- type: String,
9
- optional: true
10
- },
11
- __v: {
12
- type: Number,
13
- optional: true
14
- },
15
- updatedAt: {
16
- type: Date,
17
- optional: true
18
- },
19
- createdAt: {
20
- type: Date,
21
- optional: true
22
- },
23
- roles: {
24
- type: Object
25
- },
26
- 'roles.super_admin': {
27
- type: Boolean
28
- },
29
- 'roles.approvals': {
30
- type: Array
31
- },
32
- 'roles.approvals.$': {
33
- type: Object
34
- },
35
- 'roles.approvals.$.type': {
36
- type: String
37
- },
38
- 'roles.approvals.$.key_1': {
39
- type: String,
40
- optional: true
41
- },
42
- 'roles.approvals.$.key_2': {
43
- type: String,
44
- optional: true
45
- },
46
- 'roles.approvals.$.key_3': {
47
- type: String,
48
- optional: true
49
- },
50
- 'roles.approvals.$.name': {
51
- type: String
52
- },
53
- 'roles.groups': {
54
- type: Array
55
- },
56
- 'roles.groups.$': {
57
- type: Object
58
- },
59
- 'roles.groups.$.name': {
60
- type: String
61
- },
62
- 'roles.groups.$.views': {
63
- type: Array
64
- },
65
- 'roles.groups.$.views.$': {
66
- type: String
67
- },
68
- 'roles.groups.$.yard': {
69
- type: String,
70
- optional: true
71
- },
72
- 'roles.notifications': {
73
- type: Array
74
- },
75
- 'roles.notifications.$': {
76
- type: String
77
- },
78
- 'roles.miscs': {
79
- type: Array
80
- },
81
- 'roles.miscs.$': {
82
- type: String
83
- },
84
- username: {
85
- type: String,
86
- optional: true
87
- },
88
- email: {
89
- type: String,
90
- optional: true
91
- },
92
- fullname: {
93
- type: String
94
- },
95
- active: {
96
- type: Boolean
97
- },
98
- phonenumber: {
99
- type: String,
100
- optional: true
101
- },
102
- readonly: {
103
- type: Boolean,
104
- optional: true
105
- },
106
- other: {
107
- type: Object,
108
- blackbox: true
109
- },
110
- settings: {
111
- type: Object,
112
- optional: true
113
- },
114
- 'settings.table_color': {
115
- type: String
116
- },
117
- 'settings.table_font_color': {
118
- type: String
119
- },
120
- 'settings.secondary_table_color': {
121
- type: String
122
- },
123
- 'settings.secondary_table_font_color': {
124
- type: String
125
- },
126
- 'settings.tertiary_table_color': {
127
- type: String
128
- },
129
- 'settings.tertiary_table_font_color': {
130
- type: String
131
- },
132
- 'settings.font_size': {
133
- type: Number
134
- },
135
- 'settings.collapsable_menu': {
136
- type: Boolean
137
- },
138
- 'settings.entries_per_page': {
139
- type: String
140
- },
141
- 'settings.warning_color': {
142
- type: String
143
- },
144
- 'settings.warning_font_color': {
145
- type: String
146
- },
147
- 'settings.warning_hover_color': {
148
- type: String
149
- },
150
- 'settings.success_color': {
151
- type: String
152
- },
153
- 'settings.success_font_color': {
154
- type: String
155
- },
156
- 'settings.success_hover_color': {
157
- type: String
158
- },
159
- 'settings.danger_color': {
160
- type: String
161
- },
162
- 'settings.danger_font_color': {
163
- type: String
164
- },
165
- 'settings.danger_hover_color': {
166
- type: String
167
- },
168
- 'settings.info_color': {
169
- type: String
170
- },
171
- 'settings.info_font_color': {
172
- type: String
173
- },
174
- 'settings.info_hover_color': {
175
- type: String
176
- },
177
- 'settings.primary_color': {
178
- type: String
179
- },
180
- 'settings.primary_font_color': {
181
- type: String
182
- },
183
- 'settings.primary_hover_color': {
184
- type: String
185
- },
186
- 'settings.secondary_color': {
187
- type: String
188
- },
189
- 'settings.secondary_font_color': {
190
- type: String
191
- },
192
- 'settings.secondary_hover_color': {
193
- type: String
194
- },
195
- 'settings.routing_preference': {
196
- type: String
197
- },
198
- 'settings.opening_route': {
199
- type: String
200
- },
201
- salt: {
202
- type: String
203
- },
204
- hash: {
205
- type: String
206
- },
207
- attempts: {
208
- type: Number
209
- },
210
- last: {
211
- type: Date,
212
- optional: true
213
- },
214
- services: {
215
- type: Object,
216
- optional: true
217
- },
218
- 'services.enrollment': {
219
- type: String,
220
- optional: true
221
- },
222
- 'services.forgot_password': {
223
- type: String,
224
- optional: true
225
- },
226
- 'services.reset_password': {
227
- type: String,
228
- optional: true
229
- },
230
- };
231
- exports.Users = null;
232
- exports.UserVersions = null;
233
- initializeCollection();
234
- function initializeCollection() {
235
- if (index_1.ResolveIOServer && index_1.ResolveIOServer.getMainDB()) {
236
- var model = new mongo_manager_1.Model('users', schema, true, true);
237
- exports.Users = model.collection_main;
238
- exports.Users.createIndex({ fullname: 1 });
239
- exports.Users.createIndex({ active: 1 });
240
- exports.UserVersions = model.collection_version;
241
- }
242
- else {
243
- setTimeout(function () {
244
- initializeCollection();
245
- }, 1);
246
- }
247
- }
248
-
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UserVersions=exports.Users=void 0;var index_1=require("../index"),mongo_manager_1=require("../managers/mongo.manager"),schema={_id:{type:String,optional:!0},__v:{type:Number,optional:!0},updatedAt:{type:Date,optional:!0},createdAt:{type:Date,optional:!0},roles:{type:Object},"roles.super_admin":{type:Boolean},"roles.approvals":{type:Array},"roles.approvals.$":{type:Object},"roles.approvals.$.type":{type:String},"roles.approvals.$.key_1":{type:String,optional:!0},"roles.approvals.$.key_2":{type:String,optional:!0},"roles.approvals.$.key_3":{type:String,optional:!0},"roles.approvals.$.name":{type:String},"roles.groups":{type:Array},"roles.groups.$":{type:Object},"roles.groups.$.name":{type:String},"roles.groups.$.views":{type:Array},"roles.groups.$.views.$":{type:String},"roles.groups.$.yard":{type:String,optional:!0},"roles.notifications":{type:Array},"roles.notifications.$":{type:String},"roles.miscs":{type:Array},"roles.miscs.$":{type:String},username:{type:String,optional:!0},email:{type:String,optional:!0},fullname:{type:String},active:{type:Boolean},phonenumber:{type:String,optional:!0},readonly:{type:Boolean,optional:!0},other:{type:Object,blackbox:!0},settings:{type:Object,optional:!0},"settings.table_color":{type:String},"settings.table_font_color":{type:String},"settings.secondary_table_color":{type:String},"settings.secondary_table_font_color":{type:String},"settings.tertiary_table_color":{type:String},"settings.tertiary_table_font_color":{type:String},"settings.font_size":{type:Number},"settings.collapsable_menu":{type:Boolean},"settings.entries_per_page":{type:String},"settings.warning_color":{type:String},"settings.warning_font_color":{type:String},"settings.warning_hover_color":{type:String},"settings.success_color":{type:String},"settings.success_font_color":{type:String},"settings.success_hover_color":{type:String},"settings.danger_color":{type:String},"settings.danger_font_color":{type:String},"settings.danger_hover_color":{type:String},"settings.info_color":{type:String},"settings.info_font_color":{type:String},"settings.info_hover_color":{type:String},"settings.primary_color":{type:String},"settings.primary_font_color":{type:String},"settings.primary_hover_color":{type:String},"settings.secondary_color":{type:String},"settings.secondary_font_color":{type:String},"settings.secondary_hover_color":{type:String},"settings.routing_preference":{type:String},"settings.opening_route":{type:String},salt:{type:String},hash:{type:String},attempts:{type:Number},last:{type:Date,optional:!0},services:{type:Object,optional:!0},"services.enrollment":{type:String,optional:!0},"services.forgot_password":{type:String,optional:!0},"services.reset_password":{type:String,optional:!0}};function initializeCollection(){if(index_1.ResolveIOServer&&index_1.ResolveIOServer.getMainDB()){var e=new mongo_manager_1.Model("users",schema,!0,!0);exports.Users=e.collection_main,exports.Users.createIndex({fullname:1}),exports.Users.createIndex({active:1}),exports.UserVersions=e.collection_version}else setTimeout((function(){initializeCollection()}),1)}exports.Users=null,exports.UserVersions=null,initializeCollection();
249
2
  //# sourceMappingURL=user.collection.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/user.collection.ts"],"names":[],"mappings":";;;AAAA,kCAA2C;AAC3C,2DAAkE;AAGlE,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,KAAK,EAAE;QACN,IAAI,EAAE,MAAM;KACZ;IACD,mBAAmB,EAAE;QACpB,IAAI,EAAE,OAAO;KACb;IACD,iBAAiB,EAAE;QAClB,IAAI,EAAE,KAAK;KACX;IACD,mBAAmB,E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,EAAE,CAAC,EAAC,CAAC,CAAC;QACjC,aAAK,CAAC,WAAW,CAAC,EAAC,MAAM,EAAE,CAAC,EAAC,CAAC,CAAC;QAC/B,oBAAY,GAA8B,KAAK,CAAC,kBAAkB,CAAC;KACnE;SACI;QACJ,UAAU,CAAC;YACV,oBAAoB,EAAE,CAAC;QACxB,CAAC,EAAE,CAAC,CAAC,CAAC;KACN;AACF,CAAC","file":"user.collection.js","sourcesContent":["import { ResolveIOServer } from '../index';\nimport { Model, UserCollection } from '../managers/mongo.manager';\nimport { UserModel } from '../models/user.model';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\troles: {\n\t\ttype: Object\n\t},\n\t'roles.super_admin': {\n\t\ttype: Boolean\n\t},\n\t'roles.approvals': {\n\t\ttype: Array\n\t},\n\t'roles.approvals.$': {\n\t\ttype: Object\n\t},\n\t'roles.approvals.$.type': {\n\t\ttype: String\n\t},\n\t'roles.approvals.$.key_1': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.approvals.$.key_2': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.approvals.$.key_3': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.approvals.$.name': {\n\t\ttype: String\n\t},\n\t'roles.groups': {\n\t\ttype: Array\n\t},\n\t'roles.groups.$': {\n\t\ttype: Object\n\t},\n\t'roles.groups.$.name': {\n\t\ttype: String\n\t},\n\t'roles.groups.$.views': {\n\t\ttype: Array\n\t},\n\t'roles.groups.$.views.$': {\n\t\ttype: String\n\t},\n\t'roles.groups.$.yard': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.notifications': {\n\t\ttype: Array\n\t},\n\t'roles.notifications.$': {\n\t\ttype: String\n\t},\n\t'roles.miscs': {\n\t\ttype: Array\n\t},\n\t'roles.miscs.$': {\n\t\ttype: String\n\t},\n\tusername: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\temail: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tfullname: {\n\t\ttype: String\n\t},\n\tactive: {\n\t\ttype: Boolean\n\t},\n\tphonenumber: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\treadonly: {\n\t\ttype: Boolean,\n\t\toptional: true\n\t},\n\tother: {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tsettings: {\n\t\ttype: Object,\n\t\toptional: true\n\t},\n\t'settings.table_color': {\n\t\ttype: String\n\t},\n\t'settings.table_font_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_table_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_table_font_color': {\n\t\ttype: String\n\t},\n\t'settings.tertiary_table_color': {\n\t\ttype: String\n\t},\n\t'settings.tertiary_table_font_color': {\n\t\ttype: String\n\t},\n\t'settings.font_size': {\n\t\ttype: Number\n\t},\n\t'settings.collapsable_menu': {\n\t\ttype: Boolean\n\t},\n\t'settings.entries_per_page': {\n\t\ttype: String\n\t},\n\t'settings.warning_color': {\n\t\ttype: String\n\t},\n\t'settings.warning_font_color': {\n\t\ttype: String\n\t},\n\t'settings.warning_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.success_color': {\n\t\ttype: String\n\t},\n\t'settings.success_font_color': {\n\t\ttype: String\n\t},\n\t'settings.success_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.danger_color': {\n\t\ttype: String\n\t},\n\t'settings.danger_font_color': {\n\t\ttype: String\n\t},\n\t'settings.danger_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.info_color': {\n\t\ttype: String\n\t},\n\t'settings.info_font_color': {\n\t\ttype: String\n\t},\n\t'settings.info_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.primary_color': {\n\t\ttype: String\n\t},\n\t'settings.primary_font_color': {\n\t\ttype: String\n\t},\n\t'settings.primary_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_font_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.routing_preference': {\n\t\ttype: String\n\t},\n\t'settings.opening_route': {\n\t\ttype: String\n\t},\n\tsalt: {\n\t\ttype: String\n\t},\n\thash: {\n\t\ttype: String\n\t},\n\tattempts: {\n\t\ttype: Number\n\t},\n\tlast: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tservices: {\n\t\ttype: Object,\n\t\toptional: true\n\t},\n\t'services.enrollment': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.forgot_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.reset_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n};\n\nexport let Users: UserCollection<UserModel> = null;\nexport let UserVersions: UserCollection<UserModel> = null;\n\ninitializeCollection();\n\nfunction initializeCollection() {\n\tif (ResolveIOServer && ResolveIOServer.getMainDB()) {\n\t\tconst model = new Model<UserModel>('users', schema, true, true);\n\t\tUsers = <UserCollection<UserModel>>model.collection_main;\n\t\tUsers.createIndex({fullname: 1});\n\t\tUsers.createIndex({active: 1});\n\t\tUserVersions = <UserCollection<UserModel>>model.collection_version;\n\t}\n\telse {\n\t\tsetTimeout(() => {\n\t\t\tinitializeCollection();\n\t\t}, 1);\n\t}\n}"]}
1
+ {"version":3,"sources":["../../src/collections/user.collection.ts"],"names":["index_1","require","mongo_manager_1","schema","_id","type","String","optional","__v","Number","updatedAt","Date","createdAt","roles","Object","roles.super_admin","Boolean","roles.approvals","Array","roles.approvals.$","roles.approvals.$.type","roles.approvals.$.key_1","roles.approvals.$.key_2","roles.approvals.$.key_3","roles.approvals.$.name","roles.groups","roles.groups.$","roles.groups.$.name","roles.groups.$.views","roles.groups.$.views.$","roles.groups.$.yard","roles.notifications","roles.notifications.$","roles.miscs","roles.miscs.$","username","email","fullname","active","phonenumber","readonly","other","blackbox","settings","settings.table_color","settings.table_font_color","settings.secondary_table_color","settings.secondary_table_font_color","settings.tertiary_table_color","settings.tertiary_table_font_color","settings.font_size","settings.collapsable_menu","settings.entries_per_page","settings.warning_color","settings.warning_font_color","settings.warning_hover_color","settings.success_color","settings.success_font_color","settings.success_hover_color","settings.danger_color","settings.danger_font_color","settings.danger_hover_color","settings.info_color","settings.info_font_color","settings.info_hover_color","settings.primary_color","settings.primary_font_color","settings.primary_hover_color","settings.secondary_color","settings.secondary_font_color","settings.secondary_hover_color","settings.routing_preference","settings.opening_route","salt","hash","attempts","last","services","services.enrollment","services.forgot_password","services.reset_password","initializeCollection","ResolveIOServer","getMainDB","model","Model","exports","Users","collection_main","createIndex","UserVersions","collection_version","setTimeout"],"mappings":"8GAAA,IAAAA,QAAAC,QAAA,YACAC,gBAAAD,QAAA,6BAGIE,OAAc,CACjBC,IAAK,CACJC,KAAMC,OACNC,UAAU,GAEXC,IAAK,CACJH,KAAMI,OACNF,UAAU,GAEXG,UAAW,CACVL,KAAMM,KACNJ,UAAU,GAEXK,UAAW,CACVP,KAAMM,KACNJ,UAAU,GAEXM,MAAO,CACNR,KAAMS,QAEPC,oBAAqB,CACpBV,KAAMW,SAEPC,kBAAmB,CAClBZ,KAAMa,OAEPC,oBAAqB,CACpBd,KAAMS,QAEPM,yBAA0B,CACzBf,KAAMC,QAEPe,0BAA2B,CAC1BhB,KAAMC,OACNC,UAAU,GAEXe,0BAA2B,CAC1BjB,KAAMC,OACNC,UAAU,GAEXgB,0BAA2B,CAC1BlB,KAAMC,OACNC,UAAU,GAEXiB,yBAA0B,CACzBnB,KAAMC,QAEPmB,eAAgB,CACfpB,KAAMa,OAEPQ,iBAAkB,CACjBrB,KAAMS,QAEPa,sBAAuB,CACtBtB,KAAMC,QAEPsB,uBAAwB,CACvBvB,KAAMa,OAEPW,yBAA0B,CACzBxB,KAAMC,QAEPwB,sBAAuB,CACtBzB,KAAM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AAMC,QAEP8D,2BAA4B,CAC3B/D,KAAMC,QAEP+D,gCAAiC,CAChChE,KAAMC,QAEPgE,iCAAkC,CACjCjE,KAAMC,QAEPiE,8BAA+B,CAC9BlE,KAAMC,QAEPkE,yBAA0B,CACzBnE,KAAMC,QAEPmE,KAAM,CACLpE,KAAMC,QAEPoE,KAAM,CACLrE,KAAMC,QAEPqE,SAAU,CACTtE,KAAMI,QAEPmE,KAAM,CACLvE,KAAMM,KACNJ,UAAU,GAEXsE,SAAU,CACTxE,KAAMS,OACNP,UAAU,GAEXuE,sBAAuB,CACtBzE,KAAMC,OACNC,UAAU,GAEXwE,2BAA4B,CAC3B1E,KAAMC,OACNC,UAAU,GAEXyE,0BAA2B,CAC1B3E,KAAMC,OACNC,UAAU,IASZ,SAAS0E,uBACR,GAAIjF,QAAAkF,iBAAmBlF,QAAAkF,gBAAgBC,YAAa,CACnD,IAAMC,EAAQ,IAAIlF,gBAAAmF,MAAiB,QAASlF,QAAQ,GAAM,GAC1DmF,QAAAC,MAAmCH,EAAMI,gBACzCF,QAAAC,MAAME,YAAY,CAACpD,SAAU,IAC7BiD,QAAAC,MAAME,YAAY,CAACnD,OAAQ,IAC3BgD,QAAAI,aAA0CN,EAAMO,wBAGhDC,YAAW,WACVX,yBACE,GAhBMK,QAAAC,MAAmC,KACnCD,QAAAI,aAA0C,KAErDT","file":"user.collection.js","sourcesContent":["import { ResolveIOServer } from '../index';\nimport { Model, UserCollection } from '../managers/mongo.manager';\nimport { UserModel } from '../models/user.model';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\troles: {\n\t\ttype: Object\n\t},\n\t'roles.super_admin': {\n\t\ttype: Boolean\n\t},\n\t'roles.approvals': {\n\t\ttype: Array\n\t},\n\t'roles.approvals.$': {\n\t\ttype: Object\n\t},\n\t'roles.approvals.$.type': {\n\t\ttype: String\n\t},\n\t'roles.approvals.$.key_1': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.approvals.$.key_2': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.approvals.$.key_3': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.approvals.$.name': {\n\t\ttype: String\n\t},\n\t'roles.groups': {\n\t\ttype: Array\n\t},\n\t'roles.groups.$': {\n\t\ttype: Object\n\t},\n\t'roles.groups.$.name': {\n\t\ttype: String\n\t},\n\t'roles.groups.$.views': {\n\t\ttype: Array\n\t},\n\t'roles.groups.$.views.$': {\n\t\ttype: String\n\t},\n\t'roles.groups.$.yard': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.notifications': {\n\t\ttype: Array\n\t},\n\t'roles.notifications.$': {\n\t\ttype: String\n\t},\n\t'roles.miscs': {\n\t\ttype: Array\n\t},\n\t'roles.miscs.$': {\n\t\ttype: String\n\t},\n\tusername: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\temail: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tfullname: {\n\t\ttype: String\n\t},\n\tactive: {\n\t\ttype: Boolean\n\t},\n\tphonenumber: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\treadonly: {\n\t\ttype: Boolean,\n\t\toptional: true\n\t},\n\tother: {\n\t\ttype: Object,\n\t\tblackbox: true\n\t},\n\tsettings: {\n\t\ttype: Object,\n\t\toptional: true\n\t},\n\t'settings.table_color': {\n\t\ttype: String\n\t},\n\t'settings.table_font_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_table_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_table_font_color': {\n\t\ttype: String\n\t},\n\t'settings.tertiary_table_color': {\n\t\ttype: String\n\t},\n\t'settings.tertiary_table_font_color': {\n\t\ttype: String\n\t},\n\t'settings.font_size': {\n\t\ttype: Number\n\t},\n\t'settings.collapsable_menu': {\n\t\ttype: Boolean\n\t},\n\t'settings.entries_per_page': {\n\t\ttype: String\n\t},\n\t'settings.warning_color': {\n\t\ttype: String\n\t},\n\t'settings.warning_font_color': {\n\t\ttype: String\n\t},\n\t'settings.warning_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.success_color': {\n\t\ttype: String\n\t},\n\t'settings.success_font_color': {\n\t\ttype: String\n\t},\n\t'settings.success_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.danger_color': {\n\t\ttype: String\n\t},\n\t'settings.danger_font_color': {\n\t\ttype: String\n\t},\n\t'settings.danger_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.info_color': {\n\t\ttype: String\n\t},\n\t'settings.info_font_color': {\n\t\ttype: String\n\t},\n\t'settings.info_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.primary_color': {\n\t\ttype: String\n\t},\n\t'settings.primary_font_color': {\n\t\ttype: String\n\t},\n\t'settings.primary_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_font_color': {\n\t\ttype: String\n\t},\n\t'settings.secondary_hover_color': {\n\t\ttype: String\n\t},\n\t'settings.routing_preference': {\n\t\ttype: String\n\t},\n\t'settings.opening_route': {\n\t\ttype: String\n\t},\n\tsalt: {\n\t\ttype: String\n\t},\n\thash: {\n\t\ttype: String\n\t},\n\tattempts: {\n\t\ttype: Number\n\t},\n\tlast: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tservices: {\n\t\ttype: Object,\n\t\toptional: true\n\t},\n\t'services.enrollment': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.forgot_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.reset_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n};\n\nexport let Users: UserCollection<UserModel> = null;\nexport let UserVersions: UserCollection<UserModel> = null;\n\ninitializeCollection();\n\nfunction initializeCollection() {\n\tif (ResolveIOServer && ResolveIOServer.getMainDB()) {\n\t\tconst model = new Model<UserModel>('users', schema, true, true);\n\t\tUsers = <UserCollection<UserModel>>model.collection_main;\n\t\tUsers.createIndex({fullname: 1});\n\t\tUsers.createIndex({active: 1});\n\t\tUserVersions = <UserCollection<UserModel>>model.collection_version;\n\t}\n\telse {\n\t\tsetTimeout(() => {\n\t\t\tinitializeCollection();\n\t\t}, 1);\n\t}\n}"]}
package/cron/cron.js CHANGED
@@ -1,162 +1,2 @@
1
- var CronJobPackage = require('cron').CronJob;
2
- function CrontabManager(key, tab, task, options) {
3
- this.jobs = {};
4
- if (key && tab && task) {
5
- this.add(key, tab, task, options);
6
- }
7
- }
8
- CrontabManager.prototype.getJob = function (key) {
9
- return this.jobs[key];
10
- };
11
- CrontabManager.prototype.getJobs = function () {
12
- return Object.keys(this.jobs);
13
- };
14
- CrontabManager.prototype.add = function (key, tab, task, options) {
15
- if ((typeof tab === 'string' || tab instanceof Date) && typeof key === 'string' && task instanceof Function) {
16
- options = combineOptions(tab, task, options);
17
- try {
18
- if (this.jobs[key]) {
19
- this.deleteJob(key);
20
- console.warn(key + " already existed and was deleted from the manager...");
21
- }
22
- this.jobs[key] = new CronJobPackage(options);
23
- }
24
- catch (fooBaredByUser) {
25
- console.error("crontab: " + tab + " possibly not valid, job " + key + " not started..." + fooBaredByUser.message);
26
- }
27
- }
28
- else {
29
- console.warn("couldn't add: " + key + " improper arguments");
30
- }
31
- };
32
- CrontabManager.prototype.update = function () {
33
- if (arguments.length === 2) {
34
- if (typeof arguments[1] === 'string' || arguments[1] instanceof Date) {
35
- updateTab.call(this, arguments[0], arguments[1]);
36
- }
37
- else if (arguments[1] instanceof Function) {
38
- updateTask.call(this, arguments[0], arguments[1]);
39
- }
40
- }
41
- else if (arguments.length === 3) {
42
- updateTab.call(this, arguments[0], arguments[1]);
43
- updateTask.call(this, arguments[0], arguments[2]);
44
- }
45
- else {
46
- console.error("incorrect number of arguents passed to update.. won't update.. " + arguments[0]);
47
- }
48
- };
49
- CrontabManager.prototype.deleteJob = function (key) {
50
- try {
51
- this.jobs[key].stop();
52
- delete this.jobs[key];
53
- }
54
- catch (err) {
55
- console.error("error in trying to stop job: " + key + ": " + err);
56
- }
57
- };
58
- CrontabManager.prototype.start = function (key) {
59
- try {
60
- if (this.jobs[key].running) {
61
- console.warn(key + " job already running");
62
- }
63
- else {
64
- this.jobs[key].start();
65
- }
66
- }
67
- catch (err) {
68
- console.error("couldn't start job: " + key + ": " + err);
69
- }
70
- };
71
- CrontabManager.prototype.stop = function (key) {
72
- try {
73
- if (!this.jobs[key].running) {
74
- console.warn(key + " job already stopped");
75
- }
76
- else {
77
- this.jobs[key].stop();
78
- }
79
- }
80
- catch (err) {
81
- console.error("couldn't stop job: " + key + ": " + err);
82
- }
83
- };
84
- CrontabManager.prototype.stopAll = function () {
85
- // tslint:disable-next-line:forin
86
- for (var jobKey in this.jobs) {
87
- try {
88
- this.jobs[jobKey].stop();
89
- }
90
- catch (err) {
91
- }
92
- }
93
- };
94
- CrontabManager.prototype.toString = function () {
95
- var manString = '{\n';
96
- // tslint:disable-next-line:forin
97
- for (var jobKey in this.jobs) {
98
- manString += "'" + jobKey + "': " + this.jobs[jobKey].cronTime.source + ": " + this.jobs[jobKey]._callbacks[0] + ": " + (this.jobs[jobKey].running ? 'Running' : 'Stopped');
99
- }
100
- manString += '\n}';
101
- return manString;
102
- };
103
- CrontabManager.prototype.listCrons = function () {
104
- var manString = '{\n';
105
- // tslint:disable-next-line:forin
106
- for (var jobKey in this.jobs) {
107
- manString += "'" + jobKey + "': " + this.jobs[jobKey].cronTime.source + " status: " + (this.jobs[jobKey].running ? 'Running' : 'Stopped') + " \n";
108
- }
109
- manString += '\n}';
110
- return manString;
111
- };
112
- CrontabManager.prototype.exists = function (tabKey) {
113
- if (this.jobs[tabKey]) {
114
- return true;
115
- }
116
- return false;
117
- };
118
- function combineOptions(tab, task, options) {
119
- var newOpts = {};
120
- newOpts['cronTime'] = tab;
121
- newOpts['onTick'] = task;
122
- if (options instanceof Object) {
123
- // might overwrite... please be careful.
124
- // tslint:disable-next-line:forin
125
- for (var optionKey in options) {
126
- newOpts[optionKey] = options[optionKey];
127
- }
128
- }
129
- return newOpts;
130
- }
131
- function updateTab(key, cronstring) {
132
- try {
133
- var running = this.jobs[key].running;
134
- this.jobs[key].stop();
135
- if (typeof cronstring === 'string' || cronstring instanceof Date) {
136
- this.jobs[key] = new CronJobPackage(cronstring, this.jobs[key]._callbacks[0], this.jobs[key].onComplete, running, this.jobs[key].zone);
137
- }
138
- else {
139
- throw new Error("The cron definition passed was not a string or a Date object! " + key + " was stopped and not updated");
140
- }
141
- }
142
- catch (tabErr) {
143
- console.error("error updating tab: " + key + " - " + tabErr.message);
144
- }
145
- }
146
- function updateTask(key, task) {
147
- try {
148
- var running = this.jobs[key].running;
149
- this.jobs[key].stop();
150
- if (!(task instanceof Function)) {
151
- console.error("can't update with something that is not a function: " + typeof (task));
152
- return;
153
- }
154
- this.jobs[key] = new CronJobPackage(this.jobs[key].cronTime.source, task, this.jobs[key].onComplete, running, this.jobs[key].zone);
155
- }
156
- catch (tabErr) {
157
- console.error("error updating task: " + key + " - " + tabErr.message);
158
- }
159
- }
160
- module.exports = CrontabManager;
161
-
1
+ var CronJobPackage=require("cron").CronJob;function CrontabManager(o,t,n,r){this.jobs={},o&&t&&n&&this.add(o,t,n,r)}function combineOptions(o,t,n){var r={};if(r.cronTime=o,r.onTick=t,n instanceof Object)for(var e in n)r[e]=n[e];return r}function updateTab(o,t){try{var n=this.jobs[o].running;if(this.jobs[o].stop(),!("string"==typeof t||t instanceof Date))throw new Error("The cron definition passed was not a string or a Date object! "+o+" was stopped and not updated");this.jobs[o]=new CronJobPackage(t,this.jobs[o]._callbacks[0],this.jobs[o].onComplete,n,this.jobs[o].zone)}catch(t){console.error("error updating tab: "+o+" - "+t.message)}}function updateTask(o,t){try{var n=this.jobs[o].running;if(this.jobs[o].stop(),!(t instanceof Function))return void console.error("can't update with something that is not a function: "+typeof t);this.jobs[o]=new CronJobPackage(this.jobs[o].cronTime.source,t,this.jobs[o].onComplete,n,this.jobs[o].zone)}catch(t){console.error("error updating task: "+o+" - "+t.message)}}CrontabManager.prototype.getJob=function(o){return this.jobs[o]},CrontabManager.prototype.getJobs=function(){return Object.keys(this.jobs)},CrontabManager.prototype.add=function(o,t,n,r){if(("string"==typeof t||t instanceof Date)&&"string"==typeof o&&n instanceof Function){r=combineOptions(t,n,r);try{this.jobs[o]&&(this.deleteJob(o),console.warn(o+" already existed and was deleted from the manager...")),this.jobs[o]=new CronJobPackage(r)}catch(n){console.error("crontab: "+t+" possibly not valid, job "+o+" not started..."+n.message)}}else console.warn("couldn't add: "+o+" improper arguments")},CrontabManager.prototype.update=function(){2===arguments.length?"string"==typeof arguments[1]||arguments[1]instanceof Date?updateTab.call(this,arguments[0],arguments[1]):arguments[1]instanceof Function&&updateTask.call(this,arguments[0],arguments[1]):3===arguments.length?(updateTab.call(this,arguments[0],arguments[1]),updateTask.call(this,arguments[0],arguments[2])):console.error("incorrect number of arguents passed to update.. won't update.. "+arguments[0])},CrontabManager.prototype.deleteJob=function(o){try{this.jobs[o].stop(),delete this.jobs[o]}catch(t){console.error("error in trying to stop job: "+o+": "+t)}},CrontabManager.prototype.start=function(o){try{this.jobs[o].running?console.warn(o+" job already running"):this.jobs[o].start()}catch(t){console.error("couldn't start job: "+o+": "+t)}},CrontabManager.prototype.stop=function(o){try{this.jobs[o].running?this.jobs[o].stop():console.warn(o+" job already stopped")}catch(t){console.error("couldn't stop job: "+o+": "+t)}},CrontabManager.prototype.stopAll=function(){for(var o in this.jobs)try{this.jobs[o].stop()}catch(o){}},CrontabManager.prototype.toString=function(){var o="{\n";for(var t in this.jobs)o+="'"+t+"': "+this.jobs[t].cronTime.source+": "+this.jobs[t]._callbacks[0]+": "+(this.jobs[t].running?"Running":"Stopped");return o+="\n}"},CrontabManager.prototype.listCrons=function(){var o="{\n";for(var t in this.jobs)o+="'"+t+"': "+this.jobs[t].cronTime.source+" status: "+(this.jobs[t].running?"Running":"Stopped")+" \n";return o+="\n}"},CrontabManager.prototype.exists=function(o){return!!this.jobs[o]},module.exports=CrontabManager;
162
2
  //# sourceMappingURL=cron.js.map
package/cron/cron.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cron/cron.ts"],"names":[],"mappings":"AAAA,IAAI,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;AAE7C,SAAS,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO;IAC9C,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACf,IAAI,GAAG,IAAI,GAAG,IAAI,IAAI,EAAE;QACvB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;KAClC;AAEF,CAAC;AAED,cAAc,CAAC,SAAS,CAAC,MAAM,GAAG,UAAS,GAAG;IAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,cAAc,CAAC,SAAS,CAAC,OAAO,GAAG;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,cAAc,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO;IAC9D,IAAI,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,YAAY,IAAI,CAAC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,IAAI,YAAY,QAAQ,EAAE;QAC5G,OAAO,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAI;YACH,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACnB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACpB,OAAO,CAA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AAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAEtB,IAAI,CAAC,CAAC,IAAI,YAAY,QAAQ,CAAC,EAAE;YAChC,OAAO,CAAC,KAAK,CAAC,yDAAuD,OAAM,CAAC,IAAI,CAAG,CAAC,CAAC;YACrF,OAAO;SACP;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;KAGpI;IACD,OAAO,MAAM,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,0BAAwB,GAAG,YAAO,MAAM,CAAC,OAAS,CAAC,CAAC;KAClE;AACF,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC","file":"cron.js","sourcesContent":["let CronJobPackage = require('cron').CronJob;\n\nfunction CrontabManager(key, tab, task, options) {\n\tthis.jobs = {};\n\tif (key && tab && task) {\n\t\tthis.add(key, tab, task, options);\n\t}\n\n}\n\nCrontabManager.prototype.getJob = function(key) {\n\treturn this.jobs[key];\n};\n\nCrontabManager.prototype.getJobs = function() {\n\treturn Object.keys(this.jobs);\n};\n\nCrontabManager.prototype.add = function(key, tab, task, options) {\n\tif ((typeof tab === 'string' || tab instanceof Date) && typeof key === 'string' && task instanceof Function) {\n\t\toptions = combineOptions(tab, task, options);\n\t\ttry {\n\t\t\tif (this.jobs[key]) {\n\t\t\t\tthis.deleteJob(key);\n\t\t\t\tconsole.warn(`${key} already existed and was deleted from the manager...`);\n\t\t\t}\n\t\t\t\n\t\t\tthis.jobs[key] = new CronJobPackage(options);\n\t\t} \n\t\tcatch (fooBaredByUser) {\n\t\t\tconsole.error(`crontab: ${tab} possibly not valid, job ${key} not started...${fooBaredByUser.message}`);\n\t\t}\n\t}\n\telse {\n\t\tconsole.warn(`couldn't add: ${key} improper arguments`);\n\t}\n};\n\nCrontabManager.prototype.update = function() {\n\tif (arguments.length === 2) {\n\t\tif (typeof arguments[1] === 'string' || arguments[1] instanceof Date) {\n\t\t\tupdateTab.call(this, arguments[0], arguments[1]);\n\t\t}\n\t\telse if (arguments[1] instanceof Function) {\n\t\t\tupdateTask.call(this, arguments[0], arguments[1]);\n\t\t}\n\t} \n\telse if (arguments.length === 3) {\n\t\tupdateTab.call(this, arguments[0], arguments[1]);\n\t\tupdateTask.call(this, arguments[0], arguments[2]);\n\t}\n\telse {\n\t\tconsole.error(`incorrect number of arguents passed to update.. won't update.. ${arguments[0]}`);\n\t}\n};\n\nCrontabManager.prototype.deleteJob = function(key) {\n\ttry {\n\t\tthis.jobs[key].stop();\n\t\tdelete this.jobs[key];\n\t}\n\tcatch (err) { \n\t\tconsole.error(`error in trying to stop job: ${key}: ${err}`);\n\t}\n};\n\nCrontabManager.prototype.start = function(key) {\n\ttry {\n\t\tif (this.jobs[key].running) {\n\t\t\tconsole.warn(`${key} job already running`);\n\t\t}\n\t\telse {\n\t\t\tthis.jobs[key].start();\n\t\t}\n\t}\n\tcatch (err) {\n\t\tconsole.error(`couldn't start job: ${key}: ${err}`);\n\t}\n};\n\nCrontabManager.prototype.stop = function(key) {\n\ttry {\n\t\tif (! this.jobs[key].running ) {\n\t\t\tconsole.warn(`${key} job already stopped`);\n\t\t}\n\t\telse {\n\t\t\tthis.jobs[key].stop();\n\t\t}\n\t}\n\tcatch (err) {\n\t\tconsole.error(`couldn't stop job: ${key}: ${err}`);\n\t}\n};\n\nCrontabManager.prototype.stopAll = function() {\n\t// tslint:disable-next-line:forin\n\tfor (let jobKey in this.jobs) {\n\t\ttry {\n\t\t\tthis.jobs[jobKey].stop();\n\t\t}\n\t\tcatch (err) {\n\n\t\t}\n\t}\n};\n\nCrontabManager.prototype.toString = function() {\n\tlet manString = '{\\n';\n\t// tslint:disable-next-line:forin\n\tfor (let jobKey in this.jobs) {\n\n\t\tmanString += `'${jobKey}': ${this.jobs[jobKey].cronTime.source}: ${this.jobs[jobKey]._callbacks[0]}: ${this.jobs[jobKey].running ? 'Running' : 'Stopped'}`;\n\t}\n\tmanString += '\\n}';\n\treturn manString;\n};\n\nCrontabManager.prototype.listCrons = function() {\n\tlet manString = '{\\n';\n\t// tslint:disable-next-line:forin\n\tfor (let jobKey in this.jobs) {\n\t\tmanString += `'${jobKey}': ${this.jobs[jobKey].cronTime.source} status: ${this.jobs[jobKey].running ? 'Running' : 'Stopped'} \\n`;\n\t}\n\tmanString += '\\n}';\n\treturn manString;\n};\n\nCrontabManager.prototype.exists = function(tabKey) {\n\tif (this.jobs[tabKey]) {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\nfunction combineOptions(tab, task, options) {\n\tlet newOpts = {};\n\tnewOpts['cronTime'] = tab; \n\tnewOpts['onTick'] = task;\n\n\tif (options instanceof Object) {\n\t\t// might overwrite... please be careful.\n\t\t// tslint:disable-next-line:forin\n\t\tfor (let optionKey in options) {\n\t\t\tnewOpts[optionKey] = options[optionKey];\n\t\t}\n\t}\n\treturn newOpts;\n}\n\nfunction updateTab(key, cronstring) {\n\n\ttry {\n\t\tlet running = this.jobs[key].running;\n\t\tthis.jobs[key].stop();\n\n\t\tif (typeof cronstring === 'string' || cronstring instanceof Date) {\n\t\t\tthis.jobs[key] = new CronJobPackage(cronstring, this.jobs[key]._callbacks[0], this.jobs[key].onComplete, running, this.jobs[key].zone);\n\t\t}\n\t\telse {\n\t\t\tthrow new Error(`The cron definition passed was not a string or a Date object! ${key} was stopped and not updated`);\n\t\t}\n\t}\n\tcatch (tabErr) {\n\t\tconsole.error(`error updating tab: ${key} - ${tabErr.message}`);\n\t}\n}\n\nfunction updateTask(key, task) {\n\ttry {\n\t\tlet running = this.jobs[key].running;\n\t\tthis.jobs[key].stop();\n\n\t\tif (!(task instanceof Function)) {\n\t\t\tconsole.error(`can't update with something that is not a function: ${typeof(task)}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.jobs[key] = new CronJobPackage(this.jobs[key].cronTime.source, task, this.jobs[key].onComplete, running, this.jobs[key].zone);\n\n\n\t} \n\tcatch (tabErr) {\n\t\tconsole.error(`error updating task: ${key} - ${tabErr.message}`);\n\t}\n}\n\nmodule.exports = CrontabManager;\n"]}
1
+ {"version":3,"sources":["../../src/cron/cron.ts"],"names":["CronJobPackage","require","CronJob","CrontabManager","key","tab","task","options","this","jobs","add","combineOptions","newOpts","Object","optionKey","updateTab","cronstring","running","stop","Date","Error","_callbacks","onComplete","zone","tabErr","console","error","message","updateTask","Function","cronTime","source","prototype","getJob","getJobs","keys","deleteJob","warn","fooBaredByUser","update","arguments","length","call","err","start","stopAll","jobKey","toString","manString","listCrons","exists","tabKey","module","exports"],"mappings":"AAAA,IAAIA,eAAiBC,QAAQ,QAAQC,QAErC,SAASC,eAAeC,EAAKC,EAAKC,EAAMC,GACvCC,KAAKC,KAAO,GACRL,GAAOC,GAAOC,GACjBE,KAAKE,IAAIN,EAAKC,EAAKC,EAAMC,GAkI3B,SAASI,eAAeN,EAAKC,EAAMC,GAClC,IAAIK,EAAU,GAId,GAHAA,EAAkB,SAAIP,EACtBO,EAAgB,OAAIN,EAEhBC,aAAmBM,OAGtB,IAAK,IAAIC,KAAaP,EACrBK,EAAQE,GAAaP,EAAQO,GAG/B,OAAOF,EAGR,SAASG,UAAUX,EAAKY,GAEvB,IACC,IAAIC,EAAUT,KAAKC,KAAKL,GAAKa,QAG7B,GAFAT,KAAKC,KAAKL,GAAKc,SAEW,iBAAfF,GAA2BA,aAAsBG,MAI3D,MAAM,IAAIC,MAAM,iEAAiEhB,EAAG,gCAHpFI,KAAKC,KAAKL,GAAQ,IAAIJ,eAAegB,EAAYR,KAAKC,KAAKL,GAAKiB,WAAW,GAAIb,KAAKC,KAAK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IF,EAAM,MAAMtC,KAAKC,KAAKqC,GAAQhB,SAASC,OAAM,aAAYvB,KAAKC,KAAKqC,GAAQ7B,QAAU,UAAY,WAAS,MAG5H,OADA+B,GAAa,OAId7C,eAAe6B,UAAUkB,OAAS,SAASC,GAC1C,QAAI3C,KAAKC,KAAK0C,IA2DfC,OAAOC,QAAUlD","file":"cron.js","sourcesContent":["let CronJobPackage = require('cron').CronJob;\n\nfunction CrontabManager(key, tab, task, options) {\n\tthis.jobs = {};\n\tif (key && tab && task) {\n\t\tthis.add(key, tab, task, options);\n\t}\n\n}\n\nCrontabManager.prototype.getJob = function(key) {\n\treturn this.jobs[key];\n};\n\nCrontabManager.prototype.getJobs = function() {\n\treturn Object.keys(this.jobs);\n};\n\nCrontabManager.prototype.add = function(key, tab, task, options) {\n\tif ((typeof tab === 'string' || tab instanceof Date) && typeof key === 'string' && task instanceof Function) {\n\t\toptions = combineOptions(tab, task, options);\n\t\ttry {\n\t\t\tif (this.jobs[key]) {\n\t\t\t\tthis.deleteJob(key);\n\t\t\t\tconsole.warn(`${key} already existed and was deleted from the manager...`);\n\t\t\t}\n\t\t\t\n\t\t\tthis.jobs[key] = new CronJobPackage(options);\n\t\t} \n\t\tcatch (fooBaredByUser) {\n\t\t\tconsole.error(`crontab: ${tab} possibly not valid, job ${key} not started...${fooBaredByUser.message}`);\n\t\t}\n\t}\n\telse {\n\t\tconsole.warn(`couldn't add: ${key} improper arguments`);\n\t}\n};\n\nCrontabManager.prototype.update = function() {\n\tif (arguments.length === 2) {\n\t\tif (typeof arguments[1] === 'string' || arguments[1] instanceof Date) {\n\t\t\tupdateTab.call(this, arguments[0], arguments[1]);\n\t\t}\n\t\telse if (arguments[1] instanceof Function) {\n\t\t\tupdateTask.call(this, arguments[0], arguments[1]);\n\t\t}\n\t} \n\telse if (arguments.length === 3) {\n\t\tupdateTab.call(this, arguments[0], arguments[1]);\n\t\tupdateTask.call(this, arguments[0], arguments[2]);\n\t}\n\telse {\n\t\tconsole.error(`incorrect number of arguents passed to update.. won't update.. ${arguments[0]}`);\n\t}\n};\n\nCrontabManager.prototype.deleteJob = function(key) {\n\ttry {\n\t\tthis.jobs[key].stop();\n\t\tdelete this.jobs[key];\n\t}\n\tcatch (err) { \n\t\tconsole.error(`error in trying to stop job: ${key}: ${err}`);\n\t}\n};\n\nCrontabManager.prototype.start = function(key) {\n\ttry {\n\t\tif (this.jobs[key].running) {\n\t\t\tconsole.warn(`${key} job already running`);\n\t\t}\n\t\telse {\n\t\t\tthis.jobs[key].start();\n\t\t}\n\t}\n\tcatch (err) {\n\t\tconsole.error(`couldn't start job: ${key}: ${err}`);\n\t}\n};\n\nCrontabManager.prototype.stop = function(key) {\n\ttry {\n\t\tif (! this.jobs[key].running ) {\n\t\t\tconsole.warn(`${key} job already stopped`);\n\t\t}\n\t\telse {\n\t\t\tthis.jobs[key].stop();\n\t\t}\n\t}\n\tcatch (err) {\n\t\tconsole.error(`couldn't stop job: ${key}: ${err}`);\n\t}\n};\n\nCrontabManager.prototype.stopAll = function() {\n\t// tslint:disable-next-line:forin\n\tfor (let jobKey in this.jobs) {\n\t\ttry {\n\t\t\tthis.jobs[jobKey].stop();\n\t\t}\n\t\tcatch (err) {\n\n\t\t}\n\t}\n};\n\nCrontabManager.prototype.toString = function() {\n\tlet manString = '{\\n';\n\t// tslint:disable-next-line:forin\n\tfor (let jobKey in this.jobs) {\n\n\t\tmanString += `'${jobKey}': ${this.jobs[jobKey].cronTime.source}: ${this.jobs[jobKey]._callbacks[0]}: ${this.jobs[jobKey].running ? 'Running' : 'Stopped'}`;\n\t}\n\tmanString += '\\n}';\n\treturn manString;\n};\n\nCrontabManager.prototype.listCrons = function() {\n\tlet manString = '{\\n';\n\t// tslint:disable-next-line:forin\n\tfor (let jobKey in this.jobs) {\n\t\tmanString += `'${jobKey}': ${this.jobs[jobKey].cronTime.source} status: ${this.jobs[jobKey].running ? 'Running' : 'Stopped'} \\n`;\n\t}\n\tmanString += '\\n}';\n\treturn manString;\n};\n\nCrontabManager.prototype.exists = function(tabKey) {\n\tif (this.jobs[tabKey]) {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\nfunction combineOptions(tab, task, options) {\n\tlet newOpts = {};\n\tnewOpts['cronTime'] = tab; \n\tnewOpts['onTick'] = task;\n\n\tif (options instanceof Object) {\n\t\t// might overwrite... please be careful.\n\t\t// tslint:disable-next-line:forin\n\t\tfor (let optionKey in options) {\n\t\t\tnewOpts[optionKey] = options[optionKey];\n\t\t}\n\t}\n\treturn newOpts;\n}\n\nfunction updateTab(key, cronstring) {\n\n\ttry {\n\t\tlet running = this.jobs[key].running;\n\t\tthis.jobs[key].stop();\n\n\t\tif (typeof cronstring === 'string' || cronstring instanceof Date) {\n\t\t\tthis.jobs[key] = new CronJobPackage(cronstring, this.jobs[key]._callbacks[0], this.jobs[key].onComplete, running, this.jobs[key].zone);\n\t\t}\n\t\telse {\n\t\t\tthrow new Error(`The cron definition passed was not a string or a Date object! ${key} was stopped and not updated`);\n\t\t}\n\t}\n\tcatch (tabErr) {\n\t\tconsole.error(`error updating tab: ${key} - ${tabErr.message}`);\n\t}\n}\n\nfunction updateTask(key, task) {\n\ttry {\n\t\tlet running = this.jobs[key].running;\n\t\tthis.jobs[key].stop();\n\n\t\tif (!(task instanceof Function)) {\n\t\t\tconsole.error(`can't update with something that is not a function: ${typeof(task)}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.jobs[key] = new CronJobPackage(this.jobs[key].cronTime.source, task, this.jobs[key].onComplete, running, this.jobs[key].zone);\n\n\n\t} \n\tcatch (tabErr) {\n\t\tconsole.error(`error updating task: ${key} - ${tabErr.message}`);\n\t}\n}\n\nmodule.exports = CrontabManager;\n"]}
@@ -1,73 +1,2 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.loadServerCronJobs = void 0;
40
- var cron_job_collection_1 = require("../collections/cron-job.collection");
41
- var mongo_manager_1 = require("../managers/mongo.manager");
42
- function loadServerCronJobs() {
43
- return __awaiter(this, void 0, void 0, function () {
44
- var cronJobs;
45
- return __generator(this, function (_a) {
46
- switch (_a.label) {
47
- case 0: return [4 /*yield*/, cron_job_collection_1.CronJobs.find({})];
48
- case 1:
49
- cronJobs = _a.sent();
50
- if (!cronJobs.some(function (a) { return a.name === 'Email Merged Docs Cleanup'; })) {
51
- cron_job_collection_1.CronJobs.create({
52
- _id: mongo_manager_1.objectIdHexString(),
53
- __v: 0,
54
- name: 'Email Merged Docs Cleanup',
55
- repeat: true,
56
- time_to_run: '0 0 * * *',
57
- method_run: 'cronEmailMergedDocsCleanUp',
58
- method_run_data: null,
59
- next_run: new Date(),
60
- running: false
61
- });
62
- }
63
- cronJobs.filter(function (a) { return a.running && a.next_run && a.next_run.getTime() < (new Date()).getTime(); }).forEach(function (cronJob) {
64
- cron_job_collection_1.CronJobs.updateOne({ _id: cronJob._id }, { $set: { running: false } });
65
- });
66
- return [2 /*return*/];
67
- }
68
- });
69
- });
70
- }
71
- exports.loadServerCronJobs = loadServerCronJobs;
72
-
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(e,n,r,t){return new(r||(r=Promise))((function(o,a){function fulfilled(e){try{step(t.next(e))}catch(e){a(e)}}function rejected(e){try{step(t.throw(e))}catch(e){a(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof r?e:new r((function(n){n(e)}))}(e.value).then(fulfilled,rejected)}step((t=t.apply(e,n||[])).next())}))},__generator=this&&this.__generator||function(e,n){var r,t,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function verb(a){return function(c){return function step(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=n.call(e,i)}catch(e){a=[6,e],t=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.loadServerCronJobs=void 0;var cron_job_collection_1=require("../collections/cron-job.collection"),mongo_manager_1=require("../managers/mongo.manager");function loadServerCronJobs(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:return[4,cron_job_collection_1.CronJobs.find({})];case 1:return(e=n.sent()).some((function(e){return"Email Merged Docs Cleanup"===e.name}))||cron_job_collection_1.CronJobs.create({_id:mongo_manager_1.objectIdHexString(),__v:0,name:"Email Merged Docs Cleanup",repeat:!0,time_to_run:"0 0 * * *",method_run:"cronEmailMergedDocsCleanUp",method_run_data:null,next_run:new Date,running:!1}),e.filter((function(e){return e.running&&e.next_run&&e.next_run.getTime()<(new Date).getTime()})).forEach((function(e){cron_job_collection_1.CronJobs.updateOne({_id:e._id},{$set:{running:!1}})})),[2]}}))}))}exports.loadServerCronJobs=loadServerCronJobs;
73
2
  //# sourceMappingURL=cron-jobs.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fixtures/cron-jobs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAA8D;AAC9D,2DAA8D;AAE9D,SAAsB,kBAAkB;;;;;wBAExB,qBAAM,8BAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAA;;oBAAlC,QAAQ,GAAG,SAAuB;oBAEtC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,2BAA2B,EAAtC,CAAsC,CAAC,EAAE;wBAChE,8BAAQ,CAAC,MAAM,CAAC;4BACf,GAAG,EAAE,iCAAiB,EAAE;4BACxB,GAAG,EAAE,CAAC;4BACN,IAAI,EAAG,2BAA2B;4BAClC,MAAM,EAAG,IAAI;4BACb,WAAW,EAAG,WAAW;4BACzB,UAAU,EAAG,4BAA4B;4BACzC,eAAe,EAAG,IAAI;4BACtB,QAAQ,EAAG,IAAI,IAAI,EAAE;4BACrB,OAAO,EAAG,KAAK;yBACf,CAAC,CAAC;qBACH;oBAED,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAxE,CAAwE,CAAC,CAAC,OAAO,CAAC,UAAA,OAAO;wBAC7G,8BAAQ,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,EAAC,CAAC,CAAC;oBAClE,CAAC,CAAC,CAAC;;;;;CACH;AArBD,gDAqBC","file":"cron-jobs.js","sourcesContent":["import { CronJobs } from '../collections/cron-job.collection';\nimport { objectIdHexString } from '../managers/mongo.manager';\n\nexport async function loadServerCronJobs() {\n\n\tlet cronJobs = await CronJobs.find({});\n\n\tif (!cronJobs.some(a => a.name === 'Email Merged Docs Cleanup')) {\n\t\tCronJobs.create({\n\t\t\t_id: objectIdHexString(),\n\t\t\t__v: 0,\n\t\t\tname : 'Email Merged Docs Cleanup', \n\t\t\trepeat : true, \n\t\t\ttime_to_run : '0 0 * * *', \n\t\t\tmethod_run : 'cronEmailMergedDocsCleanUp', \n\t\t\tmethod_run_data : null, \n\t\t\tnext_run : new Date(), \n\t\t\trunning : false\n\t\t});\n\t}\n\n\tcronJobs.filter(a => a.running && a.next_run && a.next_run.getTime() < (new Date()).getTime()).forEach(cronJob => {\n\t\tCronJobs.updateOne({_id: cronJob._id}, {$set: {running: false}});\n\t});\n} "]}
1
+ {"version":3,"sources":["../../src/fixtures/cron-jobs.ts"],"names":["cron_job_collection_1","require","mongo_manager_1","loadServerCronJobs","CronJobs","find","cronJobs","_a","sent","some","a","name","create","_id","objectIdHexString","__v","repeat","time_to_run","method_run","method_run_data","next_run","Date","running","filter","getTime","forEach","cronJob","updateOne","$set","exports"],"mappings":"mkDAAA,IAAAA,sBAAAC,QAAA,sCACAC,gBAAAD,QAAA,6BAEA,SAAsBE,uIAEN,MAAA,CAAA,EAAMH,sBAAAI,SAASC,KAAK,mBAA/BC,EAAWC,EAAAC,QAEDC,MAAK,SAAAC,GAAK,MAAW,8BAAXA,EAAEC,SACzBX,sBAAAI,SAASQ,OAAO,CACfC,IAAKX,gBAAAY,oBACLC,IAAK,EACLJ,KAAO,4BACPK,QAAS,EACTC,YAAc,YACdC,WAAa,6BACbC,gBAAkB,KAClBC,SAAW,IAAIC,KACfC,SAAU,IAIZhB,EAASiB,QAAO,SAAAb,GAAK,OAAAA,EAAEY,SAAWZ,EAAEU,UAAYV,EAAEU,SAASI,WAAY,IAAKH,MAAQG,aAAWC,SAAQ,SAAAC,GACtG1B,sBAAAI,SAASuB,UAAU,CAACd,IAAKa,EAAQb,KAAM,CAACe,KAAM,CAACN,SAAS,mBAnB1DO,QAAA1B,mBAAAA","file":"cron-jobs.js","sourcesContent":["import { CronJobs } from '../collections/cron-job.collection';\nimport { objectIdHexString } from '../managers/mongo.manager';\n\nexport async function loadServerCronJobs() {\n\n\tlet cronJobs = await CronJobs.find({});\n\n\tif (!cronJobs.some(a => a.name === 'Email Merged Docs Cleanup')) {\n\t\tCronJobs.create({\n\t\t\t_id: objectIdHexString(),\n\t\t\t__v: 0,\n\t\t\tname : 'Email Merged Docs Cleanup', \n\t\t\trepeat : true, \n\t\t\ttime_to_run : '0 0 * * *', \n\t\t\tmethod_run : 'cronEmailMergedDocsCleanUp', \n\t\t\tmethod_run_data : null, \n\t\t\tnext_run : new Date(), \n\t\t\trunning : false\n\t\t});\n\t}\n\n\tcronJobs.filter(a => a.running && a.next_run && a.next_run.getTime() < (new Date()).getTime()).forEach(cronJob => {\n\t\tCronJobs.updateOne({_id: cronJob._id}, {$set: {running: false}});\n\t});\n} "]}