@pkcprotocol/pkc-js 0.0.115 → 0.0.117
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.
- package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +16 -0
- package/dist/browser/clients/rpc-client/pkc-rpc-client.js +199 -43
- package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
- package/dist/browser/errors.d.ts +2 -0
- package/dist/browser/errors.js +2 -0
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/rpc/src/index.d.ts +5 -1
- package/dist/browser/rpc/src/index.js +28 -2
- package/dist/browser/rpc/src/index.js.map +1 -1
- package/dist/browser/runtime/node/community/db-handler.js +1 -1
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/cleanup.d.ts +4 -2
- package/dist/browser/runtime/node/community/local-community/cleanup.js +11 -6
- package/dist/browser/runtime/node/community/local-community/cleanup.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +8 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-store.js +28 -4
- package/dist/browser/runtime/node/community/local-community/publication-store.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +52 -52
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc-BB8P6KYw.js → helia-for-pkc-DuG274FA.js} +2 -2
- package/dist/bundled/chunks/{local-community-wAvG_J_u.js → local-community-BsALoql_.js} +1 -1
- package/dist/bundled/chunks/{local-community-XrLSKipf.js → local-community-XUj49rN_.js} +33 -14
- package/dist/bundled/chunks/{node-D5riLTOu.js → node-DkNDHK6w.js} +169 -53
- package/dist/bundled/chunks/{page-sort-scoring-3svUUHW_.js → page-sort-scoring-Cd97obb3.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-D5ZdqFYc.js → rpc-local-community-7uUa4lxH.js} +2 -2
- package/dist/bundled/chunks/{util-Cnpgfqwn.js → util-BMGkXifx.js} +1 -1
- package/dist/bundled/chunks/{util-CabVOL7E.js → util-Bm9ef_d5.js} +3 -1
- package/dist/bundled/chunks/{validate-package-factories-CxIg67oP.js → validate-package-factories-DHupf8eD.js} +2 -2
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/page-sorts.js +1 -1
- package/dist/bundled/rpc/src/index.js +23 -6
- package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +16 -0
- package/dist/node/clients/rpc-client/pkc-rpc-client.js +199 -43
- package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
- package/dist/node/errors.d.ts +2 -0
- package/dist/node/errors.js +2 -0
- package/dist/node/errors.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/rpc/src/index.d.ts +5 -1
- package/dist/node/rpc/src/index.js +28 -2
- package/dist/node/rpc/src/index.js.map +1 -1
- package/dist/node/runtime/node/community/db-handler.js +1 -1
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/cleanup.d.ts +4 -2
- package/dist/node/runtime/node/community/local-community/cleanup.js +11 -6
- package/dist/node/runtime/node/community/local-community/cleanup.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js +8 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-store.js +28 -4
- package/dist/node/runtime/node/community/local-community/publication-store.js.map +1 -1
- 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 { $t as CommentModerationPubsubMessagePublicationSchema, A as isLinkOfAnimatedImage, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Bn as CommentUpdateTableRowSchema, Dn as VoteTablesRowSchema, Dt as pTimeout, F as isLinkValid, Gr as ZodError, Jn as CommentEditPubsubMessagePublicationSchema, Jt as CommunityEditPublicationPubsubReservedFields, K as removeNullUndefinedValues, Kt as version_default, Lt as DecryptedChallengeRequestPublicationSchema, M as isLinkOfImage, Mr as logger_default, Mt as ChallengeRequestMessageSchema, N as isLinkOfMedia, Ot as ChallengeAnswerMessageSchema, P as isLinkOfVideo, Pt as ChallengeVerificationMessageSchema, Q as retryKuboIpfsAddAndProvide, Qn as CommentEditsTableRowSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rt as DecryptedChallengeRequestSchema, S as hideClassPrivateProps, Sr as t$2, St as untrackStartedCommunity, Tn as VotePubsubReservedFields, Tt as require_sha256, U as removeBlocksFromKuboNode, Vn as CommentsTableRowSchema, W as removeMfsFilesSafely, X as retryKuboBlockPutPinAndProvidePubsubTopic, Xn as CommentEditReservedFields, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as getEquivalentCommunityAddresses, _r as r$1, a as calculateUnixFsDagSizeCidV0, c as contentContainsMarkdownVideos, ct as writeKuboFilesWithTimeout, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$2, en as CommentModerationReservedFields, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, fr as t$5, ft as findUpdatingCommunity, g as genToArray, h as findMalformedUnicodeString, hr as e, i as calculateStringSizeSameAsIpfsAddCidV0, it as timestamp, j as isLinkOfAudio, jn as CommentPubsubMessageReservedFields, jr as messages, lr as n$3, lt as findCommunityInRegistry, mr as e$1, nn as CommentModerationsTableRowSchema, nr as AuthorReservedFields, nt as statMfsPathSafely, o as contentContainsMarkdownAudio, ot as withSortedKeys, pr as t$6, r as calculateIpfsCidV0, s as contentContainsMarkdownImages, st as withSortedKeysDeep, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, ur as t$7, ut as findStartedCommunity, v as getErrorCodeFromMessage, vr as t$3, vt as syncCommunityRegistryEntry, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, xr as t$4, xt as trackUpdatingCommunity, y as getIpnsRecordInLocalKuboNode, yt as trackStartedCommunity } from "./util-
|
|
3
|
-
import { $n as calculateExpectedSignatureSize, $t as SignerWithPublicKeyAddress, A as iterateOverPageCidsToFindAllCids, An as verifyCommunityEdit, Ar as require_lodash_merge, C as TIMEFRAMES_TO_SECONDS, Cr as t$9, Dn as verifyCommentPubsubMessage, En as verifyCommentModeration, Fn as getAuthorNameFromWire, Gn as encode, H as pLimit, Hn as getCommunityPublicKeyFromWire, J as coerceSchemaRowBoolean, Jn as getPKCAddressFromPublicKey, Ln as crosspostChainDepthUpTo, Mn as buildRuntimeAuthor, Nn as cleanWireAuthor, On as verifyCommentUpdate, Qn as backupCommunityDb, Rn as effectiveMaxCrosspostDepth, Sn as verifyChallengeRequest, Tn as verifyCommentIpfs, Vn as getCommunityNameFromWire, Wn as decode, X as collectSchemaRowCoercions, Xn as getPublicKeyFromPrivateKey, Y as coerceSchemaRowJson, Yn as getPKCAddressFromPublicKeySync, Z as createSchemaRowParser, Zn as BackupAbortError, _ as TrackedInstanceRegistry, _n as signCommunity, _r as t$11, a as generatePagesReportingFailedSorts, an as encryptEd25519AesGcmPublicKeyBuffer, ar as deriveDbReplies, b as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, bn as verifyChallengeAnswer, br as n$5, c as resolvePageSortsOrThrow, cr as getThumbnailPropsOfLink, d as getCommunityChallengeFromCommunityChallengeSettings, dn as signChallengeVerification, dt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, er as calculateInlineRepliesBudget, f as loadChallengeFileFromCommunityChallengeSettings, fn as signComment, fr as moveCommunityDbToDeletedDirectory, g as createAuthorIdentityMatcher, gn as signCommentUpdateForChallengeVerification, gr as t$10, h as authorNameResolveFailureReason, hn as signCommentUpdate, i as derivePublicPageSorts, ir as deriveDbPosts, jn as verifyVote, kn as verifyCommunity, kr as STORAGE_KEYS, ln as signChallengeMessage, lr as importSignerIntoKuboNode, lt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, m as authorIdentityMatcherForRequest, nr as deleteOldCommunityInWindows, o as loadPageSortsForStartedCommunity, on as _validateSignatureOfPKCRecord, or as getDefaultCommunityDbConfig, p as pkcJsChallenges, pn as signCommentEdit, pr as resolveDbPostsCidRefs, qn as getIpfsKeyFromPrivateKey, r as computePageSortsFingerprint, rn as decryptEd25519AesGcmPublicKeyBuffer, rr as deriveCommentIpfsFromCommentTableRow, s as lookupPageSortFactories, sn as cleanUpBeforePublishing, t as RpcLocalCommunity, u as getChallengeVerification, v as LRUCache, vr as r$2, wn as verifyCommentEdit, wr as stringify, wt as parseJsonWithPKCErrorIfFails, x as KeyvBetterSqlite3, xr as n$4, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yr as t$8 } from "./rpc-local-community-
|
|
4
|
-
import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-
|
|
2
|
+
import { $t as CommentModerationPubsubMessagePublicationSchema, A as isLinkOfAnimatedImage, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Bn as CommentUpdateTableRowSchema, Dn as VoteTablesRowSchema, Dt as pTimeout, F as isLinkValid, Gr as ZodError, Jn as CommentEditPubsubMessagePublicationSchema, Jt as CommunityEditPublicationPubsubReservedFields, K as removeNullUndefinedValues, Kt as version_default, Lt as DecryptedChallengeRequestPublicationSchema, M as isLinkOfImage, Mr as logger_default, Mt as ChallengeRequestMessageSchema, N as isLinkOfMedia, Ot as ChallengeAnswerMessageSchema, P as isLinkOfVideo, Pt as ChallengeVerificationMessageSchema, Q as retryKuboIpfsAddAndProvide, Qn as CommentEditsTableRowSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rt as DecryptedChallengeRequestSchema, S as hideClassPrivateProps, Sr as t$2, St as untrackStartedCommunity, Tn as VotePubsubReservedFields, Tt as require_sha256, U as removeBlocksFromKuboNode, Vn as CommentsTableRowSchema, W as removeMfsFilesSafely, X as retryKuboBlockPutPinAndProvidePubsubTopic, Xn as CommentEditReservedFields, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as getEquivalentCommunityAddresses, _r as r$1, a as calculateUnixFsDagSizeCidV0, c as contentContainsMarkdownVideos, ct as writeKuboFilesWithTimeout, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$2, en as CommentModerationReservedFields, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, fr as t$5, ft as findUpdatingCommunity, g as genToArray, h as findMalformedUnicodeString, hr as e, i as calculateStringSizeSameAsIpfsAddCidV0, it as timestamp, j as isLinkOfAudio, jn as CommentPubsubMessageReservedFields, jr as messages, lr as n$3, lt as findCommunityInRegistry, mr as e$1, nn as CommentModerationsTableRowSchema, nr as AuthorReservedFields, nt as statMfsPathSafely, o as contentContainsMarkdownAudio, ot as withSortedKeys, pr as t$6, r as calculateIpfsCidV0, s as contentContainsMarkdownImages, st as withSortedKeysDeep, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, ur as t$7, ut as findStartedCommunity, v as getErrorCodeFromMessage, vr as t$3, vt as syncCommunityRegistryEntry, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, xr as t$4, xt as trackUpdatingCommunity, y as getIpnsRecordInLocalKuboNode, yt as trackStartedCommunity } from "./util-Bm9ef_d5.js";
|
|
3
|
+
import { $n as calculateExpectedSignatureSize, $t as SignerWithPublicKeyAddress, A as iterateOverPageCidsToFindAllCids, An as verifyCommunityEdit, Ar as require_lodash_merge, C as TIMEFRAMES_TO_SECONDS, Cr as t$9, Dn as verifyCommentPubsubMessage, En as verifyCommentModeration, Fn as getAuthorNameFromWire, Gn as encode, H as pLimit, Hn as getCommunityPublicKeyFromWire, J as coerceSchemaRowBoolean, Jn as getPKCAddressFromPublicKey, Ln as crosspostChainDepthUpTo, Mn as buildRuntimeAuthor, Nn as cleanWireAuthor, On as verifyCommentUpdate, Qn as backupCommunityDb, Rn as effectiveMaxCrosspostDepth, Sn as verifyChallengeRequest, Tn as verifyCommentIpfs, Vn as getCommunityNameFromWire, Wn as decode, X as collectSchemaRowCoercions, Xn as getPublicKeyFromPrivateKey, Y as coerceSchemaRowJson, Yn as getPKCAddressFromPublicKeySync, Z as createSchemaRowParser, Zn as BackupAbortError, _ as TrackedInstanceRegistry, _n as signCommunity, _r as t$11, a as generatePagesReportingFailedSorts, an as encryptEd25519AesGcmPublicKeyBuffer, ar as deriveDbReplies, b as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, bn as verifyChallengeAnswer, br as n$5, c as resolvePageSortsOrThrow, cr as getThumbnailPropsOfLink, d as getCommunityChallengeFromCommunityChallengeSettings, dn as signChallengeVerification, dt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, er as calculateInlineRepliesBudget, f as loadChallengeFileFromCommunityChallengeSettings, fn as signComment, fr as moveCommunityDbToDeletedDirectory, g as createAuthorIdentityMatcher, gn as signCommentUpdateForChallengeVerification, gr as t$10, h as authorNameResolveFailureReason, hn as signCommentUpdate, i as derivePublicPageSorts, ir as deriveDbPosts, jn as verifyVote, kn as verifyCommunity, kr as STORAGE_KEYS, ln as signChallengeMessage, lr as importSignerIntoKuboNode, lt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, m as authorIdentityMatcherForRequest, nr as deleteOldCommunityInWindows, o as loadPageSortsForStartedCommunity, on as _validateSignatureOfPKCRecord, or as getDefaultCommunityDbConfig, p as pkcJsChallenges, pn as signCommentEdit, pr as resolveDbPostsCidRefs, qn as getIpfsKeyFromPrivateKey, r as computePageSortsFingerprint, rn as decryptEd25519AesGcmPublicKeyBuffer, rr as deriveCommentIpfsFromCommentTableRow, s as lookupPageSortFactories, sn as cleanUpBeforePublishing, t as RpcLocalCommunity, u as getChallengeVerification, v as LRUCache, vr as r$2, wn as verifyCommentEdit, wr as stringify, wt as parseJsonWithPKCErrorIfFails, x as KeyvBetterSqlite3, xr as n$4, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yr as t$8 } from "./rpc-local-community-7uUa4lxH.js";
|
|
4
|
+
import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-Cd97obb3.js";
|
|
5
5
|
import { randomFillSync, randomUUID } from "node:crypto";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import path from "node:path";
|
|
@@ -3361,7 +3361,7 @@ var DbHandler = class {
|
|
|
3361
3361
|
`).all();
|
|
3362
3362
|
for (const { cid } of duplicateCids) {
|
|
3363
3363
|
const purgedRows = this.purgeComment(cid);
|
|
3364
|
-
for (const row of purgedRows)
|
|
3364
|
+
for (const row of purgedRows) addAllCidsUnderPurgedCommentToBeRemoved(this._community, row);
|
|
3365
3365
|
}
|
|
3366
3366
|
log(`Purged ${duplicateCids.length} duplicate comment row(s) based on signature.signature with higher rowid values.`);
|
|
3367
3367
|
continue;
|
|
@@ -5752,7 +5752,7 @@ async function unpinStaleCids(community, options = {}) {
|
|
|
5752
5752
|
log.trace(`unpinned ${sizeBefore - community._cidsToUnPin.size} stale cids from ipfs node for community (${community.address})`);
|
|
5753
5753
|
}
|
|
5754
5754
|
}
|
|
5755
|
-
async function rmUnneededMfsPaths(community) {
|
|
5755
|
+
async function rmUnneededMfsPaths(community, opts) {
|
|
5756
5756
|
const log = logger_default("pkc-js:local-community:sync:_rmUnneededMfsPaths");
|
|
5757
5757
|
if (community._mfsPathsToRemove.size > 0) {
|
|
5758
5758
|
const toDeleteMfsPaths = Array.from(community._mfsPathsToRemove.values());
|
|
@@ -5761,14 +5761,17 @@ async function rmUnneededMfsPaths(community) {
|
|
|
5761
5761
|
await removeMfsFilesSafely({
|
|
5762
5762
|
kuboRpcClient: kuboRpc,
|
|
5763
5763
|
paths: toDeleteMfsPaths,
|
|
5764
|
-
log
|
|
5764
|
+
log,
|
|
5765
|
+
inputNumOfRetries: opts?.numOfRetries
|
|
5765
5766
|
});
|
|
5766
5767
|
toDeleteMfsPaths.forEach((path) => community._mfsPathsToRemove.delete(path));
|
|
5767
5768
|
return toDeleteMfsPaths;
|
|
5768
5769
|
} catch (e) {
|
|
5769
5770
|
const error = e;
|
|
5770
|
-
if (error.message.includes("file does not exist"))
|
|
5771
|
-
|
|
5771
|
+
if (error.message.includes("file does not exist")) {
|
|
5772
|
+
toDeleteMfsPaths.forEach((path) => community._mfsPathsToRemove.delete(path));
|
|
5773
|
+
return toDeleteMfsPaths;
|
|
5774
|
+
} else {
|
|
5772
5775
|
log.error("Failed to remove paths from MFS", toDeleteMfsPaths, e);
|
|
5773
5776
|
throw error;
|
|
5774
5777
|
}
|
|
@@ -5870,7 +5873,7 @@ async function _runRepoGcIfDue({ community, kuboUrl, force, log }) {
|
|
|
5870
5873
|
after: repoSizeAfter
|
|
5871
5874
|
}));
|
|
5872
5875
|
}
|
|
5873
|
-
|
|
5876
|
+
function addAllCidsUnderPurgedCommentToBeRemoved(community, purgedCommentAndCommentUpdate) {
|
|
5874
5877
|
communitiesWithPendingPurgeFlush.set(community, Date.now());
|
|
5875
5878
|
community._cidsToUnPin.add(purgedCommentAndCommentUpdate.commentTableRow.cid);
|
|
5876
5879
|
community._blocksToRm.push(purgedCommentAndCommentUpdate.commentTableRow.cid);
|
|
@@ -5892,7 +5895,7 @@ async function purgeDisapprovedCommentsOlderThan(community) {
|
|
|
5892
5895
|
const purgedComments = community._dbHandler.purgeDisapprovedCommentsOlderThan(community.settings.purgeDisapprovedCommentsOlderThan);
|
|
5893
5896
|
if (!purgedComments || purgedComments.length === 0) return;
|
|
5894
5897
|
log("Purged disapproved comments", purgedComments, "because retention time has passed and it's time to purge them from DB and pages");
|
|
5895
|
-
for (const purgedComment of purgedComments) for (const purgedCommentAndCommentUpdate of purgedComment.purgedTableRows)
|
|
5898
|
+
for (const purgedComment of purgedComments) for (const purgedCommentAndCommentUpdate of purgedComment.purgedTableRows) addAllCidsUnderPurgedCommentToBeRemoved(community, purgedCommentAndCommentUpdate);
|
|
5896
5899
|
if (community._mfsPathsToRemove.size > 0) await rmUnneededMfsPaths(community);
|
|
5897
5900
|
if (community.updateCid) {
|
|
5898
5901
|
community._blocksToRm.push(community.updateCid);
|
|
@@ -7038,14 +7041,29 @@ async function storeCommentModeration(community, commentModRaw, challengeRequest
|
|
|
7038
7041
|
if (modTableRow.commentModeration.purged) {
|
|
7039
7042
|
log("commentModeration.purged=true, and therefore will delete the post/comment and all its reply tree from the db as well as unpin the cids from ipfs", "comment cid is", modTableRow.commentCid);
|
|
7040
7043
|
if (!community._dbHandler.queryComment(modTableRow.commentCid)) throw Error("Comment to purge not found");
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7044
|
+
community._dbHandler.createTransaction();
|
|
7045
|
+
let purgedTableRows;
|
|
7046
|
+
try {
|
|
7047
|
+
purgedTableRows = community._dbHandler.purgeComment(modTableRow.commentCid);
|
|
7048
|
+
community._dbHandler.insertCommentModerations([modTableRow]);
|
|
7049
|
+
community._dbHandler.commitTransaction();
|
|
7050
|
+
} catch (e) {
|
|
7051
|
+
community._dbHandler.rollbackTransaction();
|
|
7052
|
+
throw e;
|
|
7053
|
+
}
|
|
7054
|
+
for (const purgedTableRow of purgedTableRows) addAllCidsUnderPurgedCommentToBeRemoved(community, purgedTableRow);
|
|
7045
7055
|
if (community.updateCid) {
|
|
7046
7056
|
community._blocksToRm.push(community.updateCid);
|
|
7047
7057
|
community._cidsToUnPin.add(community.updateCid);
|
|
7048
7058
|
}
|
|
7059
|
+
community._communityUpdateTrigger = true;
|
|
7060
|
+
log("Purged comment", modTableRow.commentCid, "and its comment and comment update children", "out of DB and IPFS");
|
|
7061
|
+
try {
|
|
7062
|
+
await rmUnneededMfsPaths(community, { numOfRetries: 0 });
|
|
7063
|
+
} catch (e) {
|
|
7064
|
+
log.error("Failed to remove MFS paths of purged comment", modTableRow.commentCid, "the sync loop will retry", e);
|
|
7065
|
+
}
|
|
7066
|
+
return;
|
|
7049
7067
|
} else if ("approved" in modTableRow.commentModeration) if (modTableRow.commentModeration.approved) {
|
|
7050
7068
|
log("commentModeration.approved=true, and therefore move comment from pending approval and add it to IPFS", "comment cid is", modTableRow.commentCid);
|
|
7051
7069
|
await community._addCommentRowToIPFS(commentToBeEdited, logger_default("pkc-js:local-community:storeCommentModeration:_addCommentRowToIPFS"));
|
|
@@ -7610,6 +7628,7 @@ async function syncIpnsWithDb(community) {
|
|
|
7610
7628
|
await purgeDisapprovedCommentsOlderThan(community);
|
|
7611
7629
|
await syncWithRegistries(community);
|
|
7612
7630
|
const cidsUpdatedInThisCycle = await updateCommentsAndWritePostUpdates(community);
|
|
7631
|
+
if (community._mfsPathsToRemove.size > 0) await rmUnneededMfsPaths(community);
|
|
7613
7632
|
requireCommunityUpdateIfModQueueChanged(community);
|
|
7614
7633
|
await updateCommunityIpnsIfNeeded(community, cidsUpdatedInThisCycle);
|
|
7615
7634
|
await cleanUpIpfsRepoIfDue(community);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as shortifyAddress, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Ct as untrackUpdatingComment, Dt as pTimeout, E as isIpfsCid, Er as FailedToFetchCommentUpdateFromGatewaysError, Et as TimeoutError, Fn as CommentUpdateForChallengeVerificationSchema, Fr as setErrorMap, H as rejectWhenCommunityStopsOrAborts, J as replaceXWithY, Jr as stringifyPrimitive, Kr as joinValues, Kt as version_default, Mr as logger_default, Mt as ChallengeRequestMessageSchema, O as isIpns, Ot as ChallengeAnswerMessageSchema, Pt as ChallengeVerificationMessageSchema, Rn as CommentUpdateSchema, S as hideClassPrivateProps, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256, V as rejectWhenAbortSignalFires, Y as resolveWhenPredicateIsTrue, Z as retryKuboIpfsAdd, _r as r, at as waitForUpdateInCommunityInstanceWithErrorAndTimeout, b as getPostUpdateTimestampRange, bt as trackUpdatingComment, dn as CommunityIpfsSchema, dr as n$1, dt as findUpdatingComment, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, ft as findUpdatingCommunity, gt as refreshTrackedCommentAliases, hr as e$1, ht as listUpdatingCommunities, it as timestamp, jr as messages, l as createAbortError, lr as n$2, mr as e, mt as listUpdatingComments, on as CommunityAnchorSchema, pr as t$1, pt as listStartedCommunities, q as removeUndefinedValuesRecursively, qr as parsedType, rt as throwIfAbortSignalAborted, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, ut as findStartedCommunity, w as ipnsNameToIpnsOverPubsubTopic, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, yn as PubsubTopicSchema } from "./util-
|
|
3
|
-
import { An as verifyCommunityEdit, At as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, B as InflightResourceTypes, Bn as getCommunityAddressFromRecord, Bt as RpcExportCommunityModLogsResultSchema, Cn as verifyChallengeVerification, Cr as t$4, Ct as parseDecryptedChallengeWithPKCErrorIfItFails, D as findCommentInPageInstance, Dn as verifyCommentPubsubMessage, Dr as NAME_RESOLVED_TRUE_TTL_MS, Dt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, E as extractCommunityRuntimeFieldsFromParsedPages, En as verifyCommentModeration, Er as NAME_RESOLVED_FALSE_TTL_MS, Et as parseRpcCommentEventWithPKCErrorIfItFails, Ft as RpcCommentRepliesPageParamSchema, G as decodeRpcChallengePubsubMsg, Gt as RpcPublishAnchorRecordParamSchema, Hn as getCommunityPublicKeyFromWire, Ht as RpcExportCommunityResultSchema, I as stripNameResolvedFromCrosspost, In as normalizeCreatePublicationAuthor, It as RpcCommunityIdentifierParamSchema, Jt as RpcResolveAuthorNameResultSchema, K as decodeRpcChallengeRequestPubsubMsg, Kn as getBufferedPKCAddressFromPublicKey, Kt as RpcPublishChallengeAnswersParamSchema, L as PKCClientsManager, Lt as RpcCommunityPageParamSchema, M as applyNameResolvedCacheToCrosspost, Mn as buildRuntimeAuthor, Mr as require_undici, Mt as RpcAuthorNameParamSchema, N as cloneCrosspostForRuntime, Nn as cleanWireAuthor, Nt as RpcCancelExportParamSchema, O as findCommentInPageInstanceRecursively, On as verifyCommentUpdate, Or as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Ot as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, P as collectCrosspostAuthorsToResolve, Pn as getAuthorNameFromRuntime, Pt as RpcCidParamSchema, Q as parseCidStringSchemaWithPKCErrorIfItFails, Qt as require_lib$1, R as GenericStateClient, Rt as RpcEditCommunityParamSchema, S as RepliesPages, Sr as t$2, St as parseDecryptedChallengeVerification, Tn as verifyCommentIpfs, Tr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Tt as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, U as PKCTypedEmitter, Un as normalizeCommunityInputFromCommunity, Ut as RpcFetchCidParamSchema, Vn as getCommunityNameFromWire, Vt as RpcExportCommunityParamSchema, W as decodeRpcChallengeAnswerPubsubMsg, Wn as decode, Wt as RpcFetchCidResultSchema, Xt as RpcSuccessResultSchema, Yn as getPKCAddressFromPublicKeySync, Yt as RpcSubscriptionIdResultSchema, Zt as RpcUnsubscribeParamSchema, _ as TrackedInstanceRegistry, at as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, br as n$3, bt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, cn as signChallengeAnswer, dr as monitorCommunitiesDirectory, en as createSigner, fn as signComment, ft as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, gr as t$5, hr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, ht as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, in as encryptEd25519AesGcm, it as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, j as parseRawPages, jn as verifyVote, jr as nativeFunctions$2, jt as RpcAnchorPublishPreparationResultSchema, k as findCommentInParsedPages, l as pkcJsPageSorts, mn as signCommentModeration, mr as setNativeFunctions$1, mt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as decryptEd25519AesGcm, nt as parseCommentIpfsSchemaWithPKCErrorIfItFails, ot as parseCommentUpdateSchemaWithPKCErrorIfItFails, p as pkcJsChallenges, pn as signCommentEdit, pt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, q as decodeRpcChallengeVerificationPubsubMsg, qt as RpcPublishedAnchorRecordResultSchema, sn as cleanUpBeforePublishing, sr as getDefaultDataPath, st as parseCommunityAddressWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as createAnchorIpnsRecord$1, tr as createKuboRpcClient, tt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, un as signChallengeRequest, ur as listCommunitiesSync, ut as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, v as LRUCache, vn as signCommunityEdit, vt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, wn as verifyCommentEdit, wt as parseJsonWithPKCErrorIfFails, x as KeyvBetterSqlite3, xn as verifyChallengeMessage, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, y as RemoteCommunity, yn as signVote, yr as t$3, yt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, z as InflightFetchManager, zn as buildRuntimeCommunityFields, zt as RpcExportCommunityModLogsParamSchema } from "./rpc-local-community-
|
|
4
|
-
import { s as getHeliaDebugContext } from "./util-
|
|
2
|
+
import { $ as shortifyAddress, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Ct as untrackUpdatingComment, Dt as pTimeout, E as isIpfsCid, Er as FailedToFetchCommentUpdateFromGatewaysError, Et as TimeoutError, Fn as CommentUpdateForChallengeVerificationSchema, Fr as setErrorMap, H as rejectWhenCommunityStopsOrAborts, J as replaceXWithY, Jr as stringifyPrimitive, Kr as joinValues, Kt as version_default, Mr as logger_default, Mt as ChallengeRequestMessageSchema, O as isIpns, Ot as ChallengeAnswerMessageSchema, Pt as ChallengeVerificationMessageSchema, Rn as CommentUpdateSchema, S as hideClassPrivateProps, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256, V as rejectWhenAbortSignalFires, Y as resolveWhenPredicateIsTrue, Z as retryKuboIpfsAdd, _r as r, at as waitForUpdateInCommunityInstanceWithErrorAndTimeout, b as getPostUpdateTimestampRange, bt as trackUpdatingComment, dn as CommunityIpfsSchema, dr as n$1, dt as findUpdatingComment, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, ft as findUpdatingCommunity, gt as refreshTrackedCommentAliases, hr as e$1, ht as listUpdatingCommunities, it as timestamp, jr as messages, l as createAbortError, lr as n$2, mr as e, mt as listUpdatingComments, on as CommunityAnchorSchema, pr as t$1, pt as listStartedCommunities, q as removeUndefinedValuesRecursively, qr as parsedType, rt as throwIfAbortSignalAborted, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, ut as findStartedCommunity, w as ipnsNameToIpnsOverPubsubTopic, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, yn as PubsubTopicSchema } from "./util-Bm9ef_d5.js";
|
|
3
|
+
import { An as verifyCommunityEdit, At as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, B as InflightResourceTypes, Bn as getCommunityAddressFromRecord, Bt as RpcExportCommunityModLogsResultSchema, Cn as verifyChallengeVerification, Cr as t$4, Ct as parseDecryptedChallengeWithPKCErrorIfItFails, D as findCommentInPageInstance, Dn as verifyCommentPubsubMessage, Dr as NAME_RESOLVED_TRUE_TTL_MS, Dt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, E as extractCommunityRuntimeFieldsFromParsedPages, En as verifyCommentModeration, Er as NAME_RESOLVED_FALSE_TTL_MS, Et as parseRpcCommentEventWithPKCErrorIfItFails, Ft as RpcCommentRepliesPageParamSchema, G as decodeRpcChallengePubsubMsg, Gt as RpcPublishAnchorRecordParamSchema, Hn as getCommunityPublicKeyFromWire, Ht as RpcExportCommunityResultSchema, I as stripNameResolvedFromCrosspost, In as normalizeCreatePublicationAuthor, It as RpcCommunityIdentifierParamSchema, Jt as RpcResolveAuthorNameResultSchema, K as decodeRpcChallengeRequestPubsubMsg, Kn as getBufferedPKCAddressFromPublicKey, Kt as RpcPublishChallengeAnswersParamSchema, L as PKCClientsManager, Lt as RpcCommunityPageParamSchema, M as applyNameResolvedCacheToCrosspost, Mn as buildRuntimeAuthor, Mr as require_undici, Mt as RpcAuthorNameParamSchema, N as cloneCrosspostForRuntime, Nn as cleanWireAuthor, Nt as RpcCancelExportParamSchema, O as findCommentInPageInstanceRecursively, On as verifyCommentUpdate, Or as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Ot as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, P as collectCrosspostAuthorsToResolve, Pn as getAuthorNameFromRuntime, Pt as RpcCidParamSchema, Q as parseCidStringSchemaWithPKCErrorIfItFails, Qt as require_lib$1, R as GenericStateClient, Rt as RpcEditCommunityParamSchema, S as RepliesPages, Sr as t$2, St as parseDecryptedChallengeVerification, Tn as verifyCommentIpfs, Tr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Tt as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, U as PKCTypedEmitter, Un as normalizeCommunityInputFromCommunity, Ut as RpcFetchCidParamSchema, Vn as getCommunityNameFromWire, Vt as RpcExportCommunityParamSchema, W as decodeRpcChallengeAnswerPubsubMsg, Wn as decode, Wt as RpcFetchCidResultSchema, Xt as RpcSuccessResultSchema, Yn as getPKCAddressFromPublicKeySync, Yt as RpcSubscriptionIdResultSchema, Zt as RpcUnsubscribeParamSchema, _ as TrackedInstanceRegistry, at as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, br as n$3, bt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, cn as signChallengeAnswer, dr as monitorCommunitiesDirectory, en as createSigner, fn as signComment, ft as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, gr as t$5, hr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, ht as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, in as encryptEd25519AesGcm, it as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, j as parseRawPages, jn as verifyVote, jr as nativeFunctions$2, jt as RpcAnchorPublishPreparationResultSchema, k as findCommentInParsedPages, l as pkcJsPageSorts, mn as signCommentModeration, mr as setNativeFunctions$1, mt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as decryptEd25519AesGcm, nt as parseCommentIpfsSchemaWithPKCErrorIfItFails, ot as parseCommentUpdateSchemaWithPKCErrorIfItFails, p as pkcJsChallenges, pn as signCommentEdit, pt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, q as decodeRpcChallengeVerificationPubsubMsg, qt as RpcPublishedAnchorRecordResultSchema, sn as cleanUpBeforePublishing, sr as getDefaultDataPath, st as parseCommunityAddressWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as createAnchorIpnsRecord$1, tr as createKuboRpcClient, tt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, un as signChallengeRequest, ur as listCommunitiesSync, ut as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, v as LRUCache, vn as signCommunityEdit, vt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, wn as verifyCommentEdit, wt as parseJsonWithPKCErrorIfFails, x as KeyvBetterSqlite3, xn as verifyChallengeMessage, xt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, y as RemoteCommunity, yn as signVote, yr as t$3, yt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, z as InflightFetchManager, zn as buildRuntimeCommunityFields, zt as RpcExportCommunityModLogsParamSchema } from "./rpc-local-community-7uUa4lxH.js";
|
|
4
|
+
import { s as getHeliaDebugContext } from "./util-BMGkXifx.js";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import fs from "fs";
|
|
@@ -3439,10 +3439,26 @@ const log = logger_default("pkc-js:PKCRpcClient");
|
|
|
3439
3439
|
const WEBSOCKET_READY_STATE_CLOSED = 3;
|
|
3440
3440
|
const DESTROY_SOCKET_CLOSE_TIMEOUT_MS = 5e3;
|
|
3441
3441
|
const scheduleMacrotask = setTimeout.bind(globalThis);
|
|
3442
|
+
function isRpcSubscriptionNotification(message) {
|
|
3443
|
+
if (typeof message !== "object" || message === null || !("params" in message)) return false;
|
|
3444
|
+
const params = message.params;
|
|
3445
|
+
if (typeof params !== "object" || params === null) return false;
|
|
3446
|
+
const { subscription, event } = params;
|
|
3447
|
+
return typeof subscription === "number" && subscription > 0 && typeof event === "string";
|
|
3448
|
+
}
|
|
3442
3449
|
var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
3443
3450
|
constructor(rpcServerUrl) {
|
|
3444
3451
|
super();
|
|
3445
3452
|
this._pendingSubscriptionMsgs = {};
|
|
3453
|
+
this._serverIdByLocalId = /* @__PURE__ */ new Map();
|
|
3454
|
+
this._localIdByServerId = /* @__PURE__ */ new Map();
|
|
3455
|
+
this._resubscribeCalls = /* @__PURE__ */ new Map();
|
|
3456
|
+
this._publishSubscriptionIds = /* @__PURE__ */ new Set();
|
|
3457
|
+
this._hasConnectedBefore = false;
|
|
3458
|
+
this._socketsWithNotificationHandler = /* @__PURE__ */ new WeakSet();
|
|
3459
|
+
this._reconnectBaseIntervalMs = 1e3;
|
|
3460
|
+
this._reconnectMaxIntervalMs = 3e4;
|
|
3461
|
+
this._reconnectIntervalMs = this._reconnectBaseIntervalMs;
|
|
3446
3462
|
assert(rpcServerUrl, "pkc.pkcRpcClientsOptions needs to be defined to create a new rpc client");
|
|
3447
3463
|
this._websocketServerUrl = rpcServerUrl;
|
|
3448
3464
|
this._timeoutSeconds = 20;
|
|
@@ -3475,26 +3491,24 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3475
3491
|
let lastWebsocketError;
|
|
3476
3492
|
if (!(this._webSocketClient instanceof Client)) {
|
|
3477
3493
|
this.setState("connecting");
|
|
3478
|
-
this._webSocketClient = new Client(this._websocketServerUrl
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
const message = JSON.parse(jsonMessage);
|
|
3482
|
-
const subscriptionId = message?.params?.subscription;
|
|
3483
|
-
if (subscriptionId) {
|
|
3484
|
-
this._initSubscriptionEvent(subscriptionId);
|
|
3485
|
-
if (message?.params?.event === "error") {
|
|
3486
|
-
message.params.result = this._deserializeRpcError(message.params.result);
|
|
3487
|
-
delete message.params.result.stack;
|
|
3488
|
-
}
|
|
3489
|
-
if (this._subscriptionEvents[subscriptionId].listenerCount(message?.params?.event) === 0) this._pendingSubscriptionMsgs[subscriptionId].push(message);
|
|
3490
|
-
else this._subscriptionEvents[subscriptionId].emit(message?.params?.event, message);
|
|
3491
|
-
}
|
|
3494
|
+
this._webSocketClient = new Client(this._websocketServerUrl, {
|
|
3495
|
+
reconnect_interval: this._reconnectIntervalMs,
|
|
3496
|
+
max_reconnects: 0
|
|
3492
3497
|
});
|
|
3498
|
+
log("Created a new WebSocket instance with url " + this._websocketServerUrl);
|
|
3499
|
+
this._attachNotificationHandler();
|
|
3493
3500
|
this._webSocketClient.on("open", () => {
|
|
3494
3501
|
log("Connected to RPC server", this._websocketServerUrl);
|
|
3502
|
+
this._attachNotificationHandler();
|
|
3503
|
+
this._reconnectIntervalMs = this._reconnectBaseIntervalMs;
|
|
3504
|
+
this._webSocketClient.setReconnectInterval(this._reconnectIntervalMs);
|
|
3505
|
+
const isReconnect = this._hasConnectedBefore;
|
|
3506
|
+
this._hasConnectedBefore = true;
|
|
3495
3507
|
this.setState("connected");
|
|
3508
|
+
if (isReconnect) this._resubscribeAllAfterReconnect();
|
|
3496
3509
|
});
|
|
3497
3510
|
this._webSocketClient.on("error", (error) => {
|
|
3511
|
+
this._backOffReconnectInterval();
|
|
3498
3512
|
lastWebsocketError = error;
|
|
3499
3513
|
if (this._destroyRequested) {
|
|
3500
3514
|
log("Ignoring websocket error emitted after destroy request", error);
|
|
@@ -3507,12 +3521,17 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3507
3521
|
this.setState("failed");
|
|
3508
3522
|
return;
|
|
3509
3523
|
}
|
|
3510
|
-
|
|
3524
|
+
try {
|
|
3525
|
+
this.emit("error", error);
|
|
3526
|
+
} catch (emitError) {
|
|
3527
|
+
log.error("No listener received the RPC websocket error", this._websocketServerUrl, emitError);
|
|
3528
|
+
}
|
|
3511
3529
|
});
|
|
3512
3530
|
this._webSocketClient.on("close", () => {
|
|
3513
3531
|
if (!this._destroyRequested) log.error("connection with web socket has been closed", this._websocketServerUrl);
|
|
3514
3532
|
this._openConnectionPromise = void 0;
|
|
3515
3533
|
this.setState("stopped");
|
|
3534
|
+
if (!this._destroyRequested) this._failPublicationsLostWithConnection();
|
|
3516
3535
|
});
|
|
3517
3536
|
const originalWebsocketCall = this._webSocketClient.call.bind(this._webSocketClient);
|
|
3518
3537
|
this._webSocketClient.call = async (...args) => {
|
|
@@ -3577,9 +3596,14 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3577
3596
|
log.error("Failed to unsubscribe to subscription ID", subscriptionId, e);
|
|
3578
3597
|
cleanupSubscriptionLocally(subscriptionId);
|
|
3579
3598
|
}
|
|
3599
|
+
this._resubscribeCalls.clear();
|
|
3600
|
+
this._publishSubscriptionIds.clear();
|
|
3601
|
+
this._serverIdByLocalId.clear();
|
|
3602
|
+
this._localIdByServerId.clear();
|
|
3580
3603
|
try {
|
|
3581
3604
|
if (this._webSocketClient instanceof Client) {
|
|
3582
3605
|
this._webSocketClient.setAutoReconnect(false);
|
|
3606
|
+
clearTimeout(this._webSocketClient.reconnect_timer_id);
|
|
3583
3607
|
const socketClosed = this._waitForSocketClose();
|
|
3584
3608
|
this._webSocketClient.close();
|
|
3585
3609
|
await socketClosed;
|
|
@@ -3607,11 +3631,123 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3607
3631
|
else return this._subscriptionEvents[subscriptionId];
|
|
3608
3632
|
}
|
|
3609
3633
|
async unsubscribe(subscriptionId) {
|
|
3610
|
-
|
|
3634
|
+
const liveOnServer = this.state === "connected" && (this._resubscribeCalls.has(subscriptionId) || this._publishSubscriptionIds.has(subscriptionId));
|
|
3635
|
+
const serverSubscriptionId = this._serverIdByLocalId.get(subscriptionId) ?? subscriptionId;
|
|
3636
|
+
this._resubscribeCalls.delete(subscriptionId);
|
|
3637
|
+
this._publishSubscriptionIds.delete(subscriptionId);
|
|
3638
|
+
if (liveOnServer) await this._webSocketClient.call("unsubscribe", [{ subscriptionId: serverSubscriptionId }]);
|
|
3639
|
+
this._serverIdByLocalId.delete(subscriptionId);
|
|
3640
|
+
this._localIdByServerId.delete(serverSubscriptionId);
|
|
3611
3641
|
if (this._subscriptionEvents[subscriptionId]) this._subscriptionEvents[subscriptionId].removeAllListeners();
|
|
3612
3642
|
delete this._subscriptionEvents[subscriptionId];
|
|
3613
3643
|
delete this._pendingSubscriptionMsgs[subscriptionId];
|
|
3614
3644
|
}
|
|
3645
|
+
_attachNotificationHandler() {
|
|
3646
|
+
const socket = this._webSocketClient.socket;
|
|
3647
|
+
if (!socket || this._socketsWithNotificationHandler.has(socket)) return;
|
|
3648
|
+
this._socketsWithNotificationHandler.add(socket);
|
|
3649
|
+
socket.on("message", (jsonMessage) => {
|
|
3650
|
+
const message = JSON.parse(jsonMessage);
|
|
3651
|
+
if (!isRpcSubscriptionNotification(message)) return;
|
|
3652
|
+
const serverSubscriptionId = message.params.subscription;
|
|
3653
|
+
const subscriptionId = this._localIdByServerId.get(serverSubscriptionId) ?? serverSubscriptionId;
|
|
3654
|
+
message.params.subscription = subscriptionId;
|
|
3655
|
+
this._dispatchNotification(subscriptionId, message);
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3658
|
+
_dispatchNotification(subscriptionId, message) {
|
|
3659
|
+
this._initSubscriptionEvent(subscriptionId);
|
|
3660
|
+
if (message.params.event === "error" && !(message.params.result instanceof Error)) {
|
|
3661
|
+
const error = this._deserializeRpcError(message.params.result);
|
|
3662
|
+
delete error.stack;
|
|
3663
|
+
message.params.result = error;
|
|
3664
|
+
}
|
|
3665
|
+
if (this._subscriptionEvents[subscriptionId].listenerCount(message.params.event) === 0) this._pendingSubscriptionMsgs[subscriptionId].push(message);
|
|
3666
|
+
else this._subscriptionEvents[subscriptionId].emit(message.params.event, message);
|
|
3667
|
+
}
|
|
3668
|
+
_backOffReconnectInterval() {
|
|
3669
|
+
if (!(this._webSocketClient instanceof Client)) return;
|
|
3670
|
+
this._reconnectIntervalMs = Math.min(this._reconnectIntervalMs * 2, this._reconnectMaxIntervalMs);
|
|
3671
|
+
this._webSocketClient.setReconnectInterval(this._reconnectIntervalMs);
|
|
3672
|
+
}
|
|
3673
|
+
async _subscribe(method, params, onReconnect, resubscribeMethod = method) {
|
|
3674
|
+
const res = parseRpcSubscriptionIdResult(await this._webSocketClient.call(method, params));
|
|
3675
|
+
this._initSubscriptionEvent(res.subscriptionId);
|
|
3676
|
+
if (onReconnect === "resubscribe") this._resubscribeCalls.set(res.subscriptionId, {
|
|
3677
|
+
method: resubscribeMethod,
|
|
3678
|
+
params
|
|
3679
|
+
});
|
|
3680
|
+
else this._publishSubscriptionIds.add(res.subscriptionId);
|
|
3681
|
+
return res;
|
|
3682
|
+
}
|
|
3683
|
+
_resubscribeAllAfterReconnect() {
|
|
3684
|
+
for (const subscriptionId of [...this._resubscribeCalls.keys()]) this._resubscribe(subscriptionId).catch((error) => {
|
|
3685
|
+
if (this._destroyRequested) return;
|
|
3686
|
+
if (error?.code === "ERR_RPC_COMMUNITY_NOT_RUNNING") {
|
|
3687
|
+
log("Not re-establishing start(), the community was stopped on purpose", subscriptionId);
|
|
3688
|
+
this._resubscribeCalls.delete(subscriptionId);
|
|
3689
|
+
this._dispatchNotification(subscriptionId, { params: {
|
|
3690
|
+
event: "startedstatechange",
|
|
3691
|
+
subscription: subscriptionId,
|
|
3692
|
+
result: { state: "stopped" }
|
|
3693
|
+
} });
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
log.error("Failed to re-subscribe after reconnecting to the RPC server", subscriptionId, error);
|
|
3697
|
+
this._dispatchNotification(subscriptionId, { params: {
|
|
3698
|
+
event: "error",
|
|
3699
|
+
subscription: subscriptionId,
|
|
3700
|
+
result: error
|
|
3701
|
+
} });
|
|
3702
|
+
});
|
|
3703
|
+
}
|
|
3704
|
+
async _resubscribe(subscriptionId) {
|
|
3705
|
+
const call = this._resubscribeCalls.get(subscriptionId);
|
|
3706
|
+
if (!call || this._destroyRequested) return;
|
|
3707
|
+
const { subscriptionId: serverSubscriptionId } = parseRpcSubscriptionIdResult(await this._webSocketClient.call(call.method, call.params));
|
|
3708
|
+
const earlyMessages = serverSubscriptionId === subscriptionId ? [] : this._pendingSubscriptionMsgs[serverSubscriptionId] ?? [];
|
|
3709
|
+
if (serverSubscriptionId !== subscriptionId) {
|
|
3710
|
+
delete this._pendingSubscriptionMsgs[serverSubscriptionId];
|
|
3711
|
+
delete this._subscriptionEvents[serverSubscriptionId];
|
|
3712
|
+
}
|
|
3713
|
+
if (this._resubscribeCalls.get(subscriptionId) !== call || this._destroyRequested) {
|
|
3714
|
+
if (!this._destroyRequested) await this._webSocketClient.call("unsubscribe", [{ subscriptionId: serverSubscriptionId }]).catch((error) => {
|
|
3715
|
+
log.error("Failed to unsubscribe a subscription re-issued after it was unsubscribed", error);
|
|
3716
|
+
});
|
|
3717
|
+
return;
|
|
3718
|
+
}
|
|
3719
|
+
const previousServerSubscriptionId = this._serverIdByLocalId.get(subscriptionId);
|
|
3720
|
+
if (previousServerSubscriptionId !== void 0) this._localIdByServerId.delete(previousServerSubscriptionId);
|
|
3721
|
+
this._serverIdByLocalId.set(subscriptionId, serverSubscriptionId);
|
|
3722
|
+
this._localIdByServerId.set(serverSubscriptionId, subscriptionId);
|
|
3723
|
+
log("Re-subscribed after reconnecting", call.method, {
|
|
3724
|
+
subscriptionId,
|
|
3725
|
+
serverSubscriptionId
|
|
3726
|
+
});
|
|
3727
|
+
for (const message of earlyMessages) {
|
|
3728
|
+
message.params.subscription = subscriptionId;
|
|
3729
|
+
this._dispatchNotification(subscriptionId, message);
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
_failPublicationsLostWithConnection() {
|
|
3733
|
+
for (const subscriptionId of [...this._publishSubscriptionIds]) {
|
|
3734
|
+
this._publishSubscriptionIds.delete(subscriptionId);
|
|
3735
|
+
const error = new PKCError("ERR_RPC_PUBLICATION_LOST_WITH_CONNECTION", {
|
|
3736
|
+
rpcServerUrl: this._websocketServerUrl,
|
|
3737
|
+
publishThrowError: true
|
|
3738
|
+
});
|
|
3739
|
+
this._dispatchNotification(subscriptionId, { params: {
|
|
3740
|
+
event: "publishingstatechange",
|
|
3741
|
+
subscription: subscriptionId,
|
|
3742
|
+
result: { state: "failed" }
|
|
3743
|
+
} });
|
|
3744
|
+
this._dispatchNotification(subscriptionId, { params: {
|
|
3745
|
+
event: "error",
|
|
3746
|
+
subscription: subscriptionId,
|
|
3747
|
+
result: error
|
|
3748
|
+
} });
|
|
3749
|
+
}
|
|
3750
|
+
}
|
|
3615
3751
|
_deserializeRpcError(errorPayload) {
|
|
3616
3752
|
if (!errorPayload || typeof errorPayload !== "object") {
|
|
3617
3753
|
const genericError = /* @__PURE__ */ new Error("Received malformed RPC error payload");
|
|
@@ -3687,7 +3823,7 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3687
3823
|
while (pendingMessages.length > 0) {
|
|
3688
3824
|
if (!shouldDeliver()) return;
|
|
3689
3825
|
const message = pendingMessages.shift();
|
|
3690
|
-
this._subscriptionEvents[subscriptionId].emit(message
|
|
3826
|
+
this._subscriptionEvents[subscriptionId].emit(message.params.event, message);
|
|
3691
3827
|
}
|
|
3692
3828
|
delete this._pendingSubscriptionMsgs[subscriptionId];
|
|
3693
3829
|
}
|
|
@@ -3717,9 +3853,7 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3717
3853
|
}
|
|
3718
3854
|
async startCommunity(communityIdentifier) {
|
|
3719
3855
|
const parsedStartCommunityArgs = parseRpcCommunityIdentifierParam(communityIdentifier);
|
|
3720
|
-
|
|
3721
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3722
|
-
return res;
|
|
3856
|
+
return await this._subscribe("startCommunity", [parsedStartCommunityArgs], "resubscribe", "startedCommunitySubscribe");
|
|
3723
3857
|
}
|
|
3724
3858
|
async stopCommunity(communityIdentifier) {
|
|
3725
3859
|
const parsedStopCommunityArgs = parseRpcCommunityIdentifierParam(communityIdentifier);
|
|
@@ -3747,40 +3881,26 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3747
3881
|
}
|
|
3748
3882
|
async communityUpdateSubscribe(communityIdentifier) {
|
|
3749
3883
|
const parsedCommunityUpdateArgs = parseRpcCommunityIdentifierParam(communityIdentifier);
|
|
3750
|
-
|
|
3751
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3752
|
-
return res;
|
|
3884
|
+
return await this._subscribe("communityUpdateSubscribe", [parsedCommunityUpdateArgs], "resubscribe");
|
|
3753
3885
|
}
|
|
3754
3886
|
async publishComment(commentProps) {
|
|
3755
|
-
|
|
3756
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3757
|
-
return res;
|
|
3887
|
+
return await this._subscribe("publishComment", [commentProps], "fail");
|
|
3758
3888
|
}
|
|
3759
3889
|
async publishCommentEdit(commentEditProps) {
|
|
3760
|
-
|
|
3761
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3762
|
-
return res;
|
|
3890
|
+
return await this._subscribe("publishCommentEdit", [commentEditProps], "fail");
|
|
3763
3891
|
}
|
|
3764
3892
|
async publishCommentModeration(commentModProps) {
|
|
3765
|
-
|
|
3766
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3767
|
-
return res;
|
|
3893
|
+
return await this._subscribe("publishCommentModeration", [commentModProps], "fail");
|
|
3768
3894
|
}
|
|
3769
3895
|
async publishVote(voteProps) {
|
|
3770
|
-
|
|
3771
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3772
|
-
return res;
|
|
3896
|
+
return await this._subscribe("publishVote", [voteProps], "fail");
|
|
3773
3897
|
}
|
|
3774
3898
|
async publishCommunityEdit(communityEdit) {
|
|
3775
|
-
|
|
3776
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3777
|
-
return res;
|
|
3899
|
+
return await this._subscribe("publishCommunityEdit", [communityEdit], "fail");
|
|
3778
3900
|
}
|
|
3779
3901
|
async commentUpdateSubscribe(args) {
|
|
3780
3902
|
const parsedCommentUpdateArgs = parseRpcCidParam(args);
|
|
3781
|
-
|
|
3782
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3783
|
-
return res;
|
|
3903
|
+
return await this._subscribe("commentUpdateSubscribe", [parsedCommentUpdateArgs], "resubscribe");
|
|
3784
3904
|
}
|
|
3785
3905
|
async publishChallengeAnswers(args) {
|
|
3786
3906
|
return parseRpcSuccessResult(await this._webSocketClient.call("publishChallengeAnswers", [args]));
|
|
@@ -3790,16 +3910,14 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3790
3910
|
return parseRpcResolveAuthorNameResult(await this._webSocketClient.call("resolveAuthorName", [resolveAuthorNameArgs]));
|
|
3791
3911
|
}
|
|
3792
3912
|
async initalizeCommunitieschangeEvent() {
|
|
3793
|
-
const { subscriptionId } =
|
|
3794
|
-
this._initSubscriptionEvent(subscriptionId);
|
|
3913
|
+
const { subscriptionId } = await this._subscribe("communitiesSubscribe", [], "resubscribe");
|
|
3795
3914
|
this.getSubscription(subscriptionId).on("communitieschange", (res) => {
|
|
3796
3915
|
this.emit("communitieschange", res.params.result.communities);
|
|
3797
3916
|
});
|
|
3798
3917
|
this.emitAllPendingMessages(subscriptionId);
|
|
3799
3918
|
}
|
|
3800
3919
|
async initalizeSettingschangeEvent() {
|
|
3801
|
-
const { subscriptionId } =
|
|
3802
|
-
this._initSubscriptionEvent(subscriptionId);
|
|
3920
|
+
const { subscriptionId } = await this._subscribe("settingsSubscribe", [], "resubscribe");
|
|
3803
3921
|
this.getSubscription(subscriptionId).on("settingschange", (res) => {
|
|
3804
3922
|
this.emit("settingschange", res.params.result);
|
|
3805
3923
|
});
|
|
@@ -3830,9 +3948,7 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3830
3948
|
}
|
|
3831
3949
|
async exportsSubscribe(args) {
|
|
3832
3950
|
const parsedArgs = parseRpcCommunityIdentifierParam(args);
|
|
3833
|
-
|
|
3834
|
-
this._initSubscriptionEvent(res.subscriptionId);
|
|
3835
|
-
return res;
|
|
3951
|
+
return await this._subscribe("exportsSubscribe", [parsedArgs], "resubscribe");
|
|
3836
3952
|
}
|
|
3837
3953
|
async cancelExport(args) {
|
|
3838
3954
|
const parsedArgs = parseRpcCancelExportParam(args);
|
|
@@ -8254,7 +8370,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8254
8370
|
this.clients.libp2pJsClients = {};
|
|
8255
8371
|
if (!this.libp2pJsClientsOptions) return;
|
|
8256
8372
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
8257
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
8373
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-DuG274FA.js");
|
|
8258
8374
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
8259
8375
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
8260
8376
|
...clientOptions,
|
|
@@ -8533,7 +8649,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8533
8649
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
8534
8650
|
log.trace("Received community options to create a local community instance:", options);
|
|
8535
8651
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
8536
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
8652
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-BsALoql_.js");
|
|
8537
8653
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
8538
8654
|
const community = new LocalCommunity(this);
|
|
8539
8655
|
if (isLocalCommunity) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as getEquivalentCommunityAddresses, vn as PageSortFileSchema } from "./util-
|
|
1
|
+
import { _ as getEquivalentCommunityAddresses, vn as PageSortFileSchema } from "./util-Bm9ef_d5.js";
|
|
2
2
|
//#region dist/node/pages/page-sort-scoring.js
|
|
3
3
|
function validatePageSortFile(rawFile) {
|
|
4
4
|
const validated = PageSortFileSchema.parse(rawFile);
|
package/dist/bundled/chunks/{rpc-local-community-D5ZdqFYc.js → rpc-local-community-7uUa4lxH.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as shortifyAddress, $n as CreateCommentEditOptionsWithRefinementSchema, $t as CommentModerationPubsubMessagePublicationSchema, An as CommentIpfsSchema, Ar as PKCError, B as raceAgainstAbort, Br as literal, Bt as DecryptedChallengeVerificationSchema, C as interruptibleSleep, Cn as VoteChallengeRequestToEncryptSchema, Cr as e$4, D as isIpfsPath, Dr as FailedToFetchCommunityFromGatewaysError, Dt as pTimeout, E as isIpfsCid, En as VoteSignedPropertyNames, Er as FailedToFetchCommentUpdateFromGatewaysError, Ft as ChallengeVerificationMessageSignedPropertyNames, G as removeNullUndefinedEmptyObjectsValuesRecursively, Gn as PageIpfsSchema, Gt as PKCUserOptionsSchema, Hn as CreateCommentOptionsWithRefinementSchema, Hr as object, Ht as NameResolverSerializedSchema, I as isRequestPubsubPublicationOfPost, In as CommentUpdateForChallengeVerificationSignedPropertyNames, Ir as _enum, It as DecryptedChallengeAnswerSchema, Kn as isReservedObjectKey, L as isRequestPubsubPublicationOfReply, Ln as CommentUpdateReservedFields, Lr as array, Mn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Mr as logger_default, Nn as CommentSignedPropertyNames, Nr as require_supports_color, Nt as ChallengeRequestMessageSignedPropertyNames, O as isIpns, On as CommentChallengeRequestToEncryptSchema, Or as FailedToFetchGenericIpfsFromGatewaysError, Pn as CommentUpdateChallengeReservedFieldNames, Pr as require_ms$1, Qt as CommentModerationChallengeRequestToEncryptSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rr as boolean, S as hideClassPrivateProps, Sn as CreateVoteUserOptionsWithRefinementSchema, Sr as t$9, St as untrackStartedCommunity, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256$1, Un as GetPageParamSchema, Ur as record, Ut as PKCParsedOptionsSchema, Vr as number, Vt as NameResolveCacheOptionsSchema, Wn as ModQueuePageIpfsSchema, Wr as string, Wt as PKCUserOptionBaseSchema, Xt as CommunityEditPubsubMessagePublicationSchema, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Yt as CommunityEditPublicationSignedPropertyNames, Zn as CommentEditSignedPropertyNames, Zt as CreateCommunityEditPublicationOptionsWithRefinementSchema, _n as PageSortFileFactorySchema, _r as r$8, _t as refreshTrackedCommunityAliases, an as ChallengeFileSchema, ar as CidStringSchema, bn as RpcRemoteCommunityUpdateEventResultSchema, br as r$7, cn as CommunityEditOptionsSchema, cr as CreateSignerSchema, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$10, er as AuthorAddressSchema, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, ft as findUpdatingCommunity, gn as ExportCommunityModLogsOptionsSchema, gr as t$11, hn as CreateRpcCommunityFunctionArgumentSchema, hr as e$5, in as ChallengeFileFactorySchema, ir as CidPathSchema, it as timestamp, jr as messages, jt as ChallengeMessageSignedPropertyNames, k as isIpnsPath, kn as CommentIpfsReservedFields, kr as FailedToFetchPageIpfsFromGatewaysError, kt as ChallengeAnswerMessageSignedPropertyNames, l as createAbortError, ln as CommunityExportRecordsSchema, lr as n$9, m as fetchAndValidateIpnsRecordFromGateway, mn as CreateRemoteCommunityFunctionArgumentSchema, mr as e$6, nn as CommentModerationsTableRowSchema, or as CommunityAddressSchema, p as extractNetworkErrorDetails, pn as CreateNewLocalCommunityUserOptionsSchema, pr as t$13, qn as CommentEditChallengeRequestToEncryptSchema, qt as CommunityEditPublicationChallengeRequestToEncryptSchema, r as calculateIpfsCidV0, rn as CreateCommentModerationOptionsWithRefinementSchema, rr as ChallengeAnswersSchema, rt as throwIfAbortSignalAborted, sn as CommunityChallengeSettingSchema, sr as CommunityAuthorChallengeReservedFieldNames, t as areEquivalentCommunityAddresses, tn as CommentModerationSignedPropertyNames, tr as AuthorCommentIpfsReservedFields, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, un as CommunityIpfsReservedFields, ut as findStartedCommunity, vn as PageSortFileSchema, vr as t$12, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry$1, wt as untrackUpdatingCommunity, x as hasTransientNetworkErrorCode, xn as isStringDomain, xr as t$10, xt as trackUpdatingCommunity, yr as n$8, yt as trackStartedCommunity, zn as CommentUpdateSignedPropertyNames, zr as custom, zt as DecryptedChallengeSchema } from "./util-
|
|
2
|
+
import { $ as shortifyAddress, $n as CreateCommentEditOptionsWithRefinementSchema, $t as CommentModerationPubsubMessagePublicationSchema, An as CommentIpfsSchema, Ar as PKCError, B as raceAgainstAbort, Br as literal, Bt as DecryptedChallengeVerificationSchema, C as interruptibleSleep, Cn as VoteChallengeRequestToEncryptSchema, Cr as e$4, D as isIpfsPath, Dr as FailedToFetchCommunityFromGatewaysError, Dt as pTimeout, E as isIpfsCid, En as VoteSignedPropertyNames, Er as FailedToFetchCommentUpdateFromGatewaysError, Ft as ChallengeVerificationMessageSignedPropertyNames, G as removeNullUndefinedEmptyObjectsValuesRecursively, Gn as PageIpfsSchema, Gt as PKCUserOptionsSchema, Hn as CreateCommentOptionsWithRefinementSchema, Hr as object, Ht as NameResolverSerializedSchema, I as isRequestPubsubPublicationOfPost, In as CommentUpdateForChallengeVerificationSignedPropertyNames, Ir as _enum, It as DecryptedChallengeAnswerSchema, Kn as isReservedObjectKey, L as isRequestPubsubPublicationOfReply, Ln as CommentUpdateReservedFields, Lr as array, Mn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Mr as logger_default, Nn as CommentSignedPropertyNames, Nr as require_supports_color, Nt as ChallengeRequestMessageSignedPropertyNames, O as isIpns, On as CommentChallengeRequestToEncryptSchema, Or as FailedToFetchGenericIpfsFromGatewaysError, Pn as CommentUpdateChallengeReservedFieldNames, Pr as require_ms$1, Qt as CommentModerationChallengeRequestToEncryptSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rr as boolean, S as hideClassPrivateProps, Sn as CreateVoteUserOptionsWithRefinementSchema, Sr as t$9, St as untrackStartedCommunity, T as isAbortError, Tr as FailedToFetchCommentIpfsFromGatewaysError, Tt as require_sha256$1, Un as GetPageParamSchema, Ur as record, Ut as PKCParsedOptionsSchema, Vr as number, Vt as NameResolveCacheOptionsSchema, Wn as ModQueuePageIpfsSchema, Wr as string, Wt as PKCUserOptionBaseSchema, Xt as CommunityEditPubsubMessagePublicationSchema, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Yt as CommunityEditPublicationSignedPropertyNames, Zn as CommentEditSignedPropertyNames, Zt as CreateCommunityEditPublicationOptionsWithRefinementSchema, _n as PageSortFileFactorySchema, _r as r$8, _t as refreshTrackedCommunityAliases, an as ChallengeFileSchema, ar as CidStringSchema, bn as RpcRemoteCommunityUpdateEventResultSchema, br as r$7, cn as CommunityEditOptionsSchema, cr as CreateSignerSchema, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$10, er as AuthorAddressSchema, et as shortifyCid, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, ft as findUpdatingCommunity, gn as ExportCommunityModLogsOptionsSchema, gr as t$11, hn as CreateRpcCommunityFunctionArgumentSchema, hr as e$5, in as ChallengeFileFactorySchema, ir as CidPathSchema, it as timestamp, jr as messages, jt as ChallengeMessageSignedPropertyNames, k as isIpnsPath, kn as CommentIpfsReservedFields, kr as FailedToFetchPageIpfsFromGatewaysError, kt as ChallengeAnswerMessageSignedPropertyNames, l as createAbortError, ln as CommunityExportRecordsSchema, lr as n$9, m as fetchAndValidateIpnsRecordFromGateway, mn as CreateRemoteCommunityFunctionArgumentSchema, mr as e$6, nn as CommentModerationsTableRowSchema, or as CommunityAddressSchema, p as extractNetworkErrorDetails, pn as CreateNewLocalCommunityUserOptionsSchema, pr as t$13, qn as CommentEditChallengeRequestToEncryptSchema, qt as CommunityEditPublicationChallengeRequestToEncryptSchema, r as calculateIpfsCidV0, rn as CreateCommentModerationOptionsWithRefinementSchema, rr as ChallengeAnswersSchema, rt as throwIfAbortSignalAborted, sn as CommunityChallengeSettingSchema, sr as CommunityAuthorChallengeReservedFieldNames, t as areEquivalentCommunityAddresses, tn as CommentModerationSignedPropertyNames, tr as AuthorCommentIpfsReservedFields, tt as sleepUntilTimeoutOrAbort, u as deepMergeRuntimeFields, un as CommunityIpfsReservedFields, ut as findStartedCommunity, vn as PageSortFileSchema, vr as t$12, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry$1, wt as untrackUpdatingCommunity, x as hasTransientNetworkErrorCode, xn as isStringDomain, xr as t$10, xt as trackUpdatingCommunity, yr as n$8, yt as trackStartedCommunity, zn as CommentUpdateSignedPropertyNames, zr as custom, zt as DecryptedChallengeSchema } from "./util-Bm9ef_d5.js";
|
|
3
3
|
import { t as all } from "./src-CYIMjhjK.js";
|
|
4
|
-
import { s as validatePageSortFile } from "./page-sort-scoring-
|
|
4
|
+
import { s as validatePageSortFile } from "./page-sort-scoring-Cd97obb3.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import dns from "node:dns";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ar as PKCError, z as pubsubTopicToDhtKeyCid } from "./util-
|
|
1
|
+
import { Ar as PKCError, z as pubsubTopicToDhtKeyCid } from "./util-Bm9ef_d5.js";
|
|
2
2
|
import { ipnsSelector } from "ipns/selector";
|
|
3
3
|
import { ipnsValidator } from "ipns/validator";
|
|
4
4
|
import { unmarshalIPNSRecord } from "ipns";
|
|
@@ -5553,11 +5553,13 @@ var messages;
|
|
|
5553
5553
|
messages["ERR_FAILED_TO_OPEN_CONNECTION_TO_RPC"] = "Failed to open connection to RPC";
|
|
5554
5554
|
messages["ERR_FAILED_TO_CREATE_WS_RPC_SERVER"] = "Failed to create WebSocket RPC server";
|
|
5555
5555
|
messages["ERR_RPC_CLIENT_ATTEMPTING_TO_START_A_REMOTE_COMMUNITY"] = "Attempting to start a community that is not local";
|
|
5556
|
+
messages["ERR_RPC_COMMUNITY_NOT_RUNNING"] = "The community is not running on the PKC RPC server and was stopped on purpose, so the RPC client did not start it again after reconnecting";
|
|
5556
5557
|
messages["ERR_RPC_CLIENT_TRYING_TO_STOP_COMMUNITY_THAT_IS_NOT_RUNNING"] = "RPC client is attempting to stop a local community that is not running";
|
|
5557
5558
|
messages["ERR_RPC_CLIENT_TRYING_TO_STOP_REMOTE_COMMUNITY"] = "RPC client is attempting to stop a remote community";
|
|
5558
5559
|
messages["ERR_RPC_CLIENT_TRYING_TO_EDIT_REMOTE_COMMUNITY"] = "RPC client is attempting to edit remote community";
|
|
5559
5560
|
messages["ERR_RPC_CLIENT_TRYING_TO_DELETE_REMOTE_COMMUNITY"] = "RPC client is attempting to delete remote community";
|
|
5560
5561
|
messages["ERR_RPC_CLIENT_TRYING_TO_USE_ANCHOR_METHOD_ON_NON_LOCAL_COMMUNITY"] = "RPC client is attempting to prepare or publish an anchor record for a community this node does not host locally";
|
|
5562
|
+
messages["ERR_RPC_PUBLICATION_LOST_WITH_CONNECTION"] = "The connection to the PKC RPC server closed while the publication was in flight. The server stopped the publication, so publish it again";
|
|
5561
5563
|
messages["ERR_RPC_CLIENT_NO_ACTIVE_PUBLISH_SUBSCRIPTION"] = "Cannot publish challenge answers over PKC RPC: there is no active publish subscription. The challenge exchange has concluded, the publication was stopped, or publish() was never called";
|
|
5562
5564
|
messages["ERR_GENERIC_RPC_CLIENT_CALL_ERROR"] = "RPC client received an unknown error when executing call over websocket";
|
|
5563
5565
|
messages["ERR_RPC_CALL_TIMED_OUT"] = "RPC client call timed out without receiving a response from the RPC server";
|
|
@@ -14797,7 +14799,7 @@ const CommunityEditPublicationPubsubReservedFields = r$2([
|
|
|
14797
14799
|
], t$3(CommunityEditPubsubMessagePublicationSchema.shape));
|
|
14798
14800
|
//#endregion
|
|
14799
14801
|
//#region dist/node/generated-version.js
|
|
14800
|
-
const version = "0.0.
|
|
14802
|
+
const version = "0.0.117";
|
|
14801
14803
|
//#endregion
|
|
14802
14804
|
//#region dist/node/version.js
|
|
14803
14805
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ar as PKCError, _n as PageSortFileFactorySchema, an as ChallengeFileSchema, in as ChallengeFileFactorySchema } from "./util-
|
|
2
|
-
import { s as validatePageSortFile } from "./page-sort-scoring-
|
|
1
|
+
import { Ar as PKCError, _n as PageSortFileFactorySchema, an as ChallengeFileSchema, in as ChallengeFileFactorySchema } from "./util-Bm9ef_d5.js";
|
|
2
|
+
import { s as validatePageSortFile } from "./page-sort-scoring-Cd97obb3.js";
|
|
3
3
|
//#region dist/node/validate-package-factories.js
|
|
4
4
|
function validateChallengeFileFactory(factory, { name }) {
|
|
5
5
|
try {
|
package/dist/bundled/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getShortCid, c as setNativeFunctions, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as pageSorts, t as PKC } from "./chunks/node-
|
|
1
|
+
import { a as getShortCid, c as setNativeFunctions, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as pageSorts, t as PKC } from "./chunks/node-DkNDHK6w.js";
|
|
2
2
|
export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, pageSorts, setNativeFunctions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as validatePageSortFileFactory } from "./chunks/validate-package-factories-
|
|
1
|
+
import { n as validatePageSortFileFactory } from "./chunks/validate-package-factories-DHupf8eD.js";
|
|
2
2
|
export { validatePageSortFileFactory };
|