import Logger from "../../../logger.js"; import { PKC } from "../../../pkc/pkc.js"; import type { CommunityEditOptions, CreateNewLocalCommunityParsedOptions, InternalCommunityRecordBeforeFirstUpdateType, InternalCommunityRecordAfterFirstUpdateType, ParsedCommunityEditOptions, CommunityChallengeSetting, CommunityIpfsType, RpcInternalCommunityRecordBeforeFirstUpdateType, RpcInternalCommunityRecordAfterFirstUpdateType, CommunityEvents, AnchorPublishPreparation, PublishedAnchorRecord } from "../../../community/types.js"; import { LRUCache } from "lru-cache"; import { PageGenerator } from "./page-generator.js"; import { DbHandler } from "./db-handler.js"; import type { ChallengeAnswerMessageType, ChallengeRequestMessageType, DecryptedChallengeAnswer, DecryptedChallengeRequestMessageType } from "../../../pubsub-messages/types.js"; import type { IpfsHttpClientPubsubMessage } from "../../../types.js"; import { SignerWithPublicKeyAddress } from "../../../signer/index.js"; import { RpcLocalCommunity } from "../../../community/rpc-local-community.js"; import type { CommentsTableRow } from "../../../publications/comment/types.js"; import { AllPageCids } from "../../../pages/types.js"; import { createNewLocalCommunityDb, updateDbInternalState, updateInstancePropsWithStartedCommunityOrDb } from "./local-community/db-state.js"; export { createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb }; import { publishChallengeVerification, publishIdempotentDuplicateVerification } from "./local-community/challenges.js"; import { checkPublicationValidity } from "./local-community/publication-validation.js"; import { calculateLocalMfsPathForCommentUpdate } from "./local-community/comment-updates.js"; import { addOldPageCidsToCidsToUnpin, updateCommunityIpnsIfNeeded } from "./local-community/ipns-publishing.js"; import type { InternalExportHandle } from "./local-community/export.js"; import type { CommunityExportRecord, ExportCommunityUserOptions, ExportCommunityModLogsOptions } from "../../../community/types.js"; import type { CommentModerationTableRow } from "../../../publications/comment-moderation/types.js"; export declare class LocalCommunity extends RpcLocalCommunity implements CreateNewLocalCommunityParsedOptions { signer: SignerWithPublicKeyAddress; raw: RpcLocalCommunity["raw"]; _postUpdatesBuckets: number[]; _defaultCommunityChallenges: CommunityChallengeSetting[]; _challengeAnswerPromises: LRUCache>; _challengeAnswerResolveReject: LRUCache void; reject: (error: Error) => void; }>; _ongoingChallengeExchanges: LRUCache; _duplicatePublicationAttempts: LRUCache; _challengeExchangesFromLocalPublishers: Record; _inFlightPublicationExchanges: Map>; _challengeExchangeTtlMs: number; _cidsToUnPin: Set; _mfsPathsToRemove: Set; _communityUpdateTrigger: boolean; _combinedHashOfPendingCommentsCids: string; _pageGenerator: PageGenerator; _dbHandler: DbHandler; _stopHasBeenCalled: boolean; _publishLoopPromise?: Promise; _updateLoopPromise?: Promise; _updateLoopAbortController?: AbortController; _firstUpdateAfterStart: boolean; _internalStateUpdateId: InternalCommunityRecordBeforeFirstUpdateType["_internalStateUpdateId"]; _lastPubsubTopicRoutingProvideAt?: number; _subscribedChallengePubsubTopic?: string; _lastProvidedBrowserDialableSelfAddrs?: string[]; _lastAddressReprovideCheckAt?: number; _lastAnchorRecordReprovideAt?: number; _mirroredStartedOrUpdatingCommunity?: { community: LocalCommunity; } & Pick; _pendingEditProps: Partial[]; _blocksToRm: string[]; _postsAllPageCids: AllPageCids | undefined; _exports: CommunityExportRecord[]; _activeExports: Map; _exportQueue: Promise; constructor(pkc: PKC); toJSONInternalAfterFirstUpdate(): InternalCommunityRecordAfterFirstUpdateType; toJSONInternalBeforeFirstUpdate(): InternalCommunityRecordBeforeFirstUpdateType; toJSONInternalRpcAfterFirstUpdate(): RpcInternalCommunityRecordAfterFirstUpdateType; toJSONInternalRpcBeforeFirstUpdate(): RpcInternalCommunityRecordBeforeFirstUpdateType; _updateIpnsPubsubPropsIfNeeded(_newProps: Parameters[0]): void; _updateStartedValue(): Promise; initNewLocalCommunityPropsNoMerge(newProps: CreateNewLocalCommunityParsedOptions): Promise; initInternalCommunityAfterFirstUpdateNoMerge(newProps: InternalCommunityRecordAfterFirstUpdateType): Promise; initInternalCommunityBeforeFirstUpdateNoMerge(newProps: InternalCommunityRecordBeforeFirstUpdateType): Promise; initDbHandlerIfNeeded(): Promise; _validateCommunitySizeSchemaAndSignatureBeforePublishing(recordToPublishRaw: CommunityIpfsType): Promise; handleChallengeRequest(request: ChallengeRequestMessageType, isLocalPublisher: boolean): Promise; handleChallengeAnswer(challengeAnswer: ChallengeAnswerMessageType): Promise; handleChallengeExchange(pubsubMsg: IpfsHttpClientPubsubMessage): Promise; _addCommentRowToIPFS(unpinnedCommentRow: CommentsTableRow, log: Logger): Promise; _assertDomainResolvesCorrectly(newAddressAsDomain: string): Promise; prepareAnchorPublish(): Promise; publishAnchorRecord(recordBytes: Uint8Array): Promise; start(): Promise; update(): Promise; stop(): Promise; delete(): Promise; edit(newCommunityOptions: CommunityEditOptions): Promise; get exports(): CommunityExportRecord[]; export(options?: ExportCommunityUserOptions): Promise<{ exportId: string; }>; exportCommunityModLogs(opts?: ExportCommunityModLogsOptions): Promise<{ moderations: CommentModerationTableRow[]; }>; _cancelExport(exportId: string): Promise; _deleteExport(exportId: string): Promise; _loadExportsFromKeyv(): Promise; _getDbInternalState(includeMutable?: boolean): Promise; _listenToIncomingRequests(): Promise; _repinCommentsIPFSIfNeeded(): Promise; storePublication(request: DecryptedChallengeRequestMessageType, pendingApproval?: boolean): Promise<{ comment: import("../../../publications/comment/types.js").CommentIpfsType; cid: import("../../../publications/comment/types.js").CommentUpdateType["cid"]; } | undefined>; updateCommunityIpnsIfNeeded(args: { commentUpdateRowsToPublishToIpfs: Parameters[1]; }): Promise; _addOldPageCidsToCidsToUnpin(curPages: Parameters[1], newPages: Parameters[2], addToBlockRm?: boolean): Promise; private shouldResolveDomainForVerification; _calculateNewPostUpdates(): Promise | undefined>; _calculateLatestUpdateTrigger(): void; _resolveIpnsAndLogIfPotentialProblematicSequence(): Promise; _updateDbInternalState(props: Parameters[1]): Promise; _updateCommentsThatNeedToBeUpdated(): Promise; _purgeDisapprovedCommentsOlderThan(): Promise; _publishChallengeVerification(challengeResult: Parameters[1], request: Parameters[2]): Promise; _publishIdempotentDuplicateVerification(...args: Parameters extends [unknown, ...infer Rest] ? Rest : never): Promise; _checkPublicationValidity(...args: Parameters extends [unknown, ...infer Rest] ? Rest : never): Promise; _calculateLocalMfsPathForCommentUpdate(...args: Parameters extends [unknown, ...infer Rest] ? Rest : never): string; }