@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.
- package/CHANGELOG.md +66 -0
- package/README.md +13 -116
- package/dist/src/core/control-panel.d.ts.map +1 -1
- package/dist/src/core/control-panel.js +6 -4
- package/dist/src/core/control-panel.js.map +1 -1
- package/dist/src/core/gateway.d.ts.map +1 -1
- package/dist/src/core/gateway.js +24 -2
- package/dist/src/core/gateway.js.map +1 -1
- package/dist/src/core/plugin-registry.d.ts +15 -2
- package/dist/src/core/plugin-registry.d.ts.map +1 -1
- package/dist/src/core/plugin-registry.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/plugins/api-keys/api-keys-plugin.d.ts +5 -2
- package/dist/src/plugins/api-keys/api-keys-plugin.d.ts.map +1 -1
- package/dist/src/plugins/api-keys/api-keys-plugin.js +61 -19
- package/dist/src/plugins/api-keys/api-keys-plugin.js.map +1 -1
- package/dist/src/plugins/api-keys/index.d.ts +0 -4
- package/dist/src/plugins/api-keys/index.d.ts.map +1 -1
- package/dist/src/plugins/api-keys/index.js +2 -3
- package/dist/src/plugins/api-keys/index.js.map +1 -1
- package/dist/src/plugins/api-keys/stores/postgres-store.d.ts.map +1 -1
- package/dist/src/plugins/api-keys/stores/postgres-store.js +29 -0
- package/dist/src/plugins/api-keys/stores/postgres-store.js.map +1 -1
- package/dist/src/plugins/api-keys/types.d.ts +9 -3
- package/dist/src/plugins/api-keys/types.d.ts.map +1 -1
- package/dist/src/plugins/api-keys/types.js.map +1 -1
- package/dist/src/plugins/auth/auth-plugin.d.ts.map +1 -1
- package/dist/src/plugins/auth/auth-plugin.js +4 -2
- package/dist/src/plugins/auth/auth-plugin.js.map +1 -1
- package/dist/src/plugins/auth/env-config.d.ts.map +1 -1
- package/dist/src/plugins/auth/env-config.js +1 -0
- package/dist/src/plugins/auth/env-config.js.map +1 -1
- package/dist/src/plugins/auth/index.d.ts +0 -4
- package/dist/src/plugins/auth/index.d.ts.map +1 -1
- package/dist/src/plugins/auth/index.js +2 -3
- package/dist/src/plugins/auth/index.js.map +1 -1
- package/dist/src/plugins/bans/bans-plugin.d.ts +5 -2
- package/dist/src/plugins/bans/bans-plugin.d.ts.map +1 -1
- package/dist/src/plugins/bans/bans-plugin.js +71 -25
- package/dist/src/plugins/bans/bans-plugin.js.map +1 -1
- package/dist/src/plugins/bans/index.d.ts +1 -5
- package/dist/src/plugins/bans/index.d.ts.map +1 -1
- package/dist/src/plugins/bans/index.js +3 -4
- package/dist/src/plugins/bans/index.js.map +1 -1
- package/dist/src/plugins/bans/stores/in-memory-store.d.ts +34 -0
- package/dist/src/plugins/bans/stores/in-memory-store.d.ts.map +1 -0
- package/dist/src/plugins/bans/stores/in-memory-store.js +97 -0
- package/dist/src/plugins/bans/stores/in-memory-store.js.map +1 -0
- package/dist/src/plugins/bans/stores/index.d.ts +1 -0
- package/dist/src/plugins/bans/stores/index.d.ts.map +1 -1
- package/dist/src/plugins/bans/stores/index.js +1 -0
- package/dist/src/plugins/bans/stores/index.js.map +1 -1
- package/dist/src/plugins/bans/types.d.ts +13 -6
- package/dist/src/plugins/bans/types.d.ts.map +1 -1
- package/dist/src/plugins/cache-plugin.d.ts +35 -16
- package/dist/src/plugins/cache-plugin.d.ts.map +1 -1
- package/dist/src/plugins/cache-plugin.js +299 -20
- package/dist/src/plugins/cache-plugin.js.map +1 -1
- package/dist/src/plugins/cms/cms-plugin.d.ts.map +1 -1
- package/dist/src/plugins/cms/cms-plugin.js +3 -1
- package/dist/src/plugins/cms/cms-plugin.js.map +1 -1
- package/dist/src/plugins/devices/devices-plugin.d.ts +5 -2
- package/dist/src/plugins/devices/devices-plugin.d.ts.map +1 -1
- package/dist/src/plugins/devices/devices-plugin.js +62 -26
- package/dist/src/plugins/devices/devices-plugin.js.map +1 -1
- package/dist/src/plugins/devices/index.d.ts +0 -4
- package/dist/src/plugins/devices/index.d.ts.map +1 -1
- package/dist/src/plugins/devices/index.js +2 -3
- package/dist/src/plugins/devices/index.js.map +1 -1
- package/dist/src/plugins/entitlements/entitlements-plugin.d.ts +5 -2
- package/dist/src/plugins/entitlements/entitlements-plugin.d.ts.map +1 -1
- package/dist/src/plugins/entitlements/entitlements-plugin.js +78 -41
- package/dist/src/plugins/entitlements/entitlements-plugin.js.map +1 -1
- package/dist/src/plugins/entitlements/index.d.ts +1 -5
- package/dist/src/plugins/entitlements/index.d.ts.map +1 -1
- package/dist/src/plugins/entitlements/index.js +3 -4
- package/dist/src/plugins/entitlements/index.js.map +1 -1
- package/dist/src/plugins/entitlements/sources/in-memory-source.d.ts +9 -0
- package/dist/src/plugins/entitlements/sources/in-memory-source.d.ts.map +1 -0
- package/dist/src/plugins/entitlements/sources/in-memory-source.js +65 -0
- package/dist/src/plugins/entitlements/sources/in-memory-source.js.map +1 -0
- package/dist/src/plugins/entitlements/sources/index.d.ts +1 -0
- package/dist/src/plugins/entitlements/sources/index.d.ts.map +1 -1
- package/dist/src/plugins/entitlements/sources/index.js +1 -0
- package/dist/src/plugins/entitlements/sources/index.js.map +1 -1
- package/dist/src/plugins/entitlements/types.d.ts +9 -2
- package/dist/src/plugins/entitlements/types.d.ts.map +1 -1
- package/dist/src/plugins/health-plugin.d.ts.map +1 -1
- package/dist/src/plugins/health-plugin.js +1 -0
- package/dist/src/plugins/health-plugin.js.map +1 -1
- package/dist/src/plugins/index.d.ts +4 -4
- package/dist/src/plugins/index.d.ts.map +1 -1
- package/dist/src/plugins/index.js +4 -4
- package/dist/src/plugins/index.js.map +1 -1
- package/dist/src/plugins/logs-plugin.d.ts.map +1 -1
- package/dist/src/plugins/logs-plugin.js +49 -1
- package/dist/src/plugins/logs-plugin.js.map +1 -1
- package/dist/src/plugins/maintenance-plugin.d.ts.map +1 -1
- package/dist/src/plugins/maintenance-plugin.js +39 -0
- package/dist/src/plugins/maintenance-plugin.js.map +1 -1
- package/dist/src/plugins/notifications/index.d.ts +0 -4
- package/dist/src/plugins/notifications/index.d.ts.map +1 -1
- package/dist/src/plugins/notifications/index.js +2 -3
- package/dist/src/plugins/notifications/index.js.map +1 -1
- package/dist/src/plugins/notifications/notifications-plugin.d.ts +5 -2
- package/dist/src/plugins/notifications/notifications-plugin.d.ts.map +1 -1
- package/dist/src/plugins/notifications/notifications-plugin.js +46 -13
- package/dist/src/plugins/notifications/notifications-plugin.js.map +1 -1
- package/dist/src/plugins/parental/index.d.ts +0 -4
- package/dist/src/plugins/parental/index.d.ts.map +1 -1
- package/dist/src/plugins/parental/index.js +2 -3
- package/dist/src/plugins/parental/index.js.map +1 -1
- package/dist/src/plugins/parental/parental-plugin.d.ts +5 -2
- package/dist/src/plugins/parental/parental-plugin.d.ts.map +1 -1
- package/dist/src/plugins/parental/parental-plugin.js +60 -24
- package/dist/src/plugins/parental/parental-plugin.js.map +1 -1
- package/dist/src/plugins/postgres-plugin.d.ts +3 -1
- package/dist/src/plugins/postgres-plugin.d.ts.map +1 -1
- package/dist/src/plugins/postgres-plugin.js +18 -8
- package/dist/src/plugins/postgres-plugin.js.map +1 -1
- package/dist/src/plugins/preferences/index.d.ts +0 -4
- package/dist/src/plugins/preferences/index.d.ts.map +1 -1
- package/dist/src/plugins/preferences/index.js +2 -3
- package/dist/src/plugins/preferences/index.js.map +1 -1
- package/dist/src/plugins/preferences/preferences-plugin.d.ts +5 -2
- package/dist/src/plugins/preferences/preferences-plugin.d.ts.map +1 -1
- package/dist/src/plugins/preferences/preferences-plugin.js +63 -19
- package/dist/src/plugins/preferences/preferences-plugin.js.map +1 -1
- package/dist/src/plugins/profiles/index.d.ts +0 -4
- package/dist/src/plugins/profiles/index.d.ts.map +1 -1
- package/dist/src/plugins/profiles/index.js +2 -3
- package/dist/src/plugins/profiles/index.js.map +1 -1
- package/dist/src/plugins/profiles/profiles-plugin.d.ts +5 -2
- package/dist/src/plugins/profiles/profiles-plugin.d.ts.map +1 -1
- package/dist/src/plugins/profiles/profiles-plugin.js +60 -26
- package/dist/src/plugins/profiles/profiles-plugin.js.map +1 -1
- package/dist/src/plugins/profiles/types.d.ts +9 -2
- package/dist/src/plugins/profiles/types.d.ts.map +1 -1
- package/dist/src/plugins/qwickbrain/index.d.ts +0 -4
- package/dist/src/plugins/qwickbrain/index.d.ts.map +1 -1
- package/dist/src/plugins/qwickbrain/index.js +2 -3
- package/dist/src/plugins/qwickbrain/index.js.map +1 -1
- package/dist/src/plugins/qwickbrain/qwickbrain-plugin.d.ts.map +1 -1
- package/dist/src/plugins/qwickbrain/qwickbrain-plugin.js +117 -0
- package/dist/src/plugins/qwickbrain/qwickbrain-plugin.js.map +1 -1
- package/dist/src/plugins/rate-limit/index.d.ts +0 -4
- package/dist/src/plugins/rate-limit/index.d.ts.map +1 -1
- package/dist/src/plugins/rate-limit/index.js +2 -3
- package/dist/src/plugins/rate-limit/index.js.map +1 -1
- package/dist/src/plugins/subscriptions/index.d.ts +0 -4
- package/dist/src/plugins/subscriptions/index.d.ts.map +1 -1
- package/dist/src/plugins/subscriptions/index.js +2 -3
- package/dist/src/plugins/subscriptions/index.js.map +1 -1
- package/dist/src/plugins/subscriptions/subscriptions-plugin.d.ts +5 -2
- package/dist/src/plugins/subscriptions/subscriptions-plugin.d.ts.map +1 -1
- package/dist/src/plugins/subscriptions/subscriptions-plugin.js +63 -29
- package/dist/src/plugins/subscriptions/subscriptions-plugin.js.map +1 -1
- package/dist/src/plugins/subscriptions/types.d.ts +8 -2
- package/dist/src/plugins/subscriptions/types.d.ts.map +1 -1
- package/dist/src/plugins/tenants/index.d.ts +1 -1
- package/dist/src/plugins/tenants/index.d.ts.map +1 -1
- package/dist/src/plugins/tenants/index.js +1 -1
- package/dist/src/plugins/tenants/index.js.map +1 -1
- package/dist/src/plugins/tenants/stores/in-memory-store.d.ts +59 -0
- package/dist/src/plugins/tenants/stores/in-memory-store.d.ts.map +1 -0
- package/dist/src/plugins/tenants/stores/in-memory-store.js +257 -0
- package/dist/src/plugins/tenants/stores/in-memory-store.js.map +1 -0
- package/dist/src/plugins/tenants/stores/index.d.ts +8 -0
- package/dist/src/plugins/tenants/stores/index.d.ts.map +1 -0
- package/dist/src/plugins/tenants/stores/index.js +8 -0
- package/dist/src/plugins/tenants/stores/index.js.map +1 -0
- package/dist/src/plugins/tenants/tenants-plugin.d.ts +5 -2
- package/dist/src/plugins/tenants/tenants-plugin.d.ts.map +1 -1
- package/dist/src/plugins/tenants/tenants-plugin.js +93 -60
- package/dist/src/plugins/tenants/tenants-plugin.js.map +1 -1
- package/dist/src/plugins/tenants/types.d.ts +8 -2
- package/dist/src/plugins/tenants/types.d.ts.map +1 -1
- package/dist/src/plugins/usage/index.d.ts +0 -4
- package/dist/src/plugins/usage/index.d.ts.map +1 -1
- package/dist/src/plugins/usage/index.js +2 -3
- package/dist/src/plugins/usage/index.js.map +1 -1
- package/dist/src/plugins/usage/usage-plugin.d.ts +5 -2
- package/dist/src/plugins/usage/usage-plugin.d.ts.map +1 -1
- package/dist/src/plugins/usage/usage-plugin.js +57 -23
- package/dist/src/plugins/usage/usage-plugin.js.map +1 -1
- package/dist/src/plugins/users/index.d.ts +1 -1
- package/dist/src/plugins/users/index.d.ts.map +1 -1
- package/dist/src/plugins/users/index.js +1 -1
- package/dist/src/plugins/users/index.js.map +1 -1
- package/dist/src/plugins/users/stores/in-memory-store.d.ts +36 -0
- package/dist/src/plugins/users/stores/in-memory-store.d.ts.map +1 -0
- package/dist/src/plugins/users/stores/in-memory-store.js +122 -0
- package/dist/src/plugins/users/stores/in-memory-store.js.map +1 -0
- package/dist/src/plugins/users/stores/index.d.ts +1 -0
- package/dist/src/plugins/users/stores/index.d.ts.map +1 -1
- package/dist/src/plugins/users/stores/index.js +1 -0
- package/dist/src/plugins/users/stores/index.js.map +1 -1
- package/dist/src/plugins/users/types.d.ts +7 -2
- package/dist/src/plugins/users/types.d.ts.map +1 -1
- package/dist/src/plugins/users/users-plugin.d.ts +5 -2
- package/dist/src/plugins/users/users-plugin.d.ts.map +1 -1
- package/dist/src/plugins/users/users-plugin.js +56 -23
- package/dist/src/plugins/users/users-plugin.js.map +1 -1
- package/dist/ui/src/api/controlPanelApi.d.ts +10 -1
- package/dist/ui/src/api/controlPanelApi.d.ts.map +1 -1
- package/dist/ui/src/api/controlPanelApi.js.map +1 -1
- package/dist/ui/src/dashboard/PluginWidgetRenderer.d.ts +3 -1
- package/dist/ui/src/dashboard/PluginWidgetRenderer.d.ts.map +1 -1
- package/dist/ui/src/dashboard/PluginWidgetRenderer.js +5 -1
- package/dist/ui/src/dashboard/PluginWidgetRenderer.js.map +1 -1
- package/dist/ui/src/dashboard/builtInWidgets.d.ts.map +1 -1
- package/dist/ui/src/dashboard/builtInWidgets.js +13 -1
- package/dist/ui/src/dashboard/builtInWidgets.js.map +1 -1
- package/dist/ui/src/dashboard/widgets/CacheMaintenanceWidget.d.ts +11 -0
- package/dist/ui/src/dashboard/widgets/CacheMaintenanceWidget.d.ts.map +1 -0
- package/dist/ui/src/dashboard/widgets/CacheMaintenanceWidget.js +77 -0
- package/dist/ui/src/dashboard/widgets/CacheMaintenanceWidget.js.map +1 -0
- package/dist/ui/src/dashboard/widgets/DatabaseOpsWidget.d.ts +10 -0
- package/dist/ui/src/dashboard/widgets/DatabaseOpsWidget.d.ts.map +1 -0
- package/dist/ui/src/dashboard/widgets/DatabaseOpsWidget.js +14 -0
- package/dist/ui/src/dashboard/widgets/DatabaseOpsWidget.js.map +1 -0
- package/dist/ui/src/dashboard/widgets/EnvironmentConfigWidget.d.ts +10 -0
- package/dist/ui/src/dashboard/widgets/EnvironmentConfigWidget.d.ts.map +1 -0
- package/dist/ui/src/dashboard/widgets/EnvironmentConfigWidget.js +14 -0
- package/dist/ui/src/dashboard/widgets/EnvironmentConfigWidget.js.map +1 -0
- package/dist/ui/src/dashboard/widgets/LogsMaintenanceWidget.d.ts +11 -0
- package/dist/ui/src/dashboard/widgets/LogsMaintenanceWidget.d.ts.map +1 -0
- package/dist/ui/src/dashboard/widgets/LogsMaintenanceWidget.js +96 -0
- package/dist/ui/src/dashboard/widgets/LogsMaintenanceWidget.js.map +1 -0
- package/dist/ui/src/dashboard/widgets/SeedManagementWidget.d.ts +10 -0
- package/dist/ui/src/dashboard/widgets/SeedManagementWidget.d.ts.map +1 -0
- package/dist/ui/src/dashboard/widgets/SeedManagementWidget.js +55 -0
- package/dist/ui/src/dashboard/widgets/SeedManagementWidget.js.map +1 -0
- package/dist/ui/src/dashboard/widgets/ServiceControlWidget.d.ts +10 -0
- package/dist/ui/src/dashboard/widgets/ServiceControlWidget.d.ts.map +1 -0
- package/dist/ui/src/dashboard/widgets/ServiceControlWidget.js +14 -0
- package/dist/ui/src/dashboard/widgets/ServiceControlWidget.js.map +1 -0
- package/dist/ui/src/dashboard/widgets/index.d.ts +6 -0
- package/dist/ui/src/dashboard/widgets/index.d.ts.map +1 -1
- package/dist/ui/src/dashboard/widgets/index.js +6 -0
- package/dist/ui/src/dashboard/widgets/index.js.map +1 -1
- package/dist/ui/src/pages/DashboardPage.js +1 -1
- package/dist/ui/src/pages/DashboardPage.js.map +1 -1
- package/dist-ui/assets/index-0gzisPdy.js +528 -0
- package/dist-ui/assets/{index-lm1yX6UD.js.map → index-0gzisPdy.js.map} +1 -1
- package/dist-ui/index.html +1 -1
- package/dist-ui-lib/index.js +3109 -2774
- package/dist-ui-lib/index.js.map +1 -1
- package/dist-ui-lib/src/api/controlPanelApi.d.ts +10 -1
- package/dist-ui-lib/src/dashboard/PluginWidgetRenderer.d.ts +3 -1
- package/dist-ui-lib/src/dashboard/widgets/CacheMaintenanceWidget.d.ts +10 -0
- package/dist-ui-lib/src/dashboard/widgets/DatabaseOpsWidget.d.ts +9 -0
- package/dist-ui-lib/src/dashboard/widgets/EnvironmentConfigWidget.d.ts +9 -0
- package/dist-ui-lib/src/dashboard/widgets/LogsMaintenanceWidget.d.ts +10 -0
- package/dist-ui-lib/src/dashboard/widgets/SeedManagementWidget.d.ts +9 -0
- package/dist-ui-lib/src/dashboard/widgets/ServiceControlWidget.d.ts +9 -0
- package/dist-ui-lib/src/dashboard/widgets/index.d.ts +6 -0
- package/package.json +12 -6
- package/src/core/control-panel.ts +6 -4
- package/src/core/gateway.ts +25 -2
- package/src/core/plugin-registry.ts +15 -2
- package/src/index.ts +53 -0
- package/src/plugins/api-keys/api-keys-plugin.ts +64 -20
- package/src/plugins/api-keys/index.ts +2 -5
- package/src/plugins/api-keys/stores/postgres-store.ts +30 -0
- package/src/plugins/api-keys/types.ts +9 -3
- package/src/plugins/auth/auth-plugin.ts +4 -2
- package/src/plugins/auth/env-config.ts +1 -0
- package/src/plugins/auth/index.ts +3 -5
- package/src/plugins/bans/bans-plugin.ts +71 -26
- package/src/plugins/bans/index.ts +4 -6
- package/src/plugins/bans/stores/in-memory-store.ts +106 -0
- package/src/plugins/bans/stores/index.ts +1 -0
- package/src/plugins/bans/types.ts +13 -6
- package/src/plugins/cache-plugin.test.ts +2 -2
- package/src/plugins/cache-plugin.ts +331 -30
- package/src/plugins/cms/cms-plugin.ts +3 -1
- package/src/plugins/devices/devices-plugin.ts +62 -27
- package/src/plugins/devices/index.ts +3 -5
- package/src/plugins/entitlements/entitlements-plugin.ts +81 -43
- package/src/plugins/entitlements/index.ts +4 -6
- package/src/plugins/entitlements/sources/in-memory-source.ts +76 -0
- package/src/plugins/entitlements/sources/index.ts +1 -0
- package/src/plugins/entitlements/types.ts +9 -2
- package/src/plugins/health-plugin.ts +1 -0
- package/src/plugins/index.ts +4 -1
- package/src/plugins/logs-plugin.ts +55 -1
- package/src/plugins/maintenance-plugin.ts +43 -0
- package/src/plugins/notifications/index.ts +3 -5
- package/src/plugins/notifications/notifications-plugin.ts +49 -19
- package/src/plugins/parental/index.ts +3 -5
- package/src/plugins/parental/parental-plugin.ts +63 -25
- package/src/plugins/postgres-plugin.test.ts +2 -2
- package/src/plugins/postgres-plugin.ts +20 -9
- package/src/plugins/preferences/index.ts +3 -5
- package/src/plugins/preferences/preferences-plugin.ts +66 -20
- package/src/plugins/profiles/index.ts +3 -5
- package/src/plugins/profiles/profiles-plugin.ts +60 -27
- package/src/plugins/profiles/types.ts +9 -2
- package/src/plugins/qwickbrain/index.ts +3 -5
- package/src/plugins/qwickbrain/qwickbrain-plugin.ts +135 -0
- package/src/plugins/rate-limit/index.ts +3 -5
- package/src/plugins/subscriptions/index.ts +3 -5
- package/src/plugins/subscriptions/subscriptions-plugin.ts +63 -30
- package/src/plugins/subscriptions/types.ts +8 -2
- package/src/plugins/tenants/index.ts +1 -1
- package/src/plugins/tenants/stores/in-memory-store.ts +335 -0
- package/src/plugins/tenants/stores/index.ts +13 -0
- package/src/plugins/tenants/tenants-plugin.ts +97 -62
- package/src/plugins/tenants/types.ts +8 -2
- package/src/plugins/usage/index.ts +3 -5
- package/src/plugins/usage/usage-plugin.ts +60 -26
- package/src/plugins/users/index.ts +1 -1
- package/src/plugins/users/stores/in-memory-store.ts +140 -0
- package/src/plugins/users/stores/index.ts +1 -0
- package/src/plugins/users/types.ts +7 -2
- package/src/plugins/users/users-plugin.ts +56 -24
- package/src/testing/index.ts +1 -0
- package/src/testing/pg-mem-pool.ts +33 -0
- package/ui/src/api/controlPanelApi.ts +10 -1
- package/ui/src/dashboard/PluginWidgetRenderer.tsx +8 -0
- package/ui/src/dashboard/builtInWidgets.tsx +19 -1
- package/ui/src/dashboard/widgets/CacheMaintenanceWidget.tsx +195 -0
- package/ui/src/dashboard/widgets/DatabaseOpsWidget.tsx +29 -0
- package/ui/src/dashboard/widgets/EnvironmentConfigWidget.tsx +29 -0
- package/ui/src/dashboard/widgets/LogsMaintenanceWidget.tsx +247 -0
- package/ui/src/dashboard/widgets/SeedManagementWidget.tsx +128 -0
- package/ui/src/dashboard/widgets/ServiceControlWidget.tsx +29 -0
- package/ui/src/dashboard/widgets/index.ts +6 -0
- package/ui/src/pages/DashboardPage.tsx +2 -2
- package/ui/src/pages/MaintenancePage.tsx +1 -1
- 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
|
|
132
|
-
|
|
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
|
|
55
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
|
87
|
+
await store.initialize();
|
|
55
88
|
log('Subscriptions plugin migrations complete');
|
|
56
89
|
|
|
57
90
|
// Store references for helper access
|
|
58
|
-
currentStore =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
155
|
+
let tier = await store.getTierById(idOrSlug);
|
|
123
156
|
if (!tier) {
|
|
124
|
-
tier = await
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
204
|
-
const updatedEntitlements = await
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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/
|
|
14
|
+
export { postgresTenantStore, inMemoryTenantStore } from './stores/index.js';
|
|
15
15
|
|
|
16
16
|
// Types
|
|
17
17
|
export type {
|