import type { NetworkMembershipGraphDatabase } from "../ports/index.js"; /** * Factory class to build and compile the Network Membership Graph. * * Handles CRUD operations for the index_members table: * - create: Add a member to a network (validates join policy and ownership) * - read: List members of a network (validates caller is member) * - delete: Remove a member from a network (owner-only) * * ## Membership authority policy * * Self-join (`targetUserId === userId`): * - Allowed only when `joinPolicy: 'anyone'`. * - Idempotent: already-a-member returns success. * * Invite others (`targetUserId !== userId`): * - Caller must be a member of the network. * - For `invite_only` networks, caller must also be the owner. * - Idempotent: already-a-member returns success. * * Remove member: * - Caller must be the network owner. * - Cannot remove the owner (delete the network instead). * - Cannot remove yourself via this path (use leave-network flow). * * Flow: * START → routerNode → {addMemberNode | listMembersNode | removeMemberNode} → END * * IND-546: canonical home — previously network/membership/membership.graph.ts. */ export declare class NetworkMembershipGraphFactory { private database; constructor(database: NetworkMembershipGraphDatabase); createGraph(): import("@langchain/langgraph").CompiledStateGraph<{ userId: string; networkId: string; operationMode: "delete" | "create" | "read"; targetUserId: string | undefined; readResult: { networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | undefined; mutationResult: { success: boolean; message?: string; error?: string; } | undefined; error: string | null; }, { userId?: string | undefined; networkId?: string | undefined; operationMode?: "delete" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "create" | "read"> | undefined; targetUserId?: string | import("@langchain/langgraph").OverwriteValue | undefined; readResult?: { networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | import("@langchain/langgraph").OverwriteValue<{ networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | undefined> | undefined; mutationResult?: { success: boolean; message?: string; error?: string; } | import("@langchain/langgraph").OverwriteValue<{ success: boolean; message?: string; error?: string; } | undefined> | undefined; error?: string | import("@langchain/langgraph").OverwriteValue | null | undefined; }, "__start__" | "add_member" | "list_members" | "remove_member", { userId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; networkId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "create" | "read", "delete" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "create" | "read">, unknown>; targetUserId: import("@langchain/langgraph").BaseChannel | undefined, unknown>; readResult: import("@langchain/langgraph").BaseChannel<{ networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | undefined, { networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | import("@langchain/langgraph").OverwriteValue<{ networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | undefined> | undefined, unknown>; mutationResult: import("@langchain/langgraph").BaseChannel<{ success: boolean; message?: string; error?: string; } | undefined, { success: boolean; message?: string; error?: string; } | import("@langchain/langgraph").OverwriteValue<{ success: boolean; message?: string; error?: string; } | undefined> | undefined, unknown>; error: import("@langchain/langgraph").BaseChannel | null, unknown>; }, { userId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; networkId: { (annotation: import("@langchain/langgraph").SingleReducer): import("@langchain/langgraph").BaseChannel, unknown>; (): import("@langchain/langgraph").LastValue; Root: (sd: S) => import("@langchain/langgraph").AnnotationRoot; }; operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "create" | "read", "delete" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "create" | "read">, unknown>; targetUserId: import("@langchain/langgraph").BaseChannel | undefined, unknown>; readResult: import("@langchain/langgraph").BaseChannel<{ networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | undefined, { networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | import("@langchain/langgraph").OverwriteValue<{ networkId: string; count: number; members: Array<{ userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }>; } | undefined> | undefined, unknown>; mutationResult: import("@langchain/langgraph").BaseChannel<{ success: boolean; message?: string; error?: string; } | undefined, { success: boolean; message?: string; error?: string; } | import("@langchain/langgraph").OverwriteValue<{ success: boolean; message?: string; error?: string; } | undefined> | undefined, unknown>; error: import("@langchain/langgraph").BaseChannel | null, unknown>; }, import("@langchain/langgraph").StateDefinition, { add_member: { mutationResult: { success: boolean; error: string; message?: undefined; }; } | { mutationResult: { success: boolean; message: string; error?: undefined; }; }; list_members: { readResult: { networkId: string; count: number; members: never[]; }; error: string; } | { readResult: { networkId: string; count: number; members: { userId: string; name: string; avatar: string | null; permissions: string[]; intentCount: number; joinedAt: Date; }[]; }; error?: undefined; } | { error: string; readResult?: undefined; }; remove_member: { mutationResult: { success: boolean; error: string; message?: undefined; }; } | { mutationResult: { success: boolean; message: string; error?: undefined; }; }; }, unknown, unknown, []>; }