@bitsocial/bitsocial-react-hooks 0.1.0

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.
Files changed (269) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +1365 -0
  3. package/dist/hooks/accounts/accounts.d.ts +64 -0
  4. package/dist/hooks/accounts/accounts.d.ts.map +1 -0
  5. package/dist/hooks/accounts/accounts.js +706 -0
  6. package/dist/hooks/accounts/accounts.js.map +1 -0
  7. package/dist/hooks/accounts/index.d.ts +2 -0
  8. package/dist/hooks/accounts/index.d.ts.map +1 -0
  9. package/dist/hooks/accounts/index.js +2 -0
  10. package/dist/hooks/accounts/index.js.map +1 -0
  11. package/dist/hooks/accounts/utils.d.ts +6 -0
  12. package/dist/hooks/accounts/utils.d.ts.map +1 -0
  13. package/dist/hooks/accounts/utils.js +226 -0
  14. package/dist/hooks/accounts/utils.js.map +1 -0
  15. package/dist/hooks/actions/actions.d.ts +19 -0
  16. package/dist/hooks/actions/actions.d.ts.map +1 -0
  17. package/dist/hooks/actions/actions.js +552 -0
  18. package/dist/hooks/actions/actions.js.map +1 -0
  19. package/dist/hooks/actions/index.d.ts +2 -0
  20. package/dist/hooks/actions/index.d.ts.map +1 -0
  21. package/dist/hooks/actions/index.js +2 -0
  22. package/dist/hooks/actions/index.js.map +1 -0
  23. package/dist/hooks/authors/author-avatars.d.ts +28 -0
  24. package/dist/hooks/authors/author-avatars.d.ts.map +1 -0
  25. package/dist/hooks/authors/author-avatars.js +191 -0
  26. package/dist/hooks/authors/author-avatars.js.map +1 -0
  27. package/dist/hooks/authors/authors.d.ts +37 -0
  28. package/dist/hooks/authors/authors.d.ts.map +1 -0
  29. package/dist/hooks/authors/authors.js +509 -0
  30. package/dist/hooks/authors/authors.js.map +1 -0
  31. package/dist/hooks/authors/index.d.ts +2 -0
  32. package/dist/hooks/authors/index.d.ts.map +1 -0
  33. package/dist/hooks/authors/index.js +2 -0
  34. package/dist/hooks/authors/index.js.map +1 -0
  35. package/dist/hooks/authors/utils.d.ts +4 -0
  36. package/dist/hooks/authors/utils.d.ts.map +1 -0
  37. package/dist/hooks/authors/utils.js +21 -0
  38. package/dist/hooks/authors/utils.js.map +1 -0
  39. package/dist/hooks/comments.d.ts +17 -0
  40. package/dist/hooks/comments.d.ts.map +1 -0
  41. package/dist/hooks/comments.js +351 -0
  42. package/dist/hooks/comments.js.map +1 -0
  43. package/dist/hooks/communities.d.ts +31 -0
  44. package/dist/hooks/communities.d.ts.map +1 -0
  45. package/dist/hooks/communities.js +389 -0
  46. package/dist/hooks/communities.js.map +1 -0
  47. package/dist/hooks/feeds/feeds.d.ts +18 -0
  48. package/dist/hooks/feeds/feeds.d.ts.map +1 -0
  49. package/dist/hooks/feeds/feeds.js +315 -0
  50. package/dist/hooks/feeds/feeds.js.map +1 -0
  51. package/dist/hooks/feeds/index.d.ts +2 -0
  52. package/dist/hooks/feeds/index.d.ts.map +1 -0
  53. package/dist/hooks/feeds/index.js +2 -0
  54. package/dist/hooks/feeds/index.js.map +1 -0
  55. package/dist/hooks/pkc-rpc.d.ts +7 -0
  56. package/dist/hooks/pkc-rpc.d.ts.map +1 -0
  57. package/dist/hooks/pkc-rpc.js +88 -0
  58. package/dist/hooks/pkc-rpc.js.map +1 -0
  59. package/dist/hooks/replies.d.ts +5 -0
  60. package/dist/hooks/replies.d.ts.map +1 -0
  61. package/dist/hooks/replies.js +155 -0
  62. package/dist/hooks/replies.js.map +1 -0
  63. package/dist/hooks/states.d.ts +15 -0
  64. package/dist/hooks/states.d.ts.map +1 -0
  65. package/dist/hooks/states.js +213 -0
  66. package/dist/hooks/states.js.map +1 -0
  67. package/dist/hooks/utils/use-interval.d.ts +3 -0
  68. package/dist/hooks/utils/use-interval.d.ts.map +1 -0
  69. package/dist/hooks/utils/use-interval.js +36 -0
  70. package/dist/hooks/utils/use-interval.js.map +1 -0
  71. package/dist/hooks/utils/use-previous.d.ts +1 -0
  72. package/dist/hooks/utils/use-previous.js +10 -0
  73. package/dist/index.d.ts +82 -0
  74. package/dist/index.d.ts.map +1 -0
  75. package/dist/index.js +128 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/lib/chain/chain.d.ts +36 -0
  78. package/dist/lib/chain/chain.d.ts.map +1 -0
  79. package/dist/lib/chain/chain.js +195 -0
  80. package/dist/lib/chain/chain.js.map +1 -0
  81. package/dist/lib/chain/index.d.ts +4 -0
  82. package/dist/lib/chain/index.d.ts.map +1 -0
  83. package/dist/lib/chain/index.js +4 -0
  84. package/dist/lib/chain/index.js.map +1 -0
  85. package/dist/lib/community-address.d.ts +6 -0
  86. package/dist/lib/community-address.d.ts.map +1 -0
  87. package/dist/lib/community-address.js +26 -0
  88. package/dist/lib/community-address.js.map +1 -0
  89. package/dist/lib/community-ref.d.ts +23 -0
  90. package/dist/lib/community-ref.d.ts.map +1 -0
  91. package/dist/lib/community-ref.js +113 -0
  92. package/dist/lib/community-ref.js.map +1 -0
  93. package/dist/lib/debug-utils.d.ts +9 -0
  94. package/dist/lib/debug-utils.d.ts.map +1 -0
  95. package/dist/lib/debug-utils.js +21 -0
  96. package/dist/lib/debug-utils.js.map +1 -0
  97. package/dist/lib/feed-sort-type.d.ts +2 -0
  98. package/dist/lib/feed-sort-type.d.ts.map +1 -0
  99. package/dist/lib/feed-sort-type.js +22 -0
  100. package/dist/lib/feed-sort-type.js.map +1 -0
  101. package/dist/lib/localforage-lru/index.d.ts +3 -0
  102. package/dist/lib/localforage-lru/index.d.ts.map +1 -0
  103. package/dist/lib/localforage-lru/index.js +46 -0
  104. package/dist/lib/localforage-lru/index.js.map +1 -0
  105. package/dist/lib/localforage-lru/localforage-lru.d.ts +6 -0
  106. package/dist/lib/localforage-lru/localforage-lru.d.ts.map +1 -0
  107. package/dist/lib/localforage-lru/localforage-lru.js +182 -0
  108. package/dist/lib/localforage-lru/localforage-lru.js.map +1 -0
  109. package/dist/lib/pkc-compat.d.ts +25 -0
  110. package/dist/lib/pkc-compat.d.ts.map +1 -0
  111. package/dist/lib/pkc-compat.js +131 -0
  112. package/dist/lib/pkc-compat.js.map +1 -0
  113. package/dist/lib/pkc-js/fixtures/markdown-example.d.ts +3 -0
  114. package/dist/lib/pkc-js/fixtures/markdown-example.d.ts.map +1 -0
  115. package/dist/lib/pkc-js/fixtures/markdown-example.js +280 -0
  116. package/dist/lib/pkc-js/fixtures/markdown-example.js.map +1 -0
  117. package/dist/lib/pkc-js/index.d.ts +11 -0
  118. package/dist/lib/pkc-js/index.d.ts.map +1 -0
  119. package/dist/lib/pkc-js/index.js +85 -0
  120. package/dist/lib/pkc-js/index.js.map +1 -0
  121. package/dist/lib/pkc-js/pkc-js-mock-content.d.ts +3 -0
  122. package/dist/lib/pkc-js/pkc-js-mock-content.d.ts.map +1 -0
  123. package/dist/lib/pkc-js/pkc-js-mock-content.js +1235 -0
  124. package/dist/lib/pkc-js/pkc-js-mock-content.js.map +1 -0
  125. package/dist/lib/pkc-js/pkc-js-mock.d.ts +137 -0
  126. package/dist/lib/pkc-js/pkc-js-mock.d.ts.map +1 -0
  127. package/dist/lib/pkc-js/pkc-js-mock.js +644 -0
  128. package/dist/lib/pkc-js/pkc-js-mock.js.map +1 -0
  129. package/dist/lib/polyfill.d.ts +3 -0
  130. package/dist/lib/polyfill.d.ts.map +1 -0
  131. package/dist/lib/polyfill.js +14 -0
  132. package/dist/lib/polyfill.js.map +1 -0
  133. package/dist/lib/protocol-compat.d.ts +14 -0
  134. package/dist/lib/protocol-compat.d.ts.map +1 -0
  135. package/dist/lib/protocol-compat.js +67 -0
  136. package/dist/lib/protocol-compat.js.map +1 -0
  137. package/dist/lib/test-utils.d.ts +29 -0
  138. package/dist/lib/test-utils.d.ts.map +1 -0
  139. package/dist/lib/test-utils.js +184 -0
  140. package/dist/lib/test-utils.js.map +1 -0
  141. package/dist/lib/utils/comment-moderation.d.ts +4 -0
  142. package/dist/lib/utils/comment-moderation.d.ts.map +1 -0
  143. package/dist/lib/utils/comment-moderation.js +56 -0
  144. package/dist/lib/utils/comment-moderation.js.map +1 -0
  145. package/dist/lib/utils/index.d.ts +4 -0
  146. package/dist/lib/utils/index.d.ts.map +1 -0
  147. package/dist/lib/utils/index.js +4 -0
  148. package/dist/lib/utils/index.js.map +1 -0
  149. package/dist/lib/utils/utils.d.ts +23 -0
  150. package/dist/lib/utils/utils.d.ts.map +1 -0
  151. package/dist/lib/utils/utils.js +375 -0
  152. package/dist/lib/utils/utils.js.map +1 -0
  153. package/dist/lib/validator.d.ts +30 -0
  154. package/dist/lib/validator.d.ts.map +1 -0
  155. package/dist/lib/validator.js +307 -0
  156. package/dist/lib/validator.js.map +1 -0
  157. package/dist/stores/accounts/account-generator.d.ts +51 -0
  158. package/dist/stores/accounts/account-generator.d.ts.map +1 -0
  159. package/dist/stores/accounts/account-generator.js +160 -0
  160. package/dist/stores/accounts/account-generator.js.map +1 -0
  161. package/dist/stores/accounts/accounts-actions-internal.d.ts +8 -0
  162. package/dist/stores/accounts/accounts-actions-internal.d.ts.map +1 -0
  163. package/dist/stores/accounts/accounts-actions-internal.js +403 -0
  164. package/dist/stores/accounts/accounts-actions-internal.js.map +1 -0
  165. package/dist/stores/accounts/accounts-actions.d.ts +46 -0
  166. package/dist/stores/accounts/accounts-actions.d.ts.map +1 -0
  167. package/dist/stores/accounts/accounts-actions.js +1341 -0
  168. package/dist/stores/accounts/accounts-actions.js.map +1 -0
  169. package/dist/stores/accounts/accounts-database.d.ts +34 -0
  170. package/dist/stores/accounts/accounts-database.d.ts.map +1 -0
  171. package/dist/stores/accounts/accounts-database.js +685 -0
  172. package/dist/stores/accounts/accounts-database.js.map +1 -0
  173. package/dist/stores/accounts/accounts-store.d.ts +32 -0
  174. package/dist/stores/accounts/accounts-store.d.ts.map +1 -0
  175. package/dist/stores/accounts/accounts-store.js +169 -0
  176. package/dist/stores/accounts/accounts-store.js.map +1 -0
  177. package/dist/stores/accounts/index.d.ts +4 -0
  178. package/dist/stores/accounts/index.d.ts.map +1 -0
  179. package/dist/stores/accounts/index.js +4 -0
  180. package/dist/stores/accounts/index.js.map +1 -0
  181. package/dist/stores/accounts/utils.d.ts +49 -0
  182. package/dist/stores/accounts/utils.d.ts.map +1 -0
  183. package/dist/stores/accounts/utils.js +419 -0
  184. package/dist/stores/accounts/utils.js.map +1 -0
  185. package/dist/stores/authors-comments/authors-comments-store.d.ts +37 -0
  186. package/dist/stores/authors-comments/authors-comments-store.d.ts.map +1 -0
  187. package/dist/stores/authors-comments/authors-comments-store.js +338 -0
  188. package/dist/stores/authors-comments/authors-comments-store.js.map +1 -0
  189. package/dist/stores/authors-comments/index.d.ts +4 -0
  190. package/dist/stores/authors-comments/index.d.ts.map +1 -0
  191. package/dist/stores/authors-comments/index.js +4 -0
  192. package/dist/stores/authors-comments/index.js.map +1 -0
  193. package/dist/stores/authors-comments/utils.d.ts +14 -0
  194. package/dist/stores/authors-comments/utils.d.ts.map +1 -0
  195. package/dist/stores/authors-comments/utils.js +81 -0
  196. package/dist/stores/authors-comments/utils.js.map +1 -0
  197. package/dist/stores/comments/comments-store.d.ts +19 -0
  198. package/dist/stores/comments/comments-store.d.ts.map +1 -0
  199. package/dist/stores/comments/comments-store.js +385 -0
  200. package/dist/stores/comments/comments-store.js.map +1 -0
  201. package/dist/stores/comments/index.d.ts +4 -0
  202. package/dist/stores/comments/index.d.ts.map +1 -0
  203. package/dist/stores/comments/index.js +4 -0
  204. package/dist/stores/comments/index.js.map +1 -0
  205. package/dist/stores/communities/communities-store.d.ts +17 -0
  206. package/dist/stores/communities/communities-store.d.ts.map +1 -0
  207. package/dist/stores/communities/communities-store.js +304 -0
  208. package/dist/stores/communities/communities-store.js.map +1 -0
  209. package/dist/stores/communities/index.d.ts +4 -0
  210. package/dist/stores/communities/index.d.ts.map +1 -0
  211. package/dist/stores/communities/index.js +4 -0
  212. package/dist/stores/communities/index.js.map +1 -0
  213. package/dist/stores/communities-pages/communities-pages-store.d.ts +23 -0
  214. package/dist/stores/communities-pages/communities-pages-store.d.ts.map +1 -0
  215. package/dist/stores/communities-pages/communities-pages-store.js +316 -0
  216. package/dist/stores/communities-pages/communities-pages-store.js.map +1 -0
  217. package/dist/stores/communities-pages/index.d.ts +4 -0
  218. package/dist/stores/communities-pages/index.d.ts.map +1 -0
  219. package/dist/stores/communities-pages/index.js +4 -0
  220. package/dist/stores/communities-pages/index.js.map +1 -0
  221. package/dist/stores/feeds/feed-sorter.d.ts +5 -0
  222. package/dist/stores/feeds/feed-sorter.d.ts.map +1 -0
  223. package/dist/stores/feeds/feed-sorter.js +135 -0
  224. package/dist/stores/feeds/feed-sorter.js.map +1 -0
  225. package/dist/stores/feeds/feeds-store.d.ts +25 -0
  226. package/dist/stores/feeds/feeds-store.d.ts.map +1 -0
  227. package/dist/stores/feeds/feeds-store.js +459 -0
  228. package/dist/stores/feeds/feeds-store.js.map +1 -0
  229. package/dist/stores/feeds/index.d.ts +4 -0
  230. package/dist/stores/feeds/index.d.ts.map +1 -0
  231. package/dist/stores/feeds/index.js +4 -0
  232. package/dist/stores/feeds/index.js.map +1 -0
  233. package/dist/stores/feeds/utils.d.ts +43 -0
  234. package/dist/stores/feeds/utils.d.ts.map +1 -0
  235. package/dist/stores/feeds/utils.js +736 -0
  236. package/dist/stores/feeds/utils.js.map +1 -0
  237. package/dist/stores/replies/index.d.ts +4 -0
  238. package/dist/stores/replies/index.d.ts.map +1 -0
  239. package/dist/stores/replies/index.js +4 -0
  240. package/dist/stores/replies/index.js.map +1 -0
  241. package/dist/stores/replies/replies-comments-store.d.ts +8 -0
  242. package/dist/stores/replies/replies-comments-store.d.ts.map +1 -0
  243. package/dist/stores/replies/replies-comments-store.js +23 -0
  244. package/dist/stores/replies/replies-comments-store.js.map +1 -0
  245. package/dist/stores/replies/replies-store.d.ts +29 -0
  246. package/dist/stores/replies/replies-store.d.ts.map +1 -0
  247. package/dist/stores/replies/replies-store.js +413 -0
  248. package/dist/stores/replies/replies-store.js.map +1 -0
  249. package/dist/stores/replies/utils.d.ts +25 -0
  250. package/dist/stores/replies/utils.d.ts.map +1 -0
  251. package/dist/stores/replies/utils.js +549 -0
  252. package/dist/stores/replies/utils.js.map +1 -0
  253. package/dist/stores/replies-pages/index.d.ts +4 -0
  254. package/dist/stores/replies-pages/index.d.ts.map +1 -0
  255. package/dist/stores/replies-pages/index.js +4 -0
  256. package/dist/stores/replies-pages/index.js.map +1 -0
  257. package/dist/stores/replies-pages/replies-pages-store.d.ts +20 -0
  258. package/dist/stores/replies-pages/replies-pages-store.d.ts.map +1 -0
  259. package/dist/stores/replies-pages/replies-pages-store.js +270 -0
  260. package/dist/stores/replies-pages/replies-pages-store.js.map +1 -0
  261. package/dist/stores/replies-pages/utils.d.ts +3 -0
  262. package/dist/stores/replies-pages/utils.d.ts.map +1 -0
  263. package/dist/stores/replies-pages/utils.js +43 -0
  264. package/dist/stores/replies-pages/utils.js.map +1 -0
  265. package/dist/types.d.ts +638 -0
  266. package/dist/types.d.ts.map +1 -0
  267. package/dist/types.js +3 -0
  268. package/dist/types.js.map +1 -0
  269. package/package.json +160 -0
@@ -0,0 +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;AAElC,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,EAAE;IACjC,uBAAuB,GAAG,EAAE,CAAC;IAC7B,sBAAsB,GAAG,EAAE,CAAC;AAC9B,CAAC,CAAC;AACF,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AG;AAErD,MAAM,OAAO,aAAc,SAAQ,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\";\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(options: { address: string }) {\n return this.resolveAuthorAddress(options);\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 ) {\n for (const prop in createdOwnerCommunities[createCommunityOptions.address]) {\n if (createdOwnerCommunities[createCommunityOptions.address][prop]) {\n createCommunityOptions[prop] =\n createdOwnerCommunities[createCommunityOptions.address][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 ];\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 updating = false;\n firstUpdate = true;\n address: string | undefined;\n title: string | undefined;\n description: string | undefined;\n posts: Pages;\n modQueue: Pages;\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.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\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.updateCalledTimes > 1) {\n throw Error(\n \"with the current hooks, community.update() should be called maximum 1 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 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 delete() {\n if (this.address) {\n delete createdOwnerCommunities[this.address];\n delete editedOwnerCommunities[this.address];\n }\n }\n\n simulateUpdateEvent() {\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.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 challenges: [challenge],\n };\n this.emit(\"challenge\", challengeMessage, this);\n }\n\n async publishChallengeAnswers(challengeAnswers: string[]) {\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 this.cid = createCommentOptions?.cid;\n this.upvoteCount = createCommentOptions?.upvoteCount;\n this.downvoteCount = createCommentOptions?.downvoteCount;\n this.content = createCommentOptions?.content;\n this.author = createCommentOptions?.author;\n this.timestamp = createCommentOptions?.timestamp;\n this.parentCid = createCommentOptions?.parentCid;\n this.communityAddress = createCommentOptions?.communityAddress;\n this.state = \"stopped\";\n this.updatingState = \"stopped\";\n this.publishingState = \"stopped\";\n\n if (createCommentOptions?.author?.address) {\n this.author.shortAddress = `short ${createCommentOptions.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"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: () => void;
2
+ export default _default;
3
+ //# sourceMappingURL=polyfill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/lib/polyfill.ts"],"names":[],"mappings":";AAcA,wBAAwB"}
@@ -0,0 +1,14 @@
1
+ // import this file at the very top of index.ts to polyfill
2
+ // stuff for browsers
3
+ // fix "ReferenceError: process is not defined" in "assert" package
4
+ if (window.process === undefined) {
5
+ const processPolyfill = {};
6
+ // @ts-ignore
7
+ window.process = processPolyfill;
8
+ }
9
+ if (window.process.env === undefined) {
10
+ window.process.env = {};
11
+ }
12
+ // must export a function and call it or this file isn't read
13
+ export default () => { };
14
+ //# sourceMappingURL=polyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polyfill.js","sourceRoot":"","sources":["../../src/lib/polyfill.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,qBAAqB;AAErB,mEAAmE;AACnE,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;IACjC,MAAM,eAAe,GAAQ,EAAE,CAAC;IAChC,aAAa;IACb,MAAM,CAAC,OAAO,GAAG,eAAe,CAAC;AACnC,CAAC;AACD,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;IACrC,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;AAC1B,CAAC;AAED,6DAA6D;AAC7D,eAAe,GAAG,EAAE,GAAE,CAAC,CAAC","sourcesContent":["// import this file at the very top of index.ts to polyfill\n// stuff for browsers\n\n// fix \"ReferenceError: process is not defined\" in \"assert\" package\nif (window.process === undefined) {\n const processPolyfill: any = {};\n // @ts-ignore\n window.process = processPolyfill;\n}\nif (window.process.env === undefined) {\n window.process.env = {};\n}\n\n// must export a function and call it or this file isn't read\nexport default () => {};\n"]}
@@ -0,0 +1,14 @@
1
+ export declare const getPkcCreateCommunity: (pkc: any) => any;
2
+ export declare const getPkcGetCommunity: (pkc: any) => any;
3
+ export declare const getPkcCreateCommunityEdit: (pkc: any) => any;
4
+ export declare const getPkcCommunityAddresses: (pkc: any) => string[];
5
+ export declare const normalizePublicationOptionsForPkc: <T extends Record<string, any>>(_pkc: any, options: T) => T;
6
+ export declare const normalizePublicationOptionsForStore: <T extends Record<string, any>>(options: T) => T;
7
+ export declare const normalizeCommunityEditOptionsForPkc: <T extends Record<string, any>>(pkc: any, options: T) => T;
8
+ export declare const getCommentCommunityAddress: (comment: any) => string | undefined;
9
+ export declare const normalizeCommentCommunityAddress: <T extends Record<string, any> | undefined>(comment: T) => T;
10
+ export declare const backfillPublicationCommunityAddress: <T extends Record<string, any> | undefined, O extends Record<string, any> | undefined>(publication: T, options: O) => T;
11
+ export declare const createPkcCommunity: (pkc: any, options: any) => Promise<any>;
12
+ export declare const getPkcCommunity: (pkc: any, options: any) => Promise<any>;
13
+ export declare const createPkcCommunityEdit: (pkc: any, options: any) => Promise<any>;
14
+ //# sourceMappingURL=protocol-compat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol-compat.d.ts","sourceRoot":"","sources":["../../src/lib/protocol-compat.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,GAAI,KAAK,GAAG,QAAyB,CAAC;AAExE,eAAO,MAAM,kBAAkB,GAAI,KAAK,GAAG,QAAsB,CAAC;AAElE,eAAO,MAAM,yBAAyB,GAAI,KAAK,GAAG,QAA6B,CAAC;AAEhF,eAAO,MAAM,wBAAwB,GAAI,KAAK,GAAG,KAAG,MAAM,EAKzD,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7E,MAAM,GAAG,EACT,SAAS,CAAC,KACT,CAAY,CAAC;AAEhB,eAAO,MAAM,mCAAmC,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,KAAG,CACvF,CAAC;AAEV,eAAO,MAAM,mCAAmC,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/E,KAAK,GAAG,EACR,SAAS,CAAC,KACT,CAQF,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,SAAS,GAAG,KAAG,MAAM,GAAG,SACxC,CAAC;AAO5B,eAAO,MAAM,gCAAgC,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACxF,SAAS,CAAC,KACT,CAKF,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACzC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EAEzC,aAAa,CAAC,EACd,SAAS,CAAC,KACT,CAUF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAU,KAAK,GAAG,EAAE,SAAS,GAAG,iBAI9D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,KAAK,GAAG,EAAE,SAAS,GAAG,iBAI3D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAU,KAAK,GAAG,EAAE,SAAS,GAAG,iBAIlE,CAAC"}
@@ -0,0 +1,67 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import assert from "assert";
11
+ export const getPkcCreateCommunity = (pkc) => pkc === null || pkc === void 0 ? void 0 : pkc.createCommunity;
12
+ export const getPkcGetCommunity = (pkc) => pkc === null || pkc === void 0 ? void 0 : pkc.getCommunity;
13
+ export const getPkcCreateCommunityEdit = (pkc) => pkc === null || pkc === void 0 ? void 0 : pkc.createCommunityEdit;
14
+ export const getPkcCommunityAddresses = (pkc) => {
15
+ if (Array.isArray(pkc === null || pkc === void 0 ? void 0 : pkc.communities)) {
16
+ return pkc.communities;
17
+ }
18
+ return [];
19
+ };
20
+ export const normalizePublicationOptionsForPkc = (_pkc, options) => options;
21
+ export const normalizePublicationOptionsForStore = (options) => options;
22
+ export const normalizeCommunityEditOptionsForPkc = (pkc, options) => {
23
+ const normalized = normalizePublicationOptionsForPkc(pkc, options);
24
+ const editOptions = normalized.communityEdit;
25
+ if (!editOptions) {
26
+ return normalized;
27
+ }
28
+ normalized.communityEdit = editOptions;
29
+ return normalized;
30
+ };
31
+ export const getCommentCommunityAddress = (comment) => comment === null || comment === void 0 ? void 0 : comment.communityAddress;
32
+ const isLiveCommentInstance = (comment) => typeof (comment === null || comment === void 0 ? void 0 : comment.on) === "function" ||
33
+ typeof (comment === null || comment === void 0 ? void 0 : comment.once) === "function" ||
34
+ typeof (comment === null || comment === void 0 ? void 0 : comment.update) === "function";
35
+ export const normalizeCommentCommunityAddress = (comment) => {
36
+ if (!comment || comment.communityAddress) {
37
+ return comment;
38
+ }
39
+ return isLiveCommentInstance(comment) ? comment : Object.assign({}, comment);
40
+ };
41
+ export const backfillPublicationCommunityAddress = (publication, options) => {
42
+ if (!publication || publication.communityAddress) {
43
+ return publication;
44
+ }
45
+ const communityAddress = options === null || options === void 0 ? void 0 : options.communityAddress;
46
+ if (!communityAddress) {
47
+ return publication;
48
+ }
49
+ publication.communityAddress = communityAddress;
50
+ return publication;
51
+ };
52
+ export const createPkcCommunity = (pkc, options) => __awaiter(void 0, void 0, void 0, function* () {
53
+ const createCommunity = getPkcCreateCommunity(pkc);
54
+ assert(typeof createCommunity === "function", "pkc createCommunity missing");
55
+ return createCommunity.call(pkc, options);
56
+ });
57
+ export const getPkcCommunity = (pkc, options) => __awaiter(void 0, void 0, void 0, function* () {
58
+ const getCommunity = getPkcGetCommunity(pkc);
59
+ assert(typeof getCommunity === "function", "pkc getCommunity missing");
60
+ return getCommunity.call(pkc, options);
61
+ });
62
+ export const createPkcCommunityEdit = (pkc, options) => __awaiter(void 0, void 0, void 0, function* () {
63
+ const createCommunityEdit = getPkcCreateCommunityEdit(pkc);
64
+ assert(typeof createCommunityEdit === "function", "pkc createCommunityEdit missing");
65
+ return createCommunityEdit.call(pkc, options);
66
+ });
67
+ //# sourceMappingURL=protocol-compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol-compat.js","sourceRoot":"","sources":["../../src/lib/protocol-compat.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,qBAAqB,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E,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAO,GAAQ,EAAE,OAAY,EAAE,EAAE;IAC9D,MAAM,YAAY,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,CAAC,OAAO,YAAY,KAAK,UAAU,EAAE,0BAA0B,CAAC,CAAC;IACvE,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAO,GAAQ,EAAE,OAAY,EAAE,EAAE;IACrE,MAAM,mBAAmB,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAC3D,MAAM,CAAC,OAAO,mBAAmB,KAAK,UAAU,EAAE,iCAAiC,CAAC,CAAC;IACrF,OAAO,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC,CAAA,CAAC","sourcesContent":["import assert from \"assert\";\n\nexport const getPkcCreateCommunity = (pkc: any) => pkc?.createCommunity;\n\nexport const getPkcGetCommunity = (pkc: any) => pkc?.getCommunity;\n\nexport const getPkcCreateCommunityEdit = (pkc: any) => pkc?.createCommunityEdit;\n\nexport const getPkcCommunityAddresses = (pkc: any): string[] => {\n if (Array.isArray(pkc?.communities)) {\n return pkc.communities;\n }\n return [];\n};\n\nexport const normalizePublicationOptionsForPkc = <T extends Record<string, any>>(\n _pkc: any,\n options: T,\n): T => options;\n\nexport const normalizePublicationOptionsForStore = <T extends Record<string, any>>(options: T): T =>\n options;\n\nexport const normalizeCommunityEditOptionsForPkc = <T extends Record<string, any>>(\n pkc: any,\n options: T,\n): T => {\n const normalized: Record<string, any> = normalizePublicationOptionsForPkc(pkc, options);\n const editOptions = normalized.communityEdit;\n if (!editOptions) {\n return normalized as T;\n }\n normalized.communityEdit = editOptions;\n return normalized as T;\n};\n\nexport const getCommentCommunityAddress = (comment: any): string | undefined =>\n comment?.communityAddress;\n\nconst isLiveCommentInstance = (comment: any) =>\n typeof comment?.on === \"function\" ||\n typeof comment?.once === \"function\" ||\n typeof comment?.update === \"function\";\n\nexport const normalizeCommentCommunityAddress = <T extends Record<string, any> | undefined>(\n comment: T,\n): T => {\n if (!comment || comment.communityAddress) {\n return comment;\n }\n return isLiveCommentInstance(comment) ? comment : ({ ...comment } as T);\n};\n\nexport const backfillPublicationCommunityAddress = <\n T extends Record<string, any> | undefined,\n O extends Record<string, any> | undefined,\n>(\n publication: T,\n options: O,\n): T => {\n if (!publication || publication.communityAddress) {\n return publication;\n }\n const communityAddress = options?.communityAddress;\n if (!communityAddress) {\n return publication;\n }\n publication.communityAddress = communityAddress;\n return publication;\n};\n\nexport const createPkcCommunity = async (pkc: any, options: any) => {\n const createCommunity = getPkcCreateCommunity(pkc);\n assert(typeof createCommunity === \"function\", \"pkc createCommunity missing\");\n return createCommunity.call(pkc, options);\n};\n\nexport const getPkcCommunity = async (pkc: any, options: any) => {\n const getCommunity = getPkcGetCommunity(pkc);\n assert(typeof getCommunity === \"function\", \"pkc getCommunity missing\");\n return getCommunity.call(pkc, options);\n};\n\nexport const createPkcCommunityEdit = async (pkc: any, options: any) => {\n const createCommunityEdit = getPkcCreateCommunityEdit(pkc);\n assert(typeof createCommunityEdit === \"function\", \"pkc createCommunityEdit missing\");\n return createCommunityEdit.call(pkc, options);\n};\n"]}
@@ -0,0 +1,29 @@
1
+ declare function renderHook<Result, Props>(callback: (props: Props) => Result, options?: {
2
+ initialProps?: Props;
3
+ }): {
4
+ result: {
5
+ current: Result | null;
6
+ all: Result[];
7
+ };
8
+ rerender: (rerenderCallbackProps: Props) => void;
9
+ unmount: () => void;
10
+ };
11
+ type WaitForOptions = {
12
+ timeout?: number;
13
+ interval?: number;
14
+ };
15
+ export { renderHook };
16
+ declare const testUtils: {
17
+ silenceTestWasNotWrappedInActWarning: () => () => void;
18
+ silenceUpdateUnmountedComponentWarning: () => () => void;
19
+ silenceOverlappingActWarning: () => () => void;
20
+ silenceReactWarnings: () => void;
21
+ restoreAll: () => void;
22
+ resetStores: () => Promise<void>;
23
+ resetDatabasesAndStores: () => Promise<void>;
24
+ createWaitFor: (rendered: any, waitForOptions?: WaitForOptions) => (waitForFunction: Function) => Promise<void>;
25
+ renderHookWithHistory: typeof renderHook;
26
+ silenceWaitForWarning: boolean;
27
+ };
28
+ export default testUtils;
29
+ //# sourceMappingURL=test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/lib/test-utils.ts"],"names":[],"mappings":"AAqBA,iBAAS,UAAU,CAAC,MAAM,EAAE,KAAK,EAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,EAClC,OAAO,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE;;iBAGA,MAAM,GAAG,IAAI;aAAa,MAAM,EAAE;;sCAc3B,KAAK;;EAO/C;AA6DD,KAAK,cAAc,GAAG;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAsEF,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,SAAS;;;;;;;;8BAvEkB,GAAG,mBAAmB,cAAc,uBAI3B,QAAQ;;;CA+EjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,184 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
21
+ import { render, act as tlAct } from "@testing-library/react";
22
+ import React from "react";
23
+ import { resetCommentsStore, resetCommentsDatabaseAndStore } from "../stores/comments/index.js";
24
+ import { resetCommunitiesStore, resetCommunitiesDatabaseAndStore } from "../stores/communities/index.js";
25
+ import { resetAccountsStore, resetAccountsDatabaseAndStore } from "../stores/accounts/index.js";
26
+ import { resetFeedsStore, resetFeedsDatabaseAndStore } from "../stores/feeds/index.js";
27
+ import { resetCommunitiesPagesStore, resetCommunitiesPagesDatabaseAndStore, } from "../stores/communities-pages/index.js";
28
+ import { resetAuthorsCommentsStore, resetAuthorsCommentsDatabaseAndStore, } from "../stores/authors-comments/index.js";
29
+ import { resetRepliesStore, resetRepliesDatabaseAndStore } from "../stores/replies/index.js";
30
+ import { resetRepliesPagesStore, resetRepliesPagesDatabaseAndStore } from "../stores/replies-pages/index.js";
31
+ // Custom renderHook that sets result.current synchronously during render,
32
+ // matching @testing-library/react-hooks behavior. RTL v16's renderHook defers
33
+ // result.current via useEffect, which breaks polling-based waitFor patterns
34
+ // when Zustand store updates trigger re-renders outside act().
35
+ function renderHook(callback, options) {
36
+ const _a = options || {}, { initialProps } = _a, renderOptions = __rest(_a, ["initialProps"]);
37
+ const result = { current: null, all: [] };
38
+ function TestComponent({ renderCallbackProps }) {
39
+ const pendingResult = callback(renderCallbackProps);
40
+ result.current = pendingResult;
41
+ result.all.push(pendingResult);
42
+ return null;
43
+ }
44
+ const { rerender: baseRerender, unmount } = render(React.createElement(TestComponent, { renderCallbackProps: initialProps }), renderOptions);
45
+ function rerender(rerenderCallbackProps) {
46
+ return baseRerender(React.createElement(TestComponent, { renderCallbackProps: rerenderCallbackProps }));
47
+ }
48
+ return { result, rerender, unmount };
49
+ }
50
+ const restorables = [];
51
+ const silenceUpdateUnmountedComponentWarning = () => {
52
+ const originalError = console.error;
53
+ console.error = (...args) => {
54
+ if (/Can't perform a React state update on an unmounted component/.test(args[0])) {
55
+ return;
56
+ }
57
+ originalError.call(console, ...args);
58
+ };
59
+ const restore = () => {
60
+ console.error = originalError;
61
+ };
62
+ restorables.push(restore);
63
+ return restore;
64
+ };
65
+ const silenceTestWasNotWrappedInActWarning = () => {
66
+ const originalError = console.error;
67
+ console.error = (...args) => {
68
+ if (/inside a test was not wrapped in act/.test(args[0])) {
69
+ return;
70
+ }
71
+ originalError.call(console, ...args);
72
+ };
73
+ const restore = () => {
74
+ console.error = originalError;
75
+ };
76
+ restorables.push(restore);
77
+ return restore;
78
+ };
79
+ // this warning is usually good to have, so don't include it in silenceReactWarnings
80
+ const silenceOverlappingActWarning = () => {
81
+ const originalError = console.error;
82
+ console.error = (...args) => {
83
+ if (/overlapping act\(\) calls/.test(args[0])) {
84
+ return;
85
+ }
86
+ originalError.call(console, ...args);
87
+ };
88
+ const restore = () => {
89
+ console.error = originalError;
90
+ };
91
+ restorables.push(restore);
92
+ return restore;
93
+ };
94
+ const silenceReactWarnings = () => {
95
+ silenceUpdateUnmountedComponentWarning();
96
+ silenceTestWasNotWrappedInActWarning();
97
+ };
98
+ const restoreAll = () => {
99
+ for (const restore of restorables) {
100
+ restore();
101
+ }
102
+ };
103
+ const createWaitFor = (rendered, waitForOptions) => {
104
+ if (!(rendered === null || rendered === void 0 ? void 0 : rendered.result)) {
105
+ throw Error(`createWaitFor invalid 'rendered' argument`);
106
+ }
107
+ const waitFor = (waitForFunction) => __awaiter(void 0, void 0, void 0, function* () {
108
+ const stackTraceLimit = Error.stackTraceLimit;
109
+ Error.stackTraceLimit = 10;
110
+ const errorWithUsefulStackTrace = new Error("waitFor");
111
+ Error.stackTraceLimit = stackTraceLimit;
112
+ if (typeof waitForFunction !== "function") {
113
+ throw Error(`waitFor invalid 'waitForFunction' argument`);
114
+ }
115
+ // @ts-ignore
116
+ if (typeof waitForFunction.then === "function") {
117
+ throw Error(`waitFor 'waitForFunction' can't be async`);
118
+ }
119
+ const { timeout = 2000, interval = 50 } = waitForOptions || {};
120
+ const start = Date.now();
121
+ while (true) {
122
+ // flush pending React/Zustand state updates before each check
123
+ yield tlAct(() => __awaiter(void 0, void 0, void 0, function* () { }));
124
+ try {
125
+ if (waitForFunction())
126
+ return;
127
+ }
128
+ catch (_a) {
129
+ // condition threw (e.g. accessing property on undefined), keep waiting
130
+ }
131
+ if (Date.now() - start >= timeout) {
132
+ errorWithUsefulStackTrace.message = `Timed out in waitFor after ${timeout}ms. ${waitForFunction.toString()}`;
133
+ if (!testUtils.silenceWaitForWarning) {
134
+ console.warn(errorWithUsefulStackTrace);
135
+ }
136
+ return;
137
+ }
138
+ yield new Promise((resolve) => setTimeout(resolve, interval));
139
+ }
140
+ });
141
+ return waitFor;
142
+ };
143
+ // always reset the least important store first, because a store even can affect another store
144
+ const resetStores = () => __awaiter(void 0, void 0, void 0, function* () {
145
+ yield resetRepliesPagesStore();
146
+ yield resetRepliesStore();
147
+ yield resetAuthorsCommentsStore();
148
+ yield resetCommunitiesPagesStore();
149
+ yield resetFeedsStore();
150
+ yield resetCommunitiesStore();
151
+ yield resetCommentsStore();
152
+ // always accounts last because it has async initialization
153
+ yield resetAccountsStore();
154
+ });
155
+ const resetDatabasesAndStores = () => __awaiter(void 0, void 0, void 0, function* () {
156
+ yield resetRepliesPagesDatabaseAndStore();
157
+ yield resetRepliesDatabaseAndStore();
158
+ yield resetAuthorsCommentsDatabaseAndStore();
159
+ yield resetCommunitiesPagesDatabaseAndStore();
160
+ yield resetFeedsDatabaseAndStore();
161
+ yield resetCommunitiesDatabaseAndStore();
162
+ yield resetCommentsDatabaseAndStore();
163
+ // always accounts last because it has async initialization
164
+ yield resetAccountsDatabaseAndStore();
165
+ });
166
+ // renderHookWithHistory is kept for backward compatibility but our custom
167
+ // renderHook already tracks result.all, so this is just a passthrough.
168
+ const renderHookWithHistory = renderHook;
169
+ export { renderHook };
170
+ const testUtils = {
171
+ silenceTestWasNotWrappedInActWarning,
172
+ silenceUpdateUnmountedComponentWarning,
173
+ silenceOverlappingActWarning,
174
+ silenceReactWarnings,
175
+ restoreAll,
176
+ resetStores,
177
+ resetDatabasesAndStores,
178
+ createWaitFor,
179
+ renderHookWithHistory,
180
+ // can be useful to silence warnings in tests that use retry
181
+ silenceWaitForWarning: false,
182
+ };
183
+ export default testUtils;
184
+ //# sourceMappingURL=test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../src/lib/test-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EACL,0BAA0B,EAC1B,qCAAqC,GACtC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,yBAAyB,EACzB,oCAAoC,GACrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,iC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9C,MAAM,0BAA0B,EAAE,CAAC;IACnC,MAAM,gCAAgC,EAAE,CAAC;IACzC,MAAM,6BAA6B,EAAE,CAAC;IACtC,2DAA2D;IAC3D,MAAM,6BAA6B,EAAE,CAAC;AACxC,CAAC,CAAA,CAAC;AAEF,0EAA0E;AAC1E,uEAAuE;AACvE,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,MAAM,SAAS,GAAG;IAChB,oCAAoC;IACpC,sCAAsC;IACtC,4BAA4B;IAC5B,oBAAoB;IACpB,UAAU;IACV,WAAW;IACX,uBAAuB;IACvB,aAAa;IACb,qBAAqB;IACrB,4DAA4D;IAC5D,qBAAqB,EAAE,KAAK;CAC7B,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { render, act as tlAct } from \"@testing-library/react\";\nimport React from \"react\";\nimport { resetCommentsStore, resetCommentsDatabaseAndStore } from \"../stores/comments\";\nimport { resetCommunitiesStore, resetCommunitiesDatabaseAndStore } from \"../stores/communities\";\nimport { resetAccountsStore, resetAccountsDatabaseAndStore } from \"../stores/accounts\";\nimport { resetFeedsStore, resetFeedsDatabaseAndStore } from \"../stores/feeds\";\nimport {\n resetCommunitiesPagesStore,\n resetCommunitiesPagesDatabaseAndStore,\n} from \"../stores/communities-pages\";\nimport {\n resetAuthorsCommentsStore,\n resetAuthorsCommentsDatabaseAndStore,\n} from \"../stores/authors-comments\";\nimport { resetRepliesStore, resetRepliesDatabaseAndStore } from \"../stores/replies\";\nimport { resetRepliesPagesStore, resetRepliesPagesDatabaseAndStore } from \"../stores/replies-pages\";\n\n// Custom renderHook that sets result.current synchronously during render,\n// matching @testing-library/react-hooks behavior. RTL v16's renderHook defers\n// result.current via useEffect, which breaks polling-based waitFor patterns\n// when Zustand store updates trigger re-renders outside act().\nfunction renderHook<Result, Props>(\n callback: (props: Props) => Result,\n options?: { initialProps?: Props },\n) {\n const { initialProps, ...renderOptions } = options || {};\n const result = { current: null as Result | null, all: [] as Result[] };\n\n function TestComponent({ renderCallbackProps }: { renderCallbackProps: Props }) {\n const pendingResult = callback(renderCallbackProps);\n result.current = pendingResult;\n result.all.push(pendingResult);\n return null;\n }\n\n const { rerender: baseRerender, unmount } = render(\n React.createElement(TestComponent, { renderCallbackProps: initialProps as Props }),\n renderOptions as any,\n );\n\n function rerender(rerenderCallbackProps: Props) {\n return baseRerender(\n React.createElement(TestComponent, { renderCallbackProps: rerenderCallbackProps }),\n );\n }\n\n return { result, rerender, unmount };\n}\n\nconst restorables: any = [];\n\nconst silenceUpdateUnmountedComponentWarning = () => {\n const originalError = console.error;\n console.error = (...args) => {\n if (/Can't perform a React state update on an unmounted component/.test(args[0])) {\n return;\n }\n originalError.call(console, ...args);\n };\n const restore = () => {\n console.error = originalError;\n };\n restorables.push(restore);\n return restore;\n};\n\nconst silenceTestWasNotWrappedInActWarning = () => {\n const originalError = console.error;\n console.error = (...args) => {\n if (/inside a test was not wrapped in act/.test(args[0])) {\n return;\n }\n originalError.call(console, ...args);\n };\n const restore = () => {\n console.error = originalError;\n };\n restorables.push(restore);\n return restore;\n};\n\n// this warning is usually good to have, so don't include it in silenceReactWarnings\nconst silenceOverlappingActWarning = () => {\n const originalError = console.error;\n console.error = (...args) => {\n if (/overlapping act\\(\\) calls/.test(args[0])) {\n return;\n }\n originalError.call(console, ...args);\n };\n const restore = () => {\n console.error = originalError;\n };\n restorables.push(restore);\n return restore;\n};\n\nconst silenceReactWarnings = () => {\n silenceUpdateUnmountedComponentWarning();\n silenceTestWasNotWrappedInActWarning();\n};\n\nconst restoreAll = () => {\n for (const restore of restorables) {\n restore();\n }\n};\n\ntype WaitForOptions = {\n timeout?: number;\n interval?: number;\n};\nconst createWaitFor = (rendered: any, waitForOptions?: WaitForOptions) => {\n if (!rendered?.result) {\n throw Error(`createWaitFor invalid 'rendered' argument`);\n }\n const waitFor = async (waitForFunction: Function) => {\n const stackTraceLimit = Error.stackTraceLimit;\n Error.stackTraceLimit = 10;\n const errorWithUsefulStackTrace = new Error(\"waitFor\");\n Error.stackTraceLimit = stackTraceLimit;\n\n if (typeof waitForFunction !== \"function\") {\n throw Error(`waitFor invalid 'waitForFunction' argument`);\n }\n // @ts-ignore\n if (typeof waitForFunction.then === \"function\") {\n throw Error(`waitFor 'waitForFunction' can't be async`);\n }\n const { timeout = 2000, interval = 50 } = waitForOptions || {};\n const start = Date.now();\n while (true) {\n // flush pending React/Zustand state updates before each check\n await tlAct(async () => {});\n try {\n if (waitForFunction()) return;\n } catch {\n // condition threw (e.g. accessing property on undefined), keep waiting\n }\n if (Date.now() - start >= timeout) {\n errorWithUsefulStackTrace.message = `Timed out in waitFor after ${timeout}ms. ${waitForFunction.toString()}`;\n if (!testUtils.silenceWaitForWarning) {\n console.warn(errorWithUsefulStackTrace);\n }\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, interval));\n }\n };\n return waitFor;\n};\n\n// always reset the least important store first, because a store even can affect another store\nconst resetStores = async () => {\n await resetRepliesPagesStore();\n await resetRepliesStore();\n await resetAuthorsCommentsStore();\n await resetCommunitiesPagesStore();\n await resetFeedsStore();\n await resetCommunitiesStore();\n await resetCommentsStore();\n // always accounts last because it has async initialization\n await resetAccountsStore();\n};\n\nconst resetDatabasesAndStores = async () => {\n await resetRepliesPagesDatabaseAndStore();\n await resetRepliesDatabaseAndStore();\n await resetAuthorsCommentsDatabaseAndStore();\n await resetCommunitiesPagesDatabaseAndStore();\n await resetFeedsDatabaseAndStore();\n await resetCommunitiesDatabaseAndStore();\n await resetCommentsDatabaseAndStore();\n // always accounts last because it has async initialization\n await resetAccountsDatabaseAndStore();\n};\n\n// renderHookWithHistory is kept for backward compatibility but our custom\n// renderHook already tracks result.all, so this is just a passthrough.\nconst renderHookWithHistory = renderHook;\n\nexport { renderHook };\n\nconst testUtils = {\n silenceTestWasNotWrappedInActWarning,\n silenceUpdateUnmountedComponentWarning,\n silenceOverlappingActWarning,\n silenceReactWarnings,\n restoreAll,\n resetStores,\n resetDatabasesAndStores,\n createWaitFor,\n renderHookWithHistory,\n // can be useful to silence warnings in tests that use retry\n silenceWaitForWarning: false,\n};\n\nexport default testUtils;\n"]}
@@ -0,0 +1,4 @@
1
+ import { Comment } from "../../types.js";
2
+ export declare function addCommentModeration(comment: Comment | undefined): Comment | undefined;
3
+ export declare function addCommentModerationToComments<T extends Comment | undefined>(comments: T[] | undefined): T[];
4
+ //# sourceMappingURL=comment-moderation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment-moderation.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/comment-moderation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AActC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAoCtF;AAED,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,OAAO,GAAG,SAAS,EAC1E,QAAQ,EAAE,CAAC,EAAE,GAAG,SAAS,GACxB,CAAC,EAAE,CAeL"}
@@ -0,0 +1,56 @@
1
+ const moderationPropertyNames = [
2
+ "spoiler",
3
+ "nsfw",
4
+ "pinned",
5
+ "locked",
6
+ "archived",
7
+ "approved",
8
+ "removed",
9
+ "purged",
10
+ "reason",
11
+ ];
12
+ export function addCommentModeration(comment) {
13
+ if (!comment) {
14
+ return comment;
15
+ }
16
+ let nextCommentModeration = comment.commentModeration && typeof comment.commentModeration === "object"
17
+ ? comment.commentModeration
18
+ : undefined;
19
+ let changed = false;
20
+ for (const propertyName of moderationPropertyNames) {
21
+ const propertyValue = comment[propertyName];
22
+ if (propertyValue === undefined) {
23
+ continue;
24
+ }
25
+ if (!nextCommentModeration) {
26
+ nextCommentModeration = {};
27
+ changed = true;
28
+ }
29
+ if (nextCommentModeration[propertyName] !== propertyValue) {
30
+ if (nextCommentModeration === comment.commentModeration) {
31
+ nextCommentModeration = Object.assign({}, comment.commentModeration);
32
+ }
33
+ nextCommentModeration[propertyName] = propertyValue;
34
+ changed = true;
35
+ }
36
+ }
37
+ if (!changed) {
38
+ return comment;
39
+ }
40
+ return Object.assign(Object.assign({}, comment), { commentModeration: nextCommentModeration });
41
+ }
42
+ export function addCommentModerationToComments(comments) {
43
+ if (!comments) {
44
+ return [];
45
+ }
46
+ let changed = false;
47
+ const normalizedComments = comments.map((comment) => {
48
+ const normalizedComment = addCommentModeration(comment);
49
+ if (normalizedComment !== comment) {
50
+ changed = true;
51
+ }
52
+ return normalizedComment;
53
+ });
54
+ return changed ? normalizedComments : comments;
55
+ }
56
+ //# sourceMappingURL=comment-moderation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment-moderation.js","sourceRoot":"","sources":["../../../src/lib/utils/comment-moderation.ts"],"names":[],"mappings":"AAEA,MAAM,uBAAuB,GAAG;IAC9B,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,QAAQ;CACA,CAAC;AAEX,MAAM,UAAU,oBAAoB,CAAC,OAA4B;IAC/D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,qBAAqB,GACvB,OAAO,CAAC,iBAAiB,IAAI,OAAO,OAAO,CAAC,iBAAiB,KAAK,QAAQ;QACxE,CAAC,CAAC,OAAO,CAAC,iBAAiB;QAC3B,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,KAAK,MAAM,YAAY,IAAI,uBAAuB,EAAE,CAAC;QACnD,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YAChC,SAAS;QACX,CAAC;QAED,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC3B,qBAAqB,GAAG,EAAE,CAAC;YAC3B,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QAED,IAAI,qBAAqB,CAAC,YAAY,CAAC,KAAK,aAAa,EAAE,CAAC;YAC1D,IAAI,qBAAqB,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC;gBACxD,qBAAqB,qBAAQ,OAAO,CAAC,iBAAiB,CAAE,CAAC;YAC3D,CAAC;YACD,qBAAqB,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC;YACpD,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,uCAAY,OAAO,KAAE,iBAAiB,EAAE,qBAAqB,IAAG;AAClE,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,QAAyB;IAEzB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAS,CAAC;IACnB,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,kBAAkB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAClD,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,OAAO,CAAM,CAAC;QAC7D,IAAI,iBAAiB,KAAK,OAAO,EAAE,CAAC;YAClC,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC;AACjD,CAAC","sourcesContent":["import { Comment } from \"../../types\";\n\nconst moderationPropertyNames = [\n \"spoiler\",\n \"nsfw\",\n \"pinned\",\n \"locked\",\n \"archived\",\n \"approved\",\n \"removed\",\n \"purged\",\n \"reason\",\n] as const;\n\nexport function addCommentModeration(comment: Comment | undefined): Comment | undefined {\n if (!comment) {\n return comment;\n }\n\n let nextCommentModeration =\n comment.commentModeration && typeof comment.commentModeration === \"object\"\n ? comment.commentModeration\n : undefined;\n let changed = false;\n\n for (const propertyName of moderationPropertyNames) {\n const propertyValue = comment[propertyName];\n if (propertyValue === undefined) {\n continue;\n }\n\n if (!nextCommentModeration) {\n nextCommentModeration = {};\n changed = true;\n }\n\n if (nextCommentModeration[propertyName] !== propertyValue) {\n if (nextCommentModeration === comment.commentModeration) {\n nextCommentModeration = { ...comment.commentModeration };\n }\n nextCommentModeration[propertyName] = propertyValue;\n changed = true;\n }\n }\n\n if (!changed) {\n return comment;\n }\n\n return { ...comment, commentModeration: nextCommentModeration };\n}\n\nexport function addCommentModerationToComments<T extends Comment | undefined>(\n comments: T[] | undefined,\n): T[] {\n if (!comments) {\n return [] as T[];\n }\n\n let changed = false;\n const normalizedComments = comments.map((comment) => {\n const normalizedComment = addCommentModeration(comment) as T;\n if (normalizedComment !== comment) {\n changed = true;\n }\n return normalizedComment;\n });\n\n return changed ? normalizedComments : comments;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import utils from "./utils.js";
2
+ export * from "./utils.js";
3
+ export default utils;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,eAAe,KAAK,CAAC"}
@@ -0,0 +1,4 @@
1
+ import utils from "./utils.js";
2
+ export * from "./utils.js";
3
+ export default utils;
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,eAAe,KAAK,CAAC","sourcesContent":["import utils from \"./utils\";\nexport * from \"./utils\";\nexport default utils;\n"]}
@@ -0,0 +1,23 @@
1
+ import { Comment } from "../../types.js";
2
+ export declare const flattenCommentsPages: (pageInstanceOrPagesInstance: any) => any[];
3
+ export declare const communityPostsCacheExpired: (community: any) => boolean;
4
+ export declare const removeInvalidComments: (comments: Comment[], { validateReplies, blockCommunity }: any, pkc: any) => Promise<Comment[]>;
5
+ export declare const commentIsValid: (comment: Comment, { validateReplies, blockCommunity }: any | undefined, pkc: any) => Promise<boolean>;
6
+ declare const utils: {
7
+ merge: (...args: any) => any;
8
+ clone: (obj: any) => any;
9
+ flattenCommentsPages: (pageInstanceOrPagesInstance: any) => any[];
10
+ memo: (functionToMemo: Function, memoOptions: any) => (...args: any) => Promise<any>;
11
+ memoSync: (functionToMemo: Function, memoOptions: any) => (...args: any) => any;
12
+ retryInfinity: (f: any, o?: any) => any;
13
+ retryInfinityMinTimeout: number;
14
+ retryInfinityMaxTimeout: number;
15
+ clientsOnStateChange: (clients: any, onStateChange: Function) => void;
16
+ pageClientsOnStateChange: (clients: any, onStateChange: Function) => void;
17
+ communityPostsCacheExpired: (community: any) => boolean;
18
+ commentIsValid: (comment: Comment, { validateReplies, blockCommunity }: any | undefined, pkc: any) => Promise<boolean>;
19
+ removeInvalidComments: (comments: Comment[], { validateReplies, blockCommunity }: any, pkc: any) => Promise<Comment[]>;
20
+ repliesAreValid: (comment: Comment, { validateReplies, blockCommunity }: any | undefined, pkc: any) => Promise<boolean>;
21
+ };
22
+ export default utils;
23
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAuDtC,eAAO,MAAM,oBAAoB,GAAI,6BAA6B,GAAG,UA2CpE,CAAC;AA2LF,eAAO,MAAM,0BAA0B,GAAI,WAAW,GAAG,YAQxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,UAAU,OAAO,EAAE,EACnB,qCAAqC,GAAG,EACxC,KAAK,GAAG,uBAUT,CAAC;AAGF,eAAO,MAAM,cAAc,GACzB,SAAS,OAAO,EAChB,qCAAqC,GAAG,YAAK,EAC7C,KAAK,GAAG,qBAyBT,CAAC;AAoEF,QAAA,MAAM,KAAK;qBAjZa,GAAG;iBAmBP,GAAG;wDA8B2C,GAAG;2BA6CvC,QAAQ,eAAe,GAAG,eAQd,GAAG;+BAyDX,QAAQ,eAAe,GAAG,eAOxB,GAAG;uBAiPlB,GAAG,MAAM,GAAG,KAAG,GAAG;;;oCAzMA,GAAG,iBAAiB,QAAQ;wCAyCxB,GAAG,iBAAiB,QAAQ;4CAgCjB,GAAG;8BA2B9C,OAAO,uCACqB,GAAG,mBACnC,GAAG;sCAlBE,OAAO,EAAE,uCACkB,GAAG,OACnC,GAAG;+BA4CC,OAAO,uCACqB,GAAG,mBACnC,GAAG;CA+ET,CAAC;AAoBF,eAAe,KAAK,CAAC"}