@secondlayer/shared 11.6.0 → 11.7.0
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/src/archive/range-digest.d.ts +23 -43
- package/dist/src/archive/semantic-digest-builder.d.ts +23 -43
- package/dist/src/coverage/index.d.ts +23 -43
- package/dist/src/db/index.d.ts +29 -48
- package/dist/src/db/index.js +3 -5
- package/dist/src/db/index.js.map +3 -3
- package/dist/src/db/queries/chain-reorgs.d.ts +23 -43
- package/dist/src/db/queries/chain-reorgs.js +3 -5
- package/dist/src/db/queries/chain-reorgs.js.map +3 -3
- package/dist/src/db/queries/contracts.d.ts +23 -43
- package/dist/src/db/queries/instance.d.ts +23 -43
- package/dist/src/db/queries/integrity.d.ts +23 -43
- package/dist/src/db/queries/subgraph-gaps.d.ts +23 -43
- package/dist/src/db/queries/subgraph-operations.d.ts +23 -43
- package/dist/src/db/queries/subgraphs.d.ts +23 -43
- package/dist/src/db/queries/sync-scope.d.ts +23 -43
- package/dist/src/db/queries/webhooks.d.ts +23 -43
- package/dist/src/db/schema.d.ts +27 -44
- package/dist/src/index-http.d.ts +23 -0
- package/dist/src/index-http.js +9 -2
- package/dist/src/index-http.js.map +3 -3
- package/dist/src/index.d.ts +58 -51
- package/dist/src/index.js +56 -7
- package/dist/src/index.js.map +5 -5
- package/dist/src/node/local-client.d.ts +44 -44
- package/dist/src/node/local-client.js +41 -2
- package/dist/src/node/local-client.js.map +5 -4
- package/dist/src/schemas/index.d.ts +23 -1
- package/dist/src/schemas/index.js +38 -1
- package/dist/src/schemas/index.js.map +3 -3
- package/dist/src/schemas/webhooks.d.ts +23 -1
- package/dist/src/schemas/webhooks.js +38 -1
- package/dist/src/schemas/webhooks.js.map +3 -3
- package/dist/src/streams-rows/index.d.ts +43 -1
- package/dist/src/streams-rows/index.js +14 -3
- package/dist/src/streams-rows/index.js.map +3 -3
- package/dist/src/types.d.ts +12 -1
- package/migrations/0130_drop_empty_unused_tables.ts +26 -0
- package/migrations/0131_vm_events.ts +81 -0
- package/migrations/0132_vm_events_type_ordinal_idx.ts +21 -0
- package/migrations/0133_vm_events_fk_cascade.ts +47 -0
- package/package.json +2 -2
- package/dist/src/constants.d.ts +0 -2
- package/dist/src/constants.js +0 -24
- package/dist/src/constants.js.map +0 -10
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Kysely, sql } from "kysely";
|
|
2
|
+
import { onChainPlane } from "../src/db/migration-role.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `vm_events` referenced `transactions` / `blocks` with plain FKs, like
|
|
6
|
+
* `events_tx_id_fkey`. Every sweep that deletes a height (cli bootstrap and
|
|
7
|
+
* repair, repair-fork-block, cleanup-reorg-dupes, the smoke and drill scripts)
|
|
8
|
+
* deletes `events` explicitly before `transactions` — and none of them name
|
|
9
|
+
* `vm_events`, so each would fail with an FK violation the moment a vm row
|
|
10
|
+
* exists. Cascade instead of teaching six call sites about a second child:
|
|
11
|
+
* vm rows follow their parent. persistBlock still archives + deletes them
|
|
12
|
+
* explicitly before the parent, which stays correct under cascade.
|
|
13
|
+
*/
|
|
14
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
15
|
+
await onChainPlane(async () => {
|
|
16
|
+
await sql`SET lock_timeout = '30s'`.execute(db);
|
|
17
|
+
await sql`
|
|
18
|
+
ALTER TABLE vm_events
|
|
19
|
+
DROP CONSTRAINT IF EXISTS vm_events_tx_id_fkey,
|
|
20
|
+
DROP CONSTRAINT IF EXISTS vm_events_block_height_fkey
|
|
21
|
+
`.execute(db);
|
|
22
|
+
await sql`
|
|
23
|
+
ALTER TABLE vm_events
|
|
24
|
+
ADD CONSTRAINT vm_events_tx_id_fkey
|
|
25
|
+
FOREIGN KEY (tx_id) REFERENCES transactions (tx_id) ON DELETE CASCADE,
|
|
26
|
+
ADD CONSTRAINT vm_events_block_height_fkey
|
|
27
|
+
FOREIGN KEY (block_height) REFERENCES blocks (height) ON DELETE CASCADE
|
|
28
|
+
`.execute(db);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
33
|
+
await onChainPlane(async () => {
|
|
34
|
+
await sql`
|
|
35
|
+
ALTER TABLE vm_events
|
|
36
|
+
DROP CONSTRAINT IF EXISTS vm_events_tx_id_fkey,
|
|
37
|
+
DROP CONSTRAINT IF EXISTS vm_events_block_height_fkey
|
|
38
|
+
`.execute(db);
|
|
39
|
+
await sql`
|
|
40
|
+
ALTER TABLE vm_events
|
|
41
|
+
ADD CONSTRAINT vm_events_tx_id_fkey
|
|
42
|
+
FOREIGN KEY (tx_id) REFERENCES transactions (tx_id),
|
|
43
|
+
ADD CONSTRAINT vm_events_block_height_fkey
|
|
44
|
+
FOREIGN KEY (block_height) REFERENCES blocks (height)
|
|
45
|
+
`.execute(db);
|
|
46
|
+
});
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@secondlayer/shared",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.7.0",
|
|
4
4
|
"description": "Internal building blocks shared across Secondlayer packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
"prepublishOnly": "bun run build"
|
|
234
234
|
},
|
|
235
235
|
"dependencies": {
|
|
236
|
-
"@secondlayer/stacks": "^6.
|
|
236
|
+
"@secondlayer/stacks": "^6.1.0",
|
|
237
237
|
"kysely": "0.28.17",
|
|
238
238
|
"kysely-postgres-js": "3.0.0",
|
|
239
239
|
"postgres": "^3.4.6",
|
package/dist/src/constants.d.ts
DELETED
package/dist/src/constants.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/constants.ts
|
|
18
|
-
var ADMIN_EMAILS = ["ryan.waits@gmail.com"];
|
|
19
|
-
export {
|
|
20
|
-
ADMIN_EMAILS
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//# debugId=171573A31D5D2E7964756E2164756E21
|
|
24
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/constants.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"export const ADMIN_EMAILS: string[] = [\"ryan.waits@gmail.com\"];\n"
|
|
6
|
-
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAO,IAAM,eAAyB,CAAC,sBAAsB;",
|
|
8
|
-
"debugId": "171573A31D5D2E7964756E2164756E21",
|
|
9
|
-
"names": []
|
|
10
|
-
}
|