@pkcprotocol/pkc-js 0.0.80 → 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.
Files changed (72) hide show
  1. package/dist/browser/generated-version.d.ts +1 -1
  2. package/dist/browser/generated-version.js +1 -1
  3. package/dist/browser/pkc/pkc.d.ts +1 -2
  4. package/dist/browser/pkc/pkc.js +17 -24
  5. package/dist/browser/pkc/pkc.js.map +1 -1
  6. package/dist/browser/rpc/src/index.js +1 -1
  7. package/dist/browser/rpc/src/index.js.map +1 -1
  8. package/dist/browser/runtime/browser/setup-kubo-http-routers.d.ts +1 -0
  9. package/dist/browser/runtime/browser/setup-kubo-http-routers.js +4 -0
  10. package/dist/browser/runtime/browser/setup-kubo-http-routers.js.map +1 -0
  11. package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.d.ts +3 -2
  12. package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js +19 -10
  13. package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -1
  14. package/dist/browser/runtime/node/setup-kubo-http-routers.d.ts +2 -0
  15. package/dist/browser/runtime/node/{setup-kubo-address-rewriter-and-http-router.js → setup-kubo-http-routers.js} +54 -112
  16. package/dist/browser/runtime/node/setup-kubo-http-routers.js.map +1 -0
  17. package/dist/browser/util.d.ts +3 -4
  18. package/dist/browser/util.js +7 -3
  19. package/dist/browser/util.js.map +1 -1
  20. package/dist/bundled/bundle-manifest.json +76 -93
  21. package/dist/bundled/chunks/{helia-for-pkc-BsYWQ7qS.js → helia-for-pkc-BcNF-orO.js} +31 -31
  22. package/dist/bundled/chunks/{local-community-EqWKTLxr.js → local-community-B6-jaMsn.js} +1 -1
  23. package/dist/bundled/chunks/{local-community-CHzhypCp.js → local-community-CyX1HwD0.js} +8 -4
  24. package/dist/bundled/chunks/{node-4qAZNuJG.js → node-BCXmIYLQ.js} +265 -2310
  25. package/dist/bundled/chunks/{rpc-local-community-Cog5rZLG.js → rpc-local-community-BOiy8BX1.js} +47 -570
  26. package/dist/bundled/chunks/{schema-Iavj-cRD.js → schema-DZyEx0YQ.js} +4 -4
  27. package/dist/bundled/chunks/{util-CfSUfLkV.js → util-BTPlI1yF.js} +1 -1
  28. package/dist/bundled/index.js +1 -1
  29. package/dist/bundled/rpc/src/index.js +4 -4
  30. package/dist/node/generated-version.d.ts +1 -1
  31. package/dist/node/generated-version.js +1 -1
  32. package/dist/node/pkc/pkc.d.ts +1 -2
  33. package/dist/node/pkc/pkc.js +17 -24
  34. package/dist/node/pkc/pkc.js.map +1 -1
  35. package/dist/node/rpc/src/index.js +1 -1
  36. package/dist/node/rpc/src/index.js.map +1 -1
  37. package/dist/node/runtime/browser/setup-kubo-http-routers.d.ts +1 -0
  38. package/dist/node/runtime/browser/setup-kubo-http-routers.js +4 -0
  39. package/dist/node/runtime/browser/setup-kubo-http-routers.js.map +1 -0
  40. package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.d.ts +3 -2
  41. package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js +19 -10
  42. package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -1
  43. package/dist/node/runtime/node/setup-kubo-http-routers.d.ts +2 -0
  44. package/dist/node/runtime/node/{setup-kubo-address-rewriter-and-http-router.js → setup-kubo-http-routers.js} +54 -112
  45. package/dist/node/runtime/node/setup-kubo-http-routers.js.map +1 -0
  46. package/dist/node/util.d.ts +3 -4
  47. package/dist/node/util.js +7 -3
  48. package/dist/node/util.js.map +1 -1
  49. package/package.json +2 -2
  50. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.d.ts +0 -1
  51. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.js +0 -4
  52. package/dist/browser/runtime/browser/setup-kubo-address-rewriter-and-http-router.js.map +0 -1
  53. package/dist/browser/runtime/node/address-rewriter-db.d.ts +0 -33
  54. package/dist/browser/runtime/node/address-rewriter-db.js +0 -156
  55. package/dist/browser/runtime/node/address-rewriter-db.js.map +0 -1
  56. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.d.ts +0 -47
  57. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js +0 -534
  58. package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js.map +0 -1
  59. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.d.ts +0 -4
  60. package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +0 -1
  61. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.d.ts +0 -1
  62. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.js +0 -4
  63. package/dist/node/runtime/browser/setup-kubo-address-rewriter-and-http-router.js.map +0 -1
  64. package/dist/node/runtime/node/address-rewriter-db.d.ts +0 -33
  65. package/dist/node/runtime/node/address-rewriter-db.js +0 -156
  66. package/dist/node/runtime/node/address-rewriter-db.js.map +0 -1
  67. package/dist/node/runtime/node/addresses-rewriter-proxy-server.d.ts +0 -47
  68. package/dist/node/runtime/node/addresses-rewriter-proxy-server.js +0 -534
  69. package/dist/node/runtime/node/addresses-rewriter-proxy-server.js.map +0 -1
  70. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.d.ts +0 -4
  71. package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +0 -1
  72. package/dist/bundled/chunks/{src-BEjAH2gY.js → src-WLgFbUwZ.js} +1 -1
@@ -1,15 +1,12 @@
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-Iavj-cRD.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-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 fs 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";
12
- import path$1 from "path";
9
+ import path from "path";
13
10
  import assert from "assert";
14
11
  import { Agent } from "https";
15
12
  import { Agent as Agent$1 } from "http";
@@ -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$4 = __require("node: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$4 && http$4.maxHeaderSize && Number.isInteger(http$4.maxHeaderSize) && http$4.maxHeaderSize > 0 ? () => http$4.maxHeaderSize : () => {
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: writeFile$1, readFile: readFile$1, mkdir } = __require("node:fs/promises");
11932
- const { dirname: dirname$1, resolve } = __require("node:path");
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$1(resolvedPath), { recursive: true });
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$1(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
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$2 = __require("https");
75536
- const http$3 = __require("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$3.Agent {
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$3 : https$2).request(requestOptions);
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$2.Agent {
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$3 : https$2).request(requestOptions);
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$1 = __require("path").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$1(part.file) : name;
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$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();
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$2.Agent || http$2.Agent.defaultMaxSockets != Infinity;
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,
@@ -88437,7 +88433,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
88437
88433
  function get_stream_length(stream, given_length, cb) {
88438
88434
  if (given_length > 0) return cb(given_length);
88439
88435
  if (stream.end !== void 0 && stream.end !== Infinity && stream.start !== void 0) return cb(stream.end + 1 - (stream.start || 0));
88440
- fs$1.stat(stream.path, function(err, stat) {
88436
+ fs.stat(stream.path, function(err, stat) {
88441
88437
  cb(stat ? stat.size - (stream.start || 0) : null);
88442
88438
  });
88443
88439
  }
@@ -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$2("Modifying request URI", uri + " => " + modified_uri);
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$1 : http$2;
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$2("Already finished, stopping here.");
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$2("Request error", err);
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$2("Making request #" + count, request_opts);
88633
+ debug("Making request #" + count, request_opts);
88638
88634
  request = protocol.request(request_opts, function(resp) {
88639
88635
  var headers = resp.headers;
88640
- debug$2("Got response", resp.statusCode, headers);
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$2("Got cookies", resp.cookies);
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$2("Clearing original request cookie", config.headers["cookie"]);
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$2("Redirecting to " + redirect_url.toString());
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,11 +88692,11 @@ 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$2(err);
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) {
88703
- var file = fs$1.createWriteStream(config.output);
88699
+ var file = fs.createWriteStream(config.output);
88704
88700
  file.on("error", had_error);
88705
88701
  out.on("end", function() {
88706
88702
  if (file.writable) file.end();
@@ -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$2(err);
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$2(err);
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({
@@ -98162,6 +98157,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
98162
98157
  }));
98163
98158
  //#endregion
98164
98159
  //#region dist/node/clients/pkc-typed-emitter.js
98160
+ var import_retry = /* @__PURE__ */ __toESM(require_retry$1(), 1);
98165
98161
  var import_lib$1 = require_lib$1();
98166
98162
  var PKCTypedEmitter = class extends import_lib$1.TypedEmitter {
98167
98163
  constructor() {
@@ -101632,14 +101628,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
101632
101628
  };
101633
101629
  //#endregion
101634
101630
  //#region dist/node/runtime/node/util.js
101635
- const getDefaultDataPath = () => path$1.join(process.cwd(), ".pkc");
101631
+ const getDefaultDataPath = () => path.join(process.cwd(), ".pkc");
101636
101632
  const getDefaultCommunityDbConfig = async (communityAddress, pkc) => {
101637
101633
  let filename;
101638
101634
  if (pkc.noData) filename = ":memory:";
101639
101635
  else {
101640
101636
  assert(typeof pkc.dataPath === "string", "pkc.dataPath need to be defined to get default community db config");
101641
- filename = path$1.join(pkc.dataPath, "communities", communityAddress);
101642
- await promises.mkdir(path$1.dirname(filename), { recursive: true });
101637
+ filename = path.join(pkc.dataPath, "communities", communityAddress);
101638
+ await promises.mkdir(path.dirname(filename), { recursive: true });
101643
101639
  }
101644
101640
  return {
101645
101641
  filename,
@@ -101738,7 +101734,7 @@ const setNativeFunctions = (newNativeFunctions) => {
101738
101734
  };
101739
101735
  const deleteOldCommunityInWindows = async (subPath, pkc) => {
101740
101736
  const log = logger_default("pkc-js:community:deleteStaleCommunityInWindows");
101741
- const communityAddress = path$1.basename(subPath);
101737
+ const communityAddress = path.basename(subPath);
101742
101738
  await new Promise((resolve) => setTimeout(resolve, 1e4));
101743
101739
  try {
101744
101740
  await promises.rm(subPath, { force: true });
@@ -101762,7 +101758,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101762
101758
  }
101763
101759
  const communitiesThatWereDeletedSuccessfully = [];
101764
101760
  for (const communityAddress of deletedPersistentCommunities) {
101765
- const communityPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101761
+ const communityPath = path.join(pkc.dataPath, "communities", communityAddress);
101766
101762
  try {
101767
101763
  await promises.rm(communityPath, { force: true });
101768
101764
  log(`Succeeded in deleting old db path (${communityAddress})`);
@@ -101786,7 +101782,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101786
101782
  function listCommunitiesSync(pkc) {
101787
101783
  logger_default("pkc-js:listCommunitiesSync");
101788
101784
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath needs to be defined to listCommunities");
101789
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101785
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101790
101786
  const files = readdirSync(communitiesPath, {
101791
101787
  recursive: false,
101792
101788
  withFileTypes: false
@@ -101794,7 +101790,7 @@ function listCommunitiesSync(pkc) {
101794
101790
  const communityFilesWeDontNeedToCheck = pkc.communities ? files.filter((address) => pkc.communities.includes(address)) : [];
101795
101791
  const sqliteFiles = files.filter((address) => !communityFilesWeDontNeedToCheck.includes(address)).filter((address) => {
101796
101792
  try {
101797
- const filePath = path$1.join(communitiesPath, address);
101793
+ const filePath = path.join(communitiesPath, address);
101798
101794
  if (!existsSync(filePath)) return false;
101799
101795
  const fd = openSync(filePath, "r");
101800
101796
  const buffer = Buffer.alloc(16);
@@ -101875,7 +101871,7 @@ var BackupAbortError = class extends Error {
101875
101871
  async function backupCommunityDb(opts) {
101876
101872
  const { sourcePath, destPath, includePrivateKey, onProgress, signal } = opts;
101877
101873
  if (signal?.aborted) throw new BackupAbortError();
101878
- await promises.mkdir(path$1.dirname(destPath), { recursive: true });
101874
+ await promises.mkdir(path.dirname(destPath), { recursive: true });
101879
101875
  const partialPath = destPath + ".partial";
101880
101876
  try {
101881
101877
  await promises.unlink(partialPath);
@@ -101959,9 +101955,9 @@ async function statAndHashFile(filePath) {
101959
101955
  }
101960
101956
  async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
101961
101957
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath is not defined");
101962
- const oldPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101963
- const newPath = path$1.join(pkc.dataPath, "communities", "deleted", communityAddress);
101964
- await promises.mkdir(path$1.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101958
+ const oldPath = path.join(pkc.dataPath, "communities", communityAddress);
101959
+ const newPath = path.join(pkc.dataPath, "communities", "deleted", communityAddress);
101960
+ await promises.mkdir(path.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101965
101961
  if (!existsSync(oldPath)) throw Error(`Source database ${oldPath} does not exist`);
101966
101962
  try {
101967
101963
  const sourceDb = new Database(oldPath, { fileMustExist: true });
@@ -101982,7 +101978,7 @@ async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
101982
101978
  }
101983
101979
  async function createKuboRpcClient(kuboRpcClientOptions) {
101984
101980
  logger_default("pkc-js:pkc:createKuboRpcClient").trace("Creating a new kubo client on node with options", kuboRpcClientOptions);
101985
- const { create: CreateKuboRpcClient } = await import("./src-BEjAH2gY.js");
101981
+ const { create: CreateKuboRpcClient } = await import("./src-WLgFbUwZ.js");
101986
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;
101987
101983
  const onehourMs = 1e3 * 60 * 60;
101988
101984
  return CreateKuboRpcClient({
@@ -101997,7 +101993,7 @@ async function createKuboRpcClient(kuboRpcClientOptions) {
101997
101993
  }
101998
101994
  async function monitorCommunitiesDirectory(pkc) {
101999
101995
  const watchAbortController = new AbortController();
102000
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101996
+ const communitiesPath = path.join(pkc.dataPath, "communities");
102001
101997
  await promises.mkdir(communitiesPath, { recursive: true });
102002
101998
  const extensionsToIgnore = [
102003
101999
  ".lock",
@@ -125976,525 +125972,6 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
125976
125972
  }
125977
125973
  };
125978
125974
  //#endregion
125979
- //#region dist/node/runtime/node/address-rewriter-db.js
125980
- const debug$1 = logger_default("pkc-js:address-rewriter-db");
125981
- var AddressRewriterDatabase = class {
125982
- constructor(dataPath, kuboConfig, proxyTarget) {
125983
- this._db = null;
125984
- this._dbPath = this._initializeDbPath(dataPath, kuboConfig, proxyTarget);
125985
- }
125986
- _initializeDbPath(dataPath, kuboConfig, proxyTarget) {
125987
- if (!dataPath) throw new Error("dataPath must be defined for request logging");
125988
- let kuboIdentifier = "unknown";
125989
- if (kuboConfig && typeof kuboConfig === "object" && "host" in kuboConfig && "port" in kuboConfig) kuboIdentifier = `${kuboConfig.host}_${kuboConfig.port}`;
125990
- const proxyIdentifier = `${proxyTarget.hostname}_${proxyTarget.port || (proxyTarget.protocol === "https:" ? "443" : "80")}`;
125991
- const fileName = `address_rewriter_${kuboIdentifier}_${proxyIdentifier}.db`;
125992
- return path.join(dataPath, ".address-rewriter", fileName);
125993
- }
125994
- async initialize() {
125995
- try {
125996
- const dbDir = path.dirname(this._dbPath);
125997
- await fs.mkdir(dbDir, { recursive: true });
125998
- this._db = new Database(this._dbPath);
125999
- this._db.exec(`
126000
- CREATE TABLE IF NOT EXISTS request_logs (
126001
- id INTEGER PRIMARY KEY AUTOINCREMENT,
126002
- keys TEXT NOT NULL,
126003
- received_at INTEGER NOT NULL,
126004
- transmitted_at INTEGER,
126005
- success INTEGER NOT NULL,
126006
- status_code INTEGER,
126007
- method TEXT NOT NULL,
126008
- url TEXT NOT NULL,
126009
- error TEXT,
126010
- retry_count INTEGER DEFAULT 0,
126011
- body_preview TEXT,
126012
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP
126013
- )
126014
- `);
126015
- this._db.exec(`
126016
- CREATE TABLE IF NOT EXISTS reprovide_logs (
126017
- id INTEGER PRIMARY KEY AUTOINCREMENT,
126018
- key TEXT NOT NULL,
126019
- timestamp INTEGER NOT NULL,
126020
- success INTEGER NOT NULL,
126021
- error TEXT,
126022
- block_not_local INTEGER DEFAULT 0,
126023
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP
126024
- )
126025
- `);
126026
- this._db.exec(`
126027
- CREATE TABLE IF NOT EXISTS failed_keys (
126028
- key TEXT PRIMARY KEY,
126029
- added_at INTEGER NOT NULL,
126030
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP
126031
- )
126032
- `);
126033
- this._db.exec(`
126034
- CREATE INDEX IF NOT EXISTS idx_request_logs_received_at ON request_logs(received_at);
126035
- CREATE INDEX IF NOT EXISTS idx_reprovide_logs_timestamp ON reprovide_logs(timestamp);
126036
- CREATE INDEX IF NOT EXISTS idx_reprovide_logs_key ON reprovide_logs(key);
126037
- `);
126038
- try {
126039
- this._db.exec("ALTER TABLE request_logs ADD COLUMN body_preview TEXT");
126040
- } catch (error) {
126041
- if (!(error instanceof Error ? error.message : String(error)).toLowerCase().includes("duplicate column name")) throw error;
126042
- }
126043
- debug$1(`Initialized SQLite database at ${this._dbPath}`);
126044
- } catch (error) {
126045
- debug$1.error(`Failed to initialize database at ${this._dbPath}:`, error);
126046
- throw error;
126047
- }
126048
- }
126049
- close() {
126050
- if (this._db) {
126051
- this._db.close();
126052
- this._db = null;
126053
- }
126054
- }
126055
- insertRequestLogs(logs) {
126056
- if (!this._db) throw new Error("Database not initialized");
126057
- const insertStmt = this._db.prepare(`
126058
- INSERT INTO request_logs (
126059
- keys, received_at, transmitted_at, success, status_code,
126060
- method, url, error, retry_count, body_preview
126061
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
126062
- `);
126063
- this._db.transaction(() => {
126064
- 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);
126065
- })();
126066
- }
126067
- insertReprovideLog(key, success, error, blockNotLocal) {
126068
- if (!this._db) throw new Error("Database not initialized");
126069
- this._db.prepare(`
126070
- INSERT INTO reprovide_logs (key, timestamp, success, error, block_not_local)
126071
- VALUES (?, ?, ?, ?, ?)
126072
- `).run(key, Date.now(), success ? 1 : 0, error || null, blockNotLocal ? 1 : 0);
126073
- }
126074
- loadFailedKeys() {
126075
- if (!this._db) return [];
126076
- try {
126077
- return this._db.prepare("SELECT key FROM failed_keys").all().map((row) => row.key);
126078
- } catch (error) {
126079
- debug$1.error("Failed to load failed keys from database:", error);
126080
- return [];
126081
- }
126082
- }
126083
- saveFailedKeys(keys) {
126084
- if (!this._db) throw new Error("Database not initialized");
126085
- this._db.transaction(() => {
126086
- this._db.exec("DELETE FROM failed_keys");
126087
- if (keys.length > 0) {
126088
- const insertStmt = this._db.prepare("INSERT INTO failed_keys (key, added_at) VALUES (?, ?)");
126089
- const now = Date.now();
126090
- for (const key of keys) insertStmt.run(key, now);
126091
- }
126092
- })();
126093
- }
126094
- };
126095
- //#endregion
126096
- //#region dist/node/runtime/node/addresses-rewriter-proxy-server.js
126097
- const debug = logger_default("pkc-js:addresses-rewriter");
126098
- const MAX_BODY_PREVIEW_BYTES = 4096;
126099
- function normalizeSelfAddrsForProvider(addrs, peerId) {
126100
- const suffix = `/p2p/${peerId}`;
126101
- return n$10(addrs.map((addr) => addr.endsWith(suffix) ? addr.slice(0, -suffix.length) : addr));
126102
- }
126103
- var AddressesRewriterProxyServer = class {
126104
- constructor({ kuboClients: kuboClient, port, hostname, proxyTargetUrl, pkc }) {
126105
- this._requestLogBuffer = [];
126106
- this._isWritingLogs = false;
126107
- this._failedKeys = /* @__PURE__ */ new Set();
126108
- this._isRetrying = false;
126109
- this.addresses = {};
126110
- this.kuboClients = kuboClient;
126111
- this.port = port;
126112
- this.hostname = hostname || "127.0.0.1";
126113
- this.proxyTarget = new URL(proxyTargetUrl);
126114
- this.server = http.createServer((req, res) => this._proxyRequestRewrite(req, res));
126115
- this._storageKeyName = `httprouter_proxy_${proxyTargetUrl}`;
126116
- this._pkc = pkc;
126117
- const envValue = process.env.ENABLE_LOGGING_OF_ADDRESS_REWRITER_PROXY;
126118
- this._loggingEnabled = envValue === "1" || envValue?.toLowerCase() === "true";
126119
- if (this._loggingEnabled) {
126120
- const kuboConfig = this.kuboClients?.[0]?.getEndpointConfig();
126121
- this._db = new AddressRewriterDatabase(this._pkc.dataPath, kuboConfig, this.proxyTarget);
126122
- } else this._db = null;
126123
- this._httpAgent = new http.Agent({
126124
- keepAlive: true,
126125
- keepAliveMsecs: 3e4,
126126
- maxSockets: 50,
126127
- timeout: 1e4
126128
- });
126129
- this._httpsAgent = new https.Agent({
126130
- keepAlive: true,
126131
- keepAliveMsecs: 3e4,
126132
- maxSockets: 50,
126133
- timeout: 1e4
126134
- });
126135
- hideClassPrivateProps(this);
126136
- }
126137
- async listen(callback) {
126138
- if (this._loggingEnabled && this._db) {
126139
- await this._db.initialize();
126140
- debug("Request logging enabled for addresses rewriter proxy");
126141
- } else debug("Request logging disabled for addresses rewriter proxy");
126142
- await this._startUpdateAddressesLoop();
126143
- if (this._loggingEnabled) this._startRequestLogging();
126144
- await this._startFailedKeysRetry();
126145
- this.server.on("error", (err) => debug.error("Error with address rewriter proxy", this.server.address(), "Proxy target", this.proxyTarget, err));
126146
- this.server.listen(this.port, this.hostname, callback);
126147
- debug("Addresses rewriter proxy at", this.hostname + ":" + this.port, "started listening to forward requests to", this.proxyTarget.host, `- request logging ${this._loggingEnabled ? "enabled" : "disabled"}`);
126148
- await this._pkc._storage.setItem(this._storageKeyName, `http://${this.hostname}:${this.port}`);
126149
- }
126150
- async destroy() {
126151
- this.server.close();
126152
- if (this._updateAddressesInterval) clearInterval(this._updateAddressesInterval);
126153
- if (this._logWriteInterval) clearInterval(this._logWriteInterval);
126154
- if (this._retryInterval) clearInterval(this._retryInterval);
126155
- await this._writeRequestLogs();
126156
- this._db?.close();
126157
- this._httpAgent.destroy();
126158
- this._httpsAgent.destroy();
126159
- await this._pkc._storage.removeItem(this._storageKeyName);
126160
- }
126161
- _proxyRequestRewrite(req, res) {
126162
- let reqBody = "";
126163
- req.on("data", (chunk) => {
126164
- reqBody += chunk.toString();
126165
- });
126166
- req.on("end", () => {
126167
- const shouldRewrite = req.method === "PUT" || req.method === "POST";
126168
- let requestLogEntry = null;
126169
- if (shouldRewrite) {
126170
- const keys = this._extractKeysFromRequestBody(reqBody);
126171
- const shouldLogRequest = this._loggingEnabled;
126172
- if (keys.length > 0 || shouldLogRequest) {
126173
- requestLogEntry = {
126174
- keys,
126175
- receivedAt: Date.now(),
126176
- success: false,
126177
- method: req.method || "UNKNOWN",
126178
- url: req.url || "/",
126179
- retryCount: 0,
126180
- bodyPreview: shouldLogRequest ? this._createBodyPreview(reqBody) : void 0
126181
- };
126182
- if (shouldLogRequest) this._requestLogBuffer.push(requestLogEntry);
126183
- }
126184
- }
126185
- let rewrittenBody = reqBody;
126186
- if (shouldRewrite && rewrittenBody) try {
126187
- const json = JSON.parse(rewrittenBody);
126188
- if (json.Providers && Array.isArray(json.Providers)) {
126189
- for (const provider of json.Providers) {
126190
- const peerId = provider?.Payload?.ID;
126191
- if (peerId && this.addresses[peerId]) provider.Payload.Addrs = this.addresses[peerId];
126192
- }
126193
- rewrittenBody = JSON.stringify(json);
126194
- }
126195
- } catch (e) {
126196
- debug("proxy body rewrite error:", e, "body", rewrittenBody, req.url, req.method);
126197
- }
126198
- this._proxyRequest(req, res, rewrittenBody, requestLogEntry);
126199
- });
126200
- req.on("error", (err) => {
126201
- debug.trace("Request error:", req.url, req.method, req.headers, reqBody, err);
126202
- if (!res.headersSent) {
126203
- debug.trace("Request error:", req.url, req.method, req.headers, reqBody, err);
126204
- res.writeHead(500);
126205
- res.end("Internal Server Error");
126206
- }
126207
- });
126208
- }
126209
- _proxyRequest(req, res, rewrittenBody, requestLogEntry) {
126210
- if (requestLogEntry) {
126211
- requestLogEntry.retryCount = 0;
126212
- requestLogEntry.transmittedAt = Date.now();
126213
- }
126214
- const { request: httpRequest } = this.proxyTarget.protocol === "https:" ? https : http;
126215
- const agent = this.proxyTarget.protocol === "https:" ? this._httpsAgent : this._httpAgent;
126216
- const requestOptions = {
126217
- hostname: this.proxyTarget.hostname,
126218
- protocol: this.proxyTarget.protocol,
126219
- path: req.url,
126220
- method: req.method,
126221
- headers: {
126222
- ...req.headers,
126223
- "content-length": Buffer.byteLength(rewrittenBody),
126224
- host: this.proxyTarget.host
126225
- },
126226
- agent,
126227
- timeout: 1e4
126228
- };
126229
- if (this.proxyTarget.port) requestOptions.port = this.proxyTarget.port;
126230
- const proxyReq = httpRequest(requestOptions);
126231
- proxyReq.setTimeout(1e4, () => {
126232
- debug.trace("Proxy request timed out", requestOptions);
126233
- if (requestLogEntry) {
126234
- requestLogEntry.success = false;
126235
- requestLogEntry.statusCode = 504;
126236
- requestLogEntry.error = "Request timeout";
126237
- requestLogEntry.completed = true;
126238
- if (requestLogEntry.keys) {
126239
- const sizeBefore = this._failedKeys.size;
126240
- requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
126241
- if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
126242
- }
126243
- }
126244
- proxyReq.destroy();
126245
- if (!res.headersSent) {
126246
- res.writeHead(504);
126247
- res.end("Gateway Timeout");
126248
- }
126249
- });
126250
- proxyReq.on("error", (e) => {
126251
- proxyReq.destroy();
126252
- if (requestLogEntry) {
126253
- requestLogEntry.success = false;
126254
- requestLogEntry.statusCode = 500;
126255
- requestLogEntry.error = `Proxy error: ${e.message}`;
126256
- requestLogEntry.completed = true;
126257
- debug.trace(`Updated log entry with error for keys: ${requestLogEntry.keys.join(", ")}`);
126258
- if (requestLogEntry.keys) {
126259
- const sizeBefore = this._failedKeys.size;
126260
- requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
126261
- if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
126262
- }
126263
- }
126264
- if (!res.headersSent) {
126265
- debug.trace("address rewriter proxy error:", e, "Request options", requestOptions);
126266
- res.writeHead(500);
126267
- res.end("Internal Server Error");
126268
- }
126269
- });
126270
- proxyReq.on("response", (proxyRes) => {
126271
- const statusCode = proxyRes.statusCode || 500;
126272
- const isSuccess = statusCode >= 200 && statusCode < 300;
126273
- if (requestLogEntry) {
126274
- requestLogEntry.success = isSuccess;
126275
- requestLogEntry.statusCode = statusCode;
126276
- requestLogEntry.completed = true;
126277
- if (!isSuccess) {
126278
- requestLogEntry.error = `HTTP ${statusCode}`;
126279
- if (requestLogEntry.keys) {
126280
- const sizeBefore = this._failedKeys.size;
126281
- requestLogEntry.keys.forEach((key) => this._failedKeys.add(key));
126282
- if (this._failedKeys.size > sizeBefore) this._saveFailedKeysToDatabase();
126283
- }
126284
- }
126285
- }
126286
- proxyRes.on("error", (err) => {
126287
- debug.trace("Proxy response error:", err);
126288
- if (!res.headersSent) {
126289
- res.writeHead(500);
126290
- res.end("Proxy Response Error");
126291
- }
126292
- if (requestLogEntry) {
126293
- requestLogEntry.success = false;
126294
- requestLogEntry.statusCode = 500;
126295
- requestLogEntry.error = `Proxy response error: ${err.message}`;
126296
- requestLogEntry.completed = true;
126297
- }
126298
- proxyRes.destroy(err);
126299
- });
126300
- if (!res.headersSent) {
126301
- res.writeHead(statusCode, proxyRes.headers);
126302
- proxyRes.pipe(res);
126303
- }
126304
- res.on("finish", () => {
126305
- proxyRes.resume();
126306
- });
126307
- });
126308
- proxyReq.write(rewrittenBody);
126309
- proxyReq.end();
126310
- }
126311
- async _startUpdateAddressesLoop() {
126312
- if (!this.kuboClients?.length) throw Error("should have a defined kubo rpc client option to start the address rewriter");
126313
- const isRetriableError = (error) => {
126314
- if (typeof error !== "object" || error === null) return false;
126315
- const err = error;
126316
- return err.response?.status === 500 || err.status === 500 || err.statusCode === 500;
126317
- };
126318
- const tryUpdateAddressesForClient = async (kuboClient) => {
126319
- return new Promise((resolve) => {
126320
- const operation = import_retry.operation({
126321
- retries: 3,
126322
- factor: 2,
126323
- minTimeout: 1e3,
126324
- maxTimeout: 8e3
126325
- });
126326
- operation.attempt(async (currentAttempt) => {
126327
- try {
126328
- const idRes = await kuboClient.id();
126329
- const swarmAddrsRes = await kuboClient.swarm.addrs();
126330
- const peerId = idRes.id.toString();
126331
- if (typeof peerId !== "string") throw Error("Failed to get Peer ID of kubo node");
126332
- const swarmListeningAddresses = swarmAddrsRes.filter((swarmAddr) => swarmAddr.id.toString() === peerId);
126333
- const addresses = normalizeSelfAddrsForProvider([...idRes.addresses.map((addr) => addr.toString()), ...n$5(swarmListeningAddresses.map((swarmAddr) => swarmAddr.addrs.map((addr) => addr.toString())))], peerId);
126334
- if (addresses.length === 0) throw Error(`Failed to get any addresses for peer ${peerId}`);
126335
- this.addresses[peerId] = addresses;
126336
- resolve();
126337
- } catch (e) {
126338
- const error = e;
126339
- if (isRetriableError(error)) {
126340
- debug(`tryUpdateAddresses attempt ${currentAttempt}/4 failed with 500 error:`, error.message, { kuboConfig: kuboClient.getEndpointConfig() });
126341
- if (operation.retry(error)) return;
126342
- }
126343
- debug("tryUpdateAddresses error:", error.message, { kuboConfig: kuboClient.getEndpointConfig() });
126344
- resolve();
126345
- }
126346
- });
126347
- });
126348
- };
126349
- const tryUpdateAddresses = async () => {
126350
- const promises = this.kuboClients.map(tryUpdateAddressesForClient);
126351
- await Promise.allSettled(promises);
126352
- };
126353
- await tryUpdateAddresses();
126354
- this._updateAddressesInterval = setInterval(tryUpdateAddresses, 1e3 * 60);
126355
- }
126356
- _extractKeysFromRequestBody(body) {
126357
- try {
126358
- const json = JSON.parse(body);
126359
- const keys = [];
126360
- if (json.Providers && Array.isArray(json.Providers)) {
126361
- for (const provider of json.Providers) if (provider?.Payload?.Keys) keys.push(...provider.Payload.Keys);
126362
- }
126363
- return keys;
126364
- } catch {
126365
- return [];
126366
- }
126367
- }
126368
- _createBodyPreview(body) {
126369
- const buffer = Buffer.from(body, "utf8");
126370
- if (buffer.length <= MAX_BODY_PREVIEW_BYTES) return body;
126371
- return `${buffer.subarray(0, MAX_BODY_PREVIEW_BYTES).toString("utf8")}...[truncated ${buffer.length - MAX_BODY_PREVIEW_BYTES} bytes]`;
126372
- }
126373
- async _writeRequestLogs() {
126374
- if (!this._loggingEnabled || !this._db) return;
126375
- if (this._requestLogBuffer.length === 0 || this._isWritingLogs) return;
126376
- this._isWritingLogs = true;
126377
- const logsToWrite = this._requestLogBuffer.filter((entry) => entry.completed);
126378
- if (logsToWrite.length === 0) {
126379
- this._isWritingLogs = false;
126380
- return;
126381
- }
126382
- const inFlightLogs = this._requestLogBuffer.filter((entry) => !entry.completed);
126383
- this._requestLogBuffer = inFlightLogs;
126384
- try {
126385
- this._db.insertRequestLogs(logsToWrite);
126386
- debug.trace(`Wrote ${logsToWrite.length} new request log entries to SQLite database`);
126387
- } catch (error) {
126388
- debug.error(`Failed to write request logs to SQLite database:`, error);
126389
- this._requestLogBuffer.unshift(...logsToWrite);
126390
- } finally {
126391
- this._isWritingLogs = false;
126392
- }
126393
- }
126394
- _startRequestLogging() {
126395
- if (!this._loggingEnabled || !this._db) return;
126396
- const writeInterval = 5 * 1e3;
126397
- this._logWriteInterval = setInterval(async () => {
126398
- await this._writeRequestLogs();
126399
- }, writeInterval);
126400
- }
126401
- async _startFailedKeysRetry() {
126402
- this._loadFailedKeysFromDatabase();
126403
- const retryInterval = 120 * 1e3;
126404
- this._retryInterval = setInterval(async () => {
126405
- if (this._isRetrying) {
126406
- debug.trace("Previous failed-keys retry still running, skipping this tick");
126407
- return;
126408
- }
126409
- this._isRetrying = true;
126410
- try {
126411
- await this._retryFailedKeys();
126412
- } finally {
126413
- this._isRetrying = false;
126414
- }
126415
- }, retryInterval);
126416
- debug(`Started failed keys retry with ${this._failedKeys.size} keys from previous sessions`);
126417
- }
126418
- _loadFailedKeysFromDatabase() {
126419
- if (!this._loggingEnabled || !this._db) return;
126420
- try {
126421
- const keys = this._db.loadFailedKeys();
126422
- keys.forEach((key) => this._failedKeys.add(key));
126423
- debug(`Loaded ${keys.length} failed keys from database`);
126424
- } catch (error) {
126425
- debug.error("Failed to load failed keys from database:", error);
126426
- throw error;
126427
- }
126428
- }
126429
- _saveFailedKeysToDatabase() {
126430
- if (!this._loggingEnabled || !this._db) return;
126431
- try {
126432
- const keys = Array.from(this._failedKeys);
126433
- this._db.saveFailedKeys(keys);
126434
- if (keys.length === 0) debug.trace(`All keys successfully provided - no failed keys to save`);
126435
- else debug.trace(`Saved ${keys.length} failed keys to database`);
126436
- } catch (error) {
126437
- debug.error("Failed to save failed keys to database:", error);
126438
- throw error;
126439
- }
126440
- }
126441
- async _retryFailedKeys() {
126442
- if (this._failedKeys.size === 0) {
126443
- debug.trace(`No failed keys to retry - all keys successfully provided`);
126444
- return;
126445
- }
126446
- debug(`Retrying ${this._failedKeys.size} failed keys`);
126447
- const keysToRetry = Array.from(this._failedKeys);
126448
- const kuboClient = this.kuboClients?.[0];
126449
- if (!kuboClient) {
126450
- debug.error("No kubo client available for retry");
126451
- return;
126452
- }
126453
- const successfulKeys = [];
126454
- const stillFailedKeys = [];
126455
- const keysToDiscard = [];
126456
- for (const key of keysToRetry) try {
126457
- debug.trace(`Providing key to HTTP routers: ${key}`);
126458
- const events = [];
126459
- for await (const event of kuboClient.routing.provide(key, {
126460
- recursive: true,
126461
- verbose: true
126462
- })) {
126463
- events.push(event);
126464
- debug(`Routing provide event for ${key}:`, event);
126465
- }
126466
- successfulKeys.push(key);
126467
- debug.trace(`Successfully provided key: ${key}`);
126468
- this._logReprovideAttempt(key, true, void 0, false);
126469
- } catch (error) {
126470
- const errorMessage = error instanceof Error ? error.message : String(error);
126471
- const isBlockNotLocal = errorMessage.includes("block") && errorMessage.includes("not found locally");
126472
- this._logReprovideAttempt(key, false, errorMessage, isBlockNotLocal);
126473
- if (isBlockNotLocal) {
126474
- keysToDiscard.push(key);
126475
- debug.trace(`Discarding key ${key} - block not found locally, will not retry`);
126476
- } else {
126477
- stillFailedKeys.push(key);
126478
- debug.trace(`Failed to provide key ${key}:`, error);
126479
- }
126480
- }
126481
- successfulKeys.forEach((key) => this._failedKeys.delete(key));
126482
- keysToDiscard.forEach((key) => this._failedKeys.delete(key));
126483
- this._saveFailedKeysToDatabase();
126484
- debug.trace(`Retry completed: ${successfulKeys.length} successful, ${stillFailedKeys.length} still failed, ${keysToDiscard.length} discarded`);
126485
- }
126486
- _logReprovideAttempt(key, success, error, blockNotLocal) {
126487
- if (!this._loggingEnabled || !this._db) return;
126488
- try {
126489
- this._db.insertReprovideLog(key, success, error, blockNotLocal);
126490
- debug.trace(`Logged reprovide attempt for key ${key}: success=${success}, blockNotLocal=${blockNotLocal}`);
126491
- } catch (error) {
126492
- debug.error(`Failed to log reprovide attempt for key ${key}:`, error);
126493
- throw error;
126494
- }
126495
- }
126496
- };
126497
- //#endregion
126498
125975
  //#region node_modules/lru-cache/dist/esm/index.js
126499
125976
  /**
126500
125977
  * @module LRUCache
@@ -129875,4 +129352,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
129875
129352
  }
129876
129353
  };
129877
129354
  //#endregion
129878
- export { parseRawPages as $, t$5 as $n, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as $t, deriveCommentIpfsFromCommentTableRow as A, RpcAuthorNameParamSchema as An, verifyCommunity as At, resolveDbPostsCidRefs as B, RpcExportCommunityResultSchema as Bn, getCommunityNameFromWire$1 as Bt, encryptEd25519AesGcmPublicKeyBuffer as C, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Cn, verifyChallengeRequest as Ct, calculateInlineRepliesBudget as D, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Dn, verifyCommentModeration as Dt, calculateExpectedSignatureSize as E, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as En, verifyCommentIpfs as Et, getThumbnailPropsOfLink as F, RpcCommunityPageParamSchema as Fn, getAuthorNameFromRuntime as Ft, POST_REPLIES_SORT_TYPES as G, RpcPublishedAnchorRecordResultSchema as Gn, getBufferedPKCAddressFromPublicKey as Gt, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as H, RpcFetchCidResultSchema as Hn, normalizeCommunityInputFromCommunity as Ht, importSignerIntoKuboNode as I, RpcEditCommunityParamSchema as In, getAuthorNameFromWire as It, buildPageRuntimeFields as J, RpcSuccessResultSchema as Jn, getPKCAddressFromPublicKeySync as Jt, REPLY_REPLIES_SORT_TYPES as K, RpcResolveAuthorNameResultSchema as Kn, getIpfsKeyFromPrivateKey as Kt, listCommunitiesSync as L, RpcExportCommunityModLogsParamSchema as Ln, normalizeCreatePublicationAuthor as Lt, deriveDbReplies as M, RpcCidParamSchema as Mn, verifyVote as Mt, getDefaultCommunityDbConfig as N, RpcCommentRepliesPageParamSchema as Nn, buildRuntimeAuthor as Nt, createKuboRpcClient as O, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as On, verifyCommentPubsubMessage as Ot, getDefaultDataPath as P, RpcCommunityIdentifierParamSchema as Pn, cleanWireAuthor as Pt, iterateOverPageCidsToFindAllCids as Q, r as Qn, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Qt, monitorCommunitiesDirectory as R, RpcExportCommunityModLogsResultSchema as Rn, buildRuntimeCommunityFields as Rt, encryptEd25519AesGcm as S, parseJsonWithPKCErrorIfFails as Sn, verifyChallengeMessage as St, backupCommunityDb as T, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Tn, verifyCommentEdit as Tt, CommentClientsManager as U, RpcPublishAnchorRecordParamSchema as Un, decode as Ut, setNativeFunctions as V, RpcFetchCidParamSchema as Vn, getCommunityPublicKeyFromWire as Vt, POSTS_SORT_TYPES as W, RpcPublishChallengeAnswersParamSchema as Wn, encode as Wt, extractCommunityRuntimeFieldsFromParsedPages as X, t$2 as Xn, createSchemaRowParser as Xt, buildPagesRuntimeFields as Y, RpcUnsubscribeParamSchema as Yn, getPublicKeyFromPrivateKey as Yt, findCommentInPageInstanceRecursively as Z, t$4 as Zn, parseCidStringSchemaWithPKCErrorIfItFails as Zt, SignerWithPublicKeyAddress as _, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as _n, signCommentUpdateForChallengeVerification as _t, pkcJsChallenges as a, parseCommunityAddressWithPKCErrorIfItFails as an, STORAGE_KEYS as ar, pLimit as at, decryptEd25519AesGcm as b, parseDecryptedChallengeVerification as bn, signVote as bt, AddressesRewriterProxyServer as c, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as cn, require_undici as cr, cleanUpBeforePublishing as ct, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as d, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as dn, signChallengeRequest as dt, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as en, n$5 as er, RepliesPages as et, KeyvBetterSqlite3 as f, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as fn, signChallengeVerification as ft, decodeRpcChallengeVerificationPubsubMsg as g, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as gn, signCommentUpdate as gt, decodeRpcChallengeRequestPubsubMsg as h, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as hn, signCommentModeration as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as in, stringify as ir, pRetry as it, deriveDbPosts as j, RpcCancelExportParamSchema as jn, verifyCommunityEdit as jt, deleteOldCommunityInWindows as k, RpcAnchorPublishPreparationResultSchema as kn, verifyCommentUpdate as kt, normalizeSelfAddrsForProvider as l, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as ln, signChallengeAnswer as lt, decodeRpcChallengePubsubMsg as m, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as mn, signCommentEdit as mt, RpcRemoteCommunity as n, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nn, t$7 as nr, PKCClientsManager as nt, TrackedInstanceRegistry as o, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as on, require_lodash_merge as or, PKCTypedEmitter as ot, decodeRpcChallengeAnswerPubsubMsg as p, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as pn, signComment as pt, TIMEFRAMES_TO_SECONDS as q, RpcSubscriptionIdResultSchema as qn, getPKCAddressFromPublicKey as qt, getChallengeVerification as r, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as rn, t$8 as rr, InflightFetchManager as rt, LRUCache as s, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as sn, nativeFunctions$1 as sr, require_lib$1 as st, RpcLocalCommunity as t, parseCommentIpfsSchemaWithPKCErrorIfItFails as tn, n$6 as tr, PublicationClientsManager as tt, RemoteCommunity as u, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as un, signChallengeMessage as ut, createSigner as v, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as vn, signCommunity as vt, BackupAbortError as w, parseRpcCommentEventWithPKCErrorIfItFails as wn, verifyChallengeVerification as wt, decryptEd25519AesGcmPublicKeyBuffer as x, parseDecryptedChallengeWithPKCErrorIfItFails as xn, verifyChallengeAnswer as xt, createAnchorIpnsRecord as y, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as yn, signCommunityEdit as yt, moveCommunityDbToDeletedDirectory as z, RpcExportCommunityParamSchema as zn, getCommunityAddressFromRecord as zt };
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 };