sasat 0.21.21 → 0.22.1
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/dist/cli/index.cjs +604 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +604 -0
- package/dist/index.cjs +773 -943
- package/dist/index.d.cts +1047 -987
- package/dist/index.d.mts +1047 -987
- package/dist/index.mjs +765 -924
- package/dist/migrate-Cc47Mufl.cjs +4165 -0
- package/dist/migrate-DfAkhVPb.mjs +3947 -0
- package/package.json +24 -27
- package/dist/cli/cli.cjs +0 -5626
- package/dist/cli/cli.d.cts +0 -1
- package/dist/cli/cli.d.mts +0 -1
- package/dist/cli/cli.d.ts +0 -1
- package/dist/cli/cli.mjs +0 -5601
- package/dist/index.d.ts +0 -1167
- package/dist/shared/sasat.CFfsuShk.mjs +0 -398
- package/dist/shared/sasat.DHiyRw3a.cjs +0 -436
package/dist/index.d.mts
CHANGED
|
@@ -1,1146 +1,1071 @@
|
|
|
1
|
-
import pkg from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import pkg from "sqlstring";
|
|
2
|
+
import * as _$mysql2_promise0 from "mysql2/promise";
|
|
3
|
+
import { ConnectionOptions, PoolOptions } from "mysql2/promise";
|
|
4
|
+
import { GraphQLResolveInfo } from "graphql";
|
|
5
|
+
import Hashids from "hashids";
|
|
6
|
+
import { GraphQLResolveInfo as GraphQLResolveInfo$1 } from "graphql/type/index.js";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
//#region src/db/connectors/dbClient.d.ts
|
|
9
|
+
type QueryResponse = Array<{
|
|
10
|
+
[key: string]: SqlValueType;
|
|
11
|
+
}>;
|
|
12
|
+
interface CommandResponse {
|
|
13
|
+
insertId: number;
|
|
14
|
+
affectedRows: number;
|
|
15
|
+
changedRows: number;
|
|
16
|
+
}
|
|
17
|
+
type SqlValueType = string | number | boolean | null;
|
|
18
|
+
interface SQLExecutor {
|
|
19
|
+
rawQuery(sql: string): Promise<QueryResponse>;
|
|
20
|
+
rawCommand(sql: string): Promise<CommandResponse>;
|
|
21
|
+
}
|
|
22
|
+
declare abstract class SQLClient implements SQLExecutor {
|
|
23
|
+
protected logger: (query: string) => void;
|
|
24
|
+
rawQuery(sql: string): Promise<QueryResponse>;
|
|
25
|
+
rawCommand(sql: string): Promise<CommandResponse>;
|
|
26
|
+
query(templateString: TemplateStringsArray, ...params: any[]): Promise<QueryResponse>;
|
|
27
|
+
command(templateString: TemplateStringsArray, ...params: any[]): Promise<CommandResponse>;
|
|
28
|
+
protected abstract execSql(sql: string): Promise<QueryResponse | CommandResponse>;
|
|
29
|
+
}
|
|
30
|
+
declare abstract class SQLTransaction extends SQLClient {
|
|
31
|
+
abstract commit(): Promise<void>;
|
|
32
|
+
abstract rollback(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
declare abstract class DBClient extends SQLClient {
|
|
35
|
+
protected _released: boolean;
|
|
36
|
+
protected constructor(logger?: (query: string) => void);
|
|
37
|
+
isReleased(): boolean;
|
|
38
|
+
abstract transaction(): Promise<SQLTransaction>;
|
|
39
|
+
abstract release(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/cli/commands/migrate.d.ts
|
|
43
|
+
type MigrateCommandOption = {
|
|
44
|
+
generateFiles: boolean;
|
|
45
|
+
silent: boolean;
|
|
46
|
+
dry: boolean;
|
|
47
|
+
skipBuild: boolean;
|
|
14
48
|
};
|
|
15
|
-
|
|
49
|
+
declare const migrate: (client: DBClient, options: MigrateCommandOption) => Promise<void>;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/util/type.d.ts
|
|
52
|
+
type NestedPartial<T> = { [K in keyof T]?: T[K] extends Array<infer R> ? Array<NestedPartial<R>> : NestedPartial<T[K]> };
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/config/config.d.ts
|
|
55
|
+
interface SasatConfigDb {
|
|
56
|
+
host: string;
|
|
57
|
+
port: number;
|
|
58
|
+
user: string;
|
|
59
|
+
password?: string;
|
|
60
|
+
database: string;
|
|
61
|
+
ssl?: {
|
|
62
|
+
ca?: string[];
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
interface SasatConfigMigration {
|
|
66
|
+
table: string;
|
|
67
|
+
dir: string;
|
|
68
|
+
out: string;
|
|
69
|
+
target?: string;
|
|
70
|
+
db?: SasatConfigDb;
|
|
71
|
+
}
|
|
72
|
+
interface SasatConfigGenerator {
|
|
73
|
+
addJsExtToImportStatement: boolean;
|
|
74
|
+
gql: {
|
|
75
|
+
subscription: boolean;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
interface SasatConfig {
|
|
79
|
+
db: SasatConfigDb;
|
|
80
|
+
migration: SasatConfigMigration;
|
|
81
|
+
generator: SasatConfigGenerator;
|
|
82
|
+
}
|
|
83
|
+
declare function setConfig(update: NestedPartial<SasatConfig>): SasatConfig;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/db/connectors/mysql/client.d.ts
|
|
86
|
+
declare class MysqlClient extends DBClient {
|
|
87
|
+
readonly connectionOption: ConnectionOptions;
|
|
88
|
+
release(): Promise<void>;
|
|
89
|
+
constructor(connectionOption: ConnectionOptions, logger?: (query: string) => void);
|
|
90
|
+
protected getConnection(): Promise<_$mysql2_promise0.Connection>;
|
|
91
|
+
transaction(): Promise<SQLTransaction>;
|
|
92
|
+
protected execSql(sql: string): Promise<QueryResponse | CommandResponse>;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/db/formatQuery.d.ts
|
|
96
|
+
declare const formatQuery: (str: TemplateStringsArray, ...params: any[]) => string;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/db/sql/expression/comparison.d.ts
|
|
99
|
+
type ComparisonOperators = "=" | ">" | "<" | ">=" | "<=" | "<>";
|
|
100
|
+
type AndOr = "AND" | "OR";
|
|
101
|
+
type ComparisonExpression$1<T> = Partial<{ [P in keyof T]: T[P] | [ComparisonOperators | "LIKE" | "NOT LIKE", T[P]] | ["BETWEEN", T[P], T[P]] | ["IN", ...T[P][]] | ["IS NULL"] | ["IS NOT NULL"] }> & {
|
|
102
|
+
__type?: AndOr;
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/runtime/dsl/query/query.d.ts
|
|
16
106
|
declare enum QueryNodeKind {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
107
|
+
Field = 0,
|
|
108
|
+
Function = 1,
|
|
109
|
+
Table = 2,
|
|
110
|
+
Join = 3,
|
|
111
|
+
CompoundExpr = 4,
|
|
112
|
+
ComparisonExpr = 5,
|
|
113
|
+
IsNullExpr = 6,
|
|
114
|
+
Parenthesis = 7,
|
|
115
|
+
InExpr = 8,
|
|
116
|
+
BetweenExpr = 9,
|
|
117
|
+
ContainsExpr = 10,
|
|
118
|
+
Literal = 11,
|
|
119
|
+
Sort = 12,
|
|
120
|
+
Identifier = 13,
|
|
121
|
+
Exists = 14,
|
|
122
|
+
Raw = 15,
|
|
123
|
+
GroupBy = 16,
|
|
124
|
+
Over = 17,
|
|
125
|
+
Window = 18
|
|
36
126
|
}
|
|
37
|
-
type LockMode =
|
|
127
|
+
type LockMode = "FOR UPDATE" | "FOR SHARE";
|
|
38
128
|
type Query = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
129
|
+
select: SelectExpr[];
|
|
130
|
+
from: QueryTable;
|
|
131
|
+
where?: BooleanValueExpression;
|
|
132
|
+
groupBy?: GroupByExpr;
|
|
133
|
+
having?: BooleanValueExpression;
|
|
134
|
+
sort?: Sort[];
|
|
135
|
+
limit?: number;
|
|
136
|
+
offset?: number;
|
|
137
|
+
lock?: LockMode;
|
|
48
138
|
};
|
|
49
139
|
type GroupByExpr = {
|
|
50
|
-
|
|
51
|
-
|
|
140
|
+
kind: QueryNodeKind.GroupBy;
|
|
141
|
+
cols: (Field | Identifier)[];
|
|
52
142
|
};
|
|
53
143
|
type Field = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
144
|
+
kind: QueryNodeKind.Field;
|
|
145
|
+
table: string;
|
|
146
|
+
name: string;
|
|
147
|
+
alias?: string;
|
|
58
148
|
};
|
|
59
149
|
type Fn = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
150
|
+
kind: QueryNodeKind.Function;
|
|
151
|
+
fnName: string;
|
|
152
|
+
args: Value[];
|
|
153
|
+
over?: Over;
|
|
154
|
+
alias?: string;
|
|
65
155
|
};
|
|
66
156
|
type Over = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
157
|
+
kind: QueryNodeKind.Over;
|
|
158
|
+
orderBy?: Sort[];
|
|
159
|
+
partitionBy?: Identifier[];
|
|
160
|
+
window?: Window;
|
|
71
161
|
};
|
|
72
162
|
type Window = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
163
|
+
kind: QueryNodeKind.Window;
|
|
164
|
+
type: "ROWS" | "RANGE";
|
|
165
|
+
between: true;
|
|
166
|
+
start: WindowContent;
|
|
167
|
+
end: WindowContent;
|
|
78
168
|
} | {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
169
|
+
kind: QueryNodeKind.Window;
|
|
170
|
+
type: "ROWS" | "RANGE";
|
|
171
|
+
between: false;
|
|
172
|
+
value: WindowContent;
|
|
83
173
|
};
|
|
84
|
-
type WINDOW_TYPES_NO_ARG =
|
|
85
|
-
type WINDOW_TYPES_ARG =
|
|
174
|
+
type WINDOW_TYPES_NO_ARG = "UNBOUNDED PRECEDING" | "UNBOUNDED FOLLOWING" | "CURRENT ROW";
|
|
175
|
+
type WINDOW_TYPES_ARG = "PRECEDING" | "FOLLOWING";
|
|
86
176
|
type WindowContent = {
|
|
87
|
-
|
|
177
|
+
type: WINDOW_TYPES_NO_ARG;
|
|
88
178
|
} | {
|
|
89
|
-
|
|
90
|
-
|
|
179
|
+
type: WINDOW_TYPES_ARG;
|
|
180
|
+
value: number;
|
|
91
181
|
};
|
|
92
182
|
type SelectExpr = Field | Fn | Identifier | RawExpression;
|
|
93
183
|
type QueryTable = {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
184
|
+
kind: QueryNodeKind.Table;
|
|
185
|
+
alias: string;
|
|
186
|
+
joins: Join[];
|
|
97
187
|
} & ({
|
|
98
|
-
|
|
99
|
-
|
|
188
|
+
subquery?: false;
|
|
189
|
+
name: string;
|
|
100
190
|
} | {
|
|
101
|
-
|
|
102
|
-
|
|
191
|
+
subquery: true;
|
|
192
|
+
query: Query;
|
|
103
193
|
});
|
|
104
|
-
type JoinType =
|
|
194
|
+
type JoinType = "INNER" | "LEFT" | "RIGHT" | "OUTER";
|
|
105
195
|
type Join = {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
196
|
+
kind: QueryNodeKind.Join;
|
|
197
|
+
type?: JoinType;
|
|
198
|
+
table: QueryTable;
|
|
199
|
+
conditions: BooleanValueExpression;
|
|
110
200
|
};
|
|
111
201
|
type ParenthesisExpression = {
|
|
112
|
-
|
|
113
|
-
|
|
202
|
+
kind: QueryNodeKind.Parenthesis;
|
|
203
|
+
expression: BooleanValueExpression;
|
|
114
204
|
};
|
|
115
205
|
type RawExpression = {
|
|
116
|
-
|
|
117
|
-
|
|
206
|
+
kind: QueryNodeKind.Raw;
|
|
207
|
+
expr: string;
|
|
118
208
|
};
|
|
119
209
|
type ExistsExpression = {
|
|
120
|
-
|
|
121
|
-
|
|
210
|
+
kind: QueryNodeKind.Exists;
|
|
211
|
+
query: Query | RawExpression;
|
|
122
212
|
};
|
|
123
213
|
type BooleanValueExpression = CompoundExpression | ComparisonExpression | IsNullExpression | ParenthesisExpression | InExpression | BetweenExpression | ContainsExpression | ExistsExpression;
|
|
124
214
|
type IsNullExpression = {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
215
|
+
kind: QueryNodeKind.IsNullExpr;
|
|
216
|
+
expr: Value;
|
|
217
|
+
isNot: boolean;
|
|
128
218
|
};
|
|
129
|
-
type CompoundOperator =
|
|
219
|
+
type CompoundOperator = "AND" | "OR";
|
|
130
220
|
type CompoundExpression = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
221
|
+
kind: QueryNodeKind.CompoundExpr;
|
|
222
|
+
left: BooleanValueExpression;
|
|
223
|
+
operator: CompoundOperator;
|
|
224
|
+
right: BooleanValueExpression;
|
|
135
225
|
};
|
|
136
226
|
type ComparisonExpression = {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
227
|
+
kind: QueryNodeKind.ComparisonExpr;
|
|
228
|
+
left: Value;
|
|
229
|
+
operator: ComparisonOperators;
|
|
230
|
+
right: Value;
|
|
141
231
|
};
|
|
142
|
-
type ContainType =
|
|
232
|
+
type ContainType = "start" | "end" | "contains";
|
|
143
233
|
type ContainsExpression = {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
234
|
+
kind: QueryNodeKind.ContainsExpr;
|
|
235
|
+
type: ContainType;
|
|
236
|
+
left: Value;
|
|
237
|
+
isNot: boolean;
|
|
238
|
+
right: string;
|
|
149
239
|
};
|
|
150
240
|
type InExpression = {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
241
|
+
kind: QueryNodeKind.InExpr;
|
|
242
|
+
left: Value;
|
|
243
|
+
operator: "IN" | "NOT IN";
|
|
154
244
|
} & ({
|
|
155
|
-
|
|
245
|
+
query: Query | RawExpression;
|
|
156
246
|
} | {
|
|
157
|
-
|
|
247
|
+
right: Value[];
|
|
158
248
|
});
|
|
159
249
|
type BetweenExpression = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
250
|
+
kind: QueryNodeKind.BetweenExpr;
|
|
251
|
+
left: Value;
|
|
252
|
+
begin: Value;
|
|
253
|
+
end: Value;
|
|
164
254
|
};
|
|
165
255
|
type Value = Literal | Field | Fn | Identifier;
|
|
166
256
|
type Identifier = {
|
|
167
|
-
|
|
168
|
-
|
|
257
|
+
kind: QueryNodeKind.Identifier;
|
|
258
|
+
identifier: string;
|
|
169
259
|
};
|
|
170
260
|
type Literal = {
|
|
171
|
-
|
|
172
|
-
|
|
261
|
+
kind: QueryNodeKind.Literal;
|
|
262
|
+
value: string | boolean | number | null;
|
|
173
263
|
};
|
|
174
|
-
type SortDirection =
|
|
264
|
+
type SortDirection = "ASC" | "DESC";
|
|
175
265
|
type Sort = {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
266
|
+
kind: QueryNodeKind.Sort;
|
|
267
|
+
field: Field | Fn | Identifier;
|
|
268
|
+
direction?: SortDirection;
|
|
179
269
|
};
|
|
180
|
-
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/runtime/dsl/query/sql/queryToSql.d.ts
|
|
181
272
|
declare const queryToSql: (query: Query) => string;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
[K in keyof T]?: T[K] extends Array<infer R> ? Array<NestedPartial<R>> : NestedPartial<T[K]>;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
interface SasatConfigDb {
|
|
188
|
-
host: string;
|
|
189
|
-
port: number;
|
|
190
|
-
user: string;
|
|
191
|
-
password?: string;
|
|
192
|
-
database: string;
|
|
193
|
-
ssl?: {
|
|
194
|
-
ca?: string[];
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
interface SasatConfigMigration {
|
|
198
|
-
table: string;
|
|
199
|
-
dir: string;
|
|
200
|
-
out: string;
|
|
201
|
-
target?: string;
|
|
202
|
-
db?: SasatConfigDb;
|
|
203
|
-
}
|
|
204
|
-
interface SasatConfigGenerator {
|
|
205
|
-
addJsExtToImportStatement: boolean;
|
|
206
|
-
gql: {
|
|
207
|
-
subscription: boolean;
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
interface SasatConfig {
|
|
211
|
-
db: SasatConfigDb;
|
|
212
|
-
migration: SasatConfigMigration;
|
|
213
|
-
generator: SasatConfigGenerator;
|
|
214
|
-
}
|
|
215
|
-
declare function setConfig(update: NestedPartial<SasatConfig>): SasatConfig;
|
|
216
|
-
|
|
217
|
-
declare const formatQuery: (str: TemplateStringsArray, ...params: any[]) => string;
|
|
218
|
-
|
|
219
|
-
type QueryResponse = Array<{
|
|
220
|
-
[key: string]: SqlValueType;
|
|
221
|
-
}>;
|
|
222
|
-
interface CommandResponse {
|
|
223
|
-
insertId: number;
|
|
224
|
-
affectedRows: number;
|
|
225
|
-
changedRows: number;
|
|
226
|
-
}
|
|
227
|
-
type SqlValueType = string | number | boolean | null;
|
|
228
|
-
interface SQLExecutor {
|
|
229
|
-
rawQuery(sql: string): Promise<QueryResponse>;
|
|
230
|
-
rawCommand(sql: string): Promise<CommandResponse>;
|
|
231
|
-
}
|
|
232
|
-
declare abstract class SQLClient implements SQLExecutor {
|
|
233
|
-
protected logger: (query: string) => void;
|
|
234
|
-
rawQuery(sql: string): Promise<QueryResponse>;
|
|
235
|
-
rawCommand(sql: string): Promise<CommandResponse>;
|
|
236
|
-
query(templateString: TemplateStringsArray, ...params: any[]): Promise<QueryResponse>;
|
|
237
|
-
command(templateString: TemplateStringsArray, ...params: any[]): Promise<CommandResponse>;
|
|
238
|
-
protected abstract execSql(sql: string): Promise<QueryResponse | CommandResponse>;
|
|
239
|
-
}
|
|
240
|
-
declare abstract class SQLTransaction extends SQLClient {
|
|
241
|
-
abstract commit(): Promise<void>;
|
|
242
|
-
abstract rollback(): Promise<void>;
|
|
243
|
-
}
|
|
244
|
-
declare abstract class DBClient extends SQLClient {
|
|
245
|
-
protected _released: boolean;
|
|
246
|
-
protected constructor(logger?: (query: string) => void);
|
|
247
|
-
isReleased(): boolean;
|
|
248
|
-
abstract transaction(): Promise<SQLTransaction>;
|
|
249
|
-
abstract release(): Promise<void>;
|
|
250
|
-
}
|
|
251
|
-
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region src/runtime/field.d.ts
|
|
252
275
|
type Fields<Entity, Relation = Record<string, unknown>> = {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
276
|
+
fields: Array<keyof Entity & string>;
|
|
277
|
+
relations?: Relation;
|
|
278
|
+
tableAlias?: string;
|
|
279
|
+
joinOn?: BooleanValueExpression;
|
|
257
280
|
};
|
|
258
|
-
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/runtime/dsl/query/createQueryResolveInfo.d.ts
|
|
259
283
|
type MakeConditionArg<Context = unknown, Entity = unknown> = {
|
|
260
|
-
|
|
261
|
-
|
|
284
|
+
childTableAlias: string;
|
|
285
|
+
context?: Context;
|
|
262
286
|
} & ({
|
|
263
|
-
|
|
264
|
-
|
|
287
|
+
parentTableAlias: string;
|
|
288
|
+
parent?: undefined;
|
|
265
289
|
} | {
|
|
266
|
-
|
|
267
|
-
|
|
290
|
+
parent: Partial<Entity>;
|
|
291
|
+
parentTableAlias?: undefined;
|
|
268
292
|
});
|
|
269
|
-
type MakeCondition<Context, Entity =
|
|
293
|
+
type MakeCondition<Context, Entity = unknown> = (arg: MakeConditionArg<Context, Entity>) => BooleanValueExpression;
|
|
270
294
|
type RelationInfo<Context = unknown> = {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
295
|
+
table: string;
|
|
296
|
+
condition: MakeCondition<Context>;
|
|
297
|
+
array: boolean;
|
|
298
|
+
nullable: boolean;
|
|
299
|
+
requiredColumns: string[];
|
|
276
300
|
};
|
|
277
301
|
type RelationMap<Context = unknown> = {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
302
|
+
[from: string]: {
|
|
303
|
+
[to: string]: RelationInfo<Context>;
|
|
304
|
+
};
|
|
281
305
|
};
|
|
282
306
|
type TableInfo = {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
};
|
|
307
|
+
[tableName: string]: {
|
|
308
|
+
identifiableKeys: string[];
|
|
309
|
+
identifiableFields: string[];
|
|
310
|
+
columnMap: {
|
|
311
|
+
[fieldName: string]: string;
|
|
289
312
|
};
|
|
313
|
+
};
|
|
290
314
|
};
|
|
291
|
-
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/runtime/sql/runQuery.d.ts
|
|
292
317
|
type PagingOption$1 = {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
318
|
+
numberOfItem: number;
|
|
319
|
+
where?: BooleanValueExpression;
|
|
320
|
+
offset?: number;
|
|
321
|
+
sort?: Sort[];
|
|
322
|
+
join?: Join[];
|
|
298
323
|
};
|
|
299
|
-
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/runtime/sasatDBDatasource.d.ts
|
|
300
326
|
type EntityType = Record<string, SqlValueType>;
|
|
301
327
|
type EntityResult<Entity, Identifiable> = Identifiable & Partial<Entity>;
|
|
302
328
|
interface Repository<Entity, Identifiable, Creatable, Updatable> {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
329
|
+
create(entity: Creatable): Promise<Entity>;
|
|
330
|
+
update(entity: Updatable): Promise<CommandResponse>;
|
|
331
|
+
delete(entity: Identifiable): Promise<CommandResponse>;
|
|
306
332
|
}
|
|
307
333
|
type ListQueryOption = {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
334
|
+
numberOfItem: number;
|
|
335
|
+
offset?: number;
|
|
336
|
+
order?: string;
|
|
337
|
+
asc?: boolean;
|
|
338
|
+
join?: Join[];
|
|
313
339
|
};
|
|
314
340
|
type QueryOptions = {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
341
|
+
where?: BooleanValueExpression;
|
|
342
|
+
sort?: Sort[];
|
|
343
|
+
limit?: number;
|
|
344
|
+
offset?: number;
|
|
345
|
+
lock?: LockMode;
|
|
320
346
|
};
|
|
321
347
|
declare abstract class SasatDBDatasource<Entity extends EntityType, Identifiable extends object, Creatable extends EntityType, Updatable extends Identifiable, EntityFields extends Fields<Entity>, QueryResult extends Partial<Entity> & Identifiable> implements Repository<Entity, Identifiable, Creatable, Updatable> {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
createBulk(entities: Creatable[], option?: {
|
|
343
|
-
ignore?: boolean;
|
|
344
|
-
upsert?: {
|
|
345
|
-
updateColumns: string[];
|
|
346
|
-
};
|
|
347
|
-
}): Promise<CommandResponse>;
|
|
348
|
-
upsert<T extends Creatable & Partial<Entity>>(entity: T, updateFields?: (keyof T)[]): Promise<Entity>;
|
|
349
|
-
update(entity: Updatable): Promise<CommandResponse>;
|
|
350
|
-
updateWhere(update: Omit<Updatable, keyof Identifiable>, condition: BooleanValueExpression): Promise<CommandResponse>;
|
|
351
|
-
delete(entity: Identifiable): Promise<CommandResponse>;
|
|
352
|
-
deleteWhere(condition: BooleanValueExpression): Promise<CommandResponse>;
|
|
353
|
-
first(fields?: EntityFields, option?: QueryOptions, context?: unknown): Promise<QueryResult | null>;
|
|
354
|
-
find(fields?: EntityFields, options?: QueryOptions, context?: unknown): Promise<QueryResult[]>;
|
|
355
|
-
findPageable(paging: PagingOption$1, fields?: EntityFields, options?: QueryOptions, context?: unknown): Promise<QueryResult[]>;
|
|
356
|
-
private executeQuery;
|
|
357
|
-
private createIdentifiableExpression;
|
|
358
|
-
getRelationMap(): {
|
|
359
|
-
[to: string]: RelationInfo<any>;
|
|
348
|
+
protected client: SQLExecutor;
|
|
349
|
+
protected abstract relationMap: RelationMap<unknown>;
|
|
350
|
+
protected abstract tableInfo: TableInfo;
|
|
351
|
+
abstract readonly tableName: string;
|
|
352
|
+
abstract readonly fields: string[];
|
|
353
|
+
protected abstract readonly primaryKeys: string[];
|
|
354
|
+
protected abstract readonly identifyFields: string[];
|
|
355
|
+
protected abstract readonly autoIncrementColumn?: string | undefined;
|
|
356
|
+
constructor(client?: SQLExecutor);
|
|
357
|
+
protected abstract getDefaultValueString(): Partial<{ [P in keyof Entity]: Entity[P] | string | null | never }> | never;
|
|
358
|
+
create(entity: Creatable, option?: {
|
|
359
|
+
ignore?: boolean;
|
|
360
|
+
upsert?: {
|
|
361
|
+
updateColumns: string[];
|
|
362
|
+
};
|
|
363
|
+
}): Promise<Entity>;
|
|
364
|
+
createBulk(entities: Creatable[], option?: {
|
|
365
|
+
ignore?: boolean;
|
|
366
|
+
upsert?: {
|
|
367
|
+
updateColumns: string[];
|
|
360
368
|
};
|
|
361
|
-
|
|
369
|
+
}): Promise<CommandResponse>;
|
|
370
|
+
upsert<T extends Creatable & Partial<Entity>>(entity: T, updateFields?: (keyof T)[]): Promise<Entity>;
|
|
371
|
+
update(entity: Updatable): Promise<CommandResponse>;
|
|
372
|
+
updateWhere(update: Omit<Updatable, keyof Identifiable>, condition: BooleanValueExpression): Promise<CommandResponse>;
|
|
373
|
+
delete(entity: Identifiable): Promise<CommandResponse>;
|
|
374
|
+
deleteWhere(condition: BooleanValueExpression): Promise<CommandResponse>;
|
|
375
|
+
first(fields?: EntityFields, option?: QueryOptions, context?: unknown): Promise<QueryResult | null>;
|
|
376
|
+
find(fields?: EntityFields, options?: QueryOptions, context?: unknown): Promise<QueryResult[]>;
|
|
377
|
+
findPageable(paging: PagingOption$1, fields?: EntityFields, options?: QueryOptions, context?: unknown): Promise<QueryResult[]>;
|
|
378
|
+
private executeQuery;
|
|
379
|
+
private createIdentifiableExpression;
|
|
380
|
+
getRelationMap(): {
|
|
381
|
+
[to: string]: RelationInfo<unknown>;
|
|
382
|
+
};
|
|
383
|
+
protected fieldToColumn(fields: string[]): string[];
|
|
362
384
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
declare const escape: typeof pkg.escape;
|
|
389
|
-
declare const SqlString: {
|
|
390
|
-
escape: (value: Parameters<typeof escape>[0]) => string;
|
|
391
|
-
escapeId: (name: string) => string;
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
type ResolverArgs<Context, Params = unknown> = [
|
|
395
|
-
_: unknown,
|
|
396
|
-
params: Params,
|
|
397
|
-
context: Context,
|
|
398
|
-
info: GraphQLResolveInfo
|
|
399
|
-
];
|
|
400
|
-
type Resolver<Context, Params> = (_: unknown, params: Params, context: Context, info: GraphQLResolveInfo) => unknown;
|
|
401
|
-
declare const makeResolver: <Context, RequiredParams, IncomingParams = RequiredParams>(resolver: Resolver<Context, RequiredParams>, middlewares?: ResolverMiddleware<Context, RequiredParams, IncomingParams>[]) => Resolver<Context, RequiredParams>;
|
|
402
|
-
|
|
403
|
-
type ResolverMiddleware<Context, RequiredParams = any, IncomingParams = RequiredParams> = (args: ResolverArgs<Context, IncomingParams | RequiredParams>) => ResolverArgs<Context, RequiredParams | IncomingParams>;
|
|
404
|
-
declare const makeParamsMiddleware: <RequiredParams, IncomingParams = RequiredParams>(update: (params: RequiredParams) => IncomingParams) => ResolverMiddleware<never, RequiredParams, IncomingParams>;
|
|
405
|
-
|
|
406
|
-
type NumberIdEncoder = {
|
|
407
|
-
encode: (id: number) => string;
|
|
408
|
-
decode: (id: string) => number;
|
|
385
|
+
//#endregion
|
|
386
|
+
//#region src/db/getDbClient.d.ts
|
|
387
|
+
declare const getDbClient: (option?: Partial<PoolOptions>, logger?: (query: string) => void) => DBClient;
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/db/sql/expression/conditionExpression.d.ts
|
|
390
|
+
type ConditionExpression<T> = ComparisonExpression$1<T> | CompositeCondition<T>;
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/db/sql/expression/compositeCondition.d.ts
|
|
393
|
+
declare class CompositeCondition<T> {
|
|
394
|
+
private type;
|
|
395
|
+
private conditions;
|
|
396
|
+
private constructor();
|
|
397
|
+
static or<T>(conditions: ConditionExpression<T>[]): CompositeCondition<T>;
|
|
398
|
+
static and<T>(conditions: ConditionExpression<T>[]): CompositeCondition<T>;
|
|
399
|
+
toSQL(): string;
|
|
400
|
+
}
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/generatorv2/codegen/ts/scripts/typeDefinition.d.ts
|
|
403
|
+
type TypeFieldDefinition = {
|
|
404
|
+
return: string;
|
|
405
|
+
args?: {
|
|
406
|
+
name: string;
|
|
407
|
+
type: string;
|
|
408
|
+
}[];
|
|
409
409
|
};
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
type
|
|
413
|
-
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/migration/data/relation.d.ts
|
|
412
|
+
type Relation = "One" | "OneOrZero" | "Many";
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/migration/column/columnTypes.d.ts
|
|
415
|
+
declare enum DBColumnTypes {
|
|
416
|
+
char = "char",
|
|
417
|
+
varchar = "varchar",
|
|
418
|
+
text = "text",
|
|
419
|
+
tinyInt = "tinyint",
|
|
420
|
+
smallInt = "smallint",
|
|
421
|
+
mediumInt = "mediumint",
|
|
422
|
+
int = "int",
|
|
423
|
+
bigInt = "bigint",
|
|
424
|
+
float = "float",
|
|
425
|
+
double = "double",
|
|
426
|
+
decimal = "decimal",
|
|
427
|
+
year = "year",
|
|
428
|
+
date = "date",
|
|
429
|
+
time = "time",
|
|
430
|
+
dateTime = "datetime",
|
|
431
|
+
timestamp = "timestamp",
|
|
432
|
+
boolean = "boolean"
|
|
433
|
+
}
|
|
434
|
+
type DBType = "char" | "varchar" | "text" | "tinyint" | "smallint" | "mediumint" | "int" | "bigint" | "float" | "double" | "decimal" | "year" | "date" | "time" | "datetime" | "timestamp" | "boolean";
|
|
435
|
+
type DBStringTypes = DBColumnTypes.char | DBColumnTypes.varchar;
|
|
436
|
+
type DBTextTypes = DBColumnTypes.text;
|
|
437
|
+
type DBIntegerTypes = DBColumnTypes.tinyInt | DBColumnTypes.smallInt | DBColumnTypes.mediumInt | DBColumnTypes.int | DBColumnTypes.bigInt;
|
|
438
|
+
type DBFloatingTypes = DBColumnTypes.float | DBColumnTypes.double;
|
|
439
|
+
type DBDateTypes = DBColumnTypes.time | DBColumnTypes.date | DBColumnTypes.year;
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/generatorv2/nodes/ConditionValues.d.ts
|
|
414
442
|
type ContextConditionValue = {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
443
|
+
kind: "context";
|
|
444
|
+
field: string;
|
|
445
|
+
onNotDefined: OnNotDefinedAction;
|
|
418
446
|
};
|
|
419
447
|
type FixedConditionValue = {
|
|
420
|
-
|
|
421
|
-
|
|
448
|
+
kind: "fixed";
|
|
449
|
+
value: string | number;
|
|
422
450
|
};
|
|
423
451
|
type TodayStartConditionValue = {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
452
|
+
kind: "today";
|
|
453
|
+
type: "date" | "datetime";
|
|
454
|
+
thresholdHour?: number;
|
|
427
455
|
};
|
|
428
456
|
type NowConditionValue = {
|
|
429
|
-
|
|
457
|
+
kind: "now";
|
|
430
458
|
};
|
|
431
459
|
type OnNotDefinedAction = {
|
|
432
|
-
|
|
433
|
-
|
|
460
|
+
action: "error";
|
|
461
|
+
message: string;
|
|
434
462
|
} | {
|
|
435
|
-
|
|
436
|
-
|
|
463
|
+
action: "defaultValue";
|
|
464
|
+
value: string | number;
|
|
437
465
|
};
|
|
438
466
|
type ConditionValue = ContextConditionValue | FixedConditionValue | TodayStartConditionValue | NowConditionValue;
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
type
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
};
|
|
445
|
-
type
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/generatorv2/nodes/JoinConditionNode.d.ts
|
|
469
|
+
type JoinConditionValue = {
|
|
470
|
+
kind: "parent" | "child";
|
|
471
|
+
field: string;
|
|
472
|
+
} | ConditionValue;
|
|
473
|
+
type JoinConditionRangeValue = {
|
|
474
|
+
kind: "range";
|
|
475
|
+
begin: JoinConditionValue;
|
|
476
|
+
end: JoinConditionValue;
|
|
477
|
+
} | DateRangeConditionValue;
|
|
478
|
+
type DateRangeConditionValue = {
|
|
479
|
+
kind: "date-range";
|
|
480
|
+
range: "today";
|
|
481
|
+
thresholdHour?: number;
|
|
449
482
|
};
|
|
450
|
-
type
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
483
|
+
type JoinConditionNode = {
|
|
484
|
+
kind: "comparison";
|
|
485
|
+
left: JoinConditionValue;
|
|
486
|
+
operator: ComparisonOperators;
|
|
487
|
+
right: JoinConditionValue;
|
|
488
|
+
} | {
|
|
489
|
+
kind: "comparison";
|
|
490
|
+
left: JoinConditionValue;
|
|
491
|
+
operator: "BETWEEN";
|
|
492
|
+
right: JoinConditionRangeValue;
|
|
455
493
|
} | {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
494
|
+
kind: "comparison";
|
|
495
|
+
left: JoinConditionValue;
|
|
496
|
+
operator: "IN";
|
|
497
|
+
right: JoinConditionValue[];
|
|
498
|
+
} | {
|
|
499
|
+
kind: "isNull";
|
|
500
|
+
value: JoinConditionValue;
|
|
501
|
+
not: boolean;
|
|
502
|
+
} | JoinCustomConditionNode;
|
|
503
|
+
type JoinCustomConditionNode = {
|
|
504
|
+
kind: "custom";
|
|
505
|
+
conditionName: string;
|
|
506
|
+
parentRequiredFields?: string[];
|
|
507
|
+
childRequiredFields?: string[];
|
|
461
508
|
};
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
type DBType = 'char' | 'varchar' | 'text' | 'tinyint' | 'smallint' | 'mediumint' | 'int' | 'bigint' | 'float' | 'double' | 'decimal' | 'year' | 'date' | 'time' | 'datetime' | 'timestamp' | 'boolean';
|
|
483
|
-
type DBStringTypes = DBColumnTypes.char | DBColumnTypes.varchar;
|
|
484
|
-
type DBTextTypes = DBColumnTypes.text;
|
|
485
|
-
type DBIntegerTypes = DBColumnTypes.tinyInt | DBColumnTypes.smallInt | DBColumnTypes.mediumInt | DBColumnTypes.int | DBColumnTypes.bigInt;
|
|
486
|
-
type DBFloatingTypes = DBColumnTypes.float | DBColumnTypes.double;
|
|
487
|
-
type DBNumberTypes = DBIntegerTypes | DBFloatingTypes | DBColumnTypes.decimal;
|
|
488
|
-
type DBDateTypes = DBColumnTypes.time | DBColumnTypes.date | DBColumnTypes.year;
|
|
489
|
-
|
|
490
|
-
interface Serializable<T> {
|
|
491
|
-
serialize(): T;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
type ForeignKeyReferentialAction = 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'NO ACTION';
|
|
495
|
-
|
|
496
|
-
type Relation = 'One' | 'OneOrZero' | 'Many';
|
|
497
|
-
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/migration/data/virtualRelation.d.ts
|
|
511
|
+
type VirtualRelation = {
|
|
512
|
+
parentTable: string;
|
|
513
|
+
childTable: string;
|
|
514
|
+
parentFieldName?: string;
|
|
515
|
+
childFieldName?: string;
|
|
516
|
+
conditions: JoinConditionNode[];
|
|
517
|
+
parentType?: "array" | "nullable" | "notnull";
|
|
518
|
+
childType?: "array" | "nullable" | "notnull";
|
|
519
|
+
};
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/generatorv2/scripts/gqlTypes.d.ts
|
|
522
|
+
type GQLPrimitive = "Int" | "Float" | "String" | "Boolean" | "ID";
|
|
523
|
+
//#endregion
|
|
524
|
+
//#region src/migration/data/foreignKey.d.ts
|
|
525
|
+
type ForeignKeyReferentialAction = "RESTRICT" | "CASCADE" | "SET NULL" | "NO ACTION";
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region src/migration/serialized/serializedColumn.d.ts
|
|
498
528
|
type ColumnOptions = {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
529
|
+
updatable: boolean;
|
|
530
|
+
autoIncrementHashId: boolean;
|
|
531
|
+
hashSalt?: string;
|
|
502
532
|
};
|
|
503
533
|
interface SerializedColumnBase {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
534
|
+
hasReference: boolean;
|
|
535
|
+
fieldName: string;
|
|
536
|
+
columnName: string;
|
|
537
|
+
type: DBColumnTypes;
|
|
538
|
+
notNull: boolean;
|
|
539
|
+
default: SqlValueType | undefined;
|
|
540
|
+
zerofill: boolean;
|
|
541
|
+
signed: boolean | undefined;
|
|
542
|
+
autoIncrement: boolean;
|
|
543
|
+
length: number | undefined;
|
|
544
|
+
scale: number | undefined;
|
|
545
|
+
defaultCurrentTimeStamp: boolean;
|
|
546
|
+
onUpdateCurrentTimeStamp: boolean;
|
|
547
|
+
option: ColumnOptions;
|
|
518
548
|
}
|
|
519
549
|
interface SerializedNormalColumn extends SerializedColumnBase {
|
|
520
|
-
|
|
550
|
+
hasReference: false;
|
|
521
551
|
}
|
|
522
552
|
interface Reference {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
553
|
+
parentTable: string;
|
|
554
|
+
parentColumn: string;
|
|
555
|
+
columnName: string;
|
|
556
|
+
relation: Relation;
|
|
557
|
+
parentFieldName?: string;
|
|
558
|
+
fieldName?: string;
|
|
559
|
+
relationName?: string;
|
|
560
|
+
onUpdate?: ForeignKeyReferentialAction;
|
|
561
|
+
onDelete?: ForeignKeyReferentialAction;
|
|
562
|
+
noFKey?: boolean;
|
|
533
563
|
}
|
|
534
564
|
interface SerializedReferenceColumn extends SerializedColumnBase {
|
|
535
|
-
|
|
536
|
-
|
|
565
|
+
hasReference: true;
|
|
566
|
+
reference: Reference;
|
|
537
567
|
}
|
|
538
568
|
type SerializedColumn = SerializedNormalColumn | SerializedReferenceColumn;
|
|
539
|
-
|
|
569
|
+
//#endregion
|
|
570
|
+
//#region src/migration/serializable/serializable.d.ts
|
|
571
|
+
interface Serializable<T> {
|
|
572
|
+
serialize(): T;
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region src/generatorv2/nodes/entityName.d.ts
|
|
576
|
+
declare class EntityName {
|
|
577
|
+
readonly name: string;
|
|
578
|
+
static fromTableName(tableName: string): EntityName;
|
|
579
|
+
constructor(name: string);
|
|
580
|
+
toString(): string;
|
|
581
|
+
creatableInterface(): string;
|
|
582
|
+
updatable(): string;
|
|
583
|
+
identifiableInterfaceName(): string;
|
|
584
|
+
relationTypeName(): string;
|
|
585
|
+
entityWithRelationTypeName(): string;
|
|
586
|
+
resultType(): string;
|
|
587
|
+
fieldsTypeName(): string;
|
|
588
|
+
dataSourceName(): string;
|
|
589
|
+
generatedDataSourceName(): string;
|
|
590
|
+
lowerCase(): string;
|
|
591
|
+
createInputName(): string;
|
|
592
|
+
updateInputName(): string;
|
|
593
|
+
identifyInputName(): string;
|
|
594
|
+
IDEncoderName(): string;
|
|
595
|
+
}
|
|
596
|
+
//#endregion
|
|
597
|
+
//#region src/migration/data/index.d.ts
|
|
540
598
|
interface Index {
|
|
541
|
-
|
|
542
|
-
|
|
599
|
+
constraintName: string;
|
|
600
|
+
columns: string[];
|
|
543
601
|
}
|
|
544
602
|
declare class DBIndex implements Index, Serializable<Index> {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
603
|
+
readonly tableName: string;
|
|
604
|
+
readonly columns: string[];
|
|
605
|
+
readonly constraintName: string;
|
|
606
|
+
constructor(tableName: string, columns: string[]);
|
|
607
|
+
private toConstraintName;
|
|
608
|
+
addSql(): string;
|
|
609
|
+
dropSql(): string;
|
|
610
|
+
serialize(): Index;
|
|
553
611
|
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
kind: 'parent' | 'child';
|
|
557
|
-
field: string;
|
|
558
|
-
} | ConditionValue;
|
|
559
|
-
type JoinConditionRangeValue = {
|
|
560
|
-
kind: 'range';
|
|
561
|
-
begin: JoinConditionValue;
|
|
562
|
-
end: JoinConditionValue;
|
|
563
|
-
} | DateRangeConditionValue;
|
|
564
|
-
type DateRangeConditionValue = {
|
|
565
|
-
kind: 'date-range';
|
|
566
|
-
range: 'today';
|
|
567
|
-
thresholdHour?: number;
|
|
568
|
-
};
|
|
569
|
-
type JoinConditionNode = {
|
|
570
|
-
kind: 'comparison';
|
|
571
|
-
left: JoinConditionValue;
|
|
572
|
-
operator: ComparisonOperators;
|
|
573
|
-
right: JoinConditionValue;
|
|
574
|
-
} | {
|
|
575
|
-
kind: 'comparison';
|
|
576
|
-
left: JoinConditionValue;
|
|
577
|
-
operator: 'BETWEEN';
|
|
578
|
-
right: JoinConditionRangeValue;
|
|
579
|
-
} | {
|
|
580
|
-
kind: 'comparison';
|
|
581
|
-
left: JoinConditionValue;
|
|
582
|
-
operator: 'IN';
|
|
583
|
-
right: JoinConditionValue[];
|
|
584
|
-
} | {
|
|
585
|
-
kind: 'isNull';
|
|
586
|
-
value: JoinConditionValue;
|
|
587
|
-
not: boolean;
|
|
588
|
-
} | JoinCustomConditionNode;
|
|
589
|
-
type JoinCustomConditionNode = {
|
|
590
|
-
kind: 'custom';
|
|
591
|
-
conditionName: string;
|
|
592
|
-
parentRequiredFields?: string[];
|
|
593
|
-
childRequiredFields?: string[];
|
|
594
|
-
};
|
|
595
|
-
|
|
596
|
-
type VirtualRelation = {
|
|
597
|
-
parentTable: string;
|
|
598
|
-
childTable: string;
|
|
599
|
-
parentFieldName?: string;
|
|
600
|
-
childFieldName?: string;
|
|
601
|
-
conditions: JoinConditionNode[];
|
|
602
|
-
parentType?: 'array' | 'nullable' | 'notnull';
|
|
603
|
-
childType?: 'array' | 'nullable' | 'notnull';
|
|
604
|
-
};
|
|
605
|
-
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region src/migration/serialized/serializedStore.d.ts
|
|
606
614
|
interface SerializedTable {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
615
|
+
columns: SerializedColumn[];
|
|
616
|
+
primaryKey: string[];
|
|
617
|
+
uniqueKeys: string[][];
|
|
618
|
+
indexes: Index[];
|
|
619
|
+
tableName: string;
|
|
620
|
+
gqlOption: GQLOption;
|
|
621
|
+
virtualRelations: VirtualRelation[];
|
|
614
622
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/migration/serializable/table.d.ts
|
|
625
|
+
interface Table extends Serializable<SerializedTable> {
|
|
626
|
+
column(columnName: string): BaseColumn;
|
|
627
|
+
tableName: string;
|
|
628
|
+
gqlOption: GQLOption;
|
|
629
|
+
primaryKey: string[];
|
|
630
|
+
}
|
|
631
|
+
declare class TableHandler implements Table {
|
|
632
|
+
store: DataStore;
|
|
633
|
+
private indexes;
|
|
634
|
+
get index(): DBIndex[];
|
|
635
|
+
private _columns;
|
|
636
|
+
get columns(): BaseColumn[];
|
|
637
|
+
private readonly _virtualRelations;
|
|
638
|
+
get virtualRelations(): VirtualRelation[];
|
|
639
|
+
addVirtualRelation(relation: Omit<VirtualRelation, "childTable">): void;
|
|
640
|
+
primaryKey: string[];
|
|
641
|
+
readonly uniqueKeys: string[][];
|
|
642
|
+
readonly tableName: string;
|
|
643
|
+
private _gqlOption;
|
|
644
|
+
get gqlOption(): GQLOption;
|
|
645
|
+
constructor(table: Partial<SerializedTable> & Pick<SerializedTable, "tableName">, store: DataStore);
|
|
646
|
+
column(columnName: string): BaseColumn;
|
|
647
|
+
addColumn(column: BaseColumn, isPrimary?: boolean, isUnique?: boolean): void;
|
|
648
|
+
dropColumn(columnName: string): void;
|
|
649
|
+
serialize(): SerializedTable;
|
|
650
|
+
addReferences(ref: Reference, fieldName?: string, notNull?: boolean): this;
|
|
651
|
+
private getIndexConstraintName;
|
|
652
|
+
addIndex(...columns: string[]): this;
|
|
653
|
+
removeIndex(...columns: string[]): this;
|
|
654
|
+
addUniqueKey(...columnNames: string[]): this;
|
|
655
|
+
setPrimaryKey(...columnNames: string[]): this;
|
|
656
|
+
showCreateTable(): string;
|
|
657
|
+
hasColumn(columnName: string): boolean;
|
|
658
|
+
isColumnPrimary(columnName: string): boolean;
|
|
659
|
+
getEntityName(): EntityName;
|
|
660
|
+
setGQLOption(option: Partial<GQLOption>): void;
|
|
661
|
+
getReferenceColumns(): ReferenceColumn[];
|
|
662
|
+
addForeignKey(reference: Reference): void;
|
|
663
|
+
changeType(columnName: string, type: DBColumnTypes): void;
|
|
664
|
+
setDefault(columnName: string, value: string | number | null): void;
|
|
665
|
+
protected updateColumn(columnName: string, diff: Partial<SerializedColumn>): void;
|
|
666
|
+
getPrimaryKeyColumns(): BaseColumn[];
|
|
667
|
+
}
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region src/migration/serializable/column.d.ts
|
|
618
670
|
interface Column extends Serializable<SerializedColumn> {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
671
|
+
fieldName(): string;
|
|
672
|
+
columnName(): string;
|
|
673
|
+
dataType(): DBColumnTypes;
|
|
674
|
+
toSql(): string;
|
|
675
|
+
isReference(): this is ReferenceColumn;
|
|
676
|
+
isNullable(): boolean;
|
|
677
|
+
tsType(): string;
|
|
678
|
+
gqlType(): GQLPrimitive;
|
|
679
|
+
isNullableOnCreate(): boolean;
|
|
628
680
|
}
|
|
629
681
|
declare class BaseColumn implements Column {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
682
|
+
data: SerializedColumn;
|
|
683
|
+
table: Table;
|
|
684
|
+
constructor(data: SerializedColumn, table: Table);
|
|
685
|
+
fieldName(): string;
|
|
686
|
+
columnName(): string;
|
|
687
|
+
dataType(): DBColumnTypes;
|
|
688
|
+
tsType(): string;
|
|
689
|
+
gqlType(): GQLPrimitive;
|
|
690
|
+
isNullable(): boolean;
|
|
691
|
+
isNullableOnCreate(): boolean;
|
|
692
|
+
isReference(): this is ReferenceColumn;
|
|
693
|
+
serialize(): SerializedColumn;
|
|
694
|
+
toSql(): string;
|
|
695
|
+
isPrimary(): boolean;
|
|
696
|
+
isUpdatable(): boolean;
|
|
645
697
|
}
|
|
646
698
|
declare class ReferenceColumn extends BaseColumn {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
declare class EntityName {
|
|
653
|
-
readonly name: string;
|
|
654
|
-
static fromTableName(tableName: string): EntityName;
|
|
655
|
-
constructor(name: string);
|
|
656
|
-
toString(): string;
|
|
657
|
-
creatableInterface(): string;
|
|
658
|
-
updatable(): string;
|
|
659
|
-
identifiableInterfaceName(): string;
|
|
660
|
-
relationTypeName(): string;
|
|
661
|
-
entityWithRelationTypeName(): string;
|
|
662
|
-
resultType(): string;
|
|
663
|
-
fieldsTypeName(): string;
|
|
664
|
-
dataSourceName(): string;
|
|
665
|
-
generatedDataSourceName(): string;
|
|
666
|
-
lowerCase(): string;
|
|
667
|
-
createInputName(): string;
|
|
668
|
-
updateInputName(): string;
|
|
669
|
-
identifyInputName(): string;
|
|
670
|
-
IDEncoderName(): string;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
interface Table extends Serializable<SerializedTable> {
|
|
674
|
-
column(columnName: string): BaseColumn;
|
|
675
|
-
tableName: string;
|
|
676
|
-
gqlOption: GQLOption;
|
|
677
|
-
primaryKey: string[];
|
|
699
|
+
data: SerializedReferenceColumn;
|
|
700
|
+
constructor(data: SerializedReferenceColumn, table: Table);
|
|
701
|
+
getConstraintName(): string;
|
|
678
702
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
private indexes;
|
|
682
|
-
get index(): DBIndex[];
|
|
683
|
-
private _columns;
|
|
684
|
-
get columns(): BaseColumn[];
|
|
685
|
-
private readonly _virtualRelations;
|
|
686
|
-
get virtualRelations(): VirtualRelation[];
|
|
687
|
-
addVirtualRelation(relation: Omit<VirtualRelation, 'childTable'>): void;
|
|
688
|
-
primaryKey: string[];
|
|
689
|
-
readonly uniqueKeys: string[][];
|
|
690
|
-
readonly tableName: string;
|
|
691
|
-
private _gqlOption;
|
|
692
|
-
get gqlOption(): GQLOption;
|
|
693
|
-
constructor(table: Partial<SerializedTable> & Pick<SerializedTable, 'tableName'>, store: DataStore);
|
|
694
|
-
column(columnName: string): BaseColumn;
|
|
695
|
-
addColumn(column: BaseColumn, isPrimary?: boolean, isUnique?: boolean): void;
|
|
696
|
-
dropColumn(columnName: string): void;
|
|
697
|
-
serialize(): SerializedTable;
|
|
698
|
-
addReferences(ref: Reference, fieldName?: string, notNull?: boolean): this;
|
|
699
|
-
private getIndexConstraintName;
|
|
700
|
-
addIndex(...columns: string[]): this;
|
|
701
|
-
removeIndex(...columns: string[]): this;
|
|
702
|
-
addUniqueKey(...columnNames: string[]): this;
|
|
703
|
-
setPrimaryKey(...columnNames: string[]): this;
|
|
704
|
-
showCreateTable(): string;
|
|
705
|
-
hasColumn(columnName: string): boolean;
|
|
706
|
-
isColumnPrimary(columnName: string): boolean;
|
|
707
|
-
getEntityName(): EntityName;
|
|
708
|
-
setGQLOption(option: Partial<GQLOption>): void;
|
|
709
|
-
getReferenceColumns(): ReferenceColumn[];
|
|
710
|
-
addForeignKey(reference: Reference): void;
|
|
711
|
-
changeType(columnName: string, type: DBColumnTypes): void;
|
|
712
|
-
setDefault(columnName: string, value: string | number | null): void;
|
|
713
|
-
protected updateColumn(columnName: string, diff: Partial<SerializedColumn>): void;
|
|
714
|
-
getPrimaryKeyColumns(): BaseColumn[];
|
|
715
|
-
}
|
|
716
|
-
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/migration/dataStore.d.ts
|
|
717
705
|
interface DataStore {
|
|
718
|
-
|
|
706
|
+
table(tableName: string): Table;
|
|
719
707
|
}
|
|
720
|
-
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/generatorv2/nodes/QueryConditionNode.d.ts
|
|
710
|
+
type QueryConditionValue = ConditionValue | FieldQueryConditionValue | ArgQueryConditionValue;
|
|
711
|
+
type FieldQueryConditionValue = {
|
|
712
|
+
kind: "field";
|
|
713
|
+
column: string;
|
|
714
|
+
};
|
|
715
|
+
type ArgQueryConditionValue = {
|
|
716
|
+
kind: "arg";
|
|
717
|
+
name: string;
|
|
718
|
+
type: "Int" | "Float" | "String" | string;
|
|
719
|
+
};
|
|
720
|
+
type QueryConditionNode = {
|
|
721
|
+
kind: "comparison";
|
|
722
|
+
left: QueryConditionValue;
|
|
723
|
+
operator: ComparisonOperators;
|
|
724
|
+
right: QueryConditionValue;
|
|
725
|
+
} | {
|
|
726
|
+
kind: "between";
|
|
727
|
+
left: QueryConditionValue;
|
|
728
|
+
operator: "BETWEEN";
|
|
729
|
+
begin: QueryConditionValue;
|
|
730
|
+
end: QueryConditionValue;
|
|
731
|
+
};
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region src/migration/data/GQLOption.d.ts
|
|
721
734
|
interface GqlFromContextParam {
|
|
722
|
-
|
|
723
|
-
|
|
735
|
+
column: string;
|
|
736
|
+
contextName?: string;
|
|
724
737
|
}
|
|
725
738
|
type GQLMutation = {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
739
|
+
type: "create" | "update" | "delete";
|
|
740
|
+
noReFetch: boolean;
|
|
741
|
+
middlewares: string[];
|
|
742
|
+
contextFields: GqlFromContextParam[];
|
|
743
|
+
subscription: {
|
|
744
|
+
enabled: boolean;
|
|
745
|
+
subscriptionFilter: string[];
|
|
746
|
+
};
|
|
734
747
|
};
|
|
735
748
|
type GQLQuery = {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
749
|
+
type: "single" | "list-all" | "list-paging";
|
|
750
|
+
name: string;
|
|
751
|
+
conditions: QueryConditionNode[];
|
|
752
|
+
middlewares: string[];
|
|
740
753
|
} | {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
754
|
+
type: "primary";
|
|
755
|
+
name?: never;
|
|
756
|
+
conditions: never[];
|
|
757
|
+
middlewares: string[];
|
|
745
758
|
};
|
|
746
759
|
interface GQLOption {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
760
|
+
enabled: boolean;
|
|
761
|
+
queries: GQLQuery[];
|
|
762
|
+
mutations: GQLMutation[];
|
|
750
763
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
single: (name: string, options?: {
|
|
754
|
-
conditions?: QueryConditionNode[];
|
|
755
|
-
middlewares?: string[];
|
|
756
|
-
}) => GQLQuery;
|
|
757
|
-
listAll: (name: string, options?: {
|
|
758
|
-
conditions?: QueryConditionNode[];
|
|
759
|
-
middlewares?: string[];
|
|
760
|
-
}) => GQLQuery;
|
|
761
|
-
paging: (name: string, options?: {
|
|
762
|
-
conditions?: QueryConditionNode[];
|
|
763
|
-
middlewares?: string[];
|
|
764
|
-
}) => GQLQuery;
|
|
765
|
-
primary: (middlewares?: string[]) => GQLQuery;
|
|
766
|
-
};
|
|
767
|
-
|
|
768
|
-
type Option = {
|
|
769
|
-
noRefetch?: boolean;
|
|
770
|
-
middlewares?: string[];
|
|
771
|
-
contextFields?: GqlFromContextParam[];
|
|
772
|
-
subscription?: {
|
|
773
|
-
enabled: boolean;
|
|
774
|
-
subscriptionFilter?: string[];
|
|
775
|
-
} | boolean;
|
|
776
|
-
};
|
|
777
|
-
declare const Mutations: {
|
|
778
|
-
create: (options?: Option) => GQLMutation;
|
|
779
|
-
update: (options?: Option) => GQLMutation;
|
|
780
|
-
delete: (options?: Omit<Option, 'noRefetch'>) => GQLMutation;
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
declare const Conditions: {
|
|
784
|
-
readonly betweenRel: (left: JoinConditionValue, range: JoinConditionRangeValue) => JoinConditionNode;
|
|
785
|
-
readonly betweenQuery: (left: QueryConditionValue, begin: QueryConditionValue, end: QueryConditionValue) => QueryConditionNode;
|
|
786
|
-
readonly custom: (conditionName: string, parentRequiredFields?: string[], childRequiredFields?: string[]) => JoinConditionNode;
|
|
787
|
-
readonly rel: {
|
|
788
|
-
readonly between: (left: JoinConditionValue, range: JoinConditionRangeValue) => JoinConditionNode;
|
|
789
|
-
readonly comparison: (left: JoinConditionValue, operator: ComparisonOperators, right: JoinConditionValue) => JoinConditionNode;
|
|
790
|
-
readonly in: (left: JoinConditionValue, right: JoinConditionValue[]) => JoinConditionNode;
|
|
791
|
-
readonly isNull: (value: JoinConditionValue) => JoinConditionNode;
|
|
792
|
-
readonly isNotNull: (value: JoinConditionValue) => JoinConditionNode;
|
|
793
|
-
};
|
|
794
|
-
readonly query: {
|
|
795
|
-
readonly between: (left: QueryConditionValue, begin: QueryConditionValue, end: QueryConditionValue) => QueryConditionNode;
|
|
796
|
-
readonly comparison: (left: QueryConditionValue, operator: ComparisonOperators, right: QueryConditionValue) => QueryConditionNode;
|
|
797
|
-
};
|
|
798
|
-
readonly value: {
|
|
799
|
-
readonly parent: (field: string) => JoinConditionValue;
|
|
800
|
-
readonly child: (field: string) => JoinConditionValue;
|
|
801
|
-
readonly contextOrError: (field: string, errorMessage: string) => ConditionValue;
|
|
802
|
-
readonly contextOrDefault: (field: string, defaultValue: string | number) => ConditionValue;
|
|
803
|
-
readonly fixed: (value: string | number) => ConditionValue;
|
|
804
|
-
readonly today: (thresholdHour?: number, date?: boolean) => ConditionValue;
|
|
805
|
-
readonly now: () => ConditionValue;
|
|
806
|
-
readonly field: (column: string) => QueryConditionValue;
|
|
807
|
-
readonly arg: (name: string, type: 'Int' | 'Float' | 'String') => QueryConditionValue;
|
|
808
|
-
};
|
|
809
|
-
readonly range: {
|
|
810
|
-
readonly values: (begin: JoinConditionValue, end: JoinConditionValue) => JoinConditionRangeValue;
|
|
811
|
-
readonly today: (thresholdHour?: number) => JoinConditionRangeValue;
|
|
812
|
-
};
|
|
813
|
-
};
|
|
814
|
-
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/migration/creators/columnBuilder.d.ts
|
|
815
766
|
declare abstract class ColumnBuilderBase {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
767
|
+
readonly columnName: string;
|
|
768
|
+
protected _primary: boolean;
|
|
769
|
+
protected _notNull: boolean;
|
|
770
|
+
protected _unique: boolean;
|
|
771
|
+
protected _option: ColumnOptions;
|
|
772
|
+
protected _fieldName: string;
|
|
773
|
+
protected constructor(columnName: string);
|
|
774
|
+
fieldName(fieldName: string): this;
|
|
775
|
+
notNull(): this;
|
|
776
|
+
nullable(): this;
|
|
777
|
+
primary(): this;
|
|
778
|
+
unique(): this;
|
|
779
|
+
updatable(updatable: boolean): this;
|
|
780
|
+
abstract build(): {
|
|
781
|
+
data: SerializedColumn;
|
|
782
|
+
isPrimary: boolean;
|
|
783
|
+
isUnique: boolean;
|
|
784
|
+
};
|
|
834
785
|
}
|
|
835
786
|
declare abstract class ColumnBuilder extends ColumnBuilderBase {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
787
|
+
protected type: DBColumnTypes;
|
|
788
|
+
protected length?: number | undefined;
|
|
789
|
+
protected scale?: number | undefined;
|
|
790
|
+
protected _zerofill: boolean;
|
|
791
|
+
protected _signed: boolean | undefined;
|
|
792
|
+
protected _autoIncrement: boolean;
|
|
793
|
+
protected _default: SqlValueType | undefined;
|
|
794
|
+
protected _defaultCurrentTimeStamp: boolean;
|
|
795
|
+
protected _onUpdateCurrentTimeStamp: boolean;
|
|
796
|
+
protected constructor(name: string, type: DBColumnTypes, length?: number | undefined, scale?: number | undefined);
|
|
797
|
+
default(value: SqlValueType | undefined): this;
|
|
798
|
+
build(): {
|
|
799
|
+
data: SerializedNormalColumn;
|
|
800
|
+
isPrimary: boolean;
|
|
801
|
+
isUnique: boolean;
|
|
802
|
+
};
|
|
852
803
|
}
|
|
853
804
|
declare class StringColumnBuilder extends ColumnBuilder {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
805
|
+
readonly name: string;
|
|
806
|
+
protected type: DBStringTypes;
|
|
807
|
+
protected length?: number | undefined;
|
|
808
|
+
constructor(name: string, type: DBStringTypes, length?: number | undefined);
|
|
809
|
+
default(value: string | null | undefined): this;
|
|
859
810
|
}
|
|
860
811
|
declare class TextColumnBuilder extends ColumnBuilder {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
812
|
+
readonly name: string;
|
|
813
|
+
protected type: DBTextTypes;
|
|
814
|
+
constructor(name: string, type: DBTextTypes);
|
|
815
|
+
default(value: string | null | undefined): this;
|
|
865
816
|
}
|
|
866
817
|
declare class NumberColumnBuilder extends ColumnBuilder {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
default(value: number | null | undefined): this;
|
|
818
|
+
signed(): this;
|
|
819
|
+
unsigned(): this;
|
|
820
|
+
zerofill(): this;
|
|
821
|
+
default(value: number | null | undefined): this;
|
|
872
822
|
}
|
|
873
823
|
declare class IntegerColumnBuilder extends NumberColumnBuilder {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
824
|
+
readonly name: string;
|
|
825
|
+
protected type: DBIntegerTypes;
|
|
826
|
+
protected length?: number | undefined;
|
|
827
|
+
constructor(name: string, type: DBIntegerTypes, length?: number | undefined);
|
|
828
|
+
autoIncrement(): this;
|
|
879
829
|
}
|
|
880
830
|
declare class FloatColumnBuilder extends NumberColumnBuilder {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
831
|
+
readonly name: string;
|
|
832
|
+
protected type: DBFloatingTypes;
|
|
833
|
+
protected length?: number | undefined;
|
|
834
|
+
protected scale?: number | undefined;
|
|
835
|
+
constructor(name: string, type: DBFloatingTypes, length?: number | undefined, scale?: number | undefined);
|
|
836
|
+
autoIncrement(): this;
|
|
887
837
|
}
|
|
888
838
|
declare class DecimalColumnBuilder extends NumberColumnBuilder {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
839
|
+
readonly name: string;
|
|
840
|
+
protected type: DBColumnTypes.decimal;
|
|
841
|
+
protected length?: number | undefined;
|
|
842
|
+
protected scale?: number | undefined;
|
|
843
|
+
constructor(name: string, type: DBColumnTypes.decimal, length?: number | undefined, scale?: number | undefined);
|
|
894
844
|
}
|
|
895
845
|
declare class DateColumnBuilder extends ColumnBuilder {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
846
|
+
readonly name: string;
|
|
847
|
+
protected type: DBDateTypes;
|
|
848
|
+
constructor(name: string, type: DBDateTypes);
|
|
849
|
+
default(value: string | number | null | undefined): this;
|
|
900
850
|
}
|
|
901
851
|
declare class TimeStampColumnBuilder extends ColumnBuilder {
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
852
|
+
readonly name: string;
|
|
853
|
+
protected type: DBColumnTypes.timestamp | DBColumnTypes.dateTime;
|
|
854
|
+
constructor(name: string, type: DBColumnTypes.timestamp | DBColumnTypes.dateTime);
|
|
855
|
+
default(value: "CURRENT_TIMESTAMP" | string | null | undefined): this;
|
|
856
|
+
defaultCurrentTimeStamp(): this;
|
|
857
|
+
onUpdateCurrentTimeStamp(): this;
|
|
908
858
|
}
|
|
909
859
|
declare class ReferenceColumnBuilder extends ColumnBuilderBase {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
type CreateColumn = {
|
|
925
|
-
char: (length: number) => StringColumnBuilder;
|
|
926
|
-
varchar: (length: number) => StringColumnBuilder;
|
|
927
|
-
text: () => TextColumnBuilder;
|
|
928
|
-
tinyInt: (length?: number) => IntegerColumnBuilder;
|
|
929
|
-
smallInt: (length?: number) => IntegerColumnBuilder;
|
|
930
|
-
mediumInt: (length?: number) => IntegerColumnBuilder;
|
|
931
|
-
int: (length?: number) => IntegerColumnBuilder;
|
|
932
|
-
bigInt: (length?: number) => IntegerColumnBuilder;
|
|
933
|
-
float: (length?: number, scale?: number) => FloatColumnBuilder;
|
|
934
|
-
double: (length?: number, scale?: number) => FloatColumnBuilder;
|
|
935
|
-
decimal: (length?: number, scale?: number) => DecimalColumnBuilder;
|
|
936
|
-
year: () => DateColumnBuilder;
|
|
937
|
-
date: () => DateColumnBuilder;
|
|
938
|
-
time: () => DateColumnBuilder;
|
|
939
|
-
dateTime: () => TimeStampColumnBuilder;
|
|
940
|
-
timestamp: () => TimeStampColumnBuilder;
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
interface MigrationTable extends Table {
|
|
944
|
-
addIndex(...columns: string[]): MigrationTable;
|
|
945
|
-
removeIndex(...columns: string[]): MigrationTable;
|
|
946
|
-
addColumn(name: string, create: (column: CreateColumn) => ColumnBuilder): MigrationTable;
|
|
947
|
-
_addColumn(column: SerializedColumn): MigrationTable;
|
|
948
|
-
dropColumn(columnName: string): MigrationTable;
|
|
949
|
-
addForeignKey(reference: Reference): MigrationTable;
|
|
950
|
-
changeColumnType(columnName: string, type: DBType): MigrationTable;
|
|
951
|
-
setDefault(columnName: string, value: string | number | null): MigrationTable;
|
|
952
|
-
enableGQL(): MigrationTable;
|
|
953
|
-
setGQLOption(option: GQLOption): MigrationTable;
|
|
954
|
-
addGQLQuery(...queries: GQLQuery[]): MigrationTable;
|
|
955
|
-
addGQLMutation(...mutations: GQLMutation[]): MigrationTable;
|
|
860
|
+
protected readonly ref: Reference;
|
|
861
|
+
protected readonly parent: Column;
|
|
862
|
+
constructor(ref: Reference, parent: Column);
|
|
863
|
+
notNull(): this;
|
|
864
|
+
nullable(): this;
|
|
865
|
+
primary(): this;
|
|
866
|
+
unique(): this;
|
|
867
|
+
build(): {
|
|
868
|
+
data: SerializedReferenceColumn;
|
|
869
|
+
isPrimary: boolean;
|
|
870
|
+
isUnique: boolean;
|
|
871
|
+
};
|
|
956
872
|
}
|
|
957
|
-
|
|
873
|
+
//#endregion
|
|
874
|
+
//#region src/migration/creators/columnCreator.d.ts
|
|
958
875
|
declare class ColumnCreator {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
876
|
+
private table;
|
|
877
|
+
private name;
|
|
878
|
+
constructor(table: TableCreator, name: string);
|
|
879
|
+
char: (length: number) => StringColumnBuilder;
|
|
880
|
+
varchar: (length: number) => StringColumnBuilder;
|
|
881
|
+
text: () => TextColumnBuilder;
|
|
882
|
+
tinyInt: (length?: number) => IntegerColumnBuilder;
|
|
883
|
+
smallInt: (length?: number) => IntegerColumnBuilder;
|
|
884
|
+
mediumInt: (length?: number) => IntegerColumnBuilder;
|
|
885
|
+
int: (length?: number) => IntegerColumnBuilder;
|
|
886
|
+
bigInt: (length?: number) => IntegerColumnBuilder;
|
|
887
|
+
float: (length?: number, scale?: number) => FloatColumnBuilder;
|
|
888
|
+
double: (length?: number, scale?: number) => FloatColumnBuilder;
|
|
889
|
+
decimal: (length?: number, scale?: number) => DecimalColumnBuilder;
|
|
890
|
+
year: () => DateColumnBuilder;
|
|
891
|
+
date: () => DateColumnBuilder;
|
|
892
|
+
time: () => DateColumnBuilder;
|
|
893
|
+
dateTime: () => TimeStampColumnBuilder;
|
|
894
|
+
timestamp: () => TimeStampColumnBuilder;
|
|
895
|
+
private create;
|
|
979
896
|
}
|
|
980
|
-
|
|
897
|
+
//#endregion
|
|
898
|
+
//#region src/migration/creators/tableCreator.d.ts
|
|
981
899
|
interface TableBuilder {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
900
|
+
autoIncrementHashId(columnName: string, option?: {
|
|
901
|
+
salt?: string;
|
|
902
|
+
bigint?: boolean;
|
|
903
|
+
}): TableBuilder;
|
|
904
|
+
column(columnName: string): ColumnCreator;
|
|
905
|
+
addVirtualRelation(relation: Omit<VirtualRelation, "childTable">): TableBuilder;
|
|
906
|
+
references(reference: Reference, notNull?: boolean): ColumnBuilderBase;
|
|
907
|
+
setPrimaryKey(...columnNames: string[]): TableBuilder;
|
|
908
|
+
addUniqueKey(...columnNames: string[]): TableBuilder;
|
|
909
|
+
createdAt(): TableBuilder;
|
|
910
|
+
updatedAt(): TableBuilder;
|
|
911
|
+
addIndex(...columns: string[]): TableBuilder;
|
|
912
|
+
enableGQL(): TableBuilder;
|
|
913
|
+
setGQLOption(option: Partial<GQLOption>): TableBuilder;
|
|
914
|
+
addGQLQuery(...query: GQLQuery[]): TableBuilder;
|
|
915
|
+
addGQLMutation(...mutation: GQLMutation[]): TableBuilder;
|
|
998
916
|
}
|
|
999
917
|
declare class TableCreator implements TableBuilder {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
918
|
+
tableName: string;
|
|
919
|
+
protected readonly store: DataStore;
|
|
920
|
+
private readonly table;
|
|
921
|
+
private readonly columns;
|
|
922
|
+
constructor(tableName: string, store: DataStore);
|
|
923
|
+
autoIncrementHashId(columnName: string, option?: {
|
|
924
|
+
salt?: string;
|
|
925
|
+
bigint?: boolean;
|
|
926
|
+
}): TableBuilder;
|
|
927
|
+
column(name: string): ColumnCreator;
|
|
928
|
+
addVirtualRelation(relation: Omit<VirtualRelation, "childTable">): this;
|
|
929
|
+
addColumn(column: ColumnBuilderBase): void;
|
|
930
|
+
addUniqueKey(...columnNames: string[]): TableBuilder;
|
|
931
|
+
references(ref: Reference): ReferenceColumnBuilder;
|
|
932
|
+
setPrimaryKey(...columnNames: string[]): TableBuilder;
|
|
933
|
+
create(): TableHandler;
|
|
934
|
+
createdAt(): TableBuilder;
|
|
935
|
+
updatedAt(): TableBuilder;
|
|
936
|
+
addIndex(...columns: string[]): TableBuilder;
|
|
937
|
+
enableGQL(): TableBuilder;
|
|
938
|
+
setGQLOption(option: Partial<GQLOption>): TableBuilder;
|
|
939
|
+
addGQLQuery(...query: GQLQuery[]): TableBuilder;
|
|
940
|
+
addGQLMutation(...mutation: GQLMutation[]): TableBuilder;
|
|
1023
941
|
}
|
|
1024
|
-
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region src/migration/creators/createColumn.d.ts
|
|
944
|
+
type CreateColumn = {
|
|
945
|
+
char: (length: number) => StringColumnBuilder;
|
|
946
|
+
varchar: (length: number) => StringColumnBuilder;
|
|
947
|
+
text: () => TextColumnBuilder;
|
|
948
|
+
tinyInt: (length?: number) => IntegerColumnBuilder;
|
|
949
|
+
smallInt: (length?: number) => IntegerColumnBuilder;
|
|
950
|
+
mediumInt: (length?: number) => IntegerColumnBuilder;
|
|
951
|
+
int: (length?: number) => IntegerColumnBuilder;
|
|
952
|
+
bigInt: (length?: number) => IntegerColumnBuilder;
|
|
953
|
+
float: (length?: number, scale?: number) => FloatColumnBuilder;
|
|
954
|
+
double: (length?: number, scale?: number) => FloatColumnBuilder;
|
|
955
|
+
decimal: (length?: number, scale?: number) => DecimalColumnBuilder;
|
|
956
|
+
year: () => DateColumnBuilder;
|
|
957
|
+
date: () => DateColumnBuilder;
|
|
958
|
+
time: () => DateColumnBuilder;
|
|
959
|
+
dateTime: () => TimeStampColumnBuilder;
|
|
960
|
+
timestamp: () => TimeStampColumnBuilder;
|
|
961
|
+
};
|
|
962
|
+
//#endregion
|
|
963
|
+
//#region src/migration/front/tableMigrator.d.ts
|
|
964
|
+
interface MigrationTable extends Table {
|
|
965
|
+
addIndex(...columns: string[]): MigrationTable;
|
|
966
|
+
removeIndex(...columns: string[]): MigrationTable;
|
|
967
|
+
addColumn(name: string, create: (column: CreateColumn) => ColumnBuilder): MigrationTable;
|
|
968
|
+
_addColumn(column: SerializedColumn): MigrationTable;
|
|
969
|
+
dropColumn(columnName: string): MigrationTable;
|
|
970
|
+
addForeignKey(reference: Reference): MigrationTable;
|
|
971
|
+
changeColumnType(columnName: string, type: DBType): MigrationTable;
|
|
972
|
+
setDefault(columnName: string, value: string | number | null): MigrationTable;
|
|
973
|
+
enableGQL(): MigrationTable;
|
|
974
|
+
setGQLOption(option: GQLOption): MigrationTable;
|
|
975
|
+
addGQLQuery(...queries: GQLQuery[]): MigrationTable;
|
|
976
|
+
addGQLMutation(...mutations: GQLMutation[]): MigrationTable;
|
|
977
|
+
}
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/migration/front/storeMigrator.d.ts
|
|
1025
980
|
interface MigrationStore extends DataStore {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
981
|
+
createTable(tableName: string, tableCreator: (table: TableBuilder) => void): MigrationStore;
|
|
982
|
+
dropTable(tableName: string): MigrationStore;
|
|
983
|
+
table(tableName: string): MigrationTable;
|
|
984
|
+
sql(...sql: string[]): MigrationStore;
|
|
985
|
+
setConfig(config: NestedPartial<SasatConfig>): MigrationStore;
|
|
1031
986
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
return: string;
|
|
1035
|
-
args?: {
|
|
1036
|
-
name: string;
|
|
1037
|
-
type: string;
|
|
1038
|
-
}[];
|
|
1039
|
-
};
|
|
1040
|
-
|
|
987
|
+
//#endregion
|
|
988
|
+
//#region src/migration/front/migration.d.ts
|
|
1041
989
|
interface SasatMigration {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
990
|
+
up: (store: MigrationStore) => void | Promise<void>;
|
|
991
|
+
down: (store: MigrationStore) => void | Promise<void>;
|
|
992
|
+
beforeUp?: () => void | Promise<void>;
|
|
993
|
+
afterUp?: () => void | Promise<void>;
|
|
994
|
+
beforeDown?: () => void | Promise<void>;
|
|
995
|
+
afterDown?: () => void | Promise<void>;
|
|
1048
996
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
readonly
|
|
1057
|
-
readonly
|
|
1058
|
-
readonly
|
|
1059
|
-
readonly
|
|
1060
|
-
readonly
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
readonly
|
|
1064
|
-
readonly
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
readonly
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
readonly
|
|
1071
|
-
readonly
|
|
1072
|
-
readonly
|
|
1073
|
-
readonly
|
|
1074
|
-
readonly
|
|
1075
|
-
readonly
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
readonly
|
|
1079
|
-
readonly
|
|
1080
|
-
|
|
1081
|
-
readonly startsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1082
|
-
readonly notStartsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1083
|
-
readonly endsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1084
|
-
readonly notEndsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1085
|
-
readonly in: (left: Value, right: StrOrNum[] | Query | RawExpression) => BooleanValueExpression;
|
|
1086
|
-
readonly notIn: (left: Value, values: StrOrNum[]) => InExpression;
|
|
1087
|
-
readonly between: (left: Value, begin: Value, end: Value) => BetweenExpression;
|
|
1088
|
-
readonly isNull: (expr: Value) => IsNullExpression;
|
|
1089
|
-
readonly isNotNull: (expr: Value) => IsNullExpression;
|
|
1090
|
-
readonly exists: (query: RawExpression | Query) => ExistsExpression;
|
|
1091
|
-
readonly conditions: {
|
|
1092
|
-
simpleWhere: (tableNameOrAlias: string, where: {
|
|
1093
|
-
[field: string]: ValueType | [ComparisonOperators, ValueType];
|
|
1094
|
-
}, isOr?: boolean) => BooleanValueExpression;
|
|
1095
|
-
and: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
1096
|
-
or: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
1097
|
-
eq: (left: Value, right: Value) => ComparisonExpression;
|
|
1098
|
-
neq: (left: Value, right: Value) => ComparisonExpression;
|
|
1099
|
-
gt: (left: Value, right: Value) => ComparisonExpression;
|
|
1100
|
-
gte: (left: Value, right: Value) => ComparisonExpression;
|
|
1101
|
-
lt: (left: Value, right: Value) => ComparisonExpression;
|
|
1102
|
-
lte: (left: Value, right: Value) => ComparisonExpression;
|
|
1103
|
-
comparison: (left: Value, operator: ComparisonOperators, right: Value) => ComparisonExpression;
|
|
1104
|
-
contains: (left: Value, right: string) => BooleanValueExpression;
|
|
1105
|
-
notContains: (left: Value, right: string) => BooleanValueExpression;
|
|
1106
|
-
startsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1107
|
-
notStartsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1108
|
-
endsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1109
|
-
notEndsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1110
|
-
in: (left: Value, right: StrOrNum[] | Query | RawExpression) => BooleanValueExpression;
|
|
1111
|
-
notIn: (left: Value, values: StrOrNum[]) => InExpression;
|
|
1112
|
-
between: (left: Value, begin: Value, end: Value) => BetweenExpression;
|
|
1113
|
-
isNull: (expr: Value) => IsNullExpression;
|
|
1114
|
-
isNotNull: (expr: Value) => IsNullExpression;
|
|
1115
|
-
exists: (query: RawExpression | Query) => ExistsExpression;
|
|
1116
|
-
};
|
|
997
|
+
//#endregion
|
|
998
|
+
//#region src/migration/makeCondition.d.ts
|
|
999
|
+
declare const Conditions: {
|
|
1000
|
+
readonly betweenRel: (left: JoinConditionValue, range: JoinConditionRangeValue) => JoinConditionNode;
|
|
1001
|
+
readonly betweenQuery: (left: QueryConditionValue, begin: QueryConditionValue, end: QueryConditionValue) => QueryConditionNode;
|
|
1002
|
+
readonly custom: (conditionName: string, parentRequiredFields?: string[], childRequiredFields?: string[]) => JoinConditionNode;
|
|
1003
|
+
readonly rel: {
|
|
1004
|
+
readonly between: (left: JoinConditionValue, range: JoinConditionRangeValue) => JoinConditionNode;
|
|
1005
|
+
readonly comparison: (left: JoinConditionValue, operator: ComparisonOperators, right: JoinConditionValue) => JoinConditionNode;
|
|
1006
|
+
readonly in: (left: JoinConditionValue, right: JoinConditionValue[]) => JoinConditionNode;
|
|
1007
|
+
readonly isNull: (value: JoinConditionValue) => JoinConditionNode;
|
|
1008
|
+
readonly isNotNull: (value: JoinConditionValue) => JoinConditionNode;
|
|
1009
|
+
};
|
|
1010
|
+
readonly query: {
|
|
1011
|
+
readonly between: (left: QueryConditionValue, begin: QueryConditionValue, end: QueryConditionValue) => QueryConditionNode;
|
|
1012
|
+
readonly comparison: (left: QueryConditionValue, operator: ComparisonOperators, right: QueryConditionValue) => QueryConditionNode;
|
|
1013
|
+
};
|
|
1014
|
+
readonly value: {
|
|
1015
|
+
readonly parent: (field: string) => JoinConditionValue;
|
|
1016
|
+
readonly child: (field: string) => JoinConditionValue;
|
|
1017
|
+
readonly contextOrError: (field: string, errorMessage: string) => ConditionValue;
|
|
1018
|
+
readonly contextOrDefault: (field: string, defaultValue: string | number) => ConditionValue;
|
|
1019
|
+
readonly fixed: (value: string | number) => ConditionValue;
|
|
1020
|
+
readonly today: (thresholdHour?: number, date?: boolean) => ConditionValue;
|
|
1021
|
+
readonly now: () => ConditionValue;
|
|
1022
|
+
readonly field: (column: string) => QueryConditionValue;
|
|
1023
|
+
readonly arg: (name: string, type: "Int" | "Float" | "String") => QueryConditionValue;
|
|
1024
|
+
};
|
|
1025
|
+
readonly range: {
|
|
1026
|
+
readonly values: (begin: JoinConditionValue, end: JoinConditionValue) => JoinConditionRangeValue;
|
|
1027
|
+
readonly today: (thresholdHour?: number) => JoinConditionRangeValue;
|
|
1028
|
+
};
|
|
1117
1029
|
};
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1030
|
+
//#endregion
|
|
1031
|
+
//#region src/migration/makeMutaion.d.ts
|
|
1032
|
+
type Option = {
|
|
1033
|
+
noRefetch?: boolean;
|
|
1034
|
+
middlewares?: string[];
|
|
1035
|
+
contextFields?: GqlFromContextParam[];
|
|
1036
|
+
subscription?: {
|
|
1037
|
+
enabled: boolean;
|
|
1038
|
+
subscriptionFilter?: string[];
|
|
1039
|
+
} | boolean;
|
|
1127
1040
|
};
|
|
1128
|
-
declare const
|
|
1129
|
-
|
|
1041
|
+
declare const Mutations: {
|
|
1042
|
+
create: (options?: Option) => GQLMutation;
|
|
1043
|
+
update: (options?: Option) => GQLMutation;
|
|
1044
|
+
delete: (options?: Omit<Option, "noRefetch">) => GQLMutation;
|
|
1045
|
+
};
|
|
1046
|
+
//#endregion
|
|
1047
|
+
//#region src/migration/makeQuery.d.ts
|
|
1048
|
+
declare const Queries: {
|
|
1049
|
+
single: (name: string, options?: {
|
|
1050
|
+
conditions?: QueryConditionNode[];
|
|
1051
|
+
middlewares?: string[];
|
|
1052
|
+
}) => GQLQuery;
|
|
1053
|
+
listAll: (name: string, options?: {
|
|
1054
|
+
conditions?: QueryConditionNode[];
|
|
1055
|
+
middlewares?: string[];
|
|
1056
|
+
}) => GQLQuery;
|
|
1057
|
+
paging: (name: string, options?: {
|
|
1058
|
+
conditions?: QueryConditionNode[];
|
|
1059
|
+
middlewares?: string[];
|
|
1060
|
+
}) => GQLQuery;
|
|
1061
|
+
primary: (middlewares?: string[]) => GQLQuery;
|
|
1062
|
+
};
|
|
1063
|
+
//#endregion
|
|
1064
|
+
//#region src/runtime/createTypeDef.d.ts
|
|
1130
1065
|
type TypeDef = Record<string, TypeFieldDefinition>;
|
|
1131
1066
|
declare const createTypeDef: (typeDefs: Record<string, TypeDef>, inputs: Record<string, TypeDef>) => string;
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
declare class CompositeCondition<T> {
|
|
1136
|
-
private type;
|
|
1137
|
-
private conditions;
|
|
1138
|
-
private constructor();
|
|
1139
|
-
static or<T>(conditions: ConditionExpression<T>[]): CompositeCondition<T>;
|
|
1140
|
-
static and<T>(conditions: ConditionExpression<T>[]): CompositeCondition<T>;
|
|
1141
|
-
toSQL(): string;
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1067
|
+
//#endregion
|
|
1068
|
+
//#region src/runtime/date.d.ts
|
|
1144
1069
|
declare const dateOffset: (date: Date, timeZoneHour?: number) => Date;
|
|
1145
1070
|
declare const dateToDatetimeString: (d: Date) => string;
|
|
1146
1071
|
declare const dateToDateString: (d: Date) => string;
|
|
@@ -1148,20 +1073,155 @@ declare const getTodayDateString: (timeZoneHour?: number) => string;
|
|
|
1148
1073
|
declare const getTodayDateTimeString: (timeZoneHour?: number) => string;
|
|
1149
1074
|
declare const getDayRange: (date: Date, timeZoneHour?: number) => [string, string];
|
|
1150
1075
|
declare const getDayRangeQExpr: (date: Date, timeZoneHour?: number) => [Literal, Literal];
|
|
1151
|
-
|
|
1076
|
+
//#endregion
|
|
1077
|
+
//#region src/runtime/dsl/factory.d.ts
|
|
1078
|
+
type StrOrNum = string | number;
|
|
1079
|
+
type ValueType = string | boolean | number | null;
|
|
1080
|
+
declare const QExpr: {
|
|
1081
|
+
readonly field: (table: string, name: string, alias?: string) => Field;
|
|
1082
|
+
readonly fn: (fnName: string, args: Value[], alias?: string) => Fn;
|
|
1083
|
+
readonly window: (type: "ROWS" | "RANGE", value: WindowContent) => Window;
|
|
1084
|
+
readonly windowBetween: (type: "ROWS" | "RANGE", start: WindowContent, end: WindowContent) => Window;
|
|
1085
|
+
readonly paren: (expression: BooleanValueExpression) => ParenthesisExpression;
|
|
1086
|
+
readonly table: (name: string, joins: Join[], alias: string) => QueryTable;
|
|
1087
|
+
readonly subQueryTable: (query: Query, joins: Join[], alias: string) => QueryTable;
|
|
1088
|
+
readonly join: (table: QueryTable, conditions: BooleanValueExpression, type?: JoinType) => Join;
|
|
1089
|
+
readonly value: (value: ValueType) => Literal;
|
|
1090
|
+
readonly sort: (field: Field | Fn | Identifier, direction?: SortDirection) => Sort;
|
|
1091
|
+
readonly order: (field: Field | Fn | Identifier, direction?: SortDirection) => Sort;
|
|
1092
|
+
readonly ident: (identifier: string) => Identifier;
|
|
1093
|
+
readonly id: (identifier: string) => Identifier;
|
|
1094
|
+
readonly raw: (sql: string) => RawExpression;
|
|
1095
|
+
readonly simpleWhere: (tableNameOrAlias: string, where: {
|
|
1096
|
+
[field: string]: ValueType | [ComparisonOperators, ValueType];
|
|
1097
|
+
}, isOr?: boolean) => BooleanValueExpression;
|
|
1098
|
+
readonly and: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
1099
|
+
readonly or: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
1100
|
+
readonly eq: (left: Value, right: Value) => ComparisonExpression;
|
|
1101
|
+
readonly neq: (left: Value, right: Value) => ComparisonExpression;
|
|
1102
|
+
readonly gt: (left: Value, right: Value) => ComparisonExpression;
|
|
1103
|
+
readonly gte: (left: Value, right: Value) => ComparisonExpression;
|
|
1104
|
+
readonly lt: (left: Value, right: Value) => ComparisonExpression;
|
|
1105
|
+
readonly lte: (left: Value, right: Value) => ComparisonExpression;
|
|
1106
|
+
readonly comparison: (left: Value, operator: ComparisonOperators, right: Value) => ComparisonExpression;
|
|
1107
|
+
readonly contains: (left: Value, right: string) => BooleanValueExpression;
|
|
1108
|
+
readonly notContains: (left: Value, right: string) => BooleanValueExpression;
|
|
1109
|
+
readonly startsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1110
|
+
readonly notStartsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1111
|
+
readonly endsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1112
|
+
readonly notEndsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1113
|
+
readonly in: (left: Value, right: StrOrNum[] | Query | RawExpression) => BooleanValueExpression;
|
|
1114
|
+
readonly notIn: (left: Value, values: StrOrNum[]) => InExpression;
|
|
1115
|
+
readonly between: (left: Value, begin: Value, end: Value) => BetweenExpression;
|
|
1116
|
+
readonly isNull: (expr: Value) => IsNullExpression;
|
|
1117
|
+
readonly isNotNull: (expr: Value) => IsNullExpression;
|
|
1118
|
+
readonly exists: (query: RawExpression | Query) => ExistsExpression;
|
|
1119
|
+
readonly conditions: {
|
|
1120
|
+
simpleWhere: (tableNameOrAlias: string, where: {
|
|
1121
|
+
[field: string]: ValueType | [ComparisonOperators, ValueType];
|
|
1122
|
+
}, isOr?: boolean) => BooleanValueExpression;
|
|
1123
|
+
and: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
1124
|
+
or: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
1125
|
+
eq: (left: Value, right: Value) => ComparisonExpression;
|
|
1126
|
+
neq: (left: Value, right: Value) => ComparisonExpression;
|
|
1127
|
+
gt: (left: Value, right: Value) => ComparisonExpression;
|
|
1128
|
+
gte: (left: Value, right: Value) => ComparisonExpression;
|
|
1129
|
+
lt: (left: Value, right: Value) => ComparisonExpression;
|
|
1130
|
+
lte: (left: Value, right: Value) => ComparisonExpression;
|
|
1131
|
+
comparison: (left: Value, operator: ComparisonOperators, right: Value) => ComparisonExpression;
|
|
1132
|
+
contains: (left: Value, right: string) => BooleanValueExpression;
|
|
1133
|
+
notContains: (left: Value, right: string) => BooleanValueExpression;
|
|
1134
|
+
startsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1135
|
+
notStartsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1136
|
+
endsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1137
|
+
notEndsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
1138
|
+
in: (left: Value, right: StrOrNum[] | Query | RawExpression) => BooleanValueExpression;
|
|
1139
|
+
notIn: (left: Value, values: StrOrNum[]) => InExpression;
|
|
1140
|
+
between: (left: Value, begin: Value, end: Value) => BetweenExpression;
|
|
1141
|
+
isNull: (expr: Value) => IsNullExpression;
|
|
1142
|
+
isNotNull: (expr: Value) => IsNullExpression;
|
|
1143
|
+
exists: (query: RawExpression | Query) => ExistsExpression;
|
|
1144
|
+
};
|
|
1145
|
+
};
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region src/runtime/dsl/query/sql/nodeToSql.d.ts
|
|
1148
|
+
declare const Sql: {
|
|
1149
|
+
select: (expr: SelectExpr) => string;
|
|
1150
|
+
literal: (literal: Literal) => string;
|
|
1151
|
+
fieldInCondition: (identifier: Field) => string;
|
|
1152
|
+
fieldInSelect: (identifier: Field) => string;
|
|
1153
|
+
identifier: (ident: Identifier) => string;
|
|
1154
|
+
fn: (fn: Fn) => string;
|
|
1155
|
+
value: (v: Value) => string;
|
|
1156
|
+
between: (expr: BetweenExpression) => string;
|
|
1157
|
+
contains: (expr: ContainsExpression) => string;
|
|
1158
|
+
in: (expr: InExpression) => string;
|
|
1159
|
+
comparison: (expr: ComparisonExpression) => string;
|
|
1160
|
+
compound: (expr: CompoundExpression) => string;
|
|
1161
|
+
isNull: (expr: IsNullExpression) => string;
|
|
1162
|
+
paren: (expr: ParenthesisExpression) => string;
|
|
1163
|
+
table: (table: QueryTable) => string;
|
|
1164
|
+
join: (join: Join) => string;
|
|
1165
|
+
booleanValue: (expr: BooleanValueExpression) => string;
|
|
1166
|
+
exists: (expr: ExistsExpression) => string;
|
|
1167
|
+
sort: (expr: Sort) => string;
|
|
1168
|
+
sorts: (sorts: Sort[]) => string;
|
|
1169
|
+
queryOrRaw: (expr: Query | RawExpression) => string;
|
|
1170
|
+
};
|
|
1171
|
+
//#endregion
|
|
1172
|
+
//#region src/runtime/gqlResolveInfoToField.d.ts
|
|
1173
|
+
declare const gqlResolveInfoToField: <T extends Fields<unknown> = Fields<unknown>>(info: GraphQLResolveInfo) => T;
|
|
1174
|
+
//#endregion
|
|
1175
|
+
//#region src/runtime/id.d.ts
|
|
1176
|
+
type NumberIdEncoder = {
|
|
1177
|
+
encode: (id: number) => string;
|
|
1178
|
+
decode: (id: string) => number;
|
|
1179
|
+
};
|
|
1180
|
+
declare const makeNumberIdEncoder: (hashId: Hashids) => NumberIdEncoder;
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/runtime/resolverMiddleware.d.ts
|
|
1183
|
+
type ResolverMiddleware<Context, RequiredParams = any, IncomingParams = RequiredParams> = (args: ResolverArgs<Context, IncomingParams | RequiredParams>) => ResolverArgs<Context, RequiredParams | IncomingParams>;
|
|
1184
|
+
declare const makeParamsMiddleware: <RequiredParams, IncomingParams = RequiredParams>(update: (params: RequiredParams) => IncomingParams) => ResolverMiddleware<never, RequiredParams, IncomingParams>;
|
|
1185
|
+
//#endregion
|
|
1186
|
+
//#region src/runtime/makeResolver.d.ts
|
|
1187
|
+
type ResolverArgs<Context, Params = unknown> = [_: unknown, params: Params, context: Context, info: GraphQLResolveInfo$1];
|
|
1188
|
+
type Resolver<Context, Params> = (_: unknown, params: Params, context: Context, info: GraphQLResolveInfo$1) => unknown;
|
|
1189
|
+
declare const makeResolver: <Context, RequiredParams, IncomingParams = RequiredParams>(resolver: Resolver<Context, RequiredParams>, middlewares?: ResolverMiddleware<Context, RequiredParams, IncomingParams>[]) => Resolver<Context, RequiredParams>;
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/runtime/sql/sqlString.d.ts
|
|
1192
|
+
declare const escape: typeof pkg.escape;
|
|
1193
|
+
declare const SqlString: {
|
|
1194
|
+
escape: (value: Parameters<typeof escape>[0]) => string;
|
|
1195
|
+
escapeId: (name: string) => string;
|
|
1196
|
+
};
|
|
1197
|
+
//#endregion
|
|
1198
|
+
//#region src/runtime/types.d.ts
|
|
1199
|
+
type CustomCondition<Context> = (args: MakeConditionArg<Context>) => BooleanValueExpression;
|
|
1200
|
+
//#endregion
|
|
1201
|
+
//#region src/runtime/util.d.ts
|
|
1152
1202
|
declare const pick: <T extends object>(target: T, keys: Array<keyof T>) => {
|
|
1153
|
-
|
|
1203
|
+
[k: string]: T[keyof T];
|
|
1154
1204
|
};
|
|
1155
|
-
|
|
1205
|
+
//#endregion
|
|
1206
|
+
//#region src/util/assignDeep.d.ts
|
|
1207
|
+
type Obj = {
|
|
1208
|
+
[key: string]: any;
|
|
1209
|
+
};
|
|
1210
|
+
declare const assignDeep: (base: Obj, ...objects: Obj[]) => Obj;
|
|
1211
|
+
//#endregion
|
|
1212
|
+
//#region src/util/dateUtil.d.ts
|
|
1213
|
+
declare const getCurrentDateTimeString: () => string;
|
|
1214
|
+
//#endregion
|
|
1215
|
+
//#region src/runtime/pagingOption.d.ts
|
|
1156
1216
|
type DsPagingOption = {
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1217
|
+
numberOfItem: number;
|
|
1218
|
+
where?: BooleanValueExpression;
|
|
1219
|
+
offset?: number;
|
|
1220
|
+
sort?: Sort[];
|
|
1161
1221
|
};
|
|
1162
|
-
declare const pagingOption: (option: ListQueryOption) => DsPagingOption;
|
|
1163
|
-
|
|
1222
|
+
declare const pagingOption$1: (option: ListQueryOption) => DsPagingOption;
|
|
1223
|
+
//#endregion
|
|
1224
|
+
//#region src/index.d.ts
|
|
1164
1225
|
type PagingOption = ListQueryOption;
|
|
1165
|
-
|
|
1166
|
-
export { CompositeCondition, Conditions, Mutations, QExpr, Queries, SQLClient, SQLTransaction, SasatDBDatasource, Sql, SqlString, assignDeep, createTypeDef, dateOffset, dateToDateString, dateToDatetimeString, formatQuery, getCurrentDateTimeString, getDayRange, getDayRangeQExpr, getDbClient, getTodayDateString, getTodayDateTimeString, gqlResolveInfoToField, makeNumberIdEncoder, makeParamsMiddleware, makeResolver,
|
|
1167
|
-
export type { BooleanValueExpression, CommandResponse, ComparisonOperators, CustomCondition, EntityResult, EntityType, Fields, ListQueryOption, LockMode, MigrationStore, PagingOption, Query, QueryOptions, QueryResponse, Relation, RelationMap, ResolverMiddleware, SQLExecutor, SasatMigration, TableInfo, TypeFieldDefinition };
|
|
1226
|
+
//#endregion
|
|
1227
|
+
export { type BooleanValueExpression, type CommandResponse, type ComparisonOperators, CompositeCondition, Conditions, type CustomCondition, type EntityResult, type EntityType, type Fields, type ListQueryOption, type LockMode, type MigrationStore, Mutations, MysqlClient, PagingOption, QExpr, QExpr as qe, Queries, type Query, type QueryOptions, type QueryResponse, type Relation, type RelationMap, type ResolverMiddleware, type SQLClient, type SQLExecutor, type SQLTransaction, SasatDBDatasource, type SasatMigration, Sql, SqlString, type TableInfo, type TypeFieldDefinition, assignDeep, createTypeDef, dateOffset, dateToDateString, dateToDatetimeString, formatQuery, getCurrentDateTimeString, getDayRange, getDayRangeQExpr, getDbClient, getTodayDateString, getTodayDateTimeString, gqlResolveInfoToField, makeNumberIdEncoder, makeParamsMiddleware, makeResolver, migrate, pagingOption$1 as pagingOption, pick, queryToSql, setConfig };
|