applesauce-core 3.0.0 → 3.0.1
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/helpers/event.d.ts +1 -4
- package/dist/helpers/event.js +2 -10
- package/package.json +1 -1
package/dist/helpers/event.d.ts
CHANGED
|
@@ -39,10 +39,7 @@ export declare function isFromCache(event: NostrEvent): boolean;
|
|
|
39
39
|
export declare function getParentEventStore<T extends object>(event: T): IEventStore | undefined;
|
|
40
40
|
/** Notifies the events parent store that an event has been updated */
|
|
41
41
|
export declare function notifyEventUpdate(event: NostrEvent): void;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the replaceable identifier for a replaceable event
|
|
44
|
-
* @throws {Error} if the event is not addressable or missing the "d" tag
|
|
45
|
-
*/
|
|
42
|
+
/** Returns the replaceable identifier for a replaceable event */
|
|
46
43
|
export declare function getReplaceableIdentifier(event: NostrEvent): string;
|
|
47
44
|
/** Checks if an event is a NIP-70 protected event */
|
|
48
45
|
export declare function isProtectedEvent(event: NostrEvent): boolean;
|
package/dist/helpers/event.js
CHANGED
|
@@ -85,18 +85,10 @@ export function notifyEventUpdate(event) {
|
|
|
85
85
|
if (eventStore)
|
|
86
86
|
eventStore.update(event);
|
|
87
87
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Returns the replaceable identifier for a replaceable event
|
|
90
|
-
* @throws {Error} if the event is not addressable or missing the "d" tag
|
|
91
|
-
*/
|
|
88
|
+
/** Returns the replaceable identifier for a replaceable event */
|
|
92
89
|
export function getReplaceableIdentifier(event) {
|
|
93
|
-
if (!isAddressableKind(event.kind))
|
|
94
|
-
throw new Error("Event is not addressable");
|
|
95
90
|
return getOrComputeCachedValue(event, ReplaceableIdentifierSymbol, () => {
|
|
96
|
-
|
|
97
|
-
if (d === undefined)
|
|
98
|
-
throw new Error("Event missing identifier");
|
|
99
|
-
return d;
|
|
91
|
+
return event.tags.find((t) => t[0] === "d")?.[1] ?? "";
|
|
100
92
|
});
|
|
101
93
|
}
|
|
102
94
|
/** Checks if an event is a NIP-70 protected event */
|