@pkcprotocol/pkc-js 0.0.145 → 0.0.147

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 (102) hide show
  1. package/README.md +88 -55
  2. package/dist/browser/clients/base-client-manager.js +14 -2
  3. package/dist/browser/clients/base-client-manager.js.map +1 -1
  4. package/dist/browser/errors.d.ts +3 -0
  5. package/dist/browser/errors.js +3 -0
  6. package/dist/browser/errors.js.map +1 -1
  7. package/dist/browser/generated-version.d.ts +1 -1
  8. package/dist/browser/generated-version.js +1 -1
  9. package/dist/browser/pkc-error.d.ts +1 -1
  10. package/dist/browser/publications/comment/comment-client-manager.d.ts +15 -3
  11. package/dist/browser/publications/comment/comment-client-manager.js +221 -10
  12. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  13. package/dist/browser/publications/comment/comment.js +1 -0
  14. package/dist/browser/publications/comment/comment.js.map +1 -1
  15. package/dist/browser/publications/publication.d.ts +1 -0
  16. package/dist/browser/publications/publication.js +24 -5
  17. package/dist/browser/publications/publication.js.map +1 -1
  18. package/dist/browser/runtime/node/community/challenges/index.js +14 -0
  19. package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
  20. package/dist/browser/runtime/node/community/db-handler.d.ts +5 -1
  21. package/dist/browser/runtime/node/community/db-handler.js +64 -12
  22. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  23. package/dist/browser/runtime/node/community/local-community/db-state.d.ts +3 -1
  24. package/dist/browser/runtime/node/community/local-community/db-state.js +104 -16
  25. package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
  26. package/dist/browser/runtime/node/community/local-community/defaults.d.ts +1 -0
  27. package/dist/browser/runtime/node/community/local-community/defaults.js +5 -0
  28. package/dist/browser/runtime/node/community/local-community/defaults.js.map +1 -1
  29. package/dist/browser/runtime/node/community/local-community/editing.js +121 -24
  30. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  31. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +2 -1
  32. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  33. package/dist/browser/runtime/node/community/local-community/lifecycle.d.ts +2 -0
  34. package/dist/browser/runtime/node/community/local-community/lifecycle.js +153 -30
  35. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  36. package/dist/browser/runtime/node/community/local-community.d.ts +5 -0
  37. package/dist/browser/runtime/node/community/local-community.js +10 -1
  38. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  39. package/dist/browser/runtime/node/util.d.ts +9 -0
  40. package/dist/browser/runtime/node/util.js +141 -25
  41. package/dist/browser/runtime/node/util.js.map +1 -1
  42. package/dist/browser/test/test-util.d.ts +7 -1
  43. package/dist/browser/test/test-util.js +45 -16
  44. package/dist/browser/test/test-util.js.map +1 -1
  45. package/dist/bundled/bundle-manifest.json +40 -40
  46. package/dist/bundled/challenges.js +1 -1
  47. package/dist/bundled/chunks/{helia-for-pkc-7vdzP67t.js → helia-for-pkc-jM3y3OXF.js} +2 -2
  48. package/dist/bundled/chunks/{local-community-UB_rVgR9.js → local-community-5X7bvOoN.js} +332 -70
  49. package/dist/bundled/chunks/{local-community-Bi1JGMMa.js → local-community-P9e5jksW.js} +1 -1
  50. package/dist/bundled/chunks/{node-BT3m9Nml.js → node-By3og2hw.js} +173 -17
  51. package/dist/bundled/chunks/{page-sort-scoring-Bsc4MAy1.js → page-sort-scoring-DwYGP_0d.js} +1 -1
  52. package/dist/bundled/chunks/{rpc-local-community-DVykDP0T.js → rpc-local-community-WnhiTbxm.js} +132 -29
  53. package/dist/bundled/chunks/{util-BxfB5cRB.js → util-7QtFMzpc.js} +1 -1
  54. package/dist/bundled/chunks/{util-D6z8nIoj.js → util-DMr7Hj-w.js} +4 -1
  55. package/dist/bundled/chunks/{validate-package-factories-CiY6DjnH.js → validate-package-factories-TwRblx9f.js} +2 -2
  56. package/dist/bundled/index.js +1 -1
  57. package/dist/bundled/page-sorts.js +1 -1
  58. package/dist/bundled/rpc/src/index.js +4 -4
  59. package/dist/node/clients/base-client-manager.js +14 -2
  60. package/dist/node/clients/base-client-manager.js.map +1 -1
  61. package/dist/node/errors.d.ts +3 -0
  62. package/dist/node/errors.js +3 -0
  63. package/dist/node/errors.js.map +1 -1
  64. package/dist/node/generated-version.d.ts +1 -1
  65. package/dist/node/generated-version.js +1 -1
  66. package/dist/node/pkc-error.d.ts +1 -1
  67. package/dist/node/publications/comment/comment-client-manager.d.ts +15 -3
  68. package/dist/node/publications/comment/comment-client-manager.js +221 -10
  69. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  70. package/dist/node/publications/comment/comment.js +1 -0
  71. package/dist/node/publications/comment/comment.js.map +1 -1
  72. package/dist/node/publications/publication.d.ts +1 -0
  73. package/dist/node/publications/publication.js +24 -5
  74. package/dist/node/publications/publication.js.map +1 -1
  75. package/dist/node/runtime/node/community/challenges/index.js +14 -0
  76. package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
  77. package/dist/node/runtime/node/community/db-handler.d.ts +5 -1
  78. package/dist/node/runtime/node/community/db-handler.js +64 -12
  79. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  80. package/dist/node/runtime/node/community/local-community/db-state.d.ts +3 -1
  81. package/dist/node/runtime/node/community/local-community/db-state.js +104 -16
  82. package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
  83. package/dist/node/runtime/node/community/local-community/defaults.d.ts +1 -0
  84. package/dist/node/runtime/node/community/local-community/defaults.js +5 -0
  85. package/dist/node/runtime/node/community/local-community/defaults.js.map +1 -1
  86. package/dist/node/runtime/node/community/local-community/editing.js +121 -24
  87. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  88. package/dist/node/runtime/node/community/local-community/ipns-publishing.js +2 -1
  89. package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  90. package/dist/node/runtime/node/community/local-community/lifecycle.d.ts +2 -0
  91. package/dist/node/runtime/node/community/local-community/lifecycle.js +153 -30
  92. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  93. package/dist/node/runtime/node/community/local-community.d.ts +5 -0
  94. package/dist/node/runtime/node/community/local-community.js +10 -1
  95. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  96. package/dist/node/runtime/node/util.d.ts +9 -0
  97. package/dist/node/runtime/node/util.js +141 -25
  98. package/dist/node/runtime/node/util.js.map +1 -1
  99. package/dist/node/test/test-util.d.ts +7 -1
  100. package/dist/node/test/test-util.js +45 -16
  101. package/dist/node/test/test-util.js.map +1 -1
  102. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-UB_rVgR9.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-5X7bvOoN.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -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 pTimeout, Bn as CommentUpdateSchema, Br as logger_default, C as hideClassPrivateProps, Cr as e$1, Ct as trackUpdatingComment, D as isIpfsCid, Dt as untrackUpdatingCommunity, E as isAbortError, Et as untrackUpdatingComment, Ft as ChallengeRequestMessageSchema, Ln as CommentUpdateForChallengeVerificationSchema, Lt as ChallengeVerificationMessageSchema, Mn as CommentIpfsSchema, Mr as require_retry$1, Nr as FailedToFetchCommentIpfsFromGatewaysError, Nt as ChallengeMessageSchema, Ot as require_sha256, Pr as FailedToFetchCommentUpdateFromGatewaysError, Rr as PKCError, Sn as PubsubTopicSchema, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tr as r, U as rejectWhenAbortSignalFires, Ur as setErrorMap, W as rejectWhenCommunityStopsOrAborts, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Yt as version_default, Z as resolveWhenPredicateIsTrue, _r as n$2, _t as listUpdatingComments, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, d as deepMergeRuntimeFields, et as retryKuboIpfsAddAndProvide, ft as findStartedCommunity, gr as isStringDomain, gt as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, jt as ChallengeAnswerMessageSchema, k as isIpns, kt as TimeoutError, ln as CommunityAnchorSchema, mn as CommunityIpfsSchema, mt as findUpdatingCommunity, nt as shortifyCid, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pt as findUpdatingComment, r as calculateIpfsCidV0, ri as en_default, rt as sleepUntilTimeoutOrAbort, st as waitForUpdateInCommunityInstanceWithErrorAndTimeout, tt as shortifyAddress, u as createAbortError, vt as listUpdatingCommunities, x as getPostUpdateTimestampRange, xr as t$1, yr as n$1, yt as refreshTrackedCommentAliases, z as linkAbortSignals, zr as messages } from "./util-D6z8nIoj.js";
3
- import { $n as buildRuntimeCommunityFields, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, Ar as setNativeFunctions$1, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Br as t$3, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dt as parseJsonWithPKCErrorIfFails, Er as monitorCommunitiesDirectory, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as NAME_RESOLVED_TRUE_TTL_MS, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lr as t$5, Lt as RpcCidParamSchema, M as parseRawPages, Mr as findCommunitiesEntry, Nn as verifyChallengeVerification, Nr as toCommunitiesEntry, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pt as RpcAnchorPublishPreparationResultSchema, Qr as nativeFunctions$2, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, Sr as getDefaultDataPath, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tr as listCommunitiesSync, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as t$2, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vr as n$3, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wr as t$4, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Yt as RpcFetchCommunityListParamSchema, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, en as RpcPublishCommunityListResultSchema, er as getCommunityAddressFromRecord, et as parseCidStringSchemaWithPKCErrorIfItFails, ft as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, gn as cleanUpBeforePublishing, gt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, hr as createKuboRpcClient, ht as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, in as RpcSuccessResultSchema, ir as decode, it as parseCommentIpfsSchemaWithPKCErrorIfItFails, jn as verifyChallengeMessage, jr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kn as signVote, kt as parseRpcCommentEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as createSigner, lr as getPKCAddressFromPublicKeySync, lt as parseCommunityAddressWithPKCErrorIfItFails, m as pkcJsChallenges, mt as parseCommunityListSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcResolveAuthorNameResultSchema, nr as getCommunityPublicKeyFromWire, on as findCommunityRecordNameMismatch, or as getBufferedPKCAddressFromPublicKey, ot as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, pn as encryptEd25519AesGcm, q as decodeRpcChallengePubsubMsg, qn as normalizeCreatePublicationAuthor, qr as NAME_RESOLVED_FALSE_TTL_MS, qt as RpcFetchCidParamSchema, rn as RpcSubscriptionIdResultSchema, rr as normalizeCommunityInputFromCommunity, rt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, sn as require_lib$1, st as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcPublishedAnchorRecordResultSchema, tr as getCommunityNameFromWire, un as createAnchorIpnsRecord$1, v as TrackedInstanceRegistry, vt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, x as RemoteCommunity, xn as signComment, xt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signChallengeRequest, z as PKCClientsManager, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-DVykDP0T.js";
4
- import { s as getHeliaDebugContext } from "./util-BxfB5cRB.js";
2
+ import { $ as retryKuboIpfsAdd, At as pTimeout, Bn as CommentUpdateSchema, Br as logger_default, C as hideClassPrivateProps, Cr as e$1, Ct as trackUpdatingComment, D as isIpfsCid, Dt as untrackUpdatingCommunity, E as isAbortError, Et as untrackUpdatingComment, Ft as ChallengeRequestMessageSchema, Ln as CommentUpdateForChallengeVerificationSchema, Lr as FailedToFetchPageIpfsFromGatewaysError, Lt as ChallengeVerificationMessageSchema, Mn as CommentIpfsSchema, Mr as require_retry$1, Nr as FailedToFetchCommentIpfsFromGatewaysError, Nt as ChallengeMessageSchema, Ot as require_sha256, Pr as FailedToFetchCommentUpdateFromGatewaysError, Rr as PKCError, Sn as PubsubTopicSchema, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tr as r, U as rejectWhenAbortSignalFires, Ur as setErrorMap, W as rejectWhenCommunityStopsOrAborts, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Yt as version_default, Z as resolveWhenPredicateIsTrue, _r as n$2, _t as listUpdatingComments, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, d as deepMergeRuntimeFields, et as retryKuboIpfsAddAndProvide, ft as findStartedCommunity, gr as isStringDomain, gt as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, jt as ChallengeAnswerMessageSchema, k as isIpns, kt as TimeoutError, ln as CommunityAnchorSchema, mn as CommunityIpfsSchema, mt as findUpdatingCommunity, nt as shortifyCid, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pt as findUpdatingComment, r as calculateIpfsCidV0, ri as en_default, rt as sleepUntilTimeoutOrAbort, st as waitForUpdateInCommunityInstanceWithErrorAndTimeout, tt as shortifyAddress, u as createAbortError, vt as listUpdatingCommunities, x as getPostUpdateTimestampRange, xr as t$1, yr as n$1, yt as refreshTrackedCommentAliases, z as linkAbortSignals, zr as messages } from "./util-DMr7Hj-w.js";
3
+ import { $n as buildRuntimeCommunityFields, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Cr as getDefaultDataPath, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dr as monitorCommunitiesDirectory, Dt as parseJsonWithPKCErrorIfFails, Er as listCommunitiesSync, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Fr as toCommunitiesEntry, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gr as t$2, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Hr as t$3, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as t$4, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lt as RpcCidParamSchema, M as parseRawPages, Mr as setNativeFunctions$1, Nn as verifyChallengeVerification, Nr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pr as findCommunitiesEntry, Pt as RpcAnchorPublishPreparationResultSchema, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as n$3, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xr as NAME_RESOLVED_TRUE_TTL_MS, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVED_FALSE_TTL_MS, Yt as RpcFetchCommunityListParamSchema, Zr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, ei as nativeFunctions$2, en as RpcPublishCommunityListResultSchema, er as getCommunityAddressFromRecord, et as parseCidStringSchemaWithPKCErrorIfItFails, ft as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, gn as cleanUpBeforePublishing, gt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, hr as createKuboRpcClient, ht as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, in as RpcSuccessResultSchema, ir as decode, it as parseCommentIpfsSchemaWithPKCErrorIfItFails, jn as verifyChallengeMessage, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kn as signVote, kt as parseRpcCommentEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as createSigner, lr as getPKCAddressFromPublicKeySync, lt as parseCommunityAddressWithPKCErrorIfItFails, m as pkcJsChallenges, mt as parseCommunityListSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcResolveAuthorNameResultSchema, nr as getCommunityPublicKeyFromWire, on as findCommunityRecordNameMismatch, or as getBufferedPKCAddressFromPublicKey, ot as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, pn as encryptEd25519AesGcm, q as decodeRpcChallengePubsubMsg, qn as normalizeCreatePublicationAuthor, qt as RpcFetchCidParamSchema, rn as RpcSubscriptionIdResultSchema, rr as normalizeCommunityInputFromCommunity, rt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, sn as require_lib$1, st as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcPublishedAnchorRecordResultSchema, tr as getCommunityNameFromWire, un as createAnchorIpnsRecord$1, v as TrackedInstanceRegistry, vt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, x as RemoteCommunity, xn as signComment, xt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signChallengeRequest, z as PKCClientsManager, zr as t$5, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-WnhiTbxm.js";
4
+ import { s as getHeliaDebugContext } from "./util-7QtFMzpc.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -27973,6 +27973,9 @@ var Publication = class extends import_lib.TypedEmitter {
27973
27973
  return typeof exchange.challengeRequestPublishTimestamp === "number" && exchange.challengeRequestPublishTimestamp + this._setProviderFailureThresholdSeconds <= timestamp();
27974
27974
  });
27975
27975
  }
27976
+ _wasAnyChallengeRequestPublished() {
27977
+ return Object.values(this._challengeExchanges).some((exchange) => typeof exchange.challengeRequestPublishTimestamp === "number" && !exchange.challengeRequestPublishError);
27978
+ }
27976
27979
  async _abandonProviderIfStoppedWhileSubscribing(providerUrl) {
27977
27980
  if (!this._pkc.destroyed && this.state !== "stopped") return false;
27978
27981
  const log = logger_default("pkc-js:publication:publish:_abandonProviderIfStoppedWhileSubscribing");
@@ -28254,8 +28257,15 @@ var Publication = class extends import_lib.TypedEmitter {
28254
28257
  return;
28255
28258
  }
28256
28259
  if (this._isAllAttemptsExhausted(providers.length)) {
28260
+ const aRequestWasPublished = this._wasAnyChallengeRequestPublished();
28257
28261
  await this._postSucessOrFailurePublishing();
28258
- const allAttemptsFailedError = new PKCError("ERR_ALL_PUBSUB_PROVIDERS_THROW_ERRORS", {
28262
+ const allAttemptsFailedError = aRequestWasPublished ? new PKCError("ERR_PUBSUB_DID_NOT_RECEIVE_RESPONSE_AFTER_PUBLISHING_CHALLENGE_REQUEST", {
28263
+ challengeExchanges: this._challengeExchangesFormattedForErrors(),
28264
+ pubsubTopic: this._community?.pubsubTopic,
28265
+ publishToDifferentProviderThresholdSeconds: this._publishToDifferentProviderThresholdSeconds,
28266
+ setProviderFailureThresholdSeconds: this._setProviderFailureThresholdSeconds,
28267
+ providerHeliaContexts: this._libp2pJsClientHeliaContexts()
28268
+ }) : new PKCError("ERR_ALL_PUBSUB_PROVIDERS_THROW_ERRORS", {
28259
28269
  challengeExchanges: this._challengeExchangesFormattedForErrors(),
28260
28270
  pubsubTopic: this._community?.pubsubTopic,
28261
28271
  providerHeliaContexts: this._libp2pJsClientHeliaContexts()
@@ -28589,10 +28599,34 @@ async function loadAllPagesUnderCommunityToFindComment(opts) {
28589
28599
  //#endregion
28590
28600
  //#region dist/node/publications/comment/comment-client-manager.js
28591
28601
  const fetchCommentLogger = logger_default("pkc-js:comment:client-manager:fetchAndVerifyCommentCid");
28602
+ const TRANSIENT_FETCH_RETRY_MIN_DELAY_MS = 1e3;
28603
+ const TRANSIENT_FETCH_RETRY_MAX_DELAY_MS = 3e4;
28604
+ const PARENT_PAGE_ERROR_CODES_NOT_WORTH_A_RETRY = new Set([
28605
+ "ERR_REPLIES_PAGE_IS_INVALID",
28606
+ "ERR_POSTS_PAGE_IS_INVALID",
28607
+ "ERR_PAGE_SIGNATURE_IS_INVALID",
28608
+ "ERR_PAGE_COMMENT_IS_INVALID",
28609
+ "ERR_INVALID_PAGE_IPFS_SCHEMA",
28610
+ "ERR_CALCULATED_CID_DOES_NOT_MATCH",
28611
+ "ERR_OVER_DOWNLOAD_LIMIT",
28612
+ "ERR_INVALID_JSON"
28613
+ ]);
28614
+ function isParentPageFetchErrorWorthARetry(err) {
28615
+ if (!(err instanceof PKCError)) return false;
28616
+ if (PARENT_PAGE_ERROR_CODES_NOT_WORTH_A_RETRY.has(err.code)) return false;
28617
+ if (err instanceof FailedToFetchPageIpfsFromGatewaysError) {
28618
+ for (const gatewayError of Object.values(err.details.gatewayToError)) if (isParentPageFetchErrorWorthARetry(gatewayError)) return true;
28619
+ return false;
28620
+ }
28621
+ return true;
28622
+ }
28623
+ const POST_NOT_IN_POST_UPDATES = "post-not-in-post-updates";
28592
28624
  var CommentClientsManager = class extends PublicationClientsManager {
28593
28625
  constructor(comment) {
28594
28626
  super(comment);
28595
28627
  this._postForUpdating = void 0;
28628
+ this._transientFetchRetry = { attempts: 0 };
28629
+ this._commentUpdateLookupsStarted = 0;
28596
28630
  this._comment = comment;
28597
28631
  this._fetchingUpdateForReplyUsingPageCidsPromise = void 0;
28598
28632
  this._parentFirstPageCidsAlreadyLoaded = /* @__PURE__ */ new Set();
@@ -28602,6 +28636,28 @@ var CommentClientsManager = class extends PublicationClientsManager {
28602
28636
  if (this._freshHandlerAbortController) this._freshHandlerAbortController.abort();
28603
28637
  this._freshHandlerAbortController = new AbortController();
28604
28638
  }
28639
+ _cancelTransientFetchRetry() {
28640
+ clearTimeout(this._transientFetchRetry.timer);
28641
+ this._transientFetchRetry = { attempts: 0 };
28642
+ }
28643
+ _dropPendingTransientFetchRetry() {
28644
+ clearTimeout(this._transientFetchRetry.timer);
28645
+ this._transientFetchRetry.timer = void 0;
28646
+ }
28647
+ _scheduleTransientFetchRetry(lookup, log) {
28648
+ clearTimeout(this._transientFetchRetry.timer);
28649
+ const delayMs = Math.min(TRANSIENT_FETCH_RETRY_MIN_DELAY_MS * 2 ** this._transientFetchRetry.attempts, TRANSIENT_FETCH_RETRY_MAX_DELAY_MS);
28650
+ this._transientFetchRetry.attempts++;
28651
+ log.trace("Comment", this._comment.cid, "will retry its CommentUpdate lookup in", delayMs, "ms");
28652
+ const timer = setTimeout(() => {
28653
+ if (this._transientFetchRetry.timer !== timer) return;
28654
+ this._transientFetchRetry.timer = void 0;
28655
+ if (this._comment.state !== "updating") return;
28656
+ lookup().catch((error) => log.error("Comment", this._comment.cid, "failed to retry its CommentUpdate lookup", error));
28657
+ }, delayMs);
28658
+ if (typeof timer === "object" && "unref" in timer) timer.unref();
28659
+ this._transientFetchRetry.timer = timer;
28660
+ }
28605
28661
  _combinedAbortSignalForRetry() {
28606
28662
  return linkAbortSignals([this._comment._getStopAbortSignal(), this._freshHandlerAbortController?.signal]);
28607
28663
  }
@@ -28715,6 +28771,7 @@ var CommentClientsManager = class extends PublicationClientsManager {
28715
28771
  }
28716
28772
  async _fetchPostCommentUpdateIpfsP2P(subIpns, timestampRanges, log, abortSignal) {
28717
28773
  const attemptedPathsToLoadErrors = {};
28774
+ const pathsNotInTheirFolder = [];
28718
28775
  const kuboRpcOrHelia = this.getDefaultKuboRpcClientOrHelia();
28719
28776
  for (const timestampRange of timestampRanges) {
28720
28777
  const folderCid = subIpns.postUpdates[timestampRange];
@@ -28725,6 +28782,11 @@ var CommentClientsManager = class extends PublicationClientsManager {
28725
28782
  judgedLookup = await this._isPostUpdateFileAlreadyJudged(folderCid, path, log, abortSignal);
28726
28783
  } catch (e) {
28727
28784
  throwIfAbortSignalAborted(abortSignal);
28785
+ if (e instanceof PKCError && e.code === "ERR_IPFS_PATH_NOT_IN_FOLDER") {
28786
+ log.trace("Post", this._comment.cid, "has no CommentUpdate at", path, "trying the next timestamp range");
28787
+ pathsNotInTheirFolder.push(path);
28788
+ continue;
28789
+ }
28728
28790
  log.trace(`Timed out resolving CommentUpdate path (${path}) with IPFS P2P. Trying the next timestamp range`);
28729
28791
  attemptedPathsToLoadErrors[path] = e;
28730
28792
  continue;
@@ -28752,6 +28814,15 @@ var CommentClientsManager = class extends PublicationClientsManager {
28752
28814
  });
28753
28815
  } catch (e) {
28754
28816
  throwIfAbortSignalAborted(abortSignal);
28817
+ if (e instanceof PKCError && !this._shouldWeFetchCommentUpdateFromNextTimestamp(e)) {
28818
+ this._comment._invalidCommentUpdateMfsPaths.add(path);
28819
+ e.details = {
28820
+ ...e.details,
28821
+ commentUpdatePath: path,
28822
+ postCid: this._comment.cid
28823
+ };
28824
+ throw e;
28825
+ }
28755
28826
  log.trace(`Failed to fetch CommentUpdate from path (${path}) with IPFS P2P. Trying the next timestamp range`);
28756
28827
  attemptedPathsToLoadErrors[path] = e;
28757
28828
  continue;
@@ -28787,13 +28858,23 @@ var CommentClientsManager = class extends PublicationClientsManager {
28787
28858
  throw e;
28788
28859
  }
28789
28860
  }
28861
+ if (pathsNotInTheirFolder.length === timestampRanges.length) return POST_NOT_IN_POST_UPDATES;
28790
28862
  throw new PKCError("ERR_FAILED_TO_FETCH_COMMENT_UPDATE_FROM_ALL_POST_UPDATES_RANGES", {
28791
28863
  timestampRanges,
28792
28864
  attemptedPathsToLoadErrors,
28865
+ pathsNotInTheirFolder,
28793
28866
  postCid: this._comment.cid,
28794
28867
  commentDepth: this._comment.depth
28795
28868
  });
28796
28869
  }
28870
+ _didEveryGatewayAnswerNotFound(err) {
28871
+ if (!(err instanceof FailedToFetchCommentUpdateFromGatewaysError)) return false;
28872
+ const gatewayUrls = Object.keys(this._pkc.clients.ipfsGateways);
28873
+ return gatewayUrls.length > 0 && gatewayUrls.every((gatewayUrl) => {
28874
+ const gatewayError = err.details.gatewayToError[gatewayUrl];
28875
+ return gatewayError?.code === "ERR_FAILED_TO_FETCH_IPFS_VIA_GATEWAY" && gatewayError.details?.status === 404;
28876
+ });
28877
+ }
28797
28878
  _shouldWeFetchCommentUpdateFromNextTimestamp(err) {
28798
28879
  if (!(err instanceof PKCError)) return false;
28799
28880
  if (err.code === "ERR_COMMENT_UPDATE_SIGNATURE_IS_INVALID" || err.code === "ERR_INVALID_COMMENT_UPDATE_SCHEMA" || err.code === "ERR_OVER_DOWNLOAD_LIMIT" || err.code === "ERR_INVALID_JSON") return false;
@@ -28833,6 +28914,7 @@ var CommentClientsManager = class extends PublicationClientsManager {
28833
28914
  }
28834
28915
  async _fetchPostCommentUpdateFromGateways(subIpns, timestampRanges, log, abortSignal) {
28835
28916
  const attemptedPathsToLoadErrors = {};
28917
+ const pathsNotInTheirFolder = [];
28836
28918
  let commentUpdate;
28837
28919
  const validateCommentFromGateway = async (res) => {
28838
28920
  if (typeof res.resText !== "string") throw Error("Gateway response has no body");
@@ -28876,6 +28958,11 @@ var CommentClientsManager = class extends PublicationClientsManager {
28876
28958
  return;
28877
28959
  } catch (e) {
28878
28960
  throwIfAbortSignalAborted(abortSignal);
28961
+ if (this._didEveryGatewayAnswerNotFound(e)) {
28962
+ log.trace("Post", this._comment.cid, "has no CommentUpdate at", path, "trying the next timestamp range");
28963
+ pathsNotInTheirFolder.push(path);
28964
+ continue;
28965
+ }
28879
28966
  if (this._shouldWeFetchCommentUpdateFromNextTimestamp(e)) {
28880
28967
  attemptedPathsToLoadErrors[path] = e;
28881
28968
  log.trace(`Failed to fetch CommentUpdate from path (${path}) from gateways. Trying the next timestamp range`);
@@ -28886,9 +28973,11 @@ var CommentClientsManager = class extends PublicationClientsManager {
28886
28973
  }
28887
28974
  }
28888
28975
  }
28976
+ if (pathsNotInTheirFolder.length === timestampRanges.length) return POST_NOT_IN_POST_UPDATES;
28889
28977
  throw new PKCError("ERR_FAILED_TO_FETCH_COMMENT_UPDATE_FROM_ALL_POST_UPDATES_RANGES", {
28890
28978
  timestampRanges,
28891
28979
  attemptedPathsToLoadErrors,
28980
+ pathsNotInTheirFolder,
28892
28981
  commentCid: this._comment.cid,
28893
28982
  commentDepth: this._comment.depth
28894
28983
  });
@@ -28937,6 +29026,7 @@ var CommentClientsManager = class extends PublicationClientsManager {
28937
29026
  args: [e]
28938
29027
  }
28939
29028
  });
29029
+ return "fetch-failed";
28940
29030
  } else {
28941
29031
  log.error("Received a non retriable error when attempting to load post commentUpdate. Will be emitting error", this._comment.cid, e);
28942
29032
  this._comment._changeCommentStateEmitEventEmitStateChangeEvent({
@@ -28952,7 +29042,10 @@ var CommentClientsManager = class extends PublicationClientsManager {
28952
29042
  } finally {
28953
29043
  linkedAbortSignal.dispose();
28954
29044
  }
28955
- if (newCommentUpdate) this._useLoadedCommentUpdateIfNewInfo(newCommentUpdate, subIpfs, log);
29045
+ if (newCommentUpdate === POST_NOT_IN_POST_UPDATES) {
29046
+ log("Post", this._comment.cid, "is not under the postUpdates of this community record");
29047
+ this._comment._setUpdatingStateWithEmissionIfNewState("waiting-retry");
29048
+ } else if (newCommentUpdate) this._useLoadedCommentUpdateIfNewInfo(newCommentUpdate, subIpfs, log);
28956
29049
  else if (newCommentUpdate === void 0) {
28957
29050
  log.trace(`Comment`, this._comment.cid, "has no newer CommentUpdate under postUpdates");
28958
29051
  this._comment._setUpdatingStateWithEmissionIfNewState("waiting-retry");
@@ -29144,6 +29237,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
29144
29237
  ].filter((update) => !!update).sort((a, b) => b.commentUpdate.updatedAt - a.commentUpdate.updatedAt)[0];
29145
29238
  }
29146
29239
  async handleUpdateEventFromCommunity(community) {
29240
+ this._dropPendingTransientFetchRetry();
29241
+ const lookup = ++this._commentUpdateLookupsStarted;
29242
+ const fetchFailed = await this._fetchPostCommentUpdateOnCommunityRecord(community);
29243
+ if (lookup !== this._commentUpdateLookupsStarted) return;
29244
+ if (fetchFailed) this._scheduleTransientFetchRetry(() => this.handleUpdateEventFromCommunity(community), logger_default("pkc-js:comment:update"));
29245
+ else if (this._transientFetchRetry.timer === void 0) this._transientFetchRetry.attempts = 0;
29246
+ }
29247
+ async _fetchPostCommentUpdateOnCommunityRecord(community) {
29147
29248
  const log = logger_default("pkc-js:comment:update");
29148
29249
  if (!this._comment.cid) {
29149
29250
  log("comment.cid is not defined because comment is publishing, waiting until cid is defined");
@@ -29168,9 +29269,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
29168
29269
  log.trace("Comment", this._comment.cid, "is current with the record's pages, nothing to fetch from postUpdates");
29169
29270
  this._comment._setUpdatingStateWithEmissionIfNewState("waiting-retry");
29170
29271
  } else try {
29171
- await this.useCommunityPostUpdatesToFetchCommentUpdateForPost(community.raw.communityIpfs);
29272
+ return await this.useCommunityPostUpdatesToFetchCommentUpdateForPost(community.raw.communityIpfs) === "fetch-failed";
29172
29273
  } catch (e) {
29173
29274
  if (isAbortError(e)) return;
29275
+ if (e instanceof PKCError && e.code === "ERR_COMMUNITY_HAS_NO_POST_UPDATES") {
29276
+ log("Post", this._comment.cid, "can't fetch its CommentUpdate, the community record has no postUpdates yet");
29277
+ this._comment._setUpdatingStateWithEmissionIfNewState("waiting-retry");
29278
+ return;
29279
+ }
29174
29280
  log.error("Failed to use community update to fetch new CommentUpdate", e);
29175
29281
  this._comment._changeCommentStateEmitEventEmitStateChangeEvent({
29176
29282
  newUpdatingState: "failed",
@@ -29219,8 +29325,24 @@ var CommentClientsManager = class extends PublicationClientsManager {
29219
29325
  return;
29220
29326
  }
29221
29327
  const pageSortName = this._chooseWhichPagesBasedOnParentAndReplyTimestamp(parentCommentInstance.timestamp);
29222
- let curPageCid = parentCommentInstance.replies.pageCids[pageSortName];
29223
- if (!curPageCid) throw Error("Parent comment does not have any new or old pages");
29328
+ const firstPageCid = parentCommentInstance.replies.pageCids[pageSortName];
29329
+ if (!firstPageCid) {
29330
+ this._comment._changeCommentStateEmitEventEmitStateChangeEvent({
29331
+ newUpdatingState: "waiting-retry",
29332
+ event: {
29333
+ name: "error",
29334
+ args: [new PKCError("ERR_FAILED_TO_FIND_REPLY_COMMENT_UPDATE_WITHIN_PARENT_COMMENT_PAGE_CIDS", {
29335
+ replyCid: this._comment.cid,
29336
+ parentCommentCid: parentCommentInstance.cid,
29337
+ pageSortName,
29338
+ reason: "sort-not-in-page-cids",
29339
+ parentPageCids: parentCommentInstance.replies.pageCids
29340
+ })]
29341
+ }
29342
+ });
29343
+ return;
29344
+ }
29345
+ let curPageCid = firstPageCid;
29224
29346
  if (this._parentFirstPageCidsAlreadyLoaded.has(curPageCid)) {
29225
29347
  log(`Reply`, this._comment.cid, `:SKIPPING: Page CID ${curPageCid} already loaded parent page cid`);
29226
29348
  return;
@@ -29241,7 +29363,6 @@ var CommentClientsManager = class extends PublicationClientsManager {
29241
29363
  });
29242
29364
  break;
29243
29365
  }
29244
- if (pageCidsSearchedForNewUpdate.length === 0) this._parentFirstPageCidsAlreadyLoaded.add(curPageCid);
29245
29366
  const replyWithinParentPage = findCommentInParsedPages(pageLoaded, this._comment.cid)?.raw;
29246
29367
  const replyWithinUpdatingPages = this._findCommentInPagesOfUpdatingCommentsOrCommunity({ parent: parentCommentInstance });
29247
29368
  pageCidsSearchedForNewUpdate.push({
@@ -29265,13 +29386,20 @@ var CommentClientsManager = class extends PublicationClientsManager {
29265
29386
  curPageCid = pageLoaded.nextCid;
29266
29387
  }
29267
29388
  log("Searched for new comment update of comment", this._comment.cid, "in the following pageCids of page sort", pageSortName, "of parent comment:", parentCommentInstance.cid, pageCidsSearchedForNewUpdate, "and found", newCommentUpdate ? "a new comment update" : "no new comment update");
29389
+ const pageFetchError = pageCidsSearchedForNewUpdate.find((searched) => searched.error)?.error;
29390
+ const pageFetchFailed = pageFetchError !== void 0 && isParentPageFetchErrorWorthARetry(pageFetchError);
29391
+ if (!pageFetchFailed) this._parentFirstPageCidsAlreadyLoaded.add(firstPageCid);
29268
29392
  if (newCommentUpdate) this._useLoadedCommentUpdateIfNewInfo({ commentUpdate: newCommentUpdate.commentUpdate }, communityWithSignature, log);
29269
- else if (!replyFoundWithoutNewerUpdate) throw new PKCError("ERR_FAILED_TO_FIND_REPLY_COMMENT_UPDATE_WITHIN_PARENT_COMMENT_PAGE_CIDS", {
29270
- replyCid: this._comment.cid,
29271
- parentCommentCid: parentCommentInstance.cid,
29272
- pageSortName,
29273
- pageCidsSearchedForNewUpdate
29274
- });
29393
+ else if (!replyFoundWithoutNewerUpdate || pageFetchError) {
29394
+ const reason = pageFetchFailed ? "page-fetch-failed" : pageFetchError ? "page-invalid" : "reply-not-in-pages";
29395
+ throw new PKCError("ERR_FAILED_TO_FIND_REPLY_COMMENT_UPDATE_WITHIN_PARENT_COMMENT_PAGE_CIDS", {
29396
+ replyCid: this._comment.cid,
29397
+ parentCommentCid: parentCommentInstance.cid,
29398
+ pageSortName,
29399
+ reason,
29400
+ pageCidsSearchedForNewUpdate
29401
+ });
29402
+ }
29275
29403
  }
29276
29404
  async handleErrorEventFromCommunity(error) {
29277
29405
  if (this._comment.state === "publishing") return super.handleErrorEventFromCommunity(error);
@@ -29342,6 +29470,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
29342
29470
  this.updateNameResolverState(newState, resolverKey);
29343
29471
  }
29344
29472
  async handleUpdateEventFromPostToFetchReplyCommentUpdate(postInstance) {
29473
+ this._dropPendingTransientFetchRetry();
29474
+ const lookup = ++this._commentUpdateLookupsStarted;
29475
+ const fetchFailed = await this._fetchReplyCommentUpdateOnPostUpdate(postInstance);
29476
+ if (lookup !== this._commentUpdateLookupsStarted) return;
29477
+ if (fetchFailed) this._scheduleTransientFetchRetry(() => this.handleUpdateEventFromPostToFetchReplyCommentUpdate(postInstance), logger_default("pkc-js:comment:update"));
29478
+ else if (this._transientFetchRetry.timer === void 0) this._transientFetchRetry.attempts = 0;
29479
+ }
29480
+ async _fetchReplyCommentUpdateOnPostUpdate(postInstance) {
29345
29481
  if (!this._comment.cid) throw Error("comment.cid should be defined");
29346
29482
  const log = logger_default("pkc-js:comment:update:handleUpdateEventFromPost");
29347
29483
  log("Received update event from post", postInstance.cid, "for reply", this._comment.cid, "with depth", this._comment.depth);
@@ -29373,9 +29509,27 @@ var CommentClientsManager = class extends PublicationClientsManager {
29373
29509
  return;
29374
29510
  }
29375
29511
  if (this._fetchingUpdateForReplyUsingPageCidsPromise) await this._fetchingUpdateForReplyUsingPageCidsPromise;
29512
+ let fetchFailed = false;
29376
29513
  this._fetchingUpdateForReplyUsingPageCidsPromise = this.usePageCidsOfParentToFetchCommentUpdateForReply(postInstance, repliesCommunity).catch((error) => {
29377
29514
  if (isAbortError(error)) return;
29515
+ const reason = error instanceof PKCError && error.code === "ERR_FAILED_TO_FIND_REPLY_COMMENT_UPDATE_WITHIN_PARENT_COMMENT_PAGE_CIDS" ? error.details.reason : void 0;
29516
+ if (reason === "reply-not-in-pages") {
29517
+ log("Reply", this._comment.cid, "is not in its parent's pages yet", error.details);
29518
+ this._comment._setUpdatingStateWithEmissionIfNewState("waiting-retry");
29519
+ return;
29520
+ }
29378
29521
  log.error("Failed to fetch reply commentUpdate update from parent pages", error);
29522
+ if (reason === "page-fetch-failed") {
29523
+ this._comment._changeCommentStateEmitEventEmitStateChangeEvent({
29524
+ newUpdatingState: "waiting-retry",
29525
+ event: {
29526
+ name: "error",
29527
+ args: [error]
29528
+ }
29529
+ });
29530
+ fetchFailed = true;
29531
+ return;
29532
+ }
29379
29533
  this._comment._changeCommentStateEmitEventEmitStateChangeEvent({
29380
29534
  newUpdatingState: "failed",
29381
29535
  event: {
@@ -29388,6 +29542,7 @@ var CommentClientsManager = class extends PublicationClientsManager {
29388
29542
  });
29389
29543
  await this._fetchingUpdateForReplyUsingPageCidsPromise;
29390
29544
  this._fetchingUpdateForReplyUsingPageCidsPromise = void 0;
29545
+ return fetchFailed;
29391
29546
  }
29392
29547
  async _createPostInstanceWithStateTranslation() {
29393
29548
  if (!this._comment.postCid) throw Error("comment.postCid needs to be defined to fetch comment update of reply");
@@ -30306,6 +30461,7 @@ var Comment = class extends Publication {
30306
30461
  const log = logger_default("pkc-js:comment:update:_stopUpdateLoop");
30307
30462
  if (!this.cid) return;
30308
30463
  this._commentIpfsloadingOperation?.stop();
30464
+ this._clientsManager._cancelTransientFetchRetry();
30309
30465
  if (this._updateRpcSubscriptionId) {
30310
30466
  const subscriptionId = this._updateRpcSubscriptionId;
30311
30467
  this._updateRpcSubscriptionId = void 0;
@@ -35946,7 +36102,7 @@ var PKC$1 = class extends PKCTypedEmitter {
35946
36102
  this.clients.libp2pJsClients = {};
35947
36103
  if (!this.libp2pJsClientsOptions) return;
35948
36104
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
35949
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-7vdzP67t.js");
36105
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-jM3y3OXF.js");
35950
36106
  for (const clientOptions of this.libp2pJsClientsOptions) {
35951
36107
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
35952
36108
  ...clientOptions,
@@ -36313,7 +36469,7 @@ var PKC$1 = class extends PKCTypedEmitter {
36313
36469
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
36314
36470
  log.trace("Received community options to create a local community instance:", options);
36315
36471
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
36316
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-Bi1JGMMa.js");
36472
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-P9e5jksW.js");
36317
36473
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
36318
36474
  const community = new LocalCommunity(this);
36319
36475
  if (isLocalCommunity) {
@@ -1,4 +1,4 @@
1
- import { gr as isStringDomain, v as getEquivalentCommunityAddresses, xn as PageSortFileSchema } from "./util-D6z8nIoj.js";
1
+ import { gr as isStringDomain, v as getEquivalentCommunityAddresses, xn as PageSortFileSchema } from "./util-DMr7Hj-w.js";
2
2
  //#region dist/node/pages/page-sort-scoring.js
3
3
  function validatePageSortFile(rawFile) {
4
4
  const validated = PageSortFileSchema.parse(rawFile);