Files
agentic-dev/packages/core-consent/src/handlers/grant.handler.ts
2026-07-12 08:15:46 +00:00

27 lines
660 B
TypeScript

import { z } from "zod";
import type { IConsent } from "../consent.interface";
export const grantHandlerInputSchema = z
.object({
category: z.string().min(1),
meta: z
.object({
bannerVersion: z.string().optional(),
policyVersion: z.string().optional(),
method: z.string().optional(),
})
.strict()
.optional(),
})
.strict();
export type GrantHandlerInput = z.infer<typeof grantHandlerInputSchema>;
export async function grantHandler(
consent: IConsent,
input: GrantHandlerInput,
): Promise<{ success: true }> {
await consent.grant(input.category, input.meta);
return { success: true };
}