@revealui/core 0.0.1-pre.4 → 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 -724
- package/LICENSE_SUMMARY.md +0 -55
- package/NOTICE +0 -34
- 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 -5
- 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/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,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process Registry
|
|
3
|
+
*
|
|
4
|
+
* Central registry for tracking all spawned processes in the RevealUI system.
|
|
5
|
+
* Maintains process lifecycle information and provides query capabilities.
|
|
6
|
+
*/
|
|
7
|
+
import { DEFAULT_MONITORING_CONFIG } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Global process registry instance
|
|
10
|
+
*/
|
|
11
|
+
class ProcessRegistry {
|
|
12
|
+
processes = new Map();
|
|
13
|
+
enabled = DEFAULT_MONITORING_CONFIG.enabled;
|
|
14
|
+
maxHistorySize = DEFAULT_MONITORING_CONFIG.maxHistorySize;
|
|
15
|
+
/**
|
|
16
|
+
* Register a new process
|
|
17
|
+
*/
|
|
18
|
+
register(pid, command, args, source, metadata, ppid) {
|
|
19
|
+
if (!this.enabled)
|
|
20
|
+
return;
|
|
21
|
+
const process = {
|
|
22
|
+
pid,
|
|
23
|
+
command,
|
|
24
|
+
args,
|
|
25
|
+
source,
|
|
26
|
+
status: 'running',
|
|
27
|
+
startTime: Date.now(),
|
|
28
|
+
metadata,
|
|
29
|
+
ppid,
|
|
30
|
+
};
|
|
31
|
+
this.processes.set(pid, process);
|
|
32
|
+
this.trimHistory();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Update process status
|
|
36
|
+
*/
|
|
37
|
+
updateStatus(pid, status, exitCode, signal) {
|
|
38
|
+
if (!this.enabled)
|
|
39
|
+
return;
|
|
40
|
+
const process = this.processes.get(pid);
|
|
41
|
+
if (!process)
|
|
42
|
+
return;
|
|
43
|
+
process.status = status;
|
|
44
|
+
process.endTime = Date.now();
|
|
45
|
+
if (exitCode !== undefined) {
|
|
46
|
+
process.exitCode = exitCode;
|
|
47
|
+
}
|
|
48
|
+
if (signal !== undefined) {
|
|
49
|
+
process.signal = signal;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Mark process as zombie
|
|
54
|
+
*/
|
|
55
|
+
markZombie(pid) {
|
|
56
|
+
this.updateStatus(pid, 'zombie');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get process by PID
|
|
60
|
+
*/
|
|
61
|
+
get(pid) {
|
|
62
|
+
return this.processes.get(pid);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get all processes
|
|
66
|
+
*/
|
|
67
|
+
getAll() {
|
|
68
|
+
return Array.from(this.processes.values());
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get processes by status
|
|
72
|
+
*/
|
|
73
|
+
getByStatus(status) {
|
|
74
|
+
return this.getAll().filter((p) => p.status === status);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get processes by source
|
|
78
|
+
*/
|
|
79
|
+
getBySource(source) {
|
|
80
|
+
return this.getAll().filter((p) => p.source === source);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get running processes
|
|
84
|
+
*/
|
|
85
|
+
getRunning() {
|
|
86
|
+
return this.getByStatus('running');
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get zombie processes
|
|
90
|
+
*/
|
|
91
|
+
getZombies() {
|
|
92
|
+
return this.getByStatus('zombie');
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get failed processes
|
|
96
|
+
*/
|
|
97
|
+
getFailed() {
|
|
98
|
+
return this.getByStatus('failed');
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get registry statistics
|
|
102
|
+
*/
|
|
103
|
+
getStats() {
|
|
104
|
+
const all = this.getAll();
|
|
105
|
+
const bySource = {
|
|
106
|
+
exec: 0,
|
|
107
|
+
orchestration: 0,
|
|
108
|
+
mcp: 0,
|
|
109
|
+
'ai-runtime': 0,
|
|
110
|
+
'dev-server': 0,
|
|
111
|
+
database: 0,
|
|
112
|
+
unknown: 0,
|
|
113
|
+
};
|
|
114
|
+
for (const process of all) {
|
|
115
|
+
bySource[process.source]++;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
total: all.length,
|
|
119
|
+
running: this.getByStatus('running').length,
|
|
120
|
+
completed: this.getByStatus('completed').length,
|
|
121
|
+
failed: this.getByStatus('failed').length,
|
|
122
|
+
zombies: this.getByStatus('zombie').length,
|
|
123
|
+
killed: this.getByStatus('killed').length,
|
|
124
|
+
bySource,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Calculate spawn rate (processes per minute)
|
|
129
|
+
*/
|
|
130
|
+
getSpawnRate() {
|
|
131
|
+
const now = Date.now();
|
|
132
|
+
const oneMinuteAgo = now - 60_000;
|
|
133
|
+
const recentProcesses = this.getAll().filter((p) => p.startTime >= oneMinuteAgo);
|
|
134
|
+
return recentProcesses.length;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Clear completed/failed processes older than retention period
|
|
138
|
+
*/
|
|
139
|
+
trimHistory() {
|
|
140
|
+
if (this.processes.size <= this.maxHistorySize)
|
|
141
|
+
return;
|
|
142
|
+
const processArray = Array.from(this.processes.entries());
|
|
143
|
+
// Sort by end time (oldest first), then start time
|
|
144
|
+
processArray.sort(([, a], [, b]) => {
|
|
145
|
+
const aTime = a.endTime || a.startTime;
|
|
146
|
+
const bTime = b.endTime || b.startTime;
|
|
147
|
+
return aTime - bTime;
|
|
148
|
+
});
|
|
149
|
+
// Keep only running processes and recent completed/failed
|
|
150
|
+
const toKeep = new Map();
|
|
151
|
+
let keptCount = 0;
|
|
152
|
+
// First pass: keep all running and zombie processes
|
|
153
|
+
for (const [pid, process] of processArray) {
|
|
154
|
+
if (process.status === 'running' || process.status === 'zombie') {
|
|
155
|
+
toKeep.set(pid, process);
|
|
156
|
+
keptCount++;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Second pass: keep most recent completed/failed up to limit
|
|
160
|
+
for (const [pid, process] of processArray.reverse()) {
|
|
161
|
+
if (keptCount >= this.maxHistorySize)
|
|
162
|
+
break;
|
|
163
|
+
if (process.status !== 'running' && process.status !== 'zombie' && !toKeep.has(pid)) {
|
|
164
|
+
toKeep.set(pid, process);
|
|
165
|
+
keptCount++;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
this.processes = toKeep;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Clear all processes
|
|
172
|
+
*/
|
|
173
|
+
clear() {
|
|
174
|
+
this.processes.clear();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Enable or disable tracking
|
|
178
|
+
*/
|
|
179
|
+
setEnabled(enabled) {
|
|
180
|
+
this.enabled = enabled;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Check if tracking is enabled
|
|
184
|
+
*/
|
|
185
|
+
isEnabled() {
|
|
186
|
+
return this.enabled;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Singleton instance
|
|
191
|
+
*/
|
|
192
|
+
export const processRegistry = new ProcessRegistry();
|
|
193
|
+
/**
|
|
194
|
+
* Convenience functions
|
|
195
|
+
*/
|
|
196
|
+
export function registerProcess(pid, command, args, source, metadata, ppid) {
|
|
197
|
+
processRegistry.register(pid, command, args, source, metadata, ppid);
|
|
198
|
+
}
|
|
199
|
+
export function updateProcessStatus(pid, status, exitCode, signal) {
|
|
200
|
+
processRegistry.updateStatus(pid, status, exitCode, signal);
|
|
201
|
+
}
|
|
202
|
+
export function markProcessZombie(pid) {
|
|
203
|
+
processRegistry.markZombie(pid);
|
|
204
|
+
}
|
|
205
|
+
export function getProcess(pid) {
|
|
206
|
+
return processRegistry.get(pid);
|
|
207
|
+
}
|
|
208
|
+
export function getAllProcesses() {
|
|
209
|
+
return processRegistry.getAll();
|
|
210
|
+
}
|
|
211
|
+
export function getRunningProcesses() {
|
|
212
|
+
return processRegistry.getRunning();
|
|
213
|
+
}
|
|
214
|
+
export function getZombieProcesses() {
|
|
215
|
+
return processRegistry.getZombies();
|
|
216
|
+
}
|
|
217
|
+
export function getProcessStats() {
|
|
218
|
+
return processRegistry.getStats();
|
|
219
|
+
}
|
|
220
|
+
export function getSpawnRate() {
|
|
221
|
+
return processRegistry.getSpawnRate();
|
|
222
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database Query Performance Monitoring
|
|
3
|
+
*
|
|
4
|
+
* Tracks query execution time and logs slow queries
|
|
5
|
+
*/
|
|
6
|
+
interface QueryMetric {
|
|
7
|
+
name: string;
|
|
8
|
+
duration: number;
|
|
9
|
+
success: boolean;
|
|
10
|
+
error?: unknown;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
}
|
|
13
|
+
interface SlowQueryLog {
|
|
14
|
+
query: string;
|
|
15
|
+
duration: number;
|
|
16
|
+
parameters?: unknown[];
|
|
17
|
+
timestamp: number;
|
|
18
|
+
stackTrace?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Monitor a database query execution
|
|
22
|
+
*/
|
|
23
|
+
export declare function monitorQuery<T>(name: string, queryFn: () => Promise<T>): Promise<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Log slow query
|
|
26
|
+
*/
|
|
27
|
+
export declare function logSlowQuery(query: string, duration: number, parameters?: unknown[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get query statistics
|
|
30
|
+
*/
|
|
31
|
+
export declare function getQueryStats(): {
|
|
32
|
+
totalQueries: number;
|
|
33
|
+
avgDuration: number;
|
|
34
|
+
maxDuration: number;
|
|
35
|
+
minDuration: number;
|
|
36
|
+
successRate: number;
|
|
37
|
+
slowQueries: number;
|
|
38
|
+
slowQueryRate?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
totalQueries: number;
|
|
41
|
+
avgDuration: number;
|
|
42
|
+
maxDuration: number;
|
|
43
|
+
minDuration: number;
|
|
44
|
+
successRate: number;
|
|
45
|
+
slowQueries: number;
|
|
46
|
+
slowQueryRate: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Get slow query logs
|
|
50
|
+
*/
|
|
51
|
+
export declare function getSlowQueries(): SlowQueryLog[];
|
|
52
|
+
/**
|
|
53
|
+
* Get queries by name
|
|
54
|
+
*/
|
|
55
|
+
export declare function getQueriesByName(name: string): QueryMetric[];
|
|
56
|
+
/**
|
|
57
|
+
* Get query percentiles
|
|
58
|
+
*/
|
|
59
|
+
export declare function getQueryPercentiles(): {
|
|
60
|
+
p50: number;
|
|
61
|
+
p95: number;
|
|
62
|
+
p99: number;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Clear all metrics
|
|
66
|
+
*/
|
|
67
|
+
export declare function clearQueryMetrics(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get query report
|
|
70
|
+
*/
|
|
71
|
+
export declare function getQueryReport(): {
|
|
72
|
+
summary: {
|
|
73
|
+
percentiles: {
|
|
74
|
+
p50: number;
|
|
75
|
+
p95: number;
|
|
76
|
+
p99: number;
|
|
77
|
+
};
|
|
78
|
+
totalQueries: number;
|
|
79
|
+
avgDuration: number;
|
|
80
|
+
maxDuration: number;
|
|
81
|
+
minDuration: number;
|
|
82
|
+
successRate: number;
|
|
83
|
+
slowQueries: number;
|
|
84
|
+
slowQueryRate?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
percentiles: {
|
|
87
|
+
p50: number;
|
|
88
|
+
p95: number;
|
|
89
|
+
p99: number;
|
|
90
|
+
};
|
|
91
|
+
totalQueries: number;
|
|
92
|
+
avgDuration: number;
|
|
93
|
+
maxDuration: number;
|
|
94
|
+
minDuration: number;
|
|
95
|
+
successRate: number;
|
|
96
|
+
slowQueries: number;
|
|
97
|
+
slowQueryRate: number;
|
|
98
|
+
};
|
|
99
|
+
slowQueries: SlowQueryLog[];
|
|
100
|
+
topQueries: {
|
|
101
|
+
name: string;
|
|
102
|
+
count: number;
|
|
103
|
+
totalDuration: number;
|
|
104
|
+
avgDuration: number;
|
|
105
|
+
}[];
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Create query wrapper with automatic monitoring
|
|
109
|
+
*/
|
|
110
|
+
export declare function createMonitoredQuery<T extends (...args: unknown[]) => Promise<unknown>>(name: string, queryFn: T): T;
|
|
111
|
+
/**
|
|
112
|
+
* Measure query execution time
|
|
113
|
+
*/
|
|
114
|
+
export declare function measureQuery<T>(query: () => Promise<T>): Promise<{
|
|
115
|
+
result: T;
|
|
116
|
+
duration: number;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Export metrics for external monitoring
|
|
120
|
+
*/
|
|
121
|
+
export declare function exportMetrics(): {
|
|
122
|
+
queries: {
|
|
123
|
+
percentiles: {
|
|
124
|
+
p50: number;
|
|
125
|
+
p95: number;
|
|
126
|
+
p99: number;
|
|
127
|
+
};
|
|
128
|
+
totalQueries: number;
|
|
129
|
+
avgDuration: number;
|
|
130
|
+
maxDuration: number;
|
|
131
|
+
minDuration: number;
|
|
132
|
+
successRate: number;
|
|
133
|
+
slowQueries: number;
|
|
134
|
+
slowQueryRate?: undefined;
|
|
135
|
+
} | {
|
|
136
|
+
percentiles: {
|
|
137
|
+
p50: number;
|
|
138
|
+
p95: number;
|
|
139
|
+
p99: number;
|
|
140
|
+
};
|
|
141
|
+
totalQueries: number;
|
|
142
|
+
avgDuration: number;
|
|
143
|
+
maxDuration: number;
|
|
144
|
+
minDuration: number;
|
|
145
|
+
successRate: number;
|
|
146
|
+
slowQueries: number;
|
|
147
|
+
slowQueryRate: number;
|
|
148
|
+
};
|
|
149
|
+
slowQueries: number;
|
|
150
|
+
timestamp: number;
|
|
151
|
+
};
|
|
152
|
+
export {};
|
|
153
|
+
//# sourceMappingURL=query-monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-monitor.d.ts","sourceRoot":"","sources":["../../src/monitoring/query-monitor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,EAAE,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAUD;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAgCzF;AAcD;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAqB1F;AAED;;GAEG;AACH,wBAAgB,aAAa;;;;;;;;;;;;;;;;EAyB5B;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,YAAY,EAAE,CAE/C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAE5D;AAED;;GAEG;AACH,wBAAgB,mBAAmB;;;;EAgBlC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC;AAED;;GAEG;AACH,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa7B;AA8BD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EACrF,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,GACT,CAAC,CAIH;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAM1C;AAED;;GAEG;AACH,wBAAgB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5B"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database Query Performance Monitoring
|
|
3
|
+
*
|
|
4
|
+
* Tracks query execution time and logs slow queries
|
|
5
|
+
*/
|
|
6
|
+
import { logger } from '../observability/logger.js';
|
|
7
|
+
const queryMetrics = [];
|
|
8
|
+
const slowQueryLogs = [];
|
|
9
|
+
// Configuration
|
|
10
|
+
const SLOW_QUERY_THRESHOLD = 100; // milliseconds
|
|
11
|
+
const MAX_METRICS_STORED = 1000;
|
|
12
|
+
const MAX_SLOW_QUERIES_STORED = 100;
|
|
13
|
+
/**
|
|
14
|
+
* Monitor a database query execution
|
|
15
|
+
*/
|
|
16
|
+
export async function monitorQuery(name, queryFn) {
|
|
17
|
+
const start = Date.now();
|
|
18
|
+
try {
|
|
19
|
+
const result = await queryFn();
|
|
20
|
+
const duration = Date.now() - start;
|
|
21
|
+
recordQueryMetric({
|
|
22
|
+
name,
|
|
23
|
+
duration,
|
|
24
|
+
success: true,
|
|
25
|
+
timestamp: start,
|
|
26
|
+
});
|
|
27
|
+
if (duration > SLOW_QUERY_THRESHOLD) {
|
|
28
|
+
logger.warn('Slow query detected', { query: name, duration });
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const duration = Date.now() - start;
|
|
34
|
+
recordQueryMetric({
|
|
35
|
+
name,
|
|
36
|
+
duration,
|
|
37
|
+
success: false,
|
|
38
|
+
error,
|
|
39
|
+
timestamp: start,
|
|
40
|
+
});
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Record query metric
|
|
46
|
+
*/
|
|
47
|
+
function recordQueryMetric(metric) {
|
|
48
|
+
queryMetrics.push(metric);
|
|
49
|
+
// Limit stored metrics
|
|
50
|
+
if (queryMetrics.length > MAX_METRICS_STORED) {
|
|
51
|
+
queryMetrics.shift();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Log slow query
|
|
56
|
+
*/
|
|
57
|
+
export function logSlowQuery(query, duration, parameters) {
|
|
58
|
+
const log = {
|
|
59
|
+
query,
|
|
60
|
+
duration,
|
|
61
|
+
parameters,
|
|
62
|
+
timestamp: Date.now(),
|
|
63
|
+
stackTrace: new Error().stack,
|
|
64
|
+
};
|
|
65
|
+
slowQueryLogs.push(log);
|
|
66
|
+
// Limit stored logs
|
|
67
|
+
if (slowQueryLogs.length > MAX_SLOW_QUERIES_STORED) {
|
|
68
|
+
slowQueryLogs.shift();
|
|
69
|
+
}
|
|
70
|
+
logger.warn('Slow query logged', {
|
|
71
|
+
query,
|
|
72
|
+
duration,
|
|
73
|
+
parameters,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get query statistics
|
|
78
|
+
*/
|
|
79
|
+
export function getQueryStats() {
|
|
80
|
+
if (queryMetrics.length === 0) {
|
|
81
|
+
return {
|
|
82
|
+
totalQueries: 0,
|
|
83
|
+
avgDuration: 0,
|
|
84
|
+
maxDuration: 0,
|
|
85
|
+
minDuration: 0,
|
|
86
|
+
successRate: 0,
|
|
87
|
+
slowQueries: 0,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const durations = queryMetrics.map((m) => m.duration);
|
|
91
|
+
const successCount = queryMetrics.filter((m) => m.success).length;
|
|
92
|
+
const slowQueriesCount = queryMetrics.filter((m) => m.duration > SLOW_QUERY_THRESHOLD).length;
|
|
93
|
+
return {
|
|
94
|
+
totalQueries: queryMetrics.length,
|
|
95
|
+
avgDuration: durations.reduce((a, b) => a + b, 0) / durations.length,
|
|
96
|
+
maxDuration: Math.max(...durations),
|
|
97
|
+
minDuration: Math.min(...durations),
|
|
98
|
+
successRate: (successCount / queryMetrics.length) * 100,
|
|
99
|
+
slowQueries: slowQueriesCount,
|
|
100
|
+
slowQueryRate: (slowQueriesCount / queryMetrics.length) * 100,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get slow query logs
|
|
105
|
+
*/
|
|
106
|
+
export function getSlowQueries() {
|
|
107
|
+
return [...slowQueryLogs].sort((a, b) => b.duration - a.duration);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get queries by name
|
|
111
|
+
*/
|
|
112
|
+
export function getQueriesByName(name) {
|
|
113
|
+
return queryMetrics.filter((m) => m.name === name);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get query percentiles
|
|
117
|
+
*/
|
|
118
|
+
export function getQueryPercentiles() {
|
|
119
|
+
if (queryMetrics.length === 0) {
|
|
120
|
+
return { p50: 0, p95: 0, p99: 0 };
|
|
121
|
+
}
|
|
122
|
+
const sortedDurations = queryMetrics.map((m) => m.duration).sort((a, b) => a - b);
|
|
123
|
+
const p50Index = Math.floor(sortedDurations.length * 0.5);
|
|
124
|
+
const p95Index = Math.floor(sortedDurations.length * 0.95);
|
|
125
|
+
const p99Index = Math.floor(sortedDurations.length * 0.99);
|
|
126
|
+
return {
|
|
127
|
+
p50: sortedDurations[p50Index] || 0,
|
|
128
|
+
p95: sortedDurations[p95Index] || 0,
|
|
129
|
+
p99: sortedDurations[p99Index] || 0,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Clear all metrics
|
|
134
|
+
*/
|
|
135
|
+
export function clearQueryMetrics() {
|
|
136
|
+
queryMetrics.length = 0;
|
|
137
|
+
slowQueryLogs.length = 0;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get query report
|
|
141
|
+
*/
|
|
142
|
+
export function getQueryReport() {
|
|
143
|
+
const stats = getQueryStats();
|
|
144
|
+
const percentiles = getQueryPercentiles();
|
|
145
|
+
const slowQueries = getSlowQueries().slice(0, 10); // Top 10 slowest
|
|
146
|
+
return {
|
|
147
|
+
summary: {
|
|
148
|
+
...stats,
|
|
149
|
+
percentiles,
|
|
150
|
+
},
|
|
151
|
+
slowQueries,
|
|
152
|
+
topQueries: getTopQueriesByDuration(),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get top queries by total duration
|
|
157
|
+
*/
|
|
158
|
+
function getTopQueriesByDuration() {
|
|
159
|
+
const queryGroups = new Map();
|
|
160
|
+
for (const metric of queryMetrics) {
|
|
161
|
+
const existing = queryGroups.get(metric.name) || {
|
|
162
|
+
count: 0,
|
|
163
|
+
totalDuration: 0,
|
|
164
|
+
};
|
|
165
|
+
queryGroups.set(metric.name, {
|
|
166
|
+
count: existing.count + 1,
|
|
167
|
+
totalDuration: existing.totalDuration + metric.duration,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return Array.from(queryGroups.entries())
|
|
171
|
+
.map(([name, data]) => ({
|
|
172
|
+
name,
|
|
173
|
+
count: data.count,
|
|
174
|
+
totalDuration: data.totalDuration,
|
|
175
|
+
avgDuration: data.totalDuration / data.count,
|
|
176
|
+
}))
|
|
177
|
+
.sort((a, b) => b.totalDuration - a.totalDuration)
|
|
178
|
+
.slice(0, 10);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Create query wrapper with automatic monitoring
|
|
182
|
+
*/
|
|
183
|
+
export function createMonitoredQuery(name, queryFn) {
|
|
184
|
+
return (async (...args) => {
|
|
185
|
+
return monitorQuery(name, () => queryFn(...args));
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Measure query execution time
|
|
190
|
+
*/
|
|
191
|
+
export async function measureQuery(query) {
|
|
192
|
+
const start = Date.now();
|
|
193
|
+
const result = await query();
|
|
194
|
+
const duration = Date.now() - start;
|
|
195
|
+
return { result, duration };
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Export metrics for external monitoring
|
|
199
|
+
*/
|
|
200
|
+
export function exportMetrics() {
|
|
201
|
+
return {
|
|
202
|
+
queries: {
|
|
203
|
+
...getQueryStats(),
|
|
204
|
+
percentiles: getQueryPercentiles(),
|
|
205
|
+
},
|
|
206
|
+
slowQueries: getSlowQueries().length,
|
|
207
|
+
timestamp: Date.now(),
|
|
208
|
+
};
|
|
209
|
+
}
|