@solidxai/core 0.1.10-beta.22 → 0.1.10-beta.23

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 (434) hide show
  1. package/dist/commands/info.command.d.ts.map +1 -1
  2. package/dist/commands/info.command.js +0 -2
  3. package/dist/commands/info.command.js.map +1 -1
  4. package/dist/controllers/dashboard-user-layout.controller.d.ts +43 -0
  5. package/dist/controllers/dashboard-user-layout.controller.d.ts.map +1 -0
  6. package/dist/controllers/{dashboard-variable.controller.js → dashboard-user-layout.controller.js} +30 -30
  7. package/dist/controllers/dashboard-user-layout.controller.js.map +1 -0
  8. package/dist/controllers/dashboard.controller.d.ts +12 -42
  9. package/dist/controllers/dashboard.controller.d.ts.map +1 -1
  10. package/dist/controllers/dashboard.controller.js +71 -141
  11. package/dist/controllers/dashboard.controller.js.map +1 -1
  12. package/dist/decorators/dashboard-widget-data-provider.decorator.d.ts +3 -0
  13. package/dist/decorators/dashboard-widget-data-provider.decorator.d.ts.map +1 -0
  14. package/dist/decorators/dashboard-widget-data-provider.decorator.js +8 -0
  15. package/dist/decorators/dashboard-widget-data-provider.decorator.js.map +1 -0
  16. package/dist/dtos/create-dashboard-user-layout.dto.d.ts +10 -0
  17. package/dist/dtos/create-dashboard-user-layout.dto.d.ts.map +1 -0
  18. package/dist/dtos/create-dashboard-user-layout.dto.js +66 -0
  19. package/dist/dtos/create-dashboard-user-layout.dto.js.map +1 -0
  20. package/dist/dtos/dashboard-variable-options-query.dto.d.ts +7 -0
  21. package/dist/dtos/dashboard-variable-options-query.dto.d.ts.map +1 -0
  22. package/dist/dtos/dashboard-variable-options-query.dto.js +40 -0
  23. package/dist/dtos/dashboard-variable-options-query.dto.js.map +1 -0
  24. package/dist/dtos/dashboard-widget-data-request.dto.d.ts +12 -0
  25. package/dist/dtos/dashboard-widget-data-request.dto.d.ts.map +1 -0
  26. package/dist/dtos/dashboard-widget-data-request.dto.js +65 -0
  27. package/dist/dtos/dashboard-widget-data-request.dto.js.map +1 -0
  28. package/dist/dtos/update-dashboard-user-layout.dto.d.ts +11 -0
  29. package/dist/dtos/update-dashboard-user-layout.dto.d.ts.map +1 -0
  30. package/dist/dtos/{update-dashboard-layout.dto.js → update-dashboard-user-layout.dto.js} +34 -16
  31. package/dist/dtos/update-dashboard-user-layout.dto.js.map +1 -0
  32. package/dist/entities/dashboard-user-layout.entity.d.ts +11 -0
  33. package/dist/entities/dashboard-user-layout.entity.d.ts.map +1 -0
  34. package/dist/entities/dashboard-user-layout.entity.js +52 -0
  35. package/dist/entities/dashboard-user-layout.entity.js.map +1 -0
  36. package/dist/helpers/module-metadata-helper.service.d.ts.map +1 -1
  37. package/dist/helpers/module-metadata-helper.service.js +15 -4
  38. package/dist/helpers/module-metadata-helper.service.js.map +1 -1
  39. package/dist/helpers/solid-registry.d.ts +5 -9
  40. package/dist/helpers/solid-registry.d.ts.map +1 -1
  41. package/dist/helpers/solid-registry.js +13 -28
  42. package/dist/helpers/solid-registry.js.map +1 -1
  43. package/dist/index.d.ts +21 -5
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +21 -5
  46. package/dist/index.js.map +1 -1
  47. package/dist/interfaces.d.ts +24 -13
  48. package/dist/interfaces.d.ts.map +1 -1
  49. package/dist/interfaces.js.map +1 -1
  50. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts +1 -3
  51. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts.map +1 -1
  52. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js +2 -25
  53. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js.map +1 -1
  54. package/dist/{repository/dashboard-layout.repository.d.ts → repositories/dashboard-user-layout.repository.d.ts} +5 -5
  55. package/dist/repositories/dashboard-user-layout.repository.d.ts.map +1 -0
  56. package/dist/{repository/dashboard-question-sql-dataset-config.repository.js → repositories/dashboard-user-layout.repository.js} +15 -10
  57. package/dist/repositories/dashboard-user-layout.repository.js.map +1 -0
  58. package/dist/seeders/module-metadata-seeder.service.d.ts +1 -6
  59. package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
  60. package/dist/seeders/module-metadata-seeder.service.js +1 -60
  61. package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
  62. package/dist/seeders/seed-data/solid-core-metadata.json +6203 -6690
  63. package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.d.ts +13 -0
  64. package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.d.ts.map +1 -0
  65. package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.js +55 -0
  66. package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.js.map +1 -0
  67. package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.d.ts +13 -0
  68. package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.d.ts.map +1 -0
  69. package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.js +52 -0
  70. package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.js.map +1 -0
  71. package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.d.ts +13 -0
  72. package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.d.ts.map +1 -0
  73. package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.js +52 -0
  74. package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.js.map +1 -0
  75. package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.d.ts +10 -0
  76. package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.d.ts.map +1 -0
  77. package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.js +62 -0
  78. package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.js.map +1 -0
  79. package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.d.ts +10 -0
  80. package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.d.ts.map +1 -0
  81. package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.js +82 -0
  82. package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.js.map +1 -0
  83. package/dist/services/dashboard-providers/mq-dashboard-provider-utils.d.ts +17 -0
  84. package/dist/services/dashboard-providers/mq-dashboard-provider-utils.d.ts.map +1 -0
  85. package/dist/services/dashboard-providers/mq-dashboard-provider-utils.js +130 -0
  86. package/dist/services/dashboard-providers/mq-dashboard-provider-utils.js.map +1 -0
  87. package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.d.ts +37 -0
  88. package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.d.ts.map +1 -0
  89. package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.js +112 -0
  90. package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.js.map +1 -0
  91. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.d.ts +10 -0
  92. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.d.ts.map +1 -0
  93. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.js +57 -0
  94. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.js.map +1 -0
  95. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.d.ts +10 -0
  96. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.d.ts.map +1 -0
  97. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.js +57 -0
  98. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.js.map +1 -0
  99. package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts +10 -0
  100. package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts.map +1 -0
  101. package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js +100 -0
  102. package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js.map +1 -0
  103. package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.d.ts +10 -0
  104. package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.d.ts.map +1 -0
  105. package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.js +55 -0
  106. package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.js.map +1 -0
  107. package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.d.ts +13 -0
  108. package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.d.ts.map +1 -0
  109. package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.js +52 -0
  110. package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.js.map +1 -0
  111. package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.d.ts +15 -0
  112. package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.d.ts.map +1 -0
  113. package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.js +60 -0
  114. package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.js.map +1 -0
  115. package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.d.ts +13 -0
  116. package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.d.ts.map +1 -0
  117. package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.js +51 -0
  118. package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.js.map +1 -0
  119. package/dist/services/dashboard-runtime.service.d.ts +31 -0
  120. package/dist/services/dashboard-runtime.service.d.ts.map +1 -0
  121. package/dist/services/dashboard-runtime.service.js +408 -0
  122. package/dist/services/dashboard-runtime.service.js.map +1 -0
  123. package/dist/services/dashboard-user-layout.service.d.ts +12 -0
  124. package/dist/services/dashboard-user-layout.service.d.ts.map +1 -0
  125. package/dist/services/{dashboard-variable.service.js → dashboard-user-layout.service.js} +11 -12
  126. package/dist/services/dashboard-user-layout.service.js.map +1 -0
  127. package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.d.ts +11 -0
  128. package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.d.ts.map +1 -0
  129. package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.js +59 -0
  130. package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.js.map +1 -0
  131. package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.d.ts +11 -0
  132. package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.d.ts.map +1 -0
  133. package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.js +60 -0
  134. package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.js.map +1 -0
  135. package/dist/services/solid-introspect.service.d.ts +1 -2
  136. package/dist/services/solid-introspect.service.d.ts.map +1 -1
  137. package/dist/services/solid-introspect.service.js +12 -24
  138. package/dist/services/solid-introspect.service.js.map +1 -1
  139. package/dist/solid-core.module.d.ts.map +1 -1
  140. package/dist/solid-core.module.js +43 -66
  141. package/dist/solid-core.module.js.map +1 -1
  142. package/package.json +1 -1
  143. package/src/commands/info.command.ts +0 -2
  144. package/src/controllers/{dashboard-variable.controller.ts → dashboard-user-layout.controller.ts} +10 -10
  145. package/src/controllers/dashboard.controller.ts +70 -89
  146. package/src/decorators/dashboard-widget-data-provider.decorator.ts +6 -0
  147. package/src/dtos/create-dashboard-user-layout.dto.ts +41 -0
  148. package/src/dtos/dashboard-variable-options-query.dto.ts +20 -0
  149. package/src/dtos/dashboard-widget-data-request.dto.ts +34 -0
  150. package/src/dtos/update-dashboard-user-layout.dto.ts +45 -0
  151. package/src/entities/dashboard-user-layout.entity.ts +27 -0
  152. package/src/helpers/module-metadata-helper.service.ts +21 -6
  153. package/src/helpers/solid-registry.ts +15 -36
  154. package/src/index.ts +21 -5
  155. package/src/interfaces.ts +32 -19
  156. package/src/jobs/database/trigger-mcp-client-subscriber-database.service.ts +1 -34
  157. package/src/repositories/dashboard-user-layout.repository.ts +19 -0
  158. package/src/seeders/module-metadata-seeder.service.ts +0 -67
  159. package/src/seeders/seed-data/solid-core-metadata.json +6204 -6691
  160. package/src/services/dashboard-providers/README.md +603 -0
  161. package/src/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.ts +49 -0
  162. package/src/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.ts +45 -0
  163. package/src/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.ts +45 -0
  164. package/src/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.ts +58 -0
  165. package/src/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.ts +79 -0
  166. package/src/services/dashboard-providers/mq-dashboard-provider-utils.ts +165 -0
  167. package/src/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.ts +155 -0
  168. package/src/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.ts +51 -0
  169. package/src/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.ts +51 -0
  170. package/src/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.ts +95 -0
  171. package/src/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.ts +49 -0
  172. package/src/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.ts +45 -0
  173. package/src/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.ts +55 -0
  174. package/src/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.ts +44 -0
  175. package/src/services/dashboard-runtime.service.ts +488 -0
  176. package/src/services/dashboard-user-layout.service.ts +20 -0
  177. package/src/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.ts +52 -0
  178. package/src/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.ts +51 -0
  179. package/src/services/solid-introspect.service.ts +19 -34
  180. package/src/solid-core.module.ts +43 -72
  181. package/dist/controllers/dashboard-layout.controller.d.ts +0 -47
  182. package/dist/controllers/dashboard-layout.controller.d.ts.map +0 -1
  183. package/dist/controllers/dashboard-layout.controller.js +0 -204
  184. package/dist/controllers/dashboard-layout.controller.js.map +0 -1
  185. package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts +0 -43
  186. package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts.map +0 -1
  187. package/dist/controllers/dashboard-question-sql-dataset-config.controller.js +0 -179
  188. package/dist/controllers/dashboard-question-sql-dataset-config.controller.js.map +0 -1
  189. package/dist/controllers/dashboard-question.controller.d.ts +0 -45
  190. package/dist/controllers/dashboard-question.controller.d.ts.map +0 -1
  191. package/dist/controllers/dashboard-question.controller.js +0 -194
  192. package/dist/controllers/dashboard-question.controller.js.map +0 -1
  193. package/dist/controllers/dashboard-variable.controller.d.ts +0 -43
  194. package/dist/controllers/dashboard-variable.controller.d.ts.map +0 -1
  195. package/dist/controllers/dashboard-variable.controller.js.map +0 -1
  196. package/dist/decorators/dashboard-question-data-provider.decorator.d.ts +0 -3
  197. package/dist/decorators/dashboard-question-data-provider.decorator.d.ts.map +0 -1
  198. package/dist/decorators/dashboard-question-data-provider.decorator.js +0 -11
  199. package/dist/decorators/dashboard-question-data-provider.decorator.js.map +0 -1
  200. package/dist/decorators/dashboard-selection-provider.decorator.d.ts +0 -3
  201. package/dist/decorators/dashboard-selection-provider.decorator.d.ts.map +0 -1
  202. package/dist/decorators/dashboard-selection-provider.decorator.js +0 -11
  203. package/dist/decorators/dashboard-selection-provider.decorator.js.map +0 -1
  204. package/dist/dtos/create-dashboard-layout.dto.d.ts +0 -8
  205. package/dist/dtos/create-dashboard-layout.dto.d.ts.map +0 -1
  206. package/dist/dtos/create-dashboard-layout.dto.js +0 -53
  207. package/dist/dtos/create-dashboard-layout.dto.js.map +0 -1
  208. package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts +0 -12
  209. package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts.map +0 -1
  210. package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js +0 -77
  211. package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js.map +0 -1
  212. package/dist/dtos/create-dashboard-question.dto.d.ts +0 -17
  213. package/dist/dtos/create-dashboard-question.dto.d.ts.map +0 -1
  214. package/dist/dtos/create-dashboard-question.dto.js +0 -105
  215. package/dist/dtos/create-dashboard-question.dto.js.map +0 -1
  216. package/dist/dtos/create-dashboard-variable.dto.d.ts +0 -19
  217. package/dist/dtos/create-dashboard-variable.dto.d.ts.map +0 -1
  218. package/dist/dtos/create-dashboard-variable.dto.js +0 -103
  219. package/dist/dtos/create-dashboard-variable.dto.js.map +0 -1
  220. package/dist/dtos/create-dashboard.dto.d.ts +0 -17
  221. package/dist/dtos/create-dashboard.dto.d.ts.map +0 -1
  222. package/dist/dtos/create-dashboard.dto.js +0 -102
  223. package/dist/dtos/create-dashboard.dto.js.map +0 -1
  224. package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.d.ts +0 -8
  225. package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.d.ts.map +0 -1
  226. package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.js +0 -52
  227. package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.js.map +0 -1
  228. package/dist/dtos/update-dashboard-layout.dto.d.ts +0 -8
  229. package/dist/dtos/update-dashboard-layout.dto.d.ts.map +0 -1
  230. package/dist/dtos/update-dashboard-layout.dto.js.map +0 -1
  231. package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts +0 -13
  232. package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts.map +0 -1
  233. package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js +0 -86
  234. package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js.map +0 -1
  235. package/dist/dtos/update-dashboard-question.dto.d.ts +0 -18
  236. package/dist/dtos/update-dashboard-question.dto.d.ts.map +0 -1
  237. package/dist/dtos/update-dashboard-question.dto.js +0 -112
  238. package/dist/dtos/update-dashboard-question.dto.js.map +0 -1
  239. package/dist/dtos/update-dashboard-variable.dto.d.ts +0 -16
  240. package/dist/dtos/update-dashboard-variable.dto.d.ts.map +0 -1
  241. package/dist/dtos/update-dashboard-variable.dto.js +0 -101
  242. package/dist/dtos/update-dashboard-variable.dto.js.map +0 -1
  243. package/dist/dtos/update-dashboard.dto.d.ts +0 -18
  244. package/dist/dtos/update-dashboard.dto.d.ts.map +0 -1
  245. package/dist/dtos/update-dashboard.dto.js +0 -108
  246. package/dist/dtos/update-dashboard.dto.js.map +0 -1
  247. package/dist/entities/dashboard-layout.entity.d.ts +0 -9
  248. package/dist/entities/dashboard-layout.entity.d.ts.map +0 -1
  249. package/dist/entities/dashboard-layout.entity.js +0 -41
  250. package/dist/entities/dashboard-layout.entity.js.map +0 -1
  251. package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts +0 -14
  252. package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts.map +0 -1
  253. package/dist/entities/dashboard-question-sql-dataset-config.entity.js +0 -66
  254. package/dist/entities/dashboard-question-sql-dataset-config.entity.js.map +0 -1
  255. package/dist/entities/dashboard-question.entity.d.ts +0 -17
  256. package/dist/entities/dashboard-question.entity.d.ts.map +0 -1
  257. package/dist/entities/dashboard-question.entity.js +0 -77
  258. package/dist/entities/dashboard-question.entity.js.map +0 -1
  259. package/dist/entities/dashboard-variable.entity.d.ts +0 -16
  260. package/dist/entities/dashboard-variable.entity.d.ts.map +0 -1
  261. package/dist/entities/dashboard-variable.entity.js +0 -79
  262. package/dist/entities/dashboard-variable.entity.js.map +0 -1
  263. package/dist/entities/dashboard.entity.d.ts +0 -16
  264. package/dist/entities/dashboard.entity.d.ts.map +0 -1
  265. package/dist/entities/dashboard.entity.js +0 -64
  266. package/dist/entities/dashboard.entity.js.map +0 -1
  267. package/dist/mappers/dashboard-mapper.d.ts +0 -6
  268. package/dist/mappers/dashboard-mapper.d.ts.map +0 -1
  269. package/dist/mappers/dashboard-mapper.js +0 -62
  270. package/dist/mappers/dashboard-mapper.js.map +0 -1
  271. package/dist/repository/dashboard-layout.repository.d.ts.map +0 -1
  272. package/dist/repository/dashboard-layout.repository.js +0 -34
  273. package/dist/repository/dashboard-layout.repository.js.map +0 -1
  274. package/dist/repository/dashboard-question-sql-dataset-config.repository.d.ts +0 -12
  275. package/dist/repository/dashboard-question-sql-dataset-config.repository.d.ts.map +0 -1
  276. package/dist/repository/dashboard-question-sql-dataset-config.repository.js.map +0 -1
  277. package/dist/repository/dashboard-question.repository.d.ts +0 -12
  278. package/dist/repository/dashboard-question.repository.d.ts.map +0 -1
  279. package/dist/repository/dashboard-question.repository.js +0 -34
  280. package/dist/repository/dashboard-question.repository.js.map +0 -1
  281. package/dist/repository/dashboard-variable.repository.d.ts +0 -12
  282. package/dist/repository/dashboard-variable.repository.d.ts.map +0 -1
  283. package/dist/repository/dashboard-variable.repository.js +0 -34
  284. package/dist/repository/dashboard-variable.repository.js.map +0 -1
  285. package/dist/repository/dashboard.repository.d.ts +0 -13
  286. package/dist/repository/dashboard.repository.d.ts.map +0 -1
  287. package/dist/repository/dashboard.repository.js +0 -104
  288. package/dist/repository/dashboard.repository.js.map +0 -1
  289. package/dist/services/dashboard-layout.service.d.ts +0 -20
  290. package/dist/services/dashboard-layout.service.d.ts.map +0 -1
  291. package/dist/services/dashboard-layout.service.js +0 -120
  292. package/dist/services/dashboard-layout.service.js.map +0 -1
  293. package/dist/services/dashboard-question-sql-dataset-config.service.d.ts +0 -12
  294. package/dist/services/dashboard-question-sql-dataset-config.service.d.ts.map +0 -1
  295. package/dist/services/dashboard-question-sql-dataset-config.service.js +0 -38
  296. package/dist/services/dashboard-question-sql-dataset-config.service.js.map +0 -1
  297. package/dist/services/dashboard-question.service.d.ts +0 -23
  298. package/dist/services/dashboard-question.service.d.ts.map +0 -1
  299. package/dist/services/dashboard-question.service.js +0 -135
  300. package/dist/services/dashboard-question.service.js.map +0 -1
  301. package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.d.ts +0 -12
  302. package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.d.ts.map +0 -1
  303. package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.js +0 -55
  304. package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.js.map +0 -1
  305. package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.d.ts +0 -11
  306. package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.d.ts.map +0 -1
  307. package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.js +0 -45
  308. package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.js.map +0 -1
  309. package/dist/services/dashboard-variable.service.d.ts +0 -13
  310. package/dist/services/dashboard-variable.service.d.ts.map +0 -1
  311. package/dist/services/dashboard-variable.service.js.map +0 -1
  312. package/dist/services/dashboard.service.d.ts +0 -29
  313. package/dist/services/dashboard.service.d.ts.map +0 -1
  314. package/dist/services/dashboard.service.js +0 -171
  315. package/dist/services/dashboard.service.js.map +0 -1
  316. package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.d.ts +0 -12
  317. package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.d.ts.map +0 -1
  318. package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.js +0 -41
  319. package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.js.map +0 -1
  320. package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.d.ts +0 -12
  321. package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.d.ts.map +0 -1
  322. package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.js +0 -42
  323. package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.js.map +0 -1
  324. package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.d.ts +0 -25
  325. package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.d.ts.map +0 -1
  326. package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.js +0 -116
  327. package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.js.map +0 -1
  328. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.d.ts +0 -12
  329. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.d.ts.map +0 -1
  330. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.js +0 -37
  331. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.js.map +0 -1
  332. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.d.ts +0 -12
  333. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.d.ts.map +0 -1
  334. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.js +0 -38
  335. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.js.map +0 -1
  336. package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.d.ts +0 -12
  337. package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.d.ts.map +0 -1
  338. package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.js +0 -38
  339. package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.js.map +0 -1
  340. package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts +0 -34
  341. package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts.map +0 -1
  342. package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js +0 -90
  343. package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js.map +0 -1
  344. package/dist/services/question-data-providers/helpers.d.ts +0 -7
  345. package/dist/services/question-data-providers/helpers.d.ts.map +0 -1
  346. package/dist/services/question-data-providers/helpers.js +0 -25
  347. package/dist/services/question-data-providers/helpers.js.map +0 -1
  348. package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts +0 -14
  349. package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts.map +0 -1
  350. package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js +0 -71
  351. package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js.map +0 -1
  352. package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts +0 -16
  353. package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts.map +0 -1
  354. package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js +0 -93
  355. package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js.map +0 -1
  356. package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.d.ts +0 -11
  357. package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.d.ts.map +0 -1
  358. package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js +0 -49
  359. package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js.map +0 -1
  360. package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.d.ts +0 -11
  361. package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.d.ts.map +0 -1
  362. package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.js +0 -47
  363. package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.js.map +0 -1
  364. package/dist/services/sql-expression-resolver.service.d.ts +0 -12
  365. package/dist/services/sql-expression-resolver.service.d.ts.map +0 -1
  366. package/dist/services/sql-expression-resolver.service.js +0 -121
  367. package/dist/services/sql-expression-resolver.service.js.map +0 -1
  368. package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts +0 -16
  369. package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts.map +0 -1
  370. package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js +0 -72
  371. package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js.map +0 -1
  372. package/dist/subscribers/dashboard-question.subscriber.d.ts +0 -16
  373. package/dist/subscribers/dashboard-question.subscriber.d.ts.map +0 -1
  374. package/dist/subscribers/dashboard-question.subscriber.js +0 -72
  375. package/dist/subscribers/dashboard-question.subscriber.js.map +0 -1
  376. package/dist/subscribers/dashboard-variable.subscriber.d.ts +0 -16
  377. package/dist/subscribers/dashboard-variable.subscriber.d.ts.map +0 -1
  378. package/dist/subscribers/dashboard-variable.subscriber.js +0 -72
  379. package/dist/subscribers/dashboard-variable.subscriber.js.map +0 -1
  380. package/dist/subscribers/dashboard.subscriber.d.ts +0 -16
  381. package/dist/subscribers/dashboard.subscriber.d.ts.map +0 -1
  382. package/dist/subscribers/dashboard.subscriber.js +0 -71
  383. package/dist/subscribers/dashboard.subscriber.js.map +0 -1
  384. package/src/controllers/dashboard-layout.controller.ts +0 -106
  385. package/src/controllers/dashboard-question-sql-dataset-config.controller.ts +0 -93
  386. package/src/controllers/dashboard-question.controller.ts +0 -104
  387. package/src/decorators/dashboard-question-data-provider.decorator.ts +0 -7
  388. package/src/decorators/dashboard-selection-provider.decorator.ts +0 -7
  389. package/src/dtos/create-dashboard-layout.dto.ts +0 -31
  390. package/src/dtos/create-dashboard-question-sql-dataset-config.dto.ts +0 -42
  391. package/src/dtos/create-dashboard-question.dto.ts +0 -62
  392. package/src/dtos/create-dashboard-variable.dto.ts +0 -60
  393. package/src/dtos/create-dashboard.dto.ts +0 -61
  394. package/src/dtos/dashboard-variable-selection-dynamic-query.dto.ts +0 -29
  395. package/src/dtos/update-dashboard-layout.dto.ts +0 -30
  396. package/src/dtos/update-dashboard-question-sql-dataset-config.dto.ts +0 -49
  397. package/src/dtos/update-dashboard-question.dto.ts +0 -67
  398. package/src/dtos/update-dashboard-variable.dto.ts +0 -58
  399. package/src/dtos/update-dashboard.dto.ts +0 -65
  400. package/src/entities/dashboard-layout.entity.ts +0 -18
  401. package/src/entities/dashboard-question-sql-dataset-config.entity.ts +0 -37
  402. package/src/entities/dashboard-question.entity.ts +0 -46
  403. package/src/entities/dashboard-variable.entity.ts +0 -44
  404. package/src/entities/dashboard.entity.ts +0 -36
  405. package/src/mappers/dashboard-mapper.ts +0 -53
  406. package/src/repository/dashboard-layout.repository.ts +0 -17
  407. package/src/repository/dashboard-question-sql-dataset-config.repository.ts +0 -17
  408. package/src/repository/dashboard-question.repository.ts +0 -17
  409. package/src/repository/dashboard-variable.repository.ts +0 -17
  410. package/src/repository/dashboard.repository.ts +0 -101
  411. package/src/services/dashboard-layout.service.ts +0 -111
  412. package/src/services/dashboard-question-sql-dataset-config.service.ts +0 -25
  413. package/src/services/dashboard-question.service.ts +0 -150
  414. package/src/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.ts +0 -56
  415. package/src/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.ts +0 -37
  416. package/src/services/dashboard-variable.service.ts +0 -27
  417. package/src/services/dashboard.service.ts +0 -148
  418. package/src/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.ts +0 -43
  419. package/src/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.ts +0 -44
  420. package/src/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.ts +0 -114
  421. package/src/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.ts +0 -38
  422. package/src/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.ts +0 -40
  423. package/src/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.ts +0 -39
  424. package/src/services/question-data-providers/chartjs-sql-data-provider.service.ts +0 -121
  425. package/src/services/question-data-providers/helpers.ts +0 -30
  426. package/src/services/question-data-providers/prime-react-datatable-sql-data-provider.service.ts +0 -74
  427. package/src/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.ts +0 -115
  428. package/src/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.ts +0 -44
  429. package/src/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.ts +0 -41
  430. package/src/services/sql-expression-resolver.service.ts +0 -140
  431. package/src/subscribers/dashboard-question-sql-dataset-config.subscriber.ts +0 -61
  432. package/src/subscribers/dashboard-question.subscriber.ts +0 -62
  433. package/src/subscribers/dashboard-variable.subscriber.ts +0 -63
  434. package/src/subscribers/dashboard.subscriber.ts +0 -62
@@ -1,140 +0,0 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { SqlExpression, SqlExpressionOperator } from "./question-data-providers/chartjs-sql-data-provider.service";
3
- import { RequestContextService } from "./request-context.service";
4
- import { ERROR_MESSAGES } from "src/constants/error-messages";
5
-
6
- export interface SqlReplacementResult {
7
- rawSql: string;
8
- parameters: any[]; // Positional parameters
9
- }
10
-
11
- @Injectable()
12
- export class SqlExpressionResolverService {
13
- constructor(private readonly requestContextService: RequestContextService) { }
14
- resolveSqlWithExpressions(sql: string, expressions: SqlExpression[]): SqlReplacementResult {
15
- const variableToColumnMap: Record<string, string> = {};
16
- const variablePattern = /{{\s*(\w+)\s*\[\s*([\w.]+)\s*\]\s*}}/g;
17
-
18
- let paramIndex = 1;
19
- const parameters: any[] = [];
20
-
21
- // Handle sql expression tokens like {{$activeUserId}} in the SQL string
22
- if (sql.includes('{{$activeUserId}}')) {
23
- const activeUser = this.requestContextService.getActiveUser();
24
- if (activeUser && activeUser.sub) {
25
- // Replace custom placeholder with parameter placeholder ($1)
26
- sql = sql.replace(/\{\{\$activeUserId\}\}/g, `$${paramIndex++}`);
27
- // Add the active user ID to parameters
28
- parameters.push(activeUser.sub);
29
- }
30
- }
31
-
32
- // --- Pass 1: extract variable -> column mappings ---
33
- let simplifiedSql = sql.replace(variablePattern, (_, variableName, columnName) => {
34
- variableToColumnMap[variableName] = columnName;
35
- return `{{${variableName}}}`;
36
- });
37
-
38
- // --- Pass 2: Replace each variable with positional fragment ---
39
-
40
- for (const expr of expressions) {
41
- const column = variableToColumnMap[expr.variableName];
42
- if (!column) continue;
43
-
44
- let sqlFragment = '';
45
- const placeholder = `{{${expr.variableName}}}`;
46
-
47
- switch (expr.operator) {
48
- case SqlExpressionOperator.EQUALS:
49
- sqlFragment = `${column} = $${paramIndex++}`;
50
- parameters.push(expr.value[0]);
51
- break;
52
-
53
- case SqlExpressionOperator.NOT_EQUALS:
54
- sqlFragment = `${column} != $${paramIndex++}`;
55
- parameters.push(expr.value[0]);
56
- break;
57
-
58
- case SqlExpressionOperator.CONTAINS:
59
- sqlFragment = `${column} LIKE $${paramIndex++}`;
60
- parameters.push(`%${expr.value[0]}%`);
61
- break;
62
-
63
- case SqlExpressionOperator.NOT_CONTAINS:
64
- sqlFragment = `${column} NOT LIKE $${paramIndex++}`;
65
- parameters.push(`%${expr.value[0]}%`);
66
- break;
67
-
68
- case SqlExpressionOperator.STARTS_WITH:
69
- sqlFragment = `${column} LIKE $${paramIndex++}`;
70
- parameters.push(`${expr.value[0]}%`);
71
- break;
72
-
73
- case SqlExpressionOperator.ENDS_WITH:
74
- sqlFragment = `${column} LIKE $${paramIndex++}`;
75
- parameters.push(`%${expr.value[0]}`);
76
- break;
77
-
78
- case SqlExpressionOperator.IN:
79
- const inParams = expr.value.map(val => {
80
- parameters.push(val);
81
- return `$${paramIndex++}`;
82
- });
83
- sqlFragment = `${column} IN (${inParams.join(", ")})`;
84
- break;
85
-
86
- case SqlExpressionOperator.NOT_IN:
87
- const notInParams = expr.value.map(val => {
88
- parameters.push(val);
89
- return `$${paramIndex++}`;
90
- });
91
- sqlFragment = `${column} NOT IN (${notInParams.join(", ")})`;
92
- break;
93
-
94
- case SqlExpressionOperator.BETWEEN:
95
- sqlFragment = `${column} BETWEEN $${paramIndex} AND $${paramIndex + 1}`;
96
- parameters.push(expr.value[0], expr.value[1]);
97
- paramIndex += 2;
98
- break;
99
-
100
- case SqlExpressionOperator.LT:
101
- sqlFragment = `${column} < $${paramIndex++}`;
102
- parameters.push(expr.value[0]);
103
- break;
104
-
105
- case SqlExpressionOperator.LTE:
106
- sqlFragment = `${column} <= $${paramIndex++}`;
107
- parameters.push(expr.value[0]);
108
- break;
109
-
110
- case SqlExpressionOperator.GT:
111
- sqlFragment = `${column} > $${paramIndex++}`;
112
- parameters.push(expr.value[0]);
113
- break;
114
-
115
- case SqlExpressionOperator.GTE:
116
- sqlFragment = `${column} >= $${paramIndex++}`;
117
- parameters.push(expr.value[0]);
118
- break;
119
-
120
- default:
121
- throw new Error(ERROR_MESSAGES.UNSUPPORTED_SQL_OPERATOR(expr.operator));
122
- }
123
- simplifiedSql = simplifiedSql.replace(placeholder, sqlFragment);
124
- }
125
-
126
- // --- Final cleanup: remove any remaining placeholders ---
127
- simplifiedSql = simplifiedSql.replace(/{{\s*\w+\s*}}/g, '');
128
-
129
- // Remove dangling where clause if no expressions were applied
130
- simplifiedSql = simplifiedSql.replace(/\bwhere\b\s*$/i, '').trim();
131
-
132
- // Need to handle scenarios of complex expression i.e with and / or clauses. probably need to have this logic in the sql expression object itself
133
-
134
-
135
- return {
136
- rawSql: simplifiedSql,
137
- parameters
138
- };
139
- }
140
- }
@@ -1,61 +0,0 @@
1
- import { Injectable, Logger } from "@nestjs/common";
2
- import { InjectDataSource } from "@nestjs/typeorm";
3
- import { DashboardQuestionSqlDatasetConfig } from "src/entities/dashboard-question-sql-dataset-config.entity";
4
- import { DashboardQuestion } from "src/entities/dashboard-question.entity";
5
- import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
6
- import { DashboardService } from "src/services/dashboard.service";
7
- import { DataSource, EntityManager, EntitySubscriberInterface, InsertEvent, UpdateEvent } from "typeorm";
8
-
9
- @Injectable()
10
- export class DashboardQuestionSqlDatasetConfigSubscriber implements EntitySubscriberInterface<DashboardQuestionSqlDatasetConfig> {
11
- private readonly logger = new Logger(this.constructor.name);
12
- constructor(
13
- @InjectDataSource()
14
- private readonly dataSource: DataSource,
15
- readonly moduleMetadataHelperService: ModuleMetadataHelperService,
16
- readonly dashboardService: DashboardService, // Assuming you have a DashboardService for custom queries
17
- ) {
18
- this.dataSource.subscribers.push(this);
19
- }
20
-
21
- listenTo() {
22
- return DashboardQuestionSqlDatasetConfig;
23
- }
24
-
25
- async afterInsert(event: InsertEvent<DashboardQuestionSqlDatasetConfig>) {
26
- const question = event.entity.question;
27
- if (!question) {
28
- this.logger.debug('No question found in the QuestionSqlDatasetConfigSubscriber afterInsert method');
29
- return;
30
- }
31
- await this.saveQuestionToConfig(question, event.queryRunner.manager);
32
- }
33
-
34
- async afterUpdate(event: UpdateEvent<DashboardQuestionSqlDatasetConfig>) {
35
- const question = event.databaseEntity.question;
36
- if (!question) {
37
- this.logger.debug('No question found in the QuestionSqlDatasetConfigSubscriber afterUpdate method');
38
- return;
39
- }
40
- await this.saveQuestionToConfig(question, event.queryRunner.manager);
41
- }
42
-
43
- private async saveQuestionToConfig(question: DashboardQuestion, entityManager: EntityManager): Promise<void> {
44
- // Populate the dashboard for the question
45
- const populatedQuestion = await entityManager.findOne(DashboardQuestion, {
46
- where: {
47
- id: question.id,
48
- },
49
- relations: ['dashboard', 'dashboard.module', 'dashboard.dashboardVariables', 'dashboard.questions', 'dashboard.questions.questionSqlDatasetConfigs'],
50
- });
51
- const dashboard = populatedQuestion?.dashboard;
52
-
53
- if (!dashboard) {
54
- throw new Error(`Dashboard not found for question id ${question.id}`);
55
- }
56
-
57
- // Call the saveDashboardToConfig method from the DashboardService
58
- await this.dashboardService.saveDashboardToConfig(dashboard);
59
- }
60
-
61
- }
@@ -1,62 +0,0 @@
1
- import { Injectable, Logger } from "@nestjs/common";
2
- import { InjectDataSource } from "@nestjs/typeorm";
3
- import { DashboardQuestion } from "src/entities/dashboard-question.entity";
4
- import { Dashboard } from "src/entities/dashboard.entity";
5
- import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
6
- import { DashboardService } from "src/services/dashboard.service";
7
- import { DataSource, EntityManager, EntitySubscriberInterface, InsertEvent, UpdateEvent } from "typeorm";
8
-
9
- @Injectable()
10
- export class DashboardQuestionSubscriber implements EntitySubscriberInterface<DashboardQuestion> {
11
- private readonly logger = new Logger(this.constructor.name);
12
- constructor(
13
- @InjectDataSource()
14
- private readonly dataSource: DataSource,
15
- readonly moduleMetadataHelperService: ModuleMetadataHelperService,
16
- readonly dashboardService: DashboardService,
17
- ) {
18
- this.dataSource.subscribers.push(this);
19
- }
20
-
21
- listenTo() {
22
- return DashboardQuestion;
23
- }
24
-
25
- async afterInsert(event: InsertEvent<DashboardQuestion>) {
26
- if (!event.entity) {
27
- this.logger.debug('No question entity found in the QuestionSubscriber afterInsert method');
28
- return;
29
- }
30
- await this.saveDashboardToConfig(event.entity, event.queryRunner.manager);
31
- }
32
-
33
- async afterUpdate(event: UpdateEvent<DashboardQuestion>) {
34
- if (!event.databaseEntity) {
35
- this.logger.debug('No question entity found in the QuestionSubscriber afterUpdate method');
36
- return;
37
- }
38
- await this.saveDashboardToConfig(event.databaseEntity, event.queryRunner.manager);
39
- }
40
-
41
- private async saveDashboardToConfig(question: DashboardQuestion, entityManager: EntityManager): Promise<void> {
42
- const dashboard = question.dashboard;
43
- // Get the dashboard from the question & call the saveDashboardToConfig method
44
- if (!dashboard) {
45
- this.logger.debug(`Dashboard is undefined for question id ${question.id}`);
46
- return;
47
- }
48
-
49
- // populate the dashboard with its variables
50
- const populatedDashboard = await entityManager.findOne(Dashboard, {
51
- where: { id: dashboard.id },
52
- relations: ['module','dashboardVariables', 'questions', 'questions.questionSqlDatasetConfigs'],
53
- });
54
-
55
- if (!populatedDashboard) {
56
- throw new Error(`Dashboard not found for question id ${populatedDashboard.id}`);
57
- }
58
-
59
- // Call the saveDashboardToConfig method from the DashboardService
60
- await this.dashboardService.saveDashboardToConfig(populatedDashboard);
61
- }
62
- }
@@ -1,63 +0,0 @@
1
- import { Injectable, Logger } from "@nestjs/common";
2
- import { InjectDataSource } from "@nestjs/typeorm";
3
- import { DashboardVariable } from "src/entities/dashboard-variable.entity";
4
- import { Dashboard } from "src/entities/dashboard.entity";
5
- import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
6
- import { DashboardVariableService } from "src/services/dashboard-variable.service";
7
- import { DashboardService } from "src/services/dashboard.service";
8
- import { EntitySubscriberInterface, DataSource, InsertEvent, UpdateEvent, EntityManager } from "typeorm";
9
-
10
- @Injectable()
11
- export class DashboardVariableSubscriber implements EntitySubscriberInterface<DashboardVariable> {
12
- private readonly logger = new Logger(this.constructor.name);
13
- constructor(
14
- @InjectDataSource()
15
- private readonly dataSource: DataSource,
16
- readonly moduleMetadataHelperService: ModuleMetadataHelperService,
17
- readonly dashboardService: DashboardService, // Assuming you have a DashboardService for custom queries
18
- ) {
19
- this.dataSource.subscribers.push(this);
20
- }
21
-
22
- listenTo() {
23
- return DashboardVariable;
24
- }
25
-
26
- async afterInsert(event: InsertEvent<DashboardVariable>) {
27
- if (!event.entity) {
28
- this.logger.debug('No dashboard variable entity found in the DashboardVariableSubscriber afterInsert method');
29
- return;
30
- }
31
- await this.saveDashboardToConfig(event.entity, event.queryRunner.manager);
32
- }
33
-
34
- async afterUpdate(event: UpdateEvent<DashboardVariable>) {
35
- if (!event.databaseEntity) {
36
- this.logger.debug('No dashboard variable entity found in the DashboardVariableSubscriber afterUpdate method');
37
- return;
38
- }
39
- await this.saveDashboardToConfig(event.databaseEntity, event.queryRunner.manager);
40
- }
41
-
42
- private async saveDashboardToConfig(dashboardVariable: DashboardVariable, entityManager: EntityManager): Promise<void> {
43
- const dashboard = dashboardVariable.dashboard;
44
- // Get the dashboard from the question & call the saveDashboardToConfig method
45
- if (!dashboard) {
46
- this.logger.debug(`Dashboard is undefined for dashboard variable id ${dashboardVariable.id}`);
47
- return;
48
- }
49
-
50
- // populate the dashboard with its variables
51
- const populatedDashboard = await entityManager.findOne(Dashboard, {
52
- where: { id: dashboard.id },
53
- relations: ['module','dashboardVariables', 'questions', 'questions.questionSqlDatasetConfigs'],
54
- });
55
-
56
- if (!populatedDashboard) {
57
- throw new Error(`Dashboard not found for question id ${populatedDashboard.id}`);
58
- }
59
-
60
- // Call the saveDashboardToConfig method from the DashboardService
61
- await this.dashboardService.saveDashboardToConfig(populatedDashboard);
62
- }
63
- }
@@ -1,62 +0,0 @@
1
- import { Injectable, Logger } from '@nestjs/common';
2
- import { InjectDataSource } from "@nestjs/typeorm";
3
- import { Dashboard } from 'src/entities/dashboard.entity';
4
- import { ModuleMetadataHelperService } from "src/helpers/module-metadata-helper.service";
5
- import { DashboardService } from 'src/services/dashboard.service';
6
- import { DataSource, EntityManager, EntitySubscriberInterface, InsertEvent, UpdateEvent } from "typeorm";
7
-
8
- @Injectable()
9
- export class DashboardSubscriber implements EntitySubscriberInterface<Dashboard> {
10
- private readonly logger = new Logger(this.constructor.name);
11
- constructor(
12
- @InjectDataSource()
13
- private readonly dataSource: DataSource,
14
- readonly moduleMetadataHelperService: ModuleMetadataHelperService,
15
- readonly dashboardService: DashboardService, // Assuming you have a DashboardService for custom queries
16
- ) {
17
- this.dataSource.subscribers.push(this);
18
- }
19
-
20
- listenTo() {
21
- return Dashboard;
22
- }
23
-
24
- async afterInsert(event: InsertEvent<Dashboard>) {
25
- if (!event.entity) {
26
- this.logger.debug('No dashboard entity found in the DashboardSubscriber afterInsert method');
27
- return;
28
- }
29
- await this.saveDashboardToConfig(event.entity, event.queryRunner.manager);
30
- }
31
-
32
- async afterUpdate(event: UpdateEvent<Dashboard>) {
33
- if (!event.entity) {
34
- this.logger.debug('No dashboard entity found in the DashboardSubscriber afterInsert method');
35
- return;
36
- }
37
-
38
- await this.saveDashboardToConfig(event.databaseEntity, event.queryRunner.manager);
39
- }
40
-
41
- private async saveDashboardToConfig(dashboard: Dashboard, entityManager: EntityManager): Promise<void> {
42
- if (!dashboard || !dashboard.id) {
43
- this.logger.debug('Dashboard or dashboard id is undefined');
44
- return;
45
- }
46
-
47
- // Load the dashboard with module relation populated
48
- const populatedDashboard = await entityManager.findOne(Dashboard, {
49
- where: { id: dashboard.id },
50
- relations: ['module','dashboardVariables', 'questions', 'questions.questionSqlDatasetConfigs'],
51
- });
52
-
53
- if (!populatedDashboard) {
54
- this.logger.error(`Dashboard not found for id ${dashboard.id}`);
55
- return;
56
- }
57
-
58
- // Call the saveDashboardToConfig method from the DashboardService
59
- await this.dashboardService.saveDashboardToConfig(populatedDashboard);
60
- }
61
-
62
- }