@pkcprotocol/pkc-js 0.0.75 → 0.0.77
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 +10 -0
- package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +3 -1
- package/dist/browser/clients/rpc-client/pkc-rpc-client.js +12 -1
- package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +18 -0
- package/dist/browser/clients/rpc-client/rpc-schema-util.js +5 -1
- package/dist/browser/clients/rpc-client/rpc-schema-util.js.map +1 -1
- package/dist/browser/clients/rpc-client/schema.d.ts +15 -0
- package/dist/browser/clients/rpc-client/schema.js +20 -0
- package/dist/browser/clients/rpc-client/schema.js.map +1 -1
- package/dist/browser/clients/rpc-client/types.d.ts +3 -2
- package/dist/browser/community/community-client-manager.js +9 -9
- package/dist/browser/community/community-client-manager.js.map +1 -1
- package/dist/browser/community/rpc-local-community.d.ts +6 -1
- package/dist/browser/community/rpc-local-community.js +32 -0
- package/dist/browser/community/rpc-local-community.js.map +1 -1
- package/dist/browser/community/schema.d.ts +15 -0
- package/dist/browser/community/schema.js +16 -1
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/community/types.d.ts +14 -1
- package/dist/browser/constants.d.ts +3 -1
- package/dist/browser/constants.js +9 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/errors.d.ts +11 -1
- package/dist/browser/errors.js +11 -1
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/index-with-compile-cache.d.ts +2 -0
- package/dist/browser/index-with-compile-cache.js +1 -0
- package/dist/browser/index-with-compile-cache.js.map +1 -1
- package/dist/browser/index.d.ts +3 -0
- package/dist/browser/index.js +8 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/pkc/pkc.js +37 -3
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/rpc/src/index.d.ts +4 -1
- package/dist/browser/rpc/src/index.js +29 -1
- package/dist/browser/rpc/src/index.js.map +1 -1
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +1 -0
- package/dist/browser/runtime/node/community/local-community/anchor-publishing.d.ts +9 -0
- package/dist/browser/runtime/node/community/local-community/anchor-publishing.js +197 -0
- package/dist/browser/runtime/node/community/local-community/anchor-publishing.js.map +1 -0
- package/dist/browser/runtime/node/community/local-community/cleanup.d.ts +2 -1
- package/dist/browser/runtime/node/community/local-community/cleanup.js +81 -30
- package/dist/browser/runtime/node/community/local-community/cleanup.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/comment-updates.js +5 -0
- 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 +22 -4
- package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/identity.d.ts +2 -0
- package/dist/browser/runtime/node/community/local-community/identity.js +13 -0
- package/dist/browser/runtime/node/community/local-community/identity.js.map +1 -0
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +11 -28
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/lifecycle.js +24 -0
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-store.js +7 -3
- package/dist/browser/runtime/node/community/local-community/publication-store.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-validation.js +6 -2
- package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community.d.ts +5 -1
- package/dist/browser/runtime/node/community/local-community.js +47 -6
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.js +21 -3
- package/dist/browser/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +6 -0
- package/dist/browser/schema/schema.d.ts +1 -0
- package/dist/browser/schema/schema.js +11 -0
- package/dist/browser/schema/schema.js.map +1 -1
- package/dist/browser/signer/index.d.ts +1 -0
- package/dist/browser/signer/index.js +1 -0
- package/dist/browser/signer/index.js.map +1 -1
- package/dist/browser/signer/ipns-record.d.ts +7 -0
- package/dist/browser/signer/ipns-record.js +34 -0
- package/dist/browser/signer/ipns-record.js.map +1 -0
- package/dist/browser/signer/signatures.d.ts +2 -2
- package/dist/browser/signer/signatures.js +18 -6
- package/dist/browser/signer/signatures.js.map +1 -1
- package/dist/browser/test/test-util.d.ts +4 -0
- package/dist/browser/util.js +13 -4
- package/dist/browser/util.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +43 -38
- package/dist/bundled/chunks/{helia-for-pkc-BPj1zAUb.js → helia-for-pkc-HklWh03v.js} +3 -3
- package/dist/bundled/chunks/{local-community-D4efR9XJ.js → local-community-BIjlDWkC.js} +235 -50
- package/dist/bundled/chunks/{local-community-ChTkd8lH.js → local-community-CVm32rYh.js} +1 -1
- package/dist/bundled/chunks/{node-BK6GBM0d.js → node-tGwhcLcm.js} +48 -10
- package/dist/bundled/chunks/{rpc-local-community-O94vseOA.js → rpc-local-community-BmD9viua.js} +74 -16
- package/dist/bundled/chunks/{schema-wNdSno5O.js → schema-Bu4z3MGE.js} +32 -8
- package/dist/bundled/chunks/{util-iNnH2bP5.js → util-DIVqZjOO.js} +1 -1
- package/dist/bundled/index-with-compile-cache.js +2 -1
- package/dist/bundled/index.js +2 -2
- package/dist/bundled/rpc/src/index.js +27 -4
- package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +3 -1
- package/dist/node/clients/rpc-client/pkc-rpc-client.js +12 -1
- package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +18 -0
- package/dist/node/clients/rpc-client/rpc-schema-util.js +5 -1
- package/dist/node/clients/rpc-client/rpc-schema-util.js.map +1 -1
- package/dist/node/clients/rpc-client/schema.d.ts +15 -0
- package/dist/node/clients/rpc-client/schema.js +20 -0
- package/dist/node/clients/rpc-client/schema.js.map +1 -1
- package/dist/node/clients/rpc-client/types.d.ts +3 -2
- package/dist/node/community/community-client-manager.js +9 -9
- package/dist/node/community/community-client-manager.js.map +1 -1
- package/dist/node/community/rpc-local-community.d.ts +6 -1
- package/dist/node/community/rpc-local-community.js +32 -0
- package/dist/node/community/rpc-local-community.js.map +1 -1
- package/dist/node/community/schema.d.ts +15 -0
- package/dist/node/community/schema.js +16 -1
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/community/types.d.ts +14 -1
- package/dist/node/constants.d.ts +3 -1
- package/dist/node/constants.js +9 -1
- package/dist/node/constants.js.map +1 -1
- package/dist/node/errors.d.ts +11 -1
- package/dist/node/errors.js +11 -1
- package/dist/node/errors.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/index-with-compile-cache.d.ts +2 -0
- package/dist/node/index-with-compile-cache.js +1 -0
- package/dist/node/index-with-compile-cache.js.map +1 -1
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.js +8 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/pkc/pkc.js +37 -3
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/rpc/src/index.d.ts +4 -1
- package/dist/node/rpc/src/index.js +29 -1
- package/dist/node/rpc/src/index.js.map +1 -1
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +1 -0
- package/dist/node/runtime/node/community/local-community/anchor-publishing.d.ts +9 -0
- package/dist/node/runtime/node/community/local-community/anchor-publishing.js +197 -0
- package/dist/node/runtime/node/community/local-community/anchor-publishing.js.map +1 -0
- package/dist/node/runtime/node/community/local-community/cleanup.d.ts +2 -1
- package/dist/node/runtime/node/community/local-community/cleanup.js +81 -30
- package/dist/node/runtime/node/community/local-community/cleanup.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/comment-updates.js +5 -0
- 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 +22 -4
- package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/identity.d.ts +2 -0
- package/dist/node/runtime/node/community/local-community/identity.js +13 -0
- package/dist/node/runtime/node/community/local-community/identity.js.map +1 -0
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js +11 -28
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/lifecycle.js +24 -0
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-store.js +7 -3
- package/dist/node/runtime/node/community/local-community/publication-store.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-validation.js +6 -2
- package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/node/runtime/node/community/local-community.d.ts +5 -1
- package/dist/node/runtime/node/community/local-community.js +47 -6
- package/dist/node/runtime/node/community/local-community.js.map +1 -1
- package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js +21 -3
- package/dist/node/runtime/node/setup-kubo-address-rewriter-and-http-router.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +6 -0
- package/dist/node/schema/schema.d.ts +1 -0
- package/dist/node/schema/schema.js +11 -0
- package/dist/node/schema/schema.js.map +1 -1
- package/dist/node/signer/index.d.ts +1 -0
- package/dist/node/signer/index.js +1 -0
- package/dist/node/signer/index.js.map +1 -1
- package/dist/node/signer/ipns-record.d.ts +7 -0
- package/dist/node/signer/ipns-record.js +34 -0
- package/dist/node/signer/ipns-record.js.map +1 -0
- package/dist/node/signer/signatures.d.ts +2 -2
- package/dist/node/signer/signatures.js +18 -6
- package/dist/node/signer/signatures.js.map +1 -1
- package/dist/node/test/test-util.d.ts +4 -0
- package/dist/node/util.js +13 -4
- package/dist/node/util.js.map +1 -1
- package/package.json +2 -2
- package/dist/bundled/chunks/{src-BKg5Lhod.js → src-BEjAH2gY.js} +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { B as isIpfsCid,
|
|
3
|
-
import { $ as
|
|
4
|
-
import { o as getHeliaDebugContext } from "./util-
|
|
2
|
+
import { $n as n$1, B as isIpfsCid, Cr as setErrorMap, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dt as refreshTrackedCommentAliases, E as createAbortError, Et as listUpdatingCommunities, Fr as parsedType, H as isIpns, Ir as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Pr as joinValues, Pt as untrackUpdatingComment, Q as isStringDomain, Qt as CommunityAnchorSchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, St as findUpdatingComment, Tt as listUpdatingComments, Zn as n$2, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r, b as areEquivalentCommunityAddresses, br as logger_default, ct as resolveWhenPredicateIsTrue, fr as require_retry, ft as shortifyAddress, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, ln as PubsubTopicSchema, mt as sleepUntilTimeoutOrAbort, nr as e, ot as removeUndefinedValuesRecursively, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as t$1, ut as retryKuboIpfsAdd, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSchema, wt as listStartedCommunities, xr as require_supports_color, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, z as isAbortError } from "./schema-Bu4z3MGE.js";
|
|
3
|
+
import { $ as parseRawPages, $n as t$3, An as RpcAuthorNameParamSchema, Bn as RpcExportCommunityResultSchema, Bt as getCommunityNameFromWire, Cn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Dt as verifyCommentModeration, En as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Et as verifyCommentIpfs, Fn as RpcCommunityPageParamSchema, Ft as getAuthorNameFromRuntime, Gn as RpcPublishedAnchorRecordResultSchema, Gt as getBufferedPKCAddressFromPublicKey, H as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Hn as RpcFetchCidResultSchema, Ht as normalizeCommunityInputFromCommunity, In as RpcEditCommunityParamSchema, Jn as RpcSuccessResultSchema, Jt as getPKCAddressFromPublicKeySync, Kn as RpcResolveAuthorNameResultSchema, L as listCommunitiesSync, Ln as RpcExportCommunityModLogsParamSchema, Lt as normalizeCreatePublicationAuthor, Mn as RpcCidParamSchema, Mt as verifyVote, Nn as RpcCommentRepliesPageParamSchema, Nt as buildRuntimeAuthor, O as createKuboRpcClient, On as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Ot as verifyCommentPubsubMessage, P as getDefaultDataPath, Pn as RpcCommunityIdentifierParamSchema, Pt as cleanWireAuthor, R as monitorCommunitiesDirectory, Rn as RpcExportCommunityModLogsResultSchema, Rt as buildRuntimeCommunityFields, S as encryptEd25519AesGcm, Sn as parseJsonWithPKCErrorIfFails, St as verifyChallengeMessage, Tn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Tt as verifyCommentEdit, U as CommentClientsManager, Un as RpcPublishAnchorRecordParamSchema, Ut as decode, V as setNativeFunctions$1, Vn as RpcFetchCidParamSchema, Vt as getCommunityPublicKeyFromWire, Wn as RpcPublishChallengeAnswersParamSchema, X as extractCommunityRuntimeFieldsFromParsedPages, Xn as t$4, Yn as RpcUnsubscribeParamSchema, Z as findCommentInPageInstanceRecursively, Zt as parseCidStringSchemaWithPKCErrorIfItFails, _n as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, an as parseCommunityAddressWithPKCErrorIfItFails, b as decryptEd25519AesGcm, bn as parseDecryptedChallengeVerification, bt as signVote, c as AddressesRewriterProxyServer, cn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, cr as require_undici, ct as cleanUpBeforePublishing, dn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, dt as signChallengeRequest, en as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, er as n$3, et as RepliesPages, f as KeyvBetterSqlite3, fn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, ht as signCommentModeration, in as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, jn as RpcCancelExportParamSchema, jt as verifyCommunityEdit, kn as RpcAnchorPublishPreparationResultSchema, kt as verifyCommentUpdate, lt as signChallengeAnswer, m as decodeRpcChallengePubsubMsg, mt as signCommentEdit, n as RpcRemoteCommunity, nr as t$2, nt as PKCClientsManager, o as TrackedInstanceRegistry, ot as PKCTypedEmitter, p as decodeRpcChallengeAnswerPubsubMsg, pn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, pt as signComment, qn as RpcSubscriptionIdResultSchema, rn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, rr as t$5, rt as InflightFetchManager, s as LRUCache, sr as nativeFunctions$2, st as require_lib$1, t as RpcLocalCommunity, tn as parseCommentIpfsSchemaWithPKCErrorIfItFails, tt as PublicationClientsManager, u as RemoteCommunity, un as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, v as createSigner, vn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, wn as parseRpcCommentEventWithPKCErrorIfItFails, wt as verifyChallengeVerification, xn as parseDecryptedChallengeWithPKCErrorIfItFails, y as createAnchorIpnsRecord$1, yn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yt as signCommunityEdit, zn as RpcExportCommunityParamSchema, zt as getCommunityAddressFromRecord } from "./rpc-local-community-BmD9viua.js";
|
|
4
|
+
import { o as getHeliaDebugContext } from "./util-DIVqZjOO.js";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import fs from "fs";
|
|
@@ -2118,6 +2118,9 @@ const parseRpcResolveAuthorNameResult = (result) => RpcResolveAuthorNameResultSc
|
|
|
2118
2118
|
const parseRpcFetchCidResult = (result) => RpcFetchCidResultSchema.loose().parse(result);
|
|
2119
2119
|
const parseRpcSuccessResult = (result) => RpcSuccessResultSchema.loose().parse(result);
|
|
2120
2120
|
const parseRpcSubscriptionIdResult = (result) => RpcSubscriptionIdResultSchema.loose().parse(result);
|
|
2121
|
+
const parseRpcPublishAnchorRecordParam = (params) => RpcPublishAnchorRecordParamSchema.loose().parse(params);
|
|
2122
|
+
const parseRpcAnchorPublishPreparationResult = (result) => RpcAnchorPublishPreparationResultSchema.loose().parse(result);
|
|
2123
|
+
const parseRpcPublishedAnchorRecordResult = (result) => RpcPublishedAnchorRecordResultSchema.loose().parse(result);
|
|
2121
2124
|
const parseRpcExportCommunityParam = (params) => RpcExportCommunityParamSchema.loose().parse(params);
|
|
2122
2125
|
const parseRpcCancelExportParam = (params) => RpcCancelExportParamSchema.loose().parse(params);
|
|
2123
2126
|
const parseRpcExportCommunityResult = (result) => RpcExportCommunityResultSchema.loose().parse(result);
|
|
@@ -2363,6 +2366,14 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
2363
2366
|
const parsedStopCommunityArgs = parseRpcCommunityIdentifierParam(communityIdentifier);
|
|
2364
2367
|
return parseRpcSuccessResult(await this._webSocketClient.call("stopCommunity", [parsedStopCommunityArgs]));
|
|
2365
2368
|
}
|
|
2369
|
+
async prepareAnchorPublish(communityIdentifier) {
|
|
2370
|
+
const parsedArgs = parseRpcCommunityIdentifierParam(communityIdentifier);
|
|
2371
|
+
return parseRpcAnchorPublishPreparationResult(await this._webSocketClient.call("prepareAnchorPublish", [parsedArgs]));
|
|
2372
|
+
}
|
|
2373
|
+
async publishAnchorRecord(args) {
|
|
2374
|
+
const parsedArgs = parseRpcPublishAnchorRecordParam(args);
|
|
2375
|
+
return parseRpcPublishedAnchorRecordResult(await this._webSocketClient.call("publishAnchorRecord", [parsedArgs]));
|
|
2376
|
+
}
|
|
2366
2377
|
async editCommunity(args) {
|
|
2367
2378
|
parseRpcEditCommunityParam(args);
|
|
2368
2379
|
const wireArgs = {
|
|
@@ -8516,6 +8527,7 @@ var import_tcp_port_used = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
8516
8527
|
return deferred.promise;
|
|
8517
8528
|
}
|
|
8518
8529
|
})))(), 1);
|
|
8530
|
+
const MAX_TCP_PORT = 65535;
|
|
8519
8531
|
function _mergeRouterConfigs(existingConfig, newConfig) {
|
|
8520
8532
|
if (!existingConfig?.Routers) return newConfig;
|
|
8521
8533
|
const existingRoutersByEndpoint = /* @__PURE__ */ new Map();
|
|
@@ -8647,7 +8659,8 @@ async function setupKuboAddressesRewriterAndHttpRouters(pkc) {
|
|
|
8647
8659
|
logger_default("pkc-js:node:setupKuboAddressesRewriterAndHttpRouters");
|
|
8648
8660
|
const httpRouterProxyUrls = [];
|
|
8649
8661
|
const proxyServers = [];
|
|
8650
|
-
|
|
8662
|
+
const parsedStartPortOverride = Number(process.env.PKC_ADDRESSES_REWRITER_START_PORT);
|
|
8663
|
+
let addressesRewriterStartPort = Number.isInteger(parsedStartPortOverride) && parsedStartPortOverride > 0 && parsedStartPortOverride <= MAX_TCP_PORT ? parsedStartPortOverride : 19575;
|
|
8651
8664
|
for (const httpRouter of pkc.httpRoutersOptions) {
|
|
8652
8665
|
if (pkc.destroyed) break;
|
|
8653
8666
|
const startedProxyUrl = await _getStartedProxyUrl(pkc, httpRouter);
|
|
@@ -8657,7 +8670,10 @@ async function setupKuboAddressesRewriterAndHttpRouters(pkc) {
|
|
|
8657
8670
|
}
|
|
8658
8671
|
let port = addressesRewriterStartPort;
|
|
8659
8672
|
const hostname = "127.0.0.1";
|
|
8660
|
-
while (await import_tcp_port_used.check(port, hostname))
|
|
8673
|
+
while (await import_tcp_port_used.check(port, hostname)) {
|
|
8674
|
+
port++;
|
|
8675
|
+
if (port > MAX_TCP_PORT) throw Error(`No free loopback port for the addresses rewriter proxy between ${addressesRewriterStartPort} and ${MAX_TCP_PORT}`);
|
|
8676
|
+
}
|
|
8661
8677
|
const addressesRewriterProxyServer = new AddressesRewriterProxyServer({
|
|
8662
8678
|
kuboClients: Object.values(pkc.clients.kuboRpcClients).map((kubo) => kubo._client),
|
|
8663
8679
|
port,
|
|
@@ -8901,7 +8917,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8901
8917
|
this.clients.libp2pJsClients = {};
|
|
8902
8918
|
if (!this.libp2pJsClientsOptions) return;
|
|
8903
8919
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
8904
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
8920
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-HklWh03v.js");
|
|
8905
8921
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
8906
8922
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
8907
8923
|
...clientOptions,
|
|
@@ -9150,7 +9166,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
9150
9166
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
9151
9167
|
log.trace("Received community options to create a local community instance:", options);
|
|
9152
9168
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
9153
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
9169
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-CVm32rYh.js");
|
|
9154
9170
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
9155
9171
|
const community = new LocalCommunity(this);
|
|
9156
9172
|
if (isLocalCommunity) {
|
|
@@ -9182,11 +9198,22 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
9182
9198
|
const hasName = "name" in parsedOptions && typeof parsedOptions.name === "string";
|
|
9183
9199
|
const hasPublicKey = "publicKey" in parsedOptions && typeof parsedOptions.publicKey === "string";
|
|
9184
9200
|
const hasSigner = "signer" in parsedOptions && parsedOptions.signer !== void 0;
|
|
9201
|
+
const anchor = parsedOptions.anchor ?? void 0;
|
|
9202
|
+
const hasAnchor = anchor !== void 0;
|
|
9203
|
+
if (hasAnchor) {
|
|
9204
|
+
const parsedAnchor = CommunityAnchorSchema.safeParse(anchor);
|
|
9205
|
+
if (!parsedAnchor.success) throw new PKCError("ERR_ANCHOR_PUBLIC_KEY_IS_INVALID", {
|
|
9206
|
+
anchor,
|
|
9207
|
+
zodError: parsedAnchor.error
|
|
9208
|
+
});
|
|
9209
|
+
}
|
|
9210
|
+
if (hasAnchor && hasSigner) throw new PKCError("ERR_CAN_NOT_CREATE_A_COMMUNITY_WITH_BOTH_SIGNER_AND_ANCHOR", { ...parsedOptions });
|
|
9185
9211
|
const hasIdentifier = hasAddress || hasName || hasPublicKey;
|
|
9212
|
+
if (hasAnchor && hasIdentifier) throw new PKCError("ERR_CAN_NOT_CREATE_A_COMMUNITY_WITH_BOTH_ANCHOR_AND_IDENTIFIER", { ...parsedOptions });
|
|
9186
9213
|
const effectiveAddress = parsedOptions.address || parsedOptions.name || parsedOptions.publicKey;
|
|
9187
9214
|
if (effectiveAddress && doesDomainAddressHaveCapitalLetter(effectiveAddress)) throw new PKCError("ERR_COMMUNITY_NAME_HAS_CAPITAL_LETTER", { ...parsedOptions });
|
|
9188
9215
|
const canCreateLocalCommunity = this._canCreateNewLocalCommunity();
|
|
9189
|
-
if (hasSigner && !canCreateLocalCommunity) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", {
|
|
9216
|
+
if ((hasSigner || hasAnchor) && !canCreateLocalCommunity) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", {
|
|
9190
9217
|
pkcOptions: this._userPKCOptions,
|
|
9191
9218
|
isEnvNode: Boolean(process),
|
|
9192
9219
|
hasDataPath: Boolean(this.dataPath)
|
|
@@ -9195,7 +9222,16 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
9195
9222
|
const parsedRemoteOptions = parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails(options);
|
|
9196
9223
|
return this._createRemoteCommunityInstance(parsedRemoteOptions);
|
|
9197
9224
|
}
|
|
9198
|
-
if (
|
|
9225
|
+
if (hasAnchor) {
|
|
9226
|
+
const minterSigner = await this.createSigner();
|
|
9227
|
+
const localOptions = {
|
|
9228
|
+
...parsedOptions,
|
|
9229
|
+
signer: minterSigner,
|
|
9230
|
+
address: anchor.publicKey
|
|
9231
|
+
};
|
|
9232
|
+
log(`Creating a delegated local community with anchor (${anchor.publicKey}) and minter (${minterSigner.address})`);
|
|
9233
|
+
return this._createLocalCommunity(localOptions);
|
|
9234
|
+
} else if (hasIdentifier && !hasSigner) {
|
|
9199
9235
|
const localCommunityAddress = (await listCommunitiesSync(this)).find((localAddr) => areEquivalentCommunityAddresses(localAddr, effectiveAddress));
|
|
9200
9236
|
if (localCommunityAddress) return this._createLocalCommunity({ address: localCommunityAddress });
|
|
9201
9237
|
else {
|
|
@@ -9668,10 +9704,12 @@ PKC.nativeFunctions = {
|
|
|
9668
9704
|
PKC.getShortCid = getShortCidValue;
|
|
9669
9705
|
PKC.getShortAddress = getShortAddressValue;
|
|
9670
9706
|
PKC.challenges = pkcJsChallenges;
|
|
9707
|
+
PKC.createAnchorIpnsRecord = createAnchorIpnsRecord$1;
|
|
9671
9708
|
const setNativeFunctions = PKC.setNativeFunctions;
|
|
9672
9709
|
const nativeFunctions = PKC.nativeFunctions;
|
|
9673
9710
|
const getShortCid = PKC.getShortCid;
|
|
9674
9711
|
const getShortAddress = PKC.getShortAddress;
|
|
9675
9712
|
const challenges = PKC.challenges;
|
|
9713
|
+
const createAnchorIpnsRecord = PKC.createAnchorIpnsRecord;
|
|
9676
9714
|
//#endregion
|
|
9677
|
-
export {
|
|
9715
|
+
export { parseRpcPublishAnchorRecordParam as _, getShortCid as a, parseRpcAuthorNameParam as c, parseRpcCommentRepliesPageParam as d, parseRpcCommunityIdentifierParam as f, parseRpcExportCommunityParam as g, parseRpcExportCommunityModLogsParam as h, getShortAddress as i, parseRpcCancelExportParam as l, parseRpcEditCommunityParam as m, challenges as n, nativeFunctions as o, parseRpcCommunityPageParam as p, createAnchorIpnsRecord as r, setNativeFunctions as s, PKC as t, parseRpcCidParam as u, parseRpcPublishChallengeAnswersParam as v, parseRpcUnsubscribeParam as y };
|
package/dist/bundled/chunks/{rpc-local-community-O94vseOA.js → rpc-local-community-BmD9viua.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as pubsubTopicToDhtKey, $
|
|
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-Bu4z3MGE.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";
|
|
@@ -15,10 +15,10 @@ import { Agent } from "https";
|
|
|
15
15
|
import { Agent as Agent$1 } from "http";
|
|
16
16
|
import Database from "better-sqlite3";
|
|
17
17
|
import { CID } from "multiformats/cid";
|
|
18
|
+
import { peerIdFromMultihash, peerIdFromPrivateKey, peerIdFromPublicKey, peerIdFromString } from "@libp2p/peer-id";
|
|
18
19
|
import * as Digest from "multiformats/hashes/digest";
|
|
19
20
|
import { of } from "typestub-ipfs-only-hash";
|
|
20
21
|
import { toString } from "uint8arrays/to-string";
|
|
21
|
-
import { peerIdFromMultihash, peerIdFromPrivateKey, peerIdFromPublicKey, peerIdFromString } from "@libp2p/peer-id";
|
|
22
22
|
import { privateKeyFromProtobuf, privateKeyFromRaw, privateKeyToProtobuf, publicKeyFromRaw, publicKeyToProtobuf } from "@libp2p/crypto/keys";
|
|
23
23
|
import { fromString } from "uint8arrays/from-string";
|
|
24
24
|
import { bases } from "multiformats/basics";
|
|
@@ -91003,6 +91003,8 @@ var STORAGE_KEYS;
|
|
|
91003
91003
|
STORAGE_KEYS[STORAGE_KEYS["LAST_IPNS_RECORD"] = 2] = "LAST_IPNS_RECORD";
|
|
91004
91004
|
STORAGE_KEYS[STORAGE_KEYS["COMBINED_HASH_OF_PENDING_COMMENTS"] = 3] = "COMBINED_HASH_OF_PENDING_COMMENTS";
|
|
91005
91005
|
STORAGE_KEYS[STORAGE_KEYS["EXPORTS"] = 4] = "EXPORTS";
|
|
91006
|
+
STORAGE_KEYS[STORAGE_KEYS["ANCHOR_IPNS_RECORD"] = 5] = "ANCHOR_IPNS_RECORD";
|
|
91007
|
+
STORAGE_KEYS[STORAGE_KEYS["HIGHEST_ACCEPTED_ANCHOR_SEQUENCE"] = 6] = "HIGHEST_ACCEPTED_ANCHOR_SEQUENCE";
|
|
91006
91008
|
})(STORAGE_KEYS || (STORAGE_KEYS = {}));
|
|
91007
91009
|
//#endregion
|
|
91008
91010
|
//#region node_modules/safe-stable-stringify/index.js
|
|
@@ -91692,6 +91694,21 @@ const RpcCommunitiesChangeEventResultSchema = object({ communities: array(string
|
|
|
91692
91694
|
const RpcFetchCidResultSchema = object({ content: string() });
|
|
91693
91695
|
const RpcResolveAuthorNameResultSchema = object({ resolvedAuthorName: string().nullable() });
|
|
91694
91696
|
const RpcSuccessResultSchema = object({ success: literal(true) });
|
|
91697
|
+
const RpcPublishAnchorRecordParamSchema = object({
|
|
91698
|
+
name: string().min(1).optional(),
|
|
91699
|
+
publicKey: string().min(1).optional(),
|
|
91700
|
+
recordBase64: string().min(1)
|
|
91701
|
+
}).refine((args) => args.name || args.publicKey, "At least one of name or publicKey must be provided");
|
|
91702
|
+
const RpcAnchorPublishPreparationResultSchema = object({
|
|
91703
|
+
nextSequence: string().min(1),
|
|
91704
|
+
currentAnchorRecordSequence: string().min(1),
|
|
91705
|
+
hasPersistedAnchorRecord: boolean()
|
|
91706
|
+
});
|
|
91707
|
+
const RpcPublishedAnchorRecordResultSchema = object({
|
|
91708
|
+
sequence: string().min(1),
|
|
91709
|
+
value: string().min(1),
|
|
91710
|
+
anchorPublicKey: string().min(1)
|
|
91711
|
+
});
|
|
91695
91712
|
const RpcSubscriptionIdResultSchema = object({ subscriptionId: SubscriptionIdSchema });
|
|
91696
91713
|
const RpcExportCommunityParamSchema = object({
|
|
91697
91714
|
name: string().min(1).optional(),
|
|
@@ -97797,8 +97814,11 @@ function _allFieldsOfRecordInSignedPropertyNames(record) {
|
|
|
97797
97814
|
for (const field of fieldsOfRecord) if (!record.signature.signedPropertyNames.includes(field)) return false;
|
|
97798
97815
|
return true;
|
|
97799
97816
|
}
|
|
97800
|
-
async function verifyCommunity({ community,
|
|
97817
|
+
async function verifyCommunity({ community, communityIpnsHops, resolveAuthorNames, clientsManager, validatePages, cacheIfValid, abortSignal }) {
|
|
97801
97818
|
const log = logger_default("pkc-js:signatures:verifyCommunity");
|
|
97819
|
+
if (!Array.isArray(communityIpnsHops) || communityIpnsHops.length === 0) throw Error("verifyCommunity needs a non-empty communityIpnsHops to verify a community record against");
|
|
97820
|
+
const communityIdentityIpnsName = communityIpnsHops[0];
|
|
97821
|
+
const terminalIpnsName = communityIpnsHops[communityIpnsHops.length - 1];
|
|
97802
97822
|
if (!_allFieldsOfRecordInSignedPropertyNames(community)) return {
|
|
97803
97823
|
valid: false,
|
|
97804
97824
|
reason: messages.ERR_COMMUNITY_RECORD_INCLUDES_FIELD_NOT_IN_SIGNED_PROPERTY_NAMES
|
|
@@ -97812,11 +97832,11 @@ async function verifyCommunity({ community, communityIpnsName, resolveAuthorName
|
|
|
97812
97832
|
reason: messages.ERR_COMMUNITY_SIGNATURE_IS_INVALID
|
|
97813
97833
|
};
|
|
97814
97834
|
const cacheIfValidWithDefault = typeof cacheIfValid === "boolean" ? cacheIfValid : true;
|
|
97815
|
-
const cacheKey = (0, import_sha256.sha256)(community.signature.signature + validatePages +
|
|
97835
|
+
const cacheKey = (0, import_sha256.sha256)(community.signature.signature + validatePages + communityIpnsHops.join(","));
|
|
97816
97836
|
if (cacheIfValidWithDefault && clientsManager._pkc._memCaches.communityVerificationCache.get(cacheKey)) return { valid: true };
|
|
97817
|
-
const communityAddress = community.name ||
|
|
97837
|
+
const communityAddress = community.name || communityIdentityIpnsName;
|
|
97818
97838
|
const communityForPages = {
|
|
97819
|
-
publicKey:
|
|
97839
|
+
publicKey: communityIdentityIpnsName,
|
|
97820
97840
|
name: community.name,
|
|
97821
97841
|
signature: community.signature
|
|
97822
97842
|
};
|
|
@@ -97848,7 +97868,7 @@ async function verifyCommunity({ community, communityIpnsName, resolveAuthorName
|
|
|
97848
97868
|
};
|
|
97849
97869
|
}
|
|
97850
97870
|
}
|
|
97851
|
-
const communityPeerId = peerIdFromString(
|
|
97871
|
+
const communityPeerId = peerIdFromString(terminalIpnsName);
|
|
97852
97872
|
const signaturePeerId = getPeerIdFromPublicKey(community.signature.publicKey);
|
|
97853
97873
|
if (!communityPeerId.equals(signaturePeerId)) return {
|
|
97854
97874
|
valid: false,
|
|
@@ -101950,7 +101970,7 @@ async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
|
|
|
101950
101970
|
}
|
|
101951
101971
|
async function createKuboRpcClient(kuboRpcClientOptions) {
|
|
101952
101972
|
logger_default("pkc-js:pkc:createKuboRpcClient").trace("Creating a new kubo client on node with options", kuboRpcClientOptions);
|
|
101953
|
-
const { create: CreateKuboRpcClient } = await import("./src-
|
|
101973
|
+
const { create: CreateKuboRpcClient } = await import("./src-BEjAH2gY.js");
|
|
101954
101974
|
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;
|
|
101955
101975
|
const onehourMs = 1e3 * 60 * 60;
|
|
101956
101976
|
return CreateKuboRpcClient({
|
|
@@ -124316,6 +124336,18 @@ const decryptEd25519AesGcmPublicKeyBuffer = async (encrypted, privateKeyBase64,
|
|
|
124316
124336
|
return decrypted;
|
|
124317
124337
|
};
|
|
124318
124338
|
//#endregion
|
|
124339
|
+
//#region dist/node/signer/ipns-record.js
|
|
124340
|
+
const ANCHOR_IPNS_RECORD_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
|
|
124341
|
+
async function createAnchorIpnsRecord({ anchorSigner, minterIpnsName, sequence }) {
|
|
124342
|
+
const { createIPNSRecord, marshalIPNSRecord } = await import("ipns");
|
|
124343
|
+
if (typeof minterIpnsName !== "string" || !minterIpnsName) throw Error("minterIpnsName must be a non-empty IPNS name");
|
|
124344
|
+
peerIdFromString(minterIpnsName);
|
|
124345
|
+
const seq = BigInt(sequence);
|
|
124346
|
+
if (seq < 0n) throw Error("sequence of an anchor IPNS record can not be negative");
|
|
124347
|
+
const ipfsKey = await getIpfsKeyFromPrivateKey(anchorSigner.privateKey);
|
|
124348
|
+
return marshalIPNSRecord(await createIPNSRecord(privateKeyFromProtobuf(new Uint8Array(ipfsKey)), `/ipns/${minterIpnsName}`, seq, ANCHOR_IPNS_RECORD_LIFETIME_MS));
|
|
124349
|
+
}
|
|
124350
|
+
//#endregion
|
|
124319
124351
|
//#region dist/node/signer/index.js
|
|
124320
124352
|
var Signer = class {
|
|
124321
124353
|
constructor(props) {
|
|
@@ -125017,7 +125049,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125017
125049
|
abortSignal: this._community._getStopAbortSignal()
|
|
125018
125050
|
});
|
|
125019
125051
|
this._community.ipnsHops = ipnsHops;
|
|
125020
|
-
|
|
125052
|
+
ipnsHops[ipnsHops.length - 1];
|
|
125021
125053
|
log.trace(`Resolved community IPNS`, ipnsName, `to CID`, latestCommunityCid, `via hops`, ipnsHops);
|
|
125022
125054
|
if (this._updateCidsAlreadyLoaded.has(latestCommunityCid)) {
|
|
125023
125055
|
log.trace("Resolved community IPNS", ipnsName, "to a cid that we already loaded before. No need to fetch its ipfs", latestCommunityCid);
|
|
@@ -125050,8 +125082,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125050
125082
|
const communityIpfs = parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails(parseJsonWithPKCErrorIfFails(rawCommunityJsonString));
|
|
125051
125083
|
const errInRecord = await this._findErrorInCommunityRecord({
|
|
125052
125084
|
communityJson: communityIpfs,
|
|
125053
|
-
|
|
125054
|
-
terminalIpnsName,
|
|
125085
|
+
communityIpnsHops: ipnsHops,
|
|
125055
125086
|
cidOfCommunityIpns: latestCommunityCid
|
|
125056
125087
|
});
|
|
125057
125088
|
if (errInRecord) throw errInRecord;
|
|
@@ -125129,8 +125160,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125129
125160
|
gatewayFetches[gatewayUrl].ipnsHops = ipnsHops;
|
|
125130
125161
|
const errorWithinRecord = await this._findErrorInCommunityRecord({
|
|
125131
125162
|
communityJson: communityIpfs,
|
|
125132
|
-
|
|
125133
|
-
terminalIpnsName,
|
|
125163
|
+
communityIpnsHops: ipnsHops,
|
|
125134
125164
|
cidOfCommunityIpns: calculatedCommunityCidFromBody
|
|
125135
125165
|
});
|
|
125136
125166
|
if (errorWithinRecord) {
|
|
@@ -125300,7 +125330,9 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125300
125330
|
});
|
|
125301
125331
|
}
|
|
125302
125332
|
}
|
|
125303
|
-
async _findErrorInCommunityRecord({ communityJson,
|
|
125333
|
+
async _findErrorInCommunityRecord({ communityJson, communityIpnsHops, cidOfCommunityIpns }) {
|
|
125334
|
+
const anchorIpnsName = communityIpnsHops[0];
|
|
125335
|
+
const terminalIpnsName = communityIpnsHops[communityIpnsHops.length - 1];
|
|
125304
125336
|
const communityInstanceAddress = this._getCommunityAddressFromInstance();
|
|
125305
125337
|
const recordAddress = this._deriveAddressFromWireRecord(communityJson);
|
|
125306
125338
|
const addressMatchesInstance = this._areEquivalentCommunityAddresses(recordAddress, communityInstanceAddress);
|
|
@@ -125329,7 +125361,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125329
125361
|
});
|
|
125330
125362
|
const verificationOpts = {
|
|
125331
125363
|
community: communityJson,
|
|
125332
|
-
|
|
125364
|
+
communityIpnsHops,
|
|
125333
125365
|
resolveAuthorNames: this._pkc.resolveAuthorNames,
|
|
125334
125366
|
clientsManager: this,
|
|
125335
125367
|
validatePages: this._pkc.validatePages,
|
|
@@ -129421,6 +129453,8 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
129421
129453
|
community: this.raw.communityIpfs,
|
|
129422
129454
|
localCommunity: {
|
|
129423
129455
|
signer: this.signer,
|
|
129456
|
+
anchor: this.anchor,
|
|
129457
|
+
anchorRecordSequence: this.anchorRecordSequence,
|
|
129424
129458
|
settings: this.settings,
|
|
129425
129459
|
_usingDefaultChallenge: this._usingDefaultChallenge,
|
|
129426
129460
|
address: this.address,
|
|
@@ -129440,13 +129474,21 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
129440
129474
|
...this._toJSONIpfsBaseNoPosts(),
|
|
129441
129475
|
address: this.address,
|
|
129442
129476
|
signer: this.signer,
|
|
129477
|
+
anchor: this.anchor,
|
|
129478
|
+
anchorRecordSequence: this.anchorRecordSequence,
|
|
129443
129479
|
settings: this.settings,
|
|
129444
129480
|
_usingDefaultChallenge: this._usingDefaultChallenge,
|
|
129445
129481
|
started: this.started,
|
|
129446
129482
|
startedState: this.startedState
|
|
129447
129483
|
} };
|
|
129448
129484
|
}
|
|
129485
|
+
_replayAnchorIntoIpnsHops(localProps) {
|
|
129486
|
+
this.anchor = localProps.anchor;
|
|
129487
|
+
this.anchorRecordSequence = localProps.anchorRecordSequence;
|
|
129488
|
+
if (localProps.anchor) this.ipnsHops = [localProps.anchor.publicKey, localProps.signer.address];
|
|
129489
|
+
}
|
|
129449
129490
|
initRpcInternalCommunityBeforeFirstUpdateNoMerge(newProps) {
|
|
129491
|
+
this._replayAnchorIntoIpnsHops(newProps.localCommunity);
|
|
129450
129492
|
this.initRemoteCommunityPropsNoMerge(newProps.localCommunity);
|
|
129451
129493
|
if (newProps.localCommunity.address) this.setAddress(newProps.localCommunity.address);
|
|
129452
129494
|
this.signer = newProps.localCommunity.signer;
|
|
@@ -129456,6 +129498,7 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
129456
129498
|
this.raw.localCommunity = newProps;
|
|
129457
129499
|
}
|
|
129458
129500
|
initRpcInternalCommunityAfterFirstUpdateNoMerge(newProps) {
|
|
129501
|
+
this._replayAnchorIntoIpnsHops(newProps.localCommunity);
|
|
129459
129502
|
super.initCommunityIpfsPropsNoMerge(newProps.community);
|
|
129460
129503
|
if (newProps.localCommunity.address) this.setAddress(newProps.localCommunity.address);
|
|
129461
129504
|
this.signer = newProps.localCommunity.signer;
|
|
@@ -129583,6 +129626,21 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
129583
129626
|
this.started = false;
|
|
129584
129627
|
untrackStartedCommunity(this._pkc, this);
|
|
129585
129628
|
}
|
|
129629
|
+
async prepareAnchorPublish() {
|
|
129630
|
+
return this._pkc._pkcRpcClient.prepareAnchorPublish({
|
|
129631
|
+
name: this.name,
|
|
129632
|
+
publicKey: this.publicKey
|
|
129633
|
+
});
|
|
129634
|
+
}
|
|
129635
|
+
async publishAnchorRecord(recordBytes) {
|
|
129636
|
+
const result = await this._pkc._pkcRpcClient.publishAnchorRecord({
|
|
129637
|
+
name: this.name,
|
|
129638
|
+
publicKey: this.publicKey,
|
|
129639
|
+
recordBase64: toString(recordBytes, "base64")
|
|
129640
|
+
});
|
|
129641
|
+
this.anchorRecordSequence = result.sequence;
|
|
129642
|
+
return result;
|
|
129643
|
+
}
|
|
129586
129644
|
async stop() {
|
|
129587
129645
|
this.posts._stop();
|
|
129588
129646
|
if (this.state === "updating") return super.stop();
|
|
@@ -129728,4 +129786,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
129728
129786
|
}
|
|
129729
129787
|
};
|
|
129730
129788
|
//#endregion
|
|
129731
|
-
export {
|
|
129789
|
+
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 };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
2
|
import { Buffer } from "buffer";
|
|
3
3
|
import { CID } from "multiformats/cid";
|
|
4
|
+
import { peerIdFromString } from "@libp2p/peer-id";
|
|
4
5
|
import * as Digest from "multiformats/hashes/digest";
|
|
5
6
|
import { base58btc } from "multiformats/bases/base58";
|
|
6
7
|
import { of } from "typestub-ipfs-only-hash";
|
|
7
8
|
import { toString } from "uint8arrays/to-string";
|
|
8
9
|
import { base32 } from "multiformats/bases/base32";
|
|
9
|
-
import { peerIdFromString } from "@libp2p/peer-id";
|
|
10
10
|
Object.freeze({ status: "aborted" });
|
|
11
11
|
function $constructor(name, initializer, params) {
|
|
12
12
|
function init(inst, def) {
|
|
@@ -5156,7 +5156,7 @@ var messages;
|
|
|
5156
5156
|
messages["ERR_TIMEOUT_WAITING_FOR_PUBSUB_TOPIC_PEERS"] = "Timeout waiting for propagation of pubsub topic peers";
|
|
5157
5157
|
messages["ERR_PUBSUB_TOPIC_PEER_WAIT_ABORTED"] = "Aborted while waiting for a peer to subscribe to a pubsub topic";
|
|
5158
5158
|
messages["ERR_IPNS_DIRECT_FETCH_ABORTED"] = "Aborted while fetching an IPNS record directly from subscribers/providers";
|
|
5159
|
-
messages["ERR_TIMED_OUT_RM_MFS_FILE"] = "Timed out removing MFS paths
|
|
5159
|
+
messages["ERR_TIMED_OUT_RM_MFS_FILE"] = "Timed out removing MFS paths";
|
|
5160
5160
|
messages["ERR_ABORTED_RESOLVING_TEXT_RECORD"] = "Aborted resolving text record on domain";
|
|
5161
5161
|
messages["ERR_CALLED_COMMUNITY_STOP_WITHOUT_UPDATE"] = "community.stop() called without calling update() first";
|
|
5162
5162
|
messages["ERR_PKC_MISSING_NATIVE_FUNCTIONS"] = "missing nativeFunctions required to create a community";
|
|
@@ -5166,6 +5166,15 @@ var messages;
|
|
|
5166
5166
|
messages["ERR_FAILED_TO_SET_CONFIG_ON_KUBO_NODE"] = "Failed to set config on kubo node";
|
|
5167
5167
|
messages["ERR_FAILED_TO_SHUTDOWN_KUBO_NODE"] = "Failed to shutdown kubo node";
|
|
5168
5168
|
messages["ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY"] = "Can't create a new local community with the provided arguments";
|
|
5169
|
+
messages["ERR_CAN_NOT_CREATE_A_COMMUNITY_WITH_BOTH_SIGNER_AND_ANCHOR"] = "Can't create a community with both a signer and an anchor: a signer means the node holds the identity key, an anchor means the owner does";
|
|
5170
|
+
messages["ERR_CAN_NOT_CREATE_A_COMMUNITY_WITH_BOTH_ANCHOR_AND_IDENTIFIER"] = "Can't create a community with both an anchor and an address/name/publicKey: a delegated community is keyed by its anchor, so any other identifier would be silently ignored";
|
|
5171
|
+
messages["ERR_ANCHOR_PUBLIC_KEY_IS_INVALID"] = "anchor.publicKey is not a valid IPNS name: it becomes the community's address, so it has to be the same B58 representation community.publicKey uses";
|
|
5172
|
+
messages["ERR_COMMUNITY_IS_NOT_DELEGATED"] = "This community has no anchor, so it publishes under its own key and has no anchor record to prepare or publish";
|
|
5173
|
+
messages["ERR_UNABLE_TO_DETERMINE_ANCHOR_SEQUENCE"] = "Unable to determine the next anchor record sequence: neither this node nor the network knows one, and answering 0 could produce a record that can never win";
|
|
5174
|
+
messages["ERR_ANCHOR_IPNS_RECORD_IS_INVALID"] = "The anchor IPNS record is malformed or is not signed by the community's anchor key";
|
|
5175
|
+
messages["ERR_ANCHOR_IPNS_RECORD_POINTS_TO_DIFFERENT_MINTER"] = "The anchor IPNS record does not point at this node's minter key for this community";
|
|
5176
|
+
messages["ERR_ANCHOR_IPNS_RECORD_SEQUENCE_IS_NOT_GREATER"] = "The anchor IPNS record's sequence is not strictly greater than the highest already accepted (replay or rollback)";
|
|
5177
|
+
messages["ERR_DELEGATED_COMMUNITY_HAS_NO_ANCHOR_RECORD"] = "Can't start a delegated community before its anchor record has been published: nothing points the anchor at this node's minter, so the community would not be resolvable";
|
|
5169
5178
|
messages["ERR_COMMUNITY_ADDRESS_IS_PROVIDED_AS_NULL_OR_UNDEFINED"] = "User provided options.address in createCommunity that is either undefined or null";
|
|
5170
5179
|
messages["ERR_UNABLE_TO_DERIVE_PUBSUB_COMMENT_PUBLICATION_FROM_JSONIFIED_COMMENT"] = "User provided a jsonfied (cloned) Comment and we're unable to derive request.comment from it. This is an implementation error";
|
|
5171
5180
|
messages["ERR_UNABLE_TO_DERIVE_PUBSUB_COMMENT_EDIT_PUBLICATION_FROM_JSONIFIED_COMMENT_EDIT"] = "User provided a jsonfied (cloned) CommentEdit and we're unable to derive request.commentEdit from it. This is an implementation error";
|
|
@@ -5479,6 +5488,7 @@ var messages;
|
|
|
5479
5488
|
messages["ERR_RPC_CLIENT_TRYING_TO_STOP_REMOTE_COMMUNITY"] = "RPC client is attempting to stop a remote community";
|
|
5480
5489
|
messages["ERR_RPC_CLIENT_TRYING_TO_EDIT_REMOTE_COMMUNITY"] = "RPC client is attempting to edit remote community";
|
|
5481
5490
|
messages["ERR_RPC_CLIENT_TRYING_TO_DELETE_REMOTE_COMMUNITY"] = "RPC client is attempting to delete remote community";
|
|
5491
|
+
messages["ERR_RPC_CLIENT_TRYING_TO_USE_ANCHOR_METHOD_ON_NON_LOCAL_COMMUNITY"] = "RPC client is attempting to prepare or publish an anchor record for a community this node does not host locally";
|
|
5482
5492
|
messages["ERR_GENERIC_RPC_CLIENT_CALL_ERROR"] = "RPC client received an unknown error when executing call over websocket";
|
|
5483
5493
|
messages["ERR_RPC_CALL_TIMED_OUT"] = "RPC client call timed out without receiving a response from the RPC server";
|
|
5484
5494
|
messages["ERR_RPC_CLIENT_CHALLENGE_NAME_NOT_AVAILABLE_ON_SERVER"] = "The challenge name is not available on the RPC server. Available challenges are listed in details.availableChallenges";
|
|
@@ -6104,6 +6114,13 @@ const isIpfsCid$1 = (value) => {
|
|
|
6104
6114
|
return false;
|
|
6105
6115
|
}
|
|
6106
6116
|
};
|
|
6117
|
+
const isIpnsName = (value) => {
|
|
6118
|
+
try {
|
|
6119
|
+
return Boolean(peerIdFromString(value));
|
|
6120
|
+
} catch {
|
|
6121
|
+
return false;
|
|
6122
|
+
}
|
|
6123
|
+
};
|
|
6107
6124
|
const CidStringSchema = string().refine((arg) => isIpfsCid$1(arg), messages.ERR_CID_IS_INVALID);
|
|
6108
6125
|
const CidPathSchema = string().transform((arg) => arg.split("/")[2]).refine((arg) => isIpfsCid$1(arg), messages.ERR_CID_IS_INVALID);
|
|
6109
6126
|
const ChainTickerSchema$1 = string().min(1);
|
|
@@ -6708,8 +6725,10 @@ const CommunityEditOptionsSchema = CommunityIpfsSchema.pick({
|
|
|
6708
6725
|
settings: CommunitySettingsSchema.optional(),
|
|
6709
6726
|
roles: CommunityRolesToEditSchema.optional()
|
|
6710
6727
|
}).partial().strict();
|
|
6728
|
+
const CommunityAnchorSchema = object({ publicKey: string().refine((arg) => isIpnsName(arg), messages.ERR_ANCHOR_PUBLIC_KEY_IS_INVALID) }).strict();
|
|
6711
6729
|
const CreateNewLocalCommunityUserOptionsSchema = CommunityEditOptionsSchema.omit({ address: true }).extend({
|
|
6712
6730
|
signer: CreateSignerSchema.optional(),
|
|
6731
|
+
anchor: CommunityAnchorSchema.optional(),
|
|
6713
6732
|
roles: CommunityIpfsSchema.shape.roles
|
|
6714
6733
|
}).strict();
|
|
6715
6734
|
CreateNewLocalCommunityUserOptionsSchema.extend({
|
|
@@ -6766,6 +6785,7 @@ const CommunityIpfsReservedFields = r$2([
|
|
|
6766
6785
|
"shortAddress",
|
|
6767
6786
|
"nameResolved",
|
|
6768
6787
|
"ipnsHops",
|
|
6788
|
+
"anchor",
|
|
6769
6789
|
"raw",
|
|
6770
6790
|
"shortCommunityAddress",
|
|
6771
6791
|
"deleted",
|
|
@@ -15740,7 +15760,11 @@ async function retryKuboIpfsAdd({ ipfsClient: kuboRpcClient, log, content, input
|
|
|
15740
15760
|
}
|
|
15741
15761
|
async function writeKuboFilesWithTimeout({ ipfsClient: kuboRpcClient, log, path, content, inputNumOfRetries, options, timeoutMs }) {
|
|
15742
15762
|
const numOfRetries = inputNumOfRetries ?? 3;
|
|
15743
|
-
const timeoutMilliseconds = timeoutMs ??
|
|
15763
|
+
const timeoutMilliseconds = timeoutMs ?? 6e4;
|
|
15764
|
+
const writeOptions = {
|
|
15765
|
+
timeout: timeoutMilliseconds,
|
|
15766
|
+
...options
|
|
15767
|
+
};
|
|
15744
15768
|
return new Promise((resolve, reject) => {
|
|
15745
15769
|
const operation = import_retry.operation({
|
|
15746
15770
|
retries: numOfRetries,
|
|
@@ -15749,9 +15773,9 @@ async function writeKuboFilesWithTimeout({ ipfsClient: kuboRpcClient, log, path,
|
|
|
15749
15773
|
});
|
|
15750
15774
|
operation.attempt(async (currentAttempt) => {
|
|
15751
15775
|
try {
|
|
15752
|
-
await pTimeout(kuboRpcClient.files.write(path, content,
|
|
15753
|
-
milliseconds: timeoutMilliseconds,
|
|
15754
|
-
message: `Timed out writing to MFS path ${path} after ${timeoutMilliseconds}ms`
|
|
15776
|
+
await pTimeout(kuboRpcClient.files.write(path, content, writeOptions), {
|
|
15777
|
+
milliseconds: timeoutMilliseconds + 5e3,
|
|
15778
|
+
message: `Timed out writing to MFS path ${path} after ${timeoutMilliseconds + 5e3}ms`
|
|
15755
15779
|
});
|
|
15756
15780
|
resolve();
|
|
15757
15781
|
} catch (error) {
|
|
@@ -16035,7 +16059,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
|
|
|
16035
16059
|
}
|
|
16036
16060
|
//#endregion
|
|
16037
16061
|
//#region dist/node/generated-version.js
|
|
16038
|
-
const version = "0.0.
|
|
16062
|
+
const version = "0.0.77";
|
|
16039
16063
|
//#endregion
|
|
16040
16064
|
//#region dist/node/version.js
|
|
16041
16065
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
@@ -16189,4 +16213,4 @@ const DecryptedChallengeVerificationSchema = object({
|
|
|
16189
16213
|
}).strict();
|
|
16190
16214
|
const ChallengeVerificationMessageSignedPropertyNames = t$3(n$3(ChallengeVerificationMessageSchema.shape, ["signature"]));
|
|
16191
16215
|
//#endregion
|
|
16192
|
-
export { pubsubTopicToDhtKey as $,
|
|
16216
|
+
export { pubsubTopicToDhtKey as $, n$3 as $n, CommunityChallengeSettingSchema as $t, extractNetworkErrorDetails as A, CommentsTableRowSchema as An, object as Ar, trackStartedCommunity as At, isIpfsCid as B, CommentEditsTableRowSchema as Bn, CommunityEditPublicationPubsubReservedFields as Bt, contentContainsMarkdownAudio as C, CommentUpdateChallengeReservedFieldNames as Cn, setErrorMap as Cr, findUpdatingCommunity as Ct, deepMergeRuntimeFields as D, CommentUpdateSchema as Dn, custom as Dr, refreshTrackedCommentAliases as Dt, createAbortError as E, CommentUpdateReservedFields as En, boolean as Er, listUpdatingCommunities as Et, getIpnsRecordInLocalKuboNode as F, CommentEditChallengeRequestToEncryptSchema as Fn, parsedType as Fr, untrackUpdatingCommunity as Ft, isLinkOfAudio as G, ChallengeAnswersSchema as Gn, CommentModerationPubsubMessagePublicationSchema as Gt, isIpns as H, AuthorAddressSchema as Hn, CommunityEditPubsubMessagePublicationSchema as Ht, getPostUpdateTimestampRange as I, CommentEditPubsubMessagePublicationSchema as In, stringifyPrimitive as Ir, require_sha256 as It, isLinkOfVideo as J, CommunityAddressSchema as Jn, CommentModerationsTableRowSchema as Jt, isLinkOfImage as K, CidPathSchema as Kn, CommentModerationReservedFields as Kt, hideClassPrivateProps as L, CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema as Ln, TimeoutError as Lt, genToArray as M, GetPageParamSchema as Mn, string as Mr, trackUpdatingCommunity as Mt, getEquivalentCommunityAddresses as N, ModQueuePageIpfsSchema as Nn, ZodError as Nr, untrackStartedCommunity as Nt, derivePublicationFromChallengeRequest as O, CommentUpdateSignedPropertyNames as On, literal as Or, refreshTrackedCommunityAliases as Ot, getErrorCodeFromMessage as P, PageIpfsSchema as Pn, joinValues as Pr, untrackUpdatingComment as Pt, isStringDomain as Q, t$1 as Qn, CommunityAnchorSchema as Qt, ipnsNameToIpnsOverPubsubTopic as R, CommentEditReservedFields as Rn, pTimeout as Rt, calculateStringSizeSameAsIpfsAddCidV0 as S, CommentSignedPropertyNames as Sn, require_ms as Sr, findUpdatingComment as St, contentContainsMarkdownVideos as T, CommentUpdateForChallengeVerificationSignedPropertyNames as Tn, array as Tr, listUpdatingComments as Tt, isIpnsPath as U, AuthorCommentIpfsReservedFields as Un, CreateCommunityEditPublicationOptionsWithRefinementSchema as Ut, isIpfsPath as V, CreateCommentEditOptionsWithRefinementSchema as Vn, CommunityEditPublicationSignedPropertyNames as Vt, isLinkOfAnimatedImage as W, AuthorReservedFields as Wn, CommentModerationChallengeRequestToEncryptSchema as Wt, isRequestPubsubPublicationOfPost as X, CreateSignerSchema as Xn, ChallengeFileFactorySchema as Xt, isLinkValid as Y, CommunityAuthorChallengeReservedFieldNames as Yn, CreateCommentModerationOptionsWithRefinementSchema as Yt, isRequestPubsubPublicationOfReply as Z, n as Zn, ChallengeFileSchema as Zt, PKCUserOptionBaseSchema as _, CommentChallengeRequestToEncryptSchema as _n, FailedToFetchPageIpfsFromGatewaysError as _r, timestamp as _t, ChallengeRequestMessageSchema as a, CreateNewLocalCommunityUserOptionsSchema as an, r$2 as ar, removeNullUndefinedValues as at, areEquivalentCommunityAddresses as b, CommentPubsubMessageReservedFields as bn, logger_default as br, findCommunityInRegistry as bt, ChallengeVerificationMessageSignedPropertyNames as c, ExportCommunityModLogsOptionsSchema as cn, r$4 as cr, resolveWhenPredicateIsTrue as ct, DecryptedChallengeRequestSchema as d, CreateVoteUserOptionsWithRefinementSchema as dn, e$4 as dr, retryKuboIpfsAddAndProvide as dt, CommunityEditOptionsSchema as en, t$2 as er, pubsubTopicToDhtKeyCid as et, DecryptedChallengeSchema as f, VoteChallengeRequestToEncryptSchema as fn, require_retry as fr, shortifyAddress as ft, PKCParsedOptionsSchema as g, VoteTablesRowSchema as gn, FailedToFetchGenericIpfsFromGatewaysError as gr, throwIfAbortSignalAborted as gt, NameResolverSerializedSchema as h, VoteSignedPropertyNames as hn, FailedToFetchCommunityFromGatewaysError as hr, statMfsPathSafely as ht, ChallengeMessageSignedPropertyNames as i, CommunitySignedPropertyNames as in, t$4 as ir, removeNullUndefinedEmptyObjectsValuesRecursively as it, fetchAndValidateIpnsRecordFromGateway as j, CreateCommentOptionsWithRefinementSchema as jn, record as jr, trackUpdatingComment as jt, doesDomainAddressHaveCapitalLetter as k, CommentUpdateTableRowSchema as kn, number as kr, syncCommunityRegistryEntry as kt, DecryptedChallengeAnswerSchema as l, PubsubTopicSchema as ln, t$7 as lr, retryKuboBlockPutPinAndProvidePubsubTopic as lt, NameResolveCacheOptionsSchema as m, VotePubsubReservedFields as mn, FailedToFetchCommentUpdateFromGatewaysError as mr, sleepUntilTimeoutOrAbort as mt, ChallengeAnswerMessageSignedPropertyNames as n, CommunityIpfsReservedFields as nn, e as nr, removeBlocksFromKuboNode as nt, ChallengeRequestMessageSignedPropertyNames as o, CreateRemoteCommunityFunctionArgumentSchema as on, t$5 as or, removeUndefinedValuesRecursively as ot, DecryptedChallengeVerificationSchema as p, VotePubsubMessagePublicationSchema as pn, FailedToFetchCommentIpfsFromGatewaysError as pr, shortifyCid as pt, isLinkOfMedia as q, CidStringSchema as qn, CommentModerationSignedPropertyNames as qt, ChallengeMessageSchema as r, CommunityIpfsSchema as rn, e$2 as rr, removeMfsFilesSafely as rt, ChallengeVerificationMessageSchema as s, CreateRpcCommunityFunctionArgumentSchema as sn, n$7 as sr, replaceXWithY as st, ChallengeAnswerMessageSchema as t, CommunityExportRecordsSchema as tn, t$3 as tr, raceAgainstAbort as tt, DecryptedChallengeRequestPublicationSchema as u, RpcRemoteCommunityUpdateEventResultSchema as un, t$8 as ur, retryKuboIpfsAdd as ut, PKCUserOptionsSchema as v, CommentIpfsReservedFields as vn, PKCError as vr, waitForUpdateInCommunityInstanceWithErrorAndTimeout as vt, contentContainsMarkdownImages as w, CommentUpdateForChallengeVerificationSchema as wn, _enum as wr, listStartedCommunities as wt, calculateIpfsCidV0 as x, CommentPubsubMessageWithFlexibleAuthorRefinementSchema as xn, require_supports_color as xr, findStartedCommunity as xt, version_default as y, CommentIpfsSchema as yn, messages as yr, writeKuboFilesWithTimeout as yt, isAbortError as z, CommentEditSignedPropertyNames as zn, CommunityEditPublicationChallengeRequestToEncryptSchema as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { et as pubsubTopicToDhtKeyCid, vr as PKCError } from "./schema-Bu4z3MGE.js";
|
|
2
2
|
import { ipnsSelector } from "ipns/selector";
|
|
3
3
|
import { equals } from "uint8arrays/equals";
|
|
4
4
|
//#region dist/node/helia/util.js
|
|
@@ -15,5 +15,6 @@ const nativeFunctions = index.nativeFunctions;
|
|
|
15
15
|
const getShortCid = index.getShortCid;
|
|
16
16
|
const getShortAddress = index.getShortAddress;
|
|
17
17
|
const challenges = index.challenges;
|
|
18
|
+
const createAnchorIpnsRecord = index.createAnchorIpnsRecord;
|
|
18
19
|
//#endregion
|
|
19
|
-
export { challenges, index_with_compile_cache_default as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
|
|
20
|
+
export { challenges, createAnchorIpnsRecord, index_with_compile_cache_default as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
|