@hyperfixation/db 0.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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/dist/app-state.d.ts +12 -0
  3. package/dist/app-state.js +18 -0
  4. package/dist/boot-checks.d.ts +56 -0
  5. package/dist/boot-checks.js +228 -0
  6. package/dist/classify.d.ts +6 -0
  7. package/dist/classify.js +75 -0
  8. package/dist/control-plane.d.ts +75 -0
  9. package/dist/control-plane.js +155 -0
  10. package/dist/delete-guard.d.ts +32 -0
  11. package/dist/delete-guard.js +62 -0
  12. package/dist/fenced-client.d.ts +35 -0
  13. package/dist/fenced-client.js +153 -0
  14. package/dist/grant-ro.d.ts +23 -0
  15. package/dist/grant-ro.js +49 -0
  16. package/dist/index.d.ts +12 -0
  17. package/dist/index.js +10 -0
  18. package/dist/internal/control-pool.d.ts +20 -0
  19. package/dist/internal/control-pool.js +17 -0
  20. package/dist/loader.d.ts +15 -0
  21. package/dist/loader.js +82 -0
  22. package/dist/migrate.d.ts +54 -0
  23. package/dist/migrate.js +143 -0
  24. package/dist/migration-policy.d.ts +14 -0
  25. package/dist/migration-policy.js +85 -0
  26. package/dist/migrator.d.ts +9 -0
  27. package/dist/migrator.js +9 -0
  28. package/dist/roles.d.ts +47 -0
  29. package/dist/roles.js +112 -0
  30. package/dist/schema/app.d.ts +235 -0
  31. package/dist/schema/app.js +23 -0
  32. package/dist/schema/approvals.d.ts +352 -0
  33. package/dist/schema/approvals.js +43 -0
  34. package/dist/schema/auth.d.ts +1272 -0
  35. package/dist/schema/auth.js +120 -0
  36. package/dist/schema/index.d.ts +7 -0
  37. package/dist/schema/index.js +7 -0
  38. package/dist/schema/ledger.d.ts +722 -0
  39. package/dist/schema/ledger.js +68 -0
  40. package/dist/schema/machinery.d.ts +1343 -0
  41. package/dist/schema/machinery.js +146 -0
  42. package/dist/schema/records.d.ts +15 -0
  43. package/dist/schema/records.js +16 -0
  44. package/dist/schema/runs.d.ts +213 -0
  45. package/dist/schema/runs.js +26 -0
  46. package/dist/step-pool.d.ts +26 -0
  47. package/dist/step-pool.js +57 -0
  48. package/migrations/0000_core_schema.sql +185 -0
  49. package/migrations/0001_llm_call_reservation_index.sql +4 -0
  50. package/migrations/0002_approvals.sql +25 -0
  51. package/migrations/0003_auth_invitation.sql +13 -0
  52. package/migrations/0004_machinery.sql +105 -0
  53. package/migrations/0005_nullable_activity_task_record.sql +4 -0
  54. package/migrations/0006_activity_score_key.sql +5 -0
  55. package/migrations/0007_score_spec_name.sql +3 -0
  56. package/migrations/meta/0000_snapshot.json +1238 -0
  57. package/migrations/meta/0001_snapshot.json +1238 -0
  58. package/migrations/meta/0002_snapshot.json +1426 -0
  59. package/migrations/meta/0003_snapshot.json +1516 -0
  60. package/migrations/meta/0004_snapshot.json +2353 -0
  61. package/migrations/meta/0005_snapshot.json +2353 -0
  62. package/migrations/meta/0006_snapshot.json +2415 -0
  63. package/migrations/meta/0007_snapshot.json +2427 -0
  64. package/migrations/meta/_journal.json +62 -0
  65. package/package.json +58 -0
@@ -0,0 +1,1238 @@
1
+ {
2
+ "id": "9c8c9d12-a393-4f73-b2f9-727fbb7fe5e8",
3
+ "prevId": "eee13b2d-fabd-4271-ac1a-cfe57cdcbabe",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.hf_app_state": {
8
+ "name": "hf_app_state",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "integer",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": 1
17
+ },
18
+ "paused": {
19
+ "name": "paused",
20
+ "type": "boolean",
21
+ "primaryKey": false,
22
+ "notNull": true,
23
+ "default": false
24
+ },
25
+ "paused_by": {
26
+ "name": "paused_by",
27
+ "type": "text",
28
+ "primaryKey": false,
29
+ "notNull": false
30
+ },
31
+ "budget_usd": {
32
+ "name": "budget_usd",
33
+ "type": "numeric(12, 4)",
34
+ "primaryKey": false,
35
+ "notNull": true
36
+ },
37
+ "read_token_hash": {
38
+ "name": "read_token_hash",
39
+ "type": "text",
40
+ "primaryKey": false,
41
+ "notNull": false
42
+ },
43
+ "write_token_hash": {
44
+ "name": "write_token_hash",
45
+ "type": "text",
46
+ "primaryKey": false,
47
+ "notNull": false
48
+ }
49
+ },
50
+ "indexes": {},
51
+ "foreignKeys": {},
52
+ "compositePrimaryKeys": {},
53
+ "uniqueConstraints": {},
54
+ "policies": {},
55
+ "checkConstraints": {
56
+ "hf_app_state_singleton": {
57
+ "name": "hf_app_state_singleton",
58
+ "value": "\"hf_app_state\".\"id\" = 1"
59
+ }
60
+ },
61
+ "isRLSEnabled": false
62
+ },
63
+ "public.hf_audit": {
64
+ "name": "hf_audit",
65
+ "schema": "",
66
+ "columns": {
67
+ "id": {
68
+ "name": "id",
69
+ "type": "bigint",
70
+ "primaryKey": true,
71
+ "notNull": true,
72
+ "identity": {
73
+ "name": "hf_audit_id_seq",
74
+ "increment": "1",
75
+ "minValue": "1",
76
+ "maxValue": "9223372036854775807",
77
+ "startWith": "1",
78
+ "cache": "1",
79
+ "cycle": false,
80
+ "schema": "public",
81
+ "type": "always"
82
+ }
83
+ },
84
+ "actor_id": {
85
+ "name": "actor_id",
86
+ "type": "text",
87
+ "primaryKey": false,
88
+ "notNull": false
89
+ },
90
+ "action": {
91
+ "name": "action",
92
+ "type": "text",
93
+ "primaryKey": false,
94
+ "notNull": true
95
+ },
96
+ "target_type": {
97
+ "name": "target_type",
98
+ "type": "text",
99
+ "primaryKey": false,
100
+ "notNull": false
101
+ },
102
+ "target_id": {
103
+ "name": "target_id",
104
+ "type": "text",
105
+ "primaryKey": false,
106
+ "notNull": false
107
+ },
108
+ "meta": {
109
+ "name": "meta",
110
+ "type": "jsonb",
111
+ "primaryKey": false,
112
+ "notNull": false
113
+ },
114
+ "at": {
115
+ "name": "at",
116
+ "type": "timestamp with time zone",
117
+ "primaryKey": false,
118
+ "notNull": true,
119
+ "default": "now()"
120
+ }
121
+ },
122
+ "indexes": {},
123
+ "foreignKeys": {},
124
+ "compositePrimaryKeys": {},
125
+ "uniqueConstraints": {},
126
+ "policies": {},
127
+ "checkConstraints": {},
128
+ "isRLSEnabled": false
129
+ },
130
+ "public.hf_account": {
131
+ "name": "hf_account",
132
+ "schema": "",
133
+ "columns": {
134
+ "id": {
135
+ "name": "id",
136
+ "type": "text",
137
+ "primaryKey": true,
138
+ "notNull": true
139
+ },
140
+ "account_id": {
141
+ "name": "account_id",
142
+ "type": "text",
143
+ "primaryKey": false,
144
+ "notNull": true
145
+ },
146
+ "provider_id": {
147
+ "name": "provider_id",
148
+ "type": "text",
149
+ "primaryKey": false,
150
+ "notNull": true
151
+ },
152
+ "user_id": {
153
+ "name": "user_id",
154
+ "type": "text",
155
+ "primaryKey": false,
156
+ "notNull": true
157
+ },
158
+ "access_token": {
159
+ "name": "access_token",
160
+ "type": "text",
161
+ "primaryKey": false,
162
+ "notNull": false
163
+ },
164
+ "refresh_token": {
165
+ "name": "refresh_token",
166
+ "type": "text",
167
+ "primaryKey": false,
168
+ "notNull": false
169
+ },
170
+ "id_token": {
171
+ "name": "id_token",
172
+ "type": "text",
173
+ "primaryKey": false,
174
+ "notNull": false
175
+ },
176
+ "access_token_expires_at": {
177
+ "name": "access_token_expires_at",
178
+ "type": "timestamp with time zone",
179
+ "primaryKey": false,
180
+ "notNull": false
181
+ },
182
+ "refresh_token_expires_at": {
183
+ "name": "refresh_token_expires_at",
184
+ "type": "timestamp with time zone",
185
+ "primaryKey": false,
186
+ "notNull": false
187
+ },
188
+ "scope": {
189
+ "name": "scope",
190
+ "type": "text",
191
+ "primaryKey": false,
192
+ "notNull": false
193
+ },
194
+ "password": {
195
+ "name": "password",
196
+ "type": "text",
197
+ "primaryKey": false,
198
+ "notNull": false
199
+ },
200
+ "created_at": {
201
+ "name": "created_at",
202
+ "type": "timestamp with time zone",
203
+ "primaryKey": false,
204
+ "notNull": true,
205
+ "default": "now()"
206
+ },
207
+ "updated_at": {
208
+ "name": "updated_at",
209
+ "type": "timestamp with time zone",
210
+ "primaryKey": false,
211
+ "notNull": true,
212
+ "default": "now()"
213
+ }
214
+ },
215
+ "indexes": {},
216
+ "foreignKeys": {
217
+ "hf_account_user_id_hf_user_id_fk": {
218
+ "name": "hf_account_user_id_hf_user_id_fk",
219
+ "tableFrom": "hf_account",
220
+ "columnsFrom": [
221
+ "user_id"
222
+ ],
223
+ "tableTo": "hf_user",
224
+ "columnsTo": [
225
+ "id"
226
+ ],
227
+ "onUpdate": "no action",
228
+ "onDelete": "cascade"
229
+ }
230
+ },
231
+ "compositePrimaryKeys": {},
232
+ "uniqueConstraints": {},
233
+ "policies": {},
234
+ "checkConstraints": {},
235
+ "isRLSEnabled": false
236
+ },
237
+ "public.hf_member": {
238
+ "name": "hf_member",
239
+ "schema": "",
240
+ "columns": {
241
+ "id": {
242
+ "name": "id",
243
+ "type": "text",
244
+ "primaryKey": true,
245
+ "notNull": true
246
+ },
247
+ "organization_id": {
248
+ "name": "organization_id",
249
+ "type": "text",
250
+ "primaryKey": false,
251
+ "notNull": true
252
+ },
253
+ "user_id": {
254
+ "name": "user_id",
255
+ "type": "text",
256
+ "primaryKey": false,
257
+ "notNull": true
258
+ },
259
+ "role": {
260
+ "name": "role",
261
+ "type": "text",
262
+ "primaryKey": false,
263
+ "notNull": true,
264
+ "default": "'member'"
265
+ },
266
+ "created_at": {
267
+ "name": "created_at",
268
+ "type": "timestamp with time zone",
269
+ "primaryKey": false,
270
+ "notNull": true,
271
+ "default": "now()"
272
+ }
273
+ },
274
+ "indexes": {},
275
+ "foreignKeys": {
276
+ "hf_member_organization_id_hf_organization_id_fk": {
277
+ "name": "hf_member_organization_id_hf_organization_id_fk",
278
+ "tableFrom": "hf_member",
279
+ "columnsFrom": [
280
+ "organization_id"
281
+ ],
282
+ "tableTo": "hf_organization",
283
+ "columnsTo": [
284
+ "id"
285
+ ],
286
+ "onUpdate": "no action",
287
+ "onDelete": "cascade"
288
+ },
289
+ "hf_member_user_id_hf_user_id_fk": {
290
+ "name": "hf_member_user_id_hf_user_id_fk",
291
+ "tableFrom": "hf_member",
292
+ "columnsFrom": [
293
+ "user_id"
294
+ ],
295
+ "tableTo": "hf_user",
296
+ "columnsTo": [
297
+ "id"
298
+ ],
299
+ "onUpdate": "no action",
300
+ "onDelete": "cascade"
301
+ }
302
+ },
303
+ "compositePrimaryKeys": {},
304
+ "uniqueConstraints": {},
305
+ "policies": {},
306
+ "checkConstraints": {},
307
+ "isRLSEnabled": false
308
+ },
309
+ "public.hf_organization": {
310
+ "name": "hf_organization",
311
+ "schema": "",
312
+ "columns": {
313
+ "id": {
314
+ "name": "id",
315
+ "type": "text",
316
+ "primaryKey": true,
317
+ "notNull": true
318
+ },
319
+ "name": {
320
+ "name": "name",
321
+ "type": "text",
322
+ "primaryKey": false,
323
+ "notNull": true
324
+ },
325
+ "slug": {
326
+ "name": "slug",
327
+ "type": "text",
328
+ "primaryKey": false,
329
+ "notNull": true
330
+ },
331
+ "logo": {
332
+ "name": "logo",
333
+ "type": "text",
334
+ "primaryKey": false,
335
+ "notNull": false
336
+ },
337
+ "created_at": {
338
+ "name": "created_at",
339
+ "type": "timestamp with time zone",
340
+ "primaryKey": false,
341
+ "notNull": true,
342
+ "default": "now()"
343
+ },
344
+ "metadata": {
345
+ "name": "metadata",
346
+ "type": "text",
347
+ "primaryKey": false,
348
+ "notNull": false
349
+ }
350
+ },
351
+ "indexes": {},
352
+ "foreignKeys": {},
353
+ "compositePrimaryKeys": {},
354
+ "uniqueConstraints": {
355
+ "hf_organization_slug_unique": {
356
+ "name": "hf_organization_slug_unique",
357
+ "columns": [
358
+ "slug"
359
+ ],
360
+ "nullsNotDistinct": false
361
+ }
362
+ },
363
+ "policies": {},
364
+ "checkConstraints": {},
365
+ "isRLSEnabled": false
366
+ },
367
+ "public.hf_passkey": {
368
+ "name": "hf_passkey",
369
+ "schema": "",
370
+ "columns": {
371
+ "id": {
372
+ "name": "id",
373
+ "type": "text",
374
+ "primaryKey": true,
375
+ "notNull": true
376
+ },
377
+ "name": {
378
+ "name": "name",
379
+ "type": "text",
380
+ "primaryKey": false,
381
+ "notNull": false
382
+ },
383
+ "public_key": {
384
+ "name": "public_key",
385
+ "type": "text",
386
+ "primaryKey": false,
387
+ "notNull": true
388
+ },
389
+ "user_id": {
390
+ "name": "user_id",
391
+ "type": "text",
392
+ "primaryKey": false,
393
+ "notNull": true
394
+ },
395
+ "credential_id": {
396
+ "name": "credential_id",
397
+ "type": "text",
398
+ "primaryKey": false,
399
+ "notNull": true
400
+ },
401
+ "counter": {
402
+ "name": "counter",
403
+ "type": "integer",
404
+ "primaryKey": false,
405
+ "notNull": true
406
+ },
407
+ "device_type": {
408
+ "name": "device_type",
409
+ "type": "text",
410
+ "primaryKey": false,
411
+ "notNull": true
412
+ },
413
+ "backed_up": {
414
+ "name": "backed_up",
415
+ "type": "boolean",
416
+ "primaryKey": false,
417
+ "notNull": true
418
+ },
419
+ "transports": {
420
+ "name": "transports",
421
+ "type": "text",
422
+ "primaryKey": false,
423
+ "notNull": false
424
+ },
425
+ "created_at": {
426
+ "name": "created_at",
427
+ "type": "timestamp with time zone",
428
+ "primaryKey": false,
429
+ "notNull": false,
430
+ "default": "now()"
431
+ },
432
+ "aaguid": {
433
+ "name": "aaguid",
434
+ "type": "text",
435
+ "primaryKey": false,
436
+ "notNull": false
437
+ }
438
+ },
439
+ "indexes": {},
440
+ "foreignKeys": {
441
+ "hf_passkey_user_id_hf_user_id_fk": {
442
+ "name": "hf_passkey_user_id_hf_user_id_fk",
443
+ "tableFrom": "hf_passkey",
444
+ "columnsFrom": [
445
+ "user_id"
446
+ ],
447
+ "tableTo": "hf_user",
448
+ "columnsTo": [
449
+ "id"
450
+ ],
451
+ "onUpdate": "no action",
452
+ "onDelete": "cascade"
453
+ }
454
+ },
455
+ "compositePrimaryKeys": {},
456
+ "uniqueConstraints": {},
457
+ "policies": {},
458
+ "checkConstraints": {},
459
+ "isRLSEnabled": false
460
+ },
461
+ "public.hf_session": {
462
+ "name": "hf_session",
463
+ "schema": "",
464
+ "columns": {
465
+ "id": {
466
+ "name": "id",
467
+ "type": "text",
468
+ "primaryKey": true,
469
+ "notNull": true
470
+ },
471
+ "expires_at": {
472
+ "name": "expires_at",
473
+ "type": "timestamp with time zone",
474
+ "primaryKey": false,
475
+ "notNull": true
476
+ },
477
+ "token": {
478
+ "name": "token",
479
+ "type": "text",
480
+ "primaryKey": false,
481
+ "notNull": true
482
+ },
483
+ "created_at": {
484
+ "name": "created_at",
485
+ "type": "timestamp with time zone",
486
+ "primaryKey": false,
487
+ "notNull": true,
488
+ "default": "now()"
489
+ },
490
+ "updated_at": {
491
+ "name": "updated_at",
492
+ "type": "timestamp with time zone",
493
+ "primaryKey": false,
494
+ "notNull": true,
495
+ "default": "now()"
496
+ },
497
+ "ip_address": {
498
+ "name": "ip_address",
499
+ "type": "text",
500
+ "primaryKey": false,
501
+ "notNull": false
502
+ },
503
+ "user_agent": {
504
+ "name": "user_agent",
505
+ "type": "text",
506
+ "primaryKey": false,
507
+ "notNull": false
508
+ },
509
+ "user_id": {
510
+ "name": "user_id",
511
+ "type": "text",
512
+ "primaryKey": false,
513
+ "notNull": true
514
+ },
515
+ "active_organization_id": {
516
+ "name": "active_organization_id",
517
+ "type": "text",
518
+ "primaryKey": false,
519
+ "notNull": false
520
+ },
521
+ "impersonated_by": {
522
+ "name": "impersonated_by",
523
+ "type": "text",
524
+ "primaryKey": false,
525
+ "notNull": false
526
+ },
527
+ "factor": {
528
+ "name": "factor",
529
+ "type": "text",
530
+ "primaryKey": false,
531
+ "notNull": true,
532
+ "default": "'code'"
533
+ }
534
+ },
535
+ "indexes": {},
536
+ "foreignKeys": {
537
+ "hf_session_user_id_hf_user_id_fk": {
538
+ "name": "hf_session_user_id_hf_user_id_fk",
539
+ "tableFrom": "hf_session",
540
+ "columnsFrom": [
541
+ "user_id"
542
+ ],
543
+ "tableTo": "hf_user",
544
+ "columnsTo": [
545
+ "id"
546
+ ],
547
+ "onUpdate": "no action",
548
+ "onDelete": "cascade"
549
+ }
550
+ },
551
+ "compositePrimaryKeys": {},
552
+ "uniqueConstraints": {
553
+ "hf_session_token_unique": {
554
+ "name": "hf_session_token_unique",
555
+ "columns": [
556
+ "token"
557
+ ],
558
+ "nullsNotDistinct": false
559
+ }
560
+ },
561
+ "policies": {},
562
+ "checkConstraints": {},
563
+ "isRLSEnabled": false
564
+ },
565
+ "public.hf_user": {
566
+ "name": "hf_user",
567
+ "schema": "",
568
+ "columns": {
569
+ "id": {
570
+ "name": "id",
571
+ "type": "text",
572
+ "primaryKey": true,
573
+ "notNull": true
574
+ },
575
+ "name": {
576
+ "name": "name",
577
+ "type": "text",
578
+ "primaryKey": false,
579
+ "notNull": true
580
+ },
581
+ "email": {
582
+ "name": "email",
583
+ "type": "text",
584
+ "primaryKey": false,
585
+ "notNull": true
586
+ },
587
+ "email_verified": {
588
+ "name": "email_verified",
589
+ "type": "boolean",
590
+ "primaryKey": false,
591
+ "notNull": true,
592
+ "default": false
593
+ },
594
+ "image": {
595
+ "name": "image",
596
+ "type": "text",
597
+ "primaryKey": false,
598
+ "notNull": false
599
+ },
600
+ "created_at": {
601
+ "name": "created_at",
602
+ "type": "timestamp with time zone",
603
+ "primaryKey": false,
604
+ "notNull": true,
605
+ "default": "now()"
606
+ },
607
+ "updated_at": {
608
+ "name": "updated_at",
609
+ "type": "timestamp with time zone",
610
+ "primaryKey": false,
611
+ "notNull": true,
612
+ "default": "now()"
613
+ },
614
+ "role": {
615
+ "name": "role",
616
+ "type": "text",
617
+ "primaryKey": false,
618
+ "notNull": false
619
+ },
620
+ "banned": {
621
+ "name": "banned",
622
+ "type": "boolean",
623
+ "primaryKey": false,
624
+ "notNull": false,
625
+ "default": false
626
+ },
627
+ "ban_reason": {
628
+ "name": "ban_reason",
629
+ "type": "text",
630
+ "primaryKey": false,
631
+ "notNull": false
632
+ },
633
+ "ban_expires": {
634
+ "name": "ban_expires",
635
+ "type": "timestamp with time zone",
636
+ "primaryKey": false,
637
+ "notNull": false
638
+ }
639
+ },
640
+ "indexes": {},
641
+ "foreignKeys": {},
642
+ "compositePrimaryKeys": {},
643
+ "uniqueConstraints": {
644
+ "hf_user_email_unique": {
645
+ "name": "hf_user_email_unique",
646
+ "columns": [
647
+ "email"
648
+ ],
649
+ "nullsNotDistinct": false
650
+ }
651
+ },
652
+ "policies": {},
653
+ "checkConstraints": {},
654
+ "isRLSEnabled": false
655
+ },
656
+ "public.hf_verification": {
657
+ "name": "hf_verification",
658
+ "schema": "",
659
+ "columns": {
660
+ "id": {
661
+ "name": "id",
662
+ "type": "text",
663
+ "primaryKey": true,
664
+ "notNull": true
665
+ },
666
+ "identifier": {
667
+ "name": "identifier",
668
+ "type": "text",
669
+ "primaryKey": false,
670
+ "notNull": true
671
+ },
672
+ "value": {
673
+ "name": "value",
674
+ "type": "text",
675
+ "primaryKey": false,
676
+ "notNull": true
677
+ },
678
+ "expires_at": {
679
+ "name": "expires_at",
680
+ "type": "timestamp with time zone",
681
+ "primaryKey": false,
682
+ "notNull": true
683
+ },
684
+ "created_at": {
685
+ "name": "created_at",
686
+ "type": "timestamp with time zone",
687
+ "primaryKey": false,
688
+ "notNull": true,
689
+ "default": "now()"
690
+ },
691
+ "updated_at": {
692
+ "name": "updated_at",
693
+ "type": "timestamp with time zone",
694
+ "primaryKey": false,
695
+ "notNull": true,
696
+ "default": "now()"
697
+ }
698
+ },
699
+ "indexes": {},
700
+ "foreignKeys": {},
701
+ "compositePrimaryKeys": {},
702
+ "uniqueConstraints": {},
703
+ "policies": {},
704
+ "checkConstraints": {},
705
+ "isRLSEnabled": false
706
+ },
707
+ "public.hf_action_log": {
708
+ "name": "hf_action_log",
709
+ "schema": "",
710
+ "columns": {
711
+ "id": {
712
+ "name": "id",
713
+ "type": "bigint",
714
+ "primaryKey": true,
715
+ "notNull": true,
716
+ "identity": {
717
+ "name": "hf_action_log_id_seq",
718
+ "increment": "1",
719
+ "minValue": "1",
720
+ "maxValue": "9223372036854775807",
721
+ "startWith": "1",
722
+ "cache": "1",
723
+ "cycle": false,
724
+ "schema": "public",
725
+ "type": "always"
726
+ }
727
+ },
728
+ "run_id": {
729
+ "name": "run_id",
730
+ "type": "text",
731
+ "primaryKey": false,
732
+ "notNull": true
733
+ },
734
+ "key": {
735
+ "name": "key",
736
+ "type": "text",
737
+ "primaryKey": false,
738
+ "notNull": true
739
+ },
740
+ "workflow_id": {
741
+ "name": "workflow_id",
742
+ "type": "text",
743
+ "primaryKey": false,
744
+ "notNull": true
745
+ },
746
+ "channel": {
747
+ "name": "channel",
748
+ "type": "text",
749
+ "primaryKey": false,
750
+ "notNull": true
751
+ },
752
+ "idempotency_key": {
753
+ "name": "idempotency_key",
754
+ "type": "text",
755
+ "primaryKey": false,
756
+ "notNull": true
757
+ },
758
+ "status": {
759
+ "name": "status",
760
+ "type": "text",
761
+ "primaryKey": false,
762
+ "notNull": true
763
+ },
764
+ "external_id": {
765
+ "name": "external_id",
766
+ "type": "text",
767
+ "primaryKey": false,
768
+ "notNull": false
769
+ },
770
+ "approval_id": {
771
+ "name": "approval_id",
772
+ "type": "bigint",
773
+ "primaryKey": false,
774
+ "notNull": false
775
+ },
776
+ "record_type": {
777
+ "name": "record_type",
778
+ "type": "text",
779
+ "primaryKey": false,
780
+ "notNull": false
781
+ },
782
+ "record_id": {
783
+ "name": "record_id",
784
+ "type": "text",
785
+ "primaryKey": false,
786
+ "notNull": false
787
+ },
788
+ "request": {
789
+ "name": "request",
790
+ "type": "jsonb",
791
+ "primaryKey": false,
792
+ "notNull": false
793
+ },
794
+ "response": {
795
+ "name": "response",
796
+ "type": "jsonb",
797
+ "primaryKey": false,
798
+ "notNull": false
799
+ },
800
+ "started_at": {
801
+ "name": "started_at",
802
+ "type": "timestamp with time zone",
803
+ "primaryKey": false,
804
+ "notNull": true,
805
+ "default": "now()"
806
+ },
807
+ "finished_at": {
808
+ "name": "finished_at",
809
+ "type": "timestamp with time zone",
810
+ "primaryKey": false,
811
+ "notNull": false
812
+ }
813
+ },
814
+ "indexes": {
815
+ "hf_action_log_run_key_uq": {
816
+ "name": "hf_action_log_run_key_uq",
817
+ "columns": [
818
+ {
819
+ "expression": "run_id",
820
+ "isExpression": false,
821
+ "asc": true,
822
+ "nulls": "last"
823
+ },
824
+ {
825
+ "expression": "key",
826
+ "isExpression": false,
827
+ "asc": true,
828
+ "nulls": "last"
829
+ }
830
+ ],
831
+ "isUnique": true,
832
+ "with": {},
833
+ "method": "btree",
834
+ "concurrently": false
835
+ }
836
+ },
837
+ "foreignKeys": {},
838
+ "compositePrimaryKeys": {},
839
+ "uniqueConstraints": {},
840
+ "policies": {},
841
+ "checkConstraints": {},
842
+ "isRLSEnabled": false
843
+ },
844
+ "public.hf_budget_period": {
845
+ "name": "hf_budget_period",
846
+ "schema": "",
847
+ "columns": {
848
+ "period": {
849
+ "name": "period",
850
+ "type": "text",
851
+ "primaryKey": true,
852
+ "notNull": true
853
+ },
854
+ "budget_usd": {
855
+ "name": "budget_usd",
856
+ "type": "numeric(12, 4)",
857
+ "primaryKey": false,
858
+ "notNull": true
859
+ },
860
+ "spent_usd": {
861
+ "name": "spent_usd",
862
+ "type": "numeric(12, 4)",
863
+ "primaryKey": false,
864
+ "notNull": true,
865
+ "default": "'0'"
866
+ },
867
+ "created_at": {
868
+ "name": "created_at",
869
+ "type": "timestamp with time zone",
870
+ "primaryKey": false,
871
+ "notNull": true,
872
+ "default": "now()"
873
+ }
874
+ },
875
+ "indexes": {},
876
+ "foreignKeys": {},
877
+ "compositePrimaryKeys": {},
878
+ "uniqueConstraints": {},
879
+ "policies": {},
880
+ "checkConstraints": {
881
+ "hf_budget_period_spent_non_negative": {
882
+ "name": "hf_budget_period_spent_non_negative",
883
+ "value": "\"hf_budget_period\".\"spent_usd\" >= 0"
884
+ }
885
+ },
886
+ "isRLSEnabled": false
887
+ },
888
+ "public.hf_llm_call": {
889
+ "name": "hf_llm_call",
890
+ "schema": "",
891
+ "columns": {
892
+ "id": {
893
+ "name": "id",
894
+ "type": "bigint",
895
+ "primaryKey": true,
896
+ "notNull": true,
897
+ "identity": {
898
+ "name": "hf_llm_call_id_seq",
899
+ "increment": "1",
900
+ "minValue": "1",
901
+ "maxValue": "9223372036854775807",
902
+ "startWith": "1",
903
+ "cache": "1",
904
+ "cycle": false,
905
+ "schema": "public",
906
+ "type": "always"
907
+ }
908
+ },
909
+ "run_id": {
910
+ "name": "run_id",
911
+ "type": "text",
912
+ "primaryKey": false,
913
+ "notNull": true
914
+ },
915
+ "key": {
916
+ "name": "key",
917
+ "type": "text",
918
+ "primaryKey": false,
919
+ "notNull": true
920
+ },
921
+ "workflow_id": {
922
+ "name": "workflow_id",
923
+ "type": "text",
924
+ "primaryKey": false,
925
+ "notNull": true
926
+ },
927
+ "period": {
928
+ "name": "period",
929
+ "type": "text",
930
+ "primaryKey": false,
931
+ "notNull": true
932
+ },
933
+ "step_name": {
934
+ "name": "step_name",
935
+ "type": "text",
936
+ "primaryKey": false,
937
+ "notNull": false
938
+ },
939
+ "prompt_name": {
940
+ "name": "prompt_name",
941
+ "type": "text",
942
+ "primaryKey": false,
943
+ "notNull": false
944
+ },
945
+ "prompt_hash": {
946
+ "name": "prompt_hash",
947
+ "type": "text",
948
+ "primaryKey": false,
949
+ "notNull": false
950
+ },
951
+ "input_hash": {
952
+ "name": "input_hash",
953
+ "type": "text",
954
+ "primaryKey": false,
955
+ "notNull": true
956
+ },
957
+ "model": {
958
+ "name": "model",
959
+ "type": "text",
960
+ "primaryKey": false,
961
+ "notNull": false
962
+ },
963
+ "status": {
964
+ "name": "status",
965
+ "type": "text",
966
+ "primaryKey": false,
967
+ "notNull": true
968
+ },
969
+ "input": {
970
+ "name": "input",
971
+ "type": "jsonb",
972
+ "primaryKey": false,
973
+ "notNull": false
974
+ },
975
+ "output": {
976
+ "name": "output",
977
+ "type": "jsonb",
978
+ "primaryKey": false,
979
+ "notNull": false
980
+ },
981
+ "tokens_in": {
982
+ "name": "tokens_in",
983
+ "type": "integer",
984
+ "primaryKey": false,
985
+ "notNull": false
986
+ },
987
+ "tokens_out": {
988
+ "name": "tokens_out",
989
+ "type": "integer",
990
+ "primaryKey": false,
991
+ "notNull": false
992
+ },
993
+ "estimated_cost_usd": {
994
+ "name": "estimated_cost_usd",
995
+ "type": "numeric(12, 6)",
996
+ "primaryKey": false,
997
+ "notNull": true
998
+ },
999
+ "cost_usd": {
1000
+ "name": "cost_usd",
1001
+ "type": "numeric(12, 6)",
1002
+ "primaryKey": false,
1003
+ "notNull": false
1004
+ },
1005
+ "possible_double_charge": {
1006
+ "name": "possible_double_charge",
1007
+ "type": "boolean",
1008
+ "primaryKey": false,
1009
+ "notNull": true,
1010
+ "default": false
1011
+ },
1012
+ "latency_ms": {
1013
+ "name": "latency_ms",
1014
+ "type": "integer",
1015
+ "primaryKey": false,
1016
+ "notNull": false
1017
+ },
1018
+ "trace_id": {
1019
+ "name": "trace_id",
1020
+ "type": "text",
1021
+ "primaryKey": false,
1022
+ "notNull": false
1023
+ },
1024
+ "started_at": {
1025
+ "name": "started_at",
1026
+ "type": "timestamp with time zone",
1027
+ "primaryKey": false,
1028
+ "notNull": true,
1029
+ "default": "now()"
1030
+ },
1031
+ "finished_at": {
1032
+ "name": "finished_at",
1033
+ "type": "timestamp with time zone",
1034
+ "primaryKey": false,
1035
+ "notNull": false
1036
+ }
1037
+ },
1038
+ "indexes": {
1039
+ "hf_llm_call_run_key_uq": {
1040
+ "name": "hf_llm_call_run_key_uq",
1041
+ "columns": [
1042
+ {
1043
+ "expression": "run_id",
1044
+ "isExpression": false,
1045
+ "asc": true,
1046
+ "nulls": "last"
1047
+ },
1048
+ {
1049
+ "expression": "key",
1050
+ "isExpression": false,
1051
+ "asc": true,
1052
+ "nulls": "last"
1053
+ }
1054
+ ],
1055
+ "isUnique": true,
1056
+ "with": {},
1057
+ "method": "btree",
1058
+ "concurrently": false
1059
+ },
1060
+ "hf_llm_call_period_status_idx": {
1061
+ "name": "hf_llm_call_period_status_idx",
1062
+ "columns": [
1063
+ {
1064
+ "expression": "period",
1065
+ "isExpression": false,
1066
+ "asc": true,
1067
+ "nulls": "last"
1068
+ },
1069
+ {
1070
+ "expression": "status",
1071
+ "isExpression": false,
1072
+ "asc": true,
1073
+ "nulls": "last"
1074
+ }
1075
+ ],
1076
+ "isUnique": false,
1077
+ "with": {},
1078
+ "method": "btree",
1079
+ "concurrently": false
1080
+ }
1081
+ },
1082
+ "foreignKeys": {},
1083
+ "compositePrimaryKeys": {},
1084
+ "uniqueConstraints": {},
1085
+ "policies": {},
1086
+ "checkConstraints": {},
1087
+ "isRLSEnabled": false
1088
+ },
1089
+ "public.hf_run": {
1090
+ "name": "hf_run",
1091
+ "schema": "",
1092
+ "columns": {
1093
+ "run_id": {
1094
+ "name": "run_id",
1095
+ "type": "text",
1096
+ "primaryKey": true,
1097
+ "notNull": true
1098
+ },
1099
+ "flow": {
1100
+ "name": "flow",
1101
+ "type": "text",
1102
+ "primaryKey": false,
1103
+ "notNull": true
1104
+ },
1105
+ "input": {
1106
+ "name": "input",
1107
+ "type": "jsonb",
1108
+ "primaryKey": false,
1109
+ "notNull": false
1110
+ },
1111
+ "status": {
1112
+ "name": "status",
1113
+ "type": "text",
1114
+ "primaryKey": false,
1115
+ "notNull": true
1116
+ },
1117
+ "attempt": {
1118
+ "name": "attempt",
1119
+ "type": "integer",
1120
+ "primaryKey": false,
1121
+ "notNull": true,
1122
+ "default": 1
1123
+ },
1124
+ "current_workflow_id": {
1125
+ "name": "current_workflow_id",
1126
+ "type": "text",
1127
+ "primaryKey": false,
1128
+ "notNull": true
1129
+ },
1130
+ "version": {
1131
+ "name": "version",
1132
+ "type": "text",
1133
+ "primaryKey": false,
1134
+ "notNull": false
1135
+ },
1136
+ "record_type": {
1137
+ "name": "record_type",
1138
+ "type": "text",
1139
+ "primaryKey": false,
1140
+ "notNull": false
1141
+ },
1142
+ "record_id": {
1143
+ "name": "record_id",
1144
+ "type": "text",
1145
+ "primaryKey": false,
1146
+ "notNull": false
1147
+ },
1148
+ "error": {
1149
+ "name": "error",
1150
+ "type": "text",
1151
+ "primaryKey": false,
1152
+ "notNull": false
1153
+ },
1154
+ "started_at": {
1155
+ "name": "started_at",
1156
+ "type": "timestamp with time zone",
1157
+ "primaryKey": false,
1158
+ "notNull": true,
1159
+ "default": "now()"
1160
+ },
1161
+ "finished_at": {
1162
+ "name": "finished_at",
1163
+ "type": "timestamp with time zone",
1164
+ "primaryKey": false,
1165
+ "notNull": false
1166
+ }
1167
+ },
1168
+ "indexes": {
1169
+ "hf_run_status_idx": {
1170
+ "name": "hf_run_status_idx",
1171
+ "columns": [
1172
+ {
1173
+ "expression": "status",
1174
+ "isExpression": false,
1175
+ "asc": true,
1176
+ "nulls": "last"
1177
+ }
1178
+ ],
1179
+ "isUnique": false,
1180
+ "with": {},
1181
+ "method": "btree",
1182
+ "concurrently": false
1183
+ },
1184
+ "hf_run_record_idx": {
1185
+ "name": "hf_run_record_idx",
1186
+ "columns": [
1187
+ {
1188
+ "expression": "record_type",
1189
+ "isExpression": false,
1190
+ "asc": true,
1191
+ "nulls": "last"
1192
+ },
1193
+ {
1194
+ "expression": "record_id",
1195
+ "isExpression": false,
1196
+ "asc": true,
1197
+ "nulls": "last"
1198
+ }
1199
+ ],
1200
+ "isUnique": false,
1201
+ "with": {},
1202
+ "method": "btree",
1203
+ "concurrently": false
1204
+ }
1205
+ },
1206
+ "foreignKeys": {},
1207
+ "compositePrimaryKeys": {},
1208
+ "uniqueConstraints": {
1209
+ "hf_run_current_workflow_id_unique": {
1210
+ "name": "hf_run_current_workflow_id_unique",
1211
+ "columns": [
1212
+ "current_workflow_id"
1213
+ ],
1214
+ "nullsNotDistinct": false
1215
+ }
1216
+ },
1217
+ "policies": {},
1218
+ "checkConstraints": {
1219
+ "hf_run_attempt_positive": {
1220
+ "name": "hf_run_attempt_positive",
1221
+ "value": "\"hf_run\".\"attempt\" >= 1"
1222
+ }
1223
+ },
1224
+ "isRLSEnabled": false
1225
+ }
1226
+ },
1227
+ "enums": {},
1228
+ "schemas": {},
1229
+ "views": {},
1230
+ "sequences": {},
1231
+ "roles": {},
1232
+ "policies": {},
1233
+ "_meta": {
1234
+ "columns": {},
1235
+ "schemas": {},
1236
+ "tables": {}
1237
+ }
1238
+ }