@wrenautomation/vireo 0.12.0 → 0.13.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.
- package/README.md +11 -3
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +30 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +102 -21
- package/dist/schema.js +24 -6
- package/dist/schema.js.map +1 -1
- package/dist/store.d.ts +314 -21
- package/dist/store.js +274 -27
- package/dist/store.js.map +1 -1
- package/drizzle/0008_calls.sql +24 -0
- package/drizzle/meta/0008_snapshot.json +1256 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
package/dist/store.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Collector } from "./collect.js";
|
|
2
2
|
import { type Db, type Hooks, type Tx } from "./db.js";
|
|
3
|
-
import { type Anchor, batches, type GuideState, guides, type Kind, notes, samples, ships, steers, subjects, type Tone, type Verdict, type Width } from "./schema.js";
|
|
3
|
+
import { type Anchor, batches, calls, type GuideState, guides, type Kind, notes, samples, ships, steers, subjects, type Tone, type Verdict, type Width } from "./schema.js";
|
|
4
4
|
import { type Strength } from "./stats.js";
|
|
5
5
|
import { type Source } from "./sync.js";
|
|
6
6
|
export interface Ports {
|
|
@@ -33,10 +33,29 @@ export type Parent = number | {
|
|
|
33
33
|
export type SubjectRow = typeof subjects.$inferSelect;
|
|
34
34
|
export type BatchRow = typeof batches.$inferSelect;
|
|
35
35
|
export type SampleRow = typeof samples.$inferSelect;
|
|
36
|
+
export type CallRow = typeof calls.$inferSelect;
|
|
37
|
+
/** `by` of calls made before calls had a judge (migration 0008); a host may name them after. */
|
|
38
|
+
export declare const EARLIER_JUDGE = "person";
|
|
36
39
|
export type NoteRow = typeof notes.$inferSelect;
|
|
37
40
|
export type GuideRow = typeof guides.$inferSelect;
|
|
38
41
|
export type ShipRow = typeof ships.$inferSelect;
|
|
39
42
|
export type SteerRow = typeof steers.$inferSelect;
|
|
43
|
+
export declare const BATCH_SORTS: readonly ["waiting", "newest", "oldest", "subject", "good"];
|
|
44
|
+
export type BatchSort = (typeof BATCH_SORTS)[number];
|
|
45
|
+
/** A page of batches (D11). `subjects`: only these (a host's folder); `who`: batches they called in. */
|
|
46
|
+
export interface BatchQuery {
|
|
47
|
+
subjects?: readonly number[];
|
|
48
|
+
subject?: string | number;
|
|
49
|
+
kind?: Kind;
|
|
50
|
+
/** waits = open and its subject's newest */
|
|
51
|
+
state?: "open" | "closed" | "waits";
|
|
52
|
+
who?: string;
|
|
53
|
+
/** default waiting: what waits first, then newest */
|
|
54
|
+
sort?: BatchSort;
|
|
55
|
+
limit?: number;
|
|
56
|
+
/** offset: the `next` of the page before */
|
|
57
|
+
after?: number;
|
|
58
|
+
}
|
|
40
59
|
/** A steer to set (D10). pin, prune: `sample`. cross: `sample` and `other`. width: `subject`. */
|
|
41
60
|
export type NewSteer = {
|
|
42
61
|
kind: "pin" | "prune";
|
|
@@ -53,13 +72,28 @@ export type NewSteer = {
|
|
|
53
72
|
width: Width;
|
|
54
73
|
why?: string | null;
|
|
55
74
|
};
|
|
75
|
+
type Called = Pick<CallRow, "sampleId" | "by" | "score" | "verdict">;
|
|
76
|
+
/**
|
|
77
|
+
* One sheet per (batch, person) who called in it: each sample of the batch with that person's
|
|
78
|
+
* call, or none (unmarked). The unit of every rank and rate (D11).
|
|
79
|
+
*/
|
|
80
|
+
export declare function sheets(rows: readonly Pick<SampleRow, "id" | "batchId">[], cs: readonly Called[]): {
|
|
81
|
+
batchId: number;
|
|
82
|
+
by: string;
|
|
83
|
+
marks: {
|
|
84
|
+
id: number;
|
|
85
|
+
call: Called | null;
|
|
86
|
+
}[];
|
|
87
|
+
}[];
|
|
56
88
|
/**
|
|
57
|
-
* Strength per judged sample: each
|
|
58
|
-
* unordered. Wins from 9 and up count double.
|
|
89
|
+
* Strength per judged sample: each sheet is a partial ranking by score, 10 down to 1, ties
|
|
90
|
+
* unordered; unmarked reads as 5. Wins from 9 and up count double.
|
|
59
91
|
*/
|
|
60
|
-
export declare function strengths(rows: readonly Pick<SampleRow, "id" | "batchId"
|
|
61
|
-
/**
|
|
62
|
-
export declare function
|
|
92
|
+
export declare function strengths(rows: readonly Pick<SampleRow, "id" | "batchId">[], cs: readonly Called[]): Strength[];
|
|
93
|
+
/** Good or better over every (sample, person) mark of these sheets; null with none. */
|
|
94
|
+
export declare function goodRateOf(ss: ReturnType<typeof sheets>): number | null;
|
|
95
|
+
/** With-vs-without good rate per guide, over every mark in judged batches. */
|
|
96
|
+
export declare function guideStats(guideRows: readonly GuideRow[], judged: readonly SampleRow[], cs: readonly Called[]): {
|
|
63
97
|
effect: {
|
|
64
98
|
with: {
|
|
65
99
|
good: number;
|
|
@@ -224,8 +258,11 @@ export declare class Vireo {
|
|
|
224
258
|
}[];
|
|
225
259
|
pruned: number[];
|
|
226
260
|
}>;
|
|
227
|
-
/**
|
|
228
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Batches that wait on the person, oldest first, with samples and notes: what they have to pick.
|
|
263
|
+
* `viewer`: a person sees only their own calls and notes (D11).
|
|
264
|
+
*/
|
|
265
|
+
queue(ref?: string | number, viewer?: string | null): Promise<{
|
|
229
266
|
batch: {
|
|
230
267
|
id: number;
|
|
231
268
|
subjectId: number;
|
|
@@ -250,7 +287,15 @@ export declare class Vireo {
|
|
|
250
287
|
by: string | null;
|
|
251
288
|
createdAt: Date;
|
|
252
289
|
};
|
|
253
|
-
samples: {
|
|
290
|
+
samples: ({
|
|
291
|
+
calls: {
|
|
292
|
+
id: number;
|
|
293
|
+
sampleId: number;
|
|
294
|
+
by: string;
|
|
295
|
+
score: number;
|
|
296
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
297
|
+
at: Date;
|
|
298
|
+
}[];
|
|
254
299
|
notes: {
|
|
255
300
|
id: number;
|
|
256
301
|
sampleId: number;
|
|
@@ -260,6 +305,8 @@ export declare class Vireo {
|
|
|
260
305
|
by: string | null;
|
|
261
306
|
createdAt: Date;
|
|
262
307
|
}[];
|
|
308
|
+
score: null;
|
|
309
|
+
verdict: null;
|
|
263
310
|
id: number;
|
|
264
311
|
batchId: number;
|
|
265
312
|
subjectId: number;
|
|
@@ -272,20 +319,62 @@ export declare class Vireo {
|
|
|
272
319
|
guides: number[];
|
|
273
320
|
change: string | null;
|
|
274
321
|
agent: string | null;
|
|
275
|
-
score: number | null;
|
|
276
|
-
verdict: "amazing" | "good" | "okay" | "bad" | null;
|
|
277
322
|
keptAt: Date | null;
|
|
278
323
|
createdAt: Date;
|
|
279
|
-
}
|
|
324
|
+
} | {
|
|
325
|
+
calls: {
|
|
326
|
+
id: number;
|
|
327
|
+
sampleId: number;
|
|
328
|
+
by: string;
|
|
329
|
+
score: number;
|
|
330
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
331
|
+
at: Date;
|
|
332
|
+
}[];
|
|
333
|
+
notes: {
|
|
334
|
+
id: number;
|
|
335
|
+
sampleId: number;
|
|
336
|
+
anchor: Anchor | null;
|
|
337
|
+
tone: "good" | "bad" | null;
|
|
338
|
+
text: string | null;
|
|
339
|
+
by: string | null;
|
|
340
|
+
createdAt: Date;
|
|
341
|
+
}[];
|
|
342
|
+
score: number;
|
|
343
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
344
|
+
id: number;
|
|
345
|
+
batchId: number;
|
|
346
|
+
subjectId: number;
|
|
347
|
+
position: number;
|
|
348
|
+
body: string | null;
|
|
349
|
+
media: string | null;
|
|
350
|
+
poster: string | null;
|
|
351
|
+
source: Source | null;
|
|
352
|
+
name: string | null;
|
|
353
|
+
guides: number[];
|
|
354
|
+
change: string | null;
|
|
355
|
+
agent: string | null;
|
|
356
|
+
keptAt: Date | null;
|
|
357
|
+
createdAt: Date;
|
|
358
|
+
})[];
|
|
280
359
|
}[]>;
|
|
360
|
+
private callsOf;
|
|
281
361
|
private notesOf;
|
|
282
362
|
/** Parent edges of these children, main parent first. */
|
|
283
363
|
private lineageOf;
|
|
284
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* `by`'s call: a 1-10 score, a verdict (its tap score) or null to clear. The verdict follows.
|
|
366
|
+
* One call per person per sample (D11).
|
|
367
|
+
*/
|
|
285
368
|
judge(sampleId: number, call: number | Verdict | null, by: string | null): Promise<{
|
|
286
369
|
id: number;
|
|
287
|
-
|
|
288
|
-
|
|
370
|
+
by: string;
|
|
371
|
+
score: null;
|
|
372
|
+
verdict: null;
|
|
373
|
+
} | {
|
|
374
|
+
id: number;
|
|
375
|
+
by: string;
|
|
376
|
+
score: number;
|
|
377
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
289
378
|
}>;
|
|
290
379
|
addNote(sampleId: number, n: {
|
|
291
380
|
anchor?: Anchor | null;
|
|
@@ -417,7 +506,16 @@ export declare class Vireo {
|
|
|
417
506
|
}[];
|
|
418
507
|
batches: {
|
|
419
508
|
goodRate: number | null;
|
|
420
|
-
|
|
509
|
+
judges: string[];
|
|
510
|
+
samples: ({
|
|
511
|
+
calls: {
|
|
512
|
+
id: number;
|
|
513
|
+
sampleId: number;
|
|
514
|
+
by: string;
|
|
515
|
+
score: number;
|
|
516
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
517
|
+
at: Date;
|
|
518
|
+
}[];
|
|
421
519
|
strength: Strength | null;
|
|
422
520
|
notes: {
|
|
423
521
|
id: number;
|
|
@@ -432,6 +530,8 @@ export declare class Vireo {
|
|
|
432
530
|
id: number;
|
|
433
531
|
took: string | null;
|
|
434
532
|
}[];
|
|
533
|
+
score: null;
|
|
534
|
+
verdict: null;
|
|
435
535
|
id: number;
|
|
436
536
|
batchId: number;
|
|
437
537
|
subjectId: number;
|
|
@@ -444,11 +544,48 @@ export declare class Vireo {
|
|
|
444
544
|
guides: number[];
|
|
445
545
|
change: string | null;
|
|
446
546
|
agent: string | null;
|
|
447
|
-
score: number | null;
|
|
448
|
-
verdict: "amazing" | "good" | "okay" | "bad" | null;
|
|
449
547
|
keptAt: Date | null;
|
|
450
548
|
createdAt: Date;
|
|
451
|
-
}
|
|
549
|
+
} | {
|
|
550
|
+
calls: {
|
|
551
|
+
id: number;
|
|
552
|
+
sampleId: number;
|
|
553
|
+
by: string;
|
|
554
|
+
score: number;
|
|
555
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
556
|
+
at: Date;
|
|
557
|
+
}[];
|
|
558
|
+
strength: Strength | null;
|
|
559
|
+
notes: {
|
|
560
|
+
id: number;
|
|
561
|
+
sampleId: number;
|
|
562
|
+
anchor: Anchor | null;
|
|
563
|
+
tone: "good" | "bad" | null;
|
|
564
|
+
text: string | null;
|
|
565
|
+
by: string | null;
|
|
566
|
+
createdAt: Date;
|
|
567
|
+
}[];
|
|
568
|
+
parents: {
|
|
569
|
+
id: number;
|
|
570
|
+
took: string | null;
|
|
571
|
+
}[];
|
|
572
|
+
score: number;
|
|
573
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
574
|
+
id: number;
|
|
575
|
+
batchId: number;
|
|
576
|
+
subjectId: number;
|
|
577
|
+
position: number;
|
|
578
|
+
body: string | null;
|
|
579
|
+
media: string | null;
|
|
580
|
+
poster: string | null;
|
|
581
|
+
source: Source | null;
|
|
582
|
+
name: string | null;
|
|
583
|
+
guides: number[];
|
|
584
|
+
change: string | null;
|
|
585
|
+
agent: string | null;
|
|
586
|
+
keptAt: Date | null;
|
|
587
|
+
createdAt: Date;
|
|
588
|
+
})[];
|
|
452
589
|
id: number;
|
|
453
590
|
subjectId: number;
|
|
454
591
|
n: number;
|
|
@@ -517,6 +654,161 @@ export declare class Vireo {
|
|
|
517
654
|
}[];
|
|
518
655
|
}>;
|
|
519
656
|
/** Kept samples, newest first, with their subject. */
|
|
657
|
+
/**
|
|
658
|
+
* Batches as a page: filters, a sort and an offset (D11). `viewer` = the person reading: an open
|
|
659
|
+
* batch shows only their own marks, and none of the agent's words.
|
|
660
|
+
*/
|
|
661
|
+
batches(q?: BatchQuery, viewer?: string | null): Promise<{
|
|
662
|
+
rows: {
|
|
663
|
+
ref: string;
|
|
664
|
+
id: number;
|
|
665
|
+
n: number;
|
|
666
|
+
title: string | null;
|
|
667
|
+
state: "open" | "closed";
|
|
668
|
+
note: string | null;
|
|
669
|
+
why: string | null;
|
|
670
|
+
createdAt: Date;
|
|
671
|
+
subject: {
|
|
672
|
+
id: number;
|
|
673
|
+
slug: string;
|
|
674
|
+
name: string;
|
|
675
|
+
kind: "text" | "image" | "video" | "page";
|
|
676
|
+
brief: string | null;
|
|
677
|
+
seeds: string[];
|
|
678
|
+
state: "open" | "paused" | "done";
|
|
679
|
+
by: string | null;
|
|
680
|
+
createdAt: Date;
|
|
681
|
+
};
|
|
682
|
+
waits: boolean;
|
|
683
|
+
samples: number;
|
|
684
|
+
kept: number;
|
|
685
|
+
marked: number;
|
|
686
|
+
judges: number | null;
|
|
687
|
+
goodRate: number | null;
|
|
688
|
+
tally: {
|
|
689
|
+
amazing: number;
|
|
690
|
+
good: number;
|
|
691
|
+
okay: number;
|
|
692
|
+
bad: number;
|
|
693
|
+
unmarked: number;
|
|
694
|
+
} | null;
|
|
695
|
+
thumbs: {
|
|
696
|
+
id: number;
|
|
697
|
+
poster: string;
|
|
698
|
+
verdict: "amazing" | "good" | "okay" | "bad" | null;
|
|
699
|
+
}[];
|
|
700
|
+
}[];
|
|
701
|
+
next: number | null;
|
|
702
|
+
waiting: number;
|
|
703
|
+
}>;
|
|
704
|
+
/** One batch whole, for `viewer` (see `batches`); `newer` = the subject's newer open batch. */
|
|
705
|
+
batch(ref: string | number, viewer?: string | null): Promise<{
|
|
706
|
+
why: string | null;
|
|
707
|
+
subject: {
|
|
708
|
+
id: number;
|
|
709
|
+
slug: string;
|
|
710
|
+
name: string;
|
|
711
|
+
kind: "text" | "image" | "video" | "page";
|
|
712
|
+
brief: string | null;
|
|
713
|
+
seeds: string[];
|
|
714
|
+
state: "open" | "paused" | "done";
|
|
715
|
+
by: string | null;
|
|
716
|
+
createdAt: Date;
|
|
717
|
+
};
|
|
718
|
+
goodRate: number | null;
|
|
719
|
+
judges: string[] | null;
|
|
720
|
+
newer: {
|
|
721
|
+
n: number;
|
|
722
|
+
ref: string;
|
|
723
|
+
} | null;
|
|
724
|
+
samples: ({
|
|
725
|
+
calls: {
|
|
726
|
+
id: number;
|
|
727
|
+
sampleId: number;
|
|
728
|
+
by: string;
|
|
729
|
+
score: number;
|
|
730
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
731
|
+
at: Date;
|
|
732
|
+
}[];
|
|
733
|
+
notes: {
|
|
734
|
+
id: number;
|
|
735
|
+
sampleId: number;
|
|
736
|
+
anchor: Anchor | null;
|
|
737
|
+
tone: "good" | "bad" | null;
|
|
738
|
+
text: string | null;
|
|
739
|
+
by: string | null;
|
|
740
|
+
createdAt: Date;
|
|
741
|
+
}[];
|
|
742
|
+
parents: {
|
|
743
|
+
id: number;
|
|
744
|
+
took: string | null;
|
|
745
|
+
}[];
|
|
746
|
+
score: null;
|
|
747
|
+
verdict: null;
|
|
748
|
+
name: string | null;
|
|
749
|
+
change: string | null;
|
|
750
|
+
id: number;
|
|
751
|
+
batchId: number;
|
|
752
|
+
subjectId: number;
|
|
753
|
+
position: number;
|
|
754
|
+
body: string | null;
|
|
755
|
+
media: string | null;
|
|
756
|
+
poster: string | null;
|
|
757
|
+
source: Source | null;
|
|
758
|
+
guides: number[];
|
|
759
|
+
agent: string | null;
|
|
760
|
+
keptAt: Date | null;
|
|
761
|
+
createdAt: Date;
|
|
762
|
+
} | {
|
|
763
|
+
calls: {
|
|
764
|
+
id: number;
|
|
765
|
+
sampleId: number;
|
|
766
|
+
by: string;
|
|
767
|
+
score: number;
|
|
768
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
769
|
+
at: Date;
|
|
770
|
+
}[];
|
|
771
|
+
notes: {
|
|
772
|
+
id: number;
|
|
773
|
+
sampleId: number;
|
|
774
|
+
anchor: Anchor | null;
|
|
775
|
+
tone: "good" | "bad" | null;
|
|
776
|
+
text: string | null;
|
|
777
|
+
by: string | null;
|
|
778
|
+
createdAt: Date;
|
|
779
|
+
}[];
|
|
780
|
+
parents: {
|
|
781
|
+
id: number;
|
|
782
|
+
took: string | null;
|
|
783
|
+
}[];
|
|
784
|
+
score: number;
|
|
785
|
+
verdict: "amazing" | "good" | "okay" | "bad";
|
|
786
|
+
name: string | null;
|
|
787
|
+
change: string | null;
|
|
788
|
+
id: number;
|
|
789
|
+
batchId: number;
|
|
790
|
+
subjectId: number;
|
|
791
|
+
position: number;
|
|
792
|
+
body: string | null;
|
|
793
|
+
media: string | null;
|
|
794
|
+
poster: string | null;
|
|
795
|
+
source: Source | null;
|
|
796
|
+
guides: number[];
|
|
797
|
+
agent: string | null;
|
|
798
|
+
keptAt: Date | null;
|
|
799
|
+
createdAt: Date;
|
|
800
|
+
})[];
|
|
801
|
+
id: number;
|
|
802
|
+
subjectId: number;
|
|
803
|
+
n: number;
|
|
804
|
+
title: string | null;
|
|
805
|
+
agent: string | null;
|
|
806
|
+
state: "open" | "closed";
|
|
807
|
+
note: string | null;
|
|
808
|
+
closedAt: Date | null;
|
|
809
|
+
createdAt: Date;
|
|
810
|
+
ref: string;
|
|
811
|
+
}>;
|
|
520
812
|
catalog(opts?: {
|
|
521
813
|
kind?: Kind;
|
|
522
814
|
subject?: string | number;
|
|
@@ -534,8 +826,6 @@ export declare class Vireo {
|
|
|
534
826
|
guides: number[];
|
|
535
827
|
change: string | null;
|
|
536
828
|
agent: string | null;
|
|
537
|
-
score: number | null;
|
|
538
|
-
verdict: "amazing" | "good" | "okay" | "bad" | null;
|
|
539
829
|
keptAt: Date | null;
|
|
540
830
|
createdAt: Date;
|
|
541
831
|
};
|
|
@@ -548,7 +838,10 @@ export declare class Vireo {
|
|
|
548
838
|
}
|
|
549
839
|
/** Read models a host's page renders: no hand-copied types. */
|
|
550
840
|
export type Queue = Awaited<ReturnType<Vireo["queue"]>>;
|
|
841
|
+
export type BatchPage = Awaited<ReturnType<Vireo["batches"]>>;
|
|
842
|
+
export type BatchWhole = Awaited<ReturnType<Vireo["batch"]>>;
|
|
551
843
|
export type Feedback = Awaited<ReturnType<Vireo["feedback"]>>;
|
|
552
844
|
export type SubjectList = Awaited<ReturnType<Vireo["listSubjects"]>>;
|
|
553
845
|
export type Catalog = Awaited<ReturnType<Vireo["catalog"]>>;
|
|
554
846
|
export type Steers = Awaited<ReturnType<Vireo["steersOf"]>>;
|
|
847
|
+
export {};
|