@pkcprotocol/pkc-js 0.0.150 → 0.0.152
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.
- package/README.md +7 -7
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -1
- package/dist/browser/clients/rpc-client/schema.d.ts +1 -1
- package/dist/browser/clients/rpc-client/schema.js +2 -2
- package/dist/browser/clients/rpc-client/schema.js.map +1 -1
- package/dist/browser/community/schema.d.ts +3 -0
- package/dist/browser/community/schema.js +3 -0
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/helia/helia-for-pkc.js +70 -1
- package/dist/browser/helia/helia-for-pkc.js.map +1 -1
- package/dist/browser/index-with-compile-cache.d.ts +2 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/pkc/pkc.js +19 -5
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/publications/comment/comment.d.ts +3 -1
- package/dist/browser/publications/comment/comment.js +40 -28
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/publications/comment/schema.d.ts +3 -3
- package/dist/browser/publications/comment-edit/schema.d.ts +3 -3
- package/dist/browser/publications/comment-moderation/schema.d.ts +3 -3
- package/dist/browser/publications/community-edit/schema.d.ts +3 -3
- package/dist/browser/publications/vote/schema.d.ts +3 -3
- package/dist/browser/pubsub-messages/schema.d.ts +3 -3
- package/dist/browser/pubsub-messages/schema.js +6 -3
- package/dist/browser/pubsub-messages/schema.js.map +1 -1
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +1 -0
- package/dist/browser/rpc/src/schema.d.ts +6 -0
- package/dist/browser/runtime/node/community/challenges/index.d.ts +1 -1
- package/dist/browser/runtime/node/community/challenges/index.js +9 -3
- package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/question.js +1 -2
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/question.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/challenges.d.ts +2 -2
- package/dist/browser/runtime/node/community/local-community/challenges.js +1 -1
- package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +5 -5
- package/dist/browser/schema/schema.d.ts +2 -2
- package/dist/browser/schema/schema.js +7 -2
- package/dist/browser/schema/schema.js.map +1 -1
- package/dist/browser/schema.d.ts +8 -0
- package/dist/browser/test/test-util.d.ts +1 -1
- package/dist/browser/test/test-util.js +3 -2
- package/dist/browser/test/test-util.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +34 -34
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc-1sdkdugl.js → helia-for-pkc-DSBGaWoX.js} +83 -34
- package/dist/bundled/chunks/{local-community-BGml0_JD.js → local-community-CKRKoJii.js} +1 -1
- package/dist/bundled/chunks/{local-community-Dadvhqoi.js → local-community-nvuF7v2h.js} +36 -36
- package/dist/bundled/chunks/{node-DOdTF4o2.js → node-POly7vn3.js} +43 -26
- package/dist/bundled/chunks/{page-sort-scoring-DozAWSgg.js → page-sort-scoring-B12LzU3B.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-DaCMetml.js → rpc-local-community-BpvBPdXg.js} +13 -7
- package/dist/bundled/chunks/{util-B9XQRGR7.js → util-BjNpPYD5.js} +1 -1
- package/dist/bundled/chunks/{util-BUFRgvXt.js → util-sMOCDTgY.js} +7 -6
- package/dist/bundled/chunks/{validate-package-factories-NPflVcyZ.js → validate-package-factories-DC853tZf.js} +2 -2
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/page-sorts.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -1
- package/dist/node/clients/rpc-client/schema.d.ts +1 -1
- package/dist/node/clients/rpc-client/schema.js +2 -2
- package/dist/node/clients/rpc-client/schema.js.map +1 -1
- package/dist/node/community/schema.d.ts +3 -0
- package/dist/node/community/schema.js +3 -0
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/helia/helia-for-pkc.js +70 -1
- package/dist/node/helia/helia-for-pkc.js.map +1 -1
- package/dist/node/index-with-compile-cache.d.ts +2 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/pkc/pkc.js +19 -5
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/publications/comment/comment.d.ts +3 -1
- package/dist/node/publications/comment/comment.js +40 -28
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/publications/comment/schema.d.ts +3 -3
- package/dist/node/publications/comment-edit/schema.d.ts +3 -3
- package/dist/node/publications/comment-moderation/schema.d.ts +3 -3
- package/dist/node/publications/community-edit/schema.d.ts +3 -3
- package/dist/node/publications/vote/schema.d.ts +3 -3
- package/dist/node/pubsub-messages/schema.d.ts +3 -3
- package/dist/node/pubsub-messages/schema.js +6 -3
- package/dist/node/pubsub-messages/schema.js.map +1 -1
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +1 -0
- package/dist/node/rpc/src/schema.d.ts +6 -0
- package/dist/node/runtime/node/community/challenges/index.d.ts +1 -1
- package/dist/node/runtime/node/community/challenges/index.js +9 -3
- package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/question.js +1 -2
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/question.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/challenges.d.ts +2 -2
- package/dist/node/runtime/node/community/local-community/challenges.js +1 -1
- package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +5 -5
- package/dist/node/schema/schema.d.ts +2 -2
- package/dist/node/schema/schema.js +7 -2
- package/dist/node/schema/schema.js.map +1 -1
- package/dist/node/schema.d.ts +8 -0
- package/dist/node/test/test-util.d.ts +1 -1
- package/dist/node/test/test-util.js +3 -2
- package/dist/node/test/test-util.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-
|
|
1
|
+
import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-DC853tZf.js";
|
|
2
2
|
export { validateChallengeFileFactory };
|
|
@@ -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, Lr as PKCError, T as ipnsNameToIpnsOverPubsubTopic, n as binaryKeyToPubsubTopic, zr as logger_default } from "./util-
|
|
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-
|
|
2
|
+
import { C as hideClassPrivateProps, Lr as PKCError, T as ipnsNameToIpnsOverPubsubTopic, n as binaryKeyToPubsubTopic, zr as logger_default } from "./util-sMOCDTgY.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-BjNpPYD5.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
|
|
9
|
-
import path
|
|
8
|
+
import Path, { basename, dirname, join } from "node:path";
|
|
9
|
+
import path 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";
|
|
@@ -152,7 +152,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
152
152
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
153
153
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
154
154
|
const os$1 = __require("os");
|
|
155
|
-
const path$
|
|
155
|
+
const path$9 = __require("path");
|
|
156
156
|
const IS_WINDOWS_PLATFORM = os$1.platform() === "win32";
|
|
157
157
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
158
158
|
/**
|
|
@@ -181,7 +181,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
181
181
|
}
|
|
182
182
|
exports.unixify = unixify;
|
|
183
183
|
function makeAbsolute(cwd, filepath) {
|
|
184
|
-
return path$
|
|
184
|
+
return path$9.resolve(cwd, filepath);
|
|
185
185
|
}
|
|
186
186
|
exports.makeAbsolute = makeAbsolute;
|
|
187
187
|
function removeLeadingDotSegment(entry) {
|
|
@@ -1433,7 +1433,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1433
1433
|
//#endregion
|
|
1434
1434
|
//#region node_modules/picomatch/lib/constants.js
|
|
1435
1435
|
var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1436
|
-
const path$
|
|
1436
|
+
const path$8 = __require("path");
|
|
1437
1437
|
const WIN_SLASH = "\\\\/";
|
|
1438
1438
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1439
1439
|
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
@@ -1558,7 +1558,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1558
1558
|
CHAR_UNDERSCORE: 95,
|
|
1559
1559
|
CHAR_VERTICAL_LINE: 124,
|
|
1560
1560
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1561
|
-
SEP: path$
|
|
1561
|
+
SEP: path$8.sep,
|
|
1562
1562
|
/**
|
|
1563
1563
|
* Create EXTGLOB_CHARS
|
|
1564
1564
|
*/
|
|
@@ -1602,7 +1602,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1602
1602
|
//#endregion
|
|
1603
1603
|
//#region node_modules/picomatch/lib/utils.js
|
|
1604
1604
|
var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1605
|
-
const path$
|
|
1605
|
+
const path$7 = __require("path");
|
|
1606
1606
|
const win32 = process.platform === "win32";
|
|
1607
1607
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
|
|
1608
1608
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -1622,7 +1622,7 @@ var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1622
1622
|
};
|
|
1623
1623
|
exports.isWindows = (options) => {
|
|
1624
1624
|
if (options && typeof options.windows === "boolean") return options.windows;
|
|
1625
|
-
return win32 === true || path$
|
|
1625
|
+
return win32 === true || path$7.sep === "\\";
|
|
1626
1626
|
};
|
|
1627
1627
|
exports.escapeLast = (input, char, lastIdx) => {
|
|
1628
1628
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -2992,7 +2992,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2992
2992
|
//#endregion
|
|
2993
2993
|
//#region node_modules/picomatch/lib/picomatch.js
|
|
2994
2994
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2995
|
-
const path$
|
|
2995
|
+
const path$6 = __require("path");
|
|
2996
2996
|
const scan = require_scan();
|
|
2997
2997
|
const parse = require_parse();
|
|
2998
2998
|
const utils = require_utils$2();
|
|
@@ -3131,7 +3131,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3131
3131
|
* @api public
|
|
3132
3132
|
*/
|
|
3133
3133
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
3134
|
-
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$
|
|
3134
|
+
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$6.basename(input));
|
|
3135
3135
|
};
|
|
3136
3136
|
/**
|
|
3137
3137
|
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
@@ -3686,7 +3686,7 @@ var require_micromatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3686
3686
|
var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3687
3687
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3688
3688
|
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;
|
|
3689
|
-
const path$
|
|
3689
|
+
const path$5 = __require("path");
|
|
3690
3690
|
const globParent = require_glob_parent();
|
|
3691
3691
|
const micromatch = require_micromatch();
|
|
3692
3692
|
const GLOBSTAR = "**";
|
|
@@ -3794,7 +3794,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3794
3794
|
}
|
|
3795
3795
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
3796
3796
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
3797
|
-
const basename = path$
|
|
3797
|
+
const basename = path$5.basename(pattern);
|
|
3798
3798
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
3799
3799
|
}
|
|
3800
3800
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -3868,7 +3868,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3868
3868
|
}
|
|
3869
3869
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
3870
3870
|
function isAbsolute(pattern) {
|
|
3871
|
-
return path$
|
|
3871
|
+
return path$5.isAbsolute(pattern);
|
|
3872
3872
|
}
|
|
3873
3873
|
exports.isAbsolute = isAbsolute;
|
|
3874
3874
|
}));
|
|
@@ -4496,7 +4496,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4496
4496
|
//#region node_modules/@nodelib/fs.scandir/out/settings.js
|
|
4497
4497
|
var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4498
4498
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4499
|
-
const path$
|
|
4499
|
+
const path$4 = __require("path");
|
|
4500
4500
|
const fsStat = require_out$3();
|
|
4501
4501
|
const fs = require_fs();
|
|
4502
4502
|
var Settings = class {
|
|
@@ -4504,7 +4504,7 @@ var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4504
4504
|
this._options = _options;
|
|
4505
4505
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
4506
4506
|
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
4507
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
4507
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
|
|
4508
4508
|
this.stats = this._getValue(this._options.stats, false);
|
|
4509
4509
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
4510
4510
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -5098,7 +5098,7 @@ var require_sync$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5098
5098
|
//#region node_modules/@nodelib/fs.walk/out/settings.js
|
|
5099
5099
|
var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5100
5100
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5101
|
-
const path$
|
|
5101
|
+
const path$3 = __require("path");
|
|
5102
5102
|
const fsScandir = require_out$2();
|
|
5103
5103
|
var Settings = class {
|
|
5104
5104
|
constructor(_options = {}) {
|
|
@@ -5108,7 +5108,7 @@ var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5108
5108
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
5109
5109
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
5110
5110
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
5111
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
5111
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
|
|
5112
5112
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
5113
5113
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
5114
5114
|
fs: this._options.fs,
|
|
@@ -5160,7 +5160,7 @@ var require_out$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5160
5160
|
//#region node_modules/fast-glob/out/readers/reader.js
|
|
5161
5161
|
var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5162
5162
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5163
|
-
const path$
|
|
5163
|
+
const path$2 = __require("path");
|
|
5164
5164
|
const fsStat = require_out$3();
|
|
5165
5165
|
const utils = require_utils$1();
|
|
5166
5166
|
var Reader = class {
|
|
@@ -5173,7 +5173,7 @@ var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5173
5173
|
});
|
|
5174
5174
|
}
|
|
5175
5175
|
_getFullEntryPath(filepath) {
|
|
5176
|
-
return path$
|
|
5176
|
+
return path$2.resolve(this._settings.cwd, filepath);
|
|
5177
5177
|
}
|
|
5178
5178
|
_makeEntry(stats, pattern) {
|
|
5179
5179
|
const entry = {
|
|
@@ -5508,7 +5508,7 @@ var require_entry = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5508
5508
|
//#region node_modules/fast-glob/out/providers/provider.js
|
|
5509
5509
|
var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5510
5510
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5511
|
-
const path$
|
|
5511
|
+
const path$1 = __require("path");
|
|
5512
5512
|
const deep_1 = require_deep();
|
|
5513
5513
|
const entry_1 = require_entry$1();
|
|
5514
5514
|
const error_1 = require_error();
|
|
@@ -5522,7 +5522,7 @@ var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5522
5522
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
5523
5523
|
}
|
|
5524
5524
|
_getRootDirectory(task) {
|
|
5525
|
-
return path$
|
|
5525
|
+
return path$1.resolve(this._settings.cwd, task.base);
|
|
5526
5526
|
}
|
|
5527
5527
|
_getReaderOptions(task) {
|
|
5528
5528
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -5853,7 +5853,7 @@ var import_out = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((export
|
|
|
5853
5853
|
* Async iterable filename pattern matcher
|
|
5854
5854
|
*/
|
|
5855
5855
|
async function* glob(dir, pattern, options = {}) {
|
|
5856
|
-
const absoluteDir =
|
|
5856
|
+
const absoluteDir = Path.resolve(dir);
|
|
5857
5857
|
const stats = await fsp.stat(absoluteDir);
|
|
5858
5858
|
for await (const entry of import_out.default.stream(pattern, {
|
|
5859
5859
|
...options,
|
|
@@ -6023,7 +6023,7 @@ var NextToLast = class {
|
|
|
6023
6023
|
};
|
|
6024
6024
|
}
|
|
6025
6025
|
decode(str) {
|
|
6026
|
-
let fileName =
|
|
6026
|
+
let fileName = Path.basename(str);
|
|
6027
6027
|
if (fileName.endsWith(this.extension)) fileName = fileName.substring(0, fileName.length - this.extension.length);
|
|
6028
6028
|
return CID.decode(this.base.decoder.decode(fileName));
|
|
6029
6029
|
}
|
|
@@ -6049,7 +6049,7 @@ var NextToLast = class {
|
|
|
6049
6049
|
async function writeFile$1(file, contents, options) {
|
|
6050
6050
|
try {
|
|
6051
6051
|
options?.signal?.throwIfAborted();
|
|
6052
|
-
await raceSignal(fsp.mkdir(
|
|
6052
|
+
await raceSignal(fsp.mkdir(Path.dirname(file), { recursive: true }), options?.signal);
|
|
6053
6053
|
const writer = new Writer(file);
|
|
6054
6054
|
options?.signal?.throwIfAborted();
|
|
6055
6055
|
await writer.write(contents);
|
|
@@ -6074,7 +6074,7 @@ var FsBlockstore = class {
|
|
|
6074
6074
|
deleteManyConcurrency;
|
|
6075
6075
|
shardingStrategy;
|
|
6076
6076
|
constructor(location, init = {}) {
|
|
6077
|
-
this.path =
|
|
6077
|
+
this.path = Path.resolve(location);
|
|
6078
6078
|
this.createIfMissing = init.createIfMissing ?? true;
|
|
6079
6079
|
this.errorIfExists = init.errorIfExists ?? false;
|
|
6080
6080
|
this.deleteManyConcurrency = init.deleteManyConcurrency ?? 50;
|
|
@@ -6100,7 +6100,7 @@ var FsBlockstore = class {
|
|
|
6100
6100
|
async put(key, val, options) {
|
|
6101
6101
|
const { dir, file } = this.shardingStrategy.encode(key);
|
|
6102
6102
|
try {
|
|
6103
|
-
await writeFile$1(
|
|
6103
|
+
await writeFile$1(Path.join(this.path, dir, file), val, options);
|
|
6104
6104
|
return key;
|
|
6105
6105
|
} catch (err) {
|
|
6106
6106
|
throw new PutFailedError(String(err));
|
|
@@ -6119,7 +6119,7 @@ var FsBlockstore = class {
|
|
|
6119
6119
|
let handle;
|
|
6120
6120
|
try {
|
|
6121
6121
|
options?.signal?.throwIfAborted();
|
|
6122
|
-
handle = await raceSignal(fsp.open(
|
|
6122
|
+
handle = await raceSignal(fsp.open(Path.join(this.path, dir, file)), options?.signal);
|
|
6123
6123
|
yield* handle.createReadStream();
|
|
6124
6124
|
} catch (err) {
|
|
6125
6125
|
if (handle != null) await raceSignal(handle.close(), options?.signal);
|
|
@@ -6140,7 +6140,7 @@ var FsBlockstore = class {
|
|
|
6140
6140
|
const { dir, file } = this.shardingStrategy.encode(key);
|
|
6141
6141
|
try {
|
|
6142
6142
|
options?.signal?.throwIfAborted();
|
|
6143
|
-
await raceSignal(fsp.unlink(
|
|
6143
|
+
await raceSignal(fsp.unlink(Path.join(this.path, dir, file)), options?.signal);
|
|
6144
6144
|
} catch (err) {
|
|
6145
6145
|
if (err.code === "ENOENT") return;
|
|
6146
6146
|
throw new DeleteFailedError(String(err));
|
|
@@ -6158,14 +6158,14 @@ var FsBlockstore = class {
|
|
|
6158
6158
|
const { dir, file } = this.shardingStrategy.encode(key);
|
|
6159
6159
|
try {
|
|
6160
6160
|
options?.signal?.throwIfAborted();
|
|
6161
|
-
await raceSignal(fsp.access(
|
|
6161
|
+
await raceSignal(fsp.access(Path.join(this.path, dir, file)), options?.signal);
|
|
6162
6162
|
} catch (err) {
|
|
6163
6163
|
return false;
|
|
6164
6164
|
}
|
|
6165
6165
|
return true;
|
|
6166
6166
|
}
|
|
6167
6167
|
async *getAll(options) {
|
|
6168
|
-
const pattern = `**/*${this.shardingStrategy.extension}`.split(
|
|
6168
|
+
const pattern = `**/*${this.shardingStrategy.extension}`.split(Path.sep).join("/");
|
|
6169
6169
|
const files = glob(this.path, pattern, { absolute: true });
|
|
6170
6170
|
for await (const file of files) try {
|
|
6171
6171
|
options?.signal?.throwIfAborted();
|
|
@@ -6217,7 +6217,7 @@ async function createBlockstoreForLibp2pJsClient({ dataPath, key }) {
|
|
|
6217
6217
|
defaultMaxBytes: DEFAULT_IN_MEMORY_BLOCKSTORE_MAX_BYTES,
|
|
6218
6218
|
close: async () => {}
|
|
6219
6219
|
};
|
|
6220
|
-
const store = new FsBlockstore(path
|
|
6220
|
+
const store = new FsBlockstore(path.join(dataPath, "blockstore", key));
|
|
6221
6221
|
await store.open();
|
|
6222
6222
|
return {
|
|
6223
6223
|
blockstore: store,
|
|
@@ -6661,6 +6661,53 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
|
|
|
6661
6661
|
}, ms);
|
|
6662
6662
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
6663
6663
|
});
|
|
6664
|
+
const createNoProvidersRetryWaiter = (rootCid, signal) => {
|
|
6665
|
+
let wantController;
|
|
6666
|
+
let rootBlockArrived;
|
|
6667
|
+
let arrived = false;
|
|
6668
|
+
let earlyWakeUsed = false;
|
|
6669
|
+
const abortWant = () => wantController?.abort(signal.reason);
|
|
6670
|
+
const startWant = () => {
|
|
6671
|
+
wantController = new AbortController();
|
|
6672
|
+
if (signal.aborted) abortWant();
|
|
6673
|
+
else signal.addEventListener("abort", abortWant, { once: true });
|
|
6674
|
+
const wantSignal = wantController.signal;
|
|
6675
|
+
rootBlockArrived = (async () => {
|
|
6676
|
+
for await (const _chunk of helia.blockstore.get(rootCid, { signal: wantSignal }));
|
|
6677
|
+
arrived = true;
|
|
6678
|
+
})().catch((error) => {
|
|
6679
|
+
if (!wantSignal.aborted) log.trace("Broadcast want for", String(rootCid), "failed, keeping the retry backoff", error);
|
|
6680
|
+
return new Promise(() => {});
|
|
6681
|
+
});
|
|
6682
|
+
};
|
|
6683
|
+
return {
|
|
6684
|
+
async wait(attempt) {
|
|
6685
|
+
const delayMs = Math.min(SESSION_NO_PROVIDERS_RETRY_BASE_DELAY_MS * 2 ** attempt, 8e3);
|
|
6686
|
+
if (signal.aborted) return;
|
|
6687
|
+
if (!rootBlockArrived) startWant();
|
|
6688
|
+
if (earlyWakeUsed) return delayAbortable(delayMs, signal);
|
|
6689
|
+
if (!arrived) {
|
|
6690
|
+
const endDelay = new AbortController();
|
|
6691
|
+
const endDelayOnAbort = () => endDelay.abort();
|
|
6692
|
+
signal.addEventListener("abort", endDelayOnAbort, { once: true });
|
|
6693
|
+
try {
|
|
6694
|
+
await Promise.race([delayAbortable(delayMs, endDelay.signal), rootBlockArrived]);
|
|
6695
|
+
} finally {
|
|
6696
|
+
signal.removeEventListener("abort", endDelayOnAbort);
|
|
6697
|
+
endDelay.abort();
|
|
6698
|
+
}
|
|
6699
|
+
}
|
|
6700
|
+
if (arrived) {
|
|
6701
|
+
earlyWakeUsed = true;
|
|
6702
|
+
log.trace("Root block", String(rootCid), "arrived through the broadcast want, retrying the session now");
|
|
6703
|
+
}
|
|
6704
|
+
},
|
|
6705
|
+
stop() {
|
|
6706
|
+
signal.removeEventListener("abort", abortWant);
|
|
6707
|
+
wantController?.abort();
|
|
6708
|
+
}
|
|
6709
|
+
};
|
|
6710
|
+
};
|
|
6664
6711
|
const createSeededBitswapSession = (rootCid, scopeIpnsPubsubTopic) => {
|
|
6665
6712
|
const session = helia.blockstore.createSession(rootCid, { providers: getBitswapSessionSeedPeers(scopeIpnsPubsubTopic).map((peerId) => peerId.toCID()) });
|
|
6666
6713
|
const sessionGet = session.get.bind(session);
|
|
@@ -6958,6 +7005,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
|
|
|
6958
7005
|
ipfsPath,
|
|
6959
7006
|
timeoutMs
|
|
6960
7007
|
})), timeoutMs) : void 0;
|
|
7008
|
+
const noProvidersRetryWaiter = createNoProvidersRetryWaiter(rootCid, controller.signal);
|
|
6961
7009
|
try {
|
|
6962
7010
|
for (let attempt = 0;; attempt++) {
|
|
6963
7011
|
const session = createSeededBitswapSession(rootCid, bitswapSessionSeedScopeIpnsPubsubTopic);
|
|
@@ -6980,7 +7028,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
|
|
|
6980
7028
|
} finally {
|
|
6981
7029
|
session.close();
|
|
6982
7030
|
}
|
|
6983
|
-
await
|
|
7031
|
+
await noProvidersRetryWaiter.wait(attempt);
|
|
6984
7032
|
if (controller.signal.aborted) {
|
|
6985
7033
|
if (controller.signal.reason instanceof Error) throw controller.signal.reason;
|
|
6986
7034
|
throw new PKCError("ERR_FETCH_CID_P2P_TIMEOUT", {
|
|
@@ -6990,6 +7038,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
|
|
|
6990
7038
|
}
|
|
6991
7039
|
}
|
|
6992
7040
|
} finally {
|
|
7041
|
+
noProvidersRetryWaiter.stop();
|
|
6993
7042
|
if (timeoutTimer !== void 0) clearTimeout(timeoutTimer);
|
|
6994
7043
|
callerSignal?.removeEventListener("abort", abortFromCallerSignal);
|
|
6995
7044
|
stopController.signal.removeEventListener("abort", abortFromStop);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-
|
|
1
|
+
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-nvuF7v2h.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { i as __toESM } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, B as pubsubTopicToDhtKey, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeBlocksFromKuboNode, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, J as removeNullUndefinedValues, Jt as version_default, K as removeMfsFilesSafely, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as withSortedKeysDeep, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, o as calculateUnixFsDagSizeCidV0, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-
|
|
3
|
-
import { $ as createSchemaRowParser, $r as require_lodash_merge, An as verifyChallengeAnswer, Ar as removeFileRetryingWhileBusy, Bn as verifyCommunityEdit, Br as t$11, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Hn as verifyVote, Hr as t$8, In as verifyCommentModeration, Kn as getAuthorNameFromWire, Kr as t$9, Ln as verifyCommentPubsubMessage, Lr as isCommunityStartLocked, Mn as verifyChallengeRequest, N as MAX_PAGE_SIZE_BYTES, Or as moveCommunityDbToDeletedDirectory, Pn as verifyCommentEdit, Pr as findCommunitiesEntry, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Qr as STORAGE_KEYS, Rn as verifyCommentUpdate, Rr as require_src, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Sr as getDefaultCommunityDbConfig, Tn as signCommentUpdateForChallengeVerification, Tr as importSignerIntoKuboNode, Un as buildRuntimeAuthor, Ur as n$5, Vr as r$2, W as pLimit, Wn as cleanWireAuthor, Wr as n$4, X as coerceSchemaRowBoolean, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, jr as resolveDbPostsCidRefs, kr as refreshCommunitiesList, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, qr as stringify, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as getThumbnailPropsOfLink, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as forgetCommunityThatFailedToBeDeleted, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as t$10 } from "./rpc-local-community-
|
|
4
|
-
import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-
|
|
2
|
+
import { $n as CommentEditsTableRowSchema, At as ChallengeAnswerMessageSchema, B as pubsubTopicToDhtKey, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Ct as trackUpdatingCommunity, Dt as require_sha256, En as VotePubsubReservedFields, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeBlocksFromKuboNode, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, J as removeNullUndefinedValues, Jt as version_default, K as removeMfsFilesSafely, Lr as PKCError, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, On as VoteTablesRowSchema, Or as t$4, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Rr as messages, Sr as e, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Tr as t$3, Vn as CommentUpdateTableRowSchema, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Zn as CommentEditReservedFields, _ as genToArray, _r as t$7, b as getIpnsRecordInLocalKuboNode, br as t$6, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as n$3, hr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as require_retry, kr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as withSortedKeysDeep, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, o as calculateUnixFsDagSizeCidV0, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, ti as ZodError, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$2, wr as r$1, wt as untrackStartedCommunity, xr as e$1, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$5, zn as CommentUpdateSchema, zr as logger_default, zt as DecryptedChallengeRequestPublicationSchema } from "./util-sMOCDTgY.js";
|
|
3
|
+
import { $ as createSchemaRowParser, $r as require_lodash_merge, An as verifyChallengeAnswer, Ar as removeFileRetryingWhileBusy, Bn as verifyCommunityEdit, Br as t$11, Dt as parseJsonWithPKCErrorIfFails, En as signCommunity, Fn as verifyCommentIpfs, Hn as verifyVote, Hr as t$8, In as verifyCommentModeration, Kn as getAuthorNameFromWire, Kr as t$9, Ln as verifyCommentPubsubMessage, Lr as isCommunityStartLocked, Mn as verifyChallengeRequest, N as MAX_PAGE_SIZE_BYTES, Or as moveCommunityDbToDeletedDirectory, Pn as verifyCommentEdit, Pr as findCommunitiesEntry, Q as collectSchemaRowCoercions, Qn as effectiveMaxCrosspostDepth, Qr as STORAGE_KEYS, Rn as verifyCommentUpdate, Rr as require_src, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sn as signCommentEdit, Sr as getDefaultCommunityDbConfig, Tn as signCommentUpdateForChallengeVerification, Tr as importSignerIntoKuboNode, Un as buildRuntimeAuthor, Ur as n$5, Vr as r$2, W as pLimit, Wn as cleanWireAuthor, Wr as n$4, X as coerceSchemaRowBoolean, Z as coerceSchemaRowJson, Zn as crosspostChainDepthUpTo, _ as createAuthorIdentityMatcher, _r as deriveCommentIpfsFromCommentTableRow, a as generatePagesReportingFailedSorts, ar as encode, b as KeyvBetterSqlite3, bn as signChallengeVerification, c as resolvePageSortsOrThrow, cn as SignerWithPublicKeyAddress, cr as getPKCAddressFromPublicKey, d as getChallengeVerification, dr as BackupAbortError, dt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, f as getCommunityChallengeFromCommunityChallengeSettings, fn as decryptEd25519AesGcmPublicKeyBuffer, fr as backupCommunityDb, g as authorNameResolveFailureReason, gn as cleanUpBeforePublishing, gr as deleteOldCommunityInWindows, h as authorIdentityMatcherForRequest, hn as _validateSignatureOfPKCRecord, i as derivePublicPageSorts, ir as decode, j as iterateOverPageCidsToFindAllCids, jr as resolveDbPostsCidRefs, kr as refreshCommunitiesList, lr as getPKCAddressFromPublicKeySync, m as pkcJsChallenges, mn as encryptEd25519AesGcmPublicKeyBuffer, mr as calculateInlineRepliesBudget, nr as getCommunityPublicKeyFromWire, o as loadPageSortsForStartedCommunity, p as loadChallengeFileFromCommunityChallengeSettings, pr as calculateExpectedSignatureSize, pt as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, qr as stringify, r as computePageSortsFingerprint, s as lookupPageSortFactories, sr as getIpfsKeyFromPrivateKey, t as RpcLocalCommunity, tr as getCommunityNameFromWire, u as deriveCommunityChallengesOrThrow, ur as getPublicKeyFromPrivateKey, v as TrackedInstanceRegistry, vn as signChallengeMessage, vr as deriveDbPosts, w as TIMEFRAMES_TO_SECONDS, wn as signCommentUpdate, wr as getThumbnailPropsOfLink, wt as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, xn as signComment, xr as forgetCommunityThatFailedToBeDeleted, y as LRUCache, yr as deriveDbReplies, zn as verifyCommunity, zr as t$10 } from "./rpc-local-community-BpvBPdXg.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-B12LzU3B.js";
|
|
5
5
|
import { c as prepare, n as decode$1, r as encode$1 } from "./src-BSYNGtIQ.js";
|
|
6
6
|
import { t as UnixFS } from "./src-CAvdjq_i.js";
|
|
7
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
-
import
|
|
8
|
+
import Path from "node:path";
|
|
9
9
|
import os from "os";
|
|
10
10
|
import fs, { closeSync, existsSync, openSync, promises } from "node:fs";
|
|
11
|
-
import path
|
|
11
|
+
import path from "path";
|
|
12
12
|
import assert from "assert";
|
|
13
13
|
import { Buffer as Buffer$1 } from "buffer";
|
|
14
14
|
import fs$1 from "fs";
|
|
@@ -320,15 +320,15 @@ async function throwIfChallengeSettingsAreInvalid({ challengeSettings, pkc, comm
|
|
|
320
320
|
const processStartedCommunities = new TrackedInstanceRegistry();
|
|
321
321
|
function normalizeRegistryDataPath(dataPath) {
|
|
322
322
|
if (dataPath === void 0) return void 0;
|
|
323
|
-
const resolved = path
|
|
323
|
+
const resolved = path.resolve(dataPath);
|
|
324
324
|
let existing = resolved;
|
|
325
325
|
let tail = "";
|
|
326
326
|
while (true) try {
|
|
327
|
-
return path
|
|
327
|
+
return path.join(fs$1.realpathSync.native(existing), tail);
|
|
328
328
|
} catch {
|
|
329
|
-
const parent = path
|
|
329
|
+
const parent = path.dirname(existing);
|
|
330
330
|
if (parent === existing) return resolved;
|
|
331
|
-
tail = path
|
|
331
|
+
tail = path.join(path.basename(existing), tail);
|
|
332
332
|
existing = parent;
|
|
333
333
|
}
|
|
334
334
|
}
|
|
@@ -1796,9 +1796,9 @@ var DbHandler = class {
|
|
|
1796
1796
|
if (needToMigrate) {
|
|
1797
1797
|
if (dbExistsAlready && currentDbVersion > 0) {
|
|
1798
1798
|
this.destoryConnection();
|
|
1799
|
-
backupDbPath = path
|
|
1800
|
-
log(`Copying db ${path
|
|
1801
|
-
if (!fs$1.existsSync(path
|
|
1799
|
+
backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
1800
|
+
log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
1801
|
+
if (!fs$1.existsSync(path.dirname(backupDbPath))) await fs$1.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
|
|
1802
1802
|
const sourceDb = new Database(dbPath, { fileMustExist: true });
|
|
1803
1803
|
await sourceDb.backup(backupDbPath);
|
|
1804
1804
|
sourceDb.close();
|
|
@@ -3869,10 +3869,10 @@ var DbHandler = class {
|
|
|
3869
3869
|
if (this._db || this._keyv) await this.destoryConnection();
|
|
3870
3870
|
this._transactionDepth = 0;
|
|
3871
3871
|
const dataPath = this._community._pkc.dataPath;
|
|
3872
|
-
const oldPathString = path
|
|
3873
|
-
const newPathString = path
|
|
3874
|
-
await fs$1.promises.mkdir(path
|
|
3875
|
-
await fs$1.promises.mkdir(path
|
|
3872
|
+
const oldPathString = path.join(dataPath, "communities", oldDbName);
|
|
3873
|
+
const newPathString = path.join(dataPath, "communities", newDbName);
|
|
3874
|
+
await fs$1.promises.mkdir(path.dirname(oldPathString), { recursive: true });
|
|
3875
|
+
await fs$1.promises.mkdir(path.dirname(newPathString), { recursive: true });
|
|
3876
3876
|
try {
|
|
3877
3877
|
if (!fs$1.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
|
|
3878
3878
|
else {
|
|
@@ -3899,8 +3899,8 @@ var DbHandler = class {
|
|
|
3899
3899
|
async lockCommunityStart({ onCompromised }) {
|
|
3900
3900
|
const log = logger_default("pkc-js:local-community:db-handler:lock:start");
|
|
3901
3901
|
const communityAddress = this._community.address;
|
|
3902
|
-
const lockfilePath = path
|
|
3903
|
-
const communityDbPath = path
|
|
3902
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3903
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3904
3904
|
const startLock = {};
|
|
3905
3905
|
try {
|
|
3906
3906
|
await import_src.default.lock(communityDbPath, {
|
|
@@ -3929,8 +3929,8 @@ var DbHandler = class {
|
|
|
3929
3929
|
const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
|
|
3930
3930
|
log.trace(`Attempting to unlock the start of community (${communityAddress})`);
|
|
3931
3931
|
this._heldStartLock = void 0;
|
|
3932
|
-
const lockfilePath = path
|
|
3933
|
-
const communityDbPath = path
|
|
3932
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
3933
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
3934
3934
|
if (!fs$1.existsSync(lockfilePath) || !fs$1.existsSync(communityDbPath)) return;
|
|
3935
3935
|
try {
|
|
3936
3936
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -3948,8 +3948,8 @@ var DbHandler = class {
|
|
|
3948
3948
|
}
|
|
3949
3949
|
async lockCommunityState() {
|
|
3950
3950
|
const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
|
|
3951
|
-
const lockfilePath = path
|
|
3952
|
-
const communityDbPath = path
|
|
3951
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3952
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3953
3953
|
try {
|
|
3954
3954
|
await import_src.default.lock(communityDbPath, {
|
|
3955
3955
|
lockfilePath,
|
|
@@ -3966,8 +3966,8 @@ var DbHandler = class {
|
|
|
3966
3966
|
}
|
|
3967
3967
|
async unlockCommunityState() {
|
|
3968
3968
|
const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
|
|
3969
|
-
const lockfilePath = path
|
|
3970
|
-
const communityDbPath = path
|
|
3969
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
3970
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3971
3971
|
if (!fs$1.existsSync(lockfilePath)) return;
|
|
3972
3972
|
try {
|
|
3973
3973
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -3977,7 +3977,7 @@ var DbHandler = class {
|
|
|
3977
3977
|
}
|
|
3978
3978
|
}
|
|
3979
3979
|
communityDbExists() {
|
|
3980
|
-
const communityDbPath = path
|
|
3980
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
3981
3981
|
return fs$1.existsSync(communityDbPath);
|
|
3982
3982
|
}
|
|
3983
3983
|
markCommentsAsPublishedToPostUpdates(commentCids) {
|
|
@@ -5068,7 +5068,7 @@ async function publishChallenges(community, challenges, request) {
|
|
|
5068
5068
|
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("publishing-challenge");
|
|
5069
5069
|
const challengeTopic = challengeExchangePubsubTopic(community);
|
|
5070
5070
|
if (challengeTopic && !community._challengeExchangesFromLocalPublishers[request.challengeRequestId.toString()]) await community._clientsManager.pubsubPublish(challengeTopic, challengeMessage);
|
|
5071
|
-
log(`Community ${community.address} with pubsub topic ${challengeTopic} published ${challengeMessage.type} over pubsub: `, t$10(toSignChallenge, ["timestamp"]), toEncryptChallenge.challenges.map((challenge) => challenge.type));
|
|
5071
|
+
log(`Community ${community.address} with pubsub topic ${challengeTopic} published ${challengeMessage.type} over pubsub: `, t$10(toSignChallenge, ["timestamp"]), Object.values(toEncryptChallenge.challenges).map((challenge) => challenge.type));
|
|
5072
5072
|
community._clientsManager.updateKuboRpcPubsubStateIfProviderExists("waiting-challenge-answers");
|
|
5073
5073
|
community.emit("challenge", {
|
|
5074
5074
|
...challengeMessage,
|
|
@@ -7539,9 +7539,9 @@ async function restartCommunityAfterFailedRename({ community, oldAddress, newAdd
|
|
|
7539
7539
|
}
|
|
7540
7540
|
}
|
|
7541
7541
|
async function removePartialDbCopy({ community, oldAddress, newAddress, log }) {
|
|
7542
|
-
const communitiesPath =
|
|
7543
|
-
const partialDbCopyPath =
|
|
7544
|
-
if (!fs.existsSync(
|
|
7542
|
+
const communitiesPath = Path.join(community._pkc.dataPath, "communities");
|
|
7543
|
+
const partialDbCopyPath = Path.join(communitiesPath, newAddress);
|
|
7544
|
+
if (!fs.existsSync(Path.join(communitiesPath, oldAddress))) return {
|
|
7545
7545
|
removed: false,
|
|
7546
7546
|
path: partialDbCopyPath
|
|
7547
7547
|
};
|
|
@@ -7558,7 +7558,7 @@ async function removePartialDbCopy({ community, oldAddress, newAddress, log }) {
|
|
|
7558
7558
|
}
|
|
7559
7559
|
}
|
|
7560
7560
|
async function undoRenameAfterDbRenameFailed({ community, oldAddress, newAddress, dbRenameError, log }) {
|
|
7561
|
-
const communitiesPath =
|
|
7561
|
+
const communitiesPath = Path.join(community._pkc.dataPath, "communities");
|
|
7562
7562
|
const partialDbCopy = await removePartialDbCopy({
|
|
7563
7563
|
community,
|
|
7564
7564
|
oldAddress,
|
|
@@ -7576,8 +7576,8 @@ async function undoRenameAfterDbRenameFailed({ community, oldAddress, newAddress
|
|
|
7576
7576
|
error: new PKCError("ERR_FAILED_TO_RENAME_COMMUNITY_DB", {
|
|
7577
7577
|
oldAddress,
|
|
7578
7578
|
newAddress,
|
|
7579
|
-
oldDbPath:
|
|
7580
|
-
newDbPath:
|
|
7579
|
+
oldDbPath: Path.join(communitiesPath, oldAddress),
|
|
7580
|
+
newDbPath: Path.join(communitiesPath, newAddress),
|
|
7581
7581
|
error: dbRenameError,
|
|
7582
7582
|
errorMessage: renameError?.message,
|
|
7583
7583
|
errorName: renameError?.name,
|
|
@@ -7760,11 +7760,11 @@ async function edit(community, newCommunityOptions) {
|
|
|
7760
7760
|
const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
|
|
7761
7761
|
function defaultExportPathFor(community, exportId) {
|
|
7762
7762
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7763
|
-
return
|
|
7763
|
+
return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
|
|
7764
7764
|
}
|
|
7765
7765
|
function sourceDbPathFor(community) {
|
|
7766
7766
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7767
|
-
return
|
|
7767
|
+
return Path.join(community._pkc.dataPath, "communities", community.address);
|
|
7768
7768
|
}
|
|
7769
7769
|
async function persistExports(community) {
|
|
7770
7770
|
if (!community._dbHandler) return;
|
|
@@ -7840,9 +7840,9 @@ async function runExportTask(community, exportId, opts) {
|
|
|
7840
7840
|
async function exportCommunityEmbedded(community, options = {}) {
|
|
7841
7841
|
if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
7842
7842
|
const exportId = v4();
|
|
7843
|
-
const destPath = options.exportPath ?
|
|
7843
|
+
const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
|
|
7844
7844
|
const includePrivateKey = options.includePrivateKey === true;
|
|
7845
|
-
if (
|
|
7845
|
+
if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
|
|
7846
7846
|
communityAddress: community.address,
|
|
7847
7847
|
exportPath: destPath
|
|
7848
7848
|
});
|