import type { EntityActionResult, EntityActionVoidResult, CreateEntityInput, UpdateEntityInput, ListEntityOptions, ListEntityResult, ActionConfig, BatchDeleteResult } from './types'; /** * Create a new entity record * * Auth is automatically obtained from session/cookies - no need to pass userId/teamId. * Permissions are checked against the permissions registry before executing. * * @param entitySlug - The entity type slug (e.g., 'campaigns', 'schools') * @param data - The entity data to create * @param config - Optional configuration for revalidation/redirect * @returns The created entity wrapped in EntityActionResult * * @example * ```typescript * const result = await createEntity('schools', { * name: 'MIT', * status: 'active' * }) * * if (result.success) { * console.log('Created:', result.data) * } else { * console.error('Error:', result.error) * } * ``` * * @example * ```typescript * // With custom revalidation * const result = await createEntity('campaigns', data, { * revalidatePaths: ['/dashboard/overview'], * revalidateTags: ['campaign-stats'], * }) * ``` */ export declare function createEntity(entitySlug: string, data: CreateEntityInput, config?: ActionConfig): Promise>; /** * Update an existing entity record * * Auth is automatically obtained from session/cookies. * Permissions are checked against the permissions registry before executing. * * @param entitySlug - The entity type slug * @param id - The entity ID to update * @param data - The fields to update * @param config - Optional configuration for revalidation/redirect * @returns The updated entity wrapped in EntityActionResult * * @example * ```typescript * const result = await updateEntity('campaigns', 'abc123', { * status: 'paused' * }) * ``` */ export declare function updateEntity(entitySlug: string, id: string, data: UpdateEntityInput, config?: ActionConfig): Promise>; /** * Delete an entity record * * Auth is automatically obtained from session/cookies. * Permissions are checked against the permissions registry before executing. * * @param entitySlug - The entity type slug * @param id - The entity ID to delete * @param config - Optional configuration for revalidation/redirect * @returns Success status * * @example * ```typescript * await deleteEntity('leads', 'xyz789', { * redirectTo: '/dashboard/leads' * }) * ``` */ export declare function deleteEntity(entitySlug: string, id: string, config?: ActionConfig): Promise; /** * Get a single entity by ID * * Auth is automatically obtained from session/cookies. * Permissions are checked against the permissions registry before executing. * * Note: Prefer using Server Components for reads when possible. * Use this action only when you need to fetch data from a Client Component. * * @param entitySlug - The entity type slug * @param id - The entity ID * @returns The entity or null * * @example * ```typescript * const result = await getEntity('campaigns', 'abc123') * if (result.success && result.data) { * console.log('Found:', result.data) * } * ``` */ export declare function getEntity(entitySlug: string, id: string): Promise>; /** * List entities with filtering and pagination * * Auth is automatically obtained from session/cookies. * Permissions are checked against the permissions registry before executing. * * Note: Prefer using Server Components for reads when possible. * Use this action only when you need to fetch data from a Client Component. * * @param entitySlug - The entity type slug * @param options - Filtering, sorting, pagination options * @returns Paginated list of entities * * @example * ```typescript * const result = await listEntities('schools', { * where: { status: 'active' }, * orderBy: 'name', * limit: 20 * }) * * if (result.success) { * console.log(`Found ${result.data.total} schools`) * } * ``` */ export declare function listEntities(entitySlug: string, options?: ListEntityOptions): Promise>>; /** * Delete multiple entities at once * * Auth is automatically obtained from session/cookies. * Permissions are checked against the permissions registry before executing. * Uses efficient batch delete (single query) by default. * * @param entitySlug - The entity type slug * @param ids - Array of entity IDs to delete * @param config - Optional configuration for revalidation/redirect * @returns Count of deleted entities * * @example * ```typescript * const result = await deleteEntities('leads', ['id1', 'id2', 'id3']) * if (result.success) { * console.log(`Deleted ${result.data.deletedCount} leads`) * } * ``` */ export declare function deleteEntities(entitySlug: string, ids: string[], config?: ActionConfig): Promise>; /** * Check if an entity exists * * Auth is automatically obtained from session/cookies. * Permissions are checked against the permissions registry before executing. * * @param entitySlug - The entity type slug * @param id - The entity ID * @returns Whether the entity exists and is accessible * * @example * ```typescript * const result = await entityExists('campaigns', 'abc123') * if (result.success && result.data) { * console.log('Entity exists') * } * ``` */ export declare function entityExists(entitySlug: string, id: string): Promise>; /** * Count entities with optional filtering * * Auth is automatically obtained from session/cookies. * Permissions are checked against the permissions registry before executing. * * @param entitySlug - The entity type slug * @param where - Filter conditions * @returns Count of matching entities * * @example * ```typescript * const result = await countEntities('campaigns', { status: 'active' }) * if (result.success) { * console.log(`Found ${result.data} active campaigns`) * } * ``` */ export declare function countEntities(entitySlug: string, where?: Record): Promise>; //# sourceMappingURL=entity.actions.d.ts.map