@pkcprotocol/pkc-js 0.0.125 → 0.0.127

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 (117) hide show
  1. package/dist/browser/community/community-client-manager.js +30 -9
  2. package/dist/browser/community/community-client-manager.js.map +1 -1
  3. package/dist/browser/community/community-wire.d.ts +6 -0
  4. package/dist/browser/community/community-wire.js +22 -1
  5. package/dist/browser/community/community-wire.js.map +1 -1
  6. package/dist/browser/community/remote-community.d.ts +7 -1
  7. package/dist/browser/community/remote-community.js +87 -11
  8. package/dist/browser/community/remote-community.js.map +1 -1
  9. package/dist/browser/community/rpc-remote-community.d.ts +1 -0
  10. package/dist/browser/community/rpc-remote-community.js +41 -6
  11. package/dist/browser/community/rpc-remote-community.js.map +1 -1
  12. package/dist/browser/community/schema.js +7 -1
  13. package/dist/browser/community/schema.js.map +1 -1
  14. package/dist/browser/errors.d.ts +1 -0
  15. package/dist/browser/errors.js +1 -0
  16. package/dist/browser/errors.js.map +1 -1
  17. package/dist/browser/generated-version.d.ts +1 -1
  18. package/dist/browser/generated-version.js +1 -1
  19. package/dist/browser/pages/page-size.d.ts +2 -0
  20. package/dist/browser/pages/page-size.js +11 -0
  21. package/dist/browser/pages/page-size.js.map +1 -0
  22. package/dist/browser/pages/pages-client-manager.js +2 -1
  23. package/dist/browser/pages/pages-client-manager.js.map +1 -1
  24. package/dist/browser/pages/util.js +3 -2
  25. package/dist/browser/pages/util.js.map +1 -1
  26. package/dist/browser/pkc/tracked-instance-registry-util.d.ts +1 -0
  27. package/dist/browser/pkc/tracked-instance-registry-util.js +34 -2
  28. package/dist/browser/pkc/tracked-instance-registry-util.js.map +1 -1
  29. package/dist/browser/pkc/tracked-instance-registry.d.ts +1 -0
  30. package/dist/browser/pkc/tracked-instance-registry.js +15 -0
  31. package/dist/browser/pkc/tracked-instance-registry.js.map +1 -1
  32. package/dist/browser/pkc-error.d.ts +1 -1
  33. package/dist/browser/publications/comment/comment-client-manager.d.ts +1 -0
  34. package/dist/browser/publications/comment/comment-client-manager.js +24 -4
  35. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  36. package/dist/browser/publications/comment/comment.js +6 -2
  37. package/dist/browser/publications/comment/comment.js.map +1 -1
  38. package/dist/browser/publications/publication-client-manager.d.ts +4 -1
  39. package/dist/browser/publications/publication-client-manager.js +51 -7
  40. package/dist/browser/publications/publication-client-manager.js.map +1 -1
  41. package/dist/browser/publications/publication.js +15 -1
  42. package/dist/browser/publications/publication.js.map +1 -1
  43. package/dist/browser/runtime/node/community/local-community/comment-updates.js +2 -1
  44. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  45. package/dist/browser/runtime/node/community/page-generator.js +8 -7
  46. package/dist/browser/runtime/node/community/page-generator.js.map +1 -1
  47. package/dist/browser/test/test-util.d.ts +1 -0
  48. package/dist/browser/test/test-util.js +6 -2
  49. package/dist/browser/test/test-util.js.map +1 -1
  50. package/dist/browser/util.js +6 -1
  51. package/dist/browser/util.js.map +1 -1
  52. package/dist/bundled/bundle-manifest.json +37 -36
  53. package/dist/bundled/challenges.js +1 -1
  54. package/dist/bundled/chunks/{helia-for-pkc-DXygdFt-.js → helia-for-pkc-BsXEDYPa.js} +33 -33
  55. package/dist/bundled/chunks/{local-community-Bbqx5IaD.js → local-community-FekHR-fd.js} +1 -1
  56. package/dist/bundled/chunks/{local-community-D4I0gLqX.js → local-community-WFQoW5aC.js} +35 -36
  57. package/dist/bundled/chunks/{node-oqffR7Bn.js → node-pIjburtc.js} +69 -16
  58. package/dist/bundled/chunks/{page-sort-scoring-CK4vshII.js → page-sort-scoring-Civ7TOoF.js} +1 -1
  59. package/dist/bundled/chunks/{rpc-local-community-UpO9cs7k.js → rpc-local-community-BqP9g2Rk.js} +340 -242
  60. package/dist/bundled/chunks/{util-D3vx4Na0.js → util-D5Y6i3Nn.js} +1 -1
  61. package/dist/bundled/chunks/{util-nmnnrzbz.js → util-VrWyIc1x.js} +33 -6
  62. package/dist/bundled/chunks/{validate-package-factories-DkJmLpRe.js → validate-package-factories-CJgjDTZC.js} +2 -2
  63. package/dist/bundled/index.js +1 -1
  64. package/dist/bundled/page-sorts.js +1 -1
  65. package/dist/bundled/rpc/src/index.js +4 -4
  66. package/dist/node/community/community-client-manager.js +30 -9
  67. package/dist/node/community/community-client-manager.js.map +1 -1
  68. package/dist/node/community/community-wire.d.ts +6 -0
  69. package/dist/node/community/community-wire.js +22 -1
  70. package/dist/node/community/community-wire.js.map +1 -1
  71. package/dist/node/community/remote-community.d.ts +7 -1
  72. package/dist/node/community/remote-community.js +87 -11
  73. package/dist/node/community/remote-community.js.map +1 -1
  74. package/dist/node/community/rpc-remote-community.d.ts +1 -0
  75. package/dist/node/community/rpc-remote-community.js +41 -6
  76. package/dist/node/community/rpc-remote-community.js.map +1 -1
  77. package/dist/node/community/schema.js +7 -1
  78. package/dist/node/community/schema.js.map +1 -1
  79. package/dist/node/errors.d.ts +1 -0
  80. package/dist/node/errors.js +1 -0
  81. package/dist/node/errors.js.map +1 -1
  82. package/dist/node/generated-version.d.ts +1 -1
  83. package/dist/node/generated-version.js +1 -1
  84. package/dist/node/pages/page-size.d.ts +2 -0
  85. package/dist/node/pages/page-size.js +11 -0
  86. package/dist/node/pages/page-size.js.map +1 -0
  87. package/dist/node/pages/pages-client-manager.js +2 -1
  88. package/dist/node/pages/pages-client-manager.js.map +1 -1
  89. package/dist/node/pages/util.js +3 -2
  90. package/dist/node/pages/util.js.map +1 -1
  91. package/dist/node/pkc/tracked-instance-registry-util.d.ts +1 -0
  92. package/dist/node/pkc/tracked-instance-registry-util.js +34 -2
  93. package/dist/node/pkc/tracked-instance-registry-util.js.map +1 -1
  94. package/dist/node/pkc/tracked-instance-registry.d.ts +1 -0
  95. package/dist/node/pkc/tracked-instance-registry.js +15 -0
  96. package/dist/node/pkc/tracked-instance-registry.js.map +1 -1
  97. package/dist/node/pkc-error.d.ts +1 -1
  98. package/dist/node/publications/comment/comment-client-manager.d.ts +1 -0
  99. package/dist/node/publications/comment/comment-client-manager.js +24 -4
  100. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  101. package/dist/node/publications/comment/comment.js +6 -2
  102. package/dist/node/publications/comment/comment.js.map +1 -1
  103. package/dist/node/publications/publication-client-manager.d.ts +4 -1
  104. package/dist/node/publications/publication-client-manager.js +51 -7
  105. package/dist/node/publications/publication-client-manager.js.map +1 -1
  106. package/dist/node/publications/publication.js +15 -1
  107. package/dist/node/publications/publication.js.map +1 -1
  108. package/dist/node/runtime/node/community/local-community/comment-updates.js +2 -1
  109. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  110. package/dist/node/runtime/node/community/page-generator.js +8 -7
  111. package/dist/node/runtime/node/community/page-generator.js.map +1 -1
  112. package/dist/node/test/test-util.d.ts +1 -0
  113. package/dist/node/test/test-util.js +6 -2
  114. package/dist/node/test/test-util.js.map +1 -1
  115. package/dist/node/util.js +6 -1
  116. package/dist/node/util.js.map +1 -1
  117. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $n as CommentEditSignedPropertyNames, $r as union, $t as CommentModerationChallengeRequestToEncryptSchema, A as isIpnsPath, An as CommentChallengeRequestToEncryptSchema, Ar as require_retry$1, At as ChallengeAnswerMessageSignedPropertyNames, Bn as CommentUpdateSchema, Br as require_ms$1, Bt as DecryptedChallengeSchema, C as hideClassPrivateProps, Cn as isStringDomain, Cr as r$8, Ct as untrackStartedCommunity, D as isIpfsCid, Dr as t$10, E as isAbortError, En as VotePubsubMessagePublicationSchema, Er as r$7, Et as require_sha256$1, Fn as CommentSignedPropertyNames, Fr as FailedToFetchPageIpfsFromGatewaysError, Gn as GetPageParamSchema, Gr as custom, Gt as PKCUserOptionBaseSchema, Hr as _enum, Ht as NameResolveCacheOptionsSchema, In as CommentUpdateChallengeReservedFieldNames, Ir as PKCError, It as ChallengeVerificationMessageSignedPropertyNames, Jn as isReservedObjectKey, Jr as number, Jt as CommunityEditPublicationChallengeRequestToEncryptSchema, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as ModQueuePageIpfsSchema, Kr as literal, Kt as PKCUserOptionsSchema, L as isRequestPubsubPublicationOfPost, Lr as messages, Lt as DecryptedChallengeAnswerSchema, Mn as CommentIpfsSchema, Mr as FailedToFetchCommentUpdateFromGatewaysError, Mt as ChallengeMessageSignedPropertyNames, Nr as FailedToFetchCommunityFromGatewaysError, O as isIpfsPath, On as VoteSignedPropertyNames, Or as t$9, Ot as pTimeout, Pn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Pr as FailedToFetchGenericIpfsFromGatewaysError, Pt as ChallengeRequestMessageSignedPropertyNames, Qr as string, Qt as CreateCommunityEditPublicationOptionsWithRefinementSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateForChallengeVerificationSignedPropertyNames, Rr as logger_default, S as hasTransientNetworkErrorCode, Sn as areEquivalentNames, Sr as t$11, St as trackUpdatingCommunity, T as ipnsNameToIpnsOverPubsubTopic, Tn as VoteChallengeRequestToEncryptSchema, Tr as n$8, Tt as untrackUpdatingCommunity, Ur as array, Ut as NameResolverSerializedSchema, V as raceAgainstAbort, Vn as CommentUpdateSignedPropertyNames, Vt as DecryptedChallengeVerificationSchema, Wn as CreateCommentOptionsWithRefinementSchema, Wr as boolean, Wt as PKCParsedOptionsSchema, Xr as preprocess, Xt as CommunityEditPublicationSignedPropertyNames, Yn as CommentEditChallengeRequestToEncryptSchema, Yr as object, Zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Zr as record, Zt as CommunityEditPubsubMessagePublicationSchema, _n as ExportCommunityModLogsOptionsSchema, _r as n$10, an as ChallengeFileFactorySchema, ar as AuthorReservedFields, at as timestamp, br as e$6, bt as trackStartedCommunity, cn as CommunityChallengeSettingSchema, cr as CidStringSchema, d as deepMergeRuntimeFields, dn as CommunityIpfsReservedFields, dr as CreateSignerSchema, dt as findStartedCommunity, en as CommentModerationPubsubMessagePublicationSchema, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsSchema, fr as JsonSignatureSchema, gn as CreateRpcCommunityFunctionArgumentSchema, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateRemoteCommunityFunctionArgumentSchema, hr as n$9, in as CreateCommentModerationOptionsWithRefinementSchema, ir as AuthorPubsubSchema, it as throwIfAbortSignalAborted, jn as CommentIpfsReservedFields, jr as FailedToFetchCommentIpfsFromGatewaysError, k as isIpns, kr as e$4, ln as CommunityEditOptionsSchema, lr as CommunityAddressSchema, m as extractNetworkErrorDetails, mn as CreateNewLocalCommunityUserOptionsSchema, mr as ProtocolVersionSchema, nn as CommentModerationSignedPropertyNames, nr as AuthorAddressSchema, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileSchema, or as ChallengeAnswersSchema, p as doesDomainAddressHaveCapitalLetter, pn as CommunitySignedPropertyNames, pr as PKCTimestampSchema, pt as findUpdatingCommunity, qn as PageIpfsSchema, qr as looseObject, r as calculateIpfsCidV0, rn as CommentModerationsTableRowSchema, rr as AuthorCommentIpfsReservedFields, sr as CidPathSchema, t as areEquivalentCommunityAddresses, tr as CreateCommentEditOptionsWithRefinementSchema, tt as shortifyCid, u as createAbortError, un as CommunityExportRecordsSchema, ur as CommunityAuthorChallengeReservedFieldNames, vn as PageSortFileFactorySchema, vt as refreshTrackedCommunityAliases, w as interruptibleSleep, wn as CreateVoteUserOptionsWithRefinementSchema, wr as t$12, xn as RpcRemoteCommunityUpdateEventResultSchema, xr as e$5, yn as PageSortFileSchema, yr as t$13, z as pubsubTopicToDhtKey, zn as CommentUpdateReservedFields, zr as require_supports_color } from "./util-nmnnrzbz.js";
2
+ import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, Ar as e$4, Bn as CommentUpdateReservedFields, Br as require_supports_color, C as hideClassPrivateProps, Cn as areEquivalentNames, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VotePubsubMessagePublicationSchema, Dr as r$7, Dt as require_sha256$1, E as isAbortError, En as VoteChallengeRequestToEncryptSchema, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as CreateCommentOptionsWithRefinementSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, Hn as CommentUpdateSignedPropertyNames, Ht as DecryptedChallengeVerificationSchema, In as CommentSignedPropertyNames, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as PageIpfsSchema, Jr as looseObject, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as GetPageParamSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateChallengeReservedFieldNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mn as CommentIpfsReservedFields, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentIpfsSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as CreateVoteUserOptionsWithRefinementSchema, Tr as t$12, Ur as _enum, Ut as NameResolveCacheOptionsSchema, V as raceAgainstAbort, Vn as CommentUpdateSchema, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditChallengeRequestToEncryptSchema, Xr as object, Yn as isReservedObjectKey, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as AuthorPubsubSchema, at as timestamp, bn as PageSortFileSchema, br as t$13, cr as CidPathSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as CommunityAuthorChallengeReservedFieldNames, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CommentEditSignedPropertyNames, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as CreateSignerSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as ProtocolVersionSchema, in as CommentModerationsTableRowSchema, ir as AuthorCommentIpfsReservedFields, it as throwIfAbortSignalAborted, jn as CommentChallengeRequestToEncryptSchema, jr as require_retry$1, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as VoteSignedPropertyNames, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CidStringSchema, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as PKCTimestampSchema, mt as forgetTrackedUpdatingCommunityName, nr as CreateCommentEditOptionsWithRefinementSchema, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileFactorySchema, or as AuthorReservedFields, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as JsonSignatureSchema, pt as findUpdatingCommunity, qn as ModQueuePageIpfsSchema, qr as literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorAddressSchema, sn as ChallengeFileSchema, sr as ChallengeAnswersSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tt as shortifyCid, u as createAbortError, un as CommunityEditOptionsSchema, ur as CommunityAddressSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as isStringDomain, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as pubsubTopicToDhtKey, zn as CommentUpdateForChallengeVerificationSignedPropertyNames, zr as logger_default } from "./util-VrWyIc1x.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
- import { s as validatePageSortFile } from "./page-sort-scoring-CK4vshII.js";
4
+ import { s as validatePageSortFile } from "./page-sort-scoring-Civ7TOoF.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import dns from "node:dns";
@@ -122351,6 +122351,36 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
122351
122351
  exports.TypedEmitter = __require("events").EventEmitter;
122352
122352
  }));
122353
122353
  //#endregion
122354
+ //#region dist/node/community/community-wire.js
122355
+ var import_lib = require_lib();
122356
+ const runtimeOnlyCommunityFields = [
122357
+ "address",
122358
+ "publicKey",
122359
+ "shortAddress",
122360
+ "nameResolved"
122361
+ ];
122362
+ function omitRuntimeCommunityFields(community) {
122363
+ if (!community) return {};
122364
+ return n$10(community, runtimeOnlyCommunityFields);
122365
+ }
122366
+ function getCommunityNameFromWire(community) {
122367
+ const wireCommunity = omitRuntimeCommunityFields(community);
122368
+ if (typeof wireCommunity.name === "string") return wireCommunity.name;
122369
+ if (typeof community?.address === "string" && isStringDomain(community.address)) return community.address;
122370
+ }
122371
+ function findCommunityRecordNameMismatch(opts) {
122372
+ if (!opts.requestedName) return void 0;
122373
+ const recordName = getCommunityNameFromWire(opts.record);
122374
+ if (recordName && areEquivalentCommunityAddresses(recordName, opts.requestedName)) return void 0;
122375
+ return new PKCError("ERR_COMMUNITY_RECORD_NAME_DOES_NOT_MATCH_REQUESTED_NAME", {
122376
+ requestedName: opts.requestedName,
122377
+ recordName,
122378
+ communityPublicKey: opts.communityPublicKey,
122379
+ recordUpdatedAt: opts.record.updatedAt,
122380
+ retriableError: true
122381
+ });
122382
+ }
122383
+ //#endregion
122354
122384
  //#region dist/node/clients/rpc-client/schema.js
122355
122385
  const SubscriptionIdSchema = number().positive().int();
122356
122386
  const RpcCommentEventResultSchema = object({
@@ -122971,7 +123001,6 @@ function unwrapSchema(schema, seen = /* @__PURE__ */ new Set()) {
122971
123001
  }
122972
123002
  //#endregion
122973
123003
  //#region dist/node/clients/rpc-client/decode-rpc-response-util.js
122974
- var import_lib = require_lib();
122975
123004
  function _decodeChallengeRequestId(requestId) {
122976
123005
  return fromString(requestId, "base58btc");
122977
123006
  }
@@ -124484,6 +124513,11 @@ function stripNameResolvedFromCrosspost(crosspost) {
124484
124513
  for (const level of _chainOf(crosspost)) if (level.comment.author?.nameResolved !== void 0) delete level.comment.author.nameResolved;
124485
124514
  }
124486
124515
  //#endregion
124516
+ //#region dist/node/pages/page-size.js
124517
+ const MiB = 1024 * 1024;
124518
+ const MAX_PAGE_SIZE_BYTES = 32 * MiB;
124519
+ const nextPageMaxSizeBytes = (pageMaxSizeBytes) => Math.min(pageMaxSizeBytes * 2, MAX_PAGE_SIZE_BYTES);
124520
+ //#endregion
124487
124521
  //#region dist/node/pages/util.js
124488
124522
  const TIMEFRAMES_TO_SECONDS = Object.freeze({
124489
124523
  HOUR: 3600,
@@ -124847,7 +124881,7 @@ async function iterateOverPageCidsToFindAllCids(opts) {
124847
124881
  };
124848
124882
  Array.from(new Set(Object.values(pages.pageCids ?? {}).filter((cid) => typeof cid === "string" && cid.length > 0))).forEach((cid) => enqueue(cid, FIRST_PAGE_MAX_FILE_SIZE_BYTES));
124849
124883
  const preloadedPages = "pages" in pages ? Object.values(pages.pages ?? {}) : [];
124850
- for (const preloadedPage of preloadedPages) if (typeof preloadedPage?.nextCid === "string" && preloadedPage.nextCid.length > 0) enqueue(preloadedPage.nextCid, FIRST_PAGE_MAX_FILE_SIZE_BYTES * 2);
124884
+ for (const preloadedPage of preloadedPages) if (typeof preloadedPage?.nextCid === "string" && preloadedPage.nextCid.length > 0) enqueue(preloadedPage.nextCid, nextPageMaxSizeBytes(FIRST_PAGE_MAX_FILE_SIZE_BYTES));
124851
124885
  const fetchPage = async (cid, maxSizeBytes) => {
124852
124886
  return parsePageIpfsSchemaWithPKCErrorIfItFails(parseJsonWithPKCErrorIfFails(await clientManager._fetchCidP2P(cid, {
124853
124887
  maxFileSizeBytes: maxSizeBytes,
@@ -124885,7 +124919,7 @@ async function iterateOverPageCidsToFindAllCids(opts) {
124885
124919
  visited.add(cid);
124886
124920
  queued.delete(cid);
124887
124921
  if (!page.nextCid || visited.has(page.nextCid)) continue;
124888
- const expectedNextPageSize = Math.max(maxSize * 2, FIRST_PAGE_MAX_FILE_SIZE_BYTES);
124922
+ const expectedNextPageSize = Math.max(nextPageMaxSizeBytes(maxSize), FIRST_PAGE_MAX_FILE_SIZE_BYTES);
124889
124923
  enqueue(page.nextCid, expectedNextPageSize);
124890
124924
  }
124891
124925
  }
@@ -125136,7 +125170,7 @@ var BasePagesClientsManager = class extends BaseClientsManager {
125136
125170
  }
125137
125171
  if (result.page.nextCid) {
125138
125172
  this.updatePageCidsToSortTypesToIncludeSubsequent(result.page.nextCid, pageCid);
125139
- this.updatePagesMaxSizeCache([result.page.nextCid], pageMaxSize * 2);
125173
+ this.updatePagesMaxSizeCache([result.page.nextCid], nextPageMaxSizeBytes(pageMaxSize));
125140
125174
  }
125141
125175
  return result;
125142
125176
  }
@@ -125495,224 +125529,6 @@ var ModQueuePages = class extends BasePages {
125495
125529
  }
125496
125530
  };
125497
125531
  //#endregion
125498
- //#region dist/node/runtime/node/community/keyv-better-sqlite3.js
125499
- /**
125500
- * A KeyvStoreAdapter implementation using better-sqlite3 directly
125501
- */
125502
- var KeyvBetterSqlite3 = class extends EventEmitter$1 {
125503
- constructor(db, options = {}) {
125504
- super();
125505
- this.ttlSupport = true;
125506
- this.db = db;
125507
- this.opts = {
125508
- table: "keyv",
125509
- keySize: 255,
125510
- createTable: true,
125511
- dialect: "sqlite",
125512
- url: `sqlite://${db.name}`,
125513
- ...options
125514
- };
125515
- if (this.opts.createTable) try {
125516
- this.db.exec(`
125517
- CREATE TABLE IF NOT EXISTS ${this.opts.table} (
125518
- key TEXT PRIMARY KEY,
125519
- value TEXT
125520
- )
125521
- `);
125522
- } catch (error) {
125523
- throw error;
125524
- }
125525
- }
125526
- /**
125527
- * Get a value from the store
125528
- */
125529
- get(key) {
125530
- try {
125531
- const row = this.db.prepare(`SELECT * FROM ${this.opts.table} WHERE key = ?`).get("keyv:" + key);
125532
- if (!row) return;
125533
- const parsed = JSON.parse(row.value);
125534
- if (parsed.expires && parsed.expires <= Date.now()) {
125535
- try {
125536
- this.delete(key);
125537
- } catch (e) {
125538
- e.details = {
125539
- ...e.details,
125540
- row,
125541
- parsed,
125542
- key
125543
- };
125544
- this.emit("error", e);
125545
- }
125546
- return;
125547
- }
125548
- return parsed.value;
125549
- } catch (error) {
125550
- throw error;
125551
- }
125552
- }
125553
- /**
125554
- * Get multiple values from the store
125555
- */
125556
- getMany(keys) {
125557
- try {
125558
- const placeholders = keys.map(() => "?").join(",");
125559
- const rows = this.db.prepare(`
125560
- SELECT * FROM ${this.opts.table}
125561
- WHERE key IN (${placeholders})
125562
- `).all(...keys.map((key) => "keyv:" + key));
125563
- const now = Date.now();
125564
- return keys.map((key) => {
125565
- const row = rows.find((r) => r.key === "keyv:" + key);
125566
- if (!row) return void 0;
125567
- try {
125568
- const parsed = JSON.parse(row.value);
125569
- if (parsed.expires && parsed.expires <= now) {
125570
- try {
125571
- this.delete(key);
125572
- } catch (err) {
125573
- this.emit("error", err);
125574
- }
125575
- return;
125576
- }
125577
- return parsed.value;
125578
- } catch (e) {
125579
- return;
125580
- }
125581
- });
125582
- } catch (error) {
125583
- throw error;
125584
- }
125585
- }
125586
- /**
125587
- * Set a value in the store
125588
- */
125589
- set(key, value, ttl) {
125590
- try {
125591
- const expires = typeof ttl === "number" ? Date.now() + ttl : null;
125592
- const valueWithExpires = {
125593
- value,
125594
- ...expires && { expires }
125595
- };
125596
- return this.db.prepare(`
125597
- INSERT INTO ${this.opts.table} (key, value)
125598
- VALUES (?, ?)
125599
- ON CONFLICT(key)
125600
- DO UPDATE SET value = excluded.value
125601
- `).run("keyv:" + key, JSON.stringify(valueWithExpires));
125602
- } catch (error) {
125603
- throw error;
125604
- }
125605
- }
125606
- /**
125607
- * Delete a value from the store
125608
- */
125609
- delete(key) {
125610
- try {
125611
- return this.db.prepare(`DELETE FROM ${this.opts.table} WHERE key = ?`).run("keyv:" + key).changes > 0;
125612
- } catch (error) {
125613
- throw error;
125614
- }
125615
- }
125616
- /**
125617
- * Delete multiple values from the store
125618
- */
125619
- deleteMany(keys) {
125620
- try {
125621
- const placeholders = keys.map(() => "?").join(",");
125622
- return this.db.prepare(`DELETE FROM ${this.opts.table} WHERE key IN (${placeholders})`).run(...keys.map((key) => "keyv:" + key)).changes > 0;
125623
- } catch (error) {
125624
- throw error;
125625
- }
125626
- }
125627
- /**
125628
- * Clear all values from the store
125629
- */
125630
- clear() {
125631
- try {
125632
- const stmt = this.db.prepare(this.namespace ? `DELETE FROM ${this.opts.table} WHERE key LIKE ?` : `DELETE FROM ${this.opts.table}`);
125633
- if (this.namespace) stmt.run(`${this.namespace}:%`);
125634
- else stmt.run();
125635
- } catch (error) {
125636
- throw error;
125637
- }
125638
- }
125639
- /**
125640
- * Check if a key exists in the store
125641
- */
125642
- has(key) {
125643
- try {
125644
- const row = this.db.prepare(`SELECT value FROM ${this.opts.table} WHERE key = ?`).get("keyv:" + key);
125645
- if (!row) return false;
125646
- try {
125647
- const parsed = JSON.parse(row.value);
125648
- if (parsed.expires && parsed.expires <= Date.now()) {
125649
- try {
125650
- this.delete(key);
125651
- } catch (err) {
125652
- this.emit("error", err);
125653
- }
125654
- return false;
125655
- }
125656
- return true;
125657
- } catch (e) {
125658
- return false;
125659
- }
125660
- } catch (error) {
125661
- throw error;
125662
- }
125663
- }
125664
- /**
125665
- * Iterate over all values in the store
125666
- * Note: Even though better-sqlite3 is synchronous, we need to keep this
125667
- * as an async generator to comply with the KeyvStoreAdapter interface
125668
- */
125669
- async *iterator(namespace) {
125670
- const ns = namespace || this.namespace;
125671
- const pattern = ns ? `${ns}:%` : "%";
125672
- const now = Date.now();
125673
- try {
125674
- const rows = this.db.prepare(`SELECT key, value FROM ${this.opts.table} WHERE key LIKE ?`).all(pattern);
125675
- for (const row of rows) try {
125676
- const parsed = JSON.parse(row.value);
125677
- if (parsed.expires && parsed.expires <= now) {
125678
- try {
125679
- this.delete(row.key);
125680
- } catch (err) {
125681
- this.emit("error", err);
125682
- }
125683
- continue;
125684
- }
125685
- yield [row.key, parsed.value];
125686
- } catch (e) {
125687
- continue;
125688
- }
125689
- } catch (error) {
125690
- throw error;
125691
- }
125692
- }
125693
- /**
125694
- * Disconnect from the store
125695
- */
125696
- disconnect() {}
125697
- };
125698
- //#endregion
125699
- //#region dist/node/community/community-wire.js
125700
- const runtimeOnlyCommunityFields = [
125701
- "address",
125702
- "publicKey",
125703
- "shortAddress",
125704
- "nameResolved"
125705
- ];
125706
- function omitRuntimeCommunityFields(community) {
125707
- if (!community) return {};
125708
- return n$10(community, runtimeOnlyCommunityFields);
125709
- }
125710
- function getCommunityNameFromWire(community) {
125711
- const wireCommunity = omitRuntimeCommunityFields(community);
125712
- if (typeof wireCommunity.name === "string") return wireCommunity.name;
125713
- if (typeof community?.address === "string" && isStringDomain(community.address)) return community.address;
125714
- }
125715
- //#endregion
125716
125532
  //#region dist/node/general-util/limited-set.js
125717
125533
  var LimitedSet = class {
125718
125534
  constructor(maxSize) {
@@ -126166,12 +125982,20 @@ var CommunityClientsManager = class extends PKCClientsManager {
126166
125982
  this._community.nameResolved = newNameResolved;
126167
125983
  if (typeof this._community.updatedAt === "number") this._community.emit("update", this._community);
126168
125984
  };
125985
+ const nameStillIdentifiesCommunity = () => {
125986
+ const identifyingName = isStringDomain(this._community.address) ? this._community.address : this._community.name;
125987
+ return Boolean(identifyingName && areEquivalentCommunityAddresses(identifyingName, name));
125988
+ };
126169
125989
  this._nameResolveInFlight = true;
126170
125990
  this._resolveCommunityNameWithoutUpdatingState({
126171
125991
  communityName: name,
126172
125992
  abortSignal: this._community._getStopAbortSignal(),
126173
125993
  cache: { maxAge: 3600 }
126174
125994
  }).then((resolved) => {
125995
+ if (!nameStillIdentifiesCommunity()) {
125996
+ log.trace(`Ignoring the resolve of ${name}: it no longer identifies community ${this._community.address}`);
125997
+ return;
125998
+ }
126175
125999
  if (resolved && resolved !== this._community.publicKey) {
126176
126000
  if (this._nonAnchorHopsOfLoadedChain()?.includes(resolved)) {
126177
126001
  log(`Community name ${name} resolves to ${resolved}, a non-anchor hop of the community's own chain, instead of its identity ${this._community.publicKey}. Marking nameResolved false`);
@@ -126185,8 +126009,9 @@ var CommunityClientsManager = class extends PKCClientsManager {
126185
126009
  } else if (resolved) setNameResolvedAndEmitUpdate(true);
126186
126010
  if (!resolved && this._community.name) setNameResolvedAndEmitUpdate(false);
126187
126011
  }).catch((e) => {
126188
- if (e instanceof PKCError && (e.code === "ERR_DOMAIN_TXT_RECORD_NOT_FOUND" || e.code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS")) setNameResolvedAndEmitUpdate(false);
126189
- else if (isAbortError(e)) return;
126012
+ if (e instanceof PKCError && (e.code === "ERR_DOMAIN_TXT_RECORD_NOT_FOUND" || e.code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS")) {
126013
+ if (nameStillIdentifiesCommunity()) setNameResolvedAndEmitUpdate(false);
126014
+ } else if (isAbortError(e)) return;
126190
126015
  else {
126191
126016
  log.trace("Background name resolution failed for", name, e);
126192
126017
  this._nameResolveFailedAtMs = Date.now();
@@ -126237,7 +126062,8 @@ var CommunityClientsManager = class extends PKCClientsManager {
126237
126062
  abortSignal: this._community._getStopAbortSignal(),
126238
126063
  cache: { maxAge: 3600 }
126239
126064
  });
126240
- if (!isDomain && this._community.name && this._community.publicKey && this._community.nameResolved !== true) this._resolveNameInBackground(this._community.name);
126065
+ const nameToVerify = this._community.name ?? (this._community.raw.communityIpfs ? void 0 : this._community._nameToResolveBeforeFirstRecord);
126066
+ if (!isDomain && nameToVerify && this._community.publicKey && this._community.nameResolved !== true) this._resolveNameInBackground(nameToVerify);
126241
126067
  if (!ipnsName) throw Error("Failed to resolve community address to an IPNS name");
126242
126068
  if (this._community.ipnsName !== ipnsName) {
126243
126069
  this._community.ipnsName = ipnsName;
@@ -126277,6 +126103,8 @@ var CommunityClientsManager = class extends PKCClientsManager {
126277
126103
  publicKey: identityPublicKey,
126278
126104
  name: subRes.community.name
126279
126105
  };
126106
+ const previousForKey = this._pkc._memCaches.communityForPublishing.get(identityPublicKey, { allowStale: true });
126107
+ if (previousForKey?.name && (!communityForPublishing.name || !areEquivalentCommunityAddresses(previousForKey.name, communityForPublishing.name))) this._pkc._memCaches.communityForPublishing.delete(previousForKey.name);
126280
126108
  this._pkc._memCaches.communityForPublishing.set(anchorIdentityAddress, communityForPublishing);
126281
126109
  if (anchorIdentityAddress !== identityPublicKey) this._pkc._memCaches.communityForPublishing.set(identityPublicKey, communityForPublishing);
126282
126110
  }
@@ -126668,7 +126496,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
126668
126496
  const recordAddress = this._deriveAddressFromWireRecord(communityJson);
126669
126497
  const addressMatchesInstance = this._areEquivalentCommunityAddresses(recordAddress, communityInstanceAddress);
126670
126498
  const addressMatchesPublicKey = this._community.publicKey ? this._areEquivalentCommunityAddresses(recordAddress, this._community.publicKey) : false;
126671
- const signatureKeyMatchesTerminal = !isStringDomain(communityInstanceAddress) ? this._areEquivalentCommunityAddresses(getPKCAddressFromPublicKeySync(communityJson.signature.publicKey), terminalIpnsName) : false;
126499
+ const signatureKeyMatchesTerminal = this._areEquivalentCommunityAddresses(getPKCAddressFromPublicKeySync(communityJson.signature.publicKey), terminalIpnsName);
126672
126500
  if (!addressMatchesInstance && !addressMatchesPublicKey && !signatureKeyMatchesTerminal) return new PKCError("ERR_THE_COMMUNITY_IPNS_RECORD_POINTS_TO_DIFFERENT_ADDRESS_THAN_WE_EXPECTED", {
126673
126501
  reason: "Community record signer does not match the loaded address, the community publicKey (anchor), or the terminal (minter) IPNS name of the resolved chain",
126674
126502
  recordSignerAddress: recordAddress,
@@ -126710,7 +126538,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
126710
126538
  };
126711
126539
  //#endregion
126712
126540
  //#region dist/node/community/remote-community.js
126713
- var RemoteCommunity = class extends import_lib.TypedEmitter {
126541
+ var RemoteCommunity = class RemoteCommunity extends import_lib.TypedEmitter {
126714
126542
  constructor(pkc) {
126715
126543
  super();
126716
126544
  this.startedState = "stopped";
@@ -126718,6 +126546,8 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
126718
126546
  this._updatingCommunityInstanceWithListeners = void 0;
126719
126547
  this._numOfListenersForUpdatingInstance = 0;
126720
126548
  this._pendingWarmStartKeyMigration = void 0;
126549
+ this._lastRefusedRecordUpdatedAt = void 0;
126550
+ this._nameToResolveBeforeFirstRecord = void 0;
126721
126551
  this._pkc = pkc;
126722
126552
  this._setState("stopped");
126723
126553
  this._updatingState = "stopped";
@@ -126925,8 +126755,14 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
126925
126755
  else if (newProps.signature?.publicKey) this.publicKey = getPKCAddressFromPublicKeySync(newProps.signature.publicKey);
126926
126756
  else if (explicitPublicKey) this.publicKey = explicitPublicKey;
126927
126757
  else if (!this.publicKey && "address" in newProps && typeof newProps.address === "string" && !isStringDomain(newProps.address)) this.publicKey = newProps.address;
126928
- if (typeof newProps.name === "string") this.name = newProps.name;
126758
+ const nameBeforeProps = this.name;
126759
+ if (newProps.signature && !("publicKey" in newProps)) this.name = getCommunityNameFromWire(newProps);
126760
+ else if (typeof newProps.name === "string") this.name = newProps.name;
126929
126761
  else if (!this.name && "address" in newProps && typeof newProps.address === "string" && isStringDomain(newProps.address)) this.name = newProps.address;
126762
+ if (nameBeforeProps !== void 0 && (this.name === void 0 || !areEquivalentCommunityAddresses(this.name, nameBeforeProps))) {
126763
+ this.nameResolved = void 0;
126764
+ forgetTrackedUpdatingCommunityName(this._pkc, this, nameBeforeProps);
126765
+ }
126930
126766
  if (!this.address) {
126931
126767
  const explicitAddress = "address" in newProps ? newProps.address : void 0;
126932
126768
  const derivedAddress = this.name || this.publicKey || explicitPublicKey || explicitAddress;
@@ -127074,6 +126910,22 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127074
126910
  }
127075
126911
  return true;
127076
126912
  }
126913
+ _requestedName() {
126914
+ return this.address && isStringDomain(this.address) ? this.address : void 0;
126915
+ }
126916
+ _findRecordNameMismatch(record) {
126917
+ return findCommunityRecordNameMismatch({
126918
+ requestedName: this._requestedName(),
126919
+ record,
126920
+ communityPublicKey: this.publicKey
126921
+ });
126922
+ }
126923
+ _refuseRecordWithMismatchedName(error, record) {
126924
+ if (this._lastRefusedRecordUpdatedAt === record.updatedAt) return;
126925
+ this._lastRefusedRecordUpdatedAt = record.updatedAt;
126926
+ logger_default("pkc-js:remote-community:_refuseRecordWithMismatchedName")(`Community ${this.address} refused the record with updatedAt ${record.updatedAt}: it claims the name`, error.details.recordName, "instead of", error.details.requestedName);
126927
+ this.emit("error", error);
126928
+ }
127077
126929
  _setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible() {
127078
126930
  const log = logger_default("pkc-js:remote-community:_setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible");
127079
126931
  const updatingCommunity = findUpdatingCommunity(this._pkc, {
@@ -127089,32 +126941,41 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127089
126941
  log.trace(`New Remote Community instance`, this.address, `skipped warm start from pkc._updatingCommunities[${this.address}]: tracked instance is keyed to`, updatingCommunity.publicKey, `while the caller requested`, this.publicKey, `- deferring key-migration announcement to update()`);
127090
126942
  return;
127091
126943
  }
126944
+ if (this._findRecordNameMismatch(updatingCommunity.raw.communityIpfs)) return;
127092
126945
  const nameResolvedBeforeAdoption = this.nameResolved;
126946
+ const nameBeforeAdoption = this.name;
127093
126947
  this.initCommunityIpfsPropsNoMerge(updatingCommunity.raw.communityIpfs);
127094
126948
  this.updateCid = updatingCommunity.updateCid;
127095
- this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeAdoption);
126949
+ this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeAdoption, nameBeforeAdoption);
127096
126950
  log.trace(`New Remote Community instance`, this.address, `will use CommunityIpfs from pkc._updatingCommunities[${this.address}] with updatedAt`, this.updatedAt, "that's", timestamp() - this.updatedAt, "seconds old");
127097
126951
  this.emit("update", this);
127098
126952
  }
127099
126953
  }
127100
- _adoptMirroredNameResolved(source, nameResolvedBeforeMirror) {
127101
- if (this.name === source.name) {
126954
+ _adoptMirroredNameResolved(source, nameResolvedBeforeMirror, nameBeforeMirror) {
126955
+ const nameTheSourceClassified = source.address && isStringDomain(source.address) ? source.address : source.name;
126956
+ if (this.name && nameTheSourceClassified && areEquivalentCommunityAddresses(this.name, nameTheSourceClassified)) {
127102
126957
  if (typeof source.nameResolved === "boolean") this.nameResolved = source.nameResolved;
127103
- } else this.nameResolved = nameResolvedBeforeMirror;
126958
+ } else if (this.name && nameBeforeMirror && areEquivalentCommunityAddresses(this.name, nameBeforeMirror)) this.nameResolved = nameResolvedBeforeMirror;
126959
+ else this.nameResolved = void 0;
127104
126960
  }
127105
126961
  _initCommunityInstanceWithListeners(communityInstance) {
127106
126962
  const log = logger_default("pkc-js:remote-community:update");
127107
126963
  return {
127108
126964
  community: communityInstance,
127109
126965
  update: () => {
126966
+ if (communityInstance.raw.communityIpfs && communityInstance.updateCid) {
126967
+ const nameMismatch = this._findRecordNameMismatch(communityInstance.raw.communityIpfs);
126968
+ if (nameMismatch) return this._refuseRecordWithMismatchedName(nameMismatch, communityInstance.raw.communityIpfs);
126969
+ }
127110
126970
  const nameResolvedBeforeMirror = this.nameResolved;
126971
+ const nameBeforeMirror = this.name;
127111
126972
  if (!communityInstance.raw.communityIpfs || !communityInstance.updateCid) {
127112
126973
  if (communityInstance.publicKey) this._clearDataForKeyMigration(communityInstance.publicKey);
127113
126974
  } else {
127114
126975
  this.initCommunityIpfsPropsNoMerge(communityInstance.raw.communityIpfs);
127115
126976
  this.updateCid = communityInstance.updateCid;
127116
126977
  }
127117
- this._adoptMirroredNameResolved(communityInstance, nameResolvedBeforeMirror);
126978
+ this._adoptMirroredNameResolved(communityInstance, nameResolvedBeforeMirror, nameBeforeMirror);
127118
126979
  log(`Remote Community instance`, this.address, `received update event from pkc._updatingCommunities[${this.address}] with updatedAt`, this.updatedAt, "that's", timestamp() - this.updatedAt, "seconds old");
127119
126980
  this.emit("update", this);
127120
126981
  },
@@ -127141,6 +127002,7 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127141
127002
  publicKey: this.publicKey
127142
127003
  } : { address: this.address };
127143
127004
  const updatingCommunity = await this._pkc.createCommunity(createOpts);
127005
+ if (this._nameToResolveBeforeFirstRecord && updatingCommunity instanceof RemoteCommunity && !updatingCommunity.raw.communityIpfs) updatingCommunity._nameToResolveBeforeFirstRecord = this._nameToResolveBeforeFirstRecord;
127144
127006
  communityInstance = trackUpdatingCommunity(this._pkc, updatingCommunity);
127145
127007
  log("Creating a new entry for this._pkc._updatingCommunities", this.address);
127146
127008
  }
@@ -127169,8 +127031,9 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127169
127031
  this._announcePendingWarmStartKeyMigrationIfAny();
127170
127032
  }
127171
127033
  if (communityInstance.raw.communityIpfs && (this.updatedAt ?? 0) < communityInstance.raw.communityIpfs.updatedAt && this._updatingCommunityInstanceWithListeners) {
127034
+ const updatedAtBeforeReplay = this.updatedAt;
127172
127035
  this._updatingCommunityInstanceWithListeners.update(communityInstance);
127173
- return true;
127036
+ return this.updatedAt !== updatedAtBeforeReplay;
127174
127037
  }
127175
127038
  return false;
127176
127039
  }
@@ -127225,6 +127088,7 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127225
127088
  if (this.state !== "updating") throw new PKCError("ERR_CALLED_COMMUNITY_STOP_WITHOUT_UPDATE", { address: this.address });
127226
127089
  logger_default("pkc-js:remote-community:stop");
127227
127090
  this._abortStopOperations(`Aborting community operations for ${this.address} because community.stop() was called`);
127091
+ this._lastRefusedRecordUpdatedAt = void 0;
127228
127092
  if (this._updatingCommunityInstanceWithListeners) await this._cleanUpUpdatingCommunityInstanceWithListeners();
127229
127093
  else {
127230
127094
  await this._clientsManager.stopUpdatingLoop();
@@ -127255,6 +127119,207 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127255
127119
  }
127256
127120
  };
127257
127121
  //#endregion
127122
+ //#region dist/node/runtime/node/community/keyv-better-sqlite3.js
127123
+ /**
127124
+ * A KeyvStoreAdapter implementation using better-sqlite3 directly
127125
+ */
127126
+ var KeyvBetterSqlite3 = class extends EventEmitter$1 {
127127
+ constructor(db, options = {}) {
127128
+ super();
127129
+ this.ttlSupport = true;
127130
+ this.db = db;
127131
+ this.opts = {
127132
+ table: "keyv",
127133
+ keySize: 255,
127134
+ createTable: true,
127135
+ dialect: "sqlite",
127136
+ url: `sqlite://${db.name}`,
127137
+ ...options
127138
+ };
127139
+ if (this.opts.createTable) try {
127140
+ this.db.exec(`
127141
+ CREATE TABLE IF NOT EXISTS ${this.opts.table} (
127142
+ key TEXT PRIMARY KEY,
127143
+ value TEXT
127144
+ )
127145
+ `);
127146
+ } catch (error) {
127147
+ throw error;
127148
+ }
127149
+ }
127150
+ /**
127151
+ * Get a value from the store
127152
+ */
127153
+ get(key) {
127154
+ try {
127155
+ const row = this.db.prepare(`SELECT * FROM ${this.opts.table} WHERE key = ?`).get("keyv:" + key);
127156
+ if (!row) return;
127157
+ const parsed = JSON.parse(row.value);
127158
+ if (parsed.expires && parsed.expires <= Date.now()) {
127159
+ try {
127160
+ this.delete(key);
127161
+ } catch (e) {
127162
+ e.details = {
127163
+ ...e.details,
127164
+ row,
127165
+ parsed,
127166
+ key
127167
+ };
127168
+ this.emit("error", e);
127169
+ }
127170
+ return;
127171
+ }
127172
+ return parsed.value;
127173
+ } catch (error) {
127174
+ throw error;
127175
+ }
127176
+ }
127177
+ /**
127178
+ * Get multiple values from the store
127179
+ */
127180
+ getMany(keys) {
127181
+ try {
127182
+ const placeholders = keys.map(() => "?").join(",");
127183
+ const rows = this.db.prepare(`
127184
+ SELECT * FROM ${this.opts.table}
127185
+ WHERE key IN (${placeholders})
127186
+ `).all(...keys.map((key) => "keyv:" + key));
127187
+ const now = Date.now();
127188
+ return keys.map((key) => {
127189
+ const row = rows.find((r) => r.key === "keyv:" + key);
127190
+ if (!row) return void 0;
127191
+ try {
127192
+ const parsed = JSON.parse(row.value);
127193
+ if (parsed.expires && parsed.expires <= now) {
127194
+ try {
127195
+ this.delete(key);
127196
+ } catch (err) {
127197
+ this.emit("error", err);
127198
+ }
127199
+ return;
127200
+ }
127201
+ return parsed.value;
127202
+ } catch (e) {
127203
+ return;
127204
+ }
127205
+ });
127206
+ } catch (error) {
127207
+ throw error;
127208
+ }
127209
+ }
127210
+ /**
127211
+ * Set a value in the store
127212
+ */
127213
+ set(key, value, ttl) {
127214
+ try {
127215
+ const expires = typeof ttl === "number" ? Date.now() + ttl : null;
127216
+ const valueWithExpires = {
127217
+ value,
127218
+ ...expires && { expires }
127219
+ };
127220
+ return this.db.prepare(`
127221
+ INSERT INTO ${this.opts.table} (key, value)
127222
+ VALUES (?, ?)
127223
+ ON CONFLICT(key)
127224
+ DO UPDATE SET value = excluded.value
127225
+ `).run("keyv:" + key, JSON.stringify(valueWithExpires));
127226
+ } catch (error) {
127227
+ throw error;
127228
+ }
127229
+ }
127230
+ /**
127231
+ * Delete a value from the store
127232
+ */
127233
+ delete(key) {
127234
+ try {
127235
+ return this.db.prepare(`DELETE FROM ${this.opts.table} WHERE key = ?`).run("keyv:" + key).changes > 0;
127236
+ } catch (error) {
127237
+ throw error;
127238
+ }
127239
+ }
127240
+ /**
127241
+ * Delete multiple values from the store
127242
+ */
127243
+ deleteMany(keys) {
127244
+ try {
127245
+ const placeholders = keys.map(() => "?").join(",");
127246
+ return this.db.prepare(`DELETE FROM ${this.opts.table} WHERE key IN (${placeholders})`).run(...keys.map((key) => "keyv:" + key)).changes > 0;
127247
+ } catch (error) {
127248
+ throw error;
127249
+ }
127250
+ }
127251
+ /**
127252
+ * Clear all values from the store
127253
+ */
127254
+ clear() {
127255
+ try {
127256
+ const stmt = this.db.prepare(this.namespace ? `DELETE FROM ${this.opts.table} WHERE key LIKE ?` : `DELETE FROM ${this.opts.table}`);
127257
+ if (this.namespace) stmt.run(`${this.namespace}:%`);
127258
+ else stmt.run();
127259
+ } catch (error) {
127260
+ throw error;
127261
+ }
127262
+ }
127263
+ /**
127264
+ * Check if a key exists in the store
127265
+ */
127266
+ has(key) {
127267
+ try {
127268
+ const row = this.db.prepare(`SELECT value FROM ${this.opts.table} WHERE key = ?`).get("keyv:" + key);
127269
+ if (!row) return false;
127270
+ try {
127271
+ const parsed = JSON.parse(row.value);
127272
+ if (parsed.expires && parsed.expires <= Date.now()) {
127273
+ try {
127274
+ this.delete(key);
127275
+ } catch (err) {
127276
+ this.emit("error", err);
127277
+ }
127278
+ return false;
127279
+ }
127280
+ return true;
127281
+ } catch (e) {
127282
+ return false;
127283
+ }
127284
+ } catch (error) {
127285
+ throw error;
127286
+ }
127287
+ }
127288
+ /**
127289
+ * Iterate over all values in the store
127290
+ * Note: Even though better-sqlite3 is synchronous, we need to keep this
127291
+ * as an async generator to comply with the KeyvStoreAdapter interface
127292
+ */
127293
+ async *iterator(namespace) {
127294
+ const ns = namespace || this.namespace;
127295
+ const pattern = ns ? `${ns}:%` : "%";
127296
+ const now = Date.now();
127297
+ try {
127298
+ const rows = this.db.prepare(`SELECT key, value FROM ${this.opts.table} WHERE key LIKE ?`).all(pattern);
127299
+ for (const row of rows) try {
127300
+ const parsed = JSON.parse(row.value);
127301
+ if (parsed.expires && parsed.expires <= now) {
127302
+ try {
127303
+ this.delete(row.key);
127304
+ } catch (err) {
127305
+ this.emit("error", err);
127306
+ }
127307
+ continue;
127308
+ }
127309
+ yield [row.key, parsed.value];
127310
+ } catch (e) {
127311
+ continue;
127312
+ }
127313
+ } catch (error) {
127314
+ throw error;
127315
+ }
127316
+ }
127317
+ /**
127318
+ * Disconnect from the store
127319
+ */
127320
+ disconnect() {}
127321
+ };
127322
+ //#endregion
127258
127323
  //#region node_modules/lru-cache/dist/esm/index.js
127259
127324
  /**
127260
127325
  * @module LRUCache
@@ -128379,6 +128444,17 @@ var TrackedInstanceRegistry = class {
128379
128444
  } else this._aliases.set(alias, new Set([value]));
128380
128445
  }
128381
128446
  }
128447
+ removeAliases(value, aliases) {
128448
+ const entry = this._entries.get(value);
128449
+ if (!entry) return;
128450
+ for (const alias of aliases) {
128451
+ if (!entry.delete(alias)) continue;
128452
+ const trackedValues = this._aliases.get(alias);
128453
+ if (!trackedValues) continue;
128454
+ trackedValues.delete(value);
128455
+ if (trackedValues.size === 0) this._aliases.delete(alias);
128456
+ }
128457
+ }
128382
128458
  untrack(value) {
128383
128459
  const aliases = this._entries.get(value);
128384
128460
  if (!aliases) return;
@@ -130960,6 +131036,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
130960
131036
  const { updatingState: newUpdatingState, ...runtimeFieldsWithoutUpdatingState } = updateRecord.runtimeFields;
130961
131037
  this.raw.runtimeFieldsFromRpc = runtimeFieldsWithoutUpdatingState;
130962
131038
  deepMergeRuntimeFields(this, runtimeFieldsWithoutUpdatingState);
131039
+ if (runtimeFieldsWithoutUpdatingState.nameResolved === void 0) this.nameResolved = void 0;
130963
131040
  this._changeStateEmitEventEmitStateChangeEvent({
130964
131041
  event: {
130965
131042
  name: "update",
@@ -130980,8 +131057,13 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
130980
131057
  error: (err) => this.emit("error", err),
130981
131058
  updatingstatechange: (updatingState) => this._setUpdatingStateWithEventEmissionIfNewState.bind(this)(updatingState),
130982
131059
  update: (updatingCommunity) => {
131060
+ if (updatingCommunity.raw.communityIpfs && updatingCommunity.updateCid) {
131061
+ const nameMismatch = this._findRecordNameMismatch(updatingCommunity.raw.communityIpfs);
131062
+ if (nameMismatch) return this._refuseRecordWithMismatchedName(nameMismatch, updatingCommunity.raw.communityIpfs);
131063
+ }
130983
131064
  const keyChanged = updatingCommunity.publicKey && updatingCommunity.publicKey !== this.publicKey;
130984
131065
  const nameResolvedBeforeMirror = this.nameResolved;
131066
+ const nameBeforeMirror = this.name;
130985
131067
  if (!updatingCommunity.raw.communityIpfs || !updatingCommunity.updateCid) {
130986
131068
  if (updatingCommunity.publicKey) this._clearDataForKeyMigration(updatingCommunity.publicKey);
130987
131069
  } else {
@@ -130990,7 +131072,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
130990
131072
  this.updateCid = updatingCommunity.updateCid;
130991
131073
  if (updatingCommunity.raw.runtimeFieldsFromRpc) deepMergeRuntimeFields(this, updatingCommunity.raw.runtimeFieldsFromRpc);
130992
131074
  }
130993
- this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeMirror);
131075
+ this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeMirror, nameBeforeMirror);
130994
131076
  if (updatingCommunity.raw.communityIpfs && updatingCommunity.updateCid || keyChanged) this.emit("update", this);
130995
131077
  },
130996
131078
  statechange: async (newState) => {
@@ -131014,7 +131096,15 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131014
131096
  const clientKeys = t$13(this.clients);
131015
131097
  for (const clientType of clientKeys) if (updatingCommunity.clients[clientType]) for (const clientUrl of Object.keys(updatingCommunity.clients[clientType])) this.clients[clientType][clientUrl].mirror(updatingCommunity.clients[clientType][clientUrl]);
131016
131098
  this._updatingRpcCommunityInstanceWithListeners.community._numOfListenersForUpdatingInstance++;
131099
+ if (updatingCommunity.raw.communityIpfs && updatingCommunity.updateCid) {
131100
+ const nameMismatch = this._findRecordNameMismatch(updatingCommunity.raw.communityIpfs);
131101
+ if (nameMismatch) {
131102
+ this._refuseRecordWithMismatchedName(nameMismatch, updatingCommunity.raw.communityIpfs);
131103
+ return;
131104
+ }
131105
+ }
131017
131106
  const nameResolvedBeforeMirror = this.nameResolved;
131107
+ const nameBeforeMirror = this.name;
131018
131108
  if (!updatingCommunity.raw.communityIpfs || !updatingCommunity.updateCid) {
131019
131109
  if (updatingCommunity.publicKey) this._clearDataForKeyMigration(updatingCommunity.publicKey);
131020
131110
  } else {
@@ -131023,7 +131113,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131023
131113
  this.updateCid = updatingCommunity.updateCid;
131024
131114
  if (updatingCommunity.raw.runtimeFieldsFromRpc) deepMergeRuntimeFields(this, updatingCommunity.raw.runtimeFieldsFromRpc);
131025
131115
  }
131026
- this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeMirror);
131116
+ this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeMirror, nameBeforeMirror);
131027
131117
  if (updatingCommunity.raw.communityIpfs || updatingCommunity.updateCid) this.emit("update", this);
131028
131118
  }
131029
131119
  _handleRpcErrorEvent(args) {
@@ -131048,7 +131138,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131048
131138
  let subscriptionId;
131049
131139
  try {
131050
131140
  ({subscriptionId} = await this._pkc._pkcRpcClient.communityUpdateSubscribe({
131051
- name: this.name,
131141
+ name: this._requestedName(),
131052
131142
  publicKey: this.publicKey
131053
131143
  }));
131054
131144
  this._updateRpcSubscriptionId = subscriptionId;
@@ -131073,7 +131163,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131073
131163
  async _createAndSubscribeToNewUpdatingCommunity(updatingCommunity) {
131074
131164
  const log = logger_default("pkc-js:rpc-remote-community:_createNewUpdatingCommunity");
131075
131165
  const updatingSub = updatingCommunity || await this._pkc.createCommunity({
131076
- name: this.name,
131166
+ name: this._requestedName(),
131077
131167
  publicKey: this.publicKey
131078
131168
  });
131079
131169
  trackUpdatingCommunity(this._pkc, updatingSub);
@@ -131081,6 +131171,12 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131081
131171
  if (updatingSub !== this) await this._initMirroringUpdatingCommunity(updatingSub);
131082
131172
  await updatingSub._initRpcUpdateSubscription();
131083
131173
  }
131174
+ _sharesRequestedIdentityWith(other) {
131175
+ const ownName = this._requestedName();
131176
+ const otherName = other._requestedName();
131177
+ if (ownName === void 0 || otherName === void 0) return ownName === otherName;
131178
+ return areEquivalentCommunityAddresses(ownName, otherName);
131179
+ }
131084
131180
  async update() {
131085
131181
  logger_default("pkc-js:rpc-remote-community:update");
131086
131182
  if (this.state === "started") throw new PKCError("ERR_COMMUNITY_ALREADY_STARTED", { address: this.address });
@@ -131092,7 +131188,8 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131092
131188
  name: this.name
131093
131189
  });
131094
131190
  if (existingSub) if (existingSub === this) await this._initRpcUpdateSubscription();
131095
- else await this._initMirroringUpdatingCommunity(existingSub);
131191
+ else if (this._sharesRequestedIdentityWith(existingSub)) await this._initMirroringUpdatingCommunity(existingSub);
131192
+ else await this._initRpcUpdateSubscription();
131096
131193
  else {
131097
131194
  const startedSub = findStartedCommunity(this._pkc, {
131098
131195
  publicKey: this.publicKey,
@@ -131130,6 +131227,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131130
131227
  async stop() {
131131
131228
  const log = logger_default("pkc-js:rpc-remote-community:stop");
131132
131229
  if (this.state === "stopped") return;
131230
+ this._lastRefusedRecordUpdatedAt = void 0;
131133
131231
  if (this._updatingRpcCommunityInstanceWithListeners) await this._cleanupMirroringUpdatingCommunity();
131134
131232
  else {
131135
131233
  if (this._updateRpcSubscriptionId) {
@@ -131535,4 +131633,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
131535
131633
  }
131536
131634
  };
131537
131635
  //#endregion
131538
- export { parseCidStringSchemaWithPKCErrorIfItFails as $, getCommunityPublicKeyFromWire as $n, RpcPublishedAnchorRecordResultSchema as $t, findCommentInParsedPages as A, verifyChallengeVerification as An, r as Ar, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as At, InflightFetchManager as B, buildRuntimeAuthor as Bn, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as Br, RpcEditCommunityParamSchema as Bt, RepliesPages as C, signCommunity as Cn, moveCommunityDbToDeletedDirectory as Cr, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, verifyChallengeAnswer as Dn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as Dr, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Dt, buildPagesRuntimeFields as E, signVote as En, setNativeFunctions as Er, parseJsonWithPKCErrorIfFails as Et, collectCrosspostAuthorsToResolve as F, verifyCommentUpdate as Fn, t$8 as Fr, RpcCancelExportParamSchema as Ft, decodeRpcChallengeAnswerPubsubMsg as G, CreateCommunityListWithCidOptionsSchema as Gn, RpcFetchCidParamSchema as Gt, pRetry as H, getAuthorNameFromRuntime as Hn, require_lodash_merge as Hr, RpcExportCommunityModLogsResultSchema as Ht, extractCrosspostRuntimeFields as I, verifyCommunity as In, stringify as Ir, RpcCidParamSchema as It, decodeRpcChallengeVerificationPubsubMsg as J, crosspostChainDepthUpTo as Jn, RpcFetchCommunityListResultSchema as Jt, decodeRpcChallengePubsubMsg as K, CreateNewCommunityListOptionsSchema as Kn, RpcFetchCidResultSchema as Kt, stripNameResolvedFromCrosspost as L, verifyCommunityEdit as Ln, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as Lr, RpcCommentRepliesPageParamSchema as Lt, parseRawPages as M, verifyCommentIpfs as Mn, n$5 as Mr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Mt, applyNameResolvedCacheToCrosspost as N, verifyCommentModeration as Nn, n$6 as Nr, RpcAnchorPublishPreparationResultSchema as Nt, findCommentInPageInstance as O, verifyChallengeMessage as On, t$2 as Or, parseRpcCommentEventWithPKCErrorIfItFails as Ot, cloneCrosspostForRuntime as P, verifyCommentPubsubMessage as Pn, t$7 as Pr, RpcAuthorNameParamSchema as Pt, createSchemaRowParser as Q, getCommunityNameFromWire$1 as Qn, RpcPublishCommunityListResultSchema as Qt, PKCClientsManager as R, verifyCommunityList as Rn, NAME_RESOLVED_FALSE_TTL_MS as Rr, RpcCommunityIdentifierParamSchema as Rt, KeyvBetterSqlite3 as S, signCommentUpdateForChallengeVerification as Sn, monitorCommunitiesDirectory as Sr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, signCommunityList as Tn, resolveDbPostsCidRefs as Tr, parseDecryptedChallengeWithPKCErrorIfItFails as Tt, pLimit as U, getAuthorNameFromWire as Un, nativeFunctions$1 as Ur, RpcExportCommunityParamSchema as Ut, InflightResourceTypes as V, cleanWireAuthor as Vn, STORAGE_KEYS as Vr, RpcExportCommunityModLogsParamSchema as Vt, PKCTypedEmitter as W, normalizeCreatePublicationAuthor as Wn, require_undici as Wr, RpcExportCommunityResultSchema as Wt, coerceSchemaRowJson as X, buildRuntimeCommunityFields as Xn, RpcPublishChallengeAnswersParamSchema as Xt, coerceSchemaRowBoolean as Y, effectiveMaxCrosspostDepth as Yn, RpcPublishAnchorRecordParamSchema as Yt, collectSchemaRowCoercions as Z, getCommunityAddressFromRecord as Zn, RpcPublishCommunityListParamSchema as Zt, createAuthorIdentityMatcher as _, signChallengeVerification as _n, getDefaultCommunityDbConfig as _r, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, SignerWithPublicKeyAddress as an, getPKCAddressFromPublicKey as ar, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as at, RemoteCommunity as b, signCommentModeration as bn, importSignerIntoKuboNode as br, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, decryptEd25519AesGcm as cn, BackupAbortError as cr, parseCommunityAddressWithPKCErrorIfItFails as ct, getChallengeVerification as d, encryptEd25519AesGcmPublicKeyBuffer as dn, calculateInlineRepliesBudget as dr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as dt, RpcResolveAuthorNameResultSchema as en, normalizeCommunityInputFromCommunity as er, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as et, getCommunityChallengeFromCommunityChallengeSettings as f, _validateSignatureOfPKCRecord as fn, createKuboRpcClient as fr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, signChallengeRequest as gn, deriveDbReplies as gr, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, signChallengeMessage as hn, deriveDbPosts as hr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, require_lib as in, getIpfsKeyFromPrivateKey as ir, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, verifyCommentEdit as jn, t$5 as jr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, verifyChallengeRequest as kn, t$4 as kr, parseRpcCommentUpdateEventWithPKCErrorIfItFails as kt, pkcJsPageSorts as l, decryptEd25519AesGcmPublicKeyBuffer as ln, backupCommunityDb as lr, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as lt, pkcJsChallenges as m, signChallengeAnswer as mn, deriveCommentIpfsFromCommentTableRow as mr, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, RpcSuccessResultSchema as nn, encode as nr, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, createSigner as on, getPKCAddressFromPublicKeySync as or, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, cleanUpBeforePublishing as pn, deleteOldCommunityInWindows as pr, parseCommunityListSchemaWithPKCErrorIfItFails as pt, decodeRpcChallengeRequestPubsubMsg as q, MAX_COMMUNITY_LIST_SIZE_BYTES as qn, RpcFetchCommunityListParamSchema as qt, computePageSortsFingerprint as r, RpcUnsubscribeParamSchema as rn, getBufferedPKCAddressFromPublicKey as rr, parseCommentIpfsSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, createAnchorIpnsRecord as sn, getPublicKeyFromPrivateKey as sr, parseCommentUpdateSchemaWithPKCErrorIfItFails as st, RpcLocalCommunity as t, RpcSubscriptionIdResultSchema as tn, decode as tr, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tt, deriveCommunityChallengesOrThrow as u, encryptEd25519AesGcm as un, calculateExpectedSignatureSize as ur, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, signComment as vn, getDefaultDataPath as vr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, signCommunityEdit as wn, refreshCommunitiesList as wr, parseDecryptedChallengeVerification as wt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as x, signCommentUpdate as xn, listCommunitiesSync as xr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xt, LRUCache as y, signCommentEdit as yn, getThumbnailPropsOfLink as yr, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as yt, GenericStateClient as z, verifyVote as zn, NAME_RESOLVED_TRUE_TTL_MS as zr, RpcCommunityPageParamSchema as zt };
131636
+ export { createSchemaRowParser as $, getCommunityAddressFromRecord as $n, RpcPublishCommunityListResultSchema as $t, findCommentInParsedPages as A, verifyChallengeMessage as An, t$2 as Ar, parseRpcCommentUpdateEventWithPKCErrorIfItFails as At, GenericStateClient as B, verifyCommunityList as Bn, NAME_RESOLVED_FALSE_TTL_MS as Br, RpcCommunityPageParamSchema as Bt, RepliesPages as C, signCommentUpdate as Cn, listCommunitiesSync as Cr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, signCommunityList as Dn, resolveDbPostsCidRefs as Dr, parseJsonWithPKCErrorIfFails as Dt, buildPagesRuntimeFields as E, signCommunityEdit as En, refreshCommunitiesList as Er, parseDecryptedChallengeWithPKCErrorIfItFails as Et, cloneCrosspostForRuntime as F, verifyCommentModeration as Fn, n$6 as Fr, RpcAuthorNameParamSchema as Ft, PKCTypedEmitter as G, getAuthorNameFromWire as Gn, nativeFunctions$1 as Gr, RpcExportCommunityResultSchema as Gt, InflightResourceTypes as H, buildRuntimeAuthor as Hn, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as Hr, RpcExportCommunityModLogsParamSchema as Ht, collectCrosspostAuthorsToResolve as I, verifyCommentPubsubMessage as In, t$7 as Ir, RpcCancelExportParamSchema as It, decodeRpcChallengeRequestPubsubMsg as J, CreateNewCommunityListOptionsSchema as Jn, RpcFetchCommunityListParamSchema as Jt, decodeRpcChallengeAnswerPubsubMsg as K, normalizeCreatePublicationAuthor as Kn, require_undici as Kr, RpcFetchCidParamSchema as Kt, extractCrosspostRuntimeFields as L, verifyCommentUpdate as Ln, t$8 as Lr, RpcCidParamSchema as Lt, parseRawPages as M, verifyChallengeVerification as Mn, r as Mr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Mt, MAX_PAGE_SIZE_BYTES as N, verifyCommentEdit as Nn, t$5 as Nr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Nt, findCommentInPageInstance as O, signVote as On, setNativeFunctions as Or, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Ot, applyNameResolvedCacheToCrosspost as P, verifyCommentIpfs as Pn, n$5 as Pr, RpcAnchorPublishPreparationResultSchema as Pt, collectSchemaRowCoercions as Q, buildRuntimeCommunityFields as Qn, RpcPublishCommunityListParamSchema as Qt, stripNameResolvedFromCrosspost as R, verifyCommunity as Rn, stringify as Rr, RpcCommentRepliesPageParamSchema as Rt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as S, signCommentModeration as Sn, importSignerIntoKuboNode as Sr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, signCommunity as Tn, moveCommunityDbToDeletedDirectory as Tr, parseDecryptedChallengeVerification as Tt, pRetry as U, cleanWireAuthor as Un, STORAGE_KEYS as Ur, RpcExportCommunityModLogsResultSchema as Ut, InflightFetchManager as V, verifyVote as Vn, NAME_RESOLVED_TRUE_TTL_MS as Vr, RpcEditCommunityParamSchema as Vt, pLimit as W, getAuthorNameFromRuntime as Wn, require_lodash_merge as Wr, RpcExportCommunityParamSchema as Wt, coerceSchemaRowBoolean as X, crosspostChainDepthUpTo as Xn, RpcPublishAnchorRecordParamSchema as Xt, decodeRpcChallengeVerificationPubsubMsg as Y, MAX_COMMUNITY_LIST_SIZE_BYTES as Yn, RpcFetchCommunityListResultSchema as Yt, coerceSchemaRowJson as Z, effectiveMaxCrosspostDepth as Zn, RpcPublishChallengeAnswersParamSchema as Zt, createAuthorIdentityMatcher as _, signChallengeMessage as _n, deriveDbPosts as _r, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, findCommunityRecordNameMismatch as an, getBufferedPKCAddressFromPublicKey as ar, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as at, KeyvBetterSqlite3 as b, signComment as bn, getDefaultDataPath as br, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, createSigner as cn, getPKCAddressFromPublicKeySync as cr, parseCommentUpdateSchemaWithPKCErrorIfItFails as ct, getChallengeVerification as d, decryptEd25519AesGcmPublicKeyBuffer as dn, backupCommunityDb as dr, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as dt, RpcPublishedAnchorRecordResultSchema as en, getCommunityNameFromWire$1 as er, parseCidStringSchemaWithPKCErrorIfItFails as et, getCommunityChallengeFromCommunityChallengeSettings as f, encryptEd25519AesGcm as fn, calculateExpectedSignatureSize as fr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, signChallengeAnswer as gn, deriveCommentIpfsFromCommentTableRow as gr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, cleanUpBeforePublishing as hn, deleteOldCommunityInWindows as hr, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, RpcUnsubscribeParamSchema as in, encode as ir, parseCommentIpfsSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, verifyChallengeRequest as jn, t$4 as jr, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, verifyChallengeAnswer as kn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as kr, parseRpcCommentEventWithPKCErrorIfItFails as kt, pkcJsPageSorts as l, createAnchorIpnsRecord as ln, getPublicKeyFromPrivateKey as lr, parseCommunityAddressWithPKCErrorIfItFails as lt, pkcJsChallenges as m, _validateSignatureOfPKCRecord as mn, createKuboRpcClient as mr, parseCommunityListSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, RpcSubscriptionIdResultSchema as nn, normalizeCommunityInputFromCommunity as nr, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, require_lib as on, getIpfsKeyFromPrivateKey as or, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, encryptEd25519AesGcmPublicKeyBuffer as pn, calculateInlineRepliesBudget as pr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as pt, decodeRpcChallengePubsubMsg as q, CreateCommunityListWithCidOptionsSchema as qn, RpcFetchCidResultSchema as qt, computePageSortsFingerprint as r, RpcSuccessResultSchema as rn, decode as rr, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, SignerWithPublicKeyAddress as sn, getPKCAddressFromPublicKey as sr, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as st, RpcLocalCommunity as t, RpcResolveAuthorNameResultSchema as tn, getCommunityPublicKeyFromWire as tr, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tt, deriveCommunityChallengesOrThrow as u, decryptEd25519AesGcm as un, BackupAbortError as ur, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, signChallengeRequest as vn, deriveDbReplies as vr, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, signCommentUpdateForChallengeVerification as wn, monitorCommunitiesDirectory as wr, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as wt, RemoteCommunity as x, signCommentEdit as xn, getThumbnailPropsOfLink as xr, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xt, LRUCache as y, signChallengeVerification as yn, getDefaultCommunityDbConfig as yr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as yt, PKCClientsManager as z, verifyCommunityEdit as zn, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as zr, RpcCommunityIdentifierParamSchema as zt };