@c15t/backend 1.8.0 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +44 -78
- package/CHANGELOG.md +23 -0
- package/dist/cache/adapters/cloudflare-kv.d.ts +46 -0
- package/dist/cache/adapters/cloudflare-kv.d.ts.map +1 -0
- package/dist/cache/adapters/index.d.ts +11 -0
- package/dist/cache/adapters/index.d.ts.map +1 -0
- package/dist/cache/adapters/memory.d.ts +47 -0
- package/dist/cache/adapters/memory.d.ts.map +1 -0
- package/dist/cache/adapters/upstash-redis.d.ts +75 -0
- package/dist/cache/adapters/upstash-redis.d.ts.map +1 -0
- package/dist/cache/gvl-resolver.d.ts +86 -0
- package/dist/cache/gvl-resolver.d.ts.map +1 -0
- package/dist/cache/index.d.ts +13 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/keys.d.ts +51 -0
- package/dist/cache/keys.d.ts.map +1 -0
- package/dist/cache/types.d.ts +61 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache.cjs +530 -0
- package/dist/cache.js +467 -0
- package/dist/core.cjs +2569 -3840
- package/dist/core.d.ts +19 -409
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +2378 -3680
- package/dist/db/adapters/drizzle.cjs +36 -0
- package/dist/db/adapters/drizzle.d.ts.map +1 -0
- package/dist/db/adapters/index.d.ts.map +1 -0
- package/dist/db/adapters/kysely.cjs +36 -0
- package/dist/db/adapters/kysely.d.ts.map +1 -0
- package/dist/db/adapters/mongo.cjs +36 -0
- package/dist/db/adapters/mongo.d.ts.map +1 -0
- package/dist/db/adapters/prisma.cjs +36 -0
- package/dist/db/adapters/prisma.d.ts.map +1 -0
- package/dist/db/adapters/typeorm.cjs +36 -0
- package/dist/db/adapters/typeorm.d.ts.map +1 -0
- package/dist/db/adapters.cjs +18 -0
- package/dist/db/migrator/index.d.ts.map +1 -0
- package/dist/db/migrator.cjs +61 -0
- package/dist/db/registry/consent-policy.d.ts +23 -0
- package/dist/db/registry/consent-policy.d.ts.map +1 -0
- package/dist/db/registry/consent-purpose.d.ts +11 -0
- package/dist/db/registry/consent-purpose.d.ts.map +1 -0
- package/dist/db/registry/domain.d.ts +18 -0
- package/dist/db/registry/domain.d.ts.map +1 -0
- package/dist/db/registry/index.d.ts +57 -0
- package/dist/db/registry/index.d.ts.map +1 -0
- package/dist/db/registry/subject.d.ts +32 -0
- package/dist/db/registry/subject.d.ts.map +1 -0
- package/dist/db/registry/types.d.ts +10 -0
- package/dist/db/registry/types.d.ts.map +1 -0
- package/dist/db/registry/utils/generate-id.d.ts +25 -0
- package/dist/db/registry/utils/generate-id.d.ts.map +1 -0
- package/dist/db/registry/utils.d.ts +25 -0
- package/dist/db/registry/utils.d.ts.map +1 -0
- package/dist/db/schema/1.0.0/audit-log.d.ts +14 -0
- package/dist/db/schema/1.0.0/audit-log.d.ts.map +1 -0
- package/dist/db/schema/1.0.0/consent-policy.d.ts +13 -0
- package/dist/db/schema/1.0.0/consent-policy.d.ts.map +1 -0
- package/dist/db/schema/1.0.0/consent-purpose.d.ts +13 -0
- package/dist/db/schema/1.0.0/consent-purpose.d.ts.map +1 -0
- package/dist/db/schema/1.0.0/consent-record.d.ts +9 -0
- package/dist/db/schema/1.0.0/consent-record.d.ts.map +1 -0
- package/dist/db/schema/1.0.0/consent.d.ts +18 -0
- package/dist/db/schema/1.0.0/consent.d.ts.map +1 -0
- package/dist/db/schema/1.0.0/domain.d.ts +11 -0
- package/dist/db/schema/1.0.0/domain.d.ts.map +1 -0
- package/dist/db/schema/1.0.0/index.d.ts +1506 -0
- package/dist/db/schema/1.0.0/index.d.ts.map +1 -0
- package/dist/db/schema/1.0.0/subject.d.ts +11 -0
- package/dist/db/schema/1.0.0/subject.d.ts.map +1 -0
- package/dist/db/schema/2.0.0/audit-log.d.ts +16 -0
- package/dist/db/schema/2.0.0/audit-log.d.ts.map +1 -0
- package/dist/db/schema/2.0.0/consent-policy.d.ts +13 -0
- package/dist/db/schema/2.0.0/consent-policy.d.ts.map +1 -0
- package/dist/db/schema/2.0.0/consent-purpose.d.ts +10 -0
- package/dist/db/schema/2.0.0/consent-purpose.d.ts.map +1 -0
- package/dist/db/schema/2.0.0/consent.d.ts +24 -0
- package/dist/db/schema/2.0.0/consent.d.ts.map +1 -0
- package/dist/db/schema/2.0.0/domain.d.ts +10 -0
- package/dist/db/schema/2.0.0/domain.d.ts.map +1 -0
- package/dist/db/schema/2.0.0/index.d.ts +586 -0
- package/dist/db/schema/2.0.0/index.d.ts.map +1 -0
- package/dist/db/schema/2.0.0/subject.d.ts +12 -0
- package/dist/db/schema/2.0.0/subject.d.ts.map +1 -0
- package/dist/db/schema/index.d.ts +2664 -0
- package/dist/db/schema/index.d.ts.map +1 -0
- package/dist/db/schema.cjs +359 -0
- package/dist/db/schema.js +261 -0
- package/dist/db/tenant-scope.d.ts +20 -0
- package/dist/db/tenant-scope.d.ts.map +1 -0
- package/dist/define-config.cjs +36 -0
- package/dist/define-config.d.ts.map +1 -0
- package/dist/handlers/consent/check.handler.d.ts +24 -0
- package/dist/handlers/consent/check.handler.d.ts.map +1 -0
- package/dist/handlers/consent/index.d.ts +11 -339
- package/dist/handlers/consent/index.d.ts.map +1 -1
- package/dist/handlers/init/geo.d.ts +34 -0
- package/dist/handlers/init/geo.d.ts.map +1 -0
- package/dist/handlers/init/index.d.ts +157 -0
- package/dist/handlers/init/index.d.ts.map +1 -0
- package/dist/handlers/init/translations.d.ts +28 -0
- package/dist/handlers/init/translations.d.ts.map +1 -0
- package/dist/handlers/status/index.d.ts +7 -0
- package/dist/handlers/status/index.d.ts.map +1 -0
- package/dist/handlers/status/status.handler.d.ts +26 -0
- package/dist/handlers/status/status.handler.d.ts.map +1 -0
- package/dist/handlers/subject/get.handler.d.ts +32 -0
- package/dist/handlers/subject/get.handler.d.ts.map +1 -0
- package/dist/handlers/subject/index.d.ts +10 -0
- package/dist/handlers/subject/index.d.ts.map +1 -0
- package/dist/handlers/subject/list.handler.d.ts +31 -0
- package/dist/handlers/subject/list.handler.d.ts.map +1 -0
- package/dist/handlers/subject/patch.handler.d.ts +22 -0
- package/dist/handlers/subject/patch.handler.d.ts.map +1 -0
- package/dist/handlers/subject/post.handler.d.ts +25 -0
- package/dist/handlers/subject/post.handler.d.ts.map +1 -0
- package/dist/handlers/utils/consent-enrichment.d.ts +52 -0
- package/dist/handlers/utils/consent-enrichment.d.ts.map +1 -0
- package/dist/init.d.ts +20 -26
- package/dist/init.d.ts.map +1 -1
- package/dist/middleware/auth/index.d.ts +7 -0
- package/dist/middleware/auth/index.d.ts.map +1 -0
- package/dist/middleware/auth/validate-api-key.d.ts +49 -0
- package/dist/middleware/auth/validate-api-key.d.ts.map +1 -0
- package/dist/middleware/cors/cors.d.ts +13 -17
- package/dist/middleware/cors/cors.d.ts.map +1 -1
- package/dist/middleware/cors/is-origin-trusted.d.ts.map +1 -1
- package/dist/middleware/cors/process-cors.d.ts +1 -1
- package/dist/middleware/cors/process-cors.d.ts.map +1 -1
- package/dist/middleware/openapi/config.d.ts +16 -2
- package/dist/middleware/openapi/config.d.ts.map +1 -1
- package/dist/middleware/openapi/handlers.d.ts +1 -24
- package/dist/middleware/openapi/handlers.d.ts.map +1 -1
- package/dist/middleware/openapi/index.d.ts +3 -2
- package/dist/middleware/openapi/index.d.ts.map +1 -1
- package/dist/middleware/process-ip/index.d.ts +12 -0
- package/dist/middleware/process-ip/index.d.ts.map +1 -0
- package/dist/router.cjs +1288 -1776
- package/dist/router.d.ts +9 -363
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +1277 -1658
- package/dist/routes/consent.d.ts +16 -0
- package/dist/routes/consent.d.ts.map +1 -0
- package/dist/routes/index.d.ts +10 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/init.d.ts +16 -0
- package/dist/routes/init.d.ts.map +1 -0
- package/dist/routes/status.d.ts +16 -0
- package/dist/routes/status.d.ts.map +1 -0
- package/dist/routes/subject.d.ts +16 -0
- package/dist/routes/subject.d.ts.map +1 -0
- package/dist/types/api.d.ts +5 -1
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/index.d.ts +253 -14
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types.cjs +37 -0
- package/dist/types.js +3 -0
- package/dist/utils/create-telemetry-options.d.ts +71 -0
- package/dist/utils/create-telemetry-options.d.ts.map +1 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/extract-error-message.d.ts +9 -0
- package/dist/utils/extract-error-message.d.ts.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/instrumentation.d.ts +70 -0
- package/dist/utils/instrumentation.d.ts.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/metrics.d.ts +133 -0
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +143 -224
- package/rslib.config.ts +11 -34
- package/src/cache/adapters/cloudflare-kv.ts +71 -0
- package/src/cache/adapters/index.ts +22 -0
- package/src/cache/adapters/memory.ts +111 -0
- package/src/cache/adapters/upstash-redis.ts +113 -0
- package/src/cache/gvl-resolver.ts +289 -0
- package/src/cache/index.ts +34 -0
- package/src/cache/keys.ts +68 -0
- package/src/cache/types.ts +66 -0
- package/src/core.ts +254 -352
- package/src/db/migrator/index.ts +80 -0
- package/src/db/registry/consent-policy.test.ts +451 -0
- package/src/db/registry/consent-policy.ts +82 -0
- package/src/db/registry/consent-purpose.test.ts +428 -0
- package/src/db/registry/consent-purpose.ts +61 -0
- package/src/db/registry/domain.test.ts +445 -0
- package/src/db/registry/domain.ts +91 -0
- package/src/db/registry/index.ts +14 -0
- package/src/db/registry/subject.test.ts +388 -0
- package/src/db/registry/subject.ts +129 -0
- package/src/db/registry/types.ts +10 -0
- package/src/db/registry/utils/generate-id.test.ts +216 -0
- package/src/db/registry/utils/generate-id.ts +133 -0
- package/src/db/registry/utils.ts +133 -0
- package/src/db/schema/1.0.0/audit-log.ts +15 -0
- package/src/db/schema/1.0.0/consent-policy.ts +14 -0
- package/src/db/schema/1.0.0/consent-purpose.ts +14 -0
- package/src/db/schema/1.0.0/consent-record.ts +10 -0
- package/src/db/schema/1.0.0/consent.ts +20 -0
- package/src/db/schema/1.0.0/domain.ts +12 -0
- package/src/db/schema/1.0.0/index.ts +48 -0
- package/src/db/schema/1.0.0/subject.ts +12 -0
- package/src/db/schema/2.0.0/audit-log.ts +18 -0
- package/src/db/schema/2.0.0/consent-policy.ts +28 -0
- package/src/db/schema/2.0.0/consent-purpose.ts +12 -0
- package/src/db/schema/2.0.0/consent.ts +26 -0
- package/src/db/schema/2.0.0/domain.ts +12 -0
- package/src/db/schema/2.0.0/index.ts +47 -0
- package/src/db/schema/2.0.0/subject.ts +14 -0
- package/src/db/schema/index.ts +15 -0
- package/src/db/tenant-scope.test.ts +750 -0
- package/src/db/tenant-scope.ts +103 -0
- package/src/handlers/consent/check.handler.ts +126 -0
- package/src/handlers/consent/index.ts +11 -10
- package/src/handlers/init/geo.test.ts +317 -0
- package/src/handlers/init/geo.ts +195 -0
- package/src/handlers/init/index.test.ts +205 -0
- package/src/handlers/init/index.ts +114 -0
- package/src/handlers/init/translations.test.ts +121 -0
- package/src/handlers/init/translations.ts +72 -0
- package/src/handlers/status/index.ts +7 -0
- package/src/handlers/status/status.handler.test.ts +155 -0
- package/src/handlers/status/status.handler.ts +51 -0
- package/src/handlers/subject/get.handler.ts +93 -0
- package/src/handlers/subject/index.ts +10 -0
- package/src/handlers/subject/list.handler.ts +93 -0
- package/src/handlers/subject/patch.handler.ts +122 -0
- package/src/handlers/subject/post.handler.test.ts +294 -0
- package/src/handlers/subject/post.handler.ts +254 -0
- package/src/handlers/utils/consent-enrichment.test.ts +380 -0
- package/src/handlers/utils/consent-enrichment.ts +218 -0
- package/src/init.test.ts +126 -0
- package/src/init.ts +70 -297
- package/src/middleware/auth/index.ts +11 -0
- package/src/middleware/auth/validate-api-key.test.ts +86 -0
- package/src/middleware/auth/validate-api-key.ts +107 -0
- package/src/middleware/cors/cors.test.ts +96 -380
- package/src/middleware/cors/cors.ts +88 -97
- package/src/middleware/cors/is-origin-trusted.ts +2 -1
- package/src/middleware/cors/process-cors.ts +1 -1
- package/src/middleware/openapi/config.ts +8 -6
- package/src/middleware/openapi/handlers.ts +2 -100
- package/src/middleware/openapi/index.ts +3 -2
- package/src/middleware/process-ip/index.test.ts +195 -0
- package/src/middleware/process-ip/index.ts +199 -0
- package/src/router.ts +14 -7
- package/src/routes/consent.ts +52 -0
- package/src/routes/index.ts +10 -0
- package/src/routes/init.ts +102 -0
- package/src/routes/status.ts +46 -0
- package/src/routes/subject.ts +152 -0
- package/src/types/api.ts +17 -2
- package/src/types/index.ts +288 -23
- package/src/utils/create-telemetry-options.test.ts +302 -0
- package/src/utils/create-telemetry-options.ts +229 -0
- package/src/utils/extract-error-message.ts +21 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/instrumentation.test.ts +185 -0
- package/src/utils/instrumentation.ts +196 -0
- package/src/utils/logger.ts +41 -0
- package/src/utils/metrics.test.ts +323 -0
- package/src/utils/metrics.ts +402 -0
- package/src/utils/telemetry-pii.test.ts +325 -0
- package/src/version.ts +1 -1
- package/tsconfig.json +2 -4
- package/LICENSE.md +0 -595
- package/dist/__tests__/server.test.d.ts +0 -2
- package/dist/__tests__/server.test.d.ts.map +0 -1
- package/dist/contracts/consent/identify.contract.d.ts +0 -24
- package/dist/contracts/consent/identify.contract.d.ts.map +0 -1
- package/dist/contracts/consent/index.d.ts +0 -340
- package/dist/contracts/consent/index.d.ts.map +0 -1
- package/dist/contracts/consent/index.test.d.ts +0 -2
- package/dist/contracts/consent/index.test.d.ts.map +0 -1
- package/dist/contracts/consent/post.contract.d.ts +0 -117
- package/dist/contracts/consent/post.contract.d.ts.map +0 -1
- package/dist/contracts/consent/post.contract.test.d.ts +0 -2
- package/dist/contracts/consent/post.contract.test.d.ts.map +0 -1
- package/dist/contracts/consent/show-banner.contract.d.ts +0 -123
- package/dist/contracts/consent/show-banner.contract.d.ts.map +0 -1
- package/dist/contracts/consent/show-banner.contract.test.d.ts +0 -2
- package/dist/contracts/consent/show-banner.contract.test.d.ts.map +0 -1
- package/dist/contracts/consent/verify.contract.d.ts +0 -81
- package/dist/contracts/consent/verify.contract.d.ts.map +0 -1
- package/dist/contracts/consent/verify.contract.test.d.ts +0 -2
- package/dist/contracts/consent/verify.contract.test.d.ts.map +0 -1
- package/dist/contracts/index.d.ts +0 -731
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/meta/index.d.ts +0 -23
- package/dist/contracts/meta/index.d.ts.map +0 -1
- package/dist/contracts/meta/index.test.d.ts +0 -2
- package/dist/contracts/meta/index.test.d.ts.map +0 -1
- package/dist/contracts/meta/status.contract.d.ts +0 -22
- package/dist/contracts/meta/status.contract.d.ts.map +0 -1
- package/dist/contracts/meta/status.contract.test.d.ts +0 -2
- package/dist/contracts/meta/status.contract.test.d.ts.map +0 -1
- package/dist/contracts/shared/jurisdiction.schema.d.ts +0 -36
- package/dist/contracts/shared/jurisdiction.schema.d.ts.map +0 -1
- package/dist/contracts.cjs +0 -799
- package/dist/contracts.js +0 -636
- package/dist/handlers/consent/identify.handler.d.ts +0 -23
- package/dist/handlers/consent/identify.handler.d.ts.map +0 -1
- package/dist/handlers/consent/identify.handler.test.d.ts +0 -2
- package/dist/handlers/consent/identify.handler.test.d.ts.map +0 -1
- package/dist/handlers/consent/post.handler.d.ts +0 -139
- package/dist/handlers/consent/post.handler.d.ts.map +0 -1
- package/dist/handlers/consent/show-banner/geo.d.ts +0 -10
- package/dist/handlers/consent/show-banner/geo.d.ts.map +0 -1
- package/dist/handlers/consent/show-banner/geo.test.d.ts +0 -2
- package/dist/handlers/consent/show-banner/geo.test.d.ts.map +0 -1
- package/dist/handlers/consent/show-banner/handler.d.ts +0 -126
- package/dist/handlers/consent/show-banner/handler.d.ts.map +0 -1
- package/dist/handlers/consent/show-banner/handler.test.d.ts +0 -2
- package/dist/handlers/consent/show-banner/handler.test.d.ts.map +0 -1
- package/dist/handlers/consent/show-banner/translations.d.ts +0 -13
- package/dist/handlers/consent/show-banner/translations.d.ts.map +0 -1
- package/dist/handlers/consent/show-banner/translations.test.d.ts +0 -2
- package/dist/handlers/consent/show-banner/translations.test.d.ts.map +0 -1
- package/dist/handlers/consent/verify.handler.d.ts +0 -103
- package/dist/handlers/consent/verify.handler.d.ts.map +0 -1
- package/dist/handlers/meta/index.d.ts +0 -23
- package/dist/handlers/meta/index.d.ts.map +0 -1
- package/dist/handlers/meta/status.handler.d.ts +0 -21
- package/dist/handlers/meta/status.handler.d.ts.map +0 -1
- package/dist/middleware/cors/cors.test.d.ts +0 -2
- package/dist/middleware/cors/cors.test.d.ts.map +0 -1
- package/dist/middleware/cors/is-origin-trusted.test.d.ts +0 -2
- package/dist/middleware/cors/is-origin-trusted.test.d.ts.map +0 -1
- package/dist/pkgs/api-router/hooks/__tests__/processor.test.d.ts +0 -2
- package/dist/pkgs/api-router/hooks/__tests__/processor.test.d.ts.map +0 -1
- package/dist/pkgs/api-router/hooks/processor.d.ts +0 -87
- package/dist/pkgs/api-router/hooks/processor.d.ts.map +0 -1
- package/dist/pkgs/api-router/telemetry.d.ts +0 -15
- package/dist/pkgs/api-router/telemetry.d.ts.map +0 -1
- package/dist/pkgs/api-router/types/router-props.d.ts +0 -32
- package/dist/pkgs/api-router/types/router-props.d.ts.map +0 -1
- package/dist/pkgs/api-router/utils/ip.d.ts +0 -44
- package/dist/pkgs/api-router/utils/ip.d.ts.map +0 -1
- package/dist/pkgs/data-model/fields/field-factory.d.ts +0 -151
- package/dist/pkgs/data-model/fields/field-factory.d.ts.map +0 -1
- package/dist/pkgs/data-model/fields/field-inference.d.ts +0 -76
- package/dist/pkgs/data-model/fields/field-inference.d.ts.map +0 -1
- package/dist/pkgs/data-model/fields/field-types.d.ts +0 -182
- package/dist/pkgs/data-model/fields/field-types.d.ts.map +0 -1
- package/dist/pkgs/data-model/fields/id-generator.d.ts +0 -19
- package/dist/pkgs/data-model/fields/id-generator.d.ts.map +0 -1
- package/dist/pkgs/data-model/fields/index.cjs +0 -159
- package/dist/pkgs/data-model/fields/index.d.ts +0 -13
- package/dist/pkgs/data-model/fields/index.d.ts.map +0 -1
- package/dist/pkgs/data-model/fields/index.js +0 -106
- package/dist/pkgs/data-model/fields/superjson-utils.d.ts +0 -12
- package/dist/pkgs/data-model/fields/superjson-utils.d.ts.map +0 -1
- package/dist/pkgs/data-model/fields/zod-fields.d.ts +0 -331
- package/dist/pkgs/data-model/fields/zod-fields.d.ts.map +0 -1
- package/dist/pkgs/data-model/hooks/create-hooks.d.ts +0 -32
- package/dist/pkgs/data-model/hooks/create-hooks.d.ts.map +0 -1
- package/dist/pkgs/data-model/hooks/index.d.ts +0 -40
- package/dist/pkgs/data-model/hooks/index.d.ts.map +0 -1
- package/dist/pkgs/data-model/hooks/types.d.ts +0 -134
- package/dist/pkgs/data-model/hooks/types.d.ts.map +0 -1
- package/dist/pkgs/data-model/hooks/update-hooks.d.ts +0 -33
- package/dist/pkgs/data-model/hooks/update-hooks.d.ts.map +0 -1
- package/dist/pkgs/data-model/hooks/update-many-hooks.d.ts +0 -55
- package/dist/pkgs/data-model/hooks/update-many-hooks.d.ts.map +0 -1
- package/dist/pkgs/data-model/hooks/utils.d.ts +0 -62
- package/dist/pkgs/data-model/hooks/utils.d.ts.map +0 -1
- package/dist/pkgs/data-model/hooks/with-hooks-factory.d.ts +0 -33
- package/dist/pkgs/data-model/hooks/with-hooks-factory.d.ts.map +0 -1
- package/dist/pkgs/data-model/index.cjs +0 -1603
- package/dist/pkgs/data-model/index.d.ts +0 -10
- package/dist/pkgs/data-model/index.d.ts.map +0 -1
- package/dist/pkgs/data-model/index.js +0 -1469
- package/dist/pkgs/data-model/schema/index.cjs +0 -1550
- package/dist/pkgs/data-model/schema/index.d.ts +0 -8
- package/dist/pkgs/data-model/schema/index.d.ts.map +0 -1
- package/dist/pkgs/data-model/schema/index.js +0 -1446
- package/dist/pkgs/data-model/schema/schemas.d.ts +0 -14
- package/dist/pkgs/data-model/schema/schemas.d.ts.map +0 -1
- package/dist/pkgs/data-model/schema/types.d.ts +0 -86
- package/dist/pkgs/data-model/schema/types.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapter-factory.d.ts +0 -21
- package/dist/pkgs/db-adapters/adapter-factory.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/drizzle-adapter.d.ts +0 -122
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/drizzle-adapter.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/index.cjs +0 -1183
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/index.d.ts +0 -2
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/index.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/index.js +0 -1139
- package/dist/pkgs/db-adapters/adapters/index.d.ts +0 -10
- package/dist/pkgs/db-adapters/adapters/index.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/dialect.d.ts +0 -70
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/dialect.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/index.cjs +0 -1296
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/index.d.ts +0 -4
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/index.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/index.js +0 -1132
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/kysely-adapter.d.ts +0 -99
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/kysely-adapter.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/tests/postgres.test.d.ts +0 -2
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/tests/postgres.test.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/tests/sqlite.test.d.ts +0 -2
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/tests/sqlite.test.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/tests/test-utils.d.ts +0 -49
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/tests/test-utils.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/types.d.ts +0 -278
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/types.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/memory-adapter/index.cjs +0 -1076
- package/dist/pkgs/db-adapters/adapters/memory-adapter/index.d.ts +0 -2
- package/dist/pkgs/db-adapters/adapters/memory-adapter/index.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/memory-adapter/index.js +0 -916
- package/dist/pkgs/db-adapters/adapters/memory-adapter/memory-adapter.d.ts +0 -58
- package/dist/pkgs/db-adapters/adapters/memory-adapter/memory-adapter.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/index.cjs +0 -1155
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/index.d.ts +0 -2
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/index.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/index.js +0 -1111
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/prisma-adapter.d.ts +0 -145
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/prisma-adapter.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/adapters/test.d.ts +0 -11
- package/dist/pkgs/db-adapters/adapters/test.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/index.cjs +0 -2035
- package/dist/pkgs/db-adapters/index.d.ts +0 -16
- package/dist/pkgs/db-adapters/index.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/index.js +0 -1972
- package/dist/pkgs/db-adapters/types.d.ts +0 -160
- package/dist/pkgs/db-adapters/types.d.ts.map +0 -1
- package/dist/pkgs/db-adapters/utils.d.ts +0 -36
- package/dist/pkgs/db-adapters/utils.d.ts.map +0 -1
- package/dist/pkgs/migrations/get-migration.d.ts +0 -4
- package/dist/pkgs/migrations/get-migration.d.ts.map +0 -1
- package/dist/pkgs/migrations/get-schema/get-schema.d.ts +0 -27
- package/dist/pkgs/migrations/get-schema/get-schema.d.ts.map +0 -1
- package/dist/pkgs/migrations/get-schema/index.d.ts +0 -21
- package/dist/pkgs/migrations/get-schema/index.d.ts.map +0 -1
- package/dist/pkgs/migrations/get-schema/process-fields.d.ts +0 -15
- package/dist/pkgs/migrations/get-schema/process-fields.d.ts.map +0 -1
- package/dist/pkgs/migrations/get-schema/process-tables.d.ts +0 -13
- package/dist/pkgs/migrations/get-schema/process-tables.d.ts.map +0 -1
- package/dist/pkgs/migrations/get-schema/types.d.ts +0 -17
- package/dist/pkgs/migrations/get-schema/types.d.ts.map +0 -1
- package/dist/pkgs/migrations/index.cjs +0 -1352
- package/dist/pkgs/migrations/index.d.ts +0 -18
- package/dist/pkgs/migrations/index.d.ts.map +0 -1
- package/dist/pkgs/migrations/index.js +0 -1171
- package/dist/pkgs/migrations/migration-builders.d.ts +0 -28
- package/dist/pkgs/migrations/migration-builders.d.ts.map +0 -1
- package/dist/pkgs/migrations/migration-execution.d.ts +0 -12
- package/dist/pkgs/migrations/migration-execution.d.ts.map +0 -1
- package/dist/pkgs/migrations/schema-comparison.d.ts +0 -35
- package/dist/pkgs/migrations/schema-comparison.d.ts.map +0 -1
- package/dist/pkgs/migrations/type-mapping.d.ts +0 -75
- package/dist/pkgs/migrations/type-mapping.d.ts.map +0 -1
- package/dist/pkgs/migrations/types.d.ts +0 -36
- package/dist/pkgs/migrations/types.d.ts.map +0 -1
- package/dist/pkgs/results/__tests__/error-class.test.d.ts +0 -2
- package/dist/pkgs/results/__tests__/error-class.test.d.ts.map +0 -1
- package/dist/pkgs/results/__tests__/error-codes.test.d.ts +0 -2
- package/dist/pkgs/results/__tests__/error-codes.test.d.ts.map +0 -1
- package/dist/pkgs/results/__tests__/neverthrow-integration.test.d.ts +0 -2
- package/dist/pkgs/results/__tests__/neverthrow-integration.test.d.ts.map +0 -1
- package/dist/pkgs/results/__tests__/recovery-utils.test.d.ts +0 -2
- package/dist/pkgs/results/__tests__/recovery-utils.test.d.ts.map +0 -1
- package/dist/pkgs/results/__tests__/result-helpers.test.d.ts +0 -2
- package/dist/pkgs/results/__tests__/result-helpers.test.d.ts.map +0 -1
- package/dist/pkgs/results/core/error-class.d.ts +0 -128
- package/dist/pkgs/results/core/error-class.d.ts.map +0 -1
- package/dist/pkgs/results/core/error-codes.d.ts +0 -178
- package/dist/pkgs/results/core/error-codes.d.ts.map +0 -1
- package/dist/pkgs/results/core/tracing.d.ts +0 -11
- package/dist/pkgs/results/core/tracing.d.ts.map +0 -1
- package/dist/pkgs/results/create-telemetry-options.d.ts +0 -31
- package/dist/pkgs/results/create-telemetry-options.d.ts.map +0 -1
- package/dist/pkgs/results/index.cjs +0 -462
- package/dist/pkgs/results/index.d.ts +0 -80
- package/dist/pkgs/results/index.d.ts.map +0 -1
- package/dist/pkgs/results/index.js +0 -377
- package/dist/pkgs/results/orpc-error-handler.d.ts +0 -65
- package/dist/pkgs/results/orpc-error-handler.d.ts.map +0 -1
- package/dist/pkgs/results/results/recovery-utils.d.ts +0 -115
- package/dist/pkgs/results/results/recovery-utils.d.ts.map +0 -1
- package/dist/pkgs/results/results/result-helpers.d.ts +0 -214
- package/dist/pkgs/results/results/result-helpers.d.ts.map +0 -1
- package/dist/pkgs/results/types.d.ts +0 -200
- package/dist/pkgs/results/types.d.ts.map +0 -1
- package/dist/pkgs/types/context.d.ts +0 -160
- package/dist/pkgs/types/context.d.ts.map +0 -1
- package/dist/pkgs/types/endpoints.d.ts +0 -30
- package/dist/pkgs/types/endpoints.d.ts.map +0 -1
- package/dist/pkgs/types/helper.d.ts +0 -55
- package/dist/pkgs/types/helper.d.ts.map +0 -1
- package/dist/pkgs/types/index.cjs +0 -18
- package/dist/pkgs/types/index.d.ts +0 -11
- package/dist/pkgs/types/index.d.ts.map +0 -1
- package/dist/pkgs/types/options.d.ts +0 -228
- package/dist/pkgs/types/options.d.ts.map +0 -1
- package/dist/pkgs/types/plugins.d.ts +0 -171
- package/dist/pkgs/types/plugins.d.ts.map +0 -1
- package/dist/pkgs/utils/env.d.ts.map +0 -1
- package/dist/pkgs/utils/index.d.ts +0 -4
- package/dist/pkgs/utils/index.d.ts.map +0 -1
- package/dist/pkgs/utils/logger.d.ts.map +0 -1
- package/dist/pkgs/utils/url.d.ts +0 -28
- package/dist/pkgs/utils/url.d.ts.map +0 -1
- package/dist/schema/audit-log/index.d.ts +0 -4
- package/dist/schema/audit-log/index.d.ts.map +0 -1
- package/dist/schema/audit-log/registry.d.ts +0 -96
- package/dist/schema/audit-log/registry.d.ts.map +0 -1
- package/dist/schema/audit-log/schema.d.ts +0 -45
- package/dist/schema/audit-log/schema.d.ts.map +0 -1
- package/dist/schema/audit-log/table.d.ts +0 -153
- package/dist/schema/audit-log/table.d.ts.map +0 -1
- package/dist/schema/audit-log/types.d.ts +0 -29
- package/dist/schema/audit-log/types.d.ts.map +0 -1
- package/dist/schema/consent/index.d.ts +0 -4
- package/dist/schema/consent/index.d.ts.map +0 -1
- package/dist/schema/consent/registry.d.ts +0 -150
- package/dist/schema/consent/registry.d.ts.map +0 -1
- package/dist/schema/consent/schema.d.ts +0 -53
- package/dist/schema/consent/schema.d.ts.map +0 -1
- package/dist/schema/consent/table.d.ts +0 -183
- package/dist/schema/consent/table.d.ts.map +0 -1
- package/dist/schema/consent/types.d.ts +0 -37
- package/dist/schema/consent/types.d.ts.map +0 -1
- package/dist/schema/consent-policy/index.d.ts +0 -4
- package/dist/schema/consent-policy/index.d.ts.map +0 -1
- package/dist/schema/consent-policy/registry.d.ts +0 -200
- package/dist/schema/consent-policy/registry.d.ts.map +0 -1
- package/dist/schema/consent-policy/schema.d.ts +0 -65
- package/dist/schema/consent-policy/schema.d.ts.map +0 -1
- package/dist/schema/consent-policy/table.d.ts +0 -142
- package/dist/schema/consent-policy/table.d.ts.map +0 -1
- package/dist/schema/consent-policy/types.d.ts +0 -29
- package/dist/schema/consent-policy/types.d.ts.map +0 -1
- package/dist/schema/consent-purpose/index.d.ts +0 -4
- package/dist/schema/consent-purpose/index.d.ts.map +0 -1
- package/dist/schema/consent-purpose/registry.d.ts +0 -138
- package/dist/schema/consent-purpose/registry.d.ts.map +0 -1
- package/dist/schema/consent-purpose/schema.d.ts +0 -57
- package/dist/schema/consent-purpose/schema.d.ts.map +0 -1
- package/dist/schema/consent-purpose/table.d.ts +0 -139
- package/dist/schema/consent-purpose/table.d.ts.map +0 -1
- package/dist/schema/consent-purpose/types.d.ts +0 -16
- package/dist/schema/consent-purpose/types.d.ts.map +0 -1
- package/dist/schema/consent-record/index.d.ts +0 -3
- package/dist/schema/consent-record/index.d.ts.map +0 -1
- package/dist/schema/consent-record/schema.d.ts +0 -41
- package/dist/schema/consent-record/schema.d.ts.map +0 -1
- package/dist/schema/consent-record/table.d.ts +0 -107
- package/dist/schema/consent-record/table.d.ts.map +0 -1
- package/dist/schema/consent-record/types.d.ts +0 -21
- package/dist/schema/consent-record/types.d.ts.map +0 -1
- package/dist/schema/create-registry.d.ts +0 -218
- package/dist/schema/create-registry.d.ts.map +0 -1
- package/dist/schema/definition.d.ts +0 -586
- package/dist/schema/definition.d.ts.map +0 -1
- package/dist/schema/domain/index.d.ts +0 -4
- package/dist/schema/domain/index.d.ts.map +0 -1
- package/dist/schema/domain/registry.d.ts +0 -222
- package/dist/schema/domain/registry.d.ts.map +0 -1
- package/dist/schema/domain/schema.d.ts +0 -42
- package/dist/schema/domain/schema.d.ts.map +0 -1
- package/dist/schema/domain/table.d.ts +0 -122
- package/dist/schema/domain/table.d.ts.map +0 -1
- package/dist/schema/domain/types.d.ts +0 -27
- package/dist/schema/domain/types.d.ts.map +0 -1
- package/dist/schema/index.cjs +0 -1565
- package/dist/schema/index.d.ts +0 -70
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js +0 -1455
- package/dist/schema/schemas.d.ts +0 -98
- package/dist/schema/schemas.d.ts.map +0 -1
- package/dist/schema/subject/index.d.ts +0 -4
- package/dist/schema/subject/index.d.ts.map +0 -1
- package/dist/schema/subject/registry.d.ts +0 -110
- package/dist/schema/subject/registry.d.ts.map +0 -1
- package/dist/schema/subject/schema.d.ts +0 -40
- package/dist/schema/subject/schema.d.ts.map +0 -1
- package/dist/schema/subject/table.d.ts +0 -120
- package/dist/schema/subject/table.d.ts.map +0 -1
- package/dist/schema/subject/types.d.ts +0 -22
- package/dist/schema/subject/types.d.ts.map +0 -1
- package/dist/schema/types.d.ts +0 -108
- package/dist/schema/types.d.ts.map +0 -1
- package/dist/server.d.ts +0 -2
- package/dist/server.d.ts.map +0 -1
- package/dist/testing/contract-testing.d.ts +0 -38
- package/dist/testing/contract-testing.d.ts.map +0 -1
- package/dist/types/context.d.ts +0 -12
- package/dist/types/context.d.ts.map +0 -1
- package/dist/types/options.d.ts +0 -91
- package/dist/types/options.d.ts.map +0 -1
- package/dist/types/plugins.d.ts +0 -126
- package/dist/types/plugins.d.ts.map +0 -1
- package/dist/v2/contracts/consent/identify.contract.d.ts +0 -24
- package/dist/v2/contracts/consent/identify.contract.d.ts.map +0 -1
- package/dist/v2/contracts/consent/index.d.ts +0 -340
- package/dist/v2/contracts/consent/index.d.ts.map +0 -1
- package/dist/v2/contracts/consent/index.test.d.ts +0 -2
- package/dist/v2/contracts/consent/index.test.d.ts.map +0 -1
- package/dist/v2/contracts/consent/post.contract.d.ts +0 -117
- package/dist/v2/contracts/consent/post.contract.d.ts.map +0 -1
- package/dist/v2/contracts/consent/post.contract.test.d.ts +0 -2
- package/dist/v2/contracts/consent/post.contract.test.d.ts.map +0 -1
- package/dist/v2/contracts/consent/show-banner.contract.d.ts +0 -123
- package/dist/v2/contracts/consent/show-banner.contract.d.ts.map +0 -1
- package/dist/v2/contracts/consent/show-banner.contract.test.d.ts +0 -2
- package/dist/v2/contracts/consent/show-banner.contract.test.d.ts.map +0 -1
- package/dist/v2/contracts/consent/verify.contract.d.ts +0 -81
- package/dist/v2/contracts/consent/verify.contract.d.ts.map +0 -1
- package/dist/v2/contracts/consent/verify.contract.test.d.ts +0 -2
- package/dist/v2/contracts/consent/verify.contract.test.d.ts.map +0 -1
- package/dist/v2/contracts/index.cjs +0 -716
- package/dist/v2/contracts/index.d.ts +0 -723
- package/dist/v2/contracts/index.d.ts.map +0 -1
- package/dist/v2/contracts/index.js +0 -679
- package/dist/v2/contracts/meta/index.d.ts +0 -19
- package/dist/v2/contracts/meta/index.d.ts.map +0 -1
- package/dist/v2/contracts/meta/index.test.d.ts +0 -2
- package/dist/v2/contracts/meta/index.test.d.ts.map +0 -1
- package/dist/v2/contracts/meta/status.contract.d.ts +0 -18
- package/dist/v2/contracts/meta/status.contract.d.ts.map +0 -1
- package/dist/v2/contracts/meta/status.contract.test.d.ts +0 -2
- package/dist/v2/contracts/meta/status.contract.test.d.ts.map +0 -1
- package/dist/v2/contracts/shared/jurisdiction.schema.d.ts +0 -36
- package/dist/v2/contracts/shared/jurisdiction.schema.d.ts.map +0 -1
- package/dist/v2/contracts/test.utils.d.ts +0 -38
- package/dist/v2/contracts/test.utils.d.ts.map +0 -1
- package/dist/v2/core.cjs +0 -2350
- package/dist/v2/core.d.ts +0 -444
- package/dist/v2/core.d.ts.map +0 -1
- package/dist/v2/core.js +0 -2300
- package/dist/v2/db/adapters/drizzle.cjs +0 -36
- package/dist/v2/db/adapters/drizzle.d.ts.map +0 -1
- package/dist/v2/db/adapters/index.cjs +0 -18
- package/dist/v2/db/adapters/index.d.ts.map +0 -1
- package/dist/v2/db/adapters/index.js +0 -0
- package/dist/v2/db/adapters/kysely.cjs +0 -36
- package/dist/v2/db/adapters/kysely.d.ts.map +0 -1
- package/dist/v2/db/adapters/mongo.cjs +0 -36
- package/dist/v2/db/adapters/mongo.d.ts.map +0 -1
- package/dist/v2/db/adapters/prisma.cjs +0 -36
- package/dist/v2/db/adapters/prisma.d.ts.map +0 -1
- package/dist/v2/db/adapters/typeorm.cjs +0 -36
- package/dist/v2/db/adapters/typeorm.d.ts.map +0 -1
- package/dist/v2/db/migrator/index.cjs +0 -61
- package/dist/v2/db/migrator/index.d.ts.map +0 -1
- package/dist/v2/db/registry/audit-log.d.ts +0 -21
- package/dist/v2/db/registry/audit-log.d.ts.map +0 -1
- package/dist/v2/db/registry/audit-log.test.d.ts +0 -2
- package/dist/v2/db/registry/audit-log.test.d.ts.map +0 -1
- package/dist/v2/db/registry/consent-policy.d.ts +0 -29
- package/dist/v2/db/registry/consent-policy.d.ts.map +0 -1
- package/dist/v2/db/registry/consent-policy.test.d.ts +0 -2
- package/dist/v2/db/registry/consent-policy.test.d.ts.map +0 -1
- package/dist/v2/db/registry/consent-purpose.d.ts +0 -16
- package/dist/v2/db/registry/consent-purpose.d.ts.map +0 -1
- package/dist/v2/db/registry/consent-purpose.test.d.ts +0 -2
- package/dist/v2/db/registry/consent-purpose.test.d.ts.map +0 -1
- package/dist/v2/db/registry/consent.d.ts +0 -20
- package/dist/v2/db/registry/consent.d.ts.map +0 -1
- package/dist/v2/db/registry/consent.test.d.ts +0 -2
- package/dist/v2/db/registry/consent.test.d.ts.map +0 -1
- package/dist/v2/db/registry/domain.d.ts +0 -24
- package/dist/v2/db/registry/domain.d.ts.map +0 -1
- package/dist/v2/db/registry/domain.test.d.ts +0 -2
- package/dist/v2/db/registry/domain.test.d.ts.map +0 -1
- package/dist/v2/db/registry/index.d.ts +0 -103
- package/dist/v2/db/registry/index.d.ts.map +0 -1
- package/dist/v2/db/registry/subject.d.ts +0 -19
- package/dist/v2/db/registry/subject.d.ts.map +0 -1
- package/dist/v2/db/registry/subject.test.d.ts +0 -2
- package/dist/v2/db/registry/subject.test.d.ts.map +0 -1
- package/dist/v2/db/registry/types.d.ts +0 -10
- package/dist/v2/db/registry/types.d.ts.map +0 -1
- package/dist/v2/db/registry/utils/generate-id.d.ts +0 -25
- package/dist/v2/db/registry/utils/generate-id.d.ts.map +0 -1
- package/dist/v2/db/registry/utils/generate-id.test.d.ts +0 -2
- package/dist/v2/db/registry/utils/generate-id.test.d.ts.map +0 -1
- package/dist/v2/db/registry/utils.d.ts +0 -25
- package/dist/v2/db/registry/utils.d.ts.map +0 -1
- package/dist/v2/db/schema/1.0.0/audit-log.d.ts +0 -29
- package/dist/v2/db/schema/1.0.0/audit-log.d.ts.map +0 -1
- package/dist/v2/db/schema/1.0.0/consent-policy.d.ts +0 -45
- package/dist/v2/db/schema/1.0.0/consent-policy.d.ts.map +0 -1
- package/dist/v2/db/schema/1.0.0/consent-purpose.d.ts +0 -27
- package/dist/v2/db/schema/1.0.0/consent-purpose.d.ts.map +0 -1
- package/dist/v2/db/schema/1.0.0/consent-record.d.ts +0 -19
- package/dist/v2/db/schema/1.0.0/consent-record.d.ts.map +0 -1
- package/dist/v2/db/schema/1.0.0/consent.d.ts +0 -42
- package/dist/v2/db/schema/1.0.0/consent.d.ts.map +0 -1
- package/dist/v2/db/schema/1.0.0/domain.d.ts +0 -23
- package/dist/v2/db/schema/1.0.0/domain.d.ts.map +0 -1
- package/dist/v2/db/schema/1.0.0/index.d.ts +0 -1513
- package/dist/v2/db/schema/1.0.0/index.d.ts.map +0 -1
- package/dist/v2/db/schema/1.0.0/subject.d.ts +0 -23
- package/dist/v2/db/schema/1.0.0/subject.d.ts.map +0 -1
- package/dist/v2/db/schema/index.cjs +0 -326
- package/dist/v2/db/schema/index.d.ts +0 -1507
- package/dist/v2/db/schema/index.d.ts.map +0 -1
- package/dist/v2/db/schema/index.js +0 -241
- package/dist/v2/define-config.cjs +0 -36
- package/dist/v2/define-config.d.ts.map +0 -1
- package/dist/v2/handlers/consent/identify.handler.d.ts +0 -23
- package/dist/v2/handlers/consent/identify.handler.d.ts.map +0 -1
- package/dist/v2/handlers/consent/identify.handler.test.d.ts +0 -2
- package/dist/v2/handlers/consent/identify.handler.test.d.ts.map +0 -1
- package/dist/v2/handlers/consent/index.d.ts +0 -340
- package/dist/v2/handlers/consent/index.d.ts.map +0 -1
- package/dist/v2/handlers/consent/post.handler.d.ts +0 -139
- package/dist/v2/handlers/consent/post.handler.d.ts.map +0 -1
- package/dist/v2/handlers/consent/show-banner/geo.d.ts +0 -10
- package/dist/v2/handlers/consent/show-banner/geo.d.ts.map +0 -1
- package/dist/v2/handlers/consent/show-banner/geo.test.d.ts +0 -2
- package/dist/v2/handlers/consent/show-banner/geo.test.d.ts.map +0 -1
- package/dist/v2/handlers/consent/show-banner/handler.d.ts +0 -126
- package/dist/v2/handlers/consent/show-banner/handler.d.ts.map +0 -1
- package/dist/v2/handlers/consent/show-banner/handler.test.d.ts +0 -2
- package/dist/v2/handlers/consent/show-banner/handler.test.d.ts.map +0 -1
- package/dist/v2/handlers/consent/show-banner/translations.d.ts +0 -13
- package/dist/v2/handlers/consent/show-banner/translations.d.ts.map +0 -1
- package/dist/v2/handlers/consent/show-banner/translations.test.d.ts +0 -2
- package/dist/v2/handlers/consent/show-banner/translations.test.d.ts.map +0 -1
- package/dist/v2/handlers/consent/verify.handler.d.ts +0 -103
- package/dist/v2/handlers/consent/verify.handler.d.ts.map +0 -1
- package/dist/v2/handlers/meta/index.d.ts +0 -19
- package/dist/v2/handlers/meta/index.d.ts.map +0 -1
- package/dist/v2/handlers/meta/status.handler.d.ts +0 -17
- package/dist/v2/handlers/meta/status.handler.d.ts.map +0 -1
- package/dist/v2/init.d.ts +0 -3
- package/dist/v2/init.d.ts.map +0 -1
- package/dist/v2/init.test.d.ts +0 -2
- package/dist/v2/init.test.d.ts.map +0 -1
- package/dist/v2/middleware/cors/cors.d.ts +0 -37
- package/dist/v2/middleware/cors/cors.d.ts.map +0 -1
- package/dist/v2/middleware/cors/cors.test.d.ts +0 -2
- package/dist/v2/middleware/cors/cors.test.d.ts.map +0 -1
- package/dist/v2/middleware/cors/index.d.ts +0 -30
- package/dist/v2/middleware/cors/index.d.ts.map +0 -1
- package/dist/v2/middleware/cors/is-origin-trusted.d.ts +0 -49
- package/dist/v2/middleware/cors/is-origin-trusted.d.ts.map +0 -1
- package/dist/v2/middleware/cors/is-origin-trusted.test.d.ts +0 -2
- package/dist/v2/middleware/cors/is-origin-trusted.test.d.ts.map +0 -1
- package/dist/v2/middleware/cors/process-cors.d.ts +0 -31
- package/dist/v2/middleware/cors/process-cors.d.ts.map +0 -1
- package/dist/v2/middleware/openapi/config.d.ts +0 -28
- package/dist/v2/middleware/openapi/config.d.ts.map +0 -1
- package/dist/v2/middleware/openapi/handlers.d.ts +0 -29
- package/dist/v2/middleware/openapi/handlers.d.ts.map +0 -1
- package/dist/v2/middleware/openapi/index.d.ts +0 -11
- package/dist/v2/middleware/openapi/index.d.ts.map +0 -1
- package/dist/v2/middleware/process-ip/index.d.ts +0 -3
- package/dist/v2/middleware/process-ip/index.d.ts.map +0 -1
- package/dist/v2/router.cjs +0 -1442
- package/dist/v2/router.d.ts +0 -360
- package/dist/v2/router.d.ts.map +0 -1
- package/dist/v2/router.js +0 -1398
- package/dist/v2/types/api.d.ts +0 -27
- package/dist/v2/types/api.d.ts.map +0 -1
- package/dist/v2/types/index.cjs +0 -40
- package/dist/v2/types/index.d.ts +0 -104
- package/dist/v2/types/index.d.ts.map +0 -1
- package/dist/v2/types/index.js +0 -6
- package/dist/v2/utils/create-telemetry-options.d.ts +0 -28
- package/dist/v2/utils/create-telemetry-options.d.ts.map +0 -1
- package/dist/v2/utils/env.d.ts +0 -60
- package/dist/v2/utils/env.d.ts.map +0 -1
- package/dist/v2/utils/index.d.ts +0 -3
- package/dist/v2/utils/index.d.ts.map +0 -1
- package/dist/v2/utils/logger.d.ts +0 -16
- package/dist/v2/utils/logger.d.ts.map +0 -1
- package/src/__tests__/server.test.ts +0 -100
- package/src/contracts/consent/identify.contract.ts +0 -38
- package/src/contracts/consent/index.test.ts +0 -5
- package/src/contracts/consent/index.ts +0 -11
- package/src/contracts/consent/post.contract.test.ts +0 -521
- package/src/contracts/consent/post.contract.ts +0 -156
- package/src/contracts/consent/show-banner.contract.test.ts +0 -260
- package/src/contracts/consent/show-banner.contract.ts +0 -136
- package/src/contracts/consent/verify.contract.test.ts +0 -185
- package/src/contracts/consent/verify.contract.ts +0 -122
- package/src/contracts/index.ts +0 -20
- package/src/contracts/meta/index.test.ts +0 -5
- package/src/contracts/meta/index.ts +0 -5
- package/src/contracts/meta/status.contract.test.ts +0 -338
- package/src/contracts/meta/status.contract.ts +0 -37
- package/src/contracts/shared/jurisdiction.schema.ts +0 -30
- package/src/handlers/consent/identify.handler.test.ts +0 -473
- package/src/handlers/consent/identify.handler.ts +0 -176
- package/src/handlers/consent/post.handler.ts +0 -277
- package/src/handlers/consent/show-banner/geo.test.ts +0 -281
- package/src/handlers/consent/show-banner/geo.ts +0 -96
- package/src/handlers/consent/show-banner/handler.test.ts +0 -376
- package/src/handlers/consent/show-banner/handler.ts +0 -123
- package/src/handlers/consent/show-banner/translations.test.ts +0 -121
- package/src/handlers/consent/show-banner/translations.ts +0 -79
- package/src/handlers/consent/verify.handler.ts +0 -305
- package/src/handlers/meta/index.ts +0 -5
- package/src/handlers/meta/status.handler.ts +0 -47
- package/src/pkgs/api-router/hooks/__tests__/processor.test.ts +0 -290
- package/src/pkgs/api-router/hooks/processor.ts +0 -153
- package/src/pkgs/api-router/telemetry.ts +0 -83
- package/src/pkgs/api-router/types/router-props.ts +0 -36
- package/src/pkgs/api-router/utils/ip.ts +0 -92
- package/src/pkgs/data-model/fields/field-factory.ts +0 -208
- package/src/pkgs/data-model/fields/field-inference.ts +0 -93
- package/src/pkgs/data-model/fields/field-types.ts +0 -233
- package/src/pkgs/data-model/fields/id-generator.ts +0 -57
- package/src/pkgs/data-model/fields/index.ts +0 -37
- package/src/pkgs/data-model/fields/superjson-utils.ts +0 -17
- package/src/pkgs/data-model/fields/zod-fields.ts +0 -125
- package/src/pkgs/data-model/hooks/create-hooks.ts +0 -88
- package/src/pkgs/data-model/hooks/index.ts +0 -40
- package/src/pkgs/data-model/hooks/types.ts +0 -165
- package/src/pkgs/data-model/hooks/update-hooks.ts +0 -91
- package/src/pkgs/data-model/hooks/update-many-hooks.ts +0 -176
- package/src/pkgs/data-model/hooks/utils.ts +0 -151
- package/src/pkgs/data-model/hooks/with-hooks-factory.ts +0 -68
- package/src/pkgs/data-model/index.ts +0 -13
- package/src/pkgs/data-model/schema/index.ts +0 -19
- package/src/pkgs/data-model/schema/schemas.ts +0 -15
- package/src/pkgs/data-model/schema/types.ts +0 -105
- package/src/pkgs/db-adapters/README.md +0 -95
- package/src/pkgs/db-adapters/adapter-factory.ts +0 -68
- package/src/pkgs/db-adapters/adapters/drizzle-adapter/drizzle-adapter.ts +0 -709
- package/src/pkgs/db-adapters/adapters/drizzle-adapter/index.ts +0 -1
- package/src/pkgs/db-adapters/adapters/index.ts +0 -10
- package/src/pkgs/db-adapters/adapters/kysely-adapter/dialect.ts +0 -195
- package/src/pkgs/db-adapters/adapters/kysely-adapter/index.ts +0 -10
- package/src/pkgs/db-adapters/adapters/kysely-adapter/kysely-adapter.ts +0 -1182
- package/src/pkgs/db-adapters/adapters/kysely-adapter/tests/postgres.test.ts +0 -214
- package/src/pkgs/db-adapters/adapters/kysely-adapter/tests/sqlite.test.ts +0 -227
- package/src/pkgs/db-adapters/adapters/kysely-adapter/tests/test-utils.ts +0 -439
- package/src/pkgs/db-adapters/adapters/kysely-adapter/types.ts +0 -304
- package/src/pkgs/db-adapters/adapters/memory-adapter/index.ts +0 -1
- package/src/pkgs/db-adapters/adapters/memory-adapter/memory-adapter.ts +0 -665
- package/src/pkgs/db-adapters/adapters/prisma-adapter/index.ts +0 -1
- package/src/pkgs/db-adapters/adapters/prisma-adapter/prisma-adapter.ts +0 -586
- package/src/pkgs/db-adapters/adapters/test.ts +0 -77
- package/src/pkgs/db-adapters/index.ts +0 -28
- package/src/pkgs/db-adapters/types.ts +0 -211
- package/src/pkgs/db-adapters/utils.ts +0 -51
- package/src/pkgs/migrations/README.md +0 -73
- package/src/pkgs/migrations/get-migration.ts +0 -88
- package/src/pkgs/migrations/get-schema/get-schema.ts +0 -43
- package/src/pkgs/migrations/get-schema/index.ts +0 -20
- package/src/pkgs/migrations/get-schema/process-fields.ts +0 -65
- package/src/pkgs/migrations/get-schema/process-tables.ts +0 -66
- package/src/pkgs/migrations/get-schema/types.ts +0 -18
- package/src/pkgs/migrations/index.ts +0 -30
- package/src/pkgs/migrations/migration-builders.ts +0 -170
- package/src/pkgs/migrations/migration-execution.ts +0 -72
- package/src/pkgs/migrations/schema-comparison.ts +0 -203
- package/src/pkgs/migrations/type-mapping.ts +0 -244
- package/src/pkgs/migrations/types.ts +0 -48
- package/src/pkgs/results/README.md +0 -345
- package/src/pkgs/results/__tests__/error-class.test.ts +0 -183
- package/src/pkgs/results/__tests__/error-codes.test.ts +0 -81
- package/src/pkgs/results/__tests__/neverthrow-integration.test.ts +0 -92
- package/src/pkgs/results/__tests__/recovery-utils.test.ts +0 -140
- package/src/pkgs/results/__tests__/result-helpers.test.ts +0 -206
- package/src/pkgs/results/core/error-class.ts +0 -297
- package/src/pkgs/results/core/error-codes.ts +0 -206
- package/src/pkgs/results/core/tracing.ts +0 -65
- package/src/pkgs/results/create-telemetry-options.ts +0 -62
- package/src/pkgs/results/index.ts +0 -115
- package/src/pkgs/results/orpc-error-handler.ts +0 -137
- package/src/pkgs/results/results/recovery-utils.ts +0 -181
- package/src/pkgs/results/results/result-helpers.ts +0 -383
- package/src/pkgs/results/types.ts +0 -217
- package/src/pkgs/types/context.ts +0 -178
- package/src/pkgs/types/endpoints.ts +0 -35
- package/src/pkgs/types/helper.ts +0 -57
- package/src/pkgs/types/index.ts +0 -18
- package/src/pkgs/types/options.ts +0 -252
- package/src/pkgs/types/plugins.ts +0 -191
- package/src/pkgs/utils/index.ts +0 -3
- package/src/pkgs/utils/logger.ts +0 -35
- package/src/pkgs/utils/url.ts +0 -105
- package/src/schema/audit-log/index.ts +0 -3
- package/src/schema/audit-log/registry.ts +0 -117
- package/src/schema/audit-log/schema.ts +0 -46
- package/src/schema/audit-log/table.ts +0 -185
- package/src/schema/audit-log/types.ts +0 -29
- package/src/schema/consent/index.ts +0 -3
- package/src/schema/consent/registry.ts +0 -177
- package/src/schema/consent/schema.ts +0 -51
- package/src/schema/consent/table.ts +0 -221
- package/src/schema/consent/types.ts +0 -39
- package/src/schema/consent-policy/index.ts +0 -3
- package/src/schema/consent-policy/registry.ts +0 -352
- package/src/schema/consent-policy/schema.ts +0 -60
- package/src/schema/consent-policy/table.ts +0 -150
- package/src/schema/consent-policy/types.ts +0 -29
- package/src/schema/consent-purpose/index.ts +0 -3
- package/src/schema/consent-purpose/registry.ts +0 -168
- package/src/schema/consent-purpose/schema.ts +0 -58
- package/src/schema/consent-purpose/table.ts +0 -154
- package/src/schema/consent-purpose/types.ts +0 -16
- package/src/schema/consent-record/index.ts +0 -2
- package/src/schema/consent-record/schema.ts +0 -42
- package/src/schema/consent-record/table.ts +0 -124
- package/src/schema/consent-record/types.ts +0 -21
- package/src/schema/create-registry.ts +0 -21
- package/src/schema/definition.ts +0 -200
- package/src/schema/domain/index.ts +0 -3
- package/src/schema/domain/registry.ts +0 -296
- package/src/schema/domain/schema.ts +0 -43
- package/src/schema/domain/table.ts +0 -137
- package/src/schema/domain/types.ts +0 -27
- package/src/schema/index.ts +0 -74
- package/src/schema/schemas.ts +0 -27
- package/src/schema/subject/index.ts +0 -3
- package/src/schema/subject/registry.ts +0 -298
- package/src/schema/subject/schema.ts +0 -41
- package/src/schema/subject/table.ts +0 -138
- package/src/schema/subject/types.ts +0 -22
- package/src/schema/types.ts +0 -121
- package/src/server.ts +0 -126
- package/src/testing/contract-testing.ts +0 -400
- package/src/types/context.ts +0 -16
- package/src/types/options.ts +0 -103
- package/src/types/plugins.ts +0 -154
- package/src/v2/contracts/consent/identify.contract.ts +0 -38
- package/src/v2/contracts/consent/index.test.ts +0 -5
- package/src/v2/contracts/consent/index.ts +0 -11
- package/src/v2/contracts/consent/post.contract.test.ts +0 -521
- package/src/v2/contracts/consent/post.contract.ts +0 -156
- package/src/v2/contracts/consent/show-banner.contract.test.ts +0 -252
- package/src/v2/contracts/consent/show-banner.contract.ts +0 -136
- package/src/v2/contracts/consent/verify.contract.test.ts +0 -185
- package/src/v2/contracts/consent/verify.contract.ts +0 -122
- package/src/v2/contracts/index.ts +0 -20
- package/src/v2/contracts/meta/index.test.ts +0 -5
- package/src/v2/contracts/meta/index.ts +0 -5
- package/src/v2/contracts/meta/status.contract.test.ts +0 -226
- package/src/v2/contracts/meta/status.contract.ts +0 -34
- package/src/v2/contracts/shared/jurisdiction.schema.ts +0 -30
- package/src/v2/contracts/test.utils.ts +0 -400
- package/src/v2/core.ts +0 -379
- package/src/v2/db/migrator/index.ts +0 -80
- package/src/v2/db/registry/audit-log.test.ts +0 -77
- package/src/v2/db/registry/audit-log.ts +0 -46
- package/src/v2/db/registry/consent-policy.test.ts +0 -778
- package/src/v2/db/registry/consent-policy.ts +0 -74
- package/src/v2/db/registry/consent-purpose.test.ts +0 -485
- package/src/v2/db/registry/consent-purpose.ts +0 -41
- package/src/v2/db/registry/consent.test.ts +0 -843
- package/src/v2/db/registry/consent.ts +0 -42
- package/src/v2/db/registry/domain.test.ts +0 -463
- package/src/v2/db/registry/domain.ts +0 -51
- package/src/v2/db/registry/index.ts +0 -18
- package/src/v2/db/registry/subject.test.ts +0 -497
- package/src/v2/db/registry/subject.ts +0 -103
- package/src/v2/db/registry/types.ts +0 -10
- package/src/v2/db/registry/utils/generate-id.test.ts +0 -217
- package/src/v2/db/registry/utils/generate-id.ts +0 -134
- package/src/v2/db/registry/utils.ts +0 -134
- package/src/v2/db/schema/1.0.0/audit-log.ts +0 -32
- package/src/v2/db/schema/1.0.0/consent-policy.ts +0 -41
- package/src/v2/db/schema/1.0.0/consent-purpose.ts +0 -30
- package/src/v2/db/schema/1.0.0/consent-record.ts +0 -22
- package/src/v2/db/schema/1.0.0/consent.ts +0 -38
- package/src/v2/db/schema/1.0.0/domain.ts +0 -26
- package/src/v2/db/schema/1.0.0/index.ts +0 -56
- package/src/v2/db/schema/1.0.0/subject.ts +0 -26
- package/src/v2/db/schema/index.ts +0 -9
- package/src/v2/handlers/consent/identify.handler.test.ts +0 -453
- package/src/v2/handlers/consent/identify.handler.ts +0 -125
- package/src/v2/handlers/consent/index.ts +0 -11
- package/src/v2/handlers/consent/post.handler.ts +0 -258
- package/src/v2/handlers/consent/show-banner/geo.test.ts +0 -281
- package/src/v2/handlers/consent/show-banner/geo.ts +0 -96
- package/src/v2/handlers/consent/show-banner/handler.test.ts +0 -374
- package/src/v2/handlers/consent/show-banner/handler.ts +0 -123
- package/src/v2/handlers/consent/show-banner/translations.test.ts +0 -121
- package/src/v2/handlers/consent/show-banner/translations.ts +0 -79
- package/src/v2/handlers/consent/verify.handler.ts +0 -288
- package/src/v2/handlers/meta/index.ts +0 -5
- package/src/v2/handlers/meta/status.handler.ts +0 -43
- package/src/v2/init.test.ts +0 -120
- package/src/v2/init.ts +0 -126
- package/src/v2/middleware/cors/cors.test.ts +0 -114
- package/src/v2/middleware/cors/cors.ts +0 -195
- package/src/v2/middleware/cors/index.ts +0 -30
- package/src/v2/middleware/cors/is-origin-trusted.test.ts +0 -164
- package/src/v2/middleware/cors/is-origin-trusted.ts +0 -129
- package/src/v2/middleware/cors/process-cors.ts +0 -91
- package/src/v2/middleware/openapi/config.ts +0 -27
- package/src/v2/middleware/openapi/handlers.ts +0 -132
- package/src/v2/middleware/openapi/index.ts +0 -11
- package/src/v2/middleware/process-ip/index.ts +0 -39
- package/src/v2/router.ts +0 -8
- package/src/v2/types/api.ts +0 -32
- package/src/v2/types/index.ts +0 -121
- package/src/v2/utils/create-telemetry-options.ts +0 -115
- package/src/v2/utils/env.ts +0 -84
- package/src/v2/utils/index.ts +0 -2
- package/src/v2/utils/logger.ts +0 -35
- /package/dist/{v2/db → db}/adapters/drizzle.d.ts +0 -0
- /package/dist/{v2/db → db}/adapters/drizzle.js +0 -0
- /package/dist/{v2/db → db}/adapters/index.d.ts +0 -0
- /package/dist/{v2/db → db}/adapters/kysely.d.ts +0 -0
- /package/dist/{v2/db → db}/adapters/kysely.js +0 -0
- /package/dist/{v2/db → db}/adapters/mongo.d.ts +0 -0
- /package/dist/{v2/db → db}/adapters/mongo.js +0 -0
- /package/dist/{v2/db → db}/adapters/prisma.d.ts +0 -0
- /package/dist/{v2/db → db}/adapters/prisma.js +0 -0
- /package/dist/{v2/db → db}/adapters/typeorm.d.ts +0 -0
- /package/dist/{v2/db → db}/adapters/typeorm.js +0 -0
- /package/dist/{pkgs/types/index.js → db/adapters.js} +0 -0
- /package/dist/{v2/db → db}/migrator/index.d.ts +0 -0
- /package/dist/{v2/db/migrator/index.js → db/migrator.js} +0 -0
- /package/dist/{v2/define-config.d.ts → define-config.d.ts} +0 -0
- /package/dist/{v2/define-config.js → define-config.js} +0 -0
- /package/dist/{pkgs/utils → utils}/env.d.ts +0 -0
- /package/dist/{pkgs/utils → utils}/logger.d.ts +0 -0
- /package/src/{v2/db → db}/adapters/drizzle.ts +0 -0
- /package/src/{v2/db → db}/adapters/index.ts +0 -0
- /package/src/{v2/db → db}/adapters/kysely.ts +0 -0
- /package/src/{v2/db → db}/adapters/mongo.ts +0 -0
- /package/src/{v2/db → db}/adapters/prisma.ts +0 -0
- /package/src/{v2/db → db}/adapters/typeorm.ts +0 -0
- /package/src/{v2/define-config.ts → define-config.ts} +0 -0
- /package/src/{pkgs/utils → utils}/env.ts +0 -0
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import type { Migration } from 'kysely';
|
|
2
|
-
import type { Field } from '~/pkgs/data-model';
|
|
3
|
-
import type { DoubleTieContext, HookEndpointContext } from './context';
|
|
4
|
-
import type { Endpoint, EndpointMiddleware } from './endpoints';
|
|
5
|
-
import type { DeepPartial, LiteralString } from './helper';
|
|
6
|
-
import type { DoubleTieMiddleware, DoubleTieOptions } from './options';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Context object provided to plugin hooks
|
|
10
|
-
*
|
|
11
|
-
* This extends the standard endpoint context with additional properties
|
|
12
|
-
* specific to plugin hooks, such as the request path and geolocation data.
|
|
13
|
-
*/
|
|
14
|
-
export interface PluginHookContext {
|
|
15
|
-
/**
|
|
16
|
-
* The path of the current request
|
|
17
|
-
*/
|
|
18
|
-
path: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Core DoubleTie plugin interface
|
|
23
|
-
*
|
|
24
|
-
* Defines the structure that all DoubleTie plugins must conform to,
|
|
25
|
-
* including lifecycle methods, hooks, endpoints, and type information.
|
|
26
|
-
*/
|
|
27
|
-
export interface DoubleTiePlugin {
|
|
28
|
-
/**
|
|
29
|
-
* Unique identifier for the plugin
|
|
30
|
-
* Must be a string literal for type safety
|
|
31
|
-
*/
|
|
32
|
-
id: LiteralString;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Name of the plugin
|
|
36
|
-
*/
|
|
37
|
-
name: string;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Type of plugin for classification and type guards
|
|
41
|
-
*/
|
|
42
|
-
type: string;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The init function is called when the plugin is initialized.
|
|
46
|
-
* You can return a new context or modify the existing context.
|
|
47
|
-
*
|
|
48
|
-
* @param ctx - The DoubleTie context
|
|
49
|
-
* @returns An object with context or options modifications, or undefined
|
|
50
|
-
*/
|
|
51
|
-
init?: (ctx: DoubleTieContext) =>
|
|
52
|
-
| {
|
|
53
|
-
context?: DeepPartial<Omit<DoubleTieContext, 'options'>>;
|
|
54
|
-
options?: Partial<DoubleTieOptions>;
|
|
55
|
-
}
|
|
56
|
-
| undefined;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Custom API endpoints provided by this plugin
|
|
60
|
-
* Each key is the endpoint name, and the value is the endpoint handler
|
|
61
|
-
*/
|
|
62
|
-
endpoints?: {
|
|
63
|
-
[key: string]: Endpoint;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Middleware functions to process requests for specific paths
|
|
68
|
-
*/
|
|
69
|
-
middlewares?: {
|
|
70
|
-
path: string;
|
|
71
|
-
middleware: EndpointMiddleware;
|
|
72
|
-
}[];
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Handler for intercepting and potentially modifying incoming requests
|
|
76
|
-
*/
|
|
77
|
-
onRequest?: (request: Request, ctx: DoubleTieContext) => Promise<unknown>;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Handler for intercepting and potentially modifying outgoing responses
|
|
81
|
-
*/
|
|
82
|
-
onResponse?: (response: Response, ctx: DoubleTieContext) => Promise<unknown>;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Request lifecycle hooks for executing code before or after endpoint handling
|
|
86
|
-
*/
|
|
87
|
-
hooks?: {
|
|
88
|
-
/**
|
|
89
|
-
* Hooks that run before the endpoint handler
|
|
90
|
-
* Each hook has a matcher to determine when it should run
|
|
91
|
-
*/
|
|
92
|
-
before?: {
|
|
93
|
-
matcher: (context: HookEndpointContext) => boolean;
|
|
94
|
-
handler: DoubleTieMiddleware;
|
|
95
|
-
}[];
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Hooks that run after the endpoint handler has completed
|
|
99
|
-
* Each hook has a matcher to determine when it should run
|
|
100
|
-
*/
|
|
101
|
-
after?: {
|
|
102
|
-
matcher: (context: HookEndpointContext) => boolean;
|
|
103
|
-
handler: DoubleTieMiddleware;
|
|
104
|
-
}[];
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Schema the plugin needs
|
|
109
|
-
*
|
|
110
|
-
* This will also be used to migrate the database. If the fields are dynamic from the plugins
|
|
111
|
-
* configuration each time the configuration is changed a new migration will be created.
|
|
112
|
-
*
|
|
113
|
-
* NOTE: If you want to create migrations manually using
|
|
114
|
-
* migrations option or any other way you
|
|
115
|
-
* can disable migration per table basis.
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```ts
|
|
119
|
-
* schema: {
|
|
120
|
-
* subject: {
|
|
121
|
-
* fields: {
|
|
122
|
-
* email: {
|
|
123
|
-
* type: "string",
|
|
124
|
-
* },
|
|
125
|
-
* emailVerified: {
|
|
126
|
-
* type: "boolean",
|
|
127
|
-
* defaultValue: false,
|
|
128
|
-
* },
|
|
129
|
-
* },
|
|
130
|
-
* }
|
|
131
|
-
* } as AuthPluginSchema
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
schema?: DoubleTiePluginSchema;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* The migrations of the plugin. If you define schema that will automatically create
|
|
138
|
-
* migrations for you.
|
|
139
|
-
*
|
|
140
|
-
* ⚠️ Only uses this if you dont't want to use the schema option and you disabled migrations for
|
|
141
|
-
* the tables.
|
|
142
|
-
*/
|
|
143
|
-
migrations?: Record<string, Migration>;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* The options of the plugin
|
|
147
|
-
*/
|
|
148
|
-
options?: Record<string, unknown>;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Types to be inferred by the type system
|
|
152
|
-
* Used for type information in the plugin system
|
|
153
|
-
*/
|
|
154
|
-
$Infer?: Record<string, unknown>;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* The error codes returned by the plugin
|
|
158
|
-
* Used for consistent error handling across the system
|
|
159
|
-
*/
|
|
160
|
-
$ERROR_CODES?: Record<string, string>;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Type information for context extensions provided by this plugin
|
|
164
|
-
* This will be used to properly type the context in hooks and methods
|
|
165
|
-
*/
|
|
166
|
-
$InferContext?: Record<string, unknown>;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Plugin schema definition
|
|
171
|
-
*
|
|
172
|
-
* Defines the database schema extensions that a plugin may require.
|
|
173
|
-
*/
|
|
174
|
-
export interface DoubleTiePluginSchema {
|
|
175
|
-
[tableName: string]: {
|
|
176
|
-
/**
|
|
177
|
-
* Should migrations be created for this table when using auto migrations
|
|
178
|
-
*
|
|
179
|
-
* If you want to create migrations manually using the migrations
|
|
180
|
-
* option or any other way you can disable migration per table.
|
|
181
|
-
*
|
|
182
|
-
* @default true
|
|
183
|
-
*/
|
|
184
|
-
createMigrations?: boolean;
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Fields to add to the table
|
|
188
|
-
*/
|
|
189
|
-
fields: Record<string, Field>;
|
|
190
|
-
};
|
|
191
|
-
}
|
package/src/pkgs/utils/index.ts
DELETED
package/src/pkgs/utils/logger.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createLogger, type LoggerOptions } from '@c15t/logger';
|
|
2
|
-
|
|
3
|
-
let globalLogger: ReturnType<typeof createLogger>;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Gets or creates a global logger instance
|
|
7
|
-
*
|
|
8
|
-
* @param options - Optional logger configuration options
|
|
9
|
-
* @returns The global logger instance
|
|
10
|
-
*/
|
|
11
|
-
export function getLogger(
|
|
12
|
-
options?: LoggerOptions
|
|
13
|
-
): ReturnType<typeof createLogger> {
|
|
14
|
-
if (!globalLogger) {
|
|
15
|
-
globalLogger = createLogger({
|
|
16
|
-
level: 'info',
|
|
17
|
-
appName: 'c15t',
|
|
18
|
-
...options,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return globalLogger;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Initializes the global logger with specific options
|
|
26
|
-
*
|
|
27
|
-
* @param options - Logger configuration options
|
|
28
|
-
* @returns The initialized global logger instance
|
|
29
|
-
*/
|
|
30
|
-
export function initLogger(
|
|
31
|
-
options: LoggerOptions
|
|
32
|
-
): ReturnType<typeof createLogger> {
|
|
33
|
-
globalLogger = createLogger(options);
|
|
34
|
-
return globalLogger;
|
|
35
|
-
}
|
package/src/pkgs/utils/url.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { DoubleTieError, ERROR_CODES } from '~/pkgs/results';
|
|
2
|
-
import { env } from './env';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Regular expression to match trailing slashes in URLs
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
const TRAILING_SLASHES_REGEX = /\/+$/;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Checks if a URL contains a path component other than root
|
|
13
|
-
*
|
|
14
|
-
* @param url - The URL to check for path components
|
|
15
|
-
* @returns Boolean indicating whether the URL has a non-root path
|
|
16
|
-
*
|
|
17
|
-
* @throws {DoubleTieError} When the provided URL is invalid
|
|
18
|
-
*
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
function checkHasPath(url: string): boolean {
|
|
22
|
-
try {
|
|
23
|
-
const parsedUrl = new URL(url);
|
|
24
|
-
return parsedUrl.pathname !== '/';
|
|
25
|
-
} catch {
|
|
26
|
-
throw new DoubleTieError(
|
|
27
|
-
`Invalid base URL: ${url}. Please provide a valid base URL.`,
|
|
28
|
-
{
|
|
29
|
-
code: ERROR_CODES.BAD_REQUEST,
|
|
30
|
-
status: 400,
|
|
31
|
-
meta: {
|
|
32
|
-
url,
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Appends a path to a URL if it doesn't already have one
|
|
41
|
-
*
|
|
42
|
-
* This function ensures a URL has a path component by adding the
|
|
43
|
-
* specified path if the URL only has a root path.
|
|
44
|
-
*
|
|
45
|
-
* @param url - The base URL to potentially add a path to
|
|
46
|
-
* @param path - The path to append if needed (defaults to '/api/auth')
|
|
47
|
-
* @returns The URL with the path component
|
|
48
|
-
*
|
|
49
|
-
* @throws {DoubleTieError} When the provided URL is invalid
|
|
50
|
-
*
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
function withPath(url: string, path = '/api/auth') {
|
|
54
|
-
const hasPath = checkHasPath(url);
|
|
55
|
-
if (hasPath) {
|
|
56
|
-
return url;
|
|
57
|
-
}
|
|
58
|
-
const pathWithSlash = path.startsWith('/') ? path : `/${path}`;
|
|
59
|
-
return `${url.replace(TRAILING_SLASHES_REGEX, '')}${pathWithSlash}`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Determines the base URL for API requests
|
|
64
|
-
*
|
|
65
|
-
* Attempts to derive a base URL from multiple sources in the following order:
|
|
66
|
-
* 1. The provided URL parameter
|
|
67
|
-
* 2. Various environment variables
|
|
68
|
-
* 3. Current window location (if in browser)
|
|
69
|
-
*
|
|
70
|
-
* @param url - Optional explicit URL to use
|
|
71
|
-
* @param path - Optional path to append to the URL if it doesn't have one
|
|
72
|
-
* @returns The determined base URL or undefined if unable to determine
|
|
73
|
-
*
|
|
74
|
-
* @throws {DoubleTieError} When the provided URL is invalid
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```ts
|
|
78
|
-
* // Get the base URL with default path ('/api/auth')
|
|
79
|
-
* const baseUrl = getBaseURL();
|
|
80
|
-
*
|
|
81
|
-
* // Get the base URL with custom path
|
|
82
|
-
* const apiUrl = getBaseURL(undefined, '/api/v2');
|
|
83
|
-
*
|
|
84
|
-
* // Use an explicit URL
|
|
85
|
-
* const customUrl = getBaseURL('https://example.com');
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
|
-
export function getBaseURL(url?: string, path?: string) {
|
|
89
|
-
if (url) {
|
|
90
|
-
return withPath(url, path);
|
|
91
|
-
}
|
|
92
|
-
const fromEnv =
|
|
93
|
-
env.C15T_URL ||
|
|
94
|
-
env.NEXT_PUBLIC_C15T_URL ||
|
|
95
|
-
env.PUBLIC_C15T_URL ||
|
|
96
|
-
env.NUXT_PUBLIC_C15T_URL ||
|
|
97
|
-
env.NUXT_PUBLIC_AUTH_URL ||
|
|
98
|
-
(env.BASE_URL !== '/' ? env.BASE_URL : undefined);
|
|
99
|
-
|
|
100
|
-
if (fromEnv) {
|
|
101
|
-
return withPath(fromEnv, path);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { getWithHooks } from '~/pkgs/data-model';
|
|
2
|
-
import { DoubleTieError, ERROR_CODES } from '~/pkgs/results';
|
|
3
|
-
import type { GenericEndpointContext, RegistryContext } from '~/pkgs/types';
|
|
4
|
-
|
|
5
|
-
import type { AuditLog } from './schema';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Creates and returns a set of audit log adapter methods to interact with the database.
|
|
9
|
-
* These methods provide a consistent interface for creating and querying audit logs
|
|
10
|
-
* while applying hooks and enforcing data validation rules.
|
|
11
|
-
*
|
|
12
|
-
* The audit log system tracks changes to entities in the system, providing a historical
|
|
13
|
-
* record of modifications for compliance, debugging, and auditing purposes.
|
|
14
|
-
*
|
|
15
|
-
* @param params - Registry context parameters
|
|
16
|
-
* @param params.adapter - The database adapter used for direct database operations
|
|
17
|
-
* @param params.ctx - Additional context properties containing hooks and options
|
|
18
|
-
* @returns An object containing type-safe audit log operations
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* const registry = auditLogRegistry({
|
|
23
|
-
* adapter: databaseAdapter,
|
|
24
|
-
* hooks: customHooks,
|
|
25
|
-
* options: validationOptions
|
|
26
|
-
* });
|
|
27
|
-
*
|
|
28
|
-
* // Use the registry to create an audit log entry
|
|
29
|
-
* const logEntry = await registry.createAuditLog({
|
|
30
|
-
* entityType: 'consent',
|
|
31
|
-
* entityId: 'cns_hadt8w7nngm7xmx2bn',
|
|
32
|
-
* actionType: 'update',
|
|
33
|
-
* subjectId: 'sub_x1pftyoufsm7xgo1kv',
|
|
34
|
-
* changes: { status: { from: 'active', to: 'withdrawn' } }
|
|
35
|
-
* });
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* @see {@link RegistryContext} For details on the context parameters
|
|
39
|
-
* @see {@link AuditLog} For the structure of audit log objects
|
|
40
|
-
*/
|
|
41
|
-
export function auditLogRegistry({ adapter, ...ctx }: RegistryContext) {
|
|
42
|
-
const { createWithHooks } = getWithHooks(adapter, ctx);
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
/**
|
|
46
|
-
* Creates a new audit log entry in the database.
|
|
47
|
-
*
|
|
48
|
-
* This method records an action performed on an entity in the system,
|
|
49
|
-
* capturing details such as what changed, who made the change, and when it occurred.
|
|
50
|
-
* Automatically sets creation timestamp and applies any configured hooks during creation.
|
|
51
|
-
*
|
|
52
|
-
* @param auditLog - Audit log data to create (without id and timestamp)
|
|
53
|
-
* @param auditLog.entityType - The type of entity being audited (e.g., 'consent', 'user')
|
|
54
|
-
* @param auditLog.entityId - The unique identifier of the entity being audited
|
|
55
|
-
* @param auditLog.actionType - The type of action performed (e.g., 'create', 'update', 'delete')
|
|
56
|
-
* @param auditLog.subjectId - Identifier of the user/system that performed the action
|
|
57
|
-
* @param auditLog.changes - Object describing the changes made to the entity
|
|
58
|
-
* @param context - Optional endpoint context for hooks execution
|
|
59
|
-
* @returns Promise resolving to the created audit log entry with all fields populated
|
|
60
|
-
* @throws {Error} When the creation operation fails or returns null
|
|
61
|
-
* @throws May also throw errors if hooks prevent creation or if database operations fail
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```ts
|
|
65
|
-
* // Record a consent being withdrawn
|
|
66
|
-
* const withdrawalLog = await registry.createAuditLog({
|
|
67
|
-
* entityType: 'consent',
|
|
68
|
-
* entityId: 'cns_abc123',
|
|
69
|
-
* actionType: 'update',
|
|
70
|
-
* subjectId: 'user_xyz789',
|
|
71
|
-
* changes: {
|
|
72
|
-
* status: { from: 'active', to: 'withdrawn' },
|
|
73
|
-
* withdrawalReason: { from: null, to: 'Changed mind' }
|
|
74
|
-
* }
|
|
75
|
-
* });
|
|
76
|
-
*
|
|
77
|
-
* // Record a new policy being created
|
|
78
|
-
* const policyCreationLog = await registry.createAuditLog({
|
|
79
|
-
* entityType: 'policy',
|
|
80
|
-
* entityId: 'pol_def456',
|
|
81
|
-
* actionType: 'create',
|
|
82
|
-
* subjectId: 'admin_uvw321',
|
|
83
|
-
* changes: null // No previous state for creation
|
|
84
|
-
* });
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* @see {@link AuditLog} For the complete structure of the audit log object
|
|
88
|
-
* @see {@link GenericEndpointContext} For details on the context object
|
|
89
|
-
*/
|
|
90
|
-
createAuditLog: async (
|
|
91
|
-
auditLog: Omit<AuditLog, 'id' | 'createdAt'> & Partial<AuditLog>,
|
|
92
|
-
context?: GenericEndpointContext
|
|
93
|
-
) => {
|
|
94
|
-
const createdLog = await createWithHooks({
|
|
95
|
-
data: {
|
|
96
|
-
createdAt: new Date(),
|
|
97
|
-
...auditLog,
|
|
98
|
-
},
|
|
99
|
-
model: 'auditLog',
|
|
100
|
-
customFn: undefined,
|
|
101
|
-
context,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
if (!createdLog) {
|
|
105
|
-
throw new DoubleTieError(
|
|
106
|
-
'Failed to create audit log - operation returned null',
|
|
107
|
-
{
|
|
108
|
-
code: ERROR_CODES.INTERNAL_SERVER_ERROR,
|
|
109
|
-
status: 500,
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return createdLog as AuditLog;
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Zod schema for validating consent audit log entities.
|
|
5
|
-
*
|
|
6
|
-
* This defines the structure and validation rules for audit log entries:
|
|
7
|
-
* - Required fields: entityType, entityId, actionType
|
|
8
|
-
* - Optional fields: subjectId, ipAddress, changes, metadata
|
|
9
|
-
* - Default current date/time for creation timestamp
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const auditLogData = {
|
|
14
|
-
* id: 'log_w5qufx2a66m7xkn3ty',
|
|
15
|
-
* entityType: 'consent',
|
|
16
|
-
* entityId: 'cns_hadt8w7nngm7xmx2bn',
|
|
17
|
-
* actionType: 'update',
|
|
18
|
-
* subjectId: 'sub_x1pftyoufsm7xgo1kv',
|
|
19
|
-
* changes: { status: { from: 'active', to: 'withdrawn' } }
|
|
20
|
-
* };
|
|
21
|
-
*
|
|
22
|
-
* // Validate and parse the audit log data
|
|
23
|
-
* const validAuditLog = auditLogSchema.parse(auditLogData);
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export const auditLogSchema = z.object({
|
|
27
|
-
id: z.string(),
|
|
28
|
-
entityType: z.string(),
|
|
29
|
-
entityId: z.string(),
|
|
30
|
-
actionType: z.string(),
|
|
31
|
-
subjectId: z.string().optional(),
|
|
32
|
-
ipAddress: z.string().optional(),
|
|
33
|
-
userAgent: z.string().optional(),
|
|
34
|
-
changes: z.record(z.string(), z.unknown()).optional(),
|
|
35
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
36
|
-
createdAt: z.date().prefault(() => new Date()),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Type definition for AuditLog
|
|
41
|
-
*
|
|
42
|
-
* This type represents the structure of a consent audit log entry
|
|
43
|
-
* as defined by the auditLogSchema. It includes all fields
|
|
44
|
-
* that are part of the audit log entity.
|
|
45
|
-
*/
|
|
46
|
-
export type AuditLog = z.infer<typeof auditLogSchema>;
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { COMMON_TIMEZONES, type Field } from '~/pkgs/data-model';
|
|
2
|
-
import type { C15TOptions } from '~/types';
|
|
3
|
-
import { auditLogSchema } from './schema';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Generates the database table configuration for the consent audit log entity.
|
|
7
|
-
*
|
|
8
|
-
* This function creates a schema definition that includes all standard audit log fields
|
|
9
|
-
* and any additional fields from plugins or configuration. The resulting schema is used
|
|
10
|
-
* for database migrations, schema validation, and query building.
|
|
11
|
-
*
|
|
12
|
-
* @param options - c15t configuration options that may contain audit log table customizations
|
|
13
|
-
* @param auditLogFields - Additional fields from plugins to include in the audit log table
|
|
14
|
-
* @returns A complete table schema definition with fields, model name, and metadata
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const auditLogTableSchema = getAuditLogTable(c15tOptions);
|
|
19
|
-
* // Use the schema for migrations or data access
|
|
20
|
-
* const migrationPlans = generateMigrations(auditLogTableSchema);
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export function getAuditLogTable(
|
|
24
|
-
options: C15TOptions,
|
|
25
|
-
auditLogFields?: Record<string, Field>
|
|
26
|
-
) {
|
|
27
|
-
const auditLogConfig = options.tables?.auditLog;
|
|
28
|
-
const subjectConfig = options.tables?.subject;
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
/**
|
|
32
|
-
* The name of the audit log table in the database, configurable through options
|
|
33
|
-
*/
|
|
34
|
-
entityName: auditLogConfig?.entityName || 'auditLog',
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The ID prefix for the audit log table
|
|
38
|
-
* Used to generate unique prefixed IDs
|
|
39
|
-
*/
|
|
40
|
-
entityPrefix: auditLogConfig?.entityPrefix || 'log',
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The schema for the audit log table
|
|
44
|
-
*/
|
|
45
|
-
schema: auditLogSchema,
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Field definitions for the consent audit log table
|
|
49
|
-
*/
|
|
50
|
-
fields: {
|
|
51
|
-
/**
|
|
52
|
-
* Type of entity this audit log entry is about (e.g., 'consent', 'subject', 'consentPurpose')
|
|
53
|
-
*/
|
|
54
|
-
entityType: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
required: true,
|
|
57
|
-
fieldName: auditLogConfig?.fields?.entityType || 'entityType',
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* ID of the entity this audit log entry is about
|
|
62
|
-
*/
|
|
63
|
-
entityId: {
|
|
64
|
-
type: 'string',
|
|
65
|
-
required: true,
|
|
66
|
-
fieldName: auditLogConfig?.fields?.entityId || 'entityId',
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Type of action that was performed on the entity
|
|
71
|
-
* Common values: 'create', 'update', 'delete', 'view'
|
|
72
|
-
*/
|
|
73
|
-
actionType: {
|
|
74
|
-
type: 'string',
|
|
75
|
-
required: true,
|
|
76
|
-
fieldName: auditLogConfig?.fields?.actionType || 'actionType',
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Optional ID of the subject who performed the action
|
|
81
|
-
*/
|
|
82
|
-
subjectId: {
|
|
83
|
-
type: 'string',
|
|
84
|
-
required: false,
|
|
85
|
-
fieldName: auditLogConfig?.fields?.subjectId || 'subjectId',
|
|
86
|
-
references: {
|
|
87
|
-
model: subjectConfig?.entityName || 'subject',
|
|
88
|
-
field: 'id',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* IP address from which the action was performed
|
|
94
|
-
*/
|
|
95
|
-
ipAddress: {
|
|
96
|
-
type: 'string',
|
|
97
|
-
required: false,
|
|
98
|
-
fieldName: auditLogConfig?.fields?.ipAddress || 'ipAddress',
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Subject agent (browser/device) from which the action was performed
|
|
103
|
-
*/
|
|
104
|
-
userAgent: {
|
|
105
|
-
type: 'string',
|
|
106
|
-
required: false,
|
|
107
|
-
fieldName: auditLogConfig?.fields?.userAgent || 'userAgent',
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Detailed changes made to the entity
|
|
112
|
-
* For updates, this typically contains before/after values
|
|
113
|
-
*/
|
|
114
|
-
changes: {
|
|
115
|
-
type: 'json',
|
|
116
|
-
required: false,
|
|
117
|
-
fieldName: auditLogConfig?.fields?.changes || 'changes',
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Additional metadata about the action
|
|
122
|
-
*/
|
|
123
|
-
metadata: {
|
|
124
|
-
type: 'json',
|
|
125
|
-
required: false,
|
|
126
|
-
fieldName: auditLogConfig?.fields?.metadata || 'metadata',
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* When the audit log entry was created
|
|
131
|
-
* Automatically set to current time by default
|
|
132
|
-
*/
|
|
133
|
-
createdAt: {
|
|
134
|
-
type: 'date',
|
|
135
|
-
defaultValue: () => new Date(),
|
|
136
|
-
required: true,
|
|
137
|
-
fieldName: auditLogConfig?.fields?.createdAt || 'createdAt',
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Timezone where the audit event occurred
|
|
142
|
-
*/
|
|
143
|
-
eventTimezone: {
|
|
144
|
-
type: 'timezone',
|
|
145
|
-
required: true,
|
|
146
|
-
defaultValue: COMMON_TIMEZONES.UTC,
|
|
147
|
-
fieldName: auditLogConfig?.fields?.eventTimezone || 'eventTimezone',
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
// Include additional fields from plugins
|
|
151
|
-
...(auditLogFields || {}),
|
|
152
|
-
|
|
153
|
-
// Include additional fields from configuration
|
|
154
|
-
...(auditLogConfig?.additionalFields || {}),
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Add indexes for better query performance
|
|
159
|
-
*/
|
|
160
|
-
indexes: [
|
|
161
|
-
{
|
|
162
|
-
name: 'entity_index',
|
|
163
|
-
fields: ['entityType', 'entityId'],
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: 'action_type_index',
|
|
167
|
-
fields: ['actionType'],
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: 'subject_id_index',
|
|
171
|
-
fields: ['subjectId'],
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
name: 'created_at_index',
|
|
175
|
-
fields: ['createdAt'],
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Execution order during migrations (lower numbers run first)
|
|
181
|
-
* Audit log table needs to be created after the subject table it references
|
|
182
|
-
*/
|
|
183
|
-
order: 5,
|
|
184
|
-
};
|
|
185
|
-
}
|