@pkcprotocol/pkc-js 0.0.73 → 0.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/dist/browser/clients/base-client-manager.d.ts +1 -0
- package/dist/browser/clients/base-client-manager.js +9 -2
- package/dist/browser/clients/base-client-manager.js.map +1 -1
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -0
- package/dist/browser/clients/rpc-client/schema.d.ts +1 -0
- package/dist/browser/community/community-client-manager.d.ts +1 -0
- package/dist/browser/community/community-client-manager.js +7 -0
- package/dist/browser/community/community-client-manager.js.map +1 -1
- package/dist/browser/community/remote-community.js +18 -9
- package/dist/browser/community/remote-community.js.map +1 -1
- package/dist/browser/community/schema.d.ts +6 -0
- package/dist/browser/community/schema.js +4 -1
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/community/types.d.ts +1 -0
- package/dist/browser/errors.d.ts +2 -0
- package/dist/browser/errors.js +2 -0
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/helia/helia-for-pkc.d.ts +1 -1
- package/dist/browser/helia/helia-for-pkc.js +41 -5
- package/dist/browser/helia/helia-for-pkc.js.map +1 -1
- package/dist/browser/helia/lru-blockstore.d.ts +92 -0
- package/dist/browser/helia/lru-blockstore.js +224 -0
- package/dist/browser/helia/lru-blockstore.js.map +1 -0
- package/dist/browser/pkc/pkc.js +4 -1
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/publications/community-edit/schema.d.ts +4 -0
- package/dist/browser/publications/publication.d.ts +2 -1
- package/dist/browser/publications/publication.js +63 -24
- package/dist/browser/publications/publication.js.map +1 -1
- package/dist/browser/pubsub-messages/schema.d.ts +2 -0
- package/dist/browser/rpc/src/schema.d.ts +16 -0
- package/dist/browser/runtime/browser/blockstore.d.ts +25 -0
- package/dist/browser/runtime/browser/blockstore.js +40 -0
- package/dist/browser/runtime/browser/blockstore.js.map +1 -0
- package/dist/browser/runtime/node/blockstore.d.ts +32 -0
- package/dist/browser/runtime/node/blockstore.js +42 -0
- package/dist/browser/runtime/node/blockstore.js.map +1 -0
- package/dist/browser/runtime/node/community/db-handler.d.ts +1 -0
- package/dist/browser/runtime/node/community/local-community/challenges.js +26 -25
- package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/comment-updates.d.ts +2 -1
- package/dist/browser/runtime/node/community/local-community/comment-updates.js +14 -2
- package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/db-state.js +12 -1
- package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +22 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/lifecycle.js +17 -5
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js +42 -4
- package/dist/browser/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community.d.ts +1 -0
- package/dist/browser/runtime/node/community/local-community.js +10 -1
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +4 -0
- package/dist/browser/schema.d.ts +20 -0
- package/dist/browser/schema.js +11 -1
- package/dist/browser/schema.js.map +1 -1
- package/dist/browser/signer/signatures.d.ts +4 -4
- package/dist/browser/signer/signatures.js +23 -4
- package/dist/browser/signer/signatures.js.map +1 -1
- package/dist/browser/test/test-util.d.ts +3 -0
- package/dist/browser/test/test-util.js +15 -1
- package/dist/browser/test/test-util.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +201 -94
- package/dist/bundled/chunks/helia-for-pkc-BPj1zAUb.js +6915 -0
- package/dist/bundled/chunks/{local-community-EFv2VpQI.js → local-community-ChTkd8lH.js} +1 -1
- package/dist/bundled/chunks/{local-community-DLVCXKMM.js → local-community-D4efR9XJ.js} +92 -55
- package/dist/bundled/chunks/{node-Dpuw7iSW.js → node-BK6GBM0d.js} +55 -28
- package/dist/bundled/chunks/{rpc-local-community-8CqOzaX3.js → rpc-local-community-O94vseOA.js} +45 -34
- package/dist/bundled/chunks/{schema-DMHTAMSM.js → schema-wNdSno5O.js} +11 -4
- package/dist/bundled/chunks/{src-o_MYSn-E.js → src-B2CwDTfy.js} +2 -142
- package/dist/bundled/chunks/{src-4u0f92eE.js → src-BKg5Lhod.js} +2 -127
- package/dist/bundled/chunks/src-Cpx2Sts8.js +127 -0
- package/dist/bundled/chunks/src-DKntVmyX.js +142 -0
- package/dist/bundled/chunks/{util-hdyyy-HI.js → util-iNnH2bP5.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/clients/base-client-manager.d.ts +1 -0
- package/dist/node/clients/base-client-manager.js +9 -2
- package/dist/node/clients/base-client-manager.js.map +1 -1
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -0
- package/dist/node/clients/rpc-client/schema.d.ts +1 -0
- package/dist/node/community/community-client-manager.d.ts +1 -0
- package/dist/node/community/community-client-manager.js +7 -0
- package/dist/node/community/community-client-manager.js.map +1 -1
- package/dist/node/community/remote-community.js +18 -9
- package/dist/node/community/remote-community.js.map +1 -1
- package/dist/node/community/schema.d.ts +6 -0
- package/dist/node/community/schema.js +4 -1
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/community/types.d.ts +1 -0
- package/dist/node/errors.d.ts +2 -0
- package/dist/node/errors.js +2 -0
- package/dist/node/errors.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/helia/helia-for-pkc.d.ts +1 -1
- package/dist/node/helia/helia-for-pkc.js +41 -5
- package/dist/node/helia/helia-for-pkc.js.map +1 -1
- package/dist/node/helia/lru-blockstore.d.ts +92 -0
- package/dist/node/helia/lru-blockstore.js +224 -0
- package/dist/node/helia/lru-blockstore.js.map +1 -0
- package/dist/node/pkc/pkc.js +4 -1
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/publications/community-edit/schema.d.ts +4 -0
- package/dist/node/publications/publication.d.ts +2 -1
- package/dist/node/publications/publication.js +63 -24
- package/dist/node/publications/publication.js.map +1 -1
- package/dist/node/pubsub-messages/schema.d.ts +2 -0
- package/dist/node/rpc/src/schema.d.ts +16 -0
- package/dist/node/runtime/browser/blockstore.d.ts +25 -0
- package/dist/node/runtime/browser/blockstore.js +40 -0
- package/dist/node/runtime/browser/blockstore.js.map +1 -0
- package/dist/node/runtime/node/blockstore.d.ts +32 -0
- package/dist/node/runtime/node/blockstore.js +42 -0
- package/dist/node/runtime/node/blockstore.js.map +1 -0
- package/dist/node/runtime/node/community/db-handler.d.ts +1 -0
- package/dist/node/runtime/node/community/local-community/challenges.js +26 -25
- package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/comment-updates.d.ts +2 -1
- package/dist/node/runtime/node/community/local-community/comment-updates.js +14 -2
- package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/db-state.js +12 -1
- package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js +22 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/lifecycle.js +17 -5
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js +42 -4
- package/dist/node/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/node/runtime/node/community/local-community.d.ts +1 -0
- package/dist/node/runtime/node/community/local-community.js +10 -1
- package/dist/node/runtime/node/community/local-community.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +4 -0
- package/dist/node/schema.d.ts +20 -0
- package/dist/node/schema.js +11 -1
- package/dist/node/schema.js.map +1 -1
- package/dist/node/signer/signatures.d.ts +4 -4
- package/dist/node/signer/signatures.js +23 -4
- package/dist/node/signer/signatures.js.map +1 -1
- package/dist/node/test/test-util.d.ts +3 -0
- package/dist/node/test/test-util.js +15 -1
- package/dist/node/test/test-util.js.map +1 -1
- package/package.json +8 -5
- package/dist/bundled/chunks/helia-for-pkc-DooZDxJi.js +0 -495
package/dist/bundled/chunks/{rpc-local-community-8CqOzaX3.js → rpc-local-community-O94vseOA.js}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, 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 n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-
|
|
2
|
+
import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, 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 n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-wNdSno5O.js";
|
|
3
3
|
import { t as all } from "./src-CYIMjhjK.js";
|
|
4
4
|
import http from "node:http";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import fsp from "node:fs/promises";
|
|
8
|
-
import
|
|
8
|
+
import path from "node:path";
|
|
9
9
|
import dns from "node:dns";
|
|
10
10
|
import os from "os";
|
|
11
11
|
import { closeSync, createReadStream, existsSync, openSync, promises, readSync, readdirSync, rm, watch } from "node:fs";
|
|
12
|
-
import path from "path";
|
|
12
|
+
import path$1 from "path";
|
|
13
13
|
import assert from "assert";
|
|
14
14
|
import { Agent } from "https";
|
|
15
15
|
import { Agent as Agent$1 } from "http";
|
|
@@ -11928,8 +11928,8 @@ var require_snapshot_utils = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
11928
11928
|
//#endregion
|
|
11929
11929
|
//#region node_modules/undici/lib/mock/snapshot-recorder.js
|
|
11930
11930
|
var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11931
|
-
const { writeFile, readFile: readFile$1, mkdir } = __require("node:fs/promises");
|
|
11932
|
-
const { dirname, resolve } = __require("node:path");
|
|
11931
|
+
const { writeFile: writeFile$1, readFile: readFile$1, mkdir } = __require("node:fs/promises");
|
|
11932
|
+
const { dirname: dirname$1, resolve } = __require("node:path");
|
|
11933
11933
|
const { setTimeout: setTimeout$1, clearTimeout: clearTimeout$1 } = __require("node:timers");
|
|
11934
11934
|
const { InvalidArgumentError, UndiciError } = require_errors();
|
|
11935
11935
|
const { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -12215,12 +12215,12 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
12215
12215
|
const path = filePath || this.#snapshotPath;
|
|
12216
12216
|
if (!path) throw new InvalidArgumentError("Snapshot path is required");
|
|
12217
12217
|
const resolvedPath = resolve(path);
|
|
12218
|
-
await mkdir(dirname(resolvedPath), { recursive: true });
|
|
12218
|
+
await mkdir(dirname$1(resolvedPath), { recursive: true });
|
|
12219
12219
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
12220
12220
|
hash,
|
|
12221
12221
|
snapshot
|
|
12222
12222
|
}));
|
|
12223
|
-
await writeFile(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
12223
|
+
await writeFile$1(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
12224
12224
|
}
|
|
12225
12225
|
/**
|
|
12226
12226
|
* Clears all recorded snapshots
|
|
@@ -78248,7 +78248,7 @@ var require_querystring = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
78248
78248
|
//#endregion
|
|
78249
78249
|
//#region node_modules/needle/lib/multipart.js
|
|
78250
78250
|
var require_multipart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
78251
|
-
var readFile = __require("fs").readFile, basename = __require("path").basename;
|
|
78251
|
+
var readFile = __require("fs").readFile, basename$1 = __require("path").basename;
|
|
78252
78252
|
exports.build = function(data, boundary, callback) {
|
|
78253
78253
|
if (typeof data != "object" || typeof data.pipe == "function") return callback(/* @__PURE__ */ new Error("Multipart builder expects data as key/val object."));
|
|
78254
78254
|
var body = "", object = flatten(data), count = Object.keys(object).length;
|
|
@@ -78287,7 +78287,7 @@ var require_multipart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
78287
78287
|
callback(null, return_part + "\r\n");
|
|
78288
78288
|
}
|
|
78289
78289
|
if ((part.file || part.buffer) && part.content_type) {
|
|
78290
|
-
var filename = part.filename ? part.filename : part.file ? basename(part.file) : name;
|
|
78290
|
+
var filename = part.filename ? part.filename : part.file ? basename$1(part.file) : name;
|
|
78291
78291
|
if (part.buffer) return append(part.buffer, filename);
|
|
78292
78292
|
readFile(part.file, function(err, data) {
|
|
78293
78293
|
if (err) return callback(err);
|
|
@@ -97854,6 +97854,10 @@ async function verifyCommunity({ community, communityIpnsName, resolveAuthorName
|
|
|
97854
97854
|
valid: false,
|
|
97855
97855
|
reason: messages.ERR_COMMUNITY_IPNS_NAME_DOES_NOT_MATCH_SIGNATURE_PUBLIC_KEY
|
|
97856
97856
|
};
|
|
97857
|
+
if (!getPeerIdFromPublicKey(community.encryption.publicKey).equals(signaturePeerId)) return {
|
|
97858
|
+
valid: false,
|
|
97859
|
+
reason: messages.ERR_COMMUNITY_ENCRYPTION_PUBLIC_KEY_DOES_NOT_MATCH_SIGNATURE_PUBLIC_KEY
|
|
97860
|
+
};
|
|
97857
97861
|
clientsManager._pkc._memCaches.communityVerificationCache.set(cacheKey, true);
|
|
97858
97862
|
return { valid: true };
|
|
97859
97863
|
}
|
|
@@ -97962,12 +97966,12 @@ async function verifyChallengeRequest({ request, validateTimestampRange }) {
|
|
|
97962
97966
|
};
|
|
97963
97967
|
return _validateSignatureOfPubsubMsg(request);
|
|
97964
97968
|
}
|
|
97965
|
-
async function verifyChallengeMessage({ challenge,
|
|
97969
|
+
async function verifyChallengeMessage({ challenge, communityChallengeSignerAddress, validateTimestampRange }) {
|
|
97966
97970
|
if (!_allFieldsOfRecordInSignedPropertyNames(challenge)) return {
|
|
97967
97971
|
valid: false,
|
|
97968
97972
|
reason: messages.ERR_CHALLENGE_INCLUDES_FIELD_NOT_IN_SIGNED_PROPERTY_NAMES
|
|
97969
97973
|
};
|
|
97970
|
-
if (await getPKCAddressFromPublicKeyBuffer(challenge.signature.publicKey) !==
|
|
97974
|
+
if (await getPKCAddressFromPublicKeyBuffer(challenge.signature.publicKey) !== communityChallengeSignerAddress) return {
|
|
97971
97975
|
valid: false,
|
|
97972
97976
|
reason: messages.ERR_CHALLENGE_MSG_SIGNER_IS_NOT_COMMUNITY
|
|
97973
97977
|
};
|
|
@@ -97990,12 +97994,12 @@ async function verifyChallengeAnswer({ answer, validateTimestampRange }) {
|
|
|
97990
97994
|
};
|
|
97991
97995
|
return _validateSignatureOfPubsubMsg(answer);
|
|
97992
97996
|
}
|
|
97993
|
-
async function verifyChallengeVerification({ verification,
|
|
97997
|
+
async function verifyChallengeVerification({ verification, communityChallengeSignerAddress, validateTimestampRange }) {
|
|
97994
97998
|
if (!_allFieldsOfRecordInSignedPropertyNames(verification)) return {
|
|
97995
97999
|
valid: false,
|
|
97996
98000
|
reason: messages.ERR_CHALLENGE_VERIFICATION_INCLUDES_FIELD_NOT_IN_SIGNED_PROPERTY_NAMES
|
|
97997
98001
|
};
|
|
97998
|
-
if (await getPKCAddressFromPublicKeyBuffer(verification.signature.publicKey) !==
|
|
98002
|
+
if (await getPKCAddressFromPublicKeyBuffer(verification.signature.publicKey) !== communityChallengeSignerAddress) return {
|
|
97999
98003
|
valid: false,
|
|
98000
98004
|
reason: messages.ERR_CHALLENGE_VERIFICATION_MSG_SIGNER_IS_NOT_COMMUNITY
|
|
98001
98005
|
};
|
|
@@ -98603,10 +98607,14 @@ var BaseClientsManager = class BaseClientsManager {
|
|
|
98603
98607
|
});
|
|
98604
98608
|
}
|
|
98605
98609
|
getDefaultKuboPubsubClient() {
|
|
98606
|
-
const defaultKuboPubsubClient =
|
|
98607
|
-
if (defaultKuboPubsubClient) return
|
|
98610
|
+
const defaultKuboPubsubClient = this.getDefaultKuboPubsubClientIfAny();
|
|
98611
|
+
if (defaultKuboPubsubClient) return defaultKuboPubsubClient;
|
|
98608
98612
|
throw new PKCError("ERR_NO_DEFAULT_KUBO_RPC_PUBSUB_PROVIDER", { pubsubKuboRpcClients: this._pkc.clients.pubsubKuboRpcClients });
|
|
98609
98613
|
}
|
|
98614
|
+
getDefaultKuboPubsubClientIfAny() {
|
|
98615
|
+
const defaultKuboPubsubClient = t$13(this._pkc.clients.pubsubKuboRpcClients)[0];
|
|
98616
|
+
return defaultKuboPubsubClient ? this._pkc.clients.pubsubKuboRpcClients[defaultKuboPubsubClient] : void 0;
|
|
98617
|
+
}
|
|
98610
98618
|
getIpfsClientWithKuboRpcClientFunctions() {
|
|
98611
98619
|
const defaultKuboRpcClient = t$13(this._pkc.clients.kuboRpcClients)[0];
|
|
98612
98620
|
if (defaultKuboRpcClient) return this._pkc.clients.kuboRpcClients[defaultKuboRpcClient]._client;
|
|
@@ -101592,14 +101600,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
|
|
|
101592
101600
|
};
|
|
101593
101601
|
//#endregion
|
|
101594
101602
|
//#region dist/node/runtime/node/util.js
|
|
101595
|
-
const getDefaultDataPath = () => path.join(process.cwd(), ".pkc");
|
|
101603
|
+
const getDefaultDataPath = () => path$1.join(process.cwd(), ".pkc");
|
|
101596
101604
|
const getDefaultCommunityDbConfig = async (communityAddress, pkc) => {
|
|
101597
101605
|
let filename;
|
|
101598
101606
|
if (pkc.noData) filename = ":memory:";
|
|
101599
101607
|
else {
|
|
101600
101608
|
assert(typeof pkc.dataPath === "string", "pkc.dataPath need to be defined to get default community db config");
|
|
101601
|
-
filename = path.join(pkc.dataPath, "communities", communityAddress);
|
|
101602
|
-
await promises.mkdir(path.dirname(filename), { recursive: true });
|
|
101609
|
+
filename = path$1.join(pkc.dataPath, "communities", communityAddress);
|
|
101610
|
+
await promises.mkdir(path$1.dirname(filename), { recursive: true });
|
|
101603
101611
|
}
|
|
101604
101612
|
return {
|
|
101605
101613
|
filename,
|
|
@@ -101698,7 +101706,7 @@ const setNativeFunctions = (newNativeFunctions) => {
|
|
|
101698
101706
|
};
|
|
101699
101707
|
const deleteOldCommunityInWindows = async (subPath, pkc) => {
|
|
101700
101708
|
const log = logger_default("pkc-js:community:deleteStaleCommunityInWindows");
|
|
101701
|
-
const communityAddress = path.basename(subPath);
|
|
101709
|
+
const communityAddress = path$1.basename(subPath);
|
|
101702
101710
|
await new Promise((resolve) => setTimeout(resolve, 1e4));
|
|
101703
101711
|
try {
|
|
101704
101712
|
await promises.rm(subPath, { force: true });
|
|
@@ -101722,7 +101730,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
|
|
|
101722
101730
|
}
|
|
101723
101731
|
const communitiesThatWereDeletedSuccessfully = [];
|
|
101724
101732
|
for (const communityAddress of deletedPersistentCommunities) {
|
|
101725
|
-
const communityPath = path.join(pkc.dataPath, "communities", communityAddress);
|
|
101733
|
+
const communityPath = path$1.join(pkc.dataPath, "communities", communityAddress);
|
|
101726
101734
|
try {
|
|
101727
101735
|
await promises.rm(communityPath, { force: true });
|
|
101728
101736
|
log(`Succeeded in deleting old db path (${communityAddress})`);
|
|
@@ -101746,7 +101754,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
|
|
|
101746
101754
|
function listCommunitiesSync(pkc) {
|
|
101747
101755
|
logger_default("pkc-js:listCommunitiesSync");
|
|
101748
101756
|
if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath needs to be defined to listCommunities");
|
|
101749
|
-
const communitiesPath = path.join(pkc.dataPath, "communities");
|
|
101757
|
+
const communitiesPath = path$1.join(pkc.dataPath, "communities");
|
|
101750
101758
|
const files = readdirSync(communitiesPath, {
|
|
101751
101759
|
recursive: false,
|
|
101752
101760
|
withFileTypes: false
|
|
@@ -101754,7 +101762,7 @@ function listCommunitiesSync(pkc) {
|
|
|
101754
101762
|
const communityFilesWeDontNeedToCheck = pkc.communities ? files.filter((address) => pkc.communities.includes(address)) : [];
|
|
101755
101763
|
const sqliteFiles = files.filter((address) => !communityFilesWeDontNeedToCheck.includes(address)).filter((address) => {
|
|
101756
101764
|
try {
|
|
101757
|
-
const filePath = path.join(communitiesPath, address);
|
|
101765
|
+
const filePath = path$1.join(communitiesPath, address);
|
|
101758
101766
|
if (!existsSync(filePath)) return false;
|
|
101759
101767
|
const fd = openSync(filePath, "r");
|
|
101760
101768
|
const buffer = Buffer.alloc(16);
|
|
@@ -101835,7 +101843,7 @@ var BackupAbortError = class extends Error {
|
|
|
101835
101843
|
async function backupCommunityDb(opts) {
|
|
101836
101844
|
const { sourcePath, destPath, includePrivateKey, onProgress, signal } = opts;
|
|
101837
101845
|
if (signal?.aborted) throw new BackupAbortError();
|
|
101838
|
-
await promises.mkdir(path.dirname(destPath), { recursive: true });
|
|
101846
|
+
await promises.mkdir(path$1.dirname(destPath), { recursive: true });
|
|
101839
101847
|
const partialPath = destPath + ".partial";
|
|
101840
101848
|
try {
|
|
101841
101849
|
await promises.unlink(partialPath);
|
|
@@ -101919,9 +101927,9 @@ async function statAndHashFile(filePath) {
|
|
|
101919
101927
|
}
|
|
101920
101928
|
async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
|
|
101921
101929
|
if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath is not defined");
|
|
101922
|
-
const oldPath = path.join(pkc.dataPath, "communities", communityAddress);
|
|
101923
|
-
const newPath = path.join(pkc.dataPath, "communities", "deleted", communityAddress);
|
|
101924
|
-
await promises.mkdir(path.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
|
|
101930
|
+
const oldPath = path$1.join(pkc.dataPath, "communities", communityAddress);
|
|
101931
|
+
const newPath = path$1.join(pkc.dataPath, "communities", "deleted", communityAddress);
|
|
101932
|
+
await promises.mkdir(path$1.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
|
|
101925
101933
|
if (!existsSync(oldPath)) throw Error(`Source database ${oldPath} does not exist`);
|
|
101926
101934
|
try {
|
|
101927
101935
|
const sourceDb = new Database(oldPath, { fileMustExist: true });
|
|
@@ -101942,7 +101950,7 @@ async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
|
|
|
101942
101950
|
}
|
|
101943
101951
|
async function createKuboRpcClient(kuboRpcClientOptions) {
|
|
101944
101952
|
logger_default("pkc-js:pkc:createKuboRpcClient").trace("Creating a new kubo client on node with options", kuboRpcClientOptions);
|
|
101945
|
-
const { create: CreateKuboRpcClient } = await import("./src-
|
|
101953
|
+
const { create: CreateKuboRpcClient } = await import("./src-BKg5Lhod.js");
|
|
101946
101954
|
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;
|
|
101947
101955
|
const onehourMs = 1e3 * 60 * 60;
|
|
101948
101956
|
return CreateKuboRpcClient({
|
|
@@ -101957,7 +101965,7 @@ async function createKuboRpcClient(kuboRpcClientOptions) {
|
|
|
101957
101965
|
}
|
|
101958
101966
|
async function monitorCommunitiesDirectory(pkc) {
|
|
101959
101967
|
const watchAbortController = new AbortController();
|
|
101960
|
-
const communitiesPath = path.join(pkc.dataPath, "communities");
|
|
101968
|
+
const communitiesPath = path$1.join(pkc.dataPath, "communities");
|
|
101961
101969
|
await promises.mkdir(communitiesPath, { recursive: true });
|
|
101962
101970
|
const extensionsToIgnore = [
|
|
101963
101971
|
".lock",
|
|
@@ -124735,6 +124743,10 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
124735
124743
|
updateKuboRpcPubsubState(newState, pubsubProvider) {
|
|
124736
124744
|
super.updateKuboRpcPubsubState(newState, pubsubProvider);
|
|
124737
124745
|
}
|
|
124746
|
+
updateKuboRpcPubsubStateIfProviderExists(newState) {
|
|
124747
|
+
const pubsubClient = this.getDefaultKuboPubsubClientIfAny();
|
|
124748
|
+
if (pubsubClient) this.updateKuboRpcPubsubState(newState, pubsubClient.url);
|
|
124749
|
+
}
|
|
124738
124750
|
updateGatewayState(newState, gateway) {
|
|
124739
124751
|
super.updateGatewayState(newState, gateway);
|
|
124740
124752
|
}
|
|
@@ -125488,6 +125500,7 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125488
125500
|
const log = logger_default("pkc-js:remote-community:initCommunityIpfsPropsNoMerge");
|
|
125489
125501
|
this.raw.communityIpfs = newProps;
|
|
125490
125502
|
this.initRemoteCommunityPropsNoMerge(newProps);
|
|
125503
|
+
this.pubsubTopicRoutingCid = newProps.pubsubTopic ? pubsubTopicToDhtKey(newProps.pubsubTopic) : void 0;
|
|
125491
125504
|
const unknownProps = r$8(t$13(this.raw.communityIpfs), t$13(CommunityIpfsSchema.shape));
|
|
125492
125505
|
if (unknownProps.length > 0) {
|
|
125493
125506
|
log(`Found unknown props on community (${this.address}) ipfs record`, unknownProps);
|
|
@@ -125513,10 +125526,7 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125513
125526
|
this.ipnsPubsubTopic = ipnsNameToIpnsOverPubsubTopic(this.ipnsName);
|
|
125514
125527
|
this.ipnsPubsubTopicRoutingCid = pubsubTopicToDhtKey(this.ipnsPubsubTopic);
|
|
125515
125528
|
}
|
|
125516
|
-
if (!this.pubsubTopicRoutingCid)
|
|
125517
|
-
if ("pubsubTopicRoutingCid" in newProps) this.pubsubTopicRoutingCid = newProps.pubsubTopicRoutingCid;
|
|
125518
|
-
else if (this.raw.communityIpfs) this.pubsubTopicRoutingCid = pubsubTopicToDhtKey(newProps.pubsubTopic || this.pubsubTopic || ("address" in newProps ? newProps.address : void 0) || this.address);
|
|
125519
|
-
}
|
|
125529
|
+
if (!this.pubsubTopicRoutingCid && "pubsubTopicRoutingCid" in newProps) this.pubsubTopicRoutingCid = newProps.pubsubTopicRoutingCid;
|
|
125520
125530
|
}
|
|
125521
125531
|
initRemoteCommunityPropsNoMerge(newProps) {
|
|
125522
125532
|
const incomingIpnsHops = newProps.ipnsHops;
|
|
@@ -125584,6 +125594,7 @@ var RemoteCommunity = class extends import_lib$1.TypedEmitter {
|
|
|
125584
125594
|
this.raw.communityIpfs = void 0;
|
|
125585
125595
|
this.updateCid = void 0;
|
|
125586
125596
|
this.initRemoteCommunityPropsNoMerge({});
|
|
125597
|
+
this.pubsubTopicRoutingCid = void 0;
|
|
125587
125598
|
this.publicKey = newPublicKey;
|
|
125588
125599
|
this.ipnsName = newPublicKey;
|
|
125589
125600
|
this.ipnsPubsubTopic = ipnsNameToIpnsOverPubsubTopic(newPublicKey);
|
|
@@ -125857,11 +125868,11 @@ var AddressRewriterDatabase = class {
|
|
|
125857
125868
|
if (kuboConfig && typeof kuboConfig === "object" && "host" in kuboConfig && "port" in kuboConfig) kuboIdentifier = `${kuboConfig.host}_${kuboConfig.port}`;
|
|
125858
125869
|
const proxyIdentifier = `${proxyTarget.hostname}_${proxyTarget.port || (proxyTarget.protocol === "https:" ? "443" : "80")}`;
|
|
125859
125870
|
const fileName = `address_rewriter_${kuboIdentifier}_${proxyIdentifier}.db`;
|
|
125860
|
-
return
|
|
125871
|
+
return path.join(dataPath, ".address-rewriter", fileName);
|
|
125861
125872
|
}
|
|
125862
125873
|
async initialize() {
|
|
125863
125874
|
try {
|
|
125864
|
-
const dbDir =
|
|
125875
|
+
const dbDir = path.dirname(this._dbPath);
|
|
125865
125876
|
await fsp.mkdir(dbDir, { recursive: true });
|
|
125866
125877
|
this._db = new Database(this._dbPath);
|
|
125867
125878
|
this._db.exec(`
|
|
@@ -5136,6 +5136,7 @@ var messages;
|
|
|
5136
5136
|
messages["ERR_COMMUNITY_CAN_EITHER_RUN_OR_UPDATE"] = "Community can either sync through .start() or update, but not both";
|
|
5137
5137
|
messages["ERR_PUBLICATION_MISSING_FIELD"] = "Publication is missing field(s)";
|
|
5138
5138
|
messages["ERR_COMMUNITY_MISSING_FIELD"] = "Community is missing field needed for publishing";
|
|
5139
|
+
messages["ERR_COMMUNITY_CHALLENGE_EXCHANGE_DISABLED"] = "The community record has no pubsubTopic, which means its challenge exchange is disabled and it does not accept publications over pubsub";
|
|
5139
5140
|
messages["ERR_COMMUNITY_OPTIONS_MISSING_ADDRESS"] = "The options sent to pkc.createCommunity() is missing address or signer";
|
|
5140
5141
|
messages["ERR_INVALID_COMMUNITY_ADDRESS_SCHEMA"] = "Community address is incorrect. Address should be either a domain or IPNS";
|
|
5141
5142
|
messages["ERR_CID_IS_INVALID"] = "CID is invalid";
|
|
@@ -5284,6 +5285,7 @@ var messages;
|
|
|
5284
5285
|
messages["ERR_AUTHOR_NOT_MATCHING_SIGNATURE"] = "comment.author.address doesn't match comment.signature.publicKey";
|
|
5285
5286
|
messages["ERR_AUTHOR_NAME_MUST_BE_A_DOMAIN"] = "author.name must be a domain name (e.g. 'example.bso')";
|
|
5286
5287
|
messages["ERR_COMMUNITY_IPNS_NAME_DOES_NOT_MATCH_SIGNATURE_PUBLIC_KEY"] = "The IPNS name of community doesn't match community.signature.publicKey";
|
|
5288
|
+
messages["ERR_COMMUNITY_ENCRYPTION_PUBLIC_KEY_DOES_NOT_MATCH_SIGNATURE_PUBLIC_KEY"] = "community.encryption.publicKey doesn't match community.signature.publicKey. The key that runs the challenge exchange must be the key that signed the record";
|
|
5287
5289
|
messages["ERR_COMMENT_SHOULD_BE_THE_LATEST_EDIT"] = "comment.content is not set to the latest comment.authorEdit.content";
|
|
5288
5290
|
messages["ERR_COMMENT_UPDATE_IS_NOT_SIGNED_BY_COMMUNITY"] = "Comment update is not signed by the community";
|
|
5289
5291
|
messages["ERR_AUTHOR_EDIT_IS_NOT_SIGNED_BY_AUTHOR"] = "Author edit is not signed by original author of comment";
|
|
@@ -6687,7 +6689,8 @@ const CommunitySettingsSchema = object({
|
|
|
6687
6689
|
fetchThumbnailUrlsProxyUrl: string().optional(),
|
|
6688
6690
|
challenges: CommunityChallengeSettingSchema.array().optional(),
|
|
6689
6691
|
maxPendingApprovalCount: number().int().nonnegative().optional(),
|
|
6690
|
-
purgeDisapprovedCommentsOlderThan: number().int().nonnegative().optional()
|
|
6692
|
+
purgeDisapprovedCommentsOlderThan: number().int().nonnegative().optional(),
|
|
6693
|
+
disablePubsubChallengeExchange: boolean().optional()
|
|
6691
6694
|
}).strict();
|
|
6692
6695
|
const CommunityRolesToEditSchema = record(AuthorAddressSchema, CommunityRoleSchema.or(_undefined()));
|
|
6693
6696
|
const CommunityEditOptionsSchema = CommunityIpfsSchema.pick({
|
|
@@ -15994,7 +15997,7 @@ async function fetchAndValidateIpnsRecordFromGateway(gatewayUrl, ipnsName, opts)
|
|
|
15994
15997
|
const textEncoder = new TextEncoder();
|
|
15995
15998
|
async function calculateStringSizeSameAsIpfsAddCidV0(content) {
|
|
15996
15999
|
const { MemoryBlockstore } = await import("blockstore-core");
|
|
15997
|
-
const { importFile } = await import("./src-
|
|
16000
|
+
const { importFile } = await import("./src-B2CwDTfy.js");
|
|
15998
16001
|
const blockstore = new MemoryBlockstore();
|
|
15999
16002
|
const entry = await importFile({
|
|
16000
16003
|
path: "content.json",
|
|
@@ -16032,7 +16035,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
|
|
|
16032
16035
|
}
|
|
16033
16036
|
//#endregion
|
|
16034
16037
|
//#region dist/node/generated-version.js
|
|
16035
|
-
const version = "0.0.
|
|
16038
|
+
const version = "0.0.75";
|
|
16036
16039
|
//#endregion
|
|
16037
16040
|
//#region dist/node/version.js
|
|
16038
16041
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
@@ -16073,7 +16076,11 @@ const PKCUserOptionBaseSchema = object({
|
|
|
16073
16076
|
libp2pJsClientsOptions: object({
|
|
16074
16077
|
key: string().min(1),
|
|
16075
16078
|
libp2pOptions: custom().default({}),
|
|
16076
|
-
heliaOptions: custom().default({})
|
|
16079
|
+
heliaOptions: custom().default({}),
|
|
16080
|
+
blockstoreOptions: object({
|
|
16081
|
+
maxBytes: number().positive().optional(),
|
|
16082
|
+
lowWaterRatio: number().gt(0).lte(1).optional()
|
|
16083
|
+
}).optional()
|
|
16077
16084
|
}).array().max(1, "Only one libp2pJsClientOptions is allowed at the moment").optional(),
|
|
16078
16085
|
validatePages: boolean(),
|
|
16079
16086
|
userAgent: UserAgentSchema,
|
|
@@ -1,156 +1,16 @@
|
|
|
1
1
|
import { i as __toESM, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
+
import { n as batch, t as parallelBatch } from "./src-DKntVmyX.js";
|
|
2
3
|
import { i as first, n as src_exports, r as prepare, t as encode } from "./src-BOzgM7Fp.js";
|
|
3
4
|
import { CID } from "multiformats/cid";
|
|
4
5
|
import { fromString } from "uint8arrays/from-string";
|
|
5
6
|
import { concat } from "uint8arrays/concat";
|
|
6
7
|
import { equals } from "uint8arrays/equals";
|
|
8
|
+
import * as raw from "multiformats/codecs/raw";
|
|
7
9
|
import { alloc, allocUnsafe } from "uint8arrays/alloc";
|
|
8
10
|
import { withArrayBuffer } from "uint8arrays/with-array-buffer";
|
|
9
|
-
import * as raw from "multiformats/codecs/raw";
|
|
10
11
|
import { sha256 } from "multiformats/hashes/sha2";
|
|
11
12
|
import { murmur3128 } from "@multiformats/murmur3";
|
|
12
13
|
import { BlackHoleBlockstore } from "blockstore-core/black-hole";
|
|
13
|
-
//#region node_modules/it-batch/dist/src/index.js
|
|
14
|
-
/**
|
|
15
|
-
* @packageDocumentation
|
|
16
|
-
*
|
|
17
|
-
* The final batch may be smaller than the max.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* ```javascript
|
|
22
|
-
* import batch from 'it-batch'
|
|
23
|
-
* import all from 'it-all'
|
|
24
|
-
*
|
|
25
|
-
* // This can also be an iterator, generator, etc
|
|
26
|
-
* const values = [0, 1, 2, 3, 4]
|
|
27
|
-
* const batchSize = 2
|
|
28
|
-
*
|
|
29
|
-
* const result = all(batch(values, batchSize))
|
|
30
|
-
*
|
|
31
|
-
* console.info(result) // [0, 1], [2, 3], [4]
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* Async sources must be awaited:
|
|
35
|
-
*
|
|
36
|
-
* ```javascript
|
|
37
|
-
* import batch from 'it-batch'
|
|
38
|
-
* import all from 'it-all'
|
|
39
|
-
*
|
|
40
|
-
* const values = async function * () {
|
|
41
|
-
* yield * [0, 1, 2, 3, 4]
|
|
42
|
-
* }
|
|
43
|
-
*
|
|
44
|
-
* const batchSize = 2
|
|
45
|
-
* const result = await all(batch(values(), batchSize))
|
|
46
|
-
*
|
|
47
|
-
* console.info(result) // [0, 1], [2, 3], [4]
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
function isAsyncIterable$1(thing) {
|
|
51
|
-
return thing[Symbol.asyncIterator] != null;
|
|
52
|
-
}
|
|
53
|
-
function batch(source, size = 1) {
|
|
54
|
-
size = Number(size);
|
|
55
|
-
if (isAsyncIterable$1(source)) return async function* () {
|
|
56
|
-
let things = [];
|
|
57
|
-
if (size < 1) size = 1;
|
|
58
|
-
if (size !== Math.round(size)) throw new Error("Batch size must be an integer");
|
|
59
|
-
for await (const thing of source) {
|
|
60
|
-
things.push(thing);
|
|
61
|
-
while (things.length >= size) {
|
|
62
|
-
yield things.slice(0, size);
|
|
63
|
-
things = things.slice(size);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
while (things.length > 0) {
|
|
67
|
-
yield things.slice(0, size);
|
|
68
|
-
things = things.slice(size);
|
|
69
|
-
}
|
|
70
|
-
}();
|
|
71
|
-
return function* () {
|
|
72
|
-
let things = [];
|
|
73
|
-
if (size < 1) size = 1;
|
|
74
|
-
if (size !== Math.round(size)) throw new Error("Batch size must be an integer");
|
|
75
|
-
for (const thing of source) {
|
|
76
|
-
things.push(thing);
|
|
77
|
-
while (things.length >= size) {
|
|
78
|
-
yield things.slice(0, size);
|
|
79
|
-
things = things.slice(size);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
while (things.length > 0) {
|
|
83
|
-
yield things.slice(0, size);
|
|
84
|
-
things = things.slice(size);
|
|
85
|
-
}
|
|
86
|
-
}();
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region node_modules/it-parallel-batch/dist/src/index.js
|
|
90
|
-
/**
|
|
91
|
-
* @packageDocumentation
|
|
92
|
-
*
|
|
93
|
-
* Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input.
|
|
94
|
-
*
|
|
95
|
-
* The final batch may be smaller than the batch size.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
*
|
|
99
|
-
* ```javascript
|
|
100
|
-
* import parallelBatch from 'it-parallel-batch'
|
|
101
|
-
* import all from 'it-all'
|
|
102
|
-
* import delay from 'delay'
|
|
103
|
-
*
|
|
104
|
-
* // This can also be an iterator, async iterator, generator, etc
|
|
105
|
-
* const input = [
|
|
106
|
-
* async () => {
|
|
107
|
-
* await delay(500)
|
|
108
|
-
*
|
|
109
|
-
* return 1
|
|
110
|
-
* },
|
|
111
|
-
* async () => {
|
|
112
|
-
* await delay(200)
|
|
113
|
-
*
|
|
114
|
-
* return 2
|
|
115
|
-
* },
|
|
116
|
-
* async () => {
|
|
117
|
-
* await delay(100)
|
|
118
|
-
*
|
|
119
|
-
* return 3
|
|
120
|
-
* }
|
|
121
|
-
* ]
|
|
122
|
-
*
|
|
123
|
-
* const batchSize = 2
|
|
124
|
-
*
|
|
125
|
-
* const result = await all(parallelBatch(input, batchSize))
|
|
126
|
-
*
|
|
127
|
-
* console.info(result) // [1, 2, 3]
|
|
128
|
-
* ```
|
|
129
|
-
*/
|
|
130
|
-
/**
|
|
131
|
-
* Takes an (async) iterator that emits promise-returning functions,
|
|
132
|
-
* invokes them in parallel and emits the results as they become available but
|
|
133
|
-
* in the same order as the input
|
|
134
|
-
*/
|
|
135
|
-
async function* parallelBatch(source, size = 1) {
|
|
136
|
-
for await (const tasks of batch(source, size)) {
|
|
137
|
-
const things = tasks.map(async (p) => {
|
|
138
|
-
return p().then((value) => ({
|
|
139
|
-
ok: true,
|
|
140
|
-
value
|
|
141
|
-
}), (err) => ({
|
|
142
|
-
ok: false,
|
|
143
|
-
err
|
|
144
|
-
}));
|
|
145
|
-
});
|
|
146
|
-
for (let i = 0; i < things.length; i++) {
|
|
147
|
-
const result = await things[i];
|
|
148
|
-
if (result.ok) yield result.value;
|
|
149
|
-
else throw result.err;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
//#endregion
|
|
154
14
|
//#region node_modules/ipfs-unixfs-importer/node_modules/uint8arraylist/dist/src/index.js
|
|
155
15
|
/**
|
|
156
16
|
* @packageDocumentation
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
2
|
import { t as all } from "./src-CYIMjhjK.js";
|
|
3
|
+
import { n as peekable, t as map } from "./src-Cpx2Sts8.js";
|
|
3
4
|
import { i as first, n as src_exports$2 } from "./src-BOzgM7Fp.js";
|
|
4
5
|
import http from "node:http";
|
|
5
6
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
@@ -5831,7 +5832,7 @@ async function* browserReadableStreamToIt(stream, options = {}) {
|
|
|
5831
5832
|
}
|
|
5832
5833
|
}
|
|
5833
5834
|
//#endregion
|
|
5834
|
-
//#region node_modules/
|
|
5835
|
+
//#region node_modules/kubo-rpc-client/dist/src/lib/errors.js
|
|
5835
5836
|
var import_err_code = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5836
5837
|
/**
|
|
5837
5838
|
* @typedef {{ [key: string]: any }} Extensions
|
|
@@ -5879,132 +5880,6 @@ var import_err_code = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((e
|
|
|
5879
5880
|
}
|
|
5880
5881
|
module.exports = createError;
|
|
5881
5882
|
})))(), 1);
|
|
5882
|
-
/**
|
|
5883
|
-
* @packageDocumentation
|
|
5884
|
-
*
|
|
5885
|
-
* Lets you look at the contents of an async iterator and decide what to do
|
|
5886
|
-
*
|
|
5887
|
-
* @example
|
|
5888
|
-
*
|
|
5889
|
-
* ```javascript
|
|
5890
|
-
* import peekable from 'it-peekable'
|
|
5891
|
-
*
|
|
5892
|
-
* // This can also be an iterator, generator, etc
|
|
5893
|
-
* const values = [0, 1, 2, 3, 4]
|
|
5894
|
-
*
|
|
5895
|
-
* const it = peekable(value)
|
|
5896
|
-
*
|
|
5897
|
-
* const first = it.peek()
|
|
5898
|
-
*
|
|
5899
|
-
* console.info(first) // 0
|
|
5900
|
-
*
|
|
5901
|
-
* it.push(first)
|
|
5902
|
-
*
|
|
5903
|
-
* console.info([...it])
|
|
5904
|
-
* // [ 0, 1, 2, 3, 4 ]
|
|
5905
|
-
* ```
|
|
5906
|
-
*
|
|
5907
|
-
* Async sources must be awaited:
|
|
5908
|
-
*
|
|
5909
|
-
* ```javascript
|
|
5910
|
-
* import peekable from 'it-peekable'
|
|
5911
|
-
*
|
|
5912
|
-
* const values = async function * () {
|
|
5913
|
-
* yield * [0, 1, 2, 3, 4]
|
|
5914
|
-
* }
|
|
5915
|
-
*
|
|
5916
|
-
* const it = peekable(values())
|
|
5917
|
-
*
|
|
5918
|
-
* const first = await it.peek()
|
|
5919
|
-
*
|
|
5920
|
-
* console.info(first) // 0
|
|
5921
|
-
*
|
|
5922
|
-
* it.push(first)
|
|
5923
|
-
*
|
|
5924
|
-
* console.info(await all(it))
|
|
5925
|
-
* // [ 0, 1, 2, 3, 4 ]
|
|
5926
|
-
* ```
|
|
5927
|
-
*/
|
|
5928
|
-
function peekable(iterable) {
|
|
5929
|
-
const [iterator, symbol] = iterable[Symbol.asyncIterator] != null ? [iterable[Symbol.asyncIterator](), Symbol.asyncIterator] : [iterable[Symbol.iterator](), Symbol.iterator];
|
|
5930
|
-
const queue = [];
|
|
5931
|
-
return {
|
|
5932
|
-
peek: () => {
|
|
5933
|
-
return iterator.next();
|
|
5934
|
-
},
|
|
5935
|
-
push: (value) => {
|
|
5936
|
-
queue.push(value);
|
|
5937
|
-
},
|
|
5938
|
-
next: () => {
|
|
5939
|
-
if (queue.length > 0) return {
|
|
5940
|
-
done: false,
|
|
5941
|
-
value: queue.shift()
|
|
5942
|
-
};
|
|
5943
|
-
return iterator.next();
|
|
5944
|
-
},
|
|
5945
|
-
[symbol]() {
|
|
5946
|
-
return this;
|
|
5947
|
-
}
|
|
5948
|
-
};
|
|
5949
|
-
}
|
|
5950
|
-
//#endregion
|
|
5951
|
-
//#region node_modules/it-map/dist/src/index.js
|
|
5952
|
-
/**
|
|
5953
|
-
* @packageDocumentation
|
|
5954
|
-
*
|
|
5955
|
-
* Convert one value from an (async)iterator into another.
|
|
5956
|
-
*
|
|
5957
|
-
* @example
|
|
5958
|
-
*
|
|
5959
|
-
* ```javascript
|
|
5960
|
-
* import map from 'it-map'
|
|
5961
|
-
*
|
|
5962
|
-
* // This can also be an iterator, generator, etc
|
|
5963
|
-
* const values = [0, 1, 2, 3, 4]
|
|
5964
|
-
*
|
|
5965
|
-
* const result = map(values, (val, index) => val++)
|
|
5966
|
-
*
|
|
5967
|
-
* console.info(result) // [1, 2, 3, 4, 5]
|
|
5968
|
-
* ```
|
|
5969
|
-
*
|
|
5970
|
-
* Async sources and transforms must be awaited:
|
|
5971
|
-
*
|
|
5972
|
-
* ```javascript
|
|
5973
|
-
* import map from 'it-map'
|
|
5974
|
-
*
|
|
5975
|
-
* const values = async function * () {
|
|
5976
|
-
* yield * [0, 1, 2, 3, 4]
|
|
5977
|
-
* }
|
|
5978
|
-
*
|
|
5979
|
-
* const result = await map(values(), async (val, index) => val++)
|
|
5980
|
-
*
|
|
5981
|
-
* console.info(result) // [1, 2, 3, 4, 5]
|
|
5982
|
-
* ```
|
|
5983
|
-
*/
|
|
5984
|
-
function isAsyncIterable$3(thing) {
|
|
5985
|
-
return thing[Symbol.asyncIterator] != null;
|
|
5986
|
-
}
|
|
5987
|
-
function map(source, func) {
|
|
5988
|
-
let index = 0;
|
|
5989
|
-
if (isAsyncIterable$3(source)) return (async function* () {
|
|
5990
|
-
for await (const val of source) yield func(val, index++);
|
|
5991
|
-
})();
|
|
5992
|
-
const peekable$6 = peekable(source);
|
|
5993
|
-
const { value, done } = peekable$6.next();
|
|
5994
|
-
if (done === true) return function* () {}();
|
|
5995
|
-
const res = func(value, index++);
|
|
5996
|
-
if (typeof res.then === "function") return (async function* () {
|
|
5997
|
-
yield await res;
|
|
5998
|
-
for (const val of peekable$6) yield func(val, index++);
|
|
5999
|
-
})();
|
|
6000
|
-
const fn = func;
|
|
6001
|
-
return (function* () {
|
|
6002
|
-
yield res;
|
|
6003
|
-
for (const val of peekable$6) yield fn(val, index++);
|
|
6004
|
-
})();
|
|
6005
|
-
}
|
|
6006
|
-
//#endregion
|
|
6007
|
-
//#region node_modules/kubo-rpc-client/dist/src/lib/errors.js
|
|
6008
5883
|
var HTTPError$2 = class extends Error {
|
|
6009
5884
|
response;
|
|
6010
5885
|
constructor(response) {
|