Protocol-agnostic handlers (grant, withdraw, isGranted, getCategories) in core-consent/handlers/ call IConsent methods and return typed results. consentRouter uses a consent-specific tRPC context (userId + consentFactory) so each procedure can resolve the per-user IConsent instance at call time. Auth middleware guards all four procedures and maps UnauthenticatedError → UNAUTHORIZED via defineErrorMiddleware from core-shared (no local duplicate). 76 tests passing; new handler and router code at 100% branch coverage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
export type {
|
|
ConsentCategory,
|
|
ConsentState,
|
|
UserConsentState,
|
|
ConsentGrantMeta,
|
|
} from "./consent-types";
|
|
export type { IConsent } from "./consent.interface";
|
|
export type { ConsentChecked } from "./with-consent";
|
|
export { withConsent } from "./with-consent";
|
|
export { InMemoryConsent } from "./in-memory-consent";
|
|
export { PayloadConsent } from "./payload-consent";
|
|
export { CONSENT_SYMBOLS } from "./di/symbols";
|
|
export {
|
|
bindProductionConsent,
|
|
type BindProductionConsentOpts,
|
|
type ConsentFactory,
|
|
} from "./di/bind-production";
|
|
export { bindDevSeedConsent } from "./di/bind-dev-seed";
|
|
export {
|
|
CONSENT_COOKIE_NAME,
|
|
extractAnonymousConsent,
|
|
migrateAnonymousConsent,
|
|
} from "./migration";
|
|
export { UnauthenticatedError } from "./entities/errors/consent";
|
|
export {
|
|
grantHandler,
|
|
grantHandlerInputSchema,
|
|
} from "./handlers/grant.handler";
|
|
export type { GrantHandlerInput } from "./handlers/grant.handler";
|
|
export {
|
|
withdrawHandler,
|
|
withdrawHandlerInputSchema,
|
|
} from "./handlers/withdraw.handler";
|
|
export type { WithdrawHandlerInput } from "./handlers/withdraw.handler";
|
|
export {
|
|
isGrantedHandler,
|
|
isGrantedHandlerInputSchema,
|
|
} from "./handlers/is-granted.handler";
|
|
export type { IsGrantedHandlerInput } from "./handlers/is-granted.handler";
|
|
export { getCategoriesHandler } from "./handlers/get-categories.handler";
|
|
export { consentRouter } from "./consent.router";
|
|
export type { ConsentRouter, ConsentRouterContext } from "./consent.router";
|