@secondlayer/shared 7.11.2 → 9.0.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 +16 -169
- package/dist/src/archive/semantic-digest-builder.d.ts +16 -169
- package/dist/src/archive/status.js +11 -3
- package/dist/src/archive/status.js.map +3 -3
- package/dist/src/coverage/index.d.ts +15 -169
- package/dist/src/crypto/secrets.js +22 -3
- package/dist/src/crypto/secrets.js.map +3 -3
- package/dist/src/db/index.d.ts +18 -211
- package/dist/src/db/index.js +23 -16
- package/dist/src/db/index.js.map +4 -4
- package/dist/src/db/queries/chain-reorgs.d.ts +16 -169
- package/dist/src/db/queries/chain-reorgs.js +23 -16
- package/dist/src/db/queries/chain-reorgs.js.map +4 -4
- package/dist/src/db/queries/contracts.d.ts +16 -169
- package/dist/src/db/queries/instance.d.ts +16 -169
- package/dist/src/db/queries/integrity.d.ts +16 -169
- package/dist/src/db/queries/subgraph-gaps.d.ts +16 -169
- package/dist/src/db/queries/subgraph-operations.d.ts +17 -170
- package/dist/src/db/queries/subgraph-operations.js +1 -15
- package/dist/src/db/queries/subgraph-operations.js.map +3 -3
- package/dist/src/db/queries/subgraphs.d.ts +17 -191
- package/dist/src/db/queries/subgraphs.js +30 -1068
- package/dist/src/db/queries/subgraphs.js.map +5 -12
- package/dist/src/db/queries/subscriptions.d.ts +16 -169
- package/dist/src/db/queries/subscriptions.js +22 -3
- package/dist/src/db/queries/subscriptions.js.map +3 -3
- package/dist/src/db/queries/sync-scope.d.ts +1006 -0
- package/dist/src/db/queries/sync-scope.js +116 -0
- package/dist/src/db/queries/sync-scope.js.map +10 -0
- package/dist/src/db/schema.d.ts +17 -198
- package/dist/src/errors.d.ts +1 -22
- package/dist/src/errors.js +2 -4
- package/dist/src/errors.js.map +3 -3
- package/dist/src/index.d.ts +22 -256
- package/dist/src/index.js +24 -20
- package/dist/src/index.js.map +6 -6
- package/dist/src/mode.d.ts +16 -2
- package/dist/src/mode.js +25 -4
- package/dist/src/mode.js.map +3 -3
- package/dist/src/node/local-client.d.ts +16 -169
- package/dist/src/runtime/index.d.ts +137 -18
- package/dist/src/runtime/index.js +261 -41
- package/dist/src/runtime/index.js.map +9 -7
- package/dist/src/schemas/index.d.ts +5 -25
- package/dist/src/schemas/index.js +1 -2
- package/dist/src/schemas/index.js.map +3 -3
- package/dist/src/schemas/subgraphs.d.ts +5 -25
- package/dist/src/schemas/subgraphs.js +1 -2
- package/dist/src/schemas/subgraphs.js.map +3 -3
- package/dist/src/streams-rows/index.d.ts +399 -0
- package/dist/src/streams-rows/index.js +336 -0
- package/dist/src/streams-rows/index.js.map +17 -0
- package/dist/src/subgraphs/spec.d.ts +0 -9
- package/migrations/0118_drop_retired_control_tables.ts +53 -0
- package/migrations/0119_drop_accounts_plan.ts +29 -0
- package/migrations/0120_sync_scopes.ts +42 -0
- package/package.json +10 -6
- package/dist/src/x402.d.ts +0 -47
- package/dist/src/x402.js +0 -79
- package/dist/src/x402.js.map +0 -10
|
@@ -18,6 +18,7 @@ declare const FAILURE_CLASSES: readonly ["omission", "version", "digest_mismatch
|
|
|
18
18
|
type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
|
+
type BootstrapSource = "archive" | "genesis" | "import";
|
|
21
22
|
interface BlocksTable {
|
|
22
23
|
height: number;
|
|
23
24
|
hash: string;
|
|
@@ -223,11 +224,9 @@ interface AccountsTable {
|
|
|
223
224
|
ghost: Generated<boolean>;
|
|
224
225
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
225
226
|
wallet_principal: string | null;
|
|
226
|
-
plan: Generated<string>;
|
|
227
227
|
display_name: string | null;
|
|
228
228
|
bio: string | null;
|
|
229
229
|
avatar_url: string | null;
|
|
230
|
-
slug: string | null;
|
|
231
230
|
stripe_customer_id: string | null;
|
|
232
231
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
233
232
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -244,19 +243,6 @@ interface SessionsTable {
|
|
|
244
243
|
last_used_at: Date | null;
|
|
245
244
|
created_at: Generated<Date>;
|
|
246
245
|
}
|
|
247
|
-
/**
|
|
248
|
-
* One-time claim tokens for ghost accounts. The raw token only ever appears in
|
|
249
|
-
* the claim URL returned at mint time; we store its sha256. A used token marks
|
|
250
|
-
* the account as claimed (or merged into an existing account).
|
|
251
|
-
*/
|
|
252
|
-
interface ClaimTokensTable {
|
|
253
|
-
id: Generated<string>;
|
|
254
|
-
account_id: string;
|
|
255
|
-
token_hash: string;
|
|
256
|
-
created_at: Generated<Date>;
|
|
257
|
-
expires_at: Date;
|
|
258
|
-
used_at: Date | null;
|
|
259
|
-
}
|
|
260
246
|
interface MagicLinksTable {
|
|
261
247
|
id: Generated<string>;
|
|
262
248
|
email: string;
|
|
@@ -267,47 +253,6 @@ interface MagicLinksTable {
|
|
|
267
253
|
failed_attempts: Generated<number>;
|
|
268
254
|
created_at: Generated<Date>;
|
|
269
255
|
}
|
|
270
|
-
interface UsageDailyTable {
|
|
271
|
-
account_id: string;
|
|
272
|
-
tenant_id: string | null;
|
|
273
|
-
date: string;
|
|
274
|
-
api_requests: Generated<number>;
|
|
275
|
-
deliveries: Generated<number>;
|
|
276
|
-
streams_events_returned: Generated<number>;
|
|
277
|
-
index_decoded_events_returned: Generated<number>;
|
|
278
|
-
}
|
|
279
|
-
interface UsageSnapshotsTable {
|
|
280
|
-
id: Generated<string>;
|
|
281
|
-
account_id: string;
|
|
282
|
-
measured_at: Generated<Date>;
|
|
283
|
-
storage_bytes: Generated<number>;
|
|
284
|
-
}
|
|
285
|
-
interface AccountInsightsTable {
|
|
286
|
-
id: Generated<string>;
|
|
287
|
-
account_id: string;
|
|
288
|
-
category: string;
|
|
289
|
-
insight_type: string;
|
|
290
|
-
resource_id: string | null;
|
|
291
|
-
severity: string;
|
|
292
|
-
title: string;
|
|
293
|
-
body: string;
|
|
294
|
-
data: unknown;
|
|
295
|
-
dismissed_at: Date | null;
|
|
296
|
-
expires_at: Date | null;
|
|
297
|
-
created_at: Generated<Date>;
|
|
298
|
-
}
|
|
299
|
-
interface AccountAgentRunsTable {
|
|
300
|
-
id: Generated<string>;
|
|
301
|
-
account_id: string;
|
|
302
|
-
started_at: Generated<Date>;
|
|
303
|
-
completed_at: Date | null;
|
|
304
|
-
status: Generated<string>;
|
|
305
|
-
input_tokens: Generated<number>;
|
|
306
|
-
output_tokens: Generated<number>;
|
|
307
|
-
cost_usd: Generated<number>;
|
|
308
|
-
insights_created: Generated<number>;
|
|
309
|
-
error: string | null;
|
|
310
|
-
}
|
|
311
256
|
interface SubgraphProcessingStatsTable {
|
|
312
257
|
id: Generated<string>;
|
|
313
258
|
subgraph_name: string;
|
|
@@ -340,41 +285,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
340
285
|
last_processed_block: number | null;
|
|
341
286
|
captured_at: Generated<Date>;
|
|
342
287
|
}
|
|
343
|
-
interface SubgraphUsageDailyTable {
|
|
344
|
-
subgraph_id: string;
|
|
345
|
-
date: string;
|
|
346
|
-
query_count: Generated<number>;
|
|
347
|
-
}
|
|
348
|
-
interface ProjectsTable {
|
|
349
|
-
id: Generated<string>;
|
|
350
|
-
name: string;
|
|
351
|
-
slug: string;
|
|
352
|
-
account_id: string;
|
|
353
|
-
settings: Generated<Record<string, unknown>>;
|
|
354
|
-
network: Generated<string>;
|
|
355
|
-
node_rpc: string | null;
|
|
356
|
-
created_at: Generated<Date>;
|
|
357
|
-
updated_at: Generated<Date>;
|
|
358
|
-
}
|
|
359
|
-
interface TeamMembersTable {
|
|
360
|
-
id: Generated<string>;
|
|
361
|
-
project_id: string;
|
|
362
|
-
account_id: string;
|
|
363
|
-
role: Generated<string>;
|
|
364
|
-
invited_by: string | null;
|
|
365
|
-
created_at: Generated<Date>;
|
|
366
|
-
}
|
|
367
|
-
interface TeamInvitationsTable {
|
|
368
|
-
id: Generated<string>;
|
|
369
|
-
project_id: string;
|
|
370
|
-
email: string;
|
|
371
|
-
role: Generated<string>;
|
|
372
|
-
token: string;
|
|
373
|
-
invited_by: string | null;
|
|
374
|
-
expires_at: Date;
|
|
375
|
-
accepted_at: Date | null;
|
|
376
|
-
created_at: Generated<Date>;
|
|
377
|
-
}
|
|
378
288
|
interface ProcessedStripeEventsTable {
|
|
379
289
|
event_id: string;
|
|
380
290
|
event_type: string;
|
|
@@ -811,6 +721,20 @@ interface StageFailuresTable {
|
|
|
811
721
|
resolved_at: Date | null;
|
|
812
722
|
retain_until: Generated<Date>;
|
|
813
723
|
}
|
|
724
|
+
/**
|
|
725
|
+
* The instance's declared scope — one row per network. `start_height` is what
|
|
726
|
+
* makes missing history below it deliberate rather than a gap.
|
|
727
|
+
*/
|
|
728
|
+
interface SyncScopesTable {
|
|
729
|
+
network: string;
|
|
730
|
+
start_height: number;
|
|
731
|
+
target_height: number | null;
|
|
732
|
+
bootstrap_source: BootstrapSource;
|
|
733
|
+
bootstrap_manifest_digest: string | null;
|
|
734
|
+
genesis_hash: string | null;
|
|
735
|
+
created_at: Generated<Date>;
|
|
736
|
+
updated_at: Generated<Date>;
|
|
737
|
+
}
|
|
814
738
|
interface Database {
|
|
815
739
|
blocks: BlocksTable;
|
|
816
740
|
transactions: TransactionsTable;
|
|
@@ -827,27 +751,14 @@ interface Database {
|
|
|
827
751
|
accounts: AccountsTable;
|
|
828
752
|
sessions: SessionsTable;
|
|
829
753
|
magic_links: MagicLinksTable;
|
|
830
|
-
claim_tokens: ClaimTokensTable;
|
|
831
|
-
usage_daily: UsageDailyTable;
|
|
832
|
-
usage_snapshots: UsageSnapshotsTable;
|
|
833
|
-
account_insights: AccountInsightsTable;
|
|
834
|
-
account_agent_runs: AccountAgentRunsTable;
|
|
835
754
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
836
755
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
837
756
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
838
757
|
subgraph_gaps: SubgraphGapsTable;
|
|
839
758
|
subgraph_operations: SubgraphOperationsTable;
|
|
840
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
841
|
-
projects: ProjectsTable;
|
|
842
|
-
team_members: TeamMembersTable;
|
|
843
|
-
team_invitations: TeamInvitationsTable;
|
|
844
759
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
845
|
-
tenants: TenantsTable;
|
|
846
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
847
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
848
760
|
account_spend_caps: AccountSpendCapsTable;
|
|
849
761
|
account_credits: AccountCreditsTable;
|
|
850
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
851
762
|
subscriptions: SubscriptionsTable;
|
|
852
763
|
subscription_outbox: SubscriptionOutboxTable;
|
|
853
764
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -876,6 +787,7 @@ interface Database {
|
|
|
876
787
|
chain_read_cache: ChainReadCacheTable;
|
|
877
788
|
pending_fork_blocks: PendingForkBlocksTable;
|
|
878
789
|
observer_journal: ObserverJournalTable;
|
|
790
|
+
sync_scopes: SyncScopesTable;
|
|
879
791
|
stage_registry: StageRegistryTable;
|
|
880
792
|
stage_runs: StageRunsTable;
|
|
881
793
|
stage_block_receipts: StageBlockReceiptsTable;
|
|
@@ -922,57 +834,6 @@ interface X402PaymentsTable {
|
|
|
922
834
|
* reconciler's heal path can never double-credit them. */
|
|
923
835
|
credited_at: Generated<Date> | null;
|
|
924
836
|
}
|
|
925
|
-
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
926
|
-
interface TenantsTable {
|
|
927
|
-
id: Generated<string>;
|
|
928
|
-
account_id: string;
|
|
929
|
-
slug: string;
|
|
930
|
-
status: ColumnType<TenantStatus, TenantStatus | undefined, TenantStatus>;
|
|
931
|
-
plan: string;
|
|
932
|
-
cpus: ColumnType<number, number | string, number | string>;
|
|
933
|
-
memory_mb: number;
|
|
934
|
-
storage_limit_mb: number;
|
|
935
|
-
storage_used_mb: number | null;
|
|
936
|
-
pg_container_id: string | null;
|
|
937
|
-
api_container_id: string | null;
|
|
938
|
-
processor_container_id: string | null;
|
|
939
|
-
target_database_url_enc: Buffer;
|
|
940
|
-
tenant_jwt_secret_enc: Buffer;
|
|
941
|
-
anon_key_enc: Buffer;
|
|
942
|
-
service_key_enc: Buffer;
|
|
943
|
-
api_url_internal: string;
|
|
944
|
-
api_url_public: string;
|
|
945
|
-
suspended_at: Date | null;
|
|
946
|
-
last_health_check_at: Date | null;
|
|
947
|
-
last_active_at: Generated<Date>;
|
|
948
|
-
service_gen: Generated<number>;
|
|
949
|
-
anon_gen: Generated<number>;
|
|
950
|
-
project_id: string | null;
|
|
951
|
-
created_at: Generated<Date>;
|
|
952
|
-
updated_at: Generated<Date>;
|
|
953
|
-
}
|
|
954
|
-
interface TenantUsageMonthlyTable {
|
|
955
|
-
id: Generated<string>;
|
|
956
|
-
tenant_id: string;
|
|
957
|
-
period_month: Date;
|
|
958
|
-
storage_peak_mb: Generated<number>;
|
|
959
|
-
storage_avg_mb: Generated<number>;
|
|
960
|
-
storage_last_mb: Generated<number>;
|
|
961
|
-
measurements: Generated<number>;
|
|
962
|
-
first_at: Generated<Date>;
|
|
963
|
-
last_at: Generated<Date>;
|
|
964
|
-
}
|
|
965
|
-
interface TenantComputeAddonsTable {
|
|
966
|
-
id: Generated<string>;
|
|
967
|
-
tenant_id: string;
|
|
968
|
-
memory_mb_delta: Generated<number>;
|
|
969
|
-
cpu_delta: Generated<number | string>;
|
|
970
|
-
storage_mb_delta: Generated<number>;
|
|
971
|
-
effective_from: Generated<Date>;
|
|
972
|
-
effective_until: Date | null;
|
|
973
|
-
stripe_subscription_item_id: string | null;
|
|
974
|
-
created_at: Generated<Date>;
|
|
975
|
-
}
|
|
976
837
|
interface AccountSpendCapsTable {
|
|
977
838
|
account_id: string;
|
|
978
839
|
monthly_cap_cents: number | null;
|
|
@@ -996,20 +857,6 @@ interface AccountCreditsTable {
|
|
|
996
857
|
refill_last_at: Date | null;
|
|
997
858
|
updated_at: Generated<Date>;
|
|
998
859
|
}
|
|
999
|
-
type ProvisioningAuditEvent = "provision.start" | "provision.success" | "provision.failure" | "suspend" | "resume" | "resize" | "keys.rotate" | "bastion.key.upload" | "bastion.key.revoke" | "teardown";
|
|
1000
|
-
type ProvisioningAuditStatus = "ok" | "error";
|
|
1001
|
-
interface ProvisioningAuditLogTable {
|
|
1002
|
-
id: Generated<string>;
|
|
1003
|
-
tenant_id: string | null;
|
|
1004
|
-
tenant_slug: string | null;
|
|
1005
|
-
account_id: string | null;
|
|
1006
|
-
actor: string;
|
|
1007
|
-
event: ProvisioningAuditEvent;
|
|
1008
|
-
status: ProvisioningAuditStatus;
|
|
1009
|
-
detail: unknown | null;
|
|
1010
|
-
error: string | null;
|
|
1011
|
-
created_at: Generated<Date>;
|
|
1012
|
-
}
|
|
1013
860
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1014
861
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1015
862
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|
|
@@ -18,6 +18,7 @@ declare const FAILURE_CLASSES: readonly ["omission", "version", "digest_mismatch
|
|
|
18
18
|
type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
|
+
type BootstrapSource = "archive" | "genesis" | "import";
|
|
21
22
|
interface BlocksTable {
|
|
22
23
|
height: number;
|
|
23
24
|
hash: string;
|
|
@@ -223,11 +224,9 @@ interface AccountsTable {
|
|
|
223
224
|
ghost: Generated<boolean>;
|
|
224
225
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
225
226
|
wallet_principal: string | null;
|
|
226
|
-
plan: Generated<string>;
|
|
227
227
|
display_name: string | null;
|
|
228
228
|
bio: string | null;
|
|
229
229
|
avatar_url: string | null;
|
|
230
|
-
slug: string | null;
|
|
231
230
|
stripe_customer_id: string | null;
|
|
232
231
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
233
232
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -244,19 +243,6 @@ interface SessionsTable {
|
|
|
244
243
|
last_used_at: Date | null;
|
|
245
244
|
created_at: Generated<Date>;
|
|
246
245
|
}
|
|
247
|
-
/**
|
|
248
|
-
* One-time claim tokens for ghost accounts. The raw token only ever appears in
|
|
249
|
-
* the claim URL returned at mint time; we store its sha256. A used token marks
|
|
250
|
-
* the account as claimed (or merged into an existing account).
|
|
251
|
-
*/
|
|
252
|
-
interface ClaimTokensTable {
|
|
253
|
-
id: Generated<string>;
|
|
254
|
-
account_id: string;
|
|
255
|
-
token_hash: string;
|
|
256
|
-
created_at: Generated<Date>;
|
|
257
|
-
expires_at: Date;
|
|
258
|
-
used_at: Date | null;
|
|
259
|
-
}
|
|
260
246
|
interface MagicLinksTable {
|
|
261
247
|
id: Generated<string>;
|
|
262
248
|
email: string;
|
|
@@ -267,47 +253,6 @@ interface MagicLinksTable {
|
|
|
267
253
|
failed_attempts: Generated<number>;
|
|
268
254
|
created_at: Generated<Date>;
|
|
269
255
|
}
|
|
270
|
-
interface UsageDailyTable {
|
|
271
|
-
account_id: string;
|
|
272
|
-
tenant_id: string | null;
|
|
273
|
-
date: string;
|
|
274
|
-
api_requests: Generated<number>;
|
|
275
|
-
deliveries: Generated<number>;
|
|
276
|
-
streams_events_returned: Generated<number>;
|
|
277
|
-
index_decoded_events_returned: Generated<number>;
|
|
278
|
-
}
|
|
279
|
-
interface UsageSnapshotsTable {
|
|
280
|
-
id: Generated<string>;
|
|
281
|
-
account_id: string;
|
|
282
|
-
measured_at: Generated<Date>;
|
|
283
|
-
storage_bytes: Generated<number>;
|
|
284
|
-
}
|
|
285
|
-
interface AccountInsightsTable {
|
|
286
|
-
id: Generated<string>;
|
|
287
|
-
account_id: string;
|
|
288
|
-
category: string;
|
|
289
|
-
insight_type: string;
|
|
290
|
-
resource_id: string | null;
|
|
291
|
-
severity: string;
|
|
292
|
-
title: string;
|
|
293
|
-
body: string;
|
|
294
|
-
data: unknown;
|
|
295
|
-
dismissed_at: Date | null;
|
|
296
|
-
expires_at: Date | null;
|
|
297
|
-
created_at: Generated<Date>;
|
|
298
|
-
}
|
|
299
|
-
interface AccountAgentRunsTable {
|
|
300
|
-
id: Generated<string>;
|
|
301
|
-
account_id: string;
|
|
302
|
-
started_at: Generated<Date>;
|
|
303
|
-
completed_at: Date | null;
|
|
304
|
-
status: Generated<string>;
|
|
305
|
-
input_tokens: Generated<number>;
|
|
306
|
-
output_tokens: Generated<number>;
|
|
307
|
-
cost_usd: Generated<number>;
|
|
308
|
-
insights_created: Generated<number>;
|
|
309
|
-
error: string | null;
|
|
310
|
-
}
|
|
311
256
|
interface SubgraphProcessingStatsTable {
|
|
312
257
|
id: Generated<string>;
|
|
313
258
|
subgraph_name: string;
|
|
@@ -340,41 +285,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
340
285
|
last_processed_block: number | null;
|
|
341
286
|
captured_at: Generated<Date>;
|
|
342
287
|
}
|
|
343
|
-
interface SubgraphUsageDailyTable {
|
|
344
|
-
subgraph_id: string;
|
|
345
|
-
date: string;
|
|
346
|
-
query_count: Generated<number>;
|
|
347
|
-
}
|
|
348
|
-
interface ProjectsTable {
|
|
349
|
-
id: Generated<string>;
|
|
350
|
-
name: string;
|
|
351
|
-
slug: string;
|
|
352
|
-
account_id: string;
|
|
353
|
-
settings: Generated<Record<string, unknown>>;
|
|
354
|
-
network: Generated<string>;
|
|
355
|
-
node_rpc: string | null;
|
|
356
|
-
created_at: Generated<Date>;
|
|
357
|
-
updated_at: Generated<Date>;
|
|
358
|
-
}
|
|
359
|
-
interface TeamMembersTable {
|
|
360
|
-
id: Generated<string>;
|
|
361
|
-
project_id: string;
|
|
362
|
-
account_id: string;
|
|
363
|
-
role: Generated<string>;
|
|
364
|
-
invited_by: string | null;
|
|
365
|
-
created_at: Generated<Date>;
|
|
366
|
-
}
|
|
367
|
-
interface TeamInvitationsTable {
|
|
368
|
-
id: Generated<string>;
|
|
369
|
-
project_id: string;
|
|
370
|
-
email: string;
|
|
371
|
-
role: Generated<string>;
|
|
372
|
-
token: string;
|
|
373
|
-
invited_by: string | null;
|
|
374
|
-
expires_at: Date;
|
|
375
|
-
accepted_at: Date | null;
|
|
376
|
-
created_at: Generated<Date>;
|
|
377
|
-
}
|
|
378
288
|
interface ProcessedStripeEventsTable {
|
|
379
289
|
event_id: string;
|
|
380
290
|
event_type: string;
|
|
@@ -811,6 +721,20 @@ interface StageFailuresTable {
|
|
|
811
721
|
resolved_at: Date | null;
|
|
812
722
|
retain_until: Generated<Date>;
|
|
813
723
|
}
|
|
724
|
+
/**
|
|
725
|
+
* The instance's declared scope — one row per network. `start_height` is what
|
|
726
|
+
* makes missing history below it deliberate rather than a gap.
|
|
727
|
+
*/
|
|
728
|
+
interface SyncScopesTable {
|
|
729
|
+
network: string;
|
|
730
|
+
start_height: number;
|
|
731
|
+
target_height: number | null;
|
|
732
|
+
bootstrap_source: BootstrapSource;
|
|
733
|
+
bootstrap_manifest_digest: string | null;
|
|
734
|
+
genesis_hash: string | null;
|
|
735
|
+
created_at: Generated<Date>;
|
|
736
|
+
updated_at: Generated<Date>;
|
|
737
|
+
}
|
|
814
738
|
interface Database {
|
|
815
739
|
blocks: BlocksTable;
|
|
816
740
|
transactions: TransactionsTable;
|
|
@@ -827,27 +751,14 @@ interface Database {
|
|
|
827
751
|
accounts: AccountsTable;
|
|
828
752
|
sessions: SessionsTable;
|
|
829
753
|
magic_links: MagicLinksTable;
|
|
830
|
-
claim_tokens: ClaimTokensTable;
|
|
831
|
-
usage_daily: UsageDailyTable;
|
|
832
|
-
usage_snapshots: UsageSnapshotsTable;
|
|
833
|
-
account_insights: AccountInsightsTable;
|
|
834
|
-
account_agent_runs: AccountAgentRunsTable;
|
|
835
754
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
836
755
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
837
756
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
838
757
|
subgraph_gaps: SubgraphGapsTable;
|
|
839
758
|
subgraph_operations: SubgraphOperationsTable;
|
|
840
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
841
|
-
projects: ProjectsTable;
|
|
842
|
-
team_members: TeamMembersTable;
|
|
843
|
-
team_invitations: TeamInvitationsTable;
|
|
844
759
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
845
|
-
tenants: TenantsTable;
|
|
846
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
847
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
848
760
|
account_spend_caps: AccountSpendCapsTable;
|
|
849
761
|
account_credits: AccountCreditsTable;
|
|
850
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
851
762
|
subscriptions: SubscriptionsTable;
|
|
852
763
|
subscription_outbox: SubscriptionOutboxTable;
|
|
853
764
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -876,6 +787,7 @@ interface Database {
|
|
|
876
787
|
chain_read_cache: ChainReadCacheTable;
|
|
877
788
|
pending_fork_blocks: PendingForkBlocksTable;
|
|
878
789
|
observer_journal: ObserverJournalTable;
|
|
790
|
+
sync_scopes: SyncScopesTable;
|
|
879
791
|
stage_registry: StageRegistryTable;
|
|
880
792
|
stage_runs: StageRunsTable;
|
|
881
793
|
stage_block_receipts: StageBlockReceiptsTable;
|
|
@@ -922,57 +834,6 @@ interface X402PaymentsTable {
|
|
|
922
834
|
* reconciler's heal path can never double-credit them. */
|
|
923
835
|
credited_at: Generated<Date> | null;
|
|
924
836
|
}
|
|
925
|
-
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
926
|
-
interface TenantsTable {
|
|
927
|
-
id: Generated<string>;
|
|
928
|
-
account_id: string;
|
|
929
|
-
slug: string;
|
|
930
|
-
status: ColumnType<TenantStatus, TenantStatus | undefined, TenantStatus>;
|
|
931
|
-
plan: string;
|
|
932
|
-
cpus: ColumnType<number, number | string, number | string>;
|
|
933
|
-
memory_mb: number;
|
|
934
|
-
storage_limit_mb: number;
|
|
935
|
-
storage_used_mb: number | null;
|
|
936
|
-
pg_container_id: string | null;
|
|
937
|
-
api_container_id: string | null;
|
|
938
|
-
processor_container_id: string | null;
|
|
939
|
-
target_database_url_enc: Buffer;
|
|
940
|
-
tenant_jwt_secret_enc: Buffer;
|
|
941
|
-
anon_key_enc: Buffer;
|
|
942
|
-
service_key_enc: Buffer;
|
|
943
|
-
api_url_internal: string;
|
|
944
|
-
api_url_public: string;
|
|
945
|
-
suspended_at: Date | null;
|
|
946
|
-
last_health_check_at: Date | null;
|
|
947
|
-
last_active_at: Generated<Date>;
|
|
948
|
-
service_gen: Generated<number>;
|
|
949
|
-
anon_gen: Generated<number>;
|
|
950
|
-
project_id: string | null;
|
|
951
|
-
created_at: Generated<Date>;
|
|
952
|
-
updated_at: Generated<Date>;
|
|
953
|
-
}
|
|
954
|
-
interface TenantUsageMonthlyTable {
|
|
955
|
-
id: Generated<string>;
|
|
956
|
-
tenant_id: string;
|
|
957
|
-
period_month: Date;
|
|
958
|
-
storage_peak_mb: Generated<number>;
|
|
959
|
-
storage_avg_mb: Generated<number>;
|
|
960
|
-
storage_last_mb: Generated<number>;
|
|
961
|
-
measurements: Generated<number>;
|
|
962
|
-
first_at: Generated<Date>;
|
|
963
|
-
last_at: Generated<Date>;
|
|
964
|
-
}
|
|
965
|
-
interface TenantComputeAddonsTable {
|
|
966
|
-
id: Generated<string>;
|
|
967
|
-
tenant_id: string;
|
|
968
|
-
memory_mb_delta: Generated<number>;
|
|
969
|
-
cpu_delta: Generated<number | string>;
|
|
970
|
-
storage_mb_delta: Generated<number>;
|
|
971
|
-
effective_from: Generated<Date>;
|
|
972
|
-
effective_until: Date | null;
|
|
973
|
-
stripe_subscription_item_id: string | null;
|
|
974
|
-
created_at: Generated<Date>;
|
|
975
|
-
}
|
|
976
837
|
interface AccountSpendCapsTable {
|
|
977
838
|
account_id: string;
|
|
978
839
|
monthly_cap_cents: number | null;
|
|
@@ -996,20 +857,6 @@ interface AccountCreditsTable {
|
|
|
996
857
|
refill_last_at: Date | null;
|
|
997
858
|
updated_at: Generated<Date>;
|
|
998
859
|
}
|
|
999
|
-
type ProvisioningAuditEvent = "provision.start" | "provision.success" | "provision.failure" | "suspend" | "resume" | "resize" | "keys.rotate" | "bastion.key.upload" | "bastion.key.revoke" | "teardown";
|
|
1000
|
-
type ProvisioningAuditStatus = "ok" | "error";
|
|
1001
|
-
interface ProvisioningAuditLogTable {
|
|
1002
|
-
id: Generated<string>;
|
|
1003
|
-
tenant_id: string | null;
|
|
1004
|
-
tenant_slug: string | null;
|
|
1005
|
-
account_id: string | null;
|
|
1006
|
-
actor: string;
|
|
1007
|
-
event: ProvisioningAuditEvent;
|
|
1008
|
-
status: ProvisioningAuditStatus;
|
|
1009
|
-
detail: unknown | null;
|
|
1010
|
-
error: string | null;
|
|
1011
|
-
created_at: Generated<Date>;
|
|
1012
|
-
}
|
|
1013
860
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1014
861
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1015
862
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|