Skip to content

Commit da63d9c

Browse files
committed
chore: add verify-gen-types task and update database types with timestamp fields
- Introduced verify-gen-types to ensure database types are up-to-date - Updated database types to include created_at, started_at, completed_at, failed_at, queued_at fields - Modified relevant type definitions for consistency and completeness
1 parent 4957dd2 commit da63d9c

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

pkgs/core/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
},
177177
"test:vitest": {
178178
"executor": "@nx/vite:test",
179+
"dependsOn": ["build", "verify-gen-types"],
179180
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
180181
"options": {
181182
"passWithNoTests": true,
@@ -208,6 +209,25 @@
208209
"parallel": false
209210
},
210211
"cache": true
212+
},
213+
"verify-gen-types": {
214+
"executor": "nx:run-commands",
215+
"dependsOn": ["verify-migrations"],
216+
"inputs": ["migrations", "databaseTypes"],
217+
"outputs": ["{projectRoot}/.nx-inputs/verify-gen-types.txt"],
218+
"options": {
219+
"cwd": "{projectRoot}",
220+
"commands": [
221+
"mkdir -p .nx-inputs",
222+
"echo 'Verifying database types are up-to-date...'",
223+
"cp src/database-types.ts .nx-inputs/database-types.ts.backup",
224+
"supabase gen types --local --schema pgflow --schema pgmq > .nx-inputs/database-types.ts.new",
225+
"diff .nx-inputs/database-types.ts.backup .nx-inputs/database-types.ts.new > .nx-inputs/verify-gen-types.txt 2>&1 || (echo 'ERROR: Database types are out of date! Run \"nx gen-types core\" to update them.' && exit 1)",
226+
"echo 'Database types are up-to-date' > .nx-inputs/verify-gen-types.txt"
227+
],
228+
"parallel": false
229+
},
230+
"cache": true
211231
}
212232
}
213233
}

pkgs/core/src/database-types.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ export type Database = {
1111
Tables: {
1212
deps: {
1313
Row: {
14+
created_at: string
1415
dep_slug: string
1516
flow_slug: string
1617
step_slug: string
1718
}
1819
Insert: {
20+
created_at?: string
1921
dep_slug: string
2022
flow_slug: string
2123
step_slug: string
2224
}
2325
Update: {
26+
created_at?: string
2427
dep_slug?: string
2528
flow_slug?: string
2629
step_slug?: string
@@ -51,18 +54,21 @@ export type Database = {
5154
}
5255
flows: {
5356
Row: {
57+
created_at: string
5458
flow_slug: string
5559
opt_base_delay: number
5660
opt_max_attempts: number
5761
opt_timeout: number
5862
}
5963
Insert: {
64+
created_at?: string
6065
flow_slug: string
6166
opt_base_delay?: number
6267
opt_max_attempts?: number
6368
opt_timeout?: number
6469
}
6570
Update: {
71+
created_at?: string
6672
flow_slug?: string
6773
opt_base_delay?: number
6874
opt_max_attempts?: number
@@ -72,27 +78,36 @@ export type Database = {
7278
}
7379
runs: {
7480
Row: {
81+
completed_at: string | null
82+
failed_at: string | null
7583
flow_slug: string
7684
input: Json
7785
output: Json | null
7886
remaining_steps: number
7987
run_id: string
88+
started_at: string
8089
status: string
8190
}
8291
Insert: {
92+
completed_at?: string | null
93+
failed_at?: string | null
8394
flow_slug: string
8495
input: Json
8596
output?: Json | null
8697
remaining_steps?: number
8798
run_id?: string
99+
started_at?: string
88100
status?: string
89101
}
90102
Update: {
103+
completed_at?: string | null
104+
failed_at?: string | null
91105
flow_slug?: string
92106
input?: Json
93107
output?: Json | null
94108
remaining_steps?: number
95109
run_id?: string
110+
started_at?: string
96111
status?: string
97112
}
98113
Relationships: [
@@ -107,26 +122,38 @@ export type Database = {
107122
}
108123
step_states: {
109124
Row: {
125+
completed_at: string | null
126+
created_at: string
127+
failed_at: string | null
110128
flow_slug: string
111129
remaining_deps: number
112130
remaining_tasks: number
113131
run_id: string
132+
started_at: string | null
114133
status: string
115134
step_slug: string
116135
}
117136
Insert: {
137+
completed_at?: string | null
138+
created_at?: string
139+
failed_at?: string | null
118140
flow_slug: string
119141
remaining_deps?: number
120142
remaining_tasks?: number
121143
run_id: string
144+
started_at?: string | null
122145
status?: string
123146
step_slug: string
124147
}
125148
Update: {
149+
completed_at?: string | null
150+
created_at?: string
151+
failed_at?: string | null
126152
flow_slug?: string
127153
remaining_deps?: number
128154
remaining_tasks?: number
129155
run_id?: string
156+
started_at?: string | null
130157
status?: string
131158
step_slug?: string
132159
}
@@ -157,32 +184,41 @@ export type Database = {
157184
step_tasks: {
158185
Row: {
159186
attempts_count: number
187+
completed_at: string | null
160188
error_message: string | null
189+
failed_at: string | null
161190
flow_slug: string
162191
message_id: number | null
163192
output: Json | null
193+
queued_at: string
164194
run_id: string
165195
status: string
166196
step_slug: string
167197
task_index: number
168198
}
169199
Insert: {
170200
attempts_count?: number
201+
completed_at?: string | null
171202
error_message?: string | null
203+
failed_at?: string | null
172204
flow_slug: string
173205
message_id?: number | null
174206
output?: Json | null
207+
queued_at?: string
175208
run_id: string
176209
status?: string
177210
step_slug: string
178211
task_index?: number
179212
}
180213
Update: {
181214
attempts_count?: number
215+
completed_at?: string | null
182216
error_message?: string | null
217+
failed_at?: string | null
183218
flow_slug?: string
184219
message_id?: number | null
185220
output?: Json | null
221+
queued_at?: string
186222
run_id?: string
187223
status?: string
188224
step_slug?: string
@@ -214,29 +250,35 @@ export type Database = {
214250
}
215251
steps: {
216252
Row: {
253+
created_at: string
217254
deps_count: number
218255
flow_slug: string
219256
opt_base_delay: number | null
220257
opt_max_attempts: number | null
221258
opt_timeout: number | null
259+
step_index: number
222260
step_slug: string
223261
step_type: string
224262
}
225263
Insert: {
264+
created_at?: string
226265
deps_count?: number
227266
flow_slug: string
228267
opt_base_delay?: number | null
229268
opt_max_attempts?: number | null
230269
opt_timeout?: number | null
270+
step_index?: number
231271
step_slug: string
232272
step_type?: string
233273
}
234274
Update: {
275+
created_at?: string
235276
deps_count?: number
236277
flow_slug?: string
237278
opt_base_delay?: number | null
238279
opt_max_attempts?: number | null
239280
opt_timeout?: number | null
281+
step_index?: number
240282
step_slug?: string
241283
step_type?: string
242284
}
@@ -300,11 +342,13 @@ export type Database = {
300342
timeout?: number
301343
}
302344
Returns: {
345+
created_at: string
303346
deps_count: number
304347
flow_slug: string
305348
opt_base_delay: number | null
306349
opt_max_attempts: number | null
307350
opt_timeout: number | null
351+
step_index: number
308352
step_slug: string
309353
step_type: string
310354
}
@@ -322,10 +366,13 @@ export type Database = {
322366
}
323367
Returns: {
324368
attempts_count: number
369+
completed_at: string | null
325370
error_message: string | null
371+
failed_at: string | null
326372
flow_slug: string
327373
message_id: number | null
328374
output: Json | null
375+
queued_at: string
329376
run_id: string
330377
status: string
331378
step_slug: string
@@ -340,6 +387,7 @@ export type Database = {
340387
timeout?: number
341388
}
342389
Returns: {
390+
created_at: string
343391
flow_slug: string
344392
opt_base_delay: number
345393
opt_max_attempts: number
@@ -355,10 +403,13 @@ export type Database = {
355403
}
356404
Returns: {
357405
attempts_count: number
406+
completed_at: string | null
358407
error_message: string | null
408+
failed_at: string | null
359409
flow_slug: string
360410
message_id: number | null
361411
output: Json | null
412+
queued_at: string
362413
run_id: string
363414
status: string
364415
step_slug: string
@@ -397,11 +448,14 @@ export type Database = {
397448
start_flow: {
398449
Args: { flow_slug: string; input: Json }
399450
Returns: {
451+
completed_at: string | null
452+
failed_at: string | null
400453
flow_slug: string
401454
input: Json
402455
output: Json | null
403456
remaining_steps: number
404457
run_id: string
458+
started_at: string
405459
status: string
406460
}[]
407461
}

0 commit comments

Comments
 (0)