@pkcprotocol/pkc-js 0.0.99 → 0.0.101

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 (140) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/clients/base-client-manager.js +16 -3
  3. package/dist/browser/clients/base-client-manager.js.map +1 -1
  4. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +3 -2
  5. package/dist/browser/clients/rpc-client/schema.d.ts +3 -2
  6. package/dist/browser/community/community-client-manager.d.ts +5 -0
  7. package/dist/browser/community/community-client-manager.js +134 -23
  8. package/dist/browser/community/community-client-manager.js.map +1 -1
  9. package/dist/browser/community/schema.d.ts +110 -51
  10. package/dist/browser/community/schema.js +21 -5
  11. package/dist/browser/community/schema.js.map +1 -1
  12. package/dist/browser/domain-util.d.ts +3 -0
  13. package/dist/browser/domain-util.js +16 -0
  14. package/dist/browser/domain-util.js.map +1 -0
  15. package/dist/browser/errors.d.ts +5 -0
  16. package/dist/browser/errors.js +5 -0
  17. package/dist/browser/errors.js.map +1 -1
  18. package/dist/browser/generated-version.d.ts +1 -1
  19. package/dist/browser/generated-version.js +1 -1
  20. package/dist/browser/generated-version.js.map +1 -1
  21. package/dist/browser/helia/util.js +4 -3
  22. package/dist/browser/helia/util.js.map +1 -1
  23. package/dist/browser/index-with-compile-cache.d.ts +18 -12
  24. package/dist/browser/index.d.ts +18 -12
  25. package/dist/browser/pkc-error.d.ts +1 -1
  26. package/dist/browser/publications/community-edit/schema.d.ts +12 -8
  27. package/dist/browser/publications/publication.d.ts +1 -0
  28. package/dist/browser/publications/publication.js +56 -17
  29. package/dist/browser/publications/publication.js.map +1 -1
  30. package/dist/browser/pubsub-messages/schema.d.ts +6 -4
  31. package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +9 -6
  32. package/dist/browser/rpc/src/schema.d.ts +54 -36
  33. package/dist/browser/runtime/node/community/challenges/exclude/exclude.d.ts +1 -1
  34. package/dist/browser/runtime/node/community/challenges/exclude/exclude.js +41 -16
  35. package/dist/browser/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
  36. package/dist/browser/runtime/node/community/challenges/exclude/utils.d.ts +2 -3
  37. package/dist/browser/runtime/node/community/challenges/exclude/utils.js +1 -15
  38. package/dist/browser/runtime/node/community/challenges/exclude/utils.js.map +1 -1
  39. package/dist/browser/runtime/node/community/challenges/index.js +1 -1
  40. package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
  41. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +18 -13
  42. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
  43. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +18 -13
  44. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
  45. package/dist/browser/runtime/node/community/db-handler.d.ts +3 -2
  46. package/dist/browser/runtime/node/community/db-handler.js +20 -2
  47. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  48. package/dist/browser/runtime/node/community/local-community/author-identity.d.ts +19 -0
  49. package/dist/browser/runtime/node/community/local-community/author-identity.js +50 -0
  50. package/dist/browser/runtime/node/community/local-community/author-identity.js.map +1 -0
  51. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +7 -1
  52. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  53. package/dist/browser/runtime/node/community/local-community/publication-validation.js +8 -22
  54. package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
  55. package/dist/browser/schema/schema-util.d.ts +27 -18
  56. package/dist/browser/schema.d.ts +72 -48
  57. package/dist/browser/test/mock-ipfs-client.js +6 -0
  58. package/dist/browser/test/mock-ipfs-client.js.map +1 -1
  59. package/dist/browser/test/test-util.d.ts +13 -10
  60. package/dist/browser/test/test-util.js +2 -2
  61. package/dist/browser/test/test-util.js.map +1 -1
  62. package/dist/browser/util.d.ts +1 -4
  63. package/dist/browser/util.js +4 -10
  64. package/dist/browser/util.js.map +1 -1
  65. package/dist/browser/version.js +1 -1
  66. package/dist/bundled/bundle-manifest.json +33 -31
  67. package/dist/bundled/chunks/{helia-for-pkc-DUaUFShG.js → helia-for-pkc-DSF3IY_M.js} +33 -33
  68. package/dist/bundled/chunks/{local-community-CM2GS9Ya.js → local-community-CTd_1kw_.js} +1 -1
  69. package/dist/bundled/chunks/{local-community-BGcQIioy.js → local-community-DtlDCcc2.js} +54 -49
  70. package/dist/bundled/chunks/{node-CF18iVMW.js → node-pGNrsJuH.js} +47 -25
  71. package/dist/bundled/chunks/{rpc-local-community-CTyhIJyD.js → rpc-local-community-pLvHO4g9.js} +160 -54
  72. package/dist/bundled/chunks/{schema-f2Zr1ZxK.js → schema-DdD_6tTd.js} +30 -19
  73. package/dist/bundled/chunks/{util-BbXV7Dcu.js → util-N0_wIz2O.js} +2 -2
  74. package/dist/bundled/index.js +1 -1
  75. package/dist/bundled/rpc/src/index.js +4 -4
  76. package/dist/node/clients/base-client-manager.js +16 -3
  77. package/dist/node/clients/base-client-manager.js.map +1 -1
  78. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +3 -2
  79. package/dist/node/clients/rpc-client/schema.d.ts +3 -2
  80. package/dist/node/community/community-client-manager.d.ts +5 -0
  81. package/dist/node/community/community-client-manager.js +134 -23
  82. package/dist/node/community/community-client-manager.js.map +1 -1
  83. package/dist/node/community/schema.d.ts +110 -51
  84. package/dist/node/community/schema.js +21 -5
  85. package/dist/node/community/schema.js.map +1 -1
  86. package/dist/node/domain-util.d.ts +3 -0
  87. package/dist/node/domain-util.js +16 -0
  88. package/dist/node/domain-util.js.map +1 -0
  89. package/dist/node/errors.d.ts +5 -0
  90. package/dist/node/errors.js +5 -0
  91. package/dist/node/errors.js.map +1 -1
  92. package/dist/node/generated-version.d.ts +1 -1
  93. package/dist/node/generated-version.js +1 -1
  94. package/dist/node/generated-version.js.map +1 -1
  95. package/dist/node/helia/util.js +4 -3
  96. package/dist/node/helia/util.js.map +1 -1
  97. package/dist/node/index-with-compile-cache.d.ts +18 -12
  98. package/dist/node/index.d.ts +18 -12
  99. package/dist/node/pkc-error.d.ts +1 -1
  100. package/dist/node/publications/community-edit/schema.d.ts +12 -8
  101. package/dist/node/publications/publication.d.ts +1 -0
  102. package/dist/node/publications/publication.js +56 -17
  103. package/dist/node/publications/publication.js.map +1 -1
  104. package/dist/node/pubsub-messages/schema.d.ts +6 -4
  105. package/dist/node/rpc/src/lib/pkc-js/index.d.ts +9 -6
  106. package/dist/node/rpc/src/schema.d.ts +54 -36
  107. package/dist/node/runtime/node/community/challenges/exclude/exclude.d.ts +1 -1
  108. package/dist/node/runtime/node/community/challenges/exclude/exclude.js +41 -16
  109. package/dist/node/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
  110. package/dist/node/runtime/node/community/challenges/exclude/utils.d.ts +2 -3
  111. package/dist/node/runtime/node/community/challenges/exclude/utils.js +1 -15
  112. package/dist/node/runtime/node/community/challenges/exclude/utils.js.map +1 -1
  113. package/dist/node/runtime/node/community/challenges/index.js +1 -1
  114. package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
  115. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +18 -13
  116. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
  117. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +18 -13
  118. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
  119. package/dist/node/runtime/node/community/db-handler.d.ts +3 -2
  120. package/dist/node/runtime/node/community/db-handler.js +20 -2
  121. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  122. package/dist/node/runtime/node/community/local-community/author-identity.d.ts +19 -0
  123. package/dist/node/runtime/node/community/local-community/author-identity.js +50 -0
  124. package/dist/node/runtime/node/community/local-community/author-identity.js.map +1 -0
  125. package/dist/node/runtime/node/community/local-community/ipns-publishing.js +7 -1
  126. package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  127. package/dist/node/runtime/node/community/local-community/publication-validation.js +8 -22
  128. package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
  129. package/dist/node/schema/schema-util.d.ts +27 -18
  130. package/dist/node/schema.d.ts +72 -48
  131. package/dist/node/test/mock-ipfs-client.js +6 -0
  132. package/dist/node/test/mock-ipfs-client.js.map +1 -1
  133. package/dist/node/test/test-util.d.ts +13 -10
  134. package/dist/node/test/test-util.js +2 -2
  135. package/dist/node/test/test-util.js.map +1 -1
  136. package/dist/node/util.d.ts +1 -4
  137. package/dist/node/util.js +4 -10
  138. package/dist/node/util.js.map +1 -1
  139. package/dist/node/version.js +1 -1
  140. package/package.json +3 -2
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as isRequestPubsubPublicationOfReply, $n as CommunityAuthorChallengeReservedFieldNames, $t as CreateCommentModerationOptionsWithRefinementSchema, A as doesDomainAddressHaveCapitalLetter, An as CommentUpdateReservedFields, Ar as boolean, At as listUpdatingCommunities, B as ipnsNameToIpnsOverPubsubTopic, Bt as require_sha256$1, Cn as CommentIpfsSchema, Cr as messages, D as createAbortError, Dn as CommentUpdateChallengeReservedFieldNames, Dt as findUpdatingCommunity, En as CommentSignedPropertyNames, Er as require_ms$1, Et as findUpdatingComment, Fn as CreateCommentOptionsWithRefinementSchema, Fr as record, G as isIpnsPath, Gn as CreateCommentEditOptionsWithRefinementSchema, Gt as CommunityEditPublicationSignedPropertyNames, H as isIpfsCid, Ht as pTimeout, In as GetPageParamSchema, Ir as string, It as trackUpdatingCommunity, Jt as CommentModerationChallengeRequestToEncryptSchema, Kn as AuthorAddressSchema, Kt as CommunityEditPubsubMessagePublicationSchema, L as getPostUpdateTimestampRange, Ln as ModQueuePageIpfsSchema, Lt as untrackStartedCommunity, M as fetchAndValidateIpnsRecordFromGateway, Mn as CommentUpdateSignedPropertyNames, Mr as literal, Mt as refreshTrackedCommunityAliases, Nr as number, O as deepMergeRuntimeFields, Or as _enum, Ot as listStartedCommunities, Pr as object, Pt as trackStartedCommunity, Q as isRequestPubsubPublicationOfPost, Qn as CommunityAddressSchema, Qt as CommentModerationsTableRowSchema, R as hideClassPrivateProps, Rn as PageIpfsSchema, Rt as untrackUpdatingComment, S as calculateIpfsCidV0, Sn as CommentIpfsReservedFields, Sr as PKCError, St as waitForUpdateInCommunityInstanceWithErrorAndTimeout, Tn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Tr as require_supports_color, Tt as findStartedCommunity, U as isIpfsPath, Un as CommentEditSignedPropertyNames, Ut as CommunityEditPublicationChallengeRequestToEncryptSchema, V as isAbortError, Vn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, W as isIpns, Xn as CidPathSchema, Yn as ChallengeAnswersSchema, Yt as CommentModerationPubsubMessagePublicationSchema, Zn as CidStringSchema, Zt as CommentModerationSignedPropertyNames, _ as PKCUserOptionBaseSchema, _n as VotePubsubMessagePublicationSchema, _r as FailedToFetchCommentIpfsFromGatewaysError, _t as shortifyCid, an as CommunityExportRecordsSchema, ar as t$13, b as areEquivalentCommunityAddresses, br as FailedToFetchGenericIpfsFromGatewaysError, bt as throwIfAbortSignalAborted, c as ChallengeVerificationMessageSignedPropertyNames, cn as CommunitySignedPropertyNames, cr as t$11, ct as removeNullUndefinedEmptyObjectsValuesRecursively, dn as CreateRpcCommunityFunctionArgumentSchema, dr as n$8, en as ChallengeFileFactorySchema, er as CreateSignerSchema, et as isStringDomain, f as DecryptedChallengeSchema, fn as ExportCommunityModLogsOptionsSchema, fr as r$7, ft as resolveWhenPredicateIsTrue, g as PKCParsedOptionsSchema, gn as VoteChallengeRequestToEncryptSchema, gr as require_retry$1, gt as shortifyAddress, h as NameResolverSerializedSchema, hn as CreateVoteUserOptionsWithRefinementSchema, hr as e$4, i as ChallengeMessageSignedPropertyNames, in as CommunityEditOptionsSchema, j as extractNetworkErrorDetails, jn as CommentUpdateSchema, jr as custom, k as derivePublicationFromChallengeRequest, kn as CommentUpdateForChallengeVerificationSignedPropertyNames, kr as array, l as DecryptedChallengeAnswerSchema, ln as CreateNewLocalCommunityUserOptionsSchema, lr as r$8, m as NameResolveCacheOptionsSchema, mn as RpcRemoteCommunityUpdateEventResultSchema, mr as t$9, n as ChallengeAnswerMessageSignedPropertyNames, o as ChallengeRequestMessageSignedPropertyNames, on as CommunityIpfsReservedFields, or as e$6, p as DecryptedChallengeVerificationSchema, pr as t$10, qn as AuthorCommentIpfsReservedFields, qt as CreateCommunityEditPublicationOptionsWithRefinementSchema, rn as CommunityChallengeSettingSchema, rr as n$9, rt as raceAgainstAbort, sn as CommunityIpfsSchema, sr as e$5, tn as ChallengeFileSchema, tr as n$10, tt as pubsubTopicToDhtKey, un as CreateRemoteCommunityFunctionArgumentSchema, ur as t$12, v as PKCUserOptionsSchema, vr as FailedToFetchCommentUpdateFromGatewaysError, vt as sleepUntilTimeoutOrAbort, wr as logger_default, xn as CommentChallengeRequestToEncryptSchema, xr as FailedToFetchPageIpfsFromGatewaysError, xt as timestamp, yn as VoteSignedPropertyNames, yr as FailedToFetchCommunityFromGatewaysError, z as interruptibleSleep, zn as CommentEditChallengeRequestToEncryptSchema, zt as untrackUpdatingCommunity } from "./schema-f2Zr1ZxK.js";
2
+ import { $ as isRequestPubsubPublicationOfReply, $n as CommunityAuthorChallengeReservedFieldNames, $t as ChallengeFileFactorySchema, A as doesDomainAddressHaveCapitalLetter, An as CommentUpdateReservedFields, Ar as boolean, B as ipnsNameToIpnsOverPubsubTopic, Cn as CommentIpfsSchema, Cr as messages, D as createAbortError, Dn as CommentUpdateChallengeReservedFieldNames, Dt as listStartedCommunities, En as CommentSignedPropertyNames, Er as require_ms$1, Et as findUpdatingCommunity, Fn as CreateCommentOptionsWithRefinementSchema, Fr as record, Ft as trackUpdatingCommunity, G as isIpnsPath, Gn as CreateCommentEditOptionsWithRefinementSchema, Gt as CommunityEditPubsubMessagePublicationSchema, H as isIpfsCid, Ht as CommunityEditPublicationChallengeRequestToEncryptSchema, In as GetPageParamSchema, Ir as string, It as untrackStartedCommunity, Jt as CommentModerationPubsubMessagePublicationSchema, Kn as AuthorAddressSchema, Kt as CreateCommunityEditPublicationOptionsWithRefinementSchema, L as getPostUpdateTimestampRange, Ln as ModQueuePageIpfsSchema, Lt as untrackUpdatingComment, M as fetchAndValidateIpnsRecordFromGateway, Mn as CommentUpdateSignedPropertyNames, Mr as literal, Nr as number, Nt as trackStartedCommunity, O as deepMergeRuntimeFields, Or as _enum, Pr as object, Q as isRequestPubsubPublicationOfPost, Qn as CommunityAddressSchema, Qt as CreateCommentModerationOptionsWithRefinementSchema, R as hideClassPrivateProps, Rn as PageIpfsSchema, Rt as untrackUpdatingCommunity, S as calculateIpfsCidV0, Sn as CommentIpfsReservedFields, Sr as PKCError, Tn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Tr as require_supports_color, Tt as findUpdatingComment, U as isIpfsPath, Un as CommentEditSignedPropertyNames, V as isAbortError, Vn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Vt as pTimeout, W as isIpns, Wt as CommunityEditPublicationSignedPropertyNames, Xn as CidPathSchema, Xt as CommentModerationSignedPropertyNames, Yn as ChallengeAnswersSchema, Zn as CidStringSchema, Zt as CommentModerationsTableRowSchema, _ as PKCUserOptionBaseSchema, _n as VotePubsubMessagePublicationSchema, _r as FailedToFetchCommentIpfsFromGatewaysError, _t as sleepUntilTimeoutOrAbort, an as CommunityIpfsReservedFields, ar as t$13, b as areEquivalentCommunityAddresses, br as FailedToFetchGenericIpfsFromGatewaysError, bt as timestamp, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateNewLocalCommunityUserOptionsSchema, cr as t$11, dn as ExportCommunityModLogsOptionsSchema, dr as n$8, dt as resolveWhenPredicateIsTrue, en as ChallengeFileSchema, er as CreateSignerSchema, et as pubsubTopicToDhtKey, f as DecryptedChallengeSchema, fr as r$7, g as PKCParsedOptionsSchema, gn as VoteChallengeRequestToEncryptSchema, gr as require_retry$1, gt as shortifyCid, h as NameResolverSerializedSchema, hn as CreateVoteUserOptionsWithRefinementSchema, hr as e$4, ht as shortifyAddress, i as ChallengeMessageSignedPropertyNames, in as CommunityExportRecordsSchema, j as extractNetworkErrorDetails, jn as CommentUpdateSchema, jr as custom, jt as refreshTrackedCommunityAliases, k as derivePublicationFromChallengeRequest, kn as CommentUpdateForChallengeVerificationSignedPropertyNames, kr as array, kt as listUpdatingCommunities, l as DecryptedChallengeAnswerSchema, ln as CreateRemoteCommunityFunctionArgumentSchema, lr as r$8, m as NameResolveCacheOptionsSchema, mn as isStringDomain, mr as t$9, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityChallengeSettingSchema, nt as raceAgainstAbort, o as ChallengeRequestMessageSignedPropertyNames, on as CommunityIpfsSchema, or as e$6, p as DecryptedChallengeVerificationSchema, pn as RpcRemoteCommunityUpdateEventResultSchema, pr as t$10, qn as AuthorCommentIpfsReservedFields, qt as CommentModerationChallengeRequestToEncryptSchema, rn as CommunityEditOptionsSchema, rr as n$9, sn as CommunitySignedPropertyNames, sr as e$5, st as removeNullUndefinedEmptyObjectsValuesRecursively, tr as n$10, un as CreateRpcCommunityFunctionArgumentSchema, ur as t$12, v as PKCUserOptionsSchema, vr as FailedToFetchCommentUpdateFromGatewaysError, wr as logger_default, wt as findStartedCommunity, xn as CommentChallengeRequestToEncryptSchema, xr as FailedToFetchPageIpfsFromGatewaysError, xt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, yn as VoteSignedPropertyNames, yr as FailedToFetchCommunityFromGatewaysError, yt as throwIfAbortSignalAborted, z as interruptibleSleep, zn as CommentEditChallengeRequestToEncryptSchema, zt as require_sha256$1 } from "./schema-DdD_6tTd.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
4
  import { createHash } from "node:crypto";
5
5
  import { pathToFileURL } from "node:url";
@@ -99362,6 +99362,8 @@ var BaseClientsManager = class BaseClientsManager {
99362
99362
  url,
99363
99363
  status: res?.status,
99364
99364
  statusText: res?.statusText,
99365
+ responseEtag: res?.headers?.get("etag"),
99366
+ responseCacheControl: res?.headers?.get("cache-control"),
99365
99367
  fetchError: String(e),
99366
99368
  fetchErrorCode: nodeError?.code,
99367
99369
  fetchErrorErrno: nodeError?.errno,
@@ -99477,7 +99479,8 @@ var BaseClientsManager = class BaseClientsManager {
99477
99479
  wasRequestAborted: loadOpts.abortController.signal.aborted
99478
99480
  };
99479
99481
  this.postFetchGatewayFailure(gateway, loadOpts, e);
99480
- this._pkc._stats.recordGatewayFailure(gateway, loadOpts.recordIpfsType).catch((err) => log.error("failed to report gateway error", err));
99482
+ if (e.details?.status === 304 || String(e.code).startsWith("ERR_GATEWAY_ABORTING_LOADING")) this._pkc._stats.recordGatewaySuccess(gateway, loadOpts.recordIpfsType, Date.now() - timeBefore).catch((err) => log.error("Failed to report gateway success", err));
99483
+ else this._pkc._stats.recordGatewayFailure(gateway, loadOpts.recordIpfsType).catch((err) => log.error("failed to report gateway error", err));
99481
99484
  return { error: e };
99482
99485
  }
99483
99486
  }
@@ -125417,12 +125420,15 @@ function selectWinningGatewayCommunity(opts) {
125417
125420
  //#region dist/node/community/community-client-manager.js
125418
125421
  const MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS = 1024 * 1024;
125419
125422
  const FORCED_IPNS_NETWORK_REVALIDATION_MIN_INTERVAL_MS = 3e4;
125423
+ const GATEWAY_FALLBACK_POLL_MS = 1e4;
125424
+ const GATEWAY_POLL_FLOOR_MS = 1e3;
125420
125425
  var CommunityClientsManager = class extends PKCClientsManager {
125421
125426
  constructor(community) {
125422
125427
  super(community._pkc);
125423
125428
  this._suppressUpdatingStateForNameResolution = 0;
125424
125429
  this._ipnsLoadingOperation = void 0;
125425
125430
  this._updateCidsAlreadyLoaded = new LimitedSet(30);
125431
+ this._gatewayEtagsOfLoadedRecords = new LimitedSet(5);
125426
125432
  this._subscribedIpnsArrivalTopics = /* @__PURE__ */ new Set();
125427
125433
  this._pendingIpnsArrivalCids = /* @__PURE__ */ new Set();
125428
125434
  this._pendingIpnsArrivalHopTargets = /* @__PURE__ */ new Set();
@@ -125617,7 +125623,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
125617
125623
  ms: safetyNetMs,
125618
125624
  signal: this._community._getStopAbortSignal()
125619
125625
  });
125620
- } else await sleepUntilTimeoutOrAbort(areWeConnectedToKuboOrHelia ? 1e3 : this._pkc.updateInterval, this._community._getStopAbortSignal());
125626
+ } else await sleepUntilTimeoutOrAbort(areWeConnectedToKuboOrHelia ? 1e3 : this._computeGatewayPollMs(), this._community._getStopAbortSignal());
125621
125627
  }
125622
125628
  this._clearIpnsArrivalSubscriptions();
125623
125629
  this._community._clearStopAbortController();
@@ -125626,8 +125632,27 @@ var CommunityClientsManager = class extends PKCClientsManager {
125626
125632
  async stopUpdatingLoop() {
125627
125633
  this._ipnsLoadingOperation?.stop();
125628
125634
  this._updateCidsAlreadyLoaded.clear();
125635
+ this._gatewayEtagsOfLoadedRecords.clear();
125636
+ this._gatewayMaxAgeSecondsFromLastPoll = void 0;
125629
125637
  this._clearIpnsArrivalSubscriptions();
125630
125638
  }
125639
+ _computeGatewayPollMs() {
125640
+ const maxAgeSeconds = this._gatewayMaxAgeSecondsFromLastPoll;
125641
+ const baseMs = typeof maxAgeSeconds === "number" ? maxAgeSeconds * 1e3 + 250 + Math.random() * 750 : GATEWAY_FALLBACK_POLL_MS * (.75 + Math.random() * .5);
125642
+ const ceilingMs = this._pkc.updateInterval;
125643
+ return Math.max(Math.min(baseMs, ceilingMs), Math.min(GATEWAY_POLL_FLOOR_MS, ceilingMs));
125644
+ }
125645
+ _parseMaxAgeSeconds(cacheControl) {
125646
+ const maxAgeMatch = cacheControl?.match(/max-age=(\d+)/i);
125647
+ if (!maxAgeMatch?.[1]) return void 0;
125648
+ const maxAgeSeconds = parseInt(maxAgeMatch[1]);
125649
+ return Number.isFinite(maxAgeSeconds) ? maxAgeSeconds : void 0;
125650
+ }
125651
+ _normalizedEtagOfResponse(res) {
125652
+ const etag = res?.headers?.get("etag");
125653
+ if (!etag) return void 0;
125654
+ return etag.replace(/^W\//, "");
125655
+ }
125631
125656
  _onIpnsRecordArrival(arrival) {
125632
125657
  const value = arrival.record.value;
125633
125658
  if (isIpfsPath(value)) {
@@ -126026,26 +126051,16 @@ var CommunityClientsManager = class extends PKCClientsManager {
126026
126051
  } else {
126027
126052
  gatewayFetches[gatewayUrl].communityRecord = communityIpfs;
126028
126053
  gatewayFetches[gatewayUrl].cid = calculatedCommunityCidFromBody;
126029
- const cacheControl = gatewayRes?.res?.headers?.get("cache-control");
126030
- if (cacheControl) {
126031
- const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
126032
- if (maxAgeMatch && maxAgeMatch[1]) {
126033
- const ttl = parseInt(maxAgeMatch[1]);
126034
- gatewayFetches[gatewayUrl].ttl = ttl;
126035
- }
126036
- }
126054
+ gatewayFetches[gatewayUrl].ttl = this._parseMaxAgeSeconds(gatewayRes?.res?.headers?.get("cache-control"));
126055
+ const etag = this._normalizedEtagOfResponse(gatewayRes?.res);
126056
+ if (etag) this._gatewayEtagsOfLoadedRecords.add(etag);
126037
126057
  }
126038
126058
  };
126039
126059
  const checkResponseHeadersIfOldCid = async (gatewayRes) => {
126060
+ gatewayFetches[gatewayUrl].ttl = this._parseMaxAgeSeconds(gatewayRes?.headers?.get("cache-control"));
126040
126061
  const cidOfIpnsFromEtagHeader = gatewayRes?.headers?.get("etag")?.toString();
126041
126062
  if (!cidOfIpnsFromEtagHeader) return;
126042
- let parsedCid;
126043
- try {
126044
- parsedCid = CID.parse(cidOfIpnsFromEtagHeader.replace(/^W\//, "").split("\"").join("")).toV0().toString();
126045
- } catch (e) {
126046
- return;
126047
- }
126048
- if (this._updateCidsAlreadyLoaded.has(parsedCid)) {
126063
+ const abortBecauseRecordAlreadyLoaded = () => {
126049
126064
  abortController.abort("Aborting community IPNS request because we already loaded this record");
126050
126065
  return new PKCError("ERR_GATEWAY_ABORTING_LOADING_COMMUNITY_BECAUSE_WE_ALREADY_LOADED_THIS_RECORD", {
126051
126066
  cidOfIpnsFromEtagHeader,
@@ -126053,9 +126068,24 @@ var CommunityClientsManager = class extends PKCClientsManager {
126053
126068
  gatewayRes,
126054
126069
  gatewayUrl
126055
126070
  });
126071
+ };
126072
+ const normalizedEtag = this._normalizedEtagOfResponse(gatewayRes);
126073
+ if (normalizedEtag && this._gatewayEtagsOfLoadedRecords.has(normalizedEtag)) return abortBecauseRecordAlreadyLoaded();
126074
+ let parsedCid;
126075
+ try {
126076
+ parsedCid = CID.parse(cidOfIpnsFromEtagHeader.replace(/^W\//, "").split("\"").join("")).toV0().toString();
126077
+ } catch (e) {
126078
+ return;
126079
+ }
126080
+ if (this._updateCidsAlreadyLoaded.has(parsedCid) || this._community.updateCid === parsedCid) {
126081
+ if (normalizedEtag) this._gatewayEtagsOfLoadedRecords.add(normalizedEtag);
126082
+ return abortBecauseRecordAlreadyLoaded();
126056
126083
  }
126057
126084
  };
126058
- const requestHeaders = this._updateCidsAlreadyLoaded.size > 0 ? { "If-None-Match": "\"" + Array.from(this._updateCidsAlreadyLoaded.values()).join(",") + "\"" } : void 0;
126085
+ const etagsForConditionalRequest = new Set(this._gatewayEtagsOfLoadedRecords);
126086
+ if (this._community.updateCid) etagsForConditionalRequest.add(`"${this._community.updateCid}"`);
126087
+ for (const cid of Array.from(this._updateCidsAlreadyLoaded.values()).slice(-5)) etagsForConditionalRequest.add(`"${cid}"`);
126088
+ const requestHeaders = etagsForConditionalRequest.size > 0 ? { "If-None-Match": Array.from(etagsForConditionalRequest).join(", ") } : void 0;
126059
126089
  gatewayFetches[gatewayUrl] = {
126060
126090
  abortController,
126061
126091
  promise: queueLimit(() => this._fetchWithGateway(gatewayUrl, {
@@ -126103,6 +126133,15 @@ var CommunityClientsManager = class extends PKCClientsManager {
126103
126133
  };
126104
126134
  };
126105
126135
  const promisesToIterate = Object.values(gatewayFetches).map((gatewayFetch) => gatewayFetch.promise);
126136
+ const recordGatewayMaxAgeForPacing = () => {
126137
+ const maxAges = [];
126138
+ for (const gatewayFetch of Object.values(gatewayFetches)) {
126139
+ if (typeof gatewayFetch.ttl === "number") maxAges.push(gatewayFetch.ttl);
126140
+ const maxAgeFrom304 = this._parseMaxAgeSeconds(gatewayFetch.error?.details?.responseCacheControl);
126141
+ if (typeof maxAgeFrom304 === "number") maxAges.push(maxAgeFrom304);
126142
+ }
126143
+ this._gatewayMaxAgeSecondsFromLastPoll = maxAges.length > 0 ? Math.min(...maxAges) : void 0;
126144
+ };
126106
126145
  let suitableCommunity;
126107
126146
  try {
126108
126147
  suitableCommunity = await new Promise((resolve, reject) => promisesToIterate.map((gatewayPromise, i) => gatewayPromise.then(async (res) => {
@@ -126117,8 +126156,15 @@ var CommunityClientsManager = class extends PKCClientsManager {
126117
126156
  } catch {
126118
126157
  cleanUp();
126119
126158
  throwIfAbortSignalAborted(stopSignal);
126159
+ recordGatewayMaxAgeForPacing();
126120
126160
  const gatewayToError = t$4(gatewayFetches, (gatewayFetch) => gatewayFetch.error);
126121
- if (Object.keys(gatewayFetches).map((gatewayUrl) => gatewayFetches[gatewayUrl].error).some((err) => err.details?.status === 304 || err.code === "ERR_GATEWAY_ABORTING_LOADING_COMMUNITY_BECAUSE_WE_ALREADY_LOADED_THIS_RECORD")) {
126161
+ const hasGatewayConfirmingCurrentRecord = Object.keys(gatewayFetches).map((gatewayUrl) => gatewayFetches[gatewayUrl].error).some((err) => err.details?.status === 304 || err.code === "ERR_GATEWAY_ABORTING_LOADING_COMMUNITY_BECAUSE_WE_ALREADY_LOADED_THIS_RECORD");
126162
+ for (const gatewayFetch of Object.values(gatewayFetches)) {
126163
+ if (gatewayFetch.error?.details?.status !== 304) continue;
126164
+ const etagFrom304 = gatewayFetch.error.details?.responseEtag;
126165
+ if (etagFrom304) this._gatewayEtagsOfLoadedRecords.add(etagFrom304.replace(/^W\//, ""));
126166
+ }
126167
+ if (hasGatewayConfirmingCurrentRecord) {
126122
126168
  if (this._community.anchor && this._community.ipnsHops?.[0] !== ipnsName) {
126123
126169
  const confirmingGatewayUrl = Object.keys(gatewayFetches).find((gatewayUrl) => gatewayFetches[gatewayUrl].error?.details?.status === 304 || gatewayFetches[gatewayUrl].error?.code === "ERR_GATEWAY_ABORTING_LOADING_COMMUNITY_BECAUSE_WE_ALREADY_LOADED_THIS_RECORD");
126124
126170
  if (confirmingGatewayUrl) {
@@ -126149,6 +126195,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
126149
126195
  delete combinedError.stack;
126150
126196
  throw combinedError;
126151
126197
  }
126198
+ recordGatewayMaxAgeForPacing();
126152
126199
  return suitableCommunity;
126153
126200
  }
126154
126201
  async _resolveIpnsChainViaGateway(gatewayUrl, anchorIpnsName, abortSignal) {
@@ -128164,12 +128211,6 @@ var import_quick_lru = /* @__PURE__ */ __toESM(require_quick_lru(), 1);
128164
128211
  const getTimestampSecondsAgo = (secondsToGoBack) => Math.round(Date.now() / 1e3) - secondsToGoBack;
128165
128212
  const testScore = (excludeScore, authorScore) => excludeScore === void 0 || excludeScore <= (authorScore || 0);
128166
128213
  const testFirstCommentTimestamp = (excludeTime, authorFirstCommentTimestamp) => excludeTime === void 0 || getTimestampSecondsAgo(excludeTime) >= (authorFirstCommentTimestamp || Infinity);
128167
- const testRole = (excludeRole, authorAddress, communityRoles) => {
128168
- if (excludeRole === void 0) return true;
128169
- if (communityRoles === void 0) return false;
128170
- for (const roleName of excludeRole) if (communityRoles[authorAddress]?.role === roleName) return true;
128171
- return false;
128172
- };
128173
128214
  const isVote = (request) => Boolean(request.vote);
128174
128215
  const isReply = (request) => isRequestPubsubPublicationOfReply(request);
128175
128216
  const isPost = (request) => isRequestPubsubPublicationOfPost(request);
@@ -128467,8 +128508,58 @@ const addToRateLimiter = (communityChallenges, request, challengeSuccess) => {
128467
128508
  for (const rateLimiter of Object.values(rateLimiters)) rateLimiter.tryRemoveTokens(1);
128468
128509
  };
128469
128510
  //#endregion
128511
+ //#region dist/node/runtime/node/community/local-community/author-identity.js
128512
+ function createAuthorIdentityMatcher({ community, publication }) {
128513
+ const log = logger_default("pkc-js:local-community:author-identity");
128514
+ const signerAddress = getPKCAddressFromPublicKeySync(publication.signature.publicKey);
128515
+ const wireName = getAuthorNameFromWire(publication.author);
128516
+ let nameResolvesToSignerPromise;
128517
+ const nameResolvesToSigner = () => {
128518
+ if (!wireName || !isStringDomain(wireName)) return Promise.resolve(false);
128519
+ if (!nameResolvesToSignerPromise) nameResolvesToSignerPromise = (async () => {
128520
+ try {
128521
+ const { resolvedAuthorName } = await community._clientsManager.resolveAuthorNameIfNeeded({
128522
+ authorName: wireName,
128523
+ abortSignal: AbortSignal.timeout(community._pkc._timeouts["resolve-author-name"]),
128524
+ cache: { maxAge: 0 }
128525
+ });
128526
+ return resolvedAuthorName === signerAddress;
128527
+ } catch (e) {
128528
+ log("Failed to resolve author name while matching identity, treating as no match", wireName, e);
128529
+ return false;
128530
+ }
128531
+ })();
128532
+ return nameResolvesToSignerPromise;
128533
+ };
128534
+ const matchesIdentity = async (identity) => {
128535
+ if (!isStringDomain(identity)) return identity === signerAddress;
128536
+ if (identity !== wireName) return false;
128537
+ return nameResolvesToSigner();
128538
+ };
128539
+ const matchesAnyIdentity = async (identities) => {
128540
+ let nameListed = false;
128541
+ for (const identity of identities) {
128542
+ if (identity === signerAddress) return true;
128543
+ if (wireName && identity === wireName) nameListed = true;
128544
+ }
128545
+ return nameListed ? nameResolvesToSigner() : false;
128546
+ };
128547
+ return {
128548
+ signerAddress,
128549
+ wireName,
128550
+ matchesIdentity,
128551
+ matchesAnyIdentity
128552
+ };
128553
+ }
128554
+ //#endregion
128470
128555
  //#region dist/node/runtime/node/community/challenges/exclude/exclude.js
128471
- const shouldExcludePublication = (communityChallenge, request, community) => {
128556
+ const testRole = async (excludeRole, getIdentityMatcher, communityRoles) => {
128557
+ if (!communityRoles) return false;
128558
+ const roleKeys = Object.keys(communityRoles).filter((roleKey) => excludeRole.includes(communityRoles[roleKey].role));
128559
+ if (roleKeys.length === 0) return false;
128560
+ return getIdentityMatcher().matchesAnyIdentity(roleKeys);
128561
+ };
128562
+ const shouldExcludePublication = async (communityChallenge, request, community) => {
128472
128563
  if (!communityChallenge) throw Error(`shouldExcludePublication invalid communityChallenge argument '${communityChallenge}'`);
128473
128564
  const publication = derivePublicationFromChallengeRequest(request);
128474
128565
  if (!publication?.author) throw Error(`shouldExcludePublication invalid publication argument '${publication}'`);
@@ -128476,21 +128567,24 @@ const shouldExcludePublication = (communityChallenge, request, community) => {
128476
128567
  if (!communityChallenge.exclude) return false;
128477
128568
  if (!Array.isArray(communityChallenge.exclude)) throw Error(`shouldExcludePublication invalid communityChallenge argument '${communityChallenge}' communityChallenge.exclude not an array`);
128478
128569
  let authorPublicationCounts;
128570
+ let identityMatcher;
128571
+ const getIdentityMatcher = () => identityMatcher ??= createAuthorIdentityMatcher({
128572
+ community,
128573
+ publication
128574
+ });
128479
128575
  for (const exclude of communityChallenge.exclude) {
128480
- if (typeof exclude.postScore !== "number" && typeof exclude.replyScore !== "number" && typeof exclude.postCount !== "number" && typeof exclude.replyCount !== "number" && typeof exclude.firstCommentTimestamp !== "number" && !exclude.address?.length && exclude.publicationType === void 0 && exclude.rateLimit === void 0 && !exclude.role?.length) continue;
128576
+ if (typeof exclude.postScore !== "number" && typeof exclude.replyScore !== "number" && typeof exclude.postCount !== "number" && typeof exclude.replyCount !== "number" && typeof exclude.firstCommentTimestamp !== "number" && !exclude.publicKeys?.length && !exclude.names?.length && exclude.publicationType === void 0 && exclude.rateLimit === void 0 && !exclude.roles?.length) continue;
128481
128577
  let shouldExclude = true;
128482
128578
  if (!testScore(exclude.postScore, author.community?.postScore)) shouldExclude = false;
128483
128579
  if (!testScore(exclude.replyScore, author.community?.replyScore)) shouldExclude = false;
128484
128580
  if (!testFirstCommentTimestamp(exclude.firstCommentTimestamp, author.community?.firstCommentTimestamp)) shouldExclude = false;
128485
128581
  if (!testPublicationType(exclude.publicationType, request)) shouldExclude = false;
128486
128582
  if (!testRateLimit(exclude, request)) shouldExclude = false;
128487
- if (exclude.address && !exclude.address.includes(author.address)) shouldExclude = false;
128488
- if (Array.isArray(exclude.role) && !testRole(exclude.role, publication.author.address, community?.roles)) shouldExclude = false;
128583
+ if (exclude.publicKeys && !exclude.publicKeys.includes(getIdentityMatcher().signerAddress)) shouldExclude = false;
128584
+ if (exclude.names && !await getIdentityMatcher().matchesAnyIdentity(exclude.names)) shouldExclude = false;
128585
+ if (Array.isArray(exclude.roles) && !await testRole(exclude.roles, getIdentityMatcher, community?.roles)) shouldExclude = false;
128489
128586
  if (typeof exclude.postCount === "number" || typeof exclude.replyCount === "number") {
128490
- if (!authorPublicationCounts && community?._dbHandler) {
128491
- const signerAddress = getPKCAddressFromPublicKeySync(publication.signature.publicKey);
128492
- authorPublicationCounts = community._dbHandler.queryAuthorPublicationCounts(signerAddress);
128493
- }
128587
+ if (!authorPublicationCounts && community?._dbHandler) authorPublicationCounts = community._dbHandler.queryAuthorPublicationCounts(getIdentityMatcher().signerAddress);
128494
128588
  if (!testScore(exclude.postCount, authorPublicationCounts?.postCount)) shouldExclude = false;
128495
128589
  if (!testScore(exclude.replyCount, authorPublicationCounts?.replyCount)) shouldExclude = false;
128496
128590
  }
@@ -128535,9 +128629,13 @@ const shouldExcludeChallengeCommentCids = async (communityChallenge, challengeRe
128535
128629
  if (typeof pkc?.getComment !== "function") throw Error(`shouldExcludeChallengeCommentCids invalid pkc argument '${pkc}'`);
128536
128630
  const publication = derivePublicationFromChallengeRequest(challengeRequestMessage);
128537
128631
  const commentCids = challengeRequestMessage.challengeCommentCids;
128538
- const author = publication?.author;
128539
128632
  if (commentCids && !Array.isArray(commentCids)) throw Error(`shouldExcludeChallengeCommentCids invalid commentCids argument '${commentCids}'`);
128540
- if (!author?.address || typeof author?.address !== "string") throw Error(`shouldExcludeChallengeCommentCids invalid challengeRequestMessage.publication.author.address argument '${author?.address}'`);
128633
+ let signerAddress;
128634
+ const getSignerAddress = () => {
128635
+ if (signerAddress) return signerAddress;
128636
+ if (typeof publication?.signature?.publicKey !== "string") throw Error(`shouldExcludeChallengeCommentCids invalid challengeRequestMessage.publication.signature.publicKey argument '${publication?.signature?.publicKey}'`);
128637
+ return signerAddress = getPKCAddressFromPublicKeySync(publication.signature.publicKey);
128638
+ };
128541
128639
  const _getComment = async (commentCid, addressesSet) => {
128542
128640
  let cachedComment = commentCache.get(commentCid);
128543
128641
  let comment;
@@ -128545,12 +128643,12 @@ const shouldExcludeChallengeCommentCids = async (communityChallenge, challengeRe
128545
128643
  comment = await pkc.getComment({ cid: commentCid });
128546
128644
  cachedComment = {
128547
128645
  communityAddress: comment.communityAddress,
128548
- author: { address: comment.author.address }
128646
+ author: { publicKey: comment.author.publicKey }
128549
128647
  };
128550
128648
  commentCache.set(commentCid, cachedComment);
128551
128649
  }
128552
128650
  if (!addressesSet.has(cachedComment.communityAddress)) throw Error(`comment doesn't have matching community address`);
128553
- if (cachedComment?.author?.address !== author.address) throw Error(`comment author address doesn't match publication author address`);
128651
+ if (cachedComment?.author?.publicKey !== getSignerAddress()) throw Error(`comment author signer doesn't match publication signer`);
128554
128652
  let cachedCommentUpdate = commentUpdateCache.get(commentCid);
128555
128653
  if (!cachedCommentUpdate) {
128556
128654
  const commentUpdate = comment || await pkc.createComment({ cid: commentCid });
@@ -128764,13 +128862,13 @@ var UrlsAddressesSet$1 = class {
128764
128862
  this.communities = {};
128765
128863
  setInterval(() => this.refetchAndUpdateAllUrlsSets(), 1e3 * 60 * 5).unref?.();
128766
128864
  }
128767
- async has(address, communityAddress, urlsString) {
128768
- if (!address || !communityAddress || !urlsString) return false;
128865
+ async getAddresses(communityAddress, urlsString) {
128866
+ const addresses = /* @__PURE__ */ new Set();
128867
+ if (!communityAddress || !urlsString) return addresses;
128769
128868
  await this.setUrls(communityAddress, urlsString);
128770
128869
  const community = this.communities[communityAddress];
128771
- const urlsSets = community.urls.map((url) => community.urlsSets[url]).filter(Boolean);
128772
- for (const urlSet of urlsSets) if (urlSet.has(address)) return true;
128773
- return false;
128870
+ for (const url of community.urls) for (const address of community.urlsSets[url] || []) addresses.add(address);
128871
+ return addresses;
128774
128872
  }
128775
128873
  async setUrls(communityAddress, urlsString) {
128776
128874
  let community = this.communities[communityAddress];
@@ -128799,12 +128897,16 @@ var UrlsAddressesSet$1 = class {
128799
128897
  }
128800
128898
  };
128801
128899
  const urlsAddressesSet$1 = new UrlsAddressesSet$1();
128802
- const getChallenge$3 = async ({ challengeSettings, challengeRequestMessage }) => {
128900
+ const getChallenge$3 = async ({ challengeSettings, challengeRequestMessage, community }) => {
128803
128901
  const error = challengeSettings?.options?.error;
128804
128902
  const addresses = challengeSettings?.options?.addresses?.split(",").map((u) => u.trim()).filter(Boolean);
128805
128903
  const addressesSet = new Set(addresses);
128806
128904
  const publication = derivePublicationFromChallengeRequest(challengeRequestMessage);
128807
- if (addressesSet.has(publication?.author?.address) || await urlsAddressesSet$1.has(publication?.author?.address, getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls)) return {
128905
+ const identityMatcher = createAuthorIdentityMatcher({
128906
+ community,
128907
+ publication
128908
+ });
128909
+ if (await identityMatcher.matchesAnyIdentity(addressesSet) || await identityMatcher.matchesAnyIdentity(await urlsAddressesSet$1.getAddresses(getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls))) return {
128808
128910
  success: false,
128809
128911
  error: error || `You're blacklisted.`
128810
128912
  };
@@ -128851,13 +128953,13 @@ var UrlsAddressesSet = class {
128851
128953
  this.communities = {};
128852
128954
  setInterval(() => this.refetchAndUpdateAllUrlsSets(), 1e3 * 60 * 5).unref?.();
128853
128955
  }
128854
- async has(address, communityAddress, urlsString) {
128855
- if (!address || !communityAddress || !urlsString) return false;
128956
+ async getAddresses(communityAddress, urlsString) {
128957
+ const addresses = /* @__PURE__ */ new Set();
128958
+ if (!communityAddress || !urlsString) return addresses;
128856
128959
  await this.setUrls(communityAddress, urlsString);
128857
128960
  const community = this.communities[communityAddress];
128858
- const urlsSets = community.urls.map((url) => community.urlsSets[url]).filter(Boolean);
128859
- for (const urlSet of urlsSets) if (urlSet.has(address)) return true;
128860
- return false;
128961
+ for (const url of community.urls) for (const address of community.urlsSets[url] || []) addresses.add(address);
128962
+ return addresses;
128861
128963
  }
128862
128964
  async setUrls(communityAddress, urlsString) {
128863
128965
  let community = this.communities[communityAddress];
@@ -128886,12 +128988,16 @@ var UrlsAddressesSet = class {
128886
128988
  }
128887
128989
  };
128888
128990
  const urlsAddressesSet = new UrlsAddressesSet();
128889
- const getChallenge$2 = async ({ challengeSettings, challengeRequestMessage }) => {
128991
+ const getChallenge$2 = async ({ challengeSettings, challengeRequestMessage, community }) => {
128890
128992
  const error = challengeSettings?.options?.error;
128891
128993
  const addresses = challengeSettings?.options?.addresses?.split(",").map((u) => u.trim()).filter(Boolean);
128892
128994
  const addressesSet = new Set(addresses);
128893
128995
  const publication = derivePublicationFromChallengeRequest(challengeRequestMessage);
128894
- if (!addressesSet.has(publication?.author?.address) && !await urlsAddressesSet.has(publication?.author?.address, getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls)) return {
128996
+ const identityMatcher = createAuthorIdentityMatcher({
128997
+ community,
128998
+ publication
128999
+ });
129000
+ if (!(await identityMatcher.matchesAnyIdentity(addressesSet) || await identityMatcher.matchesAnyIdentity(await urlsAddressesSet.getAddresses(getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls)))) return {
128895
129001
  success: false,
128896
129002
  error: error || `You're not whitelisted.`
128897
129003
  };
@@ -129323,7 +129429,7 @@ const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMes
129323
129429
  community
129324
129430
  })).challengeFile));
129325
129431
  await Promise.all(communityChallenges.map(async (communityChallenge, i) => {
129326
- if (shouldExcludePublication(communityChallenge, challengeRequestMessage, community)) {
129432
+ if (await shouldExcludePublication(communityChallenge, challengeRequestMessage, community)) {
129327
129433
  decided[i] = true;
129328
129434
  return;
129329
129435
  }
@@ -130283,4 +130389,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
130283
130389
  }
130284
130390
  };
130285
130391
  //#endregion
130286
- export { RepliesPages as $, RpcUnsubscribeParamSchema as $n, getPublicKeyFromPrivateKey as $t, deriveDbPosts as A, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as An, verifyCommentIpfs as At, setNativeFunctions as B, RpcEditCommunityParamSchema as Bn, getAuthorNameFromWire as Bt, BackupAbortError as C, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Cn, signCommunityEdit as Ct, createKuboRpcClient as D, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Dn, verifyChallengeRequest as Dt, calculateInlineRepliesBudget as E, parseJsonWithPKCErrorIfFails as En, verifyChallengeMessage as Et, importSignerIntoKuboNode as F, RpcCancelExportParamSchema as Fn, verifyCommunityEdit as Ft, REPLY_REPLIES_SORT_TYPES as G, RpcFetchCidParamSchema as Gn, getCommunityPublicKeyFromWire as Gt, CommentClientsManager as H, RpcExportCommunityModLogsResultSchema as Hn, buildRuntimeCommunityFields as Ht, listCommunitiesSync as I, RpcCidParamSchema as In, verifyVote as It, buildPagesRuntimeFields as J, RpcPublishChallengeAnswersParamSchema as Jn, encode as Jt, TIMEFRAMES_TO_SECONDS as K, RpcFetchCidResultSchema as Kn, normalizeCommunityInputFromCommunity as Kt, monitorCommunitiesDirectory as L, RpcCommentRepliesPageParamSchema as Ln, buildRuntimeAuthor as Lt, getDefaultCommunityDbConfig as M, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Mn, verifyCommentPubsubMessage as Mt, getDefaultDataPath as N, RpcAnchorPublishPreparationResultSchema as Nn, verifyCommentUpdate as Nt, deleteOldCommunityInWindows as O, parseRpcCommentEventWithPKCErrorIfItFails as On, verifyChallengeVerification as Ot, getThumbnailPropsOfLink as P, RpcAuthorNameParamSchema as Pn, verifyCommunity as Pt, parseRawPages as Q, RpcSuccessResultSchema as Qn, getPKCAddressFromPublicKeySync as Qt, moveCommunityDbToDeletedDirectory as R, RpcCommunityIdentifierParamSchema as Rn, cleanWireAuthor as Rt, encryptEd25519AesGcmPublicKeyBuffer as S, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Sn, signCommunity as St, calculateExpectedSignatureSize as T, parseDecryptedChallengeWithPKCErrorIfItFails as Tn, verifyChallengeAnswer as Tt, POSTS_SORT_TYPES as U, RpcExportCommunityParamSchema as Un, getCommunityAddressFromRecord as Ut, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as V, RpcExportCommunityModLogsParamSchema as Vn, normalizeCreatePublicationAuthor as Vt, POST_REPLIES_SORT_TYPES as W, RpcExportCommunityResultSchema as Wn, getCommunityNameFromWire$1 as Wt, findCommentInPageInstanceRecursively as X, RpcResolveAuthorNameResultSchema as Xn, getIpfsKeyFromPrivateKey as Xt, extractCommunityRuntimeFieldsFromParsedPages as Y, RpcPublishedAnchorRecordResultSchema as Yn, getBufferedPKCAddressFromPublicKey as Yt, iterateOverPageCidsToFindAllCids as Z, RpcSubscriptionIdResultSchema as Zn, getPKCAddressFromPublicKey as Zt, createSigner as _, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as _n, signComment as _t, loadChallengeFileFromCommunityChallengeSettings as a, parseCommentIpfsSchemaWithPKCErrorIfItFails as an, t$5 as ar, PublicationClientsManager as at, decryptEd25519AesGcmPublicKeyBuffer as b, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as bn, signCommentUpdate as bt, LRUCache as c, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as cn, t$7 as cr, pRetry as ct, KeyvBetterSqlite3 as d, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as dn, STORAGE_KEYS as dr, require_lib$1 as dt, createSchemaRowParser as en, crosspostChainDepthUpTo as er, applyNameResolvedCacheToCrosspost as et, decodeRpcChallengeAnswerPubsubMsg as f, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as fn, require_lodash_merge as fr, cleanUpBeforePublishing as ft, SignerWithPublicKeyAddress as g, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as gn, signChallengeVerification as gt, decodeRpcChallengeVerificationPubsubMsg as h, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as hn, signChallengeRequest as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as in, r as ir, stripNameResolvedFromCrosspost as it, deriveDbReplies as j, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as jn, verifyCommentModeration as jt, deriveCommentIpfsFromCommentTableRow as k, parseRpcCommentUpdateEventWithPKCErrorIfItFails as kn, verifyCommentEdit as kt, RemoteCommunity as l, parseCommunityAddressWithPKCErrorIfItFails as ln, t$8 as lr, pLimit as lt, decodeRpcChallengeRequestPubsubMsg as m, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as mn, require_undici as mr, signChallengeMessage as mt, RpcRemoteCommunity as n, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nn, t$2 as nr, collectCrosspostAuthorsToResolve as nt, pkcJsChallenges as o, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as on, n$5 as or, PKCClientsManager as ot, decodeRpcChallengePubsubMsg as p, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as pn, nativeFunctions$1 as pr, signChallengeAnswer as pt, buildPageRuntimeFields as q, RpcPublishAnchorRecordParamSchema as qn, decode as qt, getChallengeVerification as r, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as rn, t$4 as rr, extractCrosspostRuntimeFields as rt, TrackedInstanceRegistry as s, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as sn, n$6 as sr, InflightFetchManager as st, RpcLocalCommunity as t, parseCidStringSchemaWithPKCErrorIfItFails as tn, effectiveMaxCrosspostDepth as tr, cloneCrosspostForRuntime as tt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as u, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as un, stringify as ur, PKCTypedEmitter as ut, createAnchorIpnsRecord as v, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as vn, signCommentEdit as vt, backupCommunityDb as w, parseDecryptedChallengeVerification as wn, signVote as wt, encryptEd25519AesGcm as x, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xn, signCommentUpdateForChallengeVerification as xt, decryptEd25519AesGcm as y, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as yn, signCommentModeration as yt, resolveDbPostsCidRefs as z, RpcCommunityPageParamSchema as zn, getAuthorNameFromRuntime as zt };
130392
+ export { parseRawPages as $, RpcSuccessResultSchema as $n, getPKCAddressFromPublicKeySync as $t, deriveCommentIpfsFromCommentTableRow as A, parseRpcCommentUpdateEventWithPKCErrorIfItFails as An, verifyCommentEdit as At, resolveDbPostsCidRefs as B, RpcCommunityPageParamSchema as Bn, getAuthorNameFromRuntime as Bt, encryptEd25519AesGcmPublicKeyBuffer as C, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Cn, signCommunity as Ct, calculateInlineRepliesBudget as D, parseJsonWithPKCErrorIfFails as Dn, verifyChallengeMessage as Dt, calculateExpectedSignatureSize as E, parseDecryptedChallengeWithPKCErrorIfItFails as En, verifyChallengeAnswer as Et, getThumbnailPropsOfLink as F, RpcAuthorNameParamSchema as Fn, verifyCommunity as Ft, POST_REPLIES_SORT_TYPES as G, RpcExportCommunityResultSchema as Gn, getCommunityNameFromWire$1 as Gt, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as H, RpcExportCommunityModLogsParamSchema as Hn, normalizeCreatePublicationAuthor as Ht, importSignerIntoKuboNode as I, RpcCancelExportParamSchema as In, verifyCommunityEdit as It, buildPageRuntimeFields as J, RpcPublishAnchorRecordParamSchema as Jn, decode as Jt, REPLY_REPLIES_SORT_TYPES as K, RpcFetchCidParamSchema as Kn, getCommunityPublicKeyFromWire as Kt, listCommunitiesSync as L, RpcCidParamSchema as Ln, verifyVote as Lt, deriveDbReplies as M, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Mn, verifyCommentModeration as Mt, getDefaultCommunityDbConfig as N, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Nn, verifyCommentPubsubMessage as Nt, createKuboRpcClient as O, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as On, verifyChallengeRequest as Ot, getDefaultDataPath as P, RpcAnchorPublishPreparationResultSchema as Pn, verifyCommentUpdate as Pt, iterateOverPageCidsToFindAllCids as Q, RpcSubscriptionIdResultSchema as Qn, getPKCAddressFromPublicKey as Qt, monitorCommunitiesDirectory as R, RpcCommentRepliesPageParamSchema as Rn, buildRuntimeAuthor as Rt, encryptEd25519AesGcm as S, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as Sn, signCommentUpdateForChallengeVerification as St, backupCommunityDb as T, parseDecryptedChallengeVerification as Tn, signVote as Tt, CommentClientsManager as U, RpcExportCommunityModLogsResultSchema as Un, buildRuntimeCommunityFields as Ut, setNativeFunctions as V, RpcEditCommunityParamSchema as Vn, getAuthorNameFromWire as Vt, POSTS_SORT_TYPES as W, RpcExportCommunityParamSchema as Wn, getCommunityAddressFromRecord as Wt, extractCommunityRuntimeFieldsFromParsedPages as X, RpcPublishedAnchorRecordResultSchema as Xn, getBufferedPKCAddressFromPublicKey as Xt, buildPagesRuntimeFields as Y, RpcPublishChallengeAnswersParamSchema as Yn, encode as Yt, findCommentInPageInstanceRecursively as Z, RpcResolveAuthorNameResultSchema as Zn, getIpfsKeyFromPrivateKey as Zt, SignerWithPublicKeyAddress as _, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as _n, signChallengeVerification as _t, loadChallengeFileFromCommunityChallengeSettings as a, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as an, r as ar, stripNameResolvedFromCrosspost as at, decryptEd25519AesGcm as b, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as bn, signCommentModeration as bt, TrackedInstanceRegistry as c, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as cn, n$6 as cr, InflightFetchManager as ct, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as d, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as dn, stringify as dr, PKCTypedEmitter as dt, getPublicKeyFromPrivateKey as en, RpcUnsubscribeParamSchema as er, RepliesPages as et, KeyvBetterSqlite3 as f, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as fn, STORAGE_KEYS as fr, require_lib$1 as ft, decodeRpcChallengeVerificationPubsubMsg as g, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as gn, signChallengeRequest as gt, decodeRpcChallengeRequestPubsubMsg as h, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as hn, require_undici as hr, signChallengeMessage as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as in, t$4 as ir, extractCrosspostRuntimeFields as it, deriveDbPosts as j, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as jn, verifyCommentIpfs as jt, deleteOldCommunityInWindows as k, parseRpcCommentEventWithPKCErrorIfItFails as kn, verifyChallengeVerification as kt, LRUCache as l, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as ln, t$7 as lr, pRetry as lt, decodeRpcChallengePubsubMsg as m, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as mn, nativeFunctions$1 as mr, signChallengeAnswer as mt, RpcRemoteCommunity as n, parseCidStringSchemaWithPKCErrorIfItFails as nn, effectiveMaxCrosspostDepth as nr, cloneCrosspostForRuntime as nt, pkcJsChallenges as o, parseCommentIpfsSchemaWithPKCErrorIfItFails as on, t$5 as or, PublicationClientsManager as ot, decodeRpcChallengeAnswerPubsubMsg as p, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as pn, require_lodash_merge as pr, cleanUpBeforePublishing as pt, TIMEFRAMES_TO_SECONDS as q, RpcFetchCidResultSchema as qn, normalizeCommunityInputFromCommunity as qt, getChallengeVerification as r, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as rn, t$2 as rr, collectCrosspostAuthorsToResolve as rt, createAuthorIdentityMatcher as s, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as sn, n$5 as sr, PKCClientsManager as st, RpcLocalCommunity as t, createSchemaRowParser as tn, crosspostChainDepthUpTo as tr, applyNameResolvedCacheToCrosspost as tt, RemoteCommunity as u, parseCommunityAddressWithPKCErrorIfItFails as un, t$8 as ur, pLimit as ut, createSigner as v, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as vn, signComment as vt, BackupAbortError as w, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as wn, signCommunityEdit as wt, decryptEd25519AesGcmPublicKeyBuffer as x, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xn, signCommentUpdate as xt, createAnchorIpnsRecord as y, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as yn, signCommentEdit as yt, moveCommunityDbToDeletedDirectory as z, RpcCommunityIdentifierParamSchema as zn, cleanWireAuthor as zt };
@@ -5321,9 +5321,14 @@ var messages;
5321
5321
  messages["ERR_INVALID_COMMUNITY_EDIT_CHALLENGE_REQUEST_TO_ENCRYPT_SCHEMA"] = "RPC client sent an invalid schema for challenge request with communityEdit";
5322
5322
  messages["ERR_COMMUNITY_EDIT_OPTIONS_SCHEMA"] = "User sent a community edit options with invalid schema";
5323
5323
  messages["ERR_INVALID_CHALLENGE_ANSWERS"] = "User sent challenge answers with invalid schema";
5324
+ messages["ERR_CHALLENGE_ANSWER_ALREADY_PUBLISHED"] = "publishChallengeAnswers was called again for a challenge exchange whose answer has already been published or is being published. Each challenge is answered once";
5324
5325
  messages["ERR_INVALID_CREATE_PKC_WS_SERVER_OPTIONS_SCHEMA"] = "Invalid create arguments for PKC WS RPC server";
5325
5326
  messages["ERR_INVALID_CREATE_PKC_ARGS_SCHEMA"] = "User sent arguments with invalid schema in an attempt to create a PKC instance";
5326
5327
  messages["ERR_INVALID_CREATE_COMMUNITY_WITH_RPC_ARGS_SCHEMA"] = "User provided invalid schema of arguments for pkc.createCommunity while connected to RPC";
5328
+ messages["ERR_CHALLENGE_EXCLUDE_ADDRESS_FIELD_REMOVED"] = "community.settings.challenges[x].exclude[y].address has been removed. Use exclude.publicKeys for key-derived author addresses (author.publicKey) and exclude.names for author domains";
5329
+ messages["ERR_CHALLENGE_EXCLUDE_ROLE_FIELD_RENAMED"] = "community.settings.challenges[x].exclude[y].role has been renamed to exclude.roles";
5330
+ messages["ERR_CHALLENGE_EXCLUDE_PUBLIC_KEYS_MUST_NOT_BE_DOMAIN"] = "community.settings.challenges[x].exclude[y].publicKeys must contain key-derived author addresses (author.publicKey), not domains. Use exclude.names for domains";
5331
+ messages["ERR_CHALLENGE_EXCLUDE_NAMES_MUST_BE_DOMAIN"] = "community.settings.challenges[x].exclude[y].names must contain author domains, not key-derived addresses. Use exclude.publicKeys for addresses";
5327
5332
  messages["ERR_CAN_NOT_SET_EXCLUDE_PUBLICATION_TO_EMPTY_OBJECT"] = "The community has community.settings.challenges[x].exclude[y].publicationType is set to an empty object. You should either choose which publication to exclude or remove exclude.publicationType";
5328
5333
  messages["ERR_COMMUNITY_HAS_NO_INTERNAL_STATE"] = "The community has no internal state. This should never happen. Please report this bug.";
5329
5334
  messages["ERR_AUTHOR_ADDRESS_NOT_MATCHING_SIGNER"] = "comment.author.address does not match signer.address";
@@ -6568,6 +6573,18 @@ const VotePubsubReservedFields = r$2(n([
6568
6573
  "nameResolved"
6569
6574
  ]), t$3(VotePubsubMessagePublicationSchema.shape));
6570
6575
  //#endregion
6576
+ //#region dist/node/domain-util.js
6577
+ function isStringDomain(x) {
6578
+ return typeof x === "string" && x.includes(".");
6579
+ }
6580
+ function isEthAliasDomain$1(address) {
6581
+ const lower = address.toLowerCase();
6582
+ return lower.endsWith(".eth") || lower.endsWith(".bso");
6583
+ }
6584
+ function normalizeEthAliasDomain(address) {
6585
+ return address.endsWith(".bso") ? address.slice(0, -4) + ".eth" : address;
6586
+ }
6587
+ //#endregion
6571
6588
  //#region dist/node/community/schema.js
6572
6589
  const CommunityEncryptionSchema = looseObject({
6573
6590
  type: string().min(1),
@@ -6670,6 +6687,8 @@ const ChallengeExcludePublicationTypeSchema = looseObject({
6670
6687
  commentModeration: excludePublicationFieldSchema,
6671
6688
  communityEdit: excludePublicationFieldSchema
6672
6689
  }).refine((args) => !e$2(JSON.parse(JSON.stringify(args))), messages.ERR_CAN_NOT_SET_EXCLUDE_PUBLICATION_TO_EMPTY_OBJECT);
6690
+ const ChallengeExcludePublicKeySchema = AuthorAddressSchema.refine((address) => !isStringDomain(address), messages.ERR_CHALLENGE_EXCLUDE_PUBLIC_KEYS_MUST_NOT_BE_DOMAIN);
6691
+ const ChallengeExcludeNameSchema = AuthorAddressSchema.refine((name) => isStringDomain(name), messages.ERR_CHALLENGE_EXCLUDE_NAMES_MUST_BE_DOMAIN);
6673
6692
  const ChallengeExcludeSchema = looseObject({
6674
6693
  community: ChallengeExcludeCommunitySchema.optional(),
6675
6694
  postScore: number().int().optional(),
@@ -6678,18 +6697,20 @@ const ChallengeExcludeSchema = looseObject({
6678
6697
  replyCount: number().nonnegative().int().optional(),
6679
6698
  firstCommentTimestamp: PKCTimestampSchema.optional(),
6680
6699
  challenges: number().nonnegative().int().array().optional(),
6681
- role: CommunityRoleSchema.shape.role.array().optional(),
6682
- address: AuthorAddressSchema.array().optional(),
6700
+ roles: CommunityRoleSchema.shape.role.array().nonempty().optional(),
6701
+ publicKeys: ChallengeExcludePublicKeySchema.array().nonempty().optional(),
6702
+ names: ChallengeExcludeNameSchema.array().nonempty().optional(),
6683
6703
  rateLimit: number().nonnegative().int().optional(),
6684
6704
  rateLimitChallengeSuccess: boolean().optional(),
6685
6705
  publicationType: ChallengeExcludePublicationTypeSchema.optional()
6686
6706
  });
6707
+ const ChallengeExcludeSettingSchema = ChallengeExcludeSchema.refine((exclude) => !("address" in exclude), messages.ERR_CHALLENGE_EXCLUDE_ADDRESS_FIELD_REMOVED).refine((exclude) => !("role" in exclude), messages.ERR_CHALLENGE_EXCLUDE_ROLE_FIELD_RENAMED);
6687
6708
  const CommunityChallengeSettingSchema = object({
6688
6709
  path: string().optional(),
6689
6710
  name: string().optional(),
6690
6711
  options: record(string(), string()).optional(),
6691
6712
  publicOptions: string().array().optional(),
6692
- exclude: ChallengeExcludeSchema.array().nonempty().optional(),
6713
+ exclude: ChallengeExcludeSettingSchema.array().nonempty().optional(),
6693
6714
  description: string().optional(),
6694
6715
  pendingApproval: boolean().optional()
6695
6716
  }).strict().refine((challengeData) => challengeData.path || challengeData.name, "Path or name of challenge has to be defined");
@@ -15234,7 +15255,7 @@ var require_sha256 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15234
15255
  //#endregion
15235
15256
  //#region dist/node/pkc/tracked-instance-registry-util.js
15236
15257
  const trackedAliasHistorySymbol = Symbol("trackedAliasHistory");
15237
- function isEthAliasDomain$1(address) {
15258
+ function isEthAliasDomain(address) {
15238
15259
  const lower = address.toLowerCase();
15239
15260
  return lower.endsWith(".eth") || lower.endsWith(".bso");
15240
15261
  }
@@ -15281,7 +15302,7 @@ function getCommunityRegistryAliases(community, dataPath) {
15281
15302
  ]);
15282
15303
  if (aliases.length === 0) throw new PKCError("ERR_COMMUNITY_REGISTRY_LOOKUP_HAS_NO_ALIASES", { community });
15283
15304
  return scopeAliasesToDataPath(dedupeAliases(aliases.flatMap((alias) => {
15284
- if (isEthAliasDomain$1(alias)) return getEquivalentCommunityAliases(alias);
15305
+ if (isEthAliasDomain(alias)) return getEquivalentCommunityAliases(alias);
15285
15306
  return [alias];
15286
15307
  })), dataPath);
15287
15308
  }
@@ -15567,21 +15588,11 @@ async function genToArray(gen) {
15567
15588
  for await (const x of gen) out.push(x);
15568
15589
  return out;
15569
15590
  }
15570
- function isStringDomain(x) {
15571
- return typeof x === "string" && x.includes(".");
15572
- }
15573
- function isEthAliasDomain(address) {
15574
- const lower = address.toLowerCase();
15575
- return lower.endsWith(".eth") || lower.endsWith(".bso");
15576
- }
15577
- function normalizeEthAliasDomain(address) {
15578
- return address.endsWith(".bso") ? address.slice(0, -4) + ".eth" : address;
15579
- }
15580
15591
  function areEquivalentCommunityAddresses(addressA, addressB) {
15581
15592
  if (addressA === addressB) return true;
15582
15593
  const lowerA = addressA.toLowerCase();
15583
15594
  const lowerB = addressB.toLowerCase();
15584
- if (!isEthAliasDomain(lowerA) || !isEthAliasDomain(lowerB)) return false;
15595
+ if (!isEthAliasDomain$1(lowerA) || !isEthAliasDomain$1(lowerB)) return false;
15585
15596
  return normalizeEthAliasDomain(lowerA) === normalizeEthAliasDomain(lowerB);
15586
15597
  }
15587
15598
  function getEquivalentCommunityAddresses(address) {
@@ -16224,14 +16235,14 @@ function extractNetworkErrorDetails(err, depth = 0) {
16224
16235
  }
16225
16236
  //#endregion
16226
16237
  //#region dist/node/generated-version.js
16227
- const version = "0.0.99";
16238
+ const version = "0.0.101";
16228
16239
  //#endregion
16229
16240
  //#region dist/node/version.js
16230
16241
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
16231
16242
  const pkcJsVersion = version;
16232
16243
  var version_default = {
16233
16244
  PKC_JS_VERSION: pkcJsVersion,
16234
- DB_VERSION: 41,
16245
+ DB_VERSION: 42,
16235
16246
  PROTOCOL_VERSION: protocolVersion,
16236
16247
  USER_AGENT: UserAgentSchema.parse(`/pkc-js:${pkcJsVersion}/`)
16237
16248
  };
@@ -16378,4 +16389,4 @@ const DecryptedChallengeVerificationSchema = object({
16378
16389
  }).strict();
16379
16390
  const ChallengeVerificationMessageSignedPropertyNames = t$3(n$3(ChallengeVerificationMessageSchema.shape, ["signature"]));
16380
16391
  //#endregion
16381
- export { isRequestPubsubPublicationOfReply as $, CommunityAuthorChallengeReservedFieldNames as $n, CreateCommentModerationOptionsWithRefinementSchema as $t, doesDomainAddressHaveCapitalLetter as A, CommentUpdateReservedFields as An, boolean as Ar, listUpdatingCommunities as At, ipnsNameToIpnsOverPubsubTopic as B, CommentEditPubsubMessagePublicationSchema as Bn, stringifyPrimitive as Br, require_sha256 as Bt, calculateStringSizeSameAsIpfsAddCidV0 as C, CommentIpfsSchema as Cn, messages as Cr, writeKuboFilesWithTimeout as Ct, createAbortError as D, CommentUpdateChallengeReservedFieldNames as Dn, setErrorMap as Dr, findUpdatingCommunity as Dt, contentContainsMarkdownVideos as E, CommentSignedPropertyNames as En, require_ms as Er, findUpdatingComment as Et, getErrorCodeFromMessage as F, CreateCommentOptionsWithRefinementSchema as Fn, record as Fr, trackUpdatingComment as Ft, isIpnsPath as G, CreateCommentEditOptionsWithRefinementSchema as Gn, CommunityEditPublicationSignedPropertyNames as Gt, isIpfsCid as H, CommentEditReservedFields as Hn, pTimeout as Ht, getIpnsRecordInLocalKuboNode as I, GetPageParamSchema as In, string as Ir, trackUpdatingCommunity as It, isLinkOfImage as J, AuthorReservedFields as Jn, CommentModerationChallengeRequestToEncryptSchema as Jt, isLinkOfAnimatedImage as K, AuthorAddressSchema as Kn, CommunityEditPubsubMessagePublicationSchema as Kt, getPostUpdateTimestampRange as L, ModQueuePageIpfsSchema as Ln, ZodError as Lr, untrackStartedCommunity as Lt, fetchAndValidateIpnsRecordFromGateway as M, CommentUpdateSignedPropertyNames as Mn, literal as Mr, refreshTrackedCommunityAliases as Mt, genToArray as N, CommentUpdateTableRowSchema as Nn, number as Nr, syncCommunityRegistryEntry as Nt, deepMergeRuntimeFields as O, CommentUpdateForChallengeVerificationSchema as On, _enum as Or, listStartedCommunities as Ot, getEquivalentCommunityAddresses as P, CommentsTableRowSchema as Pn, object as Pr, trackStartedCommunity as Pt, isRequestPubsubPublicationOfPost as Q, CommunityAddressSchema as Qn, CommentModerationsTableRowSchema as Qt, hideClassPrivateProps as R, PageIpfsSchema as Rn, joinValues as Rr, untrackUpdatingComment as Rt, calculateIpfsCidV0 as S, CommentIpfsReservedFields as Sn, PKCError as Sr, waitForUpdateInCommunityInstanceWithErrorAndTimeout as St, contentContainsMarkdownImages as T, CommentPubsubMessageWithFlexibleAuthorRefinementSchema as Tn, require_supports_color as Tr, findStartedCommunity as Tt, isIpfsPath as U, CommentEditSignedPropertyNames as Un, CommunityEditPublicationChallengeRequestToEncryptSchema as Ut, isAbortError as V, CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema as Vn, TimeoutError as Vt, isIpns as W, CommentEditsTableRowSchema as Wn, CommunityEditPublicationPubsubReservedFields as Wt, isLinkOfVideo as X, CidPathSchema as Xn, CommentModerationReservedFields as Xt, isLinkOfMedia as Y, ChallengeAnswersSchema as Yn, CommentModerationPubsubMessagePublicationSchema as Yt, isLinkValid as Z, CidStringSchema as Zn, CommentModerationSignedPropertyNames as Zt, PKCUserOptionBaseSchema as _, VotePubsubMessagePublicationSchema as _n, FailedToFetchCommentIpfsFromGatewaysError as _r, shortifyCid as _t, ChallengeRequestMessageSchema as a, CommunityExportRecordsSchema as an, t$3 as ar, rejectWhenCommunityStopsOrAborts as at, areEquivalentCommunityAddresses as b, VoteTablesRowSchema as bn, FailedToFetchGenericIpfsFromGatewaysError as br, throwIfAbortSignalAborted as bt, ChallengeVerificationMessageSignedPropertyNames as c, CommunitySignedPropertyNames as cn, t$4 as cr, removeNullUndefinedEmptyObjectsValuesRecursively as ct, DecryptedChallengeRequestSchema as d, CreateRpcCommunityFunctionArgumentSchema as dn, n$7 as dr, replaceXWithY as dt, ChallengeFileFactorySchema as en, CreateSignerSchema as er, isStringDomain as et, DecryptedChallengeSchema as f, ExportCommunityModLogsOptionsSchema as fn, r$4 as fr, resolveWhenPredicateIsTrue as ft, PKCParsedOptionsSchema as g, VoteChallengeRequestToEncryptSchema as gn, require_retry as gr, shortifyAddress as gt, NameResolverSerializedSchema as h, CreateVoteUserOptionsWithRefinementSchema as hn, e$4 as hr, retryKuboIpfsAddAndProvide as ht, ChallengeMessageSignedPropertyNames as i, CommunityEditOptionsSchema as in, t$2 as ir, rejectWhenAbortSignalFires as it, extractNetworkErrorDetails as j, CommentUpdateSchema as jn, custom as jr, refreshTrackedCommentAliases as jt, derivePublicationFromChallengeRequest as k, CommentUpdateForChallengeVerificationSignedPropertyNames as kn, array as kr, listUpdatingComments as kt, DecryptedChallengeAnswerSchema as l, CreateNewLocalCommunityUserOptionsSchema as ln, r$2 as lr, removeNullUndefinedValues as lt, NameResolveCacheOptionsSchema as m, RpcRemoteCommunityUpdateEventResultSchema as mn, t$8 as mr, retryKuboIpfsAdd as mt, ChallengeAnswerMessageSignedPropertyNames as n, CommunityAnchorSchema as nn, t$1 as nr, pubsubTopicToDhtKeyCid as nt, ChallengeRequestMessageSignedPropertyNames as o, CommunityIpfsReservedFields as on, e as or, removeBlocksFromKuboNode as ot, DecryptedChallengeVerificationSchema as p, PubsubTopicSchema as pn, t$7 as pr, retryKuboBlockPutPinAndProvidePubsubTopic as pt, isLinkOfAudio as q, AuthorCommentIpfsReservedFields as qn, CreateCommunityEditPublicationOptionsWithRefinementSchema as qt, ChallengeMessageSchema as r, CommunityChallengeSettingSchema as rn, n$3 as rr, raceAgainstAbort as rt, ChallengeVerificationMessageSchema as s, CommunityIpfsSchema as sn, e$2 as sr, removeMfsFilesSafely as st, ChallengeAnswerMessageSchema as t, ChallengeFileSchema as tn, n as tr, pubsubTopicToDhtKey as tt, DecryptedChallengeRequestPublicationSchema as u, CreateRemoteCommunityFunctionArgumentSchema as un, t$5 as ur, removeUndefinedValuesRecursively as ut, PKCUserOptionsSchema as v, VotePubsubReservedFields as vn, FailedToFetchCommentUpdateFromGatewaysError as vr, sleepUntilTimeoutOrAbort as vt, contentContainsMarkdownAudio as w, CommentPubsubMessageReservedFields as wn, logger_default as wr, findCommunityInRegistry as wt, binaryKeyToPubsubTopic as x, CommentChallengeRequestToEncryptSchema as xn, FailedToFetchPageIpfsFromGatewaysError as xr, timestamp as xt, version_default as y, VoteSignedPropertyNames as yn, FailedToFetchCommunityFromGatewaysError as yr, statMfsPathSafely as yt, interruptibleSleep as z, CommentEditChallengeRequestToEncryptSchema as zn, parsedType as zr, untrackUpdatingCommunity as zt };
16392
+ export { isRequestPubsubPublicationOfReply as $, CommunityAuthorChallengeReservedFieldNames as $n, ChallengeFileFactorySchema as $t, doesDomainAddressHaveCapitalLetter as A, CommentUpdateReservedFields as An, boolean as Ar, refreshTrackedCommentAliases as At, ipnsNameToIpnsOverPubsubTopic as B, CommentEditPubsubMessagePublicationSchema as Bn, stringifyPrimitive as Br, TimeoutError as Bt, calculateStringSizeSameAsIpfsAddCidV0 as C, CommentIpfsSchema as Cn, messages as Cr, findCommunityInRegistry as Ct, createAbortError as D, CommentUpdateChallengeReservedFieldNames as Dn, setErrorMap as Dr, listStartedCommunities as Dt, contentContainsMarkdownVideos as E, CommentSignedPropertyNames as En, require_ms as Er, findUpdatingCommunity as Et, getErrorCodeFromMessage as F, CreateCommentOptionsWithRefinementSchema as Fn, record as Fr, trackUpdatingCommunity as Ft, isIpnsPath as G, CreateCommentEditOptionsWithRefinementSchema as Gn, CommunityEditPubsubMessagePublicationSchema as Gt, isIpfsCid as H, CommentEditReservedFields as Hn, CommunityEditPublicationChallengeRequestToEncryptSchema as Ht, getIpnsRecordInLocalKuboNode as I, GetPageParamSchema as In, string as Ir, untrackStartedCommunity as It, isLinkOfImage as J, AuthorReservedFields as Jn, CommentModerationPubsubMessagePublicationSchema as Jt, isLinkOfAnimatedImage as K, AuthorAddressSchema as Kn, CreateCommunityEditPublicationOptionsWithRefinementSchema as Kt, getPostUpdateTimestampRange as L, ModQueuePageIpfsSchema as Ln, ZodError as Lr, untrackUpdatingComment as Lt, fetchAndValidateIpnsRecordFromGateway as M, CommentUpdateSignedPropertyNames as Mn, literal as Mr, syncCommunityRegistryEntry as Mt, genToArray as N, CommentUpdateTableRowSchema as Nn, number as Nr, trackStartedCommunity as Nt, deepMergeRuntimeFields as O, CommentUpdateForChallengeVerificationSchema as On, _enum as Or, listUpdatingComments as Ot, getEquivalentCommunityAddresses as P, CommentsTableRowSchema as Pn, object as Pr, trackUpdatingComment as Pt, isRequestPubsubPublicationOfPost as Q, CommunityAddressSchema as Qn, CreateCommentModerationOptionsWithRefinementSchema as Qt, hideClassPrivateProps as R, PageIpfsSchema as Rn, joinValues as Rr, untrackUpdatingCommunity as Rt, calculateIpfsCidV0 as S, CommentIpfsReservedFields as Sn, PKCError as Sr, writeKuboFilesWithTimeout as St, contentContainsMarkdownImages as T, CommentPubsubMessageWithFlexibleAuthorRefinementSchema as Tn, require_supports_color as Tr, findUpdatingComment as Tt, isIpfsPath as U, CommentEditSignedPropertyNames as Un, CommunityEditPublicationPubsubReservedFields as Ut, isAbortError as V, CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema as Vn, pTimeout as Vt, isIpns as W, CommentEditsTableRowSchema as Wn, CommunityEditPublicationSignedPropertyNames as Wt, isLinkOfVideo as X, CidPathSchema as Xn, CommentModerationSignedPropertyNames as Xt, isLinkOfMedia as Y, ChallengeAnswersSchema as Yn, CommentModerationReservedFields as Yt, isLinkValid as Z, CidStringSchema as Zn, CommentModerationsTableRowSchema as Zt, PKCUserOptionBaseSchema as _, VotePubsubMessagePublicationSchema as _n, FailedToFetchCommentIpfsFromGatewaysError as _r, sleepUntilTimeoutOrAbort as _t, ChallengeRequestMessageSchema as a, CommunityIpfsReservedFields as an, t$3 as ar, removeBlocksFromKuboNode as at, areEquivalentCommunityAddresses as b, VoteTablesRowSchema as bn, FailedToFetchGenericIpfsFromGatewaysError as br, timestamp as bt, ChallengeVerificationMessageSignedPropertyNames as c, CreateNewLocalCommunityUserOptionsSchema as cn, t$4 as cr, removeNullUndefinedValues as ct, DecryptedChallengeRequestSchema as d, ExportCommunityModLogsOptionsSchema as dn, n$7 as dr, resolveWhenPredicateIsTrue as dt, ChallengeFileSchema as en, CreateSignerSchema as er, pubsubTopicToDhtKey as et, DecryptedChallengeSchema as f, PubsubTopicSchema as fn, r$4 as fr, retryKuboBlockPutPinAndProvidePubsubTopic as ft, PKCParsedOptionsSchema as g, VoteChallengeRequestToEncryptSchema as gn, require_retry as gr, shortifyCid as gt, NameResolverSerializedSchema as h, CreateVoteUserOptionsWithRefinementSchema as hn, e$4 as hr, shortifyAddress as ht, ChallengeMessageSignedPropertyNames as i, CommunityExportRecordsSchema as in, t$2 as ir, rejectWhenCommunityStopsOrAborts as it, extractNetworkErrorDetails as j, CommentUpdateSchema as jn, custom as jr, refreshTrackedCommunityAliases as jt, derivePublicationFromChallengeRequest as k, CommentUpdateForChallengeVerificationSignedPropertyNames as kn, array as kr, listUpdatingCommunities as kt, DecryptedChallengeAnswerSchema as l, CreateRemoteCommunityFunctionArgumentSchema as ln, r$2 as lr, removeUndefinedValuesRecursively as lt, NameResolveCacheOptionsSchema as m, isStringDomain as mn, t$8 as mr, retryKuboIpfsAddAndProvide as mt, ChallengeAnswerMessageSignedPropertyNames as n, CommunityChallengeSettingSchema as nn, t$1 as nr, raceAgainstAbort as nt, ChallengeRequestMessageSignedPropertyNames as o, CommunityIpfsSchema as on, e as or, removeMfsFilesSafely as ot, DecryptedChallengeVerificationSchema as p, RpcRemoteCommunityUpdateEventResultSchema as pn, t$7 as pr, retryKuboIpfsAdd as pt, isLinkOfAudio as q, AuthorCommentIpfsReservedFields as qn, CommentModerationChallengeRequestToEncryptSchema as qt, ChallengeMessageSchema as r, CommunityEditOptionsSchema as rn, n$3 as rr, rejectWhenAbortSignalFires as rt, ChallengeVerificationMessageSchema as s, CommunitySignedPropertyNames as sn, e$2 as sr, removeNullUndefinedEmptyObjectsValuesRecursively as st, ChallengeAnswerMessageSchema as t, CommunityAnchorSchema as tn, n as tr, pubsubTopicToDhtKeyCid as tt, DecryptedChallengeRequestPublicationSchema as u, CreateRpcCommunityFunctionArgumentSchema as un, t$5 as ur, replaceXWithY as ut, PKCUserOptionsSchema as v, VotePubsubReservedFields as vn, FailedToFetchCommentUpdateFromGatewaysError as vr, statMfsPathSafely as vt, contentContainsMarkdownAudio as w, CommentPubsubMessageReservedFields as wn, logger_default as wr, findStartedCommunity as wt, binaryKeyToPubsubTopic as x, CommentChallengeRequestToEncryptSchema as xn, FailedToFetchPageIpfsFromGatewaysError as xr, waitForUpdateInCommunityInstanceWithErrorAndTimeout as xt, version_default as y, VoteSignedPropertyNames as yn, FailedToFetchCommunityFromGatewaysError as yr, throwIfAbortSignalAborted as yt, interruptibleSleep as z, CommentEditChallengeRequestToEncryptSchema as zn, parsedType as zr, require_sha256 as zt };
@@ -1,4 +1,4 @@
1
- import { Sr as PKCError, nt as pubsubTopicToDhtKeyCid } from "./schema-f2Zr1ZxK.js";
1
+ import { Sr as PKCError, tt as pubsubTopicToDhtKeyCid } from "./schema-DdD_6tTd.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { ipnsValidator } from "ipns/validator";
4
4
  import { unmarshalIPNSRecord } from "ipns";
@@ -475,7 +475,7 @@ async function cacheIpnsRecordInPubsubLocalStore({ localStore, routingKey, marsh
475
475
  }
476
476
  await localStore.put(routingKey, marshalledRecord);
477
477
  }
478
- const DEFAULT_CACHED_IPNS_RECORD_TTL_MS = 6e4;
478
+ const DEFAULT_CACHED_IPNS_RECORD_TTL_MS = 2e4;
479
479
  function ipnsCacheTtlJitterFactor(routingKey) {
480
480
  let hash = 2166136261;
481
481
  for (let i = 0; i < routingKey.length; i++) {