@pkcprotocol/pkc-js 0.0.61 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/clients/base-client-manager.js +1 -1
- package/dist/browser/clients/base-client-manager.js.map +1 -1
- package/dist/browser/community/community-client-manager.js +1 -1
- package/dist/browser/community/community-client-manager.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/helia/helia-for-pkc.js +22 -0
- package/dist/browser/helia/helia-for-pkc.js.map +1 -1
- package/dist/browser/helia/util.js +10 -1
- package/dist/browser/helia/util.js.map +1 -1
- package/dist/browser/pkc/pkc.js +12 -6
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/publications/comment/comment.js +1 -1
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/rpc/src/index.js +42 -3
- package/dist/browser/rpc/src/index.js.map +1 -1
- package/dist/browser/runtime/browser/util.d.ts +1 -1
- package/dist/browser/runtime/browser/util.js +4 -2
- package/dist/browser/runtime/browser/util.js.map +1 -1
- package/dist/browser/runtime/node/test/mock-http-router.d.ts +15 -0
- package/dist/browser/runtime/node/test/mock-http-router.js +80 -2
- package/dist/browser/runtime/node/test/mock-http-router.js.map +1 -1
- package/dist/browser/runtime/node/util.d.ts +1 -1
- package/dist/browser/runtime/node/util.js +4 -2
- package/dist/browser/runtime/node/util.js.map +1 -1
- package/dist/browser/schema/schema.js +1 -1
- package/dist/browser/schema/schema.js.map +1 -1
- package/dist/browser/types.d.ts +1 -1
- package/dist/browser/util.d.ts +2 -2
- package/dist/browser/util.js +6 -5
- package/dist/browser/util.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +378 -319
- package/dist/bundled/chunks/chunk-2rV9d50f.js +35 -0
- package/dist/bundled/chunks/{helia-for-pkc-De6c8bno.js → helia-for-pkc-C6vMsrJ-.js} +15 -6
- package/dist/bundled/chunks/{local-community-Cjt9uNmf.js → local-community-BQmiwsV4.js} +4 -3
- package/dist/bundled/chunks/{local-community-BmuSx3YO.js → local-community-BoIoFZHk.js} +1 -1
- package/dist/bundled/chunks/{node-ChsjNuK-.js → node-G40jxRL2.js} +15 -11
- package/dist/bundled/chunks/{rpc-local-community-CShi3R2S.js → rpc-local-community-D4-NEPJb.js} +23 -20
- package/dist/bundled/chunks/{schema-9inbPhRV.js → schema-SPGmy_14.js} +12670 -27579
- package/dist/bundled/chunks/src-0J9-Tmgd.js +4147 -0
- package/dist/bundled/chunks/src-4u0f92eE.js +9899 -0
- package/dist/bundled/chunks/src-BOzgM7Fp.js +800 -0
- package/dist/bundled/chunks/src-CYIMjhjK.js +48 -0
- package/dist/bundled/chunks/{util-CTdPyu-3.js → util-CJ6nXIW9.js} +7 -2
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +31 -8
- package/dist/node/clients/base-client-manager.js +1 -1
- package/dist/node/clients/base-client-manager.js.map +1 -1
- package/dist/node/community/community-client-manager.js +1 -1
- package/dist/node/community/community-client-manager.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/helia/helia-for-pkc.js +22 -0
- package/dist/node/helia/helia-for-pkc.js.map +1 -1
- package/dist/node/helia/util.js +10 -1
- package/dist/node/helia/util.js.map +1 -1
- package/dist/node/pkc/pkc.js +12 -6
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/publications/comment/comment.js +1 -1
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/rpc/src/index.js +42 -3
- package/dist/node/rpc/src/index.js.map +1 -1
- package/dist/node/runtime/browser/util.d.ts +1 -1
- package/dist/node/runtime/browser/util.js +4 -2
- package/dist/node/runtime/browser/util.js.map +1 -1
- package/dist/node/runtime/node/test/mock-http-router.d.ts +15 -0
- package/dist/node/runtime/node/test/mock-http-router.js +80 -2
- package/dist/node/runtime/node/test/mock-http-router.js.map +1 -1
- package/dist/node/runtime/node/util.d.ts +1 -1
- package/dist/node/runtime/node/util.js +4 -2
- package/dist/node/runtime/node/util.js.map +1 -1
- package/dist/node/schema/schema.js +1 -1
- package/dist/node/schema/schema.js.map +1 -1
- package/dist/node/types.d.ts +1 -1
- package/dist/node/util.d.ts +2 -2
- package/dist/node/util.js +6 -5
- package/dist/node/util.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __exportAll = (all, no_symbols) => {
|
|
11
|
+
let target = {};
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
21
|
+
key = keys[i];
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
+
get: ((k) => from[k]).bind(null, key),
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
34
|
+
//#endregion
|
|
35
|
+
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic,
|
|
2
|
-
import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-
|
|
1
|
+
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, ar as logger_default, rr as PKCError } from "./schema-SPGmy_14.js";
|
|
2
|
+
import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-CJ6nXIW9.js";
|
|
3
3
|
import { CID } from "multiformats/cid";
|
|
4
|
-
import { NotFoundError } from "@libp2p/interface";
|
|
5
4
|
import { peerIdFromString } from "@libp2p/peer-id";
|
|
6
|
-
import { multihashToIPNSRoutingKey, unmarshalIPNSRecord } from "ipns";
|
|
7
|
-
import { ipnsValidator } from "ipns/validator";
|
|
8
|
-
import { MemoryBlockstore } from "blockstore-core";
|
|
9
5
|
import { EventEmitter as EventEmitter$1 } from "events";
|
|
10
6
|
import { createHelia, libp2pDefaults } from "helia";
|
|
11
7
|
import { ipns } from "@helia/ipns";
|
|
8
|
+
import { multihashToIPNSRoutingKey, unmarshalIPNSRecord } from "ipns";
|
|
9
|
+
import { ipnsValidator } from "ipns/validator";
|
|
12
10
|
import { gossipsub } from "@libp2p/gossipsub";
|
|
13
11
|
import { identify } from "@libp2p/identify";
|
|
14
12
|
import { bitswap } from "@helia/block-brokers";
|
|
13
|
+
import { MemoryBlockstore } from "blockstore-core";
|
|
15
14
|
import { delegatedRoutingV1HttpApiClientContentRouting } from "@helia/delegated-routing-v1-http-api-client";
|
|
15
|
+
import { NotFoundError } from "@libp2p/interface";
|
|
16
16
|
import { unixfs } from "@helia/unixfs";
|
|
17
17
|
import { fetch } from "@libp2p/fetch";
|
|
18
18
|
import { pubsub } from "@helia/ipns/routing";
|
|
@@ -62,6 +62,15 @@ function getDelegatedRoutingFields(routers) {
|
|
|
62
62
|
throw new NotFoundError("pkc HTTP routers do not serve IPNS records");
|
|
63
63
|
};
|
|
64
64
|
routing.put = async () => {};
|
|
65
|
+
const routerUrl = routers[i];
|
|
66
|
+
const originalFindProviders = routing.findProviders.bind(routing);
|
|
67
|
+
routing.findProviders = async function* (cid, options) {
|
|
68
|
+
try {
|
|
69
|
+
yield* originalFindProviders(cid, options);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
log.trace("Content router", routerUrl, "errored during findProviders; treating it as returning no providers", e);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
65
74
|
return routing;
|
|
66
75
|
};
|
|
67
76
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
+
import { $ as pubsubTopicToDhtKey, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, P as getErrorCodeFromMessage, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as require_commonjs, Y as isLinkValid, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, ar as logger_default, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, ir as messages, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nt as removeBlocksFromKuboNode, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rr as PKCError, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, vr as ZodError, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-SPGmy_14.js";
|
|
3
|
+
import { A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as require_lodash_merge, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as stringify, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as STORAGE_KEYS, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-D4-NEPJb.js";
|
|
3
4
|
import { randomFillSync, randomUUID } from "node:crypto";
|
|
4
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
6
|
import path from "node:path";
|
|
@@ -8,8 +9,8 @@ import { existsSync, promises } from "node:fs";
|
|
|
8
9
|
import path$1 from "path";
|
|
9
10
|
import assert from "assert";
|
|
10
11
|
import fs from "fs";
|
|
11
|
-
import { CID } from "multiformats/cid";
|
|
12
12
|
import Database from "better-sqlite3";
|
|
13
|
+
import { CID } from "multiformats/cid";
|
|
13
14
|
import { of } from "typestub-ipfs-only-hash";
|
|
14
15
|
//#region dist/node/runtime/node/community/local-community/comment-updates.js
|
|
15
16
|
var import_commonjs = /* @__PURE__ */ __toESM(require_commonjs(), 1);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-
|
|
1
|
+
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-BQmiwsV4.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
1
|
+
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
+
import { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as FailedToFetchCommentIpfsFromGatewaysError, Rt as pTimeout, St as findUpdatingComment, Tt as listUpdatingComments, Xn as require_commonjs, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, ar as logger_default, b as areEquivalentCommunityAddresses, br as parsedType, cn as PubsubTopicSchema, cr as setErrorMap, ct as resolveWhenPredicateIsTrue, ft as shortifyAddress, ir as messages, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, or as require_supports_color, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, rr as PKCError, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wt as listStartedCommunities, xr as stringifyPrimitive, xt as findStartedCommunity, y as version_default, yr as joinValues, z as isAbortError } from "./schema-SPGmy_14.js";
|
|
3
|
+
import { $ as RepliesPages, $t as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCidParamSchema, At as verifyCommunityEdit, B as setNativeFunctions$1, Bn as RpcFetchCidResultSchema, Bt as getCommunityPublicKeyFromWire, Cn as parseRpcCommentEventWithPKCErrorIfItFails, Ct as verifyChallengeVerification, D as createKuboRpcClient, Dn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Dt as verifyCommentPubsubMessage, Et as verifyCommentModeration, Fn as RpcExportCommunityModLogsParamSchema, Gn as RpcUnsubscribeParamSchema, H as CommentClientsManager, Hn as RpcResolveAuthorNameResultSchema, Ht as decode, I as listCommunitiesSync, In as RpcExportCommunityModLogsResultSchema, It as normalizeCreatePublicationAuthor, L as monitorCommunitiesDirectory, Ln as RpcExportCommunityParamSchema, Lt as buildRuntimeCommunityFields, Mn as RpcCommunityIdentifierParamSchema, Mt as buildRuntimeAuthor, N as getDefaultDataPath, Nn as RpcCommunityPageParamSchema, Nt as cleanWireAuthor, On as RpcAuthorNameParamSchema, Ot as verifyCommentUpdate, Pn as RpcEditCommunityParamSchema, Pt as getAuthorNameFromRuntime, Q as parseRawPages, Rn as RpcExportCommunityResultSchema, Rt as getCommunityAddressFromRecord, Sn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Tt as verifyCommentIpfs, Un as RpcSubscriptionIdResultSchema, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcPublishChallengeAnswersParamSchema, Vt as normalizeCommunityInputFromCommunity, Wn as RpcSuccessResultSchema, Wt as getBufferedPKCAddressFromPublicKey, X as findCommentInPageInstanceRecursively, Xn as require_undici, Xt as parseCidStringSchemaWithPKCErrorIfItFails, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as nativeFunctions$2, _n as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, at as PKCTypedEmitter, bn as parseDecryptedChallengeWithPKCErrorIfItFails, c as AddressesRewriterProxyServer, ct as signChallengeAnswer, dn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, en as parseCommentIpfsSchemaWithPKCErrorIfItFails, et as PublicationClientsManager, f as KeyvBetterSqlite3, fn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ft as signComment, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, hn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, in as parseCommunityAddressWithPKCErrorIfItFails, jn as RpcCommentRepliesPageParamSchema, jt as verifyVote, kn as RpcCancelExportParamSchema, ln as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, m as decodeRpcChallengePubsubMsg, mt as signCommentModeration, n as RpcRemoteCommunity, nn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, nt as InflightFetchManager, o as TrackedInstanceRegistry, ot as require_lib$1, p as decodeRpcChallengeAnswerPubsubMsg, pt as signCommentEdit, rn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, s as LRUCache, sn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tt as PKCClientsManager, u as RemoteCommunity, un as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ut as signChallengeRequest, v as createSigner, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, vt as signCommunityEdit, wn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, wt as verifyCommentEdit, x as encryptEd25519AesGcm, xn as parseJsonWithPKCErrorIfFails, xt as verifyChallengeMessage, y as decryptEd25519AesGcm, yn as parseDecryptedChallengeVerification, yt as signVote, zn as RpcFetchCidParamSchema, zt as getCommunityNameFromWire } from "./rpc-local-community-D4-NEPJb.js";
|
|
4
|
+
import { n as getHeliaDebugContext } from "./util-CJ6nXIW9.js";
|
|
4
5
|
import path from "path";
|
|
5
6
|
import assert from "assert";
|
|
6
7
|
import fs from "fs";
|
|
7
8
|
import Database from "better-sqlite3";
|
|
9
|
+
import { CID } from "multiformats/cid";
|
|
8
10
|
import { of } from "typestub-ipfs-only-hash";
|
|
9
11
|
import EventEmitter from "events";
|
|
10
12
|
import { Client } from "rpc-websockets";
|
|
@@ -8798,8 +8800,8 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8798
8800
|
});
|
|
8799
8801
|
this._promiseToWaitForFirstCommunitieschangeEvent = new Promise((resolve) => this.once("communitieschange", resolve));
|
|
8800
8802
|
this.clients = {};
|
|
8801
|
-
this.
|
|
8802
|
-
this.
|
|
8803
|
+
this.clients.kuboRpcClients = {};
|
|
8804
|
+
this.clients.pubsubKuboRpcClients = {};
|
|
8803
8805
|
this._initRpcClientsIfNeeded();
|
|
8804
8806
|
this._initIpfsGatewaysIfNeeded();
|
|
8805
8807
|
this._initMemCaches();
|
|
@@ -8825,11 +8827,11 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8825
8827
|
nameResolvedCache: new LRUCache({ max: 5e3 })
|
|
8826
8828
|
};
|
|
8827
8829
|
}
|
|
8828
|
-
_initKuboRpcClientsIfNeeded() {
|
|
8830
|
+
async _initKuboRpcClientsIfNeeded() {
|
|
8829
8831
|
this.clients.kuboRpcClients = {};
|
|
8830
8832
|
if (!this.kuboRpcClientsOptions) return;
|
|
8831
8833
|
for (const clientOptions of this.kuboRpcClientsOptions) {
|
|
8832
|
-
const kuboRpcClient = createKuboRpcClient(clientOptions);
|
|
8834
|
+
const kuboRpcClient = await createKuboRpcClient(clientOptions);
|
|
8833
8835
|
this.clients.kuboRpcClients[clientOptions.url.toString()] = {
|
|
8834
8836
|
_client: kuboRpcClient,
|
|
8835
8837
|
_clientOptions: clientOptions,
|
|
@@ -8839,11 +8841,11 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8839
8841
|
};
|
|
8840
8842
|
}
|
|
8841
8843
|
}
|
|
8842
|
-
_initKuboPubsubClientsIfNeeded() {
|
|
8844
|
+
async _initKuboPubsubClientsIfNeeded() {
|
|
8843
8845
|
this.clients.pubsubKuboRpcClients = {};
|
|
8844
8846
|
if (!this.pubsubKuboRpcClientsOptions) return;
|
|
8845
8847
|
for (const clientOptions of this.pubsubKuboRpcClientsOptions) {
|
|
8846
|
-
const kuboRpcClient = createKuboRpcClient(clientOptions);
|
|
8848
|
+
const kuboRpcClient = await createKuboRpcClient(clientOptions);
|
|
8847
8849
|
this.clients.pubsubKuboRpcClients[clientOptions.url.toString()] = {
|
|
8848
8850
|
_client: kuboRpcClient,
|
|
8849
8851
|
_clientOptions: clientOptions,
|
|
@@ -8861,7 +8863,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8861
8863
|
this.clients.libp2pJsClients = {};
|
|
8862
8864
|
if (!this.libp2pJsClientsOptions) return;
|
|
8863
8865
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
8864
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
8866
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-C6vMsrJ-.js");
|
|
8865
8867
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
8866
8868
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
8867
8869
|
...clientOptions,
|
|
@@ -8904,6 +8906,8 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8904
8906
|
}
|
|
8905
8907
|
async _init() {
|
|
8906
8908
|
const log = logger_default("pkc-js:pkc:_init");
|
|
8909
|
+
await this._initKuboRpcClientsIfNeeded();
|
|
8910
|
+
await this._initKuboPubsubClientsIfNeeded();
|
|
8907
8911
|
this._storage = new Storage(this);
|
|
8908
8912
|
await this._storage.init();
|
|
8909
8913
|
this._stats = new Stats({
|
|
@@ -9107,7 +9111,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
9107
9111
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
9108
9112
|
log.trace("Received community options to create a local community instance:", options);
|
|
9109
9113
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
9110
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
9114
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-BoIoFZHk.js");
|
|
9111
9115
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
9112
9116
|
const community = new LocalCommunity(this);
|
|
9113
9117
|
if (isLocalCommunity) {
|
package/dist/bundled/chunks/{rpc-local-community-CShi3R2S.js → rpc-local-community-D4-NEPJb.js}
RENAMED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
+
import { $ as pubsubTopicToDhtKey, $n as FailedToFetchCommentUpdateFromGatewaysError, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as FailedToFetchCommentIpfsFromGatewaysError, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as require_commonjs$4, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as require_retry$1, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as string, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as logger_default, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, c as ChallengeVerificationMessageSignedPropertyNames, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as boolean, en as CommunityExportRecordsSchema, er as FailedToFetchCommunityFromGatewaysError, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as custom, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as record, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as object, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as messages, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, k as doesDomainAddressHaveCapitalLetter, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as _enum, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as number, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as FailedToFetchPageIpfsFromGatewaysError, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as require_supports_color, p as DecryptedChallengeVerificationSchema, pr as literal, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as PKCError, sn as ExportCommunityModLogsOptionsSchema, sr as require_ms$1, tn as CommunityIpfsReservedFields, tr as FailedToFetchGenericIpfsFromGatewaysError, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as array, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xt as findStartedCommunity, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-SPGmy_14.js";
|
|
3
|
+
import { t as all } from "./src-CYIMjhjK.js";
|
|
2
4
|
import http from "node:http";
|
|
3
5
|
import { createHash } from "node:crypto";
|
|
4
6
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import
|
|
7
|
+
import fsp from "node:fs/promises";
|
|
6
8
|
import path from "node:path";
|
|
7
9
|
import dns from "node:dns";
|
|
8
10
|
import os from "os";
|
|
@@ -11,18 +13,18 @@ import path$1 from "path";
|
|
|
11
13
|
import assert from "assert";
|
|
12
14
|
import { Agent } from "https";
|
|
13
15
|
import { Agent as Agent$1 } from "http";
|
|
14
|
-
import { CID } from "multiformats/cid";
|
|
15
|
-
import { bases } from "multiformats/basics";
|
|
16
|
-
import { fromString } from "uint8arrays/from-string";
|
|
17
|
-
import { peerIdFromMultihash, peerIdFromPrivateKey, peerIdFromPublicKey, peerIdFromString } from "@libp2p/peer-id";
|
|
18
|
-
import https from "node:https";
|
|
19
|
-
import { toString } from "uint8arrays/to-string";
|
|
20
|
-
import { privateKeyFromProtobuf, privateKeyFromRaw, privateKeyToProtobuf, publicKeyFromRaw, publicKeyToProtobuf } from "@libp2p/crypto/keys";
|
|
21
16
|
import Database from "better-sqlite3";
|
|
17
|
+
import { CID } from "multiformats/cid";
|
|
22
18
|
import * as Digest from "multiformats/hashes/digest";
|
|
23
19
|
import { of } from "typestub-ipfs-only-hash";
|
|
24
|
-
import {
|
|
20
|
+
import { toString } from "uint8arrays/to-string";
|
|
21
|
+
import { peerIdFromMultihash, peerIdFromPrivateKey, peerIdFromPublicKey, peerIdFromString } from "@libp2p/peer-id";
|
|
22
|
+
import { privateKeyFromProtobuf, privateKeyFromRaw, privateKeyToProtobuf, publicKeyFromRaw, publicKeyToProtobuf } from "@libp2p/crypto/keys";
|
|
23
|
+
import { fromString } from "uint8arrays/from-string";
|
|
24
|
+
import { bases } from "multiformats/basics";
|
|
25
25
|
import { EventEmitter as EventEmitter$1 } from "events";
|
|
26
|
+
import { concat } from "uint8arrays/concat";
|
|
27
|
+
import https from "node:https";
|
|
26
28
|
import { performance as performance$1 } from "perf_hooks";
|
|
27
29
|
//#region node_modules/undici/lib/core/symbols.js
|
|
28
30
|
var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -88343,7 +88345,7 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88343
88345
|
//#endregion
|
|
88344
88346
|
//#region node_modules/needle/lib/needle.js
|
|
88345
88347
|
var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
88346
|
-
var fs
|
|
88348
|
+
var fs = __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();
|
|
88347
88349
|
var version = require_package$1().version;
|
|
88348
88350
|
var user_agent = "Needle/" + version;
|
|
88349
88351
|
user_agent += " (Node.js " + process.version + "; " + process.platform + " " + process.arch + ")";
|
|
@@ -88435,7 +88437,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88435
88437
|
function get_stream_length(stream, given_length, cb) {
|
|
88436
88438
|
if (given_length > 0) return cb(given_length);
|
|
88437
88439
|
if (stream.end !== void 0 && stream.end !== Infinity && stream.start !== void 0) return cb(stream.end + 1 - (stream.start || 0));
|
|
88438
|
-
fs
|
|
88440
|
+
fs.stat(stream.path, function(err, stat) {
|
|
88439
88441
|
cb(stat ? stat.size - (stream.start || 0) : null);
|
|
88440
88442
|
});
|
|
88441
88443
|
}
|
|
@@ -88698,7 +88700,7 @@ var require_needle = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88698
88700
|
if (err && err.message == "write after end") request.destroy();
|
|
88699
88701
|
});
|
|
88700
88702
|
if (config.output && resp.statusCode == 200) {
|
|
88701
|
-
var file = fs
|
|
88703
|
+
var file = fs.createWriteStream(config.output);
|
|
88702
88704
|
file.on("error", had_error);
|
|
88703
88705
|
out.on("end", function() {
|
|
88704
88706
|
if (file.writable) file.end();
|
|
@@ -98309,12 +98311,12 @@ var NameResolutionCache = class NameResolutionCache {
|
|
|
98309
98311
|
//#endregion
|
|
98310
98312
|
//#region dist/node/clients/base-client-manager.js
|
|
98311
98313
|
const createUrlFromPathResolution = (gateway, opts) => {
|
|
98312
|
-
const root = opts.recordIpfsType === "ipfs" ? CID
|
|
98314
|
+
const root = opts.recordIpfsType === "ipfs" ? CID.parse(opts.root).toV1().toString() : convertBase58IpnsNameToBase36Cid(opts.root);
|
|
98313
98315
|
return `${gateway}/${opts.recordIpfsType}/${root}${opts.path ? "/" + opts.path : ""}`;
|
|
98314
98316
|
};
|
|
98315
98317
|
const createUrlFromSubdomainResolution = (gateway, opts) => {
|
|
98316
98318
|
const gatewayUrl = new URL(gateway);
|
|
98317
|
-
const root = opts.recordIpfsType === "ipfs" ? CID
|
|
98319
|
+
const root = opts.recordIpfsType === "ipfs" ? CID.parse(opts.root).toV1().toString() : opts.recordIpfsType === "ipns" ? convertBase58IpnsNameToBase36Cid(opts.root) : opts.root;
|
|
98318
98320
|
return `${gatewayUrl.protocol}//${root}.${opts.recordIpfsType}.${gatewayUrl.host}${opts.path ? "/" + opts.path : ""}`;
|
|
98319
98321
|
};
|
|
98320
98322
|
const GATEWAYS_THAT_SUPPORT_SUBDOMAIN_RESOLUTION = {};
|
|
@@ -101683,11 +101685,12 @@ async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
|
|
|
101683
101685
|
throw error;
|
|
101684
101686
|
}
|
|
101685
101687
|
}
|
|
101686
|
-
function createKuboRpcClient(kuboRpcClientOptions) {
|
|
101688
|
+
async function createKuboRpcClient(kuboRpcClientOptions) {
|
|
101687
101689
|
logger_default("pkc-js:pkc:createKuboRpcClient").trace("Creating a new kubo client on node with options", kuboRpcClientOptions);
|
|
101690
|
+
const { create: CreateKuboRpcClient } = await import("./src-4u0f92eE.js");
|
|
101688
101691
|
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;
|
|
101689
101692
|
const onehourMs = 1e3 * 60 * 60;
|
|
101690
|
-
return
|
|
101693
|
+
return CreateKuboRpcClient({
|
|
101691
101694
|
...kuboRpcClientOptions,
|
|
101692
101695
|
agent: kuboRpcClientOptions.agent || new Agent$2({
|
|
101693
101696
|
keepAlive: true,
|
|
@@ -124882,7 +124885,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
124882
124885
|
if (!cidOfIpnsFromEtagHeader) return;
|
|
124883
124886
|
let parsedCid;
|
|
124884
124887
|
try {
|
|
124885
|
-
parsedCid = CID
|
|
124888
|
+
parsedCid = CID.parse(cidOfIpnsFromEtagHeader.replace(/^W\//, "").split("\"").join("")).toV0().toString();
|
|
124886
124889
|
} catch (e) {
|
|
124887
124890
|
return;
|
|
124888
124891
|
}
|
|
@@ -125001,7 +125004,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125001
125004
|
if (isIpfsPath(value)) {
|
|
125002
125005
|
let terminalCidV0;
|
|
125003
125006
|
try {
|
|
125004
|
-
terminalCidV0 = CID
|
|
125007
|
+
terminalCidV0 = CID.parse(value.split("/")[2]).toV0().toString();
|
|
125005
125008
|
} catch (e) {
|
|
125006
125009
|
throw new PKCError("ERR_GATEWAY_IPNS_RECORD_CHAIN_INVALID", {
|
|
125007
125010
|
reason: "Terminal IPNS record value is not a valid CID",
|
|
@@ -125597,7 +125600,7 @@ var AddressRewriterDatabase = class {
|
|
|
125597
125600
|
async initialize() {
|
|
125598
125601
|
try {
|
|
125599
125602
|
const dbDir = path.dirname(this._dbPath);
|
|
125600
|
-
await
|
|
125603
|
+
await fsp.mkdir(dbDir, { recursive: true });
|
|
125601
125604
|
this._db = new Database(this._dbPath);
|
|
125602
125605
|
this._db.exec(`
|
|
125603
125606
|
CREATE TABLE IF NOT EXISTS request_logs (
|