@pkcprotocol/pkc-js 0.0.85 → 0.0.86

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 (25) hide show
  1. package/dist/browser/community/remote-community.d.ts +5 -0
  2. package/dist/browser/community/remote-community.js +98 -16
  3. package/dist/browser/community/remote-community.js.map +1 -1
  4. package/dist/browser/community/schema.js +5 -1
  5. package/dist/browser/community/schema.js.map +1 -1
  6. package/dist/browser/generated-version.d.ts +1 -1
  7. package/dist/browser/generated-version.js +1 -1
  8. package/dist/bundled/bundle-manifest.json +31 -31
  9. package/dist/bundled/chunks/{helia-for-pkc-C5Oe_ZSx.js → helia-for-pkc-yqf2rWMx.js} +33 -33
  10. package/dist/bundled/chunks/{local-community-D4SjlAKS.js → local-community-BURzF_1m.js} +1 -1
  11. package/dist/bundled/chunks/{local-community-BqxmCg5p.js → local-community-NUwjwbZz.js} +26 -26
  12. package/dist/bundled/chunks/{node-C2DKW30L.js → node-BbvETZ1u.js} +5 -5
  13. package/dist/bundled/chunks/{rpc-local-community-o0teUvw_.js → rpc-local-community-Cpw9_Nuo.js} +44 -21
  14. package/dist/bundled/chunks/{schema-qhSDu1BU.js → schema-BT0023M6.js} +3 -2
  15. package/dist/bundled/chunks/{util-BVGNNIgn.js → util-BmT_84kq.js} +1 -1
  16. package/dist/bundled/index.js +1 -1
  17. package/dist/bundled/rpc/src/index.js +4 -4
  18. package/dist/node/community/remote-community.d.ts +5 -0
  19. package/dist/node/community/remote-community.js +98 -16
  20. package/dist/node/community/remote-community.js.map +1 -1
  21. package/dist/node/community/schema.js +5 -1
  22. package/dist/node/community/schema.js.map +1 -1
  23. package/dist/node/generated-version.d.ts +1 -1
  24. package/dist/node/generated-version.js +1 -1
  25. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, Sr as logger_default, br as PKCError } from "./schema-qhSDu1BU.js";
3
- import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-BVGNNIgn.js";
2
+ import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, Sr as logger_default, br as PKCError } from "./schema-BT0023M6.js";
3
+ import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-BmT_84kq.js";
4
4
  import { t as map } from "./src-Cpx2Sts8.js";
5
5
  import { t as parallelBatch } from "./src-DKntVmyX.js";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import fsp, { rename, writeFile } from "node:fs/promises";
8
- import Path, { basename, dirname, join } from "node:path";
9
- import path from "path";
8
+ import path, { basename, dirname, join } from "node:path";
9
+ import path$1 from "path";
10
10
  import { CID } from "multiformats/cid";
11
11
  import { peerIdFromString } from "@libp2p/peer-id";
12
12
  import * as Digest from "multiformats/hashes/digest";
@@ -148,7 +148,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
148
148
  Object.defineProperty(exports, "__esModule", { value: true });
149
149
  exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
150
150
  const os$1 = __require("os");
151
- const path$9 = __require("path");
151
+ const path$10 = __require("path");
152
152
  const IS_WINDOWS_PLATFORM = os$1.platform() === "win32";
153
153
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
154
154
  /**
@@ -177,7 +177,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
177
177
  }
178
178
  exports.unixify = unixify;
179
179
  function makeAbsolute(cwd, filepath) {
180
- return path$9.resolve(cwd, filepath);
180
+ return path$10.resolve(cwd, filepath);
181
181
  }
182
182
  exports.makeAbsolute = makeAbsolute;
183
183
  function removeLeadingDotSegment(entry) {
@@ -1429,7 +1429,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1429
1429
  //#endregion
1430
1430
  //#region node_modules/picomatch/lib/constants.js
1431
1431
  var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1432
- const path$8 = __require("path");
1432
+ const path$9 = __require("path");
1433
1433
  const WIN_SLASH = "\\\\/";
1434
1434
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1435
1435
  const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
@@ -1554,7 +1554,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1554
1554
  CHAR_UNDERSCORE: 95,
1555
1555
  CHAR_VERTICAL_LINE: 124,
1556
1556
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
1557
- SEP: path$8.sep,
1557
+ SEP: path$9.sep,
1558
1558
  /**
1559
1559
  * Create EXTGLOB_CHARS
1560
1560
  */
@@ -1598,7 +1598,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1598
1598
  //#endregion
1599
1599
  //#region node_modules/picomatch/lib/utils.js
1600
1600
  var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
1601
- const path$7 = __require("path");
1601
+ const path$8 = __require("path");
1602
1602
  const win32 = process.platform === "win32";
1603
1603
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
1604
1604
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -1618,7 +1618,7 @@ var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
1618
1618
  };
1619
1619
  exports.isWindows = (options) => {
1620
1620
  if (options && typeof options.windows === "boolean") return options.windows;
1621
- return win32 === true || path$7.sep === "\\";
1621
+ return win32 === true || path$8.sep === "\\";
1622
1622
  };
1623
1623
  exports.escapeLast = (input, char, lastIdx) => {
1624
1624
  const idx = input.lastIndexOf(char, lastIdx);
@@ -2988,7 +2988,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2988
2988
  //#endregion
2989
2989
  //#region node_modules/picomatch/lib/picomatch.js
2990
2990
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2991
- const path$6 = __require("path");
2991
+ const path$7 = __require("path");
2992
2992
  const scan = require_scan();
2993
2993
  const parse = require_parse();
2994
2994
  const utils = require_utils$2();
@@ -3127,7 +3127,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3127
3127
  * @api public
3128
3128
  */
3129
3129
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3130
- return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$6.basename(input));
3130
+ return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$7.basename(input));
3131
3131
  };
3132
3132
  /**
3133
3133
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -3682,7 +3682,7 @@ var require_micromatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3682
3682
  var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
3683
3683
  Object.defineProperty(exports, "__esModule", { value: true });
3684
3684
  exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
3685
- const path$5 = __require("path");
3685
+ const path$6 = __require("path");
3686
3686
  const globParent = require_glob_parent();
3687
3687
  const micromatch = require_micromatch();
3688
3688
  const GLOBSTAR = "**";
@@ -3790,7 +3790,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
3790
3790
  }
3791
3791
  exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
3792
3792
  function isAffectDepthOfReadingPattern(pattern) {
3793
- const basename = path$5.basename(pattern);
3793
+ const basename = path$6.basename(pattern);
3794
3794
  return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
3795
3795
  }
3796
3796
  exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
@@ -3864,7 +3864,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
3864
3864
  }
3865
3865
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
3866
3866
  function isAbsolute(pattern) {
3867
- return path$5.isAbsolute(pattern);
3867
+ return path$6.isAbsolute(pattern);
3868
3868
  }
3869
3869
  exports.isAbsolute = isAbsolute;
3870
3870
  }));
@@ -4492,7 +4492,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
4492
4492
  //#region node_modules/@nodelib/fs.scandir/out/settings.js
4493
4493
  var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
4494
4494
  Object.defineProperty(exports, "__esModule", { value: true });
4495
- const path$4 = __require("path");
4495
+ const path$5 = __require("path");
4496
4496
  const fsStat = require_out$3();
4497
4497
  const fs = require_fs();
4498
4498
  var Settings = class {
@@ -4500,7 +4500,7 @@ var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
4500
4500
  this._options = _options;
4501
4501
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
4502
4502
  this.fs = fs.createFileSystemAdapter(this._options.fs);
4503
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
4503
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$5.sep);
4504
4504
  this.stats = this._getValue(this._options.stats, false);
4505
4505
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
4506
4506
  this.fsStatSettings = new fsStat.Settings({
@@ -5094,7 +5094,7 @@ var require_sync$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
5094
5094
  //#region node_modules/@nodelib/fs.walk/out/settings.js
5095
5095
  var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
5096
5096
  Object.defineProperty(exports, "__esModule", { value: true });
5097
- const path$3 = __require("path");
5097
+ const path$4 = __require("path");
5098
5098
  const fsScandir = require_out$2();
5099
5099
  var Settings = class {
5100
5100
  constructor(_options = {}) {
@@ -5104,7 +5104,7 @@ var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
5104
5104
  this.deepFilter = this._getValue(this._options.deepFilter, null);
5105
5105
  this.entryFilter = this._getValue(this._options.entryFilter, null);
5106
5106
  this.errorFilter = this._getValue(this._options.errorFilter, null);
5107
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
5107
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
5108
5108
  this.fsScandirSettings = new fsScandir.Settings({
5109
5109
  followSymbolicLinks: this._options.followSymbolicLinks,
5110
5110
  fs: this._options.fs,
@@ -5156,7 +5156,7 @@ var require_out$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
5156
5156
  //#region node_modules/fast-glob/out/readers/reader.js
5157
5157
  var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
5158
5158
  Object.defineProperty(exports, "__esModule", { value: true });
5159
- const path$2 = __require("path");
5159
+ const path$3 = __require("path");
5160
5160
  const fsStat = require_out$3();
5161
5161
  const utils = require_utils$1();
5162
5162
  var Reader = class {
@@ -5169,7 +5169,7 @@ var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
5169
5169
  });
5170
5170
  }
5171
5171
  _getFullEntryPath(filepath) {
5172
- return path$2.resolve(this._settings.cwd, filepath);
5172
+ return path$3.resolve(this._settings.cwd, filepath);
5173
5173
  }
5174
5174
  _makeEntry(stats, pattern) {
5175
5175
  const entry = {
@@ -5504,7 +5504,7 @@ var require_entry = /* @__PURE__ */ __commonJSMin(((exports) => {
5504
5504
  //#region node_modules/fast-glob/out/providers/provider.js
5505
5505
  var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
5506
5506
  Object.defineProperty(exports, "__esModule", { value: true });
5507
- const path$1 = __require("path");
5507
+ const path$2 = __require("path");
5508
5508
  const deep_1 = require_deep();
5509
5509
  const entry_1 = require_entry$1();
5510
5510
  const error_1 = require_error();
@@ -5518,7 +5518,7 @@ var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
5518
5518
  this.entryTransformer = new entry_2.default(this._settings);
5519
5519
  }
5520
5520
  _getRootDirectory(task) {
5521
- return path$1.resolve(this._settings.cwd, task.base);
5521
+ return path$2.resolve(this._settings.cwd, task.base);
5522
5522
  }
5523
5523
  _getReaderOptions(task) {
5524
5524
  const basePath = task.base === "." ? "" : task.base;
@@ -5849,7 +5849,7 @@ var import_out = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((export
5849
5849
  * Async iterable filename pattern matcher
5850
5850
  */
5851
5851
  async function* glob(dir, pattern, options = {}) {
5852
- const absoluteDir = Path.resolve(dir);
5852
+ const absoluteDir = path.resolve(dir);
5853
5853
  const stats = await fsp.stat(absoluteDir);
5854
5854
  for await (const entry of import_out.default.stream(pattern, {
5855
5855
  ...options,
@@ -6024,7 +6024,7 @@ var NextToLast = class {
6024
6024
  };
6025
6025
  }
6026
6026
  decode(str) {
6027
- let fileName = Path.basename(str);
6027
+ let fileName = path.basename(str);
6028
6028
  if (fileName.endsWith(this.extension)) fileName = fileName.substring(0, fileName.length - this.extension.length);
6029
6029
  return CID.decode(this.base.decoder.decode(fileName));
6030
6030
  }
@@ -6050,7 +6050,7 @@ var NextToLast = class {
6050
6050
  async function writeFile$1(file, contents, options) {
6051
6051
  try {
6052
6052
  options?.signal?.throwIfAborted();
6053
- await raceSignal(fsp.mkdir(Path.dirname(file), { recursive: true }), options?.signal);
6053
+ await raceSignal(fsp.mkdir(path.dirname(file), { recursive: true }), options?.signal);
6054
6054
  const writer = new Writer(file);
6055
6055
  options?.signal?.throwIfAborted();
6056
6056
  await writer.write(contents);
@@ -6075,7 +6075,7 @@ var FsBlockstore = class {
6075
6075
  deleteManyConcurrency;
6076
6076
  shardingStrategy;
6077
6077
  constructor(location, init = {}) {
6078
- this.path = Path.resolve(location);
6078
+ this.path = path.resolve(location);
6079
6079
  this.createIfMissing = init.createIfMissing ?? true;
6080
6080
  this.errorIfExists = init.errorIfExists ?? false;
6081
6081
  this.deleteManyConcurrency = init.deleteManyConcurrency ?? 50;
@@ -6101,7 +6101,7 @@ var FsBlockstore = class {
6101
6101
  async put(key, val, options) {
6102
6102
  const { dir, file } = this.shardingStrategy.encode(key);
6103
6103
  try {
6104
- await writeFile$1(Path.join(this.path, dir, file), val, options);
6104
+ await writeFile$1(path.join(this.path, dir, file), val, options);
6105
6105
  return key;
6106
6106
  } catch (err) {
6107
6107
  throw new PutFailedError(String(err));
@@ -6120,7 +6120,7 @@ var FsBlockstore = class {
6120
6120
  let handle;
6121
6121
  try {
6122
6122
  options?.signal?.throwIfAborted();
6123
- handle = await raceSignal(fsp.open(Path.join(this.path, dir, file)), options?.signal);
6123
+ handle = await raceSignal(fsp.open(path.join(this.path, dir, file)), options?.signal);
6124
6124
  yield* handle.createReadStream();
6125
6125
  } catch (err) {
6126
6126
  if (handle != null) await raceSignal(handle.close(), options?.signal);
@@ -6141,7 +6141,7 @@ var FsBlockstore = class {
6141
6141
  const { dir, file } = this.shardingStrategy.encode(key);
6142
6142
  try {
6143
6143
  options?.signal?.throwIfAborted();
6144
- await raceSignal(fsp.unlink(Path.join(this.path, dir, file)), options?.signal);
6144
+ await raceSignal(fsp.unlink(path.join(this.path, dir, file)), options?.signal);
6145
6145
  } catch (err) {
6146
6146
  if (err.code === "ENOENT") return;
6147
6147
  throw new DeleteFailedError(String(err));
@@ -6159,14 +6159,14 @@ var FsBlockstore = class {
6159
6159
  const { dir, file } = this.shardingStrategy.encode(key);
6160
6160
  try {
6161
6161
  options?.signal?.throwIfAborted();
6162
- await raceSignal(fsp.access(Path.join(this.path, dir, file)), options?.signal);
6162
+ await raceSignal(fsp.access(path.join(this.path, dir, file)), options?.signal);
6163
6163
  } catch (err) {
6164
6164
  return false;
6165
6165
  }
6166
6166
  return true;
6167
6167
  }
6168
6168
  async *getAll(options) {
6169
- const pattern = `**/*${this.shardingStrategy.extension}`.split(Path.sep).join("/");
6169
+ const pattern = `**/*${this.shardingStrategy.extension}`.split(path.sep).join("/");
6170
6170
  const files = glob(this.path, pattern, { absolute: true });
6171
6171
  for await (const file of files) try {
6172
6172
  options?.signal?.throwIfAborted();
@@ -6218,7 +6218,7 @@ async function createBlockstoreForLibp2pJsClient({ dataPath, key }) {
6218
6218
  defaultMaxBytes: DEFAULT_IN_MEMORY_BLOCKSTORE_MAX_BYTES,
6219
6219
  close: async () => {}
6220
6220
  };
6221
- const store = new FsBlockstore(path.join(dataPath, "blockstore", key));
6221
+ const store = new FsBlockstore(path$1.join(dataPath, "blockstore", key));
6222
6222
  await store.open();
6223
6223
  return {
6224
6224
  blockstore: store,
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-BqxmCg5p.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-NUwjwbZz.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -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 n$4, Bn as CommentEditReservedFields, C as contentContainsMarkdownAudio, Ct as findStartedCommunity, F as getIpnsRecordInLocalKuboNode, Fr as ZodError, Ft as untrackStartedCommunity, G as isLinkOfAudio, Hn as CommentEditsTableRowSchema, Ht as CommunityEditPublicationPubsubReservedFields, J as isLinkOfVideo, Jt as CommentModerationReservedFields, K as isLinkOfImage, Kn as AuthorReservedFields, L as hideClassPrivateProps, Lt as untrackUpdatingCommunity, M as genToArray, Mn as CommentsTableRowSchema, Mt as trackStartedCommunity, N as getEquivalentCommunityAddresses, O as derivePublicationFromChallengeRequest, P as getErrorCodeFromMessage, Pt as trackUpdatingCommunity, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditPubsubMessagePublicationSchema, Rt as require_sha256, S as calculateStringSizeSameAsIpfsAddCidV0, Sn as CommentPubsubMessageReservedFields, Sr as logger_default, St as findCommunityInRegistry, T as contentContainsMarkdownVideos, Tt as findUpdatingCommunity, W as isLinkOfAnimatedImage, Xt as CommentModerationsTableRowSchema, Y as isLinkValid, _t as statMfsPathSafely, a as ChallengeRequestMessageSchema, an as CommunityIpfsSchema, ar as e$1, at as removeMfsFilesSafely, b as areEquivalentCommunityAddresses, br as PKCError, cr as t$4, d as DecryptedChallengeRequestSchema, dr as t$5, dt as retryKuboBlockPutPinAndProvidePubsubTopic, er as t$8, fr as t$3, gn as VotePubsubReservedFields, gt as sleepUntilTimeoutOrAbort, hn as VotePubsubMessagePublicationSchema, ir as e, it as removeBlocksFromKuboNode, jn as CommentUpdateTableRowSchema, jt as syncCommunityRegistryEntry, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, mr as require_retry, nr as t$7, on as CommunitySignedPropertyNames, pt as retryKuboIpfsAddAndProvide, q as isLinkOfMedia, qt as CommentModerationPubsubMessagePublicationSchema, r as ChallengeMessageSchema, rr as t$6, s as ChallengeVerificationMessageSchema, sr as r$1, st as removeNullUndefinedValues, t as ChallengeAnswerMessageSchema, tr as n$3, u as DecryptedChallengeRequestPublicationSchema, vn as VoteTablesRowSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, xt as writeKuboFilesWithTimeout, y as version_default, yt as timestamp, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-qhSDu1BU.js";
3
- import { $t as getPublicKeyFromPrivateKey, A as deriveDbPosts, At as verifyCommentIpfs, Bt as getAuthorNameFromWire, C as BackupAbortError, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Dt as verifyChallengeRequest, E as calculateInlineRepliesBudget, En as parseJsonWithPKCErrorIfFails, F as importSignerIntoKuboNode, Ft as verifyCommunityEdit, G as REPLY_REPLIES_SORT_TYPES, Gt as getCommunityPublicKeyFromWire, It as verifyVote, Jt as encode, K as TIMEFRAMES_TO_SECONDS, Lt as buildRuntimeAuthor, M as getDefaultCommunityDbConfig, Mt as verifyCommentPubsubMessage, Nt as verifyCommentUpdate, O as deleteOldCommunityInWindows, P as getThumbnailPropsOfLink, Pt as verifyCommunity, Qt as getPKCAddressFromPublicKeySync, R as moveCommunityDbToDeletedDirectory, Rt as cleanWireAuthor, S as encryptEd25519AesGcmPublicKeyBuffer, St as signCommunity, T as calculateExpectedSignatureSize, Tt as verifyChallengeAnswer, U as POSTS_SORT_TYPES, W as POST_REPLIES_SORT_TYPES, Wt as getCommunityNameFromWire, Xt as getIpfsKeyFromPrivateKey, Z as iterateOverPageCidsToFindAllCids, Zt as getPKCAddressFromPublicKey, _t as signComment, a as loadChallengeFileFromCommunityChallengeSettings, ar as t$11, b as decryptEd25519AesGcmPublicKeyBuffer, bt as signCommentUpdate, c as LRUCache, d as KeyvBetterSqlite3, dn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, dr as STORAGE_KEYS, en as createSchemaRowParser, er as crosspostChainDepthUpTo, fr as require_lodash_merge, ft as cleanUpBeforePublishing, g as SignerWithPublicKeyAddress, gt as signChallengeVerification, i as getCommunityChallengeFromCommunityChallengeSettings, ir as r$2, j as deriveDbReplies, jt as verifyCommentModeration, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommentEdit, lr as t$10, lt as pLimit, mt as signChallengeMessage, nr as t$9, o as pkcJsChallenges, or as n$6, pn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, qt as decode, r as getChallengeVerification, rr as t$12, s as TrackedInstanceRegistry, sr as n$5, t as RpcLocalCommunity, tr as effectiveMaxCrosspostDepth, u as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, ur as stringify, vt as signCommentEdit, w as backupCommunityDb, xt as signCommentUpdateForChallengeVerification, z as resolveDbPostsCidRefs } from "./rpc-local-community-o0teUvw_.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$4, Bn as CommentEditReservedFields, C as contentContainsMarkdownAudio, Ct as findStartedCommunity, F as getIpnsRecordInLocalKuboNode, Fr as ZodError, Ft as untrackStartedCommunity, G as isLinkOfAudio, Hn as CommentEditsTableRowSchema, Ht as CommunityEditPublicationPubsubReservedFields, J as isLinkOfVideo, Jt as CommentModerationReservedFields, K as isLinkOfImage, Kn as AuthorReservedFields, L as hideClassPrivateProps, Lt as untrackUpdatingCommunity, M as genToArray, Mn as CommentsTableRowSchema, Mt as trackStartedCommunity, N as getEquivalentCommunityAddresses, O as derivePublicationFromChallengeRequest, P as getErrorCodeFromMessage, Pt as trackUpdatingCommunity, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditPubsubMessagePublicationSchema, Rt as require_sha256, S as calculateStringSizeSameAsIpfsAddCidV0, Sn as CommentPubsubMessageReservedFields, Sr as logger_default, St as findCommunityInRegistry, T as contentContainsMarkdownVideos, Tt as findUpdatingCommunity, W as isLinkOfAnimatedImage, Xt as CommentModerationsTableRowSchema, Y as isLinkValid, _t as statMfsPathSafely, a as ChallengeRequestMessageSchema, an as CommunityIpfsSchema, ar as e$1, at as removeMfsFilesSafely, b as areEquivalentCommunityAddresses, br as PKCError, cr as t$4, d as DecryptedChallengeRequestSchema, dr as t$5, dt as retryKuboBlockPutPinAndProvidePubsubTopic, er as t$8, fr as t$3, gn as VotePubsubReservedFields, gt as sleepUntilTimeoutOrAbort, hn as VotePubsubMessagePublicationSchema, ir as e, it as removeBlocksFromKuboNode, jn as CommentUpdateTableRowSchema, jt as syncCommunityRegistryEntry, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, mr as require_retry, nr as t$7, on as CommunitySignedPropertyNames, pt as retryKuboIpfsAddAndProvide, q as isLinkOfMedia, qt as CommentModerationPubsubMessagePublicationSchema, r as ChallengeMessageSchema, rr as t$6, s as ChallengeVerificationMessageSchema, sr as r$1, st as removeNullUndefinedValues, t as ChallengeAnswerMessageSchema, tr as n$3, u as DecryptedChallengeRequestPublicationSchema, vn as VoteTablesRowSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, xt as writeKuboFilesWithTimeout, y as version_default, yt as timestamp, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-BT0023M6.js";
3
+ import { $t as getPublicKeyFromPrivateKey, A as deriveDbPosts, At as verifyCommentIpfs, Bt as getAuthorNameFromWire, C as BackupAbortError, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Dt as verifyChallengeRequest, E as calculateInlineRepliesBudget, En as parseJsonWithPKCErrorIfFails, F as importSignerIntoKuboNode, Ft as verifyCommunityEdit, G as REPLY_REPLIES_SORT_TYPES, Gt as getCommunityPublicKeyFromWire, It as verifyVote, Jt as encode, K as TIMEFRAMES_TO_SECONDS, Lt as buildRuntimeAuthor, M as getDefaultCommunityDbConfig, Mt as verifyCommentPubsubMessage, Nt as verifyCommentUpdate, O as deleteOldCommunityInWindows, P as getThumbnailPropsOfLink, Pt as verifyCommunity, Qt as getPKCAddressFromPublicKeySync, R as moveCommunityDbToDeletedDirectory, Rt as cleanWireAuthor, S as encryptEd25519AesGcmPublicKeyBuffer, St as signCommunity, T as calculateExpectedSignatureSize, Tt as verifyChallengeAnswer, U as POSTS_SORT_TYPES, W as POST_REPLIES_SORT_TYPES, Wt as getCommunityNameFromWire, Xt as getIpfsKeyFromPrivateKey, Z as iterateOverPageCidsToFindAllCids, Zt as getPKCAddressFromPublicKey, _t as signComment, a as loadChallengeFileFromCommunityChallengeSettings, ar as t$11, b as decryptEd25519AesGcmPublicKeyBuffer, bt as signCommentUpdate, c as LRUCache, d as KeyvBetterSqlite3, dn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, dr as STORAGE_KEYS, en as createSchemaRowParser, er as crosspostChainDepthUpTo, fr as require_lodash_merge, ft as cleanUpBeforePublishing, g as SignerWithPublicKeyAddress, gt as signChallengeVerification, i as getCommunityChallengeFromCommunityChallengeSettings, ir as r$2, j as deriveDbReplies, jt as verifyCommentModeration, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommentEdit, lr as t$10, lt as pLimit, mt as signChallengeMessage, nr as t$9, o as pkcJsChallenges, or as n$6, pn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, qt as decode, r as getChallengeVerification, rr as t$12, s as TrackedInstanceRegistry, sr as n$5, t as RpcLocalCommunity, tr as effectiveMaxCrosspostDepth, u as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, ur as stringify, vt as signCommentEdit, w as backupCommunityDb, xt as signCommentUpdateForChallengeVerification, z as resolveDbPostsCidRefs } from "./rpc-local-community-Cpw9_Nuo.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 from "path";
9
+ import path$1 from "path";
10
10
  import assert from "assert";
11
11
  import fs from "fs";
12
12
  import Database from "better-sqlite3";
@@ -3552,9 +3552,9 @@ var DbHandler = class {
3552
3552
  if (needToMigrate) {
3553
3553
  if (dbExistsAlready && currentDbVersion > 0) {
3554
3554
  this.destoryConnection();
3555
- backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3556
- log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
3557
- if (!fs.existsSync(path.dirname(backupDbPath))) await fs.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
3555
+ backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3556
+ log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
3557
+ if (!fs.existsSync(path$1.dirname(backupDbPath))) await fs.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
3558
3558
  const sourceDb = new Database(dbPath, { fileMustExist: true });
3559
3559
  await sourceDb.backup(backupDbPath);
3560
3560
  sourceDb.close();
@@ -5372,10 +5372,10 @@ var DbHandler = class {
5372
5372
  if (this._db || this._keyv) await this.destoryConnection();
5373
5373
  this._transactionDepth = 0;
5374
5374
  const dataPath = this._community._pkc.dataPath;
5375
- const oldPathString = path.join(dataPath, "communities", oldDbName);
5376
- const newPathString = path.join(dataPath, "communities", newDbName);
5377
- await fs.promises.mkdir(path.dirname(oldPathString), { recursive: true });
5378
- await fs.promises.mkdir(path.dirname(newPathString), { recursive: true });
5375
+ const oldPathString = path$1.join(dataPath, "communities", oldDbName);
5376
+ const newPathString = path$1.join(dataPath, "communities", newDbName);
5377
+ await fs.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
5378
+ await fs.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
5379
5379
  try {
5380
5380
  if (!fs.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
5381
5381
  else {
@@ -5397,8 +5397,8 @@ var DbHandler = class {
5397
5397
  }
5398
5398
  async lockCommunityStart(communityAddress = this._community.address) {
5399
5399
  const log = logger_default("pkc-js:local-community:db-handler:lock:start");
5400
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5401
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5400
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5401
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5402
5402
  try {
5403
5403
  await import_src.default.lock(communityDbPath, {
5404
5404
  lockfilePath,
@@ -5419,8 +5419,8 @@ var DbHandler = class {
5419
5419
  async unlockCommunityStart(communityAddress = this._community.address) {
5420
5420
  const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
5421
5421
  log.trace(`Attempting to unlock the start of community (${communityAddress})`);
5422
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5423
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5422
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5423
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5424
5424
  if (!fs.existsSync(lockfilePath) || !fs.existsSync(communityDbPath)) return;
5425
5425
  try {
5426
5426
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5431,8 +5431,8 @@ var DbHandler = class {
5431
5431
  }
5432
5432
  }
5433
5433
  async isCommunityStartLocked(communityAddress = this._community.address) {
5434
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5435
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5434
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5435
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5436
5436
  return await import_src.default.check(communityDbPath, {
5437
5437
  lockfilePath,
5438
5438
  realpath: false,
@@ -5441,8 +5441,8 @@ var DbHandler = class {
5441
5441
  }
5442
5442
  async lockCommunityState() {
5443
5443
  const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
5444
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5445
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5444
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5445
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5446
5446
  try {
5447
5447
  await import_src.default.lock(communityDbPath, {
5448
5448
  lockfilePath,
@@ -5459,8 +5459,8 @@ var DbHandler = class {
5459
5459
  }
5460
5460
  async unlockCommunityState() {
5461
5461
  const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
5462
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5463
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5462
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5463
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5464
5464
  if (!fs.existsSync(lockfilePath)) return;
5465
5465
  try {
5466
5466
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5470,7 +5470,7 @@ var DbHandler = class {
5470
5470
  }
5471
5471
  }
5472
5472
  communityDbExists() {
5473
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5473
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5474
5474
  return fs.existsSync(communityDbPath);
5475
5475
  }
5476
5476
  markCommentsAsPublishedToPostUpdates(commentCids) {
@@ -7223,11 +7223,11 @@ async function edit(community, newCommunityOptions) {
7223
7223
  const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
7224
7224
  function defaultExportPathFor(community, exportId) {
7225
7225
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
7226
- return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
7226
+ return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
7227
7227
  }
7228
7228
  function sourceDbPathFor(community) {
7229
7229
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
7230
- return Path.join(community._pkc.dataPath, "communities", community.address);
7230
+ return path.join(community._pkc.dataPath, "communities", community.address);
7231
7231
  }
7232
7232
  async function persistExports(community) {
7233
7233
  if (!community._dbHandler) return;
@@ -7303,9 +7303,9 @@ async function runExportTask(community, exportId, opts) {
7303
7303
  async function exportCommunityEmbedded(community, options = {}) {
7304
7304
  if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
7305
7305
  const exportId = v4();
7306
- const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
7306
+ const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
7307
7307
  const includePrivateKey = options.includePrivateKey === true;
7308
- if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
7308
+ if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
7309
7309
  communityAddress: community.address,
7310
7310
  exportPath: destPath
7311
7311
  });
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $n as n$2, B as isIpfsCid, Bt as pTimeout, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dt as listUpdatingComments, E as createAbortError, En as CommentUpdateForChallengeVerificationSchema, Et as listStartedCommunities, H as isIpns, Ir as joinValues, It as untrackUpdatingComment, L as hideClassPrivateProps, Lr as parsedType, Nt as trackUpdatingComment, Ot as listUpdatingCommunities, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rr as stringifyPrimitive, Rt as require_sha256, Sr as logger_default, Tr as setErrorMap, Tt as findUpdatingCommunity, a as ChallengeRequestMessageSchema, an as CommunityIpfsSchema, ar as e$1, b as areEquivalentCommunityAddresses, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, ct as removeUndefinedValuesRecursively, dn as PubsubTopicSchema, en as CommunityAnchorSchema, ft as retryKuboIpfsAdd, gt as sleepUntilTimeoutOrAbort, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, ir as e, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kt as refreshTrackedCommentAliases, lt as replaceXWithY, mr as require_retry, mt as shortifyAddress, nt as rejectWhenAbortSignalFires, r as ChallengeMessageSchema, rr as t$1, rt as rejectWhenCommunityStopsOrAborts, s as ChallengeVerificationMessageSchema, sr as r, t as ChallengeAnswerMessageSchema, tr as n$1, ut as resolveWhenPredicateIsTrue, vt as throwIfAbortSignalAborted, wt as findUpdatingComment, xn as CommentIpfsSchema, xr as messages, y as version_default, yt as timestamp, z as isAbortError, zt as TimeoutError } from "./schema-qhSDu1BU.js";
3
- import { $ as RepliesPages, $n as RpcUnsubscribeParamSchema, An as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, At as verifyCommentIpfs, B as setNativeFunctions$1, Bn as RpcEditCommunityParamSchema, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Ct as signCommunityEdit, D as createKuboRpcClient, Dn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, En as parseJsonWithPKCErrorIfFails, Et as verifyChallengeMessage, Fn as RpcCancelExportParamSchema, Ft as verifyCommunityEdit, Gn as RpcFetchCidParamSchema, Gt as getCommunityPublicKeyFromWire, H as CommentClientsManager, Hn as RpcExportCommunityModLogsResultSchema, Ht as buildRuntimeCommunityFields, I as listCommunitiesSync, In as RpcCidParamSchema, It as verifyVote, Jn as RpcPublishChallengeAnswersParamSchema, Kn as RpcFetchCidResultSchema, Kt as normalizeCommunityInputFromCommunity, L as monitorCommunitiesDirectory, Ln as RpcCommentRepliesPageParamSchema, Lt as buildRuntimeAuthor, Mn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Mt as verifyCommentPubsubMessage, N as getDefaultDataPath, Nn as RpcAnchorPublishPreparationResultSchema, Nt as verifyCommentUpdate, On as parseRpcCommentEventWithPKCErrorIfItFails, Ot as verifyChallengeVerification, Pn as RpcAuthorNameParamSchema, Q as parseRawPages, Qn as RpcSuccessResultSchema, Qt as getPKCAddressFromPublicKeySync, Rn as RpcCommunityIdentifierParamSchema, Rt as cleanWireAuthor, Sn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, Tn as parseDecryptedChallengeWithPKCErrorIfItFails, Un as RpcExportCommunityParamSchema, Ut as getCommunityAddressFromRecord, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcExportCommunityModLogsParamSchema, Vt as normalizeCreatePublicationAuthor, Wn as RpcExportCommunityResultSchema, Wt as getCommunityNameFromWire, X as findCommentInPageInstanceRecursively, Xn as RpcResolveAuthorNameResultSchema, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as RpcPublishedAnchorRecordResultSchema, Yt as getBufferedPKCAddressFromPublicKey, Zn as RpcSubscriptionIdResultSchema, _ as createSigner, _n as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, _t as signComment, an as parseCommentIpfsSchemaWithPKCErrorIfItFails, ar as t$3, at as PublicationClientsManager, bn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, c as LRUCache, cn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, cr as t$2, d as KeyvBetterSqlite3, dt as require_lib$1, et as applyNameResolvedCacheToCrosspost, f as decodeRpcChallengeAnswerPubsubMsg, fn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ft as cleanUpBeforePublishing, gn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeVerificationPubsubMsg, hn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ht as signChallengeRequest, in as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, it as stripNameResolvedFromCrosspost, jt as verifyCommentModeration, kn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, kt as verifyCommentEdit, l as RemoteCommunity, ln as parseCommunityAddressWithPKCErrorIfItFails, lr as t$5, m as decodeRpcChallengeRequestPubsubMsg, mn as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, mr as require_undici, n as RpcRemoteCommunity, nr as t$4, nt as collectCrosspostAuthorsToResolve, o as pkcJsChallenges, or as n$3, ot as PKCClientsManager, p as decodeRpcChallengePubsubMsg, pr as nativeFunctions$2, pt as signChallengeAnswer, qn as RpcPublishAnchorRecordParamSchema, qt as decode, s as TrackedInstanceRegistry, sn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as InflightFetchManager, t as RpcLocalCommunity, tn as parseCidStringSchemaWithPKCErrorIfItFails, tt as cloneCrosspostForRuntime, ut as PKCTypedEmitter, v as createAnchorIpnsRecord$1, vt as signCommentEdit, wn as parseDecryptedChallengeVerification, wt as signVote, x as encryptEd25519AesGcm, xn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as decryptEd25519AesGcm, yt as signCommentModeration, zn as RpcCommunityPageParamSchema, zt as getAuthorNameFromRuntime } from "./rpc-local-community-o0teUvw_.js";
4
- import { o as getHeliaDebugContext } from "./util-BVGNNIgn.js";
2
+ import { $n as n$2, B as isIpfsCid, Bt as pTimeout, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dt as listUpdatingComments, E as createAbortError, En as CommentUpdateForChallengeVerificationSchema, Et as listStartedCommunities, H as isIpns, Ir as joinValues, It as untrackUpdatingComment, L as hideClassPrivateProps, Lr as parsedType, Nt as trackUpdatingComment, Ot as listUpdatingCommunities, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rr as stringifyPrimitive, Rt as require_sha256, Sr as logger_default, Tr as setErrorMap, Tt as findUpdatingCommunity, a as ChallengeRequestMessageSchema, an as CommunityIpfsSchema, ar as e$1, b as areEquivalentCommunityAddresses, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, ct as removeUndefinedValuesRecursively, dn as PubsubTopicSchema, en as CommunityAnchorSchema, ft as retryKuboIpfsAdd, gt as sleepUntilTimeoutOrAbort, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, ir as e, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kt as refreshTrackedCommentAliases, lt as replaceXWithY, mr as require_retry, mt as shortifyAddress, nt as rejectWhenAbortSignalFires, r as ChallengeMessageSchema, rr as t$1, rt as rejectWhenCommunityStopsOrAborts, s as ChallengeVerificationMessageSchema, sr as r, t as ChallengeAnswerMessageSchema, tr as n$1, ut as resolveWhenPredicateIsTrue, vt as throwIfAbortSignalAborted, wt as findUpdatingComment, xn as CommentIpfsSchema, xr as messages, y as version_default, yt as timestamp, z as isAbortError, zt as TimeoutError } from "./schema-BT0023M6.js";
3
+ import { $ as RepliesPages, $n as RpcUnsubscribeParamSchema, An as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, At as verifyCommentIpfs, B as setNativeFunctions$1, Bn as RpcEditCommunityParamSchema, Cn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Ct as signCommunityEdit, D as createKuboRpcClient, Dn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, En as parseJsonWithPKCErrorIfFails, Et as verifyChallengeMessage, Fn as RpcCancelExportParamSchema, Ft as verifyCommunityEdit, Gn as RpcFetchCidParamSchema, Gt as getCommunityPublicKeyFromWire, H as CommentClientsManager, Hn as RpcExportCommunityModLogsResultSchema, Ht as buildRuntimeCommunityFields, I as listCommunitiesSync, In as RpcCidParamSchema, It as verifyVote, Jn as RpcPublishChallengeAnswersParamSchema, Kn as RpcFetchCidResultSchema, Kt as normalizeCommunityInputFromCommunity, L as monitorCommunitiesDirectory, Ln as RpcCommentRepliesPageParamSchema, Lt as buildRuntimeAuthor, Mn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Mt as verifyCommentPubsubMessage, N as getDefaultDataPath, Nn as RpcAnchorPublishPreparationResultSchema, Nt as verifyCommentUpdate, On as parseRpcCommentEventWithPKCErrorIfItFails, Ot as verifyChallengeVerification, Pn as RpcAuthorNameParamSchema, Q as parseRawPages, Qn as RpcSuccessResultSchema, Qt as getPKCAddressFromPublicKeySync, Rn as RpcCommunityIdentifierParamSchema, Rt as cleanWireAuthor, Sn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, Tn as parseDecryptedChallengeWithPKCErrorIfItFails, Un as RpcExportCommunityParamSchema, Ut as getCommunityAddressFromRecord, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcExportCommunityModLogsParamSchema, Vt as normalizeCreatePublicationAuthor, Wn as RpcExportCommunityResultSchema, Wt as getCommunityNameFromWire, X as findCommentInPageInstanceRecursively, Xn as RpcResolveAuthorNameResultSchema, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as RpcPublishedAnchorRecordResultSchema, Yt as getBufferedPKCAddressFromPublicKey, Zn as RpcSubscriptionIdResultSchema, _ as createSigner, _n as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, _t as signComment, an as parseCommentIpfsSchemaWithPKCErrorIfItFails, ar as t$3, at as PublicationClientsManager, bn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, c as LRUCache, cn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, cr as t$2, d as KeyvBetterSqlite3, dt as require_lib$1, et as applyNameResolvedCacheToCrosspost, f as decodeRpcChallengeAnswerPubsubMsg, fn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ft as cleanUpBeforePublishing, gn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeVerificationPubsubMsg, hn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ht as signChallengeRequest, in as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, it as stripNameResolvedFromCrosspost, jt as verifyCommentModeration, kn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, kt as verifyCommentEdit, l as RemoteCommunity, ln as parseCommunityAddressWithPKCErrorIfItFails, lr as t$5, m as decodeRpcChallengeRequestPubsubMsg, mn as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, mr as require_undici, n as RpcRemoteCommunity, nr as t$4, nt as collectCrosspostAuthorsToResolve, o as pkcJsChallenges, or as n$3, ot as PKCClientsManager, p as decodeRpcChallengePubsubMsg, pr as nativeFunctions$2, pt as signChallengeAnswer, qn as RpcPublishAnchorRecordParamSchema, qt as decode, s as TrackedInstanceRegistry, sn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as InflightFetchManager, t as RpcLocalCommunity, tn as parseCidStringSchemaWithPKCErrorIfItFails, tt as cloneCrosspostForRuntime, ut as PKCTypedEmitter, v as createAnchorIpnsRecord$1, vt as signCommentEdit, wn as parseDecryptedChallengeVerification, wt as signVote, x as encryptEd25519AesGcm, xn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as decryptEd25519AesGcm, yt as signCommentModeration, zn as RpcCommunityPageParamSchema, zt as getAuthorNameFromRuntime } from "./rpc-local-community-Cpw9_Nuo.js";
4
+ import { o as getHeliaDebugContext } from "./util-BmT_84kq.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -6948,7 +6948,7 @@ var PKC$1 = class extends PKCTypedEmitter {
6948
6948
  this.clients.libp2pJsClients = {};
6949
6949
  if (!this.libp2pJsClientsOptions) return;
6950
6950
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
6951
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-C5Oe_ZSx.js");
6951
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-yqf2rWMx.js");
6952
6952
  for (const clientOptions of this.libp2pJsClientsOptions) {
6953
6953
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
6954
6954
  ...clientOptions,
@@ -7227,7 +7227,7 @@ var PKC$1 = class extends PKCTypedEmitter {
7227
7227
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
7228
7228
  log.trace("Received community options to create a local community instance:", options);
7229
7229
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
7230
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-D4SjlAKS.js");
7230
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-BURzF_1m.js");
7231
7231
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
7232
7232
  const community = new LocalCommunity(this);
7233
7233
  if (isLocalCommunity) {
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $n as n$10, $t as ChallengeFileSchema, A as extractNetworkErrorDetails, An as CommentUpdateSignedPropertyNames, Ar as literal, At as refreshTrackedCommunityAliases, B as isIpfsCid, Bt as pTimeout, Cn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Cr as require_supports_color, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateForChallengeVerificationSignedPropertyNames, Dr as array, E as createAbortError, Er as _enum, Et as listStartedCommunities, Fn as ModQueuePageIpfsSchema, Ft as untrackStartedCommunity, Gn as AuthorCommentIpfsReservedFields, Gt as CreateCommunityEditPublicationOptionsWithRefinementSchema, H as isIpns, I as getPostUpdateTimestampRange, In as PageIpfsSchema, It as untrackUpdatingComment, Jn as CidPathSchema, Kt as CommentModerationChallengeRequestToEncryptSchema, L as hideClassPrivateProps, Ln as CommentEditChallengeRequestToEncryptSchema, Lt as untrackUpdatingCommunity, Mr as object, Mt as trackStartedCommunity, Nn as CreateCommentOptionsWithRefinementSchema, Nr as record, O as derivePublicationFromChallengeRequest, On as CommentUpdateReservedFields, Or as boolean, Ot as listUpdatingCommunities, Pn as GetPageParamSchema, Pr as string, Pt as trackUpdatingCommunity, Q as isStringDomain, Qn as CreateSignerSchema, Qt as ChallengeFileFactorySchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as require_sha256$1, Sr as logger_default, Tn as CommentUpdateChallengeReservedFieldNames, Tt as findUpdatingCommunity, U as isIpnsPath, Un as CreateCommentEditOptionsWithRefinementSchema, Ut as CommunityEditPublicationSignedPropertyNames, V as isIpfsPath, Vn as CommentEditSignedPropertyNames, Vt as CommunityEditPublicationChallengeRequestToEncryptSchema, Wn as AuthorAddressSchema, Wt as CommunityEditPubsubMessagePublicationSchema, X as isRequestPubsubPublicationOfPost, Xn as CommunityAddressSchema, Xt as CommentModerationsTableRowSchema, Yn as CidStringSchema, Yt as CommentModerationSignedPropertyNames, Z as isRequestPubsubPublicationOfReply, Zn as CommunityAuthorChallengeReservedFieldNames, Zt as CreateCommentModerationOptionsWithRefinementSchema, _ as PKCUserOptionBaseSchema, _n as VoteSignedPropertyNames, _r as FailedToFetchCommunityFromGatewaysError, an as CommunityIpfsSchema, ar as e$5, b as areEquivalentCommunityAddresses, bn as CommentIpfsReservedFields, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateRemoteCommunityFunctionArgumentSchema, cr as t$12, dr as t$10, f as DecryptedChallengeSchema, fn as RpcRemoteCommunityUpdateEventResultSchema, fr as t$9, g as PKCParsedOptionsSchema, gr as FailedToFetchCommentUpdateFromGatewaysError, gt as sleepUntilTimeoutOrAbort, h as NameResolverSerializedSchema, hn as VotePubsubMessagePublicationSchema, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, i as ChallengeMessageSignedPropertyNames, in as CommunityIpfsReservedFields, ir as e$6, j as fetchAndValidateIpnsRecordFromGateway, jr as number, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kr as custom, l as DecryptedChallengeAnswerSchema, ln as CreateRpcCommunityFunctionArgumentSchema, lr as n$8, m as NameResolveCacheOptionsSchema, mn as VoteChallengeRequestToEncryptSchema, mr as require_retry$1, mt as shortifyAddress, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityEditOptionsSchema, o as ChallengeRequestMessageSignedPropertyNames, on as CommunitySignedPropertyNames, or as t$11, ot as removeNullUndefinedEmptyObjectsValuesRecursively, p as DecryptedChallengeVerificationSchema, pn as CreateVoteUserOptionsWithRefinementSchema, pr as e$4, qn as ChallengeAnswersSchema, qt as CommentModerationPubsubMessagePublicationSchema, rn as CommunityExportRecordsSchema, rr as t$13, sn as CreateNewLocalCommunityUserOptionsSchema, sr as r$8, tn as CommunityChallengeSettingSchema, tr as n$9, tt as raceAgainstAbort, un as ExportCommunityModLogsOptionsSchema, ur as r$7, ut as resolveWhenPredicateIsTrue, v as PKCUserOptionsSchema, vr as FailedToFetchGenericIpfsFromGatewaysError, vt as throwIfAbortSignalAborted, wn as CommentSignedPropertyNames, wr as require_ms$1, wt as findUpdatingComment, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, yn as CommentChallengeRequestToEncryptSchema, yr as FailedToFetchPageIpfsFromGatewaysError, yt as timestamp, z as isAbortError, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-qhSDu1BU.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$10, $t as ChallengeFileSchema, A as extractNetworkErrorDetails, An as CommentUpdateSignedPropertyNames, Ar as literal, At as refreshTrackedCommunityAliases, B as isIpfsCid, Bt as pTimeout, Cn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Cr as require_supports_color, Ct as findStartedCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateForChallengeVerificationSignedPropertyNames, Dr as array, E as createAbortError, Er as _enum, Et as listStartedCommunities, Fn as ModQueuePageIpfsSchema, Ft as untrackStartedCommunity, Gn as AuthorCommentIpfsReservedFields, Gt as CreateCommunityEditPublicationOptionsWithRefinementSchema, H as isIpns, I as getPostUpdateTimestampRange, In as PageIpfsSchema, It as untrackUpdatingComment, Jn as CidPathSchema, Kt as CommentModerationChallengeRequestToEncryptSchema, L as hideClassPrivateProps, Ln as CommentEditChallengeRequestToEncryptSchema, Lt as untrackUpdatingCommunity, Mr as object, Mt as trackStartedCommunity, Nn as CreateCommentOptionsWithRefinementSchema, Nr as record, O as derivePublicationFromChallengeRequest, On as CommentUpdateReservedFields, Or as boolean, Ot as listUpdatingCommunities, Pn as GetPageParamSchema, Pr as string, Pt as trackUpdatingCommunity, Q as isStringDomain, Qn as CreateSignerSchema, Qt as ChallengeFileFactorySchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as require_sha256$1, Sr as logger_default, Tn as CommentUpdateChallengeReservedFieldNames, Tt as findUpdatingCommunity, U as isIpnsPath, Un as CreateCommentEditOptionsWithRefinementSchema, Ut as CommunityEditPublicationSignedPropertyNames, V as isIpfsPath, Vn as CommentEditSignedPropertyNames, Vt as CommunityEditPublicationChallengeRequestToEncryptSchema, Wn as AuthorAddressSchema, Wt as CommunityEditPubsubMessagePublicationSchema, X as isRequestPubsubPublicationOfPost, Xn as CommunityAddressSchema, Xt as CommentModerationsTableRowSchema, Yn as CidStringSchema, Yt as CommentModerationSignedPropertyNames, Z as isRequestPubsubPublicationOfReply, Zn as CommunityAuthorChallengeReservedFieldNames, Zt as CreateCommentModerationOptionsWithRefinementSchema, _ as PKCUserOptionBaseSchema, _n as VoteSignedPropertyNames, _r as FailedToFetchCommunityFromGatewaysError, an as CommunityIpfsSchema, ar as e$5, b as areEquivalentCommunityAddresses, bn as CommentIpfsReservedFields, br as PKCError, bt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateRemoteCommunityFunctionArgumentSchema, cr as t$12, dr as t$10, f as DecryptedChallengeSchema, fn as RpcRemoteCommunityUpdateEventResultSchema, fr as t$9, g as PKCParsedOptionsSchema, gr as FailedToFetchCommentUpdateFromGatewaysError, gt as sleepUntilTimeoutOrAbort, h as NameResolverSerializedSchema, hn as VotePubsubMessagePublicationSchema, hr as FailedToFetchCommentIpfsFromGatewaysError, ht as shortifyCid, i as ChallengeMessageSignedPropertyNames, in as CommunityIpfsReservedFields, ir as e$6, j as fetchAndValidateIpnsRecordFromGateway, jr as number, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateSchema, kr as custom, l as DecryptedChallengeAnswerSchema, ln as CreateRpcCommunityFunctionArgumentSchema, lr as n$8, m as NameResolveCacheOptionsSchema, mn as VoteChallengeRequestToEncryptSchema, mr as require_retry$1, mt as shortifyAddress, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityEditOptionsSchema, o as ChallengeRequestMessageSignedPropertyNames, on as CommunitySignedPropertyNames, or as t$11, ot as removeNullUndefinedEmptyObjectsValuesRecursively, p as DecryptedChallengeVerificationSchema, pn as CreateVoteUserOptionsWithRefinementSchema, pr as e$4, qn as ChallengeAnswersSchema, qt as CommentModerationPubsubMessagePublicationSchema, rn as CommunityExportRecordsSchema, rr as t$13, sn as CreateNewLocalCommunityUserOptionsSchema, sr as r$8, tn as CommunityChallengeSettingSchema, tr as n$9, tt as raceAgainstAbort, un as ExportCommunityModLogsOptionsSchema, ur as r$7, ut as resolveWhenPredicateIsTrue, v as PKCUserOptionsSchema, vr as FailedToFetchGenericIpfsFromGatewaysError, vt as throwIfAbortSignalAborted, wn as CommentSignedPropertyNames, wr as require_ms$1, wt as findUpdatingComment, x as calculateIpfsCidV0, xn as CommentIpfsSchema, xr as messages, yn as CommentChallengeRequestToEncryptSchema, yr as FailedToFetchPageIpfsFromGatewaysError, yt as timestamp, z as isAbortError, zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema } from "./schema-BT0023M6.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
4
  import { createHash } from "node:crypto";
5
5
  import { pathToFileURL } from "node:url";
@@ -125714,6 +125714,7 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
125714
125714
  this.raw = {};
125715
125715
  this._updatingCommunityInstanceWithListeners = void 0;
125716
125716
  this._numOfListenersForUpdatingInstance = 0;
125717
+ this._pendingWarmStartKeyMigration = void 0;
125717
125718
  this._pkc = pkc;
125718
125719
  this._setState("stopped");
125719
125720
  this._updatingState = "stopped";
@@ -126069,14 +126070,24 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
126069
126070
  return true;
126070
126071
  }
126071
126072
  _setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible() {
126072
- const log = logger_default("pkc-js:comment:_setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible");
126073
+ const log = logger_default("pkc-js:remote-community:_setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible");
126073
126074
  const updatingCommunity = findUpdatingCommunity(this._pkc, {
126074
126075
  publicKey: this.publicKey,
126075
126076
  name: this.name
126076
126077
  });
126077
126078
  if (updatingCommunity?.raw?.communityIpfs && (this.updatedAt || 0) < updatingCommunity.raw.communityIpfs.updatedAt) {
126079
+ if (this.publicKey && updatingCommunity.publicKey && this.publicKey !== updatingCommunity.publicKey) {
126080
+ this._pendingWarmStartKeyMigration = {
126081
+ previousPublicKey: this.publicKey,
126082
+ newPublicKey: updatingCommunity.publicKey
126083
+ };
126084
+ log.trace(`New Remote Community instance`, this.address, `skipped warm start from pkc._updatingCommunities[${this.address}]: tracked instance is keyed to`, updatingCommunity.publicKey, `while the caller requested`, this.publicKey, `- deferring key-migration announcement to update()`);
126085
+ return;
126086
+ }
126087
+ const nameResolvedBeforeAdoption = this.nameResolved;
126078
126088
  this.initCommunityIpfsPropsNoMerge(updatingCommunity.raw.communityIpfs);
126079
126089
  this.updateCid = updatingCommunity.updateCid;
126090
+ this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeAdoption);
126080
126091
  log.trace(`New Remote Community instance`, this.address, `will use CommunityIpfs from pkc._updatingCommunities[${this.address}] with updatedAt`, this.updatedAt, "that's", timestamp() - this.updatedAt, "seconds old");
126081
126092
  this.emit("update", this);
126082
126093
  }
@@ -126086,14 +126097,8 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
126086
126097
  if (typeof source.nameResolved === "boolean") this.nameResolved = source.nameResolved;
126087
126098
  } else this.nameResolved = nameResolvedBeforeMirror;
126088
126099
  }
126089
- async _initCommunityInstanceWithListeners() {
126090
- const trackedUpdatingCommunity = findUpdatingCommunity(this._pkc, {
126091
- publicKey: this.publicKey,
126092
- name: this.name
126093
- });
126094
- if (!trackedUpdatingCommunity) throw Error("should be defined at this stage");
126100
+ _initCommunityInstanceWithListeners(communityInstance) {
126095
126101
  const log = logger_default("pkc-js:remote-community:update");
126096
- const communityInstance = trackedUpdatingCommunity;
126097
126102
  return {
126098
126103
  community: communityInstance,
126099
126104
  update: () => {
@@ -126121,28 +126126,25 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
126121
126126
  }
126122
126127
  async fetchLatestCommunityOrSubscribeToEvent() {
126123
126128
  const log = logger_default("pkc-js:remote-community:update:updateOnce");
126124
- if (!findUpdatingCommunity(this._pkc, {
126129
+ let communityInstance = findUpdatingCommunity(this._pkc, {
126125
126130
  publicKey: this.publicKey,
126126
126131
  name: this.name
126127
- })) {
126132
+ });
126133
+ if (!communityInstance) {
126128
126134
  const createOpts = this.publicKey && isStringDomain(this.address) ? {
126129
126135
  name: this.address,
126130
126136
  publicKey: this.publicKey
126131
126137
  } : { address: this.address };
126132
126138
  const updatingCommunity = await this._pkc.createCommunity(createOpts);
126133
- trackUpdatingCommunity(this._pkc, updatingCommunity);
126139
+ communityInstance = trackUpdatingCommunity(this._pkc, updatingCommunity);
126134
126140
  log("Creating a new entry for this._pkc._updatingCommunities", this.address);
126135
126141
  }
126136
- const communityInstance = findUpdatingCommunity(this._pkc, {
126137
- publicKey: this.publicKey,
126138
- name: this.name
126139
- });
126140
- if (!communityInstance) throw Error("should be defined at this stage");
126141
126142
  if (communityInstance === this) {
126142
126143
  this._clientsManager.startUpdatingLoop().catch((err) => log.error("Failed to start update loop of community", err));
126143
- return;
126144
+ return false;
126144
126145
  }
126145
- this._updatingCommunityInstanceWithListeners = await this._initCommunityInstanceWithListeners();
126146
+ if (!this._pkc._updatingCommunities.has(communityInstance)) throw Error(`Updating community instance (${communityInstance.address}) was untracked before listeners could be attached`);
126147
+ this._updatingCommunityInstanceWithListeners = this._initCommunityInstanceWithListeners(communityInstance);
126146
126148
  this._updatingCommunityInstanceWithListeners.community.on("update", this._updatingCommunityInstanceWithListeners.update);
126147
126149
  this._updatingCommunityInstanceWithListeners.community.on("updatingstatechange", this._updatingCommunityInstanceWithListeners.updatingstatechange);
126148
126150
  this._updatingCommunityInstanceWithListeners.community.on("error", this._updatingCommunityInstanceWithListeners.error);
@@ -126154,13 +126156,34 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
126154
126156
  this._updatingCommunityInstanceWithListeners.community._setState("updating");
126155
126157
  this._updatingCommunityInstanceWithListeners.community._clientsManager.startUpdatingLoop().catch((err) => log.error("Failed to start update loop of community", err));
126156
126158
  }
126159
+ if (communityInstance.raw.communityIpfs && (this.updatedAt ?? 0) < communityInstance.raw.communityIpfs.updatedAt && this._updatingCommunityInstanceWithListeners) {
126160
+ this._updatingCommunityInstanceWithListeners.update(communityInstance);
126161
+ return true;
126162
+ }
126163
+ return false;
126164
+ }
126165
+ _announcePendingWarmStartKeyMigrationIfAny() {
126166
+ if (!this._pendingWarmStartKeyMigration) return;
126167
+ const { previousPublicKey, newPublicKey } = this._pendingWarmStartKeyMigration;
126168
+ this._pendingWarmStartKeyMigration = void 0;
126169
+ const error = new PKCError("ERR_COMMUNITY_NAME_RESOLVES_TO_DIFFERENT_PUBLIC_KEY", {
126170
+ communityName: this.name,
126171
+ previousPublicKey,
126172
+ newPublicKey
126173
+ });
126174
+ this._clearDataForKeyMigration(newPublicKey);
126175
+ if (this.name) this.nameResolved = true;
126176
+ this.emit("update", this);
126177
+ this.emit("error", error);
126157
126178
  }
126158
126179
  async update() {
126159
126180
  if (this.state !== "stopped") return;
126160
126181
  logger_default("pkc-js:remote-community:update");
126161
126182
  this._setState("updating");
126162
- await this.fetchLatestCommunityOrSubscribeToEvent();
126163
- if (this.raw.communityIpfs) this.emit("update", this);
126183
+ this._announcePendingWarmStartKeyMigrationIfAny();
126184
+ const hadRecordBeforeFetch = Boolean(this.raw.communityIpfs);
126185
+ const replayEmittedUpdate = await this.fetchLatestCommunityOrSubscribeToEvent();
126186
+ if (this.raw.communityIpfs && hadRecordBeforeFetch && !replayEmittedUpdate) this.emit("update", this);
126164
126187
  }
126165
126188
  async _cleanUpUpdatingCommunityInstanceWithListeners() {
126166
126189
  if (!this._updatingCommunityInstanceWithListeners) throw Error("should be defined at this stage");