@revealui/core 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/compression.d.ts.map +1 -1
- package/dist/api/payload-optimization.d.ts.map +1 -1
- package/dist/api/rate-limit.d.ts +29 -28
- package/dist/api/rate-limit.d.ts.map +1 -1
- package/dist/api/rate-limit.js +63 -3
- package/dist/api/response-cache.d.ts.map +1 -1
- package/dist/api/response-cache.js +1 -1
- package/dist/api/rest.d.ts.map +1 -1
- package/dist/api/rest.js +3 -2
- package/dist/auth/access.d.ts.map +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/cache/query-cache.d.ts +12 -10
- package/dist/cache/query-cache.d.ts.map +1 -1
- package/dist/cache/query-cache.js +38 -42
- package/dist/caching/app-cache.d.ts +5 -0
- package/dist/caching/app-cache.d.ts.map +1 -1
- package/dist/caching/app-cache.js +9 -1
- package/dist/caching/cdn-config.d.ts.map +1 -1
- package/dist/caching/cdn-config.js +4 -0
- package/dist/caching/edge-cache.d.ts +1 -1
- package/dist/caching/edge-cache.d.ts.map +1 -1
- package/dist/caching/edge-cache.js +36 -7
- package/dist/caching/index.d.ts +6 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +5 -0
- package/dist/caching/service-worker.d.ts +6 -3
- package/dist/caching/service-worker.d.ts.map +1 -1
- package/dist/caching/service-worker.js +3 -2
- package/dist/client/admin/RichText.d.ts +1 -1
- package/dist/client/admin/RichText.d.ts.map +1 -1
- package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -1
- package/dist/client/admin/components/AdminDashboard.js +178 -205
- package/dist/client/admin/components/CollectionList.d.ts.map +1 -1
- package/dist/client/admin/components/DocumentForm.d.ts.map +1 -1
- package/dist/client/admin/components/DocumentForm.js +130 -6
- package/dist/client/admin/components/GlobalForm.d.ts.map +1 -1
- package/dist/client/admin/context/ServerFunctionContext.d.ts +8 -0
- package/dist/client/admin/context/ServerFunctionContext.d.ts.map +1 -0
- package/dist/client/admin/context/ServerFunctionContext.js +15 -0
- package/dist/client/admin/i18n/en.d.ts.map +1 -1
- package/dist/client/admin/index.d.ts +1 -0
- package/dist/client/admin/index.d.ts.map +1 -1
- package/dist/client/admin/index.js +1 -0
- package/dist/client/admin/layout.d.ts +1 -1
- package/dist/client/admin/layout.d.ts.map +1 -1
- package/dist/client/admin/layout.js +3 -2
- package/dist/client/admin/page.d.ts.map +1 -1
- package/dist/client/admin/utils/apiClient.d.ts.map +1 -1
- package/dist/client/admin/utils/apiClient.js +0 -4
- package/dist/client/admin/utils/index.d.ts +0 -1
- package/dist/client/admin/utils/index.d.ts.map +1 -1
- package/dist/client/admin/utils/index.js +0 -1
- package/dist/client/admin/utils/serializeConfig.d.ts.map +1 -1
- package/dist/client/hooks.d.ts.map +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/richtext/RichTextEditor.d.ts.map +1 -1
- package/dist/client/richtext/components/ImageNodeComponent.d.ts.map +1 -1
- package/dist/client/richtext/components/ImageNodeComponent.js +0 -1
- package/dist/client/richtext/components/ImageUploadButton.d.ts +2 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts.map +1 -1
- package/dist/client/richtext/components/ImageUploadButton.js +30 -15
- package/dist/client/richtext/index.d.ts.map +1 -1
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts.map +1 -1
- package/dist/client/richtext/nodes/ImageNode.d.ts.map +1 -1
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts.map +1 -1
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts.map +1 -1
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts.map +1 -1
- package/dist/client/richtext/plugins/ImagePlugin.d.ts.map +1 -1
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts.map +1 -1
- package/dist/client/ui/index.d.ts.map +1 -1
- package/dist/client/ui/index.js +1 -1
- package/dist/collections/CollectionOperations.d.ts +7 -7
- package/dist/collections/CollectionOperations.d.ts.map +1 -1
- package/dist/collections/CollectionOperations.js +15 -1
- package/dist/collections/hooks.d.ts.map +1 -1
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/collections/operations/create.d.ts +2 -4
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +7 -5
- package/dist/collections/operations/createMany.d.ts +12 -0
- package/dist/collections/operations/createMany.d.ts.map +1 -0
- package/dist/collections/operations/createMany.js +43 -0
- package/dist/collections/operations/delete.d.ts +1 -1
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js +31 -2
- package/dist/collections/operations/deleteMany.d.ts +11 -0
- package/dist/collections/operations/deleteMany.d.ts.map +1 -0
- package/dist/collections/operations/deleteMany.js +50 -0
- package/dist/collections/operations/fieldHooks.d.ts +2 -2
- package/dist/collections/operations/fieldHooks.d.ts.map +1 -1
- package/dist/collections/operations/fieldHooks.js +4 -4
- package/dist/collections/operations/find.d.ts +2 -4
- package/dist/collections/operations/find.d.ts.map +1 -1
- package/dist/collections/operations/find.js +115 -8
- package/dist/collections/operations/findById.d.ts +3 -4
- package/dist/collections/operations/findById.d.ts.map +1 -1
- package/dist/collections/operations/findById.js +53 -1
- package/dist/collections/operations/sqlAdapter.d.ts +23 -0
- package/dist/collections/operations/sqlAdapter.d.ts.map +1 -0
- package/dist/collections/operations/sqlAdapter.js +76 -0
- package/dist/collections/operations/update.d.ts +3 -5
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +103 -11
- package/dist/collections/operations/updateMany.d.ts +11 -0
- package/dist/collections/operations/updateMany.d.ts.map +1 -0
- package/dist/collections/operations/updateMany.js +52 -0
- package/dist/collections/registry.d.ts +12 -0
- package/dist/collections/registry.d.ts.map +1 -0
- package/dist/collections/registry.js +38 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/utils.d.ts +0 -10
- package/dist/config/utils.d.ts.map +1 -1
- package/dist/config/utils.js +0 -13
- package/dist/database/index.d.ts +3 -0
- package/dist/database/index.d.ts.map +1 -1
- package/dist/database/index.js +1 -5
- package/dist/database/safe-parse.d.ts.map +1 -1
- package/dist/database/ssl-config.d.ts.map +1 -1
- package/dist/database/type-adapter.d.ts.map +1 -1
- package/dist/database/universal-postgres.d.ts.map +1 -1
- package/dist/database/universal-postgres.js +6 -1
- package/dist/dataloader.d.ts.map +1 -1
- package/dist/error-handling/circuit-breaker.d.ts +1 -1
- package/dist/error-handling/circuit-breaker.d.ts.map +1 -1
- package/dist/error-handling/circuit-breaker.js +11 -3
- package/dist/error-handling/error-boundary.d.ts.map +1 -1
- package/dist/error-handling/error-reporter.d.ts +1 -1
- package/dist/error-handling/error-reporter.d.ts.map +1 -1
- package/dist/error-handling/error-reporter.js +19 -5
- package/dist/error-handling/fallback-components.d.ts.map +1 -1
- package/dist/error-handling/fallback-components.js +1 -1
- package/dist/error-handling/index.d.ts +2 -4
- package/dist/error-handling/index.d.ts.map +1 -1
- package/dist/error-handling/index.js +1 -4
- package/dist/error-handling/retry.d.ts.map +1 -1
- package/dist/error-handling/retry.js +13 -8
- package/dist/factories/builders.d.ts.map +1 -1
- package/dist/factories/index.d.ts.map +1 -1
- package/dist/features.d.ts +0 -4
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +0 -2
- package/dist/fieldTraversal.d.ts.map +1 -1
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/getDefaultValue.d.ts.map +1 -1
- package/dist/fields/getFieldPaths.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
- package/dist/generated/types/cms.d.ts.map +1 -1
- package/dist/generated/types/cms.js +0 -1
- package/dist/generated/types/neon.d.ts.map +1 -1
- package/dist/generated/types/neon.js +4 -2
- package/dist/globals/GlobalOperations.d.ts.map +1 -1
- package/dist/globals/GlobalOperations.js +4 -2
- package/dist/globals/index.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/instance/RevealUIInstance.d.ts.map +1 -1
- package/dist/instance/RevealUIInstance.js +6 -19
- package/dist/instance/index.d.ts.map +1 -1
- package/dist/instance/logger.d.ts.map +1 -1
- package/dist/instance/methods/create.d.ts.map +1 -1
- package/dist/instance/methods/create.js +0 -3
- package/dist/instance/methods/delete.d.ts.map +1 -1
- package/dist/instance/methods/delete.js +1 -4
- package/dist/instance/methods/find.d.ts.map +1 -1
- package/dist/instance/methods/find.js +0 -3
- package/dist/instance/methods/findById.d.ts.map +1 -1
- package/dist/instance/methods/findById.js +0 -3
- package/dist/instance/methods/hooks.d.ts.map +1 -1
- package/dist/instance/methods/update.d.ts.map +1 -1
- package/dist/instance/methods/update.js +0 -3
- package/dist/jobs/index.d.ts +16 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +14 -0
- package/dist/jobs/queue.d.ts +57 -0
- package/dist/jobs/queue.d.ts.map +1 -0
- package/dist/jobs/queue.js +134 -0
- package/dist/license-encryption.d.ts +21 -0
- package/dist/license-encryption.d.ts.map +1 -0
- package/dist/license-encryption.js +74 -0
- package/dist/license.d.ts +20 -3
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +73 -6
- package/dist/monitoring/alerts.d.ts.map +1 -1
- package/dist/monitoring/cleanup-manager.d.ts.map +1 -1
- package/dist/monitoring/health-monitor.d.ts.map +1 -1
- package/dist/monitoring/index.d.ts.map +1 -1
- package/dist/monitoring/process-registry.d.ts.map +1 -1
- package/dist/monitoring/query-monitor.d.ts.map +1 -1
- package/dist/monitoring/types.d.ts.map +1 -1
- package/dist/monitoring/zombie-detector.d.ts.map +1 -1
- package/dist/monitoring/zombie-detector.js +5 -0
- package/dist/nextjs/index.d.ts.map +1 -1
- package/dist/nextjs/utilities.d.ts.map +1 -1
- package/dist/nextjs/withRevealUI.d.ts.map +1 -1
- package/dist/observability/alerts.d.ts.map +1 -1
- package/dist/observability/alerts.js +1 -2
- package/dist/observability/health-check.d.ts +0 -4
- package/dist/observability/health-check.d.ts.map +1 -1
- package/dist/observability/health-check.js +0 -36
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/logger.d.ts.map +1 -1
- package/dist/observability/logger.js +1 -1
- package/dist/observability/metrics.d.ts.map +1 -1
- package/dist/observability/tracing.d.ts.map +1 -1
- package/dist/observability/tracing.js +0 -1
- package/dist/optimization/asset-optimizer.d.ts +6 -2
- package/dist/optimization/asset-optimizer.d.ts.map +1 -1
- package/dist/optimization/asset-optimizer.js +31 -7
- package/dist/optimization/bundle-analyzer.d.ts +1 -1
- package/dist/optimization/bundle-analyzer.d.ts.map +1 -1
- package/dist/optimization/bundle-analyzer.js +29 -5
- package/dist/optimization/code-splitting.d.ts +0 -10
- package/dist/optimization/code-splitting.d.ts.map +1 -1
- package/dist/optimization/code-splitting.js +0 -16
- package/dist/plugins/form-builder.d.ts.map +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/nested-docs.d.ts +4 -0
- package/dist/plugins/nested-docs.d.ts.map +1 -1
- package/dist/plugins/nested-docs.js +50 -5
- package/dist/plugins/redirects.d.ts.map +1 -1
- package/dist/queries/index.d.ts.map +1 -1
- package/dist/queries/queryBuilder.d.ts.map +1 -1
- package/dist/queries/queryBuilder.js +9 -2
- package/dist/relationships/analyzer.d.ts.map +1 -1
- package/dist/relationships/analyzer.js +8 -0
- package/dist/relationships/index.d.ts.map +1 -1
- package/dist/relationships/populate-core.d.ts +57 -0
- package/dist/relationships/populate-core.d.ts.map +1 -0
- package/dist/relationships/populate-core.js +116 -0
- package/dist/relationships/populate-helpers.d.ts +5 -51
- package/dist/relationships/populate-helpers.d.ts.map +1 -1
- package/dist/relationships/populate-helpers.js +4 -109
- package/dist/relationships/population.d.ts +1 -9
- package/dist/relationships/population.d.ts.map +1 -1
- package/dist/relationships/population.js +8 -3
- package/dist/revealui.d.ts.map +1 -1
- package/dist/richtext/exports/client/rcc.d.ts.map +1 -1
- package/dist/richtext/exports/client/rcc.js +1 -1
- package/dist/richtext/exports/server/rsc.d.ts +17 -0
- package/dist/richtext/exports/server/rsc.d.ts.map +1 -1
- package/dist/richtext/exports/server/rsc.js +61 -5
- package/dist/richtext/index.d.ts.map +1 -1
- package/dist/richtext/lexical.d.ts.map +1 -1
- package/dist/security/audit.d.ts +1 -1
- package/dist/security/audit.d.ts.map +1 -1
- package/dist/security/audit.js +4 -2
- package/dist/security/auth.d.ts +29 -160
- package/dist/security/auth.d.ts.map +1 -1
- package/dist/security/auth.js +148 -367
- package/dist/security/authorization.d.ts +7 -31
- package/dist/security/authorization.d.ts.map +1 -1
- package/dist/security/authorization.js +72 -14
- package/dist/security/encryption.d.ts +56 -44
- package/dist/security/encryption.d.ts.map +1 -1
- package/dist/security/encryption.js +113 -96
- package/dist/security/gdpr-storage.d.ts +102 -0
- package/dist/security/gdpr-storage.d.ts.map +1 -0
- package/dist/security/gdpr-storage.js +65 -0
- package/dist/security/gdpr.d.ts +57 -37
- package/dist/security/gdpr.d.ts.map +1 -1
- package/dist/security/gdpr.js +155 -89
- package/dist/security/headers.d.ts +4 -2
- package/dist/security/headers.d.ts.map +1 -1
- package/dist/security/headers.js +35 -17
- package/dist/security/index.d.ts +3 -16
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +3 -16
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/renderPage.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -4
- package/dist/storage/vercel-blob.d.ts.map +1 -1
- package/dist/translations/index.d.ts.map +1 -1
- package/dist/types/access.d.ts.map +1 -1
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/cms.d.ts.map +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/extensions.d.ts.map +1 -1
- package/dist/types/frontend.d.ts.map +1 -1
- package/dist/types/generated.d.ts.map +1 -1
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces/app.d.ts.map +1 -1
- package/dist/types/jobs.d.ts.map +1 -1
- package/dist/types/legacy.d.ts.map +1 -1
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/query.d.ts.map +1 -1
- package/dist/types/request.d.ts.map +1 -1
- package/dist/types/richtext.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +59 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/types/user.d.ts.map +1 -1
- package/dist/utils/access-conversion.d.ts.map +1 -1
- package/dist/utils/api-wrapper.d.ts.map +1 -1
- package/dist/utils/api-wrapper.js +1 -1
- package/dist/utils/block-conversion.d.ts.map +1 -1
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/deep-clone.js +0 -1
- package/dist/utils/error-responses.d.ts.map +1 -1
- package/dist/utils/errors.d.ts +36 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +103 -0
- package/dist/utils/field-conversion.d.ts +1 -1
- package/dist/utils/field-conversion.d.ts.map +1 -1
- package/dist/utils/flattenResult.d.ts.map +1 -1
- package/dist/utils/flattenResult.js +0 -1
- package/dist/utils/getBlockSelect.d.ts.map +1 -1
- package/dist/utils/getSelectMode.d.ts.map +1 -1
- package/dist/utils/isValidID.d.ts.map +1 -1
- package/dist/utils/json-parsing.d.ts.map +1 -1
- package/dist/utils/logger-client.d.ts.map +1 -1
- package/dist/utils/logger-server.d.ts.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/request-context.d.ts.map +1 -1
- package/dist/utils/stripUnselectedFields.d.ts.map +1 -1
- package/dist/utils/type-guards.d.ts.map +1 -1
- package/package.json +39 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/ui/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/ui/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAqB9C,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAOhD,CAAC;AAGF,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAGD,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EACvC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,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,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AASD,wBAAgB,QAAQ,qBAGvB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA8BtD,CAAC;AAGF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CAC9E;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqDpD,CAAC"}
|
package/dist/client/ui/index.js
CHANGED
|
@@ -86,7 +86,7 @@ const ModalContext = React.createContext({
|
|
|
86
86
|
isModalOpen: () => false,
|
|
87
87
|
});
|
|
88
88
|
export function useModal() {
|
|
89
|
-
const context = React.
|
|
89
|
+
const context = React.use(ModalContext);
|
|
90
90
|
return context;
|
|
91
91
|
}
|
|
92
92
|
export const ModalProvider = ({ children }) => {
|
|
@@ -4,15 +4,12 @@
|
|
|
4
4
|
* Handles CRUD operations for collections with relationship population,
|
|
5
5
|
* hooks, and query building.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { BatchCreateOptions, BatchDeleteOptions, BatchResult, BatchUpdateOptions, CollectionStorageDescriptor, PopulateType, QueryableDatabaseAdapter, RevealCollectionConfig, RevealCreateOptions, RevealDeleteOptions, RevealDocument, RevealFindOptions, RevealPaginatedResult, RevealRequest, RevealUpdateOptions } from '../types/index.js';
|
|
8
8
|
export declare class RevealUICollection {
|
|
9
9
|
config: RevealCollectionConfig;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
constructor(config: RevealCollectionConfig, db: {
|
|
14
|
-
query: (query: string, values?: unknown[]) => Promise<DatabaseResult>;
|
|
15
|
-
} | null);
|
|
10
|
+
storage: CollectionStorageDescriptor | null;
|
|
11
|
+
db: QueryableDatabaseAdapter | null;
|
|
12
|
+
constructor(config: RevealCollectionConfig, db: QueryableDatabaseAdapter | null, storage?: CollectionStorageDescriptor | null);
|
|
16
13
|
find(options: RevealFindOptions): Promise<RevealPaginatedResult>;
|
|
17
14
|
findByID(options: {
|
|
18
15
|
id: string | number;
|
|
@@ -23,5 +20,8 @@ export declare class RevealUICollection {
|
|
|
23
20
|
create(options: RevealCreateOptions): Promise<RevealDocument>;
|
|
24
21
|
update(options: RevealUpdateOptions): Promise<RevealDocument>;
|
|
25
22
|
delete(options: RevealDeleteOptions): Promise<RevealDocument>;
|
|
23
|
+
createMany(options: BatchCreateOptions): Promise<BatchResult<RevealDocument>>;
|
|
24
|
+
updateMany(options: BatchUpdateOptions): Promise<BatchResult<RevealDocument>>;
|
|
25
|
+
deleteMany(options: BatchDeleteOptions): Promise<BatchResult<RevealDocument>>;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=CollectionOperations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionOperations.d.ts","sourceRoot":"","sources":["../../src/collections/CollectionOperations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"CollectionOperations.d.ts","sourceRoot":"","sources":["../../src/collections/CollectionOperations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX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@@ -5,16 +5,21 @@
|
|
|
5
5
|
* hooks, and query building.
|
|
6
6
|
*/
|
|
7
7
|
import { create } from './operations/create.js';
|
|
8
|
+
import { createMany } from './operations/createMany.js';
|
|
8
9
|
import { deleteDocument } from './operations/delete.js';
|
|
10
|
+
import { deleteMany } from './operations/deleteMany.js';
|
|
9
11
|
import { find } from './operations/find.js';
|
|
10
12
|
import { findByID } from './operations/findById.js';
|
|
11
13
|
import { update } from './operations/update.js';
|
|
14
|
+
import { updateMany } from './operations/updateMany.js';
|
|
12
15
|
export class RevealUICollection {
|
|
13
16
|
config;
|
|
17
|
+
storage;
|
|
14
18
|
db;
|
|
15
|
-
constructor(config, db) {
|
|
19
|
+
constructor(config, db, storage = null) {
|
|
16
20
|
this.config = config;
|
|
17
21
|
this.db = db;
|
|
22
|
+
this.storage = storage;
|
|
18
23
|
}
|
|
19
24
|
async find(options) {
|
|
20
25
|
return find(this.config, this.db, options);
|
|
@@ -31,4 +36,13 @@ export class RevealUICollection {
|
|
|
31
36
|
async delete(options) {
|
|
32
37
|
return deleteDocument(this.config, this.db, options);
|
|
33
38
|
}
|
|
39
|
+
async createMany(options) {
|
|
40
|
+
return createMany(this.config, this.db, options);
|
|
41
|
+
}
|
|
42
|
+
async updateMany(options) {
|
|
43
|
+
return updateMany(this.config, this.db, options);
|
|
44
|
+
}
|
|
45
|
+
async deleteMany(options) {
|
|
46
|
+
return deleteMany(this.config, this.db, options);
|
|
47
|
+
}
|
|
34
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/collections/hooks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/collections/hooks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAC9B,WAAW,CAAC,EAAE,cAAc,EAC5B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC,cAAc,CAAC,CA2CzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Creates a new document with validation, password hashing, and JSON field handling.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
export declare function create(config: RevealCollectionConfig, db:
|
|
8
|
-
query: (query: string, values?: unknown[]) => Promise<DatabaseResult>;
|
|
9
|
-
} | null, options: RevealCreateOptions): Promise<RevealDocument>;
|
|
6
|
+
import type { QueryableDatabaseAdapter, RevealCollectionConfig, RevealCreateOptions, RevealDocument } from '../../types/index.js';
|
|
7
|
+
export declare function create(config: RevealCollectionConfig, db: QueryableDatabaseAdapter | null, options: RevealCreateOptions): Promise<RevealDocument>;
|
|
10
8
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAO9B,wBAAsB,MAAM,CAC1B,MAAM,EAAE,sBAAsB,EAC9B,EAAE,EAAE,wBAAwB,GAAG,IAAI,EACnC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAoHzB"}
|
|
@@ -8,11 +8,12 @@ import { collectJsonFields, serializeValueForDatabase } from '../../utils/json-p
|
|
|
8
8
|
import { flattenFields, isJsonFieldType } from '../../utils/type-guards.js';
|
|
9
9
|
import { runBeforeFieldHooks } from './fieldHooks.js';
|
|
10
10
|
import { findByID } from './findById.js';
|
|
11
|
+
import { insertDocumentQuery } from './sqlAdapter.js';
|
|
11
12
|
export async function create(config, db, options) {
|
|
12
13
|
const { data } = options;
|
|
13
14
|
// Run beforeValidate field hooks first so they can generate values (e.g. slug from title)
|
|
14
15
|
// before the required-field check below throws for missing values.
|
|
15
|
-
await runBeforeFieldHooks(config, data, 'create', 'beforeValidate');
|
|
16
|
+
await runBeforeFieldHooks(config, data, 'create', 'beforeValidate', undefined, options.req);
|
|
16
17
|
// Validate required fields and field types
|
|
17
18
|
if (config.fields) {
|
|
18
19
|
for (const field of config.fields) {
|
|
@@ -45,13 +46,15 @@ export async function create(config, db, options) {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
// Run beforeChange field hooks after validation but before the DB write.
|
|
48
|
-
await runBeforeFieldHooks(config, data, 'create', 'beforeChange');
|
|
49
|
+
await runBeforeFieldHooks(config, data, 'create', 'beforeChange', undefined, options.req);
|
|
49
50
|
// Hash password if present and not already hashed (doesn't start with $2a$ or $2b$)
|
|
50
51
|
if (data.password && typeof data.password === 'string' && !data.password.startsWith('$2')) {
|
|
51
|
-
const saltRounds =
|
|
52
|
+
const saltRounds = 12;
|
|
52
53
|
data.password = await bcrypt.hash(data.password, saltRounds);
|
|
53
54
|
}
|
|
54
55
|
if (db?.query) {
|
|
56
|
+
// Dynamic collection storage is quarantined in sqlAdapter.ts until this
|
|
57
|
+
// layer is redesigned around typed tables that Drizzle can model directly.
|
|
55
58
|
const tableName = config.slug;
|
|
56
59
|
// Generate ID if not provided - always ensure it's a string
|
|
57
60
|
const id = String(typeof data.id === 'string' || typeof data.id === 'number'
|
|
@@ -72,7 +75,6 @@ export async function create(config, db, options) {
|
|
|
72
75
|
if (hasJsonFields) {
|
|
73
76
|
columns.push('_json');
|
|
74
77
|
}
|
|
75
|
-
const placeholders = columns.map((_, i) => `$${i + 2}`).join(', ');
|
|
76
78
|
const values = columns.map((key) => {
|
|
77
79
|
if (key === '_json') {
|
|
78
80
|
// Serialize JSON fields object to JSON string
|
|
@@ -81,7 +83,7 @@ export async function create(config, db, options) {
|
|
|
81
83
|
// Serialize non-primitive values to JSON strings for SQLite compatibility
|
|
82
84
|
return serializeValueForDatabase(data[key]);
|
|
83
85
|
});
|
|
84
|
-
const query =
|
|
86
|
+
const query = insertDocumentQuery(tableName, columns);
|
|
85
87
|
await db.query(query, [id, ...values]);
|
|
86
88
|
// For SQLite with WAL mode, writes are immediately visible to readers on the same connection
|
|
87
89
|
// Return the created document by fetching it from the database
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createMany Operation
|
|
3
|
+
*
|
|
4
|
+
* Creates multiple documents in a single transaction. All-or-nothing: if any
|
|
5
|
+
* document fails, the entire batch is rolled back. Partial results are never
|
|
6
|
+
* committed to the database.
|
|
7
|
+
*
|
|
8
|
+
* Documents without a db adapter fall back to in-memory objects (no transaction).
|
|
9
|
+
*/
|
|
10
|
+
import type { BatchCreateOptions, BatchResult, QueryableDatabaseAdapter, RevealCollectionConfig, RevealDocument } from '../../types/index.js';
|
|
11
|
+
export declare function createMany(config: RevealCollectionConfig, db: QueryableDatabaseAdapter | null, options: BatchCreateOptions): Promise<BatchResult<RevealDocument>>;
|
|
12
|
+
//# sourceMappingURL=createMany.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMany.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/createMany.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAG9B,wBAAsB,UAAU,CAC9B,MAAM,EAAE,sBAAsB,EAC9B,EAAE,EAAE,wBAAwB,GAAG,IAAI,EACnC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAiCtC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createMany Operation
|
|
3
|
+
*
|
|
4
|
+
* Creates multiple documents in a single transaction. All-or-nothing: if any
|
|
5
|
+
* document fails, the entire batch is rolled back. Partial results are never
|
|
6
|
+
* committed to the database.
|
|
7
|
+
*
|
|
8
|
+
* Documents without a db adapter fall back to in-memory objects (no transaction).
|
|
9
|
+
*/
|
|
10
|
+
import { create } from './create.js';
|
|
11
|
+
export async function createMany(config, db, options) {
|
|
12
|
+
const results = [];
|
|
13
|
+
const errors = [];
|
|
14
|
+
if (!db?.query || options.data.length === 0) {
|
|
15
|
+
// No DB or empty batch: run each create independently (no transaction available).
|
|
16
|
+
for (const [i, data] of options.data.entries()) {
|
|
17
|
+
try {
|
|
18
|
+
const doc = await create(config, db, { data, req: options.req });
|
|
19
|
+
results.push(doc);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
errors.push({ index: i, error: error instanceof Error ? error.message : String(error) });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return { results, errors };
|
|
26
|
+
}
|
|
27
|
+
// Wrap all inserts in a transaction: stop on first error, rollback on failure.
|
|
28
|
+
await db.query('BEGIN');
|
|
29
|
+
try {
|
|
30
|
+
for (const data of options.data) {
|
|
31
|
+
const doc = await create(config, db, { data, req: options.req });
|
|
32
|
+
results.push(doc);
|
|
33
|
+
}
|
|
34
|
+
await db.query('COMMIT');
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
await db.query('ROLLBACK');
|
|
38
|
+
const index = results.length; // Index of the failing item
|
|
39
|
+
errors.push({ index, error: error instanceof Error ? error.message : String(error) });
|
|
40
|
+
return { results: [], errors };
|
|
41
|
+
}
|
|
42
|
+
return { results, errors };
|
|
43
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Delete Operation
|
|
3
3
|
*
|
|
4
|
-
* Deletes a document by ID.
|
|
4
|
+
* Deletes a document by ID with access control enforcement.
|
|
5
5
|
*/
|
|
6
6
|
import type { DatabaseResult, RevealCollectionConfig, RevealDeleteOptions, RevealDocument } from '../../types/index.js';
|
|
7
7
|
export declare function deleteDocument(config: RevealCollectionConfig, db: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAoC9B,wBAAsB,cAAc,CAClC,MAAM,EAAE,sBAAsB,EAC9B,EAAE,EAAE;IACF,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACvE,GAAG,IAAI,EACR,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAoBzB"}
|
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Delete Operation
|
|
3
3
|
*
|
|
4
|
-
* Deletes a document by ID.
|
|
4
|
+
* Deletes a document by ID with access control enforcement.
|
|
5
5
|
*/
|
|
6
|
+
import { deleteByIdQuery } from './sqlAdapter.js';
|
|
7
|
+
/**
|
|
8
|
+
* Evaluate a collection's access.delete function.
|
|
9
|
+
* Returns true (allow) or false (deny).
|
|
10
|
+
*/
|
|
11
|
+
async function evaluateDeleteAccess(config, options) {
|
|
12
|
+
if (options.overrideAccess)
|
|
13
|
+
return true;
|
|
14
|
+
const accessConfig = config.access;
|
|
15
|
+
const deleteAccess = accessConfig?.delete;
|
|
16
|
+
// No access rule defined = allow all (backward compatible)
|
|
17
|
+
if (!deleteAccess)
|
|
18
|
+
return true;
|
|
19
|
+
const req = options.req;
|
|
20
|
+
if (!req)
|
|
21
|
+
return false; // No request context = deny (safe default)
|
|
22
|
+
const result = await deleteAccess({ req, id: options.id });
|
|
23
|
+
if (result === false)
|
|
24
|
+
return false;
|
|
25
|
+
// Any truthy result (true, WhereClause) = allowed for single-document operations
|
|
26
|
+
return !!result;
|
|
27
|
+
}
|
|
6
28
|
export async function deleteDocument(config, db, options) {
|
|
7
29
|
const { id } = options;
|
|
30
|
+
// --- Access control enforcement ---
|
|
31
|
+
const allowed = await evaluateDeleteAccess(config, options);
|
|
32
|
+
if (!allowed) {
|
|
33
|
+
throw new Error('Access denied: insufficient permissions to delete this document');
|
|
34
|
+
}
|
|
8
35
|
if (db?.query) {
|
|
36
|
+
// Dynamic collection storage is quarantined in sqlAdapter.ts until this
|
|
37
|
+
// layer is redesigned around typed tables that Drizzle can model directly.
|
|
9
38
|
const tableName = config.slug;
|
|
10
39
|
// Ensure id is a string for consistent comparison
|
|
11
40
|
const idString = String(id);
|
|
12
|
-
const query =
|
|
41
|
+
const query = deleteByIdQuery(tableName);
|
|
13
42
|
await db.query(query, [idString]);
|
|
14
43
|
}
|
|
15
44
|
return { id };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* deleteMany Operation
|
|
3
|
+
*
|
|
4
|
+
* Deletes multiple documents in a single transaction. All-or-nothing: if any
|
|
5
|
+
* delete fails (including access denial), the entire batch is rolled back.
|
|
6
|
+
*
|
|
7
|
+
* Documents without a db adapter fall back to in-memory stubs (no transaction).
|
|
8
|
+
*/
|
|
9
|
+
import type { BatchDeleteOptions, BatchResult, QueryableDatabaseAdapter, RevealCollectionConfig, RevealDocument } from '../../types/index.js';
|
|
10
|
+
export declare function deleteMany(config: RevealCollectionConfig, db: QueryableDatabaseAdapter | null, options: BatchDeleteOptions): Promise<BatchResult<RevealDocument>>;
|
|
11
|
+
//# sourceMappingURL=deleteMany.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteMany.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/deleteMany.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,wBAAwB,EACxB,sBAAsB,EACtB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAG9B,wBAAsB,UAAU,CAC9B,MAAM,EAAE,sBAAsB,EAC9B,EAAE,EAAE,wBAAwB,GAAG,IAAI,EACnC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAyCtC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* deleteMany Operation
|
|
3
|
+
*
|
|
4
|
+
* Deletes multiple documents in a single transaction. All-or-nothing: if any
|
|
5
|
+
* delete fails (including access denial), the entire batch is rolled back.
|
|
6
|
+
*
|
|
7
|
+
* Documents without a db adapter fall back to in-memory stubs (no transaction).
|
|
8
|
+
*/
|
|
9
|
+
import { deleteDocument } from './delete.js';
|
|
10
|
+
export async function deleteMany(config, db, options) {
|
|
11
|
+
const results = [];
|
|
12
|
+
const errors = [];
|
|
13
|
+
if (!db?.query || options.ids.length === 0) {
|
|
14
|
+
// No DB or empty batch: run each delete independently (no transaction available).
|
|
15
|
+
for (const [i, id] of options.ids.entries()) {
|
|
16
|
+
try {
|
|
17
|
+
const doc = await deleteDocument(config, db, {
|
|
18
|
+
id,
|
|
19
|
+
req: options.req,
|
|
20
|
+
overrideAccess: options.overrideAccess,
|
|
21
|
+
});
|
|
22
|
+
results.push(doc);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
errors.push({ index: i, error: error instanceof Error ? error.message : String(error) });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return { results, errors };
|
|
29
|
+
}
|
|
30
|
+
// Wrap all deletes in a transaction: stop on first error, rollback on failure.
|
|
31
|
+
await db.query('BEGIN');
|
|
32
|
+
try {
|
|
33
|
+
for (const id of options.ids) {
|
|
34
|
+
const doc = await deleteDocument(config, db, {
|
|
35
|
+
id,
|
|
36
|
+
req: options.req,
|
|
37
|
+
overrideAccess: options.overrideAccess,
|
|
38
|
+
});
|
|
39
|
+
results.push(doc);
|
|
40
|
+
}
|
|
41
|
+
await db.query('COMMIT');
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
await db.query('ROLLBACK');
|
|
45
|
+
const index = results.length; // Index of the failing item
|
|
46
|
+
errors.push({ index, error: error instanceof Error ? error.message : String(error) });
|
|
47
|
+
return { results: [], errors };
|
|
48
|
+
}
|
|
49
|
+
return { results, errors };
|
|
50
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Mutates the data object in-place, mirroring the password-hashing pattern already used
|
|
6
6
|
* by create.ts and update.ts.
|
|
7
7
|
*/
|
|
8
|
-
import type { RevealCollectionConfig, RevealDocument } from '../../types/index.js';
|
|
8
|
+
import type { RevealCollectionConfig, RevealDocument, RevealRequest } from '../../types/index.js';
|
|
9
9
|
/**
|
|
10
10
|
* Executes all hooks of `hookType` for every field in the collection that has them.
|
|
11
11
|
*
|
|
@@ -17,5 +17,5 @@ import type { RevealCollectionConfig, RevealDocument } from '../../types/index.j
|
|
|
17
17
|
* (e.g. slug auto-generation from title) that satisfy required constraints.
|
|
18
18
|
* 2. `beforeChange` — after validation, before the DB write.
|
|
19
19
|
*/
|
|
20
|
-
export declare function runBeforeFieldHooks(config: RevealCollectionConfig, data: Record<string, unknown>, operation: 'create' | 'update', hookType: 'beforeValidate' | 'beforeChange', originalDoc?: RevealDocument): Promise<void>;
|
|
20
|
+
export declare function runBeforeFieldHooks(config: RevealCollectionConfig, data: Record<string, unknown>, operation: 'create' | 'update', hookType: 'beforeValidate' | 'beforeChange', originalDoc?: RevealDocument, req?: RevealRequest): Promise<void>;
|
|
21
21
|
//# sourceMappingURL=fieldHooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldHooks.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/fieldHooks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"fieldHooks.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/fieldHooks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGlG;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,sBAAsB,EAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAC9B,QAAQ,EAAE,gBAAgB,GAAG,cAAc,EAC3C,WAAW,CAAC,EAAE,cAAc,EAC5B,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAAC,IAAI,CAAC,CA6Cf"}
|
|
@@ -17,7 +17,7 @@ import { flattenFields } from '../../utils/type-guards.js';
|
|
|
17
17
|
* (e.g. slug auto-generation from title) that satisfy required constraints.
|
|
18
18
|
* 2. `beforeChange` — after validation, before the DB write.
|
|
19
19
|
*/
|
|
20
|
-
export async function runBeforeFieldHooks(config, data, operation, hookType, originalDoc) {
|
|
20
|
+
export async function runBeforeFieldHooks(config, data, operation, hookType, originalDoc, req) {
|
|
21
21
|
const fields = flattenFields(config.fields || []);
|
|
22
22
|
for (const field of fields) {
|
|
23
23
|
if (!field.name)
|
|
@@ -28,13 +28,13 @@ export async function runBeforeFieldHooks(config, data, operation, hookType, ori
|
|
|
28
28
|
let value = data[field.name];
|
|
29
29
|
for (const hook of hooks) {
|
|
30
30
|
// Hooks in this codebase receive the contract-defined FieldBeforeChangeHookArgs.
|
|
31
|
-
// req
|
|
32
|
-
//
|
|
31
|
+
// Thread req from the caller when available; fall back to an empty object
|
|
32
|
+
// for backward compatibility with call sites that don't provide it yet.
|
|
33
33
|
value = await hook({
|
|
34
34
|
value,
|
|
35
35
|
data,
|
|
36
36
|
siblingData: data,
|
|
37
|
-
req: {},
|
|
37
|
+
req: req ?? {},
|
|
38
38
|
operation,
|
|
39
39
|
originalDoc,
|
|
40
40
|
context: {},
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Finds multiple documents with pagination, filtering, sorting, and relationship population.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
export declare function find(config: RevealCollectionConfig, db:
|
|
8
|
-
query: (query: string, values?: unknown[]) => Promise<DatabaseResult>;
|
|
9
|
-
} | null, options: RevealFindOptions): Promise<RevealPaginatedResult>;
|
|
6
|
+
import type { QueryableDatabaseAdapter, RevealCollectionConfig, RevealFindOptions, RevealPaginatedResult } from '../../types/index.js';
|
|
7
|
+
export declare function find(config: RevealCollectionConfig, db: QueryableDatabaseAdapter | null, options: RevealFindOptions): Promise<RevealPaginatedResult>;
|
|
10
8
|
//# sourceMappingURL=find.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/find.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/collections/operations/find.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAEV,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EAItB,MAAM,sBAAsB,CAAC;AAiC9B,wBAAsB,IAAI,CACxB,MAAM,EAAE,sBAAsB,EAC9B,EAAE,EAAE,wBAAwB,GAAG,IAAI,EACnC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,qBAAqB,CAAC,CAgPhC"}
|
|
@@ -6,29 +6,138 @@
|
|
|
6
6
|
import { afterRead } from '../../fields/hooks/afterRead/index.js';
|
|
7
7
|
import { buildWhereClause } from '../../queries/queryBuilder.js';
|
|
8
8
|
import { deserializeJsonFields } from '../../utils/json-parsing.js';
|
|
9
|
+
import { countDocumentsQuery, escapeIdentifier, listDocumentsQuery } from './sqlAdapter.js';
|
|
10
|
+
/**
|
|
11
|
+
* Evaluate a collection's access.read function.
|
|
12
|
+
* Returns true (allow all), false (deny all), or a WhereClause to merge into the query.
|
|
13
|
+
*/
|
|
14
|
+
async function evaluateReadAccess(config, options) {
|
|
15
|
+
// If overrideAccess is explicitly set, skip access checks (caller already validated permission)
|
|
16
|
+
if (options.overrideAccess)
|
|
17
|
+
return true;
|
|
18
|
+
const accessConfig = config
|
|
19
|
+
.access;
|
|
20
|
+
const readAccess = accessConfig?.read;
|
|
21
|
+
// No access rule defined = allow all (backward compatible)
|
|
22
|
+
if (!readAccess)
|
|
23
|
+
return true;
|
|
24
|
+
const req = options.req;
|
|
25
|
+
if (!req)
|
|
26
|
+
return false; // No request context = deny (safe default)
|
|
27
|
+
const result = await readAccess({ req });
|
|
28
|
+
if (typeof result === 'boolean')
|
|
29
|
+
return result;
|
|
30
|
+
// WhereClause returned = row-level filtering (e.g. { author: { equals: user.id } })
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
9
33
|
export async function find(config, db, options) {
|
|
10
34
|
const { where, limit = 10, page = 1, sort, depth = 0, req, populate: populateOption } = options;
|
|
11
35
|
// Validate depth
|
|
12
36
|
if (depth < 0 || depth > 3) {
|
|
13
37
|
throw new Error(`Depth must be between 0 and 3, got ${depth}`);
|
|
14
38
|
}
|
|
39
|
+
// --- Access control enforcement ---
|
|
40
|
+
const accessResult = await evaluateReadAccess(config, options);
|
|
41
|
+
if (accessResult === false) {
|
|
42
|
+
// Deny: return empty result set (same shape as a normal response)
|
|
43
|
+
return {
|
|
44
|
+
docs: [],
|
|
45
|
+
totalDocs: 0,
|
|
46
|
+
limit,
|
|
47
|
+
totalPages: 0,
|
|
48
|
+
page,
|
|
49
|
+
pagingCounter: 0,
|
|
50
|
+
hasPrevPage: false,
|
|
51
|
+
hasNextPage: false,
|
|
52
|
+
prevPage: null,
|
|
53
|
+
nextPage: null,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// Merge access-control WhereClause with user-provided where filter
|
|
57
|
+
const mergedWhere = accessResult === true ? where : where ? { and: [where, accessResult] } : accessResult;
|
|
58
|
+
// Replace where in options for downstream use.
|
|
59
|
+
// When access returned a WhereClause (not just boolean true), set overrideAccess: true
|
|
60
|
+
// to prevent infinite recursion if collectionStorage.find re-invokes this function.
|
|
61
|
+
const accessOptions = accessResult === true
|
|
62
|
+
? { ...options, where: mergedWhere }
|
|
63
|
+
: { ...options, where: mergedWhere, overrideAccess: true };
|
|
64
|
+
if (db?.collectionStorage?.find) {
|
|
65
|
+
const result = await db.collectionStorage.find(config, accessOptions);
|
|
66
|
+
if (result !== undefined) {
|
|
67
|
+
if (req && depth > 0) {
|
|
68
|
+
const sanitizedConfig = {
|
|
69
|
+
...config,
|
|
70
|
+
fields: config.fields,
|
|
71
|
+
flattenedFields: config.fields,
|
|
72
|
+
endpoints: config.endpoints === false ? undefined : config.endpoints,
|
|
73
|
+
};
|
|
74
|
+
const docs = await Promise.all(result.docs.map(async (doc) => {
|
|
75
|
+
return await afterRead({
|
|
76
|
+
collection: sanitizedConfig,
|
|
77
|
+
context: req.context || {},
|
|
78
|
+
currentDepth: 1,
|
|
79
|
+
depth,
|
|
80
|
+
doc,
|
|
81
|
+
draft: false,
|
|
82
|
+
fallbackLocale: req.fallbackLocale || 'en',
|
|
83
|
+
findMany: true,
|
|
84
|
+
flattenLocales: true,
|
|
85
|
+
global: null,
|
|
86
|
+
locale: req.locale || 'en',
|
|
87
|
+
overrideAccess: false,
|
|
88
|
+
populate: populateOption,
|
|
89
|
+
req,
|
|
90
|
+
select: undefined,
|
|
91
|
+
showHiddenFields: false,
|
|
92
|
+
});
|
|
93
|
+
}));
|
|
94
|
+
return {
|
|
95
|
+
...result,
|
|
96
|
+
docs,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
15
102
|
// Build query based on database adapter
|
|
16
103
|
if (db?.query) {
|
|
104
|
+
// Dynamic collection storage is quarantined in sqlAdapter.ts until this
|
|
105
|
+
// layer is redesigned around typed tables that Drizzle can model directly.
|
|
17
106
|
const offset = (page - 1) * limit;
|
|
18
107
|
const tableName = config.slug;
|
|
19
|
-
// Build WHERE clause using query builder
|
|
108
|
+
// Build WHERE clause using query builder (uses access-merged where)
|
|
20
109
|
const params = [];
|
|
21
|
-
const whereClause = buildWhereClause(
|
|
110
|
+
const whereClause = buildWhereClause(mergedWhere, params, {
|
|
22
111
|
parameterStyle: 'postgres',
|
|
23
112
|
includeWhereKeyword: false,
|
|
24
113
|
quoteFields: true,
|
|
25
114
|
});
|
|
26
|
-
// Build ORDER BY clause
|
|
115
|
+
// Build ORDER BY clause with field name validation
|
|
27
116
|
let orderByClause = '';
|
|
28
117
|
if (sort) {
|
|
118
|
+
// Build allowlist from collection fields + common system columns
|
|
119
|
+
const allowedFields = new Set([
|
|
120
|
+
'id',
|
|
121
|
+
'createdAt',
|
|
122
|
+
'updatedAt',
|
|
123
|
+
'created_at',
|
|
124
|
+
'updated_at',
|
|
125
|
+
'_json',
|
|
126
|
+
]);
|
|
127
|
+
if (config.fields) {
|
|
128
|
+
for (const field of config.fields) {
|
|
129
|
+
if (field.name)
|
|
130
|
+
allowedFields.add(field.name);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
29
133
|
const sortConditions = [];
|
|
30
134
|
Object.entries(sort).forEach(([key, direction]) => {
|
|
31
|
-
|
|
135
|
+
if (!allowedFields.has(key)) {
|
|
136
|
+
throw new Error(`Invalid sort field: "${key}". Must be a defined field on the "${tableName}" collection.`);
|
|
137
|
+
}
|
|
138
|
+
// Escape embedded double quotes in identifier to prevent SQL injection
|
|
139
|
+
const escaped = escapeIdentifier(key);
|
|
140
|
+
sortConditions.push(`"${escaped}" ${direction === '-1' ? 'DESC' : 'ASC'}`);
|
|
32
141
|
});
|
|
33
142
|
orderByClause = sortConditions.length > 0 ? `ORDER BY ${sortConditions.join(', ')}` : '';
|
|
34
143
|
}
|
|
@@ -38,9 +147,7 @@ export async function find(config, db, options) {
|
|
|
38
147
|
if (whereClause?.trim().toUpperCase().startsWith('WHERE')) {
|
|
39
148
|
throw new Error(`WHERE clause unexpectedly starts with "WHERE" keyword. This indicates a bug in buildWhereClause. Clause: ${whereClause}`);
|
|
40
149
|
}
|
|
41
|
-
const countQuery = whereClause
|
|
42
|
-
? `SELECT COUNT(*) as total FROM "${tableName}" WHERE ${whereClause}`
|
|
43
|
-
: `SELECT COUNT(*) as total FROM "${tableName}"`;
|
|
150
|
+
const countQuery = countDocumentsQuery(tableName, whereClause);
|
|
44
151
|
const countResult = await db.query(countQuery, params);
|
|
45
152
|
const totalDocs = Number(countResult.rows[0]?.total) || 0;
|
|
46
153
|
// Execute data query (PostgreSQL uses $1, $2 for parameters)
|
|
@@ -59,7 +166,7 @@ export async function find(config, db, options) {
|
|
|
59
166
|
}
|
|
60
167
|
const limitParam = params.length + 1;
|
|
61
168
|
const offsetParam = params.length + 2;
|
|
62
|
-
const dataQuery =
|
|
169
|
+
const dataQuery = listDocumentsQuery(tableName, whereClause, orderByClause, limitParam, offsetParam);
|
|
63
170
|
const docsResult = await db.query(dataQuery, [...params, limit, offset]);
|
|
64
171
|
let docs = docsResult.rows.map((row) => {
|
|
65
172
|
return deserializeJsonFields(row, tableName);
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Finds a single document by ID with optional relationship population.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
export declare function findByID(config: RevealCollectionConfig, db: {
|
|
8
|
-
query: (query: string, values?: unknown[]) => Promise<DatabaseResult>;
|
|
9
|
-
} | null, options: {
|
|
6
|
+
import type { PopulateType, QueryableDatabaseAdapter, RevealCollectionConfig, RevealDocument, RevealRequest } from '../../types/index.js';
|
|
7
|
+
export declare function findByID(config: RevealCollectionConfig, db: QueryableDatabaseAdapter | null, options: {
|
|
10
8
|
id: string | number;
|
|
11
9
|
depth?: number;
|
|
12
10
|
req?: RevealRequest;
|
|
13
11
|
populate?: PopulateType;
|
|
12
|
+
overrideAccess?: boolean;
|
|
14
13
|
}): Promise<RevealDocument | null>;
|
|
15
14
|
//# sourceMappingURL=findById.d.ts.map
|