@pkcprotocol/pkc-js 0.0.127 → 0.0.128

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 (47) hide show
  1. package/dist/browser/clients/base-client-manager.d.ts +8 -0
  2. package/dist/browser/clients/base-client-manager.js +39 -2
  3. package/dist/browser/clients/base-client-manager.js.map +1 -1
  4. package/dist/browser/community/community-client-manager.js +2 -1
  5. package/dist/browser/community/community-client-manager.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/browser/helia/helia-for-pkc.js +88 -22
  9. package/dist/browser/helia/helia-for-pkc.js.map +1 -1
  10. package/dist/browser/helia/types.d.ts +4 -1
  11. package/dist/browser/publications/comment/comment-client-manager.d.ts +5 -2
  12. package/dist/browser/publications/comment/comment-client-manager.js +104 -40
  13. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  14. package/dist/browser/publications/comment/comment.d.ts +4 -0
  15. package/dist/browser/publications/comment/comment.js +4 -0
  16. package/dist/browser/publications/comment/comment.js.map +1 -1
  17. package/dist/bundled/bundle-manifest.json +52 -52
  18. package/dist/bundled/challenges.js +1 -1
  19. package/dist/bundled/chunks/{helia-for-pkc-BsXEDYPa.js → helia-for-pkc-6kkeZX1a.js} +96 -42
  20. package/dist/bundled/chunks/{local-community-WFQoW5aC.js → local-community-B79BAYRo.js} +3 -3
  21. package/dist/bundled/chunks/{local-community-FekHR-fd.js → local-community-BST1U_f3.js} +1 -1
  22. package/dist/bundled/chunks/{node-pIjburtc.js → node-BEH8NA_I.js} +108 -32
  23. package/dist/bundled/chunks/{page-sort-scoring-Civ7TOoF.js → page-sort-scoring-2FkqYYNf.js} +1 -1
  24. package/dist/bundled/chunks/{rpc-local-community-BqP9g2Rk.js → rpc-local-community-SmLDPm1j.js} +35 -5
  25. package/dist/bundled/chunks/{util-VrWyIc1x.js → util-LwSS90AE.js} +1 -1
  26. package/dist/bundled/chunks/{util-D5Y6i3Nn.js → util-jyIDYw_Q.js} +1 -1
  27. package/dist/bundled/chunks/{validate-package-factories-CJgjDTZC.js → validate-package-factories-_KKnb8At.js} +2 -2
  28. package/dist/bundled/index.js +1 -1
  29. package/dist/bundled/page-sorts.js +1 -1
  30. package/dist/bundled/rpc/src/index.js +4 -4
  31. package/dist/node/clients/base-client-manager.d.ts +8 -0
  32. package/dist/node/clients/base-client-manager.js +39 -2
  33. package/dist/node/clients/base-client-manager.js.map +1 -1
  34. package/dist/node/community/community-client-manager.js +2 -1
  35. package/dist/node/community/community-client-manager.js.map +1 -1
  36. package/dist/node/generated-version.d.ts +1 -1
  37. package/dist/node/generated-version.js +1 -1
  38. package/dist/node/helia/helia-for-pkc.js +88 -22
  39. package/dist/node/helia/helia-for-pkc.js.map +1 -1
  40. package/dist/node/helia/types.d.ts +4 -1
  41. package/dist/node/publications/comment/comment-client-manager.d.ts +5 -2
  42. package/dist/node/publications/comment/comment-client-manager.js +104 -40
  43. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  44. package/dist/node/publications/comment/comment.d.ts +4 -0
  45. package/dist/node/publications/comment/comment.js +4 -0
  46. package/dist/node/publications/comment/comment.js.map +1 -1
  47. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  "challenges.js": {
4
4
  "isEntry": true,
5
5
  "imports": [
6
- "chunks/validate-package-factories-CJgjDTZC.js"
6
+ "chunks/validate-package-factories-_KKnb8At.js"
7
7
  ],
8
8
  "dynamicImports": [],
9
9
  "inputs": [
@@ -16,7 +16,7 @@
16
16
  "node:module"
17
17
  ],
18
18
  "dynamicImports": [
19
- "chunks/node-pIjburtc.js"
19
+ "chunks/node-BEH8NA_I.js"
20
20
  ],
21
21
  "inputs": [
22
22
  "dist/node/runtime/node/compile-cache.js",
@@ -26,7 +26,7 @@
26
26
  "index.js": {
27
27
  "isEntry": true,
28
28
  "imports": [
29
- "chunks/node-pIjburtc.js"
29
+ "chunks/node-BEH8NA_I.js"
30
30
  ],
31
31
  "dynamicImports": [],
32
32
  "inputs": []
@@ -34,7 +34,7 @@
34
34
  "page-sorts.js": {
35
35
  "isEntry": true,
36
36
  "imports": [
37
- "chunks/validate-package-factories-CJgjDTZC.js"
37
+ "chunks/validate-package-factories-_KKnb8At.js"
38
38
  ],
39
39
  "dynamicImports": [],
40
40
  "inputs": [
@@ -44,10 +44,10 @@
44
44
  "rpc/src/index.js": {
45
45
  "isEntry": true,
46
46
  "imports": [
47
- "chunks/rpc-local-community-BqP9g2Rk.js",
48
- "chunks/node-pIjburtc.js",
49
- "chunks/util-VrWyIc1x.js",
50
- "chunks/local-community-WFQoW5aC.js",
47
+ "chunks/rpc-local-community-SmLDPm1j.js",
48
+ "chunks/node-BEH8NA_I.js",
49
+ "chunks/util-LwSS90AE.js",
50
+ "chunks/local-community-B79BAYRo.js",
51
51
  "node:url",
52
52
  "path",
53
53
  "assert",
@@ -77,12 +77,12 @@
77
77
  "\u0000rolldown/runtime.js"
78
78
  ]
79
79
  },
80
- "chunks/helia-for-pkc-BsXEDYPa.js": {
80
+ "chunks/helia-for-pkc-6kkeZX1a.js": {
81
81
  "isEntry": false,
82
82
  "imports": [
83
83
  "chunks/chunk-2rV9d50f.js",
84
- "chunks/util-VrWyIc1x.js",
85
- "chunks/util-D5Y6i3Nn.js",
84
+ "chunks/util-LwSS90AE.js",
85
+ "chunks/util-jyIDYw_Q.js",
86
86
  "chunks/src-DKntVmyX.js",
87
87
  "chunks/src-Cpx2Sts8.js",
88
88
  "node:url",
@@ -201,21 +201,13 @@
201
201
  "dist/node/helia/helia-for-pkc.js"
202
202
  ]
203
203
  },
204
- "chunks/local-community-FekHR-fd.js": {
205
- "isEntry": false,
206
- "imports": [
207
- "chunks/local-community-WFQoW5aC.js"
208
- ],
209
- "dynamicImports": [],
210
- "inputs": []
211
- },
212
- "chunks/local-community-WFQoW5aC.js": {
204
+ "chunks/local-community-B79BAYRo.js": {
213
205
  "isEntry": false,
214
206
  "imports": [
215
207
  "chunks/chunk-2rV9d50f.js",
216
- "chunks/rpc-local-community-BqP9g2Rk.js",
217
- "chunks/util-VrWyIc1x.js",
218
- "chunks/page-sort-scoring-Civ7TOoF.js",
208
+ "chunks/rpc-local-community-SmLDPm1j.js",
209
+ "chunks/util-LwSS90AE.js",
210
+ "chunks/page-sort-scoring-2FkqYYNf.js",
219
211
  "node:crypto",
220
212
  "node:url",
221
213
  "node:path",
@@ -274,13 +266,21 @@
274
266
  "dist/node/runtime/node/community/local-community.js"
275
267
  ]
276
268
  },
277
- "chunks/node-pIjburtc.js": {
269
+ "chunks/local-community-BST1U_f3.js": {
270
+ "isEntry": false,
271
+ "imports": [
272
+ "chunks/local-community-B79BAYRo.js"
273
+ ],
274
+ "dynamicImports": [],
275
+ "inputs": []
276
+ },
277
+ "chunks/node-BEH8NA_I.js": {
278
278
  "isEntry": false,
279
279
  "imports": [
280
280
  "chunks/chunk-2rV9d50f.js",
281
- "chunks/rpc-local-community-BqP9g2Rk.js",
282
- "chunks/util-VrWyIc1x.js",
283
- "chunks/util-D5Y6i3Nn.js",
281
+ "chunks/rpc-local-community-SmLDPm1j.js",
282
+ "chunks/util-LwSS90AE.js",
283
+ "chunks/util-jyIDYw_Q.js",
284
284
  "path",
285
285
  "assert",
286
286
  "fs",
@@ -291,8 +291,8 @@
291
291
  "rpc-websockets"
292
292
  ],
293
293
  "dynamicImports": [
294
- "chunks/helia-for-pkc-BsXEDYPa.js",
295
- "chunks/local-community-WFQoW5aC.js"
294
+ "chunks/helia-for-pkc-6kkeZX1a.js",
295
+ "chunks/local-community-B79BAYRo.js"
296
296
  ],
297
297
  "inputs": [
298
298
  "dist/node/zod-error-map.js",
@@ -339,22 +339,22 @@
339
339
  "dist/node/index.js"
340
340
  ]
341
341
  },
342
- "chunks/page-sort-scoring-Civ7TOoF.js": {
342
+ "chunks/page-sort-scoring-2FkqYYNf.js": {
343
343
  "isEntry": false,
344
344
  "imports": [
345
- "chunks/util-VrWyIc1x.js"
345
+ "chunks/util-LwSS90AE.js"
346
346
  ],
347
347
  "dynamicImports": [],
348
348
  "inputs": [
349
349
  "dist/node/pages/page-sort-scoring.js"
350
350
  ]
351
351
  },
352
- "chunks/rpc-local-community-BqP9g2Rk.js": {
352
+ "chunks/rpc-local-community-SmLDPm1j.js": {
353
353
  "isEntry": false,
354
354
  "imports": [
355
355
  "chunks/chunk-2rV9d50f.js",
356
- "chunks/util-VrWyIc1x.js",
357
- "chunks/page-sort-scoring-Civ7TOoF.js",
356
+ "chunks/util-LwSS90AE.js",
357
+ "chunks/page-sort-scoring-2FkqYYNf.js",
358
358
  "chunks/src-CYIMjhjK.js",
359
359
  "node:crypto",
360
360
  "node:url",
@@ -1306,21 +1306,7 @@
1306
1306
  "node_modules/it-parallel-batch/dist/src/index.js"
1307
1307
  ]
1308
1308
  },
1309
- "chunks/util-D5Y6i3Nn.js": {
1310
- "isEntry": false,
1311
- "imports": [
1312
- "chunks/util-VrWyIc1x.js",
1313
- "ipns/selector",
1314
- "ipns/validator",
1315
- "ipns",
1316
- "uint8arrays/equals"
1317
- ],
1318
- "dynamicImports": [],
1319
- "inputs": [
1320
- "dist/node/helia/util.js"
1321
- ]
1322
- },
1323
- "chunks/util-VrWyIc1x.js": {
1309
+ "chunks/util-LwSS90AE.js": {
1324
1310
  "isEntry": false,
1325
1311
  "imports": [
1326
1312
  "chunks/chunk-2rV9d50f.js",
@@ -1415,11 +1401,25 @@
1415
1401
  "dist/node/util.js"
1416
1402
  ]
1417
1403
  },
1418
- "chunks/validate-package-factories-CJgjDTZC.js": {
1404
+ "chunks/util-jyIDYw_Q.js": {
1405
+ "isEntry": false,
1406
+ "imports": [
1407
+ "chunks/util-LwSS90AE.js",
1408
+ "ipns/selector",
1409
+ "ipns/validator",
1410
+ "ipns",
1411
+ "uint8arrays/equals"
1412
+ ],
1413
+ "dynamicImports": [],
1414
+ "inputs": [
1415
+ "dist/node/helia/util.js"
1416
+ ]
1417
+ },
1418
+ "chunks/validate-package-factories-_KKnb8At.js": {
1419
1419
  "isEntry": false,
1420
1420
  "imports": [
1421
- "chunks/util-VrWyIc1x.js",
1422
- "chunks/page-sort-scoring-Civ7TOoF.js"
1421
+ "chunks/util-LwSS90AE.js",
1422
+ "chunks/page-sort-scoring-2FkqYYNf.js"
1423
1423
  ],
1424
1424
  "dynamicImports": [],
1425
1425
  "inputs": [
@@ -1,2 +1,2 @@
1
- import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-CJgjDTZC.js";
1
+ import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-_KKnb8At.js";
2
2
  export { validateChallengeFileFactory };
@@ -1,10 +1,10 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.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";
2
+ import { C as hideClassPrivateProps, Lr as PKCError, T as ipnsNameToIpnsOverPubsubTopic, n as binaryKeyToPubsubTopic, zr as logger_default } from "./util-LwSS90AE.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-jyIDYw_Q.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 fsp, { rename, writeFile } from "node:fs/promises";
7
+ import fs, { 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";
@@ -4153,12 +4153,12 @@ var require_sync$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
4153
4153
  var require_fs$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
4154
4154
  Object.defineProperty(exports, "__esModule", { value: true });
4155
4155
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
4156
- const fs$2 = __require("fs");
4156
+ const fs$3 = __require("fs");
4157
4157
  exports.FILE_SYSTEM_ADAPTER = {
4158
- lstat: fs$2.lstat,
4159
- stat: fs$2.stat,
4160
- lstatSync: fs$2.lstatSync,
4161
- statSync: fs$2.statSync
4158
+ lstat: fs$3.lstat,
4159
+ stat: fs$3.stat,
4160
+ lstatSync: fs$3.lstatSync,
4161
+ statSync: fs$3.statSync
4162
4162
  };
4163
4163
  function createFileSystemAdapter(fsMethods) {
4164
4164
  if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
@@ -4476,14 +4476,14 @@ var require_sync$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
4476
4476
  var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
4477
4477
  Object.defineProperty(exports, "__esModule", { value: true });
4478
4478
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
4479
- const fs$1 = __require("fs");
4479
+ const fs$2 = __require("fs");
4480
4480
  exports.FILE_SYSTEM_ADAPTER = {
4481
- lstat: fs$1.lstat,
4482
- stat: fs$1.stat,
4483
- lstatSync: fs$1.lstatSync,
4484
- statSync: fs$1.statSync,
4485
- readdir: fs$1.readdir,
4486
- readdirSync: fs$1.readdirSync
4481
+ lstat: fs$2.lstat,
4482
+ stat: fs$2.stat,
4483
+ lstatSync: fs$2.lstatSync,
4484
+ statSync: fs$2.statSync,
4485
+ readdir: fs$2.readdir,
4486
+ readdirSync: fs$2.readdirSync
4487
4487
  };
4488
4488
  function createFileSystemAdapter(fsMethods) {
4489
4489
  if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
@@ -5677,7 +5677,7 @@ var require_sync = /* @__PURE__ */ __commonJSMin(((exports) => {
5677
5677
  var require_settings = /* @__PURE__ */ __commonJSMin(((exports) => {
5678
5678
  Object.defineProperty(exports, "__esModule", { value: true });
5679
5679
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
5680
- const fs = __require("fs");
5680
+ const fs$1 = __require("fs");
5681
5681
  const os = __require("os");
5682
5682
  /**
5683
5683
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
@@ -5685,12 +5685,12 @@ var require_settings = /* @__PURE__ */ __commonJSMin(((exports) => {
5685
5685
  */
5686
5686
  const CPU_COUNT = Math.max(os.cpus().length, 1);
5687
5687
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
5688
- lstat: fs.lstat,
5689
- lstatSync: fs.lstatSync,
5690
- stat: fs.stat,
5691
- statSync: fs.statSync,
5692
- readdir: fs.readdir,
5693
- readdirSync: fs.readdirSync
5688
+ lstat: fs$1.lstat,
5689
+ lstatSync: fs$1.lstatSync,
5690
+ stat: fs$1.stat,
5691
+ statSync: fs$1.statSync,
5692
+ readdir: fs$1.readdir,
5693
+ readdirSync: fs$1.readdirSync
5694
5694
  };
5695
5695
  var Settings = class {
5696
5696
  constructor(_options = {}) {
@@ -5853,7 +5853,7 @@ var import_out = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((export
5853
5853
  */
5854
5854
  async function* glob(dir, pattern, options = {}) {
5855
5855
  const absoluteDir = path.resolve(dir);
5856
- const stats = await fsp.stat(absoluteDir);
5856
+ const stats = await fs.stat(absoluteDir);
5857
5857
  for await (const entry of import_out.default.stream(pattern, {
5858
5858
  ...options,
5859
5859
  cwd: stats.isDirectory() ? dir : process.cwd()
@@ -6048,14 +6048,14 @@ 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(fs.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);
6055
6055
  } catch (err) {
6056
6056
  if (err.syscall === "rename" && ["ENOENT", "EPERM"].includes(err.code)) {
6057
6057
  options?.signal?.throwIfAborted();
6058
- await raceSignal(fsp.access(file, fsp.constants.F_OK | fsp.constants.W_OK), options?.signal);
6058
+ await raceSignal(fs.access(file, fs.constants.F_OK | fs.constants.W_OK), options?.signal);
6059
6059
  return;
6060
6060
  }
6061
6061
  throw err;
@@ -6083,11 +6083,11 @@ var FsBlockstore = class {
6083
6083
  }
6084
6084
  async open() {
6085
6085
  try {
6086
- await fsp.access(this.path, fsp.constants.F_OK | fsp.constants.W_OK);
6086
+ await fs.access(this.path, fs.constants.F_OK | fs.constants.W_OK);
6087
6087
  if (this.errorIfExists) throw new OpenFailedError(`Blockstore directory: ${this.path} already exists`);
6088
6088
  } catch (err) {
6089
6089
  if (err.code === "ENOENT") if (this.createIfMissing) {
6090
- await fsp.mkdir(this.path, { recursive: true });
6090
+ await fs.mkdir(this.path, { recursive: true });
6091
6091
  return;
6092
6092
  } else throw new OpenFailedError(`Blockstore directory: ${this.path} does not exist`);
6093
6093
  throw 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(fs.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(fs.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,7 +6157,7 @@ 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(fs.access(path.join(this.path, dir, file)), options?.signal);
6161
6161
  } catch (err) {
6162
6162
  return false;
6163
6163
  }
@@ -6173,7 +6173,7 @@ var FsBlockstore = class {
6173
6173
  bytes: (async function* () {
6174
6174
  let handle;
6175
6175
  try {
6176
- handle = await raceSignal(fsp.open(file), options?.signal);
6176
+ handle = await raceSignal(fs.open(file), options?.signal);
6177
6177
  yield* handle.createReadStream();
6178
6178
  } finally {
6179
6179
  if (handle != null) await raceSignal(handle.close(), options?.signal);
@@ -6632,6 +6632,20 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6632
6632
  }, ms);
6633
6633
  signal.addEventListener("abort", onAbort, { once: true });
6634
6634
  });
6635
+ const createSeededBitswapSession = (rootCid, scopeIpnsPubsubTopic) => {
6636
+ const session = helia.blockstore.createSession(rootCid, { providers: getBitswapSessionSeedPeers(scopeIpnsPubsubTopic).map((peerId) => peerId.toCID()) });
6637
+ const sessionGet = session.get.bind(session);
6638
+ const fallbackGet = helia.blockstore.get.bind(helia.blockstore);
6639
+ session.get = (blockCid, blockGetOptions) => fetchBlockWithStalledSessionFailover({
6640
+ cid: blockCid,
6641
+ sessionGet,
6642
+ fallbackGet,
6643
+ stallTimeoutMs: heliaWithKuboRpcClientShape._bitswapSessionStalledGetFailoverMs ?? 2500,
6644
+ options: blockGetOptions,
6645
+ log
6646
+ });
6647
+ return session;
6648
+ };
6635
6649
  const ipnsPubsubRouter = pubSubIPNSRouting(helia);
6636
6650
  const ipnsNameResolver = ipns(helia, { routers: [ipnsPubsubRouter] });
6637
6651
  for (let i = ipnsNameResolver.routers.length - 1; i >= 0; i--) if (isLocalStoreIpnsRouter(ipnsNameResolver.routers[i])) ipnsNameResolver.routers.splice(i, 1);
@@ -6916,17 +6930,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6916
6930
  })), timeoutMs) : void 0;
6917
6931
  try {
6918
6932
  for (let attempt = 0;; attempt++) {
6919
- const session = helia.blockstore.createSession(rootCid, { providers: getBitswapSessionSeedPeers(bitswapSessionSeedScopeIpnsPubsubTopic).map((peerId) => peerId.toCID()) });
6920
- const sessionGet = session.get.bind(session);
6921
- const fallbackGet = helia.blockstore.get.bind(helia.blockstore);
6922
- session.get = (blockCid, blockGetOptions) => fetchBlockWithStalledSessionFailover({
6923
- cid: blockCid,
6924
- sessionGet,
6925
- fallbackGet,
6926
- stallTimeoutMs: heliaWithKuboRpcClientShape._bitswapSessionStalledGetFailoverMs ?? 2500,
6927
- options: blockGetOptions,
6928
- log
6929
- });
6933
+ const session = createSeededBitswapSession(rootCid, bitswapSessionSeedScopeIpnsPubsubTopic);
6930
6934
  let yieldedAnyBytes = false;
6931
6935
  try {
6932
6936
  const catIterable = unixfs({ blockstore: session }).cat(rootCid, {
@@ -6991,6 +6995,56 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
6991
6995
  if (pubsubEventHandler.listenerCount(topic) === 0) helia.libp2p.services.pubsub.unsubscribe(topic);
6992
6996
  }
6993
6997
  },
6998
+ async resolve(ipfsPath, options) {
6999
+ throwIfHeliaIsStoppingOrStopped();
7000
+ const [rootCidString, ...subPathSegments] = ipfsPath.replace(/^\/ipfs\//, "").split("/");
7001
+ const timeoutMs = parseKuboStyleTimeoutMs(options?.timeout);
7002
+ const controller = new AbortController();
7003
+ const callerSignal = options?.signal;
7004
+ const abortFromCaller = () => controller.abort(callerSignal?.reason);
7005
+ const abortFromStop = () => controller.abort(new PKCError("ERR_HELIAS_STOPPING_OR_STOPPED", {
7006
+ heliaKey: pkcOptions.key,
7007
+ ipfsPath
7008
+ }));
7009
+ if (callerSignal?.aborted) abortFromCaller();
7010
+ else callerSignal?.addEventListener("abort", abortFromCaller, { once: true });
7011
+ if (catStopController.signal.aborted) abortFromStop();
7012
+ else catStopController.signal.addEventListener("abort", abortFromStop, { once: true });
7013
+ const timeoutTimer = timeoutMs !== void 0 ? setTimeout(() => controller.abort(new PKCError("ERR_FETCH_CID_P2P_TIMEOUT", {
7014
+ ipfsPath,
7015
+ timeoutMs
7016
+ })), timeoutMs) : void 0;
7017
+ try {
7018
+ const rootCid = CID.parse(rootCidString);
7019
+ for (let attempt = 0;; attempt++) {
7020
+ const session = createSeededBitswapSession(rootCid, options?.bitswapSessionSeedScopeIpnsPubsubTopic);
7021
+ try {
7022
+ return `/ipfs/${(await unixfs({ blockstore: session }).stat(rootCid, {
7023
+ path: subPathSegments.length > 0 ? subPathSegments.join("/") : void 0,
7024
+ signal: controller.signal
7025
+ })).cid.toString()}`;
7026
+ } catch (e) {
7027
+ if (controller.signal.aborted) throw controller.signal.reason instanceof Error ? controller.signal.reason : e;
7028
+ if (!isCausedByInsufficientProviders(e)) throw e;
7029
+ log.trace("Bitswap session found no providers for", ipfsPath, "- retrying, attempt", attempt + 1);
7030
+ } finally {
7031
+ session.close();
7032
+ }
7033
+ await delayAbortable(Math.min(SESSION_NO_PROVIDERS_RETRY_BASE_DELAY_MS * 2 ** attempt, 8e3), controller.signal);
7034
+ if (controller.signal.aborted) {
7035
+ if (controller.signal.reason instanceof Error) throw controller.signal.reason;
7036
+ throw new PKCError("ERR_FETCH_CID_P2P_TIMEOUT", {
7037
+ ipfsPath,
7038
+ timeoutMs
7039
+ });
7040
+ }
7041
+ }
7042
+ } finally {
7043
+ if (timeoutTimer) clearTimeout(timeoutTimer);
7044
+ callerSignal?.removeEventListener("abort", abortFromCaller);
7045
+ catStopController.signal.removeEventListener("abort", abortFromStop);
7046
+ }
7047
+ },
6994
7048
  async add(entry, options) {
6995
7049
  throw Error("Helia 'add' is not supported at the moment in pkc-js API");
6996
7050
  },
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.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";
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-LwSS90AE.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-SmLDPm1j.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-2FkqYYNf.js";
5
5
  import { randomFillSync, randomUUID } from "node:crypto";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import path from "node:path";
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-WFQoW5aC.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-B79BAYRo.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };