@pkcprotocol/pkc-js 0.0.157 → 0.0.159

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 (152) hide show
  1. package/README.md +58 -3
  2. package/dist/browser/clients/base-client-manager.js +24 -11
  3. package/dist/browser/clients/base-client-manager.js.map +1 -1
  4. package/dist/browser/clients/rpc-client/pkc-rpc-client.js +17 -9
  5. package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  6. package/dist/browser/clients/rpc-client/schema.d.ts +2 -0
  7. package/dist/browser/community/schema.d.ts +26 -0
  8. package/dist/browser/detached-guard.d.ts +5 -0
  9. package/dist/browser/detached-guard.js +50 -0
  10. package/dist/browser/detached-guard.js.map +1 -0
  11. package/dist/browser/errors.d.ts +2 -0
  12. package/dist/browser/errors.js +2 -0
  13. package/dist/browser/errors.js.map +1 -1
  14. package/dist/browser/generated-version.d.ts +1 -1
  15. package/dist/browser/generated-version.js +1 -1
  16. package/dist/browser/helia/helia-for-pkc.js +6 -5
  17. package/dist/browser/helia/helia-for-pkc.js.map +1 -1
  18. package/dist/browser/index-with-compile-cache.d.ts +4 -0
  19. package/dist/browser/index.d.ts +8 -0
  20. package/dist/browser/pages/schema.d.ts +6 -0
  21. package/dist/browser/pkc-error.d.ts +1 -1
  22. package/dist/browser/publications/comment/comment.d.ts +2 -0
  23. package/dist/browser/publications/comment/comment.js +2 -0
  24. package/dist/browser/publications/comment/comment.js.map +1 -1
  25. package/dist/browser/publications/comment/schema.d.ts +6 -2
  26. package/dist/browser/publications/comment/schema.js +13 -1
  27. package/dist/browser/publications/comment/schema.js.map +1 -1
  28. package/dist/browser/publications/comment-moderation/schema.js +2 -2
  29. package/dist/browser/publications/comment-moderation/schema.js.map +1 -1
  30. package/dist/browser/publications/publication.js +26 -32
  31. package/dist/browser/publications/publication.js.map +1 -1
  32. package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +4 -0
  33. package/dist/browser/rpc/src/schema.d.ts +24 -0
  34. package/dist/browser/runtime/node/community/db-handler.d.ts +1 -0
  35. package/dist/browser/runtime/node/community/db-handler.js +31 -7
  36. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  37. package/dist/browser/runtime/node/community/local-community/cleanup.js +6 -0
  38. package/dist/browser/runtime/node/community/local-community/cleanup.js.map +1 -1
  39. package/dist/browser/runtime/node/community/local-community/comment-updates.js +36 -0
  40. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  41. package/dist/browser/runtime/node/community/local-community/db-fault.d.ts +3 -0
  42. package/dist/browser/runtime/node/community/local-community/db-fault.js +13 -0
  43. package/dist/browser/runtime/node/community/local-community/db-fault.js.map +1 -0
  44. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +36 -2
  45. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  46. package/dist/browser/runtime/node/community/local-community/lifecycle.js +36 -2
  47. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  48. package/dist/browser/runtime/node/community/local-community/post-updates-bucket.d.ts +21 -0
  49. package/dist/browser/runtime/node/community/local-community/post-updates-bucket.js +141 -4
  50. package/dist/browser/runtime/node/community/local-community/post-updates-bucket.js.map +1 -1
  51. package/dist/browser/runtime/node/community/local-community.d.ts +7 -0
  52. package/dist/browser/runtime/node/community/local-community.js +18 -0
  53. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  54. package/dist/browser/runtime/node/test/helpers/hanging-runner.js +7 -3
  55. package/dist/browser/runtime/node/test/helpers/hanging-runner.js.map +1 -1
  56. package/dist/browser/runtime/node/test/helpers/run-hanging-node.js +6 -1
  57. package/dist/browser/runtime/node/test/helpers/run-hanging-node.js.map +1 -1
  58. package/dist/browser/schema/schema-util.d.ts +10 -0
  59. package/dist/browser/schema/schema.d.ts +9 -0
  60. package/dist/browser/schema/schema.js +9 -1
  61. package/dist/browser/schema/schema.js.map +1 -1
  62. package/dist/browser/schema.d.ts +32 -0
  63. package/dist/browser/signer/pseudonymity-author-tag.d.ts +8 -0
  64. package/dist/browser/signer/pseudonymity-author-tag.js +39 -0
  65. package/dist/browser/signer/pseudonymity-author-tag.js.map +1 -0
  66. package/dist/browser/signer/signatures.js +16 -0
  67. package/dist/browser/signer/signatures.js.map +1 -1
  68. package/dist/browser/test/test-util.d.ts +10 -0
  69. package/dist/browser/version.js +1 -1
  70. package/dist/bundled/bundle-manifest.json +58 -53
  71. package/dist/bundled/challenges.js +1 -1
  72. package/dist/bundled/chunks/{helia-for-pkc-BT2UmDem.js → helia-for-pkc-CP5A7i4M.js} +5 -4
  73. package/dist/bundled/chunks/{local-community-oqjqTa9T.js → local-community-0xsjgulY.js} +373 -26
  74. package/dist/bundled/chunks/{local-community-BexngGU7.js → local-community-CUDfHfH_.js} +1 -1
  75. package/dist/bundled/chunks/{node-CvXtQ-4A.js → node-Bv7hIiW_.js} +40 -38
  76. package/dist/bundled/chunks/{page-sort-scoring-VN_GGInQ.js → page-sort-scoring-I02fuGkI.js} +1 -1
  77. package/dist/bundled/chunks/{rpc-local-community-BjIHRbYy.js → rpc-local-community-Bo4Z7ilA.js} +57 -13
  78. package/dist/bundled/chunks/{util-DDsWXOtP.js → util-BZuCmqxu.js} +12 -9
  79. package/dist/bundled/chunks/{util-Bu3ItQsN.js → util-xhgmI11L.js} +1 -1
  80. package/dist/bundled/chunks/{validate-package-factories-CmJt781W.js → validate-package-factories-BsSEIr__.js} +2 -2
  81. package/dist/bundled/index.js +1 -1
  82. package/dist/bundled/page-sorts.js +1 -1
  83. package/dist/bundled/rpc/src/index.js +4 -4
  84. package/dist/node/clients/base-client-manager.js +24 -11
  85. package/dist/node/clients/base-client-manager.js.map +1 -1
  86. package/dist/node/clients/rpc-client/pkc-rpc-client.js +17 -9
  87. package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  88. package/dist/node/clients/rpc-client/schema.d.ts +2 -0
  89. package/dist/node/community/schema.d.ts +26 -0
  90. package/dist/node/detached-guard.d.ts +5 -0
  91. package/dist/node/detached-guard.js +50 -0
  92. package/dist/node/detached-guard.js.map +1 -0
  93. package/dist/node/errors.d.ts +2 -0
  94. package/dist/node/errors.js +2 -0
  95. package/dist/node/errors.js.map +1 -1
  96. package/dist/node/generated-version.d.ts +1 -1
  97. package/dist/node/generated-version.js +1 -1
  98. package/dist/node/helia/helia-for-pkc.js +6 -5
  99. package/dist/node/helia/helia-for-pkc.js.map +1 -1
  100. package/dist/node/index-with-compile-cache.d.ts +4 -0
  101. package/dist/node/index.d.ts +8 -0
  102. package/dist/node/pages/schema.d.ts +6 -0
  103. package/dist/node/pkc-error.d.ts +1 -1
  104. package/dist/node/publications/comment/comment.d.ts +2 -0
  105. package/dist/node/publications/comment/comment.js +2 -0
  106. package/dist/node/publications/comment/comment.js.map +1 -1
  107. package/dist/node/publications/comment/schema.d.ts +6 -2
  108. package/dist/node/publications/comment/schema.js +13 -1
  109. package/dist/node/publications/comment/schema.js.map +1 -1
  110. package/dist/node/publications/comment-moderation/schema.js +2 -2
  111. package/dist/node/publications/comment-moderation/schema.js.map +1 -1
  112. package/dist/node/publications/publication.js +26 -32
  113. package/dist/node/publications/publication.js.map +1 -1
  114. package/dist/node/rpc/src/lib/pkc-js/index.d.ts +4 -0
  115. package/dist/node/rpc/src/schema.d.ts +24 -0
  116. package/dist/node/runtime/node/community/db-handler.d.ts +1 -0
  117. package/dist/node/runtime/node/community/db-handler.js +31 -7
  118. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  119. package/dist/node/runtime/node/community/local-community/cleanup.js +6 -0
  120. package/dist/node/runtime/node/community/local-community/cleanup.js.map +1 -1
  121. package/dist/node/runtime/node/community/local-community/comment-updates.js +36 -0
  122. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  123. package/dist/node/runtime/node/community/local-community/db-fault.d.ts +3 -0
  124. package/dist/node/runtime/node/community/local-community/db-fault.js +13 -0
  125. package/dist/node/runtime/node/community/local-community/db-fault.js.map +1 -0
  126. package/dist/node/runtime/node/community/local-community/ipns-publishing.js +36 -2
  127. package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  128. package/dist/node/runtime/node/community/local-community/lifecycle.js +36 -2
  129. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  130. package/dist/node/runtime/node/community/local-community/post-updates-bucket.d.ts +21 -0
  131. package/dist/node/runtime/node/community/local-community/post-updates-bucket.js +141 -4
  132. package/dist/node/runtime/node/community/local-community/post-updates-bucket.js.map +1 -1
  133. package/dist/node/runtime/node/community/local-community.d.ts +7 -0
  134. package/dist/node/runtime/node/community/local-community.js +18 -0
  135. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  136. package/dist/node/runtime/node/test/helpers/hanging-runner.js +7 -3
  137. package/dist/node/runtime/node/test/helpers/hanging-runner.js.map +1 -1
  138. package/dist/node/runtime/node/test/helpers/run-hanging-node.js +6 -1
  139. package/dist/node/runtime/node/test/helpers/run-hanging-node.js.map +1 -1
  140. package/dist/node/schema/schema-util.d.ts +10 -0
  141. package/dist/node/schema/schema.d.ts +9 -0
  142. package/dist/node/schema/schema.js +9 -1
  143. package/dist/node/schema/schema.js.map +1 -1
  144. package/dist/node/schema.d.ts +32 -0
  145. package/dist/node/signer/pseudonymity-author-tag.d.ts +8 -0
  146. package/dist/node/signer/pseudonymity-author-tag.js +39 -0
  147. package/dist/node/signer/pseudonymity-author-tag.js.map +1 -0
  148. package/dist/node/signer/signatures.js +16 -0
  149. package/dist/node/signer/signatures.js.map +1 -1
  150. package/dist/node/test/test-util.d.ts +10 -0
  151. package/dist/node/version.js +1 -1
  152. package/package.json +3 -2
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as retryKuboIpfsAdd, At as ChallengeAnswerMessageSchema, Br as messages, C as hideClassPrivateProps, Cr as e, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Er as r, Et as untrackUpdatingCommunity, Fr as FailedToFetchCommentUpdateFromGatewaysError, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, Jt as version_default, Mt as ChallengeMessageSchema, Nr as require_retry$1, Ot as TimeoutError, Pr as FailedToFetchCommentIpfsFromGatewaysError, Pt as ChallengeRequestMessageSchema, Rr as FailedToFetchPageIpfsFromGatewaysError, Sr as t$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenAbortSignalFires, Vr as logger_default, W as rejectWhenCommunityStopsOrAborts, Wr as setErrorMap, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Z as resolveWhenPredicateIsTrue, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, br as n$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, ft as findUpdatingComment, gr as isStringDomain, gt as listUpdatingComments, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, ii as en_default, jn as CommentIpfsSchema, k as isIpns, kt as pTimeout, nt as shortifyCid, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, rt as sleepUntilTimeoutOrAbort, st as waitForUpdateInCommunityInstanceWithErrorAndTimeout, tt as shortifyAddress, u as createAbortError, vr as n$2, vt as refreshTrackedCommentAliases, wr as e$1, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, z as linkAbortSignals, zn as CommentUpdateSchema, zr as PKCError } from "./util-DDsWXOtP.js";
3
- import { $n as getAuthorNameFromWire, $r as n$3, $t as RpcPublishAnchorRecordParamSchema, A as findCommentInParsedPages, An as signCommunityEdit, At as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommentPubsubMessage, Bt as RpcCommentRepliesPageParamSchema, C as RepliesPages, Cr as createKuboRpcClient, Ct as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dt as parseDecryptedChallengeVerification, En as signCommentModeration, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fr as markLocalCommunityDbAsBeingWritten, Ft as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Gn as verifyVote, Gt as RpcExportCommunityModLogsParamSchema, Hr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Ht as RpcCommunityIdentifierParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyChallengeVerification, Ir as monitorCommunitiesDirectory, It as RpcAnchorPublishPreparationResultSchema, J as decodeRpcChallengeAnswerPubsubMsg, Jn as mergeAuthorProps, Jt as RpcExportCommunityResultSchema, Kn as assignUnknownProps, Kr as findCommunitiesEntry, Kt as RpcExportCommunityModLogsResultSchema, Ln as verifyCommentEdit, Lt as RpcAuthorNameParamSchema, M as parseRawPages, Mn as signVote, Mt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Nt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, Or as findLocalCommunityAddress, Ot as parseDecryptedChallengeWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyChallengeMessage, Pr as isLocalCommunityAddress, Qn as getAuthorNameFromRuntime, Qr as t$3, Qt as RpcFetchCommunityListResultSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentIpfs, Rr as registerLocalCommunity, Rt as RpcCancelExportParamSchema, Sn as signChallengeRequest, Tn as signCommentEdit, Tt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, U as InflightFetchManager, Un as verifyCommunityEdit, Ut as RpcCommunityPageParamSchema, Vn as verifyCommentUpdate, Vr as setNativeFunctions$1, Vt as RpcCommunitiesChangeEventResultSchema, W as InflightResourceTypes, Wn as verifyCommunityList, Wt as RpcEditCommunityParamSchema, X as decodeRpcChallengeRequestPubsubMsg, Xn as buildRuntimeAuthor, Xt as RpcFetchCidResultSchema, Y as decodeRpcChallengePubsubMsg, Yn as withoutForbiddenKeys, Yr as t$5, Yt as RpcFetchCidParamSchema, Z as decodeRpcChallengeVerificationPubsubMsg, Zn as cleanWireAuthor, Zt as RpcFetchCommunityListParamSchema, _r as getPKCAddressFromPublicKeySync, _t as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, ai as NAME_RESOLVED_TRUE_TTL_MS, an as RpcSubscriptionIdResultSchema, at as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, b as KeyvBetterSqlite3, bn as signChallengeAnswer, bt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, cn as findCommunityRecordNameMismatch, cr as getCommunityAddressFromRecord, ct as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, dr as normalizeCommunityInputFromCommunity, dt as parseCommunityAddressWithPKCErrorIfItFails, en as RpcPublishChallengeAnswersParamSchema, er as normalizeCreatePublicationAuthor, fn as createSigner, fr as decode, gn as encryptEd25519AesGcm, gt as parseCommunityListSchemaWithPKCErrorIfItFails, ii as NAME_RESOLVED_FALSE_TTL_MS, in as RpcResolveAuthorNameResultSchema, ir as MAX_COMMUNITY_LIST_SIZE_BYTES, jn as signCommunityList, jr as getDefaultDataPath, jt as parseRpcCommentEventWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kt as parseJsonWithPKCErrorIfFails, l as pkcJsPageSorts, li as nativeFunctions$2, ln as verifyAuthorWalletEntry, lr as getCommunityNameFromWire, lt as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, m as pkcJsChallenges, mn as decryptEd25519AesGcm, mr as getBufferedPKCAddressFromPublicKey, mt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, ni as t$4, nn as RpcPublishCommunityListResultSchema, nr as CreateCommunityListWithCidOptionsSchema, nt as parseCidStringSchemaWithPKCErrorIfItFails, oi as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, on as RpcSuccessResultSchema, ot as parseCommentIpfsSchemaWithPKCErrorIfItFails, pn as createAnchorIpnsRecord$1, q as PKCTypedEmitter, qr as toCommunitiesEntry, qt as RpcExportCommunityParamSchema, ri as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, rn as RpcPublishedAnchorRecordResultSchema, rr as CreateNewCommunityListOptionsSchema, sn as RpcUnsubscribeParamSchema, sr as buildRuntimeCommunityFields, t as RpcLocalCommunity, ti as t$2, tn as RpcPublishCommunityListParamSchema, un as require_lib$1, ur as getCommunityPublicKeyFromWire, ut as parseCommentUpdateSchemaWithPKCErrorIfItFails, v as TrackedInstanceRegistry, vt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, wn as signComment, wt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, x as RemoteCommunity, y as LRUCache, yn as cleanUpBeforePublishing, yt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, z as PKCClientsManager, zn as verifyCommentModeration, zt as RpcCidParamSchema } from "./rpc-local-community-BjIHRbYy.js";
4
- import { s as getHeliaDebugContext } from "./util-Bu3ItQsN.js";
2
+ import { $ as retryKuboIpfsAdd, At as ChallengeAnswerMessageSchema, Br as messages, C as hideClassPrivateProps, Cr as e, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Er as r, Et as untrackUpdatingCommunity, Fr as FailedToFetchCommentUpdateFromGatewaysError, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, Jt as version_default, Mt as ChallengeMessageSchema, Nr as require_retry$1, Ot as TimeoutError, Pr as FailedToFetchCommentIpfsFromGatewaysError, Pt as ChallengeRequestMessageSchema, Rr as FailedToFetchPageIpfsFromGatewaysError, Sr as t$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenAbortSignalFires, Vr as logger_default, W as rejectWhenCommunityStopsOrAborts, Wr as setErrorMap, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Z as resolveWhenPredicateIsTrue, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, br as n$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, ft as findUpdatingComment, gr as isStringDomain, gt as listUpdatingComments, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, ii as en_default, jn as CommentIpfsSchema, k as isIpns, kt as pTimeout, nt as shortifyCid, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, rt as sleepUntilTimeoutOrAbort, st as waitForUpdateInCommunityInstanceWithErrorAndTimeout, tt as shortifyAddress, u as createAbortError, vr as n$2, vt as refreshTrackedCommentAliases, wr as e$1, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, z as linkAbortSignals, zn as CommentUpdateSchema, zr as PKCError } from "./util-BZuCmqxu.js";
3
+ import { $n as cleanWireAuthor, $t as RpcPublishAnchorRecordParamSchema, A as findCommentInParsedPages, At as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommentIpfs, Br as getDefaultDataPath, Bt as RpcCommentRepliesPageParamSchema, C as RepliesPages, Ct as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommentEdit, Dt as parseDecryptedChallengeVerification, En as signComment, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Ft as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Gn as verifyCommunityEdit, Gr as monitorCommunitiesDirectory, Gt as RpcExportCommunityModLogsParamSchema, Hn as verifyCommentPubsubMessage, Ht as RpcCommunityIdentifierParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyChallengeMessage, It as RpcAnchorPublishPreparationResultSchema, J as decodeRpcChallengeAnswerPubsubMsg, Jn as assignUnknownProps, Jt as RpcExportCommunityResultSchema, Kn as verifyCommunityList, Kt as RpcExportCommunityModLogsResultSchema, Lr as findLocalCommunityAddress, Lt as RpcAuthorNameParamSchema, M as parseRawPages, Mn as signCommunityEdit, Mr as createKuboRpcClient, Mt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Nn as signCommunityList, Nt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommentModeration, Ot as parseDecryptedChallengeWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as signVote, Qn as buildRuntimeAuthor, Qt as RpcFetchCommunityListResultSchema, R as stripNameResolvedFromCrosspost, Rn as verifyChallengeVerification, Rt as RpcCancelExportParamSchema, Sn as signChallengeAnswer, Tt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, U as InflightFetchManager, Un as verifyCommentUpdate, Ur as isLocalCommunityAddress, Ut as RpcCommunityPageParamSchema, Vn as verifyCommentModeration, Vt as RpcCommunitiesChangeEventResultSchema, W as InflightResourceTypes, Wr as markLocalCommunityDbAsBeingWritten, Wt as RpcEditCommunityParamSchema, X as decodeRpcChallengeRequestPubsubMsg, Xn as mergeAuthorProps, Xr as setNativeFunctions$1, Xt as RpcFetchCidResultSchema, Y as decodeRpcChallengePubsubMsg, Yt as RpcFetchCidParamSchema, Z as decodeRpcChallengeVerificationPubsubMsg, Zn as withoutForbiddenKeys, Zr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Zt as RpcFetchCommunityListParamSchema, _t as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, an as RpcSubscriptionIdResultSchema, ar as CreateNewCommunityListOptionsSchema, at as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, b as KeyvBetterSqlite3, bt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ci as n$3, cn as findCommunityRecordNameMismatch, ct as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, di as t$4, dn as require_lib$1, dr as getCommunityNameFromWire, dt as parseCommunityAddressWithPKCErrorIfItFails, en as RpcPublishChallengeAnswersParamSchema, er as getAuthorNameFromRuntime, fi as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, fn as guardDetached, fr as getCommunityPublicKeyFromWire, gn as decryptEd25519AesGcm, gr as getBufferedPKCAddressFromPublicKey, gt as parseCommunityListSchemaWithPKCErrorIfItFails, hi as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, hn as createAnchorIpnsRecord$1, ii as t$5, in as RpcResolveAuthorNameResultSchema, ir as CreateCommunityListWithCidOptionsSchema, jt as parseRpcCommentEventWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kt as parseJsonWithPKCErrorIfFails, l as pkcJsPageSorts, ln as verifyAuthorWalletEntry, lr as buildRuntimeCommunityFields, lt as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, m as pkcJsChallenges, mi as NAME_RESOLVED_TRUE_TTL_MS, mn as createSigner, mr as decode, mt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, ni as toCommunitiesEntry, nn as RpcPublishCommunityListResultSchema, nr as normalizeCreatePublicationAuthor, nt as parseCidStringSchemaWithPKCErrorIfItFails, on as RpcSuccessResultSchema, or as MAX_COMMUNITY_LIST_SIZE_BYTES, ot as parseCommentIpfsSchemaWithPKCErrorIfItFails, pi as NAME_RESOLVED_FALSE_TTL_MS, pr as normalizeCommunityInputFromCommunity, q as PKCTypedEmitter, qn as verifyVote, qr as registerLocalCommunity, qt as RpcExportCommunityParamSchema, rn as RpcPublishedAnchorRecordResultSchema, si as t$3, sn as RpcUnsubscribeParamSchema, t as RpcLocalCommunity, ti as findCommunitiesEntry, tn as RpcPublishCommunityListParamSchema, tr as getAuthorNameFromWire, ui as t$2, ur as getCommunityAddressFromRecord, ut as parseCommentUpdateSchemaWithPKCErrorIfItFails, v as TrackedInstanceRegistry, vi as nativeFunctions$2, vn as encryptEd25519AesGcm, vt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, wn as signChallengeRequest, wt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, x as RemoteCommunity, xn as cleanUpBeforePublishing, y as LRUCache, yr as getPKCAddressFromPublicKeySync, yt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, z as PKCClientsManager, zn as verifyCommentEdit, zt as RpcCidParamSchema } from "./rpc-local-community-Bo4Z7ilA.js";
4
+ import { s as getHeliaDebugContext } from "./util-xhgmI11L.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -28099,13 +28099,11 @@ var Publication = class extends import_lib.TypedEmitter {
28099
28099
  else this._pkc._publishingPublications.delete(this);
28100
28100
  }
28101
28101
  _guardDetachedHandler(entryPoint, handler) {
28102
- return async (...args) => {
28103
- try {
28104
- await handler(...args);
28105
- } catch (e) {
28106
- await this._endPublicationAfterDetachedFailure(entryPoint, e);
28107
- }
28108
- };
28102
+ return guardDetached({
28103
+ entryPoint: `Publication ${entryPoint}`,
28104
+ handler,
28105
+ onFailure: (cause) => this._endPublicationAfterDetachedFailure(entryPoint, cause)
28106
+ });
28109
28107
  }
28110
28108
  async _endPublicationAfterDetachedFailure(entryPoint, cause) {
28111
28109
  const log = logger_default("pkc-js:publication:_endPublicationAfterDetachedFailure");
@@ -28115,25 +28113,20 @@ var Publication = class extends import_lib.TypedEmitter {
28115
28113
  cause
28116
28114
  });
28117
28115
  const endedBefore = this._publishEndedBy;
28118
- const failsThePublication = this._claimPublishEnd("failure");
28119
- try {
28120
- if (failsThePublication) {
28121
- try {
28122
- await this._postSucessOrFailurePublishing();
28123
- } catch (teardownError) {
28124
- log.error(`Teardown after the failure of ${entryPoint} threw as well`, teardownError);
28116
+ if (this._claimPublishEnd("failure")) {
28117
+ try {
28118
+ await this._postSucessOrFailurePublishing();
28119
+ } catch (teardownError) {
28120
+ log.error(`Teardown after the failure of ${entryPoint} threw as well`, teardownError);
28121
+ }
28122
+ this._changePublicationStateEmitEventEmitStateChangeEvent({
28123
+ newPublishingState: "failed",
28124
+ event: {
28125
+ name: "error",
28126
+ args: [error]
28125
28127
  }
28126
- this._changePublicationStateEmitEventEmitStateChangeEvent({
28127
- newPublishingState: "failed",
28128
- event: {
28129
- name: "error",
28130
- args: [error]
28131
- }
28132
- });
28133
- } else if (endedBefore !== "stop") this.emit("error", error);
28134
- } catch (emitError) {
28135
- log.error(`Could not report the failure of ${entryPoint}`, emitError);
28136
- }
28128
+ });
28129
+ } else if (endedBefore !== "stop") this.emit("error", error);
28137
28130
  }
28138
28131
  async _tearDownWithoutThrowing() {
28139
28132
  try {
@@ -30061,6 +30054,7 @@ var Comment = class extends Publication {
30061
30054
  this.archived = props.archived;
30062
30055
  this.removed = props.removed;
30063
30056
  this.reason = props.reason;
30057
+ this.authorBanExpiresAt = props.authorBanExpiresAt;
30064
30058
  this.edit = props.edit;
30065
30059
  this.protocolVersion = props.protocolVersion;
30066
30060
  this.spoiler = typeof props.spoiler === "boolean" ? props.spoiler : typeof props.edit?.spoiler === "boolean" ? props.edit?.spoiler : this.spoiler;
@@ -30077,6 +30071,7 @@ var Comment = class extends Publication {
30077
30071
  this.author.flairs = props.author?.community?.flairs || props.edit?.author?.flairs || this.author?.flairs;
30078
30072
  this.lastChildCid = props.lastChildCid;
30079
30073
  this.lastReplyTimestamp = props.lastReplyTimestamp;
30074
+ this.pseudonymityAuthorTag = "pseudonymityAuthorTag" in props ? props.pseudonymityAuthorTag : void 0;
30080
30075
  this._updateRepliesPostsInstance(props.replies, community);
30081
30076
  if (typeof this.pendingApproval === "boolean" || "pendingApproval" in props) this.pendingApproval = Boolean("pendingApproval" in props && props.pendingApproval);
30082
30077
  else if ("approved" in props && typeof props.approved === "boolean") this.pendingApproval = false;
@@ -31273,14 +31268,21 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
31273
31268
  const socket = this._webSocketClient.socket;
31274
31269
  if (!socket || this._socketsWithNotificationHandler.has(socket)) return;
31275
31270
  this._socketsWithNotificationHandler.add(socket);
31276
- socket.on("message", (jsonMessage) => {
31277
- const message = JSON.parse(jsonMessage);
31278
- if (!isRpcSubscriptionNotification(message)) return;
31279
- const serverSubscriptionId = message.params.subscription;
31280
- const subscriptionId = this._localIdByServerId.get(serverSubscriptionId) ?? serverSubscriptionId;
31281
- message.params.subscription = subscriptionId;
31282
- this._dispatchNotification(subscriptionId, message);
31283
- });
31271
+ socket.on("message", guardDetached({
31272
+ entryPoint: "PKCRpcClient socket message",
31273
+ handler: (jsonMessage) => {
31274
+ const message = JSON.parse(jsonMessage);
31275
+ if (!isRpcSubscriptionNotification(message)) return;
31276
+ const serverSubscriptionId = message.params.subscription;
31277
+ const subscriptionId = this._localIdByServerId.get(serverSubscriptionId) ?? serverSubscriptionId;
31278
+ message.params.subscription = subscriptionId;
31279
+ this._dispatchNotification(subscriptionId, message);
31280
+ },
31281
+ onFailure: (cause) => this.emit("error", new PKCError("ERR_RPC_CLIENT_FAILED_TO_HANDLE_SERVER_MESSAGE", {
31282
+ rpcUrl: this._websocketServerUrl,
31283
+ cause
31284
+ }))
31285
+ }));
31284
31286
  }
31285
31287
  _dispatchNotification(subscriptionId, message) {
31286
31288
  this._initSubscriptionEvent(subscriptionId);
@@ -36383,7 +36385,7 @@ var PKC$1 = class extends PKCTypedEmitter {
36383
36385
  this.clients.libp2pJsClients = {};
36384
36386
  if (!this.libp2pJsClientsOptions) return;
36385
36387
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
36386
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-BT2UmDem.js");
36388
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CP5A7i4M.js");
36387
36389
  for (const clientOptions of this.libp2pJsClientsOptions) {
36388
36390
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
36389
36391
  ...clientOptions,
@@ -36760,7 +36762,7 @@ var PKC$1 = class extends PKCTypedEmitter {
36760
36762
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
36761
36763
  log.trace("Received community options to create a local community instance:", options);
36762
36764
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
36763
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-BexngGU7.js");
36765
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-CUDfHfH_.js");
36764
36766
  const isLocalCommunity = isLocalCommunityAddress(this, options.address);
36765
36767
  const community = new LocalCommunity(this);
36766
36768
  if (isLocalCommunity) {
@@ -1,4 +1,4 @@
1
- import { bn as PageSortFileSchema, gr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-DDsWXOtP.js";
1
+ import { bn as PageSortFileSchema, gr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-BZuCmqxu.js";
2
2
  //#region dist/node/pages/page-sort-scoring.js
3
3
  function validatePageSortFile(rawFile) {
4
4
  const validated = PageSortFileSchema.parse(rawFile);
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $r as preprocess, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as t$10, B as pubsubTopicToDhtKey, Bn as CommentUpdateSignedPropertyNames, Br as messages, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as e$6, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as t$12, Dt as require_sha256$1, E as isAbortError, Er as r$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchCommentUpdateFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as _enum, Gt as PKCParsedOptionsSchema, H as raceAgainstAbort, Hr as require_supports_color, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchCommunityFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as custom, Kn as PageIpfsSchema, Kr as array, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as FailedToFetchGenericIpfsFromGatewaysError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as e$4, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as require_retry$2, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as n$8, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommentIpfsFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as object, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as FailedToFetchPageIpfsFromGatewaysError, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as t$13, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$11, Un as CreateCommentOptionsWithRefinementSchema, Ur as require_ms$1, Ut as NameResolveCacheOptionsSchema, Vr as logger_default, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as looseObject, Yr as literal, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as number, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, _r as normalizeEthAliasDomain, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersByIndexSchema, at as throwIfAbortSignalAborted, bn as PageSortFileSchema, br as n$10, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as record, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as isStringDomain, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isEthAliasDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, jn as CommentIpfsSchema, jr as t$9, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as r$7, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, ni as union, nr as AuthorCommentIpfsReservedFields, nt as shortifyCid, on as ChallengeFileFactorySchema, or as CidPathSchema, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, q as removeNullUndefinedEmptyObjectsValuesRecursively, qn as isReservedObjectKey, qr as boolean, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, rt as sleepUntilTimeoutOrAbort, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, ti as string, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyAddress, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$9, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as e$5, wt as untrackStartedCommunity, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as linkAbortSignals, zn as CommentUpdateSchema, zr as PKCError } from "./util-DDsWXOtP.js";
2
+ import { $r as preprocess, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as t$10, B as pubsubTopicToDhtKey, Bn as CommentUpdateSignedPropertyNames, Br as messages, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as e$6, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as t$12, Dt as require_sha256$1, E as isAbortError, Er as r$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchCommentUpdateFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as _enum, Gt as PKCParsedOptionsSchema, H as raceAgainstAbort, Hr as require_supports_color, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchCommunityFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as custom, Kn as PageIpfsSchema, Kr as array, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as FailedToFetchGenericIpfsFromGatewaysError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as e$4, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as require_retry$2, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as n$8, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommentIpfsFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as object, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as FailedToFetchPageIpfsFromGatewaysError, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as t$13, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$11, Un as CreateCommentOptionsWithRefinementSchema, Ur as require_ms$1, Ut as NameResolveCacheOptionsSchema, Vr as logger_default, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as looseObject, Yr as literal, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as number, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, _r as normalizeEthAliasDomain, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersByIndexSchema, at as throwIfAbortSignalAborted, bn as PageSortFileSchema, br as n$10, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as record, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as isStringDomain, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isEthAliasDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, jn as CommentIpfsSchema, jr as t$9, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as r$7, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, ni as union, nr as AuthorCommentIpfsReservedFields, nt as shortifyCid, on as ChallengeFileFactorySchema, or as CidPathSchema, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, q as removeNullUndefinedEmptyObjectsValuesRecursively, qn as isReservedObjectKey, qr as boolean, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, rt as sleepUntilTimeoutOrAbort, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, ti as string, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyAddress, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$9, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as e$5, wt as untrackStartedCommunity, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as linkAbortSignals, zn as CommentUpdateSchema, zr as PKCError } from "./util-BZuCmqxu.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
- import { s as validatePageSortFile } from "./page-sort-scoring-VN_GGInQ.js";
4
+ import { s as validatePageSortFile } from "./page-sort-scoring-I02fuGkI.js";
5
5
  import { createHash, randomUUID } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import path from "node:path";
@@ -123780,6 +123780,9 @@ const verifyBufferEd25519 = async (bufferToSign, bufferSignature, publicKeyBase6
123780
123780
  if (!publicKeyBase64 || typeof publicKeyBase64 !== "string") throw Error(`verifyBufferEd25519 publicKeyBase64 '${publicKeyBase64}' not a string`);
123781
123781
  const publicKeyBuffer = fromString(publicKeyBase64, "base64");
123782
123782
  if (publicKeyBuffer.length !== 32) throw Error(`verifyBufferEd25519 publicKeyBase64 '${publicKeyBase64}' ed25519 public key length not 32 bytes (${publicKeyBuffer.length} bytes)`);
123783
+ try {
123784
+ if (ed25519.Point.fromBytes(publicKeyBuffer, true).isSmallOrder()) return false;
123785
+ } catch {}
123783
123786
  if (await _isWebCryptoEd25519Supported()) try {
123784
123787
  const cryptoKey = await globalThis.crypto.subtle.importKey("raw", publicKeyBuffer, { name: "Ed25519" }, false, ["verify"]);
123785
123788
  if (await globalThis.crypto.subtle.verify("Ed25519", cryptoKey, bufferSignature, bufferToSign)) return true;
@@ -146987,6 +146990,39 @@ const createSigner = async (createSignerOptions) => {
146987
146990
  });
146988
146991
  };
146989
146992
  //#endregion
146993
+ //#region dist/node/detached-guard.js
146994
+ function guardDetached({ entryPoint, handler, onFailure }) {
146995
+ const handleFailure = (error) => {
146996
+ logger_default("pkc-js:detached-guard").error(`Detached entry point (${entryPoint}) failed`, describeFailure(error));
146997
+ return onFailure(error);
146998
+ };
146999
+ return ((...args) => {
147000
+ let result;
147001
+ try {
147002
+ result = handler(...args);
147003
+ } catch (error) {
147004
+ const failureResult = handleFailure(error);
147005
+ return isThenable(failureResult) ? Promise.resolve(failureResult).then(() => void 0) : void 0;
147006
+ }
147007
+ if (!isThenable(result)) return void 0;
147008
+ return Promise.resolve(result).then(() => void 0, async (error) => {
147009
+ await handleFailure(error);
147010
+ });
147011
+ });
147012
+ }
147013
+ function isThenable(value) {
147014
+ return typeof value === "object" && value !== null && typeof value.then === "function";
147015
+ }
147016
+ function describeFailure(error) {
147017
+ const chain = [];
147018
+ let current = error;
147019
+ for (let depth = 0; depth < 5 && current !== void 0; depth++) {
147020
+ chain.push(current);
147021
+ current = typeof current === "object" && current !== null ? current.cause : void 0;
147022
+ }
147023
+ return chain;
147024
+ }
147025
+ //#endregion
146990
147026
  //#region node_modules/tiny-typed-emitter/lib/index.js
146991
147027
  var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
146992
147028
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -149862,17 +149898,25 @@ var BaseClientsManager = class BaseClientsManager {
149862
149898
  const pubsubClient = this._pkc.clients.libp2pJsClients[kuboPubsubRpcUrlOrLibp2pJsKey]?.heliaWithKuboRpcClientFunctions || this._pkc.clients.pubsubKuboRpcClients[kuboPubsubRpcUrlOrLibp2pJsKey]._client;
149863
149899
  if (!pubsubClient) throw new PKCError("ERR_INVALID_PUBSUB_PROVIDER", { pubsubProviderUrl: kuboPubsubRpcUrlOrLibp2pJsKey });
149864
149900
  const timeBefore = Date.now();
149865
- const handlePubsubError = async (err) => {
149866
- error = err;
149867
- log.error("pubsub callback error, topic", pubsubTopic, "provider url", kuboPubsubRpcUrlOrLibp2pJsKey, "error", err, "Will unsubscribe and re-attempt to subscribe");
149868
- await this._pkc._stats.recordGatewayFailure(kuboPubsubRpcUrlOrLibp2pJsKey, "pubsub-subscribe");
149869
- try {
149870
- await this.pubsubUnsubscribeOnProvider(pubsubTopic, kuboPubsubRpcUrlOrLibp2pJsKey, handler);
149871
- } catch (e) {
149872
- log.error("Failed to unsubscribe after onError, topic", pubsubTopic, "provider url", kuboPubsubRpcUrlOrLibp2pJsKey, e);
149901
+ const handlePubsubError = guardDetached({
149902
+ entryPoint: `pubsub onError (${kuboPubsubRpcUrlOrLibp2pJsKey})`,
149903
+ onFailure: (cause) => this._pkc.emit("error", new PKCError("ERR_FAILED_TO_RESUBSCRIBE_TO_PUBSUB_TOPIC_AFTER_ERROR", {
149904
+ pubsubTopic,
149905
+ pubsubProviderUrl: kuboPubsubRpcUrlOrLibp2pJsKey,
149906
+ cause
149907
+ })),
149908
+ handler: async (err) => {
149909
+ error = err;
149910
+ log.error("pubsub callback error, topic", pubsubTopic, "provider url", kuboPubsubRpcUrlOrLibp2pJsKey, "error", err, "Will unsubscribe and re-attempt to subscribe");
149911
+ await this._pkc._stats.recordGatewayFailure(kuboPubsubRpcUrlOrLibp2pJsKey, "pubsub-subscribe");
149912
+ try {
149913
+ await this.pubsubUnsubscribeOnProvider(pubsubTopic, kuboPubsubRpcUrlOrLibp2pJsKey, handler);
149914
+ } catch (e) {
149915
+ log.error("Failed to unsubscribe after onError, topic", pubsubTopic, "provider url", kuboPubsubRpcUrlOrLibp2pJsKey, e);
149916
+ }
149917
+ await this.pubsubSubscribeOnProvider(pubsubTopic, handler, kuboPubsubRpcUrlOrLibp2pJsKey);
149873
149918
  }
149874
- await this.pubsubSubscribeOnProvider(pubsubTopic, handler, kuboPubsubRpcUrlOrLibp2pJsKey);
149875
- };
149919
+ });
149876
149920
  let error;
149877
149921
  try {
149878
149922
  await pRetry(async () => {
@@ -158169,4 +158213,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
158169
158213
  }
158170
158214
  };
158171
158215
  //#endregion
158172
- export { coerceSchemaRowJson as $, getAuthorNameFromWire as $n, n$5 as $r, RpcPublishAnchorRecordParamSchema as $t, findCommentInParsedPages as A, signCommunityEdit as An, getDefaultCommunityDbConfig as Ar, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as At, GenericStateClient as B, verifyCommentPubsubMessage as Bn, resolveDbPostsCidRefs as Br, RpcCommentRepliesPageParamSchema as Bt, RepliesPages as C, signChallengeVerification as Cn, createKuboRpcClient as Cr, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, signCommentUpdate as Dn, deriveDbReplies as Dr, parseDecryptedChallengeVerification as Dt, buildPagesRuntimeFields as E, signCommentModeration as En, deriveDbPosts as Er, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Et, cloneCrosspostForRuntime as F, verifyChallengeRequest as Fn, markLocalCommunityDbAsBeingWritten as Fr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Ft, pRetry as G, verifyVote as Gn, markCommunityDbAsBeingWritten as Gr, RpcExportCommunityModLogsParamSchema as Gt, listSubscribedPubsubTopicsShared as H, verifyCommunity as Hn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as Hr, RpcCommunityIdentifierParamSchema as Ht, collectCrosspostAuthorsToResolve as I, verifyChallengeVerification as In, monitorCommunitiesDirectory as Ir, RpcAnchorPublishPreparationResultSchema as It, decodeRpcChallengeAnswerPubsubMsg as J, mergeAuthorProps as Jn, toCommunitiesWireEntry as Jr, RpcExportCommunityResultSchema as Jt, pLimit as K, assignUnknownProps as Kn, findCommunitiesEntry as Kr, RpcExportCommunityModLogsResultSchema as Kt, extractCrosspostRuntimeFields as L, verifyCommentEdit as Ln, moveCommunityDbToDeletedDirectory as Lr, RpcAuthorNameParamSchema as Lt, parseRawPages as M, signVote as Mn, getThumbnailPropsOfLink as Mr, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Mt, MAX_PAGE_SIZE_BYTES as N, verifyChallengeAnswer as Nn, importSignerIntoKuboNode as Nr, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as Nt, findCommentInPageInstance as O, signCommentUpdateForChallengeVerification as On, findLocalCommunityAddress as Or, parseDecryptedChallengeWithPKCErrorIfItFails as Ot, applyNameResolvedCacheToCrosspost as P, verifyChallengeMessage as Pn, isLocalCommunityAddress as Pr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Pt, coerceSchemaRowBoolean as Q, getAuthorNameFromRuntime as Qn, t$5 as Qr, RpcFetchCommunityListResultSchema as Qt, stripNameResolvedFromCrosspost as R, verifyCommentIpfs as Rn, registerLocalCommunity as Rr, RpcCancelExportParamSchema as Rt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as S, signChallengeRequest as Sn, calculateInlineRepliesBudget as Sr, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, signCommentEdit as Tn, deriveCommentIpfsFromCommentTableRow as Tr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Tt, InflightFetchManager as U, verifyCommunityEdit as Un, unregisterLocalCommunity as Ur, RpcCommunityPageParamSchema as Ut, SHARED_KUBO_READ_TIMEOUT_MS as V, verifyCommentUpdate as Vn, setNativeFunctions as Vr, RpcCommunitiesChangeEventResultSchema as Vt, InflightResourceTypes as W, verifyCommunityList as Wn, getCommunitiesRegistry as Wr, RpcEditCommunityParamSchema as Wt, decodeRpcChallengeRequestPubsubMsg as X, buildRuntimeAuthor as Xn, t$4 as Xr, RpcFetchCidResultSchema as Xt, decodeRpcChallengePubsubMsg as Y, withoutForbiddenKeys as Yn, t$2 as Yr, RpcFetchCidParamSchema as Yt, decodeRpcChallengeVerificationPubsubMsg as Z, cleanWireAuthor as Zn, r as Zr, RpcFetchCommunityListParamSchema as Zt, createAuthorIdentityMatcher as _, encryptEd25519AesGcmPublicKeyBuffer as _n, getPKCAddressFromPublicKeySync as _r, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, NAME_RESOLVED_TRUE_TTL_MS as ai, RpcSubscriptionIdResultSchema as an, crosspostChainDepthUpTo as ar, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as at, KeyvBetterSqlite3 as b, signChallengeAnswer as bn, backupCommunityDb as br, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, require_lodash_merge as ci, findCommunityRecordNameMismatch as cn, getCommunityAddressFromRecord as cr, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ct, getChallengeVerification as d, SignerWithPublicKeyAddress as dn, normalizeCommunityInputFromCommunity as dr, parseCommunityAddressWithPKCErrorIfItFails as dt, n$6 as ei, RpcPublishChallengeAnswersParamSchema as en, normalizeCreatePublicationAuthor as er, collectSchemaRowCoercions as et, getCommunityChallengeFromCommunityChallengeSettings as f, createSigner as fn, decode as fr, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, encryptEd25519AesGcm as gn, getPKCAddressFromPublicKey as gr, parseCommunityListSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, decryptEd25519AesGcmPublicKeyBuffer as hn, getIpfsKeyFromPrivateKey as hr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, NAME_RESOLVED_FALSE_TTL_MS as ii, RpcResolveAuthorNameResultSchema as in, MAX_COMMUNITY_LIST_SIZE_BYTES as ir, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, signCommunityList as jn, getDefaultDataPath as jr, parseRpcCommentEventWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, signCommunity as kn, forgetCommunityThatFailedToBeDeleted as kr, parseJsonWithPKCErrorIfFails as kt, pkcJsPageSorts as l, nativeFunctions$1 as li, verifyAuthorWalletEntry as ln, getCommunityNameFromWire$1 as lr, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as lt, pkcJsChallenges as m, decryptEd25519AesGcm as mn, getBufferedPKCAddressFromPublicKey as mr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, t$8 as ni, RpcPublishCommunityListResultSchema as nn, CreateCommunityListWithCidOptionsSchema as nr, parseCidStringSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as oi, RpcSuccessResultSchema as on, effectiveMaxCrosspostDepth as or, parseCommentIpfsSchemaWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, createAnchorIpnsRecord as pn, encode as pr, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as pt, PKCTypedEmitter as q, forbiddenKeysOf as qn, toCommunitiesEntry as qr, RpcExportCommunityParamSchema as qt, computePageSortsFingerprint as r, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as ri, RpcPublishedAnchorRecordResultSchema as rn, CreateNewCommunityListOptionsSchema as rr, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, STORAGE_KEYS as si, RpcUnsubscribeParamSchema as sn, buildRuntimeCommunityFields as sr, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as st, RpcLocalCommunity as t, t$7 as ti, RpcPublishCommunityListParamSchema as tn, stringify as tr, createSchemaRowParser as tt, deriveCommunityChallengesOrThrow as u, require_lib as un, getCommunityPublicKeyFromWire as ur, parseCommentUpdateSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, _validateSignatureOfPKCRecord as vn, getPublicKeyFromPrivateKey as vr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, signComment as wn, deleteOldCommunityInWindows as wr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as wt, RemoteCommunity as x, signChallengeMessage as xn, calculateExpectedSignatureSize as xr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as xt, LRUCache as y, cleanUpBeforePublishing as yn, BackupAbortError as yr, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as yt, PKCClientsManager as z, verifyCommentModeration as zn, removeFileRetryingWhileBusy as zr, RpcCidParamSchema as zt };
158216
+ export { coerceSchemaRowJson as $, cleanWireAuthor as $n, getCommunitiesRegistry as $r, RpcPublishAnchorRecordParamSchema as $t, findCommentInParsedPages as A, signCommentUpdateForChallengeVerification as An, calculateExpectedSignatureSize as Ar, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as At, GenericStateClient as B, verifyCommentIpfs as Bn, getDefaultDataPath as Br, RpcCommentRepliesPageParamSchema as Bt, RepliesPages as C, signChallengeMessage as Cn, sha256$8 as Cr, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, signCommentEdit as Dn, clean as Dr, parseDecryptedChallengeVerification as Dt, buildPagesRuntimeFields as E, signComment as En, anumber$1 as Er, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Et, cloneCrosspostForRuntime as F, verifyChallengeAnswer as Fn, deriveDbPosts as Fr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Ft, pRetry as G, verifyCommunityEdit as Gn, monitorCommunitiesDirectory as Gr, RpcExportCommunityModLogsParamSchema as Gt, listSubscribedPubsubTopicsShared as H, verifyCommentPubsubMessage as Hn, importSignerIntoKuboNode as Hr, RpcCommunityIdentifierParamSchema as Ht, collectCrosspostAuthorsToResolve as I, verifyChallengeMessage as In, deriveDbReplies as Ir, RpcAnchorPublishPreparationResultSchema as It, decodeRpcChallengeAnswerPubsubMsg as J, assignUnknownProps as Jn, removeFileRetryingWhileBusy as Jr, RpcExportCommunityResultSchema as Jt, pLimit as K, verifyCommunityList as Kn, moveCommunityDbToDeletedDirectory as Kr, RpcExportCommunityModLogsResultSchema as Kt, extractCrosspostRuntimeFields as L, verifyChallengeRequest as Ln, findLocalCommunityAddress as Lr, RpcAuthorNameParamSchema as Lt, parseRawPages as M, signCommunityEdit as Mn, createKuboRpcClient as Mr, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Mt, MAX_PAGE_SIZE_BYTES as N, signCommunityList as Nn, deleteOldCommunityInWindows as Nr, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as Nt, findCommentInPageInstance as O, signCommentModeration as On, BackupAbortError as Or, parseDecryptedChallengeWithPKCErrorIfItFails as Ot, applyNameResolvedCacheToCrosspost as P, signVote as Pn, deriveCommentIpfsFromCommentTableRow as Pr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Pt, coerceSchemaRowBoolean as Q, buildRuntimeAuthor as Qn, unregisterLocalCommunity as Qr, RpcFetchCommunityListResultSchema as Qt, stripNameResolvedFromCrosspost as R, verifyChallengeVerification as Rn, forgetCommunityThatFailedToBeDeleted as Rr, RpcCancelExportParamSchema as Rt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as S, signChallengeAnswer as Sn, x25519 as Sr, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, signChallengeVerification as Tn, ahash as Tr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Tt, InflightFetchManager as U, verifyCommentUpdate as Un, isLocalCommunityAddress as Ur, RpcCommunityPageParamSchema as Ut, SHARED_KUBO_READ_TIMEOUT_MS as V, verifyCommentModeration as Vn, getThumbnailPropsOfLink as Vr, RpcCommunitiesChangeEventResultSchema as Vt, InflightResourceTypes as W, verifyCommunity as Wn, markLocalCommunityDbAsBeingWritten as Wr, RpcEditCommunityParamSchema as Wt, decodeRpcChallengeRequestPubsubMsg as X, mergeAuthorProps as Xn, setNativeFunctions as Xr, RpcFetchCidResultSchema as Xt, decodeRpcChallengePubsubMsg as Y, forbiddenKeysOf as Yn, resolveDbPostsCidRefs as Yr, RpcFetchCidParamSchema as Yt, decodeRpcChallengeVerificationPubsubMsg as Z, withoutForbiddenKeys as Zn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as Zr, RpcFetchCommunityListParamSchema as Zt, createAuthorIdentityMatcher as _, require_lodash_merge as _i, decryptEd25519AesGcmPublicKeyBuffer as _n, getIpfsKeyFromPrivateKey as _r, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, t$4 as ai, RpcSubscriptionIdResultSchema as an, CreateNewCommunityListOptionsSchema as ar, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as at, KeyvBetterSqlite3 as b, _validateSignatureOfPKCRecord as bn, getPublicKeyFromPrivateKey as br, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, n$5 as ci, findCommunityRecordNameMismatch as cn, effectiveMaxCrosspostDepth as cr, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ct, getChallengeVerification as d, t$8 as di, require_lib as dn, getCommunityNameFromWire$1 as dr, parseCommunityAddressWithPKCErrorIfItFails as dt, markCommunityDbAsBeingWritten as ei, RpcPublishChallengeAnswersParamSchema as en, getAuthorNameFromRuntime as er, collectSchemaRowCoercions as et, getCommunityChallengeFromCommunityChallengeSettings as f, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as fi, guardDetached as fn, getCommunityPublicKeyFromWire as fr, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, STORAGE_KEYS as gi, decryptEd25519AesGcm as gn, getBufferedPKCAddressFromPublicKey as gr, parseCommunityListSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as hi, createAnchorIpnsRecord as hn, encode as hr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, t$2 as ii, RpcResolveAuthorNameResultSchema as in, CreateCommunityListWithCidOptionsSchema as ir, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, signCommunity as jn, calculateInlineRepliesBudget as jr, parseRpcCommentEventWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, signCommentUpdate as kn, backupCommunityDb as kr, parseJsonWithPKCErrorIfFails as kt, pkcJsPageSorts as l, n$6 as li, verifyAuthorWalletEntry as ln, buildRuntimeCommunityFields as lr, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as lt, pkcJsChallenges as m, NAME_RESOLVED_TRUE_TTL_MS as mi, createSigner as mn, decode as mr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, toCommunitiesEntry as ni, RpcPublishCommunityListResultSchema as nn, normalizeCreatePublicationAuthor as nr, parseCidStringSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, r as oi, RpcSuccessResultSchema as on, MAX_COMMUNITY_LIST_SIZE_BYTES as or, parseCommentIpfsSchemaWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, NAME_RESOLVED_FALSE_TTL_MS as pi, SignerWithPublicKeyAddress as pn, normalizeCommunityInputFromCommunity as pr, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as pt, PKCTypedEmitter as q, verifyVote as qn, registerLocalCommunity as qr, RpcExportCommunityParamSchema as qt, computePageSortsFingerprint as r, toCommunitiesWireEntry as ri, RpcPublishedAnchorRecordResultSchema as rn, stringify as rr, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, t$5 as si, RpcUnsubscribeParamSchema as sn, crosspostChainDepthUpTo as sr, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as st, RpcLocalCommunity as t, findCommunitiesEntry as ti, RpcPublishCommunityListParamSchema as tn, getAuthorNameFromWire as tr, createSchemaRowParser as tt, deriveCommunityChallengesOrThrow as u, t$7 as ui, hmac as un, getCommunityAddressFromRecord as ur, parseCommentUpdateSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, nativeFunctions$1 as vi, encryptEd25519AesGcm as vn, getPKCAddressFromPublicKey as vr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, signChallengeRequest as wn, abytes$1 as wr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as wt, RemoteCommunity as x, cleanUpBeforePublishing as xn, ed25519 as xr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as xt, LRUCache as y, encryptEd25519AesGcmPublicKeyBuffer as yn, getPKCAddressFromPublicKeySync as yr, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as yt, PKCClientsManager as z, verifyCommentEdit as zn, getDefaultCommunityDbConfig as zr, RpcCidParamSchema as zt };
@@ -6891,6 +6891,7 @@ var messages;
6891
6891
  messages["ERR_GET_COMMUNITY_ABORTED"] = "Aborted while waiting for the community record to load";
6892
6892
  messages["ERR_COMMUNITY_STOPPED_WHILE_LOADING"] = "The community instance was stopped while its record was being loaded";
6893
6893
  messages["ERR_GET_COMMENT_ABORTED"] = "Aborted while waiting for the comment record to load";
6894
+ messages["ERR_FAILED_TO_RESUBSCRIBE_TO_PUBSUB_TOPIC_AFTER_ERROR"] = "The pubsub provider reported an error on a subscription, and subscribing to the topic again failed";
6894
6895
  messages["ERR_TIMEOUT_WAITING_FOR_PUBSUB_TOPIC_PEERS"] = "Timeout waiting for propagation of pubsub topic peers";
6895
6896
  messages["ERR_PUBSUB_TOPIC_PEER_WAIT_ABORTED"] = "Aborted while waiting for a peer to subscribe to a pubsub topic";
6896
6897
  messages["ERR_IPNS_DIRECT_FETCH_ABORTED"] = "Aborted while fetching an IPNS record directly from subscribers/providers";
@@ -7281,6 +7282,7 @@ var messages;
7281
7282
  messages["ERR_FAILED_TO_OPEN_CONNECTION_TO_RPC"] = "Failed to open connection to RPC";
7282
7283
  messages["ERR_FAILED_TO_CREATE_WS_RPC_SERVER"] = "Failed to create WebSocket RPC server";
7283
7284
  messages["ERR_RPC_CLIENT_ATTEMPTING_TO_START_A_REMOTE_COMMUNITY"] = "Attempting to start a community that is not local";
7285
+ messages["ERR_RPC_CLIENT_FAILED_TO_HANDLE_SERVER_MESSAGE"] = "The RPC server sent a message the RPC client could not handle (not valid JSON, or a notification its handler rejected). The message was dropped";
7284
7286
  messages["ERR_RPC_COMMUNITY_NOT_RUNNING"] = "The community is not running on the PKC RPC server and was stopped on purpose, so the RPC client did not start it again after reconnecting";
7285
7287
  messages["ERR_RPC_CLIENT_TRYING_TO_STOP_COMMUNITY_THAT_IS_NOT_RUNNING"] = "RPC client is attempting to stop a local community that is not running";
7286
7288
  messages["ERR_RPC_CLIENT_TRYING_TO_STOP_REMOTE_COMMUNITY"] = "RPC client is attempting to stop a remote community";
@@ -8052,10 +8054,10 @@ const CommunityAuthorChallengeReservedFieldNames = [
8052
8054
  "firstCommentTimestamp",
8053
8055
  "lastCommentCid"
8054
8056
  ];
8055
- CommunityAuthorSchema.pick({
8057
+ const CommentModerationAuthorSchema = CommunityAuthorSchema.pick({
8056
8058
  banExpiresAt: true,
8057
8059
  flairs: true
8058
- });
8060
+ }).extend({ banExpiresAt: number().nonnegative().int().optional() });
8059
8061
  const AuthorReservedFields = r$2([
8060
8062
  ...t$3(AuthorPubsubSchema.extend({ community: CommunityAuthorSchema.optional() }).shape),
8061
8063
  "address",
@@ -8240,11 +8242,13 @@ const CommentUpdateSchema = object({
8240
8242
  archived: boolean().optional(),
8241
8243
  removed: boolean().optional(),
8242
8244
  reason: string().optional(),
8245
+ authorBanExpiresAt: PKCTimestampSchema.optional(),
8243
8246
  approved: boolean().optional(),
8244
8247
  updatedAt: PKCTimestampSchema,
8245
8248
  author: AuthorWithCommentUpdateSchema.pick({ community: true }).optional(),
8246
8249
  lastChildCid: CidStringSchema.optional(),
8247
8250
  lastReplyTimestamp: PKCTimestampSchema.optional(),
8251
+ pseudonymityAuthorTag: string().regex(/^[A-Za-z0-9+/]{22}$/, "pseudonymityAuthorTag must be 22 base64 characters (16 bytes)").optional(),
8248
8252
  signature: JsonSignatureSchema,
8249
8253
  protocolVersion: ProtocolVersionSchema,
8250
8254
  get replies() {
@@ -8264,9 +8268,11 @@ const CommentUpdateChallengeReservedFieldNames = [
8264
8268
  "updatedAt",
8265
8269
  "lastChildCid",
8266
8270
  "lastReplyTimestamp",
8271
+ "authorBanExpiresAt",
8267
8272
  "replies",
8268
8273
  "edit",
8269
- "protocolVersion"
8274
+ "protocolVersion",
8275
+ "pseudonymityAuthorTag"
8270
8276
  ];
8271
8277
  const CommentUpdateForDisapprovedPendingCommentSignedPropertyNames = t$3(n$3(CommentUpdateSchema.pick({
8272
8278
  author: true,
@@ -16538,10 +16544,7 @@ const ModeratorOptionsSchema = object({
16538
16544
  removed: boolean().optional(),
16539
16545
  purged: boolean().optional(),
16540
16546
  reason: string().optional(),
16541
- author: CommunityAuthorSchema.pick({
16542
- banExpiresAt: true,
16543
- flairs: true
16544
- }).loose().optional()
16547
+ author: CommentModerationAuthorSchema.loose().optional()
16545
16548
  }).strict();
16546
16549
  const CreateCommentModerationOptionsSchema = CreatePublicationUserOptionsSchema.extend({
16547
16550
  commentModeration: ModeratorOptionsSchema.loose(),
@@ -16603,14 +16606,14 @@ const CommunityEditPublicationPubsubReservedFields = r$2([
16603
16606
  ], t$3(CommunityEditPubsubMessagePublicationSchema.shape));
16604
16607
  //#endregion
16605
16608
  //#region dist/node/generated-version.js
16606
- const version = "0.0.157";
16609
+ const version = "0.0.159";
16607
16610
  //#endregion
16608
16611
  //#region dist/node/version.js
16609
16612
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
16610
16613
  const pkcJsVersion = version;
16611
16614
  var version_default = {
16612
16615
  PKC_JS_VERSION: pkcJsVersion,
16613
- DB_VERSION: 47,
16616
+ DB_VERSION: 49,
16614
16617
  PROTOCOL_VERSION: protocolVersion,
16615
16618
  USER_AGENT: UserAgentSchema.parse(`/pkc-js:${pkcJsVersion}/`)
16616
16619
  };
@@ -1,4 +1,4 @@
1
- import { V as pubsubTopicToDhtKeyCid, z as linkAbortSignals, zr as PKCError } from "./util-DDsWXOtP.js";
1
+ import { V as pubsubTopicToDhtKeyCid, z as linkAbortSignals, zr as PKCError } from "./util-BZuCmqxu.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { ipnsValidator } from "ipns/validator";
4
4
  import { unmarshalIPNSRecord } from "ipns";
@@ -1,5 +1,5 @@
1
- import { on as ChallengeFileFactorySchema, sn as ChallengeFileSchema, yn as PageSortFileFactorySchema, zr as PKCError } from "./util-DDsWXOtP.js";
2
- import { s as validatePageSortFile } from "./page-sort-scoring-VN_GGInQ.js";
1
+ import { on as ChallengeFileFactorySchema, sn as ChallengeFileSchema, yn as PageSortFileFactorySchema, zr as PKCError } from "./util-BZuCmqxu.js";
2
+ import { s as validatePageSortFile } from "./page-sort-scoring-I02fuGkI.js";
3
3
  //#region dist/node/validate-package-factories.js
4
4
  function validateChallengeFileFactory(factory, { name }) {
5
5
  try {
@@ -1,2 +1,2 @@
1
- import { a as getShortCid, c as setNativeFunctions, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as pageSorts, t as PKC } from "./chunks/node-CvXtQ-4A.js";
1
+ import { a as getShortCid, c as setNativeFunctions, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as pageSorts, t as PKC } from "./chunks/node-Bv7hIiW_.js";
2
2
  export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, pageSorts, setNativeFunctions };
@@ -1,2 +1,2 @@
1
- import { n as validatePageSortFileFactory } from "./chunks/validate-package-factories-CmJt781W.js";
1
+ import { n as validatePageSortFileFactory } from "./chunks/validate-package-factories-BsSEIr__.js";
2
2
  export { validatePageSortFileFactory };
@@ -1,7 +1,7 @@
1
- import { C as hideClassPrivateProps, Sr as t, Vr as logger_default, X as replaceXWithY, br as n, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, i as calculateStringSizeSameAsIpfsAddCidV0, kt as pTimeout, zr as PKCError } from "../../chunks/util-DDsWXOtP.js";
2
- import { S as parseRpcUnsubscribeParam, _ as parseRpcExportCommunityParam, b as parseRpcPublishChallengeAnswersParam, d as parseRpcCidParam, f as parseRpcCommentRepliesPageParam, g as parseRpcExportCommunityModLogsParam, h as parseRpcEditCommunityParam, l as parseRpcAuthorNameParam, m as parseRpcCommunityPageParam, p as parseRpcCommunityIdentifierParam, t as PKC, u as parseRpcCancelExportParam, v as parseRpcFetchCommunityListParam, x as parseRpcPublishCommunityListParam, y as parseRpcPublishAnchorRecordParam } from "../../chunks/node-CvXtQ-4A.js";
3
- import { E as buildPagesRuntimeFields, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, G as pRetry, Jr as toCommunitiesWireEntry, K as pLimit, L as extractCrosspostRuntimeFields, Nt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Or as findLocalCommunityAddress, Pr as isLocalCommunityAddress, Pt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, St as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, T as buildPageRuntimeFields, Wn as verifyCommunityList, Xr as t$1, ft as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, gt as parseCommunityListSchemaWithPKCErrorIfItFails, ir as MAX_COMMUNITY_LIST_SIZE_BYTES, it as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, kt as parseJsonWithPKCErrorIfFails, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, rt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, st as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, tr as stringify, un as require_lib, xt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-BjIHRbYy.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-oqjqTa9T.js";
1
+ import { C as hideClassPrivateProps, Sr as t, Vr as logger_default, X as replaceXWithY, br as n, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, i as calculateStringSizeSameAsIpfsAddCidV0, kt as pTimeout, zr as PKCError } from "../../chunks/util-BZuCmqxu.js";
2
+ import { S as parseRpcUnsubscribeParam, _ as parseRpcExportCommunityParam, b as parseRpcPublishChallengeAnswersParam, d as parseRpcCidParam, f as parseRpcCommentRepliesPageParam, g as parseRpcExportCommunityModLogsParam, h as parseRpcEditCommunityParam, l as parseRpcAuthorNameParam, m as parseRpcCommunityPageParam, p as parseRpcCommunityIdentifierParam, t as PKC, u as parseRpcCancelExportParam, v as parseRpcFetchCommunityListParam, x as parseRpcPublishCommunityListParam, y as parseRpcPublishAnchorRecordParam } from "../../chunks/node-Bv7hIiW_.js";
3
+ import { E as buildPagesRuntimeFields, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, G as pRetry, K as pLimit, Kn as verifyCommunityList, L as extractCrosspostRuntimeFields, Lr as findLocalCommunityAddress, Nt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Pt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, St as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, T as buildPageRuntimeFields, Ur as isLocalCommunityAddress, ai as t$1, dn as require_lib, ft as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, gt as parseCommunityListSchemaWithPKCErrorIfItFails, it as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, kt as parseJsonWithPKCErrorIfFails, or as MAX_COMMUNITY_LIST_SIZE_BYTES, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ri as toCommunitiesWireEntry, rr as stringify, rt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, st as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, xt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-Bo4Z7ilA.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-0xsjgulY.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -7,6 +7,7 @@ import pLimit from "p-limit";
7
7
  import pRetry, { AbortError as PRetryAbortError } from "p-retry";
8
8
  import { FailedToFetchCommentIpfsFromGatewaysError, FailedToFetchCommentUpdateFromGatewaysError, FailedToFetchGenericIpfsFromGatewaysError, FailedToFetchPageIpfsFromGatewaysError, FailedToFetchCommunityFromGatewaysError, PKCError } from "../pkc-error.js";
9
9
  import Logger from "../logger.js";
10
+ import { guardDetached } from "../detached-guard.js";
10
11
  import * as cborg from "cborg";
11
12
  import { concat as uint8ArrayConcat } from "uint8arrays/concat";
12
13
  import { toString as uint8ArrayToString } from "uint8arrays/to-string";
@@ -162,18 +163,30 @@ export class BaseClientsManager {
162
163
  if (!pubsubClient)
163
164
  throw new PKCError("ERR_INVALID_PUBSUB_PROVIDER", { pubsubProviderUrl: kuboPubsubRpcUrlOrLibp2pJsKey });
164
165
  const timeBefore = Date.now();
165
- const handlePubsubError = async (err) => {
166
- error = err;
167
- log.error("pubsub callback error, topic", pubsubTopic, "provider url", kuboPubsubRpcUrlOrLibp2pJsKey, "error", err, "Will unsubscribe and re-attempt to subscribe");
168
- await this._pkc._stats.recordGatewayFailure(kuboPubsubRpcUrlOrLibp2pJsKey, "pubsub-subscribe");
169
- try {
170
- await this.pubsubUnsubscribeOnProvider(pubsubTopic, kuboPubsubRpcUrlOrLibp2pJsKey, handler);
171
- }
172
- catch (e) {
173
- log.error("Failed to unsubscribe after onError, topic", pubsubTopic, "provider url", kuboPubsubRpcUrlOrLibp2pJsKey, e);
166
+ // The pubsub client calls this from a stream callback and does not await or catch it, so a throw or a rejection
167
+ // here (the provider is gone, so subscribing again fails) is an unhandled rejection that ends the process. The
168
+ // guard reports it as an "error" of the pkc instead: delivered to a listener, and, as documented, thrown when
169
+ // nothing listens.
170
+ const handlePubsubError = guardDetached({
171
+ entryPoint: `pubsub onError (${kuboPubsubRpcUrlOrLibp2pJsKey})`,
172
+ onFailure: (cause) => this._pkc.emit("error", new PKCError("ERR_FAILED_TO_RESUBSCRIBE_TO_PUBSUB_TOPIC_AFTER_ERROR", {
173
+ pubsubTopic,
174
+ pubsubProviderUrl: kuboPubsubRpcUrlOrLibp2pJsKey,
175
+ cause
176
+ })),
177
+ handler: async (err) => {
178
+ error = err;
179
+ log.error("pubsub callback error, topic", pubsubTopic, "provider url", kuboPubsubRpcUrlOrLibp2pJsKey, "error", err, "Will unsubscribe and re-attempt to subscribe");
180
+ await this._pkc._stats.recordGatewayFailure(kuboPubsubRpcUrlOrLibp2pJsKey, "pubsub-subscribe");
181
+ try {
182
+ await this.pubsubUnsubscribeOnProvider(pubsubTopic, kuboPubsubRpcUrlOrLibp2pJsKey, handler);
183
+ }
184
+ catch (e) {
185
+ log.error("Failed to unsubscribe after onError, topic", pubsubTopic, "provider url", kuboPubsubRpcUrlOrLibp2pJsKey, e);
186
+ }
187
+ await this.pubsubSubscribeOnProvider(pubsubTopic, handler, kuboPubsubRpcUrlOrLibp2pJsKey);
174
188
  }
175
- await this.pubsubSubscribeOnProvider(pubsubTopic, handler, kuboPubsubRpcUrlOrLibp2pJsKey);
176
- };
189
+ });
177
190
  let error;
178
191
  try {
179
192
  await pRetry(async () => {