@pkcprotocol/pkc-js 0.0.144 → 0.0.146
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/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/publications/publication.d.ts +1 -0
- package/dist/browser/publications/publication.js +24 -5
- package/dist/browser/publications/publication.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/index.js +14 -0
- package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/db-state.d.ts +3 -1
- package/dist/browser/runtime/node/community/local-community/db-state.js +9 -3
- package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/defaults.d.ts +1 -0
- package/dist/browser/runtime/node/community/local-community/defaults.js +5 -0
- package/dist/browser/runtime/node/community/local-community/defaults.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/editing.js +29 -2
- package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +2 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/lifecycle.js +84 -13
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community.d.ts +4 -0
- package/dist/browser/runtime/node/community/local-community.js +7 -1
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +40 -40
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc--Xw7hTTu.js → helia-for-pkc-PaZmkxgn.js} +33 -33
- package/dist/bundled/chunks/{local-community-DCVtQSci.js → local-community-BY1ouP1-.js} +119 -52
- package/dist/bundled/chunks/{local-community-CH8vMgTr.js → local-community-CeuVhBBn.js} +1 -1
- package/dist/bundled/chunks/{node-Coyk7lC6.js → node-BXilwSVE.js} +16 -6
- package/dist/bundled/chunks/{page-sort-scoring-DaW6urZ2.js → page-sort-scoring-DgSzIxmE.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-KgRrTYjv.js → rpc-local-community-BK_HGb_u.js} +12 -2
- package/dist/bundled/chunks/{util-BYT-7zVn.js → util-Bnqvxk-6.js} +1 -1
- package/dist/bundled/chunks/{util-DN7FMpHT.js → util-DRSzW-LU.js} +1 -1
- package/dist/bundled/chunks/{validate-package-factories-CPVyODKw.js → validate-package-factories-MG5ehoSU.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/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/publications/publication.d.ts +1 -0
- package/dist/node/publications/publication.js +24 -5
- package/dist/node/publications/publication.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/index.js +14 -0
- package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/db-state.d.ts +3 -1
- package/dist/node/runtime/node/community/local-community/db-state.js +9 -3
- package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/defaults.d.ts +1 -0
- package/dist/node/runtime/node/community/local-community/defaults.js +5 -0
- package/dist/node/runtime/node/community/local-community/defaults.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/editing.js +29 -2
- package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js +2 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/lifecycle.js +84 -13
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/community/local-community.d.ts +4 -0
- package/dist/node/runtime/node/community/local-community.js +7 -1
- package/dist/node/runtime/node/community/local-community.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as __toESM } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { Ar as t$2, At as pTimeout, B as pubsubTopicToDhtKey, Bn as CommentUpdateSchema, Br as logger_default, Bt as DecryptedChallengeRequestPublicationSchema, C as hideClassPrivateProps, Cr as e, Dn as VotePubsubReservedFields, Dt as untrackUpdatingCommunity, En as VotePubsubMessagePublicationSchema, Er as t$3, F as isLinkOfVideo, Ft as ChallengeRequestMessageSchema, G as removeBlocksFromKuboNode, Hn as CommentUpdateTableRowSchema, I as isLinkValid, J as removeNullUndefinedValues, K as removeMfsFilesSafely, Lt as ChallengeVerificationMessageSchema, M as isLinkOfAudio, Mn as CommentIpfsSchema, Mr as require_retry, N as isLinkOfImage, Nn as CommentPubsubMessageReservedFields, Nt as ChallengeMessageSchema, Ot as require_sha256, P as isLinkOfMedia, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Qn as CommentEditReservedFields, Rr as PKCError, Sr as e$1, St as trackStartedCommunity, T as ipnsNameToIpnsOverPubsubTopic, Tr as r$1, Tt as untrackStartedCommunity, Un as CommentsTableRowSchema, Vt as DecryptedChallengeRequestSchema, Xn as CommentEditPubsubMessagePublicationSchema, Yt as version_default, Zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Zt as CommunityEditPublicationPubsubReservedFields, _ as genToArray, _r as n$3, an as CommentModerationsTableRowSchema, ar as AuthorReservedFields, b as getIpnsRecordInLocalKuboNode, br as t$5, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findCommunityInRegistry, er as CommentEditsTableRowSchema, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, ft as findStartedCommunity, g as findMalformedUnicodeString, gr as isStringDomain, hn as CommunitySignedPropertyNames, i as calculateStringSizeSameAsIpfsAddCidV0, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jt as ChallengeAnswerMessageSchema, kn as VoteTablesRowSchema, kr as t$4, l as contentContainsMarkdownVideos, lt as withSortedKeysDeep, mn as CommunityIpfsSchema, mt as findUpdatingCommunity, ni as ZodError, nn as CommentModerationPubsubMessagePublicationSchema, o as calculateUnixFsDagSizeCidV0, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, r as calculateIpfsCidV0, rn as CommentModerationReservedFields, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, ut as writeKuboFilesWithTimeout, v as getEquivalentCommunityAddresses, vr as t$7, wt as trackUpdatingCommunity, xr as t$6, xt as syncCommunityRegistryEntry, y as getErrorCodeFromMessage, yr as n$2, zr as messages } 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 { Ar as t$2, At as pTimeout, B as pubsubTopicToDhtKey, Bn as CommentUpdateSchema, Br as logger_default, Bt as DecryptedChallengeRequestPublicationSchema, C as hideClassPrivateProps, Cr as e, Dn as VotePubsubReservedFields, Dt as untrackUpdatingCommunity, En as VotePubsubMessagePublicationSchema, Er as t$3, F as isLinkOfVideo, Ft as ChallengeRequestMessageSchema, G as removeBlocksFromKuboNode, Hn as CommentUpdateTableRowSchema, I as isLinkValid, J as removeNullUndefinedValues, K as removeMfsFilesSafely, Lt as ChallengeVerificationMessageSchema, M as isLinkOfAudio, Mn as CommentIpfsSchema, Mr as require_retry, N as isLinkOfImage, Nn as CommentPubsubMessageReservedFields, Nt as ChallengeMessageSchema, Ot as require_sha256, P as isLinkOfMedia, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Qn as CommentEditReservedFields, Rr as PKCError, Sr as e$1, St as trackStartedCommunity, T as ipnsNameToIpnsOverPubsubTopic, Tr as r$1, Tt as untrackStartedCommunity, Un as CommentsTableRowSchema, Vt as DecryptedChallengeRequestSchema, Xn as CommentEditPubsubMessagePublicationSchema, Yt as version_default, Zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Zt as CommunityEditPublicationPubsubReservedFields, _ as genToArray, _r as n$3, an as CommentModerationsTableRowSchema, ar as AuthorReservedFields, b as getIpnsRecordInLocalKuboNode, br as t$5, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findCommunityInRegistry, er as CommentEditsTableRowSchema, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, ft as findStartedCommunity, g as findMalformedUnicodeString, gr as isStringDomain, hn as CommunitySignedPropertyNames, i as calculateStringSizeSameAsIpfsAddCidV0, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jt as ChallengeAnswerMessageSchema, kn as VoteTablesRowSchema, kr as t$4, l as contentContainsMarkdownVideos, lt as withSortedKeysDeep, mn as CommunityIpfsSchema, mt as findUpdatingCommunity, ni as ZodError, nn as CommentModerationPubsubMessagePublicationSchema, o as calculateUnixFsDagSizeCidV0, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, r as calculateIpfsCidV0, rn as CommentModerationReservedFields, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, ut as writeKuboFilesWithTimeout, v as getEquivalentCommunityAddresses, vr as t$7, wt as trackUpdatingCommunity, xr as t$6, xt as syncCommunityRegistryEntry, y as getErrorCodeFromMessage, yr as n$2, zr as messages } from "./util-Bnqvxk-6.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-BK_HGb_u.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-DgSzIxmE.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 from "path";
|
|
9
|
+
import path$1 from "path";
|
|
10
10
|
import assert from "assert";
|
|
11
11
|
import { Buffer as Buffer$1 } from "buffer";
|
|
12
12
|
import fs$1 from "fs";
|
|
@@ -223,6 +223,7 @@ const DUPLICATE_PUBLICATION_ERRORS = new Set([
|
|
|
223
223
|
messages.ERR_DUPLICATE_COMMENT_MODERATION
|
|
224
224
|
]);
|
|
225
225
|
const CHALLENGE_EXCHANGE_TTL_MS = 600 * 1e3;
|
|
226
|
+
const SLOW_GET_CHALLENGE_WARNING_MS = 60 * 1e3;
|
|
226
227
|
const defaultChallengeQuestionText = "What is the answer to this community's challenge? (check community.settings.challenges to see the answer, or set your own challenge)";
|
|
227
228
|
function generateDefaultChallenges(answer) {
|
|
228
229
|
return [{
|
|
@@ -315,15 +316,15 @@ async function throwIfChallengeSettingsAreInvalid({ challengeSettings, pkc, comm
|
|
|
315
316
|
const processStartedCommunities = new TrackedInstanceRegistry();
|
|
316
317
|
function normalizeRegistryDataPath(dataPath) {
|
|
317
318
|
if (dataPath === void 0) return void 0;
|
|
318
|
-
const resolved = path.resolve(dataPath);
|
|
319
|
+
const resolved = path$1.resolve(dataPath);
|
|
319
320
|
let existing = resolved;
|
|
320
321
|
let tail = "";
|
|
321
322
|
while (true) try {
|
|
322
|
-
return path.join(fs$1.realpathSync.native(existing), tail);
|
|
323
|
+
return path$1.join(fs$1.realpathSync.native(existing), tail);
|
|
323
324
|
} catch {
|
|
324
|
-
const parent = path.dirname(existing);
|
|
325
|
+
const parent = path$1.dirname(existing);
|
|
325
326
|
if (parent === existing) return resolved;
|
|
326
|
-
tail = path.join(path.basename(existing), tail);
|
|
327
|
+
tail = path$1.join(path$1.basename(existing), tail);
|
|
327
328
|
existing = parent;
|
|
328
329
|
}
|
|
329
330
|
}
|
|
@@ -998,15 +999,17 @@ async function getDbInternalState(community, lock) {
|
|
|
998
999
|
if (lockedIt) await community._dbHandler.unlockCommunityState();
|
|
999
1000
|
}
|
|
1000
1001
|
}
|
|
1001
|
-
async function updateDbInternalState(community,
|
|
1002
|
+
async function updateDbInternalState(community, propsOrBuildProps) {
|
|
1002
1003
|
const log = logger_default("pkc-js:local-community:_updateDbInternalState");
|
|
1003
|
-
if (e(
|
|
1004
|
+
if (typeof propsOrBuildProps !== "function" && e(propsOrBuildProps)) throw Error("props to update DB internal state should not be empty");
|
|
1004
1005
|
await community._dbHandler.initDbIfNeeded();
|
|
1005
|
-
props
|
|
1006
|
+
let props = typeof propsOrBuildProps === "function" ? {} : propsOrBuildProps;
|
|
1006
1007
|
let lockedIt = false;
|
|
1007
1008
|
try {
|
|
1008
1009
|
await community._dbHandler.lockCommunityState();
|
|
1009
1010
|
lockedIt = true;
|
|
1011
|
+
if (typeof propsOrBuildProps === "function") props = propsOrBuildProps();
|
|
1012
|
+
props._internalStateUpdateId = v4();
|
|
1010
1013
|
const internalStateBefore = await community._getDbInternalState(false);
|
|
1011
1014
|
const propsToStore = "posts" in props && props.posts ? {
|
|
1012
1015
|
...props,
|
|
@@ -1723,9 +1726,9 @@ var DbHandler = class {
|
|
|
1723
1726
|
if (needToMigrate) {
|
|
1724
1727
|
if (dbExistsAlready && currentDbVersion > 0) {
|
|
1725
1728
|
this.destoryConnection();
|
|
1726
|
-
backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
1727
|
-
log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
1728
|
-
if (!fs$1.existsSync(path.dirname(backupDbPath))) await fs$1.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
|
|
1729
|
+
backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
1730
|
+
log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
1731
|
+
if (!fs$1.existsSync(path$1.dirname(backupDbPath))) await fs$1.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
|
|
1729
1732
|
const sourceDb = new Database(dbPath, { fileMustExist: true });
|
|
1730
1733
|
await sourceDb.backup(backupDbPath);
|
|
1731
1734
|
sourceDb.close();
|
|
@@ -3784,10 +3787,10 @@ var DbHandler = class {
|
|
|
3784
3787
|
if (this._db || this._keyv) await this.destoryConnection();
|
|
3785
3788
|
this._transactionDepth = 0;
|
|
3786
3789
|
const dataPath = this._community._pkc.dataPath;
|
|
3787
|
-
const oldPathString = path.join(dataPath, "communities", oldDbName);
|
|
3788
|
-
const newPathString = path.join(dataPath, "communities", newDbName);
|
|
3789
|
-
await fs$1.promises.mkdir(path.dirname(oldPathString), { recursive: true });
|
|
3790
|
-
await fs$1.promises.mkdir(path.dirname(newPathString), { recursive: true });
|
|
3790
|
+
const oldPathString = path$1.join(dataPath, "communities", oldDbName);
|
|
3791
|
+
const newPathString = path$1.join(dataPath, "communities", newDbName);
|
|
3792
|
+
await fs$1.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
|
|
3793
|
+
await fs$1.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
|
|
3791
3794
|
try {
|
|
3792
3795
|
if (!fs$1.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
|
|
3793
3796
|
else {
|
|
@@ -3809,8 +3812,8 @@ var DbHandler = class {
|
|
|
3809
3812
|
}
|
|
3810
3813
|
async lockCommunityStart(communityAddress = this._community.address) {
|
|
3811
3814
|
const log = logger_default("pkc-js:local-community:db-handler:lock:start");
|
|
3812
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3813
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3815
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3816
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3814
3817
|
try {
|
|
3815
3818
|
await import_src.default.lock(communityDbPath, {
|
|
3816
3819
|
lockfilePath,
|
|
@@ -3831,8 +3834,8 @@ var DbHandler = class {
|
|
|
3831
3834
|
async unlockCommunityStart(communityAddress = this._community.address) {
|
|
3832
3835
|
const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
|
|
3833
3836
|
log.trace(`Attempting to unlock the start of community (${communityAddress})`);
|
|
3834
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3835
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3837
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3838
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3836
3839
|
if (!fs$1.existsSync(lockfilePath) || !fs$1.existsSync(communityDbPath)) return;
|
|
3837
3840
|
try {
|
|
3838
3841
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -3850,8 +3853,8 @@ var DbHandler = class {
|
|
|
3850
3853
|
}
|
|
3851
3854
|
async lockCommunityState() {
|
|
3852
3855
|
const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
|
|
3853
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3854
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3856
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3857
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3855
3858
|
try {
|
|
3856
3859
|
await import_src.default.lock(communityDbPath, {
|
|
3857
3860
|
lockfilePath,
|
|
@@ -3868,8 +3871,8 @@ var DbHandler = class {
|
|
|
3868
3871
|
}
|
|
3869
3872
|
async unlockCommunityState() {
|
|
3870
3873
|
const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
|
|
3871
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3872
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3874
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3875
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3873
3876
|
if (!fs$1.existsSync(lockfilePath)) return;
|
|
3874
3877
|
try {
|
|
3875
3878
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -3879,7 +3882,7 @@ var DbHandler = class {
|
|
|
3879
3882
|
}
|
|
3880
3883
|
}
|
|
3881
3884
|
communityDbExists() {
|
|
3882
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3885
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3883
3886
|
return fs$1.existsSync(communityDbPath);
|
|
3884
3887
|
}
|
|
3885
3888
|
markCommentsAsPublishedToPostUpdates(commentCids) {
|
|
@@ -6437,7 +6440,7 @@ async function publishCommunityRecordToIpns(community, build, newCommunityRecord
|
|
|
6437
6440
|
}
|
|
6438
6441
|
community._combinedHashOfPendingCommentsCids = newModQueue?.combinedHashOfCids || (0, import_sha256.sha256)("");
|
|
6439
6442
|
log.trace("Updated combined hash of pending comments to", community._combinedHashOfPendingCommentsCids);
|
|
6440
|
-
await community._updateDbInternalState(community.toJSONInternalAfterFirstUpdate());
|
|
6443
|
+
await community._updateDbInternalState(() => community.toJSONInternalAfterFirstUpdate());
|
|
6441
6444
|
community._changeStateEmitEventEmitStateChangeEvent({
|
|
6442
6445
|
newStartedState: "succeeded",
|
|
6443
6446
|
event: {
|
|
@@ -6663,9 +6666,33 @@ async function emitChallengeSettingsValidationErrors(community, log) {
|
|
|
6663
6666
|
community.emit("error", error);
|
|
6664
6667
|
}
|
|
6665
6668
|
}
|
|
6669
|
+
async function runAsStartOrUpdateInFlight({ community, setUp }) {
|
|
6670
|
+
let settle;
|
|
6671
|
+
const inFlight = new Promise((resolve) => settle = resolve);
|
|
6672
|
+
community._startOrUpdateInFlight = inFlight;
|
|
6673
|
+
const releaseMark = () => {
|
|
6674
|
+
if (community._startOrUpdateInFlight === inFlight) community._startOrUpdateInFlight = void 0;
|
|
6675
|
+
};
|
|
6676
|
+
try {
|
|
6677
|
+
await setUp(releaseMark);
|
|
6678
|
+
} finally {
|
|
6679
|
+
releaseMark();
|
|
6680
|
+
settle();
|
|
6681
|
+
}
|
|
6682
|
+
}
|
|
6666
6683
|
async function start(community) {
|
|
6667
|
-
const log = logger_default("pkc-js:local-community:start");
|
|
6668
6684
|
if (community.state === "updating") throw new PKCError("ERR_NEED_TO_STOP_UPDATING_COMMUNITY_BEFORE_STARTING", { address: community.address });
|
|
6685
|
+
if (community.state === "started" || community._startOrUpdateInFlight) throw new PKCError("ERR_COMMUNITY_ALREADY_STARTED", { address: community.address });
|
|
6686
|
+
await runAsStartOrUpdateInFlight({
|
|
6687
|
+
community,
|
|
6688
|
+
setUp: (releaseMark) => startCommunity({
|
|
6689
|
+
community,
|
|
6690
|
+
releaseMark
|
|
6691
|
+
})
|
|
6692
|
+
});
|
|
6693
|
+
}
|
|
6694
|
+
async function startCommunity({ community, releaseMark }) {
|
|
6695
|
+
const log = logger_default("pkc-js:local-community:start");
|
|
6669
6696
|
community._stopHasBeenCalled = false;
|
|
6670
6697
|
community._firstUpdateAfterStart = true;
|
|
6671
6698
|
community._lastProvidedBrowserDialableSelfAddrs = void 0;
|
|
@@ -6689,9 +6716,9 @@ async function start(community) {
|
|
|
6689
6716
|
pkc: community._pkc,
|
|
6690
6717
|
communityAddress: community.address
|
|
6691
6718
|
});
|
|
6719
|
+
await community._dbHandler.lockCommunityStart();
|
|
6692
6720
|
community._setState("started");
|
|
6693
6721
|
await community._updateStartedValue();
|
|
6694
|
-
await community._dbHandler.lockCommunityStart();
|
|
6695
6722
|
trackStartedCommunity(community._pkc, community);
|
|
6696
6723
|
syncProcessStartedCommunity(community);
|
|
6697
6724
|
await community._updateStartedValue();
|
|
@@ -6718,7 +6745,9 @@ async function start(community) {
|
|
|
6718
6745
|
community._pageSortFactories = void 0;
|
|
6719
6746
|
await syncPageSortsWithRegistry(community);
|
|
6720
6747
|
} catch (e) {
|
|
6748
|
+
releaseMark();
|
|
6721
6749
|
await community.stop();
|
|
6750
|
+
if (community.state === "stopped" && !community._startOrUpdateInFlight) community._dbHandler.destoryConnection();
|
|
6722
6751
|
e.details = {
|
|
6723
6752
|
...e.details,
|
|
6724
6753
|
communityAddress: community.address
|
|
@@ -6845,19 +6874,40 @@ async function updateLoop(community) {
|
|
|
6845
6874
|
async function update(community) {
|
|
6846
6875
|
if (community.state === "started") throw new PKCError("ERR_COMMUNITY_ALREADY_STARTED", { address: community.address });
|
|
6847
6876
|
if (community.state === "updating") return;
|
|
6848
|
-
community.
|
|
6849
|
-
|
|
6877
|
+
if (community._startOrUpdateInFlight) throw new PKCError("ERR_COMMUNITY_ALREADY_STARTED", { address: community.address });
|
|
6878
|
+
await runAsStartOrUpdateInFlight({
|
|
6879
|
+
community,
|
|
6880
|
+
setUp: async () => {
|
|
6881
|
+
community._stopHasBeenCalled = false;
|
|
6882
|
+
community._setState("updating");
|
|
6883
|
+
try {
|
|
6884
|
+
await updateOnce(community);
|
|
6885
|
+
} catch (e) {
|
|
6886
|
+
community.emit("error", e);
|
|
6887
|
+
}
|
|
6888
|
+
community._updateLoopAbortController = new AbortController();
|
|
6889
|
+
community._updateLoopPromise = updateLoop(community);
|
|
6890
|
+
}
|
|
6891
|
+
});
|
|
6892
|
+
}
|
|
6893
|
+
async function stop(community) {
|
|
6894
|
+
community._stopHasBeenCalled = true;
|
|
6895
|
+
while (community._startOrUpdateInFlight || community._stopInFlight || community._editStoresInFlight.size > 0) {
|
|
6896
|
+
await (community._startOrUpdateInFlight ?? community._stopInFlight ?? Promise.allSettled([...community._editStoresInFlight]));
|
|
6897
|
+
community._stopHasBeenCalled = true;
|
|
6898
|
+
}
|
|
6899
|
+
let settle;
|
|
6900
|
+
const stopInFlight = new Promise((resolve) => settle = resolve);
|
|
6901
|
+
community._stopInFlight = stopInFlight;
|
|
6850
6902
|
try {
|
|
6851
|
-
await
|
|
6852
|
-
}
|
|
6853
|
-
community.
|
|
6903
|
+
await stopCommunity(community);
|
|
6904
|
+
} finally {
|
|
6905
|
+
if (community._stopInFlight === stopInFlight) community._stopInFlight = void 0;
|
|
6906
|
+
settle();
|
|
6854
6907
|
}
|
|
6855
|
-
community._updateLoopAbortController = new AbortController();
|
|
6856
|
-
community._updateLoopPromise = updateLoop(community);
|
|
6857
6908
|
}
|
|
6858
|
-
async function
|
|
6909
|
+
async function stopCommunity(community) {
|
|
6859
6910
|
const log = logger_default("pkc-js:local-community:stop");
|
|
6860
|
-
community._stopHasBeenCalled = true;
|
|
6861
6911
|
if (community._updateLoopAbortController) community._updateLoopAbortController.abort();
|
|
6862
6912
|
community.posts._stop();
|
|
6863
6913
|
if (community.state === "started") {
|
|
@@ -6883,7 +6933,7 @@ async function stop(community) {
|
|
|
6883
6933
|
log.error("Failed to unpin stale cids and remove mfs paths before stopping", e);
|
|
6884
6934
|
}
|
|
6885
6935
|
try {
|
|
6886
|
-
await updateDbInternalState(community, community.updateCid ? community.toJSONInternalAfterFirstUpdate() : community.toJSONInternalBeforeFirstUpdate());
|
|
6936
|
+
await updateDbInternalState(community, () => community.updateCid ? community.toJSONInternalAfterFirstUpdate() : community.toJSONInternalBeforeFirstUpdate());
|
|
6887
6937
|
} catch (e) {
|
|
6888
6938
|
log.error("Failed to update db internal state before stopping", e);
|
|
6889
6939
|
}
|
|
@@ -7119,10 +7169,10 @@ async function restoreCommunityAfterFailedRename({ community, oldAddress, newAdd
|
|
|
7119
7169
|
}
|
|
7120
7170
|
}
|
|
7121
7171
|
async function removePartialDbCopy({ community, oldAddress, newAddress, log }) {
|
|
7122
|
-
const communitiesPath =
|
|
7123
|
-
if (!fs.existsSync(
|
|
7172
|
+
const communitiesPath = path.join(community._pkc.dataPath, "communities");
|
|
7173
|
+
if (!fs.existsSync(path.join(communitiesPath, oldAddress))) return;
|
|
7124
7174
|
try {
|
|
7125
|
-
await fs.promises.rm(
|
|
7175
|
+
await fs.promises.rm(path.join(communitiesPath, newAddress), { force: true });
|
|
7126
7176
|
} catch (e) {
|
|
7127
7177
|
log.error(`Failed to remove the partial DB copy of community (${oldAddress}) at ${newAddress}`, e);
|
|
7128
7178
|
}
|
|
@@ -7175,10 +7225,21 @@ async function editPropsOnStartedCommunity(community, parsedEditOptions, pagesEd
|
|
|
7175
7225
|
editId: uniqueEditId
|
|
7176
7226
|
});
|
|
7177
7227
|
await community.start();
|
|
7178
|
-
} else
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7228
|
+
} else {
|
|
7229
|
+
if (!e(parsedEditOptions)) {
|
|
7230
|
+
const store = updateDbInternalState(community, { ...parsedEditOptions });
|
|
7231
|
+
community._editStoresInFlight.add(store);
|
|
7232
|
+
try {
|
|
7233
|
+
await store;
|
|
7234
|
+
} finally {
|
|
7235
|
+
community._editStoresInFlight.delete(store);
|
|
7236
|
+
}
|
|
7237
|
+
}
|
|
7238
|
+
community._pendingEditProps.push({
|
|
7239
|
+
...parsedEditOptions,
|
|
7240
|
+
editId: uniqueEditId
|
|
7241
|
+
});
|
|
7242
|
+
}
|
|
7182
7243
|
if (community.updateCid) await community.initInternalCommunityAfterFirstUpdateNoMerge({
|
|
7183
7244
|
...community.toJSONInternalAfterFirstUpdate(),
|
|
7184
7245
|
...parsedEditOptions,
|
|
@@ -7224,6 +7285,7 @@ async function editPropsOnNotStartedCommunity(community, parsedEditOptions, page
|
|
|
7224
7285
|
return community;
|
|
7225
7286
|
}
|
|
7226
7287
|
async function edit(community, newCommunityOptions) {
|
|
7288
|
+
while (community._stopInFlight) await community._stopInFlight;
|
|
7227
7289
|
const startedCommunity = findStartedCommunity(community._pkc, {
|
|
7228
7290
|
publicKey: community.publicKey,
|
|
7229
7291
|
name: community.name
|
|
@@ -7254,6 +7316,7 @@ async function edit(community, newCommunityOptions) {
|
|
|
7254
7316
|
...n$2(editWithDerivedName, ["roles"]),
|
|
7255
7317
|
...newInternalProps
|
|
7256
7318
|
};
|
|
7319
|
+
if (community._stopInFlight) return edit(community, newCommunityOptions);
|
|
7257
7320
|
if (!community.started && !startedCommunity) return editPropsOnNotStartedCommunity(community, newProps, pagesEdit);
|
|
7258
7321
|
if (findStartedCommunity(community._pkc, {
|
|
7259
7322
|
publicKey: community.publicKey,
|
|
@@ -7266,11 +7329,11 @@ async function edit(community, newCommunityOptions) {
|
|
|
7266
7329
|
const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
|
|
7267
7330
|
function defaultExportPathFor(community, exportId) {
|
|
7268
7331
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7269
|
-
return
|
|
7332
|
+
return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
|
|
7270
7333
|
}
|
|
7271
7334
|
function sourceDbPathFor(community) {
|
|
7272
7335
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7273
|
-
return
|
|
7336
|
+
return path.join(community._pkc.dataPath, "communities", community.address);
|
|
7274
7337
|
}
|
|
7275
7338
|
async function persistExports(community) {
|
|
7276
7339
|
if (!community._dbHandler) return;
|
|
@@ -7346,9 +7409,9 @@ async function runExportTask(community, exportId, opts) {
|
|
|
7346
7409
|
async function exportCommunityEmbedded(community, options = {}) {
|
|
7347
7410
|
if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
7348
7411
|
const exportId = v4();
|
|
7349
|
-
const destPath = options.exportPath ?
|
|
7412
|
+
const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
|
|
7350
7413
|
const includePrivateKey = options.includePrivateKey === true;
|
|
7351
|
-
if (
|
|
7414
|
+
if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
|
|
7352
7415
|
communityAddress: community.address,
|
|
7353
7416
|
exportPath: destPath
|
|
7354
7417
|
});
|
|
@@ -7476,6 +7539,7 @@ var LocalCommunity = class extends RpcLocalCommunity {
|
|
|
7476
7539
|
this._inFlightPublicationExchanges = /* @__PURE__ */ new Map();
|
|
7477
7540
|
this._pseudonymityAliasLocks = /* @__PURE__ */ new Map();
|
|
7478
7541
|
this._challengeExchangeTtlMs = CHALLENGE_EXCHANGE_TTL_MS;
|
|
7542
|
+
this._slowGetChallengeWarningMs = SLOW_GET_CHALLENGE_WARNING_MS;
|
|
7479
7543
|
this._cidsToUnPin = /* @__PURE__ */ new Set();
|
|
7480
7544
|
this._mfsPathsToRemove = /* @__PURE__ */ new Set();
|
|
7481
7545
|
this._communityUpdateTriggerValue = false;
|
|
@@ -7486,6 +7550,9 @@ var LocalCommunity = class extends RpcLocalCommunity {
|
|
|
7486
7550
|
this._reportedChallengeLoadFailures = void 0;
|
|
7487
7551
|
this._publishLoopPromise = void 0;
|
|
7488
7552
|
this._updateLoopPromise = void 0;
|
|
7553
|
+
this._startOrUpdateInFlight = void 0;
|
|
7554
|
+
this._stopInFlight = void 0;
|
|
7555
|
+
this._editStoresInFlight = /* @__PURE__ */ new Set();
|
|
7489
7556
|
this._firstUpdateAfterStart = true;
|
|
7490
7557
|
this._internalStateUpdateId = "";
|
|
7491
7558
|
this._lastPubsubTopicRoutingProvideAt = void 0;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-
|
|
1
|
+
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-BY1ouP1-.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as retryKuboIpfsAdd, At as pTimeout, Bn as CommentUpdateSchema, Br as logger_default, C as hideClassPrivateProps, Cr as e$1, Ct as trackUpdatingComment, D as isIpfsCid, Dt as untrackUpdatingCommunity, E as isAbortError, Et as untrackUpdatingComment, Ft as ChallengeRequestMessageSchema, Ln as CommentUpdateForChallengeVerificationSchema, Lt as ChallengeVerificationMessageSchema, Mn as CommentIpfsSchema, Mr as require_retry$1, Nr as FailedToFetchCommentIpfsFromGatewaysError, Nt as ChallengeMessageSchema, Ot as require_sha256, Pr as FailedToFetchCommentUpdateFromGatewaysError, Rr as PKCError, Sn as PubsubTopicSchema, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tr as r, U as rejectWhenAbortSignalFires, Ur as setErrorMap, W as rejectWhenCommunityStopsOrAborts, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Yt as version_default, Z as resolveWhenPredicateIsTrue, _r as n$2, _t as listUpdatingComments, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, d as deepMergeRuntimeFields, et as retryKuboIpfsAddAndProvide, ft as findStartedCommunity, gr as isStringDomain, gt as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, jt as ChallengeAnswerMessageSchema, k as isIpns, kt as TimeoutError, ln as CommunityAnchorSchema, mn as CommunityIpfsSchema, mt as findUpdatingCommunity, nt as shortifyCid, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pt as findUpdatingComment, r as calculateIpfsCidV0, ri as en_default, rt as sleepUntilTimeoutOrAbort, st as waitForUpdateInCommunityInstanceWithErrorAndTimeout, tt as shortifyAddress, u as createAbortError, vt as listUpdatingCommunities, x as getPostUpdateTimestampRange, xr as t$1, yr as n$1, yt as refreshTrackedCommentAliases, z as linkAbortSignals, zr as messages } 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 retryKuboIpfsAdd, At as pTimeout, Bn as CommentUpdateSchema, Br as logger_default, C as hideClassPrivateProps, Cr as e$1, Ct as trackUpdatingComment, D as isIpfsCid, Dt as untrackUpdatingCommunity, E as isAbortError, Et as untrackUpdatingComment, Ft as ChallengeRequestMessageSchema, Ln as CommentUpdateForChallengeVerificationSchema, Lt as ChallengeVerificationMessageSchema, Mn as CommentIpfsSchema, Mr as require_retry$1, Nr as FailedToFetchCommentIpfsFromGatewaysError, Nt as ChallengeMessageSchema, Ot as require_sha256, Pr as FailedToFetchCommentUpdateFromGatewaysError, Rr as PKCError, Sn as PubsubTopicSchema, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tr as r, U as rejectWhenAbortSignalFires, Ur as setErrorMap, W as rejectWhenCommunityStopsOrAborts, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Yt as version_default, Z as resolveWhenPredicateIsTrue, _r as n$2, _t as listUpdatingComments, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, d as deepMergeRuntimeFields, et as retryKuboIpfsAddAndProvide, ft as findStartedCommunity, gr as isStringDomain, gt as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, jt as ChallengeAnswerMessageSchema, k as isIpns, kt as TimeoutError, ln as CommunityAnchorSchema, mn as CommunityIpfsSchema, mt as findUpdatingCommunity, nt as shortifyCid, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pt as findUpdatingComment, r as calculateIpfsCidV0, ri as en_default, rt as sleepUntilTimeoutOrAbort, st as waitForUpdateInCommunityInstanceWithErrorAndTimeout, tt as shortifyAddress, u as createAbortError, vt as listUpdatingCommunities, x as getPostUpdateTimestampRange, xr as t$1, yr as n$1, yt as refreshTrackedCommentAliases, z as linkAbortSignals, zr as messages } from "./util-Bnqvxk-6.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-BK_HGb_u.js";
|
|
4
|
+
import { s as getHeliaDebugContext } from "./util-DRSzW-LU.js";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import fs from "fs";
|
|
@@ -27973,6 +27973,9 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
27973
27973
|
return typeof exchange.challengeRequestPublishTimestamp === "number" && exchange.challengeRequestPublishTimestamp + this._setProviderFailureThresholdSeconds <= timestamp();
|
|
27974
27974
|
});
|
|
27975
27975
|
}
|
|
27976
|
+
_wasAnyChallengeRequestPublished() {
|
|
27977
|
+
return Object.values(this._challengeExchanges).some((exchange) => typeof exchange.challengeRequestPublishTimestamp === "number" && !exchange.challengeRequestPublishError);
|
|
27978
|
+
}
|
|
27976
27979
|
async _abandonProviderIfStoppedWhileSubscribing(providerUrl) {
|
|
27977
27980
|
if (!this._pkc.destroyed && this.state !== "stopped") return false;
|
|
27978
27981
|
const log = logger_default("pkc-js:publication:publish:_abandonProviderIfStoppedWhileSubscribing");
|
|
@@ -28254,8 +28257,15 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
28254
28257
|
return;
|
|
28255
28258
|
}
|
|
28256
28259
|
if (this._isAllAttemptsExhausted(providers.length)) {
|
|
28260
|
+
const aRequestWasPublished = this._wasAnyChallengeRequestPublished();
|
|
28257
28261
|
await this._postSucessOrFailurePublishing();
|
|
28258
|
-
const allAttemptsFailedError = new PKCError("
|
|
28262
|
+
const allAttemptsFailedError = aRequestWasPublished ? new PKCError("ERR_PUBSUB_DID_NOT_RECEIVE_RESPONSE_AFTER_PUBLISHING_CHALLENGE_REQUEST", {
|
|
28263
|
+
challengeExchanges: this._challengeExchangesFormattedForErrors(),
|
|
28264
|
+
pubsubTopic: this._community?.pubsubTopic,
|
|
28265
|
+
publishToDifferentProviderThresholdSeconds: this._publishToDifferentProviderThresholdSeconds,
|
|
28266
|
+
setProviderFailureThresholdSeconds: this._setProviderFailureThresholdSeconds,
|
|
28267
|
+
providerHeliaContexts: this._libp2pJsClientHeliaContexts()
|
|
28268
|
+
}) : new PKCError("ERR_ALL_PUBSUB_PROVIDERS_THROW_ERRORS", {
|
|
28259
28269
|
challengeExchanges: this._challengeExchangesFormattedForErrors(),
|
|
28260
28270
|
pubsubTopic: this._community?.pubsubTopic,
|
|
28261
28271
|
providerHeliaContexts: this._libp2pJsClientHeliaContexts()
|
|
@@ -35946,7 +35956,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
35946
35956
|
this.clients.libp2pJsClients = {};
|
|
35947
35957
|
if (!this.libp2pJsClientsOptions) return;
|
|
35948
35958
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
35949
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc
|
|
35959
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-PaZmkxgn.js");
|
|
35950
35960
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
35951
35961
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
35952
35962
|
...clientOptions,
|
|
@@ -36313,7 +36323,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
36313
36323
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
36314
36324
|
log.trace("Received community options to create a local community instance:", options);
|
|
36315
36325
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
36316
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
36326
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-CeuVhBBn.js");
|
|
36317
36327
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
36318
36328
|
const community = new LocalCommunity(this);
|
|
36319
36329
|
if (isLocalCommunity) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { gr as isStringDomain, v as getEquivalentCommunityAddresses, xn as PageSortFileSchema } from "./util-
|
|
1
|
+
import { gr as isStringDomain, v as getEquivalentCommunityAddresses, xn as PageSortFileSchema } from "./util-Bnqvxk-6.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-KgRrTYjv.js → rpc-local-community-BK_HGb_u.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 { $n as CommentEditSignedPropertyNames, $r as record, $t as CommunityEditPubsubMessagePublicationSchema, A as isIpnsPath, An as CommentChallengeRequestToEncryptSchema, Ar as t$9, At as pTimeout, B as pubsubTopicToDhtKey, Bn as CommentUpdateSchema, Br as logger_default, C as hideClassPrivateProps, Cn as RpcRemoteCommunityUpdateEventResultSchema, Cr as e$5, D as isIpfsCid, Dr as n$8, Dt as untrackUpdatingCommunity, E as isAbortError, En as VotePubsubMessagePublicationSchema, Er as t$12, Fn as CommentSignedPropertyNames, Fr as FailedToFetchCommunityFromGatewaysError, Gn as GetPageParamSchema, Gr as array, Gt as NameResolverSerializedSchema, H as raceAgainstAbort, Hr as require_ms$1, Ht as DecryptedChallengeSchema, In as CommentUpdateChallengeReservedFieldNames, Ir as FailedToFetchGenericIpfsFromGatewaysError, It as ChallengeRequestMessageSignedPropertyNames, Jn as isReservedObjectKey, Jr as literal, Jt as PKCUserOptionsSchema, Kn as ModQueuePageIpfsSchema, Kr as boolean, Kt as PKCParsedOptionsSchema, L as isRequestPubsubPublicationOfPost, Lr as FailedToFetchPageIpfsFromGatewaysError, Mn as CommentIpfsSchema, Mr as require_retry$2, Mt as ChallengeAnswerMessageSignedPropertyNames, Nr as FailedToFetchCommentIpfsFromGatewaysError, O as isIpfsPath, On as VoteSignedPropertyNames, Or as r$7, Ot as require_sha256$1, Pn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Pr as FailedToFetchCommentUpdateFromGatewaysError, Pt as ChallengeMessageSignedPropertyNames, Qr as preprocess, Qt as CommunityEditPublicationSignedPropertyNames, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateForChallengeVerificationSignedPropertyNames, Rr as PKCError, Rt as ChallengeVerificationMessageSignedPropertyNames, S as hasTransientNetworkErrorCode, Sr as e$6, St as trackStartedCommunity, T as ipnsNameToIpnsOverPubsubTopic, Tn as VoteChallengeRequestToEncryptSchema, Tr as r$8, Tt as untrackStartedCommunity, Ut as DecryptedChallengeVerificationSchema, Vn as CommentUpdateSignedPropertyNames, Vr as require_supports_color, Wn as CreateCommentOptionsWithRefinementSchema, Wr as _enum, Wt as NameResolveCacheOptionsSchema, Xr as number, Xt as CommunityEditPublicationChallengeRequestToEncryptSchema, Yn as CommentEditChallengeRequestToEncryptSchema, Yr as looseObject, Zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Zr as object, _n as CreateRemoteCommunityFunctionArgumentSchema, _r as n$9, an as CommentModerationsTableRowSchema, ar as AuthorReservedFields, at as throwIfAbortSignalAborted, bn as PageSortFileFactorySchema, bt as refreshTrackedCommunityAliases, cn as ChallengeFileSchema, cr as CidStringSchema, d as deepMergeRuntimeFields, dn as CommunityEditOptionsSchema, dr as CreateSignerSchema, ei as string, en as CreateCommunityEditPublicationOptionsWithRefinementSchema, f as derivePublicationFromChallengeRequest, fn as CommunityExportRecordsSchema, fr as JsonSignatureSchema, ft as findStartedCommunity, gn as CreateNewLocalCommunityUserOptionsSchema, gr as isStringDomain, h as fetchAndValidateIpnsRecordFromGateway, hn as CommunitySignedPropertyNames, hr as areEquivalentNames, ht as forgetTrackedUpdatingCommunityName, in as CommentModerationSignedPropertyNames, ir as AuthorPubsubSchema, jn as CommentIpfsReservedFields, jr as e$4, k as isIpns, kr as t$10, lr as CommunityAddressSchema, m as extractNetworkErrorDetails, mn as CommunityIpfsSchema, mr as ProtocolVersionSchema, mt as findUpdatingCommunity, nn as CommentModerationPubsubMessagePublicationSchema, nr as AuthorAddressSchema, nt as shortifyCid, on as CreateCommentModerationOptionsWithRefinementSchema, or as ChallengeAnswersSchema, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsReservedFields, pr as PKCTimestampSchema, q as removeNullUndefinedEmptyObjectsValuesRecursively, qn as PageIpfsSchema, qr as custom, qt as PKCUserOptionBaseSchema, r as calculateIpfsCidV0, rr as AuthorCommentIpfsReservedFields, rt as sleepUntilTimeoutOrAbort, sn as ChallengeFileFactorySchema, sr as CidPathSchema, t as areEquivalentCommunityAddresses, ti as union, tn as CommentModerationChallengeRequestToEncryptSchema, tr as CreateCommentEditOptionsWithRefinementSchema, tt as shortifyAddress, u as createAbortError, un as CommunityChallengeSettingSchema, ur as CommunityAuthorChallengeReservedFieldNames, vn as CreateRpcCommunityFunctionArgumentSchema, w as interruptibleSleep, wn as CreateVoteUserOptionsWithRefinementSchema, wr as t$11, wt as trackUpdatingCommunity, xn as PageSortFileSchema, xr as t$13, yn as ExportCommunityModLogsOptionsSchema, yr as n$10, z as linkAbortSignals, zn as CommentUpdateReservedFields, zr as messages, zt as DecryptedChallengeAnswerSchema } from "./util-
|
|
2
|
+
import { $n as CommentEditSignedPropertyNames, $r as record, $t as CommunityEditPubsubMessagePublicationSchema, A as isIpnsPath, An as CommentChallengeRequestToEncryptSchema, Ar as t$9, At as pTimeout, B as pubsubTopicToDhtKey, Bn as CommentUpdateSchema, Br as logger_default, C as hideClassPrivateProps, Cn as RpcRemoteCommunityUpdateEventResultSchema, Cr as e$5, D as isIpfsCid, Dr as n$8, Dt as untrackUpdatingCommunity, E as isAbortError, En as VotePubsubMessagePublicationSchema, Er as t$12, Fn as CommentSignedPropertyNames, Fr as FailedToFetchCommunityFromGatewaysError, Gn as GetPageParamSchema, Gr as array, Gt as NameResolverSerializedSchema, H as raceAgainstAbort, Hr as require_ms$1, Ht as DecryptedChallengeSchema, In as CommentUpdateChallengeReservedFieldNames, Ir as FailedToFetchGenericIpfsFromGatewaysError, It as ChallengeRequestMessageSignedPropertyNames, Jn as isReservedObjectKey, Jr as literal, Jt as PKCUserOptionsSchema, Kn as ModQueuePageIpfsSchema, Kr as boolean, Kt as PKCParsedOptionsSchema, L as isRequestPubsubPublicationOfPost, Lr as FailedToFetchPageIpfsFromGatewaysError, Mn as CommentIpfsSchema, Mr as require_retry$2, Mt as ChallengeAnswerMessageSignedPropertyNames, Nr as FailedToFetchCommentIpfsFromGatewaysError, O as isIpfsPath, On as VoteSignedPropertyNames, Or as r$7, Ot as require_sha256$1, Pn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Pr as FailedToFetchCommentUpdateFromGatewaysError, Pt as ChallengeMessageSignedPropertyNames, Qr as preprocess, Qt as CommunityEditPublicationSignedPropertyNames, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateForChallengeVerificationSignedPropertyNames, Rr as PKCError, Rt as ChallengeVerificationMessageSignedPropertyNames, S as hasTransientNetworkErrorCode, Sr as e$6, St as trackStartedCommunity, T as ipnsNameToIpnsOverPubsubTopic, Tn as VoteChallengeRequestToEncryptSchema, Tr as r$8, Tt as untrackStartedCommunity, Ut as DecryptedChallengeVerificationSchema, Vn as CommentUpdateSignedPropertyNames, Vr as require_supports_color, Wn as CreateCommentOptionsWithRefinementSchema, Wr as _enum, Wt as NameResolveCacheOptionsSchema, Xr as number, Xt as CommunityEditPublicationChallengeRequestToEncryptSchema, Yn as CommentEditChallengeRequestToEncryptSchema, Yr as looseObject, Zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Zr as object, _n as CreateRemoteCommunityFunctionArgumentSchema, _r as n$9, an as CommentModerationsTableRowSchema, ar as AuthorReservedFields, at as throwIfAbortSignalAborted, bn as PageSortFileFactorySchema, bt as refreshTrackedCommunityAliases, cn as ChallengeFileSchema, cr as CidStringSchema, d as deepMergeRuntimeFields, dn as CommunityEditOptionsSchema, dr as CreateSignerSchema, ei as string, en as CreateCommunityEditPublicationOptionsWithRefinementSchema, f as derivePublicationFromChallengeRequest, fn as CommunityExportRecordsSchema, fr as JsonSignatureSchema, ft as findStartedCommunity, gn as CreateNewLocalCommunityUserOptionsSchema, gr as isStringDomain, h as fetchAndValidateIpnsRecordFromGateway, hn as CommunitySignedPropertyNames, hr as areEquivalentNames, ht as forgetTrackedUpdatingCommunityName, in as CommentModerationSignedPropertyNames, ir as AuthorPubsubSchema, jn as CommentIpfsReservedFields, jr as e$4, k as isIpns, kr as t$10, lr as CommunityAddressSchema, m as extractNetworkErrorDetails, mn as CommunityIpfsSchema, mr as ProtocolVersionSchema, mt as findUpdatingCommunity, nn as CommentModerationPubsubMessagePublicationSchema, nr as AuthorAddressSchema, nt as shortifyCid, on as CreateCommentModerationOptionsWithRefinementSchema, or as ChallengeAnswersSchema, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsReservedFields, pr as PKCTimestampSchema, q as removeNullUndefinedEmptyObjectsValuesRecursively, qn as PageIpfsSchema, qr as custom, qt as PKCUserOptionBaseSchema, r as calculateIpfsCidV0, rr as AuthorCommentIpfsReservedFields, rt as sleepUntilTimeoutOrAbort, sn as ChallengeFileFactorySchema, sr as CidPathSchema, t as areEquivalentCommunityAddresses, ti as union, tn as CommentModerationChallengeRequestToEncryptSchema, tr as CreateCommentEditOptionsWithRefinementSchema, tt as shortifyAddress, u as createAbortError, un as CommunityChallengeSettingSchema, ur as CommunityAuthorChallengeReservedFieldNames, vn as CreateRpcCommunityFunctionArgumentSchema, w as interruptibleSleep, wn as CreateVoteUserOptionsWithRefinementSchema, wr as t$11, wt as trackUpdatingCommunity, xn as PageSortFileSchema, xr as t$13, yn as ExportCommunityModLogsOptionsSchema, yr as n$10, z as linkAbortSignals, zn as CommentUpdateReservedFields, zr as messages, zt as DecryptedChallengeAnswerSchema } from "./util-Bnqvxk-6.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-DgSzIxmE.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import dns from "node:dns";
|
|
@@ -154632,6 +154632,12 @@ const loadChallengeFile = async ({ communityChallengeSettings, challengeIndex, c
|
|
|
154632
154632
|
};
|
|
154633
154633
|
const callGetChallenge = async ({ challengeFile, communityChallengeSettings, challengeRequestMessage, challengeIndex, community, authorIdentityMatcher }) => {
|
|
154634
154634
|
let challengeOrChallengeResult;
|
|
154635
|
+
const challengeName = communityChallengeSettings.name || communityChallengeSettings.path;
|
|
154636
|
+
const startedAtMs = Date.now();
|
|
154637
|
+
const slowWarningTimer = setTimeout(() => {
|
|
154638
|
+
logger_default("pkc-js:local-community:challenges:callGetChallenge").error(`getChallenge() of challenge ${challengeIndex + 1} (${challengeName}) in community ${community.address} is still running after ${community._slowGetChallengeWarningMs / 1e3}s.`, "A publisher that receives no challenge or verification gives up after about two minutes and the publication looks failed to its author.", "Slow work belongs behind pendingApproval. challengeRequestId:", challengeRequestMessage.challengeRequestId.toString());
|
|
154639
|
+
}, community._slowGetChallengeWarningMs);
|
|
154640
|
+
slowWarningTimer.unref?.();
|
|
154635
154641
|
try {
|
|
154636
154642
|
challengeOrChallengeResult = await challengeFile.getChallenge({
|
|
154637
154643
|
challengeSettings: communityChallengeSettings,
|
|
@@ -154640,6 +154646,8 @@ const callGetChallenge = async ({ challengeFile, communityChallengeSettings, cha
|
|
|
154640
154646
|
community,
|
|
154641
154647
|
authorIdentityMatcher
|
|
154642
154648
|
});
|
|
154649
|
+
const elapsedMs = Date.now() - startedAtMs;
|
|
154650
|
+
if (elapsedMs >= community._slowGetChallengeWarningMs) logger_default("pkc-js:local-community:challenges:callGetChallenge").error(`getChallenge() of challenge ${challengeIndex + 1} (${challengeName}) in community ${community.address} took ${Math.round(elapsedMs / 1e3)}s`);
|
|
154643
154651
|
validateChallengeOrChallengeResult({
|
|
154644
154652
|
challengeOrChallengeResult,
|
|
154645
154653
|
challengeIndex,
|
|
@@ -154653,6 +154661,8 @@ const callGetChallenge = async ({ challengeFile, communityChallengeSettings, cha
|
|
|
154653
154661
|
challengeIndex: challengeIndex + 1,
|
|
154654
154662
|
error: e
|
|
154655
154663
|
});
|
|
154664
|
+
} finally {
|
|
154665
|
+
clearTimeout(slowWarningTimer);
|
|
154656
154666
|
}
|
|
154657
154667
|
return { challengeOrChallengeResult };
|
|
154658
154668
|
};
|
|
@@ -16553,7 +16553,7 @@ const CommunityEditPublicationPubsubReservedFields = r$2([
|
|
|
16553
16553
|
], t$3(CommunityEditPubsubMessagePublicationSchema.shape));
|
|
16554
16554
|
//#endregion
|
|
16555
16555
|
//#region dist/node/generated-version.js
|
|
16556
|
-
const version = "0.0.
|
|
16556
|
+
const version = "0.0.146";
|
|
16557
16557
|
//#endregion
|
|
16558
16558
|
//#region dist/node/version.js
|
|
16559
16559
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Rr as PKCError, V as pubsubTopicToDhtKeyCid } from "./util-
|
|
1
|
+
import { Rr as PKCError, V as pubsubTopicToDhtKeyCid } from "./util-Bnqvxk-6.js";
|
|
2
2
|
import { ipnsSelector } from "ipns/selector";
|
|
3
3
|
import { ipnsValidator } from "ipns/validator";
|
|
4
4
|
import { unmarshalIPNSRecord } from "ipns";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Rr as PKCError, bn as PageSortFileFactorySchema, cn as ChallengeFileSchema, sn as ChallengeFileFactorySchema } from "./util-
|
|
2
|
-
import { s as validatePageSortFile } from "./page-sort-scoring-
|
|
1
|
+
import { Rr as PKCError, bn as PageSortFileFactorySchema, cn as ChallengeFileSchema, sn as ChallengeFileFactorySchema } from "./util-Bnqvxk-6.js";
|
|
2
|
+
import { s as validatePageSortFile } from "./page-sort-scoring-DgSzIxmE.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-BXilwSVE.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-MG5ehoSU.js";
|
|
2
2
|
export { validatePageSortFileFactory };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { At as pTimeout, Br as logger_default, C as hideClassPrivateProps, Rr as PKCError, X as replaceXWithY, et as retryKuboIpfsAddAndProvide, ft as findStartedCommunity, i as calculateStringSizeSameAsIpfsAddCidV0, xr as t, yr as n } 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 { At as pTimeout, Br as logger_default, C as hideClassPrivateProps, Rr as PKCError, X as replaceXWithY, et as retryKuboIpfsAddAndProvide, ft as findStartedCommunity, i as calculateStringSizeSameAsIpfsAddCidV0, xr as t, yr as n } from "../../chunks/util-Bnqvxk-6.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-BXilwSVE.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-BK_HGb_u.js";
|
|
4
|
+
import { t as LocalCommunity } from "../../chunks/local-community-BY1ouP1-.js";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import assert from "assert";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.146";
|
|
@@ -117,6 +117,7 @@ declare class Publication extends TypedEmitter<PublicationEvents> {
|
|
|
117
117
|
_fetchCommunityForPublishing(): Promise<NonNullable<Publication["_community"]>>;
|
|
118
118
|
stop(): Promise<void>;
|
|
119
119
|
_isAllAttemptsExhausted(maxNumOfChallengeExchanges: number): boolean;
|
|
120
|
+
private _wasAnyChallengeRequestPublished;
|
|
120
121
|
private _abandonProviderIfStoppedWhileSubscribing;
|
|
121
122
|
private _unregisterFromPkcOncePublishWorkSettles;
|
|
122
123
|
private _postSucessOrFailurePublishing;
|