@qwickapps/server 1.7.0 → 1.7.2

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 (335) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +13 -116
  3. package/dist/src/core/control-panel.d.ts.map +1 -1
  4. package/dist/src/core/control-panel.js +6 -4
  5. package/dist/src/core/control-panel.js.map +1 -1
  6. package/dist/src/core/gateway.d.ts.map +1 -1
  7. package/dist/src/core/gateway.js +24 -2
  8. package/dist/src/core/gateway.js.map +1 -1
  9. package/dist/src/core/plugin-registry.d.ts +15 -2
  10. package/dist/src/core/plugin-registry.d.ts.map +1 -1
  11. package/dist/src/core/plugin-registry.js.map +1 -1
  12. package/dist/src/index.d.ts +2 -2
  13. package/dist/src/index.d.ts.map +1 -1
  14. package/dist/src/index.js +9 -3
  15. package/dist/src/index.js.map +1 -1
  16. package/dist/src/plugins/api-keys/api-keys-plugin.d.ts +5 -2
  17. package/dist/src/plugins/api-keys/api-keys-plugin.d.ts.map +1 -1
  18. package/dist/src/plugins/api-keys/api-keys-plugin.js +61 -19
  19. package/dist/src/plugins/api-keys/api-keys-plugin.js.map +1 -1
  20. package/dist/src/plugins/api-keys/index.d.ts +0 -4
  21. package/dist/src/plugins/api-keys/index.d.ts.map +1 -1
  22. package/dist/src/plugins/api-keys/index.js +2 -3
  23. package/dist/src/plugins/api-keys/index.js.map +1 -1
  24. package/dist/src/plugins/api-keys/stores/postgres-store.d.ts.map +1 -1
  25. package/dist/src/plugins/api-keys/stores/postgres-store.js +29 -0
  26. package/dist/src/plugins/api-keys/stores/postgres-store.js.map +1 -1
  27. package/dist/src/plugins/api-keys/types.d.ts +9 -3
  28. package/dist/src/plugins/api-keys/types.d.ts.map +1 -1
  29. package/dist/src/plugins/api-keys/types.js.map +1 -1
  30. package/dist/src/plugins/auth/auth-plugin.d.ts.map +1 -1
  31. package/dist/src/plugins/auth/auth-plugin.js +4 -2
  32. package/dist/src/plugins/auth/auth-plugin.js.map +1 -1
  33. package/dist/src/plugins/auth/env-config.d.ts.map +1 -1
  34. package/dist/src/plugins/auth/env-config.js +1 -0
  35. package/dist/src/plugins/auth/env-config.js.map +1 -1
  36. package/dist/src/plugins/auth/index.d.ts +0 -4
  37. package/dist/src/plugins/auth/index.d.ts.map +1 -1
  38. package/dist/src/plugins/auth/index.js +2 -3
  39. package/dist/src/plugins/auth/index.js.map +1 -1
  40. package/dist/src/plugins/bans/bans-plugin.d.ts +5 -2
  41. package/dist/src/plugins/bans/bans-plugin.d.ts.map +1 -1
  42. package/dist/src/plugins/bans/bans-plugin.js +71 -25
  43. package/dist/src/plugins/bans/bans-plugin.js.map +1 -1
  44. package/dist/src/plugins/bans/index.d.ts +1 -5
  45. package/dist/src/plugins/bans/index.d.ts.map +1 -1
  46. package/dist/src/plugins/bans/index.js +3 -4
  47. package/dist/src/plugins/bans/index.js.map +1 -1
  48. package/dist/src/plugins/bans/stores/in-memory-store.d.ts +34 -0
  49. package/dist/src/plugins/bans/stores/in-memory-store.d.ts.map +1 -0
  50. package/dist/src/plugins/bans/stores/in-memory-store.js +97 -0
  51. package/dist/src/plugins/bans/stores/in-memory-store.js.map +1 -0
  52. package/dist/src/plugins/bans/stores/index.d.ts +1 -0
  53. package/dist/src/plugins/bans/stores/index.d.ts.map +1 -1
  54. package/dist/src/plugins/bans/stores/index.js +1 -0
  55. package/dist/src/plugins/bans/stores/index.js.map +1 -1
  56. package/dist/src/plugins/bans/types.d.ts +13 -6
  57. package/dist/src/plugins/bans/types.d.ts.map +1 -1
  58. package/dist/src/plugins/cache-plugin.d.ts +35 -16
  59. package/dist/src/plugins/cache-plugin.d.ts.map +1 -1
  60. package/dist/src/plugins/cache-plugin.js +299 -20
  61. package/dist/src/plugins/cache-plugin.js.map +1 -1
  62. package/dist/src/plugins/cms/cms-plugin.d.ts.map +1 -1
  63. package/dist/src/plugins/cms/cms-plugin.js +3 -1
  64. package/dist/src/plugins/cms/cms-plugin.js.map +1 -1
  65. package/dist/src/plugins/devices/devices-plugin.d.ts +5 -2
  66. package/dist/src/plugins/devices/devices-plugin.d.ts.map +1 -1
  67. package/dist/src/plugins/devices/devices-plugin.js +62 -26
  68. package/dist/src/plugins/devices/devices-plugin.js.map +1 -1
  69. package/dist/src/plugins/devices/index.d.ts +0 -4
  70. package/dist/src/plugins/devices/index.d.ts.map +1 -1
  71. package/dist/src/plugins/devices/index.js +2 -3
  72. package/dist/src/plugins/devices/index.js.map +1 -1
  73. package/dist/src/plugins/entitlements/entitlements-plugin.d.ts +5 -2
  74. package/dist/src/plugins/entitlements/entitlements-plugin.d.ts.map +1 -1
  75. package/dist/src/plugins/entitlements/entitlements-plugin.js +78 -41
  76. package/dist/src/plugins/entitlements/entitlements-plugin.js.map +1 -1
  77. package/dist/src/plugins/entitlements/index.d.ts +1 -5
  78. package/dist/src/plugins/entitlements/index.d.ts.map +1 -1
  79. package/dist/src/plugins/entitlements/index.js +3 -4
  80. package/dist/src/plugins/entitlements/index.js.map +1 -1
  81. package/dist/src/plugins/entitlements/sources/in-memory-source.d.ts +9 -0
  82. package/dist/src/plugins/entitlements/sources/in-memory-source.d.ts.map +1 -0
  83. package/dist/src/plugins/entitlements/sources/in-memory-source.js +65 -0
  84. package/dist/src/plugins/entitlements/sources/in-memory-source.js.map +1 -0
  85. package/dist/src/plugins/entitlements/sources/index.d.ts +1 -0
  86. package/dist/src/plugins/entitlements/sources/index.d.ts.map +1 -1
  87. package/dist/src/plugins/entitlements/sources/index.js +1 -0
  88. package/dist/src/plugins/entitlements/sources/index.js.map +1 -1
  89. package/dist/src/plugins/entitlements/types.d.ts +9 -2
  90. package/dist/src/plugins/entitlements/types.d.ts.map +1 -1
  91. package/dist/src/plugins/health-plugin.d.ts.map +1 -1
  92. package/dist/src/plugins/health-plugin.js +1 -0
  93. package/dist/src/plugins/health-plugin.js.map +1 -1
  94. package/dist/src/plugins/index.d.ts +4 -4
  95. package/dist/src/plugins/index.d.ts.map +1 -1
  96. package/dist/src/plugins/index.js +4 -4
  97. package/dist/src/plugins/index.js.map +1 -1
  98. package/dist/src/plugins/logs-plugin.d.ts.map +1 -1
  99. package/dist/src/plugins/logs-plugin.js +49 -1
  100. package/dist/src/plugins/logs-plugin.js.map +1 -1
  101. package/dist/src/plugins/maintenance-plugin.d.ts.map +1 -1
  102. package/dist/src/plugins/maintenance-plugin.js +39 -0
  103. package/dist/src/plugins/maintenance-plugin.js.map +1 -1
  104. package/dist/src/plugins/notifications/index.d.ts +0 -4
  105. package/dist/src/plugins/notifications/index.d.ts.map +1 -1
  106. package/dist/src/plugins/notifications/index.js +2 -3
  107. package/dist/src/plugins/notifications/index.js.map +1 -1
  108. package/dist/src/plugins/notifications/notifications-plugin.d.ts +5 -2
  109. package/dist/src/plugins/notifications/notifications-plugin.d.ts.map +1 -1
  110. package/dist/src/plugins/notifications/notifications-plugin.js +46 -13
  111. package/dist/src/plugins/notifications/notifications-plugin.js.map +1 -1
  112. package/dist/src/plugins/parental/index.d.ts +0 -4
  113. package/dist/src/plugins/parental/index.d.ts.map +1 -1
  114. package/dist/src/plugins/parental/index.js +2 -3
  115. package/dist/src/plugins/parental/index.js.map +1 -1
  116. package/dist/src/plugins/parental/parental-plugin.d.ts +5 -2
  117. package/dist/src/plugins/parental/parental-plugin.d.ts.map +1 -1
  118. package/dist/src/plugins/parental/parental-plugin.js +60 -24
  119. package/dist/src/plugins/parental/parental-plugin.js.map +1 -1
  120. package/dist/src/plugins/postgres-plugin.d.ts +3 -1
  121. package/dist/src/plugins/postgres-plugin.d.ts.map +1 -1
  122. package/dist/src/plugins/postgres-plugin.js +18 -8
  123. package/dist/src/plugins/postgres-plugin.js.map +1 -1
  124. package/dist/src/plugins/preferences/index.d.ts +0 -4
  125. package/dist/src/plugins/preferences/index.d.ts.map +1 -1
  126. package/dist/src/plugins/preferences/index.js +2 -3
  127. package/dist/src/plugins/preferences/index.js.map +1 -1
  128. package/dist/src/plugins/preferences/preferences-plugin.d.ts +5 -2
  129. package/dist/src/plugins/preferences/preferences-plugin.d.ts.map +1 -1
  130. package/dist/src/plugins/preferences/preferences-plugin.js +63 -19
  131. package/dist/src/plugins/preferences/preferences-plugin.js.map +1 -1
  132. package/dist/src/plugins/profiles/index.d.ts +0 -4
  133. package/dist/src/plugins/profiles/index.d.ts.map +1 -1
  134. package/dist/src/plugins/profiles/index.js +2 -3
  135. package/dist/src/plugins/profiles/index.js.map +1 -1
  136. package/dist/src/plugins/profiles/profiles-plugin.d.ts +5 -2
  137. package/dist/src/plugins/profiles/profiles-plugin.d.ts.map +1 -1
  138. package/dist/src/plugins/profiles/profiles-plugin.js +60 -26
  139. package/dist/src/plugins/profiles/profiles-plugin.js.map +1 -1
  140. package/dist/src/plugins/profiles/types.d.ts +9 -2
  141. package/dist/src/plugins/profiles/types.d.ts.map +1 -1
  142. package/dist/src/plugins/qwickbrain/index.d.ts +0 -4
  143. package/dist/src/plugins/qwickbrain/index.d.ts.map +1 -1
  144. package/dist/src/plugins/qwickbrain/index.js +2 -3
  145. package/dist/src/plugins/qwickbrain/index.js.map +1 -1
  146. package/dist/src/plugins/qwickbrain/qwickbrain-plugin.d.ts.map +1 -1
  147. package/dist/src/plugins/qwickbrain/qwickbrain-plugin.js +117 -0
  148. package/dist/src/plugins/qwickbrain/qwickbrain-plugin.js.map +1 -1
  149. package/dist/src/plugins/rate-limit/index.d.ts +0 -4
  150. package/dist/src/plugins/rate-limit/index.d.ts.map +1 -1
  151. package/dist/src/plugins/rate-limit/index.js +2 -3
  152. package/dist/src/plugins/rate-limit/index.js.map +1 -1
  153. package/dist/src/plugins/subscriptions/index.d.ts +0 -4
  154. package/dist/src/plugins/subscriptions/index.d.ts.map +1 -1
  155. package/dist/src/plugins/subscriptions/index.js +2 -3
  156. package/dist/src/plugins/subscriptions/index.js.map +1 -1
  157. package/dist/src/plugins/subscriptions/subscriptions-plugin.d.ts +5 -2
  158. package/dist/src/plugins/subscriptions/subscriptions-plugin.d.ts.map +1 -1
  159. package/dist/src/plugins/subscriptions/subscriptions-plugin.js +63 -29
  160. package/dist/src/plugins/subscriptions/subscriptions-plugin.js.map +1 -1
  161. package/dist/src/plugins/subscriptions/types.d.ts +8 -2
  162. package/dist/src/plugins/subscriptions/types.d.ts.map +1 -1
  163. package/dist/src/plugins/tenants/index.d.ts +1 -1
  164. package/dist/src/plugins/tenants/index.d.ts.map +1 -1
  165. package/dist/src/plugins/tenants/index.js +1 -1
  166. package/dist/src/plugins/tenants/index.js.map +1 -1
  167. package/dist/src/plugins/tenants/stores/in-memory-store.d.ts +59 -0
  168. package/dist/src/plugins/tenants/stores/in-memory-store.d.ts.map +1 -0
  169. package/dist/src/plugins/tenants/stores/in-memory-store.js +257 -0
  170. package/dist/src/plugins/tenants/stores/in-memory-store.js.map +1 -0
  171. package/dist/src/plugins/tenants/stores/index.d.ts +8 -0
  172. package/dist/src/plugins/tenants/stores/index.d.ts.map +1 -0
  173. package/dist/src/plugins/tenants/stores/index.js +8 -0
  174. package/dist/src/plugins/tenants/stores/index.js.map +1 -0
  175. package/dist/src/plugins/tenants/tenants-plugin.d.ts +5 -2
  176. package/dist/src/plugins/tenants/tenants-plugin.d.ts.map +1 -1
  177. package/dist/src/plugins/tenants/tenants-plugin.js +93 -60
  178. package/dist/src/plugins/tenants/tenants-plugin.js.map +1 -1
  179. package/dist/src/plugins/tenants/types.d.ts +8 -2
  180. package/dist/src/plugins/tenants/types.d.ts.map +1 -1
  181. package/dist/src/plugins/usage/index.d.ts +0 -4
  182. package/dist/src/plugins/usage/index.d.ts.map +1 -1
  183. package/dist/src/plugins/usage/index.js +2 -3
  184. package/dist/src/plugins/usage/index.js.map +1 -1
  185. package/dist/src/plugins/usage/usage-plugin.d.ts +5 -2
  186. package/dist/src/plugins/usage/usage-plugin.d.ts.map +1 -1
  187. package/dist/src/plugins/usage/usage-plugin.js +57 -23
  188. package/dist/src/plugins/usage/usage-plugin.js.map +1 -1
  189. package/dist/src/plugins/users/index.d.ts +1 -1
  190. package/dist/src/plugins/users/index.d.ts.map +1 -1
  191. package/dist/src/plugins/users/index.js +1 -1
  192. package/dist/src/plugins/users/index.js.map +1 -1
  193. package/dist/src/plugins/users/stores/in-memory-store.d.ts +36 -0
  194. package/dist/src/plugins/users/stores/in-memory-store.d.ts.map +1 -0
  195. package/dist/src/plugins/users/stores/in-memory-store.js +122 -0
  196. package/dist/src/plugins/users/stores/in-memory-store.js.map +1 -0
  197. package/dist/src/plugins/users/stores/index.d.ts +1 -0
  198. package/dist/src/plugins/users/stores/index.d.ts.map +1 -1
  199. package/dist/src/plugins/users/stores/index.js +1 -0
  200. package/dist/src/plugins/users/stores/index.js.map +1 -1
  201. package/dist/src/plugins/users/types.d.ts +7 -2
  202. package/dist/src/plugins/users/types.d.ts.map +1 -1
  203. package/dist/src/plugins/users/users-plugin.d.ts +5 -2
  204. package/dist/src/plugins/users/users-plugin.d.ts.map +1 -1
  205. package/dist/src/plugins/users/users-plugin.js +56 -23
  206. package/dist/src/plugins/users/users-plugin.js.map +1 -1
  207. package/dist/ui/src/api/controlPanelApi.d.ts +10 -1
  208. package/dist/ui/src/api/controlPanelApi.d.ts.map +1 -1
  209. package/dist/ui/src/api/controlPanelApi.js.map +1 -1
  210. package/dist/ui/src/dashboard/PluginWidgetRenderer.d.ts +3 -1
  211. package/dist/ui/src/dashboard/PluginWidgetRenderer.d.ts.map +1 -1
  212. package/dist/ui/src/dashboard/PluginWidgetRenderer.js +5 -1
  213. package/dist/ui/src/dashboard/PluginWidgetRenderer.js.map +1 -1
  214. package/dist/ui/src/dashboard/builtInWidgets.d.ts.map +1 -1
  215. package/dist/ui/src/dashboard/builtInWidgets.js +13 -1
  216. package/dist/ui/src/dashboard/builtInWidgets.js.map +1 -1
  217. package/dist/ui/src/dashboard/widgets/CacheMaintenanceWidget.d.ts +11 -0
  218. package/dist/ui/src/dashboard/widgets/CacheMaintenanceWidget.d.ts.map +1 -0
  219. package/dist/ui/src/dashboard/widgets/CacheMaintenanceWidget.js +77 -0
  220. package/dist/ui/src/dashboard/widgets/CacheMaintenanceWidget.js.map +1 -0
  221. package/dist/ui/src/dashboard/widgets/DatabaseOpsWidget.d.ts +10 -0
  222. package/dist/ui/src/dashboard/widgets/DatabaseOpsWidget.d.ts.map +1 -0
  223. package/dist/ui/src/dashboard/widgets/DatabaseOpsWidget.js +14 -0
  224. package/dist/ui/src/dashboard/widgets/DatabaseOpsWidget.js.map +1 -0
  225. package/dist/ui/src/dashboard/widgets/EnvironmentConfigWidget.d.ts +10 -0
  226. package/dist/ui/src/dashboard/widgets/EnvironmentConfigWidget.d.ts.map +1 -0
  227. package/dist/ui/src/dashboard/widgets/EnvironmentConfigWidget.js +14 -0
  228. package/dist/ui/src/dashboard/widgets/EnvironmentConfigWidget.js.map +1 -0
  229. package/dist/ui/src/dashboard/widgets/LogsMaintenanceWidget.d.ts +11 -0
  230. package/dist/ui/src/dashboard/widgets/LogsMaintenanceWidget.d.ts.map +1 -0
  231. package/dist/ui/src/dashboard/widgets/LogsMaintenanceWidget.js +96 -0
  232. package/dist/ui/src/dashboard/widgets/LogsMaintenanceWidget.js.map +1 -0
  233. package/dist/ui/src/dashboard/widgets/SeedManagementWidget.d.ts +10 -0
  234. package/dist/ui/src/dashboard/widgets/SeedManagementWidget.d.ts.map +1 -0
  235. package/dist/ui/src/dashboard/widgets/SeedManagementWidget.js +55 -0
  236. package/dist/ui/src/dashboard/widgets/SeedManagementWidget.js.map +1 -0
  237. package/dist/ui/src/dashboard/widgets/ServiceControlWidget.d.ts +10 -0
  238. package/dist/ui/src/dashboard/widgets/ServiceControlWidget.d.ts.map +1 -0
  239. package/dist/ui/src/dashboard/widgets/ServiceControlWidget.js +14 -0
  240. package/dist/ui/src/dashboard/widgets/ServiceControlWidget.js.map +1 -0
  241. package/dist/ui/src/dashboard/widgets/index.d.ts +6 -0
  242. package/dist/ui/src/dashboard/widgets/index.d.ts.map +1 -1
  243. package/dist/ui/src/dashboard/widgets/index.js +6 -0
  244. package/dist/ui/src/dashboard/widgets/index.js.map +1 -1
  245. package/dist/ui/src/pages/DashboardPage.js +1 -1
  246. package/dist/ui/src/pages/DashboardPage.js.map +1 -1
  247. package/dist-ui/assets/index-0gzisPdy.js +528 -0
  248. package/dist-ui/assets/{index-lm1yX6UD.js.map → index-0gzisPdy.js.map} +1 -1
  249. package/dist-ui/index.html +1 -1
  250. package/dist-ui-lib/index.js +3109 -2774
  251. package/dist-ui-lib/index.js.map +1 -1
  252. package/dist-ui-lib/src/api/controlPanelApi.d.ts +10 -1
  253. package/dist-ui-lib/src/dashboard/PluginWidgetRenderer.d.ts +3 -1
  254. package/dist-ui-lib/src/dashboard/widgets/CacheMaintenanceWidget.d.ts +10 -0
  255. package/dist-ui-lib/src/dashboard/widgets/DatabaseOpsWidget.d.ts +9 -0
  256. package/dist-ui-lib/src/dashboard/widgets/EnvironmentConfigWidget.d.ts +9 -0
  257. package/dist-ui-lib/src/dashboard/widgets/LogsMaintenanceWidget.d.ts +10 -0
  258. package/dist-ui-lib/src/dashboard/widgets/SeedManagementWidget.d.ts +9 -0
  259. package/dist-ui-lib/src/dashboard/widgets/ServiceControlWidget.d.ts +9 -0
  260. package/dist-ui-lib/src/dashboard/widgets/index.d.ts +6 -0
  261. package/package.json +12 -6
  262. package/src/core/control-panel.ts +6 -4
  263. package/src/core/gateway.ts +25 -2
  264. package/src/core/plugin-registry.ts +15 -2
  265. package/src/index.ts +53 -0
  266. package/src/plugins/api-keys/api-keys-plugin.ts +64 -20
  267. package/src/plugins/api-keys/index.ts +2 -5
  268. package/src/plugins/api-keys/stores/postgres-store.ts +30 -0
  269. package/src/plugins/api-keys/types.ts +9 -3
  270. package/src/plugins/auth/auth-plugin.ts +4 -2
  271. package/src/plugins/auth/env-config.ts +1 -0
  272. package/src/plugins/auth/index.ts +3 -5
  273. package/src/plugins/bans/bans-plugin.ts +71 -26
  274. package/src/plugins/bans/index.ts +4 -6
  275. package/src/plugins/bans/stores/in-memory-store.ts +106 -0
  276. package/src/plugins/bans/stores/index.ts +1 -0
  277. package/src/plugins/bans/types.ts +13 -6
  278. package/src/plugins/cache-plugin.test.ts +2 -2
  279. package/src/plugins/cache-plugin.ts +331 -30
  280. package/src/plugins/cms/cms-plugin.ts +3 -1
  281. package/src/plugins/devices/devices-plugin.ts +62 -27
  282. package/src/plugins/devices/index.ts +3 -5
  283. package/src/plugins/entitlements/entitlements-plugin.ts +81 -43
  284. package/src/plugins/entitlements/index.ts +4 -6
  285. package/src/plugins/entitlements/sources/in-memory-source.ts +76 -0
  286. package/src/plugins/entitlements/sources/index.ts +1 -0
  287. package/src/plugins/entitlements/types.ts +9 -2
  288. package/src/plugins/health-plugin.ts +1 -0
  289. package/src/plugins/index.ts +4 -1
  290. package/src/plugins/logs-plugin.ts +55 -1
  291. package/src/plugins/maintenance-plugin.ts +43 -0
  292. package/src/plugins/notifications/index.ts +3 -5
  293. package/src/plugins/notifications/notifications-plugin.ts +49 -19
  294. package/src/plugins/parental/index.ts +3 -5
  295. package/src/plugins/parental/parental-plugin.ts +63 -25
  296. package/src/plugins/postgres-plugin.test.ts +2 -2
  297. package/src/plugins/postgres-plugin.ts +20 -9
  298. package/src/plugins/preferences/index.ts +3 -5
  299. package/src/plugins/preferences/preferences-plugin.ts +66 -20
  300. package/src/plugins/profiles/index.ts +3 -5
  301. package/src/plugins/profiles/profiles-plugin.ts +60 -27
  302. package/src/plugins/profiles/types.ts +9 -2
  303. package/src/plugins/qwickbrain/index.ts +3 -5
  304. package/src/plugins/qwickbrain/qwickbrain-plugin.ts +135 -0
  305. package/src/plugins/rate-limit/index.ts +3 -5
  306. package/src/plugins/subscriptions/index.ts +3 -5
  307. package/src/plugins/subscriptions/subscriptions-plugin.ts +63 -30
  308. package/src/plugins/subscriptions/types.ts +8 -2
  309. package/src/plugins/tenants/index.ts +1 -1
  310. package/src/plugins/tenants/stores/in-memory-store.ts +335 -0
  311. package/src/plugins/tenants/stores/index.ts +13 -0
  312. package/src/plugins/tenants/tenants-plugin.ts +97 -62
  313. package/src/plugins/tenants/types.ts +8 -2
  314. package/src/plugins/usage/index.ts +3 -5
  315. package/src/plugins/usage/usage-plugin.ts +60 -26
  316. package/src/plugins/users/index.ts +1 -1
  317. package/src/plugins/users/stores/in-memory-store.ts +140 -0
  318. package/src/plugins/users/stores/index.ts +1 -0
  319. package/src/plugins/users/types.ts +7 -2
  320. package/src/plugins/users/users-plugin.ts +56 -24
  321. package/src/testing/index.ts +1 -0
  322. package/src/testing/pg-mem-pool.ts +33 -0
  323. package/ui/src/api/controlPanelApi.ts +10 -1
  324. package/ui/src/dashboard/PluginWidgetRenderer.tsx +8 -0
  325. package/ui/src/dashboard/builtInWidgets.tsx +19 -1
  326. package/ui/src/dashboard/widgets/CacheMaintenanceWidget.tsx +195 -0
  327. package/ui/src/dashboard/widgets/DatabaseOpsWidget.tsx +29 -0
  328. package/ui/src/dashboard/widgets/EnvironmentConfigWidget.tsx +29 -0
  329. package/ui/src/dashboard/widgets/LogsMaintenanceWidget.tsx +247 -0
  330. package/ui/src/dashboard/widgets/SeedManagementWidget.tsx +128 -0
  331. package/ui/src/dashboard/widgets/ServiceControlWidget.tsx +29 -0
  332. package/ui/src/dashboard/widgets/index.ts +6 -0
  333. package/ui/src/pages/DashboardPage.tsx +2 -2
  334. package/ui/src/pages/MaintenancePage.tsx +1 -1
  335. package/dist-ui/assets/index-lm1yX6UD.js +0 -528
@@ -530,6 +530,141 @@ export function createQwickBrainPlugin(config: QwickBrainPluginConfig): Plugin {
530
530
  },
531
531
  });
532
532
 
533
+ // POST /mcp/query - LLM Query endpoint (auth required, supports streaming)
534
+ registry.addRoute({
535
+ method: 'post',
536
+ path: `${apiPrefix}/query`,
537
+ pluginId: 'qwickbrain',
538
+ handler: async (req: Request, res: ExpressResponse) => {
539
+ // Check authentication
540
+ const authError = checkAuth(req);
541
+ if (authError) {
542
+ res.status(authError.status).json(authError.body);
543
+ return;
544
+ }
545
+
546
+ const user = getAuthenticatedUser(req);
547
+
548
+ // Check rate limits
549
+ const rateLimitError = checkRateLimits(user?.id);
550
+ if (rateLimitError) {
551
+ Object.entries(rateLimitError.headers).forEach(([key, value]) => {
552
+ res.setHeader(key, value);
553
+ });
554
+ res.status(rateLimitError.status).json(rateLimitError.body);
555
+ return;
556
+ }
557
+
558
+ try {
559
+ if (!connectionStatus.connected) {
560
+ res.status(503).json({
561
+ error: 'QwickBrain not connected',
562
+ details: connectionStatus.error,
563
+ });
564
+ return;
565
+ }
566
+
567
+ // Check if streaming is requested
568
+ const stream = req.query.stream === 'true';
569
+
570
+ // Build query string
571
+ const queryParams = new URLSearchParams();
572
+ if (stream) {
573
+ queryParams.set('stream', 'true');
574
+ }
575
+ const queryString = queryParams.toString();
576
+ const path = `/api/v1/query${queryString ? `?${queryString}` : ''}`;
577
+
578
+ log('LLM query', { userId: user?.id, streaming: stream, query: req.body.query });
579
+
580
+ if (stream) {
581
+ // Streaming mode: pipe SSE stream from QwickBrain to client
582
+ const url = `${config.qwickbrainUrl}${path}`;
583
+ const controller = new AbortController();
584
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
585
+
586
+ try {
587
+ const fetchResponse = await fetch(url, {
588
+ method: 'POST',
589
+ headers: {
590
+ 'Content-Type': 'application/json',
591
+ 'Accept': 'text/event-stream',
592
+ },
593
+ body: JSON.stringify(req.body),
594
+ signal: controller.signal,
595
+ });
596
+
597
+ clearTimeout(timeoutId);
598
+
599
+ if (!fetchResponse.ok) {
600
+ res.status(fetchResponse.status).json({
601
+ error: 'Query failed',
602
+ status: fetchResponse.status,
603
+ });
604
+ return;
605
+ }
606
+
607
+ // Set SSE headers
608
+ res.setHeader('Content-Type', 'text/event-stream');
609
+ res.setHeader('Cache-Control', 'no-cache');
610
+ res.setHeader('Connection', 'keep-alive');
611
+ res.setHeader('X-Accel-Buffering', 'no');
612
+
613
+ // Pipe the stream
614
+ const reader = fetchResponse.body?.getReader();
615
+ if (!reader) {
616
+ res.status(500).json({ error: 'No response body' });
617
+ return;
618
+ }
619
+
620
+ const decoder = new TextDecoder();
621
+
622
+ while (true) {
623
+ const { done, value } = await reader.read();
624
+ if (done) break;
625
+ const text = decoder.decode(value, { stream: true });
626
+ res.write(text);
627
+ }
628
+
629
+ res.end();
630
+ } catch (error) {
631
+ clearTimeout(timeoutId);
632
+ throw error;
633
+ }
634
+ } else {
635
+ // Non-streaming mode: proxy JSON response
636
+ const response = await proxyToQwickBrain(
637
+ config.qwickbrainUrl,
638
+ path,
639
+ {
640
+ method: 'POST',
641
+ body: req.body,
642
+ timeout,
643
+ }
644
+ );
645
+
646
+ if (!response.ok) {
647
+ const errorText = await response.text();
648
+ res.status(response.status).json({
649
+ error: 'Query failed',
650
+ details: errorText,
651
+ });
652
+ return;
653
+ }
654
+
655
+ const result = await response.json();
656
+ res.json(result);
657
+ }
658
+ } catch (error) {
659
+ log('Error executing query', { error: String(error) });
660
+ res.status(500).json({
661
+ error: 'Query execution failed',
662
+ details: error instanceof Error ? error.message : 'Unknown error',
663
+ });
664
+ }
665
+ },
666
+ });
667
+
533
668
  // GET /mcp/sse - Server-Sent Events endpoint for streaming (auth required)
534
669
  registry.addRoute({
535
670
  method: 'get',
@@ -127,8 +127,6 @@ export type {
127
127
  CheckLimitOptions,
128
128
  } from './types.js';
129
129
 
130
- // UI Components
131
- export { RateLimitStatusWidget } from './RateLimitStatusWidget.js';
132
- export { RateLimitManagementPage } from './RateLimitManagementPage.js';
133
- export type { RateLimitStatusWidgetProps } from './RateLimitStatusWidget.js';
134
- export type { RateLimitManagementPageProps } from './RateLimitManagementPage.js';
130
+ // UI Components are exported from main package index (@qwickapps/server)
131
+ // Do NOT export here to avoid loading UI dependencies when importing plugins
132
+
@@ -50,8 +50,6 @@ export type {
50
50
  // Stores
51
51
  export { postgresSubscriptionsStore } from './stores/index.js';
52
52
 
53
- // UI Components
54
- export { SubscriptionsStatusWidget } from './SubscriptionsStatusWidget.js';
55
- export type { SubscriptionsStatusWidgetProps } from './SubscriptionsStatusWidget.js';
56
- export { SubscriptionsManagementPage } from './SubscriptionsManagementPage.js';
57
- export type { SubscriptionsManagementPageProps } from './SubscriptionsManagementPage.js';
53
+ // UI Components are exported from main package index (@qwickapps/server)
54
+ // Do NOT export here to avoid loading UI dependencies when importing plugins
55
+
@@ -23,22 +23,26 @@ import type {
23
23
  UpdateUserSubscriptionInput,
24
24
  FeatureLimitResult,
25
25
  } from './types.js';
26
+ import { hasPostgres, getPostgres } from '../postgres-plugin.js';
27
+ import { postgresSubscriptionsStore } from './stores/index.js';
26
28
 
27
29
  // Store instance for helper access
28
30
  let currentStore: SubscriptionsStore | null = null;
29
31
  let currentConfig: SubscriptionsPluginConfig | null = null;
30
32
 
31
33
  /**
32
- * Create the Subscriptions plugin
34
+ * Create the Subscriptions plugin with smart defaults
35
+ *
36
+ * Config is optional - plugin will use defaults and get dependencies from registry.
37
+ * Gracefully handles missing dependencies with clear log messages.
33
38
  */
34
- export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Plugin {
35
- const debug = config.debug || false;
36
- const defaultTierSlug = config.defaultTierSlug || 'free';
37
- const apiPrefix = config.api?.prefix || '/'; // Framework adds /subscriptions prefix automatically
38
-
39
- function log(message: string, data?: Record<string, unknown>) {
40
- if (debug) {
41
- console.log(`[SubscriptionsPlugin] ${message}`, data || '');
39
+ export function createSubscriptionsPlugin(config: Partial<SubscriptionsPluginConfig> = {}): Plugin {
40
+ function log(message: string, data?: Record<string, unknown>, isError = false) {
41
+ const prefix = '[SubscriptionsPlugin]';
42
+ if (isError) {
43
+ console.error(`${prefix} ${message}`, data || '');
44
+ } else if (config.debug) {
45
+ console.log(`${prefix} ${message}`, data || '');
42
46
  }
43
47
  }
44
48
 
@@ -48,15 +52,44 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
48
52
  version: '1.0.0',
49
53
 
50
54
  async onStart(_pluginConfig: PluginConfig, registry: PluginRegistry): Promise<void> {
55
+ const logger = registry.getLogger('subscriptions');
56
+
57
+ // Check for postgres in registry
58
+ if (!hasPostgres()) {
59
+ logger.warn('No Database! Subscriptions plugin disabled.');
60
+ registry.registerHealthCheck({
61
+ name: 'subscriptions-store',
62
+ type: 'custom',
63
+ check: async () => ({
64
+ healthy: false,
65
+ details: {
66
+ error: 'PostgreSQL not available',
67
+ state: 'disabled',
68
+ },
69
+ }),
70
+ });
71
+ return;
72
+ }
73
+
74
+ // Smart defaults - get dependencies from registry
75
+ const store = config.store ?? postgresSubscriptionsStore({
76
+ pool: () => getPostgres().getPool(),
77
+ autoCreateTables: true,
78
+ });
79
+
80
+ const debug = config.debug ?? false;
81
+ const defaultTierSlug = config.defaultTierSlug ?? 'free';
82
+ const apiPrefix = config.api?.prefix ?? '/subscriptions';
83
+
51
84
  log('Starting subscriptions plugin');
52
85
 
53
86
  // Initialize the store (creates tables if needed)
54
- await config.store.initialize();
87
+ await store.initialize();
55
88
  log('Subscriptions plugin migrations complete');
56
89
 
57
90
  // Store references for helper access
58
- currentStore = config.store;
59
- currentConfig = config;
91
+ currentStore = store;
92
+ currentConfig = { ...config, store, debug, defaultTierSlug };
60
93
 
61
94
  // Register health check
62
95
  registry.registerHealthCheck({
@@ -64,7 +97,7 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
64
97
  type: 'custom',
65
98
  check: async () => {
66
99
  try {
67
- const tiers = await config.store.listTiers(true);
100
+ const tiers = await store.listTiers(true);
68
101
  return {
69
102
  healthy: true,
70
103
  details: {
@@ -88,14 +121,14 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
88
121
  handler: async (req: Request, res: Response) => {
89
122
  try {
90
123
  const activeOnly = req.query.active !== 'false';
91
- const tiers = await config.store.listTiers(activeOnly);
124
+ const tiers = await store.listTiers(activeOnly);
92
125
 
93
126
  // Include entitlements if requested
94
127
  if (req.query.include === 'entitlements') {
95
128
  const tiersWithEntitlements = await Promise.all(
96
129
  tiers.map(async (tier) => ({
97
130
  ...tier,
98
- entitlements: await config.store.getEntitlementsByTier(tier.id),
131
+ entitlements: await store.getEntitlementsByTier(tier.id),
99
132
  }))
100
133
  );
101
134
  return res.json({ tiers: tiersWithEntitlements });
@@ -119,16 +152,16 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
119
152
  const { idOrSlug } = req.params;
120
153
 
121
154
  // Try by ID first, then by slug
122
- let tier = await config.store.getTierById(idOrSlug);
155
+ let tier = await store.getTierById(idOrSlug);
123
156
  if (!tier) {
124
- tier = await config.store.getTierBySlug(idOrSlug);
157
+ tier = await store.getTierBySlug(idOrSlug);
125
158
  }
126
159
 
127
160
  if (!tier) {
128
161
  return res.status(404).json({ error: 'Tier not found' });
129
162
  }
130
163
 
131
- const entitlements = await config.store.getEntitlementsByTier(tier.id);
164
+ const entitlements = await store.getEntitlementsByTier(tier.id);
132
165
  res.json({ ...tier, entitlements });
133
166
  } catch (error) {
134
167
  console.error('[SubscriptionsPlugin] Get tier error:', error);
@@ -151,12 +184,12 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
151
184
  }
152
185
 
153
186
  // Check for duplicate slug
154
- const existing = await config.store.getTierBySlug(input.slug);
187
+ const existing = await store.getTierBySlug(input.slug);
155
188
  if (existing) {
156
189
  return res.status(409).json({ error: 'Tier with this slug already exists' });
157
190
  }
158
191
 
159
- const tier = await config.store.createTier(input);
192
+ const tier = await store.createTier(input);
160
193
  res.status(201).json(tier);
161
194
  } catch (error) {
162
195
  console.error('[SubscriptionsPlugin] Create tier error:', error);
@@ -173,7 +206,7 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
173
206
  handler: async (req: Request, res: Response) => {
174
207
  try {
175
208
  const input: UpdateTierInput = req.body;
176
- const tier = await config.store.updateTier(req.params.id, input);
209
+ const tier = await store.updateTier(req.params.id, input);
177
210
 
178
211
  if (!tier) {
179
212
  return res.status(404).json({ error: 'Tier not found' });
@@ -200,8 +233,8 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
200
233
  return res.status(400).json({ error: 'entitlements array is required' });
201
234
  }
202
235
 
203
- await config.store.setTierEntitlements(req.params.id, entitlements);
204
- const updatedEntitlements = await config.store.getEntitlementsByTier(req.params.id);
236
+ await store.setTierEntitlements(req.params.id, entitlements);
237
+ const updatedEntitlements = await store.getEntitlementsByTier(req.params.id);
205
238
 
206
239
  res.json({ entitlements: updatedEntitlements });
207
240
  } catch (error) {
@@ -221,14 +254,14 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
221
254
  pluginId: 'subscriptions',
222
255
  handler: async (req: Request, res: Response) => {
223
256
  try {
224
- const subscription = await config.store.getActiveSubscription(req.params.userId);
257
+ const subscription = await store.getActiveSubscription(req.params.userId);
225
258
 
226
259
  if (!subscription) {
227
260
  return res.status(404).json({ error: 'No active subscription found' });
228
261
  }
229
262
 
230
263
  // Get entitlements for the tier
231
- const entitlements = await config.store.getEntitlementsByTier(subscription.tier_id);
264
+ const entitlements = await store.getEntitlementsByTier(subscription.tier_id);
232
265
 
233
266
  res.json({
234
267
  subscription,
@@ -255,14 +288,14 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
255
288
 
256
289
  if (!input.tier_id) {
257
290
  // Use default tier if not specified
258
- const defaultTier = await config.store.getTierBySlug(defaultTierSlug);
291
+ const defaultTier = await store.getTierBySlug(defaultTierSlug);
259
292
  if (!defaultTier) {
260
293
  return res.status(400).json({ error: 'tier_id is required (no default tier found)' });
261
294
  }
262
295
  input.tier_id = defaultTier.id;
263
296
  }
264
297
 
265
- const subscription = await config.store.createUserSubscription(input);
298
+ const subscription = await store.createUserSubscription(input);
266
299
  res.status(201).json(subscription);
267
300
  } catch (error) {
268
301
  console.error('[SubscriptionsPlugin] Create subscription error:', error);
@@ -295,13 +328,13 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
295
328
  pluginId: 'subscriptions',
296
329
  handler: async (req: Request, res: Response) => {
297
330
  try {
298
- const success = await config.store.cancelSubscription(req.params.id);
331
+ const success = await store.cancelSubscription(req.params.id);
299
332
 
300
333
  if (!success) {
301
334
  return res.status(404).json({ error: 'Subscription not found' });
302
335
  }
303
336
 
304
- const subscription = await config.store.getUserSubscriptionById(req.params.id);
337
+ const subscription = await store.getUserSubscriptionById(req.params.id);
305
338
  res.json(subscription);
306
339
  } catch (error) {
307
340
  console.error('[SubscriptionsPlugin] Cancel subscription error:', error);
@@ -316,7 +349,7 @@ export function createSubscriptionsPlugin(config: SubscriptionsPluginConfig): Pl
316
349
 
317
350
  async onStop(): Promise<void> {
318
351
  log('Stopping subscriptions plugin');
319
- await config.store.shutdown();
352
+ if (currentStore) { await currentStore.shutdown(); };
320
353
  currentStore = null;
321
354
  currentConfig = null;
322
355
  log('Subscriptions plugin stopped');
@@ -340,10 +340,16 @@ export interface SubscriptionsApiConfig {
340
340
 
341
341
  /**
342
342
  * Subscriptions plugin configuration
343
+ *
344
+ * All properties are optional - plugin will use smart defaults:
345
+ * - store: Postgres subscriptions store using registry's postgres instance
346
+ * - defaultTierSlug: 'free'
347
+ * - api.prefix: '/subscriptions'
348
+ * - debug: false
343
349
  */
344
350
  export interface SubscriptionsPluginConfig {
345
- /** Subscriptions storage backend */
346
- store: SubscriptionsStore;
351
+ /** Subscriptions storage backend (default: postgres subscriptions store from registry) */
352
+ store?: SubscriptionsStore;
347
353
  /** Default tier slug for new users (default: 'free') */
348
354
  defaultTierSlug?: string;
349
355
  /** Whether to auto-create default subscription for new users */
@@ -11,7 +11,7 @@
11
11
  export { createTenantsPlugin, getTenantStore, autoCreateUserTenant } from './tenants-plugin.js';
12
12
 
13
13
  // Store implementations
14
- export { postgresTenantStore } from './stores/postgres-store.js';
14
+ export { postgresTenantStore, inMemoryTenantStore } from './stores/index.js';
15
15
 
16
16
  // Types
17
17
  export type {