@pkcprotocol/pkc-js 0.0.113 → 0.0.115

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 (153) hide show
  1. package/dist/browser/challenges.d.ts +1 -0
  2. package/dist/browser/challenges.js +1 -1
  3. package/dist/browser/challenges.js.map +1 -1
  4. package/dist/browser/clients/base-client-manager.js +25 -2
  5. package/dist/browser/clients/base-client-manager.js.map +1 -1
  6. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +2 -2
  7. package/dist/browser/clients/rpc-client/schema.d.ts +7 -7
  8. package/dist/browser/community/schema.d.ts +72 -72
  9. package/dist/browser/constants.d.ts +2 -1
  10. package/dist/browser/constants.js +3 -0
  11. package/dist/browser/constants.js.map +1 -1
  12. package/dist/browser/errors.d.ts +1 -0
  13. package/dist/browser/errors.js +1 -0
  14. package/dist/browser/errors.js.map +1 -1
  15. package/dist/browser/generated-version.d.ts +1 -1
  16. package/dist/browser/generated-version.js +1 -1
  17. package/dist/browser/index-with-compile-cache.d.ts +4 -4
  18. package/dist/browser/index.d.ts +8 -8
  19. package/dist/browser/page-sorts.d.ts +2 -0
  20. package/dist/browser/page-sorts.js +2 -0
  21. package/dist/browser/page-sorts.js.map +1 -0
  22. package/dist/browser/pages/page-sort-scoring.d.ts +4 -0
  23. package/dist/browser/pages/page-sort-scoring.js +20 -3
  24. package/dist/browser/pages/page-sort-scoring.js.map +1 -1
  25. package/dist/browser/pages/schema.d.ts +17 -17
  26. package/dist/browser/pkc-error.d.ts +1 -1
  27. package/dist/browser/publications/comment/schema.d.ts +18 -18
  28. package/dist/browser/publications/comment-edit/schema.d.ts +5 -5
  29. package/dist/browser/publications/comment-moderation/schema.d.ts +4 -4
  30. package/dist/browser/publications/community-edit/schema.d.ts +4 -4
  31. package/dist/browser/pubsub-messages/schema.d.ts +9 -9
  32. package/dist/browser/rpc/src/index.d.ts +2 -0
  33. package/dist/browser/rpc/src/index.js +22 -0
  34. package/dist/browser/rpc/src/index.js.map +1 -1
  35. package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +4 -4
  36. package/dist/browser/rpc/src/lib/pkc-js/index.js +3 -1
  37. package/dist/browser/rpc/src/lib/pkc-js/index.js.map +1 -1
  38. package/dist/browser/rpc/src/schema.d.ts +30 -30
  39. package/dist/browser/runtime/node/community/db-handler.d.ts +6 -0
  40. package/dist/browser/runtime/node/community/db-handler.js +38 -6
  41. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  42. package/dist/browser/runtime/node/community/local-community/challenges.js +0 -2
  43. package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
  44. package/dist/browser/runtime/node/community/local-community/editing.d.ts +2 -1
  45. package/dist/browser/runtime/node/community/local-community/editing.js +10 -7
  46. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  47. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +3 -0
  48. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  49. package/dist/browser/runtime/node/community/local-community/lifecycle.js +7 -3
  50. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  51. package/dist/browser/runtime/node/community/local-community/publication-store.js +23 -23
  52. package/dist/browser/runtime/node/community/local-community/publication-store.js.map +1 -1
  53. package/dist/browser/runtime/node/community/local-community/registry-sync.d.ts +7 -0
  54. package/dist/browser/runtime/node/community/local-community/registry-sync.js +80 -0
  55. package/dist/browser/runtime/node/community/local-community/registry-sync.js.map +1 -0
  56. package/dist/browser/runtime/node/community/local-community.d.ts +2 -1
  57. package/dist/browser/runtime/node/community/local-community.js +3 -0
  58. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  59. package/dist/browser/runtime/node/community/page-generator.js +11 -17
  60. package/dist/browser/runtime/node/community/page-generator.js.map +1 -1
  61. package/dist/browser/runtime/node/community/page-sorts/index.d.ts +9 -0
  62. package/dist/browser/runtime/node/community/page-sorts/index.js +64 -6
  63. package/dist/browser/runtime/node/community/page-sorts/index.js.map +1 -1
  64. package/dist/browser/schema/schema-util.d.ts +12 -12
  65. package/dist/browser/schema.d.ts +32 -32
  66. package/dist/browser/test/test-util.d.ts +30 -30
  67. package/dist/browser/validate-package-factories.d.ts +7 -0
  68. package/dist/browser/validate-package-factories.js +37 -0
  69. package/dist/browser/validate-package-factories.js.map +1 -0
  70. package/dist/bundled/bundle-manifest.json +68 -33
  71. package/dist/bundled/challenges.js +2 -1
  72. package/dist/bundled/chunks/{helia-for-pkc-DoOp7t8V.js → helia-for-pkc-BB8P6KYw.js} +33 -33
  73. package/dist/bundled/chunks/{local-community-CaV30etW.js → local-community-XrLSKipf.js} +172 -80
  74. package/dist/bundled/chunks/{local-community-CFX753RE.js → local-community-wAvG_J_u.js} +1 -1
  75. package/dist/bundled/chunks/{node-gyqBss4j.js → node-D5riLTOu.js} +5 -5
  76. package/dist/bundled/chunks/page-sort-scoring-3svUUHW_.js +112 -0
  77. package/dist/bundled/chunks/{rpc-local-community-DWv8wZMB.js → rpc-local-community-D5ZdqFYc.js} +80 -111
  78. package/dist/bundled/chunks/{util-B9JenRyE.js → util-CabVOL7E.js} +2 -1
  79. package/dist/bundled/chunks/{util-CH8WrVZq.js → util-Cnpgfqwn.js} +1 -1
  80. package/dist/bundled/chunks/validate-package-factories-CxIg67oP.js +41 -0
  81. package/dist/bundled/index.js +1 -1
  82. package/dist/bundled/page-sorts.js +2 -0
  83. package/dist/bundled/rpc/src/index.js +17 -4
  84. package/dist/node/challenges.d.ts +1 -0
  85. package/dist/node/challenges.js +1 -1
  86. package/dist/node/challenges.js.map +1 -1
  87. package/dist/node/clients/base-client-manager.js +25 -2
  88. package/dist/node/clients/base-client-manager.js.map +1 -1
  89. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +2 -2
  90. package/dist/node/clients/rpc-client/schema.d.ts +7 -7
  91. package/dist/node/community/schema.d.ts +72 -72
  92. package/dist/node/constants.d.ts +2 -1
  93. package/dist/node/constants.js +3 -0
  94. package/dist/node/constants.js.map +1 -1
  95. package/dist/node/errors.d.ts +1 -0
  96. package/dist/node/errors.js +1 -0
  97. package/dist/node/errors.js.map +1 -1
  98. package/dist/node/generated-version.d.ts +1 -1
  99. package/dist/node/generated-version.js +1 -1
  100. package/dist/node/index-with-compile-cache.d.ts +4 -4
  101. package/dist/node/index.d.ts +8 -8
  102. package/dist/node/page-sorts.d.ts +2 -0
  103. package/dist/node/page-sorts.js +2 -0
  104. package/dist/node/page-sorts.js.map +1 -0
  105. package/dist/node/pages/page-sort-scoring.d.ts +4 -0
  106. package/dist/node/pages/page-sort-scoring.js +20 -3
  107. package/dist/node/pages/page-sort-scoring.js.map +1 -1
  108. package/dist/node/pages/schema.d.ts +17 -17
  109. package/dist/node/pkc-error.d.ts +1 -1
  110. package/dist/node/publications/comment/schema.d.ts +18 -18
  111. package/dist/node/publications/comment-edit/schema.d.ts +5 -5
  112. package/dist/node/publications/comment-moderation/schema.d.ts +4 -4
  113. package/dist/node/publications/community-edit/schema.d.ts +4 -4
  114. package/dist/node/pubsub-messages/schema.d.ts +9 -9
  115. package/dist/node/rpc/src/index.d.ts +2 -0
  116. package/dist/node/rpc/src/index.js +22 -0
  117. package/dist/node/rpc/src/index.js.map +1 -1
  118. package/dist/node/rpc/src/lib/pkc-js/index.d.ts +4 -4
  119. package/dist/node/rpc/src/lib/pkc-js/index.js +3 -1
  120. package/dist/node/rpc/src/lib/pkc-js/index.js.map +1 -1
  121. package/dist/node/rpc/src/schema.d.ts +30 -30
  122. package/dist/node/runtime/node/community/db-handler.d.ts +6 -0
  123. package/dist/node/runtime/node/community/db-handler.js +38 -6
  124. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  125. package/dist/node/runtime/node/community/local-community/challenges.js +0 -2
  126. package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
  127. package/dist/node/runtime/node/community/local-community/editing.d.ts +2 -1
  128. package/dist/node/runtime/node/community/local-community/editing.js +10 -7
  129. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  130. package/dist/node/runtime/node/community/local-community/ipns-publishing.js +3 -0
  131. package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  132. package/dist/node/runtime/node/community/local-community/lifecycle.js +7 -3
  133. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  134. package/dist/node/runtime/node/community/local-community/publication-store.js +23 -23
  135. package/dist/node/runtime/node/community/local-community/publication-store.js.map +1 -1
  136. package/dist/node/runtime/node/community/local-community/registry-sync.d.ts +7 -0
  137. package/dist/node/runtime/node/community/local-community/registry-sync.js +80 -0
  138. package/dist/node/runtime/node/community/local-community/registry-sync.js.map +1 -0
  139. package/dist/node/runtime/node/community/local-community.d.ts +2 -1
  140. package/dist/node/runtime/node/community/local-community.js +3 -0
  141. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  142. package/dist/node/runtime/node/community/page-generator.js +11 -17
  143. package/dist/node/runtime/node/community/page-generator.js.map +1 -1
  144. package/dist/node/runtime/node/community/page-sorts/index.d.ts +9 -0
  145. package/dist/node/runtime/node/community/page-sorts/index.js +64 -6
  146. package/dist/node/runtime/node/community/page-sorts/index.js.map +1 -1
  147. package/dist/node/schema/schema-util.d.ts +12 -12
  148. package/dist/node/schema.d.ts +32 -32
  149. package/dist/node/test/test-util.d.ts +30 -30
  150. package/dist/node/validate-package-factories.d.ts +7 -0
  151. package/dist/node/validate-package-factories.js +37 -0
  152. package/dist/node/validate-package-factories.js.map +1 -0
  153. package/package.json +6 -1
@@ -1,12 +1,13 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $t as CommentModerationPubsubMessagePublicationSchema, A as isLinkOfAnimatedImage, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Bn as CommentUpdateTableRowSchema, Dn as VoteTablesRowSchema, Dt as pTimeout, F as isLinkValid, Gr as ZodError, Jn as CommentEditPubsubMessagePublicationSchema, Jt as CommunityEditPublicationPubsubReservedFields, K as removeNullUndefinedValues, Kt as version_default, Lt as DecryptedChallengeRequestPublicationSchema, M as isLinkOfImage, Mr as logger_default, Mt as ChallengeRequestMessageSchema, N as isLinkOfMedia, Ot as ChallengeAnswerMessageSchema, P as isLinkOfVideo, Pt as ChallengeVerificationMessageSchema, Q as retryKuboIpfsAddAndProvide, Qn as CommentEditsTableRowSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rt as DecryptedChallengeRequestSchema, S as hideClassPrivateProps, Sr as t$2, St as untrackStartedCommunity, Tn as VotePubsubReservedFields, Tt as require_sha256, U as removeBlocksFromKuboNode, Vn as CommentsTableRowSchema, W as removeMfsFilesSafely, X as retryKuboBlockPutPinAndProvidePubsubTopic, Xn as CommentEditReservedFields, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as getEquivalentCommunityAddresses, _r as r$1, a as calculateUnixFsDagSizeCidV0, c as contentContainsMarkdownVideos, ct as writeKuboFilesWithTimeout, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$2, en as CommentModerationReservedFields, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, fr as t$5, ft as findUpdatingCommunity, g as genToArray, h as findMalformedUnicodeString, hr as e, i as calculateStringSizeSameAsIpfsAddCidV0, it as timestamp, j as isLinkOfAudio, jn as CommentPubsubMessageReservedFields, jr as messages, lr as n$3, lt as findCommunityInRegistry, mr as e$1, nn as CommentModerationsTableRowSchema, nr as AuthorReservedFields, nt as statMfsPathSafely, o as contentContainsMarkdownAudio, ot as withSortedKeys, pr as t$6, r as calculateIpfsCidV0, s as contentContainsMarkdownImages, st as withSortedKeysDeep, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, ur as t$7, ut as findStartedCommunity, v as getErrorCodeFromMessage, vr as t$3, vt as syncCommunityRegistryEntry, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, xr as t$4, xt as trackUpdatingCommunity, y as getIpnsRecordInLocalKuboNode, yt as trackStartedCommunity } from "./util-B9JenRyE.js";
3
- import { $ as coerceSchemaRowJson, $n as getPKCAddressFromPublicKeySync, An as verifyCommentModeration, Cr as t$8, D as TIMEFRAMES_TO_SECONDS, Dr as t$9, En as verifyChallengeRequest, Fn as verifyVote, Gn as getCommunityNameFromWire, Hn as effectiveMaxCrosspostDepth, In as buildRuntimeAuthor, Jn as decode, K as pLimit, Kn as getCommunityPublicKeyFromWire, Ln as cleanWireAuthor, Mn as verifyCommentUpdate, Nn as verifyCommunity, Nr as STORAGE_KEYS, On as verifyCommentEdit, Or as stringify, Ot as parseJsonWithPKCErrorIfFails, P as iterateOverPageCidsToFindAllCids, Pn as verifyCommunityEdit, Pr as require_lodash_merge, Q as coerceSchemaRowBoolean, Qn as getPKCAddressFromPublicKey, S as LRUCache, Sr as r$2, T as KeyvBetterSqlite3, Tr as n$4, Tt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Vn as crosspostChainDepthUpTo, Yn as encode, Zn as getIpfsKeyFromPrivateKey, _ as pkcJsChallenges, _n as signCommentEdit, _r as resolveDbPostsCidRefs, a as loadPageSortsForStartedCommunity, b as createAuthorIdentityMatcher, bn as signCommentUpdateForChallengeVerification, br as t$10, c as applyPageSortExclusions, cr as deriveDbPosts, d as partitionPageCommentsForSort, dn as cleanUpBeforePublishing, er as getPublicKeyFromPrivateKey, et as collectSchemaRowCoercions, f as scorePageCommentsWithFile, fr as getThumbnailPropsOfLink, g as loadChallengeFileFromCommunityChallengeSettings, gn as signComment, gr as moveCommunityDbToDeletedDirectory, h as getCommunityChallengeFromCommunityChallengeSettings, hn as signChallengeVerification, ht as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, i as generatePagesReportingFailedSorts, ir as calculateInlineRepliesBudget, jn as verifyCommentPubsubMessage, kn as verifyCommentIpfs, l as createDescendantsLookup, ln as encryptEd25519AesGcmPublicKeyBuffer, lr as deriveDbReplies, m as getChallengeVerification, nr as backupCommunityDb, o as resolvePageSortsOrThrow, or as deleteOldCommunityInWindows, p as stripRepliesFromPageComment, pn as signChallengeMessage, pr as importSignerIntoKuboNode, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, r as derivePublicPageSorts, rn as SignerWithPublicKeyAddress, rr as calculateExpectedSignatureSize, sn as decryptEd25519AesGcmPublicKeyBuffer, sr as deriveCommentIpfsFromCommentTableRow, t as RpcLocalCommunity, tr as BackupAbortError, tt as createSchemaRowParser, u as orderPageCommentsByScore, un as _validateSignatureOfPKCRecord, ur as getDefaultCommunityDbConfig, v as authorIdentityMatcherForRequest, w as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, wn as verifyChallengeAnswer, wr as n$5, x as TrackedInstanceRegistry, xn as signCommunity, xr as t$11, y as authorNameResolveFailureReason, yn as signCommentUpdate, zn as getAuthorNameFromWire } from "./rpc-local-community-DWv8wZMB.js";
2
+ import { $t as CommentModerationPubsubMessagePublicationSchema, A as isLinkOfAnimatedImage, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Bn as CommentUpdateTableRowSchema, Dn as VoteTablesRowSchema, Dt as pTimeout, F as isLinkValid, Gr as ZodError, Jn as CommentEditPubsubMessagePublicationSchema, Jt as CommunityEditPublicationPubsubReservedFields, K as removeNullUndefinedValues, Kt as version_default, Lt as DecryptedChallengeRequestPublicationSchema, M as isLinkOfImage, Mr as logger_default, Mt as ChallengeRequestMessageSchema, N as isLinkOfMedia, Ot as ChallengeAnswerMessageSchema, P as isLinkOfVideo, Pt as ChallengeVerificationMessageSchema, Q as retryKuboIpfsAddAndProvide, Qn as CommentEditsTableRowSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rt as DecryptedChallengeRequestSchema, S as hideClassPrivateProps, Sr as t$2, St as untrackStartedCommunity, Tn as VotePubsubReservedFields, Tt as require_sha256, U as removeBlocksFromKuboNode, Vn as CommentsTableRowSchema, W as removeMfsFilesSafely, X as retryKuboBlockPutPinAndProvidePubsubTopic, Xn as CommentEditReservedFields, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as getEquivalentCommunityAddresses, _r as r$1, a as calculateUnixFsDagSizeCidV0, c as contentContainsMarkdownVideos, ct as writeKuboFilesWithTimeout, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$2, en as CommentModerationReservedFields, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, fr as t$5, ft as findUpdatingCommunity, g as genToArray, h as findMalformedUnicodeString, hr as e, i as calculateStringSizeSameAsIpfsAddCidV0, it as timestamp, j as isLinkOfAudio, jn as CommentPubsubMessageReservedFields, jr as messages, lr as n$3, lt as findCommunityInRegistry, mr as e$1, nn as CommentModerationsTableRowSchema, nr as AuthorReservedFields, nt as statMfsPathSafely, o as contentContainsMarkdownAudio, ot as withSortedKeys, pr as t$6, r as calculateIpfsCidV0, s as contentContainsMarkdownImages, st as withSortedKeysDeep, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, ur as t$7, ut as findStartedCommunity, v as getErrorCodeFromMessage, vr as t$3, vt as syncCommunityRegistryEntry, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, xr as t$4, xt as trackUpdatingCommunity, y as getIpnsRecordInLocalKuboNode, yt as trackStartedCommunity } from "./util-CabVOL7E.js";
3
+ import { $n as calculateExpectedSignatureSize, $t as SignerWithPublicKeyAddress, A as iterateOverPageCidsToFindAllCids, An as verifyCommunityEdit, Ar as require_lodash_merge, C as TIMEFRAMES_TO_SECONDS, Cr as t$9, Dn as verifyCommentPubsubMessage, En as verifyCommentModeration, Fn as getAuthorNameFromWire, Gn as encode, H as pLimit, Hn as getCommunityPublicKeyFromWire, J as coerceSchemaRowBoolean, Jn as getPKCAddressFromPublicKey, Ln as crosspostChainDepthUpTo, Mn as buildRuntimeAuthor, Nn as cleanWireAuthor, On as verifyCommentUpdate, Qn as backupCommunityDb, Rn as effectiveMaxCrosspostDepth, Sn as verifyChallengeRequest, Tn as verifyCommentIpfs, Vn as getCommunityNameFromWire, Wn as decode, X as collectSchemaRowCoercions, Xn as getPublicKeyFromPrivateKey, Y as coerceSchemaRowJson, Yn as getPKCAddressFromPublicKeySync, Z as createSchemaRowParser, Zn as BackupAbortError, _ as TrackedInstanceRegistry, _n as signCommunity, _r as t$11, a as generatePagesReportingFailedSorts, an as encryptEd25519AesGcmPublicKeyBuffer, ar as deriveDbReplies, b as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, bn as verifyChallengeAnswer, br as n$5, c as resolvePageSortsOrThrow, cr as getThumbnailPropsOfLink, d as getCommunityChallengeFromCommunityChallengeSettings, dn as signChallengeVerification, dt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, er as calculateInlineRepliesBudget, f as loadChallengeFileFromCommunityChallengeSettings, fn as signComment, fr as moveCommunityDbToDeletedDirectory, g as createAuthorIdentityMatcher, gn as signCommentUpdateForChallengeVerification, gr as t$10, h as authorNameResolveFailureReason, hn as signCommentUpdate, i as derivePublicPageSorts, ir as deriveDbPosts, jn as verifyVote, kn as verifyCommunity, kr as STORAGE_KEYS, ln as signChallengeMessage, lr as importSignerIntoKuboNode, lt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, m as authorIdentityMatcherForRequest, nr as deleteOldCommunityInWindows, o as loadPageSortsForStartedCommunity, on as _validateSignatureOfPKCRecord, or as getDefaultCommunityDbConfig, p as pkcJsChallenges, pn as signCommentEdit, pr as resolveDbPostsCidRefs, qn as getIpfsKeyFromPrivateKey, r as computePageSortsFingerprint, rn as decryptEd25519AesGcmPublicKeyBuffer, rr as deriveCommentIpfsFromCommentTableRow, s as lookupPageSortFactories, sn as cleanUpBeforePublishing, t as RpcLocalCommunity, u as getChallengeVerification, v as LRUCache, vr as r$2, wn as verifyCommentEdit, wr as stringify, wt as parseJsonWithPKCErrorIfFails, x as KeyvBetterSqlite3, xr as n$4, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yr as t$8 } from "./rpc-local-community-D5ZdqFYc.js";
4
+ import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-3svUUHW_.js";
4
5
  import { randomFillSync, randomUUID } from "node:crypto";
5
6
  import { fileURLToPath, pathToFileURL } from "node:url";
6
- import Path from "node:path";
7
+ import path from "node:path";
7
8
  import os from "os";
8
9
  import { existsSync, promises } from "node:fs";
9
- import path from "path";
10
+ import path$1 from "path";
10
11
  import assert from "assert";
11
12
  import { Buffer as Buffer$1 } from "buffer";
12
13
  import fs from "fs";
@@ -1690,15 +1691,15 @@ async function throwIfChallengeSettingsAreInvalid({ challengeSettings, pkc, comm
1690
1691
  const processStartedCommunities = new TrackedInstanceRegistry();
1691
1692
  function normalizeRegistryDataPath(dataPath) {
1692
1693
  if (dataPath === void 0) return void 0;
1693
- const resolved = path.resolve(dataPath);
1694
+ const resolved = path$1.resolve(dataPath);
1694
1695
  let existing = resolved;
1695
1696
  let tail = "";
1696
1697
  while (true) try {
1697
- return path.join(fs.realpathSync.native(existing), tail);
1698
+ return path$1.join(fs.realpathSync.native(existing), tail);
1698
1699
  } catch {
1699
- const parent = path.dirname(existing);
1700
+ const parent = path$1.dirname(existing);
1700
1701
  if (parent === existing) return resolved;
1701
- tail = path.join(path.basename(existing), tail);
1702
+ tail = path$1.join(path$1.basename(existing), tail);
1702
1703
  existing = parent;
1703
1704
  }
1704
1705
  }
@@ -2027,20 +2028,13 @@ var PageGenerator = class {
2027
2028
  });
2028
2029
  }
2029
2030
  _createRepliesLoader(load) {
2030
- let all;
2031
- const filtered = /* @__PURE__ */ new Map();
2032
- return (sort) => {
2033
- all ??= load();
2034
- const key = JSON.stringify(sort.exclusions);
2035
- if (!filtered.has(key)) filtered.set(key, applyPageSortExclusions({
2036
- comments: all,
2037
- exclusions: sort.exclusions,
2038
- communityAddress: this._community.address
2039
- }));
2040
- return filtered.get(key);
2041
- };
2031
+ let replies;
2032
+ return () => replies ??= filterRepliesForPageSort({
2033
+ replies: load(),
2034
+ communityAddress: this._community.address
2035
+ });
2042
2036
  }
2043
- _createStreamingRepliesProvider(sort) {
2037
+ _createStreamingRepliesProvider() {
2044
2038
  const db = this._community._dbHandler;
2045
2039
  const communityAddress = this._community.address;
2046
2040
  return (ordered) => {
@@ -2054,9 +2048,8 @@ var PageGenerator = class {
2054
2048
  if (index < batchStart || index >= batchEnd || !descendantsOf) {
2055
2049
  batchStart = index;
2056
2050
  batchEnd = Math.min(index + SERIALIZE_BATCH, ordered.length);
2057
- descendantsOf = createDescendantsLookup(applyPageSortExclusions({
2058
- comments: db.queryAllRepliesForPageSort({ postCids: ordered.slice(batchStart, batchEnd).map((entry) => entry.commentUpdate.cid) }),
2059
- exclusions: sort.exclusions,
2051
+ descendantsOf = createDescendantsLookup(filterRepliesForPageSort({
2052
+ replies: db.queryAllRepliesForPageSort({ postCids: ordered.slice(batchStart, batchEnd).map((entry) => entry.commentUpdate.cid) }),
2060
2053
  communityAddress
2061
2054
  }));
2062
2055
  }
@@ -2235,7 +2228,7 @@ var PageGenerator = class {
2235
2228
  scope: "posts",
2236
2229
  sorts,
2237
2230
  loadComments,
2238
- streamReplies: (sort) => this._createStreamingRepliesProvider(sort),
2231
+ streamReplies: () => this._createStreamingRepliesProvider(),
2239
2232
  source: this._dbPageEntrySource(),
2240
2233
  entryCache: this._postEntryCache,
2241
2234
  preloadedPageSizeBytes,
@@ -2722,6 +2715,7 @@ function deriveAliasOriginalAuthorSignerAddress(originalAuthorPublicKey) {
2722
2715
  }
2723
2716
  var DbHandler = class {
2724
2717
  constructor(community) {
2718
+ this._transactionGeneration = 0;
2725
2719
  this._publicationWriteGeneration = 0;
2726
2720
  this._community = community;
2727
2721
  this._transactionDepth = 0;
@@ -2832,9 +2826,31 @@ var DbHandler = class {
2832
2826
  log("Destroyed DB connection to community", this._community.address, "successfully");
2833
2827
  }
2834
2828
  createTransaction() {
2835
- if (this._transactionDepth === 0) this._db.exec("BEGIN");
2829
+ if (this._transactionDepth === 0) {
2830
+ this._db.exec("BEGIN");
2831
+ this._guardAgainstTransactionAcrossAwait();
2832
+ }
2836
2833
  this._transactionDepth++;
2837
2834
  }
2835
+ _guardAgainstTransactionAcrossAwait() {
2836
+ const transactionGeneration = ++this._transactionGeneration;
2837
+ queueMicrotask(() => {
2838
+ if (this._transactionDepth === 0 || this._transactionGeneration !== transactionGeneration) return;
2839
+ const error = /* @__PURE__ */ new Error("A DB transaction was left open across an await. Transactions must open and close synchronously (issue #417)");
2840
+ logger_default("pkc-js:local-community:db-handler:createTransaction").error(error);
2841
+ if (process.env["VITEST"]) throw error;
2842
+ });
2843
+ }
2844
+ readBackWithoutStoring(opts) {
2845
+ this._db.exec("SAVEPOINT read_back_without_storing");
2846
+ try {
2847
+ opts.write();
2848
+ return opts.read();
2849
+ } finally {
2850
+ this._db.exec("ROLLBACK TO read_back_without_storing");
2851
+ this._db.exec("RELEASE read_back_without_storing");
2852
+ }
2853
+ }
2838
2854
  commitTransaction() {
2839
2855
  if (this._transactionDepth > 0) {
2840
2856
  this._transactionDepth--;
@@ -3063,9 +3079,9 @@ var DbHandler = class {
3063
3079
  if (needToMigrate) {
3064
3080
  if (dbExistsAlready && currentDbVersion > 0) {
3065
3081
  this.destoryConnection();
3066
- backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3067
- log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
3068
- if (!fs.existsSync(path.dirname(backupDbPath))) await fs.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
3082
+ backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3083
+ log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
3084
+ if (!fs.existsSync(path$1.dirname(backupDbPath))) await fs.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
3069
3085
  const sourceDb = new Database(dbPath, { fileMustExist: true });
3070
3086
  await sourceDb.backup(backupDbPath);
3071
3087
  sourceDb.close();
@@ -5176,10 +5192,10 @@ var DbHandler = class {
5176
5192
  if (this._db || this._keyv) await this.destoryConnection();
5177
5193
  this._transactionDepth = 0;
5178
5194
  const dataPath = this._community._pkc.dataPath;
5179
- const oldPathString = path.join(dataPath, "communities", oldDbName);
5180
- const newPathString = path.join(dataPath, "communities", newDbName);
5181
- await fs.promises.mkdir(path.dirname(oldPathString), { recursive: true });
5182
- await fs.promises.mkdir(path.dirname(newPathString), { recursive: true });
5195
+ const oldPathString = path$1.join(dataPath, "communities", oldDbName);
5196
+ const newPathString = path$1.join(dataPath, "communities", newDbName);
5197
+ await fs.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
5198
+ await fs.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
5183
5199
  try {
5184
5200
  if (!fs.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
5185
5201
  else {
@@ -5201,8 +5217,8 @@ var DbHandler = class {
5201
5217
  }
5202
5218
  async lockCommunityStart(communityAddress = this._community.address) {
5203
5219
  const log = logger_default("pkc-js:local-community:db-handler:lock:start");
5204
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5205
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5220
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5221
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5206
5222
  try {
5207
5223
  await import_src.default.lock(communityDbPath, {
5208
5224
  lockfilePath,
@@ -5223,8 +5239,8 @@ var DbHandler = class {
5223
5239
  async unlockCommunityStart(communityAddress = this._community.address) {
5224
5240
  const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
5225
5241
  log.trace(`Attempting to unlock the start of community (${communityAddress})`);
5226
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5227
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5242
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5243
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5228
5244
  if (!fs.existsSync(lockfilePath) || !fs.existsSync(communityDbPath)) return;
5229
5245
  try {
5230
5246
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5235,8 +5251,8 @@ var DbHandler = class {
5235
5251
  }
5236
5252
  }
5237
5253
  async isCommunityStartLocked(communityAddress = this._community.address) {
5238
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5239
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5254
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5255
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5240
5256
  return await import_src.default.check(communityDbPath, {
5241
5257
  lockfilePath,
5242
5258
  realpath: false,
@@ -5245,8 +5261,8 @@ var DbHandler = class {
5245
5261
  }
5246
5262
  async lockCommunityState() {
5247
5263
  const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
5248
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5249
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5264
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5265
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5250
5266
  try {
5251
5267
  await import_src.default.lock(communityDbPath, {
5252
5268
  lockfilePath,
@@ -5263,8 +5279,8 @@ var DbHandler = class {
5263
5279
  }
5264
5280
  async unlockCommunityState() {
5265
5281
  const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
5266
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5267
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5282
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5283
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5268
5284
  if (!fs.existsSync(lockfilePath)) return;
5269
5285
  try {
5270
5286
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5274,7 +5290,7 @@ var DbHandler = class {
5274
5290
  }
5275
5291
  }
5276
5292
  communityDbExists() {
5277
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5293
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5278
5294
  return fs.existsSync(communityDbPath);
5279
5295
  }
5280
5296
  markCommentsAsPublishedToPostUpdates(commentCids) {
@@ -6468,13 +6484,11 @@ async function handleChallengeExchange(community, pubsubMsg) {
6468
6484
  await handleChallengeRequest(community, parsedPubsubMsg, false);
6469
6485
  } catch (e) {
6470
6486
  log.error(`Failed to process challenge request message received at (${timeReceived})`, e);
6471
- community._dbHandler.rollbackTransaction();
6472
6487
  }
6473
6488
  else if (parsedPubsubMsg.type === "CHALLENGEANSWER") try {
6474
6489
  await handleChallengeAnswer(community, parsedPubsubMsg);
6475
6490
  } catch (e) {
6476
6491
  log.error(`Failed to process challenge answer message received at (${timeReceived})`, e);
6477
- community._dbHandler.rollbackTransaction();
6478
6492
  }
6479
6493
  }
6480
6494
  //#endregion
@@ -6904,9 +6918,12 @@ async function prepareCommentEditWithAlias(community, originalEdit) {
6904
6918
  return commentEditSignedByAlias;
6905
6919
  }
6906
6920
  async function assertStoredCommentIsVerbatim(opts) {
6907
- const { community, commentCid, log } = opts;
6908
- const storedRow = community._dbHandler.queryComment(commentCid);
6909
- if (!storedRow) throw Error(`Comment ${commentCid} is missing from the DB inside the transaction that inserted it`);
6921
+ const { community, commentRow, commentCid, log } = opts;
6922
+ const storedRow = community._dbHandler.readBackWithoutStoring({
6923
+ write: () => community._dbHandler.insertComments([commentRow]),
6924
+ read: () => community._dbHandler.queryComment(commentCid)
6925
+ });
6926
+ if (!storedRow) throw Error(`Comment ${commentCid} could not be read back from the DB after inserting it`);
6910
6927
  const storedComment = deriveCommentIpfsFromCommentTableRow(storedRow);
6911
6928
  const storedCid = await calculateIpfsCidV0(stringify(storedComment));
6912
6929
  const storedValidity = await verifyCommentIpfs({
@@ -6927,9 +6944,12 @@ async function assertStoredCommentIsVerbatim(opts) {
6927
6944
  throw error;
6928
6945
  }
6929
6946
  async function assertStoredAuthorEditIsVerbatim(opts) {
6930
- const { community, commentEditRaw, authorSignerAddress, log } = opts;
6931
- const storedEdit = community._dbHandler.queryLatestAuthorEdit(commentEditRaw.commentCid, authorSignerAddress);
6932
- if (!storedEdit || storedEdit.signature.signature !== commentEditRaw.signature.signature) throw Error(`Edit of comment ${commentEditRaw.commentCid} is missing from the DB inside the transaction that inserted it`);
6947
+ const { community, editTableRow, commentEditRaw, authorSignerAddress, log } = opts;
6948
+ const storedEdit = community._dbHandler.readBackWithoutStoring({
6949
+ write: () => community._dbHandler.insertCommentEdits([editTableRow]),
6950
+ read: () => community._dbHandler.queryLatestAuthorEdit(commentEditRaw.commentCid, authorSignerAddress)
6951
+ });
6952
+ if (!storedEdit || storedEdit.signature.signature !== commentEditRaw.signature.signature) throw Error(`Edit of comment ${commentEditRaw.commentCid} could not be read back from the DB after inserting it`);
6933
6953
  const storedValidity = await _validateSignatureOfPKCRecord(storedEdit);
6934
6954
  if (storedValidity.valid) return;
6935
6955
  const error = new PKCError("ERR_COMMUNITY_CANNOT_STORE_PUBLICATION_VERBATIM", {
@@ -6962,20 +6982,14 @@ async function storeCommentEdit(community, commentEditRaw, challengeRequestId) {
6962
6982
  editTableRow.extraProps = t$10(commentEditRaw, extraPropsInEdit);
6963
6983
  }
6964
6984
  if (community._dbHandler.hasCommentEditWithSignatureEncoded(editTableRow.signature.signature)) throw new PKCError("ERR_DUPLICATE_COMMENT_EDIT", { editTableRow });
6965
- community._dbHandler.createTransaction();
6966
- try {
6967
- community._dbHandler.insertCommentEdits([editTableRow]);
6968
- if (editSignedByOriginalAuthor) await assertStoredAuthorEditIsVerbatim({
6969
- community,
6970
- commentEditRaw,
6971
- authorSignerAddress,
6972
- log
6973
- });
6974
- community._dbHandler.commitTransaction();
6975
- } catch (e) {
6976
- community._dbHandler.rollbackTransaction();
6977
- throw e;
6978
- }
6985
+ if (editSignedByOriginalAuthor) await assertStoredAuthorEditIsVerbatim({
6986
+ community,
6987
+ editTableRow,
6988
+ commentEditRaw,
6989
+ authorSignerAddress,
6990
+ log
6991
+ });
6992
+ community._dbHandler.insertCommentEdits([editTableRow]);
6979
6993
  if (commentEditRaw.deleted === true) {
6980
6994
  const isPending = commentToBeEdited.pendingApproval;
6981
6995
  const disapprovalResult = community._dbHandler._queryIsCommentApproved(commentToBeEdited);
@@ -7131,6 +7145,12 @@ async function storeComment(community, opts) {
7131
7145
  }
7132
7146
  if (challengeAggregate?.aggregatedCommentUpdate && Object.keys(challengeAggregate.aggregatedCommentUpdate).length > 0) commentRow.challengeCommentUpdate = challengeAggregate.aggregatedCommentUpdate;
7133
7147
  if (originalCommentSignatureEncoded) commentRow.originalCommentSignatureEncoded = originalCommentSignatureEncoded;
7148
+ await assertStoredCommentIsVerbatim({
7149
+ community,
7150
+ commentRow,
7151
+ commentCid,
7152
+ log
7153
+ });
7134
7154
  community._dbHandler.createTransaction();
7135
7155
  try {
7136
7156
  if (!pendingApproval) {
@@ -7139,11 +7159,6 @@ async function storeComment(community, opts) {
7139
7159
  if (typeof postNumber === "number") commentRow.postNumber = postNumber;
7140
7160
  }
7141
7161
  community._dbHandler.insertComments([commentRow]);
7142
- await assertStoredCommentIsVerbatim({
7143
- community,
7144
- commentCid,
7145
- log
7146
- });
7147
7162
  if (typeof community.settings?.maxPendingApprovalCount === "number") community._dbHandler.removeOldestPendingCommentIfWeHitMaxPendingCount(community.settings.maxPendingApprovalCount);
7148
7163
  community._dbHandler.commitTransaction();
7149
7164
  } catch (e) {
@@ -7271,6 +7286,74 @@ async function providePubsubTopicRoutingCidsIfNeeded(community, force = false) {
7271
7286
  }
7272
7287
  }
7273
7288
  //#endregion
7289
+ //#region dist/node/runtime/node/community/local-community/registry-sync.js
7290
+ const PAGE_SORTS_FINGERPRINT_KEY = STORAGE_KEYS[STORAGE_KEYS.PAGE_SORTS_FINGERPRINT];
7291
+ async function setResolvedPageSorts(community, resolved, factories) {
7292
+ const pagesSettings = community.settings?.pages;
7293
+ community._pageSorts = resolved;
7294
+ community._pageSortFactories = factories;
7295
+ community.pageSorts = derivePublicPageSorts({
7296
+ pagesSettings,
7297
+ resolved
7298
+ });
7299
+ await community._dbHandler.keyvSet(PAGE_SORTS_FINGERPRINT_KEY, computePageSortsFingerprint({
7300
+ pagesSettings,
7301
+ resolved,
7302
+ factories
7303
+ }));
7304
+ }
7305
+ const sameFactories = (a, b) => a !== void 0 && a.length === b.length && a.every((factory, i) => factory === b[i]);
7306
+ async function syncPageSortsWithRegistry(community) {
7307
+ const log = logger_default("pkc-js:local-community:registry-sync:page-sorts");
7308
+ await community._dbHandler.initDbIfNeeded();
7309
+ const pagesSettings = community.settings?.pages;
7310
+ const currentFactories = lookupPageSortFactories({
7311
+ pagesSettings,
7312
+ pkc: community._pkc
7313
+ });
7314
+ const inMemory = community._pageSorts !== void 0 && community._pageSortFactories !== void 0;
7315
+ if (inMemory && sameFactories(community._pageSortFactories, currentFactories)) return;
7316
+ const previousFingerprint = community._dbHandler.keyvGet(PAGE_SORTS_FINGERPRINT_KEY);
7317
+ const previousPublicPageSorts = stringify(community.pageSorts ?? null);
7318
+ const resolved = await loadPageSortsForStartedCommunity(community);
7319
+ const factories = community._pageSortFactories;
7320
+ const fingerprint = computePageSortsFingerprint({
7321
+ pagesSettings,
7322
+ resolved,
7323
+ factories
7324
+ });
7325
+ const changed = inMemory || previousFingerprint !== void 0 && previousFingerprint !== fingerprint;
7326
+ await setResolvedPageSorts(community, resolved, factories);
7327
+ if (changed) {
7328
+ log("Page sort factories changed in the registry, regenerating every CommentUpdate", community.address);
7329
+ community._dbHandler.forceUpdateOnAllComments();
7330
+ community._communityUpdateTrigger = true;
7331
+ } else if (stringify(community.pageSorts ?? null) !== previousPublicPageSorts) community._communityUpdateTrigger = true;
7332
+ }
7333
+ async function syncChallengesWithRegistry(community) {
7334
+ const log = logger_default("pkc-js:local-community:registry-sync:challenges");
7335
+ const challengeSettings = community.settings?.challenges;
7336
+ if (!Array.isArray(challengeSettings)) return;
7337
+ let challenges;
7338
+ try {
7339
+ challenges = await Promise.all(challengeSettings.map(async (cs) => (await getCommunityChallengeFromCommunityChallengeSettings({
7340
+ communityChallengeSettings: cs,
7341
+ pkc: community._pkc
7342
+ })).communityChallenge));
7343
+ } catch (e) {
7344
+ log.error("Could not recompute community.challenges from the registry, keeping the previous ones", community.address, e);
7345
+ return;
7346
+ }
7347
+ if (stringify(challenges) === stringify(community.challenges ?? null)) return;
7348
+ log("community.challenges changed in the registry, republishing", community.address);
7349
+ community.challenges = challenges;
7350
+ community._communityUpdateTrigger = true;
7351
+ }
7352
+ async function syncWithRegistries(community) {
7353
+ await syncChallengesWithRegistry(community);
7354
+ await syncPageSortsWithRegistry(community);
7355
+ }
7356
+ //#endregion
7274
7357
  //#region dist/node/runtime/node/community/local-community/ipns-publishing.js
7275
7358
  async function calculateNewPostUpdates(community) {
7276
7359
  const postUpdates = {};
@@ -7525,6 +7608,7 @@ async function syncIpnsWithDb(community) {
7525
7608
  community._setStartedStateWithEmission("publishing-ipns");
7526
7609
  community._clientsManager.updateKuboRpcState("publishing-ipns", kuboRpc.url);
7527
7610
  await purgeDisapprovedCommentsOlderThan(community);
7611
+ await syncWithRegistries(community);
7528
7612
  const cidsUpdatedInThisCycle = await updateCommentsAndWritePostUpdates(community);
7529
7613
  requireCommunityUpdateIfModQueueChanged(community);
7530
7614
  await updateCommunityIpnsIfNeeded(community, cidsUpdatedInThisCycle);
@@ -7742,7 +7826,9 @@ async function start(community) {
7742
7826
  pkc: community._pkc
7743
7827
  })).communityChallenge));
7744
7828
  await emitChallengeSettingsValidationErrors(community, log);
7745
- await community._loadPageSorts();
7829
+ community._pageSorts = void 0;
7830
+ community._pageSortFactories = void 0;
7831
+ await syncPageSortsWithRegistry(community);
7746
7832
  } catch (e) {
7747
7833
  await community.stop();
7748
7834
  e.details = {
@@ -8076,6 +8162,10 @@ async function parseChallengesToEdit(community, newChallengeSettings) {
8076
8162
  }
8077
8163
  async function parsePagesToEdit(community, newSettings) {
8078
8164
  await community._dbHandler.initDbIfNeeded();
8165
+ const factories = lookupPageSortFactories({
8166
+ pagesSettings: newSettings.pages,
8167
+ pkc: community._pkc
8168
+ });
8079
8169
  const resolved = await resolvePageSortsOrThrow({
8080
8170
  pagesSettings: newSettings.pages,
8081
8171
  pkc: community._pkc,
@@ -8088,13 +8178,14 @@ async function parsePagesToEdit(community, newSettings) {
8088
8178
  resolved
8089
8179
  }),
8090
8180
  resolved,
8181
+ factories,
8091
8182
  pagesChanged
8092
8183
  };
8093
8184
  }
8094
- function applyPagesEdit(community, pagesEdit) {
8185
+ async function applyPagesEdit(community, pagesEdit) {
8095
8186
  if (!pagesEdit) return;
8096
8187
  if (pagesEdit.pagesChanged) community._dbHandler.forceUpdateOnAllComments();
8097
- community._pageSorts = pagesEdit.resolved;
8188
+ await setResolvedPageSorts(community, pagesEdit.resolved, pagesEdit.factories);
8098
8189
  }
8099
8190
  async function validateNewAddressBeforeEditing(community, newAddress, log) {
8100
8191
  if (doesDomainAddressHaveCapitalLetter(newAddress)) throw new PKCError("ERR_COMMUNITY_NAME_HAS_CAPITAL_LETTER", { communityAddress: newAddress });
@@ -8136,7 +8227,7 @@ async function editPropsOnStartedCommunity(community, parsedEditOptions, pagesEd
8136
8227
  ...parsedEditOptions,
8137
8228
  _internalStateUpdateId: uniqueEditId
8138
8229
  });
8139
- applyPagesEdit(community, pagesEdit);
8230
+ await applyPagesEdit(community, pagesEdit);
8140
8231
  community._communityUpdateTrigger = true;
8141
8232
  log(`Community (${community.address}) props (${t$6(parsedEditOptions)}) has been edited. Will be including edited props in next update: `, t$10(community, t$6(parsedEditOptions)));
8142
8233
  community.emit("update", community);
@@ -8164,7 +8255,7 @@ async function editPropsOnNotStartedCommunity(community, parsedEditOptions, page
8164
8255
  const mergedInternalState = await updateDbInternalState(community, parsedEditOptions);
8165
8256
  if ("updatedAt" in mergedInternalState && mergedInternalState.updatedAt) await community.initInternalCommunityAfterFirstUpdateNoMerge(mergedInternalState);
8166
8257
  else await community.initInternalCommunityBeforeFirstUpdateNoMerge(mergedInternalState);
8167
- applyPagesEdit(community, pagesEdit);
8258
+ await applyPagesEdit(community, pagesEdit);
8168
8259
  await community._dbHandler.destoryConnection();
8169
8260
  community.emit("update", community);
8170
8261
  return community;
@@ -8216,11 +8307,11 @@ async function edit(community, newCommunityOptions) {
8216
8307
  const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
8217
8308
  function defaultExportPathFor(community, exportId) {
8218
8309
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
8219
- return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
8310
+ return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
8220
8311
  }
8221
8312
  function sourceDbPathFor(community) {
8222
8313
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
8223
- return Path.join(community._pkc.dataPath, "communities", community.address);
8314
+ return path.join(community._pkc.dataPath, "communities", community.address);
8224
8315
  }
8225
8316
  async function persistExports(community) {
8226
8317
  if (!community._dbHandler) return;
@@ -8296,9 +8387,9 @@ async function runExportTask(community, exportId, opts) {
8296
8387
  async function exportCommunityEmbedded(community, options = {}) {
8297
8388
  if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
8298
8389
  const exportId = v4();
8299
- const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
8390
+ const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
8300
8391
  const includePrivateKey = options.includePrivateKey === true;
8301
- if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
8392
+ if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
8302
8393
  communityAddress: community.address,
8303
8394
  exportPath: destPath
8304
8395
  });
@@ -8423,6 +8514,7 @@ var LocalCommunity = class extends RpcLocalCommunity {
8423
8514
  this._communityUpdateTrigger = false;
8424
8515
  this._combinedHashOfPendingCommentsCids = (0, import_sha256.sha256)("");
8425
8516
  this._pageSorts = void 0;
8517
+ this._pageSortFactories = void 0;
8426
8518
  this._publishLoopPromise = void 0;
8427
8519
  this._updateLoopPromise = void 0;
8428
8520
  this._firstUpdateAfterStart = true;
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-CaV30etW.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-XrLSKipf.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 { $ as shortifyAddress, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Ct as untrackUpdatingComment, Dt as pTimeout, E as isIpfsCid, Er as FailedToFetchCommentUpdateFromGatewaysError, Et as TimeoutError, Fn as CommentUpdateForChallengeVerificationSchema, Fr as setErrorMap, H as rejectWhenCommunityStopsOrAborts, J as replaceXWithY, Jr as stringifyPrimitive, Kr as joinValues, Kt as version_default, Mr as logger_default, Mt as ChallengeRequestMessageSchema, O as isIpns, Ot as ChallengeAnswerMessageSchema, Pt as ChallengeVerificationMessageSchema, Rn as CommentUpdateSchema, S as hideClassPrivateProps, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256, V as rejectWhenAbortSignalFires, Y as resolveWhenPredicateIsTrue, Z as retryKuboIpfsAdd, _r as r, at as waitForUpdateInCommunityInstanceWithErrorAndTimeout, b as getPostUpdateTimestampRange, bt as trackUpdatingComment, dn as CommunityIpfsSchema, dr as n$1, dt as findUpdatingComment, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, ft as findUpdatingCommunity, gt as refreshTrackedCommentAliases, hr as e$1, ht as listUpdatingCommunities, it as timestamp, jr as messages, l as createAbortError, lr as n$2, mr as e, mt as listUpdatingComments, on as CommunityAnchorSchema, pr as t$1, pt as listStartedCommunities, q as removeUndefinedValuesRecursively, qr as parsedType, rt as throwIfAbortSignalAborted, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, ut as findStartedCommunity, w as ipnsNameToIpnsOverPubsubTopic, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, yn as PubsubTopicSchema } from "./util-B9JenRyE.js";
3
- import { $n as getPKCAddressFromPublicKeySync, $t as RpcSubscriptionIdResultSchema, A as extractCommunityRuntimeFieldsFromParsedPages, An as verifyCommentModeration, Ar as NAME_RESOLVED_FALSE_TTL_MS, At as parseRpcCommentEventWithPKCErrorIfItFails, B as stripNameResolvedFromCrosspost, Bn as normalizeCreatePublicationAuthor, Bt as RpcCommunityIdentifierParamSchema, C as RemoteCommunity, Cn as signVote, Cr as t$3, Ct as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Dn as verifyChallengeVerification, Dr as t$4, Dt as parseDecryptedChallengeWithPKCErrorIfItFails, E as RepliesPages, Er as t$2, Et as parseDecryptedChallengeVerification, F as parseRawPages, Fn as verifyVote, Fr as nativeFunctions$2, Ft as RpcAnchorPublishPreparationResultSchema, Gn as getCommunityNameFromWire, Gt as RpcExportCommunityParamSchema, H as GenericStateClient, Ht as RpcEditCommunityParamSchema, I as applyNameResolvedCacheToCrosspost, In as buildRuntimeAuthor, Ir as require_undici, It as RpcAuthorNameParamSchema, J as decodeRpcChallengeAnswerPubsubMsg, Jn as decode, Jt as RpcFetchCidResultSchema, Kn as getCommunityPublicKeyFromWire, Kt as RpcExportCommunityResultSchema, L as cloneCrosspostForRuntime, Ln as cleanWireAuthor, Lt as RpcCancelExportParamSchema, M as findCommentInPageInstanceRecursively, Mn as verifyCommentUpdate, Mr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Mt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, N as findCommentInParsedPages, On as verifyCommentEdit, Ot as parseJsonWithPKCErrorIfFails, Pn as verifyCommunityEdit, Pt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Qt as RpcResolveAuthorNameResultSchema, R as collectCrosspostAuthorsToResolve, Rn as getAuthorNameFromRuntime, Rt as RpcCidParamSchema, S as LRUCache, Sn as signCommunityEdit, St as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, T as KeyvBetterSqlite3, Tn as verifyChallengeMessage, Tt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, U as InflightFetchManager, Un as buildRuntimeCommunityFields, Ut as RpcExportCommunityModLogsParamSchema, V as PKCClientsManager, Vt as RpcCommunityPageParamSchema, W as InflightResourceTypes, Wn as getCommunityAddressFromRecord, Wt as RpcExportCommunityModLogsResultSchema, X as decodeRpcChallengeRequestPubsubMsg, Xn as getBufferedPKCAddressFromPublicKey, Xt as RpcPublishChallengeAnswersParamSchema, Y as decodeRpcChallengePubsubMsg, Yt as RpcPublishAnchorRecordParamSchema, Z as decodeRpcChallengeVerificationPubsubMsg, Zt as RpcPublishedAnchorRecordResultSchema, _ as pkcJsChallenges, _n as signCommentEdit, _t as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, an as createAnchorIpnsRecord$1, ar as createKuboRpcClient, at as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, br as t$5, cn as encryptEd25519AesGcm, ct as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, dn as cleanUpBeforePublishing, dr as getDefaultDataPath, dt as parseCommunityAddressWithPKCErrorIfItFails, en as RpcSuccessResultSchema, fn as signChallengeAnswer, gn as signComment, gt as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, hr as monitorCommunitiesDirectory, in as createSigner, j as findCommentInPageInstance, jn as verifyCommentPubsubMessage, jr as NAME_RESOLVED_TRUE_TTL_MS, jt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, kn as verifyCommentIpfs, kr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, kt as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, lt as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, mn as signChallengeRequest, mr as listCommunitiesSync, mt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as require_lib$1, nt as parseCidStringSchemaWithPKCErrorIfItFails, on as decryptEd25519AesGcm, ot as parseCommentIpfsSchemaWithPKCErrorIfItFails, q as PKCTypedEmitter, qn as normalizeCommunityInputFromCommunity, qt as RpcFetchCidParamSchema, s as pkcJsPageSorts, t as RpcLocalCommunity, tn as RpcUnsubscribeParamSchema, ut as parseCommentUpdateSchemaWithPKCErrorIfItFails, vn as signCommentModeration, vr as setNativeFunctions$1, vt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, wr as n$3, wt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, x as TrackedInstanceRegistry, yr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, yt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, zt as RpcCommentRepliesPageParamSchema } from "./rpc-local-community-DWv8wZMB.js";
4
- import { s as getHeliaDebugContext } from "./util-CH8WrVZq.js";
2
+ import { $ as shortifyAddress, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Ct as untrackUpdatingComment, Dt as pTimeout, E as isIpfsCid, Er as FailedToFetchCommentUpdateFromGatewaysError, Et as TimeoutError, Fn as CommentUpdateForChallengeVerificationSchema, Fr as setErrorMap, H as rejectWhenCommunityStopsOrAborts, J as replaceXWithY, Jr as stringifyPrimitive, Kr as joinValues, Kt as version_default, Mr as logger_default, Mt as ChallengeRequestMessageSchema, O as isIpns, Ot as ChallengeAnswerMessageSchema, Pt as ChallengeVerificationMessageSchema, Rn as CommentUpdateSchema, S as hideClassPrivateProps, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256, V as rejectWhenAbortSignalFires, Y as resolveWhenPredicateIsTrue, Z as retryKuboIpfsAdd, _r as r, at as waitForUpdateInCommunityInstanceWithErrorAndTimeout, b as getPostUpdateTimestampRange, bt as trackUpdatingComment, dn as CommunityIpfsSchema, dr as n$1, dt as findUpdatingComment, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, ft as findUpdatingCommunity, gt as refreshTrackedCommentAliases, hr as e$1, ht as listUpdatingCommunities, it as timestamp, jr as messages, l as createAbortError, lr as n$2, mr as e, mt as listUpdatingComments, on as CommunityAnchorSchema, pr as t$1, pt as listStartedCommunities, q as removeUndefinedValuesRecursively, qr as parsedType, rt as throwIfAbortSignalAborted, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, ut as findStartedCommunity, w as ipnsNameToIpnsOverPubsubTopic, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, yn as PubsubTopicSchema } from "./util-CabVOL7E.js";
3
+ import { An as verifyCommunityEdit, At as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, B as InflightResourceTypes, Bn as getCommunityAddressFromRecord, Bt as RpcExportCommunityModLogsResultSchema, Cn as verifyChallengeVerification, Cr as t$4, Ct as parseDecryptedChallengeWithPKCErrorIfItFails, D as findCommentInPageInstance, Dn as verifyCommentPubsubMessage, Dr as NAME_RESOLVED_TRUE_TTL_MS, Dt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, E as extractCommunityRuntimeFieldsFromParsedPages, En as verifyCommentModeration, Er as NAME_RESOLVED_FALSE_TTL_MS, Et as parseRpcCommentEventWithPKCErrorIfItFails, Ft as RpcCommentRepliesPageParamSchema, G as decodeRpcChallengePubsubMsg, Gt as RpcPublishAnchorRecordParamSchema, Hn as getCommunityPublicKeyFromWire, Ht as RpcExportCommunityResultSchema, I as stripNameResolvedFromCrosspost, In as normalizeCreatePublicationAuthor, It as RpcCommunityIdentifierParamSchema, Jt as RpcResolveAuthorNameResultSchema, K as decodeRpcChallengeRequestPubsubMsg, Kn as getBufferedPKCAddressFromPublicKey, Kt as RpcPublishChallengeAnswersParamSchema, L as PKCClientsManager, Lt as RpcCommunityPageParamSchema, M as applyNameResolvedCacheToCrosspost, Mn as buildRuntimeAuthor, Mr as require_undici, Mt as RpcAuthorNameParamSchema, N as cloneCrosspostForRuntime, Nn as cleanWireAuthor, Nt as RpcCancelExportParamSchema, O as findCommentInPageInstanceRecursively, On as verifyCommentUpdate, Or as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Ot as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, P as collectCrosspostAuthorsToResolve, Pn as getAuthorNameFromRuntime, Pt as RpcCidParamSchema, Q as parseCidStringSchemaWithPKCErrorIfItFails, Qt as require_lib$1, R as GenericStateClient, Rt as RpcEditCommunityParamSchema, S as RepliesPages, Sr as t$2, St as parseDecryptedChallengeVerification, Tn as verifyCommentIpfs, Tr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Tt as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, U as PKCTypedEmitter, Un as normalizeCommunityInputFromCommunity, Ut as RpcFetchCidParamSchema, Vn as getCommunityNameFromWire, Vt as RpcExportCommunityParamSchema, W as decodeRpcChallengeAnswerPubsubMsg, Wn as decode, Wt as RpcFetchCidResultSchema, Xt as RpcSuccessResultSchema, Yn as getPKCAddressFromPublicKeySync, Yt as RpcSubscriptionIdResultSchema, Zt as RpcUnsubscribeParamSchema, _ as TrackedInstanceRegistry, at as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, br as n$3, bt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, cn as signChallengeAnswer, dr as monitorCommunitiesDirectory, en as createSigner, fn as signComment, ft as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, gr as t$5, hr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, ht as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, in as encryptEd25519AesGcm, it as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, j as parseRawPages, jn as verifyVote, jr as nativeFunctions$2, jt as RpcAnchorPublishPreparationResultSchema, k as findCommentInParsedPages, l as pkcJsPageSorts, mn as signCommentModeration, mr as setNativeFunctions$1, mt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as decryptEd25519AesGcm, nt as parseCommentIpfsSchemaWithPKCErrorIfItFails, ot as parseCommentUpdateSchemaWithPKCErrorIfItFails, p as pkcJsChallenges, pn as signCommentEdit, pt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, q as decodeRpcChallengeVerificationPubsubMsg, qt as RpcPublishedAnchorRecordResultSchema, sn as cleanUpBeforePublishing, sr as getDefaultDataPath, st as parseCommunityAddressWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as createAnchorIpnsRecord$1, tr as createKuboRpcClient, tt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, un as signChallengeRequest, ur as listCommunitiesSync, ut as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, v as LRUCache, vn as signCommunityEdit, vt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, wn as verifyCommentEdit, wt as parseJsonWithPKCErrorIfFails, x as KeyvBetterSqlite3, xn as verifyChallengeMessage, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, y as RemoteCommunity, yn as signVote, yr as t$3, yt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, z as InflightFetchManager, zn as buildRuntimeCommunityFields, zt as RpcExportCommunityModLogsParamSchema } from "./rpc-local-community-D5ZdqFYc.js";
4
+ import { s as getHeliaDebugContext } from "./util-Cnpgfqwn.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -8254,7 +8254,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8254
8254
  this.clients.libp2pJsClients = {};
8255
8255
  if (!this.libp2pJsClientsOptions) return;
8256
8256
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
8257
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-DoOp7t8V.js");
8257
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-BB8P6KYw.js");
8258
8258
  for (const clientOptions of this.libp2pJsClientsOptions) {
8259
8259
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
8260
8260
  ...clientOptions,
@@ -8533,7 +8533,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8533
8533
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
8534
8534
  log.trace("Received community options to create a local community instance:", options);
8535
8535
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
8536
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-CFX753RE.js");
8536
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-wAvG_J_u.js");
8537
8537
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
8538
8538
  const community = new LocalCommunity(this);
8539
8539
  if (isLocalCommunity) {