@secondlayer/shared 6.6.0 → 6.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/README.md +9 -12
- package/dist/src/db/index.d.ts +3 -0
- package/dist/src/db/queries/chain-reorgs.d.ts +3 -0
- package/dist/src/db/queries/integrity.d.ts +3 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +3 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +3 -0
- package/dist/src/db/queries/subgraphs.d.ts +3 -0
- package/dist/src/db/queries/subscriptions.d.ts +3 -0
- package/dist/src/db/schema.d.ts +3 -0
- package/dist/src/index.d.ts +32 -42
- package/dist/src/index.js +94 -103
- package/dist/src/index.js.map +3 -4
- package/dist/src/node/local-client.d.ts +3 -0
- package/dist/src/schemas/index.d.ts +29 -42
- package/dist/src/schemas/index.js +94 -103
- package/dist/src/schemas/index.js.map +3 -4
- package/migrations/0079_decoded_events_payload.ts +12 -0
- package/package.json +1 -21
- package/dist/src/db/queries/account-spend-caps.d.ts +0 -729
- package/dist/src/db/queries/account-spend-caps.js +0 -59
- package/dist/src/db/queries/account-spend-caps.js.map +0 -10
- package/dist/src/db/queries/accounts.d.ts +0 -741
- package/dist/src/db/queries/accounts.js +0 -86
- package/dist/src/db/queries/accounts.js.map +0 -10
- package/dist/src/db/queries/projects.d.ts +0 -722
- package/dist/src/db/queries/projects.js +0 -47
- package/dist/src/db/queries/projects.js.map +0 -10
- package/dist/src/db/queries/usage.d.ts +0 -731
- package/dist/src/db/queries/usage.js +0 -109
- package/dist/src/db/queries/usage.js.map +0 -10
- package/dist/src/schemas/accounts.d.ts +0 -14
- package/dist/src/schemas/accounts.js +0 -29
- package/dist/src/schemas/accounts.js.map +0 -10
|
@@ -1,722 +0,0 @@
|
|
|
1
|
-
import { Kysely } from "kysely";
|
|
2
|
-
import { ColumnType, Generated, Selectable } from "kysely";
|
|
3
|
-
interface BlocksTable {
|
|
4
|
-
height: number;
|
|
5
|
-
hash: string;
|
|
6
|
-
parent_hash: string;
|
|
7
|
-
burn_block_height: number;
|
|
8
|
-
burn_block_hash: ColumnType<string | null, string | null | undefined, string | null>;
|
|
9
|
-
timestamp: number;
|
|
10
|
-
canonical: Generated<boolean>;
|
|
11
|
-
created_at: Generated<Date>;
|
|
12
|
-
}
|
|
13
|
-
interface TransactionsTable {
|
|
14
|
-
tx_id: string;
|
|
15
|
-
block_height: number;
|
|
16
|
-
tx_index: Generated<number>;
|
|
17
|
-
type: string;
|
|
18
|
-
sender: string;
|
|
19
|
-
status: string;
|
|
20
|
-
contract_id: string | null;
|
|
21
|
-
function_name: string | null;
|
|
22
|
-
function_args: Generated<unknown | null>;
|
|
23
|
-
raw_result: Generated<string | null>;
|
|
24
|
-
raw_tx: string;
|
|
25
|
-
created_at: Generated<Date>;
|
|
26
|
-
}
|
|
27
|
-
interface EventsTable {
|
|
28
|
-
id: Generated<string>;
|
|
29
|
-
tx_id: string;
|
|
30
|
-
block_height: number;
|
|
31
|
-
event_index: number;
|
|
32
|
-
type: string;
|
|
33
|
-
data: unknown;
|
|
34
|
-
created_at: Generated<Date>;
|
|
35
|
-
}
|
|
36
|
-
interface IndexProgressTable {
|
|
37
|
-
network: string;
|
|
38
|
-
last_indexed_block: Generated<number>;
|
|
39
|
-
last_contiguous_block: Generated<number>;
|
|
40
|
-
highest_seen_block: Generated<number>;
|
|
41
|
-
updated_at: Generated<Date>;
|
|
42
|
-
}
|
|
43
|
-
interface SubgraphsTable {
|
|
44
|
-
id: Generated<string>;
|
|
45
|
-
name: string;
|
|
46
|
-
version: Generated<string>;
|
|
47
|
-
status: Generated<string>;
|
|
48
|
-
definition: Record<string, unknown>;
|
|
49
|
-
schema_hash: string;
|
|
50
|
-
handler_path: string;
|
|
51
|
-
schema_name: string | null;
|
|
52
|
-
start_block: Generated<number>;
|
|
53
|
-
last_processed_block: Generated<number>;
|
|
54
|
-
reindex_from_block: number | null;
|
|
55
|
-
reindex_to_block: number | null;
|
|
56
|
-
last_error: string | null;
|
|
57
|
-
last_error_at: Date | null;
|
|
58
|
-
total_processed: Generated<number>;
|
|
59
|
-
total_errors: Generated<number>;
|
|
60
|
-
account_id: string;
|
|
61
|
-
handler_code: string | null;
|
|
62
|
-
source_code: string | null;
|
|
63
|
-
project_id: string | null;
|
|
64
|
-
created_at: Generated<Date>;
|
|
65
|
-
updated_at: Generated<Date>;
|
|
66
|
-
}
|
|
67
|
-
interface SubgraphGapsTable {
|
|
68
|
-
id: Generated<string>;
|
|
69
|
-
subgraph_id: string;
|
|
70
|
-
subgraph_name: string;
|
|
71
|
-
gap_start: number;
|
|
72
|
-
gap_end: number;
|
|
73
|
-
reason: string;
|
|
74
|
-
detected_at: Generated<Date>;
|
|
75
|
-
resolved_at: Date | null;
|
|
76
|
-
}
|
|
77
|
-
type SubgraphOperationKind = "reindex" | "backfill";
|
|
78
|
-
type SubgraphOperationStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
|
|
79
|
-
interface SubgraphOperationsTable {
|
|
80
|
-
id: Generated<string>;
|
|
81
|
-
subgraph_id: string;
|
|
82
|
-
subgraph_name: string;
|
|
83
|
-
account_id: string | null;
|
|
84
|
-
kind: ColumnType<SubgraphOperationKind, SubgraphOperationKind, SubgraphOperationKind>;
|
|
85
|
-
status: ColumnType<SubgraphOperationStatus, SubgraphOperationStatus | undefined, SubgraphOperationStatus>;
|
|
86
|
-
from_block: number | null;
|
|
87
|
-
to_block: number | null;
|
|
88
|
-
cancel_requested: Generated<boolean>;
|
|
89
|
-
locked_by: string | null;
|
|
90
|
-
locked_until: Date | null;
|
|
91
|
-
started_at: Date | null;
|
|
92
|
-
finished_at: Date | null;
|
|
93
|
-
processed_blocks: number | null;
|
|
94
|
-
error: string | null;
|
|
95
|
-
created_at: Generated<Date>;
|
|
96
|
-
updated_at: Generated<Date>;
|
|
97
|
-
}
|
|
98
|
-
interface ApiKeysTable {
|
|
99
|
-
id: Generated<string>;
|
|
100
|
-
key_hash: string;
|
|
101
|
-
key_prefix: string;
|
|
102
|
-
name: string | null;
|
|
103
|
-
status: Generated<string>;
|
|
104
|
-
rate_limit: Generated<number>;
|
|
105
|
-
ip_address: string;
|
|
106
|
-
account_id: string;
|
|
107
|
-
product: Generated<"account" | "streams" | "index">;
|
|
108
|
-
tier: "free" | "build" | "scale" | "enterprise" | null;
|
|
109
|
-
last_used_at: Date | null;
|
|
110
|
-
revoked_at: Date | null;
|
|
111
|
-
created_at: Generated<Date>;
|
|
112
|
-
}
|
|
113
|
-
interface AccountsTable {
|
|
114
|
-
id: Generated<string>;
|
|
115
|
-
email: string;
|
|
116
|
-
plan: Generated<string>;
|
|
117
|
-
display_name: string | null;
|
|
118
|
-
bio: string | null;
|
|
119
|
-
avatar_url: string | null;
|
|
120
|
-
slug: string | null;
|
|
121
|
-
stripe_customer_id: string | null;
|
|
122
|
-
created_at: Generated<Date>;
|
|
123
|
-
}
|
|
124
|
-
interface SessionsTable {
|
|
125
|
-
id: Generated<string>;
|
|
126
|
-
token_hash: string;
|
|
127
|
-
token_prefix: string;
|
|
128
|
-
account_id: string;
|
|
129
|
-
ip_address: string;
|
|
130
|
-
expires_at: Generated<Date>;
|
|
131
|
-
revoked_at: Date | null;
|
|
132
|
-
last_used_at: Date | null;
|
|
133
|
-
created_at: Generated<Date>;
|
|
134
|
-
}
|
|
135
|
-
interface MagicLinksTable {
|
|
136
|
-
id: Generated<string>;
|
|
137
|
-
email: string;
|
|
138
|
-
token: string;
|
|
139
|
-
code: string | null;
|
|
140
|
-
expires_at: Date;
|
|
141
|
-
used_at: Date | null;
|
|
142
|
-
failed_attempts: Generated<number>;
|
|
143
|
-
created_at: Generated<Date>;
|
|
144
|
-
}
|
|
145
|
-
interface UsageDailyTable {
|
|
146
|
-
account_id: string;
|
|
147
|
-
tenant_id: string | null;
|
|
148
|
-
date: string;
|
|
149
|
-
api_requests: Generated<number>;
|
|
150
|
-
deliveries: Generated<number>;
|
|
151
|
-
streams_events_returned: Generated<number>;
|
|
152
|
-
index_decoded_events_returned: Generated<number>;
|
|
153
|
-
}
|
|
154
|
-
interface UsageSnapshotsTable {
|
|
155
|
-
id: Generated<string>;
|
|
156
|
-
account_id: string;
|
|
157
|
-
measured_at: Generated<Date>;
|
|
158
|
-
storage_bytes: Generated<number>;
|
|
159
|
-
}
|
|
160
|
-
interface AccountInsightsTable {
|
|
161
|
-
id: Generated<string>;
|
|
162
|
-
account_id: string;
|
|
163
|
-
category: string;
|
|
164
|
-
insight_type: string;
|
|
165
|
-
resource_id: string | null;
|
|
166
|
-
severity: string;
|
|
167
|
-
title: string;
|
|
168
|
-
body: string;
|
|
169
|
-
data: unknown;
|
|
170
|
-
dismissed_at: Date | null;
|
|
171
|
-
expires_at: Date | null;
|
|
172
|
-
created_at: Generated<Date>;
|
|
173
|
-
}
|
|
174
|
-
interface AccountAgentRunsTable {
|
|
175
|
-
id: Generated<string>;
|
|
176
|
-
account_id: string;
|
|
177
|
-
started_at: Generated<Date>;
|
|
178
|
-
completed_at: Date | null;
|
|
179
|
-
status: Generated<string>;
|
|
180
|
-
input_tokens: Generated<number>;
|
|
181
|
-
output_tokens: Generated<number>;
|
|
182
|
-
cost_usd: Generated<number>;
|
|
183
|
-
insights_created: Generated<number>;
|
|
184
|
-
error: string | null;
|
|
185
|
-
}
|
|
186
|
-
interface SubgraphProcessingStatsTable {
|
|
187
|
-
id: Generated<string>;
|
|
188
|
-
subgraph_name: string;
|
|
189
|
-
api_key_id: string | null;
|
|
190
|
-
bucket_start: Date | null;
|
|
191
|
-
bucket_end: Date | null;
|
|
192
|
-
blocks_processed: number | null;
|
|
193
|
-
total_time_ms: number | null;
|
|
194
|
-
handler_time_ms: number | null;
|
|
195
|
-
flush_time_ms: number | null;
|
|
196
|
-
max_block_time_ms: number | null;
|
|
197
|
-
max_handler_time_ms: number | null;
|
|
198
|
-
avg_ops_per_block: number | null;
|
|
199
|
-
is_catchup: Generated<boolean>;
|
|
200
|
-
created_at: Generated<Date>;
|
|
201
|
-
}
|
|
202
|
-
interface SubgraphTableSnapshotsTable {
|
|
203
|
-
id: Generated<string>;
|
|
204
|
-
subgraph_name: string;
|
|
205
|
-
api_key_id: string | null;
|
|
206
|
-
table_name: string;
|
|
207
|
-
row_count: number | null;
|
|
208
|
-
created_at: Generated<Date>;
|
|
209
|
-
}
|
|
210
|
-
interface SubgraphHealthSnapshotsTable {
|
|
211
|
-
id: Generated<string>;
|
|
212
|
-
subgraph_id: string;
|
|
213
|
-
total_processed: number;
|
|
214
|
-
total_errors: number;
|
|
215
|
-
last_processed_block: number | null;
|
|
216
|
-
captured_at: Generated<Date>;
|
|
217
|
-
}
|
|
218
|
-
interface SubgraphUsageDailyTable {
|
|
219
|
-
subgraph_id: string;
|
|
220
|
-
date: string;
|
|
221
|
-
query_count: Generated<number>;
|
|
222
|
-
}
|
|
223
|
-
interface ProjectsTable {
|
|
224
|
-
id: Generated<string>;
|
|
225
|
-
name: string;
|
|
226
|
-
slug: string;
|
|
227
|
-
account_id: string;
|
|
228
|
-
settings: Generated<Record<string, unknown>>;
|
|
229
|
-
network: Generated<string>;
|
|
230
|
-
node_rpc: string | null;
|
|
231
|
-
created_at: Generated<Date>;
|
|
232
|
-
updated_at: Generated<Date>;
|
|
233
|
-
}
|
|
234
|
-
interface TeamMembersTable {
|
|
235
|
-
id: Generated<string>;
|
|
236
|
-
project_id: string;
|
|
237
|
-
account_id: string;
|
|
238
|
-
role: Generated<string>;
|
|
239
|
-
invited_by: string | null;
|
|
240
|
-
created_at: Generated<Date>;
|
|
241
|
-
}
|
|
242
|
-
interface TeamInvitationsTable {
|
|
243
|
-
id: Generated<string>;
|
|
244
|
-
project_id: string;
|
|
245
|
-
email: string;
|
|
246
|
-
role: Generated<string>;
|
|
247
|
-
token: string;
|
|
248
|
-
invited_by: string | null;
|
|
249
|
-
expires_at: Date;
|
|
250
|
-
accepted_at: Date | null;
|
|
251
|
-
created_at: Generated<Date>;
|
|
252
|
-
}
|
|
253
|
-
interface ChatSessionsTable {
|
|
254
|
-
id: Generated<string>;
|
|
255
|
-
account_id: string;
|
|
256
|
-
title: string | null;
|
|
257
|
-
summary: unknown | null;
|
|
258
|
-
created_at: Generated<Date>;
|
|
259
|
-
updated_at: Generated<Date>;
|
|
260
|
-
}
|
|
261
|
-
interface ChatMessagesTable {
|
|
262
|
-
id: Generated<string>;
|
|
263
|
-
chat_session_id: string;
|
|
264
|
-
role: string;
|
|
265
|
-
parts: unknown;
|
|
266
|
-
metadata: unknown | null;
|
|
267
|
-
created_at: Generated<Date>;
|
|
268
|
-
}
|
|
269
|
-
interface ProcessedStripeEventsTable {
|
|
270
|
-
event_id: string;
|
|
271
|
-
event_type: string;
|
|
272
|
-
processed_at: Generated<Date>;
|
|
273
|
-
}
|
|
274
|
-
interface DecodedEventsTable {
|
|
275
|
-
cursor: string;
|
|
276
|
-
block_height: number;
|
|
277
|
-
tx_id: string;
|
|
278
|
-
tx_index: number;
|
|
279
|
-
event_index: number;
|
|
280
|
-
event_type: string;
|
|
281
|
-
microblock_hash: string | null;
|
|
282
|
-
canonical: Generated<boolean>;
|
|
283
|
-
contract_id: string | null;
|
|
284
|
-
sender: string | null;
|
|
285
|
-
recipient: string | null;
|
|
286
|
-
amount: string | null;
|
|
287
|
-
asset_identifier: string | null;
|
|
288
|
-
value: string | null;
|
|
289
|
-
memo: string | null;
|
|
290
|
-
source_cursor: string;
|
|
291
|
-
created_at: Generated<Date>;
|
|
292
|
-
}
|
|
293
|
-
interface L2DecoderCheckpointsTable {
|
|
294
|
-
decoder_name: string;
|
|
295
|
-
last_cursor: string | null;
|
|
296
|
-
updated_at: Generated<Date>;
|
|
297
|
-
}
|
|
298
|
-
interface ChainReorgsTable {
|
|
299
|
-
id: Generated<string>;
|
|
300
|
-
detected_at: Generated<Date>;
|
|
301
|
-
fork_point_height: number;
|
|
302
|
-
old_index_block_hash: string | null;
|
|
303
|
-
new_index_block_hash: string | null;
|
|
304
|
-
orphaned_from_height: number;
|
|
305
|
-
orphaned_from_event_index: number;
|
|
306
|
-
orphaned_to_height: number;
|
|
307
|
-
orphaned_to_event_index: number;
|
|
308
|
-
new_canonical_height: number;
|
|
309
|
-
new_canonical_event_index: number;
|
|
310
|
-
created_at: Generated<Date>;
|
|
311
|
-
}
|
|
312
|
-
type Pox4FunctionName = "stack-stx" | "delegate-stx" | "stack-extend" | "stack-increase" | "revoke-delegate-stx" | "delegate-stack-stx" | "delegate-stack-extend" | "delegate-stack-increase" | "stack-aggregation-commit" | "stack-aggregation-commit-indexed" | "stack-aggregation-increase" | "set-signer-key-authorization";
|
|
313
|
-
interface Pox4CallsTable {
|
|
314
|
-
cursor: string;
|
|
315
|
-
block_height: number;
|
|
316
|
-
block_time: Date;
|
|
317
|
-
burn_block_height: number;
|
|
318
|
-
tx_id: string;
|
|
319
|
-
tx_index: number;
|
|
320
|
-
function_name: Pox4FunctionName;
|
|
321
|
-
caller: string;
|
|
322
|
-
stacker: string | null;
|
|
323
|
-
delegate_to: string | null;
|
|
324
|
-
amount_ustx: string | null;
|
|
325
|
-
lock_period: number | null;
|
|
326
|
-
pox_addr_version: number | null;
|
|
327
|
-
pox_addr_hashbytes: string | null;
|
|
328
|
-
pox_addr_btc: string | null;
|
|
329
|
-
start_cycle: number | null;
|
|
330
|
-
end_cycle: number | null;
|
|
331
|
-
signer_key: string | null;
|
|
332
|
-
signer_signature: string | null;
|
|
333
|
-
auth_id: string | null;
|
|
334
|
-
max_amount: string | null;
|
|
335
|
-
reward_cycle: number | null;
|
|
336
|
-
aggregated_amount_ustx: string | null;
|
|
337
|
-
aggregated_signer_index: number | null;
|
|
338
|
-
auth_period: number | null;
|
|
339
|
-
auth_topic: string | null;
|
|
340
|
-
auth_allowed: boolean | null;
|
|
341
|
-
result_ok: boolean;
|
|
342
|
-
result_raw: string;
|
|
343
|
-
canonical: Generated<boolean>;
|
|
344
|
-
source_cursor: string;
|
|
345
|
-
created_at: Generated<Date>;
|
|
346
|
-
}
|
|
347
|
-
interface Pox4CyclesDailyTable {
|
|
348
|
-
date: string;
|
|
349
|
-
reward_cycle: number;
|
|
350
|
-
total_stacked_ustx: Generated<string>;
|
|
351
|
-
solo_stackers: Generated<number>;
|
|
352
|
-
delegated_principals: Generated<number>;
|
|
353
|
-
unique_pools: Generated<number>;
|
|
354
|
-
unique_signers: Generated<number>;
|
|
355
|
-
calls_today: Generated<number>;
|
|
356
|
-
updated_at: Generated<Date>;
|
|
357
|
-
}
|
|
358
|
-
interface Pox4SignersDailyTable {
|
|
359
|
-
date: string;
|
|
360
|
-
reward_cycle: number;
|
|
361
|
-
signer_key: string;
|
|
362
|
-
weight_ustx: Generated<string>;
|
|
363
|
-
stacker_count: Generated<number>;
|
|
364
|
-
aggregation_calls: Generated<number>;
|
|
365
|
-
updated_at: Generated<Date>;
|
|
366
|
-
}
|
|
367
|
-
type SbtcEventTopic = "completed-deposit" | "withdrawal-create" | "withdrawal-accept" | "withdrawal-reject" | "key-rotation" | "update-protocol-contract";
|
|
368
|
-
interface SbtcEventsTable {
|
|
369
|
-
cursor: string;
|
|
370
|
-
block_height: number;
|
|
371
|
-
block_time: Date;
|
|
372
|
-
tx_id: string;
|
|
373
|
-
tx_index: number;
|
|
374
|
-
event_index: number;
|
|
375
|
-
topic: SbtcEventTopic;
|
|
376
|
-
request_id: number | null;
|
|
377
|
-
amount: string | null;
|
|
378
|
-
sender: string | null;
|
|
379
|
-
recipient_btc_version: number | null;
|
|
380
|
-
recipient_btc_hashbytes: string | null;
|
|
381
|
-
bitcoin_txid: string | null;
|
|
382
|
-
output_index: number | null;
|
|
383
|
-
sweep_txid: string | null;
|
|
384
|
-
burn_hash: string | null;
|
|
385
|
-
burn_height: number | null;
|
|
386
|
-
signer_bitmap: string | null;
|
|
387
|
-
max_fee: string | null;
|
|
388
|
-
fee: string | null;
|
|
389
|
-
block_height_at_request: number | null;
|
|
390
|
-
governance_contract_type: number | null;
|
|
391
|
-
governance_new_contract: string | null;
|
|
392
|
-
signer_aggregate_pubkey: string | null;
|
|
393
|
-
signer_threshold: number | null;
|
|
394
|
-
signer_address: string | null;
|
|
395
|
-
signer_keys_count: number | null;
|
|
396
|
-
canonical: Generated<boolean>;
|
|
397
|
-
source_cursor: string;
|
|
398
|
-
created_at: Generated<Date>;
|
|
399
|
-
}
|
|
400
|
-
type SbtcTokenEventType = "transfer" | "mint" | "burn";
|
|
401
|
-
interface SbtcTokenEventsTable {
|
|
402
|
-
cursor: string;
|
|
403
|
-
block_height: number;
|
|
404
|
-
block_time: Date;
|
|
405
|
-
tx_id: string;
|
|
406
|
-
tx_index: number;
|
|
407
|
-
event_index: number;
|
|
408
|
-
event_type: SbtcTokenEventType;
|
|
409
|
-
sender: string | null;
|
|
410
|
-
recipient: string | null;
|
|
411
|
-
amount: string;
|
|
412
|
-
memo: string | null;
|
|
413
|
-
canonical: Generated<boolean>;
|
|
414
|
-
source_cursor: string;
|
|
415
|
-
created_at: Generated<Date>;
|
|
416
|
-
}
|
|
417
|
-
interface SbtcSupplySnapshotsTable {
|
|
418
|
-
date: string;
|
|
419
|
-
total_supply: Generated<string>;
|
|
420
|
-
mints_today: Generated<string>;
|
|
421
|
-
burns_today: Generated<string>;
|
|
422
|
-
deposit_count: Generated<number>;
|
|
423
|
-
withdrawal_create_count: Generated<number>;
|
|
424
|
-
withdrawal_accept_count: Generated<number>;
|
|
425
|
-
withdrawal_reject_count: Generated<number>;
|
|
426
|
-
updated_at: Generated<Date>;
|
|
427
|
-
}
|
|
428
|
-
type BnsNameEventTopic = "new-name" | "transfer-name" | "renew-name" | "burn-name" | "new-airdrop";
|
|
429
|
-
interface BnsNameEventsTable {
|
|
430
|
-
cursor: string;
|
|
431
|
-
block_height: number;
|
|
432
|
-
block_time: Date;
|
|
433
|
-
tx_id: string;
|
|
434
|
-
tx_index: number;
|
|
435
|
-
event_index: number;
|
|
436
|
-
topic: BnsNameEventTopic;
|
|
437
|
-
namespace: string;
|
|
438
|
-
name: string;
|
|
439
|
-
fqn: string;
|
|
440
|
-
owner: string | null;
|
|
441
|
-
bns_id: string;
|
|
442
|
-
registered_at: number | null;
|
|
443
|
-
imported_at: number | null;
|
|
444
|
-
renewal_height: number | null;
|
|
445
|
-
stx_burn: string | null;
|
|
446
|
-
preordered_by: string | null;
|
|
447
|
-
hashed_salted_fqn_preorder: string | null;
|
|
448
|
-
canonical: Generated<boolean>;
|
|
449
|
-
source_cursor: string;
|
|
450
|
-
created_at: Generated<Date>;
|
|
451
|
-
}
|
|
452
|
-
type BnsNamespaceEventStatus = "launch" | "transfer-manager" | "freeze-manager" | "update-price-manager" | "freeze-price-manager" | "turn-off-manager-transfers";
|
|
453
|
-
interface BnsNamespaceEventsTable {
|
|
454
|
-
cursor: string;
|
|
455
|
-
block_height: number;
|
|
456
|
-
block_time: Date;
|
|
457
|
-
tx_id: string;
|
|
458
|
-
tx_index: number;
|
|
459
|
-
event_index: number;
|
|
460
|
-
status: BnsNamespaceEventStatus;
|
|
461
|
-
namespace: string;
|
|
462
|
-
manager: string | null;
|
|
463
|
-
manager_frozen: boolean | null;
|
|
464
|
-
manager_transfers_disabled: boolean | null;
|
|
465
|
-
price_function: string | null;
|
|
466
|
-
price_frozen: boolean | null;
|
|
467
|
-
lifetime: number | null;
|
|
468
|
-
revealed_at: number | null;
|
|
469
|
-
launched_at: number | null;
|
|
470
|
-
canonical: Generated<boolean>;
|
|
471
|
-
source_cursor: string;
|
|
472
|
-
created_at: Generated<Date>;
|
|
473
|
-
}
|
|
474
|
-
type BnsMarketplaceAction = "list-in-ustx" | "unlist-in-ustx" | "buy-in-ustx";
|
|
475
|
-
interface BnsMarketplaceEventsTable {
|
|
476
|
-
cursor: string;
|
|
477
|
-
block_height: number;
|
|
478
|
-
block_time: Date;
|
|
479
|
-
tx_id: string;
|
|
480
|
-
tx_index: number;
|
|
481
|
-
event_index: number;
|
|
482
|
-
action: BnsMarketplaceAction;
|
|
483
|
-
bns_id: string;
|
|
484
|
-
price_ustx: string | null;
|
|
485
|
-
commission: string | null;
|
|
486
|
-
canonical: Generated<boolean>;
|
|
487
|
-
source_cursor: string;
|
|
488
|
-
created_at: Generated<Date>;
|
|
489
|
-
}
|
|
490
|
-
interface BnsNamesTable {
|
|
491
|
-
fqn: string;
|
|
492
|
-
namespace: string;
|
|
493
|
-
name: string;
|
|
494
|
-
owner: string;
|
|
495
|
-
bns_id: string;
|
|
496
|
-
registered_at: number | null;
|
|
497
|
-
renewal_height: number | null;
|
|
498
|
-
last_event_cursor: string;
|
|
499
|
-
last_event_at: Date;
|
|
500
|
-
updated_at: Generated<Date>;
|
|
501
|
-
}
|
|
502
|
-
interface BnsNamespacesTable {
|
|
503
|
-
namespace: string;
|
|
504
|
-
manager: string | null;
|
|
505
|
-
manager_frozen: Generated<boolean>;
|
|
506
|
-
price_frozen: Generated<boolean>;
|
|
507
|
-
lifetime: number | null;
|
|
508
|
-
launched_at: number | null;
|
|
509
|
-
last_event_cursor: string;
|
|
510
|
-
last_event_at: Date;
|
|
511
|
-
name_count: Generated<number>;
|
|
512
|
-
updated_at: Generated<Date>;
|
|
513
|
-
}
|
|
514
|
-
interface Database {
|
|
515
|
-
blocks: BlocksTable;
|
|
516
|
-
transactions: TransactionsTable;
|
|
517
|
-
events: EventsTable;
|
|
518
|
-
index_progress: IndexProgressTable;
|
|
519
|
-
subgraphs: SubgraphsTable;
|
|
520
|
-
api_keys: ApiKeysTable;
|
|
521
|
-
accounts: AccountsTable;
|
|
522
|
-
sessions: SessionsTable;
|
|
523
|
-
magic_links: MagicLinksTable;
|
|
524
|
-
usage_daily: UsageDailyTable;
|
|
525
|
-
usage_snapshots: UsageSnapshotsTable;
|
|
526
|
-
account_insights: AccountInsightsTable;
|
|
527
|
-
account_agent_runs: AccountAgentRunsTable;
|
|
528
|
-
subgraph_health_snapshots: SubgraphHealthSnapshotsTable;
|
|
529
|
-
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
530
|
-
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
531
|
-
subgraph_gaps: SubgraphGapsTable;
|
|
532
|
-
subgraph_operations: SubgraphOperationsTable;
|
|
533
|
-
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
534
|
-
projects: ProjectsTable;
|
|
535
|
-
team_members: TeamMembersTable;
|
|
536
|
-
team_invitations: TeamInvitationsTable;
|
|
537
|
-
chat_sessions: ChatSessionsTable;
|
|
538
|
-
chat_messages: ChatMessagesTable;
|
|
539
|
-
processed_stripe_events: ProcessedStripeEventsTable;
|
|
540
|
-
tenants: TenantsTable;
|
|
541
|
-
tenant_usage_monthly: TenantUsageMonthlyTable;
|
|
542
|
-
tenant_compute_addons: TenantComputeAddonsTable;
|
|
543
|
-
account_spend_caps: AccountSpendCapsTable;
|
|
544
|
-
provisioning_audit_log: ProvisioningAuditLogTable;
|
|
545
|
-
subscriptions: SubscriptionsTable;
|
|
546
|
-
subscription_outbox: SubscriptionOutboxTable;
|
|
547
|
-
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
548
|
-
decoded_events: DecodedEventsTable;
|
|
549
|
-
l2_decoder_checkpoints: L2DecoderCheckpointsTable;
|
|
550
|
-
chain_reorgs: ChainReorgsTable;
|
|
551
|
-
pox4_calls: Pox4CallsTable;
|
|
552
|
-
pox4_cycles_daily: Pox4CyclesDailyTable;
|
|
553
|
-
pox4_signers_daily: Pox4SignersDailyTable;
|
|
554
|
-
sbtc_events: SbtcEventsTable;
|
|
555
|
-
sbtc_token_events: SbtcTokenEventsTable;
|
|
556
|
-
sbtc_supply_snapshots: SbtcSupplySnapshotsTable;
|
|
557
|
-
bns_name_events: BnsNameEventsTable;
|
|
558
|
-
bns_namespace_events: BnsNamespaceEventsTable;
|
|
559
|
-
bns_marketplace_events: BnsMarketplaceEventsTable;
|
|
560
|
-
bns_names: BnsNamesTable;
|
|
561
|
-
bns_namespaces: BnsNamespacesTable;
|
|
562
|
-
service_heartbeats: ServiceHeartbeatsTable;
|
|
563
|
-
}
|
|
564
|
-
interface ServiceHeartbeatsTable {
|
|
565
|
-
name: string;
|
|
566
|
-
updated_at: Generated<Date>;
|
|
567
|
-
}
|
|
568
|
-
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
569
|
-
interface TenantsTable {
|
|
570
|
-
id: Generated<string>;
|
|
571
|
-
account_id: string;
|
|
572
|
-
slug: string;
|
|
573
|
-
status: ColumnType<TenantStatus, TenantStatus | undefined, TenantStatus>;
|
|
574
|
-
plan: string;
|
|
575
|
-
cpus: ColumnType<number, number | string, number | string>;
|
|
576
|
-
memory_mb: number;
|
|
577
|
-
storage_limit_mb: number;
|
|
578
|
-
storage_used_mb: number | null;
|
|
579
|
-
pg_container_id: string | null;
|
|
580
|
-
api_container_id: string | null;
|
|
581
|
-
processor_container_id: string | null;
|
|
582
|
-
target_database_url_enc: Buffer;
|
|
583
|
-
tenant_jwt_secret_enc: Buffer;
|
|
584
|
-
anon_key_enc: Buffer;
|
|
585
|
-
service_key_enc: Buffer;
|
|
586
|
-
api_url_internal: string;
|
|
587
|
-
api_url_public: string;
|
|
588
|
-
suspended_at: Date | null;
|
|
589
|
-
last_health_check_at: Date | null;
|
|
590
|
-
last_active_at: Generated<Date>;
|
|
591
|
-
service_gen: Generated<number>;
|
|
592
|
-
anon_gen: Generated<number>;
|
|
593
|
-
project_id: string | null;
|
|
594
|
-
created_at: Generated<Date>;
|
|
595
|
-
updated_at: Generated<Date>;
|
|
596
|
-
}
|
|
597
|
-
interface TenantUsageMonthlyTable {
|
|
598
|
-
id: Generated<string>;
|
|
599
|
-
tenant_id: string;
|
|
600
|
-
period_month: Date;
|
|
601
|
-
storage_peak_mb: Generated<number>;
|
|
602
|
-
storage_avg_mb: Generated<number>;
|
|
603
|
-
storage_last_mb: Generated<number>;
|
|
604
|
-
measurements: Generated<number>;
|
|
605
|
-
first_at: Generated<Date>;
|
|
606
|
-
last_at: Generated<Date>;
|
|
607
|
-
}
|
|
608
|
-
interface TenantComputeAddonsTable {
|
|
609
|
-
id: Generated<string>;
|
|
610
|
-
tenant_id: string;
|
|
611
|
-
memory_mb_delta: Generated<number>;
|
|
612
|
-
cpu_delta: Generated<number | string>;
|
|
613
|
-
storage_mb_delta: Generated<number>;
|
|
614
|
-
effective_from: Generated<Date>;
|
|
615
|
-
effective_until: Date | null;
|
|
616
|
-
stripe_subscription_item_id: string | null;
|
|
617
|
-
created_at: Generated<Date>;
|
|
618
|
-
}
|
|
619
|
-
interface AccountSpendCapsTable {
|
|
620
|
-
account_id: string;
|
|
621
|
-
monthly_cap_cents: number | null;
|
|
622
|
-
compute_cap_cents: number | null;
|
|
623
|
-
storage_cap_cents: number | null;
|
|
624
|
-
alert_threshold_pct: Generated<number>;
|
|
625
|
-
alert_sent_at: Date | null;
|
|
626
|
-
frozen_at: Date | null;
|
|
627
|
-
updated_at: Generated<Date>;
|
|
628
|
-
}
|
|
629
|
-
type ProvisioningAuditEvent = "provision.start" | "provision.success" | "provision.failure" | "suspend" | "resume" | "resize" | "keys.rotate" | "bastion.key.upload" | "bastion.key.revoke" | "teardown";
|
|
630
|
-
type ProvisioningAuditStatus = "ok" | "error";
|
|
631
|
-
interface ProvisioningAuditLogTable {
|
|
632
|
-
id: Generated<string>;
|
|
633
|
-
tenant_id: string | null;
|
|
634
|
-
tenant_slug: string | null;
|
|
635
|
-
account_id: string | null;
|
|
636
|
-
actor: string;
|
|
637
|
-
event: ProvisioningAuditEvent;
|
|
638
|
-
status: ProvisioningAuditStatus;
|
|
639
|
-
detail: unknown | null;
|
|
640
|
-
error: string | null;
|
|
641
|
-
created_at: Generated<Date>;
|
|
642
|
-
}
|
|
643
|
-
type Project = Selectable<ProjectsTable>;
|
|
644
|
-
type TeamInvitation = Selectable<TeamInvitationsTable>;
|
|
645
|
-
type SubscriptionStatus = "active" | "paused" | "error";
|
|
646
|
-
type SubscriptionFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
|
|
647
|
-
type SubscriptionRuntime = "inngest" | "trigger" | "cloudflare" | "node";
|
|
648
|
-
interface SubscriptionsTable {
|
|
649
|
-
id: Generated<string>;
|
|
650
|
-
account_id: string;
|
|
651
|
-
project_id: string | null;
|
|
652
|
-
name: string;
|
|
653
|
-
status: ColumnType<SubscriptionStatus, SubscriptionStatus | undefined, SubscriptionStatus>;
|
|
654
|
-
subgraph_name: string;
|
|
655
|
-
table_name: string;
|
|
656
|
-
filter: Generated<unknown>;
|
|
657
|
-
format: ColumnType<SubscriptionFormat, SubscriptionFormat | undefined, SubscriptionFormat>;
|
|
658
|
-
runtime: SubscriptionRuntime | null;
|
|
659
|
-
url: string;
|
|
660
|
-
signing_secret_enc: Buffer;
|
|
661
|
-
auth_config: Generated<unknown>;
|
|
662
|
-
max_retries: Generated<number>;
|
|
663
|
-
timeout_ms: Generated<number>;
|
|
664
|
-
concurrency: Generated<number>;
|
|
665
|
-
circuit_failures: Generated<number>;
|
|
666
|
-
circuit_opened_at: Date | null;
|
|
667
|
-
last_delivery_at: Date | null;
|
|
668
|
-
last_success_at: Date | null;
|
|
669
|
-
last_error: string | null;
|
|
670
|
-
created_at: Generated<Date>;
|
|
671
|
-
updated_at: Generated<Date>;
|
|
672
|
-
}
|
|
673
|
-
type OutboxStatus = "pending" | "delivered" | "dead";
|
|
674
|
-
interface SubscriptionOutboxTable {
|
|
675
|
-
id: Generated<string>;
|
|
676
|
-
subscription_id: string;
|
|
677
|
-
subgraph_name: string;
|
|
678
|
-
table_name: string;
|
|
679
|
-
block_height: number | bigint;
|
|
680
|
-
tx_id: string | null;
|
|
681
|
-
row_pk: unknown;
|
|
682
|
-
event_type: string;
|
|
683
|
-
payload: unknown;
|
|
684
|
-
dedup_key: string;
|
|
685
|
-
attempt: Generated<number>;
|
|
686
|
-
next_attempt_at: Generated<Date>;
|
|
687
|
-
status: ColumnType<OutboxStatus, OutboxStatus | undefined, OutboxStatus>;
|
|
688
|
-
is_replay: Generated<boolean>;
|
|
689
|
-
delivered_at: Date | null;
|
|
690
|
-
failed_at: Date | null;
|
|
691
|
-
locked_by: string | null;
|
|
692
|
-
locked_until: Date | null;
|
|
693
|
-
created_at: Generated<Date>;
|
|
694
|
-
}
|
|
695
|
-
interface SubscriptionDeliveriesTable {
|
|
696
|
-
id: Generated<string>;
|
|
697
|
-
/** Nullable after migration 0077 — outbox row may be cleaned up while
|
|
698
|
-
* delivery telemetry is retained. */
|
|
699
|
-
outbox_id: string | null;
|
|
700
|
-
subscription_id: string;
|
|
701
|
-
attempt: number;
|
|
702
|
-
status_code: number | null;
|
|
703
|
-
response_headers: unknown | null;
|
|
704
|
-
response_body: string | null;
|
|
705
|
-
error_message: string | null;
|
|
706
|
-
duration_ms: number | null;
|
|
707
|
-
dispatched_at: Generated<Date>;
|
|
708
|
-
}
|
|
709
|
-
declare function getProjectsByAccount(db: Kysely<Database>, accountId: string): Promise<Project[]>;
|
|
710
|
-
declare function getProjectBySlug(db: Kysely<Database>, accountId: string, slug: string): Promise<Project | undefined>;
|
|
711
|
-
declare function getTeamMembers(db: Kysely<Database>, projectId: string): Promise<Array<{
|
|
712
|
-
id: string
|
|
713
|
-
role: string
|
|
714
|
-
created_at: Date
|
|
715
|
-
account_id: string
|
|
716
|
-
email: string
|
|
717
|
-
display_name: string | null
|
|
718
|
-
avatar_url: string | null
|
|
719
|
-
account_slug: string | null
|
|
720
|
-
}>>;
|
|
721
|
-
declare function getTeamInvitations(db: Kysely<Database>, projectId: string): Promise<TeamInvitation[]>;
|
|
722
|
-
export { getTeamMembers, getTeamInvitations, getProjectsByAccount, getProjectBySlug };
|