@pkcprotocol/pkc-js 0.0.72 → 0.0.73

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.
@@ -1,5 +1,5 @@
1
- import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, _r as PKCError, yr as logger_default } from "./schema-B3duXSG7.js";
2
- import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-DOWWxZIE.js";
1
+ import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, _r as PKCError, yr as logger_default } from "./schema-DMHTAMSM.js";
2
+ import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-hdyyy-HI.js";
3
3
  import { CID } from "multiformats/cid";
4
4
  import { peerIdFromString } from "@libp2p/peer-id";
5
5
  import { EventEmitter as EventEmitter$1 } from "events";
@@ -1,12 +1,12 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $n as t$7, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mr as ZodError, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as n$3, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as n$4, Y as isLinkValid, Zn as t$8, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, ar as t$4, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as t$5, d as DecryptedChallengeRequestSchema, dr as require_retry, dt as retryKuboIpfsAddAndProvide, er as t$6, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, ir as r$1, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$3, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, nt as removeBlocksFromKuboNode, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as e, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, vr as messages, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yr as logger_default, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-B3duXSG7.js";
3
- import { $n as t$10, A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as r$2, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as t$9, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Xn as n$6, Yn as t$11, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, Zn as n$5, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, er as stringify, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, nr as require_lodash_merge, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as t$12, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tr as STORAGE_KEYS, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-ZxNkZCBr.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as t$7, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mr as ZodError, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as n$3, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as n$4, Y as isLinkValid, Zn as t$8, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, ar as t$4, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as t$5, d as DecryptedChallengeRequestSchema, dr as require_retry, dt as retryKuboIpfsAddAndProvide, er as t$6, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, ir as r$1, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$3, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, nt as removeBlocksFromKuboNode, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as e, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, vr as messages, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yr as logger_default, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-DMHTAMSM.js";
3
+ import { $n as t$10, A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as r$2, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as t$9, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Xn as n$6, Yn as t$11, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, Zn as n$5, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, er as stringify, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, nr as require_lodash_merge, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as t$12, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tr as STORAGE_KEYS, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-8CqOzaX3.js";
4
4
  import { randomFillSync, randomUUID } from "node:crypto";
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 { existsSync, promises } from "node:fs";
9
- import path$1 from "path";
9
+ import path from "path";
10
10
  import assert from "assert";
11
11
  import fs from "fs";
12
12
  import Database from "better-sqlite3";
@@ -3279,9 +3279,9 @@ var DbHandler = class {
3279
3279
  if (needToMigrate) {
3280
3280
  if (dbExistsAlready && currentDbVersion > 0) {
3281
3281
  this.destoryConnection();
3282
- backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3283
- log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
3284
- if (!fs.existsSync(path$1.dirname(backupDbPath))) await fs.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
3282
+ backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3283
+ log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
3284
+ if (!fs.existsSync(path.dirname(backupDbPath))) await fs.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
3285
3285
  const sourceDb = new Database(dbPath, { fileMustExist: true });
3286
3286
  await sourceDb.backup(backupDbPath);
3287
3287
  sourceDb.close();
@@ -4318,7 +4318,15 @@ var DbHandler = class {
4318
4318
  JOIN ${TABLES.COMMENT_UPDATES} cu_child ON cu_child.cid = child_ref.value
4319
4319
  WHERE cu_parent.replies IS NOT NULL
4320
4320
  AND json_type(cu_parent.replies, '$.best.commentCids') = 'array'
4321
- AND cu_child.updatedAt > cu_parent.insertedAt
4321
+ -- Compare against the parent's updatedAt, not its insertedAt (issue #230). insertedAt is
4322
+ -- the batch's start timestamp, shared by every row the batch writes (issue #209/#211),
4323
+ -- while updatedAt is stamped when that row is actually calculated. A batch walks a post
4324
+ -- tree deepest-depth-first, so a child is always calculated before its parent and its
4325
+ -- updatedAt lands after the batch's start: comparing against insertedAt re-flagged every
4326
+ -- parent of any batch spanning >= 1 second, which produced another such batch, and the
4327
+ -- update loop never converged. updatedAt is when the parent's replies page was actually
4328
+ -- generated, which is the point the child's data could have gone stale relative to.
4329
+ AND cu_child.updatedAt > cu_parent.updatedAt
4322
4330
  ),
4323
4331
  base_updates AS (
4324
4332
  SELECT * FROM direct_updates
@@ -5084,10 +5092,10 @@ var DbHandler = class {
5084
5092
  if (this._db || this._keyv) await this.destoryConnection();
5085
5093
  this._transactionDepth = 0;
5086
5094
  const dataPath = this._community._pkc.dataPath;
5087
- const oldPathString = path$1.join(dataPath, "communities", oldDbName);
5088
- const newPathString = path$1.join(dataPath, "communities", newDbName);
5089
- await fs.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
5090
- await fs.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
5095
+ const oldPathString = path.join(dataPath, "communities", oldDbName);
5096
+ const newPathString = path.join(dataPath, "communities", newDbName);
5097
+ await fs.promises.mkdir(path.dirname(oldPathString), { recursive: true });
5098
+ await fs.promises.mkdir(path.dirname(newPathString), { recursive: true });
5091
5099
  try {
5092
5100
  if (!fs.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
5093
5101
  else {
@@ -5109,8 +5117,8 @@ var DbHandler = class {
5109
5117
  }
5110
5118
  async lockCommunityStart(communityAddress = this._community.address) {
5111
5119
  const log = logger_default("pkc-js:local-community:db-handler:lock:start");
5112
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5113
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5120
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5121
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5114
5122
  try {
5115
5123
  await import_src.default.lock(communityDbPath, {
5116
5124
  lockfilePath,
@@ -5131,8 +5139,8 @@ var DbHandler = class {
5131
5139
  async unlockCommunityStart(communityAddress = this._community.address) {
5132
5140
  const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
5133
5141
  log.trace(`Attempting to unlock the start of community (${communityAddress})`);
5134
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5135
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5142
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5143
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5136
5144
  if (!fs.existsSync(lockfilePath) || !fs.existsSync(communityDbPath)) return;
5137
5145
  try {
5138
5146
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5143,8 +5151,8 @@ var DbHandler = class {
5143
5151
  }
5144
5152
  }
5145
5153
  async isCommunityStartLocked(communityAddress = this._community.address) {
5146
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5147
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5154
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5155
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5148
5156
  return await import_src.default.check(communityDbPath, {
5149
5157
  lockfilePath,
5150
5158
  realpath: false,
@@ -5153,8 +5161,8 @@ var DbHandler = class {
5153
5161
  }
5154
5162
  async lockCommunityState() {
5155
5163
  const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
5156
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5157
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5164
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5165
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5158
5166
  try {
5159
5167
  await import_src.default.lock(communityDbPath, {
5160
5168
  lockfilePath,
@@ -5171,8 +5179,8 @@ var DbHandler = class {
5171
5179
  }
5172
5180
  async unlockCommunityState() {
5173
5181
  const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
5174
- const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5175
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5182
+ const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5183
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5176
5184
  if (!fs.existsSync(lockfilePath)) return;
5177
5185
  try {
5178
5186
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5182,7 +5190,7 @@ var DbHandler = class {
5182
5190
  }
5183
5191
  }
5184
5192
  communityDbExists() {
5185
- const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5193
+ const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5186
5194
  return fs.existsSync(communityDbPath);
5187
5195
  }
5188
5196
  markCommentsAsPublishedToPostUpdates(commentCids) {
@@ -6873,11 +6881,11 @@ async function edit(community, newCommunityOptions) {
6873
6881
  const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
6874
6882
  function defaultExportPathFor(community, exportId) {
6875
6883
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
6876
- return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
6884
+ return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
6877
6885
  }
6878
6886
  function sourceDbPathFor(community) {
6879
6887
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
6880
- return path.join(community._pkc.dataPath, "communities", community.address);
6888
+ return Path.join(community._pkc.dataPath, "communities", community.address);
6881
6889
  }
6882
6890
  async function persistExports(community) {
6883
6891
  if (!community._dbHandler) return;
@@ -6953,9 +6961,9 @@ async function runExportTask(community, exportId, opts) {
6953
6961
  async function exportCommunityEmbedded(community, options = {}) {
6954
6962
  if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
6955
6963
  const exportId = v4();
6956
- const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
6964
+ const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
6957
6965
  const includePrivateKey = options.includePrivateKey === true;
6958
- if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
6966
+ if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
6959
6967
  communityAddress: community.address,
6960
6968
  exportPath: destPath
6961
6969
  });
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DWf7A4hj.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DLVCXKMM.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 { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, Fr as stringifyPrimitive, H as isIpns, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Nr as joinValues, Pr as parsedType, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as n$1, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sr as setErrorMap, St as findUpdatingComment, Tt as listUpdatingComments, Xn as n$2, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, br as require_supports_color, cn as PubsubTopicSchema, ct as resolveWhenPredicateIsTrue, dr as require_retry, er as t$1, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, ir as r, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as e, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yr as logger_default, z as isAbortError } from "./schema-B3duXSG7.js";
3
- import { $ as RepliesPages, $n as t$5, $t as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCidParamSchema, At as verifyCommunityEdit, B as setNativeFunctions$1, Bn as RpcFetchCidResultSchema, Bt as getCommunityPublicKeyFromWire, Cn as parseRpcCommentEventWithPKCErrorIfItFails, Ct as verifyChallengeVerification, D as createKuboRpcClient, Dn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Dt as verifyCommentPubsubMessage, Et as verifyCommentModeration, Fn as RpcExportCommunityModLogsParamSchema, Gn as RpcUnsubscribeParamSchema, H as CommentClientsManager, Hn as RpcResolveAuthorNameResultSchema, Ht as decode, I as listCommunitiesSync, In as RpcExportCommunityModLogsResultSchema, It as normalizeCreatePublicationAuthor, Kn as t$4, L as monitorCommunitiesDirectory, Ln as RpcExportCommunityParamSchema, Lt as buildRuntimeCommunityFields, Mn as RpcCommunityIdentifierParamSchema, Mt as buildRuntimeAuthor, N as getDefaultDataPath, Nn as RpcCommunityPageParamSchema, Nt as cleanWireAuthor, On as RpcAuthorNameParamSchema, Ot as verifyCommentUpdate, Pn as RpcEditCommunityParamSchema, Pt as getAuthorNameFromRuntime, Q as parseRawPages, Qn as t$2, Rn as RpcExportCommunityResultSchema, Rt as getCommunityAddressFromRecord, Sn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Tt as verifyCommentIpfs, Un as RpcSubscriptionIdResultSchema, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcPublishChallengeAnswersParamSchema, Vt as normalizeCommunityInputFromCommunity, Wn as RpcSuccessResultSchema, Wt as getBufferedPKCAddressFromPublicKey, X as findCommentInPageInstanceRecursively, Xn as n$3, Xt as parseCidStringSchemaWithPKCErrorIfItFails, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as t$3, _n as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, at as PKCTypedEmitter, bn as parseDecryptedChallengeWithPKCErrorIfItFails, c as AddressesRewriterProxyServer, ct as signChallengeAnswer, dn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, en as parseCommentIpfsSchemaWithPKCErrorIfItFails, et as PublicationClientsManager, f as KeyvBetterSqlite3, fn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ft as signComment, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, hn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, in as parseCommunityAddressWithPKCErrorIfItFails, ir as require_undici, jn as RpcCommentRepliesPageParamSchema, jt as verifyVote, kn as RpcCancelExportParamSchema, ln as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, m as decodeRpcChallengePubsubMsg, mt as signCommentModeration, n as RpcRemoteCommunity, nn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, nt as InflightFetchManager, o as TrackedInstanceRegistry, ot as require_lib$1, p as decodeRpcChallengeAnswerPubsubMsg, pt as signCommentEdit, rn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, rr as nativeFunctions$2, s as LRUCache, sn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tt as PKCClientsManager, u as RemoteCommunity, un as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ut as signChallengeRequest, v as createSigner, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, vt as signCommunityEdit, wn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, wt as verifyCommentEdit, x as encryptEd25519AesGcm, xn as parseJsonWithPKCErrorIfFails, xt as verifyChallengeMessage, y as decryptEd25519AesGcm, yn as parseDecryptedChallengeVerification, yt as signVote, zn as RpcFetchCidParamSchema, zt as getCommunityNameFromWire } from "./rpc-local-community-ZxNkZCBr.js";
4
- import { o as getHeliaDebugContext } from "./util-DOWWxZIE.js";
2
+ import { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, Fr as stringifyPrimitive, H as isIpns, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Nr as joinValues, Pr as parsedType, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as n$1, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sr as setErrorMap, St as findUpdatingComment, Tt as listUpdatingComments, Xn as n$2, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, br as require_supports_color, cn as PubsubTopicSchema, ct as resolveWhenPredicateIsTrue, dr as require_retry, er as t$1, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, ir as r, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as e, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yr as logger_default, z as isAbortError } from "./schema-DMHTAMSM.js";
3
+ import { $ as RepliesPages, $n as t$5, $t as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCidParamSchema, At as verifyCommunityEdit, B as setNativeFunctions$1, Bn as RpcFetchCidResultSchema, Bt as getCommunityPublicKeyFromWire, Cn as parseRpcCommentEventWithPKCErrorIfItFails, Ct as verifyChallengeVerification, D as createKuboRpcClient, Dn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Dt as verifyCommentPubsubMessage, Et as verifyCommentModeration, Fn as RpcExportCommunityModLogsParamSchema, Gn as RpcUnsubscribeParamSchema, H as CommentClientsManager, Hn as RpcResolveAuthorNameResultSchema, Ht as decode, I as listCommunitiesSync, In as RpcExportCommunityModLogsResultSchema, It as normalizeCreatePublicationAuthor, Kn as t$4, L as monitorCommunitiesDirectory, Ln as RpcExportCommunityParamSchema, Lt as buildRuntimeCommunityFields, Mn as RpcCommunityIdentifierParamSchema, Mt as buildRuntimeAuthor, N as getDefaultDataPath, Nn as RpcCommunityPageParamSchema, Nt as cleanWireAuthor, On as RpcAuthorNameParamSchema, Ot as verifyCommentUpdate, Pn as RpcEditCommunityParamSchema, Pt as getAuthorNameFromRuntime, Q as parseRawPages, Qn as t$2, Rn as RpcExportCommunityResultSchema, Rt as getCommunityAddressFromRecord, Sn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Tt as verifyCommentIpfs, Un as RpcSubscriptionIdResultSchema, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcPublishChallengeAnswersParamSchema, Vt as normalizeCommunityInputFromCommunity, Wn as RpcSuccessResultSchema, Wt as getBufferedPKCAddressFromPublicKey, X as findCommentInPageInstanceRecursively, Xn as n$3, Xt as parseCidStringSchemaWithPKCErrorIfItFails, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as t$3, _n as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, at as PKCTypedEmitter, bn as parseDecryptedChallengeWithPKCErrorIfItFails, c as AddressesRewriterProxyServer, ct as signChallengeAnswer, dn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, en as parseCommentIpfsSchemaWithPKCErrorIfItFails, et as PublicationClientsManager, f as KeyvBetterSqlite3, fn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ft as signComment, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, hn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, in as parseCommunityAddressWithPKCErrorIfItFails, ir as require_undici, jn as RpcCommentRepliesPageParamSchema, jt as verifyVote, kn as RpcCancelExportParamSchema, ln as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, m as decodeRpcChallengePubsubMsg, mt as signCommentModeration, n as RpcRemoteCommunity, nn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, nt as InflightFetchManager, o as TrackedInstanceRegistry, ot as require_lib$1, p as decodeRpcChallengeAnswerPubsubMsg, pt as signCommentEdit, rn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, rr as nativeFunctions$2, s as LRUCache, sn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tt as PKCClientsManager, u as RemoteCommunity, un as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ut as signChallengeRequest, v as createSigner, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, vt as signCommunityEdit, wn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, wt as verifyCommentEdit, x as encryptEd25519AesGcm, xn as parseJsonWithPKCErrorIfFails, xt as verifyChallengeMessage, y as decryptEd25519AesGcm, yn as parseDecryptedChallengeVerification, yt as signVote, zn as RpcFetchCidParamSchema, zt as getCommunityNameFromWire } from "./rpc-local-community-8CqOzaX3.js";
4
+ import { o as getHeliaDebugContext } from "./util-hdyyy-HI.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -8875,7 +8875,7 @@ var PKC$1 = class extends PKCTypedEmitter {
8875
8875
  this.clients.libp2pJsClients = {};
8876
8876
  if (!this.libp2pJsClientsOptions) return;
8877
8877
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
8878
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-BcZhGLB0.js");
8878
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-DooZDxJi.js");
8879
8879
  for (const clientOptions of this.libp2pJsClientsOptions) {
8880
8880
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
8881
8881
  ...clientOptions,
@@ -9123,7 +9123,7 @@ var PKC$1 = class extends PKCTypedEmitter {
9123
9123
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
9124
9124
  log.trace("Received community options to create a local community instance:", options);
9125
9125
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
9126
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-Cd5HOxwM.js");
9126
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-EFv2VpQI.js");
9127
9127
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
9128
9128
  const community = new LocalCommunity(this);
9129
9129
  if (isLocalCommunity) {
@@ -1,15 +1,15 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-B3duXSG7.js";
2
+ import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-DMHTAMSM.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
4
  import http from "node:http";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import fsp from "node:fs/promises";
8
- import path from "node:path";
8
+ import Path from "node:path";
9
9
  import dns from "node:dns";
10
10
  import os from "os";
11
11
  import { closeSync, createReadStream, existsSync, openSync, promises, readSync, readdirSync, rm, watch } from "node:fs";
12
- import path$1 from "path";
12
+ import path from "path";
13
13
  import assert from "assert";
14
14
  import { Agent } from "https";
15
15
  import { Agent as Agent$1 } from "http";
@@ -101592,14 +101592,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
101592
101592
  };
101593
101593
  //#endregion
101594
101594
  //#region dist/node/runtime/node/util.js
101595
- const getDefaultDataPath = () => path$1.join(process.cwd(), ".pkc");
101595
+ const getDefaultDataPath = () => path.join(process.cwd(), ".pkc");
101596
101596
  const getDefaultCommunityDbConfig = async (communityAddress, pkc) => {
101597
101597
  let filename;
101598
101598
  if (pkc.noData) filename = ":memory:";
101599
101599
  else {
101600
101600
  assert(typeof pkc.dataPath === "string", "pkc.dataPath need to be defined to get default community db config");
101601
- filename = path$1.join(pkc.dataPath, "communities", communityAddress);
101602
- await promises.mkdir(path$1.dirname(filename), { recursive: true });
101601
+ filename = path.join(pkc.dataPath, "communities", communityAddress);
101602
+ await promises.mkdir(path.dirname(filename), { recursive: true });
101603
101603
  }
101604
101604
  return {
101605
101605
  filename,
@@ -101698,7 +101698,7 @@ const setNativeFunctions = (newNativeFunctions) => {
101698
101698
  };
101699
101699
  const deleteOldCommunityInWindows = async (subPath, pkc) => {
101700
101700
  const log = logger_default("pkc-js:community:deleteStaleCommunityInWindows");
101701
- const communityAddress = path$1.basename(subPath);
101701
+ const communityAddress = path.basename(subPath);
101702
101702
  await new Promise((resolve) => setTimeout(resolve, 1e4));
101703
101703
  try {
101704
101704
  await promises.rm(subPath, { force: true });
@@ -101722,7 +101722,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101722
101722
  }
101723
101723
  const communitiesThatWereDeletedSuccessfully = [];
101724
101724
  for (const communityAddress of deletedPersistentCommunities) {
101725
- const communityPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101725
+ const communityPath = path.join(pkc.dataPath, "communities", communityAddress);
101726
101726
  try {
101727
101727
  await promises.rm(communityPath, { force: true });
101728
101728
  log(`Succeeded in deleting old db path (${communityAddress})`);
@@ -101746,7 +101746,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101746
101746
  function listCommunitiesSync(pkc) {
101747
101747
  logger_default("pkc-js:listCommunitiesSync");
101748
101748
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath needs to be defined to listCommunities");
101749
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101749
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101750
101750
  const files = readdirSync(communitiesPath, {
101751
101751
  recursive: false,
101752
101752
  withFileTypes: false
@@ -101754,7 +101754,7 @@ function listCommunitiesSync(pkc) {
101754
101754
  const communityFilesWeDontNeedToCheck = pkc.communities ? files.filter((address) => pkc.communities.includes(address)) : [];
101755
101755
  const sqliteFiles = files.filter((address) => !communityFilesWeDontNeedToCheck.includes(address)).filter((address) => {
101756
101756
  try {
101757
- const filePath = path$1.join(communitiesPath, address);
101757
+ const filePath = path.join(communitiesPath, address);
101758
101758
  if (!existsSync(filePath)) return false;
101759
101759
  const fd = openSync(filePath, "r");
101760
101760
  const buffer = Buffer.alloc(16);
@@ -101835,7 +101835,7 @@ var BackupAbortError = class extends Error {
101835
101835
  async function backupCommunityDb(opts) {
101836
101836
  const { sourcePath, destPath, includePrivateKey, onProgress, signal } = opts;
101837
101837
  if (signal?.aborted) throw new BackupAbortError();
101838
- await promises.mkdir(path$1.dirname(destPath), { recursive: true });
101838
+ await promises.mkdir(path.dirname(destPath), { recursive: true });
101839
101839
  const partialPath = destPath + ".partial";
101840
101840
  try {
101841
101841
  await promises.unlink(partialPath);
@@ -101919,9 +101919,9 @@ async function statAndHashFile(filePath) {
101919
101919
  }
101920
101920
  async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
101921
101921
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath is not defined");
101922
- const oldPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101923
- const newPath = path$1.join(pkc.dataPath, "communities", "deleted", communityAddress);
101924
- await promises.mkdir(path$1.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101922
+ const oldPath = path.join(pkc.dataPath, "communities", communityAddress);
101923
+ const newPath = path.join(pkc.dataPath, "communities", "deleted", communityAddress);
101924
+ await promises.mkdir(path.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101925
101925
  if (!existsSync(oldPath)) throw Error(`Source database ${oldPath} does not exist`);
101926
101926
  try {
101927
101927
  const sourceDb = new Database(oldPath, { fileMustExist: true });
@@ -101957,7 +101957,7 @@ async function createKuboRpcClient(kuboRpcClientOptions) {
101957
101957
  }
101958
101958
  async function monitorCommunitiesDirectory(pkc) {
101959
101959
  const watchAbortController = new AbortController();
101960
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101960
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101961
101961
  await promises.mkdir(communitiesPath, { recursive: true });
101962
101962
  const extensionsToIgnore = [
101963
101963
  ".lock",
@@ -125857,11 +125857,11 @@ var AddressRewriterDatabase = class {
125857
125857
  if (kuboConfig && typeof kuboConfig === "object" && "host" in kuboConfig && "port" in kuboConfig) kuboIdentifier = `${kuboConfig.host}_${kuboConfig.port}`;
125858
125858
  const proxyIdentifier = `${proxyTarget.hostname}_${proxyTarget.port || (proxyTarget.protocol === "https:" ? "443" : "80")}`;
125859
125859
  const fileName = `address_rewriter_${kuboIdentifier}_${proxyIdentifier}.db`;
125860
- return path.join(dataPath, ".address-rewriter", fileName);
125860
+ return Path.join(dataPath, ".address-rewriter", fileName);
125861
125861
  }
125862
125862
  async initialize() {
125863
125863
  try {
125864
- const dbDir = path.dirname(this._dbPath);
125864
+ const dbDir = Path.dirname(this._dbPath);
125865
125865
  await fsp.mkdir(dbDir, { recursive: true });
125866
125866
  this._db = new Database(this._dbPath);
125867
125867
  this._db.exec(`
@@ -16032,7 +16032,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
16032
16032
  }
16033
16033
  //#endregion
16034
16034
  //#region dist/node/generated-version.js
16035
- const version = "0.0.72";
16035
+ const version = "0.0.73";
16036
16036
  //#endregion
16037
16037
  //#region dist/node/version.js
16038
16038
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
@@ -1,4 +1,4 @@
1
- import { _r as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-B3duXSG7.js";
1
+ import { _r as PKCError, et as pubsubTopicToDhtKeyCid } from "./schema-DMHTAMSM.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { equals } from "uint8arrays/equals";
4
4
  //#region dist/node/helia/util.js
@@ -1,2 +1,2 @@
1
- import { a as nativeFunctions, i as getShortCid, n as challenges, o as setNativeFunctions, r as getShortAddress, t as PKC } from "./chunks/node-sP-twQPW.js";
1
+ import { a as nativeFunctions, i as getShortCid, n as challenges, o as setNativeFunctions, r as getShortAddress, t as PKC } from "./chunks/node-Dpuw7iSW.js";
2
2
  export { challenges, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
@@ -1,7 +1,7 @@
1
- import { L as hideClassPrivateProps, Qn as n, _r as PKCError, er as t, st as replaceXWithY, xt as findStartedCommunity, yr as logger_default } from "../../chunks/schema-B3duXSG7.js";
2
- import { _ as parseRpcUnsubscribeParam, c as parseRpcCancelExportParam, d as parseRpcCommunityIdentifierParam, f as parseRpcCommunityPageParam, g as parseRpcPublishChallengeAnswersParam, h as parseRpcExportCommunityParam, l as parseRpcCidParam, m as parseRpcExportCommunityModLogsParam, p as parseRpcEditCommunityParam, s as parseRpcAuthorNameParam, t as PKC, u as parseRpcCommentRepliesPageParam } from "../../chunks/node-sP-twQPW.js";
3
- import { En as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, J as buildPagesRuntimeFields, Qt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Zt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, an as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, er as stringify, it as pLimit, mn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ot as require_lib, pn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, q as buildPageRuntimeFields, qn as t$1, rt as pRetry, tn as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-ZxNkZCBr.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-DWf7A4hj.js";
1
+ import { L as hideClassPrivateProps, Qn as n, _r as PKCError, er as t, st as replaceXWithY, xt as findStartedCommunity, yr as logger_default } from "../../chunks/schema-DMHTAMSM.js";
2
+ import { _ as parseRpcUnsubscribeParam, c as parseRpcCancelExportParam, d as parseRpcCommunityIdentifierParam, f as parseRpcCommunityPageParam, g as parseRpcPublishChallengeAnswersParam, h as parseRpcExportCommunityParam, l as parseRpcCidParam, m as parseRpcExportCommunityModLogsParam, p as parseRpcEditCommunityParam, s as parseRpcAuthorNameParam, t as PKC, u as parseRpcCommentRepliesPageParam } from "../../chunks/node-Dpuw7iSW.js";
3
+ import { En as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, J as buildPagesRuntimeFields, Qt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Zt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, an as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, er as stringify, it as pLimit, mn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ot as require_lib, pn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, q as buildPageRuntimeFields, qn as t$1, rt as pRetry, tn as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-8CqOzaX3.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-DLVCXKMM.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -1 +1 @@
1
- export declare const version = "0.0.72";
1
+ export declare const version = "0.0.73";
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by config/generate-version.js — do not edit
2
- export const version = "0.0.72";
2
+ export const version = "0.0.73";
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -1606,7 +1606,15 @@ export class DbHandler {
1606
1606
  JOIN ${TABLES.COMMENT_UPDATES} cu_child ON cu_child.cid = child_ref.value
1607
1607
  WHERE cu_parent.replies IS NOT NULL
1608
1608
  AND json_type(cu_parent.replies, '$.best.commentCids') = 'array'
1609
- AND cu_child.updatedAt > cu_parent.insertedAt
1609
+ -- Compare against the parent's updatedAt, not its insertedAt (issue #230). insertedAt is
1610
+ -- the batch's start timestamp, shared by every row the batch writes (issue #209/#211),
1611
+ -- while updatedAt is stamped when that row is actually calculated. A batch walks a post
1612
+ -- tree deepest-depth-first, so a child is always calculated before its parent and its
1613
+ -- updatedAt lands after the batch's start: comparing against insertedAt re-flagged every
1614
+ -- parent of any batch spanning >= 1 second, which produced another such batch, and the
1615
+ -- update loop never converged. updatedAt is when the parent's replies page was actually
1616
+ -- generated, which is the point the child's data could have gone stale relative to.
1617
+ AND cu_child.updatedAt > cu_parent.updatedAt
1610
1618
  ),
1611
1619
  base_updates AS (
1612
1620
  SELECT * FROM direct_updates