@pkcprotocol/pkc-js 0.0.124 → 0.0.126
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 +54 -54
- package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +3 -1
- package/dist/browser/clients/rpc-client/pkc-rpc-client.js +18 -3
- package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +16 -0
- package/dist/browser/clients/rpc-client/rpc-schema-util.js +6 -1
- package/dist/browser/clients/rpc-client/rpc-schema-util.js.map +1 -1
- package/dist/browser/clients/rpc-client/schema.d.ts +12 -0
- package/dist/browser/clients/rpc-client/schema.js +9 -0
- package/dist/browser/clients/rpc-client/schema.js.map +1 -1
- package/dist/browser/clients/rpc-client/types.d.ts +5 -1
- package/dist/browser/community/community-client-manager.js +30 -9
- package/dist/browser/community/community-client-manager.js.map +1 -1
- package/dist/browser/community/community-wire.d.ts +6 -0
- package/dist/browser/community/community-wire.js +22 -1
- package/dist/browser/community/community-wire.js.map +1 -1
- package/dist/browser/community/remote-community.d.ts +7 -1
- package/dist/browser/community/remote-community.js +87 -11
- package/dist/browser/community/remote-community.js.map +1 -1
- package/dist/browser/community/rpc-remote-community.d.ts +1 -0
- package/dist/browser/community/rpc-remote-community.js +41 -6
- package/dist/browser/community/rpc-remote-community.js.map +1 -1
- package/dist/browser/community/schema.js +7 -1
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/community-list/community-list.d.ts +143 -0
- package/dist/browser/community-list/community-list.js +401 -0
- package/dist/browser/community-list/community-list.js.map +1 -0
- package/dist/browser/community-list/schema.d.ts +239 -0
- package/dist/browser/community-list/schema.js +95 -0
- package/dist/browser/community-list/schema.js.map +1 -0
- package/dist/browser/community-list/types.d.ts +19 -0
- package/dist/browser/community-list/types.js +2 -0
- package/dist/browser/community-list/types.js.map +1 -0
- package/dist/browser/errors.d.ts +19 -1
- package/dist/browser/errors.js +19 -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/index.d.ts +2 -0
- package/dist/browser/pkc/pkc-client-manager.d.ts +4 -1
- package/dist/browser/pkc/pkc-client-manager.js +6 -4
- package/dist/browser/pkc/pkc-client-manager.js.map +1 -1
- package/dist/browser/pkc/pkc.d.ts +7 -0
- package/dist/browser/pkc/pkc.js +93 -0
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/pkc/tracked-instance-registry-util.d.ts +1 -0
- package/dist/browser/pkc/tracked-instance-registry-util.js +34 -2
- package/dist/browser/pkc/tracked-instance-registry-util.js.map +1 -1
- package/dist/browser/pkc/tracked-instance-registry.d.ts +1 -0
- package/dist/browser/pkc/tracked-instance-registry.js +15 -0
- package/dist/browser/pkc/tracked-instance-registry.js.map +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/publications/comment/comment-client-manager.d.ts +1 -0
- package/dist/browser/publications/comment/comment-client-manager.js +24 -4
- package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
- package/dist/browser/publications/comment/comment.js +6 -2
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/publications/publication-client-manager.d.ts +4 -1
- package/dist/browser/publications/publication-client-manager.js +51 -7
- package/dist/browser/publications/publication-client-manager.js.map +1 -1
- package/dist/browser/publications/publication.js +15 -1
- package/dist/browser/publications/publication.js.map +1 -1
- package/dist/browser/rpc/src/index.d.ts +3 -1
- package/dist/browser/rpc/src/index.js +45 -3
- package/dist/browser/rpc/src/index.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/comment-updates.js +2 -1
- package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
- package/dist/browser/schema/schema-util.d.ts +3 -0
- package/dist/browser/schema/schema-util.js +10 -0
- package/dist/browser/schema/schema-util.js.map +1 -1
- package/dist/browser/signer/signatures.d.ts +9 -0
- package/dist/browser/signer/signatures.js +30 -1
- package/dist/browser/signer/signatures.js.map +1 -1
- package/dist/browser/test/test-util.d.ts +1 -0
- package/dist/browser/test/test-util.js +6 -2
- package/dist/browser/test/test-util.js.map +1 -1
- package/dist/browser/util.js +6 -1
- package/dist/browser/util.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +62 -58
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc-DfpR6JSl.js → helia-for-pkc-vQZvQcs_.js} +33 -33
- package/dist/bundled/chunks/{local-community-Ll4pUOKV.js → local-community-51NzNBUS.js} +32 -32
- package/dist/bundled/chunks/{local-community-CQ9M4cEY.js → local-community-dcM1R3k5.js} +1 -1
- package/dist/bundled/chunks/{node-BWOsSCO-.js → node-agDtcKUp.js} +487 -120
- package/dist/bundled/chunks/{page-sort-scoring-Y3zgv-l4.js → page-sort-scoring-BSBLegpC.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-D8wgBsuD.js → rpc-local-community-DOcUqswi.js} +2580 -1077
- package/dist/bundled/chunks/{util-IESnqTnj.js → util-DNYbha6W.js} +1 -1
- package/dist/bundled/chunks/{util-Bd4vp_w6.js → util-PGPkG-gU.js} +2736 -994
- package/dist/bundled/chunks/{validate-package-factories-D527vDd_.js → validate-package-factories-2U8SCIxZ.js} +2 -2
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/page-sorts.js +1 -1
- package/dist/bundled/rpc/src/index.js +31 -4
- package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +3 -1
- package/dist/node/clients/rpc-client/pkc-rpc-client.js +18 -3
- package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +16 -0
- package/dist/node/clients/rpc-client/rpc-schema-util.js +6 -1
- package/dist/node/clients/rpc-client/rpc-schema-util.js.map +1 -1
- package/dist/node/clients/rpc-client/schema.d.ts +12 -0
- package/dist/node/clients/rpc-client/schema.js +9 -0
- package/dist/node/clients/rpc-client/schema.js.map +1 -1
- package/dist/node/clients/rpc-client/types.d.ts +5 -1
- package/dist/node/community/community-client-manager.js +30 -9
- package/dist/node/community/community-client-manager.js.map +1 -1
- package/dist/node/community/community-wire.d.ts +6 -0
- package/dist/node/community/community-wire.js +22 -1
- package/dist/node/community/community-wire.js.map +1 -1
- package/dist/node/community/remote-community.d.ts +7 -1
- package/dist/node/community/remote-community.js +87 -11
- package/dist/node/community/remote-community.js.map +1 -1
- package/dist/node/community/rpc-remote-community.d.ts +1 -0
- package/dist/node/community/rpc-remote-community.js +41 -6
- package/dist/node/community/rpc-remote-community.js.map +1 -1
- package/dist/node/community/schema.js +7 -1
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/community-list/community-list.d.ts +143 -0
- package/dist/node/community-list/community-list.js +401 -0
- package/dist/node/community-list/community-list.js.map +1 -0
- package/dist/node/community-list/schema.d.ts +239 -0
- package/dist/node/community-list/schema.js +95 -0
- package/dist/node/community-list/schema.js.map +1 -0
- package/dist/node/community-list/types.d.ts +19 -0
- package/dist/node/community-list/types.js +2 -0
- package/dist/node/community-list/types.js.map +1 -0
- package/dist/node/errors.d.ts +19 -1
- package/dist/node/errors.js +19 -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/index.d.ts +2 -0
- package/dist/node/pkc/pkc-client-manager.d.ts +4 -1
- package/dist/node/pkc/pkc-client-manager.js +6 -4
- package/dist/node/pkc/pkc-client-manager.js.map +1 -1
- package/dist/node/pkc/pkc.d.ts +7 -0
- package/dist/node/pkc/pkc.js +93 -0
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/pkc/tracked-instance-registry-util.d.ts +1 -0
- package/dist/node/pkc/tracked-instance-registry-util.js +34 -2
- package/dist/node/pkc/tracked-instance-registry-util.js.map +1 -1
- package/dist/node/pkc/tracked-instance-registry.d.ts +1 -0
- package/dist/node/pkc/tracked-instance-registry.js +15 -0
- package/dist/node/pkc/tracked-instance-registry.js.map +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/publications/comment/comment-client-manager.d.ts +1 -0
- package/dist/node/publications/comment/comment-client-manager.js +24 -4
- package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
- package/dist/node/publications/comment/comment.js +6 -2
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/publications/publication-client-manager.d.ts +4 -1
- package/dist/node/publications/publication-client-manager.js +51 -7
- package/dist/node/publications/publication-client-manager.js.map +1 -1
- package/dist/node/publications/publication.js +15 -1
- package/dist/node/publications/publication.js.map +1 -1
- package/dist/node/rpc/src/index.d.ts +3 -1
- package/dist/node/rpc/src/index.js +45 -3
- package/dist/node/rpc/src/index.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/comment-updates.js +2 -1
- package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
- package/dist/node/schema/schema-util.d.ts +3 -0
- package/dist/node/schema/schema-util.js +10 -0
- package/dist/node/schema/schema-util.js.map +1 -1
- package/dist/node/signer/signatures.d.ts +9 -0
- package/dist/node/signer/signatures.js +30 -1
- package/dist/node/signer/signatures.js.map +1 -1
- package/dist/node/test/test-util.d.ts +1 -0
- package/dist/node/test/test-util.js +6 -2
- package/dist/node/test/test-util.js.map +1 -1
- package/dist/node/util.js +6 -1
- package/dist/node/util.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as
|
|
3
|
-
import { $ as parseCidStringSchemaWithPKCErrorIfItFails, $t as
|
|
4
|
-
import { s as getHeliaDebugContext } from "./util-
|
|
2
|
+
import { $ as retryKuboIpfsAddAndProvide, At as ChallengeAnswerMessageSchema, C as hideClassPrivateProps, D as isIpfsCid, Dt as require_sha256, E as isAbortError, Et as untrackUpdatingCommunity, H as rejectWhenAbortSignalFires, Hr as setErrorMap, It as ChallengeVerificationMessageSchema, J as removeUndefinedValuesRecursively, Jt as version_default, Lr as PKCError, Mr as FailedToFetchCommentIpfsFromGatewaysError, Mt as ChallengeMessageSchema, Nn as CommentIpfsSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Ot as TimeoutError, Pt as ChallengeRequestMessageSchema, Q as retryKuboIpfsAdd, Rn as CommentUpdateForChallengeVerificationSchema, Rr as messages, Sr as e$1, St as trackUpdatingComment, T as ipnsNameToIpnsOverPubsubTopic, Tt as untrackUpdatingComment, U as rejectWhenCommunityStopsOrAborts, Vn as CommentUpdateSchema, X as resolveWhenPredicateIsTrue, Y as replaceXWithY, _t as listUpdatingCommunities, a as calculateStringSizeSameAsIpfsAddCidV0Sync, at as timestamp, br as t$1, cn as CommunityAnchorSchema, d as deepMergeRuntimeFields, dt as findStartedCommunity, et as shortifyAddress, ft as findUpdatingComment, gr as n$2, gt as listUpdatingComments, ht as listStartedCommunities, i as calculateStringSizeSameAsIpfsAddCidV0, it as throwIfAbortSignalAborted, jr as require_retry, k as isIpns, kt as pTimeout, ni as en_default, nt as sleepUntilTimeoutOrAbort, ot as waitForUpdateInCommunityInstanceWithErrorAndTimeout, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, t as areEquivalentCommunityAddresses, tt as shortifyCid, u as createAbortError, vr as n$1, vt as refreshTrackedCommentAliases, wn as isStringDomain, wr as r, x as getPostUpdateTimestampRange, xn as PubsubTopicSchema, xr as e, zr as logger_default } from "./util-PGPkG-gU.js";
|
|
3
|
+
import { $ as parseCidStringSchemaWithPKCErrorIfItFails, $n as getCommunityNameFromWire, $t as RpcPublishedAnchorRecordResultSchema, A as findCommentInParsedPages, At as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, B as InflightFetchManager, Bn as verifyVote, Br as NAME_RESOLVED_TRUE_TTL_MS, Bt as RpcEditCommunityParamSchema, C as RepliesPages, Cr as monitorCommunitiesDirectory, Ct as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, D as extractCommunityRuntimeFieldsFromParsedPages, Dn as signVote, Dr as setNativeFunctions$1, Dt as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, En as signCommunityList, Et as parseJsonWithPKCErrorIfFails, F as collectCrosspostAuthorsToResolve, Fn as verifyCommentPubsubMessage, Fr as t$2, Ft as RpcCancelExportParamSchema, G as decodeRpcChallengeAnswerPubsubMsg, Gn as normalizeCreatePublicationAuthor, Gr as require_undici, Gt as RpcFetchCidParamSchema, Hn as cleanWireAuthor, Ht as RpcExportCommunityModLogsResultSchema, In as verifyCommentUpdate, Ir as t$4, It as RpcCidParamSchema, J as decodeRpcChallengeVerificationPubsubMsg, Jn as MAX_COMMUNITY_LIST_SIZE_BYTES, Jt as RpcFetchCommunityListResultSchema, K as decodeRpcChallengePubsubMsg, Kn as CreateCommunityListWithCidOptionsSchema, Kt as RpcFetchCidResultSchema, L as stripNameResolvedFromCrosspost, Lt as RpcCommentRepliesPageParamSchema, M as parseRawPages, Mn as verifyCommentEdit, Mr as t$3, Mt as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, N as applyNameResolvedCacheToCrosspost, Nn as verifyCommentIpfs, Nr as n$3, Nt as RpcAnchorPublishPreparationResultSchema, O as findCommentInPageInstance, Or as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Ot as parseRpcCommentEventWithPKCErrorIfItFails, P as cloneCrosspostForRuntime, Pn as verifyCommentModeration, Pt as RpcAuthorNameParamSchema, Qn as getCommunityAddressFromRecord, Qt as RpcPublishCommunityListResultSchema, R as PKCClientsManager, Rn as verifyCommunityEdit, Rr as MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE, Rt as RpcCommunityIdentifierParamSchema, Sr as listCommunitiesSync, St as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, Tn as signCommunityEdit, Tt as parseDecryptedChallengeWithPKCErrorIfItFails, Un as getAuthorNameFromRuntime, Ut as RpcExportCommunityParamSchema, V as InflightResourceTypes, Vn as buildRuntimeAuthor, Vr as NAME_RESOLVE_FAILED_RETRY_FLOOR_MS, Vt as RpcExportCommunityModLogsParamSchema, W as PKCTypedEmitter, Wn as getAuthorNameFromWire, Wr as nativeFunctions$2, Wt as RpcExportCommunityResultSchema, Xt as RpcPublishChallengeAnswersParamSchema, Yt as RpcPublishAnchorRecordParamSchema, Zn as buildRuntimeCommunityFields, Zt as RpcPublishCommunityListParamSchema, _n as signChallengeRequest, _t as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, an as require_lib$1, at as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, b as KeyvBetterSqlite3, bn as signCommentEdit, bt as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, cn as createAnchorIpnsRecord$1, ct as parseCommunityAddressWithPKCErrorIfItFails, dn as encryptEd25519AesGcm, dt as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, en as RpcResolveAuthorNameResultSchema, er as getCommunityPublicKeyFromWire, gt as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, hn as signChallengeAnswer, ht as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, in as findCommunityRecordNameMismatch, ir as getBufferedPKCAddressFromPublicKey, jn as verifyChallengeVerification, k as findCommentInPageInstanceRecursively, kn as verifyChallengeMessage, kr as t$5, kt as parseRpcCommentUpdateEventWithPKCErrorIfItFails, l as pkcJsPageSorts, ln as decryptEd25519AesGcm, m as pkcJsChallenges, mn as cleanUpBeforePublishing, mt as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nn as RpcSuccessResultSchema, nr as decode, nt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ot as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, pr as createKuboRpcClient, pt as parseCommunityListSchemaWithPKCErrorIfItFails, q as decodeRpcChallengeRequestPubsubMsg, qn as CreateNewCommunityListOptionsSchema, qt as RpcFetchCommunityListParamSchema, rn as RpcUnsubscribeParamSchema, rt as parseCommentIpfsSchemaWithPKCErrorIfItFails, sn as createSigner, sr as getPKCAddressFromPublicKeySync, st as parseCommentUpdateSchemaWithPKCErrorIfItFails, t as RpcLocalCommunity, tn as RpcSubscriptionIdResultSchema, tr as normalizeCommunityInputFromCommunity, v as TrackedInstanceRegistry, wt as parseDecryptedChallengeVerification, x as RemoteCommunity, xn as signCommentModeration, xt as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, y as LRUCache, yn as signComment, yr as getDefaultDataPath, z as GenericStateClient, zn as verifyCommunityList, zr as NAME_RESOLVED_FALSE_TTL_MS, zt as RpcCommunityPageParamSchema } from "./rpc-local-community-DOcUqswi.js";
|
|
4
|
+
import { s as getHeliaDebugContext } from "./util-DNYbha6W.js";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import fs from "fs";
|
|
@@ -10,108 +10,6 @@ import { CID } from "multiformats/cid";
|
|
|
10
10
|
import { of } from "typestub-ipfs-only-hash";
|
|
11
11
|
import EventEmitter from "events";
|
|
12
12
|
import { Client } from "rpc-websockets";
|
|
13
|
-
//#region node_modules/zod/v4/locales/en.js
|
|
14
|
-
const error = () => {
|
|
15
|
-
const Sizable = {
|
|
16
|
-
string: {
|
|
17
|
-
unit: "characters",
|
|
18
|
-
verb: "to have"
|
|
19
|
-
},
|
|
20
|
-
file: {
|
|
21
|
-
unit: "bytes",
|
|
22
|
-
verb: "to have"
|
|
23
|
-
},
|
|
24
|
-
array: {
|
|
25
|
-
unit: "items",
|
|
26
|
-
verb: "to have"
|
|
27
|
-
},
|
|
28
|
-
set: {
|
|
29
|
-
unit: "items",
|
|
30
|
-
verb: "to have"
|
|
31
|
-
},
|
|
32
|
-
map: {
|
|
33
|
-
unit: "entries",
|
|
34
|
-
verb: "to have"
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
function getSizing(origin) {
|
|
38
|
-
return Sizable[origin] ?? null;
|
|
39
|
-
}
|
|
40
|
-
const FormatDictionary = {
|
|
41
|
-
regex: "input",
|
|
42
|
-
email: "email address",
|
|
43
|
-
url: "URL",
|
|
44
|
-
emoji: "emoji",
|
|
45
|
-
uuid: "UUID",
|
|
46
|
-
uuidv4: "UUIDv4",
|
|
47
|
-
uuidv6: "UUIDv6",
|
|
48
|
-
nanoid: "nanoid",
|
|
49
|
-
guid: "GUID",
|
|
50
|
-
cuid: "cuid",
|
|
51
|
-
cuid2: "cuid2",
|
|
52
|
-
ulid: "ULID",
|
|
53
|
-
xid: "XID",
|
|
54
|
-
ksuid: "KSUID",
|
|
55
|
-
datetime: "ISO datetime",
|
|
56
|
-
date: "ISO date",
|
|
57
|
-
time: "ISO time",
|
|
58
|
-
duration: "ISO duration",
|
|
59
|
-
ipv4: "IPv4 address",
|
|
60
|
-
ipv6: "IPv6 address",
|
|
61
|
-
mac: "MAC address",
|
|
62
|
-
cidrv4: "IPv4 range",
|
|
63
|
-
cidrv6: "IPv6 range",
|
|
64
|
-
base64: "base64-encoded string",
|
|
65
|
-
base64url: "base64url-encoded string",
|
|
66
|
-
json_string: "JSON string",
|
|
67
|
-
e164: "E.164 number",
|
|
68
|
-
jwt: "JWT",
|
|
69
|
-
template_literal: "input"
|
|
70
|
-
};
|
|
71
|
-
const TypeDictionary = { nan: "NaN" };
|
|
72
|
-
return (issue) => {
|
|
73
|
-
switch (issue.code) {
|
|
74
|
-
case "invalid_type": {
|
|
75
|
-
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
76
|
-
const receivedType = parsedType(issue.input);
|
|
77
|
-
return `Invalid input: expected ${expected}, received ${TypeDictionary[receivedType] ?? receivedType}`;
|
|
78
|
-
}
|
|
79
|
-
case "invalid_value":
|
|
80
|
-
if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
81
|
-
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
82
|
-
case "too_big": {
|
|
83
|
-
const adj = issue.inclusive ? "<=" : "<";
|
|
84
|
-
const sizing = getSizing(issue.origin);
|
|
85
|
-
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
86
|
-
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
87
|
-
}
|
|
88
|
-
case "too_small": {
|
|
89
|
-
const adj = issue.inclusive ? ">=" : ">";
|
|
90
|
-
const sizing = getSizing(issue.origin);
|
|
91
|
-
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
92
|
-
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
93
|
-
}
|
|
94
|
-
case "invalid_format": {
|
|
95
|
-
const _issue = issue;
|
|
96
|
-
if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
|
|
97
|
-
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
|
98
|
-
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
|
99
|
-
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
100
|
-
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
101
|
-
}
|
|
102
|
-
case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
103
|
-
case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
104
|
-
case "invalid_key": return `Invalid key in ${issue.origin}`;
|
|
105
|
-
case "invalid_union": return "Invalid input";
|
|
106
|
-
case "invalid_element": return `Invalid value in ${issue.origin}`;
|
|
107
|
-
default: return `Invalid input`;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
function en_default() {
|
|
112
|
-
return { localeError: error() };
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
13
|
//#region dist/node/zod-error-map.js
|
|
116
14
|
const defaultLocaleError = en_default().localeError;
|
|
117
15
|
const friendlyErrorMap = (rawIssue) => {
|
|
@@ -241,18 +139,20 @@ var PublicationClientsManager = class extends PKCClientsManager {
|
|
|
241
139
|
}[communityNewLibp2pJsState];
|
|
242
140
|
if (translatedState) this.updateLibp2pJsClientState(translatedState, libp2pJsClientKey);
|
|
243
141
|
}
|
|
244
|
-
async _createCommunityInstanceWithStateTranslation() {
|
|
142
|
+
async _createCommunityInstanceWithStateTranslation(opts) {
|
|
143
|
+
const communityName = opts?.byPublicKey && this._publication.communityPublicKey ? void 0 : this._publication.communityName;
|
|
245
144
|
const directCommunityInstance = findUpdatingCommunity(this._pkc, {
|
|
246
145
|
publicKey: this._publication.communityPublicKey,
|
|
247
|
-
name:
|
|
146
|
+
name: communityName
|
|
248
147
|
}) || findStartedCommunity(this._pkc, {
|
|
249
148
|
publicKey: this._publication.communityPublicKey,
|
|
250
|
-
name:
|
|
149
|
+
name: communityName
|
|
251
150
|
});
|
|
252
151
|
const community = directCommunityInstance || await this._pkc.createCommunity({
|
|
253
|
-
name:
|
|
152
|
+
name: communityName,
|
|
254
153
|
publicKey: this._publication.communityPublicKey
|
|
255
154
|
}, { abortSignal: this._publication._getCommunityFetchAbortSignal() });
|
|
155
|
+
if (!directCommunityInstance && !communityName && this._publication.communityName && community instanceof RemoteCommunity) community._nameToResolveBeforeFirstRecord = this._publication.communityName;
|
|
256
156
|
this._communityForUpdating = {
|
|
257
157
|
community,
|
|
258
158
|
error: this.handleErrorEventFromCommunity.bind(this),
|
|
@@ -301,8 +201,8 @@ var PublicationClientsManager = class extends PKCClientsManager {
|
|
|
301
201
|
if (directCommunityInstance) directCommunityInstance._numOfListenersForUpdatingInstance++;
|
|
302
202
|
return this._communityForUpdating;
|
|
303
203
|
}
|
|
304
|
-
|
|
305
|
-
if (!this._communityForUpdating)
|
|
204
|
+
_detachCommunityStateListeners() {
|
|
205
|
+
if (!this._communityForUpdating) return;
|
|
306
206
|
if (this._communityForUpdating.ipfsGatewayListeners) for (const gatewayUrl of Object.keys(this._communityForUpdating.ipfsGatewayListeners)) {
|
|
307
207
|
this._communityForUpdating.community.clients.ipfsGateways[gatewayUrl].removeListener("statechange", this._communityForUpdating.ipfsGatewayListeners[gatewayUrl]);
|
|
308
208
|
this.updateGatewayState("stopped", gatewayUrl);
|
|
@@ -320,6 +220,14 @@ var PublicationClientsManager = class extends PKCClientsManager {
|
|
|
320
220
|
this.updateNameResolverState("stopped", resolverKey);
|
|
321
221
|
}
|
|
322
222
|
this._communityForUpdating.community.removeListener("updatingstatechange", this._communityForUpdating.updatingstatechange);
|
|
223
|
+
this._communityForUpdating.ipfsGatewayListeners = void 0;
|
|
224
|
+
this._communityForUpdating.kuboRpcListeners = void 0;
|
|
225
|
+
this._communityForUpdating.libp2pJsListeners = void 0;
|
|
226
|
+
this._communityForUpdating.nameResolverListeners = void 0;
|
|
227
|
+
}
|
|
228
|
+
async cleanUpUpdatingCommunityInstance() {
|
|
229
|
+
if (!this._communityForUpdating) throw Error("Need to define communityForUpdating first");
|
|
230
|
+
this._detachCommunityStateListeners();
|
|
323
231
|
this._communityForUpdating.community.removeListener("error", this._communityForUpdating.error);
|
|
324
232
|
this._communityForUpdating.community.removeListener("update", this._communityForUpdating.update);
|
|
325
233
|
if (this._communityForUpdating.community._updatingCommunityInstanceWithListeners) await this._communityForUpdating.community.stop();
|
|
@@ -340,6 +248,12 @@ var PublicationClientsManager = class extends PKCClientsManager {
|
|
|
340
248
|
let communityIpfs;
|
|
341
249
|
if (!updatingCommunityInstance.community.raw.communityIpfs) {
|
|
342
250
|
const timeoutMs = this._pkc._timeouts["community-ipns"];
|
|
251
|
+
const detachOnRecord = () => {
|
|
252
|
+
if (!updatingCommunityInstance.community.raw.communityIpfs) return;
|
|
253
|
+
updatingCommunityInstance.community.removeListener("update", detachOnRecord);
|
|
254
|
+
this._detachCommunityStateListeners();
|
|
255
|
+
};
|
|
256
|
+
updatingCommunityInstance.community.on("update", detachOnRecord);
|
|
343
257
|
try {
|
|
344
258
|
await waitForUpdateInCommunityInstanceWithErrorAndTimeout({
|
|
345
259
|
community: updatingCommunityInstance.community,
|
|
@@ -350,6 +264,8 @@ var PublicationClientsManager = class extends PKCClientsManager {
|
|
|
350
264
|
} catch (e) {
|
|
351
265
|
await this.cleanUpUpdatingCommunityInstance();
|
|
352
266
|
throw e;
|
|
267
|
+
} finally {
|
|
268
|
+
updatingCommunityInstance.community.removeListener("update", detachOnRecord);
|
|
353
269
|
}
|
|
354
270
|
await this.cleanUpUpdatingCommunityInstance();
|
|
355
271
|
} else {
|
|
@@ -360,6 +276,12 @@ var PublicationClientsManager = class extends PKCClientsManager {
|
|
|
360
276
|
communityAddress: updatingCommunityInstance.community.address,
|
|
361
277
|
timeoutMs: this._pkc._timeouts["community-ipns"]
|
|
362
278
|
});
|
|
279
|
+
const nameMismatch = findCommunityRecordNameMismatch({
|
|
280
|
+
requestedName: this._publication.communityName,
|
|
281
|
+
record: communityIpfs,
|
|
282
|
+
communityPublicKey: updatingCommunityInstance.community.publicKey
|
|
283
|
+
});
|
|
284
|
+
if (nameMismatch) throw nameMismatch;
|
|
363
285
|
return {
|
|
364
286
|
address: updatingCommunityInstance.community.address,
|
|
365
287
|
publicKey: updatingCommunityInstance.community.publicKey,
|
|
@@ -889,6 +811,11 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
889
811
|
name: this.communityName
|
|
890
812
|
});
|
|
891
813
|
const subIpfs = subInstance?.raw.communityIpfs;
|
|
814
|
+
if (subIpfs && findCommunityRecordNameMismatch({
|
|
815
|
+
requestedName: this.communityName,
|
|
816
|
+
record: subIpfs,
|
|
817
|
+
communityPublicKey: subInstance.publicKey
|
|
818
|
+
})) return void 0;
|
|
892
819
|
if (subIpfs && subInstance.publicKey) return {
|
|
893
820
|
address: subInstance.address,
|
|
894
821
|
publicKey: subInstance.publicKey,
|
|
@@ -909,7 +836,10 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
909
836
|
abortSignal: this._getCommunityFetchAbortSignal()
|
|
910
837
|
}).catch((e) => {
|
|
911
838
|
if (e?.code === "ERR_GET_COMMUNITY_ABORTED") log("Stopped the background refresh of the community cache", this.communityAddress);
|
|
912
|
-
else
|
|
839
|
+
else {
|
|
840
|
+
if (e?.code === "ERR_COMMUNITY_RECORD_NAME_DOES_NOT_MATCH_REQUESTED_NAME") this._pkc._memCaches.communityForPublishing.delete(this.communityAddress);
|
|
841
|
+
log.error("Failed to update cache of community", this.communityAddress, e);
|
|
842
|
+
}
|
|
913
843
|
}).finally(() => {
|
|
914
844
|
if (this._backgroundCommunityRefresh === refresh) this._backgroundCommunityRefresh = void 0;
|
|
915
845
|
});
|
|
@@ -1605,6 +1535,22 @@ var CommentClientsManager = class extends PublicationClientsManager {
|
|
|
1605
1535
|
_calculatePathForPostCommentUpdate(folderCid, postCid) {
|
|
1606
1536
|
return `${folderCid}/` + postCid + "/update";
|
|
1607
1537
|
}
|
|
1538
|
+
_logIgnoredNotNewerPostCommentUpdate(log, path, loaded) {
|
|
1539
|
+
const held = this._comment.raw.commentUpdate;
|
|
1540
|
+
log.trace(`Comment ${this._comment.cid} ignored the CommentUpdate at ${path} as not newer than the one it holds`, {
|
|
1541
|
+
loaded: {
|
|
1542
|
+
updatedAt: loaded.updatedAt,
|
|
1543
|
+
replyCount: loaded.replyCount,
|
|
1544
|
+
pageCids: Object.keys(loaded.replies?.pageCids ?? {})
|
|
1545
|
+
},
|
|
1546
|
+
held: {
|
|
1547
|
+
updatedAt: held?.updatedAt,
|
|
1548
|
+
replyCount: held?.replyCount,
|
|
1549
|
+
pageCids: Object.keys(held?.replies?.pageCids ?? {}),
|
|
1550
|
+
lastPostUpdatesPath: this._comment._commentUpdateIpfsPath
|
|
1551
|
+
}
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1608
1554
|
_bitswapSessionSeedScopeIpnsPubsubTopic() {
|
|
1609
1555
|
if (this._communityForUpdating?.community?.ipnsPubsubTopic) return this._communityForUpdating.community.ipnsPubsubTopic;
|
|
1610
1556
|
const communityAddress = this._comment.communityAddress;
|
|
@@ -1657,7 +1603,8 @@ var CommentClientsManager = class extends PublicationClientsManager {
|
|
|
1657
1603
|
commentUpdate,
|
|
1658
1604
|
commentUpdateIpfsPath: path
|
|
1659
1605
|
};
|
|
1660
|
-
|
|
1606
|
+
this._logIgnoredNotNewerPostCommentUpdate(log, path, commentUpdate);
|
|
1607
|
+
return;
|
|
1661
1608
|
} catch (e) {
|
|
1662
1609
|
this._comment._invalidCommentUpdateMfsPaths.add(path);
|
|
1663
1610
|
if (e instanceof PKCError) e.details = {
|
|
@@ -1749,7 +1696,8 @@ var CommentClientsManager = class extends PublicationClientsManager {
|
|
|
1749
1696
|
commentUpdate,
|
|
1750
1697
|
commentUpdateIpfsPath: path
|
|
1751
1698
|
};
|
|
1752
|
-
|
|
1699
|
+
this._logIgnoredNotNewerPostCommentUpdate(log, path, commentUpdate);
|
|
1700
|
+
return;
|
|
1753
1701
|
} catch (e) {
|
|
1754
1702
|
if (this._shouldWeFetchCommentUpdateFromNextTimestamp(e)) {
|
|
1755
1703
|
attemptedPathsToLoadErrors[path] = e;
|
|
@@ -2833,7 +2781,7 @@ var Comment = class extends Publication {
|
|
|
2833
2781
|
logger_default("pkc-js:comment:update:startCommentUpdateCommunitySubscription");
|
|
2834
2782
|
if (this.state === "stopped") return;
|
|
2835
2783
|
if (this.depth === 0) {
|
|
2836
|
-
if (!this._communityForUpdating) this._communityForUpdating = await this._clientsManager._createCommunityInstanceWithStateTranslation();
|
|
2784
|
+
if (!this._communityForUpdating) this._communityForUpdating = await this._clientsManager._createCommunityInstanceWithStateTranslation({ byPublicKey: true });
|
|
2837
2785
|
if (this.state !== "updating") return;
|
|
2838
2786
|
if (this._communityForUpdating.community.state === "stopped") await this._communityForUpdating.community.update();
|
|
2839
2787
|
if (this.state !== "updating") return;
|
|
@@ -3158,7 +3106,10 @@ var Comment = class extends Publication {
|
|
|
3158
3106
|
const existingUpdatingComment = findUpdatingComment(this._pkc, { cid: this.cid });
|
|
3159
3107
|
if (existingUpdatingComment) if (existingUpdatingComment === this) if (this._pkc._pkcRpcClient) await this._updateViaRpc();
|
|
3160
3108
|
else this.loadCommentIpfsAndStartCommentUpdateSubscription().catch((e) => log.error("Failed to update comment", e));
|
|
3161
|
-
else
|
|
3109
|
+
else {
|
|
3110
|
+
log("Comment", this.cid, "will mirror the existing pkc._updatingComments entry, its state is", existingUpdatingComment.state, "updatingState", existingUpdatingComment.updatingState, "updatedAt", existingUpdatingComment.updatedAt);
|
|
3111
|
+
this._useUpdatingCommentFromPKC(existingUpdatingComment);
|
|
3112
|
+
}
|
|
3162
3113
|
else await this._setUpNewUpdatingCommentInstance();
|
|
3163
3114
|
if (this.raw.comment || this.raw.commentUpdate) this.emit("update", this);
|
|
3164
3115
|
}
|
|
@@ -3444,6 +3395,10 @@ const parseRpcSubscriptionIdResult = (result) => RpcSubscriptionIdResultSchema.l
|
|
|
3444
3395
|
const parseRpcPublishAnchorRecordParam = (params) => RpcPublishAnchorRecordParamSchema.loose().parse(params);
|
|
3445
3396
|
const parseRpcAnchorPublishPreparationResult = (result) => RpcAnchorPublishPreparationResultSchema.loose().parse(result);
|
|
3446
3397
|
const parseRpcPublishedAnchorRecordResult = (result) => RpcPublishedAnchorRecordResultSchema.loose().parse(result);
|
|
3398
|
+
const parseRpcPublishCommunityListParam = (params) => RpcPublishCommunityListParamSchema.loose().parse(params);
|
|
3399
|
+
const parseRpcPublishCommunityListResult = (result) => RpcPublishCommunityListResultSchema.loose().parse(result);
|
|
3400
|
+
const parseRpcFetchCommunityListParam = (params) => RpcFetchCommunityListParamSchema.loose().parse(params);
|
|
3401
|
+
const parseRpcFetchCommunityListResult = (result) => RpcFetchCommunityListResultSchema.loose().parse(result);
|
|
3447
3402
|
const parseRpcExportCommunityParam = (params) => RpcExportCommunityParamSchema.loose().parse(params);
|
|
3448
3403
|
const parseRpcCancelExportParam = (params) => RpcCancelExportParamSchema.loose().parse(params);
|
|
3449
3404
|
const parseRpcExportCommunityResult = (result) => RpcExportCommunityResultSchema.loose().parse(result);
|
|
@@ -3561,7 +3516,7 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3561
3516
|
})
|
|
3562
3517
|
});
|
|
3563
3518
|
} catch (e) {
|
|
3564
|
-
const typedError = e;
|
|
3519
|
+
const typedError = e instanceof Error ? e : this._deserializeRpcError(e);
|
|
3565
3520
|
typedError.details = {
|
|
3566
3521
|
...typedError.details,
|
|
3567
3522
|
rpcArgs: args,
|
|
@@ -3943,6 +3898,14 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
|
|
|
3943
3898
|
const parsedFetchCidArgs = parseRpcFetchCidParam(args);
|
|
3944
3899
|
return parseRpcFetchCidResult(await this._webSocketClient.call("fetchCid", [parsedFetchCidArgs]));
|
|
3945
3900
|
}
|
|
3901
|
+
async publishCommunityList(args) {
|
|
3902
|
+
const parsedArgs = parseRpcPublishCommunityListParam(args);
|
|
3903
|
+
return parseRpcPublishCommunityListResult(await this._webSocketClient.call("publishCommunityList", [parsedArgs]));
|
|
3904
|
+
}
|
|
3905
|
+
async fetchCommunityList(args) {
|
|
3906
|
+
const parsedArgs = parseRpcFetchCommunityListParam(args);
|
|
3907
|
+
return parseRpcFetchCommunityListResult(await this._webSocketClient.call("fetchCommunityList", [parsedArgs]));
|
|
3908
|
+
}
|
|
3946
3909
|
async setSettings(settings) {
|
|
3947
3910
|
const parsedSettings = parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails(settings);
|
|
3948
3911
|
return parseRpcSuccessResult(await this._webSocketClient.call("setSettings", [parsedSettings]));
|
|
@@ -8244,6 +8207,325 @@ var CommunityEdit = class extends Publication {
|
|
|
8244
8207
|
}
|
|
8245
8208
|
};
|
|
8246
8209
|
//#endregion
|
|
8210
|
+
//#region dist/node/community-list/community-list.js
|
|
8211
|
+
var CommunityList = class extends import_lib.TypedEmitter {
|
|
8212
|
+
constructor(pkc) {
|
|
8213
|
+
super();
|
|
8214
|
+
this.state = "stopped";
|
|
8215
|
+
this.raw = {};
|
|
8216
|
+
this._pkc = pkc;
|
|
8217
|
+
this.on("error", (...args) => this.listenerCount("error") === 1 && this._pkc.emit("error", ...args));
|
|
8218
|
+
}
|
|
8219
|
+
_initWithCidOnly(cid) {
|
|
8220
|
+
this.cid = cid;
|
|
8221
|
+
this.shortCid = shortifyCid(cid);
|
|
8222
|
+
}
|
|
8223
|
+
_initUnsignedProps({ signer, ...props }) {
|
|
8224
|
+
this.signer = signer;
|
|
8225
|
+
this._unsignedProps = props;
|
|
8226
|
+
this.title = props.title;
|
|
8227
|
+
this.description = props.description;
|
|
8228
|
+
this.timestamp = props.timestamp;
|
|
8229
|
+
this.protocolVersion = props.protocolVersion;
|
|
8230
|
+
this.communities = props.communities.map((entry) => this._buildRuntimeEntry(entry));
|
|
8231
|
+
this.author = this._buildRuntimeAuthor(props.author, signer.publicKey);
|
|
8232
|
+
}
|
|
8233
|
+
_buildRuntimeEntry(entry) {
|
|
8234
|
+
const address = entry.name || entry.publicKey;
|
|
8235
|
+
return {
|
|
8236
|
+
...entry,
|
|
8237
|
+
address,
|
|
8238
|
+
shortAddress: shortifyAddress(address)
|
|
8239
|
+
};
|
|
8240
|
+
}
|
|
8241
|
+
_buildRuntimeAuthor(wireAuthor, signaturePublicKey) {
|
|
8242
|
+
const runtimeAuthor = buildRuntimeAuthor({
|
|
8243
|
+
author: wireAuthor,
|
|
8244
|
+
signaturePublicKey
|
|
8245
|
+
});
|
|
8246
|
+
return {
|
|
8247
|
+
...runtimeAuthor,
|
|
8248
|
+
shortAddress: shortifyAddress(runtimeAuthor.address)
|
|
8249
|
+
};
|
|
8250
|
+
}
|
|
8251
|
+
_initFromWireRecord(record, cid) {
|
|
8252
|
+
this.raw.communityList = record;
|
|
8253
|
+
this.cid = cid;
|
|
8254
|
+
this.shortCid = shortifyCid(cid);
|
|
8255
|
+
this.title = record.title;
|
|
8256
|
+
this.description = record.description;
|
|
8257
|
+
this.timestamp = record.timestamp;
|
|
8258
|
+
this.protocolVersion = record.protocolVersion;
|
|
8259
|
+
this.signature = record.signature;
|
|
8260
|
+
this.communities = record.communities.map((entry) => this._buildRuntimeEntry(entry));
|
|
8261
|
+
const previousNameResolved = this.author?.nameResolved;
|
|
8262
|
+
this.author = this._buildRuntimeAuthor(record.author, record.signature.publicKey);
|
|
8263
|
+
if (typeof previousNameResolved === "boolean") this.author.nameResolved = previousNameResolved;
|
|
8264
|
+
else this._setAuthorNameResolvedFromCache();
|
|
8265
|
+
}
|
|
8266
|
+
_setAuthorNameResolvedFromCache() {
|
|
8267
|
+
const authorDomain = this._authorDomainToSettle();
|
|
8268
|
+
if (!authorDomain || !this.author) return;
|
|
8269
|
+
const cached = this._pkc._memCaches.nameResolvedCache.get(this._nameResolvedCacheKey(authorDomain));
|
|
8270
|
+
if (typeof cached === "boolean") this.author.nameResolved = cached;
|
|
8271
|
+
}
|
|
8272
|
+
toJSON() {
|
|
8273
|
+
return {
|
|
8274
|
+
...this.raw.communityList ?? this._unsignedProps,
|
|
8275
|
+
...this.author ? { author: this.author } : void 0,
|
|
8276
|
+
...this.communities ? { communities: this.communities } : void 0,
|
|
8277
|
+
cid: this.cid,
|
|
8278
|
+
shortCid: this.shortCid
|
|
8279
|
+
};
|
|
8280
|
+
}
|
|
8281
|
+
_setState(newState) {
|
|
8282
|
+
if (this.state === newState) return;
|
|
8283
|
+
this.state = newState;
|
|
8284
|
+
this.emit("statechange", newState);
|
|
8285
|
+
}
|
|
8286
|
+
_throwIfPublishAborted(signal) {
|
|
8287
|
+
if (signal.aborted) throw new PKCError("ERR_COMMUNITY_LIST_PUBLISH_ABORTED", { cid: this.cid });
|
|
8288
|
+
}
|
|
8289
|
+
async publish() {
|
|
8290
|
+
const log = logger_default("pkc-js:community-list:publish");
|
|
8291
|
+
if (!this.signer || !this._unsignedProps) throw new PKCError("ERR_COMMUNITY_LIST_HAS_NO_SIGNER", { cid: this.cid });
|
|
8292
|
+
if (this.state === "publishing") throw new PKCError("ERR_COMMUNITY_LIST_ALREADY_PUBLISHING", {});
|
|
8293
|
+
if (this.state === "updating") throw new PKCError("ERR_COMMUNITY_LIST_ALREADY_UPDATING", {});
|
|
8294
|
+
this._setState("publishing");
|
|
8295
|
+
this._stopAbortController = new AbortController();
|
|
8296
|
+
const signal = this._stopAbortController.signal;
|
|
8297
|
+
try {
|
|
8298
|
+
const cleanedProps = cleanUpBeforePublishing(this._unsignedProps);
|
|
8299
|
+
const signature = await signCommunityList({
|
|
8300
|
+
communityList: cleanedProps,
|
|
8301
|
+
signer: this.signer,
|
|
8302
|
+
pkc: this._pkc
|
|
8303
|
+
});
|
|
8304
|
+
const record = {
|
|
8305
|
+
...cleanedProps,
|
|
8306
|
+
signature
|
|
8307
|
+
};
|
|
8308
|
+
parseCommunityListSchemaWithPKCErrorIfItFails(record);
|
|
8309
|
+
const recordString = JSON.stringify(record);
|
|
8310
|
+
const sizeBytes = await calculateStringSizeSameAsIpfsAddCidV0(recordString);
|
|
8311
|
+
if (sizeBytes > 2097152) throw new PKCError("ERR_COMMUNITY_LIST_OVER_ALLOWED_SIZE", {
|
|
8312
|
+
sizeBytes,
|
|
8313
|
+
maxSizeBytes: MAX_COMMUNITY_LIST_SIZE_BYTES
|
|
8314
|
+
});
|
|
8315
|
+
this._throwIfPublishAborted(signal);
|
|
8316
|
+
let cid;
|
|
8317
|
+
if (this._pkc._pkcRpcClient) {
|
|
8318
|
+
const res = await this._pkc._pkcRpcClient.publishCommunityList({ communityListRawString: recordString });
|
|
8319
|
+
const expectedCid = await calculateIpfsCidV0(recordString);
|
|
8320
|
+
if (res.cid !== expectedCid) throw new PKCError("ERR_ADDED_COMMUNITY_LIST_TO_IPFS_BUT_GOT_DIFFERENT_CID", {
|
|
8321
|
+
expectedCid,
|
|
8322
|
+
cidFromRpcServer: res.cid
|
|
8323
|
+
});
|
|
8324
|
+
cid = res.cid;
|
|
8325
|
+
} else {
|
|
8326
|
+
const addRes = await retryKuboIpfsAddAndProvide({
|
|
8327
|
+
ipfsClient: this._pkc._clientsManager.getDefaultKuboRpcClient()._client,
|
|
8328
|
+
log,
|
|
8329
|
+
content: recordString,
|
|
8330
|
+
addOptions: { pin: true },
|
|
8331
|
+
provideInBackground: true
|
|
8332
|
+
});
|
|
8333
|
+
cid = String(addRes.cid);
|
|
8334
|
+
}
|
|
8335
|
+
this._throwIfPublishAborted(signal);
|
|
8336
|
+
this._initFromWireRecord(record, cid);
|
|
8337
|
+
log(`Published CommunityList (${cid}) with ${record.communities.length} entries`);
|
|
8338
|
+
return cid;
|
|
8339
|
+
} finally {
|
|
8340
|
+
if (this._stopAbortController?.signal === signal) this._setState("stopped");
|
|
8341
|
+
}
|
|
8342
|
+
}
|
|
8343
|
+
async update() {
|
|
8344
|
+
if (this.state === "updating") return;
|
|
8345
|
+
if (this.state === "publishing") throw new PKCError("ERR_COMMUNITY_LIST_ALREADY_PUBLISHING", {});
|
|
8346
|
+
if (!this.cid) throw new PKCError("ERR_COMMUNITY_LIST_HAS_NO_CID", {});
|
|
8347
|
+
this._setState("updating");
|
|
8348
|
+
this._stopAbortController = new AbortController();
|
|
8349
|
+
const signal = this._stopAbortController.signal;
|
|
8350
|
+
this._pkc._updatingCommunityLists.add(this);
|
|
8351
|
+
this._runUpdateLoop(signal);
|
|
8352
|
+
}
|
|
8353
|
+
async _runUpdateLoop(signal) {
|
|
8354
|
+
const log = logger_default("pkc-js:community-list:update");
|
|
8355
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
8356
|
+
if (signal.aborted) return;
|
|
8357
|
+
try {
|
|
8358
|
+
if (!this.raw.communityList) await this._loadCommunityListIpfsWithRetries(signal);
|
|
8359
|
+
else this.emit("update", this);
|
|
8360
|
+
if (signal.aborted) return;
|
|
8361
|
+
await this._settleAuthorNameResolvedIfNeeded(signal);
|
|
8362
|
+
if (!signal.aborted) await this.stop();
|
|
8363
|
+
} catch (e) {
|
|
8364
|
+
if (signal.aborted) return;
|
|
8365
|
+
log.error(`Failed to update CommunityList (${this.cid})`, e);
|
|
8366
|
+
this.emit("error", e);
|
|
8367
|
+
await this.stop();
|
|
8368
|
+
}
|
|
8369
|
+
}
|
|
8370
|
+
_isNonRetriableError(e) {
|
|
8371
|
+
const { code, details } = e ?? {};
|
|
8372
|
+
if (code === "ERR_FAILED_TO_FETCH_GENERIC_IPFS_FROM_GATEWAYS") {
|
|
8373
|
+
const gatewayErrors = Object.values(details?.gatewayToError ?? {});
|
|
8374
|
+
return gatewayErrors.length > 0 && gatewayErrors.every((gatewayError) => this._isNonRetriableError(gatewayError));
|
|
8375
|
+
}
|
|
8376
|
+
return typeof code === "string" && [
|
|
8377
|
+
"ERR_INVALID_JSON",
|
|
8378
|
+
"ERR_INVALID_COMMUNITY_LIST_SCHEMA",
|
|
8379
|
+
"ERR_COMMUNITY_LIST_SIGNATURE_IS_INVALID",
|
|
8380
|
+
"ERR_OVER_DOWNLOAD_LIMIT",
|
|
8381
|
+
"ERR_CALCULATED_CID_DOES_NOT_MATCH"
|
|
8382
|
+
].includes(code);
|
|
8383
|
+
}
|
|
8384
|
+
async _loadCommunityListIpfsWithRetries(outerSignal) {
|
|
8385
|
+
if (this.raw.communityList) return;
|
|
8386
|
+
const cid = this.cid;
|
|
8387
|
+
if (!cid) throw new PKCError("ERR_COMMUNITY_LIST_HAS_NO_CID", {});
|
|
8388
|
+
const abortController = new AbortController();
|
|
8389
|
+
const operation = import_retry.operation({
|
|
8390
|
+
forever: true,
|
|
8391
|
+
factor: 2
|
|
8392
|
+
});
|
|
8393
|
+
this._loadingAbortController = abortController;
|
|
8394
|
+
this._loadingOperation = operation;
|
|
8395
|
+
const signal = abortController.signal;
|
|
8396
|
+
const onOuterAbort = () => abortController.abort(outerSignal?.reason);
|
|
8397
|
+
outerSignal?.addEventListener("abort", onOuterAbort, { once: true });
|
|
8398
|
+
try {
|
|
8399
|
+
const record = await new Promise((resolve, reject) => {
|
|
8400
|
+
const rejectOnAbort = () => reject(signal.reason || /* @__PURE__ */ new Error("Aborted loading CommunityList"));
|
|
8401
|
+
signal.addEventListener("abort", rejectOnAbort, { once: true });
|
|
8402
|
+
operation.attempt(async () => {
|
|
8403
|
+
if (signal.aborted) return rejectOnAbort();
|
|
8404
|
+
try {
|
|
8405
|
+
resolve(await this._fetchAndVerifyOnce(cid, signal));
|
|
8406
|
+
} catch (e) {
|
|
8407
|
+
if (signal.aborted || this._isNonRetriableError(e)) return reject(e);
|
|
8408
|
+
this.emit("error", e);
|
|
8409
|
+
operation.retry(e);
|
|
8410
|
+
}
|
|
8411
|
+
});
|
|
8412
|
+
});
|
|
8413
|
+
if (signal.aborted) return;
|
|
8414
|
+
this._initFromWireRecord(record, cid);
|
|
8415
|
+
this.emit("update", this);
|
|
8416
|
+
} finally {
|
|
8417
|
+
operation.stop();
|
|
8418
|
+
outerSignal?.removeEventListener("abort", onOuterAbort);
|
|
8419
|
+
if (this._loadingOperation === operation) this._loadingOperation = void 0;
|
|
8420
|
+
if (this._loadingAbortController === abortController) this._loadingAbortController = void 0;
|
|
8421
|
+
}
|
|
8422
|
+
}
|
|
8423
|
+
async _fetchAndVerifyOnce(cid, signal) {
|
|
8424
|
+
let rawString;
|
|
8425
|
+
if (this._pkc._pkcRpcClient) {
|
|
8426
|
+
rawString = (await this._pkc._pkcRpcClient.fetchCommunityList({ cid })).communityListRawString;
|
|
8427
|
+
const sizeBytes = calculateStringSizeSameAsIpfsAddCidV0Sync(rawString);
|
|
8428
|
+
if (sizeBytes > 2097152) throw new PKCError("ERR_OVER_DOWNLOAD_LIMIT", {
|
|
8429
|
+
cid,
|
|
8430
|
+
sizeBytes,
|
|
8431
|
+
maxSizeBytes: MAX_COMMUNITY_LIST_SIZE_BYTES
|
|
8432
|
+
});
|
|
8433
|
+
const calculatedCid = await calculateIpfsCidV0(rawString);
|
|
8434
|
+
if (calculatedCid !== cid) throw new PKCError("ERR_CALCULATED_CID_DOES_NOT_MATCH", {
|
|
8435
|
+
calculatedCid,
|
|
8436
|
+
cid
|
|
8437
|
+
});
|
|
8438
|
+
} else rawString = await this._pkc._clientsManager.fetchCid(cid, {
|
|
8439
|
+
maxFileSizeBytes: MAX_COMMUNITY_LIST_SIZE_BYTES,
|
|
8440
|
+
abortSignal: signal
|
|
8441
|
+
});
|
|
8442
|
+
const record = parseCommunityListSchemaWithPKCErrorIfItFails(parseJsonWithPKCErrorIfFails(rawString));
|
|
8443
|
+
const validity = await verifyCommunityList({ communityList: record });
|
|
8444
|
+
if (!validity.valid) throw new PKCError("ERR_COMMUNITY_LIST_SIGNATURE_IS_INVALID", {
|
|
8445
|
+
validity,
|
|
8446
|
+
cid
|
|
8447
|
+
});
|
|
8448
|
+
return record;
|
|
8449
|
+
}
|
|
8450
|
+
_authorDomainToSettle() {
|
|
8451
|
+
const wireAuthorName = this.raw.communityList?.author?.name;
|
|
8452
|
+
if (typeof wireAuthorName !== "string" || !isStringDomain(wireAuthorName)) return void 0;
|
|
8453
|
+
return wireAuthorName;
|
|
8454
|
+
}
|
|
8455
|
+
_nameResolvedCacheKey(authorDomain) {
|
|
8456
|
+
return (0, import_sha256.sha256)(authorDomain + this.raw.communityList.signature.publicKey);
|
|
8457
|
+
}
|
|
8458
|
+
async _resolveAuthorNameVerdictOnce(authorDomain) {
|
|
8459
|
+
const cache = this._pkc._memCaches.nameResolvedCache;
|
|
8460
|
+
const cacheKey = this._nameResolvedCacheKey(authorDomain);
|
|
8461
|
+
const cached = cache.get(cacheKey);
|
|
8462
|
+
if (typeof cached === "boolean") return cached;
|
|
8463
|
+
try {
|
|
8464
|
+
const { resolvedAuthorName } = await this._pkc.resolveAuthorName({ name: authorDomain });
|
|
8465
|
+
const ttlOf = (verdict) => verdict ? this._pkc._nameResolvedTrueTtlMs : this._pkc._nameResolvedFalseTtlMs;
|
|
8466
|
+
if (typeof resolvedAuthorName !== "string") {
|
|
8467
|
+
cache.set(cacheKey, false, { ttl: ttlOf(false) });
|
|
8468
|
+
return false;
|
|
8469
|
+
}
|
|
8470
|
+
const verdict = resolvedAuthorName === getPKCAddressFromPublicKeySync(this.raw.communityList.signature.publicKey);
|
|
8471
|
+
cache.set(cacheKey, verdict, { ttl: ttlOf(verdict) });
|
|
8472
|
+
return verdict;
|
|
8473
|
+
} catch (e) {
|
|
8474
|
+
const code = e?.code;
|
|
8475
|
+
if (code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS") {
|
|
8476
|
+
cache.set(cacheKey, false, { ttl: this._pkc._nameResolvedFalseTtlMs });
|
|
8477
|
+
return false;
|
|
8478
|
+
}
|
|
8479
|
+
if (code === "ERR_NO_RESOLVER_FOR_NAME") return false;
|
|
8480
|
+
return;
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8483
|
+
_kickOffBackgroundAuthorNameResolution() {
|
|
8484
|
+
const log = logger_default("pkc-js:community-list:resolve-author-name");
|
|
8485
|
+
const authorDomain = this._authorDomainToSettle();
|
|
8486
|
+
if (!authorDomain || !this._pkc.resolveAuthorNames) return;
|
|
8487
|
+
this._resolveAuthorNameVerdictOnce(authorDomain).catch((e) => log.error("Failed background author name resolution", authorDomain, e));
|
|
8488
|
+
}
|
|
8489
|
+
async _settleAuthorNameResolvedIfNeeded(signal) {
|
|
8490
|
+
const authorDomain = this._authorDomainToSettle();
|
|
8491
|
+
if (!authorDomain || !this.author || !this._pkc.resolveAuthorNames) return;
|
|
8492
|
+
let attempt = 0;
|
|
8493
|
+
while (!signal.aborted) {
|
|
8494
|
+
const verdict = await this._resolveAuthorNameVerdictOnce(authorDomain);
|
|
8495
|
+
if (signal.aborted) return;
|
|
8496
|
+
if (typeof verdict === "boolean") {
|
|
8497
|
+
this.author.nameResolved = verdict;
|
|
8498
|
+
this.emit("update", this);
|
|
8499
|
+
return;
|
|
8500
|
+
}
|
|
8501
|
+
attempt++;
|
|
8502
|
+
await this._delayWithAbort(Math.min(1e3 * 2 ** attempt, 6e4), signal);
|
|
8503
|
+
}
|
|
8504
|
+
}
|
|
8505
|
+
async _delayWithAbort(ms, signal) {
|
|
8506
|
+
if (signal.aborted) return;
|
|
8507
|
+
await new Promise((resolve) => {
|
|
8508
|
+
const timeout = setTimeout(() => {
|
|
8509
|
+
signal.removeEventListener("abort", onAbort);
|
|
8510
|
+
resolve();
|
|
8511
|
+
}, ms);
|
|
8512
|
+
const onAbort = () => {
|
|
8513
|
+
clearTimeout(timeout);
|
|
8514
|
+
resolve();
|
|
8515
|
+
};
|
|
8516
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
8517
|
+
});
|
|
8518
|
+
}
|
|
8519
|
+
async stop() {
|
|
8520
|
+
this._pkc._updatingCommunityLists.delete(this);
|
|
8521
|
+
this._stopAbortController?.abort();
|
|
8522
|
+
this._loadingAbortController?.abort();
|
|
8523
|
+
this._loadingOperation?.stop();
|
|
8524
|
+
if (this.state === "stopped") return;
|
|
8525
|
+
this._setState("stopped");
|
|
8526
|
+
}
|
|
8527
|
+
};
|
|
8528
|
+
//#endregion
|
|
8247
8529
|
//#region dist/node/pkc/pkc.js
|
|
8248
8530
|
var PKC$1 = class extends PKCTypedEmitter {
|
|
8249
8531
|
constructor(options) {
|
|
@@ -8253,6 +8535,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8253
8535
|
this._updatingComments = new TrackedInstanceRegistry();
|
|
8254
8536
|
this._startedCommunities = new TrackedInstanceRegistry();
|
|
8255
8537
|
this._publishingPublications = /* @__PURE__ */ new Set();
|
|
8538
|
+
this._updatingCommunityLists = /* @__PURE__ */ new Set();
|
|
8256
8539
|
this.destroyed = false;
|
|
8257
8540
|
this._storageLRUs = {};
|
|
8258
8541
|
this._nameResolvedFalseTtlMs = NAME_RESOLVED_FALSE_TTL_MS;
|
|
@@ -8386,7 +8669,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8386
8669
|
this.clients.libp2pJsClients = {};
|
|
8387
8670
|
if (!this.libp2pJsClientsOptions) return;
|
|
8388
8671
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
8389
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
8672
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-vQZvQcs_.js");
|
|
8390
8673
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
8391
8674
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
8392
8675
|
...clientOptions,
|
|
@@ -8506,6 +8789,88 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8506
8789
|
await comment.stop();
|
|
8507
8790
|
}
|
|
8508
8791
|
}
|
|
8792
|
+
async createCommunityList(options) {
|
|
8793
|
+
if (options && typeof options === "object" && "cid" in options) {
|
|
8794
|
+
const parseRes = CreateCommunityListWithCidOptionsSchema.safeParse(options);
|
|
8795
|
+
if (!parseRes.success) throw new PKCError("ERR_INVALID_CREATE_COMMUNITY_LIST_OPTIONS_SCHEMA", {
|
|
8796
|
+
zodError: parseRes.error,
|
|
8797
|
+
options
|
|
8798
|
+
});
|
|
8799
|
+
const communityList = new CommunityList(this);
|
|
8800
|
+
communityList._initWithCidOnly(parseRes.data.cid);
|
|
8801
|
+
return communityList;
|
|
8802
|
+
}
|
|
8803
|
+
const parseRes = CreateNewCommunityListOptionsSchema.safeParse(options);
|
|
8804
|
+
if (!parseRes.success) throw new PKCError("ERR_INVALID_CREATE_COMMUNITY_LIST_OPTIONS_SCHEMA", {
|
|
8805
|
+
zodError: parseRes.error,
|
|
8806
|
+
options
|
|
8807
|
+
});
|
|
8808
|
+
const parsedOptions = parseRes.data;
|
|
8809
|
+
const signer = await this.createSigner(parsedOptions.signer);
|
|
8810
|
+
const cleanedAuthor = cleanWireAuthor(normalizeCreatePublicationAuthor(parsedOptions.author));
|
|
8811
|
+
const communityList = new CommunityList(this);
|
|
8812
|
+
communityList._initUnsignedProps({
|
|
8813
|
+
signer,
|
|
8814
|
+
title: parsedOptions.title,
|
|
8815
|
+
description: parsedOptions.description,
|
|
8816
|
+
author: cleanedAuthor,
|
|
8817
|
+
communities: parsedOptions.communities,
|
|
8818
|
+
timestamp: typeof parsedOptions.timestamp === "number" ? parsedOptions.timestamp : timestamp(),
|
|
8819
|
+
protocolVersion: parsedOptions.protocolVersion || version_default.PROTOCOL_VERSION
|
|
8820
|
+
});
|
|
8821
|
+
return communityList;
|
|
8822
|
+
}
|
|
8823
|
+
async getCommunityList(getCommunityListArgs) {
|
|
8824
|
+
const { abortSignal, ...cidArgs } = getCommunityListArgs;
|
|
8825
|
+
const parseRes = CreateCommunityListWithCidOptionsSchema.safeParse(cidArgs);
|
|
8826
|
+
if (!parseRes.success) throw new PKCError("ERR_INVALID_CREATE_COMMUNITY_LIST_OPTIONS_SCHEMA", {
|
|
8827
|
+
zodError: parseRes.error,
|
|
8828
|
+
getCommunityListArgs
|
|
8829
|
+
});
|
|
8830
|
+
const cid = parseRes.data.cid;
|
|
8831
|
+
if (abortSignal?.aborted) throw new PKCError("ERR_GET_COMMUNITY_LIST_ABORTED", {
|
|
8832
|
+
cid,
|
|
8833
|
+
abortReason: abortSignal.reason
|
|
8834
|
+
});
|
|
8835
|
+
const communityList = await this.createCommunityList(parseRes.data);
|
|
8836
|
+
let lastUpdateError;
|
|
8837
|
+
const errorListener = (err) => lastUpdateError = err;
|
|
8838
|
+
communityList.on("error", errorListener);
|
|
8839
|
+
let abortError;
|
|
8840
|
+
let abortReject;
|
|
8841
|
+
const abortListener = () => {
|
|
8842
|
+
abortError = new PKCError("ERR_GET_COMMUNITY_LIST_ABORTED", {
|
|
8843
|
+
cid,
|
|
8844
|
+
abortReason: abortSignal?.reason,
|
|
8845
|
+
lastUpdateError
|
|
8846
|
+
});
|
|
8847
|
+
abortReject?.(abortError);
|
|
8848
|
+
};
|
|
8849
|
+
const abortPromise = new Promise((_, reject) => {
|
|
8850
|
+
abortReject = reject;
|
|
8851
|
+
});
|
|
8852
|
+
abortPromise.catch(() => {});
|
|
8853
|
+
abortSignal?.addEventListener("abort", abortListener);
|
|
8854
|
+
const timeoutMs = this._timeouts["generic-ipfs"];
|
|
8855
|
+
const timeoutError = new TimeoutError(`pkc.getCommunityList({cid: ${cid}}) timed out after ${timeoutMs}ms`);
|
|
8856
|
+
try {
|
|
8857
|
+
await pTimeout(Promise.race([communityList._loadCommunityListIpfsWithRetries(abortSignal), abortPromise]), {
|
|
8858
|
+
milliseconds: timeoutMs,
|
|
8859
|
+
message: timeoutError
|
|
8860
|
+
});
|
|
8861
|
+
if (!communityList.signature) throw Error("Failed to load CommunityList");
|
|
8862
|
+
communityList._kickOffBackgroundAuthorNameResolution();
|
|
8863
|
+
return communityList;
|
|
8864
|
+
} catch (e) {
|
|
8865
|
+
if (abortError) throw abortError;
|
|
8866
|
+
if (e === timeoutError && lastUpdateError) throw lastUpdateError;
|
|
8867
|
+
throw e;
|
|
8868
|
+
} finally {
|
|
8869
|
+
abortSignal?.removeEventListener("abort", abortListener);
|
|
8870
|
+
communityList.removeListener("error", errorListener);
|
|
8871
|
+
await communityList.stop();
|
|
8872
|
+
}
|
|
8873
|
+
}
|
|
8509
8874
|
async _initMissingFieldsOfPublicationBeforeSigning(pubOptions, log) {
|
|
8510
8875
|
const finalOptions = t$4(pubOptions);
|
|
8511
8876
|
if (!finalOptions.signer) throw Error("User did not provide a signer to create a local publication");
|
|
@@ -8668,7 +9033,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
8668
9033
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
8669
9034
|
log.trace("Received community options to create a local community instance:", options);
|
|
8670
9035
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
8671
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
9036
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-dcM1R3k5.js");
|
|
8672
9037
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
8673
9038
|
const community = new LocalCommunity(this);
|
|
8674
9039
|
if (isLocalCommunity) {
|
|
@@ -9053,6 +9418,8 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
9053
9418
|
await Promise.all([...this._publishingPublications].map((publication) => publication.stop().catch((e) => log.error("Error stopping publication during destroy", e))));
|
|
9054
9419
|
this._publishingPublications.clear();
|
|
9055
9420
|
for (const comment of listUpdatingComments(this)) await comment.stop();
|
|
9421
|
+
for (const communityList of [...this._updatingCommunityLists]) await communityList.stop().catch((e) => log.error("Error stopping CommunityList during destroy", e));
|
|
9422
|
+
this._updatingCommunityLists.clear();
|
|
9056
9423
|
for (const community of listUpdatingCommunities(this)) await community.stop();
|
|
9057
9424
|
await Promise.all(listStartedCommunities(this).map((community) => community.stop()));
|
|
9058
9425
|
if (this._communityFsWatchAbort) this._communityFsWatchAbort.abort();
|
|
@@ -9251,4 +9618,4 @@ const challenges = PKC.challenges;
|
|
|
9251
9618
|
const pageSorts = PKC.pageSorts;
|
|
9252
9619
|
const createAnchorIpnsRecord = PKC.createAnchorIpnsRecord;
|
|
9253
9620
|
//#endregion
|
|
9254
|
-
export { parseRpcExportCommunityParam as _, getShortCid as a,
|
|
9621
|
+
export { parseRpcUnsubscribeParam as S, parseRpcExportCommunityParam as _, getShortCid as a, parseRpcPublishChallengeAnswersParam as b, setNativeFunctions as c, parseRpcCidParam as d, parseRpcCommentRepliesPageParam as f, parseRpcExportCommunityModLogsParam as g, parseRpcEditCommunityParam as h, getShortAddress as i, parseRpcAuthorNameParam as l, parseRpcCommunityPageParam as m, challenges as n, nativeFunctions as o, parseRpcCommunityIdentifierParam as p, createAnchorIpnsRecord as r, pageSorts as s, PKC as t, parseRpcCancelExportParam as u, parseRpcFetchCommunityListParam as v, parseRpcPublishCommunityListParam as x, parseRpcPublishAnchorRecordParam as y };
|