@revealui/core 0.0.1-pre.4 → 0.2.1
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 +108 -152
- 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 +316 -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 +411 -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 +385 -0
- package/dist/caching/service-worker.d.ts +154 -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 +23 -0
- package/dist/client/admin/utils/auth.d.ts.map +1 -0
- package/dist/client/admin/utils/auth.js +52 -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 +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 +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 +34 -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/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 +526 -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/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 +214 -0
- package/dist/error-handling/error-reporter.d.ts.map +1 -0
- package/dist/error-handling/error-reporter.js +477 -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 +86 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +92 -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 +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 +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 +126 -33
- package/dist/instance/RevealUIInstance.d.ts +6 -0
- package/dist/instance/RevealUIInstance.d.ts.map +1 -0
- package/dist/instance/RevealUIInstance.js +306 -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 +41 -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 +27 -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 +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 +45 -0
- package/dist/license.d.ts +82 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +193 -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 +375 -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 +131 -0
- package/dist/optimization/code-splitting.d.ts.map +1 -0
- package/dist/optimization/code-splitting.js +277 -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 +255 -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 +476 -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 +517 -0
- package/dist/security/gdpr.d.ts +300 -0
- package/dist/security/gdpr.d.ts.map +1 -0
- package/dist/security/gdpr.js +465 -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 +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 +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 +241 -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,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handling Utilities
|
|
3
|
+
*
|
|
4
|
+
* Standardized error handling for RevealUI framework.
|
|
5
|
+
*/
|
|
6
|
+
import { logger } from './logger.js';
|
|
7
|
+
/**
|
|
8
|
+
* Application Error
|
|
9
|
+
* Use for business logic failures, validation failures, expected errors
|
|
10
|
+
*/
|
|
11
|
+
export class ApplicationError extends Error {
|
|
12
|
+
code;
|
|
13
|
+
statusCode;
|
|
14
|
+
context;
|
|
15
|
+
constructor(message, code, statusCode = 500, context) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.code = code;
|
|
18
|
+
this.statusCode = statusCode;
|
|
19
|
+
this.context = context;
|
|
20
|
+
this.name = 'ApplicationError';
|
|
21
|
+
Error.captureStackTrace(this, ApplicationError);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Validation Error
|
|
26
|
+
* Use for input validation failures, schema validation failures
|
|
27
|
+
*/
|
|
28
|
+
export class ValidationError extends Error {
|
|
29
|
+
field;
|
|
30
|
+
value;
|
|
31
|
+
context;
|
|
32
|
+
constructor(message, field, value, context) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.field = field;
|
|
35
|
+
this.value = value;
|
|
36
|
+
this.context = context;
|
|
37
|
+
this.name = 'ValidationError';
|
|
38
|
+
Error.captureStackTrace(this, ValidationError);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Database Error
|
|
43
|
+
* Use for database operation failures with Postgres error code parsing
|
|
44
|
+
*/
|
|
45
|
+
export class DatabaseError extends Error {
|
|
46
|
+
code;
|
|
47
|
+
statusCode;
|
|
48
|
+
pgCode;
|
|
49
|
+
constraint;
|
|
50
|
+
table;
|
|
51
|
+
column;
|
|
52
|
+
context;
|
|
53
|
+
constructor(message, code, statusCode = 500, pgCode, constraint, table, column, context) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.code = code;
|
|
56
|
+
this.statusCode = statusCode;
|
|
57
|
+
this.pgCode = pgCode;
|
|
58
|
+
this.constraint = constraint;
|
|
59
|
+
this.table = table;
|
|
60
|
+
this.column = column;
|
|
61
|
+
this.context = context;
|
|
62
|
+
this.name = 'DatabaseError';
|
|
63
|
+
Error.captureStackTrace(this, DatabaseError);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Postgres Error Codes
|
|
68
|
+
* Reference: https://www.postgresql.org/docs/current/errcodes-appendix.html
|
|
69
|
+
*/
|
|
70
|
+
export const PostgresErrorCode = {
|
|
71
|
+
// Class 23 - Integrity Constraint Violation
|
|
72
|
+
UNIQUE_VIOLATION: '23505',
|
|
73
|
+
FOREIGN_KEY_VIOLATION: '23503',
|
|
74
|
+
NOT_NULL_VIOLATION: '23502',
|
|
75
|
+
CHECK_VIOLATION: '23514',
|
|
76
|
+
// Class 42 - Syntax Error or Access Rule Violation
|
|
77
|
+
UNDEFINED_TABLE: '42P01',
|
|
78
|
+
UNDEFINED_COLUMN: '42703',
|
|
79
|
+
DUPLICATE_TABLE: '42P07',
|
|
80
|
+
DUPLICATE_COLUMN: '42701',
|
|
81
|
+
// Class 40 - Transaction Rollback
|
|
82
|
+
DEADLOCK_DETECTED: '40P01',
|
|
83
|
+
SERIALIZATION_FAILURE: '40001',
|
|
84
|
+
// Class 57 - Operator Intervention
|
|
85
|
+
QUERY_CANCELED: '57014',
|
|
86
|
+
ADMIN_SHUTDOWN: '57P01',
|
|
87
|
+
// Class 53 - Insufficient Resources
|
|
88
|
+
DISK_FULL: '53100',
|
|
89
|
+
OUT_OF_MEMORY: '53200',
|
|
90
|
+
TOO_MANY_CONNECTIONS: '53300',
|
|
91
|
+
// Class 08 - Connection Exception
|
|
92
|
+
CONNECTION_EXCEPTION: '08000',
|
|
93
|
+
CONNECTION_FAILURE: '08006',
|
|
94
|
+
CONNECTION_DOES_NOT_EXIST: '08003',
|
|
95
|
+
// Class 25 - Invalid Transaction State
|
|
96
|
+
INVALID_TRANSACTION_STATE: '25000',
|
|
97
|
+
ACTIVE_SQL_TRANSACTION: '25001',
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Extract Postgres error information from an error object
|
|
101
|
+
*/
|
|
102
|
+
function parsePostgresError(error) {
|
|
103
|
+
// Handle Postgres/pg library errors
|
|
104
|
+
if (error && typeof error === 'object' && 'code' in error && typeof error.code === 'string') {
|
|
105
|
+
const pgError = error;
|
|
106
|
+
return {
|
|
107
|
+
pgCode: pgError.code,
|
|
108
|
+
constraint: pgError.constraint,
|
|
109
|
+
table: pgError.table,
|
|
110
|
+
column: pgError.column,
|
|
111
|
+
detail: pgError.detail,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Handle and log error in API routes
|
|
118
|
+
*
|
|
119
|
+
* @param error - The error to handle
|
|
120
|
+
* @param context - Additional context to log
|
|
121
|
+
* @returns User-friendly error message
|
|
122
|
+
*/
|
|
123
|
+
export function handleApiError(error, context) {
|
|
124
|
+
if (error instanceof DatabaseError) {
|
|
125
|
+
logger.error('Database error in API', {
|
|
126
|
+
message: error.message,
|
|
127
|
+
code: error.code,
|
|
128
|
+
statusCode: error.statusCode,
|
|
129
|
+
pgCode: error.pgCode,
|
|
130
|
+
constraint: error.constraint,
|
|
131
|
+
table: error.table,
|
|
132
|
+
column: error.column,
|
|
133
|
+
...error.context,
|
|
134
|
+
...context,
|
|
135
|
+
});
|
|
136
|
+
return {
|
|
137
|
+
message: error.message,
|
|
138
|
+
statusCode: error.statusCode,
|
|
139
|
+
code: error.code,
|
|
140
|
+
retryable: error.context?.retryable,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (error instanceof ApplicationError) {
|
|
144
|
+
logger.error('Application error', {
|
|
145
|
+
message: error.message,
|
|
146
|
+
code: error.code,
|
|
147
|
+
statusCode: error.statusCode,
|
|
148
|
+
...error.context,
|
|
149
|
+
...context,
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
message: error.message,
|
|
153
|
+
statusCode: error.statusCode,
|
|
154
|
+
code: error.code,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (error instanceof ValidationError) {
|
|
158
|
+
logger.warn('Validation error', {
|
|
159
|
+
message: error.message,
|
|
160
|
+
field: error.field,
|
|
161
|
+
...error.context,
|
|
162
|
+
...context,
|
|
163
|
+
});
|
|
164
|
+
return {
|
|
165
|
+
message: error.message,
|
|
166
|
+
statusCode: 400,
|
|
167
|
+
code: 'VALIDATION_ERROR',
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
// Unknown error - log with full details, return generic message
|
|
171
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
172
|
+
// Always use logger - it's always available from the same package
|
|
173
|
+
logger.error('Unexpected error', { error: err.message, stack: err.stack });
|
|
174
|
+
return {
|
|
175
|
+
message: 'An error occurred',
|
|
176
|
+
statusCode: 500,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Handle database errors with Postgres error code parsing
|
|
181
|
+
*
|
|
182
|
+
* @param error - Database error
|
|
183
|
+
* @param operation - Operation being performed (e.g., 'insert user', 'update order')
|
|
184
|
+
* @param context - Additional context (e.g., { userId: '123', table: 'users' })
|
|
185
|
+
* @returns Never - always throws a DatabaseError
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* try {
|
|
190
|
+
* await db.insert(users).values({ email: 'existing@example.com' })
|
|
191
|
+
* } catch (error) {
|
|
192
|
+
* handleDatabaseError(error, 'insert user', { email: 'existing@example.com' })
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
export function handleDatabaseError(error, operation, context) {
|
|
197
|
+
const pgError = parsePostgresError(error);
|
|
198
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
199
|
+
// Parse Postgres error codes for specific error types
|
|
200
|
+
if (pgError.pgCode) {
|
|
201
|
+
switch (pgError.pgCode) {
|
|
202
|
+
// Unique constraint violation
|
|
203
|
+
case PostgresErrorCode.UNIQUE_VIOLATION: {
|
|
204
|
+
const field = pgError.constraint?.replace(/_/g, ' ') || 'field';
|
|
205
|
+
const message = `Duplicate ${field}: this value already exists`;
|
|
206
|
+
logger.warn('Unique constraint violation', {
|
|
207
|
+
operation,
|
|
208
|
+
constraint: pgError.constraint,
|
|
209
|
+
table: pgError.table,
|
|
210
|
+
detail: pgError.detail,
|
|
211
|
+
...context,
|
|
212
|
+
});
|
|
213
|
+
throw new DatabaseError(message, 'UNIQUE_VIOLATION', 409, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
214
|
+
operation,
|
|
215
|
+
detail: pgError.detail,
|
|
216
|
+
...context,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
// Foreign key constraint violation
|
|
220
|
+
case PostgresErrorCode.FOREIGN_KEY_VIOLATION: {
|
|
221
|
+
const constraint = pgError.constraint?.replace(/_/g, ' ') || 'reference';
|
|
222
|
+
const message = `Invalid ${constraint}: referenced record does not exist`;
|
|
223
|
+
logger.warn('Foreign key violation', {
|
|
224
|
+
operation,
|
|
225
|
+
constraint: pgError.constraint,
|
|
226
|
+
table: pgError.table,
|
|
227
|
+
detail: pgError.detail,
|
|
228
|
+
...context,
|
|
229
|
+
});
|
|
230
|
+
throw new DatabaseError(message, 'FOREIGN_KEY_VIOLATION', 400, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
231
|
+
operation,
|
|
232
|
+
detail: pgError.detail,
|
|
233
|
+
...context,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
// Not null constraint violation
|
|
237
|
+
case PostgresErrorCode.NOT_NULL_VIOLATION: {
|
|
238
|
+
const field = pgError.column || 'field';
|
|
239
|
+
const message = `Missing required field: ${field} cannot be null`;
|
|
240
|
+
logger.warn('Not null violation', {
|
|
241
|
+
operation,
|
|
242
|
+
column: pgError.column,
|
|
243
|
+
table: pgError.table,
|
|
244
|
+
...context,
|
|
245
|
+
});
|
|
246
|
+
throw new DatabaseError(message, 'NOT_NULL_VIOLATION', 400, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
247
|
+
operation,
|
|
248
|
+
...context,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
// Check constraint violation
|
|
252
|
+
case PostgresErrorCode.CHECK_VIOLATION: {
|
|
253
|
+
const constraint = pgError.constraint?.replace(/_/g, ' ') || 'constraint';
|
|
254
|
+
const message = `Validation failed: ${constraint} check constraint violated`;
|
|
255
|
+
logger.warn('Check constraint violation', {
|
|
256
|
+
operation,
|
|
257
|
+
constraint: pgError.constraint,
|
|
258
|
+
table: pgError.table,
|
|
259
|
+
detail: pgError.detail,
|
|
260
|
+
...context,
|
|
261
|
+
});
|
|
262
|
+
throw new DatabaseError(message, 'CHECK_VIOLATION', 400, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
263
|
+
operation,
|
|
264
|
+
detail: pgError.detail,
|
|
265
|
+
...context,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
// Deadlock detected
|
|
269
|
+
case PostgresErrorCode.DEADLOCK_DETECTED: {
|
|
270
|
+
const message = 'Database deadlock detected - please retry the operation';
|
|
271
|
+
logger.error('Deadlock detected', {
|
|
272
|
+
operation,
|
|
273
|
+
table: pgError.table,
|
|
274
|
+
...context,
|
|
275
|
+
});
|
|
276
|
+
throw new DatabaseError(message, 'DEADLOCK_DETECTED', 409, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
277
|
+
operation,
|
|
278
|
+
retryable: true,
|
|
279
|
+
...context,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
// Serialization failure (concurrent update conflict)
|
|
283
|
+
case PostgresErrorCode.SERIALIZATION_FAILURE: {
|
|
284
|
+
const message = 'Concurrent update conflict - please retry the operation';
|
|
285
|
+
logger.warn('Serialization failure', {
|
|
286
|
+
operation,
|
|
287
|
+
...context,
|
|
288
|
+
});
|
|
289
|
+
throw new DatabaseError(message, 'SERIALIZATION_FAILURE', 409, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
290
|
+
operation,
|
|
291
|
+
retryable: true,
|
|
292
|
+
...context,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
// Query canceled (timeout)
|
|
296
|
+
case PostgresErrorCode.QUERY_CANCELED: {
|
|
297
|
+
const message = 'Database query timeout - operation took too long';
|
|
298
|
+
logger.error('Query timeout', {
|
|
299
|
+
operation,
|
|
300
|
+
...context,
|
|
301
|
+
});
|
|
302
|
+
throw new DatabaseError(message, 'QUERY_TIMEOUT', 504, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
303
|
+
operation,
|
|
304
|
+
...context,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
// Connection errors
|
|
308
|
+
case PostgresErrorCode.CONNECTION_EXCEPTION:
|
|
309
|
+
case PostgresErrorCode.CONNECTION_FAILURE:
|
|
310
|
+
case PostgresErrorCode.CONNECTION_DOES_NOT_EXIST: {
|
|
311
|
+
const message = 'Database connection error - please try again';
|
|
312
|
+
logger.error('Database connection error', {
|
|
313
|
+
operation,
|
|
314
|
+
pgCode: pgError.pgCode,
|
|
315
|
+
...context,
|
|
316
|
+
});
|
|
317
|
+
throw new DatabaseError(message, 'CONNECTION_ERROR', 503, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
318
|
+
operation,
|
|
319
|
+
retryable: true,
|
|
320
|
+
...context,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
// Resource errors
|
|
324
|
+
case PostgresErrorCode.DISK_FULL:
|
|
325
|
+
case PostgresErrorCode.OUT_OF_MEMORY:
|
|
326
|
+
case PostgresErrorCode.TOO_MANY_CONNECTIONS: {
|
|
327
|
+
const message = 'Database resource limit reached - please try again later';
|
|
328
|
+
logger.error('Database resource error', {
|
|
329
|
+
operation,
|
|
330
|
+
pgCode: pgError.pgCode,
|
|
331
|
+
...context,
|
|
332
|
+
});
|
|
333
|
+
throw new DatabaseError(message, 'RESOURCE_ERROR', 503, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
334
|
+
operation,
|
|
335
|
+
retryable: true,
|
|
336
|
+
...context,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
// Undefined table/column
|
|
340
|
+
case PostgresErrorCode.UNDEFINED_TABLE:
|
|
341
|
+
case PostgresErrorCode.UNDEFINED_COLUMN: {
|
|
342
|
+
const message = 'Database schema error - table or column does not exist';
|
|
343
|
+
logger.error('Schema error', {
|
|
344
|
+
operation,
|
|
345
|
+
pgCode: pgError.pgCode,
|
|
346
|
+
table: pgError.table,
|
|
347
|
+
column: pgError.column,
|
|
348
|
+
...context,
|
|
349
|
+
});
|
|
350
|
+
throw new DatabaseError(message, 'SCHEMA_ERROR', 500, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
351
|
+
operation,
|
|
352
|
+
...context,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// Fallback: Check error message for common patterns (if no pgCode)
|
|
358
|
+
if (error instanceof Error) {
|
|
359
|
+
if (errorMessage.includes('unique') || errorMessage.includes('duplicate')) {
|
|
360
|
+
logger.warn('Unique violation (message-based)', {
|
|
361
|
+
operation,
|
|
362
|
+
message: errorMessage,
|
|
363
|
+
...context,
|
|
364
|
+
});
|
|
365
|
+
throw new DatabaseError('Resource already exists', 'UNIQUE_VIOLATION', 409, undefined, undefined, undefined, undefined, { operation, ...context });
|
|
366
|
+
}
|
|
367
|
+
if (errorMessage.includes('foreign key') ||
|
|
368
|
+
errorMessage.includes('violates foreign key constraint')) {
|
|
369
|
+
logger.warn('Foreign key violation (message-based)', {
|
|
370
|
+
operation,
|
|
371
|
+
message: errorMessage,
|
|
372
|
+
...context,
|
|
373
|
+
});
|
|
374
|
+
throw new DatabaseError('Invalid reference', 'FOREIGN_KEY_VIOLATION', 400, undefined, undefined, undefined, undefined, { operation, ...context });
|
|
375
|
+
}
|
|
376
|
+
if (errorMessage.includes('not found') || errorMessage.includes('does not exist')) {
|
|
377
|
+
logger.warn('Not found (message-based)', { operation, message: errorMessage, ...context });
|
|
378
|
+
throw new DatabaseError('Resource not found', 'NOT_FOUND', 404, undefined, undefined, undefined, undefined, { operation, ...context });
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// Unknown database error - log with full details
|
|
382
|
+
logger.error('Unexpected database error', {
|
|
383
|
+
operation,
|
|
384
|
+
error: errorMessage,
|
|
385
|
+
pgCode: pgError.pgCode,
|
|
386
|
+
constraint: pgError.constraint,
|
|
387
|
+
table: pgError.table,
|
|
388
|
+
column: pgError.column,
|
|
389
|
+
detail: pgError.detail,
|
|
390
|
+
...context,
|
|
391
|
+
});
|
|
392
|
+
throw new DatabaseError('Database operation failed', 'DATABASE_ERROR', 500, pgError.pgCode, pgError.constraint, pgError.table, pgError.column, {
|
|
393
|
+
operation,
|
|
394
|
+
originalError: errorMessage,
|
|
395
|
+
...context,
|
|
396
|
+
});
|
|
397
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field Conversion Utilities
|
|
3
|
+
*
|
|
4
|
+
* Converts between standard Field types and RevealUIField types.
|
|
5
|
+
*
|
|
6
|
+
* NOTE ON TYPE ASSERTIONS:
|
|
7
|
+
* The type assertions in this file are necessary due to TypeScript's limitation
|
|
8
|
+
* with narrowing separate variables. Here's why:
|
|
9
|
+
*
|
|
10
|
+
* 1. `baseField` is initialized as `RevealUIField` (a union type) or `Field` (a union type)
|
|
11
|
+
* 2. TypeScript can narrow `field` or `revealUIField` in conditionals/switches
|
|
12
|
+
* 3. However, TypeScript CANNOT narrow `baseField` because it's a separate variable
|
|
13
|
+
* that was explicitly typed, not derived from the narrowed value
|
|
14
|
+
*
|
|
15
|
+
* The assertions (`as RevealUITextField`, etc.) are used to tell TypeScript that
|
|
16
|
+
* after type narrowing checks, we're assigning type-specific properties that exist
|
|
17
|
+
* on the narrowed type but not on the base union type.
|
|
18
|
+
*
|
|
19
|
+
* Alternative approaches considered:
|
|
20
|
+
* - Returning different object literals per type: Would work but duplicates code
|
|
21
|
+
* - Using type predicates on baseField: Not possible without runtime checks
|
|
22
|
+
* - Restructuring to avoid mutations: Would require significant refactoring
|
|
23
|
+
*
|
|
24
|
+
* These assertions are safe because they're guarded by runtime type checks
|
|
25
|
+
* (isTextField, isArrayField, switch on field.type).
|
|
26
|
+
*/
|
|
27
|
+
import type { Field, RevealUIField } from '../types/index.js';
|
|
28
|
+
export declare function convertToRevealUIField(field: Field): RevealUIField;
|
|
29
|
+
export declare function convertFromRevealUIField(revealUIField: RevealUIField): Field;
|
|
30
|
+
export declare function enhanceFieldWithRevealUI(field: Field, revealUIOptions?: RevealUIField['revealUI']): RevealUIField;
|
|
31
|
+
interface RevealUIValidationContext {
|
|
32
|
+
data: Record<string, unknown>;
|
|
33
|
+
siblingData: Record<string, unknown>;
|
|
34
|
+
user?: unknown;
|
|
35
|
+
operation: 'create' | 'update';
|
|
36
|
+
tenant?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function validateRevealUIField(field: RevealUIField, value: unknown, context: RevealUIValidationContext): string | true;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=field-conversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-conversion.d.ts","sourceRoot":"","sources":["../../src/utils/field-conversion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAGV,KAAK,EACL,aAAa,EAGd,MAAM,mBAAmB,CAAA;AAoB1B,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CA6ElE;AAGD,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,aAAa,GAAG,KAAK,CAqE5E;AAGD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,KAAK,EACZ,eAAe,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,GAC1C,aAAa,CAWf;AAGD,UAAU,yBAAyB;IACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAGD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,yBAAyB,GACjC,MAAM,GAAG,IAAI,CAqFf"}
|