@pkcprotocol/pkc-js 0.0.79 → 0.0.81
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 +1 -1
- package/dist/browser/community/community-client-manager.d.ts +2 -0
- package/dist/browser/community/community-client-manager.js +164 -9
- package/dist/browser/community/community-client-manager.js.map +1 -1
- package/dist/browser/community/remote-community.d.ts +2 -1
- package/dist/browser/community/remote-community.js +30 -7
- package/dist/browser/community/remote-community.js.map +1 -1
- package/dist/browser/community/rpc-local-community.js.map +1 -1
- package/dist/browser/community/schema.d.ts +31 -4
- package/dist/browser/community/schema.js +16 -10
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/errors.d.ts +3 -0
- package/dist/browser/errors.js +3 -0
- 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/pkc/pkc.d.ts +1 -2
- package/dist/browser/pkc/pkc.js +17 -24
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/rpc/src/index.js +1 -1
- 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/local-community/publication-validation.js +7 -1
- 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/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 +15 -0
- package/dist/browser/signer/signatures.d.ts +1 -0
- package/dist/browser/signer/signatures.js +25 -2
- package/dist/browser/signer/signatures.js.map +1 -1
- package/dist/browser/test/test-util.d.ts +7 -0
- package/dist/browser/test/test-util.js +6 -0
- package/dist/browser/test/test-util.js.map +1 -1
- 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/bundled/bundle-manifest.json +76 -93
- package/dist/bundled/chunks/{helia-for-pkc-7wubsFuU.js → helia-for-pkc-BcNF-orO.js} +33 -33
- package/dist/bundled/chunks/{local-community-Cs0aQLE3.js → local-community-B6-jaMsn.js} +1 -1
- package/dist/bundled/chunks/{local-community-BhRsFFg0.js → local-community-CyX1HwD0.js} +36 -29
- package/dist/bundled/chunks/{node-BKnzoR3G.js → node-BCXmIYLQ.js} +265 -2310
- package/dist/bundled/chunks/{rpc-local-community-DlgrBPH8.js → rpc-local-community-BOiy8BX1.js} +133 -567
- package/dist/bundled/chunks/{schema-C_dFmYMp.js → schema-DZyEx0YQ.js} +9 -5
- package/dist/bundled/chunks/{util-CsiYk_QO.js → util-BTPlI1yF.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/community/community-client-manager.d.ts +2 -0
- package/dist/node/community/community-client-manager.js +164 -9
- package/dist/node/community/community-client-manager.js.map +1 -1
- package/dist/node/community/remote-community.d.ts +2 -1
- package/dist/node/community/remote-community.js +30 -7
- package/dist/node/community/remote-community.js.map +1 -1
- package/dist/node/community/rpc-local-community.js.map +1 -1
- package/dist/node/community/schema.d.ts +31 -4
- package/dist/node/community/schema.js +16 -10
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/errors.d.ts +3 -0
- package/dist/node/errors.js +3 -0
- 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/pkc/pkc.d.ts +1 -2
- package/dist/node/pkc/pkc.js +17 -24
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/rpc/src/index.js +1 -1
- 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/local-community/publication-validation.js +7 -1
- 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/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 +15 -0
- package/dist/node/signer/signatures.d.ts +1 -0
- package/dist/node/signer/signatures.js +25 -2
- package/dist/node/signer/signatures.js.map +1 -1
- package/dist/node/test/test-util.d.ts +7 -0
- package/dist/node/test/test-util.js +6 -0
- package/dist/node/test/test-util.js.map +1 -1
- package/dist/node/util.d.ts +3 -4
- package/dist/node/util.js +7 -3
- package/dist/node/util.js.map +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
package/dist/bundled/chunks/{rpc-local-community-DlgrBPH8.js → rpc-local-community-BOiy8BX1.js}
RENAMED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as pubsubTopicToDhtKey, $n as n$9, $t as CommunityChallengeSettingSchema, A as extractNetworkErrorDetails, Ar as object, At as trackStartedCommunity, B as isIpfsCid, Cn as CommentUpdateChallengeReservedFieldNames, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dr as custom, E as createAbortError, En as CommentUpdateReservedFields, Er as boolean, Et as listUpdatingCommunities, Fn as CommentEditChallengeRequestToEncryptSchema, Ft as untrackUpdatingCommunity, Gn as ChallengeAnswersSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorAddressSchema, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, It as require_sha256$1, Jn as CommunityAddressSchema, Jt as CommentModerationsTableRowSchema, Kn as CidPathSchema, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Mn as GetPageParamSchema, Mr as string, Mt as trackUpdatingCommunity, Nn as ModQueuePageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateSignedPropertyNames, Or as literal, Ot as refreshTrackedCommunityAliases, Pn as PageIpfsSchema, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sn as CommentSignedPropertyNames, Sr as require_ms$1, St as findUpdatingComment, Tn as CommentUpdateForChallengeVerificationSignedPropertyNames, Tr as array, U as isIpnsPath, Un as AuthorCommentIpfsReservedFields, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as CreateCommentEditOptionsWithRefinementSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as CreateSignerSchema, Xt as ChallengeFileFactorySchema, Yn as CommunityAuthorChallengeReservedFieldNames, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as n$10, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentChallengeRequestToEncryptSchema, _r as FailedToFetchPageIpfsFromGatewaysError, _t as timestamp, an as CreateNewLocalCommunityUserOptionsSchema, ar as r$8, b as areEquivalentCommunityAddresses, br as logger_default, c as ChallengeVerificationMessageSignedPropertyNames, cn as ExportCommunityModLogsOptionsSchema, cr as r$7, ct as resolveWhenPredicateIsTrue, dn as CreateVoteUserOptionsWithRefinementSchema, dr as e$4, en as CommunityEditOptionsSchema, f as DecryptedChallengeSchema, fn as VoteChallengeRequestToEncryptSchema, fr as require_retry$1, ft as shortifyAddress, g as PKCParsedOptionsSchema, gr as FailedToFetchGenericIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hn as VoteSignedPropertyNames, hr as FailedToFetchCommunityFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CommunitySignedPropertyNames, ir as t$11, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as CreateCommentOptionsWithRefinementSchema, jr as record, k as doesDomainAddressHaveCapitalLetter, kr as number, l as DecryptedChallengeAnswerSchema, lr as t$10, m as NameResolveCacheOptionsSchema, mr as FailedToFetchCommentUpdateFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsReservedFields, nr as e$6, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRemoteCommunityFunctionArgumentSchema, or as t$12, p as DecryptedChallengeVerificationSchema, pn as VotePubsubMessagePublicationSchema, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, qn as CidStringSchema, qt as CommentModerationSignedPropertyNames, rn as CommunityIpfsSchema, rr as e$5, sn as CreateRpcCommunityFunctionArgumentSchema, sr as n$8, tn as CommunityExportRecordsSchema, tr as t$13, tt as raceAgainstAbort, un as RpcRemoteCommunityUpdateEventResultSchema, ur as t$9, v as PKCUserOptionsSchema, vn as CommentIpfsReservedFields, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as _enum, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, xr as require_supports_color, xt as findStartedCommunity, yn as CommentIpfsSchema, yr as messages, z as isAbortError, zn as CommentEditSignedPropertyNames, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-
|
|
2
|
+
import { $ as pubsubTopicToDhtKey, $n as n$9, $t as CommunityChallengeSettingSchema, A as extractNetworkErrorDetails, Ar as object, At as trackStartedCommunity, B as isIpfsCid, Cn as CommentUpdateChallengeReservedFieldNames, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dr as custom, E as createAbortError, En as CommentUpdateReservedFields, Er as boolean, Et as listUpdatingCommunities, Fn as CommentEditChallengeRequestToEncryptSchema, Ft as untrackUpdatingCommunity, Gn as ChallengeAnswersSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorAddressSchema, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, It as require_sha256$1, Jn as CommunityAddressSchema, Jt as CommentModerationsTableRowSchema, Kn as CidPathSchema, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Mn as GetPageParamSchema, Mr as string, Mt as trackUpdatingCommunity, Nn as ModQueuePageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateSignedPropertyNames, Or as literal, Ot as refreshTrackedCommunityAliases, Pn as PageIpfsSchema, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sn as CommentSignedPropertyNames, Sr as require_ms$1, St as findUpdatingComment, Tn as CommentUpdateForChallengeVerificationSignedPropertyNames, Tr as array, U as isIpnsPath, Un as AuthorCommentIpfsReservedFields, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as CreateCommentEditOptionsWithRefinementSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as CreateSignerSchema, Xt as ChallengeFileFactorySchema, Yn as CommunityAuthorChallengeReservedFieldNames, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as n$10, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentChallengeRequestToEncryptSchema, _r as FailedToFetchPageIpfsFromGatewaysError, _t as timestamp, an as CreateNewLocalCommunityUserOptionsSchema, ar as r$8, b as areEquivalentCommunityAddresses, br as logger_default, c as ChallengeVerificationMessageSignedPropertyNames, cn as ExportCommunityModLogsOptionsSchema, cr as r$7, ct as resolveWhenPredicateIsTrue, dn as CreateVoteUserOptionsWithRefinementSchema, dr as e$4, en as CommunityEditOptionsSchema, f as DecryptedChallengeSchema, fn as VoteChallengeRequestToEncryptSchema, fr as require_retry$1, ft as shortifyAddress, g as PKCParsedOptionsSchema, gr as FailedToFetchGenericIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hn as VoteSignedPropertyNames, hr as FailedToFetchCommunityFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CommunitySignedPropertyNames, ir as t$11, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as CreateCommentOptionsWithRefinementSchema, jr as record, k as doesDomainAddressHaveCapitalLetter, kr as number, l as DecryptedChallengeAnswerSchema, lr as t$10, m as NameResolveCacheOptionsSchema, mr as FailedToFetchCommentUpdateFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsReservedFields, nr as e$6, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRemoteCommunityFunctionArgumentSchema, or as t$12, p as DecryptedChallengeVerificationSchema, pn as VotePubsubMessagePublicationSchema, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, qn as CidStringSchema, qt as CommentModerationSignedPropertyNames, rn as CommunityIpfsSchema, rr as e$5, sn as CreateRpcCommunityFunctionArgumentSchema, sr as n$8, tn as CommunityExportRecordsSchema, tr as t$13, tt as raceAgainstAbort, un as RpcRemoteCommunityUpdateEventResultSchema, ur as t$9, v as PKCUserOptionsSchema, vn as CommentIpfsReservedFields, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as _enum, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, xr as require_supports_color, xt as findStartedCommunity, yn as CommentIpfsSchema, yr as messages, z as isAbortError, zn as CommentEditSignedPropertyNames, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-DZyEx0YQ.js";
|
|
3
3
|
import { t as all } from "./src-CYIMjhjK.js";
|
|
4
|
-
import http from "node:http";
|
|
5
4
|
import { createHash } from "node:crypto";
|
|
6
5
|
import { pathToFileURL } from "node:url";
|
|
7
|
-
import fsp from "node:fs/promises";
|
|
8
|
-
import Path from "node:path";
|
|
9
6
|
import dns from "node:dns";
|
|
10
7
|
import os from "os";
|
|
11
8
|
import { closeSync, createReadStream, existsSync, openSync, promises, readSync, readdirSync, rm, watch } from "node:fs";
|
|
@@ -24,7 +21,6 @@ import { fromString } from "uint8arrays/from-string";
|
|
|
24
21
|
import { bases } from "multiformats/basics";
|
|
25
22
|
import { EventEmitter as EventEmitter$1 } from "events";
|
|
26
23
|
import { concat } from "uint8arrays/concat";
|
|
27
|
-
import https from "node:https";
|
|
28
24
|
import { performance as performance$1 } from "perf_hooks";
|
|
29
25
|
//#region node_modules/undici/lib/core/symbols.js
|
|
30
26
|
var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -7643,7 +7639,7 @@ var require_client_h2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7643
7639
|
var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7644
7640
|
const assert$23 = __require("node:assert");
|
|
7645
7641
|
const net$2 = __require("node:net");
|
|
7646
|
-
const http$
|
|
7642
|
+
const http$3 = __require("node:http");
|
|
7647
7643
|
const util = require_util$6();
|
|
7648
7644
|
const { ClientStats } = require_stats();
|
|
7649
7645
|
const { channels } = require_diagnostics();
|
|
@@ -7655,7 +7651,7 @@ var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7655
7651
|
const connectH1 = require_client_h1();
|
|
7656
7652
|
const connectH2 = require_client_h2();
|
|
7657
7653
|
const kClosedResolve = Symbol("kClosedResolve");
|
|
7658
|
-
const getDefaultNodeMaxHeaderSize = http$
|
|
7654
|
+
const getDefaultNodeMaxHeaderSize = http$3 && http$3.maxHeaderSize && Number.isInteger(http$3.maxHeaderSize) && http$3.maxHeaderSize > 0 ? () => http$3.maxHeaderSize : () => {
|
|
7659
7655
|
throw new InvalidArgumentError("http module not available or http.maxHeaderSize invalid");
|
|
7660
7656
|
};
|
|
7661
7657
|
const noop = () => {};
|
|
@@ -11928,8 +11924,8 @@ var require_snapshot_utils = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
11928
11924
|
//#endregion
|
|
11929
11925
|
//#region node_modules/undici/lib/mock/snapshot-recorder.js
|
|
11930
11926
|
var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11931
|
-
const { writeFile
|
|
11932
|
-
const { dirname
|
|
11927
|
+
const { writeFile, readFile: readFile$1, mkdir } = __require("node:fs/promises");
|
|
11928
|
+
const { dirname, resolve } = __require("node:path");
|
|
11933
11929
|
const { setTimeout: setTimeout$1, clearTimeout: clearTimeout$1 } = __require("node:timers");
|
|
11934
11930
|
const { InvalidArgumentError, UndiciError } = require_errors();
|
|
11935
11931
|
const { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -12215,12 +12211,12 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
12215
12211
|
const path = filePath || this.#snapshotPath;
|
|
12216
12212
|
if (!path) throw new InvalidArgumentError("Snapshot path is required");
|
|
12217
12213
|
const resolvedPath = resolve(path);
|
|
12218
|
-
await mkdir(dirname
|
|
12214
|
+
await mkdir(dirname(resolvedPath), { recursive: true });
|
|
12219
12215
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
12220
12216
|
hash,
|
|
12221
12217
|
snapshot
|
|
12222
12218
|
}));
|
|
12223
|
-
await writeFile
|
|
12219
|
+
await writeFile(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
12224
12220
|
}
|
|
12225
12221
|
/**
|
|
12226
12222
|
* Clears all recorded snapshots
|
|
@@ -75532,10 +75528,10 @@ var require_esm = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
75532
75528
|
//#endregion
|
|
75533
75529
|
//#region node_modules/hpagent/index.js
|
|
75534
75530
|
var require_hpagent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
75535
|
-
const https$
|
|
75536
|
-
const http$
|
|
75531
|
+
const https$1 = __require("https");
|
|
75532
|
+
const http$2 = __require("http");
|
|
75537
75533
|
const { URL: URL$2 } = __require("url");
|
|
75538
|
-
var HttpProxyAgent = class extends http$
|
|
75534
|
+
var HttpProxyAgent = class extends http$2.Agent {
|
|
75539
75535
|
constructor(options) {
|
|
75540
75536
|
const { proxy, proxyRequestOptions, ...opts } = options;
|
|
75541
75537
|
super(opts);
|
|
@@ -75563,7 +75559,7 @@ var require_hpagent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
75563
75559
|
requestOptions.headers["proxy-authorization"] = `Basic ${base64}`;
|
|
75564
75560
|
}
|
|
75565
75561
|
if (this.proxy.protocol === "https:") requestOptions.servername = this.proxy.hostname;
|
|
75566
|
-
const request = (this.proxy.protocol === "http:" ? http$
|
|
75562
|
+
const request = (this.proxy.protocol === "http:" ? http$2 : https$1).request(requestOptions);
|
|
75567
75563
|
request.once("connect", (response, socket, head) => {
|
|
75568
75564
|
request.removeAllListeners();
|
|
75569
75565
|
socket.removeAllListeners();
|
|
@@ -75583,7 +75579,7 @@ var require_hpagent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
75583
75579
|
request.end();
|
|
75584
75580
|
}
|
|
75585
75581
|
};
|
|
75586
|
-
var HttpsProxyAgent = class extends https$
|
|
75582
|
+
var HttpsProxyAgent = class extends https$1.Agent {
|
|
75587
75583
|
constructor(options) {
|
|
75588
75584
|
const { proxy, proxyRequestOptions, ...opts } = options;
|
|
75589
75585
|
super(opts);
|
|
@@ -75611,7 +75607,7 @@ var require_hpagent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
75611
75607
|
requestOptions.headers["proxy-authorization"] = `Basic ${base64}`;
|
|
75612
75608
|
}
|
|
75613
75609
|
if (this.proxy.protocol === "https:") requestOptions.servername = this.proxy.hostname;
|
|
75614
|
-
const request = (this.proxy.protocol === "http:" ? http$
|
|
75610
|
+
const request = (this.proxy.protocol === "http:" ? http$2 : https$1).request(requestOptions);
|
|
75615
75611
|
request.once("connect", (response, socket, head) => {
|
|
75616
75612
|
request.removeAllListeners();
|
|
75617
75613
|
socket.removeAllListeners();
|
|
@@ -78248,7 +78244,7 @@ var require_querystring = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
78248
78244
|
//#endregion
|
|
78249
78245
|
//#region node_modules/needle/lib/multipart.js
|
|
78250
78246
|
var require_multipart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
78251
|
-
var readFile = __require("fs").readFile, basename
|
|
78247
|
+
var readFile = __require("fs").readFile, basename = __require("path").basename;
|
|
78252
78248
|
exports.build = function(data, boundary, callback) {
|
|
78253
78249
|
if (typeof data != "object" || typeof data.pipe == "function") return callback(/* @__PURE__ */ new Error("Multipart builder expects data as key/val object."));
|
|
78254
78250
|
var body = "", object = flatten(data), count = Object.keys(object).length;
|
|
@@ -78287,7 +78283,7 @@ var require_multipart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
78287
78283
|
callback(null, return_part + "\r\n");
|
|
78288
78284
|
}
|
|
78289
78285
|
if ((part.file || part.buffer) && part.content_type) {
|
|
78290
|
-
var filename = part.filename ? part.filename : part.file ? basename
|
|
78286
|
+
var filename = part.filename ? part.filename : part.file ? basename(part.file) : name;
|
|
78291
78287
|
if (part.buffer) return append(part.buffer, filename);
|
|
78292
78288
|
readFile(part.file, function(err, data) {
|
|
78293
78289
|
if (err) return callback(err);
|
|
@@ -88345,12 +88341,12 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88345
88341
|
//#endregion
|
|
88346
88342
|
//#region node_modules/needle/lib/needle.js
|
|
88347
88343
|
var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
88348
|
-
var fs = __require("fs"), http$
|
|
88344
|
+
var fs = __require("fs"), http$1 = __require("http"), https = __require("https"), url = __require("url"), stream = __require("stream"), debug = require_src()("needle"), stringify$1 = require_querystring().build, multipart = require_multipart(), auth = require_auth(), cookies = require_cookies(), parsers = require_parsers(), decoder = require_decoder();
|
|
88349
88345
|
var version = require_package$1().version;
|
|
88350
88346
|
var user_agent = "Needle/" + version;
|
|
88351
88347
|
user_agent += " (Node.js " + process.version + "; " + process.platform + " " + process.arch + ")";
|
|
88352
88348
|
var tls_options = "agent pfx key passphrase cert ca ciphers rejectUnauthorized secureProtocol checkServerIdentity family";
|
|
88353
|
-
var close_by_default = !http$
|
|
88349
|
+
var close_by_default = !http$1.Agent || http$1.Agent.defaultMaxSockets != Infinity;
|
|
88354
88350
|
var extend = Object.assign ? Object.assign : __require("util")._extend;
|
|
88355
88351
|
var redirect_codes = [
|
|
88356
88352
|
301,
|
|
@@ -88597,12 +88593,12 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88597
88593
|
Needle.prototype.send_request = function(count, method, uri, config, post_data, out, callback) {
|
|
88598
88594
|
if (typeof config.uri_modifier === "function") {
|
|
88599
88595
|
var modified_uri = config.uri_modifier(uri);
|
|
88600
|
-
debug
|
|
88596
|
+
debug("Modifying request URI", uri + " => " + modified_uri);
|
|
88601
88597
|
uri = modified_uri;
|
|
88602
88598
|
}
|
|
88603
|
-
var request, timer, returned = 0, self = this, request_opts = this.get_request_opts(method, uri, config), protocol = request_opts.protocol == "https:" ? https
|
|
88599
|
+
var request, timer, returned = 0, self = this, request_opts = this.get_request_opts(method, uri, config), protocol = request_opts.protocol == "https:" ? https : http$1;
|
|
88604
88600
|
function done(err, resp) {
|
|
88605
|
-
if (returned++ > 0) return debug
|
|
88601
|
+
if (returned++ > 0) return debug("Already finished, stopping here.");
|
|
88606
88602
|
if (timer) clearTimeout(timer);
|
|
88607
88603
|
request.removeListener("error", had_error);
|
|
88608
88604
|
out.done = true;
|
|
@@ -88615,7 +88611,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88615
88611
|
});
|
|
88616
88612
|
}
|
|
88617
88613
|
function had_error(err) {
|
|
88618
|
-
debug
|
|
88614
|
+
debug("Request error", err);
|
|
88619
88615
|
out.emit("err", err);
|
|
88620
88616
|
done(err || /* @__PURE__ */ new Error("Unknown error when making request."));
|
|
88621
88617
|
}
|
|
@@ -88634,15 +88630,15 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88634
88630
|
had_error(/* @__PURE__ */ new Error("Remote end closed socket abruptly."));
|
|
88635
88631
|
}
|
|
88636
88632
|
}
|
|
88637
|
-
debug
|
|
88633
|
+
debug("Making request #" + count, request_opts);
|
|
88638
88634
|
request = protocol.request(request_opts, function(resp) {
|
|
88639
88635
|
var headers = resp.headers;
|
|
88640
|
-
debug
|
|
88636
|
+
debug("Got response", resp.statusCode, headers);
|
|
88641
88637
|
out.emit("response", resp);
|
|
88642
88638
|
set_timeout("read", config.read_timeout);
|
|
88643
88639
|
if (config.parse_cookies && (headers["set-cookie"] || config.previous_resp_cookies)) {
|
|
88644
88640
|
resp.cookies = extend(config.previous_resp_cookies || {}, cookies.read(headers["set-cookie"]));
|
|
88645
|
-
debug
|
|
88641
|
+
debug("Got cookies", resp.cookies);
|
|
88646
88642
|
}
|
|
88647
88643
|
if (redirect_codes.indexOf(resp.statusCode) !== -1 && self.should_follow(headers.location, config, uri)) {
|
|
88648
88644
|
clearTimeout(timer);
|
|
@@ -88658,13 +88654,13 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88658
88654
|
config.previous_resp_cookies = resp.cookies;
|
|
88659
88655
|
if (Object.keys(request_cookies).length || Object.keys(resp.cookies || {}).length) config.headers["cookie"] = cookies.write(extend(request_cookies, resp.cookies));
|
|
88660
88656
|
} else if (config.headers["cookie"]) {
|
|
88661
|
-
debug
|
|
88657
|
+
debug("Clearing original request cookie", config.headers["cookie"]);
|
|
88662
88658
|
delete config.headers["cookie"];
|
|
88663
88659
|
}
|
|
88664
88660
|
if (config.follow_set_referer) config.headers["referer"] = encodeURI(uri);
|
|
88665
88661
|
config.headers["host"] = null;
|
|
88666
88662
|
var redirect_url = resolve_url(headers.location, uri);
|
|
88667
|
-
debug
|
|
88663
|
+
debug("Redirecting to " + redirect_url.toString());
|
|
88668
88664
|
return self.send_request(++count, method, redirect_url.toString(), config, post_data, out, callback);
|
|
88669
88665
|
} else if (config.follow_max > 0) return done(/* @__PURE__ */ new Error("Max redirects reached. Possible loop in: " + headers.location));
|
|
88670
88666
|
}
|
|
@@ -88696,7 +88692,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88696
88692
|
} else if (text_response && config.decode_response && mime.charset) pipeline.push(decoder(mime.charset));
|
|
88697
88693
|
pipeline.push(out);
|
|
88698
88694
|
pump_streams([resp].concat(pipeline), function(err) {
|
|
88699
|
-
if (err) debug
|
|
88695
|
+
if (err) debug(err);
|
|
88700
88696
|
if (err && err.message == "write after end") request.destroy();
|
|
88701
88697
|
});
|
|
88702
88698
|
if (config.output && resp.statusCode == 200) {
|
|
@@ -88730,7 +88726,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88730
88726
|
}
|
|
88731
88727
|
});
|
|
88732
88728
|
pump_streams([resp, clean_pipe], function(err) {
|
|
88733
|
-
if (err) debug
|
|
88729
|
+
if (err) debug(err);
|
|
88734
88730
|
});
|
|
88735
88731
|
if (!config.output || resp.statusCode != 200) out.on("readable", function() {
|
|
88736
88732
|
var chunk;
|
|
@@ -88775,7 +88771,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88775
88771
|
}
|
|
88776
88772
|
});
|
|
88777
88773
|
if (post_data) if (is_stream(post_data)) pump_streams([post_data, request], function(err) {
|
|
88778
|
-
if (err) debug
|
|
88774
|
+
if (err) debug(err);
|
|
88779
88775
|
});
|
|
88780
88776
|
else {
|
|
88781
88777
|
request.write(post_data, config.encoding);
|
|
@@ -91645,7 +91641,6 @@ function t(n) {
|
|
|
91645
91641
|
}
|
|
91646
91642
|
//#endregion
|
|
91647
91643
|
//#region dist/node/clients/rpc-client/schema.js
|
|
91648
|
-
var import_retry = /* @__PURE__ */ __toESM(require_retry$1(), 1);
|
|
91649
91644
|
var import_sha256 = require_sha256$1();
|
|
91650
91645
|
const SubscriptionIdSchema = number().positive().int();
|
|
91651
91646
|
const RpcCommentEventResultSchema = object({
|
|
@@ -97817,7 +97812,7 @@ function _allFieldsOfRecordInSignedPropertyNames(record) {
|
|
|
97817
97812
|
async function verifyCommunity({ community, communityIpnsHops, resolveAuthorNames, clientsManager, validatePages, cacheIfValid, abortSignal }) {
|
|
97818
97813
|
const log = logger_default("pkc-js:signatures:verifyCommunity");
|
|
97819
97814
|
if (!Array.isArray(communityIpnsHops) || communityIpnsHops.length === 0) throw Error("verifyCommunity needs a non-empty communityIpnsHops to verify a community record against");
|
|
97820
|
-
const communityIdentityIpnsName = communityIpnsHops[0];
|
|
97815
|
+
const communityIdentityIpnsName = community.anchor?.publicKey ?? communityIpnsHops[0];
|
|
97821
97816
|
const terminalIpnsName = communityIpnsHops[communityIpnsHops.length - 1];
|
|
97822
97817
|
if (!_allFieldsOfRecordInSignedPropertyNames(community)) return {
|
|
97823
97818
|
valid: false,
|
|
@@ -97827,6 +97822,10 @@ async function verifyCommunity({ community, communityIpnsHops, resolveAuthorName
|
|
|
97827
97822
|
valid: false,
|
|
97828
97823
|
reason: messages.ERR_COMMUNITY_RECORD_INCLUDES_RESERVED_FIELD
|
|
97829
97824
|
};
|
|
97825
|
+
if (communityIpnsHops.length > 1 && community.anchor?.publicKey !== communityIpnsHops[0]) return {
|
|
97826
|
+
valid: false,
|
|
97827
|
+
reason: messages.ERR_COMMUNITY_RECORD_ANCHOR_CLAIM_DOES_NOT_MATCH_CHAIN_ANCHOR
|
|
97828
|
+
};
|
|
97830
97829
|
if (!await _verifyJsonSignature(community)) return {
|
|
97831
97830
|
valid: false,
|
|
97832
97831
|
reason: messages.ERR_COMMUNITY_SIGNATURE_IS_INVALID
|
|
@@ -97838,7 +97837,8 @@ async function verifyCommunity({ community, communityIpnsHops, resolveAuthorName
|
|
|
97838
97837
|
const communityForPages = {
|
|
97839
97838
|
publicKey: communityIdentityIpnsName,
|
|
97840
97839
|
name: community.name,
|
|
97841
|
-
signature: community.signature
|
|
97840
|
+
signature: community.signature,
|
|
97841
|
+
anchor: community.anchor
|
|
97842
97842
|
};
|
|
97843
97843
|
if (community.posts?.pages && validatePages) for (const preloadedPageSortName of t$13(community.posts.pages)) {
|
|
97844
97844
|
const pageCid = community.posts.pageCids?.[preloadedPageSortName];
|
|
@@ -98053,6 +98053,13 @@ async function verifyPageComment({ pageComment, community, parentComment, resolv
|
|
|
98053
98053
|
};
|
|
98054
98054
|
}
|
|
98055
98055
|
const commentRecord = pageComment.comment;
|
|
98056
|
+
if (community.anchor?.publicKey) {
|
|
98057
|
+
const communityPublicKeyFromRecord = getCommunityPublicKeyFromWire(commentRecord);
|
|
98058
|
+
if (communityPublicKeyFromRecord && !areEquivalentCommunityAddresses(communityPublicKeyFromRecord, community.anchor.publicKey)) return {
|
|
98059
|
+
valid: false,
|
|
98060
|
+
reason: messages.ERR_COMMENT_IN_PAGE_BELONG_TO_DIFFERENT_COMMUNITY
|
|
98061
|
+
};
|
|
98062
|
+
}
|
|
98056
98063
|
if (community.name) {
|
|
98057
98064
|
const communityNameFromRecord = getCommunityNameFromWire$1(commentRecord);
|
|
98058
98065
|
if (communityNameFromRecord && !areEquivalentCommunityAddresses(communityNameFromRecord, community.name)) return {
|
|
@@ -98150,6 +98157,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
98150
98157
|
}));
|
|
98151
98158
|
//#endregion
|
|
98152
98159
|
//#region dist/node/clients/pkc-typed-emitter.js
|
|
98160
|
+
var import_retry = /* @__PURE__ */ __toESM(require_retry$1(), 1);
|
|
98153
98161
|
var import_lib$1 = require_lib$1();
|
|
98154
98162
|
var PKCTypedEmitter = class extends import_lib$1.TypedEmitter {
|
|
98155
98163
|
constructor() {
|
|
@@ -101970,7 +101978,7 @@ async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
|
|
|
101970
101978
|
}
|
|
101971
101979
|
async function createKuboRpcClient(kuboRpcClientOptions) {
|
|
101972
101980
|
logger_default("pkc-js:pkc:createKuboRpcClient").trace("Creating a new kubo client on node with options", kuboRpcClientOptions);
|
|
101973
|
-
const { create: CreateKuboRpcClient } = await import("./src-
|
|
101981
|
+
const { create: CreateKuboRpcClient } = await import("./src-WLgFbUwZ.js");
|
|
101974
101982
|
const Agent$2 = typeof kuboRpcClientOptions.url === "string" && kuboRpcClientOptions.url.startsWith("https") || kuboRpcClientOptions?.protocol === "https" || kuboRpcClientOptions.url instanceof URL && kuboRpcClientOptions?.url?.protocol === "https:" || kuboRpcClientOptions.url?.toString()?.includes("https") ? Agent : Agent$1;
|
|
101975
101983
|
const onehourMs = 1e3 * 60 * 60;
|
|
101976
101984
|
return CreateKuboRpcClient({
|
|
@@ -124882,9 +124890,12 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
124882
124890
|
newUpdatingState: "failed"
|
|
124883
124891
|
});
|
|
124884
124892
|
} else if (communityLoadingRes?.community && (this._community.raw.communityIpfs?.updatedAt || 0) < communityLoadingRes.community.updatedAt) {
|
|
124893
|
+
const publicKeyBeforeApply = this._community.publicKey;
|
|
124885
124894
|
this._community.initCommunityIpfsPropsNoMerge(communityLoadingRes.community);
|
|
124886
124895
|
this._community.updateCid = communityLoadingRes.cid;
|
|
124896
|
+
if (publicKeyBeforeApply && this._community.publicKey !== publicKeyBeforeApply) this._community.nameResolved = void 0;
|
|
124887
124897
|
if (!isStringDomain(this._community.address) && this._community.name && this._community.publicKey && typeof this._community.nameResolved !== "boolean") this._resolveNameInBackground(this._community.name);
|
|
124898
|
+
else if (isStringDomain(this._community.address) && this._community.publicKey && typeof this._community.nameResolved !== "boolean") this._resolveNameInBackground(this._community.address);
|
|
124888
124899
|
log(`Remote Community`, this._community.address, `received a new update. Will emit an update event with updatedAt`, this._community.updatedAt, "that's", timestamp() - this._community.updatedAt, "seconds old");
|
|
124889
124900
|
this._community._changeStateEmitEventEmitStateChangeEvent({
|
|
124890
124901
|
event: {
|
|
@@ -124927,6 +124938,14 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
124927
124938
|
this._suppressUpdatingStateForNameResolution--;
|
|
124928
124939
|
}
|
|
124929
124940
|
}
|
|
124941
|
+
_nonAnchorHopsOfLoadedChain() {
|
|
124942
|
+
const loadedRecord = this._community.raw.communityIpfs;
|
|
124943
|
+
if (!loadedRecord) return void 0;
|
|
124944
|
+
const chainKeys = new Set(this._community.ipnsHops ?? []);
|
|
124945
|
+
chainKeys.add(getPKCAddressFromPublicKeySync(loadedRecord.signature.publicKey));
|
|
124946
|
+
if (this._community.publicKey) chainKeys.delete(this._community.publicKey);
|
|
124947
|
+
return [...chainKeys];
|
|
124948
|
+
}
|
|
124930
124949
|
_resolveNameInBackground(name) {
|
|
124931
124950
|
const log = logger_default("pkc-js:community-client-manager:_resolveNameInBackground");
|
|
124932
124951
|
const setNameResolvedAndEmitUpdate = (newNameResolved) => {
|
|
@@ -124940,6 +124959,11 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
124940
124959
|
cache: { maxAge: 3600 }
|
|
124941
124960
|
}).then((resolved) => {
|
|
124942
124961
|
if (resolved && resolved !== this._community.publicKey) {
|
|
124962
|
+
if (this._nonAnchorHopsOfLoadedChain()?.includes(resolved)) {
|
|
124963
|
+
log(`Community name ${name} resolves to ${resolved}, a non-anchor hop of the community's own chain, instead of its identity ${this._community.publicKey}. Marking nameResolved false`);
|
|
124964
|
+
setNameResolvedAndEmitUpdate(false);
|
|
124965
|
+
return;
|
|
124966
|
+
}
|
|
124943
124967
|
log("Key migration detected for", name, "old:", this._community.publicKey, "new:", resolved);
|
|
124944
124968
|
const previousPublicKey = this._community.publicKey;
|
|
124945
124969
|
const error = new PKCError("ERR_COMMUNITY_NAME_RESOLVES_TO_DIFFERENT_PUBLIC_KEY", {
|
|
@@ -124989,7 +125013,8 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
124989
125013
|
return this._withInflightCommunityFetch(communityAddress, async () => {
|
|
124990
125014
|
let ipnsName;
|
|
124991
125015
|
const isDomain = isStringDomain(communityAddress);
|
|
124992
|
-
|
|
125016
|
+
const hasAnchorClaim = Boolean(this._community.anchor);
|
|
125017
|
+
if (this._community.publicKey && (isDomain || hasAnchorClaim || !isDomain && this._community.name && this._community.nameResolved === true)) {
|
|
124993
125018
|
ipnsName = this._community.publicKey;
|
|
124994
125019
|
if (isDomain) this._resolveNameInBackground(communityAddress);
|
|
124995
125020
|
} else ipnsName = await this.resolveCommunityNameIfNeeded({
|
|
@@ -125027,12 +125052,13 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125027
125052
|
}
|
|
125028
125053
|
} else subRes = await this._fetchCommunityFromGateways(ipnsName);
|
|
125029
125054
|
if (subRes?.community) {
|
|
125030
|
-
const
|
|
125055
|
+
const identityPublicKey = subRes.community.anchor?.publicKey ?? ipnsName;
|
|
125056
|
+
const anchorIdentityAddress = subRes.community.name || identityPublicKey;
|
|
125031
125057
|
this._pkc._memCaches.communityForPublishing.set(anchorIdentityAddress, {
|
|
125032
125058
|
encryption: subRes.community.encryption,
|
|
125033
125059
|
pubsubTopic: subRes.community.pubsubTopic,
|
|
125034
125060
|
address: anchorIdentityAddress,
|
|
125035
|
-
publicKey:
|
|
125061
|
+
publicKey: identityPublicKey,
|
|
125036
125062
|
name: subRes.community.name
|
|
125037
125063
|
});
|
|
125038
125064
|
}
|
|
@@ -125080,9 +125106,18 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125080
125106
|
this._updateCidsAlreadyLoaded.add(latestCommunityCid);
|
|
125081
125107
|
try {
|
|
125082
125108
|
const communityIpfs = parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails(parseJsonWithPKCErrorIfFails(rawCommunityJsonString));
|
|
125109
|
+
const provenIpnsHops = await this._proveAnchorClaimIfUnwalked({
|
|
125110
|
+
communityJson: communityIpfs,
|
|
125111
|
+
ipnsHops,
|
|
125112
|
+
resolveChainOfClaimedAnchor: async (claimedAnchor) => (await this.resolveIpnsToCidP2P(claimedAnchor, {
|
|
125113
|
+
timeoutMs: this._pkc._timeouts["community-ipns"],
|
|
125114
|
+
abortSignal: this._community._getStopAbortSignal()
|
|
125115
|
+
})).ipnsHops
|
|
125116
|
+
});
|
|
125117
|
+
this._community.ipnsHops = provenIpnsHops;
|
|
125083
125118
|
const errInRecord = await this._findErrorInCommunityRecord({
|
|
125084
125119
|
communityJson: communityIpfs,
|
|
125085
|
-
communityIpnsHops:
|
|
125120
|
+
communityIpnsHops: provenIpnsHops,
|
|
125086
125121
|
cidOfCommunityIpns: latestCommunityCid
|
|
125087
125122
|
});
|
|
125088
125123
|
if (errInRecord) throw errInRecord;
|
|
@@ -125157,6 +125192,11 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125157
125192
|
gatewayUrl
|
|
125158
125193
|
});
|
|
125159
125194
|
}
|
|
125195
|
+
ipnsHops = await this._proveAnchorClaimIfUnwalked({
|
|
125196
|
+
communityJson: communityIpfs,
|
|
125197
|
+
ipnsHops,
|
|
125198
|
+
resolveChainOfClaimedAnchor: async (claimedAnchor) => (await this._resolveIpnsChainViaGateway(gatewayUrl, claimedAnchor, abortController.signal)).ipnsHops
|
|
125199
|
+
});
|
|
125160
125200
|
gatewayFetches[gatewayUrl].ipnsHops = ipnsHops;
|
|
125161
125201
|
const errorWithinRecord = await this._findErrorInCommunityRecord({
|
|
125162
125202
|
communityJson: communityIpfs,
|
|
@@ -125266,7 +125306,27 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125266
125306
|
cleanUp();
|
|
125267
125307
|
throwIfAbortSignalAborted(stopSignal);
|
|
125268
125308
|
const gatewayToError = t$4(gatewayFetches, (gatewayFetch) => gatewayFetch.error);
|
|
125269
|
-
if (Object.keys(gatewayFetches).map((gatewayUrl) => gatewayFetches[gatewayUrl].error).some((err) => err.details?.status === 304 || err.code === "ERR_GATEWAY_ABORTING_LOADING_COMMUNITY_BECAUSE_WE_ALREADY_LOADED_THIS_RECORD"))
|
|
125309
|
+
if (Object.keys(gatewayFetches).map((gatewayUrl) => gatewayFetches[gatewayUrl].error).some((err) => err.details?.status === 304 || err.code === "ERR_GATEWAY_ABORTING_LOADING_COMMUNITY_BECAUSE_WE_ALREADY_LOADED_THIS_RECORD")) {
|
|
125310
|
+
if (this._community.anchor && this._community.ipnsHops?.[0] !== ipnsName) {
|
|
125311
|
+
const confirmingGatewayUrl = Object.keys(gatewayFetches).find((gatewayUrl) => gatewayFetches[gatewayUrl].error?.details?.status === 304 || gatewayFetches[gatewayUrl].error?.code === "ERR_GATEWAY_ABORTING_LOADING_COMMUNITY_BECAUSE_WE_ALREADY_LOADED_THIS_RECORD");
|
|
125312
|
+
if (confirmingGatewayUrl) {
|
|
125313
|
+
const chainWalkAbortController = new AbortController();
|
|
125314
|
+
const chainWalkTimeoutId = setTimeout(() => chainWalkAbortController.abort("Aborting delegated chain upgrade because it timed out after " + timeoutMs + "ms"), timeoutMs);
|
|
125315
|
+
const onStopAbortChainWalk = () => chainWalkAbortController.abort(stopSignal?.reason);
|
|
125316
|
+
stopSignal?.addEventListener("abort", onStopAbortChainWalk, { once: true });
|
|
125317
|
+
try {
|
|
125318
|
+
const chain = await this._resolveIpnsChainViaGateway(confirmingGatewayUrl, ipnsName, chainWalkAbortController.signal);
|
|
125319
|
+
if (this._community.updateCid && chain.terminalCidV0 === this._community.updateCid) this._community.ipnsHops = chain.ipnsHops;
|
|
125320
|
+
} catch (chainWalkError) {
|
|
125321
|
+
log.trace(`Failed to upgrade the delegated chain of ${ipnsName} after a confirmed consumed record, will retry next poll`, chainWalkError);
|
|
125322
|
+
} finally {
|
|
125323
|
+
clearTimeout(chainWalkTimeoutId);
|
|
125324
|
+
stopSignal?.removeEventListener("abort", onStopAbortChainWalk);
|
|
125325
|
+
}
|
|
125326
|
+
}
|
|
125327
|
+
}
|
|
125328
|
+
return;
|
|
125329
|
+
}
|
|
125270
125330
|
const combinedError = new FailedToFetchCommunityFromGatewaysError({
|
|
125271
125331
|
ipnsName,
|
|
125272
125332
|
gatewayToError,
|
|
@@ -125330,6 +125390,26 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125330
125390
|
});
|
|
125331
125391
|
}
|
|
125332
125392
|
}
|
|
125393
|
+
async _proveAnchorClaimIfUnwalked({ communityJson, ipnsHops, resolveChainOfClaimedAnchor }) {
|
|
125394
|
+
const log = logger_default("pkc-js:community-client-manager:_proveAnchorClaimIfUnwalked");
|
|
125395
|
+
if (ipnsHops.length > 1) return ipnsHops;
|
|
125396
|
+
const claimedAnchor = communityJson.anchor?.publicKey;
|
|
125397
|
+
if (!claimedAnchor) return ipnsHops;
|
|
125398
|
+
const loadedName = ipnsHops[0];
|
|
125399
|
+
if (this._areEquivalentCommunityAddresses(claimedAnchor, loadedName)) return ipnsHops;
|
|
125400
|
+
const provenHops = await resolveChainOfClaimedAnchor(claimedAnchor);
|
|
125401
|
+
const anchorDelegatesTo = provenHops[provenHops.length - 1];
|
|
125402
|
+
if (!this._areEquivalentCommunityAddresses(anchorDelegatesTo, loadedName)) throw new PKCError("ERR_COMMUNITY_RECORD_ANCHOR_CLAIM_IS_NOT_ENDORSED", {
|
|
125403
|
+
claimedAnchor,
|
|
125404
|
+
recordIpnsName: loadedName,
|
|
125405
|
+
anchorDelegatesTo,
|
|
125406
|
+
claimedAnchorHops: provenHops,
|
|
125407
|
+
communityAddress: this._getCommunityAddressFromInstance(),
|
|
125408
|
+
recordSignerAddress: getPKCAddressFromPublicKeySync(communityJson.signature.publicKey)
|
|
125409
|
+
});
|
|
125410
|
+
log.trace(`Anchor claim of ${loadedName} proven: ${claimedAnchor} delegates to it. Adopting the chain`, provenHops);
|
|
125411
|
+
return provenHops;
|
|
125412
|
+
}
|
|
125333
125413
|
async _findErrorInCommunityRecord({ communityJson, communityIpnsHops, cidOfCommunityIpns }) {
|
|
125334
125414
|
const anchorIpnsName = communityIpnsHops[0];
|
|
125335
125415
|
const terminalIpnsName = communityIpnsHops[communityIpnsHops.length - 1];
|
|
@@ -125540,13 +125620,13 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125540
125620
|
}
|
|
125541
125621
|
}
|
|
125542
125622
|
_updateIpnsPubsubPropsIfNeeded(newProps) {
|
|
125543
|
-
const
|
|
125623
|
+
const anchorFromClaimOrHops = this.anchor?.publicKey ?? this.ipnsHops?.[0];
|
|
125544
125624
|
if ("ipnsName" in newProps && newProps.ipnsName) {
|
|
125545
125625
|
this.ipnsName = newProps.ipnsName;
|
|
125546
125626
|
this.ipnsPubsubTopic = ipnsNameToIpnsOverPubsubTopic(this.ipnsName);
|
|
125547
125627
|
this.ipnsPubsubTopicRoutingCid = pubsubTopicToDhtKey(this.ipnsPubsubTopic);
|
|
125548
|
-
} else if (
|
|
125549
|
-
this.ipnsName =
|
|
125628
|
+
} else if (anchorFromClaimOrHops) {
|
|
125629
|
+
this.ipnsName = anchorFromClaimOrHops;
|
|
125550
125630
|
this.ipnsPubsubTopic = ipnsNameToIpnsOverPubsubTopic(this.ipnsName);
|
|
125551
125631
|
this.ipnsPubsubTopicRoutingCid = pubsubTopicToDhtKey(this.ipnsPubsubTopic);
|
|
125552
125632
|
} else if (newProps.signature?.publicKey && this.signature?.publicKey !== newProps.signature?.publicKey) {
|
|
@@ -125563,6 +125643,8 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125563
125643
|
initRemoteCommunityPropsNoMerge(newProps) {
|
|
125564
125644
|
const incomingIpnsHops = newProps.ipnsHops;
|
|
125565
125645
|
if (Array.isArray(incomingIpnsHops) && incomingIpnsHops.length > 0) this._ipnsHops = incomingIpnsHops;
|
|
125646
|
+
if ("anchor" in newProps) this.anchor = newProps.anchor;
|
|
125647
|
+
else if (newProps.signature) this.anchor = void 0;
|
|
125566
125648
|
this.title = newProps.title;
|
|
125567
125649
|
this.description = newProps.description;
|
|
125568
125650
|
this.lastPostCid = newProps.lastPostCid;
|
|
@@ -125583,8 +125665,10 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125583
125665
|
this.pubsubTopic = newProps.pubsubTopic;
|
|
125584
125666
|
this.signature = newProps.signature;
|
|
125585
125667
|
const explicitPublicKey = "publicKey" in newProps ? newProps.publicKey : void 0;
|
|
125668
|
+
const anchorFromClaim = this.anchor?.publicKey;
|
|
125586
125669
|
const anchorFromHops = this.ipnsHops?.[0];
|
|
125587
|
-
if (
|
|
125670
|
+
if (anchorFromClaim) this.publicKey = anchorFromClaim;
|
|
125671
|
+
else if (anchorFromHops) this.publicKey = anchorFromHops;
|
|
125588
125672
|
else if (newProps.signature?.publicKey) this.publicKey = getPKCAddressFromPublicKeySync(newProps.signature.publicKey);
|
|
125589
125673
|
else if (explicitPublicKey) this.publicKey = explicitPublicKey;
|
|
125590
125674
|
else if (!this.publicKey && "address" in newProps && typeof newProps.address === "string" && !isStringDomain(newProps.address)) this.publicKey = newProps.address;
|
|
@@ -125625,6 +125709,7 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125625
125709
|
_clearDataForKeyMigration(newPublicKey) {
|
|
125626
125710
|
this.raw.communityIpfs = void 0;
|
|
125627
125711
|
this.updateCid = void 0;
|
|
125712
|
+
this.anchor = void 0;
|
|
125628
125713
|
this.initRemoteCommunityPropsNoMerge({});
|
|
125629
125714
|
this.pubsubTopicRoutingCid = void 0;
|
|
125630
125715
|
this.publicKey = newPublicKey;
|
|
@@ -125725,7 +125810,7 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125725
125810
|
}
|
|
125726
125811
|
_isRetriableErrorWhenLoading(err) {
|
|
125727
125812
|
if (!(err instanceof PKCError)) return false;
|
|
125728
|
-
if (err.code === "ERR_COMMUNITY_SIGNATURE_IS_INVALID" || err.code === "ERR_INVALID_COMMUNITY_IPFS_SCHEMA" || err.code === "ERR_THE_COMMUNITY_IPNS_RECORD_POINTS_TO_DIFFERENT_ADDRESS_THAN_WE_EXPECTED" || err.code === "ERR_OVER_DOWNLOAD_LIMIT" || err.code === "ERR_INVALID_JSON" || err.code === "ERR_NO_RESOLVER_FOR_NAME" || err.code === "ERR_GATEWAY_IPNS_RECORD_CHAIN_INVALID" || err.code === "ERR_IPNS_MAX_HOPS_EXCEEDED" || err.code === "ERR_RESOLVED_IPNS_TO_UNSUPPORTED_VALUE") return false;
|
|
125813
|
+
if (err.code === "ERR_COMMUNITY_SIGNATURE_IS_INVALID" || err.code === "ERR_INVALID_COMMUNITY_IPFS_SCHEMA" || err.code === "ERR_THE_COMMUNITY_IPNS_RECORD_POINTS_TO_DIFFERENT_ADDRESS_THAN_WE_EXPECTED" || err.code === "ERR_OVER_DOWNLOAD_LIMIT" || err.code === "ERR_INVALID_JSON" || err.code === "ERR_NO_RESOLVER_FOR_NAME" || err.code === "ERR_GATEWAY_IPNS_RECORD_CHAIN_INVALID" || err.code === "ERR_IPNS_MAX_HOPS_EXCEEDED" || err.code === "ERR_RESOLVED_IPNS_TO_UNSUPPORTED_VALUE" || err.code === "ERR_COMMUNITY_RECORD_ANCHOR_CLAIM_IS_NOT_ENDORSED") return false;
|
|
125729
125814
|
if (err instanceof FailedToFetchCommunityFromGatewaysError) {
|
|
125730
125815
|
for (const gatewayError of Object.values(err.details.gatewayToError)) {
|
|
125731
125816
|
if (gatewayError instanceof PKCError && gatewayError.code === "ERR_COMMUNITY_SIGNATURE_IS_INVALID") return true;
|
|
@@ -125887,525 +125972,6 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125887
125972
|
}
|
|
125888
125973
|
};
|
|
125889
125974
|
//#endregion
|
|
125890
|
-
//#region dist/node/runtime/node/address-rewriter-db.js
|
|
125891
|
-
const debug$1 = logger_default("pkc-js:address-rewriter-db");
|
|
125892
|
-
var AddressRewriterDatabase = class {
|
|
125893
|
-
constructor(dataPath, kuboConfig, proxyTarget) {
|
|
125894
|
-
this._db = null;
|
|
125895
|
-
this._dbPath = this._initializeDbPath(dataPath, kuboConfig, proxyTarget);
|
|
125896
|
-
}
|
|
125897
|
-
_initializeDbPath(dataPath, kuboConfig, proxyTarget) {
|
|
125898
|
-
if (!dataPath) throw new Error("dataPath must be defined for request logging");
|
|
125899
|
-
let kuboIdentifier = "unknown";
|
|
125900
|
-
if (kuboConfig && typeof kuboConfig === "object" && "host" in kuboConfig && "port" in kuboConfig) kuboIdentifier = `${kuboConfig.host}_${kuboConfig.port}`;
|
|
125901
|
-
const proxyIdentifier = `${proxyTarget.hostname}_${proxyTarget.port || (proxyTarget.protocol === "https:" ? "443" : "80")}`;
|
|
125902
|
-
const fileName = `address_rewriter_${kuboIdentifier}_${proxyIdentifier}.db`;
|
|
125903
|
-
return Path.join(dataPath, ".address-rewriter", fileName);
|
|
125904
|
-
}
|
|
125905
|
-
async initialize() {
|
|
125906
|
-
try {
|
|
125907
|
-
const dbDir = Path.dirname(this._dbPath);
|
|
125908
|
-
await fsp.mkdir(dbDir, { recursive: true });
|
|
125909
|
-
this._db = new Database(this._dbPath);
|
|
125910
|
-
this._db.exec(`
|
|
125911
|
-
CREATE TABLE IF NOT EXISTS request_logs (
|
|
125912
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
125913
|
-
keys TEXT NOT NULL,
|
|
125914
|
-
received_at INTEGER NOT NULL,
|
|
125915
|
-
transmitted_at INTEGER,
|
|
125916
|
-
success INTEGER NOT NULL,
|
|
125917
|
-
status_code INTEGER,
|
|
125918
|
-
method TEXT NOT NULL,
|
|
125919
|
-
url TEXT NOT NULL,
|
|
125920
|
-
error TEXT,
|
|
125921
|
-
retry_count INTEGER DEFAULT 0,
|
|
125922
|
-
body_preview TEXT,
|
|
125923
|
-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
125924
|
-
)
|
|
125925
|
-
`);
|
|
125926
|
-
this._db.exec(`
|
|
125927
|
-
CREATE TABLE IF NOT EXISTS reprovide_logs (
|
|
125928
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
125929
|
-
key TEXT NOT NULL,
|
|
125930
|
-
timestamp INTEGER NOT NULL,
|
|
125931
|
-
success INTEGER NOT NULL,
|
|
125932
|
-
error TEXT,
|
|
125933
|
-
block_not_local INTEGER DEFAULT 0,
|
|
125934
|
-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
125935
|
-
)
|
|
125936
|
-
`);
|
|
125937
|
-
this._db.exec(`
|
|
125938
|
-
CREATE TABLE IF NOT EXISTS failed_keys (
|
|
125939
|
-
key TEXT PRIMARY KEY,
|
|
125940
|
-
added_at INTEGER NOT NULL,
|
|
125941
|
-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
125942
|
-
)
|
|
125943
|
-
`);
|
|
125944
|
-
this._db.exec(`
|
|
125945
|
-
CREATE INDEX IF NOT EXISTS idx_request_logs_received_at ON request_logs(received_at);
|
|
125946
|
-
CREATE INDEX IF NOT EXISTS idx_reprovide_logs_timestamp ON reprovide_logs(timestamp);
|
|
125947
|
-
CREATE INDEX IF NOT EXISTS idx_reprovide_logs_key ON reprovide_logs(key);
|
|
125948
|
-
`);
|
|
125949
|
-
try {
|
|
125950
|
-
this._db.exec("ALTER TABLE request_logs ADD COLUMN body_preview TEXT");
|
|
125951
|
-
} catch (error) {
|
|
125952
|
-
if (!(error instanceof Error ? error.message : String(error)).toLowerCase().includes("duplicate column name")) throw error;
|
|
125953
|
-
}
|
|
125954
|
-
debug$1(`Initialized SQLite database at ${this._dbPath}`);
|
|
125955
|
-
} catch (error) {
|
|
125956
|
-
debug$1.error(`Failed to initialize database at ${this._dbPath}:`, error);
|
|
125957
|
-
throw error;
|
|
125958
|
-
}
|
|
125959
|
-
}
|
|
125960
|
-
close() {
|
|
125961
|
-
if (this._db) {
|
|
125962
|
-
this._db.close();
|
|
125963
|
-
this._db = null;
|
|
125964
|
-
}
|
|
125965
|
-
}
|
|
125966
|
-
insertRequestLogs(logs) {
|
|
125967
|
-
if (!this._db) throw new Error("Database not initialized");
|
|
125968
|
-
const insertStmt = this._db.prepare(`
|
|
125969
|
-
INSERT INTO request_logs (
|
|
125970
|
-
keys, received_at, transmitted_at, success, status_code,
|
|
125971
|
-
method, url, error, retry_count, body_preview
|
|
125972
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
125973
|
-
`);
|
|
125974
|
-
this._db.transaction(() => {
|
|
125975
|
-
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);
|
|
125976
|
-
})();
|
|
125977
|
-
}
|
|
125978
|
-
insertReprovideLog(key, success, error, blockNotLocal) {
|
|
125979
|
-
if (!this._db) throw new Error("Database not initialized");
|
|
125980
|
-
this._db.prepare(`
|
|
125981
|
-
INSERT INTO reprovide_logs (key, timestamp, success, error, block_not_local)
|
|
125982
|
-
VALUES (?, ?, ?, ?, ?)
|
|
125983
|
-
`).run(key, Date.now(), success ? 1 : 0, error || null, blockNotLocal ? 1 : 0);
|
|
125984
|
-
}
|
|
125985
|
-
loadFailedKeys() {
|
|
125986
|
-
if (!this._db) return [];
|
|
125987
|
-
try {
|
|
125988
|
-
return this._db.prepare("SELECT key FROM failed_keys").all().map((row) => row.key);
|
|
125989
|
-
} catch (error) {
|
|
125990
|
-
debug$1.error("Failed to load failed keys from database:", error);
|
|
125991
|
-
return [];
|
|
125992
|
-
}
|
|
125993
|
-
}
|
|
125994
|
-
saveFailedKeys(keys) {
|
|
125995
|
-
if (!this._db) throw new Error("Database not initialized");
|
|
125996
|
-
this._db.transaction(() => {
|
|
125997
|
-
this._db.exec("DELETE FROM failed_keys");
|
|
125998
|
-
if (keys.length > 0) {
|
|
125999
|
-
const insertStmt = this._db.prepare("INSERT INTO failed_keys (key, added_at) VALUES (?, ?)");
|
|
126000
|
-
const now = Date.now();
|
|
126001
|
-
for (const key of keys) insertStmt.run(key, now);
|
|
126002
|
-
}
|
|
126003
|
-
})();
|
|
126004
|
-
}
|
|
126005
|
-
};
|
|
126006
|
-
//#endregion
|
|
126007
|
-
//#region dist/node/runtime/node/addresses-rewriter-proxy-server.js
|
|
126008
|
-
const debug = logger_default("pkc-js:addresses-rewriter");
|
|
126009
|
-
const MAX_BODY_PREVIEW_BYTES = 4096;
|
|
126010
|
-
function normalizeSelfAddrsForProvider(addrs, peerId) {
|
|
126011
|
-
const suffix = `/p2p/${peerId}`;
|
|
126012
|
-
return n$10(addrs.map((addr) => addr.endsWith(suffix) ? addr.slice(0, -suffix.length) : addr));
|
|
126013
|
-
}
|
|
126014
|
-
var AddressesRewriterProxyServer = class {
|
|
126015
|
-
constructor({ kuboClients: kuboClient, port, hostname, proxyTargetUrl, pkc }) {
|
|
126016
|
-
this._requestLogBuffer = [];
|
|
126017
|
-
this._isWritingLogs = false;
|
|
126018
|
-
this._failedKeys = /* @__PURE__ */ new Set();
|
|
126019
|
-
this._isRetrying = false;
|
|
126020
|
-
this.addresses = {};
|
|
126021
|
-
this.kuboClients = kuboClient;
|
|
126022
|
-
this.port = port;
|
|
126023
|
-
this.hostname = hostname || "127.0.0.1";
|
|
126024
|
-
this.proxyTarget = new URL(proxyTargetUrl);
|
|
126025
|
-
this.server = http.createServer((req, res) => this._proxyRequestRewrite(req, res));
|
|
126026
|
-
this._storageKeyName = `httprouter_proxy_${proxyTargetUrl}`;
|
|
126027
|
-
this._pkc = pkc;
|
|
126028
|
-
const envValue = process.env.ENABLE_LOGGING_OF_ADDRESS_REWRITER_PROXY;
|
|
126029
|
-
this._loggingEnabled = envValue === "1" || envValue?.toLowerCase() === "true";
|
|
126030
|
-
if (this._loggingEnabled) {
|
|
126031
|
-
const kuboConfig = this.kuboClients?.[0]?.getEndpointConfig();
|
|
126032
|
-
this._db = new AddressRewriterDatabase(this._pkc.dataPath, kuboConfig, this.proxyTarget);
|
|
126033
|
-
} else this._db = null;
|
|
126034
|
-
this._httpAgent = new http.Agent({
|
|
126035
|
-
keepAlive: true,
|
|
126036
|
-
keepAliveMsecs: 3e4,
|
|
126037
|
-
maxSockets: 50,
|
|
126038
|
-
timeout: 1e4
|
|
126039
|
-
});
|
|
126040
|
-
this._httpsAgent = new https.Agent({
|
|
126041
|
-
keepAlive: true,
|
|
126042
|
-
keepAliveMsecs: 3e4,
|
|
126043
|
-
maxSockets: 50,
|
|
126044
|
-
timeout: 1e4
|
|
126045
|
-
});
|
|
126046
|
-
hideClassPrivateProps(this);
|
|
126047
|
-
}
|
|
126048
|
-
async listen(callback) {
|
|
126049
|
-
if (this._loggingEnabled && this._db) {
|
|
126050
|
-
await this._db.initialize();
|
|
126051
|
-
debug("Request logging enabled for addresses rewriter proxy");
|
|
126052
|
-
} else debug("Request logging disabled for addresses rewriter proxy");
|
|
126053
|
-
await this._startUpdateAddressesLoop();
|
|
126054
|
-
if (this._loggingEnabled) this._startRequestLogging();
|
|
126055
|
-
await this._startFailedKeysRetry();
|
|
126056
|
-
this.server.on("error", (err) => debug.error("Error with address rewriter proxy", this.server.address(), "Proxy target", this.proxyTarget, err));
|
|
126057
|
-
this.server.listen(this.port, this.hostname, callback);
|
|
126058
|
-
debug("Addresses rewriter proxy at", this.hostname + ":" + this.port, "started listening to forward requests to", this.proxyTarget.host, `- request logging ${this._loggingEnabled ? "enabled" : "disabled"}`);
|
|
126059
|
-
await this._pkc._storage.setItem(this._storageKeyName, `http://${this.hostname}:${this.port}`);
|
|
126060
|
-
}
|
|
126061
|
-
async destroy() {
|
|
126062
|
-
this.server.close();
|
|
126063
|
-
if (this._updateAddressesInterval) clearInterval(this._updateAddressesInterval);
|
|
126064
|
-
if (this._logWriteInterval) clearInterval(this._logWriteInterval);
|
|
126065
|
-
if (this._retryInterval) clearInterval(this._retryInterval);
|
|
126066
|
-
await this._writeRequestLogs();
|
|
126067
|
-
this._db?.close();
|
|
126068
|
-
this._httpAgent.destroy();
|
|
126069
|
-
this._httpsAgent.destroy();
|
|
126070
|
-
await this._pkc._storage.removeItem(this._storageKeyName);
|
|
126071
|
-
}
|
|
126072
|
-
_proxyRequestRewrite(req, res) {
|
|
126073
|
-
let reqBody = "";
|
|
126074
|
-
req.on("data", (chunk) => {
|
|
126075
|
-
reqBody += chunk.toString();
|
|
126076
|
-
});
|
|
126077
|
-
req.on("end", () => {
|
|
126078
|
-
const shouldRewrite = req.method === "PUT" || req.method === "POST";
|
|
126079
|
-
let requestLogEntry = null;
|
|
126080
|
-
if (shouldRewrite) {
|
|
126081
|
-
const keys = this._extractKeysFromRequestBody(reqBody);
|
|
126082
|
-
const shouldLogRequest = this._loggingEnabled;
|
|
126083
|
-
if (keys.length > 0 || shouldLogRequest) {
|
|
126084
|
-
requestLogEntry = {
|
|
126085
|
-
keys,
|
|
126086
|
-
receivedAt: Date.now(),
|
|
126087
|
-
success: false,
|
|
126088
|
-
method: req.method || "UNKNOWN",
|
|
126089
|
-
url: req.url || "/",
|
|
126090
|
-
retryCount: 0,
|
|
126091
|
-
bodyPreview: shouldLogRequest ? this._createBodyPreview(reqBody) : void 0
|
|
126092
|
-
};
|
|
126093
|
-
if (shouldLogRequest) this._requestLogBuffer.push(requestLogEntry);
|
|
126094
|
-
}
|
|
126095
|
-
}
|
|
126096
|
-
let rewrittenBody = reqBody;
|
|
126097
|
-
if (shouldRewrite && rewrittenBody) try {
|
|
126098
|
-
const json = JSON.parse(rewrittenBody);
|
|
126099
|
-
if (json.Providers && Array.isArray(json.Providers)) {
|
|
126100
|
-
for (const provider of json.Providers) {
|
|
126101
|
-
const peerId = provider?.Payload?.ID;
|
|
126102
|
-
if (peerId && this.addresses[peerId]) provider.Payload.Addrs = this.addresses[peerId];
|
|
126103
|
-
}
|
|
126104
|
-
rewrittenBody = JSON.stringify(json);
|
|
126105
|
-
}
|
|
126106
|
-
} catch (e) {
|
|
126107
|
-
debug("proxy body rewrite error:", e, "body", rewrittenBody, req.url, req.method);
|
|
126108
|
-
}
|
|
126109
|
-
this._proxyRequest(req, res, rewrittenBody, requestLogEntry);
|
|
126110
|
-
});
|
|
126111
|
-
req.on("error", (err) => {
|
|
126112
|
-
debug.trace("Request error:", req.url, req.method, req.headers, reqBody, err);
|
|
126113
|
-
if (!res.headersSent) {
|
|
126114
|
-
debug.trace("Request error:", req.url, req.method, req.headers, reqBody, err);
|
|
126115
|
-
res.writeHead(500);
|
|
126116
|
-
res.end("Internal Server Error");
|
|
126117
|
-
}
|
|
126118
|
-
});
|
|
126119
|
-
}
|
|
126120
|
-
_proxyRequest(req, res, rewrittenBody, requestLogEntry) {
|
|
126121
|
-
if (requestLogEntry) {
|
|
126122
|
-
requestLogEntry.retryCount = 0;
|
|
126123
|
-
requestLogEntry.transmittedAt = Date.now();
|
|
126124
|
-
}
|
|
126125
|
-
const { request: httpRequest } = this.proxyTarget.protocol === "https:" ? https : http;
|
|
126126
|
-
const agent = this.proxyTarget.protocol === "https:" ? this._httpsAgent : this._httpAgent;
|
|
126127
|
-
const requestOptions = {
|
|
126128
|
-
hostname: this.proxyTarget.hostname,
|
|
126129
|
-
protocol: this.proxyTarget.protocol,
|
|
126130
|
-
path: req.url,
|
|
126131
|
-
method: req.method,
|
|
126132
|
-
headers: {
|
|
126133
|
-
...req.headers,
|
|
126134
|
-
"content-length": Buffer.byteLength(rewrittenBody),
|
|
126135
|
-
host: this.proxyTarget.host
|
|
126136
|
-
},
|
|
126137
|
-
agent,
|
|
126138
|
-
timeout: 1e4
|
|
126139
|
-
};
|
|
126140
|
-
if (this.proxyTarget.port) requestOptions.port = this.proxyTarget.port;
|
|
126141
|
-
const proxyReq = httpRequest(requestOptions);
|
|
126142
|
-
proxyReq.setTimeout(1e4, () => {
|
|
126143
|
-
debug.trace("Proxy request timed out", requestOptions);
|
|
126144
|
-
if (requestLogEntry) {
|
|
126145
|
-
requestLogEntry.success = false;
|
|
126146
|
-
requestLogEntry.statusCode = 504;
|
|
126147
|
-
requestLogEntry.error = "Request timeout";
|
|
126148
|
-
requestLogEntry.completed = true;
|
|
126149
|
-
if (requestLogEntry.keys) {
|
|
126150
|
-
const sizeBefore = this._failedKeys.size;
|
|
126151
|
-
requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
|
|
126152
|
-
if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
|
|
126153
|
-
}
|
|
126154
|
-
}
|
|
126155
|
-
proxyReq.destroy();
|
|
126156
|
-
if (!res.headersSent) {
|
|
126157
|
-
res.writeHead(504);
|
|
126158
|
-
res.end("Gateway Timeout");
|
|
126159
|
-
}
|
|
126160
|
-
});
|
|
126161
|
-
proxyReq.on("error", (e) => {
|
|
126162
|
-
proxyReq.destroy();
|
|
126163
|
-
if (requestLogEntry) {
|
|
126164
|
-
requestLogEntry.success = false;
|
|
126165
|
-
requestLogEntry.statusCode = 500;
|
|
126166
|
-
requestLogEntry.error = `Proxy error: ${e.message}`;
|
|
126167
|
-
requestLogEntry.completed = true;
|
|
126168
|
-
debug.trace(`Updated log entry with error for keys: ${requestLogEntry.keys.join(", ")}`);
|
|
126169
|
-
if (requestLogEntry.keys) {
|
|
126170
|
-
const sizeBefore = this._failedKeys.size;
|
|
126171
|
-
requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
|
|
126172
|
-
if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
|
|
126173
|
-
}
|
|
126174
|
-
}
|
|
126175
|
-
if (!res.headersSent) {
|
|
126176
|
-
debug.trace("address rewriter proxy error:", e, "Request options", requestOptions);
|
|
126177
|
-
res.writeHead(500);
|
|
126178
|
-
res.end("Internal Server Error");
|
|
126179
|
-
}
|
|
126180
|
-
});
|
|
126181
|
-
proxyReq.on("response", (proxyRes) => {
|
|
126182
|
-
const statusCode = proxyRes.statusCode || 500;
|
|
126183
|
-
const isSuccess = statusCode >= 200 && statusCode < 300;
|
|
126184
|
-
if (requestLogEntry) {
|
|
126185
|
-
requestLogEntry.success = isSuccess;
|
|
126186
|
-
requestLogEntry.statusCode = statusCode;
|
|
126187
|
-
requestLogEntry.completed = true;
|
|
126188
|
-
if (!isSuccess) {
|
|
126189
|
-
requestLogEntry.error = `HTTP ${statusCode}`;
|
|
126190
|
-
if (requestLogEntry.keys) {
|
|
126191
|
-
const sizeBefore = this._failedKeys.size;
|
|
126192
|
-
requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
|
|
126193
|
-
if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
|
|
126194
|
-
}
|
|
126195
|
-
}
|
|
126196
|
-
}
|
|
126197
|
-
proxyRes.on("error", (err) => {
|
|
126198
|
-
debug.trace("Proxy response error:", err);
|
|
126199
|
-
if (!res.headersSent) {
|
|
126200
|
-
res.writeHead(500);
|
|
126201
|
-
res.end("Proxy Response Error");
|
|
126202
|
-
}
|
|
126203
|
-
if (requestLogEntry) {
|
|
126204
|
-
requestLogEntry.success = false;
|
|
126205
|
-
requestLogEntry.statusCode = 500;
|
|
126206
|
-
requestLogEntry.error = `Proxy response error: ${err.message}`;
|
|
126207
|
-
requestLogEntry.completed = true;
|
|
126208
|
-
}
|
|
126209
|
-
proxyRes.destroy(err);
|
|
126210
|
-
});
|
|
126211
|
-
if (!res.headersSent) {
|
|
126212
|
-
res.writeHead(statusCode, proxyRes.headers);
|
|
126213
|
-
proxyRes.pipe(res);
|
|
126214
|
-
}
|
|
126215
|
-
res.on("finish", () => {
|
|
126216
|
-
proxyRes.resume();
|
|
126217
|
-
});
|
|
126218
|
-
});
|
|
126219
|
-
proxyReq.write(rewrittenBody);
|
|
126220
|
-
proxyReq.end();
|
|
126221
|
-
}
|
|
126222
|
-
async _startUpdateAddressesLoop() {
|
|
126223
|
-
if (!this.kuboClients?.length) throw Error("should have a defined kubo rpc client option to start the address rewriter");
|
|
126224
|
-
const isRetriableError = (error) => {
|
|
126225
|
-
if (typeof error !== "object" || error === null) return false;
|
|
126226
|
-
const err = error;
|
|
126227
|
-
return err.response?.status === 500 || err.status === 500 || err.statusCode === 500;
|
|
126228
|
-
};
|
|
126229
|
-
const tryUpdateAddressesForClient = async (kuboClient) => {
|
|
126230
|
-
return new Promise((resolve) => {
|
|
126231
|
-
const operation = import_retry.operation({
|
|
126232
|
-
retries: 3,
|
|
126233
|
-
factor: 2,
|
|
126234
|
-
minTimeout: 1e3,
|
|
126235
|
-
maxTimeout: 8e3
|
|
126236
|
-
});
|
|
126237
|
-
operation.attempt(async (currentAttempt) => {
|
|
126238
|
-
try {
|
|
126239
|
-
const idRes = await kuboClient.id();
|
|
126240
|
-
const swarmAddrsRes = await kuboClient.swarm.addrs();
|
|
126241
|
-
const peerId = idRes.id.toString();
|
|
126242
|
-
if (typeof peerId !== "string") throw Error("Failed to get Peer ID of kubo node");
|
|
126243
|
-
const swarmListeningAddresses = swarmAddrsRes.filter((swarmAddr) => swarmAddr.id.toString() === peerId);
|
|
126244
|
-
const addresses = normalizeSelfAddrsForProvider([...idRes.addresses.map((addr) => addr.toString()), ...n$5(swarmListeningAddresses.map((swarmAddr) => swarmAddr.addrs.map((addr) => addr.toString())))], peerId);
|
|
126245
|
-
if (addresses.length === 0) throw Error(`Failed to get any addresses for peer ${peerId}`);
|
|
126246
|
-
this.addresses[peerId] = addresses;
|
|
126247
|
-
resolve();
|
|
126248
|
-
} catch (e) {
|
|
126249
|
-
const error = e;
|
|
126250
|
-
if (isRetriableError(error)) {
|
|
126251
|
-
debug(`tryUpdateAddresses attempt ${currentAttempt}/4 failed with 500 error:`, error.message, { kuboConfig: kuboClient.getEndpointConfig() });
|
|
126252
|
-
if (operation.retry(error)) return;
|
|
126253
|
-
}
|
|
126254
|
-
debug("tryUpdateAddresses error:", error.message, { kuboConfig: kuboClient.getEndpointConfig() });
|
|
126255
|
-
resolve();
|
|
126256
|
-
}
|
|
126257
|
-
});
|
|
126258
|
-
});
|
|
126259
|
-
};
|
|
126260
|
-
const tryUpdateAddresses = async () => {
|
|
126261
|
-
const promises = this.kuboClients.map(tryUpdateAddressesForClient);
|
|
126262
|
-
await Promise.allSettled(promises);
|
|
126263
|
-
};
|
|
126264
|
-
await tryUpdateAddresses();
|
|
126265
|
-
this._updateAddressesInterval = setInterval(tryUpdateAddresses, 1e3 * 60);
|
|
126266
|
-
}
|
|
126267
|
-
_extractKeysFromRequestBody(body) {
|
|
126268
|
-
try {
|
|
126269
|
-
const json = JSON.parse(body);
|
|
126270
|
-
const keys = [];
|
|
126271
|
-
if (json.Providers && Array.isArray(json.Providers)) {
|
|
126272
|
-
for (const provider of json.Providers) if (provider?.Payload?.Keys) keys.push(...provider.Payload.Keys);
|
|
126273
|
-
}
|
|
126274
|
-
return keys;
|
|
126275
|
-
} catch {
|
|
126276
|
-
return [];
|
|
126277
|
-
}
|
|
126278
|
-
}
|
|
126279
|
-
_createBodyPreview(body) {
|
|
126280
|
-
const buffer = Buffer.from(body, "utf8");
|
|
126281
|
-
if (buffer.length <= MAX_BODY_PREVIEW_BYTES) return body;
|
|
126282
|
-
return `${buffer.subarray(0, MAX_BODY_PREVIEW_BYTES).toString("utf8")}...[truncated ${buffer.length - MAX_BODY_PREVIEW_BYTES} bytes]`;
|
|
126283
|
-
}
|
|
126284
|
-
async _writeRequestLogs() {
|
|
126285
|
-
if (!this._loggingEnabled || !this._db) return;
|
|
126286
|
-
if (this._requestLogBuffer.length === 0 || this._isWritingLogs) return;
|
|
126287
|
-
this._isWritingLogs = true;
|
|
126288
|
-
const logsToWrite = this._requestLogBuffer.filter((entry) => entry.completed);
|
|
126289
|
-
if (logsToWrite.length === 0) {
|
|
126290
|
-
this._isWritingLogs = false;
|
|
126291
|
-
return;
|
|
126292
|
-
}
|
|
126293
|
-
const inFlightLogs = this._requestLogBuffer.filter((entry) => !entry.completed);
|
|
126294
|
-
this._requestLogBuffer = inFlightLogs;
|
|
126295
|
-
try {
|
|
126296
|
-
this._db.insertRequestLogs(logsToWrite);
|
|
126297
|
-
debug.trace(`Wrote ${logsToWrite.length} new request log entries to SQLite database`);
|
|
126298
|
-
} catch (error) {
|
|
126299
|
-
debug.error(`Failed to write request logs to SQLite database:`, error);
|
|
126300
|
-
this._requestLogBuffer.unshift(...logsToWrite);
|
|
126301
|
-
} finally {
|
|
126302
|
-
this._isWritingLogs = false;
|
|
126303
|
-
}
|
|
126304
|
-
}
|
|
126305
|
-
_startRequestLogging() {
|
|
126306
|
-
if (!this._loggingEnabled || !this._db) return;
|
|
126307
|
-
const writeInterval = 5 * 1e3;
|
|
126308
|
-
this._logWriteInterval = setInterval(async () => {
|
|
126309
|
-
await this._writeRequestLogs();
|
|
126310
|
-
}, writeInterval);
|
|
126311
|
-
}
|
|
126312
|
-
async _startFailedKeysRetry() {
|
|
126313
|
-
this._loadFailedKeysFromDatabase();
|
|
126314
|
-
const retryInterval = 120 * 1e3;
|
|
126315
|
-
this._retryInterval = setInterval(async () => {
|
|
126316
|
-
if (this._isRetrying) {
|
|
126317
|
-
debug.trace("Previous failed-keys retry still running, skipping this tick");
|
|
126318
|
-
return;
|
|
126319
|
-
}
|
|
126320
|
-
this._isRetrying = true;
|
|
126321
|
-
try {
|
|
126322
|
-
await this._retryFailedKeys();
|
|
126323
|
-
} finally {
|
|
126324
|
-
this._isRetrying = false;
|
|
126325
|
-
}
|
|
126326
|
-
}, retryInterval);
|
|
126327
|
-
debug(`Started failed keys retry with ${this._failedKeys.size} keys from previous sessions`);
|
|
126328
|
-
}
|
|
126329
|
-
_loadFailedKeysFromDatabase() {
|
|
126330
|
-
if (!this._loggingEnabled || !this._db) return;
|
|
126331
|
-
try {
|
|
126332
|
-
const keys = this._db.loadFailedKeys();
|
|
126333
|
-
keys.forEach((key) => this._failedKeys.add(key));
|
|
126334
|
-
debug(`Loaded ${keys.length} failed keys from database`);
|
|
126335
|
-
} catch (error) {
|
|
126336
|
-
debug.error("Failed to load failed keys from database:", error);
|
|
126337
|
-
throw error;
|
|
126338
|
-
}
|
|
126339
|
-
}
|
|
126340
|
-
_saveFailedKeysToDatabase() {
|
|
126341
|
-
if (!this._loggingEnabled || !this._db) return;
|
|
126342
|
-
try {
|
|
126343
|
-
const keys = Array.from(this._failedKeys);
|
|
126344
|
-
this._db.saveFailedKeys(keys);
|
|
126345
|
-
if (keys.length === 0) debug.trace(`All keys successfully provided - no failed keys to save`);
|
|
126346
|
-
else debug.trace(`Saved ${keys.length} failed keys to database`);
|
|
126347
|
-
} catch (error) {
|
|
126348
|
-
debug.error("Failed to save failed keys to database:", error);
|
|
126349
|
-
throw error;
|
|
126350
|
-
}
|
|
126351
|
-
}
|
|
126352
|
-
async _retryFailedKeys() {
|
|
126353
|
-
if (this._failedKeys.size === 0) {
|
|
126354
|
-
debug.trace(`No failed keys to retry - all keys successfully provided`);
|
|
126355
|
-
return;
|
|
126356
|
-
}
|
|
126357
|
-
debug(`Retrying ${this._failedKeys.size} failed keys`);
|
|
126358
|
-
const keysToRetry = Array.from(this._failedKeys);
|
|
126359
|
-
const kuboClient = this.kuboClients?.[0];
|
|
126360
|
-
if (!kuboClient) {
|
|
126361
|
-
debug.error("No kubo client available for retry");
|
|
126362
|
-
return;
|
|
126363
|
-
}
|
|
126364
|
-
const successfulKeys = [];
|
|
126365
|
-
const stillFailedKeys = [];
|
|
126366
|
-
const keysToDiscard = [];
|
|
126367
|
-
for (const key of keysToRetry) try {
|
|
126368
|
-
debug.trace(`Providing key to HTTP routers: ${key}`);
|
|
126369
|
-
const events = [];
|
|
126370
|
-
for await (const event of kuboClient.routing.provide(key, {
|
|
126371
|
-
recursive: true,
|
|
126372
|
-
verbose: true
|
|
126373
|
-
})) {
|
|
126374
|
-
events.push(event);
|
|
126375
|
-
debug(`Routing provide event for ${key}:`, event);
|
|
126376
|
-
}
|
|
126377
|
-
successfulKeys.push(key);
|
|
126378
|
-
debug.trace(`Successfully provided key: ${key}`);
|
|
126379
|
-
this._logReprovideAttempt(key, true, void 0, false);
|
|
126380
|
-
} catch (error) {
|
|
126381
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
126382
|
-
const isBlockNotLocal = errorMessage.includes("block") && errorMessage.includes("not found locally");
|
|
126383
|
-
this._logReprovideAttempt(key, false, errorMessage, isBlockNotLocal);
|
|
126384
|
-
if (isBlockNotLocal) {
|
|
126385
|
-
keysToDiscard.push(key);
|
|
126386
|
-
debug.trace(`Discarding key ${key} - block not found locally, will not retry`);
|
|
126387
|
-
} else {
|
|
126388
|
-
stillFailedKeys.push(key);
|
|
126389
|
-
debug.trace(`Failed to provide key ${key}:`, error);
|
|
126390
|
-
}
|
|
126391
|
-
}
|
|
126392
|
-
successfulKeys.forEach((key) => this._failedKeys.delete(key));
|
|
126393
|
-
keysToDiscard.forEach((key) => this._failedKeys.delete(key));
|
|
126394
|
-
this._saveFailedKeysToDatabase();
|
|
126395
|
-
debug.trace(`Retry completed: ${successfulKeys.length} successful, ${stillFailedKeys.length} still failed, ${keysToDiscard.length} discarded`);
|
|
126396
|
-
}
|
|
126397
|
-
_logReprovideAttempt(key, success, error, blockNotLocal) {
|
|
126398
|
-
if (!this._loggingEnabled || !this._db) return;
|
|
126399
|
-
try {
|
|
126400
|
-
this._db.insertReprovideLog(key, success, error, blockNotLocal);
|
|
126401
|
-
debug.trace(`Logged reprovide attempt for key ${key}: success=${success}, blockNotLocal=${blockNotLocal}`);
|
|
126402
|
-
} catch (error) {
|
|
126403
|
-
debug.error(`Failed to log reprovide attempt for key ${key}:`, error);
|
|
126404
|
-
throw error;
|
|
126405
|
-
}
|
|
126406
|
-
}
|
|
126407
|
-
};
|
|
126408
|
-
//#endregion
|
|
126409
125975
|
//#region node_modules/lru-cache/dist/esm/index.js
|
|
126410
125976
|
/**
|
|
126411
125977
|
* @module LRUCache
|
|
@@ -129786,4 +129352,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
129786
129352
|
}
|
|
129787
129353
|
};
|
|
129788
129354
|
//#endregion
|
|
129789
|
-
export {
|
|
129355
|
+
export { PublicationClientsManager as $, n$6 as $n, parseCommentIpfsSchemaWithPKCErrorIfItFails as $t, deriveDbReplies as A, RpcCidParamSchema as An, verifyVote as At, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as B, RpcFetchCidResultSchema as Bn, normalizeCommunityInputFromCommunity as Bt, backupCommunityDb as C, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Cn, verifyCommentEdit as Ct, deleteOldCommunityInWindows as D, RpcAnchorPublishPreparationResultSchema as Dn, verifyCommentUpdate as Dt, createKuboRpcClient as E, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as En, verifyCommentPubsubMessage as Et, listCommunitiesSync as F, RpcExportCommunityModLogsParamSchema as Fn, normalizeCreatePublicationAuthor as Ft, TIMEFRAMES_TO_SECONDS as G, RpcSubscriptionIdResultSchema as Gn, getPKCAddressFromPublicKey as Gt, POSTS_SORT_TYPES as H, RpcPublishChallengeAnswersParamSchema as Hn, encode as Ht, monitorCommunitiesDirectory as I, RpcExportCommunityModLogsResultSchema as In, buildRuntimeCommunityFields as It, extractCommunityRuntimeFieldsFromParsedPages as J, t$2 as Jn, createSchemaRowParser as Jt, buildPageRuntimeFields as K, RpcSuccessResultSchema as Kn, getPKCAddressFromPublicKeySync as Kt, moveCommunityDbToDeletedDirectory as L, RpcExportCommunityParamSchema as Ln, getCommunityAddressFromRecord as Lt, getDefaultDataPath as M, RpcCommunityIdentifierParamSchema as Mn, cleanWireAuthor as Mt, getThumbnailPropsOfLink as N, RpcCommunityPageParamSchema as Nn, getAuthorNameFromRuntime as Nt, deriveCommentIpfsFromCommentTableRow as O, RpcAuthorNameParamSchema as On, verifyCommunity as Ot, importSignerIntoKuboNode as P, RpcEditCommunityParamSchema as Pn, getAuthorNameFromWire as Pt, RepliesPages as Q, n$5 as Qn, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as Qt, resolveDbPostsCidRefs as R, RpcExportCommunityResultSchema as Rn, getCommunityNameFromWire$1 as Rt, BackupAbortError as S, parseRpcCommentEventWithPKCErrorIfItFails as Sn, verifyChallengeVerification as St, calculateInlineRepliesBudget as T, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Tn, verifyCommentModeration as Tt, POST_REPLIES_SORT_TYPES as U, RpcPublishedAnchorRecordResultSchema as Un, getBufferedPKCAddressFromPublicKey as Ut, CommentClientsManager as V, RpcPublishAnchorRecordParamSchema as Vn, decode as Vt, REPLY_REPLIES_SORT_TYPES as W, RpcResolveAuthorNameResultSchema as Wn, getIpfsKeyFromPrivateKey as Wt, iterateOverPageCidsToFindAllCids as X, r as Xn, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Xt, findCommentInPageInstanceRecursively as Y, t$4 as Yn, parseCidStringSchemaWithPKCErrorIfItFails as Yt, parseRawPages as Z, t$5 as Zn, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Zt, createAnchorIpnsRecord as _, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as _n, signCommunityEdit as _t, pkcJsChallenges as a, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as an, nativeFunctions$1 as ar, require_lib$1 as at, encryptEd25519AesGcm as b, parseJsonWithPKCErrorIfFails as bn, verifyChallengeMessage as bt, RemoteCommunity as c, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as cn, signChallengeMessage as ct, decodeRpcChallengeAnswerPubsubMsg as d, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as dn, signComment as dt, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as en, t$7 as er, PKCClientsManager as et, decodeRpcChallengePubsubMsg as f, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as fn, signCommentEdit as ft, createSigner as g, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as gn, signCommunity as gt, SignerWithPublicKeyAddress as h, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as hn, signCommentUpdateForChallengeVerification as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as in, require_lodash_merge as ir, PKCTypedEmitter as it, getDefaultCommunityDbConfig as j, RpcCommentRepliesPageParamSchema as jn, buildRuntimeAuthor as jt, deriveDbPosts as k, RpcCancelExportParamSchema as kn, verifyCommunityEdit as kt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as l, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as ln, signChallengeRequest as lt, decodeRpcChallengeVerificationPubsubMsg as m, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as mn, signCommentUpdate as mt, RpcRemoteCommunity as n, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as nn, stringify as nr, pRetry as nt, TrackedInstanceRegistry as o, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as on, require_undici as or, cleanUpBeforePublishing as ot, decodeRpcChallengeRequestPubsubMsg as p, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as pn, signCommentModeration as pt, buildPagesRuntimeFields as q, RpcUnsubscribeParamSchema as qn, getPublicKeyFromPrivateKey as qt, getChallengeVerification as r, parseCommunityAddressWithPKCErrorIfItFails as rn, STORAGE_KEYS as rr, pLimit as rt, LRUCache as s, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as sn, signChallengeAnswer as st, RpcLocalCommunity as t, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as tn, t$8 as tr, InflightFetchManager as tt, KeyvBetterSqlite3 as u, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as un, signChallengeVerification as ut, decryptEd25519AesGcm as v, parseDecryptedChallengeVerification as vn, signVote as vt, calculateExpectedSignatureSize as w, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as wn, verifyCommentIpfs as wt, encryptEd25519AesGcmPublicKeyBuffer as x, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as xn, verifyChallengeRequest as xt, decryptEd25519AesGcmPublicKeyBuffer as y, parseDecryptedChallengeWithPKCErrorIfItFails as yn, verifyChallengeAnswer as yt, setNativeFunctions as z, RpcFetchCidParamSchema as zn, getCommunityPublicKeyFromWire as zt };
|