@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,1426 @@
1
+ {
2
+ "id": "c34347f5-4270-4bf6-9f7a-4921684019d7",
3
+ "prevId": "9c8c9d12-a393-4f73-b2f9-727fbb7fe5e8",
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
+ "type": "always",
74
+ "name": "hf_audit_id_seq",
75
+ "schema": "public",
76
+ "increment": "1",
77
+ "startWith": "1",
78
+ "minValue": "1",
79
+ "maxValue": "9223372036854775807",
80
+ "cache": "1",
81
+ "cycle": false
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_approval": {
131
+ "name": "hf_approval",
132
+ "schema": "",
133
+ "columns": {
134
+ "id": {
135
+ "name": "id",
136
+ "type": "bigint",
137
+ "primaryKey": true,
138
+ "notNull": true,
139
+ "identity": {
140
+ "type": "always",
141
+ "name": "hf_approval_id_seq",
142
+ "schema": "public",
143
+ "increment": "1",
144
+ "startWith": "1",
145
+ "minValue": "1",
146
+ "maxValue": "9223372036854775807",
147
+ "cache": "1",
148
+ "cycle": false
149
+ }
150
+ },
151
+ "run_id": {
152
+ "name": "run_id",
153
+ "type": "text",
154
+ "primaryKey": false,
155
+ "notNull": true
156
+ },
157
+ "key": {
158
+ "name": "key",
159
+ "type": "text",
160
+ "primaryKey": false,
161
+ "notNull": true
162
+ },
163
+ "workflow_id": {
164
+ "name": "workflow_id",
165
+ "type": "text",
166
+ "primaryKey": false,
167
+ "notNull": true
168
+ },
169
+ "type": {
170
+ "name": "type",
171
+ "type": "text",
172
+ "primaryKey": false,
173
+ "notNull": true
174
+ },
175
+ "record_type": {
176
+ "name": "record_type",
177
+ "type": "text",
178
+ "primaryKey": false,
179
+ "notNull": false
180
+ },
181
+ "record_id": {
182
+ "name": "record_id",
183
+ "type": "text",
184
+ "primaryKey": false,
185
+ "notNull": false
186
+ },
187
+ "draft": {
188
+ "name": "draft",
189
+ "type": "jsonb",
190
+ "primaryKey": false,
191
+ "notNull": false
192
+ },
193
+ "edited_draft": {
194
+ "name": "edited_draft",
195
+ "type": "jsonb",
196
+ "primaryKey": false,
197
+ "notNull": false
198
+ },
199
+ "status": {
200
+ "name": "status",
201
+ "type": "text",
202
+ "primaryKey": false,
203
+ "notNull": true
204
+ },
205
+ "assignee_id": {
206
+ "name": "assignee_id",
207
+ "type": "text",
208
+ "primaryKey": false,
209
+ "notNull": false
210
+ },
211
+ "decided_by": {
212
+ "name": "decided_by",
213
+ "type": "text",
214
+ "primaryKey": false,
215
+ "notNull": false
216
+ },
217
+ "decided_at": {
218
+ "name": "decided_at",
219
+ "type": "timestamp with time zone",
220
+ "primaryKey": false,
221
+ "notNull": false
222
+ },
223
+ "decided_via": {
224
+ "name": "decided_via",
225
+ "type": "text",
226
+ "primaryKey": false,
227
+ "notNull": false
228
+ },
229
+ "decision_key": {
230
+ "name": "decision_key",
231
+ "type": "text",
232
+ "primaryKey": false,
233
+ "notNull": false
234
+ },
235
+ "resume_workflow_id": {
236
+ "name": "resume_workflow_id",
237
+ "type": "text",
238
+ "primaryKey": false,
239
+ "notNull": false
240
+ },
241
+ "notified_at": {
242
+ "name": "notified_at",
243
+ "type": "timestamp with time zone",
244
+ "primaryKey": false,
245
+ "notNull": false
246
+ },
247
+ "expires_at": {
248
+ "name": "expires_at",
249
+ "type": "timestamp with time zone",
250
+ "primaryKey": false,
251
+ "notNull": false
252
+ },
253
+ "batch_id": {
254
+ "name": "batch_id",
255
+ "type": "text",
256
+ "primaryKey": false,
257
+ "notNull": false
258
+ },
259
+ "created_at": {
260
+ "name": "created_at",
261
+ "type": "timestamp with time zone",
262
+ "primaryKey": false,
263
+ "notNull": true,
264
+ "default": "now()"
265
+ }
266
+ },
267
+ "indexes": {
268
+ "hf_approval_run_key_uq": {
269
+ "name": "hf_approval_run_key_uq",
270
+ "columns": [
271
+ {
272
+ "expression": "run_id",
273
+ "isExpression": false,
274
+ "asc": true,
275
+ "nulls": "last"
276
+ },
277
+ {
278
+ "expression": "key",
279
+ "isExpression": false,
280
+ "asc": true,
281
+ "nulls": "last"
282
+ }
283
+ ],
284
+ "isUnique": true,
285
+ "concurrently": false,
286
+ "method": "btree",
287
+ "with": {}
288
+ },
289
+ "hf_approval_status_idx": {
290
+ "name": "hf_approval_status_idx",
291
+ "columns": [
292
+ {
293
+ "expression": "status",
294
+ "isExpression": false,
295
+ "asc": true,
296
+ "nulls": "last"
297
+ },
298
+ {
299
+ "expression": "expires_at",
300
+ "isExpression": false,
301
+ "asc": true,
302
+ "nulls": "last"
303
+ }
304
+ ],
305
+ "isUnique": false,
306
+ "concurrently": false,
307
+ "method": "btree",
308
+ "with": {}
309
+ }
310
+ },
311
+ "foreignKeys": {},
312
+ "compositePrimaryKeys": {},
313
+ "uniqueConstraints": {},
314
+ "policies": {},
315
+ "checkConstraints": {},
316
+ "isRLSEnabled": false
317
+ },
318
+ "public.hf_account": {
319
+ "name": "hf_account",
320
+ "schema": "",
321
+ "columns": {
322
+ "id": {
323
+ "name": "id",
324
+ "type": "text",
325
+ "primaryKey": true,
326
+ "notNull": true
327
+ },
328
+ "account_id": {
329
+ "name": "account_id",
330
+ "type": "text",
331
+ "primaryKey": false,
332
+ "notNull": true
333
+ },
334
+ "provider_id": {
335
+ "name": "provider_id",
336
+ "type": "text",
337
+ "primaryKey": false,
338
+ "notNull": true
339
+ },
340
+ "user_id": {
341
+ "name": "user_id",
342
+ "type": "text",
343
+ "primaryKey": false,
344
+ "notNull": true
345
+ },
346
+ "access_token": {
347
+ "name": "access_token",
348
+ "type": "text",
349
+ "primaryKey": false,
350
+ "notNull": false
351
+ },
352
+ "refresh_token": {
353
+ "name": "refresh_token",
354
+ "type": "text",
355
+ "primaryKey": false,
356
+ "notNull": false
357
+ },
358
+ "id_token": {
359
+ "name": "id_token",
360
+ "type": "text",
361
+ "primaryKey": false,
362
+ "notNull": false
363
+ },
364
+ "access_token_expires_at": {
365
+ "name": "access_token_expires_at",
366
+ "type": "timestamp with time zone",
367
+ "primaryKey": false,
368
+ "notNull": false
369
+ },
370
+ "refresh_token_expires_at": {
371
+ "name": "refresh_token_expires_at",
372
+ "type": "timestamp with time zone",
373
+ "primaryKey": false,
374
+ "notNull": false
375
+ },
376
+ "scope": {
377
+ "name": "scope",
378
+ "type": "text",
379
+ "primaryKey": false,
380
+ "notNull": false
381
+ },
382
+ "password": {
383
+ "name": "password",
384
+ "type": "text",
385
+ "primaryKey": false,
386
+ "notNull": false
387
+ },
388
+ "created_at": {
389
+ "name": "created_at",
390
+ "type": "timestamp with time zone",
391
+ "primaryKey": false,
392
+ "notNull": true,
393
+ "default": "now()"
394
+ },
395
+ "updated_at": {
396
+ "name": "updated_at",
397
+ "type": "timestamp with time zone",
398
+ "primaryKey": false,
399
+ "notNull": true,
400
+ "default": "now()"
401
+ }
402
+ },
403
+ "indexes": {},
404
+ "foreignKeys": {
405
+ "hf_account_user_id_hf_user_id_fk": {
406
+ "name": "hf_account_user_id_hf_user_id_fk",
407
+ "tableFrom": "hf_account",
408
+ "tableTo": "hf_user",
409
+ "columnsFrom": [
410
+ "user_id"
411
+ ],
412
+ "columnsTo": [
413
+ "id"
414
+ ],
415
+ "onDelete": "cascade",
416
+ "onUpdate": "no action"
417
+ }
418
+ },
419
+ "compositePrimaryKeys": {},
420
+ "uniqueConstraints": {},
421
+ "policies": {},
422
+ "checkConstraints": {},
423
+ "isRLSEnabled": false
424
+ },
425
+ "public.hf_member": {
426
+ "name": "hf_member",
427
+ "schema": "",
428
+ "columns": {
429
+ "id": {
430
+ "name": "id",
431
+ "type": "text",
432
+ "primaryKey": true,
433
+ "notNull": true
434
+ },
435
+ "organization_id": {
436
+ "name": "organization_id",
437
+ "type": "text",
438
+ "primaryKey": false,
439
+ "notNull": true
440
+ },
441
+ "user_id": {
442
+ "name": "user_id",
443
+ "type": "text",
444
+ "primaryKey": false,
445
+ "notNull": true
446
+ },
447
+ "role": {
448
+ "name": "role",
449
+ "type": "text",
450
+ "primaryKey": false,
451
+ "notNull": true,
452
+ "default": "'member'"
453
+ },
454
+ "created_at": {
455
+ "name": "created_at",
456
+ "type": "timestamp with time zone",
457
+ "primaryKey": false,
458
+ "notNull": true,
459
+ "default": "now()"
460
+ }
461
+ },
462
+ "indexes": {},
463
+ "foreignKeys": {
464
+ "hf_member_organization_id_hf_organization_id_fk": {
465
+ "name": "hf_member_organization_id_hf_organization_id_fk",
466
+ "tableFrom": "hf_member",
467
+ "tableTo": "hf_organization",
468
+ "columnsFrom": [
469
+ "organization_id"
470
+ ],
471
+ "columnsTo": [
472
+ "id"
473
+ ],
474
+ "onDelete": "cascade",
475
+ "onUpdate": "no action"
476
+ },
477
+ "hf_member_user_id_hf_user_id_fk": {
478
+ "name": "hf_member_user_id_hf_user_id_fk",
479
+ "tableFrom": "hf_member",
480
+ "tableTo": "hf_user",
481
+ "columnsFrom": [
482
+ "user_id"
483
+ ],
484
+ "columnsTo": [
485
+ "id"
486
+ ],
487
+ "onDelete": "cascade",
488
+ "onUpdate": "no action"
489
+ }
490
+ },
491
+ "compositePrimaryKeys": {},
492
+ "uniqueConstraints": {},
493
+ "policies": {},
494
+ "checkConstraints": {},
495
+ "isRLSEnabled": false
496
+ },
497
+ "public.hf_organization": {
498
+ "name": "hf_organization",
499
+ "schema": "",
500
+ "columns": {
501
+ "id": {
502
+ "name": "id",
503
+ "type": "text",
504
+ "primaryKey": true,
505
+ "notNull": true
506
+ },
507
+ "name": {
508
+ "name": "name",
509
+ "type": "text",
510
+ "primaryKey": false,
511
+ "notNull": true
512
+ },
513
+ "slug": {
514
+ "name": "slug",
515
+ "type": "text",
516
+ "primaryKey": false,
517
+ "notNull": true
518
+ },
519
+ "logo": {
520
+ "name": "logo",
521
+ "type": "text",
522
+ "primaryKey": false,
523
+ "notNull": false
524
+ },
525
+ "created_at": {
526
+ "name": "created_at",
527
+ "type": "timestamp with time zone",
528
+ "primaryKey": false,
529
+ "notNull": true,
530
+ "default": "now()"
531
+ },
532
+ "metadata": {
533
+ "name": "metadata",
534
+ "type": "text",
535
+ "primaryKey": false,
536
+ "notNull": false
537
+ }
538
+ },
539
+ "indexes": {},
540
+ "foreignKeys": {},
541
+ "compositePrimaryKeys": {},
542
+ "uniqueConstraints": {
543
+ "hf_organization_slug_unique": {
544
+ "name": "hf_organization_slug_unique",
545
+ "nullsNotDistinct": false,
546
+ "columns": [
547
+ "slug"
548
+ ]
549
+ }
550
+ },
551
+ "policies": {},
552
+ "checkConstraints": {},
553
+ "isRLSEnabled": false
554
+ },
555
+ "public.hf_passkey": {
556
+ "name": "hf_passkey",
557
+ "schema": "",
558
+ "columns": {
559
+ "id": {
560
+ "name": "id",
561
+ "type": "text",
562
+ "primaryKey": true,
563
+ "notNull": true
564
+ },
565
+ "name": {
566
+ "name": "name",
567
+ "type": "text",
568
+ "primaryKey": false,
569
+ "notNull": false
570
+ },
571
+ "public_key": {
572
+ "name": "public_key",
573
+ "type": "text",
574
+ "primaryKey": false,
575
+ "notNull": true
576
+ },
577
+ "user_id": {
578
+ "name": "user_id",
579
+ "type": "text",
580
+ "primaryKey": false,
581
+ "notNull": true
582
+ },
583
+ "credential_id": {
584
+ "name": "credential_id",
585
+ "type": "text",
586
+ "primaryKey": false,
587
+ "notNull": true
588
+ },
589
+ "counter": {
590
+ "name": "counter",
591
+ "type": "integer",
592
+ "primaryKey": false,
593
+ "notNull": true
594
+ },
595
+ "device_type": {
596
+ "name": "device_type",
597
+ "type": "text",
598
+ "primaryKey": false,
599
+ "notNull": true
600
+ },
601
+ "backed_up": {
602
+ "name": "backed_up",
603
+ "type": "boolean",
604
+ "primaryKey": false,
605
+ "notNull": true
606
+ },
607
+ "transports": {
608
+ "name": "transports",
609
+ "type": "text",
610
+ "primaryKey": false,
611
+ "notNull": false
612
+ },
613
+ "created_at": {
614
+ "name": "created_at",
615
+ "type": "timestamp with time zone",
616
+ "primaryKey": false,
617
+ "notNull": false,
618
+ "default": "now()"
619
+ },
620
+ "aaguid": {
621
+ "name": "aaguid",
622
+ "type": "text",
623
+ "primaryKey": false,
624
+ "notNull": false
625
+ }
626
+ },
627
+ "indexes": {},
628
+ "foreignKeys": {
629
+ "hf_passkey_user_id_hf_user_id_fk": {
630
+ "name": "hf_passkey_user_id_hf_user_id_fk",
631
+ "tableFrom": "hf_passkey",
632
+ "tableTo": "hf_user",
633
+ "columnsFrom": [
634
+ "user_id"
635
+ ],
636
+ "columnsTo": [
637
+ "id"
638
+ ],
639
+ "onDelete": "cascade",
640
+ "onUpdate": "no action"
641
+ }
642
+ },
643
+ "compositePrimaryKeys": {},
644
+ "uniqueConstraints": {},
645
+ "policies": {},
646
+ "checkConstraints": {},
647
+ "isRLSEnabled": false
648
+ },
649
+ "public.hf_session": {
650
+ "name": "hf_session",
651
+ "schema": "",
652
+ "columns": {
653
+ "id": {
654
+ "name": "id",
655
+ "type": "text",
656
+ "primaryKey": true,
657
+ "notNull": true
658
+ },
659
+ "expires_at": {
660
+ "name": "expires_at",
661
+ "type": "timestamp with time zone",
662
+ "primaryKey": false,
663
+ "notNull": true
664
+ },
665
+ "token": {
666
+ "name": "token",
667
+ "type": "text",
668
+ "primaryKey": false,
669
+ "notNull": true
670
+ },
671
+ "created_at": {
672
+ "name": "created_at",
673
+ "type": "timestamp with time zone",
674
+ "primaryKey": false,
675
+ "notNull": true,
676
+ "default": "now()"
677
+ },
678
+ "updated_at": {
679
+ "name": "updated_at",
680
+ "type": "timestamp with time zone",
681
+ "primaryKey": false,
682
+ "notNull": true,
683
+ "default": "now()"
684
+ },
685
+ "ip_address": {
686
+ "name": "ip_address",
687
+ "type": "text",
688
+ "primaryKey": false,
689
+ "notNull": false
690
+ },
691
+ "user_agent": {
692
+ "name": "user_agent",
693
+ "type": "text",
694
+ "primaryKey": false,
695
+ "notNull": false
696
+ },
697
+ "user_id": {
698
+ "name": "user_id",
699
+ "type": "text",
700
+ "primaryKey": false,
701
+ "notNull": true
702
+ },
703
+ "active_organization_id": {
704
+ "name": "active_organization_id",
705
+ "type": "text",
706
+ "primaryKey": false,
707
+ "notNull": false
708
+ },
709
+ "impersonated_by": {
710
+ "name": "impersonated_by",
711
+ "type": "text",
712
+ "primaryKey": false,
713
+ "notNull": false
714
+ },
715
+ "factor": {
716
+ "name": "factor",
717
+ "type": "text",
718
+ "primaryKey": false,
719
+ "notNull": true,
720
+ "default": "'code'"
721
+ }
722
+ },
723
+ "indexes": {},
724
+ "foreignKeys": {
725
+ "hf_session_user_id_hf_user_id_fk": {
726
+ "name": "hf_session_user_id_hf_user_id_fk",
727
+ "tableFrom": "hf_session",
728
+ "tableTo": "hf_user",
729
+ "columnsFrom": [
730
+ "user_id"
731
+ ],
732
+ "columnsTo": [
733
+ "id"
734
+ ],
735
+ "onDelete": "cascade",
736
+ "onUpdate": "no action"
737
+ }
738
+ },
739
+ "compositePrimaryKeys": {},
740
+ "uniqueConstraints": {
741
+ "hf_session_token_unique": {
742
+ "name": "hf_session_token_unique",
743
+ "nullsNotDistinct": false,
744
+ "columns": [
745
+ "token"
746
+ ]
747
+ }
748
+ },
749
+ "policies": {},
750
+ "checkConstraints": {},
751
+ "isRLSEnabled": false
752
+ },
753
+ "public.hf_user": {
754
+ "name": "hf_user",
755
+ "schema": "",
756
+ "columns": {
757
+ "id": {
758
+ "name": "id",
759
+ "type": "text",
760
+ "primaryKey": true,
761
+ "notNull": true
762
+ },
763
+ "name": {
764
+ "name": "name",
765
+ "type": "text",
766
+ "primaryKey": false,
767
+ "notNull": true
768
+ },
769
+ "email": {
770
+ "name": "email",
771
+ "type": "text",
772
+ "primaryKey": false,
773
+ "notNull": true
774
+ },
775
+ "email_verified": {
776
+ "name": "email_verified",
777
+ "type": "boolean",
778
+ "primaryKey": false,
779
+ "notNull": true,
780
+ "default": false
781
+ },
782
+ "image": {
783
+ "name": "image",
784
+ "type": "text",
785
+ "primaryKey": false,
786
+ "notNull": false
787
+ },
788
+ "created_at": {
789
+ "name": "created_at",
790
+ "type": "timestamp with time zone",
791
+ "primaryKey": false,
792
+ "notNull": true,
793
+ "default": "now()"
794
+ },
795
+ "updated_at": {
796
+ "name": "updated_at",
797
+ "type": "timestamp with time zone",
798
+ "primaryKey": false,
799
+ "notNull": true,
800
+ "default": "now()"
801
+ },
802
+ "role": {
803
+ "name": "role",
804
+ "type": "text",
805
+ "primaryKey": false,
806
+ "notNull": false
807
+ },
808
+ "banned": {
809
+ "name": "banned",
810
+ "type": "boolean",
811
+ "primaryKey": false,
812
+ "notNull": false,
813
+ "default": false
814
+ },
815
+ "ban_reason": {
816
+ "name": "ban_reason",
817
+ "type": "text",
818
+ "primaryKey": false,
819
+ "notNull": false
820
+ },
821
+ "ban_expires": {
822
+ "name": "ban_expires",
823
+ "type": "timestamp with time zone",
824
+ "primaryKey": false,
825
+ "notNull": false
826
+ }
827
+ },
828
+ "indexes": {},
829
+ "foreignKeys": {},
830
+ "compositePrimaryKeys": {},
831
+ "uniqueConstraints": {
832
+ "hf_user_email_unique": {
833
+ "name": "hf_user_email_unique",
834
+ "nullsNotDistinct": false,
835
+ "columns": [
836
+ "email"
837
+ ]
838
+ }
839
+ },
840
+ "policies": {},
841
+ "checkConstraints": {},
842
+ "isRLSEnabled": false
843
+ },
844
+ "public.hf_verification": {
845
+ "name": "hf_verification",
846
+ "schema": "",
847
+ "columns": {
848
+ "id": {
849
+ "name": "id",
850
+ "type": "text",
851
+ "primaryKey": true,
852
+ "notNull": true
853
+ },
854
+ "identifier": {
855
+ "name": "identifier",
856
+ "type": "text",
857
+ "primaryKey": false,
858
+ "notNull": true
859
+ },
860
+ "value": {
861
+ "name": "value",
862
+ "type": "text",
863
+ "primaryKey": false,
864
+ "notNull": true
865
+ },
866
+ "expires_at": {
867
+ "name": "expires_at",
868
+ "type": "timestamp with time zone",
869
+ "primaryKey": false,
870
+ "notNull": true
871
+ },
872
+ "created_at": {
873
+ "name": "created_at",
874
+ "type": "timestamp with time zone",
875
+ "primaryKey": false,
876
+ "notNull": true,
877
+ "default": "now()"
878
+ },
879
+ "updated_at": {
880
+ "name": "updated_at",
881
+ "type": "timestamp with time zone",
882
+ "primaryKey": false,
883
+ "notNull": true,
884
+ "default": "now()"
885
+ }
886
+ },
887
+ "indexes": {},
888
+ "foreignKeys": {},
889
+ "compositePrimaryKeys": {},
890
+ "uniqueConstraints": {},
891
+ "policies": {},
892
+ "checkConstraints": {},
893
+ "isRLSEnabled": false
894
+ },
895
+ "public.hf_action_log": {
896
+ "name": "hf_action_log",
897
+ "schema": "",
898
+ "columns": {
899
+ "id": {
900
+ "name": "id",
901
+ "type": "bigint",
902
+ "primaryKey": true,
903
+ "notNull": true,
904
+ "identity": {
905
+ "type": "always",
906
+ "name": "hf_action_log_id_seq",
907
+ "schema": "public",
908
+ "increment": "1",
909
+ "startWith": "1",
910
+ "minValue": "1",
911
+ "maxValue": "9223372036854775807",
912
+ "cache": "1",
913
+ "cycle": false
914
+ }
915
+ },
916
+ "run_id": {
917
+ "name": "run_id",
918
+ "type": "text",
919
+ "primaryKey": false,
920
+ "notNull": true
921
+ },
922
+ "key": {
923
+ "name": "key",
924
+ "type": "text",
925
+ "primaryKey": false,
926
+ "notNull": true
927
+ },
928
+ "workflow_id": {
929
+ "name": "workflow_id",
930
+ "type": "text",
931
+ "primaryKey": false,
932
+ "notNull": true
933
+ },
934
+ "channel": {
935
+ "name": "channel",
936
+ "type": "text",
937
+ "primaryKey": false,
938
+ "notNull": true
939
+ },
940
+ "idempotency_key": {
941
+ "name": "idempotency_key",
942
+ "type": "text",
943
+ "primaryKey": false,
944
+ "notNull": true
945
+ },
946
+ "status": {
947
+ "name": "status",
948
+ "type": "text",
949
+ "primaryKey": false,
950
+ "notNull": true
951
+ },
952
+ "external_id": {
953
+ "name": "external_id",
954
+ "type": "text",
955
+ "primaryKey": false,
956
+ "notNull": false
957
+ },
958
+ "approval_id": {
959
+ "name": "approval_id",
960
+ "type": "bigint",
961
+ "primaryKey": false,
962
+ "notNull": false
963
+ },
964
+ "record_type": {
965
+ "name": "record_type",
966
+ "type": "text",
967
+ "primaryKey": false,
968
+ "notNull": false
969
+ },
970
+ "record_id": {
971
+ "name": "record_id",
972
+ "type": "text",
973
+ "primaryKey": false,
974
+ "notNull": false
975
+ },
976
+ "request": {
977
+ "name": "request",
978
+ "type": "jsonb",
979
+ "primaryKey": false,
980
+ "notNull": false
981
+ },
982
+ "response": {
983
+ "name": "response",
984
+ "type": "jsonb",
985
+ "primaryKey": false,
986
+ "notNull": false
987
+ },
988
+ "started_at": {
989
+ "name": "started_at",
990
+ "type": "timestamp with time zone",
991
+ "primaryKey": false,
992
+ "notNull": true,
993
+ "default": "now()"
994
+ },
995
+ "finished_at": {
996
+ "name": "finished_at",
997
+ "type": "timestamp with time zone",
998
+ "primaryKey": false,
999
+ "notNull": false
1000
+ }
1001
+ },
1002
+ "indexes": {
1003
+ "hf_action_log_run_key_uq": {
1004
+ "name": "hf_action_log_run_key_uq",
1005
+ "columns": [
1006
+ {
1007
+ "expression": "run_id",
1008
+ "isExpression": false,
1009
+ "asc": true,
1010
+ "nulls": "last"
1011
+ },
1012
+ {
1013
+ "expression": "key",
1014
+ "isExpression": false,
1015
+ "asc": true,
1016
+ "nulls": "last"
1017
+ }
1018
+ ],
1019
+ "isUnique": true,
1020
+ "concurrently": false,
1021
+ "method": "btree",
1022
+ "with": {}
1023
+ }
1024
+ },
1025
+ "foreignKeys": {},
1026
+ "compositePrimaryKeys": {},
1027
+ "uniqueConstraints": {},
1028
+ "policies": {},
1029
+ "checkConstraints": {},
1030
+ "isRLSEnabled": false
1031
+ },
1032
+ "public.hf_budget_period": {
1033
+ "name": "hf_budget_period",
1034
+ "schema": "",
1035
+ "columns": {
1036
+ "period": {
1037
+ "name": "period",
1038
+ "type": "text",
1039
+ "primaryKey": true,
1040
+ "notNull": true
1041
+ },
1042
+ "budget_usd": {
1043
+ "name": "budget_usd",
1044
+ "type": "numeric(12, 4)",
1045
+ "primaryKey": false,
1046
+ "notNull": true
1047
+ },
1048
+ "spent_usd": {
1049
+ "name": "spent_usd",
1050
+ "type": "numeric(12, 4)",
1051
+ "primaryKey": false,
1052
+ "notNull": true,
1053
+ "default": "'0'"
1054
+ },
1055
+ "created_at": {
1056
+ "name": "created_at",
1057
+ "type": "timestamp with time zone",
1058
+ "primaryKey": false,
1059
+ "notNull": true,
1060
+ "default": "now()"
1061
+ }
1062
+ },
1063
+ "indexes": {},
1064
+ "foreignKeys": {},
1065
+ "compositePrimaryKeys": {},
1066
+ "uniqueConstraints": {},
1067
+ "policies": {},
1068
+ "checkConstraints": {
1069
+ "hf_budget_period_spent_non_negative": {
1070
+ "name": "hf_budget_period_spent_non_negative",
1071
+ "value": "\"hf_budget_period\".\"spent_usd\" >= 0"
1072
+ }
1073
+ },
1074
+ "isRLSEnabled": false
1075
+ },
1076
+ "public.hf_llm_call": {
1077
+ "name": "hf_llm_call",
1078
+ "schema": "",
1079
+ "columns": {
1080
+ "id": {
1081
+ "name": "id",
1082
+ "type": "bigint",
1083
+ "primaryKey": true,
1084
+ "notNull": true,
1085
+ "identity": {
1086
+ "type": "always",
1087
+ "name": "hf_llm_call_id_seq",
1088
+ "schema": "public",
1089
+ "increment": "1",
1090
+ "startWith": "1",
1091
+ "minValue": "1",
1092
+ "maxValue": "9223372036854775807",
1093
+ "cache": "1",
1094
+ "cycle": false
1095
+ }
1096
+ },
1097
+ "run_id": {
1098
+ "name": "run_id",
1099
+ "type": "text",
1100
+ "primaryKey": false,
1101
+ "notNull": true
1102
+ },
1103
+ "key": {
1104
+ "name": "key",
1105
+ "type": "text",
1106
+ "primaryKey": false,
1107
+ "notNull": true
1108
+ },
1109
+ "workflow_id": {
1110
+ "name": "workflow_id",
1111
+ "type": "text",
1112
+ "primaryKey": false,
1113
+ "notNull": true
1114
+ },
1115
+ "period": {
1116
+ "name": "period",
1117
+ "type": "text",
1118
+ "primaryKey": false,
1119
+ "notNull": true
1120
+ },
1121
+ "step_name": {
1122
+ "name": "step_name",
1123
+ "type": "text",
1124
+ "primaryKey": false,
1125
+ "notNull": false
1126
+ },
1127
+ "prompt_name": {
1128
+ "name": "prompt_name",
1129
+ "type": "text",
1130
+ "primaryKey": false,
1131
+ "notNull": false
1132
+ },
1133
+ "prompt_hash": {
1134
+ "name": "prompt_hash",
1135
+ "type": "text",
1136
+ "primaryKey": false,
1137
+ "notNull": false
1138
+ },
1139
+ "input_hash": {
1140
+ "name": "input_hash",
1141
+ "type": "text",
1142
+ "primaryKey": false,
1143
+ "notNull": true
1144
+ },
1145
+ "model": {
1146
+ "name": "model",
1147
+ "type": "text",
1148
+ "primaryKey": false,
1149
+ "notNull": false
1150
+ },
1151
+ "status": {
1152
+ "name": "status",
1153
+ "type": "text",
1154
+ "primaryKey": false,
1155
+ "notNull": true
1156
+ },
1157
+ "input": {
1158
+ "name": "input",
1159
+ "type": "jsonb",
1160
+ "primaryKey": false,
1161
+ "notNull": false
1162
+ },
1163
+ "output": {
1164
+ "name": "output",
1165
+ "type": "jsonb",
1166
+ "primaryKey": false,
1167
+ "notNull": false
1168
+ },
1169
+ "tokens_in": {
1170
+ "name": "tokens_in",
1171
+ "type": "integer",
1172
+ "primaryKey": false,
1173
+ "notNull": false
1174
+ },
1175
+ "tokens_out": {
1176
+ "name": "tokens_out",
1177
+ "type": "integer",
1178
+ "primaryKey": false,
1179
+ "notNull": false
1180
+ },
1181
+ "estimated_cost_usd": {
1182
+ "name": "estimated_cost_usd",
1183
+ "type": "numeric(12, 6)",
1184
+ "primaryKey": false,
1185
+ "notNull": true
1186
+ },
1187
+ "cost_usd": {
1188
+ "name": "cost_usd",
1189
+ "type": "numeric(12, 6)",
1190
+ "primaryKey": false,
1191
+ "notNull": false
1192
+ },
1193
+ "possible_double_charge": {
1194
+ "name": "possible_double_charge",
1195
+ "type": "boolean",
1196
+ "primaryKey": false,
1197
+ "notNull": true,
1198
+ "default": false
1199
+ },
1200
+ "latency_ms": {
1201
+ "name": "latency_ms",
1202
+ "type": "integer",
1203
+ "primaryKey": false,
1204
+ "notNull": false
1205
+ },
1206
+ "trace_id": {
1207
+ "name": "trace_id",
1208
+ "type": "text",
1209
+ "primaryKey": false,
1210
+ "notNull": false
1211
+ },
1212
+ "started_at": {
1213
+ "name": "started_at",
1214
+ "type": "timestamp with time zone",
1215
+ "primaryKey": false,
1216
+ "notNull": true,
1217
+ "default": "now()"
1218
+ },
1219
+ "finished_at": {
1220
+ "name": "finished_at",
1221
+ "type": "timestamp with time zone",
1222
+ "primaryKey": false,
1223
+ "notNull": false
1224
+ }
1225
+ },
1226
+ "indexes": {
1227
+ "hf_llm_call_run_key_uq": {
1228
+ "name": "hf_llm_call_run_key_uq",
1229
+ "columns": [
1230
+ {
1231
+ "expression": "run_id",
1232
+ "isExpression": false,
1233
+ "asc": true,
1234
+ "nulls": "last"
1235
+ },
1236
+ {
1237
+ "expression": "key",
1238
+ "isExpression": false,
1239
+ "asc": true,
1240
+ "nulls": "last"
1241
+ }
1242
+ ],
1243
+ "isUnique": true,
1244
+ "concurrently": false,
1245
+ "method": "btree",
1246
+ "with": {}
1247
+ },
1248
+ "hf_llm_call_period_status_idx": {
1249
+ "name": "hf_llm_call_period_status_idx",
1250
+ "columns": [
1251
+ {
1252
+ "expression": "period",
1253
+ "isExpression": false,
1254
+ "asc": true,
1255
+ "nulls": "last"
1256
+ },
1257
+ {
1258
+ "expression": "status",
1259
+ "isExpression": false,
1260
+ "asc": true,
1261
+ "nulls": "last"
1262
+ }
1263
+ ],
1264
+ "isUnique": false,
1265
+ "concurrently": false,
1266
+ "method": "btree",
1267
+ "with": {}
1268
+ }
1269
+ },
1270
+ "foreignKeys": {},
1271
+ "compositePrimaryKeys": {},
1272
+ "uniqueConstraints": {},
1273
+ "policies": {},
1274
+ "checkConstraints": {},
1275
+ "isRLSEnabled": false
1276
+ },
1277
+ "public.hf_run": {
1278
+ "name": "hf_run",
1279
+ "schema": "",
1280
+ "columns": {
1281
+ "run_id": {
1282
+ "name": "run_id",
1283
+ "type": "text",
1284
+ "primaryKey": true,
1285
+ "notNull": true
1286
+ },
1287
+ "flow": {
1288
+ "name": "flow",
1289
+ "type": "text",
1290
+ "primaryKey": false,
1291
+ "notNull": true
1292
+ },
1293
+ "input": {
1294
+ "name": "input",
1295
+ "type": "jsonb",
1296
+ "primaryKey": false,
1297
+ "notNull": false
1298
+ },
1299
+ "status": {
1300
+ "name": "status",
1301
+ "type": "text",
1302
+ "primaryKey": false,
1303
+ "notNull": true
1304
+ },
1305
+ "attempt": {
1306
+ "name": "attempt",
1307
+ "type": "integer",
1308
+ "primaryKey": false,
1309
+ "notNull": true,
1310
+ "default": 1
1311
+ },
1312
+ "current_workflow_id": {
1313
+ "name": "current_workflow_id",
1314
+ "type": "text",
1315
+ "primaryKey": false,
1316
+ "notNull": true
1317
+ },
1318
+ "version": {
1319
+ "name": "version",
1320
+ "type": "text",
1321
+ "primaryKey": false,
1322
+ "notNull": false
1323
+ },
1324
+ "record_type": {
1325
+ "name": "record_type",
1326
+ "type": "text",
1327
+ "primaryKey": false,
1328
+ "notNull": false
1329
+ },
1330
+ "record_id": {
1331
+ "name": "record_id",
1332
+ "type": "text",
1333
+ "primaryKey": false,
1334
+ "notNull": false
1335
+ },
1336
+ "error": {
1337
+ "name": "error",
1338
+ "type": "text",
1339
+ "primaryKey": false,
1340
+ "notNull": false
1341
+ },
1342
+ "started_at": {
1343
+ "name": "started_at",
1344
+ "type": "timestamp with time zone",
1345
+ "primaryKey": false,
1346
+ "notNull": true,
1347
+ "default": "now()"
1348
+ },
1349
+ "finished_at": {
1350
+ "name": "finished_at",
1351
+ "type": "timestamp with time zone",
1352
+ "primaryKey": false,
1353
+ "notNull": false
1354
+ }
1355
+ },
1356
+ "indexes": {
1357
+ "hf_run_status_idx": {
1358
+ "name": "hf_run_status_idx",
1359
+ "columns": [
1360
+ {
1361
+ "expression": "status",
1362
+ "isExpression": false,
1363
+ "asc": true,
1364
+ "nulls": "last"
1365
+ }
1366
+ ],
1367
+ "isUnique": false,
1368
+ "concurrently": false,
1369
+ "method": "btree",
1370
+ "with": {}
1371
+ },
1372
+ "hf_run_record_idx": {
1373
+ "name": "hf_run_record_idx",
1374
+ "columns": [
1375
+ {
1376
+ "expression": "record_type",
1377
+ "isExpression": false,
1378
+ "asc": true,
1379
+ "nulls": "last"
1380
+ },
1381
+ {
1382
+ "expression": "record_id",
1383
+ "isExpression": false,
1384
+ "asc": true,
1385
+ "nulls": "last"
1386
+ }
1387
+ ],
1388
+ "isUnique": false,
1389
+ "concurrently": false,
1390
+ "method": "btree",
1391
+ "with": {}
1392
+ }
1393
+ },
1394
+ "foreignKeys": {},
1395
+ "compositePrimaryKeys": {},
1396
+ "uniqueConstraints": {
1397
+ "hf_run_current_workflow_id_unique": {
1398
+ "name": "hf_run_current_workflow_id_unique",
1399
+ "nullsNotDistinct": false,
1400
+ "columns": [
1401
+ "current_workflow_id"
1402
+ ]
1403
+ }
1404
+ },
1405
+ "policies": {},
1406
+ "checkConstraints": {
1407
+ "hf_run_attempt_positive": {
1408
+ "name": "hf_run_attempt_positive",
1409
+ "value": "\"hf_run\".\"attempt\" >= 1"
1410
+ }
1411
+ },
1412
+ "isRLSEnabled": false
1413
+ }
1414
+ },
1415
+ "enums": {},
1416
+ "schemas": {},
1417
+ "sequences": {},
1418
+ "roles": {},
1419
+ "policies": {},
1420
+ "views": {},
1421
+ "_meta": {
1422
+ "columns": {},
1423
+ "schemas": {},
1424
+ "tables": {}
1425
+ }
1426
+ }