@pkcprotocol/pkc-js 0.0.119 → 0.0.121

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 (106) hide show
  1. package/README.md +2 -2
  2. package/dist/browser/community/community-client-manager.js +8 -2
  3. package/dist/browser/community/community-client-manager.js.map +1 -1
  4. package/dist/browser/errors.d.ts +2 -0
  5. package/dist/browser/errors.js +2 -0
  6. package/dist/browser/errors.js.map +1 -1
  7. package/dist/browser/generated-version.d.ts +1 -1
  8. package/dist/browser/generated-version.js +1 -1
  9. package/dist/browser/pages/page-sort-options.d.ts +1 -0
  10. package/dist/browser/pages/page-sort-options.js +7 -6
  11. package/dist/browser/pages/page-sort-options.js.map +1 -1
  12. package/dist/browser/pages/page-sort-scoring.d.ts +5 -1
  13. package/dist/browser/pages/page-sort-scoring.js +23 -13
  14. package/dist/browser/pages/page-sort-scoring.js.map +1 -1
  15. package/dist/browser/pages/types.d.ts +1 -1
  16. package/dist/browser/pkc-error.d.ts +1 -1
  17. package/dist/browser/publications/publication.d.ts +2 -0
  18. package/dist/browser/publications/publication.js +24 -1
  19. package/dist/browser/publications/publication.js.map +1 -1
  20. package/dist/browser/rpc/src/index.d.ts +4 -0
  21. package/dist/browser/rpc/src/index.js +74 -19
  22. package/dist/browser/rpc/src/index.js.map +1 -1
  23. package/dist/browser/runtime/node/community/db-handler.d.ts +2 -2
  24. package/dist/browser/runtime/node/community/db-handler.js +42 -58
  25. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  26. package/dist/browser/runtime/node/community/local-community/editing.d.ts +1 -0
  27. package/dist/browser/runtime/node/community/local-community/editing.js +25 -4
  28. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  29. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +7 -4
  30. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  31. package/dist/browser/runtime/node/community/local-community/lifecycle.js +17 -4
  32. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  33. package/dist/browser/runtime/node/community/local-community/publication-validation.js +4 -0
  34. package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
  35. package/dist/browser/runtime/node/community/local-community.d.ts +4 -1
  36. package/dist/browser/runtime/node/community/local-community.js +12 -1
  37. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  38. package/dist/browser/runtime/node/community/page-generator.d.ts +0 -1
  39. package/dist/browser/runtime/node/community/page-generator.js.map +1 -1
  40. package/dist/browser/runtime/node/community/page-sorts/index.js +22 -4
  41. package/dist/browser/runtime/node/community/page-sorts/index.js.map +1 -1
  42. package/dist/browser/runtime/node/util.d.ts +4 -1
  43. package/dist/browser/runtime/node/util.js +41 -24
  44. package/dist/browser/runtime/node/util.js.map +1 -1
  45. package/dist/browser/signer/encryption.js +5 -1
  46. package/dist/browser/signer/encryption.js.map +1 -1
  47. package/dist/bundled/bundle-manifest.json +52 -52
  48. package/dist/bundled/challenges.js +1 -1
  49. package/dist/bundled/chunks/{helia-for-pkc-Cr90E9ul.js → helia-for-pkc-Bw9KzcSY.js} +2 -2
  50. package/dist/bundled/chunks/{local-community-DngOEreY.js → local-community-CMkVMrOZ.js} +90 -73
  51. package/dist/bundled/chunks/{local-community-B-UbNa-z.js → local-community-feziLP2d.js} +1 -1
  52. package/dist/bundled/chunks/{node-BHLzTAo9.js → node-ByPmdQSD.js} +21 -5
  53. package/dist/bundled/chunks/{page-sort-scoring-Drqxj8Pi.js → page-sort-scoring-DEib5648.js} +11 -7
  54. package/dist/bundled/chunks/{rpc-local-community-_ooAoNPM.js → rpc-local-community-WmgDVdST.js} +61 -28
  55. package/dist/bundled/chunks/{util-DX2ZJtU4.js → util-BzXGIQ9v.js} +1 -1
  56. package/dist/bundled/chunks/{util-B-JWgzlN.js → util-ok4F-vdA.js} +3 -1
  57. package/dist/bundled/chunks/{validate-package-factories-BSmEBl_0.js → validate-package-factories-DoUgLmab.js} +2 -2
  58. package/dist/bundled/index.js +1 -1
  59. package/dist/bundled/page-sorts.js +1 -1
  60. package/dist/bundled/rpc/src/index.js +56 -19
  61. package/dist/node/community/community-client-manager.js +8 -2
  62. package/dist/node/community/community-client-manager.js.map +1 -1
  63. package/dist/node/errors.d.ts +2 -0
  64. package/dist/node/errors.js +2 -0
  65. package/dist/node/errors.js.map +1 -1
  66. package/dist/node/generated-version.d.ts +1 -1
  67. package/dist/node/generated-version.js +1 -1
  68. package/dist/node/pages/page-sort-options.d.ts +1 -0
  69. package/dist/node/pages/page-sort-options.js +7 -6
  70. package/dist/node/pages/page-sort-options.js.map +1 -1
  71. package/dist/node/pages/page-sort-scoring.d.ts +5 -1
  72. package/dist/node/pages/page-sort-scoring.js +23 -13
  73. package/dist/node/pages/page-sort-scoring.js.map +1 -1
  74. package/dist/node/pages/types.d.ts +1 -1
  75. package/dist/node/pkc-error.d.ts +1 -1
  76. package/dist/node/publications/publication.d.ts +2 -0
  77. package/dist/node/publications/publication.js +24 -1
  78. package/dist/node/publications/publication.js.map +1 -1
  79. package/dist/node/rpc/src/index.d.ts +4 -0
  80. package/dist/node/rpc/src/index.js +74 -19
  81. package/dist/node/rpc/src/index.js.map +1 -1
  82. package/dist/node/runtime/node/community/db-handler.d.ts +2 -2
  83. package/dist/node/runtime/node/community/db-handler.js +42 -58
  84. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  85. package/dist/node/runtime/node/community/local-community/editing.d.ts +1 -0
  86. package/dist/node/runtime/node/community/local-community/editing.js +25 -4
  87. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  88. package/dist/node/runtime/node/community/local-community/ipns-publishing.js +7 -4
  89. package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  90. package/dist/node/runtime/node/community/local-community/lifecycle.js +17 -4
  91. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  92. package/dist/node/runtime/node/community/local-community/publication-validation.js +4 -0
  93. package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
  94. package/dist/node/runtime/node/community/local-community.d.ts +4 -1
  95. package/dist/node/runtime/node/community/local-community.js +12 -1
  96. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  97. package/dist/node/runtime/node/community/page-generator.d.ts +0 -1
  98. package/dist/node/runtime/node/community/page-generator.js.map +1 -1
  99. package/dist/node/runtime/node/community/page-sorts/index.js +22 -4
  100. package/dist/node/runtime/node/community/page-sorts/index.js.map +1 -1
  101. package/dist/node/runtime/node/util.d.ts +4 -1
  102. package/dist/node/runtime/node/util.js +41 -24
  103. package/dist/node/runtime/node/util.js.map +1 -1
  104. package/dist/node/signer/encryption.js +5 -1
  105. package/dist/node/signer/encryption.js.map +1 -1
  106. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  "challenges.js": {
4
4
  "isEntry": true,
5
5
  "imports": [
6
- "chunks/validate-package-factories-BSmEBl_0.js"
6
+ "chunks/validate-package-factories-DoUgLmab.js"
7
7
  ],
8
8
  "dynamicImports": [],
9
9
  "inputs": [
@@ -16,7 +16,7 @@
16
16
  "node:module"
17
17
  ],
18
18
  "dynamicImports": [
19
- "chunks/node-BHLzTAo9.js"
19
+ "chunks/node-ByPmdQSD.js"
20
20
  ],
21
21
  "inputs": [
22
22
  "dist/node/runtime/node/compile-cache.js",
@@ -26,7 +26,7 @@
26
26
  "index.js": {
27
27
  "isEntry": true,
28
28
  "imports": [
29
- "chunks/node-BHLzTAo9.js"
29
+ "chunks/node-ByPmdQSD.js"
30
30
  ],
31
31
  "dynamicImports": [],
32
32
  "inputs": []
@@ -34,7 +34,7 @@
34
34
  "page-sorts.js": {
35
35
  "isEntry": true,
36
36
  "imports": [
37
- "chunks/validate-package-factories-BSmEBl_0.js"
37
+ "chunks/validate-package-factories-DoUgLmab.js"
38
38
  ],
39
39
  "dynamicImports": [],
40
40
  "inputs": [
@@ -44,10 +44,10 @@
44
44
  "rpc/src/index.js": {
45
45
  "isEntry": true,
46
46
  "imports": [
47
- "chunks/rpc-local-community-_ooAoNPM.js",
48
- "chunks/node-BHLzTAo9.js",
49
- "chunks/util-B-JWgzlN.js",
50
- "chunks/local-community-DngOEreY.js",
47
+ "chunks/rpc-local-community-WmgDVdST.js",
48
+ "chunks/node-ByPmdQSD.js",
49
+ "chunks/util-ok4F-vdA.js",
50
+ "chunks/local-community-CMkVMrOZ.js",
51
51
  "node:url",
52
52
  "path",
53
53
  "assert",
@@ -77,12 +77,12 @@
77
77
  "\u0000rolldown/runtime.js"
78
78
  ]
79
79
  },
80
- "chunks/helia-for-pkc-Cr90E9ul.js": {
80
+ "chunks/helia-for-pkc-Bw9KzcSY.js": {
81
81
  "isEntry": false,
82
82
  "imports": [
83
83
  "chunks/chunk-2rV9d50f.js",
84
- "chunks/util-B-JWgzlN.js",
85
- "chunks/util-DX2ZJtU4.js",
84
+ "chunks/util-ok4F-vdA.js",
85
+ "chunks/util-BzXGIQ9v.js",
86
86
  "chunks/src-DKntVmyX.js",
87
87
  "chunks/src-Cpx2Sts8.js",
88
88
  "node:url",
@@ -201,21 +201,13 @@
201
201
  "dist/node/helia/helia-for-pkc.js"
202
202
  ]
203
203
  },
204
- "chunks/local-community-B-UbNa-z.js": {
205
- "isEntry": false,
206
- "imports": [
207
- "chunks/local-community-DngOEreY.js"
208
- ],
209
- "dynamicImports": [],
210
- "inputs": []
211
- },
212
- "chunks/local-community-DngOEreY.js": {
204
+ "chunks/local-community-CMkVMrOZ.js": {
213
205
  "isEntry": false,
214
206
  "imports": [
215
207
  "chunks/chunk-2rV9d50f.js",
216
- "chunks/rpc-local-community-_ooAoNPM.js",
217
- "chunks/util-B-JWgzlN.js",
218
- "chunks/page-sort-scoring-Drqxj8Pi.js",
208
+ "chunks/rpc-local-community-WmgDVdST.js",
209
+ "chunks/util-ok4F-vdA.js",
210
+ "chunks/page-sort-scoring-DEib5648.js",
219
211
  "node:crypto",
220
212
  "node:url",
221
213
  "node:path",
@@ -274,13 +266,21 @@
274
266
  "dist/node/runtime/node/community/local-community.js"
275
267
  ]
276
268
  },
277
- "chunks/node-BHLzTAo9.js": {
269
+ "chunks/local-community-feziLP2d.js": {
270
+ "isEntry": false,
271
+ "imports": [
272
+ "chunks/local-community-CMkVMrOZ.js"
273
+ ],
274
+ "dynamicImports": [],
275
+ "inputs": []
276
+ },
277
+ "chunks/node-ByPmdQSD.js": {
278
278
  "isEntry": false,
279
279
  "imports": [
280
280
  "chunks/chunk-2rV9d50f.js",
281
- "chunks/rpc-local-community-_ooAoNPM.js",
282
- "chunks/util-B-JWgzlN.js",
283
- "chunks/util-DX2ZJtU4.js",
281
+ "chunks/rpc-local-community-WmgDVdST.js",
282
+ "chunks/util-ok4F-vdA.js",
283
+ "chunks/util-BzXGIQ9v.js",
284
284
  "path",
285
285
  "assert",
286
286
  "fs",
@@ -291,8 +291,8 @@
291
291
  "rpc-websockets"
292
292
  ],
293
293
  "dynamicImports": [
294
- "chunks/helia-for-pkc-Cr90E9ul.js",
295
- "chunks/local-community-DngOEreY.js"
294
+ "chunks/helia-for-pkc-Bw9KzcSY.js",
295
+ "chunks/local-community-CMkVMrOZ.js"
296
296
  ],
297
297
  "inputs": [
298
298
  "node_modules/zod/v4/locales/en.js",
@@ -339,22 +339,22 @@
339
339
  "dist/node/index.js"
340
340
  ]
341
341
  },
342
- "chunks/page-sort-scoring-Drqxj8Pi.js": {
342
+ "chunks/page-sort-scoring-DEib5648.js": {
343
343
  "isEntry": false,
344
344
  "imports": [
345
- "chunks/util-B-JWgzlN.js"
345
+ "chunks/util-ok4F-vdA.js"
346
346
  ],
347
347
  "dynamicImports": [],
348
348
  "inputs": [
349
349
  "dist/node/pages/page-sort-scoring.js"
350
350
  ]
351
351
  },
352
- "chunks/rpc-local-community-_ooAoNPM.js": {
352
+ "chunks/rpc-local-community-WmgDVdST.js": {
353
353
  "isEntry": false,
354
354
  "imports": [
355
355
  "chunks/chunk-2rV9d50f.js",
356
- "chunks/util-B-JWgzlN.js",
357
- "chunks/page-sort-scoring-Drqxj8Pi.js",
356
+ "chunks/util-ok4F-vdA.js",
357
+ "chunks/page-sort-scoring-DEib5648.js",
358
358
  "chunks/src-CYIMjhjK.js",
359
359
  "node:crypto",
360
360
  "node:url",
@@ -1302,7 +1302,21 @@
1302
1302
  "node_modules/it-parallel-batch/dist/src/index.js"
1303
1303
  ]
1304
1304
  },
1305
- "chunks/util-B-JWgzlN.js": {
1305
+ "chunks/util-BzXGIQ9v.js": {
1306
+ "isEntry": false,
1307
+ "imports": [
1308
+ "chunks/util-ok4F-vdA.js",
1309
+ "ipns/selector",
1310
+ "ipns/validator",
1311
+ "ipns",
1312
+ "uint8arrays/equals"
1313
+ ],
1314
+ "dynamicImports": [],
1315
+ "inputs": [
1316
+ "dist/node/helia/util.js"
1317
+ ]
1318
+ },
1319
+ "chunks/util-ok4F-vdA.js": {
1306
1320
  "isEntry": false,
1307
1321
  "imports": [
1308
1322
  "chunks/chunk-2rV9d50f.js",
@@ -1396,25 +1410,11 @@
1396
1410
  "dist/node/util.js"
1397
1411
  ]
1398
1412
  },
1399
- "chunks/util-DX2ZJtU4.js": {
1400
- "isEntry": false,
1401
- "imports": [
1402
- "chunks/util-B-JWgzlN.js",
1403
- "ipns/selector",
1404
- "ipns/validator",
1405
- "ipns",
1406
- "uint8arrays/equals"
1407
- ],
1408
- "dynamicImports": [],
1409
- "inputs": [
1410
- "dist/node/helia/util.js"
1411
- ]
1412
- },
1413
- "chunks/validate-package-factories-BSmEBl_0.js": {
1413
+ "chunks/validate-package-factories-DoUgLmab.js": {
1414
1414
  "isEntry": false,
1415
1415
  "imports": [
1416
- "chunks/util-B-JWgzlN.js",
1417
- "chunks/page-sort-scoring-Drqxj8Pi.js"
1416
+ "chunks/util-ok4F-vdA.js",
1417
+ "chunks/page-sort-scoring-DEib5648.js"
1418
1418
  ],
1419
1419
  "dynamicImports": [],
1420
1420
  "inputs": [
@@ -1,2 +1,2 @@
1
- import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-BSmEBl_0.js";
1
+ import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-DoUgLmab.js";
2
2
  export { validateChallengeFileFactory };
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { Ar as PKCError, Mr as logger_default, S as hideClassPrivateProps, n as binaryKeyToPubsubTopic, w as ipnsNameToIpnsOverPubsubTopic } from "./util-B-JWgzlN.js";
3
- import { a as directFetchIpnsRecordFromProviders, c as readFreshCachedIpnsRecordFromPubsubLocalStore, i as connectToPubsubPeers, l as selectBitswapSessionSeedPeers, n as REACHABILITY_DOCS_URL, o as fetchBlockWithStalledSessionFailover, r as cacheIpnsRecordInPubsubLocalStore, s as getHeliaDebugContext, u as summarizeProviderReachability } from "./util-DX2ZJtU4.js";
2
+ import { Ar as PKCError, Mr as logger_default, S as hideClassPrivateProps, n as binaryKeyToPubsubTopic, w as ipnsNameToIpnsOverPubsubTopic } from "./util-ok4F-vdA.js";
3
+ import { a as directFetchIpnsRecordFromProviders, c as readFreshCachedIpnsRecordFromPubsubLocalStore, i as connectToPubsubPeers, l as selectBitswapSessionSeedPeers, n as REACHABILITY_DOCS_URL, o as fetchBlockWithStalledSessionFailover, r as cacheIpnsRecordInPubsubLocalStore, s as getHeliaDebugContext, u as summarizeProviderReachability } from "./util-BzXGIQ9v.js";
4
4
  import { t as map } from "./src-Cpx2Sts8.js";
5
5
  import { t as parallelBatch } from "./src-DKntVmyX.js";
6
6
  import { fileURLToPath } from "node:url";
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $t as CommentModerationPubsubMessagePublicationSchema, A as isLinkOfAnimatedImage, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Bn as CommentUpdateTableRowSchema, Dn as VoteTablesRowSchema, Dt as pTimeout, F as isLinkValid, Gr as ZodError, Jn as CommentEditPubsubMessagePublicationSchema, Jt as CommunityEditPublicationPubsubReservedFields, K as removeNullUndefinedValues, Kt as version_default, Lt as DecryptedChallengeRequestPublicationSchema, M as isLinkOfImage, Mr as logger_default, Mt as ChallengeRequestMessageSchema, N as isLinkOfMedia, Ot as ChallengeAnswerMessageSchema, P as isLinkOfVideo, Pt as ChallengeVerificationMessageSchema, Q as retryKuboIpfsAddAndProvide, Qn as CommentEditsTableRowSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rt as DecryptedChallengeRequestSchema, S as hideClassPrivateProps, Sr as t$2, St as untrackStartedCommunity, Tn as VotePubsubReservedFields, Tt as require_sha256, U as removeBlocksFromKuboNode, Vn as CommentsTableRowSchema, W as removeMfsFilesSafely, X as retryKuboBlockPutPinAndProvidePubsubTopic, Xn as CommentEditReservedFields, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as getEquivalentCommunityAddresses, _r as r$1, a as calculateUnixFsDagSizeCidV0, c as contentContainsMarkdownVideos, ct as writeKuboFilesWithTimeout, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$2, en as CommentModerationReservedFields, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, fr as t$5, ft as findUpdatingCommunity, g as genToArray, h as findMalformedUnicodeString, hr as e, i as calculateStringSizeSameAsIpfsAddCidV0, it as timestamp, j as isLinkOfAudio, jn as CommentPubsubMessageReservedFields, jr as messages, lr as n$3, lt as findCommunityInRegistry, mr as e$1, nn as CommentModerationsTableRowSchema, nr as AuthorReservedFields, nt as statMfsPathSafely, o as contentContainsMarkdownAudio, ot as withSortedKeys, pr as t$6, r as calculateIpfsCidV0, s as contentContainsMarkdownImages, st as withSortedKeysDeep, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, ur as t$7, ut as findStartedCommunity, v as getErrorCodeFromMessage, vr as t$3, vt as syncCommunityRegistryEntry, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, xr as t$4, xt as trackUpdatingCommunity, y as getIpnsRecordInLocalKuboNode, yt as trackStartedCommunity } from "./util-B-JWgzlN.js";
3
- import { $n as backupCommunityDb, An as verifyCommunity, Ar as STORAGE_KEYS, Cn as verifyChallengeRequest, Dn as verifyCommentModeration, En as verifyCommentIpfs, Gn as decode, Hn as getCommunityNameFromWire, In as getAuthorNameFromWire, Jn as getIpfsKeyFromPrivateKey, Kn as encode, Mn as verifyVote, Nn as buildRuntimeAuthor, On as verifyCommentPubsubMessage, Pn as cleanWireAuthor, Q as createSchemaRowParser, Qn as BackupAbortError, Rn as crosspostChainDepthUpTo, S as KeyvBetterSqlite3, Sr as n$4, St as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Tn as verifyCommentEdit, Tr as stringify, Tt as parseJsonWithPKCErrorIfFails, U as pLimit, Un as getCommunityPublicKeyFromWire, X as coerceSchemaRowJson, Xn as getPKCAddressFromPublicKeySync, Y as coerceSchemaRowBoolean, Yn as getPKCAddressFromPublicKey, Z as collectSchemaRowCoercions, Zn as getPublicKeyFromPrivateKey, _ as createAuthorIdentityMatcher, _n as signCommentUpdateForChallengeVerification, _r as t$10, a as generatePagesReportingFailedSorts, ar as deriveDbPosts, br as t$8, c as resolvePageSortsOrThrow, cn as cleanUpBeforePublishing, d as getChallengeVerification, en as SignerWithPublicKeyAddress, er as calculateExpectedSignatureSize, f as getCommunityChallengeFromCommunityChallengeSettings, fn as signChallengeVerification, ft as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, g as authorNameResolveFailureReason, gn as signCommentUpdate, h as authorIdentityMatcherForRequest, i as derivePublicPageSorts, in as decryptEd25519AesGcmPublicKeyBuffer, ir as deriveCommentIpfsFromCommentTableRow, j as iterateOverPageCidsToFindAllCids, jn as verifyCommunityEdit, jr as require_lodash_merge, kn as verifyCommentUpdate, lr as getThumbnailPropsOfLink, m as pkcJsChallenges, mn as signCommentEdit, mr as resolveDbPostsCidRefs, o as loadPageSortsForStartedCommunity, on as encryptEd25519AesGcmPublicKeyBuffer, or as deriveDbReplies, p as loadChallengeFileFromCommunityChallengeSettings, pn as signComment, pr as moveCommunityDbToDeletedDirectory, r as computePageSortsFingerprint, rr as deleteOldCommunityInWindows, s as lookupPageSortFactories, sn as _validateSignatureOfPKCRecord, sr as getDefaultCommunityDbConfig, t as RpcLocalCommunity, tr as calculateInlineRepliesBudget, u as deriveCommunityChallengesOrThrow, un as signChallengeMessage, ur as importSignerIntoKuboNode, ut as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, v as TrackedInstanceRegistry, vn as signCommunity, vr as t$11, w as TIMEFRAMES_TO_SECONDS, wr as t$9, x as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, xn as verifyChallengeAnswer, xr as n$5, y as LRUCache, yr as r$2, zn as effectiveMaxCrosspostDepth } from "./rpc-local-community-_ooAoNPM.js";
4
- import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-Drqxj8Pi.js";
2
+ import { $t as CommentModerationPubsubMessagePublicationSchema, A as isLinkOfAnimatedImage, An as CommentIpfsSchema, Ar as PKCError, At as ChallengeMessageSchema, Bn as CommentUpdateTableRowSchema, Dn as VoteTablesRowSchema, Dt as pTimeout, F as isLinkValid, Gr as ZodError, Jn as CommentEditPubsubMessagePublicationSchema, Jt as CommunityEditPublicationPubsubReservedFields, K as removeNullUndefinedValues, Kt as version_default, Lt as DecryptedChallengeRequestPublicationSchema, M as isLinkOfImage, Mr as logger_default, Mt as ChallengeRequestMessageSchema, N as isLinkOfMedia, Ot as ChallengeAnswerMessageSchema, P as isLinkOfVideo, Pt as ChallengeVerificationMessageSchema, Q as retryKuboIpfsAddAndProvide, Qn as CommentEditsTableRowSchema, R as pubsubTopicToDhtKey, Rn as CommentUpdateSchema, Rt as DecryptedChallengeRequestSchema, S as hideClassPrivateProps, Sr as t$2, St as untrackStartedCommunity, Tn as VotePubsubReservedFields, Tt as require_sha256, U as removeBlocksFromKuboNode, Vn as CommentsTableRowSchema, W as removeMfsFilesSafely, X as retryKuboBlockPutPinAndProvidePubsubTopic, Xn as CommentEditReservedFields, Yn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, _ as getEquivalentCommunityAddresses, _r as r$1, a as calculateUnixFsDagSizeCidV0, c as contentContainsMarkdownVideos, ct as writeKuboFilesWithTimeout, d as derivePublicationFromChallengeRequest, dn as CommunityIpfsSchema, dr as n$2, en as CommentModerationReservedFields, f as doesDomainAddressHaveCapitalLetter, fn as CommunitySignedPropertyNames, fr as t$5, ft as findUpdatingCommunity, g as genToArray, h as findMalformedUnicodeString, hr as e, i as calculateStringSizeSameAsIpfsAddCidV0, it as timestamp, j as isLinkOfAudio, jn as CommentPubsubMessageReservedFields, jr as messages, lr as n$3, lt as findCommunityInRegistry, mr as e$1, nn as CommentModerationsTableRowSchema, nr as AuthorReservedFields, nt as statMfsPathSafely, o as contentContainsMarkdownAudio, ot as withSortedKeys, pr as t$6, r as calculateIpfsCidV0, s as contentContainsMarkdownImages, st as withSortedKeysDeep, t as areEquivalentCommunityAddresses, tt as sleepUntilTimeoutOrAbort, ur as t$7, ut as findStartedCommunity, v as getErrorCodeFromMessage, vr as t$3, vt as syncCommunityRegistryEntry, w as ipnsNameToIpnsOverPubsubTopic, wn as VotePubsubMessagePublicationSchema, wr as require_retry, wt as untrackUpdatingCommunity, xn as isStringDomain, xr as t$4, xt as trackUpdatingCommunity, y as getIpnsRecordInLocalKuboNode, yt as trackStartedCommunity } from "./util-ok4F-vdA.js";
3
+ import { $n as backupCommunityDb, An as verifyCommunity, Cn as verifyChallengeRequest, Cr as n$4, Dn as verifyCommentModeration, En as verifyCommentIpfs, Er as stringify, Gn as decode, Hn as getCommunityNameFromWire, In as getAuthorNameFromWire, Jn as getIpfsKeyFromPrivateKey, Kn as encode, Mn as verifyVote, Mr as require_lodash_merge, Nn as buildRuntimeAuthor, On as verifyCommentPubsubMessage, Pn as cleanWireAuthor, Q as createSchemaRowParser, Qn as BackupAbortError, Rn as crosspostChainDepthUpTo, S as KeyvBetterSqlite3, Sr as n$5, St as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Tn as verifyCommentEdit, Tr as t$9, Tt as parseJsonWithPKCErrorIfFails, U as pLimit, Un as getCommunityPublicKeyFromWire, X as coerceSchemaRowJson, Xn as getPKCAddressFromPublicKeySync, Y as coerceSchemaRowBoolean, Yn as getPKCAddressFromPublicKey, Z as collectSchemaRowCoercions, Zn as getPublicKeyFromPrivateKey, _ as createAuthorIdentityMatcher, _n as signCommentUpdateForChallengeVerification, a as generatePagesReportingFailedSorts, ar as deriveDbPosts, br as r$2, c as resolvePageSortsOrThrow, cn as cleanUpBeforePublishing, d as getChallengeVerification, en as SignerWithPublicKeyAddress, er as calculateExpectedSignatureSize, f as getCommunityChallengeFromCommunityChallengeSettings, fn as signChallengeVerification, ft as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, g as authorNameResolveFailureReason, gn as signCommentUpdate, h as authorIdentityMatcherForRequest, hr as resolveDbPostsCidRefs, i as derivePublicPageSorts, in as decryptEd25519AesGcmPublicKeyBuffer, ir as deriveCommentIpfsFromCommentTableRow, j as iterateOverPageCidsToFindAllCids, jn as verifyCommunityEdit, jr as STORAGE_KEYS, kn as verifyCommentUpdate, lr as getThumbnailPropsOfLink, m as pkcJsChallenges, mn as signCommentEdit, mr as refreshCommunitiesList, o as loadPageSortsForStartedCommunity, on as encryptEd25519AesGcmPublicKeyBuffer, or as deriveDbReplies, p as loadChallengeFileFromCommunityChallengeSettings, pn as signComment, pr as moveCommunityDbToDeletedDirectory, r as computePageSortsFingerprint, rr as deleteOldCommunityInWindows, s as lookupPageSortFactories, sn as _validateSignatureOfPKCRecord, sr as getDefaultCommunityDbConfig, t as RpcLocalCommunity, tr as calculateInlineRepliesBudget, u as deriveCommunityChallengesOrThrow, un as signChallengeMessage, ur as importSignerIntoKuboNode, ut as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, v as TrackedInstanceRegistry, vn as signCommunity, vr as t$10, w as TIMEFRAMES_TO_SECONDS, x as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, xn as verifyChallengeAnswer, xr as t$8, y as LRUCache, yr as t$11, zn as effectiveMaxCrosspostDepth } from "./rpc-local-community-WmgDVdST.js";
4
+ import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-DEib5648.js";
5
5
  import { randomFillSync, randomUUID } from "node:crypto";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import path from "node:path";
@@ -3607,57 +3607,47 @@ var DbHandler = class {
3607
3607
  _pendingApprovalClause(alias) {
3608
3608
  return `(${alias}.pendingApproval IS NULL OR ${alias}.pendingApproval != 1)`;
3609
3609
  }
3610
- _communityAddressClause(alias) {
3610
+ _communityIdentityClause(alias) {
3611
3611
  const address = this._community.address;
3612
- const addresses = getEquivalentCommunityAddresses(address);
3613
3612
  if (isStringDomain(address)) {
3614
- const domainPlaceholders = addresses.map(() => "?").join(", ");
3613
+ const names = getEquivalentCommunityAddresses(address);
3615
3614
  return {
3616
- clause: `(${alias}.communityName IN (${domainPlaceholders}) OR ${alias}.communityPublicKey IN (${domainPlaceholders}))`,
3617
- params: [...addresses, ...addresses]
3615
+ clause: `(${alias}.communityName IS NULL OR ${alias}.communityName IN (${names.map(() => "?").join(", ")}))`,
3616
+ params: names
3618
3617
  };
3619
- } else return {
3620
- clause: `${alias}.communityPublicKey = ?`,
3618
+ }
3619
+ return {
3620
+ clause: `(${alias}.communityPublicKey IS NULL OR ${alias}.communityPublicKey = ?)`,
3621
3621
  params: [address]
3622
3622
  };
3623
3623
  }
3624
- _communityAddressClauseNamed(alias, paramPrefix) {
3624
+ _communityIdentityClauseNamed(alias, paramPrefix) {
3625
3625
  const address = this._community.address;
3626
- const addresses = getEquivalentCommunityAddresses(address);
3627
3626
  if (isStringDomain(address)) {
3628
3627
  const params = {};
3629
- const namePlaceholders = [];
3630
- const keyPlaceholders = [];
3631
- addresses.forEach((addr, i) => {
3632
- const nameParam = `${paramPrefix}CommunityName${i}`;
3633
- const keyParam = `${paramPrefix}CommunityKey${i}`;
3634
- params[nameParam] = addr;
3635
- params[keyParam] = addr;
3636
- namePlaceholders.push(`:${nameParam}`);
3637
- keyPlaceholders.push(`:${keyParam}`);
3638
- });
3639
3628
  return {
3640
- clause: `(${alias}.communityName IN (${namePlaceholders.join(", ")}) OR ${alias}.communityPublicKey IN (${keyPlaceholders.join(", ")}))`,
3629
+ clause: `(${alias}.communityName IS NULL OR ${alias}.communityName IN (${getEquivalentCommunityAddresses(address).map((name, i) => {
3630
+ const paramName = `${paramPrefix}CommunityName${i}`;
3631
+ params[paramName] = name;
3632
+ return `:${paramName}`;
3633
+ }).join(", ")}))`,
3641
3634
  params
3642
3635
  };
3643
- } else {
3644
- const paramName = `${paramPrefix}CommunityKey`;
3645
- return {
3646
- clause: `${alias}.communityPublicKey = :${paramName}`,
3647
- params: { [paramName]: address }
3648
- };
3649
3636
  }
3637
+ const paramName = `${paramPrefix}CommunityKey`;
3638
+ return {
3639
+ clause: `(${alias}.communityPublicKey IS NULL OR ${alias}.communityPublicKey = :${paramName})`,
3640
+ params: { [paramName]: address }
3641
+ };
3650
3642
  }
3651
3643
  _buildPageQueryParts(options) {
3652
3644
  const commentsTable = TABLES.COMMENTS;
3653
3645
  const commentUpdatesTable = TABLES.COMMENT_UPDATES;
3654
3646
  const whereClauses = [`${commentsTable}.parentCid = ?`];
3655
3647
  const params = [options.parentCid];
3656
- if (options.excludeCommentsWithDifferentCommunityAddress) {
3657
- const { clause, params: addrParams } = this._communityAddressClause(commentsTable);
3658
- whereClauses.push(clause);
3659
- params.push(...addrParams);
3660
- }
3648
+ const { clause: identityClause, params: identityParams } = this._communityIdentityClause(commentsTable);
3649
+ whereClauses.push(identityClause);
3650
+ params.push(...identityParams);
3661
3651
  if (options.excludeCommentPendingApproval) whereClauses.push(this._pendingApprovalClause(commentsTable));
3662
3652
  if (options.excludeRemovedComments) whereClauses.push(this._removedClause(commentUpdatesTable));
3663
3653
  if (options.excludeDeletedComments) whereClauses.push(this._deletedFromUpdatesClause(commentUpdatesTable));
@@ -3887,14 +3877,12 @@ var DbHandler = class {
3887
3877
  const commentsAlias = "comments";
3888
3878
  const commentUpdatesAlias = "c_updates";
3889
3879
  const deletedLookupAlias = "d";
3890
- if (options.excludeCommentsWithDifferentCommunityAddress) {
3891
- const { clause: baseClause, params: baseAddrParams } = this._communityAddressClause(commentsAlias);
3892
- baseFilterClauses.push(baseClause);
3893
- params.push(...baseAddrParams);
3894
- const { clause: recClause, params: recAddrParams } = this._communityAddressClause(commentsAlias);
3895
- recursiveFilterClauses.push(recClause);
3896
- params.push(...recAddrParams);
3897
- }
3880
+ const { clause: baseIdentityClause, params: baseIdentityParams } = this._communityIdentityClause(commentsAlias);
3881
+ baseFilterClauses.push(baseIdentityClause);
3882
+ params.push(...baseIdentityParams);
3883
+ const { clause: recursiveIdentityClause, params: recursiveIdentityParams } = this._communityIdentityClause(commentsAlias);
3884
+ recursiveFilterClauses.push(recursiveIdentityClause);
3885
+ params.push(...recursiveIdentityParams);
3898
3886
  if (options.excludeCommentPendingApproval) {
3899
3887
  const clause = this._pendingApprovalClause(commentsAlias);
3900
3888
  baseFilterClauses.push(clause);
@@ -4046,7 +4034,7 @@ var DbHandler = class {
4046
4034
  _collectCommentsToBeUpdated() {
4047
4035
  const windowed = this._buildWindowedReplySortArms(timestamp());
4048
4036
  const notPending = (alias) => `(${alias}.pendingApproval IS NULL OR ${alias}.pendingApproval != 1)`;
4049
- const countedChildAddress = this._communityAddressClauseNamed("c", "countedChild");
4037
+ const countedChildAddress = this._communityIdentityClauseNamed("c", "countedChild");
4050
4038
  const countedChild = `
4051
4039
  FROM ${TABLES.COMMENTS} c
4052
4040
  JOIN ${TABLES.COMMENT_UPDATES} cu_child ON c.cid = cu_child.cid
@@ -4186,8 +4174,8 @@ var DbHandler = class {
4186
4174
  }
4187
4175
  queryCommunityStats() {
4188
4176
  const now = timestamp();
4189
- const { clause: commentAddrClause, params: commentAddrParams } = this._communityAddressClauseNamed("comments", "statsComments");
4190
- const { clause: votesAddrClause, params: votesAddrParams } = this._communityAddressClauseNamed("comments_for_votes", "statsVotes");
4177
+ const { clause: commentAddrClause, params: commentAddrParams } = this._communityIdentityClauseNamed("comments", "statsComments");
4178
+ const { clause: votesAddrClause, params: votesAddrParams } = this._communityIdentityClauseNamed("comments_for_votes", "statsVotes");
4191
4179
  const removedCommentsClause = this._removedClause("cu_comments");
4192
4180
  const deletedCommentsClause = this._deletedFromUpdatesClause("cu_comments");
4193
4181
  const removedVotesClause = this._removedClause("cu_votes");
@@ -4328,7 +4316,7 @@ var DbHandler = class {
4328
4316
  }
4329
4317
  queryFirstCommentWithDepth(commentDepth) {
4330
4318
  if (!Number.isInteger(commentDepth) || commentDepth < 0) throw new Error("commentDepth must be a non-negative integer");
4331
- const { clause: addrClause, params: addrParams } = this._communityAddressClauseNamed("c", "firstComment");
4319
+ const { clause: addrClause, params: addrParams } = this._communityIdentityClauseNamed("c", "firstComment");
4332
4320
  const exactDepthRow = this._db.prepare(`SELECT c.* FROM ${TABLES.COMMENTS} c
4333
4321
  LEFT JOIN ${TABLES.COMMENT_UPDATES} cu ON cu.cid = c.cid
4334
4322
  WHERE ${addrClause}
@@ -4396,7 +4384,7 @@ var DbHandler = class {
4396
4384
  const currentTimestampSeconds = timestamp();
4397
4385
  const maxBucket = Math.max(...buckets);
4398
4386
  const caseClauses = buckets.sort((a, b) => a - b).map((bucket) => `WHEN (${currentTimestampSeconds} - c.timestamp) <= ${bucket} THEN ${bucket}`).join(" ");
4399
- const { clause: addrClause, params: addrParams } = this._communityAddressClause("c");
4387
+ const { clause: addrClause, params: addrParams } = this._communityIdentityClause("c");
4400
4388
  const query = `
4401
4389
  WITH post_data AS (
4402
4390
  SELECT c.cid, c.timestamp, cu.postUpdatesBucket AS current_bucket,
@@ -4669,7 +4657,7 @@ var DbHandler = class {
4669
4657
  }
4670
4658
  _queryReplyCountsByParentCids(parentCids) {
4671
4659
  const result = /* @__PURE__ */ new Map();
4672
- const { clause: addrClause, params: addrParams } = this._communityAddressClause("c");
4660
+ const { clause: addrClause, params: addrParams } = this._communityIdentityClause("c");
4673
4661
  const present = this._replyWalkPresentExpression();
4674
4662
  const deletedLookup = `(SELECT cid, json_extract(edit, '$.deleted') AS deleted_flag FROM ${TABLES.COMMENT_UPDATES})`;
4675
4663
  for (const { placeholders, params } of this._cidChunks(parentCids, addrParams.length * 2)) {
@@ -4696,7 +4684,7 @@ var DbHandler = class {
4696
4684
  }
4697
4685
  _queryLastReplyTimestampsByParentCids(parentCids) {
4698
4686
  const result = /* @__PURE__ */ new Map();
4699
- const { clause: addrClause, params: addrParams } = this._communityAddressClause("c");
4687
+ const { clause: addrClause, params: addrParams } = this._communityIdentityClause("c");
4700
4688
  const walked = `${addrClause} AND (c.pendingApproval IS NULL OR c.pendingApproval != 1)`;
4701
4689
  const present = this._replyWalkPresentExpression();
4702
4690
  const deletedLookup = `(SELECT cid, json_extract(edit, '$.deleted') AS deleted_flag FROM ${TABLES.COMMENT_UPDATES})`;
@@ -4720,7 +4708,7 @@ var DbHandler = class {
4720
4708
  }
4721
4709
  _queryLastChildCidsByParentCids(parentCids) {
4722
4710
  const result = /* @__PURE__ */ new Map();
4723
- const { clause: addrClause, params: addrParams } = this._communityAddressClause("c");
4711
+ const { clause: addrClause, params: addrParams } = this._communityIdentityClause("c");
4724
4712
  for (const { placeholders, params } of this._cidChunks(parentCids, addrParams.length)) {
4725
4713
  const rows = this._prepareCached(`SELECT c.parentCid AS parentCid, c.cid AS cid, MAX(c.rowid) AS lastRowid FROM ${TABLES.COMMENTS} c
4726
4714
  INNER JOIN ${TABLES.COMMENT_UPDATES} cu ON cu.cid = c.cid
@@ -5347,11 +5335,9 @@ var DbHandler = class {
5347
5335
  const mapper = this._pageEntryMapper(pageOptions.commentUpdateFieldsToExclude);
5348
5336
  const params = {};
5349
5337
  const postsWhereClauses = ["c.depth = 0"];
5350
- if (pageOptions.excludeCommentsWithDifferentCommunityAddress) {
5351
- const { clause, params: addrParams } = this._communityAddressClauseNamed("c", "asPosts");
5352
- postsWhereClauses.push(clause);
5353
- Object.assign(params, addrParams);
5354
- }
5338
+ const { clause: identityClause, params: identityParams } = this._communityIdentityClauseNamed("c", "asPosts");
5339
+ postsWhereClauses.push(identityClause);
5340
+ Object.assign(params, identityParams);
5355
5341
  if (pageOptions.excludeRemovedComments) postsWhereClauses.push(this._removedClause("cu"));
5356
5342
  if (pageOptions.excludeDeletedComments) postsWhereClauses.push(this._deletedFromUpdatesClause("cu"));
5357
5343
  if (pageOptions.excludeCommentPendingApproval) postsWhereClauses.push(this._pendingApprovalClause("c"));
@@ -6559,6 +6545,7 @@ async function checkWireFormatAndCommunityAuthor(community, publication, log, au
6559
6545
  }
6560
6546
  const pubCommunityName = getCommunityNameFromWire(publication);
6561
6547
  if (pubCommunityName && pubCommunityName !== community.address) return messages.ERR_PUBLICATION_INVALID_COMMUNITY_NAME;
6548
+ if (!pubCommunityName && isStringDomain(community.address)) return messages.ERR_PUBLICATION_MISSING_COMMUNITY_NAME;
6562
6549
  if (publication.timestamp <= timestamp() - 300 || publication.timestamp >= timestamp() + 300) return messages.ERR_PUBLICATION_TIMESTAMP_IS_NOT_IN_PROPER_RANGE;
6563
6550
  if (typeof authorCommunity?.banExpiresAt === "number" && authorCommunity.banExpiresAt > timestamp()) return messages.ERR_AUTHOR_IS_BANNED;
6564
6551
  }
@@ -7405,7 +7392,7 @@ function calculateLatestUpdateTrigger(community) {
7405
7392
  const lastPublishTooOld = (community.updatedAt || 0) < timestamp() - 900;
7406
7393
  const lastPostCidChanged = community.lastPostCid !== community._dbHandler.queryLatestPostCid()?.cid;
7407
7394
  const lastCommentCidChanged = community.lastCommentCid !== community._dbHandler.queryLatestCommentCid()?.cid;
7408
- community._communityUpdateTrigger = community._communityUpdateTrigger || lastPublishTooOld || community._pendingEditProps.length > 0 || community._blocksToRm.length > 0 || lastCommentCidChanged || lastPostCidChanged;
7395
+ if (!community._communityUpdateTrigger && (lastPublishTooOld || community._pendingEditProps.length > 0 || community._blocksToRm.length > 0 || lastCommentCidChanged || lastPostCidChanged)) community._communityUpdateTrigger = true;
7409
7396
  }
7410
7397
  function requireCommunityUpdateIfModQueueChanged(community) {
7411
7398
  const combinedHashOfAllQueuedComments = community._dbHandler.queryCombinedHashOfPendingComments();
@@ -7746,28 +7733,34 @@ async function publishLoop(community, syncIntervalMs) {
7746
7733
  const shouldStopPublishLoop = () => {
7747
7734
  return community.state !== "started" || community._stopHasBeenCalled && (community._pendingEditProps.length === 0 || syncFailedSinceStop);
7748
7735
  };
7749
- const waitUntilNextSync = async () => {
7736
+ const waitUntilNextSync = async ({ lastSyncFailed }) => {
7750
7737
  const doneWithLoopTime = Date.now();
7738
+ if (lastSyncFailed) calculateLatestUpdateTrigger(community);
7739
+ const triggerGenerationAfterFailure = community._updateTriggerGeneration;
7751
7740
  await new Promise((resolve) => {
7752
7741
  const checkInterval = setInterval(() => {
7753
7742
  const syncIntervalMsPassedSinceDoneWithLoop = Date.now() - doneWithLoopTime >= syncIntervalMs;
7754
7743
  calculateLatestUpdateTrigger(community);
7755
- if (community._communityUpdateTrigger || shouldStopPublishLoop() || syncIntervalMsPassedSinceDoneWithLoop) {
7744
+ if ((lastSyncFailed ? community._updateTriggerGeneration !== triggerGenerationAfterFailure : community._communityUpdateTrigger) || shouldStopPublishLoop() || syncIntervalMsPassedSinceDoneWithLoop) {
7756
7745
  clearInterval(checkInterval);
7757
7746
  resolve(1);
7758
7747
  }
7759
7748
  }, 100);
7760
7749
  });
7761
7750
  };
7762
- while (!shouldStopPublishLoop()) try {
7763
- await syncIpnsWithDb(community);
7764
- await reprovideOnAddressChangeIfDue(community).catch((e) => log.error("Failed to re-provide connection CIDs on address change", e));
7765
- await reprovideAnchorRecordIfDue(community).catch((e) => log.error("Failed to re-provide the anchor record", e));
7766
- } catch (e) {
7767
- if (community._stopHasBeenCalled) syncFailedSinceStop = true;
7768
- community.emit("error", e);
7769
- } finally {
7770
- await waitUntilNextSync();
7751
+ while (!shouldStopPublishLoop()) {
7752
+ let lastSyncFailed = false;
7753
+ try {
7754
+ await syncIpnsWithDb(community);
7755
+ await reprovideOnAddressChangeIfDue(community).catch((e) => log.error("Failed to re-provide connection CIDs on address change", e));
7756
+ await reprovideAnchorRecordIfDue(community).catch((e) => log.error("Failed to re-provide the anchor record", e));
7757
+ } catch (e) {
7758
+ lastSyncFailed = true;
7759
+ if (community._stopHasBeenCalled) syncFailedSinceStop = true;
7760
+ community.emit("error", e);
7761
+ } finally {
7762
+ await waitUntilNextSync({ lastSyncFailed });
7763
+ }
7771
7764
  }
7772
7765
  log("Stopping the publishing loop of community", community.address);
7773
7766
  }
@@ -8146,6 +8139,7 @@ async function deleteCommunity(community) {
8146
8139
  community._dbHandler.destoryConnection();
8147
8140
  }
8148
8141
  await moveCommunityDbToDeletedDirectory(community.address, community._pkc);
8142
+ refreshCommunitiesList(community._pkc);
8149
8143
  log(`Deleted community (${community.address}) successfully`);
8150
8144
  }
8151
8145
  //#endregion
@@ -8240,6 +8234,23 @@ async function validateNewAddressBeforeEditing(community, newAddress, log) {
8240
8234
  community.emit("error", err);
8241
8235
  });
8242
8236
  }
8237
+ function deriveNameAndAddressEdit(community, editOptions) {
8238
+ const hasName = "name" in editOptions;
8239
+ const hasAddress = typeof editOptions.address === "string";
8240
+ if (!hasName && !hasAddress) return editOptions;
8241
+ const addressFromName = hasName ? editOptions.name ?? communityIdentityPublicKey(community) : void 0;
8242
+ if (hasAddress && hasName && editOptions.address !== addressFromName) throw new PKCError("ERR_COMMUNITY_EDIT_NAME_AND_ADDRESS_MISMATCH", {
8243
+ name: editOptions.name,
8244
+ address: editOptions.address,
8245
+ communityAddress: community.address
8246
+ });
8247
+ const address = hasAddress ? editOptions.address : addressFromName;
8248
+ return {
8249
+ ...editOptions,
8250
+ address,
8251
+ name: isStringDomain(address) ? address : void 0
8252
+ };
8253
+ }
8243
8254
  async function editPropsOnStartedCommunity(community, parsedEditOptions, pagesEdit) {
8244
8255
  const log = logger_default("pkc-js:local-community:start:editPropsOnStartedCommunity");
8245
8256
  const oldAddress = t$9(community.address);
@@ -8248,6 +8259,7 @@ async function editPropsOnStartedCommunity(community, parsedEditOptions, pagesEd
8248
8259
  log(`Attempting to edit community.address from ${oldAddress} to ${parsedEditOptions.address}. We will stop community first`);
8249
8260
  await community.stop();
8250
8261
  await community._dbHandler.changeDbFilename(oldAddress, parsedEditOptions.address);
8262
+ refreshCommunitiesList(community._pkc);
8251
8263
  community.setAddress(parsedEditOptions.address);
8252
8264
  await community._dbHandler.initDbIfNeeded();
8253
8265
  await community.start();
@@ -8290,6 +8302,7 @@ async function editPropsOnNotStartedCommunity(community, parsedEditOptions, page
8290
8302
  await movePostUpdatesFolderToNewAddress(community, community.address, parsedEditOptions.address);
8291
8303
  community._dbHandler.destoryConnection();
8292
8304
  await community._dbHandler.changeDbFilename(community.address, parsedEditOptions.address);
8305
+ refreshCommunitiesList(community._pkc);
8293
8306
  await community._dbHandler.initDbIfNeeded();
8294
8307
  community.setAddress(parsedEditOptions.address);
8295
8308
  }
@@ -8321,11 +8334,7 @@ async function edit(community, newCommunityOptions) {
8321
8334
  dataPath: community._pkc.dataPath
8322
8335
  });
8323
8336
  }
8324
- const parsedEditOptions = parseCommunityEditOptionsSchemaWithPKCErrorIfItFails(newCommunityOptions);
8325
- const editWithDerivedName = typeof parsedEditOptions.address === "string" && isStringDomain(parsedEditOptions.address) ? {
8326
- ...parsedEditOptions,
8327
- name: parsedEditOptions.address
8328
- } : parsedEditOptions;
8337
+ const editWithDerivedName = deriveNameAndAddressEdit(community, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails(newCommunityOptions));
8329
8338
  const pagesEdit = editWithDerivedName?.settings ? await parsePagesToEdit(community, editWithDerivedName.settings) : void 0;
8330
8339
  const newInternalProps = {
8331
8340
  ...editWithDerivedName.roles ? { roles: await parseRolesToEdit(community, editWithDerivedName.roles) } : void 0,
@@ -8536,6 +8545,13 @@ async function loadAndPruneExportsFromKeyv(community) {
8536
8545
  //#endregion
8537
8546
  //#region dist/node/runtime/node/community/local-community.js
8538
8547
  var LocalCommunity = class extends RpcLocalCommunity {
8548
+ get _communityUpdateTrigger() {
8549
+ return this._communityUpdateTriggerValue;
8550
+ }
8551
+ set _communityUpdateTrigger(value) {
8552
+ if (value) this._updateTriggerGeneration++;
8553
+ this._communityUpdateTriggerValue = value;
8554
+ }
8539
8555
  constructor(pkc) {
8540
8556
  super(pkc);
8541
8557
  this.raw = {};
@@ -8552,7 +8568,8 @@ var LocalCommunity = class extends RpcLocalCommunity {
8552
8568
  this._challengeExchangeTtlMs = CHALLENGE_EXCHANGE_TTL_MS;
8553
8569
  this._cidsToUnPin = /* @__PURE__ */ new Set();
8554
8570
  this._mfsPathsToRemove = /* @__PURE__ */ new Set();
8555
- this._communityUpdateTrigger = false;
8571
+ this._communityUpdateTriggerValue = false;
8572
+ this._updateTriggerGeneration = 0;
8556
8573
  this._combinedHashOfPendingCommentsCids = (0, import_sha256.sha256)("");
8557
8574
  this._pageSorts = void 0;
8558
8575
  this._pageSortFactories = void 0;
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DngOEreY.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-CMkVMrOZ.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };