@pkcprotocol/pkc-js 0.0.81 → 0.0.83

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 (128) hide show
  1. package/README.md +3 -1
  2. package/dist/browser/clients/base-client-manager.js +19 -1
  3. package/dist/browser/clients/base-client-manager.js.map +1 -1
  4. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +1 -0
  5. package/dist/browser/clients/rpc-client/schema.d.ts +3 -0
  6. package/dist/browser/community/schema.d.ts +24 -0
  7. package/dist/browser/community/schema.js +6 -1
  8. package/dist/browser/community/schema.js.map +1 -1
  9. package/dist/browser/errors.d.ts +10 -1
  10. package/dist/browser/errors.js +10 -1
  11. package/dist/browser/errors.js.map +1 -1
  12. package/dist/browser/generated-version.d.ts +1 -1
  13. package/dist/browser/generated-version.js +1 -1
  14. package/dist/browser/pages/pages.js +8 -0
  15. package/dist/browser/pages/pages.js.map +1 -1
  16. package/dist/browser/pages/schema.d.ts +4 -0
  17. package/dist/browser/pages/util.d.ts +2 -0
  18. package/dist/browser/pages/util.js +23 -3
  19. package/dist/browser/pages/util.js.map +1 -1
  20. package/dist/browser/pkc/pkc.d.ts +2 -0
  21. package/dist/browser/pkc/pkc.js +20 -0
  22. package/dist/browser/pkc/pkc.js.map +1 -1
  23. package/dist/browser/pkc-error.d.ts +1 -1
  24. package/dist/browser/publications/comment/comment-client-manager.js +22 -4
  25. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  26. package/dist/browser/publications/comment/comment.d.ts +2 -1
  27. package/dist/browser/publications/comment/comment.js +29 -6
  28. package/dist/browser/publications/comment/comment.js.map +1 -1
  29. package/dist/browser/publications/comment/crosspost-depth.d.ts +5 -0
  30. package/dist/browser/publications/comment/crosspost-depth.js +75 -0
  31. package/dist/browser/publications/comment/crosspost-depth.js.map +1 -0
  32. package/dist/browser/publications/comment/crosspost-runtime.d.ts +30 -0
  33. package/dist/browser/publications/comment/crosspost-runtime.js +133 -0
  34. package/dist/browser/publications/comment/crosspost-runtime.js.map +1 -0
  35. package/dist/browser/publications/comment/schema.d.ts +20 -2
  36. package/dist/browser/publications/comment/schema.js +21 -10
  37. package/dist/browser/publications/comment/schema.js.map +1 -1
  38. package/dist/browser/publications/comment/types.d.ts +10 -0
  39. package/dist/browser/publications/community-edit/schema.d.ts +4 -0
  40. package/dist/browser/publications/publication.d.ts +4 -0
  41. package/dist/browser/publications/publication.js +80 -5
  42. package/dist/browser/publications/publication.js.map +1 -1
  43. package/dist/browser/pubsub-messages/schema.d.ts +5 -0
  44. package/dist/browser/rpc/src/index.js +13 -1
  45. package/dist/browser/rpc/src/index.js.map +1 -1
  46. package/dist/browser/runtime/node/community/db-handler.d.ts +2 -0
  47. package/dist/browser/runtime/node/community/db-handler.js +24 -6
  48. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  49. package/dist/browser/runtime/node/community/local-community/publication-validation.js +15 -0
  50. package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
  51. package/dist/browser/runtime/node/community/page-generator.d.ts +2 -0
  52. package/dist/browser/schema/schema-util.d.ts +17 -0
  53. package/dist/browser/schema/schema-util.js +49 -5
  54. package/dist/browser/schema/schema-util.js.map +1 -1
  55. package/dist/browser/signer/signatures.d.ts +1 -10
  56. package/dist/browser/signer/signatures.js +83 -0
  57. package/dist/browser/signer/signatures.js.map +1 -1
  58. package/dist/browser/test/test-util.d.ts +6 -0
  59. package/dist/browser/version.js +1 -1
  60. package/dist/bundled/bundle-manifest.json +27 -25
  61. package/dist/bundled/chunks/{helia-for-pkc-BcNF-orO.js → helia-for-pkc-BtjQ8rfd.js} +33 -33
  62. package/dist/bundled/chunks/{local-community-B6-jaMsn.js → local-community-B_Yg8LQH.js} +1 -1
  63. package/dist/bundled/chunks/{local-community-CyX1HwD0.js → local-community-DJM47U8C.js} +47 -32
  64. package/dist/bundled/chunks/{node-BCXmIYLQ.js → node-lb4SvdBh.js} +67 -14
  65. package/dist/bundled/chunks/{rpc-local-community-BOiy8BX1.js → rpc-local-community-a464veDe.js} +253 -12
  66. package/dist/bundled/chunks/{schema-DZyEx0YQ.js → schema-mdv9_FG5.js} +23 -8
  67. package/dist/bundled/chunks/{util-BTPlI1yF.js → util-y9-A9BnM.js} +1 -1
  68. package/dist/bundled/index.js +1 -1
  69. package/dist/bundled/rpc/src/index.js +13 -5
  70. package/dist/node/clients/base-client-manager.js +19 -1
  71. package/dist/node/clients/base-client-manager.js.map +1 -1
  72. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +1 -0
  73. package/dist/node/clients/rpc-client/schema.d.ts +3 -0
  74. package/dist/node/community/schema.d.ts +24 -0
  75. package/dist/node/community/schema.js +6 -1
  76. package/dist/node/community/schema.js.map +1 -1
  77. package/dist/node/errors.d.ts +10 -1
  78. package/dist/node/errors.js +10 -1
  79. package/dist/node/errors.js.map +1 -1
  80. package/dist/node/generated-version.d.ts +1 -1
  81. package/dist/node/generated-version.js +1 -1
  82. package/dist/node/pages/pages.js +8 -0
  83. package/dist/node/pages/pages.js.map +1 -1
  84. package/dist/node/pages/schema.d.ts +4 -0
  85. package/dist/node/pages/util.d.ts +2 -0
  86. package/dist/node/pages/util.js +23 -3
  87. package/dist/node/pages/util.js.map +1 -1
  88. package/dist/node/pkc/pkc.d.ts +2 -0
  89. package/dist/node/pkc/pkc.js +20 -0
  90. package/dist/node/pkc/pkc.js.map +1 -1
  91. package/dist/node/pkc-error.d.ts +1 -1
  92. package/dist/node/publications/comment/comment-client-manager.js +22 -4
  93. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  94. package/dist/node/publications/comment/comment.d.ts +2 -1
  95. package/dist/node/publications/comment/comment.js +29 -6
  96. package/dist/node/publications/comment/comment.js.map +1 -1
  97. package/dist/node/publications/comment/crosspost-depth.d.ts +5 -0
  98. package/dist/node/publications/comment/crosspost-depth.js +75 -0
  99. package/dist/node/publications/comment/crosspost-depth.js.map +1 -0
  100. package/dist/node/publications/comment/crosspost-runtime.d.ts +30 -0
  101. package/dist/node/publications/comment/crosspost-runtime.js +133 -0
  102. package/dist/node/publications/comment/crosspost-runtime.js.map +1 -0
  103. package/dist/node/publications/comment/schema.d.ts +20 -2
  104. package/dist/node/publications/comment/schema.js +21 -10
  105. package/dist/node/publications/comment/schema.js.map +1 -1
  106. package/dist/node/publications/comment/types.d.ts +10 -0
  107. package/dist/node/publications/community-edit/schema.d.ts +4 -0
  108. package/dist/node/publications/publication.d.ts +4 -0
  109. package/dist/node/publications/publication.js +80 -5
  110. package/dist/node/publications/publication.js.map +1 -1
  111. package/dist/node/pubsub-messages/schema.d.ts +5 -0
  112. package/dist/node/rpc/src/index.js +13 -1
  113. package/dist/node/rpc/src/index.js.map +1 -1
  114. package/dist/node/runtime/node/community/db-handler.d.ts +2 -0
  115. package/dist/node/runtime/node/community/db-handler.js +24 -6
  116. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  117. package/dist/node/runtime/node/community/local-community/publication-validation.js +15 -0
  118. package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
  119. package/dist/node/runtime/node/community/page-generator.d.ts +2 -0
  120. package/dist/node/schema/schema-util.d.ts +17 -0
  121. package/dist/node/schema/schema-util.js +49 -5
  122. package/dist/node/schema/schema-util.js.map +1 -1
  123. package/dist/node/signer/signatures.d.ts +1 -10
  124. package/dist/node/signer/signatures.js +83 -0
  125. package/dist/node/signer/signatures.js.map +1 -1
  126. package/dist/node/test/test-util.d.ts +6 -0
  127. package/dist/node/version.js +1 -1
  128. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $n as n$9, $t as CommunityChallengeSettingSchema, A as extractNetworkErrorDetails, Ar as object, At as trackStartedCommunity, B as isIpfsCid, Cn as CommentUpdateChallengeReservedFieldNames, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dr as custom, E as createAbortError, En as CommentUpdateReservedFields, Er as boolean, Et as listUpdatingCommunities, Fn as CommentEditChallengeRequestToEncryptSchema, Ft as untrackUpdatingCommunity, Gn as ChallengeAnswersSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorAddressSchema, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, It as require_sha256$1, Jn as CommunityAddressSchema, Jt as CommentModerationsTableRowSchema, Kn as CidPathSchema, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Mn as GetPageParamSchema, Mr as string, Mt as trackUpdatingCommunity, Nn as ModQueuePageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateSignedPropertyNames, Or as literal, Ot as refreshTrackedCommunityAliases, Pn as PageIpfsSchema, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sn as CommentSignedPropertyNames, Sr as require_ms$1, St as findUpdatingComment, Tn as CommentUpdateForChallengeVerificationSignedPropertyNames, Tr as array, U as isIpnsPath, Un as AuthorCommentIpfsReservedFields, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as CreateCommentEditOptionsWithRefinementSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as CreateSignerSchema, Xt as ChallengeFileFactorySchema, Yn as CommunityAuthorChallengeReservedFieldNames, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as n$10, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentChallengeRequestToEncryptSchema, _r as FailedToFetchPageIpfsFromGatewaysError, _t as timestamp, an as CreateNewLocalCommunityUserOptionsSchema, ar as r$8, b as areEquivalentCommunityAddresses, br as logger_default, c as ChallengeVerificationMessageSignedPropertyNames, cn as ExportCommunityModLogsOptionsSchema, cr as r$7, ct as resolveWhenPredicateIsTrue, dn as CreateVoteUserOptionsWithRefinementSchema, dr as e$4, en as CommunityEditOptionsSchema, f as DecryptedChallengeSchema, fn as VoteChallengeRequestToEncryptSchema, fr as require_retry$1, ft as shortifyAddress, g as PKCParsedOptionsSchema, gr as FailedToFetchGenericIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hn as VoteSignedPropertyNames, hr as FailedToFetchCommunityFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CommunitySignedPropertyNames, ir as t$11, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as CreateCommentOptionsWithRefinementSchema, jr as record, k as doesDomainAddressHaveCapitalLetter, kr as number, l as DecryptedChallengeAnswerSchema, lr as t$10, m as NameResolveCacheOptionsSchema, mr as FailedToFetchCommentUpdateFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsReservedFields, nr as e$6, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRemoteCommunityFunctionArgumentSchema, or as t$12, p as DecryptedChallengeVerificationSchema, pn as VotePubsubMessagePublicationSchema, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, qn as CidStringSchema, qt as CommentModerationSignedPropertyNames, rn as CommunityIpfsSchema, rr as e$5, sn as CreateRpcCommunityFunctionArgumentSchema, sr as n$8, tn as CommunityExportRecordsSchema, tr as t$13, tt as raceAgainstAbort, un as RpcRemoteCommunityUpdateEventResultSchema, ur as t$9, v as PKCUserOptionsSchema, vn as CommentIpfsReservedFields, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as _enum, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, xr as require_supports_color, xt as findStartedCommunity, yn as CommentIpfsSchema, yr as messages, z as isAbortError, zn as CommentEditSignedPropertyNames, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-DZyEx0YQ.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$9, $t as CommunityChallengeSettingSchema, A as extractNetworkErrorDetails, Ar as object, At as trackStartedCommunity, B as isIpfsCid, Cn as CommentUpdateChallengeReservedFieldNames, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dr as custom, E as createAbortError, En as CommentUpdateReservedFields, Er as boolean, Et as listUpdatingCommunities, Fn as CommentEditChallengeRequestToEncryptSchema, Ft as untrackUpdatingCommunity, Gn as ChallengeAnswersSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorAddressSchema, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, It as require_sha256$1, Jn as CommunityAddressSchema, Jt as CommentModerationsTableRowSchema, Kn as CidPathSchema, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Mn as GetPageParamSchema, Mr as string, Mt as trackUpdatingCommunity, Nn as ModQueuePageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateSignedPropertyNames, Or as literal, Ot as refreshTrackedCommunityAliases, Pn as PageIpfsSchema, Pt as untrackUpdatingComment, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sn as CommentSignedPropertyNames, Sr as require_ms$1, St as findUpdatingComment, Tn as CommentUpdateForChallengeVerificationSignedPropertyNames, Tr as array, U as isIpnsPath, Un as AuthorCommentIpfsReservedFields, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as CreateCommentEditOptionsWithRefinementSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as CreateSignerSchema, Xt as ChallengeFileFactorySchema, Yn as CommunityAuthorChallengeReservedFieldNames, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as n$10, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentChallengeRequestToEncryptSchema, _r as FailedToFetchPageIpfsFromGatewaysError, _t as timestamp, an as CreateNewLocalCommunityUserOptionsSchema, ar as r$8, b as areEquivalentCommunityAddresses, br as logger_default, c as ChallengeVerificationMessageSignedPropertyNames, cn as ExportCommunityModLogsOptionsSchema, cr as r$7, ct as resolveWhenPredicateIsTrue, dn as CreateVoteUserOptionsWithRefinementSchema, dr as e$4, en as CommunityEditOptionsSchema, f as DecryptedChallengeSchema, fn as VoteChallengeRequestToEncryptSchema, fr as require_retry$1, ft as shortifyAddress, g as PKCParsedOptionsSchema, gr as FailedToFetchGenericIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hn as VoteSignedPropertyNames, hr as FailedToFetchCommunityFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CommunitySignedPropertyNames, ir as t$11, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as CreateCommentOptionsWithRefinementSchema, jr as record, k as doesDomainAddressHaveCapitalLetter, kr as number, l as DecryptedChallengeAnswerSchema, lr as t$10, m as NameResolveCacheOptionsSchema, mr as FailedToFetchCommentUpdateFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsReservedFields, nr as e$6, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRemoteCommunityFunctionArgumentSchema, or as t$12, p as DecryptedChallengeVerificationSchema, pn as VotePubsubMessagePublicationSchema, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, qn as CidStringSchema, qt as CommentModerationSignedPropertyNames, rn as CommunityIpfsSchema, rr as e$5, sn as CreateRpcCommunityFunctionArgumentSchema, sr as n$8, tn as CommunityExportRecordsSchema, tr as t$13, tt as raceAgainstAbort, un as RpcRemoteCommunityUpdateEventResultSchema, ur as t$9, v as PKCUserOptionsSchema, vn as CommentIpfsReservedFields, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as _enum, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, xr as require_supports_color, xt as findStartedCommunity, yn as CommentIpfsSchema, yr as messages, z as isAbortError, zn as CommentEditSignedPropertyNames, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-mdv9_FG5.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
4
  import { createHash } from "node:crypto";
5
5
  import { pathToFileURL } from "node:url";
@@ -91640,6 +91640,50 @@ function t(n) {
91640
91640
  return r;
91641
91641
  }
91642
91642
  //#endregion
91643
+ //#region dist/node/publications/comment/crosspost-depth.js
91644
+ const MAX_CROSSPOST_DEPTH = 10;
91645
+ function crosspostChainDepthUpTo(record, stopAt = 11) {
91646
+ let depth = 0;
91647
+ let level = _prop(record, "crosspost");
91648
+ while (_isObject(level) && depth < stopAt) {
91649
+ depth++;
91650
+ level = _prop(_prop(level, "comment"), "crosspost");
91651
+ }
91652
+ return depth;
91653
+ }
91654
+ function deepestCrosspostChainInPageUpTo(pageJson, stopAt = 11) {
91655
+ return _deepestCrosspostChainInPagesUpTo([pageJson], stopAt);
91656
+ }
91657
+ function deepestCrosspostChainInCommentUpdateUpTo(commentUpdateJson, stopAt = 11) {
91658
+ const replyPages = _prop(_prop(commentUpdateJson, "replies"), "pages");
91659
+ return _isObject(replyPages) ? _deepestCrosspostChainInPagesUpTo(Object.values(replyPages), stopAt) : 0;
91660
+ }
91661
+ function _deepestCrosspostChainInPagesUpTo(pages, stopAt) {
91662
+ let deepest = 0;
91663
+ const pagesToWalk = [...pages];
91664
+ while (pagesToWalk.length > 0) {
91665
+ const comments = _prop(pagesToWalk.pop(), "comments");
91666
+ if (!Array.isArray(comments)) continue;
91667
+ for (const pageComment of comments) {
91668
+ deepest = Math.max(deepest, crosspostChainDepthUpTo(_prop(pageComment, "comment"), stopAt));
91669
+ if (deepest >= stopAt) return deepest;
91670
+ const replyPages = _prop(_prop(_prop(pageComment, "commentUpdate"), "replies"), "pages");
91671
+ if (_isObject(replyPages)) pagesToWalk.push(...Object.values(replyPages));
91672
+ }
91673
+ }
91674
+ return deepest;
91675
+ }
91676
+ function effectiveMaxCrosspostDepth(maxCrosspostDepthFeature) {
91677
+ if (typeof maxCrosspostDepthFeature !== "number" || !Number.isInteger(maxCrosspostDepthFeature) || maxCrosspostDepthFeature < 0) return 10;
91678
+ return Math.min(maxCrosspostDepthFeature, 10);
91679
+ }
91680
+ function _isObject(value) {
91681
+ return typeof value === "object" && value !== null;
91682
+ }
91683
+ function _prop(value, key) {
91684
+ return _isObject(value) ? value[key] : void 0;
91685
+ }
91686
+ //#endregion
91643
91687
  //#region dist/node/clients/rpc-client/schema.js
91644
91688
  var import_sha256 = require_sha256$1();
91645
91689
  const SubscriptionIdSchema = number().positive().int();
@@ -91739,6 +91783,28 @@ const PKCWsServerSettingsSerializedSchema = object({
91739
91783
  });
91740
91784
  //#endregion
91741
91785
  //#region dist/node/schema/schema-util.js
91786
+ function _throwIfCrosspostChainExceedsMaxDepth(record, details) {
91787
+ if (crosspostChainDepthUpTo(record) > 10) throw new PKCError("ERR_CROSSPOST_CHAIN_EXCEEDS_MAX_DEPTH", {
91788
+ ...details,
91789
+ maxCrosspostDepth: 10
91790
+ });
91791
+ }
91792
+ function _throwIfPageCrosspostChainsExceedMaxDepth(pageJson, details) {
91793
+ if (deepestCrosspostChainInPageUpTo(pageJson) > 10) throw new PKCError("ERR_CROSSPOST_CHAIN_EXCEEDS_MAX_DEPTH", {
91794
+ ...details,
91795
+ maxCrosspostDepth: 10
91796
+ });
91797
+ }
91798
+ function _safeParseWithoutLettingNonZodThrowsEscape(schema, json, code, details) {
91799
+ try {
91800
+ return schema.safeParse(json);
91801
+ } catch (e) {
91802
+ throw new PKCError(code, {
91803
+ ...details,
91804
+ error: e
91805
+ });
91806
+ }
91807
+ }
91742
91808
  function parseJsonWithPKCErrorIfFails(x) {
91743
91809
  try {
91744
91810
  return JSON.parse(x);
@@ -91759,7 +91825,8 @@ function parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails(communityIpfs)
91759
91825
  else return communityIpfs;
91760
91826
  }
91761
91827
  function parseCommentIpfsSchemaWithPKCErrorIfItFails(commentIpfsJson) {
91762
- const parseRes = CommentIpfsSchema.loose().safeParse(commentIpfsJson);
91828
+ _throwIfCrosspostChainExceedsMaxDepth(commentIpfsJson, { commentIpfsJson });
91829
+ const parseRes = _safeParseWithoutLettingNonZodThrowsEscape(CommentIpfsSchema.loose(), commentIpfsJson, "ERR_INVALID_COMMENT_IPFS_SCHEMA", { commentIpfsJson });
91763
91830
  if (!parseRes.success) throw new PKCError("ERR_INVALID_COMMENT_IPFS_SCHEMA", {
91764
91831
  zodError: parseRes.error,
91765
91832
  commentIpfsJson
@@ -91767,7 +91834,11 @@ function parseCommentIpfsSchemaWithPKCErrorIfItFails(commentIpfsJson) {
91767
91834
  else return commentIpfsJson;
91768
91835
  }
91769
91836
  function parseCommentUpdateSchemaWithPKCErrorIfItFails(commentUpdateJson) {
91770
- const parseRes = CommentUpdateSchema.loose().safeParse(commentUpdateJson);
91837
+ if (deepestCrosspostChainInCommentUpdateUpTo(commentUpdateJson) > 10) throw new PKCError("ERR_CROSSPOST_CHAIN_EXCEEDS_MAX_DEPTH", {
91838
+ commentUpdateJson,
91839
+ maxCrosspostDepth: 10
91840
+ });
91841
+ const parseRes = _safeParseWithoutLettingNonZodThrowsEscape(CommentUpdateSchema.loose(), commentUpdateJson, "ERR_INVALID_COMMENT_UPDATE_SCHEMA", { commentUpdateJson });
91771
91842
  if (!parseRes.success) throw new PKCError("ERR_INVALID_COMMENT_UPDATE_SCHEMA", {
91772
91843
  zodError: parseRes.error,
91773
91844
  commentUpdateJson
@@ -91775,7 +91846,8 @@ function parseCommentUpdateSchemaWithPKCErrorIfItFails(commentUpdateJson) {
91775
91846
  else return commentUpdateJson;
91776
91847
  }
91777
91848
  function parsePageIpfsSchemaWithPKCErrorIfItFails(pageIpfsJson) {
91778
- const parseRes = PageIpfsSchema.safeParse(pageIpfsJson);
91849
+ _throwIfPageCrosspostChainsExceedMaxDepth(pageIpfsJson, { pageIpfsJson });
91850
+ const parseRes = _safeParseWithoutLettingNonZodThrowsEscape(PageIpfsSchema, pageIpfsJson, "ERR_INVALID_PAGE_IPFS_SCHEMA", { pageIpfsJson });
91779
91851
  if (!parseRes.success) throw new PKCError("ERR_INVALID_PAGE_IPFS_SCHEMA", {
91780
91852
  zodError: parseRes.error,
91781
91853
  pageIpfsJson
@@ -91783,7 +91855,8 @@ function parsePageIpfsSchemaWithPKCErrorIfItFails(pageIpfsJson) {
91783
91855
  else return pageIpfsJson;
91784
91856
  }
91785
91857
  function parseModQueuePageIpfsSchemaWithPKCErrorIfItFails(modQueuePageIpfsJson) {
91786
- const parseRes = ModQueuePageIpfsSchema.safeParse(modQueuePageIpfsJson);
91858
+ _throwIfPageCrosspostChainsExceedMaxDepth(modQueuePageIpfsJson, { modQueuePageIpfsJson });
91859
+ const parseRes = _safeParseWithoutLettingNonZodThrowsEscape(ModQueuePageIpfsSchema, modQueuePageIpfsJson, "ERR_INVALID_MODQUEUE_PAGE_IPFS_SCHEMA", { modQueuePageIpfsJson });
91787
91860
  if (!parseRes.success) throw new PKCError("ERR_INVALID_MODQUEUE_PAGE_IPFS_SCHEMA", {
91788
91861
  zodError: parseRes.error,
91789
91862
  modQueuePageIpfsJson
@@ -91833,6 +91906,7 @@ function parseRpcCommentUpdateEventWithPKCErrorIfItFails(updateResult) {
91833
91906
  else return updateResult;
91834
91907
  }
91835
91908
  function parseRpcCommentEventWithPKCErrorIfItFails(updateResult) {
91909
+ _throwIfCrosspostChainExceedsMaxDepth(updateResult?.comment, { updateResult });
91836
91910
  const parseRes = RpcCommentEventResultSchema.safeParse(updateResult);
91837
91911
  if (!parseRes.success) throw new PKCError("ERR_INVALID_RPC_COMMENT_SCHEMA", {
91838
91912
  zodError: parseRes.error,
@@ -92017,7 +92091,14 @@ function parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails(args
92017
92091
  else return args;
92018
92092
  }
92019
92093
  function parseCommentPubsubMessagePublicationWithPKCErrorIfItFails(args) {
92020
- const parseRes = CommentPubsubMessageWithFlexibleAuthorRefinementSchema.safeParse(args);
92094
+ _throwIfCrosspostChainExceedsMaxDepth(args, {
92095
+ args,
92096
+ type: "CommentPubsubMessagePublication"
92097
+ });
92098
+ const parseRes = _safeParseWithoutLettingNonZodThrowsEscape(CommentPubsubMessageWithFlexibleAuthorRefinementSchema, args, "ERR_INVALID_CREATE_COMMENT_ARGS_SCHEMA", {
92099
+ args,
92100
+ type: "CommentPubsubMessagePublication"
92101
+ });
92021
92102
  if (!parseRes.success) throw new PKCError("ERR_INVALID_CREATE_COMMENT_ARGS_SCHEMA", {
92022
92103
  zodError: parseRes.error,
92023
92104
  args,
@@ -92026,6 +92107,10 @@ function parseCommentPubsubMessagePublicationWithPKCErrorIfItFails(args) {
92026
92107
  else return args;
92027
92108
  }
92028
92109
  function parseCreateCommentOptionsSchemaWithPKCErrorIfItFails(args) {
92110
+ _throwIfCrosspostChainExceedsMaxDepth(args, {
92111
+ args,
92112
+ type: "CreateCommentOptions"
92113
+ });
92029
92114
  const parseRes = CreateCommentOptionsWithRefinementSchema.safeParse(args);
92030
92115
  if (!parseRes.success) throw new PKCError("ERR_INVALID_CREATE_COMMENT_ARGS_SCHEMA", {
92031
92116
  zodError: parseRes.error,
@@ -97768,6 +97853,40 @@ async function verifyCommentModeration({ moderation, resolveAuthorNames, clients
97768
97853
  if (!res.valid) return res;
97769
97854
  return { valid: true };
97770
97855
  }
97856
+ async function _verifyCrosspost({ crosspost, resolveAuthorNames, clientsManager, abortSignal }) {
97857
+ if (await of(stringify(crosspost.comment)) !== crosspost.cid) return {
97858
+ valid: false,
97859
+ reason: messages.ERR_CROSSPOST_CID_DOES_NOT_MATCH_EMBEDDED_COMMENT
97860
+ };
97861
+ if (_isThereReservedFieldInRecord(crosspost.comment, CommentIpfsReservedFields)) return {
97862
+ valid: false,
97863
+ reason: messages.ERR_CROSSPOST_COMMENT_INCLUDES_RESERVED_FIELD
97864
+ };
97865
+ if (crosspost.comment.author && r(Object.keys(crosspost.comment.author), AuthorCommentIpfsReservedFields).length > 0) return {
97866
+ valid: false,
97867
+ reason: messages.ERR_CROSSPOST_COMMENT_AUTHOR_INCLUDES_RESERVED_FIELD
97868
+ };
97869
+ if (_isThereUnsignedSignableFieldInRecord(crosspost.comment)) return {
97870
+ valid: false,
97871
+ reason: messages.ERR_CROSSPOST_COMMENT_INCLUDES_SIGNABLE_FIELD_NOT_IN_SIGNED_PROPERTY_NAMES
97872
+ };
97873
+ const keysCasted = crosspost.comment.signature.signedPropertyNames;
97874
+ if (!(await verifyCommentPubsubMessage({
97875
+ comment: t$2(crosspost.comment, ["signature", ...keysCasted]),
97876
+ resolveAuthorNames,
97877
+ clientsManager,
97878
+ abortSignal
97879
+ })).valid) return {
97880
+ valid: false,
97881
+ reason: messages.ERR_CROSSPOST_COMMENT_SIGNATURE_IS_INVALID
97882
+ };
97883
+ return { valid: true };
97884
+ }
97885
+ function _isThereUnsignedSignableFieldInRecord(record) {
97886
+ const fields = record;
97887
+ for (const name of CommentSignedPropertyNames) if (fields[name] !== void 0 && !record.signature.signedPropertyNames.includes(name)) return true;
97888
+ return false;
97889
+ }
97771
97890
  async function verifyCommentPubsubMessage({ comment, resolveAuthorNames, clientsManager, abortSignal }) {
97772
97891
  if (!_allFieldsOfRecordInSignedPropertyNames(comment)) return {
97773
97892
  valid: false,
@@ -97775,6 +97894,19 @@ async function verifyCommentPubsubMessage({ comment, resolveAuthorNames, clients
97775
97894
  };
97776
97895
  const validation = await _verifyPublicationSignatureAndAuthor({ publicationJson: comment });
97777
97896
  if (!validation.valid) return validation;
97897
+ if (comment.crosspost) {
97898
+ if (crosspostChainDepthUpTo(comment) > 10) return {
97899
+ valid: false,
97900
+ reason: messages.ERR_CROSSPOST_CHAIN_EXCEEDS_MAX_DEPTH
97901
+ };
97902
+ const crosspostValidation = await _verifyCrosspost({
97903
+ crosspost: comment.crosspost,
97904
+ resolveAuthorNames,
97905
+ clientsManager,
97906
+ abortSignal
97907
+ });
97908
+ if (!crosspostValidation.valid) return crosspostValidation;
97909
+ }
97778
97910
  return validation;
97779
97911
  }
97780
97912
  async function verifyCommentIpfs(opts) {
@@ -97793,6 +97925,10 @@ async function verifyCommentIpfs(opts) {
97793
97925
  valid: false,
97794
97926
  reason: messages.ERR_COMMENT_IPFS_AUTHOR_INCLUDES_RESERVED_FIELD
97795
97927
  };
97928
+ if (_isThereUnsignedSignableFieldInRecord(opts.comment)) return {
97929
+ valid: false,
97930
+ reason: messages.ERR_COMMENT_IPFS_RECORD_INCLUDES_SIGNABLE_FIELD_NOT_IN_SIGNED_PROPERTY_NAMES
97931
+ };
97796
97932
  const keysCasted = opts.comment.signature.signedPropertyNames;
97797
97933
  const validRes = await verifyCommentPubsubMessage({
97798
97934
  comment: t$2(opts.comment, ["signature", ...keysCasted]),
@@ -98597,6 +98733,7 @@ const createUrlFromSubdomainResolution = (gateway, opts) => {
98597
98733
  return `${gatewayUrl.protocol}//${root}.${opts.recordIpfsType}.${gatewayUrl.host}${opts.path ? "/" + opts.path : ""}`;
98598
98734
  };
98599
98735
  const GATEWAYS_THAT_SUPPORT_SUBDOMAIN_RESOLUTION = {};
98736
+ const MAX_CONCURRENT_AUTHOR_NAME_RESOLUTIONS = 100;
98600
98737
  var BaseClientsManager = class BaseClientsManager {
98601
98738
  constructor(pkc) {
98602
98739
  this.pubsubProviderSubscriptions = {};
@@ -99295,7 +99432,7 @@ var BaseClientsManager = class BaseClientsManager {
99295
99432
  });
99296
99433
  }
99297
99434
  if (toResolve.length === 0) return;
99298
- const limit = pLimit(5);
99435
+ const limit = pLimit(MAX_CONCURRENT_AUTHOR_NAME_RESOLUTIONS);
99299
99436
  const resolveOne = async (entry) => {
99300
99437
  if (abortSignal?.aborted) return false;
99301
99438
  try {
@@ -100019,6 +100156,88 @@ var CommunityModQueueClientsManager = class extends BasePagesClientsManager {
100019
100156
  //#region dist/node/pages/schema-util.js
100020
100157
  const parsePageCidParams = (params) => GetPageParamSchema.parse(params);
100021
100158
  //#endregion
100159
+ //#region dist/node/publications/comment/crosspost-runtime.js
100160
+ function _chainOf(crosspost) {
100161
+ const chain = [];
100162
+ for (let level = crosspost; level; level = level.comment.crosspost) chain.push(level);
100163
+ return chain;
100164
+ }
100165
+ function cloneCrosspostForRuntime(crosspost) {
100166
+ const chain = _chainOf(crosspost);
100167
+ let child;
100168
+ for (let i = chain.length - 1; i >= 0; i--) {
100169
+ const level = chain[i];
100170
+ const comment = { ...level.comment };
100171
+ if (level.comment.author) comment.author = { ...level.comment.author };
100172
+ if (child) comment.crosspost = child;
100173
+ child = {
100174
+ cid: level.cid,
100175
+ comment
100176
+ };
100177
+ }
100178
+ return child;
100179
+ }
100180
+ const CROSSPOST_LEVELS_TO_RESOLVE_AUTHOR_NAMES_FOR = 10;
100181
+ function collectCrosspostAuthorsToResolve({ crosspost, maxLevels = CROSSPOST_LEVELS_TO_RESOLVE_AUTHOR_NAMES_FOR }) {
100182
+ const authors = [];
100183
+ const chain = _chainOf(crosspost).slice(0, maxLevels);
100184
+ for (const level of chain) {
100185
+ if (typeof level.comment.author?.nameResolved === "boolean") continue;
100186
+ const authorName = getAuthorNameFromWire(level.comment.author);
100187
+ if (!authorName) continue;
100188
+ authors.push({
100189
+ authorName,
100190
+ signaturePublicKey: level.comment.signature.publicKey
100191
+ });
100192
+ }
100193
+ return authors;
100194
+ }
100195
+ function applyNameResolvedCacheToCrosspost({ crosspost, cache }) {
100196
+ let changed = false;
100197
+ for (const level of _chainOf(crosspost)) {
100198
+ const author = level.comment.author;
100199
+ if (!author) continue;
100200
+ const authorName = getAuthorNameFromWire(author);
100201
+ if (!authorName) continue;
100202
+ const cached = cache.get((0, import_sha256.sha256)(authorName + level.comment.signature.publicKey));
100203
+ if (typeof cached !== "boolean" || author.nameResolved === cached) continue;
100204
+ author.nameResolved = cached;
100205
+ changed = true;
100206
+ }
100207
+ return changed;
100208
+ }
100209
+ function _buildCrosspostRuntimeFields(crosspost, nameResolvedOf) {
100210
+ const chain = _chainOf(crosspost);
100211
+ let child;
100212
+ let anyLevelHasAVerdict = false;
100213
+ for (let i = chain.length - 1; i >= 0; i--) {
100214
+ const nameResolved = nameResolvedOf(chain[i]);
100215
+ if (nameResolved === void 0 && !child) continue;
100216
+ const comment = {};
100217
+ if (nameResolved !== void 0) {
100218
+ comment.author = { nameResolved };
100219
+ anyLevelHasAVerdict = true;
100220
+ }
100221
+ if (child) comment.crosspost = child;
100222
+ child = { comment };
100223
+ }
100224
+ return anyLevelHasAVerdict ? child : void 0;
100225
+ }
100226
+ function buildCrosspostRuntimeFieldsFromCache({ crosspost, cache }) {
100227
+ return _buildCrosspostRuntimeFields(crosspost, (level) => {
100228
+ const authorName = getAuthorNameFromWire(level.comment.author);
100229
+ if (!authorName) return void 0;
100230
+ const cached = cache.get((0, import_sha256.sha256)(authorName + level.comment.signature.publicKey));
100231
+ return typeof cached === "boolean" ? cached : void 0;
100232
+ });
100233
+ }
100234
+ function extractCrosspostRuntimeFields(crosspost) {
100235
+ return _buildCrosspostRuntimeFields(crosspost, (level) => typeof level.comment.author?.nameResolved === "boolean" ? level.comment.author.nameResolved : void 0);
100236
+ }
100237
+ function stripNameResolvedFromCrosspost(crosspost) {
100238
+ for (const level of _chainOf(crosspost)) if (level.comment.author?.nameResolved !== void 0) delete level.comment.author.nameResolved;
100239
+ }
100240
+ //#endregion
100022
100241
  //#region dist/node/pages/pages.js
100023
100242
  var BasePages = class {
100024
100243
  constructor(props) {
@@ -100043,6 +100262,10 @@ var BasePages = class {
100043
100262
  _applyNameResolvedCacheToPage(page) {
100044
100263
  const cache = this._clientsManager._pkc._memCaches.nameResolvedCache;
100045
100264
  for (const comment of page.comments) {
100265
+ if (comment.crosspost) applyNameResolvedCacheToCrosspost({
100266
+ crosspost: comment.crosspost,
100267
+ cache
100268
+ });
100046
100269
  const domain = getAuthorNameFromRuntime(comment.author);
100047
100270
  if (!domain) continue;
100048
100271
  const cacheKey = (0, import_sha256.sha256)(domain + comment.signature.publicKey);
@@ -100408,6 +100631,7 @@ function mapModqueuePageIpfsCommentToModQueuePageJsonComment(pageComment) {
100408
100631
  shortCid: shortifyCid(pageComment.commentUpdate.cid),
100409
100632
  shortCommunityAddress: shortifyAddress(communityAddr),
100410
100633
  postCid,
100634
+ ...pageComment.comment.crosspost ? { crosspost: cloneCrosspostForRuntime(pageComment.comment.crosspost) } : {},
100411
100635
  raw: {
100412
100636
  comment: pageComment.comment,
100413
100637
  commentUpdate: pageComment.commentUpdate
@@ -100454,6 +100678,7 @@ function mapPageIpfsCommentToPageJsonComment(pageComment) {
100454
100678
  nsfw,
100455
100679
  flairs: pageComment.commentUpdate.flairs || pageComment.commentUpdate.edit?.flairs || pageComment.comment.flairs,
100456
100680
  postCid,
100681
+ ...pageComment.comment.crosspost ? { crosspost: cloneCrosspostForRuntime(pageComment.comment.crosspost) } : {},
100457
100682
  raw: {
100458
100683
  comment: pageComment.comment,
100459
100684
  commentUpdate: pageComment.commentUpdate
@@ -100523,12 +100748,19 @@ function findCommentInHierarchicalPageIpfsRecursively(page, targetCid) {
100523
100748
  }
100524
100749
  }
100525
100750
  function _buildCommentRuntimeFields(comment, cache) {
100751
+ const fields = {};
100752
+ const crosspost = comment.comment.crosspost ? buildCrosspostRuntimeFieldsFromCache({
100753
+ crosspost: comment.comment.crosspost,
100754
+ cache
100755
+ }) : void 0;
100756
+ if (crosspost) fields.crosspost = crosspost;
100526
100757
  const domain = getAuthorNameFromWire(comment.comment.author);
100527
- if (!domain) return {};
100758
+ if (!domain) return fields;
100528
100759
  const key = (0, import_sha256.sha256)(domain + comment.comment.signature.publicKey);
100529
100760
  const cached = cache.get(key);
100530
- if (typeof cached !== "boolean") return {};
100531
- return { author: { nameResolved: cached } };
100761
+ if (typeof cached !== "boolean") return fields;
100762
+ fields.author = { nameResolved: cached };
100763
+ return fields;
100532
100764
  }
100533
100765
  function buildPageRuntimeFields(page, cache) {
100534
100766
  return { comments: page.comments.map((c) => {
@@ -100549,6 +100781,10 @@ function buildPagesRuntimeFields(pages, cache) {
100549
100781
  function extractCommentRuntimeFieldsFromParsedComment(comment) {
100550
100782
  const runtimeFields = {};
100551
100783
  if (typeof comment.author?.nameResolved === "boolean") runtimeFields.author = { nameResolved: comment.author.nameResolved };
100784
+ if (comment.crosspost) {
100785
+ const crosspost = extractCrosspostRuntimeFields(comment.crosspost);
100786
+ if (crosspost) runtimeFields.crosspost = crosspost;
100787
+ }
100552
100788
  const repliesPages = "replies" in comment ? comment.replies?.pages : void 0;
100553
100789
  if (repliesPages) {
100554
100790
  const replyRuntimeFields = extractParsedPagesRuntimeFields(repliesPages);
@@ -101598,6 +101834,7 @@ var CommentClientsManager = class extends PublicationClientsManager {
101598
101834
  this._postForUpdating.comment.on("update", this._postForUpdating.update);
101599
101835
  this._postForUpdating.comment.on("updatingstatechange", this._postForUpdating.updatingstatechange);
101600
101836
  this._postForUpdating.comment.on("error", this._postForUpdating.error);
101837
+ this._postForUpdating.comment._numOfListenersForUpdatingInstance++;
101601
101838
  return this._postForUpdating;
101602
101839
  }
101603
101840
  async cleanUpUpdatingPostInstance() {
@@ -101621,7 +101858,11 @@ var CommentClientsManager = class extends PublicationClientsManager {
101621
101858
  this._postForUpdating.comment.removeListener("updatingstatechange", this._postForUpdating.updatingstatechange);
101622
101859
  this._postForUpdating.comment.removeListener("error", this._postForUpdating.error);
101623
101860
  this._postForUpdating.comment.removeListener("update", this._postForUpdating.update);
101624
- if (this._postForUpdating.comment._updatingCommentInstance) await this._postForUpdating.comment.stop();
101861
+ const postForUpdating = this._postForUpdating.comment;
101862
+ postForUpdating._numOfListenersForUpdatingInstance--;
101863
+ if (postForUpdating._updatingCommentInstance) await postForUpdating.stop();
101864
+ else if (postForUpdating._numOfListenersForUpdatingInstance === 0 && postForUpdating.state !== "stopped") await postForUpdating.stop();
101865
+ else if (postForUpdating._numOfListenersForUpdatingInstance === 0 && postForUpdating.state === "stopped" && postForUpdating.cid && findUpdatingComment(this._pkc, { cid: postForUpdating.cid }) === postForUpdating) untrackUpdatingComment(this._pkc, postForUpdating);
101625
101866
  this._parentFirstPageCidsAlreadyLoaded.clear();
101626
101867
  this._postForUpdating = void 0;
101627
101868
  }
@@ -129352,4 +129593,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
129352
129593
  }
129353
129594
  };
129354
129595
  //#endregion
129355
- export { PublicationClientsManager as $, n$6 as $n, parseCommentIpfsSchemaWithPKCErrorIfItFails as $t, deriveDbReplies as A, RpcCidParamSchema as An, verifyVote as At, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as B, RpcFetchCidResultSchema as Bn, normalizeCommunityInputFromCommunity as Bt, backupCommunityDb as C, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Cn, verifyCommentEdit as Ct, deleteOldCommunityInWindows as D, RpcAnchorPublishPreparationResultSchema as Dn, verifyCommentUpdate as Dt, createKuboRpcClient as E, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as En, verifyCommentPubsubMessage as Et, listCommunitiesSync as F, RpcExportCommunityModLogsParamSchema as Fn, normalizeCreatePublicationAuthor as Ft, TIMEFRAMES_TO_SECONDS as G, RpcSubscriptionIdResultSchema as Gn, getPKCAddressFromPublicKey as Gt, POSTS_SORT_TYPES as H, RpcPublishChallengeAnswersParamSchema as Hn, encode as Ht, monitorCommunitiesDirectory as I, RpcExportCommunityModLogsResultSchema as In, buildRuntimeCommunityFields as It, extractCommunityRuntimeFieldsFromParsedPages as J, t$2 as Jn, createSchemaRowParser as Jt, buildPageRuntimeFields as K, RpcSuccessResultSchema as Kn, getPKCAddressFromPublicKeySync as Kt, moveCommunityDbToDeletedDirectory as L, RpcExportCommunityParamSchema as Ln, getCommunityAddressFromRecord as Lt, getDefaultDataPath as M, RpcCommunityIdentifierParamSchema as Mn, cleanWireAuthor as Mt, getThumbnailPropsOfLink as N, RpcCommunityPageParamSchema as Nn, getAuthorNameFromRuntime as Nt, deriveCommentIpfsFromCommentTableRow as O, RpcAuthorNameParamSchema as On, verifyCommunity as Ot, importSignerIntoKuboNode as P, RpcEditCommunityParamSchema as Pn, getAuthorNameFromWire as Pt, RepliesPages as Q, n$5 as Qn, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as Qt, resolveDbPostsCidRefs as R, RpcExportCommunityResultSchema as Rn, getCommunityNameFromWire$1 as Rt, BackupAbortError as S, parseRpcCommentEventWithPKCErrorIfItFails as Sn, verifyChallengeVerification as St, calculateInlineRepliesBudget as T, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Tn, verifyCommentModeration as Tt, POST_REPLIES_SORT_TYPES as U, RpcPublishedAnchorRecordResultSchema as Un, getBufferedPKCAddressFromPublicKey as Ut, CommentClientsManager as V, RpcPublishAnchorRecordParamSchema as Vn, decode as Vt, REPLY_REPLIES_SORT_TYPES as W, RpcResolveAuthorNameResultSchema as Wn, getIpfsKeyFromPrivateKey as Wt, iterateOverPageCidsToFindAllCids as X, r as Xn, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Xt, findCommentInPageInstanceRecursively as Y, t$4 as Yn, parseCidStringSchemaWithPKCErrorIfItFails as Yt, parseRawPages as Z, t$5 as Zn, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Zt, createAnchorIpnsRecord as _, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as _n, signCommunityEdit as _t, pkcJsChallenges as a, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as an, nativeFunctions$1 as ar, require_lib$1 as at, encryptEd25519AesGcm as b, parseJsonWithPKCErrorIfFails as bn, verifyChallengeMessage as bt, RemoteCommunity as c, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as cn, signChallengeMessage as ct, decodeRpcChallengeAnswerPubsubMsg as d, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as dn, signComment as dt, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as en, t$7 as er, PKCClientsManager as et, decodeRpcChallengePubsubMsg as f, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as fn, signCommentEdit as ft, createSigner as g, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as gn, signCommunity as gt, SignerWithPublicKeyAddress as h, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as hn, signCommentUpdateForChallengeVerification as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as in, require_lodash_merge as ir, PKCTypedEmitter as it, getDefaultCommunityDbConfig as j, RpcCommentRepliesPageParamSchema as jn, buildRuntimeAuthor as jt, deriveDbPosts as k, RpcCancelExportParamSchema as kn, verifyCommunityEdit as kt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as l, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as ln, signChallengeRequest as lt, decodeRpcChallengeVerificationPubsubMsg as m, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as mn, signCommentUpdate as mt, RpcRemoteCommunity as n, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as nn, stringify as nr, pRetry as nt, TrackedInstanceRegistry as o, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as on, require_undici as or, cleanUpBeforePublishing as ot, decodeRpcChallengeRequestPubsubMsg as p, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as pn, signCommentModeration as pt, buildPagesRuntimeFields as q, RpcUnsubscribeParamSchema as qn, getPublicKeyFromPrivateKey as qt, getChallengeVerification as r, parseCommunityAddressWithPKCErrorIfItFails as rn, STORAGE_KEYS as rr, pLimit as rt, LRUCache as s, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as sn, signChallengeAnswer as st, RpcLocalCommunity as t, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as tn, t$8 as tr, InflightFetchManager as tt, KeyvBetterSqlite3 as u, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as un, signChallengeVerification as ut, decryptEd25519AesGcm as v, parseDecryptedChallengeVerification as vn, signVote as vt, calculateExpectedSignatureSize as w, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as wn, verifyCommentIpfs as wt, encryptEd25519AesGcmPublicKeyBuffer as x, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as xn, verifyChallengeRequest as xt, decryptEd25519AesGcmPublicKeyBuffer as y, parseDecryptedChallengeWithPKCErrorIfItFails as yn, verifyChallengeAnswer as yt, setNativeFunctions as z, RpcFetchCidParamSchema as zn, getCommunityPublicKeyFromWire as zt };
129596
+ export { applyNameResolvedCacheToCrosspost as $, crosspostChainDepthUpTo as $n, createSchemaRowParser as $t, deriveDbReplies as A, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as An, verifyCommentModeration as At, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as B, RpcExportCommunityModLogsParamSchema as Bn, normalizeCreatePublicationAuthor as Bt, backupCommunityDb as C, parseDecryptedChallengeVerification as Cn, signVote as Ct, deleteOldCommunityInWindows as D, parseRpcCommentEventWithPKCErrorIfItFails as Dn, verifyChallengeVerification as Dt, createKuboRpcClient as E, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as En, verifyChallengeRequest as Et, listCommunitiesSync as F, RpcCidParamSchema as Fn, verifyVote as Ft, TIMEFRAMES_TO_SECONDS as G, RpcFetchCidResultSchema as Gn, normalizeCommunityInputFromCommunity as Gt, POSTS_SORT_TYPES as H, RpcExportCommunityParamSchema as Hn, getCommunityAddressFromRecord as Ht, monitorCommunitiesDirectory as I, RpcCommentRepliesPageParamSchema as In, buildRuntimeAuthor as It, extractCommunityRuntimeFieldsFromParsedPages as J, RpcPublishedAnchorRecordResultSchema as Jn, getBufferedPKCAddressFromPublicKey as Jt, buildPageRuntimeFields as K, RpcPublishAnchorRecordParamSchema as Kn, decode as Kt, moveCommunityDbToDeletedDirectory as L, RpcCommunityIdentifierParamSchema as Ln, cleanWireAuthor as Lt, getDefaultDataPath as M, RpcAnchorPublishPreparationResultSchema as Mn, verifyCommentUpdate as Mt, getThumbnailPropsOfLink as N, RpcAuthorNameParamSchema as Nn, verifyCommunity as Nt, deriveCommentIpfsFromCommentTableRow as O, parseRpcCommentUpdateEventWithPKCErrorIfItFails as On, verifyCommentEdit as Ot, importSignerIntoKuboNode as P, RpcCancelExportParamSchema as Pn, verifyCommunityEdit as Pt, RepliesPages as Q, RpcUnsubscribeParamSchema as Qn, getPublicKeyFromPrivateKey as Qt, resolveDbPostsCidRefs as R, RpcCommunityPageParamSchema as Rn, getAuthorNameFromRuntime as Rt, BackupAbortError as S, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Sn, signCommunityEdit as St, calculateInlineRepliesBudget as T, parseJsonWithPKCErrorIfFails as Tn, verifyChallengeMessage as Tt, POST_REPLIES_SORT_TYPES as U, RpcExportCommunityResultSchema as Un, getCommunityNameFromWire$1 as Ut, CommentClientsManager as V, RpcExportCommunityModLogsResultSchema as Vn, buildRuntimeCommunityFields as Vt, REPLY_REPLIES_SORT_TYPES as W, RpcFetchCidParamSchema as Wn, getCommunityPublicKeyFromWire as Wt, iterateOverPageCidsToFindAllCids as X, RpcSubscriptionIdResultSchema as Xn, getPKCAddressFromPublicKey as Xt, findCommentInPageInstanceRecursively as Y, RpcResolveAuthorNameResultSchema as Yn, getIpfsKeyFromPrivateKey as Yt, parseRawPages as Z, RpcSuccessResultSchema as Zn, getPKCAddressFromPublicKeySync as Zt, createAnchorIpnsRecord as _, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as _n, signCommentEdit as _t, pkcJsChallenges as a, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as an, n$5 as ar, PKCClientsManager as at, encryptEd25519AesGcm as b, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as bn, signCommentUpdateForChallengeVerification as bt, RemoteCommunity as c, parseCommunityAddressWithPKCErrorIfItFails as cn, t$8 as cr, pLimit as ct, decodeRpcChallengeAnswerPubsubMsg as d, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as dn, require_lodash_merge as dr, cleanUpBeforePublishing as dt, parseCidStringSchemaWithPKCErrorIfItFails as en, effectiveMaxCrosspostDepth as er, cloneCrosspostForRuntime as et, decodeRpcChallengePubsubMsg as f, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as fn, nativeFunctions$1 as fr, signChallengeAnswer as ft, createSigner as g, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as gn, signComment as gt, SignerWithPublicKeyAddress as h, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as hn, signChallengeVerification as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommentIpfsSchemaWithPKCErrorIfItFails as in, t$5 as ir, PublicationClientsManager as it, getDefaultCommunityDbConfig as j, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as jn, verifyCommentPubsubMessage as jt, deriveDbPosts as k, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as kn, verifyCommentIpfs as kt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as l, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ln, stringify as lr, PKCTypedEmitter as lt, decodeRpcChallengeVerificationPubsubMsg as m, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as mn, signChallengeRequest as mt, RpcRemoteCommunity as n, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nn, t$4 as nr, extractCrosspostRuntimeFields as nt, TrackedInstanceRegistry as o, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as on, n$6 as or, InflightFetchManager as ot, decodeRpcChallengeRequestPubsubMsg as p, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as pn, require_undici as pr, signChallengeMessage as pt, buildPagesRuntimeFields as q, RpcPublishChallengeAnswersParamSchema as qn, encode as qt, getChallengeVerification as r, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as rn, r as rr, stripNameResolvedFromCrosspost as rt, LRUCache as s, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as sn, t$7 as sr, pRetry as st, RpcLocalCommunity as t, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tn, t$2 as tr, collectCrosspostAuthorsToResolve as tt, KeyvBetterSqlite3 as u, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as un, STORAGE_KEYS as ur, require_lib$1 as ut, decryptEd25519AesGcm as v, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as vn, signCommentModeration as vt, calculateExpectedSignatureSize as w, parseDecryptedChallengeWithPKCErrorIfItFails as wn, verifyChallengeAnswer as wt, encryptEd25519AesGcmPublicKeyBuffer as x, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as xn, signCommunity as xt, decryptEd25519AesGcmPublicKeyBuffer as y, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as yn, signCommentUpdate as yt, setNativeFunctions as z, RpcEditCommunityParamSchema as zn, getAuthorNameFromWire as zt };
@@ -5237,6 +5237,15 @@ var messages;
5237
5237
  messages["ERR_QUOTED_CID_DOES_NOT_EXIST"] = "One or more quoted CIDs do not exist in this community";
5238
5238
  messages["ERR_QUOTED_CID_NOT_UNDER_POST"] = "One or more quoted CIDs are not under the same post";
5239
5239
  messages["ERR_QUOTED_CID_IS_PENDING_APPROVAL"] = "One or more quoted CIDs are pending approval";
5240
+ messages["ERR_CROSSPOST_CID_DOES_NOT_MATCH_EMBEDDED_COMMENT"] = "crosspost.cid is not the CID of the embedded crosspost.comment";
5241
+ messages["ERR_CROSSPOST_COMMENT_SIGNATURE_IS_INVALID"] = "The embedded crosspost.comment has an invalid author signature";
5242
+ messages["ERR_CROSSPOST_COMMENT_INCLUDES_RESERVED_FIELD"] = "The embedded crosspost.comment includes a reserved field";
5243
+ messages["ERR_CROSSPOST_COMMENT_AUTHOR_INCLUDES_RESERVED_FIELD"] = "The embedded crosspost.comment author includes a reserved field";
5244
+ messages["ERR_CROSSPOST_COMMENT_INCLUDES_SIGNABLE_FIELD_NOT_IN_SIGNED_PROPERTY_NAMES"] = "The embedded crosspost.comment includes an author-signable field that's not included in signature.signedPropertyNames";
5245
+ messages["ERR_COMMENT_IPFS_RECORD_INCLUDES_SIGNABLE_FIELD_NOT_IN_SIGNED_PROPERTY_NAMES"] = "CommentIpfs record includes an author-signable field that's not included in signature.signedPropertyNames";
5246
+ messages["ERR_CROSSPOST_CHAIN_EXCEEDS_MAX_DEPTH"] = "The crosspost chain is nested deeper than the protocol's maximum crosspost depth";
5247
+ messages["ERR_NOT_ALLOWED_TO_PUBLISH_CROSSPOSTS"] = "This community does not allow crossposts";
5248
+ messages["ERR_CROSSPOST_CHAIN_EXCEEDS_COMMUNITY_MAX_DEPTH"] = "The crosspost chain is nested deeper than this community's features.maxCrosspostDepth";
5240
5249
  messages["ERR_INVALID_COMMUNITY_IPFS_SCHEMA"] = "The loaded Community record has an invalid schema";
5241
5250
  messages["ERR_INVALID_COMMENT_UPDATE_SCHEMA"] = "The schema of Comment Update is invalid";
5242
5251
  messages["ERR_INVALID_PAGE_IPFS_SCHEMA"] = "The schema of Page ipfs file is invalid";
@@ -5412,7 +5421,7 @@ var messages;
5412
5421
  messages["ERR_COMMENT_CONTENT_CONTAINS_MARKDOWN_AUDIO"] = "This community does not allow embedding audio in markdown content";
5413
5422
  messages["ERR_REPLY_HAS_SPOILER_ENABLED"] = "This community does not allow authors to mark replies as spoilers";
5414
5423
  messages["ERR_NESTED_REPLIES_NOT_ALLOWED"] = "This community does not allow nested replies (depth > 1)";
5415
- messages["ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE"] = "Comment has no content, link or title";
5424
+ messages["ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE"] = "Comment has no content, link, title or crosspost";
5416
5425
  messages["ERR_COMMENT_EDIT_HAS_NO_EDIT_FIELD"] = "CommentEdit has no editable field. At least one of content, deleted, flairs, spoiler or nsfw must be defined";
5417
5426
  messages["ERR_COMMENT_MODERATION_HAS_NO_MODERATION_FIELD"] = "CommentModeration has no moderation field. At least one moderation field other than reason must be defined";
5418
5427
  messages["ERR_REQUEST_ENCRYPTED_IS_INVALID_JSON_AFTER_DECRYPTION"] = "request.encrypted is an invalid json after decrypting";
@@ -6304,6 +6313,10 @@ const GetPageParamSchema = object({ cid: CidStringSchema });
6304
6313
  //#endregion
6305
6314
  //#region dist/node/publications/comment/schema.js
6306
6315
  const CommentContentSchema = string();
6316
+ const CrosspostSchema = object({
6317
+ cid: CidStringSchema,
6318
+ comment: lazy(() => CommentIpfsSchema.loose())
6319
+ });
6307
6320
  const CreateCommentOptionsSchema = object({
6308
6321
  flairs: FlairSchema.array().optional(),
6309
6322
  spoiler: boolean().optional(),
@@ -6316,15 +6329,16 @@ const CreateCommentOptionsSchema = object({
6316
6329
  linkHtmlTagName: string().min(1).optional(),
6317
6330
  parentCid: CidStringSchema.optional(),
6318
6331
  postCid: CidStringSchema.optional(),
6319
- quotedCids: array(CidStringSchema).optional()
6332
+ quotedCids: array(CidStringSchema).optional(),
6333
+ crosspost: CrosspostSchema.optional()
6320
6334
  }).merge(CreatePublicationUserOptionsSchema).strict();
6321
- const CreateCommentOptionsWithRefinementSchema = CreateCommentOptionsSchema.refine((arg) => arg.link || arg.content || arg.title, messages.ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE).refine((arg) => arg.parentCid ? arg.postCid : true, messages.ERR_REPLY_HAS_NOT_DEFINED_POST_CID).refine(hasAtLeastOneCommunityIdentifier, atLeastOneCommunityIdentifierMessage);
6335
+ const CreateCommentOptionsWithRefinementSchema = CreateCommentOptionsSchema.refine((arg) => arg.link || arg.content || arg.title || arg.crosspost, messages.ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE).refine((arg) => arg.parentCid ? arg.postCid : true, messages.ERR_REPLY_HAS_NOT_DEFINED_POST_CID).refine(hasAtLeastOneCommunityIdentifier, atLeastOneCommunityIdentifierMessage);
6322
6336
  const CommentSignedPropertyNames = t$3(n$3(CreateCommentOptionsSchema.shape, keysToOmitFromSignedPropertyNames));
6323
6337
  const commentPubsubKeys = t$2([...CommentSignedPropertyNames, "signature"], (x) => [x, true]);
6324
6338
  const CommentPubsubMessagePublicationSchema = CreateCommentOptionsSchema.merge(PublicationBaseBeforeSigning).extend({ signature: JsonSignatureSchema }).pick(commentPubsubKeys).strict();
6325
6339
  const CommentPubsubMessageWithFlexibleAuthorSchema = CommentPubsubMessagePublicationSchema.merge(object({ author: AuthorPubsubSchema.loose().optional() })).strict();
6326
- const CommentPubsubMessageWithFlexibleAuthorRefinementSchema = CommentPubsubMessageWithFlexibleAuthorSchema.loose().refine((arg) => arg.link || arg.content || arg.title, messages.ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE);
6327
- CommentPubsubMessagePublicationSchema.refine((arg) => arg.link || arg.content || arg.title, messages.ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE).refine((arg) => arg.parentCid ? arg.postCid : true, messages.ERR_REPLY_HAS_NOT_DEFINED_POST_CID);
6340
+ const CommentPubsubMessageWithFlexibleAuthorRefinementSchema = CommentPubsubMessageWithFlexibleAuthorSchema.loose().refine((arg) => arg.link || arg.content || arg.title || arg.crosspost, messages.ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE);
6341
+ CommentPubsubMessagePublicationSchema.refine((arg) => arg.link || arg.content || arg.title || arg.crosspost, messages.ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE).refine((arg) => arg.parentCid ? arg.postCid : true, messages.ERR_REPLY_HAS_NOT_DEFINED_POST_CID);
6328
6342
  const CommentChallengeRequestToEncryptSchema = CreateCommentOptionsSchema.shape.challengeRequest.unwrap().extend({ comment: CommentPubsubMessageWithFlexibleAuthorSchema.loose() }).strict();
6329
6343
  const CommentIpfsSchema = CommentPubsubMessageWithFlexibleAuthorSchema.extend({
6330
6344
  depth: number().nonnegative().int(),
@@ -6338,7 +6352,7 @@ const CommentIpfsSchema = CommentPubsubMessageWithFlexibleAuthorSchema.extend({
6338
6352
  "per-author"
6339
6353
  ]).optional()
6340
6354
  }).strict();
6341
- CommentIpfsSchema.refine((arg) => arg.link || arg.content || arg.title, messages.ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE);
6355
+ CommentIpfsSchema.refine((arg) => arg.link || arg.content || arg.title || arg.crosspost, messages.ERR_COMMENT_HAS_NO_CONTENT_LINK_TITLE);
6342
6356
  const AuthorWithCommentUpdateSchema = CommentPubsubMessagePublicationSchema.shape.author.unwrap().extend({ community: CommunityAuthorSchema.optional() }).loose();
6343
6357
  const CommentUpdateSchema = object({
6344
6358
  cid: CidStringSchema,
@@ -6540,6 +6554,7 @@ const CommunityFeaturesSchema = looseObject({
6540
6554
  noReplyLinks: boolean().optional(),
6541
6555
  noPolls: boolean().optional(),
6542
6556
  noCrossposts: boolean().optional(),
6557
+ maxCrosspostDepth: number().int().nonnegative().optional(),
6543
6558
  noNestedReplies: boolean().optional(),
6544
6559
  safeForWork: boolean().optional(),
6545
6560
  authorFlairs: boolean().optional(),
@@ -16063,14 +16078,14 @@ function extractNetworkErrorDetails(err, depth = 0) {
16063
16078
  }
16064
16079
  //#endregion
16065
16080
  //#region dist/node/generated-version.js
16066
- const version = "0.0.81";
16081
+ const version = "0.0.83";
16067
16082
  //#endregion
16068
16083
  //#region dist/node/version.js
16069
16084
  const protocolVersion = ProtocolVersionSchema.parse("1.0.0");
16070
16085
  const pkcJsVersion = version;
16071
16086
  var version_default = {
16072
16087
  PKC_JS_VERSION: pkcJsVersion,
16073
- DB_VERSION: 40,
16088
+ DB_VERSION: 41,
16074
16089
  PROTOCOL_VERSION: protocolVersion,
16075
16090
  USER_AGENT: UserAgentSchema.parse(`/pkc-js:${pkcJsVersion}/`)
16076
16091
  };
@@ -1,4 +1,4 @@
1
- import { et as pubsubTopicToDhtKeyCid, vr as PKCError } from "./schema-DZyEx0YQ.js";
1
+ import { et as pubsubTopicToDhtKeyCid, vr as PKCError } from "./schema-mdv9_FG5.js";
2
2
  import { ipnsSelector } from "ipns/selector";
3
3
  import { equals } from "uint8arrays/equals";
4
4
  //#region dist/node/helia/util.js
@@ -1,2 +1,2 @@
1
- import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-BCXmIYLQ.js";
1
+ import { a as getShortCid, i as getShortAddress, n as challenges, o as nativeFunctions, r as createAnchorIpnsRecord, s as setNativeFunctions, t as PKC } from "./chunks/node-lb4SvdBh.js";
2
2
  export { challenges, createAnchorIpnsRecord, PKC as default, getShortAddress, getShortCid, nativeFunctions, setNativeFunctions };
@@ -1,7 +1,7 @@
1
- import { $n as n, L as hideClassPrivateProps, br as logger_default, st as replaceXWithY, tr as t, vr as PKCError, xt as findStartedCommunity } from "../../chunks/schema-DZyEx0YQ.js";
2
- import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-BCXmIYLQ.js";
3
- import { K as buildPageRuntimeFields, Tn as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Xt as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, Yn as t$1, Zt as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, _n as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, an as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, at as require_lib, en as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, fn as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, in as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, nr as stringify, nt as pRetry, pn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails, q as buildPagesRuntimeFields, rt as pLimit, wn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-BOiy8BX1.js";
4
- import { t as LocalCommunity } from "../../chunks/local-community-CyX1HwD0.js";
1
+ import { $n as n, L as hideClassPrivateProps, br as logger_default, st as replaceXWithY, tr as t, vr as PKCError, xt as findStartedCommunity } from "../../chunks/schema-mdv9_FG5.js";
2
+ import { _ as parseRpcPublishAnchorRecordParam, c as parseRpcAuthorNameParam, d as parseRpcCommentRepliesPageParam, f as parseRpcCommunityIdentifierParam, g as parseRpcExportCommunityParam, h as parseRpcExportCommunityModLogsParam, l as parseRpcCancelExportParam, m as parseRpcEditCommunityParam, p as parseRpcCommunityPageParam, t as PKC, u as parseRpcCidParam, v as parseRpcPublishChallengeAnswersParam, y as parseRpcUnsubscribeParam } from "../../chunks/node-lb4SvdBh.js";
3
+ import { An as parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, K as buildPageRuntimeFields, Sn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, _n as parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails, an as parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, ct as pLimit, kn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, ln as parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, lr as stringify, nn as parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, nr as t$1, nt as extractCrosspostRuntimeFields, q as buildPagesRuntimeFields, st as pRetry, tn as parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails, un as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, ut as require_lib, vn as parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails } from "../../chunks/rpc-local-community-a464veDe.js";
4
+ import { t as LocalCommunity } from "../../chunks/local-community-DJM47U8C.js";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import path from "path";
7
7
  import assert from "assert";
@@ -833,9 +833,13 @@ var PKCWsServer = class extends import_lib.TypedEmitter {
833
833
  const comment = await pkc.createComment(parsedCommentUpdateArgs);
834
834
  const sendUpdate = () => {
835
835
  if (!sentCommentIpfsUpdateEvent && comment.raw.comment) {
836
+ const crosspostRuntimeFields = comment.crosspost ? extractCrosspostRuntimeFields(comment.crosspost) : void 0;
836
837
  sendEvent("comment", {
837
838
  comment: comment.raw.comment,
838
- runtimeFields: { author: { nameResolved: comment.author.nameResolved } }
839
+ runtimeFields: {
840
+ author: { nameResolved: comment.author.nameResolved },
841
+ ...crosspostRuntimeFields ? { crosspost: crosspostRuntimeFields } : {}
842
+ }
839
843
  });
840
844
  sentCommentIpfsUpdateEvent = true;
841
845
  lastSentNameResolved = comment.author.nameResolved;
@@ -845,6 +849,10 @@ var PKCWsServer = class extends import_lib.TypedEmitter {
845
849
  const runtimeFields = {};
846
850
  if (comment.raw.commentUpdate.replies?.pages) runtimeFields.replies = { pages: buildPagesRuntimeFields(comment.raw.commentUpdate.replies.pages, pkc._memCaches.nameResolvedCache) };
847
851
  if (typeof comment.author.nameResolved === "boolean") runtimeFields.author = { nameResolved: comment.author.nameResolved };
852
+ if (comment.crosspost) {
853
+ const crosspostRuntimeFields = extractCrosspostRuntimeFields(comment.crosspost);
854
+ if (crosspostRuntimeFields) runtimeFields.crosspost = crosspostRuntimeFields;
855
+ }
848
856
  if (Object.keys(runtimeFields).length > 0) updateEvent.runtimeFields = runtimeFields;
849
857
  sendEvent("update", updateEvent);
850
858
  lastSentNameResolved = comment.author.nameResolved;