@pkcprotocol/pkc-js 0.0.84 → 0.0.86

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 (119) hide show
  1. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -0
  2. package/dist/browser/clients/rpc-client/schema.d.ts +1 -0
  3. package/dist/browser/community/remote-community.d.ts +5 -0
  4. package/dist/browser/community/remote-community.js +98 -16
  5. package/dist/browser/community/remote-community.js.map +1 -1
  6. package/dist/browser/community/schema.d.ts +106 -2
  7. package/dist/browser/community/schema.js +30 -7
  8. package/dist/browser/community/schema.js.map +1 -1
  9. package/dist/browser/errors.d.ts +6 -1
  10. package/dist/browser/errors.js +8 -0
  11. package/dist/browser/errors.js.map +1 -1
  12. package/dist/browser/generated-version.d.ts +1 -1
  13. package/dist/browser/generated-version.js +1 -1
  14. package/dist/browser/index-with-compile-cache.d.ts +88 -2
  15. package/dist/browser/index.d.ts +88 -2
  16. package/dist/browser/pkc-error.d.ts +1 -1
  17. package/dist/browser/publications/community-edit/schema.d.ts +4 -0
  18. package/dist/browser/pubsub-messages/schema.d.ts +2 -0
  19. package/dist/browser/rpc/src/index.js +4 -1
  20. package/dist/browser/rpc/src/index.js.map +1 -1
  21. package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +44 -1
  22. package/dist/browser/rpc/src/schema.d.ts +265 -7
  23. package/dist/browser/rpc/src/schema.js +4 -2
  24. package/dist/browser/rpc/src/schema.js.map +1 -1
  25. package/dist/browser/runtime/node/community/challenges/exclude/exclude.d.ts +2 -2
  26. package/dist/browser/runtime/node/community/challenges/exclude/exclude.js +5 -1
  27. package/dist/browser/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
  28. package/dist/browser/runtime/node/community/challenges/index.d.ts +7 -3
  29. package/dist/browser/runtime/node/community/challenges/index.js +29 -6
  30. package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
  31. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.d.ts +4 -0
  32. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js +27 -0
  33. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js.map +1 -0
  34. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +2 -1
  35. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
  36. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/publication-match.js +34 -1
  37. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/publication-match.js.map +1 -1
  38. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/question.js +8 -1
  39. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/question.js.map +1 -1
  40. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +2 -1
  41. package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
  42. package/dist/browser/runtime/node/community/challenges/validate-challenge-settings.d.ts +22 -0
  43. package/dist/browser/runtime/node/community/challenges/validate-challenge-settings.js +92 -0
  44. package/dist/browser/runtime/node/community/challenges/validate-challenge-settings.js.map +1 -0
  45. package/dist/browser/runtime/node/community/db-handler.d.ts +1 -0
  46. package/dist/browser/runtime/node/community/local-community/db-state.js +8 -0
  47. package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
  48. package/dist/browser/runtime/node/community/local-community/editing.js +8 -0
  49. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  50. package/dist/browser/runtime/node/community/local-community/lifecycle.js +29 -0
  51. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  52. package/dist/browser/schema/schema-util.d.ts +9 -0
  53. package/dist/browser/schema.d.ts +352 -8
  54. package/dist/browser/test/test-util.d.ts +2 -0
  55. package/dist/bundled/bundle-manifest.json +27 -25
  56. package/dist/bundled/chunks/{helia-for-pkc-BlDudTLN.js → helia-for-pkc-yqf2rWMx.js} +2 -2
  57. package/dist/bundled/chunks/{local-community-4wIeaqty.js → local-community-BURzF_1m.js} +1 -1
  58. package/dist/bundled/chunks/{local-community-5PMI-TDB.js → local-community-NUwjwbZz.js} +107 -2
  59. package/dist/bundled/chunks/{node-B7GkmuSc.js → node-BbvETZ1u.js} +5 -5
  60. package/dist/bundled/chunks/{rpc-local-community-r51cTBYd.js → rpc-local-community-Cpw9_Nuo.js} +119 -30
  61. package/dist/bundled/chunks/{schema-AXrL86Q4.js → schema-BT0023M6.js} +50 -6
  62. package/dist/bundled/chunks/{util-CwzCEPKs.js → util-BmT_84kq.js} +1 -1
  63. package/dist/bundled/index.js +1 -1
  64. package/dist/bundled/rpc/src/index.js +5 -5
  65. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -0
  66. package/dist/node/clients/rpc-client/schema.d.ts +1 -0
  67. package/dist/node/community/remote-community.d.ts +5 -0
  68. package/dist/node/community/remote-community.js +98 -16
  69. package/dist/node/community/remote-community.js.map +1 -1
  70. package/dist/node/community/schema.d.ts +106 -2
  71. package/dist/node/community/schema.js +30 -7
  72. package/dist/node/community/schema.js.map +1 -1
  73. package/dist/node/errors.d.ts +6 -1
  74. package/dist/node/errors.js +8 -0
  75. package/dist/node/errors.js.map +1 -1
  76. package/dist/node/generated-version.d.ts +1 -1
  77. package/dist/node/generated-version.js +1 -1
  78. package/dist/node/index-with-compile-cache.d.ts +88 -2
  79. package/dist/node/index.d.ts +88 -2
  80. package/dist/node/pkc-error.d.ts +1 -1
  81. package/dist/node/publications/community-edit/schema.d.ts +4 -0
  82. package/dist/node/pubsub-messages/schema.d.ts +2 -0
  83. package/dist/node/rpc/src/index.js +4 -1
  84. package/dist/node/rpc/src/index.js.map +1 -1
  85. package/dist/node/rpc/src/lib/pkc-js/index.d.ts +44 -1
  86. package/dist/node/rpc/src/schema.d.ts +265 -7
  87. package/dist/node/rpc/src/schema.js +4 -2
  88. package/dist/node/rpc/src/schema.js.map +1 -1
  89. package/dist/node/runtime/node/community/challenges/exclude/exclude.d.ts +2 -2
  90. package/dist/node/runtime/node/community/challenges/exclude/exclude.js +5 -1
  91. package/dist/node/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
  92. package/dist/node/runtime/node/community/challenges/index.d.ts +7 -3
  93. package/dist/node/runtime/node/community/challenges/index.js +29 -6
  94. package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
  95. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.d.ts +4 -0
  96. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js +27 -0
  97. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js.map +1 -0
  98. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +2 -1
  99. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
  100. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/publication-match.js +34 -1
  101. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/publication-match.js.map +1 -1
  102. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/question.js +8 -1
  103. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/question.js.map +1 -1
  104. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +2 -1
  105. package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
  106. package/dist/node/runtime/node/community/challenges/validate-challenge-settings.d.ts +22 -0
  107. package/dist/node/runtime/node/community/challenges/validate-challenge-settings.js +92 -0
  108. package/dist/node/runtime/node/community/challenges/validate-challenge-settings.js.map +1 -0
  109. package/dist/node/runtime/node/community/db-handler.d.ts +1 -0
  110. package/dist/node/runtime/node/community/local-community/db-state.js +8 -0
  111. package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
  112. package/dist/node/runtime/node/community/local-community/editing.js +8 -0
  113. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  114. package/dist/node/runtime/node/community/local-community/lifecycle.js +29 -0
  115. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  116. package/dist/node/schema/schema-util.d.ts +9 -0
  117. package/dist/node/schema.d.ts +352 -8
  118. package/dist/node/test/test-util.d.ts +2 -0
  119. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $n as n$10, $t as ChallengeFileSchema, A as extractNetworkErrorDetails, An as CommentUpdateSignedPropertyNames, Ar as literal, At as refreshTrackedCommunityAliases, B as isIpfsCid, Bt as pTimeout, Cn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Cr as require_supports_color, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateForChallengeVerificationSignedPropertyNames, Dr as array, E as createAbortError, Er as _enum, Et as listStartedCommunities, Fn as ModQueuePageIpfsSchema, Ft as untrackStartedCommunity, Gn as AuthorCommentIpfsReservedFields, Gt as CreateCommunityEditPublicationOptionsWithRefinementSchema, H as isIpns, I as getPostUpdateTimestampRange, In as PageIpfsSchema, It as untrackUpdatingComment, Jn as CidPathSchema, Kt as CommentModerationChallengeRequestToEncryptSchema, L as hideClassPrivateProps, Ln as CommentEditChallengeRequestToEncryptSchema, Lt as untrackUpdatingCommunity, Mr as object, Mt as trackStartedCommunity, Nn as CreateCommentOptionsWithRefinementSchema, Nr as record, O as derivePublicationFromChallengeRequest, On as CommentUpdateReservedFields, Or as boolean, Ot as listUpdatingCommunities, Pn as GetPageParamSchema, Pr as string, Pt as trackUpdatingCommunity, Q as isStringDomain, Qn as CreateSignerSchema, Qt as ChallengeFileFactorySchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as require_sha256$1, Sr as logger_default, Tn as CommentUpdateChallengeReservedFieldNames, Tt as findUpdatingCommunity, U as isIpnsPath, Un as CreateCommentEditOptionsWithRefinementSchema, Ut as CommunityEditPublicationSignedPropertyNames, V as isIpfsPath, Vn as CommentEditSignedPropertyNames, Vt as CommunityEditPublicationChallengeRequestToEncryptSchema, Wn as AuthorAddressSchema, Wt as CommunityEditPubsubMessagePublicationSchema, X as isRequestPubsubPublicationOfPost, Xn as CommunityAddressSchema, Xt as CommentModerationsTableRowSchema, Yn as CidStringSchema, Yt as CommentModerationSignedPropertyNames, Z as isRequestPubsubPublicationOfReply, Zn as CommunityAuthorChallengeReservedFieldNames, Zt as CreateCommentModerationOptionsWithRefinementSchema, _ as PKCUserOptionBaseSchema, _n as VoteSignedPropertyNames, _r as FailedToFetchCommunityFromGatewaysError, an as CommunityIpfsSchema, ar as e$5, b as areEquivalentCommunityAddresses, bn as CommentIpfsReservedFields, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateRemoteCommunityFunctionArgumentSchema, cr as t$12, dr as t$10, f as DecryptedChallengeSchema, fn as RpcRemoteCommunityUpdateEventResultSchema, fr as t$9, g as PKCParsedOptionsSchema, gr as FailedToFetchCommentUpdateFromGatewaysError, gt as sleepUntilTimeoutOrAbort, h as NameResolverSerializedSchema, hn as VotePubsubMessagePublicationSchema, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, i as ChallengeMessageSignedPropertyNames, in as CommunityIpfsReservedFields, ir as e$6, j as fetchAndValidateIpnsRecordFromGateway, jr as number, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kr as custom, l as DecryptedChallengeAnswerSchema, ln as CreateRpcCommunityFunctionArgumentSchema, lr as n$8, m as NameResolveCacheOptionsSchema, mn as VoteChallengeRequestToEncryptSchema, mr as require_retry$1, mt as shortifyAddress, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityEditOptionsSchema, o as ChallengeRequestMessageSignedPropertyNames, on as CommunitySignedPropertyNames, or as t$11, ot as removeNullUndefinedEmptyObjectsValuesRecursively, p as DecryptedChallengeVerificationSchema, pn as CreateVoteUserOptionsWithRefinementSchema, pr as e$4, qn as ChallengeAnswersSchema, qt as CommentModerationPubsubMessagePublicationSchema, rn as CommunityExportRecordsSchema, rr as t$13, sn as CreateNewLocalCommunityUserOptionsSchema, sr as r$8, tn as CommunityChallengeSettingSchema, tr as n$9, tt as raceAgainstAbort, un as ExportCommunityModLogsOptionsSchema, ur as r$7, ut as resolveWhenPredicateIsTrue, v as PKCUserOptionsSchema, vr as FailedToFetchGenericIpfsFromGatewaysError, vt as throwIfAbortSignalAborted, wn as CommentSignedPropertyNames, wr as require_ms$1, wt as findUpdatingComment, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, yn as CommentChallengeRequestToEncryptSchema, yr as FailedToFetchPageIpfsFromGatewaysError, yt as timestamp, z as isAbortError, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-AXrL86Q4.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$10, $t as ChallengeFileSchema, A as extractNetworkErrorDetails, An as CommentUpdateSignedPropertyNames, Ar as literal, At as refreshTrackedCommunityAliases, B as isIpfsCid, Bt as pTimeout, Cn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Cr as require_supports_color, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateForChallengeVerificationSignedPropertyNames, Dr as array, E as createAbortError, Er as _enum, Et as listStartedCommunities, Fn as ModQueuePageIpfsSchema, Ft as untrackStartedCommunity, Gn as AuthorCommentIpfsReservedFields, Gt as CreateCommunityEditPublicationOptionsWithRefinementSchema, H as isIpns, I as getPostUpdateTimestampRange, In as PageIpfsSchema, It as untrackUpdatingComment, Jn as CidPathSchema, Kt as CommentModerationChallengeRequestToEncryptSchema, L as hideClassPrivateProps, Ln as CommentEditChallengeRequestToEncryptSchema, Lt as untrackUpdatingCommunity, Mr as object, Mt as trackStartedCommunity, Nn as CreateCommentOptionsWithRefinementSchema, Nr as record, O as derivePublicationFromChallengeRequest, On as CommentUpdateReservedFields, Or as boolean, Ot as listUpdatingCommunities, Pn as GetPageParamSchema, Pr as string, Pt as trackUpdatingCommunity, Q as isStringDomain, Qn as CreateSignerSchema, Qt as ChallengeFileFactorySchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as require_sha256$1, Sr as logger_default, Tn as CommentUpdateChallengeReservedFieldNames, Tt as findUpdatingCommunity, U as isIpnsPath, Un as CreateCommentEditOptionsWithRefinementSchema, Ut as CommunityEditPublicationSignedPropertyNames, V as isIpfsPath, Vn as CommentEditSignedPropertyNames, Vt as CommunityEditPublicationChallengeRequestToEncryptSchema, Wn as AuthorAddressSchema, Wt as CommunityEditPubsubMessagePublicationSchema, X as isRequestPubsubPublicationOfPost, Xn as CommunityAddressSchema, Xt as CommentModerationsTableRowSchema, Yn as CidStringSchema, Yt as CommentModerationSignedPropertyNames, Z as isRequestPubsubPublicationOfReply, Zn as CommunityAuthorChallengeReservedFieldNames, Zt as CreateCommentModerationOptionsWithRefinementSchema, _ as PKCUserOptionBaseSchema, _n as VoteSignedPropertyNames, _r as FailedToFetchCommunityFromGatewaysError, an as CommunityIpfsSchema, ar as e$5, b as areEquivalentCommunityAddresses, bn as CommentIpfsReservedFields, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateRemoteCommunityFunctionArgumentSchema, cr as t$12, dr as t$10, f as DecryptedChallengeSchema, fn as RpcRemoteCommunityUpdateEventResultSchema, fr as t$9, g as PKCParsedOptionsSchema, gr as FailedToFetchCommentUpdateFromGatewaysError, gt as sleepUntilTimeoutOrAbort, h as NameResolverSerializedSchema, hn as VotePubsubMessagePublicationSchema, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, i as ChallengeMessageSignedPropertyNames, in as CommunityIpfsReservedFields, ir as e$6, j as fetchAndValidateIpnsRecordFromGateway, jr as number, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kr as custom, l as DecryptedChallengeAnswerSchema, ln as CreateRpcCommunityFunctionArgumentSchema, lr as n$8, m as NameResolveCacheOptionsSchema, mn as VoteChallengeRequestToEncryptSchema, mr as require_retry$1, mt as shortifyAddress, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityEditOptionsSchema, o as ChallengeRequestMessageSignedPropertyNames, on as CommunitySignedPropertyNames, or as t$11, ot as removeNullUndefinedEmptyObjectsValuesRecursively, p as DecryptedChallengeVerificationSchema, pn as CreateVoteUserOptionsWithRefinementSchema, pr as e$4, qn as ChallengeAnswersSchema, qt as CommentModerationPubsubMessagePublicationSchema, rn as CommunityExportRecordsSchema, rr as t$13, sn as CreateNewLocalCommunityUserOptionsSchema, sr as r$8, tn as CommunityChallengeSettingSchema, tr as n$9, tt as raceAgainstAbort, un as ExportCommunityModLogsOptionsSchema, ur as r$7, ut as resolveWhenPredicateIsTrue, v as PKCUserOptionsSchema, vr as FailedToFetchGenericIpfsFromGatewaysError, vt as throwIfAbortSignalAborted, wn as CommentSignedPropertyNames, wr as require_ms$1, wt as findUpdatingComment, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, yn as CommentChallengeRequestToEncryptSchema, yr as FailedToFetchPageIpfsFromGatewaysError, yt as timestamp, z as isAbortError, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-BT0023M6.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";
@@ -91779,7 +91779,10 @@ const CreatePKCWsServerOptionsSchema = object({
91779
91779
  const SetNewSettingsPKCWsServerSchema = object({ pkcOptions: PKCUserOptionBaseSchema.extend({ nameResolvers: NameResolverSerializedSchema.array().optional() }).loose() });
91780
91780
  const PKCWsServerSettingsSerializedSchema = object({
91781
91781
  pkcOptions: PKCParsedOptionsSchema.loose(),
91782
- challenges: record(string(), ChallengeFileSchema.omit({ getChallenge: true }))
91782
+ challenges: record(string(), ChallengeFileSchema.omit({
91783
+ getChallenge: true,
91784
+ validateChallengeSettings: true
91785
+ }))
91783
91786
  });
91784
91787
  //#endregion
91785
91788
  //#region dist/node/schema/schema-util.js
@@ -125711,6 +125714,7 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
125711
125714
  this.raw = {};
125712
125715
  this._updatingCommunityInstanceWithListeners = void 0;
125713
125716
  this._numOfListenersForUpdatingInstance = 0;
125717
+ this._pendingWarmStartKeyMigration = void 0;
125714
125718
  this._pkc = pkc;
125715
125719
  this._setState("stopped");
125716
125720
  this._updatingState = "stopped";
@@ -126066,14 +126070,24 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
126066
126070
  return true;
126067
126071
  }
126068
126072
  _setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible() {
126069
- const log = logger_default("pkc-js:comment:_setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible");
126073
+ const log = logger_default("pkc-js:remote-community:_setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible");
126070
126074
  const updatingCommunity = findUpdatingCommunity(this._pkc, {
126071
126075
  publicKey: this.publicKey,
126072
126076
  name: this.name
126073
126077
  });
126074
126078
  if (updatingCommunity?.raw?.communityIpfs && (this.updatedAt || 0) < updatingCommunity.raw.communityIpfs.updatedAt) {
126079
+ if (this.publicKey && updatingCommunity.publicKey && this.publicKey !== updatingCommunity.publicKey) {
126080
+ this._pendingWarmStartKeyMigration = {
126081
+ previousPublicKey: this.publicKey,
126082
+ newPublicKey: updatingCommunity.publicKey
126083
+ };
126084
+ log.trace(`New Remote Community instance`, this.address, `skipped warm start from pkc._updatingCommunities[${this.address}]: tracked instance is keyed to`, updatingCommunity.publicKey, `while the caller requested`, this.publicKey, `- deferring key-migration announcement to update()`);
126085
+ return;
126086
+ }
126087
+ const nameResolvedBeforeAdoption = this.nameResolved;
126075
126088
  this.initCommunityIpfsPropsNoMerge(updatingCommunity.raw.communityIpfs);
126076
126089
  this.updateCid = updatingCommunity.updateCid;
126090
+ this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeAdoption);
126077
126091
  log.trace(`New Remote Community instance`, this.address, `will use CommunityIpfs from pkc._updatingCommunities[${this.address}] with updatedAt`, this.updatedAt, "that's", timestamp() - this.updatedAt, "seconds old");
126078
126092
  this.emit("update", this);
126079
126093
  }
@@ -126083,14 +126097,8 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
126083
126097
  if (typeof source.nameResolved === "boolean") this.nameResolved = source.nameResolved;
126084
126098
  } else this.nameResolved = nameResolvedBeforeMirror;
126085
126099
  }
126086
- async _initCommunityInstanceWithListeners() {
126087
- const trackedUpdatingCommunity = findUpdatingCommunity(this._pkc, {
126088
- publicKey: this.publicKey,
126089
- name: this.name
126090
- });
126091
- if (!trackedUpdatingCommunity) throw Error("should be defined at this stage");
126100
+ _initCommunityInstanceWithListeners(communityInstance) {
126092
126101
  const log = logger_default("pkc-js:remote-community:update");
126093
- const communityInstance = trackedUpdatingCommunity;
126094
126102
  return {
126095
126103
  community: communityInstance,
126096
126104
  update: () => {
@@ -126118,28 +126126,25 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
126118
126126
  }
126119
126127
  async fetchLatestCommunityOrSubscribeToEvent() {
126120
126128
  const log = logger_default("pkc-js:remote-community:update:updateOnce");
126121
- if (!findUpdatingCommunity(this._pkc, {
126129
+ let communityInstance = findUpdatingCommunity(this._pkc, {
126122
126130
  publicKey: this.publicKey,
126123
126131
  name: this.name
126124
- })) {
126132
+ });
126133
+ if (!communityInstance) {
126125
126134
  const createOpts = this.publicKey && isStringDomain(this.address) ? {
126126
126135
  name: this.address,
126127
126136
  publicKey: this.publicKey
126128
126137
  } : { address: this.address };
126129
126138
  const updatingCommunity = await this._pkc.createCommunity(createOpts);
126130
- trackUpdatingCommunity(this._pkc, updatingCommunity);
126139
+ communityInstance = trackUpdatingCommunity(this._pkc, updatingCommunity);
126131
126140
  log("Creating a new entry for this._pkc._updatingCommunities", this.address);
126132
126141
  }
126133
- const communityInstance = findUpdatingCommunity(this._pkc, {
126134
- publicKey: this.publicKey,
126135
- name: this.name
126136
- });
126137
- if (!communityInstance) throw Error("should be defined at this stage");
126138
126142
  if (communityInstance === this) {
126139
126143
  this._clientsManager.startUpdatingLoop().catch((err) => log.error("Failed to start update loop of community", err));
126140
- return;
126144
+ return false;
126141
126145
  }
126142
- this._updatingCommunityInstanceWithListeners = await this._initCommunityInstanceWithListeners();
126146
+ if (!this._pkc._updatingCommunities.has(communityInstance)) throw Error(`Updating community instance (${communityInstance.address}) was untracked before listeners could be attached`);
126147
+ this._updatingCommunityInstanceWithListeners = this._initCommunityInstanceWithListeners(communityInstance);
126143
126148
  this._updatingCommunityInstanceWithListeners.community.on("update", this._updatingCommunityInstanceWithListeners.update);
126144
126149
  this._updatingCommunityInstanceWithListeners.community.on("updatingstatechange", this._updatingCommunityInstanceWithListeners.updatingstatechange);
126145
126150
  this._updatingCommunityInstanceWithListeners.community.on("error", this._updatingCommunityInstanceWithListeners.error);
@@ -126151,13 +126156,34 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
126151
126156
  this._updatingCommunityInstanceWithListeners.community._setState("updating");
126152
126157
  this._updatingCommunityInstanceWithListeners.community._clientsManager.startUpdatingLoop().catch((err) => log.error("Failed to start update loop of community", err));
126153
126158
  }
126159
+ if (communityInstance.raw.communityIpfs && (this.updatedAt ?? 0) < communityInstance.raw.communityIpfs.updatedAt && this._updatingCommunityInstanceWithListeners) {
126160
+ this._updatingCommunityInstanceWithListeners.update(communityInstance);
126161
+ return true;
126162
+ }
126163
+ return false;
126164
+ }
126165
+ _announcePendingWarmStartKeyMigrationIfAny() {
126166
+ if (!this._pendingWarmStartKeyMigration) return;
126167
+ const { previousPublicKey, newPublicKey } = this._pendingWarmStartKeyMigration;
126168
+ this._pendingWarmStartKeyMigration = void 0;
126169
+ const error = new PKCError("ERR_COMMUNITY_NAME_RESOLVES_TO_DIFFERENT_PUBLIC_KEY", {
126170
+ communityName: this.name,
126171
+ previousPublicKey,
126172
+ newPublicKey
126173
+ });
126174
+ this._clearDataForKeyMigration(newPublicKey);
126175
+ if (this.name) this.nameResolved = true;
126176
+ this.emit("update", this);
126177
+ this.emit("error", error);
126154
126178
  }
126155
126179
  async update() {
126156
126180
  if (this.state !== "stopped") return;
126157
126181
  logger_default("pkc-js:remote-community:update");
126158
126182
  this._setState("updating");
126159
- await this.fetchLatestCommunityOrSubscribeToEvent();
126160
- if (this.raw.communityIpfs) this.emit("update", this);
126183
+ this._announcePendingWarmStartKeyMigrationIfAny();
126184
+ const hadRecordBeforeFetch = Boolean(this.raw.communityIpfs);
126185
+ const replayEmittedUpdate = await this.fetchLatestCommunityOrSubscribeToEvent();
126186
+ if (this.raw.communityIpfs && hadRecordBeforeFetch && !replayEmittedUpdate) this.emit("update", this);
126161
126187
  }
126162
126188
  async _cleanUpUpdatingCommunityInstanceWithListeners() {
126163
126189
  if (!this._updatingCommunityInstanceWithListeners) throw Error("should be defined at this stage");
@@ -128116,6 +128142,25 @@ function ChallengeFileFactory$4({ challengeSettings }) {
128116
128142
  };
128117
128143
  }
128118
128144
  //#endregion
128145
+ //#region dist/node/runtime/node/community/challenges/pkc-js-challenges/address-list-validation.js
128146
+ const splitCommaSeparated = (value) => value.split(",").map((entry) => entry.trim());
128147
+ function validateAddressListOptions({ challengeSettings }) {
128148
+ const { addresses, urls } = challengeSettings.options ?? {};
128149
+ if (addresses) {
128150
+ for (const [index, address] of splitCommaSeparated(addresses).entries()) if (!address) throw new Error(`addresses entry ${index} is empty, check for a stray or trailing comma`);
128151
+ }
128152
+ if (urls) for (const [index, url] of splitCommaSeparated(urls).entries()) {
128153
+ if (!url) throw new Error(`urls entry ${index} is empty, check for a stray or trailing comma`);
128154
+ let parsed;
128155
+ try {
128156
+ parsed = new URL(url);
128157
+ } catch {
128158
+ throw new Error(`urls entry ${index} ('${url}') is not a valid URL`);
128159
+ }
128160
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new Error(`urls entry ${index} ('${url}') must use http: or https:, it is fetched over HTTP`);
128161
+ }
128162
+ }
128163
+ //#endregion
128119
128164
  //#region dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js
128120
128165
  const optionInputs$3 = [
128121
128166
  {
@@ -128198,7 +128243,8 @@ function ChallengeFileFactory$3({ challengeSettings }) {
128198
128243
  getChallenge: getChallenge$3,
128199
128244
  optionInputs: optionInputs$3,
128200
128245
  type: type$3,
128201
- description: description$2
128246
+ description: description$2,
128247
+ validateChallengeSettings: validateAddressListOptions
128202
128248
  };
128203
128249
  }
128204
128250
  //#endregion
@@ -128284,7 +128330,8 @@ function ChallengeFileFactory$2({ challengeSettings }) {
128284
128330
  getChallenge: getChallenge$2,
128285
128331
  optionInputs: optionInputs$2,
128286
128332
  type: type$2,
128287
- description: description$1
128333
+ description: description$1,
128334
+ validateChallengeSettings: validateAddressListOptions
128288
128335
  };
128289
128336
  }
128290
128337
  //#endregion
@@ -128327,13 +128374,17 @@ const getChallenge$1 = async ({ challengeSettings, challengeRequestMessage, chal
128327
128374
  };
128328
128375
  return { success: true };
128329
128376
  };
128377
+ const validateChallengeSettings$1 = ({ challengeSettings }) => {
128378
+ if (challengeSettings.publicOptions?.includes("answer")) throw new Error("answer cannot be listed in publicOptions: publishing the answer means anyone can pass the challenge");
128379
+ };
128330
128380
  function ChallengeFileFactory$1({ challengeSettings }) {
128331
128381
  return {
128332
128382
  getChallenge: getChallenge$1,
128333
128383
  optionInputs: optionInputs$1,
128334
128384
  type: type$1,
128335
128385
  challenge: challengeSettings?.options?.question,
128336
- description
128386
+ description,
128387
+ validateChallengeSettings: validateChallengeSettings$1
128337
128388
  };
128338
128389
  }
128339
128390
  //#endregion
@@ -128434,12 +128485,35 @@ const getChallenge = async ({ challengeSettings, challengeRequestMessage }) => {
128434
128485
  error
128435
128486
  };
128436
128487
  };
128488
+ const validateChallengeSettings = ({ challengeSettings }) => {
128489
+ const matchesStr = challengeSettings.options?.matches;
128490
+ if (!matchesStr) return;
128491
+ let parsed;
128492
+ try {
128493
+ parsed = JSON.parse(matchesStr);
128494
+ } catch (e) {
128495
+ throw new Error(`matches is not valid JSON: ${e.message}`);
128496
+ }
128497
+ if (!Array.isArray(parsed)) throw new Error("matches must be a JSON array of {propertyName, regexp} objects");
128498
+ for (const [index, match] of parsed.entries()) {
128499
+ if (typeof match !== "object" || match === null || Array.isArray(match)) throw new Error(`matches[${index}] must be an object with propertyName and regexp`);
128500
+ const { propertyName, regexp } = match;
128501
+ if (typeof propertyName !== "string" || !propertyName) throw new Error(`matches[${index}].propertyName must be a non-empty string`);
128502
+ if (typeof regexp !== "string" || !regexp) throw new Error(`matches[${index}].regexp must be a non-empty string`);
128503
+ try {
128504
+ new RegExp(regexp);
128505
+ } catch (e) {
128506
+ throw new Error(`matches[${index}].regexp ('${regexp}') is not a valid regular expression: ${e.message}`);
128507
+ }
128508
+ }
128509
+ };
128437
128510
  function ChallengeFileFactory({ challengeSettings }) {
128438
128511
  return {
128439
128512
  getChallenge,
128440
128513
  optionInputs,
128441
128514
  type,
128442
- description: challengeSettings?.options?.description || defaultDescription
128515
+ description: challengeSettings?.options?.description || defaultDescription,
128516
+ validateChallengeSettings
128443
128517
  };
128444
128518
  }
128445
128519
  //#endregion
@@ -128974,8 +129048,14 @@ const getChallengeVerification = async ({ challengeRequestMessage, community, ge
128974
129048
  };
128975
129049
  return challengeVerification;
128976
129050
  };
128977
- const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityChallengeSettings, pkc }) => {
128978
- communityChallengeSettings = CommunityChallengeSettingSchema.parse(communityChallengeSettings);
129051
+ const derivePublicOptions = (communityChallengeSettings) => {
129052
+ const { publicOptions, options } = communityChallengeSettings;
129053
+ if (!publicOptions?.length || !options) return void 0;
129054
+ const published = {};
129055
+ for (const optionName of publicOptions) if (typeof options[optionName] === "string") published[optionName] = options[optionName];
129056
+ return e$5(published) ? void 0 : published;
129057
+ };
129058
+ const loadChallengeFileFromCommunityChallengeSettings = async ({ communityChallengeSettings, pkc }) => {
128979
129059
  let challengeFile = void 0;
128980
129060
  if (communityChallengeSettings.path) try {
128981
129061
  const importedFile = await import(pathToFileURL(communityChallengeSettings.path).href);
@@ -128998,6 +129078,14 @@ const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityCh
128998
129078
  challengeFile = ChallengeFileSchema.parse(ChallengeFileFactory({ challengeSettings: communityChallengeSettings }));
128999
129079
  }
129000
129080
  if (!challengeFile) throw Error("Failed to load challenge file");
129081
+ return challengeFile;
129082
+ };
129083
+ const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityChallengeSettings, pkc }) => {
129084
+ communityChallengeSettings = CommunityChallengeSettingSchema.parse(communityChallengeSettings);
129085
+ const challengeFile = await loadChallengeFileFromCommunityChallengeSettings({
129086
+ communityChallengeSettings,
129087
+ pkc
129088
+ });
129001
129089
  const { challenge, type } = challengeFile;
129002
129090
  return { communityChallenge: {
129003
129091
  exclude: communityChallengeSettings.exclude,
@@ -129005,7 +129093,8 @@ const getCommunityChallengeFromCommunityChallengeSettings = async ({ communityCh
129005
129093
  challenge,
129006
129094
  type,
129007
129095
  caseInsensitive: challengeFile.caseInsensitive,
129008
- pendingApproval: communityChallengeSettings.pendingApproval
129096
+ pendingApproval: communityChallengeSettings.pendingApproval,
129097
+ publicOptions: derivePublicOptions(communityChallengeSettings)
129009
129098
  } };
129010
129099
  };
129011
129100
  //#endregion
@@ -129599,4 +129688,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
129599
129688
  }
129600
129689
  };
129601
129690
  //#endregion
129602
- export { applyNameResolvedCacheToCrosspost as $, crosspostChainDepthUpTo as $n, createSchemaRowParser as $t, deriveDbReplies as A, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as An, verifyCommentModeration as At, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as B, RpcExportCommunityModLogsParamSchema as Bn, normalizeCreatePublicationAuthor as Bt, backupCommunityDb as C, parseDecryptedChallengeVerification as Cn, signVote as Ct, deleteOldCommunityInWindows as D, parseRpcCommentEventWithPKCErrorIfItFails as Dn, verifyChallengeVerification as Dt, createKuboRpcClient as E, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as En, verifyChallengeRequest as Et, listCommunitiesSync as F, RpcCidParamSchema as Fn, verifyVote as Ft, TIMEFRAMES_TO_SECONDS as G, RpcFetchCidResultSchema as Gn, normalizeCommunityInputFromCommunity as Gt, POSTS_SORT_TYPES as H, RpcExportCommunityParamSchema as Hn, getCommunityAddressFromRecord as Ht, monitorCommunitiesDirectory as I, RpcCommentRepliesPageParamSchema as In, buildRuntimeAuthor as It, extractCommunityRuntimeFieldsFromParsedPages as J, RpcPublishedAnchorRecordResultSchema as Jn, getBufferedPKCAddressFromPublicKey as Jt, buildPageRuntimeFields as K, RpcPublishAnchorRecordParamSchema as Kn, decode as Kt, moveCommunityDbToDeletedDirectory as L, RpcCommunityIdentifierParamSchema as Ln, cleanWireAuthor as Lt, getDefaultDataPath as M, RpcAnchorPublishPreparationResultSchema as Mn, verifyCommentUpdate as Mt, getThumbnailPropsOfLink as N, RpcAuthorNameParamSchema as Nn, verifyCommunity as Nt, deriveCommentIpfsFromCommentTableRow as O, parseRpcCommentUpdateEventWithPKCErrorIfItFails as On, verifyCommentEdit as Ot, importSignerIntoKuboNode as P, RpcCancelExportParamSchema as Pn, verifyCommunityEdit as Pt, RepliesPages as Q, RpcUnsubscribeParamSchema as Qn, getPublicKeyFromPrivateKey as Qt, resolveDbPostsCidRefs as R, RpcCommunityPageParamSchema as Rn, getAuthorNameFromRuntime as Rt, BackupAbortError as S, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Sn, signCommunityEdit as St, calculateInlineRepliesBudget as T, parseJsonWithPKCErrorIfFails as Tn, verifyChallengeMessage as Tt, POST_REPLIES_SORT_TYPES as U, RpcExportCommunityResultSchema as Un, getCommunityNameFromWire$1 as Ut, CommentClientsManager as V, RpcExportCommunityModLogsResultSchema as Vn, buildRuntimeCommunityFields as Vt, REPLY_REPLIES_SORT_TYPES as W, RpcFetchCidParamSchema as Wn, getCommunityPublicKeyFromWire as Wt, iterateOverPageCidsToFindAllCids as X, RpcSubscriptionIdResultSchema as Xn, getPKCAddressFromPublicKey as Xt, findCommentInPageInstanceRecursively as Y, RpcResolveAuthorNameResultSchema as Yn, getIpfsKeyFromPrivateKey as Yt, parseRawPages as Z, RpcSuccessResultSchema as Zn, getPKCAddressFromPublicKeySync as Zt, createAnchorIpnsRecord as _, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as _n, signCommentEdit as _t, pkcJsChallenges as a, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as an, n$5 as ar, PKCClientsManager as at, encryptEd25519AesGcm as b, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as bn, signCommentUpdateForChallengeVerification as bt, RemoteCommunity as c, parseCommunityAddressWithPKCErrorIfItFails as cn, t$8 as cr, pLimit as ct, decodeRpcChallengeAnswerPubsubMsg as d, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as dn, require_lodash_merge as dr, cleanUpBeforePublishing as dt, parseCidStringSchemaWithPKCErrorIfItFails as en, effectiveMaxCrosspostDepth as er, cloneCrosspostForRuntime as et, decodeRpcChallengePubsubMsg as f, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as fn, nativeFunctions$1 as fr, signChallengeAnswer as ft, createSigner as g, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as gn, signComment as gt, SignerWithPublicKeyAddress as h, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as hn, signChallengeVerification as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommentIpfsSchemaWithPKCErrorIfItFails as in, t$5 as ir, PublicationClientsManager as it, getDefaultCommunityDbConfig as j, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as jn, verifyCommentPubsubMessage as jt, deriveDbPosts as k, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as kn, verifyCommentIpfs as kt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as l, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ln, stringify as lr, PKCTypedEmitter as lt, decodeRpcChallengeVerificationPubsubMsg as m, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as mn, signChallengeRequest as mt, RpcRemoteCommunity as n, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nn, t$4 as nr, extractCrosspostRuntimeFields as nt, TrackedInstanceRegistry as o, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as on, n$6 as or, InflightFetchManager as ot, decodeRpcChallengeRequestPubsubMsg as p, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as pn, require_undici as pr, signChallengeMessage as pt, buildPagesRuntimeFields as q, RpcPublishChallengeAnswersParamSchema as qn, encode as qt, getChallengeVerification as r, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as rn, r as rr, stripNameResolvedFromCrosspost as rt, LRUCache as s, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as sn, t$7 as sr, pRetry as st, RpcLocalCommunity as t, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tn, t$2 as tr, collectCrosspostAuthorsToResolve as tt, KeyvBetterSqlite3 as u, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as un, STORAGE_KEYS as ur, require_lib$1 as ut, decryptEd25519AesGcm as v, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as vn, signCommentModeration as vt, calculateExpectedSignatureSize as w, parseDecryptedChallengeWithPKCErrorIfItFails as wn, verifyChallengeAnswer as wt, encryptEd25519AesGcmPublicKeyBuffer as x, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as xn, signCommunity as xt, decryptEd25519AesGcmPublicKeyBuffer as y, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as yn, signCommentUpdate as yt, setNativeFunctions as z, RpcEditCommunityParamSchema as zn, getAuthorNameFromWire as zt };
129691
+ 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 };
@@ -1429,6 +1429,20 @@ const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
1429
1429
  return payload;
1430
1430
  };
1431
1431
  });
1432
+ const $ZodVoid = /*@__PURE__*/ $constructor("$ZodVoid", (inst, def) => {
1433
+ $ZodType.init(inst, def);
1434
+ inst._zod.parse = (payload, _ctx) => {
1435
+ const input = payload.value;
1436
+ if (typeof input === "undefined") return payload;
1437
+ payload.issues.push({
1438
+ expected: "void",
1439
+ code: "invalid_type",
1440
+ input,
1441
+ inst
1442
+ });
1443
+ return payload;
1444
+ };
1445
+ });
1432
1446
  function handleArrayResult(result, final, index) {
1433
1447
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1434
1448
  final.value[index] = result.value;
@@ -2681,6 +2695,13 @@ function _never(Class, params) {
2681
2695
  });
2682
2696
  }
2683
2697
  // @__NO_SIDE_EFFECTS__
2698
+ function _void$1(Class, params) {
2699
+ return new Class({
2700
+ type: "void",
2701
+ ...normalizeParams(params)
2702
+ });
2703
+ }
2704
+ // @__NO_SIDE_EFFECTS__
2684
2705
  function _lt(value, params) {
2685
2706
  return new $ZodCheckLessThan({
2686
2707
  check: "less_than",
@@ -3229,6 +3250,9 @@ const booleanProcessor = (_schema, _ctx, json, _params) => {
3229
3250
  const undefinedProcessor = (_schema, ctx, _json, _params) => {
3230
3251
  if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
3231
3252
  };
3253
+ const voidProcessor = (_schema, ctx, _json, _params) => {
3254
+ if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
3255
+ };
3232
3256
  const neverProcessor = (_schema, _ctx, json, _params) => {
3233
3257
  json.not = {};
3234
3258
  };
@@ -3845,6 +3869,14 @@ const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
3845
3869
  function never(params) {
3846
3870
  return /* @__PURE__ */ _never(ZodNever, params);
3847
3871
  }
3872
+ const ZodVoid = /*@__PURE__*/ $constructor("ZodVoid", (inst, def) => {
3873
+ $ZodVoid.init(inst, def);
3874
+ ZodType.init(inst, def);
3875
+ inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
3876
+ });
3877
+ function _void(params) {
3878
+ return /* @__PURE__ */ _void$1(ZodVoid, params);
3879
+ }
3848
3880
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
3849
3881
  $ZodArray.init(inst, def);
3850
3882
  ZodType.init(inst, def);
@@ -5520,6 +5552,11 @@ var messages;
5520
5552
  messages["ERR_CHALLENGE_RESULT_OVERRIDES_RESERVED_COMMENT_UPDATE_FIELD"] = "A challenge result attempted to set commentUpdate.<field> that is in CommentUpdateChallengeReservedFieldNames (community-computed field)";
5521
5553
  messages["ERR_CHALLENGE_RESULT_OVERRIDES_NON_COMMUNITY_AUTHOR_KEY"] = "A challenge result attempted to set commentUpdate.author.<field> with a key other than 'community' — challenges may only extend commentUpdate.author.community";
5522
5554
  messages["ERR_CHALLENGE_RESULT_OVERRIDES_RESERVED_COMMUNITY_AUTHOR_FIELD"] = "A challenge result attempted to set commentUpdate.author.community.<field> that is in CommunityAuthorChallengeReservedFieldNames (community-computed or mod-settable field)";
5555
+ messages["ERR_CHALLENGE_OPTION_NOT_DECLARED_IN_OPTION_INPUTS"] = "settings.challenges[i].options has a key that no optionInputs entry of the challenge declares, so it is never read";
5556
+ messages["ERR_CHALLENGE_REQUIRED_OPTION_MISSING"] = "settings.challenges[i].options is missing an option whose optionInputs entry is required";
5557
+ 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";
5558
+ messages["ERR_CHALLENGE_SETTINGS_VALIDATION_FAILED"] = "The challenge's validateChallengeSettings hook rejected settings.challenges[i]";
5559
+ messages["ERR_CHALLENGE_SETTINGS_VALIDATION_FAILED_FOR_CHALLENGES"] = "One or more challenges in settings.challenges failed validation";
5523
5560
  })(messages || (messages = {}));
5524
5561
  //#endregion
5525
5562
  //#region dist/node/pkc-error.js
@@ -6649,6 +6686,7 @@ const CommunityChallengeSettingSchema = object({
6649
6686
  path: string().optional(),
6650
6687
  name: string().optional(),
6651
6688
  options: record(string(), string()).optional(),
6689
+ publicOptions: string().array().optional(),
6652
6690
  exclude: ChallengeExcludeSchema.array().nonempty().optional(),
6653
6691
  description: string().optional(),
6654
6692
  pendingApproval: boolean().optional()
@@ -6659,7 +6697,7 @@ const GetChallengeArgsSchema = object({
6659
6697
  challengeIndex: number().int().nonnegative(),
6660
6698
  community: custom()
6661
6699
  });
6662
- const ChallengeFileSchema = object({
6700
+ const ChallengeFileSchema = looseObject({
6663
6701
  optionInputs: ChallengeOptionInputSchema.array().optional(),
6664
6702
  type: ChallengeFromGetChallengeSchema.shape.type,
6665
6703
  challenge: ChallengeFromGetChallengeSchema.shape.challenge.optional(),
@@ -6668,15 +6706,20 @@ const ChallengeFileSchema = object({
6668
6706
  getChallenge: _function({
6669
6707
  input: [GetChallengeArgsSchema],
6670
6708
  output: promise(ResultOfGetChallengeSchema)
6671
- })
6672
- }).strict();
6709
+ }),
6710
+ validateChallengeSettings: _function({
6711
+ input: [object({ challengeSettings: CommunityChallengeSettingSchema })],
6712
+ output: _void()
6713
+ }).optional()
6714
+ });
6673
6715
  const CommunityChallengeSchema = looseObject({
6674
6716
  exclude: ChallengeExcludeSchema.array().nonempty().optional(),
6675
6717
  description: ChallengeFileSchema.shape.description,
6676
6718
  challenge: ChallengeFileSchema.shape.challenge,
6677
6719
  type: ChallengeFileSchema.shape.type,
6678
6720
  caseInsensitive: ChallengeFileSchema.shape.caseInsensitive,
6679
- pendingApproval: boolean().optional()
6721
+ pendingApproval: boolean().optional(),
6722
+ publicOptions: record(string(), string()).optional()
6680
6723
  });
6681
6724
  const ChallengeFileFactorySchema = _function({
6682
6725
  input: [object({ challengeSettings: CommunityChallengeSettingSchema })],
@@ -6822,7 +6865,8 @@ const CommunityIpfsReservedFields = r$2([
6822
6865
  "updatingState",
6823
6866
  "started",
6824
6867
  "exports",
6825
- "abortSignal"
6868
+ "abortSignal",
6869
+ "_pendingWarmStartKeyMigration"
6826
6870
  ], t$3(CommunityIpfsSchema.shape));
6827
6871
  //#endregion
6828
6872
  //#region dist/node/publications/comment-moderation/schema.js
@@ -16151,7 +16195,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
16151
16195
  }
16152
16196
  //#endregion
16153
16197
  //#region dist/node/generated-version.js
16154
- const version = "0.0.84";
16198
+ const version = "0.0.86";
16155
16199
  //#endregion
16156
16200
  //#region dist/node/version.js
16157
16201
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
@@ -1,4 +1,4 @@
1
- import { br as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-AXrL86Q4.js";
1
+ import { br as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-BT0023M6.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { equals } from "uint8arrays/equals";
4
4
  //#region dist/node/helia/util.js
@@ -1,2 +1,2 @@
1
- import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-B7GkmuSc.js";
1
+ import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-BbvETZ1u.js";
2
2
  export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
@@ -1,7 +1,7 @@
1
- import { Ct as findStartedCommunity, L as hideClassPrivateProps, Sr as logger_default, br as PKCError, lt as replaceXWithY, rr as t, tr as n } from "../../chunks/schema-AXrL86Q4.js";
2
- import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-B7GkmuSc.js";
3
- import { An as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, K as buildPageRuntimeFields, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, _n as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, an as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ct as pLimit, kn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, ln as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lr as stringify, nn as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, nr as t$1, nt as extractCrosspostRuntimeFields, q as buildPagesRuntimeFields, st as pRetry, tn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, un as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ut as require_lib, vn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-r51cTBYd.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-5PMI-TDB.js";
1
+ import { Ct as findStartedCommunity, L as hideClassPrivateProps, Sr as logger_default, br as PKCError, lt as replaceXWithY, rr as t, tr as n } from "../../chunks/schema-BT0023M6.js";
2
+ import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-BbvETZ1u.js";
3
+ import { An as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, J as buildPagesRuntimeFields, ct as pRetry, dn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, dt as require_lib, jn as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lt as pLimit, nn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, on as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, q as buildPageRuntimeFields, rn as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, rr as t$1, rt as extractCrosspostRuntimeFields, un as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ur as stringify, vn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, yn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-Cpw9_Nuo.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-NUwjwbZz.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -744,7 +744,7 @@ var PKCWsServer = class extends import_lib.TypedEmitter {
744
744
  challenges: t$1({
745
745
  ...PKCJs.PKC.challenges || {},
746
746
  ...pkc.settings?.challenges || {}
747
- }, (challengeFactory) => n(challengeFactory({ challengeSettings: {} }), ["getChallenge"]))
747
+ }, (challengeFactory) => n(challengeFactory({ challengeSettings: {} }), ["getChallenge", "validateChallengeSettings"]))
748
748
  };
749
749
  }
750
750
  async settingsSubscribe(params, connectionId) {
@@ -105,6 +105,7 @@ export declare const parseRpcEditCommunityParam: (params: unknown) => {
105
105
  path?: string | undefined;
106
106
  name?: string | undefined;
107
107
  options?: Record<string, string> | undefined;
108
+ publicOptions?: string[] | undefined;
108
109
  exclude?: {
109
110
  [x: string]: unknown;
110
111
  community?: {
@@ -377,6 +377,7 @@ export declare const RpcEditCommunityParamSchema: z.ZodObject<{
377
377
  path: z.ZodOptional<z.ZodString>;
378
378
  name: z.ZodOptional<z.ZodString>;
379
379
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
380
+ publicOptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
380
381
  exclude: z.ZodOptional<z.ZodArray<z.ZodObject<{
381
382
  community: z.ZodOptional<z.ZodObject<{
382
383
  addresses: z.ZodArray<z.ZodString>;
@@ -61,6 +61,10 @@ export declare class RemoteCommunity extends TypedEmitter<CommunityEvents> imple
61
61
  protected _ipnsPubsubTopic?: string;
62
62
  protected _ipnsPubsubTopicRoutingCid?: string;
63
63
  protected _stopAbortController?: AbortController;
64
+ protected _pendingWarmStartKeyMigration?: {
65
+ previousPublicKey: string;
66
+ newPublicKey: string;
67
+ };
64
68
  protected _updatingState: CommunityUpdatingState;
65
69
  constructor(pkc: PKC);
66
70
  _createStopAbortController(): AbortController;
@@ -112,6 +116,7 @@ export declare class RemoteCommunity extends TypedEmitter<CommunityEvents> imple
112
116
  }, nameResolvedBeforeMirror: boolean | undefined): void;
113
117
  private _initCommunityInstanceWithListeners;
114
118
  private fetchLatestCommunityOrSubscribeToEvent;
119
+ private _announcePendingWarmStartKeyMigrationIfAny;
115
120
  update(): Promise<void>;
116
121
  private _cleanUpUpdatingCommunityInstanceWithListeners;
117
122
  stop(): Promise<void>;