@revealui/core 0.2.1 → 0.5.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/index.d.ts +6 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +5 -0
- 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 +195 -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/FloatingToolbarPlugin.js +1 -3
- 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 +4 -5
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +35 -6
- 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/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/factories/builders.d.ts.map +1 -1
- package/dist/factories/index.d.ts.map +1 -1
- package/dist/features.d.ts +7 -7
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +2 -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 +16 -4
- package/dist/globals/index.d.ts.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -5
- 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 +26 -3
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +87 -7
- package/dist/monitoring/alerts.d.ts +4 -4
- 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/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 -6
- 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 +13 -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/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/storage/vercel-blob.js +3 -0
- 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 +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 +60 -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/error-responses.js +2 -3
- 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 +58 -26
- package/dist/caching/app-cache.d.ts +0 -237
- package/dist/caching/app-cache.d.ts.map +0 -1
- package/dist/caching/app-cache.js +0 -430
- package/dist/caching/cdn-config.d.ts +0 -155
- package/dist/caching/cdn-config.d.ts.map +0 -1
- package/dist/caching/cdn-config.js +0 -411
- package/dist/caching/edge-cache.d.ts +0 -177
- package/dist/caching/edge-cache.d.ts.map +0 -1
- package/dist/caching/edge-cache.js +0 -385
- package/dist/caching/service-worker.d.ts +0 -154
- package/dist/caching/service-worker.d.ts.map +0 -1
- package/dist/caching/service-worker.js +0 -437
- package/dist/client/admin/utils/auth.d.ts +0 -23
- package/dist/client/admin/utils/auth.d.ts.map +0 -1
- package/dist/client/admin/utils/auth.js +0 -52
- package/dist/client/http/client.d.ts +0 -15
- package/dist/client/http/client.d.ts.map +0 -1
- package/dist/client/http/client.js +0 -49
- package/dist/client/http/fetchBanner.d.ts +0 -18
- package/dist/client/http/fetchBanner.d.ts.map +0 -1
- package/dist/client/http/fetchBanner.js +0 -44
- package/dist/client/http/fetchCard.d.ts +0 -18
- package/dist/client/http/fetchCard.d.ts.map +0 -1
- package/dist/client/http/fetchCard.js +0 -46
- package/dist/client/http/fetchEvents.d.ts +0 -18
- package/dist/client/http/fetchEvents.d.ts.map +0 -1
- package/dist/client/http/fetchEvents.js +0 -44
- package/dist/client/http/fetchHero.d.ts +0 -17
- package/dist/client/http/fetchHero.d.ts.map +0 -1
- package/dist/client/http/fetchHero.js +0 -55
- package/dist/client/http/fetchMainInfos.d.ts +0 -17
- package/dist/client/http/fetchMainInfos.d.ts.map +0 -1
- package/dist/client/http/fetchMainInfos.js +0 -44
- package/dist/client/http/fetchVideos.d.ts +0 -13
- package/dist/client/http/fetchVideos.d.ts.map +0 -1
- package/dist/client/http/fetchVideos.js +0 -36
- package/dist/client/http/index.d.ts +0 -19
- package/dist/client/http/index.d.ts.map +0 -1
- package/dist/client/http/index.js +0 -11
- package/dist/error-handling/circuit-breaker.d.ts +0 -262
- package/dist/error-handling/circuit-breaker.d.ts.map +0 -1
- package/dist/error-handling/circuit-breaker.js +0 -542
- package/dist/error-handling/retry.d.ts +0 -194
- package/dist/error-handling/retry.d.ts.map +0 -1
- package/dist/error-handling/retry.js +0 -450
- package/dist/errors/index.d.ts +0 -23
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js +0 -40
- package/dist/generated/agents/index.d.ts +0 -8
- package/dist/generated/agents/index.d.ts.map +0 -1
- package/dist/generated/agents/index.js +0 -7
- package/dist/generated/components/index.d.ts +0 -8
- package/dist/generated/components/index.d.ts.map +0 -1
- package/dist/generated/components/index.js +0 -7
- package/dist/generated/functions/index.d.ts +0 -8
- package/dist/generated/functions/index.d.ts.map +0 -1
- package/dist/generated/functions/index.js +0 -7
- package/dist/generated/hooks/index.d.ts +0 -8
- package/dist/generated/hooks/index.d.ts.map +0 -1
- package/dist/generated/hooks/index.js +0 -7
- package/dist/generated/plans/index.d.ts +0 -8
- package/dist/generated/plans/index.d.ts.map +0 -1
- package/dist/generated/plans/index.js +0 -7
- package/dist/generated/prompts/index.d.ts +0 -8
- package/dist/generated/prompts/index.d.ts.map +0 -1
- package/dist/generated/prompts/index.js +0 -7
- package/dist/generated/tools/index.d.ts +0 -8
- package/dist/generated/tools/index.d.ts.map +0 -1
- package/dist/generated/tools/index.js +0 -7
- package/dist/generated/types/supabase.d.ts +0 -193
- package/dist/generated/types/supabase.d.ts.map +0 -1
- package/dist/generated/types/supabase.js +0 -5
- package/dist/optimization/asset-optimizer.d.ts +0 -202
- package/dist/optimization/asset-optimizer.d.ts.map +0 -1
- package/dist/optimization/asset-optimizer.js +0 -312
- package/dist/optimization/build-optimizer.d.ts +0 -202
- package/dist/optimization/build-optimizer.d.ts.map +0 -1
- package/dist/optimization/build-optimizer.js +0 -271
- package/dist/optimization/bundle-analyzer.d.ts +0 -98
- package/dist/optimization/bundle-analyzer.d.ts.map +0 -1
- package/dist/optimization/bundle-analyzer.js +0 -322
- package/dist/optimization/code-splitting.d.ts +0 -131
- package/dist/optimization/code-splitting.d.ts.map +0 -1
- package/dist/optimization/code-splitting.js +0 -277
- package/dist/plugin/index.d.ts +0 -12
- package/dist/plugin/index.d.ts.map +0 -1
- package/dist/plugin/index.js +0 -4
- package/dist/security/audit.d.ts +0 -188
- package/dist/security/audit.d.ts.map +0 -1
- package/dist/security/audit.js +0 -431
- package/dist/security/auth.d.ts +0 -241
- package/dist/security/auth.d.ts.map +0 -1
- package/dist/security/auth.js +0 -476
- package/dist/security/authorization.d.ts +0 -235
- package/dist/security/authorization.d.ts.map +0 -1
- package/dist/security/authorization.js +0 -434
- package/dist/security/encryption.d.ts +0 -214
- package/dist/security/encryption.d.ts.map +0 -1
- package/dist/security/encryption.js +0 -517
- package/dist/security/gdpr.d.ts +0 -300
- package/dist/security/gdpr.d.ts.map +0 -1
- package/dist/security/gdpr.js +0 -465
- package/dist/security/headers.d.ts +0 -182
- package/dist/security/headers.d.ts.map +0 -1
- package/dist/security/headers.js +0 -402
- package/dist/utils/jwt-validation.d.ts +0 -14
- package/dist/utils/jwt-validation.d.ts.map +0 -1
- package/dist/utils/jwt-validation.js +0 -36
- package/dist/utils/request-headers.d.ts +0 -15
- package/dist/utils/request-headers.d.ts.map +0 -1
- package/dist/utils/request-headers.js +0 -31
package/dist/security/gdpr.js
DELETED
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GDPR Compliance Utilities
|
|
3
|
-
*
|
|
4
|
-
* Data privacy, consent management, data export, and right to be forgotten
|
|
5
|
-
*/
|
|
6
|
-
import { createHash } from 'node:crypto';
|
|
7
|
-
import { logger } from '../observability/logger.js';
|
|
8
|
-
/**
|
|
9
|
-
* Consent management system
|
|
10
|
-
*/
|
|
11
|
-
export class ConsentManager {
|
|
12
|
-
consents = new Map();
|
|
13
|
-
consentVersion = '1.0.0';
|
|
14
|
-
/**
|
|
15
|
-
* Grant consent
|
|
16
|
-
*/
|
|
17
|
-
async grantConsent(userId, type, source = 'explicit', expiresIn) {
|
|
18
|
-
const consent = {
|
|
19
|
-
id: crypto.randomUUID(),
|
|
20
|
-
userId,
|
|
21
|
-
type,
|
|
22
|
-
granted: true,
|
|
23
|
-
timestamp: new Date().toISOString(),
|
|
24
|
-
expiresAt: expiresIn ? new Date(Date.now() + expiresIn).toISOString() : undefined,
|
|
25
|
-
source,
|
|
26
|
-
version: this.consentVersion,
|
|
27
|
-
};
|
|
28
|
-
this.consents.set(`${userId}:${type}`, consent);
|
|
29
|
-
return consent;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Revoke consent
|
|
33
|
-
*/
|
|
34
|
-
async revokeConsent(userId, type) {
|
|
35
|
-
const key = `${userId}:${type}`;
|
|
36
|
-
const existing = this.consents.get(key);
|
|
37
|
-
if (existing) {
|
|
38
|
-
existing.granted = false;
|
|
39
|
-
existing.timestamp = new Date().toISOString();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Check if consent is granted
|
|
44
|
-
*/
|
|
45
|
-
hasConsent(userId, type) {
|
|
46
|
-
const consent = this.consents.get(`${userId}:${type}`);
|
|
47
|
-
if (!consent?.granted) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
// Check if expired
|
|
51
|
-
if (consent.expiresAt && new Date(consent.expiresAt) < new Date()) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get all consents for user
|
|
58
|
-
*/
|
|
59
|
-
getUserConsents(userId) {
|
|
60
|
-
return Array.from(this.consents.values()).filter((c) => c.userId === userId);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Update consent version
|
|
64
|
-
*/
|
|
65
|
-
setConsentVersion(version) {
|
|
66
|
-
this.consentVersion = version;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Check if consent needs renewal
|
|
70
|
-
*/
|
|
71
|
-
needsRenewal(userId, type, maxAge) {
|
|
72
|
-
const consent = this.consents.get(`${userId}:${type}`);
|
|
73
|
-
if (!consent?.granted) {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
const age = Date.now() - new Date(consent.timestamp).getTime();
|
|
77
|
-
return age >= maxAge;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get consent statistics
|
|
81
|
-
*/
|
|
82
|
-
getStatistics() {
|
|
83
|
-
const consents = Array.from(this.consents.values());
|
|
84
|
-
const now = new Date();
|
|
85
|
-
const granted = consents.filter((c) => c.granted).length;
|
|
86
|
-
const revoked = consents.filter((c) => !c.granted).length;
|
|
87
|
-
const expired = consents.filter((c) => c.expiresAt && new Date(c.expiresAt) < now).length;
|
|
88
|
-
const byType = consents.reduce((acc, c) => {
|
|
89
|
-
acc[c.type] = (acc[c.type] || 0) + 1;
|
|
90
|
-
return acc;
|
|
91
|
-
}, {});
|
|
92
|
-
return {
|
|
93
|
-
total: consents.length,
|
|
94
|
-
granted,
|
|
95
|
-
revoked,
|
|
96
|
-
expired,
|
|
97
|
-
byType,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Data export system
|
|
103
|
-
*/
|
|
104
|
-
export class DataExportSystem {
|
|
105
|
-
/**
|
|
106
|
-
* Export user data
|
|
107
|
-
*/
|
|
108
|
-
async exportUserData(userId, getUserData, format = 'json') {
|
|
109
|
-
const data = await getUserData(userId);
|
|
110
|
-
const exportData = {
|
|
111
|
-
userId,
|
|
112
|
-
exportedAt: new Date().toISOString(),
|
|
113
|
-
data: {
|
|
114
|
-
profile: data.profile,
|
|
115
|
-
activities: data.activities,
|
|
116
|
-
consents: data.consents,
|
|
117
|
-
dataProcessing: [],
|
|
118
|
-
},
|
|
119
|
-
format,
|
|
120
|
-
};
|
|
121
|
-
return exportData;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Format export as JSON
|
|
125
|
-
*/
|
|
126
|
-
formatAsJSON(exportData) {
|
|
127
|
-
return JSON.stringify(exportData, null, 2);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Format export as CSV
|
|
131
|
-
*/
|
|
132
|
-
formatAsCSV(exportData) {
|
|
133
|
-
const lines = [];
|
|
134
|
-
// Profile data
|
|
135
|
-
lines.push('Type,Key,Value');
|
|
136
|
-
Object.entries(exportData.data.profile).forEach(([key, value]) => {
|
|
137
|
-
lines.push(`Profile,${key},"${value}"`);
|
|
138
|
-
});
|
|
139
|
-
// Activities
|
|
140
|
-
exportData.data.activities.forEach((activity, index) => {
|
|
141
|
-
Object.entries(activity).forEach(([key, value]) => {
|
|
142
|
-
lines.push(`Activity ${index + 1},${key},"${value}"`);
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
return lines.join('\n');
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Create download link
|
|
149
|
-
*/
|
|
150
|
-
createDownloadLink(content, _filename, mimeType) {
|
|
151
|
-
const blob = new Blob([content], { type: mimeType });
|
|
152
|
-
return URL.createObjectURL(blob);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Data deletion system (Right to be Forgotten)
|
|
157
|
-
*/
|
|
158
|
-
export class DataDeletionSystem {
|
|
159
|
-
requests = new Map();
|
|
160
|
-
/**
|
|
161
|
-
* Request data deletion
|
|
162
|
-
*/
|
|
163
|
-
async requestDeletion(userId, dataCategories, reason) {
|
|
164
|
-
const request = {
|
|
165
|
-
id: crypto.randomUUID(),
|
|
166
|
-
userId,
|
|
167
|
-
requestedAt: new Date().toISOString(),
|
|
168
|
-
status: 'pending',
|
|
169
|
-
dataCategories,
|
|
170
|
-
reason,
|
|
171
|
-
};
|
|
172
|
-
this.requests.set(request.id, request);
|
|
173
|
-
return request;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Process deletion request
|
|
177
|
-
*/
|
|
178
|
-
async processDeletion(requestId, deleteData) {
|
|
179
|
-
const request = this.requests.get(requestId);
|
|
180
|
-
if (!request) {
|
|
181
|
-
throw new Error('Deletion request not found');
|
|
182
|
-
}
|
|
183
|
-
request.status = 'processing';
|
|
184
|
-
try {
|
|
185
|
-
const result = await deleteData(request.userId, request.dataCategories);
|
|
186
|
-
request.status = 'completed';
|
|
187
|
-
request.processedAt = new Date().toISOString();
|
|
188
|
-
request.deletedData = result.deleted;
|
|
189
|
-
request.retainedData = result.retained;
|
|
190
|
-
}
|
|
191
|
-
catch (error) {
|
|
192
|
-
request.status = 'failed';
|
|
193
|
-
throw error;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Get deletion request
|
|
198
|
-
*/
|
|
199
|
-
getRequest(requestId) {
|
|
200
|
-
return this.requests.get(requestId);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Get user deletion requests
|
|
204
|
-
*/
|
|
205
|
-
getUserRequests(userId) {
|
|
206
|
-
return Array.from(this.requests.values()).filter((r) => r.userId === userId);
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Check if data can be deleted
|
|
210
|
-
*/
|
|
211
|
-
canDelete(_dataCategory, legalBasis) {
|
|
212
|
-
// Data with legal obligation or vital interest cannot be deleted
|
|
213
|
-
if (legalBasis === 'legal_obligation' || legalBasis === 'vital_interest') {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Calculate retention period
|
|
220
|
-
*/
|
|
221
|
-
calculateRetentionEnd(createdAt, retentionPeriod) {
|
|
222
|
-
return new Date(createdAt.getTime() + retentionPeriod * 24 * 60 * 60 * 1000);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Check if data should be deleted (retention period expired)
|
|
226
|
-
*/
|
|
227
|
-
shouldDelete(createdAt, retentionPeriod) {
|
|
228
|
-
const retentionEnd = this.calculateRetentionEnd(createdAt, retentionPeriod);
|
|
229
|
-
return new Date() > retentionEnd;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Data anonymization utilities
|
|
234
|
-
*/
|
|
235
|
-
export class DataAnonymization {
|
|
236
|
-
/**
|
|
237
|
-
* Anonymize user data
|
|
238
|
-
*/
|
|
239
|
-
static anonymizeUser(user) {
|
|
240
|
-
return {
|
|
241
|
-
...user,
|
|
242
|
-
email: DataAnonymization.hashValue(user.email),
|
|
243
|
-
name: 'Anonymous User',
|
|
244
|
-
phone: undefined,
|
|
245
|
-
address: undefined,
|
|
246
|
-
ip: undefined,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Pseudonymize data (reversible)
|
|
251
|
-
*/
|
|
252
|
-
static pseudonymize(value, key) {
|
|
253
|
-
// Simple pseudonymization (use proper crypto in production)
|
|
254
|
-
return `pseudo_${DataAnonymization.hashValue(value + key).substring(0, 16)}`;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Hash value (irreversible) using SHA-256
|
|
258
|
-
*/
|
|
259
|
-
static hashValue(value) {
|
|
260
|
-
const digest = createHash('sha256').update(value).digest('hex');
|
|
261
|
-
return `hash_${digest}`;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Anonymize dataset
|
|
265
|
-
*/
|
|
266
|
-
static anonymizeDataset(data, sensitiveFields) {
|
|
267
|
-
return data.map((item) => {
|
|
268
|
-
const anonymized = { ...item };
|
|
269
|
-
sensitiveFields.forEach((field) => {
|
|
270
|
-
if (field in anonymized && typeof anonymized[field] === 'string') {
|
|
271
|
-
anonymized[field] = DataAnonymization.hashValue(anonymized[field]);
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
return anonymized;
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* K-anonymity check
|
|
279
|
-
*/
|
|
280
|
-
static checkKAnonymity(data, quasiIdentifiers, k) {
|
|
281
|
-
// Group by quasi-identifiers
|
|
282
|
-
const groups = new Map();
|
|
283
|
-
data.forEach((item) => {
|
|
284
|
-
const key = quasiIdentifiers.map((field) => String(item[field])).join('|');
|
|
285
|
-
groups.set(key, (groups.get(key) || 0) + 1);
|
|
286
|
-
});
|
|
287
|
-
// Check if all groups have at least k members
|
|
288
|
-
return Array.from(groups.values()).every((count) => count >= k);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Privacy policy manager
|
|
293
|
-
*/
|
|
294
|
-
export class PrivacyPolicyManager {
|
|
295
|
-
policies = new Map();
|
|
296
|
-
currentVersion = '1.0.0';
|
|
297
|
-
/**
|
|
298
|
-
* Add policy version
|
|
299
|
-
*/
|
|
300
|
-
addPolicy(version, content, effectiveDate) {
|
|
301
|
-
this.policies.set(version, { version, content, effectiveDate });
|
|
302
|
-
this.currentVersion = version;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Get current policy
|
|
306
|
-
*/
|
|
307
|
-
getCurrentPolicy() {
|
|
308
|
-
return this.policies.get(this.currentVersion);
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Get policy by version
|
|
312
|
-
*/
|
|
313
|
-
getPolicy(version) {
|
|
314
|
-
return this.policies.get(version);
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Check if user accepted current policy
|
|
318
|
-
*/
|
|
319
|
-
hasAcceptedCurrent(userAcceptedVersion) {
|
|
320
|
-
return userAcceptedVersion === this.currentVersion;
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Get all versions
|
|
324
|
-
*/
|
|
325
|
-
getAllVersions() {
|
|
326
|
-
return Array.from(this.policies.keys());
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
export class CookieConsentManager {
|
|
330
|
-
config = {
|
|
331
|
-
necessary: true,
|
|
332
|
-
functional: false,
|
|
333
|
-
analytics: false,
|
|
334
|
-
marketing: false,
|
|
335
|
-
};
|
|
336
|
-
/**
|
|
337
|
-
* Set consent configuration
|
|
338
|
-
*/
|
|
339
|
-
setConsent(config) {
|
|
340
|
-
this.config = { ...this.config, ...config };
|
|
341
|
-
this.saveToStorage();
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Get consent configuration
|
|
345
|
-
*/
|
|
346
|
-
getConsent() {
|
|
347
|
-
return { ...this.config };
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Check if specific consent is granted
|
|
351
|
-
*/
|
|
352
|
-
hasConsent(type) {
|
|
353
|
-
return this.config[type];
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Save to storage
|
|
357
|
-
*/
|
|
358
|
-
saveToStorage() {
|
|
359
|
-
if (typeof localStorage !== 'undefined') {
|
|
360
|
-
localStorage.setItem('cookie-consent', JSON.stringify(this.config));
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Load from storage
|
|
365
|
-
*/
|
|
366
|
-
loadFromStorage() {
|
|
367
|
-
if (typeof localStorage !== 'undefined') {
|
|
368
|
-
const stored = localStorage.getItem('cookie-consent');
|
|
369
|
-
if (stored) {
|
|
370
|
-
try {
|
|
371
|
-
this.config = JSON.parse(stored);
|
|
372
|
-
}
|
|
373
|
-
catch {
|
|
374
|
-
// Ignore parse errors
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Clear consent
|
|
381
|
-
*/
|
|
382
|
-
clearConsent() {
|
|
383
|
-
this.config = {
|
|
384
|
-
necessary: true,
|
|
385
|
-
functional: false,
|
|
386
|
-
analytics: false,
|
|
387
|
-
marketing: false,
|
|
388
|
-
};
|
|
389
|
-
if (typeof localStorage !== 'undefined') {
|
|
390
|
-
localStorage.removeItem('cookie-consent');
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
export class DataBreachManager {
|
|
395
|
-
breaches = new Map();
|
|
396
|
-
/**
|
|
397
|
-
* Report data breach
|
|
398
|
-
*/
|
|
399
|
-
async reportBreach(breach) {
|
|
400
|
-
const fullBreach = {
|
|
401
|
-
...breach,
|
|
402
|
-
id: crypto.randomUUID(),
|
|
403
|
-
detectedAt: new Date().toISOString(),
|
|
404
|
-
status: 'detected',
|
|
405
|
-
};
|
|
406
|
-
this.breaches.set(fullBreach.id, fullBreach);
|
|
407
|
-
// Auto-notify if critical
|
|
408
|
-
if (fullBreach.severity === 'critical') {
|
|
409
|
-
await this.notifyAuthorities(fullBreach);
|
|
410
|
-
}
|
|
411
|
-
return fullBreach;
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Notify authorities (required within 72 hours under GDPR)
|
|
415
|
-
*/
|
|
416
|
-
async notifyAuthorities(breach) {
|
|
417
|
-
breach.reportedAt = new Date().toISOString();
|
|
418
|
-
breach.status = 'notified';
|
|
419
|
-
// In production, integrate with data protection authority API
|
|
420
|
-
logger.info('Breach reported to authorities', { breachId: breach.id });
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Notify affected users
|
|
424
|
-
*/
|
|
425
|
-
async notifyAffectedUsers(breachId, notifyFn) {
|
|
426
|
-
const breach = this.breaches.get(breachId);
|
|
427
|
-
if (!breach) {
|
|
428
|
-
throw new Error('Breach not found');
|
|
429
|
-
}
|
|
430
|
-
for (const userId of breach.affectedUsers) {
|
|
431
|
-
await notifyFn(userId, breach);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* Check if breach notification is required
|
|
436
|
-
*/
|
|
437
|
-
requiresNotification(breach) {
|
|
438
|
-
// Notification required for high risk breaches
|
|
439
|
-
return (breach.severity === 'high' ||
|
|
440
|
-
breach.severity === 'critical' ||
|
|
441
|
-
breach.dataCategories.includes('sensitive') ||
|
|
442
|
-
breach.dataCategories.includes('financial'));
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Get breach
|
|
446
|
-
*/
|
|
447
|
-
getBreach(id) {
|
|
448
|
-
return this.breaches.get(id);
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Get all breaches
|
|
452
|
-
*/
|
|
453
|
-
getAllBreaches() {
|
|
454
|
-
return Array.from(this.breaches.values());
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Global instances
|
|
459
|
-
*/
|
|
460
|
-
export const consentManager = new ConsentManager();
|
|
461
|
-
export const dataExportSystem = new DataExportSystem();
|
|
462
|
-
export const dataDeletionSystem = new DataDeletionSystem();
|
|
463
|
-
export const privacyPolicyManager = new PrivacyPolicyManager();
|
|
464
|
-
export const cookieConsentManager = new CookieConsentManager();
|
|
465
|
-
export const dataBreachManager = new DataBreachManager();
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Headers and CORS Configuration
|
|
3
|
-
*
|
|
4
|
-
* HTTP security headers and CORS policy management
|
|
5
|
-
*/
|
|
6
|
-
export interface SecurityHeadersConfig {
|
|
7
|
-
contentSecurityPolicy?: string | ContentSecurityPolicyConfig;
|
|
8
|
-
strictTransportSecurity?: boolean | HSTSConfig;
|
|
9
|
-
xFrameOptions?: 'DENY' | 'SAMEORIGIN' | string;
|
|
10
|
-
xContentTypeOptions?: boolean;
|
|
11
|
-
referrerPolicy?: ReferrerPolicyValue;
|
|
12
|
-
permissionsPolicy?: string | PermissionsPolicyConfig;
|
|
13
|
-
crossOriginEmbedderPolicy?: 'require-corp' | 'credentialless';
|
|
14
|
-
crossOriginOpenerPolicy?: 'same-origin' | 'same-origin-allow-popups' | 'unsafe-none';
|
|
15
|
-
crossOriginResourcePolicy?: 'same-origin' | 'same-site' | 'cross-origin';
|
|
16
|
-
}
|
|
17
|
-
export interface ContentSecurityPolicyConfig {
|
|
18
|
-
defaultSrc?: string[];
|
|
19
|
-
scriptSrc?: string[];
|
|
20
|
-
styleSrc?: string[];
|
|
21
|
-
imgSrc?: string[];
|
|
22
|
-
fontSrc?: string[];
|
|
23
|
-
connectSrc?: string[];
|
|
24
|
-
frameSrc?: string[];
|
|
25
|
-
objectSrc?: string[];
|
|
26
|
-
mediaSrc?: string[];
|
|
27
|
-
workerSrc?: string[];
|
|
28
|
-
childSrc?: string[];
|
|
29
|
-
formAction?: string[];
|
|
30
|
-
frameAncestors?: string[];
|
|
31
|
-
baseUri?: string[];
|
|
32
|
-
manifestSrc?: string[];
|
|
33
|
-
upgradeInsecureRequests?: boolean;
|
|
34
|
-
blockAllMixedContent?: boolean;
|
|
35
|
-
reportUri?: string;
|
|
36
|
-
reportTo?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface HSTSConfig {
|
|
39
|
-
maxAge: number;
|
|
40
|
-
includeSubDomains?: boolean;
|
|
41
|
-
preload?: boolean;
|
|
42
|
-
}
|
|
43
|
-
export type ReferrerPolicyValue = 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
|
|
44
|
-
export interface PermissionsPolicyConfig {
|
|
45
|
-
accelerometer?: string[];
|
|
46
|
-
ambientLightSensor?: string[];
|
|
47
|
-
autoplay?: string[];
|
|
48
|
-
battery?: string[];
|
|
49
|
-
camera?: string[];
|
|
50
|
-
displayCapture?: string[];
|
|
51
|
-
documentDomain?: string[];
|
|
52
|
-
encryptedMedia?: string[];
|
|
53
|
-
fullscreen?: string[];
|
|
54
|
-
geolocation?: string[];
|
|
55
|
-
gyroscope?: string[];
|
|
56
|
-
magnetometer?: string[];
|
|
57
|
-
microphone?: string[];
|
|
58
|
-
midi?: string[];
|
|
59
|
-
payment?: string[];
|
|
60
|
-
pictureInPicture?: string[];
|
|
61
|
-
publicKeyCredentials?: string[];
|
|
62
|
-
screenWakeLock?: string[];
|
|
63
|
-
syncXhr?: string[];
|
|
64
|
-
usb?: string[];
|
|
65
|
-
webShare?: string[];
|
|
66
|
-
xrSpatialTracking?: string[];
|
|
67
|
-
}
|
|
68
|
-
export interface CORSConfig {
|
|
69
|
-
origin?: string | string[] | ((origin: string) => boolean);
|
|
70
|
-
methods?: string[];
|
|
71
|
-
allowedHeaders?: string[];
|
|
72
|
-
exposedHeaders?: string[];
|
|
73
|
-
credentials?: boolean;
|
|
74
|
-
maxAge?: number;
|
|
75
|
-
preflightContinue?: boolean;
|
|
76
|
-
optionsSuccessStatus?: number;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Security headers manager
|
|
80
|
-
*/
|
|
81
|
-
export declare class SecurityHeaders {
|
|
82
|
-
private config;
|
|
83
|
-
constructor(config?: SecurityHeadersConfig);
|
|
84
|
-
/**
|
|
85
|
-
* Get all security headers
|
|
86
|
-
*/
|
|
87
|
-
getHeaders(): Record<string, string>;
|
|
88
|
-
/**
|
|
89
|
-
* Build Content Security Policy header
|
|
90
|
-
*/
|
|
91
|
-
private buildCSP;
|
|
92
|
-
/**
|
|
93
|
-
* Build HSTS header
|
|
94
|
-
*/
|
|
95
|
-
private buildHSTS;
|
|
96
|
-
/**
|
|
97
|
-
* Build Permissions-Policy header
|
|
98
|
-
*/
|
|
99
|
-
private buildPermissionsPolicy;
|
|
100
|
-
/**
|
|
101
|
-
* Apply headers to response
|
|
102
|
-
*/
|
|
103
|
-
applyHeaders(response: Response): Response;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* CORS manager
|
|
107
|
-
*/
|
|
108
|
-
export declare class CORSManager {
|
|
109
|
-
private config;
|
|
110
|
-
constructor(config?: CORSConfig);
|
|
111
|
-
/**
|
|
112
|
-
* Check if origin is allowed
|
|
113
|
-
*/
|
|
114
|
-
isOriginAllowed(origin: string): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Get CORS headers
|
|
117
|
-
*/
|
|
118
|
-
getCORSHeaders(origin: string): Record<string, string>;
|
|
119
|
-
/**
|
|
120
|
-
* Get preflight headers
|
|
121
|
-
*/
|
|
122
|
-
getPreflightHeaders(origin: string): Record<string, string>;
|
|
123
|
-
/**
|
|
124
|
-
* Handle CORS request
|
|
125
|
-
*/
|
|
126
|
-
handleRequest(request: Request): Response | null;
|
|
127
|
-
/**
|
|
128
|
-
* Handle preflight request
|
|
129
|
-
*/
|
|
130
|
-
handlePreflight(_request: Request, origin: string): Response;
|
|
131
|
-
/**
|
|
132
|
-
* Apply CORS headers to response
|
|
133
|
-
*/
|
|
134
|
-
applyHeaders(response: Response, origin: string): Response;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Common security header presets
|
|
138
|
-
*/
|
|
139
|
-
export declare const SecurityPresets: {
|
|
140
|
-
/**
|
|
141
|
-
* Strict security (recommended for production)
|
|
142
|
-
*/
|
|
143
|
-
strict: () => SecurityHeadersConfig;
|
|
144
|
-
/**
|
|
145
|
-
* Moderate security (balanced)
|
|
146
|
-
*/
|
|
147
|
-
moderate: () => SecurityHeadersConfig;
|
|
148
|
-
/**
|
|
149
|
-
* Development (permissive)
|
|
150
|
-
*/
|
|
151
|
-
development: () => SecurityHeadersConfig;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Common CORS presets
|
|
155
|
-
*/
|
|
156
|
-
export declare const CORSPresets: {
|
|
157
|
-
/**
|
|
158
|
-
* Strict CORS (same origin only)
|
|
159
|
-
*/
|
|
160
|
-
strict: () => CORSConfig;
|
|
161
|
-
/**
|
|
162
|
-
* Moderate CORS (specific origins)
|
|
163
|
-
*/
|
|
164
|
-
moderate: (allowedOrigins: string[]) => CORSConfig;
|
|
165
|
-
/**
|
|
166
|
-
* Permissive CORS (all origins)
|
|
167
|
-
*/
|
|
168
|
-
permissive: () => CORSConfig;
|
|
169
|
-
/**
|
|
170
|
-
* API CORS (for public APIs)
|
|
171
|
-
*/
|
|
172
|
-
api: () => CORSConfig;
|
|
173
|
-
};
|
|
174
|
-
/**
|
|
175
|
-
* Security middleware creator
|
|
176
|
-
*/
|
|
177
|
-
export declare function createSecurityMiddleware(securityConfig?: SecurityHeadersConfig, corsConfig?: CORSConfig): (request: Request, next: () => Promise<Response>) => Promise<Response>;
|
|
178
|
-
/**
|
|
179
|
-
* Rate limiting headers
|
|
180
|
-
*/
|
|
181
|
-
export declare function setRateLimitHeaders(response: Response, limit: number, remaining: number, reset: number): void;
|
|
182
|
-
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/security/headers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,qBAAqB;IACpC,qBAAqB,CAAC,EAAE,MAAM,GAAG,2BAA2B,CAAA;IAC5D,uBAAuB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;IAC9C,aAAa,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,MAAM,CAAA;IAC9C,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,cAAc,CAAC,EAAE,mBAAmB,CAAA;IACpC,iBAAiB,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAAA;IACpD,yBAAyB,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAA;IAC7D,uBAAuB,CAAC,EAAE,aAAa,GAAG,0BAA0B,GAAG,aAAa,CAAA;IACpF,yBAAyB,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,cAAc,CAAA;CACzE;AAED,MAAM,WAAW,2BAA2B;IAC1C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CA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