@revealui/core 0.2.0 → 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/README.md +137 -30
- 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 +30 -29
- package/dist/api/rate-limit.d.ts.map +1 -1
- package/dist/api/rate-limit.js +79 -4
- 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 +5 -4
- 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 +2 -2
- package/dist/caching/cdn-config.d.ts.map +1 -1
- package/dist/caching/cdn-config.js +5 -15
- 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 +44 -11
- 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 +10 -18
- package/dist/caching/service-worker.d.ts.map +1 -1
- package/dist/caching/service-worker.js +5 -4
- 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/auth.d.ts +0 -4
- package/dist/client/admin/utils/auth.d.ts.map +1 -1
- package/dist/client/admin/utils/auth.js +0 -6
- 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 +0 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +0 -2
- 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 +9 -7
- 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 +18 -17
- 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 +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.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 +18 -13
- package/dist/dataloader.d.ts.map +1 -1
- package/dist/dataloader.js +16 -2
- 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 +6 -5
- package/dist/error-handling/error-reporter.d.ts.map +1 -1
- package/dist/error-handling/error-reporter.js +26 -41
- 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 +3 -5
- package/dist/error-handling/index.d.ts.map +1 -1
- package/dist/error-handling/index.js +2 -5
- 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 +5 -5
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +6 -5
- 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/index.d.ts +0 -3
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +0 -7
- 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 -6
- package/dist/instance/RevealUIInstance.d.ts.map +1 -1
- package/dist/instance/RevealUIInstance.js +50 -69
- 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 +4 -4
- package/dist/instance/methods/delete.d.ts.map +1 -1
- package/dist/instance/methods/delete.js +5 -5
- 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/hooks.js +3 -1
- package/dist/instance/methods/update.d.ts.map +1 -1
- package/dist/instance/methods/update.js +4 -4
- 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 +33 -7
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +119 -16
- 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 +1 -5
- package/dist/observability/health-check.d.ts.map +1 -1
- package/dist/observability/health-check.js +37 -43
- 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 -23
- package/dist/optimization/code-splitting.d.ts.map +1 -1
- package/dist/optimization/code-splitting.js +0 -29
- 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 +15 -5
- 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 +150 -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 +128 -100
- 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 -94
- 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 +0 -2
- package/dist/types/generated.d.ts.map +1 -1
- package/dist/types/generated.js +0 -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 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursorsOverlayPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/CursorsOverlayPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"CursorsOverlayPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/CursorsOverlayPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAO1D,wBAAgB,+BAA+B,CAC7C,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACpD,qBAAqB,CA2BvB;AAED,wBAAgB,yBAAyB,CACvC,mBAAmB,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACvD,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2BtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingToolbarPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/FloatingToolbarPlugin.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"FloatingToolbarPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/FloatingToolbarPlugin.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA4ClE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B,sCA+Y7E;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/ImagePlugin.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"ImagePlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/ImagePlugin.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAgF/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/ToolbarPlugin.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../../../../src/client/richtext/plugins/ToolbarPlugin.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAsClE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC3C;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAiB,EAAE,EAAE,kBAAkB,kDA4ZhF;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -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;CA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AG,CAAC,MAAM,CAAC,CAAC;IACxB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,CAAC,IAAI,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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c,CAAC,CAAC;IAI7E,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;CAGpF"}
|
|
@@ -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,18 +46,20 @@ 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'
|
|
58
61
|
? data.id
|
|
59
|
-
: `rvl_${
|
|
62
|
+
: `rvl_${crypto.randomUUID()}`);
|
|
60
63
|
// Build INSERT query (PostgreSQL uses $1, $2 style)
|
|
61
64
|
// Serialize complex values (objects, arrays) to JSON strings for SQLite
|
|
62
65
|
// Filter out fields that should be stored as JSON (not as columns)
|
|
@@ -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
|
|
@@ -96,6 +98,6 @@ export async function create(config, db, options) {
|
|
|
96
98
|
// Fallback
|
|
97
99
|
const id = typeof data.id === 'string' || typeof data.id === 'number'
|
|
98
100
|
? data.id
|
|
99
|
-
: `rvl_${
|
|
101
|
+
: `rvl_${crypto.randomUUID()}`;
|
|
100
102
|
return { ...data, id };
|
|
101
103
|
}
|
|
@@ -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"}
|