@pkcprotocol/pkc-js 0.0.88 → 0.0.90

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 (58) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/clients/base-client-manager.js +9 -1
  3. package/dist/browser/clients/base-client-manager.js.map +1 -1
  4. package/dist/browser/generated-version.d.ts +1 -1
  5. package/dist/browser/generated-version.js +1 -1
  6. package/dist/browser/helia/helia-for-pkc.d.ts +2 -0
  7. package/dist/browser/helia/helia-for-pkc.js +231 -67
  8. package/dist/browser/helia/helia-for-pkc.js.map +1 -1
  9. package/dist/browser/helia/libp2pjsClient.d.ts +1 -1
  10. package/dist/browser/helia/lru-blockstore.d.ts +9 -8
  11. package/dist/browser/helia/lru-blockstore.js.map +1 -1
  12. package/dist/browser/helia/types.d.ts +10 -10
  13. package/dist/browser/helia/util.d.ts +6 -0
  14. package/dist/browser/helia/util.js +39 -0
  15. package/dist/browser/helia/util.js.map +1 -1
  16. package/dist/browser/rpc/src/schema.d.ts +148 -22
  17. package/dist/browser/runtime/node/community/local-community/cleanup.js +31 -1
  18. package/dist/browser/runtime/node/community/local-community/cleanup.js.map +1 -1
  19. package/dist/browser/schema.d.ts +8 -6
  20. package/dist/browser/schema.js +8 -1
  21. package/dist/browser/schema.js.map +1 -1
  22. package/dist/browser/test/test-util.js +3 -1
  23. package/dist/browser/test/test-util.js.map +1 -1
  24. package/dist/bundled/bundle-manifest.json +163 -142
  25. package/dist/bundled/chunks/{helia-for-pkc-CgG0H5g2.js → helia-for-pkc-CnQ8VxGw.js} +92 -41
  26. package/dist/bundled/chunks/{local-community-6_MVz1cc.js → local-community-CfRLoFS9.js} +32 -3
  27. package/dist/bundled/chunks/{local-community-rFE0QOdJ.js → local-community-Ctkg7wpX.js} +1 -1
  28. package/dist/bundled/chunks/{node-BjSTVzbx.js → node-cD0dEbJR.js} +5 -5
  29. package/dist/bundled/chunks/{rpc-local-community-Bu6Wp-tO.js → rpc-local-community-OsSRSfpT.js} +433 -7
  30. package/dist/bundled/chunks/{schema-By3Sh-uW.js → schema-YCcI2X94.js} +3 -3
  31. package/dist/bundled/chunks/{src-WLgFbUwZ.js → src-629pKfxo.js} +2731 -415
  32. package/dist/bundled/chunks/{src-B2CwDTfy.js → src-Dz9wtvrK.js} +18 -18
  33. package/dist/bundled/chunks/{util-BxLdjyTF.js → util-DDB5WFK9.js} +19 -2
  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 +9 -1
  37. package/dist/node/clients/base-client-manager.js.map +1 -1
  38. package/dist/node/generated-version.d.ts +1 -1
  39. package/dist/node/generated-version.js +1 -1
  40. package/dist/node/helia/helia-for-pkc.d.ts +2 -0
  41. package/dist/node/helia/helia-for-pkc.js +231 -67
  42. package/dist/node/helia/helia-for-pkc.js.map +1 -1
  43. package/dist/node/helia/libp2pjsClient.d.ts +1 -1
  44. package/dist/node/helia/lru-blockstore.d.ts +9 -8
  45. package/dist/node/helia/lru-blockstore.js.map +1 -1
  46. package/dist/node/helia/types.d.ts +10 -10
  47. package/dist/node/helia/util.d.ts +6 -0
  48. package/dist/node/helia/util.js +39 -0
  49. package/dist/node/helia/util.js.map +1 -1
  50. package/dist/node/rpc/src/schema.d.ts +148 -22
  51. package/dist/node/runtime/node/community/local-community/cleanup.js +31 -1
  52. package/dist/node/runtime/node/community/local-community/cleanup.js.map +1 -1
  53. package/dist/node/schema.d.ts +8 -6
  54. package/dist/node/schema.js +8 -1
  55. package/dist/node/schema.js.map +1 -1
  56. package/dist/node/test/test-util.js +3 -1
  57. package/dist/node/test/test-util.js.map +1 -1
  58. package/package.json +17 -16
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, Sr as logger_default, br as PKCError } from "./schema-By3Sh-uW.js";
3
- import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-BxLdjyTF.js";
2
+ import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, Sr as logger_default, br as PKCError } from "./schema-YCcI2X94.js";
3
+ import { a as fetchBlockWithStalledSessionFailover, c as selectBitswapSessionSeedPeers, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as readFreshCachedIpnsRecordFromPubsubLocalStore } from "./util-DDB5WFK9.js";
4
4
  import { t as map } from "./src-Cpx2Sts8.js";
5
5
  import { t as parallelBatch } from "./src-DKntVmyX.js";
6
6
  import { fileURLToPath } from "node:url";
@@ -12,24 +12,25 @@ import { peerIdFromString } from "@libp2p/peer-id";
12
12
  import * as Digest from "multiformats/hashes/digest";
13
13
  import { base32, base32upper } from "multiformats/bases/base32";
14
14
  import { EventEmitter as EventEmitter$1 } from "events";
15
- import { createHelia, libp2pDefaults } from "helia";
16
- import { ipns } from "@helia/ipns";
17
- import { multihashToIPNSRoutingKey, unmarshalIPNSRecord } from "ipns";
18
15
  import { ipnsValidator } from "ipns/validator";
16
+ import { multihashToIPNSRoutingKey, unmarshalIPNSRecord } from "ipns";
17
+ import { createHeliaLight } from "helia";
18
+ import { libp2pDefaults, withLibp2p } from "@helia/libp2p";
19
+ import { withBitswap } from "@helia/bitswap";
20
+ import { ipns, pubSubIPNSRouting } from "@helia/ipns";
19
21
  import { gossipsub } from "@libp2p/gossipsub";
20
22
  import { identify } from "@libp2p/identify";
21
- import { bitswap } from "@helia/block-brokers";
23
+ import { sha512 } from "multiformats/hashes/sha2";
22
24
  import { MemoryBlockstore } from "blockstore-core";
23
25
  import * as raw from "multiformats/codecs/raw";
24
26
  import { delegatedRoutingV1HttpApiClientContentRouting } from "@helia/delegated-routing-v1-http-api-client";
25
27
  import { NotFoundError } from "@libp2p/interface";
26
28
  import { unixfs } from "@helia/unixfs";
27
29
  import { fetch } from "@libp2p/fetch";
28
- import { pubsub } from "@helia/ipns/routing";
29
30
  //#region dist/node/runtime/node/libp2p-extra-transports.js
30
31
  const extraLibp2pTransports = [];
31
32
  //#endregion
32
- //#region node_modules/blockstore-fs/node_modules/interface-store/dist/src/errors.js
33
+ //#region node_modules/interface-store/dist/src/errors.js
33
34
  var OpenFailedError = class OpenFailedError extends Error {
34
35
  static name = "OpenFailedError";
35
36
  name = OpenFailedError.name;
@@ -5916,27 +5917,22 @@ async function* glob(dir, pattern, options = {}) {
5916
5917
  function defaultTranslate(signal) {
5917
5918
  return signal.reason;
5918
5919
  }
5919
- /**
5920
- * Race a promise against an abort signal
5921
- */
5922
- async function raceSignal(promise, signal, opts) {
5923
- if (signal == null) return promise;
5920
+ function raceSignal(promise, signal, opts) {
5921
+ if (signal == null || promise == null) return promise;
5924
5922
  const translateError = opts?.translateError ?? defaultTranslate;
5925
5923
  if (signal.aborted) {
5926
5924
  promise.catch(() => {});
5927
5925
  return Promise.reject(translateError(signal));
5928
5926
  }
5929
5927
  let listener;
5930
- try {
5931
- return await Promise.race([promise, new Promise((resolve, reject) => {
5932
- listener = () => {
5933
- reject(translateError(signal));
5934
- };
5935
- signal.addEventListener("abort", listener);
5936
- })]);
5937
- } finally {
5928
+ return Promise.race([promise, new Promise((resolve, reject) => {
5929
+ listener = () => {
5930
+ reject(translateError(signal));
5931
+ };
5932
+ signal.addEventListener("abort", listener);
5933
+ })]).finally(() => {
5938
5934
  if (listener != null) signal.removeEventListener("abort", listener);
5939
- }
5935
+ });
5940
5936
  }
5941
5937
  //#endregion
5942
5938
  //#region node_modules/steno/lib/index.js
@@ -6497,6 +6493,12 @@ function getDelegatedRoutingFields(routers) {
6497
6493
  }
6498
6494
  return routersObj;
6499
6495
  }
6496
+ function ipnsRouterTag(router) {
6497
+ return String(router);
6498
+ }
6499
+ function isLocalStoreIpnsRouter(router) {
6500
+ return ipnsRouterTag(router) === "LocalStoreRouting()";
6501
+ }
6500
6502
  async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6501
6503
  if (!pkcOptions.httpRoutersOptions?.length) throw Error("You need to have pkc.httpRouterOptions to set up helia");
6502
6504
  const existingClient = libp2pJsClients[pkcOptions.key];
@@ -6510,9 +6512,10 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6510
6512
  client.countOfUsesOfInstance++;
6511
6513
  return client;
6512
6514
  }
6515
+ let startedHelia;
6516
+ let closeBlockstore = async () => {};
6513
6517
  creatingLibp2pJsClients[pkcOptions.key] = (async () => {
6514
6518
  let lruBlockstore;
6515
- let closeBlockstore = async () => {};
6516
6519
  if (!pkcOptions.heliaOptions?.blockstore) {
6517
6520
  const { blockstore: childBlockstore, persistent, defaultMaxBytes, close } = await createBlockstoreForLibp2pJsClient({
6518
6521
  dataPath: pkcOptions.dataPath,
@@ -6542,12 +6545,17 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6542
6545
  }
6543
6546
  },
6544
6547
  blockstore: lruBlockstore,
6545
- blockBrokers: [bitswap()],
6546
- start: false,
6547
6548
  ...pkcOptions.heliaOptions
6548
6549
  };
6549
- const helia = await createHelia(mergedHeliaInit);
6550
- helia.routing.routers = helia.routing.routers.filter((r) => r.constructor.name !== "HTTPGatewayRouter");
6550
+ const { libp2p: mergedLibp2pInit, bitswap: bitswapInit, blockBrokers: callerBlockBrokers, ...heliaLightInit } = mergedHeliaInit;
6551
+ const heliaWithLibp2p = withLibp2p(createHeliaLight({
6552
+ ...heliaLightInit,
6553
+ blockBrokers: callerBlockBrokers,
6554
+ hashers: [sha512, ...heliaLightInit.hashers ?? []]
6555
+ }), mergedLibp2pInit ?? {});
6556
+ const helia = callerBlockBrokers === void 0 ? withBitswap(heliaWithLibp2p, bitswapInit) : heliaWithLibp2p;
6557
+ startedHelia = helia;
6558
+ await helia.start();
6551
6559
  log("Initialized libp2pjs helia with key", pkcOptions.key, "peer id", helia.libp2p.peerId.toString());
6552
6560
  const pubsubEventHandler = new EventEmitter$1();
6553
6561
  helia.libp2p.services.pubsub.addEventListener("message", (evt) => {
@@ -6560,10 +6568,6 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6560
6568
  pubsubEventHandler.emit(evt.detail.topic, msgFormatted);
6561
6569
  });
6562
6570
  const heliaFs = unixfs(helia);
6563
- const asHeliaCatCid = (ipfsPathOrCid) => {
6564
- CID.parse(ipfsPathOrCid.split("/")[0]);
6565
- return ipfsPathOrCid;
6566
- };
6567
6571
  const MAX_BITSWAP_SESSION_SEED_PEERS = 3;
6568
6572
  const getBitswapSessionSeedPeers = (scopeIpnsPubsubTopic) => {
6569
6573
  const pubsub = helia.libp2p.services.pubsub;
@@ -6616,10 +6620,14 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6616
6620
  }, ms);
6617
6621
  signal.addEventListener("abort", onAbort, { once: true });
6618
6622
  });
6619
- const ipnsPubsubRouter = pubsub(helia);
6620
- const ipnsPubsubLocalStore = ipnsPubsubRouter.localStore;
6623
+ const ipnsPubsubRouter = pubSubIPNSRouting(helia);
6621
6624
  const ipnsNameResolver = ipns(helia, { routers: [ipnsPubsubRouter] });
6622
- ipnsNameResolver.routers = ipnsNameResolver.routers.filter((r) => r?.constructor?.name !== "LocalStoreRouting");
6625
+ for (let i = ipnsNameResolver.routers.length - 1; i >= 0; i--) if (isLocalStoreIpnsRouter(ipnsNameResolver.routers[i])) ipnsNameResolver.routers.splice(i, 1);
6626
+ ipnsNameResolver.start?.();
6627
+ await ipnsPubsubRouter.start?.();
6628
+ const ipnsPubsubLocalStore = ipnsPubsubRouter.localStore;
6629
+ const ipnsPubsubRouterSubscriptions = ipnsPubsubRouter.subscriptions;
6630
+ const ipnsRecordNetworkValidatedAtMs = /* @__PURE__ */ new Map();
6623
6631
  const WARMUP_MAX_PEERS = 4;
6624
6632
  const warmupPromisesByTopic = /* @__PURE__ */ new Map();
6625
6633
  const warmupForTopic = (topic, options) => {
@@ -6654,9 +6662,24 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6654
6662
  log.trace("Resolving ipns name", currentName, "with options", options);
6655
6663
  const ipnsPubsubTopic = ipnsNameToIpnsOverPubsubTopic(ipnsNameAsPeerId.toString());
6656
6664
  const routingKey = multihashToIPNSRoutingKey(ipnsNameAsPeerId.toMultihash());
6665
+ if (options?.nocache !== true && helia.libp2p.services.pubsub.getTopics().includes(ipnsPubsubTopic)) try {
6666
+ const cachedRecord = await readFreshCachedIpnsRecordFromPubsubLocalStore({
6667
+ localStore: ipnsPubsubLocalStore,
6668
+ routingKey,
6669
+ lastNetworkValidatedAtMs: ipnsRecordNetworkValidatedAtMs.get(ipnsPubsubTopic)
6670
+ });
6671
+ if (cachedRecord) {
6672
+ log.trace("Serving IPNS record for", currentName, "from the routing-layer cache");
6673
+ yield cachedRecord.value;
6674
+ return;
6675
+ }
6676
+ } catch (cacheErr) {
6677
+ log.trace("Reading the cached IPNS record for", ipnsPubsubTopic, "failed, falling through to the network", cacheErr);
6678
+ }
6657
6679
  let directFetchOutcome = { attempted: false };
6658
6680
  {
6659
6681
  if (!helia.libp2p.services.pubsub.getTopics().includes(ipnsPubsubTopic)) helia.libp2p.services.pubsub.subscribe(ipnsPubsubTopic);
6682
+ ipnsPubsubRouterSubscriptions.add(ipnsPubsubTopic);
6660
6683
  warmupForTopic(ipnsPubsubTopic, options).catch((e) => log.trace("Fire-and-forget warmup failed for", ipnsPubsubTopic, e));
6661
6684
  const directStart = Date.now();
6662
6685
  try {
@@ -6678,6 +6701,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6678
6701
  peerId: direct.peerId
6679
6702
  };
6680
6703
  const record = unmarshalIPNSRecord(direct.recordBytes);
6704
+ ipnsRecordNetworkValidatedAtMs.set(ipnsPubsubTopic, Date.now());
6681
6705
  try {
6682
6706
  await cacheIpnsRecordInPubsubLocalStore({
6683
6707
  localStore: ipnsPubsubLocalStore,
@@ -6752,13 +6776,17 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6752
6776
  ...getHeliaDebugContext(helia)
6753
6777
  });
6754
6778
  await ipnsValidator(routingKey, recordBytes);
6755
- yield unmarshalIPNSRecord(recordBytes).value;
6779
+ const record = unmarshalIPNSRecord(recordBytes);
6780
+ ipnsRecordNetworkValidatedAtMs.set(ipnsPubsubTopic, Date.now());
6781
+ yield record.value;
6756
6782
  }
6757
6783
  return generator();
6758
6784
  } },
6759
6785
  cat(ipfsPath, options) {
6760
6786
  throwIfHeliaIsStoppingOrStopped();
6761
- const rootCid = CID.parse(ipfsPath.split("/")[0]);
6787
+ const [rootCidString, ...ipfsSubPathSegments] = ipfsPath.split("/");
6788
+ const rootCid = CID.parse(rootCidString);
6789
+ const ipfsSubPath = ipfsSubPathSegments.length > 0 ? ipfsSubPathSegments.join("/") : void 0;
6762
6790
  const timeoutMs = parseKuboStyleTimeoutMs(options?.timeout);
6763
6791
  const { bitswapSessionSeedScopeIpnsPubsubTopic, ...unixfsCatOptions } = options ?? {};
6764
6792
  return (async function* () {
@@ -6773,7 +6801,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6773
6801
  })), timeoutMs) : void 0;
6774
6802
  try {
6775
6803
  for (let attempt = 0;; attempt++) {
6776
- const session = helia.blockstore.createSession(rootCid, { providers: getBitswapSessionSeedPeers(bitswapSessionSeedScopeIpnsPubsubTopic) });
6804
+ const session = helia.blockstore.createSession(rootCid, { providers: getBitswapSessionSeedPeers(bitswapSessionSeedScopeIpnsPubsubTopic).map((peerId) => peerId.toCID()) });
6777
6805
  const sessionGet = session.get.bind(session);
6778
6806
  const fallbackGet = helia.blockstore.get.bind(helia.blockstore);
6779
6807
  session.get = (blockCid, blockGetOptions) => fetchBlockWithStalledSessionFailover({
@@ -6786,8 +6814,9 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6786
6814
  });
6787
6815
  let yieldedAnyBytes = false;
6788
6816
  try {
6789
- const catIterable = unixfs({ blockstore: session }).cat(asHeliaCatCid(ipfsPath), {
6817
+ const catIterable = unixfs({ blockstore: session }).cat(rootCid, {
6790
6818
  ...unixfsCatOptions,
6819
+ path: ipfsSubPath,
6791
6820
  signal: controller.signal
6792
6821
  });
6793
6822
  for await (const chunk of catIterable) {
@@ -6859,7 +6888,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6859
6888
  if (typeof lifecycle.stop === "function") try {
6860
6889
  await lifecycle.stop();
6861
6890
  } catch (e) {
6862
- log.error("Error stopping IPNS router", router?.constructor?.name, e);
6891
+ log.error("Error stopping IPNS router", ipnsRouterTag(router), e);
6863
6892
  }
6864
6893
  }
6865
6894
  for (const topic of helia.libp2p.services.pubsub.getTopics()) helia.libp2p.services.pubsub.unsubscribe(topic);
@@ -6898,11 +6927,33 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6898
6927
  libp2pJsClientsOptions: pkcOptions,
6899
6928
  key: pkcOptions.key
6900
6929
  });
6901
- await helia.start();
6902
6930
  log("Helia/libp2p-js started with key", pkcOptions.key, "and peer id", helia.libp2p.peerId.toString());
6903
6931
  libp2pJsClients[pkcOptions.key] = client;
6904
6932
  return client;
6905
- })();
6933
+ })().catch(async (creationError) => {
6934
+ if (startedHelia) {
6935
+ let connections = [];
6936
+ try {
6937
+ connections = startedHelia.libp2p.getConnections();
6938
+ } catch {}
6939
+ for (const connection of connections) try {
6940
+ connection.abort(/* @__PURE__ */ new Error("pkc-js libp2p instance failed to initialize"));
6941
+ } catch (e) {
6942
+ log.error("Error aborting libp2p connection during failed initialization", e);
6943
+ }
6944
+ try {
6945
+ await startedHelia.stop();
6946
+ } catch (e) {
6947
+ log.error("Error stopping helia after failed initialization", e);
6948
+ }
6949
+ }
6950
+ try {
6951
+ await closeBlockstore();
6952
+ } catch (e) {
6953
+ log.error("Error closing blockstore after failed initialization", e);
6954
+ }
6955
+ throw creationError;
6956
+ });
6906
6957
  const createdClientPromise = creatingLibp2pJsClients[pkcOptions.key];
6907
6958
  if (!createdClientPromise) throw new Error("Missing creation promise after initialization");
6908
6959
  try {
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $n as n$4, Bn as CommentEditReservedFields, C as contentContainsMarkdownAudio, Ct as findStartedCommunity, F as getIpnsRecordInLocalKuboNode, Fr as ZodError, Ft as untrackStartedCommunity, G as isLinkOfAudio, Hn as CommentEditsTableRowSchema, Ht as CommunityEditPublicationPubsubReservedFields, J as isLinkOfVideo, Jt as CommentModerationReservedFields, K as isLinkOfImage, Kn as AuthorReservedFields, L as hideClassPrivateProps, Lt as untrackUpdatingCommunity, M as genToArray, Mn as CommentsTableRowSchema, Mt as trackStartedCommunity, N as getEquivalentCommunityAddresses, O as derivePublicationFromChallengeRequest, P as getErrorCodeFromMessage, Pt as trackUpdatingCommunity, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditPubsubMessagePublicationSchema, Rt as require_sha256, S as calculateStringSizeSameAsIpfsAddCidV0, Sn as CommentPubsubMessageReservedFields, Sr as logger_default, St as findCommunityInRegistry, T as contentContainsMarkdownVideos, Tt as findUpdatingCommunity, W as isLinkOfAnimatedImage, Xt as CommentModerationsTableRowSchema, Y as isLinkValid, _t as statMfsPathSafely, a as ChallengeRequestMessageSchema, an as CommunityIpfsSchema, ar as e$1, at as removeMfsFilesSafely, b as areEquivalentCommunityAddresses, br as PKCError, cr as t$4, d as DecryptedChallengeRequestSchema, dr as t$5, dt as retryKuboBlockPutPinAndProvidePubsubTopic, er as t$8, fr as t$3, gn as VotePubsubReservedFields, gt as sleepUntilTimeoutOrAbort, hn as VotePubsubMessagePublicationSchema, ir as e, it as removeBlocksFromKuboNode, jn as CommentUpdateTableRowSchema, jt as syncCommunityRegistryEntry, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, mr as require_retry, nr as t$7, on as CommunitySignedPropertyNames, pt as retryKuboIpfsAddAndProvide, q as isLinkOfMedia, qt as CommentModerationPubsubMessagePublicationSchema, r as ChallengeMessageSchema, rr as t$6, s as ChallengeVerificationMessageSchema, sr as r$1, st as removeNullUndefinedValues, t as ChallengeAnswerMessageSchema, tr as n$3, u as DecryptedChallengeRequestPublicationSchema, vn as VoteTablesRowSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, xt as writeKuboFilesWithTimeout, y as version_default, yt as timestamp, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-By3Sh-uW.js";
3
- import { $t as getPublicKeyFromPrivateKey, A as deriveDbPosts, At as verifyCommentIpfs, Bt as getAuthorNameFromWire, C as BackupAbortError, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Dt as verifyChallengeRequest, E as calculateInlineRepliesBudget, En as parseJsonWithPKCErrorIfFails, F as importSignerIntoKuboNode, Ft as verifyCommunityEdit, G as REPLY_REPLIES_SORT_TYPES, Gt as getCommunityPublicKeyFromWire, It as verifyVote, Jt as encode, K as TIMEFRAMES_TO_SECONDS, Lt as buildRuntimeAuthor, M as getDefaultCommunityDbConfig, Mt as verifyCommentPubsubMessage, Nt as verifyCommentUpdate, O as deleteOldCommunityInWindows, P as getThumbnailPropsOfLink, Pt as verifyCommunity, Qt as getPKCAddressFromPublicKeySync, R as moveCommunityDbToDeletedDirectory, Rt as cleanWireAuthor, S as encryptEd25519AesGcmPublicKeyBuffer, St as signCommunity, T as calculateExpectedSignatureSize, Tt as verifyChallengeAnswer, U as POSTS_SORT_TYPES, W as POST_REPLIES_SORT_TYPES, Wt as getCommunityNameFromWire, Xt as getIpfsKeyFromPrivateKey, Z as iterateOverPageCidsToFindAllCids, Zt as getPKCAddressFromPublicKey, _t as signComment, a as loadChallengeFileFromCommunityChallengeSettings, ar as t$11, b as decryptEd25519AesGcmPublicKeyBuffer, bt as signCommentUpdate, c as LRUCache, d as KeyvBetterSqlite3, dn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, dr as STORAGE_KEYS, en as createSchemaRowParser, er as crosspostChainDepthUpTo, fr as require_lodash_merge, ft as cleanUpBeforePublishing, g as SignerWithPublicKeyAddress, gt as signChallengeVerification, i as getCommunityChallengeFromCommunityChallengeSettings, ir as r$2, j as deriveDbReplies, jt as verifyCommentModeration, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommentEdit, lr as t$10, lt as pLimit, mt as signChallengeMessage, nr as t$9, o as pkcJsChallenges, or as n$6, pn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, qt as decode, r as getChallengeVerification, rr as t$12, s as TrackedInstanceRegistry, sr as n$5, t as RpcLocalCommunity, tr as effectiveMaxCrosspostDepth, u as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, ur as stringify, vt as signCommentEdit, w as backupCommunityDb, xt as signCommentUpdateForChallengeVerification, z as resolveDbPostsCidRefs } from "./rpc-local-community-Bu6Wp-tO.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$4, Bn as CommentEditReservedFields, C as contentContainsMarkdownAudio, Ct as findStartedCommunity, F as getIpnsRecordInLocalKuboNode, Fr as ZodError, Ft as untrackStartedCommunity, G as isLinkOfAudio, Hn as CommentEditsTableRowSchema, Ht as CommunityEditPublicationPubsubReservedFields, J as isLinkOfVideo, Jt as CommentModerationReservedFields, K as isLinkOfImage, Kn as AuthorReservedFields, L as hideClassPrivateProps, Lt as untrackUpdatingCommunity, M as genToArray, Mn as CommentsTableRowSchema, Mt as trackStartedCommunity, N as getEquivalentCommunityAddresses, O as derivePublicationFromChallengeRequest, P as getErrorCodeFromMessage, Pt as trackUpdatingCommunity, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditPubsubMessagePublicationSchema, Rt as require_sha256, S as calculateStringSizeSameAsIpfsAddCidV0, Sn as CommentPubsubMessageReservedFields, Sr as logger_default, St as findCommunityInRegistry, T as contentContainsMarkdownVideos, Tt as findUpdatingCommunity, W as isLinkOfAnimatedImage, Xt as CommentModerationsTableRowSchema, Y as isLinkValid, _t as statMfsPathSafely, a as ChallengeRequestMessageSchema, an as CommunityIpfsSchema, ar as e$1, at as removeMfsFilesSafely, b as areEquivalentCommunityAddresses, br as PKCError, cr as t$4, d as DecryptedChallengeRequestSchema, dr as t$5, dt as retryKuboBlockPutPinAndProvidePubsubTopic, er as t$8, fr as t$3, gn as VotePubsubReservedFields, gt as sleepUntilTimeoutOrAbort, hn as VotePubsubMessagePublicationSchema, ir as e, it as removeBlocksFromKuboNode, jn as CommentUpdateTableRowSchema, jt as syncCommunityRegistryEntry, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, mr as require_retry, nr as t$7, on as CommunitySignedPropertyNames, pt as retryKuboIpfsAddAndProvide, q as isLinkOfMedia, qt as CommentModerationPubsubMessagePublicationSchema, r as ChallengeMessageSchema, rr as t$6, s as ChallengeVerificationMessageSchema, sr as r$1, st as removeNullUndefinedValues, t as ChallengeAnswerMessageSchema, tr as n$3, u as DecryptedChallengeRequestPublicationSchema, vn as VoteTablesRowSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, xt as writeKuboFilesWithTimeout, y as version_default, yt as timestamp, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-YCcI2X94.js";
3
+ import { $t as getPublicKeyFromPrivateKey, A as deriveDbPosts, At as verifyCommentIpfs, Bt as getAuthorNameFromWire, C as BackupAbortError, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Dt as verifyChallengeRequest, E as calculateInlineRepliesBudget, En as parseJsonWithPKCErrorIfFails, F as importSignerIntoKuboNode, Ft as verifyCommunityEdit, G as REPLY_REPLIES_SORT_TYPES, Gt as getCommunityPublicKeyFromWire, It as verifyVote, Jt as encode, K as TIMEFRAMES_TO_SECONDS, Lt as buildRuntimeAuthor, M as getDefaultCommunityDbConfig, Mt as verifyCommentPubsubMessage, Nt as verifyCommentUpdate, O as deleteOldCommunityInWindows, P as getThumbnailPropsOfLink, Pt as verifyCommunity, Qt as getPKCAddressFromPublicKeySync, R as moveCommunityDbToDeletedDirectory, Rt as cleanWireAuthor, S as encryptEd25519AesGcmPublicKeyBuffer, St as signCommunity, T as calculateExpectedSignatureSize, Tt as verifyChallengeAnswer, U as POSTS_SORT_TYPES, W as POST_REPLIES_SORT_TYPES, Wt as getCommunityNameFromWire, Xt as getIpfsKeyFromPrivateKey, Z as iterateOverPageCidsToFindAllCids, Zt as getPKCAddressFromPublicKey, _t as signComment, a as loadChallengeFileFromCommunityChallengeSettings, ar as t$11, b as decryptEd25519AesGcmPublicKeyBuffer, bt as signCommentUpdate, c as LRUCache, d as KeyvBetterSqlite3, dn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, dr as STORAGE_KEYS, en as createSchemaRowParser, er as crosspostChainDepthUpTo, fr as require_lodash_merge, ft as cleanUpBeforePublishing, g as SignerWithPublicKeyAddress, gt as signChallengeVerification, i as getCommunityChallengeFromCommunityChallengeSettings, ir as r$2, j as deriveDbReplies, jt as verifyCommentModeration, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommentEdit, lr as t$10, lt as pLimit, mt as signChallengeMessage, nr as t$9, o as pkcJsChallenges, or as n$6, pn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, qt as decode, r as getChallengeVerification, rr as t$12, s as TrackedInstanceRegistry, sr as n$5, t as RpcLocalCommunity, tr as effectiveMaxCrosspostDepth, u as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, ur as stringify, vt as signCommentEdit, w as backupCommunityDb, xt as signCommentUpdateForChallengeVerification, z as resolveDbPostsCidRefs } from "./rpc-local-community-OsSRSfpT.js";
4
4
  import { randomFillSync, randomUUID } from "node:crypto";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
6
  import path from "node:path";
@@ -386,13 +386,42 @@ async function adjustPostUpdatesBucketsIfNeeded(community) {
386
386
  }
387
387
  //#endregion
388
388
  //#region dist/node/runtime/node/community/local-community/cleanup.js
389
+ var import_retry = /* @__PURE__ */ __toESM(require_retry(), 1);
390
+ async function _pinLsWithRetries({ kuboRpcClient, cid, log, inputNumOfRetries }) {
391
+ const numOfRetries = inputNumOfRetries ?? 3;
392
+ return new Promise((resolve, reject) => {
393
+ const operation = import_retry.operation({
394
+ retries: numOfRetries,
395
+ factor: 2,
396
+ minTimeout: 1e3
397
+ });
398
+ operation.attempt(async (currentAttempt) => {
399
+ try {
400
+ await genToArray(kuboRpcClient._client.pin.ls({ paths: cid }));
401
+ resolve();
402
+ } catch (error) {
403
+ if (error.message?.includes("is not pinned")) {
404
+ reject(error);
405
+ return;
406
+ }
407
+ log.error(`Failed attempt ${currentAttempt}/${numOfRetries + 1} to check whether ${cid} is pinned:`, error);
408
+ if (operation.retry(error)) return;
409
+ reject(operation.mainError() || error);
410
+ }
411
+ });
412
+ });
413
+ }
389
414
  async function repinCommentsIPFSIfNeeded(community) {
390
415
  const log = logger_default("pkc-js:local-community:start:_repinCommentsIPFSIfNeeded");
391
416
  const latestCommentCid = community._dbHandler.queryLatestCommentCid();
392
417
  if (!latestCommentCid) return;
393
418
  const kuboRpcOrHelia = community._clientsManager.getDefaultKuboRpcClient();
394
419
  try {
395
- await genToArray(kuboRpcOrHelia._client.pin.ls({ paths: latestCommentCid.cid }));
420
+ await _pinLsWithRetries({
421
+ kuboRpcClient: kuboRpcOrHelia,
422
+ cid: latestCommentCid.cid,
423
+ log
424
+ });
396
425
  return;
397
426
  } catch (e) {
398
427
  if (!e.message.includes("is not pinned")) throw e;
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-6_MVz1cc.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-CfRLoFS9.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 { $n as n$2, B as isIpfsCid, Bt as pTimeout, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dt as listUpdatingComments, E as createAbortError, En as CommentUpdateForChallengeVerificationSchema, Et as listStartedCommunities, H as isIpns, Ir as joinValues, It as untrackUpdatingComment, L as hideClassPrivateProps, Lr as parsedType, Nt as trackUpdatingComment, Ot as listUpdatingCommunities, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rr as stringifyPrimitive, Rt as require_sha256, Sr as logger_default, Tr as setErrorMap, Tt as findUpdatingCommunity, a as ChallengeRequestMessageSchema, an as CommunityIpfsSchema, ar as e$1, b as areEquivalentCommunityAddresses, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, ct as removeUndefinedValuesRecursively, dn as PubsubTopicSchema, en as CommunityAnchorSchema, ft as retryKuboIpfsAdd, gt as sleepUntilTimeoutOrAbort, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, ir as e, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kt as refreshTrackedCommentAliases, lt as replaceXWithY, mr as require_retry, mt as shortifyAddress, nt as rejectWhenAbortSignalFires, r as ChallengeMessageSchema, rr as t$1, rt as rejectWhenCommunityStopsOrAborts, s as ChallengeVerificationMessageSchema, sr as r, t as ChallengeAnswerMessageSchema, tr as n$1, ut as resolveWhenPredicateIsTrue, vt as throwIfAbortSignalAborted, wt as findUpdatingComment, xn as CommentIpfsSchema, xr as messages, y as version_default, yt as timestamp, z as isAbortError, zt as TimeoutError } from "./schema-By3Sh-uW.js";
3
- import { $ as RepliesPages, $n as RpcUnsubscribeParamSchema, An as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, At as verifyCommentIpfs, B as setNativeFunctions$1, Bn as RpcEditCommunityParamSchema, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Ct as signCommunityEdit, D as createKuboRpcClient, Dn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, En as parseJsonWithPKCErrorIfFails, Et as verifyChallengeMessage, Fn as RpcCancelExportParamSchema, Ft as verifyCommunityEdit, Gn as RpcFetchCidParamSchema, Gt as getCommunityPublicKeyFromWire, H as CommentClientsManager, Hn as RpcExportCommunityModLogsResultSchema, Ht as buildRuntimeCommunityFields, I as listCommunitiesSync, In as RpcCidParamSchema, It as verifyVote, Jn as RpcPublishChallengeAnswersParamSchema, Kn as RpcFetchCidResultSchema, Kt as normalizeCommunityInputFromCommunity, L as monitorCommunitiesDirectory, Ln as RpcCommentRepliesPageParamSchema, Lt as buildRuntimeAuthor, Mn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Mt as verifyCommentPubsubMessage, N as getDefaultDataPath, Nn as RpcAnchorPublishPreparationResultSchema, Nt as verifyCommentUpdate, On as parseRpcCommentEventWithPKCErrorIfItFails, Ot as verifyChallengeVerification, Pn as RpcAuthorNameParamSchema, Q as parseRawPages, Qn as RpcSuccessResultSchema, Qt as getPKCAddressFromPublicKeySync, Rn as RpcCommunityIdentifierParamSchema, Rt as cleanWireAuthor, Sn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, Tn as parseDecryptedChallengeWithPKCErrorIfItFails, Un as RpcExportCommunityParamSchema, Ut as getCommunityAddressFromRecord, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcExportCommunityModLogsParamSchema, Vt as normalizeCreatePublicationAuthor, Wn as RpcExportCommunityResultSchema, Wt as getCommunityNameFromWire, X as findCommentInPageInstanceRecursively, Xn as RpcResolveAuthorNameResultSchema, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as RpcPublishedAnchorRecordResultSchema, Yt as getBufferedPKCAddressFromPublicKey, Zn as RpcSubscriptionIdResultSchema, _ as createSigner, _n as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, _t as signComment, an as parseCommentIpfsSchemaWithPKCErrorIfItFails, ar as t$3, at as PublicationClientsManager, bn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, c as LRUCache, cn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, cr as t$2, d as KeyvBetterSqlite3, dt as require_lib$1, et as applyNameResolvedCacheToCrosspost, f as decodeRpcChallengeAnswerPubsubMsg, fn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ft as cleanUpBeforePublishing, gn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeVerificationPubsubMsg, hn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ht as signChallengeRequest, in as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, it as stripNameResolvedFromCrosspost, jt as verifyCommentModeration, kn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, kt as verifyCommentEdit, l as RemoteCommunity, ln as parseCommunityAddressWithPKCErrorIfItFails, lr as t$5, m as decodeRpcChallengeRequestPubsubMsg, mn as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, mr as require_undici, n as RpcRemoteCommunity, nr as t$4, nt as collectCrosspostAuthorsToResolve, o as pkcJsChallenges, or as n$3, ot as PKCClientsManager, p as decodeRpcChallengePubsubMsg, pr as nativeFunctions$2, pt as signChallengeAnswer, qn as RpcPublishAnchorRecordParamSchema, qt as decode, s as TrackedInstanceRegistry, sn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as InflightFetchManager, t as RpcLocalCommunity, tn as parseCidStringSchemaWithPKCErrorIfItFails, tt as cloneCrosspostForRuntime, ut as PKCTypedEmitter, v as createAnchorIpnsRecord$1, vt as signCommentEdit, wn as parseDecryptedChallengeVerification, wt as signVote, x as encryptEd25519AesGcm, xn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as decryptEd25519AesGcm, yt as signCommentModeration, zn as RpcCommunityPageParamSchema, zt as getAuthorNameFromRuntime } from "./rpc-local-community-Bu6Wp-tO.js";
4
- import { o as getHeliaDebugContext } from "./util-BxLdjyTF.js";
2
+ import { $n as n$2, B as isIpfsCid, Bt as pTimeout, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dt as listUpdatingComments, E as createAbortError, En as CommentUpdateForChallengeVerificationSchema, Et as listStartedCommunities, H as isIpns, Ir as joinValues, It as untrackUpdatingComment, L as hideClassPrivateProps, Lr as parsedType, Nt as trackUpdatingComment, Ot as listUpdatingCommunities, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rr as stringifyPrimitive, Rt as require_sha256, Sr as logger_default, Tr as setErrorMap, Tt as findUpdatingCommunity, a as ChallengeRequestMessageSchema, an as CommunityIpfsSchema, ar as e$1, b as areEquivalentCommunityAddresses, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, ct as removeUndefinedValuesRecursively, dn as PubsubTopicSchema, en as CommunityAnchorSchema, ft as retryKuboIpfsAdd, gt as sleepUntilTimeoutOrAbort, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, ir as e, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kt as refreshTrackedCommentAliases, lt as replaceXWithY, mr as require_retry, mt as shortifyAddress, nt as rejectWhenAbortSignalFires, r as ChallengeMessageSchema, rr as t$1, rt as rejectWhenCommunityStopsOrAborts, s as ChallengeVerificationMessageSchema, sr as r, t as ChallengeAnswerMessageSchema, tr as n$1, ut as resolveWhenPredicateIsTrue, vt as throwIfAbortSignalAborted, wt as findUpdatingComment, xn as CommentIpfsSchema, xr as messages, y as version_default, yt as timestamp, z as isAbortError, zt as TimeoutError } from "./schema-YCcI2X94.js";
3
+ import { $ as RepliesPages, $n as RpcUnsubscribeParamSchema, An as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, At as verifyCommentIpfs, B as setNativeFunctions$1, Bn as RpcEditCommunityParamSchema, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Ct as signCommunityEdit, D as createKuboRpcClient, Dn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, En as parseJsonWithPKCErrorIfFails, Et as verifyChallengeMessage, Fn as RpcCancelExportParamSchema, Ft as verifyCommunityEdit, Gn as RpcFetchCidParamSchema, Gt as getCommunityPublicKeyFromWire, H as CommentClientsManager, Hn as RpcExportCommunityModLogsResultSchema, Ht as buildRuntimeCommunityFields, I as listCommunitiesSync, In as RpcCidParamSchema, It as verifyVote, Jn as RpcPublishChallengeAnswersParamSchema, Kn as RpcFetchCidResultSchema, Kt as normalizeCommunityInputFromCommunity, L as monitorCommunitiesDirectory, Ln as RpcCommentRepliesPageParamSchema, Lt as buildRuntimeAuthor, Mn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Mt as verifyCommentPubsubMessage, N as getDefaultDataPath, Nn as RpcAnchorPublishPreparationResultSchema, Nt as verifyCommentUpdate, On as parseRpcCommentEventWithPKCErrorIfItFails, Ot as verifyChallengeVerification, Pn as RpcAuthorNameParamSchema, Q as parseRawPages, Qn as RpcSuccessResultSchema, Qt as getPKCAddressFromPublicKeySync, Rn as RpcCommunityIdentifierParamSchema, Rt as cleanWireAuthor, Sn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, Tn as parseDecryptedChallengeWithPKCErrorIfItFails, Un as RpcExportCommunityParamSchema, Ut as getCommunityAddressFromRecord, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcExportCommunityModLogsParamSchema, Vt as normalizeCreatePublicationAuthor, Wn as RpcExportCommunityResultSchema, Wt as getCommunityNameFromWire, X as findCommentInPageInstanceRecursively, Xn as RpcResolveAuthorNameResultSchema, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as RpcPublishedAnchorRecordResultSchema, Yt as getBufferedPKCAddressFromPublicKey, Zn as RpcSubscriptionIdResultSchema, _ as createSigner, _n as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, _t as signComment, an as parseCommentIpfsSchemaWithPKCErrorIfItFails, ar as t$3, at as PublicationClientsManager, bn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, c as LRUCache, cn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, cr as t$2, d as KeyvBetterSqlite3, dt as require_lib$1, et as applyNameResolvedCacheToCrosspost, f as decodeRpcChallengeAnswerPubsubMsg, fn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ft as cleanUpBeforePublishing, gn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeVerificationPubsubMsg, hn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ht as signChallengeRequest, in as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, it as stripNameResolvedFromCrosspost, jt as verifyCommentModeration, kn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, kt as verifyCommentEdit, l as RemoteCommunity, ln as parseCommunityAddressWithPKCErrorIfItFails, lr as t$5, m as decodeRpcChallengeRequestPubsubMsg, mn as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, mr as require_undici, n as RpcRemoteCommunity, nr as t$4, nt as collectCrosspostAuthorsToResolve, o as pkcJsChallenges, or as n$3, ot as PKCClientsManager, p as decodeRpcChallengePubsubMsg, pr as nativeFunctions$2, pt as signChallengeAnswer, qn as RpcPublishAnchorRecordParamSchema, qt as decode, s as TrackedInstanceRegistry, sn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as InflightFetchManager, t as RpcLocalCommunity, tn as parseCidStringSchemaWithPKCErrorIfItFails, tt as cloneCrosspostForRuntime, ut as PKCTypedEmitter, v as createAnchorIpnsRecord$1, vt as signCommentEdit, wn as parseDecryptedChallengeVerification, wt as signVote, x as encryptEd25519AesGcm, xn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as decryptEd25519AesGcm, yt as signCommentModeration, zn as RpcCommunityPageParamSchema, zt as getAuthorNameFromRuntime } from "./rpc-local-community-OsSRSfpT.js";
4
+ import { o as getHeliaDebugContext } from "./util-DDB5WFK9.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -6948,7 +6948,7 @@ var PKC$1 = class extends PKCTypedEmitter {
6948
6948
  this.clients.libp2pJsClients = {};
6949
6949
  if (!this.libp2pJsClientsOptions) return;
6950
6950
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
6951
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CgG0H5g2.js");
6951
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CnQ8VxGw.js");
6952
6952
  for (const clientOptions of this.libp2pJsClientsOptions) {
6953
6953
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
6954
6954
  ...clientOptions,
@@ -7227,7 +7227,7 @@ var PKC$1 = class extends PKCTypedEmitter {
7227
7227
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
7228
7228
  log.trace("Received community options to create a local community instance:", options);
7229
7229
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
7230
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-rFE0QOdJ.js");
7230
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-Ctkg7wpX.js");
7231
7231
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
7232
7232
  const community = new LocalCommunity(this);
7233
7233
  if (isLocalCommunity) {