@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
|
@@ -245,9 +245,18 @@ export interface WidgetContribution {
|
|
|
245
245
|
title: string;
|
|
246
246
|
/** Component name to render (matched by frontend widget registry) */
|
|
247
247
|
component: string;
|
|
248
|
+
/**
|
|
249
|
+
* Widget type/category - determines which page(s) can display this widget
|
|
250
|
+
* - 'status': System health, service status, monitoring metrics (Dashboard)
|
|
251
|
+
* - 'maintenance': Operational tasks like seeding, service control, config (Maintenance page)
|
|
252
|
+
* - 'analytics': Charts, graphs, usage metrics (Dashboard or Analytics page)
|
|
253
|
+
* - 'monitoring': Performance, logs, real-time data (Monitoring page)
|
|
254
|
+
* - 'custom': Custom widgets for specific use cases
|
|
255
|
+
*/
|
|
256
|
+
type: 'status' | 'maintenance' | 'analytics' | 'monitoring' | 'custom';
|
|
248
257
|
/** Priority for ordering (lower = first, default: 100) */
|
|
249
258
|
priority?: number;
|
|
250
|
-
/** Whether this widget is shown by default */
|
|
259
|
+
/** Whether this widget is shown by default on its designated page */
|
|
251
260
|
showByDefault?: boolean;
|
|
252
261
|
pluginId: string;
|
|
253
262
|
}
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
interface PluginWidgetRendererProps {
|
|
10
|
+
/** Filter widgets by type (e.g., 'status' for dashboard, 'maintenance' for maintenance page) */
|
|
11
|
+
widgetType?: 'status' | 'maintenance' | 'analytics' | 'monitoring' | 'custom';
|
|
10
12
|
/** Only show widgets marked as showByDefault (default: true) */
|
|
11
13
|
defaultOnly?: boolean;
|
|
12
14
|
/** Additional widget IDs to show (beyond showByDefault) */
|
|
@@ -15,5 +17,5 @@ interface PluginWidgetRendererProps {
|
|
|
15
17
|
/**
|
|
16
18
|
* Renders widgets from plugins that have registered them via the server API
|
|
17
19
|
*/
|
|
18
|
-
export declare function PluginWidgetRenderer({ defaultOnly, additionalWidgetIds, }: PluginWidgetRendererProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
export declare function PluginWidgetRenderer({ widgetType, defaultOnly, additionalWidgetIds, }: PluginWidgetRendererProps): import("react/jsx-runtime").JSX.Element | null;
|
|
19
21
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache Maintenance Widget
|
|
3
|
+
*
|
|
4
|
+
* Provides cache management operations:
|
|
5
|
+
* - View cache statistics
|
|
6
|
+
* - Clear cache (flush all keys)
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
9
|
+
*/
|
|
10
|
+
export declare function CacheMaintenanceWidget(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database Operations Widget
|
|
3
|
+
*
|
|
4
|
+
* Provides database backup, restore, and maintenance operations.
|
|
5
|
+
* Part of the maintenance plugin.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
export declare function DatabaseOpsWidget(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Configuration Widget
|
|
3
|
+
*
|
|
4
|
+
* Displays and allows editing environment variables.
|
|
5
|
+
* Part of the maintenance plugin.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
export declare function EnvironmentConfigWidget(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs Maintenance Widget
|
|
3
|
+
*
|
|
4
|
+
* Provides log management operations:
|
|
5
|
+
* - View log statistics
|
|
6
|
+
* - Clear log files
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
9
|
+
*/
|
|
10
|
+
export declare function LogsMaintenanceWidget(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seed Management Widget
|
|
3
|
+
*
|
|
4
|
+
* Displays available seed scripts and allows executing them.
|
|
5
|
+
* Part of the maintenance plugin.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SeedManagementWidget(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Control Widget
|
|
3
|
+
*
|
|
4
|
+
* Provides controls for starting, stopping, and restarting services.
|
|
5
|
+
* Part of the maintenance plugin.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ServiceControlWidget(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,3 +9,9 @@ export { AuthStatusWidget } from './AuthStatusWidget';
|
|
|
9
9
|
export { NotificationsStatsWidget } from './NotificationsStatsWidget';
|
|
10
10
|
export { CMSStatusWidget } from './CMSStatusWidget';
|
|
11
11
|
export { CMSMaintenanceWidget } from './CMSMaintenanceWidget';
|
|
12
|
+
export { SeedManagementWidget } from './SeedManagementWidget';
|
|
13
|
+
export { ServiceControlWidget } from './ServiceControlWidget';
|
|
14
|
+
export { EnvironmentConfigWidget } from './EnvironmentConfigWidget';
|
|
15
|
+
export { DatabaseOpsWidget } from './DatabaseOpsWidget';
|
|
16
|
+
export { LogsMaintenanceWidget } from './LogsMaintenanceWidget';
|
|
17
|
+
export { CacheMaintenanceWidget } from './CacheMaintenanceWidget';
|
package/package.json
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwickapps/server",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Plugin-based application server framework for building websites, APIs, admin dashboards, and full-stack products",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./dist/src/index.d.ts",
|
|
10
|
-
"import": "./dist/src/index.js"
|
|
10
|
+
"import": "./dist/src/index.js",
|
|
11
|
+
"require": "./dist/src/index.js"
|
|
11
12
|
},
|
|
12
13
|
"./plugins": {
|
|
13
14
|
"types": "./dist/src/plugins/index.d.ts",
|
|
14
|
-
"import": "./dist/src/plugins/index.js"
|
|
15
|
+
"import": "./dist/src/plugins/index.js",
|
|
16
|
+
"require": "./dist/src/plugins/index.js"
|
|
15
17
|
},
|
|
16
18
|
"./ui": {
|
|
17
19
|
"types": "./dist-ui-lib/src/components/index.d.ts",
|
|
18
|
-
"import": "./dist-ui-lib/index.js"
|
|
20
|
+
"import": "./dist-ui-lib/index.js",
|
|
21
|
+
"require": "./dist-ui-lib/index.js"
|
|
19
22
|
}
|
|
20
23
|
},
|
|
21
24
|
"files": [
|
|
@@ -41,7 +44,9 @@
|
|
|
41
44
|
"test:e2e": "playwright test",
|
|
42
45
|
"test:e2e:ui": "playwright test --ui",
|
|
43
46
|
"test:e2e:headed": "playwright test --headed",
|
|
44
|
-
"demo": "
|
|
47
|
+
"demo": "npm run build:server && pnpm tsx examples/demo-server.ts",
|
|
48
|
+
"demo:gateway": "npm run build:server && pnpm tsx examples/demo-gateway.ts",
|
|
49
|
+
"demo:all": "npm run build:server && pnpm tsx examples/demo-all.ts",
|
|
45
50
|
"type-check": "tsc --noEmit",
|
|
46
51
|
"type-check:ui": "cd ui && tsc --noEmit",
|
|
47
52
|
"validate:clean-install": "./qa/clean-install/validate.sh",
|
|
@@ -63,7 +68,7 @@
|
|
|
63
68
|
"@mui/material": "^7.2.0",
|
|
64
69
|
"@mui/x-data-grid": "^7.29.12",
|
|
65
70
|
"@playwright/test": "^1.57.0",
|
|
66
|
-
"@qwickapps/auth-client": "^1.
|
|
71
|
+
"@qwickapps/auth-client": "^1.1.0",
|
|
67
72
|
"@qwickapps/react-framework": "^1.5.5",
|
|
68
73
|
"@testing-library/jest-dom": "^6.0.0",
|
|
69
74
|
"@testing-library/react": "^14.0.0",
|
|
@@ -81,6 +86,7 @@
|
|
|
81
86
|
"ioredis": "^5.4.0",
|
|
82
87
|
"jsdom": "^25.0.0",
|
|
83
88
|
"pg": "^8.13.0",
|
|
89
|
+
"pg-mem": "^3.0.5",
|
|
84
90
|
"react": "^18.2.0",
|
|
85
91
|
"react-dom": "^18.2.0",
|
|
86
92
|
"react-router-dom": "^6.30.1",
|
|
@@ -41,10 +41,12 @@ import { createCorePlugin } from '../plugins/core/index.js';
|
|
|
41
41
|
// Get the package root directory for serving UI assets
|
|
42
42
|
const __filename = fileURLToPath(import.meta.url);
|
|
43
43
|
const __dirname = dirname(__filename);
|
|
44
|
-
// Handle both src/core and dist/core paths - go up to find package root
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
// Handle both src/core and dist/src/core paths - go up to find package root
|
|
45
|
+
// - src/core/control-panel.ts → go up 2 levels to package root
|
|
46
|
+
// - dist/src/core/control-panel.js → go up 3 levels to package root
|
|
47
|
+
const packageRoot = __dirname.includes('/dist/src/')
|
|
48
|
+
? join(__dirname, '..', '..', '..') // dist/src/core → package root (3 levels)
|
|
49
|
+
: join(__dirname, '..', '..'); // src/core → package root (2 levels)
|
|
48
50
|
const uiDistPath = join(packageRoot, 'dist-ui');
|
|
49
51
|
|
|
50
52
|
// Read @qwickapps/server package version
|
package/src/core/gateway.ts
CHANGED
|
@@ -37,8 +37,31 @@ import { fileURLToPath } from 'url';
|
|
|
37
37
|
// Get QwickApps Server version from package.json
|
|
38
38
|
const __filename = fileURLToPath(import.meta.url);
|
|
39
39
|
const __dirname = dirname(__filename);
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
|
|
41
|
+
// Find package.json by walking up directories
|
|
42
|
+
// Recommended approach for libraries that work in both source and compiled contexts
|
|
43
|
+
function findPackageJson(): string {
|
|
44
|
+
let currentDir = __dirname;
|
|
45
|
+
// Walk up max 5 levels looking for the correct package.json
|
|
46
|
+
for (let i = 0; i < 5; i++) {
|
|
47
|
+
try {
|
|
48
|
+
const packagePath = join(currentDir, 'package.json');
|
|
49
|
+
if (existsSync(packagePath)) {
|
|
50
|
+
const pkg = JSON.parse(readFileSync(packagePath, 'utf-8'));
|
|
51
|
+
// Verify it's the right package
|
|
52
|
+
if (pkg.name === '@qwickapps/server') {
|
|
53
|
+
return pkg.version || '1.0.0';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} catch {
|
|
57
|
+
// Continue searching
|
|
58
|
+
}
|
|
59
|
+
currentDir = join(currentDir, '..');
|
|
60
|
+
}
|
|
61
|
+
return '1.0.0';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const QWICKAPPS_SERVER_VERSION = findPackageJson();
|
|
42
65
|
|
|
43
66
|
/**
|
|
44
67
|
* Maintenance mode configuration for a mounted app
|
|
@@ -185,7 +185,7 @@ export interface PageContribution {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* Widget contribution for dashboards
|
|
188
|
+
* Widget contribution for dashboards and pages
|
|
189
189
|
*/
|
|
190
190
|
export interface WidgetContribution {
|
|
191
191
|
/** Unique ID for this widget */
|
|
@@ -194,9 +194,22 @@ export interface WidgetContribution {
|
|
|
194
194
|
title: string;
|
|
195
195
|
/** Component name to render (matched by frontend widget registry) */
|
|
196
196
|
component: string;
|
|
197
|
+
/**
|
|
198
|
+
* Widget type/category - determines which page(s) can display this widget
|
|
199
|
+
* - 'status': System health, service status, monitoring metrics (Dashboard)
|
|
200
|
+
* - 'maintenance': Operational tasks like seeding, service control, config (Maintenance page)
|
|
201
|
+
* - 'analytics': Charts, graphs, usage metrics (Dashboard or Analytics page)
|
|
202
|
+
* - 'monitoring': Performance, logs, real-time data (Monitoring page)
|
|
203
|
+
* - 'custom': Custom widgets for specific use cases
|
|
204
|
+
*/
|
|
205
|
+
type: 'status' | 'maintenance' | 'analytics' | 'monitoring' | 'custom';
|
|
197
206
|
/** Priority for ordering (lower = first, default: 100) */
|
|
198
207
|
priority?: number;
|
|
199
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* Whether this widget is shown by default on its page (default: false)
|
|
210
|
+
* true = widget appears by default in the initial layout
|
|
211
|
+
* false = widget is available but admin must add it manually
|
|
212
|
+
*/
|
|
200
213
|
showByDefault?: boolean;
|
|
201
214
|
/** Default size */
|
|
202
215
|
defaultSize?: { width: number; height: number };
|
package/src/index.ts
CHANGED
|
@@ -116,6 +116,7 @@ export {
|
|
|
116
116
|
linkUserIdentifiers,
|
|
117
117
|
findOrCreateUser,
|
|
118
118
|
postgresUserStore,
|
|
119
|
+
inMemoryUserStore,
|
|
119
120
|
// Bans plugin (separate from Users, depends on Users)
|
|
120
121
|
createBansPlugin,
|
|
121
122
|
getBanStore,
|
|
@@ -126,6 +127,7 @@ export {
|
|
|
126
127
|
unbanUser,
|
|
127
128
|
listActiveBans,
|
|
128
129
|
postgresBanStore,
|
|
130
|
+
inMemoryBanStore,
|
|
129
131
|
// API Keys plugin (M2M authentication, depends on Users)
|
|
130
132
|
createApiKeysPlugin,
|
|
131
133
|
getApiKeysStore,
|
|
@@ -158,6 +160,21 @@ export {
|
|
|
158
160
|
requireAnyEntitlement,
|
|
159
161
|
requireAllEntitlements,
|
|
160
162
|
postgresEntitlementSource,
|
|
163
|
+
inMemoryEntitlementSource,
|
|
164
|
+
// Preferences plugin
|
|
165
|
+
createPreferencesPlugin,
|
|
166
|
+
getPreferencesStore,
|
|
167
|
+
getPreferences,
|
|
168
|
+
updatePreferences,
|
|
169
|
+
deletePreferences,
|
|
170
|
+
getDefaultPreferences,
|
|
171
|
+
postgresPreferencesStore,
|
|
172
|
+
deepMerge,
|
|
173
|
+
// Tenants plugin (multi-tenant data isolation, depends on Users)
|
|
174
|
+
createTenantsPlugin,
|
|
175
|
+
getTenantStore,
|
|
176
|
+
postgresTenantStore,
|
|
177
|
+
inMemoryTenantStore,
|
|
161
178
|
// Rate Limit plugin
|
|
162
179
|
createRateLimitPlugin,
|
|
163
180
|
createRateLimitPluginFromEnv,
|
|
@@ -276,6 +293,14 @@ export {
|
|
|
276
293
|
getActivityLog,
|
|
277
294
|
postgresParentalStore,
|
|
278
295
|
kidsAdapter,
|
|
296
|
+
// Notifications plugin
|
|
297
|
+
createNotificationsPlugin,
|
|
298
|
+
NotificationsManager,
|
|
299
|
+
getNotificationsManager,
|
|
300
|
+
hasNotificationsManager,
|
|
301
|
+
broadcastToDevice,
|
|
302
|
+
broadcastToUser,
|
|
303
|
+
broadcastToAll,
|
|
279
304
|
// QwickBrain plugin
|
|
280
305
|
createQwickBrainPlugin,
|
|
281
306
|
getConnectionStatus,
|
|
@@ -355,6 +380,26 @@ export type {
|
|
|
355
380
|
UserEntitlement,
|
|
356
381
|
CachedEntitlements,
|
|
357
382
|
EntitlementStats,
|
|
383
|
+
// Preferences plugin types
|
|
384
|
+
PreferencesPluginConfig,
|
|
385
|
+
PreferencesStore,
|
|
386
|
+
UserPreferences,
|
|
387
|
+
PostgresPreferencesStoreConfig,
|
|
388
|
+
PreferencesApiConfig,
|
|
389
|
+
// Tenants plugin types
|
|
390
|
+
TenantsPluginConfig,
|
|
391
|
+
TenantStore,
|
|
392
|
+
TenantType,
|
|
393
|
+
Tenant,
|
|
394
|
+
CreateTenantInput,
|
|
395
|
+
UpdateTenantInput,
|
|
396
|
+
TenantSearchParams,
|
|
397
|
+
TenantListResponse,
|
|
398
|
+
TenantMembership,
|
|
399
|
+
CreateTenantMembershipInput,
|
|
400
|
+
UpdateTenantMembershipInput,
|
|
401
|
+
TenantWithMembership,
|
|
402
|
+
PostgresTenantStoreConfig,
|
|
358
403
|
// Rate Limit plugin types
|
|
359
404
|
RateLimitPluginConfig,
|
|
360
405
|
RateLimitEnvPluginOptions,
|
|
@@ -445,6 +490,14 @@ export type {
|
|
|
445
490
|
ParentalApiConfig,
|
|
446
491
|
PostgresParentalStoreConfig,
|
|
447
492
|
KidsAdapterConfig,
|
|
493
|
+
// Notifications plugin types
|
|
494
|
+
NotificationsPluginConfig,
|
|
495
|
+
SSEClient,
|
|
496
|
+
NotifyPayload,
|
|
497
|
+
SSEEvent,
|
|
498
|
+
NotificationsStats,
|
|
499
|
+
ConnectionHealth,
|
|
500
|
+
NotificationsManagerInterface,
|
|
448
501
|
// QwickBrain plugin types
|
|
449
502
|
QwickBrainPluginConfig,
|
|
450
503
|
MCPToolDefinition,
|
|
@@ -23,22 +23,25 @@ import {
|
|
|
23
23
|
CreateApiKeySchema,
|
|
24
24
|
UpdateApiKeySchema,
|
|
25
25
|
} from './types.js';
|
|
26
|
+
import { hasPostgres, getPostgres } from '../postgres-plugin.js';
|
|
27
|
+
import { postgresApiKeyStore } from './stores/index.js';
|
|
26
28
|
|
|
27
29
|
// Store instance for helper access
|
|
28
30
|
let currentStore: ApiKeyStore | null = null;
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
|
-
* Create the API Keys plugin
|
|
33
|
+
* Create the API Keys plugin with smart defaults
|
|
34
|
+
*
|
|
35
|
+
* Config is optional - plugin will use defaults and get dependencies from registry.
|
|
36
|
+
* Gracefully handles missing dependencies with clear log messages.
|
|
32
37
|
*/
|
|
33
|
-
export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (debug) {
|
|
41
|
-
console.log(`[ApiKeysPlugin] ${message}`, data || '');
|
|
38
|
+
export function createApiKeysPlugin(config: Partial<ApiKeysPluginConfig> = {}): Plugin {
|
|
39
|
+
function log(message: string, data?: Record<string, unknown>, isError = false) {
|
|
40
|
+
const prefix = '[ApiKeysPlugin]';
|
|
41
|
+
if (isError) {
|
|
42
|
+
console.error(`${prefix} ${message}`, data || '');
|
|
43
|
+
} else if (config.debug) {
|
|
44
|
+
console.log(`${prefix} ${message}`, data || '');
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
|
|
@@ -48,15 +51,56 @@ export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
|
48
51
|
version: '1.0.0',
|
|
49
52
|
|
|
50
53
|
async onStart(_pluginConfig: PluginConfig, registry: PluginRegistry): Promise<void> {
|
|
51
|
-
|
|
54
|
+
const logger = registry.getLogger('api-keys');
|
|
52
55
|
|
|
53
56
|
// Check for users plugin dependency
|
|
54
57
|
if (!registry.hasPlugin('users')) {
|
|
55
|
-
|
|
58
|
+
logger.warn('Users plugin not loaded! API Keys plugin disabled.');
|
|
59
|
+
registry.registerHealthCheck({
|
|
60
|
+
name: 'api-keys-store',
|
|
61
|
+
type: 'custom',
|
|
62
|
+
check: async () => ({
|
|
63
|
+
healthy: false,
|
|
64
|
+
details: {
|
|
65
|
+
error: 'Users plugin not available',
|
|
66
|
+
state: 'disabled',
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
56
71
|
}
|
|
57
72
|
|
|
73
|
+
// Check for postgres in registry
|
|
74
|
+
if (!hasPostgres()) {
|
|
75
|
+
logger.warn('No Database! API Keys plugin disabled.');
|
|
76
|
+
registry.registerHealthCheck({
|
|
77
|
+
name: 'api-keys-store',
|
|
78
|
+
type: 'custom',
|
|
79
|
+
check: async () => ({
|
|
80
|
+
healthy: false,
|
|
81
|
+
details: {
|
|
82
|
+
error: 'PostgreSQL not available',
|
|
83
|
+
state: 'disabled',
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Smart defaults - get dependencies from registry
|
|
91
|
+
const store = config.store ?? postgresApiKeyStore({
|
|
92
|
+
pool: () => getPostgres().getPool(),
|
|
93
|
+
autoCreateTables: true,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const debug = config.debug ?? false;
|
|
97
|
+
const apiPrefix = config.api?.prefix ?? '/api-keys';
|
|
98
|
+
const apiEnabled = config.api?.enabled ?? true;
|
|
99
|
+
|
|
100
|
+
log('Starting API keys plugin');
|
|
101
|
+
|
|
58
102
|
// Initialize the store (creates tables and RLS policies if needed)
|
|
59
|
-
await
|
|
103
|
+
await store.initialize();
|
|
60
104
|
log('API keys store initialized');
|
|
61
105
|
|
|
62
106
|
// Initialize optional Phase 2 stores
|
|
@@ -71,7 +115,7 @@ export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
|
71
115
|
}
|
|
72
116
|
|
|
73
117
|
// Store reference for helper access
|
|
74
|
-
currentStore =
|
|
118
|
+
currentStore = store;
|
|
75
119
|
|
|
76
120
|
// Register health check
|
|
77
121
|
registry.registerHealthCheck({
|
|
@@ -117,7 +161,7 @@ export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
|
117
161
|
};
|
|
118
162
|
|
|
119
163
|
// Create the API key
|
|
120
|
-
const apiKey = await
|
|
164
|
+
const apiKey = await store.create(params);
|
|
121
165
|
|
|
122
166
|
// Return the key with plaintext (ONLY time plaintext is accessible)
|
|
123
167
|
res.status(201).json({
|
|
@@ -152,7 +196,7 @@ export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
|
152
196
|
return res.status(401).json({ error: 'Authentication required' });
|
|
153
197
|
}
|
|
154
198
|
|
|
155
|
-
const keys = await
|
|
199
|
+
const keys = await store.list(userId);
|
|
156
200
|
|
|
157
201
|
// Remove sensitive fields from response
|
|
158
202
|
const sanitized = keys.map(key => ({
|
|
@@ -191,7 +235,7 @@ export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
|
191
235
|
}
|
|
192
236
|
|
|
193
237
|
const { id } = req.params;
|
|
194
|
-
const key = await
|
|
238
|
+
const key = await store.get(userId, id);
|
|
195
239
|
|
|
196
240
|
if (!key) {
|
|
197
241
|
return res.status(404).json({ error: 'API key not found' });
|
|
@@ -244,7 +288,7 @@ export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
|
244
288
|
const { id } = req.params;
|
|
245
289
|
const params: UpdateApiKeyParams = validation.data;
|
|
246
290
|
|
|
247
|
-
const updated = await
|
|
291
|
+
const updated = await store.update(userId, id, params);
|
|
248
292
|
|
|
249
293
|
if (!updated) {
|
|
250
294
|
return res.status(404).json({ error: 'API key not found' });
|
|
@@ -287,7 +331,7 @@ export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
|
287
331
|
}
|
|
288
332
|
|
|
289
333
|
const { id } = req.params;
|
|
290
|
-
const deleted = await
|
|
334
|
+
const deleted = await store.delete(userId, id);
|
|
291
335
|
|
|
292
336
|
if (!deleted) {
|
|
293
337
|
return res.status(404).json({ error: 'API key not found' });
|
|
@@ -357,7 +401,7 @@ export function createApiKeysPlugin(config: ApiKeysPluginConfig): Plugin {
|
|
|
357
401
|
const { id: keyId } = req.params;
|
|
358
402
|
|
|
359
403
|
// Verify key belongs to user
|
|
360
|
-
const key = await
|
|
404
|
+
const key = await store.get(userId, keyId);
|
|
361
405
|
if (!key) {
|
|
362
406
|
return res.status(404).json({ error: 'API key not found' });
|
|
363
407
|
}
|
|
@@ -48,8 +48,5 @@ export { postgresApiKeyStore } from './stores/index.js';
|
|
|
48
48
|
// Middleware
|
|
49
49
|
export { bearerTokenAuth } from './middleware/index.js';
|
|
50
50
|
|
|
51
|
-
// UI Components
|
|
52
|
-
export
|
|
53
|
-
export type { ApiKeysStatusWidgetProps } from './ApiKeysStatusWidget.js';
|
|
54
|
-
export { ApiKeysManagementPage } from './ApiKeysManagementPage.js';
|
|
55
|
-
export type { ApiKeysManagementPageProps } from './ApiKeysManagementPage.js';
|
|
51
|
+
// UI Components are exported from main package index (@qwickapps/server)
|
|
52
|
+
// Do NOT export here to avoid loading UI dependencies when importing plugins
|
|
@@ -266,6 +266,36 @@ export function postgresApiKeyStore(config: PostgresApiKeyStoreConfig): ApiKeySt
|
|
|
266
266
|
CREATE INDEX IF NOT EXISTS idx_${tableName}_key_hash ON ${tableFullName}(key_hash);
|
|
267
267
|
`);
|
|
268
268
|
|
|
269
|
+
// Migration: Add user_id column if it doesn't exist (for existing installations)
|
|
270
|
+
await pool.query(`
|
|
271
|
+
DO $$
|
|
272
|
+
DECLARE
|
|
273
|
+
row_count INTEGER;
|
|
274
|
+
BEGIN
|
|
275
|
+
IF NOT EXISTS (
|
|
276
|
+
SELECT 1 FROM information_schema.columns
|
|
277
|
+
WHERE table_schema = '${schema}'
|
|
278
|
+
AND table_name = '${tableName}'
|
|
279
|
+
AND column_name = 'user_id'
|
|
280
|
+
) THEN
|
|
281
|
+
-- Check if table has data
|
|
282
|
+
EXECUTE 'SELECT COUNT(*) FROM ${tableFullName}' INTO row_count;
|
|
283
|
+
|
|
284
|
+
IF row_count > 0 THEN
|
|
285
|
+
-- If table has data, cannot add NOT NULL column
|
|
286
|
+
-- This requires manual migration or data cleanup
|
|
287
|
+
RAISE EXCEPTION 'Cannot add user_id column: table ${tableFullName} contains % rows. Please migrate data or clear the table first.', row_count;
|
|
288
|
+
ELSE
|
|
289
|
+
-- Table is empty, safe to add NOT NULL column
|
|
290
|
+
ALTER TABLE ${tableFullName}
|
|
291
|
+
ADD COLUMN user_id UUID NOT NULL REFERENCES "public"."users"(id) ON DELETE CASCADE;
|
|
292
|
+
|
|
293
|
+
CREATE INDEX IF NOT EXISTS idx_${tableName}_user_id ON ${tableFullName}(user_id);
|
|
294
|
+
END IF;
|
|
295
|
+
END IF;
|
|
296
|
+
END $$;
|
|
297
|
+
`);
|
|
298
|
+
|
|
269
299
|
// Enable RLS if configured
|
|
270
300
|
if (enableRLS) {
|
|
271
301
|
await pool.query(`
|
|
@@ -230,17 +230,23 @@ export interface ApiKeysApiConfig {
|
|
|
230
230
|
|
|
231
231
|
/**
|
|
232
232
|
* API keys plugin configuration
|
|
233
|
+
*
|
|
234
|
+
* All properties are optional - plugin will use smart defaults:
|
|
235
|
+
* - store: Postgres API key store using registry's postgres instance
|
|
236
|
+
* - api.prefix: '/api-keys'
|
|
237
|
+
* - api.enabled: true
|
|
238
|
+
* - debug: false
|
|
233
239
|
*/
|
|
234
240
|
export interface ApiKeysPluginConfig {
|
|
235
|
-
/** API key storage backend */
|
|
236
|
-
store
|
|
241
|
+
/** API key storage backend (default: postgres API key store from registry) */
|
|
242
|
+
store?: ApiKeyStore;
|
|
237
243
|
/** Plugin scope storage backend (optional, for Phase 2) */
|
|
238
244
|
scopeStore?: import('./stores/plugin-scope-store.js').PluginScopeStore;
|
|
239
245
|
/** Usage log storage backend (optional, for Phase 2) */
|
|
240
246
|
usageStore?: import('./stores/usage-log-store.js').UsageLogStore;
|
|
241
247
|
/** API configuration */
|
|
242
248
|
api?: ApiKeysApiConfig;
|
|
243
|
-
/** Enable debug logging */
|
|
249
|
+
/** Enable debug logging (default: false) */
|
|
244
250
|
debug?: boolean;
|
|
245
251
|
}
|
|
246
252
|
|
|
@@ -42,6 +42,7 @@ export function createAuthPlugin(config: AuthPluginConfig): Plugin {
|
|
|
42
42
|
|
|
43
43
|
async onStart(_pluginConfig: PluginConfig, registry: PluginRegistry): Promise<void> {
|
|
44
44
|
const app = registry.getApp();
|
|
45
|
+
const router = registry.getRouter();
|
|
45
46
|
|
|
46
47
|
// Store adapters for helper access
|
|
47
48
|
currentAdapter = config.adapter;
|
|
@@ -72,8 +73,9 @@ export function createAuthPlugin(config: AuthPluginConfig): Plugin {
|
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
// Add the auth checking middleware
|
|
76
|
-
|
|
76
|
+
// Add the auth checking middleware to router (not app)
|
|
77
|
+
// This ensures it processes requests to /api/* routes
|
|
78
|
+
router.use(createAuthMiddleware());
|
|
77
79
|
|
|
78
80
|
// Register auth status route
|
|
79
81
|
registry.addRoute({
|
|
@@ -790,6 +790,7 @@ export function registerAuthConfigRoutes(registry: PluginRegistry): void {
|
|
|
790
790
|
id: 'auth-status',
|
|
791
791
|
title: 'Authentication',
|
|
792
792
|
component: 'AuthStatusWidget',
|
|
793
|
+
type: 'status',
|
|
793
794
|
priority: 40, // Show before integrations
|
|
794
795
|
showByDefault: true,
|
|
795
796
|
pluginId: 'auth',
|
|
@@ -65,8 +65,6 @@ export { basicAdapter } from './adapters/basic-adapter.js';
|
|
|
65
65
|
export { supabaseAdapter } from './adapters/supabase-adapter.js';
|
|
66
66
|
export { supertokensAdapter } from './adapters/supertokens-adapter.js';
|
|
67
67
|
|
|
68
|
-
// UI Components
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
export { AuthManagementPage } from './AuthManagementPage.js';
|
|
72
|
-
export type { AuthManagementPageProps } from './AuthManagementPage.js';
|
|
68
|
+
// UI Components are exported from main package index (@qwickapps/server)
|
|
69
|
+
// Do NOT export here to avoid loading UI dependencies when importing plugins
|
|
70
|
+
|