import { z } from "zod"; import { CommentChallengeRequestToEncryptSchema, CommentIpfsSchema, CommentPubsubMessagePublicationSchema, CommentSignedPropertyNames, CommentsTableRowSchema, CommentUpdateForChallengeVerificationSchema, CommentUpdateForChallengeVerificationSignedPropertyNames, CommentUpdateForDisapprovedPendingComment, CommentUpdateSchema, CommentUpdateSignedPropertyNames, CommentUpdateTableRowSchema, CreateCommentOptionsSchema, DbRepliesSchema, DbRepliesSortEntrySchema, DbPostsSchema } from "./schema.js"; import type { Crosspost } from "./schema.js"; import { CommunityAuthorSchema } from "../../schema/schema.js"; import { RpcCommentEventResultSchema, RpcCommentUpdateResultSchema } from "../../clients/rpc-client/schema.js"; import type { JsonOfClass, RuntimeAuthorWithCommentUpdateType } from "../../types.js"; import { Comment } from "./comment.js"; import type { RepliesPagesTypeJson } from "../../pages/types.js"; import type { PublicationRpcErrorToTransmit, PublicationState } from "../types.js"; import type { JsonSignature, SignerType } from "../../signer/types.js"; import Publication from "../publication.js"; export type CommunityAuthor = z.infer; export type CreateCommentOptions = z.infer; export type CommentPubsubMessagePublication = z.infer; export interface CommentOptionsToSign extends Omit { signer: SignerType; communityAddress: string; } export type CommentUpdateType = z.infer; export type CommentUpdateForDisapprovedPendingComment = z.infer; export type CommentUpdateForChallengeVerification = z.infer; export type CommentIpfsType = z.infer; export type CrosspostRuntime = { cid: Crosspost["cid"]; comment: Omit & { author?: NonNullable & { nameResolved?: boolean; }; crosspost?: CrosspostRuntime; }; }; export type CommentChallengeRequestToEncryptType = z.infer; export type RpcCommentUpdateResultType = z.infer; export type RpcCommentResultType = z.infer; export interface CommentRawField extends Omit, "pubsubMessageToPublish" | "unsignedPublicationOptions"> { comment?: CommentIpfsType; commentUpdate?: CommentUpdateType; pubsubMessageToPublish?: CommentPubsubMessagePublication; commentUpdateFromChallengeVerification?: CommentUpdateForChallengeVerification; runtimeFieldsFromRpc?: Record; } export type CommentJson = JsonOfClass; type AuthorWithShortCommunityAddress = RuntimeAuthorWithCommentUpdateType & { shortAddress: string; }; export interface CommentIpfsWithCidDefined extends CommentIpfsType { cid: string; } export interface CommentIpfsWithCidPostCidDefined extends CommentIpfsWithCidDefined { postCid: string; } export interface CommentWithinRepliesPostsPageJson extends CommentIpfsWithCidPostCidDefined, Omit { communityAddress: string; communityPublicKey?: string; communityName?: string; shortCid: string; shortCommunityAddress: string; author: AuthorWithShortCommunityAddress; deleted?: boolean; replies?: Omit; raw: { comment: CommentIpfsType; commentUpdate: CommentUpdateType; }; } export interface CommentWithinModQueuePageJson extends CommentIpfsWithCidPostCidDefined, CommentUpdateForChallengeVerification { communityAddress: string; communityPublicKey?: string; communityName?: string; shortCid: string; shortCommunityAddress: string; author: AuthorWithShortCommunityAddress; raw: { comment: CommentIpfsType; commentUpdate: CommentUpdateForChallengeVerification & { pendingApproval: boolean; }; }; pendingApproval: boolean; } export type CommentState = PublicationState | "updating"; export type CommentUpdatingState = "stopped" | "resolving-author-name" | "fetching-ipfs" | "fetching-update-ipfs" | "resolving-community-name" | "fetching-community-ipns" | "fetching-community-ipfs" | "failed" | "succeeded" | "waiting-retry"; export interface CommentPubsubMessageWithCommunityAuthor extends CommentPubsubMessagePublication { author: RuntimeAuthorWithCommentUpdateType; } export interface PostPubsubMessageWithCommunityAuthor extends CommentPubsubMessageWithCommunityAuthor { parentCid: undefined; } export interface ReplyPubsubMessageWithCommunityAuthor extends CommentPubsubMessageWithCommunityAuthor { parentCid: string; } export interface CommentPubsubMessagPublicationSignature extends JsonSignature { signedPropertyNames: typeof CommentSignedPropertyNames; } export interface CommentUpdateForChallengeVerificationSignature extends JsonSignature { signedPropertyNames: typeof CommentUpdateForChallengeVerificationSignedPropertyNames; } export interface CommentUpdateSignature extends JsonSignature { signedPropertyNames: typeof CommentUpdateSignedPropertyNames; } export type MinimumCommentFieldsToFetchPages = Pick & { communityAddress: string; }; export type CommentRpcErrorToTransmit = PublicationRpcErrorToTransmit & { details?: PublicationRpcErrorToTransmit["details"] & { newUpdatingState?: Comment["updatingState"]; }; }; export type CommentsTableRow = z.infer; export interface CommentsTableRowInsert extends Omit { } export type DbRepliesSortEntry = z.infer; export type DbRepliesFormat = z.infer; export type DbPostsFormat = z.infer; export type CommentUpdatesRow = z.infer; export type CommentUpdatesTableRowInsert = CommentUpdatesRow; export {};