-
-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathconstants.ts
More file actions
85 lines (72 loc) · 2.03 KB
/
constants.ts
File metadata and controls
85 lines (72 loc) · 2.03 KB
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
// /**
// * The comment prefix for annotation generated Kysely queries with context information.
// */
// export const CONTEXT_COMMENT_PREFIX = '-- $$context:';
/**
* The types of fields that are numeric.
*/
export const NUMERIC_FIELD_TYPES = ['Int', 'Float', 'BigInt', 'Decimal'];
/**
* Client API methods that are not supported in transactions.
*/
export const TRANSACTION_UNSUPPORTED_METHODS = ['$transaction', '$connect', '$disconnect', '$use'] as const;
/**
* Prefix for JSON field used to store joined delegate rows.
*/
export const DELEGATE_JOINED_FIELD_PREFIX = '$delegate$';
/**
* Logical combinators used in filters.
*/
export const LOGICAL_COMBINATORS = ['AND', 'OR', 'NOT'] as const;
/**
* Aggregation operators.
*/
export const AggregateOperators = ['_count', '_sum', '_avg', '_min', '_max'] as const;
export type AggregateOperators = (typeof AggregateOperators)[number];
/**
* Mapping of filter operators to their corresponding filter kind categories.
*/
export const FILTER_PROPERTY_TO_KIND = {
// Equality operators
equals: 'Equality',
not: 'Equality',
in: 'Equality',
notIn: 'Equality',
// Range operators
lt: 'Range',
lte: 'Range',
gt: 'Range',
gte: 'Range',
between: 'Range',
// Like operators
contains: 'Like',
startsWith: 'Like',
endsWith: 'Like',
mode: 'Like',
// Relation operators
is: 'Relation',
isNot: 'Relation',
some: 'Relation',
every: 'Relation',
none: 'Relation',
// Json operators
path: 'Json',
string_contains: 'Json',
string_starts_with: 'Json',
string_ends_with: 'Json',
array_contains: 'Json',
array_starts_with: 'Json',
array_ends_with: 'Json',
// Fuzzy search operators
fuzzy: 'Fuzzy',
fuzzyContains: 'Fuzzy',
// List operators
has: 'List',
hasEvery: 'List',
hasSome: 'List',
isEmpty: 'List',
} as const;
/**
* Mapping of filter operators to their corresponding filter kind categories.
*/
export type FilterPropertyToKind = typeof FILTER_PROPERTY_TO_KIND;