@pkcprotocol/pkc-js 0.0.82 → 0.0.83
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/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/runtime/node/community/db-handler.d.ts +2 -0
- package/dist/browser/runtime/node/community/db-handler.js +21 -4
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +25 -25
- package/dist/bundled/chunks/{helia-for-pkc-CQY3-UYD.js → helia-for-pkc-BtjQ8rfd.js} +33 -33
- package/dist/bundled/chunks/{local-community-AZAEiiht.js → local-community-B_Yg8LQH.js} +1 -1
- package/dist/bundled/chunks/{local-community-DRm3r1-Y.js → local-community-DJM47U8C.js} +39 -30
- package/dist/bundled/chunks/{node-B1J8psGZ.js → node-lb4SvdBh.js} +5 -5
- package/dist/bundled/chunks/{rpc-local-community-0XmKyOdO.js → rpc-local-community-a464veDe.js} +1 -1
- package/dist/bundled/chunks/{schema-BUUhufdT.js → schema-mdv9_FG5.js} +1 -1
- package/dist/bundled/chunks/{util-Cct7-RT3.js → util-y9-A9BnM.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/runtime/node/community/db-handler.d.ts +2 -0
- package/dist/node/runtime/node/community/db-handler.js +21 -4
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node:module"
|
|
15
15
|
],
|
|
16
16
|
"dynamicImports": [
|
|
17
|
-
"chunks/node-
|
|
17
|
+
"chunks/node-lb4SvdBh.js"
|
|
18
18
|
],
|
|
19
19
|
"inputs": [
|
|
20
20
|
"dist/node/runtime/node/compile-cache.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"index.js": {
|
|
25
25
|
"isEntry": true,
|
|
26
26
|
"imports": [
|
|
27
|
-
"chunks/node-
|
|
27
|
+
"chunks/node-lb4SvdBh.js"
|
|
28
28
|
],
|
|
29
29
|
"dynamicImports": [],
|
|
30
30
|
"inputs": []
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"rpc/src/index.js": {
|
|
33
33
|
"isEntry": true,
|
|
34
34
|
"imports": [
|
|
35
|
-
"chunks/rpc-local-community-
|
|
36
|
-
"chunks/node-
|
|
37
|
-
"chunks/schema-
|
|
38
|
-
"chunks/local-community-
|
|
35
|
+
"chunks/rpc-local-community-a464veDe.js",
|
|
36
|
+
"chunks/node-lb4SvdBh.js",
|
|
37
|
+
"chunks/schema-mdv9_FG5.js",
|
|
38
|
+
"chunks/local-community-DJM47U8C.js",
|
|
39
39
|
"node:url",
|
|
40
40
|
"path",
|
|
41
41
|
"assert",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
"\u0000rolldown/runtime.js"
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"chunks/helia-for-pkc-
|
|
68
|
+
"chunks/helia-for-pkc-BtjQ8rfd.js": {
|
|
69
69
|
"isEntry": false,
|
|
70
70
|
"imports": [
|
|
71
71
|
"chunks/chunk-2rV9d50f.js",
|
|
72
|
-
"chunks/schema-
|
|
73
|
-
"chunks/util-
|
|
72
|
+
"chunks/schema-mdv9_FG5.js",
|
|
73
|
+
"chunks/util-y9-A9BnM.js",
|
|
74
74
|
"chunks/src-DKntVmyX.js",
|
|
75
75
|
"chunks/src-Cpx2Sts8.js",
|
|
76
76
|
"node:url",
|
|
@@ -186,20 +186,20 @@
|
|
|
186
186
|
"dist/node/helia/helia-for-pkc.js"
|
|
187
187
|
]
|
|
188
188
|
},
|
|
189
|
-
"chunks/local-community-
|
|
189
|
+
"chunks/local-community-B_Yg8LQH.js": {
|
|
190
190
|
"isEntry": false,
|
|
191
191
|
"imports": [
|
|
192
|
-
"chunks/local-community-
|
|
192
|
+
"chunks/local-community-DJM47U8C.js"
|
|
193
193
|
],
|
|
194
194
|
"dynamicImports": [],
|
|
195
195
|
"inputs": []
|
|
196
196
|
},
|
|
197
|
-
"chunks/local-community-
|
|
197
|
+
"chunks/local-community-DJM47U8C.js": {
|
|
198
198
|
"isEntry": false,
|
|
199
199
|
"imports": [
|
|
200
200
|
"chunks/chunk-2rV9d50f.js",
|
|
201
|
-
"chunks/rpc-local-community-
|
|
202
|
-
"chunks/schema-
|
|
201
|
+
"chunks/rpc-local-community-a464veDe.js",
|
|
202
|
+
"chunks/schema-mdv9_FG5.js",
|
|
203
203
|
"node:crypto",
|
|
204
204
|
"node:url",
|
|
205
205
|
"node:path",
|
|
@@ -255,13 +255,13 @@
|
|
|
255
255
|
"dist/node/runtime/node/community/local-community.js"
|
|
256
256
|
]
|
|
257
257
|
},
|
|
258
|
-
"chunks/node-
|
|
258
|
+
"chunks/node-lb4SvdBh.js": {
|
|
259
259
|
"isEntry": false,
|
|
260
260
|
"imports": [
|
|
261
261
|
"chunks/chunk-2rV9d50f.js",
|
|
262
|
-
"chunks/rpc-local-community-
|
|
263
|
-
"chunks/schema-
|
|
264
|
-
"chunks/util-
|
|
262
|
+
"chunks/rpc-local-community-a464veDe.js",
|
|
263
|
+
"chunks/schema-mdv9_FG5.js",
|
|
264
|
+
"chunks/util-y9-A9BnM.js",
|
|
265
265
|
"path",
|
|
266
266
|
"assert",
|
|
267
267
|
"fs",
|
|
@@ -272,8 +272,8 @@
|
|
|
272
272
|
"rpc-websockets"
|
|
273
273
|
],
|
|
274
274
|
"dynamicImports": [
|
|
275
|
-
"chunks/helia-for-pkc-
|
|
276
|
-
"chunks/local-community-
|
|
275
|
+
"chunks/helia-for-pkc-BtjQ8rfd.js",
|
|
276
|
+
"chunks/local-community-DJM47U8C.js"
|
|
277
277
|
],
|
|
278
278
|
"inputs": [
|
|
279
279
|
"node_modules/zod/v4/locales/en.js",
|
|
@@ -315,11 +315,11 @@
|
|
|
315
315
|
"dist/node/index.js"
|
|
316
316
|
]
|
|
317
317
|
},
|
|
318
|
-
"chunks/rpc-local-community-
|
|
318
|
+
"chunks/rpc-local-community-a464veDe.js": {
|
|
319
319
|
"isEntry": false,
|
|
320
320
|
"imports": [
|
|
321
321
|
"chunks/chunk-2rV9d50f.js",
|
|
322
|
-
"chunks/schema-
|
|
322
|
+
"chunks/schema-mdv9_FG5.js",
|
|
323
323
|
"chunks/src-CYIMjhjK.js",
|
|
324
324
|
"node:crypto",
|
|
325
325
|
"node:url",
|
|
@@ -872,7 +872,7 @@
|
|
|
872
872
|
"dist/node/community/rpc-local-community.js"
|
|
873
873
|
]
|
|
874
874
|
},
|
|
875
|
-
"chunks/schema-
|
|
875
|
+
"chunks/schema-mdv9_FG5.js": {
|
|
876
876
|
"isEntry": false,
|
|
877
877
|
"imports": [
|
|
878
878
|
"chunks/chunk-2rV9d50f.js",
|
|
@@ -1325,10 +1325,10 @@
|
|
|
1325
1325
|
"node_modules/kubo-rpc-client/dist/src/index.js"
|
|
1326
1326
|
]
|
|
1327
1327
|
},
|
|
1328
|
-
"chunks/util-
|
|
1328
|
+
"chunks/util-y9-A9BnM.js": {
|
|
1329
1329
|
"isEntry": false,
|
|
1330
1330
|
"imports": [
|
|
1331
|
-
"chunks/schema-
|
|
1331
|
+
"chunks/schema-mdv9_FG5.js",
|
|
1332
1332
|
"ipns/selector",
|
|
1333
1333
|
"uint8arrays/equals"
|
|
1334
1334
|
],
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, br as logger_default, vr as PKCError } from "./schema-
|
|
3
|
-
import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-
|
|
2
|
+
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, br as logger_default, vr as PKCError } from "./schema-mdv9_FG5.js";
|
|
3
|
+
import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-y9-A9BnM.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";
|
|
@@ -148,7 +148,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
148
148
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
149
149
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
150
150
|
const os$1 = __require("os");
|
|
151
|
-
const path$
|
|
151
|
+
const path$9 = __require("path");
|
|
152
152
|
const IS_WINDOWS_PLATFORM = os$1.platform() === "win32";
|
|
153
153
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
154
154
|
/**
|
|
@@ -177,7 +177,7 @@ var require_path = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
177
177
|
}
|
|
178
178
|
exports.unixify = unixify;
|
|
179
179
|
function makeAbsolute(cwd, filepath) {
|
|
180
|
-
return path$
|
|
180
|
+
return path$9.resolve(cwd, filepath);
|
|
181
181
|
}
|
|
182
182
|
exports.makeAbsolute = makeAbsolute;
|
|
183
183
|
function removeLeadingDotSegment(entry) {
|
|
@@ -1429,7 +1429,7 @@ var require_braces = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1429
1429
|
//#endregion
|
|
1430
1430
|
//#region node_modules/picomatch/lib/constants.js
|
|
1431
1431
|
var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1432
|
-
const path$
|
|
1432
|
+
const path$8 = __require("path");
|
|
1433
1433
|
const WIN_SLASH = "\\\\/";
|
|
1434
1434
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1435
1435
|
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
@@ -1554,7 +1554,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1554
1554
|
CHAR_UNDERSCORE: 95,
|
|
1555
1555
|
CHAR_VERTICAL_LINE: 124,
|
|
1556
1556
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1557
|
-
SEP: path$
|
|
1557
|
+
SEP: path$8.sep,
|
|
1558
1558
|
/**
|
|
1559
1559
|
* Create EXTGLOB_CHARS
|
|
1560
1560
|
*/
|
|
@@ -1598,7 +1598,7 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1598
1598
|
//#endregion
|
|
1599
1599
|
//#region node_modules/picomatch/lib/utils.js
|
|
1600
1600
|
var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1601
|
-
const path$
|
|
1601
|
+
const path$7 = __require("path");
|
|
1602
1602
|
const win32 = process.platform === "win32";
|
|
1603
1603
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
|
|
1604
1604
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -1618,7 +1618,7 @@ var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1618
1618
|
};
|
|
1619
1619
|
exports.isWindows = (options) => {
|
|
1620
1620
|
if (options && typeof options.windows === "boolean") return options.windows;
|
|
1621
|
-
return win32 === true || path$
|
|
1621
|
+
return win32 === true || path$7.sep === "\\";
|
|
1622
1622
|
};
|
|
1623
1623
|
exports.escapeLast = (input, char, lastIdx) => {
|
|
1624
1624
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -2988,7 +2988,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
2988
2988
|
//#endregion
|
|
2989
2989
|
//#region node_modules/picomatch/lib/picomatch.js
|
|
2990
2990
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2991
|
-
const path$
|
|
2991
|
+
const path$6 = __require("path");
|
|
2992
2992
|
const scan = require_scan();
|
|
2993
2993
|
const parse = require_parse();
|
|
2994
2994
|
const utils = require_utils$2();
|
|
@@ -3127,7 +3127,7 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3127
3127
|
* @api public
|
|
3128
3128
|
*/
|
|
3129
3129
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
3130
|
-
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$
|
|
3130
|
+
return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(path$6.basename(input));
|
|
3131
3131
|
};
|
|
3132
3132
|
/**
|
|
3133
3133
|
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
@@ -3682,7 +3682,7 @@ var require_micromatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3682
3682
|
var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3683
3683
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3684
3684
|
exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
|
|
3685
|
-
const path$
|
|
3685
|
+
const path$5 = __require("path");
|
|
3686
3686
|
const globParent = require_glob_parent();
|
|
3687
3687
|
const micromatch = require_micromatch();
|
|
3688
3688
|
const GLOBSTAR = "**";
|
|
@@ -3790,7 +3790,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3790
3790
|
}
|
|
3791
3791
|
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
3792
3792
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
3793
|
-
const basename = path$
|
|
3793
|
+
const basename = path$5.basename(pattern);
|
|
3794
3794
|
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
|
3795
3795
|
}
|
|
3796
3796
|
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
@@ -3864,7 +3864,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3864
3864
|
}
|
|
3865
3865
|
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
3866
3866
|
function isAbsolute(pattern) {
|
|
3867
|
-
return path$
|
|
3867
|
+
return path$5.isAbsolute(pattern);
|
|
3868
3868
|
}
|
|
3869
3869
|
exports.isAbsolute = isAbsolute;
|
|
3870
3870
|
}));
|
|
@@ -4492,7 +4492,7 @@ var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4492
4492
|
//#region node_modules/@nodelib/fs.scandir/out/settings.js
|
|
4493
4493
|
var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4494
4494
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4495
|
-
const path$
|
|
4495
|
+
const path$4 = __require("path");
|
|
4496
4496
|
const fsStat = require_out$3();
|
|
4497
4497
|
const fs = require_fs();
|
|
4498
4498
|
var Settings = class {
|
|
@@ -4500,7 +4500,7 @@ var require_settings$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4500
4500
|
this._options = _options;
|
|
4501
4501
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
4502
4502
|
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
4503
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
4503
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
|
|
4504
4504
|
this.stats = this._getValue(this._options.stats, false);
|
|
4505
4505
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
4506
4506
|
this.fsStatSettings = new fsStat.Settings({
|
|
@@ -5094,7 +5094,7 @@ var require_sync$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5094
5094
|
//#region node_modules/@nodelib/fs.walk/out/settings.js
|
|
5095
5095
|
var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5096
5096
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5097
|
-
const path$
|
|
5097
|
+
const path$3 = __require("path");
|
|
5098
5098
|
const fsScandir = require_out$2();
|
|
5099
5099
|
var Settings = class {
|
|
5100
5100
|
constructor(_options = {}) {
|
|
@@ -5104,7 +5104,7 @@ var require_settings$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5104
5104
|
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
|
5105
5105
|
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
|
5106
5106
|
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
|
5107
|
-
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$
|
|
5107
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
|
|
5108
5108
|
this.fsScandirSettings = new fsScandir.Settings({
|
|
5109
5109
|
followSymbolicLinks: this._options.followSymbolicLinks,
|
|
5110
5110
|
fs: this._options.fs,
|
|
@@ -5156,7 +5156,7 @@ var require_out$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5156
5156
|
//#region node_modules/fast-glob/out/readers/reader.js
|
|
5157
5157
|
var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5158
5158
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5159
|
-
const path$
|
|
5159
|
+
const path$2 = __require("path");
|
|
5160
5160
|
const fsStat = require_out$3();
|
|
5161
5161
|
const utils = require_utils$1();
|
|
5162
5162
|
var Reader = class {
|
|
@@ -5169,7 +5169,7 @@ var require_reader = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5169
5169
|
});
|
|
5170
5170
|
}
|
|
5171
5171
|
_getFullEntryPath(filepath) {
|
|
5172
|
-
return path$
|
|
5172
|
+
return path$2.resolve(this._settings.cwd, filepath);
|
|
5173
5173
|
}
|
|
5174
5174
|
_makeEntry(stats, pattern) {
|
|
5175
5175
|
const entry = {
|
|
@@ -5504,7 +5504,7 @@ var require_entry = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5504
5504
|
//#region node_modules/fast-glob/out/providers/provider.js
|
|
5505
5505
|
var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5506
5506
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5507
|
-
const path$
|
|
5507
|
+
const path$1 = __require("path");
|
|
5508
5508
|
const deep_1 = require_deep();
|
|
5509
5509
|
const entry_1 = require_entry$1();
|
|
5510
5510
|
const error_1 = require_error();
|
|
@@ -5518,7 +5518,7 @@ var require_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5518
5518
|
this.entryTransformer = new entry_2.default(this._settings);
|
|
5519
5519
|
}
|
|
5520
5520
|
_getRootDirectory(task) {
|
|
5521
|
-
return path$
|
|
5521
|
+
return path$1.resolve(this._settings.cwd, task.base);
|
|
5522
5522
|
}
|
|
5523
5523
|
_getReaderOptions(task) {
|
|
5524
5524
|
const basePath = task.base === "." ? "" : task.base;
|
|
@@ -5849,7 +5849,7 @@ var import_out = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((export
|
|
|
5849
5849
|
* Async iterable filename pattern matcher
|
|
5850
5850
|
*/
|
|
5851
5851
|
async function* glob(dir, pattern, options = {}) {
|
|
5852
|
-
const absoluteDir =
|
|
5852
|
+
const absoluteDir = Path.resolve(dir);
|
|
5853
5853
|
const stats = await fsp.stat(absoluteDir);
|
|
5854
5854
|
for await (const entry of import_out.default.stream(pattern, {
|
|
5855
5855
|
...options,
|
|
@@ -6024,7 +6024,7 @@ var NextToLast = class {
|
|
|
6024
6024
|
};
|
|
6025
6025
|
}
|
|
6026
6026
|
decode(str) {
|
|
6027
|
-
let fileName =
|
|
6027
|
+
let fileName = Path.basename(str);
|
|
6028
6028
|
if (fileName.endsWith(this.extension)) fileName = fileName.substring(0, fileName.length - this.extension.length);
|
|
6029
6029
|
return CID.decode(this.base.decoder.decode(fileName));
|
|
6030
6030
|
}
|
|
@@ -6050,7 +6050,7 @@ var NextToLast = class {
|
|
|
6050
6050
|
async function writeFile$1(file, contents, options) {
|
|
6051
6051
|
try {
|
|
6052
6052
|
options?.signal?.throwIfAborted();
|
|
6053
|
-
await raceSignal(fsp.mkdir(
|
|
6053
|
+
await raceSignal(fsp.mkdir(Path.dirname(file), { recursive: true }), options?.signal);
|
|
6054
6054
|
const writer = new Writer(file);
|
|
6055
6055
|
options?.signal?.throwIfAborted();
|
|
6056
6056
|
await writer.write(contents);
|
|
@@ -6075,7 +6075,7 @@ var FsBlockstore = class {
|
|
|
6075
6075
|
deleteManyConcurrency;
|
|
6076
6076
|
shardingStrategy;
|
|
6077
6077
|
constructor(location, init = {}) {
|
|
6078
|
-
this.path =
|
|
6078
|
+
this.path = Path.resolve(location);
|
|
6079
6079
|
this.createIfMissing = init.createIfMissing ?? true;
|
|
6080
6080
|
this.errorIfExists = init.errorIfExists ?? false;
|
|
6081
6081
|
this.deleteManyConcurrency = init.deleteManyConcurrency ?? 50;
|
|
@@ -6101,7 +6101,7 @@ var FsBlockstore = class {
|
|
|
6101
6101
|
async put(key, val, options) {
|
|
6102
6102
|
const { dir, file } = this.shardingStrategy.encode(key);
|
|
6103
6103
|
try {
|
|
6104
|
-
await writeFile$1(
|
|
6104
|
+
await writeFile$1(Path.join(this.path, dir, file), val, options);
|
|
6105
6105
|
return key;
|
|
6106
6106
|
} catch (err) {
|
|
6107
6107
|
throw new PutFailedError(String(err));
|
|
@@ -6120,7 +6120,7 @@ var FsBlockstore = class {
|
|
|
6120
6120
|
let handle;
|
|
6121
6121
|
try {
|
|
6122
6122
|
options?.signal?.throwIfAborted();
|
|
6123
|
-
handle = await raceSignal(fsp.open(
|
|
6123
|
+
handle = await raceSignal(fsp.open(Path.join(this.path, dir, file)), options?.signal);
|
|
6124
6124
|
yield* handle.createReadStream();
|
|
6125
6125
|
} catch (err) {
|
|
6126
6126
|
if (handle != null) await raceSignal(handle.close(), options?.signal);
|
|
@@ -6141,7 +6141,7 @@ var FsBlockstore = class {
|
|
|
6141
6141
|
const { dir, file } = this.shardingStrategy.encode(key);
|
|
6142
6142
|
try {
|
|
6143
6143
|
options?.signal?.throwIfAborted();
|
|
6144
|
-
await raceSignal(fsp.unlink(
|
|
6144
|
+
await raceSignal(fsp.unlink(Path.join(this.path, dir, file)), options?.signal);
|
|
6145
6145
|
} catch (err) {
|
|
6146
6146
|
if (err.code === "ENOENT") return;
|
|
6147
6147
|
throw new DeleteFailedError(String(err));
|
|
@@ -6159,14 +6159,14 @@ var FsBlockstore = class {
|
|
|
6159
6159
|
const { dir, file } = this.shardingStrategy.encode(key);
|
|
6160
6160
|
try {
|
|
6161
6161
|
options?.signal?.throwIfAborted();
|
|
6162
|
-
await raceSignal(fsp.access(
|
|
6162
|
+
await raceSignal(fsp.access(Path.join(this.path, dir, file)), options?.signal);
|
|
6163
6163
|
} catch (err) {
|
|
6164
6164
|
return false;
|
|
6165
6165
|
}
|
|
6166
6166
|
return true;
|
|
6167
6167
|
}
|
|
6168
6168
|
async *getAll(options) {
|
|
6169
|
-
const pattern = `**/*${this.shardingStrategy.extension}`.split(
|
|
6169
|
+
const pattern = `**/*${this.shardingStrategy.extension}`.split(Path.sep).join("/");
|
|
6170
6170
|
const files = glob(this.path, pattern, { absolute: true });
|
|
6171
6171
|
for await (const file of files) try {
|
|
6172
6172
|
options?.signal?.throwIfAborted();
|
|
@@ -6218,7 +6218,7 @@ async function createBlockstoreForLibp2pJsClient({ dataPath, key }) {
|
|
|
6218
6218
|
defaultMaxBytes: DEFAULT_IN_MEMORY_BLOCKSTORE_MAX_BYTES,
|
|
6219
6219
|
close: async () => {}
|
|
6220
6220
|
};
|
|
6221
|
-
const store = new FsBlockstore(path
|
|
6221
|
+
const store = new FsBlockstore(path.join(dataPath, "blockstore", key));
|
|
6222
6222
|
await store.open();
|
|
6223
6223
|
return {
|
|
6224
6224
|
blockstore: store,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-
|
|
1
|
+
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DJM47U8C.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as pubsubTopicToDhtKey, $n as n$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-
|
|
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-
|
|
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-mdv9_FG5.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-a464veDe.js";
|
|
4
4
|
import { randomFillSync, randomUUID } from "node:crypto";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
-
import
|
|
6
|
+
import Path from "node:path";
|
|
7
7
|
import os from "os";
|
|
8
8
|
import { existsSync, promises } from "node:fs";
|
|
9
|
-
import path
|
|
9
|
+
import path from "path";
|
|
10
10
|
import assert from "assert";
|
|
11
11
|
import fs from "fs";
|
|
12
12
|
import Database from "better-sqlite3";
|
|
@@ -3174,6 +3174,7 @@ var DbHandler = class {
|
|
|
3174
3174
|
this._community = community;
|
|
3175
3175
|
this._transactionDepth = 0;
|
|
3176
3176
|
this._createdTables = false;
|
|
3177
|
+
this._columnNamesByTable = {};
|
|
3177
3178
|
hideClassPrivateProps(this);
|
|
3178
3179
|
}
|
|
3179
3180
|
_parsePrefixedComment(row) {
|
|
@@ -3214,6 +3215,7 @@ var DbHandler = class {
|
|
|
3214
3215
|
await this.initDbConfigIfNeeded();
|
|
3215
3216
|
const dbFilePath = this._dbConfig.filename;
|
|
3216
3217
|
if (!this._db || !this._db.open) {
|
|
3218
|
+
this._columnNamesByTable = {};
|
|
3217
3219
|
this._db = new Database(dbFilePath, {
|
|
3218
3220
|
...this._dbConfig,
|
|
3219
3221
|
...dbConfigOptions
|
|
@@ -3479,9 +3481,9 @@ var DbHandler = class {
|
|
|
3479
3481
|
if (needToMigrate) {
|
|
3480
3482
|
if (dbExistsAlready && currentDbVersion > 0) {
|
|
3481
3483
|
this.destoryConnection();
|
|
3482
|
-
backupDbPath = path
|
|
3483
|
-
log(`Copying db ${path
|
|
3484
|
-
if (!fs.existsSync(path
|
|
3484
|
+
backupDbPath = path.join(path.dirname(dbPath), ".backup_before_migration", `${path.basename(dbPath)}.${currentDbVersion}.${timestamp()}`);
|
|
3485
|
+
log(`Copying db ${path.basename(dbPath)} to ${backupDbPath} before migration`);
|
|
3486
|
+
if (!fs.existsSync(path.dirname(backupDbPath))) await fs.promises.mkdir(path.dirname(backupDbPath), { recursive: true });
|
|
3485
3487
|
const sourceDb = new Database(dbPath, { fileMustExist: true });
|
|
3486
3488
|
await sourceDb.backup(backupDbPath);
|
|
3487
3489
|
sourceDb.close();
|
|
@@ -3498,6 +3500,7 @@ var DbHandler = class {
|
|
|
3498
3500
|
]) this._db.exec(`DROP TABLE IF EXISTS ${tableName}`);
|
|
3499
3501
|
this._db.exec(`DROP TABLE IF EXISTS ${TABLES.COMMENT_UPDATES}`);
|
|
3500
3502
|
}
|
|
3503
|
+
this._columnNamesByTable = {};
|
|
3501
3504
|
const createTableFunctions = [
|
|
3502
3505
|
this._createCommentsTable.bind(this),
|
|
3503
3506
|
this._createCommentUpdatesTable.bind(this),
|
|
@@ -3557,6 +3560,7 @@ var DbHandler = class {
|
|
|
3557
3560
|
const newDbVersion = this.getDbVersion();
|
|
3558
3561
|
assert.equal(newDbVersion, version_default.DB_VERSION);
|
|
3559
3562
|
this._createdTables = true;
|
|
3563
|
+
this._columnNamesByTable = {};
|
|
3560
3564
|
if (needToMigrate) log(`Created/migrated the tables to the latest (${newDbVersion}) version and saved to path`, this._dbConfig.filename);
|
|
3561
3565
|
if (backupDbPath) await fs.promises.rm(backupDbPath);
|
|
3562
3566
|
}
|
|
@@ -3637,6 +3641,11 @@ var DbHandler = class {
|
|
|
3637
3641
|
_getColumnNames(tableName) {
|
|
3638
3642
|
return this._db.pragma(`table_info(${tableName})`).map((col) => col.name);
|
|
3639
3643
|
}
|
|
3644
|
+
_existingColumns(tableName, columns) {
|
|
3645
|
+
if (!this._columnNamesByTable[tableName]) this._columnNamesByTable[tableName] = this._getColumnNames(tableName);
|
|
3646
|
+
const existing = this._columnNamesByTable[tableName];
|
|
3647
|
+
return columns.filter((column) => existing.includes(column));
|
|
3648
|
+
}
|
|
3640
3649
|
async _copyTable(srcTable, dstTable, currentDbVersion) {
|
|
3641
3650
|
const log = logger_default("pkc-js:local-community:db-handler:createTablesIfNeeded:copyTable");
|
|
3642
3651
|
const dstTableColumns = this._getColumnNames(dstTable);
|
|
@@ -4182,8 +4191,8 @@ var DbHandler = class {
|
|
|
4182
4191
|
}));
|
|
4183
4192
|
}
|
|
4184
4193
|
resolveRepliesCidRefsForEntries(entries) {
|
|
4185
|
-
const commentUpdateCols = t$6(CommentUpdateSchema.shape);
|
|
4186
|
-
const commentIpfsCols = [...t$6(CommentIpfsSchema.shape), "extraProps"];
|
|
4194
|
+
const commentUpdateCols = this._existingColumns(TABLES.COMMENT_UPDATES, t$6(CommentUpdateSchema.shape));
|
|
4195
|
+
const commentIpfsCols = this._existingColumns(TABLES.COMMENTS, [...t$6(CommentIpfsSchema.shape), "extraProps"]);
|
|
4187
4196
|
const allCids = [];
|
|
4188
4197
|
for (const entry of entries) {
|
|
4189
4198
|
const replies = entry.commentUpdate.replies;
|
|
@@ -4301,9 +4310,9 @@ var DbHandler = class {
|
|
|
4301
4310
|
queryCommentAndCommentUpdateByCids(cids, opts) {
|
|
4302
4311
|
if (cids.length === 0) return [];
|
|
4303
4312
|
const placeholders = cids.map(() => "?").join(",");
|
|
4304
|
-
const commentUpdateSelects = opts.commentUpdateCols.map((col) => `cu.${col} AS commentUpdate_${col}`);
|
|
4313
|
+
const commentUpdateSelects = this._existingColumns(TABLES.COMMENT_UPDATES, opts.commentUpdateCols).map((col) => `cu.${col} AS commentUpdate_${col}`);
|
|
4305
4314
|
const queryStr = `
|
|
4306
|
-
SELECT ${opts.commentIpfsCols.map((col) => `c.${col} AS commentIpfs_${col}`).join(", ")}, ${commentUpdateSelects.join(", ")}
|
|
4315
|
+
SELECT ${this._existingColumns(TABLES.COMMENTS, opts.commentIpfsCols).map((col) => `c.${col} AS commentIpfs_${col}`).join(", ")}, ${commentUpdateSelects.join(", ")}
|
|
4307
4316
|
FROM ${TABLES.COMMENTS} c
|
|
4308
4317
|
INNER JOIN ${TABLES.COMMENT_UPDATES} cu ON c.cid = cu.cid
|
|
4309
4318
|
WHERE c.cid IN (${placeholders})
|
|
@@ -5292,10 +5301,10 @@ var DbHandler = class {
|
|
|
5292
5301
|
if (this._db || this._keyv) await this.destoryConnection();
|
|
5293
5302
|
this._transactionDepth = 0;
|
|
5294
5303
|
const dataPath = this._community._pkc.dataPath;
|
|
5295
|
-
const oldPathString = path
|
|
5296
|
-
const newPathString = path
|
|
5297
|
-
await fs.promises.mkdir(path
|
|
5298
|
-
await fs.promises.mkdir(path
|
|
5304
|
+
const oldPathString = path.join(dataPath, "communities", oldDbName);
|
|
5305
|
+
const newPathString = path.join(dataPath, "communities", newDbName);
|
|
5306
|
+
await fs.promises.mkdir(path.dirname(oldPathString), { recursive: true });
|
|
5307
|
+
await fs.promises.mkdir(path.dirname(newPathString), { recursive: true });
|
|
5299
5308
|
try {
|
|
5300
5309
|
if (!fs.existsSync(oldPathString)) log(`Old DB file ${oldPathString} does not exist. Cannot backup/rename.`);
|
|
5301
5310
|
else {
|
|
@@ -5317,8 +5326,8 @@ var DbHandler = class {
|
|
|
5317
5326
|
}
|
|
5318
5327
|
async lockCommunityStart(communityAddress = this._community.address) {
|
|
5319
5328
|
const log = logger_default("pkc-js:local-community:db-handler:lock:start");
|
|
5320
|
-
const lockfilePath = path
|
|
5321
|
-
const communityDbPath = path
|
|
5329
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5330
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5322
5331
|
try {
|
|
5323
5332
|
await import_src.default.lock(communityDbPath, {
|
|
5324
5333
|
lockfilePath,
|
|
@@ -5339,8 +5348,8 @@ var DbHandler = class {
|
|
|
5339
5348
|
async unlockCommunityStart(communityAddress = this._community.address) {
|
|
5340
5349
|
const log = logger_default("pkc-js:local-community:db-handler:unlock:start");
|
|
5341
5350
|
log.trace(`Attempting to unlock the start of community (${communityAddress})`);
|
|
5342
|
-
const lockfilePath = path
|
|
5343
|
-
const communityDbPath = path
|
|
5351
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5352
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5344
5353
|
if (!fs.existsSync(lockfilePath) || !fs.existsSync(communityDbPath)) return;
|
|
5345
5354
|
try {
|
|
5346
5355
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -5351,8 +5360,8 @@ var DbHandler = class {
|
|
|
5351
5360
|
}
|
|
5352
5361
|
}
|
|
5353
5362
|
async isCommunityStartLocked(communityAddress = this._community.address) {
|
|
5354
|
-
const lockfilePath = path
|
|
5355
|
-
const communityDbPath = path
|
|
5363
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${communityAddress}.start.lock`);
|
|
5364
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", communityAddress);
|
|
5356
5365
|
return await import_src.default.check(communityDbPath, {
|
|
5357
5366
|
lockfilePath,
|
|
5358
5367
|
realpath: false,
|
|
@@ -5361,8 +5370,8 @@ var DbHandler = class {
|
|
|
5361
5370
|
}
|
|
5362
5371
|
async lockCommunityState() {
|
|
5363
5372
|
const log = logger_default("pkc-js:local-community:db-handler:lock:lockCommunityState");
|
|
5364
|
-
const lockfilePath = path
|
|
5365
|
-
const communityDbPath = path
|
|
5373
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
5374
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5366
5375
|
try {
|
|
5367
5376
|
await import_src.default.lock(communityDbPath, {
|
|
5368
5377
|
lockfilePath,
|
|
@@ -5379,8 +5388,8 @@ var DbHandler = class {
|
|
|
5379
5388
|
}
|
|
5380
5389
|
async unlockCommunityState() {
|
|
5381
5390
|
const log = logger_default("pkc-js:local-community:db-handler:lock:unlockCommunityState");
|
|
5382
|
-
const lockfilePath = path
|
|
5383
|
-
const communityDbPath = path
|
|
5391
|
+
const lockfilePath = path.join(this._community._pkc.dataPath, "communities", `${this._community.address}.state.lock`);
|
|
5392
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5384
5393
|
if (!fs.existsSync(lockfilePath)) return;
|
|
5385
5394
|
try {
|
|
5386
5395
|
await import_src.default.unlock(communityDbPath, { lockfilePath });
|
|
@@ -5390,7 +5399,7 @@ var DbHandler = class {
|
|
|
5390
5399
|
}
|
|
5391
5400
|
}
|
|
5392
5401
|
communityDbExists() {
|
|
5393
|
-
const communityDbPath = path
|
|
5402
|
+
const communityDbPath = path.join(this._community._pkc.dataPath, "communities", this._community.address);
|
|
5394
5403
|
return fs.existsSync(communityDbPath);
|
|
5395
5404
|
}
|
|
5396
5405
|
markCommentsAsPublishedToPostUpdates(commentCids) {
|
|
@@ -7109,11 +7118,11 @@ async function edit(community, newCommunityOptions) {
|
|
|
7109
7118
|
const EXPORTS_KEY = STORAGE_KEYS[STORAGE_KEYS.EXPORTS];
|
|
7110
7119
|
function defaultExportPathFor(community, exportId) {
|
|
7111
7120
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7112
|
-
return
|
|
7121
|
+
return Path.join(community._pkc.dataPath, "exports", `${exportId}.sqlite`);
|
|
7113
7122
|
}
|
|
7114
7123
|
function sourceDbPathFor(community) {
|
|
7115
7124
|
if (typeof community._pkc.dataPath !== "string") throw new PKCError("ERR_DATA_PATH_IS_NOT_DEFINED", { communityAddress: community.address });
|
|
7116
|
-
return
|
|
7125
|
+
return Path.join(community._pkc.dataPath, "communities", community.address);
|
|
7117
7126
|
}
|
|
7118
7127
|
async function persistExports(community) {
|
|
7119
7128
|
if (!community._dbHandler) return;
|
|
@@ -7189,9 +7198,9 @@ async function runExportTask(community, exportId, opts) {
|
|
|
7189
7198
|
async function exportCommunityEmbedded(community, options = {}) {
|
|
7190
7199
|
if (options.signal?.aborted) throw options.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
7191
7200
|
const exportId = v4();
|
|
7192
|
-
const destPath = options.exportPath ?
|
|
7201
|
+
const destPath = options.exportPath ? Path.resolve(options.exportPath) : defaultExportPathFor(community, exportId);
|
|
7193
7202
|
const includePrivateKey = options.includePrivateKey === true;
|
|
7194
|
-
if (
|
|
7203
|
+
if (Path.resolve(destPath) === Path.resolve(sourceDbPathFor(community))) throw new PKCError("ERR_EXPORT_PATH_TARGETS_LIVE_DB", {
|
|
7195
7204
|
communityAddress: community.address,
|
|
7196
7205
|
exportPath: destPath
|
|
7197
7206
|
});
|