@pkcprotocol/pkc-js 0.0.135 → 0.0.137

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.
Files changed (29) hide show
  1. package/dist/browser/generated-version.d.ts +1 -1
  2. package/dist/browser/generated-version.js +1 -1
  3. package/dist/browser/rpc/src/index.js +10 -3
  4. package/dist/browser/rpc/src/index.js.map +1 -1
  5. package/dist/browser/rpc/src/utils.d.ts +1 -0
  6. package/dist/browser/rpc/src/utils.js +26 -0
  7. package/dist/browser/rpc/src/utils.js.map +1 -1
  8. package/dist/bundled/bundle-manifest.json +52 -52
  9. package/dist/bundled/challenges.js +1 -1
  10. package/dist/bundled/chunks/{helia-for-pkc-DldRnBHX.js → helia-for-pkc-DrE9AZtp.js} +33 -33
  11. package/dist/bundled/chunks/{local-community-BjljrKks.js → local-community-BhrCFCCl.js} +32 -32
  12. package/dist/bundled/chunks/{local-community-9i6vs_-P.js → local-community-D4m4-sUw.js} +1 -1
  13. package/dist/bundled/chunks/{node-BNoBGxyk.js → node-CULFO_M2.js} +5 -5
  14. package/dist/bundled/chunks/{page-sort-scoring-BCqpbgnJ.js → page-sort-scoring-CMIhwYqH.js} +1 -1
  15. package/dist/bundled/chunks/{rpc-local-community-CuL4H_vR.js → rpc-local-community-vvW_Lvzi.js} +2 -2
  16. package/dist/bundled/chunks/{util-TZLcBbZd.js → util-B4ZXn1pD.js} +1 -1
  17. package/dist/bundled/chunks/{util-D104b59J.js → util-RG3tBF0u.js} +1 -1
  18. package/dist/bundled/chunks/{validate-package-factories-DGlKaHzi.js → validate-package-factories-C3PC9lVi.js} +2 -2
  19. package/dist/bundled/index.js +1 -1
  20. package/dist/bundled/page-sorts.js +1 -1
  21. package/dist/bundled/rpc/src/index.js +26 -5
  22. package/dist/node/generated-version.d.ts +1 -1
  23. package/dist/node/generated-version.js +1 -1
  24. package/dist/node/rpc/src/index.js +10 -3
  25. package/dist/node/rpc/src/index.js.map +1 -1
  26. package/dist/node/rpc/src/utils.d.ts +1 -0
  27. package/dist/node/rpc/src/utils.js +26 -0
  28. package/dist/node/rpc/src/utils.js.map +1 -1
  29. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import { i as __toESM } from "./chunk-2rV9d50f.js";
2
- import { $ as retryKuboIpfsAddAndProvide, $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, W as removeBlocksFromKuboNode, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-TZLcBbZd.js";
3
- import { $ as createSchemaRowParser, An as verifyChallengeAnswer, Bn as verifyCommunityEdit, Br as t$8, Cr as getThumbnailPropsOfLink, Dr as moveCommunityDbToDeletedDirectory, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Fr as isCommunityStartLocked, Gr as stringify, Hn as verifyVote, Hr as n$4, In as verifyCommentModeration, Ir as require_src, Kn as getAuthorNameFromWire, Ln as verifyCommentPubsubMessage, Lr as t$10, Mn as verifyChallengeRequest, Mr as findCommunitiesEntry, N as MAX_PAGE_SIZE_BYTES, Or as refreshCommunitiesList, Pn as verifyCommentEdit, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Rn as verifyCommentUpdate, Rr as t$11, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Tn as signCommentUpdateForChallengeVerification, Un as buildRuntimeAuthor, Vr as n$5, W as pLimit, Wn as cleanWireAuthor, Wr as t$9, X as coerceSchemaRowBoolean, Xr as STORAGE_KEYS, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, Zr as require_lodash_merge, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, kr as resolveDbPostsCidRefs, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as importSignerIntoKuboNode, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as getDefaultCommunityDbConfig, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as r$2 } from "./rpc-local-community-CuL4H_vR.js";
4
- import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-BCqpbgnJ.js";
2
+ import { $ as retryKuboIpfsAddAndProvide, $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, W as removeBlocksFromKuboNode, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-B4ZXn1pD.js";
3
+ import { $ as createSchemaRowParser, An as verifyChallengeAnswer, Bn as verifyCommunityEdit, Br as t$8, Cr as getThumbnailPropsOfLink, Dr as moveCommunityDbToDeletedDirectory, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Fr as isCommunityStartLocked, Gr as stringify, Hn as verifyVote, Hr as n$4, In as verifyCommentModeration, Ir as require_src, Kn as getAuthorNameFromWire, Ln as verifyCommentPubsubMessage, Lr as t$10, Mn as verifyChallengeRequest, Mr as findCommunitiesEntry, N as MAX_PAGE_SIZE_BYTES, Or as refreshCommunitiesList, Pn as verifyCommentEdit, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Rn as verifyCommentUpdate, Rr as t$11, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Tn as signCommentUpdateForChallengeVerification, Un as buildRuntimeAuthor, Vr as n$5, W as pLimit, Wn as cleanWireAuthor, Wr as t$9, X as coerceSchemaRowBoolean, Xr as STORAGE_KEYS, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, Zr as require_lodash_merge, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, kr as resolveDbPostsCidRefs, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as importSignerIntoKuboNode, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as getDefaultCommunityDbConfig, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as r$2 } from "./rpc-local-community-vvW_Lvzi.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-CMIhwYqH.js";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
- import Path from "node:path";
6
+ import path from "node:path";
7
7
  import os from "os";
8
8
  import fs, { existsSync, promises } from "node:fs";
9
- import path from "path";
9
+ import path$1 from "path";
10
10
  import assert from "assert";
11
11
  import { Buffer as Buffer$1 } from "buffer";
12
12
  import fs$1 from "fs";
@@ -315,15 +315,15 @@ async function throwIfChallengeSettingsAreInvalid({ challengeSettings, pkc, comm
315
315
  const processStartedCommunities = new TrackedInstanceRegistry();
316
316
  function normalizeRegistryDataPath(dataPath) {
317
317
  if (dataPath === void 0) return void 0;
318
- const resolved = path.resolve(dataPath);
318
+ const resolved = path$1.resolve(dataPath);
319
319
  let existing = resolved;
320
320
  let tail = "";
321
321
  while (true) try {
322
- return path.join(fs$1.realpathSync.native(existing), tail);
322
+ return path$1.join(fs$1.realpathSync.native(existing), tail);
323
323
  } catch {
324
- const parent = path.dirname(existing);
324
+ const parent = path$1.dirname(existing);
325
325
  if (parent === existing) return resolved;
326
- tail = path.join(path.basename(existing), tail);
326
+ tail = path$1.join(path$1.basename(existing), tail);
327
327
  existing = parent;
328
328
  }
329
329
  }
@@ -1707,9 +1707,9 @@ var DbHandler = class {
1707
1707
  if (needToMigrate) {
1708
1708
  if (dbExistsAlready && currentDbVersion > 0) {
1709
1709
  this.destoryConnection();
1710
- backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
1711
- log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
1712
- if (!fs$1.existsSync(path.dirname(backupDbPath))) await fs$1.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
1710
+ backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
1711
+ log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
1712
+ if (!fs$1.existsSync(path$1.dirname(backupDbPath))) await fs$1.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
1713
1713
  const sourceDb = new Database(dbPath, { fileMustExist: true });
1714
1714
  await sourceDb.backup(backupDbPath);
1715
1715
  sourceDb.close();
@@ -3760,10 +3760,10 @@ var DbHandler = class {
3760
3760
  if (this._db || this._keyv) await this.destoryConnection();
3761
3761
  this._transactionDepth = 0;
3762
3762
  const dataPath = this._community._pkc.dataPath;
3763
- const oldPathString = path.join(dataPath, "communities", oldDbName);
3764
- const newPathString = path.join(dataPath, "communities", newDbName);
3765
- await fs$1.promises.mkdir(path.dirname(oldPathString), { recursive: true });
3766
- await fs$1.promises.mkdir(path.dirname(newPathString), { recursive: true });
3763
+ const oldPathString = path$1.join(dataPath, "communities", oldDbName);
3764
+ const newPathString = path$1.join(dataPath, "communities", newDbName);
3765
+ await fs$1.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
3766
+ await fs$1.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
3767
3767
  try {
3768
3768
  if (!fs$1.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
3769
3769
  else {
@@ -3785,8 +3785,8 @@ var DbHandler = class {
3785
3785
  }
3786
3786
  async lockCommunityStart(communityAddress = this._community.address) {
3787
3787
  const log = logger_default("pkc-js:local-community:db-handler:lock:start");
3788
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
3789
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
3788
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
3789
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
3790
3790
  try {
3791
3791
  await import_src.default.lock(communityDbPath, {
3792
3792
  lockfilePath,
@@ -3807,8 +3807,8 @@ var DbHandler = class {
3807
3807
  async unlockCommunityStart(communityAddress = this._community.address) {
3808
3808
  const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
3809
3809
  log.trace(`Attempting to unlock the start of community (${communityAddress})`);
3810
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
3811
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
3810
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
3811
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
3812
3812
  if (!fs$1.existsSync(lockfilePath) || !fs$1.existsSync(communityDbPath)) return;
3813
3813
  try {
3814
3814
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -3826,8 +3826,8 @@ var DbHandler = class {
3826
3826
  }
3827
3827
  async lockCommunityState() {
3828
3828
  const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
3829
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
3830
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
3829
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
3830
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
3831
3831
  try {
3832
3832
  await import_src.default.lock(communityDbPath, {
3833
3833
  lockfilePath,
@@ -3844,8 +3844,8 @@ var DbHandler = class {
3844
3844
  }
3845
3845
  async unlockCommunityState() {
3846
3846
  const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
3847
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
3848
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
3847
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
3848
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
3849
3849
  if (!fs$1.existsSync(lockfilePath)) return;
3850
3850
  try {
3851
3851
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -3855,7 +3855,7 @@ var DbHandler = class {
3855
3855
  }
3856
3856
  }
3857
3857
  communityDbExists() {
3858
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
3858
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
3859
3859
  return fs$1.existsSync(communityDbPath);
3860
3860
  }
3861
3861
  markCommentsAsPublishedToPostUpdates(commentCids) {
@@ -6868,10 +6868,10 @@ async function restoreCommunityAfterFailedRename({ community, oldAddress, newAdd
6868
6868
  }
6869
6869
  }
6870
6870
  async function removePartialDbCopy({ community, oldAddress, newAddress, log }) {
6871
- const communitiesPath = Path.join(community._pkc.dataPath, "communities");
6872
- if (!fs.existsSync(Path.join(communitiesPath, oldAddress))) return;
6871
+ const communitiesPath = path.join(community._pkc.dataPath, "communities");
6872
+ if (!fs.existsSync(path.join(communitiesPath, oldAddress))) return;
6873
6873
  try {
6874
- await fs.promises.rm(Path.join(communitiesPath, newAddress), { force: true });
6874
+ await fs.promises.rm(path.join(communitiesPath, newAddress), { force: true });
6875
6875
  } catch (e) {
6876
6876
  log.error(`Failed to remove the partial DB copy of community (${oldAddress}) at ${newAddress}`, e);
6877
6877
  }
@@ -7015,11 +7015,11 @@ async function edit(community, newCommunityOptions) {
7015
7015
  const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
7016
7016
  function defaultExportPathFor(community, exportId) {
7017
7017
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
7018
- return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
7018
+ return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
7019
7019
  }
7020
7020
  function sourceDbPathFor(community) {
7021
7021
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
7022
- return Path.join(community._pkc.dataPath, "communities", community.address);
7022
+ return path.join(community._pkc.dataPath, "communities", community.address);
7023
7023
  }
7024
7024
  async function persistExports(community) {
7025
7025
  if (!community._dbHandler) return;
@@ -7095,9 +7095,9 @@ async function runExportTask(community, exportId, opts) {
7095
7095
  async function exportCommunityEmbedded(community, options = {}) {
7096
7096
  if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
7097
7097
  const exportId = v4();
7098
- const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
7098
+ const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
7099
7099
  const includePrivateKey = options.includePrivateKey === true;
7100
- if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
7100
+ if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
7101
7101
  communityAddress: community.address,
7102
7102
  exportPath: destPath
7103
7103
  });
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-BjljrKks.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-BhrCFCCl.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as retryKuboIpfsAddAndProvide, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, H as rejectWhenAbortSignalFires, Hr as setErrorMap, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, J as removeUndefinedValuesRecursively, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Q as retryKuboIpfsAdd, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenCommunityStopsOrAborts, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, hr as isStringDomain, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$1, k as isIpns, kt as pTimeout, ni as en_default, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, tt as shortifyCid, u as createAbortError, vr as n$1, vt as refreshTrackedCommentAliases, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, zn as CommentUpdateSchema, zr as logger_default } from "./util-TZLcBbZd.js";
3
- import { $n as buildRuntimeCommunityFields, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, Ar as setNativeFunctions$1, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Br as t$3, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dt as parseJsonWithPKCErrorIfFails, Er as monitorCommunitiesDirectory, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as NAME_RESOLVED_TRUE_TTL_MS, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lr as t$5, Lt as RpcCidParamSchema, M as parseRawPages, Mr as findCommunitiesEntry, Nn as verifyChallengeVerification, Nr as toCommunitiesEntry, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pt as RpcAnchorPublishPreparationResultSchema, Qr as nativeFunctions$2, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, Sr as getDefaultDataPath, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tr as listCommunitiesSync, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as t$2, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vr as n$3, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wr as t$4, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Yt as RpcFetchCommunityListParamSchema, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, en as RpcPublishCommunityListResultSchema, er as getCommunityAddressFromRecord, et as parseCidStringSchemaWithPKCErrorIfItFails, ft as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, gn as cleanUpBeforePublishing, gt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, hr as createKuboRpcClient, ht as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, in as RpcSuccessResultSchema, ir as decode, it as parseCommentIpfsSchemaWithPKCErrorIfItFails, jn as verifyChallengeMessage, jr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kn as signVote, kt as parseRpcCommentEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as createSigner, lr as getPKCAddressFromPublicKeySync, lt as parseCommunityAddressWithPKCErrorIfItFails, m as pkcJsChallenges, mt as parseCommunityListSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcResolveAuthorNameResultSchema, nr as getCommunityPublicKeyFromWire, on as findCommunityRecordNameMismatch, or as getBufferedPKCAddressFromPublicKey, ot as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, pn as encryptEd25519AesGcm, q as decodeRpcChallengePubsubMsg, qn as normalizeCreatePublicationAuthor, qr as NAME_RESOLVED_FALSE_TTL_MS, qt as RpcFetchCidParamSchema, rn as RpcSubscriptionIdResultSchema, rr as normalizeCommunityInputFromCommunity, rt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, sn as require_lib$1, st as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcPublishedAnchorRecordResultSchema, tr as getCommunityNameFromWire, un as createAnchorIpnsRecord$1, v as TrackedInstanceRegistry, vt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, x as RemoteCommunity, xn as signComment, xt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signChallengeRequest, z as PKCClientsManager, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-CuL4H_vR.js";
4
- import { s as getHeliaDebugContext } from "./util-D104b59J.js";
2
+ import { $ as retryKuboIpfsAddAndProvide, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, H as rejectWhenAbortSignalFires, Hr as setErrorMap, In as CommentUpdateForChallengeVerificationSchema, It as ChallengeVerificationMessageSchema, J as removeUndefinedValuesRecursively, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Q as retryKuboIpfsAdd, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenCommunityStopsOrAborts, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, hr as isStringDomain, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$1, k as isIpns, kt as pTimeout, ni as en_default, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, tt as shortifyCid, u as createAbortError, vr as n$1, vt as refreshTrackedCommentAliases, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, zn as CommentUpdateSchema, zr as logger_default } from "./util-B4ZXn1pD.js";
3
+ import { $n as buildRuntimeCommunityFields, $t as RpcPublishCommunityListParamSchema, A as findCommentInParsedPages, Ar as setNativeFunctions$1, At as parseRpcCommentUpdateEventWithPKCErrorIfItFails, B as GenericStateClient, Bn as verifyCommunityEdit, Br as t$3, Bt as RpcCommunityIdentifierParamSchema, C as RepliesPages, Cn as signCommentModeration, Ct as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signCommunityEdit, Dt as parseJsonWithPKCErrorIfFails, Er as monitorCommunitiesDirectory, Et as parseDecryptedChallengeWithPKCErrorIfItFails, F as cloneCrosspostForRuntime, Fn as verifyCommentIpfs, Ft as RpcAuthorNameParamSchema, G as PKCTypedEmitter, Gn as getAuthorNameFromRuntime, Gt as RpcExportCommunityParamSchema, H as InflightResourceTypes, Hn as verifyVote, Ht as RpcEditCommunityParamSchema, I as collectCrosspostAuthorsToResolve, In as verifyCommentModeration, It as RpcCancelExportParamSchema, J as decodeRpcChallengeRequestPubsubMsg, Jn as CreateCommunityListWithCidOptionsSchema, Jr as NAME_RESOLVED_TRUE_TTL_MS, Jt as RpcFetchCidResultSchema, K as decodeRpcChallengeAnswerPubsubMsg, Kn as getAuthorNameFromWire, Kr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Kt as RpcExportCommunityResultSchema, Ln as verifyCommentPubsubMessage, Lr as t$5, Lt as RpcCidParamSchema, M as parseRawPages, Mr as findCommunitiesEntry, Nn as verifyChallengeVerification, Nr as toCommunitiesEntry, Nt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, O as findCommentInPageInstance, On as signCommunityList, Ot as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, P as applyNameResolvedCacheToCrosspost, Pn as verifyCommentEdit, Pt as RpcAnchorPublishPreparationResultSchema, Qr as nativeFunctions$2, Qt as RpcPublishChallengeAnswersParamSchema, R as stripNameResolvedFromCrosspost, Rn as verifyCommentUpdate, Rt as RpcCommentRepliesPageParamSchema, Sn as signCommentEdit, Sr as getDefaultDataPath, St as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, Tr as listCommunitiesSync, Tt as parseDecryptedChallengeVerification, Un as buildRuntimeAuthor, Ur as t$2, Ut as RpcExportCommunityModLogsParamSchema, V as InflightFetchManager, Vn as verifyCommunityList, Vr as n$3, Vt as RpcCommunityPageParamSchema, Wn as cleanWireAuthor, Wr as t$4, Wt as RpcExportCommunityModLogsResultSchema, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, Xt as RpcFetchCommunityListResultSchema, Y as decodeRpcChallengeVerificationPubsubMsg, Yn as CreateNewCommunityListOptionsSchema, Yr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Yt as RpcFetchCommunityListParamSchema, Zt as RpcPublishAnchorRecordParamSchema, _n as signChallengeAnswer, _t as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, an as RpcUnsubscribeParamSchema, b as KeyvBetterSqlite3, br as findLocalCommunityAddress, ct as parseCommentUpdateSchemaWithPKCErrorIfItFails, dn as decryptEd25519AesGcm, en as RpcPublishCommunityListResultSchema, er as getCommunityAddressFromRecord, et as parseCidStringSchemaWithPKCErrorIfItFails, ft as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, gn as cleanUpBeforePublishing, gt as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, hr as createKuboRpcClient, ht as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, in as RpcSuccessResultSchema, ir as decode, it as parseCommentIpfsSchemaWithPKCErrorIfItFails, jn as verifyChallengeMessage, jr as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, k as findCommentInPageInstanceRecursively, kn as signVote, kt as parseRpcCommentEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as createSigner, lr as getPKCAddressFromPublicKeySync, lt as parseCommunityAddressWithPKCErrorIfItFails, m as pkcJsChallenges, mt as parseCommunityListSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcResolveAuthorNameResultSchema, nr as getCommunityPublicKeyFromWire, on as findCommunityRecordNameMismatch, or as getBufferedPKCAddressFromPublicKey, ot as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, pn as encryptEd25519AesGcm, q as decodeRpcChallengePubsubMsg, qn as normalizeCreatePublicationAuthor, qr as NAME_RESOLVED_FALSE_TTL_MS, qt as RpcFetchCidParamSchema, rn as RpcSubscriptionIdResultSchema, rr as normalizeCommunityInputFromCommunity, rt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, sn as require_lib$1, st as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcPublishedAnchorRecordResultSchema, tr as getCommunityNameFromWire, un as createAnchorIpnsRecord$1, v as TrackedInstanceRegistry, vt as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, x as RemoteCommunity, xn as signComment, xt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signChallengeRequest, z as PKCClientsManager, zt as RpcCommunitiesChangeEventResultSchema } from "./rpc-local-community-vvW_Lvzi.js";
4
+ import { s as getHeliaDebugContext } from "./util-RG3tBF0u.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -35902,7 +35902,7 @@ var PKC$1 = class extends PKCTypedEmitter {
35902
35902
  this.clients.libp2pJsClients = {};
35903
35903
  if (!this.libp2pJsClientsOptions) return;
35904
35904
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
35905
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-DldRnBHX.js");
35905
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-DrE9AZtp.js");
35906
35906
  for (const clientOptions of this.libp2pJsClientsOptions) {
35907
35907
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
35908
35908
  ...clientOptions,
@@ -36267,7 +36267,7 @@ var PKC$1 = class extends PKCTypedEmitter {
36267
36267
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
36268
36268
  log.trace("Received community options to create a local community instance:", options);
36269
36269
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
36270
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-9i6vs_-P.js");
36270
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-D4m4-sUw.js");
36271
36271
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
36272
36272
  const community = new LocalCommunity(this);
36273
36273
  if (isLocalCommunity) {
@@ -1,4 +1,4 @@
1
- import { bn as PageSortFileSchema, hr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-TZLcBbZd.js";
1
+ import { bn as PageSortFileSchema, hr as isStringDomain, v as getEquivalentCommunityAddresses } from "./util-B4ZXn1pD.js";
2
2
  //#region dist/node/pages/page-sort-scoring.js
3
3
  function validatePageSortFile(rawFile) {
4
4
  const validated = PageSortFileSchema.parse(rawFile);
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as e$4, Bn as CommentUpdateSignedPropertyNames, Br as require_supports_color, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as r$7, Dt as require_sha256$1, E as isAbortError, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as looseObject, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as PageIpfsSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$12, Un as CreateCommentOptionsWithRefinementSchema, Ur as _enum, Ut as NameResolveCacheOptionsSchema, V as raceAgainstAbort, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as object, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersSchema, at as timestamp, bn as PageSortFileSchema, br as t$13, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isStringDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$2, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, nr as AuthorCommentIpfsReservedFields, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileFactorySchema, or as CidPathSchema, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, qn as isReservedObjectKey, qr as literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyCid, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default } from "./util-TZLcBbZd.js";
2
+ import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, An as CommentIpfsReservedFields, Ar as e$4, Bn as CommentUpdateSignedPropertyNames, Br as require_supports_color, C as hideClassPrivateProps, Cn as CreateVoteUserOptionsWithRefinementSchema, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VoteSignedPropertyNames, Dr as r$7, Dt as require_sha256$1, E as isAbortError, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentUpdateChallengeReservedFieldNames, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as ModQueuePageIpfsSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, Ht as DecryptedChallengeVerificationSchema, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as CommentEditChallengeRequestToEncryptSchema, Jr as looseObject, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as PageIpfsSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateForChallengeVerificationSignedPropertyNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pn as CommentSignedPropertyNames, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditSignedPropertyNames, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateReservedFields, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$12, Un as CreateCommentOptionsWithRefinementSchema, Ur as _enum, Ut as NameResolveCacheOptionsSchema, V as raceAgainstAbort, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wn as GetPageParamSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xr as object, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as ChallengeAnswersSchema, at as timestamp, bn as PageSortFileSchema, br as t$13, cr as CommunityAddressSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as JsonSignatureSchema, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CreateCommentEditOptionsWithRefinementSchema, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as PKCTimestampSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as isStringDomain, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as throwIfAbortSignalAborted, jn as CommentIpfsSchema, jr as require_retry$2, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as CommentChallengeRequestToEncryptSchema, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CommunityAuthorChallengeReservedFieldNames, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as areEquivalentNames, mt as forgetTrackedUpdatingCommunityName, nr as AuthorCommentIpfsReservedFields, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileFactorySchema, or as CidPathSchema, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as ProtocolVersionSchema, pt as findUpdatingCommunity, qn as isReservedObjectKey, qr as literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorPubsubSchema, sn as ChallengeFileSchema, sr as CidStringSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tr as AuthorAddressSchema, tt as shortifyCid, u as createAbortError, un as CommunityEditOptionsSchema, ur as CreateSignerSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as VoteChallengeRequestToEncryptSchema, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as pubsubTopicToDhtKey, zn as CommentUpdateSchema, zr as logger_default } from "./util-B4ZXn1pD.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
- import { s as validatePageSortFile } from "./page-sort-scoring-BCqpbgnJ.js";
4
+ import { s as validatePageSortFile } from "./page-sort-scoring-CMIhwYqH.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import dns from "node:dns";
@@ -16552,7 +16552,7 @@ const CommunityEditPublicationPubsubReservedFields = r$2([
16552
16552
  ], t$3(CommunityEditPubsubMessagePublicationSchema.shape));
16553
16553
  //#endregion
16554
16554
  //#region dist/node/generated-version.js
16555
- const version = "0.0.135";
16555
+ const version = "0.0.137";
16556
16556
  //#endregion
16557
16557
  //#region dist/node/version.js
16558
16558
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
@@ -1,4 +1,4 @@
1
- import { B as pubsubTopicToDhtKeyCid, Lr as PKCError } from "./util-TZLcBbZd.js";
1
+ import { B as pubsubTopicToDhtKeyCid, Lr as PKCError } from "./util-B4ZXn1pD.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { ipnsValidator } from "ipns/validator";
4
4
  import { unmarshalIPNSRecord } from "ipns";
@@ -1,5 +1,5 @@
1
- import { Lr as PKCError, on as ChallengeFileFactorySchema, sn as ChallengeFileSchema, yn as PageSortFileFactorySchema } from "./util-TZLcBbZd.js";
2
- import { s as validatePageSortFile } from "./page-sort-scoring-BCqpbgnJ.js";
1
+ import { Lr as PKCError, on as ChallengeFileFactorySchema, sn as ChallengeFileSchema, yn as PageSortFileFactorySchema } from "./util-B4ZXn1pD.js";
2
+ import { s as validatePageSortFile } from "./page-sort-scoring-CMIhwYqH.js";
3
3
  //#region dist/node/validate-package-factories.js
4
4
  function validateChallengeFileFactory(factory, { name }) {
5
5
  try {
@@ -1,2 +1,2 @@
1
- import { a as getShortCid, c as setNativeFunctions, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as pageSorts, t as PKC } from "./chunks/node-BNoBGxyk.js";
1
+ import { a as getShortCid, c as setNativeFunctions, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as pageSorts, t as PKC } from "./chunks/node-CULFO_M2.js";
2
2
  export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, pageSorts, setNativeFunctions };
@@ -1,2 +1,2 @@
1
- import { n as validatePageSortFileFactory } from "./chunks/validate-package-factories-DGlKaHzi.js";
1
+ import { n as validatePageSortFileFactory } from "./chunks/validate-package-factories-C3PC9lVi.js";
2
2
  export { validatePageSortFileFactory };
@@ -1,7 +1,7 @@
1
- import { $ as retryKuboIpfsAddAndProvide, C as hideClassPrivateProps, Lr as PKCError, Y as replaceXWithY, br as t, dt as findStartedCommunity, i as calculateStringSizeSameAsIpfsAddCidV0, kt as pTimeout, vr as n, zr as logger_default } from "../../chunks/util-TZLcBbZd.js";
2
- import { S as parseRpcUnsubscribeParam, _ as parseRpcExportCommunityParam, b as parseRpcPublishChallengeAnswersParam, d as parseRpcCidParam, f as parseRpcCommentRepliesPageParam, g as parseRpcExportCommunityModLogsParam, h as parseRpcEditCommunityParam, l as parseRpcAuthorNameParam, m as parseRpcCommunityPageParam, p as parseRpcCommunityIdentifierParam, t as PKC, u as parseRpcCancelExportParam, v as parseRpcFetchCommunityListParam, x as parseRpcPublishCommunityListParam, y as parseRpcPublishAnchorRecordParam } from "../../chunks/node-BNoBGxyk.js";
3
- import { Dt as parseJsonWithPKCErrorIfFails, E as buildPagesRuntimeFields, Gr as stringify, L as extractCrosspostRuntimeFields, Mt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Pr as toCommunitiesWireEntry, Rr as t$1, T as buildPageRuntimeFields, Tr as listCommunitiesSync, U as pRetry, Vn as verifyCommunityList, W as pLimit, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, at as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, br as findLocalCommunityAddress, bt as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, mt as parseCommunityListSchemaWithPKCErrorIfItFails, nt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, sn as require_lib, tt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ut as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-CuL4H_vR.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-BjljrKks.js";
1
+ import { $ as retryKuboIpfsAddAndProvide, C as hideClassPrivateProps, Lr as PKCError, Y as replaceXWithY, br as t, dt as findStartedCommunity, i as calculateStringSizeSameAsIpfsAddCidV0, kt as pTimeout, vr as n, zr as logger_default } from "../../chunks/util-B4ZXn1pD.js";
2
+ import { S as parseRpcUnsubscribeParam, _ as parseRpcExportCommunityParam, b as parseRpcPublishChallengeAnswersParam, d as parseRpcCidParam, f as parseRpcCommentRepliesPageParam, g as parseRpcExportCommunityModLogsParam, h as parseRpcEditCommunityParam, l as parseRpcAuthorNameParam, m as parseRpcCommunityPageParam, p as parseRpcCommunityIdentifierParam, t as PKC, u as parseRpcCancelExportParam, v as parseRpcFetchCommunityListParam, x as parseRpcPublishCommunityListParam, y as parseRpcPublishAnchorRecordParam } from "../../chunks/node-CULFO_M2.js";
3
+ import { Dt as parseJsonWithPKCErrorIfFails, E as buildPagesRuntimeFields, Gr as stringify, L as extractCrosspostRuntimeFields, Mt as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Pr as toCommunitiesWireEntry, Rr as t$1, T as buildPageRuntimeFields, Tr as listCommunitiesSync, U as pRetry, Vn as verifyCommunityList, W as pLimit, Xn as MAX_COMMUNITY_LIST_SIZE_BYTES, at as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, br as findLocalCommunityAddress, bt as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, jt as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, mt as parseCommunityListSchemaWithPKCErrorIfItFails, nt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, sn as require_lib, tt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ut as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yt as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-vvW_Lvzi.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-BhrCFCCl.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -83,6 +83,19 @@ function encodeChallengeVerificationMessage(msg) {
83
83
  signature: _encodeSignature(msg.signature)
84
84
  };
85
85
  }
86
+ const isOriginTrustedWithoutAuthKey = (origin) => {
87
+ if (origin === void 0) return true;
88
+ if (origin === "file://") return true;
89
+ let url;
90
+ try {
91
+ url = new URL(origin);
92
+ } catch {
93
+ return false;
94
+ }
95
+ if (url.protocol !== "http:" && url.protocol !== "https:") return false;
96
+ const hostname = url.hostname.toLowerCase();
97
+ return hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "[::1]" || /^127(\.\d{1,3}){3}$/.test(hostname);
98
+ };
86
99
  //#endregion
87
100
  //#region dist/node/rpc/src/json-rpc-util.js
88
101
  var import_lib = require_lib();
@@ -176,7 +189,15 @@ var PKCWsServer = class extends import_lib.TypedEmitter {
176
189
  if (!isLocalhost && !hasAuth) {
177
190
  log(`Rejecting RPC connection request from`, requestOriginatorIp, `rejected because there is no auth key, url:`, req.url);
178
191
  callback(false, 403, "You need to set the auth key to connect remotely");
179
- } else callback(true);
192
+ return;
193
+ }
194
+ const origin = req.headers.origin;
195
+ if (!hasAuth && !isOriginTrustedWithoutAuthKey(origin)) {
196
+ log(`Rejecting RPC connection request from web page origin`, origin, `because there is no auth key, url:`, req.url);
197
+ callback(false, 403, "You need to set the auth key to connect from this web page origin");
198
+ return;
199
+ }
200
+ callback(true);
180
201
  }
181
202
  });
182
203
  this.ws = this.rpcWebsockets.wss;
@@ -1 +1 @@
1
- export declare const version = "0.0.135";
1
+ export declare const version = "0.0.137";
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by config/generate-version.js — do not edit
2
- export const version = "0.0.135";
2
+ export const version = "0.0.137";
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
7
7
  import path from "path";
8
8
  import Database from "better-sqlite3";
9
9
  import PKCJs, { setPKCJs } from "./lib/pkc-js/index.js";
10
- import { encodeChallengeAnswerMessage, encodeChallengeMessage, encodeChallengeRequest, encodeChallengeVerificationMessage, generateSubscriptionId } from "./utils.js";
10
+ import { encodeChallengeAnswerMessage, encodeChallengeMessage, encodeChallengeRequest, encodeChallengeVerificationMessage, generateSubscriptionId, isOriginTrustedWithoutAuthKey } from "./utils.js";
11
11
  import Logger from "../../logger.js";
12
12
  import pTimeout from "p-timeout";
13
13
  import { PKCError } from "../../pkc-error.js";
@@ -129,9 +129,16 @@ class PKCWsServer extends TypedEmitter {
129
129
  if (!isLocalhost && !hasAuth) {
130
130
  log(`Rejecting RPC connection request from`, requestOriginatorIp, `rejected because there is no auth key, url:`, req.url);
131
131
  callback(false, 403, "You need to set the auth key to connect remotely");
132
+ return;
132
133
  }
133
- else
134
- callback(true);
134
+ // a web page connects from localhost too, so a page from a remote origin also needs the auth key
135
+ const origin = req.headers.origin;
136
+ if (!hasAuth && !isOriginTrustedWithoutAuthKey(origin)) {
137
+ log(`Rejecting RPC connection request from web page origin`, origin, `because there is no auth key, url:`, req.url);
138
+ callback(false, 403, "You need to set the auth key to connect from this web page origin");
139
+ return;
140
+ }
141
+ callback(true);
135
142
  }
136
143
  });
137
144
  // rpc-sockets uses this library https://www.npmjs.com/package/ws