@qwickapps/server 1.3.1 → 1.5.0
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/README.md +157 -0
- package/dist/core/control-panel.d.ts.map +1 -1
- package/dist/core/control-panel.js +114 -0
- package/dist/core/control-panel.js.map +1 -1
- package/dist/core/types.d.ts +19 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/plugins/auth/adapter-wrapper.d.ts +47 -0
- package/dist/plugins/auth/adapter-wrapper.d.ts.map +1 -0
- package/dist/plugins/auth/adapter-wrapper.js +166 -0
- package/dist/plugins/auth/adapter-wrapper.js.map +1 -0
- package/dist/plugins/auth/adapter-wrapper.test.d.ts +7 -0
- package/dist/plugins/auth/adapter-wrapper.test.d.ts.map +1 -0
- package/dist/plugins/auth/adapter-wrapper.test.js +303 -0
- package/dist/plugins/auth/adapter-wrapper.test.js.map +1 -0
- package/dist/plugins/auth/config-store.d.ts +11 -0
- package/dist/plugins/auth/config-store.d.ts.map +1 -0
- package/dist/plugins/auth/config-store.js +232 -0
- package/dist/plugins/auth/config-store.js.map +1 -0
- package/dist/plugins/auth/config-store.test.d.ts +7 -0
- package/dist/plugins/auth/config-store.test.d.ts.map +1 -0
- package/dist/plugins/auth/config-store.test.js +299 -0
- package/dist/plugins/auth/config-store.test.js.map +1 -0
- package/dist/plugins/auth/env-config.d.ts +51 -1
- package/dist/plugins/auth/env-config.d.ts.map +1 -1
- package/dist/plugins/auth/env-config.js +640 -7
- package/dist/plugins/auth/env-config.js.map +1 -1
- package/dist/plugins/auth/index.d.ts +6 -2
- package/dist/plugins/auth/index.d.ts.map +1 -1
- package/dist/plugins/auth/index.js +5 -1
- package/dist/plugins/auth/index.js.map +1 -1
- package/dist/plugins/auth/types.d.ts +106 -0
- package/dist/plugins/auth/types.d.ts.map +1 -1
- package/dist/plugins/bans/bans-plugin.d.ts.map +1 -1
- package/dist/plugins/bans/bans-plugin.js +12 -3
- package/dist/plugins/bans/bans-plugin.js.map +1 -1
- package/dist/plugins/devices/__tests__/devices-plugin.test.d.ts +11 -0
- package/dist/plugins/devices/__tests__/devices-plugin.test.d.ts.map +1 -0
- package/dist/plugins/devices/__tests__/devices-plugin.test.js +410 -0
- package/dist/plugins/devices/__tests__/devices-plugin.test.js.map +1 -0
- package/dist/plugins/devices/__tests__/token-utils.test.d.ts +7 -0
- package/dist/plugins/devices/__tests__/token-utils.test.d.ts.map +1 -0
- package/dist/plugins/devices/__tests__/token-utils.test.js +197 -0
- package/dist/plugins/devices/__tests__/token-utils.test.js.map +1 -0
- package/dist/plugins/devices/adapters/compute-adapter.d.ts +36 -0
- package/dist/plugins/devices/adapters/compute-adapter.d.ts.map +1 -0
- package/dist/plugins/devices/adapters/compute-adapter.js +100 -0
- package/dist/plugins/devices/adapters/compute-adapter.js.map +1 -0
- package/dist/plugins/devices/adapters/index.d.ts +12 -0
- package/dist/plugins/devices/adapters/index.d.ts.map +1 -0
- package/dist/plugins/devices/adapters/index.js +10 -0
- package/dist/plugins/devices/adapters/index.js.map +1 -0
- package/dist/plugins/devices/adapters/mobile-adapter.d.ts +41 -0
- package/dist/plugins/devices/adapters/mobile-adapter.d.ts.map +1 -0
- package/dist/plugins/devices/adapters/mobile-adapter.js +131 -0
- package/dist/plugins/devices/adapters/mobile-adapter.js.map +1 -0
- package/dist/plugins/devices/devices-plugin.d.ts +70 -0
- package/dist/plugins/devices/devices-plugin.d.ts.map +1 -0
- package/dist/plugins/devices/devices-plugin.js +453 -0
- package/dist/plugins/devices/devices-plugin.js.map +1 -0
- package/dist/plugins/devices/index.d.ts +18 -0
- package/dist/plugins/devices/index.d.ts.map +1 -0
- package/dist/plugins/devices/index.js +18 -0
- package/dist/plugins/devices/index.js.map +1 -0
- package/dist/plugins/devices/stores/index.d.ts +9 -0
- package/dist/plugins/devices/stores/index.d.ts.map +1 -0
- package/dist/plugins/devices/stores/index.js +9 -0
- package/dist/plugins/devices/stores/index.js.map +1 -0
- package/dist/plugins/devices/stores/postgres-store.d.ts +26 -0
- package/dist/plugins/devices/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/devices/stores/postgres-store.js +199 -0
- package/dist/plugins/devices/stores/postgres-store.js.map +1 -0
- package/dist/plugins/devices/token-utils.d.ts +100 -0
- package/dist/plugins/devices/token-utils.d.ts.map +1 -0
- package/dist/plugins/devices/token-utils.js +162 -0
- package/dist/plugins/devices/token-utils.js.map +1 -0
- package/dist/plugins/devices/types.d.ts +307 -0
- package/dist/plugins/devices/types.d.ts.map +1 -0
- package/dist/plugins/devices/types.js +10 -0
- package/dist/plugins/devices/types.js.map +1 -0
- package/dist/plugins/index.d.ts +18 -4
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +16 -2
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/notifications/__tests__/notifications-manager.test.d.ts +5 -0
- package/dist/plugins/notifications/__tests__/notifications-manager.test.d.ts.map +1 -0
- package/dist/plugins/notifications/__tests__/notifications-manager.test.js +470 -0
- package/dist/plugins/notifications/__tests__/notifications-manager.test.js.map +1 -0
- package/dist/plugins/notifications/index.d.ts +71 -0
- package/dist/plugins/notifications/index.d.ts.map +1 -0
- package/dist/plugins/notifications/index.js +72 -0
- package/dist/plugins/notifications/index.js.map +1 -0
- package/dist/plugins/notifications/notifications-manager.d.ts +182 -0
- package/dist/plugins/notifications/notifications-manager.d.ts.map +1 -0
- package/dist/plugins/notifications/notifications-manager.js +610 -0
- package/dist/plugins/notifications/notifications-manager.js.map +1 -0
- package/dist/plugins/notifications/notifications-plugin.d.ts +83 -0
- package/dist/plugins/notifications/notifications-plugin.d.ts.map +1 -0
- package/dist/plugins/notifications/notifications-plugin.js +337 -0
- package/dist/plugins/notifications/notifications-plugin.js.map +1 -0
- package/dist/plugins/notifications/types.d.ts +164 -0
- package/dist/plugins/notifications/types.d.ts.map +1 -0
- package/dist/plugins/notifications/types.js +9 -0
- package/dist/plugins/notifications/types.js.map +1 -0
- package/dist/plugins/parental/__tests__/parental-plugin.test.d.ts +12 -0
- package/dist/plugins/parental/__tests__/parental-plugin.test.d.ts.map +1 -0
- package/dist/plugins/parental/__tests__/parental-plugin.test.js +349 -0
- package/dist/plugins/parental/__tests__/parental-plugin.test.js.map +1 -0
- package/dist/plugins/parental/adapters/index.d.ts +8 -0
- package/dist/plugins/parental/adapters/index.d.ts.map +1 -0
- package/dist/plugins/parental/adapters/index.js +7 -0
- package/dist/plugins/parental/adapters/index.js.map +1 -0
- package/dist/plugins/parental/adapters/kids-adapter.d.ts +24 -0
- package/dist/plugins/parental/adapters/kids-adapter.d.ts.map +1 -0
- package/dist/plugins/parental/adapters/kids-adapter.js +174 -0
- package/dist/plugins/parental/adapters/kids-adapter.js.map +1 -0
- package/dist/plugins/parental/index.d.ts +14 -0
- package/dist/plugins/parental/index.d.ts.map +1 -0
- package/dist/plugins/parental/index.js +15 -0
- package/dist/plugins/parental/index.js.map +1 -0
- package/dist/plugins/parental/parental-plugin.d.ts +88 -0
- package/dist/plugins/parental/parental-plugin.d.ts.map +1 -0
- package/dist/plugins/parental/parental-plugin.js +666 -0
- package/dist/plugins/parental/parental-plugin.js.map +1 -0
- package/dist/plugins/parental/stores/index.d.ts +7 -0
- package/dist/plugins/parental/stores/index.d.ts.map +1 -0
- package/dist/plugins/parental/stores/index.js +7 -0
- package/dist/plugins/parental/stores/index.js.map +1 -0
- package/dist/plugins/parental/stores/postgres-store.d.ts +10 -0
- package/dist/plugins/parental/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/parental/stores/postgres-store.js +209 -0
- package/dist/plugins/parental/stores/postgres-store.js.map +1 -0
- package/dist/plugins/parental/types.d.ts +154 -0
- package/dist/plugins/parental/types.d.ts.map +1 -0
- package/dist/plugins/parental/types.js +10 -0
- package/dist/plugins/parental/types.js.map +1 -0
- package/dist/plugins/profiles/__tests__/profiles-plugin.test.d.ts +11 -0
- package/dist/plugins/profiles/__tests__/profiles-plugin.test.d.ts.map +1 -0
- package/dist/plugins/profiles/__tests__/profiles-plugin.test.js +243 -0
- package/dist/plugins/profiles/__tests__/profiles-plugin.test.js.map +1 -0
- package/dist/plugins/profiles/index.d.ts +12 -0
- package/dist/plugins/profiles/index.d.ts.map +1 -0
- package/dist/plugins/profiles/index.js +13 -0
- package/dist/plugins/profiles/index.js.map +1 -0
- package/dist/plugins/profiles/profiles-plugin.d.ts +71 -0
- package/dist/plugins/profiles/profiles-plugin.d.ts.map +1 -0
- package/dist/plugins/profiles/profiles-plugin.js +481 -0
- package/dist/plugins/profiles/profiles-plugin.js.map +1 -0
- package/dist/plugins/profiles/stores/index.d.ts +9 -0
- package/dist/plugins/profiles/stores/index.d.ts.map +1 -0
- package/dist/plugins/profiles/stores/index.js +9 -0
- package/dist/plugins/profiles/stores/index.js.map +1 -0
- package/dist/plugins/profiles/stores/postgres-store.d.ts +18 -0
- package/dist/plugins/profiles/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/profiles/stores/postgres-store.js +310 -0
- package/dist/plugins/profiles/stores/postgres-store.js.map +1 -0
- package/dist/plugins/profiles/types.d.ts +289 -0
- package/dist/plugins/profiles/types.d.ts.map +1 -0
- package/dist/plugins/profiles/types.js +10 -0
- package/dist/plugins/profiles/types.js.map +1 -0
- package/dist/plugins/rate-limit/__tests__/rate-limit-plugin.test.d.ts +7 -0
- package/dist/plugins/rate-limit/__tests__/rate-limit-plugin.test.d.ts.map +1 -0
- package/dist/plugins/rate-limit/__tests__/rate-limit-plugin.test.js +220 -0
- package/dist/plugins/rate-limit/__tests__/rate-limit-plugin.test.js.map +1 -0
- package/dist/plugins/rate-limit/cleanup.d.ts +40 -0
- package/dist/plugins/rate-limit/cleanup.d.ts.map +1 -0
- package/dist/plugins/rate-limit/cleanup.js +72 -0
- package/dist/plugins/rate-limit/cleanup.js.map +1 -0
- package/dist/plugins/rate-limit/env-config.d.ts +91 -0
- package/dist/plugins/rate-limit/env-config.d.ts.map +1 -0
- package/dist/plugins/rate-limit/env-config.js +318 -0
- package/dist/plugins/rate-limit/env-config.js.map +1 -0
- package/dist/plugins/rate-limit/index.d.ts +76 -0
- package/dist/plugins/rate-limit/index.d.ts.map +1 -0
- package/dist/plugins/rate-limit/index.js +79 -0
- package/dist/plugins/rate-limit/index.js.map +1 -0
- package/dist/plugins/rate-limit/middleware.d.ts +40 -0
- package/dist/plugins/rate-limit/middleware.d.ts.map +1 -0
- package/dist/plugins/rate-limit/middleware.js +169 -0
- package/dist/plugins/rate-limit/middleware.js.map +1 -0
- package/dist/plugins/rate-limit/rate-limit-plugin.d.ts +44 -0
- package/dist/plugins/rate-limit/rate-limit-plugin.d.ts.map +1 -0
- package/dist/plugins/rate-limit/rate-limit-plugin.js +354 -0
- package/dist/plugins/rate-limit/rate-limit-plugin.js.map +1 -0
- package/dist/plugins/rate-limit/rate-limit-service.d.ts +110 -0
- package/dist/plugins/rate-limit/rate-limit-service.d.ts.map +1 -0
- package/dist/plugins/rate-limit/rate-limit-service.js +172 -0
- package/dist/plugins/rate-limit/rate-limit-service.js.map +1 -0
- package/dist/plugins/rate-limit/stores/cache-store.d.ts +33 -0
- package/dist/plugins/rate-limit/stores/cache-store.d.ts.map +1 -0
- package/dist/plugins/rate-limit/stores/cache-store.js +225 -0
- package/dist/plugins/rate-limit/stores/cache-store.js.map +1 -0
- package/dist/plugins/rate-limit/stores/index.d.ts +8 -0
- package/dist/plugins/rate-limit/stores/index.d.ts.map +1 -0
- package/dist/plugins/rate-limit/stores/index.js +8 -0
- package/dist/plugins/rate-limit/stores/index.js.map +1 -0
- package/dist/plugins/rate-limit/stores/postgres-store.d.ts +34 -0
- package/dist/plugins/rate-limit/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/rate-limit/stores/postgres-store.js +320 -0
- package/dist/plugins/rate-limit/stores/postgres-store.js.map +1 -0
- package/dist/plugins/rate-limit/strategies/fixed-window.d.ts +21 -0
- package/dist/plugins/rate-limit/strategies/fixed-window.d.ts.map +1 -0
- package/dist/plugins/rate-limit/strategies/fixed-window.js +97 -0
- package/dist/plugins/rate-limit/strategies/fixed-window.js.map +1 -0
- package/dist/plugins/rate-limit/strategies/index.d.ts +14 -0
- package/dist/plugins/rate-limit/strategies/index.d.ts.map +1 -0
- package/dist/plugins/rate-limit/strategies/index.js +27 -0
- package/dist/plugins/rate-limit/strategies/index.js.map +1 -0
- package/dist/plugins/rate-limit/strategies/sliding-window.d.ts +22 -0
- package/dist/plugins/rate-limit/strategies/sliding-window.d.ts.map +1 -0
- package/dist/plugins/rate-limit/strategies/sliding-window.js +122 -0
- package/dist/plugins/rate-limit/strategies/sliding-window.js.map +1 -0
- package/dist/plugins/rate-limit/strategies/token-bucket.d.ts +28 -0
- package/dist/plugins/rate-limit/strategies/token-bucket.d.ts.map +1 -0
- package/dist/plugins/rate-limit/strategies/token-bucket.js +121 -0
- package/dist/plugins/rate-limit/strategies/token-bucket.js.map +1 -0
- package/dist/plugins/rate-limit/types.d.ts +265 -0
- package/dist/plugins/rate-limit/types.d.ts.map +1 -0
- package/dist/plugins/rate-limit/types.js +9 -0
- package/dist/plugins/rate-limit/types.js.map +1 -0
- package/dist/plugins/subscriptions/__tests__/subscriptions-plugin.test.d.ts +11 -0
- package/dist/plugins/subscriptions/__tests__/subscriptions-plugin.test.d.ts.map +1 -0
- package/dist/plugins/subscriptions/__tests__/subscriptions-plugin.test.js +305 -0
- package/dist/plugins/subscriptions/__tests__/subscriptions-plugin.test.js.map +1 -0
- package/dist/plugins/subscriptions/index.d.ts +12 -0
- package/dist/plugins/subscriptions/index.d.ts.map +1 -0
- package/dist/plugins/subscriptions/index.js +13 -0
- package/dist/plugins/subscriptions/index.js.map +1 -0
- package/dist/plugins/subscriptions/stores/index.d.ts +9 -0
- package/dist/plugins/subscriptions/stores/index.d.ts.map +1 -0
- package/dist/plugins/subscriptions/stores/index.js +9 -0
- package/dist/plugins/subscriptions/stores/index.js.map +1 -0
- package/dist/plugins/subscriptions/stores/postgres-store.d.ts +14 -0
- package/dist/plugins/subscriptions/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/subscriptions/stores/postgres-store.js +359 -0
- package/dist/plugins/subscriptions/stores/postgres-store.js.map +1 -0
- package/dist/plugins/subscriptions/subscriptions-plugin.d.ts +82 -0
- package/dist/plugins/subscriptions/subscriptions-plugin.d.ts.map +1 -0
- package/dist/plugins/subscriptions/subscriptions-plugin.js +449 -0
- package/dist/plugins/subscriptions/subscriptions-plugin.js.map +1 -0
- package/dist/plugins/subscriptions/types.d.ts +308 -0
- package/dist/plugins/subscriptions/types.d.ts.map +1 -0
- package/dist/plugins/subscriptions/types.js +10 -0
- package/dist/plugins/subscriptions/types.js.map +1 -0
- package/dist/plugins/usage/__tests__/usage-plugin.test.d.ts +11 -0
- package/dist/plugins/usage/__tests__/usage-plugin.test.d.ts.map +1 -0
- package/dist/plugins/usage/__tests__/usage-plugin.test.js +218 -0
- package/dist/plugins/usage/__tests__/usage-plugin.test.js.map +1 -0
- package/dist/plugins/usage/index.d.ts +12 -0
- package/dist/plugins/usage/index.d.ts.map +1 -0
- package/dist/plugins/usage/index.js +13 -0
- package/dist/plugins/usage/index.js.map +1 -0
- package/dist/plugins/usage/stores/index.d.ts +9 -0
- package/dist/plugins/usage/stores/index.d.ts.map +1 -0
- package/dist/plugins/usage/stores/index.js +9 -0
- package/dist/plugins/usage/stores/index.js.map +1 -0
- package/dist/plugins/usage/stores/postgres-store.d.ts +14 -0
- package/dist/plugins/usage/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/usage/stores/postgres-store.js +146 -0
- package/dist/plugins/usage/stores/postgres-store.js.map +1 -0
- package/dist/plugins/usage/types.d.ts +195 -0
- package/dist/plugins/usage/types.d.ts.map +1 -0
- package/dist/plugins/usage/types.js +10 -0
- package/dist/plugins/usage/types.js.map +1 -0
- package/dist/plugins/usage/usage-plugin.d.ts +51 -0
- package/dist/plugins/usage/usage-plugin.d.ts.map +1 -0
- package/dist/plugins/usage/usage-plugin.js +412 -0
- package/dist/plugins/usage/usage-plugin.js.map +1 -0
- package/dist/plugins/users/__tests__/postgres-store.test.d.ts +10 -0
- package/dist/plugins/users/__tests__/postgres-store.test.d.ts.map +1 -0
- package/dist/plugins/users/__tests__/postgres-store.test.js +229 -0
- package/dist/plugins/users/__tests__/postgres-store.test.js.map +1 -0
- package/dist/plugins/users/__tests__/users-plugin.test.js +3 -0
- package/dist/plugins/users/__tests__/users-plugin.test.js.map +1 -1
- package/dist/plugins/users/index.d.ts +2 -2
- package/dist/plugins/users/index.d.ts.map +1 -1
- package/dist/plugins/users/index.js +1 -1
- package/dist/plugins/users/index.js.map +1 -1
- package/dist/plugins/users/stores/postgres-store.d.ts.map +1 -1
- package/dist/plugins/users/stores/postgres-store.js +76 -0
- package/dist/plugins/users/stores/postgres-store.js.map +1 -1
- package/dist/plugins/users/types.d.ts +74 -6
- package/dist/plugins/users/types.d.ts.map +1 -1
- package/dist/plugins/users/users-plugin.d.ts +15 -1
- package/dist/plugins/users/users-plugin.d.ts.map +1 -1
- package/dist/plugins/users/users-plugin.js +29 -0
- package/dist/plugins/users/users-plugin.js.map +1 -1
- package/dist-ui/assets/index-CynOqPkb.js +469 -0
- package/dist-ui/assets/{index-BY8OxNgO.js.map → index-CynOqPkb.js.map} +1 -1
- package/dist-ui/index.html +1 -1
- package/dist-ui-lib/api/controlPanelApi.d.ts +187 -0
- package/dist-ui-lib/components/StatCard.d.ts +16 -0
- package/dist-ui-lib/dashboard/widgets/AuthStatusWidget.d.ts +9 -0
- package/dist-ui-lib/dashboard/widgets/IntegrationStatusWidget.d.ts +9 -0
- package/dist-ui-lib/dashboard/widgets/NotificationsStatsWidget.d.ts +12 -0
- package/dist-ui-lib/dashboard/widgets/index.d.ts +3 -0
- package/dist-ui-lib/index.js +3579 -2379
- package/dist-ui-lib/index.js.map +1 -1
- package/dist-ui-lib/pages/IntegrationsPage.d.ts +1 -0
- package/dist-ui-lib/pages/NotificationsPage.d.ts +9 -0
- package/dist-ui-lib/pages/RateLimitPage.d.ts +1 -0
- package/dist-ui-lib/utils/formatters.d.ts +19 -0
- package/package.json +1 -1
- package/src/core/control-panel.ts +128 -0
- package/src/core/types.ts +17 -0
- package/src/index.ts +216 -0
- package/src/plugins/auth/adapter-wrapper.test.ts +395 -0
- package/src/plugins/auth/adapter-wrapper.ts +205 -0
- package/src/plugins/auth/config-store.test.ts +417 -0
- package/src/plugins/auth/config-store.ts +305 -0
- package/src/plugins/auth/env-config.ts +714 -7
- package/src/plugins/auth/index.ts +22 -1
- package/src/plugins/auth/types.ts +138 -0
- package/src/plugins/bans/bans-plugin.ts +15 -3
- package/src/plugins/devices/__tests__/devices-plugin.test.ts +551 -0
- package/src/plugins/devices/__tests__/token-utils.test.ts +264 -0
- package/src/plugins/devices/adapters/compute-adapter.ts +139 -0
- package/src/plugins/devices/adapters/index.ts +13 -0
- package/src/plugins/devices/adapters/mobile-adapter.ts +179 -0
- package/src/plugins/devices/devices-plugin.ts +538 -0
- package/src/plugins/devices/index.ts +69 -0
- package/src/plugins/devices/stores/index.ts +9 -0
- package/src/plugins/devices/stores/postgres-store.ts +304 -0
- package/src/plugins/devices/token-utils.ts +213 -0
- package/src/plugins/devices/types.ts +351 -0
- package/src/plugins/index.ts +267 -0
- package/src/plugins/notifications/__tests__/notifications-manager.test.ts +637 -0
- package/src/plugins/notifications/index.ts +91 -0
- package/src/plugins/notifications/notifications-manager.ts +773 -0
- package/src/plugins/notifications/notifications-plugin.ts +398 -0
- package/src/plugins/notifications/types.ts +207 -0
- package/src/plugins/parental/__tests__/parental-plugin.test.ts +465 -0
- package/src/plugins/parental/adapters/index.ts +8 -0
- package/src/plugins/parental/adapters/kids-adapter.ts +206 -0
- package/src/plugins/parental/index.ts +55 -0
- package/src/plugins/parental/parental-plugin.ts +759 -0
- package/src/plugins/parental/stores/index.ts +7 -0
- package/src/plugins/parental/stores/postgres-store.ts +304 -0
- package/src/plugins/parental/types.ts +180 -0
- package/src/plugins/profiles/__tests__/profiles-plugin.test.ts +321 -0
- package/src/plugins/profiles/index.ts +49 -0
- package/src/plugins/profiles/profiles-plugin.ts +546 -0
- package/src/plugins/profiles/stores/index.ts +9 -0
- package/src/plugins/profiles/stores/postgres-store.ts +439 -0
- package/src/plugins/profiles/types.ts +338 -0
- package/src/plugins/rate-limit/__tests__/rate-limit-plugin.test.ts +259 -0
- package/src/plugins/rate-limit/cleanup.ts +117 -0
- package/src/plugins/rate-limit/env-config.ts +400 -0
- package/src/plugins/rate-limit/index.ts +128 -0
- package/src/plugins/rate-limit/middleware.ts +212 -0
- package/src/plugins/rate-limit/rate-limit-plugin.ts +400 -0
- package/src/plugins/rate-limit/rate-limit-service.ts +228 -0
- package/src/plugins/rate-limit/stores/cache-store.ts +261 -0
- package/src/plugins/rate-limit/stores/index.ts +8 -0
- package/src/plugins/rate-limit/stores/postgres-store.ts +402 -0
- package/src/plugins/rate-limit/strategies/fixed-window.ts +116 -0
- package/src/plugins/rate-limit/strategies/index.ts +30 -0
- package/src/plugins/rate-limit/strategies/sliding-window.ts +157 -0
- package/src/plugins/rate-limit/strategies/token-bucket.ts +154 -0
- package/src/plugins/rate-limit/types.ts +338 -0
- package/src/plugins/subscriptions/__tests__/subscriptions-plugin.test.ts +404 -0
- package/src/plugins/subscriptions/index.ts +51 -0
- package/src/plugins/subscriptions/stores/index.ts +9 -0
- package/src/plugins/subscriptions/stores/postgres-store.ts +482 -0
- package/src/plugins/subscriptions/subscriptions-plugin.ts +530 -0
- package/src/plugins/subscriptions/types.ts +355 -0
- package/src/plugins/usage/__tests__/usage-plugin.test.ts +288 -0
- package/src/plugins/usage/index.ts +39 -0
- package/src/plugins/usage/stores/index.ts +9 -0
- package/src/plugins/usage/stores/postgres-store.ts +213 -0
- package/src/plugins/usage/types.ts +222 -0
- package/src/plugins/usage/usage-plugin.ts +484 -0
- package/src/plugins/users/__tests__/postgres-store.test.ts +326 -0
- package/src/plugins/users/__tests__/users-plugin.test.ts +3 -0
- package/src/plugins/users/index.ts +6 -0
- package/src/plugins/users/stores/postgres-store.ts +104 -0
- package/src/plugins/users/types.ts +82 -6
- package/src/plugins/users/users-plugin.ts +37 -0
- package/ui/src/App.tsx +36 -14
- package/ui/src/api/controlPanelApi.ts +329 -6
- package/ui/src/components/StatCard.tsx +58 -0
- package/ui/src/dashboard/builtInWidgets.tsx +7 -1
- package/ui/src/dashboard/widgets/AuthStatusWidget.tsx +143 -0
- package/ui/src/dashboard/widgets/IntegrationStatusWidget.tsx +135 -0
- package/ui/src/dashboard/widgets/NotificationsStatsWidget.tsx +167 -0
- package/ui/src/dashboard/widgets/index.ts +3 -0
- package/ui/src/pages/AuthPage.tsx +986 -142
- package/ui/src/pages/IntegrationsPage.tsx +288 -0
- package/ui/src/pages/NotificationsPage.tsx +417 -0
- package/ui/src/pages/RateLimitPage.tsx +292 -0
- package/ui/src/utils/formatters.ts +33 -0
- package/dist-ui/assets/index-BY8OxNgO.js +0 -465
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sliding-window.js","sourceRoot":"","sources":["../../../../src/plugins/rate-limit/strategies/sliding-window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAUH;;GAEG;AACH,SAAS,qBAAqB,CAC5B,YAAoB,EACpB,aAAqB,EACrB,QAAgB,EAChB,WAAmB;IAEnB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,GAAG,WAAW,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,QAAQ,CAAC;IAE3D,4EAA4E;IAC5E,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,IAAI,EAAE,gBAAgB;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AAM;oBACN,QAAQ;oBACR,SAAS;oBACT,MAAM,EAAE,CAAC;iBACV,CAAC,CAAC;gBAEH,mCAAmC;gBACnC,MAAM,SAAS,GAAgB;oBAC7B,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,WAAW;oBACX,WAAW;oBACX,SAAS;oBACT,QAAQ,EAAE,gBAAgB;iBAC3B,CAAC;gBACF,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAE1C,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,OAAO,CAAC,KAAK;oBACtB,KAAK,EAAE,WAAW;oBAClB,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;oBACnD,OAAO;oBACP,UAAU;iBACX,CAAC;YACJ,CAAC;YAED,qCAAqC;YACrC,OAAO;gBACL,OAAO;gBACP,OAAO,EAAE,YAAY;gBACrB,KAAK,EAAE,WAAW;gBAClB,SAAS;gBACT,OAAO;gBACP,UAAU;aACX,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Bucket Rate Limit Strategy
|
|
3
|
+
*
|
|
4
|
+
* Implements a token bucket algorithm that allows bursts while maintaining
|
|
5
|
+
* a long-term rate limit.
|
|
6
|
+
*
|
|
7
|
+
* How it works:
|
|
8
|
+
* - Bucket starts full with `maxRequests` tokens
|
|
9
|
+
* - Each request consumes 1 token
|
|
10
|
+
* - Tokens refill at a constant rate (maxRequests / windowMs)
|
|
11
|
+
* - If no tokens available, request is rate limited
|
|
12
|
+
*
|
|
13
|
+
* Pros:
|
|
14
|
+
* - Allows short bursts of traffic
|
|
15
|
+
* - Smooth long-term rate limiting
|
|
16
|
+
*
|
|
17
|
+
* Cons:
|
|
18
|
+
* - More complex state management
|
|
19
|
+
* - Can allow more requests than fixed/sliding in short bursts
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
22
|
+
*/
|
|
23
|
+
import type { Strategy } from '../types.js';
|
|
24
|
+
/**
|
|
25
|
+
* Create the token bucket strategy
|
|
26
|
+
*/
|
|
27
|
+
export declare function createTokenBucketStrategy(): Strategy;
|
|
28
|
+
//# sourceMappingURL=token-bucket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-bucket.d.ts","sourceRoot":"","sources":["../../../../src/plugins/rate-limit/strategies/token-bucket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EACV,QAAQ,EAKT,MAAM,aAAa,CAAC;AAoBrB;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,QAAQ,CAqGpD"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Bucket Rate Limit Strategy
|
|
3
|
+
*
|
|
4
|
+
* Implements a token bucket algorithm that allows bursts while maintaining
|
|
5
|
+
* a long-term rate limit.
|
|
6
|
+
*
|
|
7
|
+
* How it works:
|
|
8
|
+
* - Bucket starts full with `maxRequests` tokens
|
|
9
|
+
* - Each request consumes 1 token
|
|
10
|
+
* - Tokens refill at a constant rate (maxRequests / windowMs)
|
|
11
|
+
* - If no tokens available, request is rate limited
|
|
12
|
+
*
|
|
13
|
+
* Pros:
|
|
14
|
+
* - Allows short bursts of traffic
|
|
15
|
+
* - Smooth long-term rate limiting
|
|
16
|
+
*
|
|
17
|
+
* Cons:
|
|
18
|
+
* - More complex state management
|
|
19
|
+
* - Can allow more requests than fixed/sliding in short bursts
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Calculate tokens to refill based on time elapsed
|
|
25
|
+
*/
|
|
26
|
+
function calculateRefill(lastRefill, maxTokens, refillRatePerMs) {
|
|
27
|
+
const now = Date.now();
|
|
28
|
+
const elapsed = now - lastRefill;
|
|
29
|
+
const tokensToAdd = elapsed * refillRatePerMs;
|
|
30
|
+
return {
|
|
31
|
+
tokens: Math.min(maxTokens, tokensToAdd),
|
|
32
|
+
newLastRefill: now,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create the token bucket strategy
|
|
37
|
+
*/
|
|
38
|
+
export function createTokenBucketStrategy() {
|
|
39
|
+
return {
|
|
40
|
+
name: 'token-bucket',
|
|
41
|
+
async check(key, options, context) {
|
|
42
|
+
const { maxRequests, windowMs, increment = true } = options;
|
|
43
|
+
const { store, cache, userId, tenantId, ipAddress } = context;
|
|
44
|
+
const now = Date.now();
|
|
45
|
+
// Refill rate: how many tokens per millisecond
|
|
46
|
+
const refillRatePerMs = maxRequests / windowMs;
|
|
47
|
+
// Try cache first
|
|
48
|
+
let cached = await cache.get(key);
|
|
49
|
+
let tokensRemaining = maxRequests; // Start with full bucket
|
|
50
|
+
let lastRefill = now;
|
|
51
|
+
if (cached && cached.tokensRemaining !== undefined && cached.lastRefill !== undefined) {
|
|
52
|
+
// Cache hit - calculate current tokens with refill
|
|
53
|
+
const refill = calculateRefill(cached.lastRefill, maxRequests, refillRatePerMs);
|
|
54
|
+
tokensRemaining = Math.min(maxRequests, (cached.tokensRemaining || 0) + refill.tokens);
|
|
55
|
+
lastRefill = refill.newLastRefill;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Cache miss - check store
|
|
59
|
+
const stored = await store.get(key, userId);
|
|
60
|
+
if (stored && stored.tokensRemaining !== undefined && stored.lastRefill) {
|
|
61
|
+
const refill = calculateRefill(stored.lastRefill.getTime(), maxRequests, refillRatePerMs);
|
|
62
|
+
tokensRemaining = Math.min(maxRequests, (stored.tokensRemaining || 0) + refill.tokens);
|
|
63
|
+
lastRefill = refill.newLastRefill;
|
|
64
|
+
}
|
|
65
|
+
// If no stored data, start with full bucket
|
|
66
|
+
}
|
|
67
|
+
// Check if limited (less than 1 full token)
|
|
68
|
+
const limited = tokensRemaining < 1;
|
|
69
|
+
// Calculate when next token will be available
|
|
70
|
+
const timeUntilNextToken = limited ? Math.ceil((1 - tokensRemaining) / refillRatePerMs) : 0;
|
|
71
|
+
const resetAt = Math.ceil((now + timeUntilNextToken) / 1000);
|
|
72
|
+
const retryAfter = Math.max(0, Math.ceil(timeUntilNextToken / 1000));
|
|
73
|
+
// Calculate remaining (floor to show integer tokens)
|
|
74
|
+
const remaining = Math.max(0, Math.floor(tokensRemaining) - (increment && !limited ? 1 : 0));
|
|
75
|
+
// Consume token if requested and not limited
|
|
76
|
+
if (increment && !limited) {
|
|
77
|
+
const newTokens = tokensRemaining - 1;
|
|
78
|
+
// Update store with new token count
|
|
79
|
+
// We use a special increment that sets tokens instead of incrementing count
|
|
80
|
+
const updated = await store.increment(key, {
|
|
81
|
+
maxRequests,
|
|
82
|
+
windowMs,
|
|
83
|
+
strategy: 'token-bucket',
|
|
84
|
+
userId,
|
|
85
|
+
tenantId,
|
|
86
|
+
ipAddress,
|
|
87
|
+
amount: -1, // Signal to set tokens, not increment count
|
|
88
|
+
});
|
|
89
|
+
// Update cache
|
|
90
|
+
const newCached = {
|
|
91
|
+
count: Math.floor(maxRequests - newTokens), // Count as consumed tokens
|
|
92
|
+
maxRequests,
|
|
93
|
+
windowStart: now,
|
|
94
|
+
windowEnd: now + windowMs,
|
|
95
|
+
strategy: 'token-bucket',
|
|
96
|
+
tokensRemaining: newTokens,
|
|
97
|
+
lastRefill,
|
|
98
|
+
};
|
|
99
|
+
await cache.set(key, newCached, windowMs);
|
|
100
|
+
return {
|
|
101
|
+
limited: false,
|
|
102
|
+
current: Math.floor(maxRequests - newTokens),
|
|
103
|
+
limit: maxRequests,
|
|
104
|
+
remaining: Math.floor(newTokens),
|
|
105
|
+
resetAt,
|
|
106
|
+
retryAfter: 0,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// Return status without consuming
|
|
110
|
+
return {
|
|
111
|
+
limited,
|
|
112
|
+
current: Math.floor(maxRequests - tokensRemaining),
|
|
113
|
+
limit: maxRequests,
|
|
114
|
+
remaining,
|
|
115
|
+
resetAt,
|
|
116
|
+
retryAfter,
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=token-bucket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-bucket.js","sourceRoot":"","sources":["../../../../src/plugins/rate-limit/strategies/token-bucket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAUH;;GAEG;AACH,SAAS,eAAe,CACtB,UAAkB,EAClB,SAAiB,EACjB,eAAuB;IAEvB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,GAAG,UAAU,CAAC;IACjC,MAAM,WAAW,GAAG,OAAO,GAAG,eAAe,CAAC;IAE9C,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC;QACxC,aAAa,EAAE,GAAG;KACnB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,IAAI,EAAE,cAAc;QAEpB,KAAK,CAAC,KAAK,CACT,GAAW,EACX,OAAwB,EACxB,OAAwB;YAExB,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;YAC5D,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;YAE9D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACvB,+CAA+C;YAC/C,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,CAAC;YAE/C,kBAAkB;YAClB,IA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,QAAQ,CAAC,CAAC;gBAE1C,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC;oBAC5C,KAAK,EAAE,WAAW;oBAClB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;oBAChC,OAAO;oBACP,UAAU,EAAE,CAAC;iBACd,CAAC;YACJ,CAAC;YAED,kCAAkC;YAClC,OAAO;gBACL,OAAO;gBACP,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC;gBAClD,KAAK,EAAE,WAAW;gBAClB,SAAS;gBACT,OAAO;gBACP,UAAU;aACX,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate Limit Plugin Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the rate limiting plugin.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
import type { Request, Response, NextFunction } from 'express';
|
|
9
|
+
export type RateLimitStrategy = 'sliding-window' | 'fixed-window' | 'token-bucket';
|
|
10
|
+
/**
|
|
11
|
+
* Result from a rate limit check
|
|
12
|
+
*/
|
|
13
|
+
export interface LimitStatus {
|
|
14
|
+
/** Whether the limit has been exceeded */
|
|
15
|
+
limited: boolean;
|
|
16
|
+
/** Current request count in window */
|
|
17
|
+
current: number;
|
|
18
|
+
/** Maximum requests allowed */
|
|
19
|
+
limit: number;
|
|
20
|
+
/** Remaining requests in window */
|
|
21
|
+
remaining: number;
|
|
22
|
+
/** When the current window resets (Unix timestamp in seconds) */
|
|
23
|
+
resetAt: number;
|
|
24
|
+
/** Seconds until reset (for Retry-After header) */
|
|
25
|
+
retryAfter: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Strategy interface - all strategies must implement this
|
|
29
|
+
*/
|
|
30
|
+
export interface Strategy {
|
|
31
|
+
name: RateLimitStrategy;
|
|
32
|
+
/**
|
|
33
|
+
* Check if the key is rate limited and optionally increment counter
|
|
34
|
+
*/
|
|
35
|
+
check(key: string, options: StrategyOptions, context: StrategyContext): Promise<LimitStatus>;
|
|
36
|
+
}
|
|
37
|
+
export interface StrategyOptions {
|
|
38
|
+
maxRequests: number;
|
|
39
|
+
windowMs: number;
|
|
40
|
+
/** Whether to increment the counter (default: true) */
|
|
41
|
+
increment?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface StrategyContext {
|
|
44
|
+
store: RateLimitStore;
|
|
45
|
+
cache: RateLimitCache;
|
|
46
|
+
userId?: string;
|
|
47
|
+
tenantId?: string;
|
|
48
|
+
ipAddress?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Stored rate limit record
|
|
52
|
+
*/
|
|
53
|
+
export interface StoredLimit {
|
|
54
|
+
id: string;
|
|
55
|
+
key: string;
|
|
56
|
+
count: number;
|
|
57
|
+
maxRequests: number;
|
|
58
|
+
windowMs: number;
|
|
59
|
+
windowStart: Date;
|
|
60
|
+
windowEnd: Date;
|
|
61
|
+
strategy: RateLimitStrategy;
|
|
62
|
+
userId?: string;
|
|
63
|
+
tenantId?: string;
|
|
64
|
+
ipAddress?: string;
|
|
65
|
+
/** Token bucket: remaining tokens */
|
|
66
|
+
tokensRemaining?: number;
|
|
67
|
+
/** Token bucket: last refill time */
|
|
68
|
+
lastRefill?: Date;
|
|
69
|
+
createdAt: Date;
|
|
70
|
+
updatedAt: Date;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Options for incrementing a rate limit
|
|
74
|
+
*/
|
|
75
|
+
export interface IncrementOptions {
|
|
76
|
+
maxRequests: number;
|
|
77
|
+
windowMs: number;
|
|
78
|
+
strategy: RateLimitStrategy;
|
|
79
|
+
userId?: string;
|
|
80
|
+
tenantId?: string;
|
|
81
|
+
ipAddress?: string;
|
|
82
|
+
/** Amount to increment by (default: 1) */
|
|
83
|
+
amount?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Rate limit store interface - implementations handle persistence
|
|
87
|
+
*/
|
|
88
|
+
export interface RateLimitStore {
|
|
89
|
+
/** Store name for logging */
|
|
90
|
+
name: string;
|
|
91
|
+
/** Initialize store (create tables, indexes, RLS) */
|
|
92
|
+
initialize(): Promise<void>;
|
|
93
|
+
/** Get current limit status for a key */
|
|
94
|
+
get(key: string, userId?: string): Promise<StoredLimit | null>;
|
|
95
|
+
/** Increment counter for a key, returns updated record */
|
|
96
|
+
increment(key: string, options: IncrementOptions): Promise<StoredLimit>;
|
|
97
|
+
/** Clear a specific limit */
|
|
98
|
+
clear(key: string, userId?: string): Promise<boolean>;
|
|
99
|
+
/** Clean up expired limits, returns count of deleted records */
|
|
100
|
+
cleanup(): Promise<number>;
|
|
101
|
+
/** Shutdown store */
|
|
102
|
+
shutdown(): Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* PostgreSQL store configuration
|
|
106
|
+
*/
|
|
107
|
+
export interface PostgresRateLimitStoreConfig {
|
|
108
|
+
/**
|
|
109
|
+
* PostgreSQL pool instance or function that returns one.
|
|
110
|
+
* Use a function for lazy initialization.
|
|
111
|
+
*/
|
|
112
|
+
pool: unknown | (() => unknown);
|
|
113
|
+
/** Table name (default: 'rate_limits') */
|
|
114
|
+
tableName?: string;
|
|
115
|
+
/** Schema name (default: 'public') */
|
|
116
|
+
schema?: string;
|
|
117
|
+
/** Auto-create tables on initialize (default: true) */
|
|
118
|
+
autoCreateTables?: boolean;
|
|
119
|
+
/** Enable RLS policies (default: true) */
|
|
120
|
+
enableRLS?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Cached rate limit entry
|
|
124
|
+
*/
|
|
125
|
+
export interface CachedLimit {
|
|
126
|
+
count: number;
|
|
127
|
+
maxRequests: number;
|
|
128
|
+
windowStart: number;
|
|
129
|
+
windowEnd: number;
|
|
130
|
+
strategy: RateLimitStrategy;
|
|
131
|
+
/** Token bucket specific */
|
|
132
|
+
tokensRemaining?: number;
|
|
133
|
+
lastRefill?: number;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Rate limit cache interface
|
|
137
|
+
*/
|
|
138
|
+
export interface RateLimitCache {
|
|
139
|
+
/** Cache name for logging */
|
|
140
|
+
name: string;
|
|
141
|
+
/** Get cached limit for a key */
|
|
142
|
+
get(key: string): Promise<CachedLimit | null>;
|
|
143
|
+
/** Set cached limit with TTL */
|
|
144
|
+
set(key: string, value: CachedLimit, ttlMs: number): Promise<void>;
|
|
145
|
+
/** Atomic increment of count, returns new count */
|
|
146
|
+
increment(key: string, amount?: number): Promise<number | null>;
|
|
147
|
+
/** Delete a cached entry */
|
|
148
|
+
delete(key: string): Promise<boolean>;
|
|
149
|
+
/** Check if cache is available */
|
|
150
|
+
isAvailable(): boolean;
|
|
151
|
+
/** Shutdown cache */
|
|
152
|
+
shutdown(): Promise<void>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Cache store configuration
|
|
156
|
+
*/
|
|
157
|
+
export interface RateLimitCacheConfig {
|
|
158
|
+
/**
|
|
159
|
+
* Cache type:
|
|
160
|
+
* - 'redis': Use Redis via cache plugin
|
|
161
|
+
* - 'memory': Use in-memory cache
|
|
162
|
+
* - 'auto': Use Redis if available, fall back to memory
|
|
163
|
+
*/
|
|
164
|
+
type?: 'redis' | 'memory' | 'auto';
|
|
165
|
+
/** Redis cache instance name (default: 'default') */
|
|
166
|
+
redisInstance?: string;
|
|
167
|
+
/** Default TTL in milliseconds (default: 60000) */
|
|
168
|
+
defaultTtlMs?: number;
|
|
169
|
+
/** Max in-memory entries (default: 10000) */
|
|
170
|
+
maxMemoryEntries?: number;
|
|
171
|
+
/** Key prefix for cache entries (default: 'ratelimit:') */
|
|
172
|
+
keyPrefix?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Express middleware options
|
|
176
|
+
*/
|
|
177
|
+
export interface RateLimitMiddlewareOptions {
|
|
178
|
+
/** Time window in milliseconds (default: 60000 = 1 min) */
|
|
179
|
+
windowMs?: number;
|
|
180
|
+
/** Max requests per window (static or dynamic) */
|
|
181
|
+
max?: number | ((req: Request) => number | Promise<number>);
|
|
182
|
+
/** Generate the rate limit key from request */
|
|
183
|
+
keyGenerator?: (req: Request) => string | Promise<string>;
|
|
184
|
+
/** Skip rate limiting for certain requests */
|
|
185
|
+
skip?: (req: Request) => boolean | Promise<boolean>;
|
|
186
|
+
/** Custom handler when limit is exceeded */
|
|
187
|
+
handler?: (req: Request, res: Response, next: NextFunction, status: LimitStatus) => void;
|
|
188
|
+
/** Strategy to use (default: 'sliding-window') */
|
|
189
|
+
strategy?: RateLimitStrategy;
|
|
190
|
+
/** Include standard rate limit headers (default: true) */
|
|
191
|
+
headers?: boolean;
|
|
192
|
+
/** Key prefix for this middleware instance */
|
|
193
|
+
keyPrefix?: string;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Rate limit plugin configuration
|
|
197
|
+
*/
|
|
198
|
+
export interface RateLimitPluginConfig {
|
|
199
|
+
/**
|
|
200
|
+
* PostgreSQL store configuration (required for persistence)
|
|
201
|
+
*/
|
|
202
|
+
store: RateLimitStore;
|
|
203
|
+
/**
|
|
204
|
+
* Default limits applied when not specified per-route
|
|
205
|
+
*/
|
|
206
|
+
defaults?: {
|
|
207
|
+
/** Time window in milliseconds (default: 60000 = 1 min) */
|
|
208
|
+
windowMs?: number;
|
|
209
|
+
/** Max requests per window (default: 100) */
|
|
210
|
+
maxRequests?: number;
|
|
211
|
+
/** Strategy to use (default: 'sliding-window') */
|
|
212
|
+
strategy?: RateLimitStrategy;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Cache configuration
|
|
216
|
+
*/
|
|
217
|
+
cache?: RateLimitCacheConfig;
|
|
218
|
+
/**
|
|
219
|
+
* Auto-cleanup configuration
|
|
220
|
+
*/
|
|
221
|
+
cleanup?: {
|
|
222
|
+
/** Enable auto-cleanup of expired limits (default: true) */
|
|
223
|
+
enabled?: boolean;
|
|
224
|
+
/** Cleanup interval in milliseconds (default: 300000 = 5 min) */
|
|
225
|
+
intervalMs?: number;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* API routes configuration
|
|
229
|
+
*/
|
|
230
|
+
api?: {
|
|
231
|
+
/** Enable status API endpoints (default: true) */
|
|
232
|
+
enabled?: boolean;
|
|
233
|
+
/** Route prefix (default: '/rate-limit') */
|
|
234
|
+
prefix?: string;
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* UI configuration
|
|
238
|
+
*/
|
|
239
|
+
ui?: {
|
|
240
|
+
/** Enable UI menu item and config page (default: true) */
|
|
241
|
+
enabled?: boolean;
|
|
242
|
+
};
|
|
243
|
+
/** Enable debug logging (default: false) */
|
|
244
|
+
debug?: boolean;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Options for checking a rate limit programmatically
|
|
248
|
+
*/
|
|
249
|
+
export interface CheckLimitOptions {
|
|
250
|
+
/** Max requests (uses plugin default if not specified) */
|
|
251
|
+
maxRequests?: number;
|
|
252
|
+
/** Window in milliseconds (uses plugin default if not specified) */
|
|
253
|
+
windowMs?: number;
|
|
254
|
+
/** Strategy (uses plugin default if not specified) */
|
|
255
|
+
strategy?: RateLimitStrategy;
|
|
256
|
+
/** User ID for scoped limits */
|
|
257
|
+
userId?: string;
|
|
258
|
+
/** Tenant ID for scoped limits */
|
|
259
|
+
tenantId?: string;
|
|
260
|
+
/** IP address for scoped limits */
|
|
261
|
+
ipAddress?: string;
|
|
262
|
+
/** Whether to increment counter (default: true) */
|
|
263
|
+
increment?: boolean;
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins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@@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/rate-limit/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subscriptions Plugin Tests
|
|
3
|
+
*
|
|
4
|
+
* Unit tests for the subscriptions plugin including:
|
|
5
|
+
* - Plugin lifecycle
|
|
6
|
+
* - Tier management
|
|
7
|
+
* - Entitlement checks
|
|
8
|
+
* - User subscription management
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=subscriptions-plugin.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions-plugin.test.d.ts","sourceRoot":"","sources":["../../../../src/plugins/subscriptions/__tests__/subscriptions-plugin.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|