@pkcprotocol/pkc-js 0.1.0 → 0.2.0

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 (39) hide show
  1. package/dist/browser/generated-version.d.ts +1 -1
  2. package/dist/browser/generated-version.js +1 -1
  3. package/dist/browser/pkc/tracked-instance-registry-util.d.ts +3 -4
  4. package/dist/browser/pkc/tracked-instance-registry-util.js +43 -14
  5. package/dist/browser/pkc/tracked-instance-registry-util.js.map +1 -1
  6. package/dist/browser/runtime/node/community/local-community/db-state.js +5 -6
  7. package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
  8. package/dist/browser/runtime/node/community/local-community/editing.js +4 -4
  9. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  10. package/dist/browser/runtime/node/community/local-community/lifecycle.js +6 -6
  11. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  12. package/dist/browser/runtime/node/community/local-community/registry.d.ts +14 -1
  13. package/dist/browser/runtime/node/community/local-community/registry.js +37 -0
  14. package/dist/browser/runtime/node/community/local-community/registry.js.map +1 -1
  15. package/dist/bundled/bundle-manifest.json +25 -25
  16. package/dist/bundled/chunks/{helia-for-pkc-CcT2kDVL.js → helia-for-pkc-Dm3mT3h4.js} +2 -2
  17. package/dist/bundled/chunks/{local-community-B8T0Ge_b.js → local-community-B4uMItc-.js} +1 -1
  18. package/dist/bundled/chunks/{local-community-yooggNPK.js → local-community-Buip8ns5.js} +37 -26
  19. package/dist/bundled/chunks/{node-DuFF1_XR.js → node-BeKsUlS0.js} +5 -5
  20. package/dist/bundled/chunks/{rpc-local-community-Cagh_MlK.js → rpc-local-community-9ZMBP3cA.js} +1 -1
  21. package/dist/bundled/chunks/{schema-B2OWwon1.js → schema-HEMvQjxr.js} +25 -15
  22. package/dist/bundled/chunks/{util-Bk_jgfa0.js → util-DyH_eq6e.js} +1 -1
  23. package/dist/bundled/index.js +1 -1
  24. package/dist/bundled/rpc/src/index.js +4 -4
  25. package/dist/node/generated-version.d.ts +1 -1
  26. package/dist/node/generated-version.js +1 -1
  27. package/dist/node/pkc/tracked-instance-registry-util.d.ts +3 -4
  28. package/dist/node/pkc/tracked-instance-registry-util.js +43 -14
  29. package/dist/node/pkc/tracked-instance-registry-util.js.map +1 -1
  30. package/dist/node/runtime/node/community/local-community/db-state.js +5 -6
  31. package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
  32. package/dist/node/runtime/node/community/local-community/editing.js +4 -4
  33. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  34. package/dist/node/runtime/node/community/local-community/lifecycle.js +6 -6
  35. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  36. package/dist/node/runtime/node/community/local-community/registry.d.ts +14 -1
  37. package/dist/node/runtime/node/community/local-community/registry.js +37 -0
  38. package/dist/node/runtime/node/community/local-community/registry.js.map +1 -1
  39. package/package.json +1 -1
@@ -14,7 +14,7 @@
14
14
  "node:module"
15
15
  ],
16
16
  "dynamicImports": [
17
- "chunks/node-DuFF1_XR.js"
17
+ "chunks/node-BeKsUlS0.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-DuFF1_XR.js"
27
+ "chunks/node-BeKsUlS0.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-Cagh_MlK.js",
36
- "chunks/node-DuFF1_XR.js",
37
- "chunks/schema-B2OWwon1.js",
38
- "chunks/local-community-yooggNPK.js",
35
+ "chunks/rpc-local-community-9ZMBP3cA.js",
36
+ "chunks/node-BeKsUlS0.js",
37
+ "chunks/schema-HEMvQjxr.js",
38
+ "chunks/local-community-Buip8ns5.js",
39
39
  "node:url",
40
40
  "path",
41
41
  "assert",
@@ -65,12 +65,12 @@
65
65
  "\u0000rolldown/runtime.js"
66
66
  ]
67
67
  },
68
- "chunks/helia-for-pkc-CcT2kDVL.js": {
68
+ "chunks/helia-for-pkc-Dm3mT3h4.js": {
69
69
  "isEntry": false,
70
70
  "imports": [
71
71
  "chunks/chunk-2rV9d50f.js",
72
- "chunks/schema-B2OWwon1.js",
73
- "chunks/util-Bk_jgfa0.js",
72
+ "chunks/schema-HEMvQjxr.js",
73
+ "chunks/util-DyH_eq6e.js",
74
74
  "chunks/src-DKntVmyX.js",
75
75
  "chunks/src-Cpx2Sts8.js",
76
76
  "node:url",
@@ -186,20 +186,20 @@
186
186
  "dist/node/helia/helia-for-pkc.js"
187
187
  ]
188
188
  },
189
- "chunks/local-community-B8T0Ge_b.js": {
189
+ "chunks/local-community-B4uMItc-.js": {
190
190
  "isEntry": false,
191
191
  "imports": [
192
- "chunks/local-community-yooggNPK.js"
192
+ "chunks/local-community-Buip8ns5.js"
193
193
  ],
194
194
  "dynamicImports": [],
195
195
  "inputs": []
196
196
  },
197
- "chunks/local-community-yooggNPK.js": {
197
+ "chunks/local-community-Buip8ns5.js": {
198
198
  "isEntry": false,
199
199
  "imports": [
200
200
  "chunks/chunk-2rV9d50f.js",
201
- "chunks/rpc-local-community-Cagh_MlK.js",
202
- "chunks/schema-B2OWwon1.js",
201
+ "chunks/rpc-local-community-9ZMBP3cA.js",
202
+ "chunks/schema-HEMvQjxr.js",
203
203
  "node:crypto",
204
204
  "node:url",
205
205
  "node:path",
@@ -256,13 +256,13 @@
256
256
  "dist/node/runtime/node/community/local-community.js"
257
257
  ]
258
258
  },
259
- "chunks/node-DuFF1_XR.js": {
259
+ "chunks/node-BeKsUlS0.js": {
260
260
  "isEntry": false,
261
261
  "imports": [
262
262
  "chunks/chunk-2rV9d50f.js",
263
- "chunks/rpc-local-community-Cagh_MlK.js",
264
- "chunks/schema-B2OWwon1.js",
265
- "chunks/util-Bk_jgfa0.js",
263
+ "chunks/rpc-local-community-9ZMBP3cA.js",
264
+ "chunks/schema-HEMvQjxr.js",
265
+ "chunks/util-DyH_eq6e.js",
266
266
  "path",
267
267
  "assert",
268
268
  "fs",
@@ -273,8 +273,8 @@
273
273
  "rpc-websockets"
274
274
  ],
275
275
  "dynamicImports": [
276
- "chunks/helia-for-pkc-CcT2kDVL.js",
277
- "chunks/local-community-yooggNPK.js"
276
+ "chunks/helia-for-pkc-Dm3mT3h4.js",
277
+ "chunks/local-community-Buip8ns5.js"
278
278
  ],
279
279
  "inputs": [
280
280
  "node_modules/zod/v4/locales/en.js",
@@ -316,11 +316,11 @@
316
316
  "dist/node/index.js"
317
317
  ]
318
318
  },
319
- "chunks/rpc-local-community-Cagh_MlK.js": {
319
+ "chunks/rpc-local-community-9ZMBP3cA.js": {
320
320
  "isEntry": false,
321
321
  "imports": [
322
322
  "chunks/chunk-2rV9d50f.js",
323
- "chunks/schema-B2OWwon1.js",
323
+ "chunks/schema-HEMvQjxr.js",
324
324
  "chunks/src-CYIMjhjK.js",
325
325
  "node:crypto",
326
326
  "node:url",
@@ -874,7 +874,7 @@
874
874
  "dist/node/community/rpc-local-community.js"
875
875
  ]
876
876
  },
877
- "chunks/schema-B2OWwon1.js": {
877
+ "chunks/schema-HEMvQjxr.js": {
878
878
  "isEntry": false,
879
879
  "imports": [
880
880
  "chunks/chunk-2rV9d50f.js",
@@ -1327,10 +1327,10 @@
1327
1327
  "node_modules/kubo-rpc-client/dist/src/index.js"
1328
1328
  ]
1329
1329
  },
1330
- "chunks/util-Bk_jgfa0.js": {
1330
+ "chunks/util-DyH_eq6e.js": {
1331
1331
  "isEntry": false,
1332
1332
  "imports": [
1333
- "chunks/schema-B2OWwon1.js",
1333
+ "chunks/schema-HEMvQjxr.js",
1334
1334
  "ipns/selector",
1335
1335
  "uint8arrays/equals"
1336
1336
  ],
@@ -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-B2OWwon1.js";
3
- import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-Bk_jgfa0.js";
2
+ import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, Sr as logger_default, br as PKCError } from "./schema-HEMvQjxr.js";
3
+ import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-DyH_eq6e.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";
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-yooggNPK.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-Buip8ns5.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -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-B2OWwon1.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-Cagh_MlK.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-HEMvQjxr.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-9ZMBP3cA.js";
4
4
  import { randomFillSync, randomUUID } from "node:crypto";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
6
  import Path from "node:path";
@@ -1812,6 +1812,32 @@ async function throwIfChallengeSettingsAreInvalid({ challengeSettings, pkc, comm
1812
1812
  //#endregion
1813
1813
  //#region dist/node/runtime/node/community/local-community/registry.js
1814
1814
  const processStartedCommunities = new TrackedInstanceRegistry();
1815
+ function normalizeRegistryDataPath(dataPath) {
1816
+ if (dataPath === void 0) return void 0;
1817
+ const resolved = path.resolve(dataPath);
1818
+ let existing = resolved;
1819
+ let tail = "";
1820
+ while (true) try {
1821
+ return path.join(fs.realpathSync.native(existing), tail);
1822
+ } catch {
1823
+ const parent = path.dirname(existing);
1824
+ if (parent === existing) return resolved;
1825
+ tail = path.join(path.basename(existing), tail);
1826
+ existing = parent;
1827
+ }
1828
+ }
1829
+ function getLookup(community) {
1830
+ return {
1831
+ publicKey: community.publicKey,
1832
+ name: community.name
1833
+ };
1834
+ }
1835
+ function findProcessStartedCommunity(community) {
1836
+ return findCommunityInRegistry(processStartedCommunities, getLookup(community), normalizeRegistryDataPath(community._pkc.dataPath));
1837
+ }
1838
+ function syncProcessStartedCommunity(community) {
1839
+ syncCommunityRegistryEntry(processStartedCommunities, community, normalizeRegistryDataPath(community._pkc.dataPath));
1840
+ }
1815
1841
  //#endregion
1816
1842
  //#region node_modules/graceful-fs/polyfills.js
1817
1843
  var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -6081,10 +6107,7 @@ async function updateInstancePropsWithStartedCommunityOrDb(community) {
6081
6107
  const startedCommunity = findStartedCommunity(community._pkc, {
6082
6108
  publicKey: community.publicKey,
6083
6109
  name: community.name
6084
- }) || findCommunityInRegistry(processStartedCommunities, {
6085
- publicKey: community.publicKey,
6086
- name: community.name
6087
- });
6110
+ }) || findProcessStartedCommunity(community);
6088
6111
  if (startedCommunity) {
6089
6112
  log("Loading local community", community.address, "from started community instance");
6090
6113
  if (startedCommunity.updatedAt) await community.initInternalCommunityAfterFirstUpdateNoMerge(startedCommunity.toJSONInternalAfterFirstUpdate());
@@ -6236,7 +6259,7 @@ async function initInternalCommunityAfterFirstUpdateNoMerge(community, newProps)
6236
6259
  if (Array.isArray(newProps._cidsToUnPin)) newProps._cidsToUnPin.forEach((cid) => community._cidsToUnPin.add(cid));
6237
6260
  if (Array.isArray(newProps._mfsPathsToRemove)) newProps._mfsPathsToRemove.forEach((path) => community._mfsPathsToRemove.add(path));
6238
6261
  community._updateIpnsPubsubPropsIfNeeded(newProps);
6239
- if (processStartedCommunities.has(community)) syncCommunityRegistryEntry(processStartedCommunities, community);
6262
+ if (processStartedCommunities.has(community)) syncProcessStartedCommunity(community);
6240
6263
  if (community.updateCid) community.raw.localCommunity = community.toJSONInternalRpcAfterFirstUpdate();
6241
6264
  }
6242
6265
  async function initInternalCommunityBeforeFirstUpdateNoMerge(community, newProps) {
@@ -6258,7 +6281,7 @@ async function initInternalCommunityBeforeFirstUpdateNoMerge(community, newProps
6258
6281
  await initSignerProps(community, newProps.signer);
6259
6282
  community._internalStateUpdateId = newProps._internalStateUpdateId;
6260
6283
  community._updateIpnsPubsubPropsIfNeeded(newProps);
6261
- if (processStartedCommunities.has(community)) syncCommunityRegistryEntry(processStartedCommunities, community);
6284
+ if (processStartedCommunities.has(community)) syncProcessStartedCommunity(community);
6262
6285
  community.raw.localCommunity = community.toJSONInternalRpcBeforeFirstUpdate();
6263
6286
  }
6264
6287
  async function initDbHandlerIfNeeded(community) {
@@ -6745,10 +6768,7 @@ async function start(community) {
6745
6768
  if (community.started || findStartedCommunity(community._pkc, {
6746
6769
  publicKey: community.publicKey,
6747
6770
  name: community.name
6748
- }) || findCommunityInRegistry(processStartedCommunities, {
6749
- publicKey: community.publicKey,
6750
- name: community.name
6751
- })) throw new PKCError("ERR_COMMUNITY_ALREADY_STARTED", { address: community.address });
6771
+ }) || findProcessStartedCommunity(community)) throw new PKCError("ERR_COMMUNITY_ALREADY_STARTED", { address: community.address });
6752
6772
  try {
6753
6773
  await initBeforeStarting(community);
6754
6774
  if (community.anchor && !getPersistedAnchorRecordBytes(community)) throw new PKCError("ERR_DELEGATED_COMMUNITY_HAS_NO_ANCHOR_RECORD", {
@@ -6760,7 +6780,7 @@ async function start(community) {
6760
6780
  await community._updateStartedValue();
6761
6781
  await community._dbHandler.lockCommunityStart();
6762
6782
  trackStartedCommunity(community._pkc, community);
6763
- syncCommunityRegistryEntry(processStartedCommunities, community);
6783
+ syncProcessStartedCommunity(community);
6764
6784
  await community._updateStartedValue();
6765
6785
  await community._dbHandler.initDbIfNeeded();
6766
6786
  await community._dbHandler.createOrMigrateTablesIfNeeded();
@@ -6864,10 +6884,7 @@ async function updateOnce(community) {
6864
6884
  const startedCommunity = findStartedCommunity(community._pkc, {
6865
6885
  publicKey: community.publicKey,
6866
6886
  name: community.name
6867
- }) || findCommunityInRegistry(processStartedCommunities, {
6868
- publicKey: community.publicKey,
6869
- name: community.name
6870
- });
6887
+ }) || findProcessStartedCommunity(community);
6871
6888
  if (community._mirroredStartedOrUpdatingCommunity) return;
6872
6889
  else if (startedCommunity) {
6873
6890
  await initMirroringStartedOrUpdatingCommunity(community, startedCommunity);
@@ -6994,10 +7011,7 @@ async function deleteCommunity(community) {
6994
7011
  const startedCommunity = findStartedCommunity(community._pkc, {
6995
7012
  publicKey: community.publicKey,
6996
7013
  name: community.name
6997
- }) || findCommunityInRegistry(processStartedCommunities, {
6998
- publicKey: community.publicKey,
6999
- name: community.name
7000
- });
7014
+ }) || findProcessStartedCommunity(community);
7001
7015
  if (startedCommunity && startedCommunity !== community) {
7002
7016
  await startedCommunity.delete();
7003
7017
  await community.stop();
@@ -7149,7 +7163,7 @@ async function editPropsOnStartedCommunity(community, parsedEditOptions) {
7149
7163
  community.emit("update", community);
7150
7164
  if (community.address !== oldAddress) {
7151
7165
  trackStartedCommunity(community._pkc, community);
7152
- syncCommunityRegistryEntry(processStartedCommunities, community);
7166
+ syncProcessStartedCommunity(community);
7153
7167
  }
7154
7168
  return community;
7155
7169
  }
@@ -7179,10 +7193,7 @@ async function edit(community, newCommunityOptions) {
7179
7193
  const startedCommunity = findStartedCommunity(community._pkc, {
7180
7194
  publicKey: community.publicKey,
7181
7195
  name: community.name
7182
- }) || findCommunityInRegistry(processStartedCommunities, {
7183
- publicKey: community.publicKey,
7184
- name: community.name
7185
- });
7196
+ }) || findProcessStartedCommunity(community);
7186
7197
  if (startedCommunity && community.state !== "started") {
7187
7198
  const editRes = await startedCommunity.edit(newCommunityOptions);
7188
7199
  community.setAddress(editRes.address);
@@ -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-B2OWwon1.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-Cagh_MlK.js";
4
- import { o as getHeliaDebugContext } from "./util-Bk_jgfa0.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-HEMvQjxr.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-9ZMBP3cA.js";
4
+ import { o as getHeliaDebugContext } from "./util-DyH_eq6e.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-CcT2kDVL.js");
6951
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-Dm3mT3h4.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-B8T0Ge_b.js");
7230
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-B4uMItc-.js");
7231
7231
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
7232
7232
  const community = new LocalCommunity(this);
7233
7233
  if (isLocalCommunity) {
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $n as n$10, $t as ChallengeFileSchema, A as extractNetworkErrorDetails, An as CommentUpdateSignedPropertyNames, Ar as literal, At as refreshTrackedCommunityAliases, B as isIpfsCid, Bt as pTimeout, Cn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Cr as require_supports_color, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateForChallengeVerificationSignedPropertyNames, Dr as array, E as createAbortError, Er as _enum, Et as listStartedCommunities, Fn as ModQueuePageIpfsSchema, Ft as untrackStartedCommunity, Gn as AuthorCommentIpfsReservedFields, Gt as CreateCommunityEditPublicationOptionsWithRefinementSchema, H as isIpns, I as getPostUpdateTimestampRange, In as PageIpfsSchema, It as untrackUpdatingComment, Jn as CidPathSchema, Kt as CommentModerationChallengeRequestToEncryptSchema, L as hideClassPrivateProps, Ln as CommentEditChallengeRequestToEncryptSchema, Lt as untrackUpdatingCommunity, Mr as object, Mt as trackStartedCommunity, Nn as CreateCommentOptionsWithRefinementSchema, Nr as record, O as derivePublicationFromChallengeRequest, On as CommentUpdateReservedFields, Or as boolean, Ot as listUpdatingCommunities, Pn as GetPageParamSchema, Pr as string, Pt as trackUpdatingCommunity, Q as isStringDomain, Qn as CreateSignerSchema, Qt as ChallengeFileFactorySchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as require_sha256$1, Sr as logger_default, Tn as CommentUpdateChallengeReservedFieldNames, Tt as findUpdatingCommunity, U as isIpnsPath, Un as CreateCommentEditOptionsWithRefinementSchema, Ut as CommunityEditPublicationSignedPropertyNames, V as isIpfsPath, Vn as CommentEditSignedPropertyNames, Vt as CommunityEditPublicationChallengeRequestToEncryptSchema, Wn as AuthorAddressSchema, Wt as CommunityEditPubsubMessagePublicationSchema, X as isRequestPubsubPublicationOfPost, Xn as CommunityAddressSchema, Xt as CommentModerationsTableRowSchema, Yn as CidStringSchema, Yt as CommentModerationSignedPropertyNames, Z as isRequestPubsubPublicationOfReply, Zn as CommunityAuthorChallengeReservedFieldNames, Zt as CreateCommentModerationOptionsWithRefinementSchema, _ as PKCUserOptionBaseSchema, _n as VoteSignedPropertyNames, _r as FailedToFetchCommunityFromGatewaysError, an as CommunityIpfsSchema, ar as e$5, b as areEquivalentCommunityAddresses, bn as CommentIpfsReservedFields, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateRemoteCommunityFunctionArgumentSchema, cr as t$12, dr as t$10, f as DecryptedChallengeSchema, fn as RpcRemoteCommunityUpdateEventResultSchema, fr as t$9, g as PKCParsedOptionsSchema, gr as FailedToFetchCommentUpdateFromGatewaysError, gt as sleepUntilTimeoutOrAbort, h as NameResolverSerializedSchema, hn as VotePubsubMessagePublicationSchema, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, i as ChallengeMessageSignedPropertyNames, in as CommunityIpfsReservedFields, ir as e$6, j as fetchAndValidateIpnsRecordFromGateway, jr as number, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kr as custom, l as DecryptedChallengeAnswerSchema, ln as CreateRpcCommunityFunctionArgumentSchema, lr as n$8, m as NameResolveCacheOptionsSchema, mn as VoteChallengeRequestToEncryptSchema, mr as require_retry$1, mt as shortifyAddress, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityEditOptionsSchema, o as ChallengeRequestMessageSignedPropertyNames, on as CommunitySignedPropertyNames, or as t$11, ot as removeNullUndefinedEmptyObjectsValuesRecursively, p as DecryptedChallengeVerificationSchema, pn as CreateVoteUserOptionsWithRefinementSchema, pr as e$4, qn as ChallengeAnswersSchema, qt as CommentModerationPubsubMessagePublicationSchema, rn as CommunityExportRecordsSchema, rr as t$13, sn as CreateNewLocalCommunityUserOptionsSchema, sr as r$8, tn as CommunityChallengeSettingSchema, tr as n$9, tt as raceAgainstAbort, un as ExportCommunityModLogsOptionsSchema, ur as r$7, ut as resolveWhenPredicateIsTrue, v as PKCUserOptionsSchema, vr as FailedToFetchGenericIpfsFromGatewaysError, vt as throwIfAbortSignalAborted, wn as CommentSignedPropertyNames, wr as require_ms$1, wt as findUpdatingComment, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, yn as CommentChallengeRequestToEncryptSchema, yr as FailedToFetchPageIpfsFromGatewaysError, yt as timestamp, z as isAbortError, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-B2OWwon1.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$10, $t as ChallengeFileSchema, A as extractNetworkErrorDetails, An as CommentUpdateSignedPropertyNames, Ar as literal, At as refreshTrackedCommunityAliases, B as isIpfsCid, Bt as pTimeout, Cn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Cr as require_supports_color, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateForChallengeVerificationSignedPropertyNames, Dr as array, E as createAbortError, Er as _enum, Et as listStartedCommunities, Fn as ModQueuePageIpfsSchema, Ft as untrackStartedCommunity, Gn as AuthorCommentIpfsReservedFields, Gt as CreateCommunityEditPublicationOptionsWithRefinementSchema, H as isIpns, I as getPostUpdateTimestampRange, In as PageIpfsSchema, It as untrackUpdatingComment, Jn as CidPathSchema, Kt as CommentModerationChallengeRequestToEncryptSchema, L as hideClassPrivateProps, Ln as CommentEditChallengeRequestToEncryptSchema, Lt as untrackUpdatingCommunity, Mr as object, Mt as trackStartedCommunity, Nn as CreateCommentOptionsWithRefinementSchema, Nr as record, O as derivePublicationFromChallengeRequest, On as CommentUpdateReservedFields, Or as boolean, Ot as listUpdatingCommunities, Pn as GetPageParamSchema, Pr as string, Pt as trackUpdatingCommunity, Q as isStringDomain, Qn as CreateSignerSchema, Qt as ChallengeFileFactorySchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as require_sha256$1, Sr as logger_default, Tn as CommentUpdateChallengeReservedFieldNames, Tt as findUpdatingCommunity, U as isIpnsPath, Un as CreateCommentEditOptionsWithRefinementSchema, Ut as CommunityEditPublicationSignedPropertyNames, V as isIpfsPath, Vn as CommentEditSignedPropertyNames, Vt as CommunityEditPublicationChallengeRequestToEncryptSchema, Wn as AuthorAddressSchema, Wt as CommunityEditPubsubMessagePublicationSchema, X as isRequestPubsubPublicationOfPost, Xn as CommunityAddressSchema, Xt as CommentModerationsTableRowSchema, Yn as CidStringSchema, Yt as CommentModerationSignedPropertyNames, Z as isRequestPubsubPublicationOfReply, Zn as CommunityAuthorChallengeReservedFieldNames, Zt as CreateCommentModerationOptionsWithRefinementSchema, _ as PKCUserOptionBaseSchema, _n as VoteSignedPropertyNames, _r as FailedToFetchCommunityFromGatewaysError, an as CommunityIpfsSchema, ar as e$5, b as areEquivalentCommunityAddresses, bn as CommentIpfsReservedFields, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateRemoteCommunityFunctionArgumentSchema, cr as t$12, dr as t$10, f as DecryptedChallengeSchema, fn as RpcRemoteCommunityUpdateEventResultSchema, fr as t$9, g as PKCParsedOptionsSchema, gr as FailedToFetchCommentUpdateFromGatewaysError, gt as sleepUntilTimeoutOrAbort, h as NameResolverSerializedSchema, hn as VotePubsubMessagePublicationSchema, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, i as ChallengeMessageSignedPropertyNames, in as CommunityIpfsReservedFields, ir as e$6, j as fetchAndValidateIpnsRecordFromGateway, jr as number, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kr as custom, l as DecryptedChallengeAnswerSchema, ln as CreateRpcCommunityFunctionArgumentSchema, lr as n$8, m as NameResolveCacheOptionsSchema, mn as VoteChallengeRequestToEncryptSchema, mr as require_retry$1, mt as shortifyAddress, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityEditOptionsSchema, o as ChallengeRequestMessageSignedPropertyNames, on as CommunitySignedPropertyNames, or as t$11, ot as removeNullUndefinedEmptyObjectsValuesRecursively, p as DecryptedChallengeVerificationSchema, pn as CreateVoteUserOptionsWithRefinementSchema, pr as e$4, qn as ChallengeAnswersSchema, qt as CommentModerationPubsubMessagePublicationSchema, rn as CommunityExportRecordsSchema, rr as t$13, sn as CreateNewLocalCommunityUserOptionsSchema, sr as r$8, tn as CommunityChallengeSettingSchema, tr as n$9, tt as raceAgainstAbort, un as ExportCommunityModLogsOptionsSchema, ur as r$7, ut as resolveWhenPredicateIsTrue, v as PKCUserOptionsSchema, vr as FailedToFetchGenericIpfsFromGatewaysError, vt as throwIfAbortSignalAborted, wn as CommentSignedPropertyNames, wr as require_ms$1, wt as findUpdatingComment, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, yn as CommentChallengeRequestToEncryptSchema, yr as FailedToFetchPageIpfsFromGatewaysError, yt as timestamp, z as isAbortError, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-HEMvQjxr.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
4
  import { createHash } from "node:crypto";
5
5
  import { pathToFileURL } from "node:url";
@@ -15245,51 +15245,61 @@ function getEquivalentCommunityAliases(address) {
15245
15245
  function dedupeAliases(aliases) {
15246
15246
  return [...new Set(aliases.filter((alias) => typeof alias === "string" && alias.length > 0))];
15247
15247
  }
15248
- function getTrackedAliasHistory(target) {
15248
+ function getTrackedAliasHistory(target, registry) {
15249
15249
  const holder = target;
15250
15250
  if (!holder[trackedAliasHistorySymbol]) Object.defineProperty(holder, trackedAliasHistorySymbol, {
15251
- value: /* @__PURE__ */ new Set(),
15251
+ value: /* @__PURE__ */ new WeakMap(),
15252
15252
  enumerable: false,
15253
15253
  configurable: false,
15254
15254
  writable: false
15255
15255
  });
15256
- return holder[trackedAliasHistorySymbol];
15256
+ const histories = holder[trackedAliasHistorySymbol];
15257
+ let history = histories.get(registry);
15258
+ if (!history) {
15259
+ history = /* @__PURE__ */ new Set();
15260
+ histories.set(registry, history);
15261
+ }
15262
+ return history;
15257
15263
  }
15258
- function persistAliases(target, aliases) {
15259
- const aliasHistory = getTrackedAliasHistory(target);
15264
+ function persistAliases(target, registry, aliases) {
15265
+ const aliasHistory = getTrackedAliasHistory(target, registry);
15260
15266
  aliases.forEach((alias) => aliasHistory.add(alias));
15261
15267
  return [...aliasHistory];
15262
15268
  }
15263
- function getCommunityRegistryAliases(community) {
15269
+ const REGISTRY_SCOPE_SEPARATOR = "\0";
15270
+ function scopeAliasesToDataPath(aliases, dataPath) {
15271
+ if (dataPath === void 0) return aliases;
15272
+ return aliases.map((alias) => `${dataPath}${REGISTRY_SCOPE_SEPARATOR}${alias}`);
15273
+ }
15274
+ function getCommunityRegistryAliases(community, dataPath) {
15264
15275
  const aliases = dedupeAliases([
15265
- community.address,
15266
15276
  community.name,
15267
15277
  community.publicKey,
15268
15278
  community.signer?.address
15269
15279
  ]);
15270
15280
  if (aliases.length === 0) throw new PKCError("ERR_COMMUNITY_REGISTRY_LOOKUP_HAS_NO_ALIASES", { community });
15271
- return dedupeAliases(aliases.flatMap((alias) => {
15281
+ return scopeAliasesToDataPath(dedupeAliases(aliases.flatMap((alias) => {
15272
15282
  if (isEthAliasDomain$1(alias)) return getEquivalentCommunityAliases(alias);
15273
15283
  return [alias];
15274
- }));
15284
+ })), dataPath);
15275
15285
  }
15276
15286
  function getCommentRegistryAliases(comment) {
15277
15287
  return dedupeAliases([comment.cid]);
15278
15288
  }
15279
- function syncCommunityRegistryEntry(registry, community) {
15289
+ function syncCommunityRegistryEntry(registry, community, dataPath) {
15280
15290
  return registry.track({
15281
15291
  value: community,
15282
- aliases: persistAliases(community, getCommunityRegistryAliases(community))
15292
+ aliases: scopeAliasesToDataPath(persistAliases(community, registry, getCommunityRegistryAliases(community)), dataPath)
15283
15293
  });
15284
15294
  }
15285
15295
  function syncCommentRegistryEntry(registry, comment) {
15286
15296
  return registry.track({
15287
15297
  value: comment,
15288
- aliases: persistAliases(comment, getCommentRegistryAliases(comment))
15298
+ aliases: persistAliases(comment, registry, getCommentRegistryAliases(comment))
15289
15299
  });
15290
15300
  }
15291
- function findCommunityInRegistry(registry, lookup) {
15292
- return registry.findByAliases(getCommunityRegistryAliases(lookup));
15301
+ function findCommunityInRegistry(registry, lookup, dataPath) {
15302
+ return registry.findByAliases(getCommunityRegistryAliases(lookup, dataPath));
15293
15303
  }
15294
15304
  function findCommentInRegistry(registry, lookup) {
15295
15305
  return registry.findByAliases(getCommentRegistryAliases(lookup));
@@ -16195,7 +16205,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
16195
16205
  }
16196
16206
  //#endregion
16197
16207
  //#region dist/node/generated-version.js
16198
- const version = "0.1.0";
16208
+ const version = "0.2.0";
16199
16209
  //#endregion
16200
16210
  //#region dist/node/version.js
16201
16211
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
@@ -1,4 +1,4 @@
1
- import { br as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-B2OWwon1.js";
1
+ import { br as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-HEMvQjxr.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { equals } from "uint8arrays/equals";
4
4
  //#region dist/node/helia/util.js
@@ -1,2 +1,2 @@
1
- import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-DuFF1_XR.js";
1
+ import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-BeKsUlS0.js";
2
2
  export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
@@ -1,7 +1,7 @@
1
- import { Ct as findStartedCommunity, L as hideClassPrivateProps, Sr as logger_default, br as PKCError, lt as replaceXWithY, rr as t, tr as n } from "../../chunks/schema-B2OWwon1.js";
2
- import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-DuFF1_XR.js";
3
- import { An as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, J as buildPagesRuntimeFields, ct as pRetry, dn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, dt as require_lib, jn as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lt as pLimit, nn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, on as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, q as buildPageRuntimeFields, rn as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, rr as t$1, rt as extractCrosspostRuntimeFields, un as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ur as stringify, vn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, yn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-Cagh_MlK.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-yooggNPK.js";
1
+ import { Ct as findStartedCommunity, L as hideClassPrivateProps, Sr as logger_default, br as PKCError, lt as replaceXWithY, rr as t, tr as n } from "../../chunks/schema-HEMvQjxr.js";
2
+ import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-BeKsUlS0.js";
3
+ import { An as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, J as buildPagesRuntimeFields, ct as pRetry, dn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, dt as require_lib, jn as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lt as pLimit, nn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, on as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, q as buildPageRuntimeFields, rn as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, rr as t$1, rt as extractCrosspostRuntimeFields, un as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ur as stringify, vn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, yn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-9ZMBP3cA.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-Buip8ns5.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -1 +1 @@
1
- export declare const version = "0.1.0";
1
+ export declare const version = "0.2.0";
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by config/generate-version.js — do not edit
2
- export const version = "0.1.0";
2
+ export const version = "0.2.0";
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -12,7 +12,6 @@ type CommunityLookup = {
12
12
  publicKey?: string;
13
13
  };
14
14
  type CommunityWithAliases = {
15
- address?: string;
16
15
  name?: string;
17
16
  publicKey?: string;
18
17
  signer?: {
@@ -22,11 +21,11 @@ type CommunityWithAliases = {
22
21
  type CommentLookup = {
23
22
  cid?: string;
24
23
  };
25
- export declare function getCommunityRegistryAliases(community: CommunityWithAliases): string[];
24
+ export declare function getCommunityRegistryAliases(community: CommunityWithAliases, dataPath?: string): string[];
26
25
  export declare function getCommentRegistryAliases(comment: CommentLookup): string[];
27
- export declare function syncCommunityRegistryEntry<T extends CommunityWithAliases>(registry: TrackedInstanceRegistry<T>, community: T): T;
26
+ export declare function syncCommunityRegistryEntry<T extends CommunityWithAliases>(registry: TrackedInstanceRegistry<T>, community: T, dataPath?: string): T;
28
27
  export declare function syncCommentRegistryEntry<T extends CommentLookup>(registry: TrackedInstanceRegistry<T>, comment: T): T;
29
- export declare function findCommunityInRegistry<T extends CommunityWithAliases>(registry: TrackedInstanceRegistry<T>, lookup: CommunityLookup): T | undefined;
28
+ export declare function findCommunityInRegistry<T extends CommunityWithAliases>(registry: TrackedInstanceRegistry<T>, lookup: CommunityLookup, dataPath?: string): T | undefined;
30
29
  export declare function findCommentInRegistry<T extends CommentLookup>(registry: TrackedInstanceRegistry<T>, lookup: CommentLookup): T | undefined;
31
30
  export declare function listRegistryValues<T extends object>(registry: TrackedInstanceRegistry<T>): T[];
32
31
  export declare function trackUpdatingCommunity(pkc: PKC, community: TrackedCommunity): TrackedCommunity;
@@ -15,44 +15,73 @@ function getEquivalentCommunityAliases(address) {
15
15
  function dedupeAliases(aliases) {
16
16
  return [...new Set(aliases.filter((alias) => typeof alias === "string" && alias.length > 0))];
17
17
  }
18
- function getTrackedAliasHistory(target) {
18
+ function getTrackedAliasHistory(target, registry) {
19
19
  const holder = target;
20
20
  if (!holder[trackedAliasHistorySymbol]) {
21
21
  Object.defineProperty(holder, trackedAliasHistorySymbol, {
22
- value: new Set(),
22
+ value: new WeakMap(),
23
23
  enumerable: false,
24
24
  configurable: false,
25
25
  writable: false
26
26
  });
27
27
  }
28
- return holder[trackedAliasHistorySymbol];
28
+ const histories = holder[trackedAliasHistorySymbol];
29
+ let history = histories.get(registry);
30
+ if (!history) {
31
+ history = new Set();
32
+ histories.set(registry, history);
33
+ }
34
+ return history;
29
35
  }
30
- function persistAliases(target, aliases) {
31
- const aliasHistory = getTrackedAliasHistory(target);
36
+ function persistAliases(target, registry, aliases) {
37
+ const aliasHistory = getTrackedAliasHistory(target, registry);
32
38
  aliases.forEach((alias) => aliasHistory.add(alias));
33
39
  return [...aliasHistory];
34
40
  }
35
- export function getCommunityRegistryAliases(community) {
36
- const aliases = dedupeAliases([community.address, community.name, community.publicKey, community.signer?.address]);
41
+ // Aliases are scoped to the dataPath they belong to when one is given. processStartedCommunities is
42
+ // a module-level registry shared by every PKC instance in the process, and the registry matches on
43
+ // ANY alias, so without a scope two LocalCommunity instances backed by different dataPaths but
44
+ // sharing an address resolve to each other: one then adopts the other's posts/updateCid through a
45
+ // signer it does not hold, and every publish after that fails signature validation (issue #238).
46
+ // The scope is a prefix rather than an extra alias on purpose — a bare dataPath alias would instead
47
+ // make every community *within* one dataPath collide.
48
+ // A registry that is already scoped by construction (the per-PKC pkc._updatingCommunities and
49
+ // pkc._startedCommunities) passes no dataPath and is left unprefixed.
50
+ const REGISTRY_SCOPE_SEPARATOR = "\u0000";
51
+ function scopeAliasesToDataPath(aliases, dataPath) {
52
+ if (dataPath === undefined)
53
+ return aliases;
54
+ return aliases.map((alias) => `${dataPath}${REGISTRY_SCOPE_SEPARATOR}${alias}`);
55
+ }
56
+ export function getCommunityRegistryAliases(community, dataPath) {
57
+ // community.address is deliberately absent: setAddress keeps it equal to `name || publicKey`, so
58
+ // it is never an identity name/publicKey does not already carry. signer.address is NOT
59
+ // redundant — communityIdentityPublicKey() is `anchor?.publicKey ?? signer.address`, so on a
60
+ // delegated community publicKey is the anchor while signer.address is the minter that signs its
61
+ // records, and both have to resolve to the instance.
62
+ const aliases = dedupeAliases([community.name, community.publicKey, community.signer?.address]);
37
63
  if (aliases.length === 0)
38
64
  throw new PKCError("ERR_COMMUNITY_REGISTRY_LOOKUP_HAS_NO_ALIASES", { community });
39
- return dedupeAliases(aliases.flatMap((alias) => {
65
+ return scopeAliasesToDataPath(dedupeAliases(aliases.flatMap((alias) => {
40
66
  if (isEthAliasDomain(alias))
41
67
  return getEquivalentCommunityAliases(alias);
42
68
  return [alias];
43
- }));
69
+ })), dataPath);
44
70
  }
45
71
  export function getCommentRegistryAliases(comment) {
46
72
  return dedupeAliases([comment.cid]);
47
73
  }
48
- export function syncCommunityRegistryEntry(registry, community) {
49
- return registry.track({ value: community, aliases: persistAliases(community, getCommunityRegistryAliases(community)) });
74
+ export function syncCommunityRegistryEntry(registry, community, dataPath) {
75
+ return registry.track({
76
+ value: community,
77
+ aliases: scopeAliasesToDataPath(persistAliases(community, registry, getCommunityRegistryAliases(community)), dataPath)
78
+ });
50
79
  }
51
80
  export function syncCommentRegistryEntry(registry, comment) {
52
- return registry.track({ value: comment, aliases: persistAliases(comment, getCommentRegistryAliases(comment)) });
81
+ return registry.track({ value: comment, aliases: persistAliases(comment, registry, getCommentRegistryAliases(comment)) });
53
82
  }
54
- export function findCommunityInRegistry(registry, lookup) {
55
- return registry.findByAliases(getCommunityRegistryAliases(lookup));
83
+ export function findCommunityInRegistry(registry, lookup, dataPath) {
84
+ return registry.findByAliases(getCommunityRegistryAliases(lookup, dataPath));
56
85
  }
57
86
  export function findCommentInRegistry(registry, lookup) {
58
87
  return registry.findByAliases(getCommentRegistryAliases(lookup));