@resolveio/server-lib 12.5.54 → 12.5.56

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 (400) hide show
  1. package/client-server-app.d.ts +1 -0
  2. package/client-server-app.js +48 -0
  3. package/client-server-app.js.map +1 -0
  4. package/collections/app-status.collection.d.ts +3 -0
  5. package/collections/app-status.collection.js +51 -0
  6. package/collections/app-status.collection.js.map +1 -0
  7. package/collections/counter.collection.d.ts +3 -0
  8. package/collections/counter.collection.js +54 -0
  9. package/collections/counter.collection.js.map +1 -0
  10. package/collections/cron-job-history.collection.d.ts +3 -0
  11. package/collections/cron-job-history.collection.js +82 -0
  12. package/collections/cron-job-history.collection.js.map +1 -0
  13. package/collections/cron-job.collection.d.ts +3 -0
  14. package/collections/cron-job.collection.js +85 -0
  15. package/collections/cron-job.collection.js.map +1 -0
  16. package/collections/email-history.collection.d.ts +3 -0
  17. package/collections/email-history.collection.js +66 -0
  18. package/collections/email-history.collection.js.map +1 -0
  19. package/collections/email-verified.collection.d.ts +3 -0
  20. package/collections/email-verified.collection.js +61 -0
  21. package/collections/email-verified.collection.js.map +1 -0
  22. package/collections/file.collection.d.ts +3 -0
  23. package/collections/file.collection.js +73 -0
  24. package/collections/file.collection.js.map +1 -0
  25. package/collections/flag.collection.d.ts +3 -0
  26. package/collections/flag.collection.js +56 -0
  27. package/collections/flag.collection.js.map +1 -0
  28. package/collections/log-method-latency.collection.d.ts +3 -0
  29. package/collections/log-method-latency.collection.js +64 -0
  30. package/collections/log-method-latency.collection.js.map +1 -0
  31. package/collections/log-subscription.collection.d.ts +3 -0
  32. package/collections/log-subscription.collection.js +68 -0
  33. package/collections/log-subscription.collection.js.map +1 -0
  34. package/collections/log-ts.collection.d.ts +3 -0
  35. package/collections/log-ts.collection.js +78 -0
  36. package/collections/log-ts.collection.js.map +1 -0
  37. package/collections/log.collection.d.ts +3 -0
  38. package/collections/log.collection.js +77 -0
  39. package/collections/log.collection.js.map +1 -0
  40. package/collections/logged-in-users.collection.d.ts +3 -0
  41. package/collections/logged-in-users.collection.js +65 -0
  42. package/collections/logged-in-users.collection.js.map +1 -0
  43. package/collections/method-response.collection.d.ts +3 -0
  44. package/collections/method-response.collection.js +66 -0
  45. package/collections/method-response.collection.js.map +1 -0
  46. package/collections/monitor-cpu.collection.d.ts +3 -0
  47. package/collections/monitor-cpu.collection.js +63 -0
  48. package/collections/monitor-cpu.collection.js.map +1 -0
  49. package/collections/monitor-memory.collection.d.ts +3 -0
  50. package/collections/monitor-memory.collection.js +75 -0
  51. package/collections/monitor-memory.collection.js.map +1 -0
  52. package/collections/monitor-mongo.collection.d.ts +3 -0
  53. package/collections/monitor-mongo.collection.js +69 -0
  54. package/collections/monitor-mongo.collection.js.map +1 -0
  55. package/collections/notification.collection.d.ts +3 -0
  56. package/collections/notification.collection.js +51 -0
  57. package/collections/notification.collection.js.map +1 -0
  58. package/collections/report-builder-dashboard-builder.collection.d.ts +3 -0
  59. package/collections/report-builder-dashboard-builder.collection.js +109 -0
  60. package/collections/report-builder-dashboard-builder.collection.js.map +1 -0
  61. package/collections/report-builder-library.collection.d.ts +3 -0
  62. package/collections/report-builder-library.collection.js +87 -0
  63. package/collections/report-builder-library.collection.js.map +1 -0
  64. package/collections/report-builder-report.collection.d.ts +4 -0
  65. package/collections/report-builder-report.collection.js +149 -0
  66. package/collections/report-builder-report.collection.js.map +1 -0
  67. package/collections/user-group.collection.d.ts +4 -0
  68. package/collections/user-group.collection.js +90 -0
  69. package/collections/user-group.collection.js.map +1 -0
  70. package/collections/user-guide.collection.d.ts +3 -0
  71. package/collections/user-guide.collection.js +57 -0
  72. package/collections/user-guide.collection.js.map +1 -0
  73. package/collections/user.collection.d.ts +4 -0
  74. package/collections/user.collection.js +259 -0
  75. package/collections/user.collection.js.map +1 -0
  76. package/cron/cron.d.ts +5 -0
  77. package/cron/cron.js +162 -0
  78. package/cron/cron.js.map +1 -0
  79. package/fixtures/cron-jobs.d.ts +1 -0
  80. package/fixtures/cron-jobs.js +73 -0
  81. package/fixtures/cron-jobs.js.map +1 -0
  82. package/fixtures/init.d.ts +1 -0
  83. package/fixtures/init.js +59 -0
  84. package/fixtures/init.js.map +1 -0
  85. package/http/auth.d.ts +2 -0
  86. package/http/auth.js +763 -0
  87. package/http/auth.js.map +1 -0
  88. package/http/health.d.ts +1 -0
  89. package/http/health.js +12 -0
  90. package/http/health.js.map +1 -0
  91. package/http/home.d.ts +2 -0
  92. package/http/home.js +66 -0
  93. package/http/home.js.map +1 -0
  94. package/index.d.ts +23 -0
  95. package/index.js +127 -0
  96. package/index.js.map +1 -0
  97. package/managers/cron.manager.d.ts +17 -0
  98. package/managers/cron.manager.js +242 -0
  99. package/managers/cron.manager.js.map +1 -0
  100. package/managers/method.manager.d.ts +38 -0
  101. package/managers/method.manager.js +595 -0
  102. package/managers/method.manager.js.map +1 -0
  103. package/managers/mongo.manager.d.ts +178 -0
  104. package/managers/mongo.manager.js +2221 -0
  105. package/managers/mongo.manager.js.map +1 -0
  106. package/managers/monitor.manager.d.ts +59 -0
  107. package/managers/monitor.manager.js +351 -0
  108. package/managers/monitor.manager.js.map +1 -0
  109. package/managers/subscription.manager.d.ts +50 -0
  110. package/managers/subscription.manager.js +1091 -0
  111. package/managers/subscription.manager.js.map +1 -0
  112. package/managers/subscription.performance.d.ts +1 -0
  113. package/{src/managers/subscription.performance.ts → managers/subscription.performance.js} +33 -68
  114. package/managers/subscription.performance.js.map +1 -0
  115. package/methods/accounts.d.ts +2 -0
  116. package/methods/accounts.js +274 -0
  117. package/methods/accounts.js.map +1 -0
  118. package/methods/aws.d.ts +2 -0
  119. package/methods/aws.js +617 -0
  120. package/methods/aws.js.map +1 -0
  121. package/methods/collections.d.ts +2 -0
  122. package/methods/collections.js +499 -0
  123. package/methods/collections.js.map +1 -0
  124. package/methods/counters.d.ts +2 -0
  125. package/methods/counters.js +122 -0
  126. package/methods/counters.js.map +1 -0
  127. package/methods/cron-jobs.d.ts +2 -0
  128. package/methods/cron-jobs.js +1315 -0
  129. package/methods/cron-jobs.js.map +1 -0
  130. package/methods/flags.d.ts +2 -0
  131. package/methods/flags.js +9 -0
  132. package/methods/flags.js.map +1 -0
  133. package/methods/logs.d.ts +2 -0
  134. package/methods/logs.js +371 -0
  135. package/methods/logs.js.map +1 -0
  136. package/methods/monitor.d.ts +2 -0
  137. package/methods/monitor.js +565 -0
  138. package/methods/monitor.js.map +1 -0
  139. package/methods/pdf.d.ts +2 -0
  140. package/methods/pdf.js +468 -0
  141. package/methods/pdf.js.map +1 -0
  142. package/methods/report-builder.d.ts +2 -0
  143. package/methods/report-builder.js +858 -0
  144. package/methods/report-builder.js.map +1 -0
  145. package/methods/support.d.ts +2 -0
  146. package/methods/support.js +246 -0
  147. package/methods/support.js.map +1 -0
  148. package/{src/models/app-status.model.ts → models/app-status.model.d.ts} +2 -3
  149. package/models/app-status.model.js +4 -0
  150. package/models/app-status.model.js.map +1 -0
  151. package/{src/models/billing-logged-in-users.model.ts → models/billing-logged-in-users.model.d.ts} +4 -5
  152. package/models/billing-logged-in-users.model.js +4 -0
  153. package/models/billing-logged-in-users.model.js.map +1 -0
  154. package/models/collection-document.model.d.ts +19 -0
  155. package/models/collection-document.model.js +4 -0
  156. package/models/collection-document.model.js.map +1 -0
  157. package/{src/models/counter.model.ts → models/counter.model.d.ts} +3 -4
  158. package/models/counter.model.js +4 -0
  159. package/models/counter.model.js.map +1 -0
  160. package/models/cron-job-history.model.d.ts +12 -0
  161. package/models/cron-job-history.model.js +4 -0
  162. package/models/cron-job-history.model.js.map +1 -0
  163. package/models/cron-job.model.d.ts +13 -0
  164. package/models/cron-job.model.js +4 -0
  165. package/models/cron-job.model.js.map +1 -0
  166. package/models/dialog.model.d.ts +23 -0
  167. package/models/dialog.model.js +4 -0
  168. package/models/dialog.model.js.map +1 -0
  169. package/{src/models/email-history.model.ts → models/email-history.model.d.ts} +7 -8
  170. package/models/email-history.model.js +4 -0
  171. package/models/email-history.model.js.map +1 -0
  172. package/{src/models/email-verified.model.ts → models/email-verified.model.d.ts} +5 -6
  173. package/models/email-verified.model.js +4 -0
  174. package/models/email-verified.model.js.map +1 -0
  175. package/{src/models/file.model.ts → models/file.model.d.ts} +7 -8
  176. package/models/file.model.js +4 -0
  177. package/models/file.model.js.map +1 -0
  178. package/{src/models/flag.model.ts → models/flag.model.d.ts} +3 -4
  179. package/models/flag.model.js +4 -0
  180. package/models/flag.model.js.map +1 -0
  181. package/{src/models/log-method-latency.model.ts → models/log-method-latency.model.d.ts} +4 -5
  182. package/models/log-method-latency.model.js +4 -0
  183. package/models/log-method-latency.model.js.map +1 -0
  184. package/{src/models/log-subscription.model.ts → models/log-subscription.model.d.ts} +6 -8
  185. package/models/log-subscription.model.js +4 -0
  186. package/models/log-subscription.model.js.map +1 -0
  187. package/{src/models/log.model.ts → models/log.model.d.ts} +10 -12
  188. package/models/log.model.js +4 -0
  189. package/models/log.model.js.map +1 -0
  190. package/{src/models/logged-in-users.model.ts → models/logged-in-users.model.d.ts} +5 -6
  191. package/models/logged-in-users.model.js +4 -0
  192. package/models/logged-in-users.model.js.map +1 -0
  193. package/{src/models/method-response.model.ts → models/method-response.model.d.ts} +6 -7
  194. package/models/method-response.model.js +4 -0
  195. package/models/method-response.model.js.map +1 -0
  196. package/models/method.model.d.ts +9 -0
  197. package/models/method.model.js +4 -0
  198. package/models/method.model.js.map +1 -0
  199. package/{src/models/monitor-cpu.model.ts → models/monitor-cpu.model.d.ts} +7 -9
  200. package/models/monitor-cpu.model.js +4 -0
  201. package/models/monitor-cpu.model.js.map +1 -0
  202. package/models/monitor-memory.model.d.ts +15 -0
  203. package/models/monitor-memory.model.js +4 -0
  204. package/models/monitor-memory.model.js.map +1 -0
  205. package/models/monitor-mongo.model.d.ts +13 -0
  206. package/models/monitor-mongo.model.js +4 -0
  207. package/models/monitor-mongo.model.js.map +1 -0
  208. package/{src/models/notification.model.ts → models/notification.model.d.ts} +2 -3
  209. package/models/notification.model.js +4 -0
  210. package/models/notification.model.js.map +1 -0
  211. package/models/pagination.model.d.ts +10 -0
  212. package/models/pagination.model.js +24 -0
  213. package/models/pagination.model.js.map +1 -0
  214. package/models/permission.model.d.ts +12 -0
  215. package/models/permission.model.js +4 -0
  216. package/models/permission.model.js.map +1 -0
  217. package/models/report-builder-dashboard-builder.model.d.ts +25 -0
  218. package/models/report-builder-dashboard-builder.model.js +4 -0
  219. package/models/report-builder-dashboard-builder.model.js.map +1 -0
  220. package/models/report-builder-library.model.d.ts +17 -0
  221. package/models/report-builder-library.model.js +4 -0
  222. package/models/report-builder-library.model.js.map +1 -0
  223. package/models/report-builder-report.model.d.ts +98 -0
  224. package/models/report-builder-report.model.js +4 -0
  225. package/models/report-builder-report.model.js.map +1 -0
  226. package/models/report-builder.model.d.ts +61 -0
  227. package/models/report-builder.model.js +4 -0
  228. package/models/report-builder.model.js.map +1 -0
  229. package/models/select-data-label.model.d.ts +9 -0
  230. package/models/select-data-label.model.js +4 -0
  231. package/models/select-data-label.model.js.map +1 -0
  232. package/models/server-response.model.d.ts +5 -0
  233. package/models/server-response.model.js +4 -0
  234. package/models/server-response.model.js.map +1 -0
  235. package/models/subscription.model.d.ts +23 -0
  236. package/models/subscription.model.js +4 -0
  237. package/models/subscription.model.js.map +1 -0
  238. package/models/support-ticket.model.d.ts +72 -0
  239. package/models/support-ticket.model.js +4 -0
  240. package/models/support-ticket.model.js.map +1 -0
  241. package/models/user-group.model.d.ts +19 -0
  242. package/models/user-group.model.js +4 -0
  243. package/models/user-group.model.js.map +1 -0
  244. package/{src/models/user-guide.model.ts → models/user-guide.model.d.ts} +4 -5
  245. package/models/user-guide.model.js +4 -0
  246. package/models/user-guide.model.js.map +1 -0
  247. package/models/user.model.d.ts +70 -0
  248. package/models/user.model.js +4 -0
  249. package/models/user.model.js.map +1 -0
  250. package/package.json +1 -1
  251. package/{src/public_api.ts → public_api.d.ts} +1 -1
  252. package/public_api.js +75 -0
  253. package/public_api.js.map +1 -0
  254. package/publications/app-status.d.ts +2 -0
  255. package/publications/app-status.js +17 -0
  256. package/publications/app-status.js.map +1 -0
  257. package/publications/cron-jobs.d.ts +2 -0
  258. package/publications/cron-jobs.js +33 -0
  259. package/publications/cron-jobs.js.map +1 -0
  260. package/publications/files.d.ts +2 -0
  261. package/publications/files.js +37 -0
  262. package/publications/files.js.map +1 -0
  263. package/publications/flags.d.ts +2 -0
  264. package/publications/flags.js +23 -0
  265. package/publications/flags.js.map +1 -0
  266. package/publications/logs.d.ts +2 -0
  267. package/publications/logs.js +165 -0
  268. package/publications/logs.js.map +1 -0
  269. package/publications/method-responses.d.ts +2 -0
  270. package/publications/method-responses.js +17 -0
  271. package/publications/method-responses.js.map +1 -0
  272. package/publications/notifications.d.ts +2 -0
  273. package/publications/notifications.js +17 -0
  274. package/publications/notifications.js.map +1 -0
  275. package/publications/report-builder-dashboard-builders.d.ts +2 -0
  276. package/publications/report-builder-dashboard-builders.js +43 -0
  277. package/publications/report-builder-dashboard-builders.js.map +1 -0
  278. package/publications/report-builder-libraries.d.ts +2 -0
  279. package/publications/report-builder-libraries.js +90 -0
  280. package/publications/report-builder-libraries.js.map +1 -0
  281. package/publications/report-builder-reports.d.ts +2 -0
  282. package/publications/report-builder-reports.js +51 -0
  283. package/publications/report-builder-reports.js.map +1 -0
  284. package/publications/super-admin.d.ts +2 -0
  285. package/publications/super-admin.js +17 -0
  286. package/publications/super-admin.js.map +1 -0
  287. package/publications/user-groups.d.ts +1 -0
  288. package/publications/user-groups.js +17 -0
  289. package/publications/user-groups.js.map +1 -0
  290. package/publications/user-guides.d.ts +1 -0
  291. package/publications/user-guides.js +17 -0
  292. package/publications/user-guides.js.map +1 -0
  293. package/server-app.d.ts +52 -0
  294. package/server-app.js +739 -0
  295. package/server-app.js.map +1 -0
  296. package/util/common.d.ts +25 -0
  297. package/util/common.js +524 -0
  298. package/util/common.js.map +1 -0
  299. package/util/schema-report-builder.d.ts +6 -0
  300. package/util/schema-report-builder.js +453 -0
  301. package/util/schema-report-builder.js.map +1 -0
  302. package/.nodemon.json +0 -5
  303. package/.vscode/settings.json +0 -3
  304. package/README.md +0 -22
  305. package/compileDTS.pl +0 -64
  306. package/gulpfile.js +0 -127
  307. package/mongodbensurers.js +0 -2
  308. package/mongostop.js +0 -3
  309. package/settings.development.json +0 -13
  310. package/src/client-server-app.ts +0 -7
  311. package/src/collections/app-status.collection.ts +0 -51
  312. package/src/collections/counter.collection.ts +0 -54
  313. package/src/collections/cron-job-history.collection.ts +0 -82
  314. package/src/collections/cron-job.collection.ts +0 -85
  315. package/src/collections/email-history.collection.ts +0 -66
  316. package/src/collections/email-verified.collection.ts +0 -61
  317. package/src/collections/file.collection.ts +0 -73
  318. package/src/collections/flag.collection.ts +0 -56
  319. package/src/collections/log-method-latency.collection.ts +0 -64
  320. package/src/collections/log-subscription.collection.ts +0 -68
  321. package/src/collections/log-ts.collection.ts +0 -78
  322. package/src/collections/log.collection.ts +0 -77
  323. package/src/collections/logged-in-users.collection.ts +0 -65
  324. package/src/collections/method-response.collection.ts +0 -66
  325. package/src/collections/monitor-cpu.collection.ts +0 -63
  326. package/src/collections/monitor-memory.collection.ts +0 -75
  327. package/src/collections/monitor-mongo.collection.ts +0 -69
  328. package/src/collections/notification.collection.ts +0 -51
  329. package/src/collections/report-builder-dashboard-builder.collection.ts +0 -109
  330. package/src/collections/report-builder-library.collection.ts +0 -89
  331. package/src/collections/report-builder-report.collection.ts +0 -149
  332. package/src/collections/user-group.collection.ts +0 -90
  333. package/src/collections/user-guide.collection.ts +0 -57
  334. package/src/collections/user.collection.ts +0 -259
  335. package/src/cron/cron.ts +0 -188
  336. package/src/fixtures/cron-jobs.ts +0 -25
  337. package/src/fixtures/init.ts +0 -10
  338. package/src/http/auth.ts +0 -732
  339. package/src/http/health.ts +0 -7
  340. package/src/http/home.ts +0 -71
  341. package/src/index.ts +0 -71
  342. package/src/managers/cron.manager.ts +0 -208
  343. package/src/managers/method.manager.ts +0 -607
  344. package/src/managers/mongo.manager.ts +0 -2282
  345. package/src/managers/monitor.manager.ts +0 -323
  346. package/src/managers/subscription.manager.ts +0 -1196
  347. package/src/methods/accounts.ts +0 -202
  348. package/src/methods/aws.ts +0 -507
  349. package/src/methods/collections.ts +0 -512
  350. package/src/methods/counters.ts +0 -75
  351. package/src/methods/cron-jobs.ts +0 -1454
  352. package/src/methods/flags.ts +0 -7
  353. package/src/methods/logs.ts +0 -327
  354. package/src/methods/monitor.ts +0 -548
  355. package/src/methods/pdf.ts +0 -615
  356. package/src/methods/report-builder.ts +0 -876
  357. package/src/methods/support.ts +0 -146
  358. package/src/models/collection-document.model.ts +0 -22
  359. package/src/models/cron-job-history.model.ts +0 -13
  360. package/src/models/cron-job.model.ts +0 -14
  361. package/src/models/dialog.model.ts +0 -25
  362. package/src/models/method.model.ts +0 -11
  363. package/src/models/monitor-memory.model.ts +0 -17
  364. package/src/models/monitor-mongo.model.ts +0 -15
  365. package/src/models/pagination.model.ts +0 -30
  366. package/src/models/permission.model.ts +0 -14
  367. package/src/models/report-builder-dashboard-builder.model.ts +0 -29
  368. package/src/models/report-builder-library.model.ts +0 -20
  369. package/src/models/report-builder-report.model.ts +0 -110
  370. package/src/models/report-builder.model.ts +0 -68
  371. package/src/models/select-data-label.model.ts +0 -9
  372. package/src/models/server-response.model.ts +0 -5
  373. package/src/models/subscription.model.ts +0 -64
  374. package/src/models/support-ticket.model.ts +0 -81
  375. package/src/models/user-group.model.ts +0 -23
  376. package/src/models/user.model.ts +0 -79
  377. package/src/publications/app-status.ts +0 -13
  378. package/src/publications/cron-jobs.ts +0 -30
  379. package/src/publications/files.ts +0 -34
  380. package/src/publications/flags.ts +0 -20
  381. package/src/publications/logs.ts +0 -164
  382. package/src/publications/method-responses.ts +0 -13
  383. package/src/publications/notifications.ts +0 -13
  384. package/src/publications/report-builder-dashboard-builders.ts +0 -39
  385. package/src/publications/report-builder-libraries.ts +0 -41
  386. package/src/publications/report-builder-reports.ts +0 -48
  387. package/src/publications/super-admin.ts +0 -13
  388. package/src/publications/user-groups.ts +0 -12
  389. package/src/publications/user-guides.ts +0 -12
  390. package/src/server-app.ts +0 -769
  391. package/src/util/common.ts +0 -519
  392. package/src/util/schema-report-builder.ts +0 -413
  393. package/tsconfig.json +0 -30
  394. package/tslint.json +0 -143
  395. /package/{src/private → private}/email-templates/enrollment.html +0 -0
  396. /package/{src/private → private}/email-templates/forgot-password.html +0 -0
  397. /package/{src/private → private}/email-templates/support-ticket-deleted.html +0 -0
  398. /package/{src/private → private}/email-templates/support-ticket-modified.html +0 -0
  399. /package/{src/private → private}/email-templates/support-ticket.html +0 -0
  400. /package/{src/private → private}/images/ResolveIO.png +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/managers/subscription.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,6CAA2D;AAC3D,yDAAuE;AACvE,+CAA6D;AAC7D,2DAAyE;AACzE,wFAA0E;AAC1E,uDAAoE;AACpE,+CAA8D;AAC9D,qEAAkF;AAElF,kCAA2C;AAC3C,+DAA6E;AAC7E,iFAA6F;AAI7F,qFAAgG;AAChG,2DAAwE;AACxE,2DAAwE;AACxE,uGAAkH;AAClH,iDAAoD;AACpD,yCAAuD;AACvD,sCAAwC;AAExC,kEAAuD;AACvD,yBAA0B;AAC1B,IAAM,OAAO,GAAG,IAAA,SAAI,GAAE,CAAC,MAAM,CAAC;AAC9B,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAezB,wCAAwC;AACxC,gBAAgB;AAChB,qBAAqB;AACrB,wBAAwB;AACxB,4BAA4B;AAC5B,qBAAqB;AACrB,mBAAmB;AACnB,qBAAqB;AACrB,mBAAmB;AACnB,IAAI;AAEJ;IAwCC,sEAAsE;IACtE,qCAAqC;IACrC,6BAA6B;IAE7B,6BAAY,UAAU,EAAE,GAAqB,EAAE,YAAY,EAAE,sBAA8C;QAA3G,iBAoQC;QA7SO,kBAAa,GAAsB,EAAE,C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6B,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;wBAErW,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM;4BAC7C,IAAI,EAAE,GAAG,KAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;4BAElD,IAAI,EAAE,EAAE;gCACP,IAAI,EAAE,CAAC,WAAW,CAAC,KAAK,MAAM,CAAC,SAAS,EAAE;oCACzC,IAAI,SAAS,GAAwB;wCACpC,SAAS,EAAE,MAAM,CAAC,SAAS;wCAC3B,QAAQ,EAAE,IAAI;wCACd,IAAI,EAAE,GAAG;qCACT,CAAC;oCAEF,KAAI,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;iCAC3B;6BACD;wBACF,CAAC,CAAC,CAAC;wBAEH,MAAM,CAAC,GAAG,CAAC,CAAC;oBACb,CAAC,CAAC,CAAC;iBACH;;;aACD,CAAC,CAAC;IACJ,CAAC;IAEO,oCAAM,GAAd,UAAe,EAAa,EAAE,IAAyB;QACtD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;YAC5B,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC;YACtB,IAAI,EAAE,IAAI;SACV,CAAC,CAAC;IACJ,CAAC;IAEM,4CAAc,GAArB;QACC,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IACF,0BAAC;AAAD,CApnCA,AAonCC,IAAA;AApnCY,kDAAmB","file":"subscription.manager.js","sourcesContent":["import { ServerResponseModel } from '../models/server-response.model';\nimport { ActiveSubscriptionModel, SubscriptionModel } from '../models/subscription.model';\nimport * as WebSocket from 'ws';\nimport { loadLogPublications } from '../publications/logs';\nimport { loadAppStatusPublications } from '../publications/app-status';\nimport { loadFilePublications } from '../publications/files';\nimport { loadSuperAdminPublications } from '../publications/super-admin';\nimport { LoggedInUsers } from '../collections/logged-in-users.collection';\nimport { loadCronJobPublications } from '../publications/cron-jobs';\nimport { loadFlagsPublications } from '../publications/flags';\nimport { loadMethodResponsePublications } from '../publications/method-responses';\nimport ResolveIOMainServer from '../server-app';\nimport { ResolveIOServer } from '../index';\nimport { loadNotificationPublications } from '../publications/notifications';\nimport { loadReportBuilderReportPublications } from '../publications/report-builder-reports';\nimport { LoggedInUserModel } from '../models/logged-in-users.model';\n\nimport { ChangeStream, ChangeStreamDeleteDocument, ChangeStreamDocument, ChangeStreamInsertDocument, ChangeStreamReplaceDocument, ChangeStreamUpdateDocument, ResumeToken } from 'mongodb';\nimport { loadReportBuilderLibraryPublications } from '../publications/report-builder-libraries';\nimport { loadUserGroupPublications } from '../publications/user-groups';\nimport { loadUserGuidePublications } from '../publications/user-guides';\nimport { loadReportBuilderDashboardBuilderPublications } from '../publications/report-builder-dashboard-builders';\nimport { objectIdHexString } from './mongo.manager';\nimport { dateReviver, deepCopy } from '../util/common';\nimport * as NodeCache from 'node-cache';\nimport { MonitorManagerFunction } from './monitor.manager';\nimport { Flags } from '../collections/flag.collection';\nimport { cpus } from 'os';\nconst numCPUs = cpus().length;\nconst v8 = require('v8');\n\n// Performance Dependencies\n// import * as path from 'path';\n// import { Worker } from 'worker_threads';\n\ninterface MongoQueueModel {\n\t_id: number,\n\ttype: string;\n\tcollection: string;\n\tsubscription: ActiveSubscriptionModel;\n\trunning: boolean;\n\trun_again: boolean;\n}\n\n// interface CurrentPerformanceMonitor {\n// \t_id: number;\n// \tfunction: string;\n// \tpublication: string;\n// \tsubscriptionData: any[];\n// \tdate_start: Date;\n// \tdate_end: Date;\n// \tduration: number;\n// \tresult: string;\n// }\n\nexport class SubscriptionManager {\n\n\tprivate _mainServer: ResolveIOMainServer;\n\tprivate _publications: SubscriptionModel = {};\n\tprivate _subscriptions: ActiveSubscriptionModel[] = [];\n\tprivate _wss: WebSocket.Server;\n\tprivate _loggedInUsers: LoggedInUserModel[] = [];\n\n\tprivate _mongoQueue: MongoQueueModel[] = [];\n\tprivate _mongoQueueId = 0;\n\n\tprivate _sendQueue = [];\n\tprivate _runningQueue = false;\n\t\n\tprivate _oplog: ChangeStream;\n\n\tprivate _nodeCache;\n\tprivate _cacheId = 1;\n\n\tprivate serverConfig;\n\n\tprivate _heapStats = v8.getHeapStatistics();\n\tprivate _heapLimit = this._heapStats.heap_size_limit / numCPUs / 8;\n\n\tprivate _monitorManagerFunction: MonitorManagerFunction;\n\n\tprivate _enableDebug = false;\n\tprivate _debugOplogCollections = [];\n\tprivate _debugOplogHits = 0;\n\tprivate _debugSubCollections = [];\n\tprivate _debugSubHits = 0;\n\tprivate _debugUnSubHits = 0;\n\tprivate _debugUnSubAllHits = 0;\n\tprivate _debugMongoQueueHits = 0;\n\tprivate _debugMongoQueueCollections = [];\n\tprivate _debugSendQueueHits = 0;\n\tprivate _debugRemoveCacheHits = 0;\n\n\tprivate _oplogRetryCount = 0;\n\n\t// private currentPerfomanceMonitor: CurrentPerformanceMonitor[] = [];\n\t// private idPerformance: number = 0;\n\t// private performanceThread;\n\n\tconstructor(mainServer, wss: WebSocket.Server, serverConfig, monitorManagerFunction: MonitorManagerFunction) {\n\t\tthis._mainServer = mainServer;\n\t\tthis._monitorManagerFunction = monitorManagerFunction;\n\n\t\tthis._nodeCache = new NodeCache( { stdTTL: 0, checkperiod: 0 } );\n\n\t\t// setTimeout(() => {\n\t\t// \tconsole.log('Setting up performance thread');\n\n\t\t// \tthis.performanceThread = new Worker(path.join(__dirname, './subscription.performance.js'));\n\n\t\t// \tthis.performanceThread.on('exit', code => {\n\t\t// \t\tconsole.error(new Date(), 'THREAD EXITED!!!!!!!!!!!!!!!!!!', code);\n\t\t// \t});\n\n\t\t// \tthis.performanceThread.on('error', code => {\n\t\t// \t\tconsole.error(new Date(), 'THREAD RECV ERROR !!!!!!!!!!!!!!!!!!', code);\n\t\t// \t});\n\t\t// }, 5000);\n\n\t\t// setInterval(() => {\n\t\t// \tconsole.log('Post thread msg');\n\t\t// \tthis.performanceThread.postMessage(this.currentPerfomanceMonitor);\n\t\t// \tthis.currentPerfomanceMonitor = [];\n\t\t// }, 10000);\n\n\t\tthis.serverConfig = serverConfig;\n\t\tthis._wss = wss;\n\n\t\t// Publications\n\t\tloadSuperAdminPublications(this);\n\t\tloadAppStatusPublications(this);\n\t\tloadLogPublications(this);\n\t\tloadFilePublications(this);\n\t\tloadCronJobPublications(this);\n\t\tloadFlagsPublications(this);\n\t\tloadMethodResponsePublications(this);\n\t\tloadNotificationPublications(this);\n\t\tloadReportBuilderReportPublications(this);\n\t\tloadReportBuilderLibraryPublications(this);\n\t\tloadUserGroupPublications(this);\n\t\tloadUserGuidePublications(this);\n\t\tloadReportBuilderDashboardBuilderPublications(this);\n\n\t\tthis.tailOpLog();\n\n\t\tsetInterval(() => {\n\t\t\tthis._oplogRetryCount = 0;\n\t\t}, 15000);\n\n\t\tsetInterval(() => {\n\t\t\tif (this.getEnableDebug()) {\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Subs', this._subscriptions.length);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Logged In Users', this._loggedInUsers.length);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Mongo Queue', this._mongoQueue.length);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Mongo Queue Hits', this._debugMongoQueueHits);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Mongo Queue Collections', JSON.stringify(this._debugMongoQueueCollections.sort((a, b) => a.collection.localeCompare(b.collection) || a.publication.localeCompare(b.publication)), null, 2));\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Oplog Hits', this._debugOplogHits);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Oplog Collections', JSON.stringify(this._debugOplogCollections.sort((a, b) => a.collection.localeCompare(b.collection) || a.type.localeCompare(b.type)), null, 2));\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Send Queue Hits', this._debugSendQueueHits);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Sub Hits', this._debugSubHits);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Sub Collections', JSON.stringify(this._debugSubCollections.sort((a, b) => a.publication.localeCompare(b.publication)), null, 2));\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Unsub Hits', this._debugUnSubHits);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Unsub All Hits', this._debugUnSubAllHits);\n\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Cache Cleanup Hits', this._debugRemoveCacheHits);\n\t\t\t}\n\t\t\t\n\t\t\tthis._debugOplogHits = 0;\n\t\t\tthis._debugOplogCollections = [];\n\t\t\tthis._debugSubCollections = [];\n\t\t\tthis._debugMongoQueueHits = 0;\n\t\t\tthis._debugMongoQueueCollections = [];\n\t\t\tthis._debugSendQueueHits = 0;\n\t\t\tthis._debugSubHits = 0;\n\t\t\tthis._debugUnSubHits = 0;\n\t\t\tthis._debugUnSubAllHits = 0;\n\t\t\tthis._debugRemoveCacheHits = 0;\n\t\t}, 60000);\n\n\t\tsetInterval(async () => {\n\t\t\tif (!this._runningQueue) {\n\t\t\t\tthis._runningQueue = true;\n\n\t\t\t\tif (this._sendQueue.length) {\n\t\t\t\t\t// let startDate = new Date();\n\t\t\t\t\tfor (let i = this._sendQueue.length - 1; i >= 0; i--) {\n\t\t\t\t\t\tthis._debugSendQueueHits += 1;\n\n\t\t\t\t\t\tlet ws = this._mainServer.getWS(this._sendQueue[i].id_ws);\n\t\t\t\t\t\tif (ws && ws.readyState === ws.OPEN) {\n\t\t\t\t\t\t\tif (ws.bufferedAmount < 20480) {\n\t\t\t\t\t\t\t\tlet sendItem = this._sendQueue.pop();\n\t\t\t\t\t\t\t\tws.send(JSON.stringify(sendItem.data), (error) => {\n\t\t\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\t\t\tconsole.log('Error on WS: ', error);\n\t\t\t\t\t\t\t\t\t\tif (this.getEnableDebug()) {\n\t\t\t\t\t\t\t\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Unsub WS', ws['user'], ws['id_socket'], 1);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tthis.unsubscribeAll(ws);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis._sendQueue.splice(i, 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t// \tfunction: 'sendInterval',\n\t\t\t\t\t// \tpublication: '',\n\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t// \tresult: 'Done'\n\t\t\t\t\t// });\n\t\t\t\t}\n\n\t\t\t\tconst queueArr = this._mongoQueue.filter(a => !a.running);\n\t\t\t\tif (queueArr.length) {\n\t\t\t\t\tqueueArr.forEach(entry => {\n\t\t\t\t\t\tentry.running = true;\n\t\t\t\t\t});\n\n\t\t\t\t\tfor (let i = queueArr.length - 1; i >= 0; i--) {\n\t\t\t\t\t\tthis._debugMongoQueueHits += 1;\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet mongoQueue = queueArr[i];\n\n\t\t\t\t\t\tif (!this._debugMongoQueueCollections.some(a => a.collection === mongoQueue.collection && a.publication === mongoQueue.subscription.publication)) {\n\t\t\t\t\t\t\tthis._debugMongoQueueCollections.push({\n\t\t\t\t\t\t\t\tcollection: mongoQueue.collection,\n\t\t\t\t\t\t\t\tpublication: mongoQueue.subscription.publication,\n\t\t\t\t\t\t\t\thits: 1\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis._debugMongoQueueCollections.filter(a => a.collection === mongoQueue.collection && a.publication === mongoQueue.subscription.publication)[0].hits += 1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (this._publications[mongoQueue.subscription.publication].user_specific) {\n\t\t\t\t\t\t\tlet promises = [];\n\t\t\t\t\t\t\tfor (let j = 0; j < mongoQueue.subscription.clients.length; j++) {\n\t\t\t\t\t\t\t\tlet client = mongoQueue.subscription.clients[j];\n\t\t\t\t\t\t\t\tlet ws = this._mainServer.getWS(client.id_socket);\n\t\t\t\t\t\t\t\tif (ws && ws['id_socket'] === client.id_socket) {\n\t\t\t\t\t\t\t\t\tpromises.push(this.sendDataToOne(ws, client.messageId, mongoQueue.subscription, mongoQueue.type, mongoQueue.collection).catch((err) => {\n\t\t\t\t\t\t\t\t\t\tthis._mainServer.getMethodManager().sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + this.serverConfig['CLIENT_NAME'], 'Error Detected During sendDataToOne - User Specific - Socket: ' + client.id_socket + ', User: ' + client.id_user + ', MessageId: ' + client.messageId + ', Pub: ' + mongoQueue.subscription.publication + ', Err: ' + JSON.stringify(err, null, 2));\n\t\t\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tPromise.all(promises).then(() => {\n\t\t\t\t\t\t\t\tif (mongoQueue.run_again) {\n\t\t\t\t\t\t\t\t\tmongoQueue.running = false;\n\t\t\t\t\t\t\t\t\tmongoQueue.run_again = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif (this._mongoQueue.map(a => a._id).indexOf(mongoQueue._id) >= 0) {\n\t\t\t\t\t\t\t\t\t\tthis._mongoQueue.splice(this._mongoQueue.map(a => a._id).indexOf(mongoQueue._id), 1);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis.sendDataToAll(mongoQueue).then(() => {\n\t\t\t\t\t\t\t\tif (mongoQueue.run_again) {\n\t\t\t\t\t\t\t\t\tmongoQueue.running = false;\n\t\t\t\t\t\t\t\t\tmongoQueue.run_again = false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tif (this._mongoQueue.map(a => a._id).indexOf(mongoQueue._id) >= 0) {\n\t\t\t\t\t\t\t\t\t\tthis._mongoQueue.splice(this._mongoQueue.map(a => a._id).indexOf(mongoQueue._id), 1);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}, () => {\n\t\t\t\t\t\t\t\tif (this._mongoQueue.map(a => a._id).indexOf(mongoQueue._id) >= 0) {\n\t\t\t\t\t\t\t\t\tthis._mongoQueue.splice(this._mongoQueue.map(a => a._id).indexOf(mongoQueue._id), 1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t\n\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t// \tfunction: 'mongoQueue',\n\t\t\t\t\t// \tpublication: '',\n\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t// \tresult: 'Done'\n\t\t\t\t\t// });\n\t\t\t\t}\t\n\n\t\t\t\tthis._runningQueue = false;\n\t\t\t}\n\t\t}, 25);\n\n\t\tsetInterval(async () => {\n\t\t\tthis._loggedInUsers = await LoggedInUsers.find();\n\t\n\t\t\tlet userCopy = deepCopy(this._loggedInUsers);\n\t\t\tfor (let i = this._loggedInUsers.length - 1; i >= 0; i--) {\n\t\t\t\tlet loggedInUser = userCopy[i];\n\n\t\t\t\tif (!loggedInUser.date || Date.now() - loggedInUser.date.getTime() > 120000) {\n\t\t\t\t\tif (this._mainServer.getWS(loggedInUser.id_ws)) {\n\t\t\t\t\t\tif (this.getEnableDebug()) {\n\t\t\t\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Unsub WS', this._mainServer.getWS(loggedInUser.id_ws)['user'], this._mainServer.getWS(loggedInUser.id_ws)['id_socket'], 2);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.unsubscribeAll(this._mainServer.getWS(loggedInUser.id_ws));\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis._subscriptions.forEach(sub => {\n\t\t\t\t\t\t\tfor (let j = sub.clients.length - 1; j >= 0; j--) {\n\t\t\t\t\t\t\t\tlet client = sub.clients[j];\n\n\t\t\t\t\t\t\t\tif (client.id_socket === loggedInUser.id_ws) {\n\t\t\t\t\t\t\t\t\tsub.clients.splice(j, 1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tLoggedInUsers.deleteOne({_id: loggedInUser._id});\n\n\t\t\t\t\t\tif (this._loggedInUsers.findIndex(a => a._id === loggedInUser._id) >= 0) {\n\t\t\t\t\t\t\tthis._loggedInUsers.splice(this._loggedInUsers.findIndex(a => a._id === loggedInUser._id), 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < this._subscriptions.length; i++) {\n\t\t\t\tlet sub = this._subscriptions[i];\n\n\t\t\t\tfor (let j = sub.clients.length - 1; j >= 0; j--) {\n\t\t\t\t\tlet client = sub.clients[j];\n\n\t\t\t\t\tif (!this._loggedInUsers.some(a => a.id_ws === client.id_socket)) {\n\t\t\t\t\t\tsub.clients.splice(j, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}, 30000);\n\n\t\tFlags.findOne({type: 'Enable Debug'}).then(flag => {\n\t\t\tif (flag && flag.value) {\n\t\t\t\tthis._enableDebug = true;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis._enableDebug = false;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate addToQueue(mongoQueue: MongoQueueModel) {\n\t\t// let startDate = new Date();\n\n\t\tlet _mongoQueue = this._mongoQueue.filter(a => a.subscription.publication === mongoQueue.subscription.publication && JSON.stringify(a.subscription.subscriptionData) === JSON.stringify(mongoQueue.subscription.subscriptionData))[0];\n\t\t\n\t\tif (_mongoQueue) {\n\t\t\tif (_mongoQueue.running) {\n\t\t\t\t_mongoQueue.run_again = true;\n\n\t\t\t\t// let endDate = new Date();\n\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t// \tfunction: 'addToQueue',\n\t\t\t\t// \tpublication: mongoQueue.subscription.publication,\n\t\t\t\t// // \tsubscriptionData: mongoQueue.subscription.subscriptionData,\n\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t// \tresult: 'Run Again'\n\t\t\t\t// });\n\t\t\t}\n\t\t\t// else {\n\t\t\t// \tlet endDate = new Date();\n\t\t\t// \tthis.currentPerfomanceMonitor.push({\n\t\t\t// \t\t_id: this.idPerformance++,\n\t\t\t// \t\tfunction: 'addToQueue',\n\t\t\t// \t\tpublication: mongoQueue.subscription.publication,\n\t\t\t// // \tsubscriptionData: mongoQueue.subscription.subscriptionData,\n\t\t\t// \t\tsubscriptionData: [],\n\t\t\t// \t\tdate_start: startDate,\n\t\t\t// \t\tdate_end: endDate,\n\t\t\t// \t\tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t// \t\tresult: 'Not Running Yet'\n\t\t\t// \t});\n\t\t\t// }\n\t\t}\n\t\telse {\n\t\t\tmongoQueue._id = this._mongoQueueId;\n\t\t\tthis._mongoQueueId += 1;\n\n\t\t\tthis._mongoQueue.splice(0, 0, mongoQueue);\n\t\t\t\n\t\t\t// let endDate = new Date();\n\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t// \t_id: this.idPerformance++,\n\t\t\t// \tfunction: 'addToQueue',\n\t\t\t// \tpublication: mongoQueue.subscription.publication,\n\t\t\t// // \tsubscriptionData: mongoQueue.subscription.subscriptionData,\n\t\t\t// \tsubscriptionData: [],\n\t\t\t// \tdate_start: startDate,\n\t\t\t// \tdate_end: endDate,\n\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t// \tresult: 'Add to Queue'\n\t\t\t// });\n\t\t}\n\t}\n\n\tpublic invalidatePubsCache(collection, type) {\n\t\t// let startDate = new Date();\n\n\t\tResolveIOServer.getMongoManager().invalidateQueryCache(collection);\n\t\t\n\t\tlet collSubs = this._subscriptions.filter(a => a.collections.includes(collection));\n\n\t\tfor (let i = collSubs.length - 1; i >= 0; i--) {\n\t\t\tlet sub = collSubs[i];\n\t\t\t\n\t\t\tthis.addToQueue({\n\t\t\t\t_id: 0,\n\t\t\t\ttype: type,\n\t\t\t\tcollection: collection,\n\t\t\t\tsubscription: sub,\n\t\t\t\trunning: false,\n\t\t\t\trun_again: false\n\t\t\t});\n\t\t}\n\n\t\t// let endDate = new Date();\n\t\t// this.currentPerfomanceMonitor.push({\n\t\t// \t_id: this.idPerformance++,\n\t\t// \tfunction: 'invalidatePubsCache',\n\t\t// \tpublication: collection,\n\t\t// \tsubscriptionData: [],\n\t\t// \tdate_start: startDate,\n\t\t// \tdate_end: endDate,\n\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t// \tresult: 'Done'\n\t\t// });\n\t}\n\n\t// Add all files to publications private object\n\tpublic publications(method: SubscriptionModel) {\n\t\tthis._publications = Object.assign(this._publications, method);\n\t}\n\n\tpublic loggedInLatency(ws: WebSocket) {\n\t\tlet loggedInUser = this._loggedInUsers.filter(a => a.id_ws === ws['id_socket'])[0];\n\n\t\tif (loggedInUser) {\n\t\t\tloggedInUser.date = new Date();\n\n\t\t\tLoggedInUsers.updateOne({id_ws: ws['id_socket']}, {$set: {latency: ws['latency'], date: loggedInUser.date}}).then(res => {\n\t\t\t\tif (!res) {\n\t\t\t\t\tthis.unsubscribeAll(ws);\n\t\t\t\t\tif (this.getEnableDebug()) {\n\t\t\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Unsub WS', ws['user'], ws['id_socket'], 3);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, () => {\n\t\t\t\tthis.unsubscribeAll(ws);\n\t\t\t\tif (this.getEnableDebug()) {\n\t\t\t\t\tconsole.log(new Date(), 'Sub Manager', 'Unsub WS', ws['user'], ws['id_socket'], 4);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t// Subscribe to publication\n\tpublic subscribe(messageRoute: string, messageDate: Date, ws: WebSocket, messageId: number, publication: string, subscriptionData: any[]) {\n\t\t// let startDate = new Date();\n\t\tthis._debugSubHits += 1;\n\n\t\tif (!this._debugSubCollections.some(a => a.publication === publication)) {\n\t\t\tthis._debugSubCollections.push({\n\t\t\t\tpublication: publication,\n\t\t\t\thits: 1\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthis._debugSubCollections.filter(a => a.publication === publication)[0].hits += 1;\n\t\t}\n\n\t\tlet pub = this._publications[publication];\n\n\t\tif (!pub) {\n\t\t\tconsole.error(new Date(), 'No Publication: ' + publication);\n\t\t\treturn;\n\t\t}\n\t\telse {\n\t\t\tif (subscriptionData.length > 1 || subscriptionData[0]) {\n\t\t\t\tif (!pub.check) {\n\t\t\t\t\tconsole.error(new Date(), 'No Check Function For Pub ' + publication);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse if (!pub.check._schema) {\n\t\t\t\t\tconsole.error(new Date(), 'No Check Schema For Pub ' + publication);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet valObj = {};\n\t\t\t\t\tlet valKeys = Object.keys(pub.check._schema);\n\n\t\t\t\t\tlet rootKeys = valKeys.filter(a => !a.includes('.'));\n\t\t\t\t\t\n\t\t\t\t\tfor (let i = 0; i < subscriptionData.length; i++) {\n\t\t\t\t\t\tvalObj[rootKeys[i]] = subscriptionData[i];\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tpub.check.validate(valObj);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (errors) {\n\t\t\t\t\t\tif (errors) {\n\t\t\t\t\t\t\tconsole.error(new Date(), 'Error in Pub Check (' + publication + ')', errors);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (messageRoute !== 'Bypass') {\n\t\t\t\tlet urlData = messageRoute.split('/');\n\t\t\t\tlet urlModule = '';\n\t\t\t\tlet urlNext = urlData[0];\n\t\t\t\t\n\t\t\t\tif (urlData[0] === '') {\n\t\t\t\t\turlModule = '/';\n\t\t\t\t\turlNext = urlData[1];\n\t\t\t\t}\n\n\t\t\t\turlModule += urlNext;\n\n\t\t\t\tif (urlData.length > 1) {\n\t\t\t\t\turlModule += '/';\n\t\t\t\t}\n\n\t\t\t\tlet otherRouteSubs = this._subscriptions.filter(a => a.clients.some(b => b.id_socket === ws['id_socket'] && b.messageRoute !== 'Bypass' && b.messageRoute !== '/' && b.messageRoute !== messageRoute && !b.messageRoute.startsWith(urlModule)));\n\t\t\t\n\t\t\t\tif (otherRouteSubs.length) {\n\t\t\t\t\tthis._mainServer.getMethodManager().sendEmail('dev@resolveio.com', 'SERVER - Detected Undestroyed Subscription - ' + this.serverConfig['CLIENT_NAME'], 'USER: ' + ws['user'] + ' (Socket: ' + ws['id_socket'] + ') ' + ' is on route: ' + messageRoute + ' but has the following subscriptions on other routes:' + JSON.stringify(otherRouteSubs, null, 2));\n\n\t\t\t\t\totherRouteSubs.forEach(otherSub => {\n\t\t\t\t\t\totherSub.clients.filter(a => a.id_socket === ws['id_socket']).forEach(client => {\n\t\t\t\t\t\t\tthis.unsubscribe(client.messageRoute, new Date(), ws, client.messageId, otherSub.publication, otherSub.subscriptionData);\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet sub = this._subscriptions.filter(a => a.publication === publication && JSON.stringify(a.subscriptionData) === JSON.stringify(subscriptionData))[0];\n\n\t\t\t// If sub found (another user watching same data), add client to same sub\n\t\t\tif (sub) {\n\t\t\t\tif (!sub.clients.some(a => a.id_socket === ws['id_socket'] && a.messageId === messageId)) {\n\t\t\t\t\tsub.clients.push({\n\t\t\t\t\t\tid_user: ws['id_user'],\n\t\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\t\tid_socket: ws['id_socket'],\n\t\t\t\t\t\tmessageRoute: messageRoute\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If sub not found, create new sub\n\t\t\telse {\n\t\t\t\tthis._subscriptions.push({\n\t\t\t\t\tpublication: publication,\n\t\t\t\t\tsubscriptionData: subscriptionData,\n\t\t\t\t\tcollections: this.getPublicationCollections(publication),\n\t\t\t\t\tclients: [{\n\t\t\t\t\t\tid_user: ws['id_user'],\n\t\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\t\tid_socket: ws['id_socket'],\n\t\t\t\t\t\tmessageRoute: messageRoute\n\t\t\t\t\t}],\n\t\t\t\t\tcacheId: 0\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!sub) {\n\t\t\t\tsub = this._subscriptions.filter(a => a.publication === publication && JSON.stringify(a.subscriptionData) === JSON.stringify(subscriptionData))[0];\n\t\t\t}\n\n\t\t\tif (!sub.cacheId && !this._mongoQueue.some(a => a.subscription.publication === sub.publication && JSON.stringify(a.subscription.subscriptionData) === JSON.stringify(sub.subscriptionData))) {\n\t\t\t\tthis.addToQueue({\n\t\t\t\t\t_id: 0,\n\t\t\t\t\ttype: 'newSub',\n\t\t\t\t\tcollection: '',\n\t\t\t\t\tsubscription: sub,\n\t\t\t\t\trunning: false,\n\t\t\t\t\trun_again: false\n\t\t\t\t});\n\n\t\t\t\t// let endDate = new Date();\n\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t// \tfunction: 'subscribe',\n\t\t\t\t// \tpublication: publication,\n\t\t\t\t// // \tsubscriptionData: subscriptionData,\n\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t// \tresult: 'Add to Queue'\n\t\t\t\t// });\n\t\t\t}\n\t\t\telse if (sub.cacheId) {\n\t\t\t\tthis.sendDataToOne(ws, messageId, sub, 'newSub', publication);\n\n\t\t\t\t// let endDate = new Date();\n\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t// \tfunction: 'subscribe',\n\t\t\t\t// \tpublication: publication,\n\t\t\t\t// // \tsubscriptionData: subscriptionData,\n\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t// \tresult: 'Send Pub Data Once'\n\t\t\t\t// });\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic async createLoggedInUser(id_ws: string): Promise<LoggedInUserModel> {\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\tlet ws = this._mainServer.getWS(id_ws);\n\n\t\t\tif (ws) {\n\t\t\t\tlet user = {\n\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tdate: new Date(),\n\t\t\t\t\tid_user: ws['id_user'],\n\t\t\t\t\tuser: ws['user'],\n\t\t\t\t\tid_ws: ws['id_socket']\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\tthis._loggedInUsers.push(user);\n\t\t\t\tLoggedInUsers.insertOne(user);\n\t\t\t\t\n\t\t\t\tresolve(user);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tresolve(null);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Unsubscribe from publication \n\tpublic unsubscribe(messageRoute: string, messageDate: Date, ws: WebSocket, messageId: number, publication: string, subscriptionData: any[]) {\n\t\tthis._debugUnSubHits += 1;\n\t\t// let startDate = new Date();\n\t\t// console.log('Before');\n\t\t// console.dir(this._subscriptions.map(a => a.publication));\n\n\t\tif (!this._publications[publication]) {\n\t\t\tconsole.log('No Publication: ' + publication);\n\t\t\treturn;\n\t\t}\n\t\telse {\n\t\t\tlet sub = this._subscriptions.filter(a => a.publication === publication && JSON.stringify(a.subscriptionData) === JSON.stringify(subscriptionData))[0];\n\n\t\t\tif (sub) {\n\t\t\t\tfor (let i = sub.clients.length - 1; i >= 0; i--) {\n\t\t\t\t\tif (sub.clients[i].id_user === ws['id_user'] && sub.clients[i].messageId === messageId && sub.clients[i].id_socket === ws['id_socket']) {\n\t\t\t\t\t\tsub.clients.splice(i, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// let endDate = new Date();\n\t\t// this.currentPerfomanceMonitor.push({\n\t\t// \t_id: this.idPerformance++,\n\t\t// \tfunction: 'unsubscribe',\n\t\t// \tpublication: publication,\n\t\t// // \tsubscriptionData: subscriptionData,\n\t\t// \tsubscriptionData: [],\n\t\t// \tdate_start: startDate,\n\t\t// \tdate_end: endDate,\n\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t// \tresult: 'Done'\n\t\t// });\n\t}\n\n\t// Unsubscribe from publication\n\tpublic async unsubscribeAll(ws: WebSocket) {\n\t\tthis._debugUnSubAllHits += 1;\n\t\t// console.log('Before');\n\t\t// console.dir(this._subscriptions.map(a => a.publication));\n\n\t\t// let startDate = new Date();\n\n\t\tif (ws) {\n\t\t\tlet loggedInUser = await LoggedInUsers.findOne({id_ws: ws['id_socket']});\n\n\t\t\tif (loggedInUser) {\t\n\t\t\t\tif (this._loggedInUsers.map(a => a._id).indexOf(loggedInUser._id) >= 0) {\n\t\t\t\t\tthis._loggedInUsers.splice(this._loggedInUsers.map(a => a._id).indexOf(loggedInUser._id), 1);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tLoggedInUsers.deleteOne({_id: loggedInUser._id});\n\t\t\t}\n\n\t\t\tlet userSubs = this._subscriptions.filter(a => a.clients.some(b => b.id_user === ws['id_user'] && b.id_socket === ws['id_socket']));\n\n\t\t\tfor (let i = userSubs.length - 1; i >= 0; i--) {\n\t\t\t\tlet sub = userSubs[i];\n\n\t\t\t\tfor (let j = sub.clients.length - 1; j >= 0; j--) {\n\t\t\t\t\tif (sub.clients[j].id_socket === ws['id_socket']) {\n\t\t\t\t\t\tsub.clients.splice(j, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tws.close();\n\n\t\t\tprocess.nextTick(() => {\n\t\t\t\tif ([ws.OPEN, ws.CLOSING].includes(<any>ws.readyState)) {\n\t\t\t\t\t// Socket still hangs, hard close\n\t\t\t\t\tws.terminate();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// let endDate = new Date();\n\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t// \t_id: this.idPerformance++,\n\t\t\t// \tfunction: 'unsubscribeAll',\n\t\t\t// \tpublication: '',\n\t\t\t// \tsubscriptionData: [],\n\t\t\t// \tdate_start: startDate,\n\t\t\t// \tdate_end: endDate,\n\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t// \tresult: 'Done'\n\t\t\t// });\n\t\t}\n\n\t\t// console.log('After');\n\t\t// console.dir(this._subscriptions.map(a => a.publication));\n\t}\n\n\tpublic getActiveSubscriptions() {\n\t\treturn this._subscriptions;\n\t}\n\n\t// Get publication collection\n\tprivate getPublicationCollections(publication: string) {\n\t\treturn this._publications[publication].collections;\n\t}\n\n\t// Watch (tail) Mongo's operation log on the entire database (all insert/modify/delete will trigger this function)\n\tprivate tailOpLog(resumeToken?: ResumeToken) {\n\t\tif (!this._oplog || this._oplog.closed) {\n\t\t\tthis._oplogRetryCount += 1;\n\n\t\t\tif (this._oplogRetryCount > 10) {\n\t\t\t\tconsole.error('****************** TAIL OPLOG ERROR, RETRYING A BUNCH OF TIMES, KILLING PROCESS **************************')\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tlet lastResumeToken: ResumeToken;\n\n\t\t\tif (resumeToken) {\n\t\t\t\tlastResumeToken = resumeToken;\n\t\t\t\ttry {\n\t\t\t\t\tthis._oplog = ResolveIOServer.getMainDB().watch([], {resumeAfter: resumeToken});\n\t\t\t\t}\n\t\t\t\tcatch(errOp) {\n\t\t\t\t\tif (this._oplog && !this._oplog.closed) {\n\t\t\t\t\t\tthis._oplog.close();\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis._oplog = ResolveIOServer.getMainDB().watch();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis._oplog = ResolveIOServer.getMainDB().watch();\n\t\t\t}\n\n\t\t\tconsole.log(new Date(), 'oplog started');\n\n\t\t\tthis._oplog.on('change', (doc: ChangeStreamInsertDocument | ChangeStreamUpdateDocument | ChangeStreamReplaceDocument | ChangeStreamDeleteDocument) => {\n\t\t\t\t// let startDate = new Date();\n\n\t\t\t\tif (doc.ns) {\n\t\t\t\t\tlet collection = doc.ns.coll;\n\n\t\t\t\t\tif (!this._debugOplogCollections.some(a => a.collection === doc.ns.coll && a.type === doc.operationType)) {\n\t\t\t\t\t\tthis._debugOplogCollections.push({\n\t\t\t\t\t\t\tcollection: doc.ns.coll,\n\t\t\t\t\t\t\ttype: doc.operationType,\n\t\t\t\t\t\t\thits: 1\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis._debugOplogCollections.filter(a => a.collection === doc.ns.coll && a.type === doc.operationType)[0].hits += 1;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// console.log(new Date(), 'Op log doc', doc.operationType, collection);\n\n\t\t\t\t\tif (collection && !collection.endsWith('.versions') && !collection.startsWith('monitor-') && collection !== 'logs' && collection !== 'log-method-latencies' && collection !== 'log-subscriptions') {\n\t\t\t\t\t\tthis._debugOplogHits += 1;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (doc.operationType === 'insert') {\n\t\t\t\t\t\t\tif (collection === 'support-tickets') {\n\t\t\t\t\t\t\t\tif (this.serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\t\t\t\t\t\tthis._mainServer.getMethodManager().callMethodInternal.call(this._mainServer.getMethodManager(), 'sendSupportTicketEmail', doc.documentKey['_id']);\n\t\t\t\t\t\t\t\t\tthis.invalidatePubsCache(collection, 'insert');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (collection !== 'method-responses') {\n\t\t\t\t\t\t\t\tthis.invalidatePubsCache(collection, 'insert');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t\t\t// \tfunction: 'oplog',\n\t\t\t\t\t\t\t// \tpublication: collection,\n\t\t\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t\t\t// \tresult: 'Insert'\n\t\t\t\t\t\t\t// });\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (doc.operationType === 'update' || doc.operationType === 'replace') {\n\t\t\t\t\t\t\tif (collection !== 'method-responses') {\n\t\t\t\t\t\t\t\tthis.invalidatePubsCache(collection, 'update');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t\t\t// \tfunction: 'oplog',\n\t\t\t\t\t\t\t// \tpublication: collection,\n\t\t\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t\t\t// \tresult: 'Update'\n\t\t\t\t\t\t\t// });\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (doc.operationType === 'delete') {\n\t\t\t\t\t\t\tif (collection !== 'method-responses') {\n\t\t\t\t\t\t\t\tthis.invalidatePubsCache(collection, 'delete');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t\t\t// \tfunction: 'oplog',\n\t\t\t\t\t\t\t// \tpublication: collection,\n\t\t\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t\t\t// \tresult: 'Delete'\n\t\t\t\t\t\t\t// });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (collection === 'flags') {\n\t\t\t\t\t\tFlags.findOne({type: 'Enable Debug'}).then(flag => {\n\t\t\t\t\t\t\tif (flag && flag.value) {\n\t\t\t\t\t\t\t\tthis._enableDebug = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tthis._enableDebug = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tlastResumeToken = doc._id;\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\tthis._oplog.on('error', error => {\n\t\t\t\tconsole.log(new Date(), 'oplog error', error);\n\t\t\t\tthis._oplog.close();\n\t\t\t});\n\n\t\t\tthis._oplog.on('end', () => {\n\t\t\t\tconsole.log(new Date(), 'oplog end');\n\t\t\t\tthis._oplog.close();\n\t\t\t});\n\n\t\t\tthis._oplog.on('close', () => {\n\t\t\t\tthis._oplog = null;\n\n\t\t\t\tconsole.log(new Date(), 'oplog close');\n\t\t\t\tthis.tailOpLog(lastResumeToken);\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthis._oplog.close();\n\t\t}\n\t}\n\n\t// Fetch pub once, send to all clients linked to this pub\n\tprivate sendDataToOne(ws: WebSocket, messageId: number, subscription: ActiveSubscriptionModel, type: string, collection: string) {\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t// let startDate = new Date();\n\n\t\t\tif (!this._publications[subscription.publication].user_specific) { // Same pub for all users\n\t\t\t\tif (subscription.cacheId) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet cacheData = JSON.parse(this._nodeCache.get(subscription.cacheId), dateReviver);\n\n\t\t\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: cacheData\n\t\t\t\t\t\t};\n\t\n\t\t\t\t\t\tthis.sendWS(ws, serverRes);\n\t\t\t\t\t}\n\t\t\t\t\tcatch(err) {\n\t\t\t\t\t\tthis._nodeCache.del(subscription.cacheId);\n\t\t\t\t\t\tsubscription.cacheId = 0;\n\n\t\t\t\t\t\tthis.addToQueue({\n\t\t\t\t\t\t\t_id: 0,\n\t\t\t\t\t\t\ttype: 'newSub',\n\t\t\t\t\t\t\tcollection: '',\n\t\t\t\t\t\t\tsubscription: subscription,\n\t\t\t\t\t\t\trunning: false,\n\t\t\t\t\t\t\trun_again: false\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t// \tfunction: 'sendDataToOne',\n\t\t\t\t\t// \tpublication: subscription.publication,\n\t\t\t\t\t// // \tsubscriptionData: subscription.subscriptionData,\n\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t// \tresult: 'Send cache'\n\t\t\t\t\t// });\n\n\t\t\t\t\tresolve(true);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis._mainServer.getMethodManager().sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + this.serverConfig['CLIENT_NAME'], 'Error Detected During sendDataToOne - No Cache! - ' + subscription.publication + '\\n\\nData \\n' + JSON.stringify(subscription.subscriptionData, null, 2));\n\n\t\t\t\t\tresolve(false);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse { // Pub is different for each user (Look at users publication) [MUCH SLOWER, RE-RUNS FOR EACH USER]\n\t\t\t\tlet monitor = this._monitorManagerFunction.startMonitorFunction('User Specific Publication', subscription.publication, '', '', subscription.subscriptionData);\n\t\t\t\tthis._publications[subscription.publication].function.call(Object.assign({}, this, SubscriptionManager.prototype), ws['id_user'], ...subscription.subscriptionData)\n\t\t\t\t.then(res => {\n\t\t\t\t\tthis._monitorManagerFunction.finishMonitorFunction(monitor);\n\t\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\tdata: res\n\t\t\t\t\t};\n\n\t\t\t\t\t// console.log('Send Pub Data Once 2', new Date(), 'Success', subscription);\n\n\t\t\t\t\tthis.sendWS(ws, serverRes);\n\n\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t// \tfunction: 'sendDataToOne',\n\t\t\t\t\t// \tpublication: subscription.publication,\n\t\t\t\t\t// // \tsubscriptionData: subscription.subscriptionData,\n\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t// \tresult: 'Send ws spec data'\n\t\t\t\t\t// });\n\n\t\t\t\t\tresolve(true);\n\n\t\t\t\t}, err => {\n\t\t\t\t\tthis._monitorManagerFunction.finishMonitorFunction(monitor);\n\t\t\t\t\t\n\t\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\t\thasError: true,\n\t\t\t\t\t\tdata: err\n\t\t\t\t\t};\n\n\t\t\t\t\t// console.log('Send Pub Data Once 2', new Date(), 'Error', subscription);\n\n\t\t\t\t\tthis.sendWS(ws, serverRes);\n\n\t\t\t\t\tthis._mainServer.getMethodManager().sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + this.serverConfig['CLIENT_NAME'], 'Error Detected During Subscription ' + subscription.publication + ' - (sendDataToOne - WS)\\n\\nData \\n' + JSON.stringify(subscription.subscriptionData, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(err, null, 2));\n\n\t\t\t\t\treject(err);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\t// Fetch pub once, send to all clients linked to this pub\n\tprivate sendDataToAll(mongoQueue: MongoQueueModel) {\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t// let startDate = new Date();\n\t\t\tif (!mongoQueue.subscription.clients.length) {\t\t\t\t\n\t\t\t\tif (mongoQueue.subscription.cacheId) {\n\t\t\t\t\tthis._nodeCache.del(mongoQueue.subscription.cacheId);\n\t\t\t\t}\n\n\t\t\t\tif (this._subscriptions.findIndex(a => a.publication === mongoQueue.subscription.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(mongoQueue.subscription.subscriptionData)) >= 0) {\n\t\t\t\t\tthis._subscriptions.splice(this._subscriptions.findIndex(a => a.publication === mongoQueue.subscription.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(mongoQueue.subscription.subscriptionData)), 1);\n\t\t\t\t}\n\n\t\t\t\tresolve(false);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (mongoQueue.subscription.publication !== 'superadminAPM' && mongoQueue.subscription.publication !== 'loggedInUsers') {\n\t\t\t\t\tthis._mainServer.getMethodManager().callMethodInternal.call(this._mainServer.getMethodManager(), 'insertSubscriptionLog', mongoQueue.type, mongoQueue.subscription.publication, mongoQueue.collection, JSON.stringify(mongoQueue.subscription.subscriptionData));\n\t\t\t\t}\n\n\t\t\t\tlet monitor = this._monitorManagerFunction.startMonitorFunction('Publication', mongoQueue.subscription.publication, '', '', mongoQueue.subscription.subscriptionData);\n\t\t\t\tthis._publications[mongoQueue.subscription.publication].function.call(Object.assign({}, this, SubscriptionManager.prototype), ...mongoQueue.subscription.subscriptionData)\n\t\t\t\t.then(res => {\n\t\t\t\t\tthis._monitorManagerFunction.finishMonitorFunction(monitor);\n\t\t\t\t\tif (!mongoQueue.subscription.clients.length) {\n\t\t\t\t\t\tlet nodeCacheSize = this._nodeCache.getStats().vsize;\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (nodeCacheSize > this._heapLimit) {\n\t\t\t\t\t\t\tlet deleteCount = 0;\n\n\t\t\t\t\t\t\tconst subArr = this._subscriptions.filter(a => a.cacheId && !a.clients.length);\n\n\t\t\t\t\t\t\tfor (let zz = 0; zz < subArr.length; zz++) {\n\t\t\t\t\t\t\t\tthis._debugRemoveCacheHits += 1;\n\n\t\t\t\t\t\t\t\tthis._nodeCache.del(subArr[zz].cacheId);\n\t\t\t\t\t\t\t\tsubArr[zz].cacheId = 0;\n\n\t\t\t\t\t\t\t\tdeleteCount += 1;\n\n\t\t\t\t\t\t\t\tnodeCacheSize = this._nodeCache.getStats().vsize;\n\n\t\t\t\t\t\t\t\tif (nodeCacheSize < this._heapLimit * 0.75) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tconsole.log('Sub Cache: ' + 'Too Big - ' + mongoQueue.subscription.publication + ' - Deleted: ' + deleteCount + ' - ' + nodeCacheSize);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (mongoQueue.subscription.cacheId) {\n\t\t\t\t\t\t\tthis._nodeCache.del(mongoQueue.subscription.cacheId);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet cacheId = this._cacheId;\n\t\t\t\t\t\tthis._cacheId += 1;\n\n\t\t\t\t\t\tthis._nodeCache.set(cacheId, JSON.stringify(res));\n\t\t\t\t\t\tmongoQueue.subscription.cacheId = cacheId;\n\n\t\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t\t// \tfunction: 'sendPubData',\n\t\t\t\t\t\t// \tpublication: subscription.publication,\n\t\t\t\t\t\t// // \tsubscriptionData: subscription.subscriptionData,\n\t\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t\t// \tresult: 'No clients'\n\t\t\t\t\t\t// });\n\n\t\t\t\t\t\tresolve(false);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (!mongoQueue.subscription.cacheId || this._nodeCache.get(mongoQueue.subscription.cacheId) !== JSON.stringify(res)) {\n\t\t\t\t\t\t\tmongoQueue.subscription.clients.forEach(client => {\n\t\t\t\t\t\t\t\tlet ws = this._mainServer.getWS(client.id_socket);\n\n\t\t\t\t\t\t\t\tif (ws) {\n\t\t\t\t\t\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\t\t\t\t\t\tmessageId: client.messageId,\n\t\t\t\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\t\t\t\tdata: res\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\n\t\t\t\t\t\t\t\t\tthis.sendWS(ws, serverRes);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\n\t\t\t\t\t\t\tlet nodeCacheSize = this._nodeCache.getStats().vsize;\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (nodeCacheSize > this._heapLimit) {\n\t\t\t\t\t\t\t\tlet deleteCount = 0;\n\n\t\t\t\t\t\t\t\tconst subArr = this._subscriptions.filter(a => a.cacheId && !a.clients.length);\n\t\n\t\t\t\t\t\t\t\tfor (let zz = 0; zz < subArr.length; zz++) {\n\t\t\t\t\t\t\t\t\tthis._nodeCache.del(subArr[zz].cacheId);\n\t\t\t\t\t\t\t\t\tsubArr[zz].cacheId = 0;\n\t\n\t\t\t\t\t\t\t\t\tdeleteCount += 1;\n\n\t\t\t\t\t\t\t\t\tnodeCacheSize = this._nodeCache.getStats().vsize;\n\t\n\t\t\t\t\t\t\t\t\tif (nodeCacheSize < this._heapLimit * 0.75) {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tconsole.log('Sub Cache: ' + 'Too Big - ' + mongoQueue.subscription.publication + ' - Deleted: ' + deleteCount + ' - ' + nodeCacheSize);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (mongoQueue.subscription.cacheId) {\n\t\t\t\t\t\t\t\tthis._nodeCache.del(mongoQueue.subscription.cacheId);\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\tlet cacheId = this._cacheId;\n\t\t\t\t\t\t\tthis._cacheId += 1;\n\n\t\t\t\t\t\t\tthis._nodeCache.set(cacheId, JSON.stringify(res));\n\t\t\t\t\t\t\tmongoQueue.subscription.cacheId = cacheId;\n\n\t\t\t\t\t\t\t// let endDate = new Date();\n\t\t\t\t\t\t\t// this.currentPerfomanceMonitor.push({\n\t\t\t\t\t\t\t// \t_id: this.idPerformance++,\n\t\t\t\t\t\t\t// \tfunction: 'sendPubData',\n\t\t\t\t\t\t\t// \tpublication: subscription.publication,\n\t\t\t\t\t\t\t// // \tsubscriptionData: subscription.subscriptionData,\n\t\t\t\t\t\t\t// \tsubscriptionData: [],\n\t\t\t\t\t\t\t// \tdate_start: startDate,\n\t\t\t\t\t\t\t// \tdate_end: endDate,\n\t\t\t\t\t\t\t// \tduration: moment(endDate).diff(moment(startDate), 'milliseconds', false),\n\t\t\t\t\t\t\t// \tresult: 'Same data'\n\t\t\t\t\t\t\t// });\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t}\n\t\t\t\t}, err => {\n\t\t\t\t\tthis._monitorManagerFunction.finishMonitorFunction(monitor);\n\t\t\t\t\tthis._mainServer.getMethodManager().sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + this.serverConfig['CLIENT_NAME'], 'Error Detected During Subscription ' + mongoQueue.subscription.publication + ' - (sendPubData)\\n\\nData \\n' + JSON.stringify(mongoQueue.subscription.subscriptionData, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(err, null, 2));\n\n\t\t\t\t\tmongoQueue.subscription.clients.forEach(client => {\n\t\t\t\t\t\tlet ws = this._mainServer.getWS(client.id_socket);\n\n\t\t\t\t\t\tif (ws) {\n\t\t\t\t\t\t\tif (ws['id_socket'] === client.id_socket) {\n\t\t\t\t\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\t\t\t\t\tmessageId: client.messageId,\n\t\t\t\t\t\t\t\t\thasError: true,\n\t\t\t\t\t\t\t\t\tdata: err\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tthis.sendWS(ws, serverRes);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treject(err);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate sendWS(ws: WebSocket, data: ServerResponseModel) {\n\t\tthis._sendQueue.splice(0, 0, {\n\t\t\tid_ws: ws['id_socket'],\n\t\t\tdata: data\n\t\t});\n\t}\n\n\tpublic getEnableDebug() {\n\t\treturn this._enableDebug;\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,52 +1,24 @@
1
- import { parentPort } from 'worker_threads';
2
-
3
- interface CurrentPerformanceMonitor {
4
- _id: number;
5
- function: string;
6
- publication: string;
7
- subscriptionData: any[];
8
- date_start: Date;
9
- date_end: Date;
10
- duration: number;
11
- result: string;
12
- }
13
-
14
- interface TotalPerformanceMonitor {
15
- function: string;
16
- publication: string;
17
- subscriptionData: any[];
18
- data: CurrentPerformanceMonitor[];
19
- duration_total_max: number;
20
- duration_total_min: number;
21
- duration_total_avg: number;
22
- hits_total: number;
23
- duration_current_max: number;
24
- duration_current_min: number;
25
- duration_current_avg: number;
26
- hits_current: number;
27
- }
28
-
29
- let totalPerfomanceMonitor: TotalPerformanceMonitor[] = [];
30
-
31
- parentPort.on('message', msg => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var worker_threads_1 = require("worker_threads");
4
+ var totalPerfomanceMonitor = [];
5
+ worker_threads_1.parentPort.on('message', function (msg) {
32
6
  console.log('Recv Msg');
33
- processMsg(msg);
7
+ processMsg(msg);
34
8
  });
35
-
36
- function processMsg(msg: CurrentPerformanceMonitor[]) {
37
- if (totalPerfomanceMonitor.length) {
38
- totalPerfomanceMonitor.forEach(total => {
39
- let currents = msg.filter(a => a.function === total.function && a.publication === total.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(total.subscriptionData));
40
-
9
+ function processMsg(msg) {
10
+ if (totalPerfomanceMonitor.length) {
11
+ totalPerfomanceMonitor.forEach(function (total) {
12
+ var currents = msg.filter(function (a) { return a.function === total.function && a.publication === total.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(total.subscriptionData); });
41
13
  if (currents.length) {
42
14
  total.data = total.data.concat(currents);
43
- total.duration_total_max = Math.max(...total.data.map(a => a.duration));
44
- total.duration_total_min = Math.min(...total.data.map(a => a.duration));
45
- total.duration_total_avg = Math.round(total.data.map(a => a.duration).reduce((a, b) => a + b, 0) / total.data.length);
15
+ total.duration_total_max = Math.max.apply(Math, total.data.map(function (a) { return a.duration; }));
16
+ total.duration_total_min = Math.min.apply(Math, total.data.map(function (a) { return a.duration; }));
17
+ total.duration_total_avg = Math.round(total.data.map(function (a) { return a.duration; }).reduce(function (a, b) { return a + b; }, 0) / total.data.length);
46
18
  total.hits_total = total.data.length;
47
- total.duration_current_max = Math.max(...currents.map(a => a.duration));
48
- total.duration_current_min = Math.min(...currents.map(a => a.duration));
49
- total.duration_current_avg = Math.round(currents.map(a => a.duration).reduce((a, b) => a + b, 0) / currents.length);
19
+ total.duration_current_max = Math.max.apply(Math, currents.map(function (a) { return a.duration; }));
20
+ total.duration_current_min = Math.min.apply(Math, currents.map(function (a) { return a.duration; }));
21
+ total.duration_current_avg = Math.round(currents.map(function (a) { return a.duration; }).reduce(function (a, b) { return a + b; }, 0) / currents.length);
50
22
  total.hits_current = currents.length;
51
23
  }
52
24
  else {
@@ -55,14 +27,12 @@ function processMsg(msg: CurrentPerformanceMonitor[]) {
55
27
  total.duration_current_avg = 0;
56
28
  total.hits_current = 0;
57
29
  }
58
-
59
- currents.forEach(current => {
60
- msg.splice(msg.findIndex(a => a._id === current._id), 1);
30
+ currents.forEach(function (current) {
31
+ msg.splice(msg.findIndex(function (a) { return a._id === current._id; }), 1);
61
32
  });
62
33
  });
63
-
64
- msg.forEach(entry => {
65
- let total = totalPerfomanceMonitor.filter(a => a.function === entry.function && a.publication === entry.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(entry.subscriptionData))[0];
34
+ msg.forEach(function (entry) {
35
+ var total = totalPerfomanceMonitor.filter(function (a) { return a.function === entry.function && a.publication === entry.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(entry.subscriptionData); })[0];
66
36
  if (total) {
67
37
  total.data.push(entry);
68
38
  }
@@ -85,8 +55,8 @@ function processMsg(msg: CurrentPerformanceMonitor[]) {
85
55
  });
86
56
  }
87
57
  else {
88
- msg.forEach(entry => {
89
- let total = totalPerfomanceMonitor.filter(a => a.function === entry.function && a.publication === entry.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(entry.subscriptionData))[0];
58
+ msg.forEach(function (entry) {
59
+ var total = totalPerfomanceMonitor.filter(function (a) { return a.function === entry.function && a.publication === entry.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(entry.subscriptionData); })[0];
90
60
  if (total) {
91
61
  total.data.push(entry);
92
62
  }
@@ -107,32 +77,27 @@ function processMsg(msg: CurrentPerformanceMonitor[]) {
107
77
  });
108
78
  }
109
79
  });
110
-
111
- totalPerfomanceMonitor.forEach(total => {
112
- total.duration_total_max = Math.max(...total.data.map(a => a.duration));
113
- total.duration_total_min = Math.min(...total.data.map(a => a.duration));
114
- total.duration_total_avg = Math.round(total.data.map(a => a.duration).reduce((a, b) => a + b, 0) / total.data.length);
80
+ totalPerfomanceMonitor.forEach(function (total) {
81
+ total.duration_total_max = Math.max.apply(Math, total.data.map(function (a) { return a.duration; }));
82
+ total.duration_total_min = Math.min.apply(Math, total.data.map(function (a) { return a.duration; }));
83
+ total.duration_total_avg = Math.round(total.data.map(function (a) { return a.duration; }).reduce(function (a, b) { return a + b; }, 0) / total.data.length);
115
84
  total.hits_total = total.data.length;
116
- total.duration_current_max = Math.max(...total.data.map(a => a.duration));
117
- total.duration_current_min = Math.min(...total.data.map(a => a.duration));
118
- total.duration_current_avg = Math.round(total.data.map(a => a.duration).reduce((a, b) => a + b, 0) / total.data.length);
85
+ total.duration_current_max = Math.max.apply(Math, total.data.map(function (a) { return a.duration; }));
86
+ total.duration_current_min = Math.min.apply(Math, total.data.map(function (a) { return a.duration; }));
87
+ total.duration_current_avg = Math.round(total.data.map(function (a) { return a.duration; }).reduce(function (a, b) { return a + b; }, 0) / total.data.length);
119
88
  total.hits_current = total.data.length;
120
89
  });
121
90
  }
122
-
123
91
  console.log('---------------------------------------------------------------------------------');
124
92
  console.log('---------------------------------------------------------------------------------');
125
-
126
93
  console.log('Performance', new Date());
127
94
  console.log('---------------------------------------------------------------------------------');
128
-
129
-
130
95
  console.log('Function, Publication, Hits Total, Dur Tot Max, Dur Tot Min, Dur Tot Avg, Hits Current, Dur Curr Max, Dur Curr Min, Dur Curr Avg, Sub Data');
131
-
132
- totalPerfomanceMonitor.sort((a, b) => b.hits_total - a.hits_total).forEach(total => {
96
+ totalPerfomanceMonitor.sort(function (a, b) { return b.hits_total - a.hits_total; }).forEach(function (total) {
133
97
  console.log(total.function + ',' + total.publication + ',' + total.hits_total + ',' + total.duration_total_max + ',' + total.duration_total_min + ',' + total.duration_total_avg + ',' + total.hits_current + ',' + total.duration_current_max + ',' + total.duration_current_min + ',' + total.duration_current_avg + ',' + JSON.stringify(total.subscriptionData));
134
98
  });
135
-
136
99
  console.log('---------------------------------------------------------------------------------');
137
100
  console.log('---------------------------------------------------------------------------------');
138
- }
101
+ }
102
+
103
+ //# sourceMappingURL=subscription.performance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/managers/subscription.performance.ts"],"names":[],"mappings":";;AAAA,iDAA4C;AA4B5C,IAAI,sBAAsB,GAA8B,EAAE,CAAC;AAE3D,2BAAU,CAAC,EAAE,CAAC,SAAS,EAAE,UAAA,GAAG;IACxB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC3B,UAAU,CAAC,GAAG,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,SAAS,UAAU,CAAC,GAAgC;IACnD,IAAI,sBAAsB,CAAC,MAAM,EAAE;QAC5B,sBAAsB,CAAC,OAAO,CAAC,UAAA,KAAK;YAChC,IAAI,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAArJ,CAAqJ,CAAC,CAAC;YAEtL,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACjB,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACzC,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,QAAQ,EAAV,CAAU,CAAC,CAAC,CAAC;gBACxE,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,KAAK,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CAAC,IAAI,CAAC,MAAM,CAAC;QAC3C,CAAC,CAAC,CAAC;KACN;IAED,OAAO,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAC;IACjG,OAAO,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAC;IAEjG,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAC;IAGjG,OAAO,CAAC,GAAG,CAAC,4IAA4I,CAAC,CAAC;IAE1J,sBAAsB,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,EAA3B,CAA2B,CAAC,CAAC,OAAO,CAAC,UAAA,KAAK;QAC5E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,GAAG,KAAK,CAAC,WAAW,GAAG,GAAG,GAAG,KAAK,CAAC,UAAU,GAAG,GAAG,GAAG,KAAK,CAAC,kBAAkB,GAAG,GAAG,GAAG,KAAK,CAAC,kBAAkB,GAAG,GAAG,GAAG,KAAK,CAAC,kBAAkB,GAAG,GAAG,GAAG,KAAK,CAAC,YAAY,GAAG,GAAG,GAAG,KAAK,CAAC,oBAAoB,GAAG,GAAG,GAAG,KAAK,CAAC,oBAAoB,GAAG,GAAG,GAAG,KAAK,CAAC,oBAAoB,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACzW,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAC;IACjG,OAAO,CAAC,GAAG,CAAC,mFAAmF,CAAC,CAAC;AACrG,CAAC","file":"subscription.performance.js","sourcesContent":["import { parentPort } from 'worker_threads';\n\ninterface CurrentPerformanceMonitor {\n\t_id: number;\n\tfunction: string;\n\tpublication: string;\n\tsubscriptionData: any[];\n\tdate_start: Date;\n\tdate_end: Date;\n\tduration: number;\n\tresult: string;\n}\n\ninterface TotalPerformanceMonitor {\n\tfunction: string;\n\tpublication: string;\n\tsubscriptionData: any[];\n\tdata: CurrentPerformanceMonitor[];\n\tduration_total_max: number;\n\tduration_total_min: number;\n\tduration_total_avg: number;\n\thits_total: number;\n\tduration_current_max: number;\n\tduration_current_min: number;\n\tduration_current_avg: number;\n\thits_current: number;\n}\n\nlet totalPerfomanceMonitor: TotalPerformanceMonitor[] = [];\n\nparentPort.on('message', msg => {\n console.log('Recv Msg');\n\tprocessMsg(msg);\n});\n\nfunction processMsg(msg: CurrentPerformanceMonitor[]) {\n\tif (totalPerfomanceMonitor.length) {\n totalPerfomanceMonitor.forEach(total => {\n let currents = msg.filter(a => a.function === total.function && a.publication === total.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(total.subscriptionData));\n\n if (currents.length) {\n total.data = total.data.concat(currents);\n total.duration_total_max = Math.max(...total.data.map(a => a.duration));\n total.duration_total_min = Math.min(...total.data.map(a => a.duration));\n total.duration_total_avg = Math.round(total.data.map(a => a.duration).reduce((a, b) => a + b, 0) / total.data.length);\n total.hits_total = total.data.length;\n total.duration_current_max = Math.max(...currents.map(a => a.duration));\n total.duration_current_min = Math.min(...currents.map(a => a.duration));\n total.duration_current_avg = Math.round(currents.map(a => a.duration).reduce((a, b) => a + b, 0) / currents.length);\n total.hits_current = currents.length;\n }\n else {\n total.duration_current_max = 0;\n total.duration_current_min = 0;\n total.duration_current_avg = 0;\n total.hits_current = 0;\n }\n\n currents.forEach(current => {\n msg.splice(msg.findIndex(a => a._id === current._id), 1);\n });\n });\n\n msg.forEach(entry => {\n let total = totalPerfomanceMonitor.filter(a => a.function === entry.function && a.publication === entry.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(entry.subscriptionData))[0];\n if (total) {\n total.data.push(entry);\n }\n else {\n totalPerfomanceMonitor.push({\n function: entry.function,\n publication: entry.publication,\n subscriptionData: entry.subscriptionData,\n data: [entry],\n duration_total_max: 0,\n duration_total_min: 0,\n duration_total_avg: 0,\n hits_total: 0,\n duration_current_max: 0,\n duration_current_min: 0,\n duration_current_avg: 0,\n hits_current: 0\n });\n }\n });\n }\n else {\n msg.forEach(entry => {\n let total = totalPerfomanceMonitor.filter(a => a.function === entry.function && a.publication === entry.publication && JSON.stringify(a.subscriptionData) === JSON.stringify(entry.subscriptionData))[0];\n if (total) {\n total.data.push(entry);\n }\n else {\n totalPerfomanceMonitor.push({\n function: entry.function,\n publication: entry.publication,\n subscriptionData: entry.subscriptionData,\n data: [entry],\n duration_total_max: 0,\n duration_total_min: 0,\n duration_total_avg: 0,\n hits_total: 0,\n duration_current_max: 0,\n duration_current_min: 0,\n duration_current_avg: 0,\n hits_current: 0\n });\n }\n });\n\n totalPerfomanceMonitor.forEach(total => {\n total.duration_total_max = Math.max(...total.data.map(a => a.duration));\n total.duration_total_min = Math.min(...total.data.map(a => a.duration));\n total.duration_total_avg = Math.round(total.data.map(a => a.duration).reduce((a, b) => a + b, 0) / total.data.length);\n total.hits_total = total.data.length;\n total.duration_current_max = Math.max(...total.data.map(a => a.duration));\n total.duration_current_min = Math.min(...total.data.map(a => a.duration));\n total.duration_current_avg = Math.round(total.data.map(a => a.duration).reduce((a, b) => a + b, 0) / total.data.length);\n total.hits_current = total.data.length;\n });\n }\n\n console.log('---------------------------------------------------------------------------------');\n console.log('---------------------------------------------------------------------------------');\n\n console.log('Performance', new Date());\n console.log('---------------------------------------------------------------------------------');\n\n\n console.log('Function, Publication, Hits Total, Dur Tot Max, Dur Tot Min, Dur Tot Avg, Hits Current, Dur Curr Max, Dur Curr Min, Dur Curr Avg, Sub Data');\n\n totalPerfomanceMonitor.sort((a, b) => b.hits_total - a.hits_total).forEach(total => {\n console.log(total.function + ',' + total.publication + ',' + total.hits_total + ',' + total.duration_total_max + ',' + total.duration_total_min + ',' + total.duration_total_avg + ',' + total.hits_current + ',' + total.duration_current_max + ',' + total.duration_current_min + ',' + total.duration_current_avg + ',' + JSON.stringify(total.subscriptionData));\n });\n\n console.log('---------------------------------------------------------------------------------');\n console.log('---------------------------------------------------------------------------------');\n}"]}
@@ -0,0 +1,2 @@
1
+ import { MethodManager } from '../managers/method.manager';
2
+ export declare function loadAccountMethods(methodManager: MethodManager): void;