@pkcprotocol/pkc-js 0.0.117 → 0.0.119

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 (82) hide show
  1. package/README.md +1 -0
  2. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -0
  3. package/dist/browser/clients/rpc-client/schema.d.ts +1 -0
  4. package/dist/browser/community/schema.d.ts +15 -0
  5. package/dist/browser/community/schema.js +2 -1
  6. package/dist/browser/community/schema.js.map +1 -1
  7. package/dist/browser/errors.d.ts +2 -0
  8. package/dist/browser/errors.js +2 -0
  9. package/dist/browser/errors.js.map +1 -1
  10. package/dist/browser/generated-version.d.ts +1 -1
  11. package/dist/browser/generated-version.js +1 -1
  12. package/dist/browser/pkc-error.d.ts +1 -1
  13. package/dist/browser/publications/community-edit/schema.d.ts +4 -0
  14. package/dist/browser/pubsub-messages/schema.d.ts +2 -0
  15. package/dist/browser/runtime/node/community/challenges/index.d.ts +17 -3
  16. package/dist/browser/runtime/node/community/challenges/index.js +58 -16
  17. package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
  18. package/dist/browser/runtime/node/community/challenges/validate-challenge-settings.js +1 -1
  19. package/dist/browser/runtime/node/community/challenges/validate-challenge-settings.js.map +1 -1
  20. package/dist/browser/runtime/node/community/local-community/challenges.js +7 -1
  21. package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
  22. package/dist/browser/runtime/node/community/local-community/db-state.js +5 -2
  23. package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
  24. package/dist/browser/runtime/node/community/local-community/editing.js +5 -2
  25. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  26. package/dist/browser/runtime/node/community/local-community/lifecycle.js +19 -4
  27. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  28. package/dist/browser/runtime/node/community/local-community/registry-sync.js +20 -5
  29. package/dist/browser/runtime/node/community/local-community/registry-sync.js.map +1 -1
  30. package/dist/browser/runtime/node/community/local-community.d.ts +1 -0
  31. package/dist/browser/runtime/node/community/local-community.js +3 -0
  32. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  33. package/dist/browser/schema/schema-util.d.ts +9 -0
  34. package/dist/browser/test/test-util.d.ts +4 -0
  35. package/dist/bundled/bundle-manifest.json +46 -46
  36. package/dist/bundled/challenges.js +1 -1
  37. package/dist/bundled/chunks/{helia-for-pkc-DuG274FA.js → helia-for-pkc-Cr90E9ul.js} +2 -2
  38. package/dist/bundled/chunks/{local-community-BsALoql_.js → local-community-B-UbNa-z.js} +1 -1
  39. package/dist/bundled/chunks/{local-community-XUj49rN_.js → local-community-DngOEreY.js} +37 -14
  40. package/dist/bundled/chunks/{node-DkNDHK6w.js → node-BHLzTAo9.js} +5 -5
  41. package/dist/bundled/chunks/{page-sort-scoring-Cd97obb3.js → page-sort-scoring-Drqxj8Pi.js} +1 -1
  42. package/dist/bundled/chunks/{rpc-local-community-7uUa4lxH.js → rpc-local-community-_ooAoNPM.js} +64 -20
  43. package/dist/bundled/chunks/{util-Bm9ef_d5.js → util-B-JWgzlN.js} +5 -2
  44. package/dist/bundled/chunks/{util-BMGkXifx.js → util-DX2ZJtU4.js} +1 -1
  45. package/dist/bundled/chunks/{validate-package-factories-DHupf8eD.js → validate-package-factories-BSmEBl_0.js} +2 -2
  46. package/dist/bundled/index.js +1 -1
  47. package/dist/bundled/page-sorts.js +1 -1
  48. package/dist/bundled/rpc/src/index.js +4 -4
  49. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -0
  50. package/dist/node/clients/rpc-client/schema.d.ts +1 -0
  51. package/dist/node/community/schema.d.ts +15 -0
  52. package/dist/node/community/schema.js +2 -1
  53. package/dist/node/community/schema.js.map +1 -1
  54. package/dist/node/errors.d.ts +2 -0
  55. package/dist/node/errors.js +2 -0
  56. package/dist/node/errors.js.map +1 -1
  57. package/dist/node/generated-version.d.ts +1 -1
  58. package/dist/node/generated-version.js +1 -1
  59. package/dist/node/pkc-error.d.ts +1 -1
  60. package/dist/node/publications/community-edit/schema.d.ts +4 -0
  61. package/dist/node/pubsub-messages/schema.d.ts +2 -0
  62. package/dist/node/runtime/node/community/challenges/index.d.ts +17 -3
  63. package/dist/node/runtime/node/community/challenges/index.js +58 -16
  64. package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
  65. package/dist/node/runtime/node/community/challenges/validate-challenge-settings.js +1 -1
  66. package/dist/node/runtime/node/community/challenges/validate-challenge-settings.js.map +1 -1
  67. package/dist/node/runtime/node/community/local-community/challenges.js +7 -1
  68. package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
  69. package/dist/node/runtime/node/community/local-community/db-state.js +5 -2
  70. package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
  71. package/dist/node/runtime/node/community/local-community/editing.js +5 -2
  72. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  73. package/dist/node/runtime/node/community/local-community/lifecycle.js +19 -4
  74. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  75. package/dist/node/runtime/node/community/local-community/registry-sync.js +20 -5
  76. package/dist/node/runtime/node/community/local-community/registry-sync.js.map +1 -1
  77. package/dist/node/runtime/node/community/local-community.d.ts +1 -0
  78. package/dist/node/runtime/node/community/local-community.js +3 -0
  79. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  80. package/dist/node/schema/schema-util.d.ts +9 -0
  81. package/dist/node/test/test-util.d.ts +4 -0
  82. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-XUj49rN_.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DngOEreY.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $t as CommentModerationPubsubMessagePublicationSchema, A as isLinkOfAnimatedImage, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Bn as CommentUpdateTableRowSchema, Dn as VoteTablesRowSchema, Dt as pTimeout, F as isLinkValid, Gr as ZodError, Jn as CommentEditPubsubMessagePublicationSchema, Jt as CommunityEditPublicationPubsubReservedFields, K as removeNullUndefinedValues, Kt as version_default, Lt as DecryptedChallengeRequestPublicationSchema, M as isLinkOfImage, Mr as logger_default, Mt as ChallengeRequestMessageSchema, N as isLinkOfMedia, Ot as ChallengeAnswerMessageSchema, P as isLinkOfVideo, Pt as ChallengeVerificationMessageSchema, Q as retryKuboIpfsAddAndProvide, Qn as CommentEditsTableRowSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rt as DecryptedChallengeRequestSchema, S as hideClassPrivateProps, Sr as t$2, St as untrackStartedCommunity, Tn as VotePubsubReservedFields, Tt as require_sha256, U as removeBlocksFromKuboNode, Vn as CommentsTableRowSchema, W as removeMfsFilesSafely, X as retryKuboBlockPutPinAndProvidePubsubTopic, Xn as CommentEditReservedFields, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as getEquivalentCommunityAddresses, _r as r$1, a as calculateUnixFsDagSizeCidV0, c as contentContainsMarkdownVideos, ct as writeKuboFilesWithTimeout, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$2, en as CommentModerationReservedFields, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, fr as t$5, ft as findUpdatingCommunity, g as genToArray, h as findMalformedUnicodeString, hr as e, i as calculateStringSizeSameAsIpfsAddCidV0, it as timestamp, j as isLinkOfAudio, jn as CommentPubsubMessageReservedFields, jr as messages, lr as n$3, lt as findCommunityInRegistry, mr as e$1, nn as CommentModerationsTableRowSchema, nr as AuthorReservedFields, nt as statMfsPathSafely, o as contentContainsMarkdownAudio, ot as withSortedKeys, pr as t$6, r as calculateIpfsCidV0, s as contentContainsMarkdownImages, st as withSortedKeysDeep, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, ur as t$7, ut as findStartedCommunity, v as getErrorCodeFromMessage, vr as t$3, vt as syncCommunityRegistryEntry, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, xr as t$4, xt as trackUpdatingCommunity, y as getIpnsRecordInLocalKuboNode, yt as trackStartedCommunity } from "./util-Bm9ef_d5.js";
3
- import { $n as calculateExpectedSignatureSize, $t as SignerWithPublicKeyAddress, A as iterateOverPageCidsToFindAllCids, An as verifyCommunityEdit, Ar as require_lodash_merge, C as TIMEFRAMES_TO_SECONDS, Cr as t$9, Dn as verifyCommentPubsubMessage, En as verifyCommentModeration, Fn as getAuthorNameFromWire, Gn as encode, H as pLimit, Hn as getCommunityPublicKeyFromWire, J as coerceSchemaRowBoolean, Jn as getPKCAddressFromPublicKey, Ln as crosspostChainDepthUpTo, Mn as buildRuntimeAuthor, Nn as cleanWireAuthor, On as verifyCommentUpdate, Qn as backupCommunityDb, Rn as effectiveMaxCrosspostDepth, Sn as verifyChallengeRequest, Tn as verifyCommentIpfs, Vn as getCommunityNameFromWire, Wn as decode, X as collectSchemaRowCoercions, Xn as getPublicKeyFromPrivateKey, Y as coerceSchemaRowJson, Yn as getPKCAddressFromPublicKeySync, Z as createSchemaRowParser, Zn as BackupAbortError, _ as TrackedInstanceRegistry, _n as signCommunity, _r as t$11, a as generatePagesReportingFailedSorts, an as encryptEd25519AesGcmPublicKeyBuffer, ar as deriveDbReplies, b as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, bn as verifyChallengeAnswer, br as n$5, c as resolvePageSortsOrThrow, cr as getThumbnailPropsOfLink, d as getCommunityChallengeFromCommunityChallengeSettings, dn as signChallengeVerification, dt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, er as calculateInlineRepliesBudget, f as loadChallengeFileFromCommunityChallengeSettings, fn as signComment, fr as moveCommunityDbToDeletedDirectory, g as createAuthorIdentityMatcher, gn as signCommentUpdateForChallengeVerification, gr as t$10, h as authorNameResolveFailureReason, hn as signCommentUpdate, i as derivePublicPageSorts, ir as deriveDbPosts, jn as verifyVote, kn as verifyCommunity, kr as STORAGE_KEYS, ln as signChallengeMessage, lr as importSignerIntoKuboNode, lt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, m as authorIdentityMatcherForRequest, nr as deleteOldCommunityInWindows, o as loadPageSortsForStartedCommunity, on as _validateSignatureOfPKCRecord, or as getDefaultCommunityDbConfig, p as pkcJsChallenges, pn as signCommentEdit, pr as resolveDbPostsCidRefs, qn as getIpfsKeyFromPrivateKey, r as computePageSortsFingerprint, rn as decryptEd25519AesGcmPublicKeyBuffer, rr as deriveCommentIpfsFromCommentTableRow, s as lookupPageSortFactories, sn as cleanUpBeforePublishing, t as RpcLocalCommunity, u as getChallengeVerification, v as LRUCache, vr as r$2, wn as verifyCommentEdit, wr as stringify, wt as parseJsonWithPKCErrorIfFails, x as KeyvBetterSqlite3, xr as n$4, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yr as t$8 } from "./rpc-local-community-7uUa4lxH.js";
4
- import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-Cd97obb3.js";
2
+ import { $t as CommentModerationPubsubMessagePublicationSchema, A as isLinkOfAnimatedImage, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Bn as CommentUpdateTableRowSchema, Dn as VoteTablesRowSchema, Dt as pTimeout, F as isLinkValid, Gr as ZodError, Jn as CommentEditPubsubMessagePublicationSchema, Jt as CommunityEditPublicationPubsubReservedFields, K as removeNullUndefinedValues, Kt as version_default, Lt as DecryptedChallengeRequestPublicationSchema, M as isLinkOfImage, Mr as logger_default, Mt as ChallengeRequestMessageSchema, N as isLinkOfMedia, Ot as ChallengeAnswerMessageSchema, P as isLinkOfVideo, Pt as ChallengeVerificationMessageSchema, Q as retryKuboIpfsAddAndProvide, Qn as CommentEditsTableRowSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rt as DecryptedChallengeRequestSchema, S as hideClassPrivateProps, Sr as t$2, St as untrackStartedCommunity, Tn as VotePubsubReservedFields, Tt as require_sha256, U as removeBlocksFromKuboNode, Vn as CommentsTableRowSchema, W as removeMfsFilesSafely, X as retryKuboBlockPutPinAndProvidePubsubTopic, Xn as CommentEditReservedFields, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as getEquivalentCommunityAddresses, _r as r$1, a as calculateUnixFsDagSizeCidV0, c as contentContainsMarkdownVideos, ct as writeKuboFilesWithTimeout, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$2, en as CommentModerationReservedFields, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, fr as t$5, ft as findUpdatingCommunity, g as genToArray, h as findMalformedUnicodeString, hr as e, i as calculateStringSizeSameAsIpfsAddCidV0, it as timestamp, j as isLinkOfAudio, jn as CommentPubsubMessageReservedFields, jr as messages, lr as n$3, lt as findCommunityInRegistry, mr as e$1, nn as CommentModerationsTableRowSchema, nr as AuthorReservedFields, nt as statMfsPathSafely, o as contentContainsMarkdownAudio, ot as withSortedKeys, pr as t$6, r as calculateIpfsCidV0, s as contentContainsMarkdownImages, st as withSortedKeysDeep, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, ur as t$7, ut as findStartedCommunity, v as getErrorCodeFromMessage, vr as t$3, vt as syncCommunityRegistryEntry, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, xr as t$4, xt as trackUpdatingCommunity, y as getIpnsRecordInLocalKuboNode, yt as trackStartedCommunity } from "./util-B-JWgzlN.js";
3
+ import { $n as backupCommunityDb, An as verifyCommunity, Ar as STORAGE_KEYS, Cn as verifyChallengeRequest, Dn as verifyCommentModeration, En as verifyCommentIpfs, Gn as decode, Hn as getCommunityNameFromWire, In as getAuthorNameFromWire, Jn as getIpfsKeyFromPrivateKey, Kn as encode, Mn as verifyVote, Nn as buildRuntimeAuthor, On as verifyCommentPubsubMessage, Pn as cleanWireAuthor, Q as createSchemaRowParser, Qn as BackupAbortError, Rn as crosspostChainDepthUpTo, S as KeyvBetterSqlite3, Sr as n$4, St as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Tn as verifyCommentEdit, Tr as stringify, Tt as parseJsonWithPKCErrorIfFails, U as pLimit, Un as getCommunityPublicKeyFromWire, X as coerceSchemaRowJson, Xn as getPKCAddressFromPublicKeySync, Y as coerceSchemaRowBoolean, Yn as getPKCAddressFromPublicKey, Z as collectSchemaRowCoercions, Zn as getPublicKeyFromPrivateKey, _ as createAuthorIdentityMatcher, _n as signCommentUpdateForChallengeVerification, _r as t$10, a as generatePagesReportingFailedSorts, ar as deriveDbPosts, br as t$8, c as resolvePageSortsOrThrow, cn as cleanUpBeforePublishing, d as getChallengeVerification, en as SignerWithPublicKeyAddress, er as calculateExpectedSignatureSize, f as getCommunityChallengeFromCommunityChallengeSettings, fn as signChallengeVerification, ft as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, g as authorNameResolveFailureReason, gn as signCommentUpdate, h as authorIdentityMatcherForRequest, i as derivePublicPageSorts, in as decryptEd25519AesGcmPublicKeyBuffer, ir as deriveCommentIpfsFromCommentTableRow, j as iterateOverPageCidsToFindAllCids, jn as verifyCommunityEdit, jr as require_lodash_merge, kn as verifyCommentUpdate, lr as getThumbnailPropsOfLink, m as pkcJsChallenges, mn as signCommentEdit, mr as resolveDbPostsCidRefs, o as loadPageSortsForStartedCommunity, on as encryptEd25519AesGcmPublicKeyBuffer, or as deriveDbReplies, p as loadChallengeFileFromCommunityChallengeSettings, pn as signComment, pr as moveCommunityDbToDeletedDirectory, r as computePageSortsFingerprint, rr as deleteOldCommunityInWindows, s as lookupPageSortFactories, sn as _validateSignatureOfPKCRecord, sr as getDefaultCommunityDbConfig, t as RpcLocalCommunity, tr as calculateInlineRepliesBudget, u as deriveCommunityChallengesOrThrow, un as signChallengeMessage, ur as importSignerIntoKuboNode, ut as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, v as TrackedInstanceRegistry, vn as signCommunity, vr as t$11, w as TIMEFRAMES_TO_SECONDS, wr as t$9, x as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, xn as verifyChallengeAnswer, xr as n$5, y as LRUCache, yr as r$2, zn as effectiveMaxCrosspostDepth } from "./rpc-local-community-_ooAoNPM.js";
4
+ import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-Drqxj8Pi.js";
5
5
  import { randomFillSync, randomUUID } from "node:crypto";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import path from "node:path";
@@ -1660,6 +1660,7 @@ async function collectChallengeSettingsValidationFailures({ challengeSettings, p
1660
1660
  challengeSettings: communityChallengeSettings,
1661
1661
  challengeFile: await loadChallengeFileFromCommunityChallengeSettings({
1662
1662
  communityChallengeSettings,
1663
+ challengeIndex,
1663
1664
  pkc
1664
1665
  }),
1665
1666
  challengeIndex
@@ -2493,8 +2494,9 @@ async function createNewLocalCommunityDb(community) {
2493
2494
  pkc: community._pkc,
2494
2495
  communityAddress: community.address
2495
2496
  });
2496
- community.challenges = await Promise.all(community.settings.challenges.map(async (cs) => (await getCommunityChallengeFromCommunityChallengeSettings({
2497
+ community.challenges = await Promise.all(community.settings.challenges.map(async (cs, challengeIndex) => (await getCommunityChallengeFromCommunityChallengeSettings({
2497
2498
  communityChallengeSettings: cs,
2499
+ challengeIndex,
2498
2500
  pkc: community._pkc
2499
2501
  })).communityChallenge));
2500
2502
  community._pageSorts = await resolvePageSortsOrThrow({
@@ -5904,6 +5906,7 @@ async function purgeDisapprovedCommentsOlderThan(community) {
5904
5906
  }
5905
5907
  //#endregion
5906
5908
  //#region dist/node/runtime/node/community/local-community/challenges.js
5909
+ const describeMisconfiguredChallenge = (e) => e instanceof PKCError && e.code === "ERR_CHALLENGE_NOT_REGISTERED" ? `challenge "${e.details.challengeName}" is not registered on this node` : e.message;
5907
5910
  function cleanUpChallengeAnswerPromise(community, challengeRequestIdString) {
5908
5911
  community._challengeAnswerPromises.delete(challengeRequestIdString);
5909
5912
  community._challengeAnswerResolveReject.delete(challengeRequestIdString);
@@ -6335,7 +6338,7 @@ async function runChallengeExchangeIfNeeded(community, parsed, log) {
6335
6338
  community.emit("error", e);
6336
6339
  challengeVerification = {
6337
6340
  challengeSuccess: false,
6338
- reason: `One of the community challenges is misconfigured: ${e.message}`
6341
+ reason: `One of the community challenges is misconfigured: ${describeMisconfiguredChallenge(e)}`
6339
6342
  };
6340
6343
  }
6341
6344
  return challengeVerification;
@@ -7354,14 +7357,26 @@ async function syncChallengesWithRegistry(community) {
7354
7357
  if (!Array.isArray(challengeSettings)) return;
7355
7358
  let challenges;
7356
7359
  try {
7357
- challenges = await Promise.all(challengeSettings.map(async (cs) => (await getCommunityChallengeFromCommunityChallengeSettings({
7358
- communityChallengeSettings: cs,
7359
- pkc: community._pkc
7360
- })).communityChallenge));
7360
+ challenges = await deriveCommunityChallengesOrThrow({
7361
+ challengeSettings,
7362
+ pkc: community._pkc,
7363
+ communityAddress: community.address
7364
+ });
7361
7365
  } catch (e) {
7362
7366
  log.error("Could not recompute community.challenges from the registry, keeping the previous ones", community.address, e);
7367
+ const reported = stringify(e.details?.failures?.map((f) => [
7368
+ f.challengeIndex,
7369
+ f.challengeName,
7370
+ f.path,
7371
+ f.error.code
7372
+ ]) ?? String(e));
7373
+ if (reported !== community._reportedChallengeLoadFailures) {
7374
+ community._reportedChallengeLoadFailures = reported;
7375
+ community.emit("error", e);
7376
+ }
7363
7377
  return;
7364
7378
  }
7379
+ community._reportedChallengeLoadFailures = void 0;
7365
7380
  if (stringify(challenges) === stringify(community.challenges ?? null)) return;
7366
7381
  log("community.challenges changed in the registry, republishing", community.address);
7367
7382
  community.challenges = challenges;
@@ -7821,6 +7836,11 @@ async function start(community) {
7821
7836
  anchorPublicKey: community.anchor.publicKey,
7822
7837
  minterAddress: community.signer.address
7823
7838
  });
7839
+ await deriveCommunityChallengesOrThrow({
7840
+ challengeSettings: community.settings?.challenges ?? [],
7841
+ pkc: community._pkc,
7842
+ communityAddress: community.address
7843
+ });
7824
7844
  community._setState("started");
7825
7845
  await community._updateStartedValue();
7826
7846
  await community._dbHandler.lockCommunityStart();
@@ -7832,6 +7852,11 @@ async function start(community) {
7832
7852
  await updateInstanceStateWithDbState(community);
7833
7853
  await community._loadExportsFromKeyv();
7834
7854
  await setChallengesToDefaultIfNotDefined(community, log);
7855
+ community.challenges = await deriveCommunityChallengesOrThrow({
7856
+ challengeSettings: community.settings.challenges,
7857
+ pkc: community._pkc,
7858
+ communityAddress: community.address
7859
+ });
7835
7860
  await importCommunitySignerIntoIpfsIfNeeded(community);
7836
7861
  await providePubsubTopicRoutingCidsIfNeeded(community, true);
7837
7862
  await reprovideAnchorRecordIfNeeded(community).catch((e) => log.error("Failed to re-provide the anchor record on start", e));
@@ -7840,10 +7865,6 @@ async function start(community) {
7840
7865
  await community._repinCommentsIPFSIfNeeded();
7841
7866
  await repinCommentUpdateIfNeeded(community);
7842
7867
  await community._listenToIncomingRequests();
7843
- community.challenges = await Promise.all(community.settings.challenges.map(async (cs) => (await getCommunityChallengeFromCommunityChallengeSettings({
7844
- communityChallengeSettings: cs,
7845
- pkc: community._pkc
7846
- })).communityChallenge));
7847
7868
  await emitChallengeSettingsValidationErrors(community, log);
7848
7869
  community._pageSorts = void 0;
7849
7870
  community._pageSortFactories = void 0;
@@ -8172,8 +8193,9 @@ async function parseChallengesToEdit(community, newChallengeSettings) {
8172
8193
  communityAddress: community.address
8173
8194
  });
8174
8195
  return {
8175
- challenges: await Promise.all(newChallengeSettings.map(async (cs) => (await getCommunityChallengeFromCommunityChallengeSettings({
8196
+ challenges: await Promise.all(newChallengeSettings.map(async (cs, challengeIndex) => (await getCommunityChallengeFromCommunityChallengeSettings({
8176
8197
  communityChallengeSettings: cs,
8198
+ challengeIndex,
8177
8199
  pkc: community._pkc
8178
8200
  })).communityChallenge)),
8179
8201
  _usingDefaultChallenge: isDefaultChallengeStructure(newChallengeSettings)
@@ -8534,6 +8556,7 @@ var LocalCommunity = class extends RpcLocalCommunity {
8534
8556
  this._combinedHashOfPendingCommentsCids = (0, import_sha256.sha256)("");
8535
8557
  this._pageSorts = void 0;
8536
8558
  this._pageSortFactories = void 0;
8559
+ this._reportedChallengeLoadFailures = void 0;
8537
8560
  this._publishLoopPromise = void 0;
8538
8561
  this._updateLoopPromise = void 0;
8539
8562
  this._firstUpdateAfterStart = true;
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as shortifyAddress, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Ct as untrackUpdatingComment, Dt as pTimeout, E as isIpfsCid, Er as FailedToFetchCommentUpdateFromGatewaysError, Et as TimeoutError, Fn as CommentUpdateForChallengeVerificationSchema, Fr as setErrorMap, H as rejectWhenCommunityStopsOrAborts, J as replaceXWithY, Jr as stringifyPrimitive, Kr as joinValues, Kt as version_default, Mr as logger_default, Mt as ChallengeRequestMessageSchema, O as isIpns, Ot as ChallengeAnswerMessageSchema, Pt as ChallengeVerificationMessageSchema, Rn as CommentUpdateSchema, S as hideClassPrivateProps, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256, V as rejectWhenAbortSignalFires, Y as resolveWhenPredicateIsTrue, Z as retryKuboIpfsAdd, _r as r, at as waitForUpdateInCommunityInstanceWithErrorAndTimeout, b as getPostUpdateTimestampRange, bt as trackUpdatingComment, dn as CommunityIpfsSchema, dr as n$1, dt as findUpdatingComment, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, ft as findUpdatingCommunity, gt as refreshTrackedCommentAliases, hr as e$1, ht as listUpdatingCommunities, it as timestamp, jr as messages, l as createAbortError, lr as n$2, mr as e, mt as listUpdatingComments, on as CommunityAnchorSchema, pr as t$1, pt as listStartedCommunities, q as removeUndefinedValuesRecursively, qr as parsedType, rt as throwIfAbortSignalAborted, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, ut as findStartedCommunity, w as ipnsNameToIpnsOverPubsubTopic, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, yn as PubsubTopicSchema } from "./util-Bm9ef_d5.js";
3
- import { An as verifyCommunityEdit, At as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, B as InflightResourceTypes, Bn as getCommunityAddressFromRecord, Bt as RpcExportCommunityModLogsResultSchema, Cn as verifyChallengeVerification, Cr as t$4, Ct as parseDecryptedChallengeWithPKCErrorIfItFails, D as findCommentInPageInstance, Dn as verifyCommentPubsubMessage, Dr as NAME_RESOLVED_TRUE_TTL_MS, Dt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, E as extractCommunityRuntimeFieldsFromParsedPages, En as verifyCommentModeration, Er as NAME_RESOLVED_FALSE_TTL_MS, Et as parseRpcCommentEventWithPKCErrorIfItFails, Ft as RpcCommentRepliesPageParamSchema, G as decodeRpcChallengePubsubMsg, Gt as RpcPublishAnchorRecordParamSchema, Hn as getCommunityPublicKeyFromWire, Ht as RpcExportCommunityResultSchema, I as stripNameResolvedFromCrosspost, In as normalizeCreatePublicationAuthor, It as RpcCommunityIdentifierParamSchema, Jt as RpcResolveAuthorNameResultSchema, K as decodeRpcChallengeRequestPubsubMsg, Kn as getBufferedPKCAddressFromPublicKey, Kt as RpcPublishChallengeAnswersParamSchema, L as PKCClientsManager, Lt as RpcCommunityPageParamSchema, M as applyNameResolvedCacheToCrosspost, Mn as buildRuntimeAuthor, Mr as require_undici, Mt as RpcAuthorNameParamSchema, N as cloneCrosspostForRuntime, Nn as cleanWireAuthor, Nt as RpcCancelExportParamSchema, O as findCommentInPageInstanceRecursively, On as verifyCommentUpdate, Or as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Ot as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, P as collectCrosspostAuthorsToResolve, Pn as getAuthorNameFromRuntime, Pt as RpcCidParamSchema, Q as parseCidStringSchemaWithPKCErrorIfItFails, Qt as require_lib$1, R as GenericStateClient, Rt as RpcEditCommunityParamSchema, S as RepliesPages, Sr as t$2, St as parseDecryptedChallengeVerification, Tn as verifyCommentIpfs, Tr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Tt as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, U as PKCTypedEmitter, Un as normalizeCommunityInputFromCommunity, Ut as RpcFetchCidParamSchema, Vn as getCommunityNameFromWire, Vt as RpcExportCommunityParamSchema, W as decodeRpcChallengeAnswerPubsubMsg, Wn as decode, Wt as RpcFetchCidResultSchema, Xt as RpcSuccessResultSchema, Yn as getPKCAddressFromPublicKeySync, Yt as RpcSubscriptionIdResultSchema, Zt as RpcUnsubscribeParamSchema, _ as TrackedInstanceRegistry, at as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, br as n$3, bt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, cn as signChallengeAnswer, dr as monitorCommunitiesDirectory, en as createSigner, fn as signComment, ft as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, gr as t$5, hr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, ht as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, in as encryptEd25519AesGcm, it as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, j as parseRawPages, jn as verifyVote, jr as nativeFunctions$2, jt as RpcAnchorPublishPreparationResultSchema, k as findCommentInParsedPages, l as pkcJsPageSorts, mn as signCommentModeration, mr as setNativeFunctions$1, mt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as decryptEd25519AesGcm, nt as parseCommentIpfsSchemaWithPKCErrorIfItFails, ot as parseCommentUpdateSchemaWithPKCErrorIfItFails, p as pkcJsChallenges, pn as signCommentEdit, pt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, q as decodeRpcChallengeVerificationPubsubMsg, qt as RpcPublishedAnchorRecordResultSchema, sn as cleanUpBeforePublishing, sr as getDefaultDataPath, st as parseCommunityAddressWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as createAnchorIpnsRecord$1, tr as createKuboRpcClient, tt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, un as signChallengeRequest, ur as listCommunitiesSync, ut as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, v as LRUCache, vn as signCommunityEdit, vt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, wn as verifyCommentEdit, wt as parseJsonWithPKCErrorIfFails, x as KeyvBetterSqlite3, xn as verifyChallengeMessage, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, y as RemoteCommunity, yn as signVote, yr as t$3, yt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, z as InflightFetchManager, zn as buildRuntimeCommunityFields, zt as RpcExportCommunityModLogsParamSchema } from "./rpc-local-community-7uUa4lxH.js";
4
- import { s as getHeliaDebugContext } from "./util-BMGkXifx.js";
2
+ import { $ as shortifyAddress, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Ct as untrackUpdatingComment, Dt as pTimeout, E as isIpfsCid, Er as FailedToFetchCommentUpdateFromGatewaysError, Et as TimeoutError, Fn as CommentUpdateForChallengeVerificationSchema, Fr as setErrorMap, H as rejectWhenCommunityStopsOrAborts, J as replaceXWithY, Jr as stringifyPrimitive, Kr as joinValues, Kt as version_default, Mr as logger_default, Mt as ChallengeRequestMessageSchema, O as isIpns, Ot as ChallengeAnswerMessageSchema, Pt as ChallengeVerificationMessageSchema, Rn as CommentUpdateSchema, S as hideClassPrivateProps, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256, V as rejectWhenAbortSignalFires, Y as resolveWhenPredicateIsTrue, Z as retryKuboIpfsAdd, _r as r, at as waitForUpdateInCommunityInstanceWithErrorAndTimeout, b as getPostUpdateTimestampRange, bt as trackUpdatingComment, dn as CommunityIpfsSchema, dr as n$1, dt as findUpdatingComment, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, ft as findUpdatingCommunity, gt as refreshTrackedCommentAliases, hr as e$1, ht as listUpdatingCommunities, it as timestamp, jr as messages, l as createAbortError, lr as n$2, mr as e, mt as listUpdatingComments, on as CommunityAnchorSchema, pr as t$1, pt as listStartedCommunities, q as removeUndefinedValuesRecursively, qr as parsedType, rt as throwIfAbortSignalAborted, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, ut as findStartedCommunity, w as ipnsNameToIpnsOverPubsubTopic, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, yn as PubsubTopicSchema } from "./util-B-JWgzlN.js";
3
+ import { $ as parseCidStringSchemaWithPKCErrorIfItFails, $t as require_lib$1, A as findCommentInParsedPages, B as InflightFetchManager, Bn as buildRuntimeCommunityFields, Bt as RpcExportCommunityModLogsParamSchema, C as RepliesPages, Cr as t$2, Ct as parseDecryptedChallengeVerification, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as verifyCommentModeration, Dr as NAME_RESOLVED_FALSE_TTL_MS, Dt as parseRpcCommentEventWithPKCErrorIfItFails, En as verifyCommentIpfs, Er as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Et as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, F as collectCrosspostAuthorsToResolve, Fn as getAuthorNameFromRuntime, Ft as RpcCidParamSchema, G as decodeRpcChallengeAnswerPubsubMsg, Gn as decode, Gt as RpcFetchCidResultSchema, Hn as getCommunityNameFromWire, Ht as RpcExportCommunityParamSchema, It as RpcCommentRepliesPageParamSchema, J as decodeRpcChallengeVerificationPubsubMsg, Jt as RpcPublishedAnchorRecordResultSchema, K as decodeRpcChallengePubsubMsg, Kt as RpcPublishAnchorRecordParamSchema, L as stripNameResolvedFromCrosspost, Ln as normalizeCreatePublicationAuthor, Lt as RpcCommunityIdentifierParamSchema, M as parseRawPages, Mn as verifyVote, Mr as nativeFunctions$2, Mt as RpcAnchorPublishPreparationResultSchema, N as applyNameResolvedCacheToCrosspost, Nn as buildRuntimeAuthor, Nr as require_undici, Nt as RpcAuthorNameParamSchema, O as findCommentInPageInstance, On as verifyCommentPubsubMessage, Or as NAME_RESOLVED_TRUE_TTL_MS, Ot as parseRpcCommentUpdateEventWithPKCErrorIfItFails, P as cloneCrosspostForRuntime, Pn as cleanWireAuthor, Pt as RpcCancelExportParamSchema, Qt as RpcUnsubscribeParamSchema, R as PKCClientsManager, Rt as RpcCommunityPageParamSchema, S as KeyvBetterSqlite3, Sn as verifyChallengeMessage, St as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Tn as verifyCommentEdit, Tt as parseJsonWithPKCErrorIfFails, Un as getCommunityPublicKeyFromWire, Ut as RpcExportCommunityResultSchema, V as InflightResourceTypes, Vn as getCommunityAddressFromRecord, Vt as RpcExportCommunityModLogsResultSchema, W as PKCTypedEmitter, Wn as normalizeCommunityInputFromCommunity, Wt as RpcFetchCidParamSchema, Xn as getPKCAddressFromPublicKeySync, Xt as RpcSubscriptionIdResultSchema, Yt as RpcResolveAuthorNameResultSchema, Zt as RpcSuccessResultSchema, _r as t$5, an as encryptEd25519AesGcm, at as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, b as RemoteCommunity, bn as signVote, br as t$3, bt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, cn as cleanUpBeforePublishing, cr as getDefaultDataPath, ct as parseCommunityAddressWithPKCErrorIfItFails, dn as signChallengeRequest, dr as listCommunitiesSync, dt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, fr as monitorCommunitiesDirectory, gr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, gt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, hn as signCommentModeration, hr as setNativeFunctions$1, ht as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, jn as verifyCommunityEdit, jt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kn as verifyCommentUpdate, kr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, kt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as signChallengeAnswer, m as pkcJsChallenges, mn as signCommentEdit, mt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as createAnchorIpnsRecord$1, nr as createKuboRpcClient, nt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ot as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, pn as signComment, pt as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, q as decodeRpcChallengeRequestPubsubMsg, qn as getBufferedPKCAddressFromPublicKey, qt as RpcPublishChallengeAnswersParamSchema, rn as decryptEd25519AesGcm, rt as parseCommentIpfsSchemaWithPKCErrorIfItFails, st as parseCommentUpdateSchemaWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as createSigner, v as TrackedInstanceRegistry, wn as verifyChallengeVerification, wr as t$4, wt as parseDecryptedChallengeWithPKCErrorIfItFails, xr as n$3, xt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signCommunityEdit, yt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, z as GenericStateClient, zt as RpcEditCommunityParamSchema } from "./rpc-local-community-_ooAoNPM.js";
4
+ import { s as getHeliaDebugContext } from "./util-DX2ZJtU4.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -8370,7 +8370,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8370
8370
  this.clients.libp2pJsClients = {};
8371
8371
  if (!this.libp2pJsClientsOptions) return;
8372
8372
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
8373
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-DuG274FA.js");
8373
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-Cr90E9ul.js");
8374
8374
  for (const clientOptions of this.libp2pJsClientsOptions) {
8375
8375
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
8376
8376
  ...clientOptions,
@@ -8649,7 +8649,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8649
8649
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
8650
8650
  log.trace("Received community options to create a local community instance:", options);
8651
8651
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
8652
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-BsALoql_.js");
8652
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-B-UbNa-z.js");
8653
8653
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
8654
8654
  const community = new LocalCommunity(this);
8655
8655
  if (isLocalCommunity) {
@@ -1,4 +1,4 @@
1
- import { _ as getEquivalentCommunityAddresses, vn as PageSortFileSchema } from "./util-Bm9ef_d5.js";
1
+ import { _ as getEquivalentCommunityAddresses, vn as PageSortFileSchema } from "./util-B-JWgzlN.js";
2
2
  //#region dist/node/pages/page-sort-scoring.js
3
3
  function validatePageSortFile(rawFile) {
4
4
  const validated = PageSortFileSchema.parse(rawFile);
@@ -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 { $ as shortifyAddress, $n as CreateCommentEditOptionsWithRefinementSchema, $t as CommentModerationPubsubMessagePublicationSchema, An as CommentIpfsSchema, Ar as PKCError, B as raceAgainstAbort, Br as literal, Bt as DecryptedChallengeVerificationSchema, C as interruptibleSleep, Cn as VoteChallengeRequestToEncryptSchema, Cr as e$4, D as isIpfsPath, Dr as FailedToFetchCommunityFromGatewaysError, Dt as pTimeout, E as isIpfsCid, En as VoteSignedPropertyNames, Er as FailedToFetchCommentUpdateFromGatewaysError, Ft as ChallengeVerificationMessageSignedPropertyNames, G as removeNullUndefinedEmptyObjectsValuesRecursively, Gn as PageIpfsSchema, Gt as PKCUserOptionsSchema, Hn as CreateCommentOptionsWithRefinementSchema, Hr as object, Ht as NameResolverSerializedSchema, I as isRequestPubsubPublicationOfPost, In as CommentUpdateForChallengeVerificationSignedPropertyNames, Ir as _enum, It as DecryptedChallengeAnswerSchema, Kn as isReservedObjectKey, L as isRequestPubsubPublicationOfReply, Ln as CommentUpdateReservedFields, Lr as array, Mn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Mr as logger_default, Nn as CommentSignedPropertyNames, Nr as require_supports_color, Nt as ChallengeRequestMessageSignedPropertyNames, O as isIpns, On as CommentChallengeRequestToEncryptSchema, Or as FailedToFetchGenericIpfsFromGatewaysError, Pn as CommentUpdateChallengeReservedFieldNames, Pr as require_ms$1, Qt as CommentModerationChallengeRequestToEncryptSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rr as boolean, S as hideClassPrivateProps, Sn as CreateVoteUserOptionsWithRefinementSchema, Sr as t$9, St as untrackStartedCommunity, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256$1, Un as GetPageParamSchema, Ur as record, Ut as PKCParsedOptionsSchema, Vr as number, Vt as NameResolveCacheOptionsSchema, Wn as ModQueuePageIpfsSchema, Wr as string, Wt as PKCUserOptionBaseSchema, Xt as CommunityEditPubsubMessagePublicationSchema, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Yt as CommunityEditPublicationSignedPropertyNames, Zn as CommentEditSignedPropertyNames, Zt as CreateCommunityEditPublicationOptionsWithRefinementSchema, _n as PageSortFileFactorySchema, _r as r$8, _t as refreshTrackedCommunityAliases, an as ChallengeFileSchema, ar as CidStringSchema, bn as RpcRemoteCommunityUpdateEventResultSchema, br as r$7, cn as CommunityEditOptionsSchema, cr as CreateSignerSchema, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$10, er as AuthorAddressSchema, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, ft as findUpdatingCommunity, gn as ExportCommunityModLogsOptionsSchema, gr as t$11, hn as CreateRpcCommunityFunctionArgumentSchema, hr as e$5, in as ChallengeFileFactorySchema, ir as CidPathSchema, it as timestamp, jr as messages, jt as ChallengeMessageSignedPropertyNames, k as isIpnsPath, kn as CommentIpfsReservedFields, kr as FailedToFetchPageIpfsFromGatewaysError, kt as ChallengeAnswerMessageSignedPropertyNames, l as createAbortError, ln as CommunityExportRecordsSchema, lr as n$9, m as fetchAndValidateIpnsRecordFromGateway, mn as CreateRemoteCommunityFunctionArgumentSchema, mr as e$6, nn as CommentModerationsTableRowSchema, or as CommunityAddressSchema, p as extractNetworkErrorDetails, pn as CreateNewLocalCommunityUserOptionsSchema, pr as t$13, qn as CommentEditChallengeRequestToEncryptSchema, qt as CommunityEditPublicationChallengeRequestToEncryptSchema, r as calculateIpfsCidV0, rn as CreateCommentModerationOptionsWithRefinementSchema, rr as ChallengeAnswersSchema, rt as throwIfAbortSignalAborted, sn as CommunityChallengeSettingSchema, sr as CommunityAuthorChallengeReservedFieldNames, t as areEquivalentCommunityAddresses, tn as CommentModerationSignedPropertyNames, tr as AuthorCommentIpfsReservedFields, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, un as CommunityIpfsReservedFields, ut as findStartedCommunity, vn as PageSortFileSchema, vr as t$12, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry$1, wt as untrackUpdatingCommunity, x as hasTransientNetworkErrorCode, xn as isStringDomain, xr as t$10, xt as trackUpdatingCommunity, yr as n$8, yt as trackStartedCommunity, zn as CommentUpdateSignedPropertyNames, zr as custom, zt as DecryptedChallengeSchema } from "./util-Bm9ef_d5.js";
2
+ import { $ as shortifyAddress, $n as CreateCommentEditOptionsWithRefinementSchema, $t as CommentModerationPubsubMessagePublicationSchema, An as CommentIpfsSchema, Ar as PKCError, B as raceAgainstAbort, Br as literal, Bt as DecryptedChallengeVerificationSchema, C as interruptibleSleep, Cn as VoteChallengeRequestToEncryptSchema, Cr as e$4, D as isIpfsPath, Dr as FailedToFetchCommunityFromGatewaysError, Dt as pTimeout, E as isIpfsCid, En as VoteSignedPropertyNames, Er as FailedToFetchCommentUpdateFromGatewaysError, Ft as ChallengeVerificationMessageSignedPropertyNames, G as removeNullUndefinedEmptyObjectsValuesRecursively, Gn as PageIpfsSchema, Gt as PKCUserOptionsSchema, Hn as CreateCommentOptionsWithRefinementSchema, Hr as object, Ht as NameResolverSerializedSchema, I as isRequestPubsubPublicationOfPost, In as CommentUpdateForChallengeVerificationSignedPropertyNames, Ir as _enum, It as DecryptedChallengeAnswerSchema, Kn as isReservedObjectKey, L as isRequestPubsubPublicationOfReply, Ln as CommentUpdateReservedFields, Lr as array, Mn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Mr as logger_default, Nn as CommentSignedPropertyNames, Nr as require_supports_color, Nt as ChallengeRequestMessageSignedPropertyNames, O as isIpns, On as CommentChallengeRequestToEncryptSchema, Or as FailedToFetchGenericIpfsFromGatewaysError, Pn as CommentUpdateChallengeReservedFieldNames, Pr as require_ms$1, Qt as CommentModerationChallengeRequestToEncryptSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rr as boolean, S as hideClassPrivateProps, Sn as CreateVoteUserOptionsWithRefinementSchema, Sr as t$9, St as untrackStartedCommunity, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256$1, Un as GetPageParamSchema, Ur as record, Ut as PKCParsedOptionsSchema, Vr as number, Vt as NameResolveCacheOptionsSchema, Wn as ModQueuePageIpfsSchema, Wr as string, Wt as PKCUserOptionBaseSchema, Xt as CommunityEditPubsubMessagePublicationSchema, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Yt as CommunityEditPublicationSignedPropertyNames, Zn as CommentEditSignedPropertyNames, Zt as CreateCommunityEditPublicationOptionsWithRefinementSchema, _n as PageSortFileFactorySchema, _r as r$8, _t as refreshTrackedCommunityAliases, an as ChallengeFileSchema, ar as CidStringSchema, bn as RpcRemoteCommunityUpdateEventResultSchema, br as r$7, cn as CommunityEditOptionsSchema, cr as CreateSignerSchema, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$10, er as AuthorAddressSchema, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, ft as findUpdatingCommunity, gn as ExportCommunityModLogsOptionsSchema, gr as t$11, hn as CreateRpcCommunityFunctionArgumentSchema, hr as e$5, in as ChallengeFileFactorySchema, ir as CidPathSchema, it as timestamp, jr as messages, jt as ChallengeMessageSignedPropertyNames, k as isIpnsPath, kn as CommentIpfsReservedFields, kr as FailedToFetchPageIpfsFromGatewaysError, kt as ChallengeAnswerMessageSignedPropertyNames, l as createAbortError, ln as CommunityExportRecordsSchema, lr as n$9, m as fetchAndValidateIpnsRecordFromGateway, mn as CreateRemoteCommunityFunctionArgumentSchema, mr as e$6, nn as CommentModerationsTableRowSchema, or as CommunityAddressSchema, p as extractNetworkErrorDetails, pn as CreateNewLocalCommunityUserOptionsSchema, pr as t$13, qn as CommentEditChallengeRequestToEncryptSchema, qt as CommunityEditPublicationChallengeRequestToEncryptSchema, r as calculateIpfsCidV0, rn as CreateCommentModerationOptionsWithRefinementSchema, rr as ChallengeAnswersSchema, rt as throwIfAbortSignalAborted, sn as CommunityChallengeSettingSchema, sr as CommunityAuthorChallengeReservedFieldNames, t as areEquivalentCommunityAddresses, tn as CommentModerationSignedPropertyNames, tr as AuthorCommentIpfsReservedFields, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, un as CommunityIpfsReservedFields, ut as findStartedCommunity, vn as PageSortFileSchema, vr as t$12, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry$1, wt as untrackUpdatingCommunity, x as hasTransientNetworkErrorCode, xn as isStringDomain, xr as t$10, xt as trackUpdatingCommunity, yr as n$8, yt as trackStartedCommunity, zn as CommentUpdateSignedPropertyNames, zr as custom, zt as DecryptedChallengeSchema } from "./util-B-JWgzlN.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
- import { s as validatePageSortFile } from "./page-sort-scoring-Cd97obb3.js";
4
+ import { s as validatePageSortFile } from "./page-sort-scoring-Drqxj8Pi.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import dns from "node:dns";
@@ -128292,6 +128292,19 @@ const accumulateChallengeResultExtras = ({ challengeResult, challengeIndex, agg
128292
128292
  const resolveChallengeFactoryByName = ({ name, pkc }) => {
128293
128293
  return { factory: pkc?.settings?.challenges?.[name] ?? pkcJsChallenges[name] };
128294
128294
  };
128295
+ const listAvailableChallengeNames = ({ pkc }) => [...new Set([...Object.keys(pkcJsChallenges), ...Object.keys(pkc?.settings?.challenges ?? {})])].sort();
128296
+ const resolveRegisteredChallengeFactory = ({ name, challengeIndex, pkc }) => {
128297
+ const { factory } = resolveChallengeFactoryByName({
128298
+ name,
128299
+ pkc
128300
+ });
128301
+ if (!factory) throw new PKCError("ERR_CHALLENGE_NOT_REGISTERED", {
128302
+ challengeName: name,
128303
+ challengeIndex,
128304
+ availableChallengeNames: listAvailableChallengeNames({ pkc })
128305
+ });
128306
+ return factory;
128307
+ };
128295
128308
  const pkcJsChallenges = {
128296
128309
  "text-math": ChallengeFileFactory$5,
128297
128310
  fail: ChallengeFileFactory$4,
@@ -128326,16 +128339,15 @@ const validateChallengeOrChallengeResult = ({ challengeOrChallengeResult, challe
128326
128339
  return { ok: true };
128327
128340
  };
128328
128341
  const loadChallengeFile = async ({ communityChallengeSettings, challengeIndex, community }) => {
128329
- if (!communityChallengeSettings.path && !resolveChallengeFactoryByName({
128342
+ if (!communityChallengeSettings.path && !communityChallengeSettings.name) throw Error("You have to provide either path or a stored pkc-js challenge");
128343
+ const registeredFactory = communityChallengeSettings.path ? void 0 : resolveRegisteredChallengeFactory({
128330
128344
  name: communityChallengeSettings.name,
128345
+ challengeIndex,
128331
128346
  pkc: community._pkc
128332
- }).factory) throw Error("You have to provide either path or a stored pkc-js challenge");
128347
+ });
128333
128348
  let ChallengeFileFactory;
128334
128349
  try {
128335
- ChallengeFileFactory = ChallengeFileFactorySchema.parse(communityChallengeSettings.path ? (await import(pathToFileURL(communityChallengeSettings.path).href)).default : resolveChallengeFactoryByName({
128336
- name: communityChallengeSettings.name,
128337
- pkc: community._pkc
128338
- }).factory);
128350
+ ChallengeFileFactory = ChallengeFileFactorySchema.parse(communityChallengeSettings.path ? (await import(pathToFileURL(communityChallengeSettings.path).href)).default : registeredFactory);
128339
128351
  validateChallengeFileFactory({
128340
128352
  challengeFileFactory: ChallengeFileFactory,
128341
128353
  challengeIndex,
@@ -128460,8 +128472,9 @@ const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMes
128460
128472
  const challengeCount = community.settings.challenges.length;
128461
128473
  const results = new Array(challengeCount);
128462
128474
  const decided = new Array(challengeCount).fill(false);
128463
- const communityChallenges = await Promise.all(community.settings.challenges.map(async (s) => (await getCommunityChallengeFromCommunityChallengeSettings({
128475
+ const communityChallenges = await Promise.all(community.settings.challenges.map(async (s, challengeIndex) => (await getCommunityChallengeFromCommunityChallengeSettings({
128464
128476
  communityChallengeSettings: s,
128477
+ challengeIndex,
128465
128478
  pkc: community._pkc
128466
128479
  })).communityChallenge));
128467
128480
  const challengeFiles = await Promise.all(community.settings.challenges.map(async (s, i) => (await loadChallengeFile({
@@ -128815,35 +128828,36 @@ const derivePublicOptions = (communityChallengeSettings) => {
128815
128828
  for (const optionName of publicOptions) if (typeof options[optionName] === "string") published[optionName] = options[optionName];
128816
128829
  return e$5(published) ? void 0 : published;
128817
128830
  };
128818
- const loadChallengeFileFromCommunityChallengeSettings = async ({ communityChallengeSettings, pkc }) => {
128831
+ const loadChallengeFileFromCommunityChallengeSettings = async ({ communityChallengeSettings, challengeIndex, pkc }) => {
128819
128832
  let challengeFile = void 0;
128820
128833
  if (communityChallengeSettings.path) try {
128821
128834
  const importedFile = await import(pathToFileURL(communityChallengeSettings.path).href);
128822
128835
  const ChallengeFileFactory = ChallengeFileFactorySchema.parse(importedFile.default);
128823
128836
  challengeFile = ChallengeFileSchema.parse(ChallengeFileFactory({ challengeSettings: communityChallengeSettings }));
128824
128837
  } catch (e) {
128825
- e.details = {
128826
- ...e.details,
128838
+ throw new PKCError("ERR_FAILED_TO_IMPORT_CHALLENGE_FILE_FACTORY", {
128827
128839
  path: communityChallengeSettings.path,
128828
- communityChallengeSettings
128829
- };
128830
- if (e instanceof Error) e.message = `getCommunityChallengeFromCommunityChallengeSettings failed importing challenge with path '${communityChallengeSettings.path}': ${e.message}`;
128831
- throw e;
128840
+ communityChallengeSettings,
128841
+ challengeIndex,
128842
+ error: e
128843
+ });
128832
128844
  }
128833
128845
  else if (communityChallengeSettings.name) {
128834
- const ChallengeFileFactory = ChallengeFileFactorySchema.parse(resolveChallengeFactoryByName({
128846
+ const ChallengeFileFactory = ChallengeFileFactorySchema.parse(resolveRegisteredChallengeFactory({
128835
128847
  name: communityChallengeSettings.name,
128848
+ challengeIndex,
128836
128849
  pkc
128837
- }).factory);
128850
+ }));
128838
128851
  challengeFile = ChallengeFileSchema.parse(ChallengeFileFactory({ challengeSettings: communityChallengeSettings }));
128839
128852
  }
128840
128853
  if (!challengeFile) throw Error("Failed to load challenge file");
128841
128854
  return challengeFile;
128842
128855
  };
128843
- const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityChallengeSettings, pkc }) => {
128856
+ const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityChallengeSettings, challengeIndex, pkc }) => {
128844
128857
  communityChallengeSettings = CommunityChallengeSettingSchema.parse(communityChallengeSettings);
128845
128858
  const challengeFile = await loadChallengeFileFromCommunityChallengeSettings({
128846
128859
  communityChallengeSettings,
128860
+ challengeIndex,
128847
128861
  pkc
128848
128862
  });
128849
128863
  const { challenge, type } = challengeFile;
@@ -128857,6 +128871,36 @@ const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityCh
128857
128871
  publicOptions: derivePublicOptions(communityChallengeSettings)
128858
128872
  } };
128859
128873
  };
128874
+ const deriveCommunityChallengesOrThrow = async ({ challengeSettings, pkc, communityAddress }) => {
128875
+ const results = await Promise.allSettled(challengeSettings.map((communityChallengeSettings, challengeIndex) => getCommunityChallengeFromCommunityChallengeSettings({
128876
+ communityChallengeSettings,
128877
+ challengeIndex,
128878
+ pkc
128879
+ })));
128880
+ const failures = [];
128881
+ results.forEach((result, challengeIndex) => {
128882
+ if (result.status === "fulfilled") return;
128883
+ const { name: challengeName, path } = challengeSettings[challengeIndex];
128884
+ const error = result.reason instanceof PKCError ? result.reason : new PKCError("ERR_FAILED_TO_IMPORT_CHALLENGE_FILE_FACTORY", {
128885
+ challengeName,
128886
+ path,
128887
+ challengeIndex,
128888
+ error: result.reason
128889
+ });
128890
+ failures.push({
128891
+ challengeIndex,
128892
+ challengeName,
128893
+ path,
128894
+ error
128895
+ });
128896
+ });
128897
+ if (failures.length) throw new PKCError("ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD", {
128898
+ communityAddress,
128899
+ failures,
128900
+ availableChallengeNames: listAvailableChallengeNames({ pkc })
128901
+ });
128902
+ return results.map((result) => result.value.communityChallenge);
128903
+ };
128860
128904
  //#endregion
128861
128905
  //#region dist/node/pages/page-sort-options.js
128862
128906
  const MAX_AGE_UNIT_SECONDS = Object.freeze({
@@ -130048,4 +130092,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
130048
130092
  }
130049
130093
  };
130050
130094
  //#endregion
130051
- export { parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as $, calculateExpectedSignatureSize as $n, SignerWithPublicKeyAddress as $t, iterateOverPageCidsToFindAllCids as A, verifyCommunityEdit as An, require_lodash_merge as Ar, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as At, InflightResourceTypes as B, getCommunityAddressFromRecord as Bn, RpcExportCommunityModLogsResultSchema as Bt, TIMEFRAMES_TO_SECONDS as C, verifyChallengeVerification as Cn, t$8 as Cr, parseDecryptedChallengeWithPKCErrorIfItFails as Ct, findCommentInPageInstance as D, verifyCommentPubsubMessage as Dn, NAME_RESOLVED_TRUE_TTL_MS as Dr, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Dt, extractCommunityRuntimeFieldsFromParsedPages as E, verifyCommentModeration as En, NAME_RESOLVED_FALSE_TTL_MS as Er, parseRpcCommentEventWithPKCErrorIfItFails as Et, extractCrosspostRuntimeFields as F, getAuthorNameFromWire as Fn, RpcCommentRepliesPageParamSchema as Ft, decodeRpcChallengePubsubMsg as G, encode as Gn, RpcPublishAnchorRecordParamSchema as Gt, pLimit as H, getCommunityPublicKeyFromWire as Hn, RpcExportCommunityResultSchema as Ht, stripNameResolvedFromCrosspost as I, normalizeCreatePublicationAuthor as In, RpcCommunityIdentifierParamSchema as It, coerceSchemaRowBoolean as J, getPKCAddressFromPublicKey as Jn, RpcResolveAuthorNameResultSchema as Jt, decodeRpcChallengeRequestPubsubMsg as K, getBufferedPKCAddressFromPublicKey as Kn, RpcPublishChallengeAnswersParamSchema as Kt, PKCClientsManager as L, crosspostChainDepthUpTo as Ln, RpcCommunityPageParamSchema as Lt, applyNameResolvedCacheToCrosspost as M, buildRuntimeAuthor as Mn, require_undici as Mr, RpcAuthorNameParamSchema as Mt, cloneCrosspostForRuntime as N, cleanWireAuthor as Nn, RpcCancelExportParamSchema as Nt, findCommentInPageInstanceRecursively as O, verifyCommentUpdate as On, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as Or, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as Ot, collectCrosspostAuthorsToResolve as P, getAuthorNameFromRuntime as Pn, RpcCidParamSchema as Pt, parseCidStringSchemaWithPKCErrorIfItFails as Q, backupCommunityDb as Qn, require_lib as Qt, GenericStateClient as R, effectiveMaxCrosspostDepth as Rn, RpcEditCommunityParamSchema as Rt, RepliesPages as S, verifyChallengeRequest as Sn, t$7 as Sr, parseDecryptedChallengeVerification as St, buildPagesRuntimeFields as T, verifyCommentIpfs as Tn, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as Tr, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Tt, PKCTypedEmitter as U, normalizeCommunityInputFromCommunity as Un, RpcFetchCidParamSchema as Ut, pRetry as V, getCommunityNameFromWire$1 as Vn, RpcExportCommunityParamSchema as Vt, decodeRpcChallengeAnswerPubsubMsg as W, decode as Wn, RpcFetchCidResultSchema as Wt, collectSchemaRowCoercions as X, getPublicKeyFromPrivateKey as Xn, RpcSuccessResultSchema as Xt, coerceSchemaRowJson as Y, getPKCAddressFromPublicKeySync as Yn, RpcSubscriptionIdResultSchema as Yt, createSchemaRowParser as Z, BackupAbortError as Zn, RpcUnsubscribeParamSchema as Zt, TrackedInstanceRegistry as _, signCommunity as _n, t$4 as _r, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, encryptEd25519AesGcmPublicKeyBuffer as an, deriveDbReplies as ar, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as at, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as b, verifyChallengeAnswer as bn, n$5 as br, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, signChallengeAnswer as cn, getThumbnailPropsOfLink as cr, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ct, getCommunityChallengeFromCommunityChallengeSettings as d, signChallengeVerification as dn, monitorCommunitiesDirectory as dr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as dt, createSigner as en, calculateInlineRepliesBudget as er, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as et, loadChallengeFileFromCommunityChallengeSettings as f, signComment as fn, moveCommunityDbToDeletedDirectory as fr, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as ft, createAuthorIdentityMatcher as g, signCommentUpdateForChallengeVerification as gn, t$2 as gr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as gt, authorNameResolveFailureReason as h, signCommentUpdate as hn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as hr, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, encryptEd25519AesGcm as in, deriveDbPosts as ir, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as it, parseRawPages as j, verifyVote as jn, nativeFunctions$1 as jr, RpcAnchorPublishPreparationResultSchema as jt, findCommentInParsedPages as k, verifyCommunity as kn, STORAGE_KEYS as kr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as kt, pkcJsPageSorts as l, signChallengeMessage as ln, importSignerIntoKuboNode as lr, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as lt, authorIdentityMatcherForRequest as m, signCommentModeration as mn, setNativeFunctions as mr, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, decryptEd25519AesGcm as nn, deleteOldCommunityInWindows as nr, parseCommentIpfsSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, _validateSignatureOfPKCRecord as on, getDefaultCommunityDbConfig as or, parseCommentUpdateSchemaWithPKCErrorIfItFails as ot, pkcJsChallenges as p, signCommentEdit as pn, resolveDbPostsCidRefs as pr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as pt, decodeRpcChallengeVerificationPubsubMsg as q, getIpfsKeyFromPrivateKey as qn, RpcPublishedAnchorRecordResultSchema as qt, computePageSortsFingerprint as r, decryptEd25519AesGcmPublicKeyBuffer as rn, deriveCommentIpfsFromCommentTableRow as rr, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, cleanUpBeforePublishing as sn, getDefaultDataPath as sr, parseCommunityAddressWithPKCErrorIfItFails as st, RpcLocalCommunity as t, createAnchorIpnsRecord as tn, createKuboRpcClient as tr, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as tt, getChallengeVerification as u, signChallengeRequest as un, listCommunitiesSync as ur, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as ut, LRUCache as v, signCommunityEdit as vn, r as vr, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as vt, buildPageRuntimeFields as w, verifyCommentEdit as wn, stringify as wr, parseJsonWithPKCErrorIfFails as wt, KeyvBetterSqlite3 as x, verifyChallengeMessage as xn, n$6 as xr, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as xt, RemoteCommunity as y, signVote as yn, t$5 as yr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as yt, InflightFetchManager as z, buildRuntimeCommunityFields as zn, RpcExportCommunityModLogsParamSchema as zt };
130095
+ export { parseCidStringSchemaWithPKCErrorIfItFails as $, backupCommunityDb as $n, require_lib as $t, findCommentInParsedPages as A, verifyCommunity as An, STORAGE_KEYS as Ar, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as At, InflightFetchManager as B, buildRuntimeCommunityFields as Bn, RpcExportCommunityModLogsParamSchema as Bt, RepliesPages as C, verifyChallengeRequest as Cn, t$7 as Cr, parseDecryptedChallengeVerification as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, verifyCommentModeration as Dn, NAME_RESOLVED_FALSE_TTL_MS as Dr, parseRpcCommentEventWithPKCErrorIfItFails as Dt, buildPagesRuntimeFields as E, verifyCommentIpfs as En, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as Er, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Et, collectCrosspostAuthorsToResolve as F, getAuthorNameFromRuntime as Fn, RpcCidParamSchema as Ft, decodeRpcChallengeAnswerPubsubMsg as G, decode as Gn, RpcFetchCidResultSchema as Gt, pRetry as H, getCommunityNameFromWire$1 as Hn, RpcExportCommunityParamSchema as Ht, extractCrosspostRuntimeFields as I, getAuthorNameFromWire as In, RpcCommentRepliesPageParamSchema as It, decodeRpcChallengeVerificationPubsubMsg as J, getIpfsKeyFromPrivateKey as Jn, RpcPublishedAnchorRecordResultSchema as Jt, decodeRpcChallengePubsubMsg as K, encode as Kn, RpcPublishAnchorRecordParamSchema as Kt, stripNameResolvedFromCrosspost as L, normalizeCreatePublicationAuthor as Ln, RpcCommunityIdentifierParamSchema as Lt, parseRawPages as M, verifyVote as Mn, nativeFunctions$1 as Mr, RpcAnchorPublishPreparationResultSchema as Mt, applyNameResolvedCacheToCrosspost as N, buildRuntimeAuthor as Nn, require_undici as Nr, RpcAuthorNameParamSchema as Nt, findCommentInPageInstance as O, verifyCommentPubsubMessage as On, NAME_RESOLVED_TRUE_TTL_MS as Or, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Ot, cloneCrosspostForRuntime as P, cleanWireAuthor as Pn, RpcCancelExportParamSchema as Pt, createSchemaRowParser as Q, BackupAbortError as Qn, RpcUnsubscribeParamSchema as Qt, PKCClientsManager as R, crosspostChainDepthUpTo as Rn, RpcCommunityPageParamSchema as Rt, KeyvBetterSqlite3 as S, verifyChallengeMessage as Sn, n$6 as Sr, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, verifyCommentEdit as Tn, stringify as Tr, parseJsonWithPKCErrorIfFails as Tt, pLimit as U, getCommunityPublicKeyFromWire as Un, RpcExportCommunityResultSchema as Ut, InflightResourceTypes as V, getCommunityAddressFromRecord as Vn, RpcExportCommunityModLogsResultSchema as Vt, PKCTypedEmitter as W, normalizeCommunityInputFromCommunity as Wn, RpcFetchCidParamSchema as Wt, coerceSchemaRowJson as X, getPKCAddressFromPublicKeySync as Xn, RpcSubscriptionIdResultSchema as Xt, coerceSchemaRowBoolean as Y, getPKCAddressFromPublicKey as Yn, RpcResolveAuthorNameResultSchema as Yt, collectSchemaRowCoercions as Z, getPublicKeyFromPrivateKey as Zn, RpcSuccessResultSchema as Zt, createAuthorIdentityMatcher as _, signCommentUpdateForChallengeVerification as _n, t$2 as _r, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, encryptEd25519AesGcm as an, deriveDbPosts as ar, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as at, RemoteCommunity as b, signVote as bn, t$5 as br, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, cleanUpBeforePublishing as cn, getDefaultDataPath as cr, parseCommunityAddressWithPKCErrorIfItFails as ct, getChallengeVerification as d, signChallengeRequest as dn, listCommunitiesSync as dr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as dt, SignerWithPublicKeyAddress as en, calculateExpectedSignatureSize as er, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as et, getCommunityChallengeFromCommunityChallengeSettings as f, signChallengeVerification as fn, monitorCommunitiesDirectory as fr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, signCommentUpdate as gn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as gr, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, signCommentModeration as hn, setNativeFunctions as hr, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, decryptEd25519AesGcmPublicKeyBuffer as in, deriveCommentIpfsFromCommentTableRow as ir, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, verifyCommunityEdit as jn, require_lodash_merge as jr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, verifyCommentUpdate as kn, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as kr, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as kt, pkcJsPageSorts as l, signChallengeAnswer as ln, getThumbnailPropsOfLink as lr, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as lt, pkcJsChallenges as m, signCommentEdit as mn, resolveDbPostsCidRefs as mr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, createAnchorIpnsRecord as nn, createKuboRpcClient as nr, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, encryptEd25519AesGcmPublicKeyBuffer as on, deriveDbReplies as or, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, signComment as pn, moveCommunityDbToDeletedDirectory as pr, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as pt, decodeRpcChallengeRequestPubsubMsg as q, getBufferedPKCAddressFromPublicKey as qn, RpcPublishChallengeAnswersParamSchema as qt, computePageSortsFingerprint as r, decryptEd25519AesGcm as rn, deleteOldCommunityInWindows as rr, parseCommentIpfsSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, _validateSignatureOfPKCRecord as sn, getDefaultCommunityDbConfig as sr, parseCommentUpdateSchemaWithPKCErrorIfItFails as st, RpcLocalCommunity as t, createSigner as tn, calculateInlineRepliesBudget as tr, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tt, deriveCommunityChallengesOrThrow as u, signChallengeMessage as un, importSignerIntoKuboNode as ur, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, signCommunity as vn, t$4 as vr, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, verifyChallengeVerification as wn, t$8 as wr, parseDecryptedChallengeWithPKCErrorIfItFails as wt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as x, verifyChallengeAnswer as xn, n$5 as xr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as xt, LRUCache as y, signCommunityEdit as yn, r as yr, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as yt, GenericStateClient as z, effectiveMaxCrosspostDepth as zn, RpcEditCommunityParamSchema as zt };
@@ -5582,6 +5582,8 @@ var messages;
5582
5582
  messages["ERR_CHALLENGE_PUBLIC_OPTION_NOT_DECLARED_IN_OPTION_INPUTS"] = "settings.challenges[i].publicOptions names an option that no optionInputs entry of the challenge declares";
5583
5583
  messages["ERR_CHALLENGE_SETTINGS_VALIDATION_FAILED"] = "The challenge's validateChallengeSettings hook rejected settings.challenges[i]";
5584
5584
  messages["ERR_CHALLENGE_SETTINGS_VALIDATION_FAILED_FOR_CHALLENGES"] = "One or more challenges in settings.challenges failed validation";
5585
+ messages["ERR_CHALLENGE_NOT_REGISTERED"] = "settings.challenges[i].name is not a challenge registered on this node, install its package or remove it from settings.challenges";
5586
+ messages["ERR_COMMUNITY_CHALLENGES_FAILED_TO_LOAD"] = "One or more challenges in settings.challenges could not be loaded, so the community cannot start until they are installed or removed from settings.challenges";
5585
5587
  messages["ERR_FAILED_TO_IMPORT_PAGE_SORT_FILE_FACTORY"] = "Failed to import page sort file factory";
5586
5588
  messages["ERR_PAGE_SORT_FILE_INVALID"] = "The page sort file did not return a valid PageSortFile";
5587
5589
  messages["ERR_PAGE_SORT_DUPLICATE_SORT_NAME"] = "Two entries of settings.pages resolve to the same sortName";
@@ -14379,7 +14381,8 @@ const CommunitySuggestedSchema = looseObject({
14379
14381
  avatarUrl: string().min(1).optional(),
14380
14382
  bannerUrl: string().min(1).optional(),
14381
14383
  backgroundUrl: string().min(1).optional(),
14382
- language: string().optional()
14384
+ language: string().optional(),
14385
+ uiType: string().optional()
14383
14386
  });
14384
14387
  const CommunityFeaturesSchema = looseObject({
14385
14388
  noVideos: boolean().optional(),
@@ -14799,7 +14802,7 @@ const CommunityEditPublicationPubsubReservedFields = r$2([
14799
14802
  ], t$3(CommunityEditPubsubMessagePublicationSchema.shape));
14800
14803
  //#endregion
14801
14804
  //#region dist/node/generated-version.js
14802
- const version = "0.0.117";
14805
+ const version = "0.0.119";
14803
14806
  //#endregion
14804
14807
  //#region dist/node/version.js
14805
14808
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
@@ -1,4 +1,4 @@
1
- import { Ar as PKCError, z as pubsubTopicToDhtKeyCid } from "./util-Bm9ef_d5.js";
1
+ import { Ar as PKCError, z as pubsubTopicToDhtKeyCid } from "./util-B-JWgzlN.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { ipnsValidator } from "ipns/validator";
4
4
  import { unmarshalIPNSRecord } from "ipns";
@@ -1,5 +1,5 @@
1
- import { Ar as PKCError, _n as PageSortFileFactorySchema, an as ChallengeFileSchema, in as ChallengeFileFactorySchema } from "./util-Bm9ef_d5.js";
2
- import { s as validatePageSortFile } from "./page-sort-scoring-Cd97obb3.js";
1
+ import { Ar as PKCError, _n as PageSortFileFactorySchema, an as ChallengeFileSchema, in as ChallengeFileFactorySchema } from "./util-B-JWgzlN.js";
2
+ import { s as validatePageSortFile } from "./page-sort-scoring-Drqxj8Pi.js";
3
3
  //#region dist/node/validate-package-factories.js
4
4
  function validateChallengeFileFactory(factory, { name }) {
5
5
  try {
@@ -1,2 +1,2 @@
1
- import { a as getShortCid, c as setNativeFunctions, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as pageSorts, t as PKC } from "./chunks/node-DkNDHK6w.js";
1
+ import { a as getShortCid, c as setNativeFunctions, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as pageSorts, t as PKC } from "./chunks/node-BHLzTAo9.js";
2
2
  export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, pageSorts, setNativeFunctions };
@@ -1,2 +1,2 @@
1
- import { n as validatePageSortFileFactory } from "./chunks/validate-package-factories-DHupf8eD.js";
1
+ import { n as validatePageSortFileFactory } from "./chunks/validate-package-factories-BSmEBl_0.js";
2
2
  export { validatePageSortFileFactory };
@@ -1,7 +1,7 @@
1
- import { Ar as PKCError, Dt as pTimeout, J as replaceXWithY, Mr as logger_default, S as hideClassPrivateProps, dr as n, pr as t, ut as findStartedCommunity } from "../../chunks/util-Bm9ef_d5.js";
2
- import { _ as parseRpcExportCommunityParam, b as parseRpcUnsubscribeParam, d as parseRpcCidParam, f as parseRpcCommentRepliesPageParam, g as parseRpcExportCommunityModLogsParam, h as parseRpcEditCommunityParam, l as parseRpcAuthorNameParam, m as parseRpcCommunityPageParam, p as parseRpcCommunityIdentifierParam, t as PKC, u as parseRpcCancelExportParam, v as parseRpcPublishAnchorRecordParam, y as parseRpcPublishChallengeAnswersParam } from "../../chunks/node-DkNDHK6w.js";
3
- import { $ as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, F as extractCrosspostRuntimeFields, H as pLimit, Ot as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Qt as require_lib, T as buildPagesRuntimeFields, V as pRetry, _r as t$1, _t as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, ct as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, et as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, gt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, kt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, rt as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, w as buildPageRuntimeFields, wr as stringify, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-7uUa4lxH.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-XUj49rN_.js";
1
+ import { Ar as PKCError, Dt as pTimeout, J as replaceXWithY, Mr as logger_default, S as hideClassPrivateProps, dr as n, pr as t, ut as findStartedCommunity } from "../../chunks/util-B-JWgzlN.js";
2
+ import { _ as parseRpcExportCommunityParam, b as parseRpcUnsubscribeParam, d as parseRpcCidParam, f as parseRpcCommentRepliesPageParam, g as parseRpcExportCommunityModLogsParam, h as parseRpcEditCommunityParam, l as parseRpcAuthorNameParam, m as parseRpcCommunityPageParam, p as parseRpcCommunityIdentifierParam, t as PKC, u as parseRpcCancelExportParam, v as parseRpcPublishAnchorRecordParam, y as parseRpcPublishChallengeAnswersParam } from "../../chunks/node-BHLzTAo9.js";
3
+ import { $t as require_lib, At as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, E as buildPagesRuntimeFields, H as pRetry, I as extractCrosspostRuntimeFields, St as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, T as buildPageRuntimeFields, Tr as stringify, U as pLimit, _t as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, et as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, it as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, kt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, lt as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, tt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ut as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, vr as t$1, vt as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-_ooAoNPM.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-DngOEreY.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -97,6 +97,7 @@ export declare const parseRpcEditCommunityParam: (params: unknown) => {
97
97
  bannerUrl?: string | undefined;
98
98
  backgroundUrl?: string | undefined;
99
99
  language?: string | undefined;
100
+ uiType?: string | undefined;
100
101
  } | undefined;
101
102
  address?: string | undefined;
102
103
  settings?: {
@@ -369,6 +369,7 @@ export declare const RpcEditCommunityParamSchema: z.ZodObject<{
369
369
  bannerUrl: z.ZodOptional<z.ZodString>;
370
370
  backgroundUrl: z.ZodOptional<z.ZodString>;
371
371
  language: z.ZodOptional<z.ZodString>;
372
+ uiType: z.ZodOptional<z.ZodString>;
372
373
  }, z.core.$loose>>>;
373
374
  address: z.ZodOptional<z.ZodOptional<z.ZodString>>;
374
375
  settings: z.ZodOptional<z.ZodOptional<z.ZodObject<{