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