@revealui/core 0.0.1-pre.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -202
- package/README.md +108 -152
- package/dist/api/compression.d.ts +83 -0
- package/dist/api/compression.d.ts.map +1 -0
- package/dist/api/compression.js +233 -0
- package/dist/api/payload-optimization.d.ts +138 -0
- package/dist/api/payload-optimization.d.ts.map +1 -0
- package/dist/api/payload-optimization.js +320 -0
- package/dist/api/rate-limit.d.ts +113 -0
- package/dist/api/rate-limit.d.ts.map +1 -0
- package/dist/api/rate-limit.js +316 -0
- package/dist/api/response-cache.d.ts +125 -0
- package/dist/api/response-cache.d.ts.map +1 -0
- package/dist/api/response-cache.js +335 -0
- package/dist/api/rest.d.ts +54 -0
- package/dist/api/rest.d.ts.map +1 -0
- package/dist/api/rest.js +464 -0
- package/dist/auth/access.d.ts +25 -0
- package/dist/auth/access.d.ts.map +1 -0
- package/dist/auth/access.js +20 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/cache/query-cache.d.ts +98 -0
- package/dist/cache/query-cache.d.ts.map +1 -0
- package/dist/cache/query-cache.js +260 -0
- package/dist/caching/app-cache.d.ts +237 -0
- package/dist/caching/app-cache.d.ts.map +1 -0
- package/dist/caching/app-cache.js +430 -0
- package/dist/caching/cdn-config.d.ts +155 -0
- package/dist/caching/cdn-config.d.ts.map +1 -0
- package/dist/caching/cdn-config.js +411 -0
- package/dist/caching/edge-cache.d.ts +177 -0
- package/dist/caching/edge-cache.d.ts.map +1 -0
- package/dist/caching/edge-cache.js +385 -0
- package/dist/caching/service-worker.d.ts +154 -0
- package/dist/caching/service-worker.d.ts.map +1 -0
- package/dist/caching/service-worker.js +437 -0
- package/dist/client/admin/RichText.d.ts +12 -0
- package/dist/client/admin/RichText.d.ts.map +1 -0
- package/dist/client/admin/RichText.js +5 -0
- package/dist/client/admin/components/AdminDashboard.d.ts +7 -0
- package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -0
- package/dist/client/admin/components/AdminDashboard.js +318 -0
- package/dist/client/admin/components/CollectionList.d.ts +16 -0
- package/dist/client/admin/components/CollectionList.d.ts.map +1 -0
- package/dist/client/admin/components/CollectionList.js +67 -0
- package/dist/client/admin/components/DocumentForm.d.ts +11 -0
- package/dist/client/admin/components/DocumentForm.d.ts.map +1 -0
- package/dist/client/admin/components/DocumentForm.js +99 -0
- package/dist/client/admin/components/GlobalForm.d.ts +11 -0
- package/dist/client/admin/components/GlobalForm.d.ts.map +1 -0
- package/dist/client/admin/components/GlobalForm.js +74 -0
- package/dist/client/admin/i18n/en.d.ts +25 -0
- package/dist/client/admin/i18n/en.d.ts.map +1 -0
- package/dist/client/admin/i18n/en.js +25 -0
- package/dist/client/admin/index.d.ts +10 -0
- package/dist/client/admin/index.d.ts.map +1 -0
- package/dist/client/admin/index.js +10 -0
- package/dist/client/admin/layout.d.ts +10 -0
- package/dist/client/admin/layout.d.ts.map +1 -0
- package/dist/client/admin/layout.js +6 -0
- package/dist/client/admin/page.d.ts +38 -0
- package/dist/client/admin/page.d.ts.map +1 -0
- package/dist/client/admin/page.js +15 -0
- package/dist/client/admin/utils/apiClient.d.ts +110 -0
- package/dist/client/admin/utils/apiClient.d.ts.map +1 -0
- package/dist/client/admin/utils/apiClient.js +220 -0
- package/dist/client/admin/utils/auth.d.ts +23 -0
- package/dist/client/admin/utils/auth.d.ts.map +1 -0
- package/dist/client/admin/utils/auth.js +52 -0
- package/dist/client/admin/utils/index.d.ts +6 -0
- package/dist/client/admin/utils/index.d.ts.map +1 -0
- package/dist/client/admin/utils/index.js +5 -0
- package/dist/client/admin/utils/serializeConfig.d.ts +7 -0
- package/dist/client/admin/utils/serializeConfig.d.ts.map +1 -0
- package/dist/client/admin/utils/serializeConfig.js +35 -0
- package/dist/client/hooks.d.ts +18 -0
- package/dist/client/hooks.d.ts.map +1 -0
- package/dist/client/hooks.js +29 -0
- package/dist/client/http/client.d.ts +15 -0
- package/dist/client/http/client.d.ts.map +1 -0
- package/dist/client/http/client.js +49 -0
- package/dist/client/http/fetchBanner.d.ts +18 -0
- package/dist/client/http/fetchBanner.d.ts.map +1 -0
- package/dist/client/http/fetchBanner.js +44 -0
- package/dist/client/http/fetchCard.d.ts +18 -0
- package/dist/client/http/fetchCard.d.ts.map +1 -0
- package/dist/client/http/fetchCard.js +46 -0
- package/dist/client/http/fetchEvents.d.ts +18 -0
- package/dist/client/http/fetchEvents.d.ts.map +1 -0
- package/dist/client/http/fetchEvents.js +44 -0
- package/dist/client/http/fetchHero.d.ts +17 -0
- package/dist/client/http/fetchHero.d.ts.map +1 -0
- package/dist/client/http/fetchHero.js +55 -0
- package/dist/client/http/fetchMainInfos.d.ts +17 -0
- package/dist/client/http/fetchMainInfos.d.ts.map +1 -0
- package/dist/client/http/fetchMainInfos.js +44 -0
- package/dist/client/http/fetchVideos.d.ts +13 -0
- package/dist/client/http/fetchVideos.d.ts.map +1 -0
- package/dist/client/http/fetchVideos.js +36 -0
- package/dist/client/http/index.d.ts +19 -0
- package/dist/client/http/index.d.ts.map +1 -0
- package/dist/client/http/index.js +11 -0
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +13 -0
- package/dist/client/richtext/RichTextEditor.d.ts +48 -0
- package/dist/client/richtext/RichTextEditor.d.ts.map +1 -0
- package/dist/client/richtext/RichTextEditor.js +360 -0
- package/dist/client/richtext/components/ImageNodeComponent.d.ts +9 -0
- package/dist/client/richtext/components/ImageNodeComponent.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageNodeComponent.js +99 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts +11 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts.map +1 -0
- package/dist/client/richtext/components/ImageUploadButton.js +103 -0
- package/dist/client/richtext/index.d.ts +92 -0
- package/dist/client/richtext/index.d.ts.map +1 -0
- package/dist/client/richtext/index.js +74 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts +20 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts.map +1 -0
- package/dist/client/richtext/nodes/DecoratorBlockNode.js +29 -0
- package/dist/client/richtext/nodes/ImageNode.d.ts +51 -0
- package/dist/client/richtext/nodes/ImageNode.d.ts.map +1 -0
- package/dist/client/richtext/nodes/ImageNode.js +95 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts +13 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/CollaborationPlugin.js +8 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts +4 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.js +50 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts +7 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.js +248 -0
- package/dist/client/richtext/plugins/ImagePlugin.d.ts +3 -0
- package/dist/client/richtext/plugins/ImagePlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/ImagePlugin.js +73 -0
- package/dist/client/richtext/plugins/PastePlugin.d.ts +2 -0
- package/dist/client/richtext/plugins/PastePlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/PastePlugin.js +36 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts +8 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts.map +1 -0
- package/dist/client/richtext/plugins/ToolbarPlugin.js +204 -0
- package/dist/client/ui/index.d.ts +111 -0
- package/dist/client/ui/index.d.ts.map +1 -0
- package/dist/client/ui/index.js +130 -0
- package/dist/collections/CollectionOperations.d.ts +27 -0
- package/dist/collections/CollectionOperations.d.ts.map +1 -0
- package/dist/collections/CollectionOperations.js +34 -0
- package/dist/collections/hooks.d.ts +11 -0
- package/dist/collections/hooks.d.ts.map +1 -0
- package/dist/collections/hooks.js +35 -0
- package/dist/collections/index.d.ts +2 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/index.js +1 -0
- package/dist/collections/operations/create.d.ts +10 -0
- package/dist/collections/operations/create.d.ts.map +1 -0
- package/dist/collections/operations/create.js +101 -0
- package/dist/collections/operations/delete.d.ts +10 -0
- package/dist/collections/operations/delete.d.ts.map +1 -0
- package/dist/collections/operations/delete.js +16 -0
- package/dist/collections/operations/fieldHooks.d.ts +21 -0
- package/dist/collections/operations/fieldHooks.d.ts.map +1 -0
- package/dist/collections/operations/fieldHooks.js +51 -0
- package/dist/collections/operations/find.d.ts +10 -0
- package/dist/collections/operations/find.d.ts.map +1 -0
- package/dist/collections/operations/find.js +124 -0
- package/dist/collections/operations/findById.d.ts +15 -0
- package/dist/collections/operations/findById.d.ts.map +1 -0
- package/dist/collections/operations/findById.js +59 -0
- package/dist/collections/operations/update.d.ts +10 -0
- package/dist/collections/operations/update.d.ts.map +1 -0
- package/dist/collections/operations/update.js +134 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +61 -0
- package/dist/config/runtime.d.ts +22 -0
- package/dist/config/runtime.d.ts.map +1 -0
- package/dist/config/runtime.js +32 -0
- package/dist/config/utils.d.ts +12 -0
- package/dist/config/utils.d.ts.map +1 -0
- package/dist/config/utils.js +34 -0
- package/dist/database/index.d.ts +1 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +6 -0
- package/dist/database/safe-parse.d.ts +26 -0
- package/dist/database/safe-parse.d.ts.map +1 -0
- package/dist/database/safe-parse.js +42 -0
- package/dist/database/ssl-config.d.ts +9 -0
- package/dist/database/ssl-config.d.ts.map +1 -0
- package/dist/database/ssl-config.js +7 -0
- package/dist/database/type-adapter.d.ts +113 -0
- package/dist/database/type-adapter.d.ts.map +1 -0
- package/dist/database/type-adapter.js +97 -0
- package/dist/database/universal-postgres.d.ts +45 -0
- package/dist/database/universal-postgres.d.ts.map +1 -0
- package/dist/database/universal-postgres.js +526 -0
- package/dist/dataloader.d.ts +26 -0
- package/dist/dataloader.d.ts.map +1 -0
- package/dist/dataloader.js +176 -0
- package/dist/error-handling/circuit-breaker.d.ts +262 -0
- package/dist/error-handling/circuit-breaker.d.ts.map +1 -0
- package/dist/error-handling/circuit-breaker.js +542 -0
- package/dist/error-handling/error-boundary.d.ts +94 -0
- package/dist/error-handling/error-boundary.d.ts.map +1 -0
- package/dist/error-handling/error-boundary.js +285 -0
- package/dist/error-handling/error-reporter.d.ts +214 -0
- package/dist/error-handling/error-reporter.d.ts.map +1 -0
- package/dist/error-handling/error-reporter.js +477 -0
- package/dist/error-handling/fallback-components.d.ts +131 -0
- package/dist/error-handling/fallback-components.d.ts.map +1 -0
- package/dist/error-handling/fallback-components.js +371 -0
- package/dist/error-handling/index.d.ts +16 -0
- package/dist/error-handling/index.d.ts.map +1 -0
- package/dist/error-handling/index.js +15 -0
- package/dist/error-handling/retry.d.ts +194 -0
- package/dist/error-handling/retry.d.ts.map +1 -0
- package/dist/error-handling/retry.js +450 -0
- package/dist/errors/index.d.ts +23 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +40 -0
- package/dist/factories/builders.d.ts +50 -0
- package/dist/factories/builders.d.ts.map +1 -0
- package/dist/factories/builders.js +77 -0
- package/dist/factories/index.d.ts +2 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +1 -0
- package/dist/features.d.ts +86 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +92 -0
- package/dist/fieldTraversal.d.ts +26 -0
- package/dist/fieldTraversal.d.ts.map +1 -0
- package/dist/fieldTraversal.js +132 -0
- package/dist/fields/config/types.d.ts +48 -0
- package/dist/fields/config/types.d.ts.map +1 -0
- package/dist/fields/config/types.js +20 -0
- package/dist/fields/getDefaultValue.d.ts +16 -0
- package/dist/fields/getDefaultValue.d.ts.map +1 -0
- package/dist/fields/getDefaultValue.js +20 -0
- package/dist/fields/getFieldPaths.d.ts +25 -0
- package/dist/fields/getFieldPaths.d.ts.map +1 -0
- package/dist/fields/getFieldPaths.js +23 -0
- package/dist/fields/hooks/afterRead/index.d.ts +36 -0
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/index.js +70 -0
- package/dist/fields/hooks/afterRead/promise.d.ts +46 -0
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/promise.js +178 -0
- package/dist/fields/hooks/afterRead/traverseFields.d.ts +44 -0
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -0
- package/dist/fields/hooks/afterRead/traverseFields.js +37 -0
- package/dist/generated/agents/index.d.ts +8 -0
- package/dist/generated/agents/index.d.ts.map +1 -0
- package/dist/generated/agents/index.js +7 -0
- package/dist/generated/components/index.d.ts +8 -0
- package/dist/generated/components/index.d.ts.map +1 -0
- package/dist/generated/components/index.js +7 -0
- package/dist/generated/functions/index.d.ts +8 -0
- package/dist/generated/functions/index.d.ts.map +1 -0
- package/dist/generated/functions/index.js +7 -0
- package/dist/generated/hooks/index.d.ts +8 -0
- package/dist/generated/hooks/index.d.ts.map +1 -0
- package/dist/generated/hooks/index.js +7 -0
- package/dist/generated/index.d.ts +10 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +9 -0
- package/dist/generated/plans/index.d.ts +8 -0
- package/dist/generated/plans/index.d.ts.map +1 -0
- package/dist/generated/plans/index.js +7 -0
- package/dist/generated/prompts/index.d.ts +8 -0
- package/dist/generated/prompts/index.d.ts.map +1 -0
- package/dist/generated/prompts/index.js +7 -0
- package/dist/generated/tools/index.d.ts +8 -0
- package/dist/generated/tools/index.d.ts.map +1 -0
- package/dist/generated/tools/index.js +7 -0
- package/dist/generated/types/cms.d.ts +1766 -0
- package/dist/generated/types/cms.d.ts.map +1 -0
- package/dist/generated/types/cms.js +12 -0
- package/dist/generated/types/index.d.ts +16 -0
- package/dist/generated/types/index.d.ts.map +1 -0
- package/dist/generated/types/index.js +21 -0
- package/dist/generated/types/neon.d.ts +11 -0
- package/dist/generated/types/neon.d.ts.map +1 -0
- package/dist/generated/types/neon.js +11 -0
- package/dist/generated/types/supabase.d.ts +193 -0
- package/dist/generated/types/supabase.d.ts.map +1 -0
- package/dist/generated/types/supabase.js +5 -0
- package/dist/globals/GlobalOperations.d.ts +24 -0
- package/dist/globals/GlobalOperations.d.ts.map +1 -0
- package/dist/globals/GlobalOperations.js +149 -0
- package/dist/globals/index.d.ts +2 -0
- package/dist/globals/index.d.ts.map +1 -0
- package/dist/globals/index.js +1 -0
- package/dist/index.d.ts +64 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -33
- package/dist/instance/RevealUIInstance.d.ts +6 -0
- package/dist/instance/RevealUIInstance.d.ts.map +1 -0
- package/dist/instance/RevealUIInstance.js +306 -0
- package/dist/instance/index.d.ts +3 -0
- package/dist/instance/index.d.ts.map +1 -0
- package/dist/instance/index.js +2 -0
- package/dist/instance/logger.d.ts +31 -0
- package/dist/instance/logger.d.ts.map +1 -0
- package/dist/instance/logger.js +42 -0
- package/dist/instance/methods/create.d.ts +10 -0
- package/dist/instance/methods/create.d.ts.map +1 -0
- package/dist/instance/methods/create.js +41 -0
- package/dist/instance/methods/delete.d.ts +10 -0
- package/dist/instance/methods/delete.d.ts.map +1 -0
- package/dist/instance/methods/delete.js +27 -0
- package/dist/instance/methods/find.d.ts +10 -0
- package/dist/instance/methods/find.d.ts.map +1 -0
- package/dist/instance/methods/find.js +23 -0
- package/dist/instance/methods/findById.d.ts +13 -0
- package/dist/instance/methods/findById.d.ts.map +1 -0
- package/dist/instance/methods/findById.js +23 -0
- package/dist/instance/methods/hooks.d.ts +14 -0
- package/dist/instance/methods/hooks.d.ts.map +1 -0
- package/dist/instance/methods/hooks.js +34 -0
- package/dist/instance/methods/update.d.ts +10 -0
- package/dist/instance/methods/update.d.ts.map +1 -0
- package/dist/instance/methods/update.js +45 -0
- package/dist/license.d.ts +82 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +193 -0
- package/dist/monitoring/alerts.d.ts +118 -0
- package/dist/monitoring/alerts.d.ts.map +1 -0
- package/dist/monitoring/alerts.js +324 -0
- package/dist/monitoring/cleanup-manager.d.ts +71 -0
- package/dist/monitoring/cleanup-manager.d.ts.map +1 -0
- package/dist/monitoring/cleanup-manager.js +226 -0
- package/dist/monitoring/health-monitor.d.ts +22 -0
- package/dist/monitoring/health-monitor.d.ts.map +1 -0
- package/dist/monitoring/health-monitor.js +142 -0
- package/dist/monitoring/index.d.ts +14 -0
- package/dist/monitoring/index.d.ts.map +1 -0
- package/dist/monitoring/index.js +17 -0
- package/dist/monitoring/process-registry.d.ts +97 -0
- package/dist/monitoring/process-registry.d.ts.map +1 -0
- package/dist/monitoring/process-registry.js +222 -0
- package/dist/monitoring/query-monitor.d.ts +153 -0
- package/dist/monitoring/query-monitor.d.ts.map +1 -0
- package/dist/monitoring/query-monitor.js +209 -0
- package/dist/monitoring/types.d.ts +231 -0
- package/dist/monitoring/types.d.ts.map +1 -0
- package/dist/monitoring/types.js +42 -0
- package/dist/monitoring/zombie-detector.d.ts +81 -0
- package/dist/monitoring/zombie-detector.d.ts.map +1 -0
- package/dist/monitoring/zombie-detector.js +231 -0
- package/dist/nextjs/index.d.ts +4 -0
- package/dist/nextjs/index.d.ts.map +1 -0
- package/dist/nextjs/index.js +3 -0
- package/dist/nextjs/utilities.d.ts +5 -0
- package/dist/nextjs/utilities.d.ts.map +1 -0
- package/dist/nextjs/utilities.js +16 -0
- package/dist/nextjs/withRevealUI.d.ts +20 -0
- package/dist/nextjs/withRevealUI.d.ts.map +1 -0
- package/dist/nextjs/withRevealUI.js +181 -0
- package/dist/observability/alerts.d.ts +138 -0
- package/dist/observability/alerts.d.ts.map +1 -0
- package/dist/observability/alerts.js +390 -0
- package/dist/observability/health-check.d.ts +95 -0
- package/dist/observability/health-check.d.ts.map +1 -0
- package/dist/observability/health-check.js +375 -0
- package/dist/observability/index.d.ts +12 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +11 -0
- package/dist/observability/logger.d.ts +47 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +140 -0
- package/dist/observability/metrics.d.ts +205 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +429 -0
- package/dist/observability/tracing.d.ts +149 -0
- package/dist/observability/tracing.d.ts.map +1 -0
- package/dist/observability/tracing.js +381 -0
- package/dist/optimization/asset-optimizer.d.ts +202 -0
- package/dist/optimization/asset-optimizer.d.ts.map +1 -0
- package/dist/optimization/asset-optimizer.js +312 -0
- package/dist/optimization/build-optimizer.d.ts +202 -0
- package/dist/optimization/build-optimizer.d.ts.map +1 -0
- package/dist/optimization/build-optimizer.js +271 -0
- package/dist/optimization/bundle-analyzer.d.ts +98 -0
- package/dist/optimization/bundle-analyzer.d.ts.map +1 -0
- package/dist/optimization/bundle-analyzer.js +322 -0
- package/dist/optimization/code-splitting.d.ts +131 -0
- package/dist/optimization/code-splitting.d.ts.map +1 -0
- package/dist/optimization/code-splitting.js +277 -0
- package/dist/plugin/index.d.ts +12 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +4 -0
- package/dist/plugins/form-builder.d.ts +115 -0
- package/dist/plugins/form-builder.d.ts.map +1 -0
- package/dist/plugins/form-builder.js +239 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/nested-docs.d.ts +8 -0
- package/dist/plugins/nested-docs.d.ts.map +1 -0
- package/dist/plugins/nested-docs.js +67 -0
- package/dist/plugins/redirects.d.ts +17 -0
- package/dist/plugins/redirects.d.ts.map +1 -0
- package/dist/plugins/redirects.js +62 -0
- package/dist/queries/index.d.ts +2 -0
- package/dist/queries/index.d.ts.map +1 -0
- package/dist/queries/index.js +1 -0
- package/dist/queries/queryBuilder.d.ts +47 -0
- package/dist/queries/queryBuilder.d.ts.map +1 -0
- package/dist/queries/queryBuilder.js +255 -0
- package/dist/relationships/analyzer.d.ts +39 -0
- package/dist/relationships/analyzer.d.ts.map +1 -0
- package/dist/relationships/analyzer.js +127 -0
- package/dist/relationships/index.d.ts +3 -0
- package/dist/relationships/index.d.ts.map +1 -0
- package/dist/relationships/index.js +2 -0
- package/dist/relationships/populate-helpers.d.ts +104 -0
- package/dist/relationships/populate-helpers.d.ts.map +1 -0
- package/dist/relationships/populate-helpers.js +187 -0
- package/dist/relationships/population.d.ts +42 -0
- package/dist/relationships/population.d.ts.map +1 -0
- package/dist/relationships/population.js +188 -0
- package/dist/revealui.d.ts +46 -0
- package/dist/revealui.d.ts.map +1 -0
- package/dist/revealui.js +92 -0
- package/dist/richtext/exports/client/rcc.d.ts +37 -0
- package/dist/richtext/exports/client/rcc.d.ts.map +1 -0
- package/dist/richtext/exports/client/rcc.js +182 -0
- package/dist/richtext/exports/server/rsc.d.ts +117 -0
- package/dist/richtext/exports/server/rsc.d.ts.map +1 -0
- package/dist/richtext/exports/server/rsc.js +288 -0
- package/dist/richtext/index.d.ts +161 -0
- package/dist/richtext/index.d.ts.map +1 -0
- package/dist/richtext/index.js +243 -0
- package/dist/richtext/lexical.d.ts +23 -0
- package/dist/richtext/lexical.d.ts.map +1 -0
- package/dist/richtext/lexical.js +35 -0
- package/dist/security/audit.d.ts +188 -0
- package/dist/security/audit.d.ts.map +1 -0
- package/dist/security/audit.js +431 -0
- package/dist/security/auth.d.ts +241 -0
- package/dist/security/auth.d.ts.map +1 -0
- package/dist/security/auth.js +476 -0
- package/dist/security/authorization.d.ts +235 -0
- package/dist/security/authorization.d.ts.map +1 -0
- package/dist/security/authorization.js +434 -0
- package/dist/security/encryption.d.ts +214 -0
- package/dist/security/encryption.d.ts.map +1 -0
- package/dist/security/encryption.js +517 -0
- package/dist/security/gdpr.d.ts +300 -0
- package/dist/security/gdpr.d.ts.map +1 -0
- package/dist/security/gdpr.js +465 -0
- package/dist/security/headers.d.ts +182 -0
- package/dist/security/headers.d.ts.map +1 -0
- package/dist/security/headers.js +402 -0
- package/dist/security/index.d.ts +19 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +18 -0
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +28 -0
- package/dist/server/renderPage.d.ts +69 -0
- package/dist/server/renderPage.d.ts.map +1 -0
- package/dist/server/renderPage.js +109 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +4 -0
- package/dist/storage/vercel-blob.d.ts +17 -0
- package/dist/storage/vercel-blob.d.ts.map +1 -0
- package/dist/storage/vercel-blob.js +83 -0
- package/dist/translations/index.d.ts +17 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +1 -0
- package/dist/types/access.d.ts +67 -0
- package/dist/types/access.d.ts.map +1 -0
- package/dist/types/access.js +8 -0
- package/dist/types/api.d.ts +57 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +8 -0
- package/dist/types/cms.d.ts +8 -0
- package/dist/types/cms.d.ts.map +1 -0
- package/dist/types/cms.js +6 -0
- package/dist/types/config.d.ts +152 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +9 -0
- package/dist/types/core.d.ts +11 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +9 -0
- package/dist/types/extensions.d.ts +116 -0
- package/dist/types/extensions.d.ts.map +1 -0
- package/dist/types/extensions.js +8 -0
- package/dist/types/frontend.d.ts +53 -0
- package/dist/types/frontend.d.ts.map +1 -0
- package/dist/types/frontend.js +7 -0
- package/dist/types/generated.d.ts +12 -0
- package/dist/types/generated.d.ts.map +1 -0
- package/dist/types/generated.js +10 -0
- package/dist/types/hooks.d.ts +53 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/hooks.js +8 -0
- package/dist/types/index.d.ts +49 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +61 -0
- package/dist/types/interfaces/app.d.ts +50 -0
- package/dist/types/interfaces/app.d.ts.map +1 -0
- package/dist/types/interfaces/app.js +5 -0
- package/dist/types/jobs.d.ts +112 -0
- package/dist/types/jobs.d.ts.map +1 -0
- package/dist/types/jobs.js +7 -0
- package/dist/types/legacy.d.ts +147 -0
- package/dist/types/legacy.d.ts.map +1 -0
- package/dist/types/legacy.js +8 -0
- package/dist/types/plugins.d.ts +17 -0
- package/dist/types/plugins.d.ts.map +1 -0
- package/dist/types/plugins.js +8 -0
- package/dist/types/query.d.ts +99 -0
- package/dist/types/query.d.ts.map +1 -0
- package/dist/types/query.js +24 -0
- package/dist/types/request.d.ts +40 -0
- package/dist/types/request.d.ts.map +1 -0
- package/dist/types/request.js +8 -0
- package/dist/types/richtext.d.ts +23 -0
- package/dist/types/richtext.d.ts.map +1 -0
- package/dist/types/richtext.js +8 -0
- package/dist/types/runtime.d.ts +216 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +9 -0
- package/dist/types/schema.d.ts +9 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +7 -0
- package/dist/types/user.d.ts +48 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +8 -0
- package/dist/utils/access-conversion.d.ts +17 -0
- package/dist/utils/access-conversion.d.ts.map +1 -0
- package/dist/utils/access-conversion.js +96 -0
- package/dist/utils/api-wrapper.d.ts +63 -0
- package/dist/utils/api-wrapper.d.ts.map +1 -0
- package/dist/utils/api-wrapper.js +151 -0
- package/dist/utils/block-conversion.d.ts +21 -0
- package/dist/utils/block-conversion.d.ts.map +1 -0
- package/dist/utils/block-conversion.js +109 -0
- package/dist/utils/cache.d.ts +86 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +154 -0
- package/dist/utils/deep-clone.d.ts +25 -0
- package/dist/utils/deep-clone.d.ts.map +1 -0
- package/dist/utils/deep-clone.js +115 -0
- package/dist/utils/error-responses.d.ts +57 -0
- package/dist/utils/error-responses.d.ts.map +1 -0
- package/dist/utils/error-responses.js +96 -0
- package/dist/utils/errors.d.ts +97 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +397 -0
- package/dist/utils/field-conversion.d.ts +40 -0
- package/dist/utils/field-conversion.d.ts.map +1 -0
- package/dist/utils/field-conversion.js +275 -0
- package/dist/utils/flattenResult.d.ts +7 -0
- package/dist/utils/flattenResult.d.ts.map +1 -0
- package/dist/utils/flattenResult.js +23 -0
- package/dist/utils/getBlockSelect.d.ts +12 -0
- package/dist/utils/getBlockSelect.d.ts.map +1 -0
- package/dist/utils/getBlockSelect.js +12 -0
- package/dist/utils/getSelectMode.d.ts +8 -0
- package/dist/utils/getSelectMode.d.ts.map +1 -0
- package/dist/utils/getSelectMode.js +21 -0
- package/dist/utils/isValidID.d.ts +5 -0
- package/dist/utils/isValidID.d.ts.map +1 -0
- package/dist/utils/isValidID.js +13 -0
- package/dist/utils/json-parsing.d.ts +48 -0
- package/dist/utils/json-parsing.d.ts.map +1 -0
- package/dist/utils/json-parsing.js +130 -0
- package/dist/utils/jwt-validation.d.ts +14 -0
- package/dist/utils/jwt-validation.d.ts.map +1 -0
- package/dist/utils/jwt-validation.js +36 -0
- package/dist/utils/logger-client.d.ts +32 -0
- package/dist/utils/logger-client.d.ts.map +1 -0
- package/dist/utils/logger-client.js +55 -0
- package/dist/utils/logger-server.d.ts +32 -0
- package/dist/utils/logger-server.d.ts.map +1 -0
- package/dist/utils/logger-server.js +68 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +12 -0
- package/dist/utils/request-context.d.ts +143 -0
- package/dist/utils/request-context.d.ts.map +1 -0
- package/dist/utils/request-context.js +168 -0
- package/dist/utils/request-headers.d.ts +15 -0
- package/dist/utils/request-headers.d.ts.map +1 -0
- package/dist/utils/request-headers.js +31 -0
- package/dist/utils/stripUnselectedFields.d.ts +10 -0
- package/dist/utils/stripUnselectedFields.d.ts.map +1 -0
- package/dist/utils/stripUnselectedFields.js +20 -0
- package/dist/utils/type-guards.d.ts +33 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +63 -0
- package/dist/utils/user.d.ts +14 -0
- package/dist/utils/user.d.ts.map +1 -0
- package/dist/utils/user.js +15 -0
- package/package.json +241 -724
- package/LICENSE_SUMMARY.md +0 -55
- package/NOTICE +0 -34
- package/dist/exports/RenderErrorPage.js +0 -3
- package/dist/exports/__internal.js +0 -3
- package/dist/exports/abort.js +0 -3
- package/dist/exports/bin-entry.js +0 -5
- package/dist/exports/client.js +0 -3
- package/dist/exports/config.js +0 -1
- package/dist/exports/helpers.js +0 -1
- package/dist/exports/index.js +0 -33
- package/dist/exports/plugin.js +0 -3
- package/dist/exports/prerender.js +0 -3
- package/dist/exports/router.js +0 -3
- package/dist/exports/routing.js +0 -3
- package/dist/exports/server.js +0 -3
- package/dist/exports/setup.js +0 -3
- package/dist/exports/types.js +0 -1
- package/dist/integration/styles.css +0 -141
- package/dist/shared/RenderErrorPage.d.ts +0 -3
- package/dist/shared/RenderErrorPage.js +0 -3
- package/dist/shared/abort.js +0 -3
- package/dist/shared/route/routing.js +0 -3
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export function nestedDocsPlugin(config = {}) {
|
|
2
|
+
const { collections = [], parentFieldSlug = 'parent', breadcrumbsFieldSlug = 'breadcrumbs', } = config;
|
|
3
|
+
return (incomingConfig) => {
|
|
4
|
+
if (incomingConfig.collections) {
|
|
5
|
+
for (const collection of incomingConfig.collections) {
|
|
6
|
+
if (collections.includes(collection.slug)) {
|
|
7
|
+
// Add parent field
|
|
8
|
+
const parentField = {
|
|
9
|
+
name: parentFieldSlug,
|
|
10
|
+
type: 'relationship',
|
|
11
|
+
relationTo: collection.slug,
|
|
12
|
+
maxDepth: 1,
|
|
13
|
+
admin: {
|
|
14
|
+
position: 'sidebar',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
// Add breadcrumbs field
|
|
18
|
+
const breadcrumbsField = {
|
|
19
|
+
name: breadcrumbsFieldSlug,
|
|
20
|
+
type: 'array',
|
|
21
|
+
admin: {
|
|
22
|
+
readOnly: true,
|
|
23
|
+
components: {
|
|
24
|
+
// biome-ignore lint/style/useNamingConvention: Payload component key.
|
|
25
|
+
RowLabel: () => null,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
fields: [
|
|
29
|
+
{
|
|
30
|
+
name: 'doc',
|
|
31
|
+
type: 'relationship',
|
|
32
|
+
relationTo: collection.slug,
|
|
33
|
+
maxDepth: 1,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'url',
|
|
37
|
+
type: 'text',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'label',
|
|
41
|
+
type: 'text',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
// Add hooks for breadcrumbs
|
|
46
|
+
const beforeChangeHook = ({ data }) => {
|
|
47
|
+
// Generate breadcrumbs based on parent
|
|
48
|
+
if (data[parentFieldSlug]) {
|
|
49
|
+
// This would need to be implemented with actual database queries
|
|
50
|
+
data[breadcrumbsFieldSlug] = [];
|
|
51
|
+
}
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
collection.hooks = {
|
|
55
|
+
...collection.hooks,
|
|
56
|
+
beforeChange: [
|
|
57
|
+
...(collection.hooks?.beforeChange || []),
|
|
58
|
+
beforeChangeHook,
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
collection.fields = [...collection.fields, parentField, breadcrumbsField];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return incomingConfig;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Field, Plugin, RevealRequest } from '../types/index.js';
|
|
2
|
+
export interface RedirectsPluginConfig {
|
|
3
|
+
collections?: string[];
|
|
4
|
+
overrides?: {
|
|
5
|
+
fields?: (args: {
|
|
6
|
+
defaultFields: Field[];
|
|
7
|
+
}) => Field[];
|
|
8
|
+
hooks?: {
|
|
9
|
+
afterChange?: ((args: {
|
|
10
|
+
doc: Document;
|
|
11
|
+
req: RevealRequest;
|
|
12
|
+
}) => Promise<Document> | Document)[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function redirectsPlugin(config?: RedirectsPluginConfig): Plugin;
|
|
17
|
+
//# sourceMappingURL=redirects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirects.d.ts","sourceRoot":"","sources":["../../src/plugins/redirects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEvF,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,SAAS,CAAC,EAAE;QACV,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;YAAE,aAAa,EAAE,KAAK,EAAE,CAAA;SAAE,KAAK,KAAK,EAAE,CAAA;QACtD,KAAK,CAAC,EAAE;YACN,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE;gBACpB,GAAG,EAAE,QAAQ,CAAA;gBACb,GAAG,EAAE,aAAa,CAAA;aACnB,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAA;SACtC,CAAA;KACF,CAAA;CACF;AAED,wBAAgB,eAAe,CAAC,MAAM,GAAE,qBAA0B,GAAG,MAAM,CAsE1E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export function redirectsPlugin(config = {}) {
|
|
2
|
+
const { collections = ['pages', 'posts'] } = config;
|
|
3
|
+
return (incomingConfig) => {
|
|
4
|
+
// Add redirects collection
|
|
5
|
+
const redirectsCollection = {
|
|
6
|
+
slug: 'redirects',
|
|
7
|
+
admin: {
|
|
8
|
+
useAsTitle: 'from',
|
|
9
|
+
defaultColumns: ['from', 'to', 'status'],
|
|
10
|
+
},
|
|
11
|
+
fields: [
|
|
12
|
+
{
|
|
13
|
+
name: 'from',
|
|
14
|
+
type: 'text',
|
|
15
|
+
required: true,
|
|
16
|
+
unique: true,
|
|
17
|
+
admin: {
|
|
18
|
+
description: 'The URL to redirect from',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'to',
|
|
23
|
+
type: 'relationship',
|
|
24
|
+
relationTo: collections,
|
|
25
|
+
required: true,
|
|
26
|
+
maxDepth: 1,
|
|
27
|
+
admin: {
|
|
28
|
+
description: 'The page or post to redirect to',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'status',
|
|
33
|
+
type: 'select',
|
|
34
|
+
required: true,
|
|
35
|
+
defaultValue: '301',
|
|
36
|
+
options: [
|
|
37
|
+
{ label: '301 - Permanent', value: '301' },
|
|
38
|
+
{ label: '302 - Temporary', value: '302' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
// Apply overrides if provided
|
|
44
|
+
if (config.overrides?.fields) {
|
|
45
|
+
redirectsCollection.fields = config.overrides.fields({
|
|
46
|
+
defaultFields: redirectsCollection.fields,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (config.overrides?.hooks?.afterChange) {
|
|
50
|
+
redirectsCollection.hooks = {
|
|
51
|
+
...redirectsCollection.hooks,
|
|
52
|
+
afterChange: config.overrides.hooks.afterChange,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
incomingConfig.collections = [
|
|
56
|
+
...(incomingConfig.collections || []),
|
|
57
|
+
// biome-ignore lint/suspicious/noExplicitAny: invariant generic needs any for heterogeneous array
|
|
58
|
+
redirectsCollection,
|
|
59
|
+
];
|
|
60
|
+
return incomingConfig;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/queries/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildWhereClause, extractWhereValues, } from './queryBuilder.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { RevealFindOptions, RevealWhere } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Query Builder Utilities
|
|
4
|
+
*
|
|
5
|
+
* Handles building WHERE clauses from RevealWhere query objects.
|
|
6
|
+
* Uses PostgreSQL-style $1, $2 parameters by default.
|
|
7
|
+
*/
|
|
8
|
+
export type ParameterStyle = 'postgres' | 'positional';
|
|
9
|
+
/**
|
|
10
|
+
* Options for building WHERE clauses
|
|
11
|
+
*/
|
|
12
|
+
export interface BuildWhereOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Parameter style to use ('postgres' for $1, $2 or 'positional' for ?)
|
|
15
|
+
* @default 'postgres'
|
|
16
|
+
*/
|
|
17
|
+
parameterStyle?: ParameterStyle;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to include the WHERE keyword in the result
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
includeWhereKeyword?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to quote field names
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
quoteFields?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Builds a WHERE clause from a RevealWhere query object.
|
|
31
|
+
* Supports nested AND/OR conditions and various operators.
|
|
32
|
+
*
|
|
33
|
+
* @param where - The WHERE condition object
|
|
34
|
+
* @param params - Array to push parameter values into (mutated)
|
|
35
|
+
* @param options - Build options
|
|
36
|
+
* @returns SQL WHERE clause (without WHERE keyword by default)
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildWhereClause(where: RevealWhere | RevealFindOptions['where'] | undefined, params: unknown[], options?: BuildWhereOptions): string;
|
|
39
|
+
/**
|
|
40
|
+
* Extracts parameter values from a RevealWhere query object.
|
|
41
|
+
* Used for building parameter arrays separately from WHERE clauses.
|
|
42
|
+
*
|
|
43
|
+
* @param where - The WHERE condition object
|
|
44
|
+
* @returns Array of parameter values in order
|
|
45
|
+
*/
|
|
46
|
+
export declare function extractWhereValues(where?: RevealWhere): unknown[];
|
|
47
|
+
//# sourceMappingURL=queryBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryBuilder.d.ts","sourceRoot":"","sources":["../../src/queries/queryBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEvE;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,YAAY,CAAA;AAEtD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,SAAS,EAC3D,MAAM,EAAE,OAAO,EAAE,EACjB,OAAO,GAAE,iBAAsB,GAC9B,MAAM,CAmNR;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,OAAO,EAAE,CAoEjE"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a WHERE clause from a RevealWhere query object.
|
|
3
|
+
* Supports nested AND/OR conditions and various operators.
|
|
4
|
+
*
|
|
5
|
+
* @param where - The WHERE condition object
|
|
6
|
+
* @param params - Array to push parameter values into (mutated)
|
|
7
|
+
* @param options - Build options
|
|
8
|
+
* @returns SQL WHERE clause (without WHERE keyword by default)
|
|
9
|
+
*/
|
|
10
|
+
export function buildWhereClause(where, params, options = {}) {
|
|
11
|
+
if (!where) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
const { parameterStyle = 'postgres', includeWhereKeyword = false, quoteFields = true } = options;
|
|
15
|
+
const getPlaceholder = () => {
|
|
16
|
+
if (parameterStyle === 'postgres') {
|
|
17
|
+
// Calculate placeholder BEFORE pushing to params array.
|
|
18
|
+
// PostgreSQL uses 1-indexed placeholders ($1, $2, $3...).
|
|
19
|
+
// If params.length = 0, next param will be at position 1 ($1).
|
|
20
|
+
// If params.length = 1, next param will be at position 2 ($2).
|
|
21
|
+
// Therefore: placeholder = params.length + 1
|
|
22
|
+
return `$${params.length + 1}`;
|
|
23
|
+
}
|
|
24
|
+
return '?';
|
|
25
|
+
};
|
|
26
|
+
const quoteField = (field) => {
|
|
27
|
+
return quoteFields ? `"${field}"` : field;
|
|
28
|
+
};
|
|
29
|
+
const whereWithGroups = where;
|
|
30
|
+
const isOperatorObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value) && !(value instanceof Date);
|
|
31
|
+
// Handle and/or groups
|
|
32
|
+
if (Array.isArray(whereWithGroups.and)) {
|
|
33
|
+
const conditions = whereWithGroups.and
|
|
34
|
+
.map((w) => buildWhereClause(w, params, { ...options, includeWhereKeyword: false }))
|
|
35
|
+
.filter((c) => c.length > 0);
|
|
36
|
+
if (conditions.length === 0) {
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
const clause = conditions.join(' AND ');
|
|
40
|
+
return includeWhereKeyword ? `WHERE ${clause}` : clause;
|
|
41
|
+
}
|
|
42
|
+
if (Array.isArray(whereWithGroups.or)) {
|
|
43
|
+
const conditions = whereWithGroups.or
|
|
44
|
+
.map((w) => {
|
|
45
|
+
const clause = buildWhereClause(w, params, {
|
|
46
|
+
...options,
|
|
47
|
+
includeWhereKeyword: false,
|
|
48
|
+
});
|
|
49
|
+
// Ensure clause doesn't start with "WHERE" (should never happen with includeWhereKeyword: false, but defensive)
|
|
50
|
+
if (clause.trim().toUpperCase().startsWith('WHERE')) {
|
|
51
|
+
throw new Error(`buildWhereClause returned clause starting with "WHERE" when includeWhereKeyword is false. This indicates a bug in the query builder. Clause: ${clause}`);
|
|
52
|
+
}
|
|
53
|
+
return clause;
|
|
54
|
+
})
|
|
55
|
+
.filter((c) => c.length > 0);
|
|
56
|
+
if (conditions.length === 0) {
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
const clause = `(${conditions.join(' OR ')})`;
|
|
60
|
+
return includeWhereKeyword ? `WHERE ${clause}` : clause;
|
|
61
|
+
}
|
|
62
|
+
// Handle field conditions
|
|
63
|
+
const conditions = [];
|
|
64
|
+
// Valid operators for validation
|
|
65
|
+
const validOperators = new Set([
|
|
66
|
+
'equals',
|
|
67
|
+
'not_equals',
|
|
68
|
+
'in',
|
|
69
|
+
'not_in',
|
|
70
|
+
'contains',
|
|
71
|
+
'greater_than',
|
|
72
|
+
'less_than',
|
|
73
|
+
'like',
|
|
74
|
+
'exists',
|
|
75
|
+
]);
|
|
76
|
+
for (const [field, condition] of Object.entries(where)) {
|
|
77
|
+
// Skip special keys
|
|
78
|
+
if (field === 'and' || field === 'or') {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (condition === null || condition === undefined) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const quotedField = quoteField(field);
|
|
85
|
+
// If condition is a plain value, treat as equals
|
|
86
|
+
if (!isOperatorObject(condition)) {
|
|
87
|
+
// Get placeholder BEFORE pushing to ensure correct index
|
|
88
|
+
const placeholder = getPlaceholder();
|
|
89
|
+
params.push(condition);
|
|
90
|
+
conditions.push(`${quotedField} = ${placeholder}`);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
// Handle operator objects
|
|
94
|
+
if (isOperatorObject(condition)) {
|
|
95
|
+
// Validate operators before processing
|
|
96
|
+
const operatorKeys = Object.keys(condition).filter((key) => key !== 'and' && key !== 'or');
|
|
97
|
+
const invalidOperators = operatorKeys.filter((key) => !validOperators.has(key));
|
|
98
|
+
if (invalidOperators.length > 0) {
|
|
99
|
+
throw new Error(`Invalid query operators: ${invalidOperators.join(', ')}. Valid operators are: ${Array.from(validOperators).join(', ')}`);
|
|
100
|
+
}
|
|
101
|
+
// equals
|
|
102
|
+
if ('equals' in condition && condition.equals !== undefined) {
|
|
103
|
+
const placeholder = getPlaceholder();
|
|
104
|
+
params.push(condition.equals);
|
|
105
|
+
conditions.push(`${quotedField} = ${placeholder}`);
|
|
106
|
+
}
|
|
107
|
+
// not_equals
|
|
108
|
+
if ('not_equals' in condition && condition.not_equals !== undefined) {
|
|
109
|
+
const placeholder = getPlaceholder();
|
|
110
|
+
params.push(condition.not_equals);
|
|
111
|
+
conditions.push(`${quotedField} != ${placeholder}`);
|
|
112
|
+
}
|
|
113
|
+
// in
|
|
114
|
+
if ('in' in condition && Array.isArray(condition.in)) {
|
|
115
|
+
if (condition.in.length > 0) {
|
|
116
|
+
const placeholders = [];
|
|
117
|
+
for (const value of condition.in) {
|
|
118
|
+
const placeholder = getPlaceholder();
|
|
119
|
+
params.push(value);
|
|
120
|
+
placeholders.push(placeholder);
|
|
121
|
+
}
|
|
122
|
+
conditions.push(`${quotedField} IN (${placeholders.join(', ')})`);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// Empty IN clause should match nothing
|
|
126
|
+
conditions.push('1=0'); // Always false
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// not_in
|
|
130
|
+
if ('not_in' in condition && Array.isArray(condition.not_in)) {
|
|
131
|
+
if (condition.not_in.length > 0) {
|
|
132
|
+
const placeholders = [];
|
|
133
|
+
for (const value of condition.not_in) {
|
|
134
|
+
const placeholder = getPlaceholder();
|
|
135
|
+
params.push(value);
|
|
136
|
+
placeholders.push(placeholder);
|
|
137
|
+
}
|
|
138
|
+
conditions.push(`${quotedField} NOT IN (${placeholders.join(', ')})`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// contains (LIKE with wildcards)
|
|
142
|
+
if ('contains' in condition && typeof condition.contains === 'string') {
|
|
143
|
+
const placeholder = getPlaceholder();
|
|
144
|
+
// Escape LIKE wildcards (% and _) in user input to prevent wildcard injection
|
|
145
|
+
const escaped = condition.contains.replace(/[%_\\]/g, '\\$&');
|
|
146
|
+
params.push(`%${escaped}%`);
|
|
147
|
+
conditions.push(`${quotedField} LIKE ${placeholder} ESCAPE '\\'`);
|
|
148
|
+
}
|
|
149
|
+
// greater_than
|
|
150
|
+
if ('greater_than' in condition && condition.greater_than !== undefined) {
|
|
151
|
+
const placeholder = getPlaceholder();
|
|
152
|
+
params.push(condition.greater_than);
|
|
153
|
+
conditions.push(`${quotedField} > ${placeholder}`);
|
|
154
|
+
}
|
|
155
|
+
// less_than
|
|
156
|
+
if ('less_than' in condition && condition.less_than !== undefined) {
|
|
157
|
+
const placeholder = getPlaceholder();
|
|
158
|
+
params.push(condition.less_than);
|
|
159
|
+
conditions.push(`${quotedField} < ${placeholder}`);
|
|
160
|
+
}
|
|
161
|
+
// like
|
|
162
|
+
if ('like' in condition && typeof condition.like === 'string') {
|
|
163
|
+
const placeholder = getPlaceholder();
|
|
164
|
+
params.push(condition.like);
|
|
165
|
+
conditions.push(`${quotedField} LIKE ${placeholder}`);
|
|
166
|
+
}
|
|
167
|
+
// exists (check if field is not null)
|
|
168
|
+
if ('exists' in condition && typeof condition.exists === 'boolean') {
|
|
169
|
+
if (condition.exists) {
|
|
170
|
+
conditions.push(`${quotedField} IS NOT NULL`);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
conditions.push(`${quotedField} IS NULL`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const clause = conditions.length > 0 ? conditions.join(' AND ') : '';
|
|
179
|
+
const result = includeWhereKeyword && clause ? `WHERE ${clause}` : clause;
|
|
180
|
+
// Defensive check: ensure we never return "WHERE" prefix when includeWhereKeyword is false
|
|
181
|
+
if (!includeWhereKeyword && result.trim().toUpperCase().startsWith('WHERE')) {
|
|
182
|
+
throw new Error(`buildWhereClause returned clause starting with "WHERE" when includeWhereKeyword is false. This indicates a bug in the query builder. Clause: ${result}`);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Extracts parameter values from a RevealWhere query object.
|
|
188
|
+
* Used for building parameter arrays separately from WHERE clauses.
|
|
189
|
+
*
|
|
190
|
+
* @param where - The WHERE condition object
|
|
191
|
+
* @returns Array of parameter values in order
|
|
192
|
+
*/
|
|
193
|
+
export function extractWhereValues(where) {
|
|
194
|
+
if (!where)
|
|
195
|
+
return [];
|
|
196
|
+
const values = [];
|
|
197
|
+
for (const [field, operators] of Object.entries(where)) {
|
|
198
|
+
if (field === 'and' || field === 'or')
|
|
199
|
+
continue;
|
|
200
|
+
if (typeof operators === 'object' &&
|
|
201
|
+
operators !== null &&
|
|
202
|
+
!Array.isArray(operators) &&
|
|
203
|
+
!(operators instanceof Date)) {
|
|
204
|
+
for (const [op, value] of Object.entries(operators)) {
|
|
205
|
+
switch (op) {
|
|
206
|
+
case 'equals':
|
|
207
|
+
case 'not_equals':
|
|
208
|
+
case 'greater_than':
|
|
209
|
+
case 'less_than':
|
|
210
|
+
values.push(value);
|
|
211
|
+
break;
|
|
212
|
+
case 'contains':
|
|
213
|
+
if (typeof value === 'string') {
|
|
214
|
+
const escaped = value.replace(/[%_\\]/g, '\\$&');
|
|
215
|
+
values.push(`%${escaped}%`);
|
|
216
|
+
}
|
|
217
|
+
break;
|
|
218
|
+
case 'in':
|
|
219
|
+
if (Array.isArray(value)) {
|
|
220
|
+
values.push(...value);
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
case 'not_in':
|
|
224
|
+
if (Array.isArray(value)) {
|
|
225
|
+
values.push(...value);
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
case 'like':
|
|
229
|
+
if (typeof value === 'string') {
|
|
230
|
+
values.push(value);
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
// exists doesn't need a value
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else if (operators !== null && operators !== undefined) {
|
|
238
|
+
// Plain value (treated as equals)
|
|
239
|
+
values.push(operators);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const whereWithGroups = where;
|
|
243
|
+
// Handle nested conditions
|
|
244
|
+
if (Array.isArray(whereWithGroups.and)) {
|
|
245
|
+
for (const w of whereWithGroups.and) {
|
|
246
|
+
values.push(...extractWhereValues(w));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (Array.isArray(whereWithGroups.or)) {
|
|
250
|
+
for (const w of whereWithGroups.or) {
|
|
251
|
+
values.push(...extractWhereValues(w));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return values;
|
|
255
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { RevealCollectionConfig, RevealGlobalConfig, RevealUIField } from '../types/index.js';
|
|
2
|
+
import type { RelationshipMetadata } from '../types/query.js';
|
|
3
|
+
/**
|
|
4
|
+
* Relationship Field Analyzer
|
|
5
|
+
*
|
|
6
|
+
* Analyzes a collection config and extracts all relationship fields with their metadata.
|
|
7
|
+
* This is the foundation for depth-based relationship population.
|
|
8
|
+
*
|
|
9
|
+
* Based on RevealUI CMS analysis:
|
|
10
|
+
* - Simple relationships (single, no hasMany): Direct Foreign Keys
|
|
11
|
+
* - hasMany relationships: Junction Tables
|
|
12
|
+
* - Polymorphic relationships (relationTo array): Junction Tables with multiple FK columns
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Shared type for configs that have fields and slug (collections and globals)
|
|
16
|
+
*/
|
|
17
|
+
type ConfigWithFields = {
|
|
18
|
+
slug: string;
|
|
19
|
+
fields: RevealUIField[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Analyzes a collection or global configuration and extracts all relationship fields
|
|
23
|
+
* with their storage metadata for proper query building.
|
|
24
|
+
*
|
|
25
|
+
* @param config - The collection or global configuration to analyze
|
|
26
|
+
* @param collectionSlug - Optional slug override (defaults to config.slug)
|
|
27
|
+
* @returns Array of relationship metadata for all relationship fields
|
|
28
|
+
*/
|
|
29
|
+
export declare function getRelationshipFields(config: RevealCollectionConfig | RevealGlobalConfig | ConfigWithFields, collectionSlug?: string): RelationshipMetadata[];
|
|
30
|
+
/**
|
|
31
|
+
* Validates relationship metadata for consistency and correctness.
|
|
32
|
+
* Used during development to catch configuration errors early.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateRelationshipMetadata(metadata: RelationshipMetadata[]): {
|
|
35
|
+
valid: boolean;
|
|
36
|
+
errors: string[];
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../src/relationships/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAClG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7D;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,aAAa,EAAE,CAAA;CACxB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,sBAAsB,GAAG,kBAAkB,GAAG,gBAAgB,EACtE,cAAc,CAAC,EAAE,MAAM,GACtB,oBAAoB,EAAE,CAoDxB;AA6DD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG;IAC9E,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,CA+BA"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analyzes a collection or global configuration and extracts all relationship fields
|
|
3
|
+
* with their storage metadata for proper query building.
|
|
4
|
+
*
|
|
5
|
+
* @param config - The collection or global configuration to analyze
|
|
6
|
+
* @param collectionSlug - Optional slug override (defaults to config.slug)
|
|
7
|
+
* @returns Array of relationship metadata for all relationship fields
|
|
8
|
+
*/
|
|
9
|
+
export function getRelationshipFields(config, collectionSlug) {
|
|
10
|
+
const toSnakeCase = (string) => string
|
|
11
|
+
?.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
12
|
+
.replace(/\s+/g, '-')
|
|
13
|
+
.toLowerCase();
|
|
14
|
+
const relationships = [];
|
|
15
|
+
const tableName = toSnakeCase(collectionSlug || config.slug);
|
|
16
|
+
// Recursively traverse fields to find all relationships
|
|
17
|
+
function traverseFields(fields, currentPath = '', parentLocalized = false) {
|
|
18
|
+
for (const field of fields) {
|
|
19
|
+
const fieldName = field.name || '';
|
|
20
|
+
const fieldPath = currentPath ? `${currentPath}.${fieldName}` : fieldName;
|
|
21
|
+
// Determine if field is localized (field-level or inherited from parent)
|
|
22
|
+
// Note: Collection-level localization is not yet supported in RevealCollectionConfig type
|
|
23
|
+
const isLocalized = field.localized === true || parentLocalized;
|
|
24
|
+
// Check if this is a relationship field
|
|
25
|
+
if (field.type === 'relationship' || field.type === 'upload') {
|
|
26
|
+
const metadata = createRelationshipMetadata(field, fieldPath || '', tableName, isLocalized);
|
|
27
|
+
if (metadata) {
|
|
28
|
+
relationships.push(metadata);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Recursively check nested fields (for arrays, groups, blocks, etc.)
|
|
32
|
+
if ('fields' in field && Array.isArray(field.fields)) {
|
|
33
|
+
const nestedFields = field.fields;
|
|
34
|
+
traverseFields(nestedFields, fieldPath, isLocalized);
|
|
35
|
+
}
|
|
36
|
+
// Check blocks
|
|
37
|
+
if (field.type === 'blocks' && 'blocks' in field && Array.isArray(field.blocks)) {
|
|
38
|
+
for (const block of field.blocks) {
|
|
39
|
+
if ('fields' in block && Array.isArray(block.fields)) {
|
|
40
|
+
const blockFields = block.fields;
|
|
41
|
+
const blockSlug = typeof block.slug === 'string' ? block.slug : 'block';
|
|
42
|
+
traverseFields(blockFields, `${fieldPath}.${blockSlug}`, isLocalized);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
traverseFields(config.fields);
|
|
49
|
+
return relationships;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Creates relationship metadata for a single field.
|
|
53
|
+
* Determines storage type based on field properties following RevealUI CMS patterns.
|
|
54
|
+
*/
|
|
55
|
+
function createRelationshipMetadata(field, fieldPath, parentTableName, isLocalized = false) {
|
|
56
|
+
// Skip if not a relationship field
|
|
57
|
+
if (field.type !== 'relationship' && field.type !== 'upload') {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
// Skip if no relationTo (shouldn't happen but safety check)
|
|
61
|
+
if (!field.relationTo) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const relationTo = field.relationTo;
|
|
65
|
+
const hasMany = field.hasMany ?? false;
|
|
66
|
+
const isPolymorphic = Array.isArray(relationTo);
|
|
67
|
+
// Determine storage type based on RevealUI CMS analysis
|
|
68
|
+
let storageType;
|
|
69
|
+
if (isPolymorphic) {
|
|
70
|
+
storageType = 'polymorphic';
|
|
71
|
+
}
|
|
72
|
+
else if (hasMany) {
|
|
73
|
+
storageType = 'junction_table';
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
storageType = 'direct_fk';
|
|
77
|
+
}
|
|
78
|
+
// Generate table/column names
|
|
79
|
+
const tableName = storageType === 'direct_fk'
|
|
80
|
+
? parentTableName // main table for direct FKs
|
|
81
|
+
: `${parentTableName}_rels`; // junction table
|
|
82
|
+
const fkColumnName = storageType === 'direct_fk'
|
|
83
|
+
? `${field.name}_id` // e.g., author_id
|
|
84
|
+
: undefined; // junction tables have multiple FK columns
|
|
85
|
+
return {
|
|
86
|
+
fieldName: field.name,
|
|
87
|
+
path: fieldPath,
|
|
88
|
+
storageType,
|
|
89
|
+
relationTo,
|
|
90
|
+
hasMany,
|
|
91
|
+
localized: isLocalized,
|
|
92
|
+
tableName,
|
|
93
|
+
fkColumnName,
|
|
94
|
+
maxDepth: 1, // Default depth, will be configurable later
|
|
95
|
+
depth: 1, // Default depth for queries
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Validates relationship metadata for consistency and correctness.
|
|
100
|
+
* Used during development to catch configuration errors early.
|
|
101
|
+
*/
|
|
102
|
+
export function validateRelationshipMetadata(metadata) {
|
|
103
|
+
const errors = [];
|
|
104
|
+
for (const rel of metadata) {
|
|
105
|
+
// Validate storage type logic
|
|
106
|
+
if (rel.storageType === 'polymorphic' && !Array.isArray(rel.relationTo)) {
|
|
107
|
+
errors.push(`Polymorphic relationship ${rel.fieldName} must have array relationTo`);
|
|
108
|
+
}
|
|
109
|
+
if (rel.storageType === 'direct_fk' && rel.hasMany) {
|
|
110
|
+
errors.push(`Direct FK relationship ${rel.fieldName} cannot have hasMany=true`);
|
|
111
|
+
}
|
|
112
|
+
if (rel.storageType !== 'direct_fk' && rel.fkColumnName) {
|
|
113
|
+
errors.push(`Non-direct-FK relationship ${rel.fieldName} should not have fkColumnName`);
|
|
114
|
+
}
|
|
115
|
+
// Validate table name format
|
|
116
|
+
if (rel.storageType === 'direct_fk' && rel.tableName?.includes('_rels')) {
|
|
117
|
+
errors.push(`Direct FK relationship ${rel.fieldName} should not use _rels table`);
|
|
118
|
+
}
|
|
119
|
+
if (rel.storageType !== 'direct_fk' && rel.tableName && !rel.tableName.includes('_rels')) {
|
|
120
|
+
errors.push(`Junction table relationship ${rel.fieldName} should use _rels table`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
valid: errors.length === 0,
|
|
125
|
+
errors,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/relationships/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAA"}
|