@pkcprotocol/pkc-js 0.0.100 → 0.0.102
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 +1 -0
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +4 -2
- package/dist/browser/clients/rpc-client/schema.d.ts +4 -2
- package/dist/browser/community/schema.d.ts +125 -51
- package/dist/browser/community/schema.js +20 -4
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/domain-util.d.ts +3 -0
- package/dist/browser/domain-util.js +16 -0
- package/dist/browser/domain-util.js.map +1 -0
- package/dist/browser/errors.d.ts +5 -0
- package/dist/browser/errors.js +5 -0
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/index-with-compile-cache.d.ts +18 -12
- package/dist/browser/index.d.ts +18 -12
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/publications/community-edit/schema.d.ts +16 -8
- package/dist/browser/pubsub-messages/schema.d.ts +8 -4
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +9 -6
- package/dist/browser/rpc/src/schema.d.ts +54 -36
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.d.ts +1 -1
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.js +41 -16
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/exclude/utils.d.ts +2 -3
- package/dist/browser/runtime/node/community/challenges/exclude/utils.js +1 -15
- package/dist/browser/runtime/node/community/challenges/exclude/utils.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/index.js +1 -1
- package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +18 -13
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +18 -13
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
- package/dist/browser/runtime/node/community/db-handler.d.ts +3 -2
- package/dist/browser/runtime/node/community/db-handler.js +20 -2
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/author-identity.d.ts +19 -0
- package/dist/browser/runtime/node/community/local-community/author-identity.js +50 -0
- package/dist/browser/runtime/node/community/local-community/author-identity.js.map +1 -0
- package/dist/browser/runtime/node/community/local-community/publication-validation.js +14 -22
- package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +36 -18
- package/dist/browser/schema.d.ts +72 -48
- package/dist/browser/test/test-util.d.ts +17 -10
- package/dist/browser/test/test-util.js +1 -1
- package/dist/browser/test/test-util.js.map +1 -1
- package/dist/browser/util.d.ts +1 -4
- package/dist/browser/util.js +4 -10
- package/dist/browser/util.js.map +1 -1
- package/dist/browser/version.js +1 -1
- package/dist/bundled/bundle-manifest.json +27 -25
- package/dist/bundled/chunks/{helia-for-pkc-Cq6VWePV.js → helia-for-pkc-ZbhRl9a-.js} +2 -2
- package/dist/bundled/chunks/{local-community-CcHbWkoT.js → local-community-Cu95rtju.js} +1 -1
- package/dist/bundled/chunks/{local-community-ph-pl_pg.js → local-community-L-1IkV1x.js} +26 -20
- package/dist/bundled/chunks/{node-2PkhAerB.js → node-DaN6R9HB.js} +5 -5
- package/dist/bundled/chunks/{rpc-local-community-BK1FjUk2.js → rpc-local-community-aV790d8_.js} +94 -35
- package/dist/bundled/chunks/{schema-CYR820MD.js → schema-gif6qroG.js} +31 -19
- package/dist/bundled/chunks/{util-gAVw5PrE.js → util-BsJoElMm.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +4 -2
- package/dist/node/clients/rpc-client/schema.d.ts +4 -2
- package/dist/node/community/schema.d.ts +125 -51
- package/dist/node/community/schema.js +20 -4
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/domain-util.d.ts +3 -0
- package/dist/node/domain-util.js +16 -0
- package/dist/node/domain-util.js.map +1 -0
- package/dist/node/errors.d.ts +5 -0
- package/dist/node/errors.js +5 -0
- package/dist/node/errors.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/index-with-compile-cache.d.ts +18 -12
- package/dist/node/index.d.ts +18 -12
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/publications/community-edit/schema.d.ts +16 -8
- package/dist/node/pubsub-messages/schema.d.ts +8 -4
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +9 -6
- package/dist/node/rpc/src/schema.d.ts +54 -36
- package/dist/node/runtime/node/community/challenges/exclude/exclude.d.ts +1 -1
- package/dist/node/runtime/node/community/challenges/exclude/exclude.js +41 -16
- package/dist/node/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/exclude/utils.d.ts +2 -3
- package/dist/node/runtime/node/community/challenges/exclude/utils.js +1 -15
- package/dist/node/runtime/node/community/challenges/exclude/utils.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/index.js +1 -1
- package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +18 -13
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +18 -13
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
- package/dist/node/runtime/node/community/db-handler.d.ts +3 -2
- package/dist/node/runtime/node/community/db-handler.js +20 -2
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/author-identity.d.ts +19 -0
- package/dist/node/runtime/node/community/local-community/author-identity.js +50 -0
- package/dist/node/runtime/node/community/local-community/author-identity.js.map +1 -0
- package/dist/node/runtime/node/community/local-community/publication-validation.js +14 -22
- package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +36 -18
- package/dist/node/schema.d.ts +72 -48
- package/dist/node/test/test-util.d.ts +17 -10
- package/dist/node/test/test-util.js +1 -1
- package/dist/node/test/test-util.js.map +1 -1
- package/dist/node/util.d.ts +1 -4
- package/dist/node/util.js +4 -10
- package/dist/node/util.js.map +1 -1
- package/dist/node/version.js +1 -1
- package/package.json +4 -3
package/dist/bundled/chunks/{rpc-local-community-BK1FjUk2.js → rpc-local-community-aV790d8_.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as isRequestPubsubPublicationOfReply, $n as CommunityAuthorChallengeReservedFieldNames, $t as
|
|
2
|
+
import { $ as isRequestPubsubPublicationOfReply, $n as CommunityAuthorChallengeReservedFieldNames, $t as ChallengeFileFactorySchema, A as doesDomainAddressHaveCapitalLetter, An as CommentUpdateReservedFields, Ar as boolean, B as ipnsNameToIpnsOverPubsubTopic, Cn as CommentIpfsSchema, Cr as messages, D as createAbortError, Dn as CommentUpdateChallengeReservedFieldNames, Dt as listStartedCommunities, En as CommentSignedPropertyNames, Er as require_ms$1, Et as findUpdatingCommunity, Fn as CreateCommentOptionsWithRefinementSchema, Fr as record, Ft as trackUpdatingCommunity, G as isIpnsPath, Gn as CreateCommentEditOptionsWithRefinementSchema, Gt as CommunityEditPubsubMessagePublicationSchema, H as isIpfsCid, Ht as CommunityEditPublicationChallengeRequestToEncryptSchema, In as GetPageParamSchema, Ir as string, It as untrackStartedCommunity, Jt as CommentModerationPubsubMessagePublicationSchema, Kn as AuthorAddressSchema, Kt as CreateCommunityEditPublicationOptionsWithRefinementSchema, L as getPostUpdateTimestampRange, Ln as ModQueuePageIpfsSchema, Lt as untrackUpdatingComment, M as fetchAndValidateIpnsRecordFromGateway, Mn as CommentUpdateSignedPropertyNames, Mr as literal, Nr as number, Nt as trackStartedCommunity, O as deepMergeRuntimeFields, Or as _enum, Pr as object, Q as isRequestPubsubPublicationOfPost, Qn as CommunityAddressSchema, Qt as CreateCommentModerationOptionsWithRefinementSchema, R as hideClassPrivateProps, Rn as PageIpfsSchema, Rt as untrackUpdatingCommunity, S as calculateIpfsCidV0, Sn as CommentIpfsReservedFields, Sr as PKCError, Tn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Tr as require_supports_color, Tt as findUpdatingComment, U as isIpfsPath, Un as CommentEditSignedPropertyNames, V as isAbortError, Vn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Vt as pTimeout, W as isIpns, Wt as CommunityEditPublicationSignedPropertyNames, Xn as CidPathSchema, Xt as CommentModerationSignedPropertyNames, Yn as ChallengeAnswersSchema, Zn as CidStringSchema, Zt as CommentModerationsTableRowSchema, _ as PKCUserOptionBaseSchema, _n as VotePubsubMessagePublicationSchema, _r as FailedToFetchCommentIpfsFromGatewaysError, _t as sleepUntilTimeoutOrAbort, an as CommunityIpfsReservedFields, ar as t$13, b as areEquivalentCommunityAddresses, br as FailedToFetchGenericIpfsFromGatewaysError, bt as timestamp, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateNewLocalCommunityUserOptionsSchema, cr as t$11, dn as ExportCommunityModLogsOptionsSchema, dr as n$8, dt as resolveWhenPredicateIsTrue, en as ChallengeFileSchema, er as CreateSignerSchema, et as pubsubTopicToDhtKey, f as DecryptedChallengeSchema, fr as r$7, g as PKCParsedOptionsSchema, gn as VoteChallengeRequestToEncryptSchema, gr as require_retry$1, gt as shortifyCid, h as NameResolverSerializedSchema, hn as CreateVoteUserOptionsWithRefinementSchema, hr as e$4, ht as shortifyAddress, i as ChallengeMessageSignedPropertyNames, in as CommunityExportRecordsSchema, j as extractNetworkErrorDetails, jn as CommentUpdateSchema, jr as custom, jt as refreshTrackedCommunityAliases, k as derivePublicationFromChallengeRequest, kn as CommentUpdateForChallengeVerificationSignedPropertyNames, kr as array, kt as listUpdatingCommunities, l as DecryptedChallengeAnswerSchema, ln as CreateRemoteCommunityFunctionArgumentSchema, lr as r$8, m as NameResolveCacheOptionsSchema, mn as isStringDomain, mr as t$9, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityChallengeSettingSchema, nt as raceAgainstAbort, o as ChallengeRequestMessageSignedPropertyNames, on as CommunityIpfsSchema, or as e$6, p as DecryptedChallengeVerificationSchema, pn as RpcRemoteCommunityUpdateEventResultSchema, pr as t$10, qn as AuthorCommentIpfsReservedFields, qt as CommentModerationChallengeRequestToEncryptSchema, rn as CommunityEditOptionsSchema, rr as n$9, sn as CommunitySignedPropertyNames, sr as e$5, st as removeNullUndefinedEmptyObjectsValuesRecursively, tr as n$10, un as CreateRpcCommunityFunctionArgumentSchema, ur as t$12, v as PKCUserOptionsSchema, vr as FailedToFetchCommentUpdateFromGatewaysError, wr as logger_default, wt as findStartedCommunity, xn as CommentChallengeRequestToEncryptSchema, xr as FailedToFetchPageIpfsFromGatewaysError, xt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, yn as VoteSignedPropertyNames, yr as FailedToFetchCommunityFromGatewaysError, yt as throwIfAbortSignalAborted, z as interruptibleSleep, zn as CommentEditChallengeRequestToEncryptSchema, zt as require_sha256$1 } from "./schema-gif6qroG.js";
|
|
3
3
|
import { t as all } from "./src-CYIMjhjK.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
@@ -128211,12 +128211,6 @@ var import_quick_lru = /* @__PURE__ */ __toESM(require_quick_lru(), 1);
|
|
|
128211
128211
|
const getTimestampSecondsAgo = (secondsToGoBack) => Math.round(Date.now() / 1e3) - secondsToGoBack;
|
|
128212
128212
|
const testScore = (excludeScore, authorScore) => excludeScore === void 0 || excludeScore <= (authorScore || 0);
|
|
128213
128213
|
const testFirstCommentTimestamp = (excludeTime, authorFirstCommentTimestamp) => excludeTime === void 0 || getTimestampSecondsAgo(excludeTime) >= (authorFirstCommentTimestamp || Infinity);
|
|
128214
|
-
const testRole = (excludeRole, authorAddress, communityRoles) => {
|
|
128215
|
-
if (excludeRole === void 0) return true;
|
|
128216
|
-
if (communityRoles === void 0) return false;
|
|
128217
|
-
for (const roleName of excludeRole) if (communityRoles[authorAddress]?.role === roleName) return true;
|
|
128218
|
-
return false;
|
|
128219
|
-
};
|
|
128220
128214
|
const isVote = (request) => Boolean(request.vote);
|
|
128221
128215
|
const isReply = (request) => isRequestPubsubPublicationOfReply(request);
|
|
128222
128216
|
const isPost = (request) => isRequestPubsubPublicationOfPost(request);
|
|
@@ -128514,8 +128508,58 @@ const addToRateLimiter = (communityChallenges, request, challengeSuccess) => {
|
|
|
128514
128508
|
for (const rateLimiter of Object.values(rateLimiters)) rateLimiter.tryRemoveTokens(1);
|
|
128515
128509
|
};
|
|
128516
128510
|
//#endregion
|
|
128511
|
+
//#region dist/node/runtime/node/community/local-community/author-identity.js
|
|
128512
|
+
function createAuthorIdentityMatcher({ community, publication }) {
|
|
128513
|
+
const log = logger_default("pkc-js:local-community:author-identity");
|
|
128514
|
+
const signerAddress = getPKCAddressFromPublicKeySync(publication.signature.publicKey);
|
|
128515
|
+
const wireName = getAuthorNameFromWire(publication.author);
|
|
128516
|
+
let nameResolvesToSignerPromise;
|
|
128517
|
+
const nameResolvesToSigner = () => {
|
|
128518
|
+
if (!wireName || !isStringDomain(wireName)) return Promise.resolve(false);
|
|
128519
|
+
if (!nameResolvesToSignerPromise) nameResolvesToSignerPromise = (async () => {
|
|
128520
|
+
try {
|
|
128521
|
+
const { resolvedAuthorName } = await community._clientsManager.resolveAuthorNameIfNeeded({
|
|
128522
|
+
authorName: wireName,
|
|
128523
|
+
abortSignal: AbortSignal.timeout(community._pkc._timeouts["resolve-author-name"]),
|
|
128524
|
+
cache: { maxAge: 0 }
|
|
128525
|
+
});
|
|
128526
|
+
return resolvedAuthorName === signerAddress;
|
|
128527
|
+
} catch (e) {
|
|
128528
|
+
log("Failed to resolve author name while matching identity, treating as no match", wireName, e);
|
|
128529
|
+
return false;
|
|
128530
|
+
}
|
|
128531
|
+
})();
|
|
128532
|
+
return nameResolvesToSignerPromise;
|
|
128533
|
+
};
|
|
128534
|
+
const matchesIdentity = async (identity) => {
|
|
128535
|
+
if (!isStringDomain(identity)) return identity === signerAddress;
|
|
128536
|
+
if (identity !== wireName) return false;
|
|
128537
|
+
return nameResolvesToSigner();
|
|
128538
|
+
};
|
|
128539
|
+
const matchesAnyIdentity = async (identities) => {
|
|
128540
|
+
let nameListed = false;
|
|
128541
|
+
for (const identity of identities) {
|
|
128542
|
+
if (identity === signerAddress) return true;
|
|
128543
|
+
if (wireName && identity === wireName) nameListed = true;
|
|
128544
|
+
}
|
|
128545
|
+
return nameListed ? nameResolvesToSigner() : false;
|
|
128546
|
+
};
|
|
128547
|
+
return {
|
|
128548
|
+
signerAddress,
|
|
128549
|
+
wireName,
|
|
128550
|
+
matchesIdentity,
|
|
128551
|
+
matchesAnyIdentity
|
|
128552
|
+
};
|
|
128553
|
+
}
|
|
128554
|
+
//#endregion
|
|
128517
128555
|
//#region dist/node/runtime/node/community/challenges/exclude/exclude.js
|
|
128518
|
-
const
|
|
128556
|
+
const testRole = async (excludeRole, getIdentityMatcher, communityRoles) => {
|
|
128557
|
+
if (!communityRoles) return false;
|
|
128558
|
+
const roleKeys = Object.keys(communityRoles).filter((roleKey) => excludeRole.includes(communityRoles[roleKey].role));
|
|
128559
|
+
if (roleKeys.length === 0) return false;
|
|
128560
|
+
return getIdentityMatcher().matchesAnyIdentity(roleKeys);
|
|
128561
|
+
};
|
|
128562
|
+
const shouldExcludePublication = async (communityChallenge, request, community) => {
|
|
128519
128563
|
if (!communityChallenge) throw Error(`shouldExcludePublication invalid communityChallenge argument '${communityChallenge}'`);
|
|
128520
128564
|
const publication = derivePublicationFromChallengeRequest(request);
|
|
128521
128565
|
if (!publication?.author) throw Error(`shouldExcludePublication invalid publication argument '${publication}'`);
|
|
@@ -128523,21 +128567,24 @@ const shouldExcludePublication = (communityChallenge, request, community) => {
|
|
|
128523
128567
|
if (!communityChallenge.exclude) return false;
|
|
128524
128568
|
if (!Array.isArray(communityChallenge.exclude)) throw Error(`shouldExcludePublication invalid communityChallenge argument '${communityChallenge}' communityChallenge.exclude not an array`);
|
|
128525
128569
|
let authorPublicationCounts;
|
|
128570
|
+
let identityMatcher;
|
|
128571
|
+
const getIdentityMatcher = () => identityMatcher ??= createAuthorIdentityMatcher({
|
|
128572
|
+
community,
|
|
128573
|
+
publication
|
|
128574
|
+
});
|
|
128526
128575
|
for (const exclude of communityChallenge.exclude) {
|
|
128527
|
-
if (typeof exclude.postScore !== "number" && typeof exclude.replyScore !== "number" && typeof exclude.postCount !== "number" && typeof exclude.replyCount !== "number" && typeof exclude.firstCommentTimestamp !== "number" && !exclude.
|
|
128576
|
+
if (typeof exclude.postScore !== "number" && typeof exclude.replyScore !== "number" && typeof exclude.postCount !== "number" && typeof exclude.replyCount !== "number" && typeof exclude.firstCommentTimestamp !== "number" && !exclude.publicKeys?.length && !exclude.names?.length && exclude.publicationType === void 0 && exclude.rateLimit === void 0 && !exclude.roles?.length) continue;
|
|
128528
128577
|
let shouldExclude = true;
|
|
128529
128578
|
if (!testScore(exclude.postScore, author.community?.postScore)) shouldExclude = false;
|
|
128530
128579
|
if (!testScore(exclude.replyScore, author.community?.replyScore)) shouldExclude = false;
|
|
128531
128580
|
if (!testFirstCommentTimestamp(exclude.firstCommentTimestamp, author.community?.firstCommentTimestamp)) shouldExclude = false;
|
|
128532
128581
|
if (!testPublicationType(exclude.publicationType, request)) shouldExclude = false;
|
|
128533
128582
|
if (!testRateLimit(exclude, request)) shouldExclude = false;
|
|
128534
|
-
if (exclude.
|
|
128535
|
-
if (
|
|
128583
|
+
if (exclude.publicKeys && !exclude.publicKeys.includes(getIdentityMatcher().signerAddress)) shouldExclude = false;
|
|
128584
|
+
if (exclude.names && !await getIdentityMatcher().matchesAnyIdentity(exclude.names)) shouldExclude = false;
|
|
128585
|
+
if (Array.isArray(exclude.roles) && !await testRole(exclude.roles, getIdentityMatcher, community?.roles)) shouldExclude = false;
|
|
128536
128586
|
if (typeof exclude.postCount === "number" || typeof exclude.replyCount === "number") {
|
|
128537
|
-
if (!authorPublicationCounts && community?._dbHandler)
|
|
128538
|
-
const signerAddress = getPKCAddressFromPublicKeySync(publication.signature.publicKey);
|
|
128539
|
-
authorPublicationCounts = community._dbHandler.queryAuthorPublicationCounts(signerAddress);
|
|
128540
|
-
}
|
|
128587
|
+
if (!authorPublicationCounts && community?._dbHandler) authorPublicationCounts = community._dbHandler.queryAuthorPublicationCounts(getIdentityMatcher().signerAddress);
|
|
128541
128588
|
if (!testScore(exclude.postCount, authorPublicationCounts?.postCount)) shouldExclude = false;
|
|
128542
128589
|
if (!testScore(exclude.replyCount, authorPublicationCounts?.replyCount)) shouldExclude = false;
|
|
128543
128590
|
}
|
|
@@ -128582,9 +128629,13 @@ const shouldExcludeChallengeCommentCids = async (communityChallenge, challengeRe
|
|
|
128582
128629
|
if (typeof pkc?.getComment !== "function") throw Error(`shouldExcludeChallengeCommentCids invalid pkc argument '${pkc}'`);
|
|
128583
128630
|
const publication = derivePublicationFromChallengeRequest(challengeRequestMessage);
|
|
128584
128631
|
const commentCids = challengeRequestMessage.challengeCommentCids;
|
|
128585
|
-
const author = publication?.author;
|
|
128586
128632
|
if (commentCids && !Array.isArray(commentCids)) throw Error(`shouldExcludeChallengeCommentCids invalid commentCids argument '${commentCids}'`);
|
|
128587
|
-
|
|
128633
|
+
let signerAddress;
|
|
128634
|
+
const getSignerAddress = () => {
|
|
128635
|
+
if (signerAddress) return signerAddress;
|
|
128636
|
+
if (typeof publication?.signature?.publicKey !== "string") throw Error(`shouldExcludeChallengeCommentCids invalid challengeRequestMessage.publication.signature.publicKey argument '${publication?.signature?.publicKey}'`);
|
|
128637
|
+
return signerAddress = getPKCAddressFromPublicKeySync(publication.signature.publicKey);
|
|
128638
|
+
};
|
|
128588
128639
|
const _getComment = async (commentCid, addressesSet) => {
|
|
128589
128640
|
let cachedComment = commentCache.get(commentCid);
|
|
128590
128641
|
let comment;
|
|
@@ -128592,12 +128643,12 @@ const shouldExcludeChallengeCommentCids = async (communityChallenge, challengeRe
|
|
|
128592
128643
|
comment = await pkc.getComment({ cid: commentCid });
|
|
128593
128644
|
cachedComment = {
|
|
128594
128645
|
communityAddress: comment.communityAddress,
|
|
128595
|
-
author: {
|
|
128646
|
+
author: { publicKey: comment.author.publicKey }
|
|
128596
128647
|
};
|
|
128597
128648
|
commentCache.set(commentCid, cachedComment);
|
|
128598
128649
|
}
|
|
128599
128650
|
if (!addressesSet.has(cachedComment.communityAddress)) throw Error(`comment doesn't have matching community address`);
|
|
128600
|
-
if (cachedComment?.author?.
|
|
128651
|
+
if (cachedComment?.author?.publicKey !== getSignerAddress()) throw Error(`comment author signer doesn't match publication signer`);
|
|
128601
128652
|
let cachedCommentUpdate = commentUpdateCache.get(commentCid);
|
|
128602
128653
|
if (!cachedCommentUpdate) {
|
|
128603
128654
|
const commentUpdate = comment || await pkc.createComment({ cid: commentCid });
|
|
@@ -128811,13 +128862,13 @@ var UrlsAddressesSet$1 = class {
|
|
|
128811
128862
|
this.communities = {};
|
|
128812
128863
|
setInterval(() => this.refetchAndUpdateAllUrlsSets(), 1e3 * 60 * 5).unref?.();
|
|
128813
128864
|
}
|
|
128814
|
-
async
|
|
128815
|
-
|
|
128865
|
+
async getAddresses(communityAddress, urlsString) {
|
|
128866
|
+
const addresses = /* @__PURE__ */ new Set();
|
|
128867
|
+
if (!communityAddress || !urlsString) return addresses;
|
|
128816
128868
|
await this.setUrls(communityAddress, urlsString);
|
|
128817
128869
|
const community = this.communities[communityAddress];
|
|
128818
|
-
const
|
|
128819
|
-
|
|
128820
|
-
return false;
|
|
128870
|
+
for (const url of community.urls) for (const address of community.urlsSets[url] || []) addresses.add(address);
|
|
128871
|
+
return addresses;
|
|
128821
128872
|
}
|
|
128822
128873
|
async setUrls(communityAddress, urlsString) {
|
|
128823
128874
|
let community = this.communities[communityAddress];
|
|
@@ -128846,12 +128897,16 @@ var UrlsAddressesSet$1 = class {
|
|
|
128846
128897
|
}
|
|
128847
128898
|
};
|
|
128848
128899
|
const urlsAddressesSet$1 = new UrlsAddressesSet$1();
|
|
128849
|
-
const getChallenge$3 = async ({ challengeSettings, challengeRequestMessage }) => {
|
|
128900
|
+
const getChallenge$3 = async ({ challengeSettings, challengeRequestMessage, community }) => {
|
|
128850
128901
|
const error = challengeSettings?.options?.error;
|
|
128851
128902
|
const addresses = challengeSettings?.options?.addresses?.split(",").map((u) => u.trim()).filter(Boolean);
|
|
128852
128903
|
const addressesSet = new Set(addresses);
|
|
128853
128904
|
const publication = derivePublicationFromChallengeRequest(challengeRequestMessage);
|
|
128854
|
-
|
|
128905
|
+
const identityMatcher = createAuthorIdentityMatcher({
|
|
128906
|
+
community,
|
|
128907
|
+
publication
|
|
128908
|
+
});
|
|
128909
|
+
if (await identityMatcher.matchesAnyIdentity(addressesSet) || await identityMatcher.matchesAnyIdentity(await urlsAddressesSet$1.getAddresses(getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls))) return {
|
|
128855
128910
|
success: false,
|
|
128856
128911
|
error: error || `You're blacklisted.`
|
|
128857
128912
|
};
|
|
@@ -128898,13 +128953,13 @@ var UrlsAddressesSet = class {
|
|
|
128898
128953
|
this.communities = {};
|
|
128899
128954
|
setInterval(() => this.refetchAndUpdateAllUrlsSets(), 1e3 * 60 * 5).unref?.();
|
|
128900
128955
|
}
|
|
128901
|
-
async
|
|
128902
|
-
|
|
128956
|
+
async getAddresses(communityAddress, urlsString) {
|
|
128957
|
+
const addresses = /* @__PURE__ */ new Set();
|
|
128958
|
+
if (!communityAddress || !urlsString) return addresses;
|
|
128903
128959
|
await this.setUrls(communityAddress, urlsString);
|
|
128904
128960
|
const community = this.communities[communityAddress];
|
|
128905
|
-
const
|
|
128906
|
-
|
|
128907
|
-
return false;
|
|
128961
|
+
for (const url of community.urls) for (const address of community.urlsSets[url] || []) addresses.add(address);
|
|
128962
|
+
return addresses;
|
|
128908
128963
|
}
|
|
128909
128964
|
async setUrls(communityAddress, urlsString) {
|
|
128910
128965
|
let community = this.communities[communityAddress];
|
|
@@ -128933,12 +128988,16 @@ var UrlsAddressesSet = class {
|
|
|
128933
128988
|
}
|
|
128934
128989
|
};
|
|
128935
128990
|
const urlsAddressesSet = new UrlsAddressesSet();
|
|
128936
|
-
const getChallenge$2 = async ({ challengeSettings, challengeRequestMessage }) => {
|
|
128991
|
+
const getChallenge$2 = async ({ challengeSettings, challengeRequestMessage, community }) => {
|
|
128937
128992
|
const error = challengeSettings?.options?.error;
|
|
128938
128993
|
const addresses = challengeSettings?.options?.addresses?.split(",").map((u) => u.trim()).filter(Boolean);
|
|
128939
128994
|
const addressesSet = new Set(addresses);
|
|
128940
128995
|
const publication = derivePublicationFromChallengeRequest(challengeRequestMessage);
|
|
128941
|
-
|
|
128996
|
+
const identityMatcher = createAuthorIdentityMatcher({
|
|
128997
|
+
community,
|
|
128998
|
+
publication
|
|
128999
|
+
});
|
|
129000
|
+
if (!(await identityMatcher.matchesAnyIdentity(addressesSet) || await identityMatcher.matchesAnyIdentity(await urlsAddressesSet.getAddresses(getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls)))) return {
|
|
128942
129001
|
success: false,
|
|
128943
129002
|
error: error || `You're not whitelisted.`
|
|
128944
129003
|
};
|
|
@@ -129370,7 +129429,7 @@ const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMes
|
|
|
129370
129429
|
community
|
|
129371
129430
|
})).challengeFile));
|
|
129372
129431
|
await Promise.all(communityChallenges.map(async (communityChallenge, i) => {
|
|
129373
|
-
if (shouldExcludePublication(communityChallenge, challengeRequestMessage, community)) {
|
|
129432
|
+
if (await shouldExcludePublication(communityChallenge, challengeRequestMessage, community)) {
|
|
129374
129433
|
decided[i] = true;
|
|
129375
129434
|
return;
|
|
129376
129435
|
}
|
|
@@ -130330,4 +130389,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
130330
130389
|
}
|
|
130331
130390
|
};
|
|
130332
130391
|
//#endregion
|
|
130333
|
-
export {
|
|
130392
|
+
export { parseRawPages as $, RpcSuccessResultSchema as $n, getPKCAddressFromPublicKeySync as $t, deriveCommentIpfsFromCommentTableRow as A, parseRpcCommentUpdateEventWithPKCErrorIfItFails as An, verifyCommentEdit as At, resolveDbPostsCidRefs as B, RpcCommunityPageParamSchema as Bn, getAuthorNameFromRuntime as Bt, encryptEd25519AesGcmPublicKeyBuffer as C, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Cn, signCommunity as Ct, calculateInlineRepliesBudget as D, parseJsonWithPKCErrorIfFails as Dn, verifyChallengeMessage as Dt, calculateExpectedSignatureSize as E, parseDecryptedChallengeWithPKCErrorIfItFails as En, verifyChallengeAnswer as Et, getThumbnailPropsOfLink as F, RpcAuthorNameParamSchema as Fn, verifyCommunity as Ft, POST_REPLIES_SORT_TYPES as G, RpcExportCommunityResultSchema as Gn, getCommunityNameFromWire$1 as Gt, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as H, RpcExportCommunityModLogsParamSchema as Hn, normalizeCreatePublicationAuthor as Ht, importSignerIntoKuboNode as I, RpcCancelExportParamSchema as In, verifyCommunityEdit as It, buildPageRuntimeFields as J, RpcPublishAnchorRecordParamSchema as Jn, decode as Jt, REPLY_REPLIES_SORT_TYPES as K, RpcFetchCidParamSchema as Kn, getCommunityPublicKeyFromWire as Kt, listCommunitiesSync as L, RpcCidParamSchema as Ln, verifyVote as Lt, deriveDbReplies as M, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Mn, verifyCommentModeration as Mt, getDefaultCommunityDbConfig as N, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Nn, verifyCommentPubsubMessage as Nt, createKuboRpcClient as O, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as On, verifyChallengeRequest as Ot, getDefaultDataPath as P, RpcAnchorPublishPreparationResultSchema as Pn, verifyCommentUpdate as Pt, iterateOverPageCidsToFindAllCids as Q, RpcSubscriptionIdResultSchema as Qn, getPKCAddressFromPublicKey as Qt, monitorCommunitiesDirectory as R, RpcCommentRepliesPageParamSchema as Rn, buildRuntimeAuthor as Rt, encryptEd25519AesGcm as S, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as Sn, signCommentUpdateForChallengeVerification as St, backupCommunityDb as T, parseDecryptedChallengeVerification as Tn, signVote as Tt, CommentClientsManager as U, RpcExportCommunityModLogsResultSchema as Un, buildRuntimeCommunityFields as Ut, setNativeFunctions as V, RpcEditCommunityParamSchema as Vn, getAuthorNameFromWire as Vt, POSTS_SORT_TYPES as W, RpcExportCommunityParamSchema as Wn, getCommunityAddressFromRecord as Wt, extractCommunityRuntimeFieldsFromParsedPages as X, RpcPublishedAnchorRecordResultSchema as Xn, getBufferedPKCAddressFromPublicKey as Xt, buildPagesRuntimeFields as Y, RpcPublishChallengeAnswersParamSchema as Yn, encode as Yt, findCommentInPageInstanceRecursively as Z, RpcResolveAuthorNameResultSchema as Zn, getIpfsKeyFromPrivateKey as Zt, SignerWithPublicKeyAddress as _, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as _n, signChallengeVerification as _t, loadChallengeFileFromCommunityChallengeSettings as a, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as an, r as ar, stripNameResolvedFromCrosspost as at, decryptEd25519AesGcm as b, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as bn, signCommentModeration as bt, TrackedInstanceRegistry as c, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as cn, n$6 as cr, InflightFetchManager as ct, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as d, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as dn, stringify as dr, PKCTypedEmitter as dt, getPublicKeyFromPrivateKey as en, RpcUnsubscribeParamSchema as er, RepliesPages as et, KeyvBetterSqlite3 as f, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as fn, STORAGE_KEYS as fr, require_lib$1 as ft, decodeRpcChallengeVerificationPubsubMsg as g, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as gn, signChallengeRequest as gt, decodeRpcChallengeRequestPubsubMsg as h, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as hn, require_undici as hr, signChallengeMessage as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as in, t$4 as ir, extractCrosspostRuntimeFields as it, deriveDbPosts as j, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as jn, verifyCommentIpfs as jt, deleteOldCommunityInWindows as k, parseRpcCommentEventWithPKCErrorIfItFails as kn, verifyChallengeVerification as kt, LRUCache as l, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as ln, t$7 as lr, pRetry as lt, decodeRpcChallengePubsubMsg as m, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as mn, nativeFunctions$1 as mr, signChallengeAnswer as mt, RpcRemoteCommunity as n, parseCidStringSchemaWithPKCErrorIfItFails as nn, effectiveMaxCrosspostDepth as nr, cloneCrosspostForRuntime as nt, pkcJsChallenges as o, parseCommentIpfsSchemaWithPKCErrorIfItFails as on, t$5 as or, PublicationClientsManager as ot, decodeRpcChallengeAnswerPubsubMsg as p, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as pn, require_lodash_merge as pr, cleanUpBeforePublishing as pt, TIMEFRAMES_TO_SECONDS as q, RpcFetchCidResultSchema as qn, normalizeCommunityInputFromCommunity as qt, getChallengeVerification as r, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as rn, t$2 as rr, collectCrosspostAuthorsToResolve as rt, createAuthorIdentityMatcher as s, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as sn, n$5 as sr, PKCClientsManager as st, RpcLocalCommunity as t, createSchemaRowParser as tn, crosspostChainDepthUpTo as tr, applyNameResolvedCacheToCrosspost as tt, RemoteCommunity as u, parseCommunityAddressWithPKCErrorIfItFails as un, t$8 as ur, pLimit as ut, createSigner as v, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as vn, signComment as vt, BackupAbortError as w, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as wn, signCommunityEdit as wt, decryptEd25519AesGcmPublicKeyBuffer as x, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xn, signCommentUpdate as xt, createAnchorIpnsRecord as y, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as yn, signCommentEdit as yt, moveCommunityDbToDeletedDirectory as z, RpcCommunityIdentifierParamSchema as zn, cleanWireAuthor as zt };
|
|
@@ -5325,6 +5325,10 @@ var messages;
|
|
|
5325
5325
|
messages["ERR_INVALID_CREATE_PKC_WS_SERVER_OPTIONS_SCHEMA"] = "Invalid create arguments for PKC WS RPC server";
|
|
5326
5326
|
messages["ERR_INVALID_CREATE_PKC_ARGS_SCHEMA"] = "User sent arguments with invalid schema in an attempt to create a PKC instance";
|
|
5327
5327
|
messages["ERR_INVALID_CREATE_COMMUNITY_WITH_RPC_ARGS_SCHEMA"] = "User provided invalid schema of arguments for pkc.createCommunity while connected to RPC";
|
|
5328
|
+
messages["ERR_CHALLENGE_EXCLUDE_ADDRESS_FIELD_REMOVED"] = "community.settings.challenges[x].exclude[y].address has been removed. Use exclude.publicKeys for key-derived author addresses (author.publicKey) and exclude.names for author domains";
|
|
5329
|
+
messages["ERR_CHALLENGE_EXCLUDE_ROLE_FIELD_RENAMED"] = "community.settings.challenges[x].exclude[y].role has been renamed to exclude.roles";
|
|
5330
|
+
messages["ERR_CHALLENGE_EXCLUDE_PUBLIC_KEYS_MUST_NOT_BE_DOMAIN"] = "community.settings.challenges[x].exclude[y].publicKeys must contain key-derived author addresses (author.publicKey), not domains. Use exclude.names for domains";
|
|
5331
|
+
messages["ERR_CHALLENGE_EXCLUDE_NAMES_MUST_BE_DOMAIN"] = "community.settings.challenges[x].exclude[y].names must contain author domains, not key-derived addresses. Use exclude.publicKeys for addresses";
|
|
5328
5332
|
messages["ERR_CAN_NOT_SET_EXCLUDE_PUBLICATION_TO_EMPTY_OBJECT"] = "The community has community.settings.challenges[x].exclude[y].publicationType is set to an empty object. You should either choose which publication to exclude or remove exclude.publicationType";
|
|
5329
5333
|
messages["ERR_COMMUNITY_HAS_NO_INTERNAL_STATE"] = "The community has no internal state. This should never happen. Please report this bug.";
|
|
5330
5334
|
messages["ERR_AUTHOR_ADDRESS_NOT_MATCHING_SIGNER"] = "comment.author.address does not match signer.address";
|
|
@@ -5495,6 +5499,7 @@ var messages;
|
|
|
5495
5499
|
messages["ERR_AUTHOR_FLAIR_NOT_IN_ALLOWED_FLAIRS"] = "Author flair must be from the allowed flairs in community.flairs['author']";
|
|
5496
5500
|
messages["ERR_COMMUNITY_COMMENT_MOD_CAN_NOT_LOCK_REPLY"] = "Can't lock replies. Only posts";
|
|
5497
5501
|
messages["ERR_COMMUNITY_COMMENT_MOD_CAN_NOT_ARCHIVE_REPLY"] = "Can't archive replies. Only posts";
|
|
5502
|
+
messages["ERR_NOT_ALLOWED_TO_ARCHIVE_POSTS"] = "community.features.noArchive is true which means posts can't be archived in this community";
|
|
5498
5503
|
messages["ERR_COMMUNITY_COMMENT_EDIT_UNAUTHORIZED_FIELD"] = "CommentEdit includes a field that cannot be used";
|
|
5499
5504
|
messages["ERR_PUBLISHING_EDIT_WITH_BOTH_MOD_AND_AUTHOR_FIELDS"] = "CommentEdit can't have both author and mod fields. Please publish a separate request for author and mod";
|
|
5500
5505
|
messages["ERR_FAILED_TO_RESOLVE_TEXT_RECORD"] = "Failed to resolve text record";
|
|
@@ -6569,6 +6574,18 @@ const VotePubsubReservedFields = r$2(n([
|
|
|
6569
6574
|
"nameResolved"
|
|
6570
6575
|
]), t$3(VotePubsubMessagePublicationSchema.shape));
|
|
6571
6576
|
//#endregion
|
|
6577
|
+
//#region dist/node/domain-util.js
|
|
6578
|
+
function isStringDomain(x) {
|
|
6579
|
+
return typeof x === "string" && x.includes(".");
|
|
6580
|
+
}
|
|
6581
|
+
function isEthAliasDomain$1(address) {
|
|
6582
|
+
const lower = address.toLowerCase();
|
|
6583
|
+
return lower.endsWith(".eth") || lower.endsWith(".bso");
|
|
6584
|
+
}
|
|
6585
|
+
function normalizeEthAliasDomain(address) {
|
|
6586
|
+
return address.endsWith(".bso") ? address.slice(0, -4) + ".eth" : address;
|
|
6587
|
+
}
|
|
6588
|
+
//#endregion
|
|
6572
6589
|
//#region dist/node/community/schema.js
|
|
6573
6590
|
const CommunityEncryptionSchema = looseObject({
|
|
6574
6591
|
type: string().min(1),
|
|
@@ -6600,6 +6617,7 @@ const CommunityFeaturesSchema = looseObject({
|
|
|
6600
6617
|
noCrossposts: boolean().optional(),
|
|
6601
6618
|
maxCrosspostDepth: number().int().nonnegative().optional(),
|
|
6602
6619
|
noNestedReplies: boolean().optional(),
|
|
6620
|
+
noArchive: boolean().optional(),
|
|
6603
6621
|
safeForWork: boolean().optional(),
|
|
6604
6622
|
authorFlairs: boolean().optional(),
|
|
6605
6623
|
requireAuthorFlairs: boolean().optional(),
|
|
@@ -6671,6 +6689,8 @@ const ChallengeExcludePublicationTypeSchema = looseObject({
|
|
|
6671
6689
|
commentModeration: excludePublicationFieldSchema,
|
|
6672
6690
|
communityEdit: excludePublicationFieldSchema
|
|
6673
6691
|
}).refine((args) => !e$2(JSON.parse(JSON.stringify(args))), messages.ERR_CAN_NOT_SET_EXCLUDE_PUBLICATION_TO_EMPTY_OBJECT);
|
|
6692
|
+
const ChallengeExcludePublicKeySchema = AuthorAddressSchema.refine((address) => !isStringDomain(address), messages.ERR_CHALLENGE_EXCLUDE_PUBLIC_KEYS_MUST_NOT_BE_DOMAIN);
|
|
6693
|
+
const ChallengeExcludeNameSchema = AuthorAddressSchema.refine((name) => isStringDomain(name), messages.ERR_CHALLENGE_EXCLUDE_NAMES_MUST_BE_DOMAIN);
|
|
6674
6694
|
const ChallengeExcludeSchema = looseObject({
|
|
6675
6695
|
community: ChallengeExcludeCommunitySchema.optional(),
|
|
6676
6696
|
postScore: number().int().optional(),
|
|
@@ -6679,18 +6699,20 @@ const ChallengeExcludeSchema = looseObject({
|
|
|
6679
6699
|
replyCount: number().nonnegative().int().optional(),
|
|
6680
6700
|
firstCommentTimestamp: PKCTimestampSchema.optional(),
|
|
6681
6701
|
challenges: number().nonnegative().int().array().optional(),
|
|
6682
|
-
|
|
6683
|
-
|
|
6702
|
+
roles: CommunityRoleSchema.shape.role.array().nonempty().optional(),
|
|
6703
|
+
publicKeys: ChallengeExcludePublicKeySchema.array().nonempty().optional(),
|
|
6704
|
+
names: ChallengeExcludeNameSchema.array().nonempty().optional(),
|
|
6684
6705
|
rateLimit: number().nonnegative().int().optional(),
|
|
6685
6706
|
rateLimitChallengeSuccess: boolean().optional(),
|
|
6686
6707
|
publicationType: ChallengeExcludePublicationTypeSchema.optional()
|
|
6687
6708
|
});
|
|
6709
|
+
const ChallengeExcludeSettingSchema = ChallengeExcludeSchema.refine((exclude) => !("address" in exclude), messages.ERR_CHALLENGE_EXCLUDE_ADDRESS_FIELD_REMOVED).refine((exclude) => !("role" in exclude), messages.ERR_CHALLENGE_EXCLUDE_ROLE_FIELD_RENAMED);
|
|
6688
6710
|
const CommunityChallengeSettingSchema = object({
|
|
6689
6711
|
path: string().optional(),
|
|
6690
6712
|
name: string().optional(),
|
|
6691
6713
|
options: record(string(), string()).optional(),
|
|
6692
6714
|
publicOptions: string().array().optional(),
|
|
6693
|
-
exclude:
|
|
6715
|
+
exclude: ChallengeExcludeSettingSchema.array().nonempty().optional(),
|
|
6694
6716
|
description: string().optional(),
|
|
6695
6717
|
pendingApproval: boolean().optional()
|
|
6696
6718
|
}).strict().refine((challengeData) => challengeData.path || challengeData.name, "Path or name of challenge has to be defined");
|
|
@@ -15235,7 +15257,7 @@ var require_sha256 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15235
15257
|
//#endregion
|
|
15236
15258
|
//#region dist/node/pkc/tracked-instance-registry-util.js
|
|
15237
15259
|
const trackedAliasHistorySymbol = Symbol("trackedAliasHistory");
|
|
15238
|
-
function isEthAliasDomain
|
|
15260
|
+
function isEthAliasDomain(address) {
|
|
15239
15261
|
const lower = address.toLowerCase();
|
|
15240
15262
|
return lower.endsWith(".eth") || lower.endsWith(".bso");
|
|
15241
15263
|
}
|
|
@@ -15282,7 +15304,7 @@ function getCommunityRegistryAliases(community, dataPath) {
|
|
|
15282
15304
|
]);
|
|
15283
15305
|
if (aliases.length === 0) throw new PKCError("ERR_COMMUNITY_REGISTRY_LOOKUP_HAS_NO_ALIASES", { community });
|
|
15284
15306
|
return scopeAliasesToDataPath(dedupeAliases(aliases.flatMap((alias) => {
|
|
15285
|
-
if (isEthAliasDomain
|
|
15307
|
+
if (isEthAliasDomain(alias)) return getEquivalentCommunityAliases(alias);
|
|
15286
15308
|
return [alias];
|
|
15287
15309
|
})), dataPath);
|
|
15288
15310
|
}
|
|
@@ -15568,21 +15590,11 @@ async function genToArray(gen) {
|
|
|
15568
15590
|
for await (const x of gen) out.push(x);
|
|
15569
15591
|
return out;
|
|
15570
15592
|
}
|
|
15571
|
-
function isStringDomain(x) {
|
|
15572
|
-
return typeof x === "string" && x.includes(".");
|
|
15573
|
-
}
|
|
15574
|
-
function isEthAliasDomain(address) {
|
|
15575
|
-
const lower = address.toLowerCase();
|
|
15576
|
-
return lower.endsWith(".eth") || lower.endsWith(".bso");
|
|
15577
|
-
}
|
|
15578
|
-
function normalizeEthAliasDomain(address) {
|
|
15579
|
-
return address.endsWith(".bso") ? address.slice(0, -4) + ".eth" : address;
|
|
15580
|
-
}
|
|
15581
15593
|
function areEquivalentCommunityAddresses(addressA, addressB) {
|
|
15582
15594
|
if (addressA === addressB) return true;
|
|
15583
15595
|
const lowerA = addressA.toLowerCase();
|
|
15584
15596
|
const lowerB = addressB.toLowerCase();
|
|
15585
|
-
if (!isEthAliasDomain(lowerA) || !isEthAliasDomain(lowerB)) return false;
|
|
15597
|
+
if (!isEthAliasDomain$1(lowerA) || !isEthAliasDomain$1(lowerB)) return false;
|
|
15586
15598
|
return normalizeEthAliasDomain(lowerA) === normalizeEthAliasDomain(lowerB);
|
|
15587
15599
|
}
|
|
15588
15600
|
function getEquivalentCommunityAddresses(address) {
|
|
@@ -16225,14 +16237,14 @@ function extractNetworkErrorDetails(err, depth = 0) {
|
|
|
16225
16237
|
}
|
|
16226
16238
|
//#endregion
|
|
16227
16239
|
//#region dist/node/generated-version.js
|
|
16228
|
-
const version = "0.0.
|
|
16240
|
+
const version = "0.0.102";
|
|
16229
16241
|
//#endregion
|
|
16230
16242
|
//#region dist/node/version.js
|
|
16231
16243
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
16232
16244
|
const pkcJsVersion = version;
|
|
16233
16245
|
var version_default = {
|
|
16234
16246
|
PKC_JS_VERSION: pkcJsVersion,
|
|
16235
|
-
DB_VERSION:
|
|
16247
|
+
DB_VERSION: 42,
|
|
16236
16248
|
PROTOCOL_VERSION: protocolVersion,
|
|
16237
16249
|
USER_AGENT: UserAgentSchema.parse(`/pkc-js:${pkcJsVersion}/`)
|
|
16238
16250
|
};
|
|
@@ -16379,4 +16391,4 @@ const DecryptedChallengeVerificationSchema = object({
|
|
|
16379
16391
|
}).strict();
|
|
16380
16392
|
const ChallengeVerificationMessageSignedPropertyNames = t$3(n$3(ChallengeVerificationMessageSchema.shape, ["signature"]));
|
|
16381
16393
|
//#endregion
|
|
16382
|
-
export { isRequestPubsubPublicationOfReply as $, CommunityAuthorChallengeReservedFieldNames as $n,
|
|
16394
|
+
export { isRequestPubsubPublicationOfReply as $, CommunityAuthorChallengeReservedFieldNames as $n, ChallengeFileFactorySchema as $t, doesDomainAddressHaveCapitalLetter as A, CommentUpdateReservedFields as An, boolean as Ar, refreshTrackedCommentAliases as At, ipnsNameToIpnsOverPubsubTopic as B, CommentEditPubsubMessagePublicationSchema as Bn, stringifyPrimitive as Br, TimeoutError as Bt, calculateStringSizeSameAsIpfsAddCidV0 as C, CommentIpfsSchema as Cn, messages as Cr, findCommunityInRegistry as Ct, createAbortError as D, CommentUpdateChallengeReservedFieldNames as Dn, setErrorMap as Dr, listStartedCommunities as Dt, contentContainsMarkdownVideos as E, CommentSignedPropertyNames as En, require_ms as Er, findUpdatingCommunity as Et, getErrorCodeFromMessage as F, CreateCommentOptionsWithRefinementSchema as Fn, record as Fr, trackUpdatingCommunity as Ft, isIpnsPath as G, CreateCommentEditOptionsWithRefinementSchema as Gn, CommunityEditPubsubMessagePublicationSchema as Gt, isIpfsCid as H, CommentEditReservedFields as Hn, CommunityEditPublicationChallengeRequestToEncryptSchema as Ht, getIpnsRecordInLocalKuboNode as I, GetPageParamSchema as In, string as Ir, untrackStartedCommunity as It, isLinkOfImage as J, AuthorReservedFields as Jn, CommentModerationPubsubMessagePublicationSchema as Jt, isLinkOfAnimatedImage as K, AuthorAddressSchema as Kn, CreateCommunityEditPublicationOptionsWithRefinementSchema as Kt, getPostUpdateTimestampRange as L, ModQueuePageIpfsSchema as Ln, ZodError as Lr, untrackUpdatingComment as Lt, fetchAndValidateIpnsRecordFromGateway as M, CommentUpdateSignedPropertyNames as Mn, literal as Mr, syncCommunityRegistryEntry as Mt, genToArray as N, CommentUpdateTableRowSchema as Nn, number as Nr, trackStartedCommunity as Nt, deepMergeRuntimeFields as O, CommentUpdateForChallengeVerificationSchema as On, _enum as Or, listUpdatingComments as Ot, getEquivalentCommunityAddresses as P, CommentsTableRowSchema as Pn, object as Pr, trackUpdatingComment as Pt, isRequestPubsubPublicationOfPost as Q, CommunityAddressSchema as Qn, CreateCommentModerationOptionsWithRefinementSchema as Qt, hideClassPrivateProps as R, PageIpfsSchema as Rn, joinValues as Rr, untrackUpdatingCommunity as Rt, calculateIpfsCidV0 as S, CommentIpfsReservedFields as Sn, PKCError as Sr, writeKuboFilesWithTimeout as St, contentContainsMarkdownImages as T, CommentPubsubMessageWithFlexibleAuthorRefinementSchema as Tn, require_supports_color as Tr, findUpdatingComment as Tt, isIpfsPath as U, CommentEditSignedPropertyNames as Un, CommunityEditPublicationPubsubReservedFields as Ut, isAbortError as V, CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema as Vn, pTimeout as Vt, isIpns as W, CommentEditsTableRowSchema as Wn, CommunityEditPublicationSignedPropertyNames as Wt, isLinkOfVideo as X, CidPathSchema as Xn, CommentModerationSignedPropertyNames as Xt, isLinkOfMedia as Y, ChallengeAnswersSchema as Yn, CommentModerationReservedFields as Yt, isLinkValid as Z, CidStringSchema as Zn, CommentModerationsTableRowSchema as Zt, PKCUserOptionBaseSchema as _, VotePubsubMessagePublicationSchema as _n, FailedToFetchCommentIpfsFromGatewaysError as _r, sleepUntilTimeoutOrAbort as _t, ChallengeRequestMessageSchema as a, CommunityIpfsReservedFields as an, t$3 as ar, removeBlocksFromKuboNode as at, areEquivalentCommunityAddresses as b, VoteTablesRowSchema as bn, FailedToFetchGenericIpfsFromGatewaysError as br, timestamp as bt, ChallengeVerificationMessageSignedPropertyNames as c, CreateNewLocalCommunityUserOptionsSchema as cn, t$4 as cr, removeNullUndefinedValues as ct, DecryptedChallengeRequestSchema as d, ExportCommunityModLogsOptionsSchema as dn, n$7 as dr, resolveWhenPredicateIsTrue as dt, ChallengeFileSchema as en, CreateSignerSchema as er, pubsubTopicToDhtKey as et, DecryptedChallengeSchema as f, PubsubTopicSchema as fn, r$4 as fr, retryKuboBlockPutPinAndProvidePubsubTopic as ft, PKCParsedOptionsSchema as g, VoteChallengeRequestToEncryptSchema as gn, require_retry as gr, shortifyCid as gt, NameResolverSerializedSchema as h, CreateVoteUserOptionsWithRefinementSchema as hn, e$4 as hr, shortifyAddress as ht, ChallengeMessageSignedPropertyNames as i, CommunityExportRecordsSchema as in, t$2 as ir, rejectWhenCommunityStopsOrAborts as it, extractNetworkErrorDetails as j, CommentUpdateSchema as jn, custom as jr, refreshTrackedCommunityAliases as jt, derivePublicationFromChallengeRequest as k, CommentUpdateForChallengeVerificationSignedPropertyNames as kn, array as kr, listUpdatingCommunities as kt, DecryptedChallengeAnswerSchema as l, CreateRemoteCommunityFunctionArgumentSchema as ln, r$2 as lr, removeUndefinedValuesRecursively as lt, NameResolveCacheOptionsSchema as m, isStringDomain as mn, t$8 as mr, retryKuboIpfsAddAndProvide as mt, ChallengeAnswerMessageSignedPropertyNames as n, CommunityChallengeSettingSchema as nn, t$1 as nr, raceAgainstAbort as nt, ChallengeRequestMessageSignedPropertyNames as o, CommunityIpfsSchema as on, e as or, removeMfsFilesSafely as ot, DecryptedChallengeVerificationSchema as p, RpcRemoteCommunityUpdateEventResultSchema as pn, t$7 as pr, retryKuboIpfsAdd as pt, isLinkOfAudio as q, AuthorCommentIpfsReservedFields as qn, CommentModerationChallengeRequestToEncryptSchema as qt, ChallengeMessageSchema as r, CommunityEditOptionsSchema as rn, n$3 as rr, rejectWhenAbortSignalFires as rt, ChallengeVerificationMessageSchema as s, CommunitySignedPropertyNames as sn, e$2 as sr, removeNullUndefinedEmptyObjectsValuesRecursively as st, ChallengeAnswerMessageSchema as t, CommunityAnchorSchema as tn, n as tr, pubsubTopicToDhtKeyCid as tt, DecryptedChallengeRequestPublicationSchema as u, CreateRpcCommunityFunctionArgumentSchema as un, t$5 as ur, replaceXWithY as ut, PKCUserOptionsSchema as v, VotePubsubReservedFields as vn, FailedToFetchCommentUpdateFromGatewaysError as vr, statMfsPathSafely as vt, contentContainsMarkdownAudio as w, CommentPubsubMessageReservedFields as wn, logger_default as wr, findStartedCommunity as wt, binaryKeyToPubsubTopic as x, CommentChallengeRequestToEncryptSchema as xn, FailedToFetchPageIpfsFromGatewaysError as xr, waitForUpdateInCommunityInstanceWithErrorAndTimeout as xt, version_default as y, VoteSignedPropertyNames as yn, FailedToFetchCommunityFromGatewaysError as yr, throwIfAbortSignalAborted as yt, interruptibleSleep as z, CommentEditChallengeRequestToEncryptSchema as zn, parsedType as zr, require_sha256 as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Sr as PKCError,
|
|
1
|
+
import { Sr as PKCError, tt as pubsubTopicToDhtKeyCid } from "./schema-gif6qroG.js";
|
|
2
2
|
import { ipnsSelector } from "ipns/selector";
|
|
3
3
|
import { ipnsValidator } from "ipns/validator";
|
|
4
4
|
import { unmarshalIPNSRecord } from "ipns";
|
package/dist/bundled/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-
|
|
1
|
+
import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-DaN6R9HB.js";
|
|
2
2
|
export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-
|
|
3
|
-
import {
|
|
4
|
-
import { t as LocalCommunity } from "../../chunks/local-community-
|
|
1
|
+
import { R as hideClassPrivateProps, Sr as PKCError, Vt as pTimeout, ar as t, rr as n, ut as replaceXWithY, wr as logger_default, wt as findStartedCommunity } from "../../chunks/schema-gif6qroG.js";
|
|
2
|
+
import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-DaN6R9HB.js";
|
|
3
|
+
import { J as buildPageRuntimeFields, Mn as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Y as buildPagesRuntimeFields, bn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, dn as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, dr as stringify, fn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ft as require_lib, in as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ir as t$1, it as extractCrosspostRuntimeFields, jn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, lt as pRetry, rn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, sn as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ut as pLimit, wn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-aV790d8_.js";
|
|
4
|
+
import { t as LocalCommunity } from "../../chunks/local-community-L-1IkV1x.js";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import assert from "assert";
|
|
@@ -64,6 +64,7 @@ export declare const parseRpcEditCommunityParam: (params: unknown) => {
|
|
|
64
64
|
noCrossposts?: boolean | undefined;
|
|
65
65
|
maxCrosspostDepth?: number | undefined;
|
|
66
66
|
noNestedReplies?: boolean | undefined;
|
|
67
|
+
noArchive?: boolean | undefined;
|
|
67
68
|
safeForWork?: boolean | undefined;
|
|
68
69
|
authorFlairs?: boolean | undefined;
|
|
69
70
|
requireAuthorFlairs?: boolean | undefined;
|
|
@@ -121,8 +122,9 @@ export declare const parseRpcEditCommunityParam: (params: unknown) => {
|
|
|
121
122
|
replyCount?: number | undefined;
|
|
122
123
|
firstCommentTimestamp?: number | undefined;
|
|
123
124
|
challenges?: number[] | undefined;
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
roles?: string[] | undefined;
|
|
126
|
+
publicKeys?: string[] | undefined;
|
|
127
|
+
names?: string[] | undefined;
|
|
126
128
|
rateLimit?: number | undefined;
|
|
127
129
|
rateLimitChallengeSuccess?: boolean | undefined;
|
|
128
130
|
publicationType?: {
|
|
@@ -333,6 +333,7 @@ export declare const RpcEditCommunityParamSchema: z.ZodObject<{
|
|
|
333
333
|
noCrossposts: z.ZodOptional<z.ZodBoolean>;
|
|
334
334
|
maxCrosspostDepth: z.ZodOptional<z.ZodNumber>;
|
|
335
335
|
noNestedReplies: z.ZodOptional<z.ZodBoolean>;
|
|
336
|
+
noArchive: z.ZodOptional<z.ZodBoolean>;
|
|
336
337
|
safeForWork: z.ZodOptional<z.ZodBoolean>;
|
|
337
338
|
authorFlairs: z.ZodOptional<z.ZodBoolean>;
|
|
338
339
|
requireAuthorFlairs: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -392,12 +393,13 @@ export declare const RpcEditCommunityParamSchema: z.ZodObject<{
|
|
|
392
393
|
replyCount: z.ZodOptional<z.ZodNumber>;
|
|
393
394
|
firstCommentTimestamp: z.ZodOptional<z.ZodNumber>;
|
|
394
395
|
challenges: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
395
|
-
|
|
396
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<{
|
|
396
397
|
owner: "owner";
|
|
397
398
|
admin: "admin";
|
|
398
399
|
moderator: "moderator";
|
|
399
400
|
}>, z.ZodString]>>>;
|
|
400
|
-
|
|
401
|
+
publicKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
402
|
+
names: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
401
403
|
rateLimit: z.ZodOptional<z.ZodNumber>;
|
|
402
404
|
rateLimitChallengeSuccess: z.ZodOptional<z.ZodBoolean>;
|
|
403
405
|
publicationType: z.ZodOptional<z.ZodObject<{
|