@revealui/core 0.0.1-pre.3 → 0.2.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/LICENSE +22 -202
- package/README.md +29 -180
- package/dist/api/compression.d.ts +83 -0
- package/dist/api/compression.d.ts.map +1 -0
- package/dist/api/compression.js +233 -0
- package/dist/api/payload-optimization.d.ts +138 -0
- package/dist/api/payload-optimization.d.ts.map +1 -0
- package/dist/api/payload-optimization.js +320 -0
- package/dist/api/rate-limit.d.ts +113 -0
- package/dist/api/rate-limit.d.ts.map +1 -0
- package/dist/api/rate-limit.js +301 -0
- package/dist/api/response-cache.d.ts +125 -0
- package/dist/api/response-cache.d.ts.map +1 -0
- package/dist/api/response-cache.js +335 -0
- package/dist/api/rest.d.ts +54 -0
- package/dist/api/rest.d.ts.map +1 -0
- package/dist/api/rest.js +464 -0
- package/dist/auth/access.d.ts +25 -0
- package/dist/auth/access.d.ts.map +1 -0
- package/dist/auth/access.js +20 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/cache/query-cache.d.ts +98 -0
- package/dist/cache/query-cache.d.ts.map +1 -0
- package/dist/cache/query-cache.js +260 -0
- package/dist/caching/app-cache.d.ts +237 -0
- package/dist/caching/app-cache.d.ts.map +1 -0
- package/dist/caching/app-cache.js +430 -0
- package/dist/caching/cdn-config.d.ts +155 -0
- package/dist/caching/cdn-config.d.ts.map +1 -0
- package/dist/caching/cdn-config.js +425 -0
- package/dist/caching/edge-cache.d.ts +177 -0
- package/dist/caching/edge-cache.d.ts.map +1 -0
- package/dist/caching/edge-cache.js +381 -0
- package/dist/caching/service-worker.d.ts +165 -0
- package/dist/caching/service-worker.d.ts.map +1 -0
- package/dist/caching/service-worker.js +437 -0
- package/dist/client/admin/RichText.d.ts +12 -0
- package/dist/client/admin/RichText.d.ts.map +1 -0
- package/dist/client/admin/RichText.js +5 -0
- package/dist/client/admin/components/AdminDashboard.d.ts +7 -0
- package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -0
- package/dist/client/admin/components/AdminDashboard.js +318 -0
- package/dist/client/admin/components/CollectionList.d.ts +16 -0
- package/dist/client/admin/components/CollectionList.d.ts.map +1 -0
- package/dist/client/admin/components/CollectionList.js +67 -0
- package/dist/client/admin/components/DocumentForm.d.ts +11 -0
- package/dist/client/admin/components/DocumentForm.d.ts.map +1 -0
- package/dist/client/admin/components/DocumentForm.js +99 -0
- package/dist/client/admin/components/GlobalForm.d.ts +11 -0
- package/dist/client/admin/components/GlobalForm.d.ts.map +1 -0
- package/dist/client/admin/components/GlobalForm.js +74 -0
- package/dist/client/admin/i18n/en.d.ts +25 -0
- package/dist/client/admin/i18n/en.d.ts.map +1 -0
- package/dist/client/admin/i18n/en.js +25 -0
- package/dist/client/admin/index.d.ts +10 -0
- package/dist/client/admin/index.d.ts.map +1 -0
- package/dist/client/admin/index.js +10 -0
- package/dist/client/admin/layout.d.ts +10 -0
- package/dist/client/admin/layout.d.ts.map +1 -0
- package/dist/client/admin/layout.js +6 -0
- package/dist/client/admin/page.d.ts +38 -0
- package/dist/client/admin/page.d.ts.map +1 -0
- package/dist/client/admin/page.js +15 -0
- package/dist/client/admin/utils/apiClient.d.ts +110 -0
- package/dist/client/admin/utils/apiClient.d.ts.map +1 -0
- package/dist/client/admin/utils/apiClient.js +220 -0
- package/dist/client/admin/utils/auth.d.ts +27 -0
- package/dist/client/admin/utils/auth.d.ts.map +1 -0
- package/dist/client/admin/utils/auth.js +58 -0
- package/dist/client/admin/utils/index.d.ts +6 -0
- package/dist/client/admin/utils/index.d.ts.map +1 -0
- package/dist/client/admin/utils/index.js +5 -0
- package/dist/client/admin/utils/serializeConfig.d.ts +7 -0
- package/dist/client/admin/utils/serializeConfig.d.ts.map +1 -0
- package/dist/client/admin/utils/serializeConfig.js +35 -0
- package/dist/client/hooks.d.ts +18 -0
- package/dist/client/hooks.d.ts.map +1 -0
- package/dist/client/hooks.js +29 -0
- package/dist/client/http/client.d.ts +15 -0
- package/dist/client/http/client.d.ts.map +1 -0
- package/dist/client/http/client.js +49 -0
- package/dist/client/http/fetchBanner.d.ts +18 -0
- package/dist/client/http/fetchBanner.d.ts.map +1 -0
- package/dist/client/http/fetchBanner.js +44 -0
- package/dist/client/http/fetchCard.d.ts +18 -0
- package/dist/client/http/fetchCard.d.ts.map +1 -0
- package/dist/client/http/fetchCard.js +46 -0
- package/dist/client/http/fetchEvents.d.ts +18 -0
- package/dist/client/http/fetchEvents.d.ts.map +1 -0
- package/dist/client/http/fetchEvents.js +44 -0
- package/dist/client/http/fetchHero.d.ts +17 -0
- package/dist/client/http/fetchHero.d.ts.map +1 -0
- package/dist/client/http/fetchHero.js +55 -0
- package/dist/client/http/fetchMainInfos.d.ts +17 -0
- package/dist/client/http/fetchMainInfos.d.ts.map +1 -0
- package/dist/client/http/fetchMainInfos.js +44 -0
- package/dist/client/http/fetchVideos.d.ts +13 -0
- package/dist/client/http/fetchVideos.d.ts.map +1 -0
- package/dist/client/http/fetchVideos.js +36 -0
- package/dist/client/http/index.d.ts +19 -0
- package/dist/client/http/index.d.ts.map +1 -0
- package/dist/client/http/index.js +11 -0
- package/dist/client/index.d.ts +12 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +15 -0
- package/dist/client/richtext/RichTextEditor.d.ts +48 -0
- package/dist/client/richtext/RichTextEditor.d.ts.map +1 -0
- package/dist/client/richtext/RichTextEditor.js +360 -0
- package/dist/client/richtext/components/ImageNodeComponent.d.ts +9 -0
- package/dist/client/richtext/components/ImageNodeComponent.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageNodeComponent.js +99 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts +11 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageUploadButton.js +103 -0
- package/dist/client/richtext/index.d.ts +92 -0
- package/dist/client/richtext/index.d.ts.map +1 -0
- package/dist/client/richtext/index.js +74 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts +20 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts.map +1 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.js +29 -0
- package/dist/client/richtext/nodes/ImageNode.d.ts +51 -0
- package/dist/client/richtext/nodes/ImageNode.d.ts.map +1 -0
- package/dist/client/richtext/nodes/ImageNode.js +95 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts +13 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.js +8 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts +4 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.js +50 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts +7 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.js +248 -0
- package/dist/client/richtext/plugins/ImagePlugin.d.ts +3 -0
- package/dist/client/richtext/plugins/ImagePlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/ImagePlugin.js +73 -0
- package/dist/client/richtext/plugins/PastePlugin.d.ts +2 -0
- package/dist/client/richtext/plugins/PastePlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/PastePlugin.js +36 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts +8 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.js +204 -0
- package/dist/client/ui/index.d.ts +111 -0
- package/dist/client/ui/index.d.ts.map +1 -0
- package/dist/client/ui/index.js +130 -0
- package/dist/collections/CollectionOperations.d.ts +27 -0
- package/dist/collections/CollectionOperations.d.ts.map +1 -0
- package/dist/collections/CollectionOperations.js +34 -0
- package/dist/collections/hooks.d.ts +11 -0
- package/dist/collections/hooks.d.ts.map +1 -0
- package/dist/collections/hooks.js +35 -0
- package/dist/collections/index.d.ts +2 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/index.js +1 -0
- package/dist/collections/operations/create.d.ts +10 -0
- package/dist/collections/operations/create.d.ts.map +1 -0
- package/dist/collections/operations/create.js +101 -0
- package/dist/collections/operations/delete.d.ts +10 -0
- package/dist/collections/operations/delete.d.ts.map +1 -0
- package/dist/collections/operations/delete.js +16 -0
- package/dist/collections/operations/fieldHooks.d.ts +21 -0
- package/dist/collections/operations/fieldHooks.d.ts.map +1 -0
- package/dist/collections/operations/fieldHooks.js +51 -0
- package/dist/collections/operations/find.d.ts +10 -0
- package/dist/collections/operations/find.d.ts.map +1 -0
- package/dist/collections/operations/find.js +124 -0
- package/dist/collections/operations/findById.d.ts +15 -0
- package/dist/collections/operations/findById.d.ts.map +1 -0
- package/dist/collections/operations/findById.js +59 -0
- package/dist/collections/operations/update.d.ts +10 -0
- package/dist/collections/operations/update.d.ts.map +1 -0
- package/dist/collections/operations/update.js +134 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +61 -0
- package/dist/config/runtime.d.ts +22 -0
- package/dist/config/runtime.d.ts.map +1 -0
- package/dist/config/runtime.js +32 -0
- package/dist/config/utils.d.ts +12 -0
- package/dist/config/utils.d.ts.map +1 -0
- package/dist/config/utils.js +20 -0
- package/dist/database/index.d.ts +1 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +6 -0
- package/dist/database/ssl-config.d.ts +9 -0
- package/dist/database/ssl-config.d.ts.map +1 -0
- package/dist/database/ssl-config.js +7 -0
- package/dist/database/type-adapter.d.ts +113 -0
- package/dist/database/type-adapter.d.ts.map +1 -0
- package/dist/database/type-adapter.js +97 -0
- package/dist/database/universal-postgres.d.ts +45 -0
- package/dist/database/universal-postgres.d.ts.map +1 -0
- package/dist/database/universal-postgres.js +526 -0
- package/dist/dataloader.d.ts +26 -0
- package/dist/dataloader.d.ts.map +1 -0
- package/dist/dataloader.js +162 -0
- package/dist/error-handling/circuit-breaker.d.ts +262 -0
- package/dist/error-handling/circuit-breaker.d.ts.map +1 -0
- package/dist/error-handling/circuit-breaker.js +542 -0
- package/dist/error-handling/error-boundary.d.ts +94 -0
- package/dist/error-handling/error-boundary.d.ts.map +1 -0
- package/dist/error-handling/error-boundary.js +285 -0
- package/dist/error-handling/error-reporter.d.ts +213 -0
- package/dist/error-handling/error-reporter.d.ts.map +1 -0
- package/dist/error-handling/error-reporter.js +506 -0
- package/dist/error-handling/fallback-components.d.ts +131 -0
- package/dist/error-handling/fallback-components.d.ts.map +1 -0
- package/dist/error-handling/fallback-components.js +371 -0
- package/dist/error-handling/index.d.ts +16 -0
- package/dist/error-handling/index.d.ts.map +1 -0
- package/dist/error-handling/index.js +15 -0
- package/dist/error-handling/retry.d.ts +194 -0
- package/dist/error-handling/retry.d.ts.map +1 -0
- package/dist/error-handling/retry.js +450 -0
- package/dist/errors/index.d.ts +23 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +40 -0
- package/dist/factories/builders.d.ts +50 -0
- package/dist/factories/builders.d.ts.map +1 -0
- package/dist/factories/builders.js +77 -0
- package/dist/factories/index.d.ts +2 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +1 -0
- package/dist/features.d.ts +82 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +89 -0
- package/dist/fieldTraversal.d.ts +26 -0
- package/dist/fieldTraversal.d.ts.map +1 -0
- package/dist/fieldTraversal.js +132 -0
- package/dist/fields/config/types.d.ts +48 -0
- package/dist/fields/config/types.d.ts.map +1 -0
- package/dist/fields/config/types.js +20 -0
- package/dist/fields/getDefaultValue.d.ts +16 -0
- package/dist/fields/getDefaultValue.d.ts.map +1 -0
- package/dist/fields/getDefaultValue.js +20 -0
- package/dist/fields/getFieldPaths.d.ts +25 -0
- package/dist/fields/getFieldPaths.d.ts.map +1 -0
- package/dist/fields/getFieldPaths.js +23 -0
- package/dist/fields/hooks/afterRead/index.d.ts +36 -0
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/index.js +70 -0
- package/dist/fields/hooks/afterRead/promise.d.ts +46 -0
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/promise.js +178 -0
- package/dist/fields/hooks/afterRead/traverseFields.d.ts +44 -0
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/traverseFields.js +37 -0
- package/dist/generated/agents/index.d.ts +8 -0
- package/dist/generated/agents/index.d.ts.map +1 -0
- package/dist/generated/agents/index.js +7 -0
- package/dist/generated/components/index.d.ts +8 -0
- package/dist/generated/components/index.d.ts.map +1 -0
- package/dist/generated/components/index.js +7 -0
- package/dist/generated/functions/index.d.ts +8 -0
- package/dist/generated/functions/index.d.ts.map +1 -0
- package/dist/generated/functions/index.js +7 -0
- package/dist/generated/hooks/index.d.ts +8 -0
- package/dist/generated/hooks/index.d.ts.map +1 -0
- package/dist/generated/hooks/index.js +7 -0
- package/dist/generated/index.d.ts +10 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +9 -0
- package/dist/generated/plans/index.d.ts +8 -0
- package/dist/generated/plans/index.d.ts.map +1 -0
- package/dist/generated/plans/index.js +7 -0
- package/dist/generated/prompts/index.d.ts +8 -0
- package/dist/generated/prompts/index.d.ts.map +1 -0
- package/dist/generated/prompts/index.js +7 -0
- package/dist/generated/tools/index.d.ts +8 -0
- package/dist/generated/tools/index.d.ts.map +1 -0
- package/dist/generated/tools/index.js +7 -0
- package/dist/generated/types/cms.d.ts +1766 -0
- package/dist/generated/types/cms.d.ts.map +1 -0
- package/dist/generated/types/cms.js +12 -0
- package/dist/generated/types/index.d.ts +19 -0
- package/dist/generated/types/index.d.ts.map +1 -0
- package/dist/generated/types/index.js +28 -0
- package/dist/generated/types/neon.d.ts +11 -0
- package/dist/generated/types/neon.d.ts.map +1 -0
- package/dist/generated/types/neon.js +11 -0
- package/dist/generated/types/supabase.d.ts +193 -0
- package/dist/generated/types/supabase.d.ts.map +1 -0
- package/dist/generated/types/supabase.js +5 -0
- package/dist/globals/GlobalOperations.d.ts +24 -0
- package/dist/globals/GlobalOperations.d.ts.map +1 -0
- package/dist/globals/GlobalOperations.js +149 -0
- package/dist/globals/index.d.ts +2 -0
- package/dist/globals/index.d.ts.map +1 -0
- package/dist/globals/index.js +1 -0
- package/dist/index.d.ts +64 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -33
- package/dist/instance/RevealUIInstance.d.ts +6 -0
- package/dist/instance/RevealUIInstance.d.ts.map +1 -0
- package/dist/instance/RevealUIInstance.js +312 -0
- package/dist/instance/index.d.ts +3 -0
- package/dist/instance/index.d.ts.map +1 -0
- package/dist/instance/index.js +2 -0
- package/dist/instance/logger.d.ts +31 -0
- package/dist/instance/logger.d.ts.map +1 -0
- package/dist/instance/logger.js +42 -0
- package/dist/instance/methods/create.d.ts +10 -0
- package/dist/instance/methods/create.d.ts.map +1 -0
- package/dist/instance/methods/create.js +38 -0
- package/dist/instance/methods/delete.d.ts +10 -0
- package/dist/instance/methods/delete.d.ts.map +1 -0
- package/dist/instance/methods/delete.js +24 -0
- package/dist/instance/methods/find.d.ts +10 -0
- package/dist/instance/methods/find.d.ts.map +1 -0
- package/dist/instance/methods/find.js +23 -0
- package/dist/instance/methods/findById.d.ts +13 -0
- package/dist/instance/methods/findById.d.ts.map +1 -0
- package/dist/instance/methods/findById.js +23 -0
- package/dist/instance/methods/hooks.d.ts +14 -0
- package/dist/instance/methods/hooks.d.ts.map +1 -0
- package/dist/instance/methods/hooks.js +32 -0
- package/dist/instance/methods/update.d.ts +10 -0
- package/dist/instance/methods/update.d.ts.map +1 -0
- package/dist/instance/methods/update.js +42 -0
- package/dist/license.d.ts +73 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +157 -0
- package/dist/monitoring/alerts.d.ts +118 -0
- package/dist/monitoring/alerts.d.ts.map +1 -0
- package/dist/monitoring/alerts.js +324 -0
- package/dist/monitoring/cleanup-manager.d.ts +71 -0
- package/dist/monitoring/cleanup-manager.d.ts.map +1 -0
- package/dist/monitoring/cleanup-manager.js +226 -0
- package/dist/monitoring/health-monitor.d.ts +22 -0
- package/dist/monitoring/health-monitor.d.ts.map +1 -0
- package/dist/monitoring/health-monitor.js +142 -0
- package/dist/monitoring/index.d.ts +14 -0
- package/dist/monitoring/index.d.ts.map +1 -0
- package/dist/monitoring/index.js +17 -0
- package/dist/monitoring/process-registry.d.ts +97 -0
- package/dist/monitoring/process-registry.d.ts.map +1 -0
- package/dist/monitoring/process-registry.js +222 -0
- package/dist/monitoring/query-monitor.d.ts +153 -0
- package/dist/monitoring/query-monitor.d.ts.map +1 -0
- package/dist/monitoring/query-monitor.js +209 -0
- package/dist/monitoring/types.d.ts +231 -0
- package/dist/monitoring/types.d.ts.map +1 -0
- package/dist/monitoring/types.js +42 -0
- package/dist/monitoring/zombie-detector.d.ts +81 -0
- package/dist/monitoring/zombie-detector.d.ts.map +1 -0
- package/dist/monitoring/zombie-detector.js +231 -0
- package/dist/nextjs/index.d.ts +4 -0
- package/dist/nextjs/index.d.ts.map +1 -0
- package/dist/nextjs/index.js +3 -0
- package/dist/nextjs/utilities.d.ts +5 -0
- package/dist/nextjs/utilities.d.ts.map +1 -0
- package/dist/nextjs/utilities.js +16 -0
- package/dist/nextjs/withRevealUI.d.ts +20 -0
- package/dist/nextjs/withRevealUI.d.ts.map +1 -0
- package/dist/nextjs/withRevealUI.js +181 -0
- package/dist/observability/alerts.d.ts +138 -0
- package/dist/observability/alerts.d.ts.map +1 -0
- package/dist/observability/alerts.js +390 -0
- package/dist/observability/health-check.d.ts +95 -0
- package/dist/observability/health-check.d.ts.map +1 -0
- package/dist/observability/health-check.js +345 -0
- package/dist/observability/index.d.ts +12 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +11 -0
- package/dist/observability/logger.d.ts +47 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +140 -0
- package/dist/observability/metrics.d.ts +205 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +429 -0
- package/dist/observability/tracing.d.ts +149 -0
- package/dist/observability/tracing.d.ts.map +1 -0
- package/dist/observability/tracing.js +381 -0
- package/dist/optimization/asset-optimizer.d.ts +202 -0
- package/dist/optimization/asset-optimizer.d.ts.map +1 -0
- package/dist/optimization/asset-optimizer.js +312 -0
- package/dist/optimization/build-optimizer.d.ts +202 -0
- package/dist/optimization/build-optimizer.d.ts.map +1 -0
- package/dist/optimization/build-optimizer.js +271 -0
- package/dist/optimization/bundle-analyzer.d.ts +98 -0
- package/dist/optimization/bundle-analyzer.d.ts.map +1 -0
- package/dist/optimization/bundle-analyzer.js +322 -0
- package/dist/optimization/code-splitting.d.ts +144 -0
- package/dist/optimization/code-splitting.d.ts.map +1 -0
- package/dist/optimization/code-splitting.js +290 -0
- package/dist/plugin/index.d.ts +12 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +4 -0
- package/dist/plugins/form-builder.d.ts +115 -0
- package/dist/plugins/form-builder.d.ts.map +1 -0
- package/dist/plugins/form-builder.js +239 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/nested-docs.d.ts +8 -0
- package/dist/plugins/nested-docs.d.ts.map +1 -0
- package/dist/plugins/nested-docs.js +67 -0
- package/dist/plugins/redirects.d.ts +17 -0
- package/dist/plugins/redirects.d.ts.map +1 -0
- package/dist/plugins/redirects.js +62 -0
- package/dist/queries/index.d.ts +2 -0
- package/dist/queries/index.d.ts.map +1 -0
- package/dist/queries/index.js +1 -0
- package/dist/queries/queryBuilder.d.ts +47 -0
- package/dist/queries/queryBuilder.d.ts.map +1 -0
- package/dist/queries/queryBuilder.js +252 -0
- package/dist/relationships/analyzer.d.ts +39 -0
- package/dist/relationships/analyzer.d.ts.map +1 -0
- package/dist/relationships/analyzer.js +127 -0
- package/dist/relationships/index.d.ts +3 -0
- package/dist/relationships/index.d.ts.map +1 -0
- package/dist/relationships/index.js +2 -0
- package/dist/relationships/populate-helpers.d.ts +104 -0
- package/dist/relationships/populate-helpers.d.ts.map +1 -0
- package/dist/relationships/populate-helpers.js +187 -0
- package/dist/relationships/population.d.ts +42 -0
- package/dist/relationships/population.d.ts.map +1 -0
- package/dist/relationships/population.js +188 -0
- package/dist/revealui.d.ts +46 -0
- package/dist/revealui.d.ts.map +1 -0
- package/dist/revealui.js +92 -0
- package/dist/richtext/exports/client/rcc.d.ts +37 -0
- package/dist/richtext/exports/client/rcc.d.ts.map +1 -0
- package/dist/richtext/exports/client/rcc.js +182 -0
- package/dist/richtext/exports/server/rsc.d.ts +117 -0
- package/dist/richtext/exports/server/rsc.d.ts.map +1 -0
- package/dist/richtext/exports/server/rsc.js +288 -0
- package/dist/richtext/index.d.ts +161 -0
- package/dist/richtext/index.d.ts.map +1 -0
- package/dist/richtext/index.js +243 -0
- package/dist/richtext/lexical.d.ts +23 -0
- package/dist/richtext/lexical.d.ts.map +1 -0
- package/dist/richtext/lexical.js +35 -0
- package/dist/security/audit.d.ts +188 -0
- package/dist/security/audit.d.ts.map +1 -0
- package/dist/security/audit.js +431 -0
- package/dist/security/auth.d.ts +241 -0
- package/dist/security/auth.d.ts.map +1 -0
- package/dist/security/auth.js +474 -0
- package/dist/security/authorization.d.ts +235 -0
- package/dist/security/authorization.d.ts.map +1 -0
- package/dist/security/authorization.js +434 -0
- package/dist/security/encryption.d.ts +214 -0
- package/dist/security/encryption.d.ts.map +1 -0
- package/dist/security/encryption.js +506 -0
- package/dist/security/gdpr.d.ts +300 -0
- package/dist/security/gdpr.d.ts.map +1 -0
- package/dist/security/gdpr.js +470 -0
- package/dist/security/headers.d.ts +182 -0
- package/dist/security/headers.d.ts.map +1 -0
- package/dist/security/headers.js +402 -0
- package/dist/security/index.d.ts +19 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +18 -0
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +28 -0
- package/dist/server/renderPage.d.ts +69 -0
- package/dist/server/renderPage.d.ts.map +1 -0
- package/dist/server/renderPage.js +109 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +4 -0
- package/dist/storage/vercel-blob.d.ts +17 -0
- package/dist/storage/vercel-blob.d.ts.map +1 -0
- package/dist/storage/vercel-blob.js +83 -0
- package/dist/translations/index.d.ts +17 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +1 -0
- package/dist/types/access.d.ts +67 -0
- package/dist/types/access.d.ts.map +1 -0
- package/dist/types/access.js +8 -0
- package/dist/types/api.d.ts +57 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +8 -0
- package/dist/types/cms.d.ts +8 -0
- package/dist/types/cms.d.ts.map +1 -0
- package/dist/types/cms.js +6 -0
- package/dist/types/config.d.ts +152 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +9 -0
- package/dist/types/core.d.ts +11 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +9 -0
- package/dist/types/extensions.d.ts +116 -0
- package/dist/types/extensions.d.ts.map +1 -0
- package/dist/types/extensions.js +8 -0
- package/dist/types/frontend.d.ts +53 -0
- package/dist/types/frontend.d.ts.map +1 -0
- package/dist/types/frontend.js +7 -0
- package/dist/types/generated.d.ts +14 -0
- package/dist/types/generated.d.ts.map +1 -0
- package/dist/types/generated.js +11 -0
- package/dist/types/hooks.d.ts +53 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/hooks.js +8 -0
- package/dist/types/index.d.ts +49 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +61 -0
- package/dist/types/interfaces/app.d.ts +50 -0
- package/dist/types/interfaces/app.d.ts.map +1 -0
- package/dist/types/interfaces/app.js +5 -0
- package/dist/types/jobs.d.ts +112 -0
- package/dist/types/jobs.d.ts.map +1 -0
- package/dist/types/jobs.js +7 -0
- package/dist/types/legacy.d.ts +147 -0
- package/dist/types/legacy.d.ts.map +1 -0
- package/dist/types/legacy.js +8 -0
- package/dist/types/plugins.d.ts +17 -0
- package/dist/types/plugins.d.ts.map +1 -0
- package/dist/types/plugins.js +8 -0
- package/dist/types/query.d.ts +99 -0
- package/dist/types/query.d.ts.map +1 -0
- package/dist/types/query.js +24 -0
- package/dist/types/request.d.ts +40 -0
- package/dist/types/request.d.ts.map +1 -0
- package/dist/types/request.js +8 -0
- package/dist/types/richtext.d.ts +23 -0
- package/dist/types/richtext.d.ts.map +1 -0
- package/dist/types/richtext.js +8 -0
- package/dist/types/runtime.d.ts +216 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +9 -0
- package/dist/types/schema.d.ts +9 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +7 -0
- package/dist/types/user.d.ts +48 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +8 -0
- package/dist/utils/access-conversion.d.ts +17 -0
- package/dist/utils/access-conversion.d.ts.map +1 -0
- package/dist/utils/access-conversion.js +96 -0
- package/dist/utils/api-wrapper.d.ts +63 -0
- package/dist/utils/api-wrapper.d.ts.map +1 -0
- package/dist/utils/api-wrapper.js +151 -0
- package/dist/utils/block-conversion.d.ts +21 -0
- package/dist/utils/block-conversion.d.ts.map +1 -0
- package/dist/utils/block-conversion.js +109 -0
- package/dist/utils/cache.d.ts +86 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +154 -0
- package/dist/utils/deep-clone.d.ts +25 -0
- package/dist/utils/deep-clone.d.ts.map +1 -0
- package/dist/utils/deep-clone.js +115 -0
- package/dist/utils/error-responses.d.ts +57 -0
- package/dist/utils/error-responses.d.ts.map +1 -0
- package/dist/utils/error-responses.js +96 -0
- package/dist/utils/errors.d.ts +97 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +397 -0
- package/dist/utils/field-conversion.d.ts +40 -0
- package/dist/utils/field-conversion.d.ts.map +1 -0
- package/dist/utils/field-conversion.js +275 -0
- package/dist/utils/flattenResult.d.ts +7 -0
- package/dist/utils/flattenResult.d.ts.map +1 -0
- package/dist/utils/flattenResult.js +23 -0
- package/dist/utils/getBlockSelect.d.ts +12 -0
- package/dist/utils/getBlockSelect.d.ts.map +1 -0
- package/dist/utils/getBlockSelect.js +12 -0
- package/dist/utils/getSelectMode.d.ts +8 -0
- package/dist/utils/getSelectMode.d.ts.map +1 -0
- package/dist/utils/getSelectMode.js +21 -0
- package/dist/utils/isValidID.d.ts +5 -0
- package/dist/utils/isValidID.d.ts.map +1 -0
- package/dist/utils/isValidID.js +13 -0
- package/dist/utils/json-parsing.d.ts +48 -0
- package/dist/utils/json-parsing.d.ts.map +1 -0
- package/dist/utils/json-parsing.js +130 -0
- package/dist/utils/jwt-validation.d.ts +14 -0
- package/dist/utils/jwt-validation.d.ts.map +1 -0
- package/dist/utils/jwt-validation.js +36 -0
- package/dist/utils/logger-client.d.ts +32 -0
- package/dist/utils/logger-client.d.ts.map +1 -0
- package/dist/utils/logger-client.js +55 -0
- package/dist/utils/logger-server.d.ts +32 -0
- package/dist/utils/logger-server.d.ts.map +1 -0
- package/dist/utils/logger-server.js +68 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +12 -0
- package/dist/utils/request-context.d.ts +143 -0
- package/dist/utils/request-context.d.ts.map +1 -0
- package/dist/utils/request-context.js +168 -0
- package/dist/utils/request-headers.d.ts +15 -0
- package/dist/utils/request-headers.d.ts.map +1 -0
- package/dist/utils/request-headers.js +31 -0
- package/dist/utils/stripUnselectedFields.d.ts +10 -0
- package/dist/utils/stripUnselectedFields.d.ts.map +1 -0
- package/dist/utils/stripUnselectedFields.js +20 -0
- package/dist/utils/type-guards.d.ts +33 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +63 -0
- package/dist/utils/user.d.ts +14 -0
- package/dist/utils/user.d.ts.map +1 -0
- package/dist/utils/user.js +15 -0
- package/package.json +250 -697
- package/LICENSE_SUMMARY.md +0 -55
- package/NOTICE +0 -34
- package/dist/core/gaurds/logger/log404/index.spec.snapshot-1 +0 -8
- package/dist/core/gaurds/logger/log404/index.spec.snapshot-2 +0 -9
- package/dist/exports/RenderErrorPage.js +0 -3
- package/dist/exports/__internal.js +0 -3
- package/dist/exports/abort.js +0 -3
- package/dist/exports/bin-entry.js +0 -17
- package/dist/exports/cli.js +0 -3
- package/dist/exports/client.js +0 -3
- package/dist/exports/config.js +0 -1
- package/dist/exports/helpers.js +0 -1
- package/dist/exports/index.js +0 -33
- package/dist/exports/plugin.js +0 -3
- package/dist/exports/prerender.js +0 -3
- package/dist/exports/router.js +0 -3
- package/dist/exports/routing.js +0 -3
- package/dist/exports/server.js +0 -3
- package/dist/exports/setup.js +0 -3
- package/dist/exports/types.js +0 -1
- package/dist/integration/styles.css +0 -141
- package/dist/node/cli/index.js +0 -18
- package/dist/shared/RenderErrorPage.d.ts +0 -3
- package/dist/shared/RenderErrorPage.js +0 -3
- package/dist/shared/abort.js +0 -3
- package/dist/shared/route/routing.js +0 -3
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alert System
|
|
3
|
+
*
|
|
4
|
+
* Manages alert channels (logger, Sentry, console) and alert delivery.
|
|
5
|
+
* Provides configurable thresholds and aggregation for production.
|
|
6
|
+
*/
|
|
7
|
+
import type { Alert } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Sentry interface for dependency injection and testing
|
|
10
|
+
*/
|
|
11
|
+
interface SentryClient {
|
|
12
|
+
captureMessage: (message: string, context?: unknown) => void;
|
|
13
|
+
setUser: (user: unknown) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Alert channel type
|
|
17
|
+
*/
|
|
18
|
+
type AlertChannel = 'logger' | 'sentry' | 'console';
|
|
19
|
+
/**
|
|
20
|
+
* Alert configuration
|
|
21
|
+
*/
|
|
22
|
+
interface AlertConfig {
|
|
23
|
+
/** Enabled channels */
|
|
24
|
+
channels: AlertChannel[];
|
|
25
|
+
/** Aggregate alerts in production (log every N minutes instead of immediately) */
|
|
26
|
+
aggregateInProduction: boolean;
|
|
27
|
+
/** Aggregation interval in milliseconds */
|
|
28
|
+
aggregationInterval: number;
|
|
29
|
+
/** Enable Sentry in production only */
|
|
30
|
+
sentryProductionOnly: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Alert manager class
|
|
34
|
+
*/
|
|
35
|
+
declare class AlertManager {
|
|
36
|
+
private config;
|
|
37
|
+
private alertQueue;
|
|
38
|
+
private aggregationTimer;
|
|
39
|
+
private lastAggregationTime;
|
|
40
|
+
private sentryClient;
|
|
41
|
+
constructor(config?: Partial<AlertConfig>, sentryClient?: SentryClient | null);
|
|
42
|
+
/**
|
|
43
|
+
* Send an alert through configured channels
|
|
44
|
+
*/
|
|
45
|
+
sendAlert(alert: Alert): void;
|
|
46
|
+
/**
|
|
47
|
+
* Send multiple alerts
|
|
48
|
+
*/
|
|
49
|
+
sendAlerts(alerts: Alert[]): void;
|
|
50
|
+
/**
|
|
51
|
+
* Deliver an alert to configured channels
|
|
52
|
+
*/
|
|
53
|
+
private deliverAlert;
|
|
54
|
+
/**
|
|
55
|
+
* Send alert to logger
|
|
56
|
+
*/
|
|
57
|
+
private sendToLogger;
|
|
58
|
+
/**
|
|
59
|
+
* Send alert to console (uses logger for structured output)
|
|
60
|
+
*/
|
|
61
|
+
private sendToConsole;
|
|
62
|
+
/**
|
|
63
|
+
* Send alert to Sentry
|
|
64
|
+
*/
|
|
65
|
+
private sendToSentry;
|
|
66
|
+
/**
|
|
67
|
+
* Start aggregation timer
|
|
68
|
+
*/
|
|
69
|
+
private startAggregation;
|
|
70
|
+
/**
|
|
71
|
+
* Flush aggregated alerts
|
|
72
|
+
*/
|
|
73
|
+
private flushAlerts;
|
|
74
|
+
/**
|
|
75
|
+
* Stop aggregation timer
|
|
76
|
+
*/
|
|
77
|
+
stopAggregation(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Check if running in production
|
|
80
|
+
*/
|
|
81
|
+
private isProduction;
|
|
82
|
+
/**
|
|
83
|
+
* Get alert queue stats
|
|
84
|
+
*/
|
|
85
|
+
getStats(): {
|
|
86
|
+
queueSize: number;
|
|
87
|
+
lastAggregationTime: number;
|
|
88
|
+
aggregationEnabled: boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Configure alert channels
|
|
92
|
+
*/
|
|
93
|
+
setChannels(channels: AlertChannel[]): void;
|
|
94
|
+
/**
|
|
95
|
+
* Cleanup resources
|
|
96
|
+
*/
|
|
97
|
+
dispose(): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Singleton instance
|
|
101
|
+
*/
|
|
102
|
+
export declare const alertManager: AlertManager;
|
|
103
|
+
/**
|
|
104
|
+
* Export AlertManager class for testing
|
|
105
|
+
*/
|
|
106
|
+
export { AlertManager };
|
|
107
|
+
/**
|
|
108
|
+
* Export types for testing
|
|
109
|
+
*/
|
|
110
|
+
export type { AlertChannel, SentryClient };
|
|
111
|
+
/**
|
|
112
|
+
* Convenience functions
|
|
113
|
+
*/
|
|
114
|
+
export declare function sendAlert(alert: Alert): void;
|
|
115
|
+
export declare function sendAlerts(alerts: Alert[]): void;
|
|
116
|
+
export declare function getAlertStats(): ReturnType<typeof alertManager.getStats>;
|
|
117
|
+
export declare function setAlertChannels(channels: AlertChannel[]): void;
|
|
118
|
+
//# sourceMappingURL=alerts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../src/monitoring/alerts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC;;GAEG;AACH,UAAU,YAAY;IACpB,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5D,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CACjC;AAsCD;;GAEG;AACH,KAAK,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEnD;;GAEG;AACH,UAAU,WAAW;IACnB,uBAAuB;IACvB,QAAQ,EAAE,YAAY,EAAE,CAAA;IAExB,kFAAkF;IAClF,qBAAqB,EAAE,OAAO,CAAA;IAE9B,2CAA2C;IAC3C,mBAAmB,EAAE,MAAM,CAAA;IAE3B,uCAAuC;IACvC,oBAAoB,EAAE,OAAO,CAAA;CAC9B;AAYD;;GAEG;AACH,cAAM,YAAY;IAChB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,mBAAmB,CAAI;IAC/B,OAAO,CAAC,YAAY,CAA4B;gBAEpC,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI;IAUjF;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAU7B;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI;IAMjC;;OAEG;IACH,OAAO,CAAC,YAAY;IAoBpB;;OAEG;IACH,OAAO,CAAC,YAAY;IAuBpB;;OAEG;IACH,OAAO,CAAC,aAAa;IAYrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAmEpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;OAEG;IACH,OAAO,CAAC,WAAW;IAwCnB;;OAEG;IACH,eAAe,IAAI,IAAI;IAOvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,QAAQ,IAAI;QACV,SAAS,EAAE,MAAM,CAAA;QACjB,mBAAmB,EAAE,MAAM,CAAA;QAC3B,kBAAkB,EAAE,OAAO,CAAA;KAC5B;IAQD;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI;IAI3C;;OAEG;IACH,OAAO,IAAI,IAAI;CAIhB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,cAAqB,CAAA;AAE9C;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,CAAA;AAEvB;;GAEG;AACH,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA;AAE1C;;GAEG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAE5C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAEhD;AAED,wBAAgB,aAAa,IAAI,UAAU,CAAC,OAAO,YAAY,CAAC,QAAQ,CAAC,CAExE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAE/D"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alert System
|
|
3
|
+
*
|
|
4
|
+
* Manages alert channels (logger, Sentry, console) and alert delivery.
|
|
5
|
+
* Provides configurable thresholds and aggregation for production.
|
|
6
|
+
*/
|
|
7
|
+
import { logger } from '../utils/logger-server.js';
|
|
8
|
+
import { getRequestContext } from '../utils/request-context.js';
|
|
9
|
+
/**
|
|
10
|
+
* Get Sentry client if available
|
|
11
|
+
* Using dynamic import with string variable to avoid build-time resolution
|
|
12
|
+
*/
|
|
13
|
+
async function getSentryClient() {
|
|
14
|
+
try {
|
|
15
|
+
// Use string variable to prevent static analysis and bundler resolution
|
|
16
|
+
const moduleName = '@sentry' + '/node';
|
|
17
|
+
const sentry = await import(/* webpackIgnore: true */ moduleName);
|
|
18
|
+
return sentry;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Synchronous version that caches the client
|
|
26
|
+
*/
|
|
27
|
+
let sentryClientCache;
|
|
28
|
+
function getSentryClientSync() {
|
|
29
|
+
if (sentryClientCache !== undefined) {
|
|
30
|
+
return sentryClientCache;
|
|
31
|
+
}
|
|
32
|
+
// Initialize asynchronously in the background
|
|
33
|
+
getSentryClient()
|
|
34
|
+
.then((client) => {
|
|
35
|
+
sentryClientCache = client;
|
|
36
|
+
})
|
|
37
|
+
.catch(() => {
|
|
38
|
+
sentryClientCache = null;
|
|
39
|
+
});
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Default alert configuration
|
|
44
|
+
*/
|
|
45
|
+
const DEFAULT_ALERT_CONFIG = {
|
|
46
|
+
channels: ['logger', 'console'],
|
|
47
|
+
aggregateInProduction: true,
|
|
48
|
+
aggregationInterval: 5 * 60 * 1000, // 5 minutes
|
|
49
|
+
sentryProductionOnly: true,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Alert manager class
|
|
53
|
+
*/
|
|
54
|
+
class AlertManager {
|
|
55
|
+
config;
|
|
56
|
+
alertQueue = [];
|
|
57
|
+
aggregationTimer = null;
|
|
58
|
+
lastAggregationTime = 0;
|
|
59
|
+
sentryClient = null;
|
|
60
|
+
constructor(config = {}, sentryClient) {
|
|
61
|
+
this.config = { ...DEFAULT_ALERT_CONFIG, ...config };
|
|
62
|
+
this.sentryClient = sentryClient !== undefined ? sentryClient : getSentryClientSync();
|
|
63
|
+
// Start aggregation timer if enabled
|
|
64
|
+
if (this.config.aggregateInProduction && this.isProduction()) {
|
|
65
|
+
this.startAggregation();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Send an alert through configured channels
|
|
70
|
+
*/
|
|
71
|
+
sendAlert(alert) {
|
|
72
|
+
if (this.config.aggregateInProduction && this.isProduction()) {
|
|
73
|
+
// In production, queue alerts for aggregation
|
|
74
|
+
this.alertQueue.push(alert);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// In development, send immediately
|
|
78
|
+
this.deliverAlert(alert);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Send multiple alerts
|
|
83
|
+
*/
|
|
84
|
+
sendAlerts(alerts) {
|
|
85
|
+
for (const alert of alerts) {
|
|
86
|
+
this.sendAlert(alert);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Deliver an alert to configured channels
|
|
91
|
+
*/
|
|
92
|
+
deliverAlert(alert) {
|
|
93
|
+
for (const channel of this.config.channels) {
|
|
94
|
+
switch (channel) {
|
|
95
|
+
case 'logger':
|
|
96
|
+
this.sendToLogger(alert);
|
|
97
|
+
break;
|
|
98
|
+
case 'console':
|
|
99
|
+
this.sendToConsole(alert);
|
|
100
|
+
break;
|
|
101
|
+
case 'sentry':
|
|
102
|
+
if (!this.config.sentryProductionOnly || this.isProduction()) {
|
|
103
|
+
this.sendToSentry(alert);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Send alert to logger
|
|
111
|
+
*/
|
|
112
|
+
sendToLogger(alert) {
|
|
113
|
+
// Get request context for additional metadata
|
|
114
|
+
const context = getRequestContext();
|
|
115
|
+
const logData = {
|
|
116
|
+
metric: alert.metric,
|
|
117
|
+
value: alert.value,
|
|
118
|
+
threshold: alert.threshold,
|
|
119
|
+
timestamp: alert.timestamp,
|
|
120
|
+
// Include request context if available
|
|
121
|
+
...(context?.userId && { userId: context.userId }),
|
|
122
|
+
...(context?.path && { path: context.path }),
|
|
123
|
+
...(context?.method && { method: context.method }),
|
|
124
|
+
...(context?.ip && { ip: context.ip }),
|
|
125
|
+
};
|
|
126
|
+
if (alert.level === 'critical') {
|
|
127
|
+
logger.error(alert.message, logData);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
logger.warn(alert.message, logData);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Send alert to console (uses logger for structured output)
|
|
135
|
+
*/
|
|
136
|
+
sendToConsole(alert) {
|
|
137
|
+
const logLevel = alert.level === 'critical' ? 'error' : 'warn';
|
|
138
|
+
const prefix = alert.level === 'critical' ? '🔴 CRITICAL' : '⚠️ WARNING';
|
|
139
|
+
logger[logLevel](`${prefix}: ${alert.message}`, {
|
|
140
|
+
metric: alert.metric,
|
|
141
|
+
value: alert.value,
|
|
142
|
+
threshold: alert.threshold,
|
|
143
|
+
timestamp: alert.timestamp,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Send alert to Sentry
|
|
148
|
+
*/
|
|
149
|
+
sendToSentry(alert) {
|
|
150
|
+
// Only send critical alerts to Sentry
|
|
151
|
+
if (alert.level !== 'critical')
|
|
152
|
+
return;
|
|
153
|
+
// Check if Sentry is available
|
|
154
|
+
if (!this.sentryClient) {
|
|
155
|
+
logger.debug('Sentry not available for alert delivery');
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
// Get request context for rich tracing
|
|
160
|
+
const context = getRequestContext();
|
|
161
|
+
// Build tags (indexed, searchable fields)
|
|
162
|
+
const tags = {
|
|
163
|
+
metric: alert.metric,
|
|
164
|
+
alert_level: alert.level,
|
|
165
|
+
};
|
|
166
|
+
// Add request context to tags for better filtering
|
|
167
|
+
if (context?.requestId)
|
|
168
|
+
tags.request_id = context.requestId;
|
|
169
|
+
if (context?.userId)
|
|
170
|
+
tags.user_id = context.userId;
|
|
171
|
+
if (context?.path)
|
|
172
|
+
tags.path = context.path;
|
|
173
|
+
if (context?.method)
|
|
174
|
+
tags.method = context.method;
|
|
175
|
+
// Build extra context (non-indexed, rich data)
|
|
176
|
+
const extra = {
|
|
177
|
+
value: alert.value,
|
|
178
|
+
threshold: alert.threshold,
|
|
179
|
+
timestamp: alert.timestamp,
|
|
180
|
+
};
|
|
181
|
+
// Add full request context for debugging
|
|
182
|
+
if (context) {
|
|
183
|
+
extra.request_context = {
|
|
184
|
+
requestId: context.requestId,
|
|
185
|
+
startTime: context.startTime,
|
|
186
|
+
duration: Date.now() - context.startTime,
|
|
187
|
+
userId: context.userId,
|
|
188
|
+
path: context.path,
|
|
189
|
+
method: context.method,
|
|
190
|
+
ip: context.ip,
|
|
191
|
+
userAgent: context.userAgent,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
// Set user context if available (for Sentry user tracking)
|
|
195
|
+
if (context?.userId) {
|
|
196
|
+
this.sentryClient.setUser({
|
|
197
|
+
id: context.userId,
|
|
198
|
+
ip_address: context.ip,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
// Capture the alert as a Sentry event
|
|
202
|
+
this.sentryClient.captureMessage(alert.message, {
|
|
203
|
+
level: 'error',
|
|
204
|
+
tags,
|
|
205
|
+
extra,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
// Sentry error, log and continue
|
|
210
|
+
logger.debug('Sentry not available for alert delivery', { error });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Start aggregation timer
|
|
215
|
+
*/
|
|
216
|
+
startAggregation() {
|
|
217
|
+
if (this.aggregationTimer)
|
|
218
|
+
return;
|
|
219
|
+
this.aggregationTimer = setInterval(() => {
|
|
220
|
+
this.flushAlerts();
|
|
221
|
+
}, this.config.aggregationInterval);
|
|
222
|
+
// Don't keep process alive
|
|
223
|
+
this.aggregationTimer.unref();
|
|
224
|
+
this.lastAggregationTime = Date.now();
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Flush aggregated alerts
|
|
228
|
+
*/
|
|
229
|
+
flushAlerts() {
|
|
230
|
+
if (this.alertQueue.length === 0)
|
|
231
|
+
return;
|
|
232
|
+
// Group alerts by metric and level
|
|
233
|
+
const grouped = new Map();
|
|
234
|
+
for (const alert of this.alertQueue) {
|
|
235
|
+
const key = `${alert.metric}:${alert.level}`;
|
|
236
|
+
const existing = grouped.get(key) || [];
|
|
237
|
+
existing.push(alert);
|
|
238
|
+
grouped.set(key, existing);
|
|
239
|
+
}
|
|
240
|
+
// Send aggregated alerts
|
|
241
|
+
for (const [_key, alerts] of Array.from(grouped.entries())) {
|
|
242
|
+
if (alerts.length === 0)
|
|
243
|
+
continue;
|
|
244
|
+
const first = alerts[0];
|
|
245
|
+
if (!first)
|
|
246
|
+
continue;
|
|
247
|
+
const count = alerts.length;
|
|
248
|
+
const avgValue = alerts.reduce((sum, a) => sum + a.value, 0) / count;
|
|
249
|
+
const aggregatedAlert = {
|
|
250
|
+
level: first.level,
|
|
251
|
+
metric: first.metric,
|
|
252
|
+
value: first.value,
|
|
253
|
+
threshold: first.threshold,
|
|
254
|
+
message: `${first.message} (occurred ${count} times, avg value: ${Math.round(avgValue)})`,
|
|
255
|
+
timestamp: Date.now(),
|
|
256
|
+
};
|
|
257
|
+
this.deliverAlert(aggregatedAlert);
|
|
258
|
+
}
|
|
259
|
+
// Clear queue
|
|
260
|
+
this.alertQueue = [];
|
|
261
|
+
this.lastAggregationTime = Date.now();
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Stop aggregation timer
|
|
265
|
+
*/
|
|
266
|
+
stopAggregation() {
|
|
267
|
+
if (this.aggregationTimer) {
|
|
268
|
+
clearInterval(this.aggregationTimer);
|
|
269
|
+
this.aggregationTimer = null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Check if running in production
|
|
274
|
+
*/
|
|
275
|
+
isProduction() {
|
|
276
|
+
return process.env.NODE_ENV === 'production';
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Get alert queue stats
|
|
280
|
+
*/
|
|
281
|
+
getStats() {
|
|
282
|
+
return {
|
|
283
|
+
queueSize: this.alertQueue.length,
|
|
284
|
+
lastAggregationTime: this.lastAggregationTime,
|
|
285
|
+
aggregationEnabled: this.config.aggregateInProduction && this.isProduction(),
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Configure alert channels
|
|
290
|
+
*/
|
|
291
|
+
setChannels(channels) {
|
|
292
|
+
this.config.channels = channels;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Cleanup resources
|
|
296
|
+
*/
|
|
297
|
+
dispose() {
|
|
298
|
+
this.stopAggregation();
|
|
299
|
+
this.flushAlerts(); // Flush remaining alerts
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Singleton instance
|
|
304
|
+
*/
|
|
305
|
+
export const alertManager = new AlertManager();
|
|
306
|
+
/**
|
|
307
|
+
* Export AlertManager class for testing
|
|
308
|
+
*/
|
|
309
|
+
export { AlertManager };
|
|
310
|
+
/**
|
|
311
|
+
* Convenience functions
|
|
312
|
+
*/
|
|
313
|
+
export function sendAlert(alert) {
|
|
314
|
+
alertManager.sendAlert(alert);
|
|
315
|
+
}
|
|
316
|
+
export function sendAlerts(alerts) {
|
|
317
|
+
alertManager.sendAlerts(alerts);
|
|
318
|
+
}
|
|
319
|
+
export function getAlertStats() {
|
|
320
|
+
return alertManager.getStats();
|
|
321
|
+
}
|
|
322
|
+
export function setAlertChannels(channels) {
|
|
323
|
+
alertManager.setChannels(channels);
|
|
324
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cleanup Manager
|
|
3
|
+
*
|
|
4
|
+
* Global cleanup handler registry and graceful shutdown coordination.
|
|
5
|
+
* Ensures all resources are properly released when the process exits.
|
|
6
|
+
*/
|
|
7
|
+
import type { CleanupHandler, CleanupRegistration } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Cleanup manager class
|
|
10
|
+
*/
|
|
11
|
+
declare class CleanupManager {
|
|
12
|
+
private handlers;
|
|
13
|
+
private isShuttingDown;
|
|
14
|
+
private shutdownTimeout;
|
|
15
|
+
private signalHandlersRegistered;
|
|
16
|
+
/**
|
|
17
|
+
* Register a cleanup handler
|
|
18
|
+
*/
|
|
19
|
+
register(id: string, handler: CleanupHandler, description: string, priority?: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Unregister a cleanup handler
|
|
22
|
+
*/
|
|
23
|
+
unregister(id: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Execute all cleanup handlers
|
|
26
|
+
*/
|
|
27
|
+
cleanup(signal?: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Execute cleanup handlers in sequence
|
|
30
|
+
*/
|
|
31
|
+
private executeHandlers;
|
|
32
|
+
/**
|
|
33
|
+
* Register signal handlers for graceful shutdown
|
|
34
|
+
*/
|
|
35
|
+
private registerSignalHandlers;
|
|
36
|
+
/**
|
|
37
|
+
* Force immediate cleanup (skip timeout)
|
|
38
|
+
*/
|
|
39
|
+
forceCleanup(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Get registered handlers
|
|
42
|
+
*/
|
|
43
|
+
getHandlers(): CleanupRegistration[];
|
|
44
|
+
/**
|
|
45
|
+
* Check if shutdown is in progress
|
|
46
|
+
*/
|
|
47
|
+
isShutdownInProgress(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Set shutdown timeout
|
|
50
|
+
*/
|
|
51
|
+
setShutdownTimeout(ms: number): void;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all handlers
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Singleton instance
|
|
59
|
+
*/
|
|
60
|
+
export declare const cleanupManager: CleanupManager;
|
|
61
|
+
/**
|
|
62
|
+
* Convenience functions
|
|
63
|
+
*/
|
|
64
|
+
export declare function registerCleanupHandler(id: string, handler: CleanupHandler, description: string, priority?: number): void;
|
|
65
|
+
export declare function unregisterCleanupHandler(id: string): void;
|
|
66
|
+
export declare function initiateCleanup(signal?: string): Promise<void>;
|
|
67
|
+
export declare function forceCleanup(): Promise<void>;
|
|
68
|
+
export declare function getCleanupHandlers(): CleanupRegistration[];
|
|
69
|
+
export declare function isShutdownInProgress(): boolean;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=cleanup-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup-manager.d.ts","sourceRoot":"","sources":["../../src/monitoring/cleanup-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErE;;GAEG;AACH,cAAM,cAAc;IAClB,OAAO,CAAC,QAAQ,CAA8C;IAC9D,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,wBAAwB,CAAQ;IAExC;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,IAAI;IAqBtF;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAM5B;;OAEG;IACG,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmD7C;;OAEG;YACW,eAAe;IAsC7B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAmD9B;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAWnC;;OAEG;IACH,WAAW,IAAI,mBAAmB,EAAE;IAIpC;;OAEG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;OAEG;IACH,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACH,KAAK,IAAI,IAAI;CAId;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,gBAAuB,CAAA;AAElD;;GAEG;AAEH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,SAAI,GACX,IAAI,CAEN;AAED,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D;AAED,wBAAgB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5C;AAED,wBAAgB,kBAAkB,IAAI,mBAAmB,EAAE,CAE1D;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
|