applesauce-actions 0.0.0-next-20250718173521 → 0.0.0-next-20250723224513
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.
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NostrEvent } from "nostr-tools";
|
|
2
|
+
import { Action } from "../action-hub.js";
|
|
3
|
+
/** Adds a calendar event to a calendar */
|
|
4
|
+
export declare function AddEventToCalendar(calendar: NostrEvent, event: NostrEvent): Action;
|
|
5
|
+
/** Removes a calendar event from a calendar */
|
|
6
|
+
export declare function RemoveEventToCalendar(calendar: NostrEvent, event: NostrEvent): Action;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DATE_BASED_CALENDAR_EVENT_KIND, TIME_BASED_CALENDAR_EVENT_KIND } from "applesauce-core/helpers/calendar-event";
|
|
2
|
+
import { calendarAddEvent, calendarRemoveEvent } from "applesauce-factory/operations/event";
|
|
3
|
+
import { kinds } from "nostr-tools";
|
|
4
|
+
/** Adds a calendar event to a calendar */
|
|
5
|
+
export function AddEventToCalendar(calendar, event) {
|
|
6
|
+
if (calendar.kind !== kinds.Calendar)
|
|
7
|
+
throw new Error("Calendar is not a calendar event");
|
|
8
|
+
if (event.kind !== DATE_BASED_CALENDAR_EVENT_KIND && event.kind !== TIME_BASED_CALENDAR_EVENT_KIND)
|
|
9
|
+
throw new Error("Event is not a calendar event");
|
|
10
|
+
return async function* ({ factory }) {
|
|
11
|
+
const draft = await factory.modify(calendar, calendarAddEvent(event));
|
|
12
|
+
return await factory.sign(draft);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Removes a calendar event from a calendar */
|
|
16
|
+
export function RemoveEventToCalendar(calendar, event) {
|
|
17
|
+
if (calendar.kind !== kinds.Calendar)
|
|
18
|
+
throw new Error("Calendar is not a calendar event");
|
|
19
|
+
if (event.kind !== DATE_BASED_CALENDAR_EVENT_KIND && event.kind !== TIME_BASED_CALENDAR_EVENT_KIND)
|
|
20
|
+
throw new Error("Event is not a calendar event");
|
|
21
|
+
return async function* ({ factory }) {
|
|
22
|
+
const draft = await factory.modify(calendar, calendarRemoveEvent(event));
|
|
23
|
+
return await factory.sign(draft);
|
|
24
|
+
};
|
|
25
|
+
}
|
package/dist/actions/index.d.ts
CHANGED
package/dist/actions/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "applesauce-actions",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250723224513",
|
|
4
4
|
"description": "A package for performing common nostr actions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"applesauce-core": "
|
|
36
|
-
"applesauce-factory": "0.0.0-next-
|
|
35
|
+
"applesauce-core": "0.0.0-next-20250723224513",
|
|
36
|
+
"applesauce-factory": "0.0.0-next-20250723224513",
|
|
37
37
|
"nostr-tools": "^2.13",
|
|
38
38
|
"rxjs": "^7.8.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@hirez_io/observer-spy": "^2.2.0",
|
|
42
42
|
"@types/debug": "^4.1.12",
|
|
43
|
-
"applesauce-signers": "0.0.0-next-
|
|
43
|
+
"applesauce-signers": "0.0.0-next-20250723224513",
|
|
44
44
|
"nanoid": "^5.1.5",
|
|
45
45
|
"typescript": "^5.8.3",
|
|
46
46
|
"vitest": "^3.2.3"
|