@latticexyz/store-indexer 2.0.0-skystrife-playtest-19728914 → 2.0.0-skystrife-playtest-64d3dea3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/store-indexer",
3
- "version": "2.0.0-skystrife-playtest-19728914",
3
+ "version": "2.0.0-skystrife-playtest-64d3dea3",
4
4
  "description": "Minimal Typescript indexer for Store",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,10 +27,10 @@
27
27
  "superjson": "^1.12.4",
28
28
  "viem": "1.6.0",
29
29
  "zod": "^3.21.4",
30
- "@latticexyz/block-logs-stream": "2.0.0-skystrife-playtest-19728914",
31
- "@latticexyz/common": "2.0.0-skystrife-playtest-19728914",
32
- "@latticexyz/store": "2.0.0-skystrife-playtest-19728914",
33
- "@latticexyz/store-sync": "2.0.0-skystrife-playtest-19728914"
30
+ "@latticexyz/block-logs-stream": "2.0.0-skystrife-playtest-64d3dea3",
31
+ "@latticexyz/common": "2.0.0-skystrife-playtest-64d3dea3",
32
+ "@latticexyz/store": "2.0.0-skystrife-playtest-64d3dea3",
33
+ "@latticexyz/store-sync": "2.0.0-skystrife-playtest-64d3dea3"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/better-sqlite3": "^7.6.4",
@@ -5,6 +5,31 @@ import { QueryAdapter } from "@latticexyz/store-sync/trpc-indexer";
5
5
  import { debug } from "../debug";
6
6
  import { Hex, getAddress } from "viem";
7
7
 
8
+ const EXCLUDE_TABLES = [
9
+ "Position",
10
+ "MoveDifficulty",
11
+ "TerrainType",
12
+ "ArmorModifier",
13
+ "Untraversable",
14
+ "LastAction",
15
+ "StaminaOnKill",
16
+ "UnitType",
17
+ "Movable",
18
+ "Capturer",
19
+ "Range",
20
+ "Tier",
21
+ "Combat",
22
+ "StructureType",
23
+ "Capturable",
24
+ "KillCount",
25
+ "Stamina",
26
+ "ChargeCap",
27
+ "Charger",
28
+ "Chargee",
29
+ "ChargedByStart",
30
+ "Factory",
31
+ ];
32
+
8
33
  /**
9
34
  * Creates a storage adapter for the tRPC server/client to query data from SQLite.
10
35
  *
@@ -36,8 +61,24 @@ export async function createQueryAdapter(database: BaseSQLiteDatabase<"sync", an
36
61
  z: "int32",
37
62
  },
38
63
  });
64
+
65
+ const Match = createSqliteTable({
66
+ address,
67
+ namespace: "",
68
+ name: "Match",
69
+ keySchema: { key: "bytes32" },
70
+ valueSchema: {
71
+ value: "int32",
72
+ },
73
+ });
74
+
39
75
  const positions = database.select().from(Position).where(eq(Position.z, matchId)).all();
40
- return positions.map((pos) => pos.key);
76
+ const positionKeys = positions.map((pos) => pos.key);
77
+
78
+ const matches = database.select().from(Match).where(eq(Match.value, matchId)).all();
79
+ const matchKeys = matches.map((match) => match.key);
80
+
81
+ return [...new Set([...positionKeys, ...matchKeys])];
41
82
  } catch (error: unknown) {
42
83
  return [];
43
84
  }
@@ -51,10 +92,7 @@ export async function createQueryAdapter(database: BaseSQLiteDatabase<"sync", an
51
92
  .where(
52
93
  and(
53
94
  eq(sqliteTable.__isDeleted, false),
54
- entities.length &&
55
- (table.name === "MoveDifficulty" || table.name === "TerrainType") /* || table.name === "ArmorModifier"*/
56
- ? inArray(sqliteTable.__key, entities)
57
- : undefined
95
+ entities.length && EXCLUDE_TABLES.includes(table.name) ? inArray(sqliteTable.__key, entities) : undefined
58
96
  )
59
97
  )
60
98
  .all();