@c15t/backend 1.5.0 → 1.6.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/.turbo/turbo-build.log +63 -37
- package/CHANGELOG.md +4 -209
- package/README.md +86 -164
- package/dist/contracts/consent/index.d.ts +103 -615
- package/dist/contracts/consent/index.d.ts.map +1 -1
- package/dist/contracts/consent/post.contract.d.ts +42 -140
- package/dist/contracts/consent/post.contract.d.ts.map +1 -1
- package/dist/contracts/consent/show-banner.contract.d.ts +28 -376
- package/dist/contracts/consent/show-banner.contract.d.ts.map +1 -1
- package/dist/contracts/consent/verify.contract.d.ts +33 -99
- package/dist/contracts/consent/verify.contract.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +222 -1356
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/meta/index.d.ts +8 -63
- package/dist/contracts/meta/index.d.ts.map +1 -1
- package/dist/contracts/meta/status.contract.d.ts +8 -63
- package/dist/contracts/meta/status.contract.d.ts.map +1 -1
- package/dist/contracts/shared/jurisdiction.schema.d.ts +21 -9
- package/dist/contracts/shared/jurisdiction.schema.d.ts.map +1 -1
- package/dist/contracts.cjs +100 -106
- package/dist/contracts.js +100 -106
- package/dist/core.cjs +681 -681
- package/dist/core.d.ts +118 -678
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +634 -637
- package/dist/handlers/consent/index.d.ts +103 -615
- package/dist/handlers/consent/index.d.ts.map +1 -1
- package/dist/handlers/consent/post.handler.d.ts +42 -140
- package/dist/handlers/consent/post.handler.d.ts.map +1 -1
- package/dist/handlers/consent/show-banner/handler.d.ts +28 -376
- package/dist/handlers/consent/show-banner/handler.d.ts.map +1 -1
- package/dist/handlers/consent/show-banner/translations.d.ts.map +1 -1
- package/dist/handlers/consent/verify.handler.d.ts +33 -99
- package/dist/handlers/consent/verify.handler.d.ts.map +1 -1
- package/dist/handlers/meta/index.d.ts +8 -63
- package/dist/handlers/meta/index.d.ts.map +1 -1
- package/dist/handlers/meta/status.handler.d.ts +8 -63
- package/dist/handlers/meta/status.handler.d.ts.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/middleware/openapi/index.d.ts +2 -2
- package/dist/middleware/openapi/index.d.ts.map +1 -1
- package/dist/pkgs/data-model/fields/index.cjs +14 -26
- package/dist/pkgs/data-model/fields/index.d.ts +4 -4
- package/dist/pkgs/data-model/fields/index.d.ts.map +1 -1
- package/dist/pkgs/data-model/fields/index.js +14 -26
- package/dist/pkgs/data-model/fields/zod-fields.d.ts +195 -871
- package/dist/pkgs/data-model/fields/zod-fields.d.ts.map +1 -1
- package/dist/pkgs/data-model/hooks/index.d.ts +2 -2
- package/dist/pkgs/data-model/hooks/index.d.ts.map +1 -1
- package/dist/pkgs/data-model/index.cjs +346 -358
- package/dist/pkgs/data-model/index.d.ts +1 -1
- package/dist/pkgs/data-model/index.d.ts.map +1 -1
- package/dist/pkgs/data-model/index.js +345 -357
- package/dist/pkgs/data-model/schema/index.cjs +346 -358
- package/dist/pkgs/data-model/schema/index.d.ts +1 -1
- package/dist/pkgs/data-model/schema/index.d.ts.map +1 -1
- package/dist/pkgs/data-model/schema/index.js +345 -357
- package/dist/pkgs/data-model/schema/schemas.d.ts +2 -2
- package/dist/pkgs/data-model/schema/schemas.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/drizzle-adapter.d.ts +3 -0
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/drizzle-adapter.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/index.cjs +158 -170
- package/dist/pkgs/db-adapters/adapters/drizzle-adapter/index.js +157 -169
- package/dist/pkgs/db-adapters/adapters/index.d.ts +2 -2
- package/dist/pkgs/db-adapters/adapters/index.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/index.cjs +215 -227
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/index.d.ts +2 -2
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/index.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/index.js +213 -225
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/kysely-adapter.d.ts +2 -0
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/kysely-adapter.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/tests/test-utils.d.ts +1 -1
- package/dist/pkgs/db-adapters/adapters/kysely-adapter/tests/test-utils.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/adapters/memory-adapter/index.cjs +158 -170
- package/dist/pkgs/db-adapters/adapters/memory-adapter/index.js +157 -169
- package/dist/pkgs/db-adapters/adapters/memory-adapter/memory-adapter.d.ts +3 -0
- package/dist/pkgs/db-adapters/adapters/memory-adapter/memory-adapter.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/index.cjs +243 -255
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/index.d.ts +1 -1
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/index.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/index.js +241 -253
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/prisma-adapter.d.ts +3 -0
- package/dist/pkgs/db-adapters/adapters/prisma-adapter/prisma-adapter.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/index.cjs +714 -726
- package/dist/pkgs/db-adapters/index.d.ts +6 -6
- package/dist/pkgs/db-adapters/index.d.ts.map +1 -1
- package/dist/pkgs/db-adapters/index.js +708 -720
- package/dist/pkgs/migrations/get-migration.d.ts.map +1 -1
- package/dist/pkgs/migrations/get-schema/get-schema.d.ts.map +1 -1
- package/dist/pkgs/migrations/get-schema/process-tables.d.ts.map +1 -1
- package/dist/pkgs/migrations/index.cjs +236 -248
- package/dist/pkgs/migrations/index.d.ts +4 -4
- package/dist/pkgs/migrations/index.d.ts.map +1 -1
- package/dist/pkgs/migrations/index.js +235 -247
- package/dist/pkgs/results/index.cjs +67 -67
- package/dist/pkgs/results/index.d.ts +5 -5
- package/dist/pkgs/results/index.d.ts.map +1 -1
- package/dist/pkgs/results/index.js +67 -67
- package/dist/pkgs/results/orpc-error-handler.d.ts +1 -1
- package/dist/pkgs/results/orpc-error-handler.d.ts.map +1 -1
- package/dist/pkgs/types/index.d.ts +1 -2
- package/dist/pkgs/types/index.d.ts.map +1 -1
- package/dist/pkgs/types/options.d.ts +9 -2
- package/dist/pkgs/types/options.d.ts.map +1 -1
- package/dist/pkgs/utils/index.d.ts +1 -1
- package/dist/pkgs/utils/index.d.ts.map +1 -1
- package/dist/pkgs/utils/logger.d.ts +1 -1
- package/dist/pkgs/utils/logger.d.ts.map +1 -1
- package/dist/router.cjs +114 -117
- package/dist/router.d.ts +111 -678
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +114 -117
- package/dist/schema/audit-log/schema.d.ts +2 -24
- package/dist/schema/audit-log/schema.d.ts.map +1 -1
- package/dist/schema/audit-log/table.d.ts +2 -24
- package/dist/schema/audit-log/table.d.ts.map +1 -1
- package/dist/schema/consent/registry.d.ts +8 -8
- package/dist/schema/consent/schema.d.ts +9 -33
- package/dist/schema/consent/schema.d.ts.map +1 -1
- package/dist/schema/consent/table.d.ts +9 -33
- package/dist/schema/consent/table.d.ts.map +1 -1
- package/dist/schema/consent-policy/registry.d.ts +20 -20
- package/dist/schema/consent-policy/schema.d.ts +22 -30
- package/dist/schema/consent-policy/schema.d.ts.map +1 -1
- package/dist/schema/consent-policy/table.d.ts +13 -29
- package/dist/schema/consent-policy/table.d.ts.map +1 -1
- package/dist/schema/consent-purpose/registry.d.ts +6 -6
- package/dist/schema/consent-purpose/schema.d.ts +5 -27
- package/dist/schema/consent-purpose/schema.d.ts.map +1 -1
- package/dist/schema/consent-purpose/table.d.ts +5 -27
- package/dist/schema/consent-purpose/table.d.ts.map +1 -1
- package/dist/schema/consent-record/schema.d.ts +3 -19
- package/dist/schema/consent-record/schema.d.ts.map +1 -1
- package/dist/schema/consent-record/table.d.ts +3 -19
- package/dist/schema/consent-record/table.d.ts.map +1 -1
- package/dist/schema/create-registry.d.ts +58 -58
- package/dist/schema/definition.d.ts +42 -176
- package/dist/schema/definition.d.ts.map +1 -1
- package/dist/schema/domain/registry.d.ts +20 -20
- package/dist/schema/domain/schema.d.ts +6 -24
- package/dist/schema/domain/schema.d.ts.map +1 -1
- package/dist/schema/domain/table.d.ts +6 -24
- package/dist/schema/domain/table.d.ts.map +1 -1
- package/dist/schema/index.cjs +426 -438
- package/dist/schema/index.d.ts +12 -12
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +426 -438
- package/dist/schema/schemas.d.ts +42 -176
- package/dist/schema/schemas.d.ts.map +1 -1
- package/dist/schema/subject/registry.d.ts +4 -4
- package/dist/schema/subject/schema.d.ts +4 -20
- package/dist/schema/subject/schema.d.ts.map +1 -1
- package/dist/schema/subject/table.d.ts +4 -20
- package/dist/schema/subject/table.d.ts.map +1 -1
- package/dist/schema/types.d.ts +1 -1
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/testing/contract-testing.d.ts +3 -2
- package/dist/testing/contract-testing.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/options.d.ts +2 -2
- package/dist/types/options.d.ts.map +1 -1
- package/dist/v2/contracts/consent/index.d.ts +260 -0
- package/dist/v2/contracts/consent/index.d.ts.map +1 -0
- package/dist/v2/contracts/consent/index.test.d.ts +2 -0
- package/dist/v2/contracts/consent/index.test.d.ts.map +1 -0
- package/dist/v2/contracts/consent/post.contract.d.ts +114 -0
- package/dist/v2/contracts/consent/post.contract.d.ts.map +1 -0
- package/dist/v2/contracts/consent/post.contract.test.d.ts +2 -0
- package/dist/v2/contracts/consent/post.contract.test.d.ts.map +1 -0
- package/dist/v2/contracts/consent/show-banner.contract.d.ts +68 -0
- package/dist/v2/contracts/consent/show-banner.contract.d.ts.map +1 -0
- package/dist/v2/contracts/consent/show-banner.contract.test.d.ts +2 -0
- package/dist/v2/contracts/consent/show-banner.contract.test.d.ts.map +1 -0
- package/dist/v2/contracts/consent/verify.contract.d.ts +81 -0
- package/dist/v2/contracts/consent/verify.contract.d.ts.map +1 -0
- package/dist/v2/contracts/consent/verify.contract.test.d.ts +2 -0
- package/dist/v2/contracts/consent/verify.contract.test.d.ts.map +1 -0
- package/dist/v2/contracts/index.cjs +644 -0
- package/dist/v2/contracts/index.d.ts +563 -0
- package/dist/v2/contracts/index.d.ts.map +1 -0
- package/dist/v2/contracts/index.js +607 -0
- package/dist/v2/contracts/meta/index.d.ts +19 -0
- package/dist/v2/contracts/meta/index.d.ts.map +1 -0
- package/dist/v2/contracts/meta/index.test.d.ts +2 -0
- package/dist/v2/contracts/meta/index.test.d.ts.map +1 -0
- package/dist/v2/contracts/meta/status.contract.d.ts +18 -0
- package/dist/v2/contracts/meta/status.contract.d.ts.map +1 -0
- package/dist/v2/contracts/meta/status.contract.test.d.ts +2 -0
- package/dist/v2/contracts/meta/status.contract.test.d.ts.map +1 -0
- package/dist/v2/contracts/shared/jurisdiction.schema.d.ts +36 -0
- package/dist/v2/contracts/shared/jurisdiction.schema.d.ts.map +1 -0
- package/dist/v2/contracts/test.utils.d.ts +38 -0
- package/dist/v2/contracts/test.utils.d.ts.map +1 -0
- package/dist/v2/core.cjs +2181 -0
- package/dist/v2/core.d.ts +364 -0
- package/dist/v2/core.d.ts.map +1 -0
- package/dist/v2/core.js +2130 -0
- package/dist/v2/db/adapters/drizzle.cjs +36 -0
- package/dist/v2/db/adapters/drizzle.d.ts +2 -0
- package/dist/v2/db/adapters/drizzle.d.ts.map +1 -0
- package/dist/v2/db/adapters/drizzle.js +3 -0
- package/dist/v2/db/adapters/index.cjs +18 -0
- package/dist/v2/db/adapters/index.d.ts +2 -0
- package/dist/v2/db/adapters/index.d.ts.map +1 -0
- package/dist/v2/db/adapters/index.js +0 -0
- package/dist/v2/db/adapters/kysely.cjs +36 -0
- package/dist/v2/db/adapters/kysely.d.ts +2 -0
- package/dist/v2/db/adapters/kysely.d.ts.map +1 -0
- package/dist/v2/db/adapters/kysely.js +3 -0
- package/dist/v2/db/adapters/mongo.cjs +36 -0
- package/dist/v2/db/adapters/mongo.d.ts +2 -0
- package/dist/v2/db/adapters/mongo.d.ts.map +1 -0
- package/dist/v2/db/adapters/mongo.js +3 -0
- package/dist/v2/db/adapters/prisma.cjs +36 -0
- package/dist/v2/db/adapters/prisma.d.ts +2 -0
- package/dist/v2/db/adapters/prisma.d.ts.map +1 -0
- package/dist/v2/db/adapters/prisma.js +3 -0
- package/dist/v2/db/adapters/typeorm.cjs +36 -0
- package/dist/v2/db/adapters/typeorm.d.ts +2 -0
- package/dist/v2/db/adapters/typeorm.d.ts.map +1 -0
- package/dist/v2/db/adapters/typeorm.js +3 -0
- package/dist/v2/db/migrator/index.cjs +61 -0
- package/dist/v2/db/migrator/index.d.ts +29 -0
- package/dist/v2/db/migrator/index.d.ts.map +1 -0
- package/dist/v2/db/migrator/index.js +27 -0
- package/dist/v2/db/registry/audit-log.d.ts +21 -0
- package/dist/v2/db/registry/audit-log.d.ts.map +1 -0
- package/dist/v2/db/registry/audit-log.test.d.ts +2 -0
- package/dist/v2/db/registry/audit-log.test.d.ts.map +1 -0
- package/dist/v2/db/registry/consent-policy.d.ts +29 -0
- package/dist/v2/db/registry/consent-policy.d.ts.map +1 -0
- package/dist/v2/db/registry/consent-policy.test.d.ts +2 -0
- package/dist/v2/db/registry/consent-policy.test.d.ts.map +1 -0
- package/dist/v2/db/registry/consent-purpose.d.ts +16 -0
- package/dist/v2/db/registry/consent-purpose.d.ts.map +1 -0
- package/dist/v2/db/registry/consent-purpose.test.d.ts +2 -0
- package/dist/v2/db/registry/consent-purpose.test.d.ts.map +1 -0
- package/dist/v2/db/registry/consent.d.ts +20 -0
- package/dist/v2/db/registry/consent.d.ts.map +1 -0
- package/dist/v2/db/registry/consent.test.d.ts +2 -0
- package/dist/v2/db/registry/consent.test.d.ts.map +1 -0
- package/dist/v2/db/registry/domain.d.ts +24 -0
- package/dist/v2/db/registry/domain.d.ts.map +1 -0
- package/dist/v2/db/registry/domain.test.d.ts +2 -0
- package/dist/v2/db/registry/domain.test.d.ts.map +1 -0
- package/dist/v2/db/registry/index.d.ts +102 -0
- package/dist/v2/db/registry/index.d.ts.map +1 -0
- package/dist/v2/db/registry/subject.d.ts +18 -0
- package/dist/v2/db/registry/subject.d.ts.map +1 -0
- package/dist/v2/db/registry/subject.test.d.ts +2 -0
- package/dist/v2/db/registry/subject.test.d.ts.map +1 -0
- package/dist/v2/db/registry/types.d.ts +10 -0
- package/dist/v2/db/registry/types.d.ts.map +1 -0
- package/dist/v2/db/registry/utils/generate-id.d.ts +25 -0
- package/dist/v2/db/registry/utils/generate-id.d.ts.map +1 -0
- package/dist/v2/db/registry/utils/generate-id.test.d.ts +2 -0
- package/dist/v2/db/registry/utils/generate-id.test.d.ts.map +1 -0
- package/dist/v2/db/registry/utils.d.ts +25 -0
- package/dist/v2/db/registry/utils.d.ts.map +1 -0
- package/dist/v2/db/schema/1.0.0/audit-log.d.ts +29 -0
- package/dist/v2/db/schema/1.0.0/audit-log.d.ts.map +1 -0
- package/dist/v2/db/schema/1.0.0/consent-policy.d.ts +45 -0
- package/dist/v2/db/schema/1.0.0/consent-policy.d.ts.map +1 -0
- package/dist/v2/db/schema/1.0.0/consent-purpose.d.ts +27 -0
- package/dist/v2/db/schema/1.0.0/consent-purpose.d.ts.map +1 -0
- package/dist/v2/db/schema/1.0.0/consent-record.d.ts +19 -0
- package/dist/v2/db/schema/1.0.0/consent-record.d.ts.map +1 -0
- package/dist/v2/db/schema/1.0.0/consent.d.ts +42 -0
- package/dist/v2/db/schema/1.0.0/consent.d.ts.map +1 -0
- package/dist/v2/db/schema/1.0.0/domain.d.ts +23 -0
- package/dist/v2/db/schema/1.0.0/domain.d.ts.map +1 -0
- package/dist/v2/db/schema/1.0.0/index.d.ts +1513 -0
- package/dist/v2/db/schema/1.0.0/index.d.ts.map +1 -0
- package/dist/v2/db/schema/1.0.0/subject.d.ts +23 -0
- package/dist/v2/db/schema/1.0.0/subject.d.ts.map +1 -0
- package/dist/v2/db/schema/index.cjs +326 -0
- package/dist/v2/db/schema/index.d.ts +1507 -0
- package/dist/v2/db/schema/index.d.ts.map +1 -0
- package/dist/v2/db/schema/index.js +241 -0
- package/dist/v2/define-config.cjs +36 -0
- package/dist/v2/define-config.d.ts +5 -0
- package/dist/v2/define-config.d.ts.map +1 -0
- package/dist/v2/define-config.js +2 -0
- package/dist/v2/handlers/consent/index.d.ts +260 -0
- package/dist/v2/handlers/consent/index.d.ts.map +1 -0
- package/dist/v2/handlers/consent/post.handler.d.ts +136 -0
- package/dist/v2/handlers/consent/post.handler.d.ts.map +1 -0
- package/dist/v2/handlers/consent/show-banner/geo.d.ts +10 -0
- package/dist/v2/handlers/consent/show-banner/geo.d.ts.map +1 -0
- package/dist/v2/handlers/consent/show-banner/geo.test.d.ts +2 -0
- package/dist/v2/handlers/consent/show-banner/geo.test.d.ts.map +1 -0
- package/dist/v2/handlers/consent/show-banner/handler.d.ts +71 -0
- package/dist/v2/handlers/consent/show-banner/handler.d.ts.map +1 -0
- package/dist/v2/handlers/consent/show-banner/handler.test.d.ts +2 -0
- package/dist/v2/handlers/consent/show-banner/handler.test.d.ts.map +1 -0
- package/dist/v2/handlers/consent/show-banner/translations.d.ts +13 -0
- package/dist/v2/handlers/consent/show-banner/translations.d.ts.map +1 -0
- package/dist/v2/handlers/consent/show-banner/translations.test.d.ts +2 -0
- package/dist/v2/handlers/consent/show-banner/translations.test.d.ts.map +1 -0
- package/dist/v2/handlers/consent/verify.handler.d.ts +103 -0
- package/dist/v2/handlers/consent/verify.handler.d.ts.map +1 -0
- package/dist/v2/handlers/meta/index.d.ts +19 -0
- package/dist/v2/handlers/meta/index.d.ts.map +1 -0
- package/dist/v2/handlers/meta/status.handler.d.ts +17 -0
- package/dist/v2/handlers/meta/status.handler.d.ts.map +1 -0
- package/dist/v2/init.d.ts +3 -0
- package/dist/v2/init.d.ts.map +1 -0
- package/dist/v2/init.test.d.ts +2 -0
- package/dist/v2/init.test.d.ts.map +1 -0
- package/dist/v2/middleware/cors/cors.d.ts +37 -0
- package/dist/v2/middleware/cors/cors.d.ts.map +1 -0
- package/dist/v2/middleware/cors/cors.test.d.ts +2 -0
- package/dist/v2/middleware/cors/cors.test.d.ts.map +1 -0
- package/dist/v2/middleware/cors/index.d.ts +30 -0
- package/dist/v2/middleware/cors/index.d.ts.map +1 -0
- package/dist/v2/middleware/cors/is-origin-trusted.d.ts +49 -0
- package/dist/v2/middleware/cors/is-origin-trusted.d.ts.map +1 -0
- package/dist/v2/middleware/cors/is-origin-trusted.test.d.ts +2 -0
- package/dist/v2/middleware/cors/is-origin-trusted.test.d.ts.map +1 -0
- package/dist/v2/middleware/cors/process-cors.d.ts +31 -0
- package/dist/v2/middleware/cors/process-cors.d.ts.map +1 -0
- package/dist/v2/middleware/openapi/config.d.ts +28 -0
- package/dist/v2/middleware/openapi/config.d.ts.map +1 -0
- package/dist/v2/middleware/openapi/handlers.d.ts +29 -0
- package/dist/v2/middleware/openapi/handlers.d.ts.map +1 -0
- package/dist/v2/middleware/openapi/index.d.ts +11 -0
- package/dist/v2/middleware/openapi/index.d.ts.map +1 -0
- package/dist/v2/middleware/process-ip/index.d.ts +3 -0
- package/dist/v2/middleware/process-ip/index.d.ts.map +1 -0
- package/dist/v2/router.cjs +1275 -0
- package/dist/v2/router.d.ts +280 -0
- package/dist/v2/router.d.ts.map +1 -0
- package/dist/v2/router.js +1231 -0
- package/dist/v2/types/api.d.ts +27 -0
- package/dist/v2/types/api.d.ts.map +1 -0
- package/dist/v2/types/index.cjs +40 -0
- package/dist/v2/types/index.d.ts +104 -0
- package/dist/v2/types/index.d.ts.map +1 -0
- package/dist/v2/types/index.js +6 -0
- package/dist/v2/utils/create-telemetry-options.d.ts +28 -0
- package/dist/v2/utils/create-telemetry-options.d.ts.map +1 -0
- package/dist/v2/utils/env.d.ts +60 -0
- package/dist/v2/utils/env.d.ts.map +1 -0
- package/dist/v2/utils/index.d.ts +3 -0
- package/dist/v2/utils/index.d.ts.map +1 -0
- package/dist/v2/utils/logger.d.ts +16 -0
- package/dist/v2/utils/logger.d.ts.map +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +106 -15
- package/readme.json +30 -0
- package/rslib.config.ts +13 -14
- package/src/__tests__/server.test.ts +1 -1
- package/src/contracts/consent/post.contract.test.ts +3 -8
- package/src/contracts/consent/post.contract.ts +13 -13
- package/src/contracts/consent/show-banner.contract.test.ts +9 -0
- package/src/contracts/consent/show-banner.contract.ts +2 -0
- package/src/contracts/consent/verify.contract.ts +19 -23
- package/src/core.ts +7 -0
- package/src/handlers/consent/show-banner/handler.ts +12 -9
- package/src/handlers/consent/show-banner/translations.ts +2 -2
- package/src/init.ts +9 -6
- package/src/middleware/openapi/index.ts +2 -2
- package/src/pkgs/api-router/hooks/__tests__/processor.test.ts +1 -1
- package/src/pkgs/data-model/fields/index.ts +17 -22
- package/src/pkgs/data-model/fields/zod-fields.ts +14 -26
- package/src/pkgs/data-model/hooks/index.ts +3 -2
- package/src/pkgs/data-model/index.ts +2 -4
- package/src/pkgs/data-model/schema/index.ts +6 -7
- package/src/pkgs/data-model/schema/schemas.ts +3 -3
- package/src/pkgs/db-adapters/adapters/drizzle-adapter/drizzle-adapter.ts +4 -1
- package/src/pkgs/db-adapters/adapters/index.ts +2 -2
- package/src/pkgs/db-adapters/adapters/kysely-adapter/index.ts +4 -4
- package/src/pkgs/db-adapters/adapters/kysely-adapter/kysely-adapter.ts +4 -5
- package/src/pkgs/db-adapters/adapters/kysely-adapter/tests/postgres.test.ts +2 -4
- package/src/pkgs/db-adapters/adapters/kysely-adapter/tests/sqlite.test.ts +2 -3
- package/src/pkgs/db-adapters/adapters/kysely-adapter/tests/test-utils.ts +1 -6
- package/src/pkgs/db-adapters/adapters/memory-adapter/memory-adapter.ts +4 -1
- package/src/pkgs/db-adapters/adapters/prisma-adapter/index.ts +1 -1
- package/src/pkgs/db-adapters/adapters/prisma-adapter/prisma-adapter.ts +5 -2
- package/src/pkgs/db-adapters/index.ts +12 -13
- package/src/pkgs/migrations/get-migration.ts +4 -2
- package/src/pkgs/migrations/get-schema/get-schema.ts +0 -1
- package/src/pkgs/migrations/get-schema/process-fields.ts +1 -1
- package/src/pkgs/migrations/get-schema/process-tables.ts +0 -2
- package/src/pkgs/migrations/index.ts +7 -8
- package/src/pkgs/results/__tests__/error-codes.test.ts +2 -2
- package/src/pkgs/results/index.ts +22 -27
- package/src/pkgs/results/orpc-error-handler.ts +1 -1
- package/src/pkgs/results/results/result-helpers.ts +1 -1
- package/src/pkgs/types/index.ts +4 -4
- package/src/pkgs/types/options.ts +10 -3
- package/src/pkgs/utils/index.ts +1 -1
- package/src/pkgs/utils/logger.ts +1 -1
- package/src/schema/audit-log/schema.ts +3 -3
- package/src/schema/consent/schema.ts +4 -4
- package/src/schema/consent-policy/schema.ts +3 -3
- package/src/schema/consent-purpose/schema.ts +4 -4
- package/src/schema/consent-record/schema.ts +3 -3
- package/src/schema/definition.ts +1 -1
- package/src/schema/domain/schema.ts +5 -5
- package/src/schema/index.ts +14 -17
- package/src/schema/subject/schema.ts +3 -3
- package/src/schema/types.ts +1 -1
- package/src/testing/contract-testing.ts +15 -52
- package/src/types/index.ts +8 -8
- package/src/types/options.ts +2 -3
- package/src/v2/contracts/consent/index.test.ts +5 -0
- package/src/v2/contracts/consent/index.ts +9 -0
- package/src/v2/contracts/consent/post.contract.test.ts +521 -0
- package/src/v2/contracts/consent/post.contract.ts +155 -0
- package/src/v2/contracts/consent/show-banner.contract.test.ts +252 -0
- package/src/v2/contracts/consent/show-banner.contract.ts +73 -0
- package/src/v2/contracts/consent/verify.contract.test.ts +185 -0
- package/src/v2/contracts/consent/verify.contract.ts +122 -0
- package/src/v2/contracts/index.ts +20 -0
- package/src/v2/contracts/meta/index.test.ts +5 -0
- package/src/v2/contracts/meta/index.ts +5 -0
- package/src/v2/contracts/meta/status.contract.test.ts +226 -0
- package/src/v2/contracts/meta/status.contract.ts +34 -0
- package/src/v2/contracts/shared/jurisdiction.schema.ts +30 -0
- package/src/v2/contracts/test.utils.ts +400 -0
- package/src/v2/core.ts +379 -0
- package/src/v2/db/adapters/drizzle.ts +1 -0
- package/src/v2/db/adapters/index.ts +1 -0
- package/src/v2/db/adapters/kysely.ts +1 -0
- package/src/v2/db/adapters/mongo.ts +1 -0
- package/src/v2/db/adapters/prisma.ts +1 -0
- package/src/v2/db/adapters/typeorm.ts +1 -0
- package/src/v2/db/migrator/index.ts +80 -0
- package/src/v2/db/registry/audit-log.test.ts +77 -0
- package/src/v2/db/registry/audit-log.ts +46 -0
- package/src/v2/db/registry/consent-policy.test.ts +778 -0
- package/src/v2/db/registry/consent-policy.ts +74 -0
- package/src/v2/db/registry/consent-purpose.test.ts +485 -0
- package/src/v2/db/registry/consent-purpose.ts +41 -0
- package/src/v2/db/registry/consent.test.ts +843 -0
- package/src/v2/db/registry/consent.ts +42 -0
- package/src/v2/db/registry/domain.test.ts +463 -0
- package/src/v2/db/registry/domain.ts +51 -0
- package/src/v2/db/registry/index.ts +18 -0
- package/src/v2/db/registry/subject.test.ts +497 -0
- package/src/v2/db/registry/subject.ts +101 -0
- package/src/v2/db/registry/types.ts +10 -0
- package/src/v2/db/registry/utils/generate-id.test.ts +217 -0
- package/src/v2/db/registry/utils/generate-id.ts +134 -0
- package/src/v2/db/registry/utils.ts +134 -0
- package/src/v2/db/schema/1.0.0/audit-log.ts +32 -0
- package/src/v2/db/schema/1.0.0/consent-policy.ts +41 -0
- package/src/v2/db/schema/1.0.0/consent-purpose.ts +30 -0
- package/src/v2/db/schema/1.0.0/consent-record.ts +22 -0
- package/src/v2/db/schema/1.0.0/consent.ts +38 -0
- package/src/v2/db/schema/1.0.0/domain.ts +26 -0
- package/src/v2/db/schema/1.0.0/index.ts +56 -0
- package/src/v2/db/schema/1.0.0/subject.ts +26 -0
- package/src/v2/db/schema/index.ts +9 -0
- package/src/v2/define-config.ts +5 -0
- package/src/v2/handlers/consent/index.ts +9 -0
- package/src/v2/handlers/consent/post.handler.ts +254 -0
- package/src/v2/handlers/consent/show-banner/geo.test.ts +281 -0
- package/src/v2/handlers/consent/show-banner/geo.ts +96 -0
- package/src/v2/handlers/consent/show-banner/handler.test.ts +374 -0
- package/src/v2/handlers/consent/show-banner/handler.ts +123 -0
- package/src/v2/handlers/consent/show-banner/translations.test.ts +121 -0
- package/src/v2/handlers/consent/show-banner/translations.ts +79 -0
- package/src/v2/handlers/consent/verify.handler.ts +288 -0
- package/src/v2/handlers/meta/index.ts +5 -0
- package/src/v2/handlers/meta/status.handler.ts +43 -0
- package/src/v2/init.test.ts +114 -0
- package/src/v2/init.ts +126 -0
- package/src/v2/middleware/cors/cors.test.ts +111 -0
- package/src/v2/middleware/cors/cors.ts +192 -0
- package/src/v2/middleware/cors/index.ts +30 -0
- package/src/v2/middleware/cors/is-origin-trusted.test.ts +104 -0
- package/src/v2/middleware/cors/is-origin-trusted.ts +126 -0
- package/src/v2/middleware/cors/process-cors.ts +91 -0
- package/src/v2/middleware/openapi/config.ts +27 -0
- package/src/v2/middleware/openapi/handlers.ts +132 -0
- package/src/v2/middleware/openapi/index.ts +11 -0
- package/src/v2/middleware/process-ip/index.ts +39 -0
- package/src/v2/router.ts +8 -0
- package/src/v2/types/api.ts +32 -0
- package/src/v2/types/index.ts +121 -0
- package/src/v2/utils/create-telemetry-options.ts +115 -0
- package/src/v2/utils/env.ts +84 -0
- package/src/v2/utils/index.ts +2 -0
- package/src/v2/utils/logger.ts +38 -0
- package/src/version.ts +1 -1
- package/vitest.config.ts +11 -2
|
@@ -8,26 +8,26 @@ const baseConsentSchema = z.object({
|
|
|
8
8
|
externalSubjectId: z.string().optional(),
|
|
9
9
|
domain: z.string(),
|
|
10
10
|
type: PolicyTypeSchema,
|
|
11
|
-
metadata: z.record(z.unknown()).optional(),
|
|
11
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
// Cookie banner needs preferences
|
|
15
15
|
const cookieBannerSchema = baseConsentSchema.extend({
|
|
16
16
|
type: z.literal('cookie_banner'),
|
|
17
|
-
preferences: z.record(z.boolean()),
|
|
17
|
+
preferences: z.record(z.string(), z.boolean()),
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
// Policy based consent just needs the policy ID
|
|
21
21
|
const policyBasedSchema = baseConsentSchema.extend({
|
|
22
22
|
type: z.enum(['privacy_policy', 'dpa', 'terms_and_conditions']),
|
|
23
23
|
policyId: z.string().optional(),
|
|
24
|
-
preferences: z.record(z.boolean()).optional(),
|
|
24
|
+
preferences: z.record(z.string(), z.boolean()).optional(),
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
// Other consent types just need the base fields
|
|
28
28
|
const otherConsentSchema = baseConsentSchema.extend({
|
|
29
29
|
type: z.enum(['marketing_communications', 'age_verification', 'other']),
|
|
30
|
-
preferences: z.record(z.boolean()).optional(),
|
|
30
|
+
preferences: z.record(z.string(), z.boolean()).optional(),
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
export const postConsentContract = oc
|
|
@@ -67,69 +67,69 @@ Use this endpoint to record user consent and maintain a compliant consent manage
|
|
|
67
67
|
// Input validation errors
|
|
68
68
|
INPUT_VALIDATION_FAILED: {
|
|
69
69
|
status: 422,
|
|
70
|
-
message: 'Invalid input parameters',
|
|
71
70
|
data: z.object({
|
|
72
71
|
formErrors: z.array(z.string()),
|
|
73
72
|
fieldErrors: z.record(z.string(), z.array(z.string())),
|
|
74
73
|
}),
|
|
74
|
+
error: 'Invalid input parameters',
|
|
75
75
|
},
|
|
76
76
|
// Subject errors
|
|
77
77
|
SUBJECT_CREATION_FAILED: {
|
|
78
78
|
status: 400,
|
|
79
|
-
message: 'Failed to create or find subject',
|
|
80
79
|
data: z.object({
|
|
81
80
|
subjectId: z.string().optional(),
|
|
82
81
|
externalSubjectId: z.string().optional(),
|
|
83
82
|
}),
|
|
83
|
+
error: 'Failed to create or find subject',
|
|
84
84
|
},
|
|
85
85
|
// Domain errors
|
|
86
86
|
DOMAIN_CREATION_FAILED: {
|
|
87
87
|
status: 500,
|
|
88
|
-
message: 'Failed to create or find domain',
|
|
89
88
|
data: z.object({
|
|
90
89
|
domain: z.string(),
|
|
91
90
|
}),
|
|
91
|
+
error: 'Failed to create or find domain',
|
|
92
92
|
},
|
|
93
93
|
// Policy errors
|
|
94
94
|
POLICY_NOT_FOUND: {
|
|
95
95
|
status: 404,
|
|
96
|
-
message: 'Policy not found',
|
|
97
96
|
data: z.object({
|
|
98
97
|
policyId: z.string(),
|
|
99
98
|
type: z.string(),
|
|
100
99
|
}),
|
|
100
|
+
error: 'Policy not found',
|
|
101
101
|
},
|
|
102
102
|
POLICY_INACTIVE: {
|
|
103
103
|
status: 409,
|
|
104
|
-
message: 'Policy is not active',
|
|
105
104
|
data: z.object({
|
|
106
105
|
policyId: z.string(),
|
|
107
106
|
type: z.string(),
|
|
108
107
|
}),
|
|
108
|
+
error: 'Policy is not active',
|
|
109
109
|
},
|
|
110
110
|
POLICY_CREATION_FAILED: {
|
|
111
111
|
status: 500,
|
|
112
|
-
message: 'Failed to create or find policy',
|
|
113
112
|
data: z.object({
|
|
114
113
|
type: z.string(),
|
|
115
114
|
}),
|
|
115
|
+
error: 'Failed to create or find policy',
|
|
116
116
|
},
|
|
117
117
|
// Purpose errors
|
|
118
118
|
PURPOSE_CREATION_FAILED: {
|
|
119
119
|
status: 500,
|
|
120
|
-
message: 'Failed to create consent purpose',
|
|
121
120
|
data: z.object({
|
|
122
121
|
purposeCode: z.string(),
|
|
123
122
|
}),
|
|
123
|
+
error: 'Failed to create consent purpose',
|
|
124
124
|
},
|
|
125
125
|
// Transaction errors
|
|
126
126
|
CONSENT_CREATION_FAILED: {
|
|
127
127
|
status: 500,
|
|
128
|
-
message: 'Failed to create consent record',
|
|
129
128
|
data: z.object({
|
|
130
129
|
subjectId: z.string(),
|
|
131
130
|
domain: z.string(),
|
|
132
131
|
}),
|
|
132
|
+
error: 'Failed to create consent record',
|
|
133
133
|
},
|
|
134
134
|
})
|
|
135
135
|
.input(
|
|
@@ -149,7 +149,7 @@ Use this endpoint to record user consent and maintain a compliant consent manage
|
|
|
149
149
|
type: PolicyTypeSchema,
|
|
150
150
|
status: z.string(),
|
|
151
151
|
recordId: z.string(),
|
|
152
|
-
metadata: z.record(z.unknown()).optional(),
|
|
152
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
153
153
|
givenAt: z.date(),
|
|
154
154
|
})
|
|
155
155
|
);
|
|
@@ -39,6 +39,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
39
39
|
translations: baseTranslations.en,
|
|
40
40
|
language: 'en',
|
|
41
41
|
},
|
|
42
|
+
branding: 'c15t',
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
const result = validateOutput(validOutput);
|
|
@@ -84,6 +85,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
84
85
|
translations: baseTranslations.en,
|
|
85
86
|
language: 'en',
|
|
86
87
|
},
|
|
88
|
+
branding: 'c15t',
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
const result = validateOutput(output);
|
|
@@ -106,6 +108,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
106
108
|
translations: baseTranslations.en,
|
|
107
109
|
language: 'en',
|
|
108
110
|
},
|
|
111
|
+
branding: 'c15t',
|
|
109
112
|
};
|
|
110
113
|
|
|
111
114
|
const result = validateOutput(output);
|
|
@@ -129,6 +132,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
129
132
|
translations: baseTranslations.en,
|
|
130
133
|
language: 'en',
|
|
131
134
|
},
|
|
135
|
+
branding: 'c15t',
|
|
132
136
|
};
|
|
133
137
|
|
|
134
138
|
const result = validateOutput(output);
|
|
@@ -150,6 +154,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
150
154
|
translations: baseTranslations.en,
|
|
151
155
|
language: 'en',
|
|
152
156
|
},
|
|
157
|
+
branding: 'c15t',
|
|
153
158
|
};
|
|
154
159
|
|
|
155
160
|
const result = validateOutput(output);
|
|
@@ -171,6 +176,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
171
176
|
translations: baseTranslations.en,
|
|
172
177
|
language: 'en',
|
|
173
178
|
},
|
|
179
|
+
branding: 'c15t',
|
|
174
180
|
};
|
|
175
181
|
|
|
176
182
|
// Need to use type assertion to bypass TypeScript
|
|
@@ -195,6 +201,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
195
201
|
translations: baseTranslations.en,
|
|
196
202
|
language: 'en',
|
|
197
203
|
},
|
|
204
|
+
branding: 'c15t',
|
|
198
205
|
};
|
|
199
206
|
|
|
200
207
|
const falseOutput = {
|
|
@@ -211,6 +218,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
211
218
|
translations: baseTranslations.en,
|
|
212
219
|
language: 'en',
|
|
213
220
|
},
|
|
221
|
+
branding: 'c15t',
|
|
214
222
|
};
|
|
215
223
|
|
|
216
224
|
expect(validateOutput(trueOutput)?.success).toBe(true);
|
|
@@ -232,6 +240,7 @@ describe('Show Consent Banner Contract Custom Tests', () => {
|
|
|
232
240
|
translations: baseTranslations.en,
|
|
233
241
|
language: 'en',
|
|
234
242
|
},
|
|
243
|
+
branding: 'c15t',
|
|
235
244
|
};
|
|
236
245
|
|
|
237
246
|
// Need to use type assertion to bypass TypeScript
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { oc } from '@orpc/contract';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { branding } from '~/types';
|
|
3
4
|
import { JurisdictionInfoSchema } from '../shared/jurisdiction.schema';
|
|
4
5
|
|
|
5
6
|
const TitleDescriptionSchema = z.object({
|
|
@@ -67,5 +68,6 @@ Use this endpoint to implement geo-targeted consent banners and ensure complianc
|
|
|
67
68
|
language: z.string(),
|
|
68
69
|
translations: TranslationsSchema,
|
|
69
70
|
}),
|
|
71
|
+
branding: z.enum(branding),
|
|
70
72
|
})
|
|
71
73
|
);
|
|
@@ -8,24 +8,20 @@ import { PolicyTypeSchema } from '~/schema';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
// Input schema based on VerifyConsentRequestBody
|
|
11
|
-
const verifyConsentInputSchema = z
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
.strict();
|
|
11
|
+
const verifyConsentInputSchema = z.strictObject({
|
|
12
|
+
subjectId: z.string().optional(),
|
|
13
|
+
externalSubjectId: z.string().optional(),
|
|
14
|
+
domain: z.string(),
|
|
15
|
+
type: PolicyTypeSchema,
|
|
16
|
+
policyId: z.string().optional(),
|
|
17
|
+
preferences: z.array(z.string()).optional(),
|
|
18
|
+
});
|
|
21
19
|
|
|
22
20
|
// Minimal consent schema based on the response interface
|
|
23
|
-
const consentSchema = z
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
.passthrough(); // Allow additional properties
|
|
21
|
+
const consentSchema = z.looseObject({
|
|
22
|
+
id: z.string(),
|
|
23
|
+
purposeIds: z.array(z.string()),
|
|
24
|
+
}); // Allow additional properties
|
|
29
25
|
|
|
30
26
|
// Output schema based on VerifyConsentResponse
|
|
31
27
|
export const verifyConsentContract = oc
|
|
@@ -56,64 +52,64 @@ Use this endpoint to ensure compliance with privacy regulations and to verify us
|
|
|
56
52
|
// Input validation errors
|
|
57
53
|
INPUT_VALIDATION_FAILED: {
|
|
58
54
|
status: 422,
|
|
59
|
-
message: 'Invalid input parameters',
|
|
60
55
|
data: z.object({
|
|
61
56
|
formErrors: z.array(z.string()),
|
|
62
57
|
fieldErrors: z.record(z.string(), z.array(z.string()).optional()),
|
|
63
58
|
}),
|
|
59
|
+
error: 'Invalid input parameters',
|
|
64
60
|
},
|
|
65
61
|
// Subject errors
|
|
66
62
|
SUBJECT_NOT_FOUND: {
|
|
67
63
|
status: 404,
|
|
68
|
-
message: 'Subject not found',
|
|
69
64
|
data: z.object({
|
|
70
65
|
subjectId: z.string().optional(),
|
|
71
66
|
externalSubjectId: z.string().optional(),
|
|
72
67
|
}),
|
|
68
|
+
error: 'Subject not found',
|
|
73
69
|
},
|
|
74
70
|
// Domain errors
|
|
75
71
|
DOMAIN_NOT_FOUND: {
|
|
76
72
|
status: 404,
|
|
77
|
-
message: 'Domain not found',
|
|
78
73
|
data: z.object({
|
|
79
74
|
domain: z.string(),
|
|
80
75
|
}),
|
|
76
|
+
error: 'Domain not found',
|
|
81
77
|
},
|
|
82
78
|
// Policy errors
|
|
83
79
|
POLICY_NOT_FOUND: {
|
|
84
80
|
status: 404,
|
|
85
|
-
message: 'Policy not found or invalid',
|
|
86
81
|
data: z.object({
|
|
87
82
|
policyId: z.string(),
|
|
88
83
|
type: z.string(),
|
|
89
84
|
}),
|
|
85
|
+
error: 'Policy not found or invalid',
|
|
90
86
|
},
|
|
91
87
|
// Purpose errors
|
|
92
88
|
PURPOSES_NOT_FOUND: {
|
|
93
89
|
status: 404,
|
|
94
|
-
message: 'Could not find all specified purposes',
|
|
95
90
|
data: z.object({
|
|
96
91
|
preferences: z.array(z.string()),
|
|
97
92
|
foundPurposes: z.array(z.string()),
|
|
98
93
|
}),
|
|
94
|
+
error: 'Could not find all specified purposes',
|
|
99
95
|
},
|
|
100
96
|
// Cookie banner specific errors
|
|
101
97
|
COOKIE_BANNER_PREFERENCES_REQUIRED: {
|
|
102
98
|
status: 400,
|
|
103
|
-
message: 'Preferences are required for cookie banner consent',
|
|
104
99
|
data: z.object({
|
|
105
100
|
type: z.literal('cookie_banner'),
|
|
106
101
|
}),
|
|
102
|
+
error: 'Preferences are required for cookie banner consent',
|
|
107
103
|
},
|
|
108
104
|
// Consent errors
|
|
109
105
|
NO_CONSENT_FOUND: {
|
|
110
106
|
status: 404,
|
|
111
|
-
message: 'No consent found for the given policy',
|
|
112
107
|
data: z.object({
|
|
113
108
|
policyId: z.string(),
|
|
114
109
|
subjectId: z.string(),
|
|
115
110
|
domainId: z.string(),
|
|
116
111
|
}),
|
|
112
|
+
error: 'No consent found for the given policy',
|
|
117
113
|
},
|
|
118
114
|
})
|
|
119
115
|
.input(verifyConsentInputSchema)
|
package/src/core.ts
CHANGED
|
@@ -47,6 +47,9 @@ export type Route = {
|
|
|
47
47
|
* // Handle an incoming request
|
|
48
48
|
* const response = await instance.handler(request);
|
|
49
49
|
* ```
|
|
50
|
+
*
|
|
51
|
+
* @deprecated Will be removed in the next major version. Update to `@c15t/backend/v2`, view migration guide for more details.
|
|
52
|
+
* @see https://c15t.com/docs/self-host/migrate-from-v1
|
|
50
53
|
*/
|
|
51
54
|
export interface C15TInstance<PluginTypes extends C15TPlugin[] = C15TPlugin[]> {
|
|
52
55
|
/**
|
|
@@ -101,6 +104,9 @@ export interface C15TInstance<PluginTypes extends C15TPlugin[] = C15TPlugin[]> {
|
|
|
101
104
|
* Creates a new c15t consent management instance.
|
|
102
105
|
*
|
|
103
106
|
* This version provides a unified handler that works with oRPC to handle requests.
|
|
107
|
+
*
|
|
108
|
+
* @deprecated Will be removed in the next major version. Update to `@c15t/backend/v2`, view migration guide for more details.
|
|
109
|
+
* @see https://c15t.com/docs/self-host/migrate-from-v1
|
|
104
110
|
*/
|
|
105
111
|
export const c15tInstance = <PluginTypes extends C15TPlugin[] = C15TPlugin[]>(
|
|
106
112
|
options: C15TOptions<PluginTypes>
|
|
@@ -457,3 +463,4 @@ export const c15tInstance = <PluginTypes extends C15TPlugin[] = C15TPlugin[]>(
|
|
|
457
463
|
|
|
458
464
|
export type { C15TPlugin, C15TOptions, C15TContext };
|
|
459
465
|
export type { ContractsInputs, ContractsOutputs } from './contracts';
|
|
466
|
+
export { version } from './version';
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import type { Translations } from '@c15t/translations';
|
|
2
|
-
import { ORPCError } from '@orpc/server';
|
|
3
2
|
import { os } from '~/contracts';
|
|
4
3
|
import {
|
|
5
4
|
type JurisdictionCode,
|
|
6
5
|
JurisdictionMessages,
|
|
7
6
|
} from '~/contracts/shared/jurisdiction.schema';
|
|
8
|
-
import type { C15TContext } from '~/types';
|
|
7
|
+
import type { Branding, C15TContext } from '~/types';
|
|
9
8
|
import { checkJurisdiction } from './geo';
|
|
10
9
|
import { getTranslations } from './translations';
|
|
11
10
|
|
|
12
11
|
function getHeaders(headers: Headers | undefined) {
|
|
13
12
|
if (!headers) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
return {
|
|
14
|
+
countryCode: null,
|
|
15
|
+
regionCode: null,
|
|
16
|
+
acceptLanguage: null,
|
|
17
|
+
};
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
// Add this conversion to ensure headers are always string or null
|
|
@@ -57,6 +56,7 @@ function buildResponse({
|
|
|
57
56
|
location,
|
|
58
57
|
acceptLanguage,
|
|
59
58
|
customTranslations,
|
|
59
|
+
branding = 'c15t',
|
|
60
60
|
}: {
|
|
61
61
|
shouldShowBanner: boolean;
|
|
62
62
|
|
|
@@ -67,12 +67,14 @@ function buildResponse({
|
|
|
67
67
|
location: { countryCode: string | null; regionCode: string | null };
|
|
68
68
|
acceptLanguage: string | null;
|
|
69
69
|
customTranslations: Record<string, Partial<Translations>> | undefined;
|
|
70
|
+
branding?: Branding;
|
|
70
71
|
}) {
|
|
71
72
|
return {
|
|
72
73
|
showConsentBanner: shouldShowBanner,
|
|
73
74
|
jurisdiction,
|
|
74
75
|
location,
|
|
75
76
|
translations: getTranslations(acceptLanguage, customTranslations),
|
|
77
|
+
branding,
|
|
76
78
|
};
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -83,9 +85,8 @@ function buildResponse({
|
|
|
83
85
|
export const showConsentBanner = os.consent.showBanner.handler(
|
|
84
86
|
({ context }) => {
|
|
85
87
|
const typedContext = context as C15TContext;
|
|
86
|
-
const { customTranslations, disableGeoLocation } =
|
|
88
|
+
const { customTranslations, disableGeoLocation, branding } =
|
|
87
89
|
typedContext.options.advanced ?? {};
|
|
88
|
-
|
|
89
90
|
const { countryCode, regionCode, acceptLanguage } = getHeaders(
|
|
90
91
|
typedContext.headers
|
|
91
92
|
);
|
|
@@ -100,6 +101,7 @@ export const showConsentBanner = os.consent.showBanner.handler(
|
|
|
100
101
|
location: { countryCode: null, regionCode: null },
|
|
101
102
|
acceptLanguage,
|
|
102
103
|
customTranslations,
|
|
104
|
+
branding,
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
|
|
@@ -115,6 +117,7 @@ export const showConsentBanner = os.consent.showBanner.handler(
|
|
|
115
117
|
location: { countryCode, regionCode },
|
|
116
118
|
acceptLanguage,
|
|
117
119
|
customTranslations,
|
|
120
|
+
branding,
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
123
|
);
|
package/src/init.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
2
2
|
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
3
3
|
import { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
4
4
|
import { defu } from 'defu';
|
|
@@ -11,14 +11,14 @@ import { version } from '../package.json';
|
|
|
11
11
|
import { generateId } from './pkgs/data-model/fields/id-generator';
|
|
12
12
|
import type { EntityName } from './pkgs/data-model/schema/types';
|
|
13
13
|
import {
|
|
14
|
-
ERROR_CODES,
|
|
15
|
-
type SDKResult,
|
|
16
|
-
type TelemetryConfig,
|
|
17
14
|
createTelemetryOptions,
|
|
15
|
+
ERROR_CODES,
|
|
18
16
|
fail,
|
|
19
17
|
failAsync,
|
|
20
18
|
ok,
|
|
21
19
|
promiseToResult,
|
|
20
|
+
type SDKResult,
|
|
21
|
+
type TelemetryConfig,
|
|
22
22
|
} from './pkgs/results';
|
|
23
23
|
|
|
24
24
|
import type { DoubleTieOptions } from './pkgs/types/options';
|
|
@@ -113,7 +113,7 @@ export const init = async <P extends C15TPlugin[]>(
|
|
|
113
113
|
telemetryInitialized = false;
|
|
114
114
|
} else {
|
|
115
115
|
// Create a telemetry resource with provided values or safe defaults
|
|
116
|
-
const resource =
|
|
116
|
+
const resource = resourceFromAttributes({
|
|
117
117
|
'service.name': String(appName),
|
|
118
118
|
'service.version': String(version || '1.0.0'),
|
|
119
119
|
...(telemetryOptions?.defaultAttributes || {}),
|
|
@@ -196,7 +196,10 @@ export const init = async <P extends C15TPlugin[]>(
|
|
|
196
196
|
const generateIdFunc = ({
|
|
197
197
|
model,
|
|
198
198
|
size = 16,
|
|
199
|
-
}: {
|
|
199
|
+
}: {
|
|
200
|
+
model: EntityName;
|
|
201
|
+
size?: number;
|
|
202
|
+
}) => {
|
|
200
203
|
return (
|
|
201
204
|
finalOptions?.advanced?.generateId?.({ model, size }) ||
|
|
202
205
|
generateId(getConsentTables(finalOptions)[model].entityPrefix)
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
* - Documentation UI
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
10
|
+
export { createDefaultOpenAPIOptions, createOpenAPIConfig } from './config';
|
|
11
|
+
export { createDocsUI, createOpenAPISpec } from './handlers';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { beforeEach, describe, expect, type Mock, test, vi } from 'vitest';
|
|
2
2
|
import type { HookEndpointContext } from '~/pkgs/types';
|
|
3
3
|
import { runAfterHooks, runBeforeHooks } from '../processor';
|
|
4
4
|
|
|
@@ -4,39 +4,34 @@
|
|
|
4
4
|
* This module provides field definition utilities for the data model system.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
// Export core types
|
|
8
|
-
export type {
|
|
9
|
-
FieldType,
|
|
10
|
-
Field,
|
|
11
|
-
FieldConfig,
|
|
12
|
-
Primitive,
|
|
13
|
-
JsonValue,
|
|
14
|
-
} from './field-types';
|
|
15
|
-
|
|
16
|
-
// Export factory functions
|
|
17
|
-
export { COMMON_TIMEZONES } from './field-factory';
|
|
18
|
-
|
|
19
7
|
// Export field options
|
|
20
8
|
export type {
|
|
9
|
+
DateFieldOptions,
|
|
21
10
|
NumberFieldOptions,
|
|
22
11
|
StringFieldOptions,
|
|
23
|
-
DateFieldOptions,
|
|
24
12
|
} from './field-factory';
|
|
25
13
|
|
|
14
|
+
// Export factory functions
|
|
15
|
+
export { COMMON_TIMEZONES } from './field-factory';
|
|
16
|
+
// Export field inference utilities
|
|
17
|
+
export type {
|
|
18
|
+
InferFieldInput,
|
|
19
|
+
InferFieldOutput,
|
|
20
|
+
} from './field-inference';
|
|
21
|
+
// Export core types
|
|
22
|
+
export type {
|
|
23
|
+
Field,
|
|
24
|
+
FieldConfig,
|
|
25
|
+
FieldType,
|
|
26
|
+
JsonValue,
|
|
27
|
+
Primitive,
|
|
28
|
+
} from './field-types';
|
|
26
29
|
// Export ID generator
|
|
27
30
|
export { generateId } from './id-generator';
|
|
28
|
-
|
|
29
31
|
// Export SuperJSON utilities
|
|
30
32
|
export {
|
|
31
|
-
getDatabaseType,
|
|
32
33
|
type DatabaseType,
|
|
34
|
+
getDatabaseType,
|
|
33
35
|
} from './superjson-utils';
|
|
34
|
-
|
|
35
36
|
// Export Zod utilities
|
|
36
37
|
export { validateField } from './zod-fields';
|
|
37
|
-
|
|
38
|
-
// Export field inference utilities
|
|
39
|
-
export type {
|
|
40
|
-
InferFieldOutput,
|
|
41
|
-
InferFieldInput,
|
|
42
|
-
} from './field-inference';
|
|
@@ -5,34 +5,22 @@ import type { Field, FieldType } from './field-types';
|
|
|
5
5
|
* Base Zod schema for field configuration options
|
|
6
6
|
*/
|
|
7
7
|
const fieldConfigSchema = z.object({
|
|
8
|
-
required: z.boolean().
|
|
9
|
-
returned: z.boolean().
|
|
10
|
-
input: z.boolean().
|
|
11
|
-
defaultValue: z.
|
|
8
|
+
required: z.boolean().prefault(true),
|
|
9
|
+
returned: z.boolean().prefault(true),
|
|
10
|
+
input: z.boolean().prefault(true),
|
|
11
|
+
defaultValue: z.any().optional(),
|
|
12
12
|
transform: z
|
|
13
13
|
.object({
|
|
14
|
-
input: z
|
|
15
|
-
|
|
16
|
-
.args(z.any())
|
|
17
|
-
.returns(z.union([z.any(), z.promise(z.any())]))
|
|
18
|
-
.optional(),
|
|
19
|
-
output: z
|
|
20
|
-
.function()
|
|
21
|
-
.args(z.any())
|
|
22
|
-
.returns(z.union([z.any(), z.promise(z.any())]))
|
|
23
|
-
.optional(),
|
|
14
|
+
input: z.any().optional(),
|
|
15
|
+
output: z.any().optional(),
|
|
24
16
|
})
|
|
25
17
|
.optional(),
|
|
26
|
-
validator: z
|
|
27
|
-
.function()
|
|
28
|
-
.args(z.any())
|
|
29
|
-
.returns(z.union([z.string(), z.null()]))
|
|
30
|
-
.optional(),
|
|
18
|
+
validator: z.any().optional(),
|
|
31
19
|
unique: z.boolean().optional(),
|
|
32
20
|
indexed: z.boolean().optional(),
|
|
33
|
-
sortable: z.boolean().
|
|
21
|
+
sortable: z.boolean().prefault(true),
|
|
34
22
|
fieldName: z.string().optional(),
|
|
35
|
-
bigint: z.boolean().
|
|
23
|
+
bigint: z.boolean().prefault(false),
|
|
36
24
|
});
|
|
37
25
|
|
|
38
26
|
/**
|
|
@@ -68,8 +56,8 @@ export const dateFieldSchema = fieldConfigSchema.extend({
|
|
|
68
56
|
type: z.literal('date'),
|
|
69
57
|
minDate: z.date().optional(),
|
|
70
58
|
maxDate: z.date().optional(),
|
|
71
|
-
dateOnly: z.boolean().
|
|
72
|
-
format: z.record(z.unknown()).optional(),
|
|
59
|
+
dateOnly: z.boolean().prefault(false),
|
|
60
|
+
format: z.record(z.string(), z.unknown()).optional(),
|
|
73
61
|
});
|
|
74
62
|
|
|
75
63
|
/**
|
|
@@ -77,9 +65,9 @@ export const dateFieldSchema = fieldConfigSchema.extend({
|
|
|
77
65
|
*/
|
|
78
66
|
export const timezoneFieldSchema = fieldConfigSchema.extend({
|
|
79
67
|
type: z.literal('timezone'),
|
|
80
|
-
validateTimezone: z.boolean().
|
|
68
|
+
validateTimezone: z.boolean().prefault(true),
|
|
81
69
|
suggestedValues: z.array(z.string()).optional(),
|
|
82
|
-
restrictToSuggestedValues: z.boolean().
|
|
70
|
+
restrictToSuggestedValues: z.boolean().prefault(false),
|
|
83
71
|
});
|
|
84
72
|
|
|
85
73
|
/**
|
|
@@ -87,7 +75,7 @@ export const timezoneFieldSchema = fieldConfigSchema.extend({
|
|
|
87
75
|
*/
|
|
88
76
|
export const jsonFieldSchema = fieldConfigSchema.extend({
|
|
89
77
|
type: z.literal('json'),
|
|
90
|
-
validateJson: z.boolean().
|
|
78
|
+
validateJson: z.boolean().prefault(true),
|
|
91
79
|
});
|
|
92
80
|
|
|
93
81
|
/**
|
|
@@ -31,9 +31,10 @@
|
|
|
31
31
|
* });
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
export { createWithHooks } from './create-hooks';
|
|
36
|
+
export type { DatabaseHook } from './types';
|
|
36
37
|
export { updateWithHooks } from './update-hooks';
|
|
37
38
|
export { updateManyWithHooks } from './update-many-hooks';
|
|
39
|
+
export { processAfterHooksForMany, processHooks } from './utils';
|
|
38
40
|
export { getWithHooks } from './with-hooks-factory';
|
|
39
|
-
export { processHooks, processAfterHooksForMany } from './utils';
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
// Re-export field-related exports
|
|
9
9
|
export * from './fields';
|
|
10
|
-
|
|
11
|
-
// Re-export schema-related exports
|
|
12
|
-
export * from './schema';
|
|
13
|
-
|
|
14
10
|
// Re-export hook-related exports
|
|
15
11
|
export * from './hooks';
|
|
12
|
+
// Re-export schema-related exports
|
|
13
|
+
export * from './schema';
|
|
@@ -4,17 +4,16 @@
|
|
|
4
4
|
* This module provides schema definition utilities for the data model system.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
// Re-export all the table definitions
|
|
8
|
+
export * from './schemas';
|
|
7
9
|
// Export core types
|
|
8
10
|
export type {
|
|
9
|
-
SchemaDefinition,
|
|
10
|
-
TableDefinition,
|
|
11
|
-
EntityTypeMap,
|
|
12
11
|
EntityField,
|
|
13
12
|
EntityInput,
|
|
14
13
|
EntityName,
|
|
15
|
-
PluginSchema,
|
|
16
14
|
EntityOutput,
|
|
15
|
+
EntityTypeMap,
|
|
16
|
+
PluginSchema,
|
|
17
|
+
SchemaDefinition,
|
|
18
|
+
TableDefinition,
|
|
17
19
|
} from './types';
|
|
18
|
-
|
|
19
|
-
// Re-export all the table definitions
|
|
20
|
-
export * from './schemas';
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* It serves as the central hub for accessing all schema definitions.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
export * from '~/schema/subject';
|
|
8
|
+
export * from '~/schema/audit-log';
|
|
10
9
|
export * from '~/schema/consent';
|
|
11
10
|
export * from '~/schema/consent-policy';
|
|
12
11
|
export * from '~/schema/consent-purpose';
|
|
13
12
|
export * from '~/schema/consent-record';
|
|
14
13
|
export * from '~/schema/domain';
|
|
15
|
-
|
|
14
|
+
// Export the complete schema tables directly from their source locations
|
|
15
|
+
export * from '~/schema/subject';
|