@pkcprotocol/pkc-js 0.0.134 → 0.0.135
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/README.md +19 -0
- package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +12 -0
- package/dist/browser/clients/rpc-client/pkc-rpc-client.js +138 -37
- 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/bundled/bundle-manifest.json +34 -34
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc-CcFjdSPv.js → helia-for-pkc-DldRnBHX.js} +33 -33
- package/dist/bundled/chunks/{local-community-BDHE3v_Y.js → local-community-9i6vs_-P.js} +1 -1
- package/dist/bundled/chunks/{local-community-GYjtDIwZ.js → local-community-BjljrKks.js} +32 -32
- package/dist/bundled/chunks/{node-Cqt8DEE-.js → node-BNoBGxyk.js} +117 -38
- package/dist/bundled/chunks/{page-sort-scoring-BXVdZf57.js → page-sort-scoring-BCqpbgnJ.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-CDsOv_s2.js → rpc-local-community-CuL4H_vR.js} +2 -2
- package/dist/bundled/chunks/{util-B-VRroTI.js → util-D104b59J.js} +1 -1
- package/dist/bundled/chunks/{util-B5FM8shT.js → util-TZLcBbZd.js} +3 -1
- package/dist/bundled/chunks/{validate-package-factories-a2ZVHdRd.js → validate-package-factories-DGlKaHzi.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 +4 -4
- package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +12 -0
- package/dist/node/clients/rpc-client/pkc-rpc-client.js +138 -37
- 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/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as __toESM } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as retryKuboIpfsAddAndProvide, $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, W as removeBlocksFromKuboNode, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-
|
|
3
|
-
import { $ as createSchemaRowParser, An as verifyChallengeAnswer, Bn as verifyCommunityEdit, Br as t$8, Cr as getThumbnailPropsOfLink, Dr as moveCommunityDbToDeletedDirectory, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Fr as isCommunityStartLocked, Gr as stringify, Hn as verifyVote, Hr as n$4, In as verifyCommentModeration, Ir as require_src, Kn as getAuthorNameFromWire, Ln as verifyCommentPubsubMessage, Lr as t$10, Mn as verifyChallengeRequest, Mr as findCommunitiesEntry, N as MAX_PAGE_SIZE_BYTES, Or as refreshCommunitiesList, Pn as verifyCommentEdit, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Rn as verifyCommentUpdate, Rr as t$11, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Tn as signCommentUpdateForChallengeVerification, Un as buildRuntimeAuthor, Vr as n$5, W as pLimit, Wn as cleanWireAuthor, Wr as t$9, X as coerceSchemaRowBoolean, Xr as STORAGE_KEYS, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, Zr as require_lodash_merge, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, kr as resolveDbPostsCidRefs, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as importSignerIntoKuboNode, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as getDefaultCommunityDbConfig, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as r$2 } 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 { $ as retryKuboIpfsAddAndProvide, $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, W as removeBlocksFromKuboNode, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-TZLcBbZd.js";
|
|
3
|
+
import { $ as createSchemaRowParser, An as verifyChallengeAnswer, Bn as verifyCommunityEdit, Br as t$8, Cr as getThumbnailPropsOfLink, Dr as moveCommunityDbToDeletedDirectory, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Fr as isCommunityStartLocked, Gr as stringify, Hn as verifyVote, Hr as n$4, In as verifyCommentModeration, Ir as require_src, Kn as getAuthorNameFromWire, Ln as verifyCommentPubsubMessage, Lr as t$10, Mn as verifyChallengeRequest, Mr as findCommunitiesEntry, N as MAX_PAGE_SIZE_BYTES, Or as refreshCommunitiesList, Pn as verifyCommentEdit, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Rn as verifyCommentUpdate, Rr as t$11, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Tn as signCommentUpdateForChallengeVerification, Un as buildRuntimeAuthor, Vr as n$5, W as pLimit, Wn as cleanWireAuthor, Wr as t$9, X as coerceSchemaRowBoolean, Xr as STORAGE_KEYS, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, Zr as require_lodash_merge, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, kr as resolveDbPostsCidRefs, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as importSignerIntoKuboNode, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as getDefaultCommunityDbConfig, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as r$2 } from "./rpc-local-community-CuL4H_vR.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-BCqpbgnJ.js";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
-
import
|
|
6
|
+
import Path from "node:path";
|
|
7
7
|
import os from "os";
|
|
8
8
|
import fs, { existsSync, promises } from "node:fs";
|
|
9
|
-
import path
|
|
9
|
+
import path from "path";
|
|
10
10
|
import assert from "assert";
|
|
11
11
|
import { Buffer as Buffer$1 } from "buffer";
|
|
12
12
|
import fs$1 from "fs";
|
|
@@ -315,15 +315,15 @@ async function throwIfChallengeSettingsAreInvalid({ challengeSettings, pkc, comm
|
|
|
315
315
|
const processStartedCommunities = new TrackedInstanceRegistry();
|
|
316
316
|
function normalizeRegistryDataPath(dataPath) {
|
|
317
317
|
if (dataPath === void 0) return void 0;
|
|
318
|
-
const resolved = path
|
|
318
|
+
const resolved = path.resolve(dataPath);
|
|
319
319
|
let existing = resolved;
|
|
320
320
|
let tail = "";
|
|
321
321
|
while (true) try {
|
|
322
|
-
return path
|
|
322
|
+
return path.join(fs$1.realpathSync.native(existing), tail);
|
|
323
323
|
} catch {
|
|
324
|
-
const parent = path
|
|
324
|
+
const parent = path.dirname(existing);
|
|
325
325
|
if (parent === existing) return resolved;
|
|
326
|
-
tail = path
|
|
326
|
+
tail = path.join(path.basename(existing), tail);
|
|
327
327
|
existing = parent;
|
|
328
328
|
}
|
|
329
329
|
}
|
|
@@ -1707,9 +1707,9 @@ var DbHandler = class {
|
|
|
1707
1707
|
if (needToMigrate) {
|
|
1708
1708
|
if (dbExistsAlready && currentDbVersion > 0) {
|
|
1709
1709
|
this.destoryConnection();
|
|
1710
|
-
backupDbPath = path
|
|
1711
|
-
log(`Copying db ${path
|
|
1712
|
-
if (!fs$1.existsSync(path
|
|
1710
|
+
backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
1711
|
+
log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
1712
|
+
if (!fs$1.existsSync(path.dirname(backupDbPath))) await fs$1.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
|
|
1713
1713
|
const sourceDb = new Database(dbPath, { fileMustExist: true });
|
|
1714
1714
|
await sourceDb.backup(backupDbPath);
|
|
1715
1715
|
sourceDb.close();
|
|
@@ -3760,10 +3760,10 @@ var DbHandler = class {
|
|
|
3760
3760
|
if (this._db || this._keyv) await this.destoryConnection();
|
|
3761
3761
|
this._transactionDepth = 0;
|
|
3762
3762
|
const dataPath = this._community._pkc.dataPath;
|
|
3763
|
-
const oldPathString = path
|
|
3764
|
-
const newPathString = path
|
|
3765
|
-
await fs$1.promises.mkdir(path
|
|
3766
|
-
await fs$1.promises.mkdir(path
|
|
3763
|
+
const oldPathString = path.join(dataPath, "communities", oldDbName);
|
|
3764
|
+
const newPathString = path.join(dataPath, "communities", newDbName);
|
|
3765
|
+
await fs$1.promises.mkdir(path.dirname(oldPathString), { recursive: true });
|
|
3766
|
+
await fs$1.promises.mkdir(path.dirname(newPathString), { recursive: true });
|
|
3767
3767
|
try {
|
|
3768
3768
|
if (!fs$1.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
|
|
3769
3769
|
else {
|
|
@@ -3785,8 +3785,8 @@ var DbHandler = class {
|
|
|
3785
3785
|
}
|
|
3786
3786
|
async lockCommunityStart(communityAddress = this._community.address) {
|
|
3787
3787
|
const log = logger_default("pkc-js:local-community:db-handler:lock:start");
|
|
3788
|
-
const lockfilePath = path
|
|
3789
|
-
const communityDbPath = path
|
|
3788
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3789
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3790
3790
|
try {
|
|
3791
3791
|
await import_src.default.lock(communityDbPath, {
|
|
3792
3792
|
lockfilePath,
|
|
@@ -3807,8 +3807,8 @@ var DbHandler = class {
|
|
|
3807
3807
|
async unlockCommunityStart(communityAddress = this._community.address) {
|
|
3808
3808
|
const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
|
|
3809
3809
|
log.trace(`Attempting to unlock the start of community (${communityAddress})`);
|
|
3810
|
-
const lockfilePath = path
|
|
3811
|
-
const communityDbPath = path
|
|
3810
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3811
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3812
3812
|
if (!fs$1.existsSync(lockfilePath) || !fs$1.existsSync(communityDbPath)) return;
|
|
3813
3813
|
try {
|
|
3814
3814
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -3826,8 +3826,8 @@ var DbHandler = class {
|
|
|
3826
3826
|
}
|
|
3827
3827
|
async lockCommunityState() {
|
|
3828
3828
|
const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
|
|
3829
|
-
const lockfilePath = path
|
|
3830
|
-
const communityDbPath = path
|
|
3829
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3830
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3831
3831
|
try {
|
|
3832
3832
|
await import_src.default.lock(communityDbPath, {
|
|
3833
3833
|
lockfilePath,
|
|
@@ -3844,8 +3844,8 @@ var DbHandler = class {
|
|
|
3844
3844
|
}
|
|
3845
3845
|
async unlockCommunityState() {
|
|
3846
3846
|
const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
|
|
3847
|
-
const lockfilePath = path
|
|
3848
|
-
const communityDbPath = path
|
|
3847
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3848
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3849
3849
|
if (!fs$1.existsSync(lockfilePath)) return;
|
|
3850
3850
|
try {
|
|
3851
3851
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -3855,7 +3855,7 @@ var DbHandler = class {
|
|
|
3855
3855
|
}
|
|
3856
3856
|
}
|
|
3857
3857
|
communityDbExists() {
|
|
3858
|
-
const communityDbPath = path
|
|
3858
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3859
3859
|
return fs$1.existsSync(communityDbPath);
|
|
3860
3860
|
}
|
|
3861
3861
|
markCommentsAsPublishedToPostUpdates(commentCids) {
|
|
@@ -6868,10 +6868,10 @@ async function restoreCommunityAfterFailedRename({ community, oldAddress, newAdd
|
|
|
6868
6868
|
}
|
|
6869
6869
|
}
|
|
6870
6870
|
async function removePartialDbCopy({ community, oldAddress, newAddress, log }) {
|
|
6871
|
-
const communitiesPath =
|
|
6872
|
-
if (!fs.existsSync(
|
|
6871
|
+
const communitiesPath = Path.join(community._pkc.dataPath, "communities");
|
|
6872
|
+
if (!fs.existsSync(Path.join(communitiesPath, oldAddress))) return;
|
|
6873
6873
|
try {
|
|
6874
|
-
await fs.promises.rm(
|
|
6874
|
+
await fs.promises.rm(Path.join(communitiesPath, newAddress), { force: true });
|
|
6875
6875
|
} catch (e) {
|
|
6876
6876
|
log.error(`Failed to remove the partial DB copy of community (${oldAddress}) at ${newAddress}`, e);
|
|
6877
6877
|
}
|
|
@@ -7015,11 +7015,11 @@ async function edit(community, newCommunityOptions) {
|
|
|
7015
7015
|
const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
|
|
7016
7016
|
function defaultExportPathFor(community, exportId) {
|
|
7017
7017
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7018
|
-
return
|
|
7018
|
+
return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
|
|
7019
7019
|
}
|
|
7020
7020
|
function sourceDbPathFor(community) {
|
|
7021
7021
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7022
|
-
return
|
|
7022
|
+
return Path.join(community._pkc.dataPath, "communities", community.address);
|
|
7023
7023
|
}
|
|
7024
7024
|
async function persistExports(community) {
|
|
7025
7025
|
if (!community._dbHandler) return;
|
|
@@ -7095,9 +7095,9 @@ async function runExportTask(community, exportId, opts) {
|
|
|
7095
7095
|
async function exportCommunityEmbedded(community, options = {}) {
|
|
7096
7096
|
if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
7097
7097
|
const exportId = v4();
|
|
7098
|
-
const destPath = options.exportPath ?
|
|
7098
|
+
const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
|
|
7099
7099
|
const includePrivateKey = options.includePrivateKey === true;
|
|
7100
|
-
if (
|
|
7100
|
+
if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
|
|
7101
7101
|
communityAddress: community.address,
|
|
7102
7102
|
exportPath: destPath
|
|
7103
7103
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as retryKuboIpfsAddAndProvide, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, H as rejectWhenAbortSignalFires, Hr as setErrorMap, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, J as removeUndefinedValuesRecursively, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Q as retryKuboIpfsAdd, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenCommunityStopsOrAborts, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, hr as isStringDomain, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$1, k as isIpns, kt as pTimeout, ni as en_default, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, tt as shortifyCid, u as createAbortError, vr as n$1, vt as refreshTrackedCommentAliases, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, zn as CommentUpdateSchema, zr as logger_default } from "./util-
|
|
3
|
-
import { $n as buildRuntimeCommunityFields, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, Ar as setNativeFunctions$1, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Br as t$3, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dt as parseJsonWithPKCErrorIfFails, Er as monitorCommunitiesDirectory, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as NAME_RESOLVED_TRUE_TTL_MS, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lr as t$5, Lt as RpcCidParamSchema, M as parseRawPages, Mr as findCommunitiesEntry, Nn as verifyChallengeVerification, Nr as toCommunitiesEntry, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pt as RpcAnchorPublishPreparationResultSchema, Qr as nativeFunctions$2, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, Sr as getDefaultDataPath, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tr as listCommunitiesSync, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as t$2, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vr as n$3, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wr as t$4, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Yt as RpcFetchCommunityListParamSchema, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, en as RpcPublishCommunityListResultSchema, er as getCommunityAddressFromRecord, et as parseCidStringSchemaWithPKCErrorIfItFails, ft as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, gn as cleanUpBeforePublishing, gt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, hr as createKuboRpcClient, ht as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, in as RpcSuccessResultSchema, ir as decode, it as parseCommentIpfsSchemaWithPKCErrorIfItFails, jn as verifyChallengeMessage, jr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kn as signVote, kt as parseRpcCommentEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as createSigner, lr as getPKCAddressFromPublicKeySync, lt as parseCommunityAddressWithPKCErrorIfItFails, m as pkcJsChallenges, mt as parseCommunityListSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcResolveAuthorNameResultSchema, nr as getCommunityPublicKeyFromWire, on as findCommunityRecordNameMismatch, or as getBufferedPKCAddressFromPublicKey, ot as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, pn as encryptEd25519AesGcm, q as decodeRpcChallengePubsubMsg, qn as normalizeCreatePublicationAuthor, qr as NAME_RESOLVED_FALSE_TTL_MS, qt as RpcFetchCidParamSchema, rn as RpcSubscriptionIdResultSchema, rr as normalizeCommunityInputFromCommunity, rt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, sn as require_lib$1, st as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcPublishedAnchorRecordResultSchema, tr as getCommunityNameFromWire, un as createAnchorIpnsRecord$1, v as TrackedInstanceRegistry, vt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, x as RemoteCommunity, xn as signComment, xt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signChallengeRequest, z as PKCClientsManager, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-
|
|
4
|
-
import { s as getHeliaDebugContext } from "./util-
|
|
2
|
+
import { $ as retryKuboIpfsAddAndProvide, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, H as rejectWhenAbortSignalFires, Hr as setErrorMap, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, J as removeUndefinedValuesRecursively, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Q as retryKuboIpfsAdd, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenCommunityStopsOrAborts, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, hr as isStringDomain, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$1, k as isIpns, kt as pTimeout, ni as en_default, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, tt as shortifyCid, u as createAbortError, vr as n$1, vt as refreshTrackedCommentAliases, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, zn as CommentUpdateSchema, zr as logger_default } from "./util-TZLcBbZd.js";
|
|
3
|
+
import { $n as buildRuntimeCommunityFields, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, Ar as setNativeFunctions$1, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Br as t$3, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dt as parseJsonWithPKCErrorIfFails, Er as monitorCommunitiesDirectory, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as NAME_RESOLVED_TRUE_TTL_MS, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lr as t$5, Lt as RpcCidParamSchema, M as parseRawPages, Mr as findCommunitiesEntry, Nn as verifyChallengeVerification, Nr as toCommunitiesEntry, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pt as RpcAnchorPublishPreparationResultSchema, Qr as nativeFunctions$2, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, Sr as getDefaultDataPath, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tr as listCommunitiesSync, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as t$2, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vr as n$3, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wr as t$4, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Yt as RpcFetchCommunityListParamSchema, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, en as RpcPublishCommunityListResultSchema, er as getCommunityAddressFromRecord, et as parseCidStringSchemaWithPKCErrorIfItFails, ft as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, gn as cleanUpBeforePublishing, gt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, hr as createKuboRpcClient, ht as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, in as RpcSuccessResultSchema, ir as decode, it as parseCommentIpfsSchemaWithPKCErrorIfItFails, jn as verifyChallengeMessage, jr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kn as signVote, kt as parseRpcCommentEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as createSigner, lr as getPKCAddressFromPublicKeySync, lt as parseCommunityAddressWithPKCErrorIfItFails, m as pkcJsChallenges, mt as parseCommunityListSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcResolveAuthorNameResultSchema, nr as getCommunityPublicKeyFromWire, on as findCommunityRecordNameMismatch, or as getBufferedPKCAddressFromPublicKey, ot as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, pn as encryptEd25519AesGcm, q as decodeRpcChallengePubsubMsg, qn as normalizeCreatePublicationAuthor, qr as NAME_RESOLVED_FALSE_TTL_MS, qt as RpcFetchCidParamSchema, rn as RpcSubscriptionIdResultSchema, rr as normalizeCommunityInputFromCommunity, rt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, sn as require_lib$1, st as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcPublishedAnchorRecordResultSchema, tr as getCommunityNameFromWire, un as createAnchorIpnsRecord$1, v as TrackedInstanceRegistry, vt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, x as RemoteCommunity, xn as signComment, xt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signChallengeRequest, z as PKCClientsManager, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-CuL4H_vR.js";
|
|
4
|
+
import { s as getHeliaDebugContext } from "./util-D104b59J.js";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import fs from "fs";
|
|
@@ -30557,6 +30557,7 @@ const parseRpcExportCommunityModLogsResult = (result) => RpcExportCommunityModLo
|
|
|
30557
30557
|
//#region dist/node/clients/rpc-client/pkc-rpc-client.js
|
|
30558
30558
|
const log = logger_default("pkc-js:PKCRpcClient");
|
|
30559
30559
|
const WEBSOCKET_READY_STATE_CLOSED = 3;
|
|
30560
|
+
const WEBSOCKET_CLOSE_NORMAL = 1e3;
|
|
30560
30561
|
const DESTROY_SOCKET_CLOSE_TIMEOUT_MS = 5e3;
|
|
30561
30562
|
const scheduleMacrotask = setTimeout.bind(globalThis);
|
|
30562
30563
|
function isRpcSubscriptionNotification(message) {
|
|
@@ -30575,6 +30576,9 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30575
30576
|
this._resubscribeCalls = /* @__PURE__ */ new Map();
|
|
30576
30577
|
this._publishSubscriptionIds = /* @__PURE__ */ new Set();
|
|
30577
30578
|
this._hasConnectedBefore = false;
|
|
30579
|
+
this._failedReconnectAttempts = 0;
|
|
30580
|
+
this._callsAwaitingResponse = /* @__PURE__ */ new Set();
|
|
30581
|
+
this._backgroundSubscriptionsToRetry = /* @__PURE__ */ new Set();
|
|
30578
30582
|
this._socketsWithNotificationHandler = /* @__PURE__ */ new WeakSet();
|
|
30579
30583
|
this._reconnectBaseIntervalMs = 1e3;
|
|
30580
30584
|
this._reconnectMaxIntervalMs = 3e4;
|
|
@@ -30608,7 +30612,6 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30608
30612
|
async _init() {
|
|
30609
30613
|
const log = logger_default("pkc-js:pkc-rpc-client:_init");
|
|
30610
30614
|
if (this._destroyRequested) return;
|
|
30611
|
-
let lastWebsocketError;
|
|
30612
30615
|
if (!(this._webSocketClient instanceof Client)) {
|
|
30613
30616
|
this.setState("connecting");
|
|
30614
30617
|
this._webSocketClient = new Client(this._websocketServerUrl, {
|
|
@@ -30622,42 +30625,55 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30622
30625
|
this._attachNotificationHandler();
|
|
30623
30626
|
this._reconnectIntervalMs = this._reconnectBaseIntervalMs;
|
|
30624
30627
|
this._webSocketClient.setReconnectInterval(this._reconnectIntervalMs);
|
|
30628
|
+
this._failedReconnectAttempts = 0;
|
|
30629
|
+
this._lastWebsocketError = void 0;
|
|
30625
30630
|
const isReconnect = this._hasConnectedBefore;
|
|
30626
30631
|
this._hasConnectedBefore = true;
|
|
30627
30632
|
this.setState("connected");
|
|
30628
30633
|
if (isReconnect) this._resubscribeAllAfterReconnect();
|
|
30634
|
+
this._retryBackgroundSubscriptions();
|
|
30629
30635
|
});
|
|
30630
30636
|
this._webSocketClient.on("error", (error) => {
|
|
30631
30637
|
this._backOffReconnectInterval();
|
|
30632
|
-
|
|
30638
|
+
this._lastWebsocketError = error;
|
|
30633
30639
|
if (this._destroyRequested) {
|
|
30634
30640
|
log("Ignoring websocket error emitted after destroy request", error);
|
|
30635
30641
|
return;
|
|
30636
30642
|
}
|
|
30637
30643
|
if ((typeof error?.message === "string" ? error.message : "").includes("Unexpected server response: 403")) {
|
|
30638
|
-
|
|
30644
|
+
this._lastWebsocketError = new PKCError("ERR_RPC_AUTH_REQUIRED", { rpcServerUrl: this._websocketServerUrl });
|
|
30639
30645
|
this._webSocketClient.setAutoReconnect(false);
|
|
30640
|
-
this.emit("error",
|
|
30646
|
+
this.emit("error", this._lastWebsocketError);
|
|
30641
30647
|
this.setState("failed");
|
|
30642
30648
|
return;
|
|
30643
30649
|
}
|
|
30650
|
+
const errorToEmit = this._wrapIfFailedReconnectAttempt(error);
|
|
30644
30651
|
try {
|
|
30645
|
-
this.emit("error",
|
|
30652
|
+
this.emit("error", errorToEmit);
|
|
30646
30653
|
} catch (emitError) {
|
|
30647
30654
|
log.error("No listener received the RPC websocket error", this._websocketServerUrl, emitError);
|
|
30648
30655
|
}
|
|
30649
30656
|
});
|
|
30650
|
-
this._webSocketClient.on("close", () => {
|
|
30657
|
+
this._webSocketClient.on("close", (closeCode, closeReason) => {
|
|
30651
30658
|
if (!this._destroyRequested) log.error("connection with web socket has been closed", this._websocketServerUrl);
|
|
30652
30659
|
this._openConnectionPromise = void 0;
|
|
30653
30660
|
this.setState("stopped");
|
|
30654
|
-
if (
|
|
30661
|
+
if (this._destroyRequested) return;
|
|
30662
|
+
this._lastClose = {
|
|
30663
|
+
closeCode,
|
|
30664
|
+
closeReason: String(closeReason ?? "")
|
|
30665
|
+
};
|
|
30666
|
+
this._rejectCallsLostWithConnection();
|
|
30667
|
+
this._failPublicationsLostWithConnection();
|
|
30668
|
+
if (!this._webSocketClient.willReconnect()) return;
|
|
30669
|
+
if (closeCode === WEBSOCKET_CLOSE_NORMAL) this._scheduleReconnectAfterCleanClose();
|
|
30670
|
+
this.setState("connecting");
|
|
30655
30671
|
});
|
|
30656
30672
|
const originalWebsocketCall = this._webSocketClient.call.bind(this._webSocketClient);
|
|
30657
30673
|
this._webSocketClient.call = async (...args) => {
|
|
30658
30674
|
try {
|
|
30659
30675
|
await this._init();
|
|
30660
|
-
return await pTimeout(originalWebsocketCall(...args), {
|
|
30676
|
+
return await pTimeout(this._rejectIfConnectionIsLost(originalWebsocketCall(...args), args[0]), {
|
|
30661
30677
|
milliseconds: this._callTimeoutMs,
|
|
30662
30678
|
message: new PKCError("ERR_RPC_CALL_TIMED_OUT", {
|
|
30663
30679
|
rpcMethod: args[0],
|
|
@@ -30676,17 +30692,10 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30676
30692
|
};
|
|
30677
30693
|
}
|
|
30678
30694
|
if (this._webSocketClient.ready) return;
|
|
30679
|
-
if (!this._openConnectionPromise) this._openConnectionPromise =
|
|
30680
|
-
|
|
30681
|
-
predicate: () => {
|
|
30682
|
-
if (this.state === "connected") return true;
|
|
30683
|
-
if (lastWebsocketError instanceof PKCError) throw lastWebsocketError;
|
|
30684
|
-
return false;
|
|
30685
|
-
},
|
|
30686
|
-
eventName: "statechange"
|
|
30687
|
-
}), { milliseconds: this._timeoutSeconds * 1e3 });
|
|
30695
|
+
if (!this._openConnectionPromise) this._openConnectionPromise = this._waitForConnectionToOpen();
|
|
30696
|
+
const openConnectionPromise = this._openConnectionPromise;
|
|
30688
30697
|
try {
|
|
30689
|
-
await
|
|
30698
|
+
await openConnectionPromise;
|
|
30690
30699
|
} catch (e) {
|
|
30691
30700
|
if (this._destroyRequested) {
|
|
30692
30701
|
log("Aborted RPC connection before it finished opening because destroy was requested", this._websocketServerUrl);
|
|
@@ -30694,14 +30703,30 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30694
30703
|
}
|
|
30695
30704
|
const err = e instanceof PKCError ? e : new PKCError("ERR_FAILED_TO_OPEN_CONNECTION_TO_RPC", {
|
|
30696
30705
|
timeoutSeconds: this._timeoutSeconds,
|
|
30697
|
-
error:
|
|
30706
|
+
error: this._lastWebsocketError,
|
|
30698
30707
|
rpcServerUrl: this._websocketServerUrl
|
|
30699
30708
|
});
|
|
30700
|
-
this.
|
|
30709
|
+
if (this.state !== "failed" && this._openConnectionPromise === openConnectionPromise) this._openConnectionPromise = void 0;
|
|
30701
30710
|
this.emit("error", err);
|
|
30702
30711
|
throw err;
|
|
30703
30712
|
}
|
|
30704
30713
|
}
|
|
30714
|
+
async _waitForConnectionToOpen() {
|
|
30715
|
+
let onStateChange = () => {};
|
|
30716
|
+
const connectionOpened = new Promise((resolve, reject) => {
|
|
30717
|
+
onStateChange = () => {
|
|
30718
|
+
if (this.state === "connected") resolve();
|
|
30719
|
+
else if (this._lastWebsocketError instanceof PKCError) reject(this._lastWebsocketError);
|
|
30720
|
+
};
|
|
30721
|
+
this.on("statechange", onStateChange);
|
|
30722
|
+
onStateChange();
|
|
30723
|
+
});
|
|
30724
|
+
try {
|
|
30725
|
+
await pTimeout(connectionOpened, { milliseconds: this._timeoutSeconds * 1e3 });
|
|
30726
|
+
} finally {
|
|
30727
|
+
this.removeListener("statechange", onStateChange);
|
|
30728
|
+
}
|
|
30729
|
+
}
|
|
30705
30730
|
async destroy() {
|
|
30706
30731
|
if (this._destroyRequested) return;
|
|
30707
30732
|
this._destroyRequested = true;
|
|
@@ -30718,6 +30743,7 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30718
30743
|
}
|
|
30719
30744
|
this._resubscribeCalls.clear();
|
|
30720
30745
|
this._publishSubscriptionIds.clear();
|
|
30746
|
+
this._backgroundSubscriptionsToRetry.clear();
|
|
30721
30747
|
this._serverIdByLocalId.clear();
|
|
30722
30748
|
this._localIdByServerId.clear();
|
|
30723
30749
|
try {
|
|
@@ -30785,6 +30811,38 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30785
30811
|
if (this._subscriptionEvents[subscriptionId].listenerCount(message.params.event) === 0) this._pendingSubscriptionMsgs[subscriptionId].push(message);
|
|
30786
30812
|
else this._subscriptionEvents[subscriptionId].emit(message.params.event, message);
|
|
30787
30813
|
}
|
|
30814
|
+
_scheduleReconnectAfterCleanClose() {
|
|
30815
|
+
const webSocketClient = this._webSocketClient;
|
|
30816
|
+
webSocketClient.reconnect_timer_id = setTimeout(() => {
|
|
30817
|
+
if (!this._destroyRequested && this._webSocketClient.willReconnect()) this._webSocketClient.connect();
|
|
30818
|
+
}, this._reconnectIntervalMs);
|
|
30819
|
+
}
|
|
30820
|
+
_wrapIfFailedReconnectAttempt(error) {
|
|
30821
|
+
if (!this._hasConnectedBefore || this.state === "connected") return error;
|
|
30822
|
+
this._failedReconnectAttempts++;
|
|
30823
|
+
return new PKCError("ERR_RPC_RECONNECT_FAILED", {
|
|
30824
|
+
rpcServerUrl: this._websocketServerUrl,
|
|
30825
|
+
...this._lastClose,
|
|
30826
|
+
attempt: this._failedReconnectAttempts,
|
|
30827
|
+
nextRetryMs: this._reconnectIntervalMs,
|
|
30828
|
+
error: error.error ?? error
|
|
30829
|
+
});
|
|
30830
|
+
}
|
|
30831
|
+
_rejectIfConnectionIsLost(call, rpcMethod) {
|
|
30832
|
+
return new Promise((resolve, reject) => {
|
|
30833
|
+
const rejectWithLostConnection = () => reject(new PKCError("ERR_RPC_CONNECTION_LOST", {
|
|
30834
|
+
rpcMethod,
|
|
30835
|
+
rpcServerUrl: this._websocketServerUrl,
|
|
30836
|
+
...this._lastClose
|
|
30837
|
+
}));
|
|
30838
|
+
this._callsAwaitingResponse.add(rejectWithLostConnection);
|
|
30839
|
+
call.then(resolve, reject).finally(() => this._callsAwaitingResponse.delete(rejectWithLostConnection));
|
|
30840
|
+
});
|
|
30841
|
+
}
|
|
30842
|
+
_rejectCallsLostWithConnection() {
|
|
30843
|
+
for (const rejectCall of this._callsAwaitingResponse) rejectCall();
|
|
30844
|
+
this._callsAwaitingResponse.clear();
|
|
30845
|
+
}
|
|
30788
30846
|
_backOffReconnectInterval() {
|
|
30789
30847
|
if (!(this._webSocketClient instanceof Client)) return;
|
|
30790
30848
|
this._reconnectIntervalMs = Math.min(this._reconnectIntervalMs * 2, this._reconnectMaxIntervalMs);
|
|
@@ -30803,6 +30861,7 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30803
30861
|
_resubscribeAllAfterReconnect() {
|
|
30804
30862
|
for (const subscriptionId of [...this._resubscribeCalls.keys()]) this._resubscribe(subscriptionId).catch((error) => {
|
|
30805
30863
|
if (this._destroyRequested) return;
|
|
30864
|
+
if (error?.code === "ERR_RPC_CONNECTION_LOST") return;
|
|
30806
30865
|
if (error?.code === "ERR_RPC_COMMUNITY_NOT_RUNNING") {
|
|
30807
30866
|
log("Not re-establishing start(), the community was stopped on purpose", subscriptionId);
|
|
30808
30867
|
this._resubscribeCalls.delete(subscriptionId);
|
|
@@ -30821,6 +30880,22 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
30821
30880
|
} });
|
|
30822
30881
|
});
|
|
30823
30882
|
}
|
|
30883
|
+
async _runBackgroundSubscription(subscribe) {
|
|
30884
|
+
try {
|
|
30885
|
+
await subscribe();
|
|
30886
|
+
} catch (error) {
|
|
30887
|
+
if (!this._destroyRequested && this.state !== "connected") this._backgroundSubscriptionsToRetry.add(subscribe);
|
|
30888
|
+
throw error;
|
|
30889
|
+
}
|
|
30890
|
+
}
|
|
30891
|
+
_retryBackgroundSubscriptions() {
|
|
30892
|
+
const subscriptions = [...this._backgroundSubscriptionsToRetry];
|
|
30893
|
+
this._backgroundSubscriptionsToRetry.clear();
|
|
30894
|
+
for (const subscribe of subscriptions) this._runBackgroundSubscription(subscribe).catch((error) => {
|
|
30895
|
+
if (this._destroyRequested) return;
|
|
30896
|
+
log.error("Failed to subscribe after connecting to the RPC server", this._websocketServerUrl, error);
|
|
30897
|
+
});
|
|
30898
|
+
}
|
|
30824
30899
|
async _resubscribe(subscriptionId) {
|
|
30825
30900
|
const call = this._resubscribeCalls.get(subscriptionId);
|
|
30826
30901
|
if (!call || this._destroyRequested) return;
|
|
@@ -31030,23 +31105,27 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
31030
31105
|
return parseRpcResolveAuthorNameResult(await this._webSocketClient.call("resolveAuthorName", [resolveAuthorNameArgs]));
|
|
31031
31106
|
}
|
|
31032
31107
|
async initalizeCommunitieschangeEvent() {
|
|
31033
|
-
|
|
31034
|
-
|
|
31035
|
-
|
|
31036
|
-
|
|
31037
|
-
|
|
31038
|
-
|
|
31039
|
-
|
|
31040
|
-
|
|
31108
|
+
await this._runBackgroundSubscription(async () => {
|
|
31109
|
+
const { subscriptionId } = await this._subscribe("communitiesSubscribe", [], "resubscribe");
|
|
31110
|
+
this.getSubscription(subscriptionId).on("communitieschange", (res) => {
|
|
31111
|
+
const parsed = RpcCommunitiesChangeEventResultSchema.loose().safeParse(res.params.result);
|
|
31112
|
+
if (!parsed.success) return this.emit("error", new PKCError("ERR_INVALID_RPC_COMMUNITIES_SCHEMA", {
|
|
31113
|
+
zodError: parsed.error,
|
|
31114
|
+
result: res.params.result
|
|
31115
|
+
}));
|
|
31116
|
+
this.emit("communitieschange", { communities: parsed.data.communities.map((entry) => toCommunitiesEntry(entry)) });
|
|
31117
|
+
});
|
|
31118
|
+
this.emitAllPendingMessages(subscriptionId);
|
|
31041
31119
|
});
|
|
31042
|
-
this.emitAllPendingMessages(subscriptionId);
|
|
31043
31120
|
}
|
|
31044
31121
|
async initalizeSettingschangeEvent() {
|
|
31045
|
-
|
|
31046
|
-
|
|
31047
|
-
this.
|
|
31122
|
+
await this._runBackgroundSubscription(async () => {
|
|
31123
|
+
const { subscriptionId } = await this._subscribe("settingsSubscribe", [], "resubscribe");
|
|
31124
|
+
this.getSubscription(subscriptionId).on("settingschange", (res) => {
|
|
31125
|
+
this.emit("settingschange", res.params.result);
|
|
31126
|
+
});
|
|
31127
|
+
this.emitAllPendingMessages(subscriptionId);
|
|
31048
31128
|
});
|
|
31049
|
-
this.emitAllPendingMessages(subscriptionId);
|
|
31050
31129
|
}
|
|
31051
31130
|
async fetchCid(args) {
|
|
31052
31131
|
const parsedFetchCidArgs = parseRpcFetchCidParam(args);
|
|
@@ -35823,7 +35902,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
35823
35902
|
this.clients.libp2pJsClients = {};
|
|
35824
35903
|
if (!this.libp2pJsClientsOptions) return;
|
|
35825
35904
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
35826
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
35905
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-DldRnBHX.js");
|
|
35827
35906
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
35828
35907
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
35829
35908
|
...clientOptions,
|
|
@@ -36188,7 +36267,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
36188
36267
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
36189
36268
|
log.trace("Received community options to create a local community instance:", options);
|
|
36190
36269
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
36191
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
36270
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-9i6vs_-P.js");
|
|
36192
36271
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
36193
36272
|
const community = new LocalCommunity(this);
|
|
36194
36273
|
if (isLocalCommunity) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bn as PageSortFileSchema, hr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-
|
|
1
|
+
import { bn as PageSortFileSchema, hr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-TZLcBbZd.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-CDsOv_s2.js → rpc-local-community-CuL4H_vR.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 { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as e$4, Bn as CommentUpdateSignedPropertyNames, Br as require_supports_color, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as r$7, Dt as require_sha256$1, E as isAbortError, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as looseObject, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as PageIpfsSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$12, Un as CreateCommentOptionsWithRefinementSchema, Ur as _enum, Ut as NameResolveCacheOptionsSchema, V as raceAgainstAbort, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as object, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersSchema, at as timestamp, bn as PageSortFileSchema, br as t$13, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isStringDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$2, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, nr as AuthorCommentIpfsReservedFields, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileFactorySchema, or as CidPathSchema, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, qn as isReservedObjectKey, qr as literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyCid, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default } from "./util-
|
|
2
|
+
import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as e$4, Bn as CommentUpdateSignedPropertyNames, Br as require_supports_color, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as r$7, Dt as require_sha256$1, E as isAbortError, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as looseObject, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as PageIpfsSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$12, Un as CreateCommentOptionsWithRefinementSchema, Ur as _enum, Ut as NameResolveCacheOptionsSchema, V as raceAgainstAbort, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as object, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersSchema, at as timestamp, bn as PageSortFileSchema, br as t$13, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isStringDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$2, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, nr as AuthorCommentIpfsReservedFields, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileFactorySchema, or as CidPathSchema, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, qn as isReservedObjectKey, qr as literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyCid, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default } from "./util-TZLcBbZd.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-BCqpbgnJ.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 { B as pubsubTopicToDhtKeyCid, Lr as PKCError } from "./util-
|
|
1
|
+
import { B as pubsubTopicToDhtKeyCid, Lr as PKCError } from "./util-TZLcBbZd.js";
|
|
2
2
|
import { ipnsSelector } from "ipns/selector";
|
|
3
3
|
import { ipnsValidator } from "ipns/validator";
|
|
4
4
|
import { unmarshalIPNSRecord } from "ipns";
|
|
@@ -7268,6 +7268,8 @@ var messages;
|
|
|
7268
7268
|
messages["ERR_RPC_CLIENT_TRYING_TO_DELETE_REMOTE_COMMUNITY"] = "RPC client is attempting to delete remote community";
|
|
7269
7269
|
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";
|
|
7270
7270
|
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";
|
|
7271
|
+
messages["ERR_RPC_CONNECTION_LOST"] = "The connection to the PKC RPC server closed before the response to this call arrived. The server may have run the call. The client is reconnecting on its own";
|
|
7272
|
+
messages["ERR_RPC_RECONNECT_FAILED"] = "Failed to reconnect to the PKC RPC server. The client keeps retrying until pkc.destroy() is called";
|
|
7271
7273
|
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";
|
|
7272
7274
|
messages["ERR_GENERIC_RPC_CLIENT_CALL_ERROR"] = "RPC client received an unknown error when executing call over websocket";
|
|
7273
7275
|
messages["ERR_RPC_CALL_TIMED_OUT"] = "RPC client call timed out without receiving a response from the RPC server";
|
|
@@ -16550,7 +16552,7 @@ const CommunityEditPublicationPubsubReservedFields = r$2([
|
|
|
16550
16552
|
], t$3(CommunityEditPubsubMessagePublicationSchema.shape));
|
|
16551
16553
|
//#endregion
|
|
16552
16554
|
//#region dist/node/generated-version.js
|
|
16553
|
-
const version = "0.0.
|
|
16555
|
+
const version = "0.0.135";
|
|
16554
16556
|
//#endregion
|
|
16555
16557
|
//#region dist/node/version.js
|
|
16556
16558
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Lr as PKCError, on as ChallengeFileFactorySchema, sn as ChallengeFileSchema, yn as PageSortFileFactorySchema } from "./util-
|
|
2
|
-
import { s as validatePageSortFile } from "./page-sort-scoring-
|
|
1
|
+
import { Lr as PKCError, on as ChallengeFileFactorySchema, sn as ChallengeFileSchema, yn as PageSortFileFactorySchema } from "./util-TZLcBbZd.js";
|
|
2
|
+
import { s as validatePageSortFile } from "./page-sort-scoring-BCqpbgnJ.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-BNoBGxyk.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-DGlKaHzi.js";
|
|
2
2
|
export { validatePageSortFileFactory };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as retryKuboIpfsAddAndProvide, C as hideClassPrivateProps, Lr as PKCError, Y as replaceXWithY, br as t, dt as findStartedCommunity, i as calculateStringSizeSameAsIpfsAddCidV0, kt as pTimeout, vr as n, zr as logger_default } from "../../chunks/util-
|
|
2
|
-
import { S as parseRpcUnsubscribeParam, _ as parseRpcExportCommunityParam, b as parseRpcPublishChallengeAnswersParam, d as parseRpcCidParam, f as parseRpcCommentRepliesPageParam, g as parseRpcExportCommunityModLogsParam, h as parseRpcEditCommunityParam, l as parseRpcAuthorNameParam, m as parseRpcCommunityPageParam, p as parseRpcCommunityIdentifierParam, t as PKC, u as parseRpcCancelExportParam, v as parseRpcFetchCommunityListParam, x as parseRpcPublishCommunityListParam, y as parseRpcPublishAnchorRecordParam } from "../../chunks/node-
|
|
3
|
-
import { Dt as parseJsonWithPKCErrorIfFails, E as buildPagesRuntimeFields, Gr as stringify, L as extractCrosspostRuntimeFields, Mt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Pr as toCommunitiesWireEntry, Rr as t$1, T as buildPageRuntimeFields, Tr as listCommunitiesSync, U as pRetry, Vn as verifyCommunityList, W as pLimit, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, at as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, br as findLocalCommunityAddress, bt as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, mt as parseCommunityListSchemaWithPKCErrorIfItFails, nt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, sn as require_lib, tt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ut as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-
|
|
4
|
-
import { t as LocalCommunity } from "../../chunks/local-community-
|
|
1
|
+
import { $ as retryKuboIpfsAddAndProvide, C as hideClassPrivateProps, Lr as PKCError, Y as replaceXWithY, br as t, dt as findStartedCommunity, i as calculateStringSizeSameAsIpfsAddCidV0, kt as pTimeout, vr as n, zr as logger_default } from "../../chunks/util-TZLcBbZd.js";
|
|
2
|
+
import { S as parseRpcUnsubscribeParam, _ as parseRpcExportCommunityParam, b as parseRpcPublishChallengeAnswersParam, d as parseRpcCidParam, f as parseRpcCommentRepliesPageParam, g as parseRpcExportCommunityModLogsParam, h as parseRpcEditCommunityParam, l as parseRpcAuthorNameParam, m as parseRpcCommunityPageParam, p as parseRpcCommunityIdentifierParam, t as PKC, u as parseRpcCancelExportParam, v as parseRpcFetchCommunityListParam, x as parseRpcPublishCommunityListParam, y as parseRpcPublishAnchorRecordParam } from "../../chunks/node-BNoBGxyk.js";
|
|
3
|
+
import { Dt as parseJsonWithPKCErrorIfFails, E as buildPagesRuntimeFields, Gr as stringify, L as extractCrosspostRuntimeFields, Mt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Pr as toCommunitiesWireEntry, Rr as t$1, T as buildPageRuntimeFields, Tr as listCommunitiesSync, U as pRetry, Vn as verifyCommunityList, W as pLimit, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, at as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, br as findLocalCommunityAddress, bt as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, mt as parseCommunityListSchemaWithPKCErrorIfItFails, nt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, sn as require_lib, tt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ut as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-CuL4H_vR.js";
|
|
4
|
+
import { t as LocalCommunity } from "../../chunks/local-community-BjljrKks.js";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import assert from "assert";
|