workspace-directory/posthog-managed-grant
@sarj-ai/workspace-sync/workspace-directory/posthog-managed-grant ยท Source
import { z } from "zod";export declare const PosthogInvitationIdSchema: z.core.$ZodBranded<z.ZodString, "PosthogInvitationId", "out">;export declare const PosthogUserUuidSchema: z.core.$ZodBranded<z.ZodString, "PosthogUserUuid", "out">;export declare const PosthogGrantEvidenceSchema: 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">;/** Current ownership and retained provider evidence; retired evidence never grants removal authority. */export declare const PosthogManagedGrantSchema: 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">;export type PosthogManagedGrant = z.output<typeof PosthogManagedGrantSchema>;export type PosthogGrantEvidence = z.output<typeof PosthogGrantEvidenceSchema>;export type PosthogGrantEventFor<G extends PosthogManagedGrant> = G extends { state: "managed";} ? { kind: "retire";} | (G["evidence"] extends { kind: "membership" | "accepted-invitation";} ? never : { kind: "bind-member"; userUuid: z.output<typeof PosthogUserUuidSchema>;}) : never;export declare function posthogGrantTransition<G extends PosthogManagedGrant>(grant: G, event: PosthogGrantEventFor<G>): PosthogManagedGrant;export declare function posthogInvitationId(evidence: PosthogGrantEvidence): z.output<typeof PosthogInvitationIdSchema> | null;export declare function posthogUserUuid(evidence: PosthogGrantEvidence): z.output<typeof PosthogUserUuidSchema> | null;