@pkcprotocol/pkc-js 0.0.125 → 0.0.127

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 (117) hide show
  1. package/dist/browser/community/community-client-manager.js +30 -9
  2. package/dist/browser/community/community-client-manager.js.map +1 -1
  3. package/dist/browser/community/community-wire.d.ts +6 -0
  4. package/dist/browser/community/community-wire.js +22 -1
  5. package/dist/browser/community/community-wire.js.map +1 -1
  6. package/dist/browser/community/remote-community.d.ts +7 -1
  7. package/dist/browser/community/remote-community.js +87 -11
  8. package/dist/browser/community/remote-community.js.map +1 -1
  9. package/dist/browser/community/rpc-remote-community.d.ts +1 -0
  10. package/dist/browser/community/rpc-remote-community.js +41 -6
  11. package/dist/browser/community/rpc-remote-community.js.map +1 -1
  12. package/dist/browser/community/schema.js +7 -1
  13. package/dist/browser/community/schema.js.map +1 -1
  14. package/dist/browser/errors.d.ts +1 -0
  15. package/dist/browser/errors.js +1 -0
  16. package/dist/browser/errors.js.map +1 -1
  17. package/dist/browser/generated-version.d.ts +1 -1
  18. package/dist/browser/generated-version.js +1 -1
  19. package/dist/browser/pages/page-size.d.ts +2 -0
  20. package/dist/browser/pages/page-size.js +11 -0
  21. package/dist/browser/pages/page-size.js.map +1 -0
  22. package/dist/browser/pages/pages-client-manager.js +2 -1
  23. package/dist/browser/pages/pages-client-manager.js.map +1 -1
  24. package/dist/browser/pages/util.js +3 -2
  25. package/dist/browser/pages/util.js.map +1 -1
  26. package/dist/browser/pkc/tracked-instance-registry-util.d.ts +1 -0
  27. package/dist/browser/pkc/tracked-instance-registry-util.js +34 -2
  28. package/dist/browser/pkc/tracked-instance-registry-util.js.map +1 -1
  29. package/dist/browser/pkc/tracked-instance-registry.d.ts +1 -0
  30. package/dist/browser/pkc/tracked-instance-registry.js +15 -0
  31. package/dist/browser/pkc/tracked-instance-registry.js.map +1 -1
  32. package/dist/browser/pkc-error.d.ts +1 -1
  33. package/dist/browser/publications/comment/comment-client-manager.d.ts +1 -0
  34. package/dist/browser/publications/comment/comment-client-manager.js +24 -4
  35. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  36. package/dist/browser/publications/comment/comment.js +6 -2
  37. package/dist/browser/publications/comment/comment.js.map +1 -1
  38. package/dist/browser/publications/publication-client-manager.d.ts +4 -1
  39. package/dist/browser/publications/publication-client-manager.js +51 -7
  40. package/dist/browser/publications/publication-client-manager.js.map +1 -1
  41. package/dist/browser/publications/publication.js +15 -1
  42. package/dist/browser/publications/publication.js.map +1 -1
  43. package/dist/browser/runtime/node/community/local-community/comment-updates.js +2 -1
  44. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  45. package/dist/browser/runtime/node/community/page-generator.js +8 -7
  46. package/dist/browser/runtime/node/community/page-generator.js.map +1 -1
  47. package/dist/browser/test/test-util.d.ts +1 -0
  48. package/dist/browser/test/test-util.js +6 -2
  49. package/dist/browser/test/test-util.js.map +1 -1
  50. package/dist/browser/util.js +6 -1
  51. package/dist/browser/util.js.map +1 -1
  52. package/dist/bundled/bundle-manifest.json +37 -36
  53. package/dist/bundled/challenges.js +1 -1
  54. package/dist/bundled/chunks/{helia-for-pkc-DXygdFt-.js → helia-for-pkc-BsXEDYPa.js} +33 -33
  55. package/dist/bundled/chunks/{local-community-Bbqx5IaD.js → local-community-FekHR-fd.js} +1 -1
  56. package/dist/bundled/chunks/{local-community-D4I0gLqX.js → local-community-WFQoW5aC.js} +35 -36
  57. package/dist/bundled/chunks/{node-oqffR7Bn.js → node-pIjburtc.js} +69 -16
  58. package/dist/bundled/chunks/{page-sort-scoring-CK4vshII.js → page-sort-scoring-Civ7TOoF.js} +1 -1
  59. package/dist/bundled/chunks/{rpc-local-community-UpO9cs7k.js → rpc-local-community-BqP9g2Rk.js} +340 -242
  60. package/dist/bundled/chunks/{util-D3vx4Na0.js → util-D5Y6i3Nn.js} +1 -1
  61. package/dist/bundled/chunks/{util-nmnnrzbz.js → util-VrWyIc1x.js} +33 -6
  62. package/dist/bundled/chunks/{validate-package-factories-DkJmLpRe.js → validate-package-factories-CJgjDTZC.js} +2 -2
  63. package/dist/bundled/index.js +1 -1
  64. package/dist/bundled/page-sorts.js +1 -1
  65. package/dist/bundled/rpc/src/index.js +4 -4
  66. package/dist/node/community/community-client-manager.js +30 -9
  67. package/dist/node/community/community-client-manager.js.map +1 -1
  68. package/dist/node/community/community-wire.d.ts +6 -0
  69. package/dist/node/community/community-wire.js +22 -1
  70. package/dist/node/community/community-wire.js.map +1 -1
  71. package/dist/node/community/remote-community.d.ts +7 -1
  72. package/dist/node/community/remote-community.js +87 -11
  73. package/dist/node/community/remote-community.js.map +1 -1
  74. package/dist/node/community/rpc-remote-community.d.ts +1 -0
  75. package/dist/node/community/rpc-remote-community.js +41 -6
  76. package/dist/node/community/rpc-remote-community.js.map +1 -1
  77. package/dist/node/community/schema.js +7 -1
  78. package/dist/node/community/schema.js.map +1 -1
  79. package/dist/node/errors.d.ts +1 -0
  80. package/dist/node/errors.js +1 -0
  81. package/dist/node/errors.js.map +1 -1
  82. package/dist/node/generated-version.d.ts +1 -1
  83. package/dist/node/generated-version.js +1 -1
  84. package/dist/node/pages/page-size.d.ts +2 -0
  85. package/dist/node/pages/page-size.js +11 -0
  86. package/dist/node/pages/page-size.js.map +1 -0
  87. package/dist/node/pages/pages-client-manager.js +2 -1
  88. package/dist/node/pages/pages-client-manager.js.map +1 -1
  89. package/dist/node/pages/util.js +3 -2
  90. package/dist/node/pages/util.js.map +1 -1
  91. package/dist/node/pkc/tracked-instance-registry-util.d.ts +1 -0
  92. package/dist/node/pkc/tracked-instance-registry-util.js +34 -2
  93. package/dist/node/pkc/tracked-instance-registry-util.js.map +1 -1
  94. package/dist/node/pkc/tracked-instance-registry.d.ts +1 -0
  95. package/dist/node/pkc/tracked-instance-registry.js +15 -0
  96. package/dist/node/pkc/tracked-instance-registry.js.map +1 -1
  97. package/dist/node/pkc-error.d.ts +1 -1
  98. package/dist/node/publications/comment/comment-client-manager.d.ts +1 -0
  99. package/dist/node/publications/comment/comment-client-manager.js +24 -4
  100. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  101. package/dist/node/publications/comment/comment.js +6 -2
  102. package/dist/node/publications/comment/comment.js.map +1 -1
  103. package/dist/node/publications/publication-client-manager.d.ts +4 -1
  104. package/dist/node/publications/publication-client-manager.js +51 -7
  105. package/dist/node/publications/publication-client-manager.js.map +1 -1
  106. package/dist/node/publications/publication.js +15 -1
  107. package/dist/node/publications/publication.js.map +1 -1
  108. package/dist/node/runtime/node/community/local-community/comment-updates.js +2 -1
  109. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  110. package/dist/node/runtime/node/community/page-generator.js +8 -7
  111. package/dist/node/runtime/node/community/page-generator.js.map +1 -1
  112. package/dist/node/test/test-util.d.ts +1 -0
  113. package/dist/node/test/test-util.js +6 -2
  114. package/dist/node/test/test-util.js.map +1 -1
  115. package/dist/node/util.js +6 -1
  116. package/dist/node/util.js.map +1 -1
  117. 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 { C as hideClassPrivateProps, Ir as PKCError, Rr as logger_default, T as ipnsNameToIpnsOverPubsubTopic, n as binaryKeyToPubsubTopic } from "./util-nmnnrzbz.js";
3
- import { a as directFetchIpnsRecordFromProviders, c as readFreshCachedIpnsRecordFromPubsubLocalStore, i as connectToPubsubPeers, l as selectBitswapSessionSeedPeers, n as REACHABILITY_DOCS_URL, o as fetchBlockWithStalledSessionFailover, r as cacheIpnsRecordInPubsubLocalStore, s as getHeliaDebugContext, u as summarizeProviderReachability } from "./util-D3vx4Na0.js";
2
+ import { C as hideClassPrivateProps, Lr as PKCError, T as ipnsNameToIpnsOverPubsubTopic, n as binaryKeyToPubsubTopic, zr as logger_default } from "./util-VrWyIc1x.js";
3
+ import { a as directFetchIpnsRecordFromProviders, c as readFreshCachedIpnsRecordFromPubsubLocalStore, i as connectToPubsubPeers, l as selectBitswapSessionSeedPeers, n as REACHABILITY_DOCS_URL, o as fetchBlockWithStalledSessionFailover, r as cacheIpnsRecordInPubsubLocalStore, s as getHeliaDebugContext, u as summarizeProviderReachability } from "./util-D5Y6i3Nn.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";
@@ -151,7 +151,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
151
151
  Object.defineProperty(exports, "__esModule", { value: true });
152
152
  exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
153
153
  const os$1 = __require("os");
154
- const path$9 = __require("path");
154
+ const path$10 = __require("path");
155
155
  const IS_WINDOWS_PLATFORM = os$1.platform() === "win32";
156
156
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
157
157
  /**
@@ -180,7 +180,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
180
180
  }
181
181
  exports.unixify = unixify;
182
182
  function makeAbsolute(cwd, filepath) {
183
- return path$9.resolve(cwd, filepath);
183
+ return path$10.resolve(cwd, filepath);
184
184
  }
185
185
  exports.makeAbsolute = makeAbsolute;
186
186
  function removeLeadingDotSegment(entry) {
@@ -1432,7 +1432,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1432
1432
  //#endregion
1433
1433
  //#region node_modules/picomatch/lib/constants.js
1434
1434
  var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1435
- const path$8 = __require("path");
1435
+ const path$9 = __require("path");
1436
1436
  const WIN_SLASH = "\\\\/";
1437
1437
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1438
1438
  const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
@@ -1557,7 +1557,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1557
1557
  CHAR_UNDERSCORE: 95,
1558
1558
  CHAR_VERTICAL_LINE: 124,
1559
1559
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
1560
- SEP: path$8.sep,
1560
+ SEP: path$9.sep,
1561
1561
  /**
1562
1562
  * Create EXTGLOB_CHARS
1563
1563
  */
@@ -1601,7 +1601,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1601
1601
  //#endregion
1602
1602
  //#region node_modules/picomatch/lib/utils.js
1603
1603
  var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
1604
- const path$7 = __require("path");
1604
+ const path$8 = __require("path");
1605
1605
  const win32 = process.platform === "win32";
1606
1606
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
1607
1607
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -1621,7 +1621,7 @@ var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
1621
1621
  };
1622
1622
  exports.isWindows = (options) => {
1623
1623
  if (options && typeof options.windows === "boolean") return options.windows;
1624
- return win32 === true || path$7.sep === "\\";
1624
+ return win32 === true || path$8.sep === "\\";
1625
1625
  };
1626
1626
  exports.escapeLast = (input, char, lastIdx) => {
1627
1627
  const idx = input.lastIndexOf(char, lastIdx);
@@ -2991,7 +2991,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2991
2991
  //#endregion
2992
2992
  //#region node_modules/picomatch/lib/picomatch.js
2993
2993
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2994
- const path$6 = __require("path");
2994
+ const path$7 = __require("path");
2995
2995
  const scan = require_scan();
2996
2996
  const parse = require_parse();
2997
2997
  const utils = require_utils$2();
@@ -3130,7 +3130,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3130
3130
  * @api public
3131
3131
  */
3132
3132
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3133
- return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$6.basename(input));
3133
+ return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$7.basename(input));
3134
3134
  };
3135
3135
  /**
3136
3136
  * Returns true if **any** of the given glob `patterns` match the specified `string`.
@@ -3685,7 +3685,7 @@ var require_micromatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3685
3685
  var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
3686
3686
  Object.defineProperty(exports, "__esModule", { value: true });
3687
3687
  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;
3688
- const path$5 = __require("path");
3688
+ const path$6 = __require("path");
3689
3689
  const globParent = require_glob_parent();
3690
3690
  const micromatch = require_micromatch();
3691
3691
  const GLOBSTAR = "**";
@@ -3793,7 +3793,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
3793
3793
  }
3794
3794
  exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
3795
3795
  function isAffectDepthOfReadingPattern(pattern) {
3796
- const basename = path$5.basename(pattern);
3796
+ const basename = path$6.basename(pattern);
3797
3797
  return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
3798
3798
  }
3799
3799
  exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
@@ -3867,7 +3867,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
3867
3867
  }
3868
3868
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
3869
3869
  function isAbsolute(pattern) {
3870
- return path$5.isAbsolute(pattern);
3870
+ return path$6.isAbsolute(pattern);
3871
3871
  }
3872
3872
  exports.isAbsolute = isAbsolute;
3873
3873
  }));
@@ -4495,7 +4495,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
4495
4495
  //#region node_modules/@nodelib/fs.scandir/out/settings.js
4496
4496
  var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
4497
4497
  Object.defineProperty(exports, "__esModule", { value: true });
4498
- const path$4 = __require("path");
4498
+ const path$5 = __require("path");
4499
4499
  const fsStat = require_out$3();
4500
4500
  const fs = require_fs();
4501
4501
  var Settings = class {
@@ -4503,7 +4503,7 @@ var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
4503
4503
  this._options = _options;
4504
4504
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
4505
4505
  this.fs = fs.createFileSystemAdapter(this._options.fs);
4506
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
4506
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$5.sep);
4507
4507
  this.stats = this._getValue(this._options.stats, false);
4508
4508
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
4509
4509
  this.fsStatSettings = new fsStat.Settings({
@@ -5097,7 +5097,7 @@ var require_sync$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
5097
5097
  //#region node_modules/@nodelib/fs.walk/out/settings.js
5098
5098
  var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
5099
5099
  Object.defineProperty(exports, "__esModule", { value: true });
5100
- const path$3 = __require("path");
5100
+ const path$4 = __require("path");
5101
5101
  const fsScandir = require_out$2();
5102
5102
  var Settings = class {
5103
5103
  constructor(_options = {}) {
@@ -5107,7 +5107,7 @@ var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
5107
5107
  this.deepFilter = this._getValue(this._options.deepFilter, null);
5108
5108
  this.entryFilter = this._getValue(this._options.entryFilter, null);
5109
5109
  this.errorFilter = this._getValue(this._options.errorFilter, null);
5110
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
5110
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
5111
5111
  this.fsScandirSettings = new fsScandir.Settings({
5112
5112
  followSymbolicLinks: this._options.followSymbolicLinks,
5113
5113
  fs: this._options.fs,
@@ -5159,7 +5159,7 @@ var require_out$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
5159
5159
  //#region node_modules/fast-glob/out/readers/reader.js
5160
5160
  var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
5161
5161
  Object.defineProperty(exports, "__esModule", { value: true });
5162
- const path$2 = __require("path");
5162
+ const path$3 = __require("path");
5163
5163
  const fsStat = require_out$3();
5164
5164
  const utils = require_utils$1();
5165
5165
  var Reader = class {
@@ -5172,7 +5172,7 @@ var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
5172
5172
  });
5173
5173
  }
5174
5174
  _getFullEntryPath(filepath) {
5175
- return path$2.resolve(this._settings.cwd, filepath);
5175
+ return path$3.resolve(this._settings.cwd, filepath);
5176
5176
  }
5177
5177
  _makeEntry(stats, pattern) {
5178
5178
  const entry = {
@@ -5507,7 +5507,7 @@ var require_entry = /* @__PURE__ */ __commonJSMin(((exports) => {
5507
5507
  //#region node_modules/fast-glob/out/providers/provider.js
5508
5508
  var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
5509
5509
  Object.defineProperty(exports, "__esModule", { value: true });
5510
- const path$1 = __require("path");
5510
+ const path$2 = __require("path");
5511
5511
  const deep_1 = require_deep();
5512
5512
  const entry_1 = require_entry$1();
5513
5513
  const error_1 = require_error();
@@ -5521,7 +5521,7 @@ var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
5521
5521
  this.entryTransformer = new entry_2.default(this._settings);
5522
5522
  }
5523
5523
  _getRootDirectory(task) {
5524
- return path$1.resolve(this._settings.cwd, task.base);
5524
+ return path$2.resolve(this._settings.cwd, task.base);
5525
5525
  }
5526
5526
  _getReaderOptions(task) {
5527
5527
  const basePath = task.base === "." ? "" : task.base;
@@ -5852,7 +5852,7 @@ var import_out = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((export
5852
5852
  * Async iterable filename pattern matcher
5853
5853
  */
5854
5854
  async function* glob(dir, pattern, options = {}) {
5855
- const absoluteDir = Path.resolve(dir);
5855
+ const absoluteDir = path.resolve(dir);
5856
5856
  const stats = await fsp.stat(absoluteDir);
5857
5857
  for await (const entry of import_out.default.stream(pattern, {
5858
5858
  ...options,
@@ -6022,7 +6022,7 @@ var NextToLast = class {
6022
6022
  };
6023
6023
  }
6024
6024
  decode(str) {
6025
- let fileName = Path.basename(str);
6025
+ let fileName = path.basename(str);
6026
6026
  if (fileName.endsWith(this.extension)) fileName = fileName.substring(0, fileName.length - this.extension.length);
6027
6027
  return CID.decode(this.base.decoder.decode(fileName));
6028
6028
  }
@@ -6048,7 +6048,7 @@ var NextToLast = class {
6048
6048
  async function writeFile$1(file, contents, options) {
6049
6049
  try {
6050
6050
  options?.signal?.throwIfAborted();
6051
- await raceSignal(fsp.mkdir(Path.dirname(file), { recursive: true }), options?.signal);
6051
+ await raceSignal(fsp.mkdir(path.dirname(file), { recursive: true }), options?.signal);
6052
6052
  const writer = new Writer(file);
6053
6053
  options?.signal?.throwIfAborted();
6054
6054
  await writer.write(contents);
@@ -6073,7 +6073,7 @@ var FsBlockstore = class {
6073
6073
  deleteManyConcurrency;
6074
6074
  shardingStrategy;
6075
6075
  constructor(location, init = {}) {
6076
- this.path = Path.resolve(location);
6076
+ this.path = path.resolve(location);
6077
6077
  this.createIfMissing = init.createIfMissing ?? true;
6078
6078
  this.errorIfExists = init.errorIfExists ?? false;
6079
6079
  this.deleteManyConcurrency = init.deleteManyConcurrency ?? 50;
@@ -6099,7 +6099,7 @@ var FsBlockstore = class {
6099
6099
  async put(key, val, options) {
6100
6100
  const { dir, file } = this.shardingStrategy.encode(key);
6101
6101
  try {
6102
- await writeFile$1(Path.join(this.path, dir, file), val, options);
6102
+ await writeFile$1(path.join(this.path, dir, file), val, options);
6103
6103
  return key;
6104
6104
  } catch (err) {
6105
6105
  throw new PutFailedError(String(err));
@@ -6118,7 +6118,7 @@ var FsBlockstore = class {
6118
6118
  let handle;
6119
6119
  try {
6120
6120
  options?.signal?.throwIfAborted();
6121
- handle = await raceSignal(fsp.open(Path.join(this.path, dir, file)), options?.signal);
6121
+ handle = await raceSignal(fsp.open(path.join(this.path, dir, file)), options?.signal);
6122
6122
  yield* handle.createReadStream();
6123
6123
  } catch (err) {
6124
6124
  if (handle != null) await raceSignal(handle.close(), options?.signal);
@@ -6139,7 +6139,7 @@ var FsBlockstore = class {
6139
6139
  const { dir, file } = this.shardingStrategy.encode(key);
6140
6140
  try {
6141
6141
  options?.signal?.throwIfAborted();
6142
- await raceSignal(fsp.unlink(Path.join(this.path, dir, file)), options?.signal);
6142
+ await raceSignal(fsp.unlink(path.join(this.path, dir, file)), options?.signal);
6143
6143
  } catch (err) {
6144
6144
  if (err.code === "ENOENT") return;
6145
6145
  throw new DeleteFailedError(String(err));
@@ -6157,14 +6157,14 @@ var FsBlockstore = class {
6157
6157
  const { dir, file } = this.shardingStrategy.encode(key);
6158
6158
  try {
6159
6159
  options?.signal?.throwIfAborted();
6160
- await raceSignal(fsp.access(Path.join(this.path, dir, file)), options?.signal);
6160
+ await raceSignal(fsp.access(path.join(this.path, dir, file)), options?.signal);
6161
6161
  } catch (err) {
6162
6162
  return false;
6163
6163
  }
6164
6164
  return true;
6165
6165
  }
6166
6166
  async *getAll(options) {
6167
- const pattern = `**/*${this.shardingStrategy.extension}`.split(Path.sep).join("/");
6167
+ const pattern = `**/*${this.shardingStrategy.extension}`.split(path.sep).join("/");
6168
6168
  const files = glob(this.path, pattern, { absolute: true });
6169
6169
  for await (const file of files) try {
6170
6170
  options?.signal?.throwIfAborted();
@@ -6216,7 +6216,7 @@ async function createBlockstoreForLibp2pJsClient({ dataPath, key }) {
6216
6216
  defaultMaxBytes: DEFAULT_IN_MEMORY_BLOCKSTORE_MAX_BYTES,
6217
6217
  close: async () => {}
6218
6218
  };
6219
- const store = new FsBlockstore(path.join(dataPath, "blockstore", key));
6219
+ const store = new FsBlockstore(path$1.join(dataPath, "blockstore", key));
6220
6220
  await store.open();
6221
6221
  return {
6222
6222
  blockstore: store,
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-D4I0gLqX.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-WFQoW5aC.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -1,13 +1,13 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as retryKuboIpfsAddAndProvide, Ar as require_retry, Bn as CommentUpdateSchema, C as hideClassPrivateProps, Cn as isStringDomain, Cr as r$1, Ct as untrackStartedCommunity, Dn as VotePubsubReservedFields, Dr as t$4, En as VotePubsubMessagePublicationSchema, Et as require_sha256, F as isLinkOfVideo, Ft as ChallengeVerificationMessageSchema, G as removeMfsFilesSafely, Hn as CommentUpdateTableRowSchema, I as isLinkValid, Ir as PKCError, Lr as messages, M as isLinkOfAudio, Mn as CommentIpfsSchema, N as isLinkOfImage, Nn as CommentPubsubMessageReservedFields, Nt as ChallengeRequestMessageSchema, Or as t$2, Ot as pTimeout, P as isLinkOfMedia, Qn as CommentEditReservedFields, Rr as logger_default, Rt as DecryptedChallengeRequestPublicationSchema, St as trackUpdatingCommunity, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingCommunity, Un as CommentsTableRowSchema, W as removeBlocksFromKuboNode, Xn as CommentEditPubsubMessagePublicationSchema, Yt as CommunityEditPublicationPubsubReservedFields, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as genToArray, _r as n$2, ar as AuthorReservedFields, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as e$1, bt as trackStartedCommunity, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, ei as ZodError, en as CommentModerationPubsubMessagePublicationSchema, er as CommentEditsTableRowSchema, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsSchema, g as findMalformedUnicodeString, gr as t$7, hr as n$3, i as calculateStringSizeSameAsIpfsAddCidV0, j as isLinkOfAnimatedImage, jt as ChallengeMessageSchema, kn as VoteTablesRowSchema, kt as ChallengeAnswerMessageSchema, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, p as doesDomainAddressHaveCapitalLetter, pn as CommunitySignedPropertyNames, pt as findUpdatingCommunity, q as removeNullUndefinedValues, qt as version_default, r as calculateIpfsCidV0, rn as CommentModerationsTableRowSchema, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, t as areEquivalentCommunityAddresses, tn as CommentModerationReservedFields, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as t$5, wr as t$3, xr as e, y as getErrorCodeFromMessage, yr as t$6, yt as syncCommunityRegistryEntry, z as pubsubTopicToDhtKey, zt as DecryptedChallengeRequestSchema } from "./util-nmnnrzbz.js";
3
- import { $n as getCommunityPublicKeyFromWire, Ar as r$2, Bn as buildRuntimeAuthor, Cn as signCommunity, Cr as moveCommunityDbToDeletedDirectory, Ct as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Dn as verifyChallengeAnswer, Et as parseJsonWithPKCErrorIfFails, Fn as verifyCommentUpdate, Fr as t$9, Hr as require_lodash_merge, In as verifyCommunity, Ir as stringify, Jn as crosspostChainDepthUpTo, Ln as verifyCommunityEdit, Mn as verifyCommentIpfs, Mr as n$5, Nn as verifyCommentModeration, Nr as n$4, Or as t$10, Pn as verifyCommentPubsubMessage, Q as createSchemaRowParser, Qn as getCommunityNameFromWire, S as KeyvBetterSqlite3, Sn as signCommentUpdateForChallengeVerification, Tr as resolveDbPostsCidRefs, U as pLimit, Un as getAuthorNameFromWire, Vn as cleanWireAuthor, Vr as STORAGE_KEYS, X as coerceSchemaRowJson, Y as coerceSchemaRowBoolean, Yn as effectiveMaxCrosspostDepth, Z as collectSchemaRowCoercions, _ as createAuthorIdentityMatcher, _n as signChallengeVerification, _r as getDefaultCommunityDbConfig, a as generatePagesReportingFailedSorts, an as SignerWithPublicKeyAddress, ar as getPKCAddressFromPublicKey, br as importSignerIntoKuboNode, c as resolvePageSortsOrThrow, cr as BackupAbortError, d as getChallengeVerification, dn as encryptEd25519AesGcmPublicKeyBuffer, dr as calculateInlineRepliesBudget, f as getCommunityChallengeFromCommunityChallengeSettings, fn as _validateSignatureOfPKCRecord, ft as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, g as authorNameResolveFailureReason, gr as deriveDbReplies, h as authorIdentityMatcherForRequest, hn as signChallengeMessage, hr as deriveDbPosts, i as derivePublicPageSorts, ir as getIpfsKeyFromPrivateKey, j as iterateOverPageCidsToFindAllCids, jn as verifyCommentEdit, jr as t$8, kn as verifyChallengeRequest, kr as t$11, ln as decryptEd25519AesGcmPublicKeyBuffer, lr as backupCommunityDb, m as pkcJsChallenges, mr as deriveCommentIpfsFromCommentTableRow, nr as encode, o as loadPageSortsForStartedCommunity, or as getPKCAddressFromPublicKeySync, p as loadChallengeFileFromCommunityChallengeSettings, pn as cleanUpBeforePublishing, pr as deleteOldCommunityInWindows, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getPublicKeyFromPrivateKey, t as RpcLocalCommunity, tr as decode, u as deriveCommunityChallengesOrThrow, ur as calculateExpectedSignatureSize, ut as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, v as TrackedInstanceRegistry, vn as signComment, w as TIMEFRAMES_TO_SECONDS, wr as refreshCommunitiesList, x as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, xn as signCommentUpdate, y as LRUCache, yn as signCommentEdit, yr as getThumbnailPropsOfLink, zn as verifyVote } from "./rpc-local-community-UpO9cs7k.js";
4
- import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-CK4vshII.js";
2
+ import { $ as retryKuboIpfsAddAndProvide, $n as CommentEditReservedFields, An as VoteTablesRowSchema, At as ChallengeAnswerMessageSchema, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dn as VotePubsubMessagePublicationSchema, Dt as require_sha256, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeMfsFilesSafely, I as isLinkValid, It as ChallengeVerificationMessageSchema, Jt as version_default, Lr as PKCError, M as isLinkOfAudio, Mt as ChallengeMessageSchema, N as isLinkOfImage, Nn as CommentIpfsSchema, On as VotePubsubReservedFields, Or as t$4, P as isLinkOfMedia, Pn as CommentPubsubMessageReservedFields, Pt as ChallengeRequestMessageSchema, Qn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tr as t$3, Un as CommentUpdateTableRowSchema, Vn as CommentUpdateSchema, W as removeBlocksFromKuboNode, Wn as CommentsTableRowSchema, Xt as CommunityEditPublicationPubsubReservedFields, Z as retryKuboBlockPutPinAndProvidePubsubTopic, Zn as CommentEditPubsubMessagePublicationSchema, _ as genToArray, _r as t$7, at as timestamp, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeysDeep, dt as findStartedCommunity, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, j as isLinkOfAnimatedImage, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as writeKuboFilesWithTimeout, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, nt as sleepUntilTimeoutOrAbort, o as calculateUnixFsDagSizeCidV0, or as AuthorReservedFields, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, q as removeNullUndefinedValues, r as calculateIpfsCidV0, rt as statMfsPathSafely, s as contentContainsMarkdownAudio, st as withSortedKeys, t as areEquivalentCommunityAddresses, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, tr as CommentEditsTableRowSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wn as isStringDomain, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, z as pubsubTopicToDhtKey, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-VrWyIc1x.js";
3
+ import { $ as createSchemaRowParser, Ar as t$10, Cn as signCommentUpdate, Dr as resolveDbPostsCidRefs, Dt as parseJsonWithPKCErrorIfFails, Er as refreshCommunitiesList, Fn as verifyCommentModeration, Fr as n$4, Gn as getAuthorNameFromWire, Hn as buildRuntimeAuthor, In as verifyCommentPubsubMessage, Ln as verifyCommentUpdate, Lr as t$9, Mr as r$2, N as MAX_PAGE_SIZE_BYTES, Nn as verifyCommentEdit, Nr as t$8, Pn as verifyCommentIpfs, Pr as n$5, Q as collectSchemaRowCoercions, Rn as verifyCommunity, Rr as stringify, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sr as importSignerIntoKuboNode, Tn as signCommunity, Tr as moveCommunityDbToDeletedDirectory, Un as cleanWireAuthor, Ur as STORAGE_KEYS, Vn as verifyVote, W as pLimit, Wr as require_lodash_merge, X as coerceSchemaRowBoolean, Xn as crosspostChainDepthUpTo, Z as coerceSchemaRowJson, Zn as effectiveMaxCrosspostDepth, _ as createAuthorIdentityMatcher, _n as signChallengeMessage, _r as deriveDbPosts, a as generatePagesReportingFailedSorts, b as KeyvBetterSqlite3, bn as signComment, c as resolvePageSortsOrThrow, cr as getPKCAddressFromPublicKeySync, d as getChallengeVerification, dn as decryptEd25519AesGcmPublicKeyBuffer, dr as backupCommunityDb, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, er as getCommunityNameFromWire, f as getCommunityChallengeFromCommunityChallengeSettings, fr as calculateExpectedSignatureSize, g as authorNameResolveFailureReason, gr as deriveCommentIpfsFromCommentTableRow, h as authorIdentityMatcherForRequest, hn as cleanUpBeforePublishing, hr as deleteOldCommunityInWindows, i as derivePublicPageSorts, ir as encode, j as iterateOverPageCidsToFindAllCids, jn as verifyChallengeRequest, jr as t$11, kn as verifyChallengeAnswer, lr as getPublicKeyFromPrivateKey, m as pkcJsChallenges, mn as _validateSignatureOfPKCRecord, o as loadPageSortsForStartedCommunity, or as getIpfsKeyFromPrivateKey, p as loadChallengeFileFromCommunityChallengeSettings, pn as encryptEd25519AesGcmPublicKeyBuffer, pr as calculateInlineRepliesBudget, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, r as computePageSortsFingerprint, rr as decode, s as lookupPageSortFactories, sn as SignerWithPublicKeyAddress, sr as getPKCAddressFromPublicKey, t as RpcLocalCommunity, tr as getCommunityPublicKeyFromWire, u as deriveCommunityChallengesOrThrow, ur as BackupAbortError, v as TrackedInstanceRegistry, vr as deriveDbReplies, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdateForChallengeVerification, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signCommentEdit, xr as getThumbnailPropsOfLink, y as LRUCache, yn as signChallengeVerification, yr as getDefaultCommunityDbConfig, zn as verifyCommunityEdit } from "./rpc-local-community-BqP9g2Rk.js";
4
+ import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-Civ7TOoF.js";
5
5
  import { randomFillSync, randomUUID } from "node:crypto";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
- import Path from "node:path";
7
+ import path from "node:path";
8
8
  import os from "os";
9
9
  import { existsSync, promises } from "node:fs";
10
- import path from "path";
10
+ import path$1 from "path";
11
11
  import assert from "assert";
12
12
  import { Buffer as Buffer$1 } from "buffer";
13
13
  import fs from "fs";
@@ -1692,15 +1692,15 @@ async function throwIfChallengeSettingsAreInvalid({ challengeSettings, pkc, comm
1692
1692
  const processStartedCommunities = new TrackedInstanceRegistry();
1693
1693
  function normalizeRegistryDataPath(dataPath) {
1694
1694
  if (dataPath === void 0) return void 0;
1695
- const resolved = path.resolve(dataPath);
1695
+ const resolved = path$1.resolve(dataPath);
1696
1696
  let existing = resolved;
1697
1697
  let tail = "";
1698
1698
  while (true) try {
1699
- return path.join(fs.realpathSync.native(existing), tail);
1699
+ return path$1.join(fs.realpathSync.native(existing), tail);
1700
1700
  } catch {
1701
- const parent = path.dirname(existing);
1701
+ const parent = path$1.dirname(existing);
1702
1702
  if (parent === existing) return resolved;
1703
- tail = path.join(path.basename(existing), tail);
1703
+ tail = path$1.join(path$1.basename(existing), tail);
1704
1704
  existing = parent;
1705
1705
  }
1706
1706
  }
@@ -1872,7 +1872,6 @@ var PageGenerator = class {
1872
1872
  const ipfsClient = this._community._clientsManager.getDefaultKuboRpcClient();
1873
1873
  const listOfPage = new Array(chunks.length);
1874
1874
  const cids = new Array(chunks.length);
1875
- let expectedSize = MB * Math.pow(2, chunks.length - 1);
1876
1875
  for (let i = chunks.length - 1; i >= 0; i--) {
1877
1876
  const modQueuePageIpfs = {
1878
1877
  nextCid: cids[i + 1],
@@ -1887,6 +1886,7 @@ var PageGenerator = class {
1887
1886
  provideOptions: { recursive: true },
1888
1887
  provideInBackground: true
1889
1888
  });
1889
+ const expectedSize = Math.min(MB * Math.pow(2, i), MAX_PAGE_SIZE_BYTES);
1890
1890
  if (addRes.size > expectedSize) throw new PKCError("ERR_PAGE_GENERATED_IS_OVER_EXPECTED_SIZE", {
1891
1891
  addRes,
1892
1892
  pageIpfs: modQueuePageIpfs,
@@ -1896,7 +1896,6 @@ var PageGenerator = class {
1896
1896
  });
1897
1897
  cids[i] = addRes.path;
1898
1898
  listOfPage[i] = modQueuePageIpfs;
1899
- expectedSize = expectedSize / 2;
1900
1899
  }
1901
1900
  return {
1902
1901
  pages: listOfPage,
@@ -1908,7 +1907,7 @@ var PageGenerator = class {
1908
1907
  const cids = new Array(chunks.length);
1909
1908
  for (let pageNum = chunks.length - 1; pageNum >= (embedFirst ? 1 : 0); pageNum--) {
1910
1909
  const nextCid = cids[pageNum + 1];
1911
- const maximumPageSize = MB * Math.pow(2, embedFirst ? Math.max(pageNum - 1, 0) : pageNum);
1910
+ const maximumPageSize = Math.min(MB * Math.pow(2, embedFirst ? Math.max(pageNum - 1, 0) : pageNum), MAX_PAGE_SIZE_BYTES);
1912
1911
  const entries = chunks[pageNum];
1913
1912
  const entrySizes = entries.map(serialized.sizeOf);
1914
1913
  const calculatedSize = pageDagSize(entrySizes, nextCid !== void 0);
@@ -1972,7 +1971,7 @@ var PageGenerator = class {
1972
1971
  let currentChunk = [];
1973
1972
  let chunkIndex = 0;
1974
1973
  let accumulatedSize = OBJECT_WRAPPER_WITH_CID;
1975
- const getCurrentMaxSize = (index) => index === 0 ? FIRST_PAGE_SIZE : MB * Math.pow(2, index - 1);
1974
+ const getCurrentMaxSize = (index) => index === 0 ? FIRST_PAGE_SIZE : Math.min(MB * Math.pow(2, index - 1), MAX_PAGE_SIZE_BYTES);
1976
1975
  for (let i = 0; i < comments.length; i++) {
1977
1976
  const commentSize = calculateUnixFsDagSizeCidV0(entryBytes[i]);
1978
1977
  const maxSize = getCurrentMaxSize(chunkIndex);
@@ -3081,9 +3080,9 @@ var DbHandler = class {
3081
3080
  if (needToMigrate) {
3082
3081
  if (dbExistsAlready && currentDbVersion > 0) {
3083
3082
  this.destoryConnection();
3084
- backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3085
- log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
3086
- if (!fs.existsSync(path.dirname(backupDbPath))) await fs.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
3083
+ backupDbPath = path$1.join(path$1.dirname(dbPath), ".backup_before_migration", `${path$1.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
3084
+ log(`Copying db ${path$1.basename(dbPath)} to ${backupDbPath} before migration`);
3085
+ if (!fs.existsSync(path$1.dirname(backupDbPath))) await fs.promises.mkdir(path$1.dirname(backupDbPath), { recursive: true });
3087
3086
  const sourceDb = new Database(dbPath, { fileMustExist: true });
3088
3087
  await sourceDb.backup(backupDbPath);
3089
3088
  sourceDb.close();
@@ -5182,10 +5181,10 @@ var DbHandler = class {
5182
5181
  if (this._db || this._keyv) await this.destoryConnection();
5183
5182
  this._transactionDepth = 0;
5184
5183
  const dataPath = this._community._pkc.dataPath;
5185
- const oldPathString = path.join(dataPath, "communities", oldDbName);
5186
- const newPathString = path.join(dataPath, "communities", newDbName);
5187
- await fs.promises.mkdir(path.dirname(oldPathString), { recursive: true });
5188
- await fs.promises.mkdir(path.dirname(newPathString), { recursive: true });
5184
+ const oldPathString = path$1.join(dataPath, "communities", oldDbName);
5185
+ const newPathString = path$1.join(dataPath, "communities", newDbName);
5186
+ await fs.promises.mkdir(path$1.dirname(oldPathString), { recursive: true });
5187
+ await fs.promises.mkdir(path$1.dirname(newPathString), { recursive: true });
5189
5188
  try {
5190
5189
  if (!fs.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
5191
5190
  else {
@@ -5207,8 +5206,8 @@ var DbHandler = class {
5207
5206
  }
5208
5207
  async lockCommunityStart(communityAddress = this._community.address) {
5209
5208
  const log = logger_default("pkc-js:local-community:db-handler:lock:start");
5210
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5211
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5209
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5210
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5212
5211
  try {
5213
5212
  await import_src.default.lock(communityDbPath, {
5214
5213
  lockfilePath,
@@ -5229,8 +5228,8 @@ var DbHandler = class {
5229
5228
  async unlockCommunityStart(communityAddress = this._community.address) {
5230
5229
  const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
5231
5230
  log.trace(`Attempting to unlock the start of community (${communityAddress})`);
5232
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5233
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5231
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5232
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5234
5233
  if (!fs.existsSync(lockfilePath) || !fs.existsSync(communityDbPath)) return;
5235
5234
  try {
5236
5235
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5241,8 +5240,8 @@ var DbHandler = class {
5241
5240
  }
5242
5241
  }
5243
5242
  async isCommunityStartLocked(communityAddress = this._community.address) {
5244
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5245
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
5243
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
5244
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", communityAddress);
5246
5245
  return await import_src.default.check(communityDbPath, {
5247
5246
  lockfilePath,
5248
5247
  realpath: false,
@@ -5251,8 +5250,8 @@ var DbHandler = class {
5251
5250
  }
5252
5251
  async lockCommunityState() {
5253
5252
  const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
5254
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5255
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5253
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5254
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5256
5255
  try {
5257
5256
  await import_src.default.lock(communityDbPath, {
5258
5257
  lockfilePath,
@@ -5269,8 +5268,8 @@ var DbHandler = class {
5269
5268
  }
5270
5269
  async unlockCommunityState() {
5271
5270
  const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
5272
- const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5273
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5271
+ const lockfilePath = path$1.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
5272
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5274
5273
  if (!fs.existsSync(lockfilePath)) return;
5275
5274
  try {
5276
5275
  await import_src.default.unlock(communityDbPath, { lockfilePath });
@@ -5280,7 +5279,7 @@ var DbHandler = class {
5280
5279
  }
5281
5280
  }
5282
5281
  communityDbExists() {
5283
- const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
5282
+ const communityDbPath = path$1.join(this._community._pkc.dataPath, "communities", this._community.address);
5284
5283
  return fs.existsSync(communityDbPath);
5285
5284
  }
5286
5285
  markCommentsAsPublishedToPostUpdates(commentCids) {
@@ -5478,9 +5477,9 @@ async function calculateNewCommentUpdate(opts) {
5478
5477
  comment,
5479
5478
  authorDomain: getAuthorNameFromWire(comment.author)
5480
5479
  });
5481
- log.trace("Calculated comment update for comment", comment.cid, "on community", community.address, "with reply count", calculatedCommentUpdate.replyCount);
5482
5480
  const currentTimestamp = timestamp();
5483
5481
  const newUpdatedAt = typeof storedCommentUpdate?.updatedAt === "number" && storedCommentUpdate.updatedAt >= currentTimestamp ? storedCommentUpdate.updatedAt + 1 : currentTimestamp;
5482
+ log.trace("Calculated comment update for comment", comment.cid, "on community", community.address, "with reply count", calculatedCommentUpdate.replyCount, "stored updatedAt", storedCommentUpdate?.updatedAt, "current timestamp", currentTimestamp, "new updatedAt", newUpdatedAt);
5484
5483
  const commentUpdatePriorToSigning = { ...cleanUpBeforePublishing({
5485
5484
  ...calculatedCommentUpdate,
5486
5485
  updatedAt: newUpdatedAt,
@@ -8361,11 +8360,11 @@ async function edit(community, newCommunityOptions) {
8361
8360
  const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
8362
8361
  function defaultExportPathFor(community, exportId) {
8363
8362
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
8364
- return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
8363
+ return path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
8365
8364
  }
8366
8365
  function sourceDbPathFor(community) {
8367
8366
  if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
8368
- return Path.join(community._pkc.dataPath, "communities", community.address);
8367
+ return path.join(community._pkc.dataPath, "communities", community.address);
8369
8368
  }
8370
8369
  async function persistExports(community) {
8371
8370
  if (!community._dbHandler) return;
@@ -8441,9 +8440,9 @@ async function runExportTask(community, exportId, opts) {
8441
8440
  async function exportCommunityEmbedded(community, options = {}) {
8442
8441
  if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
8443
8442
  const exportId = v4();
8444
- const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
8443
+ const destPath = options.exportPath ? path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
8445
8444
  const includePrivateKey = options.includePrivateKey === true;
8446
- if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
8445
+ if (path.resolve(destPath) === path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
8447
8446
  communityAddress: community.address,
8448
8447
  exportPath: destPath
8449
8448
  });