@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
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { createRESTHandlers, handleRESTRequest } from './api/rest.js';
|
|
2
|
+
export { anyone, authenticated } from './auth/access.js';
|
|
3
|
+
export type { FloatingToolbarPluginProps, ImageNodeData, RichTextEditorProps, SerializedImageNode, ToolbarPluginProps, } from './client/index.js';
|
|
4
|
+
export { $createImageNode, $isImageNode, AdminDashboard, APIError, APIErrorType, apiClient, CollectionList, clearAuthToken, DocumentForm, FloatingToolbarPlugin, generatePageMetadata, getAuthHeader, getAuthToken, ImageNode, ImageNodeComponent, ImagePlugin, ImageUploadButton, INSERT_IMAGE_COMMAND, NotFoundPage, OPEN_IMAGE_UPLOAD_COMMAND, RootLayout, RootPage, richTextEditorStyles, serializeConfig, setAuthToken, ToolbarPlugin, useRevealUI, withRevealUIAccess, } from './client/index.js';
|
|
5
|
+
export { buildConfig } from './config/index.js';
|
|
6
|
+
export { getRevealUI } from './config/runtime.js';
|
|
7
|
+
export { deepMerge } from './config/utils.js';
|
|
8
|
+
export type { UniversalPostgresAdapterConfig } from './database/universal-postgres.js';
|
|
9
|
+
export { universalPostgresAdapter } from './database/universal-postgres.js';
|
|
10
|
+
export { createRevealUI, createRevealUIAccessRule, createRevealUIBlock, createRevealUICollection, createRevealUIField, } from './factories/index.js';
|
|
11
|
+
export { type FeatureFlags, getFeatures, getFeaturesForTier, getRequiredTier, isFeatureEnabled, } from './features.js';
|
|
12
|
+
export { generateLicenseKey, getCurrentTier, getLicensePayload, getMaxSites, getMaxUsers, initializeLicense, isLicensed, type LicensePayload, type LicenseTier, resetLicenseState, validateLicenseKey, } from './license.js';
|
|
13
|
+
export { getRevealUI as getRevealUINext, withRevealUI, } from './nextjs/index.js';
|
|
14
|
+
export { formBuilderPlugin } from './plugins/form-builder.js';
|
|
15
|
+
export { nestedDocsPlugin } from './plugins/nested-docs.js';
|
|
16
|
+
export { redirectsPlugin } from './plugins/redirects.js';
|
|
17
|
+
export { afterChangeTraverseFields, afterReadTraverseFields, beforeChangeTraverseFields, beforeValidateTraverseFields, buildWhereClause, checkDependencies, createRevealUIInstance, defaultLogger, extractWhereValues, flattenResult, getRelationshipFields, Logger, RevealUICollection, RevealUIGlobal, type RevealUILogger, type RichTextAdapter, relationshipPopulationPromise, validateRelationshipMetadata, withNullableJSONSchemaType, } from './revealui.js';
|
|
18
|
+
export { BoldFeature, FixedToolbarFeature, HeadingFeature, ItalicFeature, LinkFeature, lexicalEditor, TreeViewFeature, UnderlineFeature, } from './richtext/index.js';
|
|
19
|
+
export { vercelBlobStorage } from './storage/vercel-blob.js';
|
|
20
|
+
export { LRUCache, type LRUCacheOptions } from './utils/cache.js';
|
|
21
|
+
export { deepClone } from './utils/deep-clone.js';
|
|
22
|
+
export { createApplicationErrorResponseData, createErrorResponseData, createSuccessResponseData, createValidationErrorResponseData, type ErrorResponseData, } from './utils/error-responses.js';
|
|
23
|
+
export { ApplicationError, handleApiError, handleDatabaseError, ValidationError, } from './utils/errors.js';
|
|
24
|
+
export { createLogger, type LogContext, type LogLevel, logger, } from './utils/logger.js';
|
|
25
|
+
export { flattenFields, isJsonFieldType, isObject } from './utils/type-guards.js';
|
|
26
|
+
export { type AccessArgs, type AccessFunction, type AccessResult, type AfterChangeHookArgs, type AfterReadHookArgs, applyPluginExtensions, assertValidSlug, type BeforeChangeHookArgs, type CollectionAccessConfig, type CollectionAfterChangeHook, type CollectionAfterReadHook, type CollectionBeforeChangeHook, type CollectionBeforeValidateHook, type CollectionConfig, type CollectionHooksConfig, type Config, ConfigValidationError, defineCollection, defineField, defineGlobal, type Field, type FieldAccessConfig, type FieldValidateArgs, fromCMSCollectionConfig, fromCMSGlobalConfig, type GlobalAccessConfig, type GlobalConfig, type GlobalHooksConfig, getCustomFieldType, getRevealUIExtensions, hasRevealUIExtensions, isValidFieldType, isValidSlug, mergeCollectionConfigs, mergeFields, registerCustomFieldType, registerPluginExtension, type SanitizedCollectionConfig, type SanitizedConfig, type SanitizedGlobalConfig, safeValidate, toCMSCollectionConfig, toCMSGlobalConfig, toSlug, validateWithErrors, type Where, } from '@revealui/contracts/cms';
|
|
27
|
+
export type { Block, BlocksField, CheckboxField, DatabaseAdapter, DatabaseResult, FindArgs, JsonObject, OperationOptions, PaginatedDocs, Permission, Plugin, PluginOptions, PopulateType, RequestContext, RevealAfterChangeHook, RevealAfterReadHook, RevealBeforeChangeHook, RevealCollection, RevealCollectionConfig, RevealCollectionHooks, RevealConfig, RevealCreateOptions, RevealDataObject, RevealDeleteOptions, RevealDocument, RevealDocumentWithMeta, RevealFindOptions, RevealGlobal, RevealGlobalConfig, RevealHookContext, RevealOperator, RevealPaginatedResult, RevealRequest, RevealSelect, RevealSort, RevealUI, RevealUIAccessContext, RevealUIAccessResult, RevealUIAccessRule, RevealUICollectionConfig, RevealUIContext, RevealUIEnhancedField, RevealUIField, RevealUIFieldHook, RevealUIFieldType, RevealUIFieldValidator, RevealUIFilterResult, RevealUIFrameworkContext, RevealUIHookContext, RevealUIInstance, RevealUIPermission, RevealUITenant, RevealUIUser, RevealUIValidationRule, RevealUpdateOptions, RevealUser, RevealValue, RevealWhere, RichTextEditor, RichTextFeature, SelectType, StorageAdapter, TypeWithID, WhereClause, } from './types/index.js';
|
|
28
|
+
export { serializeLexicalState } from './richtext/index.js';
|
|
29
|
+
export type { Access, ArrayField, AuthConfig, ClientCollectionConfig, ClientConfig, CollectionAccess, CollectionAdminConfig, CollectionLabels, CustomComponent, CustomFieldTypeConfig, Document, EndpointHandler, EndpointHandlerArgs, FieldAccess, FieldAccessArgs, FieldAccessConfig as SchemaFieldAccessConfig, FieldAdminConfig, FieldHooksConfig, FieldOption, FieldType, GlobalAccess, GlobalAdminConfig, GlobalLabels, GlobalVersionsConfig, GroupField, PluginFieldExtension, RevealHandler, RevealUIAccessArgs, RevealUIBlock, RevealUIComponent, RevealUIDependencyCheckArgs, RevealUIExtensions, RevealUIRichTextAdapter, RevealUISchemaArgs, RevealUITraverseFieldsArgs, RevealUITraverseFieldsResult, SelectMode, TabDefinition, TextField, TypedFallbackLocale, UploadConfig, ValidationResult, VersionConfig, } from './types/index.js';
|
|
30
|
+
/**
|
|
31
|
+
* ## Import Guide
|
|
32
|
+
*
|
|
33
|
+
* ### Base Types (from schema - single source of truth)
|
|
34
|
+
* For standard RevealUI CMS types that work everywhere:
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { CollectionConfig, GlobalConfig, Field } from '@revealui/core'
|
|
37
|
+
* // OR directly from schema:
|
|
38
|
+
* import { CollectionConfig, GlobalConfig, Field } from '@revealui/contracts/cms'
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* ### Extended Types (RevealUI-specific)
|
|
42
|
+
* For RevealUI framework features (tenants, permissions, etc.):
|
|
43
|
+
* ```typescript
|
|
44
|
+
* import { RevealCollectionConfig, RevealGlobalConfig } from '@revealui/core'
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* ### Helper Functions
|
|
48
|
+
* For typed config creation:
|
|
49
|
+
* ```typescript
|
|
50
|
+
* import { defineCollection, defineGlobal, defineField } from '@revealui/core'
|
|
51
|
+
*
|
|
52
|
+
* const Posts = defineCollection<Post>({
|
|
53
|
+
* slug: 'posts',
|
|
54
|
+
* fields: [...]
|
|
55
|
+
* })
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* ### Validation
|
|
59
|
+
* For runtime config validation:
|
|
60
|
+
* ```typescript
|
|
61
|
+
* import { validateWithErrors, ConfigValidationError } from '@revealui/core'
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACxD,YAAY,EACV,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACL,gBAAgB,EAChB,YAAY,EAEZ,cAAc,EACd,QAAQ,EACR,YAAY,EAEZ,SAAS,EACT,cAAc,EACd,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,yBAAyB,EACzB,UAAU,EACV,QAAQ,EAER,oBAAoB,EACpB,eAAe,EACf,YAAY,EAEZ,aAAa,EAEb,WAAW,EACX,kBAAkB,GACnB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C,YAAY,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAE3E,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,KAAK,YAAY,EACjB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,WAAW,IAAI,eAAe,EAC9B,YAAY,GACb,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAEL,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,EAE5B,gBAAgB,EAEhB,iBAAiB,EAEjB,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,aAAa,EAEb,qBAAqB,EAErB,MAAM,EAEN,kBAAkB,EAClB,cAAc,EACd,KAAK,cAAc,EAEnB,KAAK,eAAe,EACpB,6BAA6B,EAC7B,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,yBAAyB,EACzB,iCAAiC,EACjC,KAAK,iBAAiB,GACvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,MAAM,GACP,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAQjF,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAE3B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EACjC,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EAEX,qBAAqB,EAErB,gBAAgB,EAChB,WAAW,EACX,YAAY,EAEZ,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAGtB,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,kBAAkB,EAClB,qBAAqB,EAErB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,sBAAsB,EACtB,WAAW,EAEX,uBAAuB,EACvB,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,YAAY,EAEZ,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,EACN,kBAAkB,EAClB,KAAK,KAAK,GACX,MAAM,yBAAyB,CAAA;AAOhC,YAAY,EAEV,KAAK,EACL,WAAW,EACX,aAAa,EACb,eAAe,EAEf,cAAc,EACd,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EAEV,MAAM,EACN,aAAa,EACb,YAAY,EACZ,cAAc,EAEd,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAEhB,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EAEnB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EAEjB,cAAc,EACd,qBAAqB,EAErB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EAExB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EAExB,mBAAmB,EAEnB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EAEnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,cAAc,EAEd,eAAe,EACf,UAAU,EACV,cAAc,EACd,UAAU,EACV,WAAW,GACZ,MAAM,kBAAkB,CAAA;AAMzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,YAAY,EAEV,MAAM,EAEN,UAAU,EACV,UAAU,EACV,sBAAsB,EAEtB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAEhB,eAAe,EAEf,qBAAqB,EACrB,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,IAAI,uBAAuB,EAC5C,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EAEX,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EAEpB,aAAa,EACb,kBAAkB,EAElB,aAAa,EACb,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,4BAA4B,EAC5B,UAAU,EACV,aAAa,EACb,SAAS,EAET,mBAAmB,EACnB,YAAY,EAEZ,gBAAgB,EAChB,aAAa,GACd,MAAM,kBAAkB,CAAA;AAKzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG"}
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
1
|
+
// Main RevealUI exports - re-export core (server) and client functionality
|
|
2
|
+
// Export core (server-side) functionality - now directly in root after flattening
|
|
3
|
+
// REST API
|
|
4
|
+
export { createRESTHandlers, handleRESTRequest } from './api/rest.js';
|
|
5
|
+
// Auth utilities
|
|
6
|
+
export { anyone, authenticated } from './auth/access.js';
|
|
7
|
+
// Export client (client-side) - but exclude RichTextEditor to avoid conflict with type
|
|
8
|
+
// Consumers should import RichTextEditor component from '@revealui/core/richtext/client' directly
|
|
9
|
+
export { $createImageNode, $isImageNode,
|
|
10
|
+
// Admin
|
|
11
|
+
AdminDashboard, APIError, APIErrorType,
|
|
12
|
+
// Re-export admin utils
|
|
13
|
+
apiClient, CollectionList, clearAuthToken, DocumentForm, FloatingToolbarPlugin, generatePageMetadata, getAuthHeader, getAuthToken, ImageNode, ImageNodeComponent, ImagePlugin, ImageUploadButton, INSERT_IMAGE_COMMAND, NotFoundPage, OPEN_IMAGE_UPLOAD_COMMAND, RootLayout, RootPage,
|
|
14
|
+
// Rich text (exclude RichTextEditor component - use richtext/client)
|
|
15
|
+
richTextEditorStyles, serializeConfig, setAuthToken,
|
|
16
|
+
// UI
|
|
17
|
+
ToolbarPlugin,
|
|
18
|
+
// Hooks
|
|
19
|
+
useRevealUI, withRevealUIAccess, } from './client/index.js';
|
|
20
|
+
// Configuration
|
|
21
|
+
export { buildConfig } from './config/index.js';
|
|
22
|
+
export { getRevealUI } from './config/runtime.js';
|
|
23
|
+
export { deepMerge } from './config/utils.js';
|
|
24
|
+
export { universalPostgresAdapter } from './database/universal-postgres.js';
|
|
25
|
+
// Factory functions
|
|
26
|
+
export { createRevealUI, createRevealUIAccessRule, createRevealUIBlock, createRevealUICollection, createRevealUIField, } from './factories/index.js';
|
|
27
|
+
export { getFeatures, getFeaturesForTier, getRequiredTier, isFeatureEnabled, } from './features.js';
|
|
28
|
+
// License and feature flags
|
|
29
|
+
export { generateLicenseKey, getCurrentTier, getLicensePayload, getMaxSites, getMaxUsers, initializeLicense, isLicensed, resetLicenseState, validateLicenseKey, } from './license.js';
|
|
30
|
+
// Next.js integration
|
|
31
|
+
export { getRevealUI as getRevealUINext, withRevealUI, } from './nextjs/index.js';
|
|
32
|
+
// Plugins
|
|
33
|
+
export { formBuilderPlugin } from './plugins/form-builder.js';
|
|
34
|
+
export { nestedDocsPlugin } from './plugins/nested-docs.js';
|
|
35
|
+
export { redirectsPlugin } from './plugins/redirects.js';
|
|
36
|
+
// Core RevealUI CMS implementation
|
|
37
|
+
export {
|
|
38
|
+
// Field traversal utilities
|
|
39
|
+
afterChangeTraverseFields, afterReadTraverseFields, beforeChangeTraverseFields, beforeValidateTraverseFields,
|
|
40
|
+
// Query utilities
|
|
41
|
+
buildWhereClause,
|
|
42
|
+
// Utilities
|
|
43
|
+
checkDependencies,
|
|
44
|
+
// Main factory function
|
|
45
|
+
createRevealUIInstance, defaultLogger, extractWhereValues, flattenResult,
|
|
46
|
+
// Relationship utilities
|
|
47
|
+
getRelationshipFields,
|
|
48
|
+
// Logger
|
|
49
|
+
Logger,
|
|
50
|
+
// Collection and Global operations
|
|
51
|
+
RevealUICollection, RevealUIGlobal, relationshipPopulationPromise, validateRelationshipMetadata, withNullableJSONSchemaType, } from './revealui.js';
|
|
52
|
+
// Rich text editor
|
|
53
|
+
export { BoldFeature, FixedToolbarFeature, HeadingFeature, ItalicFeature, LinkFeature, lexicalEditor, TreeViewFeature, UnderlineFeature, } from './richtext/index.js';
|
|
54
|
+
// Storage adapters
|
|
55
|
+
export { vercelBlobStorage } from './storage/vercel-blob.js';
|
|
56
|
+
// Note: Logger class is exported from ./revealui.ts (instance/logger.js), not from utils/logger.js
|
|
57
|
+
export { LRUCache } from './utils/cache.js';
|
|
58
|
+
// Deep clone utility
|
|
59
|
+
export { deepClone } from './utils/deep-clone.js';
|
|
60
|
+
// Error response utilities (framework-agnostic)
|
|
61
|
+
export { createApplicationErrorResponseData, createErrorResponseData, createSuccessResponseData, createValidationErrorResponseData, } from './utils/error-responses.js';
|
|
62
|
+
export { ApplicationError, handleApiError, handleDatabaseError, ValidationError, } from './utils/errors.js';
|
|
63
|
+
// Utilities
|
|
64
|
+
export { createLogger, logger, } from './utils/logger.js';
|
|
65
|
+
// Type guards
|
|
66
|
+
export { flattenFields, isJsonFieldType, isObject } from './utils/type-guards.js';
|
|
67
|
+
// =============================================================================
|
|
68
|
+
// BASE TYPES FROM SCHEMA (Single Source of Truth)
|
|
69
|
+
// =============================================================================
|
|
70
|
+
// These are the authoritative types from @revealui/contracts/cms.
|
|
71
|
+
// They are re-exported here for convenience.
|
|
72
|
+
export { applyPluginExtensions, assertValidSlug,
|
|
73
|
+
// Validation utilities
|
|
74
|
+
ConfigValidationError,
|
|
75
|
+
// Config helpers
|
|
76
|
+
defineCollection, defineField, defineGlobal,
|
|
77
|
+
// Validation types
|
|
78
|
+
// type FieldValidateFunction,
|
|
79
|
+
fromCMSCollectionConfig, fromCMSGlobalConfig, getCustomFieldType, getRevealUIExtensions,
|
|
80
|
+
// RevealUI extensions
|
|
81
|
+
hasRevealUIExtensions, isValidFieldType, isValidSlug, mergeCollectionConfigs, mergeFields,
|
|
82
|
+
// Extensibility
|
|
83
|
+
registerCustomFieldType, registerPluginExtension, safeValidate,
|
|
84
|
+
// CMS compatibility
|
|
85
|
+
toCMSCollectionConfig, toCMSGlobalConfig, toSlug, validateWithErrors, } from '@revealui/contracts/cms';
|
|
86
|
+
// =============================================================================
|
|
87
|
+
// ADDITIONAL TYPE EXPORTS
|
|
88
|
+
// =============================================================================
|
|
89
|
+
export { serializeLexicalState } from './richtext/index.js';
|
|
90
|
+
// =============================================================================
|
|
91
|
+
// TYPE DOCUMENTATION
|
|
92
|
+
// =============================================================================
|
|
93
|
+
/**
|
|
94
|
+
* ## Import Guide
|
|
95
|
+
*
|
|
96
|
+
* ### Base Types (from schema - single source of truth)
|
|
97
|
+
* For standard RevealUI CMS types that work everywhere:
|
|
98
|
+
* ```typescript
|
|
99
|
+
* import { CollectionConfig, GlobalConfig, Field } from '@revealui/core'
|
|
100
|
+
* // OR directly from schema:
|
|
101
|
+
* import { CollectionConfig, GlobalConfig, Field } from '@revealui/contracts/cms'
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* ### Extended Types (RevealUI-specific)
|
|
105
|
+
* For RevealUI framework features (tenants, permissions, etc.):
|
|
106
|
+
* ```typescript
|
|
107
|
+
* import { RevealCollectionConfig, RevealGlobalConfig } from '@revealui/core'
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* ### Helper Functions
|
|
111
|
+
* For typed config creation:
|
|
112
|
+
* ```typescript
|
|
113
|
+
* import { defineCollection, defineGlobal, defineField } from '@revealui/core'
|
|
114
|
+
*
|
|
115
|
+
* const Posts = defineCollection<Post>({
|
|
116
|
+
* slug: 'posts',
|
|
117
|
+
* fields: [...]
|
|
118
|
+
* })
|
|
119
|
+
* ```
|
|
120
|
+
*
|
|
121
|
+
* ### Validation
|
|
122
|
+
* For runtime config validation:
|
|
123
|
+
* ```typescript
|
|
124
|
+
* import { validateWithErrors, ConfigValidationError } from '@revealui/core'
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RevealConfig, RevealUIInstance } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new RevealUI instance with collections, globals, and database connections
|
|
4
|
+
*/
|
|
5
|
+
export declare function createRevealUIInstance(config: RevealConfig): Promise<RevealUIInstance>;
|
|
6
|
+
//# sourceMappingURL=RevealUIInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RevealUIInstance.d.ts","sourceRoot":"","sources":["../../src/instance/RevealUIInstance.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,YAAY,EAQZ,gBAAgB,EAGjB,MAAM,mBAAmB,CAAA;AAS1B;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAgZ5F"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import bcrypt from 'bcryptjs';
|
|
3
|
+
import { SignJWT } from 'jose';
|
|
4
|
+
import { RevealUICollection } from '../collections/CollectionOperations.js';
|
|
5
|
+
import { getDataLoader } from '../dataloader.js';
|
|
6
|
+
import { afterRead } from '../fields/hooks/afterRead/index.js';
|
|
7
|
+
import { RevealUIGlobal } from '../globals/GlobalOperations.js';
|
|
8
|
+
import { isJsonFieldType } from '../utils/type-guards.js';
|
|
9
|
+
import { createLogger } from './logger.js';
|
|
10
|
+
import { create } from './methods/create.js';
|
|
11
|
+
import { deleteMethod } from './methods/delete.js';
|
|
12
|
+
import { find } from './methods/find.js';
|
|
13
|
+
import { findByID } from './methods/findById.js';
|
|
14
|
+
import { update } from './methods/update.js';
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new RevealUI instance with collections, globals, and database connections
|
|
17
|
+
*/
|
|
18
|
+
export async function createRevealUIInstance(config) {
|
|
19
|
+
const logger = createLogger();
|
|
20
|
+
// Database connection is lazy — only connect on first query.
|
|
21
|
+
// A single shared promise guards against concurrent init from multiple requests.
|
|
22
|
+
let dbConnected = false;
|
|
23
|
+
let dbInitPromise = null;
|
|
24
|
+
const ensureDbConnected = async () => {
|
|
25
|
+
if (dbConnected)
|
|
26
|
+
return;
|
|
27
|
+
if (!dbInitPromise && config.db) {
|
|
28
|
+
const db = config.db; // capture to satisfy narrowing inside async IIFE
|
|
29
|
+
dbInitPromise = (async () => {
|
|
30
|
+
await db.init?.();
|
|
31
|
+
// Queue table creation BEFORE connect()
|
|
32
|
+
// createTable() pushes promises to a queue that connect() will await
|
|
33
|
+
if (config.collections && db.createTable) {
|
|
34
|
+
for (const collection of config.collections) {
|
|
35
|
+
const fields = collection.fields || [];
|
|
36
|
+
const tableFields = fields
|
|
37
|
+
.filter((field) => field.name && !isJsonFieldType(field))
|
|
38
|
+
.map((field) => ({
|
|
39
|
+
name: field.name || '',
|
|
40
|
+
type: field.type || 'text',
|
|
41
|
+
required: field.required,
|
|
42
|
+
unique: field.unique,
|
|
43
|
+
}));
|
|
44
|
+
db.createTable(collection.slug, tableFields);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Queue global table creation BEFORE connect()
|
|
48
|
+
if (config.globals && db.createGlobalTable) {
|
|
49
|
+
for (const global of config.globals) {
|
|
50
|
+
const fields = global.fields || [];
|
|
51
|
+
const jsonTypes = ['array', 'group', 'blocks', 'richText'];
|
|
52
|
+
const tableFields = fields
|
|
53
|
+
.filter((field) => field.name && !jsonTypes.includes(field.type || ''))
|
|
54
|
+
.map((field) => ({
|
|
55
|
+
name: field.name || '',
|
|
56
|
+
type: field.type || 'text',
|
|
57
|
+
required: field.required,
|
|
58
|
+
unique: field.unique,
|
|
59
|
+
}));
|
|
60
|
+
db.createGlobalTable(global.slug, tableFields);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Now connect() will wait for all queued table creation promises
|
|
64
|
+
await db.connect?.();
|
|
65
|
+
dbConnected = true;
|
|
66
|
+
})();
|
|
67
|
+
}
|
|
68
|
+
if (dbInitPromise) {
|
|
69
|
+
await dbInitPromise;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// Initialize collections and globals
|
|
73
|
+
const collections = {};
|
|
74
|
+
const globals = {};
|
|
75
|
+
// Initialize collections
|
|
76
|
+
if (config.collections) {
|
|
77
|
+
for (const collectionConfig of config.collections) {
|
|
78
|
+
collections[collectionConfig.slug] = new RevealUICollection(collectionConfig, config.db || null);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Initialize globals
|
|
82
|
+
if (config.globals) {
|
|
83
|
+
for (const globalConfig of config.globals) {
|
|
84
|
+
globals[globalConfig.slug] = new RevealUIGlobal(globalConfig, config.db || null);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Create a base request for DataLoader initialization
|
|
88
|
+
const baseReq = {
|
|
89
|
+
transactionID: null,
|
|
90
|
+
context: {},
|
|
91
|
+
};
|
|
92
|
+
const revealUIInstance = {
|
|
93
|
+
collections,
|
|
94
|
+
globals,
|
|
95
|
+
config,
|
|
96
|
+
db: config.db || null,
|
|
97
|
+
logger,
|
|
98
|
+
secret: config.secret || undefined,
|
|
99
|
+
async find(options) {
|
|
100
|
+
return find(revealUIInstance, ensureDbConnected, options);
|
|
101
|
+
},
|
|
102
|
+
async findByID(options) {
|
|
103
|
+
return findByID(revealUIInstance, ensureDbConnected, options);
|
|
104
|
+
},
|
|
105
|
+
async create(options) {
|
|
106
|
+
return create(revealUIInstance, ensureDbConnected, options);
|
|
107
|
+
},
|
|
108
|
+
async update(options) {
|
|
109
|
+
return update(revealUIInstance, ensureDbConnected, options);
|
|
110
|
+
},
|
|
111
|
+
async delete(options) {
|
|
112
|
+
return deleteMethod(revealUIInstance, ensureDbConnected, options);
|
|
113
|
+
},
|
|
114
|
+
async login(options) {
|
|
115
|
+
const { collection, data } = options;
|
|
116
|
+
if (!collections[collection]) {
|
|
117
|
+
throw new Error(`Collection '${collection}' not found`);
|
|
118
|
+
}
|
|
119
|
+
// Find user by email
|
|
120
|
+
const users = await collections[collection].find({
|
|
121
|
+
where: { email: { equals: data.email } },
|
|
122
|
+
limit: 1,
|
|
123
|
+
});
|
|
124
|
+
const user = users.docs[0];
|
|
125
|
+
if (!user) {
|
|
126
|
+
throw new Error('Invalid credentials');
|
|
127
|
+
}
|
|
128
|
+
// Verify password
|
|
129
|
+
const hashedPassword = user.password;
|
|
130
|
+
if (!hashedPassword || typeof hashedPassword !== 'string') {
|
|
131
|
+
throw new Error('Invalid credentials');
|
|
132
|
+
}
|
|
133
|
+
// Verify password against bcrypt hash
|
|
134
|
+
if (!hashedPassword.startsWith('$2')) {
|
|
135
|
+
// Reject plain-text passwords — they must be migrated first
|
|
136
|
+
throw new Error('Invalid credentials');
|
|
137
|
+
}
|
|
138
|
+
const isPasswordValid = await bcrypt.compare(data.password, hashedPassword);
|
|
139
|
+
if (!isPasswordValid) {
|
|
140
|
+
throw new Error('Invalid credentials');
|
|
141
|
+
}
|
|
142
|
+
// Generate JWT token with unique jti (JWT ID) for session fixation prevention
|
|
143
|
+
const secret = process.env.REVEALUI_SECRET;
|
|
144
|
+
if (!secret || secret.length < 32) {
|
|
145
|
+
throw new Error('REVEALUI_SECRET must be set to a secure random value (minimum 32 characters). ' +
|
|
146
|
+
'Generate one with: openssl rand -base64 32');
|
|
147
|
+
}
|
|
148
|
+
const secretKey = new TextEncoder().encode(secret);
|
|
149
|
+
const token = await new SignJWT({
|
|
150
|
+
id: user.id,
|
|
151
|
+
email: user.email,
|
|
152
|
+
collection,
|
|
153
|
+
})
|
|
154
|
+
.setProtectedHeader({ alg: 'HS256' })
|
|
155
|
+
.setIssuedAt()
|
|
156
|
+
.setExpirationTime('7d')
|
|
157
|
+
.setJti(`${user.id}-${Date.now()}-${randomBytes(8).toString('hex')}`)
|
|
158
|
+
.sign(secretKey);
|
|
159
|
+
// Remove password from user object before returning
|
|
160
|
+
const userWithoutPassword = { ...user, password: undefined };
|
|
161
|
+
return { user: userWithoutPassword, token };
|
|
162
|
+
},
|
|
163
|
+
async findGlobal(options) {
|
|
164
|
+
await ensureDbConnected();
|
|
165
|
+
const { slug, depth = 0, draft = false, locale, fallbackLocale, overrideAccess = false, showHiddenFields = false, populate, req, } = options;
|
|
166
|
+
// Find global config
|
|
167
|
+
const globalConfig = config.globals?.find((g) => g.slug === slug);
|
|
168
|
+
if (!globalConfig) {
|
|
169
|
+
throw new Error(`Global '${slug}' not found`);
|
|
170
|
+
}
|
|
171
|
+
// Get or use existing global instance
|
|
172
|
+
if (!globals[slug]) {
|
|
173
|
+
throw new Error(`Global '${slug}' instance not initialized`);
|
|
174
|
+
}
|
|
175
|
+
// Use the global's find method to get the document
|
|
176
|
+
const doc = await globals[slug].find({ depth: 0 }); // Get base document first
|
|
177
|
+
if (!doc) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
// Apply afterRead hook for relationship population if depth > 0 and req provided
|
|
181
|
+
if (req && depth > 0) {
|
|
182
|
+
// RevealGlobalConfig extends GlobalConfig, which matches SanitizedGlobalConfig structure
|
|
183
|
+
const sanitizedConfig = {
|
|
184
|
+
...globalConfig,
|
|
185
|
+
fields: globalConfig.fields,
|
|
186
|
+
flattenedFields: globalConfig.fields,
|
|
187
|
+
endpoints: globalConfig.endpoints === false ? undefined : globalConfig.endpoints,
|
|
188
|
+
};
|
|
189
|
+
return await afterRead({
|
|
190
|
+
collection: null,
|
|
191
|
+
global: sanitizedConfig,
|
|
192
|
+
context: req.context || {},
|
|
193
|
+
currentDepth: 1,
|
|
194
|
+
depth,
|
|
195
|
+
doc,
|
|
196
|
+
draft,
|
|
197
|
+
fallbackLocale: fallbackLocale || req.fallbackLocale || 'en',
|
|
198
|
+
findMany: false,
|
|
199
|
+
flattenLocales: true,
|
|
200
|
+
locale: locale || req.locale || 'en',
|
|
201
|
+
overrideAccess,
|
|
202
|
+
populate,
|
|
203
|
+
req,
|
|
204
|
+
select: undefined,
|
|
205
|
+
showHiddenFields,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return doc;
|
|
209
|
+
},
|
|
210
|
+
async updateGlobal(options) {
|
|
211
|
+
await ensureDbConnected();
|
|
212
|
+
const { slug } = options;
|
|
213
|
+
if (!globals[slug]) {
|
|
214
|
+
throw new Error(`Global '${slug}' not found`);
|
|
215
|
+
}
|
|
216
|
+
return globals[slug].update(options);
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* Manually populate relationships on documents
|
|
220
|
+
*
|
|
221
|
+
* Useful for:
|
|
222
|
+
* - Manual population after queries
|
|
223
|
+
* - AI context generation with relationships
|
|
224
|
+
* - Selective field population
|
|
225
|
+
* - Batch population for performance
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* // Populate single document
|
|
230
|
+
* const post = await revealui.findByID({ collection: 'posts', id: '123' })
|
|
231
|
+
* const populated = await revealui.populate('posts', post, { depth: 2 })
|
|
232
|
+
*
|
|
233
|
+
* // Populate multiple documents
|
|
234
|
+
* const posts = await revealui.find({ collection: 'posts' })
|
|
235
|
+
* const populated = await revealui.populate('posts', posts.docs, { depth: 1 })
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
async populate(collection, docs, options) {
|
|
239
|
+
await ensureDbConnected();
|
|
240
|
+
const { depth = 1, draft = false, locale = 'en', fallbackLocale = 'en', overrideAccess = false, showHiddenFields = false, req, } = options || {};
|
|
241
|
+
// Get collection config
|
|
242
|
+
const collectionConfig = config.collections?.find((c) => c.slug === collection);
|
|
243
|
+
if (!collectionConfig) {
|
|
244
|
+
throw new Error(`Collection '${collection}' not found`);
|
|
245
|
+
}
|
|
246
|
+
// Create a request context if not provided
|
|
247
|
+
const populateReq = req || {
|
|
248
|
+
...baseReq,
|
|
249
|
+
locale,
|
|
250
|
+
fallbackLocale,
|
|
251
|
+
revealui: revealUIInstance,
|
|
252
|
+
dataLoader: getDataLoader(baseReq),
|
|
253
|
+
};
|
|
254
|
+
// Handle single document
|
|
255
|
+
if (!Array.isArray(docs)) {
|
|
256
|
+
return await afterRead({
|
|
257
|
+
collection: collectionConfig,
|
|
258
|
+
context: populateReq.context || {},
|
|
259
|
+
currentDepth: 0,
|
|
260
|
+
depth,
|
|
261
|
+
doc: docs,
|
|
262
|
+
draft,
|
|
263
|
+
fallbackLocale,
|
|
264
|
+
findMany: false,
|
|
265
|
+
flattenLocales: true,
|
|
266
|
+
global: null,
|
|
267
|
+
locale,
|
|
268
|
+
overrideAccess,
|
|
269
|
+
populate: undefined,
|
|
270
|
+
req: populateReq,
|
|
271
|
+
select: undefined,
|
|
272
|
+
showHiddenFields,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
// Handle array of documents
|
|
276
|
+
return await Promise.all(docs.map(async (doc) => afterRead({
|
|
277
|
+
collection: collectionConfig,
|
|
278
|
+
context: populateReq.context || {},
|
|
279
|
+
currentDepth: 0,
|
|
280
|
+
depth,
|
|
281
|
+
doc,
|
|
282
|
+
draft,
|
|
283
|
+
fallbackLocale,
|
|
284
|
+
findMany: false,
|
|
285
|
+
flattenLocales: true,
|
|
286
|
+
global: null,
|
|
287
|
+
locale,
|
|
288
|
+
overrideAccess,
|
|
289
|
+
populate: undefined,
|
|
290
|
+
req: populateReq,
|
|
291
|
+
select: undefined,
|
|
292
|
+
showHiddenFields,
|
|
293
|
+
})));
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
// Run onInit hook if provided (skip during build to avoid database connections)
|
|
297
|
+
const isBuildTime = process.env.NEXT_PHASE === 'phase-production-build' ||
|
|
298
|
+
(process.env.NODE_ENV === 'production' && !process.env.RUNTIME_INIT);
|
|
299
|
+
if (config.onInit && !isBuildTime) {
|
|
300
|
+
await config.onInit(revealUIInstance);
|
|
301
|
+
}
|
|
302
|
+
// Initialize DataLoader for the base request
|
|
303
|
+
baseReq.revealui = revealUIInstance;
|
|
304
|
+
baseReq.dataLoader = getDataLoader(baseReq);
|
|
305
|
+
return revealUIInstance;
|
|
306
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/instance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACN,KAAK,cAAc,GACpB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RevealUI Logger
|
|
3
|
+
*
|
|
4
|
+
* Production-safe logging utility for RevealUI framework operations.
|
|
5
|
+
* Info/warn messages are no-ops in production to avoid console pollution.
|
|
6
|
+
*/
|
|
7
|
+
export interface RevealUILogger {
|
|
8
|
+
info: (...args: unknown[]) => void;
|
|
9
|
+
warn: (...args: unknown[]) => void;
|
|
10
|
+
error: (...args: unknown[]) => void;
|
|
11
|
+
debug: (...args: unknown[]) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Production-safe logger implementation
|
|
15
|
+
* Info/warn messages are completely silenced in production
|
|
16
|
+
*/
|
|
17
|
+
export declare class Logger implements RevealUILogger {
|
|
18
|
+
info(...args: unknown[]): void;
|
|
19
|
+
warn(...args: unknown[]): void;
|
|
20
|
+
error(...args: unknown[]): void;
|
|
21
|
+
debug(...args: unknown[]): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new logger instance
|
|
25
|
+
*/
|
|
26
|
+
export declare function createLogger(): RevealUILogger;
|
|
27
|
+
/**
|
|
28
|
+
* Default logger instance
|
|
29
|
+
*/
|
|
30
|
+
export declare const defaultLogger: RevealUILogger;
|
|
31
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/instance/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IAClC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IAClC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;CACpC;AAED;;;GAGG;AACH,qBAAa,MAAO,YAAW,cAAc;IAC3C,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAO9B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAO9B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAKhC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,cAAc,CAE7C;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,cAA6B,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RevealUI Logger
|
|
3
|
+
*
|
|
4
|
+
* Production-safe logging utility for RevealUI framework operations.
|
|
5
|
+
* Info/warn messages are no-ops in production to avoid console pollution.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Production-safe logger implementation
|
|
9
|
+
* Info/warn messages are completely silenced in production
|
|
10
|
+
*/
|
|
11
|
+
export class Logger {
|
|
12
|
+
info(...args) {
|
|
13
|
+
// Info messages are never logged in production
|
|
14
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
15
|
+
console.log('[RevealUI]', ...args);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
warn(...args) {
|
|
19
|
+
// Warning messages are never logged in production
|
|
20
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
21
|
+
console.warn('[RevealUI]', ...args);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
error(...args) {
|
|
25
|
+
console.error('[RevealUI]', ...args);
|
|
26
|
+
}
|
|
27
|
+
debug(...args) {
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
+
console.debug('[RevealUI]', ...args);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new logger instance
|
|
35
|
+
*/
|
|
36
|
+
export function createLogger() {
|
|
37
|
+
return new Logger();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Default logger instance
|
|
41
|
+
*/
|
|
42
|
+
export const defaultLogger = new Logger();
|