@pkcprotocol/pkc-js 0.0.64 → 0.0.67

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 (53) hide show
  1. package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +1 -0
  2. package/dist/browser/clients/rpc-client/pkc-rpc-client.js +14 -1
  3. package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  4. package/dist/browser/community/community-client-manager.js +11 -0
  5. package/dist/browser/community/community-client-manager.js.map +1 -1
  6. package/dist/browser/errors.d.ts +3 -0
  7. package/dist/browser/errors.js +3 -0
  8. package/dist/browser/errors.js.map +1 -1
  9. package/dist/browser/generated-version.d.ts +1 -1
  10. package/dist/browser/generated-version.js +1 -1
  11. package/dist/browser/helia/helia-for-pkc.js +224 -10
  12. package/dist/browser/helia/helia-for-pkc.js.map +1 -1
  13. package/dist/browser/helia/types.d.ts +2 -0
  14. package/dist/browser/helia/util.d.ts +25 -0
  15. package/dist/browser/helia/util.js +163 -0
  16. package/dist/browser/helia/util.js.map +1 -1
  17. package/dist/browser/pkc-error.d.ts +1 -1
  18. package/dist/browser/rpc/src/index.js +7 -1
  19. package/dist/browser/rpc/src/index.js.map +1 -1
  20. package/dist/browser/signer/signatures.js +26 -0
  21. package/dist/browser/signer/signatures.js.map +1 -1
  22. package/dist/bundled/bundle-manifest.json +31 -31
  23. package/dist/bundled/chunks/{helia-for-pkc-CYDRSysz.js → helia-for-pkc-CTxzGps-.js} +154 -4
  24. package/dist/bundled/chunks/{local-community-DyaGG6lj.js → local-community-DJX_xmB4.js} +1 -1
  25. package/dist/bundled/chunks/{local-community-DYvRQWsK.js → local-community-T3mSbjdf.js} +26 -26
  26. package/dist/bundled/chunks/{node-DadVit9c.js → node-zemQ3e2S.js} +14 -6
  27. package/dist/bundled/chunks/{rpc-local-community-1Uvl5iwp.js → rpc-local-community-ByjBdSQ5.js} +38 -17
  28. package/dist/bundled/chunks/{schema-Dtvt2tQ8.js → schema-B47aYWNu.js} +4 -1
  29. package/dist/bundled/chunks/{util-CjfTxkQ8.js → util-P3adfecj.js} +117 -2
  30. package/dist/bundled/index.js +1 -1
  31. package/dist/bundled/rpc/src/index.js +11 -6
  32. package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +1 -0
  33. package/dist/node/clients/rpc-client/pkc-rpc-client.js +14 -1
  34. package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  35. package/dist/node/community/community-client-manager.js +11 -0
  36. package/dist/node/community/community-client-manager.js.map +1 -1
  37. package/dist/node/errors.d.ts +3 -0
  38. package/dist/node/errors.js +3 -0
  39. package/dist/node/errors.js.map +1 -1
  40. package/dist/node/generated-version.d.ts +1 -1
  41. package/dist/node/generated-version.js +1 -1
  42. package/dist/node/helia/helia-for-pkc.js +224 -10
  43. package/dist/node/helia/helia-for-pkc.js.map +1 -1
  44. package/dist/node/helia/types.d.ts +2 -0
  45. package/dist/node/helia/util.d.ts +25 -0
  46. package/dist/node/helia/util.js +163 -0
  47. package/dist/node/helia/util.js.map +1 -1
  48. package/dist/node/pkc-error.d.ts +1 -1
  49. package/dist/node/rpc/src/index.js +7 -1
  50. package/dist/node/rpc/src/index.js.map +1 -1
  51. package/dist/node/signer/signatures.js +26 -0
  52. package/dist/node/signer/signatures.js.map +1 -1
  53. 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 { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, Fr as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Nr as joinValues, Pr as parsedType, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as n$1, Rt as pTimeout, Sr as setErrorMap, St as findUpdatingComment, Tt as listUpdatingComments, Xn as n$2, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, br as require_supports_color, cn as PubsubTopicSchema, ct as resolveWhenPredicateIsTrue, dr as require_retry, er as t$1, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, ir as r, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as e, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yr as logger_default, z as isAbortError } from "./schema-Dtvt2tQ8.js";
3
- import { $ as RepliesPages, $n as t$5, $t as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCidParamSchema, At as verifyCommunityEdit, B as setNativeFunctions$1, Bn as RpcFetchCidResultSchema, Bt as getCommunityPublicKeyFromWire, Cn as parseRpcCommentEventWithPKCErrorIfItFails, Ct as verifyChallengeVerification, D as createKuboRpcClient, Dn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Dt as verifyCommentPubsubMessage, Et as verifyCommentModeration, Fn as RpcExportCommunityModLogsParamSchema, Gn as RpcUnsubscribeParamSchema, H as CommentClientsManager, Hn as RpcResolveAuthorNameResultSchema, Ht as decode, I as listCommunitiesSync, In as RpcExportCommunityModLogsResultSchema, It as normalizeCreatePublicationAuthor, Kn as t$4, L as monitorCommunitiesDirectory, Ln as RpcExportCommunityParamSchema, Lt as buildRuntimeCommunityFields, Mn as RpcCommunityIdentifierParamSchema, Mt as buildRuntimeAuthor, N as getDefaultDataPath, Nn as RpcCommunityPageParamSchema, Nt as cleanWireAuthor, On as RpcAuthorNameParamSchema, Ot as verifyCommentUpdate, Pn as RpcEditCommunityParamSchema, Pt as getAuthorNameFromRuntime, Q as parseRawPages, Qn as t$2, Rn as RpcExportCommunityResultSchema, Rt as getCommunityAddressFromRecord, Sn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Tt as verifyCommentIpfs, Un as RpcSubscriptionIdResultSchema, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcPublishChallengeAnswersParamSchema, Vt as normalizeCommunityInputFromCommunity, Wn as RpcSuccessResultSchema, Wt as getBufferedPKCAddressFromPublicKey, X as findCommentInPageInstanceRecursively, Xn as n$3, Xt as parseCidStringSchemaWithPKCErrorIfItFails, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as t$3, _n as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, at as PKCTypedEmitter, bn as parseDecryptedChallengeWithPKCErrorIfItFails, c as AddressesRewriterProxyServer, ct as signChallengeAnswer, dn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, en as parseCommentIpfsSchemaWithPKCErrorIfItFails, et as PublicationClientsManager, f as KeyvBetterSqlite3, fn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ft as signComment, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, hn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, in as parseCommunityAddressWithPKCErrorIfItFails, ir as require_undici, jn as RpcCommentRepliesPageParamSchema, jt as verifyVote, kn as RpcCancelExportParamSchema, ln as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, m as decodeRpcChallengePubsubMsg, mt as signCommentModeration, n as RpcRemoteCommunity, nn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, nt as InflightFetchManager, o as TrackedInstanceRegistry, ot as require_lib$1, p as decodeRpcChallengeAnswerPubsubMsg, pt as signCommentEdit, rn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, rr as nativeFunctions$2, s as LRUCache, sn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tt as PKCClientsManager, u as RemoteCommunity, un as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ut as signChallengeRequest, v as createSigner, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, vt as signCommunityEdit, wn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, wt as verifyCommentEdit, x as encryptEd25519AesGcm, xn as parseJsonWithPKCErrorIfFails, xt as verifyChallengeMessage, y as decryptEd25519AesGcm, yn as parseDecryptedChallengeVerification, yt as signVote, zn as RpcFetchCidParamSchema, zt as getCommunityNameFromWire } from "./rpc-local-community-1Uvl5iwp.js";
4
- import { n as getHeliaDebugContext } from "./util-CjfTxkQ8.js";
2
+ import { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, Fr as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Nr as joinValues, Pr as parsedType, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as n$1, Rt as pTimeout, Sr as setErrorMap, St as findUpdatingComment, Tt as listUpdatingComments, Xn as n$2, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, br as require_supports_color, cn as PubsubTopicSchema, ct as resolveWhenPredicateIsTrue, dr as require_retry, er as t$1, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, ir as r, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as e, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yr as logger_default, z as isAbortError } from "./schema-B47aYWNu.js";
3
+ import { $ as RepliesPages, $n as t$5, $t as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCidParamSchema, At as verifyCommunityEdit, B as setNativeFunctions$1, Bn as RpcFetchCidResultSchema, Bt as getCommunityPublicKeyFromWire, Cn as parseRpcCommentEventWithPKCErrorIfItFails, Ct as verifyChallengeVerification, D as createKuboRpcClient, Dn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Dt as verifyCommentPubsubMessage, Et as verifyCommentModeration, Fn as RpcExportCommunityModLogsParamSchema, Gn as RpcUnsubscribeParamSchema, H as CommentClientsManager, Hn as RpcResolveAuthorNameResultSchema, Ht as decode, I as listCommunitiesSync, In as RpcExportCommunityModLogsResultSchema, It as normalizeCreatePublicationAuthor, Kn as t$4, L as monitorCommunitiesDirectory, Ln as RpcExportCommunityParamSchema, Lt as buildRuntimeCommunityFields, Mn as RpcCommunityIdentifierParamSchema, Mt as buildRuntimeAuthor, N as getDefaultDataPath, Nn as RpcCommunityPageParamSchema, Nt as cleanWireAuthor, On as RpcAuthorNameParamSchema, Ot as verifyCommentUpdate, Pn as RpcEditCommunityParamSchema, Pt as getAuthorNameFromRuntime, Q as parseRawPages, Qn as t$2, Rn as RpcExportCommunityResultSchema, Rt as getCommunityAddressFromRecord, Sn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Tt as verifyCommentIpfs, Un as RpcSubscriptionIdResultSchema, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcPublishChallengeAnswersParamSchema, Vt as normalizeCommunityInputFromCommunity, Wn as RpcSuccessResultSchema, Wt as getBufferedPKCAddressFromPublicKey, X as findCommentInPageInstanceRecursively, Xn as n$3, Xt as parseCidStringSchemaWithPKCErrorIfItFails, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as t$3, _n as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, at as PKCTypedEmitter, bn as parseDecryptedChallengeWithPKCErrorIfItFails, c as AddressesRewriterProxyServer, ct as signChallengeAnswer, dn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, en as parseCommentIpfsSchemaWithPKCErrorIfItFails, et as PublicationClientsManager, f as KeyvBetterSqlite3, fn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ft as signComment, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, hn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, in as parseCommunityAddressWithPKCErrorIfItFails, ir as require_undici, jn as RpcCommentRepliesPageParamSchema, jt as verifyVote, kn as RpcCancelExportParamSchema, ln as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, m as decodeRpcChallengePubsubMsg, mt as signCommentModeration, n as RpcRemoteCommunity, nn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, nt as InflightFetchManager, o as TrackedInstanceRegistry, ot as require_lib$1, p as decodeRpcChallengeAnswerPubsubMsg, pt as signCommentEdit, rn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, rr as nativeFunctions$2, s as LRUCache, sn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tt as PKCClientsManager, u as RemoteCommunity, un as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ut as signChallengeRequest, v as createSigner, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, vt as signCommunityEdit, wn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, wt as verifyCommentEdit, x as encryptEd25519AesGcm, xn as parseJsonWithPKCErrorIfFails, xt as verifyChallengeMessage, y as decryptEd25519AesGcm, yn as parseDecryptedChallengeVerification, yt as signVote, zn as RpcFetchCidParamSchema, zt as getCommunityNameFromWire } from "./rpc-local-community-ByjBdSQ5.js";
4
+ import { r as getHeliaDebugContext } from "./util-P3adfecj.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -2106,6 +2106,8 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
2106
2106
  assert(rpcServerUrl, "pkc.pkcRpcClientsOptions needs to be defined to create a new rpc client");
2107
2107
  this._websocketServerUrl = rpcServerUrl;
2108
2108
  this._timeoutSeconds = 20;
2109
+ const envCallTimeoutMs = typeof process !== "undefined" ? Number(process.env?.["PKC_RPC_CALL_TIMEOUT_MS"]) : NaN;
2110
+ this._callTimeoutMs = envCallTimeoutMs > 0 ? envCallTimeoutMs : 3e5;
2109
2111
  this.communities = [];
2110
2112
  this._subscriptionEvents = {};
2111
2113
  this.on("communitieschange", (newSubs) => {
@@ -2176,7 +2178,13 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
2176
2178
  this._webSocketClient.call = async (...args) => {
2177
2179
  try {
2178
2180
  await this._init();
2179
- return await originalWebsocketCall(...args);
2181
+ return await pTimeout(originalWebsocketCall(...args), {
2182
+ milliseconds: this._callTimeoutMs,
2183
+ message: new PKCError("ERR_RPC_CALL_TIMED_OUT", {
2184
+ rpcMethod: args[0],
2185
+ timeoutMs: this._callTimeoutMs
2186
+ })
2187
+ });
2180
2188
  } catch (e) {
2181
2189
  const typedError = e;
2182
2190
  typedError.details = {
@@ -8866,7 +8874,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8866
8874
  this.clients.libp2pJsClients = {};
8867
8875
  if (!this.libp2pJsClientsOptions) return;
8868
8876
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
8869
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CYDRSysz.js");
8877
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CTxzGps-.js");
8870
8878
  for (const clientOptions of this.libp2pJsClientsOptions) {
8871
8879
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
8872
8880
  ...clientOptions,
@@ -9114,7 +9122,7 @@ var PKC$1 = class extends PKCTypedEmitter {
9114
9122
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
9115
9123
  log.trace("Received community options to create a local community instance:", options);
9116
9124
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
9117
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-DyaGG6lj.js");
9125
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-DJX_xmB4.js");
9118
9126
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
9119
9127
  const community = new LocalCommunity(this);
9120
9128
  if (isLocalCommunity) {
@@ -1,15 +1,15 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-Dtvt2tQ8.js";
2
+ import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-B47aYWNu.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
4
  import http from "node:http";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import fsp from "node:fs/promises";
8
- import path from "node:path";
8
+ import Path from "node:path";
9
9
  import dns from "node:dns";
10
10
  import os from "os";
11
11
  import { closeSync, createReadStream, existsSync, openSync, promises, readSync, readdirSync, rm, watch } from "node:fs";
12
- import path$1 from "path";
12
+ import path from "path";
13
13
  import assert from "assert";
14
14
  import { Agent } from "https";
15
15
  import { Agent as Agent$1 } from "http";
@@ -97555,12 +97555,27 @@ const signBufferEd25519 = async (bufferToSign, privateKeyBase64) => {
97555
97555
  if (privateKeyBuffer.length !== 32) throw Error(`verifyBufferEd25519 publicKeyBase64 ed25519 public key length not 32 bytes (${privateKeyBuffer.length} bytes)`);
97556
97556
  return ed25519.sign(bufferToSign, privateKeyBuffer);
97557
97557
  };
97558
+ let webCryptoEd25519Supported;
97559
+ const _isWebCryptoEd25519Supported = async () => {
97560
+ if (webCryptoEd25519Supported === void 0) try {
97561
+ const knownValidPublicKey = ed25519.getPublicKey(new Uint8Array(32).fill(1));
97562
+ await globalThis.crypto.subtle.importKey("raw", knownValidPublicKey, { name: "Ed25519" }, false, ["verify"]);
97563
+ webCryptoEd25519Supported = true;
97564
+ } catch {
97565
+ webCryptoEd25519Supported = false;
97566
+ }
97567
+ return webCryptoEd25519Supported;
97568
+ };
97558
97569
  const verifyBufferEd25519 = async (bufferToSign, bufferSignature, publicKeyBase64) => {
97559
97570
  if (!isProbablyBuffer$1(bufferToSign)) throw Error(`verifyBufferEd25519 invalid bufferSignature '${bufferToSign}' not buffer`);
97560
97571
  if (!isProbablyBuffer$1(bufferSignature)) throw Error(`verifyBufferEd25519 invalid bufferSignature '${bufferSignature}' not buffer`);
97561
97572
  if (!publicKeyBase64 || typeof publicKeyBase64 !== "string") throw Error(`verifyBufferEd25519 publicKeyBase64 '${publicKeyBase64}' not a string`);
97562
97573
  const publicKeyBuffer = fromString(publicKeyBase64, "base64");
97563
97574
  if (publicKeyBuffer.length !== 32) throw Error(`verifyBufferEd25519 publicKeyBase64 '${publicKeyBase64}' ed25519 public key length not 32 bytes (${publicKeyBuffer.length} bytes)`);
97575
+ if (await _isWebCryptoEd25519Supported()) try {
97576
+ const cryptoKey = await globalThis.crypto.subtle.importKey("raw", publicKeyBuffer, { name: "Ed25519" }, false, ["verify"]);
97577
+ if (await globalThis.crypto.subtle.verify("Ed25519", cryptoKey, bufferSignature, bufferToSign)) return true;
97578
+ } catch {}
97564
97579
  return ed25519.verify(bufferSignature, bufferToSign, publicKeyBuffer);
97565
97580
  };
97566
97581
  async function _validateAuthorAddressBeforeSigning(author, signer, pkc) {
@@ -101567,14 +101582,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
101567
101582
  };
101568
101583
  //#endregion
101569
101584
  //#region dist/node/runtime/node/util.js
101570
- const getDefaultDataPath = () => path$1.join(process.cwd(), ".pkc");
101585
+ const getDefaultDataPath = () => path.join(process.cwd(), ".pkc");
101571
101586
  const getDefaultCommunityDbConfig = async (communityAddress, pkc) => {
101572
101587
  let filename;
101573
101588
  if (pkc.noData) filename = ":memory:";
101574
101589
  else {
101575
101590
  assert(typeof pkc.dataPath === "string", "pkc.dataPath need to be defined to get default community db config");
101576
- filename = path$1.join(pkc.dataPath, "communities", communityAddress);
101577
- await promises.mkdir(path$1.dirname(filename), { recursive: true });
101591
+ filename = path.join(pkc.dataPath, "communities", communityAddress);
101592
+ await promises.mkdir(path.dirname(filename), { recursive: true });
101578
101593
  }
101579
101594
  return {
101580
101595
  filename,
@@ -101673,7 +101688,7 @@ const setNativeFunctions = (newNativeFunctions) => {
101673
101688
  };
101674
101689
  const deleteOldCommunityInWindows = async (subPath, pkc) => {
101675
101690
  const log = logger_default("pkc-js:community:deleteStaleCommunityInWindows");
101676
- const communityAddress = path$1.basename(subPath);
101691
+ const communityAddress = path.basename(subPath);
101677
101692
  await new Promise((resolve) => setTimeout(resolve, 1e4));
101678
101693
  try {
101679
101694
  await promises.rm(subPath, { force: true });
@@ -101697,7 +101712,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101697
101712
  }
101698
101713
  const communitiesThatWereDeletedSuccessfully = [];
101699
101714
  for (const communityAddress of deletedPersistentCommunities) {
101700
- const communityPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101715
+ const communityPath = path.join(pkc.dataPath, "communities", communityAddress);
101701
101716
  try {
101702
101717
  await promises.rm(communityPath, { force: true });
101703
101718
  log(`Succeeded in deleting old db path (${communityAddress})`);
@@ -101721,7 +101736,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101721
101736
  function listCommunitiesSync(pkc) {
101722
101737
  logger_default("pkc-js:listCommunitiesSync");
101723
101738
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath needs to be defined to listCommunities");
101724
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101739
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101725
101740
  const files = readdirSync(communitiesPath, {
101726
101741
  recursive: false,
101727
101742
  withFileTypes: false
@@ -101729,7 +101744,7 @@ function listCommunitiesSync(pkc) {
101729
101744
  const communityFilesWeDontNeedToCheck = pkc.communities ? files.filter((address) => pkc.communities.includes(address)) : [];
101730
101745
  const sqliteFiles = files.filter((address) => !communityFilesWeDontNeedToCheck.includes(address)).filter((address) => {
101731
101746
  try {
101732
- const filePath = path$1.join(communitiesPath, address);
101747
+ const filePath = path.join(communitiesPath, address);
101733
101748
  if (!existsSync(filePath)) return false;
101734
101749
  const fd = openSync(filePath, "r");
101735
101750
  const buffer = Buffer.alloc(16);
@@ -101810,7 +101825,7 @@ var BackupAbortError = class extends Error {
101810
101825
  async function backupCommunityDb(opts) {
101811
101826
  const { sourcePath, destPath, includePrivateKey, onProgress, signal } = opts;
101812
101827
  if (signal?.aborted) throw new BackupAbortError();
101813
- await promises.mkdir(path$1.dirname(destPath), { recursive: true });
101828
+ await promises.mkdir(path.dirname(destPath), { recursive: true });
101814
101829
  const partialPath = destPath + ".partial";
101815
101830
  try {
101816
101831
  await promises.unlink(partialPath);
@@ -101894,9 +101909,9 @@ async function statAndHashFile(filePath) {
101894
101909
  }
101895
101910
  async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
101896
101911
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath is not defined");
101897
- const oldPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101898
- const newPath = path$1.join(pkc.dataPath, "communities", "deleted", communityAddress);
101899
- await promises.mkdir(path$1.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101912
+ const oldPath = path.join(pkc.dataPath, "communities", communityAddress);
101913
+ const newPath = path.join(pkc.dataPath, "communities", "deleted", communityAddress);
101914
+ await promises.mkdir(path.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101900
101915
  if (!existsSync(oldPath)) throw Error(`Source database ${oldPath} does not exist`);
101901
101916
  try {
101902
101917
  const sourceDb = new Database(oldPath, { fileMustExist: true });
@@ -101932,7 +101947,7 @@ async function createKuboRpcClient(kuboRpcClientOptions) {
101932
101947
  }
101933
101948
  async function monitorCommunitiesDirectory(pkc) {
101934
101949
  const watchAbortController = new AbortController();
101935
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101950
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101936
101951
  await promises.mkdir(communitiesPath, { recursive: true });
101937
101952
  const extensionsToIgnore = [
101938
101953
  ".lock",
@@ -124788,6 +124803,8 @@ var CommunityClientsManager = class extends PKCClientsManager {
124788
124803
  }
124789
124804
  async updateOnce() {
124790
124805
  const log = logger_default("pkc-js:remote-community:update");
124806
+ const publicKeyAtFetchStart = this._community.publicKey;
124807
+ const stopSignalAtFetchStart = this._community._getStopAbortSignal();
124791
124808
  this._ipnsLoadingOperation = import_retry.operation({
124792
124809
  forever: true,
124793
124810
  factor: 2,
@@ -124795,6 +124812,10 @@ var CommunityClientsManager = class extends PKCClientsManager {
124795
124812
  });
124796
124813
  const communityLoadingRes = await this._retryLoadingCommunityAddress(this._community.address);
124797
124814
  this._ipnsLoadingOperation.stop();
124815
+ if (stopSignalAtFetchStart?.aborted || this._community.publicKey !== publicKeyAtFetchStart) {
124816
+ log(`Community ${this._community.address} fetch result discarded: it was fetched under public key ${publicKeyAtFetchStart} but the community's operations were aborted or its public key changed to ${this._community.publicKey} mid-fetch (key migration)`);
124817
+ return;
124818
+ }
124798
124819
  if (communityLoadingRes && "aborted" in communityLoadingRes) return;
124799
124820
  else if (communityLoadingRes && "criticalError" in communityLoadingRes) {
124800
124821
  if (communityLoadingRes.criticalError instanceof FailedToFetchCommunityFromGatewaysError) for (const [gatewayUrl, gatewayError] of Object.entries(communityLoadingRes.criticalError.details.gatewayToError)) log.error(`Community ${this._community.address} gateway ${gatewayUrl} non-retriable error:`, gatewayError);
@@ -125825,11 +125846,11 @@ var AddressRewriterDatabase = class {
125825
125846
  if (kuboConfig && typeof kuboConfig === "object" && "host" in kuboConfig && "port" in kuboConfig) kuboIdentifier = `${kuboConfig.host}_${kuboConfig.port}`;
125826
125847
  const proxyIdentifier = `${proxyTarget.hostname}_${proxyTarget.port || (proxyTarget.protocol === "https:" ? "443" : "80")}`;
125827
125848
  const fileName = `address_rewriter_${kuboIdentifier}_${proxyIdentifier}.db`;
125828
- return path.join(dataPath, ".address-rewriter", fileName);
125849
+ return Path.join(dataPath, ".address-rewriter", fileName);
125829
125850
  }
125830
125851
  async initialize() {
125831
125852
  try {
125832
- const dbDir = path.dirname(this._dbPath);
125853
+ const dbDir = Path.dirname(this._dbPath);
125833
125854
  await fsp.mkdir(dbDir, { recursive: true });
125834
125855
  this._db = new Database(this._dbPath);
125835
125856
  this._db.exec(`
@@ -5154,6 +5154,7 @@ var messages;
5154
5154
  messages["ERR_GET_COMMUNITY_TIMED_OUT"] = "pkc.getCommunity({address}) timed out";
5155
5155
  messages["ERR_TIMEOUT_WAITING_FOR_PUBSUB_TOPIC_PEERS"] = "Timeout waiting for propagation of pubsub topic peers";
5156
5156
  messages["ERR_PUBSUB_TOPIC_PEER_WAIT_ABORTED"] = "Aborted while waiting for a peer to subscribe to a pubsub topic";
5157
+ messages["ERR_IPNS_DIRECT_FETCH_ABORTED"] = "Aborted while fetching an IPNS record directly from subscribers/providers";
5157
5158
  messages["ERR_TIMED_OUT_RM_MFS_FILE"] = "Timed out removing MFS paths. We may need to nuke the whole MFS directory and republish everything";
5158
5159
  messages["ERR_ABORTED_RESOLVING_TEXT_RECORD"] = "Aborted resolving text record on domain";
5159
5160
  messages["ERR_CALLED_COMMUNITY_STOP_WITHOUT_UPDATE"] = "community.stop() called without calling update() first";
@@ -5202,6 +5203,7 @@ var messages;
5202
5203
  messages["ERR_REMOTE_COMMUNITY_RECEIVED_ALREADY_PROCCESSED_RECORD"] = "We loaded a community record but it's a record we already consumed before";
5203
5204
  messages["ERR_COMMENT_RECEIVED_ALREADY_PROCESSED_COMMENT_UPDATE"] = "We loaded a CommentUpdate but it's a record we already consumed";
5204
5205
  messages["ERR_FETCH_CID_P2P_TIMEOUT"] = "Fetching CID via Kubo-rpc-client/helia P2P has timed out";
5206
+ messages["ERR_INVALID_KUBO_STYLE_TIMEOUT"] = "The timeout option is not a number of milliseconds or a kubo-style duration string (e.g. \"30s\", \"2m\")";
5205
5207
  messages["ERR_FETCH_CID_P2P_TIMEOUT_AFTER_RETRIES"] = "Fetching CID via Kubo-rpc-client/helia P2P has timed out after all retry attempts";
5206
5208
  messages["ERR_RESOLVED_IPNS_P2P_TO_UNDEFINED"] = "Resolved IPNS name to undefined. Does this IPNS name exist?";
5207
5209
  messages["ERR_IPNS_RESOLUTION_P2P_TIMEOUT"] = "IPNS resolution P2P timed out";
@@ -5476,6 +5478,7 @@ var messages;
5476
5478
  messages["ERR_RPC_CLIENT_TRYING_TO_EDIT_REMOTE_COMMUNITY"] = "RPC client is attempting to edit remote community";
5477
5479
  messages["ERR_RPC_CLIENT_TRYING_TO_DELETE_REMOTE_COMMUNITY"] = "RPC client is attempting to delete remote community";
5478
5480
  messages["ERR_GENERIC_RPC_CLIENT_CALL_ERROR"] = "RPC client received an unknown error when executing call over websocket";
5481
+ messages["ERR_RPC_CALL_TIMED_OUT"] = "RPC client call timed out without receiving a response from the RPC server";
5479
5482
  messages["ERR_RPC_CLIENT_CHALLENGE_NAME_NOT_AVAILABLE_ON_SERVER"] = "The challenge name is not available on the RPC server. Available challenges are listed in details.availableChallenges";
5480
5483
  messages["ERR_ROLE_ADDRESS_NAME_COULD_NOT_BE_RESOLVED"] = "Role address name could not be resolved";
5481
5484
  messages["ERR_COMMUNITY_NOT_LOCAL"] = "community.export() can only be called on a LocalCommunity on this daemon";
@@ -16029,7 +16032,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
16029
16032
  }
16030
16033
  //#endregion
16031
16034
  //#region dist/node/generated-version.js
16032
- const version = "0.0.64";
16035
+ const version = "0.0.67";
16033
16036
  //#endregion
16034
16037
  //#region dist/node/version.js
16035
16038
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
@@ -1,7 +1,8 @@
1
- import { _r as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-Dtvt2tQ8.js";
1
+ import { _r as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-B47aYWNu.js";
2
2
  //#region dist/node/helia/util.js
3
3
  const TOPIC_SUBSCRIBER_WAIT_TIMEOUT_MS = 1e4;
4
4
  const MESH_PEER_WAIT_TIMEOUT_MS = 3e3;
5
+ const DIRECT_FETCH_PER_PEER_TIMEOUT_MS = 5e3;
5
6
  function getHeliaDebugContext(helia) {
6
7
  const connections = helia.libp2p.getConnections();
7
8
  return {
@@ -201,5 +202,119 @@ async function connectToPubsubPeers({ helia, pubsubTopic, maxPeers, options, log
201
202
  }
202
203
  return connectedPeersWithContent;
203
204
  }
205
+ function selectBitswapSessionSeedPeers(args) {
206
+ if (args.connectedPeers.length === 0 || args.maxSeeds <= 0) return [];
207
+ const connectedByString = new Map(args.connectedPeers.map((peer) => [peer.toString(), peer]));
208
+ const seeds = [];
209
+ const seededStrings = /* @__PURE__ */ new Set();
210
+ const pushIfConnected = (peerIdString) => {
211
+ const connectedPeer = connectedByString.get(peerIdString);
212
+ if (connectedPeer && !seededStrings.has(peerIdString)) {
213
+ seededStrings.add(peerIdString);
214
+ seeds.push(connectedPeer);
215
+ }
216
+ };
217
+ args.recentIpnsRecordServerPeerIdStrings.forEach(pushIfConnected);
218
+ args.pubsubSubscriberPeerIdStrings.forEach(pushIfConnected);
219
+ for (const peer of args.connectedPeers) pushIfConnected(peer.toString());
220
+ return seeds.slice(0, args.maxSeeds);
221
+ }
222
+ async function directFetchIpnsRecordFromProviders({ helia, pubsubTopic, routingKey, maxPeers, validate, options, log }) {
223
+ if (options?.signal?.aborted) throw new PKCError("ERR_IPNS_DIRECT_FETCH_ABORTED", {
224
+ pubsubTopic,
225
+ ...getHeliaDebugContext(helia)
226
+ });
227
+ const start = Date.now();
228
+ const fetchService = helia.libp2p.services.fetch;
229
+ const pubsub = helia.libp2p.services.pubsub;
230
+ const contentCid = pubsubTopicToDhtKeyCid(pubsubTopic);
231
+ const resultController = new AbortController();
232
+ let winner;
233
+ const peerToError = {};
234
+ const recordErr = (peerId, e) => {
235
+ const err = e;
236
+ peerToError[peerId.toString()] = {
237
+ errorName: err.name,
238
+ errorMessage: err.message
239
+ };
240
+ log.trace("Direct IPNS fetch failed from peer", peerId.toString(), "due to error", e);
241
+ };
242
+ const tryFetchFromPeer = async (peerId, source) => {
243
+ if (resultController.signal.aborted || winner) return;
244
+ const timeoutSignal = AbortSignal.timeout(options?.timeoutMs ?? DIRECT_FETCH_PER_PEER_TIMEOUT_MS);
245
+ const signal = options?.signal ? AbortSignal.any([
246
+ options.signal,
247
+ resultController.signal,
248
+ timeoutSignal
249
+ ]) : AbortSignal.any([resultController.signal, timeoutSignal]);
250
+ try {
251
+ const bytes = await fetchService.fetch(peerId, routingKey, { signal });
252
+ if (bytes == null) {
253
+ log.trace("Peer", peerId.toString(), "did not have IPNS record for topic", pubsubTopic);
254
+ return;
255
+ }
256
+ await validate(routingKey, bytes);
257
+ if (!resultController.signal.aborted && !winner) {
258
+ winner = {
259
+ recordBytes: bytes,
260
+ peerId: peerId.toString(),
261
+ source,
262
+ durationMs: Date.now() - start
263
+ };
264
+ resultController.abort();
265
+ }
266
+ } catch (e) {
267
+ recordErr(peerId, e);
268
+ }
269
+ };
270
+ const subscriberTasks = pubsub.getSubscribers(pubsubTopic).map((peerId) => tryFetchFromPeer(peerId, "subscriber"));
271
+ const providerBranch = (async () => {
272
+ const findProvidersAbort = new AbortController();
273
+ const findProvidersSignal = options?.signal ? AbortSignal.any([
274
+ options.signal,
275
+ findProvidersAbort.signal,
276
+ resultController.signal
277
+ ]) : AbortSignal.any([findProvidersAbort.signal, resultController.signal]);
278
+ const dialFetchTasks = [];
279
+ let attempted = 0;
280
+ try {
281
+ for await (const peer of helia.libp2p.contentRouting.findProviders(contentCid, {
282
+ ...options,
283
+ signal: findProvidersSignal
284
+ })) {
285
+ if (resultController.signal.aborted) break;
286
+ const announcedAddrs = peer.multiaddrs ?? [];
287
+ const hasDialableAddr = announcedAddrs.length > 0 && await helia.libp2p.isDialable(announcedAddrs);
288
+ dialFetchTasks.push((async () => {
289
+ try {
290
+ if (peer.multiaddrs?.length) await helia.libp2p.peerStore.merge(peer.id, { multiaddrs: peer.multiaddrs });
291
+ const dialSignal = options?.signal ? AbortSignal.any([options.signal, resultController.signal]) : resultController.signal;
292
+ await helia.libp2p.dial(peer.id, { signal: dialSignal });
293
+ await tryFetchFromPeer(peer.id, "provider");
294
+ } catch (e) {
295
+ recordErr(peer.id, e);
296
+ }
297
+ })());
298
+ if (hasDialableAddr && ++attempted >= maxPeers) {
299
+ findProvidersAbort.abort();
300
+ break;
301
+ }
302
+ }
303
+ } catch (e) {
304
+ if (!findProvidersSignal.aborted) log.trace("findProviders errored during direct IPNS fetch for topic", pubsubTopic, e);
305
+ }
306
+ await Promise.allSettled(dialFetchTasks);
307
+ })();
308
+ await Promise.allSettled([...subscriberTasks, providerBranch]);
309
+ if (winner) {
310
+ log.trace("Direct IPNS fetch won from", winner.source, winner.peerId, "in", winner.durationMs, "ms for topic", pubsubTopic);
311
+ return winner;
312
+ }
313
+ if (options?.signal?.aborted) throw new PKCError("ERR_IPNS_DIRECT_FETCH_ABORTED", {
314
+ pubsubTopic,
315
+ peerToError,
316
+ ...getHeliaDebugContext(helia)
317
+ });
318
+ }
204
319
  //#endregion
205
- export { getHeliaDebugContext as n, connectToPubsubPeers as t };
320
+ export { selectBitswapSessionSeedPeers as i, directFetchIpnsRecordFromProviders as n, getHeliaDebugContext as r, connectToPubsubPeers as t };
@@ -1,2 +1,2 @@
1
- import { a as nativeFunctions, i as getShortCid, n as challenges, o as setNativeFunctions, r as getShortAddress, t as PKC } from "./chunks/node-DadVit9c.js";
1
+ import { a as nativeFunctions, i as getShortCid, n as challenges, o as setNativeFunctions, r as getShortAddress, t as PKC } from "./chunks/node-zemQ3e2S.js";
2
2
  export { challenges, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
@@ -1,7 +1,7 @@
1
- import { L as hideClassPrivateProps, Qn as n, _r as PKCError, er as t, st as replaceXWithY, xt as findStartedCommunity, yr as logger_default } from "../../chunks/schema-Dtvt2tQ8.js";
2
- import { _ as parseRpcUnsubscribeParam, c as parseRpcCancelExportParam, d as parseRpcCommunityIdentifierParam, f as parseRpcCommunityPageParam, g as parseRpcPublishChallengeAnswersParam, h as parseRpcExportCommunityParam, l as parseRpcCidParam, m as parseRpcExportCommunityModLogsParam, p as parseRpcEditCommunityParam, s as parseRpcAuthorNameParam, t as PKC, u as parseRpcCommentRepliesPageParam } from "../../chunks/node-DadVit9c.js";
3
- import { En as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, J as buildPagesRuntimeFields, Qt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Zt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, an as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, er as stringify, it as pLimit, mn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ot as require_lib, pn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, q as buildPageRuntimeFields, qn as t$1, rt as pRetry, tn as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-1Uvl5iwp.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-DYvRQWsK.js";
1
+ import { L as hideClassPrivateProps, Qn as n, _r as PKCError, er as t, st as replaceXWithY, xt as findStartedCommunity, yr as logger_default } from "../../chunks/schema-B47aYWNu.js";
2
+ import { _ as parseRpcUnsubscribeParam, c as parseRpcCancelExportParam, d as parseRpcCommunityIdentifierParam, f as parseRpcCommunityPageParam, g as parseRpcPublishChallengeAnswersParam, h as parseRpcExportCommunityParam, l as parseRpcCidParam, m as parseRpcExportCommunityModLogsParam, p as parseRpcEditCommunityParam, s as parseRpcAuthorNameParam, t as PKC, u as parseRpcCommentRepliesPageParam } from "../../chunks/node-zemQ3e2S.js";
3
+ import { En as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, J as buildPagesRuntimeFields, Qt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Zt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, an as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, er as stringify, it as pLimit, mn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ot as require_lib, pn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, q as buildPageRuntimeFields, qn as t$1, rt as pRetry, tn as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-ByjBdSQ5.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-T3mSbjdf.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -349,12 +349,17 @@ var PKCWsServer = class extends import_lib.TypedEmitter {
349
349
  }
350
350
  }
351
351
  rpcWebsocketsRegister(method, callback) {
352
+ let invocationCounter = 0;
352
353
  const callbackWithErrorHandled = async (params, connectionId) => {
354
+ const invocationId = `${method}#${++invocationCounter}`;
353
355
  try {
354
- return await callback(params, connectionId);
356
+ log.trace(`Received RPC call (${invocationId}) from connection (${connectionId})`);
357
+ const res = await callback(params, connectionId);
358
+ log.trace(`Dispatching RPC response for call (${invocationId}) to connection (${connectionId})`);
359
+ return res;
355
360
  } catch (e) {
356
361
  const typedError = e;
357
- log.error(`${callback.name} error`, {
362
+ log.error(`${callback.name} error (${invocationId})`, {
358
363
  params,
359
364
  error: typedError
360
365
  });
@@ -21,6 +21,7 @@ export default class PKCRpcClient extends TypedEmitter<PKCRpcClientEvents> {
21
21
  private _subscriptionEvents;
22
22
  private _pendingSubscriptionMsgs;
23
23
  private _timeoutSeconds;
24
+ private _callTimeoutMs;
24
25
  private _openConnectionPromise?;
25
26
  private _destroyRequested;
26
27
  constructor(rpcServerUrl: string);
@@ -17,6 +17,11 @@ export default class PKCRpcClient extends TypedEmitter {
17
17
  assert(rpcServerUrl, "pkc.pkcRpcClientsOptions needs to be defined to create a new rpc client");
18
18
  this._websocketServerUrl = rpcServerUrl; // default to first for now. Will change later
19
19
  this._timeoutSeconds = 20;
20
+ // Generous because some calls do unbounded server-side work (e.g. startCommunity repins a whole
21
+ // community). Its purpose is turning a lost RPC response into a diagnosable error instead of an
22
+ // infinite hang (issue #195), not bounding slow calls.
23
+ const envCallTimeoutMs = typeof process !== "undefined" ? Number(process.env?.["PKC_RPC_CALL_TIMEOUT_MS"]) : Number.NaN;
24
+ this._callTimeoutMs = envCallTimeoutMs > 0 ? envCallTimeoutMs : 300_000;
20
25
  this.communities = [];
21
26
  this._subscriptionEvents = {};
22
27
  this.on("communitieschange", (newSubs) => {
@@ -107,7 +112,15 @@ export default class PKCRpcClient extends TypedEmitter {
107
112
  this._webSocketClient.call = async (...args) => {
108
113
  try {
109
114
  await this._init();
110
- return await originalWebsocketCall(...args);
115
+ // A dropped/unmatched JSON-RPC response would otherwise leave this promise pending
116
+ // forever (issue #195) — rpc-websockets applies no timeout of its own
117
+ return await pTimeout(originalWebsocketCall(...args), {
118
+ milliseconds: this._callTimeoutMs,
119
+ message: new PKCError("ERR_RPC_CALL_TIMED_OUT", {
120
+ rpcMethod: args[0],
121
+ timeoutMs: this._callTimeoutMs
122
+ })
123
+ });
111
124
  }
112
125
  catch (e) {
113
126
  const typedError = e;
@@ -1 +1 @@
1
- {"version":3,"file":"pkc-rpc-client.js","sourceRoot":"","sources":["../../../../src/clients/rpc-client/pkc-rpc-client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAQjG,OAAO,EAAE,yDAAyD,EAAE,MAAM,6BAA6B,CAAC;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B,CAAC,IAAiC;QACpD,MAAM,UAAU,GAAG,gCAAgC,CAAC,IAAI,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,4BAA4B,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7G,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAChD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAA0B;QACzC,MAAM,UAAU,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,qBAAqB,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,KAAK,CAAC,WAAW;QACb,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,CAAC;CACJ"}
@@ -152,9 +152,20 @@ export class CommunityClientsManager extends PKCClientsManager {
152
152
  }
153
153
  async updateOnce() {
154
154
  const log = Logger("pkc-js:remote-community:update");
155
+ // Capture the identity and stop signal this fetch starts under. A key migration mid-fetch
156
+ // (_resolveNameInBackground) switches publicKey and aborts the stop controller, but the
157
+ // abort can't cancel a gateway response whose body was already received; the migration also
158
+ // clears raw.communityIpfs, so the freshness check below would accept the stale old-key
159
+ // record. Discard the result instead of applying it to the migrated community.
160
+ const publicKeyAtFetchStart = this._community.publicKey;
161
+ const stopSignalAtFetchStart = this._community._getStopAbortSignal();
155
162
  this._ipnsLoadingOperation = retry.operation({ forever: true, factor: 2, maxTimeout: 30000 });
156
163
  const communityLoadingRes = await this._retryLoadingCommunityAddress(this._community.address); // will return undefined if no new community CID is found
157
164
  this._ipnsLoadingOperation.stop();
165
+ if (stopSignalAtFetchStart?.aborted || this._community.publicKey !== publicKeyAtFetchStart) {
166
+ log(`Community ${this._community.address} fetch result discarded: it was fetched under public key ${publicKeyAtFetchStart} but the community's operations were aborted or its public key changed to ${this._community.publicKey} mid-fetch (key migration)`);
167
+ return;
168
+ }
158
169
  if (communityLoadingRes && "aborted" in communityLoadingRes) {
159
170
  return;
160
171
  }