@pkcprotocol/pkc-js 0.0.81 → 0.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/browser/clients/base-client-manager.js +19 -1
- package/dist/browser/clients/base-client-manager.js.map +1 -1
- package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -0
- package/dist/browser/clients/rpc-client/schema.d.ts +3 -0
- package/dist/browser/community/schema.d.ts +24 -0
- package/dist/browser/community/schema.js +6 -1
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/errors.d.ts +10 -1
- package/dist/browser/errors.js +10 -1
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/pages/pages.js +8 -0
- package/dist/browser/pages/pages.js.map +1 -1
- package/dist/browser/pages/schema.d.ts +4 -0
- package/dist/browser/pages/util.d.ts +2 -0
- package/dist/browser/pages/util.js +23 -3
- package/dist/browser/pages/util.js.map +1 -1
- package/dist/browser/pkc/pkc.d.ts +2 -0
- package/dist/browser/pkc/pkc.js +20 -0
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/publications/comment/comment-client-manager.js +22 -4
- package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
- package/dist/browser/publications/comment/comment.d.ts +2 -1
- package/dist/browser/publications/comment/comment.js +29 -6
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/publications/comment/crosspost-depth.d.ts +5 -0
- package/dist/browser/publications/comment/crosspost-depth.js +75 -0
- package/dist/browser/publications/comment/crosspost-depth.js.map +1 -0
- package/dist/browser/publications/comment/crosspost-runtime.d.ts +30 -0
- package/dist/browser/publications/comment/crosspost-runtime.js +133 -0
- package/dist/browser/publications/comment/crosspost-runtime.js.map +1 -0
- package/dist/browser/publications/comment/schema.d.ts +20 -2
- package/dist/browser/publications/comment/schema.js +21 -10
- package/dist/browser/publications/comment/schema.js.map +1 -1
- package/dist/browser/publications/comment/types.d.ts +10 -0
- package/dist/browser/publications/community-edit/schema.d.ts +4 -0
- package/dist/browser/publications/publication.d.ts +4 -0
- package/dist/browser/publications/publication.js +80 -5
- package/dist/browser/publications/publication.js.map +1 -1
- package/dist/browser/pubsub-messages/schema.d.ts +5 -0
- package/dist/browser/rpc/src/index.js +13 -1
- package/dist/browser/rpc/src/index.js.map +1 -1
- package/dist/browser/runtime/node/community/db-handler.js +3 -2
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-validation.js +15 -0
- package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/browser/runtime/node/community/page-generator.d.ts +2 -0
- package/dist/browser/schema/schema-util.d.ts +17 -0
- package/dist/browser/schema/schema-util.js +49 -5
- package/dist/browser/schema/schema-util.js.map +1 -1
- package/dist/browser/signer/signatures.d.ts +1 -10
- package/dist/browser/signer/signatures.js +83 -0
- package/dist/browser/signer/signatures.js.map +1 -1
- package/dist/browser/test/test-util.d.ts +6 -0
- package/dist/browser/version.js +1 -1
- package/dist/bundled/bundle-manifest.json +27 -25
- package/dist/bundled/chunks/{helia-for-pkc-BcNF-orO.js → helia-for-pkc-CQY3-UYD.js} +2 -2
- package/dist/bundled/chunks/{local-community-B6-jaMsn.js → local-community-AZAEiiht.js} +1 -1
- package/dist/bundled/chunks/{local-community-CyX1HwD0.js → local-community-DRm3r1-Y.js} +10 -4
- package/dist/bundled/chunks/{node-BCXmIYLQ.js → node-B1J8psGZ.js} +67 -14
- package/dist/bundled/chunks/{rpc-local-community-BOiy8BX1.js → rpc-local-community-0XmKyOdO.js} +253 -12
- package/dist/bundled/chunks/{schema-DZyEx0YQ.js → schema-BUUhufdT.js} +23 -8
- package/dist/bundled/chunks/{util-BTPlI1yF.js → util-Cct7-RT3.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +13 -5
- package/dist/node/clients/base-client-manager.js +19 -1
- package/dist/node/clients/base-client-manager.js.map +1 -1
- package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -0
- package/dist/node/clients/rpc-client/schema.d.ts +3 -0
- package/dist/node/community/schema.d.ts +24 -0
- package/dist/node/community/schema.js +6 -1
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/errors.d.ts +10 -1
- package/dist/node/errors.js +10 -1
- package/dist/node/errors.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/pages/pages.js +8 -0
- package/dist/node/pages/pages.js.map +1 -1
- package/dist/node/pages/schema.d.ts +4 -0
- package/dist/node/pages/util.d.ts +2 -0
- package/dist/node/pages/util.js +23 -3
- package/dist/node/pages/util.js.map +1 -1
- package/dist/node/pkc/pkc.d.ts +2 -0
- package/dist/node/pkc/pkc.js +20 -0
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/publications/comment/comment-client-manager.js +22 -4
- package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
- package/dist/node/publications/comment/comment.d.ts +2 -1
- package/dist/node/publications/comment/comment.js +29 -6
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/publications/comment/crosspost-depth.d.ts +5 -0
- package/dist/node/publications/comment/crosspost-depth.js +75 -0
- package/dist/node/publications/comment/crosspost-depth.js.map +1 -0
- package/dist/node/publications/comment/crosspost-runtime.d.ts +30 -0
- package/dist/node/publications/comment/crosspost-runtime.js +133 -0
- package/dist/node/publications/comment/crosspost-runtime.js.map +1 -0
- package/dist/node/publications/comment/schema.d.ts +20 -2
- package/dist/node/publications/comment/schema.js +21 -10
- package/dist/node/publications/comment/schema.js.map +1 -1
- package/dist/node/publications/comment/types.d.ts +10 -0
- package/dist/node/publications/community-edit/schema.d.ts +4 -0
- package/dist/node/publications/publication.d.ts +4 -0
- package/dist/node/publications/publication.js +80 -5
- package/dist/node/publications/publication.js.map +1 -1
- package/dist/node/pubsub-messages/schema.d.ts +5 -0
- package/dist/node/rpc/src/index.js +13 -1
- package/dist/node/rpc/src/index.js.map +1 -1
- package/dist/node/runtime/node/community/db-handler.js +3 -2
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-validation.js +15 -0
- package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/node/runtime/node/community/page-generator.d.ts +2 -0
- package/dist/node/schema/schema-util.d.ts +17 -0
- package/dist/node/schema/schema-util.js +49 -5
- package/dist/node/schema/schema-util.js.map +1 -1
- package/dist/node/signer/signatures.d.ts +1 -10
- package/dist/node/signer/signatures.js +83 -0
- package/dist/node/signer/signatures.js.map +1 -1
- package/dist/node/test/test-util.d.ts +6 -0
- package/dist/node/version.js +1 -1
- package/package.json +1 -1
|
@@ -303,6 +303,7 @@ export declare function createDelegatedCommunityIpns(communityOpts?: Partial<Com
|
|
|
303
303
|
parentCid?: string | undefined;
|
|
304
304
|
postCid?: string | undefined;
|
|
305
305
|
quotedCids?: string[] | undefined;
|
|
306
|
+
crosspost?: import("../publications/comment/schema.js").Crosspost | undefined;
|
|
306
307
|
author?: {
|
|
307
308
|
[x: string]: unknown;
|
|
308
309
|
name?: string | undefined;
|
|
@@ -490,6 +491,7 @@ export declare function createDelegatedCommunityIpns(communityOpts?: Partial<Com
|
|
|
490
491
|
noReplyLinks?: boolean | undefined;
|
|
491
492
|
noPolls?: boolean | undefined;
|
|
492
493
|
noCrossposts?: boolean | undefined;
|
|
494
|
+
maxCrosspostDepth?: number | undefined;
|
|
493
495
|
noNestedReplies?: boolean | undefined;
|
|
494
496
|
safeForWork?: boolean | undefined;
|
|
495
497
|
authorFlairs?: boolean | undefined;
|
|
@@ -639,6 +641,7 @@ export declare function createMockedCommunityIpns(communityOpts: CreateNewLocalC
|
|
|
639
641
|
parentCid?: string | undefined;
|
|
640
642
|
postCid?: string | undefined;
|
|
641
643
|
quotedCids?: string[] | undefined;
|
|
644
|
+
crosspost?: import("../publications/comment/schema.js").Crosspost | undefined;
|
|
642
645
|
author?: {
|
|
643
646
|
[x: string]: unknown;
|
|
644
647
|
name?: string | undefined;
|
|
@@ -826,6 +829,7 @@ export declare function createMockedCommunityIpns(communityOpts: CreateNewLocalC
|
|
|
826
829
|
noReplyLinks?: boolean | undefined;
|
|
827
830
|
noPolls?: boolean | undefined;
|
|
828
831
|
noCrossposts?: boolean | undefined;
|
|
832
|
+
maxCrosspostDepth?: number | undefined;
|
|
829
833
|
noNestedReplies?: boolean | undefined;
|
|
830
834
|
safeForWork?: boolean | undefined;
|
|
831
835
|
authorFlairs?: boolean | undefined;
|
|
@@ -939,6 +943,7 @@ export declare function jsonifyLocalCommunityWithNoInternalProps(community: Loca
|
|
|
939
943
|
noReplyLinks?: boolean | undefined;
|
|
940
944
|
noPolls?: boolean | undefined;
|
|
941
945
|
noCrossposts?: boolean | undefined;
|
|
946
|
+
maxCrosspostDepth?: number | undefined;
|
|
942
947
|
noNestedReplies?: boolean | undefined;
|
|
943
948
|
safeForWork?: boolean | undefined;
|
|
944
949
|
authorFlairs?: boolean | undefined;
|
|
@@ -1142,6 +1147,7 @@ export declare function createCommentUpdateWithInvalidSignature(commentCid: stri
|
|
|
1142
1147
|
parentCid?: string | undefined;
|
|
1143
1148
|
postCid?: string | undefined;
|
|
1144
1149
|
quotedCids?: string[] | undefined;
|
|
1150
|
+
crosspost?: import("../publications/comment/schema.js").Crosspost | undefined;
|
|
1145
1151
|
author?: {
|
|
1146
1152
|
[x: string]: unknown;
|
|
1147
1153
|
name?: string | undefined;
|
package/dist/browser/version.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node:module"
|
|
15
15
|
],
|
|
16
16
|
"dynamicImports": [
|
|
17
|
-
"chunks/node-
|
|
17
|
+
"chunks/node-B1J8psGZ.js"
|
|
18
18
|
],
|
|
19
19
|
"inputs": [
|
|
20
20
|
"dist/node/runtime/node/compile-cache.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"index.js": {
|
|
25
25
|
"isEntry": true,
|
|
26
26
|
"imports": [
|
|
27
|
-
"chunks/node-
|
|
27
|
+
"chunks/node-B1J8psGZ.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/rpc-local-community-
|
|
36
|
-
"chunks/node-
|
|
37
|
-
"chunks/schema-
|
|
38
|
-
"chunks/local-community-
|
|
35
|
+
"chunks/rpc-local-community-0XmKyOdO.js",
|
|
36
|
+
"chunks/node-B1J8psGZ.js",
|
|
37
|
+
"chunks/schema-BUUhufdT.js",
|
|
38
|
+
"chunks/local-community-DRm3r1-Y.js",
|
|
39
39
|
"node:url",
|
|
40
40
|
"path",
|
|
41
41
|
"assert",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
"\u0000rolldown/runtime.js"
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
|
-
"chunks/helia-for-pkc-
|
|
68
|
+
"chunks/helia-for-pkc-CQY3-UYD.js": {
|
|
69
69
|
"isEntry": false,
|
|
70
70
|
"imports": [
|
|
71
71
|
"chunks/chunk-2rV9d50f.js",
|
|
72
|
-
"chunks/schema-
|
|
73
|
-
"chunks/util-
|
|
72
|
+
"chunks/schema-BUUhufdT.js",
|
|
73
|
+
"chunks/util-Cct7-RT3.js",
|
|
74
74
|
"chunks/src-DKntVmyX.js",
|
|
75
75
|
"chunks/src-Cpx2Sts8.js",
|
|
76
76
|
"node:url",
|
|
@@ -186,20 +186,20 @@
|
|
|
186
186
|
"dist/node/helia/helia-for-pkc.js"
|
|
187
187
|
]
|
|
188
188
|
},
|
|
189
|
-
"chunks/local-community-
|
|
189
|
+
"chunks/local-community-AZAEiiht.js": {
|
|
190
190
|
"isEntry": false,
|
|
191
191
|
"imports": [
|
|
192
|
-
"chunks/local-community-
|
|
192
|
+
"chunks/local-community-DRm3r1-Y.js"
|
|
193
193
|
],
|
|
194
194
|
"dynamicImports": [],
|
|
195
195
|
"inputs": []
|
|
196
196
|
},
|
|
197
|
-
"chunks/local-community-
|
|
197
|
+
"chunks/local-community-DRm3r1-Y.js": {
|
|
198
198
|
"isEntry": false,
|
|
199
199
|
"imports": [
|
|
200
200
|
"chunks/chunk-2rV9d50f.js",
|
|
201
|
-
"chunks/rpc-local-community-
|
|
202
|
-
"chunks/schema-
|
|
201
|
+
"chunks/rpc-local-community-0XmKyOdO.js",
|
|
202
|
+
"chunks/schema-BUUhufdT.js",
|
|
203
203
|
"node:crypto",
|
|
204
204
|
"node:url",
|
|
205
205
|
"node:path",
|
|
@@ -255,13 +255,13 @@
|
|
|
255
255
|
"dist/node/runtime/node/community/local-community.js"
|
|
256
256
|
]
|
|
257
257
|
},
|
|
258
|
-
"chunks/node-
|
|
258
|
+
"chunks/node-B1J8psGZ.js": {
|
|
259
259
|
"isEntry": false,
|
|
260
260
|
"imports": [
|
|
261
261
|
"chunks/chunk-2rV9d50f.js",
|
|
262
|
-
"chunks/rpc-local-community-
|
|
263
|
-
"chunks/schema-
|
|
264
|
-
"chunks/util-
|
|
262
|
+
"chunks/rpc-local-community-0XmKyOdO.js",
|
|
263
|
+
"chunks/schema-BUUhufdT.js",
|
|
264
|
+
"chunks/util-Cct7-RT3.js",
|
|
265
265
|
"path",
|
|
266
266
|
"assert",
|
|
267
267
|
"fs",
|
|
@@ -272,8 +272,8 @@
|
|
|
272
272
|
"rpc-websockets"
|
|
273
273
|
],
|
|
274
274
|
"dynamicImports": [
|
|
275
|
-
"chunks/helia-for-pkc-
|
|
276
|
-
"chunks/local-community-
|
|
275
|
+
"chunks/helia-for-pkc-CQY3-UYD.js",
|
|
276
|
+
"chunks/local-community-DRm3r1-Y.js"
|
|
277
277
|
],
|
|
278
278
|
"inputs": [
|
|
279
279
|
"node_modules/zod/v4/locales/en.js",
|
|
@@ -315,11 +315,11 @@
|
|
|
315
315
|
"dist/node/index.js"
|
|
316
316
|
]
|
|
317
317
|
},
|
|
318
|
-
"chunks/rpc-local-community-
|
|
318
|
+
"chunks/rpc-local-community-0XmKyOdO.js": {
|
|
319
319
|
"isEntry": false,
|
|
320
320
|
"imports": [
|
|
321
321
|
"chunks/chunk-2rV9d50f.js",
|
|
322
|
-
"chunks/schema-
|
|
322
|
+
"chunks/schema-BUUhufdT.js",
|
|
323
323
|
"chunks/src-CYIMjhjK.js",
|
|
324
324
|
"node:crypto",
|
|
325
325
|
"node:url",
|
|
@@ -732,6 +732,7 @@
|
|
|
732
732
|
"node_modules/remeda/dist/withPrecision-CqXhgRqZ.js",
|
|
733
733
|
"node_modules/remeda/dist/round.js",
|
|
734
734
|
"node_modules/remeda/dist/stringToPath.js",
|
|
735
|
+
"dist/node/publications/comment/crosspost-depth.js",
|
|
735
736
|
"dist/node/clients/rpc-client/schema.js",
|
|
736
737
|
"dist/node/rpc/src/schema.js",
|
|
737
738
|
"dist/node/schema/schema-util.js",
|
|
@@ -785,6 +786,7 @@
|
|
|
785
786
|
"dist/node/pages/pages-clients.js",
|
|
786
787
|
"dist/node/pages/pages-client-manager.js",
|
|
787
788
|
"dist/node/pages/schema-util.js",
|
|
789
|
+
"dist/node/publications/comment/crosspost-runtime.js",
|
|
788
790
|
"dist/node/pages/pages.js",
|
|
789
791
|
"dist/node/pages/util.js",
|
|
790
792
|
"dist/node/publications/comment/comment-clients.js",
|
|
@@ -870,7 +872,7 @@
|
|
|
870
872
|
"dist/node/community/rpc-local-community.js"
|
|
871
873
|
]
|
|
872
874
|
},
|
|
873
|
-
"chunks/schema-
|
|
875
|
+
"chunks/schema-BUUhufdT.js": {
|
|
874
876
|
"isEntry": false,
|
|
875
877
|
"imports": [
|
|
876
878
|
"chunks/chunk-2rV9d50f.js",
|
|
@@ -1323,10 +1325,10 @@
|
|
|
1323
1325
|
"node_modules/kubo-rpc-client/dist/src/index.js"
|
|
1324
1326
|
]
|
|
1325
1327
|
},
|
|
1326
|
-
"chunks/util-
|
|
1328
|
+
"chunks/util-Cct7-RT3.js": {
|
|
1327
1329
|
"isEntry": false,
|
|
1328
1330
|
"imports": [
|
|
1329
|
-
"chunks/schema-
|
|
1331
|
+
"chunks/schema-BUUhufdT.js",
|
|
1330
1332
|
"ipns/selector",
|
|
1331
1333
|
"uint8arrays/equals"
|
|
1332
1334
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, br as logger_default, vr as PKCError } from "./schema-
|
|
3
|
-
import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-
|
|
2
|
+
import { L as hideClassPrivateProps, R as ipnsNameToIpnsOverPubsubTopic, br as logger_default, vr as PKCError } from "./schema-BUUhufdT.js";
|
|
3
|
+
import { a as fetchBlockWithStalledSessionFailover, i as directFetchIpnsRecordFromProviders, n as cacheIpnsRecordInPubsubLocalStore, o as getHeliaDebugContext, r as connectToPubsubPeers, s as selectBitswapSessionSeedPeers } from "./util-Cct7-RT3.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,2 +1,2 @@
|
|
|
1
|
-
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-
|
|
1
|
+
import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-DRm3r1-Y.js";
|
|
2
2
|
export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as pubsubTopicToDhtKey, $n as n$3, An as CommentsTableRowSchema, At as trackStartedCommunity, Bn as CommentEditsTableRowSchema, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dn as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nr as ZodError, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as t$8, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditReservedFields, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, W as isLinkOfAnimatedImage, Wn as AuthorReservedFields, Y as isLinkValid, Zn as n$4, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r$1, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageReservedFields, br as logger_default, bt as findCommunityInRegistry, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, er as t$7, fr as require_retry, gn as VoteTablesRowSchema, ht as statMfsPathSafely, in as CommunitySignedPropertyNames, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$5, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mn as VotePubsubReservedFields, mt as sleepUntilTimeoutOrAbort, nr as e, nt as removeBlocksFromKuboNode, or as t$4, pn as VotePubsubMessagePublicationSchema, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as t$6, u as DecryptedChallengeRequestPublicationSchema, ur as t$3, vr as PKCError, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, yt as writeKuboFilesWithTimeout } from "./schema-
|
|
3
|
-
import { $n as
|
|
2
|
+
import { $ as pubsubTopicToDhtKey, $n as n$3, An as CommentsTableRowSchema, At as trackStartedCommunity, Bn as CommentEditsTableRowSchema, Bt as CommunityEditPublicationPubsubReservedFields, C as contentContainsMarkdownAudio, Ct as findUpdatingCommunity, Dn as CommentUpdateSchema, F as getIpnsRecordInLocalKuboNode, Ft as untrackUpdatingCommunity, G as isLinkOfAudio, Gt as CommentModerationPubsubMessagePublicationSchema, In as CommentEditPubsubMessagePublicationSchema, It as require_sha256, J as isLinkOfVideo, Jt as CommentModerationsTableRowSchema, K as isLinkOfImage, Kt as CommentModerationReservedFields, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, M as genToArray, Mt as trackUpdatingCommunity, N as getEquivalentCommunityAddresses, Nr as ZodError, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, P as getErrorCodeFromMessage, Q as isStringDomain, Qn as t$8, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditReservedFields, S as calculateStringSizeSameAsIpfsAddCidV0, T as contentContainsMarkdownVideos, W as isLinkOfAnimatedImage, Wn as AuthorReservedFields, Y as isLinkValid, Zn as n$4, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r$1, at as removeNullUndefinedValues, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageReservedFields, br as logger_default, bt as findCommunityInRegistry, d as DecryptedChallengeRequestSchema, dt as retryKuboIpfsAddAndProvide, er as t$7, fr as require_retry, gn as VoteTablesRowSchema, ht as statMfsPathSafely, in as CommunitySignedPropertyNames, k as doesDomainAddressHaveCapitalLetter, kn as CommentUpdateTableRowSchema, kt as syncCommunityRegistryEntry, lr as t$5, lt as retryKuboBlockPutPinAndProvidePubsubTopic, mn as VotePubsubReservedFields, mt as sleepUntilTimeoutOrAbort, nr as e, nt as removeBlocksFromKuboNode, or as t$4, pn as VotePubsubMessagePublicationSchema, q as isLinkOfMedia, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, rt as removeMfsFilesSafely, s as ChallengeVerificationMessageSchema, t as ChallengeAnswerMessageSchema, tr as t$6, u as DecryptedChallengeRequestPublicationSchema, ur as t$3, vr as PKCError, w as contentContainsMarkdownImages, x as calculateIpfsCidV0, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, yt as writeKuboFilesWithTimeout } from "./schema-BUUhufdT.js";
|
|
3
|
+
import { $n as crosspostChainDepthUpTo, $t as createSchemaRowParser, A as deriveDbReplies, At as verifyCommentModeration, C as backupCommunityDb, D as deleteOldCommunityInWindows, Et as verifyChallengeRequest, Ft as verifyVote, G as TIMEFRAMES_TO_SECONDS, H as POSTS_SORT_TYPES, It as buildRuntimeAuthor, Kt as decode, L as moveCommunityDbToDeletedDirectory, Lt as cleanWireAuthor, Mt as verifyCommentUpdate, N as getThumbnailPropsOfLink, Nt as verifyCommunity, O as deriveCommentIpfsFromCommentTableRow, Ot as verifyCommentEdit, P as importSignerIntoKuboNode, Pt as verifyCommunityEdit, Qt as getPublicKeyFromPrivateKey, R as resolveDbPostsCidRefs, S as BackupAbortError, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, T as calculateInlineRepliesBudget, Tn as parseJsonWithPKCErrorIfFails, U as POST_REPLIES_SORT_TYPES, Ut as getCommunityNameFromWire, W as REPLY_REPLIES_SORT_TYPES, Wt as getCommunityPublicKeyFromWire, X as iterateOverPageCidsToFindAllCids, Xt as getPKCAddressFromPublicKey, Yt as getIpfsKeyFromPrivateKey, Zt as getPKCAddressFromPublicKeySync, _t as signCommentEdit, a as pkcJsChallenges, ar as n$6, bt as signCommentUpdateForChallengeVerification, cr as t$10, ct as pLimit, dr as require_lodash_merge, dt as cleanUpBeforePublishing, er as effectiveMaxCrosspostDepth, fn as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, gt as signComment, h as SignerWithPublicKeyAddress, ht as signChallengeVerification, i as getCommunityChallengeFromCommunityChallengeSettings, ir as t$11, j as getDefaultCommunityDbConfig, jt as verifyCommentPubsubMessage, k as deriveDbPosts, kt as verifyCommentIpfs, l as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, lr as stringify, nr as t$12, o as TrackedInstanceRegistry, or as n$5, pt as signChallengeMessage, qt as encode, r as getChallengeVerification, rr as r$2, s as LRUCache, t as RpcLocalCommunity, tr as t$9, u as KeyvBetterSqlite3, un as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ur as STORAGE_KEYS, w as calculateExpectedSignatureSize, wt as verifyChallengeAnswer, x as encryptEd25519AesGcmPublicKeyBuffer, xt as signCommunity, y as decryptEd25519AesGcmPublicKeyBuffer, yt as signCommentUpdate, zt as getAuthorNameFromWire } from "./rpc-local-community-0XmKyOdO.js";
|
|
4
4
|
import { randomFillSync, randomUUID } from "node:crypto";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import path from "node:path";
|
|
@@ -1304,6 +1304,11 @@ async function checkCommentPublication(community, request) {
|
|
|
1304
1304
|
const parentsOfComment = community._dbHandler.queryParentsCids({ parentCid: commentPublication.parentCid });
|
|
1305
1305
|
if (parentsOfComment[parentsOfComment.length - 1].cid !== commentPublication.postCid) return messages.ERR_REPLY_POST_CID_IS_NOT_PARENT_OF_REPLY;
|
|
1306
1306
|
}
|
|
1307
|
+
if (commentPublication.crosspost) {
|
|
1308
|
+
if (community.features?.noCrossposts) return messages.ERR_NOT_ALLOWED_TO_PUBLISH_CROSSPOSTS;
|
|
1309
|
+
const maxDepth = effectiveMaxCrosspostDepth(community.features?.maxCrosspostDepth);
|
|
1310
|
+
if (crosspostChainDepthUpTo(commentPublication, maxDepth + 1) > maxDepth) return messages.ERR_CROSSPOST_CHAIN_EXCEEDS_COMMUNITY_MAX_DEPTH;
|
|
1311
|
+
}
|
|
1307
1312
|
if (commentPublication.quotedCids && commentPublication.quotedCids.length > 0) {
|
|
1308
1313
|
if (!commentPublication.parentCid) return messages.ERR_POST_CANNOT_HAVE_QUOTED_CIDS;
|
|
1309
1314
|
const threadPostCid = commentPublication.postCid;
|
|
@@ -3336,6 +3341,7 @@ var DbHandler = class {
|
|
|
3336
3341
|
nsfw INTEGER NULLABLE, -- BOOLEAN (0/1)
|
|
3337
3342
|
pseudonymityMode TEXT NULLABLE,
|
|
3338
3343
|
quotedCids TEXT NULLABLE, -- JSON array
|
|
3344
|
+
crosspost TEXT NULLABLE, -- JSON: {cid, comment} of the comment this one reposts, stored verbatim so the embedded record keeps reproducing its cid
|
|
3339
3345
|
extraProps TEXT NULLABLE, -- JSON
|
|
3340
3346
|
challengeCommentUpdate TEXT NULLABLE, -- JSON: challenge-supplied partial CommentUpdate seeded into queryCalculatedCommentUpdate with lowest priority
|
|
3341
3347
|
protocolVersion TEXT NOT NULL,
|
|
@@ -3862,8 +3868,8 @@ var DbHandler = class {
|
|
|
3862
3868
|
const columnNames = this._getColumnNames(TABLES.COMMENTS);
|
|
3863
3869
|
const stmt = this._db.prepare(`
|
|
3864
3870
|
INSERT INTO ${TABLES.COMMENTS}
|
|
3865
|
-
(cid, authorSignerAddress, author, link, linkWidth, linkHeight, thumbnailUrl, thumbnailUrlWidth, thumbnailUrlHeight, parentCid, postCid, previousCid, communityPublicKey, communityName, content, timestamp, signature, originalCommentSignatureEncoded, title, depth, linkHtmlTagName, flairs, spoiler, pendingApproval, number, postNumber, nsfw, pseudonymityMode, quotedCids, extraProps, challengeCommentUpdate, protocolVersion, insertedAt)
|
|
3866
|
-
VALUES (@cid, @authorSignerAddress, @author, @link, @linkWidth, @linkHeight, @thumbnailUrl, @thumbnailUrlWidth, @thumbnailUrlHeight, @parentCid, @postCid, @previousCid, @communityPublicKey, @communityName, @content, @timestamp, @signature, @originalCommentSignatureEncoded, @title, @depth, @linkHtmlTagName, @flairs, @spoiler, @pendingApproval, @number, @postNumber, @nsfw, @pseudonymityMode, @quotedCids, @extraProps, @challengeCommentUpdate, @protocolVersion, @insertedAt)
|
|
3871
|
+
(cid, authorSignerAddress, author, link, linkWidth, linkHeight, thumbnailUrl, thumbnailUrlWidth, thumbnailUrlHeight, parentCid, postCid, previousCid, communityPublicKey, communityName, content, timestamp, signature, originalCommentSignatureEncoded, title, depth, linkHtmlTagName, flairs, spoiler, pendingApproval, number, postNumber, nsfw, pseudonymityMode, quotedCids, crosspost, extraProps, challengeCommentUpdate, protocolVersion, insertedAt)
|
|
3872
|
+
VALUES (@cid, @authorSignerAddress, @author, @link, @linkWidth, @linkHeight, @thumbnailUrl, @thumbnailUrlWidth, @thumbnailUrlHeight, @parentCid, @postCid, @previousCid, @communityPublicKey, @communityName, @content, @timestamp, @signature, @originalCommentSignatureEncoded, @title, @depth, @linkHtmlTagName, @flairs, @spoiler, @pendingApproval, @number, @postNumber, @nsfw, @pseudonymityMode, @quotedCids, @crosspost, @extraProps, @challengeCommentUpdate, @protocolVersion, @insertedAt)
|
|
3867
3873
|
`);
|
|
3868
3874
|
const defaults = t$7(columnNames, (column) => [column, null]);
|
|
3869
3875
|
this._db.transaction((items) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $n as n$1, B as isIpfsCid, Cr as setErrorMap, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dt as refreshTrackedCommentAliases, E as createAbortError, Et as listUpdatingCommunities, Fr as parsedType, H as isIpns, Ir as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Pr as joinValues, Pt as untrackUpdatingComment, Q as isStringDomain, Qt as CommunityAnchorSchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, St as findUpdatingComment, Tt as listUpdatingComments, Zn as n$2, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r, b as areEquivalentCommunityAddresses, br as logger_default, ct as resolveWhenPredicateIsTrue, fr as require_retry, ft as shortifyAddress, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, ln as PubsubTopicSchema, mt as sleepUntilTimeoutOrAbort, nr as e, ot as removeUndefinedValuesRecursively, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as t$1, ut as retryKuboIpfsAdd, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSchema, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, z as isAbortError } from "./schema-
|
|
3
|
-
import { $ as
|
|
4
|
-
import { o as getHeliaDebugContext } from "./util-
|
|
2
|
+
import { $n as n$1, B as isIpfsCid, Cr as setErrorMap, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dt as refreshTrackedCommentAliases, E as createAbortError, Et as listUpdatingCommunities, Fr as parsedType, H as isIpns, Ir as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Pr as joinValues, Pt as untrackUpdatingComment, Q as isStringDomain, Qt as CommunityAnchorSchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, St as findUpdatingComment, Tt as listUpdatingComments, Zn as n$2, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r, b as areEquivalentCommunityAddresses, br as logger_default, ct as resolveWhenPredicateIsTrue, fr as require_retry, ft as shortifyAddress, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, ln as PubsubTopicSchema, mt as sleepUntilTimeoutOrAbort, nr as e, ot as removeUndefinedValuesRecursively, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as t$1, ut as retryKuboIpfsAdd, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSchema, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, z as isAbortError } from "./schema-BUUhufdT.js";
|
|
3
|
+
import { $ as applyNameResolvedCacheToCrosspost, At as verifyCommentModeration, B as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Bn as RpcExportCommunityModLogsParamSchema, Bt as normalizeCreatePublicationAuthor, Cn as parseDecryptedChallengeVerification, Ct as signVote, Dn as parseRpcCommentEventWithPKCErrorIfItFails, Dt as verifyChallengeVerification, E as createKuboRpcClient, En as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, F as listCommunitiesSync, Fn as RpcCidParamSchema, Ft as verifyVote, Gn as RpcFetchCidResultSchema, Gt as normalizeCommunityInputFromCommunity, Hn as RpcExportCommunityParamSchema, Ht as getCommunityAddressFromRecord, I as monitorCommunitiesDirectory, In as RpcCommentRepliesPageParamSchema, It as buildRuntimeAuthor, J as extractCommunityRuntimeFieldsFromParsedPages, Jn as RpcPublishedAnchorRecordResultSchema, Jt as getBufferedPKCAddressFromPublicKey, Kn as RpcPublishAnchorRecordParamSchema, Kt as decode, Ln as RpcCommunityIdentifierParamSchema, Lt as cleanWireAuthor, M as getDefaultDataPath, Mn as RpcAnchorPublishPreparationResultSchema, Mt as verifyCommentUpdate, Nn as RpcAuthorNameParamSchema, On as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Ot as verifyCommentEdit, Pn as RpcCancelExportParamSchema, Pt as verifyCommunityEdit, Q as RepliesPages, Qn as RpcUnsubscribeParamSchema, Rn as RpcCommunityPageParamSchema, Rt as getAuthorNameFromRuntime, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, St as signCommunityEdit, Tn as parseJsonWithPKCErrorIfFails, Tt as verifyChallengeMessage, Un as RpcExportCommunityResultSchema, Ut as getCommunityNameFromWire, V as CommentClientsManager, Vn as RpcExportCommunityModLogsResultSchema, Vt as buildRuntimeCommunityFields, Wn as RpcFetchCidParamSchema, Wt as getCommunityPublicKeyFromWire, Xn as RpcSubscriptionIdResultSchema, Y as findCommentInPageInstanceRecursively, Yn as RpcResolveAuthorNameResultSchema, Z as parseRawPages, Zn as RpcSuccessResultSchema, Zt as getPKCAddressFromPublicKeySync, _ as createAnchorIpnsRecord$1, _t as signCommentEdit, a as pkcJsChallenges, ar as n$3, at as PKCClientsManager, b as encryptEd25519AesGcm, bn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, c as RemoteCommunity, cn as parseCommunityAddressWithPKCErrorIfItFails, cr as t$5, d as decodeRpcChallengeAnswerPubsubMsg, dn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, dt as cleanUpBeforePublishing, en as parseCidStringSchemaWithPKCErrorIfItFails, et as cloneCrosspostForRuntime, f as decodeRpcChallengePubsubMsg, fr as nativeFunctions$2, ft as signChallengeAnswer, g as createSigner, gn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, gt as signComment, hn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, in as parseCommentIpfsSchemaWithPKCErrorIfItFails, ir as t$3, it as PublicationClientsManager, jn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, jt as verifyCommentPubsubMessage, kn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, kt as verifyCommentIpfs, lt as PKCTypedEmitter, m as decodeRpcChallengeVerificationPubsubMsg, mn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, mt as signChallengeRequest, n as RpcRemoteCommunity, o as TrackedInstanceRegistry, on as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, ot as InflightFetchManager, p as decodeRpcChallengeRequestPubsubMsg, pn as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, pr as require_undici, qn as RpcPublishChallengeAnswersParamSchema, rn as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, rt as stripNameResolvedFromCrosspost, s as LRUCache, sn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, sr as t$2, t as RpcLocalCommunity, tr as t$4, tt as collectCrosspostAuthorsToResolve, u as KeyvBetterSqlite3, ut as require_lib$1, v as decryptEd25519AesGcm, vt as signCommentModeration, wn as parseDecryptedChallengeWithPKCErrorIfItFails, xn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, yn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, z as setNativeFunctions$1, zn as RpcEditCommunityParamSchema } from "./rpc-local-community-0XmKyOdO.js";
|
|
4
|
+
import { o as getHeliaDebugContext } from "./util-Cct7-RT3.js";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import fs from "fs";
|
|
@@ -637,17 +637,24 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
637
637
|
if (cachedCommunity) {
|
|
638
638
|
if (!this._pkc._memCaches.communityForPublishing.has(this.communityAddress)) {
|
|
639
639
|
log("The cache of community is stale, we will use the cached and update in the background");
|
|
640
|
-
this._pkc.getCommunity({
|
|
640
|
+
const refresh = this._pkc.getCommunity({
|
|
641
641
|
publicKey: this.communityPublicKey,
|
|
642
642
|
name: this.communityName
|
|
643
|
-
}).catch((e) => log.error("Failed to update cache of community", this.communityAddress, e))
|
|
643
|
+
}).catch((e) => log.error("Failed to update cache of community", this.communityAddress, e)).finally(() => {
|
|
644
|
+
if (this._backgroundCommunityRefresh === refresh) this._backgroundCommunityRefresh = void 0;
|
|
645
|
+
});
|
|
646
|
+
this._backgroundCommunityRefresh = refresh;
|
|
644
647
|
}
|
|
645
648
|
return cachedCommunity;
|
|
646
649
|
} else return this._clientsManager.fetchCommunityForPublishingWithCacheGuard();
|
|
647
650
|
}
|
|
648
651
|
async stop() {
|
|
649
|
-
|
|
650
|
-
|
|
652
|
+
try {
|
|
653
|
+
await this._postSucessOrFailurePublishing();
|
|
654
|
+
} finally {
|
|
655
|
+
if (this._backgroundCommunityRefresh) await this._backgroundCommunityRefresh;
|
|
656
|
+
this._updatePublishingStateWithEmission("stopped");
|
|
657
|
+
}
|
|
651
658
|
}
|
|
652
659
|
_isAllAttemptsExhausted(maxNumOfChallengeExchanges) {
|
|
653
660
|
if (Object.keys(this._challengeExchanges).length !== maxNumOfChallengeExchanges) return false;
|
|
@@ -656,8 +663,26 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
656
663
|
return typeof exchange.challengeRequestPublishTimestamp === "number" && exchange.challengeRequestPublishTimestamp + this._setProviderFailureThresholdSeconds <= timestamp();
|
|
657
664
|
});
|
|
658
665
|
}
|
|
666
|
+
async _abandonProviderIfStoppedWhileSubscribing(providerUrl) {
|
|
667
|
+
if (!this._pkc.destroyed && this.state !== "stopped") return false;
|
|
668
|
+
const log = logger_default("pkc-js:publication:publish:_abandonProviderIfStoppedWhileSubscribing");
|
|
669
|
+
log("Publication was stopped while subscribing to pubsub, will not publish a challenge request", providerUrl);
|
|
670
|
+
try {
|
|
671
|
+
await this._clientsManager.pubsubUnsubscribeOnProvider(this._communityChallengePubsubExchangeTopic(), providerUrl, this._handleChallengeExchange);
|
|
672
|
+
} catch (e) {
|
|
673
|
+
log.error("Failed to undo the pubsub subscription that resolved after being stopped", providerUrl, e);
|
|
674
|
+
}
|
|
675
|
+
this._updatePubsubState("stopped", providerUrl);
|
|
676
|
+
return true;
|
|
677
|
+
}
|
|
678
|
+
_unregisterFromPkcOncePublishWorkSettles() {
|
|
679
|
+
const refresh = this._backgroundCommunityRefresh;
|
|
680
|
+
if (refresh) refresh.finally(() => this._pkc._publishingPublications.delete(this));
|
|
681
|
+
else this._pkc._publishingPublications.delete(this);
|
|
682
|
+
}
|
|
659
683
|
async _postSucessOrFailurePublishing() {
|
|
660
684
|
const log = logger_default("pkc-js:publication:_postSucessOrFailurePublishing");
|
|
685
|
+
this._unregisterFromPkcOncePublishWorkSettles();
|
|
661
686
|
this._setStateWithEmission("stopped");
|
|
662
687
|
if (this._rpcPublishSubscriptionId) {
|
|
663
688
|
try {
|
|
@@ -877,6 +902,7 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
877
902
|
this._updatePubsubState("subscribing-pubsub", providerUrl);
|
|
878
903
|
try {
|
|
879
904
|
await this._clientsManager.pubsubSubscribeOnProvider(this._communityChallengePubsubExchangeTopic(), this._handleChallengeExchange, providerUrl);
|
|
905
|
+
if (await this._abandonProviderIfStoppedWhileSubscribing(providerUrl)) return;
|
|
880
906
|
this._updatePubsubState("publishing-challenge-request", providerUrl);
|
|
881
907
|
await this._clientsManager.pubsubPublishOnProvider(this._communityChallengePubsubExchangeTopic(), challengeRequest, providerUrl);
|
|
882
908
|
this._challengeExchanges[challengeRequest.challengeRequestId.toString()].challengeRequestPublishTimestamp = timestamp();
|
|
@@ -958,8 +984,17 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
958
984
|
});
|
|
959
985
|
}
|
|
960
986
|
async publish() {
|
|
961
|
-
const log = logger_default("pkc-js:publication:publish");
|
|
962
987
|
this._validatePublicationFields();
|
|
988
|
+
this._pkc._publishingPublications.add(this);
|
|
989
|
+
try {
|
|
990
|
+
return await this._publishAfterRegistering();
|
|
991
|
+
} catch (e) {
|
|
992
|
+
this._unregisterFromPkcOncePublishWorkSettles();
|
|
993
|
+
throw e;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
async _publishAfterRegistering() {
|
|
997
|
+
const log = logger_default("pkc-js:publication:publish");
|
|
963
998
|
this._setStateWithEmission("publishing");
|
|
964
999
|
await this._initCommunity();
|
|
965
1000
|
if (this.raw.unsignedPublicationOptions && !this.raw.pubsubMessageToPublish) await this._signPublicationWithCommunityFields();
|
|
@@ -998,6 +1033,7 @@ var Publication = class extends import_lib.TypedEmitter {
|
|
|
998
1033
|
this._updatePubsubState("subscribing-pubsub", providerUrl);
|
|
999
1034
|
try {
|
|
1000
1035
|
await this._clientsManager.pubsubSubscribeOnProvider(this._communityChallengePubsubExchangeTopic(), this._handleChallengeExchange, providerUrl);
|
|
1036
|
+
if (await this._abandonProviderIfStoppedWhileSubscribing(providerUrl)) return;
|
|
1001
1037
|
this._updatePubsubState("publishing-challenge-request", providerUrl);
|
|
1002
1038
|
await this._clientsManager.pubsubPublishOnProvider(this._communityChallengePubsubExchangeTopic(), challengeRequest, providerUrl);
|
|
1003
1039
|
this._challengeExchanges[challengeRequest.challengeRequestId.toString()].challengeRequestPublishTimestamp = timestamp();
|
|
@@ -1105,6 +1141,7 @@ var Comment = class extends Publication {
|
|
|
1105
1141
|
this.nsfw = o.nsfw;
|
|
1106
1142
|
this.flairs = o.flairs;
|
|
1107
1143
|
this.quotedCids = o.quotedCids;
|
|
1144
|
+
this.crosspost = o.crosspost ? cloneCrosspostForRuntime(o.crosspost) : void 0;
|
|
1108
1145
|
}
|
|
1109
1146
|
_initLocalProps(props) {
|
|
1110
1147
|
this._initPubsubMessageProps(props.comment);
|
|
@@ -1134,6 +1171,10 @@ var Comment = class extends Publication {
|
|
|
1134
1171
|
this._setAuthorNameResolvedFromCache();
|
|
1135
1172
|
}
|
|
1136
1173
|
_setAuthorNameResolvedFromCache() {
|
|
1174
|
+
if (this.crosspost) applyNameResolvedCacheToCrosspost({
|
|
1175
|
+
crosspost: this.crosspost,
|
|
1176
|
+
cache: this._pkc._memCaches.nameResolvedCache
|
|
1177
|
+
});
|
|
1137
1178
|
const domain = getAuthorNameFromRuntime(this.author);
|
|
1138
1179
|
if (!domain) return;
|
|
1139
1180
|
const cached = this._pkc._memCaches.nameResolvedCache.get((0, import_sha256.sha256)(domain + this.signature.publicKey));
|
|
@@ -1160,14 +1201,19 @@ var Comment = class extends Publication {
|
|
|
1160
1201
|
});
|
|
1161
1202
|
}
|
|
1162
1203
|
}
|
|
1163
|
-
|
|
1204
|
+
const crosspostAuthors = this.crosspost ? collectCrosspostAuthorsToResolve({ crosspost: this.crosspost }) : [];
|
|
1205
|
+
if (ownAuthor.length === 0 && replyAuthors.length === 0 && crosspostAuthors.length === 0) return;
|
|
1164
1206
|
const previousNameResolved = this.author.nameResolved;
|
|
1165
1207
|
const onResolved = () => {
|
|
1208
|
+
const crosspostChanged = this.crosspost ? applyNameResolvedCacheToCrosspost({
|
|
1209
|
+
crosspost: this.crosspost,
|
|
1210
|
+
cache: this._pkc._memCaches.nameResolvedCache
|
|
1211
|
+
}) : false;
|
|
1166
1212
|
this._setAuthorNameResolvedFromCache();
|
|
1167
1213
|
if (this.replies?.pages) {
|
|
1168
1214
|
for (const page of Object.values(this.replies.pages)) if (page) this.replies._applyNameResolvedCacheToPage(page);
|
|
1169
1215
|
}
|
|
1170
|
-
if (this.author.nameResolved !== previousNameResolved) this.emit("update", this);
|
|
1216
|
+
if (this.author.nameResolved !== previousNameResolved || crosspostChanged) this.emit("update", this);
|
|
1171
1217
|
};
|
|
1172
1218
|
const abortSignal = this._getStopAbortSignal();
|
|
1173
1219
|
if (ownAuthor.length > 0) this._clientsManager.resolveAuthorNamesInBackground({
|
|
@@ -1175,8 +1221,8 @@ var Comment = class extends Publication {
|
|
|
1175
1221
|
onResolved,
|
|
1176
1222
|
abortSignal
|
|
1177
1223
|
});
|
|
1178
|
-
if (replyAuthors.length > 0) this._pkc._clientsManager.resolveAuthorNamesInBackground({
|
|
1179
|
-
authors: replyAuthors,
|
|
1224
|
+
if (replyAuthors.length > 0 || crosspostAuthors.length > 0) this._pkc._clientsManager.resolveAuthorNamesInBackground({
|
|
1225
|
+
authors: [...replyAuthors, ...crosspostAuthors],
|
|
1180
1226
|
onResolved,
|
|
1181
1227
|
abortSignal
|
|
1182
1228
|
});
|
|
@@ -1194,6 +1240,7 @@ var Comment = class extends Publication {
|
|
|
1194
1240
|
this.title = props.title;
|
|
1195
1241
|
this.linkHtmlTagName = props.linkHtmlTagName;
|
|
1196
1242
|
this.quotedCids = props.quotedCids;
|
|
1243
|
+
this.crosspost = props.crosspost ? cloneCrosspostForRuntime(props.crosspost) : void 0;
|
|
1197
1244
|
if ("depth" in props && typeof props.depth === "number") {
|
|
1198
1245
|
this.depth = props.depth;
|
|
1199
1246
|
const postCid = props.postCid ? props.postCid : this.cid && this.depth === 0 ? this.cid : void 0;
|
|
@@ -6761,6 +6808,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
6761
6808
|
this._updatingCommunities = new TrackedInstanceRegistry();
|
|
6762
6809
|
this._updatingComments = new TrackedInstanceRegistry();
|
|
6763
6810
|
this._startedCommunities = new TrackedInstanceRegistry();
|
|
6811
|
+
this._publishingPublications = /* @__PURE__ */ new Set();
|
|
6764
6812
|
this.destroyed = false;
|
|
6765
6813
|
this._storageLRUs = {};
|
|
6766
6814
|
this._timeouts = {
|
|
@@ -6880,7 +6928,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
6880
6928
|
this.clients.libp2pJsClients = {};
|
|
6881
6929
|
if (!this.libp2pJsClientsOptions) return;
|
|
6882
6930
|
if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
|
|
6883
|
-
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-
|
|
6931
|
+
const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-CQY3-UYD.js");
|
|
6884
6932
|
for (const clientOptions of this.libp2pJsClientsOptions) {
|
|
6885
6933
|
const heliaNode = await createLibp2pJsClientOrUseExistingOne({
|
|
6886
6934
|
...clientOptions,
|
|
@@ -6980,6 +7028,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
6980
7028
|
}
|
|
6981
7029
|
if (e$1(cleanedAuthor)) cleanedAuthor = void 0;
|
|
6982
7030
|
}
|
|
7031
|
+
if ("crosspost" in finalOptions && finalOptions.crosspost) stripNameResolvedFromCrosspost(finalOptions.crosspost);
|
|
6983
7032
|
const filledTimestamp = typeof finalOptions.timestamp !== "number" ? timestamp() : finalOptions.timestamp;
|
|
6984
7033
|
const filledSigner = await this.createSigner(finalOptions.signer);
|
|
6985
7034
|
const filledProtocolVersion = finalOptions.protocolVersion || version_default.PROTOCOL_VERSION;
|
|
@@ -7028,6 +7077,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
7028
7077
|
if ("commentUpdateFromChallengeVerification" in options.raw && options.raw.commentUpdateFromChallengeVerification) commentInstance._initCommentUpdateFromChallengeVerificationProps(options.raw.commentUpdateFromChallengeVerification);
|
|
7029
7078
|
if (options.raw.commentUpdate) commentInstance._initCommentUpdate(options.raw.commentUpdate);
|
|
7030
7079
|
if (commentInstance.author?.nameResolved !== void 0) delete commentInstance.author.nameResolved;
|
|
7080
|
+
if (commentInstance.crosspost) stripNameResolvedFromCrosspost(commentInstance.crosspost);
|
|
7031
7081
|
return commentInstance;
|
|
7032
7082
|
}
|
|
7033
7083
|
async createComment(options) {
|
|
@@ -7046,6 +7096,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
7046
7096
|
if (!("signature" in options)) Object.assign(commentInstance, options);
|
|
7047
7097
|
else commentInstance._initIpfsProps(parseCommentIpfsSchemaWithPKCErrorIfItFails(commentIpfs));
|
|
7048
7098
|
if (commentInstance.author?.nameResolved !== void 0) delete commentInstance.author.nameResolved;
|
|
7099
|
+
if (commentInstance.crosspost) stripNameResolvedFromCrosspost(commentInstance.crosspost);
|
|
7049
7100
|
} else if ("signature" in options) {
|
|
7050
7101
|
const parsedOptions = parseCommentPubsubMessagePublicationWithPKCErrorIfItFails(options);
|
|
7051
7102
|
commentInstance._initPubsubMessageProps(parsedOptions);
|
|
@@ -7125,7 +7176,7 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
7125
7176
|
const log = logger_default("pkc-js:pkc:createLocalCommunity");
|
|
7126
7177
|
log.trace("Received community options to create a local community instance:", options);
|
|
7127
7178
|
if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
|
|
7128
|
-
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-
|
|
7179
|
+
const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-AZAEiiht.js");
|
|
7129
7180
|
const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
|
|
7130
7181
|
const community = new LocalCommunity(this);
|
|
7131
7182
|
if (isLocalCommunity) {
|
|
@@ -7499,6 +7550,8 @@ var PKC$1 = class extends PKCTypedEmitter {
|
|
|
7499
7550
|
}
|
|
7500
7551
|
}
|
|
7501
7552
|
if (exportDonePromises.length) await Promise.all(exportDonePromises);
|
|
7553
|
+
await Promise.all([...this._publishingPublications].map((publication) => publication.stop().catch((e) => log.error("Error stopping publication during destroy", e))));
|
|
7554
|
+
this._publishingPublications.clear();
|
|
7502
7555
|
for (const comment of listUpdatingComments(this)) await comment.stop();
|
|
7503
7556
|
for (const community of listUpdatingCommunities(this)) await community.stop();
|
|
7504
7557
|
await Promise.all(listStartedCommunities(this).map((community) => community.stop()));
|