@pkcprotocol/pkc-js 0.0.114 → 0.0.115

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 (143) hide show
  1. package/dist/browser/challenges.d.ts +1 -0
  2. package/dist/browser/challenges.js +1 -1
  3. package/dist/browser/challenges.js.map +1 -1
  4. package/dist/browser/clients/base-client-manager.js +25 -2
  5. package/dist/browser/clients/base-client-manager.js.map +1 -1
  6. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +2 -2
  7. package/dist/browser/clients/rpc-client/schema.d.ts +7 -7
  8. package/dist/browser/community/schema.d.ts +72 -72
  9. package/dist/browser/constants.d.ts +2 -1
  10. package/dist/browser/constants.js +3 -0
  11. package/dist/browser/constants.js.map +1 -1
  12. package/dist/browser/errors.d.ts +1 -0
  13. package/dist/browser/errors.js +1 -0
  14. package/dist/browser/errors.js.map +1 -1
  15. package/dist/browser/generated-version.d.ts +1 -1
  16. package/dist/browser/generated-version.js +1 -1
  17. package/dist/browser/index-with-compile-cache.d.ts +4 -4
  18. package/dist/browser/index.d.ts +8 -8
  19. package/dist/browser/page-sorts.d.ts +2 -0
  20. package/dist/browser/page-sorts.js +2 -0
  21. package/dist/browser/page-sorts.js.map +1 -0
  22. package/dist/browser/pages/schema.d.ts +17 -17
  23. package/dist/browser/pkc-error.d.ts +1 -1
  24. package/dist/browser/publications/comment/schema.d.ts +18 -18
  25. package/dist/browser/publications/comment-edit/schema.d.ts +5 -5
  26. package/dist/browser/publications/comment-moderation/schema.d.ts +4 -4
  27. package/dist/browser/publications/community-edit/schema.d.ts +4 -4
  28. package/dist/browser/pubsub-messages/schema.d.ts +9 -9
  29. package/dist/browser/rpc/src/index.d.ts +2 -0
  30. package/dist/browser/rpc/src/index.js +22 -0
  31. package/dist/browser/rpc/src/index.js.map +1 -1
  32. package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +4 -4
  33. package/dist/browser/rpc/src/lib/pkc-js/index.js +3 -1
  34. package/dist/browser/rpc/src/lib/pkc-js/index.js.map +1 -1
  35. package/dist/browser/rpc/src/schema.d.ts +30 -30
  36. package/dist/browser/runtime/node/community/db-handler.d.ts +6 -0
  37. package/dist/browser/runtime/node/community/db-handler.js +32 -0
  38. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  39. package/dist/browser/runtime/node/community/local-community/challenges.js +0 -2
  40. package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
  41. package/dist/browser/runtime/node/community/local-community/editing.d.ts +2 -1
  42. package/dist/browser/runtime/node/community/local-community/editing.js +10 -7
  43. package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
  44. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +3 -0
  45. package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  46. package/dist/browser/runtime/node/community/local-community/lifecycle.js +7 -3
  47. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  48. package/dist/browser/runtime/node/community/local-community/publication-store.js +23 -23
  49. package/dist/browser/runtime/node/community/local-community/publication-store.js.map +1 -1
  50. package/dist/browser/runtime/node/community/local-community/registry-sync.d.ts +7 -0
  51. package/dist/browser/runtime/node/community/local-community/registry-sync.js +80 -0
  52. package/dist/browser/runtime/node/community/local-community/registry-sync.js.map +1 -0
  53. package/dist/browser/runtime/node/community/local-community.d.ts +2 -1
  54. package/dist/browser/runtime/node/community/local-community.js +3 -0
  55. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  56. package/dist/browser/runtime/node/community/page-sorts/index.d.ts +9 -0
  57. package/dist/browser/runtime/node/community/page-sorts/index.js +64 -6
  58. package/dist/browser/runtime/node/community/page-sorts/index.js.map +1 -1
  59. package/dist/browser/schema/schema-util.d.ts +12 -12
  60. package/dist/browser/schema.d.ts +32 -32
  61. package/dist/browser/test/test-util.d.ts +30 -30
  62. package/dist/browser/validate-package-factories.d.ts +7 -0
  63. package/dist/browser/validate-package-factories.js +37 -0
  64. package/dist/browser/validate-package-factories.js.map +1 -0
  65. package/dist/bundled/bundle-manifest.json +80 -45
  66. package/dist/bundled/challenges.js +2 -1
  67. package/dist/bundled/chunks/{helia-for-pkc-hSpmyI9D.js → helia-for-pkc-BB8P6KYw.js} +2 -2
  68. package/dist/bundled/chunks/{local-community-EeQMdfYM.js → local-community-XrLSKipf.js} +135 -35
  69. package/dist/bundled/chunks/{local-community-Dc_fNPrx.js → local-community-wAvG_J_u.js} +1 -1
  70. package/dist/bundled/chunks/{node-apYZl3B3.js → node-D5riLTOu.js} +5 -5
  71. package/dist/bundled/chunks/page-sort-scoring-3svUUHW_.js +112 -0
  72. package/dist/bundled/chunks/{rpc-local-community-C_0FRCqg.js → rpc-local-community-D5ZdqFYc.js} +80 -124
  73. package/dist/bundled/chunks/{util-DFGl6QDd.js → util-CabVOL7E.js} +2 -1
  74. package/dist/bundled/chunks/{util-B2SuJZg-.js → util-Cnpgfqwn.js} +1 -1
  75. package/dist/bundled/chunks/validate-package-factories-CxIg67oP.js +41 -0
  76. package/dist/bundled/index.js +1 -1
  77. package/dist/bundled/page-sorts.js +2 -0
  78. package/dist/bundled/rpc/src/index.js +17 -4
  79. package/dist/node/challenges.d.ts +1 -0
  80. package/dist/node/challenges.js +1 -1
  81. package/dist/node/challenges.js.map +1 -1
  82. package/dist/node/clients/base-client-manager.js +25 -2
  83. package/dist/node/clients/base-client-manager.js.map +1 -1
  84. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +2 -2
  85. package/dist/node/clients/rpc-client/schema.d.ts +7 -7
  86. package/dist/node/community/schema.d.ts +72 -72
  87. package/dist/node/constants.d.ts +2 -1
  88. package/dist/node/constants.js +3 -0
  89. package/dist/node/constants.js.map +1 -1
  90. package/dist/node/errors.d.ts +1 -0
  91. package/dist/node/errors.js +1 -0
  92. package/dist/node/errors.js.map +1 -1
  93. package/dist/node/generated-version.d.ts +1 -1
  94. package/dist/node/generated-version.js +1 -1
  95. package/dist/node/index-with-compile-cache.d.ts +4 -4
  96. package/dist/node/index.d.ts +8 -8
  97. package/dist/node/page-sorts.d.ts +2 -0
  98. package/dist/node/page-sorts.js +2 -0
  99. package/dist/node/page-sorts.js.map +1 -0
  100. package/dist/node/pages/schema.d.ts +17 -17
  101. package/dist/node/pkc-error.d.ts +1 -1
  102. package/dist/node/publications/comment/schema.d.ts +18 -18
  103. package/dist/node/publications/comment-edit/schema.d.ts +5 -5
  104. package/dist/node/publications/comment-moderation/schema.d.ts +4 -4
  105. package/dist/node/publications/community-edit/schema.d.ts +4 -4
  106. package/dist/node/pubsub-messages/schema.d.ts +9 -9
  107. package/dist/node/rpc/src/index.d.ts +2 -0
  108. package/dist/node/rpc/src/index.js +22 -0
  109. package/dist/node/rpc/src/index.js.map +1 -1
  110. package/dist/node/rpc/src/lib/pkc-js/index.d.ts +4 -4
  111. package/dist/node/rpc/src/lib/pkc-js/index.js +3 -1
  112. package/dist/node/rpc/src/lib/pkc-js/index.js.map +1 -1
  113. package/dist/node/rpc/src/schema.d.ts +30 -30
  114. package/dist/node/runtime/node/community/db-handler.d.ts +6 -0
  115. package/dist/node/runtime/node/community/db-handler.js +32 -0
  116. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  117. package/dist/node/runtime/node/community/local-community/challenges.js +0 -2
  118. package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
  119. package/dist/node/runtime/node/community/local-community/editing.d.ts +2 -1
  120. package/dist/node/runtime/node/community/local-community/editing.js +10 -7
  121. package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
  122. package/dist/node/runtime/node/community/local-community/ipns-publishing.js +3 -0
  123. package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
  124. package/dist/node/runtime/node/community/local-community/lifecycle.js +7 -3
  125. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  126. package/dist/node/runtime/node/community/local-community/publication-store.js +23 -23
  127. package/dist/node/runtime/node/community/local-community/publication-store.js.map +1 -1
  128. package/dist/node/runtime/node/community/local-community/registry-sync.d.ts +7 -0
  129. package/dist/node/runtime/node/community/local-community/registry-sync.js +80 -0
  130. package/dist/node/runtime/node/community/local-community/registry-sync.js.map +1 -0
  131. package/dist/node/runtime/node/community/local-community.d.ts +2 -1
  132. package/dist/node/runtime/node/community/local-community.js +3 -0
  133. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  134. package/dist/node/runtime/node/community/page-sorts/index.d.ts +9 -0
  135. package/dist/node/runtime/node/community/page-sorts/index.js +64 -6
  136. package/dist/node/runtime/node/community/page-sorts/index.js.map +1 -1
  137. package/dist/node/schema/schema-util.d.ts +12 -12
  138. package/dist/node/schema.d.ts +32 -32
  139. package/dist/node/test/test-util.d.ts +30 -30
  140. package/dist/node/validate-package-factories.d.ts +7 -0
  141. package/dist/node/validate-package-factories.js +37 -0
  142. package/dist/node/validate-package-factories.js.map +1 -0
  143. package/package.json +6 -1
@@ -11,7 +11,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
11
11
  key: string;
12
12
  libp2pOptions?: (Partial<Omit<import("libp2p").Libp2pInit<import("@helia/libp2p").DefaultLibp2pServices> & {
13
13
  start?: boolean;
14
- } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "addresses" | "nodeInfo" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
14
+ } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "nodeInfo" | "addresses" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
15
15
  services?: Partial<import("libp2p").ServiceFactoryMap<import("@helia/libp2p").DefaultLibp2pServices> & import("libp2p").ServiceFactoryMap<import("@libp2p/interface").ServiceMap>> & Record<string, unknown>;
16
16
  }) | undefined;
17
17
  heliaOptions?: Partial<{
@@ -243,6 +243,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
243
243
  };
244
244
  protocolVersion: string;
245
245
  depth: number;
246
+ link?: string | undefined;
246
247
  flairs?: {
247
248
  [x: string]: unknown;
248
249
  text: string;
@@ -252,7 +253,6 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
252
253
  }[] | undefined;
253
254
  communityPublicKey?: string | undefined;
254
255
  communityName?: string | undefined;
255
- link?: string | undefined;
256
256
  spoiler?: boolean | undefined;
257
257
  nsfw?: boolean | undefined;
258
258
  content?: string | undefined;
@@ -312,6 +312,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
312
312
  };
313
313
  protocolVersion: string;
314
314
  depth: number;
315
+ link?: string | undefined;
315
316
  flairs?: {
316
317
  [x: string]: unknown;
317
318
  text: string;
@@ -321,7 +322,6 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
321
322
  }[] | undefined;
322
323
  communityPublicKey?: string | undefined;
323
324
  communityName?: string | undefined;
324
- link?: string | undefined;
325
325
  spoiler?: boolean | undefined;
326
326
  nsfw?: boolean | undefined;
327
327
  content?: string | undefined;
@@ -495,6 +495,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
495
495
  };
496
496
  protocolVersion: string;
497
497
  depth: number;
498
+ link?: string | undefined;
498
499
  flairs?: {
499
500
  [x: string]: unknown;
500
501
  text: string;
@@ -504,7 +505,6 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
504
505
  }[] | undefined;
505
506
  communityPublicKey?: string | undefined;
506
507
  communityName?: string | undefined;
507
- link?: string | undefined;
508
508
  spoiler?: boolean | undefined;
509
509
  nsfw?: boolean | undefined;
510
510
  content?: string | undefined;
@@ -684,6 +684,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
684
684
  };
685
685
  protocolVersion: string;
686
686
  depth: number;
687
+ link?: string | undefined;
687
688
  flairs?: {
688
689
  [x: string]: unknown;
689
690
  text: string;
@@ -693,7 +694,6 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
693
694
  }[] | undefined;
694
695
  communityPublicKey?: string | undefined;
695
696
  communityName?: string | undefined;
696
- link?: string | undefined;
697
697
  spoiler?: boolean | undefined;
698
698
  nsfw?: boolean | undefined;
699
699
  content?: string | undefined;
@@ -782,7 +782,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
782
782
  key: string;
783
783
  libp2pOptions?: (Partial<Omit<import("libp2p").Libp2pInit<import("@helia/libp2p").DefaultLibp2pServices> & {
784
784
  start?: boolean;
785
- } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "addresses" | "nodeInfo" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
785
+ } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "nodeInfo" | "addresses" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
786
786
  services?: Partial<import("libp2p").ServiceFactoryMap<import("@helia/libp2p").DefaultLibp2pServices> & import("libp2p").ServiceFactoryMap<import("@libp2p/interface").ServiceMap>> & Record<string, unknown>;
787
787
  }) | undefined;
788
788
  heliaOptions?: Partial<{
@@ -1014,6 +1014,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
1014
1014
  };
1015
1015
  protocolVersion: string;
1016
1016
  depth: number;
1017
+ link?: string | undefined;
1017
1018
  flairs?: {
1018
1019
  [x: string]: unknown;
1019
1020
  text: string;
@@ -1023,7 +1024,6 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
1023
1024
  }[] | undefined;
1024
1025
  communityPublicKey?: string | undefined;
1025
1026
  communityName?: string | undefined;
1026
- link?: string | undefined;
1027
1027
  spoiler?: boolean | undefined;
1028
1028
  nsfw?: boolean | undefined;
1029
1029
  content?: string | undefined;
@@ -1083,6 +1083,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
1083
1083
  };
1084
1084
  protocolVersion: string;
1085
1085
  depth: number;
1086
+ link?: string | undefined;
1086
1087
  flairs?: {
1087
1088
  [x: string]: unknown;
1088
1089
  text: string;
@@ -1092,7 +1093,6 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
1092
1093
  }[] | undefined;
1093
1094
  communityPublicKey?: string | undefined;
1094
1095
  communityName?: string | undefined;
1095
- link?: string | undefined;
1096
1096
  spoiler?: boolean | undefined;
1097
1097
  nsfw?: boolean | undefined;
1098
1098
  content?: string | undefined;
@@ -1266,6 +1266,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
1266
1266
  };
1267
1267
  protocolVersion: string;
1268
1268
  depth: number;
1269
+ link?: string | undefined;
1269
1270
  flairs?: {
1270
1271
  [x: string]: unknown;
1271
1272
  text: string;
@@ -1275,7 +1276,6 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
1275
1276
  }[] | undefined;
1276
1277
  communityPublicKey?: string | undefined;
1277
1278
  communityName?: string | undefined;
1278
- link?: string | undefined;
1279
1279
  spoiler?: boolean | undefined;
1280
1280
  nsfw?: boolean | undefined;
1281
1281
  content?: string | undefined;
@@ -1455,6 +1455,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
1455
1455
  };
1456
1456
  protocolVersion: string;
1457
1457
  depth: number;
1458
+ link?: string | undefined;
1458
1459
  flairs?: {
1459
1460
  [x: string]: unknown;
1460
1461
  text: string;
@@ -1464,7 +1465,6 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
1464
1465
  }[] | undefined;
1465
1466
  communityPublicKey?: string | undefined;
1466
1467
  communityName?: string | undefined;
1467
- link?: string | undefined;
1468
1468
  spoiler?: boolean | undefined;
1469
1469
  nsfw?: boolean | undefined;
1470
1470
  content?: string | undefined;
@@ -1566,11 +1566,11 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
1566
1566
  key: z.ZodString;
1567
1567
  libp2pOptions: z.ZodDefault<z.ZodCustom<Partial<Omit<import("libp2p").Libp2pInit<import("@helia/libp2p").DefaultLibp2pServices> & {
1568
1568
  start?: boolean;
1569
- } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "addresses" | "nodeInfo" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
1569
+ } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "nodeInfo" | "addresses" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
1570
1570
  services?: Partial<import("libp2p").ServiceFactoryMap<import("@helia/libp2p").DefaultLibp2pServices> & import("libp2p").ServiceFactoryMap<import("@libp2p/interface").ServiceMap>> & Record<string, unknown>;
1571
1571
  }, Partial<Omit<import("libp2p").Libp2pInit<import("@helia/libp2p").DefaultLibp2pServices> & {
1572
1572
  start?: boolean;
1573
- } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "addresses" | "nodeInfo" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
1573
+ } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "nodeInfo" | "addresses" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
1574
1574
  services?: Partial<import("libp2p").ServiceFactoryMap<import("@helia/libp2p").DefaultLibp2pServices> & import("libp2p").ServiceFactoryMap<import("@libp2p/interface").ServiceMap>> & Record<string, unknown>;
1575
1575
  }>>;
1576
1576
  heliaOptions: z.ZodDefault<z.ZodCustom<Partial<{
@@ -1991,6 +1991,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
1991
1991
  };
1992
1992
  protocolVersion: string;
1993
1993
  depth: number;
1994
+ link?: string | undefined;
1994
1995
  flairs?: {
1995
1996
  [x: string]: unknown;
1996
1997
  text: string;
@@ -2000,7 +2001,6 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2000
2001
  }[] | undefined;
2001
2002
  communityPublicKey?: string | undefined;
2002
2003
  communityName?: string | undefined;
2003
- link?: string | undefined;
2004
2004
  spoiler?: boolean | undefined;
2005
2005
  nsfw?: boolean | undefined;
2006
2006
  content?: string | undefined;
@@ -2060,6 +2060,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2060
2060
  };
2061
2061
  protocolVersion: string;
2062
2062
  depth: number;
2063
+ link?: string | undefined;
2063
2064
  flairs?: {
2064
2065
  [x: string]: unknown;
2065
2066
  text: string;
@@ -2069,7 +2070,6 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2069
2070
  }[] | undefined;
2070
2071
  communityPublicKey?: string | undefined;
2071
2072
  communityName?: string | undefined;
2072
- link?: string | undefined;
2073
2073
  spoiler?: boolean | undefined;
2074
2074
  nsfw?: boolean | undefined;
2075
2075
  content?: string | undefined;
@@ -2243,6 +2243,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2243
2243
  };
2244
2244
  protocolVersion: string;
2245
2245
  depth: number;
2246
+ link?: string | undefined;
2246
2247
  flairs?: {
2247
2248
  [x: string]: unknown;
2248
2249
  text: string;
@@ -2252,7 +2253,6 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2252
2253
  }[] | undefined;
2253
2254
  communityPublicKey?: string | undefined;
2254
2255
  communityName?: string | undefined;
2255
- link?: string | undefined;
2256
2256
  spoiler?: boolean | undefined;
2257
2257
  nsfw?: boolean | undefined;
2258
2258
  content?: string | undefined;
@@ -2432,6 +2432,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2432
2432
  };
2433
2433
  protocolVersion: string;
2434
2434
  depth: number;
2435
+ link?: string | undefined;
2435
2436
  flairs?: {
2436
2437
  [x: string]: unknown;
2437
2438
  text: string;
@@ -2441,7 +2442,6 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2441
2442
  }[] | undefined;
2442
2443
  communityPublicKey?: string | undefined;
2443
2444
  communityName?: string | undefined;
2444
- link?: string | undefined;
2445
2445
  spoiler?: boolean | undefined;
2446
2446
  nsfw?: boolean | undefined;
2447
2447
  content?: string | undefined;
@@ -2549,6 +2549,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2549
2549
  };
2550
2550
  protocolVersion: string;
2551
2551
  depth: number;
2552
+ link?: string | undefined;
2552
2553
  flairs?: {
2553
2554
  [x: string]: unknown;
2554
2555
  text: string;
@@ -2558,7 +2559,6 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2558
2559
  }[] | undefined;
2559
2560
  communityPublicKey?: string | undefined;
2560
2561
  communityName?: string | undefined;
2561
- link?: string | undefined;
2562
2562
  spoiler?: boolean | undefined;
2563
2563
  nsfw?: boolean | undefined;
2564
2564
  content?: string | undefined;
@@ -2618,6 +2618,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2618
2618
  };
2619
2619
  protocolVersion: string;
2620
2620
  depth: number;
2621
+ link?: string | undefined;
2621
2622
  flairs?: {
2622
2623
  [x: string]: unknown;
2623
2624
  text: string;
@@ -2627,7 +2628,6 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2627
2628
  }[] | undefined;
2628
2629
  communityPublicKey?: string | undefined;
2629
2630
  communityName?: string | undefined;
2630
- link?: string | undefined;
2631
2631
  spoiler?: boolean | undefined;
2632
2632
  nsfw?: boolean | undefined;
2633
2633
  content?: string | undefined;
@@ -2801,6 +2801,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2801
2801
  };
2802
2802
  protocolVersion: string;
2803
2803
  depth: number;
2804
+ link?: string | undefined;
2804
2805
  flairs?: {
2805
2806
  [x: string]: unknown;
2806
2807
  text: string;
@@ -2810,7 +2811,6 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2810
2811
  }[] | undefined;
2811
2812
  communityPublicKey?: string | undefined;
2812
2813
  communityName?: string | undefined;
2813
- link?: string | undefined;
2814
2814
  spoiler?: boolean | undefined;
2815
2815
  nsfw?: boolean | undefined;
2816
2816
  content?: string | undefined;
@@ -2990,6 +2990,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2990
2990
  };
2991
2991
  protocolVersion: string;
2992
2992
  depth: number;
2993
+ link?: string | undefined;
2993
2994
  flairs?: {
2994
2995
  [x: string]: unknown;
2995
2996
  text: string;
@@ -2999,7 +3000,6 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
2999
3000
  }[] | undefined;
3000
3001
  communityPublicKey?: string | undefined;
3001
3002
  communityName?: string | undefined;
3002
- link?: string | undefined;
3003
3003
  spoiler?: boolean | undefined;
3004
3004
  nsfw?: boolean | undefined;
3005
3005
  content?: string | undefined;
@@ -3087,11 +3087,11 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3087
3087
  key: z.ZodString;
3088
3088
  libp2pOptions: z.ZodDefault<z.ZodCustom<Partial<Omit<import("libp2p").Libp2pInit<import("@helia/libp2p").DefaultLibp2pServices> & {
3089
3089
  start?: boolean;
3090
- } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "addresses" | "nodeInfo" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
3090
+ } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "nodeInfo" | "addresses" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
3091
3091
  services?: Partial<import("libp2p").ServiceFactoryMap<import("@helia/libp2p").DefaultLibp2pServices> & import("libp2p").ServiceFactoryMap<import("@libp2p/interface").ServiceMap>> & Record<string, unknown>;
3092
3092
  }, Partial<Omit<import("libp2p").Libp2pInit<import("@helia/libp2p").DefaultLibp2pServices> & {
3093
3093
  start?: boolean;
3094
- } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "addresses" | "nodeInfo" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
3094
+ } & Required<Pick<import("libp2p").Libp2pOptions<import("@helia/libp2p").DefaultLibp2pServices>, "nodeInfo" | "addresses" | "transports" | "connectionEncrypters" | "streamMuxers" | "peerDiscovery" | "services">> & import("@helia/libp2p").CreateLibp2pOptions<import("@libp2p/interface").ServiceMap>, "services">> & {
3095
3095
  services?: Partial<import("libp2p").ServiceFactoryMap<import("@helia/libp2p").DefaultLibp2pServices> & import("libp2p").ServiceFactoryMap<import("@libp2p/interface").ServiceMap>> & Record<string, unknown>;
3096
3096
  }>>;
3097
3097
  heliaOptions: z.ZodDefault<z.ZodCustom<Partial<{
@@ -3512,6 +3512,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3512
3512
  };
3513
3513
  protocolVersion: string;
3514
3514
  depth: number;
3515
+ link?: string | undefined;
3515
3516
  flairs?: {
3516
3517
  [x: string]: unknown;
3517
3518
  text: string;
@@ -3521,7 +3522,6 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3521
3522
  }[] | undefined;
3522
3523
  communityPublicKey?: string | undefined;
3523
3524
  communityName?: string | undefined;
3524
- link?: string | undefined;
3525
3525
  spoiler?: boolean | undefined;
3526
3526
  nsfw?: boolean | undefined;
3527
3527
  content?: string | undefined;
@@ -3581,6 +3581,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3581
3581
  };
3582
3582
  protocolVersion: string;
3583
3583
  depth: number;
3584
+ link?: string | undefined;
3584
3585
  flairs?: {
3585
3586
  [x: string]: unknown;
3586
3587
  text: string;
@@ -3590,7 +3591,6 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3590
3591
  }[] | undefined;
3591
3592
  communityPublicKey?: string | undefined;
3592
3593
  communityName?: string | undefined;
3593
- link?: string | undefined;
3594
3594
  spoiler?: boolean | undefined;
3595
3595
  nsfw?: boolean | undefined;
3596
3596
  content?: string | undefined;
@@ -3764,6 +3764,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3764
3764
  };
3765
3765
  protocolVersion: string;
3766
3766
  depth: number;
3767
+ link?: string | undefined;
3767
3768
  flairs?: {
3768
3769
  [x: string]: unknown;
3769
3770
  text: string;
@@ -3773,7 +3774,6 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3773
3774
  }[] | undefined;
3774
3775
  communityPublicKey?: string | undefined;
3775
3776
  communityName?: string | undefined;
3776
- link?: string | undefined;
3777
3777
  spoiler?: boolean | undefined;
3778
3778
  nsfw?: boolean | undefined;
3779
3779
  content?: string | undefined;
@@ -3953,6 +3953,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3953
3953
  };
3954
3954
  protocolVersion: string;
3955
3955
  depth: number;
3956
+ link?: string | undefined;
3956
3957
  flairs?: {
3957
3958
  [x: string]: unknown;
3958
3959
  text: string;
@@ -3962,7 +3963,6 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
3962
3963
  }[] | undefined;
3963
3964
  communityPublicKey?: string | undefined;
3964
3965
  communityName?: string | undefined;
3965
- link?: string | undefined;
3966
3966
  spoiler?: boolean | undefined;
3967
3967
  nsfw?: boolean | undefined;
3968
3968
  content?: string | undefined;
@@ -4070,6 +4070,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
4070
4070
  };
4071
4071
  protocolVersion: string;
4072
4072
  depth: number;
4073
+ link?: string | undefined;
4073
4074
  flairs?: {
4074
4075
  [x: string]: unknown;
4075
4076
  text: string;
@@ -4079,7 +4080,6 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
4079
4080
  }[] | undefined;
4080
4081
  communityPublicKey?: string | undefined;
4081
4082
  communityName?: string | undefined;
4082
- link?: string | undefined;
4083
4083
  spoiler?: boolean | undefined;
4084
4084
  nsfw?: boolean | undefined;
4085
4085
  content?: string | undefined;
@@ -4139,6 +4139,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
4139
4139
  };
4140
4140
  protocolVersion: string;
4141
4141
  depth: number;
4142
+ link?: string | undefined;
4142
4143
  flairs?: {
4143
4144
  [x: string]: unknown;
4144
4145
  text: string;
@@ -4148,7 +4149,6 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
4148
4149
  }[] | undefined;
4149
4150
  communityPublicKey?: string | undefined;
4150
4151
  communityName?: string | undefined;
4151
- link?: string | undefined;
4152
4152
  spoiler?: boolean | undefined;
4153
4153
  nsfw?: boolean | undefined;
4154
4154
  content?: string | undefined;
@@ -4322,6 +4322,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
4322
4322
  };
4323
4323
  protocolVersion: string;
4324
4324
  depth: number;
4325
+ link?: string | undefined;
4325
4326
  flairs?: {
4326
4327
  [x: string]: unknown;
4327
4328
  text: string;
@@ -4331,7 +4332,6 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
4331
4332
  }[] | undefined;
4332
4333
  communityPublicKey?: string | undefined;
4333
4334
  communityName?: string | undefined;
4334
- link?: string | undefined;
4335
4335
  spoiler?: boolean | undefined;
4336
4336
  nsfw?: boolean | undefined;
4337
4337
  content?: string | undefined;
@@ -4511,6 +4511,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
4511
4511
  };
4512
4512
  protocolVersion: string;
4513
4513
  depth: number;
4514
+ link?: string | undefined;
4514
4515
  flairs?: {
4515
4516
  [x: string]: unknown;
4516
4517
  text: string;
@@ -4520,7 +4521,6 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
4520
4521
  }[] | undefined;
4521
4522
  communityPublicKey?: string | undefined;
4522
4523
  communityName?: string | undefined;
4523
- link?: string | undefined;
4524
4524
  spoiler?: boolean | undefined;
4525
4525
  nsfw?: boolean | undefined;
4526
4526
  content?: string | undefined;
@@ -21,6 +21,7 @@ export declare class DbHandler {
21
21
  _db: BetterSqlite3Database;
22
22
  private _community;
23
23
  private _transactionDepth;
24
+ private _transactionGeneration;
24
25
  private _dbConfig;
25
26
  private _keyv;
26
27
  private _createdTables;
@@ -48,6 +49,11 @@ export declare class DbHandler {
48
49
  keyvHas(key: string): boolean;
49
50
  destoryConnection(): void;
50
51
  createTransaction(): void;
52
+ private _guardAgainstTransactionAcrossAwait;
53
+ readBackWithoutStoring<T>(opts: {
54
+ write: () => void;
55
+ read: () => T;
56
+ }): T;
51
57
  commitTransaction(): void;
52
58
  rollbackTransaction(): void;
53
59
  rollbackAllTransactions(): Promise<void>;
@@ -48,6 +48,7 @@ function deriveAliasOriginalAuthorSignerAddress(originalAuthorPublicKey) {
48
48
  }
49
49
  export class DbHandler {
50
50
  constructor(community) {
51
+ this._transactionGeneration = 0;
51
52
  // Advanced by every write to the publication tables (comments, votes, edits, moderations, aliases, purges). The
52
53
  // update cycle's author memo (CommunityAuthorMemo) is only reused while it stays the same.
53
54
  this._publicationWriteGeneration = 0;
@@ -181,9 +182,40 @@ export class DbHandler {
181
182
  createTransaction() {
182
183
  if (this._transactionDepth === 0) {
183
184
  this._db.exec("BEGIN");
185
+ this._guardAgainstTransactionAcrossAwait();
184
186
  }
185
187
  this._transactionDepth++;
186
188
  }
189
+ // The connection and its transaction depth are shared by every challenge exchange and the update loop, so
190
+ // a transaction left open across an await is joined by every write that runs meanwhile, and its rollback
191
+ // discards those writes too (issue #417). Transactions must open and close in one synchronous run. An
192
+ // await always yields to the microtask queue, so a transaction still open when this microtask runs spans
193
+ // one. Under vitest it throws, so a test that reaches such a transaction fails.
194
+ _guardAgainstTransactionAcrossAwait() {
195
+ const transactionGeneration = ++this._transactionGeneration;
196
+ queueMicrotask(() => {
197
+ if (this._transactionDepth === 0 || this._transactionGeneration !== transactionGeneration)
198
+ return;
199
+ const error = new Error("A DB transaction was left open across an await. Transactions must open and close synchronously (issue #417)");
200
+ Logger("pkc-js:local-community:db-handler:createTransaction").error(error);
201
+ if (process.env["VITEST"])
202
+ throw error;
203
+ });
204
+ }
205
+ // Runs write and then read inside a savepoint that is always rolled back, so the caller gets a row exactly
206
+ // as SQLite stores it without storing it. This lets a check that has to await run on the stored form with
207
+ // no transaction open (issue #417).
208
+ readBackWithoutStoring(opts) {
209
+ this._db.exec("SAVEPOINT read_back_without_storing");
210
+ try {
211
+ opts.write();
212
+ return opts.read();
213
+ }
214
+ finally {
215
+ this._db.exec("ROLLBACK TO read_back_without_storing");
216
+ this._db.exec("RELEASE read_back_without_storing");
217
+ }
218
+ }
187
219
  commitTransaction() {
188
220
  if (this._transactionDepth > 0) {
189
221
  this._transactionDepth--;