applesauce-actions 0.0.0-next-20250930093922 → 0.0.0-next-20251203172109

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.
@@ -1,6 +1,6 @@
1
1
  import { Observable } from "rxjs";
2
- import { NostrEvent } from "nostr-tools";
3
- import { EventFactory } from "applesauce-factory";
2
+ import { NostrEvent } from "applesauce-core/helpers/event";
3
+ import { EventFactory } from "applesauce-core";
4
4
  import { IEventStoreActions, IEventStoreRead } from "applesauce-core";
5
5
  /** A callback used to tell the upstream app to publish an event */
6
6
  export type PublishMethod = (event: NostrEvent) => void | Promise<void>;
@@ -1,6 +1,6 @@
1
- import { APP_DATA_KIND, getAppDataEncryption } from "applesauce-core/helpers/app-data";
2
- import { AppDataBlueprint } from "applesauce-factory/blueprints/app-data";
3
- import { AppData } from "applesauce-factory/operations";
1
+ import { AppDataBlueprint } from "applesauce-common/blueprints/app-data";
2
+ import { APP_DATA_KIND, getAppDataEncryption } from "applesauce-common/helpers/app-data";
3
+ import * as AppData from "applesauce-common/operations/app-data";
4
4
  export function UpdateAppData(identifier, data) {
5
5
  return async function* ({ self, factory, events }) {
6
6
  const event = events.getReplaceable(APP_DATA_KIND, self, identifier);
@@ -1,6 +1,6 @@
1
- import { modifyHiddenTags, modifyPublicTags } from "applesauce-factory/operations";
2
- import { addRelayTag, removeRelayTag } from "applesauce-factory/operations/tag/relay";
3
- import { kinds } from "nostr-tools";
1
+ import { kinds } from "applesauce-core/helpers/event";
2
+ import { modifyHiddenTags, modifyPublicTags } from "applesauce-core/operations";
3
+ import { addRelayTag, removeRelayTag } from "applesauce-core/operations/tag/relay";
4
4
  function getBlockedRelaysEvent(events, self) {
5
5
  const event = events.getReplaceable(kinds.BlockedRelaysList, self);
6
6
  if (!event)
@@ -1,15 +1,14 @@
1
- import { BLOSSOM_SERVER_LIST_KIND } from "applesauce-core/helpers/blossom";
2
- import { modifyPublicTags, modifyTags } from "applesauce-factory/operations";
3
- import { addBlossomServerTag, removeBlossomServerTag } from "applesauce-factory/operations/tag/blossom";
1
+ import { BLOSSOM_SERVER_LIST_KIND } from "applesauce-common/helpers/blossom";
2
+ import { addBlossomServer, removeBlossomServer } from "applesauce-common/operations/blossom";
4
3
  /** An action that adds a server to the Blossom servers event */
5
4
  export function AddBlossomServer(server) {
6
5
  return async function* ({ events, factory, self }) {
7
6
  const servers = events.getReplaceable(BLOSSOM_SERVER_LIST_KIND, self);
8
- const operation = Array.isArray(server) ? server.map((s) => addBlossomServerTag(s)) : addBlossomServerTag(server);
7
+ const operations = Array.isArray(server) ? server.map((s) => addBlossomServer(s)) : [addBlossomServer(server)];
9
8
  // Modify or build new event
10
9
  const draft = servers
11
- ? await factory.modifyTags(servers, operation)
12
- : await factory.build({ kind: BLOSSOM_SERVER_LIST_KIND }, modifyTags(operation));
10
+ ? await factory.modify(servers, ...operations)
11
+ : await factory.build({ kind: BLOSSOM_SERVER_LIST_KIND }, ...operations);
13
12
  yield await factory.sign(draft);
14
13
  };
15
14
  }
@@ -17,13 +16,13 @@ export function AddBlossomServer(server) {
17
16
  export function RemoveBlossomServer(server) {
18
17
  return async function* ({ events, factory, self }) {
19
18
  const servers = events.getReplaceable(BLOSSOM_SERVER_LIST_KIND, self);
20
- const operation = Array.isArray(server)
21
- ? server.map((s) => removeBlossomServerTag(s))
22
- : removeBlossomServerTag(server);
19
+ const operations = Array.isArray(server)
20
+ ? server.map((s) => removeBlossomServer(s))
21
+ : [removeBlossomServer(server)];
23
22
  // Modify or build new event
24
23
  const draft = servers
25
- ? await factory.modifyTags(servers, operation)
26
- : await factory.build({ kind: BLOSSOM_SERVER_LIST_KIND }, modifyTags(operation));
24
+ ? await factory.modify(servers, ...operations)
25
+ : await factory.build({ kind: BLOSSOM_SERVER_LIST_KIND }, ...operations);
27
26
  yield await factory.sign(draft);
28
27
  };
29
28
  }
@@ -31,11 +30,11 @@ export function RemoveBlossomServer(server) {
31
30
  export function SetDefaultBlossomServer(server) {
32
31
  return async function* ({ events, factory, self }) {
33
32
  const servers = events.getReplaceable(BLOSSOM_SERVER_LIST_KIND, self);
34
- const prependTag = (tag) => (tags) => [tag, ...tags];
35
- const operations = [removeBlossomServerTag(server), prependTag(["server", String(server)])];
33
+ const prependTag = (tag) => (draft) => ({ ...draft, tags: [tag, ...draft.tags] });
34
+ const operations = [removeBlossomServer(server), prependTag(["server", String(server)])];
36
35
  const draft = servers
37
- ? await factory.modifyTags(servers, operations)
38
- : await factory.build({ kind: BLOSSOM_SERVER_LIST_KIND }, modifyTags(...operations));
36
+ ? await factory.modify(servers, ...operations)
37
+ : await factory.build({ kind: BLOSSOM_SERVER_LIST_KIND }, ...operations);
39
38
  yield await factory.sign(draft);
40
39
  };
41
40
  }
@@ -45,8 +44,8 @@ export function NewBlossomServers(servers) {
45
44
  const existing = events.getReplaceable(BLOSSOM_SERVER_LIST_KIND, self);
46
45
  if (existing)
47
46
  throw new Error("Blossom servers event already exists");
48
- const operations = servers ? servers.map((s) => addBlossomServerTag(s)) : [];
49
- const draft = await factory.build({ kind: BLOSSOM_SERVER_LIST_KIND }, modifyPublicTags(...operations));
47
+ const operations = servers ? servers.map((s) => addBlossomServer(s)) : [];
48
+ const draft = await factory.build({ kind: BLOSSOM_SERVER_LIST_KIND }, ...operations);
50
49
  yield await factory.sign(draft);
51
50
  };
52
51
  }
@@ -1,4 +1,4 @@
1
- import { NostrEvent } from "nostr-tools";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
2
  import { Action } from "../action-hub.js";
3
3
  /**
4
4
  * An action that adds a note or article to the bookmark list or a bookmark set
@@ -1,6 +1,7 @@
1
- import { modifyHiddenTags, modifyPublicTags, List } from "applesauce-factory/operations";
2
- import { addEventBookmarkTag, removeEventBookmarkTag } from "applesauce-factory/operations/tag";
3
- import { kinds } from "nostr-tools";
1
+ import * as List from "applesauce-common/operations/list";
2
+ import { addEventBookmarkTag, removeEventBookmarkTag } from "applesauce-common/operations/tag/bookmarks";
3
+ import { kinds } from "applesauce-core/helpers/event";
4
+ import { modifyHiddenTags, modifyPublicTags } from "applesauce-core/operations";
4
5
  /**
5
6
  * An action that adds a note or article to the bookmark list or a bookmark set
6
7
  * @param event the event to bookmark
@@ -1,4 +1,4 @@
1
- import { NostrEvent } from "nostr-tools";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
2
  import { Action } from "../action-hub.js";
3
3
  /** Adds a calendar event to a calendar */
4
4
  export declare function AddEventToCalendar(calendar: NostrEvent, event: NostrEvent): Action;
@@ -1,6 +1,6 @@
1
- import { DATE_BASED_CALENDAR_EVENT_KIND, TIME_BASED_CALENDAR_EVENT_KIND } from "applesauce-core/helpers/calendar-event";
2
- import { Calendar } from "applesauce-factory/operations";
3
- import { kinds } from "nostr-tools";
1
+ import { DATE_BASED_CALENDAR_EVENT_KIND, TIME_BASED_CALENDAR_EVENT_KIND, } from "applesauce-common/helpers/calendar-event";
2
+ import { kinds } from "applesauce-core/helpers/event";
3
+ import * as Calendar from "applesauce-common/operations/calendar";
4
4
  /** Adds a calendar event to a calendar */
5
5
  export function AddEventToCalendar(calendar, event) {
6
6
  if (calendar.kind !== kinds.Calendar)
@@ -1,4 +1,4 @@
1
- import { ProfilePointer } from "nostr-tools/nip19";
1
+ import { ProfilePointer } from "applesauce-core/helpers/pointers";
2
2
  import { Action } from "../action-hub.js";
3
3
  /** An action that adds a pubkey to a users contacts event */
4
4
  export declare function FollowUser(pubkey: string, relay?: string, hidden?: boolean): Action;
@@ -1,12 +1,12 @@
1
- import { modifyHiddenTags, modifyPublicTags } from "applesauce-factory/operations";
2
- import { addPubkeyTag, removePubkeyTag } from "applesauce-factory/operations/tag";
3
- import { kinds } from "nostr-tools";
1
+ import { kinds } from "applesauce-core/helpers/event";
2
+ import { modifyHiddenTags, modifyPublicTags } from "applesauce-core/operations";
3
+ import { addProfilePointerTag, removeProfilePointerTag } from "applesauce-core/operations/tag/common";
4
4
  /** An action that adds a pubkey to a users contacts event */
5
5
  export function FollowUser(pubkey, relay, hidden = false) {
6
6
  return async function* ({ events, factory, self }) {
7
7
  let contacts = events.getReplaceable(kinds.Contacts, self);
8
8
  const pointer = { pubkey, relays: relay ? [relay] : undefined };
9
- const operation = addPubkeyTag(pointer);
9
+ const operation = addProfilePointerTag(pointer);
10
10
  let draft;
11
11
  // No contact list, create one
12
12
  if (!contacts)
@@ -23,7 +23,7 @@ export function UnfollowUser(user, hidden = false) {
23
23
  // Unable to find a contacts event, so we can't unfollow
24
24
  if (!contacts)
25
25
  return;
26
- const operation = removePubkeyTag(user);
26
+ const operation = removeProfilePointerTag(user);
27
27
  const draft = await factory.modifyTags(contacts, hidden ? { hidden: operation } : operation);
28
28
  yield await factory.sign(draft);
29
29
  };
@@ -34,7 +34,7 @@ export function NewContacts(pubkeys) {
34
34
  const contacts = events.getReplaceable(kinds.Contacts, self);
35
35
  if (contacts)
36
36
  throw new Error("Contact list already exists");
37
- const draft = await factory.build({ kind: kinds.Contacts }, pubkeys ? modifyPublicTags(...pubkeys.map((p) => addPubkeyTag(p))) : undefined);
37
+ const draft = await factory.build({ kind: kinds.Contacts }, pubkeys ? modifyPublicTags(...pubkeys.map((p) => addProfilePointerTag(p))) : undefined);
38
38
  yield await factory.sign(draft);
39
39
  };
40
40
  }
@@ -1,6 +1,6 @@
1
- import { modifyPublicTags } from "applesauce-factory/operations";
2
- import { addRelayTag, removeRelayTag } from "applesauce-factory/operations/tag/relay";
3
- import { kinds } from "nostr-tools";
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
4
  function getDMRelaysEvent(events, self) {
5
5
  const event = events.getReplaceable(kinds.DirectMessageRelaysList, self);
6
6
  if (!event)
@@ -1,4 +1,4 @@
1
- import { AddressPointer } from "nostr-tools/nip19";
1
+ import { AddressPointer } from "applesauce-core/helpers/pointers";
2
2
  import { Action } from "../action-hub.js";
3
3
  /** An action that adds a relay to the 10012 favorite relays event */
4
4
  export declare function AddFavoriteRelay(relay: string | string[], hidden?: boolean): Action;
@@ -1,6 +1,7 @@
1
1
  import { FAVORITE_RELAYS_KIND } from "applesauce-core/helpers/lists";
2
- import { modifyHiddenTags, modifyPublicTags } from "applesauce-factory/operations";
3
- import { addAddressTag, addRelayTag, removeAddressTag, removeRelayTag } from "applesauce-factory/operations/tag";
2
+ import { modifyHiddenTags, modifyPublicTags } from "applesauce-core/operations";
3
+ import { addAddressPointerTag, removeAddressPointerTag } from "applesauce-core/operations/tag/common";
4
+ import { addRelayTag, removeRelayTag } from "applesauce-core/operations/tag/relay";
4
5
  function getFavoriteRelaysEvent(events, self) {
5
6
  const event = events.getReplaceable(FAVORITE_RELAYS_KIND, self);
6
7
  if (!event)
@@ -29,7 +30,7 @@ export function RemoveFavoriteRelay(relay, hidden = false) {
29
30
  export function AddFavoriteRelaySet(addr, hidden = false) {
30
31
  return async function* ({ events, factory, self }) {
31
32
  const favorites = getFavoriteRelaysEvent(events, self);
32
- const operation = Array.isArray(addr) ? addr.map((a) => addAddressTag(a)) : addAddressTag(addr);
33
+ const operation = Array.isArray(addr) ? addr.map((a) => addAddressPointerTag(a)) : addAddressPointerTag(addr);
33
34
  const draft = await factory.modifyTags(favorites, hidden ? { hidden: operation } : operation);
34
35
  yield await factory.sign(draft);
35
36
  };
@@ -38,7 +39,7 @@ export function AddFavoriteRelaySet(addr, hidden = false) {
38
39
  export function RemoveFavoriteRelaySet(addr, hidden = false) {
39
40
  return async function* ({ events, factory, self }) {
40
41
  const favorites = getFavoriteRelaysEvent(events, self);
41
- const operation = Array.isArray(addr) ? addr.map((a) => removeAddressTag(a)) : removeAddressTag(addr);
42
+ const operation = Array.isArray(addr) ? addr.map((a) => removeAddressPointerTag(a)) : removeAddressPointerTag(addr);
42
43
  const draft = await factory.modifyTags(favorites, hidden ? { hidden: operation } : operation);
43
44
  yield await factory.sign(draft);
44
45
  };
@@ -61,13 +62,13 @@ export function NewFavoriteRelays(relays, sets) {
61
62
  hiddenOperations.push(...(relays?.hidden ?? []).map((r) => addRelayTag(r)));
62
63
  }
63
64
  if (Array.isArray(sets)) {
64
- publicOperations.push(...sets.map((s) => addAddressTag(s)));
65
+ publicOperations.push(...sets.map((s) => addAddressPointerTag(s)));
65
66
  }
66
67
  else {
67
68
  if (sets?.public)
68
- publicOperations.push(...(sets?.public ?? []).map((s) => addAddressTag(s)));
69
+ publicOperations.push(...(sets?.public ?? []).map((s) => addAddressPointerTag(s)));
69
70
  if (sets?.hidden)
70
- hiddenOperations.push(...(sets?.hidden ?? []).map((s) => addAddressTag(s)));
71
+ hiddenOperations.push(...(sets?.hidden ?? []).map((s) => addAddressPointerTag(s)));
71
72
  }
72
73
  const draft = await factory.build({ kind: FAVORITE_RELAYS_KIND }, publicOperations.length ? modifyPublicTags(...publicOperations) : undefined, hiddenOperations.length ? modifyHiddenTags(...hiddenOperations) : undefined);
73
74
  yield await factory.sign(draft);
@@ -1,5 +1,5 @@
1
- import { NostrEvent } from "nostr-tools";
2
- import { ProfilePointer } from "nostr-tools/nip19";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
+ import { ProfilePointer } from "applesauce-core/helpers/pointers";
3
3
  import { Action } from "../action-hub.js";
4
4
  /**
5
5
  * An action that creates a new follow set
@@ -1,6 +1,7 @@
1
- import { modifyHiddenTags, modifyPublicTags, List } from "applesauce-factory/operations";
2
- import { addPubkeyTag, removePubkeyTag } from "applesauce-factory/operations/tag";
3
- import { kinds } from "nostr-tools";
1
+ import * as List from "applesauce-common/operations/list";
2
+ import { kinds } from "applesauce-core/helpers/event";
3
+ import { modifyHiddenTags, modifyPublicTags } from "applesauce-core/operations";
4
+ import { addProfilePointerTag, removeProfilePointerTag } from "applesauce-core/operations/tag/common";
4
5
  function getFollowSetEvent(events, self, identifier) {
5
6
  const set = typeof identifier === "string" ? events.getReplaceable(kinds.Followsets, self, identifier) : identifier;
6
7
  if (!set)
@@ -19,7 +20,7 @@ export function CreateFollowSet(title, options) {
19
20
  // set list information
20
21
  List.setTitle(title), options?.description ? List.setDescription(options.description) : undefined, options?.image ? List.setImage(options.image) : undefined,
21
22
  // add pubkey tags
22
- options?.public ? modifyPublicTags(...options.public.map((p) => addPubkeyTag(p))) : undefined, options?.hidden ? modifyHiddenTags(...options.hidden.map((p) => addPubkeyTag(p))) : undefined);
23
+ options?.public ? modifyPublicTags(...options.public.map((p) => addProfilePointerTag(p))) : undefined, options?.hidden ? modifyHiddenTags(...options.hidden.map((p) => addProfilePointerTag(p))) : undefined);
23
24
  yield await factory.sign(draft);
24
25
  };
25
26
  }
@@ -33,7 +34,9 @@ export function CreateFollowSet(title, options) {
33
34
  export function AddUserToFollowSet(pubkey, identifier, hidden = false) {
34
35
  return async function* ({ events, factory, self }) {
35
36
  const follows = getFollowSetEvent(events, self, identifier);
36
- const operations = Array.isArray(pubkey) ? pubkey.map((p) => addPubkeyTag(p)) : addPubkeyTag(pubkey);
37
+ const operations = Array.isArray(pubkey)
38
+ ? pubkey.map((p) => addProfilePointerTag(p))
39
+ : addProfilePointerTag(pubkey);
37
40
  const draft = await factory.modifyTags(follows, hidden ? { hidden: operations } : operations);
38
41
  yield await factory.sign(draft);
39
42
  };
@@ -48,7 +51,9 @@ export function AddUserToFollowSet(pubkey, identifier, hidden = false) {
48
51
  export function RemoveUserFromFollowSet(pubkey, identifier, hidden = false) {
49
52
  return async function* ({ events, factory, self }) {
50
53
  const follows = getFollowSetEvent(events, self, identifier);
51
- const operations = Array.isArray(pubkey) ? pubkey.map((p) => removePubkeyTag(p)) : removePubkeyTag(pubkey);
54
+ const operations = Array.isArray(pubkey)
55
+ ? pubkey.map((p) => removeProfilePointerTag(p))
56
+ : removeProfilePointerTag(pubkey);
52
57
  const draft = await factory.modifyTags(follows, hidden ? { hidden: operations } : operations);
53
58
  yield await factory.sign(draft);
54
59
  };
@@ -1,5 +1,5 @@
1
- import { LegacyMessageBlueprintOptions } from "applesauce-factory/blueprints";
2
- import { NostrEvent } from "nostr-tools";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
+ import { LegacyMessageBlueprintOptions } from "applesauce-common/blueprints";
3
3
  import { Action } from "../action-hub.js";
4
4
  /** Sends a legacy NIP-04 message to a recipient */
5
5
  export declare function SendLegacyMessage(recipient: string, message: string, opts?: LegacyMessageBlueprintOptions): Action;
@@ -1,5 +1,5 @@
1
- import { LegacyMessageBlueprint, LegacyMessageReplyBlueprint, } from "applesauce-factory/blueprints";
2
- import { kinds } from "nostr-tools";
1
+ import { kinds } from "applesauce-core/helpers/event";
2
+ import { LegacyMessageBlueprint, LegacyMessageReplyBlueprint, } from "applesauce-common/blueprints";
3
3
  /** Sends a legacy NIP-04 message to a recipient */
4
4
  export function SendLegacyMessage(recipient, message, opts) {
5
5
  return async function* ({ factory }) {
@@ -1,5 +1,5 @@
1
- import { NostrEvent } from "nostr-tools";
2
- import { AddressPointer } from "nostr-tools/nip19";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
+ import { AddressPointer } from "applesauce-core/helpers/pointers";
3
3
  import { Action } from "../action-hub.js";
4
4
  /** An action that sets or removes a NIP-15 list information */
5
5
  export declare function SetListMetadata(list: NostrEvent | AddressPointer, info: {
@@ -1,5 +1,5 @@
1
- import { isAddressPointer } from "applesauce-core/helpers";
2
- import { List } from "applesauce-factory/operations";
1
+ import * as List from "applesauce-common/operations/list";
2
+ import { isAddressPointer } from "applesauce-core/helpers/pointers";
3
3
  function getList(events, address) {
4
4
  const list = isAddressPointer(address)
5
5
  ? events.getReplaceable(address.kind, address.pubkey, address.identifier)
@@ -1,13 +1,12 @@
1
- import { kinds } from "nostr-tools";
2
- import { addInboxRelay, addOutboxRelay, removeInboxRelay, removeOutboxRelay } from "applesauce-factory/operations/tag";
3
- import { modifyPublicTags } from "applesauce-factory/operations";
1
+ import { kinds } from "applesauce-core/helpers/event";
2
+ import { addInboxRelay, addOutboxRelay, removeInboxRelay, removeOutboxRelay, } from "applesauce-core/operations/mailboxes";
4
3
  /** An action to create a new kind 10002 relay list event */
5
4
  export function CreateMailboxes(inboxes, outboxes) {
6
5
  return async function* ({ events, factory, self }) {
7
6
  const mailboxes = events.getReplaceable(kinds.RelayList, self);
8
7
  if (mailboxes)
9
8
  throw new Error("Mailbox event already exists");
10
- const draft = await factory.build({ kind: kinds.RelayList }, modifyPublicTags(...inboxes.map(addInboxRelay), ...outboxes.map(addOutboxRelay)));
9
+ const draft = await factory.build({ kind: kinds.RelayList }, ...inboxes.map(addInboxRelay), ...outboxes.map(addOutboxRelay));
11
10
  const signed = await factory.sign(draft);
12
11
  yield signed;
13
12
  };
@@ -19,8 +18,8 @@ export function AddInboxRelay(relay) {
19
18
  relay = [relay];
20
19
  const mailboxes = events.getReplaceable(kinds.RelayList, self);
21
20
  const draft = mailboxes
22
- ? await factory.modifyTags(mailboxes, ...relay.map(addInboxRelay))
23
- : await factory.build({ kind: kinds.RelayList }, modifyPublicTags(...relay.map(addInboxRelay)));
21
+ ? await factory.modify(mailboxes, ...relay.map(addInboxRelay))
22
+ : await factory.build({ kind: kinds.RelayList }, ...relay.map(addInboxRelay));
24
23
  const signed = await factory.sign(draft);
25
24
  yield signed;
26
25
  };
@@ -33,7 +32,7 @@ export function RemoveInboxRelay(relay) {
33
32
  const mailboxes = events.getReplaceable(kinds.RelayList, self);
34
33
  if (!mailboxes)
35
34
  return;
36
- const draft = await factory.modifyTags(mailboxes, ...relay.map(removeInboxRelay));
35
+ const draft = await factory.modify(mailboxes, ...relay.map(removeInboxRelay));
37
36
  const signed = await factory.sign(draft);
38
37
  yield signed;
39
38
  };
@@ -45,8 +44,8 @@ export function AddOutboxRelay(relay) {
45
44
  relay = [relay];
46
45
  const mailboxes = events.getReplaceable(kinds.RelayList, self);
47
46
  const draft = mailboxes
48
- ? await factory.modifyTags(mailboxes, ...relay.map(addOutboxRelay))
49
- : await factory.build({ kind: kinds.RelayList }, modifyPublicTags(...relay.map(addOutboxRelay)));
47
+ ? await factory.modify(mailboxes, ...relay.map(addOutboxRelay))
48
+ : await factory.build({ kind: kinds.RelayList }, ...relay.map(addOutboxRelay));
50
49
  const signed = await factory.sign(draft);
51
50
  yield signed;
52
51
  };
@@ -59,7 +58,7 @@ export function RemoveOutboxRelay(relay) {
59
58
  const mailboxes = events.getReplaceable(kinds.RelayList, self);
60
59
  if (!mailboxes)
61
60
  return;
62
- const draft = await factory.modifyTags(mailboxes, ...relay.map(removeOutboxRelay));
61
+ const draft = await factory.modify(mailboxes, ...relay.map(removeOutboxRelay));
63
62
  const signed = await factory.sign(draft);
64
63
  yield signed;
65
64
  };
@@ -1,5 +1,5 @@
1
- import { NostrEvent } from "nostr-tools";
2
- import { EventPointer } from "nostr-tools/nip19";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
+ import { EventPointer } from "applesauce-core/helpers/pointers";
3
3
  import { Action } from "../action-hub.js";
4
4
  /** An action that adds a pubkey to the mute list */
5
5
  export declare function MuteUser(pubkey: string, hidden?: boolean): Action;
@@ -1,5 +1,5 @@
1
- import { addEventTag, addNameValueTag, addPubkeyTag, removeEventTag, removeNameValueTag, removePubkeyTag, } from "applesauce-factory/operations/tag";
2
- import { kinds } from "nostr-tools";
1
+ import { kinds } from "applesauce-core/helpers/event";
2
+ import { addEventPointerTag, addNameValueTag, addProfilePointerTag, removeEventPointerTag, removeNameValueTag, removeProfilePointerTag, } from "applesauce-core/operations/tag/common";
3
3
  function ensureMuteList(events, self) {
4
4
  const mute = events.getReplaceable(kinds.Mutelist, self);
5
5
  if (!mute)
@@ -10,7 +10,7 @@ function ensureMuteList(events, self) {
10
10
  export function MuteUser(pubkey, hidden = false) {
11
11
  return async function* ({ events, factory, self }) {
12
12
  const mute = ensureMuteList(events, self);
13
- const operation = addPubkeyTag(pubkey);
13
+ const operation = addProfilePointerTag(pubkey);
14
14
  const draft = await factory.modifyTags(mute, hidden ? { hidden: operation } : operation);
15
15
  yield await factory.sign(draft);
16
16
  };
@@ -19,7 +19,7 @@ export function MuteUser(pubkey, hidden = false) {
19
19
  export function UnmuteUser(pubkey, hidden = false) {
20
20
  return async function* ({ events, factory, self }) {
21
21
  const mute = ensureMuteList(events, self);
22
- const draft = await factory.modifyTags(mute, hidden ? { hidden: removePubkeyTag(pubkey) } : removePubkeyTag(pubkey));
22
+ const draft = await factory.modifyTags(mute, hidden ? { hidden: removeProfilePointerTag(pubkey) } : removeProfilePointerTag(pubkey));
23
23
  yield await factory.sign(draft);
24
24
  };
25
25
  }
@@ -27,7 +27,7 @@ export function UnmuteUser(pubkey, hidden = false) {
27
27
  export function MuteThread(thread, hidden = false) {
28
28
  return async function* ({ events, factory, self }) {
29
29
  const mute = ensureMuteList(events, self);
30
- const operation = addEventTag(thread);
30
+ const operation = addEventPointerTag(thread);
31
31
  const draft = await factory.modifyTags(mute, hidden ? { hidden: operation } : operation);
32
32
  yield await factory.sign(draft);
33
33
  };
@@ -36,7 +36,7 @@ export function MuteThread(thread, hidden = false) {
36
36
  export function UnmuteThread(thread, hidden = false) {
37
37
  return async function* ({ events, factory, self }) {
38
38
  const mute = ensureMuteList(events, self);
39
- const operation = removeEventTag(thread);
39
+ const operation = removeEventPointerTag(thread);
40
40
  const draft = await factory.modifyTags(mute, hidden ? { hidden: operation } : operation);
41
41
  yield await factory.sign(draft);
42
42
  };
@@ -1,4 +1,4 @@
1
- import { NostrEvent } from "nostr-tools";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
2
  import { Action } from "../action-hub.js";
3
3
  export declare const ALLOWED_PIN_KINDS: number[];
4
4
  /** An action that pins a note to the users pin list */
@@ -1,7 +1,6 @@
1
- import { getReplaceableAddress, isReplaceable } from "applesauce-core/helpers";
2
- import { modifyPublicTags } from "applesauce-factory/operations";
3
- import { addAddressTag, addEventTag, removeAddressTag, removeEventTag } from "applesauce-factory/operations/tag";
4
- import { kinds } from "nostr-tools";
1
+ import { getReplaceableAddress, isReplaceable, kinds } from "applesauce-core/helpers/event";
2
+ import { addAddressPointerTag, addEventPointerTag, removeAddressPointerTag, removeEventPointerTag, } from "applesauce-core/operations/tag/common";
3
+ import { modifyPublicTags } from "applesauce-core/operations/tags";
5
4
  export const ALLOWED_PIN_KINDS = [kinds.ShortTextNote, kinds.LongFormArticle];
6
5
  /** An action that pins a note to the users pin list */
7
6
  export function PinNote(note) {
@@ -9,7 +8,9 @@ export function PinNote(note) {
9
8
  throw new Error(`Event kind ${note.kind} can not be pinned`);
10
9
  return async function* ({ events, factory, self }) {
11
10
  const pins = events.getReplaceable(kinds.Pinlist, self);
12
- const operation = isReplaceable(note.kind) ? addAddressTag(getReplaceableAddress(note)) : addEventTag(note.id);
11
+ const operation = isReplaceable(note.kind)
12
+ ? addAddressPointerTag(getReplaceableAddress(note))
13
+ : addEventPointerTag(note.id);
13
14
  const draft = pins
14
15
  ? await factory.modifyTags(pins, operation)
15
16
  : await factory.build({ kind: kinds.Pinlist }, modifyPublicTags(operation));
@@ -23,8 +24,8 @@ export function UnpinNote(note) {
23
24
  if (!pins)
24
25
  return;
25
26
  const operation = isReplaceable(note.kind)
26
- ? removeAddressTag(getReplaceableAddress(note))
27
- : removeEventTag(note.id);
27
+ ? removeAddressPointerTag(getReplaceableAddress(note))
28
+ : removeEventPointerTag(note.id);
28
29
  const draft = await factory.modifyTags(pins, operation);
29
30
  yield await factory.sign(draft);
30
31
  };
@@ -35,7 +36,7 @@ export function CreatePinList(pins = []) {
35
36
  const existing = events.getReplaceable(kinds.Pinlist, self);
36
37
  if (existing)
37
38
  throw new Error("Pin list already exists");
38
- const draft = await factory.build({ kind: kinds.Pinlist }, modifyPublicTags(...pins.map((event) => addEventTag(event.id))));
39
+ const draft = await factory.build({ kind: kinds.Pinlist }, modifyPublicTags(...pins.map((event) => addEventPointerTag(event.id))));
39
40
  yield await factory.sign(draft);
40
41
  };
41
42
  }
@@ -1,4 +1,4 @@
1
- import { ProfileContent } from "applesauce-core/helpers";
1
+ import { ProfileContent } from "applesauce-core/helpers/profile";
2
2
  import { Action } from "../action-hub.js";
3
3
  /** An action that creates a new kind 0 profile event for a user */
4
4
  export declare function CreateProfile(content: ProfileContent): Action;
@@ -1,5 +1,5 @@
1
- import { kinds } from "nostr-tools";
2
- import { Profile } from "applesauce-factory/operations";
1
+ import { kinds } from "applesauce-core/helpers/event";
2
+ import * as Profile from "applesauce-core/operations/profile";
3
3
  /** An action that creates a new kind 0 profile event for a user */
4
4
  export function CreateProfile(content) {
5
5
  return async function* ({ events, factory, self }) {
@@ -1,4 +1,4 @@
1
- import { NostrEvent } from "nostr-tools";
1
+ import { NostrEvent } from "applesauce-core/helpers/event";
2
2
  import { Action } from "../action-hub.js";
3
3
  /** An action that adds a relay to a relay set*/
4
4
  export declare function AddRelayToRelaySet(relay: string | string[], identifier: NostrEvent | string, hidden?: boolean): Action;
@@ -1,6 +1,7 @@
1
- import { modifyHiddenTags, modifyPublicTags, List } from "applesauce-factory/operations";
2
- import { addRelayTag, removeRelayTag } from "applesauce-factory/operations/tag";
3
- import { kinds } from "nostr-tools";
1
+ import * as List from "applesauce-common/operations/list";
2
+ import { kinds } from "applesauce-core/helpers/event";
3
+ import { modifyHiddenTags, modifyPublicTags } from "applesauce-core/operations";
4
+ import { addRelayTag, removeRelayTag } from "applesauce-core/operations/tag/relay";
4
5
  function getRelaySetEvent(events, self, identifier) {
5
6
  const set = typeof identifier === "string" ? events.getReplaceable(kinds.Relaysets, self, identifier) : identifier;
6
7
  if (!set)
@@ -1,6 +1,6 @@
1
- import { modifyHiddenTags, modifyPublicTags } from "applesauce-factory/operations";
2
- import { addRelayTag, removeRelayTag } from "applesauce-factory/operations/tag/relay";
3
- import { kinds } from "nostr-tools";
1
+ import { kinds } from "applesauce-core/helpers/event";
2
+ import { modifyHiddenTags, modifyPublicTags } from "applesauce-core/operations";
3
+ import { addRelayTag, removeRelayTag } from "applesauce-core/operations/tag/relay";
4
4
  function getSearchRelaysEvent(events, self) {
5
5
  const event = events.getReplaceable(kinds.SearchRelaysList, self);
6
6
  if (!event)
@@ -1,6 +1,6 @@
1
- import { Rumor } from "applesauce-core/helpers";
2
- import { WrappedMessageBlueprintOptions } from "applesauce-factory/blueprints";
3
- import { GiftWrapOptions } from "applesauce-factory/operations/gift-wrap";
1
+ import { Rumor } from "applesauce-common/helpers/gift-wrap";
2
+ import { WrappedMessageBlueprintOptions } from "applesauce-common/blueprints";
3
+ import { GiftWrapOptions } from "applesauce-common/operations/gift-wrap";
4
4
  import { Action } from "../action-hub.js";
5
5
  /**
6
6
  * Sends a NIP-17 wrapped message to a conversation
@@ -1,5 +1,5 @@
1
- import { getConversationParticipants } from "applesauce-core/helpers";
2
- import { GiftWrapBlueprint, WrappedMessageBlueprint, WrappedMessageReplyBlueprint, } from "applesauce-factory/blueprints";
1
+ import { getConversationParticipants } from "applesauce-common/helpers/messages";
2
+ import { GiftWrapBlueprint, WrappedMessageBlueprint, WrappedMessageReplyBlueprint, } from "applesauce-common/blueprints";
3
3
  /**
4
4
  * Sends a NIP-17 wrapped message to a conversation
5
5
  * @param participants - A conversation identifier, user pubkey, or a list of participant pubkeys
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-actions",
3
- "version": "0.0.0-next-20250930093922",
3
+ "version": "0.0.0-next-20251203172109",
4
4
  "description": "A package for performing common nostr actions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,19 +32,18 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "applesauce-core": "0.0.0-next-20250930093922",
36
- "applesauce-factory": "0.0.0-next-20250930093922",
37
- "nostr-tools": "~2.17",
35
+ "applesauce-common": "0.0.0-next-20251203172109",
36
+ "applesauce-core": "0.0.0-next-20251203172109",
38
37
  "rxjs": "^7.8.1"
39
38
  },
40
39
  "devDependencies": {
41
40
  "@hirez_io/observer-spy": "^2.2.0",
42
41
  "@types/debug": "^4.1.12",
43
- "applesauce-signers": "0.0.0-next-20250930093922",
42
+ "applesauce-signers": "0.0.0-next-20251203172109",
44
43
  "nanoid": "^5.1.5",
45
44
  "rimraf": "^6.0.1",
46
45
  "typescript": "^5.8.3",
47
- "vitest": "^3.2.4"
46
+ "vitest": "^4.0.15"
48
47
  },
49
48
  "funding": {
50
49
  "type": "lightning",