@secondlayer/shared 11.7.0 → 11.8.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/copy-loader.d.ts +1 -1
- package/dist/src/archive/copy-loader.js +4 -20
- package/dist/src/archive/copy-loader.js.map +2 -2
- package/dist/src/archive/derived-stage-report.d.ts +1 -1
- package/dist/src/archive/derived-stage-report.js +3 -19
- package/dist/src/archive/derived-stage-report.js.map +2 -2
- package/dist/src/archive/disk-guard.d.ts +1 -1
- package/dist/src/archive/disk-guard.js +3 -19
- package/dist/src/archive/disk-guard.js.map +2 -2
- package/dist/src/archive/instance-diagnosis.d.ts +1 -1
- package/dist/src/archive/instance-diagnosis.js +6 -22
- package/dist/src/archive/instance-diagnosis.js.map +2 -2
- package/dist/src/archive/key-registry.d.ts +1 -1
- package/dist/src/archive/key-registry.js +12 -12
- package/dist/src/archive/key-registry.js.map +1 -1
- package/dist/src/archive/per-height-digest.d.ts +1 -1
- package/dist/src/archive/per-height-digest.js +3 -17
- package/dist/src/archive/per-height-digest.js.map +5 -5
- package/dist/src/archive/progress.d.ts +1 -1
- package/dist/src/archive/progress.js +4 -20
- package/dist/src/archive/progress.js.map +2 -2
- package/dist/src/archive/range-digest.d.ts +25 -30
- package/dist/src/archive/range-digest.js +4 -20
- package/dist/src/archive/range-digest.js.map +2 -2
- package/dist/src/archive/reference.d.ts +1 -1
- package/dist/src/archive/reference.js +14 -12
- package/dist/src/archive/reference.js.map +5 -5
- package/dist/src/archive/root-key.d.ts +1 -1
- package/dist/src/archive/root-key.js +3 -19
- package/dist/src/archive/root-key.js.map +2 -2
- package/dist/src/archive/semantic-digest-builder.d.ts +25 -30
- package/dist/src/archive/semantic-digest-builder.js +5 -19
- package/dist/src/archive/semantic-digest-builder.js.map +5 -5
- package/dist/src/archive/semantic-digest.d.ts +1 -1
- package/dist/src/archive/semantic-digest.js +4 -20
- package/dist/src/archive/semantic-digest.js.map +2 -2
- package/dist/src/archive/status.d.ts +1 -1
- package/dist/src/archive/status.js +4 -20
- package/dist/src/archive/status.js.map +2 -2
- package/dist/src/coverage/index.d.ts +24 -29
- package/dist/src/coverage/index.js +80 -96
- package/dist/src/coverage/index.js.map +2 -2
- package/dist/src/crypto/ed25519.d.ts +1 -1
- package/dist/src/crypto/ed25519.js +13 -13
- package/dist/src/crypto/ed25519.js.map +1 -1
- package/dist/src/crypto/hmac.d.ts +1 -1
- package/dist/src/crypto/hmac.js +9 -9
- package/dist/src/crypto/hmac.js.map +1 -1
- package/dist/src/crypto/secondlayer-webhook.d.ts +1 -1
- package/dist/src/crypto/secondlayer-webhook.js +14 -14
- package/dist/src/crypto/secondlayer-webhook.js.map +2 -2
- package/dist/src/crypto/secrets.d.ts +1 -1
- package/dist/src/crypto/secrets.js +15 -29
- package/dist/src/crypto/secrets.js.map +5 -5
- package/dist/src/crypto/standard-webhooks.d.ts +1 -1
- package/dist/src/crypto/standard-webhooks.js +3 -19
- package/dist/src/crypto/standard-webhooks.js.map +2 -2
- package/dist/src/db/index.d.ts +46 -57
- package/dist/src/db/index.js +42 -58
- package/dist/src/db/index.js.map +6 -6
- package/dist/src/db/jsonb.d.ts +1 -1
- package/dist/src/db/jsonb.js +3 -19
- package/dist/src/db/jsonb.js.map +2 -2
- package/dist/src/db/queries/chain-reorgs.d.ts +24 -29
- package/dist/src/db/queries/chain-reorgs.js +29 -45
- package/dist/src/db/queries/chain-reorgs.js.map +6 -6
- package/dist/src/db/queries/contracts.d.ts +24 -29
- package/dist/src/db/queries/contracts.js +9 -23
- package/dist/src/db/queries/contracts.js.map +5 -5
- package/dist/src/db/queries/instance.d.ts +24 -29
- package/dist/src/db/queries/instance.js +7 -23
- package/dist/src/db/queries/instance.js.map +2 -2
- package/dist/src/db/queries/integrity.d.ts +25 -30
- package/dist/src/db/queries/integrity.js +8 -23
- package/dist/src/db/queries/integrity.js.map +3 -3
- package/dist/src/db/queries/subgraph-gaps.d.ts +24 -29
- package/dist/src/db/queries/subgraph-gaps.js +5 -21
- package/dist/src/db/queries/subgraph-gaps.js.map +2 -2
- package/dist/src/db/queries/subgraph-operations.d.ts +24 -29
- package/dist/src/db/queries/subgraph-operations.js +17 -33
- package/dist/src/db/queries/subgraph-operations.js.map +2 -2
- package/dist/src/db/queries/subgraphs.d.ts +23 -44
- package/dist/src/db/queries/subgraphs.js +15 -46
- package/dist/src/db/queries/subgraphs.js.map +5 -5
- package/dist/src/db/queries/sync-scope.d.ts +24 -29
- package/dist/src/db/queries/sync-scope.js +6 -22
- package/dist/src/db/queries/sync-scope.js.map +2 -2
- package/dist/src/db/queries/webhooks.d.ts +24 -29
- package/dist/src/db/queries/webhooks.js +54 -50
- package/dist/src/db/queries/webhooks.js.map +5 -5
- package/dist/src/db/schema.d.ts +27 -37
- package/dist/src/env.d.ts +1 -1
- package/dist/src/env.js +7 -23
- package/dist/src/env.js.map +2 -2
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/errors.js +15 -31
- package/dist/src/errors.js.map +2 -2
- package/dist/src/index-http.d.ts +1 -1
- package/dist/src/index-http.js +3 -19
- package/dist/src/index-http.js.map +2 -2
- package/dist/src/index-internal-auth.d.ts +1 -1
- package/dist/src/index-internal-auth.js +7 -23
- package/dist/src/index-internal-auth.js.map +2 -2
- package/dist/src/index.d.ts +164 -187
- package/dist/src/index.js +261 -316
- package/dist/src/index.js.map +13 -13
- package/dist/src/leader.d.ts +1 -1
- package/dist/src/leader.js +7 -21
- package/dist/src/leader.js.map +5 -5
- package/dist/src/logger.js +1 -17
- package/dist/src/logger.js.map +2 -2
- package/dist/src/mode.d.ts +1 -1
- package/dist/src/mode.js +5 -21
- package/dist/src/mode.js.map +2 -2
- package/dist/src/node/archive-client.d.ts +1 -1
- package/dist/src/node/archive-client.js +9 -23
- package/dist/src/node/archive-client.js.map +5 -5
- package/dist/src/node/client.d.ts +1 -1
- package/dist/src/node/client.js +4 -18
- package/dist/src/node/client.js.map +5 -5
- package/dist/src/node/consensus.d.ts +1 -1
- package/dist/src/node/consensus.js +5 -21
- package/dist/src/node/consensus.js.map +2 -2
- package/dist/src/node/hiro-client.d.ts +1 -1
- package/dist/src/node/hiro-client.js +1 -17
- package/dist/src/node/hiro-client.js.map +2 -2
- package/dist/src/node/hiro-pg-client.js +1 -17
- package/dist/src/node/hiro-pg-client.js.map +2 -2
- package/dist/src/node/local-client.d.ts +24 -29
- package/dist/src/node/local-client.js +3 -19
- package/dist/src/node/local-client.js.map +2 -2
- package/dist/src/node/nakamoto.d.ts +1 -1
- package/dist/src/node/nakamoto.js +12 -28
- package/dist/src/node/nakamoto.js.map +2 -2
- package/dist/src/queue/listener.d.ts +1 -1
- package/dist/src/queue/listener.js +4 -20
- package/dist/src/queue/listener.js.map +2 -2
- package/dist/src/runtime/index.d.ts +1 -1
- package/dist/src/runtime/index.js +51 -67
- package/dist/src/runtime/index.js.map +2 -2
- package/dist/src/schemas/index.d.ts +1 -4
- package/dist/src/schemas/index.js +19 -37
- package/dist/src/schemas/index.js.map +3 -3
- package/dist/src/schemas/subgraphs.d.ts +1 -4
- package/dist/src/schemas/subgraphs.js +1 -18
- package/dist/src/schemas/subgraphs.js.map +3 -3
- package/dist/src/schemas/webhooks.d.ts +1 -1
- package/dist/src/schemas/webhooks.js +21 -37
- package/dist/src/schemas/webhooks.js.map +2 -2
- package/dist/src/streams-bulk-manifest.d.ts +1 -1
- package/dist/src/streams-bulk-manifest.js +9 -9
- package/dist/src/streams-bulk-manifest.js.map +1 -1
- package/dist/src/streams-rows/index.d.ts +1 -1
- package/dist/src/streams-rows/index.js +32 -48
- package/dist/src/streams-rows/index.js.map +2 -2
- package/dist/src/subgraphs/spec.d.ts +1 -11
- package/dist/src/subgraphs/spec.js +27 -93
- package/dist/src/subgraphs/spec.js.map +3 -3
- package/dist/src/types.d.ts +1 -1
- package/migrations/0134_waitlists.ts +64 -0
- package/migrations/0135_drop_hosted_play_and_meters.ts +58 -0
- package/migrations/0136_drop_subgraph_visibility.ts +34 -0
- package/package.json +1 -1
|
@@ -153,7 +153,6 @@ interface SubgraphsTable {
|
|
|
153
153
|
handler_code: string | null;
|
|
154
154
|
source_code: string | null;
|
|
155
155
|
project_id: string | null;
|
|
156
|
-
visibility: Generated<string>;
|
|
157
156
|
/** Paid (wallet-ghost) deploys expire unless renewed or claimed; NULL = no expiry. */
|
|
158
157
|
expires_at: Date | null;
|
|
159
158
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
@@ -284,21 +283,6 @@ interface MagicLinksTable {
|
|
|
284
283
|
failed_attempts: Generated<number>;
|
|
285
284
|
created_at: Generated<Date>;
|
|
286
285
|
}
|
|
287
|
-
/** One-shot hashed tokens that attach a play ghost to an email at claim. */
|
|
288
|
-
interface ClaimTokensTable {
|
|
289
|
-
id: Generated<string>;
|
|
290
|
-
account_id: string;
|
|
291
|
-
token_hash: string;
|
|
292
|
-
created_at: Generated<Date>;
|
|
293
|
-
expires_at: Date;
|
|
294
|
-
used_at: Date | null;
|
|
295
|
-
}
|
|
296
|
-
/** 3 play provisions per IP per UTC day. PK (ip_hash, day); `count` caps at 3. */
|
|
297
|
-
interface PlayProvisionsTable {
|
|
298
|
-
ip_hash: string;
|
|
299
|
-
day: string;
|
|
300
|
-
count: Generated<number>;
|
|
301
|
-
}
|
|
302
286
|
interface SubgraphProcessingStatsTable {
|
|
303
287
|
id: Generated<string>;
|
|
304
288
|
subgraph_name: string;
|
|
@@ -760,8 +744,6 @@ interface Database {
|
|
|
760
744
|
accounts: AccountsTable;
|
|
761
745
|
sessions: SessionsTable;
|
|
762
746
|
magic_links: MagicLinksTable;
|
|
763
|
-
claim_tokens: ClaimTokensTable;
|
|
764
|
-
play_provisions: PlayProvisionsTable;
|
|
765
747
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
766
748
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
767
749
|
subgraph_gaps: SubgraphGapsTable;
|
|
@@ -770,7 +752,6 @@ interface Database {
|
|
|
770
752
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
771
753
|
account_spend_caps: AccountSpendCapsTable;
|
|
772
754
|
account_credits: AccountCreditsTable;
|
|
773
|
-
hosted_meter_days: HostedMeterDaysTable;
|
|
774
755
|
webhooks: WebhooksTable;
|
|
775
756
|
webhook_outbox: WebhookOutboxTable;
|
|
776
757
|
webhook_deliveries: WebhookDeliveriesTable;
|
|
@@ -801,6 +782,8 @@ interface Database {
|
|
|
801
782
|
coverage_segments: CoverageSegmentsTable;
|
|
802
783
|
stage_failures: StageFailuresTable;
|
|
803
784
|
archive_fetches: ArchiveFetchesTable;
|
|
785
|
+
waitlists: WaitlistsTable;
|
|
786
|
+
waitlist_signups: WaitlistSignupsTable;
|
|
804
787
|
}
|
|
805
788
|
interface ServiceHeartbeatsTable {
|
|
806
789
|
name: string;
|
|
@@ -829,15 +812,6 @@ interface AccountCreditsTable {
|
|
|
829
812
|
refill_last_at: Date | null;
|
|
830
813
|
updated_at: Generated<Date>;
|
|
831
814
|
}
|
|
832
|
-
/** Daily idempotency ledger for hosted subgraph running + storage meters. */
|
|
833
|
-
interface HostedMeterDaysTable {
|
|
834
|
-
day: string;
|
|
835
|
-
account_id: string;
|
|
836
|
-
subgraph_name: string;
|
|
837
|
-
kind: string;
|
|
838
|
-
usd_micros: string | number | bigint;
|
|
839
|
-
billed_at: Generated<Date>;
|
|
840
|
-
}
|
|
841
815
|
/**
|
|
842
816
|
* Archive fetch charge log (design-f089 gate). Append-only: one row per
|
|
843
817
|
* priced attempt to fetch a partition object. `usd_micros` is 0 for
|
|
@@ -940,6 +914,27 @@ interface TriggerEvaluatorStateTable {
|
|
|
940
914
|
last_settlement_scan_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
941
915
|
updated_at: Generated<Date>;
|
|
942
916
|
}
|
|
917
|
+
/** A public waitlist page: what it is for and whether it takes signups. */
|
|
918
|
+
interface WaitlistsTable {
|
|
919
|
+
slug: string;
|
|
920
|
+
title: string;
|
|
921
|
+
description: string;
|
|
922
|
+
url: string;
|
|
923
|
+
opened_at: Generated<Date>;
|
|
924
|
+
/** Null while the list is open. */
|
|
925
|
+
closed_at: Date | null;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* One signup per (list, contact, token). `answers` holds the list's own
|
|
929
|
+
* questions, validated per list by the API before insert.
|
|
930
|
+
*/
|
|
931
|
+
interface WaitlistSignupsTable {
|
|
932
|
+
id: Generated<string>;
|
|
933
|
+
list: string;
|
|
934
|
+
contact: string;
|
|
935
|
+
answers: Record<string, unknown>;
|
|
936
|
+
created_at: Generated<Date>;
|
|
937
|
+
}
|
|
943
938
|
declare const INSTANCE_NETWORKS: readonly ["mainnet", "testnet", "devnet"];
|
|
944
939
|
type InstanceNetwork = (typeof INSTANCE_NETWORKS)[number];
|
|
945
940
|
type InstanceRow = {
|
|
@@ -970,4 +965,4 @@ declare function getInstance(db: Kysely<Database>): Promise<InstanceRow | null>;
|
|
|
970
965
|
declare function ensureInstance(db: Kysely<Database>, input: {
|
|
971
966
|
network: InstanceNetwork
|
|
972
967
|
}): Promise<InstanceRow>;
|
|
973
|
-
export {
|
|
968
|
+
export { INSTANCE_NETWORKS, InstanceNetwork, InstanceNetworkMismatchError, InstanceRow, InvalidInstanceNetworkError, ensureInstance, getInstance, instanceNetworkFromEnv, parseInstanceNetwork };
|
|
@@ -1,19 +1,3 @@
|
|
|
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
1
|
// src/db/queries/instance.ts
|
|
18
2
|
var INSTANCE_NETWORKS = ["mainnet", "testnet", "devnet"];
|
|
19
3
|
|
|
@@ -79,14 +63,14 @@ function toInstance(row) {
|
|
|
79
63
|
};
|
|
80
64
|
}
|
|
81
65
|
export {
|
|
82
|
-
|
|
83
|
-
instanceNetworkFromEnv,
|
|
84
|
-
getInstance,
|
|
85
|
-
ensureInstance,
|
|
86
|
-
InvalidInstanceNetworkError,
|
|
66
|
+
INSTANCE_NETWORKS,
|
|
87
67
|
InstanceNetworkMismatchError,
|
|
88
|
-
|
|
68
|
+
InvalidInstanceNetworkError,
|
|
69
|
+
ensureInstance,
|
|
70
|
+
getInstance,
|
|
71
|
+
instanceNetworkFromEnv,
|
|
72
|
+
parseInstanceNetwork
|
|
89
73
|
};
|
|
90
74
|
|
|
91
|
-
//# debugId=
|
|
75
|
+
//# debugId=2C46A70E1317C50664756E2164756E21
|
|
92
76
|
//# sourceMappingURL=instance.js.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { Kysely } from \"kysely\";\nimport type { Database } from \"../types.ts\";\n\nexport const INSTANCE_NETWORKS = [\"mainnet\", \"testnet\", \"devnet\"] as const;\nexport type InstanceNetwork = (typeof INSTANCE_NETWORKS)[number];\n\nexport type InstanceRow = {\n\tid: string;\n\tnetwork: InstanceNetwork;\n\tcreated_at: Date;\n};\n\nexport class InstanceNetworkMismatchError extends Error {\n\treadonly name = \"InstanceNetworkMismatchError\";\n\tconstructor(\n\t\treadonly existing: InstanceNetwork,\n\t\treadonly requested: InstanceNetwork,\n\t) {\n\t\tsuper(`instance network is ${existing}; cannot change to ${requested}`);\n\t}\n}\n\nexport class InvalidInstanceNetworkError extends Error {\n\treadonly name = \"InvalidInstanceNetworkError\";\n\tconstructor(readonly value: string) {\n\t\tsuper(\n\t\t\t`instance network must be mainnet, testnet, or devnet (got ${value})`,\n\t\t);\n\t}\n}\n\nexport function parseInstanceNetwork(value: string): InstanceNetwork {\n\tconst network = value.trim().toLowerCase();\n\tif ((INSTANCE_NETWORKS as readonly string[]).includes(network)) {\n\t\treturn network as InstanceNetwork;\n\t}\n\tthrow new InvalidInstanceNetworkError(value);\n}\n\n/** STACKS_NETWORK, then NETWORK, then mainnet. */\nexport function instanceNetworkFromEnv(\n\tenv: NodeJS.ProcessEnv = process.env,\n): InstanceNetwork {\n\treturn parseInstanceNetwork(env.STACKS_NETWORK ?? env.NETWORK ?? \"mainnet\");\n}\n\nexport async function getInstance(\n\tdb: Kysely<Database>,\n): Promise<InstanceRow | null> {\n\tconst row = await db\n\t\t.selectFrom(\"instances\")\n\t\t.select([\"id\", \"network\", \"created_at\"])\n\t\t.executeTakeFirst();\n\treturn row ? toInstance(row) : null;\n}\n\n/**\n * Return the singleton instance, creating it on first call.\n * A second call with a different network is refused — the network is\n * immutable for the life of the database.\n */\nexport async function ensureInstance(\n\tdb: Kysely<Database>,\n\tinput: { network: InstanceNetwork },\n): Promise<InstanceRow> {\n\tconst existing = await getInstance(db);\n\tif (existing) {\n\t\tif (existing.network !== input.network) {\n\t\t\tthrow new InstanceNetworkMismatchError(existing.network, input.network);\n\t\t}\n\t\treturn existing;\n\t}\n\ttry {\n\t\tconst inserted = await db\n\t\t\t.insertInto(\"instances\")\n\t\t\t.values({ network: input.network })\n\t\t\t.returning([\"id\", \"network\", \"created_at\"])\n\t\t\t.executeTakeFirstOrThrow();\n\t\treturn toInstance(inserted);\n\t} catch {\n\t\t// Lost the singleton race — the other writer won.\n\t\tconst raced = await getInstance(db);\n\t\tif (!raced) throw new Error(\"failed to create instance\");\n\t\tif (raced.network !== input.network) {\n\t\t\tthrow new InstanceNetworkMismatchError(raced.network, input.network);\n\t\t}\n\t\treturn raced;\n\t}\n}\n\nfunction toInstance(row: {\n\tid: string;\n\tnetwork: string;\n\tcreated_at: Date;\n}): InstanceRow {\n\treturn {\n\t\tid: row.id,\n\t\tnetwork: parseInstanceNetwork(row.network),\n\t\tcreated_at: row.created_at,\n\t};\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";AAGO,IAAM,oBAAoB,CAAC,WAAW,WAAW,QAAQ;AAAA;AASzD,MAAM,qCAAqC,MAAM;AAAA,EAG7C;AAAA,EACA;AAAA,EAHD,OAAO;AAAA,EAChB,WAAW,CACD,UACA,WACR;AAAA,IACD,MAAM,uBAAuB,8BAA8B,WAAW;AAAA,IAH7D;AAAA,IACA;AAAA;AAIX;AAAA;AAEO,MAAM,oCAAoC,MAAM;AAAA,EAEjC;AAAA,EADZ,OAAO;AAAA,EAChB,WAAW,CAAU,OAAe;AAAA,IACnC,MACC,6DAA6D,QAC9D;AAAA,IAHoB;AAAA;AAKtB;AAEO,SAAS,oBAAoB,CAAC,OAAgC;AAAA,EACpE,MAAM,UAAU,MAAM,KAAK,EAAE,YAAY;AAAA,EACzC,IAAK,kBAAwC,SAAS,OAAO,GAAG;AAAA,IAC/D,OAAO;AAAA,EACR;AAAA,EACA,MAAM,IAAI,4BAA4B,KAAK;AAAA;AAIrC,SAAS,sBAAsB,CACrC,MAAyB,QAAQ,KACf;AAAA,EAClB,OAAO,qBAAqB,IAAI,kBAAkB,IAAI,WAAW,SAAS;AAAA;AAG3E,eAAsB,WAAW,CAChC,IAC8B;AAAA,EAC9B,MAAM,MAAM,MAAM,GAChB,WAAW,WAAW,EACtB,OAAO,CAAC,MAAM,WAAW,YAAY,CAAC,EACtC,iBAAiB;AAAA,EACnB,OAAO,MAAM,WAAW,GAAG,IAAI;AAAA;AAQhC,eAAsB,cAAc,CACnC,IACA,OACuB;AAAA,EACvB,MAAM,WAAW,MAAM,YAAY,EAAE;AAAA,EACrC,IAAI,UAAU;AAAA,IACb,IAAI,SAAS,YAAY,MAAM,SAAS;AAAA,MACvC,MAAM,IAAI,6BAA6B,SAAS,SAAS,MAAM,OAAO;AAAA,IACvE;AAAA,IACA,OAAO;AAAA,EACR;AAAA,EACA,IAAI;AAAA,IACH,MAAM,WAAW,MAAM,GACrB,WAAW,WAAW,EACtB,OAAO,EAAE,SAAS,MAAM,QAAQ,CAAC,EACjC,UAAU,CAAC,MAAM,WAAW,YAAY,CAAC,EACzC,wBAAwB;AAAA,IAC1B,OAAO,WAAW,QAAQ;AAAA,IACzB,MAAM;AAAA,IAEP,MAAM,QAAQ,MAAM,YAAY,EAAE;AAAA,IAClC,IAAI,CAAC;AAAA,MAAO,MAAM,IAAI,MAAM,2BAA2B;AAAA,IACvD,IAAI,MAAM,YAAY,MAAM,SAAS;AAAA,MACpC,MAAM,IAAI,6BAA6B,MAAM,SAAS,MAAM,OAAO;AAAA,IACpE;AAAA,IACA,OAAO;AAAA;AAAA;AAIT,SAAS,UAAU,CAAC,KAIJ;AAAA,EACf,OAAO;AAAA,IACN,IAAI,IAAI;AAAA,IACR,SAAS,qBAAqB,IAAI,OAAO;AAAA,IACzC,YAAY,IAAI;AAAA,EACjB;AAAA;",
|
|
8
|
+
"debugId": "2C46A70E1317C50664756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -153,7 +153,6 @@ interface SubgraphsTable {
|
|
|
153
153
|
handler_code: string | null;
|
|
154
154
|
source_code: string | null;
|
|
155
155
|
project_id: string | null;
|
|
156
|
-
visibility: Generated<string>;
|
|
157
156
|
/** Paid (wallet-ghost) deploys expire unless renewed or claimed; NULL = no expiry. */
|
|
158
157
|
expires_at: Date | null;
|
|
159
158
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
@@ -284,21 +283,6 @@ interface MagicLinksTable {
|
|
|
284
283
|
failed_attempts: Generated<number>;
|
|
285
284
|
created_at: Generated<Date>;
|
|
286
285
|
}
|
|
287
|
-
/** One-shot hashed tokens that attach a play ghost to an email at claim. */
|
|
288
|
-
interface ClaimTokensTable {
|
|
289
|
-
id: Generated<string>;
|
|
290
|
-
account_id: string;
|
|
291
|
-
token_hash: string;
|
|
292
|
-
created_at: Generated<Date>;
|
|
293
|
-
expires_at: Date;
|
|
294
|
-
used_at: Date | null;
|
|
295
|
-
}
|
|
296
|
-
/** 3 play provisions per IP per UTC day. PK (ip_hash, day); `count` caps at 3. */
|
|
297
|
-
interface PlayProvisionsTable {
|
|
298
|
-
ip_hash: string;
|
|
299
|
-
day: string;
|
|
300
|
-
count: Generated<number>;
|
|
301
|
-
}
|
|
302
286
|
interface SubgraphProcessingStatsTable {
|
|
303
287
|
id: Generated<string>;
|
|
304
288
|
subgraph_name: string;
|
|
@@ -760,8 +744,6 @@ interface Database {
|
|
|
760
744
|
accounts: AccountsTable;
|
|
761
745
|
sessions: SessionsTable;
|
|
762
746
|
magic_links: MagicLinksTable;
|
|
763
|
-
claim_tokens: ClaimTokensTable;
|
|
764
|
-
play_provisions: PlayProvisionsTable;
|
|
765
747
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
766
748
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
767
749
|
subgraph_gaps: SubgraphGapsTable;
|
|
@@ -770,7 +752,6 @@ interface Database {
|
|
|
770
752
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
771
753
|
account_spend_caps: AccountSpendCapsTable;
|
|
772
754
|
account_credits: AccountCreditsTable;
|
|
773
|
-
hosted_meter_days: HostedMeterDaysTable;
|
|
774
755
|
webhooks: WebhooksTable;
|
|
775
756
|
webhook_outbox: WebhookOutboxTable;
|
|
776
757
|
webhook_deliveries: WebhookDeliveriesTable;
|
|
@@ -801,6 +782,8 @@ interface Database {
|
|
|
801
782
|
coverage_segments: CoverageSegmentsTable;
|
|
802
783
|
stage_failures: StageFailuresTable;
|
|
803
784
|
archive_fetches: ArchiveFetchesTable;
|
|
785
|
+
waitlists: WaitlistsTable;
|
|
786
|
+
waitlist_signups: WaitlistSignupsTable;
|
|
804
787
|
}
|
|
805
788
|
interface ServiceHeartbeatsTable {
|
|
806
789
|
name: string;
|
|
@@ -829,15 +812,6 @@ interface AccountCreditsTable {
|
|
|
829
812
|
refill_last_at: Date | null;
|
|
830
813
|
updated_at: Generated<Date>;
|
|
831
814
|
}
|
|
832
|
-
/** Daily idempotency ledger for hosted subgraph running + storage meters. */
|
|
833
|
-
interface HostedMeterDaysTable {
|
|
834
|
-
day: string;
|
|
835
|
-
account_id: string;
|
|
836
|
-
subgraph_name: string;
|
|
837
|
-
kind: string;
|
|
838
|
-
usd_micros: string | number | bigint;
|
|
839
|
-
billed_at: Generated<Date>;
|
|
840
|
-
}
|
|
841
815
|
/**
|
|
842
816
|
* Archive fetch charge log (design-f089 gate). Append-only: one row per
|
|
843
817
|
* priced attempt to fetch a partition object. `usd_micros` is 0 for
|
|
@@ -940,6 +914,27 @@ interface TriggerEvaluatorStateTable {
|
|
|
940
914
|
last_settlement_scan_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
941
915
|
updated_at: Generated<Date>;
|
|
942
916
|
}
|
|
917
|
+
/** A public waitlist page: what it is for and whether it takes signups. */
|
|
918
|
+
interface WaitlistsTable {
|
|
919
|
+
slug: string;
|
|
920
|
+
title: string;
|
|
921
|
+
description: string;
|
|
922
|
+
url: string;
|
|
923
|
+
opened_at: Generated<Date>;
|
|
924
|
+
/** Null while the list is open. */
|
|
925
|
+
closed_at: Date | null;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* One signup per (list, contact, token). `answers` holds the list's own
|
|
929
|
+
* questions, validated per list by the API before insert.
|
|
930
|
+
*/
|
|
931
|
+
interface WaitlistSignupsTable {
|
|
932
|
+
id: Generated<string>;
|
|
933
|
+
list: string;
|
|
934
|
+
contact: string;
|
|
935
|
+
answers: Record<string, unknown>;
|
|
936
|
+
created_at: Generated<Date>;
|
|
937
|
+
}
|
|
943
938
|
interface Gap {
|
|
944
939
|
gapStart: number;
|
|
945
940
|
gapEnd: number;
|
|
@@ -991,7 +986,7 @@ type BrokenLink = {
|
|
|
991
986
|
* concern, and scanning eight million rows every cycle is not.
|
|
992
987
|
*/
|
|
993
988
|
declare function findBrokenLinks(db: Kysely<Database>, opts?: {
|
|
994
|
-
window?: number
|
|
989
|
+
window?: number | null
|
|
995
990
|
limit?: number
|
|
996
991
|
}): Promise<BrokenLink[]>;
|
|
997
|
-
export {
|
|
992
|
+
export { BrokenLink, ChainDataIntegrity, Gap, checkChainDataIntegrity, computeContiguousTip, countMissingBlocks, findBrokenLinks, findGaps };
|
|
@@ -1,19 +1,3 @@
|
|
|
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
1
|
// src/db/queries/integrity.ts
|
|
18
2
|
import { sql } from "kysely";
|
|
19
3
|
async function findGaps(db, limit) {
|
|
@@ -93,14 +77,15 @@ async function computeContiguousTip(db, fromHeight) {
|
|
|
93
77
|
return Number(rows[0]?.tip ?? fromHeight);
|
|
94
78
|
}
|
|
95
79
|
async function findBrokenLinks(db, opts = {}) {
|
|
96
|
-
const windowSize = opts.window
|
|
80
|
+
const windowSize = opts.window === undefined ? 1e4 : opts.window;
|
|
97
81
|
const limitClause = opts.limit ? sql`LIMIT ${opts.limit}` : sql``;
|
|
82
|
+
const windowClause = windowSize === null ? sql`` : sql`AND height > (SELECT MAX(height) - ${windowSize} FROM blocks WHERE canonical = true)`;
|
|
98
83
|
const { rows } = await sql`
|
|
99
84
|
WITH recent AS (
|
|
100
85
|
SELECT height, hash, parent_hash
|
|
101
86
|
FROM blocks
|
|
102
87
|
WHERE canonical = true
|
|
103
|
-
|
|
88
|
+
${windowClause}
|
|
104
89
|
)
|
|
105
90
|
SELECT b.height, b.hash, p.hash AS expected_parent, b.parent_hash AS stored_parent
|
|
106
91
|
FROM recent b
|
|
@@ -117,12 +102,12 @@ async function findBrokenLinks(db, opts = {}) {
|
|
|
117
102
|
}));
|
|
118
103
|
}
|
|
119
104
|
export {
|
|
120
|
-
|
|
121
|
-
findBrokenLinks,
|
|
122
|
-
countMissingBlocks,
|
|
105
|
+
checkChainDataIntegrity,
|
|
123
106
|
computeContiguousTip,
|
|
124
|
-
|
|
107
|
+
countMissingBlocks,
|
|
108
|
+
findBrokenLinks,
|
|
109
|
+
findGaps
|
|
125
110
|
};
|
|
126
111
|
|
|
127
|
-
//# debugId=
|
|
112
|
+
//# debugId=1E6E1376EB78163164756E2164756E21
|
|
128
113
|
//# sourceMappingURL=integrity.js.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/db/queries/integrity.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { type Kysely, sql } from \"kysely\";\nimport type { Database } from \"../types.ts\";\n\nexport interface Gap {\n\tgapStart: number;\n\tgapEnd: number;\n\tsize: number;\n}\n\nexport async function findGaps(\n\tdb: Kysely<Database>,\n\tlimit?: number,\n): Promise<Gap[]> {\n\tconst limitClause = limit ? sql`LIMIT ${limit}` : sql``;\n\tconst { rows } = await sql<{\n\t\tgap_start: string;\n\t\tgap_end: string;\n\t\tsize: string;\n\t}>`\n SELECT gap_start, gap_end, gap_end - gap_start + 1 AS size\n FROM (\n SELECT height + 1 AS gap_start, next_height - 1 AS gap_end\n FROM (\n SELECT height, LEAD(height) OVER (ORDER BY height) AS next_height\n FROM blocks WHERE canonical = true\n ) sub\n WHERE next_height - height > 1\n ) gaps\n ORDER BY gap_start\n ${limitClause}\n `.execute(db);\n\n\treturn rows.map((r) => ({\n\t\tgapStart: Number(r.gap_start),\n\t\tgapEnd: Number(r.gap_end),\n\t\tsize: Number(r.size),\n\t}));\n}\n\nexport async function countMissingBlocks(\n\tdb: Kysely<Database>,\n): Promise<number> {\n\tconst { rows } = await sql<{ total: string }>`\n SELECT COALESCE(SUM(next_height - height - 1), 0) AS total\n FROM (\n SELECT height, LEAD(height) OVER (ORDER BY height) AS next_height\n FROM blocks WHERE canonical = true\n ) sub\n WHERE next_height - height > 1\n `.execute(db);\n\n\treturn Number(rows[0]?.total ?? 0);\n}\n\nexport interface ChainDataIntegrity {\n\tok: boolean;\n\tmaxHeight: number;\n\tsampleHeight: number | null;\n\tsampleBlocks: number;\n\treason: string | null;\n}\n\n/**\n * Cheap sanity check that the `blocks` table actually holds the history its tip\n * implies. Catches a wrong/empty Postgres volume — e.g. a container recreated\n * against a fresh volume — being silently served: if the tip is high but a\n * window of blocks well below it is missing, the data isn't what the tip claims.\n *\n * Below `checkFloor` we can't distinguish a fresh install from an empty volume,\n * so we report ok — a genuinely new DB legitimately has little history. Two\n * indexed lookups, safe to run on every startup / health poll.\n */\nexport async function checkChainDataIntegrity(\n\tdb: Kysely<Database>,\n\topts?: { checkFloor?: number; lookback?: number },\n): Promise<ChainDataIntegrity> {\n\tconst checkFloor = opts?.checkFloor ?? 1_000_000;\n\tconst lookback = opts?.lookback ?? 500_000;\n\n\tconst { rows: tipRows } = await sql<{ max: string | null }>`\n\t\tSELECT MAX(height) AS max FROM blocks WHERE canonical = true\n\t`.execute(db);\n\tconst maxHeight = Number(tipRows[0]?.max ?? 0);\n\n\tif (maxHeight < checkFloor) {\n\t\treturn {\n\t\t\tok: true,\n\t\t\tmaxHeight,\n\t\t\tsampleHeight: null,\n\t\t\tsampleBlocks: 0,\n\t\t\treason: null,\n\t\t};\n\t}\n\n\tconst sampleHeight = maxHeight - lookback;\n\tconst { rows: sampleRows } = await sql<{ n: string }>`\n\t\tSELECT count(*) AS n FROM blocks\n\t\tWHERE canonical = true AND height >= ${sampleHeight} AND height < ${sampleHeight + 1000}\n\t`.execute(db);\n\tconst sampleBlocks = Number(sampleRows[0]?.n ?? 0);\n\n\treturn {\n\t\tok: sampleBlocks > 0,\n\t\tmaxHeight,\n\t\tsampleHeight,\n\t\tsampleBlocks,\n\t\treason:\n\t\t\tsampleBlocks > 0\n\t\t\t\t? null\n\t\t\t\t: `tip is ${maxHeight} but no canonical blocks near ${sampleHeight} — wrong or empty volume?`,\n\t};\n}\n\nexport async function computeContiguousTip(\n\tdb: Kysely<Database>,\n\tfromHeight: number,\n): Promise<number> {\n\tconst { rows } = await sql<{ tip: string }>`\n SELECT COALESCE(MAX(height), ${fromHeight}) AS tip\n FROM (\n SELECT height, height - ROW_NUMBER() OVER (ORDER BY height) AS grp\n FROM blocks WHERE canonical = true AND height >= ${fromHeight}\n ) sub\n WHERE grp = (\n SELECT height - ROW_NUMBER() OVER (ORDER BY height)\n FROM blocks WHERE canonical = true AND height = ${fromHeight}\n )\n `.execute(db);\n\n\treturn Number(rows[0]?.tip ?? fromHeight);\n}\n\nexport type BrokenLink = {\n\theight: number;\n\thash: string;\n\texpectedParent: string;\n\tstoredParent: string;\n};\n\n/**\n * Canonical heights whose block does not descend from the canonical block\n * below it.\n *\n * `findGaps` asks \"is every height present?\", which a chain sitting on a losing\n * fork answers yes to. On 2026-07-30 a reorg at 8,663,166 was resolved the\n * wrong way: we adopted a block that mainnet orphaned, its true successors were\n * swept non-canonical, and later blocks were inserted canonical on top. Every\n * height existed. Nothing was \"missing\". The chain simply did not join up, and\n * no check asked that question — so we served a broken chain for seventeen\n * hours and only noticed because subgraphs stopped moving.\n *\n * Scoped to a recent window by default: an unlinked height is an active-repair\n * concern, and scanning eight million rows every cycle is not.\n */\nexport async function findBrokenLinks(\n\tdb: Kysely<Database>,\n\topts: { window?: number; limit?: number } = {},\n): Promise<BrokenLink[]> {\n\tconst windowSize = opts.window
|
|
5
|
+
"import { type Kysely, sql } from \"kysely\";\nimport type { Database } from \"../types.ts\";\n\nexport interface Gap {\n\tgapStart: number;\n\tgapEnd: number;\n\tsize: number;\n}\n\nexport async function findGaps(\n\tdb: Kysely<Database>,\n\tlimit?: number,\n): Promise<Gap[]> {\n\tconst limitClause = limit ? sql`LIMIT ${limit}` : sql``;\n\tconst { rows } = await sql<{\n\t\tgap_start: string;\n\t\tgap_end: string;\n\t\tsize: string;\n\t}>`\n SELECT gap_start, gap_end, gap_end - gap_start + 1 AS size\n FROM (\n SELECT height + 1 AS gap_start, next_height - 1 AS gap_end\n FROM (\n SELECT height, LEAD(height) OVER (ORDER BY height) AS next_height\n FROM blocks WHERE canonical = true\n ) sub\n WHERE next_height - height > 1\n ) gaps\n ORDER BY gap_start\n ${limitClause}\n `.execute(db);\n\n\treturn rows.map((r) => ({\n\t\tgapStart: Number(r.gap_start),\n\t\tgapEnd: Number(r.gap_end),\n\t\tsize: Number(r.size),\n\t}));\n}\n\nexport async function countMissingBlocks(\n\tdb: Kysely<Database>,\n): Promise<number> {\n\tconst { rows } = await sql<{ total: string }>`\n SELECT COALESCE(SUM(next_height - height - 1), 0) AS total\n FROM (\n SELECT height, LEAD(height) OVER (ORDER BY height) AS next_height\n FROM blocks WHERE canonical = true\n ) sub\n WHERE next_height - height > 1\n `.execute(db);\n\n\treturn Number(rows[0]?.total ?? 0);\n}\n\nexport interface ChainDataIntegrity {\n\tok: boolean;\n\tmaxHeight: number;\n\tsampleHeight: number | null;\n\tsampleBlocks: number;\n\treason: string | null;\n}\n\n/**\n * Cheap sanity check that the `blocks` table actually holds the history its tip\n * implies. Catches a wrong/empty Postgres volume — e.g. a container recreated\n * against a fresh volume — being silently served: if the tip is high but a\n * window of blocks well below it is missing, the data isn't what the tip claims.\n *\n * Below `checkFloor` we can't distinguish a fresh install from an empty volume,\n * so we report ok — a genuinely new DB legitimately has little history. Two\n * indexed lookups, safe to run on every startup / health poll.\n */\nexport async function checkChainDataIntegrity(\n\tdb: Kysely<Database>,\n\topts?: { checkFloor?: number; lookback?: number },\n): Promise<ChainDataIntegrity> {\n\tconst checkFloor = opts?.checkFloor ?? 1_000_000;\n\tconst lookback = opts?.lookback ?? 500_000;\n\n\tconst { rows: tipRows } = await sql<{ max: string | null }>`\n\t\tSELECT MAX(height) AS max FROM blocks WHERE canonical = true\n\t`.execute(db);\n\tconst maxHeight = Number(tipRows[0]?.max ?? 0);\n\n\tif (maxHeight < checkFloor) {\n\t\treturn {\n\t\t\tok: true,\n\t\t\tmaxHeight,\n\t\t\tsampleHeight: null,\n\t\t\tsampleBlocks: 0,\n\t\t\treason: null,\n\t\t};\n\t}\n\n\tconst sampleHeight = maxHeight - lookback;\n\tconst { rows: sampleRows } = await sql<{ n: string }>`\n\t\tSELECT count(*) AS n FROM blocks\n\t\tWHERE canonical = true AND height >= ${sampleHeight} AND height < ${sampleHeight + 1000}\n\t`.execute(db);\n\tconst sampleBlocks = Number(sampleRows[0]?.n ?? 0);\n\n\treturn {\n\t\tok: sampleBlocks > 0,\n\t\tmaxHeight,\n\t\tsampleHeight,\n\t\tsampleBlocks,\n\t\treason:\n\t\t\tsampleBlocks > 0\n\t\t\t\t? null\n\t\t\t\t: `tip is ${maxHeight} but no canonical blocks near ${sampleHeight} — wrong or empty volume?`,\n\t};\n}\n\nexport async function computeContiguousTip(\n\tdb: Kysely<Database>,\n\tfromHeight: number,\n): Promise<number> {\n\tconst { rows } = await sql<{ tip: string }>`\n SELECT COALESCE(MAX(height), ${fromHeight}) AS tip\n FROM (\n SELECT height, height - ROW_NUMBER() OVER (ORDER BY height) AS grp\n FROM blocks WHERE canonical = true AND height >= ${fromHeight}\n ) sub\n WHERE grp = (\n SELECT height - ROW_NUMBER() OVER (ORDER BY height)\n FROM blocks WHERE canonical = true AND height = ${fromHeight}\n )\n `.execute(db);\n\n\treturn Number(rows[0]?.tip ?? fromHeight);\n}\n\nexport type BrokenLink = {\n\theight: number;\n\thash: string;\n\texpectedParent: string;\n\tstoredParent: string;\n};\n\n/**\n * Canonical heights whose block does not descend from the canonical block\n * below it.\n *\n * `findGaps` asks \"is every height present?\", which a chain sitting on a losing\n * fork answers yes to. On 2026-07-30 a reorg at 8,663,166 was resolved the\n * wrong way: we adopted a block that mainnet orphaned, its true successors were\n * swept non-canonical, and later blocks were inserted canonical on top. Every\n * height existed. Nothing was \"missing\". The chain simply did not join up, and\n * no check asked that question — so we served a broken chain for seventeen\n * hours and only noticed because subgraphs stopped moving.\n *\n * Scoped to a recent window by default: an unlinked height is an active-repair\n * concern, and scanning eight million rows every cycle is not.\n */\nexport async function findBrokenLinks(\n\tdb: Kysely<Database>,\n\t/** Heights below the tip to scan; `null` scans the whole chain. */\n\topts: { window?: number | null; limit?: number } = {},\n): Promise<BrokenLink[]> {\n\tconst windowSize = opts.window === undefined ? 10_000 : opts.window;\n\tconst limitClause = opts.limit ? sql`LIMIT ${opts.limit}` : sql``;\n\tconst windowClause =\n\t\twindowSize === null\n\t\t\t? sql``\n\t\t\t: sql`AND height > (SELECT MAX(height) - ${windowSize} FROM blocks WHERE canonical = true)`;\n\tconst { rows } = await sql<{\n\t\theight: string | number;\n\t\thash: string;\n\t\texpected_parent: string;\n\t\tstored_parent: string;\n\t}>`\n\t\tWITH recent AS (\n\t\t\tSELECT height, hash, parent_hash\n\t\t\tFROM blocks\n\t\t\tWHERE canonical = true\n\t\t\t\t${windowClause}\n\t\t)\n\t\tSELECT b.height, b.hash, p.hash AS expected_parent, b.parent_hash AS stored_parent\n\t\tFROM recent b\n\t\tJOIN recent p ON p.height = b.height - 1\n\t\tWHERE b.parent_hash <> p.hash\n\t\tORDER BY b.height\n\t\t${limitClause}\n\t`.execute(db);\n\treturn rows.map((r) => ({\n\t\theight: Number(r.height),\n\t\thash: r.hash,\n\t\texpectedParent: r.expected_parent,\n\t\tstoredParent: r.stored_parent,\n\t}));\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";AAAA;AASA,eAAsB,QAAQ,CAC7B,IACA,OACiB;AAAA,EACjB,MAAM,cAAc,QAAQ,YAAY,UAAU;AAAA,EAClD,QAAQ,SAAS,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAelB;AAAA,IACF,QAAQ,EAAE;AAAA,EAEb,OAAO,KAAK,IAAI,CAAC,OAAO;AAAA,IACvB,UAAU,OAAO,EAAE,SAAS;AAAA,IAC5B,QAAQ,OAAO,EAAE,OAAO;AAAA,IACxB,MAAM,OAAO,EAAE,IAAI;AAAA,EACpB,EAAE;AAAA;AAGH,eAAsB,kBAAkB,CACvC,IACkB;AAAA,EAClB,QAAQ,SAAS,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOpB,QAAQ,EAAE;AAAA,EAEb,OAAO,OAAO,KAAK,IAAI,SAAS,CAAC;AAAA;AAqBlC,eAAsB,uBAAuB,CAC5C,IACA,MAC8B;AAAA,EAC9B,MAAM,aAAa,MAAM,cAAc;AAAA,EACvC,MAAM,WAAW,MAAM,YAAY;AAAA,EAEnC,QAAQ,MAAM,YAAY,MAAM;AAAA;AAAA,GAE9B,QAAQ,EAAE;AAAA,EACZ,MAAM,YAAY,OAAO,QAAQ,IAAI,OAAO,CAAC;AAAA,EAE7C,IAAI,YAAY,YAAY;AAAA,IAC3B,OAAO;AAAA,MACN,IAAI;AAAA,MACJ;AAAA,MACA,cAAc;AAAA,MACd,cAAc;AAAA,MACd,QAAQ;AAAA,IACT;AAAA,EACD;AAAA,EAEA,MAAM,eAAe,YAAY;AAAA,EACjC,QAAQ,MAAM,eAAe,MAAM;AAAA;AAAA,yCAEK,6BAA6B,eAAe;AAAA,GAClF,QAAQ,EAAE;AAAA,EACZ,MAAM,eAAe,OAAO,WAAW,IAAI,KAAK,CAAC;AAAA,EAEjD,OAAO;AAAA,IACN,IAAI,eAAe;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA,QACC,eAAe,IACZ,OACA,UAAU,0CAA0C;AAAA,EACzD;AAAA;AAGD,eAAsB,oBAAoB,CACzC,IACA,YACkB;AAAA,EAClB,QAAQ,SAAS,MAAM;AAAA,mCACW;AAAA;AAAA;AAAA,yDAGsB;AAAA;AAAA;AAAA;AAAA,wDAID;AAAA;AAAA,IAEpD,QAAQ,EAAE;AAAA,EAEb,OAAO,OAAO,KAAK,IAAI,OAAO,UAAU;AAAA;AAyBzC,eAAsB,eAAe,CACpC,IAEA,OAAmD,CAAC,GAC5B;AAAA,EACxB,MAAM,aAAa,KAAK,WAAW,YAAY,MAAS,KAAK;AAAA,EAC7D,MAAM,cAAc,KAAK,QAAQ,YAAY,KAAK,UAAU;AAAA,EAC5D,MAAM,eACL,eAAe,OACZ,QACA,yCAAyC;AAAA,EAC7C,QAAQ,SAAS,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,MAUlB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOF;AAAA,GACD,QAAQ,EAAE;AAAA,EACZ,OAAO,KAAK,IAAI,CAAC,OAAO;AAAA,IACvB,QAAQ,OAAO,EAAE,MAAM;AAAA,IACvB,MAAM,EAAE;AAAA,IACR,gBAAgB,EAAE;AAAA,IAClB,cAAc,EAAE;AAAA,EACjB,EAAE;AAAA;",
|
|
8
|
+
"debugId": "1E6E1376EB78163164756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -153,7 +153,6 @@ interface SubgraphsTable {
|
|
|
153
153
|
handler_code: string | null;
|
|
154
154
|
source_code: string | null;
|
|
155
155
|
project_id: string | null;
|
|
156
|
-
visibility: Generated<string>;
|
|
157
156
|
/** Paid (wallet-ghost) deploys expire unless renewed or claimed; NULL = no expiry. */
|
|
158
157
|
expires_at: Date | null;
|
|
159
158
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
@@ -284,21 +283,6 @@ interface MagicLinksTable {
|
|
|
284
283
|
failed_attempts: Generated<number>;
|
|
285
284
|
created_at: Generated<Date>;
|
|
286
285
|
}
|
|
287
|
-
/** One-shot hashed tokens that attach a play ghost to an email at claim. */
|
|
288
|
-
interface ClaimTokensTable {
|
|
289
|
-
id: Generated<string>;
|
|
290
|
-
account_id: string;
|
|
291
|
-
token_hash: string;
|
|
292
|
-
created_at: Generated<Date>;
|
|
293
|
-
expires_at: Date;
|
|
294
|
-
used_at: Date | null;
|
|
295
|
-
}
|
|
296
|
-
/** 3 play provisions per IP per UTC day. PK (ip_hash, day); `count` caps at 3. */
|
|
297
|
-
interface PlayProvisionsTable {
|
|
298
|
-
ip_hash: string;
|
|
299
|
-
day: string;
|
|
300
|
-
count: Generated<number>;
|
|
301
|
-
}
|
|
302
286
|
interface SubgraphProcessingStatsTable {
|
|
303
287
|
id: Generated<string>;
|
|
304
288
|
subgraph_name: string;
|
|
@@ -760,8 +744,6 @@ interface Database {
|
|
|
760
744
|
accounts: AccountsTable;
|
|
761
745
|
sessions: SessionsTable;
|
|
762
746
|
magic_links: MagicLinksTable;
|
|
763
|
-
claim_tokens: ClaimTokensTable;
|
|
764
|
-
play_provisions: PlayProvisionsTable;
|
|
765
747
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
766
748
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
767
749
|
subgraph_gaps: SubgraphGapsTable;
|
|
@@ -770,7 +752,6 @@ interface Database {
|
|
|
770
752
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
771
753
|
account_spend_caps: AccountSpendCapsTable;
|
|
772
754
|
account_credits: AccountCreditsTable;
|
|
773
|
-
hosted_meter_days: HostedMeterDaysTable;
|
|
774
755
|
webhooks: WebhooksTable;
|
|
775
756
|
webhook_outbox: WebhookOutboxTable;
|
|
776
757
|
webhook_deliveries: WebhookDeliveriesTable;
|
|
@@ -801,6 +782,8 @@ interface Database {
|
|
|
801
782
|
coverage_segments: CoverageSegmentsTable;
|
|
802
783
|
stage_failures: StageFailuresTable;
|
|
803
784
|
archive_fetches: ArchiveFetchesTable;
|
|
785
|
+
waitlists: WaitlistsTable;
|
|
786
|
+
waitlist_signups: WaitlistSignupsTable;
|
|
804
787
|
}
|
|
805
788
|
interface ServiceHeartbeatsTable {
|
|
806
789
|
name: string;
|
|
@@ -829,15 +812,6 @@ interface AccountCreditsTable {
|
|
|
829
812
|
refill_last_at: Date | null;
|
|
830
813
|
updated_at: Generated<Date>;
|
|
831
814
|
}
|
|
832
|
-
/** Daily idempotency ledger for hosted subgraph running + storage meters. */
|
|
833
|
-
interface HostedMeterDaysTable {
|
|
834
|
-
day: string;
|
|
835
|
-
account_id: string;
|
|
836
|
-
subgraph_name: string;
|
|
837
|
-
kind: string;
|
|
838
|
-
usd_micros: string | number | bigint;
|
|
839
|
-
billed_at: Generated<Date>;
|
|
840
|
-
}
|
|
841
815
|
/**
|
|
842
816
|
* Archive fetch charge log (design-f089 gate). Append-only: one row per
|
|
843
817
|
* priced attempt to fetch a partition object. `usd_micros` is 0 for
|
|
@@ -940,6 +914,27 @@ interface TriggerEvaluatorStateTable {
|
|
|
940
914
|
last_settlement_scan_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
941
915
|
updated_at: Generated<Date>;
|
|
942
916
|
}
|
|
917
|
+
/** A public waitlist page: what it is for and whether it takes signups. */
|
|
918
|
+
interface WaitlistsTable {
|
|
919
|
+
slug: string;
|
|
920
|
+
title: string;
|
|
921
|
+
description: string;
|
|
922
|
+
url: string;
|
|
923
|
+
opened_at: Generated<Date>;
|
|
924
|
+
/** Null while the list is open. */
|
|
925
|
+
closed_at: Date | null;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* One signup per (list, contact, token). `answers` holds the list's own
|
|
929
|
+
* questions, validated per list by the API before insert.
|
|
930
|
+
*/
|
|
931
|
+
interface WaitlistSignupsTable {
|
|
932
|
+
id: Generated<string>;
|
|
933
|
+
list: string;
|
|
934
|
+
contact: string;
|
|
935
|
+
answers: Record<string, unknown>;
|
|
936
|
+
created_at: Generated<Date>;
|
|
937
|
+
}
|
|
943
938
|
interface GapRange {
|
|
944
939
|
start: number;
|
|
945
940
|
end: number;
|
|
@@ -990,4 +985,4 @@ declare function countSubgraphMissingBlocks(db: Kysely<Database>, subgraphName:
|
|
|
990
985
|
* Used by the /status endpoint for per-subgraph gap summary.
|
|
991
986
|
*/
|
|
992
987
|
declare function getGapSummaryBySubgraph(db: Kysely<Database>): Promise<GapSummary[]>;
|
|
993
|
-
export {
|
|
988
|
+
export { GapRange, GapSummary, SubgraphGapRow, countSubgraphMissingBlocks, findSubgraphGaps, getGapSummaryBySubgraph, recordGapBatch, resolveGaps };
|
|
@@ -1,19 +1,3 @@
|
|
|
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
1
|
// src/db/queries/subgraph-gaps.ts
|
|
18
2
|
import { sql } from "kysely";
|
|
19
3
|
async function recordGapBatch(db, subgraphId, subgraphName, gaps) {
|
|
@@ -92,12 +76,12 @@ async function getGapSummaryBySubgraph(db) {
|
|
|
92
76
|
}));
|
|
93
77
|
}
|
|
94
78
|
export {
|
|
95
|
-
|
|
96
|
-
recordGapBatch,
|
|
97
|
-
getGapSummaryBySubgraph,
|
|
79
|
+
countSubgraphMissingBlocks,
|
|
98
80
|
findSubgraphGaps,
|
|
99
|
-
|
|
81
|
+
getGapSummaryBySubgraph,
|
|
82
|
+
recordGapBatch,
|
|
83
|
+
resolveGaps
|
|
100
84
|
};
|
|
101
85
|
|
|
102
|
-
//# debugId=
|
|
86
|
+
//# debugId=3220DE92B2B7A0A764756E2164756E21
|
|
103
87
|
//# sourceMappingURL=subgraph-gaps.js.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import { type Kysely, sql } from \"kysely\";\nimport type { Database } from \"../types.ts\";\n\nexport interface GapRange {\n\tstart: number;\n\tend: number;\n\treason: string;\n}\n\nexport interface SubgraphGapRow {\n\tid: string;\n\tsubgraphName: string;\n\tgapStart: number;\n\tgapEnd: number;\n\tsize: number;\n\treason: string;\n\tdetectedAt: Date;\n\tresolvedAt: Date | null;\n}\n\nexport interface GapSummary {\n\tsubgraphName: string;\n\tgapCount: number;\n\ttotalMissingBlocks: number;\n}\n\n/**\n * Batch-insert gap ranges for a subgraph. Append-only — no merge on write.\n * Callers should coalesce contiguous skipped blocks into ranges before calling.\n */\nexport async function recordGapBatch(\n\tdb: Kysely<Database>,\n\tsubgraphId: string,\n\tsubgraphName: string,\n\tgaps: GapRange[],\n): Promise<void> {\n\tif (gaps.length === 0) return;\n\n\tawait db\n\t\t.insertInto(\"subgraph_gaps\")\n\t\t.values(\n\t\t\tgaps.map((g) => ({\n\t\t\t\tsubgraph_id: subgraphId,\n\t\t\t\tsubgraph_name: subgraphName,\n\t\t\t\tgap_start: g.start,\n\t\t\t\tgap_end: g.end,\n\t\t\t\treason: g.reason,\n\t\t\t})),\n\t\t)\n\t\t.execute();\n}\n\n/**\n * List gaps for a subgraph with computed size.\n */\nexport async function findSubgraphGaps(\n\tdb: Kysely<Database>,\n\tsubgraphName: string,\n\topts?: { limit?: number; offset?: number; unresolvedOnly?: boolean },\n): Promise<{ gaps: SubgraphGapRow[]; total: number }> {\n\tconst limit = opts?.limit ?? 50;\n\tconst offset = opts?.offset ?? 0;\n\tconst unresolvedOnly = opts?.unresolvedOnly ?? true;\n\n\tlet baseQuery = db\n\t\t.selectFrom(\"subgraph_gaps\")\n\t\t.where(\"subgraph_name\", \"=\", subgraphName);\n\n\tif (unresolvedOnly) {\n\t\tbaseQuery = baseQuery.where(\"resolved_at\", \"is\", null);\n\t}\n\n\tconst [rows, countResult] = await Promise.all([\n\t\tbaseQuery\n\t\t\t.select([\n\t\t\t\t\"id\",\n\t\t\t\t\"subgraph_name\",\n\t\t\t\t\"gap_start\",\n\t\t\t\t\"gap_end\",\n\t\t\t\tsql<number>`gap_end - gap_start + 1`.as(\"size\"),\n\t\t\t\t\"reason\",\n\t\t\t\t\"detected_at\",\n\t\t\t\t\"resolved_at\",\n\t\t\t])\n\t\t\t.orderBy(\"gap_start\", \"asc\")\n\t\t\t.limit(limit)\n\t\t\t.offset(offset)\n\t\t\t.execute(),\n\t\tbaseQuery\n\t\t\t.select(sql<number>`count(*)`.as(\"count\"))\n\t\t\t.executeTakeFirstOrThrow(),\n\t]);\n\n\treturn {\n\t\tgaps: rows.map((r) => ({\n\t\t\tid: r.id,\n\t\t\tsubgraphName: r.subgraph_name,\n\t\t\tgapStart: Number(r.gap_start),\n\t\t\tgapEnd: Number(r.gap_end),\n\t\t\tsize: Number(r.size),\n\t\t\treason: r.reason,\n\t\t\tdetectedAt: r.detected_at,\n\t\t\tresolvedAt: r.resolved_at,\n\t\t})),\n\t\ttotal: Number(countResult.count),\n\t};\n}\n\n/**\n * Mark gaps as resolved within a block range. Idempotent.\n * Only resolves gaps fully contained within [fromBlock, toBlock].\n */\nexport async function resolveGaps(\n\tdb: Kysely<Database>,\n\tsubgraphName: string,\n\tfromBlock: number,\n\ttoBlock: number,\n): Promise<number> {\n\tconst result = await db\n\t\t.updateTable(\"subgraph_gaps\")\n\t\t.set({ resolved_at: new Date() })\n\t\t.where(\"subgraph_name\", \"=\", subgraphName)\n\t\t.where(\"resolved_at\", \"is\", null)\n\t\t.where(\"gap_start\", \">=\", fromBlock)\n\t\t.where(\"gap_end\", \"<=\", toBlock)\n\t\t.executeTakeFirst();\n\n\treturn Number(result.numUpdatedRows);\n}\n\n/**\n * Total missing blocks across unresolved gaps for a subgraph.\n */\nexport async function countSubgraphMissingBlocks(\n\tdb: Kysely<Database>,\n\tsubgraphName: string,\n): Promise<number> {\n\tconst { rows } = await sql<{ total: string }>`\n SELECT COALESCE(SUM(gap_end - gap_start + 1), 0) AS total\n FROM subgraph_gaps\n WHERE subgraph_name = ${subgraphName}\n AND resolved_at IS NULL\n `.execute(db);\n\n\treturn Number(rows[0]?.total ?? 0);\n}\n\n/**\n * Aggregate gap counts + missing blocks grouped by subgraph_name.\n * Used by the /status endpoint for per-subgraph gap summary.\n */\nexport async function getGapSummaryBySubgraph(\n\tdb: Kysely<Database>,\n): Promise<GapSummary[]> {\n\tconst { rows } = await sql<{\n\t\tsubgraph_name: string;\n\t\tgap_count: string;\n\t\ttotal_missing: string;\n\t}>`\n SELECT\n subgraph_name,\n COUNT(*) AS gap_count,\n COALESCE(SUM(gap_end - gap_start + 1), 0) AS total_missing\n FROM subgraph_gaps\n WHERE resolved_at IS NULL\n GROUP BY subgraph_name\n `.execute(db);\n\n\treturn rows.map((r) => ({\n\t\tsubgraphName: r.subgraph_name,\n\t\tgapCount: Number(r.gap_count),\n\t\ttotalMissingBlocks: Number(r.total_missing),\n\t}));\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";AAAA;AA8BA,eAAsB,cAAc,CACnC,IACA,YACA,cACA,MACgB;AAAA,EAChB,IAAI,KAAK,WAAW;AAAA,IAAG;AAAA,EAEvB,MAAM,GACJ,WAAW,eAAe,EAC1B,OACA,KAAK,IAAI,CAAC,OAAO;AAAA,IAChB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,WAAW,EAAE;AAAA,IACb,SAAS,EAAE;AAAA,IACX,QAAQ,EAAE;AAAA,EACX,EAAE,CACH,EACC,QAAQ;AAAA;AAMX,eAAsB,gBAAgB,CACrC,IACA,cACA,MACqD;AAAA,EACrD,MAAM,QAAQ,MAAM,SAAS;AAAA,EAC7B,MAAM,SAAS,MAAM,UAAU;AAAA,EAC/B,MAAM,iBAAiB,MAAM,kBAAkB;AAAA,EAE/C,IAAI,YAAY,GACd,WAAW,eAAe,EAC1B,MAAM,iBAAiB,KAAK,YAAY;AAAA,EAE1C,IAAI,gBAAgB;AAAA,IACnB,YAAY,UAAU,MAAM,eAAe,MAAM,IAAI;AAAA,EACtD;AAAA,EAEA,OAAO,MAAM,eAAe,MAAM,QAAQ,IAAI;AAAA,IAC7C,UACE,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,6BAAqC,GAAG,MAAM;AAAA,MAC9C;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC,EACA,QAAQ,aAAa,KAAK,EAC1B,MAAM,KAAK,EACX,OAAO,MAAM,EACb,QAAQ;AAAA,IACV,UACE,OAAO,cAAsB,GAAG,OAAO,CAAC,EACxC,wBAAwB;AAAA,EAC3B,CAAC;AAAA,EAED,OAAO;AAAA,IACN,MAAM,KAAK,IAAI,CAAC,OAAO;AAAA,MACtB,IAAI,EAAE;AAAA,MACN,cAAc,EAAE;AAAA,MAChB,UAAU,OAAO,EAAE,SAAS;AAAA,MAC5B,QAAQ,OAAO,EAAE,OAAO;AAAA,MACxB,MAAM,OAAO,EAAE,IAAI;AAAA,MACnB,QAAQ,EAAE;AAAA,MACV,YAAY,EAAE;AAAA,MACd,YAAY,EAAE;AAAA,IACf,EAAE;AAAA,IACF,OAAO,OAAO,YAAY,KAAK;AAAA,EAChC;AAAA;AAOD,eAAsB,WAAW,CAChC,IACA,cACA,WACA,SACkB;AAAA,EAClB,MAAM,SAAS,MAAM,GACnB,YAAY,eAAe,EAC3B,IAAI,EAAE,aAAa,IAAI,KAAO,CAAC,EAC/B,MAAM,iBAAiB,KAAK,YAAY,EACxC,MAAM,eAAe,MAAM,IAAI,EAC/B,MAAM,aAAa,MAAM,SAAS,EAClC,MAAM,WAAW,MAAM,OAAO,EAC9B,iBAAiB;AAAA,EAEnB,OAAO,OAAO,OAAO,cAAc;AAAA;AAMpC,eAAsB,0BAA0B,CAC/C,IACA,cACkB;AAAA,EAClB,QAAQ,SAAS,MAAM;AAAA;AAAA;AAAA,4BAGI;AAAA;AAAA,IAExB,QAAQ,EAAE;AAAA,EAEb,OAAO,OAAO,KAAK,IAAI,SAAS,CAAC;AAAA;AAOlC,eAAsB,uBAAuB,CAC5C,IACwB;AAAA,EACxB,QAAQ,SAAS,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYpB,QAAQ,EAAE;AAAA,EAEb,OAAO,KAAK,IAAI,CAAC,OAAO;AAAA,IACvB,cAAc,EAAE;AAAA,IAChB,UAAU,OAAO,EAAE,SAAS;AAAA,IAC5B,oBAAoB,OAAO,EAAE,aAAa;AAAA,EAC3C,EAAE;AAAA;",
|
|
8
|
+
"debugId": "3220DE92B2B7A0A764756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -153,7 +153,6 @@ interface SubgraphsTable {
|
|
|
153
153
|
handler_code: string | null;
|
|
154
154
|
source_code: string | null;
|
|
155
155
|
project_id: string | null;
|
|
156
|
-
visibility: Generated<string>;
|
|
157
156
|
/** Paid (wallet-ghost) deploys expire unless renewed or claimed; NULL = no expiry. */
|
|
158
157
|
expires_at: Date | null;
|
|
159
158
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
@@ -284,21 +283,6 @@ interface MagicLinksTable {
|
|
|
284
283
|
failed_attempts: Generated<number>;
|
|
285
284
|
created_at: Generated<Date>;
|
|
286
285
|
}
|
|
287
|
-
/** One-shot hashed tokens that attach a play ghost to an email at claim. */
|
|
288
|
-
interface ClaimTokensTable {
|
|
289
|
-
id: Generated<string>;
|
|
290
|
-
account_id: string;
|
|
291
|
-
token_hash: string;
|
|
292
|
-
created_at: Generated<Date>;
|
|
293
|
-
expires_at: Date;
|
|
294
|
-
used_at: Date | null;
|
|
295
|
-
}
|
|
296
|
-
/** 3 play provisions per IP per UTC day. PK (ip_hash, day); `count` caps at 3. */
|
|
297
|
-
interface PlayProvisionsTable {
|
|
298
|
-
ip_hash: string;
|
|
299
|
-
day: string;
|
|
300
|
-
count: Generated<number>;
|
|
301
|
-
}
|
|
302
286
|
interface SubgraphProcessingStatsTable {
|
|
303
287
|
id: Generated<string>;
|
|
304
288
|
subgraph_name: string;
|
|
@@ -760,8 +744,6 @@ interface Database {
|
|
|
760
744
|
accounts: AccountsTable;
|
|
761
745
|
sessions: SessionsTable;
|
|
762
746
|
magic_links: MagicLinksTable;
|
|
763
|
-
claim_tokens: ClaimTokensTable;
|
|
764
|
-
play_provisions: PlayProvisionsTable;
|
|
765
747
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
766
748
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
767
749
|
subgraph_gaps: SubgraphGapsTable;
|
|
@@ -770,7 +752,6 @@ interface Database {
|
|
|
770
752
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
771
753
|
account_spend_caps: AccountSpendCapsTable;
|
|
772
754
|
account_credits: AccountCreditsTable;
|
|
773
|
-
hosted_meter_days: HostedMeterDaysTable;
|
|
774
755
|
webhooks: WebhooksTable;
|
|
775
756
|
webhook_outbox: WebhookOutboxTable;
|
|
776
757
|
webhook_deliveries: WebhookDeliveriesTable;
|
|
@@ -801,6 +782,8 @@ interface Database {
|
|
|
801
782
|
coverage_segments: CoverageSegmentsTable;
|
|
802
783
|
stage_failures: StageFailuresTable;
|
|
803
784
|
archive_fetches: ArchiveFetchesTable;
|
|
785
|
+
waitlists: WaitlistsTable;
|
|
786
|
+
waitlist_signups: WaitlistSignupsTable;
|
|
804
787
|
}
|
|
805
788
|
interface ServiceHeartbeatsTable {
|
|
806
789
|
name: string;
|
|
@@ -829,15 +812,6 @@ interface AccountCreditsTable {
|
|
|
829
812
|
refill_last_at: Date | null;
|
|
830
813
|
updated_at: Generated<Date>;
|
|
831
814
|
}
|
|
832
|
-
/** Daily idempotency ledger for hosted subgraph running + storage meters. */
|
|
833
|
-
interface HostedMeterDaysTable {
|
|
834
|
-
day: string;
|
|
835
|
-
account_id: string;
|
|
836
|
-
subgraph_name: string;
|
|
837
|
-
kind: string;
|
|
838
|
-
usd_micros: string | number | bigint;
|
|
839
|
-
billed_at: Generated<Date>;
|
|
840
|
-
}
|
|
841
815
|
/**
|
|
842
816
|
* Archive fetch charge log (design-f089 gate). Append-only: one row per
|
|
843
817
|
* priced attempt to fetch a partition object. `usd_micros` is 0 for
|
|
@@ -941,6 +915,27 @@ interface TriggerEvaluatorStateTable {
|
|
|
941
915
|
last_settlement_scan_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
942
916
|
updated_at: Generated<Date>;
|
|
943
917
|
}
|
|
918
|
+
/** A public waitlist page: what it is for and whether it takes signups. */
|
|
919
|
+
interface WaitlistsTable {
|
|
920
|
+
slug: string;
|
|
921
|
+
title: string;
|
|
922
|
+
description: string;
|
|
923
|
+
url: string;
|
|
924
|
+
opened_at: Generated<Date>;
|
|
925
|
+
/** Null while the list is open. */
|
|
926
|
+
closed_at: Date | null;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* One signup per (list, contact, token). `answers` holds the list's own
|
|
930
|
+
* questions, validated per list by the API before insert.
|
|
931
|
+
*/
|
|
932
|
+
interface WaitlistSignupsTable {
|
|
933
|
+
id: Generated<string>;
|
|
934
|
+
list: string;
|
|
935
|
+
contact: string;
|
|
936
|
+
answers: Record<string, unknown>;
|
|
937
|
+
created_at: Generated<Date>;
|
|
938
|
+
}
|
|
944
939
|
declare function isActiveSubgraphOperationConflict(err: unknown): boolean;
|
|
945
940
|
declare function createSubgraphOperation(db: Kysely<Database>, data: {
|
|
946
941
|
subgraphId: string
|
|
@@ -990,4 +985,4 @@ declare function updateOperationProcessedEvents(db: Kysely<Database>, operationI
|
|
|
990
985
|
* whether THIS caller advanced (false = a racing writer already covered h).
|
|
991
986
|
*/
|
|
992
987
|
declare function advanceOperationCursor(db: Kysely<Database>, operationId: string, height: number): Promise<boolean>;
|
|
993
|
-
export {
|
|
988
|
+
export { advanceOperationCursor, cancelSubgraphOperation, claimSubgraphOperation, completeSubgraphOperation, createSubgraphOperation, failSubgraphOperation, findActiveSubgraphOperation, getOperationQueuePosition, getRecentOperationMedianDuration, getSubgraphOperation, heartbeatSubgraphOperation, isActiveSubgraphOperationConflict, listSubgraphOperations, requestSubgraphOperationCancel, requestSubgraphOperationsCancelForDelete, updateOperationProcessedEvents, waitForSubgraphOperationsClear };
|