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

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 (481) hide show
  1. package/CLAUDE.md +9 -1
  2. package/dist/commands/info.command.d.ts.map +1 -1
  3. package/dist/commands/info.command.js +0 -2
  4. package/dist/commands/info.command.js.map +1 -1
  5. package/dist/controllers/dashboard-user-layout.controller.d.ts +43 -0
  6. package/dist/controllers/dashboard-user-layout.controller.d.ts.map +1 -0
  7. package/dist/controllers/{dashboard-variable.controller.js → dashboard-user-layout.controller.js} +30 -30
  8. package/dist/controllers/dashboard-user-layout.controller.js.map +1 -0
  9. package/dist/controllers/dashboard.controller.d.ts +12 -42
  10. package/dist/controllers/dashboard.controller.d.ts.map +1 -1
  11. package/dist/controllers/dashboard.controller.js +71 -141
  12. package/dist/controllers/dashboard.controller.js.map +1 -1
  13. package/dist/decorators/dashboard-widget-data-provider.decorator.d.ts +3 -0
  14. package/dist/decorators/dashboard-widget-data-provider.decorator.d.ts.map +1 -0
  15. package/dist/decorators/dashboard-widget-data-provider.decorator.js +8 -0
  16. package/dist/decorators/dashboard-widget-data-provider.decorator.js.map +1 -0
  17. package/dist/dtos/create-dashboard-user-layout.dto.d.ts +10 -0
  18. package/dist/dtos/create-dashboard-user-layout.dto.d.ts.map +1 -0
  19. package/dist/dtos/create-dashboard-user-layout.dto.js +66 -0
  20. package/dist/dtos/create-dashboard-user-layout.dto.js.map +1 -0
  21. package/dist/dtos/create-model-metadata.dto.d.ts +2 -2
  22. package/dist/dtos/create-model-metadata.dto.d.ts.map +1 -1
  23. package/dist/dtos/create-model-metadata.dto.js +6 -11
  24. package/dist/dtos/create-model-metadata.dto.js.map +1 -1
  25. package/dist/dtos/dashboard-variable-options-query.dto.d.ts +7 -0
  26. package/dist/dtos/dashboard-variable-options-query.dto.d.ts.map +1 -0
  27. package/dist/dtos/dashboard-variable-options-query.dto.js +40 -0
  28. package/dist/dtos/dashboard-variable-options-query.dto.js.map +1 -0
  29. package/dist/dtos/dashboard-widget-data-request.dto.d.ts +12 -0
  30. package/dist/dtos/dashboard-widget-data-request.dto.d.ts.map +1 -0
  31. package/dist/dtos/dashboard-widget-data-request.dto.js +65 -0
  32. package/dist/dtos/dashboard-widget-data-request.dto.js.map +1 -0
  33. package/dist/dtos/update-dashboard-user-layout.dto.d.ts +11 -0
  34. package/dist/dtos/update-dashboard-user-layout.dto.d.ts.map +1 -0
  35. package/dist/dtos/{update-dashboard-layout.dto.js → update-dashboard-user-layout.dto.js} +34 -16
  36. package/dist/dtos/update-dashboard-user-layout.dto.js.map +1 -0
  37. package/dist/entities/dashboard-user-layout.entity.d.ts +11 -0
  38. package/dist/entities/dashboard-user-layout.entity.d.ts.map +1 -0
  39. package/dist/entities/dashboard-user-layout.entity.js +52 -0
  40. package/dist/entities/dashboard-user-layout.entity.js.map +1 -0
  41. package/dist/entities/legacy-common-with-id.entity.d.ts +2 -2
  42. package/dist/entities/legacy-common-with-id.entity.d.ts.map +1 -1
  43. package/dist/entities/legacy-common-with-id.entity.js +6 -6
  44. package/dist/entities/legacy-common-with-id.entity.js.map +1 -1
  45. package/dist/entities/legacy-common.entity.d.ts +1 -1
  46. package/dist/entities/legacy-common.entity.d.ts.map +1 -1
  47. package/dist/entities/legacy-common.entity.js +14 -14
  48. package/dist/entities/legacy-common.entity.js.map +1 -1
  49. package/dist/entities/model-metadata.entity.d.ts +2 -2
  50. package/dist/entities/model-metadata.entity.d.ts.map +1 -1
  51. package/dist/entities/model-metadata.entity.js +5 -8
  52. package/dist/entities/model-metadata.entity.js.map +1 -1
  53. package/dist/enums/legacy-table-type.enum.d.ts +6 -0
  54. package/dist/enums/legacy-table-type.enum.d.ts.map +1 -0
  55. package/dist/enums/legacy-table-type.enum.js +10 -0
  56. package/dist/enums/legacy-table-type.enum.js.map +1 -0
  57. package/dist/helpers/model-metadata-helper.service.d.ts +2 -1
  58. package/dist/helpers/model-metadata-helper.service.d.ts.map +1 -1
  59. package/dist/helpers/model-metadata-helper.service.js +4 -3
  60. package/dist/helpers/model-metadata-helper.service.js.map +1 -1
  61. package/dist/helpers/module-metadata-helper.service.d.ts.map +1 -1
  62. package/dist/helpers/module-metadata-helper.service.js +15 -4
  63. package/dist/helpers/module-metadata-helper.service.js.map +1 -1
  64. package/dist/helpers/solid-registry.d.ts +5 -9
  65. package/dist/helpers/solid-registry.d.ts.map +1 -1
  66. package/dist/helpers/solid-registry.js +13 -28
  67. package/dist/helpers/solid-registry.js.map +1 -1
  68. package/dist/index.d.ts +22 -5
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +22 -5
  71. package/dist/index.js.map +1 -1
  72. package/dist/interfaces.d.ts +24 -13
  73. package/dist/interfaces.d.ts.map +1 -1
  74. package/dist/interfaces.js.map +1 -1
  75. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts +1 -3
  76. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts.map +1 -1
  77. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js +2 -25
  78. package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js.map +1 -1
  79. package/dist/{repository/dashboard-layout.repository.d.ts → repositories/dashboard-user-layout.repository.d.ts} +5 -5
  80. package/dist/repositories/dashboard-user-layout.repository.d.ts.map +1 -0
  81. package/dist/{repository/dashboard-question-sql-dataset-config.repository.js → repositories/dashboard-user-layout.repository.js} +15 -10
  82. package/dist/repositories/dashboard-user-layout.repository.js.map +1 -0
  83. package/dist/seeders/module-metadata-seeder.service.d.ts +1 -6
  84. package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
  85. package/dist/seeders/module-metadata-seeder.service.js +1 -60
  86. package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
  87. package/dist/seeders/seed-data/solid-core-metadata.json +6209 -6690
  88. package/dist/seeders/system-fields-seeder.service.js +1 -1
  89. package/dist/seeders/system-fields-seeder.service.js.map +1 -1
  90. package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.d.ts +13 -0
  91. package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.d.ts.map +1 -0
  92. package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.js +55 -0
  93. package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.js.map +1 -0
  94. package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.d.ts +13 -0
  95. package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.d.ts.map +1 -0
  96. package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.js +52 -0
  97. package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.js.map +1 -0
  98. package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.d.ts +13 -0
  99. package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.d.ts.map +1 -0
  100. package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.js +52 -0
  101. package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.js.map +1 -0
  102. package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.d.ts +10 -0
  103. package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.d.ts.map +1 -0
  104. package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.js +62 -0
  105. package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.js.map +1 -0
  106. package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.d.ts +10 -0
  107. package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.d.ts.map +1 -0
  108. package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.js +82 -0
  109. package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.js.map +1 -0
  110. package/dist/services/dashboard-providers/mq-dashboard-provider-utils.d.ts +17 -0
  111. package/dist/services/dashboard-providers/mq-dashboard-provider-utils.d.ts.map +1 -0
  112. package/dist/services/dashboard-providers/mq-dashboard-provider-utils.js +130 -0
  113. package/dist/services/dashboard-providers/mq-dashboard-provider-utils.js.map +1 -0
  114. package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.d.ts +37 -0
  115. package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.d.ts.map +1 -0
  116. package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.js +112 -0
  117. package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.js.map +1 -0
  118. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.d.ts +10 -0
  119. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.d.ts.map +1 -0
  120. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.js +57 -0
  121. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.js.map +1 -0
  122. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.d.ts +10 -0
  123. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.d.ts.map +1 -0
  124. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.js +57 -0
  125. package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.js.map +1 -0
  126. package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts +10 -0
  127. package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts.map +1 -0
  128. package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js +100 -0
  129. package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js.map +1 -0
  130. package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.d.ts +10 -0
  131. package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.d.ts.map +1 -0
  132. package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.js +55 -0
  133. package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.js.map +1 -0
  134. package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.d.ts +13 -0
  135. package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.d.ts.map +1 -0
  136. package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.js +52 -0
  137. package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.js.map +1 -0
  138. package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.d.ts +15 -0
  139. package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.d.ts.map +1 -0
  140. package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.js +60 -0
  141. package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.js.map +1 -0
  142. package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.d.ts +13 -0
  143. package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.d.ts.map +1 -0
  144. package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.js +51 -0
  145. package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.js.map +1 -0
  146. package/dist/services/dashboard-runtime.service.d.ts +31 -0
  147. package/dist/services/dashboard-runtime.service.d.ts.map +1 -0
  148. package/dist/services/dashboard-runtime.service.js +408 -0
  149. package/dist/services/dashboard-runtime.service.js.map +1 -0
  150. package/dist/services/dashboard-user-layout.service.d.ts +12 -0
  151. package/dist/services/dashboard-user-layout.service.d.ts.map +1 -0
  152. package/dist/services/{dashboard-variable.service.js → dashboard-user-layout.service.js} +11 -12
  153. package/dist/services/dashboard-user-layout.service.js.map +1 -0
  154. package/dist/services/mediaStorageProviders/file-s3-storage-provider.js +9 -9
  155. package/dist/services/mediaStorageProviders/file-s3-storage-provider.js.map +1 -1
  156. package/dist/services/model-metadata.service.d.ts +2 -2
  157. package/dist/services/model-metadata.service.d.ts.map +1 -1
  158. package/dist/services/model-metadata.service.js +3 -4
  159. package/dist/services/model-metadata.service.js.map +1 -1
  160. package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.d.ts +11 -0
  161. package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.d.ts.map +1 -0
  162. package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.js +59 -0
  163. package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.js.map +1 -0
  164. package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.d.ts +11 -0
  165. package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.d.ts.map +1 -0
  166. package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.js +60 -0
  167. package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.js.map +1 -0
  168. package/dist/services/solid-introspect.service.d.ts +1 -2
  169. package/dist/services/solid-introspect.service.d.ts.map +1 -1
  170. package/dist/services/solid-introspect.service.js +12 -24
  171. package/dist/services/solid-introspect.service.js.map +1 -1
  172. package/dist/solid-core.module.d.ts.map +1 -1
  173. package/dist/solid-core.module.js +43 -66
  174. package/dist/solid-core.module.js.map +1 -1
  175. package/dist/subscribers/model-metadata.subscriber.d.ts.map +1 -1
  176. package/dist/subscribers/model-metadata.subscriber.js +1 -3
  177. package/dist/subscribers/model-metadata.subscriber.js.map +1 -1
  178. package/package.json +1 -1
  179. package/src/commands/info.command.ts +0 -2
  180. package/src/controllers/{dashboard-variable.controller.ts → dashboard-user-layout.controller.ts} +10 -10
  181. package/src/controllers/dashboard.controller.ts +70 -89
  182. package/src/decorators/dashboard-widget-data-provider.decorator.ts +6 -0
  183. package/src/dtos/create-dashboard-user-layout.dto.ts +41 -0
  184. package/src/dtos/create-model-metadata.dto.ts +5 -9
  185. package/src/dtos/dashboard-variable-options-query.dto.ts +20 -0
  186. package/src/dtos/dashboard-widget-data-request.dto.ts +34 -0
  187. package/src/dtos/update-dashboard-user-layout.dto.ts +45 -0
  188. package/src/entities/dashboard-user-layout.entity.ts +27 -0
  189. package/src/entities/legacy-common-with-id.entity.ts +2 -2
  190. package/src/entities/legacy-common.entity.ts +1 -1
  191. package/src/entities/model-metadata.entity.ts +3 -5
  192. package/src/enums/legacy-table-type.enum.ts +5 -0
  193. package/src/helpers/model-metadata-helper.service.ts +4 -3
  194. package/src/helpers/module-metadata-helper.service.ts +21 -6
  195. package/src/helpers/solid-registry.ts +15 -36
  196. package/src/index.ts +22 -5
  197. package/src/interfaces.ts +32 -19
  198. package/src/jobs/database/trigger-mcp-client-subscriber-database.service.ts +1 -34
  199. package/src/repositories/dashboard-user-layout.repository.ts +19 -0
  200. package/src/seeders/module-metadata-seeder.service.ts +0 -67
  201. package/src/seeders/seed-data/solid-core-metadata.json +6210 -6691
  202. package/src/seeders/system-fields-seeder.service.ts +1 -1
  203. package/src/services/dashboard-providers/README.md +603 -0
  204. package/src/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.ts +49 -0
  205. package/src/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.ts +45 -0
  206. package/src/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.ts +45 -0
  207. package/src/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.ts +58 -0
  208. package/src/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.ts +79 -0
  209. package/src/services/dashboard-providers/mq-dashboard-provider-utils.ts +165 -0
  210. package/src/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.ts +155 -0
  211. package/src/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.ts +51 -0
  212. package/src/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.ts +51 -0
  213. package/src/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.ts +95 -0
  214. package/src/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.ts +49 -0
  215. package/src/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.ts +45 -0
  216. package/src/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.ts +55 -0
  217. package/src/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.ts +44 -0
  218. package/src/services/dashboard-runtime.service.ts +488 -0
  219. package/src/services/dashboard-user-layout.service.ts +20 -0
  220. package/src/services/mediaStorageProviders/file-s3-storage-provider.ts +11 -11
  221. package/src/services/model-metadata.service.ts +6 -8
  222. package/src/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.ts +52 -0
  223. package/src/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.ts +51 -0
  224. package/src/services/solid-introspect.service.ts +19 -34
  225. package/src/solid-core.module.ts +43 -72
  226. package/src/subscribers/model-metadata.subscriber.ts +1 -3
  227. package/CURRENT_PROMPT +0 -6
  228. package/dist/controllers/dashboard-layout.controller.d.ts +0 -47
  229. package/dist/controllers/dashboard-layout.controller.d.ts.map +0 -1
  230. package/dist/controllers/dashboard-layout.controller.js +0 -204
  231. package/dist/controllers/dashboard-layout.controller.js.map +0 -1
  232. package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts +0 -43
  233. package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts.map +0 -1
  234. package/dist/controllers/dashboard-question-sql-dataset-config.controller.js +0 -179
  235. package/dist/controllers/dashboard-question-sql-dataset-config.controller.js.map +0 -1
  236. package/dist/controllers/dashboard-question.controller.d.ts +0 -45
  237. package/dist/controllers/dashboard-question.controller.d.ts.map +0 -1
  238. package/dist/controllers/dashboard-question.controller.js +0 -194
  239. package/dist/controllers/dashboard-question.controller.js.map +0 -1
  240. package/dist/controllers/dashboard-variable.controller.d.ts +0 -43
  241. package/dist/controllers/dashboard-variable.controller.d.ts.map +0 -1
  242. package/dist/controllers/dashboard-variable.controller.js.map +0 -1
  243. package/dist/decorators/dashboard-question-data-provider.decorator.d.ts +0 -3
  244. package/dist/decorators/dashboard-question-data-provider.decorator.d.ts.map +0 -1
  245. package/dist/decorators/dashboard-question-data-provider.decorator.js +0 -11
  246. package/dist/decorators/dashboard-question-data-provider.decorator.js.map +0 -1
  247. package/dist/decorators/dashboard-selection-provider.decorator.d.ts +0 -3
  248. package/dist/decorators/dashboard-selection-provider.decorator.d.ts.map +0 -1
  249. package/dist/decorators/dashboard-selection-provider.decorator.js +0 -11
  250. package/dist/decorators/dashboard-selection-provider.decorator.js.map +0 -1
  251. package/dist/dtos/create-dashboard-layout.dto.d.ts +0 -8
  252. package/dist/dtos/create-dashboard-layout.dto.d.ts.map +0 -1
  253. package/dist/dtos/create-dashboard-layout.dto.js +0 -53
  254. package/dist/dtos/create-dashboard-layout.dto.js.map +0 -1
  255. package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts +0 -12
  256. package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts.map +0 -1
  257. package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js +0 -77
  258. package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js.map +0 -1
  259. package/dist/dtos/create-dashboard-question.dto.d.ts +0 -17
  260. package/dist/dtos/create-dashboard-question.dto.d.ts.map +0 -1
  261. package/dist/dtos/create-dashboard-question.dto.js +0 -105
  262. package/dist/dtos/create-dashboard-question.dto.js.map +0 -1
  263. package/dist/dtos/create-dashboard-variable.dto.d.ts +0 -19
  264. package/dist/dtos/create-dashboard-variable.dto.d.ts.map +0 -1
  265. package/dist/dtos/create-dashboard-variable.dto.js +0 -103
  266. package/dist/dtos/create-dashboard-variable.dto.js.map +0 -1
  267. package/dist/dtos/create-dashboard.dto.d.ts +0 -17
  268. package/dist/dtos/create-dashboard.dto.d.ts.map +0 -1
  269. package/dist/dtos/create-dashboard.dto.js +0 -102
  270. package/dist/dtos/create-dashboard.dto.js.map +0 -1
  271. package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.d.ts +0 -8
  272. package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.d.ts.map +0 -1
  273. package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.js +0 -52
  274. package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.js.map +0 -1
  275. package/dist/dtos/update-dashboard-layout.dto.d.ts +0 -8
  276. package/dist/dtos/update-dashboard-layout.dto.d.ts.map +0 -1
  277. package/dist/dtos/update-dashboard-layout.dto.js.map +0 -1
  278. package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts +0 -13
  279. package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts.map +0 -1
  280. package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js +0 -86
  281. package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js.map +0 -1
  282. package/dist/dtos/update-dashboard-question.dto.d.ts +0 -18
  283. package/dist/dtos/update-dashboard-question.dto.d.ts.map +0 -1
  284. package/dist/dtos/update-dashboard-question.dto.js +0 -112
  285. package/dist/dtos/update-dashboard-question.dto.js.map +0 -1
  286. package/dist/dtos/update-dashboard-variable.dto.d.ts +0 -16
  287. package/dist/dtos/update-dashboard-variable.dto.d.ts.map +0 -1
  288. package/dist/dtos/update-dashboard-variable.dto.js +0 -101
  289. package/dist/dtos/update-dashboard-variable.dto.js.map +0 -1
  290. package/dist/dtos/update-dashboard.dto.d.ts +0 -18
  291. package/dist/dtos/update-dashboard.dto.d.ts.map +0 -1
  292. package/dist/dtos/update-dashboard.dto.js +0 -108
  293. package/dist/dtos/update-dashboard.dto.js.map +0 -1
  294. package/dist/entities/dashboard-layout.entity.d.ts +0 -9
  295. package/dist/entities/dashboard-layout.entity.d.ts.map +0 -1
  296. package/dist/entities/dashboard-layout.entity.js +0 -41
  297. package/dist/entities/dashboard-layout.entity.js.map +0 -1
  298. package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts +0 -14
  299. package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts.map +0 -1
  300. package/dist/entities/dashboard-question-sql-dataset-config.entity.js +0 -66
  301. package/dist/entities/dashboard-question-sql-dataset-config.entity.js.map +0 -1
  302. package/dist/entities/dashboard-question.entity.d.ts +0 -17
  303. package/dist/entities/dashboard-question.entity.d.ts.map +0 -1
  304. package/dist/entities/dashboard-question.entity.js +0 -77
  305. package/dist/entities/dashboard-question.entity.js.map +0 -1
  306. package/dist/entities/dashboard-variable.entity.d.ts +0 -16
  307. package/dist/entities/dashboard-variable.entity.d.ts.map +0 -1
  308. package/dist/entities/dashboard-variable.entity.js +0 -79
  309. package/dist/entities/dashboard-variable.entity.js.map +0 -1
  310. package/dist/entities/dashboard.entity.d.ts +0 -16
  311. package/dist/entities/dashboard.entity.d.ts.map +0 -1
  312. package/dist/entities/dashboard.entity.js +0 -64
  313. package/dist/entities/dashboard.entity.js.map +0 -1
  314. package/dist/mappers/dashboard-mapper.d.ts +0 -6
  315. package/dist/mappers/dashboard-mapper.d.ts.map +0 -1
  316. package/dist/mappers/dashboard-mapper.js +0 -62
  317. package/dist/mappers/dashboard-mapper.js.map +0 -1
  318. package/dist/repository/dashboard-layout.repository.d.ts.map +0 -1
  319. package/dist/repository/dashboard-layout.repository.js +0 -34
  320. package/dist/repository/dashboard-layout.repository.js.map +0 -1
  321. package/dist/repository/dashboard-question-sql-dataset-config.repository.d.ts +0 -12
  322. package/dist/repository/dashboard-question-sql-dataset-config.repository.d.ts.map +0 -1
  323. package/dist/repository/dashboard-question-sql-dataset-config.repository.js.map +0 -1
  324. package/dist/repository/dashboard-question.repository.d.ts +0 -12
  325. package/dist/repository/dashboard-question.repository.d.ts.map +0 -1
  326. package/dist/repository/dashboard-question.repository.js +0 -34
  327. package/dist/repository/dashboard-question.repository.js.map +0 -1
  328. package/dist/repository/dashboard-variable.repository.d.ts +0 -12
  329. package/dist/repository/dashboard-variable.repository.d.ts.map +0 -1
  330. package/dist/repository/dashboard-variable.repository.js +0 -34
  331. package/dist/repository/dashboard-variable.repository.js.map +0 -1
  332. package/dist/repository/dashboard.repository.d.ts +0 -13
  333. package/dist/repository/dashboard.repository.d.ts.map +0 -1
  334. package/dist/repository/dashboard.repository.js +0 -104
  335. package/dist/repository/dashboard.repository.js.map +0 -1
  336. package/dist/services/dashboard-layout.service.d.ts +0 -20
  337. package/dist/services/dashboard-layout.service.d.ts.map +0 -1
  338. package/dist/services/dashboard-layout.service.js +0 -120
  339. package/dist/services/dashboard-layout.service.js.map +0 -1
  340. package/dist/services/dashboard-question-sql-dataset-config.service.d.ts +0 -12
  341. package/dist/services/dashboard-question-sql-dataset-config.service.d.ts.map +0 -1
  342. package/dist/services/dashboard-question-sql-dataset-config.service.js +0 -38
  343. package/dist/services/dashboard-question-sql-dataset-config.service.js.map +0 -1
  344. package/dist/services/dashboard-question.service.d.ts +0 -23
  345. package/dist/services/dashboard-question.service.d.ts.map +0 -1
  346. package/dist/services/dashboard-question.service.js +0 -135
  347. package/dist/services/dashboard-question.service.js.map +0 -1
  348. package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.d.ts +0 -12
  349. package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.d.ts.map +0 -1
  350. package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.js +0 -55
  351. package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.js.map +0 -1
  352. package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.d.ts +0 -11
  353. package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.d.ts.map +0 -1
  354. package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.js +0 -45
  355. package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.js.map +0 -1
  356. package/dist/services/dashboard-variable.service.d.ts +0 -13
  357. package/dist/services/dashboard-variable.service.d.ts.map +0 -1
  358. package/dist/services/dashboard-variable.service.js.map +0 -1
  359. package/dist/services/dashboard.service.d.ts +0 -29
  360. package/dist/services/dashboard.service.d.ts.map +0 -1
  361. package/dist/services/dashboard.service.js +0 -171
  362. package/dist/services/dashboard.service.js.map +0 -1
  363. package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.d.ts +0 -12
  364. package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.d.ts.map +0 -1
  365. package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.js +0 -41
  366. package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.js.map +0 -1
  367. package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.d.ts +0 -12
  368. package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.d.ts.map +0 -1
  369. package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.js +0 -42
  370. package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.js.map +0 -1
  371. package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.d.ts +0 -25
  372. package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.d.ts.map +0 -1
  373. package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.js +0 -116
  374. package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.js.map +0 -1
  375. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.d.ts +0 -12
  376. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.d.ts.map +0 -1
  377. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.js +0 -37
  378. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.js.map +0 -1
  379. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.d.ts +0 -12
  380. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.d.ts.map +0 -1
  381. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.js +0 -38
  382. package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.js.map +0 -1
  383. package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.d.ts +0 -12
  384. package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.d.ts.map +0 -1
  385. package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.js +0 -38
  386. package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.js.map +0 -1
  387. package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts +0 -34
  388. package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts.map +0 -1
  389. package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js +0 -90
  390. package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js.map +0 -1
  391. package/dist/services/question-data-providers/helpers.d.ts +0 -7
  392. package/dist/services/question-data-providers/helpers.d.ts.map +0 -1
  393. package/dist/services/question-data-providers/helpers.js +0 -25
  394. package/dist/services/question-data-providers/helpers.js.map +0 -1
  395. package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts +0 -14
  396. package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts.map +0 -1
  397. package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js +0 -71
  398. package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js.map +0 -1
  399. package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts +0 -16
  400. package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts.map +0 -1
  401. package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js +0 -93
  402. package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js.map +0 -1
  403. package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.d.ts +0 -11
  404. package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.d.ts.map +0 -1
  405. package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js +0 -49
  406. package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js.map +0 -1
  407. package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.d.ts +0 -11
  408. package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.d.ts.map +0 -1
  409. package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.js +0 -47
  410. package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.js.map +0 -1
  411. package/dist/services/sql-expression-resolver.service.d.ts +0 -12
  412. package/dist/services/sql-expression-resolver.service.d.ts.map +0 -1
  413. package/dist/services/sql-expression-resolver.service.js +0 -121
  414. package/dist/services/sql-expression-resolver.service.js.map +0 -1
  415. package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts +0 -16
  416. package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts.map +0 -1
  417. package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js +0 -72
  418. package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js.map +0 -1
  419. package/dist/subscribers/dashboard-question.subscriber.d.ts +0 -16
  420. package/dist/subscribers/dashboard-question.subscriber.d.ts.map +0 -1
  421. package/dist/subscribers/dashboard-question.subscriber.js +0 -72
  422. package/dist/subscribers/dashboard-question.subscriber.js.map +0 -1
  423. package/dist/subscribers/dashboard-variable.subscriber.d.ts +0 -16
  424. package/dist/subscribers/dashboard-variable.subscriber.d.ts.map +0 -1
  425. package/dist/subscribers/dashboard-variable.subscriber.js +0 -72
  426. package/dist/subscribers/dashboard-variable.subscriber.js.map +0 -1
  427. package/dist/subscribers/dashboard.subscriber.d.ts +0 -16
  428. package/dist/subscribers/dashboard.subscriber.d.ts.map +0 -1
  429. package/dist/subscribers/dashboard.subscriber.js +0 -71
  430. package/dist/subscribers/dashboard.subscriber.js.map +0 -1
  431. package/src/controllers/dashboard-layout.controller.ts +0 -106
  432. package/src/controllers/dashboard-question-sql-dataset-config.controller.ts +0 -93
  433. package/src/controllers/dashboard-question.controller.ts +0 -104
  434. package/src/decorators/dashboard-question-data-provider.decorator.ts +0 -7
  435. package/src/decorators/dashboard-selection-provider.decorator.ts +0 -7
  436. package/src/dtos/create-dashboard-layout.dto.ts +0 -31
  437. package/src/dtos/create-dashboard-question-sql-dataset-config.dto.ts +0 -42
  438. package/src/dtos/create-dashboard-question.dto.ts +0 -62
  439. package/src/dtos/create-dashboard-variable.dto.ts +0 -60
  440. package/src/dtos/create-dashboard.dto.ts +0 -61
  441. package/src/dtos/dashboard-variable-selection-dynamic-query.dto.ts +0 -29
  442. package/src/dtos/update-dashboard-layout.dto.ts +0 -30
  443. package/src/dtos/update-dashboard-question-sql-dataset-config.dto.ts +0 -49
  444. package/src/dtos/update-dashboard-question.dto.ts +0 -67
  445. package/src/dtos/update-dashboard-variable.dto.ts +0 -58
  446. package/src/dtos/update-dashboard.dto.ts +0 -65
  447. package/src/entities/dashboard-layout.entity.ts +0 -18
  448. package/src/entities/dashboard-question-sql-dataset-config.entity.ts +0 -37
  449. package/src/entities/dashboard-question.entity.ts +0 -46
  450. package/src/entities/dashboard-variable.entity.ts +0 -44
  451. package/src/entities/dashboard.entity.ts +0 -36
  452. package/src/mappers/dashboard-mapper.ts +0 -53
  453. package/src/repository/dashboard-layout.repository.ts +0 -17
  454. package/src/repository/dashboard-question-sql-dataset-config.repository.ts +0 -17
  455. package/src/repository/dashboard-question.repository.ts +0 -17
  456. package/src/repository/dashboard-variable.repository.ts +0 -17
  457. package/src/repository/dashboard.repository.ts +0 -101
  458. package/src/services/dashboard-layout.service.ts +0 -111
  459. package/src/services/dashboard-question-sql-dataset-config.service.ts +0 -25
  460. package/src/services/dashboard-question.service.ts +0 -150
  461. package/src/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.ts +0 -56
  462. package/src/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.ts +0 -37
  463. package/src/services/dashboard-variable.service.ts +0 -27
  464. package/src/services/dashboard.service.ts +0 -148
  465. package/src/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.ts +0 -43
  466. package/src/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.ts +0 -44
  467. package/src/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.ts +0 -114
  468. package/src/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.ts +0 -38
  469. package/src/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.ts +0 -40
  470. package/src/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.ts +0 -39
  471. package/src/services/question-data-providers/chartjs-sql-data-provider.service.ts +0 -121
  472. package/src/services/question-data-providers/helpers.ts +0 -30
  473. package/src/services/question-data-providers/prime-react-datatable-sql-data-provider.service.ts +0 -74
  474. package/src/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.ts +0 -115
  475. package/src/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.ts +0 -44
  476. package/src/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.ts +0 -41
  477. package/src/services/sql-expression-resolver.service.ts +0 -140
  478. package/src/subscribers/dashboard-question-sql-dataset-config.subscriber.ts +0 -61
  479. package/src/subscribers/dashboard-question.subscriber.ts +0 -62
  480. package/src/subscribers/dashboard-variable.subscriber.ts +0 -63
  481. package/src/subscribers/dashboard.subscriber.ts +0 -62
@@ -1,148 +0,0 @@
1
- import { Injectable, Logger, NotFoundException } from '@nestjs/common';
2
- import { ModuleRef } from "@nestjs/core";
3
- import { InjectEntityManager } from '@nestjs/typeorm';
4
- import { EntityManager } from 'typeorm';
5
-
6
- import { CRUDService } from 'src/services/crud.service';
7
-
8
-
9
- import * as fs from 'fs/promises'; // Use the Promise-based version of fs for async/await
10
- import { SelectionDynamicSourceType } from 'src/dtos/create-dashboard-variable.dto';
11
- import { DashboardVariableSelectionDynamicQueryDto } from 'src/dtos/dashboard-variable-selection-dynamic-query.dto';
12
- import { DashboardVariable } from 'src/entities/dashboard-variable.entity';
13
- import { ModuleMetadataHelperService } from 'src/helpers/module-metadata-helper.service';
14
- import { SolidRegistry } from 'src/helpers/solid-registry';
15
- import { DashboardMapper } from 'src/mappers/dashboard-mapper';
16
- import { DashboardRepository } from 'src/repository/dashboard.repository';
17
- import { Dashboard } from '../entities/dashboard.entity';
18
- import { CreateDashboardDto } from 'src/dtos/create-dashboard.dto';
19
-
20
-
21
- export const SQL_DYNAMIC_PROVIDER_NAME = 'DashboardVariableSQLDynamicProvider';
22
- @Injectable()
23
- export class DashboardService extends CRUDService<Dashboard> {
24
- private readonly logger = new Logger(this.constructor.name);
25
- constructor(
26
- @InjectEntityManager()
27
- readonly entityManager: EntityManager,
28
- readonly repo: DashboardRepository, // Assuming you have a DashboardRepository for custom queries
29
- readonly moduleRef: ModuleRef,
30
- readonly solidRegistry: SolidRegistry, // Assuming solidRegistry is injected for selection providers
31
- readonly moduleMetadataHelperService: ModuleMetadataHelperService,
32
- readonly dashboardMapper: DashboardMapper,
33
- ) {
34
- super(entityManager, repo, 'dashboard', 'solid-core', moduleRef);
35
- }
36
-
37
-
38
- async create(createDto: CreateDashboardDto, files: Express.Multer.File[]) {
39
- createDto.name = createDto.name.trim().replace(/\s+/g, '-').toLowerCase();
40
- return super.create(createDto, files);
41
- }
42
-
43
- async getSelectionDynamicValues(query: DashboardVariableSelectionDynamicQueryDto) {
44
- // Get the dashboard variable repo
45
- const dashboardVariable = await this.loadDashboardVariable(query.variableId);
46
-
47
- // Get the providerName and context for the dashboard variable
48
- const [providerName, context] = this.getProviderNameAndContext(dashboardVariable, query);
49
-
50
- // Get hold of the provider instance from the SolidRegistry
51
- const selectionProviderInstance = this.solidRegistry.getDashboardVariableSelectionProviderInstance(providerName);
52
- if (!selectionProviderInstance) {
53
- throw new NotFoundException(`Field incorrectly configured. No provider with name ${providerName} registered in backend.`);
54
- }
55
-
56
- // 4. Call the provider's getSelectionDynamicValues method
57
- return selectionProviderInstance.values(query.query, context);
58
- }
59
-
60
-
61
- private getProviderNameAndContext(dashboardVariable: DashboardVariable, query: DashboardVariableSelectionDynamicQueryDto): [string, any] {
62
- const sourceType = dashboardVariable.selectionDynamicSourceType;
63
-
64
- // Get the appropriate provide name based on the source type
65
- let providerName: string;
66
- const context = { limit: query.limit, offset: query.offset };
67
- switch (sourceType) {
68
- case SelectionDynamicSourceType.SQL:
69
- providerName = SQL_DYNAMIC_PROVIDER_NAME;
70
- context['sql'] = dashboardVariable.selectionDynamicSQL;
71
- break;
72
- case SelectionDynamicSourceType.PROVIDER:
73
- providerName = dashboardVariable.selectionDynamicProviderName;
74
- break;
75
- default:
76
- throw new Error(`Unsupported selection dynamic source type: ${sourceType}`);
77
- }
78
- return [providerName, context];
79
- }
80
-
81
- private async loadDashboardVariable(variableId: number) {
82
- const dashboardVariableRepo = this.entityManager.getRepository(DashboardVariable);
83
-
84
- // Load the dashboard record using the field
85
- const dashboardVariable = await dashboardVariableRepo.findOne({
86
- where: {
87
- id: variableId,
88
- },
89
- });
90
- return dashboardVariable;
91
- }
92
-
93
- async saveDashboardToConfig(entity: Dashboard) {
94
- if (!entity) {
95
- this.logger.debug('No entity found in the DashboardSubscriber saveDashboardToConfig method');
96
- return;
97
- }
98
-
99
- // Validate dashboard details
100
- const dashboard = entity as Dashboard;
101
- const moduleMetadata = entity.module;
102
- if (!moduleMetadata) {
103
- throw new Error(`Module metadata not found for dashboard id ${entity.id}`);
104
- }
105
-
106
- // Get config file details
107
- const { filePath, metaData } = await this.getConfigFileDetails(moduleMetadata.name);
108
- if (!filePath || !metaData) {
109
- throw new Error(`Configuration details not found for module: ${moduleMetadata.name}`);
110
- }
111
-
112
- // Write the dashboard to the config file
113
- await this.writeToConfig(metaData, dashboard, filePath);
114
- }
115
-
116
- private async getConfigFileDetails(moduleName: string): Promise<{ filePath: string; metaData: any }> {
117
- const filePath = await this.moduleMetadataHelperService.getModuleMetadataFilePath(moduleName);
118
- try {
119
- await fs.access(filePath);
120
- } catch (error: any) {
121
- throw new Error(`Configuration file not found for module: ${moduleName}`);
122
- }
123
- const metaData = await this.moduleMetadataHelperService.getModuleMetadataConfiguration(filePath);
124
- return { filePath, metaData };
125
- }
126
-
127
- private async writeToConfig(metaData: any, dashboard: Dashboard, filePath: string) {
128
- if (metaData.dashboards && Array.isArray(metaData.dashboards)) {
129
- const dashboardIndex = metaData.dashboards?.findIndex((dashboardFromFile: { name: string; }) => dashboardFromFile.name === dashboard.name);
130
- const dto = await this.dashboardMapper.toDto(dashboard);
131
- if (dashboardIndex !== -1) {
132
- metaData.dashboards[dashboardIndex] = dto;
133
- }
134
- else {
135
- metaData.dashboards.push(dto);
136
- }
137
- }
138
- else {
139
- const dashboards = [];
140
- const dto = await this.dashboardMapper.toDto(dashboard);
141
- dashboards.push(dto);
142
- metaData.dashboards = dashboards;
143
- }
144
- // Write the updated object back to the file
145
- const updatedContent = JSON.stringify(metaData, null, 2);
146
- await fs.writeFile(filePath, updatedContent);
147
- }
148
- }
@@ -1,43 +0,0 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { plainToInstance } from "class-transformer";
3
- import { CreateDashboardQuestionDto } from "src/dtos/create-dashboard-question.dto";
4
- import { AiInteraction } from "src/entities/ai-interaction.entity";
5
- import { IMcpToolResponseHandler } from "../../../interfaces";
6
- import { DashboardQuestionService } from "../../dashboard-question.service";
7
-
8
- @Injectable()
9
- export class SolidAddQuestionToDashboardMcpHandler implements IMcpToolResponseHandler {
10
-
11
- constructor(
12
- private readonly dashboardQuestionService: DashboardQuestionService,
13
- ) {
14
- }
15
-
16
- async apply(aiInteraction: AiInteraction) {
17
- const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
18
- const aiResponseMessage = JSON.parse(escapedMessage);
19
-
20
- const {data} = aiResponseMessage;
21
- const { dashboardUserKey, schema} = data;
22
-
23
- //FIXME: Replace \' with ' in the response, since the AI response seems to contain \' which is invalid JSON.
24
- // This is a workaround for now, until we find a better solution.
25
- // const aiResponseMessageReplaced = aiResponseMessage['message'].replace(/\\'/g, "'");
26
- // const dashboardUserKey = aiResponseMessageReplaced['dashboardUserKey'];
27
- // if (!dashboardUserKey) {
28
- // throw new Error("Dashboard User Key is required to create a Dashboard Question.");
29
- // }
30
- const dashboardQuestionDto = plainToInstance(CreateDashboardQuestionDto, schema);
31
- dashboardQuestionDto['questionSqlDatasetConfigsCommand'] = "update";
32
- dashboardQuestionDto['dashboardUserKey'] = dashboardUserKey;
33
-
34
- const dashboardQuestion = await this.dashboardQuestionService.create(dashboardQuestionDto, []);
35
-
36
- // TODO: decide on some shape to return hre...
37
- return {
38
- seedingRequired: false,
39
- serverRebooting: false,
40
- }
41
- }
42
-
43
- }
@@ -1,44 +0,0 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { plainToInstance } from "class-transformer";
3
- import { CreateDashboardVariableDto } from "src/dtos/create-dashboard-variable.dto";
4
- import { AiInteraction } from "src/entities/ai-interaction.entity";
5
- import { DashboardVariableService } from "src/services/dashboard-variable.service";
6
- import { IMcpToolResponseHandler } from "../../../interfaces";
7
-
8
- @Injectable()
9
- export class SolidAddVariableToDashboardMcpHandler implements IMcpToolResponseHandler {
10
-
11
- constructor(
12
- private readonly dashboardVariableService: DashboardVariableService,
13
- ) {
14
- }
15
-
16
- async apply(aiInteraction: AiInteraction) {
17
- const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
18
- const aiResponseMessage = JSON.parse(escapedMessage);
19
-
20
- const {data} = aiResponseMessage;
21
- const { dashboardUserKey, schema} = data;
22
-
23
- //FIXME: Replace \' with ' in the response, since the AI response seems to contain \' which is invalid JSON.
24
- // This is a workaround for now, until we find a better solution.
25
- // const aiResponseMessageReplaced = aiResponseMessage['message'].replace(/\\'/g, "'");
26
- // const dashboardUserKey = aiResponseMessageReplaced['dashboardUserKey'];
27
- // if (!dashboardUserKey) {
28
- // throw new Error("Dashboard User Key is required to create a Dashboard Question.");
29
- // }
30
- const dashboardVariableDto = plainToInstance(CreateDashboardVariableDto, schema);
31
- dashboardVariableDto['selectionStaticValues'] = JSON.stringify(dashboardVariableDto['selectionStaticValues'] || []);
32
- dashboardVariableDto['defaultValue'] = JSON.stringify(dashboardVariableDto['defaultValue'] || []);
33
- dashboardVariableDto['dashboardUserKey'] = dashboardUserKey;
34
-
35
- const dashboardVariable = await this.dashboardVariableService.create(dashboardVariableDto, []);
36
-
37
- // TODO: decide on some shape to return hre...
38
- return {
39
- seedingRequired: false,
40
- serverRebooting: false,
41
- }
42
- }
43
-
44
- }
@@ -1,114 +0,0 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { plainToInstance } from "class-transformer";
3
- import { CreateDashboardDto } from "src/dtos/create-dashboard.dto";
4
- import { UpdateMenuItemMetadataDto } from "src/dtos/update-menu-item-metadata.dto";
5
- import { AiInteraction } from "src/entities/ai-interaction.entity";
6
- import { Dashboard } from "src/entities/dashboard.entity";
7
- import { IMcpToolResponseHandler } from "../../../interfaces";
8
- import { ActionMetadataService } from "../../action-metadata.service";
9
- import { DashboardService } from "../../dashboard.service";
10
- import { MenuItemMetadataService } from "../../menu-item-metadata.service";
11
- import { ModelMetadataService } from "../../model-metadata.service";
12
- import { ModuleMetadataService } from "../../module-metadata.service";
13
- import { RoleMetadataService } from "../../role-metadata.service";
14
-
15
- @Injectable()
16
- export class SolidCreateDashboardWithWidgetsMcpHandler implements IMcpToolResponseHandler {
17
-
18
- constructor(
19
- private readonly dashboardService: DashboardService,
20
- private readonly actionMetadataService: ActionMetadataService,
21
- private readonly menuItemMetadataService: MenuItemMetadataService,
22
- private readonly moduleMetadataService: ModuleMetadataService,
23
- private readonly modelMetadataService: ModelMetadataService,
24
- private readonly roleService: RoleMetadataService, // Assuming roleService is a Mongoose model, adjust as necessary
25
- ) {
26
- }
27
-
28
- async apply(aiInteraction: AiInteraction) {
29
- const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
30
- const aiResponseMessage = JSON.parse(escapedMessage);
31
- const { data } = aiResponseMessage;
32
- const { schema } = data;
33
- const { dashboardDto, dashboard } = await this.createDashboard(schema);
34
-
35
- const { moduleUserKey, actionMetadataEntity } = await this.createActionMetadataEntry(dashboardDto, dashboard);
36
-
37
- await this.createMenuItemEntry(dashboard, moduleUserKey, actionMetadataEntity);
38
-
39
- // TODO: decide on some shape to return hre...
40
- return {
41
- seedingRequired: false,
42
- serverRebooting: false,
43
- }
44
- }
45
-
46
-
47
- private async createMenuItemEntry(dashboard: Dashboard, moduleUserKey: string, actionMetadataEntity: any) {
48
- const menuData = {
49
- displayName: dashboard.displayName || dashboard.name,
50
- name: `${moduleUserKey}-${dashboard.name}-dashboard-menu-item`,
51
- sequenceNumber: 1,
52
- actionUserKey: actionMetadataEntity.name,
53
- moduleUserKey: moduleUserKey,
54
- parentMenuItemUserKey: '',
55
- };
56
-
57
- const adminRole = await this.roleService.findRoleByName('Admin');
58
- const specifiedRoles = menuData['roles'];
59
-
60
- // If the developer has specified roles, then resolve them, making sure that admin role is also given.
61
- const specifiedRoleObjects = [adminRole];
62
- if (specifiedRoles) {
63
- for (let i = 0; i < specifiedRoles.length; i++) {
64
- const specifiedRole = specifiedRoles[i];
65
- const specifiedRoleObject = await this.roleService.findRoleByName(specifiedRole);
66
- if (!specifiedRoleObject) {
67
- throw new Error(`Invalid role: (${specifiedRole}) specified against menu with display name ${menuData.displayName}.`);
68
- }
69
- specifiedRoleObjects.push(specifiedRoleObject);
70
- }
71
- }
72
-
73
- menuData['roles'] = specifiedRoleObjects;
74
- menuData['action'] = await this.actionMetadataService.findOneByUserKey(menuData.actionUserKey);
75
- menuData['module'] = await this.moduleMetadataService.findOneByUserKey(menuData.moduleUserKey);
76
-
77
- if (menuData.parentMenuItemUserKey) {
78
- menuData['parentMenuItem'] = await this.menuItemMetadataService.findOneByUserKey(menuData.parentMenuItemUserKey);
79
- } else {
80
- menuData['parentMenuItem'] = null;
81
- }
82
- await this.menuItemMetadataService.upsert(menuData as unknown as UpdateMenuItemMetadataDto);
83
- }
84
-
85
- private async createActionMetadataEntry(dashboardDto: CreateDashboardDto, dashboard: Dashboard) {
86
- const moduleUserKey = dashboardDto.moduleUserKey;
87
- const actionMetadata = {
88
- name: `${dashboard.name}-view`,
89
- displayName: dashboard.displayName || dashboard.name,
90
- type: 'custom',
91
- domain: "{}",
92
- context: "{}",
93
- customComponent: `/admin/core/${moduleUserKey}/dashboards?dashboardName=${dashboard.name}`,
94
- customIsModal: true,
95
- serverEndpoint: '',
96
- moduleUserKey: moduleUserKey,
97
- modelUserKey: '',
98
- viewUserKey: `${dashboard.name}-view`,
99
- };
100
- actionMetadata['module'] = await this.moduleMetadataService.findOneByUserKey(actionMetadata.moduleUserKey);
101
- if (actionMetadata.modelUserKey) {
102
- actionMetadata['model'] = await this.modelMetadataService.findOneByUserKey(actionMetadata.modelUserKey);
103
- }
104
- const actionMetadataEntity = await this.actionMetadataService.upsert(actionMetadata);
105
- return { moduleUserKey, actionMetadataEntity };
106
- }
107
-
108
- private async createDashboard(aiResponseMessage: any) {
109
- const dashboardDto = plainToInstance(CreateDashboardDto, aiResponseMessage);
110
- dashboardDto['layoutJson'] = JSON.stringify(dashboardDto['layoutJson']);
111
- const dashboard = await this.dashboardService.create(dashboardDto, []);
112
- return { dashboardDto, dashboard };
113
- }
114
- }
@@ -1,38 +0,0 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { plainToInstance } from "class-transformer";
3
- import { CreateDashboardQuestionDto } from "src/dtos/create-dashboard-question.dto";
4
- import { AiInteraction } from "src/entities/ai-interaction.entity";
5
- import { IMcpToolResponseHandler } from "../../../interfaces";
6
- import { DashboardQuestionService } from "../../dashboard-question.service";
7
-
8
- @Injectable()
9
- export class SolidCreateDashboardQuestionMcpHandler implements IMcpToolResponseHandler {
10
-
11
- constructor(
12
- private readonly dashboardQuestionService: DashboardQuestionService,
13
- ) {
14
- }
15
-
16
- async apply(aiInteraction: AiInteraction) {
17
- const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
18
- const aiResponseMessage = JSON.parse(escapedMessage);
19
-
20
- //FIXME: Replace \' with ' in the response, since the AI response seems to contain \' which is invalid JSON.
21
- // This is a workaround for now, until we find a better solution.
22
- // const aiResponseMessageReplaced = aiResponseMessage['message'].replace(/\\'/g, "'");
23
- // const dashboardUserKey = aiResponseMessageReplaced['dashboardUserKey'];
24
- // if (!dashboardUserKey) {
25
- // throw new Error("Dashboard User Key is required to create a Dashboard Question.");
26
- // }
27
- const dashboardQuestionDto = plainToInstance(CreateDashboardQuestionDto, aiResponseMessage);
28
-
29
- const dashboardQuestion = await this.dashboardQuestionService.create(dashboardQuestionDto, []);
30
-
31
- // TODO: decide on some shape to return hre...
32
- return {
33
- seedingRequired: false,
34
- serverRebooting: false,
35
- }
36
- }
37
-
38
- }
@@ -1,40 +0,0 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { plainToInstance } from "class-transformer";
3
- import { AiInteraction } from "src/entities/ai-interaction.entity";
4
- import { IMcpToolResponseHandler } from "../../../interfaces";
5
- import { DashboardQuestionSqlDatasetConfigService } from "../../dashboard-question-sql-dataset-config.service";
6
- import { CreateDashboardQuestionSqlDatasetConfigDto } from "src/dtos/create-dashboard-question-sql-dataset-config.dto";
7
-
8
- @Injectable()
9
- export class SolidCreateDashboardQuestionSqlDatasetConfigMcpHandler implements IMcpToolResponseHandler {
10
-
11
- constructor(
12
- private readonly dashboardQuestionSqlDatasetConfigService: DashboardQuestionSqlDatasetConfigService,
13
- ) {
14
- }
15
-
16
- async apply(aiInteraction: AiInteraction) {
17
- // const aiResponse = JSON.parse(aiInteraction.message);
18
- const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
19
- const aiResponseMessage = JSON.parse(escapedMessage);
20
-
21
- // FIXME: Replace \' with ' in the response, since the AI response seems to contain \' which is invalid JSON.
22
- // This is a workaround for now, until we find a better solution.
23
- // const aiResponseMessageReplaced = aiResponse['message'].replace(/\\'/g, "'");
24
- // const dashboardUserKey = aiResponseMessageReplaced['dashboardUserKey'];
25
- // if (!dashboardUserKey) {
26
- // throw new Error("Dashboard User Key is required to create a Dashboard Question.");
27
- // }
28
- const dto = plainToInstance(CreateDashboardQuestionSqlDatasetConfigDto, aiResponseMessage);
29
- dto['options'] = JSON.stringify(dto['options']);
30
-
31
- const dashboardQuestion = await this.dashboardQuestionSqlDatasetConfigService.create(dto, []);
32
-
33
- // TODO: decide on some shape to return hre...
34
- return {
35
- seedingRequired: false,
36
- serverRebooting: false,
37
- }
38
- }
39
-
40
- }
@@ -1,39 +0,0 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { plainToInstance } from "class-transformer";
3
- import { CreateDashboardQuestionDto } from "src/dtos/create-dashboard-question.dto";
4
- import { AiInteraction } from "src/entities/ai-interaction.entity";
5
- import { IMcpToolResponseHandler } from "../../../interfaces";
6
- import { DashboardQuestionService } from "../../dashboard-question.service";
7
-
8
- @Injectable()
9
- export class SolidCreateDashboardWidgetMcpHandler implements IMcpToolResponseHandler {
10
-
11
- constructor(
12
- private readonly dashboardQuestionService: DashboardQuestionService,
13
- ) {
14
- }
15
-
16
- async apply(aiInteraction: AiInteraction) {
17
- const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
18
- const aiResponseMessage = JSON.parse(escapedMessage);
19
-
20
- //FIXME: Replace \' with ' in the response, since the AI response seems to contain \' which is invalid JSON.
21
- // This is a workaround for now, until we find a better solution.
22
- // const aiResponseMessageReplaced = aiResponseMessage['message'].replace(/\\'/g, "'");
23
- // const dashboardUserKey = aiResponseMessageReplaced['dashboardUserKey'];
24
- // if (!dashboardUserKey) {
25
- // throw new Error("Dashboard User Key is required to create a Dashboard Question.");
26
- // }
27
- const dashboardQuestionDto = plainToInstance(CreateDashboardQuestionDto, aiResponseMessage);
28
- dashboardQuestionDto['questionSqlDatasetConfigsCommand'] = "update";
29
-
30
- const dashboardQuestion = await this.dashboardQuestionService.create(dashboardQuestionDto, []);
31
-
32
- // TODO: decide on some shape to return hre...
33
- return {
34
- seedingRequired: false,
35
- serverRebooting: false,
36
- }
37
- }
38
-
39
- }
@@ -1,121 +0,0 @@
1
- import { Injectable, Logger } from "@nestjs/common";
2
- import { DashboardQuestionDataProvider } from "src/decorators/dashboard-question-data-provider.decorator";
3
- import { DashboardQuestion } from "src/entities/dashboard-question.entity";
4
- import { IDashboardQuestionDataProvider, QuestionSqlDataProviderContext } from "src/interfaces";
5
- import { EntityManager } from "typeorm";
6
- import { SqlExpressionResolverService } from "../sql-expression-resolver.service";
7
- import { getKpi, getLabels } from "./helpers";
8
-
9
-
10
- export enum SqlExpressionOperator {
11
- EQUALS = '$equals',
12
- NOT_EQUALS = '$notEquals',
13
- CONTAINS = '$contains',
14
- NOT_CONTAINS = '$notContains',
15
- STARTS_WITH = '$startsWith',
16
- ENDS_WITH = '$endsWith',
17
- IN = '$in',
18
- NOT_IN = '$notIn',
19
- BETWEEN = '$between',
20
- LT = '$lt',
21
- LTE = '$lte',
22
- GT = '$gt',
23
- GTE = '$gte'
24
- }
25
-
26
- export interface SqlExpression {
27
- variableName: string; // The name of the variable in the SQL query
28
- operator: SqlExpressionOperator; // The operator to use for the replacement (e.g., '=', '>', '<', etc.)
29
- value: string[]; // The value to replace the variable with
30
- }
31
-
32
- @DashboardQuestionDataProvider()
33
- @Injectable()
34
- export class ChartJsSqlDataProvider implements IDashboardQuestionDataProvider<QuestionSqlDataProviderContext, any> {
35
- private readonly logger = new Logger(ChartJsSqlDataProvider.name);
36
-
37
- constructor(private readonly entityManager: EntityManager, private readonly sqlExpressionResolver: SqlExpressionResolverService) { }
38
-
39
- help(): string {
40
- return "Provides data for dashboard questions using a SQL dataset configuration. Configure your SQL dataset in the admin panel, then reference it in your dashboard question to fetch data.";
41
- }
42
-
43
- name(): string {
44
- return "ChartJsSqlDataProvider";
45
- }
46
-
47
- async getData(question: DashboardQuestion, context?: QuestionSqlDataProviderContext): Promise<any> {
48
- const expressions: SqlExpression[] = context?.expressions || [];
49
- // TODO: put some validation to check if the results of each SQL in each dataset returns the same number of rows
50
-
51
- // This is what we have to return.
52
- // const data = {
53
- // labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
54
- // datasets: [
55
- // {
56
- // label: 'Dataset 1',
57
- // data: labels.map(() => faker.number.int({ min: 0, max: 1000 })),
58
- // backgroundColor: 'rgba(255, 99, 132, 0.5)',
59
- // },
60
- // {
61
- // label: 'Dataset 2',
62
- // data: labels.map(() => faker.number.int({ min: 0, max: 1000 })),
63
- // backgroundColor: 'rgba(53, 162, 235, 0.5)',
64
- // },
65
- // {
66
- // label: 'Dataset 3',
67
- // data: labels.map(() => faker.number.int({ min: 0, max: 1000 })),
68
- // backgroundColor: 'rgba(53, 235, 162, 0.5)',
69
- // },
70
- // ],
71
- // };
72
-
73
- // TODO: Load the set of labels by using a separate field on the question entity.
74
-
75
- let datasetIdx = 0;
76
- const datasets = [];
77
-
78
- const labels: string[] = await getLabels(question, expressions, this.entityManager, this.sqlExpressionResolver);
79
- const kpi: string = await getKpi(question, expressions, this.entityManager, this.sqlExpressionResolver);
80
-
81
- // const question = context.question;
82
- for (const questionSqlDatasetConfig of question.questionSqlDatasetConfigs) {
83
-
84
- const sql = questionSqlDatasetConfig.sql;
85
- if (!sql) {
86
- throw new Error(`SQL dataset ${questionSqlDatasetConfig.datasetName} configuration does not contain a valid SQL query.`);
87
- }
88
-
89
- const sqlReplacementResult = this.sqlExpressionResolver.resolveSqlWithExpressions(sql, expressions || []);
90
- this.logger.debug(`Final Sql query for dataset [${questionSqlDatasetConfig.datasetName}] is query=[${sqlReplacementResult.rawSql}]`);
91
- this.logger.debug(`Final Sql query for dataset [${questionSqlDatasetConfig.datasetName}] is parameters=[${JSON.stringify(sqlReplacementResult.parameters)}]`);
92
- const results = await this.entityManager.query(sqlReplacementResult.rawSql, sqlReplacementResult.parameters);
93
-
94
- // Also for each data set we create the dataset object as is expected by ChartJs.
95
- const data = [];
96
- for (let i = 0; i < results.length; i++) {
97
- const result = results[i];
98
- data.push(result[questionSqlDatasetConfig.valueColumnName]);
99
- }
100
- datasets.push({
101
- label: questionSqlDatasetConfig.datasetDisplayName,
102
- data: data,
103
- ...JSON.parse(questionSqlDatasetConfig.options || '{}'),
104
- });
105
-
106
- datasetIdx++;
107
- }
108
-
109
- return {
110
- kpi,
111
- visualizedAs: question.visualisedAs,
112
- visualizationData: {
113
- labels,
114
- datasets
115
- }
116
- };
117
-
118
- }
119
-
120
-
121
- }
@@ -1,30 +0,0 @@
1
- import { DashboardQuestion } from "src/entities/dashboard-question.entity";
2
- import { EntityManager } from "typeorm";
3
- import { SqlExpression } from "./chartjs-sql-data-provider.service";
4
- import { SqlExpressionResolverService } from "../sql-expression-resolver.service";
5
-
6
- export async function getLabels(question: DashboardQuestion, expressions: SqlExpression[], entityManager: EntityManager, sqlExpressionResolver: SqlExpressionResolverService): Promise<string[]> {
7
- const sql = question.labelSql;
8
- if (!sql) {
9
- return [];
10
- }
11
- const sqlReplacementResult = sqlExpressionResolver.resolveSqlWithExpressions(sql, expressions || []);
12
-
13
- const labelResults = await entityManager.query(sqlReplacementResult.rawSql, sqlReplacementResult.parameters);
14
-
15
- // Assuming labelResults has a single row with a 'label' field
16
- // Map the label results to the labels array
17
- const labels: string[] = labelResults.map((result: { [x: string]: string; }) => result['label']);
18
- return labels;
19
- }
20
-
21
- export async function getKpi(question: DashboardQuestion, expressions: SqlExpression[], entityManager: EntityManager, sqlExpressionResolver: SqlExpressionResolverService): Promise<string> {
22
- const sql = question.kpiSql;
23
- if (!sql) {
24
- return "";
25
- }
26
- const sqlReplacementResult = sqlExpressionResolver.resolveSqlWithExpressions(sql, expressions || []);
27
- const result = await entityManager.query(sqlReplacementResult.rawSql, sqlReplacementResult.parameters);
28
- const kpiResult = result.pop();
29
- return kpiResult?.kpi || "";
30
- }