@revealui/core 0.0.0-canary-20260409021642
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 -0
- package/README.md +171 -0
- 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 +114 -0
- package/dist/api/rate-limit.d.ts.map +1 -0
- package/dist/api/rate-limit.js +376 -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 +465 -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 +100 -0
- package/dist/cache/query-cache.d.ts.map +1 -0
- package/dist/cache/query-cache.js +266 -0
- package/dist/caching/index.d.ts +6 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +5 -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 +308 -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 +223 -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/context/ServerFunctionContext.d.ts +8 -0
- package/dist/client/admin/context/ServerFunctionContext.d.ts.map +1 -0
- package/dist/client/admin/context/ServerFunctionContext.js +15 -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 +11 -0
- package/dist/client/admin/index.d.ts.map +1 -0
- package/dist/client/admin/index.js +11 -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 +7 -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 +216 -0
- package/dist/client/admin/utils/index.d.ts +5 -0
- package/dist/client/admin/utils/index.d.ts.map +1 -0
- package/dist/client/admin/utils/index.js +4 -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/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +13 -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 +98 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts +13 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageUploadButton.js +118 -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 +246 -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 +48 -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 +9 -0
- package/dist/collections/operations/create.d.ts.map +1 -0
- package/dist/collections/operations/create.js +130 -0
- package/dist/collections/operations/createMany.d.ts +12 -0
- package/dist/collections/operations/createMany.d.ts.map +1 -0
- package/dist/collections/operations/createMany.js +43 -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 +45 -0
- package/dist/collections/operations/deleteMany.d.ts +11 -0
- package/dist/collections/operations/deleteMany.d.ts.map +1 -0
- package/dist/collections/operations/deleteMany.js +50 -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 +8 -0
- package/dist/collections/operations/find.d.ts.map +1 -0
- package/dist/collections/operations/find.js +231 -0
- package/dist/collections/operations/findById.d.ts +14 -0
- package/dist/collections/operations/findById.d.ts.map +1 -0
- package/dist/collections/operations/findById.js +111 -0
- package/dist/collections/operations/sqlAdapter.d.ts +23 -0
- package/dist/collections/operations/sqlAdapter.d.ts.map +1 -0
- package/dist/collections/operations/sqlAdapter.js +108 -0
- package/dist/collections/operations/update.d.ts +8 -0
- package/dist/collections/operations/update.d.ts.map +1 -0
- package/dist/collections/operations/update.js +226 -0
- package/dist/collections/operations/updateMany.d.ts +11 -0
- package/dist/collections/operations/updateMany.d.ts.map +1 -0
- package/dist/collections/operations/updateMany.js +52 -0
- package/dist/collections/registry.d.ts +12 -0
- package/dist/collections/registry.d.ts.map +1 -0
- package/dist/collections/registry.js +38 -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 +2 -0
- package/dist/config/utils.d.ts.map +1 -0
- package/dist/config/utils.js +21 -0
- package/dist/database/index.d.ts +4 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +2 -0
- package/dist/database/safe-parse.d.ts +26 -0
- package/dist/database/safe-parse.d.ts.map +1 -0
- package/dist/database/safe-parse.js +42 -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 +531 -0
- package/dist/dataloader.d.ts +26 -0
- package/dist/dataloader.d.ts.map +1 -0
- package/dist/dataloader.js +176 -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 +214 -0
- package/dist/error-handling/error-reporter.d.ts.map +1 -0
- package/dist/error-handling/error-reporter.js +491 -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 +14 -0
- package/dist/error-handling/index.d.ts.map +1 -0
- package/dist/error-handling/index.js +12 -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 +88 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +105 -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/index.d.ts +10 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +9 -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 +11 -0
- package/dist/generated/types/index.d.ts +16 -0
- package/dist/generated/types/index.d.ts.map +1 -0
- package/dist/generated/types/index.js +21 -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 +13 -0
- package/dist/globals/GlobalOperations.d.ts +24 -0
- package/dist/globals/GlobalOperations.d.ts.map +1 -0
- package/dist/globals/GlobalOperations.js +165 -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 +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +136 -0
- package/dist/instance/RevealUIInstance.d.ts +6 -0
- package/dist/instance/RevealUIInstance.d.ts.map +1 -0
- package/dist/instance/RevealUIInstance.js +293 -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 +20 -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 +20 -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 +34 -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/jobs/index.d.ts +16 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +14 -0
- package/dist/jobs/queue.d.ts +57 -0
- package/dist/jobs/queue.d.ts.map +1 -0
- package/dist/jobs/queue.js +134 -0
- package/dist/license-encryption.d.ts +21 -0
- package/dist/license-encryption.d.ts.map +1 -0
- package/dist/license-encryption.js +74 -0
- package/dist/license.d.ts +99 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +262 -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 +236 -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 +389 -0
- package/dist/observability/health-check.d.ts +91 -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 +380 -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 +12 -0
- package/dist/plugins/nested-docs.d.ts.map +1 -0
- package/dist/plugins/nested-docs.js +111 -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 +276 -0
- package/dist/relationships/analyzer.d.ts +39 -0
- package/dist/relationships/analyzer.d.ts.map +1 -0
- package/dist/relationships/analyzer.js +135 -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-core.d.ts +57 -0
- package/dist/relationships/populate-core.d.ts.map +1 -0
- package/dist/relationships/populate-core.js +116 -0
- package/dist/relationships/populate-helpers.d.ts +58 -0
- package/dist/relationships/populate-helpers.d.ts.map +1 -0
- package/dist/relationships/populate-helpers.js +82 -0
- package/dist/relationships/population.d.ts +34 -0
- package/dist/relationships/population.d.ts.map +1 -0
- package/dist/relationships/population.js +193 -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 +134 -0
- package/dist/richtext/exports/server/rsc.d.ts.map +1 -0
- package/dist/richtext/exports/server/rsc.js +344 -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/index.d.ts +6 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +5 -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 +2 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +2 -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 +86 -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 +12 -0
- package/dist/types/generated.d.ts.map +1 -0
- package/dist/types/generated.js +10 -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 +275 -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 +114 -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 +95 -0
- package/dist/utils/errors.d.ts +133 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +500 -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 +22 -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/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/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 +302 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health Check System
|
|
3
|
+
*
|
|
4
|
+
* Provides health and readiness checks for the application
|
|
5
|
+
*/
|
|
6
|
+
import { execFile } from 'node:child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
8
|
+
import { logger } from './logger.js';
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
10
|
+
export class HealthCheckSystem {
|
|
11
|
+
checks = new Map();
|
|
12
|
+
startTime = Date.now();
|
|
13
|
+
/**
|
|
14
|
+
* Register a health check
|
|
15
|
+
*/
|
|
16
|
+
register(check) {
|
|
17
|
+
this.checks.set(check.name, check);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Unregister a health check
|
|
21
|
+
*/
|
|
22
|
+
unregister(name) {
|
|
23
|
+
this.checks.delete(name);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Run all health checks
|
|
27
|
+
*/
|
|
28
|
+
async checkHealth() {
|
|
29
|
+
const results = {};
|
|
30
|
+
let overallStatus = 'healthy';
|
|
31
|
+
for (const [name, check] of this.checks) {
|
|
32
|
+
const startTime = Date.now();
|
|
33
|
+
try {
|
|
34
|
+
const timeout = check.timeout || 5000;
|
|
35
|
+
const result = await this.runWithTimeout(check.check(), timeout);
|
|
36
|
+
results[name] = {
|
|
37
|
+
...result,
|
|
38
|
+
duration: Date.now() - startTime,
|
|
39
|
+
timestamp: new Date().toISOString(),
|
|
40
|
+
};
|
|
41
|
+
// Update overall status
|
|
42
|
+
if (check.critical && result.status === 'unhealthy') {
|
|
43
|
+
overallStatus = 'unhealthy';
|
|
44
|
+
}
|
|
45
|
+
else if (result.status === 'degraded' && overallStatus === 'healthy') {
|
|
46
|
+
overallStatus = 'degraded';
|
|
47
|
+
}
|
|
48
|
+
else if (result.status === 'unhealthy' && overallStatus !== 'unhealthy') {
|
|
49
|
+
overallStatus = 'degraded';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const duration = Date.now() - startTime;
|
|
54
|
+
results[name] = {
|
|
55
|
+
status: 'unhealthy',
|
|
56
|
+
message: error instanceof Error ? error.message : 'Check failed',
|
|
57
|
+
duration,
|
|
58
|
+
timestamp: new Date().toISOString(),
|
|
59
|
+
};
|
|
60
|
+
if (check.critical) {
|
|
61
|
+
overallStatus = 'unhealthy';
|
|
62
|
+
}
|
|
63
|
+
else if (overallStatus === 'healthy') {
|
|
64
|
+
overallStatus = 'degraded';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
status: overallStatus,
|
|
70
|
+
checks: results,
|
|
71
|
+
timestamp: new Date().toISOString(),
|
|
72
|
+
uptime: Date.now() - this.startTime,
|
|
73
|
+
version: process.env.APP_VERSION,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Run check with timeout
|
|
78
|
+
*/
|
|
79
|
+
async runWithTimeout(promise, timeoutMs) {
|
|
80
|
+
return Promise.race([
|
|
81
|
+
promise,
|
|
82
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Check timeout')), timeoutMs)),
|
|
83
|
+
]);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get uptime in seconds
|
|
87
|
+
*/
|
|
88
|
+
getUptime() {
|
|
89
|
+
return Math.floor((Date.now() - this.startTime) / 1000);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Default health check system
|
|
94
|
+
*/
|
|
95
|
+
export const healthCheck = new HealthCheckSystem();
|
|
96
|
+
/**
|
|
97
|
+
* Database health check
|
|
98
|
+
*/
|
|
99
|
+
export function createDatabaseHealthCheck(queryFn) {
|
|
100
|
+
return {
|
|
101
|
+
name: 'database',
|
|
102
|
+
critical: true,
|
|
103
|
+
timeout: 5000,
|
|
104
|
+
check: async () => {
|
|
105
|
+
const startTime = Date.now();
|
|
106
|
+
try {
|
|
107
|
+
await queryFn();
|
|
108
|
+
const duration = Date.now() - startTime;
|
|
109
|
+
return {
|
|
110
|
+
status: duration > 1000 ? 'degraded' : 'healthy',
|
|
111
|
+
message: duration > 1000 ? 'Database responding slowly' : 'Database healthy',
|
|
112
|
+
details: {
|
|
113
|
+
responseTime: duration,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
// Surface the root cause — Drizzle wraps Neon errors with "Failed query: ..."
|
|
119
|
+
// but the actual HTTP/connection error is in .cause
|
|
120
|
+
let message = error instanceof Error ? error.message : 'Database connection failed';
|
|
121
|
+
if (error instanceof Error && error.cause instanceof Error) {
|
|
122
|
+
message = `${message} | cause: ${error.cause.message}`;
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
status: 'unhealthy',
|
|
126
|
+
message,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Memory health check
|
|
134
|
+
*/
|
|
135
|
+
export function createMemoryHealthCheck(thresholdPercent = 90) {
|
|
136
|
+
return {
|
|
137
|
+
name: 'memory',
|
|
138
|
+
critical: false,
|
|
139
|
+
timeout: 1000,
|
|
140
|
+
check: async () => {
|
|
141
|
+
if (typeof process === 'undefined') {
|
|
142
|
+
return {
|
|
143
|
+
status: 'healthy',
|
|
144
|
+
message: 'Memory check not available',
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const usage = process.memoryUsage();
|
|
148
|
+
const usedPercent = (usage.heapUsed / usage.heapTotal) * 100;
|
|
149
|
+
let status = 'healthy';
|
|
150
|
+
let message = 'Memory usage normal';
|
|
151
|
+
if (usedPercent > thresholdPercent) {
|
|
152
|
+
status = 'unhealthy';
|
|
153
|
+
message = 'Memory usage critical';
|
|
154
|
+
}
|
|
155
|
+
else if (usedPercent > thresholdPercent * 0.8) {
|
|
156
|
+
status = 'degraded';
|
|
157
|
+
message = 'Memory usage high';
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
status,
|
|
161
|
+
message,
|
|
162
|
+
details: {
|
|
163
|
+
heapUsed: usage.heapUsed,
|
|
164
|
+
heapTotal: usage.heapTotal,
|
|
165
|
+
usedPercent: usedPercent.toFixed(2),
|
|
166
|
+
external: usage.external,
|
|
167
|
+
rss: usage.rss,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Disk health check
|
|
175
|
+
*/
|
|
176
|
+
export function createDiskHealthCheck(thresholdPercent = 90) {
|
|
177
|
+
return {
|
|
178
|
+
name: 'disk',
|
|
179
|
+
critical: false,
|
|
180
|
+
timeout: 2000,
|
|
181
|
+
check: async () => {
|
|
182
|
+
try {
|
|
183
|
+
const { stdout } = await execFileAsync('df', ['-P', '/']);
|
|
184
|
+
// df -P output: "Filesystem 1024-blocks Used Available Capacity% Mounted"
|
|
185
|
+
const lines = stdout.trim().split('\n');
|
|
186
|
+
const dataLine = lines[1];
|
|
187
|
+
if (!dataLine)
|
|
188
|
+
throw new Error('Unexpected df output format');
|
|
189
|
+
const parts = dataLine.split(/\s+/);
|
|
190
|
+
const usedPercent = Number.parseInt(parts[4] ?? '0', 10);
|
|
191
|
+
const availableKb = Number.parseInt(parts[3] ?? '0', 10);
|
|
192
|
+
const availableMb = Math.round(availableKb / 1024);
|
|
193
|
+
const status = usedPercent >= thresholdPercent
|
|
194
|
+
? 'unhealthy'
|
|
195
|
+
: usedPercent >= thresholdPercent - 10
|
|
196
|
+
? 'degraded'
|
|
197
|
+
: 'healthy';
|
|
198
|
+
return {
|
|
199
|
+
status,
|
|
200
|
+
message: status === 'healthy'
|
|
201
|
+
? `Disk usage ${usedPercent}% (${availableMb} MB free)`
|
|
202
|
+
: `Disk usage ${usedPercent}% exceeds threshold ${thresholdPercent}% (${availableMb} MB free)`,
|
|
203
|
+
details: { usedPercent, availableMb, thresholdPercent },
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
logger.warn('Disk health check failed', {
|
|
208
|
+
error: err instanceof Error ? err.message : String(err),
|
|
209
|
+
});
|
|
210
|
+
return {
|
|
211
|
+
status: 'degraded',
|
|
212
|
+
message: 'Disk check unavailable',
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* API endpoint health check
|
|
220
|
+
*/
|
|
221
|
+
export function createAPIHealthCheck(url, expectedStatus = 200) {
|
|
222
|
+
return {
|
|
223
|
+
name: `api:${url}`,
|
|
224
|
+
critical: false,
|
|
225
|
+
timeout: 10000,
|
|
226
|
+
check: async () => {
|
|
227
|
+
const startTime = Date.now();
|
|
228
|
+
try {
|
|
229
|
+
const response = await fetch(url);
|
|
230
|
+
const duration = Date.now() - startTime;
|
|
231
|
+
if (response.status !== expectedStatus) {
|
|
232
|
+
return {
|
|
233
|
+
status: 'unhealthy',
|
|
234
|
+
message: `API returned ${response.status}, expected ${expectedStatus}`,
|
|
235
|
+
details: {
|
|
236
|
+
status: response.status,
|
|
237
|
+
responseTime: duration,
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
status: duration > 2000 ? 'degraded' : 'healthy',
|
|
243
|
+
message: duration > 2000 ? 'API responding slowly' : 'API healthy',
|
|
244
|
+
details: {
|
|
245
|
+
status: response.status,
|
|
246
|
+
responseTime: duration,
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
return {
|
|
252
|
+
status: 'unhealthy',
|
|
253
|
+
message: error instanceof Error ? error.message : 'API unreachable',
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Custom health check
|
|
261
|
+
*/
|
|
262
|
+
export function createCustomHealthCheck(name, checkFn, critical = false) {
|
|
263
|
+
return {
|
|
264
|
+
name,
|
|
265
|
+
critical,
|
|
266
|
+
check: checkFn,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Create health check endpoint handler
|
|
271
|
+
*/
|
|
272
|
+
export function createHealthEndpoint() {
|
|
273
|
+
return async () => {
|
|
274
|
+
const health = await healthCheck.checkHealth();
|
|
275
|
+
const status = health.status === 'healthy' ? 200 : health.status === 'degraded' ? 200 : 503;
|
|
276
|
+
return new Response(JSON.stringify(health, null, 2), {
|
|
277
|
+
status,
|
|
278
|
+
headers: {
|
|
279
|
+
'Content-Type': 'application/json',
|
|
280
|
+
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Create readiness check endpoint handler
|
|
287
|
+
*/
|
|
288
|
+
export function createReadinessEndpoint() {
|
|
289
|
+
return async () => {
|
|
290
|
+
const health = await healthCheck.checkHealth();
|
|
291
|
+
// Only return 200 if all critical checks are healthy
|
|
292
|
+
const ready = health.status !== 'unhealthy';
|
|
293
|
+
const status = ready ? 200 : 503;
|
|
294
|
+
return new Response(JSON.stringify({
|
|
295
|
+
ready,
|
|
296
|
+
status: health.status,
|
|
297
|
+
timestamp: health.timestamp,
|
|
298
|
+
}, null, 2), {
|
|
299
|
+
status,
|
|
300
|
+
headers: {
|
|
301
|
+
'Content-Type': 'application/json',
|
|
302
|
+
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Create liveness check endpoint handler
|
|
309
|
+
*/
|
|
310
|
+
export function createLivenessEndpoint() {
|
|
311
|
+
return () => {
|
|
312
|
+
// Liveness is simple - if we can respond, we're alive
|
|
313
|
+
return new Response(JSON.stringify({
|
|
314
|
+
alive: true,
|
|
315
|
+
timestamp: new Date().toISOString(),
|
|
316
|
+
uptime: healthCheck.getUptime(),
|
|
317
|
+
}, null, 2), {
|
|
318
|
+
status: 200,
|
|
319
|
+
headers: {
|
|
320
|
+
'Content-Type': 'application/json',
|
|
321
|
+
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
322
|
+
},
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Monitor health and log status changes
|
|
328
|
+
*/
|
|
329
|
+
export async function monitorHealth(intervalMs = 30000, onStatusChange) {
|
|
330
|
+
let lastStatus = null;
|
|
331
|
+
const monitor = async () => {
|
|
332
|
+
const health = await healthCheck.checkHealth();
|
|
333
|
+
if (health.status !== lastStatus) {
|
|
334
|
+
logger.info('Health status changed', { from: lastStatus, to: health.status });
|
|
335
|
+
if (onStatusChange) {
|
|
336
|
+
onStatusChange(health.status);
|
|
337
|
+
}
|
|
338
|
+
lastStatus = health.status;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
// Run immediately
|
|
342
|
+
await monitor();
|
|
343
|
+
// Then run on interval
|
|
344
|
+
return setInterval(monitor, intervalMs);
|
|
345
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observability Module
|
|
3
|
+
*
|
|
4
|
+
* Centralized exports for observability functionality including logging,
|
|
5
|
+
* metrics, tracing, alerts, and health checks.
|
|
6
|
+
*/
|
|
7
|
+
export * from './alerts.js';
|
|
8
|
+
export * from './health-check.js';
|
|
9
|
+
export * from './logger.js';
|
|
10
|
+
export * from './metrics.js';
|
|
11
|
+
export * from './tracing.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observability Module
|
|
3
|
+
*
|
|
4
|
+
* Centralized exports for observability functionality including logging,
|
|
5
|
+
* metrics, tracing, alerts, and health checks.
|
|
6
|
+
*/
|
|
7
|
+
export * from './alerts.js';
|
|
8
|
+
export * from './health-check.js';
|
|
9
|
+
export * from './logger.js';
|
|
10
|
+
export * from './metrics.js';
|
|
11
|
+
export * from './tracing.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured Logging Infrastructure
|
|
3
|
+
*
|
|
4
|
+
* Re-exports from @revealui/utils to maintain backward compatibility.
|
|
5
|
+
* The actual implementation has been moved to @revealui/utils to break circular dependencies.
|
|
6
|
+
*/
|
|
7
|
+
export type { LogContext, LogEntry, LoggerConfig, LogLevel, } from '@revealui/utils/logger';
|
|
8
|
+
export { createLogger, Logger, logAudit, logError, logger, logQuery, } from '@revealui/utils/logger';
|
|
9
|
+
/**
|
|
10
|
+
* Request logger middleware
|
|
11
|
+
*/
|
|
12
|
+
export declare function createRequestLogger<TRequest = unknown, TResponse = unknown>(options?: {
|
|
13
|
+
includeBody?: boolean;
|
|
14
|
+
includeHeaders?: boolean;
|
|
15
|
+
}): (request: TRequest & {
|
|
16
|
+
method: string;
|
|
17
|
+
url: string;
|
|
18
|
+
headers?: {
|
|
19
|
+
get?: (key: string) => string | null;
|
|
20
|
+
entries?: () => Iterable<[string, string]>;
|
|
21
|
+
};
|
|
22
|
+
}, next: () => Promise<TResponse>) => Promise<TResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Performance logger
|
|
25
|
+
*/
|
|
26
|
+
export declare function logPerformance(operation: string, duration: number, context?: Record<string, unknown>): void;
|
|
27
|
+
/**
|
|
28
|
+
* API call logger
|
|
29
|
+
*/
|
|
30
|
+
export declare function logAPICall(method: string, url: string, status: number, duration: number, context?: Record<string, unknown>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Cache operation logger
|
|
33
|
+
*/
|
|
34
|
+
export declare function logCache(operation: 'hit' | 'miss' | 'set' | 'delete', key: string, context?: Record<string, unknown>): void;
|
|
35
|
+
/**
|
|
36
|
+
* User action logger
|
|
37
|
+
*/
|
|
38
|
+
export declare function logUserAction(action: string, userId?: string, context?: Record<string, unknown>): void;
|
|
39
|
+
/**
|
|
40
|
+
* System event logger
|
|
41
|
+
*/
|
|
42
|
+
export declare function logSystemEvent(event: string, context?: Record<string, unknown>): void;
|
|
43
|
+
/**
|
|
44
|
+
* Sanitize sensitive data from logs
|
|
45
|
+
*/
|
|
46
|
+
export declare function sanitizeLogData(data: Record<string, unknown>): Record<string, unknown>;
|
|
47
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/observability/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,YAAY,EACV,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAKhC;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,GAAG,OAAO,EAAE,SAAS,GAAG,OAAO,EACzE,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,IAG/D,SAAS,QAAQ,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE;QACR,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;QACrC,OAAO,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KAC5C,CAAC;CACH,EACD,MAAM,MAAM,OAAO,CAAC,SAAS,CAAC,KAC7B,OAAO,CAAC,SAAS,CAAC,CA6CtB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CASN;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CAgBN;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,EAC5C,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAKrF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2BtF"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured Logging Infrastructure
|
|
3
|
+
*
|
|
4
|
+
* Re-exports from @revealui/utils to maintain backward compatibility.
|
|
5
|
+
* The actual implementation has been moved to @revealui/utils to break circular dependencies.
|
|
6
|
+
*/
|
|
7
|
+
// Import logger for internal use
|
|
8
|
+
import { logger as utilsLogger } from '@revealui/utils/logger';
|
|
9
|
+
export { createLogger, Logger, logAudit, logError, logger, logQuery, } from '@revealui/utils/logger';
|
|
10
|
+
// Additional helper functions that were in core but not in utils
|
|
11
|
+
// These can stay here as they're core-specific
|
|
12
|
+
/**
|
|
13
|
+
* Request logger middleware
|
|
14
|
+
*/
|
|
15
|
+
export function createRequestLogger(options = {}) {
|
|
16
|
+
return async (request, next) => {
|
|
17
|
+
// Import logger at runtime to avoid circular deps
|
|
18
|
+
const { logger } = await import('@revealui/utils/logger');
|
|
19
|
+
const requestId = crypto.randomUUID();
|
|
20
|
+
const startTime = Date.now();
|
|
21
|
+
const requestLogger = logger.child({
|
|
22
|
+
requestId,
|
|
23
|
+
method: request.method,
|
|
24
|
+
url: request.url,
|
|
25
|
+
userAgent: request.headers?.get?.('user-agent'),
|
|
26
|
+
});
|
|
27
|
+
requestLogger.info('Request started');
|
|
28
|
+
if (options.includeHeaders) {
|
|
29
|
+
requestLogger.debug('Request headers', {
|
|
30
|
+
headers: Object.fromEntries(request.headers?.entries?.() || []),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const response = await next();
|
|
35
|
+
const duration = Date.now() - startTime;
|
|
36
|
+
const responseWithStatus = response;
|
|
37
|
+
requestLogger.info('Request completed', {
|
|
38
|
+
status: responseWithStatus.status ?? 200,
|
|
39
|
+
duration,
|
|
40
|
+
});
|
|
41
|
+
return response;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
const duration = Date.now() - startTime;
|
|
45
|
+
requestLogger.error('Request failed', error instanceof Error ? error : new Error(String(error)), { duration });
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Performance logger
|
|
52
|
+
*/
|
|
53
|
+
export function logPerformance(operation, duration, context) {
|
|
54
|
+
const level = duration > 1000 ? 'warn' : 'info';
|
|
55
|
+
utilsLogger[level](`Performance: ${operation}`, {
|
|
56
|
+
...context,
|
|
57
|
+
operation,
|
|
58
|
+
duration,
|
|
59
|
+
slow: duration > 1000,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* API call logger
|
|
64
|
+
*/
|
|
65
|
+
export function logAPICall(method, url, status, duration, context) {
|
|
66
|
+
const apiContext = {
|
|
67
|
+
...context,
|
|
68
|
+
method,
|
|
69
|
+
url,
|
|
70
|
+
status,
|
|
71
|
+
duration,
|
|
72
|
+
};
|
|
73
|
+
if (status >= 400) {
|
|
74
|
+
utilsLogger.error('API call', undefined, apiContext);
|
|
75
|
+
}
|
|
76
|
+
else if (status >= 300) {
|
|
77
|
+
utilsLogger.warn('API call', apiContext);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
utilsLogger.info('API call', apiContext);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Cache operation logger
|
|
85
|
+
*/
|
|
86
|
+
export function logCache(operation, key, context) {
|
|
87
|
+
utilsLogger.debug(`Cache ${operation}`, {
|
|
88
|
+
...context,
|
|
89
|
+
operation,
|
|
90
|
+
key,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* User action logger
|
|
95
|
+
*/
|
|
96
|
+
export function logUserAction(action, userId, context) {
|
|
97
|
+
utilsLogger.info('User action', {
|
|
98
|
+
...context,
|
|
99
|
+
action,
|
|
100
|
+
userId,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* System event logger
|
|
105
|
+
*/
|
|
106
|
+
export function logSystemEvent(event, context) {
|
|
107
|
+
utilsLogger.info('System event', {
|
|
108
|
+
...context,
|
|
109
|
+
event,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sanitize sensitive data from logs
|
|
114
|
+
*/
|
|
115
|
+
export function sanitizeLogData(data) {
|
|
116
|
+
const sensitiveKeys = [
|
|
117
|
+
'password',
|
|
118
|
+
'token',
|
|
119
|
+
'secret',
|
|
120
|
+
'apiKey',
|
|
121
|
+
'accessToken',
|
|
122
|
+
'refreshToken',
|
|
123
|
+
'creditCard',
|
|
124
|
+
'ssn',
|
|
125
|
+
];
|
|
126
|
+
const sanitized = {};
|
|
127
|
+
for (const [key, value] of Object.entries(data)) {
|
|
128
|
+
const lowerKey = key.toLowerCase();
|
|
129
|
+
if (sensitiveKeys.some((sensitive) => lowerKey.includes(sensitive.toLowerCase()))) {
|
|
130
|
+
sanitized[key] = '[REDACTED]';
|
|
131
|
+
}
|
|
132
|
+
else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
133
|
+
sanitized[key] = sanitizeLogData(value);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
sanitized[key] = value;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return sanitized;
|
|
140
|
+
}
|