@pkcprotocol/pkc-js 0.0.80 → 0.0.82

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 (173) hide show
  1. package/README.md +3 -1
  2. package/dist/browser/clients/base-client-manager.js +19 -1
  3. package/dist/browser/clients/base-client-manager.js.map +1 -1
  4. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -0
  5. package/dist/browser/clients/rpc-client/schema.d.ts +3 -0
  6. package/dist/browser/community/schema.d.ts +24 -0
  7. package/dist/browser/community/schema.js +6 -1
  8. package/dist/browser/community/schema.js.map +1 -1
  9. package/dist/browser/errors.d.ts +10 -1
  10. package/dist/browser/errors.js +10 -1
  11. package/dist/browser/errors.js.map +1 -1
  12. package/dist/browser/generated-version.d.ts +1 -1
  13. package/dist/browser/generated-version.js +1 -1
  14. package/dist/browser/pages/pages.js +8 -0
  15. package/dist/browser/pages/pages.js.map +1 -1
  16. package/dist/browser/pages/schema.d.ts +4 -0
  17. package/dist/browser/pages/util.d.ts +2 -0
  18. package/dist/browser/pages/util.js +23 -3
  19. package/dist/browser/pages/util.js.map +1 -1
  20. package/dist/browser/pkc/pkc.d.ts +3 -2
  21. package/dist/browser/pkc/pkc.js +37 -24
  22. package/dist/browser/pkc/pkc.js.map +1 -1
  23. package/dist/browser/pkc-error.d.ts +1 -1
  24. package/dist/browser/publications/comment/comment-client-manager.js +22 -4
  25. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  26. package/dist/browser/publications/comment/comment.d.ts +2 -1
  27. package/dist/browser/publications/comment/comment.js +29 -6
  28. package/dist/browser/publications/comment/comment.js.map +1 -1
  29. package/dist/browser/publications/comment/crosspost-depth.d.ts +5 -0
  30. package/dist/browser/publications/comment/crosspost-depth.js +75 -0
  31. package/dist/browser/publications/comment/crosspost-depth.js.map +1 -0
  32. package/dist/browser/publications/comment/crosspost-runtime.d.ts +30 -0
  33. package/dist/browser/publications/comment/crosspost-runtime.js +133 -0
  34. package/dist/browser/publications/comment/crosspost-runtime.js.map +1 -0
  35. package/dist/browser/publications/comment/schema.d.ts +20 -2
  36. package/dist/browser/publications/comment/schema.js +21 -10
  37. package/dist/browser/publications/comment/schema.js.map +1 -1
  38. package/dist/browser/publications/comment/types.d.ts +10 -0
  39. package/dist/browser/publications/community-edit/schema.d.ts +4 -0
  40. package/dist/browser/publications/publication.d.ts +4 -0
  41. package/dist/browser/publications/publication.js +80 -5
  42. package/dist/browser/publications/publication.js.map +1 -1
  43. package/dist/browser/pubsub-messages/schema.d.ts +5 -0
  44. package/dist/browser/rpc/src/index.js +14 -2
  45. package/dist/browser/rpc/src/index.js.map +1 -1
  46. package/dist/browser/runtime/browser/setup-kubo-http-routers.d.ts +1 -0
  47. package/dist/browser/runtime/browser/setup-kubo-http-routers.js +4 -0
  48. package/dist/browser/runtime/browser/setup-kubo-http-routers.js.map +1 -0
  49. package/dist/browser/runtime/node/community/db-handler.js +3 -2
  50. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  51. package/dist/browser/runtime/node/community/local-community/publication-validation.js +15 -0
  52. package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
  53. package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.d.ts +3 -2
  54. package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js +19 -10
  55. package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -1
  56. package/dist/browser/runtime/node/community/page-generator.d.ts +2 -0
  57. package/dist/browser/runtime/node/setup-kubo-http-routers.d.ts +2 -0
  58. package/dist/browser/runtime/node/{setup-kubo-address-rewriter-and-http-router.js → setup-kubo-http-routers.js} +54 -112
  59. package/dist/browser/runtime/node/setup-kubo-http-routers.js.map +1 -0
  60. package/dist/browser/schema/schema-util.d.ts +17 -0
  61. package/dist/browser/schema/schema-util.js +49 -5
  62. package/dist/browser/schema/schema-util.js.map +1 -1
  63. package/dist/browser/signer/signatures.d.ts +1 -10
  64. package/dist/browser/signer/signatures.js +83 -0
  65. package/dist/browser/signer/signatures.js.map +1 -1
  66. package/dist/browser/test/test-util.d.ts +6 -0
  67. package/dist/browser/util.d.ts +3 -4
  68. package/dist/browser/util.js +7 -3
  69. package/dist/browser/util.js.map +1 -1
  70. package/dist/browser/version.js +1 -1
  71. package/dist/bundled/bundle-manifest.json +78 -93
  72. package/dist/bundled/chunks/{helia-for-pkc-BsYWQ7qS.js → helia-for-pkc-CQY3-UYD.js} +31 -31
  73. package/dist/bundled/chunks/{local-community-EqWKTLxr.js → local-community-AZAEiiht.js} +1 -1
  74. package/dist/bundled/chunks/{local-community-CHzhypCp.js → local-community-DRm3r1-Y.js} +16 -6
  75. package/dist/bundled/chunks/{node-4qAZNuJG.js → node-B1J8psGZ.js} +380 -2372
  76. package/dist/bundled/chunks/{rpc-local-community-Cog5rZLG.js → rpc-local-community-0XmKyOdO.js} +298 -580
  77. package/dist/bundled/chunks/{schema-Iavj-cRD.js → schema-BUUhufdT.js} +26 -11
  78. package/dist/bundled/chunks/{util-CfSUfLkV.js → util-Cct7-RT3.js} +1 -1
  79. package/dist/bundled/index.js +1 -1
  80. package/dist/bundled/rpc/src/index.js +13 -5
  81. package/dist/node/clients/base-client-manager.js +19 -1
  82. package/dist/node/clients/base-client-manager.js.map +1 -1
  83. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -0
  84. package/dist/node/clients/rpc-client/schema.d.ts +3 -0
  85. package/dist/node/community/schema.d.ts +24 -0
  86. package/dist/node/community/schema.js +6 -1
  87. package/dist/node/community/schema.js.map +1 -1
  88. package/dist/node/errors.d.ts +10 -1
  89. package/dist/node/errors.js +10 -1
  90. package/dist/node/errors.js.map +1 -1
  91. package/dist/node/generated-version.d.ts +1 -1
  92. package/dist/node/generated-version.js +1 -1
  93. package/dist/node/pages/pages.js +8 -0
  94. package/dist/node/pages/pages.js.map +1 -1
  95. package/dist/node/pages/schema.d.ts +4 -0
  96. package/dist/node/pages/util.d.ts +2 -0
  97. package/dist/node/pages/util.js +23 -3
  98. package/dist/node/pages/util.js.map +1 -1
  99. package/dist/node/pkc/pkc.d.ts +3 -2
  100. package/dist/node/pkc/pkc.js +37 -24
  101. package/dist/node/pkc/pkc.js.map +1 -1
  102. package/dist/node/pkc-error.d.ts +1 -1
  103. package/dist/node/publications/comment/comment-client-manager.js +22 -4
  104. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  105. package/dist/node/publications/comment/comment.d.ts +2 -1
  106. package/dist/node/publications/comment/comment.js +29 -6
  107. package/dist/node/publications/comment/comment.js.map +1 -1
  108. package/dist/node/publications/comment/crosspost-depth.d.ts +5 -0
  109. package/dist/node/publications/comment/crosspost-depth.js +75 -0
  110. package/dist/node/publications/comment/crosspost-depth.js.map +1 -0
  111. package/dist/node/publications/comment/crosspost-runtime.d.ts +30 -0
  112. package/dist/node/publications/comment/crosspost-runtime.js +133 -0
  113. package/dist/node/publications/comment/crosspost-runtime.js.map +1 -0
  114. package/dist/node/publications/comment/schema.d.ts +20 -2
  115. package/dist/node/publications/comment/schema.js +21 -10
  116. package/dist/node/publications/comment/schema.js.map +1 -1
  117. package/dist/node/publications/comment/types.d.ts +10 -0
  118. package/dist/node/publications/community-edit/schema.d.ts +4 -0
  119. package/dist/node/publications/publication.d.ts +4 -0
  120. package/dist/node/publications/publication.js +80 -5
  121. package/dist/node/publications/publication.js.map +1 -1
  122. package/dist/node/pubsub-messages/schema.d.ts +5 -0
  123. package/dist/node/rpc/src/index.js +14 -2
  124. package/dist/node/rpc/src/index.js.map +1 -1
  125. package/dist/node/runtime/browser/setup-kubo-http-routers.d.ts +1 -0
  126. package/dist/node/runtime/browser/setup-kubo-http-routers.js +4 -0
  127. package/dist/node/runtime/browser/setup-kubo-http-routers.js.map +1 -0
  128. package/dist/node/runtime/node/community/db-handler.js +3 -2
  129. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  130. package/dist/node/runtime/node/community/local-community/publication-validation.js +15 -0
  131. package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
  132. package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.d.ts +3 -2
  133. package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js +19 -10
  134. package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -1
  135. package/dist/node/runtime/node/community/page-generator.d.ts +2 -0
  136. package/dist/node/runtime/node/setup-kubo-http-routers.d.ts +2 -0
  137. package/dist/node/runtime/node/{setup-kubo-address-rewriter-and-http-router.js → setup-kubo-http-routers.js} +54 -112
  138. package/dist/node/runtime/node/setup-kubo-http-routers.js.map +1 -0
  139. package/dist/node/schema/schema-util.d.ts +17 -0
  140. package/dist/node/schema/schema-util.js +49 -5
  141. package/dist/node/schema/schema-util.js.map +1 -1
  142. package/dist/node/signer/signatures.d.ts +1 -10
  143. package/dist/node/signer/signatures.js +83 -0
  144. package/dist/node/signer/signatures.js.map +1 -1
  145. package/dist/node/test/test-util.d.ts +6 -0
  146. package/dist/node/util.d.ts +3 -4
  147. package/dist/node/util.js +7 -3
  148. package/dist/node/util.js.map +1 -1
  149. package/dist/node/version.js +1 -1
  150. package/package.json +2 -2
  151. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.d.ts +0 -1
  152. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.js +0 -4
  153. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.js.map +0 -1
  154. package/dist/browser/runtime/node/address-rewriter-db.d.ts +0 -33
  155. package/dist/browser/runtime/node/address-rewriter-db.js +0 -156
  156. package/dist/browser/runtime/node/address-rewriter-db.js.map +0 -1
  157. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.d.ts +0 -47
  158. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js +0 -534
  159. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js.map +0 -1
  160. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.d.ts +0 -4
  161. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +0 -1
  162. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.d.ts +0 -1
  163. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.js +0 -4
  164. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.js.map +0 -1
  165. package/dist/node/runtime/node/address-rewriter-db.d.ts +0 -33
  166. package/dist/node/runtime/node/address-rewriter-db.js +0 -156
  167. package/dist/node/runtime/node/address-rewriter-db.js.map +0 -1
  168. package/dist/node/runtime/node/addresses-rewriter-proxy-server.d.ts +0 -47
  169. package/dist/node/runtime/node/addresses-rewriter-proxy-server.js +0 -534
  170. package/dist/node/runtime/node/addresses-rewriter-proxy-server.js.map +0 -1
  171. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.d.ts +0 -4
  172. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +0 -1
  173. package/dist/bundled/chunks/{src-BEjAH2gY.js → src-WLgFbUwZ.js} +1 -1
@@ -1,10 +1,10 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, br as logger_default, vr as PKCError } from "./schema-Iavj-cRD.js";
3
- import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-CfSUfLkV.js";
2
+ import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, br as logger_default, vr as PKCError } from "./schema-BUUhufdT.js";
3
+ import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-Cct7-RT3.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
- import fs, { rename, writeFile } from "node:fs/promises";
7
+ import fsp, { rename, writeFile } from "node:fs/promises";
8
8
  import path, { basename, dirname, join } from "node:path";
9
9
  import path$1 from "path";
10
10
  import { CID } from "multiformats/cid";
@@ -4150,12 +4150,12 @@ var require_sync$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
4150
4150
  var require_fs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
4151
4151
  Object.defineProperty(exports, "__esModule", { value: true });
4152
4152
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
4153
- const fs$3 = __require("fs");
4153
+ const fs$2 = __require("fs");
4154
4154
  exports.FILE_SYSTEM_ADAPTER = {
4155
- lstat: fs$3.lstat,
4156
- stat: fs$3.stat,
4157
- lstatSync: fs$3.lstatSync,
4158
- statSync: fs$3.statSync
4155
+ lstat: fs$2.lstat,
4156
+ stat: fs$2.stat,
4157
+ lstatSync: fs$2.lstatSync,
4158
+ statSync: fs$2.statSync
4159
4159
  };
4160
4160
  function createFileSystemAdapter(fsMethods) {
4161
4161
  if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
@@ -4473,14 +4473,14 @@ var require_sync$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
4473
4473
  var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
4474
4474
  Object.defineProperty(exports, "__esModule", { value: true });
4475
4475
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
4476
- const fs$2 = __require("fs");
4476
+ const fs$1 = __require("fs");
4477
4477
  exports.FILE_SYSTEM_ADAPTER = {
4478
- lstat: fs$2.lstat,
4479
- stat: fs$2.stat,
4480
- lstatSync: fs$2.lstatSync,
4481
- statSync: fs$2.statSync,
4482
- readdir: fs$2.readdir,
4483
- readdirSync: fs$2.readdirSync
4478
+ lstat: fs$1.lstat,
4479
+ stat: fs$1.stat,
4480
+ lstatSync: fs$1.lstatSync,
4481
+ statSync: fs$1.statSync,
4482
+ readdir: fs$1.readdir,
4483
+ readdirSync: fs$1.readdirSync
4484
4484
  };
4485
4485
  function createFileSystemAdapter(fsMethods) {
4486
4486
  if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
@@ -5674,7 +5674,7 @@ var require_sync = /* @__PURE__ */ __commonJSMin(((exports) => {
5674
5674
  var require_settings = /* @__PURE__ */ __commonJSMin(((exports) => {
5675
5675
  Object.defineProperty(exports, "__esModule", { value: true });
5676
5676
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
5677
- const fs$1 = __require("fs");
5677
+ const fs = __require("fs");
5678
5678
  const os = __require("os");
5679
5679
  /**
5680
5680
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
@@ -5682,12 +5682,12 @@ var require_settings = /* @__PURE__ */ __commonJSMin(((exports) => {
5682
5682
  */
5683
5683
  const CPU_COUNT = Math.max(os.cpus().length, 1);
5684
5684
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
5685
- lstat: fs$1.lstat,
5686
- lstatSync: fs$1.lstatSync,
5687
- stat: fs$1.stat,
5688
- statSync: fs$1.statSync,
5689
- readdir: fs$1.readdir,
5690
- readdirSync: fs$1.readdirSync
5685
+ lstat: fs.lstat,
5686
+ lstatSync: fs.lstatSync,
5687
+ stat: fs.stat,
5688
+ statSync: fs.statSync,
5689
+ readdir: fs.readdir,
5690
+ readdirSync: fs.readdirSync
5691
5691
  };
5692
5692
  var Settings = class {
5693
5693
  constructor(_options = {}) {
@@ -5850,7 +5850,7 @@ var import_out = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((export
5850
5850
  */
5851
5851
  async function* glob(dir, pattern, options = {}) {
5852
5852
  const absoluteDir = path.resolve(dir);
5853
- const stats = await fs.stat(absoluteDir);
5853
+ const stats = await fsp.stat(absoluteDir);
5854
5854
  for await (const entry of import_out.default.stream(pattern, {
5855
5855
  ...options,
5856
5856
  cwd: stats.isDirectory() ? dir : process.cwd()
@@ -6050,14 +6050,14 @@ var NextToLast = class {
6050
6050
  async function writeFile$1(file, contents, options) {
6051
6051
  try {
6052
6052
  options?.signal?.throwIfAborted();
6053
- await raceSignal(fs.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);
6057
6057
  } catch (err) {
6058
6058
  if (err.syscall === "rename" && ["ENOENT", "EPERM"].includes(err.code)) {
6059
6059
  options?.signal?.throwIfAborted();
6060
- await raceSignal(fs.access(file, fs.constants.F_OK | fs.constants.W_OK), options?.signal);
6060
+ await raceSignal(fsp.access(file, fsp.constants.F_OK | fsp.constants.W_OK), options?.signal);
6061
6061
  return;
6062
6062
  }
6063
6063
  throw err;
@@ -6085,11 +6085,11 @@ var FsBlockstore = class {
6085
6085
  }
6086
6086
  async open() {
6087
6087
  try {
6088
- await fs.access(this.path, fs.constants.F_OK | fs.constants.W_OK);
6088
+ await fsp.access(this.path, fsp.constants.F_OK | fsp.constants.W_OK);
6089
6089
  if (this.errorIfExists) throw new OpenFailedError(`Blockstore directory: ${this.path} already exists`);
6090
6090
  } catch (err) {
6091
6091
  if (err.code === "ENOENT") if (this.createIfMissing) {
6092
- await fs.mkdir(this.path, { recursive: true });
6092
+ await fsp.mkdir(this.path, { recursive: true });
6093
6093
  return;
6094
6094
  } else throw new OpenFailedError(`Blockstore directory: ${this.path} does not exist`);
6095
6095
  throw err;
@@ -6120,7 +6120,7 @@ var FsBlockstore = class {
6120
6120
  let handle;
6121
6121
  try {
6122
6122
  options?.signal?.throwIfAborted();
6123
- handle = await raceSignal(fs.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(fs.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,7 +6159,7 @@ var FsBlockstore = class {
6159
6159
  const { dir, file } = this.shardingStrategy.encode(key);
6160
6160
  try {
6161
6161
  options?.signal?.throwIfAborted();
6162
- await raceSignal(fs.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
  }
@@ -6175,7 +6175,7 @@ var FsBlockstore = class {
6175
6175
  bytes: (async function* () {
6176
6176
  let handle;
6177
6177
  try {
6178
- handle = await raceSignal(fs.open(file), options?.signal);
6178
+ handle = await raceSignal(fsp.open(file), options?.signal);
6179
6179
  yield* handle.createReadStream();
6180
6180
  } finally {
6181
6181
  if (handle != null) await raceSignal(handle.close(), options?.signal);
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-CHzhypCp.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DRm3r1-Y.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $n as n$3, An as CommentsTableRowSchema, At as trackStartedCommunity, Bn as CommentEditsTableRowSchema, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dn as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nr as ZodError, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as t$8, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditReservedFields, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, W as isLinkOfAnimatedImage, Wn as AuthorReservedFields, Y as isLinkValid, Zn as n$4, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r$1, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageReservedFields, br as logger_default, bt as findCommunityInRegistry, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, er as t$7, fr as require_retry, gn as VoteTablesRowSchema, ht as statMfsPathSafely, in as CommunitySignedPropertyNames, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$5, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mn as VotePubsubReservedFields, mt as sleepUntilTimeoutOrAbort, nr as e, nt as removeBlocksFromKuboNode, or as t$4, pn as VotePubsubMessagePublicationSchema, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as t$6, u as DecryptedChallengeRequestPublicationSchema, ur as t$3, vr as PKCError, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, yt as writeKuboFilesWithTimeout } from "./schema-Iavj-cRD.js";
3
- import { $n as t$11, A as deriveCommentIpfsFromCommentTableRow, At as verifyCommunity, B as resolveDbPostsCidRefs, Bt as getCommunityNameFromWire, C as encryptEd25519AesGcmPublicKeyBuffer, Ct as verifyChallengeRequest, D as calculateInlineRepliesBudget, Dt as verifyCommentModeration, E as calculateExpectedSignatureSize, Et as verifyCommentIpfs, F as getThumbnailPropsOfLink, G as POST_REPLIES_SORT_TYPES, I as importSignerIntoKuboNode, It as getAuthorNameFromWire, Jt as getPKCAddressFromPublicKeySync, K as REPLY_REPLIES_SORT_TYPES, Kt as getIpfsKeyFromPrivateKey, M as deriveDbReplies, Mt as verifyVote, N as getDefaultCommunityDbConfig, Nt as buildRuntimeAuthor, Ot as verifyCommentPubsubMessage, Pt as cleanWireAuthor, Q as iterateOverPageCidsToFindAllCids, Qn as r$2, Sn as parseJsonWithPKCErrorIfFails, T as backupCommunityDb, Tt as verifyCommentEdit, Ut as decode, Vt as getCommunityPublicKeyFromWire, W as POSTS_SORT_TYPES, Wt as encode, Xn as t$9, Xt as createSchemaRowParser, Yt as getPublicKeyFromPrivateKey, Zn as t$12, _ as SignerWithPublicKeyAddress, _t as signCommentUpdateForChallengeVerification, a as pkcJsChallenges, ar as STORAGE_KEYS, at as pLimit, ct as cleanUpBeforePublishing, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, er as n$6, f as KeyvBetterSqlite3, ft as signChallengeVerification, gt as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, ir as stringify, j as deriveDbPosts, jt as verifyCommunityEdit, k as deleteOldCommunityInWindows, kt as verifyCommentUpdate, l as normalizeSelfAddrsForProvider, ln as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, mt as signCommentEdit, o as TrackedInstanceRegistry, or as require_lodash_merge, pt as signComment, q as TIMEFRAMES_TO_SECONDS, qt as getPKCAddressFromPublicKey, r as getChallengeVerification, rr as t$10, s as LRUCache, sn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, t as RpcLocalCommunity, tr as n$5, ut as signChallengeMessage, vt as signCommunity, w as BackupAbortError, x as decryptEd25519AesGcmPublicKeyBuffer, xt as verifyChallengeAnswer, yn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, z as moveCommunityDbToDeletedDirectory } from "./rpc-local-community-Cog5rZLG.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$3, An as CommentsTableRowSchema, At as trackStartedCommunity, Bn as CommentEditsTableRowSchema, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dn as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nr as ZodError, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as t$8, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditReservedFields, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, W as isLinkOfAnimatedImage, Wn as AuthorReservedFields, Y as isLinkValid, Zn as n$4, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r$1, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageReservedFields, br as logger_default, bt as findCommunityInRegistry, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, er as t$7, fr as require_retry, gn as VoteTablesRowSchema, ht as statMfsPathSafely, in as CommunitySignedPropertyNames, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$5, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mn as VotePubsubReservedFields, mt as sleepUntilTimeoutOrAbort, nr as e, nt as removeBlocksFromKuboNode, or as t$4, pn as VotePubsubMessagePublicationSchema, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as t$6, u as DecryptedChallengeRequestPublicationSchema, ur as t$3, vr as PKCError, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, yt as writeKuboFilesWithTimeout } from "./schema-BUUhufdT.js";
3
+ import { $n as crosspostChainDepthUpTo, $t as createSchemaRowParser, A as deriveDbReplies, At as verifyCommentModeration, C as backupCommunityDb, D as deleteOldCommunityInWindows, Et as verifyChallengeRequest, Ft as verifyVote, G as TIMEFRAMES_TO_SECONDS, H as POSTS_SORT_TYPES, It as buildRuntimeAuthor, Kt as decode, L as moveCommunityDbToDeletedDirectory, Lt as cleanWireAuthor, Mt as verifyCommentUpdate, N as getThumbnailPropsOfLink, Nt as verifyCommunity, O as deriveCommentIpfsFromCommentTableRow, Ot as verifyCommentEdit, P as importSignerIntoKuboNode, Pt as verifyCommunityEdit, Qt as getPublicKeyFromPrivateKey, R as resolveDbPostsCidRefs, S as BackupAbortError, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, T as calculateInlineRepliesBudget, Tn as parseJsonWithPKCErrorIfFails, U as POST_REPLIES_SORT_TYPES, Ut as getCommunityNameFromWire, W as REPLY_REPLIES_SORT_TYPES, Wt as getCommunityPublicKeyFromWire, X as iterateOverPageCidsToFindAllCids, Xt as getPKCAddressFromPublicKey, Yt as getIpfsKeyFromPrivateKey, Zt as getPKCAddressFromPublicKeySync, _t as signCommentEdit, a as pkcJsChallenges, ar as n$6, bt as signCommentUpdateForChallengeVerification, cr as t$10, ct as pLimit, dr as require_lodash_merge, dt as cleanUpBeforePublishing, er as effectiveMaxCrosspostDepth, fn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, gt as signComment, h as SignerWithPublicKeyAddress, ht as signChallengeVerification, i as getCommunityChallengeFromCommunityChallengeSettings, ir as t$11, j as getDefaultCommunityDbConfig, jt as verifyCommentPubsubMessage, k as deriveDbPosts, kt as verifyCommentIpfs, l as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, lr as stringify, nr as t$12, o as TrackedInstanceRegistry, or as n$5, pt as signChallengeMessage, qt as encode, r as getChallengeVerification, rr as r$2, s as LRUCache, t as RpcLocalCommunity, tr as t$9, u as KeyvBetterSqlite3, un as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ur as STORAGE_KEYS, w as calculateExpectedSignatureSize, wt as verifyChallengeAnswer, x as encryptEd25519AesGcmPublicKeyBuffer, xt as signCommunity, y as decryptEd25519AesGcmPublicKeyBuffer, yt as signCommentUpdate, zt as getAuthorNameFromWire } from "./rpc-local-community-0XmKyOdO.js";
4
4
  import { randomFillSync, randomUUID } from "node:crypto";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
6
  import path from "node:path";
@@ -1304,6 +1304,11 @@ async function checkCommentPublication(community, request) {
1304
1304
  const parentsOfComment = community._dbHandler.queryParentsCids({ parentCid: commentPublication.parentCid });
1305
1305
  if (parentsOfComment[parentsOfComment.length - 1].cid !== commentPublication.postCid) return messages.ERR_REPLY_POST_CID_IS_NOT_PARENT_OF_REPLY;
1306
1306
  }
1307
+ if (commentPublication.crosspost) {
1308
+ if (community.features?.noCrossposts) return messages.ERR_NOT_ALLOWED_TO_PUBLISH_CROSSPOSTS;
1309
+ const maxDepth = effectiveMaxCrosspostDepth(community.features?.maxCrosspostDepth);
1310
+ if (crosspostChainDepthUpTo(commentPublication, maxDepth + 1) > maxDepth) return messages.ERR_CROSSPOST_CHAIN_EXCEEDS_COMMUNITY_MAX_DEPTH;
1311
+ }
1307
1312
  if (commentPublication.quotedCids && commentPublication.quotedCids.length > 0) {
1308
1313
  if (!commentPublication.parentCid) return messages.ERR_POST_CANNOT_HAVE_QUOTED_CIDS;
1309
1314
  const threadPostCid = commentPublication.postCid;
@@ -3336,6 +3341,7 @@ var DbHandler = class {
3336
3341
  nsfw INTEGER NULLABLE, -- BOOLEAN (0/1)
3337
3342
  pseudonymityMode TEXT NULLABLE,
3338
3343
  quotedCids TEXT NULLABLE, -- JSON array
3344
+ crosspost TEXT NULLABLE, -- JSON: {cid, comment} of the comment this one reposts, stored verbatim so the embedded record keeps reproducing its cid
3339
3345
  extraProps TEXT NULLABLE, -- JSON
3340
3346
  challengeCommentUpdate TEXT NULLABLE, -- JSON: challenge-supplied partial CommentUpdate seeded into queryCalculatedCommentUpdate with lowest priority
3341
3347
  protocolVersion TEXT NOT NULL,
@@ -3862,8 +3868,8 @@ var DbHandler = class {
3862
3868
  const columnNames = this._getColumnNames(TABLES.COMMENTS);
3863
3869
  const stmt = this._db.prepare(`
3864
3870
  INSERT INTO ${TABLES.COMMENTS}
3865
- (cid, authorSignerAddress, author, link, linkWidth, linkHeight, thumbnailUrl, thumbnailUrlWidth, thumbnailUrlHeight, parentCid, postCid, previousCid, communityPublicKey, communityName, content, timestamp, signature, originalCommentSignatureEncoded, title, depth, linkHtmlTagName, flairs, spoiler, pendingApproval, number, postNumber, nsfw, pseudonymityMode, quotedCids, extraProps, challengeCommentUpdate, protocolVersion, insertedAt)
3866
- VALUES (@cid, @authorSignerAddress, @author, @link, @linkWidth, @linkHeight, @thumbnailUrl, @thumbnailUrlWidth, @thumbnailUrlHeight, @parentCid, @postCid, @previousCid, @communityPublicKey, @communityName, @content, @timestamp, @signature, @originalCommentSignatureEncoded, @title, @depth, @linkHtmlTagName, @flairs, @spoiler, @pendingApproval, @number, @postNumber, @nsfw, @pseudonymityMode, @quotedCids, @extraProps, @challengeCommentUpdate, @protocolVersion, @insertedAt)
3871
+ (cid, authorSignerAddress, author, link, linkWidth, linkHeight, thumbnailUrl, thumbnailUrlWidth, thumbnailUrlHeight, parentCid, postCid, previousCid, communityPublicKey, communityName, content, timestamp, signature, originalCommentSignatureEncoded, title, depth, linkHtmlTagName, flairs, spoiler, pendingApproval, number, postNumber, nsfw, pseudonymityMode, quotedCids, crosspost, extraProps, challengeCommentUpdate, protocolVersion, insertedAt)
3872
+ VALUES (@cid, @authorSignerAddress, @author, @link, @linkWidth, @linkHeight, @thumbnailUrl, @thumbnailUrlWidth, @thumbnailUrlHeight, @parentCid, @postCid, @previousCid, @communityPublicKey, @communityName, @content, @timestamp, @signature, @originalCommentSignatureEncoded, @title, @depth, @linkHtmlTagName, @flairs, @spoiler, @pendingApproval, @number, @postNumber, @nsfw, @pseudonymityMode, @quotedCids, @crosspost, @extraProps, @challengeCommentUpdate, @protocolVersion, @insertedAt)
3867
3873
  `);
3868
3874
  const defaults = t$7(columnNames, (column) => [column, null]);
3869
3875
  this._db.transaction((items) => {
@@ -6487,6 +6493,10 @@ async function syncIpnsWithDb(community) {
6487
6493
  throw e;
6488
6494
  }
6489
6495
  }
6496
+ function normalizeSelfAddrsForProvider(addrs, peerId) {
6497
+ const suffix = `/p2p/${peerId}`;
6498
+ return n$4(addrs.map((addr) => addr.endsWith(suffix) ? addr.slice(0, -suffix.length) : addr));
6499
+ }
6490
6500
  function isBrowserDialableAddr(addr) {
6491
6501
  return addr.includes("/webrtc") || addr.includes("/ws");
6492
6502
  }
@@ -6501,8 +6511,8 @@ function connectionCriticalCids(community) {
6501
6511
  }
6502
6512
  /**
6503
6513
  * Re-provide the connection-critical CIDs when the node's browser-dialable (WSS/WebRTC) self-addresses
6504
- * have changed since the last provide. This pushes the current addresses to the HTTP routers (via the
6505
- * address-rewriter proxy) so browsers don't get NoValidAddressesError against stale/dead addresses.
6514
+ * have changed since the last provide. This pushes the current addresses to the HTTP routers so browsers
6515
+ * don't get NoValidAddressesError against stale/dead addresses.
6506
6516
  *
6507
6517
  * The first observation only establishes a baseline (start() already force-provides these CIDs with fresh
6508
6518
  * addresses via providePubsubTopicRoutingCidsIfNeeded); subsequent changes trigger a re-provide.