@pkcprotocol/pkc-js 0.0.47 → 0.0.49

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 (61) hide show
  1. package/dist/browser/clients/base-client-manager.js +5 -14
  2. package/dist/browser/clients/base-client-manager.js.map +1 -1
  3. package/dist/browser/community/community-client-manager.js +4 -11
  4. package/dist/browser/community/community-client-manager.js.map +1 -1
  5. package/dist/browser/generated-version.d.ts +1 -1
  6. package/dist/browser/generated-version.js +1 -1
  7. package/dist/browser/helia/helia-for-pkc.js +26 -17
  8. package/dist/browser/helia/helia-for-pkc.js.map +1 -1
  9. package/dist/browser/publications/comment/comment.js +6 -9
  10. package/dist/browser/publications/comment/comment.js.map +1 -1
  11. package/dist/browser/runtime/node/community/challenges/exclude/exclude.d.ts +1 -0
  12. package/dist/browser/runtime/node/community/challenges/exclude/exclude.js +6 -1
  13. package/dist/browser/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
  14. package/dist/browser/runtime/node/community/db-handler.d.ts +1 -0
  15. package/dist/browser/runtime/node/community/db-handler.js +3 -0
  16. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  17. package/dist/browser/runtime/node/community/local-community/comment-updates.js +11 -3
  18. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  19. package/dist/browser/runtime/node/community/local-community/lifecycle.js +4 -10
  20. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  21. package/dist/browser/signer/encryption.d.ts +2 -2
  22. package/dist/browser/signer/util.d.ts +1 -1
  23. package/dist/browser/util.d.ts +2 -0
  24. package/dist/browser/util.js +45 -0
  25. package/dist/browser/util.js.map +1 -1
  26. package/dist/bundled/bundle-manifest.json +81 -77
  27. package/dist/bundled/chunks/{helia-for-pkc-Kr0fvym5.js → helia-for-pkc-BZ6rZnW_.js} +16 -15
  28. package/dist/bundled/chunks/{local-community-DyL61Q84.js → local-community-CPvHllf9.js} +1 -1
  29. package/dist/bundled/chunks/{local-community-1YWTMINk.js → local-community-CbMGlscJ.js} +12 -13
  30. package/dist/bundled/chunks/{node-7bvDHqBl.js → node-eJCx_6gz.js} +8 -9
  31. package/dist/bundled/chunks/{rpc-local-community-Xpx65cbz.js → rpc-local-community-CTDbXkkP.js} +5 -17
  32. package/dist/bundled/chunks/{schema-CijXm_fr.js → schema-D0I45iuK.js} +3811 -3411
  33. package/dist/bundled/chunks/{util-RR1J0iZB.js → util-C0EAYvmS.js} +1 -1
  34. package/dist/bundled/index.js +1 -1
  35. package/dist/bundled/rpc/src/index.js +4 -4
  36. package/dist/node/clients/base-client-manager.js +5 -14
  37. package/dist/node/clients/base-client-manager.js.map +1 -1
  38. package/dist/node/community/community-client-manager.js +4 -11
  39. package/dist/node/community/community-client-manager.js.map +1 -1
  40. package/dist/node/generated-version.d.ts +1 -1
  41. package/dist/node/generated-version.js +1 -1
  42. package/dist/node/helia/helia-for-pkc.js +26 -17
  43. package/dist/node/helia/helia-for-pkc.js.map +1 -1
  44. package/dist/node/publications/comment/comment.js +6 -9
  45. package/dist/node/publications/comment/comment.js.map +1 -1
  46. package/dist/node/runtime/node/community/challenges/exclude/exclude.d.ts +1 -0
  47. package/dist/node/runtime/node/community/challenges/exclude/exclude.js +6 -1
  48. package/dist/node/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
  49. package/dist/node/runtime/node/community/db-handler.d.ts +1 -0
  50. package/dist/node/runtime/node/community/db-handler.js +3 -0
  51. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  52. package/dist/node/runtime/node/community/local-community/comment-updates.js +11 -3
  53. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  54. package/dist/node/runtime/node/community/local-community/lifecycle.js +4 -10
  55. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  56. package/dist/node/signer/encryption.d.ts +2 -2
  57. package/dist/node/signer/util.d.ts +1 -1
  58. package/dist/node/util.d.ts +2 -0
  59. package/dist/node/util.js +45 -0
  60. package/dist/node/util.js.map +1 -1
  61. package/package.json +16 -16
@@ -1,6 +1,7 @@
1
- import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, ir as PKCError, or as logger_default } from "./schema-CijXm_fr.js";
2
- import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-RR1J0iZB.js";
1
+ import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, cr as logger_default, or as PKCError } from "./schema-D0I45iuK.js";
2
+ import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-C0EAYvmS.js";
3
3
  import { CID } from "multiformats/cid";
4
+ import { NotFoundError } from "@libp2p/interface";
4
5
  import { peerIdFromString } from "@libp2p/peer-id";
5
6
  import { multihashToIPNSRoutingKey, unmarshalIPNSRecord } from "ipns";
6
7
  import { ipnsValidator } from "ipns/validator";
@@ -11,7 +12,7 @@ import { ipns } from "@helia/ipns";
11
12
  import { gossipsub } from "@libp2p/gossipsub";
12
13
  import { identify } from "@libp2p/identify";
13
14
  import { bitswap } from "@helia/block-brokers";
14
- import { delegatedRoutingV1HttpApiClient } from "@helia/delegated-routing-v1-http-api-client";
15
+ import { delegatedRoutingV1HttpApiClientContentRouting } from "@helia/delegated-routing-v1-http-api-client";
15
16
  import { unixfs } from "@helia/unixfs";
16
17
  import { fetch } from "@libp2p/fetch";
17
18
  import { pubsub } from "@helia/ipns/routing";
@@ -40,11 +41,14 @@ const creatingLibp2pJsClients = {};
40
41
  function getDelegatedRoutingFields(routers) {
41
42
  const routersObj = {};
42
43
  for (let i = 0; i < routers.length; i++) {
43
- const factory = delegatedRoutingV1HttpApiClient({ url: routers[i] });
44
+ const factory = delegatedRoutingV1HttpApiClientContentRouting({ url: routers[i] });
44
45
  routersObj["delegatedRouting" + i] = (components) => {
45
- const client = factory(components);
46
- client.getIPNS = client.getPeers = client.putIPNS = void 0;
47
- return client;
46
+ const routing = factory(components);
47
+ routing.get = async () => {
48
+ throw new NotFoundError("pkc HTTP routers do not serve IPNS records");
49
+ };
50
+ routing.put = async () => {};
51
+ return routing;
48
52
  };
49
53
  }
50
54
  return routersObj;
@@ -97,6 +101,10 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
97
101
  pubsubEventHandler.emit(evt.detail.topic, msgFormatted);
98
102
  });
99
103
  const heliaFs = unixfs(helia);
104
+ const asHeliaCatCid = (ipfsPathOrCid) => {
105
+ CID.parse(ipfsPathOrCid.split("/")[0]);
106
+ return ipfsPathOrCid;
107
+ };
100
108
  const ipnsNameResolver = ipns(helia, { routers: [pubsub(helia)] });
101
109
  ipnsNameResolver.routers = ipnsNameResolver.routers.filter((r) => r?.constructor?.name !== "LocalStoreRouting");
102
110
  const WARMUP_MAX_PEERS = 4;
@@ -184,14 +192,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
184
192
  } },
185
193
  cat(ipfsPath, options) {
186
194
  throwIfHeliaIsStoppingOrStopped();
187
- if (ipfsPath.includes("/")) {
188
- const rootCid = ipfsPath.split("/")[0];
189
- const path = ipfsPath.split("/").slice(1).join("/");
190
- return heliaFs.cat(CID.parse(rootCid), {
191
- ...options,
192
- path
193
- });
194
- } else return heliaFs.cat(CID.parse(ipfsPath), options);
195
+ return heliaFs.cat(asHeliaCatCid(ipfsPath), options);
195
196
  },
196
197
  pubsub: {
197
198
  ls: async () => helia.libp2p.services.pubsub.getTopics(),
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-1YWTMINk.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-CbMGlscJ.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -1,5 +1,5 @@
1
- import { $ as pubsubTopicToDhtKey, At as trackUpdatingCommunity, C as contentContainsMarkdownAudio, Cr as __commonJSMin, Dn as CommentsTableRowSchema, Dt as syncCommunityRegistryEntry, En as CommentUpdateTableRowSchema, Er as __toESM, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditReservedFields, G as isLinkOfAudio, J as isLinkOfVideo, Jn as require_commonjs, K as isLinkOfImage, Kt as CommentModerationsTableRowSchema, L as hideClassPrivateProps, Ln as CommentEditsTableRowSchema, M as genToArray, N as getEquivalentCommunityAddresses, Nn as CommentEditPubsubMessagePublicationSchema, Nt as untrackUpdatingCommunity, O as derivePublicationFromChallengeRequest, Ot as trackStartedCommunity, P as getErrorCodeFromMessage, Pn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Pt as require_sha256, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as CommunityEditPublicationPubsubReservedFields, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Tr as __require, Ut as CommentModerationPubsubMessagePublicationSchema, Vn as AuthorReservedFields, W as isLinkOfAnimatedImage, Wt as CommentModerationReservedFields, Y as isLinkValid, Yn as require_retry, _n as CommentPubsubMessageReservedFields, _t as writeKuboFilesWithTimeout, a as ChallengeRequestMessageSchema, ar as messages, b as areEquivalentCommunityAddresses, ct as retryKuboBlockPutPinAndProvidePubsubTopic, d as DecryptedChallengeRequestSchema, dn as VotePubsubReservedFields, en as CommunityIpfsSchema, gn as CommentIpfsSchema, ht as timestamp, ir as PKCError, it as removeNullUndefinedValues, jt as untrackStartedCommunity, k as doesDomainAddressHaveCapitalLetter, nt as removeMfsFilesSafely, or as logger_default, pn as VoteTablesRowSchema, pt as statMfsPathSafely, q as isLinkOfMedia, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tn as CommunitySignedPropertyNames, tt as removeBlocksFromKuboNode, u as DecryptedChallengeRequestPublicationSchema, un as VotePubsubMessagePublicationSchema, ut as retryKuboIpfsAddAndProvide, vt as findCommunityInRegistry, w as contentContainsMarkdownImages, wn as CommentUpdateSchema, x as calculateIpfsCidV0, xt as findUpdatingCommunity, y as version_default, yr as ZodError, yt as findStartedCommunity } from "./schema-CijXm_fr.js";
2
- import { A as getDefaultCommunityDbConfig, At as cleanWireAuthor, Bt as encode, C as calculateExpectedSignatureSize, Ct as verifyCommentModeration, D as deriveCommentIpfsFromCommentTableRow, Dt as verifyCommunityEdit, E as deleteOldCommunityInWindows, Et as verifyCommunity, Gn as require_lodash_merge, Gt as getPublicKeyFromPrivateKey, H as POST_REPLIES_SORT_TYPES, Ht as getIpfsKeyFromPrivateKey, I as moveCommunityDbToDeletedDirectory, It as getCommunityNameFromWire, Kt as createSchemaRowParser, L as resolveDbPostsCidRefs, Lt as getCommunityPublicKeyFromWire, M as getThumbnailPropsOfLink, Mt as getAuthorNameFromWire, N as importSignerIntoKuboNode, O as deriveDbPosts, Ot as verifyVote, S as backupCommunityDb, St as verifyCommentIpfs, Tt as verifyCommentUpdate, U as REPLY_REPLIES_SORT_TYPES, Un as stringify, Ut as getPKCAddressFromPublicKey, V as POSTS_SORT_TYPES, W as TIMEFRAMES_TO_SECONDS, Wn as STORAGE_KEYS, Wt as getPKCAddressFromPublicKeySync, Y as iterateOverPageCidsToFindAllCids, _t as verifyChallengeAnswer, a as pkcJsChallenges, an as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, b as encryptEd25519AesGcmPublicKeyBuffer, ct as signChallengeVerification, ft as signCommentUpdate, h as SignerWithPublicKeyAddress, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, i as getCommunityChallengeFromCommunityChallengeSettings, it as cleanUpBeforePublishing, k as deriveDbReplies, kt as buildRuntimeAuthor, l as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, lt as signComment, mt as signCommunity, o as TrackedInstanceRegistry, ot as signChallengeMessage, pt as signCommentUpdateForChallengeVerification, r as getChallengeVerification, rn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, s as LRUCache, t as RpcLocalCommunity, tt as pLimit, u as KeyvBetterSqlite3, ut as signCommentEdit, v as decryptEd25519AesGcmPublicKeyBuffer, vn as parseJsonWithPKCErrorIfFails, w as calculateInlineRepliesBudget, wt as verifyCommentPubsubMessage, x as BackupAbortError, xt as verifyCommentEdit, yt as verifyChallengeRequest, zt as decode } from "./rpc-local-community-Xpx65cbz.js";
1
+ import { $ as pubsubTopicToDhtKey, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dr as __require, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, Or as __toESM, P as getErrorCodeFromMessage, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Tr as __commonJSMin, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as require_commonjs, Y as isLinkValid, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as logger_default, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nt as removeBlocksFromKuboNode, or as PKCError, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, sr as messages, t as ChallengeAnswerMessageSchema, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xr as ZodError, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-D0I45iuK.js";
2
+ import { A as getDefaultCommunityDbConfig, At as cleanWireAuthor, Bt as encode, C as calculateExpectedSignatureSize, Ct as verifyCommentModeration, D as deriveCommentIpfsFromCommentTableRow, Dt as verifyCommunityEdit, E as deleteOldCommunityInWindows, Et as verifyCommunity, Gn as require_lodash_merge, Gt as getPublicKeyFromPrivateKey, H as POST_REPLIES_SORT_TYPES, Ht as getIpfsKeyFromPrivateKey, I as moveCommunityDbToDeletedDirectory, It as getCommunityNameFromWire, Kt as createSchemaRowParser, L as resolveDbPostsCidRefs, Lt as getCommunityPublicKeyFromWire, M as getThumbnailPropsOfLink, Mt as getAuthorNameFromWire, N as importSignerIntoKuboNode, O as deriveDbPosts, Ot as verifyVote, S as backupCommunityDb, St as verifyCommentIpfs, Tt as verifyCommentUpdate, U as REPLY_REPLIES_SORT_TYPES, Un as stringify, Ut as getPKCAddressFromPublicKey, V as POSTS_SORT_TYPES, W as TIMEFRAMES_TO_SECONDS, Wn as STORAGE_KEYS, Wt as getPKCAddressFromPublicKeySync, Y as iterateOverPageCidsToFindAllCids, _t as verifyChallengeAnswer, a as pkcJsChallenges, an as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, b as encryptEd25519AesGcmPublicKeyBuffer, ct as signChallengeVerification, ft as signCommentUpdate, h as SignerWithPublicKeyAddress, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, i as getCommunityChallengeFromCommunityChallengeSettings, it as cleanUpBeforePublishing, k as deriveDbReplies, kt as buildRuntimeAuthor, l as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, lt as signComment, mt as signCommunity, o as TrackedInstanceRegistry, ot as signChallengeMessage, pt as signCommentUpdateForChallengeVerification, r as getChallengeVerification, rn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, s as LRUCache, t as RpcLocalCommunity, tt as pLimit, u as KeyvBetterSqlite3, ut as signCommentEdit, v as decryptEd25519AesGcmPublicKeyBuffer, vn as parseJsonWithPKCErrorIfFails, w as calculateInlineRepliesBudget, wt as verifyCommentPubsubMessage, x as BackupAbortError, xt as verifyCommentEdit, yt as verifyChallengeRequest, zt as decode } from "./rpc-local-community-CTDbXkkP.js";
3
3
  import { randomFillSync, randomUUID } from "node:crypto";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import path from "node:path";
@@ -148,12 +148,15 @@ async function syncPostUpdatesWithIpfs(community, commentUpdateRowsToPublishToIp
148
148
  const postUpdatesDirectory = `/${community.address}`;
149
149
  const commentUpdatesWithLocalPath = commentUpdateRowsToPublishToIpfs.filter((row) => typeof row.localMfsPath === "string");
150
150
  if (commentUpdatesWithLocalPath.length === 0) throw Error("No comment updates of posts to publish to postUpdates directory. This is a critical bug");
151
+ const liveCommentUpdates = commentUpdatesWithLocalPath.filter((row) => community._dbHandler.commentExistsInDb(row.newCommentUpdate.cid));
152
+ const purgedMidSyncCount = commentUpdatesWithLocalPath.length - liveCommentUpdates.length;
153
+ if (purgedMidSyncCount > 0) log(`Skipping ${purgedMidSyncCount} post CommentUpdate(s) for community ${community.address} whose comment was purged mid-sync`);
151
154
  const kuboRpc = community._clientsManager.getDefaultKuboRpcClient();
152
155
  const removedMfsPaths = await rmUnneededMfsPaths(community);
153
156
  let postUpdatesDirectoryCid;
154
157
  const BATCH_SIZE = 50;
155
- for (let index = 0; index < commentUpdatesWithLocalPath.length; index += BATCH_SIZE) {
156
- const batch = commentUpdatesWithLocalPath.slice(index, index + BATCH_SIZE);
158
+ for (let index = 0; index < liveCommentUpdates.length; index += BATCH_SIZE) {
159
+ const batch = liveCommentUpdates.slice(index, index + BATCH_SIZE);
157
160
  await Promise.all(batch.map(async (row) => {
158
161
  const { localMfsPath, newCommentUpdate } = row;
159
162
  const content = stringify(newCommentUpdate);
@@ -174,7 +177,7 @@ async function syncPostUpdatesWithIpfs(community, commentUpdateRowsToPublishToIp
174
177
  postUpdatesDirectoryCid = await kuboRpc._client.files.flush(postUpdatesDirectory);
175
178
  }
176
179
  const postUpdatesDirectoryCidString = postUpdatesDirectoryCid?.toString();
177
- log("Community", community.address, "Synced", commentUpdatesWithLocalPath.length, "post CommentUpdates", "with MFS postUpdates directory", postUpdatesDirectoryCidString);
180
+ log("Community", community.address, "Synced", liveCommentUpdates.length, "post CommentUpdates", "with MFS postUpdates directory", postUpdatesDirectoryCidString);
178
181
  community._dbHandler.markCommentsAsPublishedToPostUpdates(commentUpdateRowsToPublishToIpfs.map((row) => row.newCommentUpdate.cid));
179
182
  }
180
183
  async function adjustPostUpdatesBucketsIfNeeded(community) {
@@ -4449,6 +4452,9 @@ var DbHandler = class {
4449
4452
  if (!row) return void 0;
4450
4453
  return this._parseCommentsTableRow(row);
4451
4454
  }
4455
+ commentExistsInDb(cid) {
4456
+ return this._db.prepare(`SELECT 1 FROM ${TABLES.COMMENTS} WHERE cid = ? LIMIT 1`).get(cid) !== void 0;
4457
+ }
4452
4458
  queryPseudonymityAliasByCommentCid(commentCid) {
4453
4459
  return this._db.prepare(`SELECT commentCid, aliasPrivateKey, originalAuthorPublicKey, originalAuthorName, mode, insertedAt FROM ${TABLES.PSEUDONYMITY_ALIASES} WHERE commentCid = ?`).get(commentCid);
4454
4460
  }
@@ -6405,14 +6411,7 @@ async function updateLoop(community) {
6405
6411
  log.error("Error in update loop", e);
6406
6412
  community.emit("error", e);
6407
6413
  } finally {
6408
- await new Promise((resolve) => {
6409
- if (community._updateLoopAbortController?.signal.aborted) return resolve();
6410
- const timer = setTimeout(resolve, community._pkc.updateInterval);
6411
- community._updateLoopAbortController?.signal.addEventListener("abort", () => {
6412
- clearTimeout(timer);
6413
- resolve();
6414
- }, { once: true });
6415
- });
6414
+ await sleepUntilTimeoutOrAbort(community._pkc.updateInterval, community._updateLoopAbortController?.signal);
6416
6415
  }
6417
6416
  }
6418
6417
  async function update(community) {
@@ -1,6 +1,6 @@
1
- import { $n as FailedToFetchCommentIpfsFromGatewaysError, B as isIpfsCid, Cr as __commonJSMin, Ct as listUpdatingComments, D as deepMergeRuntimeFields, E as createAbortError, Er as __toESM, Ft as TimeoutError, It as pTimeout, Jn as require_commonjs, L as hideClassPrivateProps, Mt as untrackUpdatingComment, Pt as require_sha256, Q as isStringDomain, Sr as stringifyPrimitive, St as listStartedCommunities, Tr as __require, Tt as refreshTrackedCommentAliases, Xn as CID, Yn as require_retry, a as ChallengeRequestMessageSchema, ar as messages, at as removeUndefinedValuesRecursively, b as areEquivalentCommunityAddresses, br as joinValues, bt as findUpdatingComment, dt as shortifyAddress, en as CommunityIpfsSchema, ft as shortifyCid, gn as CommentIpfsSchema, gt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, ht as timestamp, ir as PKCError, k as doesDomainAddressHaveCapitalLetter, kt as trackUpdatingComment, lr as setErrorMap, lt as retryKuboIpfsAdd, on as PubsubTopicSchema, or as logger_default, ot as replaceXWithY, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, st as resolveWhenPredicateIsTrue, t as ChallengeAnswerMessageSchema, wn as CommentUpdateSchema, wt as listUpdatingCommunities, xn as CommentUpdateForChallengeVerificationSchema, xr as parsedType, xt as findUpdatingCommunity, y as version_default, yt as findStartedCommunity, z as isAbortError } from "./schema-CijXm_fr.js";
2
- import { $ as PKCClientsManager, $t as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCommunityPageParamSchema, At as cleanWireAuthor, B as CommentClientsManager, Bn as RpcSubscriptionIdResultSchema, Ct as verifyCommentModeration, Dn as RpcCidParamSchema, Dt as verifyCommunityEdit, En as RpcCancelExportParamSchema, F as monitorCommunitiesDirectory, Fn as RpcExportCommunityResultSchema, Ft as getCommunityAddressFromRecord, Hn as RpcUnsubscribeParamSchema, In as RpcFetchCidParamSchema, It as getCommunityNameFromWire, J as findCommentInPageInstanceRecursively, Kn as nativeFunctions$2, Ln as RpcFetchCidResultSchema, Lt as getCommunityPublicKeyFromWire, Mn as RpcExportCommunityModLogsParamSchema, Nn as RpcExportCommunityModLogsResultSchema, Nt as normalizeCreatePublicationAuthor, On as RpcCommentRepliesPageParamSchema, Ot as verifyVote, P as listCommunitiesSync, Pn as RpcExportCommunityParamSchema, Pt as buildRuntimeCommunityFields, Q as PublicationClientsManager, R as setNativeFunctions$1, Rn as RpcPublishChallengeAnswersParamSchema, Rt as normalizeCommunityInputFromCommunity, Sn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, St as verifyCommentIpfs, T as createKuboRpcClient, Tn as RpcAuthorNameParamSchema, Tt as verifyCommentUpdate, Vn as RpcSuccessResultSchema, Vt as getBufferedPKCAddressFromPublicKey, X as parseRawPages, Xt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, Z as RepliesPages, Zt as parseCommentIpfsSchemaWithPKCErrorIfItFails, _ as decryptEd25519AesGcm, _n as parseDecryptedChallengeWithPKCErrorIfItFails, a as pkcJsChallenges, at as signChallengeAnswer, bn as parseRpcCommentEventWithPKCErrorIfItFails, bt as verifyChallengeVerification, c as RemoteCommunity, cn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, d as decodeRpcChallengeAnswerPubsubMsg, dt as signCommentModeration, en as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, et as InflightFetchManager, f as decodeRpcChallengePubsubMsg, fn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, g as createSigner, gn as parseDecryptedChallengeVerification, gt as signVote, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, ht as signCommunityEdit, in as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, it as cleanUpBeforePublishing, j as getDefaultDataPath, jn as RpcEditCommunityParamSchema, jt as getAuthorNameFromRuntime, kn as RpcCommunityIdentifierParamSchema, kt as buildRuntimeAuthor, ln as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, lt as signComment, m as decodeRpcChallengeVerificationPubsubMsg, mn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nt as PKCTypedEmitter, o as TrackedInstanceRegistry, on as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, p as decodeRpcChallengeRequestPubsubMsg, pn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, q as extractCommunityRuntimeFieldsFromParsedPages, qn as require_undici, qt as parseCidStringSchemaWithPKCErrorIfItFails, rt as require_lib$1, s as LRUCache, sn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, st as signChallengeRequest, t as RpcLocalCommunity, tn as parseCommunityAddressWithPKCErrorIfItFails, u as KeyvBetterSqlite3, ut as signCommentEdit, vn as parseJsonWithPKCErrorIfFails, vt as verifyChallengeMessage, wn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, wt as verifyCommentPubsubMessage, xn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, xt as verifyCommentEdit, y as encryptEd25519AesGcm, yn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, z as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, zn as RpcResolveAuthorNameResultSchema, zt as decode } from "./rpc-local-community-Xpx65cbz.js";
3
- import { n as getHeliaDebugContext } from "./util-RR1J0iZB.js";
1
+ import { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Cr as parsedType, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dr as __require, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Or as __toESM, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as CID, Rt as pTimeout, Sr as joinValues, St as findUpdatingComment, Tr as __commonJSMin, Tt as listUpdatingComments, Xn as require_commonjs, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, cn as PubsubTopicSchema, cr as logger_default, ct as resolveWhenPredicateIsTrue, dr as setErrorMap, ft as shortifyAddress, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, or as PKCError, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, sr as messages, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as FailedToFetchCommentIpfsFromGatewaysError, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as stringifyPrimitive, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, z as isAbortError } from "./schema-D0I45iuK.js";
2
+ import { $ as PKCClientsManager, $t as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCommunityPageParamSchema, At as cleanWireAuthor, B as CommentClientsManager, Bn as RpcSubscriptionIdResultSchema, Ct as verifyCommentModeration, Dn as RpcCidParamSchema, Dt as verifyCommunityEdit, En as RpcCancelExportParamSchema, F as monitorCommunitiesDirectory, Fn as RpcExportCommunityResultSchema, Ft as getCommunityAddressFromRecord, Hn as RpcUnsubscribeParamSchema, In as RpcFetchCidParamSchema, It as getCommunityNameFromWire, J as findCommentInPageInstanceRecursively, Kn as nativeFunctions$2, Ln as RpcFetchCidResultSchema, Lt as getCommunityPublicKeyFromWire, Mn as RpcExportCommunityModLogsParamSchema, Nn as RpcExportCommunityModLogsResultSchema, Nt as normalizeCreatePublicationAuthor, On as RpcCommentRepliesPageParamSchema, Ot as verifyVote, P as listCommunitiesSync, Pn as RpcExportCommunityParamSchema, Pt as buildRuntimeCommunityFields, Q as PublicationClientsManager, R as setNativeFunctions$1, Rn as RpcPublishChallengeAnswersParamSchema, Rt as normalizeCommunityInputFromCommunity, Sn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, St as verifyCommentIpfs, T as createKuboRpcClient, Tn as RpcAuthorNameParamSchema, Tt as verifyCommentUpdate, Vn as RpcSuccessResultSchema, Vt as getBufferedPKCAddressFromPublicKey, X as parseRawPages, Xt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, Z as RepliesPages, Zt as parseCommentIpfsSchemaWithPKCErrorIfItFails, _ as decryptEd25519AesGcm, _n as parseDecryptedChallengeWithPKCErrorIfItFails, a as pkcJsChallenges, at as signChallengeAnswer, bn as parseRpcCommentEventWithPKCErrorIfItFails, bt as verifyChallengeVerification, c as RemoteCommunity, cn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, d as decodeRpcChallengeAnswerPubsubMsg, dt as signCommentModeration, en as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, et as InflightFetchManager, f as decodeRpcChallengePubsubMsg, fn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, g as createSigner, gn as parseDecryptedChallengeVerification, gt as signVote, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, ht as signCommunityEdit, in as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, it as cleanUpBeforePublishing, j as getDefaultDataPath, jn as RpcEditCommunityParamSchema, jt as getAuthorNameFromRuntime, kn as RpcCommunityIdentifierParamSchema, kt as buildRuntimeAuthor, ln as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, lt as signComment, m as decodeRpcChallengeVerificationPubsubMsg, mn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nt as PKCTypedEmitter, o as TrackedInstanceRegistry, on as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, p as decodeRpcChallengeRequestPubsubMsg, pn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, q as extractCommunityRuntimeFieldsFromParsedPages, qn as require_undici, qt as parseCidStringSchemaWithPKCErrorIfItFails, rt as require_lib$1, s as LRUCache, sn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, st as signChallengeRequest, t as RpcLocalCommunity, tn as parseCommunityAddressWithPKCErrorIfItFails, u as KeyvBetterSqlite3, ut as signCommentEdit, vn as parseJsonWithPKCErrorIfFails, vt as verifyChallengeMessage, wn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, wt as verifyCommentPubsubMessage, xn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, xt as verifyCommentEdit, y as encryptEd25519AesGcm, yn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, z as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, zn as RpcResolveAuthorNameResultSchema, zt as decode } from "./rpc-local-community-CTDbXkkP.js";
3
+ import { n as getHeliaDebugContext } from "./util-C0EAYvmS.js";
4
4
  import path from "path";
5
5
  import assert from "assert";
6
6
  import fs from "fs";
@@ -1431,7 +1431,8 @@ var Comment = class extends Publication {
1431
1431
  _scheduleParallelCommunityConnect(log) {
1432
1432
  if (!this.communityName && !this.communityPublicKey) return;
1433
1433
  const stopSignal = this._getStopAbortSignal();
1434
- const timer = setTimeout(async () => {
1434
+ (async () => {
1435
+ await sleepUntilTimeoutOrAbort(5e3, stopSignal);
1435
1436
  if (this.raw.comment) return;
1436
1437
  if (this._isStopAbortRequested() || this._pkc.destroyed) return;
1437
1438
  log("Starting parallel pkc.getCommunity for", this.cid, "so bitswap can fetch the comment block from community peers");
@@ -1443,9 +1444,7 @@ var Comment = class extends Publication {
1443
1444
  } catch (err) {
1444
1445
  if (!isAbortError(err)) log.error("Parallel pkc.getCommunity failed for", this.cid, err);
1445
1446
  }
1446
- }, 5e3);
1447
- if (stopSignal) if (stopSignal.aborted) clearTimeout(timer);
1448
- else stopSignal.addEventListener("abort", () => clearTimeout(timer), { once: true });
1447
+ })();
1449
1448
  }
1450
1449
  async _attemptToFetchCommentIpfsIfNeeded(log) {
1451
1450
  if (this.cid && !this.raw.comment) {
@@ -6805,7 +6804,7 @@ var PKC$1 = class extends PKCTypedEmitter {
6805
6804
  this.clients.libp2pJsClients = {};
6806
6805
  if (!this.libp2pJsClientsOptions) return;
6807
6806
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
6808
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-Kr0fvym5.js");
6807
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-BZ6rZnW_.js");
6809
6808
  for (const clientOptions of this.libp2pJsClientsOptions) {
6810
6809
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
6811
6810
  ...clientOptions,
@@ -7044,7 +7043,7 @@ var PKC$1 = class extends PKCTypedEmitter {
7044
7043
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
7045
7044
  log.trace("Received community options to create a local community instance:", options);
7046
7045
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
7047
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-DyL61Q84.js");
7046
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-CPvHllf9.js");
7048
7047
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
7049
7048
  const community = new LocalCommunity(this);
7050
7049
  if (isLocalCommunity) {
@@ -1,4 +1,4 @@
1
- import { $ as pubsubTopicToDhtKey, $n as FailedToFetchCommentIpfsFromGatewaysError, $t as CommunityIpfsReservedFields, A as extractNetworkErrorDetails, An as ModQueuePageIpfsSchema, At as trackUpdatingCommunity, B as isIpfsCid, Bn as AuthorCommentIpfsReservedFields, Bt as CommunityEditPubsubMessagePublicationSchema, Cn as CommentUpdateReservedFields, Cr as __commonJSMin, D as deepMergeRuntimeFields, E as createAbortError, Er as __toESM, Et as refreshTrackedCommunityAliases, Gn as CommunityAddressSchema, Gt as CommentModerationSignedPropertyNames, H as isIpns, Hn as ChallengeAnswersSchema, Ht as CommentModerationChallengeRequestToEncryptSchema, I as getPostUpdateTimestampRange, In as CommentEditSignedPropertyNames, It as pTimeout, Jn as require_commonjs$4, Jt as ChallengeFileFactorySchema, Kn as CommunityAuthorChallengeReservedFieldNames, Kt as CommentModerationsTableRowSchema, L as hideClassPrivateProps, Lt as CommunityEditPublicationChallengeRequestToEncryptSchema, Mn as CommentEditChallengeRequestToEncryptSchema, Nt as untrackUpdatingCommunity, O as derivePublicationFromChallengeRequest, On as CreateCommentOptionsWithRefinementSchema, Ot as trackStartedCommunity, Pn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Pt as require_sha256$1, Q as isStringDomain, Qn as all, Qt as CommunityExportRecordsSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CreateCommentEditOptionsWithRefinementSchema, Sn as CommentUpdateForChallengeVerificationSignedPropertyNames, St as listStartedCommunities, Tn as CommentUpdateSignedPropertyNames, Tr as __require, U as isIpnsPath, Un as CidPathSchema, Ut as CommentModerationPubsubMessagePublicationSchema, V as isIpfsPath, Vt as CreateCommunityEditPublicationOptionsWithRefinementSchema, Wn as CidStringSchema, X as isRequestPubsubPublicationOfPost, Xn as CID$1, Xt as CommunityChallengeSettingSchema, Yn as require_retry$1, Yt as ChallengeFileSchema, Z as isRequestPubsubPublicationOfReply, Zn as create, Zt as CommunityEditOptionsSchema, _ as PKCUserOptionBaseSchema, _r as record, an as ExportCommunityModLogsOptionsSchema, ar as messages, b as areEquivalentCommunityAddresses, bn as CommentUpdateChallengeReservedFieldNames, bt as findUpdatingComment, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateVoteUserOptionsWithRefinementSchema, cr as require_ms$1, dr as array, dt as shortifyAddress, en as CommunityIpfsSchema, er as FailedToFetchCommentUpdateFromGatewaysError, f as DecryptedChallengeSchema, fn as VoteSignedPropertyNames, fr as boolean, ft as shortifyCid, g as PKCParsedOptionsSchema, gn as CommentIpfsSchema, gr as object, gt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, h as NameResolverSerializedSchema, hn as CommentIpfsReservedFields, hr as number, ht as timestamp, i as ChallengeMessageSignedPropertyNames, in as CreateRpcCommunityFunctionArgumentSchema, ir as PKCError, j as fetchAndValidateIpnsRecordFromGateway, jn as PageIpfsSchema, jt as untrackStartedCommunity, k as doesDomainAddressHaveCapitalLetter, kn as GetPageParamSchema, l as DecryptedChallengeAnswerSchema, ln as VoteChallengeRequestToEncryptSchema, m as NameResolveCacheOptionsSchema, mn as CommentChallengeRequestToEncryptSchema, mr as literal, mt as throwIfAbortSignalAborted, n as ChallengeAnswerMessageSignedPropertyNames, nn as CreateNewLocalCommunityUserOptionsSchema, nr as FailedToFetchGenericIpfsFromGatewaysError, o as ChallengeRequestMessageSignedPropertyNames, or as logger_default, p as DecryptedChallengeVerificationSchema, pr as custom, qn as CreateSignerSchema, qt as CreateCommentModerationOptionsWithRefinementSchema, rn as CreateRemoteCommunityFunctionArgumentSchema, rr as FailedToFetchPageIpfsFromGatewaysError, rt as removeNullUndefinedEmptyObjectsValuesRecursively, sn as RpcRemoteCommunityUpdateEventResultSchema, sr as require_supports_color, st as resolveWhenPredicateIsTrue, tn as CommunitySignedPropertyNames, tr as FailedToFetchCommunityFromGatewaysError, un as VotePubsubMessagePublicationSchema, ur as _enum, v as PKCUserOptionsSchema, vn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, vr as string, wn as CommentUpdateSchema, wr as __exportAll, wt as listUpdatingCommunities, x as calculateIpfsCidV0, xt as findUpdatingCommunity, yn as CommentSignedPropertyNames, yt as findStartedCommunity, z as isAbortError, zn as AuthorAddressSchema, zt as CommunityEditPublicationSignedPropertyNames } from "./schema-CijXm_fr.js";
1
+ import { $ as pubsubTopicToDhtKey, $n as create, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as __require, E as createAbortError, En as CommentUpdateSchema, Er as __exportAll, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as __toESM, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as CID$1, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as __commonJSMin, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as require_commonjs$4, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as require_retry$1, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as number, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as FailedToFetchPageIpfsFromGatewaysError, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as string, c as ChallengeVerificationMessageSignedPropertyNames, cr as logger_default, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, en as CommunityExportRecordsSchema, er as all, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as _enum, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as literal, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as custom, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as FailedToFetchGenericIpfsFromGatewaysError, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, k as doesDomainAddressHaveCapitalLetter, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as require_supports_color, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as boolean, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as FailedToFetchCommentUpdateFromGatewaysError, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as PKCError, p as DecryptedChallengeVerificationSchema, pr as array, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as FailedToFetchCommunityFromGatewaysError, sn as ExportCommunityModLogsOptionsSchema, sr as messages, tn as CommunityIpfsReservedFields, tr as FailedToFetchCommentIpfsFromGatewaysError, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as require_ms$1, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as object, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xt as findStartedCommunity, yr as record, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-D0I45iuK.js";
2
2
  import { createHash } from "node:crypto";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import dns from "node:dns";
@@ -98914,14 +98914,10 @@ var BaseClientsManager = class BaseClientsManager {
98914
98914
  });
98915
98915
  try {
98916
98916
  throwIfAbortSignalAborted(abortSignal);
98917
- const resolvePromise = nameResolver.resolve({
98917
+ const result = await raceAgainstAbort(nameResolver.resolve({
98918
98918
  name,
98919
98919
  abortSignal
98920
- });
98921
- const result = abortSignal ? await Promise.race([resolvePromise, new Promise((_, reject) => {
98922
- if (abortSignal.aborted) reject(createAbortError());
98923
- else abortSignal.addEventListener("abort", () => reject(createAbortError()), { once: true });
98924
- })]) : await resolvePromise;
98920
+ }), abortSignal);
98925
98921
  throwIfAbortSignalAborted(abortSignal);
98926
98922
  value = result?.publicKey;
98927
98923
  } catch (e) {
@@ -124598,15 +124594,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
124598
124594
  } catch (e) {
124599
124595
  log.error(`Failed to update community ${this._community.address} for this iteration, will retry later`, e);
124600
124596
  } finally {
124601
- await new Promise((resolve) => {
124602
- const stopSignal = this._community._getStopAbortSignal();
124603
- if (stopSignal?.aborted) return resolve();
124604
- const timer = setTimeout(resolve, updateInterval);
124605
- stopSignal?.addEventListener("abort", () => {
124606
- clearTimeout(timer);
124607
- resolve();
124608
- }, { once: true });
124609
- });
124597
+ await sleepUntilTimeoutOrAbort(updateInterval, this._community._getStopAbortSignal());
124610
124598
  }
124611
124599
  this._community._clearStopAbortController();
124612
124600
  log("Community", this._community.address, "is no longer updating");
@@ -127360,7 +127348,7 @@ const shouldExcludeChallengeCommentCids = async (communityChallenge, challengeRe
127360
127348
  } catch (e) {
127361
127349
  throw e;
127362
127350
  } finally {
127363
- getCommentPending[pendingKey] = false;
127351
+ delete getCommentPending[pendingKey];
127364
127352
  }
127365
127353
  };
127366
127354
  const validateComment = async (commentCid, addressesSet, exclude) => {