@pkcprotocol/pkc-js 0.0.56 → 0.0.58
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/errors.d.ts +1 -1
- package/dist/browser/errors.js +1 -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/runtime/node/community/local-community/lifecycle.js +10 -0
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-validation.js +8 -2
- package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.d.ts +60 -0
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js +95 -0
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -0
- package/dist/browser/runtime/node/community/local-community.d.ts +2 -0
- package/dist/browser/runtime/node/community/local-community.js +5 -0
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +39 -37
- package/dist/bundled/chunks/{helia-for-pkc-CcmiATPg.js → helia-for-pkc-Dy66yFBq.js} +2 -2
- package/dist/bundled/chunks/{local-community-DzFaedmf.js → local-community-CpqhUYOZ.js} +1 -1
- package/dist/bundled/chunks/{local-community-DdB4oPEw.js → local-community-D1BZqTaY.js} +92 -4
- package/dist/bundled/chunks/{node-DNJqRHLq.js → node-OomQx4kQ.js} +10 -533
- package/dist/bundled/chunks/{rpc-local-community-OVRYzYQ3.js → rpc-local-community-XVq4w0ZG.js} +563 -40
- package/dist/bundled/chunks/{schema-lNZ3-tdE.js → schema-C03N0i5R.js} +2 -2
- package/dist/bundled/chunks/{util-MtD9fpa8.js → util-DFDVE6vH.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/errors.d.ts +1 -1
- package/dist/node/errors.js +1 -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/runtime/node/community/local-community/lifecycle.js +10 -0
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-validation.js +8 -2
- package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.d.ts +60 -0
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js +95 -0
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -0
- package/dist/node/runtime/node/community/local-community.d.ts +2 -0
- package/dist/node/runtime/node/community/local-community.js +5 -0
- package/dist/node/runtime/node/community/local-community.js.map +1 -1
- package/package.json +1 -1
package/dist/bundled/chunks/{rpc-local-community-OVRYzYQ3.js → rpc-local-community-XVq4w0ZG.js}
RENAMED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { $ as pubsubTopicToDhtKey, $n as create, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as __require, E as createAbortError, En as CommentUpdateSchema, Er as __exportAll, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as __toESM, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as CID$1, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as __commonJSMin, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as require_commonjs$4, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as require_retry$1, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as number, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as FailedToFetchPageIpfsFromGatewaysError, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as string, c as ChallengeVerificationMessageSignedPropertyNames, cr as logger_default, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, en as CommunityExportRecordsSchema, er as all, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as _enum, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as literal, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as custom, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as FailedToFetchGenericIpfsFromGatewaysError, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, k as doesDomainAddressHaveCapitalLetter, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as require_supports_color, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as boolean, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as FailedToFetchCommentUpdateFromGatewaysError, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as PKCError, p as DecryptedChallengeVerificationSchema, pr as array, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as FailedToFetchCommunityFromGatewaysError, sn as ExportCommunityModLogsOptionsSchema, sr as messages, tn as CommunityIpfsReservedFields, tr as FailedToFetchCommentIpfsFromGatewaysError, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as require_ms$1, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as object, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xt as findStartedCommunity, yr as record, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-
|
|
1
|
+
import { $ as pubsubTopicToDhtKey, $n as create, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as __require, E as createAbortError, En as CommentUpdateSchema, Er as __exportAll, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as __toESM, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as CID$1, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as __commonJSMin, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as require_commonjs$4, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as require_retry$1, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as number, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as FailedToFetchPageIpfsFromGatewaysError, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as string, c as ChallengeVerificationMessageSignedPropertyNames, cr as logger_default, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, en as CommunityExportRecordsSchema, er as all, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as _enum, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as literal, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as custom, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as FailedToFetchGenericIpfsFromGatewaysError, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, k as doesDomainAddressHaveCapitalLetter, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as require_supports_color, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as boolean, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as FailedToFetchCommentUpdateFromGatewaysError, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as PKCError, p as DecryptedChallengeVerificationSchema, pr as array, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as FailedToFetchCommunityFromGatewaysError, sn as ExportCommunityModLogsOptionsSchema, sr as messages, tn as CommunityIpfsReservedFields, tr as FailedToFetchCommentIpfsFromGatewaysError, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as require_ms$1, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as object, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xt as findStartedCommunity, yr as record, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-C03N0i5R.js";
|
|
2
|
+
import http from "node:http";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
+
import fs from "node:fs/promises";
|
|
6
|
+
import path from "node:path";
|
|
4
7
|
import dns from "node:dns";
|
|
5
8
|
import os from "os";
|
|
6
9
|
import { closeSync, createReadStream, existsSync, openSync, promises, readSync, readdirSync, rm, watch } from "node:fs";
|
|
7
|
-
import path from "path";
|
|
10
|
+
import path$1 from "path";
|
|
8
11
|
import assert from "assert";
|
|
9
12
|
import { Agent } from "https";
|
|
10
13
|
import { Agent as Agent$1 } from "http";
|
|
@@ -12,6 +15,7 @@ import { CID } from "multiformats/cid";
|
|
|
12
15
|
import { bases } from "multiformats/basics";
|
|
13
16
|
import { fromString } from "uint8arrays/from-string";
|
|
14
17
|
import { peerIdFromMultihash, peerIdFromPrivateKey, peerIdFromPublicKey, peerIdFromString } from "@libp2p/peer-id";
|
|
18
|
+
import https from "node:https";
|
|
15
19
|
import { toString } from "uint8arrays/to-string";
|
|
16
20
|
import { privateKeyFromProtobuf, privateKeyFromRaw, privateKeyToProtobuf, publicKeyFromRaw, publicKeyToProtobuf } from "@libp2p/crypto/keys";
|
|
17
21
|
import Database from "better-sqlite3";
|
|
@@ -7637,7 +7641,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7637
7641
|
var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7638
7642
|
const assert$23 = __require("node:assert");
|
|
7639
7643
|
const net$2 = __require("node:net");
|
|
7640
|
-
const http$
|
|
7644
|
+
const http$4 = __require("node:http");
|
|
7641
7645
|
const util = require_util$6();
|
|
7642
7646
|
const { ClientStats } = require_stats();
|
|
7643
7647
|
const { channels } = require_diagnostics();
|
|
@@ -7649,7 +7653,7 @@ var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7649
7653
|
const connectH1 = require_client_h1();
|
|
7650
7654
|
const connectH2 = require_client_h2();
|
|
7651
7655
|
const kClosedResolve = Symbol("kClosedResolve");
|
|
7652
|
-
const getDefaultNodeMaxHeaderSize = http$
|
|
7656
|
+
const getDefaultNodeMaxHeaderSize = http$4 && http$4.maxHeaderSize && Number.isInteger(http$4.maxHeaderSize) && http$4.maxHeaderSize > 0 ? () => http$4.maxHeaderSize : () => {
|
|
7653
7657
|
throw new InvalidArgumentError("http module not available or http.maxHeaderSize invalid");
|
|
7654
7658
|
};
|
|
7655
7659
|
const noop = () => {};
|
|
@@ -75526,10 +75530,10 @@ var require_esm = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
75526
75530
|
//#endregion
|
|
75527
75531
|
//#region node_modules/hpagent/index.js
|
|
75528
75532
|
var require_hpagent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
75529
|
-
const https$
|
|
75530
|
-
const http$
|
|
75533
|
+
const https$2 = __require("https");
|
|
75534
|
+
const http$3 = __require("http");
|
|
75531
75535
|
const { URL: URL$2 } = __require("url");
|
|
75532
|
-
var HttpProxyAgent = class extends http$
|
|
75536
|
+
var HttpProxyAgent = class extends http$3.Agent {
|
|
75533
75537
|
constructor(options) {
|
|
75534
75538
|
const { proxy, proxyRequestOptions, ...opts } = options;
|
|
75535
75539
|
super(opts);
|
|
@@ -75557,7 +75561,7 @@ var require_hpagent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
75557
75561
|
requestOptions.headers["proxy-authorization"] = `Basic ${base64}`;
|
|
75558
75562
|
}
|
|
75559
75563
|
if (this.proxy.protocol === "https:") requestOptions.servername = this.proxy.hostname;
|
|
75560
|
-
const request = (this.proxy.protocol === "http:" ? http$
|
|
75564
|
+
const request = (this.proxy.protocol === "http:" ? http$3 : https$2).request(requestOptions);
|
|
75561
75565
|
request.once("connect", (response, socket, head) => {
|
|
75562
75566
|
request.removeAllListeners();
|
|
75563
75567
|
socket.removeAllListeners();
|
|
@@ -75577,7 +75581,7 @@ var require_hpagent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
75577
75581
|
request.end();
|
|
75578
75582
|
}
|
|
75579
75583
|
};
|
|
75580
|
-
var HttpsProxyAgent = class extends https$
|
|
75584
|
+
var HttpsProxyAgent = class extends https$2.Agent {
|
|
75581
75585
|
constructor(options) {
|
|
75582
75586
|
const { proxy, proxyRequestOptions, ...opts } = options;
|
|
75583
75587
|
super(opts);
|
|
@@ -75605,7 +75609,7 @@ var require_hpagent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
75605
75609
|
requestOptions.headers["proxy-authorization"] = `Basic ${base64}`;
|
|
75606
75610
|
}
|
|
75607
75611
|
if (this.proxy.protocol === "https:") requestOptions.servername = this.proxy.hostname;
|
|
75608
|
-
const request = (this.proxy.protocol === "http:" ? http$
|
|
75612
|
+
const request = (this.proxy.protocol === "http:" ? http$3 : https$2).request(requestOptions);
|
|
75609
75613
|
request.once("connect", (response, socket, head) => {
|
|
75610
75614
|
request.removeAllListeners();
|
|
75611
75615
|
socket.removeAllListeners();
|
|
@@ -88339,12 +88343,12 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88339
88343
|
//#endregion
|
|
88340
88344
|
//#region node_modules/needle/lib/needle.js
|
|
88341
88345
|
var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
88342
|
-
var fs = __require("fs"), http$
|
|
88346
|
+
var fs$1 = __require("fs"), http$2 = __require("http"), https$1 = __require("https"), url = __require("url"), stream = __require("stream"), debug$2 = require_src()("needle"), stringify$1 = require_querystring().build, multipart = require_multipart(), auth = require_auth(), cookies = require_cookies(), parsers = require_parsers(), decoder = require_decoder();
|
|
88343
88347
|
var version = require_package$1().version;
|
|
88344
88348
|
var user_agent = "Needle/" + version;
|
|
88345
88349
|
user_agent += " (Node.js " + process.version + "; " + process.platform + " " + process.arch + ")";
|
|
88346
88350
|
var tls_options = "agent pfx key passphrase cert ca ciphers rejectUnauthorized secureProtocol checkServerIdentity family";
|
|
88347
|
-
var close_by_default = !http$
|
|
88351
|
+
var close_by_default = !http$2.Agent || http$2.Agent.defaultMaxSockets != Infinity;
|
|
88348
88352
|
var extend = Object.assign ? Object.assign : __require("util")._extend;
|
|
88349
88353
|
var redirect_codes = [
|
|
88350
88354
|
301,
|
|
@@ -88431,7 +88435,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88431
88435
|
function get_stream_length(stream, given_length, cb) {
|
|
88432
88436
|
if (given_length > 0) return cb(given_length);
|
|
88433
88437
|
if (stream.end !== void 0 && stream.end !== Infinity && stream.start !== void 0) return cb(stream.end + 1 - (stream.start || 0));
|
|
88434
|
-
fs.stat(stream.path, function(err, stat) {
|
|
88438
|
+
fs$1.stat(stream.path, function(err, stat) {
|
|
88435
88439
|
cb(stat ? stat.size - (stream.start || 0) : null);
|
|
88436
88440
|
});
|
|
88437
88441
|
}
|
|
@@ -88591,12 +88595,12 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88591
88595
|
Needle.prototype.send_request = function(count, method, uri, config, post_data, out, callback) {
|
|
88592
88596
|
if (typeof config.uri_modifier === "function") {
|
|
88593
88597
|
var modified_uri = config.uri_modifier(uri);
|
|
88594
|
-
debug("Modifying request URI", uri + " => " + modified_uri);
|
|
88598
|
+
debug$2("Modifying request URI", uri + " => " + modified_uri);
|
|
88595
88599
|
uri = modified_uri;
|
|
88596
88600
|
}
|
|
88597
|
-
var request, timer, returned = 0, self = this, request_opts = this.get_request_opts(method, uri, config), protocol = request_opts.protocol == "https:" ? https : http$
|
|
88601
|
+
var request, timer, returned = 0, self = this, request_opts = this.get_request_opts(method, uri, config), protocol = request_opts.protocol == "https:" ? https$1 : http$2;
|
|
88598
88602
|
function done(err, resp) {
|
|
88599
|
-
if (returned++ > 0) return debug("Already finished, stopping here.");
|
|
88603
|
+
if (returned++ > 0) return debug$2("Already finished, stopping here.");
|
|
88600
88604
|
if (timer) clearTimeout(timer);
|
|
88601
88605
|
request.removeListener("error", had_error);
|
|
88602
88606
|
out.done = true;
|
|
@@ -88609,7 +88613,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88609
88613
|
});
|
|
88610
88614
|
}
|
|
88611
88615
|
function had_error(err) {
|
|
88612
|
-
debug("Request error", err);
|
|
88616
|
+
debug$2("Request error", err);
|
|
88613
88617
|
out.emit("err", err);
|
|
88614
88618
|
done(err || /* @__PURE__ */ new Error("Unknown error when making request."));
|
|
88615
88619
|
}
|
|
@@ -88628,15 +88632,15 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88628
88632
|
had_error(/* @__PURE__ */ new Error("Remote end closed socket abruptly."));
|
|
88629
88633
|
}
|
|
88630
88634
|
}
|
|
88631
|
-
debug("Making request #" + count, request_opts);
|
|
88635
|
+
debug$2("Making request #" + count, request_opts);
|
|
88632
88636
|
request = protocol.request(request_opts, function(resp) {
|
|
88633
88637
|
var headers = resp.headers;
|
|
88634
|
-
debug("Got response", resp.statusCode, headers);
|
|
88638
|
+
debug$2("Got response", resp.statusCode, headers);
|
|
88635
88639
|
out.emit("response", resp);
|
|
88636
88640
|
set_timeout("read", config.read_timeout);
|
|
88637
88641
|
if (config.parse_cookies && (headers["set-cookie"] || config.previous_resp_cookies)) {
|
|
88638
88642
|
resp.cookies = extend(config.previous_resp_cookies || {}, cookies.read(headers["set-cookie"]));
|
|
88639
|
-
debug("Got cookies", resp.cookies);
|
|
88643
|
+
debug$2("Got cookies", resp.cookies);
|
|
88640
88644
|
}
|
|
88641
88645
|
if (redirect_codes.indexOf(resp.statusCode) !== -1 && self.should_follow(headers.location, config, uri)) {
|
|
88642
88646
|
clearTimeout(timer);
|
|
@@ -88652,13 +88656,13 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88652
88656
|
config.previous_resp_cookies = resp.cookies;
|
|
88653
88657
|
if (Object.keys(request_cookies).length || Object.keys(resp.cookies || {}).length) config.headers["cookie"] = cookies.write(extend(request_cookies, resp.cookies));
|
|
88654
88658
|
} else if (config.headers["cookie"]) {
|
|
88655
|
-
debug("Clearing original request cookie", config.headers["cookie"]);
|
|
88659
|
+
debug$2("Clearing original request cookie", config.headers["cookie"]);
|
|
88656
88660
|
delete config.headers["cookie"];
|
|
88657
88661
|
}
|
|
88658
88662
|
if (config.follow_set_referer) config.headers["referer"] = encodeURI(uri);
|
|
88659
88663
|
config.headers["host"] = null;
|
|
88660
88664
|
var redirect_url = resolve_url(headers.location, uri);
|
|
88661
|
-
debug("Redirecting to " + redirect_url.toString());
|
|
88665
|
+
debug$2("Redirecting to " + redirect_url.toString());
|
|
88662
88666
|
return self.send_request(++count, method, redirect_url.toString(), config, post_data, out, callback);
|
|
88663
88667
|
} else if (config.follow_max > 0) return done(/* @__PURE__ */ new Error("Max redirects reached. Possible loop in: " + headers.location));
|
|
88664
88668
|
}
|
|
@@ -88690,11 +88694,11 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88690
88694
|
} else if (text_response && config.decode_response && mime.charset) pipeline.push(decoder(mime.charset));
|
|
88691
88695
|
pipeline.push(out);
|
|
88692
88696
|
pump_streams([resp].concat(pipeline), function(err) {
|
|
88693
|
-
if (err) debug(err);
|
|
88697
|
+
if (err) debug$2(err);
|
|
88694
88698
|
if (err && err.message == "write after end") request.destroy();
|
|
88695
88699
|
});
|
|
88696
88700
|
if (config.output && resp.statusCode == 200) {
|
|
88697
|
-
var file = fs.createWriteStream(config.output);
|
|
88701
|
+
var file = fs$1.createWriteStream(config.output);
|
|
88698
88702
|
file.on("error", had_error);
|
|
88699
88703
|
out.on("end", function() {
|
|
88700
88704
|
if (file.writable) file.end();
|
|
@@ -88724,7 +88728,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88724
88728
|
}
|
|
88725
88729
|
});
|
|
88726
88730
|
pump_streams([resp, clean_pipe], function(err) {
|
|
88727
|
-
if (err) debug(err);
|
|
88731
|
+
if (err) debug$2(err);
|
|
88728
88732
|
});
|
|
88729
88733
|
if (!config.output || resp.statusCode != 200) out.on("readable", function() {
|
|
88730
88734
|
var chunk;
|
|
@@ -88769,7 +88773,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88769
88773
|
}
|
|
88770
88774
|
});
|
|
88771
88775
|
if (post_data) if (is_stream(post_data)) pump_streams([post_data, request], function(err) {
|
|
88772
|
-
if (err) debug(err);
|
|
88776
|
+
if (err) debug$2(err);
|
|
88773
88777
|
});
|
|
88774
88778
|
else {
|
|
88775
88779
|
request.write(post_data, config.encoding);
|
|
@@ -91406,6 +91410,7 @@ const configure = import_safe_stable_stringify.configure;
|
|
|
91406
91410
|
const stringify = import_safe_stable_stringify.default;
|
|
91407
91411
|
//#endregion
|
|
91408
91412
|
//#region dist/node/clients/rpc-client/schema.js
|
|
91413
|
+
var import_retry = /* @__PURE__ */ __toESM(require_retry$1(), 1);
|
|
91409
91414
|
var import_commonjs = /* @__PURE__ */ __toESM(require_commonjs$4(), 1);
|
|
91410
91415
|
var import_sha256 = require_sha256$1();
|
|
91411
91416
|
const SubscriptionIdSchema = number().positive().int();
|
|
@@ -97874,7 +97879,6 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
97874
97879
|
}));
|
|
97875
97880
|
//#endregion
|
|
97876
97881
|
//#region dist/node/clients/pkc-typed-emitter.js
|
|
97877
|
-
var import_retry = /* @__PURE__ */ __toESM(require_retry$1(), 1);
|
|
97878
97882
|
var import_lib$1 = require_lib$1();
|
|
97879
97883
|
var PKCTypedEmitter = class extends import_lib$1.TypedEmitter {
|
|
97880
97884
|
constructor() {
|
|
@@ -101331,14 +101335,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
|
|
|
101331
101335
|
};
|
|
101332
101336
|
//#endregion
|
|
101333
101337
|
//#region dist/node/runtime/node/util.js
|
|
101334
|
-
const getDefaultDataPath = () => path.join(process.cwd(), ".pkc");
|
|
101338
|
+
const getDefaultDataPath = () => path$1.join(process.cwd(), ".pkc");
|
|
101335
101339
|
const getDefaultCommunityDbConfig = async (communityAddress, pkc) => {
|
|
101336
101340
|
let filename;
|
|
101337
101341
|
if (pkc.noData) filename = ":memory:";
|
|
101338
101342
|
else {
|
|
101339
101343
|
assert(typeof pkc.dataPath === "string", "pkc.dataPath need to be defined to get default community db config");
|
|
101340
|
-
filename = path.join(pkc.dataPath, "communities", communityAddress);
|
|
101341
|
-
await promises.mkdir(path.dirname(filename), { recursive: true });
|
|
101344
|
+
filename = path$1.join(pkc.dataPath, "communities", communityAddress);
|
|
101345
|
+
await promises.mkdir(path$1.dirname(filename), { recursive: true });
|
|
101342
101346
|
}
|
|
101343
101347
|
return {
|
|
101344
101348
|
filename,
|
|
@@ -101437,7 +101441,7 @@ const setNativeFunctions = (newNativeFunctions) => {
|
|
|
101437
101441
|
};
|
|
101438
101442
|
const deleteOldCommunityInWindows = async (subPath, pkc) => {
|
|
101439
101443
|
const log = logger_default("pkc-js:community:deleteStaleCommunityInWindows");
|
|
101440
|
-
const communityAddress = path.basename(subPath);
|
|
101444
|
+
const communityAddress = path$1.basename(subPath);
|
|
101441
101445
|
await new Promise((resolve) => setTimeout(resolve, 1e4));
|
|
101442
101446
|
try {
|
|
101443
101447
|
await promises.rm(subPath, { force: true });
|
|
@@ -101461,7 +101465,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
|
|
|
101461
101465
|
}
|
|
101462
101466
|
const communitiesThatWereDeletedSuccessfully = [];
|
|
101463
101467
|
for (const communityAddress of deletedPersistentCommunities) {
|
|
101464
|
-
const communityPath = path.join(pkc.dataPath, "communities", communityAddress);
|
|
101468
|
+
const communityPath = path$1.join(pkc.dataPath, "communities", communityAddress);
|
|
101465
101469
|
try {
|
|
101466
101470
|
await promises.rm(communityPath, { force: true });
|
|
101467
101471
|
log(`Succeeded in deleting old db path (${communityAddress})`);
|
|
@@ -101485,7 +101489,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
|
|
|
101485
101489
|
function listCommunitiesSync(pkc) {
|
|
101486
101490
|
logger_default("pkc-js:listCommunitiesSync");
|
|
101487
101491
|
if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath needs to be defined to listCommunities");
|
|
101488
|
-
const communitiesPath = path.join(pkc.dataPath, "communities");
|
|
101492
|
+
const communitiesPath = path$1.join(pkc.dataPath, "communities");
|
|
101489
101493
|
const files = readdirSync(communitiesPath, {
|
|
101490
101494
|
recursive: false,
|
|
101491
101495
|
withFileTypes: false
|
|
@@ -101493,7 +101497,7 @@ function listCommunitiesSync(pkc) {
|
|
|
101493
101497
|
const communityFilesWeDontNeedToCheck = pkc.communities ? files.filter((address) => pkc.communities.includes(address)) : [];
|
|
101494
101498
|
const sqliteFiles = files.filter((address) => !communityFilesWeDontNeedToCheck.includes(address)).filter((address) => {
|
|
101495
101499
|
try {
|
|
101496
|
-
const filePath = path.join(communitiesPath, address);
|
|
101500
|
+
const filePath = path$1.join(communitiesPath, address);
|
|
101497
101501
|
if (!existsSync(filePath)) return false;
|
|
101498
101502
|
const fd = openSync(filePath, "r");
|
|
101499
101503
|
const buffer = Buffer.alloc(16);
|
|
@@ -101574,7 +101578,7 @@ var BackupAbortError = class extends Error {
|
|
|
101574
101578
|
async function backupCommunityDb(opts) {
|
|
101575
101579
|
const { sourcePath, destPath, includePrivateKey, onProgress, signal } = opts;
|
|
101576
101580
|
if (signal?.aborted) throw new BackupAbortError();
|
|
101577
|
-
await promises.mkdir(path.dirname(destPath), { recursive: true });
|
|
101581
|
+
await promises.mkdir(path$1.dirname(destPath), { recursive: true });
|
|
101578
101582
|
const partialPath = destPath + ".partial";
|
|
101579
101583
|
try {
|
|
101580
101584
|
await promises.unlink(partialPath);
|
|
@@ -101658,9 +101662,9 @@ async function statAndHashFile(filePath) {
|
|
|
101658
101662
|
}
|
|
101659
101663
|
async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
|
|
101660
101664
|
if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath is not defined");
|
|
101661
|
-
const oldPath = path.join(pkc.dataPath, "communities", communityAddress);
|
|
101662
|
-
const newPath = path.join(pkc.dataPath, "communities", "deleted", communityAddress);
|
|
101663
|
-
await promises.mkdir(path.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
|
|
101665
|
+
const oldPath = path$1.join(pkc.dataPath, "communities", communityAddress);
|
|
101666
|
+
const newPath = path$1.join(pkc.dataPath, "communities", "deleted", communityAddress);
|
|
101667
|
+
await promises.mkdir(path$1.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
|
|
101664
101668
|
if (!existsSync(oldPath)) throw Error(`Source database ${oldPath} does not exist`);
|
|
101665
101669
|
try {
|
|
101666
101670
|
const sourceDb = new Database(oldPath, { fileMustExist: true });
|
|
@@ -101695,7 +101699,7 @@ function createKuboRpcClient(kuboRpcClientOptions) {
|
|
|
101695
101699
|
}
|
|
101696
101700
|
async function monitorCommunitiesDirectory(pkc) {
|
|
101697
101701
|
const watchAbortController = new AbortController();
|
|
101698
|
-
const communitiesPath = path.join(pkc.dataPath, "communities");
|
|
101702
|
+
const communitiesPath = path$1.join(pkc.dataPath, "communities");
|
|
101699
101703
|
await promises.mkdir(communitiesPath, { recursive: true });
|
|
101700
101704
|
const extensionsToIgnore = [
|
|
101701
101705
|
".lock",
|
|
@@ -125575,6 +125579,525 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125575
125579
|
}
|
|
125576
125580
|
};
|
|
125577
125581
|
//#endregion
|
|
125582
|
+
//#region dist/node/runtime/node/address-rewriter-db.js
|
|
125583
|
+
const debug$1 = logger_default("pkc-js:address-rewriter-db");
|
|
125584
|
+
var AddressRewriterDatabase = class {
|
|
125585
|
+
constructor(dataPath, kuboConfig, proxyTarget) {
|
|
125586
|
+
this._db = null;
|
|
125587
|
+
this._dbPath = this._initializeDbPath(dataPath, kuboConfig, proxyTarget);
|
|
125588
|
+
}
|
|
125589
|
+
_initializeDbPath(dataPath, kuboConfig, proxyTarget) {
|
|
125590
|
+
if (!dataPath) throw new Error("dataPath must be defined for request logging");
|
|
125591
|
+
let kuboIdentifier = "unknown";
|
|
125592
|
+
if (kuboConfig && typeof kuboConfig === "object" && "host" in kuboConfig && "port" in kuboConfig) kuboIdentifier = `${kuboConfig.host}_${kuboConfig.port}`;
|
|
125593
|
+
const proxyIdentifier = `${proxyTarget.hostname}_${proxyTarget.port || (proxyTarget.protocol === "https:" ? "443" : "80")}`;
|
|
125594
|
+
const fileName = `address_rewriter_${kuboIdentifier}_${proxyIdentifier}.db`;
|
|
125595
|
+
return path.join(dataPath, ".address-rewriter", fileName);
|
|
125596
|
+
}
|
|
125597
|
+
async initialize() {
|
|
125598
|
+
try {
|
|
125599
|
+
const dbDir = path.dirname(this._dbPath);
|
|
125600
|
+
await fs.mkdir(dbDir, { recursive: true });
|
|
125601
|
+
this._db = new Database(this._dbPath);
|
|
125602
|
+
this._db.exec(`
|
|
125603
|
+
CREATE TABLE IF NOT EXISTS request_logs (
|
|
125604
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
125605
|
+
keys TEXT NOT NULL,
|
|
125606
|
+
received_at INTEGER NOT NULL,
|
|
125607
|
+
transmitted_at INTEGER,
|
|
125608
|
+
success INTEGER NOT NULL,
|
|
125609
|
+
status_code INTEGER,
|
|
125610
|
+
method TEXT NOT NULL,
|
|
125611
|
+
url TEXT NOT NULL,
|
|
125612
|
+
error TEXT,
|
|
125613
|
+
retry_count INTEGER DEFAULT 0,
|
|
125614
|
+
body_preview TEXT,
|
|
125615
|
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
125616
|
+
)
|
|
125617
|
+
`);
|
|
125618
|
+
this._db.exec(`
|
|
125619
|
+
CREATE TABLE IF NOT EXISTS reprovide_logs (
|
|
125620
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
125621
|
+
key TEXT NOT NULL,
|
|
125622
|
+
timestamp INTEGER NOT NULL,
|
|
125623
|
+
success INTEGER NOT NULL,
|
|
125624
|
+
error TEXT,
|
|
125625
|
+
block_not_local INTEGER DEFAULT 0,
|
|
125626
|
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
125627
|
+
)
|
|
125628
|
+
`);
|
|
125629
|
+
this._db.exec(`
|
|
125630
|
+
CREATE TABLE IF NOT EXISTS failed_keys (
|
|
125631
|
+
key TEXT PRIMARY KEY,
|
|
125632
|
+
added_at INTEGER NOT NULL,
|
|
125633
|
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
125634
|
+
)
|
|
125635
|
+
`);
|
|
125636
|
+
this._db.exec(`
|
|
125637
|
+
CREATE INDEX IF NOT EXISTS idx_request_logs_received_at ON request_logs(received_at);
|
|
125638
|
+
CREATE INDEX IF NOT EXISTS idx_reprovide_logs_timestamp ON reprovide_logs(timestamp);
|
|
125639
|
+
CREATE INDEX IF NOT EXISTS idx_reprovide_logs_key ON reprovide_logs(key);
|
|
125640
|
+
`);
|
|
125641
|
+
try {
|
|
125642
|
+
this._db.exec("ALTER TABLE request_logs ADD COLUMN body_preview TEXT");
|
|
125643
|
+
} catch (error) {
|
|
125644
|
+
if (!(error instanceof Error ? error.message : String(error)).toLowerCase().includes("duplicate column name")) throw error;
|
|
125645
|
+
}
|
|
125646
|
+
debug$1(`Initialized SQLite database at ${this._dbPath}`);
|
|
125647
|
+
} catch (error) {
|
|
125648
|
+
debug$1.error(`Failed to initialize database at ${this._dbPath}:`, error);
|
|
125649
|
+
throw error;
|
|
125650
|
+
}
|
|
125651
|
+
}
|
|
125652
|
+
close() {
|
|
125653
|
+
if (this._db) {
|
|
125654
|
+
this._db.close();
|
|
125655
|
+
this._db = null;
|
|
125656
|
+
}
|
|
125657
|
+
}
|
|
125658
|
+
insertRequestLogs(logs) {
|
|
125659
|
+
if (!this._db) throw new Error("Database not initialized");
|
|
125660
|
+
const insertStmt = this._db.prepare(`
|
|
125661
|
+
INSERT INTO request_logs (
|
|
125662
|
+
keys, received_at, transmitted_at, success, status_code,
|
|
125663
|
+
method, url, error, retry_count, body_preview
|
|
125664
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
125665
|
+
`);
|
|
125666
|
+
this._db.transaction(() => {
|
|
125667
|
+
for (const log of logs) insertStmt.run(JSON.stringify(log.keys), log.receivedAt, log.transmittedAt || null, log.success ? 1 : 0, log.statusCode || null, log.method, log.url, log.error || null, log.retryCount || 0, log.bodyPreview || null);
|
|
125668
|
+
})();
|
|
125669
|
+
}
|
|
125670
|
+
insertReprovideLog(key, success, error, blockNotLocal) {
|
|
125671
|
+
if (!this._db) throw new Error("Database not initialized");
|
|
125672
|
+
this._db.prepare(`
|
|
125673
|
+
INSERT INTO reprovide_logs (key, timestamp, success, error, block_not_local)
|
|
125674
|
+
VALUES (?, ?, ?, ?, ?)
|
|
125675
|
+
`).run(key, Date.now(), success ? 1 : 0, error || null, blockNotLocal ? 1 : 0);
|
|
125676
|
+
}
|
|
125677
|
+
loadFailedKeys() {
|
|
125678
|
+
if (!this._db) return [];
|
|
125679
|
+
try {
|
|
125680
|
+
return this._db.prepare("SELECT key FROM failed_keys").all().map((row) => row.key);
|
|
125681
|
+
} catch (error) {
|
|
125682
|
+
debug$1.error("Failed to load failed keys from database:", error);
|
|
125683
|
+
return [];
|
|
125684
|
+
}
|
|
125685
|
+
}
|
|
125686
|
+
saveFailedKeys(keys) {
|
|
125687
|
+
if (!this._db) throw new Error("Database not initialized");
|
|
125688
|
+
this._db.transaction(() => {
|
|
125689
|
+
this._db.exec("DELETE FROM failed_keys");
|
|
125690
|
+
if (keys.length > 0) {
|
|
125691
|
+
const insertStmt = this._db.prepare("INSERT INTO failed_keys (key, added_at) VALUES (?, ?)");
|
|
125692
|
+
const now = Date.now();
|
|
125693
|
+
for (const key of keys) insertStmt.run(key, now);
|
|
125694
|
+
}
|
|
125695
|
+
})();
|
|
125696
|
+
}
|
|
125697
|
+
};
|
|
125698
|
+
//#endregion
|
|
125699
|
+
//#region dist/node/runtime/node/addresses-rewriter-proxy-server.js
|
|
125700
|
+
const debug = logger_default("pkc-js:addresses-rewriter");
|
|
125701
|
+
const MAX_BODY_PREVIEW_BYTES = 4096;
|
|
125702
|
+
function normalizeSelfAddrsForProvider(addrs, peerId) {
|
|
125703
|
+
const suffix = `/p2p/${peerId}`;
|
|
125704
|
+
return import_commonjs.unique(addrs.map((addr) => addr.endsWith(suffix) ? addr.slice(0, -suffix.length) : addr));
|
|
125705
|
+
}
|
|
125706
|
+
var AddressesRewriterProxyServer = class {
|
|
125707
|
+
constructor({ kuboClients: kuboClient, port, hostname, proxyTargetUrl, pkc }) {
|
|
125708
|
+
this._requestLogBuffer = [];
|
|
125709
|
+
this._isWritingLogs = false;
|
|
125710
|
+
this._failedKeys = /* @__PURE__ */ new Set();
|
|
125711
|
+
this._isRetrying = false;
|
|
125712
|
+
this.addresses = {};
|
|
125713
|
+
this.kuboClients = kuboClient;
|
|
125714
|
+
this.port = port;
|
|
125715
|
+
this.hostname = hostname || "127.0.0.1";
|
|
125716
|
+
this.proxyTarget = new URL(proxyTargetUrl);
|
|
125717
|
+
this.server = http.createServer((req, res) => this._proxyRequestRewrite(req, res));
|
|
125718
|
+
this._storageKeyName = `httprouter_proxy_${proxyTargetUrl}`;
|
|
125719
|
+
this._pkc = pkc;
|
|
125720
|
+
const envValue = process.env.ENABLE_LOGGING_OF_ADDRESS_REWRITER_PROXY;
|
|
125721
|
+
this._loggingEnabled = envValue === "1" || envValue?.toLowerCase() === "true";
|
|
125722
|
+
if (this._loggingEnabled) {
|
|
125723
|
+
const kuboConfig = this.kuboClients?.[0]?.getEndpointConfig();
|
|
125724
|
+
this._db = new AddressRewriterDatabase(this._pkc.dataPath, kuboConfig, this.proxyTarget);
|
|
125725
|
+
} else this._db = null;
|
|
125726
|
+
this._httpAgent = new http.Agent({
|
|
125727
|
+
keepAlive: true,
|
|
125728
|
+
keepAliveMsecs: 3e4,
|
|
125729
|
+
maxSockets: 50,
|
|
125730
|
+
timeout: 1e4
|
|
125731
|
+
});
|
|
125732
|
+
this._httpsAgent = new https.Agent({
|
|
125733
|
+
keepAlive: true,
|
|
125734
|
+
keepAliveMsecs: 3e4,
|
|
125735
|
+
maxSockets: 50,
|
|
125736
|
+
timeout: 1e4
|
|
125737
|
+
});
|
|
125738
|
+
hideClassPrivateProps(this);
|
|
125739
|
+
}
|
|
125740
|
+
async listen(callback) {
|
|
125741
|
+
if (this._loggingEnabled && this._db) {
|
|
125742
|
+
await this._db.initialize();
|
|
125743
|
+
debug("Request logging enabled for addresses rewriter proxy");
|
|
125744
|
+
} else debug("Request logging disabled for addresses rewriter proxy");
|
|
125745
|
+
await this._startUpdateAddressesLoop();
|
|
125746
|
+
if (this._loggingEnabled) this._startRequestLogging();
|
|
125747
|
+
await this._startFailedKeysRetry();
|
|
125748
|
+
this.server.on("error", (err) => debug.error("Error with address rewriter proxy", this.server.address(), "Proxy target", this.proxyTarget, err));
|
|
125749
|
+
this.server.listen(this.port, this.hostname, callback);
|
|
125750
|
+
debug("Addresses rewriter proxy at", this.hostname + ":" + this.port, "started listening to forward requests to", this.proxyTarget.host, `- request logging ${this._loggingEnabled ? "enabled" : "disabled"}`);
|
|
125751
|
+
await this._pkc._storage.setItem(this._storageKeyName, `http://${this.hostname}:${this.port}`);
|
|
125752
|
+
}
|
|
125753
|
+
async destroy() {
|
|
125754
|
+
this.server.close();
|
|
125755
|
+
if (this._updateAddressesInterval) clearInterval(this._updateAddressesInterval);
|
|
125756
|
+
if (this._logWriteInterval) clearInterval(this._logWriteInterval);
|
|
125757
|
+
if (this._retryInterval) clearInterval(this._retryInterval);
|
|
125758
|
+
await this._writeRequestLogs();
|
|
125759
|
+
this._db?.close();
|
|
125760
|
+
this._httpAgent.destroy();
|
|
125761
|
+
this._httpsAgent.destroy();
|
|
125762
|
+
await this._pkc._storage.removeItem(this._storageKeyName);
|
|
125763
|
+
}
|
|
125764
|
+
_proxyRequestRewrite(req, res) {
|
|
125765
|
+
let reqBody = "";
|
|
125766
|
+
req.on("data", (chunk) => {
|
|
125767
|
+
reqBody += chunk.toString();
|
|
125768
|
+
});
|
|
125769
|
+
req.on("end", () => {
|
|
125770
|
+
const shouldRewrite = req.method === "PUT" || req.method === "POST";
|
|
125771
|
+
let requestLogEntry = null;
|
|
125772
|
+
if (shouldRewrite) {
|
|
125773
|
+
const keys = this._extractKeysFromRequestBody(reqBody);
|
|
125774
|
+
const shouldLogRequest = this._loggingEnabled;
|
|
125775
|
+
if (keys.length > 0 || shouldLogRequest) {
|
|
125776
|
+
requestLogEntry = {
|
|
125777
|
+
keys,
|
|
125778
|
+
receivedAt: Date.now(),
|
|
125779
|
+
success: false,
|
|
125780
|
+
method: req.method || "UNKNOWN",
|
|
125781
|
+
url: req.url || "/",
|
|
125782
|
+
retryCount: 0,
|
|
125783
|
+
bodyPreview: shouldLogRequest ? this._createBodyPreview(reqBody) : void 0
|
|
125784
|
+
};
|
|
125785
|
+
if (shouldLogRequest) this._requestLogBuffer.push(requestLogEntry);
|
|
125786
|
+
}
|
|
125787
|
+
}
|
|
125788
|
+
let rewrittenBody = reqBody;
|
|
125789
|
+
if (shouldRewrite && rewrittenBody) try {
|
|
125790
|
+
const json = JSON.parse(rewrittenBody);
|
|
125791
|
+
if (json.Providers && Array.isArray(json.Providers)) {
|
|
125792
|
+
for (const provider of json.Providers) {
|
|
125793
|
+
const peerId = provider?.Payload?.ID;
|
|
125794
|
+
if (peerId && this.addresses[peerId]) provider.Payload.Addrs = this.addresses[peerId];
|
|
125795
|
+
}
|
|
125796
|
+
rewrittenBody = JSON.stringify(json);
|
|
125797
|
+
}
|
|
125798
|
+
} catch (e) {
|
|
125799
|
+
debug("proxy body rewrite error:", e, "body", rewrittenBody, req.url, req.method);
|
|
125800
|
+
}
|
|
125801
|
+
this._proxyRequest(req, res, rewrittenBody, requestLogEntry);
|
|
125802
|
+
});
|
|
125803
|
+
req.on("error", (err) => {
|
|
125804
|
+
debug.trace("Request error:", req.url, req.method, req.headers, reqBody, err);
|
|
125805
|
+
if (!res.headersSent) {
|
|
125806
|
+
debug.trace("Request error:", req.url, req.method, req.headers, reqBody, err);
|
|
125807
|
+
res.writeHead(500);
|
|
125808
|
+
res.end("Internal Server Error");
|
|
125809
|
+
}
|
|
125810
|
+
});
|
|
125811
|
+
}
|
|
125812
|
+
_proxyRequest(req, res, rewrittenBody, requestLogEntry) {
|
|
125813
|
+
if (requestLogEntry) {
|
|
125814
|
+
requestLogEntry.retryCount = 0;
|
|
125815
|
+
requestLogEntry.transmittedAt = Date.now();
|
|
125816
|
+
}
|
|
125817
|
+
const { request: httpRequest } = this.proxyTarget.protocol === "https:" ? https : http;
|
|
125818
|
+
const agent = this.proxyTarget.protocol === "https:" ? this._httpsAgent : this._httpAgent;
|
|
125819
|
+
const requestOptions = {
|
|
125820
|
+
hostname: this.proxyTarget.hostname,
|
|
125821
|
+
protocol: this.proxyTarget.protocol,
|
|
125822
|
+
path: req.url,
|
|
125823
|
+
method: req.method,
|
|
125824
|
+
headers: {
|
|
125825
|
+
...req.headers,
|
|
125826
|
+
"content-length": Buffer.byteLength(rewrittenBody),
|
|
125827
|
+
host: this.proxyTarget.host
|
|
125828
|
+
},
|
|
125829
|
+
agent,
|
|
125830
|
+
timeout: 1e4
|
|
125831
|
+
};
|
|
125832
|
+
if (this.proxyTarget.port) requestOptions.port = this.proxyTarget.port;
|
|
125833
|
+
const proxyReq = httpRequest(requestOptions);
|
|
125834
|
+
proxyReq.setTimeout(1e4, () => {
|
|
125835
|
+
debug.trace("Proxy request timed out", requestOptions);
|
|
125836
|
+
if (requestLogEntry) {
|
|
125837
|
+
requestLogEntry.success = false;
|
|
125838
|
+
requestLogEntry.statusCode = 504;
|
|
125839
|
+
requestLogEntry.error = "Request timeout";
|
|
125840
|
+
requestLogEntry.completed = true;
|
|
125841
|
+
if (requestLogEntry.keys) {
|
|
125842
|
+
const sizeBefore = this._failedKeys.size;
|
|
125843
|
+
requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
|
|
125844
|
+
if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
|
|
125845
|
+
}
|
|
125846
|
+
}
|
|
125847
|
+
proxyReq.destroy();
|
|
125848
|
+
if (!res.headersSent) {
|
|
125849
|
+
res.writeHead(504);
|
|
125850
|
+
res.end("Gateway Timeout");
|
|
125851
|
+
}
|
|
125852
|
+
});
|
|
125853
|
+
proxyReq.on("error", (e) => {
|
|
125854
|
+
proxyReq.destroy();
|
|
125855
|
+
if (requestLogEntry) {
|
|
125856
|
+
requestLogEntry.success = false;
|
|
125857
|
+
requestLogEntry.statusCode = 500;
|
|
125858
|
+
requestLogEntry.error = `Proxy error: ${e.message}`;
|
|
125859
|
+
requestLogEntry.completed = true;
|
|
125860
|
+
debug.trace(`Updated log entry with error for keys: ${requestLogEntry.keys.join(", ")}`);
|
|
125861
|
+
if (requestLogEntry.keys) {
|
|
125862
|
+
const sizeBefore = this._failedKeys.size;
|
|
125863
|
+
requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
|
|
125864
|
+
if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
|
|
125865
|
+
}
|
|
125866
|
+
}
|
|
125867
|
+
if (!res.headersSent) {
|
|
125868
|
+
debug.trace("address rewriter proxy error:", e, "Request options", requestOptions);
|
|
125869
|
+
res.writeHead(500);
|
|
125870
|
+
res.end("Internal Server Error");
|
|
125871
|
+
}
|
|
125872
|
+
});
|
|
125873
|
+
proxyReq.on("response", (proxyRes) => {
|
|
125874
|
+
const statusCode = proxyRes.statusCode || 500;
|
|
125875
|
+
const isSuccess = statusCode >= 200 && statusCode < 300;
|
|
125876
|
+
if (requestLogEntry) {
|
|
125877
|
+
requestLogEntry.success = isSuccess;
|
|
125878
|
+
requestLogEntry.statusCode = statusCode;
|
|
125879
|
+
requestLogEntry.completed = true;
|
|
125880
|
+
if (!isSuccess) {
|
|
125881
|
+
requestLogEntry.error = `HTTP ${statusCode}`;
|
|
125882
|
+
if (requestLogEntry.keys) {
|
|
125883
|
+
const sizeBefore = this._failedKeys.size;
|
|
125884
|
+
requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
|
|
125885
|
+
if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
|
|
125886
|
+
}
|
|
125887
|
+
}
|
|
125888
|
+
}
|
|
125889
|
+
proxyRes.on("error", (err) => {
|
|
125890
|
+
debug.trace("Proxy response error:", err);
|
|
125891
|
+
if (!res.headersSent) {
|
|
125892
|
+
res.writeHead(500);
|
|
125893
|
+
res.end("Proxy Response Error");
|
|
125894
|
+
}
|
|
125895
|
+
if (requestLogEntry) {
|
|
125896
|
+
requestLogEntry.success = false;
|
|
125897
|
+
requestLogEntry.statusCode = 500;
|
|
125898
|
+
requestLogEntry.error = `Proxy response error: ${err.message}`;
|
|
125899
|
+
requestLogEntry.completed = true;
|
|
125900
|
+
}
|
|
125901
|
+
proxyRes.destroy(err);
|
|
125902
|
+
});
|
|
125903
|
+
if (!res.headersSent) {
|
|
125904
|
+
res.writeHead(statusCode, proxyRes.headers);
|
|
125905
|
+
proxyRes.pipe(res);
|
|
125906
|
+
}
|
|
125907
|
+
res.on("finish", () => {
|
|
125908
|
+
proxyRes.resume();
|
|
125909
|
+
});
|
|
125910
|
+
});
|
|
125911
|
+
proxyReq.write(rewrittenBody);
|
|
125912
|
+
proxyReq.end();
|
|
125913
|
+
}
|
|
125914
|
+
async _startUpdateAddressesLoop() {
|
|
125915
|
+
if (!this.kuboClients?.length) throw Error("should have a defined kubo rpc client option to start the address rewriter");
|
|
125916
|
+
const isRetriableError = (error) => {
|
|
125917
|
+
if (typeof error !== "object" || error === null) return false;
|
|
125918
|
+
const err = error;
|
|
125919
|
+
return err.response?.status === 500 || err.status === 500 || err.statusCode === 500;
|
|
125920
|
+
};
|
|
125921
|
+
const tryUpdateAddressesForClient = async (kuboClient) => {
|
|
125922
|
+
return new Promise((resolve) => {
|
|
125923
|
+
const operation = import_retry.operation({
|
|
125924
|
+
retries: 3,
|
|
125925
|
+
factor: 2,
|
|
125926
|
+
minTimeout: 1e3,
|
|
125927
|
+
maxTimeout: 8e3
|
|
125928
|
+
});
|
|
125929
|
+
operation.attempt(async (currentAttempt) => {
|
|
125930
|
+
try {
|
|
125931
|
+
const idRes = await kuboClient.id();
|
|
125932
|
+
const swarmAddrsRes = await kuboClient.swarm.addrs();
|
|
125933
|
+
const peerId = idRes.id.toString();
|
|
125934
|
+
if (typeof peerId !== "string") throw Error("Failed to get Peer ID of kubo node");
|
|
125935
|
+
const swarmListeningAddresses = swarmAddrsRes.filter((swarmAddr) => swarmAddr.id.toString() === peerId);
|
|
125936
|
+
const addresses = normalizeSelfAddrsForProvider([...idRes.addresses.map((addr) => addr.toString()), ...import_commonjs.flatten(swarmListeningAddresses.map((swarmAddr) => swarmAddr.addrs.map((addr) => addr.toString())))], peerId);
|
|
125937
|
+
if (addresses.length === 0) throw Error(`Failed to get any addresses for peer ${peerId}`);
|
|
125938
|
+
this.addresses[peerId] = addresses;
|
|
125939
|
+
resolve();
|
|
125940
|
+
} catch (e) {
|
|
125941
|
+
const error = e;
|
|
125942
|
+
if (isRetriableError(error)) {
|
|
125943
|
+
debug(`tryUpdateAddresses attempt ${currentAttempt}/4 failed with 500 error:`, error.message, { kuboConfig: kuboClient.getEndpointConfig() });
|
|
125944
|
+
if (operation.retry(error)) return;
|
|
125945
|
+
}
|
|
125946
|
+
debug("tryUpdateAddresses error:", error.message, { kuboConfig: kuboClient.getEndpointConfig() });
|
|
125947
|
+
resolve();
|
|
125948
|
+
}
|
|
125949
|
+
});
|
|
125950
|
+
});
|
|
125951
|
+
};
|
|
125952
|
+
const tryUpdateAddresses = async () => {
|
|
125953
|
+
const promises = this.kuboClients.map(tryUpdateAddressesForClient);
|
|
125954
|
+
await Promise.allSettled(promises);
|
|
125955
|
+
};
|
|
125956
|
+
await tryUpdateAddresses();
|
|
125957
|
+
this._updateAddressesInterval = setInterval(tryUpdateAddresses, 1e3 * 60);
|
|
125958
|
+
}
|
|
125959
|
+
_extractKeysFromRequestBody(body) {
|
|
125960
|
+
try {
|
|
125961
|
+
const json = JSON.parse(body);
|
|
125962
|
+
const keys = [];
|
|
125963
|
+
if (json.Providers && Array.isArray(json.Providers)) {
|
|
125964
|
+
for (const provider of json.Providers) if (provider?.Payload?.Keys) keys.push(...provider.Payload.Keys);
|
|
125965
|
+
}
|
|
125966
|
+
return keys;
|
|
125967
|
+
} catch {
|
|
125968
|
+
return [];
|
|
125969
|
+
}
|
|
125970
|
+
}
|
|
125971
|
+
_createBodyPreview(body) {
|
|
125972
|
+
const buffer = Buffer.from(body, "utf8");
|
|
125973
|
+
if (buffer.length <= MAX_BODY_PREVIEW_BYTES) return body;
|
|
125974
|
+
return `${buffer.subarray(0, MAX_BODY_PREVIEW_BYTES).toString("utf8")}...[truncated ${buffer.length - MAX_BODY_PREVIEW_BYTES} bytes]`;
|
|
125975
|
+
}
|
|
125976
|
+
async _writeRequestLogs() {
|
|
125977
|
+
if (!this._loggingEnabled || !this._db) return;
|
|
125978
|
+
if (this._requestLogBuffer.length === 0 || this._isWritingLogs) return;
|
|
125979
|
+
this._isWritingLogs = true;
|
|
125980
|
+
const logsToWrite = this._requestLogBuffer.filter((entry) => entry.completed);
|
|
125981
|
+
if (logsToWrite.length === 0) {
|
|
125982
|
+
this._isWritingLogs = false;
|
|
125983
|
+
return;
|
|
125984
|
+
}
|
|
125985
|
+
const inFlightLogs = this._requestLogBuffer.filter((entry) => !entry.completed);
|
|
125986
|
+
this._requestLogBuffer = inFlightLogs;
|
|
125987
|
+
try {
|
|
125988
|
+
this._db.insertRequestLogs(logsToWrite);
|
|
125989
|
+
debug.trace(`Wrote ${logsToWrite.length} new request log entries to SQLite database`);
|
|
125990
|
+
} catch (error) {
|
|
125991
|
+
debug.error(`Failed to write request logs to SQLite database:`, error);
|
|
125992
|
+
this._requestLogBuffer.unshift(...logsToWrite);
|
|
125993
|
+
} finally {
|
|
125994
|
+
this._isWritingLogs = false;
|
|
125995
|
+
}
|
|
125996
|
+
}
|
|
125997
|
+
_startRequestLogging() {
|
|
125998
|
+
if (!this._loggingEnabled || !this._db) return;
|
|
125999
|
+
const writeInterval = 5 * 1e3;
|
|
126000
|
+
this._logWriteInterval = setInterval(async () => {
|
|
126001
|
+
await this._writeRequestLogs();
|
|
126002
|
+
}, writeInterval);
|
|
126003
|
+
}
|
|
126004
|
+
async _startFailedKeysRetry() {
|
|
126005
|
+
this._loadFailedKeysFromDatabase();
|
|
126006
|
+
const retryInterval = 120 * 1e3;
|
|
126007
|
+
this._retryInterval = setInterval(async () => {
|
|
126008
|
+
if (this._isRetrying) {
|
|
126009
|
+
debug.trace("Previous failed-keys retry still running, skipping this tick");
|
|
126010
|
+
return;
|
|
126011
|
+
}
|
|
126012
|
+
this._isRetrying = true;
|
|
126013
|
+
try {
|
|
126014
|
+
await this._retryFailedKeys();
|
|
126015
|
+
} finally {
|
|
126016
|
+
this._isRetrying = false;
|
|
126017
|
+
}
|
|
126018
|
+
}, retryInterval);
|
|
126019
|
+
debug(`Started failed keys retry with ${this._failedKeys.size} keys from previous sessions`);
|
|
126020
|
+
}
|
|
126021
|
+
_loadFailedKeysFromDatabase() {
|
|
126022
|
+
if (!this._loggingEnabled || !this._db) return;
|
|
126023
|
+
try {
|
|
126024
|
+
const keys = this._db.loadFailedKeys();
|
|
126025
|
+
keys.forEach((key) => this._failedKeys.add(key));
|
|
126026
|
+
debug(`Loaded ${keys.length} failed keys from database`);
|
|
126027
|
+
} catch (error) {
|
|
126028
|
+
debug.error("Failed to load failed keys from database:", error);
|
|
126029
|
+
throw error;
|
|
126030
|
+
}
|
|
126031
|
+
}
|
|
126032
|
+
_saveFailedKeysToDatabase() {
|
|
126033
|
+
if (!this._loggingEnabled || !this._db) return;
|
|
126034
|
+
try {
|
|
126035
|
+
const keys = Array.from(this._failedKeys);
|
|
126036
|
+
this._db.saveFailedKeys(keys);
|
|
126037
|
+
if (keys.length === 0) debug.trace(`All keys successfully provided - no failed keys to save`);
|
|
126038
|
+
else debug.trace(`Saved ${keys.length} failed keys to database`);
|
|
126039
|
+
} catch (error) {
|
|
126040
|
+
debug.error("Failed to save failed keys to database:", error);
|
|
126041
|
+
throw error;
|
|
126042
|
+
}
|
|
126043
|
+
}
|
|
126044
|
+
async _retryFailedKeys() {
|
|
126045
|
+
if (this._failedKeys.size === 0) {
|
|
126046
|
+
debug.trace(`No failed keys to retry - all keys successfully provided`);
|
|
126047
|
+
return;
|
|
126048
|
+
}
|
|
126049
|
+
debug(`Retrying ${this._failedKeys.size} failed keys`);
|
|
126050
|
+
const keysToRetry = Array.from(this._failedKeys);
|
|
126051
|
+
const kuboClient = this.kuboClients?.[0];
|
|
126052
|
+
if (!kuboClient) {
|
|
126053
|
+
debug.error("No kubo client available for retry");
|
|
126054
|
+
return;
|
|
126055
|
+
}
|
|
126056
|
+
const successfulKeys = [];
|
|
126057
|
+
const stillFailedKeys = [];
|
|
126058
|
+
const keysToDiscard = [];
|
|
126059
|
+
for (const key of keysToRetry) try {
|
|
126060
|
+
debug.trace(`Providing key to HTTP routers: ${key}`);
|
|
126061
|
+
const events = [];
|
|
126062
|
+
for await (const event of kuboClient.routing.provide(key, {
|
|
126063
|
+
recursive: true,
|
|
126064
|
+
verbose: true
|
|
126065
|
+
})) {
|
|
126066
|
+
events.push(event);
|
|
126067
|
+
debug(`Routing provide event for ${key}:`, event);
|
|
126068
|
+
}
|
|
126069
|
+
successfulKeys.push(key);
|
|
126070
|
+
debug.trace(`Successfully provided key: ${key}`);
|
|
126071
|
+
this._logReprovideAttempt(key, true, void 0, false);
|
|
126072
|
+
} catch (error) {
|
|
126073
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
126074
|
+
const isBlockNotLocal = errorMessage.includes("block") && errorMessage.includes("not found locally");
|
|
126075
|
+
this._logReprovideAttempt(key, false, errorMessage, isBlockNotLocal);
|
|
126076
|
+
if (isBlockNotLocal) {
|
|
126077
|
+
keysToDiscard.push(key);
|
|
126078
|
+
debug.trace(`Discarding key ${key} - block not found locally, will not retry`);
|
|
126079
|
+
} else {
|
|
126080
|
+
stillFailedKeys.push(key);
|
|
126081
|
+
debug.trace(`Failed to provide key ${key}:`, error);
|
|
126082
|
+
}
|
|
126083
|
+
}
|
|
126084
|
+
successfulKeys.forEach((key) => this._failedKeys.delete(key));
|
|
126085
|
+
keysToDiscard.forEach((key) => this._failedKeys.delete(key));
|
|
126086
|
+
this._saveFailedKeysToDatabase();
|
|
126087
|
+
debug.trace(`Retry completed: ${successfulKeys.length} successful, ${stillFailedKeys.length} still failed, ${keysToDiscard.length} discarded`);
|
|
126088
|
+
}
|
|
126089
|
+
_logReprovideAttempt(key, success, error, blockNotLocal) {
|
|
126090
|
+
if (!this._loggingEnabled || !this._db) return;
|
|
126091
|
+
try {
|
|
126092
|
+
this._db.insertReprovideLog(key, success, error, blockNotLocal);
|
|
126093
|
+
debug.trace(`Logged reprovide attempt for key ${key}: success=${success}, blockNotLocal=${blockNotLocal}`);
|
|
126094
|
+
} catch (error) {
|
|
126095
|
+
debug.error(`Failed to log reprovide attempt for key ${key}:`, error);
|
|
126096
|
+
throw error;
|
|
126097
|
+
}
|
|
126098
|
+
}
|
|
126099
|
+
};
|
|
126100
|
+
//#endregion
|
|
125578
126101
|
//#region node_modules/lru-cache/dist/esm/index.js
|
|
125579
126102
|
/**
|
|
125580
126103
|
* @module LRUCache
|
|
@@ -128930,4 +129453,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
128930
129453
|
}
|
|
128931
129454
|
};
|
|
128932
129455
|
//#endregion
|
|
128933
|
-
export {
|
|
129456
|
+
export { RepliesPages as $, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as $t, deriveDbPosts as A, RpcCidParamSchema as An, verifyCommunityEdit as At, setNativeFunctions as B, RpcFetchCidResultSchema as Bn, getCommunityPublicKeyFromWire as Bt, BackupAbortError as C, parseRpcCommentEventWithPKCErrorIfItFails as Cn, verifyChallengeVerification as Ct, createKuboRpcClient as D, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Dn, verifyCommentPubsubMessage as Dt, calculateInlineRepliesBudget as E, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as En, verifyCommentModeration as Et, importSignerIntoKuboNode as F, RpcExportCommunityModLogsParamSchema as Fn, getAuthorNameFromWire as Ft, REPLY_REPLIES_SORT_TYPES as G, RpcUnsubscribeParamSchema as Gn, getIpfsKeyFromPrivateKey as Gt, CommentClientsManager as H, RpcResolveAuthorNameResultSchema as Hn, decode as Ht, listCommunitiesSync as I, RpcExportCommunityModLogsResultSchema as In, normalizeCreatePublicationAuthor as It, buildPagesRuntimeFields as J, require_lodash_merge as Jn, getPublicKeyFromPrivateKey as Jt, TIMEFRAMES_TO_SECONDS as K, stringify as Kn, getPKCAddressFromPublicKey as Kt, monitorCommunitiesDirectory as L, RpcExportCommunityParamSchema as Ln, buildRuntimeCommunityFields as Lt, getDefaultCommunityDbConfig as M, RpcCommunityIdentifierParamSchema as Mn, buildRuntimeAuthor as Mt, getDefaultDataPath as N, RpcCommunityPageParamSchema as Nn, cleanWireAuthor as Nt, deleteOldCommunityInWindows as O, RpcAuthorNameParamSchema as On, verifyCommentUpdate as Ot, getThumbnailPropsOfLink as P, RpcEditCommunityParamSchema as Pn, getAuthorNameFromRuntime as Pt, parseRawPages as Q, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Qt, moveCommunityDbToDeletedDirectory as R, RpcExportCommunityResultSchema as Rn, getCommunityAddressFromRecord as Rt, encryptEd25519AesGcmPublicKeyBuffer as S, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Sn, verifyChallengeRequest as St, calculateExpectedSignatureSize as T, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as Tn, verifyCommentIpfs as Tt, POSTS_SORT_TYPES as U, RpcSubscriptionIdResultSchema as Un, encode as Ut, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as V, RpcPublishChallengeAnswersParamSchema as Vn, normalizeCommunityInputFromCommunity as Vt, POST_REPLIES_SORT_TYPES as W, RpcSuccessResultSchema as Wn, getBufferedPKCAddressFromPublicKey as Wt, findCommentInPageInstanceRecursively as X, require_undici as Xn, parseCidStringSchemaWithPKCErrorIfItFails as Xt, extractCommunityRuntimeFieldsFromParsedPages as Y, nativeFunctions$1 as Yn, createSchemaRowParser as Yt, iterateOverPageCidsToFindAllCids as Z, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Zt, SignerWithPublicKeyAddress as _, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as _n, signCommunity as _t, pkcJsChallenges as a, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as an, PKCTypedEmitter as at, decryptEd25519AesGcmPublicKeyBuffer as b, parseDecryptedChallengeWithPKCErrorIfItFails as bn, verifyChallengeAnswer as bt, AddressesRewriterProxyServer as c, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as cn, signChallengeAnswer as ct, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as d, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as dn, signChallengeVerification as dt, parseCommentIpfsSchemaWithPKCErrorIfItFails as en, PublicationClientsManager as et, KeyvBetterSqlite3 as f, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as fn, signComment as ft, decodeRpcChallengeVerificationPubsubMsg as g, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as gn, signCommentUpdateForChallengeVerification as gt, decodeRpcChallengeRequestPubsubMsg as h, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as hn, signCommentUpdate as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommunityAddressWithPKCErrorIfItFails as in, pLimit as it, deriveDbReplies as j, RpcCommentRepliesPageParamSchema as jn, verifyVote as jt, deriveCommentIpfsFromCommentTableRow as k, RpcCancelExportParamSchema as kn, verifyCommunity as kt, normalizeSelfAddrsForProvider as l, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as ln, signChallengeMessage as lt, decodeRpcChallengePubsubMsg as m, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as mn, signCommentModeration as mt, RpcRemoteCommunity as n, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as nn, InflightFetchManager as nt, TrackedInstanceRegistry as o, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as on, require_lib$1 as ot, decodeRpcChallengeAnswerPubsubMsg as p, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as pn, signCommentEdit as pt, buildPageRuntimeFields as q, STORAGE_KEYS as qn, getPKCAddressFromPublicKeySync as qt, getChallengeVerification as r, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as rn, pRetry as rt, LRUCache as s, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as sn, cleanUpBeforePublishing as st, RpcLocalCommunity as t, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tn, PKCClientsManager as tt, RemoteCommunity as u, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as un, signChallengeRequest as ut, createSigner as v, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as vn, signCommunityEdit as vt, backupCommunityDb as w, parseRpcCommentUpdateEventWithPKCErrorIfItFails as wn, verifyCommentEdit as wt, encryptEd25519AesGcm as x, parseJsonWithPKCErrorIfFails as xn, verifyChallengeMessage as xt, decryptEd25519AesGcm as y, parseDecryptedChallengeVerification as yn, signVote as yt, resolveDbPostsCidRefs as z, RpcFetchCidParamSchema as zn, getCommunityNameFromWire$1 as zt };
|