applesauce-core 0.0.0-next-20250212000029 → 0.0.0-next-20250212160639

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.
@@ -58,7 +58,7 @@ export function getIndexableTags(event) {
58
58
  if (!indexable) {
59
59
  const tags = new Set();
60
60
  for (const tag of event.tags) {
61
- if (tag[0] && tag[0].length >= 2 && INDEXABLE_TAGS.has(tag[0])) {
61
+ if (tag.length >= 2 && tag[0].length === 1 && INDEXABLE_TAGS.has(tag[0])) {
62
62
  tags.add(tag[0] + ":" + tag[1]);
63
63
  }
64
64
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { EventIndexableTagsSymbol, getIndexableTags, getTagValue } from "./event.js";
3
+ const event = {
4
+ content: "",
5
+ created_at: 1732889913,
6
+ id: "2d53511f321cc82dd13eedfb597c9fe834d12d271c10d8068e9d8cfb8f58d1b4",
7
+ kind: 30000,
8
+ pubkey: "266815e0c9210dfa324c6cba3573b14bee49da4209a9456f9484e5106cd408a5",
9
+ sig: "e6a442487ef44a8a00ec1e0a852e547991fcd5cbf19aa1a4219fa65d6f41022675e0745207649f4b16fe9a6c5c7c3693dc3e13966ffa5b2891634867c874cf22",
10
+ tags: [
11
+ ["d", "qRxLhBbTfRlxsvKSu0iUl"],
12
+ ["title", "Musicians"],
13
+ ["client", "noStrudel", "31990:266815e0c9210dfa324c6cba3573b14bee49da4209a9456f9484e5106cd408a5:1686066542546"],
14
+ ["p", "2842e34860c59dfacd5df48ba7a65065e6760d08c35f779553d83c2c2310b493"],
15
+ ["p", "28ca019b78b494c25a9da2d645975a8501c7e99b11302e5cbe748ee593fcb2cc"],
16
+ ["p", "f46192b8b9be1b43fc30ea27c7cb16210aede17252b3aa9692fbb3f2ba153199"],
17
+ ],
18
+ };
19
+ describe("getIndexableTags", () => {
20
+ it("should return a set of indexable tags for event", () => {
21
+ expect(Array.from(getIndexableTags(event))).toEqual(expect.arrayContaining([
22
+ "p:2842e34860c59dfacd5df48ba7a65065e6760d08c35f779553d83c2c2310b493",
23
+ "p:28ca019b78b494c25a9da2d645975a8501c7e99b11302e5cbe748ee593fcb2cc",
24
+ "p:f46192b8b9be1b43fc30ea27c7cb16210aede17252b3aa9692fbb3f2ba153199",
25
+ ]));
26
+ });
27
+ it("should cache value on EventIndexableTagsSymbol", () => {
28
+ getIndexableTags(event);
29
+ expect(Reflect.has(event, EventIndexableTagsSymbol)).toBe(true);
30
+ });
31
+ });
32
+ describe("getTagValue", () => {
33
+ it("should return value of tag if present", () => {
34
+ expect(getTagValue(event, "title")).toBe("Musicians");
35
+ });
36
+ });
@@ -17,7 +17,6 @@ export function matchFilter(filter, event) {
17
17
  for (let f in filter) {
18
18
  if (f[0] === "#") {
19
19
  let tagName = f.slice(1);
20
- // @ts-expect-error
21
20
  let values = filter[f];
22
21
  if (values) {
23
22
  const tags = getIndexableTags(event);
@@ -6,7 +6,7 @@ export function UserContactsQuery(pubkey) {
6
6
  return {
7
7
  key: pubkey,
8
8
  run: (store) => store
9
- .replaceable(kinds.Mutelist, pubkey)
9
+ .replaceable(kinds.Contacts, pubkey)
10
10
  .pipe(map((event) => event && processTags(event.tags.filter(isPTag), getProfilePointerFromPTag))),
11
11
  };
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-core",
3
- "version": "0.0.0-next-20250212000029",
3
+ "version": "0.0.0-next-20250212160639",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",