applesauce-common 6.2.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 (224) 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 +2 -0
  41. package/dist/casts/trusted-assertions.js +19 -18
  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 +22 -0
  75. package/dist/factories/index.js +22 -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/nsite-snapshot.d.ts +18 -0
  95. package/dist/factories/nsite-snapshot.js +29 -0
  96. package/dist/factories/reaction.d.ts +3 -2
  97. package/dist/factories/report.d.ts +48 -0
  98. package/dist/factories/report.js +66 -0
  99. package/dist/factories/root-napplet.d.ts +18 -0
  100. package/dist/factories/root-napplet.js +24 -0
  101. package/dist/factories/root-nsite.d.ts +23 -0
  102. package/dist/factories/root-nsite.js +44 -0
  103. package/dist/factories/torrent.d.ts +24 -10
  104. package/dist/factories/torrent.js +48 -44
  105. package/dist/factories/trusted-provider-list.d.ts +23 -0
  106. package/dist/factories/trusted-provider-list.js +39 -0
  107. package/dist/factories/user-status.d.ts +26 -0
  108. package/dist/factories/user-status.js +52 -0
  109. package/dist/helpers/app-data.js +15 -7
  110. package/dist/helpers/app-handler.d.ts +43 -6
  111. package/dist/helpers/app-handler.js +53 -3
  112. package/dist/helpers/app-recommendation.d.ts +24 -0
  113. package/dist/helpers/app-recommendation.js +30 -0
  114. package/dist/helpers/bookmark.js +5 -2
  115. package/dist/helpers/comment.d.ts +11 -5
  116. package/dist/helpers/comment.js +7 -1
  117. package/dist/helpers/content.d.ts +3 -1
  118. package/dist/helpers/emoji-pack.js +11 -6
  119. package/dist/helpers/emoji.d.ts +2 -2
  120. package/dist/helpers/encrypted-content-cache.js +18 -1
  121. package/dist/helpers/external-id.js +13 -19
  122. package/dist/helpers/external-identities.d.ts +29 -0
  123. package/dist/helpers/external-identities.js +52 -0
  124. package/dist/helpers/file-metadata.js +5 -6
  125. package/dist/helpers/forum-thread.d.ts +10 -0
  126. package/dist/helpers/forum-thread.js +10 -0
  127. package/dist/helpers/gift-wrap.d.ts +40 -15
  128. package/dist/helpers/gift-wrap.js +110 -33
  129. package/dist/helpers/git-issue.d.ts +13 -0
  130. package/dist/helpers/git-issue.js +19 -0
  131. package/dist/helpers/git-patch.d.ts +41 -0
  132. package/dist/helpers/git-patch.js +73 -0
  133. package/dist/helpers/git-pull-request.d.ts +57 -0
  134. package/dist/helpers/git-pull-request.js +111 -0
  135. package/dist/helpers/git-repository.d.ts +4 -0
  136. package/dist/helpers/git-repository.js +16 -0
  137. package/dist/helpers/git-status.d.ts +44 -0
  138. package/dist/helpers/git-status.js +93 -0
  139. package/dist/helpers/git.d.ts +2 -0
  140. package/dist/helpers/git.js +4 -0
  141. package/dist/helpers/groups.d.ts +5 -2
  142. package/dist/helpers/groups.js +40 -18
  143. package/dist/helpers/hashtag.d.ts +4 -2
  144. package/dist/helpers/index.d.ts +10 -0
  145. package/dist/helpers/index.js +10 -0
  146. package/dist/helpers/lists.js +14 -2
  147. package/dist/helpers/lnurl.js +1 -1
  148. package/dist/helpers/mute.js +18 -7
  149. package/dist/helpers/napplet.d.ts +89 -0
  150. package/dist/helpers/napplet.js +144 -0
  151. package/dist/helpers/nsite.d.ts +90 -0
  152. package/dist/helpers/nsite.js +217 -0
  153. package/dist/helpers/relay-discovery.d.ts +4 -0
  154. package/dist/helpers/relay-discovery.js +8 -0
  155. package/dist/helpers/reports.d.ts +35 -0
  156. package/dist/helpers/reports.js +36 -5
  157. package/dist/helpers/threading.d.ts +4 -2
  158. package/dist/helpers/torrent.d.ts +9 -6
  159. package/dist/helpers/torrent.js +23 -15
  160. package/dist/helpers/trusted-assertions.d.ts +7 -0
  161. package/dist/helpers/trusted-assertions.js +41 -2
  162. package/dist/helpers/user-status.d.ts +13 -1
  163. package/dist/helpers/user-status.js +15 -0
  164. package/dist/models/app-handler.d.ts +21 -0
  165. package/dist/models/app-handler.js +47 -0
  166. package/dist/models/git.d.ts +34 -0
  167. package/dist/models/git.js +144 -0
  168. package/dist/models/index.d.ts +3 -0
  169. package/dist/models/index.js +3 -0
  170. package/dist/models/nsite.d.ts +22 -0
  171. package/dist/models/nsite.js +67 -0
  172. package/dist/models/thread.d.ts +4 -1
  173. package/dist/models/thread.js +34 -5
  174. package/dist/models/user-status.d.ts +8 -4
  175. package/dist/models/user-status.js +16 -22
  176. package/dist/observable/filter-timeline-by-mutes.d.ts +1 -1
  177. package/dist/observable/filter-timeline-by-mutes.js +5 -1
  178. package/dist/operations/app-handler.d.ts +24 -0
  179. package/dist/operations/app-handler.js +58 -0
  180. package/dist/operations/app-recommendation.d.ts +13 -0
  181. package/dist/operations/app-recommendation.js +40 -0
  182. package/dist/operations/calendar-event.js +3 -2
  183. package/dist/operations/chat-message.d.ts +9 -0
  184. package/dist/operations/chat-message.js +12 -0
  185. package/dist/operations/client.d.ts +1 -4
  186. package/dist/operations/client.js +1 -23
  187. package/dist/operations/comment.d.ts +9 -3
  188. package/dist/operations/comment.js +12 -9
  189. package/dist/operations/external-identities.d.ts +8 -0
  190. package/dist/operations/external-identities.js +23 -0
  191. package/dist/operations/forum-thread.d.ts +3 -0
  192. package/dist/operations/forum-thread.js +6 -0
  193. package/dist/operations/gift-wrap.js +38 -14
  194. package/dist/operations/git-issue.d.ts +18 -0
  195. package/dist/operations/git-issue.js +31 -0
  196. package/dist/operations/git-patch.d.ts +30 -0
  197. package/dist/operations/git-patch.js +75 -0
  198. package/dist/operations/git-pull-request.d.ts +29 -0
  199. package/dist/operations/git-pull-request.js +74 -0
  200. package/dist/operations/git-repository.js +4 -4
  201. package/dist/operations/git-status.d.ts +28 -0
  202. package/dist/operations/git-status.js +116 -0
  203. package/dist/operations/git-thread.d.ts +13 -0
  204. package/dist/operations/git-thread.js +39 -0
  205. package/dist/operations/index.d.ts +15 -0
  206. package/dist/operations/index.js +15 -0
  207. package/dist/operations/internal/git-commits.d.ts +2 -0
  208. package/dist/operations/internal/git-commits.js +16 -0
  209. package/dist/operations/napplet.d.ts +51 -0
  210. package/dist/operations/napplet.js +121 -0
  211. package/dist/operations/nsite.d.ts +51 -0
  212. package/dist/operations/nsite.js +112 -0
  213. package/dist/operations/reaction.d.ts +12 -2
  214. package/dist/operations/reaction.js +1 -1
  215. package/dist/operations/report.d.ts +33 -0
  216. package/dist/operations/report.js +60 -0
  217. package/dist/operations/stream.js +5 -4
  218. package/dist/operations/torrent.d.ts +1 -4
  219. package/dist/operations/torrent.js +24 -11
  220. package/dist/operations/trusted-providers.d.ts +14 -0
  221. package/dist/operations/trusted-providers.js +33 -0
  222. package/dist/operations/user-status.d.ts +11 -0
  223. package/dist/operations/user-status.js +29 -0
  224. package/package.json +9 -9
@@ -0,0 +1,74 @@
1
+ import { isHexKey } from "applesauce-core/helpers/string";
2
+ import { modifyPublicTags } from "applesauce-core/operations/tags";
3
+ import { removeSingletonTag, setSingletonTag } from "applesauce-core/operations/tag/common";
4
+ import { isGitCommitId } from "../helpers/git.js";
5
+ import { isGitPatchRoot, isValidGitPatch } from "../helpers/git-patch.js";
6
+ import { isValidGitPullRequest } from "../helpers/git-pull-request.js";
7
+ import { getGitRepositoryReference } from "../helpers/git-repository.js";
8
+ import { setGitThreadRepository } from "./git-thread.js";
9
+ /**
10
+ * Sets the branch tip commit of a pull request or update
11
+ * @throws if the commit is not a Git object id
12
+ */
13
+ export function setGitPullRequestTipCommit(commit) {
14
+ if (!isGitCommitId(commit))
15
+ throw new Error("Invalid Git commit id");
16
+ return modifyPublicTags(setSingletonTag(["c", commit]));
17
+ }
18
+ /**
19
+ * Replaces the clone URLs of a pull request or update
20
+ * @throws if there are no nonempty clone URLs
21
+ */
22
+ export function setGitPullRequestCloneUrls(urls) {
23
+ if (!urls.length || urls.some((url) => !url.trim()))
24
+ throw new Error("Expected at least one clone URL");
25
+ return modifyPublicTags((tags) => [...tags.filter((t) => t[0] !== "clone"), ["clone", ...new Set(urls)]]);
26
+ }
27
+ /** Sets or removes the recommended branch name */
28
+ export function setGitPullRequestBranchName(name) {
29
+ return modifyPublicTags(name === null ? removeSingletonTag("branch-name") : setSingletonTag(["branch-name", name]));
30
+ }
31
+ /**
32
+ * Sets or removes the common ancestor with the target branch
33
+ * @throws if the commit is not a Git object id
34
+ */
35
+ export function setGitPullRequestMergeBase(commit) {
36
+ if (commit !== null && !isGitCommitId(commit))
37
+ throw new Error("Invalid Git commit id");
38
+ return modifyPublicTags(commit === null ? removeSingletonTag("merge-base") : setSingletonTag(["merge-base", commit]));
39
+ }
40
+ /**
41
+ * Sets or removes the original patch revised by a pull request
42
+ * @throws if the target is not a root patch or its id is invalid
43
+ */
44
+ export function setGitPullRequestPatch(patch) {
45
+ if (patch !== null && typeof patch !== "string" && (!isValidGitPatch(patch) || !isGitPatchRoot(patch)))
46
+ throw new Error("Expected a root patch");
47
+ const id = typeof patch === "string" ? patch : patch?.id;
48
+ if (id !== undefined && !isHexKey(id))
49
+ throw new Error("Invalid patch id");
50
+ return modifyPublicTags(id === undefined ? removeSingletonTag("e") : setSingletonTag(["e", id]));
51
+ }
52
+ /**
53
+ * Sets the pull request targeted by an update and copies its repository tags
54
+ * @throws if the target is not a valid pull request
55
+ */
56
+ export function setGitPullRequestUpdateTarget(pr, relay = "") {
57
+ if (!isValidGitPullRequest(pr) || !isHexKey(pr.id) || !isHexKey(pr.pubkey))
58
+ throw new Error("Expected a valid pull request");
59
+ const repo = getGitRepositoryReference(pr);
60
+ const repository = setGitThreadRepository(repo);
61
+ return async (draft) => {
62
+ const next = await repository(draft);
63
+ return modifyPublicTags((tags) => {
64
+ const oldAuthor = tags.find((t) => t[0] === "P")?.[1];
65
+ const result = tags.filter((t) => t[0] !== "E" && t[0] !== "P" && t[0] !== "r" && !(t[0] === "p" && t[1] === oldAuthor && t[1] !== repo.pubkey));
66
+ const euc = pr.tags.find((t) => t[0] === "r")?.[1];
67
+ if (euc)
68
+ result.push(["r", euc]);
69
+ if (!result.some((t) => t[0] === "p" && t[1] === pr.pubkey))
70
+ result.push(["p", pr.pubkey]);
71
+ return [...result, ["E", pr.id, relay], ["P", pr.pubkey]];
72
+ })(next);
73
+ };
74
+ }
@@ -1,6 +1,6 @@
1
1
  import { getReplaceableAddressFromPointer } from "applesauce-core/helpers/pointers";
2
2
  import { isSafeRelayURL } from "applesauce-core/helpers/relays";
3
- import { normalizeURL } from "applesauce-core/helpers/url";
3
+ import { normalizeURL, serializeURL } from "applesauce-core/helpers/url";
4
4
  import { includeSingletonTag, modifyPublicTags } from "applesauce-core/operations/tags";
5
5
  import { removeSingletonTag, setSingletonTag } from "applesauce-core/operations/tag/common";
6
6
  import { GIT_REPOSITORY_KIND } from "../helpers/git-repository.js";
@@ -46,7 +46,7 @@ export function setGitRepositoryCloneUrls(urls) {
46
46
  /** Sets the repository relay URLs (single `relays` tag, normalized). */
47
47
  export function setGitRepositoryRelays(relays) {
48
48
  return modifyPublicTags((tags) => {
49
- const normalized = relays.map((relay) => new URL(relay).toString());
49
+ const normalized = relays.map((relay) => serializeURL(relay));
50
50
  return withFlatListTag(tags, "relays", normalized);
51
51
  });
52
52
  }
@@ -84,7 +84,7 @@ export function removeGitRepositoryCloneUrl(url) {
84
84
  }
85
85
  /** Adds a repository relay URL. */
86
86
  export function addGitRepositoryRelay(relay) {
87
- const normalized = new URL(relay).toString();
87
+ const normalized = serializeURL(relay);
88
88
  return modifyPublicTags((tags) => {
89
89
  const cur = collectFlatTagValues(tags, "relays");
90
90
  if (cur.includes(normalized))
@@ -94,7 +94,7 @@ export function addGitRepositoryRelay(relay) {
94
94
  }
95
95
  /** Removes a repository relay URL. */
96
96
  export function removeGitRepositoryRelay(relay) {
97
- const normalized = new URL(relay).toString();
97
+ const normalized = serializeURL(relay);
98
98
  return modifyPublicTags((tags) => {
99
99
  const cur = collectFlatTagValues(tags, "relays").filter((r) => r !== normalized);
100
100
  return withFlatListTag(tags, "relays", cur);
@@ -0,0 +1,28 @@
1
+ import { EventOperation } from "applesauce-core/factories";
2
+ import { NostrEvent } from "applesauce-core/helpers/event";
3
+ import { EventPointer } from "applesauce-core/helpers/pointers";
4
+ /**
5
+ * Sets the original root and removes tags belonging to a replaced target
6
+ * @throws if the target is not an issue, pull request or original root patch
7
+ */
8
+ export declare function setGitStatusRoot(root: NostrEvent, relay?: string): EventOperation;
9
+ /**
10
+ * Replaces the applied patch references, retaining relay and author hints
11
+ * @throws if a patch id is invalid
12
+ */
13
+ export declare function setGitStatusAppliedPatches(patches: (string | EventPointer)[]): EventOperation;
14
+ /**
15
+ * Sets or removes the accepted revision root and tags its author
16
+ * @throws if the event is not a revision root patch
17
+ */
18
+ export declare function setGitStatusAcceptedRevision(revision: NostrEvent | null, relay?: string): EventOperation;
19
+ /**
20
+ * Sets or removes the merge commit and its discovery tag
21
+ * @throws if the commit is not a Git object id
22
+ */
23
+ export declare function setGitStatusMergeCommit(commit: string | null): EventOperation;
24
+ /**
25
+ * Replaces the applied commit ids and their discovery tags
26
+ * @throws if a commit is not a Git object id
27
+ */
28
+ export declare function setGitStatusAppliedCommits(commits: string[]): EventOperation;
@@ -0,0 +1,116 @@
1
+ import { isHexKey } from "applesauce-core/helpers/string";
2
+ import { modifyPublicTags } from "applesauce-core/operations/tags";
3
+ import { isValidGitIssue } from "../helpers/git-issue.js";
4
+ import { isGitPatchRoot, isGitPatchRootRevision, isValidGitPatch } from "../helpers/git-patch.js";
5
+ import { isValidGitPullRequest } from "../helpers/git-pull-request.js";
6
+ import { getGitRepositoryReference } from "../helpers/git-repository.js";
7
+ import { isGitCommitId } from "../helpers/git.js";
8
+ import { createGitRepositoryTags } from "./git-thread.js";
9
+ import { replaceGitCommitReferences } from "./internal/git-commits.js";
10
+ /**
11
+ * Sets the original root and removes tags belonging to a replaced target
12
+ * @throws if the target is not an issue, pull request or original root patch
13
+ */
14
+ export function setGitStatusRoot(root, relay = "") {
15
+ if (!(isValidGitIssue(root) ||
16
+ isValidGitPullRequest(root) ||
17
+ (isValidGitPatch(root) && isGitPatchRoot(root) && !isGitPatchRootRevision(root))) ||
18
+ !isHexKey(root.id) ||
19
+ !isHexKey(root.pubkey))
20
+ throw new Error("Expected an issue, pull request or original root patch");
21
+ return modifyPublicTags((tags) => {
22
+ const oldRoot = tags.find((t) => t[0] === "e" && t[3] === "root");
23
+ const changed = !!oldRoot && oldRoot[1] !== root.id;
24
+ const oldOwner = getGitRepositoryReference({ tags })?.pubkey;
25
+ const oldAuthor = oldRoot?.[4];
26
+ const oldRevisionAuthor = tags.find((t) => t[0] === "e" && t[3] === "reply")?.[4];
27
+ const scoped = ["q", "merge-commit", "applied-as-commits"];
28
+ const next = tags.filter((t) => t[0] !== "a" &&
29
+ t[0] !== "r" &&
30
+ !(t[0] === "e" && (t[3] === "root" || (changed && t[3] === "reply"))) &&
31
+ !(changed &&
32
+ (scoped.includes(t[0]) || (t[0] === "p" && [oldOwner, oldAuthor, oldRevisionAuthor].includes(t[1])))));
33
+ // The fifth field preserves the generated author when the target is replaced later.
34
+ next.push(["e", root.id, relay, "root", root.pubkey]);
35
+ const repo = getGitRepositoryReference(root);
36
+ for (const tag of createGitRepositoryTags(repo))
37
+ if (tag[0] !== "p")
38
+ next.push(tag);
39
+ const patchCommit = root.tags.find((t) => t[0] === "commit")?.[1];
40
+ const euc = root.tags.find((t) => t[0] === "r" &&
41
+ (t[1] !== patchCommit || root.tags.filter((r) => r[0] === "r" && r[1] === patchCommit).length > 1))?.[1];
42
+ if (euc)
43
+ next.push(["r", euc]);
44
+ for (const pubkey of new Set([root.pubkey, repo.pubkey]))
45
+ if (!next.some((t) => t[0] === "p" && t[1] === pubkey))
46
+ next.push(["p", pubkey]);
47
+ for (const commit of next.filter((t) => scoped.slice(1).includes(t[0])).flatMap((t) => t.slice(1)))
48
+ next.push(["r", commit]);
49
+ return next;
50
+ });
51
+ }
52
+ /**
53
+ * Replaces the applied patch references, retaining relay and author hints
54
+ * @throws if a patch id is invalid
55
+ */
56
+ export function setGitStatusAppliedPatches(patches) {
57
+ if (patches.some((patch) => !isHexKey(typeof patch === "string" ? patch : patch.id)))
58
+ throw new Error("Invalid patch id");
59
+ return modifyPublicTags((tags) => [
60
+ ...tags.filter((t) => t[0] !== "q"),
61
+ ...patches.map((patch) => typeof patch === "string"
62
+ ? ["q", patch]
63
+ : ["q", patch.id, patch.relays?.[0] || "", ...(patch.author ? [patch.author] : [])]),
64
+ ]);
65
+ }
66
+ /**
67
+ * Sets or removes the accepted revision root and tags its author
68
+ * @throws if the event is not a revision root patch
69
+ */
70
+ export function setGitStatusAcceptedRevision(revision, relay = "") {
71
+ if (revision &&
72
+ (!isValidGitPatch(revision) ||
73
+ !isGitPatchRootRevision(revision) ||
74
+ !isHexKey(revision.id) ||
75
+ !isHexKey(revision.pubkey)))
76
+ throw new Error("Expected a revision root patch");
77
+ return modifyPublicTags((tags) => {
78
+ const root = tags.find((t) => t[0] === "e" && t[3] === "root");
79
+ const previous = revision?.tags.find((t) => t[0] === "e" && t[3] === "reply")?.[1];
80
+ if (revision && (!root || previous !== root[1]))
81
+ throw new Error("Revision must reference the status root");
82
+ const oldAuthor = tags.find((t) => t[0] === "e" && t[3] === "reply")?.[4];
83
+ const repository = getGitRepositoryReference({ tags });
84
+ const revisionRepository = revision && getGitRepositoryReference(revision);
85
+ if (revision &&
86
+ (repository?.pubkey !== revisionRepository?.pubkey || repository?.identifier !== revisionRepository?.identifier))
87
+ throw new Error("Revision must belong to the status repository");
88
+ const owner = repository?.pubkey;
89
+ const next = tags.filter((t) => !(t[0] === "e" && t[3] === "reply") &&
90
+ !(t[0] === "p" && t[1] === oldAuthor && t[1] !== root?.[4] && t[1] !== owner));
91
+ if (revision) {
92
+ next.push(["e", revision.id, relay, "reply", revision.pubkey]);
93
+ if (!next.some((t) => t[0] === "p" && t[1] === revision.pubkey))
94
+ next.push(["p", revision.pubkey]);
95
+ }
96
+ return next;
97
+ });
98
+ }
99
+ /**
100
+ * Sets or removes the merge commit and its discovery tag
101
+ * @throws if the commit is not a Git object id
102
+ */
103
+ export function setGitStatusMergeCommit(commit) {
104
+ if (commit !== null && !isGitCommitId(commit))
105
+ throw new Error("Invalid Git commit id");
106
+ return modifyPublicTags((tags) => replaceGitCommitReferences(tags, "merge-commit", commit ? [commit] : []));
107
+ }
108
+ /**
109
+ * Replaces the applied commit ids and their discovery tags
110
+ * @throws if a commit is not a Git object id
111
+ */
112
+ export function setGitStatusAppliedCommits(commits) {
113
+ if (commits.some((commit) => !isGitCommitId(commit)))
114
+ throw new Error("Invalid Git commit id");
115
+ return modifyPublicTags((tags) => replaceGitCommitReferences(tags, "applied-as-commits", commits));
116
+ }
@@ -0,0 +1,13 @@
1
+ import { EventOperation } from "applesauce-core/factories";
2
+ import { NostrEvent } from "applesauce-core/helpers/event";
3
+ import { GitRepositoryPointer } from "../helpers/git-repository.js";
4
+ /**
5
+ * Returns the tags linking a thread to a repository
6
+ * @throws if the event or pointer is not a valid repository
7
+ */
8
+ export declare function createGitRepositoryTags(repo: GitRepositoryPointer | NostrEvent): string[][];
9
+ /**
10
+ * Replaces repository tags while preserving commit references and unrelated recipients
11
+ * @throws if the event or pointer is not a valid repository
12
+ */
13
+ export declare function setGitThreadRepository(repo: GitRepositoryPointer | NostrEvent): EventOperation;
@@ -0,0 +1,39 @@
1
+ import { isEvent } from "applesauce-core/helpers/event";
2
+ import { createATagFromAddressPointer } from "applesauce-core/helpers/factory";
3
+ import { getAddressPointerForEvent } from "applesauce-core/helpers/pointers";
4
+ import { isHexKey } from "applesauce-core/helpers/string";
5
+ import { modifyPublicTags } from "applesauce-core/operations/tags";
6
+ import { GIT_REPOSITORY_KIND, getGitRepositoryEarliestUniqueCommit, getGitRepositoryReference, isValidGitRepository, } from "../helpers/git-repository.js";
7
+ /**
8
+ * Returns the tags linking a thread to a repository
9
+ * @throws if the event or pointer is not a valid repository
10
+ */
11
+ export function createGitRepositoryTags(repo) {
12
+ if (isEvent(repo) && !isValidGitRepository(repo))
13
+ throw new Error("Expected a git repository event");
14
+ const pointer = isEvent(repo) ? getAddressPointerForEvent(repo) : repo;
15
+ if (!pointer || pointer.kind !== GIT_REPOSITORY_KIND || !pointer.identifier || !isHexKey(pointer.pubkey))
16
+ throw new Error("Expected a git repository pointer");
17
+ const tags = [createATagFromAddressPointer(pointer), ["p", pointer.pubkey]];
18
+ const euc = isEvent(repo) ? getGitRepositoryEarliestUniqueCommit(repo) : undefined;
19
+ if (euc)
20
+ tags.push(["r", euc]);
21
+ return tags;
22
+ }
23
+ /**
24
+ * Replaces repository tags while preserving commit references and unrelated recipients
25
+ * @throws if the event or pointer is not a valid repository
26
+ */
27
+ export function setGitThreadRepository(repo) {
28
+ const repoTags = createGitRepositoryTags(repo);
29
+ return modifyPublicTags((tags) => {
30
+ const oldRepo = getGitRepositoryReference({ tags });
31
+ const commitTags = tags
32
+ .filter((t) => ["commit", "c", "merge-commit", "applied-as-commits"].includes(t[0]))
33
+ .flatMap((t) => [...new Set(t.slice(1))])
34
+ .filter((id) => tags.some((t) => t[0] === "r" && t[1] === id))
35
+ .map((id) => ["r", id]);
36
+ const next = tags.filter((t) => t[0] !== "a" && t[0] !== "r" && !(t[0] === "p" && (t[1] === oldRepo?.pubkey || t[1] === repoTags[1][1])));
37
+ return [...next, ...commitTags, ...repoTags];
38
+ });
39
+ }
@@ -1,4 +1,6 @@
1
1
  export * as AppData from "./app-data.js";
2
+ export * as AppHandler from "./app-handler.js";
3
+ export * as AppRecommendation from "./app-recommendation.js";
2
4
  export * as Badge from "./badge.js";
3
5
  export * as BadgeAward from "./badge-award.js";
4
6
  export * as CodeSnippet from "./code-snippet.js";
@@ -6,13 +8,21 @@ export * as Calendar from "./calendar.js";
6
8
  export * as CalendarEvent from "./calendar-event.js";
7
9
  export * as CalendarRsvp from "./calendar-rsvp.js";
8
10
  export * as Channel from "./channel.js";
11
+ export * as ChatMessage from "./chat-message.js";
12
+ export * as ForumThread from "./forum-thread.js";
9
13
  export * as Client from "./client.js";
10
14
  export * as Comment from "./comment.js";
15
+ export * as ExternalIdentities from "./external-identities.js";
11
16
  export * as FileMetadata from "./file-metadata.js";
12
17
  export * as Geohash from "./geohash.js";
13
18
  export * as GiftWrap from "./gift-wrap.js";
14
19
  export * as GitGraspList from "./git-grasp-list.js";
20
+ export * as GitIssue from "./git-issue.js";
21
+ export * as GitThread from "./git-thread.js";
22
+ export * as GitPatch from "./git-patch.js";
23
+ export * as GitPullRequest from "./git-pull-request.js";
15
24
  export * as GitRepository from "./git-repository.js";
25
+ export * as GitStatus from "./git-status.js";
16
26
  export * as Group from "./group.js";
17
27
  export * as Hashtags from "./hashtags.js";
18
28
  export * as Highlight from "./highlight.js";
@@ -20,6 +30,7 @@ export * as LegacyMessage from "./legacy-message.js";
20
30
  export * as List from "./list.js";
21
31
  export * as LiveStream from "./live-stream.js";
22
32
  export * as MediaAttachment from "./media-attachment.js";
33
+ export * as Napplet from "./napplet.js";
23
34
  export * as Note from "./note.js";
24
35
  export * as NostrWebToken from "./nostr-web-token.js";
25
36
  export * as PicturePost from "./picture-post.js";
@@ -30,9 +41,13 @@ export * as ProfileBadges from "./profile-badges.js";
30
41
  export * as Stream from "./stream.js";
31
42
  export * as StreamChat from "./stream-chat.js";
32
43
  export * as Torrent from "./torrent.js";
44
+ export * as TrustedProviders from "./trusted-providers.js";
45
+ export * as UserStatus from "./user-status.js";
33
46
  export * as WrappedMessage from "./wrapped-message.js";
34
47
  export * as Zap from "./zap.js";
35
48
  export * as ZapGoal from "./zap-goal.js";
36
49
  export * as ZapRequest from "./zap-request.js";
37
50
  export * as ZapSplit from "./zap-split.js";
38
51
  export * as TagOperations from "./tag/index.js";
52
+ export * from "./nsite.js";
53
+ export * from "./report.js";
@@ -1,4 +1,6 @@
1
1
  export * as AppData from "./app-data.js";
2
+ export * as AppHandler from "./app-handler.js";
3
+ export * as AppRecommendation from "./app-recommendation.js";
2
4
  export * as Badge from "./badge.js";
3
5
  export * as BadgeAward from "./badge-award.js";
4
6
  export * as CodeSnippet from "./code-snippet.js";
@@ -6,13 +8,21 @@ export * as Calendar from "./calendar.js";
6
8
  export * as CalendarEvent from "./calendar-event.js";
7
9
  export * as CalendarRsvp from "./calendar-rsvp.js";
8
10
  export * as Channel from "./channel.js";
11
+ export * as ChatMessage from "./chat-message.js";
12
+ export * as ForumThread from "./forum-thread.js";
9
13
  export * as Client from "./client.js";
10
14
  export * as Comment from "./comment.js";
15
+ export * as ExternalIdentities from "./external-identities.js";
11
16
  export * as FileMetadata from "./file-metadata.js";
12
17
  export * as Geohash from "./geohash.js";
13
18
  export * as GiftWrap from "./gift-wrap.js";
14
19
  export * as GitGraspList from "./git-grasp-list.js";
20
+ export * as GitIssue from "./git-issue.js";
21
+ export * as GitThread from "./git-thread.js";
22
+ export * as GitPatch from "./git-patch.js";
23
+ export * as GitPullRequest from "./git-pull-request.js";
15
24
  export * as GitRepository from "./git-repository.js";
25
+ export * as GitStatus from "./git-status.js";
16
26
  export * as Group from "./group.js";
17
27
  export * as Hashtags from "./hashtags.js";
18
28
  export * as Highlight from "./highlight.js";
@@ -20,6 +30,7 @@ export * as LegacyMessage from "./legacy-message.js";
20
30
  export * as List from "./list.js";
21
31
  export * as LiveStream from "./live-stream.js";
22
32
  export * as MediaAttachment from "./media-attachment.js";
33
+ export * as Napplet from "./napplet.js";
23
34
  export * as Note from "./note.js";
24
35
  export * as NostrWebToken from "./nostr-web-token.js";
25
36
  export * as PicturePost from "./picture-post.js";
@@ -30,9 +41,13 @@ export * as ProfileBadges from "./profile-badges.js";
30
41
  export * as Stream from "./stream.js";
31
42
  export * as StreamChat from "./stream-chat.js";
32
43
  export * as Torrent from "./torrent.js";
44
+ export * as TrustedProviders from "./trusted-providers.js";
45
+ export * as UserStatus from "./user-status.js";
33
46
  export * as WrappedMessage from "./wrapped-message.js";
34
47
  export * as Zap from "./zap.js";
35
48
  export * as ZapGoal from "./zap-goal.js";
36
49
  export * as ZapRequest from "./zap-request.js";
37
50
  export * as ZapSplit from "./zap-split.js";
38
51
  export * as TagOperations from "./tag/index.js";
52
+ export * from "./nsite.js";
53
+ export * from "./report.js";
@@ -0,0 +1,2 @@
1
+ /** Replaces commit metadata and the discovery tags owned by that metadata */
2
+ export declare function replaceGitCommitReferences(tags: string[][], name: string, commits: string[]): string[][];
@@ -0,0 +1,16 @@
1
+ /** Replaces commit metadata and the discovery tags owned by that metadata */
2
+ export function replaceGitCommitReferences(tags, name, commits) {
3
+ const old = new Set(tags.filter((tag) => tag[0] === name).flatMap((tag) => tag.slice(1)));
4
+ const next = tags.filter((tag) => tag[0] !== name);
5
+ // Each generated role owns one discovery tag; the same id may also identify the repository.
6
+ for (const commit of old) {
7
+ for (let index = next.length - 1; index >= 0; index--) {
8
+ if (next[index][0] === "r" && next[index][1] === commit) {
9
+ next.splice(index, 1);
10
+ break;
11
+ }
12
+ }
13
+ }
14
+ const ids = [...new Set(commits)];
15
+ return [...next, ...(ids.length ? [[name, ...ids], ...ids.map((id) => ["r", id])] : [])];
16
+ }
@@ -0,0 +1,51 @@
1
+ import { EventOperation } from "applesauce-core/factories";
2
+ import { AddressPointer } from "applesauce-core/helpers/pointers";
3
+ import { NappletIconType } from "../helpers/napplet.js";
4
+ /** Sets the `d` tag identifier of a named napplet */
5
+ export declare function setNappletIdentifier(identifier: string): EventOperation;
6
+ /**
7
+ * Sets the sha256 of the napplet `index.html` artifact (`x` tag)
8
+ * @throws if the hash is not a 64 character lowercase hex string
9
+ */
10
+ export declare function setNappletArtifactHash(sha256: string): EventOperation;
11
+ /** Sets the plain-text description of the napplet */
12
+ export declare function setNappletDescription(description: string): EventOperation;
13
+ /** Sets or removes the short display label (`title` tag) */
14
+ export declare function setNappletTitle(title: string | null): EventOperation;
15
+ /** Sets or removes the source URL (`source` tag) */
16
+ export declare function setNappletSource(url: string | null): EventOperation;
17
+ /** Adds an archetype (`z` tag) */
18
+ export declare function addNappletArchetype(archetype: string): EventOperation;
19
+ /** Removes an archetype (`z` tag) */
20
+ export declare function removeNappletArchetype(archetype: string): EventOperation;
21
+ /** Adds or replaces an accepted intent and its parameter names (`i` tag) */
22
+ export declare function addNappletIntent(intent: string, params?: string[]): EventOperation;
23
+ /** Removes an accepted intent (`i` tag) */
24
+ export declare function removeNappletIntent(intent: string): EventOperation;
25
+ /** Adds a NAP domain required for full functionality (`R` tag) */
26
+ export declare function addNappletRequiredDomain(domain: string): EventOperation;
27
+ /** Removes a required NAP domain (`R` tag) */
28
+ export declare function removeNappletRequiredDomain(domain: string): EventOperation;
29
+ /** Adds an optional NAP domain (`O` tag) */
30
+ export declare function addNappletOptionalDomain(domain: string): EventOperation;
31
+ /** Removes an optional NAP domain (`O` tag) */
32
+ export declare function removeNappletOptionalDomain(domain: string): EventOperation;
33
+ /** Adds a Blossom server hint (`server` tag) */
34
+ export declare function addNappletServer(url: string): EventOperation;
35
+ /** Removes a Blossom server hint (`server` tag) */
36
+ export declare function removeNappletServer(url: string): EventOperation;
37
+ /**
38
+ * Sets or removes the content-addressed icon (`icon` tag)
39
+ * @throws if the hash is not a lowercase hex sha256 or the MIME type is not png, jpeg or webp
40
+ */
41
+ export declare function setNappletIcon(sha256: string | null, type?: NappletIconType): EventOperation;
42
+ /**
43
+ * Sets or removes the address of the napplet a snapshot derives from (`a` tag)
44
+ * @throws if the address cannot be parsed
45
+ */
46
+ export declare function setNappletParent(parent: AddressPointer | string | null): EventOperation;
47
+ /**
48
+ * Sets or removes the address of the root napplet a snapshot's lineage originates from (`A` tag)
49
+ * @throws if the address cannot be parsed
50
+ */
51
+ export declare function setNappletRoot(root: AddressPointer | string | null): EventOperation;
@@ -0,0 +1,121 @@
1
+ import { getReplaceableAddressFromPointer, parseReplaceableAddress, } from "applesauce-core/helpers/pointers";
2
+ import { isSafeRelayURL } from "applesauce-core/helpers/relays";
3
+ import { normalizeURL } from "applesauce-core/helpers/url";
4
+ import { setContent } from "applesauce-core/operations/content";
5
+ import { addNameValueTag, removeNameValueTag, removeSingletonTag, setSingletonTag, } from "applesauce-core/operations/tag/common";
6
+ import { includeSingletonTag, modifyPublicTags } from "applesauce-core/operations/tags";
7
+ import { isSha256 } from "../helpers/blossom.js";
8
+ import { isNappletIconType } from "../helpers/napplet.js";
9
+ /** Builds a lineage tag (`a` or `A`) for a napplet address */
10
+ function createLineageTag(name, input) {
11
+ const pointer = typeof input === "string" ? parseReplaceableAddress(input) : input;
12
+ if (!pointer)
13
+ throw new Error(`Invalid napplet address: ${input}`);
14
+ const hint = pointer.relays?.find((url) => isSafeRelayURL(url));
15
+ const address = getReplaceableAddressFromPointer(pointer);
16
+ return hint ? [name, address, normalizeURL(hint)] : [name, address];
17
+ }
18
+ /** Removes all but the first tag with a name */
19
+ function keepFirstTag(name) {
20
+ return (tags) => {
21
+ const first = tags.findIndex((t) => t[0] === name);
22
+ return tags.filter((t, i) => t[0] !== name || i === first);
23
+ };
24
+ }
25
+ /** Sets the `d` tag identifier of a named napplet */
26
+ export function setNappletIdentifier(identifier) {
27
+ return includeSingletonTag(["d", identifier], true);
28
+ }
29
+ /**
30
+ * Sets the sha256 of the napplet `index.html` artifact (`x` tag)
31
+ * @throws if the hash is not a 64 character lowercase hex string
32
+ */
33
+ export function setNappletArtifactHash(sha256) {
34
+ if (!isSha256(sha256))
35
+ throw new Error("Napplet artifact hash must be a lowercase hex sha256");
36
+ // Drop duplicate "x" tags since a manifest must carry exactly one
37
+ return modifyPublicTags(keepFirstTag("x"), setSingletonTag(["x", sha256], true));
38
+ }
39
+ /** Sets the plain-text description of the napplet */
40
+ export function setNappletDescription(description) {
41
+ return setContent(description);
42
+ }
43
+ /** Sets or removes the short display label (`title` tag) */
44
+ export function setNappletTitle(title) {
45
+ return modifyPublicTags(title === null ? removeSingletonTag("title") : setSingletonTag(["title", title], true));
46
+ }
47
+ /** Sets or removes the source URL (`source` tag) */
48
+ export function setNappletSource(url) {
49
+ return modifyPublicTags(url === null ? removeSingletonTag("source") : setSingletonTag(["source", url], true));
50
+ }
51
+ /** Adds an archetype (`z` tag) */
52
+ export function addNappletArchetype(archetype) {
53
+ return modifyPublicTags(addNameValueTag(["z", archetype]));
54
+ }
55
+ /** Removes an archetype (`z` tag) */
56
+ export function removeNappletArchetype(archetype) {
57
+ return modifyPublicTags(removeNameValueTag(["z", archetype]));
58
+ }
59
+ /** Adds or replaces an accepted intent and its parameter names (`i` tag) */
60
+ export function addNappletIntent(intent, params = []) {
61
+ return modifyPublicTags(addNameValueTag(["i", intent, ...params]));
62
+ }
63
+ /** Removes an accepted intent (`i` tag) */
64
+ export function removeNappletIntent(intent) {
65
+ return modifyPublicTags(removeNameValueTag(["i", intent]));
66
+ }
67
+ /** Adds a NAP domain required for full functionality (`R` tag) */
68
+ export function addNappletRequiredDomain(domain) {
69
+ return modifyPublicTags(addNameValueTag(["R", domain]));
70
+ }
71
+ /** Removes a required NAP domain (`R` tag) */
72
+ export function removeNappletRequiredDomain(domain) {
73
+ return modifyPublicTags(removeNameValueTag(["R", domain]));
74
+ }
75
+ /** Adds an optional NAP domain (`O` tag) */
76
+ export function addNappletOptionalDomain(domain) {
77
+ return modifyPublicTags(addNameValueTag(["O", domain]));
78
+ }
79
+ /** Removes an optional NAP domain (`O` tag) */
80
+ export function removeNappletOptionalDomain(domain) {
81
+ return modifyPublicTags(removeNameValueTag(["O", domain]));
82
+ }
83
+ /** Adds a Blossom server hint (`server` tag) */
84
+ export function addNappletServer(url) {
85
+ return modifyPublicTags(addNameValueTag(["server", url]));
86
+ }
87
+ /** Removes a Blossom server hint (`server` tag) */
88
+ export function removeNappletServer(url) {
89
+ return modifyPublicTags(removeNameValueTag(["server", url]));
90
+ }
91
+ /**
92
+ * Sets or removes the content-addressed icon (`icon` tag)
93
+ * @throws if the hash is not a lowercase hex sha256 or the MIME type is not png, jpeg or webp
94
+ */
95
+ export function setNappletIcon(sha256, type) {
96
+ if (sha256 === null)
97
+ return modifyPublicTags(removeSingletonTag("icon"));
98
+ if (!isSha256(sha256))
99
+ throw new Error("Napplet icon hash must be a lowercase hex sha256");
100
+ if (!type || !isNappletIconType(type))
101
+ throw new Error(`Unsupported napplet icon type: ${type}`);
102
+ return modifyPublicTags(setSingletonTag(["icon", sha256, type], true));
103
+ }
104
+ /**
105
+ * Sets or removes the address of the napplet a snapshot derives from (`a` tag)
106
+ * @throws if the address cannot be parsed
107
+ */
108
+ export function setNappletParent(parent) {
109
+ if (parent === null)
110
+ return modifyPublicTags(removeSingletonTag("a"));
111
+ return modifyPublicTags(setSingletonTag(createLineageTag("a", parent), true));
112
+ }
113
+ /**
114
+ * Sets or removes the address of the root napplet a snapshot's lineage originates from (`A` tag)
115
+ * @throws if the address cannot be parsed
116
+ */
117
+ export function setNappletRoot(root) {
118
+ if (root === null)
119
+ return modifyPublicTags(removeSingletonTag("A"));
120
+ return modifyPublicTags(setSingletonTag(createLineageTag("A", root), true));
121
+ }
@@ -0,0 +1,51 @@
1
+ import { EventOperation } from "applesauce-core/factories";
2
+ import { AddressPointer } from "applesauce-core/helpers/pointers";
3
+ /**
4
+ * Sets the identifier of a named site
5
+ * @throws if the identifier is invalid or the draft is not a named site
6
+ */
7
+ export declare function setNsiteIdentifier(identifier: string): EventOperation;
8
+ /** Sets or removes the site's title */
9
+ export declare function setNsiteTitle(title: string | null): EventOperation;
10
+ /** Sets or removes the site's description tag */
11
+ export declare function setNsiteDescription(description: string | null): EventOperation;
12
+ /** Sets or removes the site's source repository or archive URL */
13
+ export declare function setNsiteSource(source: string | null): EventOperation;
14
+ /** Adds a Blossom server hint */
15
+ export declare function addNsiteServer(server: string): EventOperation;
16
+ /** Removes a Blossom server hint */
17
+ export declare function removeNsiteServer(server: string): EventOperation;
18
+ /**
19
+ * Adds or replaces an upstream app descriptor reference
20
+ * @throws if the address is not addressable
21
+ */
22
+ export declare function addNsiteApp(app: AddressPointer | string): EventOperation;
23
+ /**
24
+ * Removes an upstream app descriptor reference
25
+ * @throws if the address is not addressable
26
+ */
27
+ export declare function removeNsiteApp(app: AddressPointer | string): EventOperation;
28
+ /**
29
+ * Sets or removes the immediate parent site address
30
+ * @throws if the address does not reference a root or named site
31
+ */
32
+ export declare function setNsiteParent(parent: AddressPointer | string | null): EventOperation;
33
+ /**
34
+ * Sets or removes the origin site address of the copy lineage
35
+ * @throws if the address does not reference a root or named site
36
+ */
37
+ export declare function setNsiteRoot(root: AddressPointer | string | null): EventOperation;
38
+ /**
39
+ * Sets or removes the advertised aggregate hash
40
+ * @throws if the hash is not lowercase hexadecimal SHA-256
41
+ */
42
+ export declare function setNsiteAggregateHash(hash: string | null): EventOperation;
43
+ /** Updates the aggregate hash from all current path tags */
44
+ export declare function updateNsiteAggregateHash(): EventOperation;
45
+ /**
46
+ * Adds or replaces a file mapping and updates the aggregate hash
47
+ * @throws if the path or hash is invalid
48
+ */
49
+ export declare function setNsiteFile(path: string, hash: string): EventOperation;
50
+ /** Removes a file mapping and updates the aggregate hash */
51
+ export declare function removeNsiteFile(path: string): EventOperation;