@secondlayer/shared 7.11.1 → 8.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 +0 -169
- package/dist/src/archive/semantic-digest-builder.d.ts +0 -169
- package/dist/src/coverage/index.d.ts +0 -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 +1 -211
- package/dist/src/db/index.js +22 -16
- package/dist/src/db/index.js.map +4 -4
- package/dist/src/db/queries/chain-reorgs.d.ts +0 -169
- package/dist/src/db/queries/chain-reorgs.js +22 -16
- package/dist/src/db/queries/chain-reorgs.js.map +4 -4
- package/dist/src/db/queries/contracts.d.ts +0 -169
- package/dist/src/db/queries/instance.d.ts +0 -169
- package/dist/src/db/queries/integrity.d.ts +0 -169
- package/dist/src/db/queries/subgraph-gaps.d.ts +0 -169
- package/dist/src/db/queries/subgraph-operations.d.ts +1 -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 +1 -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 +0 -169
- package/dist/src/db/queries/subscriptions.js +22 -3
- package/dist/src/db/queries/subscriptions.js.map +3 -3
- package/dist/src/db/schema.d.ts +1 -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 +5 -256
- package/dist/src/index.js +23 -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 +0 -169
- package/dist/src/runtime/index.js +26 -3
- package/dist/src/runtime/index.js.map +3 -3
- 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/package.json +5 -1
|
@@ -223,11 +223,9 @@ interface AccountsTable {
|
|
|
223
223
|
ghost: Generated<boolean>;
|
|
224
224
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
225
225
|
wallet_principal: string | null;
|
|
226
|
-
plan: Generated<string>;
|
|
227
226
|
display_name: string | null;
|
|
228
227
|
bio: string | null;
|
|
229
228
|
avatar_url: string | null;
|
|
230
|
-
slug: string | null;
|
|
231
229
|
stripe_customer_id: string | null;
|
|
232
230
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
233
231
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -244,19 +242,6 @@ interface SessionsTable {
|
|
|
244
242
|
last_used_at: Date | null;
|
|
245
243
|
created_at: Generated<Date>;
|
|
246
244
|
}
|
|
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
245
|
interface MagicLinksTable {
|
|
261
246
|
id: Generated<string>;
|
|
262
247
|
email: string;
|
|
@@ -267,47 +252,6 @@ interface MagicLinksTable {
|
|
|
267
252
|
failed_attempts: Generated<number>;
|
|
268
253
|
created_at: Generated<Date>;
|
|
269
254
|
}
|
|
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
255
|
interface SubgraphProcessingStatsTable {
|
|
312
256
|
id: Generated<string>;
|
|
313
257
|
subgraph_name: string;
|
|
@@ -340,41 +284,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
340
284
|
last_processed_block: number | null;
|
|
341
285
|
captured_at: Generated<Date>;
|
|
342
286
|
}
|
|
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
287
|
interface ProcessedStripeEventsTable {
|
|
379
288
|
event_id: string;
|
|
380
289
|
event_type: string;
|
|
@@ -827,27 +736,14 @@ interface Database {
|
|
|
827
736
|
accounts: AccountsTable;
|
|
828
737
|
sessions: SessionsTable;
|
|
829
738
|
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
739
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
836
740
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
837
741
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
838
742
|
subgraph_gaps: SubgraphGapsTable;
|
|
839
743
|
subgraph_operations: SubgraphOperationsTable;
|
|
840
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
841
|
-
projects: ProjectsTable;
|
|
842
|
-
team_members: TeamMembersTable;
|
|
843
|
-
team_invitations: TeamInvitationsTable;
|
|
844
744
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
845
|
-
tenants: TenantsTable;
|
|
846
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
847
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
848
745
|
account_spend_caps: AccountSpendCapsTable;
|
|
849
746
|
account_credits: AccountCreditsTable;
|
|
850
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
851
747
|
subscriptions: SubscriptionsTable;
|
|
852
748
|
subscription_outbox: SubscriptionOutboxTable;
|
|
853
749
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -922,57 +818,6 @@ interface X402PaymentsTable {
|
|
|
922
818
|
* reconciler's heal path can never double-credit them. */
|
|
923
819
|
credited_at: Generated<Date> | null;
|
|
924
820
|
}
|
|
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
821
|
interface AccountSpendCapsTable {
|
|
977
822
|
account_id: string;
|
|
978
823
|
monthly_cap_cents: number | null;
|
|
@@ -996,20 +841,6 @@ interface AccountCreditsTable {
|
|
|
996
841
|
refill_last_at: Date | null;
|
|
997
842
|
updated_at: Generated<Date>;
|
|
998
843
|
}
|
|
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
844
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1014
845
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1015
846
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|
|
@@ -223,11 +223,9 @@ interface AccountsTable {
|
|
|
223
223
|
ghost: Generated<boolean>;
|
|
224
224
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
225
225
|
wallet_principal: string | null;
|
|
226
|
-
plan: Generated<string>;
|
|
227
226
|
display_name: string | null;
|
|
228
227
|
bio: string | null;
|
|
229
228
|
avatar_url: string | null;
|
|
230
|
-
slug: string | null;
|
|
231
229
|
stripe_customer_id: string | null;
|
|
232
230
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
233
231
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -244,19 +242,6 @@ interface SessionsTable {
|
|
|
244
242
|
last_used_at: Date | null;
|
|
245
243
|
created_at: Generated<Date>;
|
|
246
244
|
}
|
|
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
245
|
interface MagicLinksTable {
|
|
261
246
|
id: Generated<string>;
|
|
262
247
|
email: string;
|
|
@@ -267,47 +252,6 @@ interface MagicLinksTable {
|
|
|
267
252
|
failed_attempts: Generated<number>;
|
|
268
253
|
created_at: Generated<Date>;
|
|
269
254
|
}
|
|
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
255
|
interface SubgraphProcessingStatsTable {
|
|
312
256
|
id: Generated<string>;
|
|
313
257
|
subgraph_name: string;
|
|
@@ -340,41 +284,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
340
284
|
last_processed_block: number | null;
|
|
341
285
|
captured_at: Generated<Date>;
|
|
342
286
|
}
|
|
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
287
|
interface ProcessedStripeEventsTable {
|
|
379
288
|
event_id: string;
|
|
380
289
|
event_type: string;
|
|
@@ -827,27 +736,14 @@ interface Database {
|
|
|
827
736
|
accounts: AccountsTable;
|
|
828
737
|
sessions: SessionsTable;
|
|
829
738
|
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
739
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
836
740
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
837
741
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
838
742
|
subgraph_gaps: SubgraphGapsTable;
|
|
839
743
|
subgraph_operations: SubgraphOperationsTable;
|
|
840
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
841
|
-
projects: ProjectsTable;
|
|
842
|
-
team_members: TeamMembersTable;
|
|
843
|
-
team_invitations: TeamInvitationsTable;
|
|
844
744
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
845
|
-
tenants: TenantsTable;
|
|
846
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
847
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
848
745
|
account_spend_caps: AccountSpendCapsTable;
|
|
849
746
|
account_credits: AccountCreditsTable;
|
|
850
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
851
747
|
subscriptions: SubscriptionsTable;
|
|
852
748
|
subscription_outbox: SubscriptionOutboxTable;
|
|
853
749
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -922,57 +818,6 @@ interface X402PaymentsTable {
|
|
|
922
818
|
* reconciler's heal path can never double-credit them. */
|
|
923
819
|
credited_at: Generated<Date> | null;
|
|
924
820
|
}
|
|
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
821
|
interface AccountSpendCapsTable {
|
|
977
822
|
account_id: string;
|
|
978
823
|
monthly_cap_cents: number | null;
|
|
@@ -996,20 +841,6 @@ interface AccountCreditsTable {
|
|
|
996
841
|
refill_last_at: Date | null;
|
|
997
842
|
updated_at: Generated<Date>;
|
|
998
843
|
}
|
|
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
844
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1014
845
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1015
846
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|
|
@@ -223,11 +223,9 @@ interface AccountsTable {
|
|
|
223
223
|
ghost: Generated<boolean>;
|
|
224
224
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
225
225
|
wallet_principal: string | null;
|
|
226
|
-
plan: Generated<string>;
|
|
227
226
|
display_name: string | null;
|
|
228
227
|
bio: string | null;
|
|
229
228
|
avatar_url: string | null;
|
|
230
|
-
slug: string | null;
|
|
231
229
|
stripe_customer_id: string | null;
|
|
232
230
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
233
231
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -244,19 +242,6 @@ interface SessionsTable {
|
|
|
244
242
|
last_used_at: Date | null;
|
|
245
243
|
created_at: Generated<Date>;
|
|
246
244
|
}
|
|
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
245
|
interface MagicLinksTable {
|
|
261
246
|
id: Generated<string>;
|
|
262
247
|
email: string;
|
|
@@ -267,47 +252,6 @@ interface MagicLinksTable {
|
|
|
267
252
|
failed_attempts: Generated<number>;
|
|
268
253
|
created_at: Generated<Date>;
|
|
269
254
|
}
|
|
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
255
|
interface SubgraphProcessingStatsTable {
|
|
312
256
|
id: Generated<string>;
|
|
313
257
|
subgraph_name: string;
|
|
@@ -340,41 +284,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
340
284
|
last_processed_block: number | null;
|
|
341
285
|
captured_at: Generated<Date>;
|
|
342
286
|
}
|
|
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
287
|
interface ProcessedStripeEventsTable {
|
|
379
288
|
event_id: string;
|
|
380
289
|
event_type: string;
|
|
@@ -827,27 +736,14 @@ interface Database {
|
|
|
827
736
|
accounts: AccountsTable;
|
|
828
737
|
sessions: SessionsTable;
|
|
829
738
|
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
739
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
836
740
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
837
741
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
838
742
|
subgraph_gaps: SubgraphGapsTable;
|
|
839
743
|
subgraph_operations: SubgraphOperationsTable;
|
|
840
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
841
|
-
projects: ProjectsTable;
|
|
842
|
-
team_members: TeamMembersTable;
|
|
843
|
-
team_invitations: TeamInvitationsTable;
|
|
844
744
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
845
|
-
tenants: TenantsTable;
|
|
846
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
847
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
848
745
|
account_spend_caps: AccountSpendCapsTable;
|
|
849
746
|
account_credits: AccountCreditsTable;
|
|
850
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
851
747
|
subscriptions: SubscriptionsTable;
|
|
852
748
|
subscription_outbox: SubscriptionOutboxTable;
|
|
853
749
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -922,57 +818,6 @@ interface X402PaymentsTable {
|
|
|
922
818
|
* reconciler's heal path can never double-credit them. */
|
|
923
819
|
credited_at: Generated<Date> | null;
|
|
924
820
|
}
|
|
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
821
|
interface AccountSpendCapsTable {
|
|
977
822
|
account_id: string;
|
|
978
823
|
monthly_cap_cents: number | null;
|
|
@@ -996,20 +841,6 @@ interface AccountCreditsTable {
|
|
|
996
841
|
refill_last_at: Date | null;
|
|
997
842
|
updated_at: Generated<Date>;
|
|
998
843
|
}
|
|
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
844
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1014
845
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1015
846
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|