-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtypes.ts
85 lines (73 loc) · 1.61 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// incremented only when breaking changes are made
export const SCHEMA_VERSION = 7;
export type ScalarType =
| 'bool'
| 'string'
| 'i16'
| 'u16'
| 'i32'
| 'u32'
| 'f32';
export type ColumnType =
| ScalarType
// column is an array of unknown type
| 'array'
// row index (references column in same table)
| 'row'
// row index (references column in foreign table)
| 'foreignrow'
// row index (references foreign table with no columns)
| 'enumrow';
export interface RefUsingRowIndex {
table: string;
}
export interface RefUsingColumn {
table: string;
column: string;
}
export type FileExtension = string;
// Bitmask
export enum ValidFor {
PoE1 = 0x01,
PoE2 = 0x02,
Common = 0x03,
};
export interface TableColumn {
name: string | null;
description: string | null;
array: boolean;
type: ColumnType;
unique: boolean;
localized: boolean;
until: string | null;
references: RefUsingRowIndex | RefUsingColumn | null;
file: FileExtension | null;
files: FileExtension[] | null;
interval: boolean;
}
export interface SchemaTable {
validFor: ValidFor;
name: string;
columns: TableColumn[];
tags: string[];
}
export interface SchemaEnumeration {
validFor: ValidFor;
name: string;
indexing: 0 | 1;
enumerators: Array<string | null>;
}
export interface SchemaMetadata {
version: number;
createdAt: number;
}
// exported as "schema.min.json"
export interface SchemaFile extends SchemaMetadata {
tables: SchemaTable[];
enumerations: SchemaEnumeration[];
}
// exported as "schema.jsonl"
export type SchemaLine =
| SchemaMetadata
| SchemaTable
| SchemaEnumeration;