applesauce-common 5.1.0 → 6.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.
- package/dist/casts/_circular-import.d.ts +7 -0
- package/dist/casts/_circular-import.js +9 -0
- package/dist/casts/article.d.ts +1 -1
- package/dist/casts/badge-award.d.ts +24 -0
- package/dist/casts/badge-award.js +39 -0
- package/dist/casts/badge.d.ts +19 -0
- package/dist/casts/badge.js +48 -0
- package/dist/casts/bookmarks.d.ts +5 -5
- package/dist/casts/cast.d.ts +1 -30
- package/dist/casts/cast.js +2 -67
- package/dist/casts/comment.d.ts +5 -5
- package/dist/casts/emoji-pack.d.ts +11 -0
- package/dist/casts/emoji-pack.js +25 -0
- package/dist/casts/favorite-emojis.d.ts +25 -0
- package/dist/casts/favorite-emojis.js +62 -0
- package/dist/casts/file-metadata.d.ts +22 -0
- package/dist/casts/file-metadata.js +55 -0
- package/dist/casts/groups.d.ts +1 -1
- package/dist/casts/index.d.ts +7 -0
- package/dist/casts/index.js +7 -0
- package/dist/casts/mutes.d.ts +1 -1
- package/dist/casts/note.d.ts +7 -7
- package/dist/casts/profile-badges.d.ts +28 -0
- package/dist/casts/profile-badges.js +59 -0
- package/dist/casts/reaction.d.ts +1 -1
- package/dist/casts/relay-lists.d.ts +1 -1
- package/dist/casts/relay-monitor.d.ts +1 -1
- package/dist/casts/report.d.ts +2 -2
- package/dist/casts/share.d.ts +2 -2
- package/dist/casts/stream.d.ts +9 -9
- package/dist/casts/torrent.d.ts +3 -3
- package/dist/casts/trusted-assertions.d.ts +144 -0
- package/dist/casts/trusted-assertions.js +281 -0
- package/dist/casts/user.d.ts +22 -38
- package/dist/casts/user.js +106 -153
- package/dist/casts/zap-goal.d.ts +2 -2
- package/dist/casts/zap.d.ts +4 -4
- package/dist/factories/app-data.d.ts +13 -0
- package/dist/factories/app-data.js +20 -0
- package/dist/factories/badge-award.d.ts +25 -0
- package/dist/factories/badge-award.js +41 -0
- package/dist/factories/badge.d.ts +32 -0
- package/dist/factories/badge.js +50 -0
- package/dist/factories/blocked-relays.d.ts +10 -0
- package/dist/factories/blocked-relays.js +16 -0
- package/dist/factories/blossom-server-list.d.ts +19 -0
- package/dist/factories/blossom-server-list.js +36 -0
- package/dist/factories/bookmark-list.d.ts +23 -0
- package/dist/factories/bookmark-list.js +45 -0
- package/dist/factories/bookmark-set.d.ts +25 -0
- package/dist/factories/bookmark-set.js +51 -0
- package/dist/factories/calendar-event.d.ts +88 -0
- package/dist/factories/calendar-event.js +175 -0
- package/dist/factories/calendar-rsvp.d.ts +22 -0
- package/dist/factories/calendar-rsvp.js +35 -0
- package/dist/factories/calendar.d.ts +20 -0
- package/dist/factories/calendar.js +36 -0
- package/dist/factories/code-snippet.d.ts +65 -0
- package/dist/factories/code-snippet.js +100 -0
- package/dist/factories/comment.d.ts +26 -0
- package/dist/factories/comment.js +49 -0
- package/dist/factories/contacts.d.ts +19 -0
- package/dist/factories/contacts.js +36 -0
- package/dist/factories/dm-relays.d.ts +10 -0
- package/dist/factories/dm-relays.js +16 -0
- package/dist/factories/favorite-relays.d.ts +16 -0
- package/dist/factories/favorite-relays.js +31 -0
- package/dist/factories/file-metadata.d.ts +54 -0
- package/dist/factories/file-metadata.js +92 -0
- package/dist/factories/follow-set.d.ts +12 -0
- package/dist/factories/follow-set.js +22 -0
- package/dist/factories/gift-wrap.d.ts +17 -0
- package/dist/factories/gift-wrap.js +21 -0
- package/dist/factories/group-management.d.ts +63 -0
- package/dist/factories/group-management.js +147 -0
- package/dist/factories/group.d.ts +35 -0
- package/dist/factories/group.js +69 -0
- package/dist/factories/highlight.d.ts +33 -0
- package/dist/factories/highlight.js +49 -0
- package/dist/factories/index.d.ts +41 -0
- package/dist/factories/index.js +41 -0
- package/dist/factories/legacy-message.d.ts +10 -0
- package/dist/factories/legacy-message.js +19 -0
- package/dist/factories/list.d.ts +56 -0
- package/dist/factories/list.js +120 -0
- package/dist/factories/live-stream.d.ts +48 -0
- package/dist/factories/live-stream.js +90 -0
- package/dist/factories/mute-list.d.ts +27 -0
- package/dist/factories/mute-list.js +57 -0
- package/dist/factories/note.d.ts +38 -0
- package/dist/factories/note.js +66 -0
- package/dist/factories/picture-post.d.ts +28 -0
- package/dist/factories/picture-post.js +46 -0
- package/dist/factories/pin-list.d.ts +14 -0
- package/dist/factories/pin-list.js +24 -0
- package/dist/factories/poll-response.d.ts +36 -0
- package/dist/factories/poll-response.js +46 -0
- package/dist/factories/poll.d.ts +35 -0
- package/dist/factories/poll.js +48 -0
- package/dist/factories/profile-badges.d.ts +31 -0
- package/dist/factories/profile-badges.js +52 -0
- package/dist/factories/reaction.d.ts +22 -0
- package/dist/factories/reaction.js +37 -0
- package/dist/factories/relay-set.d.ts +12 -0
- package/dist/factories/relay-set.js +22 -0
- package/dist/factories/search-relays.d.ts +10 -0
- package/dist/factories/search-relays.js +16 -0
- package/dist/factories/share.d.ts +26 -0
- package/dist/factories/share.js +44 -0
- package/dist/factories/stream-chat-message.d.ts +22 -0
- package/dist/factories/stream-chat-message.js +31 -0
- package/dist/factories/torrent.d.ts +57 -0
- package/dist/factories/torrent.js +93 -0
- package/dist/factories/wrapped-message.d.ts +22 -0
- package/dist/factories/wrapped-message.js +39 -0
- package/dist/factories/zap-goal.d.ts +35 -0
- package/dist/factories/zap-goal.js +49 -0
- package/dist/factories/zap-request.d.ts +28 -0
- package/dist/factories/zap-request.js +55 -0
- package/dist/factories/zap.d.ts +13 -0
- package/dist/factories/zap.js +21 -0
- package/dist/helpers/badge-award.d.ts +15 -0
- package/dist/helpers/badge-award.js +32 -0
- package/dist/helpers/badge.d.ts +27 -0
- package/dist/helpers/badge.js +59 -0
- package/dist/helpers/blossom.d.ts +29 -1
- package/dist/helpers/blossom.js +64 -7
- package/dist/helpers/emoji-pack.d.ts +43 -0
- package/dist/helpers/emoji-pack.js +108 -0
- package/dist/helpers/emoji.d.ts +4 -5
- package/dist/helpers/emoji.js +3 -15
- package/dist/helpers/file-metadata.d.ts +18 -13
- package/dist/helpers/file-metadata.js +10 -4
- package/dist/helpers/groups.d.ts +1 -0
- package/dist/helpers/groups.js +3 -2
- package/dist/helpers/hashtag.d.ts +1 -0
- package/dist/helpers/hashtag.js +3 -3
- package/dist/helpers/index.d.ts +7 -2
- package/dist/helpers/index.js +7 -2
- package/dist/helpers/lists.d.ts +8 -0
- package/dist/helpers/lists.js +27 -5
- package/dist/helpers/picture-post.d.ts +2 -2
- package/dist/helpers/profile-badges.d.ts +23 -0
- package/dist/helpers/profile-badges.js +51 -0
- package/dist/helpers/trusted-assertions.d.ts +81 -0
- package/dist/helpers/trusted-assertions.js +161 -0
- package/dist/helpers/zap.d.ts +8 -2
- package/dist/helpers/zap.js +31 -26
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +1 -1
- package/dist/models/thread.d.ts +1 -1
- package/dist/models/thread.js +23 -7
- package/dist/observable/chainable.d.ts +1 -36
- package/dist/observable/chainable.js +2 -72
- package/dist/operations/app-data.d.ts +8 -3
- package/dist/operations/app-data.js +9 -4
- package/dist/operations/badge-award.d.ts +17 -0
- package/dist/operations/badge-award.js +30 -0
- package/dist/operations/badge.d.ts +22 -0
- package/dist/operations/badge.js +54 -0
- package/dist/operations/blossom.d.ts +1 -1
- package/dist/operations/calendar-event.d.ts +1 -1
- package/dist/operations/calendar-rsvp.d.ts +1 -1
- package/dist/operations/calendar.d.ts +1 -1
- package/dist/operations/channel.d.ts +1 -1
- package/dist/operations/client.d.ts +1 -1
- package/dist/operations/client.js +2 -2
- package/dist/operations/code-snippet.d.ts +27 -0
- package/dist/operations/code-snippet.js +63 -0
- package/dist/operations/comment.d.ts +7 -3
- package/dist/operations/comment.js +8 -4
- package/dist/operations/file-metadata.d.ts +38 -4
- package/dist/operations/file-metadata.js +105 -19
- package/dist/operations/geohash.d.ts +1 -1
- package/dist/operations/gift-wrap.d.ts +19 -7
- package/dist/operations/gift-wrap.js +36 -26
- package/dist/operations/group.d.ts +1 -1
- package/dist/operations/hashtags.d.ts +1 -1
- package/dist/operations/highlight.d.ts +1 -1
- package/dist/operations/highlight.js +5 -5
- package/dist/operations/index.d.ts +7 -1
- package/dist/operations/index.js +7 -1
- package/dist/operations/legacy-message.d.ts +1 -1
- package/dist/operations/list.d.ts +1 -1
- package/dist/operations/live-stream.d.ts +7 -3
- package/dist/operations/live-stream.js +9 -5
- package/dist/operations/media-attachment.d.ts +3 -3
- package/dist/operations/note.d.ts +10 -4
- package/dist/operations/note.js +14 -8
- package/dist/operations/picture-post.d.ts +1 -1
- package/dist/operations/poll-response.d.ts +1 -1
- package/dist/operations/poll-response.js +1 -1
- package/dist/operations/poll.d.ts +1 -1
- package/dist/operations/profile-badges.d.ts +26 -0
- package/dist/operations/profile-badges.js +150 -0
- package/dist/operations/reaction.d.ts +8 -3
- package/dist/operations/reaction.js +10 -5
- package/dist/operations/share.d.ts +8 -3
- package/dist/operations/share.js +10 -5
- package/dist/operations/stream.d.ts +1 -1
- package/dist/operations/tag/bookmarks.d.ts +1 -1
- package/dist/operations/torrent.d.ts +1 -1
- package/dist/operations/wrapped-message.d.ts +1 -1
- package/dist/operations/zap-goal.d.ts +1 -1
- package/dist/operations/zap-request.d.ts +22 -0
- package/dist/operations/zap-request.js +40 -0
- package/dist/operations/zap-split.d.ts +8 -4
- package/dist/operations/zap-split.js +10 -6
- package/dist/operations/zap.d.ts +12 -0
- package/dist/operations/zap.js +34 -0
- package/package.json +13 -12
- package/dist/blueprints/__register__.d.ts +0 -7
- package/dist/blueprints/__register__.js +0 -8
- package/dist/blueprints/app-data.d.ts +0 -5
- package/dist/blueprints/app-data.js +0 -10
- package/dist/blueprints/calendar.d.ts +0 -5
- package/dist/blueprints/calendar.js +0 -7
- package/dist/blueprints/channels.d.ts +0 -6
- package/dist/blueprints/channels.js +0 -13
- package/dist/blueprints/comment.d.ts +0 -13
- package/dist/blueprints/comment.js +0 -15
- package/dist/blueprints/delete.d.ts +0 -9
- package/dist/blueprints/delete.js +0 -14
- package/dist/blueprints/file-metadata.d.ts +0 -8
- package/dist/blueprints/file-metadata.js +0 -11
- package/dist/blueprints/follow-set.d.ts +0 -11
- package/dist/blueprints/follow-set.js +0 -21
- package/dist/blueprints/gift-wrap.d.ts +0 -5
- package/dist/blueprints/gift-wrap.js +0 -6
- package/dist/blueprints/group-mangement.d.ts +0 -25
- package/dist/blueprints/group-mangement.js +0 -40
- package/dist/blueprints/group.d.ts +0 -9
- package/dist/blueprints/group.js +0 -17
- package/dist/blueprints/highlight.d.ts +0 -20
- package/dist/blueprints/highlight.js +0 -12
- package/dist/blueprints/index.d.ts +0 -25
- package/dist/blueprints/index.js +0 -26
- package/dist/blueprints/legacy-message.d.ts +0 -7
- package/dist/blueprints/legacy-message.js +0 -29
- package/dist/blueprints/live-stream.d.ts +0 -6
- package/dist/blueprints/live-stream.js +0 -9
- package/dist/blueprints/note.d.ts +0 -16
- package/dist/blueprints/note.js +0 -30
- package/dist/blueprints/picture-post.d.ts +0 -12
- package/dist/blueprints/picture-post.js +0 -17
- package/dist/blueprints/poll.d.ts +0 -41
- package/dist/blueprints/poll.js +0 -33
- package/dist/blueprints/profile.d.ts +0 -3
- package/dist/blueprints/profile.js +0 -7
- package/dist/blueprints/reaction.d.ts +0 -10
- package/dist/blueprints/reaction.js +0 -14
- package/dist/blueprints/share.d.ts +0 -12
- package/dist/blueprints/share.js +0 -25
- package/dist/blueprints/stream.d.ts +0 -6
- package/dist/blueprints/stream.js +0 -7
- package/dist/blueprints/torrent.d.ts +0 -30
- package/dist/blueprints/torrent.js +0 -29
- package/dist/blueprints/wrapped-message.d.ts +0 -20
- package/dist/blueprints/wrapped-message.js +0 -64
- package/dist/blueprints/zap-goal.d.ts +0 -16
- package/dist/blueprints/zap-goal.js +0 -12
- package/dist/register.d.ts +0 -2
- package/dist/register.js +0 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { EventFactory, blankEventTemplate } from "applesauce-core/factories";
|
|
2
|
+
import { setShortTextContent } from "applesauce-core/operations/content";
|
|
3
|
+
import { setMetaTags } from "applesauce-core/operations/event";
|
|
4
|
+
import { includeNameValueTag, includeSingletonTag } from "applesauce-core/operations/tags";
|
|
5
|
+
import { GROUP_MESSAGE_KIND, GROUP_THREAD_KIND } from "../helpers/groups.js";
|
|
6
|
+
import { addPreviousRefs, setGroupPointer } from "../operations/group.js";
|
|
7
|
+
import { addHashtag, includeHashtags } from "../operations/hashtags.js";
|
|
8
|
+
export class GroupMessageFactory extends EventFactory {
|
|
9
|
+
static create(group, content) {
|
|
10
|
+
return new GroupMessageFactory((res) => res(blankEventTemplate(GROUP_MESSAGE_KIND))).group(group).text(content);
|
|
11
|
+
}
|
|
12
|
+
group(pointer) {
|
|
13
|
+
return this.chain((draft) => setGroupPointer(pointer)(draft));
|
|
14
|
+
}
|
|
15
|
+
text(content, options) {
|
|
16
|
+
return this.chain((draft) => setShortTextContent(content, options)(draft));
|
|
17
|
+
}
|
|
18
|
+
previous(events) {
|
|
19
|
+
return this.chain((draft) => addPreviousRefs(events)(draft));
|
|
20
|
+
}
|
|
21
|
+
/** Sets the "e" reply tag pointing to a parent group message */
|
|
22
|
+
replyTo(parent) {
|
|
23
|
+
return this.chain(includeNameValueTag(["e", parent.id]));
|
|
24
|
+
}
|
|
25
|
+
meta(options) {
|
|
26
|
+
return this.chain((draft) => setMetaTags(options)(draft));
|
|
27
|
+
}
|
|
28
|
+
/** Creates a reply to a group message */
|
|
29
|
+
static reply(group, parent, content) {
|
|
30
|
+
return new GroupMessageFactory((res) => res(blankEventTemplate(GROUP_MESSAGE_KIND)))
|
|
31
|
+
.group(group)
|
|
32
|
+
.replyTo(parent)
|
|
33
|
+
.text(content);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** A factory class for building NIP-29 group thread events (kind 11) */
|
|
37
|
+
export class GroupThreadFactory extends EventFactory {
|
|
38
|
+
/** Creates a new group thread event */
|
|
39
|
+
static create(group, title, content) {
|
|
40
|
+
return new GroupThreadFactory((res) => res(blankEventTemplate(GROUP_THREAD_KIND)))
|
|
41
|
+
.group(group)
|
|
42
|
+
.title(title)
|
|
43
|
+
.text(content);
|
|
44
|
+
}
|
|
45
|
+
/** Sets the NIP-29 group pointer "h" tag */
|
|
46
|
+
group(pointer) {
|
|
47
|
+
return this.chain(setGroupPointer(pointer));
|
|
48
|
+
}
|
|
49
|
+
/** Sets the thread title */
|
|
50
|
+
title(title) {
|
|
51
|
+
return this.chain(includeSingletonTag(["title", title]));
|
|
52
|
+
}
|
|
53
|
+
/** Sets the text content */
|
|
54
|
+
text(content, options) {
|
|
55
|
+
return this.chain(setShortTextContent(content, options));
|
|
56
|
+
}
|
|
57
|
+
/** Adds a hashtag "t" tag to the thread */
|
|
58
|
+
addHashtag(hashtag) {
|
|
59
|
+
return this.chain(addHashtag(hashtag));
|
|
60
|
+
}
|
|
61
|
+
/** Adds multiple hashtags as "t" tags */
|
|
62
|
+
hashtags(hashtags) {
|
|
63
|
+
return this.chain(includeHashtags(hashtags));
|
|
64
|
+
}
|
|
65
|
+
/** Sets meta tags */
|
|
66
|
+
meta(options) {
|
|
67
|
+
return this.chain(setMetaTags(options));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EventFactory } from "applesauce-core/factories";
|
|
2
|
+
import { kinds, KnownEventTemplate, NostrEvent } from "applesauce-core/helpers";
|
|
3
|
+
import { AddressPointer } from "applesauce-core/helpers/pointers";
|
|
4
|
+
import { MetaTagOptions } from "applesauce-core/operations/event";
|
|
5
|
+
import { HighlightAttribution } from "../helpers/index.js";
|
|
6
|
+
import { ZapOptions } from "../operations/zap-split.js";
|
|
7
|
+
export type HighlightTemplate = KnownEventTemplate<kinds.Highlights>;
|
|
8
|
+
export type HighlightBlueprintOptions = MetaTagOptions & ZapOptions & {
|
|
9
|
+
context?: string;
|
|
10
|
+
comment?: string;
|
|
11
|
+
attributions?: HighlightAttribution[];
|
|
12
|
+
alt?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare class HighlightFactory extends EventFactory<kinds.Highlights, HighlightTemplate> {
|
|
15
|
+
/** Creates a new highlight factory from content and source */
|
|
16
|
+
static create(content: string, source: NostrEvent | AddressPointer | string, options?: HighlightBlueprintOptions): HighlightFactory;
|
|
17
|
+
/** Sets the content of the highlight */
|
|
18
|
+
highlight(content: string): this;
|
|
19
|
+
/** Sets the source event that was highlighted using an 'e' tag */
|
|
20
|
+
source(source: NostrEvent | AddressPointer | string): this;
|
|
21
|
+
/** Adds a single attribution for the highlight */
|
|
22
|
+
addAttribution(attribution: HighlightAttribution): this;
|
|
23
|
+
/** Sets multiple attributions at once for the highlight */
|
|
24
|
+
attributions(attrs: HighlightAttribution[]): this;
|
|
25
|
+
/** Sets the surrounding context for the highlight */
|
|
26
|
+
context(context: string): this;
|
|
27
|
+
/** Sets the comment for the highlight */
|
|
28
|
+
comment(comment: string): this;
|
|
29
|
+
/** Sets the zap split for the highlight */
|
|
30
|
+
zapSplit(options: ZapOptions): this;
|
|
31
|
+
/** Sets the meta tags for the highlight */
|
|
32
|
+
meta(options: MetaTagOptions): this;
|
|
33
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// highlight.ts
|
|
2
|
+
import { blankEventTemplate, EventFactory } from "applesauce-core/factories";
|
|
3
|
+
import { kinds } from "applesauce-core/helpers";
|
|
4
|
+
import { setMetaTags } from "applesauce-core/operations/event";
|
|
5
|
+
import { addAttribution, setAttributions, setComment, setContext, setHighlightContent, setSource, } from "../operations/highlight.js";
|
|
6
|
+
import { setZapSplit } from "../operations/zap-split.js";
|
|
7
|
+
export class HighlightFactory extends EventFactory {
|
|
8
|
+
/** Creates a new highlight factory from content and source */
|
|
9
|
+
static create(content, source, options) {
|
|
10
|
+
let factory = new HighlightFactory((res) => res(blankEventTemplate(kinds.Highlights)))
|
|
11
|
+
.highlight(content)
|
|
12
|
+
.source(source);
|
|
13
|
+
if (options)
|
|
14
|
+
factory = factory.meta(options);
|
|
15
|
+
return factory;
|
|
16
|
+
}
|
|
17
|
+
/** Sets the content of the highlight */
|
|
18
|
+
highlight(content) {
|
|
19
|
+
return this.chain(setHighlightContent(content));
|
|
20
|
+
}
|
|
21
|
+
/** Sets the source event that was highlighted using an 'e' tag */
|
|
22
|
+
source(source) {
|
|
23
|
+
return this.chain(setSource(source));
|
|
24
|
+
}
|
|
25
|
+
/** Adds a single attribution for the highlight */
|
|
26
|
+
addAttribution(attribution) {
|
|
27
|
+
return this.chain(addAttribution(attribution));
|
|
28
|
+
}
|
|
29
|
+
/** Sets multiple attributions at once for the highlight */
|
|
30
|
+
attributions(attrs) {
|
|
31
|
+
return this.chain(setAttributions(attrs));
|
|
32
|
+
}
|
|
33
|
+
/** Sets the surrounding context for the highlight */
|
|
34
|
+
context(context) {
|
|
35
|
+
return this.chain(setContext(context));
|
|
36
|
+
}
|
|
37
|
+
/** Sets the comment for the highlight */
|
|
38
|
+
comment(comment) {
|
|
39
|
+
return this.chain(setComment(comment));
|
|
40
|
+
}
|
|
41
|
+
/** Sets the zap split for the highlight */
|
|
42
|
+
zapSplit(options) {
|
|
43
|
+
return this.chain(setZapSplit(options, undefined));
|
|
44
|
+
}
|
|
45
|
+
/** Sets the meta tags for the highlight */
|
|
46
|
+
meta(options) {
|
|
47
|
+
return this.chain(setMetaTags(options));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export * from "./note.js";
|
|
2
|
+
export * from "./reaction.js";
|
|
3
|
+
export * from "./comment.js";
|
|
4
|
+
export * from "./share.js";
|
|
5
|
+
export * from "./poll.js";
|
|
6
|
+
export * from "./poll-response.js";
|
|
7
|
+
export * from "./torrent.js";
|
|
8
|
+
export * from "./highlight.js";
|
|
9
|
+
export * from "./calendar.js";
|
|
10
|
+
export * from "./gift-wrap.js";
|
|
11
|
+
export * from "./group.js";
|
|
12
|
+
export * from "./group-management.js";
|
|
13
|
+
export * from "./legacy-message.js";
|
|
14
|
+
export * from "./wrapped-message.js";
|
|
15
|
+
export * from "./app-data.js";
|
|
16
|
+
export * from "./zap-goal.js";
|
|
17
|
+
export * from "./zap-request.js";
|
|
18
|
+
export * from "./zap.js";
|
|
19
|
+
export * from "./code-snippet.js";
|
|
20
|
+
export * from "./contacts.js";
|
|
21
|
+
export * from "./mute-list.js";
|
|
22
|
+
export * from "./pin-list.js";
|
|
23
|
+
export * from "./bookmark-list.js";
|
|
24
|
+
export * from "./bookmark-set.js";
|
|
25
|
+
export * from "./blocked-relays.js";
|
|
26
|
+
export * from "./search-relays.js";
|
|
27
|
+
export * from "./favorite-relays.js";
|
|
28
|
+
export * from "./dm-relays.js";
|
|
29
|
+
export * from "./blossom-server-list.js";
|
|
30
|
+
export * from "./follow-set.js";
|
|
31
|
+
export * from "./relay-set.js";
|
|
32
|
+
export * from "./list.js";
|
|
33
|
+
export * from "./stream-chat-message.js";
|
|
34
|
+
export * from "./calendar-event.js";
|
|
35
|
+
export * from "./live-stream.js";
|
|
36
|
+
export * from "./calendar-rsvp.js";
|
|
37
|
+
export * from "./file-metadata.js";
|
|
38
|
+
export * from "./picture-post.js";
|
|
39
|
+
export * from "./badge.js";
|
|
40
|
+
export * from "./badge-award.js";
|
|
41
|
+
export * from "./profile-badges.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export * from "./note.js";
|
|
2
|
+
export * from "./reaction.js";
|
|
3
|
+
export * from "./comment.js";
|
|
4
|
+
export * from "./share.js";
|
|
5
|
+
export * from "./poll.js";
|
|
6
|
+
export * from "./poll-response.js";
|
|
7
|
+
export * from "./torrent.js";
|
|
8
|
+
export * from "./highlight.js";
|
|
9
|
+
export * from "./calendar.js";
|
|
10
|
+
export * from "./gift-wrap.js";
|
|
11
|
+
export * from "./group.js";
|
|
12
|
+
export * from "./group-management.js";
|
|
13
|
+
export * from "./legacy-message.js";
|
|
14
|
+
export * from "./wrapped-message.js";
|
|
15
|
+
export * from "./app-data.js";
|
|
16
|
+
export * from "./zap-goal.js";
|
|
17
|
+
export * from "./zap-request.js";
|
|
18
|
+
export * from "./zap.js";
|
|
19
|
+
export * from "./code-snippet.js";
|
|
20
|
+
export * from "./contacts.js";
|
|
21
|
+
export * from "./mute-list.js";
|
|
22
|
+
export * from "./pin-list.js";
|
|
23
|
+
export * from "./bookmark-list.js";
|
|
24
|
+
export * from "./bookmark-set.js";
|
|
25
|
+
export * from "./blocked-relays.js";
|
|
26
|
+
export * from "./search-relays.js";
|
|
27
|
+
export * from "./favorite-relays.js";
|
|
28
|
+
export * from "./dm-relays.js";
|
|
29
|
+
export * from "./blossom-server-list.js";
|
|
30
|
+
export * from "./follow-set.js";
|
|
31
|
+
export * from "./relay-set.js";
|
|
32
|
+
export * from "./list.js";
|
|
33
|
+
export * from "./stream-chat-message.js";
|
|
34
|
+
export * from "./calendar-event.js";
|
|
35
|
+
export * from "./live-stream.js";
|
|
36
|
+
export * from "./calendar-rsvp.js";
|
|
37
|
+
export * from "./file-metadata.js";
|
|
38
|
+
export * from "./picture-post.js";
|
|
39
|
+
export * from "./badge.js";
|
|
40
|
+
export * from "./badge-award.js";
|
|
41
|
+
export * from "./profile-badges.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventFactory } from "applesauce-core/factories";
|
|
2
|
+
import { kinds, KnownEventTemplate, NostrEvent } from "applesauce-core/helpers";
|
|
3
|
+
export type LegacyMessageTemplate = KnownEventTemplate<kinds.EncryptedDirectMessage>;
|
|
4
|
+
export type LegacyMessageBlueprintOptions = {};
|
|
5
|
+
export declare class LegacyMessageFactory extends EventFactory<kinds.EncryptedDirectMessage, LegacyMessageTemplate> {
|
|
6
|
+
static create(recipient: string, message: string): LegacyMessageFactory;
|
|
7
|
+
static reply(parent: NostrEvent, recipient: string, message: string): LegacyMessageFactory;
|
|
8
|
+
/** Sets the parent message "e" tag for NIP-04 reply threading */
|
|
9
|
+
replyTo(parent: NostrEvent | string): this;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EventFactory, blankEventTemplate } from "applesauce-core/factories";
|
|
2
|
+
import { kinds } from "applesauce-core/helpers";
|
|
3
|
+
import { setMessageParent } from "../operations/legacy-message.js";
|
|
4
|
+
export class LegacyMessageFactory extends EventFactory {
|
|
5
|
+
static create(recipient, message) {
|
|
6
|
+
return new LegacyMessageFactory((res) => res(blankEventTemplate(kinds.EncryptedDirectMessage))).encryptedContent(recipient, message, "nip04");
|
|
7
|
+
}
|
|
8
|
+
static reply(parent, recipient, message) {
|
|
9
|
+
if (parent.kind !== kinds.EncryptedDirectMessage)
|
|
10
|
+
throw new Error("Parent must be a legacy message (kind 4)");
|
|
11
|
+
return new LegacyMessageFactory((res) => res(blankEventTemplate(kinds.EncryptedDirectMessage)))
|
|
12
|
+
.encryptedContent(recipient, message, "nip04")
|
|
13
|
+
.replyTo(parent);
|
|
14
|
+
}
|
|
15
|
+
/** Sets the parent message "e" tag for NIP-04 reply threading */
|
|
16
|
+
replyTo(parent) {
|
|
17
|
+
return this.chain(setMessageParent(parent));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EventFactory } from "applesauce-core/factories";
|
|
2
|
+
import { KnownEventTemplate, NostrEvent } from "applesauce-core/helpers";
|
|
3
|
+
import { AddressPointer, EventPointer, ProfilePointer } from "applesauce-core/helpers/pointers";
|
|
4
|
+
/** A factory class for modifying any NIP-51 list event (kind-agnostic) */
|
|
5
|
+
export declare class ListFactory<K extends number = number, T extends KnownEventTemplate<K> = KnownEventTemplate<K>> extends EventFactory<K, T> {
|
|
6
|
+
/** Creates a new list factory from an existing list event */
|
|
7
|
+
static modify(event: NostrEvent): ListFactory;
|
|
8
|
+
/** Sets or removes the title of the list */
|
|
9
|
+
title(title: string | null): this;
|
|
10
|
+
/** Sets or removes the description of the list */
|
|
11
|
+
description(description: string | null): this;
|
|
12
|
+
/** Sets or removes the image of the list */
|
|
13
|
+
image(image: string | null): this;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A base factory class for NIP-51 lists that contain relay URLs.
|
|
17
|
+
* Provides `addRelay` and `removeRelay` methods in addition to `title`, `description`, and `image`.
|
|
18
|
+
*/
|
|
19
|
+
export declare class NIP51RelayListFactory<K extends number = number, T extends KnownEventTemplate<K> = KnownEventTemplate<K>> extends ListFactory<K, T> {
|
|
20
|
+
/** Adds a relay URL to the list's public tags */
|
|
21
|
+
addRelay(relay: string | string[], hidden?: boolean): this;
|
|
22
|
+
/** Removes a relay URL from the list */
|
|
23
|
+
removeRelay(relay: string | string[], hidden?: boolean): this;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A base factory class for NIP-51 lists that contain user pubkeys (profile pointers).
|
|
27
|
+
* Provides `addUser` and `removeUser` methods in addition to `title`, `description`, and `image`.
|
|
28
|
+
*/
|
|
29
|
+
export declare class NIP51UserListFactory<K extends number = number, T extends KnownEventTemplate<K> = KnownEventTemplate<K>> extends ListFactory<K, T> {
|
|
30
|
+
/** Adds one or more pubkeys (or ProfilePointers) to the list */
|
|
31
|
+
addUser(pubkey: string | ProfilePointer | (string | ProfilePointer)[], hidden?: boolean): this;
|
|
32
|
+
/** Removes one or more pubkeys (or ProfilePointers) from the list */
|
|
33
|
+
removeUser(pubkey: string | ProfilePointer | (string | ProfilePointer)[], hidden?: boolean): this;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A base factory class for NIP-51 lists that contain event / address pointers.
|
|
37
|
+
* Provides `addItem` and `removeItem` methods in addition to `title`, `description`, and `image`.
|
|
38
|
+
*/
|
|
39
|
+
export declare class NIP51ItemListFactory<K extends number = number, T extends KnownEventTemplate<K> = KnownEventTemplate<K>> extends ListFactory<K, T> {
|
|
40
|
+
/** Adds an event (by id or EventPointer) to the list */
|
|
41
|
+
addEventItem(id: string | EventPointer | NostrEvent, hidden?: boolean): this;
|
|
42
|
+
/** Removes an event (by id or EventPointer) from the list */
|
|
43
|
+
removeEventItem(id: string | EventPointer, hidden?: boolean): this;
|
|
44
|
+
/** Adds an addressable event (by AddressPointer or NostrEvent) to the list */
|
|
45
|
+
addAddressItem(address: string | AddressPointer | NostrEvent, hidden?: boolean): this;
|
|
46
|
+
/** Removes an addressable event (by AddressPointer or NostrEvent) from the list */
|
|
47
|
+
removeAddressItem(address: string | AddressPointer | NostrEvent, hidden?: boolean): this;
|
|
48
|
+
/** Adds a URL "r" tag item to the list */
|
|
49
|
+
addUrlItem(url: string, hidden?: boolean): this;
|
|
50
|
+
/** Removes a URL "r" tag item from the list */
|
|
51
|
+
removeUrlItem(url: string, hidden?: boolean): this;
|
|
52
|
+
/** Adds a hashtag "t" tag item to the list */
|
|
53
|
+
addHashtagItem(hashtag: string, hidden?: boolean): this;
|
|
54
|
+
/** Removes a hashtag "t" tag item from the list */
|
|
55
|
+
removeHashtagItem(hashtag: string, hidden?: boolean): this;
|
|
56
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { EventFactory, toEventTemplate } from "applesauce-core/factories";
|
|
2
|
+
import { addAddressPointerTag, addEventPointerTag, addNameValueTag, addProfilePointerTag, removeAddressPointerTag, removeEventPointerTag, removeNameValueTag, removeProfilePointerTag, removeSingletonTag, setSingletonTag, } from "applesauce-core/operations/tag/common";
|
|
3
|
+
import { addRelayTag, removeRelayTag } from "applesauce-core/operations/tag/relay";
|
|
4
|
+
/** A factory class for modifying any NIP-51 list event (kind-agnostic) */
|
|
5
|
+
export class ListFactory extends EventFactory {
|
|
6
|
+
/** Creates a new list factory from an existing list event */
|
|
7
|
+
static modify(event) {
|
|
8
|
+
return new ListFactory((res) => res(toEventTemplate(event)));
|
|
9
|
+
}
|
|
10
|
+
/** Sets or removes the title of the list */
|
|
11
|
+
title(title) {
|
|
12
|
+
return title === null
|
|
13
|
+
? this.modifyPublicTags(removeSingletonTag("title"))
|
|
14
|
+
: this.modifyPublicTags(setSingletonTag(["title", title], true));
|
|
15
|
+
}
|
|
16
|
+
/** Sets or removes the description of the list */
|
|
17
|
+
description(description) {
|
|
18
|
+
return description === null
|
|
19
|
+
? this.modifyPublicTags(removeSingletonTag("description"))
|
|
20
|
+
: this.modifyPublicTags(setSingletonTag(["description", description], true));
|
|
21
|
+
}
|
|
22
|
+
/** Sets or removes the image of the list */
|
|
23
|
+
image(image) {
|
|
24
|
+
return image === null
|
|
25
|
+
? this.modifyPublicTags(removeSingletonTag("image"))
|
|
26
|
+
: this.modifyPublicTags(setSingletonTag(["image", image], true));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A base factory class for NIP-51 lists that contain relay URLs.
|
|
31
|
+
* Provides `addRelay` and `removeRelay` methods in addition to `title`, `description`, and `image`.
|
|
32
|
+
*/
|
|
33
|
+
export class NIP51RelayListFactory extends ListFactory {
|
|
34
|
+
/** Adds a relay URL to the list's public tags */
|
|
35
|
+
addRelay(relay, hidden = false) {
|
|
36
|
+
const relays = Array.isArray(relay) ? relay : [relay];
|
|
37
|
+
return hidden
|
|
38
|
+
? this.modifyHiddenTags(...relays.map((r) => addRelayTag(r)))
|
|
39
|
+
: this.modifyPublicTags(...relays.map((r) => addRelayTag(r)));
|
|
40
|
+
}
|
|
41
|
+
/** Removes a relay URL from the list */
|
|
42
|
+
removeRelay(relay, hidden = false) {
|
|
43
|
+
const relays = Array.isArray(relay) ? relay : [relay];
|
|
44
|
+
return hidden
|
|
45
|
+
? this.modifyHiddenTags(...relays.map((r) => removeRelayTag(r)))
|
|
46
|
+
: this.modifyPublicTags(...relays.map((r) => removeRelayTag(r)));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A base factory class for NIP-51 lists that contain user pubkeys (profile pointers).
|
|
51
|
+
* Provides `addUser` and `removeUser` methods in addition to `title`, `description`, and `image`.
|
|
52
|
+
*/
|
|
53
|
+
export class NIP51UserListFactory extends ListFactory {
|
|
54
|
+
/** Adds one or more pubkeys (or ProfilePointers) to the list */
|
|
55
|
+
addUser(pubkey, hidden = false) {
|
|
56
|
+
const pubkeys = Array.isArray(pubkey) ? pubkey : [pubkey];
|
|
57
|
+
return hidden
|
|
58
|
+
? this.modifyHiddenTags(...pubkeys.map((p) => addProfilePointerTag(p)))
|
|
59
|
+
: this.modifyPublicTags(...pubkeys.map((p) => addProfilePointerTag(p)));
|
|
60
|
+
}
|
|
61
|
+
/** Removes one or more pubkeys (or ProfilePointers) from the list */
|
|
62
|
+
removeUser(pubkey, hidden = false) {
|
|
63
|
+
const pubkeys = Array.isArray(pubkey) ? pubkey : [pubkey];
|
|
64
|
+
return hidden
|
|
65
|
+
? this.modifyHiddenTags(...pubkeys.map((p) => removeProfilePointerTag(p)))
|
|
66
|
+
: this.modifyPublicTags(...pubkeys.map((p) => removeProfilePointerTag(p)));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A base factory class for NIP-51 lists that contain event / address pointers.
|
|
71
|
+
* Provides `addItem` and `removeItem` methods in addition to `title`, `description`, and `image`.
|
|
72
|
+
*/
|
|
73
|
+
export class NIP51ItemListFactory extends ListFactory {
|
|
74
|
+
/** Adds an event (by id or EventPointer) to the list */
|
|
75
|
+
addEventItem(id, hidden = false) {
|
|
76
|
+
return hidden ? this.modifyHiddenTags(addEventPointerTag(id)) : this.modifyPublicTags(addEventPointerTag(id));
|
|
77
|
+
}
|
|
78
|
+
/** Removes an event (by id or EventPointer) from the list */
|
|
79
|
+
removeEventItem(id, hidden = false) {
|
|
80
|
+
return hidden ? this.modifyHiddenTags(removeEventPointerTag(id)) : this.modifyPublicTags(removeEventPointerTag(id));
|
|
81
|
+
}
|
|
82
|
+
/** Adds an addressable event (by AddressPointer or NostrEvent) to the list */
|
|
83
|
+
addAddressItem(address, hidden = false) {
|
|
84
|
+
return hidden
|
|
85
|
+
? this.modifyHiddenTags(addAddressPointerTag(address))
|
|
86
|
+
: this.modifyPublicTags(addAddressPointerTag(address));
|
|
87
|
+
}
|
|
88
|
+
/** Removes an addressable event (by AddressPointer or NostrEvent) from the list */
|
|
89
|
+
removeAddressItem(address, hidden = false) {
|
|
90
|
+
return hidden
|
|
91
|
+
? this.modifyHiddenTags(removeAddressPointerTag(address))
|
|
92
|
+
: this.modifyPublicTags(removeAddressPointerTag(address));
|
|
93
|
+
}
|
|
94
|
+
/** Adds a URL "r" tag item to the list */
|
|
95
|
+
addUrlItem(url, hidden = false) {
|
|
96
|
+
return hidden
|
|
97
|
+
? this.modifyHiddenTags(addNameValueTag(["r", url], true))
|
|
98
|
+
: this.modifyPublicTags(addNameValueTag(["r", url], true));
|
|
99
|
+
}
|
|
100
|
+
/** Removes a URL "r" tag item from the list */
|
|
101
|
+
removeUrlItem(url, hidden = false) {
|
|
102
|
+
return hidden
|
|
103
|
+
? this.modifyHiddenTags(removeNameValueTag(["r", url]))
|
|
104
|
+
: this.modifyPublicTags(removeNameValueTag(["r", url]));
|
|
105
|
+
}
|
|
106
|
+
/** Adds a hashtag "t" tag item to the list */
|
|
107
|
+
addHashtagItem(hashtag, hidden = false) {
|
|
108
|
+
const cleanTag = (hashtag.startsWith("#") ? hashtag.slice(1) : hashtag).toLocaleLowerCase();
|
|
109
|
+
return hidden
|
|
110
|
+
? this.modifyHiddenTags(addNameValueTag(["t", cleanTag], true))
|
|
111
|
+
: this.modifyPublicTags(addNameValueTag(["t", cleanTag], true));
|
|
112
|
+
}
|
|
113
|
+
/** Removes a hashtag "t" tag item from the list */
|
|
114
|
+
removeHashtagItem(hashtag, hidden = false) {
|
|
115
|
+
const cleanTag = (hashtag.startsWith("#") ? hashtag.slice(1) : hashtag).toLocaleLowerCase();
|
|
116
|
+
return hidden
|
|
117
|
+
? this.modifyHiddenTags(removeNameValueTag(["t", cleanTag]))
|
|
118
|
+
: this.modifyPublicTags(removeNameValueTag(["t", cleanTag]));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EventFactory } from "applesauce-core/factories";
|
|
2
|
+
import { kinds, KnownEvent, KnownEventTemplate, NostrEvent } from "applesauce-core/helpers";
|
|
3
|
+
import { ProfilePointer } from "applesauce-core/helpers/pointers";
|
|
4
|
+
import { StreamRole } from "../helpers/stream.js";
|
|
5
|
+
export type LiveStreamTemplate = KnownEventTemplate<kinds.LiveEvent>;
|
|
6
|
+
/** A factory class for building NIP-53 live stream events (kind 30311) */
|
|
7
|
+
export declare class LiveStreamFactory extends EventFactory<kinds.LiveEvent, LiveStreamTemplate> {
|
|
8
|
+
/** Creates a new live stream factory with an auto-generated identifier */
|
|
9
|
+
static create(title: string): LiveStreamFactory;
|
|
10
|
+
/** Creates a factory from an existing live stream event for editing */
|
|
11
|
+
static modify(event: NostrEvent | KnownEvent<kinds.LiveEvent>): LiveStreamFactory;
|
|
12
|
+
/** Sets the "d" identifier tag */
|
|
13
|
+
identifier(id: string): this;
|
|
14
|
+
/** Sets the title of the live stream */
|
|
15
|
+
title(title: string): this;
|
|
16
|
+
/** Sets the summary/description of the live stream */
|
|
17
|
+
summary(summary: string): this;
|
|
18
|
+
/** Sets the preview image for the live stream */
|
|
19
|
+
image(url: string): this;
|
|
20
|
+
/** Sets the streaming URL */
|
|
21
|
+
streamingUrl(url: string | URL): this;
|
|
22
|
+
/** Sets the recording URL (typically after the stream ends) */
|
|
23
|
+
recordingUrl(url: string | URL): this;
|
|
24
|
+
/** Sets the start time of the stream */
|
|
25
|
+
startTime(time: number | Date): this;
|
|
26
|
+
/** Sets the end time of the stream */
|
|
27
|
+
endTime(time: number | Date): this;
|
|
28
|
+
/** Sets the status of the stream */
|
|
29
|
+
status(status: "planned" | "live" | "ended"): this;
|
|
30
|
+
/** Sets the host of the stream */
|
|
31
|
+
host(user: ProfilePointer): this;
|
|
32
|
+
/** Adds a participant to the stream with a role */
|
|
33
|
+
addParticipant(user: ProfilePointer, role: StreamRole): this;
|
|
34
|
+
/** Removes a participant from the stream */
|
|
35
|
+
removeParticipant(pubkey: string): this;
|
|
36
|
+
/** Adds a relay to the stream's relay list */
|
|
37
|
+
addRelay(relay: string | URL): this;
|
|
38
|
+
/** Removes a relay from the stream's relay list */
|
|
39
|
+
removeRelay(relay: string | URL): this;
|
|
40
|
+
/** Sets the pinned live chat message */
|
|
41
|
+
pinnedMessage(eventId: string): this;
|
|
42
|
+
/** Removes the pinned live chat message */
|
|
43
|
+
removePinnedMessage(): this;
|
|
44
|
+
/** Adds a hashtag "t" tag to the stream */
|
|
45
|
+
addHashtag(hashtag: string): this;
|
|
46
|
+
/** Removes a hashtag from the stream */
|
|
47
|
+
removeHashtag(hashtag: string): this;
|
|
48
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { EventFactory, blankEventTemplate, toEventTemplate } from "applesauce-core/factories";
|
|
2
|
+
import { isKind, kinds } from "applesauce-core/helpers";
|
|
3
|
+
import { includeReplaceableIdentifier } from "applesauce-core/operations/index";
|
|
4
|
+
import { nanoid } from "nanoid";
|
|
5
|
+
import * as Stream from "../operations/stream.js";
|
|
6
|
+
/** A factory class for building NIP-53 live stream events (kind 30311) */
|
|
7
|
+
export class LiveStreamFactory extends EventFactory {
|
|
8
|
+
/** Creates a new live stream factory with an auto-generated identifier */
|
|
9
|
+
static create(title) {
|
|
10
|
+
return new LiveStreamFactory((res) => res(blankEventTemplate(kinds.LiveEvent))).identifier(nanoid()).title(title);
|
|
11
|
+
}
|
|
12
|
+
/** Creates a factory from an existing live stream event for editing */
|
|
13
|
+
static modify(event) {
|
|
14
|
+
if (!isKind(event, kinds.LiveEvent))
|
|
15
|
+
throw new Error("Event is not a live stream event");
|
|
16
|
+
return new LiveStreamFactory((res) => res(toEventTemplate(event)));
|
|
17
|
+
}
|
|
18
|
+
/** Sets the "d" identifier tag */
|
|
19
|
+
identifier(id) {
|
|
20
|
+
return this.chain(includeReplaceableIdentifier(id));
|
|
21
|
+
}
|
|
22
|
+
/** Sets the title of the live stream */
|
|
23
|
+
title(title) {
|
|
24
|
+
return this.chain(Stream.setTitle(title));
|
|
25
|
+
}
|
|
26
|
+
/** Sets the summary/description of the live stream */
|
|
27
|
+
summary(summary) {
|
|
28
|
+
return this.chain(Stream.setSummary(summary));
|
|
29
|
+
}
|
|
30
|
+
/** Sets the preview image for the live stream */
|
|
31
|
+
image(url) {
|
|
32
|
+
return this.chain(Stream.setImage(url));
|
|
33
|
+
}
|
|
34
|
+
/** Sets the streaming URL */
|
|
35
|
+
streamingUrl(url) {
|
|
36
|
+
return this.chain(Stream.setStreamingUrl(url));
|
|
37
|
+
}
|
|
38
|
+
/** Sets the recording URL (typically after the stream ends) */
|
|
39
|
+
recordingUrl(url) {
|
|
40
|
+
return this.chain(Stream.setRecordingUrl(url));
|
|
41
|
+
}
|
|
42
|
+
/** Sets the start time of the stream */
|
|
43
|
+
startTime(time) {
|
|
44
|
+
return this.chain(Stream.setStartTime(time));
|
|
45
|
+
}
|
|
46
|
+
/** Sets the end time of the stream */
|
|
47
|
+
endTime(time) {
|
|
48
|
+
return this.chain(Stream.setEndTime(time));
|
|
49
|
+
}
|
|
50
|
+
/** Sets the status of the stream */
|
|
51
|
+
status(status) {
|
|
52
|
+
return this.chain(Stream.setStatus(status));
|
|
53
|
+
}
|
|
54
|
+
/** Sets the host of the stream */
|
|
55
|
+
host(user) {
|
|
56
|
+
return this.chain(Stream.setHost(user));
|
|
57
|
+
}
|
|
58
|
+
/** Adds a participant to the stream with a role */
|
|
59
|
+
addParticipant(user, role) {
|
|
60
|
+
return this.chain(Stream.addParticipant(user, role));
|
|
61
|
+
}
|
|
62
|
+
/** Removes a participant from the stream */
|
|
63
|
+
removeParticipant(pubkey) {
|
|
64
|
+
return this.chain(Stream.removeParticipant(pubkey));
|
|
65
|
+
}
|
|
66
|
+
/** Adds a relay to the stream's relay list */
|
|
67
|
+
addRelay(relay) {
|
|
68
|
+
return this.chain(Stream.addRelay(relay));
|
|
69
|
+
}
|
|
70
|
+
/** Removes a relay from the stream's relay list */
|
|
71
|
+
removeRelay(relay) {
|
|
72
|
+
return this.chain(Stream.removeRelay(relay));
|
|
73
|
+
}
|
|
74
|
+
/** Sets the pinned live chat message */
|
|
75
|
+
pinnedMessage(eventId) {
|
|
76
|
+
return this.chain(Stream.setPinnedMessage(eventId));
|
|
77
|
+
}
|
|
78
|
+
/** Removes the pinned live chat message */
|
|
79
|
+
removePinnedMessage() {
|
|
80
|
+
return this.chain(Stream.removePinnedMessage());
|
|
81
|
+
}
|
|
82
|
+
/** Adds a hashtag "t" tag to the stream */
|
|
83
|
+
addHashtag(hashtag) {
|
|
84
|
+
return this.chain(Stream.addHashtag(hashtag));
|
|
85
|
+
}
|
|
86
|
+
/** Removes a hashtag from the stream */
|
|
87
|
+
removeHashtag(hashtag) {
|
|
88
|
+
return this.chain(Stream.removeHashtag(hashtag));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { kinds, KnownEvent, KnownEventTemplate, NostrEvent } from "applesauce-core/helpers";
|
|
2
|
+
import { EventPointer, ProfilePointer } from "applesauce-core/helpers/pointers";
|
|
3
|
+
import { NIP51UserListFactory } from "./list.js";
|
|
4
|
+
export type MuteListTemplate = KnownEventTemplate<kinds.Mutelist>;
|
|
5
|
+
/** A factory class for building kind 10000 mute list events */
|
|
6
|
+
export declare class MuteListFactory extends NIP51UserListFactory<kinds.Mutelist, MuteListTemplate> {
|
|
7
|
+
/** Creates a new mute list factory */
|
|
8
|
+
static create(): MuteListFactory;
|
|
9
|
+
/** Creates a new mute list factory from an existing mute list event */
|
|
10
|
+
static modify(event: NostrEvent | KnownEvent<kinds.Mutelist>): MuteListFactory;
|
|
11
|
+
/** Mutes a thread by event id or EventPointer */
|
|
12
|
+
muteThread(thread: string | NostrEvent | EventPointer, hidden?: boolean): this;
|
|
13
|
+
/** Unmutes a thread by event id or EventPointer */
|
|
14
|
+
unmuteThread(thread: string | EventPointer, hidden?: boolean): this;
|
|
15
|
+
/** Mutes a word */
|
|
16
|
+
muteWord(word: string, hidden?: boolean): this;
|
|
17
|
+
/** Unmutes a word */
|
|
18
|
+
unmuteWord(word: string, hidden?: boolean): this;
|
|
19
|
+
/** Mutes a hashtag */
|
|
20
|
+
muteHashtag(hashtag: string, hidden?: boolean): this;
|
|
21
|
+
/** Unmutes a hashtag */
|
|
22
|
+
unmuteHashtag(hashtag: string, hidden?: boolean): this;
|
|
23
|
+
/** Mutes a pubkey — semantic alias for addUser() */
|
|
24
|
+
mutePubkey(pubkey: string | ProfilePointer, hidden?: boolean): this;
|
|
25
|
+
/** Unmutes a pubkey — semantic alias for removeUser() */
|
|
26
|
+
unmutePubkey(pubkey: string | ProfilePointer, hidden?: boolean): this;
|
|
27
|
+
}
|