Skip to content
Sarj Workspace Sync

workspace-directory/d1-posthog-managed-grant-repository

@sarj-ai/workspace-sync/workspace-directory/d1-posthog-managed-grant-repository ยท Source

import type { D1Database } from "@cloudflare/workers-types";
import { z } from "zod";
import { type ActiveResourceLease } from "../identity-sync/resource-lease.ts";
import type { IPosthogManagedGrantRepository, PosthogManagedGrant } from "./posthog-membership-plan.ts";
export declare const PosthogGrantRowCodecSchema: z.ZodCodec<z.ZodObject<{
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
email: z.ZodEmail;
inviteId: z.ZodNullable<z.ZodString>;
userUuid: z.ZodNullable<z.ZodString>;
state: z.ZodEnum<{
managed: "managed";
retired: "retired";
}>;
}, z.core.$strict>, z.ZodDiscriminatedUnion<[z.ZodObject<{
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
email: z.ZodEmail;
evidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"invitation">;
inviteId: z.core.$ZodBranded<z.ZodString, "PosthogInvitationId", "out">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"membership">;
userUuid: z.core.$ZodBranded<z.ZodString, "PosthogUserUuid", "out">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"accepted-invitation">;
inviteId: z.core.$ZodBranded<z.ZodString, "PosthogInvitationId", "out">;
userUuid: z.core.$ZodBranded<z.ZodString, "PosthogUserUuid", "out">;
}, z.core.$strict>], "kind">;
state: z.ZodLiteral<"managed">;
}, z.core.$strict>, z.ZodObject<{
googleUserId: z.core.$ZodBranded<z.ZodString, "GoogleUserId", "out">;
email: z.ZodEmail;
evidence: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"invitation">;
inviteId: z.core.$ZodBranded<z.ZodString, "PosthogInvitationId", "out">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"membership">;
userUuid: z.core.$ZodBranded<z.ZodString, "PosthogUserUuid", "out">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"accepted-invitation">;
inviteId: z.core.$ZodBranded<z.ZodString, "PosthogInvitationId", "out">;
userUuid: z.core.$ZodBranded<z.ZodString, "PosthogUserUuid", "out">;
}, z.core.$strict>], "kind">;
state: z.ZodLiteral<"retired">;
}, z.core.$strict>], "state">>;
/** The host owns the migration; retired rows prevent re-adopting later manual grants. */
export declare class D1PosthogManagedGrantRepository implements IPosthogManagedGrantRepository {
#private;
constructor(database: D1Database);
list(organizationId: string): Promise<PosthogManagedGrant[]>;
record(organizationId: string, raw: PosthogManagedGrant, lease: ActiveResourceLease): Promise<void>;
}