@bitsocial/bitsocial-react-hooks 0.3.2 → 0.3.4
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 +29 -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 +96 -70
- package/dist/stores/accounts/accounts-actions.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 +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkc-js-mock.js","sourceRoot":"","sources":["../../../src/lib/pkc-js/pkc-js-mock.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAIlC,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;AAExF,sDAAsD;AACtD,kDAAkD;AAClD,IAAI,uBAAuB,GAAQ,EAAE,CAAC;AACtC,IAAI,sBAAsB,GAAQ,EAAE,CAAC;AAErC,iDAAiD;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG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AAQ,WAAW;CAAG;AAEjD,MAAM,SAAS,GAAQ,CAAO,GAAG,IAAS,EAAE,EAAE;IAC5C,OAAO,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAA,CAAC;AAEF,SAAS,CAAC,eAAe,GAAG,CAAC,OAA4B,EAAE,EAAE;IAC3D,MAAM,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC;IACjC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,CAAC,OAAwB,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC;IACzB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import EventEmitter from \"events\";\nimport type { PkcResolveAuthorNameOptions, PkcResolveAuthorNameResult } from \"../pkc-types\";\nimport type { ChallengeAnswersByIndex } from \"../../types\";\n\nconst loadingTime = 10;\nexport const simulateLoadingTime = () => new Promise((r) => setTimeout(r, loadingTime));\n\n// keep a list of created and edited owner communities\n// to reinitialize them with pkc.createCommunity()\nlet createdOwnerCommunities: any = {};\nlet editedOwnerCommunities: any = {};\n\n// reset the pkc-js global state in between tests\nexport const resetPkcJsMock = () => {\n createdOwnerCommunities = {};\n editedOwnerCommunities = {};\n};\nexport const debugPkcJsMock = () => {\n console.log({ createdOwnerCommunities, editedOwnerCommunities });\n};\n\nclass NameResolverClient extends EventEmitter {\n state = \"stopped\";\n}\n\nexport class PKC extends EventEmitter {\n nameResolvers: any[];\n _clientsManager: {\n clients: {\n nameResolvers: { [resolverKey: string]: NameResolverClient };\n };\n };\n\n constructor(options: any = {}) {\n super();\n this.nameResolvers = options?.nameResolvers || [];\n this._clientsManager = {\n clients: {\n nameResolvers: this.nameResolvers.reduce(\n (resolverClients: { [resolverKey: string]: NameResolverClient }, resolver: any) => ({\n ...resolverClients,\n [resolver.key]: new NameResolverClient(),\n }),\n {},\n ),\n },\n };\n }\n\n async resolveAuthorAddress(options: { address: string }) {\n const resolver = this.nameResolvers.find((nameResolver) =>\n nameResolver?.canResolve?.({ name: options.address }),\n );\n const resolverClient = resolver && this._clientsManager.clients.nameResolvers[resolver.key];\n if (resolverClient) {\n resolverClient.state = \"resolving-author-name\";\n resolverClient.emit(\"statechange\", resolverClient.state);\n }\n await simulateLoadingTime();\n if (resolverClient) {\n resolverClient.state = \"stopped\";\n resolverClient.emit(\"statechange\", resolverClient.state);\n }\n return \"resolved author address\";\n }\n\n async resolveAuthorName(\n options: PkcResolveAuthorNameOptions,\n ): Promise<PkcResolveAuthorNameResult> {\n const resolvedAuthorName = await this.resolveAuthorAddress({ address: options.name });\n return { resolvedAuthorName };\n }\n\n async createSigner() {\n return {\n privateKey: \"private key\",\n address: \"address\",\n };\n }\n\n async createCommunity(createCommunityOptions: any) {\n if (!createCommunityOptions) {\n createCommunityOptions = {};\n }\n const communityIdentifier =\n createCommunityOptions.address ||\n createCommunityOptions.name ||\n createCommunityOptions.publicKey;\n\n // no address provided so probably a user creating an owner community\n if (!communityIdentifier) {\n createCommunityOptions = {\n ...createCommunityOptions,\n address: \"created community address\",\n };\n // createdCommunityAddresses.push('created community address')\n createdOwnerCommunities[createCommunityOptions.address] = { ...createCommunityOptions };\n }\n // only address provided, so could be a previously created owner community\n // add props from previously created sub\n else if (\n (createdOwnerCommunities[createCommunityOptions.address] &&\n JSON.stringify(Object.keys(createCommunityOptions)) === '[\"address\"]') ||\n (createdOwnerCommunities[createCommunityOptions.name] &&\n JSON.stringify(Object.keys(createCommunityOptions)) === '[\"name\"]')\n ) {\n const ownerCommunityAddress = createCommunityOptions.address || createCommunityOptions.name;\n for (const prop in createdOwnerCommunities[ownerCommunityAddress]) {\n if (createdOwnerCommunities[ownerCommunityAddress][prop]) {\n createCommunityOptions[prop] = createdOwnerCommunities[ownerCommunityAddress][prop];\n }\n }\n }\n\n // add edited props if owner community was edited in the past\n if (editedOwnerCommunities[createCommunityOptions.address]) {\n for (const prop in editedOwnerCommunities[createCommunityOptions.address]) {\n if (editedOwnerCommunities[createCommunityOptions.address][prop]) {\n createCommunityOptions[prop] =\n editedOwnerCommunities[createCommunityOptions.address][prop];\n }\n }\n }\n\n return new Community(createCommunityOptions);\n }\n\n async getCommunity(options: { address: string }) {\n const address = options?.address;\n await simulateLoadingTime();\n const createCommunityOptions = { address };\n const community: any = new Community(createCommunityOptions);\n community.title = community.address + \" title\";\n const hotPageCid = community.address + \" page cid hot\";\n community.posts.pages.hot = community.posts.pageToGet(hotPageCid);\n community.posts.pageCids = {\n hot: hotPageCid,\n topAll: community.address + \" page cid topAll\",\n new: community.address + \" page cid new\",\n active: community.address + \" page cid active\",\n };\n community.modQueue.pageCids = {\n pendingApproval: community.address + \" page cid pendingApproval\",\n };\n return community;\n }\n\n // TODO: implement event communitieschange\n get communities() {\n return [\n ...new Set([\n \"list community address 1\",\n \"list community address 2\",\n ...Object.keys(createdOwnerCommunities),\n ]),\n ].map((address) => ({ publicKey: address, address, started: false }));\n }\n\n async createComment(createCommentOptions: any) {\n return new Comment(createCommentOptions);\n }\n\n async getComment(options: { cid: string }) {\n const cid = options?.cid;\n await simulateLoadingTime();\n const createCommentOptions = {\n cid,\n // useComment() requires timestamp or will use account comment instead of comment from store\n timestamp: 1670000000,\n ...this.commentToGet(cid),\n };\n return new Comment(createCommentOptions);\n }\n\n // mock this method to get a comment with different content, timestamp, address, etc\n commentToGet(commentCid?: string) {\n return {\n // content: 'mock some content'\n // author: {address: 'mock some address'},\n // timestamp: 1234\n };\n }\n\n async createVote() {\n return new Vote();\n }\n\n async createCommentEdit(createCommentEditOptions: any) {\n return new CommentEdit(createCommentEditOptions);\n }\n\n async createCommentModeration(createCommentModerationOptions: any) {\n return new CommentModeration(createCommentModerationOptions);\n }\n\n async createCommunityEdit(createCommunityEditOptions: any) {\n return new CommunityEdit(createCommunityEditOptions);\n }\n\n async fetchCid(options: { cid: string }) {\n const cid = options?.cid;\n if (cid?.startsWith(\"statscid\")) {\n return JSON.stringify({ hourActiveUserCount: 1 });\n }\n throw Error(`pkc.fetchCid not implemented in pkc-js mock for cid '${cid}'`);\n }\n\n async pubsubSubscribe(communityAddress: string) {}\n async pubsubUnsubscribe(communityAddress: string) {}\n\n clients = (() => {\n const pkcRpcClients = {\n \"http://localhost:9138\": new PkcRpcClient(),\n };\n return {\n pkcRpcClients,\n };\n })();\n\n async validateComment(comment: any, validateCommentOptions: any) {}\n}\n\nclass PkcRpcClient extends EventEmitter {\n state = \"connecting\";\n settings: any = undefined;\n constructor() {\n super();\n // simulate connecting to the rpc\n setTimeout(() => {\n this.state = \"connected\";\n this.settings = { challenges: {} };\n this.emit(\"statechange\", this.state);\n this.emit(\"settingschange\", this.settings);\n }, 10);\n }\n\n async setSettings(settings: any) {\n this.settings = settings;\n this.emit(\"settingschange\", this.settings);\n }\n}\n\nexport class Pages {\n pageCids: any = {};\n pages: any = {};\n community: any;\n comment: any;\n\n constructor(pagesOptions?: any) {\n Object.defineProperty(this, \"community\", {\n value: pagesOptions?.community,\n enumerable: false,\n });\n Object.defineProperty(this, \"comment\", { value: pagesOptions?.comment, enumerable: false });\n }\n\n async getPage(options: { cid: string }) {\n const cid = options?.cid;\n // need to wait twice otherwise react renders too fast and fetches too many pages in advance\n await simulateLoadingTime();\n return this.pageToGet(cid);\n }\n\n async validatePage(page: any) {}\n\n // mock this method to get pages with different content, or use to getPage without simulated loading time\n pageToGet(pageCid: string) {\n const communityAddress = this.community?.address || this.comment?.communityAddress;\n const isPendingApprovalPage = pageCid.includes(\"pendingApproval\");\n const page: any = {\n nextCid: communityAddress + \" \" + pageCid + \" - next page cid\",\n comments: [],\n };\n const postCount = 100;\n let index = 0;\n while (index++ < postCount) {\n const comment: any = {\n timestamp: index,\n cid: pageCid + \" comment cid \" + index,\n communityAddress,\n upvoteCount: index,\n downvoteCount: 10,\n author: {\n address: pageCid + \" author address \" + index,\n },\n updatedAt: index,\n };\n if (isPendingApprovalPage) {\n comment.pendingApproval = true;\n }\n page.comments.push(comment);\n }\n return page;\n }\n}\n\nexport class Community extends EventEmitter {\n updateCalledTimes = 0;\n stopCalledTimes = 0;\n updating = false;\n firstUpdate = true;\n address: string | undefined;\n publicKey: string | undefined;\n title: string | undefined;\n description: string | undefined;\n posts: Pages;\n modQueue: Pages;\n exportRecords: any[];\n updatedAt: number | undefined;\n statsCid: string | undefined;\n state: string;\n updatingState: string;\n\n constructor(createCommunityOptions?: any) {\n super();\n this.address =\n createCommunityOptions?.address ||\n createCommunityOptions?.name ||\n createCommunityOptions?.publicKey;\n this.publicKey = createCommunityOptions?.publicKey || this.address;\n this.title = createCommunityOptions?.title;\n this.description = createCommunityOptions?.description;\n this.statsCid = \"statscid\";\n this.state = \"stopped\";\n this.updatingState = \"stopped\";\n this.updatedAt = createCommunityOptions?.updatedAt;\n this.exportRecords = [];\n\n this.posts = new Pages({ community: this });\n // add community.posts from createCommunityOptions\n if (createCommunityOptions?.posts?.pages) {\n this.posts.pages = createCommunityOptions?.posts?.pages;\n }\n if (createCommunityOptions?.posts?.pageCids) {\n this.posts.pageCids = createCommunityOptions?.posts?.pageCids;\n }\n\n this.modQueue = new Pages({ community: this });\n // add community.modQueue from createCommunityOptions\n if (createCommunityOptions?.modQueue?.pageCids) {\n this.modQueue.pageCids = createCommunityOptions?.modQueue?.pageCids;\n }\n\n if (createCommunityOptions) {\n for (const prop in createCommunityOptions) {\n if (createCommunityOptions[prop] !== undefined) {\n const descriptor =\n Object.getOwnPropertyDescriptor(this, prop) ||\n Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), prop);\n if (descriptor && !descriptor.writable && !descriptor.set) {\n continue;\n }\n // @ts-ignore\n this[prop] = createCommunityOptions[prop];\n }\n }\n }\n\n const lookupKeys = [\"address\", \"name\", \"publicKey\"];\n const createCommunityOptionKeys = Object.keys(createCommunityOptions || {});\n const hasLookupIdentifier = Boolean(\n createCommunityOptions?.address ||\n createCommunityOptions?.name ||\n createCommunityOptions?.publicKey,\n );\n const lookupOnly =\n hasLookupIdentifier &&\n createCommunityOptionKeys.length > 0 &&\n createCommunityOptionKeys.every((key) => lookupKeys.includes(key));\n\n // only trigger a first update for lookup-only remote community instances\n if (!lookupOnly) {\n this.firstUpdate = false;\n }\n }\n\n async update() {\n this.updateCalledTimes++;\n if (!this.address) {\n throw Error(`can't update without community.address`);\n }\n // don't update twice\n if (this.updating) {\n return;\n }\n this.updating = true;\n\n this.state = \"updating\";\n this.updatingState = \"fetching-ipns\";\n this.emit(\"statechange\", \"updating\");\n this.emit(\"updatingstatechange\", \"fetching-ipns\");\n\n simulateLoadingTime().then(() => {\n this.simulateUpdateEvent();\n });\n }\n\n async stop() {\n this.stopCalledTimes++;\n if (this.state !== \"updating\") {\n return;\n }\n this.updating = false;\n this.state = \"stopped\";\n this.updatingState = \"stopped\";\n this.emit(\"statechange\", \"stopped\");\n this.emit(\"updatingstatechange\", \"stopped\");\n }\n\n async delete() {\n if (this.address) {\n delete createdOwnerCommunities[this.address];\n delete editedOwnerCommunities[this.address];\n }\n }\n\n get exports() {\n return this.exportRecords.map((record) => ({ ...record }));\n }\n\n async export(exportCommunityOptions: any = {}) {\n if (!this.address) {\n throw Error(`can't community.export with no community.address`);\n }\n const exportRecord = {\n exportId: `${this.address} export ${this.exportRecords.length + 1}`,\n name: this.address,\n publicKey: this.publicKey || this.address,\n includePrivateKey: exportCommunityOptions.includePrivateKey === true,\n progress: 1,\n url: `file://${this.address}.zip`,\n };\n this.exportRecords.push(exportRecord);\n this.emit(\"exportschange\", this.exports);\n return { exportId: exportRecord.exportId };\n }\n\n simulateUpdateEvent() {\n if (this.state === \"stopped\" && this.stopCalledTimes > 0) {\n return;\n }\n if (this.firstUpdate) {\n this.simulateFirstUpdateEvent();\n return;\n }\n\n this.description = this.address + \" description updated\";\n // @ts-ignore\n this.updatedAt = this.updatedAt + 1;\n\n this.updating = false;\n this.updatingState = \"succeeded\";\n this.emit(\"update\", this);\n this.emit(\"updatingstatechange\", \"succeeded\");\n }\n\n // the first update event adds all the field from getCommunity\n async simulateFirstUpdateEvent() {\n this.firstUpdate = false;\n this.updatedAt = Math.floor(Date.now() / 1000);\n\n this.title = this.address + \" title\";\n const hotPageCid = this.address + \" page cid hot\";\n this.posts.pages.hot = this.posts.pageToGet(hotPageCid);\n this.posts.pageCids = {\n hot: hotPageCid,\n topAll: this.address + \" page cid topAll\",\n new: this.address + \" page cid new\",\n active: this.address + \" page cid active\",\n };\n this.modQueue.pageCids = {\n pendingApproval: this.address + \" page cid pendingApproval\",\n };\n\n // simulate the ipns update\n this.updatingState = \"succeeded\";\n this.emit(\"update\", this);\n this.emit(\"updatingstatechange\", \"succeeded\");\n\n // simulate the next update\n this.updatingState = \"fetching-ipns\";\n this.emit(\"updatingstatechange\", \"fetching-ipns\");\n simulateLoadingTime().then(() => {\n this.simulateUpdateEvent();\n });\n }\n\n // use getting to easily mock it\n get roles() {\n return this.rolesToGet();\n }\n\n // mock this method to get different roles\n rolesToGet() {\n return {};\n }\n\n async edit(editCommunityOptions: any) {\n if (!this.address || typeof this.address !== \"string\") {\n throw Error(`can't community.edit with no community.address`);\n }\n const previousAddress = this.address;\n\n // do community.edit\n for (const prop in editCommunityOptions) {\n if (editCommunityOptions[prop] !== undefined) {\n const descriptor =\n Object.getOwnPropertyDescriptor(this, prop) ||\n Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), prop);\n if (descriptor && !descriptor.writable && !descriptor.set) {\n continue;\n }\n // @ts-ignore\n this[prop] = editCommunityOptions[prop];\n }\n }\n\n // keep a list of edited communities to reinitialize\n // them with pkc.createCommunity()\n editedOwnerCommunities[this.address] = {\n address: this.address,\n title: this.title,\n description: this.description,\n };\n\n // handle change of community.address\n if (editCommunityOptions.address) {\n // apply address change to editedOwnerCommunities\n editedOwnerCommunities[previousAddress] = {\n address: this.address,\n title: this.title,\n description: this.description,\n };\n delete editedOwnerCommunities[previousAddress];\n\n // apply address change to createdOwnerCommunities\n createdOwnerCommunities[this.address] = {\n ...createdOwnerCommunities[previousAddress],\n address: this.address,\n };\n delete createdOwnerCommunities[previousAddress];\n }\n }\n}\n// make roles enumarable so it acts like a regular prop\nObject.defineProperty(Community.prototype, \"roles\", { enumerable: true });\n\nlet challengeRequestCount = 0;\nlet challengeAnswerCount = 0;\n\nclass Publication extends EventEmitter {\n timestamp: number | undefined;\n content: string | undefined;\n cid: string | undefined;\n challengeRequestId = `r${++challengeRequestCount}`;\n challengeAnswerId = `a${++challengeAnswerCount}`;\n state: string | undefined;\n publishingState: string | undefined;\n\n async publish() {\n this.state = \"publishing\";\n this.publishingState = \"publishing-challenge-request\";\n this.emit(\"statechange\", \"publishing\");\n this.emit(\"publishingstatechange\", \"publishing-challenge-request\");\n\n await simulateLoadingTime();\n this.simulateChallengeEvent();\n }\n\n simulateChallengeEvent() {\n this.publishingState = \"waiting-challenge-answers\";\n this.emit(\"publishingstatechange\", \"waiting-challenge-answers\");\n\n const challenge = { type: \"text\", challenge: \"2+2=?\" };\n const challengeMessage = {\n type: \"CHALLENGE\",\n challengeRequestId: this.challengeRequestId,\n // keyed by challenge index, like pkc-js\n challenges: { \"0\": challenge },\n };\n this.emit(\"challenge\", challengeMessage, this);\n }\n\n async publishChallengeAnswers(options: { challengeAnswers: ChallengeAnswersByIndex }) {\n const challengeAnswers = options?.challengeAnswers;\n // pkc-js rejects an array or an empty record\n if (\n !challengeAnswers ||\n typeof challengeAnswers !== \"object\" ||\n Array.isArray(challengeAnswers) ||\n Object.keys(challengeAnswers).length === 0\n ) {\n throw Error(\n `pkc-js-mock publishChallengeAnswers: challengeAnswers must be a non-empty record keyed by challenge index, got '${JSON.stringify(challengeAnswers)}'`,\n );\n }\n this.publishingState = \"publishing-challenge-answer\";\n this.emit(\"publishingstatechange\", \"publishing-challenge-answer\");\n\n await simulateLoadingTime();\n this.publishingState = \"waiting-challenge-verification\";\n this.emit(\"publishingstatechange\", \"waiting-challenge-verification\");\n\n await simulateLoadingTime();\n this.simulateChallengeVerificationEvent();\n }\n\n simulateChallengeVerificationEvent() {\n // if publication has content, create cid for this content and add it to comment and challengeVerificationMessage\n this.cid = this.content && `${this.content} cid`;\n const commentUpdate = this.cid && { cid: this.cid };\n\n const challengeVerificationMessage = {\n type: \"CHALLENGEVERIFICATION\",\n challengeRequestId: this.challengeRequestId,\n challengeAnswerId: this.challengeAnswerId,\n challengeSuccess: true,\n commentUpdate,\n };\n this.emit(\"challengeverification\", challengeVerificationMessage, this);\n\n this.publishingState = \"succeeded\";\n this.emit(\"publishingstatechange\", \"succeeded\");\n }\n\n stop() {\n if (this.state === \"publishing\" || this.publishingState !== \"stopped\") {\n this.state = \"stopped\";\n this.publishingState = \"stopped\";\n this.emit(\"statechange\", \"stopped\");\n this.emit(\"publishingstatechange\", \"stopped\");\n }\n if ((this as any).updating || (this as any).updatingState !== \"stopped\") {\n (this as any).state = \"stopped\";\n (this as any).updating = false;\n (this as any).updatingState = \"stopped\";\n this.emit(\"statechange\", \"stopped\");\n this.emit(\"updatingstatechange\", \"stopped\");\n }\n }\n}\n\nexport class Comment extends Publication {\n updateCalledTimes = 0;\n updating = false;\n author: any;\n upvoteCount: number | undefined;\n downvoteCount: number | undefined;\n content: string | undefined;\n parentCid: string | undefined;\n replies: any;\n updatedAt: number | undefined;\n communityAddress: string | undefined;\n state: string;\n updatingState: string;\n publishingState: string;\n\n constructor(createCommentOptions?: any) {\n super();\n const rawComment = createCommentOptions?.raw?.comment;\n this.cid = createCommentOptions?.cid;\n this.upvoteCount = createCommentOptions?.upvoteCount;\n this.downvoteCount = createCommentOptions?.downvoteCount;\n this.content = createCommentOptions?.content ?? rawComment?.content;\n const author = createCommentOptions?.author ?? rawComment?.author;\n this.author = author ? { ...author } : undefined;\n this.timestamp = createCommentOptions?.timestamp ?? rawComment?.timestamp;\n this.parentCid = createCommentOptions?.parentCid ?? rawComment?.parentCid;\n this.communityAddress = createCommentOptions?.communityAddress ?? rawComment?.communityAddress;\n (this as any).crosspost = createCommentOptions?.crosspost ?? rawComment?.crosspost;\n (this as any).gallery = createCommentOptions?.gallery ?? rawComment?.gallery;\n (this as any).link = createCommentOptions?.link ?? rawComment?.link;\n (this as any).raw = createCommentOptions?.raw;\n (this as any).signature = createCommentOptions?.signature ?? rawComment?.signature;\n (this as any).title = createCommentOptions?.title ?? rawComment?.title;\n this.state = \"stopped\";\n this.updatingState = \"stopped\";\n this.publishingState = \"stopped\";\n\n if (this.author?.address) {\n this.author.shortAddress = `short ${this.author.address}`;\n }\n\n this.replies = new Pages({ comment: this });\n\n // add comment.replies from createCommentOptions\n if (createCommentOptions?.replies?.pages) {\n this.replies.pages = createCommentOptions?.replies?.pages;\n }\n if (createCommentOptions?.replies?.pageCids) {\n this.replies.pageCids = createCommentOptions?.replies?.pageCids;\n }\n }\n\n async update() {\n this.updateCalledTimes++;\n if (this.updateCalledTimes > 5) {\n throw Error(\n \"with the current hooks, comment.update() should be called maximum 5 times, this number might change if the hooks change and is only there to catch bugs, the real comment.update() can be called infinite times\",\n );\n }\n // don't update twice\n if (this.updating) {\n return;\n }\n this.updating = true;\n\n this.state = \"updating\";\n this.updatingState = \"fetching-ipfs\";\n this.emit(\"statechange\", \"updating\");\n this.emit(\"updatingstatechange\", \"fetching-ipfs\");\n\n simulateLoadingTime().then(() => {\n this.simulateUpdateEvent();\n });\n }\n\n simulateUpdateEvent() {\n if (!this.updating) {\n return;\n }\n // if timestamp isn't defined, simulate fetching the comment ipfs\n if (!this.timestamp) {\n this.simulateFetchCommentIpfsUpdateEvent();\n return;\n }\n\n // simulate finding vote counts on an IPNS record\n this.upvoteCount = typeof this.upvoteCount === \"number\" ? this.upvoteCount + 2 : 3;\n this.downvoteCount = typeof this.downvoteCount === \"number\" ? this.downvoteCount + 1 : 1;\n this.updatedAt = Math.floor(Date.now() / 1000);\n\n this.updatingState = \"succeeded\";\n this.emit(\"update\", this);\n this.emit(\"updatingstatechange\", \"succeeded\");\n }\n\n async simulateFetchCommentIpfsUpdateEvent() {\n if (!this.updating) {\n return;\n }\n // use pkc.getComment() so mocking PKC.prototype.getComment works\n const commentIpfs = await new PKC().getComment({ cid: this.cid || \"\" });\n if (!this.updating) {\n return;\n }\n this.content = commentIpfs.content;\n this.author = commentIpfs.author;\n this.timestamp = commentIpfs.timestamp;\n this.parentCid = commentIpfs.parentCid;\n this.communityAddress = commentIpfs.communityAddress;\n\n // simulate the ipns update\n this.updatingState = \"fetching-update-ipns\";\n this.emit(\"update\", this);\n this.emit(\"updatingstatechange\", \"fetching-update-ipns\");\n simulateLoadingTime().then(() => {\n this.simulateUpdateEvent();\n });\n }\n}\n\nexport class Vote extends Publication {}\n\nexport class CommentEdit extends Publication {}\n\nexport class CommentModeration extends Publication {}\n\nexport class CommunityEdit extends Publication {}\n\nconst createPkc: any = async (...args: any) => {\n return new PKC(...args);\n};\n\ncreatePkc.getShortAddress = (options: { address: string }) => {\n const address = options?.address;\n if (address.includes(\".\")) {\n return address;\n }\n return address.substring(2, 14);\n};\n\ncreatePkc.getShortCid = (options: { cid: string }) => {\n const cid = options?.cid;\n return cid.substring(2, 14);\n};\n\nexport default createPkc;\n"]}
|
|
1
|
+
{"version":3,"file":"pkc-js-mock.js","sourceRoot":"","sources":["../../../src/lib/pkc-js/pkc-js-mock.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAIlC,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;AAExF,sDAAsD;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S,CAAC,eAAe,GAAG,CAAC,OAA4B,EAAE,EAAE;IAC3D,MAAM,OAAO,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC;IACjC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,SAAS,CAAC,WAAW,GAAG,CAAC,OAAwB,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC;IACzB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import EventEmitter from \"events\";\nimport type { PkcResolveAuthorNameOptions, PkcResolveAuthorNameResult } from \"../pkc-types\";\nimport type { ChallengeAnswersByIndex } from \"../../types\";\n\nconst loadingTime = 10;\nexport const simulateLoadingTime = () => new Promise((r) => setTimeout(r, loadingTime));\n\n// keep a list of created and edited owner communities\n// to reinitialize them with pkc.createCommunity()\nlet createdOwnerCommunities: any = {};\nlet editedOwnerCommunities: any = {};\n\n// reset the pkc-js global state in between tests\nexport const resetPkcJsMock = () => {\n createdOwnerCommunities = {};\n editedOwnerCommunities = {};\n};\nexport const debugPkcJsMock = () => {\n console.log({ createdOwnerCommunities, editedOwnerCommunities });\n};\n\nclass NameResolverClient extends EventEmitter {\n state = \"stopped\";\n}\n\nexport class PKC extends EventEmitter {\n nameResolvers: any[];\n _clientsManager: {\n clients: {\n nameResolvers: { [resolverKey: string]: NameResolverClient };\n };\n };\n\n constructor(options: any = {}) {\n super();\n this.nameResolvers = options?.nameResolvers || [];\n this._clientsManager = {\n clients: {\n nameResolvers: this.nameResolvers.reduce(\n (resolverClients: { [resolverKey: string]: NameResolverClient }, resolver: any) => ({\n ...resolverClients,\n [resolver.key]: new NameResolverClient(),\n }),\n {},\n ),\n },\n };\n }\n\n async resolveAuthorAddress(options: { address: string }) {\n const resolver = this.nameResolvers.find((nameResolver) =>\n nameResolver?.canResolve?.({ name: options.address }),\n );\n const resolverClient = resolver && this._clientsManager.clients.nameResolvers[resolver.key];\n if (resolverClient) {\n resolverClient.state = \"resolving-author-name\";\n resolverClient.emit(\"statechange\", resolverClient.state);\n }\n await simulateLoadingTime();\n if (resolverClient) {\n resolverClient.state = \"stopped\";\n resolverClient.emit(\"statechange\", resolverClient.state);\n }\n return \"resolved author address\";\n }\n\n async resolveAuthorName(\n options: PkcResolveAuthorNameOptions,\n ): Promise<PkcResolveAuthorNameResult> {\n const resolvedAuthorName = await this.resolveAuthorAddress({ address: options.name });\n return { resolvedAuthorName };\n }\n\n async createSigner() {\n return {\n privateKey: \"private key\",\n address: \"address\",\n };\n }\n\n async createCommunity(createCommunityOptions: any) {\n if (!createCommunityOptions) {\n createCommunityOptions = {};\n }\n const communityIdentifier =\n createCommunityOptions.address ||\n createCommunityOptions.name ||\n createCommunityOptions.publicKey;\n\n // no address provided so probably a user creating an owner community\n if (!communityIdentifier) {\n createCommunityOptions = {\n ...createCommunityOptions,\n address: \"created community address\",\n };\n // createdCommunityAddresses.push('created community address')\n createdOwnerCommunities[createCommunityOptions.address] = { ...createCommunityOptions };\n }\n // only address provided, so could be a previously created owner community\n // add props from previously created sub\n else if (\n (createdOwnerCommunities[createCommunityOptions.address] &&\n JSON.stringify(Object.keys(createCommunityOptions)) === '[\"address\"]') ||\n (createdOwnerCommunities[createCommunityOptions.name] &&\n JSON.stringify(Object.keys(createCommunityOptions)) === '[\"name\"]')\n ) {\n const ownerCommunityAddress = createCommunityOptions.address || createCommunityOptions.name;\n for (const prop in createdOwnerCommunities[ownerCommunityAddress]) {\n if (createdOwnerCommunities[ownerCommunityAddress][prop]) {\n createCommunityOptions[prop] = createdOwnerCommunities[ownerCommunityAddress][prop];\n }\n }\n }\n\n // add edited props if owner community was edited in the past\n if (editedOwnerCommunities[createCommunityOptions.address]) {\n for (const prop in editedOwnerCommunities[createCommunityOptions.address]) {\n if (editedOwnerCommunities[createCommunityOptions.address][prop]) {\n createCommunityOptions[prop] =\n editedOwnerCommunities[createCommunityOptions.address][prop];\n }\n }\n }\n\n return new Community(createCommunityOptions);\n }\n\n async getCommunity(options: { address: string }) {\n const address = options?.address;\n await simulateLoadingTime();\n const createCommunityOptions = { address };\n const community: any = new Community(createCommunityOptions);\n community.title = community.address + \" title\";\n const hotPageCid = community.address + \" page cid hot\";\n community.posts.pages.hot = community.posts.pageToGet(hotPageCid);\n community.posts.pageCids = {\n hot: hotPageCid,\n topAll: community.address + \" page cid topAll\",\n new: community.address + \" page cid new\",\n active: community.address + \" page cid active\",\n };\n community.modQueue.pageCids = {\n pendingApproval: community.address + \" page cid pendingApproval\",\n };\n return community;\n }\n\n // TODO: implement event communitieschange\n get communities() {\n return [\n ...new Set([\n \"list community address 1\",\n \"list community address 2\",\n ...Object.keys(createdOwnerCommunities),\n ]),\n ].map((address) => ({ publicKey: address, address, started: false }));\n }\n\n async createComment(createCommentOptions: any) {\n return new Comment(createCommentOptions);\n }\n\n async getComment(options: { cid: string }) {\n const cid = options?.cid;\n await simulateLoadingTime();\n const createCommentOptions = {\n cid,\n // useComment() requires timestamp or will use account comment instead of comment from store\n timestamp: 1670000000,\n ...this.commentToGet(cid),\n };\n return new Comment(createCommentOptions);\n }\n\n // mock this method to get a comment with different content, timestamp, address, etc\n commentToGet(commentCid?: string) {\n return {\n // content: 'mock some content'\n // author: {address: 'mock some address'},\n // timestamp: 1234\n };\n }\n\n async createVote() {\n return new Vote();\n }\n\n async createCommentEdit(createCommentEditOptions: any) {\n return new CommentEdit(createCommentEditOptions);\n }\n\n async createCommentModeration(createCommentModerationOptions: any) {\n return new CommentModeration(createCommentModerationOptions);\n }\n\n async createCommunityEdit(createCommunityEditOptions: any) {\n return new CommunityEdit(createCommunityEditOptions);\n }\n\n async fetchCid(options: { cid: string }) {\n const cid = options?.cid;\n if (cid?.startsWith(\"statscid\")) {\n return JSON.stringify({ hourActiveUserCount: 1 });\n }\n throw Error(`pkc.fetchCid not implemented in pkc-js mock for cid '${cid}'`);\n }\n\n async pubsubSubscribe(communityAddress: string) {}\n async pubsubUnsubscribe(communityAddress: string) {}\n\n clients = (() => {\n const pkcRpcClients = {\n \"http://localhost:9138\": new PkcRpcClient(),\n };\n return {\n pkcRpcClients,\n };\n })();\n\n async validateComment(comment: any, validateCommentOptions: any) {}\n}\n\nclass PkcRpcClient extends EventEmitter {\n state = \"connecting\";\n settings: any = undefined;\n constructor() {\n super();\n // simulate connecting to the rpc\n setTimeout(() => {\n this.state = \"connected\";\n this.settings = { challenges: {} };\n this.emit(\"statechange\", this.state);\n this.emit(\"settingschange\", this.settings);\n }, 10);\n }\n\n async setSettings(settings: any) {\n this.settings = settings;\n this.emit(\"settingschange\", this.settings);\n }\n}\n\nexport class Pages {\n pageCids: any = {};\n pages: any = {};\n community: any;\n comment: any;\n\n constructor(pagesOptions?: any) {\n Object.defineProperty(this, \"community\", {\n value: pagesOptions?.community,\n enumerable: false,\n });\n Object.defineProperty(this, \"comment\", { value: pagesOptions?.comment, enumerable: false });\n }\n\n async getPage(options: { cid: string }) {\n const cid = options?.cid;\n // need to wait twice otherwise react renders too fast and fetches too many pages in advance\n await simulateLoadingTime();\n return this.pageToGet(cid);\n }\n\n async validatePage(page: any) {}\n\n // mock this method to get pages with different content, or use to getPage without simulated loading time\n pageToGet(pageCid: string) {\n const communityAddress = this.community?.address || this.comment?.communityAddress;\n const isPendingApprovalPage = pageCid.includes(\"pendingApproval\");\n const page: any = {\n nextCid: communityAddress + \" \" + pageCid + \" - next page cid\",\n comments: [],\n };\n const postCount = 100;\n let index = 0;\n while (index++ < postCount) {\n const comment: any = {\n timestamp: index,\n cid: pageCid + \" comment cid \" + index,\n communityAddress,\n upvoteCount: index,\n downvoteCount: 10,\n author: {\n address: pageCid + \" author address \" + index,\n },\n updatedAt: index,\n };\n if (isPendingApprovalPage) {\n comment.pendingApproval = true;\n }\n page.comments.push(comment);\n }\n return page;\n }\n}\n\nexport class Community extends EventEmitter {\n updateCalledTimes = 0;\n stopCalledTimes = 0;\n updating = false;\n firstUpdate = true;\n address: string | undefined;\n publicKey: string | undefined;\n title: string | undefined;\n description: string | undefined;\n posts: Pages;\n modQueue: Pages;\n exportRecords: any[];\n updatedAt: number | undefined;\n statsCid: string | undefined;\n state: string;\n updatingState: string;\n\n constructor(createCommunityOptions?: any) {\n super();\n this.address =\n createCommunityOptions?.address ||\n createCommunityOptions?.name ||\n createCommunityOptions?.publicKey;\n this.publicKey = createCommunityOptions?.publicKey || this.address;\n this.title = createCommunityOptions?.title;\n this.description = createCommunityOptions?.description;\n this.statsCid = \"statscid\";\n this.state = \"stopped\";\n this.updatingState = \"stopped\";\n this.updatedAt = createCommunityOptions?.updatedAt;\n this.exportRecords = [];\n\n this.posts = new Pages({ community: this });\n // add community.posts from createCommunityOptions\n if (createCommunityOptions?.posts?.pages) {\n this.posts.pages = createCommunityOptions?.posts?.pages;\n }\n if (createCommunityOptions?.posts?.pageCids) {\n this.posts.pageCids = createCommunityOptions?.posts?.pageCids;\n }\n\n this.modQueue = new Pages({ community: this });\n // add community.modQueue from createCommunityOptions\n if (createCommunityOptions?.modQueue?.pageCids) {\n this.modQueue.pageCids = createCommunityOptions?.modQueue?.pageCids;\n }\n\n if (createCommunityOptions) {\n for (const prop in createCommunityOptions) {\n if (createCommunityOptions[prop] !== undefined) {\n const descriptor =\n Object.getOwnPropertyDescriptor(this, prop) ||\n Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), prop);\n if (descriptor && !descriptor.writable && !descriptor.set) {\n continue;\n }\n // @ts-ignore\n this[prop] = createCommunityOptions[prop];\n }\n }\n }\n\n const lookupKeys = [\"address\", \"name\", \"publicKey\"];\n const createCommunityOptionKeys = Object.keys(createCommunityOptions || {});\n const hasLookupIdentifier = Boolean(\n createCommunityOptions?.address ||\n createCommunityOptions?.name ||\n createCommunityOptions?.publicKey,\n );\n const lookupOnly =\n hasLookupIdentifier &&\n createCommunityOptionKeys.length > 0 &&\n createCommunityOptionKeys.every((key) => lookupKeys.includes(key));\n\n // only trigger a first update for lookup-only remote community instances\n if (!lookupOnly) {\n this.firstUpdate = false;\n }\n }\n\n async update() {\n this.updateCalledTimes++;\n if (!this.address) {\n throw Error(`can't update without community.address`);\n }\n // don't update twice\n if (this.updating) {\n return;\n }\n this.updating = true;\n\n this.state = \"updating\";\n this.updatingState = \"fetching-ipns\";\n this.emit(\"statechange\", \"updating\");\n this.emit(\"updatingstatechange\", \"fetching-ipns\");\n\n simulateLoadingTime().then(() => {\n this.simulateUpdateEvent();\n });\n }\n\n async stop() {\n this.stopCalledTimes++;\n if (this.state !== \"updating\") {\n return;\n }\n this.updating = false;\n this.state = \"stopped\";\n this.updatingState = \"stopped\";\n this.emit(\"statechange\", \"stopped\");\n this.emit(\"updatingstatechange\", \"stopped\");\n }\n\n async delete() {\n if (this.address) {\n delete createdOwnerCommunities[this.address];\n delete editedOwnerCommunities[this.address];\n }\n }\n\n get exports() {\n return this.exportRecords.map((record) => ({ ...record }));\n }\n\n async export(exportCommunityOptions: any = {}) {\n if (!this.address) {\n throw Error(`can't community.export with no community.address`);\n }\n const exportRecord = {\n exportId: `${this.address} export ${this.exportRecords.length + 1}`,\n name: this.address,\n publicKey: this.publicKey || this.address,\n includePrivateKey: exportCommunityOptions.includePrivateKey === true,\n progress: 1,\n url: `file://${this.address}.zip`,\n };\n this.exportRecords.push(exportRecord);\n this.emit(\"exportschange\", this.exports);\n return { exportId: exportRecord.exportId };\n }\n\n simulateUpdateEvent() {\n if (this.state === \"stopped\" && this.stopCalledTimes > 0) {\n return;\n }\n if (this.firstUpdate) {\n this.simulateFirstUpdateEvent();\n return;\n }\n\n this.description = this.address + \" description updated\";\n // @ts-ignore\n this.updatedAt = this.updatedAt + 1;\n\n this.updating = false;\n this.updatingState = \"succeeded\";\n this.emit(\"update\", this);\n this.emit(\"updatingstatechange\", \"succeeded\");\n }\n\n // the first update event adds all the field from getCommunity\n async simulateFirstUpdateEvent() {\n this.firstUpdate = false;\n this.updatedAt = Math.floor(Date.now() / 1000);\n\n this.title = this.address + \" title\";\n const hotPageCid = this.address + \" page cid hot\";\n this.posts.pages.hot = this.posts.pageToGet(hotPageCid);\n this.posts.pageCids = {\n hot: hotPageCid,\n topAll: this.address + \" page cid topAll\",\n new: this.address + \" page cid new\",\n active: this.address + \" page cid active\",\n };\n this.modQueue.pageCids = {\n pendingApproval: this.address + \" page cid pendingApproval\",\n };\n\n // simulate the ipns update\n this.updatingState = \"succeeded\";\n this.emit(\"update\", this);\n this.emit(\"updatingstatechange\", \"succeeded\");\n\n // simulate the next update\n this.updatingState = \"fetching-ipns\";\n this.emit(\"updatingstatechange\", \"fetching-ipns\");\n simulateLoadingTime().then(() => {\n this.simulateUpdateEvent();\n });\n }\n\n // use getting to easily mock it\n get roles() {\n return this.rolesToGet();\n }\n\n // mock this method to get different roles\n rolesToGet() {\n return {};\n }\n\n async edit(editCommunityOptions: any) {\n if (!this.address || typeof this.address !== \"string\") {\n throw Error(`can't community.edit with no community.address`);\n }\n const previousAddress = this.address;\n\n // do community.edit\n for (const prop in editCommunityOptions) {\n if (editCommunityOptions[prop] !== undefined) {\n const descriptor =\n Object.getOwnPropertyDescriptor(this, prop) ||\n Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), prop);\n if (descriptor && !descriptor.writable && !descriptor.set) {\n continue;\n }\n // @ts-ignore\n this[prop] = editCommunityOptions[prop];\n }\n }\n\n // keep a list of edited communities to reinitialize\n // them with pkc.createCommunity()\n editedOwnerCommunities[this.address] = {\n address: this.address,\n title: this.title,\n description: this.description,\n };\n\n // handle change of community.address\n if (editCommunityOptions.address) {\n // apply address change to editedOwnerCommunities\n editedOwnerCommunities[previousAddress] = {\n address: this.address,\n title: this.title,\n description: this.description,\n };\n delete editedOwnerCommunities[previousAddress];\n\n // apply address change to createdOwnerCommunities\n createdOwnerCommunities[this.address] = {\n ...createdOwnerCommunities[previousAddress],\n address: this.address,\n };\n delete createdOwnerCommunities[previousAddress];\n }\n }\n}\n// make roles enumarable so it acts like a regular prop\nObject.defineProperty(Community.prototype, \"roles\", { enumerable: true });\n\nlet challengeRequestCount = 0;\nlet challengeAnswerCount = 0;\n// kept outside the instances so the hooks never copy it into stored or cloned publications\nconst publishCalledPublications = new WeakSet<object>();\n\nclass Publication extends EventEmitter {\n timestamp: number | undefined;\n content: string | undefined;\n cid: string | undefined;\n challengeRequestId = `r${++challengeRequestCount}`;\n challengeAnswerId = `a${++challengeAnswerCount}`;\n state: string | undefined;\n publishingState: string | undefined;\n\n async publish() {\n // like pkc-js 0.0.154, an instance runs one challenge exchange: publishing again needs a new\n // instance (the mock has no pre-flight that could reject before anything is sent)\n if (publishCalledPublications.has(this)) {\n throw Object.assign(\n Error(\n \"pkc-js-mock publish() was already called on this publication instance, create a new instance to publish again\",\n ),\n {\n code: \"ERR_PUBLICATION_PUBLISH_ALREADY_CALLED\",\n details: { state: this.state, publishingState: this.publishingState },\n },\n );\n }\n publishCalledPublications.add(this);\n this.state = \"publishing\";\n this.publishingState = \"publishing-challenge-request\";\n this.emit(\"statechange\", \"publishing\");\n this.emit(\"publishingstatechange\", \"publishing-challenge-request\");\n\n await simulateLoadingTime();\n this.simulateChallengeEvent();\n }\n\n simulateChallengeEvent() {\n this.publishingState = \"waiting-challenge-answers\";\n this.emit(\"publishingstatechange\", \"waiting-challenge-answers\");\n\n const challenge = { type: \"text\", challenge: \"2+2=?\" };\n const challengeMessage = {\n type: \"CHALLENGE\",\n challengeRequestId: this.challengeRequestId,\n // keyed by challenge index, like pkc-js\n challenges: { \"0\": challenge },\n };\n this.emit(\"challenge\", challengeMessage, this);\n }\n\n async publishChallengeAnswers(options: { challengeAnswers: ChallengeAnswersByIndex }) {\n const challengeAnswers = options?.challengeAnswers;\n // pkc-js rejects an array or an empty record\n if (\n !challengeAnswers ||\n typeof challengeAnswers !== \"object\" ||\n Array.isArray(challengeAnswers) ||\n Object.keys(challengeAnswers).length === 0\n ) {\n throw Error(\n `pkc-js-mock publishChallengeAnswers: challengeAnswers must be a non-empty record keyed by challenge index, got '${JSON.stringify(challengeAnswers)}'`,\n );\n }\n this.publishingState = \"publishing-challenge-answer\";\n this.emit(\"publishingstatechange\", \"publishing-challenge-answer\");\n\n await simulateLoadingTime();\n this.publishingState = \"waiting-challenge-verification\";\n this.emit(\"publishingstatechange\", \"waiting-challenge-verification\");\n\n await simulateLoadingTime();\n this.simulateChallengeVerificationEvent();\n }\n\n simulateChallengeVerificationEvent() {\n // if publication has content, create cid for this content and add it to comment and challengeVerificationMessage\n this.cid = this.content && `${this.content} cid`;\n const commentUpdate = this.cid && { cid: this.cid };\n\n const challengeVerificationMessage = {\n type: \"CHALLENGEVERIFICATION\",\n challengeRequestId: this.challengeRequestId,\n challengeAnswerId: this.challengeAnswerId,\n challengeSuccess: true,\n commentUpdate,\n };\n this.emit(\"challengeverification\", challengeVerificationMessage, this);\n\n this.publishingState = \"succeeded\";\n this.emit(\"publishingstatechange\", \"succeeded\");\n }\n\n // like pkc-js 0.0.154 for an error it recovers from, e.g. a challenge it cannot decrypt:\n // publishingState becomes \"failed\" but state stays \"publishing\" and the exchange goes on\n simulateRecoverableErrorEvent(error: Error) {\n this.publishingState = \"failed\";\n this.emit(\"error\", error);\n this.emit(\"publishingstatechange\", \"failed\");\n }\n\n // like a pkc-js publish() that rejects before a challenge exchange exists (signing, the signature\n // hook, the RPC publish call, no pubsub provider): state stays \"publishing\", no error event is\n // emitted and nothing is published. Call it in place of publish()\n async simulatePreflightPublishError(error: Error) {\n this.state = \"publishing\";\n this.emit(\"statechange\", \"publishing\");\n await simulateLoadingTime();\n throw error;\n }\n\n stop() {\n if (this.state === \"publishing\" || this.publishingState !== \"stopped\") {\n this.state = \"stopped\";\n this.publishingState = \"stopped\";\n this.emit(\"statechange\", \"stopped\");\n this.emit(\"publishingstatechange\", \"stopped\");\n }\n if ((this as any).updating || (this as any).updatingState !== \"stopped\") {\n (this as any).state = \"stopped\";\n (this as any).updating = false;\n (this as any).updatingState = \"stopped\";\n this.emit(\"statechange\", \"stopped\");\n this.emit(\"updatingstatechange\", \"stopped\");\n }\n }\n}\n\nexport class Comment extends Publication {\n updateCalledTimes = 0;\n updating = false;\n author: any;\n upvoteCount: number | undefined;\n downvoteCount: number | undefined;\n content: string | undefined;\n parentCid: string | undefined;\n replies: any;\n updatedAt: number | undefined;\n communityAddress: string | undefined;\n state: string;\n updatingState: string;\n publishingState: string;\n\n constructor(createCommentOptions?: any) {\n super();\n const rawComment = createCommentOptions?.raw?.comment;\n this.cid = createCommentOptions?.cid;\n this.upvoteCount = createCommentOptions?.upvoteCount;\n this.downvoteCount = createCommentOptions?.downvoteCount;\n this.content = createCommentOptions?.content ?? rawComment?.content;\n const author = createCommentOptions?.author ?? rawComment?.author;\n this.author = author ? { ...author } : undefined;\n this.timestamp = createCommentOptions?.timestamp ?? rawComment?.timestamp;\n this.parentCid = createCommentOptions?.parentCid ?? rawComment?.parentCid;\n this.communityAddress = createCommentOptions?.communityAddress ?? rawComment?.communityAddress;\n (this as any).crosspost = createCommentOptions?.crosspost ?? rawComment?.crosspost;\n (this as any).gallery = createCommentOptions?.gallery ?? rawComment?.gallery;\n (this as any).link = createCommentOptions?.link ?? rawComment?.link;\n (this as any).raw = createCommentOptions?.raw;\n (this as any).signature = createCommentOptions?.signature ?? rawComment?.signature;\n (this as any).title = createCommentOptions?.title ?? rawComment?.title;\n this.state = \"stopped\";\n this.updatingState = \"stopped\";\n this.publishingState = \"stopped\";\n\n if (this.author?.address) {\n this.author.shortAddress = `short ${this.author.address}`;\n }\n\n this.replies = new Pages({ comment: this });\n\n // add comment.replies from createCommentOptions\n if (createCommentOptions?.replies?.pages) {\n this.replies.pages = createCommentOptions?.replies?.pages;\n }\n if (createCommentOptions?.replies?.pageCids) {\n this.replies.pageCids = createCommentOptions?.replies?.pageCids;\n }\n }\n\n async update() {\n this.updateCalledTimes++;\n if (this.updateCalledTimes > 5) {\n throw Error(\n \"with the current hooks, comment.update() should be called maximum 5 times, this number might change if the hooks change and is only there to catch bugs, the real comment.update() can be called infinite times\",\n );\n }\n // don't update twice\n if (this.updating) {\n return;\n }\n this.updating = true;\n\n this.state = \"updating\";\n this.updatingState = \"fetching-ipfs\";\n this.emit(\"statechange\", \"updating\");\n this.emit(\"updatingstatechange\", \"fetching-ipfs\");\n\n simulateLoadingTime().then(() => {\n this.simulateUpdateEvent();\n });\n }\n\n simulateUpdateEvent() {\n if (!this.updating) {\n return;\n }\n // if timestamp isn't defined, simulate fetching the comment ipfs\n if (!this.timestamp) {\n this.simulateFetchCommentIpfsUpdateEvent();\n return;\n }\n\n // simulate finding vote counts on an IPNS record\n this.upvoteCount = typeof this.upvoteCount === \"number\" ? this.upvoteCount + 2 : 3;\n this.downvoteCount = typeof this.downvoteCount === \"number\" ? this.downvoteCount + 1 : 1;\n this.updatedAt = Math.floor(Date.now() / 1000);\n\n this.updatingState = \"succeeded\";\n this.emit(\"update\", this);\n this.emit(\"updatingstatechange\", \"succeeded\");\n }\n\n async simulateFetchCommentIpfsUpdateEvent() {\n if (!this.updating) {\n return;\n }\n // use pkc.getComment() so mocking PKC.prototype.getComment works\n const commentIpfs = await new PKC().getComment({ cid: this.cid || \"\" });\n if (!this.updating) {\n return;\n }\n this.content = commentIpfs.content;\n this.author = commentIpfs.author;\n this.timestamp = commentIpfs.timestamp;\n this.parentCid = commentIpfs.parentCid;\n this.communityAddress = commentIpfs.communityAddress;\n\n // simulate the ipns update\n this.updatingState = \"fetching-update-ipns\";\n this.emit(\"update\", this);\n this.emit(\"updatingstatechange\", \"fetching-update-ipns\");\n simulateLoadingTime().then(() => {\n this.simulateUpdateEvent();\n });\n }\n}\n\nexport class Vote extends Publication {}\n\nexport class CommentEdit extends Publication {}\n\nexport class CommentModeration extends Publication {}\n\nexport class CommunityEdit extends Publication {}\n\nconst createPkc: any = async (...args: any) => {\n return new PKC(...args);\n};\n\ncreatePkc.getShortAddress = (options: { address: string }) => {\n const address = options?.address;\n if (address.includes(\".\")) {\n return address;\n }\n return address.substring(2, 14);\n};\n\ncreatePkc.getShortCid = (options: { cid: string }) => {\n const cid = options?.cid;\n return cid.substring(2, 14);\n};\n\nexport default createPkc;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-actions.d.ts","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,OAAO,EAEP,qBAAqB,EAGrB,kBAAkB,EAClB,yBAAyB,EACzB,+BAA+B,EAC/B,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EAEf,cAAc,
|
|
1
|
+
{"version":3,"file":"accounts-actions.d.ts","sourceRoot":"","sources":["../../../src/stores/accounts/accounts-actions.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,OAAO,EAEP,qBAAqB,EAGrB,kBAAkB,EAClB,yBAAyB,EACzB,+BAA+B,EAC/B,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EAEf,cAAc,EAGf,MAAM,aAAa,CAAC;AAyYrB,sGAAsG;AACtG,eAAO,MAAM,yBAAyB,GACpC,kBAAkB,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EACvC,WAAW,MAAM,EACjB,OAAO,MAAM,EACb,SAAS,CAAC,eAAe,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI;;;;;;CAO/D,CAAC;AAoCF,eAAO,MAAM,0BAA0B,GAAI,mBAAmB,GAAG,EAAE,yBAAyB,GAAG,YAGtC,CAAC;AAE1D,eAAO,MAAM,yBAAyB,GAAI,mBAAmB,GAAG,QAK/D,CAAC;AAuCF,eAAO,MAAM,kCAAkC,GAC7C,wBAAwB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,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,EACxD,cAAc,MAAM,kBAmKrB,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,wBAAwB,sBAAsB,EAC9C,cAAc,MAAM,iBAmBrB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,kBAAkB,MAAM,EAAE,cAAc,MAAM,kBAsDnF,CAAC"}
|
|
@@ -460,6 +460,48 @@ export const hasTerminalChallengeVerificationError = (challengeVerification) =>
|
|
|
460
460
|
return (!(challengeVerification === null || challengeVerification === void 0 ? void 0 : challengeVerification.challengeSuccess) &&
|
|
461
461
|
(hasChallengeErrors || Boolean(challengeVerification === null || challengeVerification === void 0 ? void 0 : challengeVerification.reason)));
|
|
462
462
|
};
|
|
463
|
+
// pkc-js stops a publication and sets its publishingState to "failed" before emitting the error that
|
|
464
|
+
// ends its publish, and over RPC an error the server ended its publish with ends it too, the test
|
|
465
|
+
// pkc-js makes itself (see its _handleIncomingErrorFromRpc). Its other errors did not end the
|
|
466
|
+
// publish: ones it recovers from while the publication keeps publishing, e.g. a challenge it cannot
|
|
467
|
+
// decrypt, or a pubsub unsubscribe that failed while a stopped publication was torn down
|
|
468
|
+
const isPublishEndingError = (publication, error) => {
|
|
469
|
+
var _a, _b;
|
|
470
|
+
return (publication === null || publication === void 0 ? void 0 : publication.state) === "stopped" &&
|
|
471
|
+
(publication.publishingState === "failed" ||
|
|
472
|
+
Boolean((_a = error === null || error === void 0 ? void 0 : error.details) === null || _a === void 0 ? void 0 : _a.publishThrowError) ||
|
|
473
|
+
((_b = error === null || error === void 0 ? void 0 : error.details) === null || _b === void 0 ? void 0 : _b.newState) === "stopped");
|
|
474
|
+
};
|
|
475
|
+
/**
|
|
476
|
+
* Reports the errors of one publication to a publish action's onError with whether each ended the
|
|
477
|
+
* publish, and runs onPublishEnd before reporting the one that did. Only the first error that ends
|
|
478
|
+
* it is final, none after its challenge verification decided it, and an error pkc-js both emits and
|
|
479
|
+
* rejects publish() with (when every pubsub provider threw or the community's challenge exchange is
|
|
480
|
+
* disabled) is reported once. A rejected publish() ends the publish, although pkc-js leaves the
|
|
481
|
+
* state "publishing" when it rejects before a challenge exchange exists (signing, the RPC call).
|
|
482
|
+
*/
|
|
483
|
+
const createPublicationErrorReporter = (publication, onError, onPublishEnd) => {
|
|
484
|
+
let publishEnded = false;
|
|
485
|
+
let lastReportedError;
|
|
486
|
+
const report = (error, endsPublish) => __awaiter(void 0, void 0, void 0, function* () {
|
|
487
|
+
if (error === lastReportedError)
|
|
488
|
+
return;
|
|
489
|
+
lastReportedError = error;
|
|
490
|
+
const final = endsPublish && !publishEnded;
|
|
491
|
+
if (final) {
|
|
492
|
+
publishEnded = true;
|
|
493
|
+
yield onPublishEnd();
|
|
494
|
+
}
|
|
495
|
+
onError === null || onError === void 0 ? void 0 : onError(error, publication, { final });
|
|
496
|
+
});
|
|
497
|
+
return {
|
|
498
|
+
reportErrorEvent: (error) => report(error, isPublishEndingError(publication, error)),
|
|
499
|
+
reportPublishRejection: (error) => report(error, true),
|
|
500
|
+
onChallengeVerification: () => {
|
|
501
|
+
publishEnded = true;
|
|
502
|
+
},
|
|
503
|
+
};
|
|
504
|
+
};
|
|
463
505
|
export const addStoredAccountEditToState = (accountsEdits, accountId, storedAccountEdit) => {
|
|
464
506
|
const accountEdits = accountsEdits[accountId] || {};
|
|
465
507
|
const editTarget = getStoredAccountEditTarget(storedAccountEdit);
|
|
@@ -1196,7 +1238,7 @@ export const publishComment = (publishCommentOptions, accountName) => __awaiter(
|
|
|
1196
1238
|
}
|
|
1197
1239
|
});
|
|
1198
1240
|
};
|
|
1199
|
-
const recordPublishCommentError = (rawError, activeComment) => {
|
|
1241
|
+
const recordPublishCommentError = (rawError, activeComment, final) => {
|
|
1200
1242
|
const error = normalizePublishError(rawError);
|
|
1201
1243
|
if (lastReportedPublishError === error) {
|
|
1202
1244
|
return error;
|
|
@@ -1211,21 +1253,24 @@ export const publishComment = (publishCommentOptions, accountName) => __awaiter(
|
|
|
1211
1253
|
const errors = previousErrors[previousErrors.length - 1] === error
|
|
1212
1254
|
? previousErrors
|
|
1213
1255
|
: [...previousErrors, error];
|
|
1214
|
-
|
|
1256
|
+
// a final error ends the account comment failed, also when pkc-js left the publication
|
|
1257
|
+
// publishing, as it does when publish() rejects in pre-flight
|
|
1258
|
+
ac[currentIndex] = final
|
|
1259
|
+
? Object.assign(Object.assign({}, acc), { errors, error, state: "stopped", publishingState: "failed" }) : Object.assign(Object.assign({}, acc), { errors, error });
|
|
1215
1260
|
}));
|
|
1216
1261
|
return error;
|
|
1217
1262
|
};
|
|
1218
|
-
const reportActivePublishCommentError = (rawError, activeComment,
|
|
1263
|
+
const reportActivePublishCommentError = (rawError, activeComment, final) => {
|
|
1219
1264
|
var _a;
|
|
1220
1265
|
if (!getActiveSessionForComment(activeComment))
|
|
1221
1266
|
return;
|
|
1222
|
-
const error = recordPublishCommentError(rawError, activeComment);
|
|
1223
|
-
//
|
|
1224
|
-
//
|
|
1225
|
-
if (
|
|
1267
|
+
const error = recordPublishCommentError(rawError, activeComment, final);
|
|
1268
|
+
// only an error that ended the publish ends the session: pkc-js keeps processing the exchange
|
|
1269
|
+
// after an error it recovers from
|
|
1270
|
+
if (final) {
|
|
1226
1271
|
queueCleanupFailedPublishSession(activeComment);
|
|
1227
1272
|
}
|
|
1228
|
-
(_a = publishCommentOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishCommentOptions, error, activeComment);
|
|
1273
|
+
(_a = publishCommentOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishCommentOptions, error, activeComment, { final });
|
|
1229
1274
|
};
|
|
1230
1275
|
// the options onBeforeRepublish returns go through the same pipeline as the first publish; resolves
|
|
1231
1276
|
// to false when the publish was abandoned while onBeforeRepublish ran
|
|
@@ -1263,7 +1308,7 @@ export const publishComment = (publishCommentOptions, accountName) => __awaiter(
|
|
|
1263
1308
|
accountsStore.setState(({ accountsComments }) => maybeUpdateAccountComment(accountsComments, account.id, session.currentIndex, (ac, acc) => {
|
|
1264
1309
|
ac[session.currentIndex] = Object.assign(Object.assign({}, acc), { state: "stopped", publishingState: "failed" });
|
|
1265
1310
|
}));
|
|
1266
|
-
(_a = publishCommentOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommentOptions, "failed");
|
|
1311
|
+
(_a = publishCommentOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommentOptions, "failed", failedComment);
|
|
1267
1312
|
reportActivePublishCommentError(error, failedComment, true);
|
|
1268
1313
|
};
|
|
1269
1314
|
function publishAndRetryFailedChallengeVerification() {
|
|
@@ -1379,24 +1424,21 @@ export const publishComment = (publishCommentOptions, accountName) => __awaiter(
|
|
|
1379
1424
|
}
|
|
1380
1425
|
}));
|
|
1381
1426
|
activeComment.on("error", (error) => {
|
|
1382
|
-
|
|
1427
|
+
// an error after the verdict is not reported: the verdict ends or detaches the session
|
|
1428
|
+
reportActivePublishCommentError(error, activeComment, isPublishEndingError(activeComment, error));
|
|
1383
1429
|
});
|
|
1430
|
+
// the session ends with the publication's final error, its rejected publish() or its verdict,
|
|
1431
|
+
// not with a stopped and failed state: pkc-js stops a publication before emitting the error that
|
|
1432
|
+
// ends it, awaiting its teardown in between, and stops it before publish() rejects when the
|
|
1433
|
+
// community fails to load, so ending the session here dropped that error
|
|
1384
1434
|
activeComment.on("statechange", (state) => {
|
|
1385
1435
|
const session = getActiveSessionForComment(activeComment);
|
|
1386
1436
|
if (!session)
|
|
1387
1437
|
return;
|
|
1388
1438
|
const currentIndex = session.currentIndex;
|
|
1389
|
-
let hasTerminalFailedState = false;
|
|
1390
1439
|
accountsStore.setState(({ accountsComments }) => maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {
|
|
1391
|
-
|
|
1392
|
-
ac[currentIndex] = nextAccountComment;
|
|
1393
|
-
hasTerminalFailedState =
|
|
1394
|
-
nextAccountComment.state === "stopped" &&
|
|
1395
|
-
nextAccountComment.publishingState === "failed";
|
|
1440
|
+
ac[currentIndex] = Object.assign(Object.assign({}, acc), { state });
|
|
1396
1441
|
}));
|
|
1397
|
-
if (hasTerminalFailedState) {
|
|
1398
|
-
queueCleanupFailedPublishSession(activeComment);
|
|
1399
|
-
}
|
|
1400
1442
|
});
|
|
1401
1443
|
activeComment.on("publishingstatechange", (publishingState) => __awaiter(this, void 0, void 0, function* () {
|
|
1402
1444
|
var _a;
|
|
@@ -1404,18 +1446,12 @@ export const publishComment = (publishCommentOptions, accountName) => __awaiter(
|
|
|
1404
1446
|
if (!session)
|
|
1405
1447
|
return;
|
|
1406
1448
|
const currentIndex = session.currentIndex;
|
|
1407
|
-
let hasTerminalFailedState = false;
|
|
1408
1449
|
accountsStore.setState(({ accountsComments }) => maybeUpdateAccountComment(accountsComments, account.id, currentIndex, (ac, acc) => {
|
|
1409
|
-
|
|
1410
|
-
ac[currentIndex] = nextAccountComment;
|
|
1411
|
-
hasTerminalFailedState =
|
|
1412
|
-
nextAccountComment.state === "stopped" &&
|
|
1413
|
-
nextAccountComment.publishingState === "failed";
|
|
1450
|
+
ac[currentIndex] = Object.assign(Object.assign({}, acc), { publishingState });
|
|
1414
1451
|
}));
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
(_a = publishCommentOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommentOptions, publishingState);
|
|
1452
|
+
// the hooks read the publication's state: pkc-js also reports "failed" for an error it
|
|
1453
|
+
// recovers from, while the publication keeps publishing
|
|
1454
|
+
(_a = publishCommentOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommentOptions, publishingState, activeComment);
|
|
1419
1455
|
}));
|
|
1420
1456
|
// set clients on account comment so the frontend can display it, dont persist in db because a reload cancels publishing
|
|
1421
1457
|
utils.clientsOnStateChange(activeComment.clients, (clientState, clientType, clientUrl, chainTicker) => {
|
|
@@ -1619,15 +1655,17 @@ export const publishVote = (publishVoteOptions, accountName) => __awaiter(void 0
|
|
|
1619
1655
|
return;
|
|
1620
1656
|
let lastChallenge;
|
|
1621
1657
|
const publishAndRetryFailedChallengeVerification = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1622
|
-
var _a;
|
|
1623
1658
|
const activeVote = vote;
|
|
1624
1659
|
votePublishSession.publications.add(vote);
|
|
1660
|
+
// only an error that ended the publish fails the vote
|
|
1661
|
+
const errorReporter = createPublicationErrorReporter(activeVote, publishVoteOptions.onError, () => endVotePublication(activeVote, false));
|
|
1625
1662
|
vote.once("challenge", (challenge) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1626
1663
|
lastChallenge = challenge;
|
|
1627
1664
|
publishVoteOptions.onChallenge(challenge, withPublishChallengeAnswersCompat(vote, challenge));
|
|
1628
1665
|
}));
|
|
1629
1666
|
vote.once("challengeverification", (challengeVerification) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1630
1667
|
var _a;
|
|
1668
|
+
errorReporter.onChallengeVerification();
|
|
1631
1669
|
publishVoteOptions.onChallengeVerification(challengeVerification, vote);
|
|
1632
1670
|
// same terminal short-circuit as publishComment/publishCommentEdit: never retry a rejection
|
|
1633
1671
|
if (!challengeVerification.challengeSuccess &&
|
|
@@ -1643,7 +1681,7 @@ export const publishVote = (publishVoteOptions, accountName) => __awaiter(void 0
|
|
|
1643
1681
|
// no retry was published, so the failed vote ends the burst like a rejected one
|
|
1644
1682
|
votePublishSession.failed = true;
|
|
1645
1683
|
yield endVotePublishSessionIfSettled();
|
|
1646
|
-
(_a = publishVoteOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishVoteOptions, error, activeVote);
|
|
1684
|
+
(_a = publishVoteOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishVoteOptions, error, activeVote, { final: true });
|
|
1647
1685
|
return;
|
|
1648
1686
|
}
|
|
1649
1687
|
if (!isVotePublishSessionActive())
|
|
@@ -1655,17 +1693,9 @@ export const publishVote = (publishVoteOptions, accountName) => __awaiter(void 0
|
|
|
1655
1693
|
yield endVotePublication(activeVote, challengeVerification.challengeSuccess);
|
|
1656
1694
|
}
|
|
1657
1695
|
}));
|
|
1658
|
-
vote.on("error",
|
|
1659
|
-
var _a;
|
|
1660
|
-
// pkc-js also emits errors it recovers from, e.g. a challenge with an invalid signature, and
|
|
1661
|
-
// stops the publication before emitting the ones that end it
|
|
1662
|
-
if (activeVote.state === "stopped") {
|
|
1663
|
-
yield endVotePublication(activeVote, false);
|
|
1664
|
-
}
|
|
1665
|
-
(_a = publishVoteOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishVoteOptions, error, vote);
|
|
1666
|
-
}));
|
|
1696
|
+
vote.on("error", errorReporter.reportErrorEvent);
|
|
1667
1697
|
// TODO: add publishingState to account votes
|
|
1668
|
-
vote.on("publishingstatechange", (publishingState) => { var _a; return (_a = publishVoteOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishVoteOptions, publishingState); });
|
|
1698
|
+
vote.on("publishingstatechange", (publishingState) => { var _a; return (_a = publishVoteOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishVoteOptions, publishingState, activeVote); });
|
|
1669
1699
|
listeners.push(vote);
|
|
1670
1700
|
try {
|
|
1671
1701
|
// publish will resolve after the challenge request
|
|
@@ -1673,8 +1703,7 @@ export const publishVote = (publishVoteOptions, accountName) => __awaiter(void 0
|
|
|
1673
1703
|
yield vote.publish();
|
|
1674
1704
|
}
|
|
1675
1705
|
catch (error) {
|
|
1676
|
-
yield
|
|
1677
|
-
(_a = publishVoteOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishVoteOptions, error, vote);
|
|
1706
|
+
yield errorReporter.reportPublishRejection(error);
|
|
1678
1707
|
}
|
|
1679
1708
|
});
|
|
1680
1709
|
publishAndRetryFailedChallengeVerification();
|
|
@@ -1775,12 +1804,15 @@ export const publishCommentEdit = (publishCommentEditOptions, accountName) => __
|
|
|
1775
1804
|
return nextState;
|
|
1776
1805
|
});
|
|
1777
1806
|
const publishAndRetryFailedChallengeVerification = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1778
|
-
|
|
1807
|
+
const activeCommentEdit = commentEdit;
|
|
1808
|
+
// only an error that ended the publish rolls back the edit
|
|
1809
|
+
const errorReporter = createPublicationErrorReporter(activeCommentEdit, publishCommentEditOptions.onError, rollbackStoredCommentEdit);
|
|
1779
1810
|
commentEdit.once("challenge", (challenge) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1780
1811
|
lastChallenge = challenge;
|
|
1781
1812
|
publishCommentEditOptions.onChallenge(challenge, withPublishChallengeAnswersCompat(commentEdit, challenge));
|
|
1782
1813
|
}));
|
|
1783
1814
|
commentEdit.once("challengeverification", (challengeVerification) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1815
|
+
errorReporter.onChallengeVerification();
|
|
1784
1816
|
publishCommentEditOptions.onChallengeVerification(challengeVerification, commentEdit);
|
|
1785
1817
|
if (challengeVerification.challengeSuccess) {
|
|
1786
1818
|
challengeSucceeded = true;
|
|
@@ -1798,13 +1830,9 @@ export const publishCommentEdit = (publishCommentEditOptions, accountName) => __
|
|
|
1798
1830
|
publishAndRetryFailedChallengeVerification();
|
|
1799
1831
|
}
|
|
1800
1832
|
}));
|
|
1801
|
-
commentEdit.on("error",
|
|
1802
|
-
var _a;
|
|
1803
|
-
yield rollbackStoredCommentEdit();
|
|
1804
|
-
(_a = publishCommentEditOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishCommentEditOptions, error, commentEdit);
|
|
1805
|
-
}));
|
|
1833
|
+
commentEdit.on("error", errorReporter.reportErrorEvent);
|
|
1806
1834
|
// TODO: add publishingState to account edits
|
|
1807
|
-
commentEdit.on("publishingstatechange", (publishingState) => { var _a; return (_a = publishCommentEditOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommentEditOptions, publishingState); });
|
|
1835
|
+
commentEdit.on("publishingstatechange", (publishingState) => { var _a; return (_a = publishCommentEditOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommentEditOptions, publishingState, activeCommentEdit); });
|
|
1808
1836
|
listeners.push(commentEdit);
|
|
1809
1837
|
try {
|
|
1810
1838
|
// publish will resolve after the challenge request
|
|
@@ -1812,8 +1840,7 @@ export const publishCommentEdit = (publishCommentEditOptions, accountName) => __
|
|
|
1812
1840
|
yield commentEdit.publish();
|
|
1813
1841
|
}
|
|
1814
1842
|
catch (error) {
|
|
1815
|
-
yield
|
|
1816
|
-
(_a = publishCommentEditOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishCommentEditOptions, error, commentEdit);
|
|
1843
|
+
yield errorReporter.reportPublishRejection(error);
|
|
1817
1844
|
}
|
|
1818
1845
|
});
|
|
1819
1846
|
publishAndRetryFailedChallengeVerification();
|
|
@@ -1863,12 +1890,15 @@ export const publishCommentModeration = (publishCommentModerationOptions, accoun
|
|
|
1863
1890
|
return rollbackPendingEditPromise || Promise.resolve();
|
|
1864
1891
|
};
|
|
1865
1892
|
const publishAndRetryFailedChallengeVerification = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1866
|
-
|
|
1893
|
+
const activeCommentModeration = commentModeration;
|
|
1894
|
+
// only an error that ended the publish rolls back the moderation
|
|
1895
|
+
const errorReporter = createPublicationErrorReporter(activeCommentModeration, publishCommentModerationOptions.onError, rollbackStoredCommentModeration);
|
|
1867
1896
|
commentModeration.once("challenge", (challenge) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1868
1897
|
lastChallenge = challenge;
|
|
1869
1898
|
publishCommentModerationOptions.onChallenge(challenge, withPublishChallengeAnswersCompat(commentModeration, challenge));
|
|
1870
1899
|
}));
|
|
1871
1900
|
commentModeration.once("challengeverification", (challengeVerification) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1901
|
+
errorReporter.onChallengeVerification();
|
|
1872
1902
|
publishCommentModerationOptions.onChallengeVerification(challengeVerification, commentModeration);
|
|
1873
1903
|
if (challengeVerification.challengeSuccess) {
|
|
1874
1904
|
challengeSucceeded = true;
|
|
@@ -1886,13 +1916,12 @@ export const publishCommentModeration = (publishCommentModerationOptions, accoun
|
|
|
1886
1916
|
publishAndRetryFailedChallengeVerification();
|
|
1887
1917
|
}
|
|
1888
1918
|
}));
|
|
1889
|
-
commentModeration.on("error",
|
|
1890
|
-
var _a;
|
|
1891
|
-
yield rollbackStoredCommentModeration();
|
|
1892
|
-
(_a = publishCommentModerationOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishCommentModerationOptions, error, commentModeration);
|
|
1893
|
-
}));
|
|
1919
|
+
commentModeration.on("error", errorReporter.reportErrorEvent);
|
|
1894
1920
|
// TODO: add publishingState to account edits
|
|
1895
|
-
commentModeration.on("publishingstatechange", (publishingState) => {
|
|
1921
|
+
commentModeration.on("publishingstatechange", (publishingState) => {
|
|
1922
|
+
var _a;
|
|
1923
|
+
return (_a = publishCommentModerationOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommentModerationOptions, publishingState, activeCommentModeration);
|
|
1924
|
+
});
|
|
1896
1925
|
listeners.push(commentModeration);
|
|
1897
1926
|
try {
|
|
1898
1927
|
// publish will resolve after the challenge request
|
|
@@ -1900,8 +1929,7 @@ export const publishCommentModeration = (publishCommentModerationOptions, accoun
|
|
|
1900
1929
|
yield commentModeration.publish();
|
|
1901
1930
|
}
|
|
1902
1931
|
catch (error) {
|
|
1903
|
-
yield
|
|
1904
|
-
(_a = publishCommentModerationOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishCommentModerationOptions, error, commentModeration);
|
|
1932
|
+
yield errorReporter.reportPublishRejection(error);
|
|
1905
1933
|
}
|
|
1906
1934
|
});
|
|
1907
1935
|
publishAndRetryFailedChallengeVerification();
|
|
@@ -1987,12 +2015,15 @@ export const publishCommunityEdit = (communityAddress, publishCommunityEditOptio
|
|
|
1987
2015
|
let communityEdit = backfillPublicationCommunityAddress(yield createPkcCommunityEdit(account.pkc, createCommunityEditOptions), createCommunityEditOptions);
|
|
1988
2016
|
let lastChallenge;
|
|
1989
2017
|
const publishAndRetryFailedChallengeVerification = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1990
|
-
|
|
2018
|
+
const activeCommunityEdit = communityEdit;
|
|
2019
|
+
// only an error that ended the publish rolls back the edit
|
|
2020
|
+
const errorReporter = createPublicationErrorReporter(activeCommunityEdit, publishCommunityEditOptions.onError, rollbackStoredCommunityEdit);
|
|
1991
2021
|
communityEdit.once("challenge", (challenge) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1992
2022
|
lastChallenge = challenge;
|
|
1993
2023
|
publishCommunityEditOptions.onChallenge(challenge, withPublishChallengeAnswersCompat(communityEdit, challenge));
|
|
1994
2024
|
}));
|
|
1995
2025
|
communityEdit.once("challengeverification", (challengeVerification) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2026
|
+
errorReporter.onChallengeVerification();
|
|
1996
2027
|
publishCommunityEditOptions.onChallengeVerification(challengeVerification, communityEdit);
|
|
1997
2028
|
if (challengeVerification.challengeSuccess) {
|
|
1998
2029
|
challengeSucceeded = true;
|
|
@@ -2010,13 +2041,9 @@ export const publishCommunityEdit = (communityAddress, publishCommunityEditOptio
|
|
|
2010
2041
|
publishAndRetryFailedChallengeVerification();
|
|
2011
2042
|
}
|
|
2012
2043
|
}));
|
|
2013
|
-
communityEdit.on("error",
|
|
2014
|
-
var _a;
|
|
2015
|
-
yield rollbackStoredCommunityEdit();
|
|
2016
|
-
(_a = publishCommunityEditOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishCommunityEditOptions, error, communityEdit);
|
|
2017
|
-
}));
|
|
2044
|
+
communityEdit.on("error", errorReporter.reportErrorEvent);
|
|
2018
2045
|
// TODO: add publishingState to account edits
|
|
2019
|
-
communityEdit.on("publishingstatechange", (publishingState) => { var _a; return (_a = publishCommunityEditOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommunityEditOptions, publishingState); });
|
|
2046
|
+
communityEdit.on("publishingstatechange", (publishingState) => { var _a; return (_a = publishCommunityEditOptions.onPublishingStateChange) === null || _a === void 0 ? void 0 : _a.call(publishCommunityEditOptions, publishingState, activeCommunityEdit); });
|
|
2020
2047
|
listeners.push(communityEdit);
|
|
2021
2048
|
try {
|
|
2022
2049
|
// publish will resolve after the challenge request
|
|
@@ -2024,8 +2051,7 @@ export const publishCommunityEdit = (communityAddress, publishCommunityEditOptio
|
|
|
2024
2051
|
yield communityEdit.publish();
|
|
2025
2052
|
}
|
|
2026
2053
|
catch (error) {
|
|
2027
|
-
yield
|
|
2028
|
-
(_a = publishCommunityEditOptions.onError) === null || _a === void 0 ? void 0 : _a.call(publishCommunityEditOptions, error, communityEdit);
|
|
2054
|
+
yield errorReporter.reportPublishRejection(error);
|
|
2029
2055
|
}
|
|
2030
2056
|
});
|
|
2031
2057
|
yield storePublishedCommunityEdit();
|