@verdict-ai/db 0.0.0-stage → 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 (65) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +21 -2
  3. package/dist/auth.d.ts +44 -0
  4. package/dist/auth.js +81 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/control.d.ts +58 -0
  7. package/dist/control.js +305 -0
  8. package/dist/control.js.map +1 -0
  9. package/dist/d1.d.ts +2235 -0
  10. package/dist/d1.js +21 -0
  11. package/dist/d1.js.map +1 -0
  12. package/dist/dialects.d.ts +21 -0
  13. package/dist/dialects.js +83 -0
  14. package/dist/dialects.js.map +1 -0
  15. package/dist/documents.d.ts +89 -0
  16. package/dist/documents.js +45 -0
  17. package/dist/documents.js.map +1 -0
  18. package/dist/errors.d.ts +7 -0
  19. package/dist/errors.js +21 -0
  20. package/dist/errors.js.map +1 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.js +12 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/postgres.d.ts +4111 -0
  25. package/dist/postgres.js +63 -0
  26. package/dist/postgres.js.map +1 -0
  27. package/dist/queries.d.ts +33 -0
  28. package/dist/queries.js +72 -0
  29. package/dist/queries.js.map +1 -0
  30. package/dist/schema/control.d.ts +71 -0
  31. package/dist/schema/control.js +29 -0
  32. package/dist/schema/control.js.map +1 -0
  33. package/dist/schema/pg.d.ts +4083 -0
  34. package/dist/schema/pg.js +132 -0
  35. package/dist/schema/pg.js.map +1 -0
  36. package/dist/schema/sqlite.d.ts +4457 -0
  37. package/dist/schema/sqlite.js +132 -0
  38. package/dist/schema/sqlite.js.map +1 -0
  39. package/dist/sqlite.d.ts +25 -0
  40. package/dist/sqlite.js +64 -0
  41. package/dist/sqlite.js.map +1 -0
  42. package/dist/store.d.ts +55 -0
  43. package/dist/store.js +220 -0
  44. package/dist/store.js.map +1 -0
  45. package/drizzle/0000_init.sql +66 -0
  46. package/drizzle/0001_idempotency.sql +12 -0
  47. package/drizzle/0002_publications.sql +20 -0
  48. package/drizzle/0003_publishers.sql +9 -0
  49. package/drizzle/0004_control_plane.sql +75 -0
  50. package/drizzle/meta/0000_snapshot.json +452 -0
  51. package/drizzle/meta/0001_snapshot.json +527 -0
  52. package/drizzle/meta/0002_snapshot.json +659 -0
  53. package/drizzle/meta/0003_snapshot.json +712 -0
  54. package/drizzle/meta/0004_snapshot.json +1191 -0
  55. package/drizzle/meta/_journal.json +41 -0
  56. package/drizzle/pg/0000_init.sql +78 -0
  57. package/drizzle/pg/0001_publications.sql +20 -0
  58. package/drizzle/pg/0002_publishers.sql +9 -0
  59. package/drizzle/pg/0003_control_plane.sql +75 -0
  60. package/drizzle/pg/meta/0000_snapshot.json +605 -0
  61. package/drizzle/pg/meta/0001_snapshot.json +769 -0
  62. package/drizzle/pg/meta/0002_snapshot.json +828 -0
  63. package/drizzle/pg/meta/0003_snapshot.json +1381 -0
  64. package/drizzle/pg/meta/_journal.json +34 -0
  65. package/package.json +82 -3
@@ -0,0 +1,20 @@
1
+ CREATE TABLE `publications` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `tenant_id` text,
4
+ `owner` text NOT NULL,
5
+ `slug` text NOT NULL,
6
+ `version_id` text NOT NULL,
7
+ `title` text NOT NULL,
8
+ `domain` text,
9
+ `locale` text,
10
+ `judgment_type` text NOT NULL,
11
+ `license` text NOT NULL,
12
+ `doc` text NOT NULL,
13
+ `created_at` text NOT NULL,
14
+ `withdrawn_at` text
15
+ );
16
+ --> statement-breakpoint
17
+ CREATE UNIQUE INDEX `publications_owner_slug_version` ON `publications` (`owner`,`slug`,`version_id`);--> statement-breakpoint
18
+ CREATE INDEX `publications_created` ON `publications` (`created_at`);--> statement-breakpoint
19
+ CREATE INDEX `publications_version` ON `publications` (`version_id`);--> statement-breakpoint
20
+ CREATE INDEX `publications_tenant` ON `publications` (`tenant_id`);
@@ -0,0 +1,9 @@
1
+ CREATE TABLE `publishers` (
2
+ `tenant_id` text PRIMARY KEY NOT NULL,
3
+ `github_id` integer NOT NULL,
4
+ `login` text NOT NULL,
5
+ `created_at` text NOT NULL,
6
+ `updated_at` text NOT NULL
7
+ );
8
+ --> statement-breakpoint
9
+ CREATE UNIQUE INDEX `publishers_github_id` ON `publishers` (`github_id`);
@@ -0,0 +1,75 @@
1
+ CREATE TABLE `comparison_reports` (
2
+ `tenant_id` text NOT NULL,
3
+ `project` text NOT NULL,
4
+ `id` text NOT NULL,
5
+ `rubric_name` text NOT NULL,
6
+ `head_version_id` text NOT NULL,
7
+ `doc` text NOT NULL,
8
+ `reported_at` text NOT NULL,
9
+ PRIMARY KEY(`tenant_id`, `project`, `id`)
10
+ );
11
+ --> statement-breakpoint
12
+ CREATE INDEX `comparison_reports_reported` ON `comparison_reports` (`tenant_id`,`project`,`reported_at`);--> statement-breakpoint
13
+ CREATE TABLE `environments` (
14
+ `tenant_id` text NOT NULL,
15
+ `project` text NOT NULL,
16
+ `name` text NOT NULL,
17
+ `created_at` text NOT NULL,
18
+ PRIMARY KEY(`tenant_id`, `project`, `name`)
19
+ );
20
+ --> statement-breakpoint
21
+ CREATE TABLE `pointers` (
22
+ `tenant_id` text NOT NULL,
23
+ `project` text NOT NULL,
24
+ `environment` text NOT NULL,
25
+ `rubric_name` text NOT NULL,
26
+ `version_id` text NOT NULL,
27
+ `updated_at` text NOT NULL,
28
+ PRIMARY KEY(`tenant_id`, `project`, `environment`, `rubric_name`)
29
+ );
30
+ --> statement-breakpoint
31
+ CREATE INDEX `pointers_version` ON `pointers` (`tenant_id`,`project`,`rubric_name`,`version_id`);--> statement-breakpoint
32
+ CREATE TABLE `project_versions` (
33
+ `tenant_id` text NOT NULL,
34
+ `project` text NOT NULL,
35
+ `rubric_name` text NOT NULL,
36
+ `version_id` text NOT NULL,
37
+ `doc` text NOT NULL,
38
+ `created_at` text NOT NULL,
39
+ PRIMARY KEY(`tenant_id`, `project`, `rubric_name`, `version_id`)
40
+ );
41
+ --> statement-breakpoint
42
+ CREATE INDEX `project_versions_created` ON `project_versions` (`tenant_id`,`project`,`created_at`);--> statement-breakpoint
43
+ CREATE TABLE `projects` (
44
+ `tenant_id` text NOT NULL,
45
+ `name` text NOT NULL,
46
+ `created_at` text NOT NULL,
47
+ PRIMARY KEY(`tenant_id`, `name`)
48
+ );
49
+ --> statement-breakpoint
50
+ CREATE TABLE `promotions` (
51
+ `tenant_id` text NOT NULL,
52
+ `project` text NOT NULL,
53
+ `id` text NOT NULL,
54
+ `environment` text NOT NULL,
55
+ `rubric_name` text NOT NULL,
56
+ `doc` text NOT NULL,
57
+ `created_at` text NOT NULL,
58
+ PRIMARY KEY(`tenant_id`, `project`, `id`)
59
+ );
60
+ --> statement-breakpoint
61
+ CREATE INDEX `promotions_created` ON `promotions` (`tenant_id`,`project`,`created_at`);--> statement-breakpoint
62
+ CREATE TABLE `run_reports` (
63
+ `tenant_id` text NOT NULL,
64
+ `project` text NOT NULL,
65
+ `run_id` text NOT NULL,
66
+ `rubric_name` text NOT NULL,
67
+ `version_id` text NOT NULL,
68
+ `dataset_name` text,
69
+ `started_at` text NOT NULL,
70
+ `doc` text NOT NULL,
71
+ `reported_at` text NOT NULL,
72
+ PRIMARY KEY(`tenant_id`, `project`, `run_id`)
73
+ );
74
+ --> statement-breakpoint
75
+ CREATE INDEX `run_reports_started` ON `run_reports` (`tenant_id`,`project`,`started_at`);
@@ -0,0 +1,452 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "94b3e522-db6f-42ac-943a-ebacf304d669",
5
+ "prevId": "00000000-0000-0000-0000-000000000000",
6
+ "tables": {
7
+ "api_keys": {
8
+ "name": "api_keys",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "tenant_id": {
18
+ "name": "tenant_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "name": {
25
+ "name": "name",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "key_hash": {
32
+ "name": "key_hash",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "prefix": {
39
+ "name": "prefix",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": true,
43
+ "autoincrement": false
44
+ },
45
+ "created_at": {
46
+ "name": "created_at",
47
+ "type": "text",
48
+ "primaryKey": false,
49
+ "notNull": true,
50
+ "autoincrement": false
51
+ },
52
+ "last_used_at": {
53
+ "name": "last_used_at",
54
+ "type": "text",
55
+ "primaryKey": false,
56
+ "notNull": false,
57
+ "autoincrement": false
58
+ },
59
+ "revoked_at": {
60
+ "name": "revoked_at",
61
+ "type": "text",
62
+ "primaryKey": false,
63
+ "notNull": false,
64
+ "autoincrement": false
65
+ }
66
+ },
67
+ "indexes": {
68
+ "api_keys_hash": {
69
+ "name": "api_keys_hash",
70
+ "columns": [
71
+ "key_hash"
72
+ ],
73
+ "isUnique": true
74
+ },
75
+ "api_keys_tenant": {
76
+ "name": "api_keys_tenant",
77
+ "columns": [
78
+ "tenant_id"
79
+ ],
80
+ "isUnique": false
81
+ }
82
+ },
83
+ "foreignKeys": {},
84
+ "compositePrimaryKeys": {},
85
+ "uniqueConstraints": {},
86
+ "checkConstraints": {}
87
+ },
88
+ "evaluations": {
89
+ "name": "evaluations",
90
+ "columns": {
91
+ "id": {
92
+ "name": "id",
93
+ "type": "text",
94
+ "primaryKey": true,
95
+ "notNull": true,
96
+ "autoincrement": false
97
+ },
98
+ "tenant_id": {
99
+ "name": "tenant_id",
100
+ "type": "text",
101
+ "primaryKey": false,
102
+ "notNull": false,
103
+ "autoincrement": false
104
+ },
105
+ "rubric_id": {
106
+ "name": "rubric_id",
107
+ "type": "text",
108
+ "primaryKey": false,
109
+ "notNull": false,
110
+ "autoincrement": false
111
+ },
112
+ "rubric_name": {
113
+ "name": "rubric_name",
114
+ "type": "text",
115
+ "primaryKey": false,
116
+ "notNull": true,
117
+ "autoincrement": false
118
+ },
119
+ "subject_name": {
120
+ "name": "subject_name",
121
+ "type": "text",
122
+ "primaryKey": false,
123
+ "notNull": false,
124
+ "autoincrement": false
125
+ },
126
+ "status": {
127
+ "name": "status",
128
+ "type": "text",
129
+ "primaryKey": false,
130
+ "notNull": true,
131
+ "autoincrement": false
132
+ },
133
+ "score": {
134
+ "name": "score",
135
+ "type": "real",
136
+ "primaryKey": false,
137
+ "notNull": false,
138
+ "autoincrement": false
139
+ },
140
+ "grade": {
141
+ "name": "grade",
142
+ "type": "text",
143
+ "primaryKey": false,
144
+ "notNull": false,
145
+ "autoincrement": false
146
+ },
147
+ "passed": {
148
+ "name": "passed",
149
+ "type": "integer",
150
+ "primaryKey": false,
151
+ "notNull": false,
152
+ "autoincrement": false
153
+ },
154
+ "pending_human": {
155
+ "name": "pending_human",
156
+ "type": "integer",
157
+ "primaryKey": false,
158
+ "notNull": true,
159
+ "autoincrement": false,
160
+ "default": 0
161
+ },
162
+ "decision_calls": {
163
+ "name": "decision_calls",
164
+ "type": "integer",
165
+ "primaryKey": false,
166
+ "notNull": true,
167
+ "autoincrement": false,
168
+ "default": 0
169
+ },
170
+ "llm_calls": {
171
+ "name": "llm_calls",
172
+ "type": "integer",
173
+ "primaryKey": false,
174
+ "notNull": true,
175
+ "autoincrement": false,
176
+ "default": 0
177
+ },
178
+ "input_tokens": {
179
+ "name": "input_tokens",
180
+ "type": "integer",
181
+ "primaryKey": false,
182
+ "notNull": true,
183
+ "autoincrement": false,
184
+ "default": 0
185
+ },
186
+ "duration_ms": {
187
+ "name": "duration_ms",
188
+ "type": "integer",
189
+ "primaryKey": false,
190
+ "notNull": true,
191
+ "autoincrement": false,
192
+ "default": 0
193
+ },
194
+ "doc": {
195
+ "name": "doc",
196
+ "type": "text",
197
+ "primaryKey": false,
198
+ "notNull": true,
199
+ "autoincrement": false
200
+ },
201
+ "created_at": {
202
+ "name": "created_at",
203
+ "type": "text",
204
+ "primaryKey": false,
205
+ "notNull": true,
206
+ "autoincrement": false
207
+ },
208
+ "updated_at": {
209
+ "name": "updated_at",
210
+ "type": "text",
211
+ "primaryKey": false,
212
+ "notNull": true,
213
+ "autoincrement": false
214
+ }
215
+ },
216
+ "indexes": {
217
+ "evaluations_tenant_created": {
218
+ "name": "evaluations_tenant_created",
219
+ "columns": [
220
+ "tenant_id",
221
+ "created_at"
222
+ ],
223
+ "isUnique": false
224
+ },
225
+ "evaluations_rubric_created": {
226
+ "name": "evaluations_rubric_created",
227
+ "columns": [
228
+ "rubric_id",
229
+ "created_at"
230
+ ],
231
+ "isUnique": false
232
+ },
233
+ "evaluations_tenant_status": {
234
+ "name": "evaluations_tenant_status",
235
+ "columns": [
236
+ "tenant_id",
237
+ "status"
238
+ ],
239
+ "isUnique": false
240
+ }
241
+ },
242
+ "foreignKeys": {},
243
+ "compositePrimaryKeys": {},
244
+ "uniqueConstraints": {},
245
+ "checkConstraints": {}
246
+ },
247
+ "ratings": {
248
+ "name": "ratings",
249
+ "columns": {
250
+ "id": {
251
+ "name": "id",
252
+ "type": "text",
253
+ "primaryKey": true,
254
+ "notNull": true,
255
+ "autoincrement": false
256
+ },
257
+ "evaluation_id": {
258
+ "name": "evaluation_id",
259
+ "type": "text",
260
+ "primaryKey": false,
261
+ "notNull": true,
262
+ "autoincrement": false
263
+ },
264
+ "tenant_id": {
265
+ "name": "tenant_id",
266
+ "type": "text",
267
+ "primaryKey": false,
268
+ "notNull": false,
269
+ "autoincrement": false
270
+ },
271
+ "rubric_id": {
272
+ "name": "rubric_id",
273
+ "type": "text",
274
+ "primaryKey": false,
275
+ "notNull": false,
276
+ "autoincrement": false
277
+ },
278
+ "criterion_id": {
279
+ "name": "criterion_id",
280
+ "type": "text",
281
+ "primaryKey": false,
282
+ "notNull": true,
283
+ "autoincrement": false
284
+ },
285
+ "rater_id": {
286
+ "name": "rater_id",
287
+ "type": "text",
288
+ "primaryKey": false,
289
+ "notNull": true,
290
+ "autoincrement": false
291
+ },
292
+ "judge_type": {
293
+ "name": "judge_type",
294
+ "type": "text",
295
+ "primaryKey": false,
296
+ "notNull": true,
297
+ "autoincrement": false
298
+ },
299
+ "status": {
300
+ "name": "status",
301
+ "type": "text",
302
+ "primaryKey": false,
303
+ "notNull": true,
304
+ "autoincrement": false
305
+ },
306
+ "score": {
307
+ "name": "score",
308
+ "type": "real",
309
+ "primaryKey": false,
310
+ "notNull": false,
311
+ "autoincrement": false
312
+ },
313
+ "normalized": {
314
+ "name": "normalized",
315
+ "type": "real",
316
+ "primaryKey": false,
317
+ "notNull": false,
318
+ "autoincrement": false
319
+ },
320
+ "confidence": {
321
+ "name": "confidence",
322
+ "type": "real",
323
+ "primaryKey": false,
324
+ "notNull": false,
325
+ "autoincrement": false
326
+ },
327
+ "model": {
328
+ "name": "model",
329
+ "type": "text",
330
+ "primaryKey": false,
331
+ "notNull": false,
332
+ "autoincrement": false
333
+ },
334
+ "created_at": {
335
+ "name": "created_at",
336
+ "type": "text",
337
+ "primaryKey": false,
338
+ "notNull": true,
339
+ "autoincrement": false
340
+ }
341
+ },
342
+ "indexes": {
343
+ "ratings_evaluation": {
344
+ "name": "ratings_evaluation",
345
+ "columns": [
346
+ "evaluation_id"
347
+ ],
348
+ "isUnique": false
349
+ },
350
+ "ratings_rubric_criterion": {
351
+ "name": "ratings_rubric_criterion",
352
+ "columns": [
353
+ "rubric_id",
354
+ "criterion_id"
355
+ ],
356
+ "isUnique": false
357
+ },
358
+ "ratings_tenant_judge": {
359
+ "name": "ratings_tenant_judge",
360
+ "columns": [
361
+ "tenant_id",
362
+ "judge_type"
363
+ ],
364
+ "isUnique": false
365
+ }
366
+ },
367
+ "foreignKeys": {},
368
+ "compositePrimaryKeys": {},
369
+ "uniqueConstraints": {},
370
+ "checkConstraints": {}
371
+ },
372
+ "rubrics": {
373
+ "name": "rubrics",
374
+ "columns": {
375
+ "id": {
376
+ "name": "id",
377
+ "type": "text",
378
+ "primaryKey": true,
379
+ "notNull": true,
380
+ "autoincrement": false
381
+ },
382
+ "tenant_id": {
383
+ "name": "tenant_id",
384
+ "type": "text",
385
+ "primaryKey": false,
386
+ "notNull": false,
387
+ "autoincrement": false
388
+ },
389
+ "name": {
390
+ "name": "name",
391
+ "type": "text",
392
+ "primaryKey": false,
393
+ "notNull": true,
394
+ "autoincrement": false
395
+ },
396
+ "version": {
397
+ "name": "version",
398
+ "type": "text",
399
+ "primaryKey": false,
400
+ "notNull": true,
401
+ "autoincrement": false,
402
+ "default": "'1'"
403
+ },
404
+ "doc": {
405
+ "name": "doc",
406
+ "type": "text",
407
+ "primaryKey": false,
408
+ "notNull": true,
409
+ "autoincrement": false
410
+ },
411
+ "created_at": {
412
+ "name": "created_at",
413
+ "type": "text",
414
+ "primaryKey": false,
415
+ "notNull": true,
416
+ "autoincrement": false
417
+ },
418
+ "updated_at": {
419
+ "name": "updated_at",
420
+ "type": "text",
421
+ "primaryKey": false,
422
+ "notNull": true,
423
+ "autoincrement": false
424
+ }
425
+ },
426
+ "indexes": {
427
+ "rubrics_tenant_created": {
428
+ "name": "rubrics_tenant_created",
429
+ "columns": [
430
+ "tenant_id",
431
+ "created_at"
432
+ ],
433
+ "isUnique": false
434
+ }
435
+ },
436
+ "foreignKeys": {},
437
+ "compositePrimaryKeys": {},
438
+ "uniqueConstraints": {},
439
+ "checkConstraints": {}
440
+ }
441
+ },
442
+ "views": {},
443
+ "enums": {},
444
+ "_meta": {
445
+ "schemas": {},
446
+ "tables": {},
447
+ "columns": {}
448
+ },
449
+ "internal": {
450
+ "indexes": {}
451
+ }
452
+ }