@secondlayer/shared 7.11.2 → 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/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
|
@@ -222,11 +222,9 @@ interface AccountsTable {
|
|
|
222
222
|
ghost: Generated<boolean>;
|
|
223
223
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
224
224
|
wallet_principal: string | null;
|
|
225
|
-
plan: Generated<string>;
|
|
226
225
|
display_name: string | null;
|
|
227
226
|
bio: string | null;
|
|
228
227
|
avatar_url: string | null;
|
|
229
|
-
slug: string | null;
|
|
230
228
|
stripe_customer_id: string | null;
|
|
231
229
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
232
230
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -243,19 +241,6 @@ interface SessionsTable {
|
|
|
243
241
|
last_used_at: Date | null;
|
|
244
242
|
created_at: Generated<Date>;
|
|
245
243
|
}
|
|
246
|
-
/**
|
|
247
|
-
* One-time claim tokens for ghost accounts. The raw token only ever appears in
|
|
248
|
-
* the claim URL returned at mint time; we store its sha256. A used token marks
|
|
249
|
-
* the account as claimed (or merged into an existing account).
|
|
250
|
-
*/
|
|
251
|
-
interface ClaimTokensTable {
|
|
252
|
-
id: Generated<string>;
|
|
253
|
-
account_id: string;
|
|
254
|
-
token_hash: string;
|
|
255
|
-
created_at: Generated<Date>;
|
|
256
|
-
expires_at: Date;
|
|
257
|
-
used_at: Date | null;
|
|
258
|
-
}
|
|
259
244
|
interface MagicLinksTable {
|
|
260
245
|
id: Generated<string>;
|
|
261
246
|
email: string;
|
|
@@ -266,47 +251,6 @@ interface MagicLinksTable {
|
|
|
266
251
|
failed_attempts: Generated<number>;
|
|
267
252
|
created_at: Generated<Date>;
|
|
268
253
|
}
|
|
269
|
-
interface UsageDailyTable {
|
|
270
|
-
account_id: string;
|
|
271
|
-
tenant_id: string | null;
|
|
272
|
-
date: string;
|
|
273
|
-
api_requests: Generated<number>;
|
|
274
|
-
deliveries: Generated<number>;
|
|
275
|
-
streams_events_returned: Generated<number>;
|
|
276
|
-
index_decoded_events_returned: Generated<number>;
|
|
277
|
-
}
|
|
278
|
-
interface UsageSnapshotsTable {
|
|
279
|
-
id: Generated<string>;
|
|
280
|
-
account_id: string;
|
|
281
|
-
measured_at: Generated<Date>;
|
|
282
|
-
storage_bytes: Generated<number>;
|
|
283
|
-
}
|
|
284
|
-
interface AccountInsightsTable {
|
|
285
|
-
id: Generated<string>;
|
|
286
|
-
account_id: string;
|
|
287
|
-
category: string;
|
|
288
|
-
insight_type: string;
|
|
289
|
-
resource_id: string | null;
|
|
290
|
-
severity: string;
|
|
291
|
-
title: string;
|
|
292
|
-
body: string;
|
|
293
|
-
data: unknown;
|
|
294
|
-
dismissed_at: Date | null;
|
|
295
|
-
expires_at: Date | null;
|
|
296
|
-
created_at: Generated<Date>;
|
|
297
|
-
}
|
|
298
|
-
interface AccountAgentRunsTable {
|
|
299
|
-
id: Generated<string>;
|
|
300
|
-
account_id: string;
|
|
301
|
-
started_at: Generated<Date>;
|
|
302
|
-
completed_at: Date | null;
|
|
303
|
-
status: Generated<string>;
|
|
304
|
-
input_tokens: Generated<number>;
|
|
305
|
-
output_tokens: Generated<number>;
|
|
306
|
-
cost_usd: Generated<number>;
|
|
307
|
-
insights_created: Generated<number>;
|
|
308
|
-
error: string | null;
|
|
309
|
-
}
|
|
310
254
|
interface SubgraphProcessingStatsTable {
|
|
311
255
|
id: Generated<string>;
|
|
312
256
|
subgraph_name: string;
|
|
@@ -339,41 +283,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
339
283
|
last_processed_block: number | null;
|
|
340
284
|
captured_at: Generated<Date>;
|
|
341
285
|
}
|
|
342
|
-
interface SubgraphUsageDailyTable {
|
|
343
|
-
subgraph_id: string;
|
|
344
|
-
date: string;
|
|
345
|
-
query_count: Generated<number>;
|
|
346
|
-
}
|
|
347
|
-
interface ProjectsTable {
|
|
348
|
-
id: Generated<string>;
|
|
349
|
-
name: string;
|
|
350
|
-
slug: string;
|
|
351
|
-
account_id: string;
|
|
352
|
-
settings: Generated<Record<string, unknown>>;
|
|
353
|
-
network: Generated<string>;
|
|
354
|
-
node_rpc: string | null;
|
|
355
|
-
created_at: Generated<Date>;
|
|
356
|
-
updated_at: Generated<Date>;
|
|
357
|
-
}
|
|
358
|
-
interface TeamMembersTable {
|
|
359
|
-
id: Generated<string>;
|
|
360
|
-
project_id: string;
|
|
361
|
-
account_id: string;
|
|
362
|
-
role: Generated<string>;
|
|
363
|
-
invited_by: string | null;
|
|
364
|
-
created_at: Generated<Date>;
|
|
365
|
-
}
|
|
366
|
-
interface TeamInvitationsTable {
|
|
367
|
-
id: Generated<string>;
|
|
368
|
-
project_id: string;
|
|
369
|
-
email: string;
|
|
370
|
-
role: Generated<string>;
|
|
371
|
-
token: string;
|
|
372
|
-
invited_by: string | null;
|
|
373
|
-
expires_at: Date;
|
|
374
|
-
accepted_at: Date | null;
|
|
375
|
-
created_at: Generated<Date>;
|
|
376
|
-
}
|
|
377
286
|
interface ProcessedStripeEventsTable {
|
|
378
287
|
event_id: string;
|
|
379
288
|
event_type: string;
|
|
@@ -826,27 +735,14 @@ interface Database {
|
|
|
826
735
|
accounts: AccountsTable;
|
|
827
736
|
sessions: SessionsTable;
|
|
828
737
|
magic_links: MagicLinksTable;
|
|
829
|
-
claim_tokens: ClaimTokensTable;
|
|
830
|
-
usage_daily: UsageDailyTable;
|
|
831
|
-
usage_snapshots: UsageSnapshotsTable;
|
|
832
|
-
account_insights: AccountInsightsTable;
|
|
833
|
-
account_agent_runs: AccountAgentRunsTable;
|
|
834
738
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
835
739
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
836
740
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
837
741
|
subgraph_gaps: SubgraphGapsTable;
|
|
838
742
|
subgraph_operations: SubgraphOperationsTable;
|
|
839
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
840
|
-
projects: ProjectsTable;
|
|
841
|
-
team_members: TeamMembersTable;
|
|
842
|
-
team_invitations: TeamInvitationsTable;
|
|
843
743
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
844
|
-
tenants: TenantsTable;
|
|
845
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
846
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
847
744
|
account_spend_caps: AccountSpendCapsTable;
|
|
848
745
|
account_credits: AccountCreditsTable;
|
|
849
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
850
746
|
subscriptions: SubscriptionsTable;
|
|
851
747
|
subscription_outbox: SubscriptionOutboxTable;
|
|
852
748
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -921,57 +817,6 @@ interface X402PaymentsTable {
|
|
|
921
817
|
* reconciler's heal path can never double-credit them. */
|
|
922
818
|
credited_at: Generated<Date> | null;
|
|
923
819
|
}
|
|
924
|
-
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
925
|
-
interface TenantsTable {
|
|
926
|
-
id: Generated<string>;
|
|
927
|
-
account_id: string;
|
|
928
|
-
slug: string;
|
|
929
|
-
status: ColumnType<TenantStatus, TenantStatus | undefined, TenantStatus>;
|
|
930
|
-
plan: string;
|
|
931
|
-
cpus: ColumnType<number, number | string, number | string>;
|
|
932
|
-
memory_mb: number;
|
|
933
|
-
storage_limit_mb: number;
|
|
934
|
-
storage_used_mb: number | null;
|
|
935
|
-
pg_container_id: string | null;
|
|
936
|
-
api_container_id: string | null;
|
|
937
|
-
processor_container_id: string | null;
|
|
938
|
-
target_database_url_enc: Buffer;
|
|
939
|
-
tenant_jwt_secret_enc: Buffer;
|
|
940
|
-
anon_key_enc: Buffer;
|
|
941
|
-
service_key_enc: Buffer;
|
|
942
|
-
api_url_internal: string;
|
|
943
|
-
api_url_public: string;
|
|
944
|
-
suspended_at: Date | null;
|
|
945
|
-
last_health_check_at: Date | null;
|
|
946
|
-
last_active_at: Generated<Date>;
|
|
947
|
-
service_gen: Generated<number>;
|
|
948
|
-
anon_gen: Generated<number>;
|
|
949
|
-
project_id: string | null;
|
|
950
|
-
created_at: Generated<Date>;
|
|
951
|
-
updated_at: Generated<Date>;
|
|
952
|
-
}
|
|
953
|
-
interface TenantUsageMonthlyTable {
|
|
954
|
-
id: Generated<string>;
|
|
955
|
-
tenant_id: string;
|
|
956
|
-
period_month: Date;
|
|
957
|
-
storage_peak_mb: Generated<number>;
|
|
958
|
-
storage_avg_mb: Generated<number>;
|
|
959
|
-
storage_last_mb: Generated<number>;
|
|
960
|
-
measurements: Generated<number>;
|
|
961
|
-
first_at: Generated<Date>;
|
|
962
|
-
last_at: Generated<Date>;
|
|
963
|
-
}
|
|
964
|
-
interface TenantComputeAddonsTable {
|
|
965
|
-
id: Generated<string>;
|
|
966
|
-
tenant_id: string;
|
|
967
|
-
memory_mb_delta: Generated<number>;
|
|
968
|
-
cpu_delta: Generated<number | string>;
|
|
969
|
-
storage_mb_delta: Generated<number>;
|
|
970
|
-
effective_from: Generated<Date>;
|
|
971
|
-
effective_until: Date | null;
|
|
972
|
-
stripe_subscription_item_id: string | null;
|
|
973
|
-
created_at: Generated<Date>;
|
|
974
|
-
}
|
|
975
820
|
interface AccountSpendCapsTable {
|
|
976
821
|
account_id: string;
|
|
977
822
|
monthly_cap_cents: number | null;
|
|
@@ -995,20 +840,6 @@ interface AccountCreditsTable {
|
|
|
995
840
|
refill_last_at: Date | null;
|
|
996
841
|
updated_at: Generated<Date>;
|
|
997
842
|
}
|
|
998
|
-
type ProvisioningAuditEvent = "provision.start" | "provision.success" | "provision.failure" | "suspend" | "resume" | "resize" | "keys.rotate" | "bastion.key.upload" | "bastion.key.revoke" | "teardown";
|
|
999
|
-
type ProvisioningAuditStatus = "ok" | "error";
|
|
1000
|
-
interface ProvisioningAuditLogTable {
|
|
1001
|
-
id: Generated<string>;
|
|
1002
|
-
tenant_id: string | null;
|
|
1003
|
-
tenant_slug: string | null;
|
|
1004
|
-
account_id: string | null;
|
|
1005
|
-
actor: string;
|
|
1006
|
-
event: ProvisioningAuditEvent;
|
|
1007
|
-
status: ProvisioningAuditStatus;
|
|
1008
|
-
detail: unknown | null;
|
|
1009
|
-
error: string | null;
|
|
1010
|
-
created_at: Generated<Date>;
|
|
1011
|
-
}
|
|
1012
843
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1013
844
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1014
845
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|
|
@@ -222,11 +222,9 @@ interface AccountsTable {
|
|
|
222
222
|
ghost: Generated<boolean>;
|
|
223
223
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
224
224
|
wallet_principal: string | null;
|
|
225
|
-
plan: Generated<string>;
|
|
226
225
|
display_name: string | null;
|
|
227
226
|
bio: string | null;
|
|
228
227
|
avatar_url: string | null;
|
|
229
|
-
slug: string | null;
|
|
230
228
|
stripe_customer_id: string | null;
|
|
231
229
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
232
230
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -243,19 +241,6 @@ interface SessionsTable {
|
|
|
243
241
|
last_used_at: Date | null;
|
|
244
242
|
created_at: Generated<Date>;
|
|
245
243
|
}
|
|
246
|
-
/**
|
|
247
|
-
* One-time claim tokens for ghost accounts. The raw token only ever appears in
|
|
248
|
-
* the claim URL returned at mint time; we store its sha256. A used token marks
|
|
249
|
-
* the account as claimed (or merged into an existing account).
|
|
250
|
-
*/
|
|
251
|
-
interface ClaimTokensTable {
|
|
252
|
-
id: Generated<string>;
|
|
253
|
-
account_id: string;
|
|
254
|
-
token_hash: string;
|
|
255
|
-
created_at: Generated<Date>;
|
|
256
|
-
expires_at: Date;
|
|
257
|
-
used_at: Date | null;
|
|
258
|
-
}
|
|
259
244
|
interface MagicLinksTable {
|
|
260
245
|
id: Generated<string>;
|
|
261
246
|
email: string;
|
|
@@ -266,47 +251,6 @@ interface MagicLinksTable {
|
|
|
266
251
|
failed_attempts: Generated<number>;
|
|
267
252
|
created_at: Generated<Date>;
|
|
268
253
|
}
|
|
269
|
-
interface UsageDailyTable {
|
|
270
|
-
account_id: string;
|
|
271
|
-
tenant_id: string | null;
|
|
272
|
-
date: string;
|
|
273
|
-
api_requests: Generated<number>;
|
|
274
|
-
deliveries: Generated<number>;
|
|
275
|
-
streams_events_returned: Generated<number>;
|
|
276
|
-
index_decoded_events_returned: Generated<number>;
|
|
277
|
-
}
|
|
278
|
-
interface UsageSnapshotsTable {
|
|
279
|
-
id: Generated<string>;
|
|
280
|
-
account_id: string;
|
|
281
|
-
measured_at: Generated<Date>;
|
|
282
|
-
storage_bytes: Generated<number>;
|
|
283
|
-
}
|
|
284
|
-
interface AccountInsightsTable {
|
|
285
|
-
id: Generated<string>;
|
|
286
|
-
account_id: string;
|
|
287
|
-
category: string;
|
|
288
|
-
insight_type: string;
|
|
289
|
-
resource_id: string | null;
|
|
290
|
-
severity: string;
|
|
291
|
-
title: string;
|
|
292
|
-
body: string;
|
|
293
|
-
data: unknown;
|
|
294
|
-
dismissed_at: Date | null;
|
|
295
|
-
expires_at: Date | null;
|
|
296
|
-
created_at: Generated<Date>;
|
|
297
|
-
}
|
|
298
|
-
interface AccountAgentRunsTable {
|
|
299
|
-
id: Generated<string>;
|
|
300
|
-
account_id: string;
|
|
301
|
-
started_at: Generated<Date>;
|
|
302
|
-
completed_at: Date | null;
|
|
303
|
-
status: Generated<string>;
|
|
304
|
-
input_tokens: Generated<number>;
|
|
305
|
-
output_tokens: Generated<number>;
|
|
306
|
-
cost_usd: Generated<number>;
|
|
307
|
-
insights_created: Generated<number>;
|
|
308
|
-
error: string | null;
|
|
309
|
-
}
|
|
310
254
|
interface SubgraphProcessingStatsTable {
|
|
311
255
|
id: Generated<string>;
|
|
312
256
|
subgraph_name: string;
|
|
@@ -339,41 +283,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
339
283
|
last_processed_block: number | null;
|
|
340
284
|
captured_at: Generated<Date>;
|
|
341
285
|
}
|
|
342
|
-
interface SubgraphUsageDailyTable {
|
|
343
|
-
subgraph_id: string;
|
|
344
|
-
date: string;
|
|
345
|
-
query_count: Generated<number>;
|
|
346
|
-
}
|
|
347
|
-
interface ProjectsTable {
|
|
348
|
-
id: Generated<string>;
|
|
349
|
-
name: string;
|
|
350
|
-
slug: string;
|
|
351
|
-
account_id: string;
|
|
352
|
-
settings: Generated<Record<string, unknown>>;
|
|
353
|
-
network: Generated<string>;
|
|
354
|
-
node_rpc: string | null;
|
|
355
|
-
created_at: Generated<Date>;
|
|
356
|
-
updated_at: Generated<Date>;
|
|
357
|
-
}
|
|
358
|
-
interface TeamMembersTable {
|
|
359
|
-
id: Generated<string>;
|
|
360
|
-
project_id: string;
|
|
361
|
-
account_id: string;
|
|
362
|
-
role: Generated<string>;
|
|
363
|
-
invited_by: string | null;
|
|
364
|
-
created_at: Generated<Date>;
|
|
365
|
-
}
|
|
366
|
-
interface TeamInvitationsTable {
|
|
367
|
-
id: Generated<string>;
|
|
368
|
-
project_id: string;
|
|
369
|
-
email: string;
|
|
370
|
-
role: Generated<string>;
|
|
371
|
-
token: string;
|
|
372
|
-
invited_by: string | null;
|
|
373
|
-
expires_at: Date;
|
|
374
|
-
accepted_at: Date | null;
|
|
375
|
-
created_at: Generated<Date>;
|
|
376
|
-
}
|
|
377
286
|
interface ProcessedStripeEventsTable {
|
|
378
287
|
event_id: string;
|
|
379
288
|
event_type: string;
|
|
@@ -826,27 +735,14 @@ interface Database {
|
|
|
826
735
|
accounts: AccountsTable;
|
|
827
736
|
sessions: SessionsTable;
|
|
828
737
|
magic_links: MagicLinksTable;
|
|
829
|
-
claim_tokens: ClaimTokensTable;
|
|
830
|
-
usage_daily: UsageDailyTable;
|
|
831
|
-
usage_snapshots: UsageSnapshotsTable;
|
|
832
|
-
account_insights: AccountInsightsTable;
|
|
833
|
-
account_agent_runs: AccountAgentRunsTable;
|
|
834
738
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
835
739
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
836
740
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
837
741
|
subgraph_gaps: SubgraphGapsTable;
|
|
838
742
|
subgraph_operations: SubgraphOperationsTable;
|
|
839
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
840
|
-
projects: ProjectsTable;
|
|
841
|
-
team_members: TeamMembersTable;
|
|
842
|
-
team_invitations: TeamInvitationsTable;
|
|
843
743
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
844
|
-
tenants: TenantsTable;
|
|
845
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
846
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
847
744
|
account_spend_caps: AccountSpendCapsTable;
|
|
848
745
|
account_credits: AccountCreditsTable;
|
|
849
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
850
746
|
subscriptions: SubscriptionsTable;
|
|
851
747
|
subscription_outbox: SubscriptionOutboxTable;
|
|
852
748
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -921,57 +817,6 @@ interface X402PaymentsTable {
|
|
|
921
817
|
* reconciler's heal path can never double-credit them. */
|
|
922
818
|
credited_at: Generated<Date> | null;
|
|
923
819
|
}
|
|
924
|
-
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
925
|
-
interface TenantsTable {
|
|
926
|
-
id: Generated<string>;
|
|
927
|
-
account_id: string;
|
|
928
|
-
slug: string;
|
|
929
|
-
status: ColumnType<TenantStatus, TenantStatus | undefined, TenantStatus>;
|
|
930
|
-
plan: string;
|
|
931
|
-
cpus: ColumnType<number, number | string, number | string>;
|
|
932
|
-
memory_mb: number;
|
|
933
|
-
storage_limit_mb: number;
|
|
934
|
-
storage_used_mb: number | null;
|
|
935
|
-
pg_container_id: string | null;
|
|
936
|
-
api_container_id: string | null;
|
|
937
|
-
processor_container_id: string | null;
|
|
938
|
-
target_database_url_enc: Buffer;
|
|
939
|
-
tenant_jwt_secret_enc: Buffer;
|
|
940
|
-
anon_key_enc: Buffer;
|
|
941
|
-
service_key_enc: Buffer;
|
|
942
|
-
api_url_internal: string;
|
|
943
|
-
api_url_public: string;
|
|
944
|
-
suspended_at: Date | null;
|
|
945
|
-
last_health_check_at: Date | null;
|
|
946
|
-
last_active_at: Generated<Date>;
|
|
947
|
-
service_gen: Generated<number>;
|
|
948
|
-
anon_gen: Generated<number>;
|
|
949
|
-
project_id: string | null;
|
|
950
|
-
created_at: Generated<Date>;
|
|
951
|
-
updated_at: Generated<Date>;
|
|
952
|
-
}
|
|
953
|
-
interface TenantUsageMonthlyTable {
|
|
954
|
-
id: Generated<string>;
|
|
955
|
-
tenant_id: string;
|
|
956
|
-
period_month: Date;
|
|
957
|
-
storage_peak_mb: Generated<number>;
|
|
958
|
-
storage_avg_mb: Generated<number>;
|
|
959
|
-
storage_last_mb: Generated<number>;
|
|
960
|
-
measurements: Generated<number>;
|
|
961
|
-
first_at: Generated<Date>;
|
|
962
|
-
last_at: Generated<Date>;
|
|
963
|
-
}
|
|
964
|
-
interface TenantComputeAddonsTable {
|
|
965
|
-
id: Generated<string>;
|
|
966
|
-
tenant_id: string;
|
|
967
|
-
memory_mb_delta: Generated<number>;
|
|
968
|
-
cpu_delta: Generated<number | string>;
|
|
969
|
-
storage_mb_delta: Generated<number>;
|
|
970
|
-
effective_from: Generated<Date>;
|
|
971
|
-
effective_until: Date | null;
|
|
972
|
-
stripe_subscription_item_id: string | null;
|
|
973
|
-
created_at: Generated<Date>;
|
|
974
|
-
}
|
|
975
820
|
interface AccountSpendCapsTable {
|
|
976
821
|
account_id: string;
|
|
977
822
|
monthly_cap_cents: number | null;
|
|
@@ -995,20 +840,6 @@ interface AccountCreditsTable {
|
|
|
995
840
|
refill_last_at: Date | null;
|
|
996
841
|
updated_at: Generated<Date>;
|
|
997
842
|
}
|
|
998
|
-
type ProvisioningAuditEvent = "provision.start" | "provision.success" | "provision.failure" | "suspend" | "resume" | "resize" | "keys.rotate" | "bastion.key.upload" | "bastion.key.revoke" | "teardown";
|
|
999
|
-
type ProvisioningAuditStatus = "ok" | "error";
|
|
1000
|
-
interface ProvisioningAuditLogTable {
|
|
1001
|
-
id: Generated<string>;
|
|
1002
|
-
tenant_id: string | null;
|
|
1003
|
-
tenant_slug: string | null;
|
|
1004
|
-
account_id: string | null;
|
|
1005
|
-
actor: string;
|
|
1006
|
-
event: ProvisioningAuditEvent;
|
|
1007
|
-
status: ProvisioningAuditStatus;
|
|
1008
|
-
detail: unknown | null;
|
|
1009
|
-
error: string | null;
|
|
1010
|
-
created_at: Generated<Date>;
|
|
1011
|
-
}
|
|
1012
843
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1013
844
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1014
845
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|
|
@@ -541,11 +541,9 @@ interface AccountsTable {
|
|
|
541
541
|
ghost: Generated<boolean>;
|
|
542
542
|
/** Stacks principal owning a wallet-ghost account (x402-paid deploys). */
|
|
543
543
|
wallet_principal: string | null;
|
|
544
|
-
plan: Generated<string>;
|
|
545
544
|
display_name: string | null;
|
|
546
545
|
bio: string | null;
|
|
547
546
|
avatar_url: string | null;
|
|
548
|
-
slug: string | null;
|
|
549
547
|
stripe_customer_id: string | null;
|
|
550
548
|
/** Opt-out toggle for the subgraph reindex-completion email. Defaults true. */
|
|
551
549
|
notify_reindex_complete: Generated<boolean>;
|
|
@@ -562,19 +560,6 @@ interface SessionsTable {
|
|
|
562
560
|
last_used_at: Date | null;
|
|
563
561
|
created_at: Generated<Date>;
|
|
564
562
|
}
|
|
565
|
-
/**
|
|
566
|
-
* One-time claim tokens for ghost accounts. The raw token only ever appears in
|
|
567
|
-
* the claim URL returned at mint time; we store its sha256. A used token marks
|
|
568
|
-
* the account as claimed (or merged into an existing account).
|
|
569
|
-
*/
|
|
570
|
-
interface ClaimTokensTable {
|
|
571
|
-
id: Generated<string>;
|
|
572
|
-
account_id: string;
|
|
573
|
-
token_hash: string;
|
|
574
|
-
created_at: Generated<Date>;
|
|
575
|
-
expires_at: Date;
|
|
576
|
-
used_at: Date | null;
|
|
577
|
-
}
|
|
578
563
|
interface MagicLinksTable {
|
|
579
564
|
id: Generated<string>;
|
|
580
565
|
email: string;
|
|
@@ -585,47 +570,6 @@ interface MagicLinksTable {
|
|
|
585
570
|
failed_attempts: Generated<number>;
|
|
586
571
|
created_at: Generated<Date>;
|
|
587
572
|
}
|
|
588
|
-
interface UsageDailyTable {
|
|
589
|
-
account_id: string;
|
|
590
|
-
tenant_id: string | null;
|
|
591
|
-
date: string;
|
|
592
|
-
api_requests: Generated<number>;
|
|
593
|
-
deliveries: Generated<number>;
|
|
594
|
-
streams_events_returned: Generated<number>;
|
|
595
|
-
index_decoded_events_returned: Generated<number>;
|
|
596
|
-
}
|
|
597
|
-
interface UsageSnapshotsTable {
|
|
598
|
-
id: Generated<string>;
|
|
599
|
-
account_id: string;
|
|
600
|
-
measured_at: Generated<Date>;
|
|
601
|
-
storage_bytes: Generated<number>;
|
|
602
|
-
}
|
|
603
|
-
interface AccountInsightsTable {
|
|
604
|
-
id: Generated<string>;
|
|
605
|
-
account_id: string;
|
|
606
|
-
category: string;
|
|
607
|
-
insight_type: string;
|
|
608
|
-
resource_id: string | null;
|
|
609
|
-
severity: string;
|
|
610
|
-
title: string;
|
|
611
|
-
body: string;
|
|
612
|
-
data: unknown;
|
|
613
|
-
dismissed_at: Date | null;
|
|
614
|
-
expires_at: Date | null;
|
|
615
|
-
created_at: Generated<Date>;
|
|
616
|
-
}
|
|
617
|
-
interface AccountAgentRunsTable {
|
|
618
|
-
id: Generated<string>;
|
|
619
|
-
account_id: string;
|
|
620
|
-
started_at: Generated<Date>;
|
|
621
|
-
completed_at: Date | null;
|
|
622
|
-
status: Generated<string>;
|
|
623
|
-
input_tokens: Generated<number>;
|
|
624
|
-
output_tokens: Generated<number>;
|
|
625
|
-
cost_usd: Generated<number>;
|
|
626
|
-
insights_created: Generated<number>;
|
|
627
|
-
error: string | null;
|
|
628
|
-
}
|
|
629
573
|
interface SubgraphProcessingStatsTable {
|
|
630
574
|
id: Generated<string>;
|
|
631
575
|
subgraph_name: string;
|
|
@@ -658,41 +602,6 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
658
602
|
last_processed_block: number | null;
|
|
659
603
|
captured_at: Generated<Date>;
|
|
660
604
|
}
|
|
661
|
-
interface SubgraphUsageDailyTable {
|
|
662
|
-
subgraph_id: string;
|
|
663
|
-
date: string;
|
|
664
|
-
query_count: Generated<number>;
|
|
665
|
-
}
|
|
666
|
-
interface ProjectsTable {
|
|
667
|
-
id: Generated<string>;
|
|
668
|
-
name: string;
|
|
669
|
-
slug: string;
|
|
670
|
-
account_id: string;
|
|
671
|
-
settings: Generated<Record<string, unknown>>;
|
|
672
|
-
network: Generated<string>;
|
|
673
|
-
node_rpc: string | null;
|
|
674
|
-
created_at: Generated<Date>;
|
|
675
|
-
updated_at: Generated<Date>;
|
|
676
|
-
}
|
|
677
|
-
interface TeamMembersTable {
|
|
678
|
-
id: Generated<string>;
|
|
679
|
-
project_id: string;
|
|
680
|
-
account_id: string;
|
|
681
|
-
role: Generated<string>;
|
|
682
|
-
invited_by: string | null;
|
|
683
|
-
created_at: Generated<Date>;
|
|
684
|
-
}
|
|
685
|
-
interface TeamInvitationsTable {
|
|
686
|
-
id: Generated<string>;
|
|
687
|
-
project_id: string;
|
|
688
|
-
email: string;
|
|
689
|
-
role: Generated<string>;
|
|
690
|
-
token: string;
|
|
691
|
-
invited_by: string | null;
|
|
692
|
-
expires_at: Date;
|
|
693
|
-
accepted_at: Date | null;
|
|
694
|
-
created_at: Generated<Date>;
|
|
695
|
-
}
|
|
696
605
|
interface ProcessedStripeEventsTable {
|
|
697
606
|
event_id: string;
|
|
698
607
|
event_type: string;
|
|
@@ -1145,27 +1054,14 @@ interface Database {
|
|
|
1145
1054
|
accounts: AccountsTable;
|
|
1146
1055
|
sessions: SessionsTable;
|
|
1147
1056
|
magic_links: MagicLinksTable;
|
|
1148
|
-
claim_tokens: ClaimTokensTable;
|
|
1149
|
-
usage_daily: UsageDailyTable;
|
|
1150
|
-
usage_snapshots: UsageSnapshotsTable;
|
|
1151
|
-
account_insights: AccountInsightsTable;
|
|
1152
|
-
account_agent_runs: AccountAgentRunsTable;
|
|
1153
1057
|
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
1154
1058
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
1155
1059
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
1156
1060
|
subgraph_gaps: SubgraphGapsTable;
|
|
1157
1061
|
subgraph_operations: SubgraphOperationsTable;
|
|
1158
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
1159
|
-
projects: ProjectsTable;
|
|
1160
|
-
team_members: TeamMembersTable;
|
|
1161
|
-
team_invitations: TeamInvitationsTable;
|
|
1162
1062
|
processed_stripe_events: ProcessedStripeEventsTable;
|
|
1163
|
-
tenants: TenantsTable;
|
|
1164
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
1165
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
1166
1063
|
account_spend_caps: AccountSpendCapsTable;
|
|
1167
1064
|
account_credits: AccountCreditsTable;
|
|
1168
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
1169
1065
|
subscriptions: SubscriptionsTable;
|
|
1170
1066
|
subscription_outbox: SubscriptionOutboxTable;
|
|
1171
1067
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
@@ -1240,57 +1136,6 @@ interface X402PaymentsTable {
|
|
|
1240
1136
|
* reconciler's heal path can never double-credit them. */
|
|
1241
1137
|
credited_at: Generated<Date> | null;
|
|
1242
1138
|
}
|
|
1243
|
-
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
1244
|
-
interface TenantsTable {
|
|
1245
|
-
id: Generated<string>;
|
|
1246
|
-
account_id: string;
|
|
1247
|
-
slug: string;
|
|
1248
|
-
status: ColumnType<TenantStatus, TenantStatus | undefined, TenantStatus>;
|
|
1249
|
-
plan: string;
|
|
1250
|
-
cpus: ColumnType<number, number | string, number | string>;
|
|
1251
|
-
memory_mb: number;
|
|
1252
|
-
storage_limit_mb: number;
|
|
1253
|
-
storage_used_mb: number | null;
|
|
1254
|
-
pg_container_id: string | null;
|
|
1255
|
-
api_container_id: string | null;
|
|
1256
|
-
processor_container_id: string | null;
|
|
1257
|
-
target_database_url_enc: Buffer;
|
|
1258
|
-
tenant_jwt_secret_enc: Buffer;
|
|
1259
|
-
anon_key_enc: Buffer;
|
|
1260
|
-
service_key_enc: Buffer;
|
|
1261
|
-
api_url_internal: string;
|
|
1262
|
-
api_url_public: string;
|
|
1263
|
-
suspended_at: Date | null;
|
|
1264
|
-
last_health_check_at: Date | null;
|
|
1265
|
-
last_active_at: Generated<Date>;
|
|
1266
|
-
service_gen: Generated<number>;
|
|
1267
|
-
anon_gen: Generated<number>;
|
|
1268
|
-
project_id: string | null;
|
|
1269
|
-
created_at: Generated<Date>;
|
|
1270
|
-
updated_at: Generated<Date>;
|
|
1271
|
-
}
|
|
1272
|
-
interface TenantUsageMonthlyTable {
|
|
1273
|
-
id: Generated<string>;
|
|
1274
|
-
tenant_id: string;
|
|
1275
|
-
period_month: Date;
|
|
1276
|
-
storage_peak_mb: Generated<number>;
|
|
1277
|
-
storage_avg_mb: Generated<number>;
|
|
1278
|
-
storage_last_mb: Generated<number>;
|
|
1279
|
-
measurements: Generated<number>;
|
|
1280
|
-
first_at: Generated<Date>;
|
|
1281
|
-
last_at: Generated<Date>;
|
|
1282
|
-
}
|
|
1283
|
-
interface TenantComputeAddonsTable {
|
|
1284
|
-
id: Generated<string>;
|
|
1285
|
-
tenant_id: string;
|
|
1286
|
-
memory_mb_delta: Generated<number>;
|
|
1287
|
-
cpu_delta: Generated<number | string>;
|
|
1288
|
-
storage_mb_delta: Generated<number>;
|
|
1289
|
-
effective_from: Generated<Date>;
|
|
1290
|
-
effective_until: Date | null;
|
|
1291
|
-
stripe_subscription_item_id: string | null;
|
|
1292
|
-
created_at: Generated<Date>;
|
|
1293
|
-
}
|
|
1294
1139
|
interface AccountSpendCapsTable {
|
|
1295
1140
|
account_id: string;
|
|
1296
1141
|
monthly_cap_cents: number | null;
|
|
@@ -1314,20 +1159,6 @@ interface AccountCreditsTable {
|
|
|
1314
1159
|
refill_last_at: Date | null;
|
|
1315
1160
|
updated_at: Generated<Date>;
|
|
1316
1161
|
}
|
|
1317
|
-
type ProvisioningAuditEvent = "provision.start" | "provision.success" | "provision.failure" | "suspend" | "resume" | "resize" | "keys.rotate" | "bastion.key.upload" | "bastion.key.revoke" | "teardown";
|
|
1318
|
-
type ProvisioningAuditStatus = "ok" | "error";
|
|
1319
|
-
interface ProvisioningAuditLogTable {
|
|
1320
|
-
id: Generated<string>;
|
|
1321
|
-
tenant_id: string | null;
|
|
1322
|
-
tenant_slug: string | null;
|
|
1323
|
-
account_id: string | null;
|
|
1324
|
-
actor: string;
|
|
1325
|
-
event: ProvisioningAuditEvent;
|
|
1326
|
-
status: ProvisioningAuditStatus;
|
|
1327
|
-
detail: unknown | null;
|
|
1328
|
-
error: string | null;
|
|
1329
|
-
created_at: Generated<Date>;
|
|
1330
|
-
}
|
|
1331
1162
|
type SubscriptionStatus = "active" | "paused" | "error";
|
|
1332
1163
|
/** Polymorphic subscription mode: `subgraph` reacts to processed table rows;
|
|
1333
1164
|
* `chain` reacts to raw chain events matched directly off the Index/Streams
|