@pkcprotocol/pkc-js 0.0.125 → 0.0.126

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 (99) hide show
  1. package/dist/browser/community/community-client-manager.js +30 -9
  2. package/dist/browser/community/community-client-manager.js.map +1 -1
  3. package/dist/browser/community/community-wire.d.ts +6 -0
  4. package/dist/browser/community/community-wire.js +22 -1
  5. package/dist/browser/community/community-wire.js.map +1 -1
  6. package/dist/browser/community/remote-community.d.ts +7 -1
  7. package/dist/browser/community/remote-community.js +87 -11
  8. package/dist/browser/community/remote-community.js.map +1 -1
  9. package/dist/browser/community/rpc-remote-community.d.ts +1 -0
  10. package/dist/browser/community/rpc-remote-community.js +41 -6
  11. package/dist/browser/community/rpc-remote-community.js.map +1 -1
  12. package/dist/browser/community/schema.js +7 -1
  13. package/dist/browser/community/schema.js.map +1 -1
  14. package/dist/browser/errors.d.ts +1 -0
  15. package/dist/browser/errors.js +1 -0
  16. package/dist/browser/errors.js.map +1 -1
  17. package/dist/browser/generated-version.d.ts +1 -1
  18. package/dist/browser/generated-version.js +1 -1
  19. package/dist/browser/pkc/tracked-instance-registry-util.d.ts +1 -0
  20. package/dist/browser/pkc/tracked-instance-registry-util.js +34 -2
  21. package/dist/browser/pkc/tracked-instance-registry-util.js.map +1 -1
  22. package/dist/browser/pkc/tracked-instance-registry.d.ts +1 -0
  23. package/dist/browser/pkc/tracked-instance-registry.js +15 -0
  24. package/dist/browser/pkc/tracked-instance-registry.js.map +1 -1
  25. package/dist/browser/pkc-error.d.ts +1 -1
  26. package/dist/browser/publications/comment/comment-client-manager.d.ts +1 -0
  27. package/dist/browser/publications/comment/comment-client-manager.js +24 -4
  28. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  29. package/dist/browser/publications/comment/comment.js +6 -2
  30. package/dist/browser/publications/comment/comment.js.map +1 -1
  31. package/dist/browser/publications/publication-client-manager.d.ts +4 -1
  32. package/dist/browser/publications/publication-client-manager.js +51 -7
  33. package/dist/browser/publications/publication-client-manager.js.map +1 -1
  34. package/dist/browser/publications/publication.js +15 -1
  35. package/dist/browser/publications/publication.js.map +1 -1
  36. package/dist/browser/runtime/node/community/local-community/comment-updates.js +2 -1
  37. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  38. package/dist/browser/test/test-util.d.ts +1 -0
  39. package/dist/browser/test/test-util.js +6 -2
  40. package/dist/browser/test/test-util.js.map +1 -1
  41. package/dist/browser/util.js +6 -1
  42. package/dist/browser/util.js.map +1 -1
  43. package/dist/bundled/bundle-manifest.json +42 -42
  44. package/dist/bundled/challenges.js +1 -1
  45. package/dist/bundled/chunks/{helia-for-pkc-DXygdFt-.js → helia-for-pkc-vQZvQcs_.js} +2 -2
  46. package/dist/bundled/chunks/{local-community-D4I0gLqX.js → local-community-51NzNBUS.js} +4 -4
  47. package/dist/bundled/chunks/{local-community-Bbqx5IaD.js → local-community-dcM1R3k5.js} +1 -1
  48. package/dist/bundled/chunks/{node-oqffR7Bn.js → node-agDtcKUp.js} +69 -16
  49. package/dist/bundled/chunks/{page-sort-scoring-CK4vshII.js → page-sort-scoring-BSBLegpC.js} +1 -1
  50. package/dist/bundled/chunks/{rpc-local-community-UpO9cs7k.js → rpc-local-community-DOcUqswi.js} +332 -239
  51. package/dist/bundled/chunks/{util-D3vx4Na0.js → util-DNYbha6W.js} +1 -1
  52. package/dist/bundled/chunks/{util-nmnnrzbz.js → util-PGPkG-gU.js} +33 -6
  53. package/dist/bundled/chunks/{validate-package-factories-DkJmLpRe.js → validate-package-factories-2U8SCIxZ.js} +2 -2
  54. package/dist/bundled/index.js +1 -1
  55. package/dist/bundled/page-sorts.js +1 -1
  56. package/dist/bundled/rpc/src/index.js +4 -4
  57. package/dist/node/community/community-client-manager.js +30 -9
  58. package/dist/node/community/community-client-manager.js.map +1 -1
  59. package/dist/node/community/community-wire.d.ts +6 -0
  60. package/dist/node/community/community-wire.js +22 -1
  61. package/dist/node/community/community-wire.js.map +1 -1
  62. package/dist/node/community/remote-community.d.ts +7 -1
  63. package/dist/node/community/remote-community.js +87 -11
  64. package/dist/node/community/remote-community.js.map +1 -1
  65. package/dist/node/community/rpc-remote-community.d.ts +1 -0
  66. package/dist/node/community/rpc-remote-community.js +41 -6
  67. package/dist/node/community/rpc-remote-community.js.map +1 -1
  68. package/dist/node/community/schema.js +7 -1
  69. package/dist/node/community/schema.js.map +1 -1
  70. package/dist/node/errors.d.ts +1 -0
  71. package/dist/node/errors.js +1 -0
  72. package/dist/node/errors.js.map +1 -1
  73. package/dist/node/generated-version.d.ts +1 -1
  74. package/dist/node/generated-version.js +1 -1
  75. package/dist/node/pkc/tracked-instance-registry-util.d.ts +1 -0
  76. package/dist/node/pkc/tracked-instance-registry-util.js +34 -2
  77. package/dist/node/pkc/tracked-instance-registry-util.js.map +1 -1
  78. package/dist/node/pkc/tracked-instance-registry.d.ts +1 -0
  79. package/dist/node/pkc/tracked-instance-registry.js +15 -0
  80. package/dist/node/pkc/tracked-instance-registry.js.map +1 -1
  81. package/dist/node/pkc-error.d.ts +1 -1
  82. package/dist/node/publications/comment/comment-client-manager.d.ts +1 -0
  83. package/dist/node/publications/comment/comment-client-manager.js +24 -4
  84. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  85. package/dist/node/publications/comment/comment.js +6 -2
  86. package/dist/node/publications/comment/comment.js.map +1 -1
  87. package/dist/node/publications/publication-client-manager.d.ts +4 -1
  88. package/dist/node/publications/publication-client-manager.js +51 -7
  89. package/dist/node/publications/publication-client-manager.js.map +1 -1
  90. package/dist/node/publications/publication.js +15 -1
  91. package/dist/node/publications/publication.js.map +1 -1
  92. package/dist/node/runtime/node/community/local-community/comment-updates.js +2 -1
  93. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  94. package/dist/node/test/test-util.d.ts +1 -0
  95. package/dist/node/test/test-util.js +6 -2
  96. package/dist/node/test/test-util.js.map +1 -1
  97. package/dist/node/util.js +6 -1
  98. package/dist/node/util.js.map +1 -1
  99. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $n as CommentEditSignedPropertyNames, $r as union, $t as CommentModerationChallengeRequestToEncryptSchema, A as isIpnsPath, An as CommentChallengeRequestToEncryptSchema, Ar as require_retry$1, At as ChallengeAnswerMessageSignedPropertyNames, Bn as CommentUpdateSchema, Br as require_ms$1, Bt as DecryptedChallengeSchema, C as hideClassPrivateProps, Cn as isStringDomain, Cr as r$8, Ct as untrackStartedCommunity, D as isIpfsCid, Dr as t$10, E as isAbortError, En as VotePubsubMessagePublicationSchema, Er as r$7, Et as require_sha256$1, Fn as CommentSignedPropertyNames, Fr as FailedToFetchPageIpfsFromGatewaysError, Gn as GetPageParamSchema, Gr as custom, Gt as PKCUserOptionBaseSchema, Hr as _enum, Ht as NameResolveCacheOptionsSchema, In as CommentUpdateChallengeReservedFieldNames, Ir as PKCError, It as ChallengeVerificationMessageSignedPropertyNames, Jn as isReservedObjectKey, Jr as number, Jt as CommunityEditPublicationChallengeRequestToEncryptSchema, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as ModQueuePageIpfsSchema, Kr as literal, Kt as PKCUserOptionsSchema, L as isRequestPubsubPublicationOfPost, Lr as messages, Lt as DecryptedChallengeAnswerSchema, Mn as CommentIpfsSchema, Mr as FailedToFetchCommentUpdateFromGatewaysError, Mt as ChallengeMessageSignedPropertyNames, Nr as FailedToFetchCommunityFromGatewaysError, O as isIpfsPath, On as VoteSignedPropertyNames, Or as t$9, Ot as pTimeout, Pn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Pr as FailedToFetchGenericIpfsFromGatewaysError, Pt as ChallengeRequestMessageSignedPropertyNames, Qr as string, Qt as CreateCommunityEditPublicationOptionsWithRefinementSchema, R as isRequestPubsubPublicationOfReply, Rn as CommentUpdateForChallengeVerificationSignedPropertyNames, Rr as logger_default, S as hasTransientNetworkErrorCode, Sn as areEquivalentNames, Sr as t$11, St as trackUpdatingCommunity, T as ipnsNameToIpnsOverPubsubTopic, Tn as VoteChallengeRequestToEncryptSchema, Tr as n$8, Tt as untrackUpdatingCommunity, Ur as array, Ut as NameResolverSerializedSchema, V as raceAgainstAbort, Vn as CommentUpdateSignedPropertyNames, Vt as DecryptedChallengeVerificationSchema, Wn as CreateCommentOptionsWithRefinementSchema, Wr as boolean, Wt as PKCParsedOptionsSchema, Xr as preprocess, Xt as CommunityEditPublicationSignedPropertyNames, Yn as CommentEditChallengeRequestToEncryptSchema, Yr as object, Zn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Zr as record, Zt as CommunityEditPubsubMessagePublicationSchema, _n as ExportCommunityModLogsOptionsSchema, _r as n$10, an as ChallengeFileFactorySchema, ar as AuthorReservedFields, at as timestamp, br as e$6, bt as trackStartedCommunity, cn as CommunityChallengeSettingSchema, cr as CidStringSchema, d as deepMergeRuntimeFields, dn as CommunityIpfsReservedFields, dr as CreateSignerSchema, dt as findStartedCommunity, en as CommentModerationPubsubMessagePublicationSchema, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsSchema, fr as JsonSignatureSchema, gn as CreateRpcCommunityFunctionArgumentSchema, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateRemoteCommunityFunctionArgumentSchema, hr as n$9, in as CreateCommentModerationOptionsWithRefinementSchema, ir as AuthorPubsubSchema, it as throwIfAbortSignalAborted, jn as CommentIpfsReservedFields, jr as FailedToFetchCommentIpfsFromGatewaysError, k as isIpns, kr as e$4, ln as CommunityEditOptionsSchema, lr as CommunityAddressSchema, m as extractNetworkErrorDetails, mn as CreateNewLocalCommunityUserOptionsSchema, mr as ProtocolVersionSchema, nn as CommentModerationSignedPropertyNames, nr as AuthorAddressSchema, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileSchema, or as ChallengeAnswersSchema, p as doesDomainAddressHaveCapitalLetter, pn as CommunitySignedPropertyNames, pr as PKCTimestampSchema, pt as findUpdatingCommunity, qn as PageIpfsSchema, qr as looseObject, r as calculateIpfsCidV0, rn as CommentModerationsTableRowSchema, rr as AuthorCommentIpfsReservedFields, sr as CidPathSchema, t as areEquivalentCommunityAddresses, tr as CreateCommentEditOptionsWithRefinementSchema, tt as shortifyCid, u as createAbortError, un as CommunityExportRecordsSchema, ur as CommunityAuthorChallengeReservedFieldNames, vn as PageSortFileFactorySchema, vt as refreshTrackedCommunityAliases, w as interruptibleSleep, wn as CreateVoteUserOptionsWithRefinementSchema, wr as t$12, xn as RpcRemoteCommunityUpdateEventResultSchema, xr as e$5, yn as PageSortFileSchema, yr as t$13, z as pubsubTopicToDhtKey, zn as CommentUpdateReservedFields, zr as require_supports_color } from "./util-nmnnrzbz.js";
2
+ import { $r as string, $t as CreateCommunityEditPublicationOptionsWithRefinementSchema, A as isIpnsPath, Ar as e$4, Bn as CommentUpdateReservedFields, Br as require_supports_color, C as hideClassPrivateProps, Cn as areEquivalentNames, Cr as t$11, Ct as trackUpdatingCommunity, D as isIpfsCid, Dn as VotePubsubMessagePublicationSchema, Dr as r$7, Dt as require_sha256$1, E as isAbortError, En as VoteChallengeRequestToEncryptSchema, Er as n$8, Et as untrackUpdatingCommunity, Fn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Fr as FailedToFetchGenericIpfsFromGatewaysError, Ft as ChallengeRequestMessageSignedPropertyNames, Gn as CreateCommentOptionsWithRefinementSchema, Gr as boolean, Gt as PKCParsedOptionsSchema, Hn as CommentUpdateSignedPropertyNames, Ht as DecryptedChallengeVerificationSchema, In as CommentSignedPropertyNames, Ir as FailedToFetchPageIpfsFromGatewaysError, Jn as PageIpfsSchema, Jr as looseObject, K as removeNullUndefinedEmptyObjectsValuesRecursively, Kn as GetPageParamSchema, Kr as custom, Kt as PKCUserOptionBaseSchema, L as isRequestPubsubPublicationOfPost, Ln as CommentUpdateChallengeReservedFieldNames, Lr as PKCError, Lt as ChallengeVerificationMessageSignedPropertyNames, Mn as CommentIpfsReservedFields, Mr as FailedToFetchCommentIpfsFromGatewaysError, Nn as CommentIpfsSchema, Nr as FailedToFetchCommentUpdateFromGatewaysError, Nt as ChallengeMessageSignedPropertyNames, O as isIpfsPath, Or as t$10, Pr as FailedToFetchCommunityFromGatewaysError, Qn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Qr as record, Qt as CommunityEditPubsubMessagePublicationSchema, R as isRequestPubsubPublicationOfReply, Rr as messages, Rt as DecryptedChallengeAnswerSchema, S as hasTransientNetworkErrorCode, Sn as RpcRemoteCommunityUpdateEventResultSchema, Sr as e$5, T as ipnsNameToIpnsOverPubsubTopic, Tn as CreateVoteUserOptionsWithRefinementSchema, Tr as t$12, Ur as _enum, Ut as NameResolveCacheOptionsSchema, V as raceAgainstAbort, Vn as CommentUpdateSchema, Vr as require_ms$1, Vt as DecryptedChallengeSchema, Wr as array, Wt as NameResolverSerializedSchema, Xn as CommentEditChallengeRequestToEncryptSchema, Xr as object, Yn as isReservedObjectKey, Yr as number, Yt as CommunityEditPublicationChallengeRequestToEncryptSchema, Zr as preprocess, Zt as CommunityEditPublicationSignedPropertyNames, _n as CreateRpcCommunityFunctionArgumentSchema, an as CreateCommentModerationOptionsWithRefinementSchema, ar as AuthorPubsubSchema, at as timestamp, bn as PageSortFileSchema, br as t$13, cr as CidPathSchema, d as deepMergeRuntimeFields, dn as CommunityExportRecordsSchema, dr as CommunityAuthorChallengeReservedFieldNames, dt as findStartedCommunity, ei as union, en as CommentModerationChallengeRequestToEncryptSchema, er as CommentEditSignedPropertyNames, et as shortifyAddress, f as derivePublicationFromChallengeRequest, fn as CommunityIpfsReservedFields, fr as CreateSignerSchema, gn as CreateRemoteCommunityFunctionArgumentSchema, gr as n$9, h as fetchAndValidateIpnsRecordFromGateway, hn as CreateNewLocalCommunityUserOptionsSchema, hr as ProtocolVersionSchema, in as CommentModerationsTableRowSchema, ir as AuthorCommentIpfsReservedFields, it as throwIfAbortSignalAborted, jn as CommentChallengeRequestToEncryptSchema, jr as require_retry$1, jt as ChallengeAnswerMessageSignedPropertyNames, k as isIpns, kn as VoteSignedPropertyNames, kr as t$9, kt as pTimeout, ln as CommunityChallengeSettingSchema, lr as CidStringSchema, m as extractNetworkErrorDetails, mn as CommunitySignedPropertyNames, mr as PKCTimestampSchema, mt as forgetTrackedUpdatingCommunityName, nr as CreateCommentEditOptionsWithRefinementSchema, nt as sleepUntilTimeoutOrAbort, on as ChallengeFileFactorySchema, or as AuthorReservedFields, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pr as JsonSignatureSchema, pt as findUpdatingCommunity, qn as ModQueuePageIpfsSchema, qr as literal, qt as PKCUserOptionsSchema, r as calculateIpfsCidV0, rn as CommentModerationSignedPropertyNames, rr as AuthorAddressSchema, sn as ChallengeFileSchema, sr as ChallengeAnswersSchema, t as areEquivalentCommunityAddresses, tn as CommentModerationPubsubMessagePublicationSchema, tt as shortifyCid, u as createAbortError, un as CommunityEditOptionsSchema, ur as CommunityAddressSchema, vn as ExportCommunityModLogsOptionsSchema, vr as n$10, w as interruptibleSleep, wn as isStringDomain, wr as r$8, wt as untrackStartedCommunity, xr as e$6, xt as trackStartedCommunity, yn as PageSortFileFactorySchema, yt as refreshTrackedCommunityAliases, z as pubsubTopicToDhtKey, zn as CommentUpdateForChallengeVerificationSignedPropertyNames, zr as logger_default } from "./util-PGPkG-gU.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
- import { s as validatePageSortFile } from "./page-sort-scoring-CK4vshII.js";
4
+ import { s as validatePageSortFile } from "./page-sort-scoring-BSBLegpC.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import dns from "node:dns";
@@ -122351,6 +122351,36 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
122351
122351
  exports.TypedEmitter = __require("events").EventEmitter;
122352
122352
  }));
122353
122353
  //#endregion
122354
+ //#region dist/node/community/community-wire.js
122355
+ var import_lib = require_lib();
122356
+ const runtimeOnlyCommunityFields = [
122357
+ "address",
122358
+ "publicKey",
122359
+ "shortAddress",
122360
+ "nameResolved"
122361
+ ];
122362
+ function omitRuntimeCommunityFields(community) {
122363
+ if (!community) return {};
122364
+ return n$10(community, runtimeOnlyCommunityFields);
122365
+ }
122366
+ function getCommunityNameFromWire(community) {
122367
+ const wireCommunity = omitRuntimeCommunityFields(community);
122368
+ if (typeof wireCommunity.name === "string") return wireCommunity.name;
122369
+ if (typeof community?.address === "string" && isStringDomain(community.address)) return community.address;
122370
+ }
122371
+ function findCommunityRecordNameMismatch(opts) {
122372
+ if (!opts.requestedName) return void 0;
122373
+ const recordName = getCommunityNameFromWire(opts.record);
122374
+ if (recordName && areEquivalentCommunityAddresses(recordName, opts.requestedName)) return void 0;
122375
+ return new PKCError("ERR_COMMUNITY_RECORD_NAME_DOES_NOT_MATCH_REQUESTED_NAME", {
122376
+ requestedName: opts.requestedName,
122377
+ recordName,
122378
+ communityPublicKey: opts.communityPublicKey,
122379
+ recordUpdatedAt: opts.record.updatedAt,
122380
+ retriableError: true
122381
+ });
122382
+ }
122383
+ //#endregion
122354
122384
  //#region dist/node/clients/rpc-client/schema.js
122355
122385
  const SubscriptionIdSchema = number().positive().int();
122356
122386
  const RpcCommentEventResultSchema = object({
@@ -122971,7 +123001,6 @@ function unwrapSchema(schema, seen = /* @__PURE__ */ new Set()) {
122971
123001
  }
122972
123002
  //#endregion
122973
123003
  //#region dist/node/clients/rpc-client/decode-rpc-response-util.js
122974
- var import_lib = require_lib();
122975
123004
  function _decodeChallengeRequestId(requestId) {
122976
123005
  return fromString(requestId, "base58btc");
122977
123006
  }
@@ -125495,224 +125524,6 @@ var ModQueuePages = class extends BasePages {
125495
125524
  }
125496
125525
  };
125497
125526
  //#endregion
125498
- //#region dist/node/runtime/node/community/keyv-better-sqlite3.js
125499
- /**
125500
- * A KeyvStoreAdapter implementation using better-sqlite3 directly
125501
- */
125502
- var KeyvBetterSqlite3 = class extends EventEmitter$1 {
125503
- constructor(db, options = {}) {
125504
- super();
125505
- this.ttlSupport = true;
125506
- this.db = db;
125507
- this.opts = {
125508
- table: "keyv",
125509
- keySize: 255,
125510
- createTable: true,
125511
- dialect: "sqlite",
125512
- url: `sqlite://${db.name}`,
125513
- ...options
125514
- };
125515
- if (this.opts.createTable) try {
125516
- this.db.exec(`
125517
- CREATE TABLE IF NOT EXISTS ${this.opts.table} (
125518
- key TEXT PRIMARY KEY,
125519
- value TEXT
125520
- )
125521
- `);
125522
- } catch (error) {
125523
- throw error;
125524
- }
125525
- }
125526
- /**
125527
- * Get a value from the store
125528
- */
125529
- get(key) {
125530
- try {
125531
- const row = this.db.prepare(`SELECT * FROM ${this.opts.table} WHERE key = ?`).get("keyv:" + key);
125532
- if (!row) return;
125533
- const parsed = JSON.parse(row.value);
125534
- if (parsed.expires && parsed.expires <= Date.now()) {
125535
- try {
125536
- this.delete(key);
125537
- } catch (e) {
125538
- e.details = {
125539
- ...e.details,
125540
- row,
125541
- parsed,
125542
- key
125543
- };
125544
- this.emit("error", e);
125545
- }
125546
- return;
125547
- }
125548
- return parsed.value;
125549
- } catch (error) {
125550
- throw error;
125551
- }
125552
- }
125553
- /**
125554
- * Get multiple values from the store
125555
- */
125556
- getMany(keys) {
125557
- try {
125558
- const placeholders = keys.map(() => "?").join(",");
125559
- const rows = this.db.prepare(`
125560
- SELECT * FROM ${this.opts.table}
125561
- WHERE key IN (${placeholders})
125562
- `).all(...keys.map((key) => "keyv:" + key));
125563
- const now = Date.now();
125564
- return keys.map((key) => {
125565
- const row = rows.find((r) => r.key === "keyv:" + key);
125566
- if (!row) return void 0;
125567
- try {
125568
- const parsed = JSON.parse(row.value);
125569
- if (parsed.expires && parsed.expires <= now) {
125570
- try {
125571
- this.delete(key);
125572
- } catch (err) {
125573
- this.emit("error", err);
125574
- }
125575
- return;
125576
- }
125577
- return parsed.value;
125578
- } catch (e) {
125579
- return;
125580
- }
125581
- });
125582
- } catch (error) {
125583
- throw error;
125584
- }
125585
- }
125586
- /**
125587
- * Set a value in the store
125588
- */
125589
- set(key, value, ttl) {
125590
- try {
125591
- const expires = typeof ttl === "number" ? Date.now() + ttl : null;
125592
- const valueWithExpires = {
125593
- value,
125594
- ...expires && { expires }
125595
- };
125596
- return this.db.prepare(`
125597
- INSERT INTO ${this.opts.table} (key, value)
125598
- VALUES (?, ?)
125599
- ON CONFLICT(key)
125600
- DO UPDATE SET value = excluded.value
125601
- `).run("keyv:" + key, JSON.stringify(valueWithExpires));
125602
- } catch (error) {
125603
- throw error;
125604
- }
125605
- }
125606
- /**
125607
- * Delete a value from the store
125608
- */
125609
- delete(key) {
125610
- try {
125611
- return this.db.prepare(`DELETE FROM ${this.opts.table} WHERE key = ?`).run("keyv:" + key).changes > 0;
125612
- } catch (error) {
125613
- throw error;
125614
- }
125615
- }
125616
- /**
125617
- * Delete multiple values from the store
125618
- */
125619
- deleteMany(keys) {
125620
- try {
125621
- const placeholders = keys.map(() => "?").join(",");
125622
- return this.db.prepare(`DELETE FROM ${this.opts.table} WHERE key IN (${placeholders})`).run(...keys.map((key) => "keyv:" + key)).changes > 0;
125623
- } catch (error) {
125624
- throw error;
125625
- }
125626
- }
125627
- /**
125628
- * Clear all values from the store
125629
- */
125630
- clear() {
125631
- try {
125632
- const stmt = this.db.prepare(this.namespace ? `DELETE FROM ${this.opts.table} WHERE key LIKE ?` : `DELETE FROM ${this.opts.table}`);
125633
- if (this.namespace) stmt.run(`${this.namespace}:%`);
125634
- else stmt.run();
125635
- } catch (error) {
125636
- throw error;
125637
- }
125638
- }
125639
- /**
125640
- * Check if a key exists in the store
125641
- */
125642
- has(key) {
125643
- try {
125644
- const row = this.db.prepare(`SELECT value FROM ${this.opts.table} WHERE key = ?`).get("keyv:" + key);
125645
- if (!row) return false;
125646
- try {
125647
- const parsed = JSON.parse(row.value);
125648
- if (parsed.expires && parsed.expires <= Date.now()) {
125649
- try {
125650
- this.delete(key);
125651
- } catch (err) {
125652
- this.emit("error", err);
125653
- }
125654
- return false;
125655
- }
125656
- return true;
125657
- } catch (e) {
125658
- return false;
125659
- }
125660
- } catch (error) {
125661
- throw error;
125662
- }
125663
- }
125664
- /**
125665
- * Iterate over all values in the store
125666
- * Note: Even though better-sqlite3 is synchronous, we need to keep this
125667
- * as an async generator to comply with the KeyvStoreAdapter interface
125668
- */
125669
- async *iterator(namespace) {
125670
- const ns = namespace || this.namespace;
125671
- const pattern = ns ? `${ns}:%` : "%";
125672
- const now = Date.now();
125673
- try {
125674
- const rows = this.db.prepare(`SELECT key, value FROM ${this.opts.table} WHERE key LIKE ?`).all(pattern);
125675
- for (const row of rows) try {
125676
- const parsed = JSON.parse(row.value);
125677
- if (parsed.expires && parsed.expires <= now) {
125678
- try {
125679
- this.delete(row.key);
125680
- } catch (err) {
125681
- this.emit("error", err);
125682
- }
125683
- continue;
125684
- }
125685
- yield [row.key, parsed.value];
125686
- } catch (e) {
125687
- continue;
125688
- }
125689
- } catch (error) {
125690
- throw error;
125691
- }
125692
- }
125693
- /**
125694
- * Disconnect from the store
125695
- */
125696
- disconnect() {}
125697
- };
125698
- //#endregion
125699
- //#region dist/node/community/community-wire.js
125700
- const runtimeOnlyCommunityFields = [
125701
- "address",
125702
- "publicKey",
125703
- "shortAddress",
125704
- "nameResolved"
125705
- ];
125706
- function omitRuntimeCommunityFields(community) {
125707
- if (!community) return {};
125708
- return n$10(community, runtimeOnlyCommunityFields);
125709
- }
125710
- function getCommunityNameFromWire(community) {
125711
- const wireCommunity = omitRuntimeCommunityFields(community);
125712
- if (typeof wireCommunity.name === "string") return wireCommunity.name;
125713
- if (typeof community?.address === "string" && isStringDomain(community.address)) return community.address;
125714
- }
125715
- //#endregion
125716
125527
  //#region dist/node/general-util/limited-set.js
125717
125528
  var LimitedSet = class {
125718
125529
  constructor(maxSize) {
@@ -126166,12 +125977,20 @@ var CommunityClientsManager = class extends PKCClientsManager {
126166
125977
  this._community.nameResolved = newNameResolved;
126167
125978
  if (typeof this._community.updatedAt === "number") this._community.emit("update", this._community);
126168
125979
  };
125980
+ const nameStillIdentifiesCommunity = () => {
125981
+ const identifyingName = isStringDomain(this._community.address) ? this._community.address : this._community.name;
125982
+ return Boolean(identifyingName && areEquivalentCommunityAddresses(identifyingName, name));
125983
+ };
126169
125984
  this._nameResolveInFlight = true;
126170
125985
  this._resolveCommunityNameWithoutUpdatingState({
126171
125986
  communityName: name,
126172
125987
  abortSignal: this._community._getStopAbortSignal(),
126173
125988
  cache: { maxAge: 3600 }
126174
125989
  }).then((resolved) => {
125990
+ if (!nameStillIdentifiesCommunity()) {
125991
+ log.trace(`Ignoring the resolve of ${name}: it no longer identifies community ${this._community.address}`);
125992
+ return;
125993
+ }
126175
125994
  if (resolved && resolved !== this._community.publicKey) {
126176
125995
  if (this._nonAnchorHopsOfLoadedChain()?.includes(resolved)) {
126177
125996
  log(`Community name ${name} resolves to ${resolved}, a non-anchor hop of the community's own chain, instead of its identity ${this._community.publicKey}. Marking nameResolved false`);
@@ -126185,8 +126004,9 @@ var CommunityClientsManager = class extends PKCClientsManager {
126185
126004
  } else if (resolved) setNameResolvedAndEmitUpdate(true);
126186
126005
  if (!resolved && this._community.name) setNameResolvedAndEmitUpdate(false);
126187
126006
  }).catch((e) => {
126188
- if (e instanceof PKCError && (e.code === "ERR_DOMAIN_TXT_RECORD_NOT_FOUND" || e.code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS")) setNameResolvedAndEmitUpdate(false);
126189
- else if (isAbortError(e)) return;
126007
+ if (e instanceof PKCError && (e.code === "ERR_DOMAIN_TXT_RECORD_NOT_FOUND" || e.code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS")) {
126008
+ if (nameStillIdentifiesCommunity()) setNameResolvedAndEmitUpdate(false);
126009
+ } else if (isAbortError(e)) return;
126190
126010
  else {
126191
126011
  log.trace("Background name resolution failed for", name, e);
126192
126012
  this._nameResolveFailedAtMs = Date.now();
@@ -126237,7 +126057,8 @@ var CommunityClientsManager = class extends PKCClientsManager {
126237
126057
  abortSignal: this._community._getStopAbortSignal(),
126238
126058
  cache: { maxAge: 3600 }
126239
126059
  });
126240
- if (!isDomain && this._community.name && this._community.publicKey && this._community.nameResolved !== true) this._resolveNameInBackground(this._community.name);
126060
+ const nameToVerify = this._community.name ?? (this._community.raw.communityIpfs ? void 0 : this._community._nameToResolveBeforeFirstRecord);
126061
+ if (!isDomain && nameToVerify && this._community.publicKey && this._community.nameResolved !== true) this._resolveNameInBackground(nameToVerify);
126241
126062
  if (!ipnsName) throw Error("Failed to resolve community address to an IPNS name");
126242
126063
  if (this._community.ipnsName !== ipnsName) {
126243
126064
  this._community.ipnsName = ipnsName;
@@ -126277,6 +126098,8 @@ var CommunityClientsManager = class extends PKCClientsManager {
126277
126098
  publicKey: identityPublicKey,
126278
126099
  name: subRes.community.name
126279
126100
  };
126101
+ const previousForKey = this._pkc._memCaches.communityForPublishing.get(identityPublicKey, { allowStale: true });
126102
+ if (previousForKey?.name && (!communityForPublishing.name || !areEquivalentCommunityAddresses(previousForKey.name, communityForPublishing.name))) this._pkc._memCaches.communityForPublishing.delete(previousForKey.name);
126280
126103
  this._pkc._memCaches.communityForPublishing.set(anchorIdentityAddress, communityForPublishing);
126281
126104
  if (anchorIdentityAddress !== identityPublicKey) this._pkc._memCaches.communityForPublishing.set(identityPublicKey, communityForPublishing);
126282
126105
  }
@@ -126668,7 +126491,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
126668
126491
  const recordAddress = this._deriveAddressFromWireRecord(communityJson);
126669
126492
  const addressMatchesInstance = this._areEquivalentCommunityAddresses(recordAddress, communityInstanceAddress);
126670
126493
  const addressMatchesPublicKey = this._community.publicKey ? this._areEquivalentCommunityAddresses(recordAddress, this._community.publicKey) : false;
126671
- const signatureKeyMatchesTerminal = !isStringDomain(communityInstanceAddress) ? this._areEquivalentCommunityAddresses(getPKCAddressFromPublicKeySync(communityJson.signature.publicKey), terminalIpnsName) : false;
126494
+ const signatureKeyMatchesTerminal = this._areEquivalentCommunityAddresses(getPKCAddressFromPublicKeySync(communityJson.signature.publicKey), terminalIpnsName);
126672
126495
  if (!addressMatchesInstance && !addressMatchesPublicKey && !signatureKeyMatchesTerminal) return new PKCError("ERR_THE_COMMUNITY_IPNS_RECORD_POINTS_TO_DIFFERENT_ADDRESS_THAN_WE_EXPECTED", {
126673
126496
  reason: "Community record signer does not match the loaded address, the community publicKey (anchor), or the terminal (minter) IPNS name of the resolved chain",
126674
126497
  recordSignerAddress: recordAddress,
@@ -126710,7 +126533,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
126710
126533
  };
126711
126534
  //#endregion
126712
126535
  //#region dist/node/community/remote-community.js
126713
- var RemoteCommunity = class extends import_lib.TypedEmitter {
126536
+ var RemoteCommunity = class RemoteCommunity extends import_lib.TypedEmitter {
126714
126537
  constructor(pkc) {
126715
126538
  super();
126716
126539
  this.startedState = "stopped";
@@ -126718,6 +126541,8 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
126718
126541
  this._updatingCommunityInstanceWithListeners = void 0;
126719
126542
  this._numOfListenersForUpdatingInstance = 0;
126720
126543
  this._pendingWarmStartKeyMigration = void 0;
126544
+ this._lastRefusedRecordUpdatedAt = void 0;
126545
+ this._nameToResolveBeforeFirstRecord = void 0;
126721
126546
  this._pkc = pkc;
126722
126547
  this._setState("stopped");
126723
126548
  this._updatingState = "stopped";
@@ -126925,8 +126750,14 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
126925
126750
  else if (newProps.signature?.publicKey) this.publicKey = getPKCAddressFromPublicKeySync(newProps.signature.publicKey);
126926
126751
  else if (explicitPublicKey) this.publicKey = explicitPublicKey;
126927
126752
  else if (!this.publicKey && "address" in newProps && typeof newProps.address === "string" && !isStringDomain(newProps.address)) this.publicKey = newProps.address;
126928
- if (typeof newProps.name === "string") this.name = newProps.name;
126753
+ const nameBeforeProps = this.name;
126754
+ if (newProps.signature && !("publicKey" in newProps)) this.name = getCommunityNameFromWire(newProps);
126755
+ else if (typeof newProps.name === "string") this.name = newProps.name;
126929
126756
  else if (!this.name && "address" in newProps && typeof newProps.address === "string" && isStringDomain(newProps.address)) this.name = newProps.address;
126757
+ if (nameBeforeProps !== void 0 && (this.name === void 0 || !areEquivalentCommunityAddresses(this.name, nameBeforeProps))) {
126758
+ this.nameResolved = void 0;
126759
+ forgetTrackedUpdatingCommunityName(this._pkc, this, nameBeforeProps);
126760
+ }
126930
126761
  if (!this.address) {
126931
126762
  const explicitAddress = "address" in newProps ? newProps.address : void 0;
126932
126763
  const derivedAddress = this.name || this.publicKey || explicitPublicKey || explicitAddress;
@@ -127074,6 +126905,22 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127074
126905
  }
127075
126906
  return true;
127076
126907
  }
126908
+ _requestedName() {
126909
+ return this.address && isStringDomain(this.address) ? this.address : void 0;
126910
+ }
126911
+ _findRecordNameMismatch(record) {
126912
+ return findCommunityRecordNameMismatch({
126913
+ requestedName: this._requestedName(),
126914
+ record,
126915
+ communityPublicKey: this.publicKey
126916
+ });
126917
+ }
126918
+ _refuseRecordWithMismatchedName(error, record) {
126919
+ if (this._lastRefusedRecordUpdatedAt === record.updatedAt) return;
126920
+ this._lastRefusedRecordUpdatedAt = record.updatedAt;
126921
+ logger_default("pkc-js:remote-community:_refuseRecordWithMismatchedName")(`Community ${this.address} refused the record with updatedAt ${record.updatedAt}: it claims the name`, error.details.recordName, "instead of", error.details.requestedName);
126922
+ this.emit("error", error);
126923
+ }
127077
126924
  _setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible() {
127078
126925
  const log = logger_default("pkc-js:remote-community:_setCommunityIpfsPropsFromUpdatingCommunitiesIfPossible");
127079
126926
  const updatingCommunity = findUpdatingCommunity(this._pkc, {
@@ -127089,32 +126936,41 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127089
126936
  log.trace(`New Remote Community instance`, this.address, `skipped warm start from pkc._updatingCommunities[${this.address}]: tracked instance is keyed to`, updatingCommunity.publicKey, `while the caller requested`, this.publicKey, `- deferring key-migration announcement to update()`);
127090
126937
  return;
127091
126938
  }
126939
+ if (this._findRecordNameMismatch(updatingCommunity.raw.communityIpfs)) return;
127092
126940
  const nameResolvedBeforeAdoption = this.nameResolved;
126941
+ const nameBeforeAdoption = this.name;
127093
126942
  this.initCommunityIpfsPropsNoMerge(updatingCommunity.raw.communityIpfs);
127094
126943
  this.updateCid = updatingCommunity.updateCid;
127095
- this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeAdoption);
126944
+ this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeAdoption, nameBeforeAdoption);
127096
126945
  log.trace(`New Remote Community instance`, this.address, `will use CommunityIpfs from pkc._updatingCommunities[${this.address}] with updatedAt`, this.updatedAt, "that's", timestamp() - this.updatedAt, "seconds old");
127097
126946
  this.emit("update", this);
127098
126947
  }
127099
126948
  }
127100
- _adoptMirroredNameResolved(source, nameResolvedBeforeMirror) {
127101
- if (this.name === source.name) {
126949
+ _adoptMirroredNameResolved(source, nameResolvedBeforeMirror, nameBeforeMirror) {
126950
+ const nameTheSourceClassified = source.address && isStringDomain(source.address) ? source.address : source.name;
126951
+ if (this.name && nameTheSourceClassified && areEquivalentCommunityAddresses(this.name, nameTheSourceClassified)) {
127102
126952
  if (typeof source.nameResolved === "boolean") this.nameResolved = source.nameResolved;
127103
- } else this.nameResolved = nameResolvedBeforeMirror;
126953
+ } else if (this.name && nameBeforeMirror && areEquivalentCommunityAddresses(this.name, nameBeforeMirror)) this.nameResolved = nameResolvedBeforeMirror;
126954
+ else this.nameResolved = void 0;
127104
126955
  }
127105
126956
  _initCommunityInstanceWithListeners(communityInstance) {
127106
126957
  const log = logger_default("pkc-js:remote-community:update");
127107
126958
  return {
127108
126959
  community: communityInstance,
127109
126960
  update: () => {
126961
+ if (communityInstance.raw.communityIpfs && communityInstance.updateCid) {
126962
+ const nameMismatch = this._findRecordNameMismatch(communityInstance.raw.communityIpfs);
126963
+ if (nameMismatch) return this._refuseRecordWithMismatchedName(nameMismatch, communityInstance.raw.communityIpfs);
126964
+ }
127110
126965
  const nameResolvedBeforeMirror = this.nameResolved;
126966
+ const nameBeforeMirror = this.name;
127111
126967
  if (!communityInstance.raw.communityIpfs || !communityInstance.updateCid) {
127112
126968
  if (communityInstance.publicKey) this._clearDataForKeyMigration(communityInstance.publicKey);
127113
126969
  } else {
127114
126970
  this.initCommunityIpfsPropsNoMerge(communityInstance.raw.communityIpfs);
127115
126971
  this.updateCid = communityInstance.updateCid;
127116
126972
  }
127117
- this._adoptMirroredNameResolved(communityInstance, nameResolvedBeforeMirror);
126973
+ this._adoptMirroredNameResolved(communityInstance, nameResolvedBeforeMirror, nameBeforeMirror);
127118
126974
  log(`Remote Community instance`, this.address, `received update event from pkc._updatingCommunities[${this.address}] with updatedAt`, this.updatedAt, "that's", timestamp() - this.updatedAt, "seconds old");
127119
126975
  this.emit("update", this);
127120
126976
  },
@@ -127141,6 +126997,7 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127141
126997
  publicKey: this.publicKey
127142
126998
  } : { address: this.address };
127143
126999
  const updatingCommunity = await this._pkc.createCommunity(createOpts);
127000
+ if (this._nameToResolveBeforeFirstRecord && updatingCommunity instanceof RemoteCommunity && !updatingCommunity.raw.communityIpfs) updatingCommunity._nameToResolveBeforeFirstRecord = this._nameToResolveBeforeFirstRecord;
127144
127001
  communityInstance = trackUpdatingCommunity(this._pkc, updatingCommunity);
127145
127002
  log("Creating a new entry for this._pkc._updatingCommunities", this.address);
127146
127003
  }
@@ -127169,8 +127026,9 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127169
127026
  this._announcePendingWarmStartKeyMigrationIfAny();
127170
127027
  }
127171
127028
  if (communityInstance.raw.communityIpfs && (this.updatedAt ?? 0) < communityInstance.raw.communityIpfs.updatedAt && this._updatingCommunityInstanceWithListeners) {
127029
+ const updatedAtBeforeReplay = this.updatedAt;
127172
127030
  this._updatingCommunityInstanceWithListeners.update(communityInstance);
127173
- return true;
127031
+ return this.updatedAt !== updatedAtBeforeReplay;
127174
127032
  }
127175
127033
  return false;
127176
127034
  }
@@ -127225,6 +127083,7 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127225
127083
  if (this.state !== "updating") throw new PKCError("ERR_CALLED_COMMUNITY_STOP_WITHOUT_UPDATE", { address: this.address });
127226
127084
  logger_default("pkc-js:remote-community:stop");
127227
127085
  this._abortStopOperations(`Aborting community operations for ${this.address} because community.stop() was called`);
127086
+ this._lastRefusedRecordUpdatedAt = void 0;
127228
127087
  if (this._updatingCommunityInstanceWithListeners) await this._cleanUpUpdatingCommunityInstanceWithListeners();
127229
127088
  else {
127230
127089
  await this._clientsManager.stopUpdatingLoop();
@@ -127255,6 +127114,207 @@ var RemoteCommunity = class extends import_lib.TypedEmitter {
127255
127114
  }
127256
127115
  };
127257
127116
  //#endregion
127117
+ //#region dist/node/runtime/node/community/keyv-better-sqlite3.js
127118
+ /**
127119
+ * A KeyvStoreAdapter implementation using better-sqlite3 directly
127120
+ */
127121
+ var KeyvBetterSqlite3 = class extends EventEmitter$1 {
127122
+ constructor(db, options = {}) {
127123
+ super();
127124
+ this.ttlSupport = true;
127125
+ this.db = db;
127126
+ this.opts = {
127127
+ table: "keyv",
127128
+ keySize: 255,
127129
+ createTable: true,
127130
+ dialect: "sqlite",
127131
+ url: `sqlite://${db.name}`,
127132
+ ...options
127133
+ };
127134
+ if (this.opts.createTable) try {
127135
+ this.db.exec(`
127136
+ CREATE TABLE IF NOT EXISTS ${this.opts.table} (
127137
+ key TEXT PRIMARY KEY,
127138
+ value TEXT
127139
+ )
127140
+ `);
127141
+ } catch (error) {
127142
+ throw error;
127143
+ }
127144
+ }
127145
+ /**
127146
+ * Get a value from the store
127147
+ */
127148
+ get(key) {
127149
+ try {
127150
+ const row = this.db.prepare(`SELECT * FROM ${this.opts.table} WHERE key = ?`).get("keyv:" + key);
127151
+ if (!row) return;
127152
+ const parsed = JSON.parse(row.value);
127153
+ if (parsed.expires && parsed.expires <= Date.now()) {
127154
+ try {
127155
+ this.delete(key);
127156
+ } catch (e) {
127157
+ e.details = {
127158
+ ...e.details,
127159
+ row,
127160
+ parsed,
127161
+ key
127162
+ };
127163
+ this.emit("error", e);
127164
+ }
127165
+ return;
127166
+ }
127167
+ return parsed.value;
127168
+ } catch (error) {
127169
+ throw error;
127170
+ }
127171
+ }
127172
+ /**
127173
+ * Get multiple values from the store
127174
+ */
127175
+ getMany(keys) {
127176
+ try {
127177
+ const placeholders = keys.map(() => "?").join(",");
127178
+ const rows = this.db.prepare(`
127179
+ SELECT * FROM ${this.opts.table}
127180
+ WHERE key IN (${placeholders})
127181
+ `).all(...keys.map((key) => "keyv:" + key));
127182
+ const now = Date.now();
127183
+ return keys.map((key) => {
127184
+ const row = rows.find((r) => r.key === "keyv:" + key);
127185
+ if (!row) return void 0;
127186
+ try {
127187
+ const parsed = JSON.parse(row.value);
127188
+ if (parsed.expires && parsed.expires <= now) {
127189
+ try {
127190
+ this.delete(key);
127191
+ } catch (err) {
127192
+ this.emit("error", err);
127193
+ }
127194
+ return;
127195
+ }
127196
+ return parsed.value;
127197
+ } catch (e) {
127198
+ return;
127199
+ }
127200
+ });
127201
+ } catch (error) {
127202
+ throw error;
127203
+ }
127204
+ }
127205
+ /**
127206
+ * Set a value in the store
127207
+ */
127208
+ set(key, value, ttl) {
127209
+ try {
127210
+ const expires = typeof ttl === "number" ? Date.now() + ttl : null;
127211
+ const valueWithExpires = {
127212
+ value,
127213
+ ...expires && { expires }
127214
+ };
127215
+ return this.db.prepare(`
127216
+ INSERT INTO ${this.opts.table} (key, value)
127217
+ VALUES (?, ?)
127218
+ ON CONFLICT(key)
127219
+ DO UPDATE SET value = excluded.value
127220
+ `).run("keyv:" + key, JSON.stringify(valueWithExpires));
127221
+ } catch (error) {
127222
+ throw error;
127223
+ }
127224
+ }
127225
+ /**
127226
+ * Delete a value from the store
127227
+ */
127228
+ delete(key) {
127229
+ try {
127230
+ return this.db.prepare(`DELETE FROM ${this.opts.table} WHERE key = ?`).run("keyv:" + key).changes > 0;
127231
+ } catch (error) {
127232
+ throw error;
127233
+ }
127234
+ }
127235
+ /**
127236
+ * Delete multiple values from the store
127237
+ */
127238
+ deleteMany(keys) {
127239
+ try {
127240
+ const placeholders = keys.map(() => "?").join(",");
127241
+ return this.db.prepare(`DELETE FROM ${this.opts.table} WHERE key IN (${placeholders})`).run(...keys.map((key) => "keyv:" + key)).changes > 0;
127242
+ } catch (error) {
127243
+ throw error;
127244
+ }
127245
+ }
127246
+ /**
127247
+ * Clear all values from the store
127248
+ */
127249
+ clear() {
127250
+ try {
127251
+ const stmt = this.db.prepare(this.namespace ? `DELETE FROM ${this.opts.table} WHERE key LIKE ?` : `DELETE FROM ${this.opts.table}`);
127252
+ if (this.namespace) stmt.run(`${this.namespace}:%`);
127253
+ else stmt.run();
127254
+ } catch (error) {
127255
+ throw error;
127256
+ }
127257
+ }
127258
+ /**
127259
+ * Check if a key exists in the store
127260
+ */
127261
+ has(key) {
127262
+ try {
127263
+ const row = this.db.prepare(`SELECT value FROM ${this.opts.table} WHERE key = ?`).get("keyv:" + key);
127264
+ if (!row) return false;
127265
+ try {
127266
+ const parsed = JSON.parse(row.value);
127267
+ if (parsed.expires && parsed.expires <= Date.now()) {
127268
+ try {
127269
+ this.delete(key);
127270
+ } catch (err) {
127271
+ this.emit("error", err);
127272
+ }
127273
+ return false;
127274
+ }
127275
+ return true;
127276
+ } catch (e) {
127277
+ return false;
127278
+ }
127279
+ } catch (error) {
127280
+ throw error;
127281
+ }
127282
+ }
127283
+ /**
127284
+ * Iterate over all values in the store
127285
+ * Note: Even though better-sqlite3 is synchronous, we need to keep this
127286
+ * as an async generator to comply with the KeyvStoreAdapter interface
127287
+ */
127288
+ async *iterator(namespace) {
127289
+ const ns = namespace || this.namespace;
127290
+ const pattern = ns ? `${ns}:%` : "%";
127291
+ const now = Date.now();
127292
+ try {
127293
+ const rows = this.db.prepare(`SELECT key, value FROM ${this.opts.table} WHERE key LIKE ?`).all(pattern);
127294
+ for (const row of rows) try {
127295
+ const parsed = JSON.parse(row.value);
127296
+ if (parsed.expires && parsed.expires <= now) {
127297
+ try {
127298
+ this.delete(row.key);
127299
+ } catch (err) {
127300
+ this.emit("error", err);
127301
+ }
127302
+ continue;
127303
+ }
127304
+ yield [row.key, parsed.value];
127305
+ } catch (e) {
127306
+ continue;
127307
+ }
127308
+ } catch (error) {
127309
+ throw error;
127310
+ }
127311
+ }
127312
+ /**
127313
+ * Disconnect from the store
127314
+ */
127315
+ disconnect() {}
127316
+ };
127317
+ //#endregion
127258
127318
  //#region node_modules/lru-cache/dist/esm/index.js
127259
127319
  /**
127260
127320
  * @module LRUCache
@@ -128379,6 +128439,17 @@ var TrackedInstanceRegistry = class {
128379
128439
  } else this._aliases.set(alias, new Set([value]));
128380
128440
  }
128381
128441
  }
128442
+ removeAliases(value, aliases) {
128443
+ const entry = this._entries.get(value);
128444
+ if (!entry) return;
128445
+ for (const alias of aliases) {
128446
+ if (!entry.delete(alias)) continue;
128447
+ const trackedValues = this._aliases.get(alias);
128448
+ if (!trackedValues) continue;
128449
+ trackedValues.delete(value);
128450
+ if (trackedValues.size === 0) this._aliases.delete(alias);
128451
+ }
128452
+ }
128382
128453
  untrack(value) {
128383
128454
  const aliases = this._entries.get(value);
128384
128455
  if (!aliases) return;
@@ -130960,6 +131031,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
130960
131031
  const { updatingState: newUpdatingState, ...runtimeFieldsWithoutUpdatingState } = updateRecord.runtimeFields;
130961
131032
  this.raw.runtimeFieldsFromRpc = runtimeFieldsWithoutUpdatingState;
130962
131033
  deepMergeRuntimeFields(this, runtimeFieldsWithoutUpdatingState);
131034
+ if (runtimeFieldsWithoutUpdatingState.nameResolved === void 0) this.nameResolved = void 0;
130963
131035
  this._changeStateEmitEventEmitStateChangeEvent({
130964
131036
  event: {
130965
131037
  name: "update",
@@ -130980,8 +131052,13 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
130980
131052
  error: (err) => this.emit("error", err),
130981
131053
  updatingstatechange: (updatingState) => this._setUpdatingStateWithEventEmissionIfNewState.bind(this)(updatingState),
130982
131054
  update: (updatingCommunity) => {
131055
+ if (updatingCommunity.raw.communityIpfs && updatingCommunity.updateCid) {
131056
+ const nameMismatch = this._findRecordNameMismatch(updatingCommunity.raw.communityIpfs);
131057
+ if (nameMismatch) return this._refuseRecordWithMismatchedName(nameMismatch, updatingCommunity.raw.communityIpfs);
131058
+ }
130983
131059
  const keyChanged = updatingCommunity.publicKey && updatingCommunity.publicKey !== this.publicKey;
130984
131060
  const nameResolvedBeforeMirror = this.nameResolved;
131061
+ const nameBeforeMirror = this.name;
130985
131062
  if (!updatingCommunity.raw.communityIpfs || !updatingCommunity.updateCid) {
130986
131063
  if (updatingCommunity.publicKey) this._clearDataForKeyMigration(updatingCommunity.publicKey);
130987
131064
  } else {
@@ -130990,7 +131067,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
130990
131067
  this.updateCid = updatingCommunity.updateCid;
130991
131068
  if (updatingCommunity.raw.runtimeFieldsFromRpc) deepMergeRuntimeFields(this, updatingCommunity.raw.runtimeFieldsFromRpc);
130992
131069
  }
130993
- this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeMirror);
131070
+ this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeMirror, nameBeforeMirror);
130994
131071
  if (updatingCommunity.raw.communityIpfs && updatingCommunity.updateCid || keyChanged) this.emit("update", this);
130995
131072
  },
130996
131073
  statechange: async (newState) => {
@@ -131014,7 +131091,15 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131014
131091
  const clientKeys = t$13(this.clients);
131015
131092
  for (const clientType of clientKeys) if (updatingCommunity.clients[clientType]) for (const clientUrl of Object.keys(updatingCommunity.clients[clientType])) this.clients[clientType][clientUrl].mirror(updatingCommunity.clients[clientType][clientUrl]);
131016
131093
  this._updatingRpcCommunityInstanceWithListeners.community._numOfListenersForUpdatingInstance++;
131094
+ if (updatingCommunity.raw.communityIpfs && updatingCommunity.updateCid) {
131095
+ const nameMismatch = this._findRecordNameMismatch(updatingCommunity.raw.communityIpfs);
131096
+ if (nameMismatch) {
131097
+ this._refuseRecordWithMismatchedName(nameMismatch, updatingCommunity.raw.communityIpfs);
131098
+ return;
131099
+ }
131100
+ }
131017
131101
  const nameResolvedBeforeMirror = this.nameResolved;
131102
+ const nameBeforeMirror = this.name;
131018
131103
  if (!updatingCommunity.raw.communityIpfs || !updatingCommunity.updateCid) {
131019
131104
  if (updatingCommunity.publicKey) this._clearDataForKeyMigration(updatingCommunity.publicKey);
131020
131105
  } else {
@@ -131023,7 +131108,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131023
131108
  this.updateCid = updatingCommunity.updateCid;
131024
131109
  if (updatingCommunity.raw.runtimeFieldsFromRpc) deepMergeRuntimeFields(this, updatingCommunity.raw.runtimeFieldsFromRpc);
131025
131110
  }
131026
- this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeMirror);
131111
+ this._adoptMirroredNameResolved(updatingCommunity, nameResolvedBeforeMirror, nameBeforeMirror);
131027
131112
  if (updatingCommunity.raw.communityIpfs || updatingCommunity.updateCid) this.emit("update", this);
131028
131113
  }
131029
131114
  _handleRpcErrorEvent(args) {
@@ -131048,7 +131133,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131048
131133
  let subscriptionId;
131049
131134
  try {
131050
131135
  ({subscriptionId} = await this._pkc._pkcRpcClient.communityUpdateSubscribe({
131051
- name: this.name,
131136
+ name: this._requestedName(),
131052
131137
  publicKey: this.publicKey
131053
131138
  }));
131054
131139
  this._updateRpcSubscriptionId = subscriptionId;
@@ -131073,7 +131158,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131073
131158
  async _createAndSubscribeToNewUpdatingCommunity(updatingCommunity) {
131074
131159
  const log = logger_default("pkc-js:rpc-remote-community:_createNewUpdatingCommunity");
131075
131160
  const updatingSub = updatingCommunity || await this._pkc.createCommunity({
131076
- name: this.name,
131161
+ name: this._requestedName(),
131077
131162
  publicKey: this.publicKey
131078
131163
  });
131079
131164
  trackUpdatingCommunity(this._pkc, updatingSub);
@@ -131081,6 +131166,12 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131081
131166
  if (updatingSub !== this) await this._initMirroringUpdatingCommunity(updatingSub);
131082
131167
  await updatingSub._initRpcUpdateSubscription();
131083
131168
  }
131169
+ _sharesRequestedIdentityWith(other) {
131170
+ const ownName = this._requestedName();
131171
+ const otherName = other._requestedName();
131172
+ if (ownName === void 0 || otherName === void 0) return ownName === otherName;
131173
+ return areEquivalentCommunityAddresses(ownName, otherName);
131174
+ }
131084
131175
  async update() {
131085
131176
  logger_default("pkc-js:rpc-remote-community:update");
131086
131177
  if (this.state === "started") throw new PKCError("ERR_COMMUNITY_ALREADY_STARTED", { address: this.address });
@@ -131092,7 +131183,8 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131092
131183
  name: this.name
131093
131184
  });
131094
131185
  if (existingSub) if (existingSub === this) await this._initRpcUpdateSubscription();
131095
- else await this._initMirroringUpdatingCommunity(existingSub);
131186
+ else if (this._sharesRequestedIdentityWith(existingSub)) await this._initMirroringUpdatingCommunity(existingSub);
131187
+ else await this._initRpcUpdateSubscription();
131096
131188
  else {
131097
131189
  const startedSub = findStartedCommunity(this._pkc, {
131098
131190
  publicKey: this.publicKey,
@@ -131130,6 +131222,7 @@ var RpcRemoteCommunity = class extends RemoteCommunity {
131130
131222
  async stop() {
131131
131223
  const log = logger_default("pkc-js:rpc-remote-community:stop");
131132
131224
  if (this.state === "stopped") return;
131225
+ this._lastRefusedRecordUpdatedAt = void 0;
131133
131226
  if (this._updatingRpcCommunityInstanceWithListeners) await this._cleanupMirroringUpdatingCommunity();
131134
131227
  else {
131135
131228
  if (this._updateRpcSubscriptionId) {
@@ -131535,4 +131628,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
131535
131628
  }
131536
131629
  };
131537
131630
  //#endregion
131538
- export { parseCidStringSchemaWithPKCErrorIfItFails as $, getCommunityPublicKeyFromWire as $n, RpcPublishedAnchorRecordResultSchema as $t, findCommentInParsedPages as A, verifyChallengeVerification as An, r as Ar, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as At, InflightFetchManager as B, buildRuntimeAuthor as Bn, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as Br, RpcEditCommunityParamSchema as Bt, RepliesPages as C, signCommunity as Cn, moveCommunityDbToDeletedDirectory as Cr, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, verifyChallengeAnswer as Dn, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as Dr, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Dt, buildPagesRuntimeFields as E, signVote as En, setNativeFunctions as Er, parseJsonWithPKCErrorIfFails as Et, collectCrosspostAuthorsToResolve as F, verifyCommentUpdate as Fn, t$8 as Fr, RpcCancelExportParamSchema as Ft, decodeRpcChallengeAnswerPubsubMsg as G, CreateCommunityListWithCidOptionsSchema as Gn, RpcFetchCidParamSchema as Gt, pRetry as H, getAuthorNameFromRuntime as Hn, require_lodash_merge as Hr, RpcExportCommunityModLogsResultSchema as Ht, extractCrosspostRuntimeFields as I, verifyCommunity as In, stringify as Ir, RpcCidParamSchema as It, decodeRpcChallengeVerificationPubsubMsg as J, crosspostChainDepthUpTo as Jn, RpcFetchCommunityListResultSchema as Jt, decodeRpcChallengePubsubMsg as K, CreateNewCommunityListOptionsSchema as Kn, RpcFetchCidResultSchema as Kt, stripNameResolvedFromCrosspost as L, verifyCommunityEdit as Ln, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as Lr, RpcCommentRepliesPageParamSchema as Lt, parseRawPages as M, verifyCommentIpfs as Mn, n$5 as Mr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Mt, applyNameResolvedCacheToCrosspost as N, verifyCommentModeration as Nn, n$6 as Nr, RpcAnchorPublishPreparationResultSchema as Nt, findCommentInPageInstance as O, verifyChallengeMessage as On, t$2 as Or, parseRpcCommentEventWithPKCErrorIfItFails as Ot, cloneCrosspostForRuntime as P, verifyCommentPubsubMessage as Pn, t$7 as Pr, RpcAuthorNameParamSchema as Pt, createSchemaRowParser as Q, getCommunityNameFromWire$1 as Qn, RpcPublishCommunityListResultSchema as Qt, PKCClientsManager as R, verifyCommunityList as Rn, NAME_RESOLVED_FALSE_TTL_MS as Rr, RpcCommunityIdentifierParamSchema as Rt, KeyvBetterSqlite3 as S, signCommentUpdateForChallengeVerification as Sn, monitorCommunitiesDirectory as Sr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, signCommunityList as Tn, resolveDbPostsCidRefs as Tr, parseDecryptedChallengeWithPKCErrorIfItFails as Tt, pLimit as U, getAuthorNameFromWire as Un, nativeFunctions$1 as Ur, RpcExportCommunityParamSchema as Ut, InflightResourceTypes as V, cleanWireAuthor as Vn, STORAGE_KEYS as Vr, RpcExportCommunityModLogsParamSchema as Vt, PKCTypedEmitter as W, normalizeCreatePublicationAuthor as Wn, require_undici as Wr, RpcExportCommunityResultSchema as Wt, coerceSchemaRowJson as X, buildRuntimeCommunityFields as Xn, RpcPublishChallengeAnswersParamSchema as Xt, coerceSchemaRowBoolean as Y, effectiveMaxCrosspostDepth as Yn, RpcPublishAnchorRecordParamSchema as Yt, collectSchemaRowCoercions as Z, getCommunityAddressFromRecord as Zn, RpcPublishCommunityListParamSchema as Zt, createAuthorIdentityMatcher as _, signChallengeVerification as _n, getDefaultCommunityDbConfig as _r, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, SignerWithPublicKeyAddress as an, getPKCAddressFromPublicKey as ar, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as at, RemoteCommunity as b, signCommentModeration as bn, importSignerIntoKuboNode as br, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, decryptEd25519AesGcm as cn, BackupAbortError as cr, parseCommunityAddressWithPKCErrorIfItFails as ct, getChallengeVerification as d, encryptEd25519AesGcmPublicKeyBuffer as dn, calculateInlineRepliesBudget as dr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as dt, RpcResolveAuthorNameResultSchema as en, normalizeCommunityInputFromCommunity as er, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as et, getCommunityChallengeFromCommunityChallengeSettings as f, _validateSignatureOfPKCRecord as fn, createKuboRpcClient as fr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, signChallengeRequest as gn, deriveDbReplies as gr, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, signChallengeMessage as hn, deriveDbPosts as hr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, require_lib as in, getIpfsKeyFromPrivateKey as ir, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, verifyCommentEdit as jn, t$5 as jr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, verifyChallengeRequest as kn, t$4 as kr, parseRpcCommentUpdateEventWithPKCErrorIfItFails as kt, pkcJsPageSorts as l, decryptEd25519AesGcmPublicKeyBuffer as ln, backupCommunityDb as lr, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as lt, pkcJsChallenges as m, signChallengeAnswer as mn, deriveCommentIpfsFromCommentTableRow as mr, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, RpcSuccessResultSchema as nn, encode as nr, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, createSigner as on, getPKCAddressFromPublicKeySync as or, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, cleanUpBeforePublishing as pn, deleteOldCommunityInWindows as pr, parseCommunityListSchemaWithPKCErrorIfItFails as pt, decodeRpcChallengeRequestPubsubMsg as q, MAX_COMMUNITY_LIST_SIZE_BYTES as qn, RpcFetchCommunityListParamSchema as qt, computePageSortsFingerprint as r, RpcUnsubscribeParamSchema as rn, getBufferedPKCAddressFromPublicKey as rr, parseCommentIpfsSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, createAnchorIpnsRecord as sn, getPublicKeyFromPrivateKey as sr, parseCommentUpdateSchemaWithPKCErrorIfItFails as st, RpcLocalCommunity as t, RpcSubscriptionIdResultSchema as tn, decode as tr, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tt, deriveCommunityChallengesOrThrow as u, encryptEd25519AesGcm as un, calculateExpectedSignatureSize as ur, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, signComment as vn, getDefaultDataPath as vr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, signCommunityEdit as wn, refreshCommunitiesList as wr, parseDecryptedChallengeVerification as wt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as x, signCommentUpdate as xn, listCommunitiesSync as xr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xt, LRUCache as y, signCommentEdit as yn, getThumbnailPropsOfLink as yr, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as yt, GenericStateClient as z, verifyVote as zn, NAME_RESOLVED_TRUE_TTL_MS as zr, RpcCommunityPageParamSchema as zt };
131631
+ export { parseCidStringSchemaWithPKCErrorIfItFails as $, getCommunityNameFromWire$1 as $n, RpcPublishedAnchorRecordResultSchema as $t, findCommentInParsedPages as A, verifyChallengeRequest as An, t$4 as Ar, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as At, InflightFetchManager as B, verifyVote as Bn, NAME_RESOLVED_TRUE_TTL_MS as Br, RpcEditCommunityParamSchema as Bt, RepliesPages as C, signCommentUpdateForChallengeVerification as Cn, monitorCommunitiesDirectory as Cr, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as Ct, extractCommunityRuntimeFieldsFromParsedPages as D, signVote as Dn, setNativeFunctions as Dr, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Dt, buildPagesRuntimeFields as E, signCommunityList as En, resolveDbPostsCidRefs as Er, parseJsonWithPKCErrorIfFails as Et, collectCrosspostAuthorsToResolve as F, verifyCommentPubsubMessage as Fn, t$7 as Fr, RpcCancelExportParamSchema as Ft, decodeRpcChallengeAnswerPubsubMsg as G, normalizeCreatePublicationAuthor as Gn, require_undici as Gr, RpcFetchCidParamSchema as Gt, pRetry as H, cleanWireAuthor as Hn, STORAGE_KEYS as Hr, RpcExportCommunityModLogsResultSchema as Ht, extractCrosspostRuntimeFields as I, verifyCommentUpdate as In, t$8 as Ir, RpcCidParamSchema as It, decodeRpcChallengeVerificationPubsubMsg as J, MAX_COMMUNITY_LIST_SIZE_BYTES as Jn, RpcFetchCommunityListResultSchema as Jt, decodeRpcChallengePubsubMsg as K, CreateCommunityListWithCidOptionsSchema as Kn, RpcFetchCidResultSchema as Kt, stripNameResolvedFromCrosspost as L, verifyCommunity as Ln, stringify as Lr, RpcCommentRepliesPageParamSchema as Lt, parseRawPages as M, verifyCommentEdit as Mn, t$5 as Mr, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Mt, applyNameResolvedCacheToCrosspost as N, verifyCommentIpfs as Nn, n$5 as Nr, RpcAnchorPublishPreparationResultSchema as Nt, findCommentInPageInstance as O, verifyChallengeAnswer as On, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as Or, parseRpcCommentEventWithPKCErrorIfItFails as Ot, cloneCrosspostForRuntime as P, verifyCommentModeration as Pn, n$6 as Pr, RpcAuthorNameParamSchema as Pt, createSchemaRowParser as Q, getCommunityAddressFromRecord as Qn, RpcPublishCommunityListResultSchema as Qt, PKCClientsManager as R, verifyCommunityEdit as Rn, MAX_FILE_SIZE_BYTES_FOR_COMMENT_UPDATE as Rr, RpcCommunityIdentifierParamSchema as Rt, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as S, signCommentUpdate as Sn, listCommunitiesSync as Sr, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as St, buildPageRuntimeFields as T, signCommunityEdit as Tn, refreshCommunitiesList as Tr, parseDecryptedChallengeWithPKCErrorIfItFails as Tt, pLimit as U, getAuthorNameFromRuntime as Un, require_lodash_merge as Ur, RpcExportCommunityParamSchema as Ut, InflightResourceTypes as V, buildRuntimeAuthor as Vn, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as Vr, RpcExportCommunityModLogsParamSchema as Vt, PKCTypedEmitter as W, getAuthorNameFromWire as Wn, nativeFunctions$1 as Wr, RpcExportCommunityResultSchema as Wt, coerceSchemaRowJson as X, effectiveMaxCrosspostDepth as Xn, RpcPublishChallengeAnswersParamSchema as Xt, coerceSchemaRowBoolean as Y, crosspostChainDepthUpTo as Yn, RpcPublishAnchorRecordParamSchema as Yt, collectSchemaRowCoercions as Z, buildRuntimeCommunityFields as Zn, RpcPublishCommunityListParamSchema as Zt, createAuthorIdentityMatcher as _, signChallengeRequest as _n, deriveDbReplies as _r, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as _t, generatePagesReportingFailedSorts as a, require_lib as an, getIpfsKeyFromPrivateKey as ar, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as at, KeyvBetterSqlite3 as b, signCommentEdit as bn, getThumbnailPropsOfLink as br, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as bt, resolvePageSortsOrThrow as c, createAnchorIpnsRecord as cn, getPublicKeyFromPrivateKey as cr, parseCommunityAddressWithPKCErrorIfItFails as ct, getChallengeVerification as d, encryptEd25519AesGcm as dn, calculateExpectedSignatureSize as dr, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as dt, RpcResolveAuthorNameResultSchema as en, getCommunityPublicKeyFromWire as er, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as et, getCommunityChallengeFromCommunityChallengeSettings as f, encryptEd25519AesGcmPublicKeyBuffer as fn, calculateInlineRepliesBudget as fr, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as ft, authorNameResolveFailureReason as g, signChallengeMessage as gn, deriveDbPosts as gr, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as gt, authorIdentityMatcherForRequest as h, signChallengeAnswer as hn, deriveCommentIpfsFromCommentTableRow as hr, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as ht, derivePublicPageSorts as i, findCommunityRecordNameMismatch as in, getBufferedPKCAddressFromPublicKey as ir, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as it, iterateOverPageCidsToFindAllCids as j, verifyChallengeVerification as jn, r as jr, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as jt, findCommentInPageInstanceRecursively as k, verifyChallengeMessage as kn, t$2 as kr, parseRpcCommentUpdateEventWithPKCErrorIfItFails as kt, pkcJsPageSorts as l, decryptEd25519AesGcm as ln, BackupAbortError as lr, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as lt, pkcJsChallenges as m, cleanUpBeforePublishing as mn, deleteOldCommunityInWindows as mr, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as mt, RpcRemoteCommunity as n, RpcSuccessResultSchema as nn, decode as nr, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as nt, loadPageSortsForStartedCommunity as o, SignerWithPublicKeyAddress as on, getPKCAddressFromPublicKey as or, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as ot, loadChallengeFileFromCommunityChallengeSettings as p, _validateSignatureOfPKCRecord as pn, createKuboRpcClient as pr, parseCommunityListSchemaWithPKCErrorIfItFails as pt, decodeRpcChallengeRequestPubsubMsg as q, CreateNewCommunityListOptionsSchema as qn, RpcFetchCommunityListParamSchema as qt, computePageSortsFingerprint as r, RpcUnsubscribeParamSchema as rn, encode as rr, parseCommentIpfsSchemaWithPKCErrorIfItFails as rt, lookupPageSortFactories as s, createSigner as sn, getPKCAddressFromPublicKeySync as sr, parseCommentUpdateSchemaWithPKCErrorIfItFails as st, RpcLocalCommunity as t, RpcSubscriptionIdResultSchema as tn, normalizeCommunityInputFromCommunity as tr, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tt, deriveCommunityChallengesOrThrow as u, decryptEd25519AesGcmPublicKeyBuffer as un, backupCommunityDb as ur, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as ut, TrackedInstanceRegistry as v, signChallengeVerification as vn, getDefaultCommunityDbConfig as vr, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as vt, TIMEFRAMES_TO_SECONDS as w, signCommunity as wn, moveCommunityDbToDeletedDirectory as wr, parseDecryptedChallengeVerification as wt, RemoteCommunity as x, signCommentModeration as xn, importSignerIntoKuboNode as xr, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as xt, LRUCache as y, signComment as yn, getDefaultDataPath as yr, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as yt, GenericStateClient as z, verifyCommunityList as zn, NAME_RESOLVED_FALSE_TTL_MS as zr, RpcCommunityPageParamSchema as zt };