@pkcprotocol/pkc-js 0.0.124 → 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 (170) hide show
  1. package/README.md +54 -54
  2. package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +3 -1
  3. package/dist/browser/clients/rpc-client/pkc-rpc-client.js +18 -3
  4. package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  5. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +16 -0
  6. package/dist/browser/clients/rpc-client/rpc-schema-util.js +6 -1
  7. package/dist/browser/clients/rpc-client/rpc-schema-util.js.map +1 -1
  8. package/dist/browser/clients/rpc-client/schema.d.ts +12 -0
  9. package/dist/browser/clients/rpc-client/schema.js +9 -0
  10. package/dist/browser/clients/rpc-client/schema.js.map +1 -1
  11. package/dist/browser/clients/rpc-client/types.d.ts +5 -1
  12. package/dist/browser/community/community-client-manager.js +30 -9
  13. package/dist/browser/community/community-client-manager.js.map +1 -1
  14. package/dist/browser/community/community-wire.d.ts +6 -0
  15. package/dist/browser/community/community-wire.js +22 -1
  16. package/dist/browser/community/community-wire.js.map +1 -1
  17. package/dist/browser/community/remote-community.d.ts +7 -1
  18. package/dist/browser/community/remote-community.js +87 -11
  19. package/dist/browser/community/remote-community.js.map +1 -1
  20. package/dist/browser/community/rpc-remote-community.d.ts +1 -0
  21. package/dist/browser/community/rpc-remote-community.js +41 -6
  22. package/dist/browser/community/rpc-remote-community.js.map +1 -1
  23. package/dist/browser/community/schema.js +7 -1
  24. package/dist/browser/community/schema.js.map +1 -1
  25. package/dist/browser/community-list/community-list.d.ts +143 -0
  26. package/dist/browser/community-list/community-list.js +401 -0
  27. package/dist/browser/community-list/community-list.js.map +1 -0
  28. package/dist/browser/community-list/schema.d.ts +239 -0
  29. package/dist/browser/community-list/schema.js +95 -0
  30. package/dist/browser/community-list/schema.js.map +1 -0
  31. package/dist/browser/community-list/types.d.ts +19 -0
  32. package/dist/browser/community-list/types.js +2 -0
  33. package/dist/browser/community-list/types.js.map +1 -0
  34. package/dist/browser/errors.d.ts +19 -1
  35. package/dist/browser/errors.js +19 -0
  36. package/dist/browser/errors.js.map +1 -1
  37. package/dist/browser/generated-version.d.ts +1 -1
  38. package/dist/browser/generated-version.js +1 -1
  39. package/dist/browser/index.d.ts +2 -0
  40. package/dist/browser/pkc/pkc-client-manager.d.ts +4 -1
  41. package/dist/browser/pkc/pkc-client-manager.js +6 -4
  42. package/dist/browser/pkc/pkc-client-manager.js.map +1 -1
  43. package/dist/browser/pkc/pkc.d.ts +7 -0
  44. package/dist/browser/pkc/pkc.js +93 -0
  45. package/dist/browser/pkc/pkc.js.map +1 -1
  46. package/dist/browser/pkc/tracked-instance-registry-util.d.ts +1 -0
  47. package/dist/browser/pkc/tracked-instance-registry-util.js +34 -2
  48. package/dist/browser/pkc/tracked-instance-registry-util.js.map +1 -1
  49. package/dist/browser/pkc/tracked-instance-registry.d.ts +1 -0
  50. package/dist/browser/pkc/tracked-instance-registry.js +15 -0
  51. package/dist/browser/pkc/tracked-instance-registry.js.map +1 -1
  52. package/dist/browser/pkc-error.d.ts +1 -1
  53. package/dist/browser/publications/comment/comment-client-manager.d.ts +1 -0
  54. package/dist/browser/publications/comment/comment-client-manager.js +24 -4
  55. package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
  56. package/dist/browser/publications/comment/comment.js +6 -2
  57. package/dist/browser/publications/comment/comment.js.map +1 -1
  58. package/dist/browser/publications/publication-client-manager.d.ts +4 -1
  59. package/dist/browser/publications/publication-client-manager.js +51 -7
  60. package/dist/browser/publications/publication-client-manager.js.map +1 -1
  61. package/dist/browser/publications/publication.js +15 -1
  62. package/dist/browser/publications/publication.js.map +1 -1
  63. package/dist/browser/rpc/src/index.d.ts +3 -1
  64. package/dist/browser/rpc/src/index.js +45 -3
  65. package/dist/browser/rpc/src/index.js.map +1 -1
  66. package/dist/browser/runtime/node/community/local-community/comment-updates.js +2 -1
  67. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  68. package/dist/browser/schema/schema-util.d.ts +3 -0
  69. package/dist/browser/schema/schema-util.js +10 -0
  70. package/dist/browser/schema/schema-util.js.map +1 -1
  71. package/dist/browser/signer/signatures.d.ts +9 -0
  72. package/dist/browser/signer/signatures.js +30 -1
  73. package/dist/browser/signer/signatures.js.map +1 -1
  74. package/dist/browser/test/test-util.d.ts +1 -0
  75. package/dist/browser/test/test-util.js +6 -2
  76. package/dist/browser/test/test-util.js.map +1 -1
  77. package/dist/browser/util.js +6 -1
  78. package/dist/browser/util.js.map +1 -1
  79. package/dist/bundled/bundle-manifest.json +62 -58
  80. package/dist/bundled/challenges.js +1 -1
  81. package/dist/bundled/chunks/{helia-for-pkc-DfpR6JSl.js → helia-for-pkc-vQZvQcs_.js} +33 -33
  82. package/dist/bundled/chunks/{local-community-Ll4pUOKV.js → local-community-51NzNBUS.js} +32 -32
  83. package/dist/bundled/chunks/{local-community-CQ9M4cEY.js → local-community-dcM1R3k5.js} +1 -1
  84. package/dist/bundled/chunks/{node-BWOsSCO-.js → node-agDtcKUp.js} +487 -120
  85. package/dist/bundled/chunks/{page-sort-scoring-Y3zgv-l4.js → page-sort-scoring-BSBLegpC.js} +1 -1
  86. package/dist/bundled/chunks/{rpc-local-community-D8wgBsuD.js → rpc-local-community-DOcUqswi.js} +2580 -1077
  87. package/dist/bundled/chunks/{util-IESnqTnj.js → util-DNYbha6W.js} +1 -1
  88. package/dist/bundled/chunks/{util-Bd4vp_w6.js → util-PGPkG-gU.js} +2736 -994
  89. package/dist/bundled/chunks/{validate-package-factories-D527vDd_.js → validate-package-factories-2U8SCIxZ.js} +2 -2
  90. package/dist/bundled/index.js +1 -1
  91. package/dist/bundled/page-sorts.js +1 -1
  92. package/dist/bundled/rpc/src/index.js +31 -4
  93. package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +3 -1
  94. package/dist/node/clients/rpc-client/pkc-rpc-client.js +18 -3
  95. package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  96. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +16 -0
  97. package/dist/node/clients/rpc-client/rpc-schema-util.js +6 -1
  98. package/dist/node/clients/rpc-client/rpc-schema-util.js.map +1 -1
  99. package/dist/node/clients/rpc-client/schema.d.ts +12 -0
  100. package/dist/node/clients/rpc-client/schema.js +9 -0
  101. package/dist/node/clients/rpc-client/schema.js.map +1 -1
  102. package/dist/node/clients/rpc-client/types.d.ts +5 -1
  103. package/dist/node/community/community-client-manager.js +30 -9
  104. package/dist/node/community/community-client-manager.js.map +1 -1
  105. package/dist/node/community/community-wire.d.ts +6 -0
  106. package/dist/node/community/community-wire.js +22 -1
  107. package/dist/node/community/community-wire.js.map +1 -1
  108. package/dist/node/community/remote-community.d.ts +7 -1
  109. package/dist/node/community/remote-community.js +87 -11
  110. package/dist/node/community/remote-community.js.map +1 -1
  111. package/dist/node/community/rpc-remote-community.d.ts +1 -0
  112. package/dist/node/community/rpc-remote-community.js +41 -6
  113. package/dist/node/community/rpc-remote-community.js.map +1 -1
  114. package/dist/node/community/schema.js +7 -1
  115. package/dist/node/community/schema.js.map +1 -1
  116. package/dist/node/community-list/community-list.d.ts +143 -0
  117. package/dist/node/community-list/community-list.js +401 -0
  118. package/dist/node/community-list/community-list.js.map +1 -0
  119. package/dist/node/community-list/schema.d.ts +239 -0
  120. package/dist/node/community-list/schema.js +95 -0
  121. package/dist/node/community-list/schema.js.map +1 -0
  122. package/dist/node/community-list/types.d.ts +19 -0
  123. package/dist/node/community-list/types.js +2 -0
  124. package/dist/node/community-list/types.js.map +1 -0
  125. package/dist/node/errors.d.ts +19 -1
  126. package/dist/node/errors.js +19 -0
  127. package/dist/node/errors.js.map +1 -1
  128. package/dist/node/generated-version.d.ts +1 -1
  129. package/dist/node/generated-version.js +1 -1
  130. package/dist/node/index.d.ts +2 -0
  131. package/dist/node/pkc/pkc-client-manager.d.ts +4 -1
  132. package/dist/node/pkc/pkc-client-manager.js +6 -4
  133. package/dist/node/pkc/pkc-client-manager.js.map +1 -1
  134. package/dist/node/pkc/pkc.d.ts +7 -0
  135. package/dist/node/pkc/pkc.js +93 -0
  136. package/dist/node/pkc/pkc.js.map +1 -1
  137. package/dist/node/pkc/tracked-instance-registry-util.d.ts +1 -0
  138. package/dist/node/pkc/tracked-instance-registry-util.js +34 -2
  139. package/dist/node/pkc/tracked-instance-registry-util.js.map +1 -1
  140. package/dist/node/pkc/tracked-instance-registry.d.ts +1 -0
  141. package/dist/node/pkc/tracked-instance-registry.js +15 -0
  142. package/dist/node/pkc/tracked-instance-registry.js.map +1 -1
  143. package/dist/node/pkc-error.d.ts +1 -1
  144. package/dist/node/publications/comment/comment-client-manager.d.ts +1 -0
  145. package/dist/node/publications/comment/comment-client-manager.js +24 -4
  146. package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
  147. package/dist/node/publications/comment/comment.js +6 -2
  148. package/dist/node/publications/comment/comment.js.map +1 -1
  149. package/dist/node/publications/publication-client-manager.d.ts +4 -1
  150. package/dist/node/publications/publication-client-manager.js +51 -7
  151. package/dist/node/publications/publication-client-manager.js.map +1 -1
  152. package/dist/node/publications/publication.js +15 -1
  153. package/dist/node/publications/publication.js.map +1 -1
  154. package/dist/node/rpc/src/index.d.ts +3 -1
  155. package/dist/node/rpc/src/index.js +45 -3
  156. package/dist/node/rpc/src/index.js.map +1 -1
  157. package/dist/node/runtime/node/community/local-community/comment-updates.js +2 -1
  158. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  159. package/dist/node/schema/schema-util.d.ts +3 -0
  160. package/dist/node/schema/schema-util.js +10 -0
  161. package/dist/node/schema/schema-util.js.map +1 -1
  162. package/dist/node/signer/signatures.d.ts +9 -0
  163. package/dist/node/signer/signatures.js +30 -1
  164. package/dist/node/signer/signatures.js.map +1 -1
  165. package/dist/node/test/test-util.d.ts +1 -0
  166. package/dist/node/test/test-util.js +6 -2
  167. package/dist/node/test/test-util.js.map +1 -1
  168. package/dist/node/util.js +6 -1
  169. package/dist/node/util.js.map +1 -1
  170. package/package.json +6 -6
@@ -0,0 +1,401 @@
1
+ import { TypedEmitter } from "tiny-typed-emitter";
2
+ import retry from "retry";
3
+ import Logger from "../logger.js";
4
+ import { PKCError } from "../pkc-error.js";
5
+ import { cleanUpBeforePublishing, signCommunityList, verifyCommunityList } from "../signer/signatures.js";
6
+ import { getPKCAddressFromPublicKeySync } from "../signer/util.js";
7
+ import { buildRuntimeAuthor } from "../publications/publication-author.js";
8
+ import { calculateIpfsCidV0, calculateStringSizeSameAsIpfsAddCidV0, calculateStringSizeSameAsIpfsAddCidV0Sync, isStringDomain, retryKuboIpfsAddAndProvide, shortifyAddress, shortifyCid } from "../util.js";
9
+ import { parseCommunityListSchemaWithPKCErrorIfItFails, parseJsonWithPKCErrorIfFails } from "../schema/schema-util.js";
10
+ import { MAX_COMMUNITY_LIST_SIZE_BYTES } from "./schema.js";
11
+ import { sha256 } from "js-sha256";
12
+ // A CommunityList is an immutable, signed IPFS file addressed by CID. One class, no Remote split:
13
+ // constructed with a signer it can publish(), constructed with a cid it can update(). Spec:
14
+ // docs/protocol/community-lists.md
15
+ export class CommunityList extends TypedEmitter {
16
+ constructor(pkc) {
17
+ super();
18
+ this.state = "stopped";
19
+ this.raw = {};
20
+ this._pkc = pkc;
21
+ // The error listener initialized here must never be removed (see AGENTS.md on removeAllListeners)
22
+ this.on("error", (...args) => this.listenerCount("error") === 1 && this._pkc.emit("error", ...args)); // only bubble up to pkc if no other listeners are attached
23
+ }
24
+ _initWithCidOnly(cid) {
25
+ this.cid = cid;
26
+ this.shortCid = shortifyCid(cid);
27
+ }
28
+ _initUnsignedProps({ signer, ...props }) {
29
+ this.signer = signer;
30
+ this._unsignedProps = props;
31
+ this.title = props.title;
32
+ this.description = props.description;
33
+ this.timestamp = props.timestamp;
34
+ this.protocolVersion = props.protocolVersion;
35
+ this.communities = props.communities.map((entry) => this._buildRuntimeEntry(entry));
36
+ // author identity always comes from the signature; before publishing, the signer is who will sign
37
+ this.author = this._buildRuntimeAuthor(props.author, signer.publicKey);
38
+ }
39
+ _buildRuntimeEntry(entry) {
40
+ const address = entry.name || entry.publicKey;
41
+ return { ...entry, address, shortAddress: shortifyAddress(address) };
42
+ }
43
+ _buildRuntimeAuthor(wireAuthor, signaturePublicKey) {
44
+ const runtimeAuthor = buildRuntimeAuthor({ author: wireAuthor, signaturePublicKey });
45
+ return { ...runtimeAuthor, shortAddress: shortifyAddress(runtimeAuthor.address) };
46
+ }
47
+ _initFromWireRecord(record, cid) {
48
+ this.raw.communityList = record;
49
+ this.cid = cid;
50
+ this.shortCid = shortifyCid(cid);
51
+ this.title = record.title;
52
+ this.description = record.description;
53
+ this.timestamp = record.timestamp;
54
+ this.protocolVersion = record.protocolVersion;
55
+ this.signature = record.signature;
56
+ this.communities = record.communities.map((entry) => this._buildRuntimeEntry(entry));
57
+ const previousNameResolved = this.author?.nameResolved;
58
+ this.author = this._buildRuntimeAuthor(record.author, record.signature.publicKey);
59
+ if (typeof previousNameResolved === "boolean")
60
+ this.author.nameResolved = previousNameResolved;
61
+ else
62
+ this._setAuthorNameResolvedFromCache();
63
+ }
64
+ // Reading a cached verdict is free, so a one-shot load shows one like getComment does
65
+ _setAuthorNameResolvedFromCache() {
66
+ const authorDomain = this._authorDomainToSettle();
67
+ if (!authorDomain || !this.author)
68
+ return;
69
+ const cached = this._pkc._memCaches.nameResolvedCache.get(this._nameResolvedCacheKey(authorDomain));
70
+ if (typeof cached === "boolean")
71
+ this.author.nameResolved = cached;
72
+ }
73
+ toJSON() {
74
+ return {
75
+ // An unpublished list has no wire record yet; its props are the ones it will sign
76
+ ...(this.raw.communityList ?? this._unsignedProps),
77
+ ...(this.author ? { author: this.author } : undefined),
78
+ ...(this.communities ? { communities: this.communities } : undefined),
79
+ cid: this.cid,
80
+ shortCid: this.shortCid
81
+ };
82
+ }
83
+ _setState(newState) {
84
+ if (this.state === newState)
85
+ return;
86
+ this.state = newState;
87
+ this.emit("statechange", newState);
88
+ }
89
+ _throwIfPublishAborted(signal) {
90
+ if (signal.aborted)
91
+ throw new PKCError("ERR_COMMUNITY_LIST_PUBLISH_ABORTED", { cid: this.cid });
92
+ }
93
+ // Sign the JSON and add the file to IPFS (locally, or via the RPC server). Sets cid and returns it
94
+ async publish() {
95
+ const log = Logger("pkc-js:community-list:publish");
96
+ if (!this.signer || !this._unsignedProps)
97
+ throw new PKCError("ERR_COMMUNITY_LIST_HAS_NO_SIGNER", { cid: this.cid });
98
+ if (this.state === "publishing")
99
+ throw new PKCError("ERR_COMMUNITY_LIST_ALREADY_PUBLISHING", {});
100
+ if (this.state === "updating")
101
+ throw new PKCError("ERR_COMMUNITY_LIST_ALREADY_UPDATING", {});
102
+ this._setState("publishing");
103
+ this._stopAbortController = new AbortController();
104
+ const signal = this._stopAbortController.signal;
105
+ try {
106
+ const cleanedProps = cleanUpBeforePublishing(this._unsignedProps);
107
+ const signature = await signCommunityList({ communityList: cleanedProps, signer: this.signer, pkc: this._pkc });
108
+ const record = { ...cleanedProps, signature };
109
+ parseCommunityListSchemaWithPKCErrorIfItFails(record); // throws on schema violations incl. duplicate entry publicKey
110
+ const recordString = JSON.stringify(record);
111
+ const sizeBytes = await calculateStringSizeSameAsIpfsAddCidV0(recordString);
112
+ if (sizeBytes > MAX_COMMUNITY_LIST_SIZE_BYTES)
113
+ throw new PKCError("ERR_COMMUNITY_LIST_OVER_ALLOWED_SIZE", {
114
+ sizeBytes,
115
+ maxSizeBytes: MAX_COMMUNITY_LIST_SIZE_BYTES
116
+ });
117
+ this._throwIfPublishAborted(signal);
118
+ let cid;
119
+ if (this._pkc._pkcRpcClient) {
120
+ // The raw string crosses the wire so the server adds the exact bytes we signed
121
+ const res = await this._pkc._pkcRpcClient.publishCommunityList({ communityListRawString: recordString });
122
+ // The server can pin whatever it wants, but the cid it hands back must be the cid of
123
+ // the exact bytes we signed, or every consumer would fail signature verification
124
+ const expectedCid = await calculateIpfsCidV0(recordString);
125
+ if (res.cid !== expectedCid)
126
+ throw new PKCError("ERR_ADDED_COMMUNITY_LIST_TO_IPFS_BUT_GOT_DIFFERENT_CID", {
127
+ expectedCid,
128
+ cidFromRpcServer: res.cid
129
+ });
130
+ cid = res.cid;
131
+ }
132
+ else {
133
+ const kuboRpcClient = this._pkc._clientsManager.getDefaultKuboRpcClient();
134
+ const addRes = await retryKuboIpfsAddAndProvide({
135
+ ipfsClient: kuboRpcClient._client,
136
+ log,
137
+ content: recordString,
138
+ addOptions: { pin: true },
139
+ provideInBackground: true
140
+ });
141
+ cid = String(addRes.cid);
142
+ }
143
+ this._throwIfPublishAborted(signal);
144
+ this._initFromWireRecord(record, cid);
145
+ log(`Published CommunityList (${cid}) with ${record.communities.length} entries`);
146
+ return cid;
147
+ }
148
+ finally {
149
+ // The add takes no abort signal, so a stopped publish can settle after a newer publish() or
150
+ // update() took over; only the run that still owns the controller may reset the state
151
+ if (this._stopAbortController?.signal === signal)
152
+ this._setState("stopped");
153
+ }
154
+ }
155
+ // Fetch and verify the record (retrying transient failures), emit `update`, then keep driving
156
+ // author.nameResolved until the verdict is definitive, emit `update` again, and stop itself
157
+ async update() {
158
+ if (this.state === "updating")
159
+ return; // no-op, same as Comment.update()
160
+ if (this.state === "publishing")
161
+ throw new PKCError("ERR_COMMUNITY_LIST_ALREADY_PUBLISHING", {});
162
+ if (!this.cid)
163
+ throw new PKCError("ERR_COMMUNITY_LIST_HAS_NO_CID", {});
164
+ this._setState("updating");
165
+ this._stopAbortController = new AbortController();
166
+ const signal = this._stopAbortController.signal;
167
+ this._pkc._updatingCommunityLists.add(this);
168
+ void this._runUpdateLoop(signal);
169
+ }
170
+ async _runUpdateLoop(signal) {
171
+ const log = Logger("pkc-js:community-list:update");
172
+ // Next macrotask, so a caller doing `await list.update()` can attach listeners before the
173
+ // already-loaded path emits synchronously
174
+ await new Promise((resolve) => setTimeout(resolve, 0));
175
+ if (signal.aborted)
176
+ return;
177
+ try {
178
+ if (!this.raw.communityList)
179
+ await this._loadCommunityListIpfsWithRetries(signal);
180
+ else
181
+ this.emit("update", this); // already loaded (e.g. update() after publish()): emit current state
182
+ if (signal.aborted)
183
+ return;
184
+ await this._settleAuthorNameResolvedIfNeeded(signal);
185
+ // The record is immutable: once the record is loaded and the nameResolved verdict is
186
+ // definitive (or there is nothing to settle) there is nothing left to watch
187
+ if (!signal.aborted)
188
+ await this.stop();
189
+ }
190
+ catch (e) {
191
+ if (signal.aborted)
192
+ return;
193
+ log.error(`Failed to update CommunityList (${this.cid})`, e);
194
+ this.emit("error", e);
195
+ await this.stop();
196
+ }
197
+ }
198
+ // Deterministic record errors: the record is content-addressed, so refetching the same cid can
199
+ // never fix these. Everything else (transport) is retried forever
200
+ _isNonRetriableError(e) {
201
+ // Classified by code, not instanceof: an error rejected by an RPC call crosses the wire as a
202
+ // plain object carrying the server-side PKCError's code, never as a PKCError instance
203
+ const { code, details } = (e ?? {});
204
+ if (code === "ERR_FAILED_TO_FETCH_GENERIC_IPFS_FROM_GATEWAYS") {
205
+ // Gateways wrap each gateway's error into one: final only if every gateway hit a record
206
+ // error, same as Comment._isCommentIpfsErrorRetriable
207
+ const gatewayErrors = Object.values(details?.gatewayToError ?? {});
208
+ return gatewayErrors.length > 0 && gatewayErrors.every((gatewayError) => this._isNonRetriableError(gatewayError));
209
+ }
210
+ return (typeof code === "string" &&
211
+ [
212
+ "ERR_INVALID_JSON",
213
+ "ERR_INVALID_COMMUNITY_LIST_SCHEMA",
214
+ "ERR_COMMUNITY_LIST_SIGNATURE_IS_INVALID",
215
+ "ERR_OVER_DOWNLOAD_LIMIT",
216
+ "ERR_CALCULATED_CID_DOES_NOT_MATCH"
217
+ ].includes(code));
218
+ }
219
+ async _loadCommunityListIpfsWithRetries(outerSignal) {
220
+ if (this.raw.communityList)
221
+ return;
222
+ const cid = this.cid;
223
+ if (!cid)
224
+ throw new PKCError("ERR_COMMUNITY_LIST_HAS_NO_CID", {});
225
+ // Own controller so stop() can cancel a load that was started without update() (getCommunityList).
226
+ // The controller and retry operation are this run's own: a stopped run can still settle later (an
227
+ // RPC fetch takes no abort signal), and it must not touch a newer run's controller or retry timers.
228
+ // They are mirrored on the instance only so stop() can reach the current run
229
+ const abortController = new AbortController();
230
+ const operation = retry.operation({ forever: true, factor: 2 });
231
+ this._loadingAbortController = abortController;
232
+ this._loadingOperation = operation;
233
+ const signal = abortController.signal;
234
+ const onOuterAbort = () => abortController.abort(outerSignal?.reason);
235
+ outerSignal?.addEventListener("abort", onOuterAbort, { once: true });
236
+ try {
237
+ const record = await new Promise((resolve, reject) => {
238
+ // Settle on abort, not on the next attempt: stop() clears a pending retry timer, so an
239
+ // attempt may never run again, and a load left pending never reaches its finally
240
+ const rejectOnAbort = () => reject(signal.reason || new Error("Aborted loading CommunityList"));
241
+ signal.addEventListener("abort", rejectOnAbort, { once: true });
242
+ operation.attempt(async () => {
243
+ if (signal.aborted)
244
+ return rejectOnAbort();
245
+ try {
246
+ resolve(await this._fetchAndVerifyOnce(cid, signal));
247
+ }
248
+ catch (e) {
249
+ if (signal.aborted || this._isNonRetriableError(e))
250
+ return reject(e);
251
+ this.emit("error", e);
252
+ operation.retry(e);
253
+ }
254
+ });
255
+ });
256
+ if (signal.aborted)
257
+ return;
258
+ this._initFromWireRecord(record, cid);
259
+ this.emit("update", this);
260
+ }
261
+ finally {
262
+ operation.stop();
263
+ outerSignal?.removeEventListener("abort", onOuterAbort);
264
+ if (this._loadingOperation === operation)
265
+ this._loadingOperation = undefined;
266
+ if (this._loadingAbortController === abortController)
267
+ this._loadingAbortController = undefined;
268
+ }
269
+ }
270
+ async _fetchAndVerifyOnce(cid, signal) {
271
+ let rawString;
272
+ if (this._pkc._pkcRpcClient) {
273
+ const res = await this._pkc._pkcRpcClient.fetchCommunityList({ cid });
274
+ rawString = res.communityListRawString;
275
+ // The RPC server is not trusted with record validity: enforce the load cap before hashing or
276
+ // parsing, the same error the direct path throws, then check the bytes are the cid's bytes
277
+ const sizeBytes = calculateStringSizeSameAsIpfsAddCidV0Sync(rawString);
278
+ if (sizeBytes > MAX_COMMUNITY_LIST_SIZE_BYTES)
279
+ throw new PKCError("ERR_OVER_DOWNLOAD_LIMIT", { cid, sizeBytes, maxSizeBytes: MAX_COMMUNITY_LIST_SIZE_BYTES });
280
+ const calculatedCid = await calculateIpfsCidV0(rawString);
281
+ if (calculatedCid !== cid)
282
+ throw new PKCError("ERR_CALCULATED_CID_DOES_NOT_MATCH", { calculatedCid, cid });
283
+ }
284
+ else {
285
+ rawString = await this._pkc._clientsManager.fetchCid(cid, {
286
+ maxFileSizeBytes: MAX_COMMUNITY_LIST_SIZE_BYTES,
287
+ abortSignal: signal
288
+ });
289
+ }
290
+ const record = parseCommunityListSchemaWithPKCErrorIfItFails(parseJsonWithPKCErrorIfFails(rawString));
291
+ const validity = await verifyCommunityList({ communityList: record });
292
+ if (!validity.valid)
293
+ throw new PKCError("ERR_COMMUNITY_LIST_SIGNATURE_IS_INVALID", { validity, cid });
294
+ return record;
295
+ }
296
+ // The name of the author on the wire, only when it's a domain that can be resolved
297
+ _authorDomainToSettle() {
298
+ const wireAuthorName = this.raw.communityList?.author?.name;
299
+ if (typeof wireAuthorName !== "string" || !isStringDomain(wireAuthorName))
300
+ return undefined;
301
+ return wireAuthorName;
302
+ }
303
+ _nameResolvedCacheKey(authorDomain) {
304
+ return sha256(authorDomain + this.raw.communityList.signature.publicKey);
305
+ }
306
+ // One resolution attempt. Returns a definitive verdict (boolean) or undefined for a transient
307
+ // failure that should be retried. Resolved verdicts are cached pkc-wide, same as publications
308
+ async _resolveAuthorNameVerdictOnce(authorDomain) {
309
+ const cache = this._pkc._memCaches.nameResolvedCache;
310
+ const cacheKey = this._nameResolvedCacheKey(authorDomain);
311
+ const cached = cache.get(cacheKey);
312
+ if (typeof cached === "boolean")
313
+ return cached;
314
+ try {
315
+ // Works over both transports: PKCWithRpcClient overrides resolveAuthorName to delegate to the RPC server
316
+ const { resolvedAuthorName } = await this._pkc.resolveAuthorName({ name: authorDomain });
317
+ const ttlOf = (verdict) => (verdict ? this._pkc._nameResolvedTrueTtlMs : this._pkc._nameResolvedFalseTtlMs);
318
+ if (typeof resolvedAuthorName !== "string") {
319
+ // The resolvers answered and there is no record: definitive, same as
320
+ // resolveAuthorNamesInBackground. All resolvers erroring throws instead (issue #353)
321
+ cache.set(cacheKey, false, { ttl: ttlOf(false) });
322
+ return false;
323
+ }
324
+ const signerAddress = getPKCAddressFromPublicKeySync(this.raw.communityList.signature.publicKey);
325
+ const verdict = resolvedAuthorName === signerAddress;
326
+ // Same per-verdict ttls as resolveAuthorNamesInBackground: a `false` is what a domain looks
327
+ // like while its owner is still configuring it, so it expires quickly (issue #353)
328
+ cache.set(cacheKey, verdict, { ttl: ttlOf(verdict) });
329
+ return verdict;
330
+ }
331
+ catch (e) {
332
+ // Classified by code, not instanceof: over RPC the rejection is a plain object carrying the code
333
+ const code = e?.code;
334
+ if (code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS") {
335
+ // The resolvers answered: the record exists and is not a key. Definitive non-match
336
+ cache.set(cacheKey, false, { ttl: this._pkc._nameResolvedFalseTtlMs });
337
+ return false;
338
+ }
339
+ if (code === "ERR_NO_RESOLVER_FOR_NAME") {
340
+ // Definitive for this list: no resolver in this PKC instance (or its RPC server) handles
341
+ // this TLD. Not cached: the cache is shared with comments and pages, for which "never
342
+ // asked" is undefined, not false (issue #353)
343
+ return false;
344
+ }
345
+ return undefined; // no answer (every resolver errored, a timeout): retry
346
+ }
347
+ }
348
+ // Fire-and-forget cache warmup, used by the one-shot getCommunityList path which does not wait
349
+ // for the verdict: evented instances pick it up from the pkc-wide cache
350
+ _kickOffBackgroundAuthorNameResolution() {
351
+ const log = Logger("pkc-js:community-list:resolve-author-name");
352
+ const authorDomain = this._authorDomainToSettle();
353
+ if (!authorDomain || !this._pkc.resolveAuthorNames)
354
+ return;
355
+ this._resolveAuthorNameVerdictOnce(authorDomain).catch((e) => log.error("Failed background author name resolution", authorDomain, e));
356
+ }
357
+ async _settleAuthorNameResolvedIfNeeded(signal) {
358
+ const authorDomain = this._authorDomainToSettle();
359
+ if (!authorDomain || !this.author || !this._pkc.resolveAuthorNames)
360
+ return;
361
+ let attempt = 0;
362
+ while (!signal.aborted) {
363
+ const verdict = await this._resolveAuthorNameVerdictOnce(authorDomain);
364
+ if (signal.aborted)
365
+ return;
366
+ if (typeof verdict === "boolean") {
367
+ this.author.nameResolved = verdict;
368
+ this.emit("update", this);
369
+ return;
370
+ }
371
+ attempt++;
372
+ await this._delayWithAbort(Math.min(1000 * 2 ** attempt, 60_000), signal);
373
+ }
374
+ }
375
+ async _delayWithAbort(ms, signal) {
376
+ if (signal.aborted)
377
+ return;
378
+ await new Promise((resolve) => {
379
+ const timeout = setTimeout(() => {
380
+ signal.removeEventListener("abort", onAbort);
381
+ resolve();
382
+ }, ms);
383
+ const onAbort = () => {
384
+ clearTimeout(timeout);
385
+ resolve();
386
+ };
387
+ signal.addEventListener("abort", onAbort, { once: true });
388
+ });
389
+ }
390
+ // Aborts an in-flight publish(), update(), or getCommunityList() load
391
+ async stop() {
392
+ this._pkc._updatingCommunityLists.delete(this);
393
+ this._stopAbortController?.abort();
394
+ this._loadingAbortController?.abort();
395
+ this._loadingOperation?.stop();
396
+ if (this.state === "stopped")
397
+ return;
398
+ this._setState("stopped");
399
+ }
400
+ }
401
+ //# sourceMappingURL=community-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"community-list.js","sourceRoot":"","sources":["../../../src/community-list/community-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAyB,MAAM,OAAO,CAAC;AAC9C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC1G,OAAO,EAAE,8BAA8B,EAAE,M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IACL,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,EAAU,EAAE,MAAmB;QACzD,IAAI,MAAM,CAAC,OAAO;YAAE,OAAO;QAC3B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAChC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC7C,OAAO,EAAE,CAAC;YACd,CAAC,EAAE,EAAE,CAAC,CAAC;YACP,MAAM,OAAO,GAAG,GAAG,EAAE;gBACjB,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO,EAAE,CAAC;YACd,CAAC,CAAC;YACF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC;IAED,sEAAsE;IACtE,KAAK,CAAC,IAAI;QACN,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,oBAAoB,EAAE,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,uBAAuB,EAAE,KAAK,EAAE,CAAC;QACtC,IAAI,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;YAAE,OAAO;QACrC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;CACJ"}
@@ -0,0 +1,239 @@
1
+ import { z } from "zod";
2
+ export declare const MAX_COMMUNITY_LIST_SIZE_BYTES: number;
3
+ export declare const communityListHasNoDuplicateEntryPublicKeys: (list: {
4
+ communities: {
5
+ publicKey: string;
6
+ }[];
7
+ }) => boolean;
8
+ export declare const CommunityListEntrySchema: z.ZodObject<{
9
+ publicKey: z.ZodString;
10
+ name: z.ZodOptional<z.ZodString>;
11
+ title: z.ZodOptional<z.ZodString>;
12
+ description: z.ZodOptional<z.ZodString>;
13
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ locations: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ features: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
17
+ }, z.core.$loose>;
18
+ export declare const CommunityListEntryReservedFields: string[];
19
+ export declare const CreateCommunityListEntrySchema: z.ZodPreprocess<z.ZodObject<{
20
+ publicKey: z.ZodString;
21
+ name: z.ZodOptional<z.ZodString>;
22
+ title: z.ZodOptional<z.ZodString>;
23
+ description: z.ZodOptional<z.ZodString>;
24
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
+ locations: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
+ features: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
28
+ }, z.core.$strict>, unknown>;
29
+ export declare const CommunityListSignedPropertyNames: ("timestamp" | "author" | "protocolVersion" | "description" | "title" | "communities")[];
30
+ export declare const CommunityListIpfsSchema: z.ZodObject<{
31
+ title: z.ZodOptional<z.ZodString>;
32
+ description: z.ZodOptional<z.ZodString>;
33
+ author: z.ZodOptional<z.ZodObject<{
34
+ name: z.ZodOptional<z.ZodString>;
35
+ previousCommentCid: z.ZodOptional<z.ZodString>;
36
+ displayName: z.ZodOptional<z.ZodString>;
37
+ wallets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
38
+ address: z.ZodString;
39
+ timestamp: z.ZodNumber;
40
+ signature: z.ZodObject<{
41
+ signature: z.ZodString;
42
+ type: z.ZodString;
43
+ }, z.core.$strip>;
44
+ }, z.core.$strip>>>;
45
+ avatar: z.ZodOptional<z.ZodObject<{
46
+ chainTicker: z.ZodString;
47
+ address: z.ZodString;
48
+ id: z.ZodString;
49
+ timestamp: z.ZodNumber;
50
+ signature: z.ZodObject<{
51
+ signature: z.ZodString;
52
+ type: z.ZodString;
53
+ }, z.core.$strip>;
54
+ }, z.core.$loose>>;
55
+ flairs: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
+ text: z.ZodString;
57
+ backgroundColor: z.ZodOptional<z.ZodString>;
58
+ textColor: z.ZodOptional<z.ZodString>;
59
+ expiresAt: z.ZodOptional<z.ZodNumber>;
60
+ }, z.core.$loose>>>;
61
+ }, z.core.$loose>>;
62
+ communities: z.ZodArray<z.ZodObject<{
63
+ publicKey: z.ZodString;
64
+ name: z.ZodOptional<z.ZodString>;
65
+ title: z.ZodOptional<z.ZodString>;
66
+ description: z.ZodOptional<z.ZodString>;
67
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
+ locations: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
+ features: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
+ }, z.core.$loose>>;
72
+ timestamp: z.ZodNumber;
73
+ protocolVersion: z.ZodString;
74
+ signature: z.ZodObject<{
75
+ type: z.ZodString;
76
+ signature: z.ZodString;
77
+ publicKey: z.ZodString;
78
+ signedPropertyNames: z.ZodArray<z.ZodString>;
79
+ }, z.core.$strip>;
80
+ }, z.core.$strict>;
81
+ export declare const CommunityListIpfsLooseSchema: z.ZodObject<{
82
+ title: z.ZodOptional<z.ZodString>;
83
+ description: z.ZodOptional<z.ZodString>;
84
+ author: z.ZodOptional<z.ZodObject<{
85
+ name: z.ZodOptional<z.ZodString>;
86
+ previousCommentCid: z.ZodOptional<z.ZodString>;
87
+ displayName: z.ZodOptional<z.ZodString>;
88
+ wallets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
89
+ address: z.ZodString;
90
+ timestamp: z.ZodNumber;
91
+ signature: z.ZodObject<{
92
+ signature: z.ZodString;
93
+ type: z.ZodString;
94
+ }, z.core.$strip>;
95
+ }, z.core.$strip>>>;
96
+ avatar: z.ZodOptional<z.ZodObject<{
97
+ chainTicker: z.ZodString;
98
+ address: z.ZodString;
99
+ id: z.ZodString;
100
+ timestamp: z.ZodNumber;
101
+ signature: z.ZodObject<{
102
+ signature: z.ZodString;
103
+ type: z.ZodString;
104
+ }, z.core.$strip>;
105
+ }, z.core.$loose>>;
106
+ flairs: z.ZodOptional<z.ZodArray<z.ZodObject<{
107
+ text: z.ZodString;
108
+ backgroundColor: z.ZodOptional<z.ZodString>;
109
+ textColor: z.ZodOptional<z.ZodString>;
110
+ expiresAt: z.ZodOptional<z.ZodNumber>;
111
+ }, z.core.$loose>>>;
112
+ }, z.core.$loose>>;
113
+ communities: z.ZodArray<z.ZodObject<{
114
+ publicKey: z.ZodString;
115
+ name: z.ZodOptional<z.ZodString>;
116
+ title: z.ZodOptional<z.ZodString>;
117
+ description: z.ZodOptional<z.ZodString>;
118
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
+ locations: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
+ features: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ }, z.core.$loose>>;
123
+ timestamp: z.ZodNumber;
124
+ protocolVersion: z.ZodString;
125
+ signature: z.ZodObject<{
126
+ type: z.ZodString;
127
+ signature: z.ZodString;
128
+ publicKey: z.ZodString;
129
+ signedPropertyNames: z.ZodArray<z.ZodString>;
130
+ }, z.core.$strip>;
131
+ }, z.core.$loose>;
132
+ export declare const CreateNewCommunityListOptionsSchema: z.ZodObject<{
133
+ signer: z.ZodObject<{
134
+ type: z.ZodEnum<{
135
+ ed25519: "ed25519";
136
+ }>;
137
+ privateKey: z.ZodString;
138
+ }, z.core.$strip>;
139
+ title: z.ZodOptional<z.ZodString>;
140
+ description: z.ZodOptional<z.ZodString>;
141
+ author: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
142
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
143
+ previousCommentCid: z.ZodOptional<z.ZodOptional<z.ZodString>>;
144
+ displayName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
145
+ wallets: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
146
+ address: z.ZodString;
147
+ timestamp: z.ZodNumber;
148
+ signature: z.ZodObject<{
149
+ signature: z.ZodString;
150
+ type: z.ZodString;
151
+ }, z.core.$strip>;
152
+ }, z.core.$strip>>>>;
153
+ avatar: z.ZodOptional<z.ZodOptional<z.ZodObject<{
154
+ chainTicker: z.ZodString;
155
+ address: z.ZodString;
156
+ id: z.ZodString;
157
+ timestamp: z.ZodNumber;
158
+ signature: z.ZodObject<{
159
+ signature: z.ZodString;
160
+ type: z.ZodString;
161
+ }, z.core.$strip>;
162
+ }, z.core.$loose>>>;
163
+ flairs: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
164
+ text: z.ZodString;
165
+ backgroundColor: z.ZodOptional<z.ZodString>;
166
+ textColor: z.ZodOptional<z.ZodString>;
167
+ expiresAt: z.ZodOptional<z.ZodNumber>;
168
+ }, z.core.$loose>>>>;
169
+ }, z.core.$strict>, unknown>>;
170
+ communities: z.ZodArray<z.ZodPreprocess<z.ZodObject<{
171
+ publicKey: z.ZodString;
172
+ name: z.ZodOptional<z.ZodString>;
173
+ title: z.ZodOptional<z.ZodString>;
174
+ description: z.ZodOptional<z.ZodString>;
175
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
176
+ locations: z.ZodOptional<z.ZodArray<z.ZodString>>;
177
+ features: z.ZodOptional<z.ZodArray<z.ZodString>>;
178
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
179
+ }, z.core.$strict>, unknown>>;
180
+ timestamp: z.ZodOptional<z.ZodNumber>;
181
+ protocolVersion: z.ZodOptional<z.ZodString>;
182
+ }, z.core.$strict>;
183
+ export declare const CreateCommunityListWithCidOptionsSchema: z.ZodObject<{
184
+ cid: z.ZodString;
185
+ }, z.core.$strict>;
186
+ export declare const CreateCommunityListOptionsSchema: z.ZodUnion<readonly [z.ZodObject<{
187
+ cid: z.ZodString;
188
+ }, z.core.$strict>, z.ZodObject<{
189
+ signer: z.ZodObject<{
190
+ type: z.ZodEnum<{
191
+ ed25519: "ed25519";
192
+ }>;
193
+ privateKey: z.ZodString;
194
+ }, z.core.$strip>;
195
+ title: z.ZodOptional<z.ZodString>;
196
+ description: z.ZodOptional<z.ZodString>;
197
+ author: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
198
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
199
+ previousCommentCid: z.ZodOptional<z.ZodOptional<z.ZodString>>;
200
+ displayName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
201
+ wallets: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
202
+ address: z.ZodString;
203
+ timestamp: z.ZodNumber;
204
+ signature: z.ZodObject<{
205
+ signature: z.ZodString;
206
+ type: z.ZodString;
207
+ }, z.core.$strip>;
208
+ }, z.core.$strip>>>>;
209
+ avatar: z.ZodOptional<z.ZodOptional<z.ZodObject<{
210
+ chainTicker: z.ZodString;
211
+ address: z.ZodString;
212
+ id: z.ZodString;
213
+ timestamp: z.ZodNumber;
214
+ signature: z.ZodObject<{
215
+ signature: z.ZodString;
216
+ type: z.ZodString;
217
+ }, z.core.$strip>;
218
+ }, z.core.$loose>>>;
219
+ flairs: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
220
+ text: z.ZodString;
221
+ backgroundColor: z.ZodOptional<z.ZodString>;
222
+ textColor: z.ZodOptional<z.ZodString>;
223
+ expiresAt: z.ZodOptional<z.ZodNumber>;
224
+ }, z.core.$loose>>>>;
225
+ }, z.core.$strict>, unknown>>;
226
+ communities: z.ZodArray<z.ZodPreprocess<z.ZodObject<{
227
+ publicKey: z.ZodString;
228
+ name: z.ZodOptional<z.ZodString>;
229
+ title: z.ZodOptional<z.ZodString>;
230
+ description: z.ZodOptional<z.ZodString>;
231
+ languages: z.ZodOptional<z.ZodArray<z.ZodString>>;
232
+ locations: z.ZodOptional<z.ZodArray<z.ZodString>>;
233
+ features: z.ZodOptional<z.ZodArray<z.ZodString>>;
234
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
235
+ }, z.core.$strict>, unknown>>;
236
+ timestamp: z.ZodOptional<z.ZodNumber>;
237
+ protocolVersion: z.ZodOptional<z.ZodString>;
238
+ }, z.core.$strict>]>;
239
+ export declare const CommunityListReservedFields: string[];