@pkcprotocol/pkc-js 0.0.49 → 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.
Files changed (33) hide show
  1. package/dist/browser/generated-version.d.ts +1 -1
  2. package/dist/browser/generated-version.js +1 -1
  3. package/dist/browser/pkc/pkc.d.ts +2 -0
  4. package/dist/browser/pkc/pkc.js +34 -2
  5. package/dist/browser/pkc/pkc.js.map +1 -1
  6. package/dist/browser/runtime/browser/setup-kubo-http-routers.d.ts +1 -0
  7. package/dist/browser/runtime/browser/setup-kubo-http-routers.js +10 -0
  8. package/dist/browser/runtime/browser/setup-kubo-http-routers.js.map +1 -1
  9. package/dist/browser/runtime/node/setup-kubo-http-routers.d.ts +8 -0
  10. package/dist/browser/runtime/node/setup-kubo-http-routers.js +179 -3
  11. package/dist/browser/runtime/node/setup-kubo-http-routers.js.map +1 -1
  12. package/dist/bundled/bundle-manifest.json +25 -25
  13. package/dist/bundled/chunks/{helia-for-pkc-BZ6rZnW_.js → helia-for-pkc-CoiCnGzf.js} +2 -2
  14. package/dist/bundled/chunks/{local-community-CPvHllf9.js → local-community-DiTjNeA_.js} +1 -1
  15. package/dist/bundled/chunks/{local-community-CbMGlscJ.js → local-community-PMOePYFy.js} +2 -2
  16. package/dist/bundled/chunks/{node-eJCx_6gz.js → node-2IRJmtOa.js} +149 -17
  17. package/dist/bundled/chunks/{rpc-local-community-CTDbXkkP.js → rpc-local-community-DUD2jTEu.js} +1 -1
  18. package/dist/bundled/chunks/{schema-D0I45iuK.js → schema-DEqa38Xx.js} +1 -1
  19. package/dist/bundled/chunks/{util-C0EAYvmS.js → util-CcKyKVLs.js} +1 -1
  20. package/dist/bundled/index.js +1 -1
  21. package/dist/bundled/rpc/src/index.js +4 -4
  22. package/dist/node/generated-version.d.ts +1 -1
  23. package/dist/node/generated-version.js +1 -1
  24. package/dist/node/pkc/pkc.d.ts +2 -0
  25. package/dist/node/pkc/pkc.js +34 -2
  26. package/dist/node/pkc/pkc.js.map +1 -1
  27. package/dist/node/runtime/browser/setup-kubo-http-routers.d.ts +1 -0
  28. package/dist/node/runtime/browser/setup-kubo-http-routers.js +10 -0
  29. package/dist/node/runtime/browser/setup-kubo-http-routers.js.map +1 -1
  30. package/dist/node/runtime/node/setup-kubo-http-routers.d.ts +8 -0
  31. package/dist/node/runtime/node/setup-kubo-http-routers.js +179 -3
  32. package/dist/node/runtime/node/setup-kubo-http-routers.js.map +1 -1
  33. package/package.json +1 -1
@@ -14,7 +14,7 @@
14
14
  "node:module"
15
15
  ],
16
16
  "dynamicImports": [
17
- "chunks/node-eJCx_6gz.js"
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-eJCx_6gz.js"
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-D0I45iuK.js",
36
- "chunks/rpc-local-community-CTDbXkkP.js",
37
- "chunks/node-eJCx_6gz.js",
38
- "chunks/local-community-CbMGlscJ.js",
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-BZ6rZnW_.js": {
57
+ "chunks/helia-for-pkc-CoiCnGzf.js": {
58
58
  "isEntry": false,
59
59
  "imports": [
60
- "chunks/schema-D0I45iuK.js",
61
- "chunks/util-C0EAYvmS.js",
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-CPvHllf9.js": {
86
+ "chunks/local-community-DiTjNeA_.js": {
87
87
  "isEntry": false,
88
88
  "imports": [
89
- "chunks/local-community-CbMGlscJ.js"
89
+ "chunks/local-community-PMOePYFy.js"
90
90
  ],
91
91
  "dynamicImports": [],
92
92
  "inputs": []
93
93
  },
94
- "chunks/local-community-CbMGlscJ.js": {
94
+ "chunks/local-community-PMOePYFy.js": {
95
95
  "isEntry": false,
96
96
  "imports": [
97
- "chunks/schema-D0I45iuK.js",
98
- "chunks/rpc-local-community-CTDbXkkP.js",
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-eJCx_6gz.js": {
145
+ "chunks/node-2IRJmtOa.js": {
146
146
  "isEntry": false,
147
147
  "imports": [
148
- "chunks/schema-D0I45iuK.js",
149
- "chunks/rpc-local-community-CTDbXkkP.js",
150
- "chunks/util-C0EAYvmS.js",
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-BZ6rZnW_.js",
161
- "chunks/local-community-CbMGlscJ.js"
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-CTDbXkkP.js": {
202
+ "chunks/rpc-local-community-DUD2jTEu.js": {
203
203
  "isEntry": false,
204
204
  "imports": [
205
- "chunks/schema-D0I45iuK.js",
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-D0I45iuK.js": {
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-C0EAYvmS.js": {
1281
+ "chunks/util-CcKyKVLs.js": {
1282
1282
  "isEntry": false,
1283
1283
  "imports": [
1284
- "chunks/schema-D0I45iuK.js"
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, cr as logger_default, or as PKCError } from "./schema-D0I45iuK.js";
2
- import { n as getHeliaDebugContext, t as connectToPubsubPeers } from "./util-C0EAYvmS.js";
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-CbMGlscJ.js";
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 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-D0I45iuK.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-CTDbXkkP.js";
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";
@@ -1,6 +1,6 @@
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-D0I45iuK.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-CTDbXkkP.js";
3
- import { n as getHeliaDebugContext } from "./util-C0EAYvmS.js";
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";
@@ -6467,6 +6467,16 @@ var CommentModeration = class extends Publication {
6467
6467
  };
6468
6468
  //#endregion
6469
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
+ }
6470
6480
  function _mergeRouterConfigs(existingConfig, newConfig) {
6471
6481
  if (!existingConfig?.Routers) return newConfig;
6472
6482
  const existingRoutersByEndpoint = /* @__PURE__ */ new Map();
@@ -6500,10 +6510,7 @@ async function _setProvideDhtSweepEnabledOnKuboNode(kuboClient, sweepEnabled) {
6500
6510
  const configKey = "Provide.DHT.SweepEnabled";
6501
6511
  const url = `${kuboClient._clientOptions.url}/config?arg=${configKey}&arg=${JSON.stringify(sweepEnabled)}&json=true`;
6502
6512
  try {
6503
- await fetch(url, {
6504
- method: "POST",
6505
- headers: kuboClient._clientOptions.headers
6506
- });
6513
+ await _postToKuboRpc(kuboClient, url);
6507
6514
  } catch (e) {
6508
6515
  const error = new PKCError("ERR_FAILED_TO_SET_CONFIG_ON_KUBO_NODE", {
6509
6516
  fullUrl: url,
@@ -6535,10 +6542,7 @@ async function _setHttpRouterOptionsOnKuboNode(kuboClient, routingValue) {
6535
6542
  const mergedRoutingValue = _mergeRouterConfigs(routingConfigBeforeChanging, routingValue);
6536
6543
  const url = `${kuboClient._clientOptions.url}/config?arg=${routingKey}&arg=${JSON.stringify(mergedRoutingValue)}&json=true`;
6537
6544
  try {
6538
- await fetch(url, {
6539
- method: "POST",
6540
- headers: kuboClient._clientOptions.headers
6541
- });
6545
+ await _postToKuboRpc(kuboClient, url);
6542
6546
  } catch (e) {
6543
6547
  const error = new PKCError("ERR_FAILED_TO_SET_CONFIG_ON_KUBO_NODE", {
6544
6548
  fullUrl: url,
@@ -6558,10 +6562,95 @@ async function _setHttpRouterOptionsOnKuboNode(kuboClient, routingValue) {
6558
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");
6559
6563
  const shutdownUrl = `${kuboClient._clientOptions.url}/shutdown`;
6560
6564
  try {
6561
- await fetch(shutdownUrl, {
6562
- method: "POST",
6563
- headers: kuboClient._clientOptions.headers
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
6564
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);
6565
6654
  } catch (e) {
6566
6655
  const error = new PKCError("ERR_FAILED_TO_SHUTDOWN_KUBO_NODE", {
6567
6656
  actualError: e,
@@ -6572,6 +6661,28 @@ async function _setHttpRouterOptionsOnKuboNode(kuboClient, routingValue) {
6572
6661
  throw error;
6573
6662
  }
6574
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 };
6575
6686
  }
6576
6687
  async function setupKuboHttpRouters(pkc) {
6577
6688
  if (pkc.destroyed) return;
@@ -6804,7 +6915,7 @@ var PKC$1 = class extends PKCTypedEmitter {
6804
6915
  this.clients.libp2pJsClients = {};
6805
6916
  if (!this.libp2pJsClientsOptions) return;
6806
6917
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
6807
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-BZ6rZnW_.js");
6918
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CoiCnGzf.js");
6808
6919
  for (const clientOptions of this.libp2pJsClientsOptions) {
6809
6920
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
6810
6921
  ...clientOptions,
@@ -6827,9 +6938,10 @@ var PKC$1 = class extends PKCTypedEmitter {
6827
6938
  const log = logger_default("pkc-js:pkc:_initHttpRoutersWithIpfsInBackground");
6828
6939
  if (this.destroyed) return;
6829
6940
  if (this.httpRoutersOptions?.length && this.kuboRpcClientsOptions?.length && this._canCreateNewLocalCommunity()) {
6830
- const setupPromise = setupKuboHttpRouters(this).then(() => {
6941
+ const setupPromise = setupKuboHttpRouters(this).then(async () => {
6831
6942
  if (this.destroyed) return;
6832
6943
  log("Set http router options successfully on all connected ipfs", Object.keys(this.clients.kuboRpcClients));
6944
+ await this._runAppendAnnounceSyncAndReschedule();
6833
6945
  }).catch((e) => {
6834
6946
  if (this.destroyed) return;
6835
6947
  log.error("Failed to set http router options on ipfs nodes due to error", e);
@@ -6838,6 +6950,22 @@ var PKC$1 = class extends PKCTypedEmitter {
6838
6950
  this._httpRouterSetupPromise = setupPromise;
6839
6951
  }
6840
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
+ }
6841
6969
  async _init() {
6842
6970
  const log = logger_default("pkc-js:pkc:_init");
6843
6971
  this._storage = new Storage(this);
@@ -7043,7 +7171,7 @@ var PKC$1 = class extends PKCTypedEmitter {
7043
7171
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
7044
7172
  log.trace("Received community options to create a local community instance:", options);
7045
7173
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
7046
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-CPvHllf9.js");
7174
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-DiTjNeA_.js");
7047
7175
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
7048
7176
  const community = new LocalCommunity(this);
7049
7177
  if (isLocalCommunity) {
@@ -7401,6 +7529,10 @@ var PKC$1 = class extends PKCTypedEmitter {
7401
7529
  for (const community of listUpdatingCommunities(this)) await community.stop();
7402
7530
  await Promise.all(listStartedCommunities(this).map((community) => community.stop()));
7403
7531
  if (this._communityFsWatchAbort) this._communityFsWatchAbort.abort();
7532
+ if (this._appendAnnounceTimer) {
7533
+ clearTimeout(this._appendAnnounceTimer);
7534
+ this._appendAnnounceTimer = void 0;
7535
+ }
7404
7536
  if (this._httpRouterSetupPromise) {
7405
7537
  await this._httpRouterSetupPromise;
7406
7538
  this._httpRouterSetupPromise = void 0;
@@ -1,4 +1,4 @@
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-D0I45iuK.js";
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";
@@ -34591,7 +34591,7 @@ function extractNetworkErrorDetails(err, depth = 0) {
34591
34591
  }
34592
34592
  //#endregion
34593
34593
  //#region dist/node/generated-version.js
34594
- const version = "0.0.49";
34594
+ const version = "0.0.50";
34595
34595
  //#endregion
34596
34596
  //#region dist/node/version.js
34597
34597
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
@@ -1,4 +1,4 @@
1
- import { et as pubsubTopicToDhtKeyCid, or as PKCError } from "./schema-D0I45iuK.js";
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;
@@ -1,2 +1,2 @@
1
- import { a as nativeFunctions, i as getShortCid, n as challenges, o as setNativeFunctions, r as getShortAddress, t as PKC } from "./chunks/node-eJCx_6gz.js";
1
+ import { a as nativeFunctions, i as getShortCid, n as challenges, o as setNativeFunctions, r as getShortAddress, t as PKC } from "./chunks/node-2IRJmtOa.js";
2
2
  export { challenges, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
@@ -1,7 +1,7 @@
1
- import { L as hideClassPrivateProps, Or as __toESM, Xn as require_commonjs, cr as logger_default, or as PKCError, st as replaceXWithY, xt as findStartedCommunity } from "../../chunks/schema-D0I45iuK.js";
2
- import { _ as parseRpcUnsubscribeParam, c as parseRpcCancelExportParam, d as parseRpcCommunityIdentifierParam, f as parseRpcCommunityPageParam, g as parseRpcPublishChallengeAnswersParam, h as parseRpcExportCommunityParam, l as parseRpcCidParam, m as parseRpcExportCommunityModLogsParam, p as parseRpcEditCommunityParam, s as parseRpcAuthorNameParam, t as PKC, u as parseRpcCommentRepliesPageParam } from "../../chunks/node-eJCx_6gz.js";
3
- import { Cn as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, G as buildPageRuntimeFields, Jt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, K as buildPagesRuntimeFields, Qt as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Sn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Un as stringify, Yt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, dn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, nn as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, rn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, rt as require_lib, tt as pLimit, un as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-CTDbXkkP.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-CbMGlscJ.js";
1
+ import { L as hideClassPrivateProps, Or as __toESM, Xn as require_commonjs, cr as logger_default, or as PKCError, st as replaceXWithY, xt as findStartedCommunity } from "../../chunks/schema-DEqa38Xx.js";
2
+ import { _ as parseRpcUnsubscribeParam, c as parseRpcCancelExportParam, d as parseRpcCommunityIdentifierParam, f as parseRpcCommunityPageParam, g as parseRpcPublishChallengeAnswersParam, h as parseRpcExportCommunityParam, l as parseRpcCidParam, m as parseRpcExportCommunityModLogsParam, p as parseRpcEditCommunityParam, s as parseRpcAuthorNameParam, t as PKC, u as parseRpcCommentRepliesPageParam } from "../../chunks/node-2IRJmtOa.js";
3
+ import { Cn as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, G as buildPageRuntimeFields, Jt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, K as buildPagesRuntimeFields, Qt as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Sn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Un as stringify, Yt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, dn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, hn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, nn as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, rn as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, rt as require_lib, tt as pLimit, un as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-DUD2jTEu.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-PMOePYFy.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -1 +1 @@
1
- export declare const version = "0.0.49";
1
+ export declare const version = "0.0.50";
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by config/generate-version.js — do not edit
2
- export const version = "0.0.49";
2
+ export const version = "0.0.50";
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -75,6 +75,7 @@ export declare class PKC extends PKCTypedEmitter<PKCEvents> implements ParsedPKC
75
75
  private _communityFsWatchAbort?;
76
76
  private _destroyAbortController?;
77
77
  private _httpRouterSetupPromise?;
78
+ private _appendAnnounceTimer?;
78
79
  destroyed: boolean;
79
80
  private _promiseToWaitForFirstCommunitieschangeEvent;
80
81
  private _storageLRUs;
@@ -97,6 +98,7 @@ export declare class PKC extends PKCTypedEmitter<PKCEvents> implements ParsedPKC
97
98
  private _initRpcClientsIfNeeded;
98
99
  private _initIpfsGatewaysIfNeeded;
99
100
  private _setupHttpRoutersWithKuboNodeInBackground;
101
+ private _runAppendAnnounceSyncAndReschedule;
100
102
  _init(): Promise<void>;
101
103
  getCommunity(getCommunityArgs: GetCommunityArgs): Promise<RemoteCommunity>;
102
104
  getComment(cid: CidRpcParam): Promise<Comment>;
@@ -21,7 +21,7 @@ import * as remeda from "remeda";
21
21
  import { PubsubTopicSchema, CommunityIpfsSchema } from "../community/schema.js";
22
22
  import { parseCidStringSchemaWithPKCErrorIfItFails, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, parseCommentIpfsSchemaWithPKCErrorIfItFails, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, parsePKCUserOptionsSchemaWithPKCErrorIfItFails, parseCommunityAddressWithPKCErrorIfItFails, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails } from "../schema/schema-util.js";
23
23
  import { CommentModeration } from "../publications/comment-moderation/comment-moderation.js";
24
- import { setupKuboHttpRouters } from "../runtime/node/setup-kubo-http-routers.js";
24
+ import { setupKuboHttpRouters, syncKuboAppendAnnounce } from "../runtime/node/setup-kubo-http-routers.js";
25
25
  import CommunityEdit from "../publications/community-edit/community-edit.js";
26
26
  import { LRUCache } from "lru-cache";
27
27
  import { PKCTypedEmitter } from "../clients/pkc-typed-emitter.js";
@@ -219,10 +219,15 @@ export class PKC extends PKCTypedEmitter {
219
219
  if (this.httpRoutersOptions?.length && this.kuboRpcClientsOptions?.length && this._canCreateNewLocalCommunity()) {
220
220
  // only for node
221
221
  const setupPromise = setupKuboHttpRouters(this)
222
- .then(() => {
222
+ .then(async () => {
223
223
  if (this.destroyed)
224
224
  return;
225
225
  log("Set http router options successfully on all connected ipfs", Object.keys(this.clients.kuboRpcClients));
226
+ // Workaround for ipfs/kubo#11369: force-announce the node's browser-dialable
227
+ // addresses (webrtc-direct + AutoTLS WSS) via AppendAnnounce so they reach the
228
+ // HTTP routers. Runs once here; the AutoTLS WSS may not be provisioned yet, so
229
+ // _scheduleAppendAnnounceSync re-checks every 10 min until it lands.
230
+ await this._runAppendAnnounceSyncAndReschedule();
226
231
  })
227
232
  .catch((e) => {
228
233
  if (this.destroyed)
@@ -233,6 +238,29 @@ export class PKC extends PKCTypedEmitter {
233
238
  this._httpRouterSetupPromise = setupPromise;
234
239
  }
235
240
  }
241
+ // Workaround for ipfs/kubo#11369. Sync browser-dialable addresses into the kubo nodes'
242
+ // AppendAnnounce, then re-check every 10 minutes until the (slow-to-provision) AutoTLS WSS
243
+ // has landed — then stop. The timer is unref'd and cleared on destroy().
244
+ async _runAppendAnnounceSyncAndReschedule() {
245
+ const log = Logger("pkc-js:pkc:_runAppendAnnounceSyncAndReschedule");
246
+ const RECHECK_MS = 10 * 60 * 1000;
247
+ if (this.destroyed)
248
+ return;
249
+ let allDone = false;
250
+ try {
251
+ ({ allDone } = await syncKuboAppendAnnounce(this));
252
+ }
253
+ catch (e) {
254
+ log.error("AppendAnnounce sync failed; will retry", e);
255
+ }
256
+ if (this.destroyed || allDone)
257
+ return;
258
+ this._appendAnnounceTimer = setTimeout(() => {
259
+ this._runAppendAnnounceSyncAndReschedule().catch((e) => log.error("AppendAnnounce re-sync failed", e));
260
+ }, RECHECK_MS);
261
+ // Don't keep the Node event loop alive solely for this re-check timer.
262
+ this._appendAnnounceTimer.unref?.();
263
+ }
236
264
  async _init() {
237
265
  const log = Logger("pkc-js:pkc:_init");
238
266
  // Init storage
@@ -904,6 +932,10 @@ export class PKC extends PKCTypedEmitter {
904
932
  await Promise.all(listStartedCommunities(this).map((community) => community.stop()));
905
933
  if (this._communityFsWatchAbort)
906
934
  this._communityFsWatchAbort.abort();
935
+ if (this._appendAnnounceTimer) {
936
+ clearTimeout(this._appendAnnounceTimer);
937
+ this._appendAnnounceTimer = undefined;
938
+ }
907
939
  if (this._httpRouterSetupPromise) {
908
940
  await this._httpRouterSetupPromise;
909
941
  this._httpRouterSetupPromise = undefined;