@secondlayer/shared 6.3.0 → 6.3.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.
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Kysely, sql } from "kysely";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Expression index on `events.data->>'contract_identifier'` for the print
|
|
5
|
+
* event types. Without this, BNS-style consumers that filter prints by
|
|
6
|
+
* contract scan every print row in the cursor range — millions of rows on
|
|
7
|
+
* mainnet — and the response window times out.
|
|
8
|
+
*
|
|
9
|
+
* Already applied to prod 2026-05-09 via `CREATE INDEX CONCURRENTLY`. This
|
|
10
|
+
* migration is a no-op there (IF NOT EXISTS) and seeds dev/staging. The
|
|
11
|
+
* migrate runner wraps each migration in a tx, so CONCURRENTLY can't be
|
|
12
|
+
* used here — we accept a brief lock on dev/staging where the events table
|
|
13
|
+
* is small.
|
|
14
|
+
*/
|
|
15
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
16
|
+
await sql`
|
|
17
|
+
CREATE INDEX IF NOT EXISTS events_contract_event_contract_id_idx
|
|
18
|
+
ON events ((data->>'contract_identifier'), block_height)
|
|
19
|
+
WHERE type IN ('smart_contract_event', 'contract_event')
|
|
20
|
+
`.execute(db);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
24
|
+
await sql`DROP INDEX IF EXISTS events_contract_event_contract_id_idx`.execute(
|
|
25
|
+
db,
|
|
26
|
+
);
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secondlayer/shared",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
"prepublishOnly": "bun run build"
|
|
189
189
|
},
|
|
190
190
|
"dependencies": {
|
|
191
|
-
"@secondlayer/stacks": "^2.
|
|
191
|
+
"@secondlayer/stacks": "^2.2.0",
|
|
192
192
|
"kysely": "0.28.15",
|
|
193
193
|
"kysely-postgres-js": "3.0.0",
|
|
194
194
|
"postgres": "^3.4.6",
|