applesauce-core 0.0.0-next-20241119160247 → 0.0.0-next-20241119173145
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 +4 -1
- package/dist/helpers/event.js +9 -1
- package/package.json +1 -1
package/dist/helpers/event.d.ts
CHANGED
|
@@ -24,7 +24,10 @@ export declare function getEventUID(event: NostrEvent): string;
|
|
|
24
24
|
export declare function getReplaceableUID(kind: number, pubkey: string, d?: string): string;
|
|
25
25
|
/** Returns a Set of tag names and values that are indexable */
|
|
26
26
|
export declare function getIndexableTags(event: NostrEvent): Set<string>;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Returns the second index ( tag[1] ) of the first tag that matches the name
|
|
29
|
+
* If the event has any hidden tags they will be searched first
|
|
30
|
+
*/
|
|
28
31
|
export declare function getTagValue(event: NostrEvent, name: string): string | undefined;
|
|
29
32
|
/** Sets events verified flag without checking anything */
|
|
30
33
|
export declare function fakeVerifyEvent(event: NostrEvent): event is VerifiedEvent;
|
package/dist/helpers/event.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { kinds, verifiedSymbol } from "nostr-tools";
|
|
2
2
|
import { INDEXABLE_TAGS } from "../event-store/common.js";
|
|
3
|
+
import { getHiddenTags } from "./hidden-tags.js";
|
|
3
4
|
export const EventUIDSymbol = Symbol.for("event-uid");
|
|
4
5
|
export const EventIndexableTagsSymbol = Symbol.for("indexable-tags");
|
|
5
6
|
export const FromCacheSymbol = Symbol.for("from-cache");
|
|
@@ -46,8 +47,15 @@ export function getIndexableTags(event) {
|
|
|
46
47
|
}
|
|
47
48
|
return indexable;
|
|
48
49
|
}
|
|
49
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Returns the second index ( tag[1] ) of the first tag that matches the name
|
|
52
|
+
* If the event has any hidden tags they will be searched first
|
|
53
|
+
*/
|
|
50
54
|
export function getTagValue(event, name) {
|
|
55
|
+
const hidden = getHiddenTags(event);
|
|
56
|
+
const hiddenValue = hidden?.find((t) => t[0] === name)?.[1];
|
|
57
|
+
if (hiddenValue)
|
|
58
|
+
return hiddenValue;
|
|
51
59
|
return event.tags.find((t) => t[0] === name)?.[1];
|
|
52
60
|
}
|
|
53
61
|
/** Sets events verified flag without checking anything */
|