applesauce-common 6.1.0 → 7.0.0

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 (231) hide show
  1. package/README.md +1 -0
  2. package/dist/casts/_circular-import.d.ts +3 -0
  3. package/dist/casts/_circular-import.js +3 -0
  4. package/dist/casts/app-handler.d.ts +56 -0
  5. package/dist/casts/app-handler.js +105 -0
  6. package/dist/casts/app-recommendation.d.ts +26 -0
  7. package/dist/casts/app-recommendation.js +41 -0
  8. package/dist/casts/external-identities.d.ts +9 -0
  9. package/dist/casts/external-identities.js +14 -0
  10. package/dist/casts/forum-thread.d.ts +17 -0
  11. package/dist/casts/forum-thread.js +31 -0
  12. package/dist/casts/git-issue.d.ts +18 -0
  13. package/dist/casts/git-issue.js +26 -0
  14. package/dist/casts/git-patch.d.ts +49 -0
  15. package/dist/casts/git-patch.js +88 -0
  16. package/dist/casts/git-pull-request.d.ts +67 -0
  17. package/dist/casts/git-pull-request.js +122 -0
  18. package/dist/casts/git-repository.d.ts +9 -0
  19. package/dist/casts/git-repository.js +16 -0
  20. package/dist/casts/git-thread.d.ts +33 -0
  21. package/dist/casts/git-thread.js +65 -0
  22. package/dist/casts/index.d.ts +11 -0
  23. package/dist/casts/index.js +11 -0
  24. package/dist/casts/napplet.d.ts +98 -0
  25. package/dist/casts/napplet.js +196 -0
  26. package/dist/casts/note.d.ts +8 -0
  27. package/dist/casts/note.js +21 -1
  28. package/dist/casts/nsite.d.ts +134 -0
  29. package/dist/casts/nsite.js +249 -0
  30. package/dist/casts/profile.d.ts +20 -0
  31. package/dist/casts/profile.js +30 -0
  32. package/dist/casts/reaction.d.ts +1 -1
  33. package/dist/casts/relay-discovery.d.ts +4 -0
  34. package/dist/casts/relay-discovery.js +9 -1
  35. package/dist/casts/report.d.ts +28 -15
  36. package/dist/casts/report.js +42 -19
  37. package/dist/casts/share.d.ts +1 -1
  38. package/dist/casts/torrent.d.ts +5 -0
  39. package/dist/casts/torrent.js +8 -1
  40. package/dist/casts/trusted-assertions.d.ts +4 -2
  41. package/dist/casts/trusted-assertions.js +20 -19
  42. package/dist/casts/user-status.d.ts +33 -0
  43. package/dist/casts/user-status.js +69 -0
  44. package/dist/casts/user.d.ts +7 -0
  45. package/dist/casts/user.js +20 -1
  46. package/dist/factories/app-handler.d.ts +31 -0
  47. package/dist/factories/app-handler.js +50 -0
  48. package/dist/factories/app-recommendation.d.ts +21 -0
  49. package/dist/factories/app-recommendation.js +28 -0
  50. package/dist/factories/chat-message.d.ts +37 -0
  51. package/dist/factories/chat-message.js +56 -0
  52. package/dist/factories/comment.d.ts +8 -7
  53. package/dist/factories/comment.js +2 -2
  54. package/dist/factories/external-identities.d.ts +17 -0
  55. package/dist/factories/external-identities.js +28 -0
  56. package/dist/factories/forum-thread.d.ts +34 -0
  57. package/dist/factories/forum-thread.js +50 -0
  58. package/dist/factories/git-applied-status.d.ts +39 -0
  59. package/dist/factories/git-applied-status.js +53 -0
  60. package/dist/factories/git-closed-status.d.ts +18 -0
  61. package/dist/factories/git-closed-status.js +24 -0
  62. package/dist/factories/git-draft-status.d.ts +18 -0
  63. package/dist/factories/git-draft-status.js +24 -0
  64. package/dist/factories/git-issue.d.ts +19 -0
  65. package/dist/factories/git-issue.js +25 -0
  66. package/dist/factories/git-open-status.d.ts +18 -0
  67. package/dist/factories/git-open-status.js +22 -0
  68. package/dist/factories/git-patch.d.ts +59 -0
  69. package/dist/factories/git-patch.js +102 -0
  70. package/dist/factories/git-pull-request-update.d.ts +23 -0
  71. package/dist/factories/git-pull-request-update.js +33 -0
  72. package/dist/factories/git-pull-request.d.ts +39 -0
  73. package/dist/factories/git-pull-request.js +64 -0
  74. package/dist/factories/index.d.ts +23 -0
  75. package/dist/factories/index.js +23 -0
  76. package/dist/factories/internal/git-pull-request.d.ts +19 -0
  77. package/dist/factories/internal/git-pull-request.js +26 -0
  78. package/dist/factories/internal/git-status.d.ts +11 -0
  79. package/dist/factories/internal/git-status.js +12 -0
  80. package/dist/factories/internal/git-thread.d.ts +19 -0
  81. package/dist/factories/internal/git-thread.js +29 -0
  82. package/dist/factories/internal/napplet-manifest.d.ts +52 -0
  83. package/dist/factories/internal/napplet-manifest.js +85 -0
  84. package/dist/factories/internal/nsite-manifest.d.ts +45 -0
  85. package/dist/factories/internal/nsite-manifest.js +68 -0
  86. package/dist/factories/legacy-message.d.ts +2 -0
  87. package/dist/factories/legacy-message.js +9 -2
  88. package/dist/factories/named-napplet.d.ts +20 -0
  89. package/dist/factories/named-napplet.js +30 -0
  90. package/dist/factories/named-nsite.d.ts +28 -0
  91. package/dist/factories/named-nsite.js +53 -0
  92. package/dist/factories/napplet-snapshot.d.ts +18 -0
  93. package/dist/factories/napplet-snapshot.js +38 -0
  94. package/dist/factories/nostr-web-token.d.ts +39 -0
  95. package/dist/factories/nostr-web-token.js +95 -0
  96. package/dist/factories/nsite-snapshot.d.ts +18 -0
  97. package/dist/factories/nsite-snapshot.js +29 -0
  98. package/dist/factories/reaction.d.ts +3 -2
  99. package/dist/factories/report.d.ts +48 -0
  100. package/dist/factories/report.js +66 -0
  101. package/dist/factories/root-napplet.d.ts +18 -0
  102. package/dist/factories/root-napplet.js +24 -0
  103. package/dist/factories/root-nsite.d.ts +23 -0
  104. package/dist/factories/root-nsite.js +44 -0
  105. package/dist/factories/torrent.d.ts +24 -10
  106. package/dist/factories/torrent.js +48 -44
  107. package/dist/factories/trusted-provider-list.d.ts +23 -0
  108. package/dist/factories/trusted-provider-list.js +39 -0
  109. package/dist/factories/user-status.d.ts +26 -0
  110. package/dist/factories/user-status.js +52 -0
  111. package/dist/helpers/app-data.js +15 -7
  112. package/dist/helpers/app-handler.d.ts +43 -6
  113. package/dist/helpers/app-handler.js +53 -3
  114. package/dist/helpers/app-recommendation.d.ts +24 -0
  115. package/dist/helpers/app-recommendation.js +30 -0
  116. package/dist/helpers/bookmark.js +5 -2
  117. package/dist/helpers/comment.d.ts +11 -5
  118. package/dist/helpers/comment.js +7 -1
  119. package/dist/helpers/content.d.ts +3 -1
  120. package/dist/helpers/emoji-pack.js +11 -6
  121. package/dist/helpers/emoji.d.ts +2 -2
  122. package/dist/helpers/encrypted-content-cache.js +18 -1
  123. package/dist/helpers/external-id.d.ts +1 -0
  124. package/dist/helpers/external-id.js +21 -46
  125. package/dist/helpers/external-identities.d.ts +29 -0
  126. package/dist/helpers/external-identities.js +52 -0
  127. package/dist/helpers/file-metadata.js +5 -6
  128. package/dist/helpers/forum-thread.d.ts +10 -0
  129. package/dist/helpers/forum-thread.js +10 -0
  130. package/dist/helpers/gift-wrap.d.ts +40 -15
  131. package/dist/helpers/gift-wrap.js +110 -33
  132. package/dist/helpers/git-issue.d.ts +13 -0
  133. package/dist/helpers/git-issue.js +19 -0
  134. package/dist/helpers/git-patch.d.ts +41 -0
  135. package/dist/helpers/git-patch.js +73 -0
  136. package/dist/helpers/git-pull-request.d.ts +57 -0
  137. package/dist/helpers/git-pull-request.js +111 -0
  138. package/dist/helpers/git-repository.d.ts +4 -0
  139. package/dist/helpers/git-repository.js +16 -0
  140. package/dist/helpers/git-status.d.ts +44 -0
  141. package/dist/helpers/git-status.js +93 -0
  142. package/dist/helpers/git.d.ts +2 -0
  143. package/dist/helpers/git.js +4 -0
  144. package/dist/helpers/groups.d.ts +5 -2
  145. package/dist/helpers/groups.js +40 -18
  146. package/dist/helpers/hashtag.d.ts +4 -2
  147. package/dist/helpers/index.d.ts +11 -0
  148. package/dist/helpers/index.js +11 -0
  149. package/dist/helpers/lists.js +14 -2
  150. package/dist/helpers/lnurl.js +1 -1
  151. package/dist/helpers/mute.js +18 -7
  152. package/dist/helpers/napplet.d.ts +89 -0
  153. package/dist/helpers/napplet.js +144 -0
  154. package/dist/helpers/nostr-web-token.d.ts +54 -0
  155. package/dist/helpers/nostr-web-token.js +124 -0
  156. package/dist/helpers/nsite.d.ts +90 -0
  157. package/dist/helpers/nsite.js +217 -0
  158. package/dist/helpers/relay-discovery.d.ts +4 -0
  159. package/dist/helpers/relay-discovery.js +8 -0
  160. package/dist/helpers/reports.d.ts +35 -0
  161. package/dist/helpers/reports.js +36 -5
  162. package/dist/helpers/threading.d.ts +4 -2
  163. package/dist/helpers/torrent.d.ts +9 -6
  164. package/dist/helpers/torrent.js +23 -15
  165. package/dist/helpers/trusted-assertions.d.ts +7 -0
  166. package/dist/helpers/trusted-assertions.js +41 -2
  167. package/dist/helpers/user-status.d.ts +13 -1
  168. package/dist/helpers/user-status.js +15 -0
  169. package/dist/models/app-handler.d.ts +21 -0
  170. package/dist/models/app-handler.js +47 -0
  171. package/dist/models/git.d.ts +34 -0
  172. package/dist/models/git.js +144 -0
  173. package/dist/models/index.d.ts +3 -0
  174. package/dist/models/index.js +3 -0
  175. package/dist/models/nsite.d.ts +22 -0
  176. package/dist/models/nsite.js +67 -0
  177. package/dist/models/thread.d.ts +4 -1
  178. package/dist/models/thread.js +34 -5
  179. package/dist/models/user-status.d.ts +8 -4
  180. package/dist/models/user-status.js +16 -22
  181. package/dist/observable/filter-timeline-by-mutes.d.ts +1 -1
  182. package/dist/observable/filter-timeline-by-mutes.js +5 -1
  183. package/dist/operations/app-handler.d.ts +24 -0
  184. package/dist/operations/app-handler.js +58 -0
  185. package/dist/operations/app-recommendation.d.ts +13 -0
  186. package/dist/operations/app-recommendation.js +40 -0
  187. package/dist/operations/calendar-event.js +3 -2
  188. package/dist/operations/chat-message.d.ts +9 -0
  189. package/dist/operations/chat-message.js +12 -0
  190. package/dist/operations/client.d.ts +1 -4
  191. package/dist/operations/client.js +1 -23
  192. package/dist/operations/comment.d.ts +9 -3
  193. package/dist/operations/comment.js +12 -9
  194. package/dist/operations/external-identities.d.ts +8 -0
  195. package/dist/operations/external-identities.js +23 -0
  196. package/dist/operations/forum-thread.d.ts +3 -0
  197. package/dist/operations/forum-thread.js +6 -0
  198. package/dist/operations/gift-wrap.js +38 -14
  199. package/dist/operations/git-issue.d.ts +18 -0
  200. package/dist/operations/git-issue.js +31 -0
  201. package/dist/operations/git-patch.d.ts +30 -0
  202. package/dist/operations/git-patch.js +75 -0
  203. package/dist/operations/git-pull-request.d.ts +29 -0
  204. package/dist/operations/git-pull-request.js +74 -0
  205. package/dist/operations/git-repository.js +4 -4
  206. package/dist/operations/git-status.d.ts +28 -0
  207. package/dist/operations/git-status.js +116 -0
  208. package/dist/operations/git-thread.d.ts +13 -0
  209. package/dist/operations/git-thread.js +39 -0
  210. package/dist/operations/index.d.ts +16 -0
  211. package/dist/operations/index.js +16 -0
  212. package/dist/operations/internal/git-commits.d.ts +2 -0
  213. package/dist/operations/internal/git-commits.js +16 -0
  214. package/dist/operations/napplet.d.ts +51 -0
  215. package/dist/operations/napplet.js +121 -0
  216. package/dist/operations/nostr-web-token.d.ts +27 -0
  217. package/dist/operations/nostr-web-token.js +58 -0
  218. package/dist/operations/nsite.d.ts +51 -0
  219. package/dist/operations/nsite.js +112 -0
  220. package/dist/operations/reaction.d.ts +12 -2
  221. package/dist/operations/reaction.js +1 -1
  222. package/dist/operations/report.d.ts +33 -0
  223. package/dist/operations/report.js +60 -0
  224. package/dist/operations/stream.js +5 -4
  225. package/dist/operations/torrent.d.ts +1 -4
  226. package/dist/operations/torrent.js +24 -11
  227. package/dist/operations/trusted-providers.d.ts +14 -0
  228. package/dist/operations/trusted-providers.js +33 -0
  229. package/dist/operations/user-status.d.ts +11 -0
  230. package/dist/operations/user-status.js +29 -0
  231. package/package.json +10 -10
@@ -1,4 +1,4 @@
1
- import { EventTemplate, NostrEvent } from "applesauce-core/helpers/event";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
2
  import { AddressPointer, EventPointer } from "applesauce-core/helpers/pointers";
3
3
  export type ThreadReferences = {
4
4
  root?: {
@@ -52,4 +52,6 @@ export declare function interpretThreadTags(tags: string[][]): {
52
52
  };
53
53
  };
54
54
  /** Returns the parsed NIP-10 tags for an event */
55
- export declare function getNip10References(event: NostrEvent | EventTemplate): ThreadReferences;
55
+ export declare function getNip10References<E extends {
56
+ tags: string[][];
57
+ } = NostrEvent>(event: E): ThreadReferences;
@@ -1,4 +1,5 @@
1
1
  import { KnownEvent, NostrEvent } from "applesauce-core/helpers/event";
2
+ /** The NIP-35 torrent event kind */
2
3
  export declare const TORRENT_KIND = 2003;
3
4
  /** Type for validated torrent events */
4
5
  export type TorrentEvent = KnownEvent<typeof TORRENT_KIND>;
@@ -26,6 +27,7 @@ export type TorrentExternalIdentifier = {
26
27
  export declare function getTorrentInfoHash(torrent: TorrentEvent): string;
27
28
  export declare function getTorrentInfoHash(torrent: NostrEvent): string | undefined;
28
29
  /** Returns the torrent title from the `title` tag */
30
+ export declare function getTorrentTitle(torrent: TorrentEvent): string | undefined;
29
31
  export declare function getTorrentTitle(torrent: NostrEvent): string | undefined;
30
32
  /** Returns all file entries from `file` tags */
31
33
  export declare function getTorrentFiles(torrent: NostrEvent): TorrentFile[];
@@ -37,19 +39,20 @@ export declare function getTorrentCategory(torrent: NostrEvent): number | undefi
37
39
  export declare function getTorrentSearchTags(torrent: NostrEvent): string[];
38
40
  /** Returns the category path from the `tcat` identifier in `i` tags (e.g., "video,movie,4k") */
39
41
  export declare function getTorrentCategoryPath(torrent: NostrEvent): string | undefined;
42
+ /** Returns the `tcat` category path split into its parts (e.g., ["video", "movie", "4k"]) */
43
+ export declare function getTorrentCategoryPathParts(torrent: NostrEvent): string[];
40
44
  /** Returns all external identifiers from `i` tags (excluding tcat and newznab, which are handled separately) */
41
45
  export declare function getTorrentExternalIdentifiers(torrent: NostrEvent): TorrentExternalIdentifier[];
42
- /**
43
- * Creates a TorrentExternalIdentifier object from prefix, id, and optional mediaType
44
- * Automatically constructs the full identifier string
45
- */
46
+ /** Creates a TorrentExternalIdentifier and builds its full identifier string */
46
47
  export declare function createTorrentExternalIdentifier(prefix: TorrentExternalIdentifierPrefix, id: string, mediaType?: string): TorrentExternalIdentifier;
47
48
  /**
48
49
  * Builds a magnet link from an info hash, optional trackers, and optional name
49
- * Format: magnet:?xt=urn:btih:${infoHash}${trackers ? '&tr=' + trackers.join('&tr=') : ''}${name ? '&dn=' + encodeURIComponent(name) : ''}
50
+ * @see https://www.bittorrent.org/beps/bep_0053.html
50
51
  */
51
52
  export declare function buildTorrentMagnetLink(infoHash: string, trackers?: string[], name?: string): string;
52
53
  /** Returns the magnet link for a torrent, building it from the event if needed */
53
54
  export declare function getTorrentMagnetLink(torrent: NostrEvent): string | undefined;
54
- /** Validates that an event is a valid torrent event (kind 2003 with required `x` tag) */
55
+ /** Checks if a string is a hex encoded V1 BitTorrent info hash */
56
+ export declare function isTorrentInfoHash(hash: string): boolean;
57
+ /** Checks if an event is a valid torrent event (kind 2003 with a V1 info hash in the `x` tag) */
55
58
  export declare function isValidTorrent(torrent: NostrEvent): torrent is TorrentEvent;
@@ -1,5 +1,6 @@
1
1
  import { getOrComputeCachedValue } from "applesauce-core/helpers/cache";
2
2
  import { getTagValue } from "applesauce-core/helpers/event";
3
+ /** The NIP-35 torrent event kind */
3
4
  export const TORRENT_KIND = 2003;
4
5
  const TorrentInfoHashSymbol = Symbol.for("torrent-info-hash");
5
6
  const TorrentTitleSymbol = Symbol.for("torrent-title");
@@ -17,7 +18,6 @@ export function getTorrentInfoHash(torrent) {
17
18
  return getTagValue(torrent, "x");
18
19
  });
19
20
  }
20
- /** Returns the torrent title from the `title` tag */
21
21
  export function getTorrentTitle(torrent) {
22
22
  if (torrent.kind !== TORRENT_KIND)
23
23
  return undefined;
@@ -104,13 +104,17 @@ export function getTorrentCategoryPath(torrent) {
104
104
  return undefined;
105
105
  });
106
106
  }
107
- /**
108
- * Parses an external identifier from an `i` tag value
109
- * Supports prefixes: tmdb, ttvdb, imdb, mal, anilist
110
- * Supports second-level prefixes: tmdb:movie, ttvdb:movie, mal:anime, mal:manga
111
- * Note: tcat is excluded as it's handled separately via getTorrentCategoryPath
112
- * Note: newznab is excluded as it's handled separately via getTorrentCategory
113
- */
107
+ /** Returns the `tcat` category path split into its parts (e.g., ["video", "movie", "4k"]) */
108
+ export function getTorrentCategoryPathParts(torrent) {
109
+ const path = getTorrentCategoryPath(torrent);
110
+ if (!path)
111
+ return [];
112
+ return path
113
+ .split(",")
114
+ .map((part) => part.trim())
115
+ .filter(Boolean);
116
+ }
117
+ // Parses tmdb, ttvdb, imdb, mal and anilist identifiers; tcat and newznab are handled by their own getters
114
118
  function parseTorrentExternalIdentifier(value) {
115
119
  // Skip tcat - it's handled separately as a category path
116
120
  if (value.startsWith("tcat:"))
@@ -213,10 +217,7 @@ export function getTorrentExternalIdentifiers(torrent) {
213
217
  return identifiers;
214
218
  });
215
219
  }
216
- /**
217
- * Creates a TorrentExternalIdentifier object from prefix, id, and optional mediaType
218
- * Automatically constructs the full identifier string
219
- */
220
+ /** Creates a TorrentExternalIdentifier and builds its full identifier string */
220
221
  export function createTorrentExternalIdentifier(prefix, id, mediaType) {
221
222
  let identifier;
222
223
  // Build identifier string based on prefix and whether mediaType is provided
@@ -237,7 +238,7 @@ export function createTorrentExternalIdentifier(prefix, id, mediaType) {
237
238
  }
238
239
  /**
239
240
  * Builds a magnet link from an info hash, optional trackers, and optional name
240
- * Format: magnet:?xt=urn:btih:${infoHash}${trackers ? '&tr=' + trackers.join('&tr=') : ''}${name ? '&dn=' + encodeURIComponent(name) : ''}
241
+ * @see https://www.bittorrent.org/beps/bep_0053.html
241
242
  */
242
243
  export function buildTorrentMagnetLink(infoHash, trackers, name) {
243
244
  const parts = [`magnet:?xt=urn:btih:${infoHash}`];
@@ -264,7 +265,14 @@ export function getTorrentMagnetLink(torrent) {
264
265
  return buildTorrentMagnetLink(infoHash, trackers.length > 0 ? trackers : undefined, title);
265
266
  });
266
267
  }
267
- /** Validates that an event is a valid torrent event (kind 2003 with required `x` tag) */
268
+ /** Checks if a string is a hex encoded V1 BitTorrent info hash */
269
+ export function isTorrentInfoHash(hash) {
270
+ return /^[0-9a-f]{40}$/i.test(hash);
271
+ }
272
+ /** Checks if an event is a valid torrent event (kind 2003 with a V1 info hash in the `x` tag) */
268
273
  export function isValidTorrent(torrent) {
269
- return torrent.kind === TORRENT_KIND && getTorrentInfoHash(torrent) !== undefined;
274
+ if (torrent.kind !== TORRENT_KIND)
275
+ return false;
276
+ const infoHash = getTorrentInfoHash(torrent);
277
+ return infoHash !== undefined && isTorrentInfoHash(infoHash);
270
278
  }
@@ -2,6 +2,11 @@ import { KnownEvent, NostrEvent } from "applesauce-core/helpers/event";
2
2
  import { HiddenContentSigner } from "applesauce-core/helpers/hidden-content";
3
3
  export declare const TRUSTED_PROVIDER_LIST_KIND = 10040;
4
4
  export declare const USER_ASSERTION_KIND = 30382;
5
+ export declare const EVENT_ASSERTION_KIND = 30383;
6
+ export declare const ADDRESS_ASSERTION_KIND = 30384;
7
+ export declare const IDENTIFIER_ASSERTION_KIND = 30385;
8
+ /** The result tags defined by NIP-85 for each assertion kind */
9
+ export declare const TRUSTED_ASSERTION_TAGS: Record<number, string[]>;
5
10
  export type TrustedProviderListEvent = KnownEvent<typeof TRUSTED_PROVIDER_LIST_KIND>;
6
11
  export type UserAssertionEvent = KnownEvent<typeof USER_ASSERTION_KIND>;
7
12
  /** A parsed trusted provider declaration from a kind 10040 event */
@@ -28,6 +33,8 @@ export declare function isValidTrustedProviderList(event: NostrEvent): event is
28
33
  * Tag format: ["<kind>:<tag>", "<servicePubkey>", "<relayHint?>"]
29
34
  */
30
35
  export declare function parseProviderTag(tag: string[]): TrustedProvider | undefined;
36
+ /** Creates a kind 10040 provider tag from a {@link TrustedProvider} */
37
+ export declare function createProviderTag(provider: TrustedProvider): string[];
31
38
  /** Returns all public trusted providers from a kind 10040 event */
32
39
  export declare function getPublicProviders(event: NostrEvent): TrustedProvider[];
33
40
  /** Returns hidden trusted providers if the event is unlocked */
@@ -1,9 +1,38 @@
1
1
  import { getOrComputeCachedValue, notifyEventUpdate } from "applesauce-core/helpers";
2
+ import { setCachedValue } from "applesauce-core/helpers/cache";
2
3
  import { getTagValue } from "applesauce-core/helpers/event";
3
4
  import { getHiddenTags, isHiddenTagsUnlocked, setHiddenTagsEncryptionMethod, unlockHiddenTags, } from "applesauce-core/helpers/hidden-tags";
4
5
  // NIP-85 Trusted Assertions Kinds
5
6
  export const TRUSTED_PROVIDER_LIST_KIND = 10040;
6
7
  export const USER_ASSERTION_KIND = 30382;
8
+ export const EVENT_ASSERTION_KIND = 30383;
9
+ export const ADDRESS_ASSERTION_KIND = 30384;
10
+ export const IDENTIFIER_ASSERTION_KIND = 30385;
11
+ /** The result tags defined by NIP-85 for each assertion kind */
12
+ export const TRUSTED_ASSERTION_TAGS = {
13
+ [USER_ASSERTION_KIND]: [
14
+ "rank",
15
+ "followers",
16
+ "first_created_at",
17
+ "post_cnt",
18
+ "reply_cnt",
19
+ "reactions_cnt",
20
+ "zap_amt_recd",
21
+ "zap_amt_sent",
22
+ "zap_cnt_recd",
23
+ "zap_cnt_sent",
24
+ "zap_avg_amt_day_recd",
25
+ "zap_avg_amt_day_sent",
26
+ "reports_cnt_recd",
27
+ "reports_cnt_sent",
28
+ "t",
29
+ "active_hours_start",
30
+ "active_hours_end",
31
+ ],
32
+ [EVENT_ASSERTION_KIND]: ["rank", "comment_cnt", "quote_cnt", "repost_cnt", "reaction_cnt", "zap_cnt", "zap_amount"],
33
+ [ADDRESS_ASSERTION_KIND]: ["rank", "comment_cnt", "quote_cnt", "repost_cnt", "reaction_cnt", "zap_cnt", "zap_amount"],
34
+ [IDENTIFIER_ASSERTION_KIND]: ["rank", "comment_cnt", "reaction_cnt"],
35
+ };
7
36
  // Register NIP-85 kind 10040 as using NIP-44 hidden tags
8
37
  setHiddenTagsEncryptionMethod(TRUSTED_PROVIDER_LIST_KIND, "nip44");
9
38
  // Caching symbols
@@ -33,6 +62,13 @@ export function parseProviderTag(tag) {
33
62
  return undefined;
34
63
  return { kind, tag: assertionTag, servicePubkey, relay: relay || undefined };
35
64
  }
65
+ /** Creates a kind 10040 provider tag from a {@link TrustedProvider} */
66
+ export function createProviderTag(provider) {
67
+ const tag = [`${provider.kind}:${provider.tag}`, provider.servicePubkey];
68
+ if (provider.relay)
69
+ tag.push(provider.relay);
70
+ return tag;
71
+ }
36
72
  /** Returns all public trusted providers from a kind 10040 event */
37
73
  export function getPublicProviders(event) {
38
74
  return getOrComputeCachedValue(event, TrustedProvidersPublicSymbol, () => event.tags.map(parseProviderTag).filter((p) => p !== undefined));
@@ -44,12 +80,15 @@ export function getHiddenProviders(event) {
44
80
  if (!tags)
45
81
  return undefined;
46
82
  const providers = tags.map(parseProviderTag).filter((p) => p !== undefined);
47
- Reflect.set(event, TrustedProvidersHiddenSymbol, providers);
83
+ // Derived from the event's own hidden tags — identity memo (see applesauce-core's cache.ts
84
+ // taxonomy). Written non-enumerable via setCachedValue (05.1-09) so a plain spread drops it
85
+ // instead of carrying a stale derivation onto a copy whose hidden tags differ.
86
+ setCachedValue(event, TrustedProvidersHiddenSymbol, providers);
48
87
  return providers;
49
88
  }
50
89
  /** Checks if the hidden providers are unlocked */
51
90
  export function isHiddenProvidersUnlocked(event) {
52
- return TrustedProvidersHiddenSymbol in event || isHiddenTagsUnlocked(event);
91
+ return (isHiddenTagsUnlocked(event) && (TrustedProvidersHiddenSymbol in event || getHiddenProviders(event) !== undefined));
53
92
  }
54
93
  /** Unlocks the hidden providers in a trusted provider list event */
55
94
  export async function unlockHiddenProviders(event, signer) {
@@ -1,5 +1,11 @@
1
- import { NostrEvent } from "applesauce-core/helpers/event";
1
+ import { kinds, KnownEvent, NostrEvent } from "applesauce-core/helpers/event";
2
2
  import { AddressPointer, EventPointer, ProfilePointer } from "applesauce-core/helpers/pointers";
3
+ /** The event kind for NIP-38 user statuses */
4
+ export declare const USER_STATUS_KIND = 30315;
5
+ /** A NIP-38 user status event */
6
+ export type UserStatusEvent = KnownEvent<typeof kinds.UserStatuses>;
7
+ /** The type of a user status, `general` and `music` are defined by NIP-38 */
8
+ export type UserStatusType = "general" | "music" | (string & {});
3
9
  export declare const UserStatusPointerSymbol: unique symbol;
4
10
  export type UserStatusPointer = {
5
11
  type: "nevent";
@@ -14,5 +20,11 @@ export type UserStatusPointer = {
14
20
  type: "url";
15
21
  data: string;
16
22
  };
23
+ /** Checks if an event is a valid NIP-38 user status */
24
+ export declare function isValidUserStatus(event?: NostrEvent): event is UserStatusEvent;
25
+ /** Gets the status type (the "d" tag) of a user status event */
26
+ export declare function getUserStatusType(status: NostrEvent): UserStatusType;
27
+ /** Checks if a user status has been cleared (empty content) */
28
+ export declare function isUserStatusCleared(status: NostrEvent): boolean;
17
29
  /** Gets the {@link UserStatusPointer} for a status event */
18
30
  export declare function getUserStatusPointer(status: NostrEvent): UserStatusPointer | null;
@@ -1,5 +1,8 @@
1
1
  import { getOrComputeCachedValue } from "applesauce-core/helpers/cache";
2
+ import { getReplaceableIdentifier, kinds } from "applesauce-core/helpers/event";
2
3
  import { getAddressPointerFromATag, getEventPointerFromETag, getProfilePointerFromPTag, } from "applesauce-core/helpers/pointers";
4
+ /** The event kind for NIP-38 user statuses */
5
+ export const USER_STATUS_KIND = kinds.UserStatuses;
3
6
  export const UserStatusPointerSymbol = Symbol.for("user-status-pointer");
4
7
  function getStatusPointer(status) {
5
8
  const pTag = status.tags.find((t) => t[0] === "p" && t[1]);
@@ -25,6 +28,18 @@ function getStatusPointer(status) {
25
28
  return { type: "url", data: rTag[1] };
26
29
  return null;
27
30
  }
31
+ /** Checks if an event is a valid NIP-38 user status */
32
+ export function isValidUserStatus(event) {
33
+ return !!event && event.kind === kinds.UserStatuses && event.tags.some((t) => t[0] === "d");
34
+ }
35
+ /** Gets the status type (the "d" tag) of a user status event */
36
+ export function getUserStatusType(status) {
37
+ return getReplaceableIdentifier(status);
38
+ }
39
+ /** Checks if a user status has been cleared (empty content) */
40
+ export function isUserStatusCleared(status) {
41
+ return status.content.trim() === "";
42
+ }
28
43
  /** Gets the {@link UserStatusPointer} for a status event */
29
44
  export function getUserStatusPointer(status) {
30
45
  return getOrComputeCachedValue(status, UserStatusPointerSymbol, () => getStatusPointer(status));
@@ -0,0 +1,21 @@
1
+ import { Model } from "applesauce-core/event-store";
2
+ import { ProfilePointer } from "applesauce-core/helpers/pointers";
3
+ import { AppHandlerEvent } from "../helpers/app-handler.js";
4
+ import { AppRecommendationEvent } from "../helpers/app-recommendation.js";
5
+ /** A handler ranked by the authors that recommend it */
6
+ export interface RankedAppHandler {
7
+ /** The handler information event */
8
+ handler: AppHandlerEvent;
9
+ /** The pubkeys of the authors recommending the handler */
10
+ recommenders: string[];
11
+ }
12
+ /** A model that returns NIP-89 handlers that advertise support for an event kind */
13
+ export declare function AppHandlersModel(kind: number): Model<AppHandlerEvent[]>;
14
+ /** A model that returns NIP-89 handler recommendations for an event kind, optionally from a set of authors */
15
+ export declare function AppRecommendationsModel(kind: number, authors?: string[]): Model<AppRecommendationEvent[]>;
16
+ /** A model that returns the handlers a user has published */
17
+ export declare function UserAppHandlersModel(user: string | ProfilePointer): Model<AppHandlerEvent[]>;
18
+ /** A model that returns a user's handler recommendations for every event kind */
19
+ export declare function UserAppRecommendationsModel(user: string | ProfilePointer): Model<AppRecommendationEvent[]>;
20
+ /** A model that returns the handlers recommended for an event kind, ranked by how many authors recommend each */
21
+ export declare function RecommendedAppHandlersModel(kind: number, authors?: string[]): Model<RankedAppHandler[]>;
@@ -0,0 +1,47 @@
1
+ import { getReplaceableAddressFromPointer } from "applesauce-core/helpers/pointers";
2
+ import { combineLatest, map, of, switchMap } from "rxjs";
3
+ import { APP_HANDLER_KIND, getAppHandlersFilter, isValidAppHandler } from "../helpers/app-handler.js";
4
+ import { APP_RECOMMENDATION_KIND, getAppRecommendationsFilter, getRecommendedHandlers, isValidAppRecommendation, } from "../helpers/app-recommendation.js";
5
+ /** A model that returns NIP-89 handlers that advertise support for an event kind */
6
+ export function AppHandlersModel(kind) {
7
+ return (store) => store.timeline(getAppHandlersFilter(kind)).pipe(map((events) => events.filter(isValidAppHandler)));
8
+ }
9
+ /** A model that returns NIP-89 handler recommendations for an event kind, optionally from a set of authors */
10
+ export function AppRecommendationsModel(kind, authors) {
11
+ return (store) => store
12
+ .timeline(getAppRecommendationsFilter(kind, authors))
13
+ .pipe(map((events) => events.filter(isValidAppRecommendation)));
14
+ }
15
+ /** A model that returns the handlers a user has published */
16
+ export function UserAppHandlersModel(user) {
17
+ const pubkey = typeof user === "string" ? user : user.pubkey;
18
+ return (store) => store
19
+ .timeline({ kinds: [APP_HANDLER_KIND], authors: [pubkey] })
20
+ .pipe(map((events) => events.filter(isValidAppHandler)));
21
+ }
22
+ /** A model that returns a user's handler recommendations for every event kind */
23
+ export function UserAppRecommendationsModel(user) {
24
+ const pubkey = typeof user === "string" ? user : user.pubkey;
25
+ return (store) => store
26
+ .timeline({ kinds: [APP_RECOMMENDATION_KIND], authors: [pubkey] })
27
+ .pipe(map((events) => events.filter(isValidAppRecommendation)));
28
+ }
29
+ /** A model that returns the handlers recommended for an event kind, ranked by how many authors recommend each */
30
+ export function RecommendedAppHandlersModel(kind, authors) {
31
+ return (store) => store.model(AppRecommendationsModel, kind, authors).pipe(switchMap((recommendations) => {
32
+ const ranked = new Map();
33
+ for (const recommendation of recommendations) {
34
+ // A set counts each author once, even if they list the handler for several platforms
35
+ for (const { pointer } of getRecommendedHandlers(recommendation)) {
36
+ const address = getReplaceableAddressFromPointer(pointer);
37
+ const entry = ranked.get(address) ?? { pointer, recommenders: new Set() };
38
+ entry.recommenders.add(recommendation.pubkey);
39
+ ranked.set(address, entry);
40
+ }
41
+ }
42
+ if (ranked.size === 0)
43
+ return of([]);
44
+ const entries = [...ranked.values()].sort((a, b) => b.recommenders.size - a.recommenders.size);
45
+ return combineLatest(entries.map((e) => store.replaceable(e.pointer))).pipe(map((events) => events.flatMap((handler, i) => isValidAppHandler(handler) ? [{ handler, recommenders: [...entries[i].recommenders] }] : [])));
46
+ }));
47
+ }
@@ -0,0 +1,34 @@
1
+ import { Model } from "applesauce-core/event-store";
2
+ import { NostrEvent } from "applesauce-core/helpers/event";
3
+ import { GitPatchEvent } from "../helpers/git-patch.js";
4
+ import { GitPullRequestEvent, GitPullRequestUpdateEvent, GitPullRequestState } from "../helpers/git-pull-request.js";
5
+ import { GitRepositoryPointer } from "../helpers/git-repository.js";
6
+ import { GitStatus, GitStatusEvent } from "../helpers/git-status.js";
7
+ /** A model that returns the latest authorized status event for an issue, patch or pull request */
8
+ export declare function GitStatusEventModel(root: NostrEvent, maintainers?: string[]): Model<GitStatusEvent | undefined>;
9
+ /** A model that returns the current status of an issue, patch or pull request */
10
+ export declare function GitStatusModel(root: NostrEvent, maintainers?: string[]): Model<GitStatus>;
11
+ /** A model that returns all NIP-22 comments in an issue, patch or pull request thread */
12
+ export declare function GitThreadCommentsModel(root: NostrEvent): Model<NostrEvent[]>;
13
+ /** A model that returns the updates to a pull request */
14
+ export declare function GitPullRequestUpdatesModel(pr: NostrEvent): Model<GitPullRequestUpdateEvent[]>;
15
+ /** A model that returns the latest complete fetch state of a pull request */
16
+ export declare function GitPullRequestStateModel(pr: GitPullRequestEvent): Model<GitPullRequestState>;
17
+ /** A model that resolves the first patch of the current series or revision */
18
+ export declare function GitPatchSeriesRootModel(patch: NostrEvent): Model<GitPatchEvent | undefined>;
19
+ /** A model that resolves the original root through patch and revision ancestors */
20
+ export declare function GitPatchOriginalRootModel(patch: NostrEvent): Model<GitPatchEvent | undefined>;
21
+ /** A model that returns patches in dependency order within a series, excluding other revisions */
22
+ export declare function GitPatchSeriesModel(patch: NostrEvent): Model<GitPatchEvent[]>;
23
+ /** A model that returns revision roots pointing to the original root patch */
24
+ export declare function GitPatchRevisionsModel(patch: NostrEvent): Model<GitPatchEvent[]>;
25
+ /** A model that returns the original root's latest authorized status event for a patch */
26
+ export declare function GitPatchStatusEventModel(patch: NostrEvent, maintainers?: string[]): Model<GitStatusEvent | undefined>;
27
+ /** A model that inherits original status and closes unaccepted revisions after application */
28
+ export declare function GitPatchStatusModel(patch: NostrEvent, maintainers?: string[]): Model<GitStatus>;
29
+ /** A model that returns the issues of a repository */
30
+ export declare function GitRepositoryIssuesModel(repo: GitRepositoryPointer): Model<NostrEvent[]>;
31
+ /** A model that returns the pull requests of a repository */
32
+ export declare function GitRepositoryPullRequestsModel(repo: GitRepositoryPointer): Model<NostrEvent[]>;
33
+ /** A model that returns the root patches (the first patch of each series) of a repository */
34
+ export declare function GitRepositoryPatchesModel(repo: GitRepositoryPointer): Model<NostrEvent[]>;
@@ -0,0 +1,144 @@
1
+ import { getReplaceableAddressFromPointer } from "applesauce-core/helpers/pointers";
2
+ import { combineLatest, map, of, switchMap } from "rxjs";
3
+ import { COMMENT_KIND, getCommentRootPointer, isValidComment } from "../helpers/comment.js";
4
+ import { GIT_ISSUE_KIND } from "../helpers/git-issue.js";
5
+ import { GIT_PATCH_KIND, getGitPatchPreviousPointer, isGitPatchRoot, isGitPatchRootRevision, isValidGitPatch, } from "../helpers/git-patch.js";
6
+ import { GIT_PULL_REQUEST_KIND, GIT_PULL_REQUEST_UPDATE_KIND, getGitPullRequestUpdateAuthor, getGitPullRequestUpdateTarget, getGitPullRequestState, isValidGitPullRequestUpdate, } from "../helpers/git-pull-request.js";
7
+ import { getGitRepositoryReference } from "../helpers/git-repository.js";
8
+ import { getGitCurrentStatusEvent, getGitStatusType, GIT_STATUS_KINDS, getGitStatusAcceptedRevisionId, getGitStatusAppliedPatchIds, } from "../helpers/git-status.js";
9
+ /** A model that returns the latest authorized status event for an issue, patch or pull request */
10
+ export function GitStatusEventModel(root, maintainers = []) {
11
+ return (store) => store
12
+ .timeline({ kinds: GIT_STATUS_KINDS, "#e": [root.id] })
13
+ .pipe(map((statuses) => getGitCurrentStatusEvent(root, statuses, maintainers)));
14
+ }
15
+ /** A model that returns the current status of an issue, patch or pull request */
16
+ export function GitStatusModel(root, maintainers = []) {
17
+ return (store) => store
18
+ .model(GitStatusEventModel, root, maintainers)
19
+ .pipe(map((status) => (status ? getGitStatusType(status) : "open")));
20
+ }
21
+ /** A model that returns all NIP-22 comments in an issue, patch or pull request thread */
22
+ export function GitThreadCommentsModel(root) {
23
+ return (store) => store.timeline({ kinds: [COMMENT_KIND], "#E": [root.id] }).pipe(map((comments) => comments.filter((event) => {
24
+ if (!isValidComment(event))
25
+ return false;
26
+ const pointer = getCommentRootPointer(event);
27
+ return pointer.type === "event" && pointer.id === root.id && pointer.kind === root.kind;
28
+ })));
29
+ }
30
+ /** A model that returns the updates to a pull request */
31
+ export function GitPullRequestUpdatesModel(pr) {
32
+ return (store) => store
33
+ .timeline({ kinds: [GIT_PULL_REQUEST_UPDATE_KIND], "#E": [pr.id] })
34
+ .pipe(map((updates) => updates.filter((update) => isValidGitPullRequestUpdate(update) &&
35
+ getGitPullRequestUpdateTarget(update) === pr.id &&
36
+ getGitPullRequestUpdateAuthor(update) === pr.pubkey &&
37
+ update.pubkey === pr.pubkey &&
38
+ update.created_at >= pr.created_at)));
39
+ }
40
+ /** A model that returns the latest complete fetch state of a pull request */
41
+ export function GitPullRequestStateModel(pr) {
42
+ return (store) => store.model(GitPullRequestUpdatesModel, pr).pipe(map((updates) => getGitPullRequestState(updates[0] ?? pr)));
43
+ }
44
+ function patchRootModel(patch, original, visited = []) {
45
+ return (store) => {
46
+ if (!isValidGitPatch(patch) || visited.includes(patch.id))
47
+ return of(undefined);
48
+ if (isGitPatchRoot(patch) && (!original || !isGitPatchRootRevision(patch)))
49
+ return of(patch);
50
+ const previous = getGitPatchPreviousPointer(patch);
51
+ if (!previous)
52
+ return of(undefined);
53
+ return store.event(previous).pipe(switchMap((parent) => {
54
+ if (!parent ||
55
+ getGitRepositoryReference(parent)?.pubkey !== getGitRepositoryReference(patch)?.pubkey ||
56
+ getGitRepositoryReference(parent)?.identifier !== getGitRepositoryReference(patch)?.identifier)
57
+ return of(undefined);
58
+ return patchRootModel(parent, original, [...visited, patch.id])(store);
59
+ }));
60
+ };
61
+ }
62
+ /** A model that resolves the first patch of the current series or revision */
63
+ export function GitPatchSeriesRootModel(patch) {
64
+ return patchRootModel(patch, false);
65
+ }
66
+ /** A model that resolves the original root through patch and revision ancestors */
67
+ export function GitPatchOriginalRootModel(patch) {
68
+ return patchRootModel(patch, true);
69
+ }
70
+ /** A model that returns patches in dependency order within a series, excluding other revisions */
71
+ export function GitPatchSeriesModel(patch) {
72
+ return (store) => store.model(GitPatchSeriesRootModel, patch).pipe(switchMap((root) => {
73
+ const repo = root && getGitRepositoryReference(root);
74
+ if (!root || !repo)
75
+ return of([]);
76
+ return store.timeline({ kinds: [GIT_PATCH_KIND], "#a": [getReplaceableAddressFromPointer(repo)] }).pipe(map((events) => {
77
+ const result = [root];
78
+ const seen = new Set([root.id]);
79
+ let frontier = [root.id];
80
+ while (frontier.length) {
81
+ const next = events
82
+ .filter((event) => isValidGitPatch(event) &&
83
+ !isGitPatchRoot(event) &&
84
+ !seen.has(event.id) &&
85
+ frontier.includes(getGitPatchPreviousPointer(event)?.id ?? ""))
86
+ .sort((a, b) => a.created_at - b.created_at || a.id.localeCompare(b.id));
87
+ result.push(...next);
88
+ frontier = next.map((event) => event.id);
89
+ for (const id of frontier)
90
+ seen.add(id);
91
+ }
92
+ return result;
93
+ }));
94
+ }));
95
+ }
96
+ /** A model that returns revision roots pointing to the original root patch */
97
+ export function GitPatchRevisionsModel(patch) {
98
+ return (store) => store.model(GitPatchOriginalRootModel, patch).pipe(switchMap((root) => {
99
+ if (!root)
100
+ return of([]);
101
+ return store
102
+ .timeline({ kinds: [GIT_PATCH_KIND], "#e": [root.id] })
103
+ .pipe(map((events) => events.filter((event) => isValidGitPatch(event) &&
104
+ isGitPatchRootRevision(event) &&
105
+ getGitPatchPreviousPointer(event)?.id === root.id &&
106
+ getGitRepositoryReference(event)?.pubkey === getGitRepositoryReference(root)?.pubkey &&
107
+ getGitRepositoryReference(event)?.identifier === getGitRepositoryReference(root)?.identifier)));
108
+ }));
109
+ }
110
+ /** A model that returns the original root's latest authorized status event for a patch */
111
+ export function GitPatchStatusEventModel(patch, maintainers = []) {
112
+ return (store) => store
113
+ .model(GitPatchOriginalRootModel, patch)
114
+ .pipe(switchMap((root) => (root ? store.model(GitStatusEventModel, root, maintainers) : of(undefined))));
115
+ }
116
+ /** A model that inherits original status and closes unaccepted revisions after application */
117
+ export function GitPatchStatusModel(patch, maintainers = []) {
118
+ return (store) => combineLatest([
119
+ store.model(GitPatchSeriesRootModel, patch),
120
+ store.model(GitPatchStatusEventModel, patch, maintainers),
121
+ store.model(GitPatchSeriesModel, patch),
122
+ ]).pipe(map(([seriesRoot, status, series]) => {
123
+ const type = status ? getGitStatusType(status) : "open";
124
+ if (type !== "applied" || !seriesRoot || !isGitPatchRootRevision(seriesRoot) || !status)
125
+ return type;
126
+ const accepted = getGitStatusAcceptedRevisionId(status);
127
+ const applied = getGitStatusAppliedPatchIds(status);
128
+ return accepted === seriesRoot.id || series.some((event) => applied.includes(event.id)) ? "applied" : "closed";
129
+ }));
130
+ }
131
+ /** A model that returns the issues of a repository */
132
+ export function GitRepositoryIssuesModel(repo) {
133
+ return (store) => store.timeline({ kinds: [GIT_ISSUE_KIND], "#a": [getReplaceableAddressFromPointer(repo)] });
134
+ }
135
+ /** A model that returns the pull requests of a repository */
136
+ export function GitRepositoryPullRequestsModel(repo) {
137
+ return (store) => store.timeline({ kinds: [GIT_PULL_REQUEST_KIND], "#a": [getReplaceableAddressFromPointer(repo)] });
138
+ }
139
+ /** A model that returns the root patches (the first patch of each series) of a repository */
140
+ export function GitRepositoryPatchesModel(repo) {
141
+ return (store) => store
142
+ .timeline({ kinds: [GIT_PATCH_KIND], "#a": [getReplaceableAddressFromPointer(repo)] })
143
+ .pipe(map((patches) => patches.filter(isGitPatchRoot)));
144
+ }
@@ -1,8 +1,10 @@
1
+ export * from "./app-handler.js";
1
2
  export * from "./blossom.js";
2
3
  export * from "./bookmarks.js";
3
4
  export * from "./calendar.js";
4
5
  export * from "./channels.js";
5
6
  export * from "./comments.js";
7
+ export * from "./git.js";
6
8
  export * from "./legacy-messages.js";
7
9
  export * from "./mutes.js";
8
10
  export * from "./pins.js";
@@ -18,3 +20,4 @@ export * from "./shares.js";
18
20
  export * from "./zap-goals.js";
19
21
  export * from "applesauce-core/models";
20
22
  import "./__register__.js";
23
+ export * from "./nsite.js";
@@ -1,8 +1,10 @@
1
+ export * from "./app-handler.js";
1
2
  export * from "./blossom.js";
2
3
  export * from "./bookmarks.js";
3
4
  export * from "./calendar.js";
4
5
  export * from "./channels.js";
5
6
  export * from "./comments.js";
7
+ export * from "./git.js";
6
8
  export * from "./legacy-messages.js";
7
9
  export * from "./mutes.js";
8
10
  export * from "./pins.js";
@@ -20,3 +22,4 @@ export * from "./zap-goals.js";
20
22
  export * from "applesauce-core/models";
21
23
  // Register the common models with the event store
22
24
  import "./__register__.js";
25
+ export * from "./nsite.js";
@@ -0,0 +1,22 @@
1
+ import { Model } from "applesauce-core/event-store";
2
+ import { NostrEvent } from "applesauce-core/helpers/event";
3
+ import { AddressPointer, EventPointer, ProfilePointer } from "applesauce-core/helpers/pointers";
4
+ import { NsiteEvent, NsiteSnapshotEvent, RootNsiteEvent } from "../helpers/nsite.js";
5
+ /** A model that resolves a site or snapshot pointer and validates its manifest */
6
+ export declare function NsiteModel(pointer: AddressPointer | EventPointer | string): Model<NsiteEvent | undefined>;
7
+ /** A model that returns a user's root and named sites */
8
+ export declare function UserNsitesModel(user: string | ProfilePointer): Model<NsiteEvent[]>;
9
+ /** A model that returns a user's root site */
10
+ export declare function RootNsiteModel(user: string | ProfilePointer): Model<RootNsiteEvent | undefined>;
11
+ /** A model that returns a user's manifest snapshots */
12
+ export declare function UserNsiteSnapshotsModel(user: string | ProfilePointer): Model<NsiteSnapshotEvent[]>;
13
+ /** A model that returns snapshots of a specific site */
14
+ export declare function NsiteSnapshotsModel(site: NostrEvent | AddressPointer | string): Model<NsiteSnapshotEvent[]>;
15
+ /** A model that returns sites copied directly from a site */
16
+ export declare function NsiteCopiesModel(site: NostrEvent | AddressPointer | string): Model<NsiteEvent[]>;
17
+ /** A model that returns copied sites and snapshots with a shared lineage origin */
18
+ export declare function NsiteLineageModel(site: NostrEvent | AddressPointer | string): Model<NsiteEvent[]>;
19
+ /** A model that returns manifests belonging to an upstream app descriptor */
20
+ export declare function AppNsitesModel(app: NostrEvent | AddressPointer | string): Model<NsiteEvent[]>;
21
+ /** A model that returns manifests advertising an aggregate hash */
22
+ export declare function NsitesByHashModel(hash: string): Model<NsiteEvent[]>;