@verdict-ai/db 0.1.0 → 0.2.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 (42) hide show
  1. package/dist/auth.d.ts +12 -2
  2. package/dist/auth.js +5 -4
  3. package/dist/auth.js.map +1 -1
  4. package/dist/control.d.ts +58 -0
  5. package/dist/control.js +305 -0
  6. package/dist/control.js.map +1 -0
  7. package/dist/d1.d.ts +1201 -0
  8. package/dist/dialects.d.ts +7 -0
  9. package/dist/dialects.js +17 -0
  10. package/dist/dialects.js.map +1 -1
  11. package/dist/documents.d.ts +2 -0
  12. package/dist/postgres.d.ts +2454 -268
  13. package/dist/queries.d.ts +2 -0
  14. package/dist/queries.js +4 -0
  15. package/dist/queries.js.map +1 -1
  16. package/dist/schema/control.d.ts +71 -0
  17. package/dist/schema/control.js +29 -0
  18. package/dist/schema/control.js.map +1 -0
  19. package/dist/schema/pg.d.ts +2453 -262
  20. package/dist/schema/pg.js +44 -2
  21. package/dist/schema/pg.js.map +1 -1
  22. package/dist/schema/sqlite.d.ts +2680 -273
  23. package/dist/schema/sqlite.js +44 -2
  24. package/dist/schema/sqlite.js.map +1 -1
  25. package/dist/store.d.ts +12 -4
  26. package/dist/store.js +77 -6
  27. package/dist/store.js.map +1 -1
  28. package/drizzle/0002_publications.sql +20 -0
  29. package/drizzle/0003_publishers.sql +9 -0
  30. package/drizzle/0004_control_plane.sql +75 -0
  31. package/drizzle/meta/0002_snapshot.json +659 -0
  32. package/drizzle/meta/0003_snapshot.json +712 -0
  33. package/drizzle/meta/0004_snapshot.json +1191 -0
  34. package/drizzle/meta/_journal.json +21 -0
  35. package/drizzle/pg/0001_publications.sql +20 -0
  36. package/drizzle/pg/0002_publishers.sql +9 -0
  37. package/drizzle/pg/0003_control_plane.sql +75 -0
  38. package/drizzle/pg/meta/0001_snapshot.json +769 -0
  39. package/drizzle/pg/meta/0002_snapshot.json +828 -0
  40. package/drizzle/pg/meta/0003_snapshot.json +1381 -0
  41. package/drizzle/pg/meta/_journal.json +21 -0
  42. package/package.json +4 -3
@@ -0,0 +1,769 @@
1
+ {
2
+ "id": "baef0b9e-b446-43d7-9099-d8bb44422eee",
3
+ "prevId": "397b7de7-2624-49e7-8526-c171eb6ae8b4",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.api_keys": {
8
+ "name": "api_keys",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "tenant_id": {
18
+ "name": "tenant_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "name": {
24
+ "name": "name",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "key_hash": {
30
+ "name": "key_hash",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "prefix": {
36
+ "name": "prefix",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "created_at": {
42
+ "name": "created_at",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": true
46
+ },
47
+ "last_used_at": {
48
+ "name": "last_used_at",
49
+ "type": "text",
50
+ "primaryKey": false,
51
+ "notNull": false
52
+ },
53
+ "revoked_at": {
54
+ "name": "revoked_at",
55
+ "type": "text",
56
+ "primaryKey": false,
57
+ "notNull": false
58
+ }
59
+ },
60
+ "indexes": {
61
+ "api_keys_hash": {
62
+ "name": "api_keys_hash",
63
+ "columns": [
64
+ {
65
+ "expression": "key_hash",
66
+ "isExpression": false,
67
+ "asc": true,
68
+ "nulls": "last"
69
+ }
70
+ ],
71
+ "isUnique": true,
72
+ "concurrently": false,
73
+ "method": "btree",
74
+ "with": {}
75
+ },
76
+ "api_keys_tenant": {
77
+ "name": "api_keys_tenant",
78
+ "columns": [
79
+ {
80
+ "expression": "tenant_id",
81
+ "isExpression": false,
82
+ "asc": true,
83
+ "nulls": "last"
84
+ }
85
+ ],
86
+ "isUnique": false,
87
+ "concurrently": false,
88
+ "method": "btree",
89
+ "with": {}
90
+ }
91
+ },
92
+ "foreignKeys": {},
93
+ "compositePrimaryKeys": {},
94
+ "uniqueConstraints": {},
95
+ "policies": {},
96
+ "checkConstraints": {},
97
+ "isRLSEnabled": false
98
+ },
99
+ "public.evaluations": {
100
+ "name": "evaluations",
101
+ "schema": "",
102
+ "columns": {
103
+ "id": {
104
+ "name": "id",
105
+ "type": "text",
106
+ "primaryKey": true,
107
+ "notNull": true
108
+ },
109
+ "tenant_id": {
110
+ "name": "tenant_id",
111
+ "type": "text",
112
+ "primaryKey": false,
113
+ "notNull": false
114
+ },
115
+ "rubric_id": {
116
+ "name": "rubric_id",
117
+ "type": "text",
118
+ "primaryKey": false,
119
+ "notNull": false
120
+ },
121
+ "rubric_name": {
122
+ "name": "rubric_name",
123
+ "type": "text",
124
+ "primaryKey": false,
125
+ "notNull": true
126
+ },
127
+ "subject_name": {
128
+ "name": "subject_name",
129
+ "type": "text",
130
+ "primaryKey": false,
131
+ "notNull": false
132
+ },
133
+ "status": {
134
+ "name": "status",
135
+ "type": "text",
136
+ "primaryKey": false,
137
+ "notNull": true
138
+ },
139
+ "score": {
140
+ "name": "score",
141
+ "type": "double precision",
142
+ "primaryKey": false,
143
+ "notNull": false
144
+ },
145
+ "grade": {
146
+ "name": "grade",
147
+ "type": "text",
148
+ "primaryKey": false,
149
+ "notNull": false
150
+ },
151
+ "passed": {
152
+ "name": "passed",
153
+ "type": "boolean",
154
+ "primaryKey": false,
155
+ "notNull": false
156
+ },
157
+ "pending_human": {
158
+ "name": "pending_human",
159
+ "type": "integer",
160
+ "primaryKey": false,
161
+ "notNull": true,
162
+ "default": 0
163
+ },
164
+ "decision_calls": {
165
+ "name": "decision_calls",
166
+ "type": "integer",
167
+ "primaryKey": false,
168
+ "notNull": true,
169
+ "default": 0
170
+ },
171
+ "llm_calls": {
172
+ "name": "llm_calls",
173
+ "type": "integer",
174
+ "primaryKey": false,
175
+ "notNull": true,
176
+ "default": 0
177
+ },
178
+ "input_tokens": {
179
+ "name": "input_tokens",
180
+ "type": "integer",
181
+ "primaryKey": false,
182
+ "notNull": true,
183
+ "default": 0
184
+ },
185
+ "duration_ms": {
186
+ "name": "duration_ms",
187
+ "type": "integer",
188
+ "primaryKey": false,
189
+ "notNull": true,
190
+ "default": 0
191
+ },
192
+ "doc": {
193
+ "name": "doc",
194
+ "type": "jsonb",
195
+ "primaryKey": false,
196
+ "notNull": true
197
+ },
198
+ "created_at": {
199
+ "name": "created_at",
200
+ "type": "text",
201
+ "primaryKey": false,
202
+ "notNull": true
203
+ },
204
+ "updated_at": {
205
+ "name": "updated_at",
206
+ "type": "text",
207
+ "primaryKey": false,
208
+ "notNull": true
209
+ }
210
+ },
211
+ "indexes": {
212
+ "evaluations_tenant_created": {
213
+ "name": "evaluations_tenant_created",
214
+ "columns": [
215
+ {
216
+ "expression": "tenant_id",
217
+ "isExpression": false,
218
+ "asc": true,
219
+ "nulls": "last"
220
+ },
221
+ {
222
+ "expression": "created_at",
223
+ "isExpression": false,
224
+ "asc": true,
225
+ "nulls": "last"
226
+ }
227
+ ],
228
+ "isUnique": false,
229
+ "concurrently": false,
230
+ "method": "btree",
231
+ "with": {}
232
+ },
233
+ "evaluations_rubric_created": {
234
+ "name": "evaluations_rubric_created",
235
+ "columns": [
236
+ {
237
+ "expression": "rubric_id",
238
+ "isExpression": false,
239
+ "asc": true,
240
+ "nulls": "last"
241
+ },
242
+ {
243
+ "expression": "created_at",
244
+ "isExpression": false,
245
+ "asc": true,
246
+ "nulls": "last"
247
+ }
248
+ ],
249
+ "isUnique": false,
250
+ "concurrently": false,
251
+ "method": "btree",
252
+ "with": {}
253
+ },
254
+ "evaluations_tenant_status": {
255
+ "name": "evaluations_tenant_status",
256
+ "columns": [
257
+ {
258
+ "expression": "tenant_id",
259
+ "isExpression": false,
260
+ "asc": true,
261
+ "nulls": "last"
262
+ },
263
+ {
264
+ "expression": "status",
265
+ "isExpression": false,
266
+ "asc": true,
267
+ "nulls": "last"
268
+ }
269
+ ],
270
+ "isUnique": false,
271
+ "concurrently": false,
272
+ "method": "btree",
273
+ "with": {}
274
+ }
275
+ },
276
+ "foreignKeys": {},
277
+ "compositePrimaryKeys": {},
278
+ "uniqueConstraints": {},
279
+ "policies": {},
280
+ "checkConstraints": {},
281
+ "isRLSEnabled": false
282
+ },
283
+ "public.idempotency_keys": {
284
+ "name": "idempotency_keys",
285
+ "schema": "",
286
+ "columns": {
287
+ "tenant_id": {
288
+ "name": "tenant_id",
289
+ "type": "text",
290
+ "primaryKey": false,
291
+ "notNull": false
292
+ },
293
+ "key": {
294
+ "name": "key",
295
+ "type": "text",
296
+ "primaryKey": false,
297
+ "notNull": true
298
+ },
299
+ "fingerprint": {
300
+ "name": "fingerprint",
301
+ "type": "text",
302
+ "primaryKey": false,
303
+ "notNull": true
304
+ },
305
+ "target_type": {
306
+ "name": "target_type",
307
+ "type": "text",
308
+ "primaryKey": false,
309
+ "notNull": true
310
+ },
311
+ "target_id": {
312
+ "name": "target_id",
313
+ "type": "text",
314
+ "primaryKey": false,
315
+ "notNull": false
316
+ },
317
+ "target_ids": {
318
+ "name": "target_ids",
319
+ "type": "jsonb",
320
+ "primaryKey": false,
321
+ "notNull": false
322
+ },
323
+ "created_at": {
324
+ "name": "created_at",
325
+ "type": "text",
326
+ "primaryKey": false,
327
+ "notNull": true
328
+ },
329
+ "expires_at": {
330
+ "name": "expires_at",
331
+ "type": "text",
332
+ "primaryKey": false,
333
+ "notNull": true
334
+ }
335
+ },
336
+ "indexes": {
337
+ "idempotency_keys_tenant_key": {
338
+ "name": "idempotency_keys_tenant_key",
339
+ "columns": [
340
+ {
341
+ "expression": "tenant_id",
342
+ "isExpression": false,
343
+ "asc": true,
344
+ "nulls": "last"
345
+ },
346
+ {
347
+ "expression": "key",
348
+ "isExpression": false,
349
+ "asc": true,
350
+ "nulls": "last"
351
+ }
352
+ ],
353
+ "isUnique": true,
354
+ "concurrently": false,
355
+ "method": "btree",
356
+ "with": {}
357
+ }
358
+ },
359
+ "foreignKeys": {},
360
+ "compositePrimaryKeys": {},
361
+ "uniqueConstraints": {},
362
+ "policies": {},
363
+ "checkConstraints": {},
364
+ "isRLSEnabled": false
365
+ },
366
+ "public.publications": {
367
+ "name": "publications",
368
+ "schema": "",
369
+ "columns": {
370
+ "id": {
371
+ "name": "id",
372
+ "type": "text",
373
+ "primaryKey": true,
374
+ "notNull": true
375
+ },
376
+ "tenant_id": {
377
+ "name": "tenant_id",
378
+ "type": "text",
379
+ "primaryKey": false,
380
+ "notNull": false
381
+ },
382
+ "owner": {
383
+ "name": "owner",
384
+ "type": "text",
385
+ "primaryKey": false,
386
+ "notNull": true
387
+ },
388
+ "slug": {
389
+ "name": "slug",
390
+ "type": "text",
391
+ "primaryKey": false,
392
+ "notNull": true
393
+ },
394
+ "version_id": {
395
+ "name": "version_id",
396
+ "type": "text",
397
+ "primaryKey": false,
398
+ "notNull": true
399
+ },
400
+ "title": {
401
+ "name": "title",
402
+ "type": "text",
403
+ "primaryKey": false,
404
+ "notNull": true
405
+ },
406
+ "domain": {
407
+ "name": "domain",
408
+ "type": "text",
409
+ "primaryKey": false,
410
+ "notNull": false
411
+ },
412
+ "locale": {
413
+ "name": "locale",
414
+ "type": "text",
415
+ "primaryKey": false,
416
+ "notNull": false
417
+ },
418
+ "judgment_type": {
419
+ "name": "judgment_type",
420
+ "type": "text",
421
+ "primaryKey": false,
422
+ "notNull": true
423
+ },
424
+ "license": {
425
+ "name": "license",
426
+ "type": "text",
427
+ "primaryKey": false,
428
+ "notNull": true
429
+ },
430
+ "doc": {
431
+ "name": "doc",
432
+ "type": "jsonb",
433
+ "primaryKey": false,
434
+ "notNull": true
435
+ },
436
+ "created_at": {
437
+ "name": "created_at",
438
+ "type": "text",
439
+ "primaryKey": false,
440
+ "notNull": true
441
+ },
442
+ "withdrawn_at": {
443
+ "name": "withdrawn_at",
444
+ "type": "text",
445
+ "primaryKey": false,
446
+ "notNull": false
447
+ }
448
+ },
449
+ "indexes": {
450
+ "publications_owner_slug_version": {
451
+ "name": "publications_owner_slug_version",
452
+ "columns": [
453
+ {
454
+ "expression": "owner",
455
+ "isExpression": false,
456
+ "asc": true,
457
+ "nulls": "last"
458
+ },
459
+ {
460
+ "expression": "slug",
461
+ "isExpression": false,
462
+ "asc": true,
463
+ "nulls": "last"
464
+ },
465
+ {
466
+ "expression": "version_id",
467
+ "isExpression": false,
468
+ "asc": true,
469
+ "nulls": "last"
470
+ }
471
+ ],
472
+ "isUnique": true,
473
+ "concurrently": false,
474
+ "method": "btree",
475
+ "with": {}
476
+ },
477
+ "publications_created": {
478
+ "name": "publications_created",
479
+ "columns": [
480
+ {
481
+ "expression": "created_at",
482
+ "isExpression": false,
483
+ "asc": true,
484
+ "nulls": "last"
485
+ }
486
+ ],
487
+ "isUnique": false,
488
+ "concurrently": false,
489
+ "method": "btree",
490
+ "with": {}
491
+ },
492
+ "publications_version": {
493
+ "name": "publications_version",
494
+ "columns": [
495
+ {
496
+ "expression": "version_id",
497
+ "isExpression": false,
498
+ "asc": true,
499
+ "nulls": "last"
500
+ }
501
+ ],
502
+ "isUnique": false,
503
+ "concurrently": false,
504
+ "method": "btree",
505
+ "with": {}
506
+ },
507
+ "publications_tenant": {
508
+ "name": "publications_tenant",
509
+ "columns": [
510
+ {
511
+ "expression": "tenant_id",
512
+ "isExpression": false,
513
+ "asc": true,
514
+ "nulls": "last"
515
+ }
516
+ ],
517
+ "isUnique": false,
518
+ "concurrently": false,
519
+ "method": "btree",
520
+ "with": {}
521
+ }
522
+ },
523
+ "foreignKeys": {},
524
+ "compositePrimaryKeys": {},
525
+ "uniqueConstraints": {},
526
+ "policies": {},
527
+ "checkConstraints": {},
528
+ "isRLSEnabled": false
529
+ },
530
+ "public.ratings": {
531
+ "name": "ratings",
532
+ "schema": "",
533
+ "columns": {
534
+ "id": {
535
+ "name": "id",
536
+ "type": "text",
537
+ "primaryKey": true,
538
+ "notNull": true
539
+ },
540
+ "evaluation_id": {
541
+ "name": "evaluation_id",
542
+ "type": "text",
543
+ "primaryKey": false,
544
+ "notNull": true
545
+ },
546
+ "tenant_id": {
547
+ "name": "tenant_id",
548
+ "type": "text",
549
+ "primaryKey": false,
550
+ "notNull": false
551
+ },
552
+ "rubric_id": {
553
+ "name": "rubric_id",
554
+ "type": "text",
555
+ "primaryKey": false,
556
+ "notNull": false
557
+ },
558
+ "criterion_id": {
559
+ "name": "criterion_id",
560
+ "type": "text",
561
+ "primaryKey": false,
562
+ "notNull": true
563
+ },
564
+ "rater_id": {
565
+ "name": "rater_id",
566
+ "type": "text",
567
+ "primaryKey": false,
568
+ "notNull": true
569
+ },
570
+ "judge_type": {
571
+ "name": "judge_type",
572
+ "type": "text",
573
+ "primaryKey": false,
574
+ "notNull": true
575
+ },
576
+ "status": {
577
+ "name": "status",
578
+ "type": "text",
579
+ "primaryKey": false,
580
+ "notNull": true
581
+ },
582
+ "score": {
583
+ "name": "score",
584
+ "type": "double precision",
585
+ "primaryKey": false,
586
+ "notNull": false
587
+ },
588
+ "normalized": {
589
+ "name": "normalized",
590
+ "type": "double precision",
591
+ "primaryKey": false,
592
+ "notNull": false
593
+ },
594
+ "confidence": {
595
+ "name": "confidence",
596
+ "type": "double precision",
597
+ "primaryKey": false,
598
+ "notNull": false
599
+ },
600
+ "model": {
601
+ "name": "model",
602
+ "type": "text",
603
+ "primaryKey": false,
604
+ "notNull": false
605
+ },
606
+ "created_at": {
607
+ "name": "created_at",
608
+ "type": "text",
609
+ "primaryKey": false,
610
+ "notNull": true
611
+ }
612
+ },
613
+ "indexes": {
614
+ "ratings_evaluation": {
615
+ "name": "ratings_evaluation",
616
+ "columns": [
617
+ {
618
+ "expression": "evaluation_id",
619
+ "isExpression": false,
620
+ "asc": true,
621
+ "nulls": "last"
622
+ }
623
+ ],
624
+ "isUnique": false,
625
+ "concurrently": false,
626
+ "method": "btree",
627
+ "with": {}
628
+ },
629
+ "ratings_rubric_criterion": {
630
+ "name": "ratings_rubric_criterion",
631
+ "columns": [
632
+ {
633
+ "expression": "rubric_id",
634
+ "isExpression": false,
635
+ "asc": true,
636
+ "nulls": "last"
637
+ },
638
+ {
639
+ "expression": "criterion_id",
640
+ "isExpression": false,
641
+ "asc": true,
642
+ "nulls": "last"
643
+ }
644
+ ],
645
+ "isUnique": false,
646
+ "concurrently": false,
647
+ "method": "btree",
648
+ "with": {}
649
+ },
650
+ "ratings_tenant_judge": {
651
+ "name": "ratings_tenant_judge",
652
+ "columns": [
653
+ {
654
+ "expression": "tenant_id",
655
+ "isExpression": false,
656
+ "asc": true,
657
+ "nulls": "last"
658
+ },
659
+ {
660
+ "expression": "judge_type",
661
+ "isExpression": false,
662
+ "asc": true,
663
+ "nulls": "last"
664
+ }
665
+ ],
666
+ "isUnique": false,
667
+ "concurrently": false,
668
+ "method": "btree",
669
+ "with": {}
670
+ }
671
+ },
672
+ "foreignKeys": {},
673
+ "compositePrimaryKeys": {},
674
+ "uniqueConstraints": {},
675
+ "policies": {},
676
+ "checkConstraints": {},
677
+ "isRLSEnabled": false
678
+ },
679
+ "public.rubrics": {
680
+ "name": "rubrics",
681
+ "schema": "",
682
+ "columns": {
683
+ "id": {
684
+ "name": "id",
685
+ "type": "text",
686
+ "primaryKey": true,
687
+ "notNull": true
688
+ },
689
+ "tenant_id": {
690
+ "name": "tenant_id",
691
+ "type": "text",
692
+ "primaryKey": false,
693
+ "notNull": false
694
+ },
695
+ "name": {
696
+ "name": "name",
697
+ "type": "text",
698
+ "primaryKey": false,
699
+ "notNull": true
700
+ },
701
+ "version": {
702
+ "name": "version",
703
+ "type": "text",
704
+ "primaryKey": false,
705
+ "notNull": true,
706
+ "default": "'1'"
707
+ },
708
+ "doc": {
709
+ "name": "doc",
710
+ "type": "jsonb",
711
+ "primaryKey": false,
712
+ "notNull": true
713
+ },
714
+ "created_at": {
715
+ "name": "created_at",
716
+ "type": "text",
717
+ "primaryKey": false,
718
+ "notNull": true
719
+ },
720
+ "updated_at": {
721
+ "name": "updated_at",
722
+ "type": "text",
723
+ "primaryKey": false,
724
+ "notNull": true
725
+ }
726
+ },
727
+ "indexes": {
728
+ "rubrics_tenant_created": {
729
+ "name": "rubrics_tenant_created",
730
+ "columns": [
731
+ {
732
+ "expression": "tenant_id",
733
+ "isExpression": false,
734
+ "asc": true,
735
+ "nulls": "last"
736
+ },
737
+ {
738
+ "expression": "created_at",
739
+ "isExpression": false,
740
+ "asc": true,
741
+ "nulls": "last"
742
+ }
743
+ ],
744
+ "isUnique": false,
745
+ "concurrently": false,
746
+ "method": "btree",
747
+ "with": {}
748
+ }
749
+ },
750
+ "foreignKeys": {},
751
+ "compositePrimaryKeys": {},
752
+ "uniqueConstraints": {},
753
+ "policies": {},
754
+ "checkConstraints": {},
755
+ "isRLSEnabled": false
756
+ }
757
+ },
758
+ "enums": {},
759
+ "schemas": {},
760
+ "sequences": {},
761
+ "roles": {},
762
+ "policies": {},
763
+ "views": {},
764
+ "_meta": {
765
+ "columns": {},
766
+ "schemas": {},
767
+ "tables": {}
768
+ }
769
+ }