@secondlayer/shared 0.10.2 → 0.12.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 +180 -2
- package/dist/src/db/queries/accounts.d.ts +157 -2
- package/dist/src/db/queries/accounts.js +17 -1
- package/dist/src/db/queries/accounts.js.map +3 -3
- package/dist/src/db/queries/integrity.d.ts +150 -1
- package/dist/src/db/queries/marketplace.d.ts +464 -0
- package/dist/src/db/queries/marketplace.js +142 -0
- package/dist/src/db/queries/marketplace.js.map +10 -0
- package/dist/src/db/queries/metrics.d.ts +150 -1
- package/dist/src/db/queries/projects.d.ts +424 -0
- package/dist/src/db/queries/projects.js +47 -0
- package/dist/src/db/queries/projects.js.map +10 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +150 -1
- package/dist/src/db/queries/subgraphs.d.ts +158 -6
- package/dist/src/db/queries/subgraphs.js +18 -13
- package/dist/src/db/queries/subgraphs.js.map +3 -3
- package/dist/src/db/queries/usage.d.ts +150 -1
- package/dist/src/db/queries/workflows.d.ts +440 -0
- package/dist/src/db/queries/workflows.js +115 -0
- package/dist/src/db/queries/workflows.js.map +11 -0
- package/dist/src/db/schema.d.ts +180 -2
- package/dist/src/index.d.ts +258 -10
- package/dist/src/index.js +91 -72
- package/dist/src/index.js.map +5 -4
- package/dist/src/node/local-client.d.ts +150 -1
- package/dist/src/schemas/index.d.ts +79 -9
- package/dist/src/schemas/index.js +93 -74
- package/dist/src/schemas/index.js.map +5 -4
- package/dist/src/schemas/marketplace.d.ts +63 -0
- package/dist/src/schemas/marketplace.js +39 -0
- package/dist/src/schemas/marketplace.js.map +10 -0
- package/dist/src/schemas/subgraphs.d.ts +8 -0
- package/dist/src/schemas/subgraphs.js.map +2 -2
- package/dist/src/schemas/workflows.d.ts +66 -0
- package/dist/src/schemas/workflows.js +39 -0
- package/dist/src/schemas/workflows.js.map +10 -0
- package/dist/src/types.d.ts +1 -0
- package/migrations/0022_marketplace.ts +88 -0
- package/migrations/0023_projects.ts +149 -0
- package/migrations/0024_chat_sessions.ts +51 -0
- package/migrations/0025_chat_session_summary.ts +15 -0
- package/migrations/0026_workflows.ts +204 -0
- package/migrations/0027_workflow_cursors.ts +16 -0
- package/migrations/0028_subgraph_account_scoping.ts +116 -0
- package/migrations/0029_subgraph_handler_code.ts +23 -0
- package/package.json +22 -2
package/dist/src/db/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ interface StreamsTable {
|
|
|
55
55
|
endpoint_url: string;
|
|
56
56
|
signing_secret: string | null;
|
|
57
57
|
api_key_id: string;
|
|
58
|
+
project_id: string | null;
|
|
58
59
|
created_at: Generated<Date>;
|
|
59
60
|
updated_at: Generated<Date>;
|
|
60
61
|
}
|
|
@@ -116,7 +117,14 @@ interface SubgraphsTable {
|
|
|
116
117
|
last_error_at: Date | null;
|
|
117
118
|
total_processed: Generated<number>;
|
|
118
119
|
total_errors: Generated<number>;
|
|
119
|
-
api_key_id: string;
|
|
120
|
+
api_key_id: string | null;
|
|
121
|
+
account_id: string;
|
|
122
|
+
handler_code: string | null;
|
|
123
|
+
project_id: string | null;
|
|
124
|
+
is_public: Generated<boolean>;
|
|
125
|
+
tags: Generated<string[]>;
|
|
126
|
+
description: string | null;
|
|
127
|
+
forked_from_id: string | null;
|
|
120
128
|
created_at: Generated<Date>;
|
|
121
129
|
updated_at: Generated<Date>;
|
|
122
130
|
}
|
|
@@ -147,6 +155,10 @@ interface AccountsTable {
|
|
|
147
155
|
id: Generated<string>;
|
|
148
156
|
email: string;
|
|
149
157
|
plan: Generated<string>;
|
|
158
|
+
display_name: string | null;
|
|
159
|
+
bio: string | null;
|
|
160
|
+
avatar_url: string | null;
|
|
161
|
+
slug: string | null;
|
|
150
162
|
created_at: Generated<Date>;
|
|
151
163
|
}
|
|
152
164
|
interface SessionsTable {
|
|
@@ -247,6 +259,131 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
247
259
|
last_processed_block: number | null;
|
|
248
260
|
captured_at: Generated<Date>;
|
|
249
261
|
}
|
|
262
|
+
interface SubgraphUsageDailyTable {
|
|
263
|
+
subgraph_id: string;
|
|
264
|
+
date: string;
|
|
265
|
+
query_count: Generated<number>;
|
|
266
|
+
}
|
|
267
|
+
interface ProjectsTable {
|
|
268
|
+
id: Generated<string>;
|
|
269
|
+
name: string;
|
|
270
|
+
slug: string;
|
|
271
|
+
account_id: string;
|
|
272
|
+
settings: Generated<Record<string, unknown>>;
|
|
273
|
+
network: Generated<string>;
|
|
274
|
+
node_rpc: string | null;
|
|
275
|
+
created_at: Generated<Date>;
|
|
276
|
+
updated_at: Generated<Date>;
|
|
277
|
+
}
|
|
278
|
+
interface TeamMembersTable {
|
|
279
|
+
id: Generated<string>;
|
|
280
|
+
project_id: string;
|
|
281
|
+
account_id: string;
|
|
282
|
+
role: Generated<string>;
|
|
283
|
+
invited_by: string | null;
|
|
284
|
+
created_at: Generated<Date>;
|
|
285
|
+
}
|
|
286
|
+
interface TeamInvitationsTable {
|
|
287
|
+
id: Generated<string>;
|
|
288
|
+
project_id: string;
|
|
289
|
+
email: string;
|
|
290
|
+
role: Generated<string>;
|
|
291
|
+
token: string;
|
|
292
|
+
invited_by: string | null;
|
|
293
|
+
expires_at: Date;
|
|
294
|
+
accepted_at: Date | null;
|
|
295
|
+
created_at: Generated<Date>;
|
|
296
|
+
}
|
|
297
|
+
interface ChatSessionsTable {
|
|
298
|
+
id: Generated<string>;
|
|
299
|
+
account_id: string;
|
|
300
|
+
title: string | null;
|
|
301
|
+
summary: unknown | null;
|
|
302
|
+
created_at: Generated<Date>;
|
|
303
|
+
updated_at: Generated<Date>;
|
|
304
|
+
}
|
|
305
|
+
interface ChatMessagesTable {
|
|
306
|
+
id: Generated<string>;
|
|
307
|
+
chat_session_id: string;
|
|
308
|
+
role: string;
|
|
309
|
+
parts: unknown;
|
|
310
|
+
metadata: unknown | null;
|
|
311
|
+
created_at: Generated<Date>;
|
|
312
|
+
}
|
|
313
|
+
interface WorkflowDefinitionsTable {
|
|
314
|
+
id: Generated<string>;
|
|
315
|
+
name: string;
|
|
316
|
+
version: Generated<string>;
|
|
317
|
+
status: Generated<string>;
|
|
318
|
+
trigger_type: string;
|
|
319
|
+
trigger_config: unknown;
|
|
320
|
+
handler_path: string;
|
|
321
|
+
retries_config: unknown | null;
|
|
322
|
+
timeout_ms: number | null;
|
|
323
|
+
api_key_id: string;
|
|
324
|
+
project_id: string | null;
|
|
325
|
+
created_at: Generated<Date>;
|
|
326
|
+
updated_at: Generated<Date>;
|
|
327
|
+
}
|
|
328
|
+
interface WorkflowRunsTable {
|
|
329
|
+
id: Generated<string>;
|
|
330
|
+
definition_id: string;
|
|
331
|
+
status: Generated<string>;
|
|
332
|
+
trigger_type: string;
|
|
333
|
+
trigger_data: unknown | null;
|
|
334
|
+
dedup_key: string | null;
|
|
335
|
+
error: string | null;
|
|
336
|
+
started_at: Date | null;
|
|
337
|
+
completed_at: Date | null;
|
|
338
|
+
duration_ms: number | null;
|
|
339
|
+
total_ai_tokens: Generated<number>;
|
|
340
|
+
created_at: Generated<Date>;
|
|
341
|
+
}
|
|
342
|
+
interface WorkflowStepsTable {
|
|
343
|
+
id: Generated<string>;
|
|
344
|
+
run_id: string;
|
|
345
|
+
step_index: number;
|
|
346
|
+
step_id: string;
|
|
347
|
+
step_type: string;
|
|
348
|
+
status: Generated<string>;
|
|
349
|
+
input: unknown | null;
|
|
350
|
+
output: unknown | null;
|
|
351
|
+
error: string | null;
|
|
352
|
+
retry_count: Generated<number>;
|
|
353
|
+
ai_tokens_used: Generated<number>;
|
|
354
|
+
started_at: Date | null;
|
|
355
|
+
completed_at: Date | null;
|
|
356
|
+
duration_ms: number | null;
|
|
357
|
+
created_at: Generated<Date>;
|
|
358
|
+
}
|
|
359
|
+
interface WorkflowQueueTable {
|
|
360
|
+
id: Generated<string>;
|
|
361
|
+
run_id: string;
|
|
362
|
+
status: Generated<string>;
|
|
363
|
+
attempts: Generated<number>;
|
|
364
|
+
max_attempts: Generated<number>;
|
|
365
|
+
scheduled_for: Generated<Date>;
|
|
366
|
+
locked_at: Date | null;
|
|
367
|
+
locked_by: string | null;
|
|
368
|
+
error: string | null;
|
|
369
|
+
created_at: Generated<Date>;
|
|
370
|
+
completed_at: Date | null;
|
|
371
|
+
}
|
|
372
|
+
interface WorkflowSchedulesTable {
|
|
373
|
+
id: Generated<string>;
|
|
374
|
+
definition_id: string;
|
|
375
|
+
cron_expr: string;
|
|
376
|
+
timezone: Generated<string>;
|
|
377
|
+
next_run_at: Date;
|
|
378
|
+
last_run_at: Date | null;
|
|
379
|
+
enabled: Generated<boolean>;
|
|
380
|
+
created_at: Generated<Date>;
|
|
381
|
+
}
|
|
382
|
+
interface WorkflowCursorsTable {
|
|
383
|
+
name: string;
|
|
384
|
+
block_height: Generated<number>;
|
|
385
|
+
updated_at: Generated<Date>;
|
|
386
|
+
}
|
|
250
387
|
interface Database {
|
|
251
388
|
blocks: BlocksTable;
|
|
252
389
|
transactions: TransactionsTable;
|
|
@@ -270,6 +407,18 @@ interface Database {
|
|
|
270
407
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
271
408
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
272
409
|
subgraph_gaps: SubgraphGapsTable;
|
|
410
|
+
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
411
|
+
projects: ProjectsTable;
|
|
412
|
+
team_members: TeamMembersTable;
|
|
413
|
+
team_invitations: TeamInvitationsTable;
|
|
414
|
+
chat_sessions: ChatSessionsTable;
|
|
415
|
+
chat_messages: ChatMessagesTable;
|
|
416
|
+
workflow_definitions: WorkflowDefinitionsTable;
|
|
417
|
+
workflow_runs: WorkflowRunsTable;
|
|
418
|
+
workflow_steps: WorkflowStepsTable;
|
|
419
|
+
workflow_queue: WorkflowQueueTable;
|
|
420
|
+
workflow_schedules: WorkflowSchedulesTable;
|
|
421
|
+
workflow_cursors: WorkflowCursorsTable;
|
|
273
422
|
}
|
|
274
423
|
type Block = Selectable<BlocksTable>;
|
|
275
424
|
type InsertBlock = Insertable<BlocksTable>;
|
|
@@ -317,10 +466,39 @@ type SubgraphHealthSnapshot = Selectable<SubgraphHealthSnapshotsTable>;
|
|
|
317
466
|
type InsertSubgraphHealthSnapshot = Insertable<SubgraphHealthSnapshotsTable>;
|
|
318
467
|
type SubgraphGap = Selectable<SubgraphGapsTable>;
|
|
319
468
|
type InsertSubgraphGap = Insertable<SubgraphGapsTable>;
|
|
469
|
+
type SubgraphUsageDaily = Selectable<SubgraphUsageDailyTable>;
|
|
470
|
+
type InsertSubgraphUsageDaily = Insertable<SubgraphUsageDailyTable>;
|
|
471
|
+
type WorkflowDefinition = Selectable<WorkflowDefinitionsTable>;
|
|
472
|
+
type InsertWorkflowDefinition = Insertable<WorkflowDefinitionsTable>;
|
|
473
|
+
type UpdateWorkflowDefinition = Updateable<WorkflowDefinitionsTable>;
|
|
474
|
+
type WorkflowRun = Selectable<WorkflowRunsTable>;
|
|
475
|
+
type InsertWorkflowRun = Insertable<WorkflowRunsTable>;
|
|
476
|
+
type UpdateWorkflowRun = Updateable<WorkflowRunsTable>;
|
|
477
|
+
type WorkflowStep = Selectable<WorkflowStepsTable>;
|
|
478
|
+
type InsertWorkflowStep = Insertable<WorkflowStepsTable>;
|
|
479
|
+
type UpdateWorkflowStep = Updateable<WorkflowStepsTable>;
|
|
480
|
+
type WorkflowQueueItem = Selectable<WorkflowQueueTable>;
|
|
481
|
+
type InsertWorkflowQueueItem = Insertable<WorkflowQueueTable>;
|
|
482
|
+
type WorkflowSchedule = Selectable<WorkflowSchedulesTable>;
|
|
483
|
+
type InsertWorkflowSchedule = Insertable<WorkflowSchedulesTable>;
|
|
484
|
+
type UpdateWorkflowSchedule = Updateable<WorkflowSchedulesTable>;
|
|
485
|
+
type WorkflowCursor = Selectable<WorkflowCursorsTable>;
|
|
486
|
+
type Project = Selectable<ProjectsTable>;
|
|
487
|
+
type InsertProject = Insertable<ProjectsTable>;
|
|
488
|
+
type UpdateProject = Updateable<ProjectsTable>;
|
|
489
|
+
type TeamMember = Selectable<TeamMembersTable>;
|
|
490
|
+
type InsertTeamMember = Insertable<TeamMembersTable>;
|
|
491
|
+
type TeamInvitation = Selectable<TeamInvitationsTable>;
|
|
492
|
+
type InsertTeamInvitation = Insertable<TeamInvitationsTable>;
|
|
493
|
+
type ChatSession = Selectable<ChatSessionsTable>;
|
|
494
|
+
type InsertChatSession = Insertable<ChatSessionsTable>;
|
|
495
|
+
type UpdateChatSession = Updateable<ChatSessionsTable>;
|
|
496
|
+
type ChatMessage = Selectable<ChatMessagesTable>;
|
|
497
|
+
type InsertChatMessage = Insertable<ChatMessagesTable>;
|
|
320
498
|
import { sql } from "kysely";
|
|
321
499
|
declare function getDb(connectionString?: string): Kysely<Database>;
|
|
322
500
|
/** Raw postgres.js client for dynamic schema DDL (CREATE SCHEMA, DROP, etc.) */
|
|
323
501
|
declare function getRawClient(): ReturnType<typeof postgres>;
|
|
324
502
|
/** Close the DB connection pool. Call in CLI commands to allow process exit. */
|
|
325
503
|
declare function closeDb(): Promise<void>;
|
|
326
|
-
export { sql, parseJsonb, jsonb, getRawClient, getDb, closeDb, WaitlistTable, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateTransaction, UpdateSubgraph, UpdateStreamRow, UpdateStreamMetrics, UpdateJob, UpdateIndexProgress, UpdateEvent, UpdateDelivery, UpdateBlock, UpdateApiKey, TransactionsTable, Transaction, SubgraphsTable, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, StreamsTable, StreamMetricsTable, StreamMetrics, Stream, SessionsTable, Session, MagicLinksTable, MagicLink, JobsTable, Job, InsertTransaction, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertStreamMetrics, InsertStream, InsertSession, InsertMagicLink, InsertJob, InsertIndexProgress, InsertEvent, InsertDelivery, InsertBlock, InsertApiKey, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, Event, Delivery, DeliveriesTable, Database, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
|
|
504
|
+
export { sql, parseJsonb, jsonb, getRawClient, getDb, closeDb, WorkflowStepsTable, WorkflowStep, WorkflowSchedulesTable, WorkflowSchedule, WorkflowRunsTable, WorkflowRun, WorkflowQueueTable, WorkflowQueueItem, WorkflowDefinitionsTable, WorkflowDefinition, WorkflowCursorsTable, WorkflowCursor, WaitlistTable, UsageSnapshotsTable, UsageSnapshot, UsageDailyTable, UsageDaily, UpdateWorkflowStep, UpdateWorkflowSchedule, UpdateWorkflowRun, UpdateWorkflowDefinition, UpdateTransaction, UpdateSubgraph, UpdateStreamRow, UpdateStreamMetrics, UpdateProject, UpdateJob, UpdateIndexProgress, UpdateEvent, UpdateDelivery, UpdateChatSession, UpdateBlock, UpdateApiKey, TransactionsTable, Transaction, TeamMembersTable, TeamMember, TeamInvitationsTable, TeamInvitation, SubgraphsTable, SubgraphUsageDailyTable, SubgraphUsageDaily, SubgraphTableSnapshotsTable, SubgraphProcessingStatsTable, SubgraphHealthSnapshotsTable, SubgraphHealthSnapshot, SubgraphGapsTable, SubgraphGap, Subgraph, StreamsTable, StreamMetricsTable, StreamMetrics, Stream, SessionsTable, Session, ProjectsTable, Project, MagicLinksTable, MagicLink, JobsTable, Job, InsertWorkflowStep, InsertWorkflowSchedule, InsertWorkflowRun, InsertWorkflowQueueItem, InsertWorkflowDefinition, InsertTransaction, InsertTeamMember, InsertTeamInvitation, InsertSubgraphUsageDaily, InsertSubgraphHealthSnapshot, InsertSubgraphGap, InsertSubgraph, InsertStreamMetrics, InsertStream, InsertSession, InsertProject, InsertMagicLink, InsertJob, InsertIndexProgress, InsertEvent, InsertDelivery, InsertChatSession, InsertChatMessage, InsertBlock, InsertApiKey, InsertAccountInsight, InsertAccountAgentRun, InsertAccount, IndexProgressTable, IndexProgress, EventsTable, Event, Delivery, DeliveriesTable, Database, ChatSessionsTable, ChatSession, ChatMessagesTable, ChatMessage, BlocksTable, Block, ApiKeysTable, ApiKey, AccountsTable, AccountInsightsTable, AccountInsight, AccountAgentRunsTable, AccountAgentRun, Account };
|
|
@@ -41,6 +41,7 @@ interface StreamsTable {
|
|
|
41
41
|
endpoint_url: string;
|
|
42
42
|
signing_secret: string | null;
|
|
43
43
|
api_key_id: string;
|
|
44
|
+
project_id: string | null;
|
|
44
45
|
created_at: Generated<Date>;
|
|
45
46
|
updated_at: Generated<Date>;
|
|
46
47
|
}
|
|
@@ -102,7 +103,14 @@ interface SubgraphsTable {
|
|
|
102
103
|
last_error_at: Date | null;
|
|
103
104
|
total_processed: Generated<number>;
|
|
104
105
|
total_errors: Generated<number>;
|
|
105
|
-
api_key_id: string;
|
|
106
|
+
api_key_id: string | null;
|
|
107
|
+
account_id: string;
|
|
108
|
+
handler_code: string | null;
|
|
109
|
+
project_id: string | null;
|
|
110
|
+
is_public: Generated<boolean>;
|
|
111
|
+
tags: Generated<string[]>;
|
|
112
|
+
description: string | null;
|
|
113
|
+
forked_from_id: string | null;
|
|
106
114
|
created_at: Generated<Date>;
|
|
107
115
|
updated_at: Generated<Date>;
|
|
108
116
|
}
|
|
@@ -133,6 +141,10 @@ interface AccountsTable {
|
|
|
133
141
|
id: Generated<string>;
|
|
134
142
|
email: string;
|
|
135
143
|
plan: Generated<string>;
|
|
144
|
+
display_name: string | null;
|
|
145
|
+
bio: string | null;
|
|
146
|
+
avatar_url: string | null;
|
|
147
|
+
slug: string | null;
|
|
136
148
|
created_at: Generated<Date>;
|
|
137
149
|
}
|
|
138
150
|
interface SessionsTable {
|
|
@@ -233,6 +245,131 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
233
245
|
last_processed_block: number | null;
|
|
234
246
|
captured_at: Generated<Date>;
|
|
235
247
|
}
|
|
248
|
+
interface SubgraphUsageDailyTable {
|
|
249
|
+
subgraph_id: string;
|
|
250
|
+
date: string;
|
|
251
|
+
query_count: Generated<number>;
|
|
252
|
+
}
|
|
253
|
+
interface ProjectsTable {
|
|
254
|
+
id: Generated<string>;
|
|
255
|
+
name: string;
|
|
256
|
+
slug: string;
|
|
257
|
+
account_id: string;
|
|
258
|
+
settings: Generated<Record<string, unknown>>;
|
|
259
|
+
network: Generated<string>;
|
|
260
|
+
node_rpc: string | null;
|
|
261
|
+
created_at: Generated<Date>;
|
|
262
|
+
updated_at: Generated<Date>;
|
|
263
|
+
}
|
|
264
|
+
interface TeamMembersTable {
|
|
265
|
+
id: Generated<string>;
|
|
266
|
+
project_id: string;
|
|
267
|
+
account_id: string;
|
|
268
|
+
role: Generated<string>;
|
|
269
|
+
invited_by: string | null;
|
|
270
|
+
created_at: Generated<Date>;
|
|
271
|
+
}
|
|
272
|
+
interface TeamInvitationsTable {
|
|
273
|
+
id: Generated<string>;
|
|
274
|
+
project_id: string;
|
|
275
|
+
email: string;
|
|
276
|
+
role: Generated<string>;
|
|
277
|
+
token: string;
|
|
278
|
+
invited_by: string | null;
|
|
279
|
+
expires_at: Date;
|
|
280
|
+
accepted_at: Date | null;
|
|
281
|
+
created_at: Generated<Date>;
|
|
282
|
+
}
|
|
283
|
+
interface ChatSessionsTable {
|
|
284
|
+
id: Generated<string>;
|
|
285
|
+
account_id: string;
|
|
286
|
+
title: string | null;
|
|
287
|
+
summary: unknown | null;
|
|
288
|
+
created_at: Generated<Date>;
|
|
289
|
+
updated_at: Generated<Date>;
|
|
290
|
+
}
|
|
291
|
+
interface ChatMessagesTable {
|
|
292
|
+
id: Generated<string>;
|
|
293
|
+
chat_session_id: string;
|
|
294
|
+
role: string;
|
|
295
|
+
parts: unknown;
|
|
296
|
+
metadata: unknown | null;
|
|
297
|
+
created_at: Generated<Date>;
|
|
298
|
+
}
|
|
299
|
+
interface WorkflowDefinitionsTable {
|
|
300
|
+
id: Generated<string>;
|
|
301
|
+
name: string;
|
|
302
|
+
version: Generated<string>;
|
|
303
|
+
status: Generated<string>;
|
|
304
|
+
trigger_type: string;
|
|
305
|
+
trigger_config: unknown;
|
|
306
|
+
handler_path: string;
|
|
307
|
+
retries_config: unknown | null;
|
|
308
|
+
timeout_ms: number | null;
|
|
309
|
+
api_key_id: string;
|
|
310
|
+
project_id: string | null;
|
|
311
|
+
created_at: Generated<Date>;
|
|
312
|
+
updated_at: Generated<Date>;
|
|
313
|
+
}
|
|
314
|
+
interface WorkflowRunsTable {
|
|
315
|
+
id: Generated<string>;
|
|
316
|
+
definition_id: string;
|
|
317
|
+
status: Generated<string>;
|
|
318
|
+
trigger_type: string;
|
|
319
|
+
trigger_data: unknown | null;
|
|
320
|
+
dedup_key: string | null;
|
|
321
|
+
error: string | null;
|
|
322
|
+
started_at: Date | null;
|
|
323
|
+
completed_at: Date | null;
|
|
324
|
+
duration_ms: number | null;
|
|
325
|
+
total_ai_tokens: Generated<number>;
|
|
326
|
+
created_at: Generated<Date>;
|
|
327
|
+
}
|
|
328
|
+
interface WorkflowStepsTable {
|
|
329
|
+
id: Generated<string>;
|
|
330
|
+
run_id: string;
|
|
331
|
+
step_index: number;
|
|
332
|
+
step_id: string;
|
|
333
|
+
step_type: string;
|
|
334
|
+
status: Generated<string>;
|
|
335
|
+
input: unknown | null;
|
|
336
|
+
output: unknown | null;
|
|
337
|
+
error: string | null;
|
|
338
|
+
retry_count: Generated<number>;
|
|
339
|
+
ai_tokens_used: Generated<number>;
|
|
340
|
+
started_at: Date | null;
|
|
341
|
+
completed_at: Date | null;
|
|
342
|
+
duration_ms: number | null;
|
|
343
|
+
created_at: Generated<Date>;
|
|
344
|
+
}
|
|
345
|
+
interface WorkflowQueueTable {
|
|
346
|
+
id: Generated<string>;
|
|
347
|
+
run_id: string;
|
|
348
|
+
status: Generated<string>;
|
|
349
|
+
attempts: Generated<number>;
|
|
350
|
+
max_attempts: Generated<number>;
|
|
351
|
+
scheduled_for: Generated<Date>;
|
|
352
|
+
locked_at: Date | null;
|
|
353
|
+
locked_by: string | null;
|
|
354
|
+
error: string | null;
|
|
355
|
+
created_at: Generated<Date>;
|
|
356
|
+
completed_at: Date | null;
|
|
357
|
+
}
|
|
358
|
+
interface WorkflowSchedulesTable {
|
|
359
|
+
id: Generated<string>;
|
|
360
|
+
definition_id: string;
|
|
361
|
+
cron_expr: string;
|
|
362
|
+
timezone: Generated<string>;
|
|
363
|
+
next_run_at: Date;
|
|
364
|
+
last_run_at: Date | null;
|
|
365
|
+
enabled: Generated<boolean>;
|
|
366
|
+
created_at: Generated<Date>;
|
|
367
|
+
}
|
|
368
|
+
interface WorkflowCursorsTable {
|
|
369
|
+
name: string;
|
|
370
|
+
block_height: Generated<number>;
|
|
371
|
+
updated_at: Generated<Date>;
|
|
372
|
+
}
|
|
236
373
|
interface Database {
|
|
237
374
|
blocks: BlocksTable;
|
|
238
375
|
transactions: TransactionsTable;
|
|
@@ -256,10 +393,28 @@ interface Database {
|
|
|
256
393
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
257
394
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
258
395
|
subgraph_gaps: SubgraphGapsTable;
|
|
396
|
+
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
397
|
+
projects: ProjectsTable;
|
|
398
|
+
team_members: TeamMembersTable;
|
|
399
|
+
team_invitations: TeamInvitationsTable;
|
|
400
|
+
chat_sessions: ChatSessionsTable;
|
|
401
|
+
chat_messages: ChatMessagesTable;
|
|
402
|
+
workflow_definitions: WorkflowDefinitionsTable;
|
|
403
|
+
workflow_runs: WorkflowRunsTable;
|
|
404
|
+
workflow_steps: WorkflowStepsTable;
|
|
405
|
+
workflow_queue: WorkflowQueueTable;
|
|
406
|
+
workflow_schedules: WorkflowSchedulesTable;
|
|
407
|
+
workflow_cursors: WorkflowCursorsTable;
|
|
259
408
|
}
|
|
260
409
|
type Account = Selectable<AccountsTable>;
|
|
261
410
|
declare function upsertAccount(db: Kysely<Database>, email: string): Promise<Account>;
|
|
262
411
|
declare function getAccountById(db: Kysely<Database>, id: string): Promise<Account | null>;
|
|
412
|
+
declare function updateAccountProfile(db: Kysely<Database>, id: string, data: {
|
|
413
|
+
display_name?: string
|
|
414
|
+
bio?: string
|
|
415
|
+
slug?: string
|
|
416
|
+
}): Promise<Account>;
|
|
417
|
+
declare function isSlugTaken(db: Kysely<Database>, slug: string, excludeAccountId: string): Promise<boolean>;
|
|
263
418
|
declare function isEmailAllowed(db: Kysely<Database>, email: string): Promise<boolean>;
|
|
264
419
|
declare function createMagicLink(db: Kysely<Database>, email: string, token: string, code: string, expiresInMs?: number): Promise<void>;
|
|
265
420
|
/**
|
|
@@ -273,4 +428,4 @@ declare function verifyMagicLink(db: Kysely<Database>, token: string): Promise<s
|
|
|
273
428
|
* active codes for this email on failure (prevents parallel brute-force).
|
|
274
429
|
*/
|
|
275
430
|
declare function verifyMagicLinkByCode(db: Kysely<Database>, email: string, code: string): Promise<string | null>;
|
|
276
|
-
export { verifyMagicLinkByCode, verifyMagicLink, upsertAccount, isEmailAllowed, getAccountById, createMagicLink };
|
|
431
|
+
export { verifyMagicLinkByCode, verifyMagicLink, upsertAccount, updateAccountProfile, isSlugTaken, isEmailAllowed, getAccountById, createMagicLink };
|
|
@@ -22,6 +22,20 @@ async function upsertAccount(db, email) {
|
|
|
22
22
|
async function getAccountById(db, id) {
|
|
23
23
|
return await db.selectFrom("accounts").selectAll().where("id", "=", id).executeTakeFirst() ?? null;
|
|
24
24
|
}
|
|
25
|
+
async function updateAccountProfile(db, id, data) {
|
|
26
|
+
const set = {};
|
|
27
|
+
if (data.display_name !== undefined)
|
|
28
|
+
set.display_name = data.display_name;
|
|
29
|
+
if (data.bio !== undefined)
|
|
30
|
+
set.bio = data.bio;
|
|
31
|
+
if (data.slug !== undefined)
|
|
32
|
+
set.slug = data.slug;
|
|
33
|
+
return db.updateTable("accounts").set(set).where("id", "=", id).returningAll().executeTakeFirstOrThrow();
|
|
34
|
+
}
|
|
35
|
+
async function isSlugTaken(db, slug, excludeAccountId) {
|
|
36
|
+
const row = await db.selectFrom("accounts").select("id").where("slug", "=", slug).where("id", "!=", excludeAccountId).executeTakeFirst();
|
|
37
|
+
return !!row;
|
|
38
|
+
}
|
|
25
39
|
async function isEmailAllowed(db, email) {
|
|
26
40
|
const result = await sql`
|
|
27
41
|
SELECT 1 AS found FROM accounts WHERE email = ${email}
|
|
@@ -57,10 +71,12 @@ export {
|
|
|
57
71
|
verifyMagicLinkByCode,
|
|
58
72
|
verifyMagicLink,
|
|
59
73
|
upsertAccount,
|
|
74
|
+
updateAccountProfile,
|
|
75
|
+
isSlugTaken,
|
|
60
76
|
isEmailAllowed,
|
|
61
77
|
getAccountById,
|
|
62
78
|
createMagicLink
|
|
63
79
|
};
|
|
64
80
|
|
|
65
|
-
//# debugId=
|
|
81
|
+
//# debugId=8E5E398F014808DA64756E2164756E21
|
|
66
82
|
//# sourceMappingURL=accounts.js.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/db/queries/accounts.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { type Kysely, sql } from \"kysely\";\nimport type { Account, Database } from \"../types.ts\";\n\nexport async function upsertAccount(\n\tdb: Kysely<Database>,\n\temail: string,\n): Promise<Account> {\n\treturn await db\n\t\t.insertInto(\"accounts\")\n\t\t.values({ email })\n\t\t.onConflict(\n\t\t\t(oc) => oc.column(\"email\").doUpdateSet({ email }), // no-op update to return existing\n\t\t)\n\t\t.returningAll()\n\t\t.executeTakeFirstOrThrow();\n}\n\nexport async function getAccountById(\n\tdb: Kysely<Database>,\n\tid: string,\n): Promise<Account | null> {\n\treturn (\n\t\t(await db\n\t\t\t.selectFrom(\"accounts\")\n\t\t\t.selectAll()\n\t\t\t.where(\"id\", \"=\", id)\n\t\t\t.executeTakeFirst()) ?? null\n\t);\n}\n\nexport async function isEmailAllowed(\n\tdb: Kysely<Database>,\n\temail: string,\n): Promise<boolean> {\n\tconst result = await sql<{ found: number }>`\n SELECT 1 AS found FROM accounts WHERE email = ${email}\n UNION ALL\n SELECT 1 AS found FROM waitlist WHERE email = ${email} AND status = 'approved'\n LIMIT 1\n `.execute(db);\n\n\treturn result.rows.length > 0;\n}\n\nexport async function createMagicLink(\n\tdb: Kysely<Database>,\n\temail: string,\n\ttoken: string,\n\tcode: string,\n\texpiresInMs: number = 15 * 60 * 1000,\n): Promise<void> {\n\tawait db\n\t\t.insertInto(\"magic_links\")\n\t\t.values({\n\t\t\temail,\n\t\t\ttoken,\n\t\t\tcode,\n\t\t\texpires_at: new Date(Date.now() + expiresInMs),\n\t\t})\n\t\t.execute();\n}\n\n/**\n * Verify a magic link token. Returns the email if valid, null otherwise.\n * Marks the token as used atomically. Rejects after 3 failed attempts.\n */\nexport async function verifyMagicLink(\n\tdb: Kysely<Database>,\n\ttoken: string,\n): Promise<string | null> {\n\tconst result = await db\n\t\t.updateTable(\"magic_links\")\n\t\t.set({ used_at: new Date() })\n\t\t.where(\"token\", \"=\", token)\n\t\t.where(\"used_at\", \"is\", null)\n\t\t.where(\"expires_at\", \">\", new Date())\n\t\t.where(\"failed_attempts\", \"<\", 3)\n\t\t.returning(\"email\")\n\t\t.executeTakeFirst();\n\n\tif (result?.email) return result.email;\n\n\t// Increment failed attempts if token exists but didn't verify\n\tawait db\n\t\t.updateTable(\"magic_links\")\n\t\t.set({ failed_attempts: sql`failed_attempts + 1` })\n\t\t.where(\"token\", \"=\", token)\n\t\t.where(\"used_at\", \"is\", null)\n\t\t.where(\"expires_at\", \">\", new Date())\n\t\t.execute();\n\n\treturn null;\n}\n\n/**\n * Verify by 6-digit code + email. Same atomic pattern as verifyMagicLink.\n * Rejects after 3 failed attempts. Increments failed_attempts on all\n * active codes for this email on failure (prevents parallel brute-force).\n */\nexport async function verifyMagicLinkByCode(\n\tdb: Kysely<Database>,\n\temail: string,\n\tcode: string,\n): Promise<string | null> {\n\tconst result = await db\n\t\t.updateTable(\"magic_links\")\n\t\t.set({ used_at: new Date() })\n\t\t.where(\"email\", \"=\", email)\n\t\t.where(\"code\", \"=\", code)\n\t\t.where(\"used_at\", \"is\", null)\n\t\t.where(\"expires_at\", \">\", new Date())\n\t\t.where(\"failed_attempts\", \"<\", 3)\n\t\t.returning(\"email\")\n\t\t.executeTakeFirst();\n\n\tif (result?.email) return result.email;\n\n\t// Increment failed attempts on all active codes for this email\n\tawait db\n\t\t.updateTable(\"magic_links\")\n\t\t.set({ failed_attempts: sql`failed_attempts + 1` })\n\t\t.where(\"email\", \"=\", email)\n\t\t.where(\"used_at\", \"is\", null)\n\t\t.where(\"expires_at\", \">\", new Date())\n\t\t.execute();\n\n\treturn null;\n}\n"
|
|
5
|
+
"import { type Kysely, sql } from \"kysely\";\nimport type { Account, Database } from \"../types.ts\";\n\nexport async function upsertAccount(\n\tdb: Kysely<Database>,\n\temail: string,\n): Promise<Account> {\n\treturn await db\n\t\t.insertInto(\"accounts\")\n\t\t.values({ email })\n\t\t.onConflict(\n\t\t\t(oc) => oc.column(\"email\").doUpdateSet({ email }), // no-op update to return existing\n\t\t)\n\t\t.returningAll()\n\t\t.executeTakeFirstOrThrow();\n}\n\nexport async function getAccountById(\n\tdb: Kysely<Database>,\n\tid: string,\n): Promise<Account | null> {\n\treturn (\n\t\t(await db\n\t\t\t.selectFrom(\"accounts\")\n\t\t\t.selectAll()\n\t\t\t.where(\"id\", \"=\", id)\n\t\t\t.executeTakeFirst()) ?? null\n\t);\n}\n\nexport async function updateAccountProfile(\n\tdb: Kysely<Database>,\n\tid: string,\n\tdata: {\n\t\tdisplay_name?: string;\n\t\tbio?: string;\n\t\tslug?: string;\n\t},\n): Promise<Account> {\n\tconst set: Record<string, unknown> = {};\n\tif (data.display_name !== undefined) set.display_name = data.display_name;\n\tif (data.bio !== undefined) set.bio = data.bio;\n\tif (data.slug !== undefined) set.slug = data.slug;\n\n\treturn db\n\t\t.updateTable(\"accounts\")\n\t\t.set(set)\n\t\t.where(\"id\", \"=\", id)\n\t\t.returningAll()\n\t\t.executeTakeFirstOrThrow();\n}\n\nexport async function isSlugTaken(\n\tdb: Kysely<Database>,\n\tslug: string,\n\texcludeAccountId: string,\n): Promise<boolean> {\n\tconst row = await db\n\t\t.selectFrom(\"accounts\")\n\t\t.select(\"id\")\n\t\t.where(\"slug\", \"=\", slug)\n\t\t.where(\"id\", \"!=\", excludeAccountId)\n\t\t.executeTakeFirst();\n\treturn !!row;\n}\n\nexport async function isEmailAllowed(\n\tdb: Kysely<Database>,\n\temail: string,\n): Promise<boolean> {\n\tconst result = await sql<{ found: number }>`\n SELECT 1 AS found FROM accounts WHERE email = ${email}\n UNION ALL\n SELECT 1 AS found FROM waitlist WHERE email = ${email} AND status = 'approved'\n LIMIT 1\n `.execute(db);\n\n\treturn result.rows.length > 0;\n}\n\nexport async function createMagicLink(\n\tdb: Kysely<Database>,\n\temail: string,\n\ttoken: string,\n\tcode: string,\n\texpiresInMs: number = 15 * 60 * 1000,\n): Promise<void> {\n\tawait db\n\t\t.insertInto(\"magic_links\")\n\t\t.values({\n\t\t\temail,\n\t\t\ttoken,\n\t\t\tcode,\n\t\t\texpires_at: new Date(Date.now() + expiresInMs),\n\t\t})\n\t\t.execute();\n}\n\n/**\n * Verify a magic link token. Returns the email if valid, null otherwise.\n * Marks the token as used atomically. Rejects after 3 failed attempts.\n */\nexport async function verifyMagicLink(\n\tdb: Kysely<Database>,\n\ttoken: string,\n): Promise<string | null> {\n\tconst result = await db\n\t\t.updateTable(\"magic_links\")\n\t\t.set({ used_at: new Date() })\n\t\t.where(\"token\", \"=\", token)\n\t\t.where(\"used_at\", \"is\", null)\n\t\t.where(\"expires_at\", \">\", new Date())\n\t\t.where(\"failed_attempts\", \"<\", 3)\n\t\t.returning(\"email\")\n\t\t.executeTakeFirst();\n\n\tif (result?.email) return result.email;\n\n\t// Increment failed attempts if token exists but didn't verify\n\tawait db\n\t\t.updateTable(\"magic_links\")\n\t\t.set({ failed_attempts: sql`failed_attempts + 1` })\n\t\t.where(\"token\", \"=\", token)\n\t\t.where(\"used_at\", \"is\", null)\n\t\t.where(\"expires_at\", \">\", new Date())\n\t\t.execute();\n\n\treturn null;\n}\n\n/**\n * Verify by 6-digit code + email. Same atomic pattern as verifyMagicLink.\n * Rejects after 3 failed attempts. Increments failed_attempts on all\n * active codes for this email on failure (prevents parallel brute-force).\n */\nexport async function verifyMagicLinkByCode(\n\tdb: Kysely<Database>,\n\temail: string,\n\tcode: string,\n): Promise<string | null> {\n\tconst result = await db\n\t\t.updateTable(\"magic_links\")\n\t\t.set({ used_at: new Date() })\n\t\t.where(\"email\", \"=\", email)\n\t\t.where(\"code\", \"=\", code)\n\t\t.where(\"used_at\", \"is\", null)\n\t\t.where(\"expires_at\", \">\", new Date())\n\t\t.where(\"failed_attempts\", \"<\", 3)\n\t\t.returning(\"email\")\n\t\t.executeTakeFirst();\n\n\tif (result?.email) return result.email;\n\n\t// Increment failed attempts on all active codes for this email\n\tawait db\n\t\t.updateTable(\"magic_links\")\n\t\t.set({ failed_attempts: sql`failed_attempts + 1` })\n\t\t.where(\"email\", \"=\", email)\n\t\t.where(\"used_at\", \"is\", null)\n\t\t.where(\"expires_at\", \">\", new Date())\n\t\t.execute();\n\n\treturn null;\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAGA,eAAsB,aAAa,CAClC,IACA,OACmB;AAAA,EACnB,OAAO,MAAM,GACX,WAAW,UAAU,EACrB,OAAO,EAAE,MAAM,CAAC,EAChB,WACA,CAAC,OAAO,GAAG,OAAO,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,CACjD,EACC,aAAa,EACb,wBAAwB;AAAA;AAG3B,eAAsB,cAAc,CACnC,IACA,IAC0B;AAAA,EAC1B,OACE,MAAM,GACL,WAAW,UAAU,EACrB,UAAU,EACV,MAAM,MAAM,KAAK,EAAE,EACnB,iBAAiB,KAAM;AAAA;AAI3B,eAAsB,cAAc,CACnC,IACA,OACmB;AAAA,EACn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M,QAAQ,KAAK,IAAI,EACvB,MAAM,WAAW,MAAM,IAAI,EAC3B,MAAM,cAAc,KAAK,IAAI,IAAM,EACnC,MAAM,mBAAmB,KAAK,CAAC,EAC/B,UAAU,OAAO,EACjB,iBAAiB;AAAA,EAEnB,IAAI,QAAQ;AAAA,IAAO,OAAO,OAAO;AAAA,EAGjC,MAAM,GACJ,YAAY,aAAa,EACzB,IAAI,EAAE,iBAAiB,yBAAyB,CAAC,EACjD,MAAM,SAAS,KAAK,KAAK,EACzB,MAAM,WAAW,MAAM,IAAI,EAC3B,MAAM,cAAc,KAAK,IAAI,IAAM,EACnC,QAAQ;AAAA,EAEV,OAAO;AAAA;",
|
|
8
|
+
"debugId": "8E5E398F014808DA64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -41,6 +41,7 @@ interface StreamsTable {
|
|
|
41
41
|
endpoint_url: string;
|
|
42
42
|
signing_secret: string | null;
|
|
43
43
|
api_key_id: string;
|
|
44
|
+
project_id: string | null;
|
|
44
45
|
created_at: Generated<Date>;
|
|
45
46
|
updated_at: Generated<Date>;
|
|
46
47
|
}
|
|
@@ -102,7 +103,14 @@ interface SubgraphsTable {
|
|
|
102
103
|
last_error_at: Date | null;
|
|
103
104
|
total_processed: Generated<number>;
|
|
104
105
|
total_errors: Generated<number>;
|
|
105
|
-
api_key_id: string;
|
|
106
|
+
api_key_id: string | null;
|
|
107
|
+
account_id: string;
|
|
108
|
+
handler_code: string | null;
|
|
109
|
+
project_id: string | null;
|
|
110
|
+
is_public: Generated<boolean>;
|
|
111
|
+
tags: Generated<string[]>;
|
|
112
|
+
description: string | null;
|
|
113
|
+
forked_from_id: string | null;
|
|
106
114
|
created_at: Generated<Date>;
|
|
107
115
|
updated_at: Generated<Date>;
|
|
108
116
|
}
|
|
@@ -133,6 +141,10 @@ interface AccountsTable {
|
|
|
133
141
|
id: Generated<string>;
|
|
134
142
|
email: string;
|
|
135
143
|
plan: Generated<string>;
|
|
144
|
+
display_name: string | null;
|
|
145
|
+
bio: string | null;
|
|
146
|
+
avatar_url: string | null;
|
|
147
|
+
slug: string | null;
|
|
136
148
|
created_at: Generated<Date>;
|
|
137
149
|
}
|
|
138
150
|
interface SessionsTable {
|
|
@@ -233,6 +245,131 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
233
245
|
last_processed_block: number | null;
|
|
234
246
|
captured_at: Generated<Date>;
|
|
235
247
|
}
|
|
248
|
+
interface SubgraphUsageDailyTable {
|
|
249
|
+
subgraph_id: string;
|
|
250
|
+
date: string;
|
|
251
|
+
query_count: Generated<number>;
|
|
252
|
+
}
|
|
253
|
+
interface ProjectsTable {
|
|
254
|
+
id: Generated<string>;
|
|
255
|
+
name: string;
|
|
256
|
+
slug: string;
|
|
257
|
+
account_id: string;
|
|
258
|
+
settings: Generated<Record<string, unknown>>;
|
|
259
|
+
network: Generated<string>;
|
|
260
|
+
node_rpc: string | null;
|
|
261
|
+
created_at: Generated<Date>;
|
|
262
|
+
updated_at: Generated<Date>;
|
|
263
|
+
}
|
|
264
|
+
interface TeamMembersTable {
|
|
265
|
+
id: Generated<string>;
|
|
266
|
+
project_id: string;
|
|
267
|
+
account_id: string;
|
|
268
|
+
role: Generated<string>;
|
|
269
|
+
invited_by: string | null;
|
|
270
|
+
created_at: Generated<Date>;
|
|
271
|
+
}
|
|
272
|
+
interface TeamInvitationsTable {
|
|
273
|
+
id: Generated<string>;
|
|
274
|
+
project_id: string;
|
|
275
|
+
email: string;
|
|
276
|
+
role: Generated<string>;
|
|
277
|
+
token: string;
|
|
278
|
+
invited_by: string | null;
|
|
279
|
+
expires_at: Date;
|
|
280
|
+
accepted_at: Date | null;
|
|
281
|
+
created_at: Generated<Date>;
|
|
282
|
+
}
|
|
283
|
+
interface ChatSessionsTable {
|
|
284
|
+
id: Generated<string>;
|
|
285
|
+
account_id: string;
|
|
286
|
+
title: string | null;
|
|
287
|
+
summary: unknown | null;
|
|
288
|
+
created_at: Generated<Date>;
|
|
289
|
+
updated_at: Generated<Date>;
|
|
290
|
+
}
|
|
291
|
+
interface ChatMessagesTable {
|
|
292
|
+
id: Generated<string>;
|
|
293
|
+
chat_session_id: string;
|
|
294
|
+
role: string;
|
|
295
|
+
parts: unknown;
|
|
296
|
+
metadata: unknown | null;
|
|
297
|
+
created_at: Generated<Date>;
|
|
298
|
+
}
|
|
299
|
+
interface WorkflowDefinitionsTable {
|
|
300
|
+
id: Generated<string>;
|
|
301
|
+
name: string;
|
|
302
|
+
version: Generated<string>;
|
|
303
|
+
status: Generated<string>;
|
|
304
|
+
trigger_type: string;
|
|
305
|
+
trigger_config: unknown;
|
|
306
|
+
handler_path: string;
|
|
307
|
+
retries_config: unknown | null;
|
|
308
|
+
timeout_ms: number | null;
|
|
309
|
+
api_key_id: string;
|
|
310
|
+
project_id: string | null;
|
|
311
|
+
created_at: Generated<Date>;
|
|
312
|
+
updated_at: Generated<Date>;
|
|
313
|
+
}
|
|
314
|
+
interface WorkflowRunsTable {
|
|
315
|
+
id: Generated<string>;
|
|
316
|
+
definition_id: string;
|
|
317
|
+
status: Generated<string>;
|
|
318
|
+
trigger_type: string;
|
|
319
|
+
trigger_data: unknown | null;
|
|
320
|
+
dedup_key: string | null;
|
|
321
|
+
error: string | null;
|
|
322
|
+
started_at: Date | null;
|
|
323
|
+
completed_at: Date | null;
|
|
324
|
+
duration_ms: number | null;
|
|
325
|
+
total_ai_tokens: Generated<number>;
|
|
326
|
+
created_at: Generated<Date>;
|
|
327
|
+
}
|
|
328
|
+
interface WorkflowStepsTable {
|
|
329
|
+
id: Generated<string>;
|
|
330
|
+
run_id: string;
|
|
331
|
+
step_index: number;
|
|
332
|
+
step_id: string;
|
|
333
|
+
step_type: string;
|
|
334
|
+
status: Generated<string>;
|
|
335
|
+
input: unknown | null;
|
|
336
|
+
output: unknown | null;
|
|
337
|
+
error: string | null;
|
|
338
|
+
retry_count: Generated<number>;
|
|
339
|
+
ai_tokens_used: Generated<number>;
|
|
340
|
+
started_at: Date | null;
|
|
341
|
+
completed_at: Date | null;
|
|
342
|
+
duration_ms: number | null;
|
|
343
|
+
created_at: Generated<Date>;
|
|
344
|
+
}
|
|
345
|
+
interface WorkflowQueueTable {
|
|
346
|
+
id: Generated<string>;
|
|
347
|
+
run_id: string;
|
|
348
|
+
status: Generated<string>;
|
|
349
|
+
attempts: Generated<number>;
|
|
350
|
+
max_attempts: Generated<number>;
|
|
351
|
+
scheduled_for: Generated<Date>;
|
|
352
|
+
locked_at: Date | null;
|
|
353
|
+
locked_by: string | null;
|
|
354
|
+
error: string | null;
|
|
355
|
+
created_at: Generated<Date>;
|
|
356
|
+
completed_at: Date | null;
|
|
357
|
+
}
|
|
358
|
+
interface WorkflowSchedulesTable {
|
|
359
|
+
id: Generated<string>;
|
|
360
|
+
definition_id: string;
|
|
361
|
+
cron_expr: string;
|
|
362
|
+
timezone: Generated<string>;
|
|
363
|
+
next_run_at: Date;
|
|
364
|
+
last_run_at: Date | null;
|
|
365
|
+
enabled: Generated<boolean>;
|
|
366
|
+
created_at: Generated<Date>;
|
|
367
|
+
}
|
|
368
|
+
interface WorkflowCursorsTable {
|
|
369
|
+
name: string;
|
|
370
|
+
block_height: Generated<number>;
|
|
371
|
+
updated_at: Generated<Date>;
|
|
372
|
+
}
|
|
236
373
|
interface Database {
|
|
237
374
|
blocks: BlocksTable;
|
|
238
375
|
transactions: TransactionsTable;
|
|
@@ -256,6 +393,18 @@ interface Database {
|
|
|
256
393
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
257
394
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
258
395
|
subgraph_gaps: SubgraphGapsTable;
|
|
396
|
+
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
397
|
+
projects: ProjectsTable;
|
|
398
|
+
team_members: TeamMembersTable;
|
|
399
|
+
team_invitations: TeamInvitationsTable;
|
|
400
|
+
chat_sessions: ChatSessionsTable;
|
|
401
|
+
chat_messages: ChatMessagesTable;
|
|
402
|
+
workflow_definitions: WorkflowDefinitionsTable;
|
|
403
|
+
workflow_runs: WorkflowRunsTable;
|
|
404
|
+
workflow_steps: WorkflowStepsTable;
|
|
405
|
+
workflow_queue: WorkflowQueueTable;
|
|
406
|
+
workflow_schedules: WorkflowSchedulesTable;
|
|
407
|
+
workflow_cursors: WorkflowCursorsTable;
|
|
259
408
|
}
|
|
260
409
|
interface Gap {
|
|
261
410
|
gapStart: number;
|