@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,1516 @@
1
+ {
2
+ "id": "83640783-d54a-4812-a70b-e3cb0bd83bda",
3
+ "prevId": "c34347f5-4270-4bf6-9f7a-4921684019d7",
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_invitation": {
426
+ "name": "hf_invitation",
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
+ "email": {
442
+ "name": "email",
443
+ "type": "text",
444
+ "primaryKey": false,
445
+ "notNull": true
446
+ },
447
+ "role": {
448
+ "name": "role",
449
+ "type": "text",
450
+ "primaryKey": false,
451
+ "notNull": false
452
+ },
453
+ "status": {
454
+ "name": "status",
455
+ "type": "text",
456
+ "primaryKey": false,
457
+ "notNull": true,
458
+ "default": "'pending'"
459
+ },
460
+ "expires_at": {
461
+ "name": "expires_at",
462
+ "type": "timestamp with time zone",
463
+ "primaryKey": false,
464
+ "notNull": true
465
+ },
466
+ "inviter_id": {
467
+ "name": "inviter_id",
468
+ "type": "text",
469
+ "primaryKey": false,
470
+ "notNull": true
471
+ },
472
+ "created_at": {
473
+ "name": "created_at",
474
+ "type": "timestamp with time zone",
475
+ "primaryKey": false,
476
+ "notNull": true,
477
+ "default": "now()"
478
+ }
479
+ },
480
+ "indexes": {},
481
+ "foreignKeys": {
482
+ "hf_invitation_organization_id_hf_organization_id_fk": {
483
+ "name": "hf_invitation_organization_id_hf_organization_id_fk",
484
+ "tableFrom": "hf_invitation",
485
+ "tableTo": "hf_organization",
486
+ "columnsFrom": [
487
+ "organization_id"
488
+ ],
489
+ "columnsTo": [
490
+ "id"
491
+ ],
492
+ "onDelete": "cascade",
493
+ "onUpdate": "no action"
494
+ },
495
+ "hf_invitation_inviter_id_hf_user_id_fk": {
496
+ "name": "hf_invitation_inviter_id_hf_user_id_fk",
497
+ "tableFrom": "hf_invitation",
498
+ "tableTo": "hf_user",
499
+ "columnsFrom": [
500
+ "inviter_id"
501
+ ],
502
+ "columnsTo": [
503
+ "id"
504
+ ],
505
+ "onDelete": "cascade",
506
+ "onUpdate": "no action"
507
+ }
508
+ },
509
+ "compositePrimaryKeys": {},
510
+ "uniqueConstraints": {},
511
+ "policies": {},
512
+ "checkConstraints": {},
513
+ "isRLSEnabled": false
514
+ },
515
+ "public.hf_member": {
516
+ "name": "hf_member",
517
+ "schema": "",
518
+ "columns": {
519
+ "id": {
520
+ "name": "id",
521
+ "type": "text",
522
+ "primaryKey": true,
523
+ "notNull": true
524
+ },
525
+ "organization_id": {
526
+ "name": "organization_id",
527
+ "type": "text",
528
+ "primaryKey": false,
529
+ "notNull": true
530
+ },
531
+ "user_id": {
532
+ "name": "user_id",
533
+ "type": "text",
534
+ "primaryKey": false,
535
+ "notNull": true
536
+ },
537
+ "role": {
538
+ "name": "role",
539
+ "type": "text",
540
+ "primaryKey": false,
541
+ "notNull": true,
542
+ "default": "'member'"
543
+ },
544
+ "created_at": {
545
+ "name": "created_at",
546
+ "type": "timestamp with time zone",
547
+ "primaryKey": false,
548
+ "notNull": true,
549
+ "default": "now()"
550
+ }
551
+ },
552
+ "indexes": {},
553
+ "foreignKeys": {
554
+ "hf_member_organization_id_hf_organization_id_fk": {
555
+ "name": "hf_member_organization_id_hf_organization_id_fk",
556
+ "tableFrom": "hf_member",
557
+ "tableTo": "hf_organization",
558
+ "columnsFrom": [
559
+ "organization_id"
560
+ ],
561
+ "columnsTo": [
562
+ "id"
563
+ ],
564
+ "onDelete": "cascade",
565
+ "onUpdate": "no action"
566
+ },
567
+ "hf_member_user_id_hf_user_id_fk": {
568
+ "name": "hf_member_user_id_hf_user_id_fk",
569
+ "tableFrom": "hf_member",
570
+ "tableTo": "hf_user",
571
+ "columnsFrom": [
572
+ "user_id"
573
+ ],
574
+ "columnsTo": [
575
+ "id"
576
+ ],
577
+ "onDelete": "cascade",
578
+ "onUpdate": "no action"
579
+ }
580
+ },
581
+ "compositePrimaryKeys": {},
582
+ "uniqueConstraints": {},
583
+ "policies": {},
584
+ "checkConstraints": {},
585
+ "isRLSEnabled": false
586
+ },
587
+ "public.hf_organization": {
588
+ "name": "hf_organization",
589
+ "schema": "",
590
+ "columns": {
591
+ "id": {
592
+ "name": "id",
593
+ "type": "text",
594
+ "primaryKey": true,
595
+ "notNull": true
596
+ },
597
+ "name": {
598
+ "name": "name",
599
+ "type": "text",
600
+ "primaryKey": false,
601
+ "notNull": true
602
+ },
603
+ "slug": {
604
+ "name": "slug",
605
+ "type": "text",
606
+ "primaryKey": false,
607
+ "notNull": true
608
+ },
609
+ "logo": {
610
+ "name": "logo",
611
+ "type": "text",
612
+ "primaryKey": false,
613
+ "notNull": false
614
+ },
615
+ "created_at": {
616
+ "name": "created_at",
617
+ "type": "timestamp with time zone",
618
+ "primaryKey": false,
619
+ "notNull": true,
620
+ "default": "now()"
621
+ },
622
+ "metadata": {
623
+ "name": "metadata",
624
+ "type": "text",
625
+ "primaryKey": false,
626
+ "notNull": false
627
+ }
628
+ },
629
+ "indexes": {},
630
+ "foreignKeys": {},
631
+ "compositePrimaryKeys": {},
632
+ "uniqueConstraints": {
633
+ "hf_organization_slug_unique": {
634
+ "name": "hf_organization_slug_unique",
635
+ "nullsNotDistinct": false,
636
+ "columns": [
637
+ "slug"
638
+ ]
639
+ }
640
+ },
641
+ "policies": {},
642
+ "checkConstraints": {},
643
+ "isRLSEnabled": false
644
+ },
645
+ "public.hf_passkey": {
646
+ "name": "hf_passkey",
647
+ "schema": "",
648
+ "columns": {
649
+ "id": {
650
+ "name": "id",
651
+ "type": "text",
652
+ "primaryKey": true,
653
+ "notNull": true
654
+ },
655
+ "name": {
656
+ "name": "name",
657
+ "type": "text",
658
+ "primaryKey": false,
659
+ "notNull": false
660
+ },
661
+ "public_key": {
662
+ "name": "public_key",
663
+ "type": "text",
664
+ "primaryKey": false,
665
+ "notNull": true
666
+ },
667
+ "user_id": {
668
+ "name": "user_id",
669
+ "type": "text",
670
+ "primaryKey": false,
671
+ "notNull": true
672
+ },
673
+ "credential_id": {
674
+ "name": "credential_id",
675
+ "type": "text",
676
+ "primaryKey": false,
677
+ "notNull": true
678
+ },
679
+ "counter": {
680
+ "name": "counter",
681
+ "type": "integer",
682
+ "primaryKey": false,
683
+ "notNull": true
684
+ },
685
+ "device_type": {
686
+ "name": "device_type",
687
+ "type": "text",
688
+ "primaryKey": false,
689
+ "notNull": true
690
+ },
691
+ "backed_up": {
692
+ "name": "backed_up",
693
+ "type": "boolean",
694
+ "primaryKey": false,
695
+ "notNull": true
696
+ },
697
+ "transports": {
698
+ "name": "transports",
699
+ "type": "text",
700
+ "primaryKey": false,
701
+ "notNull": false
702
+ },
703
+ "created_at": {
704
+ "name": "created_at",
705
+ "type": "timestamp with time zone",
706
+ "primaryKey": false,
707
+ "notNull": false,
708
+ "default": "now()"
709
+ },
710
+ "aaguid": {
711
+ "name": "aaguid",
712
+ "type": "text",
713
+ "primaryKey": false,
714
+ "notNull": false
715
+ }
716
+ },
717
+ "indexes": {},
718
+ "foreignKeys": {
719
+ "hf_passkey_user_id_hf_user_id_fk": {
720
+ "name": "hf_passkey_user_id_hf_user_id_fk",
721
+ "tableFrom": "hf_passkey",
722
+ "tableTo": "hf_user",
723
+ "columnsFrom": [
724
+ "user_id"
725
+ ],
726
+ "columnsTo": [
727
+ "id"
728
+ ],
729
+ "onDelete": "cascade",
730
+ "onUpdate": "no action"
731
+ }
732
+ },
733
+ "compositePrimaryKeys": {},
734
+ "uniqueConstraints": {},
735
+ "policies": {},
736
+ "checkConstraints": {},
737
+ "isRLSEnabled": false
738
+ },
739
+ "public.hf_session": {
740
+ "name": "hf_session",
741
+ "schema": "",
742
+ "columns": {
743
+ "id": {
744
+ "name": "id",
745
+ "type": "text",
746
+ "primaryKey": true,
747
+ "notNull": true
748
+ },
749
+ "expires_at": {
750
+ "name": "expires_at",
751
+ "type": "timestamp with time zone",
752
+ "primaryKey": false,
753
+ "notNull": true
754
+ },
755
+ "token": {
756
+ "name": "token",
757
+ "type": "text",
758
+ "primaryKey": false,
759
+ "notNull": true
760
+ },
761
+ "created_at": {
762
+ "name": "created_at",
763
+ "type": "timestamp with time zone",
764
+ "primaryKey": false,
765
+ "notNull": true,
766
+ "default": "now()"
767
+ },
768
+ "updated_at": {
769
+ "name": "updated_at",
770
+ "type": "timestamp with time zone",
771
+ "primaryKey": false,
772
+ "notNull": true,
773
+ "default": "now()"
774
+ },
775
+ "ip_address": {
776
+ "name": "ip_address",
777
+ "type": "text",
778
+ "primaryKey": false,
779
+ "notNull": false
780
+ },
781
+ "user_agent": {
782
+ "name": "user_agent",
783
+ "type": "text",
784
+ "primaryKey": false,
785
+ "notNull": false
786
+ },
787
+ "user_id": {
788
+ "name": "user_id",
789
+ "type": "text",
790
+ "primaryKey": false,
791
+ "notNull": true
792
+ },
793
+ "active_organization_id": {
794
+ "name": "active_organization_id",
795
+ "type": "text",
796
+ "primaryKey": false,
797
+ "notNull": false
798
+ },
799
+ "impersonated_by": {
800
+ "name": "impersonated_by",
801
+ "type": "text",
802
+ "primaryKey": false,
803
+ "notNull": false
804
+ },
805
+ "factor": {
806
+ "name": "factor",
807
+ "type": "text",
808
+ "primaryKey": false,
809
+ "notNull": true,
810
+ "default": "'code'"
811
+ }
812
+ },
813
+ "indexes": {},
814
+ "foreignKeys": {
815
+ "hf_session_user_id_hf_user_id_fk": {
816
+ "name": "hf_session_user_id_hf_user_id_fk",
817
+ "tableFrom": "hf_session",
818
+ "tableTo": "hf_user",
819
+ "columnsFrom": [
820
+ "user_id"
821
+ ],
822
+ "columnsTo": [
823
+ "id"
824
+ ],
825
+ "onDelete": "cascade",
826
+ "onUpdate": "no action"
827
+ }
828
+ },
829
+ "compositePrimaryKeys": {},
830
+ "uniqueConstraints": {
831
+ "hf_session_token_unique": {
832
+ "name": "hf_session_token_unique",
833
+ "nullsNotDistinct": false,
834
+ "columns": [
835
+ "token"
836
+ ]
837
+ }
838
+ },
839
+ "policies": {},
840
+ "checkConstraints": {},
841
+ "isRLSEnabled": false
842
+ },
843
+ "public.hf_user": {
844
+ "name": "hf_user",
845
+ "schema": "",
846
+ "columns": {
847
+ "id": {
848
+ "name": "id",
849
+ "type": "text",
850
+ "primaryKey": true,
851
+ "notNull": true
852
+ },
853
+ "name": {
854
+ "name": "name",
855
+ "type": "text",
856
+ "primaryKey": false,
857
+ "notNull": true
858
+ },
859
+ "email": {
860
+ "name": "email",
861
+ "type": "text",
862
+ "primaryKey": false,
863
+ "notNull": true
864
+ },
865
+ "email_verified": {
866
+ "name": "email_verified",
867
+ "type": "boolean",
868
+ "primaryKey": false,
869
+ "notNull": true,
870
+ "default": false
871
+ },
872
+ "image": {
873
+ "name": "image",
874
+ "type": "text",
875
+ "primaryKey": false,
876
+ "notNull": false
877
+ },
878
+ "created_at": {
879
+ "name": "created_at",
880
+ "type": "timestamp with time zone",
881
+ "primaryKey": false,
882
+ "notNull": true,
883
+ "default": "now()"
884
+ },
885
+ "updated_at": {
886
+ "name": "updated_at",
887
+ "type": "timestamp with time zone",
888
+ "primaryKey": false,
889
+ "notNull": true,
890
+ "default": "now()"
891
+ },
892
+ "role": {
893
+ "name": "role",
894
+ "type": "text",
895
+ "primaryKey": false,
896
+ "notNull": false
897
+ },
898
+ "banned": {
899
+ "name": "banned",
900
+ "type": "boolean",
901
+ "primaryKey": false,
902
+ "notNull": false,
903
+ "default": false
904
+ },
905
+ "ban_reason": {
906
+ "name": "ban_reason",
907
+ "type": "text",
908
+ "primaryKey": false,
909
+ "notNull": false
910
+ },
911
+ "ban_expires": {
912
+ "name": "ban_expires",
913
+ "type": "timestamp with time zone",
914
+ "primaryKey": false,
915
+ "notNull": false
916
+ }
917
+ },
918
+ "indexes": {},
919
+ "foreignKeys": {},
920
+ "compositePrimaryKeys": {},
921
+ "uniqueConstraints": {
922
+ "hf_user_email_unique": {
923
+ "name": "hf_user_email_unique",
924
+ "nullsNotDistinct": false,
925
+ "columns": [
926
+ "email"
927
+ ]
928
+ }
929
+ },
930
+ "policies": {},
931
+ "checkConstraints": {},
932
+ "isRLSEnabled": false
933
+ },
934
+ "public.hf_verification": {
935
+ "name": "hf_verification",
936
+ "schema": "",
937
+ "columns": {
938
+ "id": {
939
+ "name": "id",
940
+ "type": "text",
941
+ "primaryKey": true,
942
+ "notNull": true
943
+ },
944
+ "identifier": {
945
+ "name": "identifier",
946
+ "type": "text",
947
+ "primaryKey": false,
948
+ "notNull": true
949
+ },
950
+ "value": {
951
+ "name": "value",
952
+ "type": "text",
953
+ "primaryKey": false,
954
+ "notNull": true
955
+ },
956
+ "expires_at": {
957
+ "name": "expires_at",
958
+ "type": "timestamp with time zone",
959
+ "primaryKey": false,
960
+ "notNull": true
961
+ },
962
+ "created_at": {
963
+ "name": "created_at",
964
+ "type": "timestamp with time zone",
965
+ "primaryKey": false,
966
+ "notNull": true,
967
+ "default": "now()"
968
+ },
969
+ "updated_at": {
970
+ "name": "updated_at",
971
+ "type": "timestamp with time zone",
972
+ "primaryKey": false,
973
+ "notNull": true,
974
+ "default": "now()"
975
+ }
976
+ },
977
+ "indexes": {},
978
+ "foreignKeys": {},
979
+ "compositePrimaryKeys": {},
980
+ "uniqueConstraints": {},
981
+ "policies": {},
982
+ "checkConstraints": {},
983
+ "isRLSEnabled": false
984
+ },
985
+ "public.hf_action_log": {
986
+ "name": "hf_action_log",
987
+ "schema": "",
988
+ "columns": {
989
+ "id": {
990
+ "name": "id",
991
+ "type": "bigint",
992
+ "primaryKey": true,
993
+ "notNull": true,
994
+ "identity": {
995
+ "type": "always",
996
+ "name": "hf_action_log_id_seq",
997
+ "schema": "public",
998
+ "increment": "1",
999
+ "startWith": "1",
1000
+ "minValue": "1",
1001
+ "maxValue": "9223372036854775807",
1002
+ "cache": "1",
1003
+ "cycle": false
1004
+ }
1005
+ },
1006
+ "run_id": {
1007
+ "name": "run_id",
1008
+ "type": "text",
1009
+ "primaryKey": false,
1010
+ "notNull": true
1011
+ },
1012
+ "key": {
1013
+ "name": "key",
1014
+ "type": "text",
1015
+ "primaryKey": false,
1016
+ "notNull": true
1017
+ },
1018
+ "workflow_id": {
1019
+ "name": "workflow_id",
1020
+ "type": "text",
1021
+ "primaryKey": false,
1022
+ "notNull": true
1023
+ },
1024
+ "channel": {
1025
+ "name": "channel",
1026
+ "type": "text",
1027
+ "primaryKey": false,
1028
+ "notNull": true
1029
+ },
1030
+ "idempotency_key": {
1031
+ "name": "idempotency_key",
1032
+ "type": "text",
1033
+ "primaryKey": false,
1034
+ "notNull": true
1035
+ },
1036
+ "status": {
1037
+ "name": "status",
1038
+ "type": "text",
1039
+ "primaryKey": false,
1040
+ "notNull": true
1041
+ },
1042
+ "external_id": {
1043
+ "name": "external_id",
1044
+ "type": "text",
1045
+ "primaryKey": false,
1046
+ "notNull": false
1047
+ },
1048
+ "approval_id": {
1049
+ "name": "approval_id",
1050
+ "type": "bigint",
1051
+ "primaryKey": false,
1052
+ "notNull": false
1053
+ },
1054
+ "record_type": {
1055
+ "name": "record_type",
1056
+ "type": "text",
1057
+ "primaryKey": false,
1058
+ "notNull": false
1059
+ },
1060
+ "record_id": {
1061
+ "name": "record_id",
1062
+ "type": "text",
1063
+ "primaryKey": false,
1064
+ "notNull": false
1065
+ },
1066
+ "request": {
1067
+ "name": "request",
1068
+ "type": "jsonb",
1069
+ "primaryKey": false,
1070
+ "notNull": false
1071
+ },
1072
+ "response": {
1073
+ "name": "response",
1074
+ "type": "jsonb",
1075
+ "primaryKey": false,
1076
+ "notNull": false
1077
+ },
1078
+ "started_at": {
1079
+ "name": "started_at",
1080
+ "type": "timestamp with time zone",
1081
+ "primaryKey": false,
1082
+ "notNull": true,
1083
+ "default": "now()"
1084
+ },
1085
+ "finished_at": {
1086
+ "name": "finished_at",
1087
+ "type": "timestamp with time zone",
1088
+ "primaryKey": false,
1089
+ "notNull": false
1090
+ }
1091
+ },
1092
+ "indexes": {
1093
+ "hf_action_log_run_key_uq": {
1094
+ "name": "hf_action_log_run_key_uq",
1095
+ "columns": [
1096
+ {
1097
+ "expression": "run_id",
1098
+ "isExpression": false,
1099
+ "asc": true,
1100
+ "nulls": "last"
1101
+ },
1102
+ {
1103
+ "expression": "key",
1104
+ "isExpression": false,
1105
+ "asc": true,
1106
+ "nulls": "last"
1107
+ }
1108
+ ],
1109
+ "isUnique": true,
1110
+ "concurrently": false,
1111
+ "method": "btree",
1112
+ "with": {}
1113
+ }
1114
+ },
1115
+ "foreignKeys": {},
1116
+ "compositePrimaryKeys": {},
1117
+ "uniqueConstraints": {},
1118
+ "policies": {},
1119
+ "checkConstraints": {},
1120
+ "isRLSEnabled": false
1121
+ },
1122
+ "public.hf_budget_period": {
1123
+ "name": "hf_budget_period",
1124
+ "schema": "",
1125
+ "columns": {
1126
+ "period": {
1127
+ "name": "period",
1128
+ "type": "text",
1129
+ "primaryKey": true,
1130
+ "notNull": true
1131
+ },
1132
+ "budget_usd": {
1133
+ "name": "budget_usd",
1134
+ "type": "numeric(12, 4)",
1135
+ "primaryKey": false,
1136
+ "notNull": true
1137
+ },
1138
+ "spent_usd": {
1139
+ "name": "spent_usd",
1140
+ "type": "numeric(12, 4)",
1141
+ "primaryKey": false,
1142
+ "notNull": true,
1143
+ "default": "'0'"
1144
+ },
1145
+ "created_at": {
1146
+ "name": "created_at",
1147
+ "type": "timestamp with time zone",
1148
+ "primaryKey": false,
1149
+ "notNull": true,
1150
+ "default": "now()"
1151
+ }
1152
+ },
1153
+ "indexes": {},
1154
+ "foreignKeys": {},
1155
+ "compositePrimaryKeys": {},
1156
+ "uniqueConstraints": {},
1157
+ "policies": {},
1158
+ "checkConstraints": {
1159
+ "hf_budget_period_spent_non_negative": {
1160
+ "name": "hf_budget_period_spent_non_negative",
1161
+ "value": "\"hf_budget_period\".\"spent_usd\" >= 0"
1162
+ }
1163
+ },
1164
+ "isRLSEnabled": false
1165
+ },
1166
+ "public.hf_llm_call": {
1167
+ "name": "hf_llm_call",
1168
+ "schema": "",
1169
+ "columns": {
1170
+ "id": {
1171
+ "name": "id",
1172
+ "type": "bigint",
1173
+ "primaryKey": true,
1174
+ "notNull": true,
1175
+ "identity": {
1176
+ "type": "always",
1177
+ "name": "hf_llm_call_id_seq",
1178
+ "schema": "public",
1179
+ "increment": "1",
1180
+ "startWith": "1",
1181
+ "minValue": "1",
1182
+ "maxValue": "9223372036854775807",
1183
+ "cache": "1",
1184
+ "cycle": false
1185
+ }
1186
+ },
1187
+ "run_id": {
1188
+ "name": "run_id",
1189
+ "type": "text",
1190
+ "primaryKey": false,
1191
+ "notNull": true
1192
+ },
1193
+ "key": {
1194
+ "name": "key",
1195
+ "type": "text",
1196
+ "primaryKey": false,
1197
+ "notNull": true
1198
+ },
1199
+ "workflow_id": {
1200
+ "name": "workflow_id",
1201
+ "type": "text",
1202
+ "primaryKey": false,
1203
+ "notNull": true
1204
+ },
1205
+ "period": {
1206
+ "name": "period",
1207
+ "type": "text",
1208
+ "primaryKey": false,
1209
+ "notNull": true
1210
+ },
1211
+ "step_name": {
1212
+ "name": "step_name",
1213
+ "type": "text",
1214
+ "primaryKey": false,
1215
+ "notNull": false
1216
+ },
1217
+ "prompt_name": {
1218
+ "name": "prompt_name",
1219
+ "type": "text",
1220
+ "primaryKey": false,
1221
+ "notNull": false
1222
+ },
1223
+ "prompt_hash": {
1224
+ "name": "prompt_hash",
1225
+ "type": "text",
1226
+ "primaryKey": false,
1227
+ "notNull": false
1228
+ },
1229
+ "input_hash": {
1230
+ "name": "input_hash",
1231
+ "type": "text",
1232
+ "primaryKey": false,
1233
+ "notNull": true
1234
+ },
1235
+ "model": {
1236
+ "name": "model",
1237
+ "type": "text",
1238
+ "primaryKey": false,
1239
+ "notNull": false
1240
+ },
1241
+ "status": {
1242
+ "name": "status",
1243
+ "type": "text",
1244
+ "primaryKey": false,
1245
+ "notNull": true
1246
+ },
1247
+ "input": {
1248
+ "name": "input",
1249
+ "type": "jsonb",
1250
+ "primaryKey": false,
1251
+ "notNull": false
1252
+ },
1253
+ "output": {
1254
+ "name": "output",
1255
+ "type": "jsonb",
1256
+ "primaryKey": false,
1257
+ "notNull": false
1258
+ },
1259
+ "tokens_in": {
1260
+ "name": "tokens_in",
1261
+ "type": "integer",
1262
+ "primaryKey": false,
1263
+ "notNull": false
1264
+ },
1265
+ "tokens_out": {
1266
+ "name": "tokens_out",
1267
+ "type": "integer",
1268
+ "primaryKey": false,
1269
+ "notNull": false
1270
+ },
1271
+ "estimated_cost_usd": {
1272
+ "name": "estimated_cost_usd",
1273
+ "type": "numeric(12, 6)",
1274
+ "primaryKey": false,
1275
+ "notNull": true
1276
+ },
1277
+ "cost_usd": {
1278
+ "name": "cost_usd",
1279
+ "type": "numeric(12, 6)",
1280
+ "primaryKey": false,
1281
+ "notNull": false
1282
+ },
1283
+ "possible_double_charge": {
1284
+ "name": "possible_double_charge",
1285
+ "type": "boolean",
1286
+ "primaryKey": false,
1287
+ "notNull": true,
1288
+ "default": false
1289
+ },
1290
+ "latency_ms": {
1291
+ "name": "latency_ms",
1292
+ "type": "integer",
1293
+ "primaryKey": false,
1294
+ "notNull": false
1295
+ },
1296
+ "trace_id": {
1297
+ "name": "trace_id",
1298
+ "type": "text",
1299
+ "primaryKey": false,
1300
+ "notNull": false
1301
+ },
1302
+ "started_at": {
1303
+ "name": "started_at",
1304
+ "type": "timestamp with time zone",
1305
+ "primaryKey": false,
1306
+ "notNull": true,
1307
+ "default": "now()"
1308
+ },
1309
+ "finished_at": {
1310
+ "name": "finished_at",
1311
+ "type": "timestamp with time zone",
1312
+ "primaryKey": false,
1313
+ "notNull": false
1314
+ }
1315
+ },
1316
+ "indexes": {
1317
+ "hf_llm_call_run_key_uq": {
1318
+ "name": "hf_llm_call_run_key_uq",
1319
+ "columns": [
1320
+ {
1321
+ "expression": "run_id",
1322
+ "isExpression": false,
1323
+ "asc": true,
1324
+ "nulls": "last"
1325
+ },
1326
+ {
1327
+ "expression": "key",
1328
+ "isExpression": false,
1329
+ "asc": true,
1330
+ "nulls": "last"
1331
+ }
1332
+ ],
1333
+ "isUnique": true,
1334
+ "concurrently": false,
1335
+ "method": "btree",
1336
+ "with": {}
1337
+ },
1338
+ "hf_llm_call_period_status_idx": {
1339
+ "name": "hf_llm_call_period_status_idx",
1340
+ "columns": [
1341
+ {
1342
+ "expression": "period",
1343
+ "isExpression": false,
1344
+ "asc": true,
1345
+ "nulls": "last"
1346
+ },
1347
+ {
1348
+ "expression": "status",
1349
+ "isExpression": false,
1350
+ "asc": true,
1351
+ "nulls": "last"
1352
+ }
1353
+ ],
1354
+ "isUnique": false,
1355
+ "concurrently": false,
1356
+ "method": "btree",
1357
+ "with": {}
1358
+ }
1359
+ },
1360
+ "foreignKeys": {},
1361
+ "compositePrimaryKeys": {},
1362
+ "uniqueConstraints": {},
1363
+ "policies": {},
1364
+ "checkConstraints": {},
1365
+ "isRLSEnabled": false
1366
+ },
1367
+ "public.hf_run": {
1368
+ "name": "hf_run",
1369
+ "schema": "",
1370
+ "columns": {
1371
+ "run_id": {
1372
+ "name": "run_id",
1373
+ "type": "text",
1374
+ "primaryKey": true,
1375
+ "notNull": true
1376
+ },
1377
+ "flow": {
1378
+ "name": "flow",
1379
+ "type": "text",
1380
+ "primaryKey": false,
1381
+ "notNull": true
1382
+ },
1383
+ "input": {
1384
+ "name": "input",
1385
+ "type": "jsonb",
1386
+ "primaryKey": false,
1387
+ "notNull": false
1388
+ },
1389
+ "status": {
1390
+ "name": "status",
1391
+ "type": "text",
1392
+ "primaryKey": false,
1393
+ "notNull": true
1394
+ },
1395
+ "attempt": {
1396
+ "name": "attempt",
1397
+ "type": "integer",
1398
+ "primaryKey": false,
1399
+ "notNull": true,
1400
+ "default": 1
1401
+ },
1402
+ "current_workflow_id": {
1403
+ "name": "current_workflow_id",
1404
+ "type": "text",
1405
+ "primaryKey": false,
1406
+ "notNull": true
1407
+ },
1408
+ "version": {
1409
+ "name": "version",
1410
+ "type": "text",
1411
+ "primaryKey": false,
1412
+ "notNull": false
1413
+ },
1414
+ "record_type": {
1415
+ "name": "record_type",
1416
+ "type": "text",
1417
+ "primaryKey": false,
1418
+ "notNull": false
1419
+ },
1420
+ "record_id": {
1421
+ "name": "record_id",
1422
+ "type": "text",
1423
+ "primaryKey": false,
1424
+ "notNull": false
1425
+ },
1426
+ "error": {
1427
+ "name": "error",
1428
+ "type": "text",
1429
+ "primaryKey": false,
1430
+ "notNull": false
1431
+ },
1432
+ "started_at": {
1433
+ "name": "started_at",
1434
+ "type": "timestamp with time zone",
1435
+ "primaryKey": false,
1436
+ "notNull": true,
1437
+ "default": "now()"
1438
+ },
1439
+ "finished_at": {
1440
+ "name": "finished_at",
1441
+ "type": "timestamp with time zone",
1442
+ "primaryKey": false,
1443
+ "notNull": false
1444
+ }
1445
+ },
1446
+ "indexes": {
1447
+ "hf_run_status_idx": {
1448
+ "name": "hf_run_status_idx",
1449
+ "columns": [
1450
+ {
1451
+ "expression": "status",
1452
+ "isExpression": false,
1453
+ "asc": true,
1454
+ "nulls": "last"
1455
+ }
1456
+ ],
1457
+ "isUnique": false,
1458
+ "concurrently": false,
1459
+ "method": "btree",
1460
+ "with": {}
1461
+ },
1462
+ "hf_run_record_idx": {
1463
+ "name": "hf_run_record_idx",
1464
+ "columns": [
1465
+ {
1466
+ "expression": "record_type",
1467
+ "isExpression": false,
1468
+ "asc": true,
1469
+ "nulls": "last"
1470
+ },
1471
+ {
1472
+ "expression": "record_id",
1473
+ "isExpression": false,
1474
+ "asc": true,
1475
+ "nulls": "last"
1476
+ }
1477
+ ],
1478
+ "isUnique": false,
1479
+ "concurrently": false,
1480
+ "method": "btree",
1481
+ "with": {}
1482
+ }
1483
+ },
1484
+ "foreignKeys": {},
1485
+ "compositePrimaryKeys": {},
1486
+ "uniqueConstraints": {
1487
+ "hf_run_current_workflow_id_unique": {
1488
+ "name": "hf_run_current_workflow_id_unique",
1489
+ "nullsNotDistinct": false,
1490
+ "columns": [
1491
+ "current_workflow_id"
1492
+ ]
1493
+ }
1494
+ },
1495
+ "policies": {},
1496
+ "checkConstraints": {
1497
+ "hf_run_attempt_positive": {
1498
+ "name": "hf_run_attempt_positive",
1499
+ "value": "\"hf_run\".\"attempt\" >= 1"
1500
+ }
1501
+ },
1502
+ "isRLSEnabled": false
1503
+ }
1504
+ },
1505
+ "enums": {},
1506
+ "schemas": {},
1507
+ "sequences": {},
1508
+ "roles": {},
1509
+ "policies": {},
1510
+ "views": {},
1511
+ "_meta": {
1512
+ "columns": {},
1513
+ "schemas": {},
1514
+ "tables": {}
1515
+ }
1516
+ }