applesauce-common 6.2.0 → 7.1.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 (251) 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 +12 -0
  23. package/dist/casts/index.js +12 -0
  24. package/dist/casts/napplet-handlers.d.ts +39 -0
  25. package/dist/casts/napplet-handlers.js +91 -0
  26. package/dist/casts/napplet.d.ts +98 -0
  27. package/dist/casts/napplet.js +196 -0
  28. package/dist/casts/note.d.ts +8 -0
  29. package/dist/casts/note.js +21 -1
  30. package/dist/casts/nsite.d.ts +134 -0
  31. package/dist/casts/nsite.js +249 -0
  32. package/dist/casts/profile.d.ts +20 -0
  33. package/dist/casts/profile.js +30 -0
  34. package/dist/casts/reaction.d.ts +1 -1
  35. package/dist/casts/relay-discovery.d.ts +4 -0
  36. package/dist/casts/relay-discovery.js +9 -1
  37. package/dist/casts/report.d.ts +28 -15
  38. package/dist/casts/report.js +42 -19
  39. package/dist/casts/share.d.ts +1 -1
  40. package/dist/casts/torrent.d.ts +5 -0
  41. package/dist/casts/torrent.js +8 -1
  42. package/dist/casts/trusted-assertions.d.ts +2 -0
  43. package/dist/casts/trusted-assertions.js +19 -18
  44. package/dist/casts/user-status.d.ts +33 -0
  45. package/dist/casts/user-status.js +69 -0
  46. package/dist/casts/user.d.ts +7 -0
  47. package/dist/casts/user.js +20 -1
  48. package/dist/factories/app-handler.d.ts +31 -0
  49. package/dist/factories/app-handler.js +50 -0
  50. package/dist/factories/app-recommendation.d.ts +21 -0
  51. package/dist/factories/app-recommendation.js +28 -0
  52. package/dist/factories/chat-message.d.ts +37 -0
  53. package/dist/factories/chat-message.js +56 -0
  54. package/dist/factories/comment.d.ts +8 -7
  55. package/dist/factories/comment.js +2 -2
  56. package/dist/factories/external-identities.d.ts +17 -0
  57. package/dist/factories/external-identities.js +28 -0
  58. package/dist/factories/file-message.d.ts +24 -0
  59. package/dist/factories/file-message.js +37 -0
  60. package/dist/factories/forum-thread.d.ts +34 -0
  61. package/dist/factories/forum-thread.js +50 -0
  62. package/dist/factories/git-applied-status.d.ts +39 -0
  63. package/dist/factories/git-applied-status.js +53 -0
  64. package/dist/factories/git-closed-status.d.ts +18 -0
  65. package/dist/factories/git-closed-status.js +24 -0
  66. package/dist/factories/git-draft-status.d.ts +18 -0
  67. package/dist/factories/git-draft-status.js +24 -0
  68. package/dist/factories/git-issue.d.ts +19 -0
  69. package/dist/factories/git-issue.js +25 -0
  70. package/dist/factories/git-open-status.d.ts +18 -0
  71. package/dist/factories/git-open-status.js +22 -0
  72. package/dist/factories/git-patch.d.ts +59 -0
  73. package/dist/factories/git-patch.js +102 -0
  74. package/dist/factories/git-pull-request-update.d.ts +23 -0
  75. package/dist/factories/git-pull-request-update.js +33 -0
  76. package/dist/factories/git-pull-request.d.ts +39 -0
  77. package/dist/factories/git-pull-request.js +64 -0
  78. package/dist/factories/index.d.ts +24 -0
  79. package/dist/factories/index.js +24 -0
  80. package/dist/factories/internal/git-pull-request.d.ts +19 -0
  81. package/dist/factories/internal/git-pull-request.js +26 -0
  82. package/dist/factories/internal/git-status.d.ts +11 -0
  83. package/dist/factories/internal/git-status.js +12 -0
  84. package/dist/factories/internal/git-thread.d.ts +19 -0
  85. package/dist/factories/internal/git-thread.js +29 -0
  86. package/dist/factories/internal/napplet-manifest.d.ts +52 -0
  87. package/dist/factories/internal/napplet-manifest.js +85 -0
  88. package/dist/factories/internal/nsite-manifest.d.ts +45 -0
  89. package/dist/factories/internal/nsite-manifest.js +68 -0
  90. package/dist/factories/legacy-message.d.ts +2 -0
  91. package/dist/factories/legacy-message.js +9 -2
  92. package/dist/factories/named-napplet.d.ts +20 -0
  93. package/dist/factories/named-napplet.js +30 -0
  94. package/dist/factories/named-nsite.d.ts +28 -0
  95. package/dist/factories/named-nsite.js +53 -0
  96. package/dist/factories/napplet-handlers.d.ts +34 -0
  97. package/dist/factories/napplet-handlers.js +77 -0
  98. package/dist/factories/napplet-snapshot.d.ts +18 -0
  99. package/dist/factories/napplet-snapshot.js +38 -0
  100. package/dist/factories/nsite-snapshot.d.ts +18 -0
  101. package/dist/factories/nsite-snapshot.js +29 -0
  102. package/dist/factories/reaction.d.ts +3 -2
  103. package/dist/factories/report.d.ts +48 -0
  104. package/dist/factories/report.js +66 -0
  105. package/dist/factories/root-napplet.d.ts +18 -0
  106. package/dist/factories/root-napplet.js +24 -0
  107. package/dist/factories/root-nsite.d.ts +23 -0
  108. package/dist/factories/root-nsite.js +44 -0
  109. package/dist/factories/torrent.d.ts +24 -10
  110. package/dist/factories/torrent.js +48 -44
  111. package/dist/factories/trusted-provider-list.d.ts +23 -0
  112. package/dist/factories/trusted-provider-list.js +39 -0
  113. package/dist/factories/user-status.d.ts +26 -0
  114. package/dist/factories/user-status.js +52 -0
  115. package/dist/factories/wrapped-message.js +10 -4
  116. package/dist/helpers/app-data.js +15 -7
  117. package/dist/helpers/app-handler.d.ts +43 -6
  118. package/dist/helpers/app-handler.js +53 -3
  119. package/dist/helpers/app-recommendation.d.ts +24 -0
  120. package/dist/helpers/app-recommendation.js +30 -0
  121. package/dist/helpers/bookmark.js +5 -2
  122. package/dist/helpers/comment.d.ts +11 -5
  123. package/dist/helpers/comment.js +7 -1
  124. package/dist/helpers/content.d.ts +3 -1
  125. package/dist/helpers/emoji-pack.js +11 -6
  126. package/dist/helpers/emoji.d.ts +2 -2
  127. package/dist/helpers/encrypted-content-cache.d.ts +2 -11
  128. package/dist/helpers/encrypted-content-cache.js +6 -14
  129. package/dist/helpers/encrypted-file.d.ts +41 -0
  130. package/dist/helpers/encrypted-file.js +64 -0
  131. package/dist/helpers/external-id.js +13 -19
  132. package/dist/helpers/external-identities.d.ts +29 -0
  133. package/dist/helpers/external-identities.js +52 -0
  134. package/dist/helpers/file-message.d.ts +18 -0
  135. package/dist/helpers/file-message.js +44 -0
  136. package/dist/helpers/file-metadata.d.ts +9 -4
  137. package/dist/helpers/file-metadata.js +21 -6
  138. package/dist/helpers/forum-thread.d.ts +10 -0
  139. package/dist/helpers/forum-thread.js +10 -0
  140. package/dist/helpers/gift-wrap.d.ts +40 -15
  141. package/dist/helpers/gift-wrap.js +110 -33
  142. package/dist/helpers/git-issue.d.ts +13 -0
  143. package/dist/helpers/git-issue.js +19 -0
  144. package/dist/helpers/git-patch.d.ts +41 -0
  145. package/dist/helpers/git-patch.js +73 -0
  146. package/dist/helpers/git-pull-request.d.ts +57 -0
  147. package/dist/helpers/git-pull-request.js +111 -0
  148. package/dist/helpers/git-repository.d.ts +4 -0
  149. package/dist/helpers/git-repository.js +16 -0
  150. package/dist/helpers/git-status.d.ts +44 -0
  151. package/dist/helpers/git-status.js +93 -0
  152. package/dist/helpers/git.d.ts +2 -0
  153. package/dist/helpers/git.js +4 -0
  154. package/dist/helpers/groups.d.ts +5 -2
  155. package/dist/helpers/groups.js +40 -18
  156. package/dist/helpers/hashtag.d.ts +4 -2
  157. package/dist/helpers/index.d.ts +13 -0
  158. package/dist/helpers/index.js +13 -0
  159. package/dist/helpers/lists.js +14 -2
  160. package/dist/helpers/lnurl.js +1 -1
  161. package/dist/helpers/messages.js +3 -2
  162. package/dist/helpers/mute.js +20 -9
  163. package/dist/helpers/napplet-handlers.d.ts +79 -0
  164. package/dist/helpers/napplet-handlers.js +187 -0
  165. package/dist/helpers/napplet.d.ts +107 -0
  166. package/dist/helpers/napplet.js +177 -0
  167. package/dist/helpers/nsite.d.ts +90 -0
  168. package/dist/helpers/nsite.js +217 -0
  169. package/dist/helpers/relay-discovery.d.ts +4 -0
  170. package/dist/helpers/relay-discovery.js +8 -0
  171. package/dist/helpers/reports.d.ts +35 -0
  172. package/dist/helpers/reports.js +36 -5
  173. package/dist/helpers/threading.d.ts +4 -2
  174. package/dist/helpers/torrent.d.ts +9 -6
  175. package/dist/helpers/torrent.js +23 -15
  176. package/dist/helpers/trusted-assertions.d.ts +7 -0
  177. package/dist/helpers/trusted-assertions.js +41 -2
  178. package/dist/helpers/user-status.d.ts +13 -1
  179. package/dist/helpers/user-status.js +15 -0
  180. package/dist/helpers/wrapped-messages.d.ts +2 -0
  181. package/dist/helpers/wrapped-messages.js +6 -1
  182. package/dist/models/app-handler.d.ts +21 -0
  183. package/dist/models/app-handler.js +47 -0
  184. package/dist/models/git.d.ts +34 -0
  185. package/dist/models/git.js +144 -0
  186. package/dist/models/index.d.ts +4 -0
  187. package/dist/models/index.js +4 -0
  188. package/dist/models/legacy-messages.js +6 -1
  189. package/dist/models/napplet-handlers.d.ts +16 -0
  190. package/dist/models/napplet-handlers.js +45 -0
  191. package/dist/models/nsite.d.ts +22 -0
  192. package/dist/models/nsite.js +67 -0
  193. package/dist/models/thread.d.ts +4 -1
  194. package/dist/models/thread.js +34 -5
  195. package/dist/models/user-status.d.ts +8 -4
  196. package/dist/models/user-status.js +16 -22
  197. package/dist/models/wrapped-messages.js +9 -7
  198. package/dist/observable/filter-timeline-by-mutes.d.ts +1 -1
  199. package/dist/observable/filter-timeline-by-mutes.js +6 -2
  200. package/dist/operations/app-handler.d.ts +24 -0
  201. package/dist/operations/app-handler.js +58 -0
  202. package/dist/operations/app-recommendation.d.ts +13 -0
  203. package/dist/operations/app-recommendation.js +40 -0
  204. package/dist/operations/calendar-event.js +3 -2
  205. package/dist/operations/chat-message.d.ts +9 -0
  206. package/dist/operations/chat-message.js +12 -0
  207. package/dist/operations/client.d.ts +1 -4
  208. package/dist/operations/client.js +1 -23
  209. package/dist/operations/comment.d.ts +9 -3
  210. package/dist/operations/comment.js +12 -9
  211. package/dist/operations/external-identities.d.ts +8 -0
  212. package/dist/operations/external-identities.js +23 -0
  213. package/dist/operations/file-message.d.ts +7 -0
  214. package/dist/operations/file-message.js +34 -0
  215. package/dist/operations/forum-thread.d.ts +3 -0
  216. package/dist/operations/forum-thread.js +6 -0
  217. package/dist/operations/gift-wrap.js +38 -14
  218. package/dist/operations/git-issue.d.ts +18 -0
  219. package/dist/operations/git-issue.js +31 -0
  220. package/dist/operations/git-patch.d.ts +30 -0
  221. package/dist/operations/git-patch.js +75 -0
  222. package/dist/operations/git-pull-request.d.ts +29 -0
  223. package/dist/operations/git-pull-request.js +74 -0
  224. package/dist/operations/git-repository.js +4 -4
  225. package/dist/operations/git-status.d.ts +28 -0
  226. package/dist/operations/git-status.js +116 -0
  227. package/dist/operations/git-thread.d.ts +13 -0
  228. package/dist/operations/git-thread.js +39 -0
  229. package/dist/operations/index.d.ts +17 -0
  230. package/dist/operations/index.js +17 -0
  231. package/dist/operations/internal/git-commits.d.ts +2 -0
  232. package/dist/operations/internal/git-commits.js +16 -0
  233. package/dist/operations/napplet-handlers.d.ts +47 -0
  234. package/dist/operations/napplet-handlers.js +161 -0
  235. package/dist/operations/napplet.d.ts +51 -0
  236. package/dist/operations/napplet.js +121 -0
  237. package/dist/operations/nsite.d.ts +51 -0
  238. package/dist/operations/nsite.js +112 -0
  239. package/dist/operations/reaction.d.ts +12 -2
  240. package/dist/operations/reaction.js +1 -1
  241. package/dist/operations/report.d.ts +33 -0
  242. package/dist/operations/report.js +60 -0
  243. package/dist/operations/stream.js +5 -4
  244. package/dist/operations/torrent.d.ts +1 -4
  245. package/dist/operations/torrent.js +24 -11
  246. package/dist/operations/trusted-providers.d.ts +14 -0
  247. package/dist/operations/trusted-providers.js +33 -0
  248. package/dist/operations/user-status.d.ts +11 -0
  249. package/dist/operations/user-status.js +29 -0
  250. package/dist/operations/wrapped-message.js +2 -2
  251. package/package.json +13 -17
@@ -26,10 +26,7 @@ export declare function setTorrentCategoryPath(categoryPath: string): EventOpera
26
26
  export declare function removeTorrentCategoryPath(): EventOperation;
27
27
  /** Adds an external identifier */
28
28
  export declare function addTorrentExternalIdentifier(identifier: TorrentExternalIdentifier): EventOperation;
29
- /**
30
- * Adds an external identifier using prefix, id, and optional mediaType
31
- * Convenience function that creates the identifier object automatically
32
- */
29
+ /** Adds an external identifier built from a prefix, id, and optional media type */
33
30
  export declare function addTorrentExternalIdentifierByParts(prefix: TorrentExternalIdentifierPrefix, id: string, mediaType?: string): EventOperation;
34
31
  /** Removes an external identifier */
35
32
  export declare function removeTorrentExternalIdentifier(identifier: string): EventOperation;
@@ -11,9 +11,7 @@ export function setTorrentTitle(title) {
11
11
  }
12
12
  /** Adds a file entry to the torrent */
13
13
  export function addTorrentFile(file) {
14
- const tag = file.size
15
- ? ["file", file.name, file.size.toString()]
16
- : ["file", file.name];
14
+ const tag = file.size !== undefined ? ["file", file.name, file.size.toString()] : ["file", file.name];
17
15
  return modifyPublicTags(addNameValueTag(tag, false));
18
16
  }
19
17
  /** Removes a file entry from the torrent */
@@ -28,13 +26,31 @@ export function addTorrentTracker(tracker) {
28
26
  export function removeTorrentTracker(tracker) {
29
27
  return modifyPublicTags(removeNameValueTag(["tracker", tracker]));
30
28
  }
29
+ // Replaces the first `i` tag with the given prefix and removes the rest, leaving other `i` tags untouched
30
+ function setPrefixedIdentifierTag(prefix, value) {
31
+ return (tags) => {
32
+ const tag = ["i", `${prefix}:${value}`];
33
+ const index = tags.findIndex((t) => t[0] === "i" && t[1]?.startsWith(`${prefix}:`));
34
+ if (index === -1)
35
+ return [...tags, tag];
36
+ return tags.flatMap((t, i) => {
37
+ if (i === index)
38
+ return [tag];
39
+ return t[0] === "i" && t[1]?.startsWith(`${prefix}:`) ? [] : [t];
40
+ });
41
+ };
42
+ }
43
+ // Removes every `i` tag with the given prefix
44
+ function removePrefixedIdentifierTags(prefix) {
45
+ return (tags) => tags.filter((t) => !(t[0] === "i" && t[1]?.startsWith(`${prefix}:`)));
46
+ }
31
47
  /** Sets the newznab category ID (replaces any existing newznab category) */
32
48
  export function setTorrentCategory(categoryId) {
33
- return modifyPublicTags(setSingletonTag(["i", `newznab:${categoryId}`]));
49
+ return modifyPublicTags(setPrefixedIdentifierTag("newznab", String(categoryId)));
34
50
  }
35
51
  /** Removes the newznab category ID */
36
52
  export function removeTorrentCategory() {
37
- return modifyPublicTags((tags) => tags.filter((t) => !(t[0] === "i" && t[1]?.startsWith("newznab:"))));
53
+ return modifyPublicTags(removePrefixedIdentifierTags("newznab"));
38
54
  }
39
55
  /** Adds a search tag (for searchability) */
40
56
  export function addTorrentSearchTag(tag) {
@@ -46,20 +62,17 @@ export function removeTorrentSearchTag(tag) {
46
62
  }
47
63
  /** Sets the category path (tcat) */
48
64
  export function setTorrentCategoryPath(categoryPath) {
49
- return modifyPublicTags(setSingletonTag(["i", `tcat:${categoryPath}`]));
65
+ return modifyPublicTags(setPrefixedIdentifierTag("tcat", categoryPath));
50
66
  }
51
67
  /** Removes the category path (tcat) */
52
68
  export function removeTorrentCategoryPath() {
53
- return modifyPublicTags((tags) => tags.filter((t) => !(t[0] === "i" && t[1]?.startsWith("tcat:"))));
69
+ return modifyPublicTags(removePrefixedIdentifierTags("tcat"));
54
70
  }
55
71
  /** Adds an external identifier */
56
72
  export function addTorrentExternalIdentifier(identifier) {
57
73
  return modifyPublicTags(addNameValueTag(["i", identifier.identifier], false));
58
74
  }
59
- /**
60
- * Adds an external identifier using prefix, id, and optional mediaType
61
- * Convenience function that creates the identifier object automatically
62
- */
75
+ /** Adds an external identifier built from a prefix, id, and optional media type */
63
76
  export function addTorrentExternalIdentifierByParts(prefix, id, mediaType) {
64
77
  const identifier = createTorrentExternalIdentifier(prefix, id, mediaType);
65
78
  return addTorrentExternalIdentifier(identifier);
@@ -0,0 +1,14 @@
1
+ import { TagOperation } from "applesauce-core/factories";
2
+ import { TrustedProvider } from "../helpers/trusted-assertions.js";
3
+ /** A provider slot, optionally narrowed to a single service pubkey */
4
+ export type TrustedProviderSelector = Pick<TrustedProvider, "kind" | "tag"> & {
5
+ servicePubkey?: string;
6
+ };
7
+ /** Adds a provider to a kind 10040 tag list, or updates the relay hint of an existing entry */
8
+ export declare function addProviderTag(provider: TrustedProvider): TagOperation;
9
+ /** Removes a provider from a kind 10040 tag list, or every provider in the slot if no pubkey is given */
10
+ export declare function removeProviderTag(selector: TrustedProviderSelector): TagOperation;
11
+ /** Replaces every provider in the `kind:tag` slot with a single provider */
12
+ export declare function setProviderTag(provider: TrustedProvider): TagOperation;
13
+ /** Removes a service pubkey from every slot in a kind 10040 tag list */
14
+ export declare function removeServiceTags(servicePubkey: string): TagOperation;
@@ -0,0 +1,33 @@
1
+ import { createProviderTag, parseProviderTag } from "../helpers/trusted-assertions.js";
2
+ /** Checks if a tag matches a provider selector */
3
+ function matchesProvider(tag, selector) {
4
+ const parsed = parseProviderTag(tag);
5
+ if (!parsed || parsed.kind !== selector.kind || parsed.tag !== selector.tag)
6
+ return false;
7
+ return selector.servicePubkey === undefined || parsed.servicePubkey === selector.servicePubkey;
8
+ }
9
+ /** Adds a provider to a kind 10040 tag list, or updates the relay hint of an existing entry */
10
+ export function addProviderTag(provider) {
11
+ return (tags) => {
12
+ const tag = createProviderTag(provider);
13
+ const index = tags.findIndex((t) => matchesProvider(t, provider));
14
+ if (index === -1)
15
+ return [...tags, tag];
16
+ return tags.map((t, i) => (i === index ? tag : t));
17
+ };
18
+ }
19
+ /** Removes a provider from a kind 10040 tag list, or every provider in the slot if no pubkey is given */
20
+ export function removeProviderTag(selector) {
21
+ return (tags) => tags.filter((t) => !matchesProvider(t, selector));
22
+ }
23
+ /** Replaces every provider in the `kind:tag` slot with a single provider */
24
+ export function setProviderTag(provider) {
25
+ return (tags) => [
26
+ ...tags.filter((t) => !matchesProvider(t, { kind: provider.kind, tag: provider.tag })),
27
+ createProviderTag(provider),
28
+ ];
29
+ }
30
+ /** Removes a service pubkey from every slot in a kind 10040 tag list */
31
+ export function removeServiceTags(servicePubkey) {
32
+ return (tags) => tags.filter((t) => parseProviderTag(t)?.servicePubkey !== servicePubkey);
33
+ }
@@ -0,0 +1,11 @@
1
+ import { EventOperation } from "applesauce-core/factories";
2
+ import { UserStatusPointer, UserStatusType } from "../helpers/user-status.js";
3
+ /** Sets the status type ("d" tag) of a user status */
4
+ export declare function setStatusType(type: UserStatusType): EventOperation;
5
+ /**
6
+ * Sets the single URL, profile, event, or address the status links to
7
+ * @param link a URL string or a {@link UserStatusPointer}
8
+ */
9
+ export declare function setStatusLink(link: string | UserStatusPointer): EventOperation;
10
+ /** Removes any "r", "p", "e", or "a" link tags from the status */
11
+ export declare function clearStatusLink(): EventOperation;
@@ -0,0 +1,29 @@
1
+ import { addAddressPointerTag, addEventPointerTag, addProfilePointerTag, setSingletonTag, } from "applesauce-core/operations/tag/common";
2
+ import { modifyPublicTags } from "applesauce-core/operations/tags";
3
+ const LINK_TAGS = ["r", "p", "e", "a"];
4
+ const removeLinkTags = (tags) => tags.filter((t) => !LINK_TAGS.includes(t[0]));
5
+ /** Sets the status type ("d" tag) of a user status */
6
+ export function setStatusType(type) {
7
+ return modifyPublicTags(setSingletonTag(["d", type], true));
8
+ }
9
+ /**
10
+ * Sets the single URL, profile, event, or address the status links to
11
+ * @param link a URL string or a {@link UserStatusPointer}
12
+ */
13
+ export function setStatusLink(link) {
14
+ const pointer = typeof link === "string" ? { type: "url", data: link } : link;
15
+ switch (pointer.type) {
16
+ case "url":
17
+ return modifyPublicTags(removeLinkTags, (tags) => [...tags, ["r", pointer.data]]);
18
+ case "nprofile":
19
+ return modifyPublicTags(removeLinkTags, addProfilePointerTag(pointer.data));
20
+ case "nevent":
21
+ return modifyPublicTags(removeLinkTags, addEventPointerTag(pointer.data));
22
+ case "naddr":
23
+ return modifyPublicTags(removeLinkTags, addAddressPointerTag(pointer.data));
24
+ }
25
+ }
26
+ /** Removes any "r", "p", "e", or "a" link tags from the status */
27
+ export function clearStatusLink() {
28
+ return modifyPublicTags(removeLinkTags);
29
+ }
@@ -20,8 +20,8 @@ export function setSubject(subject) {
20
20
  }
21
21
  /** Makes the wrapped message a reply to the parent message */
22
22
  export function setParent(parent) {
23
- if (typeof parent !== "string" && parent.kind !== kinds.PrivateDirectMessage)
24
- throw new Error("Parent must be a private direct message event");
23
+ if (typeof parent !== "string" && parent.kind !== kinds.PrivateDirectMessage && parent.kind !== kinds.FileMessage)
24
+ throw new Error("Parent must be a private direct message or file message");
25
25
  const id = typeof parent === "string" ? parent : parent.id;
26
26
  // TODO: support relay hints
27
27
  return includeNameValueTag(["e", id]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-common",
3
- "version": "6.2.0",
3
+ "version": "7.1.0",
4
4
  "description": "Common NIP-specific helpers and models for applesauce",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -82,26 +82,22 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@scure/base": "^2.2.0",
86
- "applesauce-core": "^6.2.0",
85
+ "@noble/hashes": "^2.4.0",
86
+ "@scure/base": "^2.4.0",
87
+ "applesauce-core": "^7.1.0",
87
88
  "hash-sum": "^2.0.0",
88
89
  "light-bolt11-decoder": "^3.2.0",
89
- "nanoid": "^5.0.9",
90
- "rxjs": "^7.8.1"
90
+ "nanoid": "^6.0.2",
91
+ "rxjs": "^7.8.2"
91
92
  },
92
93
  "devDependencies": {
93
94
  "@hirez_io/observer-spy": "^2.2.0",
94
- "@nostrability/schemata": "^0.3.2",
95
- "@types/debug": "^4.1.12",
96
95
  "@types/hash-sum": "^1.0.2",
97
- "@types/node": "^22.19.1",
98
- "ajv": "^8.20.0",
99
- "ajv-formats": "^3.0.1",
100
- "nostr-tools": "^2.19",
101
- "rimraf": "^6.0.1",
102
- "typescript": "^5.8.3",
103
- "vitest": "^4.0.15",
104
- "yaml": "^2.9.0"
96
+ "@types/node": "^26.6.6",
97
+ "nostr-tools": "^2.26.0",
98
+ "rimraf": "^6.1.4",
99
+ "typescript": "^7.0.2",
100
+ "vitest": "^5.1.0"
105
101
  },
106
102
  "funding": {
107
103
  "type": "lightning",
@@ -111,7 +107,7 @@
111
107
  "prebuild": "rimraf dist",
112
108
  "build": "tsc",
113
109
  "watch:build": "tsc --watch > /dev/null",
114
- "test": "vitest run --passWithNoTests",
115
- "watch:test": "vitest"
110
+ "test": "vitest run --config ../../vitest.config.mts --dir . --passWithNoTests",
111
+ "watch:test": "vitest --config ../../vitest.config.mts --dir ."
116
112
  }
117
113
  }