applesauce-actions 0.0.0-next-20251209200210 → 0.0.0-next-20251231055351
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 +3 -3
- package/dist/action-runner.d.ts +53 -0
- package/dist/action-runner.js +91 -0
- package/dist/actions/app-data.d.ts +1 -1
- package/dist/actions/app-data.js +5 -5
- package/dist/actions/blocked-relays.d.ts +1 -6
- package/dist/actions/blocked-relays.js +30 -36
- package/dist/actions/blossom.d.ts +1 -1
- package/dist/actions/blossom.js +25 -32
- package/dist/actions/bookmarks.d.ts +4 -3
- package/dist/actions/bookmarks.js +64 -55
- package/dist/actions/calendar.d.ts +6 -3
- package/dist/actions/calendar.js +26 -12
- package/dist/actions/comment.d.ts +10 -0
- package/dist/actions/comment.js +43 -0
- package/dist/actions/contacts.d.ts +3 -3
- package/dist/actions/contacts.js +27 -27
- package/dist/actions/direct-message-relays.d.ts +7 -0
- package/dist/actions/direct-message-relays.js +47 -0
- package/dist/actions/favorite-relays.d.ts +1 -1
- package/dist/actions/favorite-relays.js +34 -33
- package/dist/actions/follow-sets.d.ts +1 -3
- package/dist/actions/follow-sets.js +32 -31
- package/dist/actions/index.d.ts +2 -1
- package/dist/actions/index.js +2 -1
- package/dist/actions/legacy-messages.d.ts +2 -2
- package/dist/actions/legacy-messages.js +24 -9
- package/dist/actions/lists.d.ts +1 -1
- package/dist/actions/lists.js +5 -3
- package/dist/actions/mailboxes.d.ts +1 -1
- package/dist/actions/mailboxes.js +31 -29
- package/dist/actions/mute.d.ts +1 -1
- package/dist/actions/mute.js +32 -60
- package/dist/actions/pins.d.ts +1 -3
- package/dist/actions/pins.js +20 -26
- package/dist/actions/profile.d.ts +1 -1
- package/dist/actions/profile.js +14 -9
- package/dist/actions/relay-sets.d.ts +1 -1
- package/dist/actions/relay-sets.js +36 -29
- package/dist/actions/search-relays.d.ts +1 -1
- package/dist/actions/search-relays.js +19 -19
- package/dist/actions/wrapped-messages.d.ts +4 -2
- package/dist/actions/wrapped-messages.js +35 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/dist/action-hub.d.ts +0 -35
- package/dist/action-hub.js +0 -51
- package/dist/actions/dm-relays.d.ts +0 -7
- package/dist/actions/dm-relays.js +0 -38
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { kinds } from "applesauce-core/helpers/event";
|
|
2
|
-
import { modifyPublicTags } from "applesauce-core/operations/tags";
|
|
3
|
-
import { addRelayTag, removeRelayTag } from "applesauce-core/operations/tag/relay";
|
|
4
|
-
function getDMRelaysEvent(events, self) {
|
|
5
|
-
const event = events.getReplaceable(kinds.DirectMessageRelaysList, self);
|
|
6
|
-
if (!event)
|
|
7
|
-
throw new Error("Can't find DM relays event");
|
|
8
|
-
return event;
|
|
9
|
-
}
|
|
10
|
-
/** An action that adds a relay to the 10050 DM relays event */
|
|
11
|
-
export function AddDMRelay(relay) {
|
|
12
|
-
return async function* ({ events, factory, self }) {
|
|
13
|
-
const dmRelays = getDMRelaysEvent(events, self);
|
|
14
|
-
const operation = Array.isArray(relay) ? relay.map((r) => addRelayTag(r)) : addRelayTag(relay);
|
|
15
|
-
const draft = await factory.modifyTags(dmRelays, operation);
|
|
16
|
-
yield await factory.sign(draft);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/** An action that removes a relay from the 10050 DM relays event */
|
|
20
|
-
export function RemoveDMRelay(relay) {
|
|
21
|
-
return async function* ({ events, factory, self }) {
|
|
22
|
-
const dmRelays = getDMRelaysEvent(events, self);
|
|
23
|
-
const operation = Array.isArray(relay) ? relay.map((r) => removeRelayTag(r)) : removeRelayTag(relay);
|
|
24
|
-
const draft = await factory.modifyTags(dmRelays, operation);
|
|
25
|
-
yield await factory.sign(draft);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/** Creates a new DM relays event */
|
|
29
|
-
export function NewDMRelays(relays) {
|
|
30
|
-
return async function* ({ events, factory, self }) {
|
|
31
|
-
const dmRelays = events.getReplaceable(kinds.DirectMessageRelaysList, self);
|
|
32
|
-
if (dmRelays)
|
|
33
|
-
throw new Error("DM relays event already exists");
|
|
34
|
-
const operations = relays?.map((r) => addRelayTag(r)) ?? [];
|
|
35
|
-
const draft = await factory.build({ kind: kinds.DirectMessageRelaysList }, modifyPublicTags(...operations));
|
|
36
|
-
yield await factory.sign(draft);
|
|
37
|
-
};
|
|
38
|
-
}
|