@pkcprotocol/pkc-js 0.0.64 → 0.0.65

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 (35) hide show
  1. package/dist/browser/errors.d.ts +1 -0
  2. package/dist/browser/errors.js +1 -0
  3. package/dist/browser/errors.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.js +52 -6
  7. package/dist/browser/helia/helia-for-pkc.js.map +1 -1
  8. package/dist/browser/helia/types.d.ts +2 -0
  9. package/dist/browser/helia/util.d.ts +18 -0
  10. package/dist/browser/helia/util.js +123 -0
  11. package/dist/browser/helia/util.js.map +1 -1
  12. package/dist/browser/pkc-error.d.ts +1 -1
  13. package/dist/bundled/bundle-manifest.json +25 -25
  14. package/dist/bundled/chunks/{helia-for-pkc-CYDRSysz.js → helia-for-pkc-h-rjuHh7.js} +46 -3
  15. package/dist/bundled/chunks/{local-community-DYvRQWsK.js → local-community-DEWf2apw.js} +26 -26
  16. package/dist/bundled/chunks/{local-community-DyaGG6lj.js → local-community-DdDpaZqk.js} +1 -1
  17. package/dist/bundled/chunks/{node-DadVit9c.js → node-CrnvA79m.js} +5 -5
  18. package/dist/bundled/chunks/{rpc-local-community-1Uvl5iwp.js → rpc-local-community-CpN6R3ZN.js} +17 -17
  19. package/dist/bundled/chunks/{schema-Dtvt2tQ8.js → schema-Db4geGeo.js} +2 -1
  20. package/dist/bundled/chunks/{util-CjfTxkQ8.js → util-DrHyKxFe.js} +98 -2
  21. package/dist/bundled/index.js +1 -1
  22. package/dist/bundled/rpc/src/index.js +4 -4
  23. package/dist/node/errors.d.ts +1 -0
  24. package/dist/node/errors.js +1 -0
  25. package/dist/node/errors.js.map +1 -1
  26. package/dist/node/generated-version.d.ts +1 -1
  27. package/dist/node/generated-version.js +1 -1
  28. package/dist/node/helia/helia-for-pkc.js +52 -6
  29. package/dist/node/helia/helia-for-pkc.js.map +1 -1
  30. package/dist/node/helia/types.d.ts +2 -0
  31. package/dist/node/helia/util.d.ts +18 -0
  32. package/dist/node/helia/util.js +123 -0
  33. package/dist/node/helia/util.js.map +1 -1
  34. package/dist/node/pkc-error.d.ts +1 -1
  35. package/package.json +1 -1
@@ -14,7 +14,7 @@
14
14
  "node:module"
15
15
  ],
16
16
  "dynamicImports": [
17
- "chunks/node-DadVit9c.js"
17
+ "chunks/node-CrnvA79m.js"
18
18
  ],
19
19
  "inputs": [
20
20
  "dist/node/runtime/node/compile-cache.js",
@@ -24,7 +24,7 @@
24
24
  "index.js": {
25
25
  "isEntry": true,
26
26
  "imports": [
27
- "chunks/node-DadVit9c.js"
27
+ "chunks/node-CrnvA79m.js"
28
28
  ],
29
29
  "dynamicImports": [],
30
30
  "inputs": []
@@ -32,10 +32,10 @@
32
32
  "rpc/src/index.js": {
33
33
  "isEntry": true,
34
34
  "imports": [
35
- "chunks/rpc-local-community-1Uvl5iwp.js",
36
- "chunks/node-DadVit9c.js",
37
- "chunks/schema-Dtvt2tQ8.js",
38
- "chunks/local-community-DYvRQWsK.js",
35
+ "chunks/rpc-local-community-CpN6R3ZN.js",
36
+ "chunks/node-CrnvA79m.js",
37
+ "chunks/schema-Db4geGeo.js",
38
+ "chunks/local-community-DEWf2apw.js",
39
39
  "node:url",
40
40
  "path",
41
41
  "assert",
@@ -64,11 +64,11 @@
64
64
  "\u0000rolldown/runtime.js"
65
65
  ]
66
66
  },
67
- "chunks/helia-for-pkc-CYDRSysz.js": {
67
+ "chunks/helia-for-pkc-h-rjuHh7.js": {
68
68
  "isEntry": false,
69
69
  "imports": [
70
- "chunks/schema-Dtvt2tQ8.js",
71
- "chunks/util-CjfTxkQ8.js",
70
+ "chunks/schema-Db4geGeo.js",
71
+ "chunks/util-DrHyKxFe.js",
72
72
  "multiformats/cid",
73
73
  "@libp2p/peer-id",
74
74
  "events",
@@ -94,12 +94,12 @@
94
94
  "dist/node/helia/helia-for-pkc.js"
95
95
  ]
96
96
  },
97
- "chunks/local-community-DYvRQWsK.js": {
97
+ "chunks/local-community-DEWf2apw.js": {
98
98
  "isEntry": false,
99
99
  "imports": [
100
100
  "chunks/chunk-2rV9d50f.js",
101
- "chunks/rpc-local-community-1Uvl5iwp.js",
102
- "chunks/schema-Dtvt2tQ8.js",
101
+ "chunks/rpc-local-community-CpN6R3ZN.js",
102
+ "chunks/schema-Db4geGeo.js",
103
103
  "node:crypto",
104
104
  "node:url",
105
105
  "node:path",
@@ -152,21 +152,21 @@
152
152
  "dist/node/runtime/node/community/local-community.js"
153
153
  ]
154
154
  },
155
- "chunks/local-community-DyaGG6lj.js": {
155
+ "chunks/local-community-DdDpaZqk.js": {
156
156
  "isEntry": false,
157
157
  "imports": [
158
- "chunks/local-community-DYvRQWsK.js"
158
+ "chunks/local-community-DEWf2apw.js"
159
159
  ],
160
160
  "dynamicImports": [],
161
161
  "inputs": []
162
162
  },
163
- "chunks/node-DadVit9c.js": {
163
+ "chunks/node-CrnvA79m.js": {
164
164
  "isEntry": false,
165
165
  "imports": [
166
166
  "chunks/chunk-2rV9d50f.js",
167
- "chunks/rpc-local-community-1Uvl5iwp.js",
168
- "chunks/schema-Dtvt2tQ8.js",
169
- "chunks/util-CjfTxkQ8.js",
167
+ "chunks/rpc-local-community-CpN6R3ZN.js",
168
+ "chunks/schema-Db4geGeo.js",
169
+ "chunks/util-DrHyKxFe.js",
170
170
  "path",
171
171
  "assert",
172
172
  "fs",
@@ -177,8 +177,8 @@
177
177
  "rpc-websockets"
178
178
  ],
179
179
  "dynamicImports": [
180
- "chunks/helia-for-pkc-CYDRSysz.js",
181
- "chunks/local-community-DYvRQWsK.js"
180
+ "chunks/helia-for-pkc-h-rjuHh7.js",
181
+ "chunks/local-community-DEWf2apw.js"
182
182
  ],
183
183
  "inputs": [
184
184
  "node_modules/zod/v4/locales/en.js",
@@ -231,11 +231,11 @@
231
231
  "dist/node/index.js"
232
232
  ]
233
233
  },
234
- "chunks/rpc-local-community-1Uvl5iwp.js": {
234
+ "chunks/rpc-local-community-CpN6R3ZN.js": {
235
235
  "isEntry": false,
236
236
  "imports": [
237
237
  "chunks/chunk-2rV9d50f.js",
238
- "chunks/schema-Dtvt2tQ8.js",
238
+ "chunks/schema-Db4geGeo.js",
239
239
  "chunks/src-CYIMjhjK.js",
240
240
  "node:http",
241
241
  "node:crypto",
@@ -791,7 +791,7 @@
791
791
  "dist/node/community/rpc-local-community.js"
792
792
  ]
793
793
  },
794
- "chunks/schema-Dtvt2tQ8.js": {
794
+ "chunks/schema-Db4geGeo.js": {
795
795
  "isEntry": false,
796
796
  "imports": [
797
797
  "chunks/chunk-2rV9d50f.js",
@@ -1228,10 +1228,10 @@
1228
1228
  "node_modules/it-all/dist/src/index.js"
1229
1229
  ]
1230
1230
  },
1231
- "chunks/util-CjfTxkQ8.js": {
1231
+ "chunks/util-DrHyKxFe.js": {
1232
1232
  "isEntry": false,
1233
1233
  "imports": [
1234
- "chunks/schema-Dtvt2tQ8.js"
1234
+ "chunks/schema-Db4geGeo.js"
1235
1235
  ],
1236
1236
  "dynamicImports": [],
1237
1237
  "inputs": [
@@ -1,5 +1,5 @@
1
- import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, _r as PKCError, yr as logger_default } from "./schema-Dtvt2tQ8.js";
2
- import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-CjfTxkQ8.js";
1
+ import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, _r as PKCError, yr as logger_default } from "./schema-Db4geGeo.js";
2
+ import { n as directFetchIpnsRecordFromProviders, r as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-DrHyKxFe.js";
3
3
  import { CID } from "multiformats/cid";
4
4
  import { peerIdFromString } from "@libp2p/peer-id";
5
5
  import { EventEmitter as EventEmitter$1 } from "events";
@@ -164,6 +164,49 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
164
164
  const ipnsNameAsPeerId = peerIdFromString(currentName);
165
165
  log.trace("Resolving ipns name", currentName, "with options", options);
166
166
  const ipnsPubsubTopic = ipnsNameToIpnsOverPubsubTopic(ipnsNameAsPeerId.toString());
167
+ const routingKey = multihashToIPNSRoutingKey(ipnsNameAsPeerId.toMultihash());
168
+ let directFetchOutcome = { attempted: false };
169
+ {
170
+ if (!helia.libp2p.services.pubsub.getTopics().includes(ipnsPubsubTopic)) helia.libp2p.services.pubsub.subscribe(ipnsPubsubTopic);
171
+ warmupForTopic(ipnsPubsubTopic, options).catch((e) => log.trace("Fire-and-forget warmup failed for", ipnsPubsubTopic, e));
172
+ const directStart = Date.now();
173
+ try {
174
+ const direct = await directFetchIpnsRecordFromProviders({
175
+ helia,
176
+ pubsubTopic: ipnsPubsubTopic,
177
+ routingKey,
178
+ maxPeers: WARMUP_MAX_PEERS,
179
+ validate: ipnsValidator,
180
+ options,
181
+ log: logger_default("pkc-js:helia:ipns:direct-fetch")
182
+ });
183
+ if (direct) {
184
+ directFetchOutcome = {
185
+ attempted: true,
186
+ hit: true,
187
+ durationMs: direct.durationMs,
188
+ source: direct.source,
189
+ peerId: direct.peerId
190
+ };
191
+ yield unmarshalIPNSRecord(direct.recordBytes).value;
192
+ return;
193
+ }
194
+ directFetchOutcome = {
195
+ attempted: true,
196
+ hit: false,
197
+ durationMs: Date.now() - directStart
198
+ };
199
+ } catch (directErr) {
200
+ if (options?.signal?.aborted) throw directErr;
201
+ directFetchOutcome = {
202
+ attempted: true,
203
+ hit: false,
204
+ durationMs: Date.now() - directStart,
205
+ error: directErr
206
+ };
207
+ log.trace("Direct IPNS fetch path errored for", ipnsPubsubTopic, directErr);
208
+ }
209
+ }
167
210
  let warmupOutcome = { attempted: false };
168
211
  if (helia.libp2p.services.pubsub.getSubscribers(ipnsPubsubTopic).length === 0) {
169
212
  const warmupStart = Date.now();
@@ -183,7 +226,6 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
183
226
  log.error("Pre-resolve peer warmup failed for", ipnsPubsubTopic, warmupErr);
184
227
  }
185
228
  }
186
- const routingKey = multihashToIPNSRoutingKey(ipnsNameAsPeerId.toMultihash());
187
229
  let recordBytes;
188
230
  const routerErrors = [];
189
231
  for (const router of ipnsNameResolver.routers) try {
@@ -203,6 +245,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
203
245
  currentName,
204
246
  ipnsPubsubTopic,
205
247
  ipnsResolveOptions: options,
248
+ directFetchOutcome,
206
249
  warmupOutcome,
207
250
  routerErrors,
208
251
  subscribersAtResolveTime: helia.libp2p.services.pubsub.getSubscribers(ipnsPubsubTopic).length,
@@ -1,12 +1,12 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $n as t$7, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, 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, Mr as ZodError, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as n$3, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as n$4, Y as isLinkValid, Zn as t$8, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, ar as t$4, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as t$5, d as DecryptedChallengeRequestSchema, dr as require_retry, dt as retryKuboIpfsAddAndProvide, er as t$6, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, ir as r$1, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$3, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, nt as removeBlocksFromKuboNode, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as e, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, vr as messages, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yr as logger_default, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-Dtvt2tQ8.js";
3
- import { $n as t$10, A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as r$2, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as t$9, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Xn as n$6, Yn as t$11, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, Zn as n$5, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, er as stringify, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, nr as require_lodash_merge, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as t$12, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tr as STORAGE_KEYS, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-1Uvl5iwp.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as t$7, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, 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, Mr as ZodError, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as n$3, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as n$4, Y as isLinkValid, Zn as t$8, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, ar as t$4, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as t$5, d as DecryptedChallengeRequestSchema, dr as require_retry, dt as retryKuboIpfsAddAndProvide, er as t$6, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, ir as r$1, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$3, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, nt as removeBlocksFromKuboNode, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as e, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, vr as messages, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yr as logger_default, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-Db4geGeo.js";
3
+ import { $n as t$10, A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as r$2, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as t$9, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Xn as n$6, Yn as t$11, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, Zn as n$5, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, er as stringify, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, nr as require_lodash_merge, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as t$12, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tr as STORAGE_KEYS, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-CpN6R3ZN.js";
4
4
  import { randomFillSync, randomUUID } from "node:crypto";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
- import path from "node:path";
6
+ import Path from "node:path";
7
7
  import os from "os";
8
8
  import { existsSync, promises } from "node:fs";
9
- import path$1 from "path";
9
+ import path from "path";
10
10
  import assert from "assert";
11
11
  import fs from "fs";
12
12
  import Database from "better-sqlite3";
@@ -3273,9 +3273,9 @@ var DbHandler = class {
3273
3273
  if (needToMigrate) {
3274
3274
  if (dbExistsAlready && currentDbVersion > 0) {
3275
3275
  this.destoryConnection();
3276
- backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3277
- log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
3278
- if (!fs.existsSync(path$1.dirname(backupDbPath))) await fs.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
3276
+ backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3277
+ log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
3278
+ if (!fs.existsSync(path.dirname(backupDbPath))) await fs.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
3279
3279
  const sourceDb = new Database(dbPath, { fileMustExist: true });
3280
3280
  await sourceDb.backup(backupDbPath);
3281
3281
  sourceDb.close();
@@ -5078,10 +5078,10 @@ var DbHandler = class {
5078
5078
  if (this._db || this._keyv) await this.destoryConnection();
5079
5079
  this._transactionDepth = 0;
5080
5080
  const dataPath = this._community._pkc.dataPath;
5081
- const oldPathString = path$1.join(dataPath, "communities", oldDbName);
5082
- const newPathString = path$1.join(dataPath, "communities", newDbName);
5083
- await fs.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
5084
- await fs.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
5081
+ const oldPathString = path.join(dataPath, "communities", oldDbName);
5082
+ const newPathString = path.join(dataPath, "communities", newDbName);
5083
+ await fs.promises.mkdir(path.dirname(oldPathString), { recursive: true });
5084
+ await fs.promises.mkdir(path.dirname(newPathString), { recursive: true });
5085
5085
  try {
5086
5086
  if (!fs.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
5087
5087
  else {
@@ -5103,8 +5103,8 @@ var DbHandler = class {
5103
5103
  }
5104
5104
  async lockCommunityStart(communityAddress = this._community.address) {
5105
5105
  const log = logger_default("pkc-js:local-community:db-handler:lock:start");
5106
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5107
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5106
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5107
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5108
5108
  try {
5109
5109
  await import_src.default.lock(communityDbPath, {
5110
5110
  lockfilePath,
@@ -5125,8 +5125,8 @@ var DbHandler = class {
5125
5125
  async unlockCommunityStart(communityAddress = this._community.address) {
5126
5126
  const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
5127
5127
  log.trace(`Attempting to unlock the start of community (${communityAddress})`);
5128
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5129
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5128
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5129
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5130
5130
  if (!fs.existsSync(lockfilePath) || !fs.existsSync(communityDbPath)) return;
5131
5131
  try {
5132
5132
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5137,8 +5137,8 @@ var DbHandler = class {
5137
5137
  }
5138
5138
  }
5139
5139
  async isCommunityStartLocked(communityAddress = this._community.address) {
5140
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5141
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5140
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5141
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5142
5142
  return await import_src.default.check(communityDbPath, {
5143
5143
  lockfilePath,
5144
5144
  realpath: false,
@@ -5147,8 +5147,8 @@ var DbHandler = class {
5147
5147
  }
5148
5148
  async lockCommunityState() {
5149
5149
  const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
5150
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5151
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5150
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5151
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5152
5152
  try {
5153
5153
  await import_src.default.lock(communityDbPath, {
5154
5154
  lockfilePath,
@@ -5165,8 +5165,8 @@ var DbHandler = class {
5165
5165
  }
5166
5166
  async unlockCommunityState() {
5167
5167
  const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
5168
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5169
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5168
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5169
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5170
5170
  if (!fs.existsSync(lockfilePath)) return;
5171
5171
  try {
5172
5172
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5176,7 +5176,7 @@ var DbHandler = class {
5176
5176
  }
5177
5177
  }
5178
5178
  communityDbExists() {
5179
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5179
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5180
5180
  return fs.existsSync(communityDbPath);
5181
5181
  }
5182
5182
  markCommentsAsPublishedToPostUpdates(commentCids) {
@@ -6867,11 +6867,11 @@ async function edit(community, newCommunityOptions) {
6867
6867
  const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
6868
6868
  function defaultExportPathFor(community, exportId) {
6869
6869
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
6870
- return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
6870
+ return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
6871
6871
  }
6872
6872
  function sourceDbPathFor(community) {
6873
6873
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
6874
- return path.join(community._pkc.dataPath, "communities", community.address);
6874
+ return Path.join(community._pkc.dataPath, "communities", community.address);
6875
6875
  }
6876
6876
  async function persistExports(community) {
6877
6877
  if (!community._dbHandler) return;
@@ -6947,9 +6947,9 @@ async function runExportTask(community, exportId, opts) {
6947
6947
  async function exportCommunityEmbedded(community, options = {}) {
6948
6948
  if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
6949
6949
  const exportId = v4();
6950
- const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
6950
+ const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
6951
6951
  const includePrivateKey = options.includePrivateKey === true;
6952
- if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
6952
+ if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
6953
6953
  communityAddress: community.address,
6954
6954
  exportPath: destPath
6955
6955
  });
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DYvRQWsK.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DEWf2apw.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 { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, Fr as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Nr as joinValues, Pr as parsedType, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as n$1, Rt as pTimeout, Sr as setErrorMap, St as findUpdatingComment, Tt as listUpdatingComments, Xn as n$2, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, br as require_supports_color, cn as PubsubTopicSchema, ct as resolveWhenPredicateIsTrue, dr as require_retry, er as t$1, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, ir as r, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as e, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yr as logger_default, z as isAbortError } from "./schema-Dtvt2tQ8.js";
3
- import { $ as RepliesPages, $n as t$5, $t as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCidParamSchema, At as verifyCommunityEdit, B as setNativeFunctions$1, Bn as RpcFetchCidResultSchema, Bt as getCommunityPublicKeyFromWire, Cn as parseRpcCommentEventWithPKCErrorIfItFails, Ct as verifyChallengeVerification, D as createKuboRpcClient, Dn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Dt as verifyCommentPubsubMessage, Et as verifyCommentModeration, Fn as RpcExportCommunityModLogsParamSchema, Gn as RpcUnsubscribeParamSchema, H as CommentClientsManager, Hn as RpcResolveAuthorNameResultSchema, Ht as decode, I as listCommunitiesSync, In as RpcExportCommunityModLogsResultSchema, It as normalizeCreatePublicationAuthor, Kn as t$4, L as monitorCommunitiesDirectory, Ln as RpcExportCommunityParamSchema, Lt as buildRuntimeCommunityFields, Mn as RpcCommunityIdentifierParamSchema, Mt as buildRuntimeAuthor, N as getDefaultDataPath, Nn as RpcCommunityPageParamSchema, Nt as cleanWireAuthor, On as RpcAuthorNameParamSchema, Ot as verifyCommentUpdate, Pn as RpcEditCommunityParamSchema, Pt as getAuthorNameFromRuntime, Q as parseRawPages, Qn as t$2, Rn as RpcExportCommunityResultSchema, Rt as getCommunityAddressFromRecord, Sn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Tt as verifyCommentIpfs, Un as RpcSubscriptionIdResultSchema, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcPublishChallengeAnswersParamSchema, Vt as normalizeCommunityInputFromCommunity, Wn as RpcSuccessResultSchema, Wt as getBufferedPKCAddressFromPublicKey, X as findCommentInPageInstanceRecursively, Xn as n$3, Xt as parseCidStringSchemaWithPKCErrorIfItFails, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as t$3, _n as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, at as PKCTypedEmitter, bn as parseDecryptedChallengeWithPKCErrorIfItFails, c as AddressesRewriterProxyServer, ct as signChallengeAnswer, dn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, en as parseCommentIpfsSchemaWithPKCErrorIfItFails, et as PublicationClientsManager, f as KeyvBetterSqlite3, fn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ft as signComment, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, hn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, in as parseCommunityAddressWithPKCErrorIfItFails, ir as require_undici, jn as RpcCommentRepliesPageParamSchema, jt as verifyVote, kn as RpcCancelExportParamSchema, ln as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, m as decodeRpcChallengePubsubMsg, mt as signCommentModeration, n as RpcRemoteCommunity, nn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, nt as InflightFetchManager, o as TrackedInstanceRegistry, ot as require_lib$1, p as decodeRpcChallengeAnswerPubsubMsg, pt as signCommentEdit, rn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, rr as nativeFunctions$2, s as LRUCache, sn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tt as PKCClientsManager, u as RemoteCommunity, un as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ut as signChallengeRequest, v as createSigner, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, vt as signCommunityEdit, wn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, wt as verifyCommentEdit, x as encryptEd25519AesGcm, xn as parseJsonWithPKCErrorIfFails, xt as verifyChallengeMessage, y as decryptEd25519AesGcm, yn as parseDecryptedChallengeVerification, yt as signVote, zn as RpcFetchCidParamSchema, zt as getCommunityNameFromWire } from "./rpc-local-community-1Uvl5iwp.js";
4
- import { n as getHeliaDebugContext } from "./util-CjfTxkQ8.js";
2
+ import { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, Fr as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Nr as joinValues, Pr as parsedType, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as n$1, Rt as pTimeout, Sr as setErrorMap, St as findUpdatingComment, Tt as listUpdatingComments, Xn as n$2, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, br as require_supports_color, cn as PubsubTopicSchema, ct as resolveWhenPredicateIsTrue, dr as require_retry, er as t$1, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, ir as r, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as e, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yr as logger_default, z as isAbortError } from "./schema-Db4geGeo.js";
3
+ import { $ as RepliesPages, $n as t$5, $t as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCidParamSchema, At as verifyCommunityEdit, B as setNativeFunctions$1, Bn as RpcFetchCidResultSchema, Bt as getCommunityPublicKeyFromWire, Cn as parseRpcCommentEventWithPKCErrorIfItFails, Ct as verifyChallengeVerification, D as createKuboRpcClient, Dn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Dt as verifyCommentPubsubMessage, Et as verifyCommentModeration, Fn as RpcExportCommunityModLogsParamSchema, Gn as RpcUnsubscribeParamSchema, H as CommentClientsManager, Hn as RpcResolveAuthorNameResultSchema, Ht as decode, I as listCommunitiesSync, In as RpcExportCommunityModLogsResultSchema, It as normalizeCreatePublicationAuthor, Kn as t$4, L as monitorCommunitiesDirectory, Ln as RpcExportCommunityParamSchema, Lt as buildRuntimeCommunityFields, Mn as RpcCommunityIdentifierParamSchema, Mt as buildRuntimeAuthor, N as getDefaultDataPath, Nn as RpcCommunityPageParamSchema, Nt as cleanWireAuthor, On as RpcAuthorNameParamSchema, Ot as verifyCommentUpdate, Pn as RpcEditCommunityParamSchema, Pt as getAuthorNameFromRuntime, Q as parseRawPages, Qn as t$2, Rn as RpcExportCommunityResultSchema, Rt as getCommunityAddressFromRecord, Sn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Tt as verifyCommentIpfs, Un as RpcSubscriptionIdResultSchema, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcPublishChallengeAnswersParamSchema, Vt as normalizeCommunityInputFromCommunity, Wn as RpcSuccessResultSchema, Wt as getBufferedPKCAddressFromPublicKey, X as findCommentInPageInstanceRecursively, Xn as n$3, Xt as parseCidStringSchemaWithPKCErrorIfItFails, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as t$3, _n as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, at as PKCTypedEmitter, bn as parseDecryptedChallengeWithPKCErrorIfItFails, c as AddressesRewriterProxyServer, ct as signChallengeAnswer, dn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, en as parseCommentIpfsSchemaWithPKCErrorIfItFails, et as PublicationClientsManager, f as KeyvBetterSqlite3, fn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ft as signComment, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, hn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, in as parseCommunityAddressWithPKCErrorIfItFails, ir as require_undici, jn as RpcCommentRepliesPageParamSchema, jt as verifyVote, kn as RpcCancelExportParamSchema, ln as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, m as decodeRpcChallengePubsubMsg, mt as signCommentModeration, n as RpcRemoteCommunity, nn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, nt as InflightFetchManager, o as TrackedInstanceRegistry, ot as require_lib$1, p as decodeRpcChallengeAnswerPubsubMsg, pt as signCommentEdit, rn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, rr as nativeFunctions$2, s as LRUCache, sn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tt as PKCClientsManager, u as RemoteCommunity, un as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ut as signChallengeRequest, v as createSigner, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, vt as signCommunityEdit, wn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, wt as verifyCommentEdit, x as encryptEd25519AesGcm, xn as parseJsonWithPKCErrorIfFails, xt as verifyChallengeMessage, y as decryptEd25519AesGcm, yn as parseDecryptedChallengeVerification, yt as signVote, zn as RpcFetchCidParamSchema, zt as getCommunityNameFromWire } from "./rpc-local-community-CpN6R3ZN.js";
4
+ import { r as getHeliaDebugContext } from "./util-DrHyKxFe.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -8866,7 +8866,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8866
8866
  this.clients.libp2pJsClients = {};
8867
8867
  if (!this.libp2pJsClientsOptions) return;
8868
8868
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
8869
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CYDRSysz.js");
8869
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-h-rjuHh7.js");
8870
8870
  for (const clientOptions of this.libp2pJsClientsOptions) {
8871
8871
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
8872
8872
  ...clientOptions,
@@ -9114,7 +9114,7 @@ var PKC$1 = class extends PKCTypedEmitter {
9114
9114
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
9115
9115
  log.trace("Received community options to create a local community instance:", options);
9116
9116
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
9117
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-DyaGG6lj.js");
9117
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-DdDpaZqk.js");
9118
9118
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
9119
9119
  const community = new LocalCommunity(this);
9120
9120
  if (isLocalCommunity) {
@@ -1,15 +1,15 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, 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 number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, 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 n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-Dtvt2tQ8.js";
2
+ import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, 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 number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, 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 n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-Db4geGeo.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
4
  import http from "node:http";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import fsp from "node:fs/promises";
8
- import path from "node:path";
8
+ import Path from "node:path";
9
9
  import dns from "node:dns";
10
10
  import os from "os";
11
11
  import { closeSync, createReadStream, existsSync, openSync, promises, readSync, readdirSync, rm, watch } from "node:fs";
12
- import path$1 from "path";
12
+ import path from "path";
13
13
  import assert from "assert";
14
14
  import { Agent } from "https";
15
15
  import { Agent as Agent$1 } from "http";
@@ -101567,14 +101567,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
101567
101567
  };
101568
101568
  //#endregion
101569
101569
  //#region dist/node/runtime/node/util.js
101570
- const getDefaultDataPath = () => path$1.join(process.cwd(), ".pkc");
101570
+ const getDefaultDataPath = () => path.join(process.cwd(), ".pkc");
101571
101571
  const getDefaultCommunityDbConfig = async (communityAddress, pkc) => {
101572
101572
  let filename;
101573
101573
  if (pkc.noData) filename = ":memory:";
101574
101574
  else {
101575
101575
  assert(typeof pkc.dataPath === "string", "pkc.dataPath need to be defined to get default community db config");
101576
- filename = path$1.join(pkc.dataPath, "communities", communityAddress);
101577
- await promises.mkdir(path$1.dirname(filename), { recursive: true });
101576
+ filename = path.join(pkc.dataPath, "communities", communityAddress);
101577
+ await promises.mkdir(path.dirname(filename), { recursive: true });
101578
101578
  }
101579
101579
  return {
101580
101580
  filename,
@@ -101673,7 +101673,7 @@ const setNativeFunctions = (newNativeFunctions) => {
101673
101673
  };
101674
101674
  const deleteOldCommunityInWindows = async (subPath, pkc) => {
101675
101675
  const log = logger_default("pkc-js:community:deleteStaleCommunityInWindows");
101676
- const communityAddress = path$1.basename(subPath);
101676
+ const communityAddress = path.basename(subPath);
101677
101677
  await new Promise((resolve) => setTimeout(resolve, 1e4));
101678
101678
  try {
101679
101679
  await promises.rm(subPath, { force: true });
@@ -101697,7 +101697,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101697
101697
  }
101698
101698
  const communitiesThatWereDeletedSuccessfully = [];
101699
101699
  for (const communityAddress of deletedPersistentCommunities) {
101700
- const communityPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101700
+ const communityPath = path.join(pkc.dataPath, "communities", communityAddress);
101701
101701
  try {
101702
101702
  await promises.rm(communityPath, { force: true });
101703
101703
  log(`Succeeded in deleting old db path (${communityAddress})`);
@@ -101721,7 +101721,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101721
101721
  function listCommunitiesSync(pkc) {
101722
101722
  logger_default("pkc-js:listCommunitiesSync");
101723
101723
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath needs to be defined to listCommunities");
101724
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101724
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101725
101725
  const files = readdirSync(communitiesPath, {
101726
101726
  recursive: false,
101727
101727
  withFileTypes: false
@@ -101729,7 +101729,7 @@ function listCommunitiesSync(pkc) {
101729
101729
  const communityFilesWeDontNeedToCheck = pkc.communities ? files.filter((address) => pkc.communities.includes(address)) : [];
101730
101730
  const sqliteFiles = files.filter((address) => !communityFilesWeDontNeedToCheck.includes(address)).filter((address) => {
101731
101731
  try {
101732
- const filePath = path$1.join(communitiesPath, address);
101732
+ const filePath = path.join(communitiesPath, address);
101733
101733
  if (!existsSync(filePath)) return false;
101734
101734
  const fd = openSync(filePath, "r");
101735
101735
  const buffer = Buffer.alloc(16);
@@ -101810,7 +101810,7 @@ var BackupAbortError = class extends Error {
101810
101810
  async function backupCommunityDb(opts) {
101811
101811
  const { sourcePath, destPath, includePrivateKey, onProgress, signal } = opts;
101812
101812
  if (signal?.aborted) throw new BackupAbortError();
101813
- await promises.mkdir(path$1.dirname(destPath), { recursive: true });
101813
+ await promises.mkdir(path.dirname(destPath), { recursive: true });
101814
101814
  const partialPath = destPath + ".partial";
101815
101815
  try {
101816
101816
  await promises.unlink(partialPath);
@@ -101894,9 +101894,9 @@ async function statAndHashFile(filePath) {
101894
101894
  }
101895
101895
  async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
101896
101896
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath is not defined");
101897
- const oldPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101898
- const newPath = path$1.join(pkc.dataPath, "communities", "deleted", communityAddress);
101899
- await promises.mkdir(path$1.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101897
+ const oldPath = path.join(pkc.dataPath, "communities", communityAddress);
101898
+ const newPath = path.join(pkc.dataPath, "communities", "deleted", communityAddress);
101899
+ await promises.mkdir(path.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101900
101900
  if (!existsSync(oldPath)) throw Error(`Source database ${oldPath} does not exist`);
101901
101901
  try {
101902
101902
  const sourceDb = new Database(oldPath, { fileMustExist: true });
@@ -101932,7 +101932,7 @@ async function createKuboRpcClient(kuboRpcClientOptions) {
101932
101932
  }
101933
101933
  async function monitorCommunitiesDirectory(pkc) {
101934
101934
  const watchAbortController = new AbortController();
101935
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101935
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101936
101936
  await promises.mkdir(communitiesPath, { recursive: true });
101937
101937
  const extensionsToIgnore = [
101938
101938
  ".lock",
@@ -125825,11 +125825,11 @@ var AddressRewriterDatabase = class {
125825
125825
  if (kuboConfig && typeof kuboConfig === "object" && "host" in kuboConfig && "port" in kuboConfig) kuboIdentifier = `${kuboConfig.host}_${kuboConfig.port}`;
125826
125826
  const proxyIdentifier = `${proxyTarget.hostname}_${proxyTarget.port || (proxyTarget.protocol === "https:" ? "443" : "80")}`;
125827
125827
  const fileName = `address_rewriter_${kuboIdentifier}_${proxyIdentifier}.db`;
125828
- return path.join(dataPath, ".address-rewriter", fileName);
125828
+ return Path.join(dataPath, ".address-rewriter", fileName);
125829
125829
  }
125830
125830
  async initialize() {
125831
125831
  try {
125832
- const dbDir = path.dirname(this._dbPath);
125832
+ const dbDir = Path.dirname(this._dbPath);
125833
125833
  await fsp.mkdir(dbDir, { recursive: true });
125834
125834
  this._db = new Database(this._dbPath);
125835
125835
  this._db.exec(`
@@ -5154,6 +5154,7 @@ var messages;
5154
5154
  messages["ERR_GET_COMMUNITY_TIMED_OUT"] = "pkc.getCommunity({address}) timed out";
5155
5155
  messages["ERR_TIMEOUT_WAITING_FOR_PUBSUB_TOPIC_PEERS"] = "Timeout waiting for propagation of pubsub topic peers";
5156
5156
  messages["ERR_PUBSUB_TOPIC_PEER_WAIT_ABORTED"] = "Aborted while waiting for a peer to subscribe to a pubsub topic";
5157
+ messages["ERR_IPNS_DIRECT_FETCH_ABORTED"] = "Aborted while fetching an IPNS record directly from subscribers/providers";
5157
5158
  messages["ERR_TIMED_OUT_RM_MFS_FILE"] = "Timed out removing MFS paths. We may need to nuke the whole MFS directory and republish everything";
5158
5159
  messages["ERR_ABORTED_RESOLVING_TEXT_RECORD"] = "Aborted resolving text record on domain";
5159
5160
  messages["ERR_CALLED_COMMUNITY_STOP_WITHOUT_UPDATE"] = "community.stop() called without calling update() first";
@@ -16029,7 +16030,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
16029
16030
  }
16030
16031
  //#endregion
16031
16032
  //#region dist/node/generated-version.js
16032
- const version = "0.0.64";
16033
+ const version = "0.0.65";
16033
16034
  //#endregion
16034
16035
  //#region dist/node/version.js
16035
16036
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");