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.
- package/README.md +1 -0
- package/dist/casts/_circular-import.d.ts +3 -0
- package/dist/casts/_circular-import.js +3 -0
- package/dist/casts/app-handler.d.ts +56 -0
- package/dist/casts/app-handler.js +105 -0
- package/dist/casts/app-recommendation.d.ts +26 -0
- package/dist/casts/app-recommendation.js +41 -0
- package/dist/casts/external-identities.d.ts +9 -0
- package/dist/casts/external-identities.js +14 -0
- package/dist/casts/forum-thread.d.ts +17 -0
- package/dist/casts/forum-thread.js +31 -0
- package/dist/casts/git-issue.d.ts +18 -0
- package/dist/casts/git-issue.js +26 -0
- package/dist/casts/git-patch.d.ts +49 -0
- package/dist/casts/git-patch.js +88 -0
- package/dist/casts/git-pull-request.d.ts +67 -0
- package/dist/casts/git-pull-request.js +122 -0
- package/dist/casts/git-repository.d.ts +9 -0
- package/dist/casts/git-repository.js +16 -0
- package/dist/casts/git-thread.d.ts +33 -0
- package/dist/casts/git-thread.js +65 -0
- package/dist/casts/index.d.ts +12 -0
- package/dist/casts/index.js +12 -0
- package/dist/casts/napplet-handlers.d.ts +39 -0
- package/dist/casts/napplet-handlers.js +91 -0
- package/dist/casts/napplet.d.ts +98 -0
- package/dist/casts/napplet.js +196 -0
- package/dist/casts/note.d.ts +8 -0
- package/dist/casts/note.js +21 -1
- package/dist/casts/nsite.d.ts +134 -0
- package/dist/casts/nsite.js +249 -0
- package/dist/casts/profile.d.ts +20 -0
- package/dist/casts/profile.js +30 -0
- package/dist/casts/reaction.d.ts +1 -1
- package/dist/casts/relay-discovery.d.ts +4 -0
- package/dist/casts/relay-discovery.js +9 -1
- package/dist/casts/report.d.ts +28 -15
- package/dist/casts/report.js +42 -19
- package/dist/casts/share.d.ts +1 -1
- package/dist/casts/torrent.d.ts +5 -0
- package/dist/casts/torrent.js +8 -1
- package/dist/casts/trusted-assertions.d.ts +2 -0
- package/dist/casts/trusted-assertions.js +19 -18
- package/dist/casts/user-status.d.ts +33 -0
- package/dist/casts/user-status.js +69 -0
- package/dist/casts/user.d.ts +7 -0
- package/dist/casts/user.js +20 -1
- package/dist/factories/app-handler.d.ts +31 -0
- package/dist/factories/app-handler.js +50 -0
- package/dist/factories/app-recommendation.d.ts +21 -0
- package/dist/factories/app-recommendation.js +28 -0
- package/dist/factories/chat-message.d.ts +37 -0
- package/dist/factories/chat-message.js +56 -0
- package/dist/factories/comment.d.ts +8 -7
- package/dist/factories/comment.js +2 -2
- package/dist/factories/external-identities.d.ts +17 -0
- package/dist/factories/external-identities.js +28 -0
- package/dist/factories/file-message.d.ts +24 -0
- package/dist/factories/file-message.js +37 -0
- package/dist/factories/forum-thread.d.ts +34 -0
- package/dist/factories/forum-thread.js +50 -0
- package/dist/factories/git-applied-status.d.ts +39 -0
- package/dist/factories/git-applied-status.js +53 -0
- package/dist/factories/git-closed-status.d.ts +18 -0
- package/dist/factories/git-closed-status.js +24 -0
- package/dist/factories/git-draft-status.d.ts +18 -0
- package/dist/factories/git-draft-status.js +24 -0
- package/dist/factories/git-issue.d.ts +19 -0
- package/dist/factories/git-issue.js +25 -0
- package/dist/factories/git-open-status.d.ts +18 -0
- package/dist/factories/git-open-status.js +22 -0
- package/dist/factories/git-patch.d.ts +59 -0
- package/dist/factories/git-patch.js +102 -0
- package/dist/factories/git-pull-request-update.d.ts +23 -0
- package/dist/factories/git-pull-request-update.js +33 -0
- package/dist/factories/git-pull-request.d.ts +39 -0
- package/dist/factories/git-pull-request.js +64 -0
- package/dist/factories/index.d.ts +24 -0
- package/dist/factories/index.js +24 -0
- package/dist/factories/internal/git-pull-request.d.ts +19 -0
- package/dist/factories/internal/git-pull-request.js +26 -0
- package/dist/factories/internal/git-status.d.ts +11 -0
- package/dist/factories/internal/git-status.js +12 -0
- package/dist/factories/internal/git-thread.d.ts +19 -0
- package/dist/factories/internal/git-thread.js +29 -0
- package/dist/factories/internal/napplet-manifest.d.ts +52 -0
- package/dist/factories/internal/napplet-manifest.js +85 -0
- package/dist/factories/internal/nsite-manifest.d.ts +45 -0
- package/dist/factories/internal/nsite-manifest.js +68 -0
- package/dist/factories/legacy-message.d.ts +2 -0
- package/dist/factories/legacy-message.js +9 -2
- package/dist/factories/named-napplet.d.ts +20 -0
- package/dist/factories/named-napplet.js +30 -0
- package/dist/factories/named-nsite.d.ts +28 -0
- package/dist/factories/named-nsite.js +53 -0
- package/dist/factories/napplet-handlers.d.ts +34 -0
- package/dist/factories/napplet-handlers.js +77 -0
- package/dist/factories/napplet-snapshot.d.ts +18 -0
- package/dist/factories/napplet-snapshot.js +38 -0
- package/dist/factories/nsite-snapshot.d.ts +18 -0
- package/dist/factories/nsite-snapshot.js +29 -0
- package/dist/factories/reaction.d.ts +3 -2
- package/dist/factories/report.d.ts +48 -0
- package/dist/factories/report.js +66 -0
- package/dist/factories/root-napplet.d.ts +18 -0
- package/dist/factories/root-napplet.js +24 -0
- package/dist/factories/root-nsite.d.ts +23 -0
- package/dist/factories/root-nsite.js +44 -0
- package/dist/factories/torrent.d.ts +24 -10
- package/dist/factories/torrent.js +48 -44
- package/dist/factories/trusted-provider-list.d.ts +23 -0
- package/dist/factories/trusted-provider-list.js +39 -0
- package/dist/factories/user-status.d.ts +26 -0
- package/dist/factories/user-status.js +52 -0
- package/dist/factories/wrapped-message.js +10 -4
- package/dist/helpers/app-data.js +15 -7
- package/dist/helpers/app-handler.d.ts +43 -6
- package/dist/helpers/app-handler.js +53 -3
- package/dist/helpers/app-recommendation.d.ts +24 -0
- package/dist/helpers/app-recommendation.js +30 -0
- package/dist/helpers/bookmark.js +5 -2
- package/dist/helpers/comment.d.ts +11 -5
- package/dist/helpers/comment.js +7 -1
- package/dist/helpers/content.d.ts +3 -1
- package/dist/helpers/emoji-pack.js +11 -6
- package/dist/helpers/emoji.d.ts +2 -2
- package/dist/helpers/encrypted-content-cache.d.ts +2 -11
- package/dist/helpers/encrypted-content-cache.js +6 -14
- package/dist/helpers/encrypted-file.d.ts +41 -0
- package/dist/helpers/encrypted-file.js +64 -0
- package/dist/helpers/external-id.js +13 -19
- package/dist/helpers/external-identities.d.ts +29 -0
- package/dist/helpers/external-identities.js +52 -0
- package/dist/helpers/file-message.d.ts +18 -0
- package/dist/helpers/file-message.js +44 -0
- package/dist/helpers/file-metadata.d.ts +9 -4
- package/dist/helpers/file-metadata.js +21 -6
- package/dist/helpers/forum-thread.d.ts +10 -0
- package/dist/helpers/forum-thread.js +10 -0
- package/dist/helpers/gift-wrap.d.ts +40 -15
- package/dist/helpers/gift-wrap.js +110 -33
- package/dist/helpers/git-issue.d.ts +13 -0
- package/dist/helpers/git-issue.js +19 -0
- package/dist/helpers/git-patch.d.ts +41 -0
- package/dist/helpers/git-patch.js +73 -0
- package/dist/helpers/git-pull-request.d.ts +57 -0
- package/dist/helpers/git-pull-request.js +111 -0
- package/dist/helpers/git-repository.d.ts +4 -0
- package/dist/helpers/git-repository.js +16 -0
- package/dist/helpers/git-status.d.ts +44 -0
- package/dist/helpers/git-status.js +93 -0
- package/dist/helpers/git.d.ts +2 -0
- package/dist/helpers/git.js +4 -0
- package/dist/helpers/groups.d.ts +5 -2
- package/dist/helpers/groups.js +40 -18
- package/dist/helpers/hashtag.d.ts +4 -2
- package/dist/helpers/index.d.ts +13 -0
- package/dist/helpers/index.js +13 -0
- package/dist/helpers/lists.js +14 -2
- package/dist/helpers/lnurl.js +1 -1
- package/dist/helpers/messages.js +3 -2
- package/dist/helpers/mute.js +20 -9
- package/dist/helpers/napplet-handlers.d.ts +79 -0
- package/dist/helpers/napplet-handlers.js +187 -0
- package/dist/helpers/napplet.d.ts +107 -0
- package/dist/helpers/napplet.js +177 -0
- package/dist/helpers/nsite.d.ts +90 -0
- package/dist/helpers/nsite.js +217 -0
- package/dist/helpers/relay-discovery.d.ts +4 -0
- package/dist/helpers/relay-discovery.js +8 -0
- package/dist/helpers/reports.d.ts +35 -0
- package/dist/helpers/reports.js +36 -5
- package/dist/helpers/threading.d.ts +4 -2
- package/dist/helpers/torrent.d.ts +9 -6
- package/dist/helpers/torrent.js +23 -15
- package/dist/helpers/trusted-assertions.d.ts +7 -0
- package/dist/helpers/trusted-assertions.js +41 -2
- package/dist/helpers/user-status.d.ts +13 -1
- package/dist/helpers/user-status.js +15 -0
- package/dist/helpers/wrapped-messages.d.ts +2 -0
- package/dist/helpers/wrapped-messages.js +6 -1
- package/dist/models/app-handler.d.ts +21 -0
- package/dist/models/app-handler.js +47 -0
- package/dist/models/git.d.ts +34 -0
- package/dist/models/git.js +144 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +4 -0
- package/dist/models/legacy-messages.js +6 -1
- package/dist/models/napplet-handlers.d.ts +16 -0
- package/dist/models/napplet-handlers.js +45 -0
- package/dist/models/nsite.d.ts +22 -0
- package/dist/models/nsite.js +67 -0
- package/dist/models/thread.d.ts +4 -1
- package/dist/models/thread.js +34 -5
- package/dist/models/user-status.d.ts +8 -4
- package/dist/models/user-status.js +16 -22
- package/dist/models/wrapped-messages.js +9 -7
- package/dist/observable/filter-timeline-by-mutes.d.ts +1 -1
- package/dist/observable/filter-timeline-by-mutes.js +6 -2
- package/dist/operations/app-handler.d.ts +24 -0
- package/dist/operations/app-handler.js +58 -0
- package/dist/operations/app-recommendation.d.ts +13 -0
- package/dist/operations/app-recommendation.js +40 -0
- package/dist/operations/calendar-event.js +3 -2
- package/dist/operations/chat-message.d.ts +9 -0
- package/dist/operations/chat-message.js +12 -0
- package/dist/operations/client.d.ts +1 -4
- package/dist/operations/client.js +1 -23
- package/dist/operations/comment.d.ts +9 -3
- package/dist/operations/comment.js +12 -9
- package/dist/operations/external-identities.d.ts +8 -0
- package/dist/operations/external-identities.js +23 -0
- package/dist/operations/file-message.d.ts +7 -0
- package/dist/operations/file-message.js +34 -0
- package/dist/operations/forum-thread.d.ts +3 -0
- package/dist/operations/forum-thread.js +6 -0
- package/dist/operations/gift-wrap.js +38 -14
- package/dist/operations/git-issue.d.ts +18 -0
- package/dist/operations/git-issue.js +31 -0
- package/dist/operations/git-patch.d.ts +30 -0
- package/dist/operations/git-patch.js +75 -0
- package/dist/operations/git-pull-request.d.ts +29 -0
- package/dist/operations/git-pull-request.js +74 -0
- package/dist/operations/git-repository.js +4 -4
- package/dist/operations/git-status.d.ts +28 -0
- package/dist/operations/git-status.js +116 -0
- package/dist/operations/git-thread.d.ts +13 -0
- package/dist/operations/git-thread.js +39 -0
- package/dist/operations/index.d.ts +17 -0
- package/dist/operations/index.js +17 -0
- package/dist/operations/internal/git-commits.d.ts +2 -0
- package/dist/operations/internal/git-commits.js +16 -0
- package/dist/operations/napplet-handlers.d.ts +47 -0
- package/dist/operations/napplet-handlers.js +161 -0
- package/dist/operations/napplet.d.ts +51 -0
- package/dist/operations/napplet.js +121 -0
- package/dist/operations/nsite.d.ts +51 -0
- package/dist/operations/nsite.js +112 -0
- package/dist/operations/reaction.d.ts +12 -2
- package/dist/operations/reaction.js +1 -1
- package/dist/operations/report.d.ts +33 -0
- package/dist/operations/report.js +60 -0
- package/dist/operations/stream.js +5 -4
- package/dist/operations/torrent.d.ts +1 -4
- package/dist/operations/torrent.js +24 -11
- package/dist/operations/trusted-providers.d.ts +14 -0
- package/dist/operations/trusted-providers.js +33 -0
- package/dist/operations/user-status.d.ts +11 -0
- package/dist/operations/user-status.js +29 -0
- package/dist/operations/wrapped-message.js +2 -2
- package/package.json +13 -17
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { castEventStream, castTimelineStream } from "applesauce-core/observable/cast-stream";
|
|
2
|
+
import { map, of } from "rxjs";
|
|
3
|
+
import { getGitPullRequestBranchName, getGitPullRequestCloneUrls, getGitPullRequestLabels, getGitPullRequestMergeBase, getGitPullRequestSubject, getGitPullRequestTipCommit, getGitPullRequestUpdateCloneUrls, getGitPullRequestUpdateTarget, getGitPullRequestUpdateTipCommit, isValidGitPullRequest, isValidGitPullRequestUpdate, getGitPullRequestPatchId, getGitPullRequestUpdateAuthor, getGitPullRequestUpdatePointer, getGitPullRequestPatchPointer, } from "../helpers/git-pull-request.js";
|
|
4
|
+
import { GitPullRequestUpdatesModel, GitPullRequestStateModel } from "../models/git.js";
|
|
5
|
+
import { GitPatch } from "./git-patch.js";
|
|
6
|
+
import { EventCast } from "./cast.js";
|
|
7
|
+
import { GitThread } from "./git-thread.js";
|
|
8
|
+
/** Cast for NIP-34 pull request update events */
|
|
9
|
+
export class GitPullRequestUpdate extends EventCast {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a pull request update cast
|
|
12
|
+
* @throws if the event is not a valid update
|
|
13
|
+
*/
|
|
14
|
+
constructor(event, store) {
|
|
15
|
+
if (!isValidGitPullRequestUpdate(event))
|
|
16
|
+
throw new Error("Invalid git pull request update event");
|
|
17
|
+
super(event, store);
|
|
18
|
+
}
|
|
19
|
+
/** The id of the pull request this update targets */
|
|
20
|
+
get pullRequestId() {
|
|
21
|
+
return getGitPullRequestUpdateTarget(this.event);
|
|
22
|
+
}
|
|
23
|
+
/** The updated branch tip commit */
|
|
24
|
+
get tipCommit() {
|
|
25
|
+
return getGitPullRequestUpdateTipCommit(this.event);
|
|
26
|
+
}
|
|
27
|
+
/** The clone URLs containing the updated tip */
|
|
28
|
+
get cloneUrls() {
|
|
29
|
+
return getGitPullRequestUpdateCloneUrls(this.event);
|
|
30
|
+
}
|
|
31
|
+
/** The common ancestor with the target branch */
|
|
32
|
+
get mergeBase() {
|
|
33
|
+
return getGitPullRequestMergeBase(this.event);
|
|
34
|
+
}
|
|
35
|
+
/** The author of the targeted pull request */
|
|
36
|
+
get pullRequestAuthor() {
|
|
37
|
+
return getGitPullRequestUpdateAuthor(this.event);
|
|
38
|
+
}
|
|
39
|
+
/** The target pull request pointer with its relay and author hints */
|
|
40
|
+
get pullRequestPointer() {
|
|
41
|
+
return getGitPullRequestUpdatePointer(this.event);
|
|
42
|
+
}
|
|
43
|
+
/** Subscribes to the targeted pull request */
|
|
44
|
+
get pullRequest$() {
|
|
45
|
+
return this.$$ref("pullRequest$", (store) => store.event(this.pullRequestPointer).pipe(castEventStream(GitPullRequest, store)));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Cast for NIP-34 pull request events */
|
|
49
|
+
export class GitPullRequest extends GitThread {
|
|
50
|
+
/**
|
|
51
|
+
* Creates a pull request cast
|
|
52
|
+
* @throws if the event is not a valid pull request
|
|
53
|
+
*/
|
|
54
|
+
constructor(event, store) {
|
|
55
|
+
if (!isValidGitPullRequest(event))
|
|
56
|
+
throw new Error("Invalid git pull request event");
|
|
57
|
+
super(event, store);
|
|
58
|
+
}
|
|
59
|
+
/** The pull request subject */
|
|
60
|
+
get subject() {
|
|
61
|
+
return getGitPullRequestSubject(this.event);
|
|
62
|
+
}
|
|
63
|
+
/** The subject or first content line */
|
|
64
|
+
get title() {
|
|
65
|
+
return this.subject ?? super.title;
|
|
66
|
+
}
|
|
67
|
+
/** The pull request labels */
|
|
68
|
+
get labels() {
|
|
69
|
+
return getGitPullRequestLabels(this.event);
|
|
70
|
+
}
|
|
71
|
+
/** The original branch tip commit */
|
|
72
|
+
get tipCommit() {
|
|
73
|
+
return getGitPullRequestTipCommit(this.event);
|
|
74
|
+
}
|
|
75
|
+
/** The original clone URLs */
|
|
76
|
+
get cloneUrls() {
|
|
77
|
+
return getGitPullRequestCloneUrls(this.event);
|
|
78
|
+
}
|
|
79
|
+
/** The recommended branch name */
|
|
80
|
+
get branchName() {
|
|
81
|
+
return getGitPullRequestBranchName(this.event);
|
|
82
|
+
}
|
|
83
|
+
/** The original common ancestor with the target branch */
|
|
84
|
+
get mergeBase() {
|
|
85
|
+
return getGitPullRequestMergeBase(this.event);
|
|
86
|
+
}
|
|
87
|
+
/** The id of the original patch revised by this pull request */
|
|
88
|
+
get patchId() {
|
|
89
|
+
return getGitPullRequestPatchId(this.event);
|
|
90
|
+
}
|
|
91
|
+
/** The pointer to the original patch with its relay hint */
|
|
92
|
+
get patchPointer() {
|
|
93
|
+
return getGitPullRequestPatchPointer(this.event);
|
|
94
|
+
}
|
|
95
|
+
/** Subscribes to the original patch revised by this pull request */
|
|
96
|
+
get patch$() {
|
|
97
|
+
return this.$$ref("patch$", (store) => this.patchPointer ? store.event(this.patchPointer).pipe(castEventStream(GitPatch, store)) : of(undefined));
|
|
98
|
+
}
|
|
99
|
+
/** Subscribes to the latest coherent tip, clone URLs and merge base */
|
|
100
|
+
get state$() {
|
|
101
|
+
return this.$$ref("state$", (store) => store.model(GitPullRequestStateModel, this.event));
|
|
102
|
+
}
|
|
103
|
+
/** Subscribes to the updates published by the pull request author */
|
|
104
|
+
get updates$() {
|
|
105
|
+
return this.$$ref("updates$", (store) => store.model(GitPullRequestUpdatesModel, this.event).pipe(castTimelineStream(GitPullRequestUpdate, store)));
|
|
106
|
+
}
|
|
107
|
+
/** Subscribes to the latest branch tip commit, including updates */
|
|
108
|
+
get latestTipCommit$() {
|
|
109
|
+
return this.$$ref("latestTipCommit$", () => this.state$.pipe(map((state) => state.tipCommit)));
|
|
110
|
+
}
|
|
111
|
+
/** Subscribes to the clone URLs containing the latest tip */
|
|
112
|
+
get latestCloneUrls$() {
|
|
113
|
+
return this.$$ref("latestCloneUrls$", () => this.state$.pipe(map((state) => state.cloneUrls)));
|
|
114
|
+
}
|
|
115
|
+
/** Subscribes to the latest merge base */
|
|
116
|
+
get latestMergeBase$() {
|
|
117
|
+
return this.$$ref("latestMergeBase$", () => this.state$.pipe(map((state) => state.mergeBase)));
|
|
118
|
+
}
|
|
119
|
+
activity$() {
|
|
120
|
+
return this.store.model(GitPullRequestUpdatesModel, this.event);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -3,6 +3,9 @@ import { User } from "applesauce-core/casts/user";
|
|
|
3
3
|
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
4
4
|
import { GitRepositoryEvent, GitRepositoryPointer } from "../helpers/git-repository.js";
|
|
5
5
|
import { CastRefEventStore, EventCast } from "./cast.js";
|
|
6
|
+
import { GitIssue } from "./git-issue.js";
|
|
7
|
+
import { GitPatch } from "./git-patch.js";
|
|
8
|
+
import { GitPullRequest } from "./git-pull-request.js";
|
|
6
9
|
import { Reaction } from "./reaction.js";
|
|
7
10
|
/** Cast for NIP-34 repository announcement events. */
|
|
8
11
|
export declare class GitRepository extends EventCast<GitRepositoryEvent> {
|
|
@@ -26,4 +29,10 @@ export declare class GitRepository extends EventCast<GitRepositoryEvent> {
|
|
|
26
29
|
get followers$(): ChainableObservable<User[]>;
|
|
27
30
|
/** Returns a timeline of all reactions to this git repository */
|
|
28
31
|
get reactions$(): ChainableObservable<Reaction[]>;
|
|
32
|
+
/** Subscribes to the issues of this repository */
|
|
33
|
+
get issues$(): ChainableObservable<GitIssue[]>;
|
|
34
|
+
/** Subscribes to the pull requests of this repository */
|
|
35
|
+
get pullRequests$(): ChainableObservable<GitPullRequest[]>;
|
|
36
|
+
/** Subscribes to the root patches (the first patch of each series) of this repository */
|
|
37
|
+
get patches$(): ChainableObservable<GitPatch[]>;
|
|
29
38
|
}
|
|
@@ -4,8 +4,12 @@ import { castEventStream, castTimelineStream } from "applesauce-core/observable/
|
|
|
4
4
|
import { map, of } from "rxjs";
|
|
5
5
|
import { FAVORITE_GIT_REPOS_KIND } from "../helpers/git-lists.js";
|
|
6
6
|
import { getGitRepositoryCloneUrls, getGitRepositoryDescription, getGitRepositoryEarliestUniqueCommit, getGitRepositoryHashtags, getGitRepositoryIdentifier, getGitRepositoryMaintainers, getGitRepositoryName, getGitRepositoryRelays, getGitRepositoryUpstream, getGitRepositoryWebUrls, isValidGitRepository, } from "../helpers/git-repository.js";
|
|
7
|
+
import { GitRepositoryIssuesModel, GitRepositoryPatchesModel, GitRepositoryPullRequestsModel } from "../models/git.js";
|
|
7
8
|
import { ReactionsModel } from "../models/reactions.js";
|
|
8
9
|
import { EventCast } from "./cast.js";
|
|
10
|
+
import { GitIssue } from "./git-issue.js";
|
|
11
|
+
import { GitPatch } from "./git-patch.js";
|
|
12
|
+
import { GitPullRequest } from "./git-pull-request.js";
|
|
9
13
|
import { Reaction } from "./reaction.js";
|
|
10
14
|
/** Cast for NIP-34 repository announcement events. */
|
|
11
15
|
export class GitRepository extends EventCast {
|
|
@@ -65,4 +69,16 @@ export class GitRepository extends EventCast {
|
|
|
65
69
|
get reactions$() {
|
|
66
70
|
return this.$$ref("reactions$", (store) => store.model(ReactionsModel, this.event).pipe(castTimelineStream(Reaction, store)));
|
|
67
71
|
}
|
|
72
|
+
/** Subscribes to the issues of this repository */
|
|
73
|
+
get issues$() {
|
|
74
|
+
return this.$$ref("issues$", (store) => store.model(GitRepositoryIssuesModel, this.pointer).pipe(castTimelineStream(GitIssue, store)));
|
|
75
|
+
}
|
|
76
|
+
/** Subscribes to the pull requests of this repository */
|
|
77
|
+
get pullRequests$() {
|
|
78
|
+
return this.$$ref("pullRequests$", (store) => store.model(GitRepositoryPullRequestsModel, this.pointer).pipe(castTimelineStream(GitPullRequest, store)));
|
|
79
|
+
}
|
|
80
|
+
/** Subscribes to the root patches (the first patch of each series) of this repository */
|
|
81
|
+
get patches$() {
|
|
82
|
+
return this.$$ref("patches$", (store) => store.model(GitRepositoryPatchesModel, this.pointer).pipe(castTimelineStream(GitPatch, store)));
|
|
83
|
+
}
|
|
68
84
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ChainableObservable } from "applesauce-core";
|
|
2
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { GitRepositoryPointer } from "../helpers/git-repository.js";
|
|
5
|
+
import { GitStatus } from "../helpers/git-status.js";
|
|
6
|
+
import { CastRefEventStore, EventCast } from "./cast.js";
|
|
7
|
+
import { Comment } from "./comment.js";
|
|
8
|
+
import type { GitRepository } from "./git-repository.js";
|
|
9
|
+
/** Base cast for NIP-34 issues, patches and pull requests */
|
|
10
|
+
export declare class GitThread<T extends NostrEvent = NostrEvent> extends EventCast<T> {
|
|
11
|
+
/** Creates a shared repository thread cast */
|
|
12
|
+
constructor(event: T, store: CastRefEventStore);
|
|
13
|
+
/** The pointer to the repository this thread belongs to */
|
|
14
|
+
get repositoryPointer(): GitRepositoryPointer;
|
|
15
|
+
/** The `<kind>:<pubkey>:<identifier>` address of the repository */
|
|
16
|
+
get repositoryAddress(): string;
|
|
17
|
+
/** The title of the thread, falls back to the first line of the content */
|
|
18
|
+
get title(): string;
|
|
19
|
+
/** Subscribes to the repository announcement */
|
|
20
|
+
get repository$(): ChainableObservable<GitRepository | undefined>;
|
|
21
|
+
/** Subscribes to the pubkeys allowed to set the status, the repository owner is used until the announcement loads */
|
|
22
|
+
get maintainers$(): ChainableObservable<string[]>;
|
|
23
|
+
/** Subscribes to the current status */
|
|
24
|
+
get status$(): ChainableObservable<GitStatus>;
|
|
25
|
+
/** Subscribes to the latest authorized status event */
|
|
26
|
+
get statusEvent$(): ChainableObservable<NostrEvent | undefined>;
|
|
27
|
+
/** Subscribes to all NIP-22 comments in the thread */
|
|
28
|
+
get comments$(): ChainableObservable<Comment[]>;
|
|
29
|
+
/** Extra events that count as activity on the thread */
|
|
30
|
+
protected activity$(): Observable<NostrEvent[]>;
|
|
31
|
+
/** Subscribes to the unix timestamp of the most recent activity (status, comment or update) */
|
|
32
|
+
get updatedAt$(): ChainableObservable<number>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { castEventStream, castTimelineStream } from "applesauce-core/observable/cast-stream";
|
|
2
|
+
import { combineLatest, defer, from, map, of, switchMap } from "rxjs";
|
|
3
|
+
import { getGitRepositoryMaintainers, getGitRepositoryReference, } from "../helpers/git-repository.js";
|
|
4
|
+
import { GitStatusEventModel, GitStatusModel, GitThreadCommentsModel } from "../models/git.js";
|
|
5
|
+
import { EventCast } from "./cast.js";
|
|
6
|
+
import { Comment } from "./comment.js";
|
|
7
|
+
// GitRepository imports the thread casts, so it MUST be imported lazily to avoid a circular dependency
|
|
8
|
+
const GitRepositoryModule = defer(() => from(import("./git-repository.js")));
|
|
9
|
+
/** Base cast for NIP-34 issues, patches and pull requests */
|
|
10
|
+
export class GitThread extends EventCast {
|
|
11
|
+
/** Creates a shared repository thread cast */
|
|
12
|
+
constructor(event, store) {
|
|
13
|
+
super(event, store);
|
|
14
|
+
}
|
|
15
|
+
/** The pointer to the repository this thread belongs to */
|
|
16
|
+
get repositoryPointer() {
|
|
17
|
+
return getGitRepositoryReference(this.event);
|
|
18
|
+
}
|
|
19
|
+
/** The `<kind>:<pubkey>:<identifier>` address of the repository */
|
|
20
|
+
get repositoryAddress() {
|
|
21
|
+
const { kind, pubkey, identifier } = this.repositoryPointer;
|
|
22
|
+
return `${kind}:${pubkey}:${identifier}`;
|
|
23
|
+
}
|
|
24
|
+
/** The title of the thread, falls back to the first line of the content */
|
|
25
|
+
get title() {
|
|
26
|
+
return this.event.content.split("\n", 1)[0].trim();
|
|
27
|
+
}
|
|
28
|
+
/** Subscribes to the repository announcement */
|
|
29
|
+
get repository$() {
|
|
30
|
+
return this.$$ref("repository$", (store) => GitRepositoryModule.pipe(switchMap(({ GitRepository }) => store.replaceable(this.repositoryPointer).pipe(castEventStream(GitRepository, store)))));
|
|
31
|
+
}
|
|
32
|
+
/** Subscribes to the pubkeys allowed to set the status, the repository owner is used until the announcement loads */
|
|
33
|
+
get maintainers$() {
|
|
34
|
+
return this.$$ref("maintainers$", (store) => store
|
|
35
|
+
.replaceable(this.repositoryPointer)
|
|
36
|
+
.pipe(map((repo) => (repo ? getGitRepositoryMaintainers(repo) : [this.repositoryPointer.pubkey]))));
|
|
37
|
+
}
|
|
38
|
+
/** Subscribes to the current status */
|
|
39
|
+
get status$() {
|
|
40
|
+
return this.$$ref("status$", (store) => this.maintainers$.pipe(switchMap((maintainers) => store.model(GitStatusModel, this.event, maintainers))));
|
|
41
|
+
}
|
|
42
|
+
/** Subscribes to the latest authorized status event */
|
|
43
|
+
get statusEvent$() {
|
|
44
|
+
return this.$$ref("statusEvent$", (store) => this.maintainers$.pipe(switchMap((maintainers) => store.model(GitStatusEventModel, this.event, maintainers))));
|
|
45
|
+
}
|
|
46
|
+
/** Subscribes to all NIP-22 comments in the thread */
|
|
47
|
+
get comments$() {
|
|
48
|
+
return this.$$ref("comments$", (store) => store.model(GitThreadCommentsModel, this.event).pipe(castTimelineStream(Comment, store)));
|
|
49
|
+
}
|
|
50
|
+
/** Extra events that count as activity on the thread */
|
|
51
|
+
activity$() {
|
|
52
|
+
return of([]);
|
|
53
|
+
}
|
|
54
|
+
/** Subscribes to the unix timestamp of the most recent activity (status, comment or update) */
|
|
55
|
+
get updatedAt$() {
|
|
56
|
+
return this.$$ref("updatedAt$", (store) => combineLatest([this.statusEvent$, store.model(GitThreadCommentsModel, this.event), this.activity$()]).pipe(map(([status, comments, activity]) => {
|
|
57
|
+
let latest = Math.max(this.event.created_at, status?.created_at ?? 0);
|
|
58
|
+
for (const event of comments)
|
|
59
|
+
latest = Math.max(latest, event.created_at);
|
|
60
|
+
for (const event of activity)
|
|
61
|
+
latest = Math.max(latest, event.created_at);
|
|
62
|
+
return latest;
|
|
63
|
+
})));
|
|
64
|
+
}
|
|
65
|
+
}
|
package/dist/casts/index.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
+
export * from "./app-handler.js";
|
|
2
|
+
export * from "./app-recommendation.js";
|
|
1
3
|
export * from "./article.js";
|
|
4
|
+
export * from "./forum-thread.js";
|
|
2
5
|
export * from "./bookmarks.js";
|
|
3
6
|
export * from "./cast.js";
|
|
4
7
|
export * from "./code-snippet.js";
|
|
5
8
|
export * from "./comment.js";
|
|
6
9
|
export * from "./emoji-pack.js";
|
|
10
|
+
export * from "./external-identities.js";
|
|
7
11
|
export * from "./favorite-emojis.js";
|
|
8
12
|
export * from "./file-metadata.js";
|
|
9
13
|
export * from "./git-grasp-list.js";
|
|
14
|
+
export * from "./git-issue.js";
|
|
10
15
|
export * from "./git-lists.js";
|
|
16
|
+
export * from "./git-patch.js";
|
|
17
|
+
export * from "./git-pull-request.js";
|
|
11
18
|
export * from "./git-repository.js";
|
|
19
|
+
export * from "./git-thread.js";
|
|
12
20
|
export * from "./groups.js";
|
|
13
21
|
export * from "./mutes.js";
|
|
22
|
+
export * from "./napplet.js";
|
|
23
|
+
export * from "./napplet-handlers.js";
|
|
14
24
|
export * from "./note.js";
|
|
15
25
|
export * from "./profile.js";
|
|
16
26
|
export * from "./profile-badges.js";
|
|
@@ -23,8 +33,10 @@ export * from "./share.js";
|
|
|
23
33
|
export * from "./stream.js";
|
|
24
34
|
export * from "./torrent.js";
|
|
25
35
|
export * from "./user.js";
|
|
36
|
+
export * from "./user-status.js";
|
|
26
37
|
export * from "./badge.js";
|
|
27
38
|
export * from "./badge-award.js";
|
|
28
39
|
export * from "./zap.js";
|
|
29
40
|
export * from "./trusted-assertions.js";
|
|
30
41
|
export * from "./zap-goal.js";
|
|
42
|
+
export * from "./nsite.js";
|
package/dist/casts/index.js
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
+
export * from "./app-handler.js";
|
|
2
|
+
export * from "./app-recommendation.js";
|
|
1
3
|
export * from "./article.js";
|
|
4
|
+
export * from "./forum-thread.js";
|
|
2
5
|
export * from "./bookmarks.js";
|
|
3
6
|
export * from "./cast.js";
|
|
4
7
|
export * from "./code-snippet.js";
|
|
5
8
|
export * from "./comment.js";
|
|
6
9
|
export * from "./emoji-pack.js";
|
|
10
|
+
export * from "./external-identities.js";
|
|
7
11
|
export * from "./favorite-emojis.js";
|
|
8
12
|
export * from "./file-metadata.js";
|
|
9
13
|
export * from "./git-grasp-list.js";
|
|
14
|
+
export * from "./git-issue.js";
|
|
10
15
|
export * from "./git-lists.js";
|
|
16
|
+
export * from "./git-patch.js";
|
|
17
|
+
export * from "./git-pull-request.js";
|
|
11
18
|
export * from "./git-repository.js";
|
|
19
|
+
export * from "./git-thread.js";
|
|
12
20
|
export * from "./groups.js";
|
|
13
21
|
export * from "./mutes.js";
|
|
22
|
+
export * from "./napplet.js";
|
|
23
|
+
export * from "./napplet-handlers.js";
|
|
14
24
|
export * from "./note.js";
|
|
15
25
|
export * from "./profile.js";
|
|
16
26
|
export * from "./profile-badges.js";
|
|
@@ -23,8 +33,10 @@ export * from "./share.js";
|
|
|
23
33
|
export * from "./stream.js";
|
|
24
34
|
export * from "./torrent.js";
|
|
25
35
|
export * from "./user.js";
|
|
36
|
+
export * from "./user-status.js";
|
|
26
37
|
export * from "./badge.js";
|
|
27
38
|
export * from "./badge-award.js";
|
|
28
39
|
export * from "./zap.js";
|
|
29
40
|
export * from "./trusted-assertions.js";
|
|
30
41
|
export * from "./zap-goal.js";
|
|
42
|
+
export * from "./nsite.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ChainableObservable } from "applesauce-core";
|
|
2
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
3
|
+
import { HiddenContentSigner } from "applesauce-core/helpers/hidden-content";
|
|
4
|
+
import { NappletHandlerCandidate, NappletHandlersEvent } from "../helpers/napplet-handlers.js";
|
|
5
|
+
import { CastRefEventStore, EventCast } from "./cast.js";
|
|
6
|
+
import { Napplet } from "./napplet.js";
|
|
7
|
+
/** Cast for napplet handler preferences (kind 31129) */
|
|
8
|
+
export declare class NappletHandlers extends EventCast<NappletHandlersEvent> {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
11
|
+
/** The archetype the preferences apply to */
|
|
12
|
+
get archetype(): string;
|
|
13
|
+
/** The public entries, which other users read as recommendations */
|
|
14
|
+
get publicEntries(): import("../helpers/napplet-handlers.js").NappletHandlerEntries;
|
|
15
|
+
/** The private entries if unlocked, otherwise undefined */
|
|
16
|
+
get hiddenEntries(): import("../helpers/napplet-handlers.js").NappletHandlerEntries | undefined;
|
|
17
|
+
/** An observable of the private entries that emits undefined until they are unlocked */
|
|
18
|
+
get hiddenEntries$(): ChainableObservable<import("../helpers/napplet-handlers.js").NappletHandlerEntries | undefined>;
|
|
19
|
+
/** Whether the event has encrypted private entries */
|
|
20
|
+
get hasHidden(): boolean;
|
|
21
|
+
/** Whether the private entries are unlocked */
|
|
22
|
+
get unlocked(): boolean;
|
|
23
|
+
/** Decrypts the private entries */
|
|
24
|
+
unlock(signer: HiddenContentSigner): Promise<import("../helpers/napplet-handlers.js").NappletHandlerEntries>;
|
|
25
|
+
/** Returns the handlers to try for an intent name or convention identity, in resolution order */
|
|
26
|
+
candidates(intent: string): NappletHandlerCandidate[];
|
|
27
|
+
/** Subscribes to the archetype-wide handlers, private entries first once unlocked */
|
|
28
|
+
get handlers$(): ChainableObservable<(Napplet | undefined)[]>;
|
|
29
|
+
/** Subscribes to the handler candidates for an intent name or convention identity, in resolution order */
|
|
30
|
+
candidates$(intent: string): ChainableObservable<(Napplet | undefined)[]>;
|
|
31
|
+
}
|
|
32
|
+
declare module "applesauce-core/casts" {
|
|
33
|
+
interface User {
|
|
34
|
+
/** Subscribes to the user's napplet handler preferences for every archetype */
|
|
35
|
+
get nappletHandlers$(): ChainableObservable<NappletHandlers[]>;
|
|
36
|
+
/** Subscribes to the user's own napplet handler preferences for an archetype */
|
|
37
|
+
nappletHandlers(archetype: string): ChainableObservable<NappletHandlers | undefined>;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { User } from "applesauce-core/casts/user";
|
|
2
|
+
import { hasHiddenTags } from "applesauce-core/helpers/hidden-tags";
|
|
3
|
+
import { watchEventUpdates } from "applesauce-core/observable";
|
|
4
|
+
import { combineLatest, map, of, switchMap } from "rxjs";
|
|
5
|
+
import { getHiddenNappletHandlers, getNappletHandlerCandidates, getNappletHandlersArchetype, getPublicNappletHandlers, isHiddenNappletHandlersUnlocked, isValidNappletHandlers, NAPPLET_HANDLERS_KIND, unlockHiddenNappletHandlers, } from "../helpers/napplet-handlers.js";
|
|
6
|
+
import { createNappletConvention } from "../helpers/napplet.js";
|
|
7
|
+
import { castEventStream, castTimelineStream } from "../observable/cast-stream.js";
|
|
8
|
+
import { EventCast } from "./cast.js";
|
|
9
|
+
import { Napplet, NappletSnapshot } from "./napplet.js";
|
|
10
|
+
/** Cast for napplet handler preferences (kind 31129) */
|
|
11
|
+
export class NappletHandlers extends EventCast {
|
|
12
|
+
constructor(event, store) {
|
|
13
|
+
if (!isValidNappletHandlers(event))
|
|
14
|
+
throw new Error("Invalid napplet handler preferences");
|
|
15
|
+
super(event, store);
|
|
16
|
+
}
|
|
17
|
+
/** The archetype the preferences apply to */
|
|
18
|
+
get archetype() {
|
|
19
|
+
return getNappletHandlersArchetype(this.event);
|
|
20
|
+
}
|
|
21
|
+
/** The public entries, which other users read as recommendations */
|
|
22
|
+
get publicEntries() {
|
|
23
|
+
return getPublicNappletHandlers(this.event);
|
|
24
|
+
}
|
|
25
|
+
/** The private entries if unlocked, otherwise undefined */
|
|
26
|
+
get hiddenEntries() {
|
|
27
|
+
return getHiddenNappletHandlers(this.event);
|
|
28
|
+
}
|
|
29
|
+
/** An observable of the private entries that emits undefined until they are unlocked */
|
|
30
|
+
get hiddenEntries$() {
|
|
31
|
+
return this.$$ref("hiddenEntries$", (store) => of(this.event).pipe(watchEventUpdates(store), map((event) => (event ? getHiddenNappletHandlers(event) : undefined))));
|
|
32
|
+
}
|
|
33
|
+
/** Whether the event has encrypted private entries */
|
|
34
|
+
get hasHidden() {
|
|
35
|
+
return hasHiddenTags(this.event);
|
|
36
|
+
}
|
|
37
|
+
/** Whether the private entries are unlocked */
|
|
38
|
+
get unlocked() {
|
|
39
|
+
return isHiddenNappletHandlersUnlocked(this.event);
|
|
40
|
+
}
|
|
41
|
+
/** Decrypts the private entries */
|
|
42
|
+
unlock(signer) {
|
|
43
|
+
return unlockHiddenNappletHandlers(this.event, signer);
|
|
44
|
+
}
|
|
45
|
+
/** Returns the handlers to try for an intent name or convention identity, in resolution order */
|
|
46
|
+
candidates(intent) {
|
|
47
|
+
return getNappletHandlerCandidates(this.event, this.#identity(intent));
|
|
48
|
+
}
|
|
49
|
+
/** Subscribes to the archetype-wide handlers, private entries first once unlocked */
|
|
50
|
+
get handlers$() {
|
|
51
|
+
return this.$$ref("handlers$", (store) => this.hiddenEntries$.pipe(map((hidden) => [...(hidden?.handlers ?? []), ...this.publicEntries.handlers]), switchMap((refs) => this.#napplets$(refs, store))));
|
|
52
|
+
}
|
|
53
|
+
/** Subscribes to the handler candidates for an intent name or convention identity, in resolution order */
|
|
54
|
+
candidates$(intent) {
|
|
55
|
+
const identity = this.#identity(intent);
|
|
56
|
+
return this.$$ref(`candidates$:${identity}`, (store) => this.hiddenEntries$.pipe(map(() => getNappletHandlerCandidates(this.event, identity).map((candidate) => candidate.ref)), switchMap((refs) => this.#napplets$(refs, store))));
|
|
57
|
+
}
|
|
58
|
+
/** Expands a bare intent name into a convention identity for this archetype */
|
|
59
|
+
#identity(intent) {
|
|
60
|
+
return intent.startsWith("napplet:") ? intent : createNappletConvention(this.archetype, intent);
|
|
61
|
+
}
|
|
62
|
+
/** Subscribes to the napplets for a list of references, in the same order */
|
|
63
|
+
#napplets$(refs, store) {
|
|
64
|
+
if (refs.length === 0)
|
|
65
|
+
return of([]);
|
|
66
|
+
return combineLatest(refs.map((ref) =>
|
|
67
|
+
// A pin only resolves to a snapshot, never to the napplet it derives from
|
|
68
|
+
ref.type === "snapshot"
|
|
69
|
+
? store.event(ref.pointer).pipe(castEventStream(NappletSnapshot, store))
|
|
70
|
+
: store.replaceable(ref.pointer).pipe(castEventStream(Napplet, store))));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
Object.defineProperty(User.prototype, "nappletHandlers$", {
|
|
74
|
+
get() {
|
|
75
|
+
return this.$$ref("nappletHandlers$", (store) => store
|
|
76
|
+
.timeline({ kinds: [NAPPLET_HANDLERS_KIND], authors: [this.pubkey] })
|
|
77
|
+
.pipe(castTimelineStream(NappletHandlers, store)));
|
|
78
|
+
},
|
|
79
|
+
configurable: true,
|
|
80
|
+
enumerable: false,
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(User.prototype, "nappletHandlers", {
|
|
83
|
+
value(archetype) {
|
|
84
|
+
return this.$$ref(`nappletHandlers:${archetype}`, (store) => store
|
|
85
|
+
.addressable({ kind: NAPPLET_HANDLERS_KIND, pubkey: this.pubkey, identifier: archetype })
|
|
86
|
+
.pipe(castEventStream(NappletHandlers, store)));
|
|
87
|
+
},
|
|
88
|
+
configurable: true,
|
|
89
|
+
enumerable: false,
|
|
90
|
+
writable: true,
|
|
91
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ChainableObservable } from "applesauce-core";
|
|
2
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
3
|
+
import { AddressPointer, EventPointer } from "applesauce-core/helpers/pointers";
|
|
4
|
+
import { Observable } from "rxjs";
|
|
5
|
+
import { NamedNappletEvent, NappletEvent, NappletSnapshotEvent, RootNappletEvent } from "../helpers/napplet.js";
|
|
6
|
+
import { CastRefEventStore, EventCast } from "./cast.js";
|
|
7
|
+
import { Comment } from "./comment.js";
|
|
8
|
+
import { Reaction } from "./reaction.js";
|
|
9
|
+
import { Share } from "./share.js";
|
|
10
|
+
import { Zap } from "./zap.js";
|
|
11
|
+
/** Cast for any NIP-5D napplet manifest (kinds 5129, 15129 and 35129) */
|
|
12
|
+
export declare class Napplet<T extends NappletEvent = NappletEvent> extends EventCast<T> {
|
|
13
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
14
|
+
/** The sha256 of the napplet `index.html` artifact */
|
|
15
|
+
get artifactHash(): string;
|
|
16
|
+
/** The plain-text description of the napplet */
|
|
17
|
+
get description(): string;
|
|
18
|
+
/** The short display label */
|
|
19
|
+
get title(): string | undefined;
|
|
20
|
+
/** The archetypes the napplet advertises */
|
|
21
|
+
get archetypes(): string[];
|
|
22
|
+
/** The intents the napplet accepts */
|
|
23
|
+
get intents(): import("../helpers/napplet.js").NappletIntent[];
|
|
24
|
+
/** The NAP domains required for full functionality */
|
|
25
|
+
get requiredDomains(): string[];
|
|
26
|
+
/** The optional NAP domains */
|
|
27
|
+
get optionalDomains(): string[];
|
|
28
|
+
/** The content-addressed icon, if valid */
|
|
29
|
+
get icon(): import("../helpers/napplet.js").NappletIcon | undefined;
|
|
30
|
+
/** The Blossom server hints for the artifact and icon blobs */
|
|
31
|
+
get servers(): string[];
|
|
32
|
+
/** The source URL */
|
|
33
|
+
get source(): string | undefined;
|
|
34
|
+
/** Whether this is a kind 5129 snapshot */
|
|
35
|
+
get isSnapshot(): boolean;
|
|
36
|
+
/** Whether this is a kind 15129 root napplet */
|
|
37
|
+
get isRoot(): boolean;
|
|
38
|
+
/** Whether this is a kind 35129 named napplet */
|
|
39
|
+
get isNamed(): boolean;
|
|
40
|
+
/** An address pointer for root and named napplets, or an event pointer for snapshots */
|
|
41
|
+
get pointer(): AddressPointer | EventPointer;
|
|
42
|
+
/** An observable of the pointer with relay hints from the authors outboxes */
|
|
43
|
+
get pointer$(): Observable<AddressPointer | EventPointer>;
|
|
44
|
+
/** The NIP-19 naddr, or nevent for snapshots */
|
|
45
|
+
get address(): string;
|
|
46
|
+
/** An observable of the NIP-19 address with relay hints from the authors outboxes */
|
|
47
|
+
get address$(): Observable<string>;
|
|
48
|
+
/** Subscribes to the NIP-22 comments on this napplet */
|
|
49
|
+
get comments$(): ChainableObservable<Comment[]>;
|
|
50
|
+
/** Subscribes to the reactions to this napplet */
|
|
51
|
+
get reactions$(): ChainableObservable<Reaction[]>;
|
|
52
|
+
/** Subscribes to the zaps of this napplet */
|
|
53
|
+
get zaps$(): ChainableObservable<Zap[]>;
|
|
54
|
+
/** Subscribes to the shares of this napplet */
|
|
55
|
+
get shares$(): ChainableObservable<Share[]>;
|
|
56
|
+
}
|
|
57
|
+
/** Base class for root and named napplets that snapshots can derive from */
|
|
58
|
+
declare class AddressableNapplet<T extends RootNappletEvent | NamedNappletEvent> extends Napplet<T> {
|
|
59
|
+
/** The `kind:pubkey:identifier` address used by snapshot `a` and `A` tags */
|
|
60
|
+
get coordinate(): string;
|
|
61
|
+
/** Subscribes to the snapshots that derive directly from this napplet */
|
|
62
|
+
get snapshots$(): ChainableObservable<NappletSnapshot[]>;
|
|
63
|
+
/** Subscribes to every snapshot whose lineage originates from this napplet */
|
|
64
|
+
get lineage$(): ChainableObservable<NappletSnapshot[]>;
|
|
65
|
+
}
|
|
66
|
+
/** Cast for a NIP-5D root napplet (kind 15129) */
|
|
67
|
+
export declare class RootNapplet extends AddressableNapplet<RootNappletEvent> {
|
|
68
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
69
|
+
}
|
|
70
|
+
/** Cast for a NIP-5D named napplet (kind 35129) */
|
|
71
|
+
export declare class NamedNapplet extends AddressableNapplet<NamedNappletEvent> {
|
|
72
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
73
|
+
/** The `d` tag identifier of the napplet */
|
|
74
|
+
get identifier(): string;
|
|
75
|
+
}
|
|
76
|
+
/** Cast for a NIP-5D napplet snapshot (kind 5129) */
|
|
77
|
+
export declare class NappletSnapshot extends Napplet<NappletSnapshotEvent> {
|
|
78
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
79
|
+
/** The address of the napplet this snapshot derives from */
|
|
80
|
+
get parentPointer(): AddressPointer | undefined;
|
|
81
|
+
/** The address of the root napplet this snapshot's lineage originates from */
|
|
82
|
+
get rootPointer(): AddressPointer | undefined;
|
|
83
|
+
/** Subscribes to the napplet this snapshot derives from */
|
|
84
|
+
get parent$(): ChainableObservable<Napplet | undefined>;
|
|
85
|
+
/** Alias for {@link parent$} */
|
|
86
|
+
get upstream$(): ChainableObservable<Napplet<NappletEvent> | undefined>;
|
|
87
|
+
/** Subscribes to the root napplet this snapshot's lineage originates from */
|
|
88
|
+
get root$(): ChainableObservable<Napplet | undefined>;
|
|
89
|
+
}
|
|
90
|
+
declare module "applesauce-core/casts" {
|
|
91
|
+
interface User {
|
|
92
|
+
/** Subscribes to the user's root and named napplets */
|
|
93
|
+
get napplets$(): ChainableObservable<Napplet[]>;
|
|
94
|
+
/** Subscribes to the user's root (kind 15129) napplet */
|
|
95
|
+
get napplet$(): ChainableObservable<RootNapplet | undefined>;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export {};
|