@secondlayer/shared 11.7.0 → 11.7.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.
- package/dist/src/archive/range-digest.d.ts +23 -27
- package/dist/src/archive/semantic-digest-builder.d.ts +23 -27
- package/dist/src/coverage/index.d.ts +23 -27
- package/dist/src/db/index.d.ts +29 -39
- package/dist/src/db/index.js +3 -4
- package/dist/src/db/index.js.map +3 -3
- package/dist/src/db/queries/chain-reorgs.d.ts +23 -27
- package/dist/src/db/queries/chain-reorgs.js +3 -4
- package/dist/src/db/queries/chain-reorgs.js.map +3 -3
- package/dist/src/db/queries/contracts.d.ts +23 -27
- package/dist/src/db/queries/instance.d.ts +23 -27
- package/dist/src/db/queries/integrity.d.ts +24 -28
- package/dist/src/db/queries/integrity.js +4 -3
- package/dist/src/db/queries/integrity.js.map +3 -3
- package/dist/src/db/queries/subgraph-gaps.d.ts +23 -27
- package/dist/src/db/queries/subgraph-operations.d.ts +23 -27
- package/dist/src/db/queries/subgraphs.d.ts +24 -33
- package/dist/src/db/queries/subgraphs.js +1 -10
- package/dist/src/db/queries/subgraphs.js.map +3 -3
- package/dist/src/db/queries/sync-scope.d.ts +23 -27
- package/dist/src/db/queries/webhooks.d.ts +23 -27
- package/dist/src/db/schema.d.ts +27 -36
- package/dist/src/index.d.ts +29 -39
- package/dist/src/index.js +3 -4
- package/dist/src/index.js.map +3 -3
- package/dist/src/node/local-client.d.ts +23 -27
- package/migrations/0134_waitlists.ts +64 -0
- package/migrations/0135_drop_hosted_play_and_meters.ts +58 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type Kysely, sql } from "kysely";
|
|
2
|
+
import { onControlPlane } from "../src/db/migration-role.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Drop the hosted subgraph tables: accountless play (claim_tokens,
|
|
6
|
+
* play_provisions, from 0125) and the hosted meter ledger (hosted_meter_days,
|
|
7
|
+
* from 0124). Hosted subgraphs are not offered; subgraphs and webhooks run on
|
|
8
|
+
* self-host only. Prod 2026-09-23: count(*) = 0 on all three.
|
|
9
|
+
*
|
|
10
|
+
* `down` recreates the empty tables exactly as 0124/0125 created them.
|
|
11
|
+
*/
|
|
12
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
13
|
+
await sql`SET lock_timeout = '30s'`.execute(db);
|
|
14
|
+
await onControlPlane(async () => {
|
|
15
|
+
await sql`DROP TABLE IF EXISTS hosted_meter_days`.execute(db);
|
|
16
|
+
await sql`DROP TABLE IF EXISTS play_provisions`.execute(db);
|
|
17
|
+
await sql`DROP TABLE IF EXISTS claim_tokens`.execute(db);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
22
|
+
await sql`SET lock_timeout = '30s'`.execute(db);
|
|
23
|
+
await onControlPlane(async () => {
|
|
24
|
+
await sql`
|
|
25
|
+
CREATE TABLE IF NOT EXISTS claim_tokens (
|
|
26
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
27
|
+
account_id UUID NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
|
|
28
|
+
token_hash TEXT NOT NULL UNIQUE,
|
|
29
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
30
|
+
expires_at TIMESTAMPTZ NOT NULL,
|
|
31
|
+
used_at TIMESTAMPTZ
|
|
32
|
+
)
|
|
33
|
+
`.execute(db);
|
|
34
|
+
await sql`CREATE INDEX IF NOT EXISTS claim_tokens_account_id_idx ON claim_tokens (account_id)`.execute(
|
|
35
|
+
db,
|
|
36
|
+
);
|
|
37
|
+
await sql`
|
|
38
|
+
CREATE TABLE IF NOT EXISTS play_provisions (
|
|
39
|
+
ip_hash TEXT NOT NULL,
|
|
40
|
+
day DATE NOT NULL,
|
|
41
|
+
count INTEGER NOT NULL DEFAULT 1,
|
|
42
|
+
PRIMARY KEY (ip_hash, day)
|
|
43
|
+
)
|
|
44
|
+
`.execute(db);
|
|
45
|
+
await sql`
|
|
46
|
+
CREATE TABLE IF NOT EXISTS hosted_meter_days (
|
|
47
|
+
day date NOT NULL,
|
|
48
|
+
account_id text NOT NULL,
|
|
49
|
+
subgraph_name text NOT NULL,
|
|
50
|
+
kind text NOT NULL,
|
|
51
|
+
usd_micros bigint NOT NULL,
|
|
52
|
+
billed_at timestamptz NOT NULL DEFAULT now(),
|
|
53
|
+
PRIMARY KEY (day, account_id, subgraph_name, kind),
|
|
54
|
+
CHECK (kind IN ('running', 'storage'))
|
|
55
|
+
)
|
|
56
|
+
`.execute(db);
|
|
57
|
+
});
|
|
58
|
+
}
|