@bitsocial/bitsocial-react-hooks 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/hooks/accounts/accounts.d.ts.map +1 -1
- package/dist/hooks/accounts/accounts.js +10 -6
- package/dist/hooks/accounts/accounts.js.map +1 -1
- package/dist/hooks/actions/actions.d.ts +5 -3
- package/dist/hooks/actions/actions.d.ts.map +1 -1
- package/dist/hooks/actions/actions.js +128 -113
- package/dist/hooks/actions/actions.js.map +1 -1
- package/dist/lib/pkc-js/pkc-js-mock.d.ts +2 -0
- package/dist/lib/pkc-js/pkc-js-mock.d.ts.map +1 -1
- package/dist/lib/pkc-js/pkc-js-mock.js +18 -0
- package/dist/lib/pkc-js/pkc-js-mock.js.map +1 -1
- package/dist/stores/accounts/accounts-actions.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-actions.js +119 -70
- package/dist/stores/accounts/accounts-actions.js.map +1 -1
- package/dist/stores/accounts/accounts-database.d.ts.map +1 -1
- package/dist/stores/accounts/accounts-database.js +3 -0
- package/dist/stores/accounts/accounts-database.js.map +1 -1
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-actions.js","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions.ts"],"names":[],"mappings":"AAAA,sDAAsD;;;;;;;;;;;;;;;;;;;;;AAEtD,OAAO,aAAa,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,gBAAgB,EAAE,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,S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AC,EAAE,CAAC,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IACD,IAAI,cAAmC,CAAC;IACxC,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QACtC,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,KAAI,EAAE,CAAC,CAAC,MAAM,CAC7E,kBAAkB,CACnB,CAAC;QACF,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,WAAW,qBAAQ,cAAc,CAAC,WAAW,CAAE,CAAC;QACtD,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;YACxC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QACD,cAAc,mCAAQ,cAAc,KAAE,WAAW,GAAE,CAAC;QACpD,OAAO,EAAE,QAAQ,kCAAO,QAAQ,KAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,cAAc,GAAE,EAAE,CAAC;IACrE,CAAC,CAAC,CAAC;IACH,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,gBAAgB,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IACpD,CAAC;IACD,GAAG,CAAC,iCAAiC,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAA,CAAC","sourcesContent":["// public accounts actions that are called by the user\n\nimport accountsStore, { listeners } from \"./accounts-store\";\nimport communitiesStore, { isRetriableCommunityLoadError } from \"../communities\";\nimport accountsDatabase from \"./accounts-database\";\nimport accountGenerator from \"./account-generator\";\nimport Logger from \"@pkcprotocol/pkc-logger\";\nimport validator from \"../../lib/validator\";\nimport chain from \"../../lib/chain\";\nimport assert from \"../../lib/assert\";\nconst log = Logger(\"bitsocial-react-hooks:accounts:stores\");\nimport {\n Account,\n Accounts,\n PublishCommentOptions,\n Challenge,\n ChallengeVerification,\n PublishVoteOptions,\n PublishCommentEditOptions,\n PublishCommentModerationOptions,\n PublishCommunityEditOptions,\n CreateCommunityOptions,\n ExportCommunityOptions,\n CommunityExport,\n Communities,\n AccountComment,\n AccountVote,\n} from \"../../types\";\nimport * as accountsActionsInternal from \"./accounts-actions-internal\";\nimport {\n backfillPublicationCommunityAddress,\n createPkcCommunity,\n createPkcCommunityEdit,\n getPkcCommunityAddresses,\n normalizeCommunityEditOptionsForPkc,\n normalizePublicationOptionsForStore,\n normalizePublicationOptionsForPkc,\n withPublishChallengeAnswersCompat,\n} from \"../../lib/pkc-compat\";\nimport {\n getAccountCommentsIndex,\n getAccountCommunities,\n getCommentCidsToAccountsComments,\n getAccountsCommentsIndexes,\n COMMENT_MODERATION_AUTHOR_SUMMARY_KEY,\n getAccountEditPropertySummary,\n fetchCommentLinkDimensions,\n getAccountCommentDepth,\n getAccountCommentPostCid,\n addShortAddressesToAccountComment,\n sanitizeAccountCommentForState,\n sanitizeStoredAccountComment,\n getFreshestLoadedComment,\n getInitAccountCommentsToUpdate,\n} from \"./utils\";\nimport isEqual from \"../../lib/is-equal\";\nimport { v4 as uuid } from \"uuid\";\nimport utils from \"../../lib/utils\";\nimport { addOptimisticVoteMetadata } from \"../../lib/utils/optimistic-vote-counts\";\nimport { applyCommunityWordfilters } from \"../../lib/wordfilters\";\nimport { doesAddressMatchCommunityRef } from \"../../lib/community-ref\";\n\nconst getAccountCommentByCid = (commentCid?: string) => {\n const { commentCidsToAccountsComments, accountsComments } = accountsStore.getState();\n const accountCommentInfo = commentCid ? commentCidsToAccountsComments[commentCid] : undefined;\n return accountCommentInfo\n ? accountsComments[accountCommentInfo.accountId]?.[accountCommentInfo.accountCommentIndex]\n : undefined;\n};\n\nconst PUBLICATION_COMMUNITY_LOAD_TIMEOUT_MS = 30_000;\nconst COMMENT_AUTHOR_LOAD_TIMEOUT_MS = 10_000;\n\nconst communityHasPublicationConfig = (community: any) =>\n community &&\n (typeof community.updatedAt === \"number\" ||\n Object.prototype.hasOwnProperty.call(community, \"challenges\"));\n\nconst findLoadedPublicationCommunity = (communityAddress: string) => {\n const communities = communitiesStore.getState().communities;\n return Object.values(communities).find(\n (community: any) =>\n communityHasPublicationConfig(community) &&\n [community.address, community.name, community.publicKey].includes(communityAddress),\n );\n};\n\nconst loadPublicationCommunity = async (communityAddress: string, account: Account) => {\n const loadedCommunity = findLoadedPublicationCommunity(communityAddress);\n if (loadedCommunity) return loadedCommunity;\n\n const community = await createPkcCommunity(account.pkc, { address: communityAddress });\n try {\n if (communityHasPublicationConfig(community)) return community;\n\n return await new Promise<any>((resolve, reject) => {\n let settled = false;\n let timeout: ReturnType<typeof setTimeout>;\n const cleanup = () => {\n clearTimeout(timeout);\n community.removeListener?.(\"update\", onUpdate);\n community.removeListener?.(\"error\", onError);\n };\n const onUpdate = (updatedCommunity: any) => {\n if (settled) return;\n settled = true;\n cleanup();\n resolve(updatedCommunity || community);\n };\n const onError = (error: Error) => {\n if (settled) return;\n // pkc-js emits an error on every failed fetch attempt while it keeps retrying;\n // keep waiting for a later update and only fail on non-retriable errors or the timeout\n if (isRetriableCommunityLoadError(error)) return;\n settled = true;\n cleanup();\n reject(error);\n };\n timeout = setTimeout(\n () =>\n onError(\n new Error(`timed out loading challenge settings for community '${communityAddress}'`),\n ),\n PUBLICATION_COMMUNITY_LOAD_TIMEOUT_MS,\n );\n community.once(\"update\", onUpdate);\n community.on(\"error\", onError);\n void Promise.resolve()\n .then(() => community.update())\n .then(() => {\n if (communityHasPublicationConfig(community)) onUpdate(community);\n }, onError);\n });\n } finally {\n await community.stop?.();\n }\n};\n\nconst loadCommentAuthorAddress = async (\n account: Account,\n commentCid: string,\n): Promise<string | undefined> => {\n const abortController = new AbortController();\n const timeout = setTimeout(() => abortController.abort(), COMMENT_AUTHOR_LOAD_TIMEOUT_MS);\n try {\n const comment = await account.pkc.getComment({\n cid: commentCid,\n abortSignal: abortController.signal,\n });\n return comment?.author?.address;\n } catch (error) {\n log.error(\"accountsActions.loadCommentAuthorAddress error\", { commentCid, error });\n } finally {\n clearTimeout(timeout);\n }\n};\n\nconst applyPublicationWordfilters = async <T extends Record<string, any>>(\n publicationType: string,\n options: T,\n account: Account,\n) => {\n const communityAddress = options.communityAddress;\n if (typeof communityAddress !== \"string\" || !communityAddress) return options;\n const community = await loadPublicationCommunity(communityAddress, account);\n return applyCommunityWordfilters(publicationType, options, community?.challenges);\n};\n\ntype PublishSession = {\n accountId: string;\n originalIndex: number;\n currentIndex: number;\n comment?: any;\n // called with currentIndex after a deletion of an earlier account comment shifted it\n onIndexChange?: (index: number) => void;\n};\n\n// Active publish-session tracking for pending comments (Task 3)\nconst activePublishSessions = new Map<string, PublishSession>();\nconst abandonedPublishSessionIds = new Set<string>();\n\ntype VotePublishSession = {\n // the account vote restored when the burst is abandoned or one of its publications failed: the one\n // the first publication replaced, or the latest verified vote of the burst\n previousAccountVote: AccountVote | undefined;\n publications: Set<any>;\n // votes still waiting on account.pkc.createVote(), they join publications once it resolves\n creating: number;\n // a publication of the burst was rejected or failed to publish, so the session restores\n // previousAccountVote when it ends\n failed?: boolean;\n};\n\n// A vote has no pending account comment to delete, so abandoning one restores the account vote that\n// the optimistic write in publishVote replaced. Keyed per comment because that is what the caller\n// abandons, and because rapid votes on the same comment share one revert target.\nconst activeVotePublishSessions = new Map<string, VotePublishSession>();\n\nconst getVotePublishSessionKey = (accountId: string, commentCid: string) =>\n `${accountId}:${commentCid}`;\n\nconst getClientsSnapshotForState = (clients: any): any => {\n if (!clients || typeof clients !== \"object\") {\n return undefined;\n }\n if (typeof clients.on === \"function\" || \"state\" in clients) {\n return { state: clients.state };\n }\n\n const snapshot: Record<string, any> = {};\n for (const key in clients) {\n const childSnapshot = getClientsSnapshotForState(clients[key]);\n if (childSnapshot !== undefined) {\n snapshot[key] = childSnapshot;\n }\n }\n return Object.keys(snapshot).length > 0 ? snapshot : undefined;\n};\n\nconst unsafeCommentUpdatePropertyNames = new Set([\"__proto__\", \"constructor\", \"prototype\"]);\n// commentUpdate.signature is the community's signature over the update, not the comment's own\n// signature, which pkc-js keeps on the publication (and which a pseudonymous community re-signs).\nconst commentOwnedCommentUpdatePropertyNames = new Set([\"signature\"]);\n\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n !!value && typeof value === \"object\" && !Array.isArray(value);\n\nconst applyChallengeVerificationCommentUpdateToPublication = (\n challengeVerification: ChallengeVerification | undefined,\n publication: Record<string, any> | undefined,\n) => {\n const commentUpdate = challengeVerification?.commentUpdate;\n if (\n !commentUpdate ||\n typeof commentUpdate !== \"object\" ||\n Array.isArray(commentUpdate) ||\n !publication ||\n typeof publication !== \"object\"\n ) {\n return;\n }\n\n for (const key of Object.keys(commentUpdate)) {\n if (\n unsafeCommentUpdatePropertyNames.has(key) ||\n commentOwnedCommentUpdatePropertyNames.has(key)\n ) {\n continue;\n }\n // commentUpdate.author only carries community-side fields such as author.community, so merge\n // it like pkc-js does. Replacing it drops the published author address, which in a pseudonymous\n // community is the community-assigned alias, not the account address.\n if (\n key === \"author\" &&\n isPlainObject(publication.author) &&\n isPlainObject(commentUpdate.author)\n ) {\n publication.author = { ...publication.author, ...commentUpdate.author };\n continue;\n }\n publication[key] = commentUpdate[key];\n }\n};\n\nconst syncCommentClientsSnapshot = (\n publishSessionId: string,\n accountId: string,\n publication: any,\n) => {\n const session = getPublishSession(publishSessionId);\n if (session?.currentIndex === undefined) {\n return;\n }\n\n const snapshot = getClientsSnapshotForState(publication?.clients);\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, accountId, session.currentIndex, (ac, acc) => {\n const updatedAccountComment = { ...acc };\n if (snapshot === undefined) {\n delete updatedAccountComment.clients;\n } else {\n updatedAccountComment.clients = snapshot;\n }\n ac[session.currentIndex] = updatedAccountComment;\n }),\n );\n};\n\n// only a community hosted by the connected pkc instance can be edited with community.edit(), for any\n// other community pkc.createCommunity() returns a remote instance whose edit() throws. owner roles and\n// cached signers don't prove hosting, e.g. an owner using a client that doesn't host the community\n// must publish a CommunityEdit over pubsub, which the hosting node accepts from owners\nconst pkcHostsCommunity = (account: Account, communityAddress: string) =>\n getPkcCommunityAddresses(account.pkc).includes(communityAddress);\n\nconst createPublishSession = (accountId: string, index: number) => {\n const sessionId = uuid();\n activePublishSessions.set(sessionId, {\n accountId,\n originalIndex: index,\n currentIndex: index,\n });\n return sessionId;\n};\n\n// A pending comment takes the next row of its account's live comment list, so the first saves of\n// an account's pending comments run one at a time: two overlapping publishComment calls that read\n// the length before either saved its row would get the same index and overwrite each other.\nconst accountCommentAppendQueues = new Map<string, Promise<unknown>>();\nconst queueAccountCommentAppend = <T>(accountId: string, append: () => Promise<T>) => {\n const previousAppend = accountCommentAppendQueues.get(accountId) || Promise.resolve();\n const queuedAppend = previousAppend.catch(() => {}).then(append);\n accountCommentAppendQueues.set(accountId, queuedAppend);\n return queuedAppend.finally(() => {\n if (accountCommentAppendQueues.get(accountId) === queuedAppend) {\n accountCommentAppendQueues.delete(accountId);\n }\n });\n};\n\nconst updatePublishSessionComment = (sessionId: string, comment?: any) => {\n const session = activePublishSessions.get(sessionId);\n if (!session) {\n return;\n }\n activePublishSessions.set(sessionId, { ...session, comment });\n};\n\nconst abandonAndStopPublishSession = (accountId: string, index: number) => {\n const session = getPublishSessionByCurrentIndex(accountId, index);\n if (!session) return;\n abandonedPublishSessionIds.add(session.sessionId);\n try {\n const stop = session.comment?.stop?.bind(session.comment);\n if (typeof stop === \"function\") stop();\n } catch (e) {\n log.error(\"comment.stop() error during abandon\", { accountId, index, error: e });\n }\n activePublishSessions.delete(session.sessionId);\n};\n\n// deleteAccount only abandons the publish sessions that exist when it starts, so a publication that\n// reaches its first save later checks that its account is still there\nconst deletingAccountIds = new Set<string>();\nconst isAccountDeleted = (accountId: string) =>\n deletingAccountIds.has(accountId) || !accountsStore.getState().accounts?.[accountId];\n\n// a deleted account's pending comments and votes would otherwise keep publishing and write their\n// results for an account that no longer exists\nconst abandonAccountPublishSessions = (accountId: string) => {\n for (const session of activePublishSessions.values()) {\n if (session.accountId === accountId) {\n abandonAndStopPublishSession(accountId, session.currentIndex);\n }\n }\n const votePublishSessionKeyPrefix = getVotePublishSessionKey(accountId, \"\");\n for (const [key, session] of activeVotePublishSessions) {\n if (!key.startsWith(votePublishSessionKeyPrefix)) continue;\n activeVotePublishSessions.delete(key);\n for (const publication of session.publications) {\n Promise.resolve()\n .then(() => publication?.stop?.())\n .catch((error) =>\n log.error(\"vote.stop() error during account delete\", { accountId, error }),\n );\n }\n }\n};\n\nconst startVotePublishSession = (\n accountId: string,\n commentCid: string,\n previousAccountVote: AccountVote | undefined,\n) => {\n const key = getVotePublishSessionKey(accountId, commentCid);\n const session = activeVotePublishSessions.get(key);\n // a retry or a rapid second vote joins the running session so the revert target stays the vote the\n // user had before any of them was published\n if (session) return session;\n const startedSession: VotePublishSession = {\n previousAccountVote,\n publications: new Set(),\n creating: 0,\n };\n activeVotePublishSessions.set(key, startedSession);\n return startedSession;\n};\n\nconst endVotePublishSession = (accountId: string, commentCid: string) => {\n activeVotePublishSessions.delete(getVotePublishSessionKey(accountId, commentCid));\n};\n\nconst restoreAccountVote = async (\n accountId: string,\n commentCid: string,\n previousAccountVote: AccountVote | undefined,\n) => {\n const currentAccountVote = accountsStore.getState().accountsVotes[accountId]?.[commentCid];\n // nothing was written optimistically, so there is nothing to restore\n if (currentAccountVote === previousAccountVote) return;\n // the account votes database only appends, so a comment with no earlier vote is restored to an\n // explicit neutral vote rather than by deleting the abandoned one\n const restoredAccountVote: AccountVote = previousAccountVote ?? {\n commentCid,\n vote: 0,\n timestamp: Math.floor(Date.now() / 1000),\n };\n await accountsDatabase.addAccountVote(accountId, restoredAccountVote);\n accountsStore.setState(({ accountsVotes }) => ({\n accountsVotes: {\n ...accountsVotes,\n [accountId]: { ...accountsVotes[accountId], [commentCid]: restoredAccountVote },\n },\n }));\n};\n\nconst isPublishSessionAbandoned = (sessionId: string) => abandonedPublishSessionIds.has(sessionId);\n\nconst getPublishSession = (sessionId: string) => activePublishSessions.get(sessionId);\n\n/** Returns state update or {} when accountComment not yet in state (no-op). Exported for coverage. */\nexport const maybeUpdateAccountComment = (\n accountsComments: Record<string, any[]>,\n accountId: string,\n index: number,\n updater: (accountComments: any[], accountComment: any) => void,\n) => {\n const accountComments = [...(accountsComments[accountId] || [])];\n const accountComment = accountComments[index];\n if (!accountComment) return {};\n updater(accountComments, accountComment);\n return { accountsComments: { ...accountsComments, [accountId]: accountComments } };\n};\n\nconst getPublishSessionByCurrentIndex = (\n accountId: string,\n index: number,\n): ({ sessionId: string } & PublishSession) | undefined => {\n for (const [key, session] of activePublishSessions) {\n if (session.accountId === accountId && session.currentIndex === index) {\n return { sessionId: key, ...session };\n }\n }\n return undefined;\n};\n\nconst shiftPublishSessionIndicesAfterDelete = (accountId: string, deletedIndex: number) => {\n for (const session of activePublishSessions.values()) {\n if (session.accountId === accountId && session.currentIndex > deletedIndex) {\n session.currentIndex -= 1;\n }\n }\n};\n\n// the sessions shifted by a deletion are the ones now at or after the deleted index\nconst notifyShiftedPublishSessions = (accountId: string, deletedIndex: number) => {\n for (const session of activePublishSessions.values()) {\n if (session.accountId === accountId && session.currentIndex >= deletedIndex) {\n session.onIndexChange?.(session.currentIndex);\n }\n }\n};\n\nconst cleanupPublishSessionOnTerminal = (sessionId: string) => {\n activePublishSessions.delete(sessionId);\n abandonedPublishSessionIds.delete(sessionId);\n};\n\nexport const doesStoredAccountEditMatch = (storedAccountEdit: any, targetStoredAccountEdit: any) =>\n storedAccountEdit?.clientId && targetStoredAccountEdit?.clientId\n ? storedAccountEdit.clientId === targetStoredAccountEdit.clientId\n : isEqual(storedAccountEdit, targetStoredAccountEdit);\n\nexport const sanitizeStoredAccountEdit = (storedAccountEdit: any) => {\n const sanitizedStoredAccountEdit = { ...storedAccountEdit };\n delete sanitizedStoredAccountEdit.signer;\n delete sanitizedStoredAccountEdit.author;\n return sanitizedStoredAccountEdit;\n};\n\nconst accountEditNonPropertyNames = new Set([\n \"author\",\n \"signer\",\n \"clientId\",\n \"commentCid\",\n \"communityAddress\",\n \"communityAddress\",\n \"communityEdit\",\n \"communityEdit\",\n \"timestamp\",\n]);\n\nconst normalizeStoredAccountEditForSummary = (storedAccountEdit: any) => {\n const normalizedEdit = { ...storedAccountEdit };\n const commentModeration = normalizedEdit.commentModeration;\n if (commentModeration && typeof commentModeration === \"object\") {\n const { author, ...commentModerationProperties } = commentModeration;\n Object.assign(normalizedEdit, commentModerationProperties);\n if (Object.prototype.hasOwnProperty.call(commentModeration, \"author\")) {\n normalizedEdit[COMMENT_MODERATION_AUTHOR_SUMMARY_KEY] = author;\n }\n normalizedEdit.commentModeration = undefined;\n }\n const communityEdit = normalizedEdit.communityEdit ?? normalizedEdit.communityEdit;\n if (communityEdit && typeof communityEdit === \"object\") {\n Object.assign(normalizedEdit, communityEdit);\n }\n delete normalizedEdit.communityEdit;\n delete normalizedEdit.communityEdit;\n return normalizedEdit;\n};\n\nconst getStoredAccountEditTarget = (storedAccountEdit: any) =>\n storedAccountEdit.commentCid ||\n storedAccountEdit.communityAddress ||\n storedAccountEdit.communityAddress;\n\nexport const addStoredAccountEditSummaryToState = (\n accountsEditsSummaries: Record<string, Record<string, any>>,\n accountId: string,\n storedAccountEdit: any,\n) => {\n const editTarget = getStoredAccountEditTarget(storedAccountEdit);\n if (!editTarget) {\n return { accountsEditsSummaries };\n }\n\n const accountEditsSummary = accountsEditsSummaries[accountId] || {};\n const targetSummary = accountEditsSummary[editTarget] || {};\n const nextSummary = { ...targetSummary };\n const normalizedEdit = normalizeStoredAccountEditForSummary(storedAccountEdit);\n\n for (const propertyName in normalizedEdit) {\n if (\n (normalizedEdit[propertyName] === undefined &&\n propertyName !== COMMENT_MODERATION_AUTHOR_SUMMARY_KEY) ||\n accountEditNonPropertyNames.has(propertyName)\n ) {\n continue;\n }\n const previousTimestamp = nextSummary[propertyName]?.timestamp || 0;\n if ((normalizedEdit.timestamp || 0) >= previousTimestamp) {\n nextSummary[propertyName] = {\n timestamp: normalizedEdit.timestamp,\n value: normalizedEdit[propertyName],\n };\n }\n }\n\n return {\n accountsEditsSummaries: {\n ...accountsEditsSummaries,\n [accountId]: {\n ...accountEditsSummary,\n [editTarget]: nextSummary,\n },\n },\n };\n};\n\nexport const removeStoredAccountEditSummaryFromState = (\n accountsEditsSummaries: Record<string, Record<string, any>>,\n accountsEdits: Record<string, Record<string, any[]>>,\n accountId: string,\n storedAccountEdit: any,\n) => {\n const editTarget = getStoredAccountEditTarget(storedAccountEdit);\n if (!editTarget) {\n return { accountsEditsSummaries };\n }\n\n let deletedEdit = false;\n const editsForTarget = (accountsEdits[accountId]?.[editTarget] || []).filter((storedEdit) => {\n if (!deletedEdit && doesStoredAccountEditMatch(storedEdit, storedAccountEdit)) {\n deletedEdit = true;\n return false;\n }\n return true;\n });\n const nextTargetSummary = getAccountEditPropertySummary(editsForTarget);\n const nextAccountSummary = { ...(accountsEditsSummaries[accountId] || {}) };\n if (Object.keys(nextTargetSummary).length > 0) {\n nextAccountSummary[editTarget] = nextTargetSummary;\n } else {\n delete nextAccountSummary[editTarget];\n }\n\n return {\n accountsEditsSummaries: {\n ...accountsEditsSummaries,\n [accountId]: nextAccountSummary,\n },\n };\n};\n\nexport const hasTerminalChallengeVerificationError = (challengeVerification: any) => {\n const challengeErrors = challengeVerification?.challengeErrors;\n const hasChallengeErrors = Array.isArray(challengeErrors)\n ? challengeErrors.length > 0\n : challengeErrors && typeof challengeErrors === \"object\"\n ? Object.keys(challengeErrors).length > 0\n : Boolean(challengeErrors);\n\n return (\n !challengeVerification?.challengeSuccess &&\n (hasChallengeErrors || Boolean(challengeVerification?.reason))\n );\n};\n\nexport const addStoredAccountEditToState = (\n accountsEdits: Record<string, Record<string, any[]>>,\n accountId: string,\n storedAccountEdit: any,\n) => {\n const accountEdits = accountsEdits[accountId] || {};\n const editTarget = getStoredAccountEditTarget(storedAccountEdit);\n if (!editTarget) {\n return { accountsEdits };\n }\n const commentEdits = accountEdits[editTarget] || [];\n return {\n accountsEdits: {\n ...accountsEdits,\n [accountId]: {\n ...accountEdits,\n [editTarget]: [...commentEdits, storedAccountEdit],\n },\n },\n };\n};\n\nexport const removeStoredAccountEditFromState = (\n accountsEdits: Record<string, Record<string, any[]>>,\n accountId: string,\n storedAccountEdit: any,\n) => {\n const accountEdits = accountsEdits[accountId] || {};\n const editTarget = getStoredAccountEditTarget(storedAccountEdit);\n if (!editTarget) {\n return { accountsEdits };\n }\n const commentEdits = accountEdits[editTarget] || [];\n let deletedEdit = false;\n const nextCommentEdits = commentEdits.filter((commentEdit) => {\n if (!deletedEdit && doesStoredAccountEditMatch(commentEdit, storedAccountEdit)) {\n deletedEdit = true;\n return false;\n }\n return true;\n });\n\n const nextAccountEdits =\n nextCommentEdits.length > 0\n ? {\n ...accountEdits,\n [editTarget]: nextCommentEdits,\n }\n : Object.fromEntries(\n Object.entries(accountEdits).filter(([target]) => target !== editTarget),\n );\n\n return {\n accountsEdits: {\n ...accountsEdits,\n [accountId]: nextAccountEdits,\n },\n };\n};\n\nconst addNewAccountToDatabaseAndState = async (newAccount: Account) => {\n // add to database first to init the account\n await accountsDatabase.addAccount(newAccount);\n // use database data for these because it's easier\n const [newAccountIds, newAccountNamesToAccountIds] = await Promise.all<any>([\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountIds\"),\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountNamesToAccountIds\"),\n ]);\n\n // set the new state\n const {\n accounts,\n accountsComments,\n accountsCommentsIndexes,\n accountsVotes,\n accountsEdits,\n accountsEditsSummaries,\n accountsEditsLoaded,\n accountsCommentsReplies,\n } = accountsStore.getState();\n const newAccounts = { ...accounts, [newAccount.id]: newAccount };\n const newState: any = {\n accounts: newAccounts,\n accountIds: newAccountIds,\n accountNamesToAccountIds: newAccountNamesToAccountIds,\n accountsComments: { ...accountsComments, [newAccount.id]: [] },\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [newAccount.id]: getAccountCommentsIndex([]),\n },\n accountsVotes: { ...accountsVotes, [newAccount.id]: {} },\n accountsEdits: { ...accountsEdits, [newAccount.id]: {} },\n accountsEditsSummaries: { ...accountsEditsSummaries, [newAccount.id]: {} },\n accountsEditsLoaded: { ...accountsEditsLoaded, [newAccount.id]: false },\n accountsCommentsReplies: { ...accountsCommentsReplies, [newAccount.id]: {} },\n };\n // if there is only 1 account, make it active\n // otherwise stay on the same active account\n if (newAccountIds.length === 1) {\n newState.activeAccountId = newAccount.id;\n }\n accountsStore.setState(newState);\n};\n\nexport const createAccount = async (accountName?: string) => {\n const newAccount = await accountGenerator.generateDefaultAccount();\n if (accountName) {\n newAccount.name = accountName;\n }\n await addNewAccountToDatabaseAndState(newAccount);\n log(\"accountsActions.createAccount\", { accountName, account: newAccount });\n};\n\nexport const deleteAccount = async (accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.deleteAccount account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n // until the store drops the account, a publication that has not started yet must not start\n deletingAccountIds.add(account.id);\n try {\n abandonAccountPublishSessions(account.id);\n // a pending comment already saving its first row finishes before the account is cleared\n await accountCommentAppendQueues.get(account.id)?.catch(() => {});\n await accountsDatabase.removeAccount(account);\n const [newAccountIds, newActiveAccountId, newAccountNamesToAccountIds] = await Promise.all<any>(\n [\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountIds\"),\n accountsDatabase.accountsMetadataDatabase.getItem(\"activeAccountId\"),\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountNamesToAccountIds\"),\n ],\n );\n // from the live state: other accounts may have saved comments, votes, edits or replies during\n // the awaits above\n accountsStore.setState((state) => {\n const withoutAccount = <T extends Record<string, any>>(map: T): T => {\n const newMap = { ...map };\n delete newMap[account.id];\n return newMap;\n };\n const newAccountsComments = withoutAccount(state.accountsComments);\n return {\n accounts: withoutAccount(state.accounts),\n accountIds: newAccountIds,\n activeAccountId: newActiveAccountId,\n accountNamesToAccountIds: newAccountNamesToAccountIds,\n accountsComments: newAccountsComments,\n accountsCommentsIndexes: withoutAccount(state.accountsCommentsIndexes),\n commentCidsToAccountsComments: getCommentCidsToAccountsComments(newAccountsComments),\n accountsVotes: withoutAccount(state.accountsVotes),\n accountsEdits: withoutAccount(state.accountsEdits),\n accountsEditsSummaries: withoutAccount(state.accountsEditsSummaries),\n accountsEditsLoaded: withoutAccount(state.accountsEditsLoaded),\n accountsCommentsReplies: withoutAccount(state.accountsCommentsReplies),\n };\n });\n } finally {\n deletingAccountIds.delete(account.id);\n }\n};\n\nexport const setActiveAccount = async (accountName: string) => {\n const { accountNamesToAccountIds } = accountsStore.getState();\n assert(accountNamesToAccountIds, `can't use accountsStore.accountActions before initialized`);\n validator.validateAccountsActionsSetActiveAccountArguments(accountName);\n const accountId = accountNamesToAccountIds[accountName];\n await accountsDatabase.accountsMetadataDatabase.setItem(\"activeAccountId\", accountId);\n log(\"accountsActions.setActiveAccount\", { accountName, accountId });\n accountsStore.setState({ activeAccountId: accountId });\n};\n\nexport const setAccount = async (account: Account) => {\n const { accounts } = accountsStore.getState();\n validator.validateAccountsActionsSetAccountArguments(account);\n assert(\n accounts?.[account.id],\n `cannot set account with account.id '${account.id}' id does not exist in database`,\n );\n validator.validateAccountsActionsSetAccountAuthorName(\n account.author,\n accounts[account.id].author,\n );\n\n // if author.address has changed, add new community roles of author.address found in communities store\n // TODO: add test to check if roles get added\n if (account.author.address !== accounts[account.id].author.address) {\n const communities = getAccountCommunities(account, communitiesStore.getState().communities);\n account = { ...account, communities };\n\n // wallet.signature changes if author.address changes\n if (account.author.wallets?.eth) {\n const pkcSignerWalletWithNewAuthorAddress = await chain.getEthWalletFromPkcPrivateKey(\n account.signer.privateKey,\n account.author.address,\n );\n // wallet is using pkc signer, redo signature with new author.address\n if (account.author.wallets.eth.address === pkcSignerWalletWithNewAuthorAddress?.address) {\n account.author.wallets = {\n ...account.author.wallets,\n eth: pkcSignerWalletWithNewAuthorAddress,\n };\n }\n }\n }\n\n // use this function to serialize and update all databases\n await accountsDatabase.addAccount(account);\n const [newAccount, newAccountNamesToAccountIds] = await Promise.all<any>([\n // use this function to deserialize\n accountsDatabase.getAccount(account.id),\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountNamesToAccountIds\"),\n ]);\n const newAccounts: Accounts = { ...accounts, [newAccount.id]: newAccount };\n log(\"accountsActions.setAccount\", { account: newAccount });\n accountsStore.setState({\n accounts: newAccounts,\n accountNamesToAccountIds: newAccountNamesToAccountIds,\n });\n};\n\nexport const setAccountsOrder = async (newOrderedAccountNames: string[]) => {\n const { accounts, accountNamesToAccountIds } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds,\n `can't use accountsStore.accountActions before initialized`,\n );\n const accountIds = [];\n const accountNames = [];\n for (const accountName of newOrderedAccountNames) {\n const accountId = accountNamesToAccountIds[accountName];\n accountIds.push(accountId);\n accountNames.push(accounts[accountId].name);\n }\n validator.validateAccountsActionsSetAccountsOrderArguments(newOrderedAccountNames, accountNames);\n log(\"accountsActions.setAccountsOrder\", {\n previousAccountNames: accountNames,\n newAccountNames: newOrderedAccountNames,\n });\n await accountsDatabase.accountsMetadataDatabase.setItem(\"accountIds\", accountIds);\n accountsStore.setState({ accountIds });\n};\n\nexport const importAccount = async (serializedAccount: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let imported;\n try {\n imported = JSON.parse(serializedAccount);\n } catch (e) {}\n assert(\n imported?.account && imported?.account?.id && imported?.account?.name,\n `accountsActions.importAccount failed JSON.stringify json serializedAccount '${serializedAccount}'`,\n );\n\n // add community roles already in communities store to imported account\n // TODO: add test to check if roles get added\n const communities = getAccountCommunities(\n imported.account,\n communitiesStore.getState().communities,\n );\n // Preserve the imported name when possible; otherwise use the next available numeric suffix.\n const importedAccountName = imported.account.name;\n let accountNameNumber = 2;\n while (accountNamesToAccountIds[imported.account.name]) {\n imported.account.name = `${importedAccountName} ${accountNameNumber}`;\n accountNameNumber++;\n }\n\n // Always assign a new local id so importing the same backup cannot overwrite an existing account.\n const accountToImport = {\n ...accountGenerator.getDefaultAccountFields(),\n ...imported.account,\n communities,\n id: uuid(),\n };\n\n // Hydrate the imported identity once, then persist its history in bulk instead of replaying\n // every record through the single-publication write path.\n const newAccount = await accountsDatabase.addAccount(accountToImport, {\n returnHydratedAccount: true,\n });\n assert(newAccount, `accountsActions.importAccount failed to hydrate imported account`);\n let importedHistory;\n let accountIds;\n let newAccountNamesToAccountIds;\n try {\n importedHistory = await accountsDatabase.importAccountHistory(newAccount.id, {\n accountComments: imported.accountComments || [],\n accountVotes: imported.accountVotes || [],\n accountEdits: imported.accountEdits || [],\n });\n [accountIds, newAccountNamesToAccountIds] = await Promise.all<any>([\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountIds\"),\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountNamesToAccountIds\"),\n ]);\n } catch (error) {\n await accountsDatabase.removeAccount(newAccount);\n void newAccount.pkc?.destroy?.();\n throw error;\n }\n const { accountComments, accountVotes, accountEditsSummary } = importedHistory;\n\n accountsStore.setState((state) => ({\n accounts: { ...state.accounts, [newAccount.id]: newAccount },\n accountIds,\n accountNamesToAccountIds: newAccountNamesToAccountIds,\n accountsComments: { ...state.accountsComments, [newAccount.id]: accountComments },\n accountsCommentsIndexes: {\n ...state.accountsCommentsIndexes,\n [newAccount.id]: getAccountCommentsIndex(accountComments),\n },\n commentCidsToAccountsComments: getCommentCidsToAccountsComments({\n ...state.accountsComments,\n [newAccount.id]: accountComments,\n }),\n accountsVotes: { ...state.accountsVotes, [newAccount.id]: accountVotes },\n accountsEdits: { ...state.accountsEdits, [newAccount.id]: {} },\n accountsEditsSummaries: {\n ...state.accountsEditsSummaries,\n [newAccount.id]: accountEditsSummary,\n },\n accountsEditsLoaded: { ...state.accountsEditsLoaded, [newAccount.id]: false },\n // don't import/export replies to own comments, those are just cached and can be refetched\n accountsCommentsReplies: { ...state.accountsCommentsReplies, [newAccount.id]: {} },\n }));\n\n log(\"accountsActions.importAccount\", {\n account: newAccount,\n accountComments,\n accountVotes,\n accountEditsSummary,\n });\n\n // Match normal startup: refresh only the ten newest comments instead of opening a watcher\n // for the entire imported history at once.\n for (const { accountComment } of getInitAccountCommentsToUpdate({\n [newAccount.id]: accountComments,\n })) {\n accountsStore\n .getState()\n .accountsActionsInternal.startUpdatingAccountCommentOnCommentUpdateEvents(\n accountComment,\n newAccount,\n accountComment.index,\n )\n .catch((error: unknown) =>\n log.error(\n \"accountsActions.importAccount startUpdatingAccountCommentOnCommentUpdateEvents error\",\n {\n accountComment,\n accountCommentIndex: accountComment.index,\n importedAccount: newAccount,\n error,\n },\n ),\n );\n }\n\n // TODO: add options to only import private key, account settings, or include all account comments/votes history\n};\n\nexport const exportAccount = async (accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.exportAccount account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n const exportedAccountJson = await accountsDatabase.getExportedAccountJson(account.id);\n log(\"accountsActions.exportAccount\", { exportedAccountJson });\n return exportedAccountJson;\n};\n\nconst getCommunityAddressesToExport = (\n communityAddressOrAddresses: string | string[] | undefined,\n account: Account,\n) => {\n if (Array.isArray(communityAddressOrAddresses)) {\n return communityAddressOrAddresses;\n }\n if (communityAddressOrAddresses) {\n return [communityAddressOrAddresses];\n }\n return getPkcCommunityAddresses(account.pkc);\n};\n\nexport const exportCommunity = async (\n communityAddressOrAddresses?: string | string[],\n exportCommunityOptions: ExportCommunityOptions = {},\n accountName?: string,\n): Promise<CommunityExport[]> => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountsActions before initialized`,\n );\n assert(\n !exportCommunityOptions || typeof exportCommunityOptions === \"object\",\n `accountsActions.exportCommunity invalid exportCommunityOptions argument '${exportCommunityOptions}'`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.exportCommunity account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const communityAddresses = getCommunityAddressesToExport(communityAddressOrAddresses, account);\n assert(\n communityAddresses.length > 0,\n `accountsActions.exportCommunity no community addresses to export`,\n );\n for (const communityAddress of communityAddresses) {\n assert(\n communityAddress && typeof communityAddress === \"string\",\n `accountsActions.exportCommunity invalid communityAddress '${communityAddress}'`,\n );\n }\n\n const communityExports = await Promise.all(\n [...new Set(communityAddresses)].map(async (communityAddress) => {\n const community = await createPkcCommunity(account.pkc, { address: communityAddress });\n assert(\n typeof community?.export === \"function\",\n `accountsActions.exportCommunity community.export missing for communityAddress '${communityAddress}'`,\n );\n const exportedCommunity = await community.export(exportCommunityOptions);\n return { ...exportedCommunity, communityAddress };\n }),\n );\n log(\"accountsActions.exportCommunity\", {\n communityAddresses,\n includePrivateKey: exportCommunityOptions.includePrivateKey === true,\n communityExportCount: communityExports.length,\n });\n return communityExports;\n};\n\nexport const subscribe = async (communityAddress: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n communityAddress && typeof communityAddress === \"string\",\n `accountsActions.subscribe invalid communityAddress '${communityAddress}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.subscribe account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n let subscriptions: string[] = account.subscriptions || [];\n if (subscriptions.includes(communityAddress)) {\n throw Error(`account '${account.id}' already subscribed to '${communityAddress}'`);\n }\n subscriptions = [...subscriptions, communityAddress];\n\n const updatedAccount: Account = { ...account, subscriptions };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.subscribe\", { account: updatedAccount, accountName, communityAddress });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const unsubscribe = async (communityAddress: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n communityAddress && typeof communityAddress === \"string\",\n `accountsActions.unsubscribe invalid communityAddress '${communityAddress}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.unsubscribe account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n let subscriptions: string[] = account.subscriptions || [];\n if (!subscriptions.includes(communityAddress)) {\n throw Error(`account '${account.id}' already unsubscribed from '${communityAddress}'`);\n }\n // remove communityAddress\n subscriptions = subscriptions.filter((address) => address !== communityAddress);\n\n const updatedAccount: Account = { ...account, subscriptions };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.unsubscribe\", { account: updatedAccount, accountName, communityAddress });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const blockAddress = async (address: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n address && typeof address === \"string\",\n `accountsActions.blockAddress invalid address '${address}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.blockAddress account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const blockedAddresses: { [address: string]: boolean } = { ...account.blockedAddresses };\n if (blockedAddresses[address] === true) {\n throw Error(`account '${account.id}' already blocked address '${address}'`);\n }\n blockedAddresses[address] = true;\n\n const updatedAccount: Account = { ...account, blockedAddresses };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.blockAddress\", { account: updatedAccount, accountName, address });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const unblockAddress = async (address: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n address && typeof address === \"string\",\n `accountsActions.unblockAddress invalid address '${address}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.unblockAddress account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const blockedAddresses: { [address: string]: boolean } = { ...account.blockedAddresses };\n if (!blockedAddresses[address]) {\n throw Error(`account '${account.id}' already unblocked address '${address}'`);\n }\n delete blockedAddresses[address];\n\n const updatedAccount: Account = { ...account, blockedAddresses };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.unblockAddress\", { account: updatedAccount, accountName, address });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const blockCid = async (cid: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(cid && typeof cid === \"string\", `accountsActions.blockCid invalid cid '${cid}'`);\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.blockCid account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const blockedCids: { [cid: string]: boolean } = { ...account.blockedCids };\n if (blockedCids[cid] === true) {\n throw Error(`account '${account.id}' already blocked cid '${cid}'`);\n }\n blockedCids[cid] = true;\n\n const updatedAccount: Account = { ...account, blockedCids };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.blockCid\", { account: updatedAccount, accountName, cid });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const unblockCid = async (cid: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(cid && typeof cid === \"string\", `accountsActions.unblockCid invalid cid '${cid}'`);\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.unblockCid account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const blockedCids: { [cid: string]: boolean } = { ...account.blockedCids };\n if (!blockedCids[cid]) {\n throw Error(`account '${account.id}' already unblocked cid '${cid}'`);\n }\n delete blockedCids[cid];\n\n const updatedAccount: Account = { ...account, blockedCids };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.unblockCid\", { account: updatedAccount, accountName, cid });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nconst savedCommentMutationQueues = new Map<string, Promise<void>>();\n\nconst updateSavedComments = async (\n commentCid: string,\n accountName: string | undefined,\n shouldSave: boolean,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n commentCid && typeof commentCid === \"string\",\n `accountsActions.${shouldSave ? \"saveComment\" : \"unsaveComment\"} invalid commentCid '${commentCid}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n const accountId = accountName ? accountNamesToAccountIds[accountName] : activeAccountId;\n assert(\n accounts[accountId]?.id,\n `accountsActions.${shouldSave ? \"saveComment\" : \"unsaveComment\"} account.id '${accounts[accountId]?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const previousMutation = savedCommentMutationQueues.get(accountId) || Promise.resolve();\n const mutation = previousMutation\n .catch(() => {})\n .then(async () => {\n const currentAccounts = accountsStore.getState().accounts;\n const account = currentAccounts[accountId];\n assert(\n account?.id,\n `accountsActions.${shouldSave ? \"saveComment\" : \"unsaveComment\"} account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const isSaved = account.savedComments.includes(commentCid);\n if (shouldSave && isSaved) {\n throw Error(`account '${account.id}' already saved comment '${commentCid}'`);\n }\n if (!shouldSave && !isSaved) {\n throw Error(`account '${account.id}' already unsaved comment '${commentCid}'`);\n }\n\n const savedComments = shouldSave\n ? [commentCid, ...account.savedComments]\n : account.savedComments.filter((savedCommentCid: string) => savedCommentCid !== commentCid);\n const updatedAccount: Account = { ...account, savedComments };\n await accountsDatabase.addAccount(updatedAccount);\n\n const latestAccounts = accountsStore.getState().accounts;\n const latestAccount = latestAccounts[accountId];\n assert(latestAccount?.id, `account '${accountId}' was removed while updating saved comments`);\n const mergedAccount: Account = { ...latestAccount, savedComments };\n const updatedAccounts = { ...latestAccounts, [accountId]: mergedAccount };\n const actionName = shouldSave ? \"saveComment\" : \"unsaveComment\";\n log(`accountsActions.${actionName}`, {\n accountId,\n accountName,\n commentCid,\n });\n accountsStore.setState({ accounts: updatedAccounts });\n });\n\n savedCommentMutationQueues.set(accountId, mutation);\n try {\n await mutation;\n } finally {\n if (savedCommentMutationQueues.get(accountId) === mutation) {\n savedCommentMutationQueues.delete(accountId);\n }\n }\n};\n\nexport const saveComment = async (commentCid: string, accountName?: string) => {\n await updateSavedComments(commentCid, accountName, true);\n};\n\nexport const unsaveComment = async (commentCid: string, accountName?: string) => {\n await updateSavedComments(commentCid, accountName, false);\n};\n\n// callbacks passed with the comment publish options, never part of the published comment\nconst publishCommentCallbackNames = [\n \"onChallenge\",\n \"onChallengeVerification\",\n \"onError\",\n \"onPendingComment\",\n \"onPublishingStateChange\",\n \"onBeforeRepublish\",\n \"_onPendingCommentIndex\",\n];\nconst omitPublishCommentCallbacks = (options: PublishCommentOptions) => {\n const publicationOptions = { ...options };\n for (const callbackName of publishCommentCallbackNames) {\n delete publicationOptions[callbackName];\n }\n return publicationOptions;\n};\n\nexport const publishComment = async (\n publishCommentOptions: PublishCommentOptions,\n accountName?: string,\n) => {\n const { accounts, accountsComments, accountNamesToAccountIds, activeAccountId } =\n accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishCommentArguments({\n publishCommentOptions,\n accountName,\n account,\n });\n\n // find author.previousCommentCid if any\n const accountCommentsWithCids = accountsComments[account.id]\n .filter((comment: AccountComment) => comment.cid)\n // a pseudonymous community published the comment under an alias, linking it would reveal the account\n .filter((comment: AccountComment) => !comment.pseudonymityMode)\n // author can change his address, his previousCommentCid becomes invalid. hooks <= 0.1.51 replaced\n // the stored author with commentUpdate.author, so those comments have no author.address at all\n .filter(\n (comment: AccountComment) =>\n !comment.author?.address || comment.author.address === account.author?.address,\n );\n const previousComment = accountCommentsWithCids[accountCommentsWithCids.length - 1];\n const author = { ...account.author };\n if (previousComment) {\n author.previousCommentCid = previousComment.cid;\n }\n let previousCommentAuthorAddressPromise: Promise<string | undefined> | undefined;\n // builds the options pkc-js publishes from the client's options without callbacks, for the first\n // publish and for each republish whose options onBeforeRepublish returned\n const createPublishCommentOptions = async (options: PublishCommentOptions) => {\n const publicationAuthor = { ...author, ...options.author };\n if (\n publicationAuthor.address !== account.author?.address &&\n options.author?.previousCommentCid === undefined\n ) {\n delete publicationAuthor.previousCommentCid;\n }\n // a comment without author.address may have been published under an alternate author passed to\n // publishComment, so only link it once its immutable author, loaded from its cid, is the account's\n if (\n previousComment &&\n !previousComment.author?.address &&\n options.author?.previousCommentCid === undefined &&\n publicationAuthor.previousCommentCid === previousComment.cid\n ) {\n // loaded once, a republish reuses it\n previousCommentAuthorAddressPromise ??= loadCommentAuthorAddress(\n account,\n previousComment.cid,\n );\n const previousCommentAuthorAddress = await previousCommentAuthorAddressPromise;\n if (\n !previousCommentAuthorAddress ||\n previousCommentAuthorAddress !== account.author?.address\n ) {\n // fall back to the newest stored comment that kept the account author address\n const previousAccountAuthorComment = accountCommentsWithCids\n .filter((comment: AccountComment) => comment.author?.address)\n .pop();\n if (previousAccountAuthorComment) {\n publicationAuthor.previousCommentCid = previousAccountAuthorComment.cid;\n } else {\n delete publicationAuthor.previousCommentCid;\n }\n }\n }\n\n const createCommentOptions: any = normalizePublicationOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n signer: account.signer,\n ...options,\n author: publicationAuthor,\n });\n return applyPublicationWordfilters(\"comment\", createCommentOptions, account);\n };\n const createAccountComment = (createCommentOptions: any, index: number) =>\n addShortAddressesToAccountComment(\n sanitizeAccountCommentForState({\n ...normalizePublicationOptionsForStore(createCommentOptions),\n // try to get comment depth needed for custom depth flat account replies\n depth: getAccountCommentDepth(createCommentOptions),\n // try to get the post cid so a pending reply can link to its thread\n postCid: getAccountCommentPostCid(\n createCommentOptions,\n // the parent can be a comment of a local account that only the accounts store has so far\n getAccountCommentByCid(createCommentOptions.parentCid),\n ),\n index,\n accountId: account.id,\n }),\n ) as AccountComment;\n const commentLinkDimensionsPromises = new Map<\n string,\n ReturnType<typeof fetchCommentLinkDimensions>\n >();\n const getCommentLinkDimensions = (link: string) => {\n if (!commentLinkDimensionsPromises.has(link)) {\n commentLinkDimensionsPromises.set(link, fetchCommentLinkDimensions(link));\n }\n return commentLinkDimensionsPromises.get(link)!;\n };\n\n // the client's options, without callbacks, as last published: onBeforeRepublish receives them\n let publicationOptions = omitPublishCommentCallbacks(publishCommentOptions);\n let createCommentOptions: any = await createPublishCommentOptions(publicationOptions);\n\n // make sure the options dont throw\n await account.pkc.createComment(createCommentOptions);\n\n // set fetching link dimensions state\n let fetchingLinkDimensionsStates: { state: string; publishingState: string };\n if (publishCommentOptions.link) {\n publishCommentOptions.onPublishingStateChange?.(\"fetching-link-dimensions\");\n fetchingLinkDimensionsStates = {\n state: \"publishing\",\n publishingState: \"fetching-link-dimensions\",\n };\n }\n\n // save comment to db: the row index and the publish session are set by the queued first save\n let accountCommentIndex!: number;\n let publishSessionId!: string;\n let savedOnce = false;\n const saveCreatedAccountComment = async (\n accountComment: AccountComment,\n ): Promise<number | undefined> => {\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n const isUpdate = savedOnce;\n const session = getPublishSession(publishSessionId);\n const currentIndex = session?.currentIndex ?? accountCommentIndex;\n const persistedAccountComment = addShortAddressesToAccountComment(\n sanitizeStoredAccountComment(accountComment),\n ) as AccountComment;\n const liveAccountComment = addShortAddressesToAccountComment(\n sanitizeAccountCommentForState(accountComment),\n ) as AccountComment;\n const liveAccountComments = accountsStore.getState().accountsComments[account.id] || [];\n if (isUpdate && !liveAccountComments[currentIndex]) {\n return;\n }\n await accountsDatabase.addAccountComment(\n account.id,\n persistedAccountComment,\n isUpdate ? currentIndex : undefined,\n );\n const currentSession = getPublishSession(publishSessionId);\n if (!currentSession || isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n const persistedIndex = currentSession.currentIndex;\n savedOnce = true;\n accountsStore.setState(({ accountsComments, accountsCommentsIndexes }) => {\n const accountComments = [...accountsComments[account.id]];\n if (isUpdate && !accountComments[persistedIndex]) {\n return {};\n }\n accountComments[persistedIndex] = {\n ...liveAccountComment,\n index: persistedIndex,\n accountId: account.id,\n };\n return {\n accountsComments: { ...accountsComments, [account.id]: accountComments },\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [account.id]: getAccountCommentsIndex(accountComments),\n },\n };\n });\n return persistedIndex;\n };\n let createdAccountComment!: AccountComment;\n const reportOnPendingCommentError = (error: unknown, pendingCommentIndex: number) => {\n log.error(\"accountsActions.publishComment onPendingComment callback error\", {\n accountId: account.id,\n accountCommentIndex: pendingCommentIndex,\n error,\n });\n };\n const notifyPendingComment = (pendingCommentIndex: number, pendingComment: AccountComment) => {\n try {\n const pendingCommentSnapshot = utils.clone(pendingComment) as AccountComment;\n void Promise.resolve(\n publishCommentOptions.onPendingComment?.(pendingCommentIndex, pendingCommentSnapshot),\n ).catch((error) => reportOnPendingCommentError(error, pendingCommentIndex));\n } catch (error) {\n reportOnPendingCommentError(error, pendingCommentIndex);\n }\n };\n const pendingCommentIndex = await queueAccountCommentAppend(account.id, () => {\n if (isAccountDeleted(account.id)) {\n throw Error(`accountsActions.publishComment account '${account.id}' was deleted`);\n }\n // read the live list, not the state from before the awaits above\n accountCommentIndex = accountsStore.getState().accountsComments[account.id].length;\n publishSessionId = createPublishSession(account.id, accountCommentIndex);\n createdAccountComment = createAccountComment(createCommentOptions, accountCommentIndex);\n notifyPendingComment(accountCommentIndex, createdAccountComment);\n return saveCreatedAccountComment(createdAccountComment);\n });\n if (pendingCommentIndex === undefined) {\n return createdAccountComment;\n }\n createdAccountComment = { ...createdAccountComment, index: pendingCommentIndex };\n if (pendingCommentIndex !== accountCommentIndex) {\n notifyPendingComment(pendingCommentIndex, createdAccountComment);\n }\n // the hooks abandon the pending comment with abandonPendingComment, and learn its new index when a\n // deletion of an earlier account comment shifts it\n const abandonPendingComment = () => abandonPublishSession(publishSessionId);\n const onPendingCommentIndex = publishCommentOptions._onPendingCommentIndex;\n onPendingCommentIndex?.(pendingCommentIndex, createdAccountComment, abandonPendingComment);\n const pendingPublishSession = getPublishSession(publishSessionId);\n if (onPendingCommentIndex && pendingPublishSession) {\n pendingPublishSession.onIndexChange = (index) =>\n onPendingCommentIndex(index, { ...createdAccountComment, index }, abandonPendingComment);\n }\n\n let comment: any;\n (async () => {\n // fetch comment.link dimensions\n if (publishCommentOptions.link) {\n const commentLinkDimensions = await getCommentLinkDimensions(publishCommentOptions.link);\n createCommentOptions = { ...createCommentOptions, ...commentLinkDimensions };\n // save dimensions to db\n createdAccountComment = { ...createdAccountComment, ...commentLinkDimensions };\n await saveCreatedAccountComment(createdAccountComment);\n }\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n comment = backfillPublicationCommunityAddress(\n await account.pkc.createComment(createCommentOptions),\n createCommentOptions,\n );\n syncCommentClientsSnapshot(publishSessionId, account.id, comment);\n publishAndRetryFailedChallengeVerification();\n log(\"accountsActions.publishComment\", { createCommentOptions });\n })();\n\n let lastChallenge: Challenge | undefined;\n let lastReportedPublishError: Error | undefined;\n const normalizePublishError = (error: unknown): Error =>\n error instanceof Error ? error : new Error(String(error));\n const getActiveSessionForComment = (activeComment: any) => {\n const session = getPublishSession(publishSessionId);\n if (\n !session ||\n isPublishSessionAbandoned(publishSessionId) ||\n session.comment !== activeComment\n ) {\n return undefined;\n }\n return session;\n };\n const queueCleanupFailedPublishSession = (activeComment: any) => {\n if (!getActiveSessionForComment(activeComment)) return;\n queueMicrotask(() => {\n if (getActiveSessionForComment(activeComment)) {\n cleanupPublishSessionOnTerminal(publishSessionId);\n }\n });\n };\n const recordPublishCommentError = (rawError: unknown, activeComment: any) => {\n const error = normalizePublishError(rawError);\n if (lastReportedPublishError === error) {\n return error;\n }\n lastReportedPublishError = error;\n\n const session = getActiveSessionForComment(activeComment);\n if (!session) return error;\n const currentIndex = session.currentIndex;\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {\n const previousErrors = Array.isArray(acc.errors) ? acc.errors : [];\n const errors =\n previousErrors[previousErrors.length - 1] === error\n ? previousErrors\n : [...previousErrors, error];\n ac[currentIndex] = { ...acc, errors, error };\n }),\n );\n return error;\n };\n const reportActivePublishCommentError = (\n rawError: unknown,\n activeComment: any,\n publicationStopped: boolean,\n ) => {\n if (!getActiveSessionForComment(activeComment)) return;\n const error = recordPublishCommentError(rawError, activeComment);\n // pkc-js also emits errors it recovers from, e.g. a challenge it cannot decrypt, and keeps\n // processing the exchange, so only an error that stopped the publication ends the session\n if (publicationStopped) {\n queueCleanupFailedPublishSession(activeComment);\n }\n publishCommentOptions.onError?.(error, activeComment);\n };\n // the options onBeforeRepublish returns go through the same pipeline as the first publish; resolves\n // to false when the publish was abandoned while onBeforeRepublish ran\n const createRepublishCommentOptions = async (timestamp: number) => {\n const nextOptions = await publishCommentOptions.onBeforeRepublish({\n ...publicationOptions,\n timestamp,\n });\n if (isPublishSessionAbandoned(publishSessionId)) {\n return false;\n }\n assert(\n nextOptions && typeof nextOptions === \"object\",\n \"publishComment publishCommentOptions.onBeforeRepublish did not return an object\",\n );\n const nextPublicationOptions = omitPublishCommentCallbacks(nextOptions);\n validator.validateAccountsActionsPublishCommentArguments({\n publishCommentOptions: {\n ...nextPublicationOptions,\n onChallenge: publishCommentOptions.onChallenge,\n onChallengeVerification: publishCommentOptions.onChallengeVerification,\n },\n accountName,\n account,\n });\n let nextCreateCommentOptions = await createPublishCommentOptions(nextPublicationOptions);\n if (nextPublicationOptions.link) {\n nextCreateCommentOptions = {\n ...nextCreateCommentOptions,\n ...(await getCommentLinkDimensions(nextPublicationOptions.link)),\n };\n }\n // make sure the options dont throw\n await account.pkc.createComment(nextCreateCommentOptions);\n publicationOptions = nextPublicationOptions;\n createCommentOptions = nextCreateCommentOptions;\n createdAccountComment = createAccountComment(createCommentOptions, createdAccountComment.index);\n return true;\n };\n // the failed comment was detached for the republish, so its stopped/failed state events were ignored:\n // reattach it to end the publish with that state and the error, like any other publish error\n const failRepublish = (error: unknown, failedComment: any) => {\n const session = getPublishSession(publishSessionId);\n if (!session || isPublishSessionAbandoned(publishSessionId)) return;\n updatePublishSessionComment(publishSessionId, failedComment);\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, session.currentIndex, (ac, acc) => {\n ac[session.currentIndex] = { ...acc, state: \"stopped\", publishingState: \"failed\" };\n }),\n );\n publishCommentOptions.onPublishingStateChange?.(\"failed\");\n reportActivePublishCommentError(error, failedComment, true);\n };\n async function publishAndRetryFailedChallengeVerification() {\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n const activeComment = comment;\n updatePublishSessionComment(publishSessionId, activeComment);\n activeComment.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishCommentOptions.onChallenge(\n challenge,\n withPublishChallengeAnswersCompat(activeComment, challenge),\n );\n });\n activeComment.once(\n \"challengeverification\",\n async (challengeVerification: ChallengeVerification) => {\n applyChallengeVerificationCommentUpdateToPublication(challengeVerification, activeComment);\n publishCommentOptions.onChallengeVerification(challengeVerification, activeComment);\n // a verification with challengeErrors/reason is a terminal rejection of the publication\n // (e.g. stale wordfilter rules); republishing the same signed content would loop forever,\n // so fall through to the terminal path instead of retrying\n if (\n !challengeVerification.challengeSuccess &&\n lastChallenge &&\n !hasTerminalChallengeVerificationError(challengeVerification)\n ) {\n // publish again automatically on fail, unless the publish was abandoned meanwhile\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n const timestamp = Math.floor(Date.now() / 1000);\n updatePublishSessionComment(publishSessionId, undefined);\n if (publishCommentOptions.onBeforeRepublish) {\n try {\n if (!(await createRepublishCommentOptions(timestamp))) {\n return;\n }\n } catch (error) {\n failRepublish(error, activeComment);\n return;\n }\n } else {\n createCommentOptions = { ...createCommentOptions, timestamp };\n createdAccountComment = { ...createdAccountComment, timestamp };\n }\n await saveCreatedAccountComment(createdAccountComment);\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n comment = backfillPublicationCommunityAddress(\n await account.pkc.createComment(createCommentOptions),\n createCommentOptions,\n );\n syncCommentClientsSnapshot(publishSessionId, account.id, comment);\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n } else {\n // the challengeverification message of a comment publication should in theory send back the CID\n // of the published comment which is needed to resolve it for replies, upvotes, etc\n const session = getPublishSession(publishSessionId);\n if (!session || isPublishSessionAbandoned(publishSessionId)) return;\n const hasCid = !!challengeVerification?.commentUpdate?.cid;\n // once the publication's last state events ran, they and any later ones are ignored; with a\n // cid the session stays registered until the cid is saved, so a deleteComment meanwhile still\n // shifts or abandons its row\n queueMicrotask(() =>\n hasCid\n ? updatePublishSessionComment(publishSessionId, undefined)\n : cleanupPublishSessionOnTerminal(publishSessionId),\n );\n if (hasCid) {\n const persistedCommentWithCid = addShortAddressesToAccountComment(\n sanitizeStoredAccountComment(normalizePublicationOptionsForStore(comment as any)),\n );\n const liveCommentWithCid = addShortAddressesToAccountComment(\n sanitizeAccountCommentForState(normalizePublicationOptionsForStore(comment as any)),\n );\n delete (persistedCommentWithCid as any).clients;\n delete (persistedCommentWithCid as any).publishingState;\n delete (persistedCommentWithCid as any).error;\n delete (persistedCommentWithCid as any).errors;\n delete (liveCommentWithCid as any).clients;\n delete (liveCommentWithCid as any).publishingState;\n delete (liveCommentWithCid as any).error;\n delete (liveCommentWithCid as any).errors;\n let savedSession: PublishSession | undefined;\n try {\n await accountsDatabase.addAccountComment(\n account.id,\n persistedCommentWithCid,\n session.currentIndex,\n );\n savedSession = isPublishSessionAbandoned(publishSessionId)\n ? undefined\n : getPublishSession(publishSessionId);\n } finally {\n cleanupPublishSessionOnTerminal(publishSessionId);\n }\n // the comment was deleted during the save\n if (!savedSession) return;\n const currentIndex = savedSession.currentIndex;\n accountsStore.setState(\n ({ accountsComments, accountsCommentsIndexes, commentCidsToAccountsComments }) => {\n const updatedAccountComments = [...accountsComments[account.id]];\n const updatedAccountComment = {\n ...liveCommentWithCid,\n index: currentIndex,\n accountId: account.id,\n };\n updatedAccountComments[currentIndex] = updatedAccountComment;\n return {\n accountsComments: { ...accountsComments, [account.id]: updatedAccountComments },\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [account.id]: getAccountCommentsIndex(updatedAccountComments),\n },\n commentCidsToAccountsComments: {\n ...commentCidsToAccountsComments,\n [challengeVerification?.commentUpdate?.cid]: {\n accountId: account.id,\n accountCommentIndex: currentIndex,\n },\n },\n };\n },\n );\n\n // clone the comment or it bugs publishing callbacks\n const updatingComment = await account.pkc.createComment(\n normalizePublicationOptionsForPkc(account.pkc, { ...comment }),\n );\n applyChallengeVerificationCommentUpdateToPublication(\n challengeVerification,\n updatingComment,\n );\n accountsActionsInternal\n .startUpdatingAccountCommentOnCommentUpdateEvents(\n updatingComment,\n account,\n currentIndex,\n )\n .catch((error: unknown) =>\n log.error(\n \"accountsActions.publishComment startUpdatingAccountCommentOnCommentUpdateEvents error\",\n { comment, account, accountCommentIndex, error },\n ),\n );\n }\n }\n },\n );\n\n activeComment.on(\"error\", (error: Error) => {\n reportActivePublishCommentError(error, activeComment, activeComment.state === \"stopped\");\n });\n activeComment.on(\"statechange\", (state: string) => {\n const session = getActiveSessionForComment(activeComment);\n if (!session) return;\n const currentIndex = session.currentIndex;\n let hasTerminalFailedState = false;\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {\n const nextAccountComment = { ...acc, state };\n ac[currentIndex] = nextAccountComment;\n hasTerminalFailedState =\n nextAccountComment.state === \"stopped\" &&\n nextAccountComment.publishingState === \"failed\";\n }),\n );\n if (hasTerminalFailedState) {\n queueCleanupFailedPublishSession(activeComment);\n }\n });\n activeComment.on(\"publishingstatechange\", async (publishingState: string) => {\n const session = getActiveSessionForComment(activeComment);\n if (!session) return;\n const currentIndex = session.currentIndex;\n let hasTerminalFailedState = false;\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {\n const nextAccountComment = { ...acc, publishingState };\n ac[currentIndex] = nextAccountComment;\n hasTerminalFailedState =\n nextAccountComment.state === \"stopped\" &&\n nextAccountComment.publishingState === \"failed\";\n }),\n );\n if (hasTerminalFailedState) {\n queueCleanupFailedPublishSession(activeComment);\n }\n publishCommentOptions.onPublishingStateChange?.(publishingState);\n });\n\n // set clients on account comment so the frontend can display it, dont persist in db because a reload cancels publishing\n utils.clientsOnStateChange(\n activeComment.clients,\n (clientState: string, clientType: string, clientUrl: string, chainTicker?: string) => {\n const session = getActiveSessionForComment(activeComment);\n if (!session) return;\n const currentIndex = session.currentIndex;\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {\n const clients = getClientsSnapshotForState(activeComment.clients) || {};\n const client = { state: clientState };\n if (chainTicker) {\n const chainProviders = { ...clients[clientType][chainTicker], [clientUrl]: client };\n clients[clientType] = { ...clients[clientType], [chainTicker]: chainProviders };\n } else {\n clients[clientType] = { ...clients[clientType], [clientUrl]: client };\n }\n ac[currentIndex] = { ...acc, clients };\n }),\n );\n },\n );\n\n listeners.push(activeComment);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await activeComment.publish();\n } catch (error) {\n reportActivePublishCommentError(error, activeComment, true);\n }\n }\n\n return createdAccountComment;\n};\n\nexport const deleteComment = async (\n commentCidOrAccountCommentIndex: string | number,\n accountName?: string,\n) => {\n const {\n accounts,\n accountsComments,\n accountNamesToAccountIds,\n activeAccountId,\n commentCidsToAccountsComments,\n } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(account?.id, `accountsActions.deleteComment account.id '${account?.id}' doesn't exist`);\n const accountComments = accountsComments[account.id] || [];\n assert(accountComments.length > 0, `accountsActions.deleteComment no comments for account`);\n\n let accountCommentIndex: number;\n if (typeof commentCidOrAccountCommentIndex === \"number\") {\n accountCommentIndex = commentCidOrAccountCommentIndex;\n } else {\n const mapping = commentCidsToAccountsComments[commentCidOrAccountCommentIndex];\n assert(\n mapping && mapping.accountId === account.id,\n `accountsActions.deleteComment cid '${commentCidOrAccountCommentIndex}' not found for account`,\n );\n accountCommentIndex = mapping.accountCommentIndex;\n }\n await deleteAccountComment(account.id, accountCommentIndex);\n};\n\nconst deleteAccountComment = async (accountId: string, accountCommentIndex: number) => {\n const { accountsComments } = accountsStore.getState();\n const accountComments = accountsComments[accountId] || [];\n assert(\n accountCommentIndex >= 0 && accountCommentIndex < accountComments.length,\n `accountsActions.deleteComment index '${accountCommentIndex}' out of range`,\n );\n\n abandonAndStopPublishSession(accountId, accountCommentIndex);\n shiftPublishSessionIndicesAfterDelete(accountId, accountCommentIndex);\n\n const spliced = [...accountComments];\n spliced.splice(accountCommentIndex, 1);\n const reindexed = spliced.map((c, i) => ({ ...c, index: i, accountId }));\n const newAccountsComments = { ...accountsComments, [accountId]: reindexed };\n const newCommentCidsToAccountsComments = getCommentCidsToAccountsComments(newAccountsComments);\n\n accountsStore.setState(({ accountsCommentsIndexes }) => ({\n accountsComments: newAccountsComments,\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [accountId]: getAccountCommentsIndex(reindexed),\n },\n commentCidsToAccountsComments: newCommentCidsToAccountsComments,\n }));\n notifyShiftedPublishSessions(accountId, accountCommentIndex);\n\n await accountsDatabase.deleteAccountComment(accountId, accountCommentIndex);\n\n log(\"accountsActions.deleteComment\", { accountId, accountCommentIndex });\n};\n\n// deletes a comment that is still publishing from where its session has it now, in the account that\n// published it, so a deletion that shifted it or a change of the active account can't redirect it\nconst abandonPublishSession = async (sessionId: string) => {\n const session = getPublishSession(sessionId);\n if (!session || isPublishSessionAbandoned(sessionId)) return;\n await deleteAccountComment(session.accountId, session.currentIndex);\n};\n\nexport const publishVote = async (publishVoteOptions: PublishVoteOptions, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishVoteArguments({\n publishVoteOptions,\n accountName,\n account,\n });\n\n let createVoteOptions: any = normalizePublicationOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n author: account.author,\n signer: account.signer,\n ...publishVoteOptions,\n });\n delete createVoteOptions.onChallenge;\n delete createVoteOptions.onChallengeVerification;\n delete createVoteOptions.onError;\n delete createVoteOptions.onPublishingStateChange;\n delete createVoteOptions._onVotePublishSession;\n const { commentCid } = createVoteOptions;\n // started before the community's wordfilters load, so abandoning the vote meanwhile ends it\n const votePublishSession = startVotePublishSession(\n account.id,\n commentCid,\n accountsStore.getState().accountsVotes[account.id]?.[commentCid],\n );\n const votePublishSessionKey = getVotePublishSessionKey(account.id, commentCid);\n const isVotePublishSessionActive = () =>\n activeVotePublishSessions.get(votePublishSessionKey) === votePublishSession;\n // the hooks abandon this vote's session in the account that published it, whichever is active\n publishVoteOptions._onVotePublishSession?.(() =>\n abandonVotePublishSession(account.id, commentCid, votePublishSession),\n );\n // counted as a vote being created, so the rest of the burst can't end the session meanwhile\n votePublishSession.creating++;\n try {\n createVoteOptions = await applyPublicationWordfilters(\"vote\", createVoteOptions, account);\n } catch (error) {\n votePublishSession.creating--;\n if (\n votePublishSession.publications.size === 0 &&\n votePublishSession.creating === 0 &&\n isVotePublishSessionActive()\n ) {\n endVotePublishSession(account.id, commentCid);\n }\n throw error;\n }\n votePublishSession.creating--;\n // abandoned while the wordfilters loaded: nothing was published or written, so stop here\n if (!isVotePublishSessionActive()) return;\n // the account was deleted while the wordfilters loaded: nothing was published or written. Its\n // delete only abandoned the sessions that existed when it started, so end this one here\n if (isAccountDeleted(account.id)) {\n endVotePublishSession(account.id, commentCid);\n return;\n }\n const accountsState = accountsStore.getState();\n const accountCommentInfo =\n accountsState.commentCidsToAccountsComments[createVoteOptions.commentCid];\n const accountComment = accountCommentInfo\n ? accountsState.accountsComments[accountCommentInfo.accountId]?.[\n accountCommentInfo.accountCommentIndex\n ]\n : undefined;\n const previousAccountVote =\n accountsState.accountsVotes[account.id]?.[createVoteOptions.commentCid];\n const storedCreateVoteOptions = addOptimisticVoteMetadata(\n normalizePublicationOptionsForStore(createVoteOptions),\n previousAccountVote,\n getFreshestLoadedComment(createVoteOptions.commentCid, accountComment),\n );\n const accountVote: AccountVote = {\n ...storedCreateVoteOptions,\n // remove signer and author because not needed and they expose private key\n signer: undefined,\n author: undefined,\n };\n const createSessionVote = async () => {\n votePublishSession.creating++;\n try {\n return backfillPublicationCommunityAddress(\n await account.pkc.createVote(createVoteOptions),\n createVoteOptions,\n );\n } finally {\n votePublishSession.creating--;\n }\n };\n\n let resolveAccountVoteWritten!: () => void;\n const accountVoteWritten = new Promise<void>((resolve) => (resolveAccountVoteWritten = resolve));\n // a publication is verified, rejected by the community, or failed to publish: it is no longer\n // abandonable. The session ends only once no other publication of the burst is waiting on its\n // challenge or still being created, and only if a newer session has not replaced it in the\n // meantime; if one of them failed, the account vote goes back to the last one verified.\n const endVotePublication = async (endedVote: any, verified: boolean) => {\n // already ended, e.g. publish() rejecting after its error event\n if (!votePublishSession.publications.delete(endedVote)) return;\n if (verified) {\n // the verified vote is the one the account has now, so abandoning the rest of the burst\n // restores it instead of the vote from before the burst\n votePublishSession.previousAccountVote = accountVote;\n } else {\n votePublishSession.failed = true;\n }\n await endVotePublishSessionIfSettled();\n };\n const endVotePublishSessionIfSettled = async () => {\n if (\n votePublishSession.publications.size !== 0 ||\n votePublishSession.creating !== 0 ||\n !isVotePublishSessionActive()\n ) {\n return;\n }\n activeVotePublishSessions.delete(votePublishSessionKey);\n if (!votePublishSession.failed) return;\n try {\n // the optimistic write may still be running when the publication fails fast\n await accountVoteWritten;\n await restoreAccountVote(\n account.id,\n createVoteOptions.commentCid,\n votePublishSession.previousAccountVote,\n );\n } catch (error) {\n log.error(\"accountsActions.publishVote restore failed vote error\", { error });\n }\n };\n\n let vote = await createSessionVote().catch(async (error) => {\n // nothing was published or written for this vote, but an earlier vote of the burst may have\n // failed while it was being created and left the session for this one to end\n resolveAccountVoteWritten();\n await endVotePublishSessionIfSettled();\n throw error;\n });\n // abandoned while the vote was being created: nothing was published or written, so stop here\n if (!isVotePublishSessionActive()) return;\n let lastChallenge: Challenge | undefined;\n const publishAndRetryFailedChallengeVerification = async () => {\n const activeVote = vote;\n votePublishSession.publications.add(vote);\n vote.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishVoteOptions.onChallenge(challenge, withPublishChallengeAnswersCompat(vote, challenge));\n });\n vote.once(\"challengeverification\", async (challengeVerification: ChallengeVerification) => {\n publishVoteOptions.onChallengeVerification(challengeVerification, vote);\n // same terminal short-circuit as publishComment/publishCommentEdit: never retry a rejection\n if (\n !challengeVerification.challengeSuccess &&\n lastChallenge &&\n !hasTerminalChallengeVerificationError(challengeVerification)\n ) {\n // publish again automatically on fail\n votePublishSession.publications.delete(vote);\n createVoteOptions = { ...createVoteOptions, timestamp: Math.floor(Date.now() / 1000) };\n try {\n vote = await createSessionVote();\n } catch (error) {\n // no retry was published, so the failed vote ends the burst like a rejected one\n votePublishSession.failed = true;\n await endVotePublishSessionIfSettled();\n publishVoteOptions.onError?.(error, activeVote);\n return;\n }\n if (!isVotePublishSessionActive()) return;\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n } else {\n await endVotePublication(activeVote, challengeVerification.challengeSuccess);\n }\n });\n vote.on(\"error\", async (error: Error) => {\n // pkc-js also emits errors it recovers from, e.g. a challenge it cannot decrypt, and stops\n // the publication before emitting the ones that end it\n if (activeVote.state === \"stopped\") {\n await endVotePublication(activeVote, false);\n }\n publishVoteOptions.onError?.(error, vote);\n });\n // TODO: add publishingState to account votes\n vote.on(\"publishingstatechange\", (publishingState: string) =>\n publishVoteOptions.onPublishingStateChange?.(publishingState),\n );\n listeners.push(vote);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await vote.publish();\n } catch (error) {\n await endVotePublication(activeVote, false);\n publishVoteOptions.onError?.(error, vote);\n }\n };\n\n publishAndRetryFailedChallengeVerification();\n try {\n await accountsDatabase.addAccountVote(account.id, storedCreateVoteOptions);\n log(\"accountsActions.publishVote\", { createVoteOptions });\n accountsStore.setState(({ accountsVotes }) => ({\n accountsVotes: {\n ...accountsVotes,\n [account.id]: {\n ...accountsVotes[account.id],\n [storedCreateVoteOptions.commentCid]: accountVote,\n },\n },\n }));\n } finally {\n resolveAccountVoteWritten();\n }\n};\n\n/**\n * Stops the vote publications still waiting on a challenge for a comment and restores the account\n * vote they optimistically replaced. Does nothing once the vote has been verified.\n */\nexport const abandonVote = async (commentCid: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(account?.id, `accountsActions.abandonVote account.id '${account?.id}' doesn't exist`);\n assert(\n commentCid && typeof commentCid === \"string\",\n `accountsActions.abandonVote commentCid '${commentCid}' not a string`,\n );\n await abandonVotePublishSession(account.id, commentCid);\n};\n\n// with votePublishSession, abandons only that session, not a newer one for the same comment\nconst abandonVotePublishSession = async (\n accountId: string,\n commentCid: string,\n votePublishSession?: VotePublishSession,\n) => {\n const session = activeVotePublishSessions.get(getVotePublishSessionKey(accountId, commentCid));\n if (!session || (votePublishSession && session !== votePublishSession)) return;\n endVotePublishSession(accountId, commentCid);\n\n for (const publication of session.publications) {\n try {\n const stop = publication?.stop?.bind(publication);\n if (typeof stop === \"function\") await stop();\n } catch (e) {\n log.error(\"vote.stop() error during abandon\", {\n accountId,\n commentCid,\n error: e,\n });\n }\n }\n await restoreAccountVote(accountId, commentCid, session.previousAccountVote);\n log(\"accountsActions.abandonVote\", { accountId, commentCid });\n};\n\nexport const publishCommentEdit = async (\n publishCommentEditOptions: PublishCommentEditOptions,\n accountName?: string,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishCommentEditArguments({\n publishCommentEditOptions,\n accountName,\n account,\n });\n\n let createCommentEditOptions: any = normalizePublicationOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n author: account.author,\n signer: account.signer,\n ...publishCommentEditOptions,\n });\n delete createCommentEditOptions.onChallenge;\n delete createCommentEditOptions.onChallengeVerification;\n delete createCommentEditOptions.onError;\n delete createCommentEditOptions.onPublishingStateChange;\n createCommentEditOptions = await applyPublicationWordfilters(\n \"commentEdit\",\n createCommentEditOptions,\n account,\n );\n const storedCreateCommentEditOptions = {\n ...normalizePublicationOptionsForStore(createCommentEditOptions),\n clientId: uuid(),\n };\n const storedCommentEdit = sanitizeStoredAccountEdit(storedCreateCommentEditOptions);\n\n let commentEdit = backfillPublicationCommunityAddress(\n await account.pkc.createCommentEdit(createCommentEditOptions),\n createCommentEditOptions,\n );\n let lastChallenge: Challenge | undefined;\n let challengeSucceeded = false;\n let rollbackPendingEditPromise: Promise<void> | undefined;\n const rollbackStoredCommentEdit = () => {\n if (!rollbackPendingEditPromise && !challengeSucceeded) {\n rollbackPendingEditPromise = Promise.all([\n accountsDatabase.deleteAccountEdit(account.id, storedCommentEdit),\n Promise.resolve(\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = removeStoredAccountEditSummaryFromState(\n accountsEditsSummaries,\n accountsEdits,\n account.id,\n storedCommentEdit,\n );\n Object.assign(\n nextState,\n removeStoredAccountEditFromState(accountsEdits, account.id, storedCommentEdit),\n );\n return nextState;\n }),\n ),\n ]).then(() => {});\n }\n return rollbackPendingEditPromise;\n };\n\n await accountsDatabase.addAccountEdit(account.id, storedCreateCommentEditOptions);\n log(\"accountsActions.publishCommentEdit\", { createCommentEditOptions });\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = addStoredAccountEditSummaryToState(\n accountsEditsSummaries,\n account.id,\n storedCommentEdit,\n );\n Object.assign(\n nextState,\n addStoredAccountEditToState(accountsEdits, account.id, storedCommentEdit),\n );\n return nextState;\n });\n\n const publishAndRetryFailedChallengeVerification = async () => {\n commentEdit.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishCommentEditOptions.onChallenge(\n challenge,\n withPublishChallengeAnswersCompat(commentEdit, challenge),\n );\n });\n commentEdit.once(\n \"challengeverification\",\n async (challengeVerification: ChallengeVerification) => {\n publishCommentEditOptions.onChallengeVerification(challengeVerification, commentEdit);\n if (challengeVerification.challengeSuccess) {\n challengeSucceeded = true;\n }\n if (hasTerminalChallengeVerificationError(challengeVerification)) {\n lastChallenge = undefined;\n await rollbackStoredCommentEdit();\n return;\n }\n if (!challengeVerification.challengeSuccess && lastChallenge) {\n // publish again automatically on fail\n createCommentEditOptions = {\n ...createCommentEditOptions,\n timestamp: Math.floor(Date.now() / 1000),\n };\n commentEdit = backfillPublicationCommunityAddress(\n await account.pkc.createCommentEdit(createCommentEditOptions),\n createCommentEditOptions,\n );\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n }\n },\n );\n commentEdit.on(\"error\", async (error: Error) => {\n await rollbackStoredCommentEdit();\n publishCommentEditOptions.onError?.(error, commentEdit);\n });\n // TODO: add publishingState to account edits\n commentEdit.on(\"publishingstatechange\", (publishingState: string) =>\n publishCommentEditOptions.onPublishingStateChange?.(publishingState),\n );\n listeners.push(commentEdit);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await commentEdit.publish();\n } catch (error) {\n await rollbackStoredCommentEdit();\n publishCommentEditOptions.onError?.(error, commentEdit);\n }\n };\n\n publishAndRetryFailedChallengeVerification();\n};\n\nexport const publishCommentModeration = async (\n publishCommentModerationOptions: PublishCommentModerationOptions,\n accountName?: string,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishCommentModerationArguments({\n publishCommentModerationOptions,\n accountName,\n account,\n });\n\n let createCommentModerationOptions: any = normalizePublicationOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n author: account.author,\n signer: account.signer,\n ...publishCommentModerationOptions,\n });\n delete createCommentModerationOptions.onChallenge;\n delete createCommentModerationOptions.onChallengeVerification;\n delete createCommentModerationOptions.onError;\n delete createCommentModerationOptions.onPublishingStateChange;\n createCommentModerationOptions = await applyPublicationWordfilters(\n \"commentModeration\",\n createCommentModerationOptions,\n account,\n );\n const storedCreateCommentModerationOptions = {\n ...normalizePublicationOptionsForStore(createCommentModerationOptions),\n clientId: uuid(),\n };\n const storedCommentModeration = sanitizeStoredAccountEdit(storedCreateCommentModerationOptions);\n\n let commentModeration = backfillPublicationCommunityAddress(\n await account.pkc.createCommentModeration(createCommentModerationOptions),\n createCommentModerationOptions,\n );\n let lastChallenge: Challenge | undefined;\n let challengeSucceeded = false;\n let storedCommentModerationAdded = false;\n let rollbackStoredCommentModerationRequested = false;\n let rollbackPendingEditPromise: Promise<void> | undefined;\n const rollbackStoredCommentModeration = () => {\n rollbackStoredCommentModerationRequested = true;\n if (!storedCommentModerationAdded) {\n return Promise.resolve();\n }\n if (!rollbackPendingEditPromise && !challengeSucceeded) {\n rollbackPendingEditPromise = Promise.all([\n accountsDatabase.deleteAccountEdit(account.id, storedCommentModeration),\n Promise.resolve(\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = removeStoredAccountEditSummaryFromState(\n accountsEditsSummaries,\n accountsEdits,\n account.id,\n storedCommentModeration,\n );\n Object.assign(\n nextState,\n removeStoredAccountEditFromState(accountsEdits, account.id, storedCommentModeration),\n );\n return nextState;\n }),\n ),\n ]).then(() => {});\n }\n return rollbackPendingEditPromise || Promise.resolve();\n };\n\n const publishAndRetryFailedChallengeVerification = async () => {\n commentModeration.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishCommentModerationOptions.onChallenge(\n challenge,\n withPublishChallengeAnswersCompat(commentModeration, challenge),\n );\n });\n commentModeration.once(\n \"challengeverification\",\n async (challengeVerification: ChallengeVerification) => {\n publishCommentModerationOptions.onChallengeVerification(\n challengeVerification,\n commentModeration,\n );\n if (challengeVerification.challengeSuccess) {\n challengeSucceeded = true;\n }\n if (hasTerminalChallengeVerificationError(challengeVerification)) {\n lastChallenge = undefined;\n await rollbackStoredCommentModeration();\n return;\n }\n if (!challengeVerification.challengeSuccess && lastChallenge) {\n // publish again automatically on fail\n createCommentModerationOptions = {\n ...createCommentModerationOptions,\n timestamp: Math.floor(Date.now() / 1000),\n };\n commentModeration = backfillPublicationCommunityAddress(\n await account.pkc.createCommentModeration(createCommentModerationOptions),\n createCommentModerationOptions,\n );\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n }\n },\n );\n commentModeration.on(\"error\", async (error: Error) => {\n await rollbackStoredCommentModeration();\n publishCommentModerationOptions.onError?.(error, commentModeration);\n });\n // TODO: add publishingState to account edits\n commentModeration.on(\"publishingstatechange\", (publishingState: string) =>\n publishCommentModerationOptions.onPublishingStateChange?.(publishingState),\n );\n listeners.push(commentModeration);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await commentModeration.publish();\n } catch (error) {\n await rollbackStoredCommentModeration();\n publishCommentModerationOptions.onError?.(error, commentModeration);\n }\n };\n\n publishAndRetryFailedChallengeVerification();\n\n await accountsDatabase.addAccountEdit(account.id, storedCreateCommentModerationOptions);\n log(\"accountsActions.publishCommentModeration\", { createCommentModerationOptions });\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = addStoredAccountEditSummaryToState(\n accountsEditsSummaries,\n account.id,\n storedCommentModeration,\n );\n Object.assign(\n nextState,\n addStoredAccountEditToState(accountsEdits, account.id, storedCommentModeration),\n );\n return nextState;\n });\n storedCommentModerationAdded = true;\n if (rollbackStoredCommentModerationRequested) {\n await rollbackStoredCommentModeration();\n }\n};\n\nexport const publishCommunityEdit = async (\n communityAddress: string,\n publishCommunityEditOptions: PublishCommunityEditOptions,\n accountName?: string,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishCommunityEditArguments({\n communityAddress,\n publishCommunityEditOptions,\n accountName,\n account,\n });\n\n const communityEditOptions = { ...publishCommunityEditOptions };\n delete communityEditOptions.onChallenge;\n delete communityEditOptions.onChallengeVerification;\n delete communityEditOptions.onError;\n delete communityEditOptions.onPublishingStateChange;\n let createCommunityEditOptions: any = normalizeCommunityEditOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n author: account.author,\n signer: account.signer,\n // the current address, a new address is in communityEdit.address, which the hosting node only\n // accepts from the owner\n communityAddress,\n communityEdit: communityEditOptions,\n });\n createCommunityEditOptions = await applyPublicationWordfilters(\n \"communityEdit\",\n createCommunityEditOptions,\n account,\n );\n const storedCreateCommunityEditOptions = {\n ...normalizePublicationOptionsForStore(createCommunityEditOptions),\n clientId: uuid(),\n };\n const storedCommunityEdit = sanitizeStoredAccountEdit(storedCreateCommunityEditOptions);\n let challengeSucceeded = false;\n let rollbackPendingEditPromise: Promise<void> | undefined;\n const rollbackStoredCommunityEdit = () => {\n if (!rollbackPendingEditPromise && !challengeSucceeded) {\n rollbackPendingEditPromise = Promise.all([\n accountsDatabase.deleteAccountEdit(account.id, storedCommunityEdit),\n Promise.resolve(\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = removeStoredAccountEditSummaryFromState(\n accountsEditsSummaries,\n accountsEdits,\n account.id,\n storedCommunityEdit,\n );\n Object.assign(\n nextState,\n removeStoredAccountEditFromState(accountsEdits, account.id, storedCommunityEdit),\n );\n return nextState;\n }),\n ),\n ]).then(() => {});\n }\n return rollbackPendingEditPromise;\n };\n const storePublishedCommunityEdit = async () => {\n await accountsDatabase.addAccountEdit(account.id, storedCreateCommunityEditOptions);\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = addStoredAccountEditSummaryToState(\n accountsEditsSummaries,\n account.id,\n storedCommunityEdit,\n );\n Object.assign(\n nextState,\n addStoredAccountEditToState(accountsEdits, account.id, storedCommunityEdit),\n );\n return nextState;\n });\n };\n\n // the connected pkc instance hosts the community and can edit it locally, no need to publish\n if (pkcHostsCommunity(account, communityAddress)) {\n // use the wordfiltered edit so the applied community state matches the stored account edit\n await communitiesStore\n .getState()\n .editCommunity(communityAddress, createCommunityEditOptions.communityEdit, account);\n await storePublishedCommunityEdit();\n // create fake success challenge verification for consistent behavior with remote community edit\n publishCommunityEditOptions.onChallengeVerification({ challengeSuccess: true });\n publishCommunityEditOptions.onPublishingStateChange?.(\"succeeded\");\n return;\n }\n\n let communityEdit = backfillPublicationCommunityAddress(\n await createPkcCommunityEdit(account.pkc, createCommunityEditOptions),\n createCommunityEditOptions,\n );\n let lastChallenge: Challenge | undefined;\n const publishAndRetryFailedChallengeVerification = async () => {\n communityEdit.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishCommunityEditOptions.onChallenge(\n challenge,\n withPublishChallengeAnswersCompat(communityEdit, challenge),\n );\n });\n communityEdit.once(\n \"challengeverification\",\n async (challengeVerification: ChallengeVerification) => {\n publishCommunityEditOptions.onChallengeVerification(challengeVerification, communityEdit);\n if (challengeVerification.challengeSuccess) {\n challengeSucceeded = true;\n }\n if (hasTerminalChallengeVerificationError(challengeVerification)) {\n lastChallenge = undefined;\n await rollbackStoredCommunityEdit();\n return;\n }\n if (!challengeVerification.challengeSuccess && lastChallenge) {\n // publish again automatically on fail\n createCommunityEditOptions = {\n ...createCommunityEditOptions,\n timestamp: Math.floor(Date.now() / 1000),\n };\n communityEdit = backfillPublicationCommunityAddress(\n await createPkcCommunityEdit(account.pkc, createCommunityEditOptions),\n createCommunityEditOptions,\n );\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n }\n },\n );\n communityEdit.on(\"error\", async (error: Error) => {\n await rollbackStoredCommunityEdit();\n publishCommunityEditOptions.onError?.(error, communityEdit);\n });\n // TODO: add publishingState to account edits\n communityEdit.on(\"publishingstatechange\", (publishingState: string) =>\n publishCommunityEditOptions.onPublishingStateChange?.(publishingState),\n );\n listeners.push(communityEdit);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await communityEdit.publish();\n } catch (error) {\n await rollbackStoredCommunityEdit();\n publishCommunityEditOptions.onError?.(error, communityEdit);\n }\n };\n\n await storePublishedCommunityEdit();\n publishAndRetryFailedChallengeVerification();\n log(\"accountsActions.publishCommunityEdit\", { createCommunityEditOptions });\n};\n\nexport const createCommunity = async (\n createCommunityOptions: CreateCommunityOptions,\n accountName?: string,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountsActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsCreateCommunityArguments(createCommunityOptions);\n\n const community = await communitiesStore\n .getState()\n .createCommunity(createCommunityOptions, account);\n log(\"accountsActions.createCommunity\", { createCommunityOptions, community });\n return community;\n};\n\nexport const deleteCommunity = async (communityAddress: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountsActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n\n // read the other identifiers of the community (name, public key) before the store forgets them\n const deletedCommunity = communitiesStore.getState().communities[communityAddress];\n await communitiesStore.getState().deleteCommunity(communityAddress, account);\n\n // remove the deleted community from the deleting account's stored communities, under every\n // address it is known by, or useAccountCommunities keeps listing it. Other local accounts keep\n // their entry: they did not delete the community\n const isDeletedCommunity = (accountCommunityAddress: string) =>\n doesAddressMatchCommunityRef(\n accountCommunityAddress,\n { address: communityAddress },\n deletedCommunity,\n );\n // a saveComment still writing has the database ahead of the store: let it merge first, or the\n // store snapshot written below drops its saved comment\n while (savedCommentMutationQueues.has(account.id)) {\n await savedCommentMutationQueues.get(account.id)?.catch(() => {});\n }\n // the account was deleted while the community was: writing it would restore its record\n if (isAccountDeleted(account.id)) {\n return;\n }\n let updatedAccount: Account | undefined;\n accountsStore.setState(({ accounts }) => {\n const currentAccount = accounts[account.id];\n const addressesToRemove = Object.keys(currentAccount?.communities || {}).filter(\n isDeletedCommunity,\n );\n if (!addressesToRemove.length) {\n return {};\n }\n const communities = { ...currentAccount.communities };\n for (const address of addressesToRemove) {\n delete communities[address];\n }\n updatedAccount = { ...currentAccount, communities };\n return { accounts: { ...accounts, [account.id]: updatedAccount } };\n });\n if (updatedAccount) {\n await accountsDatabase.addAccount(updatedAccount);\n }\n log(\"accountsActions.deleteCommunity\", { communityAddress });\n};\n"]}
|
|
1
|
+
{"version":3,"file":"accounts-actions.js","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions.ts"],"names":[],"mappings":"AAAA,sDAAsD;;;;;;;;;;;;;;;;;;;;;AAEtD,OAAO,aAAa,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,gBAAgB,EAAE,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,MAAM,GAAG,GAAG,MAAM,CAAC,uCAAuC,CAAC,CAAC;AAmB5D,OAAO,KAAK,uBAAuB,MAAM,6BAA6B,CAAC;AACvE,OAAO,EACL,mCAAmC,EACnC,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EAC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AAQ,cAAc,KAAE,WAAW,GAAE,CAAC;QACpD,OAAO,EAAE,QAAQ,kCAAO,QAAQ,KAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,cAAc,GAAE,EAAE,CAAC;IACrE,CAAC,CAAC,CAAC;IACH,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,gBAAgB,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IACpD,CAAC;IACD,GAAG,CAAC,iCAAiC,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAA,CAAC","sourcesContent":["// public accounts actions that are called by the user\n\nimport accountsStore, { listeners } from \"./accounts-store\";\nimport communitiesStore, { isRetriableCommunityLoadError } from \"../communities\";\nimport accountsDatabase from \"./accounts-database\";\nimport accountGenerator from \"./account-generator\";\nimport Logger from \"@pkcprotocol/pkc-logger\";\nimport validator from \"../../lib/validator\";\nimport chain from \"../../lib/chain\";\nimport assert from \"../../lib/assert\";\nconst log = Logger(\"bitsocial-react-hooks:accounts:stores\");\nimport {\n Account,\n Accounts,\n PublishCommentOptions,\n Challenge,\n ChallengeVerification,\n PublishVoteOptions,\n PublishCommentEditOptions,\n PublishCommentModerationOptions,\n PublishCommunityEditOptions,\n CreateCommunityOptions,\n ExportCommunityOptions,\n CommunityExport,\n Communities,\n AccountComment,\n AccountVote,\n PublishErrorInfo,\n} from \"../../types\";\nimport * as accountsActionsInternal from \"./accounts-actions-internal\";\nimport {\n backfillPublicationCommunityAddress,\n createPkcCommunity,\n createPkcCommunityEdit,\n getPkcCommunityAddresses,\n normalizeCommunityEditOptionsForPkc,\n normalizePublicationOptionsForStore,\n normalizePublicationOptionsForPkc,\n withPublishChallengeAnswersCompat,\n} from \"../../lib/pkc-compat\";\nimport {\n getAccountCommentsIndex,\n getAccountCommunities,\n getCommentCidsToAccountsComments,\n getAccountsCommentsIndexes,\n COMMENT_MODERATION_AUTHOR_SUMMARY_KEY,\n getAccountEditPropertySummary,\n fetchCommentLinkDimensions,\n getAccountCommentDepth,\n getAccountCommentPostCid,\n addShortAddressesToAccountComment,\n sanitizeAccountCommentForState,\n sanitizeStoredAccountComment,\n getFreshestLoadedComment,\n getInitAccountCommentsToUpdate,\n} from \"./utils\";\nimport isEqual from \"../../lib/is-equal\";\nimport { v4 as uuid } from \"uuid\";\nimport utils from \"../../lib/utils\";\nimport { addOptimisticVoteMetadata } from \"../../lib/utils/optimistic-vote-counts\";\nimport { applyCommunityWordfilters } from \"../../lib/wordfilters\";\nimport { doesAddressMatchCommunityRef } from \"../../lib/community-ref\";\n\nconst getAccountCommentByCid = (commentCid?: string) => {\n const { commentCidsToAccountsComments, accountsComments } = accountsStore.getState();\n const accountCommentInfo = commentCid ? commentCidsToAccountsComments[commentCid] : undefined;\n return accountCommentInfo\n ? accountsComments[accountCommentInfo.accountId]?.[accountCommentInfo.accountCommentIndex]\n : undefined;\n};\n\nconst PUBLICATION_COMMUNITY_LOAD_TIMEOUT_MS = 30_000;\nconst COMMENT_AUTHOR_LOAD_TIMEOUT_MS = 10_000;\n\nconst communityHasPublicationConfig = (community: any) =>\n community &&\n (typeof community.updatedAt === \"number\" ||\n Object.prototype.hasOwnProperty.call(community, \"challenges\"));\n\nconst findLoadedPublicationCommunity = (communityAddress: string) => {\n const communities = communitiesStore.getState().communities;\n return Object.values(communities).find(\n (community: any) =>\n communityHasPublicationConfig(community) &&\n [community.address, community.name, community.publicKey].includes(communityAddress),\n );\n};\n\nconst loadPublicationCommunity = async (communityAddress: string, account: Account) => {\n const loadedCommunity = findLoadedPublicationCommunity(communityAddress);\n if (loadedCommunity) return loadedCommunity;\n\n const community = await createPkcCommunity(account.pkc, { address: communityAddress });\n try {\n if (communityHasPublicationConfig(community)) return community;\n\n return await new Promise<any>((resolve, reject) => {\n let settled = false;\n let timeout: ReturnType<typeof setTimeout>;\n const cleanup = () => {\n clearTimeout(timeout);\n community.removeListener?.(\"update\", onUpdate);\n community.removeListener?.(\"error\", onError);\n };\n const onUpdate = (updatedCommunity: any) => {\n if (settled) return;\n settled = true;\n cleanup();\n resolve(updatedCommunity || community);\n };\n const onError = (error: Error) => {\n if (settled) return;\n // pkc-js emits an error on every failed fetch attempt while it keeps retrying;\n // keep waiting for a later update and only fail on non-retriable errors or the timeout\n if (isRetriableCommunityLoadError(error)) return;\n settled = true;\n cleanup();\n reject(error);\n };\n timeout = setTimeout(\n () =>\n onError(\n new Error(`timed out loading challenge settings for community '${communityAddress}'`),\n ),\n PUBLICATION_COMMUNITY_LOAD_TIMEOUT_MS,\n );\n community.once(\"update\", onUpdate);\n community.on(\"error\", onError);\n void Promise.resolve()\n .then(() => community.update())\n .then(() => {\n if (communityHasPublicationConfig(community)) onUpdate(community);\n }, onError);\n });\n } finally {\n await community.stop?.();\n }\n};\n\nconst loadCommentAuthorAddress = async (\n account: Account,\n commentCid: string,\n): Promise<string | undefined> => {\n const abortController = new AbortController();\n const timeout = setTimeout(() => abortController.abort(), COMMENT_AUTHOR_LOAD_TIMEOUT_MS);\n try {\n const comment = await account.pkc.getComment({\n cid: commentCid,\n abortSignal: abortController.signal,\n });\n return comment?.author?.address;\n } catch (error) {\n log.error(\"accountsActions.loadCommentAuthorAddress error\", { commentCid, error });\n } finally {\n clearTimeout(timeout);\n }\n};\n\nconst applyPublicationWordfilters = async <T extends Record<string, any>>(\n publicationType: string,\n options: T,\n account: Account,\n) => {\n const communityAddress = options.communityAddress;\n if (typeof communityAddress !== \"string\" || !communityAddress) return options;\n const community = await loadPublicationCommunity(communityAddress, account);\n return applyCommunityWordfilters(publicationType, options, community?.challenges);\n};\n\ntype PublishSession = {\n accountId: string;\n originalIndex: number;\n currentIndex: number;\n comment?: any;\n // called with currentIndex after a deletion of an earlier account comment shifted it\n onIndexChange?: (index: number) => void;\n};\n\n// Active publish-session tracking for pending comments (Task 3)\nconst activePublishSessions = new Map<string, PublishSession>();\nconst abandonedPublishSessionIds = new Set<string>();\n\ntype VotePublishSession = {\n // the account vote restored when the burst is abandoned or one of its publications failed: the one\n // the first publication replaced, or the latest verified vote of the burst\n previousAccountVote: AccountVote | undefined;\n publications: Set<any>;\n // votes still waiting on account.pkc.createVote(), they join publications once it resolves\n creating: number;\n // a publication of the burst was rejected or failed to publish, so the session restores\n // previousAccountVote when it ends\n failed?: boolean;\n};\n\n// A vote has no pending account comment to delete, so abandoning one restores the account vote that\n// the optimistic write in publishVote replaced. Keyed per comment because that is what the caller\n// abandons, and because rapid votes on the same comment share one revert target.\nconst activeVotePublishSessions = new Map<string, VotePublishSession>();\n\nconst getVotePublishSessionKey = (accountId: string, commentCid: string) =>\n `${accountId}:${commentCid}`;\n\nconst getClientsSnapshotForState = (clients: any): any => {\n if (!clients || typeof clients !== \"object\") {\n return undefined;\n }\n if (typeof clients.on === \"function\" || \"state\" in clients) {\n return { state: clients.state };\n }\n\n const snapshot: Record<string, any> = {};\n for (const key in clients) {\n const childSnapshot = getClientsSnapshotForState(clients[key]);\n if (childSnapshot !== undefined) {\n snapshot[key] = childSnapshot;\n }\n }\n return Object.keys(snapshot).length > 0 ? snapshot : undefined;\n};\n\nconst unsafeCommentUpdatePropertyNames = new Set([\"__proto__\", \"constructor\", \"prototype\"]);\n// commentUpdate.signature is the community's signature over the update, not the comment's own\n// signature, which pkc-js keeps on the publication (and which a pseudonymous community re-signs).\nconst commentOwnedCommentUpdatePropertyNames = new Set([\"signature\"]);\n\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n !!value && typeof value === \"object\" && !Array.isArray(value);\n\nconst applyChallengeVerificationCommentUpdateToPublication = (\n challengeVerification: ChallengeVerification | undefined,\n publication: Record<string, any> | undefined,\n) => {\n const commentUpdate = challengeVerification?.commentUpdate;\n if (\n !commentUpdate ||\n typeof commentUpdate !== \"object\" ||\n Array.isArray(commentUpdate) ||\n !publication ||\n typeof publication !== \"object\"\n ) {\n return;\n }\n\n for (const key of Object.keys(commentUpdate)) {\n if (\n unsafeCommentUpdatePropertyNames.has(key) ||\n commentOwnedCommentUpdatePropertyNames.has(key)\n ) {\n continue;\n }\n // commentUpdate.author only carries community-side fields such as author.community, so merge\n // it like pkc-js does. Replacing it drops the published author address, which in a pseudonymous\n // community is the community-assigned alias, not the account address.\n if (\n key === \"author\" &&\n isPlainObject(publication.author) &&\n isPlainObject(commentUpdate.author)\n ) {\n publication.author = { ...publication.author, ...commentUpdate.author };\n continue;\n }\n publication[key] = commentUpdate[key];\n }\n};\n\nconst syncCommentClientsSnapshot = (\n publishSessionId: string,\n accountId: string,\n publication: any,\n) => {\n const session = getPublishSession(publishSessionId);\n if (session?.currentIndex === undefined) {\n return;\n }\n\n const snapshot = getClientsSnapshotForState(publication?.clients);\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, accountId, session.currentIndex, (ac, acc) => {\n const updatedAccountComment = { ...acc };\n if (snapshot === undefined) {\n delete updatedAccountComment.clients;\n } else {\n updatedAccountComment.clients = snapshot;\n }\n ac[session.currentIndex] = updatedAccountComment;\n }),\n );\n};\n\n// only a community hosted by the connected pkc instance can be edited with community.edit(), for any\n// other community pkc.createCommunity() returns a remote instance whose edit() throws. owner roles and\n// cached signers don't prove hosting, e.g. an owner using a client that doesn't host the community\n// must publish a CommunityEdit over pubsub, which the hosting node accepts from owners\nconst pkcHostsCommunity = (account: Account, communityAddress: string) =>\n getPkcCommunityAddresses(account.pkc).includes(communityAddress);\n\nconst createPublishSession = (accountId: string, index: number) => {\n const sessionId = uuid();\n activePublishSessions.set(sessionId, {\n accountId,\n originalIndex: index,\n currentIndex: index,\n });\n return sessionId;\n};\n\n// A pending comment takes the next row of its account's live comment list, so the first saves of\n// an account's pending comments run one at a time: two overlapping publishComment calls that read\n// the length before either saved its row would get the same index and overwrite each other.\nconst accountCommentAppendQueues = new Map<string, Promise<unknown>>();\nconst queueAccountCommentAppend = <T>(accountId: string, append: () => Promise<T>) => {\n const previousAppend = accountCommentAppendQueues.get(accountId) || Promise.resolve();\n const queuedAppend = previousAppend.catch(() => {}).then(append);\n accountCommentAppendQueues.set(accountId, queuedAppend);\n return queuedAppend.finally(() => {\n if (accountCommentAppendQueues.get(accountId) === queuedAppend) {\n accountCommentAppendQueues.delete(accountId);\n }\n });\n};\n\nconst updatePublishSessionComment = (sessionId: string, comment?: any) => {\n const session = activePublishSessions.get(sessionId);\n if (!session) {\n return;\n }\n activePublishSessions.set(sessionId, { ...session, comment });\n};\n\nconst abandonAndStopPublishSession = (accountId: string, index: number) => {\n const session = getPublishSessionByCurrentIndex(accountId, index);\n if (!session) return;\n abandonedPublishSessionIds.add(session.sessionId);\n try {\n const stop = session.comment?.stop?.bind(session.comment);\n if (typeof stop === \"function\") stop();\n } catch (e) {\n log.error(\"comment.stop() error during abandon\", { accountId, index, error: e });\n }\n activePublishSessions.delete(session.sessionId);\n};\n\n// deleteAccount only abandons the publish sessions that exist when it starts, so a publication that\n// reaches its first save later checks that its account is still there\nconst deletingAccountIds = new Set<string>();\nconst isAccountDeleted = (accountId: string) =>\n deletingAccountIds.has(accountId) || !accountsStore.getState().accounts?.[accountId];\n\n// a deleted account's pending comments and votes would otherwise keep publishing and write their\n// results for an account that no longer exists\nconst abandonAccountPublishSessions = (accountId: string) => {\n for (const session of activePublishSessions.values()) {\n if (session.accountId === accountId) {\n abandonAndStopPublishSession(accountId, session.currentIndex);\n }\n }\n const votePublishSessionKeyPrefix = getVotePublishSessionKey(accountId, \"\");\n for (const [key, session] of activeVotePublishSessions) {\n if (!key.startsWith(votePublishSessionKeyPrefix)) continue;\n activeVotePublishSessions.delete(key);\n for (const publication of session.publications) {\n Promise.resolve()\n .then(() => publication?.stop?.())\n .catch((error) =>\n log.error(\"vote.stop() error during account delete\", { accountId, error }),\n );\n }\n }\n};\n\nconst startVotePublishSession = (\n accountId: string,\n commentCid: string,\n previousAccountVote: AccountVote | undefined,\n) => {\n const key = getVotePublishSessionKey(accountId, commentCid);\n const session = activeVotePublishSessions.get(key);\n // a retry or a rapid second vote joins the running session so the revert target stays the vote the\n // user had before any of them was published\n if (session) return session;\n const startedSession: VotePublishSession = {\n previousAccountVote,\n publications: new Set(),\n creating: 0,\n };\n activeVotePublishSessions.set(key, startedSession);\n return startedSession;\n};\n\nconst endVotePublishSession = (accountId: string, commentCid: string) => {\n activeVotePublishSessions.delete(getVotePublishSessionKey(accountId, commentCid));\n};\n\nconst restoreAccountVote = async (\n accountId: string,\n commentCid: string,\n previousAccountVote: AccountVote | undefined,\n) => {\n const currentAccountVote = accountsStore.getState().accountsVotes[accountId]?.[commentCid];\n // nothing was written optimistically, so there is nothing to restore\n if (currentAccountVote === previousAccountVote) return;\n // the account votes database only appends, so a comment with no earlier vote is restored to an\n // explicit neutral vote rather than by deleting the abandoned one\n const restoredAccountVote: AccountVote = previousAccountVote ?? {\n commentCid,\n vote: 0,\n timestamp: Math.floor(Date.now() / 1000),\n };\n await accountsDatabase.addAccountVote(accountId, restoredAccountVote);\n accountsStore.setState(({ accountsVotes }) => ({\n accountsVotes: {\n ...accountsVotes,\n [accountId]: { ...accountsVotes[accountId], [commentCid]: restoredAccountVote },\n },\n }));\n};\n\nconst isPublishSessionAbandoned = (sessionId: string) => abandonedPublishSessionIds.has(sessionId);\n\nconst getPublishSession = (sessionId: string) => activePublishSessions.get(sessionId);\n\n/** Returns state update or {} when accountComment not yet in state (no-op). Exported for coverage. */\nexport const maybeUpdateAccountComment = (\n accountsComments: Record<string, any[]>,\n accountId: string,\n index: number,\n updater: (accountComments: any[], accountComment: any) => void,\n) => {\n const accountComments = [...(accountsComments[accountId] || [])];\n const accountComment = accountComments[index];\n if (!accountComment) return {};\n updater(accountComments, accountComment);\n return { accountsComments: { ...accountsComments, [accountId]: accountComments } };\n};\n\nconst getPublishSessionByCurrentIndex = (\n accountId: string,\n index: number,\n): ({ sessionId: string } & PublishSession) | undefined => {\n for (const [key, session] of activePublishSessions) {\n if (session.accountId === accountId && session.currentIndex === index) {\n return { sessionId: key, ...session };\n }\n }\n return undefined;\n};\n\nconst shiftPublishSessionIndicesAfterDelete = (accountId: string, deletedIndex: number) => {\n for (const session of activePublishSessions.values()) {\n if (session.accountId === accountId && session.currentIndex > deletedIndex) {\n session.currentIndex -= 1;\n }\n }\n};\n\n// the sessions shifted by a deletion are the ones now at or after the deleted index\nconst notifyShiftedPublishSessions = (accountId: string, deletedIndex: number) => {\n for (const session of activePublishSessions.values()) {\n if (session.accountId === accountId && session.currentIndex >= deletedIndex) {\n session.onIndexChange?.(session.currentIndex);\n }\n }\n};\n\nconst cleanupPublishSessionOnTerminal = (sessionId: string) => {\n activePublishSessions.delete(sessionId);\n abandonedPublishSessionIds.delete(sessionId);\n};\n\nexport const doesStoredAccountEditMatch = (storedAccountEdit: any, targetStoredAccountEdit: any) =>\n storedAccountEdit?.clientId && targetStoredAccountEdit?.clientId\n ? storedAccountEdit.clientId === targetStoredAccountEdit.clientId\n : isEqual(storedAccountEdit, targetStoredAccountEdit);\n\nexport const sanitizeStoredAccountEdit = (storedAccountEdit: any) => {\n const sanitizedStoredAccountEdit = { ...storedAccountEdit };\n delete sanitizedStoredAccountEdit.signer;\n delete sanitizedStoredAccountEdit.author;\n return sanitizedStoredAccountEdit;\n};\n\nconst accountEditNonPropertyNames = new Set([\n \"author\",\n \"signer\",\n \"clientId\",\n \"commentCid\",\n \"communityAddress\",\n \"communityAddress\",\n \"communityEdit\",\n \"communityEdit\",\n \"timestamp\",\n]);\n\nconst normalizeStoredAccountEditForSummary = (storedAccountEdit: any) => {\n const normalizedEdit = { ...storedAccountEdit };\n const commentModeration = normalizedEdit.commentModeration;\n if (commentModeration && typeof commentModeration === \"object\") {\n const { author, ...commentModerationProperties } = commentModeration;\n Object.assign(normalizedEdit, commentModerationProperties);\n if (Object.prototype.hasOwnProperty.call(commentModeration, \"author\")) {\n normalizedEdit[COMMENT_MODERATION_AUTHOR_SUMMARY_KEY] = author;\n }\n normalizedEdit.commentModeration = undefined;\n }\n const communityEdit = normalizedEdit.communityEdit ?? normalizedEdit.communityEdit;\n if (communityEdit && typeof communityEdit === \"object\") {\n Object.assign(normalizedEdit, communityEdit);\n }\n delete normalizedEdit.communityEdit;\n delete normalizedEdit.communityEdit;\n return normalizedEdit;\n};\n\nconst getStoredAccountEditTarget = (storedAccountEdit: any) =>\n storedAccountEdit.commentCid ||\n storedAccountEdit.communityAddress ||\n storedAccountEdit.communityAddress;\n\nexport const addStoredAccountEditSummaryToState = (\n accountsEditsSummaries: Record<string, Record<string, any>>,\n accountId: string,\n storedAccountEdit: any,\n) => {\n const editTarget = getStoredAccountEditTarget(storedAccountEdit);\n if (!editTarget) {\n return { accountsEditsSummaries };\n }\n\n const accountEditsSummary = accountsEditsSummaries[accountId] || {};\n const targetSummary = accountEditsSummary[editTarget] || {};\n const nextSummary = { ...targetSummary };\n const normalizedEdit = normalizeStoredAccountEditForSummary(storedAccountEdit);\n\n for (const propertyName in normalizedEdit) {\n if (\n (normalizedEdit[propertyName] === undefined &&\n propertyName !== COMMENT_MODERATION_AUTHOR_SUMMARY_KEY) ||\n accountEditNonPropertyNames.has(propertyName)\n ) {\n continue;\n }\n const previousTimestamp = nextSummary[propertyName]?.timestamp || 0;\n if ((normalizedEdit.timestamp || 0) >= previousTimestamp) {\n nextSummary[propertyName] = {\n timestamp: normalizedEdit.timestamp,\n value: normalizedEdit[propertyName],\n };\n }\n }\n\n return {\n accountsEditsSummaries: {\n ...accountsEditsSummaries,\n [accountId]: {\n ...accountEditsSummary,\n [editTarget]: nextSummary,\n },\n },\n };\n};\n\nexport const removeStoredAccountEditSummaryFromState = (\n accountsEditsSummaries: Record<string, Record<string, any>>,\n accountsEdits: Record<string, Record<string, any[]>>,\n accountId: string,\n storedAccountEdit: any,\n) => {\n const editTarget = getStoredAccountEditTarget(storedAccountEdit);\n if (!editTarget) {\n return { accountsEditsSummaries };\n }\n\n let deletedEdit = false;\n const editsForTarget = (accountsEdits[accountId]?.[editTarget] || []).filter((storedEdit) => {\n if (!deletedEdit && doesStoredAccountEditMatch(storedEdit, storedAccountEdit)) {\n deletedEdit = true;\n return false;\n }\n return true;\n });\n const nextTargetSummary = getAccountEditPropertySummary(editsForTarget);\n const nextAccountSummary = { ...(accountsEditsSummaries[accountId] || {}) };\n if (Object.keys(nextTargetSummary).length > 0) {\n nextAccountSummary[editTarget] = nextTargetSummary;\n } else {\n delete nextAccountSummary[editTarget];\n }\n\n return {\n accountsEditsSummaries: {\n ...accountsEditsSummaries,\n [accountId]: nextAccountSummary,\n },\n };\n};\n\nexport const hasTerminalChallengeVerificationError = (challengeVerification: any) => {\n const challengeErrors = challengeVerification?.challengeErrors;\n const hasChallengeErrors = Array.isArray(challengeErrors)\n ? challengeErrors.length > 0\n : challengeErrors && typeof challengeErrors === \"object\"\n ? Object.keys(challengeErrors).length > 0\n : Boolean(challengeErrors);\n\n return (\n !challengeVerification?.challengeSuccess &&\n (hasChallengeErrors || Boolean(challengeVerification?.reason))\n );\n};\n\n// pkc-js stops a publication and sets its publishingState to \"failed\" before emitting the error that\n// ends its publish, and over RPC an error the server ended its publish with ends it too, the test\n// pkc-js makes itself (see its _handleIncomingErrorFromRpc). Its other errors did not end the\n// publish: ones it recovers from while the publication keeps publishing, e.g. a challenge it cannot\n// decrypt, or a pubsub unsubscribe that failed while a stopped publication was torn down\nconst isPublishEndingError = (publication: any, error: any) =>\n publication?.state === \"stopped\" &&\n (publication.publishingState === \"failed\" ||\n Boolean(error?.details?.publishThrowError) ||\n error?.details?.newState === \"stopped\");\n\n/**\n * Reports the errors of one publication to a publish action's onError with whether each ended the\n * publish, and runs onPublishEnd before reporting the one that did. Only the first error that ends\n * it is final, none after its challenge verification decided it, and an error pkc-js both emits and\n * rejects publish() with (when every pubsub provider threw or the community's challenge exchange is\n * disabled) is reported once. A rejected publish() ends the publish, although pkc-js leaves the\n * state \"publishing\" when it rejects before a challenge exchange exists (signing, the RPC call).\n */\nconst createPublicationErrorReporter = (\n publication: any,\n onError: ((error: unknown, publication: any, info: PublishErrorInfo) => void) | undefined,\n onPublishEnd: () => Promise<void> | void,\n) => {\n let publishEnded = false;\n let lastReportedError: unknown;\n const report = async (error: unknown, endsPublish: boolean) => {\n if (error === lastReportedError) return;\n lastReportedError = error;\n const final = endsPublish && !publishEnded;\n if (final) {\n publishEnded = true;\n await onPublishEnd();\n }\n onError?.(error, publication, { final });\n };\n return {\n reportErrorEvent: (error: unknown) => report(error, isPublishEndingError(publication, error)),\n reportPublishRejection: (error: unknown) => report(error, true),\n onChallengeVerification: () => {\n publishEnded = true;\n },\n };\n};\n\nexport const addStoredAccountEditToState = (\n accountsEdits: Record<string, Record<string, any[]>>,\n accountId: string,\n storedAccountEdit: any,\n) => {\n const accountEdits = accountsEdits[accountId] || {};\n const editTarget = getStoredAccountEditTarget(storedAccountEdit);\n if (!editTarget) {\n return { accountsEdits };\n }\n const commentEdits = accountEdits[editTarget] || [];\n return {\n accountsEdits: {\n ...accountsEdits,\n [accountId]: {\n ...accountEdits,\n [editTarget]: [...commentEdits, storedAccountEdit],\n },\n },\n };\n};\n\nexport const removeStoredAccountEditFromState = (\n accountsEdits: Record<string, Record<string, any[]>>,\n accountId: string,\n storedAccountEdit: any,\n) => {\n const accountEdits = accountsEdits[accountId] || {};\n const editTarget = getStoredAccountEditTarget(storedAccountEdit);\n if (!editTarget) {\n return { accountsEdits };\n }\n const commentEdits = accountEdits[editTarget] || [];\n let deletedEdit = false;\n const nextCommentEdits = commentEdits.filter((commentEdit) => {\n if (!deletedEdit && doesStoredAccountEditMatch(commentEdit, storedAccountEdit)) {\n deletedEdit = true;\n return false;\n }\n return true;\n });\n\n const nextAccountEdits =\n nextCommentEdits.length > 0\n ? {\n ...accountEdits,\n [editTarget]: nextCommentEdits,\n }\n : Object.fromEntries(\n Object.entries(accountEdits).filter(([target]) => target !== editTarget),\n );\n\n return {\n accountsEdits: {\n ...accountsEdits,\n [accountId]: nextAccountEdits,\n },\n };\n};\n\nconst addNewAccountToDatabaseAndState = async (newAccount: Account) => {\n // add to database first to init the account\n await accountsDatabase.addAccount(newAccount);\n // use database data for these because it's easier\n const [newAccountIds, newAccountNamesToAccountIds] = await Promise.all<any>([\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountIds\"),\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountNamesToAccountIds\"),\n ]);\n\n // set the new state\n const {\n accounts,\n accountsComments,\n accountsCommentsIndexes,\n accountsVotes,\n accountsEdits,\n accountsEditsSummaries,\n accountsEditsLoaded,\n accountsCommentsReplies,\n } = accountsStore.getState();\n const newAccounts = { ...accounts, [newAccount.id]: newAccount };\n const newState: any = {\n accounts: newAccounts,\n accountIds: newAccountIds,\n accountNamesToAccountIds: newAccountNamesToAccountIds,\n accountsComments: { ...accountsComments, [newAccount.id]: [] },\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [newAccount.id]: getAccountCommentsIndex([]),\n },\n accountsVotes: { ...accountsVotes, [newAccount.id]: {} },\n accountsEdits: { ...accountsEdits, [newAccount.id]: {} },\n accountsEditsSummaries: { ...accountsEditsSummaries, [newAccount.id]: {} },\n accountsEditsLoaded: { ...accountsEditsLoaded, [newAccount.id]: false },\n accountsCommentsReplies: { ...accountsCommentsReplies, [newAccount.id]: {} },\n };\n // if there is only 1 account, make it active\n // otherwise stay on the same active account\n if (newAccountIds.length === 1) {\n newState.activeAccountId = newAccount.id;\n }\n accountsStore.setState(newState);\n};\n\nexport const createAccount = async (accountName?: string) => {\n const newAccount = await accountGenerator.generateDefaultAccount();\n if (accountName) {\n newAccount.name = accountName;\n }\n await addNewAccountToDatabaseAndState(newAccount);\n log(\"accountsActions.createAccount\", { accountName, account: newAccount });\n};\n\nexport const deleteAccount = async (accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.deleteAccount account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n // until the store drops the account, a publication that has not started yet must not start\n deletingAccountIds.add(account.id);\n try {\n abandonAccountPublishSessions(account.id);\n // a pending comment already saving its first row finishes before the account is cleared\n await accountCommentAppendQueues.get(account.id)?.catch(() => {});\n await accountsDatabase.removeAccount(account);\n const [newAccountIds, newActiveAccountId, newAccountNamesToAccountIds] = await Promise.all<any>(\n [\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountIds\"),\n accountsDatabase.accountsMetadataDatabase.getItem(\"activeAccountId\"),\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountNamesToAccountIds\"),\n ],\n );\n // from the live state: other accounts may have saved comments, votes, edits or replies during\n // the awaits above\n accountsStore.setState((state) => {\n const withoutAccount = <T extends Record<string, any>>(map: T): T => {\n const newMap = { ...map };\n delete newMap[account.id];\n return newMap;\n };\n const newAccountsComments = withoutAccount(state.accountsComments);\n return {\n accounts: withoutAccount(state.accounts),\n accountIds: newAccountIds,\n activeAccountId: newActiveAccountId,\n accountNamesToAccountIds: newAccountNamesToAccountIds,\n accountsComments: newAccountsComments,\n accountsCommentsIndexes: withoutAccount(state.accountsCommentsIndexes),\n commentCidsToAccountsComments: getCommentCidsToAccountsComments(newAccountsComments),\n accountsVotes: withoutAccount(state.accountsVotes),\n accountsEdits: withoutAccount(state.accountsEdits),\n accountsEditsSummaries: withoutAccount(state.accountsEditsSummaries),\n accountsEditsLoaded: withoutAccount(state.accountsEditsLoaded),\n accountsCommentsReplies: withoutAccount(state.accountsCommentsReplies),\n };\n });\n } finally {\n deletingAccountIds.delete(account.id);\n }\n};\n\nexport const setActiveAccount = async (accountName: string) => {\n const { accountNamesToAccountIds } = accountsStore.getState();\n assert(accountNamesToAccountIds, `can't use accountsStore.accountActions before initialized`);\n validator.validateAccountsActionsSetActiveAccountArguments(accountName);\n const accountId = accountNamesToAccountIds[accountName];\n await accountsDatabase.accountsMetadataDatabase.setItem(\"activeAccountId\", accountId);\n log(\"accountsActions.setActiveAccount\", { accountName, accountId });\n accountsStore.setState({ activeAccountId: accountId });\n};\n\nexport const setAccount = async (account: Account) => {\n const { accounts } = accountsStore.getState();\n validator.validateAccountsActionsSetAccountArguments(account);\n assert(\n accounts?.[account.id],\n `cannot set account with account.id '${account.id}' id does not exist in database`,\n );\n validator.validateAccountsActionsSetAccountAuthorName(\n account.author,\n accounts[account.id].author,\n );\n\n // if author.address has changed, add new community roles of author.address found in communities store\n // TODO: add test to check if roles get added\n if (account.author.address !== accounts[account.id].author.address) {\n const communities = getAccountCommunities(account, communitiesStore.getState().communities);\n account = { ...account, communities };\n\n // wallet.signature changes if author.address changes\n if (account.author.wallets?.eth) {\n const pkcSignerWalletWithNewAuthorAddress = await chain.getEthWalletFromPkcPrivateKey(\n account.signer.privateKey,\n account.author.address,\n );\n // wallet is using pkc signer, redo signature with new author.address\n if (account.author.wallets.eth.address === pkcSignerWalletWithNewAuthorAddress?.address) {\n account.author.wallets = {\n ...account.author.wallets,\n eth: pkcSignerWalletWithNewAuthorAddress,\n };\n }\n }\n }\n\n // use this function to serialize and update all databases\n await accountsDatabase.addAccount(account);\n const [newAccount, newAccountNamesToAccountIds] = await Promise.all<any>([\n // use this function to deserialize\n accountsDatabase.getAccount(account.id),\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountNamesToAccountIds\"),\n ]);\n const newAccounts: Accounts = { ...accounts, [newAccount.id]: newAccount };\n log(\"accountsActions.setAccount\", { account: newAccount });\n accountsStore.setState({\n accounts: newAccounts,\n accountNamesToAccountIds: newAccountNamesToAccountIds,\n });\n};\n\nexport const setAccountsOrder = async (newOrderedAccountNames: string[]) => {\n const { accounts, accountNamesToAccountIds } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds,\n `can't use accountsStore.accountActions before initialized`,\n );\n const accountIds = [];\n const accountNames = [];\n for (const accountName of newOrderedAccountNames) {\n const accountId = accountNamesToAccountIds[accountName];\n accountIds.push(accountId);\n accountNames.push(accounts[accountId].name);\n }\n validator.validateAccountsActionsSetAccountsOrderArguments(newOrderedAccountNames, accountNames);\n log(\"accountsActions.setAccountsOrder\", {\n previousAccountNames: accountNames,\n newAccountNames: newOrderedAccountNames,\n });\n await accountsDatabase.accountsMetadataDatabase.setItem(\"accountIds\", accountIds);\n accountsStore.setState({ accountIds });\n};\n\nexport const importAccount = async (serializedAccount: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let imported;\n try {\n imported = JSON.parse(serializedAccount);\n } catch (e) {}\n assert(\n imported?.account && imported?.account?.id && imported?.account?.name,\n `accountsActions.importAccount failed JSON.stringify json serializedAccount '${serializedAccount}'`,\n );\n\n // add community roles already in communities store to imported account\n // TODO: add test to check if roles get added\n const communities = getAccountCommunities(\n imported.account,\n communitiesStore.getState().communities,\n );\n // Preserve the imported name when possible; otherwise use the next available numeric suffix.\n const importedAccountName = imported.account.name;\n let accountNameNumber = 2;\n while (accountNamesToAccountIds[imported.account.name]) {\n imported.account.name = `${importedAccountName} ${accountNameNumber}`;\n accountNameNumber++;\n }\n\n // Always assign a new local id so importing the same backup cannot overwrite an existing account.\n const accountToImport = {\n ...accountGenerator.getDefaultAccountFields(),\n ...imported.account,\n communities,\n id: uuid(),\n };\n\n // Hydrate the imported identity once, then persist its history in bulk instead of replaying\n // every record through the single-publication write path.\n const newAccount = await accountsDatabase.addAccount(accountToImport, {\n returnHydratedAccount: true,\n });\n assert(newAccount, `accountsActions.importAccount failed to hydrate imported account`);\n let importedHistory;\n let accountIds;\n let newAccountNamesToAccountIds;\n try {\n importedHistory = await accountsDatabase.importAccountHistory(newAccount.id, {\n accountComments: imported.accountComments || [],\n accountVotes: imported.accountVotes || [],\n accountEdits: imported.accountEdits || [],\n });\n [accountIds, newAccountNamesToAccountIds] = await Promise.all<any>([\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountIds\"),\n accountsDatabase.accountsMetadataDatabase.getItem(\"accountNamesToAccountIds\"),\n ]);\n } catch (error) {\n await accountsDatabase.removeAccount(newAccount);\n void newAccount.pkc?.destroy?.();\n throw error;\n }\n const { accountComments, accountVotes, accountEditsSummary } = importedHistory;\n\n accountsStore.setState((state) => ({\n accounts: { ...state.accounts, [newAccount.id]: newAccount },\n accountIds,\n accountNamesToAccountIds: newAccountNamesToAccountIds,\n accountsComments: { ...state.accountsComments, [newAccount.id]: accountComments },\n accountsCommentsIndexes: {\n ...state.accountsCommentsIndexes,\n [newAccount.id]: getAccountCommentsIndex(accountComments),\n },\n commentCidsToAccountsComments: getCommentCidsToAccountsComments({\n ...state.accountsComments,\n [newAccount.id]: accountComments,\n }),\n accountsVotes: { ...state.accountsVotes, [newAccount.id]: accountVotes },\n accountsEdits: { ...state.accountsEdits, [newAccount.id]: {} },\n accountsEditsSummaries: {\n ...state.accountsEditsSummaries,\n [newAccount.id]: accountEditsSummary,\n },\n accountsEditsLoaded: { ...state.accountsEditsLoaded, [newAccount.id]: false },\n // don't import/export replies to own comments, those are just cached and can be refetched\n accountsCommentsReplies: { ...state.accountsCommentsReplies, [newAccount.id]: {} },\n }));\n\n log(\"accountsActions.importAccount\", {\n account: newAccount,\n accountComments,\n accountVotes,\n accountEditsSummary,\n });\n\n // Match normal startup: refresh only the ten newest comments instead of opening a watcher\n // for the entire imported history at once.\n for (const { accountComment } of getInitAccountCommentsToUpdate({\n [newAccount.id]: accountComments,\n })) {\n accountsStore\n .getState()\n .accountsActionsInternal.startUpdatingAccountCommentOnCommentUpdateEvents(\n accountComment,\n newAccount,\n accountComment.index,\n )\n .catch((error: unknown) =>\n log.error(\n \"accountsActions.importAccount startUpdatingAccountCommentOnCommentUpdateEvents error\",\n {\n accountComment,\n accountCommentIndex: accountComment.index,\n importedAccount: newAccount,\n error,\n },\n ),\n );\n }\n\n // TODO: add options to only import private key, account settings, or include all account comments/votes history\n};\n\nexport const exportAccount = async (accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.exportAccount account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n const exportedAccountJson = await accountsDatabase.getExportedAccountJson(account.id);\n log(\"accountsActions.exportAccount\", { exportedAccountJson });\n return exportedAccountJson;\n};\n\nconst getCommunityAddressesToExport = (\n communityAddressOrAddresses: string | string[] | undefined,\n account: Account,\n) => {\n if (Array.isArray(communityAddressOrAddresses)) {\n return communityAddressOrAddresses;\n }\n if (communityAddressOrAddresses) {\n return [communityAddressOrAddresses];\n }\n return getPkcCommunityAddresses(account.pkc);\n};\n\nexport const exportCommunity = async (\n communityAddressOrAddresses?: string | string[],\n exportCommunityOptions: ExportCommunityOptions = {},\n accountName?: string,\n): Promise<CommunityExport[]> => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountsActions before initialized`,\n );\n assert(\n !exportCommunityOptions || typeof exportCommunityOptions === \"object\",\n `accountsActions.exportCommunity invalid exportCommunityOptions argument '${exportCommunityOptions}'`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.exportCommunity account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const communityAddresses = getCommunityAddressesToExport(communityAddressOrAddresses, account);\n assert(\n communityAddresses.length > 0,\n `accountsActions.exportCommunity no community addresses to export`,\n );\n for (const communityAddress of communityAddresses) {\n assert(\n communityAddress && typeof communityAddress === \"string\",\n `accountsActions.exportCommunity invalid communityAddress '${communityAddress}'`,\n );\n }\n\n const communityExports = await Promise.all(\n [...new Set(communityAddresses)].map(async (communityAddress) => {\n const community = await createPkcCommunity(account.pkc, { address: communityAddress });\n assert(\n typeof community?.export === \"function\",\n `accountsActions.exportCommunity community.export missing for communityAddress '${communityAddress}'`,\n );\n const exportedCommunity = await community.export(exportCommunityOptions);\n return { ...exportedCommunity, communityAddress };\n }),\n );\n log(\"accountsActions.exportCommunity\", {\n communityAddresses,\n includePrivateKey: exportCommunityOptions.includePrivateKey === true,\n communityExportCount: communityExports.length,\n });\n return communityExports;\n};\n\nexport const subscribe = async (communityAddress: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n communityAddress && typeof communityAddress === \"string\",\n `accountsActions.subscribe invalid communityAddress '${communityAddress}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.subscribe account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n let subscriptions: string[] = account.subscriptions || [];\n if (subscriptions.includes(communityAddress)) {\n throw Error(`account '${account.id}' already subscribed to '${communityAddress}'`);\n }\n subscriptions = [...subscriptions, communityAddress];\n\n const updatedAccount: Account = { ...account, subscriptions };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.subscribe\", { account: updatedAccount, accountName, communityAddress });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const unsubscribe = async (communityAddress: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n communityAddress && typeof communityAddress === \"string\",\n `accountsActions.unsubscribe invalid communityAddress '${communityAddress}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.unsubscribe account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n let subscriptions: string[] = account.subscriptions || [];\n if (!subscriptions.includes(communityAddress)) {\n throw Error(`account '${account.id}' already unsubscribed from '${communityAddress}'`);\n }\n // remove communityAddress\n subscriptions = subscriptions.filter((address) => address !== communityAddress);\n\n const updatedAccount: Account = { ...account, subscriptions };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.unsubscribe\", { account: updatedAccount, accountName, communityAddress });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const blockAddress = async (address: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n address && typeof address === \"string\",\n `accountsActions.blockAddress invalid address '${address}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.blockAddress account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const blockedAddresses: { [address: string]: boolean } = { ...account.blockedAddresses };\n if (blockedAddresses[address] === true) {\n throw Error(`account '${account.id}' already blocked address '${address}'`);\n }\n blockedAddresses[address] = true;\n\n const updatedAccount: Account = { ...account, blockedAddresses };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.blockAddress\", { account: updatedAccount, accountName, address });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const unblockAddress = async (address: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n address && typeof address === \"string\",\n `accountsActions.unblockAddress invalid address '${address}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.unblockAddress account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const blockedAddresses: { [address: string]: boolean } = { ...account.blockedAddresses };\n if (!blockedAddresses[address]) {\n throw Error(`account '${account.id}' already unblocked address '${address}'`);\n }\n delete blockedAddresses[address];\n\n const updatedAccount: Account = { ...account, blockedAddresses };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.unblockAddress\", { account: updatedAccount, accountName, address });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const blockCid = async (cid: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(cid && typeof cid === \"string\", `accountsActions.blockCid invalid cid '${cid}'`);\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.blockCid account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const blockedCids: { [cid: string]: boolean } = { ...account.blockedCids };\n if (blockedCids[cid] === true) {\n throw Error(`account '${account.id}' already blocked cid '${cid}'`);\n }\n blockedCids[cid] = true;\n\n const updatedAccount: Account = { ...account, blockedCids };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.blockCid\", { account: updatedAccount, accountName, cid });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nexport const unblockCid = async (cid: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(cid && typeof cid === \"string\", `accountsActions.unblockCid invalid cid '${cid}'`);\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(\n account?.id,\n `accountsActions.unblockCid account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const blockedCids: { [cid: string]: boolean } = { ...account.blockedCids };\n if (!blockedCids[cid]) {\n throw Error(`account '${account.id}' already unblocked cid '${cid}'`);\n }\n delete blockedCids[cid];\n\n const updatedAccount: Account = { ...account, blockedCids };\n // update account in db async for instant feedback speed\n accountsDatabase.addAccount(updatedAccount);\n const updatedAccounts = { ...accounts, [updatedAccount.id]: updatedAccount };\n log(\"accountsActions.unblockCid\", { account: updatedAccount, accountName, cid });\n accountsStore.setState({ accounts: updatedAccounts });\n};\n\nconst savedCommentMutationQueues = new Map<string, Promise<void>>();\n\nconst updateSavedComments = async (\n commentCid: string,\n accountName: string | undefined,\n shouldSave: boolean,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n commentCid && typeof commentCid === \"string\",\n `accountsActions.${shouldSave ? \"saveComment\" : \"unsaveComment\"} invalid commentCid '${commentCid}'`,\n );\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n const accountId = accountName ? accountNamesToAccountIds[accountName] : activeAccountId;\n assert(\n accounts[accountId]?.id,\n `accountsActions.${shouldSave ? \"saveComment\" : \"unsaveComment\"} account.id '${accounts[accountId]?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const previousMutation = savedCommentMutationQueues.get(accountId) || Promise.resolve();\n const mutation = previousMutation\n .catch(() => {})\n .then(async () => {\n const currentAccounts = accountsStore.getState().accounts;\n const account = currentAccounts[accountId];\n assert(\n account?.id,\n `accountsActions.${shouldSave ? \"saveComment\" : \"unsaveComment\"} account.id '${account?.id}' doesn't exist, activeAccountId '${activeAccountId}' accountName '${accountName}'`,\n );\n\n const isSaved = account.savedComments.includes(commentCid);\n if (shouldSave && isSaved) {\n throw Error(`account '${account.id}' already saved comment '${commentCid}'`);\n }\n if (!shouldSave && !isSaved) {\n throw Error(`account '${account.id}' already unsaved comment '${commentCid}'`);\n }\n\n const savedComments = shouldSave\n ? [commentCid, ...account.savedComments]\n : account.savedComments.filter((savedCommentCid: string) => savedCommentCid !== commentCid);\n const updatedAccount: Account = { ...account, savedComments };\n await accountsDatabase.addAccount(updatedAccount);\n\n const latestAccounts = accountsStore.getState().accounts;\n const latestAccount = latestAccounts[accountId];\n assert(latestAccount?.id, `account '${accountId}' was removed while updating saved comments`);\n const mergedAccount: Account = { ...latestAccount, savedComments };\n const updatedAccounts = { ...latestAccounts, [accountId]: mergedAccount };\n const actionName = shouldSave ? \"saveComment\" : \"unsaveComment\";\n log(`accountsActions.${actionName}`, {\n accountId,\n accountName,\n commentCid,\n });\n accountsStore.setState({ accounts: updatedAccounts });\n });\n\n savedCommentMutationQueues.set(accountId, mutation);\n try {\n await mutation;\n } finally {\n if (savedCommentMutationQueues.get(accountId) === mutation) {\n savedCommentMutationQueues.delete(accountId);\n }\n }\n};\n\nexport const saveComment = async (commentCid: string, accountName?: string) => {\n await updateSavedComments(commentCid, accountName, true);\n};\n\nexport const unsaveComment = async (commentCid: string, accountName?: string) => {\n await updateSavedComments(commentCid, accountName, false);\n};\n\n// callbacks passed with the comment publish options, never part of the published comment\nconst publishCommentCallbackNames = [\n \"onChallenge\",\n \"onChallengeVerification\",\n \"onError\",\n \"onPendingComment\",\n \"onPublishingStateChange\",\n \"onBeforeRepublish\",\n \"_onPendingCommentIndex\",\n];\nconst omitPublishCommentCallbacks = (options: PublishCommentOptions) => {\n const publicationOptions = { ...options };\n for (const callbackName of publishCommentCallbackNames) {\n delete publicationOptions[callbackName];\n }\n return publicationOptions;\n};\n\nexport const publishComment = async (\n publishCommentOptions: PublishCommentOptions,\n accountName?: string,\n) => {\n const { accounts, accountsComments, accountNamesToAccountIds, activeAccountId } =\n accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishCommentArguments({\n publishCommentOptions,\n accountName,\n account,\n });\n\n // find author.previousCommentCid if any\n const accountCommentsWithCids = accountsComments[account.id]\n .filter((comment: AccountComment) => comment.cid)\n // a pseudonymous community published the comment under an alias, linking it would reveal the account\n .filter((comment: AccountComment) => !comment.pseudonymityMode)\n // author can change his address, his previousCommentCid becomes invalid. hooks <= 0.1.51 replaced\n // the stored author with commentUpdate.author, so those comments have no author.address at all\n .filter(\n (comment: AccountComment) =>\n !comment.author?.address || comment.author.address === account.author?.address,\n );\n const previousComment = accountCommentsWithCids[accountCommentsWithCids.length - 1];\n const author = { ...account.author };\n if (previousComment) {\n author.previousCommentCid = previousComment.cid;\n }\n let previousCommentAuthorAddressPromise: Promise<string | undefined> | undefined;\n // builds the options pkc-js publishes from the client's options without callbacks, for the first\n // publish and for each republish whose options onBeforeRepublish returned\n const createPublishCommentOptions = async (options: PublishCommentOptions) => {\n const publicationAuthor = { ...author, ...options.author };\n if (\n publicationAuthor.address !== account.author?.address &&\n options.author?.previousCommentCid === undefined\n ) {\n delete publicationAuthor.previousCommentCid;\n }\n // a comment without author.address may have been published under an alternate author passed to\n // publishComment, so only link it once its immutable author, loaded from its cid, is the account's\n if (\n previousComment &&\n !previousComment.author?.address &&\n options.author?.previousCommentCid === undefined &&\n publicationAuthor.previousCommentCid === previousComment.cid\n ) {\n // loaded once, a republish reuses it\n previousCommentAuthorAddressPromise ??= loadCommentAuthorAddress(\n account,\n previousComment.cid,\n );\n const previousCommentAuthorAddress = await previousCommentAuthorAddressPromise;\n if (\n !previousCommentAuthorAddress ||\n previousCommentAuthorAddress !== account.author?.address\n ) {\n // fall back to the newest stored comment that kept the account author address\n const previousAccountAuthorComment = accountCommentsWithCids\n .filter((comment: AccountComment) => comment.author?.address)\n .pop();\n if (previousAccountAuthorComment) {\n publicationAuthor.previousCommentCid = previousAccountAuthorComment.cid;\n } else {\n delete publicationAuthor.previousCommentCid;\n }\n }\n }\n\n const createCommentOptions: any = normalizePublicationOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n signer: account.signer,\n ...options,\n author: publicationAuthor,\n });\n return applyPublicationWordfilters(\"comment\", createCommentOptions, account);\n };\n const createAccountComment = (createCommentOptions: any, index: number) =>\n addShortAddressesToAccountComment(\n sanitizeAccountCommentForState({\n ...normalizePublicationOptionsForStore(createCommentOptions),\n // try to get comment depth needed for custom depth flat account replies\n depth: getAccountCommentDepth(createCommentOptions),\n // try to get the post cid so a pending reply can link to its thread\n postCid: getAccountCommentPostCid(\n createCommentOptions,\n // the parent can be a comment of a local account that only the accounts store has so far\n getAccountCommentByCid(createCommentOptions.parentCid),\n ),\n index,\n accountId: account.id,\n }),\n ) as AccountComment;\n const commentLinkDimensionsPromises = new Map<\n string,\n ReturnType<typeof fetchCommentLinkDimensions>\n >();\n const getCommentLinkDimensions = (link: string) => {\n if (!commentLinkDimensionsPromises.has(link)) {\n commentLinkDimensionsPromises.set(link, fetchCommentLinkDimensions(link));\n }\n return commentLinkDimensionsPromises.get(link)!;\n };\n\n // the client's options, without callbacks, as last published: onBeforeRepublish receives them\n let publicationOptions = omitPublishCommentCallbacks(publishCommentOptions);\n let createCommentOptions: any = await createPublishCommentOptions(publicationOptions);\n\n // make sure the options dont throw\n await account.pkc.createComment(createCommentOptions);\n\n // set fetching link dimensions state\n let fetchingLinkDimensionsStates: { state: string; publishingState: string };\n if (publishCommentOptions.link) {\n publishCommentOptions.onPublishingStateChange?.(\"fetching-link-dimensions\");\n fetchingLinkDimensionsStates = {\n state: \"publishing\",\n publishingState: \"fetching-link-dimensions\",\n };\n }\n\n // save comment to db: the row index and the publish session are set by the queued first save\n let accountCommentIndex!: number;\n let publishSessionId!: string;\n let savedOnce = false;\n const saveCreatedAccountComment = async (\n accountComment: AccountComment,\n ): Promise<number | undefined> => {\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n const isUpdate = savedOnce;\n const session = getPublishSession(publishSessionId);\n const currentIndex = session?.currentIndex ?? accountCommentIndex;\n const persistedAccountComment = addShortAddressesToAccountComment(\n sanitizeStoredAccountComment(accountComment),\n ) as AccountComment;\n const liveAccountComment = addShortAddressesToAccountComment(\n sanitizeAccountCommentForState(accountComment),\n ) as AccountComment;\n const liveAccountComments = accountsStore.getState().accountsComments[account.id] || [];\n if (isUpdate && !liveAccountComments[currentIndex]) {\n return;\n }\n await accountsDatabase.addAccountComment(\n account.id,\n persistedAccountComment,\n isUpdate ? currentIndex : undefined,\n );\n const currentSession = getPublishSession(publishSessionId);\n if (!currentSession || isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n const persistedIndex = currentSession.currentIndex;\n savedOnce = true;\n accountsStore.setState(({ accountsComments, accountsCommentsIndexes }) => {\n const accountComments = [...accountsComments[account.id]];\n if (isUpdate && !accountComments[persistedIndex]) {\n return {};\n }\n accountComments[persistedIndex] = {\n ...liveAccountComment,\n index: persistedIndex,\n accountId: account.id,\n };\n return {\n accountsComments: { ...accountsComments, [account.id]: accountComments },\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [account.id]: getAccountCommentsIndex(accountComments),\n },\n };\n });\n return persistedIndex;\n };\n let createdAccountComment!: AccountComment;\n // a reload cancels publishing, so the publication's states stay out of the database except a\n // failed end: without it, the reloaded row has no state and counts as pending until it expires\n const saveFailedAccountComment = (index: number) => {\n if (!accountsStore.getState().accountsComments[account.id]?.[index]) {\n return;\n }\n const failedAccountComment = addShortAddressesToAccountComment(\n sanitizeStoredAccountComment({\n ...createdAccountComment,\n state: \"stopped\",\n publishingState: \"failed\",\n } as AccountComment),\n ) as AccountComment;\n accountsDatabase\n .addAccountComment(account.id, failedAccountComment, index)\n .catch((error: unknown) =>\n log.error(\"accountsActions.publishComment save failed account comment error\", {\n accountId: account.id,\n accountCommentIndex: index,\n error,\n }),\n );\n };\n const reportOnPendingCommentError = (error: unknown, pendingCommentIndex: number) => {\n log.error(\"accountsActions.publishComment onPendingComment callback error\", {\n accountId: account.id,\n accountCommentIndex: pendingCommentIndex,\n error,\n });\n };\n const notifyPendingComment = (pendingCommentIndex: number, pendingComment: AccountComment) => {\n try {\n const pendingCommentSnapshot = utils.clone(pendingComment) as AccountComment;\n void Promise.resolve(\n publishCommentOptions.onPendingComment?.(pendingCommentIndex, pendingCommentSnapshot),\n ).catch((error) => reportOnPendingCommentError(error, pendingCommentIndex));\n } catch (error) {\n reportOnPendingCommentError(error, pendingCommentIndex);\n }\n };\n const pendingCommentIndex = await queueAccountCommentAppend(account.id, () => {\n if (isAccountDeleted(account.id)) {\n throw Error(`accountsActions.publishComment account '${account.id}' was deleted`);\n }\n // read the live list, not the state from before the awaits above\n accountCommentIndex = accountsStore.getState().accountsComments[account.id].length;\n publishSessionId = createPublishSession(account.id, accountCommentIndex);\n createdAccountComment = createAccountComment(createCommentOptions, accountCommentIndex);\n notifyPendingComment(accountCommentIndex, createdAccountComment);\n return saveCreatedAccountComment(createdAccountComment);\n });\n if (pendingCommentIndex === undefined) {\n return createdAccountComment;\n }\n createdAccountComment = { ...createdAccountComment, index: pendingCommentIndex };\n if (pendingCommentIndex !== accountCommentIndex) {\n notifyPendingComment(pendingCommentIndex, createdAccountComment);\n }\n // the hooks abandon the pending comment with abandonPendingComment, and learn its new index when a\n // deletion of an earlier account comment shifts it\n const abandonPendingComment = () => abandonPublishSession(publishSessionId);\n const onPendingCommentIndex = publishCommentOptions._onPendingCommentIndex;\n onPendingCommentIndex?.(pendingCommentIndex, createdAccountComment, abandonPendingComment);\n const pendingPublishSession = getPublishSession(publishSessionId);\n if (onPendingCommentIndex && pendingPublishSession) {\n pendingPublishSession.onIndexChange = (index) =>\n onPendingCommentIndex(index, { ...createdAccountComment, index }, abandonPendingComment);\n }\n\n let comment: any;\n (async () => {\n // fetch comment.link dimensions\n if (publishCommentOptions.link) {\n const commentLinkDimensions = await getCommentLinkDimensions(publishCommentOptions.link);\n createCommentOptions = { ...createCommentOptions, ...commentLinkDimensions };\n // save dimensions to db\n createdAccountComment = { ...createdAccountComment, ...commentLinkDimensions };\n await saveCreatedAccountComment(createdAccountComment);\n }\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n comment = backfillPublicationCommunityAddress(\n await account.pkc.createComment(createCommentOptions),\n createCommentOptions,\n );\n syncCommentClientsSnapshot(publishSessionId, account.id, comment);\n publishAndRetryFailedChallengeVerification();\n log(\"accountsActions.publishComment\", { createCommentOptions });\n })();\n\n let lastChallenge: Challenge | undefined;\n let lastReportedPublishError: Error | undefined;\n const normalizePublishError = (error: unknown): Error =>\n error instanceof Error ? error : new Error(String(error));\n const getActiveSessionForComment = (activeComment: any) => {\n const session = getPublishSession(publishSessionId);\n if (\n !session ||\n isPublishSessionAbandoned(publishSessionId) ||\n session.comment !== activeComment\n ) {\n return undefined;\n }\n return session;\n };\n const queueCleanupFailedPublishSession = (activeComment: any) => {\n if (!getActiveSessionForComment(activeComment)) return;\n queueMicrotask(() => {\n if (getActiveSessionForComment(activeComment)) {\n cleanupPublishSessionOnTerminal(publishSessionId);\n }\n });\n };\n const recordPublishCommentError = (rawError: unknown, activeComment: any, final: boolean) => {\n const error = normalizePublishError(rawError);\n if (lastReportedPublishError === error) {\n return error;\n }\n lastReportedPublishError = error;\n\n const session = getActiveSessionForComment(activeComment);\n if (!session) return error;\n const currentIndex = session.currentIndex;\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {\n const previousErrors = Array.isArray(acc.errors) ? acc.errors : [];\n const errors =\n previousErrors[previousErrors.length - 1] === error\n ? previousErrors\n : [...previousErrors, error];\n // a final error ends the account comment failed, also when pkc-js left the publication\n // publishing, as it does when publish() rejects in pre-flight\n ac[currentIndex] = final\n ? { ...acc, errors, error, state: \"stopped\", publishingState: \"failed\" }\n : { ...acc, errors, error };\n }),\n );\n if (final) {\n saveFailedAccountComment(currentIndex);\n }\n return error;\n };\n const reportActivePublishCommentError = (\n rawError: unknown,\n activeComment: any,\n final: boolean,\n ) => {\n if (!getActiveSessionForComment(activeComment)) return;\n const error = recordPublishCommentError(rawError, activeComment, final);\n // only an error that ended the publish ends the session: pkc-js keeps processing the exchange\n // after an error it recovers from\n if (final) {\n queueCleanupFailedPublishSession(activeComment);\n }\n publishCommentOptions.onError?.(error, activeComment, { final });\n };\n // the options onBeforeRepublish returns go through the same pipeline as the first publish; resolves\n // to false when the publish was abandoned while onBeforeRepublish ran\n const createRepublishCommentOptions = async (timestamp: number) => {\n const nextOptions = await publishCommentOptions.onBeforeRepublish({\n ...publicationOptions,\n timestamp,\n });\n if (isPublishSessionAbandoned(publishSessionId)) {\n return false;\n }\n assert(\n nextOptions && typeof nextOptions === \"object\",\n \"publishComment publishCommentOptions.onBeforeRepublish did not return an object\",\n );\n const nextPublicationOptions = omitPublishCommentCallbacks(nextOptions);\n validator.validateAccountsActionsPublishCommentArguments({\n publishCommentOptions: {\n ...nextPublicationOptions,\n onChallenge: publishCommentOptions.onChallenge,\n onChallengeVerification: publishCommentOptions.onChallengeVerification,\n },\n accountName,\n account,\n });\n let nextCreateCommentOptions = await createPublishCommentOptions(nextPublicationOptions);\n if (nextPublicationOptions.link) {\n nextCreateCommentOptions = {\n ...nextCreateCommentOptions,\n ...(await getCommentLinkDimensions(nextPublicationOptions.link)),\n };\n }\n // make sure the options dont throw\n await account.pkc.createComment(nextCreateCommentOptions);\n publicationOptions = nextPublicationOptions;\n createCommentOptions = nextCreateCommentOptions;\n createdAccountComment = createAccountComment(createCommentOptions, createdAccountComment.index);\n return true;\n };\n // the failed comment was detached for the republish, so its stopped/failed state events were ignored:\n // reattach it to end the publish with that state and the error, like any other publish error\n const failRepublish = (error: unknown, failedComment: any) => {\n const session = getPublishSession(publishSessionId);\n if (!session || isPublishSessionAbandoned(publishSessionId)) return;\n updatePublishSessionComment(publishSessionId, failedComment);\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, session.currentIndex, (ac, acc) => {\n ac[session.currentIndex] = { ...acc, state: \"stopped\", publishingState: \"failed\" };\n }),\n );\n publishCommentOptions.onPublishingStateChange?.(\"failed\", failedComment);\n reportActivePublishCommentError(error, failedComment, true);\n };\n async function publishAndRetryFailedChallengeVerification() {\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n const activeComment = comment;\n updatePublishSessionComment(publishSessionId, activeComment);\n activeComment.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishCommentOptions.onChallenge(\n challenge,\n withPublishChallengeAnswersCompat(activeComment, challenge),\n );\n });\n activeComment.once(\n \"challengeverification\",\n async (challengeVerification: ChallengeVerification) => {\n applyChallengeVerificationCommentUpdateToPublication(challengeVerification, activeComment);\n publishCommentOptions.onChallengeVerification(challengeVerification, activeComment);\n // a verification with challengeErrors/reason is a terminal rejection of the publication\n // (e.g. stale wordfilter rules); republishing the same signed content would loop forever,\n // so fall through to the terminal path instead of retrying\n if (\n !challengeVerification.challengeSuccess &&\n lastChallenge &&\n !hasTerminalChallengeVerificationError(challengeVerification)\n ) {\n // publish again automatically on fail, unless the publish was abandoned meanwhile\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n const timestamp = Math.floor(Date.now() / 1000);\n updatePublishSessionComment(publishSessionId, undefined);\n if (publishCommentOptions.onBeforeRepublish) {\n try {\n if (!(await createRepublishCommentOptions(timestamp))) {\n return;\n }\n } catch (error) {\n failRepublish(error, activeComment);\n return;\n }\n } else {\n createCommentOptions = { ...createCommentOptions, timestamp };\n createdAccountComment = { ...createdAccountComment, timestamp };\n }\n await saveCreatedAccountComment(createdAccountComment);\n if (isPublishSessionAbandoned(publishSessionId)) {\n return;\n }\n comment = backfillPublicationCommunityAddress(\n await account.pkc.createComment(createCommentOptions),\n createCommentOptions,\n );\n syncCommentClientsSnapshot(publishSessionId, account.id, comment);\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n } else {\n // the challengeverification message of a comment publication should in theory send back the CID\n // of the published comment which is needed to resolve it for replies, upvotes, etc\n const session = getPublishSession(publishSessionId);\n if (!session || isPublishSessionAbandoned(publishSessionId)) return;\n const hasCid = !!challengeVerification?.commentUpdate?.cid;\n // a rejection ends the publish failed, e.g. the community's challenge exchange timed out\n if (!hasCid && !challengeVerification?.challengeSuccess) {\n saveFailedAccountComment(session.currentIndex);\n }\n // once the publication's last state events ran, they and any later ones are ignored; with a\n // cid the session stays registered until the cid is saved, so a deleteComment meanwhile still\n // shifts or abandons its row\n queueMicrotask(() =>\n hasCid\n ? updatePublishSessionComment(publishSessionId, undefined)\n : cleanupPublishSessionOnTerminal(publishSessionId),\n );\n if (hasCid) {\n const persistedCommentWithCid = addShortAddressesToAccountComment(\n sanitizeStoredAccountComment(normalizePublicationOptionsForStore(comment as any)),\n );\n const liveCommentWithCid = addShortAddressesToAccountComment(\n sanitizeAccountCommentForState(normalizePublicationOptionsForStore(comment as any)),\n );\n delete (persistedCommentWithCid as any).clients;\n delete (persistedCommentWithCid as any).publishingState;\n delete (persistedCommentWithCid as any).error;\n delete (persistedCommentWithCid as any).errors;\n delete (liveCommentWithCid as any).clients;\n delete (liveCommentWithCid as any).publishingState;\n delete (liveCommentWithCid as any).error;\n delete (liveCommentWithCid as any).errors;\n let savedSession: PublishSession | undefined;\n try {\n await accountsDatabase.addAccountComment(\n account.id,\n persistedCommentWithCid,\n session.currentIndex,\n );\n savedSession = isPublishSessionAbandoned(publishSessionId)\n ? undefined\n : getPublishSession(publishSessionId);\n } finally {\n cleanupPublishSessionOnTerminal(publishSessionId);\n }\n // the comment was deleted during the save\n if (!savedSession) return;\n const currentIndex = savedSession.currentIndex;\n accountsStore.setState(\n ({ accountsComments, accountsCommentsIndexes, commentCidsToAccountsComments }) => {\n const updatedAccountComments = [...accountsComments[account.id]];\n const updatedAccountComment = {\n ...liveCommentWithCid,\n index: currentIndex,\n accountId: account.id,\n };\n updatedAccountComments[currentIndex] = updatedAccountComment;\n return {\n accountsComments: { ...accountsComments, [account.id]: updatedAccountComments },\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [account.id]: getAccountCommentsIndex(updatedAccountComments),\n },\n commentCidsToAccountsComments: {\n ...commentCidsToAccountsComments,\n [challengeVerification?.commentUpdate?.cid]: {\n accountId: account.id,\n accountCommentIndex: currentIndex,\n },\n },\n };\n },\n );\n\n // clone the comment or it bugs publishing callbacks\n const updatingComment = await account.pkc.createComment(\n normalizePublicationOptionsForPkc(account.pkc, { ...comment }),\n );\n applyChallengeVerificationCommentUpdateToPublication(\n challengeVerification,\n updatingComment,\n );\n accountsActionsInternal\n .startUpdatingAccountCommentOnCommentUpdateEvents(\n updatingComment,\n account,\n currentIndex,\n )\n .catch((error: unknown) =>\n log.error(\n \"accountsActions.publishComment startUpdatingAccountCommentOnCommentUpdateEvents error\",\n { comment, account, accountCommentIndex, error },\n ),\n );\n }\n }\n },\n );\n\n activeComment.on(\"error\", (error: Error) => {\n // an error after the verdict is not reported: the verdict ends or detaches the session\n reportActivePublishCommentError(\n error,\n activeComment,\n isPublishEndingError(activeComment, error),\n );\n });\n // the session ends with the publication's final error, its rejected publish() or its verdict,\n // not with a stopped and failed state: pkc-js stops a publication before emitting the error that\n // ends it, awaiting its teardown in between, and stops it before publish() rejects when the\n // community fails to load, so ending the session here dropped that error\n activeComment.on(\"statechange\", (state: string) => {\n const session = getActiveSessionForComment(activeComment);\n if (!session) return;\n const currentIndex = session.currentIndex;\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {\n ac[currentIndex] = { ...acc, state };\n }),\n );\n });\n activeComment.on(\"publishingstatechange\", async (publishingState: string) => {\n const session = getActiveSessionForComment(activeComment);\n if (!session) return;\n const currentIndex = session.currentIndex;\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {\n ac[currentIndex] = { ...acc, publishingState };\n }),\n );\n // the hooks read the publication's state: pkc-js also reports \"failed\" for an error it\n // recovers from, while the publication keeps publishing\n publishCommentOptions.onPublishingStateChange?.(publishingState, activeComment);\n });\n\n // set clients on account comment so the frontend can display it, dont persist in db because a reload cancels publishing\n utils.clientsOnStateChange(\n activeComment.clients,\n (clientState: string, clientType: string, clientUrl: string, chainTicker?: string) => {\n const session = getActiveSessionForComment(activeComment);\n if (!session) return;\n const currentIndex = session.currentIndex;\n accountsStore.setState(({ accountsComments }) =>\n maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {\n const clients = getClientsSnapshotForState(activeComment.clients) || {};\n const client = { state: clientState };\n if (chainTicker) {\n const chainProviders = { ...clients[clientType][chainTicker], [clientUrl]: client };\n clients[clientType] = { ...clients[clientType], [chainTicker]: chainProviders };\n } else {\n clients[clientType] = { ...clients[clientType], [clientUrl]: client };\n }\n ac[currentIndex] = { ...acc, clients };\n }),\n );\n },\n );\n\n listeners.push(activeComment);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await activeComment.publish();\n } catch (error) {\n reportActivePublishCommentError(error, activeComment, true);\n }\n }\n\n return createdAccountComment;\n};\n\nexport const deleteComment = async (\n commentCidOrAccountCommentIndex: string | number,\n accountName?: string,\n) => {\n const {\n accounts,\n accountsComments,\n accountNamesToAccountIds,\n activeAccountId,\n commentCidsToAccountsComments,\n } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(account?.id, `accountsActions.deleteComment account.id '${account?.id}' doesn't exist`);\n const accountComments = accountsComments[account.id] || [];\n assert(accountComments.length > 0, `accountsActions.deleteComment no comments for account`);\n\n let accountCommentIndex: number;\n if (typeof commentCidOrAccountCommentIndex === \"number\") {\n accountCommentIndex = commentCidOrAccountCommentIndex;\n } else {\n const mapping = commentCidsToAccountsComments[commentCidOrAccountCommentIndex];\n assert(\n mapping && mapping.accountId === account.id,\n `accountsActions.deleteComment cid '${commentCidOrAccountCommentIndex}' not found for account`,\n );\n accountCommentIndex = mapping.accountCommentIndex;\n }\n await deleteAccountComment(account.id, accountCommentIndex);\n};\n\nconst deleteAccountComment = async (accountId: string, accountCommentIndex: number) => {\n const { accountsComments } = accountsStore.getState();\n const accountComments = accountsComments[accountId] || [];\n assert(\n accountCommentIndex >= 0 && accountCommentIndex < accountComments.length,\n `accountsActions.deleteComment index '${accountCommentIndex}' out of range`,\n );\n\n abandonAndStopPublishSession(accountId, accountCommentIndex);\n shiftPublishSessionIndicesAfterDelete(accountId, accountCommentIndex);\n\n const spliced = [...accountComments];\n spliced.splice(accountCommentIndex, 1);\n const reindexed = spliced.map((c, i) => ({ ...c, index: i, accountId }));\n const newAccountsComments = { ...accountsComments, [accountId]: reindexed };\n const newCommentCidsToAccountsComments = getCommentCidsToAccountsComments(newAccountsComments);\n\n accountsStore.setState(({ accountsCommentsIndexes }) => ({\n accountsComments: newAccountsComments,\n accountsCommentsIndexes: {\n ...accountsCommentsIndexes,\n [accountId]: getAccountCommentsIndex(reindexed),\n },\n commentCidsToAccountsComments: newCommentCidsToAccountsComments,\n }));\n notifyShiftedPublishSessions(accountId, accountCommentIndex);\n\n await accountsDatabase.deleteAccountComment(accountId, accountCommentIndex);\n\n log(\"accountsActions.deleteComment\", { accountId, accountCommentIndex });\n};\n\n// deletes a comment that is still publishing from where its session has it now, in the account that\n// published it, so a deletion that shifted it or a change of the active account can't redirect it\nconst abandonPublishSession = async (sessionId: string) => {\n const session = getPublishSession(sessionId);\n if (!session || isPublishSessionAbandoned(sessionId)) return;\n await deleteAccountComment(session.accountId, session.currentIndex);\n};\n\nexport const publishVote = async (publishVoteOptions: PublishVoteOptions, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishVoteArguments({\n publishVoteOptions,\n accountName,\n account,\n });\n\n let createVoteOptions: any = normalizePublicationOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n author: account.author,\n signer: account.signer,\n ...publishVoteOptions,\n });\n delete createVoteOptions.onChallenge;\n delete createVoteOptions.onChallengeVerification;\n delete createVoteOptions.onError;\n delete createVoteOptions.onPublishingStateChange;\n delete createVoteOptions._onVotePublishSession;\n const { commentCid } = createVoteOptions;\n // started before the community's wordfilters load, so abandoning the vote meanwhile ends it\n const votePublishSession = startVotePublishSession(\n account.id,\n commentCid,\n accountsStore.getState().accountsVotes[account.id]?.[commentCid],\n );\n const votePublishSessionKey = getVotePublishSessionKey(account.id, commentCid);\n const isVotePublishSessionActive = () =>\n activeVotePublishSessions.get(votePublishSessionKey) === votePublishSession;\n // the hooks abandon this vote's session in the account that published it, whichever is active\n publishVoteOptions._onVotePublishSession?.(() =>\n abandonVotePublishSession(account.id, commentCid, votePublishSession),\n );\n // counted as a vote being created, so the rest of the burst can't end the session meanwhile\n votePublishSession.creating++;\n try {\n createVoteOptions = await applyPublicationWordfilters(\"vote\", createVoteOptions, account);\n } catch (error) {\n votePublishSession.creating--;\n if (\n votePublishSession.publications.size === 0 &&\n votePublishSession.creating === 0 &&\n isVotePublishSessionActive()\n ) {\n endVotePublishSession(account.id, commentCid);\n }\n throw error;\n }\n votePublishSession.creating--;\n // abandoned while the wordfilters loaded: nothing was published or written, so stop here\n if (!isVotePublishSessionActive()) return;\n // the account was deleted while the wordfilters loaded: nothing was published or written. Its\n // delete only abandoned the sessions that existed when it started, so end this one here\n if (isAccountDeleted(account.id)) {\n endVotePublishSession(account.id, commentCid);\n return;\n }\n const accountsState = accountsStore.getState();\n const accountCommentInfo =\n accountsState.commentCidsToAccountsComments[createVoteOptions.commentCid];\n const accountComment = accountCommentInfo\n ? accountsState.accountsComments[accountCommentInfo.accountId]?.[\n accountCommentInfo.accountCommentIndex\n ]\n : undefined;\n const previousAccountVote =\n accountsState.accountsVotes[account.id]?.[createVoteOptions.commentCid];\n const storedCreateVoteOptions = addOptimisticVoteMetadata(\n normalizePublicationOptionsForStore(createVoteOptions),\n previousAccountVote,\n getFreshestLoadedComment(createVoteOptions.commentCid, accountComment),\n );\n const accountVote: AccountVote = {\n ...storedCreateVoteOptions,\n // remove signer and author because not needed and they expose private key\n signer: undefined,\n author: undefined,\n };\n const createSessionVote = async () => {\n votePublishSession.creating++;\n try {\n return backfillPublicationCommunityAddress(\n await account.pkc.createVote(createVoteOptions),\n createVoteOptions,\n );\n } finally {\n votePublishSession.creating--;\n }\n };\n\n let resolveAccountVoteWritten!: () => void;\n const accountVoteWritten = new Promise<void>((resolve) => (resolveAccountVoteWritten = resolve));\n // a publication is verified, rejected by the community, or failed to publish: it is no longer\n // abandonable. The session ends only once no other publication of the burst is waiting on its\n // challenge or still being created, and only if a newer session has not replaced it in the\n // meantime; if one of them failed, the account vote goes back to the last one verified.\n const endVotePublication = async (endedVote: any, verified: boolean) => {\n // already ended, e.g. publish() rejecting after its error event\n if (!votePublishSession.publications.delete(endedVote)) return;\n if (verified) {\n // the verified vote is the one the account has now, so abandoning the rest of the burst\n // restores it instead of the vote from before the burst\n votePublishSession.previousAccountVote = accountVote;\n } else {\n votePublishSession.failed = true;\n }\n await endVotePublishSessionIfSettled();\n };\n const endVotePublishSessionIfSettled = async () => {\n if (\n votePublishSession.publications.size !== 0 ||\n votePublishSession.creating !== 0 ||\n !isVotePublishSessionActive()\n ) {\n return;\n }\n activeVotePublishSessions.delete(votePublishSessionKey);\n if (!votePublishSession.failed) return;\n try {\n // the optimistic write may still be running when the publication fails fast\n await accountVoteWritten;\n await restoreAccountVote(\n account.id,\n createVoteOptions.commentCid,\n votePublishSession.previousAccountVote,\n );\n } catch (error) {\n log.error(\"accountsActions.publishVote restore failed vote error\", { error });\n }\n };\n\n let vote = await createSessionVote().catch(async (error) => {\n // nothing was published or written for this vote, but an earlier vote of the burst may have\n // failed while it was being created and left the session for this one to end\n resolveAccountVoteWritten();\n await endVotePublishSessionIfSettled();\n throw error;\n });\n // abandoned while the vote was being created: nothing was published or written, so stop here\n if (!isVotePublishSessionActive()) return;\n let lastChallenge: Challenge | undefined;\n const publishAndRetryFailedChallengeVerification = async () => {\n const activeVote = vote;\n votePublishSession.publications.add(vote);\n // only an error that ended the publish fails the vote\n const errorReporter = createPublicationErrorReporter(\n activeVote,\n publishVoteOptions.onError,\n () => endVotePublication(activeVote, false),\n );\n vote.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishVoteOptions.onChallenge(challenge, withPublishChallengeAnswersCompat(vote, challenge));\n });\n vote.once(\"challengeverification\", async (challengeVerification: ChallengeVerification) => {\n errorReporter.onChallengeVerification();\n publishVoteOptions.onChallengeVerification(challengeVerification, vote);\n // same terminal short-circuit as publishComment/publishCommentEdit: never retry a rejection\n if (\n !challengeVerification.challengeSuccess &&\n lastChallenge &&\n !hasTerminalChallengeVerificationError(challengeVerification)\n ) {\n // publish again automatically on fail\n votePublishSession.publications.delete(vote);\n createVoteOptions = { ...createVoteOptions, timestamp: Math.floor(Date.now() / 1000) };\n try {\n vote = await createSessionVote();\n } catch (error) {\n // no retry was published, so the failed vote ends the burst like a rejected one\n votePublishSession.failed = true;\n await endVotePublishSessionIfSettled();\n publishVoteOptions.onError?.(error, activeVote, { final: true });\n return;\n }\n if (!isVotePublishSessionActive()) return;\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n } else {\n await endVotePublication(activeVote, challengeVerification.challengeSuccess);\n }\n });\n vote.on(\"error\", errorReporter.reportErrorEvent);\n // TODO: add publishingState to account votes\n vote.on(\"publishingstatechange\", (publishingState: string) =>\n publishVoteOptions.onPublishingStateChange?.(publishingState, activeVote),\n );\n listeners.push(vote);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await vote.publish();\n } catch (error) {\n await errorReporter.reportPublishRejection(error);\n }\n };\n\n publishAndRetryFailedChallengeVerification();\n try {\n await accountsDatabase.addAccountVote(account.id, storedCreateVoteOptions);\n log(\"accountsActions.publishVote\", { createVoteOptions });\n accountsStore.setState(({ accountsVotes }) => ({\n accountsVotes: {\n ...accountsVotes,\n [account.id]: {\n ...accountsVotes[account.id],\n [storedCreateVoteOptions.commentCid]: accountVote,\n },\n },\n }));\n } finally {\n resolveAccountVoteWritten();\n }\n};\n\n/**\n * Stops the vote publications still waiting on a challenge for a comment and restores the account\n * vote they optimistically replaced. Does nothing once the vote has been verified.\n */\nexport const abandonVote = async (commentCid: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n assert(account?.id, `accountsActions.abandonVote account.id '${account?.id}' doesn't exist`);\n assert(\n commentCid && typeof commentCid === \"string\",\n `accountsActions.abandonVote commentCid '${commentCid}' not a string`,\n );\n await abandonVotePublishSession(account.id, commentCid);\n};\n\n// with votePublishSession, abandons only that session, not a newer one for the same comment\nconst abandonVotePublishSession = async (\n accountId: string,\n commentCid: string,\n votePublishSession?: VotePublishSession,\n) => {\n const session = activeVotePublishSessions.get(getVotePublishSessionKey(accountId, commentCid));\n if (!session || (votePublishSession && session !== votePublishSession)) return;\n endVotePublishSession(accountId, commentCid);\n\n for (const publication of session.publications) {\n try {\n const stop = publication?.stop?.bind(publication);\n if (typeof stop === \"function\") await stop();\n } catch (e) {\n log.error(\"vote.stop() error during abandon\", {\n accountId,\n commentCid,\n error: e,\n });\n }\n }\n await restoreAccountVote(accountId, commentCid, session.previousAccountVote);\n log(\"accountsActions.abandonVote\", { accountId, commentCid });\n};\n\nexport const publishCommentEdit = async (\n publishCommentEditOptions: PublishCommentEditOptions,\n accountName?: string,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishCommentEditArguments({\n publishCommentEditOptions,\n accountName,\n account,\n });\n\n let createCommentEditOptions: any = normalizePublicationOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n author: account.author,\n signer: account.signer,\n ...publishCommentEditOptions,\n });\n delete createCommentEditOptions.onChallenge;\n delete createCommentEditOptions.onChallengeVerification;\n delete createCommentEditOptions.onError;\n delete createCommentEditOptions.onPublishingStateChange;\n createCommentEditOptions = await applyPublicationWordfilters(\n \"commentEdit\",\n createCommentEditOptions,\n account,\n );\n const storedCreateCommentEditOptions = {\n ...normalizePublicationOptionsForStore(createCommentEditOptions),\n clientId: uuid(),\n };\n const storedCommentEdit = sanitizeStoredAccountEdit(storedCreateCommentEditOptions);\n\n let commentEdit = backfillPublicationCommunityAddress(\n await account.pkc.createCommentEdit(createCommentEditOptions),\n createCommentEditOptions,\n );\n let lastChallenge: Challenge | undefined;\n let challengeSucceeded = false;\n let rollbackPendingEditPromise: Promise<void> | undefined;\n const rollbackStoredCommentEdit = () => {\n if (!rollbackPendingEditPromise && !challengeSucceeded) {\n rollbackPendingEditPromise = Promise.all([\n accountsDatabase.deleteAccountEdit(account.id, storedCommentEdit),\n Promise.resolve(\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = removeStoredAccountEditSummaryFromState(\n accountsEditsSummaries,\n accountsEdits,\n account.id,\n storedCommentEdit,\n );\n Object.assign(\n nextState,\n removeStoredAccountEditFromState(accountsEdits, account.id, storedCommentEdit),\n );\n return nextState;\n }),\n ),\n ]).then(() => {});\n }\n return rollbackPendingEditPromise;\n };\n\n await accountsDatabase.addAccountEdit(account.id, storedCreateCommentEditOptions);\n log(\"accountsActions.publishCommentEdit\", { createCommentEditOptions });\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = addStoredAccountEditSummaryToState(\n accountsEditsSummaries,\n account.id,\n storedCommentEdit,\n );\n Object.assign(\n nextState,\n addStoredAccountEditToState(accountsEdits, account.id, storedCommentEdit),\n );\n return nextState;\n });\n\n const publishAndRetryFailedChallengeVerification = async () => {\n const activeCommentEdit = commentEdit;\n // only an error that ended the publish rolls back the edit\n const errorReporter = createPublicationErrorReporter(\n activeCommentEdit,\n publishCommentEditOptions.onError,\n rollbackStoredCommentEdit,\n );\n commentEdit.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishCommentEditOptions.onChallenge(\n challenge,\n withPublishChallengeAnswersCompat(commentEdit, challenge),\n );\n });\n commentEdit.once(\n \"challengeverification\",\n async (challengeVerification: ChallengeVerification) => {\n errorReporter.onChallengeVerification();\n publishCommentEditOptions.onChallengeVerification(challengeVerification, commentEdit);\n if (challengeVerification.challengeSuccess) {\n challengeSucceeded = true;\n }\n if (hasTerminalChallengeVerificationError(challengeVerification)) {\n lastChallenge = undefined;\n await rollbackStoredCommentEdit();\n return;\n }\n if (!challengeVerification.challengeSuccess && lastChallenge) {\n // publish again automatically on fail\n createCommentEditOptions = {\n ...createCommentEditOptions,\n timestamp: Math.floor(Date.now() / 1000),\n };\n commentEdit = backfillPublicationCommunityAddress(\n await account.pkc.createCommentEdit(createCommentEditOptions),\n createCommentEditOptions,\n );\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n }\n },\n );\n commentEdit.on(\"error\", errorReporter.reportErrorEvent);\n // TODO: add publishingState to account edits\n commentEdit.on(\"publishingstatechange\", (publishingState: string) =>\n publishCommentEditOptions.onPublishingStateChange?.(publishingState, activeCommentEdit),\n );\n listeners.push(commentEdit);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await commentEdit.publish();\n } catch (error) {\n await errorReporter.reportPublishRejection(error);\n }\n };\n\n publishAndRetryFailedChallengeVerification();\n};\n\nexport const publishCommentModeration = async (\n publishCommentModerationOptions: PublishCommentModerationOptions,\n accountName?: string,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishCommentModerationArguments({\n publishCommentModerationOptions,\n accountName,\n account,\n });\n\n let createCommentModerationOptions: any = normalizePublicationOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n author: account.author,\n signer: account.signer,\n ...publishCommentModerationOptions,\n });\n delete createCommentModerationOptions.onChallenge;\n delete createCommentModerationOptions.onChallengeVerification;\n delete createCommentModerationOptions.onError;\n delete createCommentModerationOptions.onPublishingStateChange;\n createCommentModerationOptions = await applyPublicationWordfilters(\n \"commentModeration\",\n createCommentModerationOptions,\n account,\n );\n const storedCreateCommentModerationOptions = {\n ...normalizePublicationOptionsForStore(createCommentModerationOptions),\n clientId: uuid(),\n };\n const storedCommentModeration = sanitizeStoredAccountEdit(storedCreateCommentModerationOptions);\n\n let commentModeration = backfillPublicationCommunityAddress(\n await account.pkc.createCommentModeration(createCommentModerationOptions),\n createCommentModerationOptions,\n );\n let lastChallenge: Challenge | undefined;\n let challengeSucceeded = false;\n let storedCommentModerationAdded = false;\n let rollbackStoredCommentModerationRequested = false;\n let rollbackPendingEditPromise: Promise<void> | undefined;\n const rollbackStoredCommentModeration = () => {\n rollbackStoredCommentModerationRequested = true;\n if (!storedCommentModerationAdded) {\n return Promise.resolve();\n }\n if (!rollbackPendingEditPromise && !challengeSucceeded) {\n rollbackPendingEditPromise = Promise.all([\n accountsDatabase.deleteAccountEdit(account.id, storedCommentModeration),\n Promise.resolve(\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = removeStoredAccountEditSummaryFromState(\n accountsEditsSummaries,\n accountsEdits,\n account.id,\n storedCommentModeration,\n );\n Object.assign(\n nextState,\n removeStoredAccountEditFromState(accountsEdits, account.id, storedCommentModeration),\n );\n return nextState;\n }),\n ),\n ]).then(() => {});\n }\n return rollbackPendingEditPromise || Promise.resolve();\n };\n\n const publishAndRetryFailedChallengeVerification = async () => {\n const activeCommentModeration = commentModeration;\n // only an error that ended the publish rolls back the moderation\n const errorReporter = createPublicationErrorReporter(\n activeCommentModeration,\n publishCommentModerationOptions.onError,\n rollbackStoredCommentModeration,\n );\n commentModeration.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishCommentModerationOptions.onChallenge(\n challenge,\n withPublishChallengeAnswersCompat(commentModeration, challenge),\n );\n });\n commentModeration.once(\n \"challengeverification\",\n async (challengeVerification: ChallengeVerification) => {\n errorReporter.onChallengeVerification();\n publishCommentModerationOptions.onChallengeVerification(\n challengeVerification,\n commentModeration,\n );\n if (challengeVerification.challengeSuccess) {\n challengeSucceeded = true;\n }\n if (hasTerminalChallengeVerificationError(challengeVerification)) {\n lastChallenge = undefined;\n await rollbackStoredCommentModeration();\n return;\n }\n if (!challengeVerification.challengeSuccess && lastChallenge) {\n // publish again automatically on fail\n createCommentModerationOptions = {\n ...createCommentModerationOptions,\n timestamp: Math.floor(Date.now() / 1000),\n };\n commentModeration = backfillPublicationCommunityAddress(\n await account.pkc.createCommentModeration(createCommentModerationOptions),\n createCommentModerationOptions,\n );\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n }\n },\n );\n commentModeration.on(\"error\", errorReporter.reportErrorEvent);\n // TODO: add publishingState to account edits\n commentModeration.on(\"publishingstatechange\", (publishingState: string) =>\n publishCommentModerationOptions.onPublishingStateChange?.(\n publishingState,\n activeCommentModeration,\n ),\n );\n listeners.push(commentModeration);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await commentModeration.publish();\n } catch (error) {\n await errorReporter.reportPublishRejection(error);\n }\n };\n\n publishAndRetryFailedChallengeVerification();\n\n await accountsDatabase.addAccountEdit(account.id, storedCreateCommentModerationOptions);\n log(\"accountsActions.publishCommentModeration\", { createCommentModerationOptions });\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = addStoredAccountEditSummaryToState(\n accountsEditsSummaries,\n account.id,\n storedCommentModeration,\n );\n Object.assign(\n nextState,\n addStoredAccountEditToState(accountsEdits, account.id, storedCommentModeration),\n );\n return nextState;\n });\n storedCommentModerationAdded = true;\n if (rollbackStoredCommentModerationRequested) {\n await rollbackStoredCommentModeration();\n }\n};\n\nexport const publishCommunityEdit = async (\n communityAddress: string,\n publishCommunityEditOptions: PublishCommunityEditOptions,\n accountName?: string,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsPublishCommunityEditArguments({\n communityAddress,\n publishCommunityEditOptions,\n accountName,\n account,\n });\n\n const communityEditOptions = { ...publishCommunityEditOptions };\n delete communityEditOptions.onChallenge;\n delete communityEditOptions.onChallengeVerification;\n delete communityEditOptions.onError;\n delete communityEditOptions.onPublishingStateChange;\n let createCommunityEditOptions: any = normalizeCommunityEditOptionsForPkc(account.pkc, {\n timestamp: Math.floor(Date.now() / 1000),\n author: account.author,\n signer: account.signer,\n // the current address, a new address is in communityEdit.address, which the hosting node only\n // accepts from the owner\n communityAddress,\n communityEdit: communityEditOptions,\n });\n createCommunityEditOptions = await applyPublicationWordfilters(\n \"communityEdit\",\n createCommunityEditOptions,\n account,\n );\n const storedCreateCommunityEditOptions = {\n ...normalizePublicationOptionsForStore(createCommunityEditOptions),\n clientId: uuid(),\n };\n const storedCommunityEdit = sanitizeStoredAccountEdit(storedCreateCommunityEditOptions);\n let challengeSucceeded = false;\n let rollbackPendingEditPromise: Promise<void> | undefined;\n const rollbackStoredCommunityEdit = () => {\n if (!rollbackPendingEditPromise && !challengeSucceeded) {\n rollbackPendingEditPromise = Promise.all([\n accountsDatabase.deleteAccountEdit(account.id, storedCommunityEdit),\n Promise.resolve(\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = removeStoredAccountEditSummaryFromState(\n accountsEditsSummaries,\n accountsEdits,\n account.id,\n storedCommunityEdit,\n );\n Object.assign(\n nextState,\n removeStoredAccountEditFromState(accountsEdits, account.id, storedCommunityEdit),\n );\n return nextState;\n }),\n ),\n ]).then(() => {});\n }\n return rollbackPendingEditPromise;\n };\n const storePublishedCommunityEdit = async () => {\n await accountsDatabase.addAccountEdit(account.id, storedCreateCommunityEditOptions);\n accountsStore.setState(({ accountsEdits, accountsEditsSummaries }) => {\n const nextState: any = addStoredAccountEditSummaryToState(\n accountsEditsSummaries,\n account.id,\n storedCommunityEdit,\n );\n Object.assign(\n nextState,\n addStoredAccountEditToState(accountsEdits, account.id, storedCommunityEdit),\n );\n return nextState;\n });\n };\n\n // the connected pkc instance hosts the community and can edit it locally, no need to publish\n if (pkcHostsCommunity(account, communityAddress)) {\n // use the wordfiltered edit so the applied community state matches the stored account edit\n await communitiesStore\n .getState()\n .editCommunity(communityAddress, createCommunityEditOptions.communityEdit, account);\n await storePublishedCommunityEdit();\n // create fake success challenge verification for consistent behavior with remote community edit\n publishCommunityEditOptions.onChallengeVerification({ challengeSuccess: true });\n publishCommunityEditOptions.onPublishingStateChange?.(\"succeeded\");\n return;\n }\n\n let communityEdit = backfillPublicationCommunityAddress(\n await createPkcCommunityEdit(account.pkc, createCommunityEditOptions),\n createCommunityEditOptions,\n );\n let lastChallenge: Challenge | undefined;\n const publishAndRetryFailedChallengeVerification = async () => {\n const activeCommunityEdit = communityEdit;\n // only an error that ended the publish rolls back the edit\n const errorReporter = createPublicationErrorReporter(\n activeCommunityEdit,\n publishCommunityEditOptions.onError,\n rollbackStoredCommunityEdit,\n );\n communityEdit.once(\"challenge\", async (challenge: Challenge) => {\n lastChallenge = challenge;\n publishCommunityEditOptions.onChallenge(\n challenge,\n withPublishChallengeAnswersCompat(communityEdit, challenge),\n );\n });\n communityEdit.once(\n \"challengeverification\",\n async (challengeVerification: ChallengeVerification) => {\n errorReporter.onChallengeVerification();\n publishCommunityEditOptions.onChallengeVerification(challengeVerification, communityEdit);\n if (challengeVerification.challengeSuccess) {\n challengeSucceeded = true;\n }\n if (hasTerminalChallengeVerificationError(challengeVerification)) {\n lastChallenge = undefined;\n await rollbackStoredCommunityEdit();\n return;\n }\n if (!challengeVerification.challengeSuccess && lastChallenge) {\n // publish again automatically on fail\n createCommunityEditOptions = {\n ...createCommunityEditOptions,\n timestamp: Math.floor(Date.now() / 1000),\n };\n communityEdit = backfillPublicationCommunityAddress(\n await createPkcCommunityEdit(account.pkc, createCommunityEditOptions),\n createCommunityEditOptions,\n );\n lastChallenge = undefined;\n publishAndRetryFailedChallengeVerification();\n }\n },\n );\n communityEdit.on(\"error\", errorReporter.reportErrorEvent);\n // TODO: add publishingState to account edits\n communityEdit.on(\"publishingstatechange\", (publishingState: string) =>\n publishCommunityEditOptions.onPublishingStateChange?.(publishingState, activeCommunityEdit),\n );\n listeners.push(communityEdit);\n try {\n // publish will resolve after the challenge request\n // if it fails before, like failing to resolve ENS, we can emit the error\n await communityEdit.publish();\n } catch (error) {\n await errorReporter.reportPublishRejection(error);\n }\n };\n\n await storePublishedCommunityEdit();\n publishAndRetryFailedChallengeVerification();\n log(\"accountsActions.publishCommunityEdit\", { createCommunityEditOptions });\n};\n\nexport const createCommunity = async (\n createCommunityOptions: CreateCommunityOptions,\n accountName?: string,\n) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountsActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n validator.validateAccountsActionsCreateCommunityArguments(createCommunityOptions);\n\n const community = await communitiesStore\n .getState()\n .createCommunity(createCommunityOptions, account);\n log(\"accountsActions.createCommunity\", { createCommunityOptions, community });\n return community;\n};\n\nexport const deleteCommunity = async (communityAddress: string, accountName?: string) => {\n const { accounts, accountNamesToAccountIds, activeAccountId } = accountsStore.getState();\n assert(\n accounts && accountNamesToAccountIds && activeAccountId,\n `can't use accountsStore.accountsActions before initialized`,\n );\n let account = accounts[activeAccountId];\n if (accountName) {\n const accountId = accountNamesToAccountIds[accountName];\n account = accounts[accountId];\n }\n\n // read the other identifiers of the community (name, public key) before the store forgets them\n const deletedCommunity = communitiesStore.getState().communities[communityAddress];\n await communitiesStore.getState().deleteCommunity(communityAddress, account);\n\n // remove the deleted community from the deleting account's stored communities, under every\n // address it is known by, or useAccountCommunities keeps listing it. Other local accounts keep\n // their entry: they did not delete the community\n const isDeletedCommunity = (accountCommunityAddress: string) =>\n doesAddressMatchCommunityRef(\n accountCommunityAddress,\n { address: communityAddress },\n deletedCommunity,\n );\n // a saveComment still writing has the database ahead of the store: let it merge first, or the\n // store snapshot written below drops its saved comment\n while (savedCommentMutationQueues.has(account.id)) {\n await savedCommentMutationQueues.get(account.id)?.catch(() => {});\n }\n // the account was deleted while the community was: writing it would restore its record\n if (isAccountDeleted(account.id)) {\n return;\n }\n let updatedAccount: Account | undefined;\n accountsStore.setState(({ accounts }) => {\n const currentAccount = accounts[account.id];\n const addressesToRemove = Object.keys(currentAccount?.communities || {}).filter(\n isDeletedCommunity,\n );\n if (!addressesToRemove.length) {\n return {};\n }\n const communities = { ...currentAccount.communities };\n for (const address of addressesToRemove) {\n delete communities[address];\n }\n updatedAccount = { ...currentAccount, communities };\n return { accounts: { ...accounts, [account.id]: updatedAccount } };\n });\n if (updatedAccount) {\n await accountsDatabase.addAccount(updatedAccount);\n }\n log(\"accountsActions.deleteCommunity\", { communityAddress });\n};\n"]}
|