@mrnafisia/type-query 1.0.45 → 1.0.46
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 +2 -2
- package/dist/U.d.ts +2 -2
- package/dist/U.js +27 -27
- package/dist/context.d.ts +987 -987
- package/dist/context.js +85 -85
- package/dist/dictionary.d.ts +12 -12
- package/dist/dictionary.js +179 -179
- package/dist/entity.d.ts +3562 -3562
- package/dist/entity.js +997 -997
- package/dist/error.d.ts +4 -4
- package/dist/error.js +6 -6
- package/dist/index.d.ts +36 -36
- package/dist/index.js +60 -60
- package/dist/model.d.ts +1005 -1005
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +282 -282
- package/dist/parser.d.ts +11 -11
- package/dist/parser.js +120 -120
- package/dist/pool.d.ts +5 -5
- package/dist/pool.js +121 -121
- package/dist/schema.d.ts +25 -25
- package/dist/schema.js +395 -395
- package/dist/testUtil.d.ts +4 -4
- package/dist/testUtil.js +333 -333
- package/dist/types/context.d.ts +55 -55
- package/dist/types/context.js +2 -2
- package/dist/types/entity.d.ts +70 -70
- package/dist/types/entity.js +2 -2
- package/dist/types/json.d.ts +8 -8
- package/dist/types/json.js +2 -2
- package/dist/types/model.d.ts +23 -23
- package/dist/types/model.js +2 -2
- package/dist/types/pool.d.ts +18 -18
- package/dist/types/pool.js +2 -2
- package/dist/types/postgres.d.ts +9 -9
- package/dist/types/postgres.js +2 -2
- package/dist/types/table.d.ts +234 -234
- package/dist/types/table.js +2 -2
- package/dist/types/testUtil.d.ts +26 -26
- package/dist/types/testUtil.js +2 -2
- package/dist/utils.d.ts +67 -67
- package/dist/utils.js +220 -220
- package/package.json +39 -39
package/dist/types/table.d.ts
CHANGED
|
@@ -1,235 +1,235 @@
|
|
|
1
|
-
import Decimal from 'decimal.js';
|
|
2
|
-
import type { JSON } from './json';
|
|
3
|
-
import { PostgresType } from './postgres';
|
|
4
|
-
type ReferenceActions = 'no-action' | 'restrict' | 'set-null' | 'set-Default' | 'cascade';
|
|
5
|
-
type Base = {
|
|
6
|
-
type: PostgresType;
|
|
7
|
-
default: boolean | 'value' | 'auto-increment' | 'created-at' | 'updated-at';
|
|
8
|
-
nullable: boolean;
|
|
9
|
-
title?: string;
|
|
10
|
-
reference?: {
|
|
11
|
-
table: Table;
|
|
12
|
-
onUpdate?: ReferenceActions;
|
|
13
|
-
onDelete?: ReferenceActions;
|
|
14
|
-
column: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
type Primary = {
|
|
18
|
-
primary?: true;
|
|
19
|
-
nullable: false;
|
|
20
|
-
} | {
|
|
21
|
-
nullable: true;
|
|
22
|
-
};
|
|
23
|
-
type Types = {
|
|
24
|
-
type: 'boolean' | 'text' | 'uuid' | 'date' | 'json' | 'jsonb';
|
|
25
|
-
} | {
|
|
26
|
-
type: 'smallint' | 'integer' | 'real' | 'double precision';
|
|
27
|
-
min?: number;
|
|
28
|
-
max?: number;
|
|
29
|
-
} | {
|
|
30
|
-
type: 'bigint';
|
|
31
|
-
min?: bigint;
|
|
32
|
-
max?: bigint;
|
|
33
|
-
} | {
|
|
34
|
-
type: 'numeric';
|
|
35
|
-
precision: number;
|
|
36
|
-
scale: number;
|
|
37
|
-
min?: Decimal;
|
|
38
|
-
max?: Decimal;
|
|
39
|
-
} | {
|
|
40
|
-
type: 'character' | 'character varying';
|
|
41
|
-
minLength?: number;
|
|
42
|
-
maxLength?: number;
|
|
43
|
-
regex?: RegExp;
|
|
44
|
-
} | {
|
|
45
|
-
type: 'timestamp without time zone' | 'timestamp with time zone';
|
|
46
|
-
length?: number;
|
|
47
|
-
};
|
|
48
|
-
type ReferenceCheck<T extends Table, C extends keyof T['columns']> = {
|
|
49
|
-
type: 'boolean';
|
|
50
|
-
reference?: {
|
|
51
|
-
table: T;
|
|
52
|
-
onUpdate?: ReferenceActions;
|
|
53
|
-
onDelete?: ReferenceActions;
|
|
54
|
-
column: T['columns'][C]['type'] extends 'boolean' ? C : never;
|
|
55
|
-
};
|
|
56
|
-
} | {
|
|
57
|
-
type: 'smallint';
|
|
58
|
-
reference?: {
|
|
59
|
-
table: T;
|
|
60
|
-
onUpdate?: ReferenceActions;
|
|
61
|
-
onDelete?: ReferenceActions;
|
|
62
|
-
column: T['columns'][C]['type'] extends 'smallint' ? C : never;
|
|
63
|
-
};
|
|
64
|
-
} | {
|
|
65
|
-
type: 'integer';
|
|
66
|
-
reference?: {
|
|
67
|
-
table: T;
|
|
68
|
-
onUpdate?: ReferenceActions;
|
|
69
|
-
onDelete?: ReferenceActions;
|
|
70
|
-
column: T['columns'][C]['type'] extends 'smallint' | 'integer' ? C : never;
|
|
71
|
-
};
|
|
72
|
-
} | {
|
|
73
|
-
type: 'bigint';
|
|
74
|
-
reference?: {
|
|
75
|
-
table: T;
|
|
76
|
-
onUpdate?: ReferenceActions;
|
|
77
|
-
onDelete?: ReferenceActions;
|
|
78
|
-
column: T['columns'][C]['type'] extends 'smallint' | 'integer' | 'bigint' ? C : never;
|
|
79
|
-
};
|
|
80
|
-
} | {
|
|
81
|
-
type: 'real';
|
|
82
|
-
reference?: {
|
|
83
|
-
table: T;
|
|
84
|
-
onUpdate?: ReferenceActions;
|
|
85
|
-
onDelete?: ReferenceActions;
|
|
86
|
-
column: T['columns'][C]['type'] extends 'real' ? C : never;
|
|
87
|
-
};
|
|
88
|
-
} | {
|
|
89
|
-
type: 'double precision';
|
|
90
|
-
reference?: {
|
|
91
|
-
table: T;
|
|
92
|
-
onUpdate?: ReferenceActions;
|
|
93
|
-
onDelete?: ReferenceActions;
|
|
94
|
-
column: T['columns'][C]['type'] extends 'double precision' ? C : never;
|
|
95
|
-
};
|
|
96
|
-
} | {
|
|
97
|
-
type: 'text';
|
|
98
|
-
reference?: {
|
|
99
|
-
table: T;
|
|
100
|
-
onUpdate?: ReferenceActions;
|
|
101
|
-
onDelete?: ReferenceActions;
|
|
102
|
-
column: T['columns'][C]['type'] extends 'text' ? C : never;
|
|
103
|
-
};
|
|
104
|
-
} | {
|
|
105
|
-
type: 'uuid';
|
|
106
|
-
reference?: {
|
|
107
|
-
table: T;
|
|
108
|
-
onUpdate?: ReferenceActions;
|
|
109
|
-
onDelete?: ReferenceActions;
|
|
110
|
-
column: T['columns'][C]['type'] extends 'uuid' ? C : never;
|
|
111
|
-
};
|
|
112
|
-
} | {
|
|
113
|
-
type: 'date';
|
|
114
|
-
reference?: {
|
|
115
|
-
table: T;
|
|
116
|
-
onUpdate?: ReferenceActions;
|
|
117
|
-
onDelete?: ReferenceActions;
|
|
118
|
-
column: T['columns'][C]['type'] extends 'date' ? C : never;
|
|
119
|
-
};
|
|
120
|
-
} | {
|
|
121
|
-
type: 'json';
|
|
122
|
-
reference?: {
|
|
123
|
-
table: T;
|
|
124
|
-
onUpdate?: ReferenceActions;
|
|
125
|
-
onDelete?: ReferenceActions;
|
|
126
|
-
column: T['columns'][C]['type'] extends 'json' ? C : never;
|
|
127
|
-
};
|
|
128
|
-
} | {
|
|
129
|
-
type: 'jsonb';
|
|
130
|
-
reference?: {
|
|
131
|
-
table: T;
|
|
132
|
-
onUpdate?: ReferenceActions;
|
|
133
|
-
onDelete?: ReferenceActions;
|
|
134
|
-
column: T['columns'][C]['type'] extends 'jsonb' ? C : never;
|
|
135
|
-
};
|
|
136
|
-
} | {
|
|
137
|
-
type: 'numeric';
|
|
138
|
-
reference?: {
|
|
139
|
-
table: T;
|
|
140
|
-
onUpdate?: ReferenceActions;
|
|
141
|
-
onDelete?: ReferenceActions;
|
|
142
|
-
column: T['columns'][C]['type'] extends 'numeric' ? C : never;
|
|
143
|
-
};
|
|
144
|
-
} | {
|
|
145
|
-
type: 'character';
|
|
146
|
-
reference?: {
|
|
147
|
-
table: T;
|
|
148
|
-
onUpdate?: ReferenceActions;
|
|
149
|
-
onDelete?: ReferenceActions;
|
|
150
|
-
column: T['columns'][C]['type'] extends 'character' ? C : never;
|
|
151
|
-
};
|
|
152
|
-
} | {
|
|
153
|
-
type: 'character varying';
|
|
154
|
-
reference?: {
|
|
155
|
-
table: T;
|
|
156
|
-
onUpdate?: ReferenceActions;
|
|
157
|
-
onDelete?: ReferenceActions;
|
|
158
|
-
column: T['columns'][C]['type'] extends 'character varying' ? C : never;
|
|
159
|
-
};
|
|
160
|
-
} | {
|
|
161
|
-
type: 'timestamp without time zone';
|
|
162
|
-
reference?: {
|
|
163
|
-
table: T;
|
|
164
|
-
onUpdate?: ReferenceActions;
|
|
165
|
-
onDelete?: ReferenceActions;
|
|
166
|
-
column: T['columns'][C]['type'] extends 'timestamp without time zone' ? C : never;
|
|
167
|
-
};
|
|
168
|
-
} | {
|
|
169
|
-
type: 'timestamp with time zone';
|
|
170
|
-
reference?: {
|
|
171
|
-
table: T;
|
|
172
|
-
onUpdate?: ReferenceActions;
|
|
173
|
-
onDelete?: ReferenceActions;
|
|
174
|
-
column: T['columns'][C]['type'] extends 'timestamp with time zone' ? C : never;
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
type Default = {
|
|
178
|
-
default: false;
|
|
179
|
-
} | {
|
|
180
|
-
default: true;
|
|
181
|
-
value: string;
|
|
182
|
-
} | {
|
|
183
|
-
default: 'auto-increment';
|
|
184
|
-
type: 'smallint' | 'integer' | 'bigint';
|
|
185
|
-
seqTitle?: string;
|
|
186
|
-
} | {
|
|
187
|
-
default: 'created-at' | 'updated-at';
|
|
188
|
-
type: 'timestamp without time zone' | 'timestamp with time zone';
|
|
189
|
-
} | ({
|
|
190
|
-
default: 'value';
|
|
191
|
-
type: 'boolean';
|
|
192
|
-
value: boolean;
|
|
193
|
-
} | {
|
|
194
|
-
default: 'value';
|
|
195
|
-
type: 'smallint' | 'integer' | 'real' | 'double precision';
|
|
196
|
-
value: number;
|
|
197
|
-
} | {
|
|
198
|
-
default: 'value';
|
|
199
|
-
type: 'bigint';
|
|
200
|
-
value: bigint;
|
|
201
|
-
} | {
|
|
202
|
-
default: 'value';
|
|
203
|
-
type: 'numeric';
|
|
204
|
-
value: Decimal;
|
|
205
|
-
} | {
|
|
206
|
-
default: 'value';
|
|
207
|
-
type: 'character' | 'character varying' | 'text' | 'uuid';
|
|
208
|
-
value: string;
|
|
209
|
-
} | {
|
|
210
|
-
default: 'value';
|
|
211
|
-
type: 'date' | 'timestamp without time zone' | 'timestamp with time zone';
|
|
212
|
-
value: Date;
|
|
213
|
-
} | {
|
|
214
|
-
default: 'value';
|
|
215
|
-
type: 'json' | 'jsonb';
|
|
216
|
-
value: JSON;
|
|
217
|
-
});
|
|
218
|
-
type Column = Base & Primary & Types & Default;
|
|
219
|
-
type Table = {
|
|
220
|
-
schema: string;
|
|
221
|
-
title: string;
|
|
222
|
-
columns: {
|
|
223
|
-
[key: string]: Column;
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
type TableCheck = {
|
|
227
|
-
schema: string;
|
|
228
|
-
title: string;
|
|
229
|
-
columns: {
|
|
230
|
-
[key: string]: Base & Primary & Types & Default & ReferenceCheck<Table, keyof Table['columns']>;
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
export default Table;
|
|
234
|
-
export type { ReferenceActions, Column, TableCheck };
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import type { JSON } from './json';
|
|
3
|
+
import { PostgresType } from './postgres';
|
|
4
|
+
type ReferenceActions = 'no-action' | 'restrict' | 'set-null' | 'set-Default' | 'cascade';
|
|
5
|
+
type Base = {
|
|
6
|
+
type: PostgresType;
|
|
7
|
+
default: boolean | 'value' | 'auto-increment' | 'created-at' | 'updated-at';
|
|
8
|
+
nullable: boolean;
|
|
9
|
+
title?: string;
|
|
10
|
+
reference?: {
|
|
11
|
+
table: Table;
|
|
12
|
+
onUpdate?: ReferenceActions;
|
|
13
|
+
onDelete?: ReferenceActions;
|
|
14
|
+
column: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type Primary = {
|
|
18
|
+
primary?: true;
|
|
19
|
+
nullable: false;
|
|
20
|
+
} | {
|
|
21
|
+
nullable: true;
|
|
22
|
+
};
|
|
23
|
+
type Types = {
|
|
24
|
+
type: 'boolean' | 'text' | 'uuid' | 'date' | 'json' | 'jsonb';
|
|
25
|
+
} | {
|
|
26
|
+
type: 'smallint' | 'integer' | 'real' | 'double precision';
|
|
27
|
+
min?: number;
|
|
28
|
+
max?: number;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'bigint';
|
|
31
|
+
min?: bigint;
|
|
32
|
+
max?: bigint;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'numeric';
|
|
35
|
+
precision: number;
|
|
36
|
+
scale: number;
|
|
37
|
+
min?: Decimal;
|
|
38
|
+
max?: Decimal;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'character' | 'character varying';
|
|
41
|
+
minLength?: number;
|
|
42
|
+
maxLength?: number;
|
|
43
|
+
regex?: RegExp;
|
|
44
|
+
} | {
|
|
45
|
+
type: 'timestamp without time zone' | 'timestamp with time zone';
|
|
46
|
+
length?: number;
|
|
47
|
+
};
|
|
48
|
+
type ReferenceCheck<T extends Table, C extends keyof T['columns']> = {
|
|
49
|
+
type: 'boolean';
|
|
50
|
+
reference?: {
|
|
51
|
+
table: T;
|
|
52
|
+
onUpdate?: ReferenceActions;
|
|
53
|
+
onDelete?: ReferenceActions;
|
|
54
|
+
column: T['columns'][C]['type'] extends 'boolean' ? C : never;
|
|
55
|
+
};
|
|
56
|
+
} | {
|
|
57
|
+
type: 'smallint';
|
|
58
|
+
reference?: {
|
|
59
|
+
table: T;
|
|
60
|
+
onUpdate?: ReferenceActions;
|
|
61
|
+
onDelete?: ReferenceActions;
|
|
62
|
+
column: T['columns'][C]['type'] extends 'smallint' ? C : never;
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
type: 'integer';
|
|
66
|
+
reference?: {
|
|
67
|
+
table: T;
|
|
68
|
+
onUpdate?: ReferenceActions;
|
|
69
|
+
onDelete?: ReferenceActions;
|
|
70
|
+
column: T['columns'][C]['type'] extends 'smallint' | 'integer' ? C : never;
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
type: 'bigint';
|
|
74
|
+
reference?: {
|
|
75
|
+
table: T;
|
|
76
|
+
onUpdate?: ReferenceActions;
|
|
77
|
+
onDelete?: ReferenceActions;
|
|
78
|
+
column: T['columns'][C]['type'] extends 'smallint' | 'integer' | 'bigint' ? C : never;
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
type: 'real';
|
|
82
|
+
reference?: {
|
|
83
|
+
table: T;
|
|
84
|
+
onUpdate?: ReferenceActions;
|
|
85
|
+
onDelete?: ReferenceActions;
|
|
86
|
+
column: T['columns'][C]['type'] extends 'real' ? C : never;
|
|
87
|
+
};
|
|
88
|
+
} | {
|
|
89
|
+
type: 'double precision';
|
|
90
|
+
reference?: {
|
|
91
|
+
table: T;
|
|
92
|
+
onUpdate?: ReferenceActions;
|
|
93
|
+
onDelete?: ReferenceActions;
|
|
94
|
+
column: T['columns'][C]['type'] extends 'double precision' ? C : never;
|
|
95
|
+
};
|
|
96
|
+
} | {
|
|
97
|
+
type: 'text';
|
|
98
|
+
reference?: {
|
|
99
|
+
table: T;
|
|
100
|
+
onUpdate?: ReferenceActions;
|
|
101
|
+
onDelete?: ReferenceActions;
|
|
102
|
+
column: T['columns'][C]['type'] extends 'text' ? C : never;
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
type: 'uuid';
|
|
106
|
+
reference?: {
|
|
107
|
+
table: T;
|
|
108
|
+
onUpdate?: ReferenceActions;
|
|
109
|
+
onDelete?: ReferenceActions;
|
|
110
|
+
column: T['columns'][C]['type'] extends 'uuid' ? C : never;
|
|
111
|
+
};
|
|
112
|
+
} | {
|
|
113
|
+
type: 'date';
|
|
114
|
+
reference?: {
|
|
115
|
+
table: T;
|
|
116
|
+
onUpdate?: ReferenceActions;
|
|
117
|
+
onDelete?: ReferenceActions;
|
|
118
|
+
column: T['columns'][C]['type'] extends 'date' ? C : never;
|
|
119
|
+
};
|
|
120
|
+
} | {
|
|
121
|
+
type: 'json';
|
|
122
|
+
reference?: {
|
|
123
|
+
table: T;
|
|
124
|
+
onUpdate?: ReferenceActions;
|
|
125
|
+
onDelete?: ReferenceActions;
|
|
126
|
+
column: T['columns'][C]['type'] extends 'json' ? C : never;
|
|
127
|
+
};
|
|
128
|
+
} | {
|
|
129
|
+
type: 'jsonb';
|
|
130
|
+
reference?: {
|
|
131
|
+
table: T;
|
|
132
|
+
onUpdate?: ReferenceActions;
|
|
133
|
+
onDelete?: ReferenceActions;
|
|
134
|
+
column: T['columns'][C]['type'] extends 'jsonb' ? C : never;
|
|
135
|
+
};
|
|
136
|
+
} | {
|
|
137
|
+
type: 'numeric';
|
|
138
|
+
reference?: {
|
|
139
|
+
table: T;
|
|
140
|
+
onUpdate?: ReferenceActions;
|
|
141
|
+
onDelete?: ReferenceActions;
|
|
142
|
+
column: T['columns'][C]['type'] extends 'numeric' ? C : never;
|
|
143
|
+
};
|
|
144
|
+
} | {
|
|
145
|
+
type: 'character';
|
|
146
|
+
reference?: {
|
|
147
|
+
table: T;
|
|
148
|
+
onUpdate?: ReferenceActions;
|
|
149
|
+
onDelete?: ReferenceActions;
|
|
150
|
+
column: T['columns'][C]['type'] extends 'character' ? C : never;
|
|
151
|
+
};
|
|
152
|
+
} | {
|
|
153
|
+
type: 'character varying';
|
|
154
|
+
reference?: {
|
|
155
|
+
table: T;
|
|
156
|
+
onUpdate?: ReferenceActions;
|
|
157
|
+
onDelete?: ReferenceActions;
|
|
158
|
+
column: T['columns'][C]['type'] extends 'character varying' ? C : never;
|
|
159
|
+
};
|
|
160
|
+
} | {
|
|
161
|
+
type: 'timestamp without time zone';
|
|
162
|
+
reference?: {
|
|
163
|
+
table: T;
|
|
164
|
+
onUpdate?: ReferenceActions;
|
|
165
|
+
onDelete?: ReferenceActions;
|
|
166
|
+
column: T['columns'][C]['type'] extends 'timestamp without time zone' ? C : never;
|
|
167
|
+
};
|
|
168
|
+
} | {
|
|
169
|
+
type: 'timestamp with time zone';
|
|
170
|
+
reference?: {
|
|
171
|
+
table: T;
|
|
172
|
+
onUpdate?: ReferenceActions;
|
|
173
|
+
onDelete?: ReferenceActions;
|
|
174
|
+
column: T['columns'][C]['type'] extends 'timestamp with time zone' ? C : never;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
type Default = {
|
|
178
|
+
default: false;
|
|
179
|
+
} | {
|
|
180
|
+
default: true;
|
|
181
|
+
value: string;
|
|
182
|
+
} | {
|
|
183
|
+
default: 'auto-increment';
|
|
184
|
+
type: 'smallint' | 'integer' | 'bigint';
|
|
185
|
+
seqTitle?: string;
|
|
186
|
+
} | {
|
|
187
|
+
default: 'created-at' | 'updated-at';
|
|
188
|
+
type: 'timestamp without time zone' | 'timestamp with time zone';
|
|
189
|
+
} | ({
|
|
190
|
+
default: 'value';
|
|
191
|
+
type: 'boolean';
|
|
192
|
+
value: boolean;
|
|
193
|
+
} | {
|
|
194
|
+
default: 'value';
|
|
195
|
+
type: 'smallint' | 'integer' | 'real' | 'double precision';
|
|
196
|
+
value: number;
|
|
197
|
+
} | {
|
|
198
|
+
default: 'value';
|
|
199
|
+
type: 'bigint';
|
|
200
|
+
value: bigint;
|
|
201
|
+
} | {
|
|
202
|
+
default: 'value';
|
|
203
|
+
type: 'numeric';
|
|
204
|
+
value: Decimal;
|
|
205
|
+
} | {
|
|
206
|
+
default: 'value';
|
|
207
|
+
type: 'character' | 'character varying' | 'text' | 'uuid';
|
|
208
|
+
value: string;
|
|
209
|
+
} | {
|
|
210
|
+
default: 'value';
|
|
211
|
+
type: 'date' | 'timestamp without time zone' | 'timestamp with time zone';
|
|
212
|
+
value: Date;
|
|
213
|
+
} | {
|
|
214
|
+
default: 'value';
|
|
215
|
+
type: 'json' | 'jsonb';
|
|
216
|
+
value: JSON;
|
|
217
|
+
});
|
|
218
|
+
type Column = Base & Primary & Types & Default;
|
|
219
|
+
type Table = {
|
|
220
|
+
schema: string;
|
|
221
|
+
title: string;
|
|
222
|
+
columns: {
|
|
223
|
+
[key: string]: Column;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
type TableCheck = {
|
|
227
|
+
schema: string;
|
|
228
|
+
title: string;
|
|
229
|
+
columns: {
|
|
230
|
+
[key: string]: Base & Primary & Types & Default & ReferenceCheck<Table, keyof Table['columns']>;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
export default Table;
|
|
234
|
+
export type { ReferenceActions, Column, TableCheck };
|
|
235
235
|
//# sourceMappingURL=table.d.ts.map
|
package/dist/types/table.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=table.js.map
|
package/dist/types/testUtil.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import Table from './table';
|
|
2
|
-
import { PoolClient } from 'pg';
|
|
3
|
-
import { Result } from 'never-catch';
|
|
4
|
-
import { SimpleModel } from './model';
|
|
5
|
-
import { ColumnTypeByColumns } from './postgres';
|
|
6
|
-
import { NullableAndDefaultColumns } from './entity';
|
|
7
|
-
import { Pool, TransactionIsolationLevel } from './pool';
|
|
8
|
-
type TestTableData<T extends Table> = {
|
|
9
|
-
table: T;
|
|
10
|
-
startData: ({
|
|
11
|
-
[columnKey in Exclude<keyof T['columns'], keyof NullableAndDefaultColumns<T['columns']>>]: ColumnTypeByColumns<T['columns'], columnKey>;
|
|
12
|
-
} & {
|
|
13
|
-
[columnKey in keyof NullableAndDefaultColumns<T['columns']>]?: ColumnTypeByColumns<T['columns'], columnKey & string>;
|
|
14
|
-
})[];
|
|
15
|
-
finalData: ((rows: SimpleModel<T['columns']>[]) => Result<any, any> | Promise<Result<any, any>>) | {
|
|
16
|
-
row: {
|
|
17
|
-
[columnKey in keyof T['columns']]: ((cell: ColumnTypeByColumns<T['columns'], columnKey>, row: SimpleModel<T['columns']>, rows: SimpleModel<T['columns']>[]) => Result<any, any> | Promise<Result<any, any>>) | ColumnTypeByColumns<T['columns'], columnKey>;
|
|
18
|
-
};
|
|
19
|
-
useTime?: ['equal', number] | ['moreThanEqual', number] | ['lessThanEqual', number] | undefined;
|
|
20
|
-
}[];
|
|
21
|
-
skipIt?: ((row: SimpleModel<T['columns']>) => Result<any, any> | Promise<Result<any, any>>) | undefined;
|
|
22
|
-
lengthCheck?: ((rows: SimpleModel<T['columns']>[]) => Result<any, any> | Promise<Result<any, any>>) | number | undefined;
|
|
23
|
-
};
|
|
24
|
-
type TestTransaction = (data: TestTableData<any>[], callback: (client: PoolClient) => void, pool: Pool, isolationLevel?: TransactionIsolationLevel, rollback?: boolean) => Promise<undefined>;
|
|
25
|
-
type CreateTestTableData = <T extends Table>(table: T, startData: TestTableData<T>['startData'], finalData: TestTableData<T>['finalData'], skipIt?: TestTableData<T>['skipIt'], lengthCheck?: TestTableData<T>['lengthCheck']) => TestTableData<T>;
|
|
26
|
-
export type { TestTableData, TestTransaction, CreateTestTableData };
|
|
1
|
+
import Table from './table';
|
|
2
|
+
import { PoolClient } from 'pg';
|
|
3
|
+
import { Result } from 'never-catch';
|
|
4
|
+
import { SimpleModel } from './model';
|
|
5
|
+
import { ColumnTypeByColumns } from './postgres';
|
|
6
|
+
import { NullableAndDefaultColumns } from './entity';
|
|
7
|
+
import { Pool, TransactionIsolationLevel } from './pool';
|
|
8
|
+
type TestTableData<T extends Table> = {
|
|
9
|
+
table: T;
|
|
10
|
+
startData: ({
|
|
11
|
+
[columnKey in Exclude<keyof T['columns'], keyof NullableAndDefaultColumns<T['columns']>>]: ColumnTypeByColumns<T['columns'], columnKey>;
|
|
12
|
+
} & {
|
|
13
|
+
[columnKey in keyof NullableAndDefaultColumns<T['columns']>]?: ColumnTypeByColumns<T['columns'], columnKey & string>;
|
|
14
|
+
})[];
|
|
15
|
+
finalData: ((rows: SimpleModel<T['columns']>[]) => Result<any, any> | Promise<Result<any, any>>) | {
|
|
16
|
+
row: {
|
|
17
|
+
[columnKey in keyof T['columns']]: ((cell: ColumnTypeByColumns<T['columns'], columnKey>, row: SimpleModel<T['columns']>, rows: SimpleModel<T['columns']>[]) => Result<any, any> | Promise<Result<any, any>>) | ColumnTypeByColumns<T['columns'], columnKey>;
|
|
18
|
+
};
|
|
19
|
+
useTime?: ['equal', number] | ['moreThanEqual', number] | ['lessThanEqual', number] | undefined;
|
|
20
|
+
}[];
|
|
21
|
+
skipIt?: ((row: SimpleModel<T['columns']>) => Result<any, any> | Promise<Result<any, any>>) | undefined;
|
|
22
|
+
lengthCheck?: ((rows: SimpleModel<T['columns']>[]) => Result<any, any> | Promise<Result<any, any>>) | number | undefined;
|
|
23
|
+
};
|
|
24
|
+
type TestTransaction = (data: TestTableData<any>[], callback: (client: PoolClient) => void, pool: Pool, isolationLevel?: TransactionIsolationLevel, rollback?: boolean) => Promise<undefined>;
|
|
25
|
+
type CreateTestTableData = <T extends Table>(table: T, startData: TestTableData<T>['startData'], finalData: TestTableData<T>['finalData'], skipIt?: TestTableData<T>['skipIt'], lengthCheck?: TestTableData<T>['lengthCheck']) => TestTableData<T>;
|
|
26
|
+
export type { TestTableData, TestTransaction, CreateTestTableData };
|
|
27
27
|
//# sourceMappingURL=testUtil.d.ts.map
|
package/dist/types/testUtil.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=testUtil.js.map
|