@secondlayer/shared 6.0.0 → 6.1.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/db/index.d.ts +45 -1
- package/dist/src/db/queries/account-spend-caps.d.ts +44 -0
- package/dist/src/db/queries/account-usage.d.ts +44 -0
- package/dist/src/db/queries/accounts.d.ts +44 -0
- package/dist/src/db/queries/chain-reorgs.d.ts +532 -0
- package/dist/src/db/queries/chain-reorgs.js +322 -0
- package/dist/src/db/queries/chain-reorgs.js.map +14 -0
- package/dist/src/db/queries/integrity.d.ts +44 -0
- package/dist/src/db/queries/projects.d.ts +44 -0
- package/dist/src/db/queries/provisioning-audit.d.ts +44 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +44 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +44 -0
- package/dist/src/db/queries/subgraphs.d.ts +44 -0
- package/dist/src/db/queries/subscriptions.d.ts +44 -0
- package/dist/src/db/queries/tenant-compute-addons.d.ts +44 -0
- package/dist/src/db/queries/tenants.d.ts +44 -0
- package/dist/src/db/queries/usage.d.ts +47 -1
- package/dist/src/db/queries/usage.js +20 -1
- package/dist/src/db/queries/usage.js.map +3 -3
- package/dist/src/db/schema.d.ts +45 -1
- package/dist/src/index.d.ts +45 -1
- package/dist/src/node/local-client.d.ts +44 -0
- package/dist/src/types.d.ts +2 -1
- package/migrations/0065_l2_decoded_events.ts +50 -0
- package/migrations/0066_public_l2_decoded_events.ts +83 -0
- package/migrations/0067_product_usage_counters.ts +18 -0
- package/migrations/0068_chain_reorgs_and_burn_block_hash.ts +48 -0
- package/package.json +5 -1
package/dist/src/db/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ interface BlocksTable {
|
|
|
23
23
|
hash: string;
|
|
24
24
|
parent_hash: string;
|
|
25
25
|
burn_block_height: number;
|
|
26
|
+
burn_block_hash: ColumnType<string | null, string | null | undefined, string | null>;
|
|
26
27
|
timestamp: number;
|
|
27
28
|
canonical: Generated<boolean>;
|
|
28
29
|
created_at: Generated<Date>;
|
|
@@ -163,6 +164,8 @@ interface UsageDailyTable {
|
|
|
163
164
|
date: string;
|
|
164
165
|
api_requests: Generated<number>;
|
|
165
166
|
deliveries: Generated<number>;
|
|
167
|
+
streams_events_returned: Generated<number>;
|
|
168
|
+
index_decoded_events_returned: Generated<number>;
|
|
166
169
|
}
|
|
167
170
|
interface UsageSnapshotsTable {
|
|
168
171
|
id: Generated<string>;
|
|
@@ -291,6 +294,44 @@ interface ProcessedStripeEventsTable {
|
|
|
291
294
|
event_type: string;
|
|
292
295
|
processed_at: Generated<Date>;
|
|
293
296
|
}
|
|
297
|
+
interface DecodedEventsTable {
|
|
298
|
+
cursor: string;
|
|
299
|
+
block_height: number;
|
|
300
|
+
tx_id: string;
|
|
301
|
+
tx_index: number;
|
|
302
|
+
event_index: number;
|
|
303
|
+
event_type: string;
|
|
304
|
+
microblock_hash: string | null;
|
|
305
|
+
canonical: Generated<boolean>;
|
|
306
|
+
contract_id: string | null;
|
|
307
|
+
sender: string | null;
|
|
308
|
+
recipient: string | null;
|
|
309
|
+
amount: string | null;
|
|
310
|
+
asset_identifier: string | null;
|
|
311
|
+
value: string | null;
|
|
312
|
+
memo: string | null;
|
|
313
|
+
source_cursor: string;
|
|
314
|
+
created_at: Generated<Date>;
|
|
315
|
+
}
|
|
316
|
+
interface L2DecoderCheckpointsTable {
|
|
317
|
+
decoder_name: string;
|
|
318
|
+
last_cursor: string | null;
|
|
319
|
+
updated_at: Generated<Date>;
|
|
320
|
+
}
|
|
321
|
+
interface ChainReorgsTable {
|
|
322
|
+
id: Generated<string>;
|
|
323
|
+
detected_at: Generated<Date>;
|
|
324
|
+
fork_point_height: number;
|
|
325
|
+
old_index_block_hash: string | null;
|
|
326
|
+
new_index_block_hash: string | null;
|
|
327
|
+
orphaned_from_height: number;
|
|
328
|
+
orphaned_from_event_index: number;
|
|
329
|
+
orphaned_to_height: number;
|
|
330
|
+
orphaned_to_event_index: number;
|
|
331
|
+
new_canonical_height: number;
|
|
332
|
+
new_canonical_event_index: number;
|
|
333
|
+
created_at: Generated<Date>;
|
|
334
|
+
}
|
|
294
335
|
interface Database {
|
|
295
336
|
blocks: BlocksTable;
|
|
296
337
|
transactions: TransactionsTable;
|
|
@@ -326,6 +367,9 @@ interface Database {
|
|
|
326
367
|
subscriptions: SubscriptionsTable;
|
|
327
368
|
subscription_outbox: SubscriptionOutboxTable;
|
|
328
369
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
370
|
+
decoded_events: DecodedEventsTable;
|
|
371
|
+
l2_decoder_checkpoints: L2DecoderCheckpointsTable;
|
|
372
|
+
chain_reorgs: ChainReorgsTable;
|
|
329
373
|
}
|
|
330
374
|
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
331
375
|
interface TenantsTable {
|
|
@@ -562,4 +606,4 @@ declare function getDb(connectionString?: string): Kysely<Database>;
|
|
|
562
606
|
declare function getRawClient(role?: "source" | "target"): ReturnType<typeof postgres>;
|
|
563
607
|
/** Close all DB connection pools. Call in CLI commands to allow process exit. */
|
|
564
608
|
declare function closeDb(): Promise<void>;
|
|
565
|
-
export { sql, parseJsonb, jsonb, getTargetDb, getSourceDb, getRawClient, getDb, closeDb, WaitlistTable, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionStatus, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormat, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, SessionsTable, Session, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, OutboxStatus, MagicLinksTable, MagicLink, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, Event, Database, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
|
|
609
|
+
export { sql, parseJsonb, jsonb, getTargetDb, getSourceDb, getRawClient, getDb, closeDb, WaitlistTable, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateTenantUsageMonthly, UpdateTenantComputeAddon, UpdateTenant, UpdateSubscriptionOutbox, UpdateSubscription, UpdateSubgraphOperation, UpdateSubgraph, UpdateProject, UpdateIndexProgress, UpdateEvent, UpdateChatSession, UpdateBlock, UpdateApiKey, UpdateAccountSpendCap, TransactionsTable, Transaction, TenantsTable, TenantUsageMonthlyTable, TenantUsageMonthly, TenantStatus, TenantComputeAddonsTable, TenantComputeAddon, Tenant, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubscriptionsTable, SubscriptionStatus, SubscriptionRuntime, SubscriptionOutboxTable, SubscriptionOutbox, SubscriptionFormat, SubscriptionDelivery, SubscriptionDeliveriesTable, Subscription, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphOperationsTable, SubgraphOperationStatus, SubgraphOperationKind, SubgraphOperation, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, SessionsTable, Session, ProvisioningAuditStatus, ProvisioningAuditLogTable, ProvisioningAuditLog, ProvisioningAuditEvent, ProjectsTable, Project, ProcessedStripeEventsTable, OutboxStatus, MagicLinksTable, MagicLink, L2DecoderCheckpointsTable, InsertTransaction, InsertTenantUsageMonthly, InsertTenantComputeAddon, InsertTenant, InsertTeamMember, InsertTeamInvitation, InsertSubscriptionOutbox, InsertSubscriptionDelivery, InsertSubscription, InsertSubgraphUsageDaily, InsertSubgraphOperation, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertSession, InsertProvisioningAuditLog, InsertProject, InsertMagicLink, InsertIndexProgress, InsertEvent, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountSpendCap, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, Event, DecodedEventsTable, Database, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, ChainReorgsTable, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountSpendCapsTable, AccountSpendCap, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
|
|
@@ -5,6 +5,7 @@ interface BlocksTable {
|
|
|
5
5
|
hash: string;
|
|
6
6
|
parent_hash: string;
|
|
7
7
|
burn_block_height: number;
|
|
8
|
+
burn_block_hash: ColumnType<string | null, string | null | undefined, string | null>;
|
|
8
9
|
timestamp: number;
|
|
9
10
|
canonical: Generated<boolean>;
|
|
10
11
|
created_at: Generated<Date>;
|
|
@@ -145,6 +146,8 @@ interface UsageDailyTable {
|
|
|
145
146
|
date: string;
|
|
146
147
|
api_requests: Generated<number>;
|
|
147
148
|
deliveries: Generated<number>;
|
|
149
|
+
streams_events_returned: Generated<number>;
|
|
150
|
+
index_decoded_events_returned: Generated<number>;
|
|
148
151
|
}
|
|
149
152
|
interface UsageSnapshotsTable {
|
|
150
153
|
id: Generated<string>;
|
|
@@ -273,6 +276,44 @@ interface ProcessedStripeEventsTable {
|
|
|
273
276
|
event_type: string;
|
|
274
277
|
processed_at: Generated<Date>;
|
|
275
278
|
}
|
|
279
|
+
interface DecodedEventsTable {
|
|
280
|
+
cursor: string;
|
|
281
|
+
block_height: number;
|
|
282
|
+
tx_id: string;
|
|
283
|
+
tx_index: number;
|
|
284
|
+
event_index: number;
|
|
285
|
+
event_type: string;
|
|
286
|
+
microblock_hash: string | null;
|
|
287
|
+
canonical: Generated<boolean>;
|
|
288
|
+
contract_id: string | null;
|
|
289
|
+
sender: string | null;
|
|
290
|
+
recipient: string | null;
|
|
291
|
+
amount: string | null;
|
|
292
|
+
asset_identifier: string | null;
|
|
293
|
+
value: string | null;
|
|
294
|
+
memo: string | null;
|
|
295
|
+
source_cursor: string;
|
|
296
|
+
created_at: Generated<Date>;
|
|
297
|
+
}
|
|
298
|
+
interface L2DecoderCheckpointsTable {
|
|
299
|
+
decoder_name: string;
|
|
300
|
+
last_cursor: string | null;
|
|
301
|
+
updated_at: Generated<Date>;
|
|
302
|
+
}
|
|
303
|
+
interface ChainReorgsTable {
|
|
304
|
+
id: Generated<string>;
|
|
305
|
+
detected_at: Generated<Date>;
|
|
306
|
+
fork_point_height: number;
|
|
307
|
+
old_index_block_hash: string | null;
|
|
308
|
+
new_index_block_hash: string | null;
|
|
309
|
+
orphaned_from_height: number;
|
|
310
|
+
orphaned_from_event_index: number;
|
|
311
|
+
orphaned_to_height: number;
|
|
312
|
+
orphaned_to_event_index: number;
|
|
313
|
+
new_canonical_height: number;
|
|
314
|
+
new_canonical_event_index: number;
|
|
315
|
+
created_at: Generated<Date>;
|
|
316
|
+
}
|
|
276
317
|
interface Database {
|
|
277
318
|
blocks: BlocksTable;
|
|
278
319
|
transactions: TransactionsTable;
|
|
@@ -308,6 +349,9 @@ interface Database {
|
|
|
308
349
|
subscriptions: SubscriptionsTable;
|
|
309
350
|
subscription_outbox: SubscriptionOutboxTable;
|
|
310
351
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
352
|
+
decoded_events: DecodedEventsTable;
|
|
353
|
+
l2_decoder_checkpoints: L2DecoderCheckpointsTable;
|
|
354
|
+
chain_reorgs: ChainReorgsTable;
|
|
311
355
|
}
|
|
312
356
|
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
313
357
|
interface TenantsTable {
|
|
@@ -5,6 +5,7 @@ interface BlocksTable {
|
|
|
5
5
|
hash: string;
|
|
6
6
|
parent_hash: string;
|
|
7
7
|
burn_block_height: number;
|
|
8
|
+
burn_block_hash: ColumnType<string | null, string | null | undefined, string | null>;
|
|
8
9
|
timestamp: number;
|
|
9
10
|
canonical: Generated<boolean>;
|
|
10
11
|
created_at: Generated<Date>;
|
|
@@ -145,6 +146,8 @@ interface UsageDailyTable {
|
|
|
145
146
|
date: string;
|
|
146
147
|
api_requests: Generated<number>;
|
|
147
148
|
deliveries: Generated<number>;
|
|
149
|
+
streams_events_returned: Generated<number>;
|
|
150
|
+
index_decoded_events_returned: Generated<number>;
|
|
148
151
|
}
|
|
149
152
|
interface UsageSnapshotsTable {
|
|
150
153
|
id: Generated<string>;
|
|
@@ -273,6 +276,44 @@ interface ProcessedStripeEventsTable {
|
|
|
273
276
|
event_type: string;
|
|
274
277
|
processed_at: Generated<Date>;
|
|
275
278
|
}
|
|
279
|
+
interface DecodedEventsTable {
|
|
280
|
+
cursor: string;
|
|
281
|
+
block_height: number;
|
|
282
|
+
tx_id: string;
|
|
283
|
+
tx_index: number;
|
|
284
|
+
event_index: number;
|
|
285
|
+
event_type: string;
|
|
286
|
+
microblock_hash: string | null;
|
|
287
|
+
canonical: Generated<boolean>;
|
|
288
|
+
contract_id: string | null;
|
|
289
|
+
sender: string | null;
|
|
290
|
+
recipient: string | null;
|
|
291
|
+
amount: string | null;
|
|
292
|
+
asset_identifier: string | null;
|
|
293
|
+
value: string | null;
|
|
294
|
+
memo: string | null;
|
|
295
|
+
source_cursor: string;
|
|
296
|
+
created_at: Generated<Date>;
|
|
297
|
+
}
|
|
298
|
+
interface L2DecoderCheckpointsTable {
|
|
299
|
+
decoder_name: string;
|
|
300
|
+
last_cursor: string | null;
|
|
301
|
+
updated_at: Generated<Date>;
|
|
302
|
+
}
|
|
303
|
+
interface ChainReorgsTable {
|
|
304
|
+
id: Generated<string>;
|
|
305
|
+
detected_at: Generated<Date>;
|
|
306
|
+
fork_point_height: number;
|
|
307
|
+
old_index_block_hash: string | null;
|
|
308
|
+
new_index_block_hash: string | null;
|
|
309
|
+
orphaned_from_height: number;
|
|
310
|
+
orphaned_from_event_index: number;
|
|
311
|
+
orphaned_to_height: number;
|
|
312
|
+
orphaned_to_event_index: number;
|
|
313
|
+
new_canonical_height: number;
|
|
314
|
+
new_canonical_event_index: number;
|
|
315
|
+
created_at: Generated<Date>;
|
|
316
|
+
}
|
|
276
317
|
interface Database {
|
|
277
318
|
blocks: BlocksTable;
|
|
278
319
|
transactions: TransactionsTable;
|
|
@@ -308,6 +349,9 @@ interface Database {
|
|
|
308
349
|
subscriptions: SubscriptionsTable;
|
|
309
350
|
subscription_outbox: SubscriptionOutboxTable;
|
|
310
351
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
352
|
+
decoded_events: DecodedEventsTable;
|
|
353
|
+
l2_decoder_checkpoints: L2DecoderCheckpointsTable;
|
|
354
|
+
chain_reorgs: ChainReorgsTable;
|
|
311
355
|
}
|
|
312
356
|
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
313
357
|
interface TenantsTable {
|
|
@@ -6,6 +6,7 @@ interface BlocksTable {
|
|
|
6
6
|
hash: string;
|
|
7
7
|
parent_hash: string;
|
|
8
8
|
burn_block_height: number;
|
|
9
|
+
burn_block_hash: ColumnType<string | null, string | null | undefined, string | null>;
|
|
9
10
|
timestamp: number;
|
|
10
11
|
canonical: Generated<boolean>;
|
|
11
12
|
created_at: Generated<Date>;
|
|
@@ -146,6 +147,8 @@ interface UsageDailyTable {
|
|
|
146
147
|
date: string;
|
|
147
148
|
api_requests: Generated<number>;
|
|
148
149
|
deliveries: Generated<number>;
|
|
150
|
+
streams_events_returned: Generated<number>;
|
|
151
|
+
index_decoded_events_returned: Generated<number>;
|
|
149
152
|
}
|
|
150
153
|
interface UsageSnapshotsTable {
|
|
151
154
|
id: Generated<string>;
|
|
@@ -274,6 +277,44 @@ interface ProcessedStripeEventsTable {
|
|
|
274
277
|
event_type: string;
|
|
275
278
|
processed_at: Generated<Date>;
|
|
276
279
|
}
|
|
280
|
+
interface DecodedEventsTable {
|
|
281
|
+
cursor: string;
|
|
282
|
+
block_height: number;
|
|
283
|
+
tx_id: string;
|
|
284
|
+
tx_index: number;
|
|
285
|
+
event_index: number;
|
|
286
|
+
event_type: string;
|
|
287
|
+
microblock_hash: string | null;
|
|
288
|
+
canonical: Generated<boolean>;
|
|
289
|
+
contract_id: string | null;
|
|
290
|
+
sender: string | null;
|
|
291
|
+
recipient: string | null;
|
|
292
|
+
amount: string | null;
|
|
293
|
+
asset_identifier: string | null;
|
|
294
|
+
value: string | null;
|
|
295
|
+
memo: string | null;
|
|
296
|
+
source_cursor: string;
|
|
297
|
+
created_at: Generated<Date>;
|
|
298
|
+
}
|
|
299
|
+
interface L2DecoderCheckpointsTable {
|
|
300
|
+
decoder_name: string;
|
|
301
|
+
last_cursor: string | null;
|
|
302
|
+
updated_at: Generated<Date>;
|
|
303
|
+
}
|
|
304
|
+
interface ChainReorgsTable {
|
|
305
|
+
id: Generated<string>;
|
|
306
|
+
detected_at: Generated<Date>;
|
|
307
|
+
fork_point_height: number;
|
|
308
|
+
old_index_block_hash: string | null;
|
|
309
|
+
new_index_block_hash: string | null;
|
|
310
|
+
orphaned_from_height: number;
|
|
311
|
+
orphaned_from_event_index: number;
|
|
312
|
+
orphaned_to_height: number;
|
|
313
|
+
orphaned_to_event_index: number;
|
|
314
|
+
new_canonical_height: number;
|
|
315
|
+
new_canonical_event_index: number;
|
|
316
|
+
created_at: Generated<Date>;
|
|
317
|
+
}
|
|
277
318
|
interface Database {
|
|
278
319
|
blocks: BlocksTable;
|
|
279
320
|
transactions: TransactionsTable;
|
|
@@ -309,6 +350,9 @@ interface Database {
|
|
|
309
350
|
subscriptions: SubscriptionsTable;
|
|
310
351
|
subscription_outbox: SubscriptionOutboxTable;
|
|
311
352
|
subscription_deliveries: SubscriptionDeliveriesTable;
|
|
353
|
+
decoded_events: DecodedEventsTable;
|
|
354
|
+
l2_decoder_checkpoints: L2DecoderCheckpointsTable;
|
|
355
|
+
chain_reorgs: ChainReorgsTable;
|
|
312
356
|
}
|
|
313
357
|
type TenantStatus = "provisioning" | "active" | "limit_warning" | "paused_limit" | "suspended" | "error" | "deleted";
|
|
314
358
|
interface TenantsTable {
|