applesauce-common 0.0.0-concord-20260710175615

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 (403) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -0
  3. package/dist/casts/_circular-import.d.ts +9 -0
  4. package/dist/casts/_circular-import.js +11 -0
  5. package/dist/casts/article.d.ts +19 -0
  6. package/dist/casts/article.js +47 -0
  7. package/dist/casts/badge-award.d.ts +24 -0
  8. package/dist/casts/badge-award.js +39 -0
  9. package/dist/casts/badge.d.ts +19 -0
  10. package/dist/casts/badge.js +48 -0
  11. package/dist/casts/bookmarks.d.ts +35 -0
  12. package/dist/casts/bookmarks.js +91 -0
  13. package/dist/casts/cast.d.ts +1 -0
  14. package/dist/casts/cast.js +2 -0
  15. package/dist/casts/code-snippet.d.ts +14 -0
  16. package/dist/casts/code-snippet.js +33 -0
  17. package/dist/casts/comment.d.ts +18 -0
  18. package/dist/casts/comment.js +54 -0
  19. package/dist/casts/emoji-pack.d.ts +11 -0
  20. package/dist/casts/emoji-pack.js +25 -0
  21. package/dist/casts/favorite-emojis.d.ts +25 -0
  22. package/dist/casts/favorite-emojis.js +62 -0
  23. package/dist/casts/file-metadata.d.ts +22 -0
  24. package/dist/casts/file-metadata.js +55 -0
  25. package/dist/casts/forum-thread.d.ts +17 -0
  26. package/dist/casts/forum-thread.js +31 -0
  27. package/dist/casts/git-grasp-list.d.ts +8 -0
  28. package/dist/casts/git-grasp-list.js +13 -0
  29. package/dist/casts/git-lists.d.ts +42 -0
  30. package/dist/casts/git-lists.js +94 -0
  31. package/dist/casts/git-repository.d.ts +29 -0
  32. package/dist/casts/git-repository.js +68 -0
  33. package/dist/casts/groups.d.ts +19 -0
  34. package/dist/casts/groups.js +43 -0
  35. package/dist/casts/index.d.ts +31 -0
  36. package/dist/casts/index.js +31 -0
  37. package/dist/casts/mutes.d.ts +23 -0
  38. package/dist/casts/mutes.js +54 -0
  39. package/dist/casts/note.d.ts +25 -0
  40. package/dist/casts/note.js +76 -0
  41. package/dist/casts/profile-badges.d.ts +28 -0
  42. package/dist/casts/profile-badges.js +59 -0
  43. package/dist/casts/profile.d.ts +24 -0
  44. package/dist/casts/profile.js +52 -0
  45. package/dist/casts/reaction.d.ts +19 -0
  46. package/dist/casts/reaction.js +50 -0
  47. package/dist/casts/relay-discovery.d.ts +29 -0
  48. package/dist/casts/relay-discovery.js +54 -0
  49. package/dist/casts/relay-lists.d.ts +37 -0
  50. package/dist/casts/relay-lists.js +81 -0
  51. package/dist/casts/relay-monitor.d.ts +21 -0
  52. package/dist/casts/relay-monitor.js +41 -0
  53. package/dist/casts/report.d.ts +31 -0
  54. package/dist/casts/report.js +74 -0
  55. package/dist/casts/share.d.ts +15 -0
  56. package/dist/casts/share.js +34 -0
  57. package/dist/casts/stream.d.ts +43 -0
  58. package/dist/casts/stream.js +116 -0
  59. package/dist/casts/torrent.d.ts +31 -0
  60. package/dist/casts/torrent.js +62 -0
  61. package/dist/casts/trusted-assertions.d.ts +144 -0
  62. package/dist/casts/trusted-assertions.js +281 -0
  63. package/dist/casts/user.d.ts +28 -0
  64. package/dist/casts/user.js +140 -0
  65. package/dist/casts/zap-goal.d.ts +18 -0
  66. package/dist/casts/zap-goal.js +47 -0
  67. package/dist/casts/zap.d.ts +17 -0
  68. package/dist/casts/zap.js +46 -0
  69. package/dist/factories/app-data.d.ts +13 -0
  70. package/dist/factories/app-data.js +20 -0
  71. package/dist/factories/badge-award.d.ts +25 -0
  72. package/dist/factories/badge-award.js +41 -0
  73. package/dist/factories/badge.d.ts +32 -0
  74. package/dist/factories/badge.js +50 -0
  75. package/dist/factories/blossom-server-list.d.ts +19 -0
  76. package/dist/factories/blossom-server-list.js +36 -0
  77. package/dist/factories/bookmark-list.d.ts +23 -0
  78. package/dist/factories/bookmark-list.js +45 -0
  79. package/dist/factories/bookmark-set.d.ts +25 -0
  80. package/dist/factories/bookmark-set.js +51 -0
  81. package/dist/factories/calendar-event.d.ts +83 -0
  82. package/dist/factories/calendar-event.js +166 -0
  83. package/dist/factories/calendar-rsvp.d.ts +23 -0
  84. package/dist/factories/calendar-rsvp.js +36 -0
  85. package/dist/factories/calendar.d.ts +20 -0
  86. package/dist/factories/calendar.js +36 -0
  87. package/dist/factories/chat-message.d.ts +37 -0
  88. package/dist/factories/chat-message.js +56 -0
  89. package/dist/factories/code-snippet.d.ts +63 -0
  90. package/dist/factories/code-snippet.js +95 -0
  91. package/dist/factories/comment.d.ts +24 -0
  92. package/dist/factories/comment.js +46 -0
  93. package/dist/factories/contacts.d.ts +19 -0
  94. package/dist/factories/contacts.js +36 -0
  95. package/dist/factories/favorite-git-repos.d.ts +17 -0
  96. package/dist/factories/favorite-git-repos.js +43 -0
  97. package/dist/factories/file-metadata.d.ts +54 -0
  98. package/dist/factories/file-metadata.js +92 -0
  99. package/dist/factories/follow-set.d.ts +12 -0
  100. package/dist/factories/follow-set.js +22 -0
  101. package/dist/factories/forum-thread.d.ts +34 -0
  102. package/dist/factories/forum-thread.js +50 -0
  103. package/dist/factories/gift-wrap.d.ts +17 -0
  104. package/dist/factories/gift-wrap.js +21 -0
  105. package/dist/factories/git-authors.d.ts +17 -0
  106. package/dist/factories/git-authors.js +24 -0
  107. package/dist/factories/git-grasp-list.d.ts +14 -0
  108. package/dist/factories/git-grasp-list.js +25 -0
  109. package/dist/factories/git-repository.d.ts +51 -0
  110. package/dist/factories/git-repository.js +96 -0
  111. package/dist/factories/group-management.d.ts +63 -0
  112. package/dist/factories/group-management.js +147 -0
  113. package/dist/factories/group.d.ts +33 -0
  114. package/dist/factories/group.js +63 -0
  115. package/dist/factories/highlight.d.ts +24 -0
  116. package/dist/factories/highlight.js +39 -0
  117. package/dist/factories/index.d.ts +45 -0
  118. package/dist/factories/index.js +45 -0
  119. package/dist/factories/legacy-message.d.ts +9 -0
  120. package/dist/factories/legacy-message.js +19 -0
  121. package/dist/factories/list.d.ts +46 -0
  122. package/dist/factories/list.js +99 -0
  123. package/dist/factories/live-stream.d.ts +48 -0
  124. package/dist/factories/live-stream.js +90 -0
  125. package/dist/factories/mute-list.d.ts +27 -0
  126. package/dist/factories/mute-list.js +57 -0
  127. package/dist/factories/nostr-web-token.d.ts +39 -0
  128. package/dist/factories/nostr-web-token.js +95 -0
  129. package/dist/factories/note.d.ts +40 -0
  130. package/dist/factories/note.js +74 -0
  131. package/dist/factories/picture-post.d.ts +27 -0
  132. package/dist/factories/picture-post.js +42 -0
  133. package/dist/factories/pin-list.d.ts +14 -0
  134. package/dist/factories/pin-list.js +24 -0
  135. package/dist/factories/poll-response.d.ts +34 -0
  136. package/dist/factories/poll-response.js +41 -0
  137. package/dist/factories/poll.d.ts +38 -0
  138. package/dist/factories/poll.js +51 -0
  139. package/dist/factories/profile-badges.d.ts +31 -0
  140. package/dist/factories/profile-badges.js +52 -0
  141. package/dist/factories/reaction.d.ts +23 -0
  142. package/dist/factories/reaction.js +37 -0
  143. package/dist/factories/relay-lists.d.ts +46 -0
  144. package/dist/factories/relay-lists.js +93 -0
  145. package/dist/factories/relay-set.d.ts +12 -0
  146. package/dist/factories/relay-set.js +22 -0
  147. package/dist/factories/share.d.ts +19 -0
  148. package/dist/factories/share.js +33 -0
  149. package/dist/factories/stream-chat-message.d.ts +19 -0
  150. package/dist/factories/stream-chat-message.js +26 -0
  151. package/dist/factories/torrent.d.ts +55 -0
  152. package/dist/factories/torrent.js +88 -0
  153. package/dist/factories/wrapped-message.d.ts +22 -0
  154. package/dist/factories/wrapped-message.js +39 -0
  155. package/dist/factories/zap-goal.d.ts +33 -0
  156. package/dist/factories/zap-goal.js +44 -0
  157. package/dist/factories/zap-request.d.ts +28 -0
  158. package/dist/factories/zap-request.js +55 -0
  159. package/dist/factories/zap.d.ts +13 -0
  160. package/dist/factories/zap.js +21 -0
  161. package/dist/helpers/app-data.d.ts +39 -0
  162. package/dist/helpers/app-data.js +68 -0
  163. package/dist/helpers/app-handler.d.ts +22 -0
  164. package/dist/helpers/app-handler.js +67 -0
  165. package/dist/helpers/article.d.ts +14 -0
  166. package/dist/helpers/article.js +24 -0
  167. package/dist/helpers/badge-award.d.ts +15 -0
  168. package/dist/helpers/badge-award.js +32 -0
  169. package/dist/helpers/badge.d.ts +27 -0
  170. package/dist/helpers/badge.js +59 -0
  171. package/dist/helpers/blossom.d.ts +39 -0
  172. package/dist/helpers/blossom.js +97 -0
  173. package/dist/helpers/bolt11.d.ts +10 -0
  174. package/dist/helpers/bolt11.js +17 -0
  175. package/dist/helpers/bookmark.d.ts +31 -0
  176. package/dist/helpers/bookmark.js +87 -0
  177. package/dist/helpers/calendar-event.d.ts +45 -0
  178. package/dist/helpers/calendar-event.js +126 -0
  179. package/dist/helpers/calendar-rsvp.d.ts +15 -0
  180. package/dist/helpers/calendar-rsvp.js +38 -0
  181. package/dist/helpers/calendar.d.ts +6 -0
  182. package/dist/helpers/calendar.js +14 -0
  183. package/dist/helpers/channels.d.ts +13 -0
  184. package/dist/helpers/channels.js +24 -0
  185. package/dist/helpers/code-snippet.d.ts +25 -0
  186. package/dist/helpers/code-snippet.js +37 -0
  187. package/dist/helpers/comment.d.ts +49 -0
  188. package/dist/helpers/comment.js +197 -0
  189. package/dist/helpers/content.d.ts +5 -0
  190. package/dist/helpers/content.js +8 -0
  191. package/dist/helpers/emoji-pack.d.ts +43 -0
  192. package/dist/helpers/emoji-pack.js +108 -0
  193. package/dist/helpers/emoji.d.ts +20 -0
  194. package/dist/helpers/emoji.js +22 -0
  195. package/dist/helpers/encrypted-content-cache.d.ts +22 -0
  196. package/dist/helpers/encrypted-content-cache.js +136 -0
  197. package/dist/helpers/external-id.d.ts +33 -0
  198. package/dist/helpers/external-id.js +66 -0
  199. package/dist/helpers/file-metadata.d.ts +57 -0
  200. package/dist/helpers/file-metadata.js +133 -0
  201. package/dist/helpers/forum-thread.d.ts +10 -0
  202. package/dist/helpers/forum-thread.js +10 -0
  203. package/dist/helpers/gift-wrap.d.ts +64 -0
  204. package/dist/helpers/gift-wrap.js +210 -0
  205. package/dist/helpers/git-grasp-list.d.ts +8 -0
  206. package/dist/helpers/git-grasp-list.js +15 -0
  207. package/dist/helpers/git-lists.d.ts +20 -0
  208. package/dist/helpers/git-lists.js +28 -0
  209. package/dist/helpers/git-repository.d.ts +39 -0
  210. package/dist/helpers/git-repository.js +104 -0
  211. package/dist/helpers/groups.d.ts +156 -0
  212. package/dist/helpers/groups.js +372 -0
  213. package/dist/helpers/hashtag.d.ts +5 -0
  214. package/dist/helpers/hashtag.js +7 -0
  215. package/dist/helpers/highlight.d.ts +45 -0
  216. package/dist/helpers/highlight.js +78 -0
  217. package/dist/helpers/index.d.ts +48 -0
  218. package/dist/helpers/index.js +48 -0
  219. package/dist/helpers/legacy-messages.d.ts +31 -0
  220. package/dist/helpers/legacy-messages.js +49 -0
  221. package/dist/helpers/lists.d.ts +65 -0
  222. package/dist/helpers/lists.js +134 -0
  223. package/dist/helpers/lnurl.d.ts +8 -0
  224. package/dist/helpers/lnurl.js +44 -0
  225. package/dist/helpers/messages.d.ts +31 -0
  226. package/dist/helpers/messages.js +57 -0
  227. package/dist/helpers/mute.d.ts +36 -0
  228. package/dist/helpers/mute.js +116 -0
  229. package/dist/helpers/nostr-web-token.d.ts +54 -0
  230. package/dist/helpers/nostr-web-token.js +124 -0
  231. package/dist/helpers/picture-post.d.ts +5 -0
  232. package/dist/helpers/picture-post.js +6 -0
  233. package/dist/helpers/poll.d.ts +46 -0
  234. package/dist/helpers/poll.js +78 -0
  235. package/dist/helpers/profile-badges.d.ts +23 -0
  236. package/dist/helpers/profile-badges.js +51 -0
  237. package/dist/helpers/reaction.d.ts +8 -0
  238. package/dist/helpers/reaction.js +60 -0
  239. package/dist/helpers/relay-discovery.d.ts +87 -0
  240. package/dist/helpers/relay-discovery.js +126 -0
  241. package/dist/helpers/relay-list.d.ts +19 -0
  242. package/dist/helpers/relay-list.js +26 -0
  243. package/dist/helpers/reports.d.ts +31 -0
  244. package/dist/helpers/reports.js +42 -0
  245. package/dist/helpers/share.d.ts +19 -0
  246. package/dist/helpers/share.js +58 -0
  247. package/dist/helpers/stream-chat.d.ts +7 -0
  248. package/dist/helpers/stream-chat.js +12 -0
  249. package/dist/helpers/stream.d.ts +31 -0
  250. package/dist/helpers/stream.js +87 -0
  251. package/dist/helpers/threading.d.ts +57 -0
  252. package/dist/helpers/threading.js +94 -0
  253. package/dist/helpers/torrent.d.ts +55 -0
  254. package/dist/helpers/torrent.js +270 -0
  255. package/dist/helpers/trusted-assertions.d.ts +81 -0
  256. package/dist/helpers/trusted-assertions.js +161 -0
  257. package/dist/helpers/user-status.d.ts +18 -0
  258. package/dist/helpers/user-status.js +31 -0
  259. package/dist/helpers/wrapped-messages.d.ts +14 -0
  260. package/dist/helpers/wrapped-messages.js +23 -0
  261. package/dist/helpers/zap-goal.d.ts +63 -0
  262. package/dist/helpers/zap-goal.js +127 -0
  263. package/dist/helpers/zap.d.ts +52 -0
  264. package/dist/helpers/zap.js +130 -0
  265. package/dist/index.d.ts +7 -0
  266. package/dist/index.js +8 -0
  267. package/dist/models/__register__.d.ts +5 -0
  268. package/dist/models/__register__.js +6 -0
  269. package/dist/models/blossom.d.ts +11 -0
  270. package/dist/models/blossom.js +18 -0
  271. package/dist/models/bookmarks.d.ts +6 -0
  272. package/dist/models/bookmarks.js +16 -0
  273. package/dist/models/calendar.d.ts +6 -0
  274. package/dist/models/calendar.js +18 -0
  275. package/dist/models/channels.d.ts +11 -0
  276. package/dist/models/channels.js +55 -0
  277. package/dist/models/comments.d.ts +12 -0
  278. package/dist/models/comments.js +29 -0
  279. package/dist/models/gift-wrap.d.ts +7 -0
  280. package/dist/models/gift-wrap.js +20 -0
  281. package/dist/models/index.d.ts +20 -0
  282. package/dist/models/index.js +22 -0
  283. package/dist/models/legacy-messages.d.ts +14 -0
  284. package/dist/models/legacy-messages.js +64 -0
  285. package/dist/models/mutes.d.ts +16 -0
  286. package/dist/models/mutes.js +34 -0
  287. package/dist/models/pins.d.ts +4 -0
  288. package/dist/models/pins.js +10 -0
  289. package/dist/models/reactions.d.ts +11 -0
  290. package/dist/models/reactions.js +11 -0
  291. package/dist/models/relay-lists.d.ts +27 -0
  292. package/dist/models/relay-lists.js +37 -0
  293. package/dist/models/shares.d.ts +3 -0
  294. package/dist/models/shares.js +5 -0
  295. package/dist/models/stream.d.ts +4 -0
  296. package/dist/models/stream.js +6 -0
  297. package/dist/models/thread.d.ts +33 -0
  298. package/dist/models/thread.js +118 -0
  299. package/dist/models/user-status.d.ts +11 -0
  300. package/dist/models/user-status.js +32 -0
  301. package/dist/models/wrapped-messages.d.ts +31 -0
  302. package/dist/models/wrapped-messages.js +76 -0
  303. package/dist/models/zap-goals.d.ts +9 -0
  304. package/dist/models/zap-goals.js +28 -0
  305. package/dist/models/zaps.d.ts +10 -0
  306. package/dist/models/zaps.js +18 -0
  307. package/dist/observable/cast-stream.d.ts +1 -0
  308. package/dist/observable/cast-stream.js +2 -0
  309. package/dist/observable/chainable.d.ts +1 -0
  310. package/dist/observable/chainable.js +2 -0
  311. package/dist/observable/filter-timeline-by-mutes.d.ts +6 -0
  312. package/dist/observable/filter-timeline-by-mutes.js +11 -0
  313. package/dist/observable/index.d.ts +3 -0
  314. package/dist/observable/index.js +3 -0
  315. package/dist/operations/app-data.d.ts +11 -0
  316. package/dist/operations/app-data.js +26 -0
  317. package/dist/operations/badge-award.d.ts +17 -0
  318. package/dist/operations/badge-award.js +30 -0
  319. package/dist/operations/badge.d.ts +22 -0
  320. package/dist/operations/badge.js +54 -0
  321. package/dist/operations/blossom.d.ts +5 -0
  322. package/dist/operations/blossom.js +13 -0
  323. package/dist/operations/calendar-event.d.ts +34 -0
  324. package/dist/operations/calendar-event.js +72 -0
  325. package/dist/operations/calendar-rsvp.d.ts +10 -0
  326. package/dist/operations/calendar-rsvp.js +37 -0
  327. package/dist/operations/calendar.d.ts +9 -0
  328. package/dist/operations/calendar.js +14 -0
  329. package/dist/operations/channel.d.ts +4 -0
  330. package/dist/operations/channel.js +10 -0
  331. package/dist/operations/chat-message.d.ts +9 -0
  332. package/dist/operations/chat-message.js +12 -0
  333. package/dist/operations/client.d.ts +4 -0
  334. package/dist/operations/client.js +23 -0
  335. package/dist/operations/code-snippet.d.ts +27 -0
  336. package/dist/operations/code-snippet.js +63 -0
  337. package/dist/operations/comment.d.ts +9 -0
  338. package/dist/operations/comment.js +29 -0
  339. package/dist/operations/file-metadata.d.ts +38 -0
  340. package/dist/operations/file-metadata.js +107 -0
  341. package/dist/operations/forum-thread.d.ts +3 -0
  342. package/dist/operations/forum-thread.js +6 -0
  343. package/dist/operations/geohash.d.ts +5 -0
  344. package/dist/operations/geohash.js +17 -0
  345. package/dist/operations/gift-wrap.d.ts +25 -0
  346. package/dist/operations/gift-wrap.js +103 -0
  347. package/dist/operations/git-grasp-list.d.ts +7 -0
  348. package/dist/operations/git-grasp-list.js +18 -0
  349. package/dist/operations/git-repository.d.ts +45 -0
  350. package/dist/operations/git-repository.js +160 -0
  351. package/dist/operations/group.d.ts +24 -0
  352. package/dist/operations/group.js +72 -0
  353. package/dist/operations/hashtags.d.ts +9 -0
  354. package/dist/operations/hashtags.js +24 -0
  355. package/dist/operations/highlight.d.ts +18 -0
  356. package/dist/operations/highlight.js +63 -0
  357. package/dist/operations/index.d.ts +40 -0
  358. package/dist/operations/index.js +40 -0
  359. package/dist/operations/legacy-message.d.ts +6 -0
  360. package/dist/operations/legacy-message.js +13 -0
  361. package/dist/operations/list.d.ts +7 -0
  362. package/dist/operations/list.js +14 -0
  363. package/dist/operations/live-stream.d.ts +8 -0
  364. package/dist/operations/live-stream.js +21 -0
  365. package/dist/operations/media-attachment.d.ts +4 -0
  366. package/dist/operations/media-attachment.js +12 -0
  367. package/dist/operations/nostr-web-token.d.ts +27 -0
  368. package/dist/operations/nostr-web-token.js +58 -0
  369. package/dist/operations/note.d.ts +15 -0
  370. package/dist/operations/note.js +48 -0
  371. package/dist/operations/picture-post.d.ts +4 -0
  372. package/dist/operations/picture-post.js +14 -0
  373. package/dist/operations/poll-response.d.ts +9 -0
  374. package/dist/operations/poll-response.js +20 -0
  375. package/dist/operations/poll.d.ts +20 -0
  376. package/dist/operations/poll.js +43 -0
  377. package/dist/operations/profile-badges.d.ts +26 -0
  378. package/dist/operations/profile-badges.js +150 -0
  379. package/dist/operations/reaction.d.ts +22 -0
  380. package/dist/operations/reaction.js +44 -0
  381. package/dist/operations/share.d.ts +13 -0
  382. package/dist/operations/share.js +41 -0
  383. package/dist/operations/stream-chat.d.ts +8 -0
  384. package/dist/operations/stream-chat.js +32 -0
  385. package/dist/operations/stream.d.ts +41 -0
  386. package/dist/operations/stream.js +83 -0
  387. package/dist/operations/tag/bookmarks.d.ts +7 -0
  388. package/dist/operations/tag/bookmarks.js +42 -0
  389. package/dist/operations/tag/index.d.ts +1 -0
  390. package/dist/operations/tag/index.js +1 -0
  391. package/dist/operations/torrent.d.ts +35 -0
  392. package/dist/operations/torrent.js +70 -0
  393. package/dist/operations/wrapped-message.d.ts +12 -0
  394. package/dist/operations/wrapped-message.js +28 -0
  395. package/dist/operations/zap-goal.d.ts +18 -0
  396. package/dist/operations/zap-goal.js +38 -0
  397. package/dist/operations/zap-request.d.ts +22 -0
  398. package/dist/operations/zap-request.js +40 -0
  399. package/dist/operations/zap-split.d.ts +14 -0
  400. package/dist/operations/zap-split.js +24 -0
  401. package/dist/operations/zap.d.ts +12 -0
  402. package/dist/operations/zap.js +34 -0
  403. package/package.json +117 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 hzrd149
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # applesauce-common
2
+
3
+ Applesauce is a collection of utilities for building reactive nostr applications. The common package provides NIP-specific helpers, models, operations, and utilities for working with various Nostr Improvement Proposals (NIPs). This package contains all the extra functionality that applications can use with nostr events that is not directly related to the core protocol.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install applesauce-common
9
+ ```
10
+
11
+ or
12
+
13
+ ```bash
14
+ yarn add applesauce-common
15
+ ```
16
+
17
+ or
18
+
19
+ ```bash
20
+ pnpm add applesauce-common
21
+ ```
22
+
23
+ ## Key Components
24
+
25
+ - **Helpers**: NIP-specific utility methods for parsing and extracting data from nostr events
26
+ - **Models**: Complex reactive subscriptions for NIP-specific nostr data patterns
27
+ - **Operations**: Functions for creating and constructing nostr events according to various NIPs
28
+ - **Blueprints**: Event blueprints and templates for creating properly formatted nostr events
29
+ - **Casts**: Type casting utilities for converting between different event representations
30
+ - **Observable**: Observable utilities and operators for working with reactive streams of nostr events
31
+
32
+ ## Documentation
33
+
34
+ For detailed documentation and guides, visit:
35
+
36
+ - [Getting Started](https://applesauce.build/introduction/getting-started)
37
+ - [API Reference](https://applesauce.build/typedoc/)
38
+
39
+ ## Example
40
+
41
+ ```js
42
+ import { EventStore } from "applesauce-core";
43
+ import { ThreadModel } from "applesauce-common/models";
44
+ import { getNip10References } from "applesauce-common/helpers/threading";
45
+ import { Relay } from "nostr-tools/relay";
46
+
47
+ // Create a single EventStore instance for your app
48
+ const eventStore = new EventStore();
49
+
50
+ // Use any nostr library for relay connections (nostr-tools, ndk, nostrify, etc...)
51
+ const relay = await Relay.connect("wss://relay.example.com");
52
+
53
+ // Subscribe to events and add them to the store
54
+ const sub = relay.subscribe([{ ids: ["event-id"] }], {
55
+ onevent(event) {
56
+ eventStore.add(event);
57
+ },
58
+ });
59
+
60
+ // Get NIP-10 thread references
61
+ const refs = getNip10References(event);
62
+
63
+ // Subscribe to a thread using ThreadModel
64
+ const thread = eventStore.model(ThreadModel, "event-id");
65
+
66
+ thread.subscribe((thread) => {
67
+ console.log(thread);
68
+ });
69
+ ```
70
+
71
+ ## Supported NIPs
72
+
73
+ This package includes helpers, models, and operations for various NIPs including:
74
+
75
+ - NIP-10 (Threading)
76
+ - NIP-18 (Reposts)
77
+ - NIP-22 (Comments)
78
+ - NIP-23 (Articles)
79
+ - NIP-25 (Reactions)
80
+ - NIP-28 (Channels)
81
+ - NIP-52 (Calendar Events)
82
+ - NIP-53 (Streams)
83
+ - NIP-57 (Zaps)
84
+ - NIP-88 (Polls)
85
+ - And many more...
86
+
87
+ ## Exports
88
+
89
+ The package provides several export paths:
90
+
91
+ - `applesauce-common` - Main exports (Helpers, Models, Operations, etc.)
92
+ - `applesauce-common/helpers` - All helper functions
93
+ - `applesauce-common/helpers/*` - Individual helper modules
94
+ - `applesauce-common/models` - All model functions
95
+ - `applesauce-common/models/*` - Individual model modules
96
+ - `applesauce-common/operations` - All operation functions
97
+ - `applesauce-common/operations/*` - Individual operation modules
98
+ - `applesauce-common/blueprints` - Event blueprints
99
+ - `applesauce-common/casts` - Type casting utilities
100
+ - `applesauce-common/observable` - Observable utilities
@@ -0,0 +1,9 @@
1
+ export * from "./profile.js";
2
+ export * from "./mutes.js";
3
+ export * from "./bookmarks.js";
4
+ export * from "./favorite-emojis.js";
5
+ export * from "./git-grasp-list.js";
6
+ export * from "./git-lists.js";
7
+ export * from "./relay-lists.js";
8
+ export * from "./groups.js";
9
+ export * from "./trusted-assertions.js";
@@ -0,0 +1,11 @@
1
+ // Export all casts that need to be added to the User prototype in a single module
2
+ // This is to optimize the code-splitting for downstream bundlers that split on "await import()"
3
+ export * from "./profile.js";
4
+ export * from "./mutes.js";
5
+ export * from "./bookmarks.js";
6
+ export * from "./favorite-emojis.js";
7
+ export * from "./git-grasp-list.js";
8
+ export * from "./git-lists.js";
9
+ export * from "./relay-lists.js";
10
+ export * from "./groups.js";
11
+ export * from "./trusted-assertions.js";
@@ -0,0 +1,19 @@
1
+ import { NostrEvent } from "applesauce-core/helpers";
2
+ import { ArticleEvent } from "../helpers/article.js";
3
+ import { CastRefEventStore, EventCast } from "./cast.js";
4
+ import { Reaction } from "./reaction.js";
5
+ export declare class Article extends EventCast<ArticleEvent> {
6
+ constructor(event: NostrEvent, store: CastRefEventStore);
7
+ get title(): string;
8
+ get image(): string | undefined;
9
+ get summary(): string | undefined;
10
+ get published(): number;
11
+ get publishedDate(): Date;
12
+ get pointer(): import("nostr-tools/nip19").AddressPointer;
13
+ /** An observable of the address with relay hints from the authors outboxes */
14
+ get pointer$(): import("applesauce-core").Observable<import("nostr-tools/nip19").AddressPointer>;
15
+ get address(): `naddr1${string}`;
16
+ /** An observable of the address with relay hints from the authors outboxes */
17
+ get address$(): import("applesauce-core").Observable<`naddr1${string}`>;
18
+ get reactions$(): import("applesauce-core").ChainableObservable<Reaction[]>;
19
+ }
@@ -0,0 +1,47 @@
1
+ import { withImmediateValueOrDefault } from "applesauce-core";
2
+ import { addRelayHintsToPointer, getAddressPointerForEvent, naddrEncode } from "applesauce-core/helpers";
3
+ import { map } from "rxjs";
4
+ import { getArticleImage, getArticlePublished, getArticleSummary, getArticleTitle, isValidArticle, } from "../helpers/article.js";
5
+ import { ReactionsModel } from "../models/reactions.js";
6
+ import { castTimelineStream } from "../observable/cast-stream.js";
7
+ import { EventCast } from "./cast.js";
8
+ import { Reaction } from "./reaction.js";
9
+ export class Article extends EventCast {
10
+ constructor(event, store) {
11
+ if (!isValidArticle(event))
12
+ throw new Error("Invalid article");
13
+ super(event, store);
14
+ }
15
+ get title() {
16
+ return getArticleTitle(this.event);
17
+ }
18
+ get image() {
19
+ return getArticleImage(this.event);
20
+ }
21
+ get summary() {
22
+ return getArticleSummary(this.event);
23
+ }
24
+ get published() {
25
+ return getArticlePublished(this.event);
26
+ }
27
+ get publishedDate() {
28
+ return new Date(this.published * 1000);
29
+ }
30
+ get pointer() {
31
+ return getAddressPointerForEvent(this.event);
32
+ }
33
+ /** An observable of the address with relay hints from the authors outboxes */
34
+ get pointer$() {
35
+ return this.author.outboxes$.pipe(withImmediateValueOrDefault(undefined), map((outboxes) => (outboxes ? addRelayHintsToPointer(this.pointer, outboxes.slice(0, 3)) : this.pointer)));
36
+ }
37
+ get address() {
38
+ return naddrEncode(this.pointer);
39
+ }
40
+ /** An observable of the address with relay hints from the authors outboxes */
41
+ get address$() {
42
+ return this.pointer$.pipe(map((pointer) => naddrEncode(pointer)));
43
+ }
44
+ get reactions$() {
45
+ return this.$$ref("reactions$", (store) => store.model(ReactionsModel, this.event).pipe(castTimelineStream(Reaction, store)));
46
+ }
47
+ }
@@ -0,0 +1,24 @@
1
+ import { ChainableObservable } from "applesauce-core";
2
+ import { User } from "applesauce-core/casts/user";
3
+ import { NostrEvent } from "applesauce-core/helpers/event";
4
+ import { AddressPointer } from "applesauce-core/helpers/pointers";
5
+ import { BadgeAwardEvent } from "../helpers/badge-award.js";
6
+ import { Badge } from "./badge.js";
7
+ import { CastRefEventStore, EventCast } from "./cast.js";
8
+ /** Cast for badge award events (kind 8) */
9
+ export declare class BadgeAward extends EventCast<BadgeAwardEvent> {
10
+ constructor(event: NostrEvent, store: CastRefEventStore);
11
+ /** Returns the address pointer to the badge definition */
12
+ get pointer(): AddressPointer;
13
+ /** Returns the array of users who received the badge */
14
+ get recipients(): User[];
15
+ /** Returns the User who issued the badge */
16
+ get issuer(): User;
17
+ /** Returns the badge definition */
18
+ get badge$(): ChainableObservable<Badge | undefined>;
19
+ }
20
+ declare module "applesauce-core/casts" {
21
+ interface User {
22
+ get badgeAwards$(): ChainableObservable<BadgeAward[]>;
23
+ }
24
+ }
@@ -0,0 +1,39 @@
1
+ import { castUser, User } from "applesauce-core/casts/user";
2
+ import { kinds } from "applesauce-core/helpers/event";
3
+ import { getBadgeAwardPointer, getBadgeAwardRecipients, isValidBadgeAward, } from "../helpers/badge-award.js";
4
+ import { castEventStream, castTimelineStream } from "../observable/cast-stream.js";
5
+ import { Badge } from "./badge.js";
6
+ import { EventCast } from "./cast.js";
7
+ /** Cast for badge award events (kind 8) */
8
+ export class BadgeAward extends EventCast {
9
+ constructor(event, store) {
10
+ if (!isValidBadgeAward(event))
11
+ throw new Error("Invalid badge award event");
12
+ super(event, store);
13
+ }
14
+ /** Returns the address pointer to the badge definition */
15
+ get pointer() {
16
+ return getBadgeAwardPointer(this.event);
17
+ }
18
+ /** Returns the array of users who received the badge */
19
+ get recipients() {
20
+ return getBadgeAwardRecipients(this.event).map((pointer) => castUser(pointer, this.store));
21
+ }
22
+ /** Returns the User who issued the badge */
23
+ get issuer() {
24
+ return this.author;
25
+ }
26
+ /** Returns the badge definition */
27
+ get badge$() {
28
+ return this.$$ref("badge$", (store) => store.event(this.pointer).pipe(castEventStream(Badge, store)));
29
+ }
30
+ }
31
+ Object.defineProperty(User.prototype, "badgeAwards$", {
32
+ get() {
33
+ return this.$$ref("badges$", (store) => store
34
+ .timeline({ kinds: [kinds.BadgeAward], "#p": [this.pubkey] })
35
+ .pipe(castTimelineStream(BadgeAward, this.store)));
36
+ },
37
+ configurable: true,
38
+ enumerable: false,
39
+ });
@@ -0,0 +1,19 @@
1
+ import { ChainableObservable } from "applesauce-core";
2
+ import { AddressPointer } from "applesauce-core/helpers";
3
+ import { NostrEvent } from "applesauce-core/helpers/event";
4
+ import { BadgeEvent } from "../helpers/badge.js";
5
+ import { BadgeAward } from "./badge-award.js";
6
+ import { CastRefEventStore, EventCast } from "./cast.js";
7
+ /** Cast for badge definition events (kind 30009) */
8
+ export declare class Badge extends EventCast<BadgeEvent> {
9
+ #private;
10
+ constructor(event: NostrEvent, store: CastRefEventStore);
11
+ get identifier(): string;
12
+ get pointer(): AddressPointer;
13
+ get name(): string | undefined;
14
+ get description(): string | undefined;
15
+ get image(): import("../helpers/badge.js").BadgeThumbnail | undefined;
16
+ get thumbnails(): import("../helpers/badge.js").BadgeThumbnail[];
17
+ /** Returns a timeline of all badge awards for this badge */
18
+ get awards$(): ChainableObservable<BadgeAward[]>;
19
+ }
@@ -0,0 +1,48 @@
1
+ import { getAddressPointerForEvent, getReplaceableAddressFromPointer } from "applesauce-core/helpers";
2
+ import { kinds } from "applesauce-core/helpers/event";
3
+ import { getBadgeDescription, getBadgeIdentifier, getBadgeImage, getBadgeName, getBadgeThumbnails, } from "../helpers/badge.js";
4
+ import { castTimelineStream } from "../observable/cast-stream.js";
5
+ import { BadgeAward } from "./badge-award.js";
6
+ import { EventCast } from "./cast.js";
7
+ function isBadge(event) {
8
+ if (event.kind !== kinds.BadgeDefinition)
9
+ throw new Error("Invalid badge definition event");
10
+ }
11
+ /** Cast for badge definition events (kind 30009) */
12
+ export class Badge extends EventCast {
13
+ #identifier;
14
+ constructor(event, store) {
15
+ isBadge(event);
16
+ super(event, store);
17
+ const identifier = getBadgeIdentifier(event);
18
+ if (!identifier)
19
+ throw new Error("Invalid badge definition payload");
20
+ this.#identifier = identifier;
21
+ }
22
+ get identifier() {
23
+ return this.#identifier;
24
+ }
25
+ get pointer() {
26
+ return getAddressPointerForEvent(this.event);
27
+ }
28
+ get name() {
29
+ return getBadgeName(this.event);
30
+ }
31
+ get description() {
32
+ return getBadgeDescription(this.event);
33
+ }
34
+ get image() {
35
+ return getBadgeImage(this.event);
36
+ }
37
+ get thumbnails() {
38
+ return getBadgeThumbnails(this.event);
39
+ }
40
+ /** Returns a timeline of all badge awards for this badge */
41
+ get awards$() {
42
+ return this.$$ref("awards$", (store) => {
43
+ return store
44
+ .timeline({ kinds: [kinds.BadgeAward], "#a": [getReplaceableAddressFromPointer(this.pointer)] })
45
+ .pipe(castTimelineStream(BadgeAward, store));
46
+ });
47
+ }
48
+ }
@@ -0,0 +1,35 @@
1
+ import { HiddenContentSigner, NostrEvent } from "applesauce-core/helpers";
2
+ import { BookmarkListEvent, BookmarkSetEvent } from "../helpers/bookmark.js";
3
+ import { Article } from "./article.js";
4
+ import { CastRefEventStore, EventCast } from "./cast.js";
5
+ import { Note } from "./note.js";
6
+ /** Base class for bookmarks lists and sets */
7
+ declare class BookmarksListBase<T extends BookmarkListEvent | BookmarkSetEvent> extends EventCast<T> {
8
+ constructor(event: T, store: CastRefEventStore);
9
+ get bookmarks(): import("../helpers/bookmark.js").BookmarkPointer[];
10
+ get articles(): import("nostr-tools/nip19").AddressPointer[];
11
+ get notes(): import("nostr-tools/nip19").EventPointer[];
12
+ get notes$(): import("applesauce-core/observable").ChainableObservable<Note[]>;
13
+ get articles$(): import("applesauce-core/observable").ChainableObservable<Article[]>;
14
+ /** Get the unlocked hidden bookmarks */
15
+ get hidden(): import("../helpers/bookmark.js").BookmarkPointer[] | undefined;
16
+ /** An observable that updates when hidden bookmarks are unlocked */
17
+ get hidden$(): import("applesauce-core/observable").ChainableObservable<import("../helpers/bookmark.js").BookmarkPointer[] | undefined>;
18
+ get hiddenNotes$(): import("applesauce-core/observable").ChainableObservable<Note[] | undefined>;
19
+ get hiddenArticles$(): import("applesauce-core/observable").ChainableObservable<Article[] | undefined>;
20
+ /** Whether the bookmark set has hidden bookmarks */
21
+ get hasHidden(): boolean;
22
+ /** Whether the bookmark set is unlocked */
23
+ get unlocked(): boolean;
24
+ /** Unlocks the hidden bookmarks on the bookmark set */
25
+ unlock(signer: HiddenContentSigner): Promise<import("../helpers/bookmark.js").BookmarkPointer[]>;
26
+ }
27
+ /** A class for bookmarks lists (kind 10003) */
28
+ export declare class BookmarksList extends BookmarksListBase<BookmarkListEvent> {
29
+ constructor(event: NostrEvent, store: CastRefEventStore);
30
+ }
31
+ /** A class for bookmarks sets (kind 30003) */
32
+ export declare class BookmarksSet extends BookmarksListBase<BookmarkSetEvent> {
33
+ constructor(event: NostrEvent, store: CastRefEventStore);
34
+ }
35
+ export {};
@@ -0,0 +1,91 @@
1
+ import { hasHiddenContent, isAddressPointer, isEventPointer, } from "applesauce-core/helpers";
2
+ import { watchEventUpdates } from "applesauce-core/observable";
3
+ import { combineLatest, map, of, switchMap } from "rxjs";
4
+ import { getBookmarks, getHiddenBookmarks, isHiddenBookmarksUnlocked, isValidBookmarkList, isValidBookmarkSet, unlockHiddenBookmarks, } from "../helpers/bookmark.js";
5
+ import { castTimelineStream } from "../observable/cast-stream.js";
6
+ import { Article } from "./article.js";
7
+ import { EventCast } from "./cast.js";
8
+ import { Note } from "./note.js";
9
+ /** Base class for bookmarks lists and sets */
10
+ class BookmarksListBase extends EventCast {
11
+ constructor(event, store) {
12
+ if (!isValidBookmarkList(event) && !isValidBookmarkSet(event))
13
+ throw new Error("Invalid bookmark list or set");
14
+ super(event, store);
15
+ }
16
+ get bookmarks() {
17
+ return getBookmarks(this.event);
18
+ }
19
+ get articles() {
20
+ return this.bookmarks.filter((pointer) => isAddressPointer(pointer));
21
+ }
22
+ get notes() {
23
+ return this.bookmarks.filter((pointer) => isEventPointer(pointer));
24
+ }
25
+ get notes$() {
26
+ return this.$$ref("notes$", (store) => combineLatest(this.notes.map((pointer) => store.event(pointer))).pipe(map((arr) => arr.filter((e) => !!e)), castTimelineStream(Note, store)));
27
+ }
28
+ get articles$() {
29
+ return this.$$ref("articles$", (store) => combineLatest(this.articles.map((pointer) => store.replaceable(pointer))).pipe(map((arr) => arr.filter((e) => !!e)), castTimelineStream(Article, store)));
30
+ }
31
+ /** Get the unlocked hidden bookmarks */
32
+ get hidden() {
33
+ return getHiddenBookmarks(this.event);
34
+ }
35
+ /** An observable that updates when hidden bookmarks are unlocked */
36
+ get hidden$() {
37
+ return this.$$ref("hidden$", (store) => of(this.event).pipe(
38
+ // Watch for event updates
39
+ watchEventUpdates(store),
40
+ // Get hidden bookmarks
41
+ map((event) => event && getHiddenBookmarks(event))));
42
+ }
43
+ get hiddenNotes$() {
44
+ return this.$$ref("hiddenNotes$", (store) => this.hidden$.pipe(switchMap((hidden) => {
45
+ if (hidden === undefined)
46
+ return of(undefined);
47
+ const eventPointers = hidden.filter((pointer) => isEventPointer(pointer));
48
+ if (eventPointers.length === 0)
49
+ return of([]);
50
+ return combineLatest(eventPointers.map((pointer) => store.event(pointer))).pipe(map((arr) => arr.filter((e) => !!e)), castTimelineStream(Note, store));
51
+ })));
52
+ }
53
+ get hiddenArticles$() {
54
+ return this.$$ref("hiddenArticles$", (store) => this.hidden$.pipe(switchMap((hidden) => {
55
+ if (hidden === undefined)
56
+ return of(undefined);
57
+ const addressPointers = hidden.filter((pointer) => isAddressPointer(pointer));
58
+ if (addressPointers.length === 0)
59
+ return of([]);
60
+ return combineLatest(addressPointers.map((pointer) => store.replaceable(pointer))).pipe(map((arr) => arr.filter((e) => !!e)), castTimelineStream(Article, store));
61
+ })));
62
+ }
63
+ /** Whether the bookmark set has hidden bookmarks */
64
+ get hasHidden() {
65
+ return hasHiddenContent(this.event);
66
+ }
67
+ /** Whether the bookmark set is unlocked */
68
+ get unlocked() {
69
+ return isHiddenBookmarksUnlocked(this.event);
70
+ }
71
+ /** Unlocks the hidden bookmarks on the bookmark set */
72
+ async unlock(signer) {
73
+ return unlockHiddenBookmarks(this.event, signer);
74
+ }
75
+ }
76
+ /** A class for bookmarks lists (kind 10003) */
77
+ export class BookmarksList extends BookmarksListBase {
78
+ constructor(event, store) {
79
+ if (!isValidBookmarkList(event))
80
+ throw new Error("Invalid bookmark list");
81
+ super(event, store);
82
+ }
83
+ }
84
+ /** A class for bookmarks sets (kind 30003) */
85
+ export class BookmarksSet extends BookmarksListBase {
86
+ constructor(event, store) {
87
+ if (!isValidBookmarkSet(event))
88
+ throw new Error("Invalid bookmark set");
89
+ super(event, store);
90
+ }
91
+ }
@@ -0,0 +1 @@
1
+ export { castEvent, castPubkey, type CastRefEventStore, CAST_REF_SYMBOL, CASTS_SYMBOL, type CastConstructor, type PubkeyCastConstructor, EventCast, PubkeyCast, } from "applesauce-core/casts";
@@ -0,0 +1,2 @@
1
+ // Re-exported from applesauce-core — cast infrastructure now lives in the core package
2
+ export { castEvent, castPubkey, CAST_REF_SYMBOL, CASTS_SYMBOL, EventCast, PubkeyCast, } from "applesauce-core/casts";
@@ -0,0 +1,14 @@
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
+ import { type CodeSnippetEvent } from "../helpers/code-snippet.js";
3
+ import { CastRefEventStore, EventCast } from "./cast.js";
4
+ export declare class CodeSnippet extends EventCast<CodeSnippetEvent> {
5
+ constructor(event: NostrEvent, store: CastRefEventStore);
6
+ get language(): string;
7
+ get name(): string;
8
+ get description(): string | undefined;
9
+ get extension(): string;
10
+ get runtime(): string | undefined;
11
+ get license(): string[];
12
+ get repo(): string | undefined;
13
+ get dependencies(): string[];
14
+ }
@@ -0,0 +1,33 @@
1
+ import { getCodeSnippetDependencies, getCodeSnippetDescription, getCodeSnippetExtension, getCodeSnippetLanguage, getCodeSnippetLicense, getCodeSnippetName, getCodeSnippetRepo, getCodeSnippetRuntime, isValidCodeSnippet, } from "../helpers/code-snippet.js";
2
+ import { EventCast } from "./cast.js";
3
+ export class CodeSnippet extends EventCast {
4
+ constructor(event, store) {
5
+ if (!isValidCodeSnippet(event))
6
+ throw new Error("Invalid code snippet");
7
+ super(event, store);
8
+ }
9
+ get language() {
10
+ return getCodeSnippetLanguage(this.event);
11
+ }
12
+ get name() {
13
+ return getCodeSnippetName(this.event);
14
+ }
15
+ get description() {
16
+ return getCodeSnippetDescription(this.event);
17
+ }
18
+ get extension() {
19
+ return getCodeSnippetExtension(this.event) || "ts";
20
+ }
21
+ get runtime() {
22
+ return getCodeSnippetRuntime(this.event);
23
+ }
24
+ get license() {
25
+ return getCodeSnippetLicense(this.event);
26
+ }
27
+ get repo() {
28
+ return getCodeSnippetRepo(this.event);
29
+ }
30
+ get dependencies() {
31
+ return getCodeSnippetDependencies(this.event);
32
+ }
33
+ }
@@ -0,0 +1,18 @@
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
+ import { CommentEvent } from "../helpers/comment.js";
3
+ import { CastRefEventStore, EventCast } from "./cast.js";
4
+ import { Reaction } from "./reaction.js";
5
+ import { Zap } from "./zap.js";
6
+ /** Cast a kind 1111 event to a Comment */
7
+ export declare class Comment extends EventCast<CommentEvent> {
8
+ constructor(event: NostrEvent, store: CastRefEventStore);
9
+ get rootPointer(): import("../helpers/comment.js").CommentPointer;
10
+ get replyPointer(): import("../helpers/comment.js").CommentPointer | null;
11
+ /** Get the event at the root of this thread */
12
+ get root$(): import("applesauce-core").ChainableObservable<NostrEvent | undefined>;
13
+ /** Get the event that this comment is replying to */
14
+ get parent$(): import("applesauce-core").ChainableObservable<NostrEvent | undefined>;
15
+ get zaps$(): import("applesauce-core").ChainableObservable<Zap[]>;
16
+ get replies$(): import("applesauce-core").ChainableObservable<Comment[]>;
17
+ get reactions$(): import("applesauce-core").ChainableObservable<Reaction[]>;
18
+ }
@@ -0,0 +1,54 @@
1
+ import { of } from "rxjs";
2
+ import { getCommentReplyPointer, getCommentRootPointer, isValidComment } from "../helpers/comment.js";
3
+ import { CommentsModel } from "../models/comments.js";
4
+ import { ReactionsModel } from "../models/reactions.js";
5
+ import { EventZapsModel } from "../models/zaps.js";
6
+ import { castTimelineStream } from "../observable/cast-stream.js";
7
+ import { EventCast } from "./cast.js";
8
+ import { Reaction } from "./reaction.js";
9
+ import { Zap } from "./zap.js";
10
+ /** Cast a kind 1111 event to a Comment */
11
+ export class Comment extends EventCast {
12
+ constructor(event, store) {
13
+ if (!isValidComment(event))
14
+ throw new Error("Invalid comment");
15
+ super(event, store);
16
+ }
17
+ get rootPointer() {
18
+ return getCommentRootPointer(this.event);
19
+ }
20
+ get replyPointer() {
21
+ return getCommentReplyPointer(this.event);
22
+ }
23
+ /** Get the event at the root of this thread */
24
+ get root$() {
25
+ return this.$$ref("root$", (store) => {
26
+ const pointer = this.rootPointer;
27
+ if (pointer.type === "event" || pointer.type === "address")
28
+ return store.event(pointer);
29
+ else
30
+ return of(undefined);
31
+ });
32
+ }
33
+ /** Get the event that this comment is replying to */
34
+ get parent$() {
35
+ return this.$$ref("parent$", (store) => {
36
+ const pointer = this.replyPointer;
37
+ if (!pointer)
38
+ return of(undefined);
39
+ else if (pointer.type === "event" || pointer.type === "address")
40
+ return store.event(pointer);
41
+ else
42
+ return of(undefined);
43
+ });
44
+ }
45
+ get zaps$() {
46
+ return this.$$ref("zaps$", (store) => store.model(EventZapsModel, this.event).pipe(castTimelineStream(Zap, store)));
47
+ }
48
+ get replies$() {
49
+ return this.$$ref("replies$", (store) => store.model(CommentsModel, this.event).pipe(castTimelineStream(Comment, store)));
50
+ }
51
+ get reactions$() {
52
+ return this.$$ref("reactions$", (store) => store.model(ReactionsModel, this.event).pipe(castTimelineStream(Reaction, store)));
53
+ }
54
+ }
@@ -0,0 +1,11 @@
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
+ import { EmojiPackEvent } from "../helpers/emoji-pack.js";
3
+ import { CastRefEventStore, EventCast } from "./cast.js";
4
+ export declare class EmojiPack extends EventCast<EmojiPackEvent> {
5
+ constructor(event: NostrEvent, store: CastRefEventStore);
6
+ get identifier(): string;
7
+ get name(): string | undefined;
8
+ get title(): string | undefined;
9
+ get description(): string | undefined;
10
+ get emojis(): import("../helpers/emoji.js").Emoji[];
11
+ }
@@ -0,0 +1,25 @@
1
+ import { getReplaceableIdentifier } from "applesauce-core/helpers/event";
2
+ import { getEmojiPackDescription, getEmojiPackEmojis, getEmojiPackName, isValidEmojiPack, } from "../helpers/emoji-pack.js";
3
+ import { EventCast } from "./cast.js";
4
+ export class EmojiPack extends EventCast {
5
+ constructor(event, store) {
6
+ if (!isValidEmojiPack(event))
7
+ throw new Error("Invalid emoji pack");
8
+ super(event, store);
9
+ }
10
+ get identifier() {
11
+ return getReplaceableIdentifier(this.event);
12
+ }
13
+ get name() {
14
+ return getEmojiPackName(this.event);
15
+ }
16
+ get title() {
17
+ return this.name;
18
+ }
19
+ get description() {
20
+ return getEmojiPackDescription(this.event);
21
+ }
22
+ get emojis() {
23
+ return getEmojiPackEmojis(this.event);
24
+ }
25
+ }