@c15t/backend 2.0.0-rc.0 → 2.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/302.js +473 -0
- package/dist/583.js +540 -0
- package/dist/915.js +1771 -0
- package/dist/cache.cjs +5 -5
- package/dist/cache.js +4 -415
- package/dist/core.cjs +1356 -120
- package/dist/core.js +163 -1981
- package/dist/db/adapters/drizzle.cjs +1 -1
- package/dist/db/adapters/drizzle.js +1 -2
- package/dist/db/adapters/kysely.cjs +1 -1
- package/dist/db/adapters/kysely.js +1 -2
- package/dist/db/adapters/mongo.cjs +1 -1
- package/dist/db/adapters/mongo.js +1 -2
- package/dist/db/adapters/prisma.cjs +1 -1
- package/dist/db/adapters/prisma.js +1 -2
- package/dist/db/adapters/typeorm.cjs +1 -1
- package/dist/db/adapters/typeorm.js +1 -2
- package/dist/db/adapters.cjs +1 -1
- package/dist/db/migrator.cjs +1 -1
- package/dist/db/schema.cjs +43 -3
- package/dist/db/schema.js +35 -4
- package/dist/define-config.cjs +1 -1
- package/dist/edge.cjs +1106 -0
- package/dist/edge.js +190 -0
- package/dist/router.cjs +885 -123
- package/dist/router.js +1 -1507
- package/dist/{types.cjs → types/index.cjs} +1 -1
- package/{dist → dist-types}/cache/adapters/cloudflare-kv.d.ts +0 -1
- package/{dist → dist-types}/cache/adapters/index.d.ts +0 -1
- package/{dist → dist-types}/cache/adapters/memory.d.ts +0 -1
- package/{dist → dist-types}/cache/adapters/upstash-redis.d.ts +0 -1
- package/{dist → dist-types}/cache/gvl-resolver.d.ts +0 -1
- package/{dist → dist-types}/cache/index.d.ts +0 -1
- package/{dist → dist-types}/cache/keys.d.ts +0 -1
- package/{dist → dist-types}/cache/types.d.ts +0 -1
- package/{dist → dist-types}/core.d.ts +8 -1
- package/{dist → dist-types}/db/migrator/index.d.ts +0 -1
- package/dist-types/db/registry/consent-policy.d.ts +78 -0
- package/{dist → dist-types}/db/registry/consent-purpose.d.ts +0 -1
- package/{dist → dist-types}/db/registry/domain.d.ts +0 -1
- package/dist-types/db/registry/index.d.ts +118 -0
- package/dist-types/db/registry/runtime-policy-decision.d.ts +60 -0
- package/{dist → dist-types}/db/registry/subject.d.ts +0 -2
- package/{dist → dist-types}/db/registry/types.d.ts +1 -1
- package/{dist → dist-types}/db/registry/utils/generate-id.d.ts +0 -1
- package/{dist → dist-types}/db/registry/utils.d.ts +0 -1
- package/{dist → dist-types}/db/schema/1.0.0/audit-log.d.ts +0 -1
- package/{dist → dist-types}/db/schema/1.0.0/consent-policy.d.ts +0 -1
- package/{dist → dist-types}/db/schema/1.0.0/consent-purpose.d.ts +0 -1
- package/{dist → dist-types}/db/schema/1.0.0/consent-record.d.ts +0 -1
- package/{dist → dist-types}/db/schema/1.0.0/consent.d.ts +1 -2
- package/{dist → dist-types}/db/schema/1.0.0/domain.d.ts +0 -1
- package/{dist → dist-types}/db/schema/1.0.0/index.d.ts +0 -32
- package/{dist → dist-types}/db/schema/1.0.0/subject.d.ts +0 -2
- package/{dist → dist-types}/db/schema/2.0.0/audit-log.d.ts +1 -2
- package/{dist → dist-types}/db/schema/2.0.0/consent-policy.d.ts +3 -3
- package/{dist → dist-types}/db/schema/2.0.0/consent-purpose.d.ts +1 -2
- package/{dist → dist-types}/db/schema/2.0.0/consent.d.ts +7 -2
- package/{dist → dist-types}/db/schema/2.0.0/domain.d.ts +1 -2
- package/{dist → dist-types}/db/schema/2.0.0/index.d.ts +455 -28
- package/dist-types/db/schema/2.0.0/runtime-policy-decision.d.ts +23 -0
- package/{dist → dist-types}/db/schema/2.0.0/subject.d.ts +1 -3
- package/{dist → dist-types}/db/schema/index.d.ts +908 -86
- package/{dist → dist-types}/db/tenant-scope.d.ts +0 -1
- package/dist-types/define-config.d.ts +17 -0
- package/dist-types/edge/index.d.ts +5 -0
- package/dist-types/edge/init-handler.d.ts +40 -0
- package/dist-types/edge/resolve-consent.d.ts +80 -0
- package/dist-types/edge/types.d.ts +13 -0
- package/{dist → dist-types}/handlers/consent/check.handler.d.ts +0 -1
- package/{src/handlers/consent/index.ts → dist-types/handlers/consent/index.d.ts} +0 -1
- package/{dist → dist-types}/handlers/init/geo.d.ts +2 -3
- package/{dist → dist-types}/handlers/init/index.d.ts +2 -3
- package/dist-types/handlers/init/policy.d.ts +26 -0
- package/dist-types/handlers/init/resolve-init.d.ts +44 -0
- package/dist-types/handlers/init/translations.d.ts +48 -0
- package/dist-types/handlers/legal-document/current.handler.d.ts +11 -0
- package/dist-types/handlers/legal-document/snapshot.d.ts +39 -0
- package/dist-types/handlers/policy/snapshot.d.ts +99 -0
- package/{src/handlers/status/index.ts → dist-types/handlers/status/index.d.ts} +0 -1
- package/{dist → dist-types}/handlers/status/status.handler.d.ts +0 -1
- package/{dist → dist-types}/handlers/subject/get.handler.d.ts +3 -2
- package/{src/handlers/subject/index.ts → dist-types/handlers/subject/index.d.ts} +0 -1
- package/{dist → dist-types}/handlers/subject/list.handler.d.ts +3 -2
- package/{dist → dist-types}/handlers/subject/patch.handler.d.ts +0 -2
- package/{dist → dist-types}/handlers/subject/post.handler.d.ts +12 -1
- package/{dist → dist-types}/handlers/utils/consent-enrichment.d.ts +3 -1
- package/{dist → dist-types}/init.d.ts +4 -7
- package/{dist → dist-types}/middleware/auth/index.d.ts +0 -1
- package/{dist → dist-types}/middleware/auth/validate-api-key.d.ts +0 -1
- package/{dist → dist-types}/middleware/cors/cors.d.ts +0 -1
- package/{src/middleware/cors/index.ts → dist-types/middleware/cors/index.d.ts} +0 -1
- package/{dist → dist-types}/middleware/cors/is-origin-trusted.d.ts +0 -1
- package/{dist → dist-types}/middleware/cors/process-cors.d.ts +0 -1
- package/{dist → dist-types}/middleware/openapi/config.d.ts +0 -1
- package/{dist → dist-types}/middleware/openapi/handlers.d.ts +0 -1
- package/{src/middleware/openapi/index.ts → dist-types/middleware/openapi/index.d.ts} +0 -1
- package/{dist → dist-types}/middleware/process-ip/index.d.ts +0 -1
- package/dist-types/policies/builder.d.ts +127 -0
- package/dist-types/policies/defaults.d.ts +2 -0
- package/dist-types/policies/matchers.d.ts +3 -0
- package/{dist → dist-types}/router.d.ts +0 -1
- package/{dist → dist-types}/routes/consent.d.ts +0 -1
- package/{dist → dist-types}/routes/index.d.ts +1 -1
- package/{dist → dist-types}/routes/init.d.ts +0 -1
- package/dist-types/routes/legal-document.d.ts +7 -0
- package/{dist → dist-types}/routes/status.d.ts +0 -1
- package/{dist → dist-types}/routes/subject.d.ts +0 -1
- package/{dist → dist-types}/types/api.d.ts +0 -1
- package/dist-types/types/index.d.ts +464 -0
- package/dist-types/utils/background.d.ts +6 -0
- package/{dist → dist-types}/utils/create-telemetry-options.d.ts +1 -2
- package/{dist → dist-types}/utils/env.d.ts +0 -1
- package/{dist → dist-types}/utils/extract-error-message.d.ts +0 -1
- package/{dist → dist-types}/utils/instrumentation.d.ts +2 -3
- package/{dist → dist-types}/utils/logger.d.ts +0 -1
- package/{dist → dist-types}/utils/metrics.d.ts +0 -1
- package/dist-types/version.d.ts +1 -0
- package/docs/README.md +49 -0
- package/docs/api/configuration.md +208 -0
- package/docs/api/endpoints.md +211 -0
- package/docs/guides/caching.md +85 -0
- package/docs/guides/database-setup.md +128 -0
- package/docs/guides/edge-deployment.md +251 -0
- package/docs/guides/framework-integration.md +142 -0
- package/docs/guides/iab-tcf.md +89 -0
- package/docs/guides/observability.md +96 -0
- package/docs/guides/policy-packs.md +396 -0
- package/docs/quickstart.md +129 -0
- package/package.json +53 -39
- package/.turbo/turbo-build.log +0 -49
- package/CHANGELOG.md +0 -89
- package/dist/cache/adapters/cloudflare-kv.d.ts.map +0 -1
- package/dist/cache/adapters/index.d.ts.map +0 -1
- package/dist/cache/adapters/memory.d.ts.map +0 -1
- package/dist/cache/adapters/upstash-redis.d.ts.map +0 -1
- package/dist/cache/gvl-resolver.d.ts.map +0 -1
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/keys.d.ts.map +0 -1
- package/dist/cache/types.d.ts.map +0 -1
- package/dist/core.d.ts.map +0 -1
- package/dist/db/adapters/drizzle.d.ts +0 -2
- package/dist/db/adapters/drizzle.d.ts.map +0 -1
- package/dist/db/adapters/index.d.ts +0 -2
- package/dist/db/adapters/index.d.ts.map +0 -1
- package/dist/db/adapters/kysely.d.ts +0 -2
- package/dist/db/adapters/kysely.d.ts.map +0 -1
- package/dist/db/adapters/mongo.d.ts +0 -2
- package/dist/db/adapters/mongo.d.ts.map +0 -1
- package/dist/db/adapters/prisma.d.ts +0 -2
- package/dist/db/adapters/prisma.d.ts.map +0 -1
- package/dist/db/adapters/typeorm.d.ts +0 -2
- package/dist/db/adapters/typeorm.d.ts.map +0 -1
- package/dist/db/migrator/index.d.ts.map +0 -1
- package/dist/db/registry/consent-policy.d.ts +0 -23
- package/dist/db/registry/consent-policy.d.ts.map +0 -1
- package/dist/db/registry/consent-purpose.d.ts.map +0 -1
- package/dist/db/registry/domain.d.ts.map +0 -1
- package/dist/db/registry/index.d.ts +0 -57
- package/dist/db/registry/index.d.ts.map +0 -1
- package/dist/db/registry/subject.d.ts.map +0 -1
- package/dist/db/registry/types.d.ts.map +0 -1
- package/dist/db/registry/utils/generate-id.d.ts.map +0 -1
- package/dist/db/registry/utils.d.ts.map +0 -1
- package/dist/db/schema/1.0.0/audit-log.d.ts.map +0 -1
- package/dist/db/schema/1.0.0/consent-policy.d.ts.map +0 -1
- package/dist/db/schema/1.0.0/consent-purpose.d.ts.map +0 -1
- package/dist/db/schema/1.0.0/consent-record.d.ts.map +0 -1
- package/dist/db/schema/1.0.0/consent.d.ts.map +0 -1
- package/dist/db/schema/1.0.0/domain.d.ts.map +0 -1
- package/dist/db/schema/1.0.0/index.d.ts.map +0 -1
- package/dist/db/schema/1.0.0/subject.d.ts.map +0 -1
- package/dist/db/schema/2.0.0/audit-log.d.ts.map +0 -1
- package/dist/db/schema/2.0.0/consent-policy.d.ts.map +0 -1
- package/dist/db/schema/2.0.0/consent-purpose.d.ts.map +0 -1
- package/dist/db/schema/2.0.0/consent.d.ts.map +0 -1
- package/dist/db/schema/2.0.0/domain.d.ts.map +0 -1
- package/dist/db/schema/2.0.0/index.d.ts.map +0 -1
- package/dist/db/schema/2.0.0/subject.d.ts.map +0 -1
- package/dist/db/schema/index.d.ts.map +0 -1
- package/dist/db/tenant-scope.d.ts.map +0 -1
- package/dist/define-config.d.ts +0 -5
- package/dist/define-config.d.ts.map +0 -1
- package/dist/handlers/consent/check.handler.d.ts.map +0 -1
- package/dist/handlers/consent/index.d.ts +0 -12
- package/dist/handlers/consent/index.d.ts.map +0 -1
- package/dist/handlers/init/geo.d.ts.map +0 -1
- package/dist/handlers/init/index.d.ts.map +0 -1
- package/dist/handlers/init/translations.d.ts +0 -28
- package/dist/handlers/init/translations.d.ts.map +0 -1
- package/dist/handlers/status/index.d.ts +0 -7
- package/dist/handlers/status/index.d.ts.map +0 -1
- package/dist/handlers/status/status.handler.d.ts.map +0 -1
- package/dist/handlers/subject/get.handler.d.ts.map +0 -1
- package/dist/handlers/subject/index.d.ts +0 -10
- package/dist/handlers/subject/index.d.ts.map +0 -1
- package/dist/handlers/subject/list.handler.d.ts.map +0 -1
- package/dist/handlers/subject/patch.handler.d.ts.map +0 -1
- package/dist/handlers/subject/post.handler.d.ts.map +0 -1
- package/dist/handlers/utils/consent-enrichment.d.ts.map +0 -1
- package/dist/init.d.ts.map +0 -1
- package/dist/middleware/auth/index.d.ts.map +0 -1
- package/dist/middleware/auth/validate-api-key.d.ts.map +0 -1
- package/dist/middleware/cors/cors.d.ts.map +0 -1
- package/dist/middleware/cors/index.d.ts +0 -30
- package/dist/middleware/cors/index.d.ts.map +0 -1
- package/dist/middleware/cors/is-origin-trusted.d.ts.map +0 -1
- package/dist/middleware/cors/process-cors.d.ts.map +0 -1
- package/dist/middleware/openapi/config.d.ts.map +0 -1
- package/dist/middleware/openapi/handlers.d.ts.map +0 -1
- package/dist/middleware/openapi/index.d.ts +0 -12
- package/dist/middleware/openapi/index.d.ts.map +0 -1
- package/dist/middleware/process-ip/index.d.ts.map +0 -1
- package/dist/router.d.ts.map +0 -1
- package/dist/routes/consent.d.ts.map +0 -1
- package/dist/routes/index.d.ts.map +0 -1
- package/dist/routes/init.d.ts.map +0 -1
- package/dist/routes/status.d.ts.map +0 -1
- package/dist/routes/subject.d.ts.map +0 -1
- package/dist/types/api.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -255
- package/dist/types/index.d.ts.map +0 -1
- package/dist/utils/create-telemetry-options.d.ts.map +0 -1
- package/dist/utils/env.d.ts.map +0 -1
- package/dist/utils/extract-error-message.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/instrumentation.d.ts.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/metrics.d.ts.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/knip.json +0 -31
- package/rslib.config.ts +0 -93
- package/src/cache/adapters/cloudflare-kv.ts +0 -71
- package/src/cache/adapters/index.ts +0 -22
- package/src/cache/adapters/memory.ts +0 -111
- package/src/cache/adapters/upstash-redis.ts +0 -113
- package/src/cache/gvl-resolver.ts +0 -289
- package/src/cache/index.ts +0 -34
- package/src/cache/keys.ts +0 -68
- package/src/cache/types.ts +0 -66
- package/src/core.ts +0 -368
- package/src/db/migrator/index.ts +0 -80
- package/src/db/registry/consent-policy.test.ts +0 -451
- package/src/db/registry/consent-policy.ts +0 -82
- package/src/db/registry/consent-purpose.test.ts +0 -428
- package/src/db/registry/consent-purpose.ts +0 -61
- package/src/db/registry/domain.test.ts +0 -445
- package/src/db/registry/domain.ts +0 -91
- package/src/db/registry/index.ts +0 -14
- package/src/db/registry/subject.test.ts +0 -388
- package/src/db/registry/subject.ts +0 -129
- package/src/db/registry/types.ts +0 -10
- package/src/db/registry/utils/generate-id.test.ts +0 -216
- package/src/db/registry/utils/generate-id.ts +0 -133
- package/src/db/registry/utils.ts +0 -133
- package/src/db/schema/1.0.0/audit-log.ts +0 -15
- package/src/db/schema/1.0.0/consent-policy.ts +0 -14
- package/src/db/schema/1.0.0/consent-purpose.ts +0 -14
- package/src/db/schema/1.0.0/consent-record.ts +0 -10
- package/src/db/schema/1.0.0/consent.ts +0 -20
- package/src/db/schema/1.0.0/domain.ts +0 -12
- package/src/db/schema/1.0.0/index.ts +0 -48
- package/src/db/schema/1.0.0/subject.ts +0 -12
- package/src/db/schema/2.0.0/audit-log.ts +0 -18
- package/src/db/schema/2.0.0/consent-policy.ts +0 -28
- package/src/db/schema/2.0.0/consent-purpose.ts +0 -12
- package/src/db/schema/2.0.0/consent.ts +0 -26
- package/src/db/schema/2.0.0/domain.ts +0 -12
- package/src/db/schema/2.0.0/index.ts +0 -47
- package/src/db/schema/2.0.0/subject.ts +0 -14
- package/src/db/schema/index.ts +0 -15
- package/src/db/tenant-scope.test.ts +0 -750
- package/src/db/tenant-scope.ts +0 -103
- package/src/define-config.ts +0 -5
- package/src/handlers/consent/check.handler.ts +0 -126
- package/src/handlers/init/geo.test.ts +0 -317
- package/src/handlers/init/geo.ts +0 -195
- package/src/handlers/init/index.test.ts +0 -205
- package/src/handlers/init/index.ts +0 -114
- package/src/handlers/init/translations.test.ts +0 -121
- package/src/handlers/init/translations.ts +0 -72
- package/src/handlers/status/status.handler.test.ts +0 -155
- package/src/handlers/status/status.handler.ts +0 -51
- package/src/handlers/subject/get.handler.ts +0 -93
- package/src/handlers/subject/list.handler.ts +0 -93
- package/src/handlers/subject/patch.handler.ts +0 -122
- package/src/handlers/subject/post.handler.test.ts +0 -294
- package/src/handlers/subject/post.handler.ts +0 -254
- package/src/handlers/utils/consent-enrichment.test.ts +0 -380
- package/src/handlers/utils/consent-enrichment.ts +0 -218
- package/src/init.test.ts +0 -126
- package/src/init.ts +0 -87
- package/src/middleware/auth/index.ts +0 -11
- package/src/middleware/auth/validate-api-key.test.ts +0 -86
- package/src/middleware/auth/validate-api-key.ts +0 -107
- package/src/middleware/cors/cors.test.ts +0 -135
- package/src/middleware/cors/cors.ts +0 -186
- package/src/middleware/cors/is-origin-trusted.test.ts +0 -164
- package/src/middleware/cors/is-origin-trusted.ts +0 -130
- package/src/middleware/cors/process-cors.ts +0 -91
- package/src/middleware/openapi/config.ts +0 -29
- package/src/middleware/openapi/handlers.ts +0 -34
- package/src/middleware/process-ip/index.test.ts +0 -195
- package/src/middleware/process-ip/index.ts +0 -199
- package/src/router.ts +0 -15
- package/src/routes/consent.ts +0 -52
- package/src/routes/index.ts +0 -10
- package/src/routes/init.ts +0 -102
- package/src/routes/status.ts +0 -46
- package/src/routes/subject.ts +0 -152
- package/src/types/api.ts +0 -48
- package/src/types/index.ts +0 -288
- package/src/utils/create-telemetry-options.test.ts +0 -302
- package/src/utils/create-telemetry-options.ts +0 -229
- package/src/utils/env.ts +0 -84
- package/src/utils/extract-error-message.ts +0 -21
- package/src/utils/instrumentation.test.ts +0 -185
- package/src/utils/instrumentation.ts +0 -196
- package/src/utils/logger.ts +0 -41
- package/src/utils/metrics.test.ts +0 -323
- package/src/utils/metrics.ts +0 -402
- package/src/utils/telemetry-pii.test.ts +0 -325
- package/src/version.ts +0 -2
- package/tsconfig.json +0 -11
- package/vitest.config.ts +0 -28
- /package/dist/{types.js → types/index.js} +0 -0
- /package/{src/db/adapters/drizzle.ts → dist-types/db/adapters/drizzle.d.ts} +0 -0
- /package/{src/db/adapters/index.ts → dist-types/db/adapters/index.d.ts} +0 -0
- /package/{src/db/adapters/kysely.ts → dist-types/db/adapters/kysely.d.ts} +0 -0
- /package/{src/db/adapters/mongo.ts → dist-types/db/adapters/mongo.d.ts} +0 -0
- /package/{src/db/adapters/prisma.ts → dist-types/db/adapters/prisma.d.ts} +0 -0
- /package/{src/db/adapters/typeorm.ts → dist-types/db/adapters/typeorm.d.ts} +0 -0
- /package/{src/utils/index.ts → dist-types/utils/index.d.ts} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { C15TOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* c15t backend config accepted by `defineConfig`.
|
|
4
|
+
*
|
|
5
|
+
* Keep this as an intersection with `C15TOptions` (instead of `Omit`) so
|
|
6
|
+
* TypeScript preserves property-level JSDoc in editor completions.
|
|
7
|
+
*/
|
|
8
|
+
export type C15TConfig = C15TOptions & {
|
|
9
|
+
/**
|
|
10
|
+
* Logger config is managed internally and is not supported via config files.
|
|
11
|
+
*/
|
|
12
|
+
logger?: never;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Helper for typed backend configuration in `c15t-backend.config.ts`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const defineConfig: (config: C15TConfig) => C15TConfig;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { InitPayload } from './init-handler';
|
|
2
|
+
export { unstable_c15tEdgeInit } from './init-handler';
|
|
3
|
+
export type { C15TConsentResolverOptions, CategoryConsent, ResolvedConsent, } from './resolve-consent';
|
|
4
|
+
export { unstable_resolveConsent } from './resolve-consent';
|
|
5
|
+
export type { C15TEdgeOptions } from './types';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edge-compatible /init handler — runs as a pure Request → Response function
|
|
3
|
+
* without Hono or a database adapter.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import { type InitPayload } from '../handlers/init/resolve-init';
|
|
8
|
+
import type { C15TEdgeOptions } from './types';
|
|
9
|
+
export type { InitPayload };
|
|
10
|
+
/**
|
|
11
|
+
* Creates an edge-compatible /init handler.
|
|
12
|
+
*
|
|
13
|
+
* The returned function accepts a standard `Request` and returns a `Response`.
|
|
14
|
+
* It has no dependency on Hono or any database adapter, making it suitable for
|
|
15
|
+
* edge runtimes such as Vercel Middleware, Cloudflare Workers, or Deno Deploy.
|
|
16
|
+
*
|
|
17
|
+
* @experimental This API is unstable in 2.0 and may change or be removed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* // middleware.ts (Vercel Edge)
|
|
22
|
+
* import { unstable_c15tEdgeInit } from '@c15t/backend/edge';
|
|
23
|
+
*
|
|
24
|
+
* const initHandler = unstable_c15tEdgeInit({
|
|
25
|
+
* trustedOrigins: ['https://myapp.com'],
|
|
26
|
+
* policyPacks: [
|
|
27
|
+
* { id: 'eu', match: { countries: ['DE', 'FR'] }, consent: { model: 'opt-in' }, ui: { mode: 'banner' } },
|
|
28
|
+
* ],
|
|
29
|
+
* policySnapshot: { signingKey: process.env.SNAPSHOT_KEY! },
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* export async function middleware(request: Request) {
|
|
33
|
+
* const url = new URL(request.url);
|
|
34
|
+
* if (url.pathname === '/api/consent/init') {
|
|
35
|
+
* return initHandler(request);
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function unstable_c15tEdgeInit(options: C15TEdgeOptions): (request: Request) => Promise<Response>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight edge consent resolver — resolves policy + default consent
|
|
3
|
+
* categories from geo headers without the full /init payload.
|
|
4
|
+
*
|
|
5
|
+
* Designed for enterprise customers who maintain their own consent cookie
|
|
6
|
+
* and need to know which categories to load in middleware.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import type { Logger } from '@c15t/logger';
|
|
11
|
+
import type { C15TEdgeOptions } from './types';
|
|
12
|
+
/**
|
|
13
|
+
* Options for the consent resolver — a subset of C15TEdgeOptions
|
|
14
|
+
* containing only what's needed for policy resolution.
|
|
15
|
+
*/
|
|
16
|
+
export type C15TConsentResolverOptions = Pick<C15TEdgeOptions, 'policyPacks' | 'disableGeoLocation'>;
|
|
17
|
+
/**
|
|
18
|
+
* Default consent state for a single category.
|
|
19
|
+
*/
|
|
20
|
+
export interface CategoryConsent {
|
|
21
|
+
/** Whether this category is granted by default (before user interaction). */
|
|
22
|
+
granted: boolean;
|
|
23
|
+
/** Whether the user can toggle this category off. */
|
|
24
|
+
required: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Result of resolving consent defaults for a request.
|
|
28
|
+
*/
|
|
29
|
+
export interface ResolvedConsent {
|
|
30
|
+
/** The jurisdiction code for this visitor (GDPR, CCPA, etc.) */
|
|
31
|
+
jurisdiction: string;
|
|
32
|
+
/** Visitor's detected location. */
|
|
33
|
+
location: {
|
|
34
|
+
countryCode: string | null;
|
|
35
|
+
regionCode: string | null;
|
|
36
|
+
};
|
|
37
|
+
/** The resolved consent model (opt-in, opt-out, none, iab). */
|
|
38
|
+
model: string;
|
|
39
|
+
/** The matched policy ID, or null if no policy matched. */
|
|
40
|
+
policyId: string | null;
|
|
41
|
+
/** Default consent state per category. */
|
|
42
|
+
defaults: Record<string, CategoryConsent>;
|
|
43
|
+
/** Whether a consent banner/dialog should be shown. */
|
|
44
|
+
showBanner: boolean;
|
|
45
|
+
/** Whether the GPC (Global Privacy Control) signal is active. */
|
|
46
|
+
gpc: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolves consent policy and default category states from a request.
|
|
50
|
+
*
|
|
51
|
+
* Fully synchronous — no async, no fetch calls, no crypto.
|
|
52
|
+
*
|
|
53
|
+
* This is a lightweight alternative to `unstable_c15tEdgeInit` for enterprise
|
|
54
|
+
* customers who manage their own consent cookie. It returns the resolved
|
|
55
|
+
* policy and default consent state without translations, GVL, branding,
|
|
56
|
+
* or snapshot tokens.
|
|
57
|
+
*
|
|
58
|
+
* @experimental This API is unstable in 2.0 and may change or be removed.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { unstable_resolveConsent } from '@c15t/backend/edge';
|
|
63
|
+
*
|
|
64
|
+
* export function middleware(request: Request) {
|
|
65
|
+
* const consent = unstable_resolveConsent(request, {
|
|
66
|
+
* policyPacks: [
|
|
67
|
+
* { id: 'eu', match: { countries: ['DE', 'FR'] }, consent: { model: 'opt-in', categories: ['necessary', 'marketing', 'measurement'] }, ui: { mode: 'banner' } },
|
|
68
|
+
* { id: 'us', match: { isDefault: true }, consent: { model: 'opt-out', categories: ['necessary', 'marketing', 'measurement'] }, ui: { mode: 'banner' } },
|
|
69
|
+
* ],
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // consent.defaults => { necessary: { granted: true, required: true }, marketing: { granted: false, required: false }, ... }
|
|
73
|
+
* // consent.model => "opt-in"
|
|
74
|
+
* // consent.showBanner => true
|
|
75
|
+
*
|
|
76
|
+
* // Read your own cookie, merge with consent.defaults, decide what to load
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function unstable_resolveConsent(request: Request, options: C15TConsentResolverOptions, logger?: Logger): ResolvedConsent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edge handler types — the minimal subset of C15TOptions needed to run /init
|
|
3
|
+
* without a database adapter.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import type { C15TOptions } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for the edge init handler.
|
|
10
|
+
* This is a strict subset of {@link C15TOptions} containing only the fields
|
|
11
|
+
* needed for consent policy resolution — no database adapter required.
|
|
12
|
+
*/
|
|
13
|
+
export type C15TEdgeOptions = Pick<C15TOptions, 'appName' | 'tenantId' | 'trustedOrigins' | 'disableGeoLocation' | 'customTranslations' | 'i18n' | 'policyPacks' | 'branding' | 'iab' | 'cache' | 'policySnapshot' | 'legalDocumentSnapshot' | 'telemetry' | 'logger'>;
|
|
@@ -16,7 +16,7 @@ export declare function checkJurisdiction(countryCode: string | null, regionCode
|
|
|
16
16
|
* @param options - The C15T options
|
|
17
17
|
* @returns The location object with countryCode and regionCode
|
|
18
18
|
*/
|
|
19
|
-
export declare function getLocation(request: Request, options: C15TOptions): Promise<{
|
|
19
|
+
export declare function getLocation(request: Request, options: Pick<C15TOptions, 'disableGeoLocation'>): Promise<{
|
|
20
20
|
countryCode: string | null;
|
|
21
21
|
regionCode: string | null;
|
|
22
22
|
}>;
|
|
@@ -30,5 +30,4 @@ export declare function getLocation(request: Request, options: C15TOptions): Pro
|
|
|
30
30
|
export declare function getJurisdiction(location: {
|
|
31
31
|
countryCode: string | null;
|
|
32
32
|
regionCode: string | null;
|
|
33
|
-
}, options: C15TOptions): JurisdictionCode;
|
|
34
|
-
//# sourceMappingURL=geo.d.ts.map
|
|
33
|
+
}, options: Pick<C15TOptions, 'disableGeoLocation'>): JurisdictionCode;
|
|
@@ -41,7 +41,7 @@ export declare function buildResponse({ jurisdiction, location, acceptLanguage,
|
|
|
41
41
|
translations: import("@c15t/translations").CompleteTranslations;
|
|
42
42
|
language: string;
|
|
43
43
|
};
|
|
44
|
-
branding: "c15t" | "consent" | "none";
|
|
44
|
+
branding: "c15t" | "consent" | "none" | "inth";
|
|
45
45
|
gvl: {
|
|
46
46
|
gvlSpecificationVersion: number;
|
|
47
47
|
vendorListVersion: number;
|
|
@@ -153,5 +153,4 @@ export declare function buildResponse({ jurisdiction, location, acceptLanguage,
|
|
|
153
153
|
}[] | undefined;
|
|
154
154
|
};
|
|
155
155
|
export { checkJurisdiction, getJurisdiction, getLocation } from './geo';
|
|
156
|
-
export { getTranslations, getTranslationsData } from './translations';
|
|
157
|
-
//# sourceMappingURL=index.d.ts.map
|
|
156
|
+
export { getTranslations, getTranslationsData, listProfiles, validateMessages, } from './translations';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PolicyMatchedBy, PolicyValidationResult, ResolvedPolicyDecision as SharedResolvedPolicyDecision, ResolvedPolicyMatch as SharedResolvedPolicyMatch, ResolvedPolicy as SharedResolvedRuntimePolicy } from '@c15t/schema/types';
|
|
2
|
+
import type { JurisdictionCode as BackendJurisdictionCode } from '../../types';
|
|
3
|
+
export type { PolicyMatchedBy, PolicyValidationResult };
|
|
4
|
+
export type ResolvedRuntimePolicy = SharedResolvedRuntimePolicy;
|
|
5
|
+
export type ResolvedPolicyDecision = SharedResolvedPolicyDecision;
|
|
6
|
+
export type ResolvedPolicyMatch = SharedResolvedPolicyMatch;
|
|
7
|
+
export declare function inspectPolicies(policies: unknown, options?: {
|
|
8
|
+
iabEnabled?: boolean;
|
|
9
|
+
}): PolicyValidationResult;
|
|
10
|
+
export declare function validatePolicies(policies: unknown, options?: {
|
|
11
|
+
iabEnabled?: boolean;
|
|
12
|
+
}): void;
|
|
13
|
+
export declare function resolvePolicyDecision(params: {
|
|
14
|
+
policies?: unknown;
|
|
15
|
+
countryCode: string | null;
|
|
16
|
+
regionCode: string | null;
|
|
17
|
+
jurisdiction?: BackendJurisdictionCode;
|
|
18
|
+
iabEnabled?: boolean;
|
|
19
|
+
}): Promise<ResolvedPolicyDecision | undefined>;
|
|
20
|
+
export declare function resolvePolicySync(params: {
|
|
21
|
+
policies?: unknown;
|
|
22
|
+
countryCode: string | null;
|
|
23
|
+
regionCode: string | null;
|
|
24
|
+
jurisdiction?: BackendJurisdictionCode;
|
|
25
|
+
iabEnabled?: boolean;
|
|
26
|
+
}): ResolvedPolicyMatch | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared init payload resolution — used by both the Hono route and the edge handler.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import type { Logger } from '@c15t/logger';
|
|
7
|
+
import type { ResolvedPolicy } from '@c15t/schema/types';
|
|
8
|
+
import type { C15TEdgeOptions } from '../../edge/types';
|
|
9
|
+
/**
|
|
10
|
+
* Subset of C15TOptions needed by the init resolver.
|
|
11
|
+
* Derived from {@link C15TEdgeOptions} minus `logger` (passed separately).
|
|
12
|
+
*/
|
|
13
|
+
export type InitResolverOptions = Omit<C15TEdgeOptions, 'logger'>;
|
|
14
|
+
/** The JSON-serializable payload returned by /init. */
|
|
15
|
+
export interface InitPayload {
|
|
16
|
+
jurisdiction: string;
|
|
17
|
+
location: {
|
|
18
|
+
countryCode: string | null;
|
|
19
|
+
regionCode: string | null;
|
|
20
|
+
};
|
|
21
|
+
translations: {
|
|
22
|
+
translations: unknown;
|
|
23
|
+
language: string;
|
|
24
|
+
};
|
|
25
|
+
branding: string;
|
|
26
|
+
gvl?: unknown;
|
|
27
|
+
customVendors?: unknown[];
|
|
28
|
+
policy?: ResolvedPolicy;
|
|
29
|
+
policyDecision?: {
|
|
30
|
+
policyId: string;
|
|
31
|
+
fingerprint: string;
|
|
32
|
+
matchedBy: string;
|
|
33
|
+
country: string | null;
|
|
34
|
+
region: string | null;
|
|
35
|
+
jurisdiction: string;
|
|
36
|
+
};
|
|
37
|
+
policySnapshotToken?: string;
|
|
38
|
+
cmpId?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the full /init payload from a request and options.
|
|
42
|
+
* Pure function — no Hono, no database dependency.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveInitPayload(request: Request, options: InitResolverOptions, logger?: Logger): Promise<InitPayload>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type CompleteTranslations, type Translations } from '@c15t/translations';
|
|
2
|
+
import type { C15TOptions, PolicyConfig } from '../../types';
|
|
3
|
+
interface LoggerLike {
|
|
4
|
+
warn: (message: string, metadata?: Record<string, unknown>) => void;
|
|
5
|
+
}
|
|
6
|
+
interface TranslationResolutionOptions {
|
|
7
|
+
i18n?: C15TOptions['i18n'];
|
|
8
|
+
policyI18n?: PolicyConfig['i18n'];
|
|
9
|
+
logger?: LoggerLike;
|
|
10
|
+
}
|
|
11
|
+
export declare function listProfiles(options: {
|
|
12
|
+
customTranslations?: Record<string, Partial<Translations>>;
|
|
13
|
+
i18n?: C15TOptions['i18n'];
|
|
14
|
+
}): string[];
|
|
15
|
+
export declare function validateMessages(options: {
|
|
16
|
+
customTranslations?: Record<string, Partial<Translations>>;
|
|
17
|
+
i18n?: C15TOptions['i18n'];
|
|
18
|
+
policies?: PolicyConfig[];
|
|
19
|
+
}): {
|
|
20
|
+
profiles: string[];
|
|
21
|
+
errors: string[];
|
|
22
|
+
warnings: string[];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Gets the translations data for a given language, resolving optional policy
|
|
26
|
+
* profile/language hints and compatibility aliases.
|
|
27
|
+
*
|
|
28
|
+
* Fallback order:
|
|
29
|
+
* 1) profile + language
|
|
30
|
+
* 2) profile + fallback language
|
|
31
|
+
*/
|
|
32
|
+
export declare function getTranslationsData(acceptLanguage: string | null, customTranslations?: Record<string, Partial<Translations>>, options?: TranslationResolutionOptions): {
|
|
33
|
+
translations: CompleteTranslations;
|
|
34
|
+
language: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Gets the translations for a given language from options.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getTranslations(acceptLanguage: string, options: {
|
|
40
|
+
customTranslations?: Record<string, Partial<Translations>>;
|
|
41
|
+
i18n?: C15TOptions['i18n'];
|
|
42
|
+
policyI18n?: PolicyConfig['i18n'];
|
|
43
|
+
logger?: LoggerLike;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
translations: CompleteTranslations;
|
|
46
|
+
language: string;
|
|
47
|
+
}>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
export declare const syncCurrentLegalDocumentHandler: (c: Context) => Promise<Response & import("hono").TypedResponse<{
|
|
3
|
+
policy: {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
version: string;
|
|
7
|
+
hash: string;
|
|
8
|
+
effectiveDate: string;
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
};
|
|
11
|
+
}, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type JWTPayload } from 'jose';
|
|
2
|
+
import type { LegalDocumentPolicyType, LegalDocumentSnapshotOptions } from '../../types';
|
|
3
|
+
export type LegalDocumentSnapshotVerificationFailureReason = 'missing' | 'malformed' | 'expired' | 'invalid';
|
|
4
|
+
export type LegalDocumentSnapshotVerificationResult = {
|
|
5
|
+
valid: true;
|
|
6
|
+
payload: LegalDocumentSnapshotPayload;
|
|
7
|
+
} | {
|
|
8
|
+
valid: false;
|
|
9
|
+
reason: LegalDocumentSnapshotVerificationFailureReason;
|
|
10
|
+
};
|
|
11
|
+
export interface LegalDocumentSnapshotPayload extends JWTPayload {
|
|
12
|
+
iss: string;
|
|
13
|
+
aud: string;
|
|
14
|
+
sub: string;
|
|
15
|
+
tenantId?: string;
|
|
16
|
+
type: LegalDocumentPolicyType;
|
|
17
|
+
version: string;
|
|
18
|
+
hash: string;
|
|
19
|
+
effectiveDate: string;
|
|
20
|
+
iat: number;
|
|
21
|
+
exp: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function createLegalDocumentSnapshotToken(params: {
|
|
24
|
+
options?: LegalDocumentSnapshotOptions;
|
|
25
|
+
tenantId?: string;
|
|
26
|
+
type: LegalDocumentPolicyType;
|
|
27
|
+
version: string;
|
|
28
|
+
hash: string;
|
|
29
|
+
effectiveDate: string;
|
|
30
|
+
ttlSeconds?: number;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
token: string;
|
|
33
|
+
payload: LegalDocumentSnapshotPayload;
|
|
34
|
+
} | undefined>;
|
|
35
|
+
export declare function verifyLegalDocumentSnapshotToken(params: {
|
|
36
|
+
token?: string;
|
|
37
|
+
options?: LegalDocumentSnapshotOptions;
|
|
38
|
+
tenantId?: string;
|
|
39
|
+
}): Promise<LegalDocumentSnapshotVerificationResult>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type JWTPayload } from 'jose';
|
|
2
|
+
import type { JurisdictionCode, PolicyModel, PolicyScopeMode, PolicySnapshotOptions, PolicyUiMode, PolicyUiSurfaceConfig } from '../../types';
|
|
3
|
+
import type { PolicyMatchedBy } from '../init/policy';
|
|
4
|
+
export type PolicySnapshotVerificationFailureReason = 'missing' | 'malformed' | 'expired' | 'invalid';
|
|
5
|
+
export type PolicySnapshotVerificationResult = {
|
|
6
|
+
valid: true;
|
|
7
|
+
payload: PolicySnapshotPayload;
|
|
8
|
+
} | {
|
|
9
|
+
valid: false;
|
|
10
|
+
reason: PolicySnapshotVerificationFailureReason;
|
|
11
|
+
};
|
|
12
|
+
export interface PolicySnapshotUiSurface {
|
|
13
|
+
allowedActions?: PolicyUiSurfaceConfig['allowedActions'];
|
|
14
|
+
primaryActions?: PolicyUiSurfaceConfig['primaryActions'];
|
|
15
|
+
layout?: PolicyUiSurfaceConfig['layout'];
|
|
16
|
+
direction?: PolicyUiSurfaceConfig['direction'];
|
|
17
|
+
uiProfile?: PolicyUiSurfaceConfig['uiProfile'];
|
|
18
|
+
scrollLock?: PolicyUiSurfaceConfig['scrollLock'];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* JWT payload for a policy snapshot token.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Fields are intentionally flattened from the nested `ResolvedPolicy` structure
|
|
25
|
+
* to keep the JWT compact. For example, `scopeMode` maps to
|
|
26
|
+
* `ResolvedPolicy.consent.scopeMode` and `uiMode` maps to
|
|
27
|
+
* `ResolvedPolicy.ui.mode`. The post handler reconstructs the nested shape
|
|
28
|
+
* when verifying the token.
|
|
29
|
+
*/
|
|
30
|
+
export interface PolicySnapshotPayload extends JWTPayload {
|
|
31
|
+
iss: string;
|
|
32
|
+
aud: string;
|
|
33
|
+
sub: string;
|
|
34
|
+
tenantId?: string;
|
|
35
|
+
policyId: string;
|
|
36
|
+
fingerprint: string;
|
|
37
|
+
matchedBy: PolicyMatchedBy;
|
|
38
|
+
country: string | null;
|
|
39
|
+
region: string | null;
|
|
40
|
+
jurisdiction: JurisdictionCode;
|
|
41
|
+
language?: string;
|
|
42
|
+
model: PolicyModel;
|
|
43
|
+
policyI18n?: {
|
|
44
|
+
language?: string;
|
|
45
|
+
messageProfile?: string;
|
|
46
|
+
};
|
|
47
|
+
expiryDays?: number;
|
|
48
|
+
scopeMode?: PolicyScopeMode;
|
|
49
|
+
uiMode?: PolicyUiMode;
|
|
50
|
+
bannerUi?: PolicySnapshotUiSurface;
|
|
51
|
+
dialogUi?: PolicySnapshotUiSurface;
|
|
52
|
+
categories?: string[];
|
|
53
|
+
preselectedCategories?: string[];
|
|
54
|
+
gpc?: boolean;
|
|
55
|
+
proofConfig?: {
|
|
56
|
+
storeIp?: boolean;
|
|
57
|
+
storeUserAgent?: boolean;
|
|
58
|
+
storeLanguage?: boolean;
|
|
59
|
+
};
|
|
60
|
+
iat: number;
|
|
61
|
+
exp: number;
|
|
62
|
+
}
|
|
63
|
+
export declare function createPolicySnapshotToken(params: {
|
|
64
|
+
options?: PolicySnapshotOptions;
|
|
65
|
+
tenantId?: string;
|
|
66
|
+
policyId: string;
|
|
67
|
+
fingerprint: string;
|
|
68
|
+
matchedBy: PolicyMatchedBy;
|
|
69
|
+
country: string | null;
|
|
70
|
+
region: string | null;
|
|
71
|
+
jurisdiction: JurisdictionCode;
|
|
72
|
+
language?: string;
|
|
73
|
+
model: PolicyModel;
|
|
74
|
+
policyI18n?: {
|
|
75
|
+
language?: string;
|
|
76
|
+
messageProfile?: string;
|
|
77
|
+
};
|
|
78
|
+
expiryDays?: number;
|
|
79
|
+
scopeMode?: PolicyScopeMode;
|
|
80
|
+
uiMode?: PolicyUiMode;
|
|
81
|
+
bannerUi?: PolicySnapshotUiSurface;
|
|
82
|
+
dialogUi?: PolicySnapshotUiSurface;
|
|
83
|
+
categories?: string[];
|
|
84
|
+
preselectedCategories?: string[];
|
|
85
|
+
gpc?: boolean;
|
|
86
|
+
proofConfig?: {
|
|
87
|
+
storeIp?: boolean;
|
|
88
|
+
storeUserAgent?: boolean;
|
|
89
|
+
storeLanguage?: boolean;
|
|
90
|
+
};
|
|
91
|
+
}): Promise<{
|
|
92
|
+
token: string;
|
|
93
|
+
payload: PolicySnapshotPayload;
|
|
94
|
+
} | undefined>;
|
|
95
|
+
export declare function verifyPolicySnapshotToken(params: {
|
|
96
|
+
token?: string;
|
|
97
|
+
options?: PolicySnapshotOptions;
|
|
98
|
+
tenantId?: string;
|
|
99
|
+
}): Promise<PolicySnapshotVerificationResult>;
|
|
@@ -14,13 +14,15 @@ export declare const getSubjectHandler: (c: Context) => Promise<Response & impor
|
|
|
14
14
|
subject: {
|
|
15
15
|
id: string;
|
|
16
16
|
externalId: string | undefined;
|
|
17
|
-
isIdentified: boolean;
|
|
18
17
|
createdAt: string;
|
|
19
18
|
};
|
|
20
19
|
consents: {
|
|
21
20
|
id: string;
|
|
22
21
|
type: string;
|
|
23
22
|
policyId: string | undefined;
|
|
23
|
+
policyVersion: string | undefined;
|
|
24
|
+
policyHash: string | undefined;
|
|
25
|
+
policyEffectiveDate: string | undefined;
|
|
24
26
|
isLatestPolicy: boolean;
|
|
25
27
|
preferences: {
|
|
26
28
|
[x: string]: boolean;
|
|
@@ -29,4 +31,3 @@ export declare const getSubjectHandler: (c: Context) => Promise<Response & impor
|
|
|
29
31
|
}[];
|
|
30
32
|
isValid: boolean;
|
|
31
33
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
|
|
32
|
-
//# sourceMappingURL=get.handler.d.ts.map
|
|
@@ -14,12 +14,14 @@ export declare const listSubjectsHandler: (c: Context) => Promise<Response & imp
|
|
|
14
14
|
subjects: {
|
|
15
15
|
id: string;
|
|
16
16
|
externalId: string;
|
|
17
|
-
isIdentified: boolean;
|
|
18
17
|
createdAt: string;
|
|
19
18
|
consents: {
|
|
20
19
|
id: string;
|
|
21
20
|
type: string;
|
|
22
21
|
policyId: string | undefined;
|
|
22
|
+
policyVersion: string | undefined;
|
|
23
|
+
policyHash: string | undefined;
|
|
24
|
+
policyEffectiveDate: string | undefined;
|
|
23
25
|
isLatestPolicy: boolean;
|
|
24
26
|
preferences: {
|
|
25
27
|
[x: string]: boolean;
|
|
@@ -28,4 +30,3 @@ export declare const listSubjectsHandler: (c: Context) => Promise<Response & imp
|
|
|
28
30
|
}[];
|
|
29
31
|
}[];
|
|
30
32
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
|
|
31
|
-
//# sourceMappingURL=list.handler.d.ts.map
|
|
@@ -16,7 +16,5 @@ export declare const patchSubjectHandler: (c: Context) => Promise<Response & imp
|
|
|
16
16
|
subject: {
|
|
17
17
|
id: string;
|
|
18
18
|
externalId: string;
|
|
19
|
-
isIdentified: true;
|
|
20
19
|
};
|
|
21
20
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
|
|
22
|
-
//# sourceMappingURL=patch.handler.d.ts.map
|
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
import type { Context } from 'hono';
|
|
7
|
+
export declare function buildRuntimeDecisionDedupeKey(input: {
|
|
8
|
+
tenantId?: string;
|
|
9
|
+
fingerprint: string;
|
|
10
|
+
matchedBy: string;
|
|
11
|
+
countryCode: string | null;
|
|
12
|
+
regionCode: string | null;
|
|
13
|
+
jurisdiction: string;
|
|
14
|
+
language?: string;
|
|
15
|
+
}): string;
|
|
7
16
|
/**
|
|
8
17
|
* Handles the creation of a new consent record for a subject.
|
|
9
18
|
*
|
|
@@ -19,7 +28,9 @@ export declare const postSubjectHandler: (c: Context) => Promise<Response & impo
|
|
|
19
28
|
metadata: {
|
|
20
29
|
[x: string]: import("hono/utils/types").JSONValue;
|
|
21
30
|
} | undefined;
|
|
31
|
+
appliedPreferences: {
|
|
32
|
+
[x: string]: boolean;
|
|
33
|
+
} | undefined;
|
|
22
34
|
uiSource: string | undefined;
|
|
23
35
|
givenAt: string;
|
|
24
36
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">>;
|
|
25
|
-
//# sourceMappingURL=post.handler.d.ts.map
|
|
@@ -12,6 +12,9 @@ export interface EnrichedConsentItem {
|
|
|
12
12
|
id: string;
|
|
13
13
|
type: string;
|
|
14
14
|
policyId: string | undefined;
|
|
15
|
+
policyVersion: string | undefined;
|
|
16
|
+
policyHash: string | undefined;
|
|
17
|
+
policyEffectiveDate: Date | undefined;
|
|
15
18
|
isLatestPolicy: boolean;
|
|
16
19
|
preferences: Record<string, boolean> | undefined;
|
|
17
20
|
givenAt: Date;
|
|
@@ -49,4 +52,3 @@ export declare function resolveConsentPolicies(consents: Array<{
|
|
|
49
52
|
policyId: string | null;
|
|
50
53
|
}>, ctx: EnrichmentContext): Promise<ConsentPolicyInfo[]>;
|
|
51
54
|
export {};
|
|
52
|
-
//# sourceMappingURL=consent-enrichment.d.ts.map
|
|
@@ -16,15 +16,12 @@ import type { C15TContext, C15TOptions } from './types';
|
|
|
16
16
|
*
|
|
17
17
|
* // Then pass telemetry config
|
|
18
18
|
* const instance = c15tInstance({
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* meter: metrics.getMeter('my-app'),
|
|
24
|
-
* },
|
|
19
|
+
* telemetry: {
|
|
20
|
+
* enabled: true,
|
|
21
|
+
* tracer: trace.getTracer('my-app'),
|
|
22
|
+
* meter: metrics.getMeter('my-app'),
|
|
25
23
|
* },
|
|
26
24
|
* });
|
|
27
25
|
* ```
|
|
28
26
|
*/
|
|
29
27
|
export declare const init: (options: C15TOptions) => C15TContext;
|
|
30
|
-
//# sourceMappingURL=init.d.ts.map
|