@pkcprotocol/pkc-js 0.0.48 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/clients/base-client-manager.js +5 -14
- package/dist/browser/clients/base-client-manager.js.map +1 -1
- package/dist/browser/community/community-client-manager.js +4 -11
- package/dist/browser/community/community-client-manager.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/pkc/pkc.d.ts +2 -0
- package/dist/browser/pkc/pkc.js +34 -2
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/publications/comment/comment.js +6 -9
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/runtime/browser/setup-kubo-http-routers.d.ts +1 -0
- package/dist/browser/runtime/browser/setup-kubo-http-routers.js +10 -0
- package/dist/browser/runtime/browser/setup-kubo-http-routers.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.d.ts +1 -0
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.js +6 -1
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/lifecycle.js +4 -10
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/setup-kubo-http-routers.d.ts +8 -0
- package/dist/browser/runtime/node/setup-kubo-http-routers.js +179 -3
- package/dist/browser/runtime/node/setup-kubo-http-routers.js.map +1 -1
- package/dist/browser/util.d.ts +2 -0
- package/dist/browser/util.js +45 -0
- package/dist/browser/util.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +25 -25
- package/dist/bundled/chunks/{helia-for-pkc-C9v3jcS7.js → helia-for-pkc-CoiCnGzf.js} +2 -2
- package/dist/bundled/chunks/{local-community-BUAd-a_f.js → local-community-DiTjNeA_.js} +1 -1
- package/dist/bundled/chunks/{local-community-CXbUZ0um.js → local-community-PMOePYFy.js} +3 -10
- package/dist/bundled/chunks/{node-edb9-nES.js → node-2IRJmtOa.js} +152 -21
- package/dist/bundled/chunks/{rpc-local-community-CO__pwvD.js → rpc-local-community-DUD2jTEu.js} +5 -17
- package/dist/bundled/chunks/{schema-B7HIUI8w.js → schema-DEqa38Xx.js} +30 -2
- package/dist/bundled/chunks/{util-BqBjzCfN.js → util-CcKyKVLs.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/clients/base-client-manager.js +5 -14
- package/dist/node/clients/base-client-manager.js.map +1 -1
- package/dist/node/community/community-client-manager.js +4 -11
- package/dist/node/community/community-client-manager.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/pkc/pkc.d.ts +2 -0
- package/dist/node/pkc/pkc.js +34 -2
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/publications/comment/comment.js +6 -9
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/runtime/browser/setup-kubo-http-routers.d.ts +1 -0
- package/dist/node/runtime/browser/setup-kubo-http-routers.js +10 -0
- package/dist/node/runtime/browser/setup-kubo-http-routers.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/exclude/exclude.d.ts +1 -0
- package/dist/node/runtime/node/community/challenges/exclude/exclude.js +6 -1
- package/dist/node/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/lifecycle.js +4 -10
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/setup-kubo-http-routers.d.ts +8 -0
- package/dist/node/runtime/node/setup-kubo-http-routers.js +179 -3
- package/dist/node/runtime/node/setup-kubo-http-routers.js.map +1 -1
- package/dist/node/util.d.ts +2 -0
- package/dist/node/util.js +45 -0
- package/dist/node/util.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node:module"
|
|
15
15
|
],
|
|
16
16
|
"dynamicImports": [
|
|
17
|
-
"chunks/node-
|
|
17
|
+
"chunks/node-2IRJmtOa.js"
|
|
18
18
|
],
|
|
19
19
|
"inputs": [
|
|
20
20
|
"dist/node/runtime/node/compile-cache.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"index.js": {
|
|
25
25
|
"isEntry": true,
|
|
26
26
|
"imports": [
|
|
27
|
-
"chunks/node-
|
|
27
|
+
"chunks/node-2IRJmtOa.js"
|
|
28
28
|
],
|
|
29
29
|
"dynamicImports": [],
|
|
30
30
|
"inputs": []
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"rpc/src/index.js": {
|
|
33
33
|
"isEntry": true,
|
|
34
34
|
"imports": [
|
|
35
|
-
"chunks/schema-
|
|
36
|
-
"chunks/rpc-local-community-
|
|
37
|
-
"chunks/node-
|
|
38
|
-
"chunks/local-community-
|
|
35
|
+
"chunks/schema-DEqa38Xx.js",
|
|
36
|
+
"chunks/rpc-local-community-DUD2jTEu.js",
|
|
37
|
+
"chunks/node-2IRJmtOa.js",
|
|
38
|
+
"chunks/local-community-PMOePYFy.js",
|
|
39
39
|
"node:url",
|
|
40
40
|
"path",
|
|
41
41
|
"assert",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"dist/node/rpc/src/index.js"
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
|
-
"chunks/helia-for-pkc-
|
|
57
|
+
"chunks/helia-for-pkc-CoiCnGzf.js": {
|
|
58
58
|
"isEntry": false,
|
|
59
59
|
"imports": [
|
|
60
|
-
"chunks/schema-
|
|
61
|
-
"chunks/util-
|
|
60
|
+
"chunks/schema-DEqa38Xx.js",
|
|
61
|
+
"chunks/util-CcKyKVLs.js",
|
|
62
62
|
"multiformats/cid",
|
|
63
63
|
"@libp2p/interface",
|
|
64
64
|
"@libp2p/peer-id",
|
|
@@ -83,19 +83,19 @@
|
|
|
83
83
|
"dist/node/helia/helia-for-pkc.js"
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
|
-
"chunks/local-community-
|
|
86
|
+
"chunks/local-community-DiTjNeA_.js": {
|
|
87
87
|
"isEntry": false,
|
|
88
88
|
"imports": [
|
|
89
|
-
"chunks/local-community-
|
|
89
|
+
"chunks/local-community-PMOePYFy.js"
|
|
90
90
|
],
|
|
91
91
|
"dynamicImports": [],
|
|
92
92
|
"inputs": []
|
|
93
93
|
},
|
|
94
|
-
"chunks/local-community-
|
|
94
|
+
"chunks/local-community-PMOePYFy.js": {
|
|
95
95
|
"isEntry": false,
|
|
96
96
|
"imports": [
|
|
97
|
-
"chunks/schema-
|
|
98
|
-
"chunks/rpc-local-community-
|
|
97
|
+
"chunks/schema-DEqa38Xx.js",
|
|
98
|
+
"chunks/rpc-local-community-DUD2jTEu.js",
|
|
99
99
|
"node:crypto",
|
|
100
100
|
"node:url",
|
|
101
101
|
"node:path",
|
|
@@ -142,12 +142,12 @@
|
|
|
142
142
|
"dist/node/runtime/node/community/local-community.js"
|
|
143
143
|
]
|
|
144
144
|
},
|
|
145
|
-
"chunks/node-
|
|
145
|
+
"chunks/node-2IRJmtOa.js": {
|
|
146
146
|
"isEntry": false,
|
|
147
147
|
"imports": [
|
|
148
|
-
"chunks/schema-
|
|
149
|
-
"chunks/rpc-local-community-
|
|
150
|
-
"chunks/util-
|
|
148
|
+
"chunks/schema-DEqa38Xx.js",
|
|
149
|
+
"chunks/rpc-local-community-DUD2jTEu.js",
|
|
150
|
+
"chunks/util-CcKyKVLs.js",
|
|
151
151
|
"path",
|
|
152
152
|
"assert",
|
|
153
153
|
"fs",
|
|
@@ -157,8 +157,8 @@
|
|
|
157
157
|
"rpc-websockets"
|
|
158
158
|
],
|
|
159
159
|
"dynamicImports": [
|
|
160
|
-
"chunks/helia-for-pkc-
|
|
161
|
-
"chunks/local-community-
|
|
160
|
+
"chunks/helia-for-pkc-CoiCnGzf.js",
|
|
161
|
+
"chunks/local-community-PMOePYFy.js"
|
|
162
162
|
],
|
|
163
163
|
"inputs": [
|
|
164
164
|
"node_modules/zod/v4/locales/en.js",
|
|
@@ -199,10 +199,10 @@
|
|
|
199
199
|
"dist/node/index.js"
|
|
200
200
|
]
|
|
201
201
|
},
|
|
202
|
-
"chunks/rpc-local-community-
|
|
202
|
+
"chunks/rpc-local-community-DUD2jTEu.js": {
|
|
203
203
|
"isEntry": false,
|
|
204
204
|
"imports": [
|
|
205
|
-
"chunks/schema-
|
|
205
|
+
"chunks/schema-DEqa38Xx.js",
|
|
206
206
|
"node:crypto",
|
|
207
207
|
"node:url",
|
|
208
208
|
"node:dns",
|
|
@@ -734,7 +734,7 @@
|
|
|
734
734
|
"dist/node/community/rpc-local-community.js"
|
|
735
735
|
]
|
|
736
736
|
},
|
|
737
|
-
"chunks/schema-
|
|
737
|
+
"chunks/schema-DEqa38Xx.js": {
|
|
738
738
|
"isEntry": false,
|
|
739
739
|
"imports": [
|
|
740
740
|
"node:module",
|
|
@@ -1278,10 +1278,10 @@
|
|
|
1278
1278
|
"dist/node/pubsub-messages/schema.js"
|
|
1279
1279
|
]
|
|
1280
1280
|
},
|
|
1281
|
-
"chunks/util-
|
|
1281
|
+
"chunks/util-CcKyKVLs.js": {
|
|
1282
1282
|
"isEntry": false,
|
|
1283
1283
|
"imports": [
|
|
1284
|
-
"chunks/schema-
|
|
1284
|
+
"chunks/schema-DEqa38Xx.js"
|
|
1285
1285
|
],
|
|
1286
1286
|
"dynamicImports": [],
|
|
1287
1287
|
"inputs": [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic,
|
|
2
|
-
import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-
|
|
1
|
+
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, cr as logger_default, or as PKCError } from "./schema-DEqa38Xx.js";
|
|
2
|
+
import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-CcKyKVLs.js";
|
|
3
3
|
import { CID } from "multiformats/cid";
|
|
4
4
|
import { NotFoundError } from "@libp2p/interface";
|
|
5
5
|
import { peerIdFromString } from "@libp2p/peer-id";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-
|
|
1
|
+
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-PMOePYFy.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as pubsubTopicToDhtKey, At as
|
|
2
|
-
import { A as getDefaultCommunityDbConfig, At as cleanWireAuthor, Bt as encode, C as calculateExpectedSignatureSize, Ct as verifyCommentModeration, D as deriveCommentIpfsFromCommentTableRow, Dt as verifyCommunityEdit, E as deleteOldCommunityInWindows, Et as verifyCommunity, Gn as require_lodash_merge, Gt as getPublicKeyFromPrivateKey, H as POST_REPLIES_SORT_TYPES, Ht as getIpfsKeyFromPrivateKey, I as moveCommunityDbToDeletedDirectory, It as getCommunityNameFromWire, Kt as createSchemaRowParser, L as resolveDbPostsCidRefs, Lt as getCommunityPublicKeyFromWire, M as getThumbnailPropsOfLink, Mt as getAuthorNameFromWire, N as importSignerIntoKuboNode, O as deriveDbPosts, Ot as verifyVote, S as backupCommunityDb, St as verifyCommentIpfs, Tt as verifyCommentUpdate, U as REPLY_REPLIES_SORT_TYPES, Un as stringify, Ut as getPKCAddressFromPublicKey, V as POSTS_SORT_TYPES, W as TIMEFRAMES_TO_SECONDS, Wn as STORAGE_KEYS, Wt as getPKCAddressFromPublicKeySync, Y as iterateOverPageCidsToFindAllCids, _t as verifyChallengeAnswer, a as pkcJsChallenges, an as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, b as encryptEd25519AesGcmPublicKeyBuffer, ct as signChallengeVerification, ft as signCommentUpdate, h as SignerWithPublicKeyAddress, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, i as getCommunityChallengeFromCommunityChallengeSettings, it as cleanUpBeforePublishing, k as deriveDbReplies, kt as buildRuntimeAuthor, l as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, lt as signComment, mt as signCommunity, o as TrackedInstanceRegistry, ot as signChallengeMessage, pt as signCommentUpdateForChallengeVerification, r as getChallengeVerification, rn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, s as LRUCache, t as RpcLocalCommunity, tt as pLimit, u as KeyvBetterSqlite3, ut as signCommentEdit, v as decryptEd25519AesGcmPublicKeyBuffer, vn as parseJsonWithPKCErrorIfFails, w as calculateInlineRepliesBudget, wt as verifyCommentPubsubMessage, x as BackupAbortError, xt as verifyCommentEdit, yt as verifyChallengeRequest, zt as decode } from "./rpc-local-community-
|
|
1
|
+
import { $ as pubsubTopicToDhtKey, At as trackStartedCommunity, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dr as __require, En as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Fn as CommentEditPubsubMessagePublicationSchema, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditReservedFields, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateTableRowSchema, Or as __toESM, P as getErrorCodeFromMessage, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, Tr as __commonJSMin, Un as AuthorReservedFields, W as isLinkOfAnimatedImage, Xn as require_commonjs, Y as isLinkValid, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bt as findCommunityInRegistry, cr as logger_default, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, fn as VotePubsubMessagePublicationSchema, hn as VoteTablesRowSchema, ht as statMfsPathSafely, k as doesDomainAddressHaveCapitalLetter, kn as CommentsTableRowSchema, kt as syncCommunityRegistryEntry, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nt as removeBlocksFromKuboNode, or as PKCError, pn as VotePubsubReservedFields, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunitySignedPropertyNames, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, sr as messages, t as ChallengeAnswerMessageSchema, u as DecryptedChallengeRequestPublicationSchema, vn as CommentIpfsSchema, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xr as ZodError, xt as findStartedCommunity, y as version_default, yn as CommentPubsubMessageReservedFields, yt as writeKuboFilesWithTimeout, zn as CommentEditsTableRowSchema } from "./schema-DEqa38Xx.js";
|
|
2
|
+
import { A as getDefaultCommunityDbConfig, At as cleanWireAuthor, Bt as encode, C as calculateExpectedSignatureSize, Ct as verifyCommentModeration, D as deriveCommentIpfsFromCommentTableRow, Dt as verifyCommunityEdit, E as deleteOldCommunityInWindows, Et as verifyCommunity, Gn as require_lodash_merge, Gt as getPublicKeyFromPrivateKey, H as POST_REPLIES_SORT_TYPES, Ht as getIpfsKeyFromPrivateKey, I as moveCommunityDbToDeletedDirectory, It as getCommunityNameFromWire, Kt as createSchemaRowParser, L as resolveDbPostsCidRefs, Lt as getCommunityPublicKeyFromWire, M as getThumbnailPropsOfLink, Mt as getAuthorNameFromWire, N as importSignerIntoKuboNode, O as deriveDbPosts, Ot as verifyVote, S as backupCommunityDb, St as verifyCommentIpfs, Tt as verifyCommentUpdate, U as REPLY_REPLIES_SORT_TYPES, Un as stringify, Ut as getPKCAddressFromPublicKey, V as POSTS_SORT_TYPES, W as TIMEFRAMES_TO_SECONDS, Wn as STORAGE_KEYS, Wt as getPKCAddressFromPublicKeySync, Y as iterateOverPageCidsToFindAllCids, _t as verifyChallengeAnswer, a as pkcJsChallenges, an as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, b as encryptEd25519AesGcmPublicKeyBuffer, ct as signChallengeVerification, ft as signCommentUpdate, h as SignerWithPublicKeyAddress, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, i as getCommunityChallengeFromCommunityChallengeSettings, it as cleanUpBeforePublishing, k as deriveDbReplies, kt as buildRuntimeAuthor, l as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, lt as signComment, mt as signCommunity, o as TrackedInstanceRegistry, ot as signChallengeMessage, pt as signCommentUpdateForChallengeVerification, r as getChallengeVerification, rn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, s as LRUCache, t as RpcLocalCommunity, tt as pLimit, u as KeyvBetterSqlite3, ut as signCommentEdit, v as decryptEd25519AesGcmPublicKeyBuffer, vn as parseJsonWithPKCErrorIfFails, w as calculateInlineRepliesBudget, wt as verifyCommentPubsubMessage, x as BackupAbortError, xt as verifyCommentEdit, yt as verifyChallengeRequest, zt as decode } from "./rpc-local-community-DUD2jTEu.js";
|
|
3
3
|
import { randomFillSync, randomUUID } from "node:crypto";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import path from "node:path";
|
|
@@ -6411,14 +6411,7 @@ async function updateLoop(community) {
|
|
|
6411
6411
|
log.error("Error in update loop", e);
|
|
6412
6412
|
community.emit("error", e);
|
|
6413
6413
|
} finally {
|
|
6414
|
-
await
|
|
6415
|
-
if (community._updateLoopAbortController?.signal.aborted) return resolve();
|
|
6416
|
-
const timer = setTimeout(resolve, community._pkc.updateInterval);
|
|
6417
|
-
community._updateLoopAbortController?.signal.addEventListener("abort", () => {
|
|
6418
|
-
clearTimeout(timer);
|
|
6419
|
-
resolve();
|
|
6420
|
-
}, { once: true });
|
|
6421
|
-
});
|
|
6414
|
+
await sleepUntilTimeoutOrAbort(community._pkc.updateInterval, community._updateLoopAbortController?.signal);
|
|
6422
6415
|
}
|
|
6423
6416
|
}
|
|
6424
6417
|
async function update(community) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as PKCClientsManager, $t as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCommunityPageParamSchema, At as cleanWireAuthor, B as CommentClientsManager, Bn as RpcSubscriptionIdResultSchema, Ct as verifyCommentModeration, Dn as RpcCidParamSchema, Dt as verifyCommunityEdit, En as RpcCancelExportParamSchema, F as monitorCommunitiesDirectory, Fn as RpcExportCommunityResultSchema, Ft as getCommunityAddressFromRecord, Hn as RpcUnsubscribeParamSchema, In as RpcFetchCidParamSchema, It as getCommunityNameFromWire, J as findCommentInPageInstanceRecursively, Kn as nativeFunctions$2, Ln as RpcFetchCidResultSchema, Lt as getCommunityPublicKeyFromWire, Mn as RpcExportCommunityModLogsParamSchema, Nn as RpcExportCommunityModLogsResultSchema, Nt as normalizeCreatePublicationAuthor, On as RpcCommentRepliesPageParamSchema, Ot as verifyVote, P as listCommunitiesSync, Pn as RpcExportCommunityParamSchema, Pt as buildRuntimeCommunityFields, Q as PublicationClientsManager, R as setNativeFunctions$1, Rn as RpcPublishChallengeAnswersParamSchema, Rt as normalizeCommunityInputFromCommunity, Sn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, St as verifyCommentIpfs, T as createKuboRpcClient, Tn as RpcAuthorNameParamSchema, Tt as verifyCommentUpdate, Vn as RpcSuccessResultSchema, Vt as getBufferedPKCAddressFromPublicKey, X as parseRawPages, Xt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, Z as RepliesPages, Zt as parseCommentIpfsSchemaWithPKCErrorIfItFails, _ as decryptEd25519AesGcm, _n as parseDecryptedChallengeWithPKCErrorIfItFails, a as pkcJsChallenges, at as signChallengeAnswer, bn as parseRpcCommentEventWithPKCErrorIfItFails, bt as verifyChallengeVerification, c as RemoteCommunity, cn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, d as decodeRpcChallengeAnswerPubsubMsg, dt as signCommentModeration, en as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, et as InflightFetchManager, f as decodeRpcChallengePubsubMsg, fn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, g as createSigner, gn as parseDecryptedChallengeVerification, gt as signVote, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, ht as signCommunityEdit, in as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, it as cleanUpBeforePublishing, j as getDefaultDataPath, jn as RpcEditCommunityParamSchema, jt as getAuthorNameFromRuntime, kn as RpcCommunityIdentifierParamSchema, kt as buildRuntimeAuthor, ln as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, lt as signComment, m as decodeRpcChallengeVerificationPubsubMsg, mn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nt as PKCTypedEmitter, o as TrackedInstanceRegistry, on as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, p as decodeRpcChallengeRequestPubsubMsg, pn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, q as extractCommunityRuntimeFieldsFromParsedPages, qn as require_undici, qt as parseCidStringSchemaWithPKCErrorIfItFails, rt as require_lib$1, s as LRUCache, sn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, st as signChallengeRequest, t as RpcLocalCommunity, tn as parseCommunityAddressWithPKCErrorIfItFails, u as KeyvBetterSqlite3, ut as signCommentEdit, vn as parseJsonWithPKCErrorIfFails, vt as verifyChallengeMessage, wn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, wt as verifyCommentPubsubMessage, xn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, xt as verifyCommentEdit, y as encryptEd25519AesGcm, yn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, z as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, zn as RpcResolveAuthorNameResultSchema, zt as decode } from "./rpc-local-community-
|
|
3
|
-
import { n as getHeliaDebugContext } from "./util-
|
|
1
|
+
import { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Cr as parsedType, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dr as __require, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Or as __toESM, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as CID, Rt as pTimeout, Sr as joinValues, St as findUpdatingComment, Tr as __commonJSMin, Tt as listUpdatingComments, Xn as require_commonjs, Zn as require_retry, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, cn as PubsubTopicSchema, cr as logger_default, ct as resolveWhenPredicateIsTrue, dr as setErrorMap, ft as shortifyAddress, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, or as PKCError, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, sr as messages, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as FailedToFetchCommentIpfsFromGatewaysError, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as stringifyPrimitive, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, z as isAbortError } from "./schema-DEqa38Xx.js";
|
|
2
|
+
import { $ as PKCClientsManager, $t as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCommunityPageParamSchema, At as cleanWireAuthor, B as CommentClientsManager, Bn as RpcSubscriptionIdResultSchema, Ct as verifyCommentModeration, Dn as RpcCidParamSchema, Dt as verifyCommunityEdit, En as RpcCancelExportParamSchema, F as monitorCommunitiesDirectory, Fn as RpcExportCommunityResultSchema, Ft as getCommunityAddressFromRecord, Hn as RpcUnsubscribeParamSchema, In as RpcFetchCidParamSchema, It as getCommunityNameFromWire, J as findCommentInPageInstanceRecursively, Kn as nativeFunctions$2, Ln as RpcFetchCidResultSchema, Lt as getCommunityPublicKeyFromWire, Mn as RpcExportCommunityModLogsParamSchema, Nn as RpcExportCommunityModLogsResultSchema, Nt as normalizeCreatePublicationAuthor, On as RpcCommentRepliesPageParamSchema, Ot as verifyVote, P as listCommunitiesSync, Pn as RpcExportCommunityParamSchema, Pt as buildRuntimeCommunityFields, Q as PublicationClientsManager, R as setNativeFunctions$1, Rn as RpcPublishChallengeAnswersParamSchema, Rt as normalizeCommunityInputFromCommunity, Sn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, St as verifyCommentIpfs, T as createKuboRpcClient, Tn as RpcAuthorNameParamSchema, Tt as verifyCommentUpdate, Vn as RpcSuccessResultSchema, Vt as getBufferedPKCAddressFromPublicKey, X as parseRawPages, Xt as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, Z as RepliesPages, Zt as parseCommentIpfsSchemaWithPKCErrorIfItFails, _ as decryptEd25519AesGcm, _n as parseDecryptedChallengeWithPKCErrorIfItFails, a as pkcJsChallenges, at as signChallengeAnswer, bn as parseRpcCommentEventWithPKCErrorIfItFails, bt as verifyChallengeVerification, c as RemoteCommunity, cn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, d as decodeRpcChallengeAnswerPubsubMsg, dt as signCommentModeration, en as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, et as InflightFetchManager, f as decodeRpcChallengePubsubMsg, fn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, g as createSigner, gn as parseDecryptedChallengeVerification, gt as signVote, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, ht as signCommunityEdit, in as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, it as cleanUpBeforePublishing, j as getDefaultDataPath, jn as RpcEditCommunityParamSchema, jt as getAuthorNameFromRuntime, kn as RpcCommunityIdentifierParamSchema, kt as buildRuntimeAuthor, ln as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, lt as signComment, m as decodeRpcChallengeVerificationPubsubMsg, mn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, n as RpcRemoteCommunity, nt as PKCTypedEmitter, o as TrackedInstanceRegistry, on as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, p as decodeRpcChallengeRequestPubsubMsg, pn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, q as extractCommunityRuntimeFieldsFromParsedPages, qn as require_undici, qt as parseCidStringSchemaWithPKCErrorIfItFails, rt as require_lib$1, s as LRUCache, sn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, st as signChallengeRequest, t as RpcLocalCommunity, tn as parseCommunityAddressWithPKCErrorIfItFails, u as KeyvBetterSqlite3, ut as signCommentEdit, vn as parseJsonWithPKCErrorIfFails, vt as verifyChallengeMessage, wn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, wt as verifyCommentPubsubMessage, xn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, xt as verifyCommentEdit, y as encryptEd25519AesGcm, yn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, z as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, zn as RpcResolveAuthorNameResultSchema, zt as decode } from "./rpc-local-community-DUD2jTEu.js";
|
|
3
|
+
import { n as getHeliaDebugContext } from "./util-CcKyKVLs.js";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import assert from "assert";
|
|
6
6
|
import fs from "fs";
|
|
@@ -1431,7 +1431,8 @@ var Comment = class extends Publication {
|
|
|
1431
1431
|
_scheduleParallelCommunityConnect(log) {
|
|
1432
1432
|
if (!this.communityName && !this.communityPublicKey) return;
|
|
1433
1433
|
const stopSignal = this._getStopAbortSignal();
|
|
1434
|
-
|
|
1434
|
+
(async () => {
|
|
1435
|
+
await sleepUntilTimeoutOrAbort(5e3, stopSignal);
|
|
1435
1436
|
if (this.raw.comment) return;
|
|
1436
1437
|
if (this._isStopAbortRequested() || this._pkc.destroyed) return;
|
|
1437
1438
|
log("Starting parallel pkc.getCommunity for", this.cid, "so bitswap can fetch the comment block from community peers");
|
|
@@ -1443,9 +1444,7 @@ var Comment = class extends Publication {
|
|
|
1443
1444
|
} catch (err) {
|
|
1444
1445
|
if (!isAbortError(err)) log.error("Parallel pkc.getCommunity failed for", this.cid, err);
|
|
1445
1446
|
}
|
|
1446
|
-
}
|
|
1447
|
-
if (stopSignal) if (stopSignal.aborted) clearTimeout(timer);
|
|
1448
|
-
else stopSignal.addEventListener("abort", () => clearTimeout(timer), { once: true });
|
|
1447
|
+
})();
|
|
1449
1448
|
}
|
|
1450
1449
|
async _attemptToFetchCommentIpfsIfNeeded(log) {
|
|
1451
1450
|
if (this.cid && !this.raw.comment) {
|
|
@@ -6468,6 +6467,16 @@ var CommentModeration = class extends Publication {
|
|
|
6468
6467
|
};
|
|
6469
6468
|
//#endregion
|
|
6470
6469
|
//#region dist/node/runtime/node/setup-kubo-http-routers.js
|
|
6470
|
+
async function _postToKuboRpc(kuboClient, url) {
|
|
6471
|
+
const res = await fetch(url, {
|
|
6472
|
+
method: "POST",
|
|
6473
|
+
headers: kuboClient._clientOptions.headers
|
|
6474
|
+
});
|
|
6475
|
+
if (!res.ok) {
|
|
6476
|
+
const body = await res.text().catch(() => "");
|
|
6477
|
+
throw Error(`kubo RPC responded with non-2xx status ${res.status} ${res.statusText}${body ? `: ${body}` : ""}`);
|
|
6478
|
+
}
|
|
6479
|
+
}
|
|
6471
6480
|
function _mergeRouterConfigs(existingConfig, newConfig) {
|
|
6472
6481
|
if (!existingConfig?.Routers) return newConfig;
|
|
6473
6482
|
const existingRoutersByEndpoint = /* @__PURE__ */ new Map();
|
|
@@ -6501,10 +6510,7 @@ async function _setProvideDhtSweepEnabledOnKuboNode(kuboClient, sweepEnabled) {
|
|
|
6501
6510
|
const configKey = "Provide.DHT.SweepEnabled";
|
|
6502
6511
|
const url = `${kuboClient._clientOptions.url}/config?arg=${configKey}&arg=${JSON.stringify(sweepEnabled)}&json=true`;
|
|
6503
6512
|
try {
|
|
6504
|
-
await
|
|
6505
|
-
method: "POST",
|
|
6506
|
-
headers: kuboClient._clientOptions.headers
|
|
6507
|
-
});
|
|
6513
|
+
await _postToKuboRpc(kuboClient, url);
|
|
6508
6514
|
} catch (e) {
|
|
6509
6515
|
const error = new PKCError("ERR_FAILED_TO_SET_CONFIG_ON_KUBO_NODE", {
|
|
6510
6516
|
fullUrl: url,
|
|
@@ -6536,10 +6542,7 @@ async function _setHttpRouterOptionsOnKuboNode(kuboClient, routingValue) {
|
|
|
6536
6542
|
const mergedRoutingValue = _mergeRouterConfigs(routingConfigBeforeChanging, routingValue);
|
|
6537
6543
|
const url = `${kuboClient._clientOptions.url}/config?arg=${routingKey}&arg=${JSON.stringify(mergedRoutingValue)}&json=true`;
|
|
6538
6544
|
try {
|
|
6539
|
-
await
|
|
6540
|
-
method: "POST",
|
|
6541
|
-
headers: kuboClient._clientOptions.headers
|
|
6542
|
-
});
|
|
6545
|
+
await _postToKuboRpc(kuboClient, url);
|
|
6543
6546
|
} catch (e) {
|
|
6544
6547
|
const error = new PKCError("ERR_FAILED_TO_SET_CONFIG_ON_KUBO_NODE", {
|
|
6545
6548
|
fullUrl: url,
|
|
@@ -6559,10 +6562,95 @@ async function _setHttpRouterOptionsOnKuboNode(kuboClient, routingValue) {
|
|
|
6559
6562
|
log("Config on kubo node has been changed. PKC-js will send shutdown command to node", kuboClient._clientOptions.url, "Clients of pkc-js should restart ipfs node");
|
|
6560
6563
|
const shutdownUrl = `${kuboClient._clientOptions.url}/shutdown`;
|
|
6561
6564
|
try {
|
|
6562
|
-
await
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
+
await _postToKuboRpc(kuboClient, shutdownUrl);
|
|
6566
|
+
} catch (e) {
|
|
6567
|
+
const error = new PKCError("ERR_FAILED_TO_SHUTDOWN_KUBO_NODE", {
|
|
6568
|
+
actualError: e,
|
|
6569
|
+
kuboEndpoint: kuboClient._clientOptions.url,
|
|
6570
|
+
shutdownUrl
|
|
6565
6571
|
});
|
|
6572
|
+
log.error(e);
|
|
6573
|
+
throw error;
|
|
6574
|
+
}
|
|
6575
|
+
}
|
|
6576
|
+
}
|
|
6577
|
+
function _isPrivateOrLoopbackIpv4(ip) {
|
|
6578
|
+
if (/^(10|127|0)\./.test(ip) || /^169\.254\./.test(ip) || /^192\.168\./.test(ip)) return true;
|
|
6579
|
+
const m172 = ip.match(/^172\.(\d{1,3})\./);
|
|
6580
|
+
if (m172 && Number(m172[1]) >= 16 && Number(m172[1]) <= 31) return true;
|
|
6581
|
+
const m100 = ip.match(/^100\.(\d{1,3})\./);
|
|
6582
|
+
if (m100 && Number(m100[1]) >= 64 && Number(m100[1]) <= 127) return true;
|
|
6583
|
+
return false;
|
|
6584
|
+
}
|
|
6585
|
+
function _isPrivateOrLoopbackIpv6(ip) {
|
|
6586
|
+
const l = ip.toLowerCase();
|
|
6587
|
+
return l === "::1" || l === "::" || l.startsWith("fe80") || l.startsWith("fc") || l.startsWith("fd");
|
|
6588
|
+
}
|
|
6589
|
+
function _hasPublicHost(addr) {
|
|
6590
|
+
const parts = addr.split("/");
|
|
6591
|
+
const proto = parts[1];
|
|
6592
|
+
const host = parts[2] ?? "";
|
|
6593
|
+
if (proto === "ip4") return !_isPrivateOrLoopbackIpv4(host);
|
|
6594
|
+
if (proto === "ip6") return !_isPrivateOrLoopbackIpv6(host);
|
|
6595
|
+
if (proto === "dns" || proto === "dns4" || proto === "dns6" || proto === "dnsaddr") return true;
|
|
6596
|
+
return false;
|
|
6597
|
+
}
|
|
6598
|
+
function selectBrowserDialableAddrsToAppendAnnounce(idAddrs) {
|
|
6599
|
+
const webrtcDirect = /* @__PURE__ */ new Set();
|
|
6600
|
+
const wss = /* @__PURE__ */ new Set();
|
|
6601
|
+
for (const raw of idAddrs) {
|
|
6602
|
+
const addr = String(raw).replace(/\/p2p\/[^/]+$/, "");
|
|
6603
|
+
if (!_hasPublicHost(addr)) continue;
|
|
6604
|
+
if (addr.includes("/webrtc-direct/") && addr.includes("/certhash/")) webrtcDirect.add(addr);
|
|
6605
|
+
else if (addr.endsWith("/ws") && (addr.includes("/tls/ws") || addr.includes("/tls/sni/") && addr.includes("libp2p.direct"))) wss.add(addr);
|
|
6606
|
+
}
|
|
6607
|
+
return {
|
|
6608
|
+
webrtcDirect: [...webrtcDirect],
|
|
6609
|
+
wss: [...wss],
|
|
6610
|
+
all: [...webrtcDirect, ...wss]
|
|
6611
|
+
};
|
|
6612
|
+
}
|
|
6613
|
+
async function _setKuboConfigJson(kuboClient, configKey, value) {
|
|
6614
|
+
const log = logger_default("pkc-js:pkc:_init:syncKuboAppendAnnounce:setConfig");
|
|
6615
|
+
const url = `${kuboClient._clientOptions.url}/config?arg=${configKey}&arg=${JSON.stringify(value)}&json=true`;
|
|
6616
|
+
try {
|
|
6617
|
+
await _postToKuboRpc(kuboClient, url);
|
|
6618
|
+
} catch (e) {
|
|
6619
|
+
const error = new PKCError("ERR_FAILED_TO_SET_CONFIG_ON_KUBO_NODE", {
|
|
6620
|
+
fullUrl: url,
|
|
6621
|
+
actualError: e,
|
|
6622
|
+
kuboEndpoint: kuboClient._clientOptions.url,
|
|
6623
|
+
configKey,
|
|
6624
|
+
configValueToBeSet: value
|
|
6625
|
+
});
|
|
6626
|
+
log.error(e);
|
|
6627
|
+
throw error;
|
|
6628
|
+
}
|
|
6629
|
+
log.trace("Set config key", configKey, "on node", kuboClient._clientOptions.url);
|
|
6630
|
+
}
|
|
6631
|
+
async function _syncAppendAnnounceOnKuboNode(pkc, kuboClient) {
|
|
6632
|
+
const log = logger_default("pkc-js:pkc:_init:syncKuboAppendAnnounce");
|
|
6633
|
+
const desired = selectBrowserDialableAddrsToAppendAnnounce(((await kuboClient._client.id()).addresses ?? []).map((a) => String(a)));
|
|
6634
|
+
let autoTlsEnabled = false;
|
|
6635
|
+
try {
|
|
6636
|
+
autoTlsEnabled = String(await kuboClient._client.config.get("AutoTLS.Enabled")) === "true";
|
|
6637
|
+
} catch {}
|
|
6638
|
+
const current = await kuboClient._client.config.get("Addresses.AppendAnnounce") ?? [];
|
|
6639
|
+
const currentArr = Array.isArray(current) ? current.map((a) => String(a)) : [];
|
|
6640
|
+
const currentSet = new Set(currentArr);
|
|
6641
|
+
const merged = [...currentArr];
|
|
6642
|
+
let changed = false;
|
|
6643
|
+
for (const addr of desired.all) if (!currentSet.has(addr)) {
|
|
6644
|
+
merged.push(addr);
|
|
6645
|
+
currentSet.add(addr);
|
|
6646
|
+
changed = true;
|
|
6647
|
+
}
|
|
6648
|
+
if (changed && !pkc.destroyed) {
|
|
6649
|
+
await _setKuboConfigJson(kuboClient, "Addresses.AppendAnnounce", merged);
|
|
6650
|
+
log("Added browser-dialable addresses to AppendAnnounce on kubo node", kuboClient._clientOptions.url, desired.all, "- sending shutdown so the node restarts and announces them");
|
|
6651
|
+
const shutdownUrl = `${kuboClient._clientOptions.url}/shutdown`;
|
|
6652
|
+
try {
|
|
6653
|
+
await _postToKuboRpc(kuboClient, shutdownUrl);
|
|
6566
6654
|
} catch (e) {
|
|
6567
6655
|
const error = new PKCError("ERR_FAILED_TO_SHUTDOWN_KUBO_NODE", {
|
|
6568
6656
|
actualError: e,
|
|
@@ -6573,6 +6661,28 @@ async function _setHttpRouterOptionsOnKuboNode(kuboClient, routingValue) {
|
|
|
6573
6661
|
throw error;
|
|
6574
6662
|
}
|
|
6575
6663
|
}
|
|
6664
|
+
const wssPresent = desired.wss.length > 0 && desired.wss.every((a) => currentSet.has(a));
|
|
6665
|
+
return {
|
|
6666
|
+
changed,
|
|
6667
|
+
wssPresent,
|
|
6668
|
+
autoTlsEnabled
|
|
6669
|
+
};
|
|
6670
|
+
}
|
|
6671
|
+
async function syncKuboAppendAnnounce(pkc) {
|
|
6672
|
+
const log = logger_default("pkc-js:pkc:_init:syncKuboAppendAnnounce");
|
|
6673
|
+
if (pkc.destroyed) return { allDone: true };
|
|
6674
|
+
let allDone = true;
|
|
6675
|
+
for (const kuboClient of Object.values(pkc.clients.kuboRpcClients)) {
|
|
6676
|
+
if (pkc.destroyed) return { allDone: true };
|
|
6677
|
+
try {
|
|
6678
|
+
const { wssPresent, autoTlsEnabled } = await _syncAppendAnnounceOnKuboNode(pkc, kuboClient);
|
|
6679
|
+
if (autoTlsEnabled && !wssPresent) allDone = false;
|
|
6680
|
+
} catch (e) {
|
|
6681
|
+
log.error("Failed to sync AppendAnnounce on kubo node", kuboClient._clientOptions.url, e);
|
|
6682
|
+
allDone = false;
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
return { allDone };
|
|
6576
6686
|
}
|
|
6577
6687
|
async function setupKuboHttpRouters(pkc) {
|
|
6578
6688
|
if (pkc.destroyed) return;
|
|
@@ -6805,7 +6915,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
6805
6915
|
this.clients.libp2pJsClients = {};
|
|
6806
6916
|
if (!this.libp2pJsClientsOptions) return;
|
|
6807
6917
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
6808
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
6918
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CoiCnGzf.js");
|
|
6809
6919
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
6810
6920
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
6811
6921
|
...clientOptions,
|
|
@@ -6828,9 +6938,10 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
6828
6938
|
const log = logger_default("pkc-js:pkc:_initHttpRoutersWithIpfsInBackground");
|
|
6829
6939
|
if (this.destroyed) return;
|
|
6830
6940
|
if (this.httpRoutersOptions?.length && this.kuboRpcClientsOptions?.length && this._canCreateNewLocalCommunity()) {
|
|
6831
|
-
const setupPromise = setupKuboHttpRouters(this).then(() => {
|
|
6941
|
+
const setupPromise = setupKuboHttpRouters(this).then(async () => {
|
|
6832
6942
|
if (this.destroyed) return;
|
|
6833
6943
|
log("Set http router options successfully on all connected ipfs", Object.keys(this.clients.kuboRpcClients));
|
|
6944
|
+
await this._runAppendAnnounceSyncAndReschedule();
|
|
6834
6945
|
}).catch((e) => {
|
|
6835
6946
|
if (this.destroyed) return;
|
|
6836
6947
|
log.error("Failed to set http router options on ipfs nodes due to error", e);
|
|
@@ -6839,6 +6950,22 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
6839
6950
|
this._httpRouterSetupPromise = setupPromise;
|
|
6840
6951
|
}
|
|
6841
6952
|
}
|
|
6953
|
+
async _runAppendAnnounceSyncAndReschedule() {
|
|
6954
|
+
const log = logger_default("pkc-js:pkc:_runAppendAnnounceSyncAndReschedule");
|
|
6955
|
+
const RECHECK_MS = 600 * 1e3;
|
|
6956
|
+
if (this.destroyed) return;
|
|
6957
|
+
let allDone = false;
|
|
6958
|
+
try {
|
|
6959
|
+
({allDone} = await syncKuboAppendAnnounce(this));
|
|
6960
|
+
} catch (e) {
|
|
6961
|
+
log.error("AppendAnnounce sync failed; will retry", e);
|
|
6962
|
+
}
|
|
6963
|
+
if (this.destroyed || allDone) return;
|
|
6964
|
+
this._appendAnnounceTimer = setTimeout(() => {
|
|
6965
|
+
this._runAppendAnnounceSyncAndReschedule().catch((e) => log.error("AppendAnnounce re-sync failed", e));
|
|
6966
|
+
}, RECHECK_MS);
|
|
6967
|
+
this._appendAnnounceTimer.unref?.();
|
|
6968
|
+
}
|
|
6842
6969
|
async _init() {
|
|
6843
6970
|
const log = logger_default("pkc-js:pkc:_init");
|
|
6844
6971
|
this._storage = new Storage(this);
|
|
@@ -7044,7 +7171,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
7044
7171
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
7045
7172
|
log.trace("Received community options to create a local community instance:", options);
|
|
7046
7173
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
7047
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
7174
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-DiTjNeA_.js");
|
|
7048
7175
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
7049
7176
|
const community = new LocalCommunity(this);
|
|
7050
7177
|
if (isLocalCommunity) {
|
|
@@ -7402,6 +7529,10 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
7402
7529
|
for (const community of listUpdatingCommunities(this)) await community.stop();
|
|
7403
7530
|
await Promise.all(listStartedCommunities(this).map((community) => community.stop()));
|
|
7404
7531
|
if (this._communityFsWatchAbort) this._communityFsWatchAbort.abort();
|
|
7532
|
+
if (this._appendAnnounceTimer) {
|
|
7533
|
+
clearTimeout(this._appendAnnounceTimer);
|
|
7534
|
+
this._appendAnnounceTimer = void 0;
|
|
7535
|
+
}
|
|
7405
7536
|
if (this._httpRouterSetupPromise) {
|
|
7406
7537
|
await this._httpRouterSetupPromise;
|
|
7407
7538
|
this._httpRouterSetupPromise = void 0;
|
package/dist/bundled/chunks/{rpc-local-community-CO__pwvD.js → rpc-local-community-DUD2jTEu.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as pubsubTopicToDhtKey, $n as
|
|
1
|
+
import { $ as pubsubTopicToDhtKey, $n as create, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as __require, E as createAbortError, En as CommentUpdateSchema, Er as __exportAll, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as __toESM, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as CID$1, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as __commonJSMin, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as require_commonjs$4, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as require_retry$1, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as number, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as FailedToFetchPageIpfsFromGatewaysError, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as string, c as ChallengeVerificationMessageSignedPropertyNames, cr as logger_default, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, en as CommunityExportRecordsSchema, er as all, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as _enum, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as literal, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as custom, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as FailedToFetchGenericIpfsFromGatewaysError, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, k as doesDomainAddressHaveCapitalLetter, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as require_supports_color, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as boolean, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as FailedToFetchCommentUpdateFromGatewaysError, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as PKCError, p as DecryptedChallengeVerificationSchema, pr as array, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as FailedToFetchCommunityFromGatewaysError, sn as ExportCommunityModLogsOptionsSchema, sr as messages, tn as CommunityIpfsReservedFields, tr as FailedToFetchCommentIpfsFromGatewaysError, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as require_ms$1, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as object, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xt as findStartedCommunity, yr as record, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-DEqa38Xx.js";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import dns from "node:dns";
|
|
@@ -98914,14 +98914,10 @@ var BaseClientsManager = class BaseClientsManager {
|
|
|
98914
98914
|
});
|
|
98915
98915
|
try {
|
|
98916
98916
|
throwIfAbortSignalAborted(abortSignal);
|
|
98917
|
-
const
|
|
98917
|
+
const result = await raceAgainstAbort(nameResolver.resolve({
|
|
98918
98918
|
name,
|
|
98919
98919
|
abortSignal
|
|
98920
|
-
});
|
|
98921
|
-
const result = abortSignal ? await Promise.race([resolvePromise, new Promise((_, reject) => {
|
|
98922
|
-
if (abortSignal.aborted) reject(createAbortError());
|
|
98923
|
-
else abortSignal.addEventListener("abort", () => reject(createAbortError()), { once: true });
|
|
98924
|
-
})]) : await resolvePromise;
|
|
98920
|
+
}), abortSignal);
|
|
98925
98921
|
throwIfAbortSignalAborted(abortSignal);
|
|
98926
98922
|
value = result?.publicKey;
|
|
98927
98923
|
} catch (e) {
|
|
@@ -124598,15 +124594,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
124598
124594
|
} catch (e) {
|
|
124599
124595
|
log.error(`Failed to update community ${this._community.address} for this iteration, will retry later`, e);
|
|
124600
124596
|
} finally {
|
|
124601
|
-
await
|
|
124602
|
-
const stopSignal = this._community._getStopAbortSignal();
|
|
124603
|
-
if (stopSignal?.aborted) return resolve();
|
|
124604
|
-
const timer = setTimeout(resolve, updateInterval);
|
|
124605
|
-
stopSignal?.addEventListener("abort", () => {
|
|
124606
|
-
clearTimeout(timer);
|
|
124607
|
-
resolve();
|
|
124608
|
-
}, { once: true });
|
|
124609
|
-
});
|
|
124597
|
+
await sleepUntilTimeoutOrAbort(updateInterval, this._community._getStopAbortSignal());
|
|
124610
124598
|
}
|
|
124611
124599
|
this._community._clearStopAbortController();
|
|
124612
124600
|
log("Community", this._community.address, "is no longer updating");
|
|
@@ -127360,7 +127348,7 @@ const shouldExcludeChallengeCommentCids = async (communityChallenge, challengeRe
|
|
|
127360
127348
|
} catch (e) {
|
|
127361
127349
|
throw e;
|
|
127362
127350
|
} finally {
|
|
127363
|
-
getCommentPending[pendingKey]
|
|
127351
|
+
delete getCommentPending[pendingKey];
|
|
127364
127352
|
}
|
|
127365
127353
|
};
|
|
127366
127354
|
const validateComment = async (commentCid, addressesSet, exclude) => {
|
|
@@ -33837,6 +33837,34 @@ function throwIfAbortSignalAborted(signal) {
|
|
|
33837
33837
|
if (typeof signal.reason === "string" && signal.reason.length > 0) throw createAbortError(signal.reason);
|
|
33838
33838
|
throw createAbortError();
|
|
33839
33839
|
}
|
|
33840
|
+
function sleepUntilTimeoutOrAbort(ms, signal) {
|
|
33841
|
+
return new Promise((resolve) => {
|
|
33842
|
+
if (signal?.aborted) return resolve();
|
|
33843
|
+
const onAbortOrTimeout = () => {
|
|
33844
|
+
clearTimeout(timer);
|
|
33845
|
+
signal?.removeEventListener("abort", onAbortOrTimeout);
|
|
33846
|
+
resolve();
|
|
33847
|
+
};
|
|
33848
|
+
const timer = setTimeout(onAbortOrTimeout, ms);
|
|
33849
|
+
signal?.addEventListener("abort", onAbortOrTimeout, { once: true });
|
|
33850
|
+
});
|
|
33851
|
+
}
|
|
33852
|
+
async function raceAgainstAbort(promise, signal) {
|
|
33853
|
+
if (!signal) return promise;
|
|
33854
|
+
let onAbort;
|
|
33855
|
+
try {
|
|
33856
|
+
return await Promise.race([promise, new Promise((_, reject) => {
|
|
33857
|
+
if (signal.aborted) {
|
|
33858
|
+
reject(createAbortError());
|
|
33859
|
+
return;
|
|
33860
|
+
}
|
|
33861
|
+
onAbort = () => reject(createAbortError());
|
|
33862
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
33863
|
+
})]);
|
|
33864
|
+
} finally {
|
|
33865
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
33866
|
+
}
|
|
33867
|
+
}
|
|
33840
33868
|
function replaceXWithY(obj, x, y) {
|
|
33841
33869
|
if (!import_commonjs.isPlainObject(obj)) return obj;
|
|
33842
33870
|
const newObj = {};
|
|
@@ -34563,7 +34591,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
|
|
|
34563
34591
|
}
|
|
34564
34592
|
//#endregion
|
|
34565
34593
|
//#region dist/node/generated-version.js
|
|
34566
|
-
const version = "0.0.
|
|
34594
|
+
const version = "0.0.50";
|
|
34567
34595
|
//#endregion
|
|
34568
34596
|
//#region dist/node/version.js
|
|
34569
34597
|
const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
|
|
@@ -34711,4 +34739,4 @@ const DecryptedChallengeVerificationSchema = object({
|
|
|
34711
34739
|
}).strict();
|
|
34712
34740
|
const ChallengeVerificationMessageSignedPropertyNames = import_commonjs.keys.strict(import_commonjs.omit(ChallengeVerificationMessageSchema.shape, ["signature"]));
|
|
34713
34741
|
//#endregion
|
|
34714
|
-
export { pubsubTopicToDhtKey as $,
|
|
34742
|
+
export { pubsubTopicToDhtKey as $, create as $n, CommunityEditOptionsSchema as $t, extractNetworkErrorDetails as A, CreateCommentOptionsWithRefinementSchema as An, trackStartedCommunity as At, isIpfsCid as B, CreateCommentEditOptionsWithRefinementSchema as Bn, CommunityEditPublicationPubsubReservedFields as Bt, contentContainsMarkdownAudio as C, CommentUpdateForChallengeVerificationSchema as Cn, parsedType as Cr, findUpdatingCommunity as Ct, deepMergeRuntimeFields as D, CommentUpdateSignedPropertyNames as Dn, __require as Dr, refreshTrackedCommentAliases as Dt, createAbortError as E, CommentUpdateSchema as En, __exportAll as Er, listUpdatingCommunities as Et, getIpnsRecordInLocalKuboNode as F, CommentEditPubsubMessagePublicationSchema as Fn, untrackUpdatingCommunity as Ft, isLinkOfAudio as G, CidPathSchema as Gn, CommentModerationPubsubMessagePublicationSchema as Gt, isIpns as H, AuthorCommentIpfsReservedFields as Hn, CommunityEditPubsubMessagePublicationSchema as Ht, getPostUpdateTimestampRange as I, CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema as In, require_sha256 as It, isLinkOfVideo as J, CommunityAuthorChallengeReservedFieldNames as Jn, CommentModerationsTableRowSchema as Jt, isLinkOfImage as K, CidStringSchema as Kn, CommentModerationReservedFields as Kt, hideClassPrivateProps as L, CommentEditReservedFields as Ln, TimeoutError as Lt, genToArray as M, ModQueuePageIpfsSchema as Mn, trackUpdatingCommunity as Mt, getEquivalentCommunityAddresses as N, PageIpfsSchema as Nn, untrackStartedCommunity as Nt, derivePublicationFromChallengeRequest as O, CommentUpdateTableRowSchema as On, __toESM as Or, refreshTrackedCommunityAliases as Ot, getErrorCodeFromMessage as P, CommentEditChallengeRequestToEncryptSchema as Pn, untrackUpdatingComment as Pt, isStringDomain as Q, CID$2 as Qn, CommunityChallengeSettingSchema as Qt, ipnsNameToIpnsOverPubsubTopic as R, CommentEditSignedPropertyNames as Rn, pTimeout as Rt, calculateStringSizeSameAsIpfsAddCidV0 as S, CommentUpdateChallengeReservedFieldNames as Sn, joinValues as Sr, findUpdatingComment as St, contentContainsMarkdownVideos as T, CommentUpdateReservedFields as Tn, __commonJSMin as Tr, listUpdatingComments as Tt, isIpnsPath as U, AuthorReservedFields as Un, CreateCommunityEditPublicationOptionsWithRefinementSchema as Ut, isIpfsPath as V, AuthorAddressSchema as Vn, CommunityEditPublicationSignedPropertyNames as Vt, isLinkOfAnimatedImage as W, ChallengeAnswersSchema as Wn, CommentModerationChallengeRequestToEncryptSchema as Wt, isRequestPubsubPublicationOfPost as X, require_commonjs as Xn, ChallengeFileFactorySchema as Xt, isLinkValid as Y, CreateSignerSchema as Yn, CreateCommentModerationOptionsWithRefinementSchema as Yt, isRequestPubsubPublicationOfReply as Z, require_retry as Zn, ChallengeFileSchema as Zt, PKCUserOptionBaseSchema as _, CommentIpfsReservedFields as _n, number as _r, timestamp as _t, ChallengeRequestMessageSchema as a, CreateRemoteCommunityFunctionArgumentSchema as an, FailedToFetchPageIpfsFromGatewaysError as ar, removeNullUndefinedValues as at, areEquivalentCommunityAddresses as b, CommentPubsubMessageWithFlexibleAuthorRefinementSchema as bn, string as br, findCommunityInRegistry as bt, ChallengeVerificationMessageSignedPropertyNames as c, PubsubTopicSchema as cn, logger_default as cr, resolveWhenPredicateIsTrue as ct, DecryptedChallengeRequestSchema as d, VoteChallengeRequestToEncryptSchema as dn, setErrorMap as dr, retryKuboIpfsAddAndProvide as dt, CommunityExportRecordsSchema as en, all as er, pubsubTopicToDhtKeyCid as et, DecryptedChallengeSchema as f, VotePubsubMessagePublicationSchema as fn, _enum as fr, shortifyAddress as ft, PKCParsedOptionsSchema as g, CommentChallengeRequestToEncryptSchema as gn, literal as gr, throwIfAbortSignalAborted as gt, NameResolverSerializedSchema as h, VoteTablesRowSchema as hn, custom as hr, statMfsPathSafely as ht, ChallengeMessageSignedPropertyNames as i, CreateNewLocalCommunityUserOptionsSchema as in, FailedToFetchGenericIpfsFromGatewaysError as ir, removeNullUndefinedEmptyObjectsValuesRecursively as it, fetchAndValidateIpnsRecordFromGateway as j, GetPageParamSchema as jn, trackUpdatingComment as jt, doesDomainAddressHaveCapitalLetter as k, CommentsTableRowSchema as kn, syncCommunityRegistryEntry as kt, DecryptedChallengeAnswerSchema as l, RpcRemoteCommunityUpdateEventResultSchema as ln, require_supports_color as lr, retryKuboBlockPutPinAndProvidePubsubTopic as lt, NameResolveCacheOptionsSchema as m, VoteSignedPropertyNames as mn, boolean as mr, sleepUntilTimeoutOrAbort as mt, ChallengeAnswerMessageSignedPropertyNames as n, CommunityIpfsSchema as nn, FailedToFetchCommentUpdateFromGatewaysError as nr, removeBlocksFromKuboNode as nt, ChallengeRequestMessageSignedPropertyNames as o, CreateRpcCommunityFunctionArgumentSchema as on, PKCError as or, removeUndefinedValuesRecursively as ot, DecryptedChallengeVerificationSchema as p, VotePubsubReservedFields as pn, array as pr, shortifyCid as pt, isLinkOfMedia as q, CommunityAddressSchema as qn, CommentModerationSignedPropertyNames as qt, ChallengeMessageSchema as r, CommunitySignedPropertyNames as rn, FailedToFetchCommunityFromGatewaysError as rr, removeMfsFilesSafely as rt, ChallengeVerificationMessageSchema as s, ExportCommunityModLogsOptionsSchema as sn, messages as sr, replaceXWithY as st, ChallengeAnswerMessageSchema as t, CommunityIpfsReservedFields as tn, FailedToFetchCommentIpfsFromGatewaysError as tr, raceAgainstAbort as tt, DecryptedChallengeRequestPublicationSchema as u, CreateVoteUserOptionsWithRefinementSchema as un, require_ms as ur, retryKuboIpfsAdd as ut, PKCUserOptionsSchema as v, CommentIpfsSchema as vn, object as vr, waitForUpdateInCommunityInstanceWithErrorAndTimeout as vt, contentContainsMarkdownImages as w, CommentUpdateForChallengeVerificationSignedPropertyNames as wn, stringifyPrimitive as wr, listStartedCommunities as wt, calculateIpfsCidV0 as x, CommentSignedPropertyNames as xn, ZodError as xr, findStartedCommunity as xt, version_default as y, CommentPubsubMessageReservedFields as yn, record as yr, writeKuboFilesWithTimeout as yt, isAbortError as z, CommentEditsTableRowSchema as zn, CommunityEditPublicationChallengeRequestToEncryptSchema as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { et as pubsubTopicToDhtKeyCid,
|
|
1
|
+
import { et as pubsubTopicToDhtKeyCid, or as PKCError } from "./schema-DEqa38Xx.js";
|
|
2
2
|
//#region dist/node/helia/util.js
|
|
3
3
|
const TOPIC_SUBSCRIBER_WAIT_TIMEOUT_MS = 1e4;
|
|
4
4
|
const MESH_PEER_WAIT_TIMEOUT_MS = 3e3;
|