applesauce-common 6.0.2 → 6.2.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/dist/casts/_circular-import.d.ts +2 -0
- package/dist/casts/_circular-import.js +2 -0
- package/dist/casts/git-grasp-list.d.ts +8 -0
- package/dist/casts/git-grasp-list.js +13 -0
- package/dist/casts/git-lists.d.ts +42 -0
- package/dist/casts/git-lists.js +94 -0
- package/dist/casts/git-repository.d.ts +29 -0
- package/dist/casts/git-repository.js +68 -0
- package/dist/casts/index.d.ts +3 -0
- package/dist/casts/index.js +3 -0
- package/dist/casts/reaction.d.ts +3 -1
- package/dist/casts/reaction.js +6 -2
- package/dist/casts/relay-lists.d.ts +6 -2
- package/dist/casts/relay-lists.js +11 -2
- package/dist/casts/trusted-assertions.d.ts +2 -2
- package/dist/casts/trusted-assertions.js +1 -1
- package/dist/casts/user.d.ts +4 -0
- package/dist/casts/user.js +23 -1
- package/dist/factories/calendar-event.d.ts +0 -5
- package/dist/factories/calendar-event.js +0 -9
- package/dist/factories/calendar-rsvp.d.ts +1 -0
- package/dist/factories/calendar-rsvp.js +1 -0
- package/dist/factories/code-snippet.d.ts +0 -2
- package/dist/factories/code-snippet.js +0 -5
- package/dist/factories/comment.d.ts +0 -2
- package/dist/factories/comment.js +5 -8
- package/dist/factories/favorite-git-repos.d.ts +17 -0
- package/dist/factories/favorite-git-repos.js +43 -0
- package/dist/factories/gift-wrap.js +2 -2
- package/dist/factories/git-authors.d.ts +17 -0
- package/dist/factories/git-authors.js +24 -0
- package/dist/factories/git-grasp-list.d.ts +14 -0
- package/dist/factories/git-grasp-list.js +25 -0
- package/dist/factories/git-repository.d.ts +51 -0
- package/dist/factories/git-repository.js +96 -0
- package/dist/factories/group.d.ts +5 -7
- package/dist/factories/group.js +8 -14
- package/dist/factories/highlight.d.ts +1 -10
- package/dist/factories/highlight.js +2 -12
- package/dist/factories/index.d.ts +6 -4
- package/dist/factories/index.js +6 -4
- package/dist/factories/legacy-message.d.ts +0 -1
- package/dist/factories/list.d.ts +0 -10
- package/dist/factories/list.js +0 -21
- package/dist/factories/nostr-web-token.d.ts +39 -0
- package/dist/factories/nostr-web-token.js +95 -0
- package/dist/factories/picture-post.d.ts +3 -4
- package/dist/factories/picture-post.js +3 -7
- package/dist/factories/poll-response.d.ts +0 -2
- package/dist/factories/poll-response.js +0 -5
- package/dist/factories/poll.d.ts +9 -6
- package/dist/factories/poll.js +12 -9
- package/dist/factories/relay-lists.d.ts +46 -0
- package/dist/factories/relay-lists.js +93 -0
- package/dist/factories/relay-set.d.ts +1 -1
- package/dist/factories/relay-set.js +1 -1
- package/dist/factories/share.d.ts +0 -7
- package/dist/factories/share.js +0 -11
- package/dist/factories/stream-chat-message.d.ts +0 -3
- package/dist/factories/stream-chat-message.js +0 -5
- package/dist/factories/torrent.d.ts +0 -2
- package/dist/factories/torrent.js +0 -5
- package/dist/factories/zap-goal.d.ts +0 -2
- package/dist/factories/zap-goal.js +0 -5
- package/dist/helpers/external-id.d.ts +1 -0
- package/dist/helpers/external-id.js +8 -27
- package/dist/helpers/git-grasp-list.d.ts +8 -0
- package/dist/helpers/git-grasp-list.js +15 -0
- package/dist/helpers/git-lists.d.ts +20 -0
- package/dist/helpers/git-lists.js +28 -0
- package/dist/helpers/git-repository.d.ts +39 -0
- package/dist/helpers/git-repository.js +104 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/index.js +4 -0
- package/dist/helpers/nostr-web-token.d.ts +54 -0
- package/dist/helpers/nostr-web-token.js +124 -0
- package/dist/helpers/relay-list.d.ts +5 -0
- package/dist/helpers/relay-list.js +8 -0
- package/dist/observable/cast-stream.d.ts +1 -8
- package/dist/observable/cast-stream.js +2 -29
- package/dist/observable/chainable.d.ts +1 -1
- package/dist/observable/chainable.js +1 -1
- package/dist/operations/git-grasp-list.d.ts +7 -0
- package/dist/operations/git-grasp-list.js +18 -0
- package/dist/operations/git-repository.d.ts +45 -0
- package/dist/operations/git-repository.js +160 -0
- package/dist/operations/hashtags.d.ts +2 -0
- package/dist/operations/hashtags.js +7 -0
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +3 -0
- package/dist/operations/nostr-web-token.d.ts +27 -0
- package/dist/operations/nostr-web-token.js +58 -0
- package/dist/operations/poll.d.ts +3 -2
- package/dist/operations/poll.js +4 -3
- package/package.json +4 -4
- package/dist/factories/blocked-relays.d.ts +0 -10
- package/dist/factories/blocked-relays.js +0 -16
- package/dist/factories/dm-relays.d.ts +0 -10
- package/dist/factories/dm-relays.js +0 -16
- package/dist/factories/favorite-relays.d.ts +0 -16
- package/dist/factories/favorite-relays.js +0 -31
- package/dist/factories/search-relays.d.ts +0 -10
- package/dist/factories/search-relays.js +0 -16
|
@@ -2,6 +2,8 @@ export * from "./profile.js";
|
|
|
2
2
|
export * from "./mutes.js";
|
|
3
3
|
export * from "./bookmarks.js";
|
|
4
4
|
export * from "./favorite-emojis.js";
|
|
5
|
+
export * from "./git-grasp-list.js";
|
|
6
|
+
export * from "./git-lists.js";
|
|
5
7
|
export * from "./relay-lists.js";
|
|
6
8
|
export * from "./groups.js";
|
|
7
9
|
export * from "./trusted-assertions.js";
|
|
@@ -4,6 +4,8 @@ export * from "./profile.js";
|
|
|
4
4
|
export * from "./mutes.js";
|
|
5
5
|
export * from "./bookmarks.js";
|
|
6
6
|
export * from "./favorite-emojis.js";
|
|
7
|
+
export * from "./git-grasp-list.js";
|
|
8
|
+
export * from "./git-lists.js";
|
|
7
9
|
export * from "./relay-lists.js";
|
|
8
10
|
export * from "./groups.js";
|
|
9
11
|
export * from "./trusted-assertions.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
2
|
+
import { GitGraspListEvent } from "../helpers/git-grasp-list.js";
|
|
3
|
+
import { CastRefEventStore, EventCast } from "./cast.js";
|
|
4
|
+
/** Cast for NIP-34 user grasp server lists. */
|
|
5
|
+
export declare class GitGraspList extends EventCast<GitGraspListEvent> {
|
|
6
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
7
|
+
get servers(): string[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getGitGraspServers, isValidGitGraspList } from "../helpers/git-grasp-list.js";
|
|
2
|
+
import { EventCast } from "./cast.js";
|
|
3
|
+
/** Cast for NIP-34 user grasp server lists. */
|
|
4
|
+
export class GitGraspList extends EventCast {
|
|
5
|
+
constructor(event, store) {
|
|
6
|
+
if (!isValidGitGraspList(event))
|
|
7
|
+
throw new Error("Invalid git grasp list event");
|
|
8
|
+
super(event, store);
|
|
9
|
+
}
|
|
10
|
+
get servers() {
|
|
11
|
+
return getGitGraspServers(this.event);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { HiddenContentSigner, NostrEvent } from "applesauce-core/helpers";
|
|
2
|
+
import { FavoriteGitReposListEvent, GitAuthorsListEvent } from "../helpers/git-lists.js";
|
|
3
|
+
import { CastRefEventStore, EventCast } from "./cast.js";
|
|
4
|
+
import { GitRepository } from "./git-repository.js";
|
|
5
|
+
/** Class for git authors lists (kind 10017) */
|
|
6
|
+
export declare class GitAuthors extends EventCast<GitAuthorsListEvent> {
|
|
7
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
8
|
+
/** The public git authors in the list */
|
|
9
|
+
get authors(): import("nostr-tools/nip19").ProfilePointer[];
|
|
10
|
+
/** The public git author pubkeys in the list */
|
|
11
|
+
get pubkeys(): string[];
|
|
12
|
+
/** The unlocked hidden git authors in the list */
|
|
13
|
+
get hidden(): import("nostr-tools/nip19").ProfilePointer[];
|
|
14
|
+
/** An observable that updates when the hidden authors are unlocked */
|
|
15
|
+
get hidden$(): import("applesauce-core").ChainableObservable<import("nostr-tools/nip19").ProfilePointer[]>;
|
|
16
|
+
/** Whether the list has hidden authors */
|
|
17
|
+
get hasHidden(): boolean;
|
|
18
|
+
/** Whether the list is unlocked */
|
|
19
|
+
get unlocked(): boolean;
|
|
20
|
+
/** Unlocks the hidden authors on the list */
|
|
21
|
+
unlock(signer: HiddenContentSigner): Promise<import("nostr-tools/nip19").ProfilePointer[]>;
|
|
22
|
+
}
|
|
23
|
+
/** Class for git repositories lists (kind 10018) */
|
|
24
|
+
export declare class FavoriteGitRepos extends EventCast<FavoriteGitReposListEvent> {
|
|
25
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
26
|
+
/** The public NIP-34 repository address pointers in the list */
|
|
27
|
+
get repositoryPointers(): import("../helpers/git-repository.js").GitRepositoryPointer[];
|
|
28
|
+
/** Returns an observable of {@link GitRepository} casts for the public pointers as they resolve in the store */
|
|
29
|
+
get repositories$(): import("applesauce-core").ChainableObservable<(GitRepository | undefined)[]>;
|
|
30
|
+
/** The unlocked hidden NIP-34 repository address pointers in the list */
|
|
31
|
+
get hidden(): import("../helpers/git-repository.js").GitRepositoryPointer[];
|
|
32
|
+
/** Returns an observable of the hidden repository pointers as they resolve in the store */
|
|
33
|
+
get hiddenPointers$(): import("applesauce-core").ChainableObservable<import("../helpers/git-repository.js").GitRepositoryPointer[]>;
|
|
34
|
+
/** Returns an observable of {@link GitRepository} casts for the hidden pointers as they resolve in the store */
|
|
35
|
+
get hiddenRepositories$(): import("applesauce-core").ChainableObservable<(GitRepository | undefined)[]>;
|
|
36
|
+
/** Whether the list has hidden repositories */
|
|
37
|
+
get hasHidden(): boolean;
|
|
38
|
+
/** Whether the list is unlocked */
|
|
39
|
+
get unlocked(): boolean;
|
|
40
|
+
/** Unlocks the hidden repositories on the list */
|
|
41
|
+
unlock(signer: HiddenContentSigner): Promise<import("../helpers/git-repository.js").GitRepositoryPointer[]>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defined, watchEventUpdates } from "applesauce-core";
|
|
2
|
+
import { addRelayHintsToPointer, hasHiddenTags, isHiddenTagsUnlocked, unlockHiddenTags, } from "applesauce-core/helpers";
|
|
3
|
+
import { combineLatest, map, of, switchMap } from "rxjs";
|
|
4
|
+
import { getFavoriteGitReposPointers, getGitAuthors, isValidFavoriteGitReposList, isValidGitAuthorsList, } from "../helpers/git-lists.js";
|
|
5
|
+
import { castEventStream } from "../observable/cast-stream.js";
|
|
6
|
+
import { EventCast } from "./cast.js";
|
|
7
|
+
import { GitRepository } from "./git-repository.js";
|
|
8
|
+
/** Class for git authors lists (kind 10017) */
|
|
9
|
+
export class GitAuthors extends EventCast {
|
|
10
|
+
constructor(event, store) {
|
|
11
|
+
if (!isValidGitAuthorsList(event))
|
|
12
|
+
throw new Error("Invalid git authors list");
|
|
13
|
+
super(event, store);
|
|
14
|
+
}
|
|
15
|
+
/** The public git authors in the list */
|
|
16
|
+
get authors() {
|
|
17
|
+
return getGitAuthors(this.event);
|
|
18
|
+
}
|
|
19
|
+
/** The public git author pubkeys in the list */
|
|
20
|
+
get pubkeys() {
|
|
21
|
+
return this.authors.map((author) => author.pubkey);
|
|
22
|
+
}
|
|
23
|
+
/** The unlocked hidden git authors in the list */
|
|
24
|
+
get hidden() {
|
|
25
|
+
return getGitAuthors(this.event, "hidden");
|
|
26
|
+
}
|
|
27
|
+
/** An observable that updates when the hidden authors are unlocked */
|
|
28
|
+
get hidden$() {
|
|
29
|
+
return this.$$ref("hidden$", (store) => of(this.event).pipe(watchEventUpdates(store), map((event) => event && getGitAuthors(event, "hidden")), defined()));
|
|
30
|
+
}
|
|
31
|
+
/** Whether the list has hidden authors */
|
|
32
|
+
get hasHidden() {
|
|
33
|
+
return hasHiddenTags(this.event);
|
|
34
|
+
}
|
|
35
|
+
/** Whether the list is unlocked */
|
|
36
|
+
get unlocked() {
|
|
37
|
+
return isHiddenTagsUnlocked(this.event);
|
|
38
|
+
}
|
|
39
|
+
/** Unlocks the hidden authors on the list */
|
|
40
|
+
async unlock(signer) {
|
|
41
|
+
await unlockHiddenTags(this.event, signer);
|
|
42
|
+
return this.hidden;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Class for git repositories lists (kind 10018) */
|
|
46
|
+
export class FavoriteGitRepos extends EventCast {
|
|
47
|
+
constructor(event, store) {
|
|
48
|
+
if (!isValidFavoriteGitReposList(event))
|
|
49
|
+
throw new Error("Invalid git repositories list");
|
|
50
|
+
super(event, store);
|
|
51
|
+
}
|
|
52
|
+
/** The public NIP-34 repository address pointers in the list */
|
|
53
|
+
get repositoryPointers() {
|
|
54
|
+
return getFavoriteGitReposPointers(this.event);
|
|
55
|
+
}
|
|
56
|
+
/** Returns an observable of {@link GitRepository} casts for the public pointers as they resolve in the store */
|
|
57
|
+
get repositories$() {
|
|
58
|
+
return this.$$ref("repositories$", (store) => this.author.mailboxes$.pipe(switchMap((mailboxes) => combineLatest(this.repositoryPointers.map((pointer) => store
|
|
59
|
+
.replaceable(
|
|
60
|
+
// Add outbox relay hints to point if available
|
|
61
|
+
mailboxes?.outboxes ? addRelayHintsToPointer(pointer, mailboxes?.outboxes) : pointer)
|
|
62
|
+
// Cast all events to GitRepositories
|
|
63
|
+
.pipe(castEventStream(GitRepository, store)))))));
|
|
64
|
+
}
|
|
65
|
+
/** The unlocked hidden NIP-34 repository address pointers in the list */
|
|
66
|
+
get hidden() {
|
|
67
|
+
return getFavoriteGitReposPointers(this.event, "hidden");
|
|
68
|
+
}
|
|
69
|
+
/** Returns an observable of the hidden repository pointers as they resolve in the store */
|
|
70
|
+
get hiddenPointers$() {
|
|
71
|
+
return this.$$ref("hiddenPointers$", (store) => of(this.event).pipe(watchEventUpdates(store), map((event) => event && getFavoriteGitReposPointers(event, "hidden")), defined()));
|
|
72
|
+
}
|
|
73
|
+
/** Returns an observable of {@link GitRepository} casts for the hidden pointers as they resolve in the store */
|
|
74
|
+
get hiddenRepositories$() {
|
|
75
|
+
return this.$$ref("hiddenRepositories$", (store) => combineLatest([this.author.mailboxes$, this.hiddenPointers$]).pipe(switchMap(([mailboxes, pointers]) => combineLatest(pointers.map((pointer) => store
|
|
76
|
+
// Add outbox relay hints to point if available
|
|
77
|
+
.replaceable(mailboxes?.outboxes ? addRelayHintsToPointer(pointer, mailboxes?.outboxes) : pointer)
|
|
78
|
+
// Cast the event to a GitRepository
|
|
79
|
+
.pipe(castEventStream(GitRepository, store)))))));
|
|
80
|
+
}
|
|
81
|
+
/** Whether the list has hidden repositories */
|
|
82
|
+
get hasHidden() {
|
|
83
|
+
return hasHiddenTags(this.event);
|
|
84
|
+
}
|
|
85
|
+
/** Whether the list is unlocked */
|
|
86
|
+
get unlocked() {
|
|
87
|
+
return isHiddenTagsUnlocked(this.event);
|
|
88
|
+
}
|
|
89
|
+
/** Unlocks the hidden repositories on the list */
|
|
90
|
+
async unlock(signer) {
|
|
91
|
+
await unlockHiddenTags(this.event, signer);
|
|
92
|
+
return this.hidden;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChainableObservable } from "applesauce-core";
|
|
2
|
+
import { User } from "applesauce-core/casts/user";
|
|
3
|
+
import { NostrEvent } from "applesauce-core/helpers/event";
|
|
4
|
+
import { GitRepositoryEvent, GitRepositoryPointer } from "../helpers/git-repository.js";
|
|
5
|
+
import { CastRefEventStore, EventCast } from "./cast.js";
|
|
6
|
+
import { Reaction } from "./reaction.js";
|
|
7
|
+
/** Cast for NIP-34 repository announcement events. */
|
|
8
|
+
export declare class GitRepository extends EventCast<GitRepositoryEvent> {
|
|
9
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
10
|
+
get identifier(): string;
|
|
11
|
+
get pointer(): GitRepositoryPointer;
|
|
12
|
+
get name(): string | undefined;
|
|
13
|
+
get description(): string | undefined;
|
|
14
|
+
get webUrls(): string[];
|
|
15
|
+
get cloneUrls(): string[];
|
|
16
|
+
get relays(): string[];
|
|
17
|
+
get earliestUniqueCommit(): string | undefined;
|
|
18
|
+
get maintainers(): User[];
|
|
19
|
+
get maintainerPubkeys(): string[];
|
|
20
|
+
get hashtags(): string[];
|
|
21
|
+
/** Pointer to the upstream repository this one was forked from, if declared. */
|
|
22
|
+
get upstream(): GitRepositoryPointer | undefined;
|
|
23
|
+
/** Subscribes the upstream {@link GitRepository} if there is one, otherwise `undefined`. */
|
|
24
|
+
get upstream$(): ChainableObservable<GitRepository | undefined>;
|
|
25
|
+
/** Returns a timeline of users who have favorited this git repository */
|
|
26
|
+
get followers$(): ChainableObservable<User[]>;
|
|
27
|
+
/** Returns a timeline of all reactions to this git repository */
|
|
28
|
+
get reactions$(): ChainableObservable<Reaction[]>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { castUser } from "applesauce-core";
|
|
2
|
+
import { getAddressPointerForEvent } from "applesauce-core/helpers";
|
|
3
|
+
import { castEventStream, castTimelineStream } from "applesauce-core/observable/cast-stream";
|
|
4
|
+
import { map, of } from "rxjs";
|
|
5
|
+
import { FAVORITE_GIT_REPOS_KIND } from "../helpers/git-lists.js";
|
|
6
|
+
import { getGitRepositoryCloneUrls, getGitRepositoryDescription, getGitRepositoryEarliestUniqueCommit, getGitRepositoryHashtags, getGitRepositoryIdentifier, getGitRepositoryMaintainers, getGitRepositoryName, getGitRepositoryRelays, getGitRepositoryUpstream, getGitRepositoryWebUrls, isValidGitRepository, } from "../helpers/git-repository.js";
|
|
7
|
+
import { ReactionsModel } from "../models/reactions.js";
|
|
8
|
+
import { EventCast } from "./cast.js";
|
|
9
|
+
import { Reaction } from "./reaction.js";
|
|
10
|
+
/** Cast for NIP-34 repository announcement events. */
|
|
11
|
+
export class GitRepository extends EventCast {
|
|
12
|
+
constructor(event, store) {
|
|
13
|
+
if (!isValidGitRepository(event))
|
|
14
|
+
throw new Error("Invalid git repository announcement event");
|
|
15
|
+
super(event, store);
|
|
16
|
+
}
|
|
17
|
+
get identifier() {
|
|
18
|
+
return getGitRepositoryIdentifier(this.event);
|
|
19
|
+
}
|
|
20
|
+
get pointer() {
|
|
21
|
+
return getAddressPointerForEvent(this.event);
|
|
22
|
+
}
|
|
23
|
+
get name() {
|
|
24
|
+
return getGitRepositoryName(this.event);
|
|
25
|
+
}
|
|
26
|
+
get description() {
|
|
27
|
+
return getGitRepositoryDescription(this.event);
|
|
28
|
+
}
|
|
29
|
+
get webUrls() {
|
|
30
|
+
return getGitRepositoryWebUrls(this.event);
|
|
31
|
+
}
|
|
32
|
+
get cloneUrls() {
|
|
33
|
+
return getGitRepositoryCloneUrls(this.event);
|
|
34
|
+
}
|
|
35
|
+
get relays() {
|
|
36
|
+
return getGitRepositoryRelays(this.event);
|
|
37
|
+
}
|
|
38
|
+
get earliestUniqueCommit() {
|
|
39
|
+
return getGitRepositoryEarliestUniqueCommit(this.event);
|
|
40
|
+
}
|
|
41
|
+
get maintainers() {
|
|
42
|
+
return this.maintainerPubkeys.map((pubkey) => castUser(pubkey, this.store));
|
|
43
|
+
}
|
|
44
|
+
get maintainerPubkeys() {
|
|
45
|
+
return getGitRepositoryMaintainers(this.event);
|
|
46
|
+
}
|
|
47
|
+
get hashtags() {
|
|
48
|
+
return getGitRepositoryHashtags(this.event);
|
|
49
|
+
}
|
|
50
|
+
/** Pointer to the upstream repository this one was forked from, if declared. */
|
|
51
|
+
get upstream() {
|
|
52
|
+
return getGitRepositoryUpstream(this.event);
|
|
53
|
+
}
|
|
54
|
+
/** Subscribes the upstream {@link GitRepository} if there is one, otherwise `undefined`. */
|
|
55
|
+
get upstream$() {
|
|
56
|
+
return this.$$ref("upstream$", (store) => this.upstream ? store.replaceable(this.upstream).pipe(castEventStream(GitRepository)) : of(undefined));
|
|
57
|
+
}
|
|
58
|
+
/** Returns a timeline of users who have favorited this git repository */
|
|
59
|
+
get followers$() {
|
|
60
|
+
return this.$$ref("followers$", (store) => store
|
|
61
|
+
.timeline({ kinds: [FAVORITE_GIT_REPOS_KIND], "#a": [this.coordinate] })
|
|
62
|
+
.pipe(map((events) => events.map((event) => castUser(event, store)))));
|
|
63
|
+
}
|
|
64
|
+
/** Returns a timeline of all reactions to this git repository */
|
|
65
|
+
get reactions$() {
|
|
66
|
+
return this.$$ref("reactions$", (store) => store.model(ReactionsModel, this.event).pipe(castTimelineStream(Reaction, store)));
|
|
67
|
+
}
|
|
68
|
+
}
|
package/dist/casts/index.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ export * from "./comment.js";
|
|
|
6
6
|
export * from "./emoji-pack.js";
|
|
7
7
|
export * from "./favorite-emojis.js";
|
|
8
8
|
export * from "./file-metadata.js";
|
|
9
|
+
export * from "./git-grasp-list.js";
|
|
10
|
+
export * from "./git-lists.js";
|
|
11
|
+
export * from "./git-repository.js";
|
|
9
12
|
export * from "./groups.js";
|
|
10
13
|
export * from "./mutes.js";
|
|
11
14
|
export * from "./note.js";
|
package/dist/casts/index.js
CHANGED
|
@@ -6,6 +6,9 @@ export * from "./comment.js";
|
|
|
6
6
|
export * from "./emoji-pack.js";
|
|
7
7
|
export * from "./favorite-emojis.js";
|
|
8
8
|
export * from "./file-metadata.js";
|
|
9
|
+
export * from "./git-grasp-list.js";
|
|
10
|
+
export * from "./git-lists.js";
|
|
11
|
+
export * from "./git-repository.js";
|
|
9
12
|
export * from "./groups.js";
|
|
10
13
|
export * from "./mutes.js";
|
|
11
14
|
export * from "./note.js";
|
package/dist/casts/reaction.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ export declare class Reaction extends EventCast<KnownEvent<7>> {
|
|
|
11
11
|
/** Get the address pointer for the event being reacted to (for replaceable events) */
|
|
12
12
|
get addressPointer(): import("nostr-tools/nip19").AddressPointer | undefined;
|
|
13
13
|
/** Get the pointer (event or address) for the event being reacted to */
|
|
14
|
-
get
|
|
14
|
+
get reactedPointer(): import("nostr-tools/nip19").EventPointer | import("nostr-tools/nip19").AddressPointer | undefined;
|
|
15
15
|
/** Get the event that this reaction is reacting to */
|
|
16
16
|
get reactedTo$(): import("applesauce-core").ChainableObservable<NostrEvent | undefined>;
|
|
17
|
+
/** Alias for {@link reactedTo$} */
|
|
18
|
+
get reactedEvent$(): import("applesauce-core").ChainableObservable<NostrEvent | undefined>;
|
|
17
19
|
}
|
package/dist/casts/reaction.js
CHANGED
|
@@ -30,17 +30,21 @@ export class Reaction extends EventCast {
|
|
|
30
30
|
return getReactionAddressPointer(this.event);
|
|
31
31
|
}
|
|
32
32
|
/** Get the pointer (event or address) for the event being reacted to */
|
|
33
|
-
get
|
|
33
|
+
get reactedPointer() {
|
|
34
34
|
return this.addressPointer || this.eventPointer;
|
|
35
35
|
}
|
|
36
36
|
/** Get the event that this reaction is reacting to */
|
|
37
37
|
get reactedTo$() {
|
|
38
38
|
return this.$$ref("reactedTo$", (store) => {
|
|
39
|
-
const pointer = this.
|
|
39
|
+
const pointer = this.reactedPointer;
|
|
40
40
|
if (!pointer)
|
|
41
41
|
return of(undefined);
|
|
42
42
|
else
|
|
43
43
|
return store.event(addRelayHintsToPointer(pointer, this.seen));
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
+
/** Alias for {@link reactedTo$} */
|
|
47
|
+
get reactedEvent$() {
|
|
48
|
+
return this.reactedTo$;
|
|
49
|
+
}
|
|
46
50
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HiddenContentSigner } from "applesauce-core/helpers";
|
|
2
2
|
import { kinds, KnownEvent, NostrEvent } from "applesauce-core/helpers/event";
|
|
3
|
-
import { BlockedRelaysListEvent, FAVORITE_RELAYS_KIND, FavoriteRelaysListEvent, SearchRelaysListEvent } from "../helpers/relay-list.js";
|
|
3
|
+
import { BlockedRelaysListEvent, FAVORITE_RELAYS_KIND, FavoriteRelaysListEvent, LOOKUP_RELAY_LIST_KIND, LookupRelayListEvent, SearchRelaysListEvent } from "../helpers/relay-list.js";
|
|
4
4
|
import { CastRefEventStore, EventCast } from "./cast.js";
|
|
5
5
|
/** Base class for relay lists */
|
|
6
|
-
declare class RelayListBase<T extends KnownEvent<typeof FAVORITE_RELAYS_KIND | typeof kinds.SearchRelaysList | kinds.BlockedRelaysList>> extends EventCast<T> {
|
|
6
|
+
declare class RelayListBase<T extends KnownEvent<typeof FAVORITE_RELAYS_KIND | typeof kinds.SearchRelaysList | kinds.BlockedRelaysList | typeof LOOKUP_RELAY_LIST_KIND>> extends EventCast<T> {
|
|
7
7
|
constructor(event: T, store: CastRefEventStore);
|
|
8
8
|
/** The public relays in the relay list */
|
|
9
9
|
get relays(): string[];
|
|
@@ -30,4 +30,8 @@ export declare class SearchRelays extends RelayListBase<SearchRelaysListEvent> {
|
|
|
30
30
|
export declare class BlockedRelays extends RelayListBase<BlockedRelaysListEvent> {
|
|
31
31
|
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
32
32
|
}
|
|
33
|
+
/** Class for lookup / indexer relays lists (kind 10086) */
|
|
34
|
+
export declare class LookupRelayList extends RelayListBase<LookupRelayListEvent> {
|
|
35
|
+
constructor(event: NostrEvent, store: CastRefEventStore);
|
|
36
|
+
}
|
|
33
37
|
export {};
|
|
@@ -3,14 +3,15 @@ import { hasHiddenTags, isHiddenTagsUnlocked, unlockHiddenTags } from "applesauc
|
|
|
3
3
|
import { kinds } from "applesauce-core/helpers/event";
|
|
4
4
|
import { map, of } from "rxjs";
|
|
5
5
|
import { getRelaysFromList } from "../helpers/lists.js";
|
|
6
|
-
import { FAVORITE_RELAYS_KIND, isValidBlockedRelaysList, isValidFavoriteRelaysList, isValidSearchRelaysList, } from "../helpers/relay-list.js";
|
|
6
|
+
import { FAVORITE_RELAYS_KIND, isValidBlockedRelaysList, isValidFavoriteRelaysList, isValidLookupRelayList, isValidSearchRelaysList, LOOKUP_RELAY_LIST_KIND, } from "../helpers/relay-list.js";
|
|
7
7
|
import { EventCast } from "./cast.js";
|
|
8
8
|
/** Base class for relay lists */
|
|
9
9
|
class RelayListBase extends EventCast {
|
|
10
10
|
constructor(event, store) {
|
|
11
11
|
if (event.kind !== FAVORITE_RELAYS_KIND &&
|
|
12
12
|
event.kind !== kinds.SearchRelaysList &&
|
|
13
|
-
event.kind !== kinds.BlockedRelaysList
|
|
13
|
+
event.kind !== kinds.BlockedRelaysList &&
|
|
14
|
+
event.kind !== LOOKUP_RELAY_LIST_KIND)
|
|
14
15
|
throw new Error(`Invalid relay list (kind ${event.kind})`);
|
|
15
16
|
super(event, store);
|
|
16
17
|
}
|
|
@@ -70,3 +71,11 @@ export class BlockedRelays extends RelayListBase {
|
|
|
70
71
|
super(event, store);
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
/** Class for lookup / indexer relays lists (kind 10086) */
|
|
75
|
+
export class LookupRelayList extends RelayListBase {
|
|
76
|
+
constructor(event, store) {
|
|
77
|
+
if (!isValidLookupRelayList(event))
|
|
78
|
+
throw new Error("Invalid lookup relay list");
|
|
79
|
+
super(event, store);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -4,8 +4,8 @@ import { TrustedProvider, TrustedProviderListEvent, UserAssertionEvent } from ".
|
|
|
4
4
|
import { CastRefEventStore, EventCast, PubkeyCast } from "./cast.js";
|
|
5
5
|
/** A cast for a service provider pubkey that publishes NIP-85 assertion events */
|
|
6
6
|
export declare class AssertionProvider extends PubkeyCast {
|
|
7
|
-
/** @internal Per-class singleton cache used by castPubkey */
|
|
8
|
-
static cache: Map<string, AssertionProvider
|
|
7
|
+
/** @internal Per-class weak singleton cache used by castPubkey */
|
|
8
|
+
static cache: Map<string, WeakRef<AssertionProvider>>;
|
|
9
9
|
/** Relay hints declared for this provider in the trusted provider list */
|
|
10
10
|
get providerRelays(): string[];
|
|
11
11
|
/** Returns the relays to use when querying this provider's assertion events */
|
|
@@ -9,7 +9,7 @@ import { castUser } from "./user.js";
|
|
|
9
9
|
// ─── AssertionProvider ───────────────────────────────────────────────────────
|
|
10
10
|
/** A cast for a service provider pubkey that publishes NIP-85 assertion events */
|
|
11
11
|
export class AssertionProvider extends PubkeyCast {
|
|
12
|
-
/** @internal Per-class singleton cache used by castPubkey */
|
|
12
|
+
/** @internal Per-class weak singleton cache used by castPubkey */
|
|
13
13
|
static cache = new Map();
|
|
14
14
|
/** Relay hints declared for this provider in the trusted provider list */
|
|
15
15
|
get providerRelays() {
|
package/dist/casts/user.d.ts
CHANGED
|
@@ -14,7 +14,11 @@ declare module "applesauce-core/casts" {
|
|
|
14
14
|
get bookmarks$(): ChainableObservable<import("./bookmarks.js").BookmarksList | undefined>;
|
|
15
15
|
get favoriteEmojis$(): ChainableObservable<import("./favorite-emojis.js").FavoriteEmojis | undefined>;
|
|
16
16
|
get favoriteRelays$(): ChainableObservable<import("./relay-lists.js").FavoriteRelays | undefined>;
|
|
17
|
+
get gitAuthors$(): ChainableObservable<import("./git-lists.js").GitAuthors | undefined>;
|
|
18
|
+
get favoriteGitRepos$(): ChainableObservable<import("./git-lists.js").FavoriteGitRepos | undefined>;
|
|
19
|
+
get graspServers$(): ChainableObservable<import("./git-grasp-list.js").GitGraspList | undefined>;
|
|
17
20
|
get searchRelays$(): ChainableObservable<import("./relay-lists.js").SearchRelays | undefined>;
|
|
21
|
+
get lookupRelayList$(): ChainableObservable<import("./relay-lists.js").LookupRelayList | undefined>;
|
|
18
22
|
get blockedRelays$(): ChainableObservable<import("./relay-lists.js").BlockedRelays | undefined>;
|
|
19
23
|
get directMessageRelays$(): ChainableObservable<string[] | undefined>;
|
|
20
24
|
get blossomServers$(): ChainableObservable<URL[] | undefined>;
|
package/dist/casts/user.js
CHANGED
|
@@ -3,9 +3,11 @@ import { kinds, nprofileEncode } from "applesauce-core/helpers";
|
|
|
3
3
|
import { combineLatest, defer, from, map, ReplaySubject, share, switchMap, tap } from "rxjs";
|
|
4
4
|
import { BLOSSOM_SERVER_LIST_KIND, getBlossomServersFromList } from "../helpers/blossom.js";
|
|
5
5
|
import { FAVORITE_EMOJI_PACKS_KIND } from "../helpers/emoji-pack.js";
|
|
6
|
+
import { GIT_GRASP_LIST_KIND } from "../helpers/git-grasp-list.js";
|
|
7
|
+
import { GIT_AUTHORS_KIND, FAVORITE_GIT_REPOS_KIND } from "../helpers/git-lists.js";
|
|
6
8
|
import { GROUPS_LIST_KIND } from "../helpers/groups.js";
|
|
7
9
|
import { getRelaysFromList } from "../helpers/lists.js";
|
|
8
|
-
import { FAVORITE_RELAYS_KIND } from "../helpers/relay-list.js";
|
|
10
|
+
import { FAVORITE_RELAYS_KIND, LOOKUP_RELAY_LIST_KIND } from "../helpers/relay-list.js";
|
|
9
11
|
import { TRUSTED_PROVIDER_LIST_KIND } from "../helpers/trusted-assertions.js";
|
|
10
12
|
import { castEventStream } from "../observable/cast-stream.js";
|
|
11
13
|
// Re-export castUser and User from core so consumers don't need to change imports
|
|
@@ -86,11 +88,31 @@ defineGetter("favoriteEmojis$", function () {
|
|
|
86
88
|
.replaceable({ kind: FAVORITE_EMOJI_PACKS_KIND, pubkey: this.pubkey, relays: outboxes })
|
|
87
89
|
.pipe(castEventStream(FavoriteEmojis, store)))));
|
|
88
90
|
});
|
|
91
|
+
defineGetter("gitAuthors$", function () {
|
|
92
|
+
return this.$$ref("gitAuthors$", (store) => combineLatest([Circular, this.outboxes$]).pipe(switchMap(([{ GitAuthors }, outboxes]) => store
|
|
93
|
+
.replaceable({ kind: GIT_AUTHORS_KIND, pubkey: this.pubkey, relays: outboxes })
|
|
94
|
+
.pipe(castEventStream(GitAuthors, store)))));
|
|
95
|
+
});
|
|
96
|
+
defineGetter("favoriteGitRepos$", function () {
|
|
97
|
+
return this.$$ref("favoriteGitRepos", (store) => combineLatest([Circular, this.outboxes$]).pipe(switchMap(([{ FavoriteGitRepos }, outboxes]) => store
|
|
98
|
+
.replaceable({ kind: FAVORITE_GIT_REPOS_KIND, pubkey: this.pubkey, relays: outboxes })
|
|
99
|
+
.pipe(castEventStream(FavoriteGitRepos, store)))));
|
|
100
|
+
});
|
|
101
|
+
defineGetter("graspServers$", function () {
|
|
102
|
+
return this.$$ref("graspServers$", (store) => combineLatest([Circular, this.outboxes$]).pipe(switchMap(([{ GitGraspList }, outboxes]) => store
|
|
103
|
+
.replaceable({ kind: GIT_GRASP_LIST_KIND, pubkey: this.pubkey, relays: outboxes })
|
|
104
|
+
.pipe(castEventStream(GitGraspList, store)))));
|
|
105
|
+
});
|
|
89
106
|
defineGetter("searchRelays$", function () {
|
|
90
107
|
return this.$$ref("searchRelays$", (store) => combineLatest([Circular, this.outboxes$]).pipe(switchMap(([{ SearchRelays }, outboxes]) => store
|
|
91
108
|
.replaceable({ kind: kinds.SearchRelaysList, pubkey: this.pubkey, relays: outboxes })
|
|
92
109
|
.pipe(castEventStream(SearchRelays, store)))));
|
|
93
110
|
});
|
|
111
|
+
defineGetter("lookupRelayList$", function () {
|
|
112
|
+
return this.$$ref("lookupRelayList$", (store) => combineLatest([Circular, this.outboxes$]).pipe(switchMap(([{ LookupRelayList }, outboxes]) => store
|
|
113
|
+
.replaceable({ kind: LOOKUP_RELAY_LIST_KIND, pubkey: this.pubkey, relays: outboxes })
|
|
114
|
+
.pipe(castEventStream(LookupRelayList, store)))));
|
|
115
|
+
});
|
|
94
116
|
defineGetter("blockedRelays$", function () {
|
|
95
117
|
return this.$$ref("blockedRelays$", (store) => combineLatest([Circular, this.outboxes$]).pipe(switchMap(([{ BlockedRelays }, outboxes]) => store
|
|
96
118
|
.replaceable({ kind: kinds.BlockedRelaysList, pubkey: this.pubkey, relays: outboxes })
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EventFactory } from "applesauce-core/factories";
|
|
2
2
|
import { KnownEvent, KnownEventTemplate, NostrEvent } from "applesauce-core/helpers";
|
|
3
|
-
import { MetaTagOptions } from "applesauce-core/operations/event";
|
|
4
3
|
import { DATE_BASED_CALENDAR_EVENT_KIND, TIME_BASED_CALENDAR_EVENT_KIND, CalendarEventParticipant } from "../helpers/calendar-event.js";
|
|
5
4
|
export type DateBasedCalendarEventTemplate = KnownEventTemplate<typeof DATE_BASED_CALENDAR_EVENT_KIND>;
|
|
6
5
|
export type TimeBasedCalendarEventTemplate = KnownEventTemplate<typeof TIME_BASED_CALENDAR_EVENT_KIND>;
|
|
@@ -42,8 +41,6 @@ export declare class DateBasedCalendarEventFactory extends EventFactory<typeof D
|
|
|
42
41
|
addHashtag(hashtag: string): this;
|
|
43
42
|
/** Adds multiple hashtags to the calendar event */
|
|
44
43
|
hashtags(hashtags: string[]): this;
|
|
45
|
-
/** Sets meta tags */
|
|
46
|
-
meta(options: MetaTagOptions): this;
|
|
47
44
|
}
|
|
48
45
|
/** A factory class for building NIP-52 time-based calendar events (kind 31923) */
|
|
49
46
|
export declare class TimeBasedCalendarEventFactory extends EventFactory<typeof TIME_BASED_CALENDAR_EVENT_KIND, TimeBasedCalendarEventTemplate> {
|
|
@@ -83,6 +80,4 @@ export declare class TimeBasedCalendarEventFactory extends EventFactory<typeof T
|
|
|
83
80
|
addHashtag(hashtag: string): this;
|
|
84
81
|
/** Adds multiple hashtags to the calendar event */
|
|
85
82
|
hashtags(hashtags: string[]): this;
|
|
86
|
-
/** Sets meta tags */
|
|
87
|
-
meta(options: MetaTagOptions): this;
|
|
88
83
|
}
|
|
@@ -2,7 +2,6 @@ import { EventFactory, blankEventTemplate, toEventTemplate } from "applesauce-co
|
|
|
2
2
|
import { isKind } from "applesauce-core/helpers";
|
|
3
3
|
import { nanoid } from "nanoid";
|
|
4
4
|
import { setContent } from "applesauce-core/operations/content";
|
|
5
|
-
import { setMetaTags } from "applesauce-core/operations/event";
|
|
6
5
|
import { includeReplaceableIdentifier } from "applesauce-core/operations/index";
|
|
7
6
|
import { DATE_BASED_CALENDAR_EVENT_KIND, TIME_BASED_CALENDAR_EVENT_KIND, } from "../helpers/calendar-event.js";
|
|
8
7
|
import * as CalendarEventOps from "../operations/calendar-event.js";
|
|
@@ -85,10 +84,6 @@ export class DateBasedCalendarEventFactory extends EventFactory {
|
|
|
85
84
|
hashtags(hashtags) {
|
|
86
85
|
return this.chain(includeHashtags(hashtags));
|
|
87
86
|
}
|
|
88
|
-
/** Sets meta tags */
|
|
89
|
-
meta(options) {
|
|
90
|
-
return this.chain(setMetaTags(options));
|
|
91
|
-
}
|
|
92
87
|
}
|
|
93
88
|
/** A factory class for building NIP-52 time-based calendar events (kind 31923) */
|
|
94
89
|
export class TimeBasedCalendarEventFactory extends EventFactory {
|
|
@@ -168,8 +163,4 @@ export class TimeBasedCalendarEventFactory extends EventFactory {
|
|
|
168
163
|
hashtags(hashtags) {
|
|
169
164
|
return this.chain(includeHashtags(hashtags));
|
|
170
165
|
}
|
|
171
|
-
/** Sets meta tags */
|
|
172
|
-
meta(options) {
|
|
173
|
-
return this.chain(setMetaTags(options));
|
|
174
|
-
}
|
|
175
166
|
}
|
|
@@ -9,6 +9,7 @@ export declare class CalendarEventRSVPFactory extends EventFactory<typeof CALEND
|
|
|
9
9
|
* Creates a new RSVP factory for a calendar event
|
|
10
10
|
* @param calendarEvent - The calendar event being RSVPed to
|
|
11
11
|
* @param status - The RSVP status (accepted, declined, tentative)
|
|
12
|
+
* @param relay - Optional relay hint for the calendar event pointer
|
|
12
13
|
*/
|
|
13
14
|
static create(calendarEvent: NostrEvent | AddressPointer, status: RSVPStatus, relay?: string): CalendarEventRSVPFactory;
|
|
14
15
|
/** Creates a factory from an existing RSVP event for editing */
|
|
@@ -8,6 +8,7 @@ export class CalendarEventRSVPFactory extends EventFactory {
|
|
|
8
8
|
* Creates a new RSVP factory for a calendar event
|
|
9
9
|
* @param calendarEvent - The calendar event being RSVPed to
|
|
10
10
|
* @param status - The RSVP status (accepted, declined, tentative)
|
|
11
|
+
* @param relay - Optional relay hint for the calendar event pointer
|
|
11
12
|
*/
|
|
12
13
|
static create(calendarEvent, status, relay) {
|
|
13
14
|
return new CalendarEventRSVPFactory((res) => res(blankEventTemplate(CALENDAR_EVENT_RSVP_KIND)))
|
|
@@ -60,6 +60,4 @@ export declare class CodeSnippetFactory extends EventFactory<typeof CODE_SNIPPET
|
|
|
60
60
|
addHashtag(hashtag: string): this;
|
|
61
61
|
/** Adds multiple hashtags as "t" tags */
|
|
62
62
|
hashtags(tags: string[]): this;
|
|
63
|
-
/** Sets meta tags */
|
|
64
|
-
meta(options: MetaTagOptions): this;
|
|
65
63
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { blankEventTemplate, EventFactory } from "applesauce-core/factories";
|
|
2
|
-
import { setMetaTags } from "applesauce-core/operations/event";
|
|
3
2
|
import { CODE_SNIPPET_KIND } from "../helpers/code-snippet.js";
|
|
4
3
|
import { addCodeSnippetDependency, addCodeSnippetLicense, removeCodeSnippetDependency, removeCodeSnippetLicense, setCodeSnippetContent, setCodeSnippetDependencies, setCodeSnippetDescription, setCodeSnippetExtension, setCodeSnippetLanguage, setCodeSnippetLicense, setCodeSnippetName, setCodeSnippetRepo, setCodeSnippetRuntime, } from "../operations/code-snippet.js";
|
|
5
4
|
import { addHashtag, includeHashtags } from "../operations/hashtags.js";
|
|
@@ -93,8 +92,4 @@ export class CodeSnippetFactory extends EventFactory {
|
|
|
93
92
|
hashtags(tags) {
|
|
94
93
|
return this.chain(includeHashtags(tags));
|
|
95
94
|
}
|
|
96
|
-
/** Sets meta tags */
|
|
97
|
-
meta(options) {
|
|
98
|
-
return this.chain(setMetaTags(options));
|
|
99
|
-
}
|
|
100
95
|
}
|
|
@@ -21,6 +21,4 @@ export declare class CommentFactory extends EventFactory<typeof COMMENT_KIND, Co
|
|
|
21
21
|
addHashtag(hashtag: string): this;
|
|
22
22
|
/** Adds multiple hashtags as "t" tags */
|
|
23
23
|
hashtags(tags: string[]): this;
|
|
24
|
-
/** Sets the meta tags for the comment */
|
|
25
|
-
meta(options: MetaTagOptions): this;
|
|
26
24
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { blankEventTemplate, EventFactory } from "applesauce-core/factories";
|
|
2
2
|
import { setShortTextContent } from "applesauce-core/operations/content";
|
|
3
|
-
import { setMetaTags } from "applesauce-core/operations/event";
|
|
4
3
|
import { COMMENT_KIND } from "../helpers/comment.js";
|
|
5
4
|
import { setParent } from "../operations/comment.js";
|
|
6
5
|
import { setGroupPointer } from "../operations/group.js";
|
|
@@ -12,14 +11,16 @@ export class CommentFactory extends EventFactory {
|
|
|
12
11
|
.parent(parent)
|
|
13
12
|
.text(content, options);
|
|
14
13
|
if (options)
|
|
15
|
-
factory
|
|
14
|
+
factory.meta(options);
|
|
16
15
|
return factory;
|
|
17
16
|
}
|
|
18
17
|
/** Creates a new comment that is replying to a parent event or pointer */
|
|
19
18
|
static reply(parent, content, options) {
|
|
20
|
-
let factory = new CommentFactory((res) => res(blankEventTemplate(COMMENT_KIND)))
|
|
19
|
+
let factory = new CommentFactory((res) => res(blankEventTemplate(COMMENT_KIND)))
|
|
20
|
+
.parent(parent)
|
|
21
|
+
.text(content, options);
|
|
21
22
|
if (options)
|
|
22
|
-
factory
|
|
23
|
+
factory.meta(options);
|
|
23
24
|
return factory;
|
|
24
25
|
}
|
|
25
26
|
/** Sets the parent event or pointer that this comment is replying to */
|
|
@@ -42,8 +43,4 @@ export class CommentFactory extends EventFactory {
|
|
|
42
43
|
hashtags(tags) {
|
|
43
44
|
return this.chain(includeHashtags(tags));
|
|
44
45
|
}
|
|
45
|
-
/** Sets the meta tags for the comment */
|
|
46
|
-
meta(options) {
|
|
47
|
-
return this.chain(setMetaTags(options));
|
|
48
|
-
}
|
|
49
46
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { KnownEvent, KnownEventTemplate, NostrEvent } from "applesauce-core/helpers";
|
|
2
|
+
import { FAVORITE_GIT_REPOS_KIND } from "../helpers/git-lists.js";
|
|
3
|
+
import { GitRepositoryPointer } from "../helpers/git-repository.js";
|
|
4
|
+
import { NIP51ItemListFactory } from "./list.js";
|
|
5
|
+
export type FavoriteGitReposTemplate = KnownEventTemplate<typeof FAVORITE_GIT_REPOS_KIND>;
|
|
6
|
+
export type FavoriteGitRepoInput = string | GitRepositoryPointer | NostrEvent;
|
|
7
|
+
/** A factory class for building kind 10018 git repositories list events */
|
|
8
|
+
export declare class FavoriteGitReposFactory extends NIP51ItemListFactory<typeof FAVORITE_GIT_REPOS_KIND, FavoriteGitReposTemplate> {
|
|
9
|
+
/** Creates a new git repositories list factory */
|
|
10
|
+
static create(): FavoriteGitReposFactory;
|
|
11
|
+
/** Creates a new git repositories list factory from an existing list event */
|
|
12
|
+
static modify(event: NostrEvent | KnownEvent<typeof FAVORITE_GIT_REPOS_KIND>): FavoriteGitReposFactory;
|
|
13
|
+
/** Adds a NIP-34 repository announcement pointer to the list */
|
|
14
|
+
addRepository(repository: FavoriteGitRepoInput, hidden?: boolean): this;
|
|
15
|
+
/** Removes a NIP-34 repository announcement pointer from the list */
|
|
16
|
+
removeRepository(repository: FavoriteGitRepoInput, hidden?: boolean): this;
|
|
17
|
+
}
|