@pkcprotocol/pkc-js 0.0.157 → 0.0.158
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 +55 -3
- package/dist/browser/clients/rpc-client/schema.d.ts +1 -0
- package/dist/browser/community/schema.d.ts +13 -0
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/index-with-compile-cache.d.ts +2 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/pages/schema.d.ts +3 -0
- package/dist/browser/publications/comment/comment.d.ts +1 -0
- package/dist/browser/publications/comment/comment.js +1 -0
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/publications/comment/schema.d.ts +4 -2
- package/dist/browser/publications/comment/schema.js +2 -0
- package/dist/browser/publications/comment/schema.js.map +1 -1
- package/dist/browser/publications/comment-moderation/schema.js +2 -2
- package/dist/browser/publications/comment-moderation/schema.js.map +1 -1
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +2 -0
- package/dist/browser/rpc/src/schema.d.ts +12 -0
- package/dist/browser/runtime/node/community/db-handler.d.ts +1 -0
- package/dist/browser/runtime/node/community/db-handler.js +28 -5
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/cleanup.js +6 -0
- package/dist/browser/runtime/node/community/local-community/cleanup.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +36 -2
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/post-updates-bucket.d.ts +21 -0
- package/dist/browser/runtime/node/community/local-community/post-updates-bucket.js +141 -4
- package/dist/browser/runtime/node/community/local-community/post-updates-bucket.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community.d.ts +3 -0
- package/dist/browser/runtime/node/community/local-community.js +11 -0
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +5 -0
- package/dist/browser/schema/schema.d.ts +9 -0
- package/dist/browser/schema/schema.js +9 -1
- package/dist/browser/schema/schema.js.map +1 -1
- package/dist/browser/schema.d.ts +16 -0
- package/dist/browser/test/test-util.d.ts +5 -0
- package/dist/browser/version.js +1 -1
- package/dist/bundled/bundle-manifest.json +47 -47
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc-BT2UmDem.js → helia-for-pkc-D3uvabO4.js} +2 -2
- package/dist/bundled/chunks/{local-community-BexngGU7.js → local-community-ChB5dbEH.js} +1 -1
- package/dist/bundled/chunks/{local-community-oqjqTa9T.js → local-community-SgssDrxj.js} +198 -22
- package/dist/bundled/chunks/{node-CvXtQ-4A.js → node-Bx3xTqFv.js} +6 -5
- package/dist/bundled/chunks/{page-sort-scoring-VN_GGInQ.js → page-sort-scoring-CZmdHvps.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-BjIHRbYy.js → rpc-local-community-D66Be62U.js} +2 -2
- package/dist/bundled/chunks/{util-DDsWXOtP.js → util-BuTE1Bd1.js} +7 -8
- package/dist/bundled/chunks/{util-Bu3ItQsN.js → util-CodXreIl.js} +1 -1
- package/dist/bundled/chunks/{validate-package-factories-CmJt781W.js → validate-package-factories-Bc4uoozL.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/schema.d.ts +1 -0
- package/dist/node/community/schema.d.ts +13 -0
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/index-with-compile-cache.d.ts +2 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/pages/schema.d.ts +3 -0
- package/dist/node/publications/comment/comment.d.ts +1 -0
- package/dist/node/publications/comment/comment.js +1 -0
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/publications/comment/schema.d.ts +4 -2
- package/dist/node/publications/comment/schema.js +2 -0
- package/dist/node/publications/comment/schema.js.map +1 -1
- package/dist/node/publications/comment-moderation/schema.js +2 -2
- package/dist/node/publications/comment-moderation/schema.js.map +1 -1
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +2 -0
- package/dist/node/rpc/src/schema.d.ts +12 -0
- package/dist/node/runtime/node/community/db-handler.d.ts +1 -0
- package/dist/node/runtime/node/community/db-handler.js +28 -5
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/cleanup.js +6 -0
- package/dist/node/runtime/node/community/local-community/cleanup.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js +36 -2
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/post-updates-bucket.d.ts +21 -0
- package/dist/node/runtime/node/community/local-community/post-updates-bucket.js +141 -4
- package/dist/node/runtime/node/community/local-community/post-updates-bucket.js.map +1 -1
- package/dist/node/runtime/node/community/local-community.d.ts +3 -0
- package/dist/node/runtime/node/community/local-community.js +11 -0
- package/dist/node/runtime/node/community/local-community.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +5 -0
- package/dist/node/schema/schema.d.ts +9 -0
- package/dist/node/schema/schema.js +9 -1
- package/dist/node/schema/schema.js.map +1 -1
- package/dist/node/schema.d.ts +16 -0
- package/dist/node/test/test-util.d.ts +5 -0
- package/dist/node/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $n as CommentEditsTableRowSchema, Ar as t$4, At as ChallengeAnswerMessageSchema, B as pubsubTopicToDhtKey, Br as messages, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Cr as e$1, Ct as trackUpdatingCommunity, Dr as t$3, Dt as require_sha256, En as VotePubsubReservedFields, Er as r$1, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeBlocksFromKuboNode, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, J as removeNullUndefinedValues, Jt as version_default, K as removeMfsFilesSafely, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, Nr as require_retry, On as VoteTablesRowSchema, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Sr as t$6, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Vn as CommentUpdateTableRowSchema, Vr as logger_default, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Zn as CommentEditReservedFields, _ as genToArray, b as getIpnsRecordInLocalKuboNode, br as n$2, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as withSortedKeysDeep, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, o as calculateUnixFsDagSizeCidV0, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, ri as ZodError, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$3, wr as e, wt as untrackStartedCommunity, xr as t$5, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$7, zn as CommentUpdateSchema, zr as PKCError, zt as DecryptedChallengeRequestPublicationSchema } from "./util-
|
|
3
|
-
import { $ as coerceSchemaRowJson, $n as getAuthorNameFromWire, $r as n$5, Ar as getDefaultCommunityDbConfig, Bn as verifyCommentPubsubMessage, Br as resolveDbPostsCidRefs, Cn as signChallengeVerification, Dn as signCommentUpdate, Dr as deriveDbReplies, Er as deriveDbPosts, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Fn as verifyChallengeRequest, Gn as verifyVote, Gr as markCommunityDbAsBeingWritten, H as listSubscribedPubsubTopicsShared, Hn as verifyCommunity, K as pLimit, Kr as findCommunitiesEntry, Ln as verifyCommentEdit, Lr as moveCommunityDbToDeletedDirectory, Mr as getThumbnailPropsOfLink, N as MAX_PAGE_SIZE_BYTES, Nn as verifyChallengeAnswer, Nr as importSignerIntoKuboNode, On as signCommentUpdateForChallengeVerification, Q as coerceSchemaRowBoolean, Qr as t$8, Rn as verifyCommentIpfs, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sr as calculateInlineRepliesBudget, Tn as signCommentEdit, Tr as deriveCommentIpfsFromCommentTableRow, Un as verifyCommunityEdit, Ur as unregisterLocalCommunity, V as SHARED_KUBO_READ_TIMEOUT_MS, Vn as verifyCommentUpdate, Wr as getCommunitiesRegistry, Xn as buildRuntimeAuthor, Xr as t$11, Yr as t$10, Zn as cleanWireAuthor, Zr as r$2, _ as createAuthorIdentityMatcher, _n as encryptEd25519AesGcmPublicKeyBuffer, _r as getPKCAddressFromPublicKeySync, a as generatePagesReportingFailedSorts, ar as crosspostChainDepthUpTo, b as KeyvBetterSqlite3, br as backupCommunityDb, c as resolvePageSortsOrThrow, ci as require_lodash_merge, d as getChallengeVerification, dn as SignerWithPublicKeyAddress, ei as n$4, et as collectSchemaRowCoercions, f as getCommunityChallengeFromCommunityChallengeSettings, fr as decode, g as authorNameResolveFailureReason, gr as getPKCAddressFromPublicKey, h as authorIdentityMatcherForRequest, hn as decryptEd25519AesGcmPublicKeyBuffer, hr as getIpfsKeyFromPrivateKey, ht as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, i as derivePublicPageSorts, j as iterateOverPageCidsToFindAllCids, kn as signCommunity, kr as forgetCommunityThatFailedToBeDeleted, kt as parseJsonWithPKCErrorIfFails, ln as verifyAuthorWalletEntry, lr as getCommunityNameFromWire, m as pkcJsChallenges, ni as t$9, o as loadPageSortsForStartedCommunity, or as effectiveMaxCrosspostDepth, p as loadChallengeFileFromCommunityChallengeSettings, pr as encode, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, qn as forbiddenKeysOf, r as computePageSortsFingerprint, s as lookupPageSortFactories, si as STORAGE_KEYS, t as RpcLocalCommunity, tr as stringify, tt as createSchemaRowParser, u as deriveCommunityChallengesOrThrow, ur as getCommunityPublicKeyFromWire, v as TrackedInstanceRegistry, vn as _validateSignatureOfPKCRecord, vr as getPublicKeyFromPrivateKey, w as TIMEFRAMES_TO_SECONDS, wn as signComment, wr as deleteOldCommunityInWindows, xn as signChallengeMessage, xr as calculateExpectedSignatureSize, y as LRUCache, yn as cleanUpBeforePublishing, yr as BackupAbortError, zn as verifyCommentModeration, zr as removeFileRetryingWhileBusy } 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 { $n as CommentEditsTableRowSchema, Ar as t$4, At as ChallengeAnswerMessageSchema, B as pubsubTopicToDhtKey, Br as messages, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Cr as e$1, Ct as trackUpdatingCommunity, Dr as t$3, Dt as require_sha256, En as VotePubsubReservedFields, Er as r$1, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeBlocksFromKuboNode, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, J as removeNullUndefinedValues, Jt as version_default, K as removeMfsFilesSafely, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, Nr as require_retry, On as VoteTablesRowSchema, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Sr as t$6, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Vn as CommentUpdateTableRowSchema, Vr as logger_default, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Zn as CommentEditReservedFields, _ as genToArray, b as getIpnsRecordInLocalKuboNode, br as n$2, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as withSortedKeysDeep, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, o as calculateUnixFsDagSizeCidV0, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, ri as ZodError, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$3, wr as e, wt as untrackStartedCommunity, xr as t$5, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$7, zn as CommentUpdateSchema, zr as PKCError, zt as DecryptedChallengeRequestPublicationSchema } from "./util-BuTE1Bd1.js";
|
|
3
|
+
import { $ as coerceSchemaRowJson, $n as getAuthorNameFromWire, $r as n$5, Ar as getDefaultCommunityDbConfig, Bn as verifyCommentPubsubMessage, Br as resolveDbPostsCidRefs, Cn as signChallengeVerification, Dn as signCommentUpdate, Dr as deriveDbReplies, Er as deriveDbPosts, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Fn as verifyChallengeRequest, Gn as verifyVote, Gr as markCommunityDbAsBeingWritten, H as listSubscribedPubsubTopicsShared, Hn as verifyCommunity, K as pLimit, Kr as findCommunitiesEntry, Ln as verifyCommentEdit, Lr as moveCommunityDbToDeletedDirectory, Mr as getThumbnailPropsOfLink, N as MAX_PAGE_SIZE_BYTES, Nn as verifyChallengeAnswer, Nr as importSignerIntoKuboNode, On as signCommentUpdateForChallengeVerification, Q as coerceSchemaRowBoolean, Qr as t$8, Rn as verifyCommentIpfs, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sr as calculateInlineRepliesBudget, Tn as signCommentEdit, Tr as deriveCommentIpfsFromCommentTableRow, Un as verifyCommunityEdit, Ur as unregisterLocalCommunity, V as SHARED_KUBO_READ_TIMEOUT_MS, Vn as verifyCommentUpdate, Wr as getCommunitiesRegistry, Xn as buildRuntimeAuthor, Xr as t$11, Yr as t$10, Zn as cleanWireAuthor, Zr as r$2, _ as createAuthorIdentityMatcher, _n as encryptEd25519AesGcmPublicKeyBuffer, _r as getPKCAddressFromPublicKeySync, a as generatePagesReportingFailedSorts, ar as crosspostChainDepthUpTo, b as KeyvBetterSqlite3, br as backupCommunityDb, c as resolvePageSortsOrThrow, ci as require_lodash_merge, d as getChallengeVerification, dn as SignerWithPublicKeyAddress, ei as n$4, et as collectSchemaRowCoercions, f as getCommunityChallengeFromCommunityChallengeSettings, fr as decode, g as authorNameResolveFailureReason, gr as getPKCAddressFromPublicKey, h as authorIdentityMatcherForRequest, hn as decryptEd25519AesGcmPublicKeyBuffer, hr as getIpfsKeyFromPrivateKey, ht as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, i as derivePublicPageSorts, j as iterateOverPageCidsToFindAllCids, kn as signCommunity, kr as forgetCommunityThatFailedToBeDeleted, kt as parseJsonWithPKCErrorIfFails, ln as verifyAuthorWalletEntry, lr as getCommunityNameFromWire, m as pkcJsChallenges, ni as t$9, o as loadPageSortsForStartedCommunity, or as effectiveMaxCrosspostDepth, p as loadChallengeFileFromCommunityChallengeSettings, pr as encode, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, qn as forbiddenKeysOf, r as computePageSortsFingerprint, s as lookupPageSortFactories, si as STORAGE_KEYS, t as RpcLocalCommunity, tr as stringify, tt as createSchemaRowParser, u as deriveCommunityChallengesOrThrow, ur as getCommunityPublicKeyFromWire, v as TrackedInstanceRegistry, vn as _validateSignatureOfPKCRecord, vr as getPublicKeyFromPrivateKey, w as TIMEFRAMES_TO_SECONDS, wn as signComment, wr as deleteOldCommunityInWindows, xn as signChallengeMessage, xr as calculateExpectedSignatureSize, y as LRUCache, yn as cleanUpBeforePublishing, yr as BackupAbortError, zn as verifyCommentModeration, zr as removeFileRetryingWhileBusy } from "./rpc-local-community-D66Be62U.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-CZmdHvps.js";
|
|
5
5
|
import { c as prepare, n as decode$1, r as encode$1 } from "./src-BSYNGtIQ.js";
|
|
6
6
|
import { t as UnixFS } from "./src-CAvdjq_i.js";
|
|
7
7
|
import { monitorEventLoopDelay } from "node:perf_hooks";
|
|
@@ -1450,6 +1450,9 @@ const TABLES = Object.freeze({
|
|
|
1450
1450
|
COMMENT_EDITS: "commentEdits",
|
|
1451
1451
|
PSEUDONYMITY_ALIASES: "pseudonymityAliases"
|
|
1452
1452
|
});
|
|
1453
|
+
function isAuthorBanRow(modEdit) {
|
|
1454
|
+
return typeof modEdit?.banExpiresAt === "number" && modEdit.banExpiresAt > 0;
|
|
1455
|
+
}
|
|
1453
1456
|
function deriveAliasOriginalAuthorSignerAddress(originalAuthorPublicKey) {
|
|
1454
1457
|
try {
|
|
1455
1458
|
return getPKCAddressFromPublicKeySync(originalAuthorPublicKey);
|
|
@@ -1707,6 +1710,7 @@ var DbHandler = class {
|
|
|
1707
1710
|
removed INTEGER NULLABLE, -- BOOLEAN (0/1)
|
|
1708
1711
|
approved INTEGER NULLABLE, -- BOOLEAN (0/1)
|
|
1709
1712
|
reason TEXT NULLABLE,
|
|
1713
|
+
authorBanExpiresAt INTEGER NULLABLE, -- the ban a mod published on this comment (issue #363)
|
|
1710
1714
|
updatedAt INTEGER NOT NULL CHECK(updatedAt > 0),
|
|
1711
1715
|
protocolVersion TEXT NOT NULL,
|
|
1712
1716
|
signature TEXT NOT NULL, -- JSON
|
|
@@ -2319,14 +2323,14 @@ var DbHandler = class {
|
|
|
2319
2323
|
const columnNames = this._getColumnNames(TABLES.COMMENT_UPDATES);
|
|
2320
2324
|
const stmt = this._prepareCached(`
|
|
2321
2325
|
INSERT INTO ${TABLES.COMMENT_UPDATES}
|
|
2322
|
-
(cid, edit, upvoteCount, downvoteCount, replyCount, childCount, number, postNumber, flairs, spoiler, nsfw, pinned, locked, archived, removed, approved, reason, updatedAt, protocolVersion, signature, author, replies, lastChildCid, lastReplyTimestamp, postUpdatesBucket, publishedToPostUpdatesMFS, insertedAt, extraProps)
|
|
2323
|
-
VALUES (@cid, @edit, @upvoteCount, @downvoteCount, @replyCount, @childCount, @number, @postNumber, @flairs, @spoiler, @nsfw, @pinned, @locked, @archived, @removed, @approved, @reason, @updatedAt, @protocolVersion, @signature, @author, @replies, @lastChildCid, @lastReplyTimestamp, @postUpdatesBucket, @publishedToPostUpdatesMFS, @insertedAt, @extraProps)
|
|
2326
|
+
(cid, edit, upvoteCount, downvoteCount, replyCount, childCount, number, postNumber, flairs, spoiler, nsfw, pinned, locked, archived, removed, approved, reason, authorBanExpiresAt, updatedAt, protocolVersion, signature, author, replies, lastChildCid, lastReplyTimestamp, postUpdatesBucket, publishedToPostUpdatesMFS, insertedAt, extraProps)
|
|
2327
|
+
VALUES (@cid, @edit, @upvoteCount, @downvoteCount, @replyCount, @childCount, @number, @postNumber, @flairs, @spoiler, @nsfw, @pinned, @locked, @archived, @removed, @approved, @reason, @authorBanExpiresAt, @updatedAt, @protocolVersion, @signature, @author, @replies, @lastChildCid, @lastReplyTimestamp, @postUpdatesBucket, @publishedToPostUpdatesMFS, @insertedAt, @extraProps)
|
|
2324
2328
|
ON CONFLICT(cid) DO UPDATE SET
|
|
2325
2329
|
edit = excluded.edit, upvoteCount = excluded.upvoteCount, downvoteCount = excluded.downvoteCount, replyCount = excluded.replyCount, childCount = excluded.childCount,
|
|
2326
2330
|
number = COALESCE(excluded.number, ${TABLES.COMMENT_UPDATES}.number),
|
|
2327
2331
|
postNumber = COALESCE(excluded.postNumber, ${TABLES.COMMENT_UPDATES}.postNumber),
|
|
2328
2332
|
flairs = excluded.flairs, spoiler = excluded.spoiler, nsfw = excluded.nsfw, pinned = excluded.pinned, locked = excluded.locked, archived = excluded.archived,
|
|
2329
|
-
removed = excluded.removed, approved = excluded.approved, reason = excluded.reason, updatedAt = excluded.updatedAt, protocolVersion = excluded.protocolVersion,
|
|
2333
|
+
removed = excluded.removed, approved = excluded.approved, reason = excluded.reason, authorBanExpiresAt = excluded.authorBanExpiresAt, updatedAt = excluded.updatedAt, protocolVersion = excluded.protocolVersion,
|
|
2330
2334
|
signature = excluded.signature, author = excluded.author, replies = excluded.replies, lastChildCid = excluded.lastChildCid,
|
|
2331
2335
|
lastReplyTimestamp = excluded.lastReplyTimestamp, postUpdatesBucket = excluded.postUpdatesBucket,
|
|
2332
2336
|
publishedToPostUpdatesMFS = excluded.publishedToPostUpdatesMFS,
|
|
@@ -3362,6 +3366,7 @@ var DbHandler = class {
|
|
|
3362
3366
|
flairs: moderation?.flairs || authorEdit?.flairs || comment.challengeCommentUpdate?.flairs,
|
|
3363
3367
|
...moderation?.flags,
|
|
3364
3368
|
reason: moderation?.reason ?? comment.challengeCommentUpdate?.reason,
|
|
3369
|
+
authorBanExpiresAt: moderation?.authorBanExpiresAt || void 0,
|
|
3365
3370
|
author: { community: {
|
|
3366
3371
|
...challengeAuthorCommunity ?? {},
|
|
3367
3372
|
...authorCommunity
|
|
@@ -3497,6 +3502,8 @@ var DbHandler = class {
|
|
|
3497
3502
|
result.set(row.commentCid, summary);
|
|
3498
3503
|
}
|
|
3499
3504
|
if (summary.reason === void 0 && typeof moderation.reason === "string") summary.reason = moderation.reason;
|
|
3505
|
+
const banExpiresAt = moderation.author?.banExpiresAt;
|
|
3506
|
+
if (summary.authorBanExpiresAt === void 0 && typeof banExpiresAt === "number") summary.authorBanExpiresAt = banExpiresAt;
|
|
3500
3507
|
if (summary.flairs === void 0 && moderation.flairs !== null && moderation.flairs !== void 0) summary.flairs = moderation.flairs;
|
|
3501
3508
|
if (summary.approved === void 0 && moderation.approved !== null && moderation.approved !== void 0) summary.approved = Boolean(moderation.approved);
|
|
3502
3509
|
for (const flag of FLAG_NAMES) if (summary.flags[flag] === void 0 && moderation[flag] !== null && moderation[flag] !== void 0) summary.flags[flag] = Boolean(moderation[flag]);
|
|
@@ -3615,7 +3622,7 @@ var DbHandler = class {
|
|
|
3615
3622
|
for (const need of uncached.values()) {
|
|
3616
3623
|
const modEditSet = new Set(need.modEdit);
|
|
3617
3624
|
const modAuthorEdits = modEditRows.filter((row) => row.targetAuthorSignerAddress !== null && modEditSet.has(row.targetAuthorSignerAddress) || need.domain !== void 0 && row.targetAuthorDomain === need.domain).map((row) => row.author);
|
|
3618
|
-
const banAuthor = modAuthorEdits.find(
|
|
3625
|
+
const banAuthor = modAuthorEdits.find(isAuthorBanRow);
|
|
3619
3626
|
const authorFlairsByMod = modAuthorEdits.find((modEdit) => modEdit?.flairs);
|
|
3620
3627
|
const modEdits = {};
|
|
3621
3628
|
if (banAuthor?.banExpiresAt) modEdits.banExpiresAt = banAuthor.banExpiresAt;
|
|
@@ -3767,7 +3774,7 @@ var DbHandler = class {
|
|
|
3767
3774
|
SELECT json_extract(commentModeration, '$.author') AS commentAuthorJson FROM ${TABLES.COMMENT_MODERATIONS}
|
|
3768
3775
|
WHERE (${conditions.join(" OR ")}) AND json_extract(commentModeration, '$.author') IS NOT NULL ORDER BY rowid DESC
|
|
3769
3776
|
`).all(...params).map((r) => JSON.parse(r.commentAuthorJson));
|
|
3770
|
-
const banAuthor = modAuthorEdits.find(
|
|
3777
|
+
const banAuthor = modAuthorEdits.find(isAuthorBanRow);
|
|
3771
3778
|
const authorFlairsByMod = modAuthorEdits.find((modEdit) => modEdit?.flairs);
|
|
3772
3779
|
const aggregateAuthor = {};
|
|
3773
3780
|
if (banAuthor?.banExpiresAt) aggregateAuthor.banExpiresAt = banAuthor.banExpiresAt;
|
|
@@ -4038,6 +4045,9 @@ var DbHandler = class {
|
|
|
4038
4045
|
if (commentCids.length === 0) return;
|
|
4039
4046
|
this._runForEachCidBatch(commentCids, (placeholders) => `UPDATE ${TABLES.COMMENT_UPDATES} SET publishedToPostUpdatesMFS = 1 WHERE cid IN (${placeholders})`);
|
|
4040
4047
|
}
|
|
4048
|
+
queryPublishedPostCidsOfBucket(bucket) {
|
|
4049
|
+
return this._db.prepare(`SELECT cid FROM ${TABLES.COMMENT_UPDATES} WHERE postUpdatesBucket = ? AND publishedToPostUpdatesMFS = 1`).pluck().all(bucket);
|
|
4050
|
+
}
|
|
4041
4051
|
forceUpdateOnAllComments() {
|
|
4042
4052
|
this._db.prepare(`UPDATE ${TABLES.COMMENT_UPDATES} SET publishedToPostUpdatesMFS = 0`).run();
|
|
4043
4053
|
}
|
|
@@ -4456,6 +4466,58 @@ async function statMfsPathOrUndefined(kuboRpcClient, path, log) {
|
|
|
4456
4466
|
throw error;
|
|
4457
4467
|
}
|
|
4458
4468
|
}
|
|
4469
|
+
const bucketOfPath = (bucketPath) => Number(bucketPath.split("/").pop());
|
|
4470
|
+
async function markPostsMissingFromBucketForRewrite({ community, bucket, log }) {
|
|
4471
|
+
const published = community._dbHandler.queryPublishedPostCidsOfBucket(bucket);
|
|
4472
|
+
if (published.length === 0) return 0;
|
|
4473
|
+
const kubo = community._clientsManager.getDefaultKuboRpcClient()._client;
|
|
4474
|
+
const listed = /* @__PURE__ */ new Set();
|
|
4475
|
+
try {
|
|
4476
|
+
for await (const entry of kubo.files.ls(`/${community.address}/postUpdates/${bucket}`, { timeout: MFS_OP_TIMEOUT_MS })) listed.add(entry.name);
|
|
4477
|
+
} catch (error) {
|
|
4478
|
+
if (!isAbsentPathError(error)) throw error;
|
|
4479
|
+
}
|
|
4480
|
+
const missing = published.filter((cid) => !listed.has(cid));
|
|
4481
|
+
if (missing.length > 0) {
|
|
4482
|
+
community._dbHandler.forceUpdateOnAllCommentsWithCid(missing);
|
|
4483
|
+
log.error(`The postUpdates bucket ${bucket} of community ${community.address} holds ${listed.size} entries in MFS and ${missing.length} of its ${published.length} published posts are not in it. They will be written again by the next cycle`);
|
|
4484
|
+
}
|
|
4485
|
+
return missing.length;
|
|
4486
|
+
}
|
|
4487
|
+
const bucketsOfPaths = (community, mfsPaths) => {
|
|
4488
|
+
const prefix = `/${community.address}/postUpdates/`;
|
|
4489
|
+
const buckets = /* @__PURE__ */ new Set();
|
|
4490
|
+
for (const path of mfsPaths) if (path.startsWith(prefix)) {
|
|
4491
|
+
const bucket = Number(path.slice(prefix.length).split("/")[0]);
|
|
4492
|
+
if (Number.isFinite(bucket)) buckets.add(bucket);
|
|
4493
|
+
}
|
|
4494
|
+
return [...buckets];
|
|
4495
|
+
};
|
|
4496
|
+
async function statBucketsOfPaths({ community, mfsPaths }) {
|
|
4497
|
+
const log = logger_default("pkc-js:local-community:sync:statBucketsOfPaths");
|
|
4498
|
+
const kuboRpcClient = community._clientsManager.getDefaultKuboRpcClient();
|
|
4499
|
+
const stats = /* @__PURE__ */ new Map();
|
|
4500
|
+
for (const bucket of bucketsOfPaths(community, mfsPaths)) stats.set(bucket, await statMfsPathOrUndefined(kuboRpcClient, `/${community.address}/postUpdates/${bucket}`, log).then((stat) => stat?.cid.toString(), () => null));
|
|
4501
|
+
return stats;
|
|
4502
|
+
}
|
|
4503
|
+
function noteUnconfirmedRemovalsFromBuckets({ community, mfsPaths }) {
|
|
4504
|
+
for (const bucket of bucketsOfPaths(community, mfsPaths)) community._postUpdatesBucketsWithUnconfirmedRemovals.add(bucket);
|
|
4505
|
+
}
|
|
4506
|
+
async function rememberPostUpdatesBucketsOfPaths({ community, mfsPaths, before }) {
|
|
4507
|
+
const log = logger_default("pkc-js:local-community:sync:rememberPostUpdatesBuckets");
|
|
4508
|
+
const kuboRpcClient = community._clientsManager.getDefaultKuboRpcClient();
|
|
4509
|
+
for (const bucket of bucketsOfPaths(community, mfsPaths)) {
|
|
4510
|
+
const remembered = community._postUpdatesBucketCids.get(bucket);
|
|
4511
|
+
if (remembered !== void 0 && before.get(bucket) !== remembered) {
|
|
4512
|
+
community._postUpdatesBucketsWithUnconfirmedRemovals.add(bucket);
|
|
4513
|
+
continue;
|
|
4514
|
+
}
|
|
4515
|
+
community._postUpdatesBucketsWithUnconfirmedRemovals.delete(bucket);
|
|
4516
|
+
const stat = await statMfsPathOrUndefined(kuboRpcClient, `/${community.address}/postUpdates/${bucket}`, log).catch(() => void 0);
|
|
4517
|
+
if (stat) community._postUpdatesBucketCids.set(bucket, stat.cid.toString());
|
|
4518
|
+
else community._postUpdatesBucketCids.delete(bucket);
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4459
4521
|
async function buildPostUpdateFiles(posts) {
|
|
4460
4522
|
const { importer } = await import("./src-DIOHVUq9.js");
|
|
4461
4523
|
const blocks = /* @__PURE__ */ new Map();
|
|
@@ -4570,22 +4632,68 @@ async function writePostUpdatesToBucket({ community, bucketPath, posts }) {
|
|
|
4570
4632
|
}
|
|
4571
4633
|
return bytes;
|
|
4572
4634
|
};
|
|
4635
|
+
const bucket = bucketOfPath(bucketPath);
|
|
4573
4636
|
let live = await recoverInterruptedBucketSwap(kuboRpcClient, bucketPath, log);
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4637
|
+
if (!live) {
|
|
4638
|
+
const bucketWasHere = community._postUpdatesBucketCids.delete(bucket);
|
|
4639
|
+
await markPostsMissingFromBucketForRewrite({
|
|
4640
|
+
community,
|
|
4641
|
+
bucket,
|
|
4642
|
+
log
|
|
4643
|
+
});
|
|
4644
|
+
if (bucketWasHere) throw new PKCError("ERR_POST_UPDATES_BUCKET_SWAP_WAS_LOST", {
|
|
4578
4645
|
communityAddress: community.address,
|
|
4579
4646
|
bucketPath,
|
|
4580
|
-
attempt
|
|
4647
|
+
attempt: 0
|
|
4648
|
+
});
|
|
4649
|
+
}
|
|
4650
|
+
const rememberedCid = community._postUpdatesBucketCids.get(bucket);
|
|
4651
|
+
const pendingCid = community._postUpdatesBucketPendingCids.get(bucket);
|
|
4652
|
+
if (live && pendingCid !== void 0 && live.cid.toString() === pendingCid) {
|
|
4653
|
+
community._postUpdatesBucketCids.set(bucket, pendingCid);
|
|
4654
|
+
community._postUpdatesBucketPendingCids.delete(bucket);
|
|
4655
|
+
} else if (live && rememberedCid !== void 0 && rememberedCid !== live.cid.toString()) {
|
|
4656
|
+
const missing = await markPostsMissingFromBucketForRewrite({
|
|
4657
|
+
community,
|
|
4658
|
+
bucket,
|
|
4659
|
+
log
|
|
4581
4660
|
});
|
|
4661
|
+
const removalsExplainIt = community._postUpdatesBucketsWithUnconfirmedRemovals.delete(bucket);
|
|
4662
|
+
community._postUpdatesBucketCids.set(bucket, live.cid.toString());
|
|
4663
|
+
if (!(removalsExplainIt && missing === 0)) throw new PKCError("ERR_POST_UPDATES_BUCKET_SWAP_WAS_LOST", {
|
|
4664
|
+
communityAddress: community.address,
|
|
4665
|
+
bucketPath,
|
|
4666
|
+
attempt: 0,
|
|
4667
|
+
bucketCidInMfs: live.cid.toString(),
|
|
4668
|
+
bucketCidRemembered: rememberedCid
|
|
4669
|
+
});
|
|
4670
|
+
}
|
|
4671
|
+
let bucketExisted = false;
|
|
4672
|
+
for (let attempt = 1;; attempt++) {
|
|
4673
|
+
if (live) bucketExisted = true;
|
|
4674
|
+
else if (bucketExisted) {
|
|
4675
|
+
community._postUpdatesBucketCids.delete(bucket);
|
|
4676
|
+
await markPostsMissingFromBucketForRewrite({
|
|
4677
|
+
community,
|
|
4678
|
+
bucket,
|
|
4679
|
+
log
|
|
4680
|
+
});
|
|
4681
|
+
throw new PKCError("ERR_POST_UPDATES_BUCKET_SWAP_WAS_LOST", {
|
|
4682
|
+
communityAddress: community.address,
|
|
4683
|
+
bucketPath,
|
|
4684
|
+
attempt
|
|
4685
|
+
});
|
|
4686
|
+
}
|
|
4582
4687
|
const { cid: root, newBlocks } = await patchUnixFsDirectory({
|
|
4583
4688
|
directoryCid: live?.cid,
|
|
4584
4689
|
entriesToPut: entries,
|
|
4585
4690
|
getBlock,
|
|
4586
4691
|
shardSplitThresholdBytes: MFS_SHARD_SPLIT_THRESHOLD_BYTES
|
|
4587
4692
|
});
|
|
4588
|
-
if (live && root.equals(live.cid))
|
|
4693
|
+
if (live && root.equals(live.cid)) {
|
|
4694
|
+
community._postUpdatesBucketCids.set(bucket, live.cid.toString());
|
|
4695
|
+
return;
|
|
4696
|
+
}
|
|
4589
4697
|
if (attempt > MAX_ATTEMPTS_TO_SWAP_POST_UPDATES_BUCKET) throw new PKCError("ERR_POST_UPDATES_BUCKET_SWAP_WAS_LOST", {
|
|
4590
4698
|
communityAddress: community.address,
|
|
4591
4699
|
bucketPath,
|
|
@@ -4609,6 +4717,7 @@ async function writePostUpdatesToBucket({ community, bucketPath, posts }) {
|
|
|
4609
4717
|
timeout: MFS_OP_TIMEOUT_MS
|
|
4610
4718
|
})) if (result.root.pinErrorMsg) throw Error(`Failed to pin the new blocks of bucket ${bucketPath} (${result.root.cid.toString()}): ${result.root.pinErrorMsg}`);
|
|
4611
4719
|
log(`Bucket ${bucketPath}: ${posts.length} posts written, ${newBlocks.length} of the bucket's nodes rebuilt (${car.length} bytes imported), root ${root.toString()}`);
|
|
4720
|
+
community._postUpdatesBucketPendingCids.set(bucket, root.toString());
|
|
4612
4721
|
await kubo.files.cp(`/ipfs/${root.toString()}`, nextPath, {
|
|
4613
4722
|
parents: true,
|
|
4614
4723
|
flush: true,
|
|
@@ -4628,9 +4737,30 @@ async function writePostUpdatesToBucket({ community, bucketPath, posts }) {
|
|
|
4628
4737
|
});
|
|
4629
4738
|
}
|
|
4630
4739
|
const swapped = await statMfsPathOrUndefined(kuboRpcClient, bucketPath, log);
|
|
4631
|
-
if (swapped?.cid.equals(root))
|
|
4740
|
+
if (swapped?.cid.equals(root)) {
|
|
4741
|
+
community._postUpdatesBucketCids.set(bucket, root.toString());
|
|
4742
|
+
community._postUpdatesBucketPendingCids.delete(bucket);
|
|
4743
|
+
return;
|
|
4744
|
+
}
|
|
4632
4745
|
log.error(`Bucket ${bucketPath} is ${swapped?.cid.toString()} in MFS after ${root.toString()} was swapped in (attempt ${attempt}), checking it for the posts' files`);
|
|
4633
4746
|
live = await recoverInterruptedBucketSwap(kuboRpcClient, bucketPath, log);
|
|
4747
|
+
if (live) {
|
|
4748
|
+
if (await markPostsMissingFromBucketForRewrite({
|
|
4749
|
+
community,
|
|
4750
|
+
bucket,
|
|
4751
|
+
log
|
|
4752
|
+
}) > 0) {
|
|
4753
|
+
community._postUpdatesBucketCids.set(bucket, live.cid.toString());
|
|
4754
|
+
community._postUpdatesBucketPendingCids.delete(bucket);
|
|
4755
|
+
throw new PKCError("ERR_POST_UPDATES_BUCKET_SWAP_WAS_LOST", {
|
|
4756
|
+
communityAddress: community.address,
|
|
4757
|
+
bucketPath,
|
|
4758
|
+
attempt,
|
|
4759
|
+
bucketCidInMfs: live.cid.toString(),
|
|
4760
|
+
bucketCidWithThePosts: root.toString()
|
|
4761
|
+
});
|
|
4762
|
+
}
|
|
4763
|
+
}
|
|
4634
4764
|
}
|
|
4635
4765
|
}
|
|
4636
4766
|
//#endregion
|
|
@@ -4940,6 +5070,10 @@ async function rmUnneededMfsPaths(community, opts) {
|
|
|
4940
5070
|
const toDeleteMfsPaths = Array.from(community._mfsPathsToRemove.values());
|
|
4941
5071
|
const kuboRpc = community._clientsManager.getDefaultKuboRpcClient();
|
|
4942
5072
|
for (const watcher of community._mfsPathRemovalWatchers) for (const path of toDeleteMfsPaths) watcher.add(path);
|
|
5073
|
+
const bucketsBefore = await statBucketsOfPaths({
|
|
5074
|
+
community,
|
|
5075
|
+
mfsPaths: toDeleteMfsPaths
|
|
5076
|
+
});
|
|
4943
5077
|
try {
|
|
4944
5078
|
await removeMfsFilesSafely({
|
|
4945
5079
|
kuboRpcClient: kuboRpc,
|
|
@@ -4948,14 +5082,28 @@ async function rmUnneededMfsPaths(community, opts) {
|
|
|
4948
5082
|
inputNumOfRetries: opts?.numOfRetries
|
|
4949
5083
|
});
|
|
4950
5084
|
toDeleteMfsPaths.forEach((path) => community._mfsPathsToRemove.delete(path));
|
|
5085
|
+
await rememberPostUpdatesBucketsOfPaths({
|
|
5086
|
+
community,
|
|
5087
|
+
mfsPaths: toDeleteMfsPaths,
|
|
5088
|
+
before: bucketsBefore
|
|
5089
|
+
});
|
|
4951
5090
|
return toDeleteMfsPaths;
|
|
4952
5091
|
} catch (e) {
|
|
4953
5092
|
const error = e;
|
|
4954
5093
|
if (error.message.includes("file does not exist")) {
|
|
4955
5094
|
toDeleteMfsPaths.forEach((path) => community._mfsPathsToRemove.delete(path));
|
|
5095
|
+
await rememberPostUpdatesBucketsOfPaths({
|
|
5096
|
+
community,
|
|
5097
|
+
mfsPaths: toDeleteMfsPaths,
|
|
5098
|
+
before: bucketsBefore
|
|
5099
|
+
});
|
|
4956
5100
|
return toDeleteMfsPaths;
|
|
4957
5101
|
} else {
|
|
4958
5102
|
log.error("Failed to remove paths from MFS", toDeleteMfsPaths, e);
|
|
5103
|
+
noteUnconfirmedRemovalsFromBuckets({
|
|
5104
|
+
community,
|
|
5105
|
+
mfsPaths: toDeleteMfsPaths
|
|
5106
|
+
});
|
|
4959
5107
|
throw error;
|
|
4960
5108
|
}
|
|
4961
5109
|
}
|
|
@@ -6675,13 +6823,38 @@ async function syncWithRegistries(community) {
|
|
|
6675
6823
|
async function calculateNewPostUpdates(community) {
|
|
6676
6824
|
const postUpdates = {};
|
|
6677
6825
|
const kuboRpcClient = community._clientsManager.getDefaultKuboRpcClient();
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6826
|
+
const log = logger_default("pkc-js:local-community:sync:calculateNewPostUpdates");
|
|
6827
|
+
for (const timeBucket of community._postUpdatesBuckets) {
|
|
6828
|
+
const rememberedCid = community._postUpdatesBucketCids.get(timeBucket);
|
|
6829
|
+
let cidInMfs;
|
|
6830
|
+
let absent = false;
|
|
6831
|
+
try {
|
|
6832
|
+
const statRes = await statMfsPathSafely({
|
|
6833
|
+
kuboRpcClient,
|
|
6834
|
+
path: `/${community.address}/postUpdates/${timeBucket}`
|
|
6835
|
+
});
|
|
6836
|
+
cidInMfs = String(statRes.cid);
|
|
6837
|
+
if (statRes.blocks !== 0) postUpdates[String(timeBucket)] = cidInMfs;
|
|
6838
|
+
} catch (error) {
|
|
6839
|
+
if (!isAbsentPathError(error)) continue;
|
|
6840
|
+
absent = true;
|
|
6841
|
+
}
|
|
6842
|
+
const lost = absent && (rememberedCid !== void 0 || community.postUpdates?.[String(timeBucket)] !== void 0);
|
|
6843
|
+
const changed = !absent && rememberedCid !== void 0 && rememberedCid !== cidInMfs;
|
|
6844
|
+
if (lost || changed) try {
|
|
6845
|
+
await markPostsMissingFromBucketForRewrite({
|
|
6846
|
+
community,
|
|
6847
|
+
bucket: timeBucket,
|
|
6848
|
+
log
|
|
6849
|
+
});
|
|
6850
|
+
} catch (error) {
|
|
6851
|
+
log.error(`Failed to check the postUpdates bucket ${timeBucket} of community ${community.address}`, error);
|
|
6852
|
+
continue;
|
|
6853
|
+
}
|
|
6854
|
+
if (lost || changed) community._postUpdatesBucketsWithUnconfirmedRemovals.delete(timeBucket);
|
|
6855
|
+
if (cidInMfs !== void 0) community._postUpdatesBucketCids.set(timeBucket, cidInMfs);
|
|
6856
|
+
else community._postUpdatesBucketCids.delete(timeBucket);
|
|
6857
|
+
}
|
|
6685
6858
|
if (e(postUpdates)) return void 0;
|
|
6686
6859
|
return postUpdates;
|
|
6687
6860
|
}
|
|
@@ -8293,6 +8466,9 @@ var LocalCommunity = class extends RpcLocalCommunity {
|
|
|
8293
8466
|
this._slowGetChallengeWarningMs = SLOW_GET_CHALLENGE_WARNING_MS;
|
|
8294
8467
|
this._cidsToUnPin = /* @__PURE__ */ new Set();
|
|
8295
8468
|
this._mfsPathsToRemove = /* @__PURE__ */ new Set();
|
|
8469
|
+
this._postUpdatesBucketCids = /* @__PURE__ */ new Map();
|
|
8470
|
+
this._postUpdatesBucketPendingCids = /* @__PURE__ */ new Map();
|
|
8471
|
+
this._postUpdatesBucketsWithUnconfirmedRemovals = /* @__PURE__ */ new Set();
|
|
8296
8472
|
this._mfsPathRemovalWatchers = /* @__PURE__ */ new Set();
|
|
8297
8473
|
this._communityUpdateTriggerValue = false;
|
|
8298
8474
|
this._updateTriggerGeneration = 0;
|
|
@@ -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 ChallengeAnswerMessageSchema, Br as messages, C as hideClassPrivateProps, Cr as e, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Er as r, Et as untrackUpdatingCommunity, Fr as FailedToFetchCommentUpdateFromGatewaysError, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, Jt as version_default, Mt as ChallengeMessageSchema, Nr as require_retry$1, Ot as TimeoutError, Pr as FailedToFetchCommentIpfsFromGatewaysError, Pt as ChallengeRequestMessageSchema, Rr as FailedToFetchPageIpfsFromGatewaysError, Sr as t$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenAbortSignalFires, Vr as logger_default, W as rejectWhenCommunityStopsOrAborts, Wr as setErrorMap, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Z as resolveWhenPredicateIsTrue, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, br as n$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, ft as findUpdatingComment, gr as isStringDomain, gt as listUpdatingComments, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, ii as en_default, jn as CommentIpfsSchema, k as isIpns, kt as pTimeout, nt as shortifyCid, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, rt as sleepUntilTimeoutOrAbort, st as waitForUpdateInCommunityInstanceWithErrorAndTimeout, tt as shortifyAddress, u as createAbortError, vr as n$2, vt as refreshTrackedCommentAliases, wr as e$1, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, z as linkAbortSignals, zn as CommentUpdateSchema, zr as PKCError } from "./util-
|
|
3
|
-
import { $n as getAuthorNameFromWire, $r as n$3, $t as RpcPublishAnchorRecordParamSchema, A as findCommentInParsedPages, An as signCommunityEdit, At as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommentPubsubMessage, Bt as RpcCommentRepliesPageParamSchema, C as RepliesPages, Cr as createKuboRpcClient, Ct as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dt as parseDecryptedChallengeVerification, En as signCommentModeration, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fr as markLocalCommunityDbAsBeingWritten, Ft as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Gn as verifyVote, Gt as RpcExportCommunityModLogsParamSchema, Hr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Ht as RpcCommunityIdentifierParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyChallengeVerification, Ir as monitorCommunitiesDirectory, It as RpcAnchorPublishPreparationResultSchema, J as decodeRpcChallengeAnswerPubsubMsg, Jn as mergeAuthorProps, Jt as RpcExportCommunityResultSchema, Kn as assignUnknownProps, Kr as findCommunitiesEntry, Kt as RpcExportCommunityModLogsResultSchema, Ln as verifyCommentEdit, Lt as RpcAuthorNameParamSchema, M as parseRawPages, Mn as signVote, Mt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Nt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, Or as findLocalCommunityAddress, Ot as parseDecryptedChallengeWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyChallengeMessage, Pr as isLocalCommunityAddress, Qn as getAuthorNameFromRuntime, Qr as t$3, Qt as RpcFetchCommunityListResultSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentIpfs, Rr as registerLocalCommunity, Rt as RpcCancelExportParamSchema, Sn as signChallengeRequest, Tn as signCommentEdit, Tt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, U as InflightFetchManager, Un as verifyCommunityEdit, Ut as RpcCommunityPageParamSchema, Vn as verifyCommentUpdate, Vr as setNativeFunctions$1, Vt as RpcCommunitiesChangeEventResultSchema, W as InflightResourceTypes, Wn as verifyCommunityList, Wt as RpcEditCommunityParamSchema, X as decodeRpcChallengeRequestPubsubMsg, Xn as buildRuntimeAuthor, Xt as RpcFetchCidResultSchema, Y as decodeRpcChallengePubsubMsg, Yn as withoutForbiddenKeys, Yr as t$5, Yt as RpcFetchCidParamSchema, Z as decodeRpcChallengeVerificationPubsubMsg, Zn as cleanWireAuthor, Zt as RpcFetchCommunityListParamSchema, _r as getPKCAddressFromPublicKeySync, _t as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, ai as NAME_RESOLVED_TRUE_TTL_MS, an as RpcSubscriptionIdResultSchema, at as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, b as KeyvBetterSqlite3, bn as signChallengeAnswer, bt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, cn as findCommunityRecordNameMismatch, cr as getCommunityAddressFromRecord, ct as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, dr as normalizeCommunityInputFromCommunity, dt as parseCommunityAddressWithPKCErrorIfItFails, en as RpcPublishChallengeAnswersParamSchema, er as normalizeCreatePublicationAuthor, fn as createSigner, fr as decode, gn as encryptEd25519AesGcm, gt as parseCommunityListSchemaWithPKCErrorIfItFails, ii as NAME_RESOLVED_FALSE_TTL_MS, in as RpcResolveAuthorNameResultSchema, ir as MAX_COMMUNITY_LIST_SIZE_BYTES, jn as signCommunityList, jr as getDefaultDataPath, jt as parseRpcCommentEventWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kt as parseJsonWithPKCErrorIfFails, l as pkcJsPageSorts, li as nativeFunctions$2, ln as verifyAuthorWalletEntry, lr as getCommunityNameFromWire, lt as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, m as pkcJsChallenges, mn as decryptEd25519AesGcm, mr as getBufferedPKCAddressFromPublicKey, mt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, ni as t$4, nn as RpcPublishCommunityListResultSchema, nr as CreateCommunityListWithCidOptionsSchema, nt as parseCidStringSchemaWithPKCErrorIfItFails, oi as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, on as RpcSuccessResultSchema, ot as parseCommentIpfsSchemaWithPKCErrorIfItFails, pn as createAnchorIpnsRecord$1, q as PKCTypedEmitter, qr as toCommunitiesEntry, qt as RpcExportCommunityParamSchema, ri as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, rn as RpcPublishedAnchorRecordResultSchema, rr as CreateNewCommunityListOptionsSchema, sn as RpcUnsubscribeParamSchema, sr as buildRuntimeCommunityFields, t as RpcLocalCommunity, ti as t$2, tn as RpcPublishCommunityListParamSchema, un as require_lib$1, ur as getCommunityPublicKeyFromWire, ut as parseCommentUpdateSchemaWithPKCErrorIfItFails, v as TrackedInstanceRegistry, vt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, wn as signComment, wt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, x as RemoteCommunity, y as LRUCache, yn as cleanUpBeforePublishing, yt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, z as PKCClientsManager, zn as verifyCommentModeration, zt as RpcCidParamSchema } from "./rpc-local-community-
|
|
4
|
-
import { s as getHeliaDebugContext } from "./util-
|
|
2
|
+
import { $ as retryKuboIpfsAdd, At as ChallengeAnswerMessageSchema, Br as messages, C as hideClassPrivateProps, Cr as e, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Er as r, Et as untrackUpdatingCommunity, Fr as FailedToFetchCommentUpdateFromGatewaysError, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, Jt as version_default, Mt as ChallengeMessageSchema, Nr as require_retry$1, Ot as TimeoutError, Pr as FailedToFetchCommentIpfsFromGatewaysError, Pt as ChallengeRequestMessageSchema, Rr as FailedToFetchPageIpfsFromGatewaysError, Sr as t$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenAbortSignalFires, Vr as logger_default, W as rejectWhenCommunityStopsOrAborts, Wr as setErrorMap, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Z as resolveWhenPredicateIsTrue, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, br as n$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, ft as findUpdatingComment, gr as isStringDomain, gt as listUpdatingComments, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, ii as en_default, jn as CommentIpfsSchema, k as isIpns, kt as pTimeout, nt as shortifyCid, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, rt as sleepUntilTimeoutOrAbort, st as waitForUpdateInCommunityInstanceWithErrorAndTimeout, tt as shortifyAddress, u as createAbortError, vr as n$2, vt as refreshTrackedCommentAliases, wr as e$1, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, z as linkAbortSignals, zn as CommentUpdateSchema, zr as PKCError } from "./util-BuTE1Bd1.js";
|
|
3
|
+
import { $n as getAuthorNameFromWire, $r as n$3, $t as RpcPublishAnchorRecordParamSchema, A as findCommentInParsedPages, An as signCommunityEdit, At as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommentPubsubMessage, Bt as RpcCommentRepliesPageParamSchema, C as RepliesPages, Cr as createKuboRpcClient, Ct as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dt as parseDecryptedChallengeVerification, En as signCommentModeration, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fr as markLocalCommunityDbAsBeingWritten, Ft as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Gn as verifyVote, Gt as RpcExportCommunityModLogsParamSchema, Hr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Ht as RpcCommunityIdentifierParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyChallengeVerification, Ir as monitorCommunitiesDirectory, It as RpcAnchorPublishPreparationResultSchema, J as decodeRpcChallengeAnswerPubsubMsg, Jn as mergeAuthorProps, Jt as RpcExportCommunityResultSchema, Kn as assignUnknownProps, Kr as findCommunitiesEntry, Kt as RpcExportCommunityModLogsResultSchema, Ln as verifyCommentEdit, Lt as RpcAuthorNameParamSchema, M as parseRawPages, Mn as signVote, Mt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Nt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, Or as findLocalCommunityAddress, Ot as parseDecryptedChallengeWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyChallengeMessage, Pr as isLocalCommunityAddress, Qn as getAuthorNameFromRuntime, Qr as t$3, Qt as RpcFetchCommunityListResultSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentIpfs, Rr as registerLocalCommunity, Rt as RpcCancelExportParamSchema, Sn as signChallengeRequest, Tn as signCommentEdit, Tt as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, U as InflightFetchManager, Un as verifyCommunityEdit, Ut as RpcCommunityPageParamSchema, Vn as verifyCommentUpdate, Vr as setNativeFunctions$1, Vt as RpcCommunitiesChangeEventResultSchema, W as InflightResourceTypes, Wn as verifyCommunityList, Wt as RpcEditCommunityParamSchema, X as decodeRpcChallengeRequestPubsubMsg, Xn as buildRuntimeAuthor, Xt as RpcFetchCidResultSchema, Y as decodeRpcChallengePubsubMsg, Yn as withoutForbiddenKeys, Yr as t$5, Yt as RpcFetchCidParamSchema, Z as decodeRpcChallengeVerificationPubsubMsg, Zn as cleanWireAuthor, Zt as RpcFetchCommunityListParamSchema, _r as getPKCAddressFromPublicKeySync, _t as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, ai as NAME_RESOLVED_TRUE_TTL_MS, an as RpcSubscriptionIdResultSchema, at as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, b as KeyvBetterSqlite3, bn as signChallengeAnswer, bt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, cn as findCommunityRecordNameMismatch, cr as getCommunityAddressFromRecord, ct as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, dr as normalizeCommunityInputFromCommunity, dt as parseCommunityAddressWithPKCErrorIfItFails, en as RpcPublishChallengeAnswersParamSchema, er as normalizeCreatePublicationAuthor, fn as createSigner, fr as decode, gn as encryptEd25519AesGcm, gt as parseCommunityListSchemaWithPKCErrorIfItFails, ii as NAME_RESOLVED_FALSE_TTL_MS, in as RpcResolveAuthorNameResultSchema, ir as MAX_COMMUNITY_LIST_SIZE_BYTES, jn as signCommunityList, jr as getDefaultDataPath, jt as parseRpcCommentEventWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kt as parseJsonWithPKCErrorIfFails, l as pkcJsPageSorts, li as nativeFunctions$2, ln as verifyAuthorWalletEntry, lr as getCommunityNameFromWire, lt as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, m as pkcJsChallenges, mn as decryptEd25519AesGcm, mr as getBufferedPKCAddressFromPublicKey, mt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, ni as t$4, nn as RpcPublishCommunityListResultSchema, nr as CreateCommunityListWithCidOptionsSchema, nt as parseCidStringSchemaWithPKCErrorIfItFails, oi as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, on as RpcSuccessResultSchema, ot as parseCommentIpfsSchemaWithPKCErrorIfItFails, pn as createAnchorIpnsRecord$1, q as PKCTypedEmitter, qr as toCommunitiesEntry, qt as RpcExportCommunityParamSchema, ri as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, rn as RpcPublishedAnchorRecordResultSchema, rr as CreateNewCommunityListOptionsSchema, sn as RpcUnsubscribeParamSchema, sr as buildRuntimeCommunityFields, t as RpcLocalCommunity, ti as t$2, tn as RpcPublishCommunityListParamSchema, un as require_lib$1, ur as getCommunityPublicKeyFromWire, ut as parseCommentUpdateSchemaWithPKCErrorIfItFails, v as TrackedInstanceRegistry, vt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, wn as signComment, wt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, x as RemoteCommunity, y as LRUCache, yn as cleanUpBeforePublishing, yt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, z as PKCClientsManager, zn as verifyCommentModeration, zt as RpcCidParamSchema } from "./rpc-local-community-D66Be62U.js";
|
|
4
|
+
import { s as getHeliaDebugContext } from "./util-CodXreIl.js";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import fs from "fs";
|
|
@@ -30061,6 +30061,7 @@ var Comment = class extends Publication {
|
|
|
30061
30061
|
this.archived = props.archived;
|
|
30062
30062
|
this.removed = props.removed;
|
|
30063
30063
|
this.reason = props.reason;
|
|
30064
|
+
this.authorBanExpiresAt = props.authorBanExpiresAt;
|
|
30064
30065
|
this.edit = props.edit;
|
|
30065
30066
|
this.protocolVersion = props.protocolVersion;
|
|
30066
30067
|
this.spoiler = typeof props.spoiler === "boolean" ? props.spoiler : typeof props.edit?.spoiler === "boolean" ? props.edit?.spoiler : this.spoiler;
|
|
@@ -36383,7 +36384,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
36383
36384
|
this.clients.libp2pJsClients = {};
|
|
36384
36385
|
if (!this.libp2pJsClientsOptions) return;
|
|
36385
36386
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
36386
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
36387
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-D3uvabO4.js");
|
|
36387
36388
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
36388
36389
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
36389
36390
|
...clientOptions,
|
|
@@ -36760,7 +36761,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
36760
36761
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
36761
36762
|
log.trace("Received community options to create a local community instance:", options);
|
|
36762
36763
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
36763
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
36764
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-ChB5dbEH.js");
|
|
36764
36765
|
const isLocalCommunity = isLocalCommunityAddress(this, options.address);
|
|
36765
36766
|
const community = new LocalCommunity(this);
|
|
36766
36767
|
if (isLocalCommunity) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bn as PageSortFileSchema, gr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-
|
|
1
|
+
import { bn as PageSortFileSchema, gr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-BuTE1Bd1.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-BjIHRbYy.js → rpc-local-community-D66Be62U.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 preprocess, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as t$10, B as pubsubTopicToDhtKey, Bn as CommentUpdateSignedPropertyNames, Br as messages, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as e$6, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as t$12, Dt as require_sha256$1, E as isAbortError, Er as r$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchCommentUpdateFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as _enum, Gt as PKCParsedOptionsSchema, H as raceAgainstAbort, Hr as require_supports_color, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchCommunityFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as custom, Kn as PageIpfsSchema, Kr as array, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as FailedToFetchGenericIpfsFromGatewaysError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as e$4, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as require_retry$2, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as n$8, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommentIpfsFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as object, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as FailedToFetchPageIpfsFromGatewaysError, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as t$13, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$11, Un as CreateCommentOptionsWithRefinementSchema, Ur as require_ms$1, Ut as NameResolveCacheOptionsSchema, Vr as logger_default, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as looseObject, Yr as literal, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as number, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, _r as normalizeEthAliasDomain, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersByIndexSchema, at as throwIfAbortSignalAborted, bn as PageSortFileSchema, br as n$10, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as record, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as isStringDomain, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isEthAliasDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, jn as CommentIpfsSchema, jr as t$9, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as r$7, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, ni as union, nr as AuthorCommentIpfsReservedFields, nt as shortifyCid, on as ChallengeFileFactorySchema, or as CidPathSchema, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, q as removeNullUndefinedEmptyObjectsValuesRecursively, qn as isReservedObjectKey, qr as boolean, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, rt as sleepUntilTimeoutOrAbort, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, ti as string, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyAddress, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$9, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as e$5, wt as untrackStartedCommunity, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as linkAbortSignals, zn as CommentUpdateSchema, zr as PKCError } from "./util-
|
|
2
|
+
import { $r as preprocess, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as t$10, B as pubsubTopicToDhtKey, Bn as CommentUpdateSignedPropertyNames, Br as messages, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as e$6, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as t$12, Dt as require_sha256$1, E as isAbortError, Er as r$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchCommentUpdateFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as _enum, Gt as PKCParsedOptionsSchema, H as raceAgainstAbort, Hr as require_supports_color, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchCommunityFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as custom, Kn as PageIpfsSchema, Kr as array, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as FailedToFetchGenericIpfsFromGatewaysError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as e$4, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as require_retry$2, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as n$8, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommentIpfsFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as object, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as FailedToFetchPageIpfsFromGatewaysError, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as t$13, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$11, Un as CreateCommentOptionsWithRefinementSchema, Ur as require_ms$1, Ut as NameResolveCacheOptionsSchema, Vr as logger_default, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as looseObject, Yr as literal, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as number, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, _r as normalizeEthAliasDomain, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersByIndexSchema, at as throwIfAbortSignalAborted, bn as PageSortFileSchema, br as n$10, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as record, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as isStringDomain, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isEthAliasDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, jn as CommentIpfsSchema, jr as t$9, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as r$7, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, ni as union, nr as AuthorCommentIpfsReservedFields, nt as shortifyCid, on as ChallengeFileFactorySchema, or as CidPathSchema, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, q as removeNullUndefinedEmptyObjectsValuesRecursively, qn as isReservedObjectKey, qr as boolean, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, rt as sleepUntilTimeoutOrAbort, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, ti as string, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyAddress, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$9, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as e$5, wt as untrackStartedCommunity, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as linkAbortSignals, zn as CommentUpdateSchema, zr as PKCError } from "./util-BuTE1Bd1.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-CZmdHvps.js";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import path from "node:path";
|
|
@@ -8052,10 +8052,10 @@ const CommunityAuthorChallengeReservedFieldNames = [
|
|
|
8052
8052
|
"firstCommentTimestamp",
|
|
8053
8053
|
"lastCommentCid"
|
|
8054
8054
|
];
|
|
8055
|
-
CommunityAuthorSchema.pick({
|
|
8055
|
+
const CommentModerationAuthorSchema = CommunityAuthorSchema.pick({
|
|
8056
8056
|
banExpiresAt: true,
|
|
8057
8057
|
flairs: true
|
|
8058
|
-
});
|
|
8058
|
+
}).extend({ banExpiresAt: number().nonnegative().int().optional() });
|
|
8059
8059
|
const AuthorReservedFields = r$2([
|
|
8060
8060
|
...t$3(AuthorPubsubSchema.extend({ community: CommunityAuthorSchema.optional() }).shape),
|
|
8061
8061
|
"address",
|
|
@@ -8240,6 +8240,7 @@ const CommentUpdateSchema = object({
|
|
|
8240
8240
|
archived: boolean().optional(),
|
|
8241
8241
|
removed: boolean().optional(),
|
|
8242
8242
|
reason: string().optional(),
|
|
8243
|
+
authorBanExpiresAt: PKCTimestampSchema.optional(),
|
|
8243
8244
|
approved: boolean().optional(),
|
|
8244
8245
|
updatedAt: PKCTimestampSchema,
|
|
8245
8246
|
author: AuthorWithCommentUpdateSchema.pick({ community: true }).optional(),
|
|
@@ -8264,6 +8265,7 @@ const CommentUpdateChallengeReservedFieldNames = [
|
|
|
8264
8265
|
"updatedAt",
|
|
8265
8266
|
"lastChildCid",
|
|
8266
8267
|
"lastReplyTimestamp",
|
|
8268
|
+
"authorBanExpiresAt",
|
|
8267
8269
|
"replies",
|
|
8268
8270
|
"edit",
|
|
8269
8271
|
"protocolVersion"
|
|
@@ -16538,10 +16540,7 @@ const ModeratorOptionsSchema = object({
|
|
|
16538
16540
|
removed: boolean().optional(),
|
|
16539
16541
|
purged: boolean().optional(),
|
|
16540
16542
|
reason: string().optional(),
|
|
16541
|
-
author:
|
|
16542
|
-
banExpiresAt: true,
|
|
16543
|
-
flairs: true
|
|
16544
|
-
}).loose().optional()
|
|
16543
|
+
author: CommentModerationAuthorSchema.loose().optional()
|
|
16545
16544
|
}).strict();
|
|
16546
16545
|
const CreateCommentModerationOptionsSchema = CreatePublicationUserOptionsSchema.extend({
|
|
16547
16546
|
commentModeration: ModeratorOptionsSchema.loose(),
|
|
@@ -16603,14 +16602,14 @@ const CommunityEditPublicationPubsubReservedFields = r$2([
|
|
|
16603
16602
|
], t$3(CommunityEditPubsubMessagePublicationSchema.shape));
|
|
16604
16603
|
//#endregion
|
|
16605
16604
|
//#region dist/node/generated-version.js
|
|
16606
|
-
const version = "0.0.
|
|
16605
|
+
const version = "0.0.158";
|
|
16607
16606
|
//#endregion
|
|
16608
16607
|
//#region dist/node/version.js
|
|
16609
16608
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
16610
16609
|
const pkcJsVersion = version;
|
|
16611
16610
|
var version_default = {
|
|
16612
16611
|
PKC_JS_VERSION: pkcJsVersion,
|
|
16613
|
-
DB_VERSION:
|
|
16612
|
+
DB_VERSION: 48,
|
|
16614
16613
|
PROTOCOL_VERSION: protocolVersion,
|
|
16615
16614
|
USER_AGENT: UserAgentSchema.parse(`/pkc-js:${pkcJsVersion}/`)
|
|
16616
16615
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as pubsubTopicToDhtKeyCid, z as linkAbortSignals, zr as PKCError } from "./util-
|
|
1
|
+
import { V as pubsubTopicToDhtKeyCid, z as linkAbortSignals, zr as PKCError } from "./util-BuTE1Bd1.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 { on as ChallengeFileFactorySchema, sn as ChallengeFileSchema, yn as PageSortFileFactorySchema, zr as PKCError } from "./util-
|
|
2
|
-
import { s as validatePageSortFile } from "./page-sort-scoring-
|
|
1
|
+
import { on as ChallengeFileFactorySchema, sn as ChallengeFileSchema, yn as PageSortFileFactorySchema, zr as PKCError } from "./util-BuTE1Bd1.js";
|
|
2
|
+
import { s as validatePageSortFile } from "./page-sort-scoring-CZmdHvps.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-Bx3xTqFv.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-Bc4uoozL.js";
|
|
2
2
|
export { validatePageSortFileFactory };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as hideClassPrivateProps, Sr as t, Vr as logger_default, X as replaceXWithY, br as n, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, i as calculateStringSizeSameAsIpfsAddCidV0, kt as pTimeout, zr as PKCError } 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 { E as buildPagesRuntimeFields, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, G as pRetry, Jr as toCommunitiesWireEntry, K as pLimit, L as extractCrosspostRuntimeFields, Nt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Or as findLocalCommunityAddress, Pr as isLocalCommunityAddress, Pt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, St as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, T as buildPageRuntimeFields, Wn as verifyCommunityList, Xr as t$1, ft as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, gt as parseCommunityListSchemaWithPKCErrorIfItFails, ir as MAX_COMMUNITY_LIST_SIZE_BYTES, it as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, kt as parseJsonWithPKCErrorIfFails, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, rt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, st as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, tr as stringify, un as require_lib, xt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-
|
|
4
|
-
import { t as LocalCommunity } from "../../chunks/local-community-
|
|
1
|
+
import { C as hideClassPrivateProps, Sr as t, Vr as logger_default, X as replaceXWithY, br as n, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, i as calculateStringSizeSameAsIpfsAddCidV0, kt as pTimeout, zr as PKCError } from "../../chunks/util-BuTE1Bd1.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-Bx3xTqFv.js";
|
|
3
|
+
import { E as buildPagesRuntimeFields, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, G as pRetry, Jr as toCommunitiesWireEntry, K as pLimit, L as extractCrosspostRuntimeFields, Nt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Or as findLocalCommunityAddress, Pr as isLocalCommunityAddress, Pt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, St as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, T as buildPageRuntimeFields, Wn as verifyCommunityList, Xr as t$1, ft as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, gt as parseCommunityListSchemaWithPKCErrorIfItFails, ir as MAX_COMMUNITY_LIST_SIZE_BYTES, it as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, kt as parseJsonWithPKCErrorIfFails, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, rt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, st as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, tr as stringify, un as require_lib, xt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-D66Be62U.js";
|
|
4
|
+
import { t as LocalCommunity } from "../../chunks/local-community-SgssDrxj.js";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import assert from "assert";
|
|
@@ -159,6 +159,7 @@ export declare const RpcCommentUpdateResultSchema: z.ZodObject<{
|
|
|
159
159
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
160
160
|
removed: z.ZodOptional<z.ZodBoolean>;
|
|
161
161
|
reason: z.ZodOptional<z.ZodString>;
|
|
162
|
+
authorBanExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
162
163
|
approved: z.ZodOptional<z.ZodBoolean>;
|
|
163
164
|
updatedAt: z.ZodNumber;
|
|
164
165
|
author: z.ZodOptional<z.ZodObject<{
|