@secondlayer/shared 0.10.2 → 0.11.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 +179 -2
- package/dist/src/db/queries/accounts.d.ts +156 -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 +149 -1
- package/dist/src/db/queries/marketplace.d.ts +463 -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 +149 -1
- package/dist/src/db/queries/projects.d.ts +423 -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 +149 -1
- package/dist/src/db/queries/subgraphs.d.ts +156 -6
- package/dist/src/db/queries/subgraphs.js +16 -13
- package/dist/src/db/queries/subgraphs.js.map +3 -3
- package/dist/src/db/queries/usage.d.ts +149 -1
- package/dist/src/db/queries/workflows.d.ts +439 -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 +179 -2
- package/dist/src/index.d.ts +249 -10
- package/dist/src/index.js +91 -72
- package/dist/src/index.js.map +4 -3
- package/dist/src/node/local-client.d.ts +149 -1
- package/dist/src/schemas/index.d.ts +71 -9
- package/dist/src/schemas/index.js +93 -74
- package/dist/src/schemas/index.js.map +4 -3
- 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/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/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,13 @@ 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
|
+
project_id: string | null;
|
|
123
|
+
is_public: Generated<boolean>;
|
|
124
|
+
tags: Generated<string[]>;
|
|
125
|
+
description: string | null;
|
|
126
|
+
forked_from_id: string | null;
|
|
120
127
|
created_at: Generated<Date>;
|
|
121
128
|
updated_at: Generated<Date>;
|
|
122
129
|
}
|
|
@@ -147,6 +154,10 @@ interface AccountsTable {
|
|
|
147
154
|
id: Generated<string>;
|
|
148
155
|
email: string;
|
|
149
156
|
plan: Generated<string>;
|
|
157
|
+
display_name: string | null;
|
|
158
|
+
bio: string | null;
|
|
159
|
+
avatar_url: string | null;
|
|
160
|
+
slug: string | null;
|
|
150
161
|
created_at: Generated<Date>;
|
|
151
162
|
}
|
|
152
163
|
interface SessionsTable {
|
|
@@ -247,6 +258,131 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
247
258
|
last_processed_block: number | null;
|
|
248
259
|
captured_at: Generated<Date>;
|
|
249
260
|
}
|
|
261
|
+
interface SubgraphUsageDailyTable {
|
|
262
|
+
subgraph_id: string;
|
|
263
|
+
date: string;
|
|
264
|
+
query_count: Generated<number>;
|
|
265
|
+
}
|
|
266
|
+
interface ProjectsTable {
|
|
267
|
+
id: Generated<string>;
|
|
268
|
+
name: string;
|
|
269
|
+
slug: string;
|
|
270
|
+
account_id: string;
|
|
271
|
+
settings: Generated<Record<string, unknown>>;
|
|
272
|
+
network: Generated<string>;
|
|
273
|
+
node_rpc: string | null;
|
|
274
|
+
created_at: Generated<Date>;
|
|
275
|
+
updated_at: Generated<Date>;
|
|
276
|
+
}
|
|
277
|
+
interface TeamMembersTable {
|
|
278
|
+
id: Generated<string>;
|
|
279
|
+
project_id: string;
|
|
280
|
+
account_id: string;
|
|
281
|
+
role: Generated<string>;
|
|
282
|
+
invited_by: string | null;
|
|
283
|
+
created_at: Generated<Date>;
|
|
284
|
+
}
|
|
285
|
+
interface TeamInvitationsTable {
|
|
286
|
+
id: Generated<string>;
|
|
287
|
+
project_id: string;
|
|
288
|
+
email: string;
|
|
289
|
+
role: Generated<string>;
|
|
290
|
+
token: string;
|
|
291
|
+
invited_by: string | null;
|
|
292
|
+
expires_at: Date;
|
|
293
|
+
accepted_at: Date | null;
|
|
294
|
+
created_at: Generated<Date>;
|
|
295
|
+
}
|
|
296
|
+
interface ChatSessionsTable {
|
|
297
|
+
id: Generated<string>;
|
|
298
|
+
account_id: string;
|
|
299
|
+
title: string | null;
|
|
300
|
+
summary: unknown | null;
|
|
301
|
+
created_at: Generated<Date>;
|
|
302
|
+
updated_at: Generated<Date>;
|
|
303
|
+
}
|
|
304
|
+
interface ChatMessagesTable {
|
|
305
|
+
id: Generated<string>;
|
|
306
|
+
chat_session_id: string;
|
|
307
|
+
role: string;
|
|
308
|
+
parts: unknown;
|
|
309
|
+
metadata: unknown | null;
|
|
310
|
+
created_at: Generated<Date>;
|
|
311
|
+
}
|
|
312
|
+
interface WorkflowDefinitionsTable {
|
|
313
|
+
id: Generated<string>;
|
|
314
|
+
name: string;
|
|
315
|
+
version: Generated<string>;
|
|
316
|
+
status: Generated<string>;
|
|
317
|
+
trigger_type: string;
|
|
318
|
+
trigger_config: unknown;
|
|
319
|
+
handler_path: string;
|
|
320
|
+
retries_config: unknown | null;
|
|
321
|
+
timeout_ms: number | null;
|
|
322
|
+
api_key_id: string;
|
|
323
|
+
project_id: string | null;
|
|
324
|
+
created_at: Generated<Date>;
|
|
325
|
+
updated_at: Generated<Date>;
|
|
326
|
+
}
|
|
327
|
+
interface WorkflowRunsTable {
|
|
328
|
+
id: Generated<string>;
|
|
329
|
+
definition_id: string;
|
|
330
|
+
status: Generated<string>;
|
|
331
|
+
trigger_type: string;
|
|
332
|
+
trigger_data: unknown | null;
|
|
333
|
+
dedup_key: string | null;
|
|
334
|
+
error: string | null;
|
|
335
|
+
started_at: Date | null;
|
|
336
|
+
completed_at: Date | null;
|
|
337
|
+
duration_ms: number | null;
|
|
338
|
+
total_ai_tokens: Generated<number>;
|
|
339
|
+
created_at: Generated<Date>;
|
|
340
|
+
}
|
|
341
|
+
interface WorkflowStepsTable {
|
|
342
|
+
id: Generated<string>;
|
|
343
|
+
run_id: string;
|
|
344
|
+
step_index: number;
|
|
345
|
+
step_id: string;
|
|
346
|
+
step_type: string;
|
|
347
|
+
status: Generated<string>;
|
|
348
|
+
input: unknown | null;
|
|
349
|
+
output: unknown | null;
|
|
350
|
+
error: string | null;
|
|
351
|
+
retry_count: Generated<number>;
|
|
352
|
+
ai_tokens_used: Generated<number>;
|
|
353
|
+
started_at: Date | null;
|
|
354
|
+
completed_at: Date | null;
|
|
355
|
+
duration_ms: number | null;
|
|
356
|
+
created_at: Generated<Date>;
|
|
357
|
+
}
|
|
358
|
+
interface WorkflowQueueTable {
|
|
359
|
+
id: Generated<string>;
|
|
360
|
+
run_id: string;
|
|
361
|
+
status: Generated<string>;
|
|
362
|
+
attempts: Generated<number>;
|
|
363
|
+
max_attempts: Generated<number>;
|
|
364
|
+
scheduled_for: Generated<Date>;
|
|
365
|
+
locked_at: Date | null;
|
|
366
|
+
locked_by: string | null;
|
|
367
|
+
error: string | null;
|
|
368
|
+
created_at: Generated<Date>;
|
|
369
|
+
completed_at: Date | null;
|
|
370
|
+
}
|
|
371
|
+
interface WorkflowSchedulesTable {
|
|
372
|
+
id: Generated<string>;
|
|
373
|
+
definition_id: string;
|
|
374
|
+
cron_expr: string;
|
|
375
|
+
timezone: Generated<string>;
|
|
376
|
+
next_run_at: Date;
|
|
377
|
+
last_run_at: Date | null;
|
|
378
|
+
enabled: Generated<boolean>;
|
|
379
|
+
created_at: Generated<Date>;
|
|
380
|
+
}
|
|
381
|
+
interface WorkflowCursorsTable {
|
|
382
|
+
name: string;
|
|
383
|
+
block_height: Generated<number>;
|
|
384
|
+
updated_at: Generated<Date>;
|
|
385
|
+
}
|
|
250
386
|
interface Database {
|
|
251
387
|
blocks: BlocksTable;
|
|
252
388
|
transactions: TransactionsTable;
|
|
@@ -270,6 +406,18 @@ interface Database {
|
|
|
270
406
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
271
407
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
272
408
|
subgraph_gaps: SubgraphGapsTable;
|
|
409
|
+
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
410
|
+
projects: ProjectsTable;
|
|
411
|
+
team_members: TeamMembersTable;
|
|
412
|
+
team_invitations: TeamInvitationsTable;
|
|
413
|
+
chat_sessions: ChatSessionsTable;
|
|
414
|
+
chat_messages: ChatMessagesTable;
|
|
415
|
+
workflow_definitions: WorkflowDefinitionsTable;
|
|
416
|
+
workflow_runs: WorkflowRunsTable;
|
|
417
|
+
workflow_steps: WorkflowStepsTable;
|
|
418
|
+
workflow_queue: WorkflowQueueTable;
|
|
419
|
+
workflow_schedules: WorkflowSchedulesTable;
|
|
420
|
+
workflow_cursors: WorkflowCursorsTable;
|
|
273
421
|
}
|
|
274
422
|
type Block = Selectable<BlocksTable>;
|
|
275
423
|
type InsertBlock = Insertable<BlocksTable>;
|
|
@@ -317,10 +465,39 @@ type SubgraphHealthSnapshot = Selectable<SubgraphHealthSnapshotsTable>;
|
|
|
317
465
|
type InsertSubgraphHealthSnapshot = Insertable<SubgraphHealthSnapshotsTable>;
|
|
318
466
|
type SubgraphGap = Selectable<SubgraphGapsTable>;
|
|
319
467
|
type InsertSubgraphGap = Insertable<SubgraphGapsTable>;
|
|
468
|
+
type SubgraphUsageDaily = Selectable<SubgraphUsageDailyTable>;
|
|
469
|
+
type InsertSubgraphUsageDaily = Insertable<SubgraphUsageDailyTable>;
|
|
470
|
+
type WorkflowDefinition = Selectable<WorkflowDefinitionsTable>;
|
|
471
|
+
type InsertWorkflowDefinition = Insertable<WorkflowDefinitionsTable>;
|
|
472
|
+
type UpdateWorkflowDefinition = Updateable<WorkflowDefinitionsTable>;
|
|
473
|
+
type WorkflowRun = Selectable<WorkflowRunsTable>;
|
|
474
|
+
type InsertWorkflowRun = Insertable<WorkflowRunsTable>;
|
|
475
|
+
type UpdateWorkflowRun = Updateable<WorkflowRunsTable>;
|
|
476
|
+
type WorkflowStep = Selectable<WorkflowStepsTable>;
|
|
477
|
+
type InsertWorkflowStep = Insertable<WorkflowStepsTable>;
|
|
478
|
+
type UpdateWorkflowStep = Updateable<WorkflowStepsTable>;
|
|
479
|
+
type WorkflowQueueItem = Selectable<WorkflowQueueTable>;
|
|
480
|
+
type InsertWorkflowQueueItem = Insertable<WorkflowQueueTable>;
|
|
481
|
+
type WorkflowSchedule = Selectable<WorkflowSchedulesTable>;
|
|
482
|
+
type InsertWorkflowSchedule = Insertable<WorkflowSchedulesTable>;
|
|
483
|
+
type UpdateWorkflowSchedule = Updateable<WorkflowSchedulesTable>;
|
|
484
|
+
type WorkflowCursor = Selectable<WorkflowCursorsTable>;
|
|
485
|
+
type Project = Selectable<ProjectsTable>;
|
|
486
|
+
type InsertProject = Insertable<ProjectsTable>;
|
|
487
|
+
type UpdateProject = Updateable<ProjectsTable>;
|
|
488
|
+
type TeamMember = Selectable<TeamMembersTable>;
|
|
489
|
+
type InsertTeamMember = Insertable<TeamMembersTable>;
|
|
490
|
+
type TeamInvitation = Selectable<TeamInvitationsTable>;
|
|
491
|
+
type InsertTeamInvitation = Insertable<TeamInvitationsTable>;
|
|
492
|
+
type ChatSession = Selectable<ChatSessionsTable>;
|
|
493
|
+
type InsertChatSession = Insertable<ChatSessionsTable>;
|
|
494
|
+
type UpdateChatSession = Updateable<ChatSessionsTable>;
|
|
495
|
+
type ChatMessage = Selectable<ChatMessagesTable>;
|
|
496
|
+
type InsertChatMessage = Insertable<ChatMessagesTable>;
|
|
320
497
|
import { sql } from "kysely";
|
|
321
498
|
declare function getDb(connectionString?: string): Kysely<Database>;
|
|
322
499
|
/** Raw postgres.js client for dynamic schema DDL (CREATE SCHEMA, DROP, etc.) */
|
|
323
500
|
declare function getRawClient(): ReturnType<typeof postgres>;
|
|
324
501
|
/** Close the DB connection pool. Call in CLI commands to allow process exit. */
|
|
325
502
|
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 };
|
|
503
|
+
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,13 @@ 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
|
+
project_id: string | null;
|
|
109
|
+
is_public: Generated<boolean>;
|
|
110
|
+
tags: Generated<string[]>;
|
|
111
|
+
description: string | null;
|
|
112
|
+
forked_from_id: string | null;
|
|
106
113
|
created_at: Generated<Date>;
|
|
107
114
|
updated_at: Generated<Date>;
|
|
108
115
|
}
|
|
@@ -133,6 +140,10 @@ interface AccountsTable {
|
|
|
133
140
|
id: Generated<string>;
|
|
134
141
|
email: string;
|
|
135
142
|
plan: Generated<string>;
|
|
143
|
+
display_name: string | null;
|
|
144
|
+
bio: string | null;
|
|
145
|
+
avatar_url: string | null;
|
|
146
|
+
slug: string | null;
|
|
136
147
|
created_at: Generated<Date>;
|
|
137
148
|
}
|
|
138
149
|
interface SessionsTable {
|
|
@@ -233,6 +244,131 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
233
244
|
last_processed_block: number | null;
|
|
234
245
|
captured_at: Generated<Date>;
|
|
235
246
|
}
|
|
247
|
+
interface SubgraphUsageDailyTable {
|
|
248
|
+
subgraph_id: string;
|
|
249
|
+
date: string;
|
|
250
|
+
query_count: Generated<number>;
|
|
251
|
+
}
|
|
252
|
+
interface ProjectsTable {
|
|
253
|
+
id: Generated<string>;
|
|
254
|
+
name: string;
|
|
255
|
+
slug: string;
|
|
256
|
+
account_id: string;
|
|
257
|
+
settings: Generated<Record<string, unknown>>;
|
|
258
|
+
network: Generated<string>;
|
|
259
|
+
node_rpc: string | null;
|
|
260
|
+
created_at: Generated<Date>;
|
|
261
|
+
updated_at: Generated<Date>;
|
|
262
|
+
}
|
|
263
|
+
interface TeamMembersTable {
|
|
264
|
+
id: Generated<string>;
|
|
265
|
+
project_id: string;
|
|
266
|
+
account_id: string;
|
|
267
|
+
role: Generated<string>;
|
|
268
|
+
invited_by: string | null;
|
|
269
|
+
created_at: Generated<Date>;
|
|
270
|
+
}
|
|
271
|
+
interface TeamInvitationsTable {
|
|
272
|
+
id: Generated<string>;
|
|
273
|
+
project_id: string;
|
|
274
|
+
email: string;
|
|
275
|
+
role: Generated<string>;
|
|
276
|
+
token: string;
|
|
277
|
+
invited_by: string | null;
|
|
278
|
+
expires_at: Date;
|
|
279
|
+
accepted_at: Date | null;
|
|
280
|
+
created_at: Generated<Date>;
|
|
281
|
+
}
|
|
282
|
+
interface ChatSessionsTable {
|
|
283
|
+
id: Generated<string>;
|
|
284
|
+
account_id: string;
|
|
285
|
+
title: string | null;
|
|
286
|
+
summary: unknown | null;
|
|
287
|
+
created_at: Generated<Date>;
|
|
288
|
+
updated_at: Generated<Date>;
|
|
289
|
+
}
|
|
290
|
+
interface ChatMessagesTable {
|
|
291
|
+
id: Generated<string>;
|
|
292
|
+
chat_session_id: string;
|
|
293
|
+
role: string;
|
|
294
|
+
parts: unknown;
|
|
295
|
+
metadata: unknown | null;
|
|
296
|
+
created_at: Generated<Date>;
|
|
297
|
+
}
|
|
298
|
+
interface WorkflowDefinitionsTable {
|
|
299
|
+
id: Generated<string>;
|
|
300
|
+
name: string;
|
|
301
|
+
version: Generated<string>;
|
|
302
|
+
status: Generated<string>;
|
|
303
|
+
trigger_type: string;
|
|
304
|
+
trigger_config: unknown;
|
|
305
|
+
handler_path: string;
|
|
306
|
+
retries_config: unknown | null;
|
|
307
|
+
timeout_ms: number | null;
|
|
308
|
+
api_key_id: string;
|
|
309
|
+
project_id: string | null;
|
|
310
|
+
created_at: Generated<Date>;
|
|
311
|
+
updated_at: Generated<Date>;
|
|
312
|
+
}
|
|
313
|
+
interface WorkflowRunsTable {
|
|
314
|
+
id: Generated<string>;
|
|
315
|
+
definition_id: string;
|
|
316
|
+
status: Generated<string>;
|
|
317
|
+
trigger_type: string;
|
|
318
|
+
trigger_data: unknown | null;
|
|
319
|
+
dedup_key: string | null;
|
|
320
|
+
error: string | null;
|
|
321
|
+
started_at: Date | null;
|
|
322
|
+
completed_at: Date | null;
|
|
323
|
+
duration_ms: number | null;
|
|
324
|
+
total_ai_tokens: Generated<number>;
|
|
325
|
+
created_at: Generated<Date>;
|
|
326
|
+
}
|
|
327
|
+
interface WorkflowStepsTable {
|
|
328
|
+
id: Generated<string>;
|
|
329
|
+
run_id: string;
|
|
330
|
+
step_index: number;
|
|
331
|
+
step_id: string;
|
|
332
|
+
step_type: string;
|
|
333
|
+
status: Generated<string>;
|
|
334
|
+
input: unknown | null;
|
|
335
|
+
output: unknown | null;
|
|
336
|
+
error: string | null;
|
|
337
|
+
retry_count: Generated<number>;
|
|
338
|
+
ai_tokens_used: Generated<number>;
|
|
339
|
+
started_at: Date | null;
|
|
340
|
+
completed_at: Date | null;
|
|
341
|
+
duration_ms: number | null;
|
|
342
|
+
created_at: Generated<Date>;
|
|
343
|
+
}
|
|
344
|
+
interface WorkflowQueueTable {
|
|
345
|
+
id: Generated<string>;
|
|
346
|
+
run_id: string;
|
|
347
|
+
status: Generated<string>;
|
|
348
|
+
attempts: Generated<number>;
|
|
349
|
+
max_attempts: Generated<number>;
|
|
350
|
+
scheduled_for: Generated<Date>;
|
|
351
|
+
locked_at: Date | null;
|
|
352
|
+
locked_by: string | null;
|
|
353
|
+
error: string | null;
|
|
354
|
+
created_at: Generated<Date>;
|
|
355
|
+
completed_at: Date | null;
|
|
356
|
+
}
|
|
357
|
+
interface WorkflowSchedulesTable {
|
|
358
|
+
id: Generated<string>;
|
|
359
|
+
definition_id: string;
|
|
360
|
+
cron_expr: string;
|
|
361
|
+
timezone: Generated<string>;
|
|
362
|
+
next_run_at: Date;
|
|
363
|
+
last_run_at: Date | null;
|
|
364
|
+
enabled: Generated<boolean>;
|
|
365
|
+
created_at: Generated<Date>;
|
|
366
|
+
}
|
|
367
|
+
interface WorkflowCursorsTable {
|
|
368
|
+
name: string;
|
|
369
|
+
block_height: Generated<number>;
|
|
370
|
+
updated_at: Generated<Date>;
|
|
371
|
+
}
|
|
236
372
|
interface Database {
|
|
237
373
|
blocks: BlocksTable;
|
|
238
374
|
transactions: TransactionsTable;
|
|
@@ -256,10 +392,28 @@ interface Database {
|
|
|
256
392
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
257
393
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
258
394
|
subgraph_gaps: SubgraphGapsTable;
|
|
395
|
+
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
396
|
+
projects: ProjectsTable;
|
|
397
|
+
team_members: TeamMembersTable;
|
|
398
|
+
team_invitations: TeamInvitationsTable;
|
|
399
|
+
chat_sessions: ChatSessionsTable;
|
|
400
|
+
chat_messages: ChatMessagesTable;
|
|
401
|
+
workflow_definitions: WorkflowDefinitionsTable;
|
|
402
|
+
workflow_runs: WorkflowRunsTable;
|
|
403
|
+
workflow_steps: WorkflowStepsTable;
|
|
404
|
+
workflow_queue: WorkflowQueueTable;
|
|
405
|
+
workflow_schedules: WorkflowSchedulesTable;
|
|
406
|
+
workflow_cursors: WorkflowCursorsTable;
|
|
259
407
|
}
|
|
260
408
|
type Account = Selectable<AccountsTable>;
|
|
261
409
|
declare function upsertAccount(db: Kysely<Database>, email: string): Promise<Account>;
|
|
262
410
|
declare function getAccountById(db: Kysely<Database>, id: string): Promise<Account | null>;
|
|
411
|
+
declare function updateAccountProfile(db: Kysely<Database>, id: string, data: {
|
|
412
|
+
display_name?: string
|
|
413
|
+
bio?: string
|
|
414
|
+
slug?: string
|
|
415
|
+
}): Promise<Account>;
|
|
416
|
+
declare function isSlugTaken(db: Kysely<Database>, slug: string, excludeAccountId: string): Promise<boolean>;
|
|
263
417
|
declare function isEmailAllowed(db: Kysely<Database>, email: string): Promise<boolean>;
|
|
264
418
|
declare function createMagicLink(db: Kysely<Database>, email: string, token: string, code: string, expiresInMs?: number): Promise<void>;
|
|
265
419
|
/**
|
|
@@ -273,4 +427,4 @@ declare function verifyMagicLink(db: Kysely<Database>, token: string): Promise<s
|
|
|
273
427
|
* active codes for this email on failure (prevents parallel brute-force).
|
|
274
428
|
*/
|
|
275
429
|
declare function verifyMagicLinkByCode(db: Kysely<Database>, email: string, code: string): Promise<string | null>;
|
|
276
|
-
export { verifyMagicLinkByCode, verifyMagicLink, upsertAccount, isEmailAllowed, getAccountById, createMagicLink };
|
|
430
|
+
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,EACnB,MAAM,SAAS,MAAM;AAAA,oDAC8B;AAAA;AAAA,oDAEA;AAAA;AAAA,IAEhD,QAAQ,EAAE;AAAA,EAEb,OAAO,OAAO,KAAK,SAAS;AAAA;AAG7B,eAAsB,eAAe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BAAiB;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,13 @@ 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
|
+
project_id: string | null;
|
|
109
|
+
is_public: Generated<boolean>;
|
|
110
|
+
tags: Generated<string[]>;
|
|
111
|
+
description: string | null;
|
|
112
|
+
forked_from_id: string | null;
|
|
106
113
|
created_at: Generated<Date>;
|
|
107
114
|
updated_at: Generated<Date>;
|
|
108
115
|
}
|
|
@@ -133,6 +140,10 @@ interface AccountsTable {
|
|
|
133
140
|
id: Generated<string>;
|
|
134
141
|
email: string;
|
|
135
142
|
plan: Generated<string>;
|
|
143
|
+
display_name: string | null;
|
|
144
|
+
bio: string | null;
|
|
145
|
+
avatar_url: string | null;
|
|
146
|
+
slug: string | null;
|
|
136
147
|
created_at: Generated<Date>;
|
|
137
148
|
}
|
|
138
149
|
interface SessionsTable {
|
|
@@ -233,6 +244,131 @@ interface SubgraphHealthSnapshotsTable {
|
|
|
233
244
|
last_processed_block: number | null;
|
|
234
245
|
captured_at: Generated<Date>;
|
|
235
246
|
}
|
|
247
|
+
interface SubgraphUsageDailyTable {
|
|
248
|
+
subgraph_id: string;
|
|
249
|
+
date: string;
|
|
250
|
+
query_count: Generated<number>;
|
|
251
|
+
}
|
|
252
|
+
interface ProjectsTable {
|
|
253
|
+
id: Generated<string>;
|
|
254
|
+
name: string;
|
|
255
|
+
slug: string;
|
|
256
|
+
account_id: string;
|
|
257
|
+
settings: Generated<Record<string, unknown>>;
|
|
258
|
+
network: Generated<string>;
|
|
259
|
+
node_rpc: string | null;
|
|
260
|
+
created_at: Generated<Date>;
|
|
261
|
+
updated_at: Generated<Date>;
|
|
262
|
+
}
|
|
263
|
+
interface TeamMembersTable {
|
|
264
|
+
id: Generated<string>;
|
|
265
|
+
project_id: string;
|
|
266
|
+
account_id: string;
|
|
267
|
+
role: Generated<string>;
|
|
268
|
+
invited_by: string | null;
|
|
269
|
+
created_at: Generated<Date>;
|
|
270
|
+
}
|
|
271
|
+
interface TeamInvitationsTable {
|
|
272
|
+
id: Generated<string>;
|
|
273
|
+
project_id: string;
|
|
274
|
+
email: string;
|
|
275
|
+
role: Generated<string>;
|
|
276
|
+
token: string;
|
|
277
|
+
invited_by: string | null;
|
|
278
|
+
expires_at: Date;
|
|
279
|
+
accepted_at: Date | null;
|
|
280
|
+
created_at: Generated<Date>;
|
|
281
|
+
}
|
|
282
|
+
interface ChatSessionsTable {
|
|
283
|
+
id: Generated<string>;
|
|
284
|
+
account_id: string;
|
|
285
|
+
title: string | null;
|
|
286
|
+
summary: unknown | null;
|
|
287
|
+
created_at: Generated<Date>;
|
|
288
|
+
updated_at: Generated<Date>;
|
|
289
|
+
}
|
|
290
|
+
interface ChatMessagesTable {
|
|
291
|
+
id: Generated<string>;
|
|
292
|
+
chat_session_id: string;
|
|
293
|
+
role: string;
|
|
294
|
+
parts: unknown;
|
|
295
|
+
metadata: unknown | null;
|
|
296
|
+
created_at: Generated<Date>;
|
|
297
|
+
}
|
|
298
|
+
interface WorkflowDefinitionsTable {
|
|
299
|
+
id: Generated<string>;
|
|
300
|
+
name: string;
|
|
301
|
+
version: Generated<string>;
|
|
302
|
+
status: Generated<string>;
|
|
303
|
+
trigger_type: string;
|
|
304
|
+
trigger_config: unknown;
|
|
305
|
+
handler_path: string;
|
|
306
|
+
retries_config: unknown | null;
|
|
307
|
+
timeout_ms: number | null;
|
|
308
|
+
api_key_id: string;
|
|
309
|
+
project_id: string | null;
|
|
310
|
+
created_at: Generated<Date>;
|
|
311
|
+
updated_at: Generated<Date>;
|
|
312
|
+
}
|
|
313
|
+
interface WorkflowRunsTable {
|
|
314
|
+
id: Generated<string>;
|
|
315
|
+
definition_id: string;
|
|
316
|
+
status: Generated<string>;
|
|
317
|
+
trigger_type: string;
|
|
318
|
+
trigger_data: unknown | null;
|
|
319
|
+
dedup_key: string | null;
|
|
320
|
+
error: string | null;
|
|
321
|
+
started_at: Date | null;
|
|
322
|
+
completed_at: Date | null;
|
|
323
|
+
duration_ms: number | null;
|
|
324
|
+
total_ai_tokens: Generated<number>;
|
|
325
|
+
created_at: Generated<Date>;
|
|
326
|
+
}
|
|
327
|
+
interface WorkflowStepsTable {
|
|
328
|
+
id: Generated<string>;
|
|
329
|
+
run_id: string;
|
|
330
|
+
step_index: number;
|
|
331
|
+
step_id: string;
|
|
332
|
+
step_type: string;
|
|
333
|
+
status: Generated<string>;
|
|
334
|
+
input: unknown | null;
|
|
335
|
+
output: unknown | null;
|
|
336
|
+
error: string | null;
|
|
337
|
+
retry_count: Generated<number>;
|
|
338
|
+
ai_tokens_used: Generated<number>;
|
|
339
|
+
started_at: Date | null;
|
|
340
|
+
completed_at: Date | null;
|
|
341
|
+
duration_ms: number | null;
|
|
342
|
+
created_at: Generated<Date>;
|
|
343
|
+
}
|
|
344
|
+
interface WorkflowQueueTable {
|
|
345
|
+
id: Generated<string>;
|
|
346
|
+
run_id: string;
|
|
347
|
+
status: Generated<string>;
|
|
348
|
+
attempts: Generated<number>;
|
|
349
|
+
max_attempts: Generated<number>;
|
|
350
|
+
scheduled_for: Generated<Date>;
|
|
351
|
+
locked_at: Date | null;
|
|
352
|
+
locked_by: string | null;
|
|
353
|
+
error: string | null;
|
|
354
|
+
created_at: Generated<Date>;
|
|
355
|
+
completed_at: Date | null;
|
|
356
|
+
}
|
|
357
|
+
interface WorkflowSchedulesTable {
|
|
358
|
+
id: Generated<string>;
|
|
359
|
+
definition_id: string;
|
|
360
|
+
cron_expr: string;
|
|
361
|
+
timezone: Generated<string>;
|
|
362
|
+
next_run_at: Date;
|
|
363
|
+
last_run_at: Date | null;
|
|
364
|
+
enabled: Generated<boolean>;
|
|
365
|
+
created_at: Generated<Date>;
|
|
366
|
+
}
|
|
367
|
+
interface WorkflowCursorsTable {
|
|
368
|
+
name: string;
|
|
369
|
+
block_height: Generated<number>;
|
|
370
|
+
updated_at: Generated<Date>;
|
|
371
|
+
}
|
|
236
372
|
interface Database {
|
|
237
373
|
blocks: BlocksTable;
|
|
238
374
|
transactions: TransactionsTable;
|
|
@@ -256,6 +392,18 @@ interface Database {
|
|
|
256
392
|
subgraph_processing_stats: SubgraphProcessingStatsTable;
|
|
257
393
|
subgraph_table_snapshots: SubgraphTableSnapshotsTable;
|
|
258
394
|
subgraph_gaps: SubgraphGapsTable;
|
|
395
|
+
subgraph_usage_daily: SubgraphUsageDailyTable;
|
|
396
|
+
projects: ProjectsTable;
|
|
397
|
+
team_members: TeamMembersTable;
|
|
398
|
+
team_invitations: TeamInvitationsTable;
|
|
399
|
+
chat_sessions: ChatSessionsTable;
|
|
400
|
+
chat_messages: ChatMessagesTable;
|
|
401
|
+
workflow_definitions: WorkflowDefinitionsTable;
|
|
402
|
+
workflow_runs: WorkflowRunsTable;
|
|
403
|
+
workflow_steps: WorkflowStepsTable;
|
|
404
|
+
workflow_queue: WorkflowQueueTable;
|
|
405
|
+
workflow_schedules: WorkflowSchedulesTable;
|
|
406
|
+
workflow_cursors: WorkflowCursorsTable;
|
|
259
407
|
}
|
|
260
408
|
interface Gap {
|
|
261
409
|
gapStart: number;
|