@pkcprotocol/pkc-js 0.0.125 → 0.0.126

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 (99) hide show
  1. package/dist/browser/community/community-client-manager.js +30 -9
  2. package/dist/browser/community/community-client-manager.js.map +1 -1
  3. package/dist/browser/community/community-wire.d.ts +6 -0
  4. package/dist/browser/community/community-wire.js +22 -1
  5. package/dist/browser/community/community-wire.js.map +1 -1
  6. package/dist/browser/community/remote-community.d.ts +7 -1
  7. package/dist/browser/community/remote-community.js +87 -11
  8. package/dist/browser/community/remote-community.js.map +1 -1
  9. package/dist/browser/community/rpc-remote-community.d.ts +1 -0
  10. package/dist/browser/community/rpc-remote-community.js +41 -6
  11. package/dist/browser/community/rpc-remote-community.js.map +1 -1
  12. package/dist/browser/community/schema.js +7 -1
  13. package/dist/browser/community/schema.js.map +1 -1
  14. package/dist/browser/errors.d.ts +1 -0
  15. package/dist/browser/errors.js +1 -0
  16. package/dist/browser/errors.js.map +1 -1
  17. package/dist/browser/generated-version.d.ts +1 -1
  18. package/dist/browser/generated-version.js +1 -1
  19. package/dist/browser/pkc/tracked-instance-registry-util.d.ts +1 -0
  20. package/dist/browser/pkc/tracked-instance-registry-util.js +34 -2
  21. package/dist/browser/pkc/tracked-instance-registry-util.js.map +1 -1
  22. package/dist/browser/pkc/tracked-instance-registry.d.ts +1 -0
  23. package/dist/browser/pkc/tracked-instance-registry.js +15 -0
  24. package/dist/browser/pkc/tracked-instance-registry.js.map +1 -1
  25. package/dist/browser/pkc-error.d.ts +1 -1
  26. package/dist/browser/publications/comment/comment-client-manager.d.ts +1 -0
  27. package/dist/browser/publications/comment/comment-client-manager.js +24 -4
  28. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  29. package/dist/browser/publications/comment/comment.js +6 -2
  30. package/dist/browser/publications/comment/comment.js.map +1 -1
  31. package/dist/browser/publications/publication-client-manager.d.ts +4 -1
  32. package/dist/browser/publications/publication-client-manager.js +51 -7
  33. package/dist/browser/publications/publication-client-manager.js.map +1 -1
  34. package/dist/browser/publications/publication.js +15 -1
  35. package/dist/browser/publications/publication.js.map +1 -1
  36. package/dist/browser/runtime/node/community/local-community/comment-updates.js +2 -1
  37. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  38. package/dist/browser/test/test-util.d.ts +1 -0
  39. package/dist/browser/test/test-util.js +6 -2
  40. package/dist/browser/test/test-util.js.map +1 -1
  41. package/dist/browser/util.js +6 -1
  42. package/dist/browser/util.js.map +1 -1
  43. package/dist/bundled/bundle-manifest.json +42 -42
  44. package/dist/bundled/challenges.js +1 -1
  45. package/dist/bundled/chunks/{helia-for-pkc-DXygdFt-.js → helia-for-pkc-vQZvQcs_.js} +2 -2
  46. package/dist/bundled/chunks/{local-community-D4I0gLqX.js → local-community-51NzNBUS.js} +4 -4
  47. package/dist/bundled/chunks/{local-community-Bbqx5IaD.js → local-community-dcM1R3k5.js} +1 -1
  48. package/dist/bundled/chunks/{node-oqffR7Bn.js → node-agDtcKUp.js} +69 -16
  49. package/dist/bundled/chunks/{page-sort-scoring-CK4vshII.js → page-sort-scoring-BSBLegpC.js} +1 -1
  50. package/dist/bundled/chunks/{rpc-local-community-UpO9cs7k.js → rpc-local-community-DOcUqswi.js} +332 -239
  51. package/dist/bundled/chunks/{util-D3vx4Na0.js → util-DNYbha6W.js} +1 -1
  52. package/dist/bundled/chunks/{util-nmnnrzbz.js → util-PGPkG-gU.js} +33 -6
  53. package/dist/bundled/chunks/{validate-package-factories-DkJmLpRe.js → validate-package-factories-2U8SCIxZ.js} +2 -2
  54. package/dist/bundled/index.js +1 -1
  55. package/dist/bundled/page-sorts.js +1 -1
  56. package/dist/bundled/rpc/src/index.js +4 -4
  57. package/dist/node/community/community-client-manager.js +30 -9
  58. package/dist/node/community/community-client-manager.js.map +1 -1
  59. package/dist/node/community/community-wire.d.ts +6 -0
  60. package/dist/node/community/community-wire.js +22 -1
  61. package/dist/node/community/community-wire.js.map +1 -1
  62. package/dist/node/community/remote-community.d.ts +7 -1
  63. package/dist/node/community/remote-community.js +87 -11
  64. package/dist/node/community/remote-community.js.map +1 -1
  65. package/dist/node/community/rpc-remote-community.d.ts +1 -0
  66. package/dist/node/community/rpc-remote-community.js +41 -6
  67. package/dist/node/community/rpc-remote-community.js.map +1 -1
  68. package/dist/node/community/schema.js +7 -1
  69. package/dist/node/community/schema.js.map +1 -1
  70. package/dist/node/errors.d.ts +1 -0
  71. package/dist/node/errors.js +1 -0
  72. package/dist/node/errors.js.map +1 -1
  73. package/dist/node/generated-version.d.ts +1 -1
  74. package/dist/node/generated-version.js +1 -1
  75. package/dist/node/pkc/tracked-instance-registry-util.d.ts +1 -0
  76. package/dist/node/pkc/tracked-instance-registry-util.js +34 -2
  77. package/dist/node/pkc/tracked-instance-registry-util.js.map +1 -1
  78. package/dist/node/pkc/tracked-instance-registry.d.ts +1 -0
  79. package/dist/node/pkc/tracked-instance-registry.js +15 -0
  80. package/dist/node/pkc/tracked-instance-registry.js.map +1 -1
  81. package/dist/node/pkc-error.d.ts +1 -1
  82. package/dist/node/publications/comment/comment-client-manager.d.ts +1 -0
  83. package/dist/node/publications/comment/comment-client-manager.js +24 -4
  84. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  85. package/dist/node/publications/comment/comment.js +6 -2
  86. package/dist/node/publications/comment/comment.js.map +1 -1
  87. package/dist/node/publications/publication-client-manager.d.ts +4 -1
  88. package/dist/node/publications/publication-client-manager.js +51 -7
  89. package/dist/node/publications/publication-client-manager.js.map +1 -1
  90. package/dist/node/publications/publication.js +15 -1
  91. package/dist/node/publications/publication.js.map +1 -1
  92. package/dist/node/runtime/node/community/local-community/comment-updates.js +2 -1
  93. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  94. package/dist/node/test/test-util.d.ts +1 -0
  95. package/dist/node/test/test-util.js +6 -2
  96. package/dist/node/test/test-util.js.map +1 -1
  97. package/dist/node/util.js +6 -1
  98. package/dist/node/util.js.map +1 -1
  99. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as retryKuboIpfsAddAndProvide, Ar as require_retry, Bn as CommentUpdateSchema, C as hideClassPrivateProps, Cn as isStringDomain, Cr as r, D as isIpfsCid, Dt as TimeoutError, E as isAbortError, Et as require_sha256, Ft as ChallengeVerificationMessageSchema, H as rejectWhenAbortSignalFires, Ir as PKCError, J as removeUndefinedValuesRecursively, Ln as CommentUpdateForChallengeVerificationSchema, Lr as messages, Mn as CommentIpfsSchema, Mr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeRequestMessageSchema, Ot as pTimeout, Q as retryKuboIpfsAdd, Rr as logger_default, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingCommunity, U as rejectWhenCommunityStopsOrAborts, Vr as setErrorMap, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _r as n$1, _t as refreshTrackedCommentAliases, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, bn as PubsubTopicSchema, br as e, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, fn as CommunityIpfsSchema, ft as findUpdatingComment, gt as listUpdatingCommunities, hr as n$2, ht as listUpdatingComments, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jr as FailedToFetchCommentIpfsFromGatewaysError, jt as ChallengeMessageSchema, k as isIpns, kt as ChallengeAnswerMessageSchema, mt as listStartedCommunities, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pt as findUpdatingCommunity, qt as version_default, r as calculateIpfsCidV0, sn as CommunityAnchorSchema, t as areEquivalentCommunityAddresses, ti as en_default, tt as shortifyCid, u as createAbortError, wt as untrackUpdatingComment, x as getPostUpdateTimestampRange, xr as e$1, xt as trackUpdatingComment, yr as t$1 } from "./util-nmnnrzbz.js";
3
- import { $ as parseCidStringSchemaWithPKCErrorIfItFails, $n as getCommunityPublicKeyFromWire, $t as RpcPublishedAnchorRecordResultSchema, A as findCommentInParsedPages, An as verifyChallengeVerification, At as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, B as InflightFetchManager, Bn as buildRuntimeAuthor, Br as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Bt as RpcEditCommunityParamSchema, C as RepliesPages, Ct as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Dt as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, En as signVote, Er as setNativeFunctions$1, Et as parseJsonWithPKCErrorIfFails, F as collectCrosspostAuthorsToResolve, Fn as verifyCommentUpdate, Fr as t$4, Ft as RpcCancelExportParamSchema, G as decodeRpcChallengeAnswerPubsubMsg, Gn as CreateCommunityListWithCidOptionsSchema, Gt as RpcFetchCidParamSchema, Hn as getAuthorNameFromRuntime, Ht as RpcExportCommunityModLogsResultSchema, It as RpcCidParamSchema, J as decodeRpcChallengeVerificationPubsubMsg, Jt as RpcFetchCommunityListResultSchema, K as decodeRpcChallengePubsubMsg, Kn as CreateNewCommunityListOptionsSchema, Kt as RpcFetchCidResultSchema, L as stripNameResolvedFromCrosspost, Ln as verifyCommunityEdit, Lr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Lt as RpcCommentRepliesPageParamSchema, M as parseRawPages, Mn as verifyCommentIpfs, Mr as n$3, Mt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, N as applyNameResolvedCacheToCrosspost, Nn as verifyCommentModeration, Nt as RpcAnchorPublishPreparationResultSchema, O as findCommentInPageInstance, On as verifyChallengeMessage, Or as t$5, Ot as parseRpcCommentEventWithPKCErrorIfItFails, P as cloneCrosspostForRuntime, Pn as verifyCommentPubsubMessage, Pr as t$2, Pt as RpcAuthorNameParamSchema, Qn as getCommunityNameFromWire, Qt as RpcPublishCommunityListResultSchema, R as PKCClientsManager, Rn as verifyCommunityList, Rr as NAME_RESOLVED_FALSE_TTL_MS, Rt as RpcCommunityIdentifierParamSchema, S as KeyvBetterSqlite3, Sr as monitorCommunitiesDirectory, St as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, Tn as signCommunityList, Tt as parseDecryptedChallengeWithPKCErrorIfItFails, Un as getAuthorNameFromWire, Ur as nativeFunctions$2, Ut as RpcExportCommunityParamSchema, V as InflightResourceTypes, Vn as cleanWireAuthor, Vt as RpcExportCommunityModLogsParamSchema, W as PKCTypedEmitter, Wn as normalizeCreatePublicationAuthor, Wr as require_undici, Wt as RpcExportCommunityResultSchema, Xn as buildRuntimeCommunityFields, Xt as RpcPublishChallengeAnswersParamSchema, Yt as RpcPublishAnchorRecordParamSchema, Zn as getCommunityAddressFromRecord, Zt as RpcPublishCommunityListParamSchema, _t as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, at as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, b as RemoteCommunity, bn as signCommentModeration, bt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, cn as decryptEd25519AesGcm, ct as parseCommunityAddressWithPKCErrorIfItFails, dt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, en as RpcResolveAuthorNameResultSchema, er as normalizeCommunityInputFromCommunity, fr as createKuboRpcClient, gn as signChallengeRequest, gt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, ht as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, in as require_lib$1, jn as verifyCommentEdit, jr as t$3, k as findCommentInPageInstanceRecursively, kt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, l as pkcJsPageSorts, m as pkcJsChallenges, mn as signChallengeAnswer, mt as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcSuccessResultSchema, nt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, on as createSigner, or as getPKCAddressFromPublicKeySync, ot as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, pn as cleanUpBeforePublishing, pt as parseCommunityListSchemaWithPKCErrorIfItFails, q as decodeRpcChallengeRequestPubsubMsg, qn as MAX_COMMUNITY_LIST_SIZE_BYTES, qt as RpcFetchCommunityListParamSchema, rn as RpcUnsubscribeParamSchema, rr as getBufferedPKCAddressFromPublicKey, rt as parseCommentIpfsSchemaWithPKCErrorIfItFails, sn as createAnchorIpnsRecord$1, st as parseCommentUpdateSchemaWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcSubscriptionIdResultSchema, tr as decode, un as encryptEd25519AesGcm, v as TrackedInstanceRegistry, vn as signComment, vr as getDefaultDataPath, wn as signCommunityEdit, wt as parseDecryptedChallengeVerification, xr as listCommunitiesSync, xt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signCommentEdit, z as GenericStateClient, zn as verifyVote, zr as NAME_RESOLVED_TRUE_TTL_MS, zt as RpcCommunityPageParamSchema } from "./rpc-local-community-UpO9cs7k.js";
4
- import { s as getHeliaDebugContext } from "./util-D3vx4Na0.js";
2
+ import { $ as retryKuboIpfsAddAndProvide, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, H as rejectWhenAbortSignalFires, Hr as setErrorMap, It as ChallengeVerificationMessageSchema, J as removeUndefinedValuesRecursively, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nn as CommentIpfsSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Q as retryKuboIpfsAdd, Rn as CommentUpdateForChallengeVerificationSchema, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenCommunityStopsOrAborts, Vn as CommentUpdateSchema, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jr as require_retry, k as isIpns, kt as pTimeout, ni as en_default, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, t as areEquivalentCommunityAddresses, tt as shortifyCid, u as createAbortError, vr as n$1, vt as refreshTrackedCommentAliases, wn as isStringDomain, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, zr as logger_default } from "./util-PGPkG-gU.js";
3
+ import { $ as parseCidStringSchemaWithPKCErrorIfItFails, $n as getCommunityNameFromWire, $t as RpcPublishedAnchorRecordResultSchema, A as findCommentInParsedPages, At as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, B as InflightFetchManager, Bn as verifyVote, Br as NAME_RESOLVED_TRUE_TTL_MS, Bt as RpcEditCommunityParamSchema, C as RepliesPages, Cr as monitorCommunitiesDirectory, Ct as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signVote, Dr as setNativeFunctions$1, Dt as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, En as signCommunityList, Et as parseJsonWithPKCErrorIfFails, F as collectCrosspostAuthorsToResolve, Fn as verifyCommentPubsubMessage, Fr as t$2, Ft as RpcCancelExportParamSchema, G as decodeRpcChallengeAnswerPubsubMsg, Gn as normalizeCreatePublicationAuthor, Gr as require_undici, Gt as RpcFetchCidParamSchema, Hn as cleanWireAuthor, Ht as RpcExportCommunityModLogsResultSchema, In as verifyCommentUpdate, Ir as t$4, It as RpcCidParamSchema, J as decodeRpcChallengeVerificationPubsubMsg, Jn as MAX_COMMUNITY_LIST_SIZE_BYTES, Jt as RpcFetchCommunityListResultSchema, K as decodeRpcChallengePubsubMsg, Kn as CreateCommunityListWithCidOptionsSchema, Kt as RpcFetchCidResultSchema, L as stripNameResolvedFromCrosspost, Lt as RpcCommentRepliesPageParamSchema, M as parseRawPages, Mn as verifyCommentEdit, Mr as t$3, Mt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, N as applyNameResolvedCacheToCrosspost, Nn as verifyCommentIpfs, Nr as n$3, Nt as RpcAnchorPublishPreparationResultSchema, O as findCommentInPageInstance, Or as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Ot as parseRpcCommentEventWithPKCErrorIfItFails, P as cloneCrosspostForRuntime, Pn as verifyCommentModeration, Pt as RpcAuthorNameParamSchema, Qn as getCommunityAddressFromRecord, Qt as RpcPublishCommunityListResultSchema, R as PKCClientsManager, Rn as verifyCommunityEdit, Rr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Rt as RpcCommunityIdentifierParamSchema, Sr as listCommunitiesSync, St as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, Tn as signCommunityEdit, Tt as parseDecryptedChallengeWithPKCErrorIfItFails, Un as getAuthorNameFromRuntime, Ut as RpcExportCommunityParamSchema, V as InflightResourceTypes, Vn as buildRuntimeAuthor, Vr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Vt as RpcExportCommunityModLogsParamSchema, W as PKCTypedEmitter, Wn as getAuthorNameFromWire, Wr as nativeFunctions$2, Wt as RpcExportCommunityResultSchema, Xt as RpcPublishChallengeAnswersParamSchema, Yt as RpcPublishAnchorRecordParamSchema, Zn as buildRuntimeCommunityFields, Zt as RpcPublishCommunityListParamSchema, _n as signChallengeRequest, _t as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, an as require_lib$1, at as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, b as KeyvBetterSqlite3, bn as signCommentEdit, bt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, cn as createAnchorIpnsRecord$1, ct as parseCommunityAddressWithPKCErrorIfItFails, dn as encryptEd25519AesGcm, dt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, en as RpcResolveAuthorNameResultSchema, er as getCommunityPublicKeyFromWire, gt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, hn as signChallengeAnswer, ht as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, in as findCommunityRecordNameMismatch, ir as getBufferedPKCAddressFromPublicKey, jn as verifyChallengeVerification, k as findCommentInPageInstanceRecursively, kn as verifyChallengeMessage, kr as t$5, kt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as decryptEd25519AesGcm, m as pkcJsChallenges, mn as cleanUpBeforePublishing, mt as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcSuccessResultSchema, nr as decode, nt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ot as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, pr as createKuboRpcClient, pt as parseCommunityListSchemaWithPKCErrorIfItFails, q as decodeRpcChallengeRequestPubsubMsg, qn as CreateNewCommunityListOptionsSchema, qt as RpcFetchCommunityListParamSchema, rn as RpcUnsubscribeParamSchema, rt as parseCommentIpfsSchemaWithPKCErrorIfItFails, sn as createSigner, sr as getPKCAddressFromPublicKeySync, st as parseCommentUpdateSchemaWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcSubscriptionIdResultSchema, tr as normalizeCommunityInputFromCommunity, v as TrackedInstanceRegistry, wt as parseDecryptedChallengeVerification, x as RemoteCommunity, xn as signCommentModeration, xt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signComment, yr as getDefaultDataPath, z as GenericStateClient, zn as verifyCommunityList, zr as NAME_RESOLVED_FALSE_TTL_MS, zt as RpcCommunityPageParamSchema } from "./rpc-local-community-DOcUqswi.js";
4
+ import { s as getHeliaDebugContext } from "./util-DNYbha6W.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -139,18 +139,20 @@ var PublicationClientsManager = class extends PKCClientsManager {
139
139
  }[communityNewLibp2pJsState];
140
140
  if (translatedState) this.updateLibp2pJsClientState(translatedState, libp2pJsClientKey);
141
141
  }
142
- async _createCommunityInstanceWithStateTranslation() {
142
+ async _createCommunityInstanceWithStateTranslation(opts) {
143
+ const communityName = opts?.byPublicKey && this._publication.communityPublicKey ? void 0 : this._publication.communityName;
143
144
  const directCommunityInstance = findUpdatingCommunity(this._pkc, {
144
145
  publicKey: this._publication.communityPublicKey,
145
- name: this._publication.communityName
146
+ name: communityName
146
147
  }) || findStartedCommunity(this._pkc, {
147
148
  publicKey: this._publication.communityPublicKey,
148
- name: this._publication.communityName
149
+ name: communityName
149
150
  });
150
151
  const community = directCommunityInstance || await this._pkc.createCommunity({
151
- name: this._publication.communityName,
152
+ name: communityName,
152
153
  publicKey: this._publication.communityPublicKey
153
154
  }, { abortSignal: this._publication._getCommunityFetchAbortSignal() });
155
+ if (!directCommunityInstance && !communityName && this._publication.communityName && community instanceof RemoteCommunity) community._nameToResolveBeforeFirstRecord = this._publication.communityName;
154
156
  this._communityForUpdating = {
155
157
  community,
156
158
  error: this.handleErrorEventFromCommunity.bind(this),
@@ -199,8 +201,8 @@ var PublicationClientsManager = class extends PKCClientsManager {
199
201
  if (directCommunityInstance) directCommunityInstance._numOfListenersForUpdatingInstance++;
200
202
  return this._communityForUpdating;
201
203
  }
202
- async cleanUpUpdatingCommunityInstance() {
203
- if (!this._communityForUpdating) throw Error("Need to define communityForUpdating first");
204
+ _detachCommunityStateListeners() {
205
+ if (!this._communityForUpdating) return;
204
206
  if (this._communityForUpdating.ipfsGatewayListeners) for (const gatewayUrl of Object.keys(this._communityForUpdating.ipfsGatewayListeners)) {
205
207
  this._communityForUpdating.community.clients.ipfsGateways[gatewayUrl].removeListener("statechange", this._communityForUpdating.ipfsGatewayListeners[gatewayUrl]);
206
208
  this.updateGatewayState("stopped", gatewayUrl);
@@ -218,6 +220,14 @@ var PublicationClientsManager = class extends PKCClientsManager {
218
220
  this.updateNameResolverState("stopped", resolverKey);
219
221
  }
220
222
  this._communityForUpdating.community.removeListener("updatingstatechange", this._communityForUpdating.updatingstatechange);
223
+ this._communityForUpdating.ipfsGatewayListeners = void 0;
224
+ this._communityForUpdating.kuboRpcListeners = void 0;
225
+ this._communityForUpdating.libp2pJsListeners = void 0;
226
+ this._communityForUpdating.nameResolverListeners = void 0;
227
+ }
228
+ async cleanUpUpdatingCommunityInstance() {
229
+ if (!this._communityForUpdating) throw Error("Need to define communityForUpdating first");
230
+ this._detachCommunityStateListeners();
221
231
  this._communityForUpdating.community.removeListener("error", this._communityForUpdating.error);
222
232
  this._communityForUpdating.community.removeListener("update", this._communityForUpdating.update);
223
233
  if (this._communityForUpdating.community._updatingCommunityInstanceWithListeners) await this._communityForUpdating.community.stop();
@@ -238,6 +248,12 @@ var PublicationClientsManager = class extends PKCClientsManager {
238
248
  let communityIpfs;
239
249
  if (!updatingCommunityInstance.community.raw.communityIpfs) {
240
250
  const timeoutMs = this._pkc._timeouts["community-ipns"];
251
+ const detachOnRecord = () => {
252
+ if (!updatingCommunityInstance.community.raw.communityIpfs) return;
253
+ updatingCommunityInstance.community.removeListener("update", detachOnRecord);
254
+ this._detachCommunityStateListeners();
255
+ };
256
+ updatingCommunityInstance.community.on("update", detachOnRecord);
241
257
  try {
242
258
  await waitForUpdateInCommunityInstanceWithErrorAndTimeout({
243
259
  community: updatingCommunityInstance.community,
@@ -248,6 +264,8 @@ var PublicationClientsManager = class extends PKCClientsManager {
248
264
  } catch (e) {
249
265
  await this.cleanUpUpdatingCommunityInstance();
250
266
  throw e;
267
+ } finally {
268
+ updatingCommunityInstance.community.removeListener("update", detachOnRecord);
251
269
  }
252
270
  await this.cleanUpUpdatingCommunityInstance();
253
271
  } else {
@@ -258,6 +276,12 @@ var PublicationClientsManager = class extends PKCClientsManager {
258
276
  communityAddress: updatingCommunityInstance.community.address,
259
277
  timeoutMs: this._pkc._timeouts["community-ipns"]
260
278
  });
279
+ const nameMismatch = findCommunityRecordNameMismatch({
280
+ requestedName: this._publication.communityName,
281
+ record: communityIpfs,
282
+ communityPublicKey: updatingCommunityInstance.community.publicKey
283
+ });
284
+ if (nameMismatch) throw nameMismatch;
261
285
  return {
262
286
  address: updatingCommunityInstance.community.address,
263
287
  publicKey: updatingCommunityInstance.community.publicKey,
@@ -787,6 +811,11 @@ var Publication = class extends import_lib.TypedEmitter {
787
811
  name: this.communityName
788
812
  });
789
813
  const subIpfs = subInstance?.raw.communityIpfs;
814
+ if (subIpfs && findCommunityRecordNameMismatch({
815
+ requestedName: this.communityName,
816
+ record: subIpfs,
817
+ communityPublicKey: subInstance.publicKey
818
+ })) return void 0;
790
819
  if (subIpfs && subInstance.publicKey) return {
791
820
  address: subInstance.address,
792
821
  publicKey: subInstance.publicKey,
@@ -807,7 +836,10 @@ var Publication = class extends import_lib.TypedEmitter {
807
836
  abortSignal: this._getCommunityFetchAbortSignal()
808
837
  }).catch((e) => {
809
838
  if (e?.code === "ERR_GET_COMMUNITY_ABORTED") log("Stopped the background refresh of the community cache", this.communityAddress);
810
- else log.error("Failed to update cache of community", this.communityAddress, e);
839
+ else {
840
+ if (e?.code === "ERR_COMMUNITY_RECORD_NAME_DOES_NOT_MATCH_REQUESTED_NAME") this._pkc._memCaches.communityForPublishing.delete(this.communityAddress);
841
+ log.error("Failed to update cache of community", this.communityAddress, e);
842
+ }
811
843
  }).finally(() => {
812
844
  if (this._backgroundCommunityRefresh === refresh) this._backgroundCommunityRefresh = void 0;
813
845
  });
@@ -1503,6 +1535,22 @@ var CommentClientsManager = class extends PublicationClientsManager {
1503
1535
  _calculatePathForPostCommentUpdate(folderCid, postCid) {
1504
1536
  return `${folderCid}/` + postCid + "/update";
1505
1537
  }
1538
+ _logIgnoredNotNewerPostCommentUpdate(log, path, loaded) {
1539
+ const held = this._comment.raw.commentUpdate;
1540
+ log.trace(`Comment ${this._comment.cid} ignored the CommentUpdate at ${path} as not newer than the one it holds`, {
1541
+ loaded: {
1542
+ updatedAt: loaded.updatedAt,
1543
+ replyCount: loaded.replyCount,
1544
+ pageCids: Object.keys(loaded.replies?.pageCids ?? {})
1545
+ },
1546
+ held: {
1547
+ updatedAt: held?.updatedAt,
1548
+ replyCount: held?.replyCount,
1549
+ pageCids: Object.keys(held?.replies?.pageCids ?? {}),
1550
+ lastPostUpdatesPath: this._comment._commentUpdateIpfsPath
1551
+ }
1552
+ });
1553
+ }
1506
1554
  _bitswapSessionSeedScopeIpnsPubsubTopic() {
1507
1555
  if (this._communityForUpdating?.community?.ipnsPubsubTopic) return this._communityForUpdating.community.ipnsPubsubTopic;
1508
1556
  const communityAddress = this._comment.communityAddress;
@@ -1555,7 +1603,8 @@ var CommentClientsManager = class extends PublicationClientsManager {
1555
1603
  commentUpdate,
1556
1604
  commentUpdateIpfsPath: path
1557
1605
  };
1558
- else return void 0;
1606
+ this._logIgnoredNotNewerPostCommentUpdate(log, path, commentUpdate);
1607
+ return;
1559
1608
  } catch (e) {
1560
1609
  this._comment._invalidCommentUpdateMfsPaths.add(path);
1561
1610
  if (e instanceof PKCError) e.details = {
@@ -1647,7 +1696,8 @@ var CommentClientsManager = class extends PublicationClientsManager {
1647
1696
  commentUpdate,
1648
1697
  commentUpdateIpfsPath: path
1649
1698
  };
1650
- else return void 0;
1699
+ this._logIgnoredNotNewerPostCommentUpdate(log, path, commentUpdate);
1700
+ return;
1651
1701
  } catch (e) {
1652
1702
  if (this._shouldWeFetchCommentUpdateFromNextTimestamp(e)) {
1653
1703
  attemptedPathsToLoadErrors[path] = e;
@@ -2731,7 +2781,7 @@ var Comment = class extends Publication {
2731
2781
  logger_default("pkc-js:comment:update:startCommentUpdateCommunitySubscription");
2732
2782
  if (this.state === "stopped") return;
2733
2783
  if (this.depth === 0) {
2734
- if (!this._communityForUpdating) this._communityForUpdating = await this._clientsManager._createCommunityInstanceWithStateTranslation();
2784
+ if (!this._communityForUpdating) this._communityForUpdating = await this._clientsManager._createCommunityInstanceWithStateTranslation({ byPublicKey: true });
2735
2785
  if (this.state !== "updating") return;
2736
2786
  if (this._communityForUpdating.community.state === "stopped") await this._communityForUpdating.community.update();
2737
2787
  if (this.state !== "updating") return;
@@ -3056,7 +3106,10 @@ var Comment = class extends Publication {
3056
3106
  const existingUpdatingComment = findUpdatingComment(this._pkc, { cid: this.cid });
3057
3107
  if (existingUpdatingComment) if (existingUpdatingComment === this) if (this._pkc._pkcRpcClient) await this._updateViaRpc();
3058
3108
  else this.loadCommentIpfsAndStartCommentUpdateSubscription().catch((e) => log.error("Failed to update comment", e));
3059
- else this._useUpdatingCommentFromPKC(existingUpdatingComment);
3109
+ else {
3110
+ log("Comment", this.cid, "will mirror the existing pkc._updatingComments entry, its state is", existingUpdatingComment.state, "updatingState", existingUpdatingComment.updatingState, "updatedAt", existingUpdatingComment.updatedAt);
3111
+ this._useUpdatingCommentFromPKC(existingUpdatingComment);
3112
+ }
3060
3113
  else await this._setUpNewUpdatingCommentInstance();
3061
3114
  if (this.raw.comment || this.raw.commentUpdate) this.emit("update", this);
3062
3115
  }
@@ -8616,7 +8669,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8616
8669
  this.clients.libp2pJsClients = {};
8617
8670
  if (!this.libp2pJsClientsOptions) return;
8618
8671
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
8619
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-DXygdFt-.js");
8672
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-vQZvQcs_.js");
8620
8673
  for (const clientOptions of this.libp2pJsClientsOptions) {
8621
8674
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
8622
8675
  ...clientOptions,
@@ -8980,7 +9033,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8980
9033
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
8981
9034
  log.trace("Received community options to create a local community instance:", options);
8982
9035
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
8983
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-Bbqx5IaD.js");
9036
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-dcM1R3k5.js");
8984
9037
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
8985
9038
  const community = new LocalCommunity(this);
8986
9039
  if (isLocalCommunity) {
@@ -1,4 +1,4 @@
1
- import { Cn as isStringDomain, v as getEquivalentCommunityAddresses, yn as PageSortFileSchema } from "./util-nmnnrzbz.js";
1
+ import { bn as PageSortFileSchema, v as getEquivalentCommunityAddresses, wn as isStringDomain } from "./util-PGPkG-gU.js";
2
2
  //#region dist/node/pages/page-sort-scoring.js
3
3
  function validatePageSortFile(rawFile) {
4
4
  const validated = PageSortFileSchema.parse(rawFile);