import { KyselyDB, KyselyTransaction } from '../../types/kysely.types';
import { InsertablePage, Page, UpdatablePage } from "../../types/entity.types";
import { PaginationOptions } from "../../pagination/pagination-options";
import { ExpressionBuilder } from 'kysely';
import { DB } from '@docmost/db/types/db';
import { SpaceMemberRepo } from "../space/space-member.repo";
import { EventEmitter2 } from '@nestjs/event-emitter';
import type { RecentlyUpdatedDto } from '../../../core/page/dto/recently-updated.dto';
import { PagePermissionRepo } from './page-permission.repo';
import { UserRecentPageActivity } from '../../../core/user/user.types';
export declare class PageRepo {
    private readonly db;
    private spaceMemberRepo;
    private eventEmitter;
    private readonly pagePermissionRepo;
    constructor(db: KyselyDB, spaceMemberRepo: SpaceMemberRepo, eventEmitter: EventEmitter2, pagePermissionRepo: PagePermissionRepo);
    private baseFields;
    findById(pageId: string, opts?: {
        includeContent?: boolean;
        includeTextContent?: boolean;
        includeYdoc?: boolean;
        includeSpace?: boolean;
        includeCreator?: boolean;
        includeLastUpdatedBy?: boolean;
        includeContributors?: boolean;
        includeDeletedBy?: boolean;
        includeHasChildren?: boolean;
        withLock?: boolean;
        trx?: KyselyTransaction;
    }): Promise<Page>;
    findManyByIds(pageIds: string[], opts?: {
        trx?: KyselyTransaction;
        workspaceId?: string;
    }): Promise<Page[]>;
    updatePage(updatablePage: UpdatablePage, pageId: string, trx?: KyselyTransaction): Promise<import("kysely").UpdateResult>;
    saveYdocState(pageId: string, ydoc: Buffer, trx?: KyselyTransaction): Promise<void>;
    updatePages(updatePageData: UpdatablePage, pageIds: string[], trx?: KyselyTransaction): Promise<import("kysely").UpdateResult>;
    lockPageHierarchySpaces(spaceIds: string[], trx: KyselyTransaction): Promise<void>;
    insertPage(insertablePage: InsertablePage, trx?: KyselyTransaction): Promise<Page>;
    deletePage(pageId: string): Promise<void>;
    removePage(pageId: string, deletedById: string, workspaceId: string): Promise<void>;
    restorePage(pageId: string, workspaceId: string): Promise<void>;
    getRecentPagesInSpace(spaceId: string, pagination: PaginationOptions): Promise<import("@docmost/db/pagination/cursor-pagination").CursorPaginationResult<{
        id: string;
        workspaceId: string;
        creatorId: string;
        title: string;
        createdAt: Date;
        updatedAt: Date;
        deletedAt: Date;
        content: import("@docmost/db/types/db").JsonValue;
        tsv: string;
        spaceId: string;
        contributorIds: string[];
        coverAttribution: import("@docmost/db/types/db").JsonValue;
        coverPhoto: string;
        coverPosition: number;
        deletedById: string;
        icon: string;
        isBase: boolean;
        baseSchemaVersion: number;
        isLocked: boolean;
        lastUpdatedById: string;
        parentPageId: string;
        position: string;
        slugId: string;
        textContent: string;
        ydoc: Buffer<ArrayBufferLike>;
    } & {
        lastUpdatedBy: {
            id: string;
            name: string;
            avatarUrl: string;
        };
        space: {
            id: string;
            name: string;
            slug: string;
            archivedAt?: string;
        };
    }, undefined>>;
    getRecentlyUpdatedPages(userId: string, workspaceId: string, options: RecentlyUpdatedDto): Promise<{
        id: string;
        title: string;
        updatedAt: Date;
        icon: string;
        isBase: boolean;
        slugId: string;
        spaceSlug: string;
        spaceName: string;
        lastEditorName: string;
        lastEditorAvatarUrl: string;
    }[]>;
    getRecentPages(userId: string, pagination: PaginationOptions): Promise<import("@docmost/db/pagination/cursor-pagination").CursorPaginationResult<{
        id: string;
        workspaceId: string;
        creatorId: string;
        title: string;
        createdAt: Date;
        updatedAt: Date;
        deletedAt: Date;
        content: import("@docmost/db/types/db").JsonValue;
        tsv: string;
        spaceId: string;
        contributorIds: string[];
        coverAttribution: import("@docmost/db/types/db").JsonValue;
        coverPhoto: string;
        coverPosition: number;
        deletedById: string;
        icon: string;
        isBase: boolean;
        baseSchemaVersion: number;
        isLocked: boolean;
        lastUpdatedById: string;
        parentPageId: string;
        position: string;
        slugId: string;
        textContent: string;
        ydoc: Buffer<ArrayBufferLike>;
    } & {
        lastUpdatedBy: {
            id: string;
            name: string;
            avatarUrl: string;
        };
        space: {
            id: string;
            name: string;
            slug: string;
            archivedAt?: string;
        };
    }, undefined>>;
    getCreatedByPages(creatorId: string, requestingUserId: string, pagination: PaginationOptions, spaceId?: string): Promise<import("@docmost/db/pagination/cursor-pagination").CursorPaginationResult<{
        id: string;
        workspaceId: string;
        creatorId: string;
        title: string;
        createdAt: Date;
        updatedAt: Date;
        deletedAt: Date;
        content: import("@docmost/db/types/db").JsonValue;
        tsv: string;
        spaceId: string;
        contributorIds: string[];
        coverAttribution: import("@docmost/db/types/db").JsonValue;
        coverPhoto: string;
        coverPosition: number;
        deletedById: string;
        icon: string;
        isBase: boolean;
        baseSchemaVersion: number;
        isLocked: boolean;
        lastUpdatedById: string;
        parentPageId: string;
        position: string;
        slugId: string;
        textContent: string;
        ydoc: Buffer<ArrayBufferLike>;
    } & {
        space: {
            id: string;
            name: string;
            slug: string;
            archivedAt?: string;
        };
    }, undefined>>;
    getRecentPagesByUser(userId: string, viewerId: string, workspaceId: string, pagination: PaginationOptions): Promise<import("@docmost/db/pagination/cursor-pagination").CursorPaginationResult<{
        id: string;
        title: string;
        spaceId: string;
        icon: string;
        isBase: boolean;
        slugId: string;
        space: {
            id: string;
            logo: string;
            name: string;
            slug: string;
        };
        activity: UserRecentPageActivity;
        activityAt: Date;
    }, undefined>>;
    getDeletedPagesInSpace(spaceId: string, pagination: PaginationOptions): Promise<import("@docmost/db/pagination/cursor-pagination").CursorPaginationResult<{
        id: string;
        workspaceId: string;
        creatorId: string;
        title: string;
        createdAt: Date;
        updatedAt: Date;
        deletedAt: Date;
        content: import("@docmost/db/types/db").JsonValue;
        tsv: string;
        spaceId: string;
        contributorIds: string[];
        coverAttribution: import("@docmost/db/types/db").JsonValue;
        coverPhoto: string;
        coverPosition: number;
        deletedById: string;
        icon: string;
        isBase: boolean;
        baseSchemaVersion: number;
        isLocked: boolean;
        lastUpdatedById: string;
        parentPageId: string;
        position: string;
        slugId: string;
        textContent: string;
        ydoc: Buffer<ArrayBufferLike>;
    } & {
        content: import("@docmost/db/types/db").JsonValue;
    } & {
        space: {
            id: string;
            name: string;
            slug: string;
            archivedAt?: string;
        };
    } & {
        deletedBy: {
            id: string;
            name: string;
            avatarUrl: string;
        };
    }, undefined>>;
    withSpace(eb: ExpressionBuilder<DB, 'pages'>, opts?: {
        includeArchivedAt?: boolean;
    }): import("kysely").AliasedRawBuilder<{
        id: string;
        name: string;
        slug: string;
        archivedAt?: string;
    }, "space">;
    withCreator(eb: ExpressionBuilder<DB, 'pages'>): import("kysely").AliasedRawBuilder<{
        id: string;
        name: string;
        avatarUrl: string;
    }, "creator">;
    withLastUpdatedBy(eb: ExpressionBuilder<DB, 'pages'>): import("kysely").AliasedRawBuilder<{
        id: string;
        name: string;
        avatarUrl: string;
    }, "lastUpdatedBy">;
    withDeletedBy(eb: ExpressionBuilder<DB, 'pages'>): import("kysely").AliasedRawBuilder<{
        id: string;
        name: string;
        avatarUrl: string;
    }, "deletedBy">;
    withContributors(eb: ExpressionBuilder<DB, 'pages'>): import("kysely").AliasedRawBuilder<{
        id: string;
        name: string;
        avatarUrl: string;
    }[], "contributors">;
    withHasChildren(eb: ExpressionBuilder<DB, 'pages'>): import("kysely").AliasedSelectQueryBuilder<{
        count: boolean;
    }, "hasChildren">;
    getPageAndDescendants(parentPageId: string, opts: {
        includeContent: boolean;
        trx?: KyselyTransaction;
    }): Promise<{
        id: string;
        workspaceId: string;
        title: string;
        createdAt: Date;
        updatedAt: Date;
        content: import("@docmost/db/types/db").JsonValue;
        spaceId: string;
        coverAttribution: import("@docmost/db/types/db").JsonValue;
        coverPhoto: string;
        coverPosition: number;
        icon: string;
        parentPageId: string;
        position: string;
        slugId: string;
    }[]>;
    isPageDescendant(ancestorPageId: string, descendantPageId: string, trx?: KyselyTransaction): Promise<boolean>;
    getPageAndDescendantsExcludingRestricted(parentPageId: string, opts: {
        includeContent: boolean;
    }): Promise<{
        id: string;
        workspaceId: string;
        title: string;
        updatedAt: Date;
        spaceId: string;
        icon: string;
        parentPageId: string;
        position: string;
        slugId: string;
        content?: import("@docmost/db/types/db").JsonValue;
    }[]>;
    getSpacePagesExcludingRestricted(spaceId: string): Promise<{
        id: string;
        workspaceId: string;
        title: string;
        updatedAt: Date;
        spaceId: string;
        icon: string;
        parentPageId: string;
        position: string;
        slugId: string;
    }[]>;
    getFirstUnrestrictedRootPage(spaceId: string): Promise<{
        id: string;
        slugId: string;
    }>;
}
