@revealui/core 0.0.1-pre.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -202
- package/README.md +29 -180
- package/dist/api/compression.d.ts +83 -0
- package/dist/api/compression.d.ts.map +1 -0
- package/dist/api/compression.js +233 -0
- package/dist/api/payload-optimization.d.ts +138 -0
- package/dist/api/payload-optimization.d.ts.map +1 -0
- package/dist/api/payload-optimization.js +320 -0
- package/dist/api/rate-limit.d.ts +113 -0
- package/dist/api/rate-limit.d.ts.map +1 -0
- package/dist/api/rate-limit.js +301 -0
- package/dist/api/response-cache.d.ts +125 -0
- package/dist/api/response-cache.d.ts.map +1 -0
- package/dist/api/response-cache.js +335 -0
- package/dist/api/rest.d.ts +54 -0
- package/dist/api/rest.d.ts.map +1 -0
- package/dist/api/rest.js +464 -0
- package/dist/auth/access.d.ts +25 -0
- package/dist/auth/access.d.ts.map +1 -0
- package/dist/auth/access.js +20 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/cache/query-cache.d.ts +98 -0
- package/dist/cache/query-cache.d.ts.map +1 -0
- package/dist/cache/query-cache.js +260 -0
- package/dist/caching/app-cache.d.ts +237 -0
- package/dist/caching/app-cache.d.ts.map +1 -0
- package/dist/caching/app-cache.js +430 -0
- package/dist/caching/cdn-config.d.ts +155 -0
- package/dist/caching/cdn-config.d.ts.map +1 -0
- package/dist/caching/cdn-config.js +425 -0
- package/dist/caching/edge-cache.d.ts +177 -0
- package/dist/caching/edge-cache.d.ts.map +1 -0
- package/dist/caching/edge-cache.js +381 -0
- package/dist/caching/service-worker.d.ts +165 -0
- package/dist/caching/service-worker.d.ts.map +1 -0
- package/dist/caching/service-worker.js +437 -0
- package/dist/client/admin/RichText.d.ts +12 -0
- package/dist/client/admin/RichText.d.ts.map +1 -0
- package/dist/client/admin/RichText.js +5 -0
- package/dist/client/admin/components/AdminDashboard.d.ts +7 -0
- package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -0
- package/dist/client/admin/components/AdminDashboard.js +318 -0
- package/dist/client/admin/components/CollectionList.d.ts +16 -0
- package/dist/client/admin/components/CollectionList.d.ts.map +1 -0
- package/dist/client/admin/components/CollectionList.js +67 -0
- package/dist/client/admin/components/DocumentForm.d.ts +11 -0
- package/dist/client/admin/components/DocumentForm.d.ts.map +1 -0
- package/dist/client/admin/components/DocumentForm.js +99 -0
- package/dist/client/admin/components/GlobalForm.d.ts +11 -0
- package/dist/client/admin/components/GlobalForm.d.ts.map +1 -0
- package/dist/client/admin/components/GlobalForm.js +74 -0
- package/dist/client/admin/i18n/en.d.ts +25 -0
- package/dist/client/admin/i18n/en.d.ts.map +1 -0
- package/dist/client/admin/i18n/en.js +25 -0
- package/dist/client/admin/index.d.ts +10 -0
- package/dist/client/admin/index.d.ts.map +1 -0
- package/dist/client/admin/index.js +10 -0
- package/dist/client/admin/layout.d.ts +10 -0
- package/dist/client/admin/layout.d.ts.map +1 -0
- package/dist/client/admin/layout.js +6 -0
- package/dist/client/admin/page.d.ts +38 -0
- package/dist/client/admin/page.d.ts.map +1 -0
- package/dist/client/admin/page.js +15 -0
- package/dist/client/admin/utils/apiClient.d.ts +110 -0
- package/dist/client/admin/utils/apiClient.d.ts.map +1 -0
- package/dist/client/admin/utils/apiClient.js +220 -0
- package/dist/client/admin/utils/auth.d.ts +27 -0
- package/dist/client/admin/utils/auth.d.ts.map +1 -0
- package/dist/client/admin/utils/auth.js +58 -0
- package/dist/client/admin/utils/index.d.ts +6 -0
- package/dist/client/admin/utils/index.d.ts.map +1 -0
- package/dist/client/admin/utils/index.js +5 -0
- package/dist/client/admin/utils/serializeConfig.d.ts +7 -0
- package/dist/client/admin/utils/serializeConfig.d.ts.map +1 -0
- package/dist/client/admin/utils/serializeConfig.js +35 -0
- package/dist/client/hooks.d.ts +18 -0
- package/dist/client/hooks.d.ts.map +1 -0
- package/dist/client/hooks.js +29 -0
- package/dist/client/http/client.d.ts +15 -0
- package/dist/client/http/client.d.ts.map +1 -0
- package/dist/client/http/client.js +49 -0
- package/dist/client/http/fetchBanner.d.ts +18 -0
- package/dist/client/http/fetchBanner.d.ts.map +1 -0
- package/dist/client/http/fetchBanner.js +44 -0
- package/dist/client/http/fetchCard.d.ts +18 -0
- package/dist/client/http/fetchCard.d.ts.map +1 -0
- package/dist/client/http/fetchCard.js +46 -0
- package/dist/client/http/fetchEvents.d.ts +18 -0
- package/dist/client/http/fetchEvents.d.ts.map +1 -0
- package/dist/client/http/fetchEvents.js +44 -0
- package/dist/client/http/fetchHero.d.ts +17 -0
- package/dist/client/http/fetchHero.d.ts.map +1 -0
- package/dist/client/http/fetchHero.js +55 -0
- package/dist/client/http/fetchMainInfos.d.ts +17 -0
- package/dist/client/http/fetchMainInfos.d.ts.map +1 -0
- package/dist/client/http/fetchMainInfos.js +44 -0
- package/dist/client/http/fetchVideos.d.ts +13 -0
- package/dist/client/http/fetchVideos.d.ts.map +1 -0
- package/dist/client/http/fetchVideos.js +36 -0
- package/dist/client/http/index.d.ts +19 -0
- package/dist/client/http/index.d.ts.map +1 -0
- package/dist/client/http/index.js +11 -0
- package/dist/client/index.d.ts +12 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +15 -0
- package/dist/client/richtext/RichTextEditor.d.ts +48 -0
- package/dist/client/richtext/RichTextEditor.d.ts.map +1 -0
- package/dist/client/richtext/RichTextEditor.js +360 -0
- package/dist/client/richtext/components/ImageNodeComponent.d.ts +9 -0
- package/dist/client/richtext/components/ImageNodeComponent.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageNodeComponent.js +99 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts +11 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageUploadButton.js +103 -0
- package/dist/client/richtext/index.d.ts +92 -0
- package/dist/client/richtext/index.d.ts.map +1 -0
- package/dist/client/richtext/index.js +74 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts +20 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts.map +1 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.js +29 -0
- package/dist/client/richtext/nodes/ImageNode.d.ts +51 -0
- package/dist/client/richtext/nodes/ImageNode.d.ts.map +1 -0
- package/dist/client/richtext/nodes/ImageNode.js +95 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts +13 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.js +8 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts +4 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.js +50 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts +7 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.js +248 -0
- package/dist/client/richtext/plugins/ImagePlugin.d.ts +3 -0
- package/dist/client/richtext/plugins/ImagePlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/ImagePlugin.js +73 -0
- package/dist/client/richtext/plugins/PastePlugin.d.ts +2 -0
- package/dist/client/richtext/plugins/PastePlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/PastePlugin.js +36 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts +8 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.js +204 -0
- package/dist/client/ui/index.d.ts +111 -0
- package/dist/client/ui/index.d.ts.map +1 -0
- package/dist/client/ui/index.js +130 -0
- package/dist/collections/CollectionOperations.d.ts +27 -0
- package/dist/collections/CollectionOperations.d.ts.map +1 -0
- package/dist/collections/CollectionOperations.js +34 -0
- package/dist/collections/hooks.d.ts +11 -0
- package/dist/collections/hooks.d.ts.map +1 -0
- package/dist/collections/hooks.js +35 -0
- package/dist/collections/index.d.ts +2 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/index.js +1 -0
- package/dist/collections/operations/create.d.ts +10 -0
- package/dist/collections/operations/create.d.ts.map +1 -0
- package/dist/collections/operations/create.js +101 -0
- package/dist/collections/operations/delete.d.ts +10 -0
- package/dist/collections/operations/delete.d.ts.map +1 -0
- package/dist/collections/operations/delete.js +16 -0
- package/dist/collections/operations/fieldHooks.d.ts +21 -0
- package/dist/collections/operations/fieldHooks.d.ts.map +1 -0
- package/dist/collections/operations/fieldHooks.js +51 -0
- package/dist/collections/operations/find.d.ts +10 -0
- package/dist/collections/operations/find.d.ts.map +1 -0
- package/dist/collections/operations/find.js +124 -0
- package/dist/collections/operations/findById.d.ts +15 -0
- package/dist/collections/operations/findById.d.ts.map +1 -0
- package/dist/collections/operations/findById.js +59 -0
- package/dist/collections/operations/update.d.ts +10 -0
- package/dist/collections/operations/update.d.ts.map +1 -0
- package/dist/collections/operations/update.js +134 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +61 -0
- package/dist/config/runtime.d.ts +22 -0
- package/dist/config/runtime.d.ts.map +1 -0
- package/dist/config/runtime.js +32 -0
- package/dist/config/utils.d.ts +12 -0
- package/dist/config/utils.d.ts.map +1 -0
- package/dist/config/utils.js +20 -0
- package/dist/database/index.d.ts +1 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +6 -0
- package/dist/database/ssl-config.d.ts +9 -0
- package/dist/database/ssl-config.d.ts.map +1 -0
- package/dist/database/ssl-config.js +7 -0
- package/dist/database/type-adapter.d.ts +113 -0
- package/dist/database/type-adapter.d.ts.map +1 -0
- package/dist/database/type-adapter.js +97 -0
- package/dist/database/universal-postgres.d.ts +45 -0
- package/dist/database/universal-postgres.d.ts.map +1 -0
- package/dist/database/universal-postgres.js +526 -0
- package/dist/dataloader.d.ts +26 -0
- package/dist/dataloader.d.ts.map +1 -0
- package/dist/dataloader.js +162 -0
- package/dist/error-handling/circuit-breaker.d.ts +262 -0
- package/dist/error-handling/circuit-breaker.d.ts.map +1 -0
- package/dist/error-handling/circuit-breaker.js +542 -0
- package/dist/error-handling/error-boundary.d.ts +94 -0
- package/dist/error-handling/error-boundary.d.ts.map +1 -0
- package/dist/error-handling/error-boundary.js +285 -0
- package/dist/error-handling/error-reporter.d.ts +213 -0
- package/dist/error-handling/error-reporter.d.ts.map +1 -0
- package/dist/error-handling/error-reporter.js +506 -0
- package/dist/error-handling/fallback-components.d.ts +131 -0
- package/dist/error-handling/fallback-components.d.ts.map +1 -0
- package/dist/error-handling/fallback-components.js +371 -0
- package/dist/error-handling/index.d.ts +16 -0
- package/dist/error-handling/index.d.ts.map +1 -0
- package/dist/error-handling/index.js +15 -0
- package/dist/error-handling/retry.d.ts +194 -0
- package/dist/error-handling/retry.d.ts.map +1 -0
- package/dist/error-handling/retry.js +450 -0
- package/dist/errors/index.d.ts +23 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +40 -0
- package/dist/factories/builders.d.ts +50 -0
- package/dist/factories/builders.d.ts.map +1 -0
- package/dist/factories/builders.js +77 -0
- package/dist/factories/index.d.ts +2 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +1 -0
- package/dist/features.d.ts +82 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +89 -0
- package/dist/fieldTraversal.d.ts +26 -0
- package/dist/fieldTraversal.d.ts.map +1 -0
- package/dist/fieldTraversal.js +132 -0
- package/dist/fields/config/types.d.ts +48 -0
- package/dist/fields/config/types.d.ts.map +1 -0
- package/dist/fields/config/types.js +20 -0
- package/dist/fields/getDefaultValue.d.ts +16 -0
- package/dist/fields/getDefaultValue.d.ts.map +1 -0
- package/dist/fields/getDefaultValue.js +20 -0
- package/dist/fields/getFieldPaths.d.ts +25 -0
- package/dist/fields/getFieldPaths.d.ts.map +1 -0
- package/dist/fields/getFieldPaths.js +23 -0
- package/dist/fields/hooks/afterRead/index.d.ts +36 -0
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/index.js +70 -0
- package/dist/fields/hooks/afterRead/promise.d.ts +46 -0
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/promise.js +178 -0
- package/dist/fields/hooks/afterRead/traverseFields.d.ts +44 -0
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/traverseFields.js +37 -0
- package/dist/generated/agents/index.d.ts +8 -0
- package/dist/generated/agents/index.d.ts.map +1 -0
- package/dist/generated/agents/index.js +7 -0
- package/dist/generated/components/index.d.ts +8 -0
- package/dist/generated/components/index.d.ts.map +1 -0
- package/dist/generated/components/index.js +7 -0
- package/dist/generated/functions/index.d.ts +8 -0
- package/dist/generated/functions/index.d.ts.map +1 -0
- package/dist/generated/functions/index.js +7 -0
- package/dist/generated/hooks/index.d.ts +8 -0
- package/dist/generated/hooks/index.d.ts.map +1 -0
- package/dist/generated/hooks/index.js +7 -0
- package/dist/generated/index.d.ts +10 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +9 -0
- package/dist/generated/plans/index.d.ts +8 -0
- package/dist/generated/plans/index.d.ts.map +1 -0
- package/dist/generated/plans/index.js +7 -0
- package/dist/generated/prompts/index.d.ts +8 -0
- package/dist/generated/prompts/index.d.ts.map +1 -0
- package/dist/generated/prompts/index.js +7 -0
- package/dist/generated/tools/index.d.ts +8 -0
- package/dist/generated/tools/index.d.ts.map +1 -0
- package/dist/generated/tools/index.js +7 -0
- package/dist/generated/types/cms.d.ts +1766 -0
- package/dist/generated/types/cms.d.ts.map +1 -0
- package/dist/generated/types/cms.js +12 -0
- package/dist/generated/types/index.d.ts +19 -0
- package/dist/generated/types/index.d.ts.map +1 -0
- package/dist/generated/types/index.js +28 -0
- package/dist/generated/types/neon.d.ts +11 -0
- package/dist/generated/types/neon.d.ts.map +1 -0
- package/dist/generated/types/neon.js +11 -0
- package/dist/generated/types/supabase.d.ts +193 -0
- package/dist/generated/types/supabase.d.ts.map +1 -0
- package/dist/generated/types/supabase.js +5 -0
- package/dist/globals/GlobalOperations.d.ts +24 -0
- package/dist/globals/GlobalOperations.d.ts.map +1 -0
- package/dist/globals/GlobalOperations.js +149 -0
- package/dist/globals/index.d.ts +2 -0
- package/dist/globals/index.d.ts.map +1 -0
- package/dist/globals/index.js +1 -0
- package/dist/index.d.ts +64 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -33
- package/dist/instance/RevealUIInstance.d.ts +6 -0
- package/dist/instance/RevealUIInstance.d.ts.map +1 -0
- package/dist/instance/RevealUIInstance.js +312 -0
- package/dist/instance/index.d.ts +3 -0
- package/dist/instance/index.d.ts.map +1 -0
- package/dist/instance/index.js +2 -0
- package/dist/instance/logger.d.ts +31 -0
- package/dist/instance/logger.d.ts.map +1 -0
- package/dist/instance/logger.js +42 -0
- package/dist/instance/methods/create.d.ts +10 -0
- package/dist/instance/methods/create.d.ts.map +1 -0
- package/dist/instance/methods/create.js +38 -0
- package/dist/instance/methods/delete.d.ts +10 -0
- package/dist/instance/methods/delete.d.ts.map +1 -0
- package/dist/instance/methods/delete.js +24 -0
- package/dist/instance/methods/find.d.ts +10 -0
- package/dist/instance/methods/find.d.ts.map +1 -0
- package/dist/instance/methods/find.js +23 -0
- package/dist/instance/methods/findById.d.ts +13 -0
- package/dist/instance/methods/findById.d.ts.map +1 -0
- package/dist/instance/methods/findById.js +23 -0
- package/dist/instance/methods/hooks.d.ts +14 -0
- package/dist/instance/methods/hooks.d.ts.map +1 -0
- package/dist/instance/methods/hooks.js +32 -0
- package/dist/instance/methods/update.d.ts +10 -0
- package/dist/instance/methods/update.d.ts.map +1 -0
- package/dist/instance/methods/update.js +42 -0
- package/dist/license.d.ts +73 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +157 -0
- package/dist/monitoring/alerts.d.ts +118 -0
- package/dist/monitoring/alerts.d.ts.map +1 -0
- package/dist/monitoring/alerts.js +324 -0
- package/dist/monitoring/cleanup-manager.d.ts +71 -0
- package/dist/monitoring/cleanup-manager.d.ts.map +1 -0
- package/dist/monitoring/cleanup-manager.js +226 -0
- package/dist/monitoring/health-monitor.d.ts +22 -0
- package/dist/monitoring/health-monitor.d.ts.map +1 -0
- package/dist/monitoring/health-monitor.js +142 -0
- package/dist/monitoring/index.d.ts +14 -0
- package/dist/monitoring/index.d.ts.map +1 -0
- package/dist/monitoring/index.js +17 -0
- package/dist/monitoring/process-registry.d.ts +97 -0
- package/dist/monitoring/process-registry.d.ts.map +1 -0
- package/dist/monitoring/process-registry.js +222 -0
- package/dist/monitoring/query-monitor.d.ts +153 -0
- package/dist/monitoring/query-monitor.d.ts.map +1 -0
- package/dist/monitoring/query-monitor.js +209 -0
- package/dist/monitoring/types.d.ts +231 -0
- package/dist/monitoring/types.d.ts.map +1 -0
- package/dist/monitoring/types.js +42 -0
- package/dist/monitoring/zombie-detector.d.ts +81 -0
- package/dist/monitoring/zombie-detector.d.ts.map +1 -0
- package/dist/monitoring/zombie-detector.js +231 -0
- package/dist/nextjs/index.d.ts +4 -0
- package/dist/nextjs/index.d.ts.map +1 -0
- package/dist/nextjs/index.js +3 -0
- package/dist/nextjs/utilities.d.ts +5 -0
- package/dist/nextjs/utilities.d.ts.map +1 -0
- package/dist/nextjs/utilities.js +16 -0
- package/dist/nextjs/withRevealUI.d.ts +20 -0
- package/dist/nextjs/withRevealUI.d.ts.map +1 -0
- package/dist/nextjs/withRevealUI.js +181 -0
- package/dist/observability/alerts.d.ts +138 -0
- package/dist/observability/alerts.d.ts.map +1 -0
- package/dist/observability/alerts.js +390 -0
- package/dist/observability/health-check.d.ts +95 -0
- package/dist/observability/health-check.d.ts.map +1 -0
- package/dist/observability/health-check.js +345 -0
- package/dist/observability/index.d.ts +12 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +11 -0
- package/dist/observability/logger.d.ts +47 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +140 -0
- package/dist/observability/metrics.d.ts +205 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +429 -0
- package/dist/observability/tracing.d.ts +149 -0
- package/dist/observability/tracing.d.ts.map +1 -0
- package/dist/observability/tracing.js +381 -0
- package/dist/optimization/asset-optimizer.d.ts +202 -0
- package/dist/optimization/asset-optimizer.d.ts.map +1 -0
- package/dist/optimization/asset-optimizer.js +312 -0
- package/dist/optimization/build-optimizer.d.ts +202 -0
- package/dist/optimization/build-optimizer.d.ts.map +1 -0
- package/dist/optimization/build-optimizer.js +271 -0
- package/dist/optimization/bundle-analyzer.d.ts +98 -0
- package/dist/optimization/bundle-analyzer.d.ts.map +1 -0
- package/dist/optimization/bundle-analyzer.js +322 -0
- package/dist/optimization/code-splitting.d.ts +144 -0
- package/dist/optimization/code-splitting.d.ts.map +1 -0
- package/dist/optimization/code-splitting.js +290 -0
- package/dist/plugin/index.d.ts +12 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +4 -0
- package/dist/plugins/form-builder.d.ts +115 -0
- package/dist/plugins/form-builder.d.ts.map +1 -0
- package/dist/plugins/form-builder.js +239 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/nested-docs.d.ts +8 -0
- package/dist/plugins/nested-docs.d.ts.map +1 -0
- package/dist/plugins/nested-docs.js +67 -0
- package/dist/plugins/redirects.d.ts +17 -0
- package/dist/plugins/redirects.d.ts.map +1 -0
- package/dist/plugins/redirects.js +62 -0
- package/dist/queries/index.d.ts +2 -0
- package/dist/queries/index.d.ts.map +1 -0
- package/dist/queries/index.js +1 -0
- package/dist/queries/queryBuilder.d.ts +47 -0
- package/dist/queries/queryBuilder.d.ts.map +1 -0
- package/dist/queries/queryBuilder.js +252 -0
- package/dist/relationships/analyzer.d.ts +39 -0
- package/dist/relationships/analyzer.d.ts.map +1 -0
- package/dist/relationships/analyzer.js +127 -0
- package/dist/relationships/index.d.ts +3 -0
- package/dist/relationships/index.d.ts.map +1 -0
- package/dist/relationships/index.js +2 -0
- package/dist/relationships/populate-helpers.d.ts +104 -0
- package/dist/relationships/populate-helpers.d.ts.map +1 -0
- package/dist/relationships/populate-helpers.js +187 -0
- package/dist/relationships/population.d.ts +42 -0
- package/dist/relationships/population.d.ts.map +1 -0
- package/dist/relationships/population.js +188 -0
- package/dist/revealui.d.ts +46 -0
- package/dist/revealui.d.ts.map +1 -0
- package/dist/revealui.js +92 -0
- package/dist/richtext/exports/client/rcc.d.ts +37 -0
- package/dist/richtext/exports/client/rcc.d.ts.map +1 -0
- package/dist/richtext/exports/client/rcc.js +182 -0
- package/dist/richtext/exports/server/rsc.d.ts +117 -0
- package/dist/richtext/exports/server/rsc.d.ts.map +1 -0
- package/dist/richtext/exports/server/rsc.js +288 -0
- package/dist/richtext/index.d.ts +161 -0
- package/dist/richtext/index.d.ts.map +1 -0
- package/dist/richtext/index.js +243 -0
- package/dist/richtext/lexical.d.ts +23 -0
- package/dist/richtext/lexical.d.ts.map +1 -0
- package/dist/richtext/lexical.js +35 -0
- package/dist/security/audit.d.ts +188 -0
- package/dist/security/audit.d.ts.map +1 -0
- package/dist/security/audit.js +431 -0
- package/dist/security/auth.d.ts +241 -0
- package/dist/security/auth.d.ts.map +1 -0
- package/dist/security/auth.js +474 -0
- package/dist/security/authorization.d.ts +235 -0
- package/dist/security/authorization.d.ts.map +1 -0
- package/dist/security/authorization.js +434 -0
- package/dist/security/encryption.d.ts +214 -0
- package/dist/security/encryption.d.ts.map +1 -0
- package/dist/security/encryption.js +506 -0
- package/dist/security/gdpr.d.ts +300 -0
- package/dist/security/gdpr.d.ts.map +1 -0
- package/dist/security/gdpr.js +470 -0
- package/dist/security/headers.d.ts +182 -0
- package/dist/security/headers.d.ts.map +1 -0
- package/dist/security/headers.js +402 -0
- package/dist/security/index.d.ts +19 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +18 -0
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +28 -0
- package/dist/server/renderPage.d.ts +69 -0
- package/dist/server/renderPage.d.ts.map +1 -0
- package/dist/server/renderPage.js +109 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +4 -0
- package/dist/storage/vercel-blob.d.ts +17 -0
- package/dist/storage/vercel-blob.d.ts.map +1 -0
- package/dist/storage/vercel-blob.js +83 -0
- package/dist/translations/index.d.ts +17 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +1 -0
- package/dist/types/access.d.ts +67 -0
- package/dist/types/access.d.ts.map +1 -0
- package/dist/types/access.js +8 -0
- package/dist/types/api.d.ts +57 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +8 -0
- package/dist/types/cms.d.ts +8 -0
- package/dist/types/cms.d.ts.map +1 -0
- package/dist/types/cms.js +6 -0
- package/dist/types/config.d.ts +152 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +9 -0
- package/dist/types/core.d.ts +11 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +9 -0
- package/dist/types/extensions.d.ts +116 -0
- package/dist/types/extensions.d.ts.map +1 -0
- package/dist/types/extensions.js +8 -0
- package/dist/types/frontend.d.ts +53 -0
- package/dist/types/frontend.d.ts.map +1 -0
- package/dist/types/frontend.js +7 -0
- package/dist/types/generated.d.ts +14 -0
- package/dist/types/generated.d.ts.map +1 -0
- package/dist/types/generated.js +11 -0
- package/dist/types/hooks.d.ts +53 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/hooks.js +8 -0
- package/dist/types/index.d.ts +49 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +61 -0
- package/dist/types/interfaces/app.d.ts +50 -0
- package/dist/types/interfaces/app.d.ts.map +1 -0
- package/dist/types/interfaces/app.js +5 -0
- package/dist/types/jobs.d.ts +112 -0
- package/dist/types/jobs.d.ts.map +1 -0
- package/dist/types/jobs.js +7 -0
- package/dist/types/legacy.d.ts +147 -0
- package/dist/types/legacy.d.ts.map +1 -0
- package/dist/types/legacy.js +8 -0
- package/dist/types/plugins.d.ts +17 -0
- package/dist/types/plugins.d.ts.map +1 -0
- package/dist/types/plugins.js +8 -0
- package/dist/types/query.d.ts +99 -0
- package/dist/types/query.d.ts.map +1 -0
- package/dist/types/query.js +24 -0
- package/dist/types/request.d.ts +40 -0
- package/dist/types/request.d.ts.map +1 -0
- package/dist/types/request.js +8 -0
- package/dist/types/richtext.d.ts +23 -0
- package/dist/types/richtext.d.ts.map +1 -0
- package/dist/types/richtext.js +8 -0
- package/dist/types/runtime.d.ts +216 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +9 -0
- package/dist/types/schema.d.ts +9 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +7 -0
- package/dist/types/user.d.ts +48 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +8 -0
- package/dist/utils/access-conversion.d.ts +17 -0
- package/dist/utils/access-conversion.d.ts.map +1 -0
- package/dist/utils/access-conversion.js +96 -0
- package/dist/utils/api-wrapper.d.ts +63 -0
- package/dist/utils/api-wrapper.d.ts.map +1 -0
- package/dist/utils/api-wrapper.js +151 -0
- package/dist/utils/block-conversion.d.ts +21 -0
- package/dist/utils/block-conversion.d.ts.map +1 -0
- package/dist/utils/block-conversion.js +109 -0
- package/dist/utils/cache.d.ts +86 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +154 -0
- package/dist/utils/deep-clone.d.ts +25 -0
- package/dist/utils/deep-clone.d.ts.map +1 -0
- package/dist/utils/deep-clone.js +115 -0
- package/dist/utils/error-responses.d.ts +57 -0
- package/dist/utils/error-responses.d.ts.map +1 -0
- package/dist/utils/error-responses.js +96 -0
- package/dist/utils/errors.d.ts +97 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +397 -0
- package/dist/utils/field-conversion.d.ts +40 -0
- package/dist/utils/field-conversion.d.ts.map +1 -0
- package/dist/utils/field-conversion.js +275 -0
- package/dist/utils/flattenResult.d.ts +7 -0
- package/dist/utils/flattenResult.d.ts.map +1 -0
- package/dist/utils/flattenResult.js +23 -0
- package/dist/utils/getBlockSelect.d.ts +12 -0
- package/dist/utils/getBlockSelect.d.ts.map +1 -0
- package/dist/utils/getBlockSelect.js +12 -0
- package/dist/utils/getSelectMode.d.ts +8 -0
- package/dist/utils/getSelectMode.d.ts.map +1 -0
- package/dist/utils/getSelectMode.js +21 -0
- package/dist/utils/isValidID.d.ts +5 -0
- package/dist/utils/isValidID.d.ts.map +1 -0
- package/dist/utils/isValidID.js +13 -0
- package/dist/utils/json-parsing.d.ts +48 -0
- package/dist/utils/json-parsing.d.ts.map +1 -0
- package/dist/utils/json-parsing.js +130 -0
- package/dist/utils/jwt-validation.d.ts +14 -0
- package/dist/utils/jwt-validation.d.ts.map +1 -0
- package/dist/utils/jwt-validation.js +36 -0
- package/dist/utils/logger-client.d.ts +32 -0
- package/dist/utils/logger-client.d.ts.map +1 -0
- package/dist/utils/logger-client.js +55 -0
- package/dist/utils/logger-server.d.ts +32 -0
- package/dist/utils/logger-server.d.ts.map +1 -0
- package/dist/utils/logger-server.js +68 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +12 -0
- package/dist/utils/request-context.d.ts +143 -0
- package/dist/utils/request-context.d.ts.map +1 -0
- package/dist/utils/request-context.js +168 -0
- package/dist/utils/request-headers.d.ts +15 -0
- package/dist/utils/request-headers.d.ts.map +1 -0
- package/dist/utils/request-headers.js +31 -0
- package/dist/utils/stripUnselectedFields.d.ts +10 -0
- package/dist/utils/stripUnselectedFields.d.ts.map +1 -0
- package/dist/utils/stripUnselectedFields.js +20 -0
- package/dist/utils/type-guards.d.ts +33 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +63 -0
- package/dist/utils/user.d.ts +14 -0
- package/dist/utils/user.d.ts.map +1 -0
- package/dist/utils/user.js +15 -0
- package/package.json +250 -724
- package/LICENSE_SUMMARY.md +0 -55
- package/NOTICE +0 -34
- package/dist/exports/RenderErrorPage.js +0 -3
- package/dist/exports/__internal.js +0 -3
- package/dist/exports/abort.js +0 -3
- package/dist/exports/bin-entry.js +0 -5
- package/dist/exports/client.js +0 -3
- package/dist/exports/config.js +0 -1
- package/dist/exports/helpers.js +0 -1
- package/dist/exports/index.js +0 -33
- package/dist/exports/plugin.js +0 -3
- package/dist/exports/prerender.js +0 -3
- package/dist/exports/router.js +0 -3
- package/dist/exports/routing.js +0 -3
- package/dist/exports/server.js +0 -3
- package/dist/exports/setup.js +0 -3
- package/dist/exports/types.js +0 -1
- package/dist/integration/styles.css +0 -141
- package/dist/shared/RenderErrorPage.d.ts +0 -3
- package/dist/shared/RenderErrorPage.js +0 -3
- package/dist/shared/abort.js +0 -3
- package/dist/shared/route/routing.js +0 -3
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal PostgreSQL Adapter for RevealUI CMS
|
|
3
|
+
*
|
|
4
|
+
* Supports multiple PostgreSQL providers:
|
|
5
|
+
* - Neon Database (https://neon.tech)
|
|
6
|
+
* - Supabase (https://supabase.com)
|
|
7
|
+
* - Vercel Postgres (https://vercel.com/storage/postgres)
|
|
8
|
+
*
|
|
9
|
+
* Automatically detects the provider based on connection string or environment.
|
|
10
|
+
*
|
|
11
|
+
* WARNING: This module uses Node.js-specific database drivers.
|
|
12
|
+
* Do NOT import in client-side code or edge runtime.
|
|
13
|
+
*/
|
|
14
|
+
import { defaultLogger } from '../instance/logger.js';
|
|
15
|
+
import { logger } from '../observability/logger.js';
|
|
16
|
+
import { getSSLConfig } from './ssl-config.js';
|
|
17
|
+
/**
|
|
18
|
+
* Worker-isolated PGlite instances for parallel test execution
|
|
19
|
+
* Each Vitest worker thread gets its own isolated database instance
|
|
20
|
+
* Key: worker ID (from VITEST_WORKER_ID env var)
|
|
21
|
+
* Value: PGlite instance for that worker
|
|
22
|
+
*/
|
|
23
|
+
const workerPGliteInstances = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* Worker-isolated table creation promises
|
|
26
|
+
* Each worker tracks its own pending table creations
|
|
27
|
+
*/
|
|
28
|
+
const workerPendingTableCreations = new Map();
|
|
29
|
+
/**
|
|
30
|
+
* Worker-isolated table tracking
|
|
31
|
+
* Each worker tracks which tables it has created
|
|
32
|
+
*/
|
|
33
|
+
const workerCreatedTables = new Map();
|
|
34
|
+
/**
|
|
35
|
+
* Get the current worker ID for test isolation
|
|
36
|
+
* In tests: Uses VITEST_WORKER_ID to isolate per worker thread
|
|
37
|
+
* In production: Uses 'main' for single shared instance
|
|
38
|
+
*/
|
|
39
|
+
function getWorkerID() {
|
|
40
|
+
return process.env.VITEST_WORKER_ID || 'main';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get or create worker-specific PGlite instance
|
|
44
|
+
*/
|
|
45
|
+
function getWorkerPGliteInstance() {
|
|
46
|
+
const workerID = getWorkerID();
|
|
47
|
+
return workerPGliteInstances.get(workerID) || null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Set worker-specific PGlite instance
|
|
51
|
+
*/
|
|
52
|
+
function setWorkerPGliteInstance(instance) {
|
|
53
|
+
const workerID = getWorkerID();
|
|
54
|
+
workerPGliteInstances.set(workerID, instance);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get worker-specific pending table creations
|
|
58
|
+
*/
|
|
59
|
+
function getWorkerPendingTableCreations() {
|
|
60
|
+
const workerID = getWorkerID();
|
|
61
|
+
if (!workerPendingTableCreations.has(workerID)) {
|
|
62
|
+
workerPendingTableCreations.set(workerID, []);
|
|
63
|
+
}
|
|
64
|
+
return workerPendingTableCreations.get(workerID);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get worker-specific created tables set
|
|
68
|
+
*/
|
|
69
|
+
function getWorkerCreatedTables() {
|
|
70
|
+
const workerID = getWorkerID();
|
|
71
|
+
if (!workerCreatedTables.has(workerID)) {
|
|
72
|
+
workerCreatedTables.set(workerID, new Set());
|
|
73
|
+
}
|
|
74
|
+
return workerCreatedTables.get(workerID);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Detects the PostgreSQL provider from connection string
|
|
78
|
+
*/
|
|
79
|
+
function detectProvider(connectionString) {
|
|
80
|
+
const url = connectionString.toLowerCase();
|
|
81
|
+
if (url.includes('.neon.tech') || url.includes('neon.tech')) {
|
|
82
|
+
return 'neon';
|
|
83
|
+
}
|
|
84
|
+
if (url.includes('.supabase.co') || url.includes('supabase')) {
|
|
85
|
+
return 'supabase';
|
|
86
|
+
}
|
|
87
|
+
if (url.includes('electric') || process.env.ELECTRIC_ENV) {
|
|
88
|
+
return 'electric';
|
|
89
|
+
}
|
|
90
|
+
return 'generic';
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Creates a universal PostgreSQL adapter that works with Neon, Supabase, and Electric Postgres
|
|
94
|
+
*/
|
|
95
|
+
export function universalPostgresAdapter(config = {}) {
|
|
96
|
+
let queryFn;
|
|
97
|
+
let provider = 'generic';
|
|
98
|
+
const initializeConnection = async () => {
|
|
99
|
+
// Allow explicit electric provider without a connection string (PGlite local)
|
|
100
|
+
let connectionString;
|
|
101
|
+
if (config.provider === 'electric') {
|
|
102
|
+
provider = 'electric';
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// Get connection string from config or environment
|
|
106
|
+
connectionString =
|
|
107
|
+
config.connectionString ||
|
|
108
|
+
process.env[config.envVar || 'DATABASE_URL'] ||
|
|
109
|
+
process.env.POSTGRES_URL ||
|
|
110
|
+
process.env.SUPABASE_DATABASE_URI ||
|
|
111
|
+
process.env.DATABASE_URL;
|
|
112
|
+
if (!connectionString) {
|
|
113
|
+
throw new Error('Database connection string not found. Set DATABASE_URL, POSTGRES_URL, or SUPABASE_DATABASE_URI environment variable.');
|
|
114
|
+
}
|
|
115
|
+
// Detect provider if not explicitly set
|
|
116
|
+
provider = config.provider || detectProvider(connectionString);
|
|
117
|
+
}
|
|
118
|
+
// Initialize provider-specific query function
|
|
119
|
+
// Note: connectionString is guaranteed defined for non-electric providers (throws at line 81 if undefined)
|
|
120
|
+
switch (provider) {
|
|
121
|
+
case 'neon': {
|
|
122
|
+
// Use pg library for Neon (more compatible with parameterized queries)
|
|
123
|
+
// Neon serverless has limitations with $1, $2 style parameters
|
|
124
|
+
// Using pg ensures full PostgreSQL compatibility
|
|
125
|
+
const neonConnectionString = connectionString;
|
|
126
|
+
queryFn = async (queryString, values = []) => {
|
|
127
|
+
try {
|
|
128
|
+
// Use pg library for best compatibility with parameterized queries
|
|
129
|
+
const { Pool } = await import('pg');
|
|
130
|
+
const pool = new Pool({
|
|
131
|
+
connectionString: neonConnectionString,
|
|
132
|
+
ssl: getSSLConfig(neonConnectionString),
|
|
133
|
+
});
|
|
134
|
+
const client = await pool.connect();
|
|
135
|
+
try {
|
|
136
|
+
const result = await client.query(queryString, values);
|
|
137
|
+
return {
|
|
138
|
+
rows: result.rows,
|
|
139
|
+
rowCount: result.rowCount || 0,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
client.release();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
defaultLogger.error('Neon database query error:', error);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case 'supabase': {
|
|
154
|
+
// CRITICAL: For Supabase transaction pooling (port 6543), we use pg library
|
|
155
|
+
// Transaction pooling works fine with pg - no special configuration needed
|
|
156
|
+
// Reference: https://supabase.com/docs/guides/database/connecting-to-postgres
|
|
157
|
+
const supabaseConnectionString = connectionString;
|
|
158
|
+
const isTransactionPooling = supabaseConnectionString.includes(':6543');
|
|
159
|
+
if (isTransactionPooling) {
|
|
160
|
+
// For transaction pooling: Use pg library with parameterized queries
|
|
161
|
+
// pg supports $1, $2 style parameters without prepared statements
|
|
162
|
+
const { Pool } = await import('pg');
|
|
163
|
+
const pool = new Pool({
|
|
164
|
+
connectionString: supabaseConnectionString,
|
|
165
|
+
ssl: getSSLConfig(supabaseConnectionString),
|
|
166
|
+
});
|
|
167
|
+
queryFn = async (queryString, values = []) => {
|
|
168
|
+
const client = await pool.connect();
|
|
169
|
+
try {
|
|
170
|
+
const result = await client.query(queryString, values);
|
|
171
|
+
return {
|
|
172
|
+
rows: result.rows,
|
|
173
|
+
rowCount: result.rowCount || 0,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
client.release();
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// Use pg library for session pooling or direct connections (port 5432)
|
|
183
|
+
const { Pool } = await import('pg');
|
|
184
|
+
const pool = new Pool({
|
|
185
|
+
connectionString: supabaseConnectionString,
|
|
186
|
+
ssl: getSSLConfig(supabaseConnectionString),
|
|
187
|
+
});
|
|
188
|
+
queryFn = async (queryString, values = []) => {
|
|
189
|
+
try {
|
|
190
|
+
const client = await pool.connect();
|
|
191
|
+
try {
|
|
192
|
+
const result = await client.query(queryString, values);
|
|
193
|
+
return {
|
|
194
|
+
rows: result.rows,
|
|
195
|
+
rowCount: result.rowCount || 0,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
finally {
|
|
199
|
+
client.release();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
defaultLogger.error('Supabase database query error:', error);
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
case 'electric': {
|
|
211
|
+
// Use worker-isolated PGlite instance for parallel test execution
|
|
212
|
+
// Each Vitest worker gets its own database instance to prevent race conditions
|
|
213
|
+
let db = getWorkerPGliteInstance();
|
|
214
|
+
if (!db) {
|
|
215
|
+
const { PGlite } = await import('@electric-sql/pglite');
|
|
216
|
+
db = new PGlite();
|
|
217
|
+
setWorkerPGliteInstance(db);
|
|
218
|
+
}
|
|
219
|
+
queryFn = async (queryString, values = []) => {
|
|
220
|
+
const result = await db.query(queryString, values);
|
|
221
|
+
return {
|
|
222
|
+
rows: result.rows,
|
|
223
|
+
rowCount: result.rowCount || 0,
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
default: {
|
|
229
|
+
// Generic PostgreSQL using pg (node-postgres)
|
|
230
|
+
const genericConnectionString = connectionString;
|
|
231
|
+
const { Pool } = await import('pg');
|
|
232
|
+
const pool = new Pool({
|
|
233
|
+
connectionString: genericConnectionString,
|
|
234
|
+
ssl: getSSLConfig(genericConnectionString),
|
|
235
|
+
});
|
|
236
|
+
queryFn = async (queryString, values = []) => {
|
|
237
|
+
try {
|
|
238
|
+
const client = await pool.connect();
|
|
239
|
+
try {
|
|
240
|
+
const result = await client.query(queryString, values);
|
|
241
|
+
return {
|
|
242
|
+
rows: result.rows,
|
|
243
|
+
rowCount: result.rowCount || 0,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
client.release();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
defaultLogger.error('PostgreSQL query error:', error);
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
let initialized = false;
|
|
260
|
+
return {
|
|
261
|
+
async init() {
|
|
262
|
+
// Initialize connection for PGlite
|
|
263
|
+
if (!initialized) {
|
|
264
|
+
await initializeConnection();
|
|
265
|
+
initialized = true;
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
async connect() {
|
|
269
|
+
if (!initialized) {
|
|
270
|
+
await initializeConnection();
|
|
271
|
+
initialized = true;
|
|
272
|
+
}
|
|
273
|
+
// Wait for all pending table creation promises to complete
|
|
274
|
+
const pendingCreations = getWorkerPendingTableCreations();
|
|
275
|
+
if (pendingCreations.length > 0) {
|
|
276
|
+
try {
|
|
277
|
+
await Promise.all(pendingCreations);
|
|
278
|
+
// Clear promises after successful execution
|
|
279
|
+
pendingCreations.length = 0;
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
defaultLogger.error('Failed to create tables:', error);
|
|
283
|
+
throw error;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// Test connection
|
|
287
|
+
try {
|
|
288
|
+
await queryFn('SELECT 1', []);
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
defaultLogger.error(`Failed to connect to ${provider} database:`, error);
|
|
292
|
+
throw error;
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
async disconnect() {
|
|
296
|
+
// Connection pooling is handled by the provider libraries
|
|
297
|
+
// No explicit disconnect needed for most providers
|
|
298
|
+
if (provider === 'supabase' || provider === 'generic') {
|
|
299
|
+
// pg Pool cleanup would go here if needed
|
|
300
|
+
// Most providers handle connection cleanup automatically
|
|
301
|
+
}
|
|
302
|
+
await Promise.resolve();
|
|
303
|
+
},
|
|
304
|
+
async query(queryString, values = []) {
|
|
305
|
+
if (!initialized) {
|
|
306
|
+
await initializeConnection();
|
|
307
|
+
initialized = true;
|
|
308
|
+
}
|
|
309
|
+
// Wait for any pending table creations before executing queries
|
|
310
|
+
const pendingCreations = getWorkerPendingTableCreations();
|
|
311
|
+
if (pendingCreations.length > 0) {
|
|
312
|
+
logger.debug('[PGlite] Query intercepted: waiting for pending table creations', {
|
|
313
|
+
pendingCount: pendingCreations.length,
|
|
314
|
+
});
|
|
315
|
+
try {
|
|
316
|
+
await Promise.all(pendingCreations);
|
|
317
|
+
logger.debug('[PGlite] All table creations completed', {
|
|
318
|
+
count: pendingCreations.length,
|
|
319
|
+
});
|
|
320
|
+
// Clear promises after successful execution
|
|
321
|
+
pendingCreations.length = 0;
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
logger.error('[PGlite] Table creation failed', error instanceof Error ? error : new Error(String(error)));
|
|
325
|
+
defaultLogger.error('Failed to create tables before query:', error);
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return queryFn(queryString, values);
|
|
330
|
+
},
|
|
331
|
+
// Create table schema for PGlite provider
|
|
332
|
+
// For other providers, tables should be created via migrations
|
|
333
|
+
createTable: config.provider === 'electric' ||
|
|
334
|
+
!(config.connectionString ||
|
|
335
|
+
config.envVar ||
|
|
336
|
+
process.env.DATABASE_URL ||
|
|
337
|
+
process.env.POSTGRES_URL ||
|
|
338
|
+
process.env.SUPABASE_DATABASE_URI)
|
|
339
|
+
? (tableName, fields) => {
|
|
340
|
+
const createdTables = getWorkerCreatedTables();
|
|
341
|
+
// Skip if table was already created in this worker
|
|
342
|
+
if (createdTables.has(tableName)) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
// Mark as created to prevent duplicates in this worker
|
|
346
|
+
createdTables.add(tableName);
|
|
347
|
+
// Build CREATE TABLE SQL statement
|
|
348
|
+
const columns = [
|
|
349
|
+
'id TEXT PRIMARY KEY', // TEXT to support both string IDs (rvl_*) and integer IDs
|
|
350
|
+
'created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
|
|
351
|
+
'updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
|
|
352
|
+
'_status TEXT', // Draft/published status
|
|
353
|
+
'_json JSONB', // Store complex field types (arrays, relationships with hasMany, etc.)
|
|
354
|
+
];
|
|
355
|
+
// Add fields from collection definition
|
|
356
|
+
// Skip reserved columns (id, created_at, updated_at) as they're already added
|
|
357
|
+
const reservedColumns = ['id', 'created_at', 'updated_at', 'createdAt', 'updatedAt'];
|
|
358
|
+
for (const field of fields) {
|
|
359
|
+
if ('name' in field && field.name && !reservedColumns.includes(field.name)) {
|
|
360
|
+
let columnType = 'TEXT';
|
|
361
|
+
// Map field types to PostgreSQL types
|
|
362
|
+
if ('type' in field) {
|
|
363
|
+
switch (field.type) {
|
|
364
|
+
case 'number':
|
|
365
|
+
columnType = 'NUMERIC';
|
|
366
|
+
break;
|
|
367
|
+
case 'checkbox':
|
|
368
|
+
columnType = 'BOOLEAN';
|
|
369
|
+
break;
|
|
370
|
+
case 'date':
|
|
371
|
+
columnType = 'TIMESTAMP';
|
|
372
|
+
break;
|
|
373
|
+
case 'json':
|
|
374
|
+
case 'richText':
|
|
375
|
+
case 'array':
|
|
376
|
+
case 'blocks':
|
|
377
|
+
columnType = 'JSONB';
|
|
378
|
+
break;
|
|
379
|
+
case 'relationship':
|
|
380
|
+
columnType = 'INTEGER'; // Foreign key
|
|
381
|
+
break;
|
|
382
|
+
default:
|
|
383
|
+
columnType = 'TEXT';
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const required = 'required' in field && field.required ? 'NOT NULL' : '';
|
|
387
|
+
columns.push(`"${field.name}" ${columnType} ${required}`.trim());
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
const createTableSQL = `CREATE TABLE IF NOT EXISTS "${tableName}" (${columns.join(', ')})`;
|
|
391
|
+
// Debug: log SQL
|
|
392
|
+
logger.debug('[PGlite] CREATE TABLE SQL', { tableName, sql: createTableSQL });
|
|
393
|
+
// Execute CREATE TABLE and store promise for awaiting before queries
|
|
394
|
+
// Don't catch errors here - let them propagate when the promise is awaited
|
|
395
|
+
const workerCreatedTables = getWorkerCreatedTables();
|
|
396
|
+
const createPromise = (async () => {
|
|
397
|
+
logger.debug('[PGlite] Worker executing CREATE TABLE', {
|
|
398
|
+
workerId: getWorkerID(),
|
|
399
|
+
tableName,
|
|
400
|
+
});
|
|
401
|
+
try {
|
|
402
|
+
const result = await queryFn(createTableSQL, []);
|
|
403
|
+
logger.debug('[PGlite] Worker successfully created table', {
|
|
404
|
+
workerId: getWorkerID(),
|
|
405
|
+
tableName,
|
|
406
|
+
result,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
catch (error) {
|
|
410
|
+
// Remove from created set on failure so it can be retried
|
|
411
|
+
workerCreatedTables.delete(tableName);
|
|
412
|
+
logger.error('[PGlite] Worker FAILED to create table', error instanceof Error ? error : new Error(String(error)), { workerId: getWorkerID(), tableName });
|
|
413
|
+
defaultLogger.error(`Failed to create table ${tableName}:`, error);
|
|
414
|
+
defaultLogger.error('SQL:', createTableSQL);
|
|
415
|
+
throw error;
|
|
416
|
+
}
|
|
417
|
+
})();
|
|
418
|
+
const pendingCreations = getWorkerPendingTableCreations();
|
|
419
|
+
logger.debug('[PGlite] Worker added promise to pending queue', {
|
|
420
|
+
workerId: getWorkerID(),
|
|
421
|
+
tableName,
|
|
422
|
+
totalPending: pendingCreations.length + 1,
|
|
423
|
+
});
|
|
424
|
+
pendingCreations.push(createPromise);
|
|
425
|
+
}
|
|
426
|
+
: undefined,
|
|
427
|
+
// Create global table schema for PGlite provider
|
|
428
|
+
createGlobalTable: config.provider === 'electric' ||
|
|
429
|
+
!(config.connectionString ||
|
|
430
|
+
config.envVar ||
|
|
431
|
+
process.env.DATABASE_URL ||
|
|
432
|
+
process.env.POSTGRES_URL ||
|
|
433
|
+
process.env.SUPABASE_DATABASE_URI)
|
|
434
|
+
? (globalSlug, fields) => {
|
|
435
|
+
const tableName = `global_${globalSlug}`;
|
|
436
|
+
const createdTables = getWorkerCreatedTables();
|
|
437
|
+
// Skip if table was already created in this worker
|
|
438
|
+
if (createdTables.has(tableName)) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
// Mark as created to prevent duplicates in this worker
|
|
442
|
+
createdTables.add(tableName);
|
|
443
|
+
// Build CREATE TABLE SQL statement for global
|
|
444
|
+
const columns = [
|
|
445
|
+
'id TEXT PRIMARY KEY', // TEXT to support both string IDs (rvl_*) and integer IDs
|
|
446
|
+
'created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
|
|
447
|
+
'updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
|
|
448
|
+
'_status TEXT', // Draft/published status
|
|
449
|
+
'_json JSONB', // Store complex field types (arrays, relationships with hasMany, etc.)
|
|
450
|
+
];
|
|
451
|
+
// Add fields from global definition
|
|
452
|
+
// Skip reserved columns (id, created_at, updated_at) as they're already added
|
|
453
|
+
const reservedColumns = ['id', 'created_at', 'updated_at', 'createdAt', 'updatedAt'];
|
|
454
|
+
for (const field of fields) {
|
|
455
|
+
if ('name' in field && field.name && !reservedColumns.includes(field.name)) {
|
|
456
|
+
let columnType = 'TEXT';
|
|
457
|
+
// Map field types to PostgreSQL types
|
|
458
|
+
if ('type' in field) {
|
|
459
|
+
switch (field.type) {
|
|
460
|
+
case 'number':
|
|
461
|
+
columnType = 'NUMERIC';
|
|
462
|
+
break;
|
|
463
|
+
case 'checkbox':
|
|
464
|
+
columnType = 'BOOLEAN';
|
|
465
|
+
break;
|
|
466
|
+
case 'date':
|
|
467
|
+
columnType = 'TIMESTAMP';
|
|
468
|
+
break;
|
|
469
|
+
case 'json':
|
|
470
|
+
case 'richText':
|
|
471
|
+
case 'array':
|
|
472
|
+
case 'blocks':
|
|
473
|
+
columnType = 'JSONB';
|
|
474
|
+
break;
|
|
475
|
+
default:
|
|
476
|
+
columnType = 'TEXT';
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
const required = 'required' in field && field.required ? 'NOT NULL' : '';
|
|
480
|
+
columns.push(`"${field.name}" ${columnType} ${required}`.trim());
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
const createTableSQL = `CREATE TABLE IF NOT EXISTS "${tableName}" (${columns.join(', ')})`;
|
|
484
|
+
// Execute CREATE TABLE and store promise for awaiting before queries
|
|
485
|
+
// Don't catch errors here - let them propagate when the promise is awaited
|
|
486
|
+
const workerCreatedTables = getWorkerCreatedTables();
|
|
487
|
+
const createPromise = (async () => {
|
|
488
|
+
try {
|
|
489
|
+
await queryFn(createTableSQL, []);
|
|
490
|
+
}
|
|
491
|
+
catch (error) {
|
|
492
|
+
// Remove from created set on failure so it can be retried
|
|
493
|
+
workerCreatedTables.delete(tableName);
|
|
494
|
+
defaultLogger.error(`Failed to create global table ${tableName}:`, error);
|
|
495
|
+
defaultLogger.error('SQL:', createTableSQL);
|
|
496
|
+
throw error;
|
|
497
|
+
}
|
|
498
|
+
})();
|
|
499
|
+
const pendingCreations = getWorkerPendingTableCreations();
|
|
500
|
+
pendingCreations.push(createPromise);
|
|
501
|
+
}
|
|
502
|
+
: undefined,
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Clear all worker-specific PGlite instances and state (useful for test cleanup)
|
|
507
|
+
* Only affects electric provider
|
|
508
|
+
* Can optionally clear just the current worker or all workers
|
|
509
|
+
*/
|
|
510
|
+
export function clearGlobalPGlite(clearAllWorkers = false) {
|
|
511
|
+
if (clearAllWorkers) {
|
|
512
|
+
// Clear all workers (for global cleanup)
|
|
513
|
+
workerPGliteInstances.clear();
|
|
514
|
+
workerPendingTableCreations.clear();
|
|
515
|
+
workerCreatedTables.clear();
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
// Clear only current worker (for test isolation)
|
|
519
|
+
const workerID = getWorkerID();
|
|
520
|
+
workerPGliteInstances.delete(workerID);
|
|
521
|
+
workerPendingTableCreations.delete(workerID);
|
|
522
|
+
workerCreatedTables.delete(workerID);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
// Export as default for convenience
|
|
526
|
+
export default universalPostgresAdapter;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import DataLoader from 'dataloader';
|
|
2
|
+
import type { RevealPaginatedResult, TypedFallbackLocale } from './index.js';
|
|
3
|
+
import type { PopulateType, RevealFindOptions, RevealRequest, SelectType, TypeWithID } from './types/index.js';
|
|
4
|
+
interface ExtendedDataLoader extends DataLoader<string, TypeWithID> {
|
|
5
|
+
find: (args: RevealFindOptions & {
|
|
6
|
+
collection: string;
|
|
7
|
+
}) => Promise<RevealPaginatedResult>;
|
|
8
|
+
}
|
|
9
|
+
export declare const getDataLoader: (req: RevealRequest) => ExtendedDataLoader;
|
|
10
|
+
type CreateCacheKeyArgs = {
|
|
11
|
+
collectionSlug: string;
|
|
12
|
+
currentDepth: number;
|
|
13
|
+
depth: number;
|
|
14
|
+
docID: number | string;
|
|
15
|
+
draft: boolean;
|
|
16
|
+
fallbackLocale: TypedFallbackLocale;
|
|
17
|
+
locale: string | string[];
|
|
18
|
+
overrideAccess: boolean;
|
|
19
|
+
populate?: PopulateType;
|
|
20
|
+
select?: SelectType;
|
|
21
|
+
showHiddenFields: boolean;
|
|
22
|
+
transactionID: number | Promise<number | string> | string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export declare const createDataloaderCacheKey: ({ collectionSlug, currentDepth, depth, docID, draft, fallbackLocale, locale, overrideAccess, populate, select, showHiddenFields, transactionID, }: CreateCacheKeyArgs) => string;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=dataloader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataloader.d.ts","sourceRoot":"","sources":["../src/dataloader.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,UAAU,EACX,MAAM,kBAAkB,CAAA;AA8LzB,UAAU,kBAAmB,SAAQ,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC;IACjE,IAAI,EAAE,CAAC,IAAI,EAAE,iBAAiB,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;CAC3F;AAED,eAAO,MAAM,aAAa,GAAI,KAAK,aAAa,KAAG,kBAmBlD,CAAA;AA6CD,KAAK,kBAAkB,GAAG;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,KAAK,EAAE,OAAO,CAAA;IACd,cAAc,EAAE,mBAAmB,CAAA;IACnC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,cAAc,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;IACzB,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;CACtE,CAAA;AACD,eAAO,MAAM,wBAAwB,GAAI,mJAatC,kBAAkB,KAAG,MAcpB,CAAA"}
|