@pkcprotocol/pkc-js 0.0.151 → 0.0.153
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 +7 -7
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -1
- package/dist/browser/clients/rpc-client/schema.d.ts +2 -2
- package/dist/browser/clients/rpc-client/schema.js +3 -3
- package/dist/browser/clients/rpc-client/schema.js.map +1 -1
- package/dist/browser/community/schema.d.ts +3 -0
- package/dist/browser/community/schema.js +3 -0
- package/dist/browser/community/schema.js.map +1 -1
- 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 +2 -0
- package/dist/browser/publications/comment/schema.d.ts +4 -3
- package/dist/browser/publications/comment/schema.js +6 -2
- package/dist/browser/publications/comment/schema.js.map +1 -1
- package/dist/browser/publications/comment-edit/schema.d.ts +3 -3
- package/dist/browser/publications/comment-moderation/schema.d.ts +3 -3
- package/dist/browser/publications/community-edit/schema.d.ts +3 -3
- package/dist/browser/publications/vote/schema.d.ts +3 -3
- package/dist/browser/pubsub-messages/schema.d.ts +3 -3
- package/dist/browser/pubsub-messages/schema.js +6 -3
- package/dist/browser/pubsub-messages/schema.js.map +1 -1
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +1 -0
- package/dist/browser/rpc/src/schema.d.ts +6 -0
- package/dist/browser/runtime/node/community/challenges/index.d.ts +1 -1
- package/dist/browser/runtime/node/community/challenges/index.js +9 -3
- package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/question.js +1 -2
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/question.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/validate-challenge-result.js +7 -2
- package/dist/browser/runtime/node/community/challenges/validate-challenge-result.js.map +1 -1
- package/dist/browser/runtime/node/community/comment-update-row.d.ts +9 -0
- package/dist/browser/runtime/node/community/comment-update-row.js +49 -0
- package/dist/browser/runtime/node/community/comment-update-row.js.map +1 -0
- package/dist/browser/runtime/node/community/db-handler.js +10 -5
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/browser/runtime/node/community/db-row-parser.js +15 -1
- package/dist/browser/runtime/node/community/db-row-parser.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/challenges.d.ts +2 -2
- package/dist/browser/runtime/node/community/local-community/challenges.js +1 -1
- package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/comment-updates.js +17 -8
- package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
- package/dist/browser/runtime/node/util.js +2 -1
- package/dist/browser/runtime/node/util.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +5 -5
- package/dist/browser/schema/schema.d.ts +2 -2
- package/dist/browser/schema/schema.js +7 -2
- package/dist/browser/schema/schema.js.map +1 -1
- package/dist/browser/schema.d.ts +8 -0
- package/dist/browser/signer/signatures.js +12 -6
- package/dist/browser/signer/signatures.js.map +1 -1
- package/dist/browser/test/test-util.d.ts +1 -1
- package/dist/browser/test/test-util.js +3 -2
- package/dist/browser/test/test-util.js.map +1 -1
- package/dist/browser/version.js +1 -1
- package/dist/bundled/bundle-manifest.json +48 -47
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc-C86lDfh5.js → helia-for-pkc-COJ3xMF9.js} +33 -33
- package/dist/bundled/chunks/{local-community-DKZRsY97.js → local-community-BTx2HxIm.js} +1 -1
- package/dist/bundled/chunks/{local-community-k_ETfr57.js → local-community-CflGu_ET.js} +97 -53
- package/dist/bundled/chunks/{node-Br5aH83u.js → node-B0b6lAIX.js} +5 -5
- package/dist/bundled/chunks/{page-sort-scoring-DK29vmN0.js → page-sort-scoring-DAMnUmDY.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-Cfc2G6NP.js → rpc-local-community-Cy03QajY.js} +23 -13
- package/dist/bundled/chunks/{util-XNoDQ4hb.js → util-C4y8KHmp.js} +1 -1
- package/dist/bundled/chunks/{util-Bmd1e0QJ.js → util-D7AtfLYH.js} +11 -9
- package/dist/bundled/chunks/{validate-package-factories-evt2DaRs.js → validate-package-factories-EH9ydbPR.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/rpc-schema-util.d.ts +1 -1
- package/dist/node/clients/rpc-client/schema.d.ts +2 -2
- package/dist/node/clients/rpc-client/schema.js +3 -3
- package/dist/node/clients/rpc-client/schema.js.map +1 -1
- package/dist/node/community/schema.d.ts +3 -0
- package/dist/node/community/schema.js +3 -0
- package/dist/node/community/schema.js.map +1 -1
- 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 +2 -0
- package/dist/node/publications/comment/schema.d.ts +4 -3
- package/dist/node/publications/comment/schema.js +6 -2
- package/dist/node/publications/comment/schema.js.map +1 -1
- package/dist/node/publications/comment-edit/schema.d.ts +3 -3
- package/dist/node/publications/comment-moderation/schema.d.ts +3 -3
- package/dist/node/publications/community-edit/schema.d.ts +3 -3
- package/dist/node/publications/vote/schema.d.ts +3 -3
- package/dist/node/pubsub-messages/schema.d.ts +3 -3
- package/dist/node/pubsub-messages/schema.js +6 -3
- package/dist/node/pubsub-messages/schema.js.map +1 -1
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +1 -0
- package/dist/node/rpc/src/schema.d.ts +6 -0
- package/dist/node/runtime/node/community/challenges/index.d.ts +1 -1
- package/dist/node/runtime/node/community/challenges/index.js +9 -3
- package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/question.js +1 -2
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/question.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/validate-challenge-result.js +7 -2
- package/dist/node/runtime/node/community/challenges/validate-challenge-result.js.map +1 -1
- package/dist/node/runtime/node/community/comment-update-row.d.ts +9 -0
- package/dist/node/runtime/node/community/comment-update-row.js +49 -0
- package/dist/node/runtime/node/community/comment-update-row.js.map +1 -0
- package/dist/node/runtime/node/community/db-handler.js +10 -5
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/dist/node/runtime/node/community/db-row-parser.js +15 -1
- package/dist/node/runtime/node/community/db-row-parser.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/challenges.d.ts +2 -2
- package/dist/node/runtime/node/community/local-community/challenges.js +1 -1
- package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/comment-updates.js +17 -8
- package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
- package/dist/node/runtime/node/util.js +2 -1
- package/dist/node/runtime/node/util.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +5 -5
- package/dist/node/schema/schema.d.ts +2 -2
- package/dist/node/schema/schema.js +7 -2
- package/dist/node/schema/schema.js.map +1 -1
- package/dist/node/schema.d.ts +8 -0
- package/dist/node/signer/signatures.js +12 -6
- package/dist/node/signer/signatures.js.map +1 -1
- package/dist/node/test/test-util.d.ts +1 -1
- package/dist/node/test/test-util.js +3 -2
- package/dist/node/test/test-util.js.map +1 -1
- package/dist/node/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { i as __toESM } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, B as pubsubTopicToDhtKey, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, 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, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr 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, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-
|
|
3
|
-
import { $ as createSchemaRowParser, $r as require_lodash_merge, An as verifyChallengeAnswer, Ar as removeFileRetryingWhileBusy, Bn as verifyCommunityEdit, Br as t$11, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Hn as verifyVote, Hr as t$8, In as verifyCommentModeration, Kn as getAuthorNameFromWire, Kr as t$9, Ln as verifyCommentPubsubMessage, Lr as isCommunityStartLocked, Mn as verifyChallengeRequest, N as MAX_PAGE_SIZE_BYTES, Or as moveCommunityDbToDeletedDirectory, Pn as verifyCommentEdit, Pr as findCommunitiesEntry, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Qr as STORAGE_KEYS, Rn as verifyCommentUpdate, Rr as require_src, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Sr as getDefaultCommunityDbConfig, Tn as signCommentUpdateForChallengeVerification, Tr as importSignerIntoKuboNode, Un as buildRuntimeAuthor, Ur as n$5, Vr as r$2, W as pLimit, Wn as cleanWireAuthor, Wr as n$4, X as coerceSchemaRowBoolean, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, _ 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, jr as resolveDbPostsCidRefs, kr as refreshCommunitiesList, 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, qr as stringify, 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 getThumbnailPropsOfLink, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as forgetCommunityThatFailedToBeDeleted, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as t$10 } 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, At as ChallengeAnswerMessageSchema, B as pubsubTopicToDhtKey, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, 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, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr 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, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-D7AtfLYH.js";
|
|
3
|
+
import { $ as createSchemaRowParser, $r as require_lodash_merge, An as verifyChallengeAnswer, Ar as removeFileRetryingWhileBusy, Bn as verifyCommunityEdit, Br as t$11, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Hn as verifyVote, Hr as t$8, In as verifyCommentModeration, Kn as getAuthorNameFromWire, Kr as t$9, Ln as verifyCommentPubsubMessage, Lr as isCommunityStartLocked, Mn as verifyChallengeRequest, N as MAX_PAGE_SIZE_BYTES, Or as moveCommunityDbToDeletedDirectory, Pn as verifyCommentEdit, Pr as findCommunitiesEntry, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Qr as STORAGE_KEYS, Rn as verifyCommentUpdate, Rr as require_src, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Sr as getDefaultCommunityDbConfig, Tn as signCommentUpdateForChallengeVerification, Tr as importSignerIntoKuboNode, Un as buildRuntimeAuthor, Ur as n$5, Vr as r$2, W as pLimit, Wn as cleanWireAuthor, Wr as n$4, X as coerceSchemaRowBoolean, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, _ 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, jr as resolveDbPostsCidRefs, kr as refreshCommunitiesList, 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, qr as stringify, 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 getThumbnailPropsOfLink, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as forgetCommunityThatFailedToBeDeleted, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as t$10 } from "./rpc-local-community-Cy03QajY.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-DAMnUmDY.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 { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
-
import
|
|
8
|
+
import path from "node:path";
|
|
9
9
|
import os from "os";
|
|
10
10
|
import fs, { closeSync, existsSync, openSync, promises } from "node:fs";
|
|
11
|
-
import path from "path";
|
|
11
|
+
import path$1 from "path";
|
|
12
12
|
import assert from "assert";
|
|
13
13
|
import { Buffer as Buffer$1 } from "buffer";
|
|
14
14
|
import fs$1 from "fs";
|
|
@@ -187,6 +187,34 @@ async function reprovideAnchorRecordIfDue(community) {
|
|
|
187
187
|
await reprovideAnchorRecordIfNeeded(community);
|
|
188
188
|
}
|
|
189
189
|
//#endregion
|
|
190
|
+
//#region dist/node/runtime/node/community/comment-update-row.js
|
|
191
|
+
const commentUpdateSchemaKeys = new Set(Object.keys(CommentUpdateSchema.shape));
|
|
192
|
+
function commentUpdateExtraKeys(update) {
|
|
193
|
+
return Object.keys(update).filter((key) => !commentUpdateSchemaKeys.has(key));
|
|
194
|
+
}
|
|
195
|
+
function commentUpdateToDbRow({ update, dbOnlyFields }) {
|
|
196
|
+
const record = { ...update };
|
|
197
|
+
const extraProps = {};
|
|
198
|
+
for (const key of commentUpdateExtraKeys(update)) {
|
|
199
|
+
const value = record[key];
|
|
200
|
+
delete record[key];
|
|
201
|
+
if (value !== void 0) extraProps[key] = value;
|
|
202
|
+
}
|
|
203
|
+
const row = {
|
|
204
|
+
...record,
|
|
205
|
+
...dbOnlyFields
|
|
206
|
+
};
|
|
207
|
+
if (Object.keys(extraProps).length > 0) row.extraProps = extraProps;
|
|
208
|
+
return row;
|
|
209
|
+
}
|
|
210
|
+
function spreadCommentUpdateExtraProps(record, extraProps) {
|
|
211
|
+
if (!extraProps || typeof extraProps !== "object") return;
|
|
212
|
+
for (const [key, value] of Object.entries(extraProps)) {
|
|
213
|
+
if (value === null || value === void 0 || commentUpdateSchemaKeys.has(key)) continue;
|
|
214
|
+
record[key] = value;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
190
218
|
//#region node_modules/uuid/dist-node/rng.js
|
|
191
219
|
const rnds8 = new Uint8Array(16);
|
|
192
220
|
function rng() {
|
|
@@ -320,15 +348,15 @@ async function throwIfChallengeSettingsAreInvalid({ challengeSettings, pkc, comm
|
|
|
320
348
|
const processStartedCommunities = new TrackedInstanceRegistry();
|
|
321
349
|
function normalizeRegistryDataPath(dataPath) {
|
|
322
350
|
if (dataPath === void 0) return void 0;
|
|
323
|
-
const resolved = path.resolve(dataPath);
|
|
351
|
+
const resolved = path$1.resolve(dataPath);
|
|
324
352
|
let existing = resolved;
|
|
325
353
|
let tail = "";
|
|
326
354
|
while (true) try {
|
|
327
|
-
return path.join(fs$1.realpathSync.native(existing), tail);
|
|
355
|
+
return path$1.join(fs$1.realpathSync.native(existing), tail);
|
|
328
356
|
} catch {
|
|
329
|
-
const parent = path.dirname(existing);
|
|
357
|
+
const parent = path$1.dirname(existing);
|
|
330
358
|
if (parent === existing) return resolved;
|
|
331
|
-
tail = path.join(path.basename(existing), tail);
|
|
359
|
+
tail = path$1.join(path$1.basename(existing), tail);
|
|
332
360
|
existing = parent;
|
|
333
361
|
}
|
|
334
362
|
}
|
|
@@ -1351,7 +1379,10 @@ const commentIpfsCoercions = collectSchemaRowCoercions({
|
|
|
1351
1379
|
...CommentIpfsSchema.shape,
|
|
1352
1380
|
extraProps: CommentsTableRowSchema.shape.extraProps
|
|
1353
1381
|
});
|
|
1354
|
-
const commentUpdateCoercions = collectSchemaRowCoercions(
|
|
1382
|
+
const commentUpdateCoercions = collectSchemaRowCoercions({
|
|
1383
|
+
...CommentUpdateSchema.shape,
|
|
1384
|
+
extraProps: CommentUpdateTableRowSchema.shape.extraProps
|
|
1385
|
+
});
|
|
1355
1386
|
function compileColumns(columns, coercions) {
|
|
1356
1387
|
return columns.map((key) => ({
|
|
1357
1388
|
key,
|
|
@@ -1394,6 +1425,15 @@ function createPositionalCommentRowMapper(cols) {
|
|
|
1394
1425
|
}
|
|
1395
1426
|
const commentUpdate = {};
|
|
1396
1427
|
assignColumns(commentUpdate, row, updateOffset, updateColumns, "commentUpdate_");
|
|
1428
|
+
const commentUpdateExtraProps = commentUpdate.extraProps;
|
|
1429
|
+
if (commentUpdateExtraProps !== void 0) {
|
|
1430
|
+
delete commentUpdate.extraProps;
|
|
1431
|
+
spreadCommentUpdateExtraProps(commentUpdate, commentUpdateExtraProps);
|
|
1432
|
+
return {
|
|
1433
|
+
comment,
|
|
1434
|
+
commentUpdate: withSortedKeys(commentUpdate)
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1397
1437
|
return {
|
|
1398
1438
|
comment,
|
|
1399
1439
|
commentUpdate
|
|
@@ -1669,7 +1709,8 @@ var DbHandler = class {
|
|
|
1669
1709
|
lastReplyTimestamp INTEGER NULLABLE,
|
|
1670
1710
|
postUpdatesBucket INTEGER NULLABLE,
|
|
1671
1711
|
publishedToPostUpdatesMFS INTEGER NOT NULL, -- BOOLEAN (0/1)
|
|
1672
|
-
insertedAt INTEGER NOT NULL
|
|
1712
|
+
insertedAt INTEGER NOT NULL,
|
|
1713
|
+
extraProps TEXT NULLABLE -- JSON: unknown keys of the signed record (issue #572); a snapshot, this table is rebuilt on every DB_VERSION bump
|
|
1673
1714
|
)
|
|
1674
1715
|
`);
|
|
1675
1716
|
}
|
|
@@ -1796,9 +1837,9 @@ var DbHandler = class {
|
|
|
1796
1837
|
if (needToMigrate) {
|
|
1797
1838
|
if (dbExistsAlready && currentDbVersion > 0) {
|
|
1798
1839
|
this.destoryConnection();
|
|
1799
|
-
backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
1800
|
-
log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
1801
|
-
if (!fs$1.existsSync(path.dirname(backupDbPath))) await fs$1.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
|
|
1840
|
+
backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
1841
|
+
log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
1842
|
+
if (!fs$1.existsSync(path$1.dirname(backupDbPath))) await fs$1.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
|
|
1802
1843
|
const sourceDb = new Database(dbPath, { fileMustExist: true });
|
|
1803
1844
|
await sourceDb.backup(backupDbPath);
|
|
1804
1845
|
sourceDb.close();
|
|
@@ -2248,8 +2289,8 @@ var DbHandler = class {
|
|
|
2248
2289
|
const columnNames = this._getColumnNames(TABLES.COMMENT_UPDATES);
|
|
2249
2290
|
const stmt = this._prepareCached(`
|
|
2250
2291
|
INSERT INTO ${TABLES.COMMENT_UPDATES}
|
|
2251
|
-
(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)
|
|
2252
|
-
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)
|
|
2292
|
+
(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)
|
|
2293
|
+
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)
|
|
2253
2294
|
ON CONFLICT(cid) DO UPDATE SET
|
|
2254
2295
|
edit = excluded.edit, upvoteCount = excluded.upvoteCount, downvoteCount = excluded.downvoteCount, replyCount = excluded.replyCount, childCount = excluded.childCount,
|
|
2255
2296
|
number = COALESCE(excluded.number, ${TABLES.COMMENT_UPDATES}.number),
|
|
@@ -2259,7 +2300,8 @@ var DbHandler = class {
|
|
|
2259
2300
|
signature = excluded.signature, author = excluded.author, replies = excluded.replies, lastChildCid = excluded.lastChildCid,
|
|
2260
2301
|
lastReplyTimestamp = excluded.lastReplyTimestamp, postUpdatesBucket = excluded.postUpdatesBucket,
|
|
2261
2302
|
publishedToPostUpdatesMFS = excluded.publishedToPostUpdatesMFS,
|
|
2262
|
-
insertedAt = excluded.insertedAt
|
|
2303
|
+
insertedAt = excluded.insertedAt,
|
|
2304
|
+
extraProps = excluded.extraProps
|
|
2263
2305
|
`);
|
|
2264
2306
|
const defaults = t$5(columnNames, (column) => [column, null]);
|
|
2265
2307
|
this._db.transaction((items) => {
|
|
@@ -2385,7 +2427,7 @@ var DbHandler = class {
|
|
|
2385
2427
|
};
|
|
2386
2428
|
}
|
|
2387
2429
|
_pageEntryMapper(commentUpdateFieldsToExclude, existingOnly = false) {
|
|
2388
|
-
const commentUpdateCols = t$6(commentUpdateFieldsToExclude ? n$2(CommentUpdateSchema.shape, commentUpdateFieldsToExclude) : CommentUpdateSchema.shape);
|
|
2430
|
+
const commentUpdateCols = [...t$6(commentUpdateFieldsToExclude ? n$2(CommentUpdateSchema.shape, commentUpdateFieldsToExclude) : CommentUpdateSchema.shape), "extraProps"];
|
|
2389
2431
|
const commentIpfsCols = [...t$6(CommentIpfsSchema.shape), "extraProps"];
|
|
2390
2432
|
return this._positionalMapperFor({
|
|
2391
2433
|
commentIpfsCols: existingOnly ? this._existingColumns(TABLES.COMMENTS, commentIpfsCols) : commentIpfsCols,
|
|
@@ -3869,10 +3911,10 @@ var DbHandler = class {
|
|
|
3869
3911
|
if (this._db || this._keyv) await this.destoryConnection();
|
|
3870
3912
|
this._transactionDepth = 0;
|
|
3871
3913
|
const dataPath = this._community._pkc.dataPath;
|
|
3872
|
-
const oldPathString = path.join(dataPath, "communities", oldDbName);
|
|
3873
|
-
const newPathString = path.join(dataPath, "communities", newDbName);
|
|
3874
|
-
await fs$1.promises.mkdir(path.dirname(oldPathString), { recursive: true });
|
|
3875
|
-
await fs$1.promises.mkdir(path.dirname(newPathString), { recursive: true });
|
|
3914
|
+
const oldPathString = path$1.join(dataPath, "communities", oldDbName);
|
|
3915
|
+
const newPathString = path$1.join(dataPath, "communities", newDbName);
|
|
3916
|
+
await fs$1.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
|
|
3917
|
+
await fs$1.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
|
|
3876
3918
|
try {
|
|
3877
3919
|
if (!fs$1.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
|
|
3878
3920
|
else {
|
|
@@ -3899,8 +3941,8 @@ var DbHandler = class {
|
|
|
3899
3941
|
async lockCommunityStart({ onCompromised }) {
|
|
3900
3942
|
const log = logger_default("pkc-js:local-community:db-handler:lock:start");
|
|
3901
3943
|
const communityAddress = this._community.address;
|
|
3902
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3903
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3944
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3945
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3904
3946
|
const startLock = {};
|
|
3905
3947
|
try {
|
|
3906
3948
|
await import_src.default.lock(communityDbPath, {
|
|
@@ -3929,8 +3971,8 @@ var DbHandler = class {
|
|
|
3929
3971
|
const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
|
|
3930
3972
|
log.trace(`Attempting to unlock the start of community (${communityAddress})`);
|
|
3931
3973
|
this._heldStartLock = void 0;
|
|
3932
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3933
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3974
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3975
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3934
3976
|
if (!fs$1.existsSync(lockfilePath) || !fs$1.existsSync(communityDbPath)) return;
|
|
3935
3977
|
try {
|
|
3936
3978
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -3948,8 +3990,8 @@ var DbHandler = class {
|
|
|
3948
3990
|
}
|
|
3949
3991
|
async lockCommunityState() {
|
|
3950
3992
|
const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
|
|
3951
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3952
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3993
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3994
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3953
3995
|
try {
|
|
3954
3996
|
await import_src.default.lock(communityDbPath, {
|
|
3955
3997
|
lockfilePath,
|
|
@@ -3966,8 +4008,8 @@ var DbHandler = class {
|
|
|
3966
4008
|
}
|
|
3967
4009
|
async unlockCommunityState() {
|
|
3968
4010
|
const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
|
|
3969
|
-
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3970
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
4011
|
+
const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
4012
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3971
4013
|
if (!fs$1.existsSync(lockfilePath)) return;
|
|
3972
4014
|
try {
|
|
3973
4015
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -3977,7 +4019,7 @@ var DbHandler = class {
|
|
|
3977
4019
|
}
|
|
3978
4020
|
}
|
|
3979
4021
|
communityDbExists() {
|
|
3980
|
-
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
4022
|
+
const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3981
4023
|
return fs$1.existsSync(communityDbPath);
|
|
3982
4024
|
}
|
|
3983
4025
|
markCommentsAsPublishedToPostUpdates(commentCids) {
|
|
@@ -4655,17 +4697,19 @@ async function calculateNewCommentUpdate(opts) {
|
|
|
4655
4697
|
}
|
|
4656
4698
|
return {
|
|
4657
4699
|
newCommentUpdate,
|
|
4658
|
-
newCommentUpdateToWriteToDb: {
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
replies:
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4700
|
+
newCommentUpdateToWriteToDb: commentUpdateToDbRow({
|
|
4701
|
+
update: newCommentUpdate,
|
|
4702
|
+
dbOnlyFields: {
|
|
4703
|
+
replies: deriveDbReplies({
|
|
4704
|
+
replies: newCommentUpdate.replies,
|
|
4705
|
+
allPageCids,
|
|
4706
|
+
flatSortNames: generatedRepliesPages?.flatSortNames
|
|
4707
|
+
}),
|
|
4708
|
+
postUpdatesBucket: newPostUpdateBucket,
|
|
4709
|
+
publishedToPostUpdatesMFS: false,
|
|
4710
|
+
insertedAt: batchStartTimestamp
|
|
4711
|
+
}
|
|
4712
|
+
}),
|
|
4669
4713
|
localMfsPath: newLocalMfsPath,
|
|
4670
4714
|
pendingApproval: comment.pendingApproval
|
|
4671
4715
|
};
|
|
@@ -5068,7 +5112,7 @@ async function publishChallenges(community, challenges, request) {
|
|
|
5068
5112
|
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("publishing-challenge");
|
|
5069
5113
|
const challengeTopic = challengeExchangePubsubTopic(community);
|
|
5070
5114
|
if (challengeTopic && !community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(challengeTopic, challengeMessage);
|
|
5071
|
-
log(`Community ${community.address} with pubsub topic ${challengeTopic} published ${challengeMessage.type} over pubsub: `, t$10(toSignChallenge, ["timestamp"]), toEncryptChallenge.challenges.map((challenge) => challenge.type));
|
|
5115
|
+
log(`Community ${community.address} with pubsub topic ${challengeTopic} published ${challengeMessage.type} over pubsub: `, t$10(toSignChallenge, ["timestamp"]), Object.values(toEncryptChallenge.challenges).map((challenge) => challenge.type));
|
|
5072
5116
|
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("waiting-challenge-answers");
|
|
5073
5117
|
community.emit("challenge", {
|
|
5074
5118
|
...challengeMessage,
|
|
@@ -7539,9 +7583,9 @@ async function restartCommunityAfterFailedRename({ community, oldAddress, newAdd
|
|
|
7539
7583
|
}
|
|
7540
7584
|
}
|
|
7541
7585
|
async function removePartialDbCopy({ community, oldAddress, newAddress, log }) {
|
|
7542
|
-
const communitiesPath =
|
|
7543
|
-
const partialDbCopyPath =
|
|
7544
|
-
if (!fs.existsSync(
|
|
7586
|
+
const communitiesPath = path.join(community._pkc.dataPath, "communities");
|
|
7587
|
+
const partialDbCopyPath = path.join(communitiesPath, newAddress);
|
|
7588
|
+
if (!fs.existsSync(path.join(communitiesPath, oldAddress))) return {
|
|
7545
7589
|
removed: false,
|
|
7546
7590
|
path: partialDbCopyPath
|
|
7547
7591
|
};
|
|
@@ -7558,7 +7602,7 @@ async function removePartialDbCopy({ community, oldAddress, newAddress, log }) {
|
|
|
7558
7602
|
}
|
|
7559
7603
|
}
|
|
7560
7604
|
async function undoRenameAfterDbRenameFailed({ community, oldAddress, newAddress, dbRenameError, log }) {
|
|
7561
|
-
const communitiesPath =
|
|
7605
|
+
const communitiesPath = path.join(community._pkc.dataPath, "communities");
|
|
7562
7606
|
const partialDbCopy = await removePartialDbCopy({
|
|
7563
7607
|
community,
|
|
7564
7608
|
oldAddress,
|
|
@@ -7576,8 +7620,8 @@ async function undoRenameAfterDbRenameFailed({ community, oldAddress, newAddress
|
|
|
7576
7620
|
error: new PKCError("ERR_FAILED_TO_RENAME_COMMUNITY_DB", {
|
|
7577
7621
|
oldAddress,
|
|
7578
7622
|
newAddress,
|
|
7579
|
-
oldDbPath:
|
|
7580
|
-
newDbPath:
|
|
7623
|
+
oldDbPath: path.join(communitiesPath, oldAddress),
|
|
7624
|
+
newDbPath: path.join(communitiesPath, newAddress),
|
|
7581
7625
|
error: dbRenameError,
|
|
7582
7626
|
errorMessage: renameError?.message,
|
|
7583
7627
|
errorName: renameError?.name,
|
|
@@ -7760,11 +7804,11 @@ async function edit(community, newCommunityOptions) {
|
|
|
7760
7804
|
const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
|
|
7761
7805
|
function defaultExportPathFor(community, exportId) {
|
|
7762
7806
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7763
|
-
return
|
|
7807
|
+
return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
|
|
7764
7808
|
}
|
|
7765
7809
|
function sourceDbPathFor(community) {
|
|
7766
7810
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7767
|
-
return
|
|
7811
|
+
return path.join(community._pkc.dataPath, "communities", community.address);
|
|
7768
7812
|
}
|
|
7769
7813
|
async function persistExports(community) {
|
|
7770
7814
|
if (!community._dbHandler) return;
|
|
@@ -7840,9 +7884,9 @@ async function runExportTask(community, exportId, opts) {
|
|
|
7840
7884
|
async function exportCommunityEmbedded(community, options = {}) {
|
|
7841
7885
|
if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
7842
7886
|
const exportId = v4();
|
|
7843
|
-
const destPath = options.exportPath ?
|
|
7887
|
+
const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
|
|
7844
7888
|
const includePrivateKey = options.includePrivateKey === true;
|
|
7845
|
-
if (
|
|
7889
|
+
if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
|
|
7846
7890
|
communityAddress: community.address,
|
|
7847
7891
|
exportPath: destPath
|
|
7848
7892
|
});
|
|
@@ -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, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, Hr as setErrorMap, In as CommentUpdateForChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenAbortSignalFires, W as rejectWhenCommunityStopsOrAborts, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Z as resolveWhenPredicateIsTrue, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, hr as isStringDomain, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, jn as CommentIpfsSchema, jr as require_retry$1, k as isIpns, kt as pTimeout, ni as en_default, 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$1, vt as refreshTrackedCommentAliases, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, z as linkAbortSignals, zn as CommentUpdateSchema, zr as logger_default } from "./util-
|
|
3
|
-
import { $n as buildRuntimeCommunityFields, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Cr as getDefaultDataPath, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dr as monitorCommunitiesDirectory, Dt as parseJsonWithPKCErrorIfFails, Er as listCommunitiesSync, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Fr as toCommunitiesEntry, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gr as t$2, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Hr as t$3, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as t$4, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lt as RpcCidParamSchema, M as parseRawPages, Mr as setNativeFunctions$1, Nn as verifyChallengeVerification, Nr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pr as findCommunitiesEntry, Pt as RpcAnchorPublishPreparationResultSchema, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as n$3, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xr as NAME_RESOLVED_TRUE_TTL_MS, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVED_FALSE_TTL_MS, Yt as RpcFetchCommunityListParamSchema, Zr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, ei as nativeFunctions$2, 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, 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, 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, zr as t$5, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-
|
|
4
|
-
import { s as getHeliaDebugContext } from "./util-
|
|
2
|
+
import { $ as retryKuboIpfsAdd, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, Hr as setErrorMap, In as CommentUpdateForChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenAbortSignalFires, W as rejectWhenCommunityStopsOrAborts, X as replaceXWithY, Y as removeUndefinedValuesRecursively, Z as resolveWhenPredicateIsTrue, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as throwIfAbortSignalAborted, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, hr as isStringDomain, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, jn as CommentIpfsSchema, jr as require_retry$1, k as isIpns, kt as pTimeout, ni as en_default, 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$1, vt as refreshTrackedCommentAliases, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, z as linkAbortSignals, zn as CommentUpdateSchema, zr as logger_default } from "./util-D7AtfLYH.js";
|
|
3
|
+
import { $n as buildRuntimeCommunityFields, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Cr as getDefaultDataPath, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dr as monitorCommunitiesDirectory, Dt as parseJsonWithPKCErrorIfFails, Er as listCommunitiesSync, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Fr as toCommunitiesEntry, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gr as t$2, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Hr as t$3, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as t$4, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lt as RpcCidParamSchema, M as parseRawPages, Mr as setNativeFunctions$1, Nn as verifyChallengeVerification, Nr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pr as findCommunitiesEntry, Pt as RpcAnchorPublishPreparationResultSchema, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as n$3, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xr as NAME_RESOLVED_TRUE_TTL_MS, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVED_FALSE_TTL_MS, Yt as RpcFetchCommunityListParamSchema, Zr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, ei as nativeFunctions$2, 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, 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, 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, zr as t$5, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-Cy03QajY.js";
|
|
4
|
+
import { s as getHeliaDebugContext } from "./util-C4y8KHmp.js";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import fs from "fs";
|
|
@@ -36109,7 +36109,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
36109
36109
|
this.clients.libp2pJsClients = {};
|
|
36110
36110
|
if (!this.libp2pJsClientsOptions) return;
|
|
36111
36111
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
36112
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
36112
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-COJ3xMF9.js");
|
|
36113
36113
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
36114
36114
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
36115
36115
|
...clientOptions,
|
|
@@ -36486,7 +36486,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
36486
36486
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
36487
36487
|
log.trace("Received community options to create a local community instance:", options);
|
|
36488
36488
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
36489
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
36489
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-BTx2HxIm.js");
|
|
36490
36490
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
36491
36491
|
const community = new LocalCommunity(this);
|
|
36492
36492
|
if (isLocalCommunity) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bn as PageSortFileSchema, hr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-
|
|
1
|
+
import { bn as PageSortFileSchema, hr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-D7AtfLYH.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-Cfc2G6NP.js → rpc-local-community-Cy03QajY.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as e$4, B as pubsubTopicToDhtKey, Bn as CommentUpdateSignedPropertyNames, Br as require_supports_color, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as r$7, Dt as require_sha256$1, E as isAbortError, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, H as raceAgainstAbort, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as looseObject, Kn as PageIpfsSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$12, Un as CreateCommentOptionsWithRefinementSchema, Ur as _enum, Ut as NameResolveCacheOptionsSchema, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as object, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as
|
|
2
|
+
import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as e$4, B as pubsubTopicToDhtKey, Bn as CommentUpdateSignedPropertyNames, Br as require_supports_color, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as r$7, Dt as require_sha256$1, E as isAbortError, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, H as raceAgainstAbort, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as looseObject, Kn as PageIpfsSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$12, Un as CreateCommentOptionsWithRefinementSchema, Ur as _enum, Ut as NameResolveCacheOptionsSchema, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as object, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersByIndexSchema, at as throwIfAbortSignalAborted, bn as PageSortFileSchema, br as t$13, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isStringDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, jn as CommentIpfsSchema, jr as require_retry$2, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, nr as AuthorCommentIpfsReservedFields, nt as 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 literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, rt as sleepUntilTimeoutOrAbort, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyAddress, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as linkAbortSignals, zn as CommentUpdateSchema, zr as logger_default } from "./util-D7AtfLYH.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-DAMnUmDY.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import dns from "node:dns";
|
|
@@ -118323,7 +118323,7 @@ function deriveDbPosts(opts) {
|
|
|
118323
118323
|
}
|
|
118324
118324
|
function resolveDbPostsCidRefs(opts) {
|
|
118325
118325
|
const { dbPosts, dbHandler } = opts;
|
|
118326
|
-
const commentUpdateCols = t$13(CommentUpdateSchema.shape);
|
|
118326
|
+
const commentUpdateCols = [...t$13(CommentUpdateSchema.shape), "extraProps"];
|
|
118327
118327
|
const commentIpfsCols = [...t$13(CommentIpfsSchema.shape), "extraProps"];
|
|
118328
118328
|
const pages = {};
|
|
118329
118329
|
const pageCids = {};
|
|
@@ -123949,12 +123949,16 @@ async function signComment({ comment, pkc }) {
|
|
|
123949
123949
|
return await _signJson(CommentSignedPropertyNames, comment, comment.signer, log);
|
|
123950
123950
|
}
|
|
123951
123951
|
async function signCommentUpdate({ update, signer }) {
|
|
123952
|
-
|
|
123952
|
+
const log = logger_default("pkc-js:signatures:signCommentUpdate");
|
|
123953
|
+
return await _signJson(_withExtraKeysSigned(CommentUpdateSignedPropertyNames, update), update, signer, log);
|
|
123954
|
+
}
|
|
123955
|
+
function _withExtraKeysSigned(baseNames, record) {
|
|
123956
|
+
const extraKeys = Object.keys(record).filter((k) => !baseNames.includes(k) && k !== "signature");
|
|
123957
|
+
return [...baseNames, ...extraKeys];
|
|
123953
123958
|
}
|
|
123954
123959
|
async function signCommentUpdateForChallengeVerification({ update, signer }) {
|
|
123955
123960
|
const log = logger_default("pkc-js:signatures:signCommentUpdateForChallengeVerification");
|
|
123956
|
-
|
|
123957
|
-
return await _signJson([...CommentUpdateForChallengeVerificationSignedPropertyNames, ...extraKeys], update, signer, log);
|
|
123961
|
+
return await _signJson(_withExtraKeysSigned(CommentUpdateForChallengeVerificationSignedPropertyNames, update), update, signer, log);
|
|
123958
123962
|
}
|
|
123959
123963
|
async function signVote({ vote, pkc }) {
|
|
123960
123964
|
const log = logger_default("pkc-js:signatures:signVote");
|
|
@@ -147091,7 +147095,7 @@ const RpcCommentEventResultSchema = object({
|
|
|
147091
147095
|
runtimeFields: object({}).loose().optional()
|
|
147092
147096
|
});
|
|
147093
147097
|
const RpcCommentUpdateResultSchema = object({
|
|
147094
|
-
commentUpdate: CommentUpdateSchema,
|
|
147098
|
+
commentUpdate: CommentUpdateSchema.loose(),
|
|
147095
147099
|
runtimeFields: object({}).loose().optional()
|
|
147096
147100
|
});
|
|
147097
147101
|
const RpcChallengeVerificationEventResultSchema = object({
|
|
@@ -147124,7 +147128,7 @@ const RpcEditCommunityParamSchema = object({
|
|
|
147124
147128
|
}).refine((args) => args.name || args.publicKey, "At least one of name or publicKey must be provided");
|
|
147125
147129
|
const RpcPublishChallengeAnswersParamSchema = object({
|
|
147126
147130
|
subscriptionId: SubscriptionIdSchema,
|
|
147127
|
-
challengeAnswers:
|
|
147131
|
+
challengeAnswers: ChallengeAnswersByIndexSchema
|
|
147128
147132
|
});
|
|
147129
147133
|
const RpcUnsubscribeParamSchema = object({ subscriptionId: SubscriptionIdSchema });
|
|
147130
147134
|
const RpcStateChangeEventResultSchema = object({ state: string() });
|
|
@@ -154426,11 +154430,10 @@ const optionInputs$1 = [{
|
|
|
154426
154430
|
}];
|
|
154427
154431
|
const type$1 = "text/plain";
|
|
154428
154432
|
const description = `Ask a question, like 'What is the password?'`;
|
|
154429
|
-
const getChallenge$1 = async ({ challengeSettings,
|
|
154433
|
+
const getChallenge$1 = async ({ challengeSettings, challengeAnswer }) => {
|
|
154430
154434
|
if (!challengeSettings?.options?.question) throw Error("No option question");
|
|
154431
154435
|
let answer = challengeSettings?.options?.answer;
|
|
154432
154436
|
if (!answer) throw Error("no option answer");
|
|
154433
|
-
const challengeAnswer = challengeRequestMessage?.challengeAnswers?.[challengeIndex];
|
|
154434
154437
|
if (challengeAnswer === void 0) return {
|
|
154435
154438
|
challenge: challengeSettings?.options?.question,
|
|
154436
154439
|
verify: async (_answer) => {
|
|
@@ -154601,7 +154604,7 @@ function validateChallengeResultExtras({ challengeResult, challengeIndex }) {
|
|
|
154601
154604
|
});
|
|
154602
154605
|
}
|
|
154603
154606
|
if (challengeResult.commentUpdate) {
|
|
154604
|
-
for (const key of Object.keys(challengeResult.commentUpdate)) if (CommentUpdateChallengeReservedFieldNames.includes(key)) throw new PKCError("ERR_CHALLENGE_RESULT_OVERRIDES_RESERVED_COMMENT_UPDATE_FIELD", {
|
|
154607
|
+
for (const key of Object.keys(challengeResult.commentUpdate)) if (CommentUpdateChallengeReservedFieldNames.includes(key) || CommentUpdateReservedFields.includes(key) || key === "__proto__") throw new PKCError("ERR_CHALLENGE_RESULT_OVERRIDES_RESERVED_COMMENT_UPDATE_FIELD", {
|
|
154605
154608
|
challengeIndex,
|
|
154606
154609
|
offendingKey: key
|
|
154607
154610
|
});
|
|
@@ -154742,6 +154745,7 @@ const callGetChallenge = async ({ challengeFile, communityChallengeSettings, cha
|
|
|
154742
154745
|
challengeSettings: communityChallengeSettings,
|
|
154743
154746
|
challengeRequestMessage,
|
|
154744
154747
|
challengeIndex,
|
|
154748
|
+
challengeAnswer: challengeRequestMessage.challengeAnswers?.[String(challengeIndex)],
|
|
154745
154749
|
community,
|
|
154746
154750
|
authorIdentityMatcher
|
|
154747
154751
|
});
|
|
@@ -155010,7 +155014,13 @@ const getChallengeVerificationFromChallengeAnswers = async ({ pendingChallenges,
|
|
|
155010
155014
|
}) : NO_OP_AUTHOR_IDENTITY_MATCHER);
|
|
155011
155015
|
const challengeCount = community.settings.challenges.length;
|
|
155012
155016
|
const verifyChallengePromises = [];
|
|
155013
|
-
for (const
|
|
155017
|
+
for (const pendingChallenge of pendingChallenges) {
|
|
155018
|
+
const challengeAnswer = challengeAnswers[String(pendingChallenge.index)];
|
|
155019
|
+
verifyChallengePromises.push(challengeAnswer === void 0 ? Promise.resolve({
|
|
155020
|
+
success: false,
|
|
155021
|
+
error: "No answer."
|
|
155022
|
+
}) : Promise.resolve(pendingChallenge.verify(challengeAnswer)));
|
|
155023
|
+
}
|
|
155014
155024
|
const challengeResultsWithPendingIndexes = await Promise.all(verifyChallengePromises);
|
|
155015
155025
|
for (const i in challengeResultsWithPendingIndexes) validateChallengeResult({
|
|
155016
155026
|
challengeResult: challengeResultsWithPendingIndexes[Number(i)],
|
|
@@ -155146,7 +155156,7 @@ const getChallengeVerification = async ({ challengeRequestMessage, community, ge
|
|
|
155146
155156
|
let challengeVerification;
|
|
155147
155157
|
let postAnswerAuthorIdentityMatcher;
|
|
155148
155158
|
if ("pendingChallenges" in res) {
|
|
155149
|
-
const challengeAnswers = await getChallengeAnswers(res.pendingChallenges.map((challenge) => n$10(challenge, ["index", "verify"])));
|
|
155159
|
+
const challengeAnswers = await getChallengeAnswers(Object.fromEntries(res.pendingChallenges.map((challenge) => [String(challenge.index), n$10(challenge, ["index", "verify"])])));
|
|
155150
155160
|
postAnswerAuthorIdentityMatcher = authorIdentityMatcherForRequest({
|
|
155151
155161
|
community,
|
|
155152
155162
|
request: challengeRequestMessage
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Lr as PKCError, V as pubsubTopicToDhtKeyCid, z as linkAbortSignals } from "./util-
|
|
1
|
+
import { Lr as PKCError, V as pubsubTopicToDhtKeyCid, z as linkAbortSignals } from "./util-D7AtfLYH.js";
|
|
2
2
|
import { ipnsSelector } from "ipns/selector";
|
|
3
3
|
import { ipnsValidator } from "ipns/validator";
|
|
4
4
|
import { unmarshalIPNSRecord } from "ipns";
|