@pkcprotocol/pkc-js 0.0.128 → 0.0.129

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 (102) hide show
  1. package/README.md +16 -5
  2. package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +2 -2
  3. package/dist/browser/clients/rpc-client/pkc-rpc-client.js +8 -3
  4. package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  5. package/dist/browser/clients/rpc-client/schema.d.ts +10 -1
  6. package/dist/browser/clients/rpc-client/schema.js +8 -1
  7. package/dist/browser/clients/rpc-client/schema.js.map +1 -1
  8. package/dist/browser/clients/rpc-client/types.d.ts +5 -1
  9. package/dist/browser/community/communities-entry-util.d.ts +14 -0
  10. package/dist/browser/community/communities-entry-util.js +20 -0
  11. package/dist/browser/community/communities-entry-util.js.map +1 -0
  12. package/dist/browser/errors.d.ts +1 -0
  13. package/dist/browser/errors.js +1 -0
  14. package/dist/browser/errors.js.map +1 -1
  15. package/dist/browser/generated-version.d.ts +1 -1
  16. package/dist/browser/generated-version.js +1 -1
  17. package/dist/browser/pkc/pkc-with-rpc-client.d.ts +2 -0
  18. package/dist/browser/pkc/pkc-with-rpc-client.js +66 -3
  19. package/dist/browser/pkc/pkc-with-rpc-client.js.map +1 -1
  20. package/dist/browser/pkc/pkc.d.ts +5 -3
  21. package/dist/browser/pkc/pkc.js +15 -10
  22. package/dist/browser/pkc/pkc.js.map +1 -1
  23. package/dist/browser/pkc-error.d.ts +1 -1
  24. package/dist/browser/rpc/src/index.js +10 -8
  25. package/dist/browser/rpc/src/index.js.map +1 -1
  26. package/dist/browser/runtime/browser/util.d.ts +1 -0
  27. package/dist/browser/runtime/browser/util.js +3 -0
  28. package/dist/browser/runtime/browser/util.js.map +1 -1
  29. package/dist/browser/runtime/node/community/db-handler.js +2 -4
  30. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  31. package/dist/browser/runtime/node/community/local-community/editing.js +13 -6
  32. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  33. package/dist/browser/runtime/node/community/local-community.js +9 -1
  34. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  35. package/dist/browser/runtime/node/community/start-lock.d.ts +8 -0
  36. package/dist/browser/runtime/node/community/start-lock.js +18 -0
  37. package/dist/browser/runtime/node/community/start-lock.js.map +1 -0
  38. package/dist/browser/runtime/node/util.d.ts +6 -0
  39. package/dist/browser/runtime/node/util.js +106 -8
  40. package/dist/browser/runtime/node/util.js.map +1 -1
  41. package/dist/browser/test/test-util.d.ts +20 -0
  42. package/dist/browser/test/test-util.js +25 -0
  43. package/dist/browser/test/test-util.js.map +1 -1
  44. package/dist/browser/types.d.ts +7 -3
  45. package/dist/bundled/bundle-manifest.json +65 -63
  46. package/dist/bundled/challenges.js +1 -1
  47. package/dist/bundled/chunks/{helia-for-pkc-6kkeZX1a.js → helia-for-pkc-Cg_zH9dT.js} +31 -31
  48. package/dist/bundled/chunks/{local-community-BST1U_f3.js → local-community-CufTrjaK.js} +1 -1
  49. package/dist/bundled/chunks/{local-community-B79BAYRo.js → local-community-Gj16RMFM.js} +18 -1381
  50. package/dist/bundled/chunks/{node-BEH8NA_I.js → node-jDoQBCgW.js} +76 -16
  51. package/dist/bundled/chunks/{page-sort-scoring-2FkqYYNf.js → page-sort-scoring-B53_j_WT.js} +1 -1
  52. package/dist/bundled/chunks/{rpc-local-community-SmLDPm1j.js → rpc-local-community-9DP4Rskv.js} +1571 -48
  53. package/dist/bundled/chunks/{util-jyIDYw_Q.js → util-CxVo5EMD.js} +1 -1
  54. package/dist/bundled/chunks/{util-LwSS90AE.js → util-D7gst5MT.js} +20 -19
  55. package/dist/bundled/chunks/{validate-package-factories-_KKnb8At.js → validate-package-factories-D2LBnQVu.js} +2 -2
  56. package/dist/bundled/index.js +1 -1
  57. package/dist/bundled/page-sorts.js +1 -1
  58. package/dist/bundled/rpc/src/index.js +10 -9
  59. package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +2 -2
  60. package/dist/node/clients/rpc-client/pkc-rpc-client.js +8 -3
  61. package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  62. package/dist/node/clients/rpc-client/schema.d.ts +10 -1
  63. package/dist/node/clients/rpc-client/schema.js +8 -1
  64. package/dist/node/clients/rpc-client/schema.js.map +1 -1
  65. package/dist/node/clients/rpc-client/types.d.ts +5 -1
  66. package/dist/node/community/communities-entry-util.d.ts +14 -0
  67. package/dist/node/community/communities-entry-util.js +20 -0
  68. package/dist/node/community/communities-entry-util.js.map +1 -0
  69. package/dist/node/errors.d.ts +1 -0
  70. package/dist/node/errors.js +1 -0
  71. package/dist/node/errors.js.map +1 -1
  72. package/dist/node/generated-version.d.ts +1 -1
  73. package/dist/node/generated-version.js +1 -1
  74. package/dist/node/pkc/pkc-with-rpc-client.d.ts +2 -0
  75. package/dist/node/pkc/pkc-with-rpc-client.js +66 -3
  76. package/dist/node/pkc/pkc-with-rpc-client.js.map +1 -1
  77. package/dist/node/pkc/pkc.d.ts +5 -3
  78. package/dist/node/pkc/pkc.js +15 -10
  79. package/dist/node/pkc/pkc.js.map +1 -1
  80. package/dist/node/pkc-error.d.ts +1 -1
  81. package/dist/node/rpc/src/index.js +10 -8
  82. package/dist/node/rpc/src/index.js.map +1 -1
  83. package/dist/node/runtime/browser/util.d.ts +1 -0
  84. package/dist/node/runtime/browser/util.js +3 -0
  85. package/dist/node/runtime/browser/util.js.map +1 -1
  86. package/dist/node/runtime/node/community/db-handler.js +2 -4
  87. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  88. package/dist/node/runtime/node/community/local-community/editing.js +13 -6
  89. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  90. package/dist/node/runtime/node/community/local-community.js +9 -1
  91. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  92. package/dist/node/runtime/node/community/start-lock.d.ts +8 -0
  93. package/dist/node/runtime/node/community/start-lock.js +18 -0
  94. package/dist/node/runtime/node/community/start-lock.js.map +1 -0
  95. package/dist/node/runtime/node/util.d.ts +6 -0
  96. package/dist/node/runtime/node/util.js +106 -8
  97. package/dist/node/runtime/node/util.js.map +1 -1
  98. package/dist/node/test/test-util.d.ts +20 -0
  99. package/dist/node/test/test-util.js +25 -0
  100. package/dist/node/test/test-util.js.map +1 -1
  101. package/dist/node/types.d.ts +7 -3
  102. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as retryKuboIpfsAddAndProvide, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, H as rejectWhenAbortSignalFires, Hr as setErrorMap, It as ChallengeVerificationMessageSchema, J as removeUndefinedValuesRecursively, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nn as CommentIpfsSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Q as retryKuboIpfsAdd, Rn as CommentUpdateForChallengeVerificationSchema, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenCommunityStopsOrAborts, Vn as CommentUpdateSchema, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jr as require_retry, k as isIpns, kt as pTimeout, ni as en_default, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, t as areEquivalentCommunityAddresses, tt as shortifyCid, u as createAbortError, vr as n$1, vt as refreshTrackedCommentAliases, wn as isStringDomain, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, zr as logger_default } from "./util-LwSS90AE.js";
3
- import { $n as getCommunityAddressFromRecord, $t as RpcPublishCommunityListResultSchema, A as findCommentInParsedPages, An as verifyChallengeMessage, Ar as t$5, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityList, Br as NAME_RESOLVED_FALSE_TTL_MS, Bt as RpcCommunityPageParamSchema, C as RepliesPages, Cr as listCommunitiesSync, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityList, Dt as parseJsonWithPKCErrorIfFails, En as signCommunityEdit, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentModeration, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromWire, Gr as nativeFunctions$2, Gt as RpcExportCommunityResultSchema, H as InflightResourceTypes, Hn as buildRuntimeAuthor, Hr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Ht as RpcExportCommunityModLogsParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentPubsubMessage, Ir as t$2, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateNewCommunityListOptionsSchema, Jt as RpcFetchCommunityListParamSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as normalizeCreatePublicationAuthor, Kr as require_undici, Kt as RpcFetchCidParamSchema, Ln as verifyCommentUpdate, Lr as t$4, Lt as RpcCidParamSchema, M as parseRawPages, Mn as verifyChallengeVerification, Nn as verifyCommentEdit, Nr as t$3, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signVote, Or as setNativeFunctions$1, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentIpfs, Pr as n$3, Pt as RpcAnchorPublishPreparationResultSchema, Qn as buildRuntimeCommunityFields, Qt as RpcPublishCommunityListParamSchema, R as stripNameResolvedFromCrosspost, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentModeration, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tt as parseDecryptedChallengeVerification, Un as cleanWireAuthor, Ut as RpcExportCommunityModLogsResultSchema, V as InflightFetchManager, Vn as verifyVote, Vr as NAME_RESOLVED_TRUE_TTL_MS, Vt as RpcEditCommunityParamSchema, Wn as getAuthorNameFromRuntime, Wt as RpcExportCommunityParamSchema, Xt as RpcPublishAnchorRecordParamSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as MAX_COMMUNITY_LIST_SIZE_BYTES, Yt as RpcFetchCommunityListResultSchema, Zt as RpcPublishChallengeAnswersParamSchema, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as findCommunityRecordNameMismatch, ar as getBufferedPKCAddressFromPublicKey, b as KeyvBetterSqlite3, bn as signComment, br as getDefaultDataPath, cn as createSigner, cr as getPKCAddressFromPublicKeySync, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, en as RpcPublishedAnchorRecordResultSchema, er as getCommunityNameFromWire, et as parseCidStringSchemaWithPKCErrorIfItFails, fn as encryptEd25519AesGcm, ft as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, gn as signChallengeAnswer, gt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, hn as cleanUpBeforePublishing, ht as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, in as RpcUnsubscribeParamSchema, it as parseCommentIpfsSchemaWithPKCErrorIfItFails, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, kt as parseRpcCommentEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as createAnchorIpnsRecord$1, lt as parseCommunityAddressWithPKCErrorIfItFails, m as pkcJsChallenges, mr as createKuboRpcClient, mt as parseCommunityListSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcSubscriptionIdResultSchema, nr as normalizeCommunityInputFromCommunity, on as require_lib$1, ot as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, q as decodeRpcChallengePubsubMsg, qn as CreateCommunityListWithCidOptionsSchema, qt as RpcFetchCidResultSchema, rn as RpcSuccessResultSchema, rr as decode, rt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcResolveAuthorNameResultSchema, tr as getCommunityPublicKeyFromWire, un as decryptEd25519AesGcm, v as TrackedInstanceRegistry, vn as signChallengeRequest, vt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, wr as monitorCommunitiesDirectory, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, x as RemoteCommunity, xn as signCommentEdit, xt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, z as PKCClientsManager, zn as verifyCommunityEdit, zr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, zt as RpcCommunityIdentifierParamSchema } from "./rpc-local-community-SmLDPm1j.js";
4
- import { s as getHeliaDebugContext } from "./util-jyIDYw_Q.js";
2
+ import { $ as retryKuboIpfsAddAndProvide, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, H as rejectWhenAbortSignalFires, Hr as setErrorMap, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, J as removeUndefinedValuesRecursively, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Q as retryKuboIpfsAdd, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenCommunityStopsOrAborts, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, hr as isStringDomain, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry, k as isIpns, kt as pTimeout, ni as en_default, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, tt as shortifyCid, u as createAbortError, vr as n$1, vt as refreshTrackedCommentAliases, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, zn as CommentUpdateSchema, zr as logger_default } from "./util-D7gst5MT.js";
3
+ import { $n as buildRuntimeCommunityFields, $r as require_undici, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, Ar as setNativeFunctions$1, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Br as t$3, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dt as parseJsonWithPKCErrorIfFails, Er as monitorCommunitiesDirectory, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as NAME_RESOLVED_TRUE_TTL_MS, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lr as t$5, Lt as RpcCidParamSchema, M as parseRawPages, Mr as findCommunitiesEntry, Nn as verifyChallengeVerification, Nr as toCommunitiesEntry, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pt as RpcAnchorPublishPreparationResultSchema, Qr as nativeFunctions$2, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, Sr as getDefaultDataPath, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tr as listCommunitiesSync, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as t$2, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vr as n$3, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wr as t$4, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Yt as RpcFetchCommunityListParamSchema, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, en as RpcPublishCommunityListResultSchema, er as getCommunityAddressFromRecord, et as parseCidStringSchemaWithPKCErrorIfItFails, ft as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, gn as cleanUpBeforePublishing, gt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, hr as createKuboRpcClient, ht as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, in as RpcSuccessResultSchema, ir as decode, it as parseCommentIpfsSchemaWithPKCErrorIfItFails, jn as verifyChallengeMessage, jr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kn as signVote, kt as parseRpcCommentEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as createSigner, lr as getPKCAddressFromPublicKeySync, lt as parseCommunityAddressWithPKCErrorIfItFails, m as pkcJsChallenges, mt as parseCommunityListSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcResolveAuthorNameResultSchema, nr as getCommunityPublicKeyFromWire, on as findCommunityRecordNameMismatch, or as getBufferedPKCAddressFromPublicKey, ot as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, pn as encryptEd25519AesGcm, q as decodeRpcChallengePubsubMsg, qn as normalizeCreatePublicationAuthor, qr as NAME_RESOLVED_FALSE_TTL_MS, qt as RpcFetchCidParamSchema, rn as RpcSubscriptionIdResultSchema, rr as normalizeCommunityInputFromCommunity, rt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, sn as require_lib$1, st as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcPublishedAnchorRecordResultSchema, tr as getCommunityNameFromWire, un as createAnchorIpnsRecord$1, v as TrackedInstanceRegistry, vt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, x as RemoteCommunity, xn as signComment, xt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signChallengeRequest, z as PKCClientsManager, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-9DP4Rskv.js";
4
+ import { s as getHeliaDebugContext } from "./util-CxVo5EMD.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -3513,8 +3513,8 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
3513
3513
  this._callTimeoutMs = envCallTimeoutMs > 0 ? envCallTimeoutMs : 3e5;
3514
3514
  this.communities = [];
3515
3515
  this._subscriptionEvents = {};
3516
- this.on("communitieschange", (newSubs) => {
3517
- this.communities = newSubs;
3516
+ this.on("communitieschange", ({ communities }) => {
3517
+ this.communities = communities;
3518
3518
  });
3519
3519
  this.on("settingschange", (newSettings) => {
3520
3520
  this.settings = newSettings;
@@ -3959,7 +3959,12 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
3959
3959
  async initalizeCommunitieschangeEvent() {
3960
3960
  const { subscriptionId } = await this._subscribe("communitiesSubscribe", [], "resubscribe");
3961
3961
  this.getSubscription(subscriptionId).on("communitieschange", (res) => {
3962
- this.emit("communitieschange", res.params.result.communities);
3962
+ const parsed = RpcCommunitiesChangeEventResultSchema.loose().safeParse(res.params.result);
3963
+ if (!parsed.success) return this.emit("error", new PKCError("ERR_INVALID_RPC_COMMUNITIES_SCHEMA", {
3964
+ zodError: parsed.error,
3965
+ result: res.params.result
3966
+ }));
3967
+ this.emit("communitieschange", { communities: parsed.data.communities.map((entry) => toCommunitiesEntry(entry)) });
3963
3968
  });
3964
3969
  this.emitAllPendingMessages(subscriptionId);
3965
3970
  }
@@ -8671,8 +8676,8 @@ var PKC$1 = class extends PKCTypedEmitter {
8671
8676
  pageSorts: this.parsedPKCOptions.pageSorts
8672
8677
  };
8673
8678
  this.nameResolvers = this.pkcRpcClientsOptions ? void 0 : this.parsedPKCOptions.nameResolvers;
8674
- this.on("communitieschange", (newCommunities) => {
8675
- this.communities = newCommunities;
8679
+ this.on("communitieschange", ({ communities }) => {
8680
+ this.communities = communities;
8676
8681
  });
8677
8682
  this._promiseToWaitForFirstCommunitieschangeEvent = new Promise((resolve) => this.once("communitieschange", resolve));
8678
8683
  this.clients = {};
@@ -8745,7 +8750,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8745
8750
  this.clients.libp2pJsClients = {};
8746
8751
  if (!this.libp2pJsClientsOptions) return;
8747
8752
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
8748
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-6kkeZX1a.js");
8753
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-Cg_zH9dT.js");
8749
8754
  for (const clientOptions of this.libp2pJsClientsOptions) {
8750
8755
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
8751
8756
  ...clientOptions,
@@ -9090,10 +9095,11 @@ var PKC$1 = class extends PKCTypedEmitter {
9090
9095
  if (!Array.isArray(this.communities)) throw Error("pkc.communities should be defined after communitieschange event");
9091
9096
  }
9092
9097
  async _awaitCommunitiesToIncludeCommunity(communityAddress) {
9093
- if (this.communities.includes(communityAddress)) return;
9098
+ const isListed = () => Boolean(findCommunitiesEntry(this.communities, { address: communityAddress }));
9099
+ if (isListed()) return;
9094
9100
  else await resolveWhenPredicateIsTrue({
9095
9101
  toUpdate: this,
9096
- predicate: () => this.communities.includes(communityAddress),
9102
+ predicate: isListed,
9097
9103
  eventName: "communitieschange"
9098
9104
  });
9099
9105
  }
@@ -9109,7 +9115,7 @@ var PKC$1 = class extends PKCTypedEmitter {
9109
9115
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
9110
9116
  log.trace("Received community options to create a local community instance:", options);
9111
9117
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
9112
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-BST1U_f3.js");
9118
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-CufTrjaK.js");
9113
9119
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
9114
9120
  const community = new LocalCommunity(this);
9115
9121
  if (isLocalCommunity) {
@@ -9129,7 +9135,7 @@ var PKC$1 = class extends PKCTypedEmitter {
9129
9135
  } else throw Error("Are you trying to create a local community with no address or signer? This is a critical error");
9130
9136
  }
9131
9137
  async _createCommunityInstanceFromJsonifiedCommunity(jsonfied) {
9132
- if (this.communities.includes(jsonfied.address)) return this._createLocalCommunity(jsonfied);
9138
+ if (findCommunitiesEntry(this.communities, { address: jsonfied.address })) return this._createLocalCommunity(jsonfied);
9133
9139
  else return this._createRemoteCommunityInstance(jsonfied);
9134
9140
  }
9135
9141
  async createCommunity(options = {}, opts) {
@@ -9176,7 +9182,11 @@ var PKC$1 = class extends PKCTypedEmitter {
9176
9182
  log(`Creating a delegated local community with anchor (${anchor.publicKey}) and minter (${minterSigner.address})`);
9177
9183
  return this._createLocalCommunity(localOptions);
9178
9184
  } else if (hasIdentifier && !hasSigner) {
9179
- const localCommunityAddress = (await listCommunitiesSync(this)).find((localAddr) => areEquivalentCommunityAddresses(localAddr, effectiveAddress));
9185
+ const localCommunityAddress = findLocalCommunityAddress(this, {
9186
+ address: parsedOptions.address,
9187
+ name: parsedOptions.name,
9188
+ publicKey: parsedOptions.publicKey
9189
+ });
9180
9190
  if (localCommunityAddress) return this._createLocalCommunity({ address: localCommunityAddress });
9181
9191
  else {
9182
9192
  const parsedRemoteOptions = parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails(options);
@@ -9530,6 +9540,7 @@ var PKC$1 = class extends PKCTypedEmitter {
9530
9540
  const nativeFunctions$1 = { fetch: (...args) => window.fetch(...args) };
9531
9541
  //#endregion
9532
9542
  //#region dist/node/pkc/pkc-with-rpc-client.js
9543
+ const isInvalidCommunitiesListError = (error) => error instanceof PKCError && error.code === "ERR_INVALID_RPC_COMMUNITIES_SCHEMA";
9533
9544
  var PKCWithRpcClient = class extends PKC$1 {
9534
9545
  constructor(options) {
9535
9546
  super(options);
@@ -9539,6 +9550,7 @@ var PKCWithRpcClient = class extends PKC$1 {
9539
9550
  await super._init();
9540
9551
  const log = logger_default("pkc-js:pkc-with-rpc-client:_init");
9541
9552
  this.communities = [];
9553
+ this._waitForFirstValidCommunitiesList();
9542
9554
  this._pkcRpcClient.on("communitieschange", (newSubs) => this.emit("communitieschange", newSubs));
9543
9555
  for (const rpcUrl of Object.keys(this.clients.pkcRpcClients)) {
9544
9556
  const rpcClient = this.clients.pkcRpcClients[rpcUrl];
@@ -9554,6 +9566,27 @@ var PKCWithRpcClient = class extends PKC$1 {
9554
9566
  this.emit("settingschange", newSettings.pkcOptions);
9555
9567
  });
9556
9568
  }
9569
+ _waitForFirstValidCommunitiesList() {
9570
+ this._promiseToWaitForFirstCommunitieschangeEvent = new Promise((resolve, reject) => {
9571
+ const cleanup = () => {
9572
+ this.removeListener("communitieschange", onCommunitiesChange);
9573
+ this._pkcRpcClient.removeListener("error", onRpcError);
9574
+ };
9575
+ const onCommunitiesChange = (event) => {
9576
+ cleanup();
9577
+ resolve(event);
9578
+ };
9579
+ const onRpcError = (error) => {
9580
+ if (!isInvalidCommunitiesListError(error)) return;
9581
+ cleanup();
9582
+ reject(error);
9583
+ this._waitForFirstValidCommunitiesList();
9584
+ };
9585
+ this.on("communitieschange", onCommunitiesChange);
9586
+ this._pkcRpcClient.on("error", onRpcError);
9587
+ });
9588
+ this._promiseToWaitForFirstCommunitieschangeEvent.catch(() => {});
9589
+ }
9557
9590
  async fetchCid(cid) {
9558
9591
  const parsedCid = parseRpcFetchCidParam(cid).cid;
9559
9592
  return this._pkcRpcClient.fetchCid({ cid: parsedCid });
@@ -9562,6 +9595,28 @@ var PKCWithRpcClient = class extends PKC$1 {
9562
9595
  const parsedArgs = parseRpcAuthorNameParam(args);
9563
9596
  return this._pkcRpcClient.resolveAuthorName(parsedArgs);
9564
9597
  }
9598
+ async _awaitCommunitiesToIncludeCommunity(communityAddress) {
9599
+ const isListed = () => Boolean(findCommunitiesEntry(this.communities, { address: communityAddress }));
9600
+ if (isListed()) return;
9601
+ await new Promise((resolve, reject) => {
9602
+ const cleanup = () => {
9603
+ this.removeListener("communitieschange", onCommunitiesChange);
9604
+ this._pkcRpcClient.removeListener("error", onRpcError);
9605
+ };
9606
+ const onCommunitiesChange = () => {
9607
+ if (!isListed()) return;
9608
+ cleanup();
9609
+ resolve();
9610
+ };
9611
+ const onRpcError = (error) => {
9612
+ if (!isInvalidCommunitiesListError(error)) return;
9613
+ cleanup();
9614
+ reject(error);
9615
+ };
9616
+ this.on("communitieschange", onCommunitiesChange);
9617
+ this._pkcRpcClient.on("error", onRpcError);
9618
+ });
9619
+ }
9565
9620
  async destroy() {
9566
9621
  for (const startedCommunity of listStartedCommunities(this)) await startedCommunity.stopWithoutRpcCall();
9567
9622
  await super.destroy();
@@ -9604,7 +9659,12 @@ var PKCWithRpcClient = class extends PKC$1 {
9604
9659
  const effectiveAddress = parsedRpcOptions.address || parsedRpcOptions.name || parsedRpcOptions.publicKey;
9605
9660
  if (hasIdentifier && effectiveAddress) {
9606
9661
  await this._waitForCommunitiesToBeDefined();
9607
- const isCommunityRpcLocal = this.communities.includes(effectiveAddress);
9662
+ const rpcLocalEntry = findCommunitiesEntry(this.communities, {
9663
+ address: parsedRpcOptions.address,
9664
+ name: parsedRpcOptions.name,
9665
+ publicKey: parsedRpcOptions.publicKey
9666
+ });
9667
+ const isCommunityRpcLocal = Boolean(rpcLocalEntry);
9608
9668
  if ("clients" in options && isCommunityRpcLocal) {
9609
9669
  const community = new RpcLocalCommunity(this);
9610
9670
  const jsonified = parsedRpcOptions;
@@ -9616,7 +9676,7 @@ var PKCWithRpcClient = class extends PKC$1 {
9616
9676
  return community;
9617
9677
  } else if (isCommunityRpcLocal) {
9618
9678
  const community = new RpcLocalCommunity(this);
9619
- community.setAddress(effectiveAddress);
9679
+ community.setAddress(rpcLocalEntry.address);
9620
9680
  const updatePromise = new Promise((resolve) => community.once("update", resolve));
9621
9681
  let error;
9622
9682
  const errorPromise = new Promise((resolve) => community.once("error", (err) => resolve(error = err)));
@@ -1,4 +1,4 @@
1
- import { bn as PageSortFileSchema, v as getEquivalentCommunityAddresses, wn as isStringDomain } from "./util-LwSS90AE.js";
1
+ import { bn as PageSortFileSchema, hr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-D7gst5MT.js";
2
2
  //#region dist/node/pages/page-sort-scoring.js
3
3
  function validatePageSortFile(rawFile) {
4
4
  const validated = PageSortFileSchema.parse(rawFile);