1
8
9import type { PropertyType } from "@factory/shared/dto";
10
11
12export type PropertyValue =
13 | string
14 | number
15 | boolean
16 | null
17 | undefined
18 | PropertyValue[]
19 | { start: string; end: string }
20 | { id: string; name: string; url?: string; size?: number }[];
21
22
23export type DateValue = string;
24
25
26export interface DateRangeValue {
27 start: string;
28 end: string;
29}
30
31
32export interface FileValue {
33 id: string;
34 name: string;
35 url?: string;
36 size?: number;
37}
38
39
40export interface RecordRow {
41 id: string;
42 pageId: string;
43 position: string;
44 title?: string;
45 values: Record<string, PropertyValue | undefined>;
46 icon?: string;
47 coverUrl?: string;
48 archivedAt?: number;
49 createdTime: number;
50 lastEditedTime: number;
51}
52
53
54export interface PropertyInfo {
55 id: string;
56 name: string;
57 type: PropertyType;
58 config: Record<string, unknown>;
59}
60
61export interface EvalContext {
62 now: number;
63
64
65 actorUserId?: string | undefined;
66 userTimezone: string;
67}
68
69
70export interface ValueCodec {
71 type: PropertyType;
72
73 fromWire(json: unknown): PropertyValue;
74
75 toWire(value: PropertyValue): unknown;
76
77 display(value: PropertyValue, config: Record<string, unknown>, locale?: string): string;
78
79 compare(a: PropertyValue, b: PropertyValue, config: Record<string, unknown>): number;
80}
81