@pkcprotocol/pkc-js 0.0.55 → 0.0.57
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/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/pkc/pkc.d.ts +1 -0
- package/dist/browser/pkc/pkc.js +9 -0
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/rpc/src/index.js +42 -1
- package/dist/browser/rpc/src/index.js.map +1 -1
- package/dist/browser/runtime/node/address-rewriter-db.d.ts +1 -0
- package/dist/browser/runtime/node/address-rewriter-db.js.map +1 -1
- package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js +15 -2
- package/dist/browser/runtime/node/addresses-rewriter-proxy-server.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/lifecycle.js +10 -0
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.d.ts +60 -0
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js +95 -0
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -0
- package/dist/browser/runtime/node/community/local-community.d.ts +2 -0
- package/dist/browser/runtime/node/community/local-community.js +5 -0
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/bundled/bundle-manifest.json +39 -37
- package/dist/bundled/chunks/{helia-for-pkc-DoDRlLOH.js → helia-for-pkc-DxnB3FKD.js} +2 -2
- package/dist/bundled/chunks/{local-community-mDvKQvBs.js → local-community-DoCgfUYZ.js} +85 -3
- package/dist/bundled/chunks/{local-community-DphDAMON.js → local-community-K4gwxMtl.js} +1 -1
- package/dist/bundled/chunks/{node-DMZvDa2V.js → node-DjTc94sT.js} +13 -524
- package/dist/bundled/chunks/{rpc-local-community--wAc0T6w.js → rpc-local-community-Bw7ZxESs.js} +563 -40
- package/dist/bundled/chunks/{schema-DFwj_zFI.js → schema-DGX0DsS6.js} +1 -1
- package/dist/bundled/chunks/{util-o-NLJmIo.js → util-SCefBhSi.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +38 -6
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/pkc/pkc.d.ts +1 -0
- package/dist/node/pkc/pkc.js +9 -0
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/rpc/src/index.js +42 -1
- package/dist/node/rpc/src/index.js.map +1 -1
- package/dist/node/runtime/node/address-rewriter-db.d.ts +1 -0
- package/dist/node/runtime/node/address-rewriter-db.js.map +1 -1
- package/dist/node/runtime/node/addresses-rewriter-proxy-server.js +15 -2
- package/dist/node/runtime/node/addresses-rewriter-proxy-server.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/lifecycle.js +10 -0
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.d.ts +60 -0
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js +95 -0
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -0
- package/dist/node/runtime/node/community/local-community.d.ts +2 -0
- package/dist/node/runtime/node/community/local-community.js +5 -0
- package/dist/node/runtime/node/community/local-community.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-DjTc94sT.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-DjTc94sT.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-DGX0DsS6.js",
|
|
36
|
+
"chunks/rpc-local-community-Bw7ZxESs.js",
|
|
37
|
+
"chunks/node-DjTc94sT.js",
|
|
38
|
+
"chunks/local-community-DoCgfUYZ.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-DxnB3FKD.js": {
|
|
58
58
|
"isEntry": false,
|
|
59
59
|
"imports": [
|
|
60
|
-
"chunks/schema-
|
|
61
|
-
"chunks/util-
|
|
60
|
+
"chunks/schema-DGX0DsS6.js",
|
|
61
|
+
"chunks/util-SCefBhSi.js",
|
|
62
62
|
"multiformats/cid",
|
|
63
63
|
"@libp2p/interface",
|
|
64
64
|
"@libp2p/peer-id",
|
|
@@ -83,19 +83,11 @@
|
|
|
83
83
|
"dist/node/helia/helia-for-pkc.js"
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
|
-
"chunks/local-community-
|
|
86
|
+
"chunks/local-community-DoCgfUYZ.js": {
|
|
87
87
|
"isEntry": false,
|
|
88
88
|
"imports": [
|
|
89
|
-
"chunks/
|
|
90
|
-
|
|
91
|
-
"dynamicImports": [],
|
|
92
|
-
"inputs": []
|
|
93
|
-
},
|
|
94
|
-
"chunks/local-community-mDvKQvBs.js": {
|
|
95
|
-
"isEntry": false,
|
|
96
|
-
"imports": [
|
|
97
|
-
"chunks/schema-DFwj_zFI.js",
|
|
98
|
-
"chunks/rpc-local-community--wAc0T6w.js",
|
|
89
|
+
"chunks/schema-DGX0DsS6.js",
|
|
90
|
+
"chunks/rpc-local-community-Bw7ZxESs.js",
|
|
99
91
|
"node:crypto",
|
|
100
92
|
"node:url",
|
|
101
93
|
"node:path",
|
|
@@ -104,6 +96,7 @@
|
|
|
104
96
|
"path",
|
|
105
97
|
"assert",
|
|
106
98
|
"fs",
|
|
99
|
+
"multiformats/cid",
|
|
107
100
|
"better-sqlite3",
|
|
108
101
|
"typestub-ipfs-only-hash"
|
|
109
102
|
],
|
|
@@ -136,33 +129,38 @@
|
|
|
136
129
|
"dist/node/runtime/node/community/local-community/db-state.js",
|
|
137
130
|
"dist/node/runtime/node/community/local-community/pubsub.js",
|
|
138
131
|
"dist/node/runtime/node/community/local-community/ipns-publishing.js",
|
|
132
|
+
"dist/node/runtime/node/community/local-community/reprovide-on-address-change.js",
|
|
139
133
|
"dist/node/runtime/node/community/local-community/lifecycle.js",
|
|
140
134
|
"dist/node/runtime/node/community/local-community/editing.js",
|
|
141
135
|
"dist/node/runtime/node/community/local-community/export.js",
|
|
142
136
|
"dist/node/runtime/node/community/local-community.js"
|
|
143
137
|
]
|
|
144
138
|
},
|
|
145
|
-
"chunks/
|
|
139
|
+
"chunks/local-community-K4gwxMtl.js": {
|
|
146
140
|
"isEntry": false,
|
|
147
141
|
"imports": [
|
|
148
|
-
"chunks/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
142
|
+
"chunks/local-community-DoCgfUYZ.js"
|
|
143
|
+
],
|
|
144
|
+
"dynamicImports": [],
|
|
145
|
+
"inputs": []
|
|
146
|
+
},
|
|
147
|
+
"chunks/node-DjTc94sT.js": {
|
|
148
|
+
"isEntry": false,
|
|
149
|
+
"imports": [
|
|
150
|
+
"chunks/schema-DGX0DsS6.js",
|
|
151
|
+
"chunks/rpc-local-community-Bw7ZxESs.js",
|
|
152
|
+
"chunks/util-SCefBhSi.js",
|
|
154
153
|
"path",
|
|
155
154
|
"assert",
|
|
156
155
|
"fs",
|
|
157
|
-
"node:https",
|
|
158
156
|
"better-sqlite3",
|
|
159
157
|
"typestub-ipfs-only-hash",
|
|
160
158
|
"events",
|
|
161
159
|
"rpc-websockets"
|
|
162
160
|
],
|
|
163
161
|
"dynamicImports": [
|
|
164
|
-
"chunks/helia-for-pkc-
|
|
165
|
-
"chunks/local-community-
|
|
162
|
+
"chunks/helia-for-pkc-DxnB3FKD.js",
|
|
163
|
+
"chunks/local-community-DoCgfUYZ.js"
|
|
166
164
|
],
|
|
167
165
|
"inputs": [
|
|
168
166
|
"node_modules/zod/v4/locales/en.js",
|
|
@@ -195,8 +193,6 @@
|
|
|
195
193
|
"dist/node/runtime/node/sqlite-lru-cache.js",
|
|
196
194
|
"dist/node/runtime/node/lru-storage.js",
|
|
197
195
|
"dist/node/publications/comment-moderation/comment-moderation.js",
|
|
198
|
-
"dist/node/runtime/node/address-rewriter-db.js",
|
|
199
|
-
"dist/node/runtime/node/addresses-rewriter-proxy-server.js",
|
|
200
196
|
"node_modules/deep-is/index.js",
|
|
201
197
|
"node_modules/is2/node_modules/ip-regex/index.js",
|
|
202
198
|
"node_modules/is2/package.json",
|
|
@@ -216,12 +212,15 @@
|
|
|
216
212
|
"dist/node/index.js"
|
|
217
213
|
]
|
|
218
214
|
},
|
|
219
|
-
"chunks/rpc-local-community
|
|
215
|
+
"chunks/rpc-local-community-Bw7ZxESs.js": {
|
|
220
216
|
"isEntry": false,
|
|
221
217
|
"imports": [
|
|
222
|
-
"chunks/schema-
|
|
218
|
+
"chunks/schema-DGX0DsS6.js",
|
|
219
|
+
"node:http",
|
|
223
220
|
"node:crypto",
|
|
224
221
|
"node:url",
|
|
222
|
+
"node:fs/promises",
|
|
223
|
+
"node:path",
|
|
225
224
|
"node:dns",
|
|
226
225
|
"os",
|
|
227
226
|
"node:fs",
|
|
@@ -233,6 +232,7 @@
|
|
|
233
232
|
"multiformats/basics",
|
|
234
233
|
"uint8arrays/from-string",
|
|
235
234
|
"@libp2p/peer-id",
|
|
235
|
+
"node:https",
|
|
236
236
|
"uint8arrays/to-string",
|
|
237
237
|
"@libp2p/crypto/keys",
|
|
238
238
|
"better-sqlite3",
|
|
@@ -725,6 +725,8 @@
|
|
|
725
725
|
"dist/node/community/community-gateway-selection.js",
|
|
726
726
|
"dist/node/community/community-client-manager.js",
|
|
727
727
|
"dist/node/community/remote-community.js",
|
|
728
|
+
"dist/node/runtime/node/address-rewriter-db.js",
|
|
729
|
+
"dist/node/runtime/node/addresses-rewriter-proxy-server.js",
|
|
728
730
|
"node_modules/lru-cache/dist/esm/index.js",
|
|
729
731
|
"dist/node/pkc/tracked-instance-registry.js",
|
|
730
732
|
"node_modules/js-sizeof/index.js",
|
|
@@ -751,7 +753,7 @@
|
|
|
751
753
|
"dist/node/community/rpc-local-community.js"
|
|
752
754
|
]
|
|
753
755
|
},
|
|
754
|
-
"chunks/schema-
|
|
756
|
+
"chunks/schema-DGX0DsS6.js": {
|
|
755
757
|
"isEntry": false,
|
|
756
758
|
"imports": [
|
|
757
759
|
"node:module",
|
|
@@ -1295,10 +1297,10 @@
|
|
|
1295
1297
|
"dist/node/pubsub-messages/schema.js"
|
|
1296
1298
|
]
|
|
1297
1299
|
},
|
|
1298
|
-
"chunks/util-
|
|
1300
|
+
"chunks/util-SCefBhSi.js": {
|
|
1299
1301
|
"isEntry": false,
|
|
1300
1302
|
"imports": [
|
|
1301
|
-
"chunks/schema-
|
|
1303
|
+
"chunks/schema-DGX0DsS6.js"
|
|
1302
1304
|
],
|
|
1303
1305
|
"dynamicImports": [],
|
|
1304
1306
|
"inputs": [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, cr as logger_default, or as PKCError } from "./schema-
|
|
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-DGX0DsS6.js";
|
|
2
|
+
import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-SCefBhSi.js";
|
|
3
3
|
import { CID } from "multiformats/cid";
|
|
4
4
|
import { NotFoundError } from "@libp2p/interface";
|
|
5
5
|
import { peerIdFromString } from "@libp2p/peer-id";
|
|
@@ -1,5 +1,5 @@
|
|
|
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, Rt as pTimeout, 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-
|
|
2
|
-
import { A as
|
|
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, Rt as pTimeout, 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-DGX0DsS6.js";
|
|
2
|
+
import { A as deriveDbPosts, At as verifyCommunityEdit, Bt as getCommunityPublicKeyFromWire, C as BackupAbortError, Dt as verifyCommentPubsubMessage, E as calculateInlineRepliesBudget, Et as verifyCommentModeration, F as importSignerIntoKuboNode, Ft as getAuthorNameFromWire, G as REPLY_REPLIES_SORT_TYPES, Gt as getIpfsKeyFromPrivateKey, Ht as decode, Jn as require_lodash_merge, Jt as getPublicKeyFromPrivateKey, K as TIMEFRAMES_TO_SECONDS, Kn as stringify, Kt as getPKCAddressFromPublicKey, M as getDefaultCommunityDbConfig, Mt as buildRuntimeAuthor, Nt as cleanWireAuthor, O as deleteOldCommunityInWindows, Ot as verifyCommentUpdate, P as getThumbnailPropsOfLink, R as moveCommunityDbToDeletedDirectory, S as encryptEd25519AesGcmPublicKeyBuffer, St as verifyChallengeRequest, T as calculateExpectedSignatureSize, Tt as verifyCommentIpfs, U as POSTS_SORT_TYPES, Ut as encode, W as POST_REPLIES_SORT_TYPES, Yt as createSchemaRowParser, Z as iterateOverPageCidsToFindAllCids, _ as SignerWithPublicKeyAddress, _t as signCommunity, a as pkcJsChallenges, b as decryptEd25519AesGcmPublicKeyBuffer, bt as verifyChallengeAnswer, cn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, d as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, dt as signChallengeVerification, f as KeyvBetterSqlite3, ft as signComment, gt as signCommentUpdateForChallengeVerification, ht as signCommentUpdate, i as getCommunityChallengeFromCommunityChallengeSettings, it as pLimit, j as deriveDbReplies, jt as verifyVote, k as deriveCommentIpfsFromCommentTableRow, kt as verifyCommunity, l as normalizeSelfAddrsForProvider, lt as signChallengeMessage, o as TrackedInstanceRegistry, on as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, pt as signCommentEdit, qn as STORAGE_KEYS, qt as getPKCAddressFromPublicKeySync, r as getChallengeVerification, s as LRUCache, st as cleanUpBeforePublishing, t as RpcLocalCommunity, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, w as backupCommunityDb, wt as verifyCommentEdit, xn as parseJsonWithPKCErrorIfFails, z as resolveDbPostsCidRefs, zt as getCommunityNameFromWire } from "./rpc-local-community-Bw7ZxESs.js";
|
|
3
3
|
import { randomFillSync, randomUUID } from "node:crypto";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import path from "node:path";
|
|
@@ -8,6 +8,7 @@ import { existsSync, promises } from "node:fs";
|
|
|
8
8
|
import path$1 from "path";
|
|
9
9
|
import assert from "assert";
|
|
10
10
|
import fs from "fs";
|
|
11
|
+
import { CID } from "multiformats/cid";
|
|
11
12
|
import Database from "better-sqlite3";
|
|
12
13
|
import { of } from "typestub-ipfs-only-hash";
|
|
13
14
|
//#region dist/node/runtime/node/community/local-community/comment-updates.js
|
|
@@ -5923,7 +5924,7 @@ async function listenToIncomingRequests(community) {
|
|
|
5923
5924
|
}
|
|
5924
5925
|
async function providePubsubTopicRoutingCidsIfNeeded(community, force = false) {
|
|
5925
5926
|
const log = logger_default("pkc-js:local-community:_providePubsubTopicRoutingCidsIfNeeded");
|
|
5926
|
-
const reprovideIntervalMs =
|
|
5927
|
+
const reprovideIntervalMs = 3600 * 1e3;
|
|
5927
5928
|
const now = Date.now();
|
|
5928
5929
|
if (!force && community._lastPubsubTopicRoutingProvideAt && now - community._lastPubsubTopicRoutingProvideAt < reprovideIntervalMs) return;
|
|
5929
5930
|
const topics = [pubsubTopicWithfallback(community), community.ipnsPubsubTopic].filter((topic) => typeof topic === "string");
|
|
@@ -6208,6 +6209,82 @@ async function syncIpnsWithDb(community) {
|
|
|
6208
6209
|
throw e;
|
|
6209
6210
|
}
|
|
6210
6211
|
}
|
|
6212
|
+
function isBrowserDialableAddr(addr) {
|
|
6213
|
+
return addr.includes("/webrtc") || addr.includes("/ws");
|
|
6214
|
+
}
|
|
6215
|
+
async function getBrowserDialableSelfAddrs(client) {
|
|
6216
|
+
const idRes = await client.id();
|
|
6217
|
+
const peerId = idRes.id.toString();
|
|
6218
|
+
const swarmListeningAddresses = (await client.swarm.addrs()).filter((swarmAddr) => swarmAddr.id.toString() === peerId);
|
|
6219
|
+
const normalized = normalizeSelfAddrsForProvider([...idRes.addresses.map((addr) => addr.toString()), ...import_commonjs.flatten(swarmListeningAddresses.map((swarmAddr) => swarmAddr.addrs.map((addr) => addr.toString())))], peerId);
|
|
6220
|
+
return import_commonjs.unique(normalized.filter(isBrowserDialableAddr)).sort();
|
|
6221
|
+
}
|
|
6222
|
+
function connectionCriticalCids(community) {
|
|
6223
|
+
return import_commonjs.unique([community.pubsubTopicRoutingCid, community.ipnsPubsubTopicRoutingCid].filter((cid) => typeof cid === "string"));
|
|
6224
|
+
}
|
|
6225
|
+
/**
|
|
6226
|
+
* Re-provide the connection-critical CIDs when the node's browser-dialable (WSS/WebRTC) self-addresses
|
|
6227
|
+
* have changed since the last provide. This pushes the current addresses to the HTTP routers (via the
|
|
6228
|
+
* address-rewriter proxy) so browsers don't get NoValidAddressesError against stale/dead addresses.
|
|
6229
|
+
*
|
|
6230
|
+
* The first observation only establishes a baseline (start() already force-provides these CIDs with fresh
|
|
6231
|
+
* addresses via providePubsubTopicRoutingCidsIfNeeded); subsequent changes trigger a re-provide.
|
|
6232
|
+
*/
|
|
6233
|
+
async function reprovideConnectionCidsIfBrowserAddrsChanged(community) {
|
|
6234
|
+
const log = logger_default("pkc-js:local-community:_reprovideConnectionCidsIfBrowserAddrsChanged");
|
|
6235
|
+
const client = community._clientsManager.getDefaultKuboRpcClient()._client;
|
|
6236
|
+
const current = await getBrowserDialableSelfAddrs(client);
|
|
6237
|
+
const previous = community._lastProvidedBrowserDialableSelfAddrs;
|
|
6238
|
+
if (previous === void 0) {
|
|
6239
|
+
community._lastProvidedBrowserDialableSelfAddrs = current;
|
|
6240
|
+
return {
|
|
6241
|
+
reprovided: false,
|
|
6242
|
+
providedCids: [],
|
|
6243
|
+
browserAddrs: current
|
|
6244
|
+
};
|
|
6245
|
+
}
|
|
6246
|
+
if (import_commonjs.isDeepEqual(previous, current)) return {
|
|
6247
|
+
reprovided: false,
|
|
6248
|
+
providedCids: [],
|
|
6249
|
+
browserAddrs: current
|
|
6250
|
+
};
|
|
6251
|
+
community._lastProvidedBrowserDialableSelfAddrs = current;
|
|
6252
|
+
const cidStrings = connectionCriticalCids(community);
|
|
6253
|
+
const providedCids = [];
|
|
6254
|
+
for (const cidString of cidStrings) {
|
|
6255
|
+
let cid;
|
|
6256
|
+
try {
|
|
6257
|
+
cid = CID.parse(cidString);
|
|
6258
|
+
} catch (e) {
|
|
6259
|
+
log.error(`Failed to parse connection-critical CID (${cidString}) for community (${community.address})`, e);
|
|
6260
|
+
continue;
|
|
6261
|
+
}
|
|
6262
|
+
try {
|
|
6263
|
+
const provideEvents = client.routing.provide(cid, { recursive: true });
|
|
6264
|
+
for await (const event of provideEvents) log.trace(`Provide event for ${cidString}:`, event);
|
|
6265
|
+
providedCids.push(cidString);
|
|
6266
|
+
} catch (e) {
|
|
6267
|
+
log.error(`Failed to re-provide connection-critical CID (${cidString}) for community (${community.address})`, e);
|
|
6268
|
+
}
|
|
6269
|
+
}
|
|
6270
|
+
log(`Browser-dialable addresses of community (${community.address}) changed; re-provided ${providedCids.length}/${cidStrings.length} connection-critical CIDs`, { browserAddrs: current });
|
|
6271
|
+
return {
|
|
6272
|
+
reprovided: providedCids.length > 0,
|
|
6273
|
+
providedCids,
|
|
6274
|
+
browserAddrs: current
|
|
6275
|
+
};
|
|
6276
|
+
}
|
|
6277
|
+
/**
|
|
6278
|
+
* Publish-loop entry point. The publish loop runs once per sync cycle (and faster during bursts), so this
|
|
6279
|
+
* throttles the kubo id()/swarm.addrs() poll to ADDRESS_REPROVIDE_POLL_INTERVAL_MS before delegating to the
|
|
6280
|
+
* core change-detection. Lives inside the publish loop so it's torn down together with the loop on stop().
|
|
6281
|
+
*/
|
|
6282
|
+
async function reprovideOnAddressChangeIfDue(community) {
|
|
6283
|
+
const now = Date.now();
|
|
6284
|
+
if (typeof community._lastAddressReprovideCheckAt === "number" && now - community._lastAddressReprovideCheckAt < 6e4) return;
|
|
6285
|
+
community._lastAddressReprovideCheckAt = now;
|
|
6286
|
+
await reprovideConnectionCidsIfBrowserAddrsChanged(community);
|
|
6287
|
+
}
|
|
6211
6288
|
//#endregion
|
|
6212
6289
|
//#region dist/node/runtime/node/community/local-community/lifecycle.js
|
|
6213
6290
|
async function publishLoop(community, syncIntervalMs) {
|
|
@@ -6230,6 +6307,7 @@ async function publishLoop(community, syncIntervalMs) {
|
|
|
6230
6307
|
};
|
|
6231
6308
|
while (!shouldStopPublishLoop()) try {
|
|
6232
6309
|
await syncIpnsWithDb(community);
|
|
6310
|
+
await reprovideOnAddressChangeIfDue(community).catch((e) => log.error("Failed to re-provide connection CIDs on address change", e));
|
|
6233
6311
|
} catch (e) {
|
|
6234
6312
|
community.emit("error", e);
|
|
6235
6313
|
} finally {
|
|
@@ -6263,6 +6341,8 @@ async function start(community) {
|
|
|
6263
6341
|
if (community.state === "updating") throw new PKCError("ERR_NEED_TO_STOP_UPDATING_COMMUNITY_BEFORE_STARTING", { address: community.address });
|
|
6264
6342
|
community._stopHasBeenCalled = false;
|
|
6265
6343
|
community._firstUpdateAfterStart = true;
|
|
6344
|
+
community._lastProvidedBrowserDialableSelfAddrs = void 0;
|
|
6345
|
+
community._lastAddressReprovideCheckAt = void 0;
|
|
6266
6346
|
if (!community._clientsManager.getDefaultKuboRpcClientOrHelia()) throw Error("You need to define an IPFS client in your pkc instance to be able to start a local community");
|
|
6267
6347
|
await community.initDbHandlerIfNeeded();
|
|
6268
6348
|
await community._updateStartedValue();
|
|
@@ -6938,6 +7018,8 @@ var LocalCommunity = class extends RpcLocalCommunity {
|
|
|
6938
7018
|
this._firstUpdateAfterStart = true;
|
|
6939
7019
|
this._internalStateUpdateId = "";
|
|
6940
7020
|
this._lastPubsubTopicRoutingProvideAt = void 0;
|
|
7021
|
+
this._lastProvidedBrowserDialableSelfAddrs = void 0;
|
|
7022
|
+
this._lastAddressReprovideCheckAt = void 0;
|
|
6941
7023
|
this._mirroredStartedOrUpdatingCommunity = void 0;
|
|
6942
7024
|
this._pendingEditProps = [];
|
|
6943
7025
|
this._blocksToRm = [];
|
|
@@ -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-DoCgfUYZ.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|