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/index.d.mts CHANGED
@@ -1,1146 +1,1071 @@
1
- import pkg from 'sqlstring';
2
- import { GraphQLResolveInfo } from 'graphql/type';
3
- import Hashids from 'hashids';
4
- import { NestedPartial as NestedPartial$1 } from 'util/type';
5
- import { GraphQLResolveInfo as GraphQLResolveInfo$1 } from 'graphql';
6
- import * as mysql2 from 'mysql2';
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
- type ComparisonOperators = '=' | '>' | '<' | '>=' | '<=' | '<>';
9
- type AndOr = 'AND' | 'OR';
10
- type ComparisonExpression$1<T> = Partial<{
11
- [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'];
12
- }> & {
13
- __type?: AndOr;
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
- Field = 0,
18
- Function = 1,
19
- Table = 2,
20
- Join = 3,
21
- CompoundExpr = 4,
22
- ComparisonExpr = 5,
23
- IsNullExpr = 6,
24
- Parenthesis = 7,
25
- InExpr = 8,
26
- BetweenExpr = 9,
27
- ContainsExpr = 10,
28
- Literal = 11,
29
- Sort = 12,
30
- Identifier = 13,
31
- Exists = 14,
32
- Raw = 15,
33
- GroupBy = 16,
34
- Over = 17,
35
- Window = 18
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 = 'FOR UPDATE' | 'FOR SHARE';
127
+ type LockMode = "FOR UPDATE" | "FOR SHARE";
38
128
  type Query = {
39
- select: SelectExpr[];
40
- from: QueryTable;
41
- where?: BooleanValueExpression;
42
- groupBy?: GroupByExpr;
43
- having?: BooleanValueExpression;
44
- sort?: Sort[];
45
- limit?: number;
46
- offset?: number;
47
- lock?: LockMode;
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
- kind: QueryNodeKind.GroupBy;
51
- cols: (Field | Identifier)[];
140
+ kind: QueryNodeKind.GroupBy;
141
+ cols: (Field | Identifier)[];
52
142
  };
53
143
  type Field = {
54
- kind: QueryNodeKind.Field;
55
- table: string;
56
- name: string;
57
- alias?: string;
144
+ kind: QueryNodeKind.Field;
145
+ table: string;
146
+ name: string;
147
+ alias?: string;
58
148
  };
59
149
  type Fn = {
60
- kind: QueryNodeKind.Function;
61
- fnName: string;
62
- args: Value[];
63
- over?: Over;
64
- alias?: string;
150
+ kind: QueryNodeKind.Function;
151
+ fnName: string;
152
+ args: Value[];
153
+ over?: Over;
154
+ alias?: string;
65
155
  };
66
156
  type Over = {
67
- kind: QueryNodeKind.Over;
68
- orderBy?: Sort[];
69
- partitionBy?: Identifier[];
70
- window?: Window;
157
+ kind: QueryNodeKind.Over;
158
+ orderBy?: Sort[];
159
+ partitionBy?: Identifier[];
160
+ window?: Window;
71
161
  };
72
162
  type Window = {
73
- kind: QueryNodeKind.Window;
74
- type: 'ROWS' | 'RANGE';
75
- between: true;
76
- start: WindowContent;
77
- end: WindowContent;
163
+ kind: QueryNodeKind.Window;
164
+ type: "ROWS" | "RANGE";
165
+ between: true;
166
+ start: WindowContent;
167
+ end: WindowContent;
78
168
  } | {
79
- kind: QueryNodeKind.Window;
80
- type: 'ROWS' | 'RANGE';
81
- between: false;
82
- value: WindowContent;
169
+ kind: QueryNodeKind.Window;
170
+ type: "ROWS" | "RANGE";
171
+ between: false;
172
+ value: WindowContent;
83
173
  };
84
- type WINDOW_TYPES_NO_ARG = 'UNBOUNDED PRECEDING' | 'UNBOUNDED FOLLOWING' | 'CURRENT ROW';
85
- type WINDOW_TYPES_ARG = 'PRECEDING' | 'FOLLOWING';
174
+ type WINDOW_TYPES_NO_ARG = "UNBOUNDED PRECEDING" | "UNBOUNDED FOLLOWING" | "CURRENT ROW";
175
+ type WINDOW_TYPES_ARG = "PRECEDING" | "FOLLOWING";
86
176
  type WindowContent = {
87
- type: WINDOW_TYPES_NO_ARG;
177
+ type: WINDOW_TYPES_NO_ARG;
88
178
  } | {
89
- type: WINDOW_TYPES_ARG;
90
- value: number;
179
+ type: WINDOW_TYPES_ARG;
180
+ value: number;
91
181
  };
92
182
  type SelectExpr = Field | Fn | Identifier | RawExpression;
93
183
  type QueryTable = {
94
- kind: QueryNodeKind.Table;
95
- alias: string;
96
- joins: Join[];
184
+ kind: QueryNodeKind.Table;
185
+ alias: string;
186
+ joins: Join[];
97
187
  } & ({
98
- subquery?: false;
99
- name: string;
188
+ subquery?: false;
189
+ name: string;
100
190
  } | {
101
- subquery: true;
102
- query: Query;
191
+ subquery: true;
192
+ query: Query;
103
193
  });
104
- type JoinType = 'INNER' | 'LEFT' | 'RIGHT' | 'OUTER';
194
+ type JoinType = "INNER" | "LEFT" | "RIGHT" | "OUTER";
105
195
  type Join = {
106
- kind: QueryNodeKind.Join;
107
- type?: JoinType;
108
- table: QueryTable;
109
- conditions: BooleanValueExpression;
196
+ kind: QueryNodeKind.Join;
197
+ type?: JoinType;
198
+ table: QueryTable;
199
+ conditions: BooleanValueExpression;
110
200
  };
111
201
  type ParenthesisExpression = {
112
- kind: QueryNodeKind.Parenthesis;
113
- expression: BooleanValueExpression;
202
+ kind: QueryNodeKind.Parenthesis;
203
+ expression: BooleanValueExpression;
114
204
  };
115
205
  type RawExpression = {
116
- kind: QueryNodeKind.Raw;
117
- expr: string;
206
+ kind: QueryNodeKind.Raw;
207
+ expr: string;
118
208
  };
119
209
  type ExistsExpression = {
120
- kind: QueryNodeKind.Exists;
121
- query: Query | RawExpression;
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
- kind: QueryNodeKind.IsNullExpr;
126
- expr: Value;
127
- isNot: boolean;
215
+ kind: QueryNodeKind.IsNullExpr;
216
+ expr: Value;
217
+ isNot: boolean;
128
218
  };
129
- type CompoundOperator = 'AND' | 'OR';
219
+ type CompoundOperator = "AND" | "OR";
130
220
  type CompoundExpression = {
131
- kind: QueryNodeKind.CompoundExpr;
132
- left: BooleanValueExpression;
133
- operator: CompoundOperator;
134
- right: BooleanValueExpression;
221
+ kind: QueryNodeKind.CompoundExpr;
222
+ left: BooleanValueExpression;
223
+ operator: CompoundOperator;
224
+ right: BooleanValueExpression;
135
225
  };
136
226
  type ComparisonExpression = {
137
- kind: QueryNodeKind.ComparisonExpr;
138
- left: Value;
139
- operator: ComparisonOperators;
140
- right: Value;
227
+ kind: QueryNodeKind.ComparisonExpr;
228
+ left: Value;
229
+ operator: ComparisonOperators;
230
+ right: Value;
141
231
  };
142
- type ContainType = 'start' | 'end' | 'contains';
232
+ type ContainType = "start" | "end" | "contains";
143
233
  type ContainsExpression = {
144
- kind: QueryNodeKind.ContainsExpr;
145
- type: ContainType;
146
- left: Value;
147
- isNot: boolean;
148
- right: string;
234
+ kind: QueryNodeKind.ContainsExpr;
235
+ type: ContainType;
236
+ left: Value;
237
+ isNot: boolean;
238
+ right: string;
149
239
  };
150
240
  type InExpression = {
151
- kind: QueryNodeKind.InExpr;
152
- left: Value;
153
- operator: 'IN' | 'NOT IN';
241
+ kind: QueryNodeKind.InExpr;
242
+ left: Value;
243
+ operator: "IN" | "NOT IN";
154
244
  } & ({
155
- query: Query | RawExpression;
245
+ query: Query | RawExpression;
156
246
  } | {
157
- right: Value[];
247
+ right: Value[];
158
248
  });
159
249
  type BetweenExpression = {
160
- kind: QueryNodeKind.BetweenExpr;
161
- left: Value;
162
- begin: Value;
163
- end: Value;
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
- kind: QueryNodeKind.Identifier;
168
- identifier: string;
257
+ kind: QueryNodeKind.Identifier;
258
+ identifier: string;
169
259
  };
170
260
  type Literal = {
171
- kind: QueryNodeKind.Literal;
172
- value: string | boolean | number | null;
261
+ kind: QueryNodeKind.Literal;
262
+ value: string | boolean | number | null;
173
263
  };
174
- type SortDirection = 'ASC' | 'DESC';
264
+ type SortDirection = "ASC" | "DESC";
175
265
  type Sort = {
176
- kind: QueryNodeKind.Sort;
177
- field: Field | Fn | Identifier;
178
- direction?: SortDirection;
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
- type NestedPartial<T> = {
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
- fields: Array<keyof Entity & string>;
254
- relations?: Relation;
255
- tableAlias?: string;
256
- joinOn?: BooleanValueExpression;
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
- childTableAlias: string;
261
- context?: Context;
284
+ childTableAlias: string;
285
+ context?: Context;
262
286
  } & ({
263
- parentTableAlias: string;
264
- parent?: undefined;
287
+ parentTableAlias: string;
288
+ parent?: undefined;
265
289
  } | {
266
- parent: Partial<Entity>;
267
- parentTableAlias?: undefined;
290
+ parent: Partial<Entity>;
291
+ parentTableAlias?: undefined;
268
292
  });
269
- type MakeCondition<Context, Entity = any> = (arg: MakeConditionArg<Context, Entity>) => BooleanValueExpression;
293
+ type MakeCondition<Context, Entity = unknown> = (arg: MakeConditionArg<Context, Entity>) => BooleanValueExpression;
270
294
  type RelationInfo<Context = unknown> = {
271
- table: string;
272
- condition: MakeCondition<Context>;
273
- array: boolean;
274
- nullable: boolean;
275
- requiredColumns: string[];
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
- [from: string]: {
279
- [to: string]: RelationInfo<Context>;
280
- };
302
+ [from: string]: {
303
+ [to: string]: RelationInfo<Context>;
304
+ };
281
305
  };
282
306
  type TableInfo = {
283
- [tableName: string]: {
284
- identifiableKeys: string[];
285
- identifiableFields: string[];
286
- columnMap: {
287
- [fieldName: string]: string;
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
- numberOfItem: number;
294
- where?: BooleanValueExpression;
295
- offset?: number;
296
- sort?: Sort[];
297
- join?: Join[];
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
- create(entity: Creatable): Promise<Entity>;
304
- update(entity: Updatable): Promise<CommandResponse>;
305
- delete(entity: Identifiable): Promise<CommandResponse>;
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
- numberOfItem: number;
309
- offset?: number;
310
- order?: string;
311
- asc?: boolean;
312
- join?: Join[];
334
+ numberOfItem: number;
335
+ offset?: number;
336
+ order?: string;
337
+ asc?: boolean;
338
+ join?: Join[];
313
339
  };
314
340
  type QueryOptions = {
315
- where?: BooleanValueExpression;
316
- sort?: Sort[];
317
- limit?: number;
318
- offset?: number;
319
- lock?: LockMode;
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
- protected client: SQLExecutor;
323
- protected abstract relationMap: RelationMap<any>;
324
- protected abstract tableInfo: TableInfo;
325
- abstract readonly tableName: string;
326
- abstract readonly fields: string[];
327
- protected abstract readonly primaryKeys: string[];
328
- protected abstract readonly identifyFields: string[];
329
- protected abstract readonly autoIncrementColumn?: string | undefined;
330
- protected queryLogger: (sql: string) => void;
331
- protected commandLogger: (sql: string) => void;
332
- constructor(client?: SQLExecutor);
333
- protected abstract getDefaultValueString(): Partial<{
334
- [P in keyof Entity]: Entity[P] | string | null | never;
335
- }> | never;
336
- create(entity: Creatable, option?: {
337
- ignore?: boolean;
338
- upsert?: {
339
- updateColumns: string[];
340
- };
341
- }): Promise<Entity>;
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
- protected fieldToColumn(fields: string[]): string[];
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
- declare const Sql: {
365
- select: (expr: SelectExpr) => string;
366
- literal: (literal: Literal) => string;
367
- fieldInCondition: (identifier: Field) => string;
368
- fieldInSelect: (identifier: Field) => string;
369
- identifier: (ident: Identifier) => string;
370
- fn: (fn: Fn) => string;
371
- value: (v: Value) => string;
372
- between: (expr: BetweenExpression) => string;
373
- contains: (expr: ContainsExpression) => string;
374
- in: (expr: InExpression) => string;
375
- comparison: (expr: ComparisonExpression) => string;
376
- compound: (expr: CompoundExpression) => string;
377
- isNull: (expr: IsNullExpression) => string;
378
- paren: (expr: ParenthesisExpression) => string;
379
- table: (table: QueryTable) => string;
380
- join: (join: Join) => string;
381
- booleanValue: (expr: BooleanValueExpression) => string;
382
- exists: (expr: ExistsExpression) => string;
383
- sort: (expr: Sort) => string;
384
- sorts: (sorts: Sort[]) => string;
385
- queryOrRaw: (expr: Query | RawExpression) => string;
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
- declare const makeNumberIdEncoder: (hashId: Hashids) => NumberIdEncoder;
411
-
412
- type CustomCondition<Context> = (args: MakeConditionArg<Context>) => BooleanValueExpression;
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
- kind: 'context';
416
- field: string;
417
- onNotDefined: OnNotDefinedAction;
443
+ kind: "context";
444
+ field: string;
445
+ onNotDefined: OnNotDefinedAction;
418
446
  };
419
447
  type FixedConditionValue = {
420
- kind: 'fixed';
421
- value: string | number;
448
+ kind: "fixed";
449
+ value: string | number;
422
450
  };
423
451
  type TodayStartConditionValue = {
424
- kind: 'today';
425
- type: 'date' | 'datetime';
426
- thresholdHour?: number;
452
+ kind: "today";
453
+ type: "date" | "datetime";
454
+ thresholdHour?: number;
427
455
  };
428
456
  type NowConditionValue = {
429
- kind: 'now';
457
+ kind: "now";
430
458
  };
431
459
  type OnNotDefinedAction = {
432
- action: 'error';
433
- message: string;
460
+ action: "error";
461
+ message: string;
434
462
  } | {
435
- action: 'defaultValue';
436
- value: string | number;
463
+ action: "defaultValue";
464
+ value: string | number;
437
465
  };
438
466
  type ConditionValue = ContextConditionValue | FixedConditionValue | TodayStartConditionValue | NowConditionValue;
439
-
440
- type QueryConditionValue = ConditionValue | FieldQueryConditionValue | ArgQueryConditionValue;
441
- type FieldQueryConditionValue = {
442
- kind: 'field';
443
- column: string;
444
- };
445
- type ArgQueryConditionValue = {
446
- kind: 'arg';
447
- name: string;
448
- type: 'Int' | 'Float' | 'String' | string;
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 QueryConditionNode = {
451
- kind: 'comparison';
452
- left: QueryConditionValue;
453
- operator: ComparisonOperators;
454
- right: QueryConditionValue;
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
- kind: 'between';
457
- left: QueryConditionValue;
458
- operator: 'BETWEEN';
459
- begin: QueryConditionValue;
460
- end: QueryConditionValue;
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
- declare enum DBColumnTypes {
464
- char = "char",
465
- varchar = "varchar",
466
- text = "text",
467
- tinyInt = "tinyint",
468
- smallInt = "smallint",
469
- mediumInt = "mediumint",
470
- int = "int",
471
- bigInt = "bigint",
472
- float = "float",
473
- double = "double",
474
- decimal = "decimal",
475
- year = "year",
476
- date = "date",
477
- time = "time",
478
- dateTime = "datetime",
479
- timestamp = "timestamp",
480
- boolean = "boolean"
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
- updatable: boolean;
500
- autoIncrementHashId: boolean;
501
- hashSalt?: string;
529
+ updatable: boolean;
530
+ autoIncrementHashId: boolean;
531
+ hashSalt?: string;
502
532
  };
503
533
  interface SerializedColumnBase {
504
- hasReference: boolean;
505
- fieldName: string;
506
- columnName: string;
507
- type: DBColumnTypes;
508
- notNull: boolean;
509
- default: SqlValueType | undefined;
510
- zerofill: boolean;
511
- signed: boolean | undefined;
512
- autoIncrement: boolean;
513
- length: number | undefined;
514
- scale: number | undefined;
515
- defaultCurrentTimeStamp: boolean;
516
- onUpdateCurrentTimeStamp: boolean;
517
- option: ColumnOptions;
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
- hasReference: false;
550
+ hasReference: false;
521
551
  }
522
552
  interface Reference {
523
- parentTable: string;
524
- parentColumn: string;
525
- columnName: string;
526
- relation: Relation;
527
- parentFieldName?: string;
528
- fieldName?: string;
529
- relationName?: string;
530
- onUpdate?: ForeignKeyReferentialAction;
531
- onDelete?: ForeignKeyReferentialAction;
532
- noFKey?: boolean;
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
- hasReference: true;
536
- reference: Reference;
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
- constraintName: string;
542
- columns: string[];
599
+ constraintName: string;
600
+ columns: string[];
543
601
  }
544
602
  declare class DBIndex implements Index, Serializable<Index> {
545
- readonly tableName: string;
546
- readonly columns: string[];
547
- readonly constraintName: string;
548
- constructor(tableName: string, columns: string[]);
549
- private toConstraintName;
550
- addSql(): string;
551
- dropSql(): string;
552
- serialize(): Index;
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
- type JoinConditionValue = {
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
- columns: SerializedColumn[];
608
- primaryKey: string[];
609
- uniqueKeys: string[][];
610
- indexes: Index[];
611
- tableName: string;
612
- gqlOption: GQLOption;
613
- virtualRelations: VirtualRelation[];
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
- type GQLPrimitive = 'Int' | 'Float' | 'String' | 'Boolean' | 'ID';
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
- fieldName(): string;
620
- columnName(): string;
621
- dataType(): DBColumnTypes;
622
- toSql(): string;
623
- isReference(): this is ReferenceColumn;
624
- isNullable(): boolean;
625
- tsType(): string;
626
- gqlType(): GQLPrimitive;
627
- isNullableOnCreate(): boolean;
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
- data: SerializedColumn;
631
- table: Table;
632
- constructor(data: SerializedColumn, table: Table);
633
- fieldName(): string;
634
- columnName(): string;
635
- dataType(): DBColumnTypes;
636
- tsType(): string;
637
- gqlType(): GQLPrimitive;
638
- isNullable(): boolean;
639
- isNullableOnCreate(): boolean;
640
- isReference(): this is ReferenceColumn;
641
- serialize(): SerializedColumn;
642
- toSql(): string;
643
- isPrimary(): boolean;
644
- isUpdatable(): boolean;
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
- data: SerializedReferenceColumn;
648
- constructor(data: SerializedReferenceColumn, table: Table);
649
- getConstraintName(): string;
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
- declare class TableHandler implements Table {
680
- store: DataStore;
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
- table(tableName: string): Table;
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
- column: string;
723
- contextName?: string;
735
+ column: string;
736
+ contextName?: string;
724
737
  }
725
738
  type GQLMutation = {
726
- type: 'create' | 'update' | 'delete';
727
- noReFetch: boolean;
728
- middlewares: string[];
729
- contextFields: GqlFromContextParam[];
730
- subscription: {
731
- enabled: boolean;
732
- subscriptionFilter: string[];
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
- type: 'single' | 'list-all' | 'list-paging';
737
- name: string;
738
- conditions: QueryConditionNode[];
739
- middlewares: string[];
749
+ type: "single" | "list-all" | "list-paging";
750
+ name: string;
751
+ conditions: QueryConditionNode[];
752
+ middlewares: string[];
740
753
  } | {
741
- type: 'primary';
742
- name?: never;
743
- conditions: never[];
744
- middlewares: string[];
754
+ type: "primary";
755
+ name?: never;
756
+ conditions: never[];
757
+ middlewares: string[];
745
758
  };
746
759
  interface GQLOption {
747
- enabled: boolean;
748
- queries: GQLQuery[];
749
- mutations: GQLMutation[];
760
+ enabled: boolean;
761
+ queries: GQLQuery[];
762
+ mutations: GQLMutation[];
750
763
  }
751
-
752
- declare const Queries: {
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
- readonly columnName: string;
817
- protected _primary: boolean;
818
- protected _notNull: boolean;
819
- protected _unique: boolean;
820
- protected _option: ColumnOptions;
821
- protected _fieldName: string;
822
- protected constructor(columnName: string);
823
- fieldName(fieldName: string): this;
824
- notNull(): this;
825
- nullable(): this;
826
- primary(): this;
827
- unique(): this;
828
- updatable(updatable: boolean): this;
829
- abstract build(): {
830
- data: SerializedColumn;
831
- isPrimary: boolean;
832
- isUnique: boolean;
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
- protected type: DBColumnTypes;
837
- protected length?: number | undefined;
838
- protected scale?: number | undefined;
839
- protected _zerofill: boolean;
840
- protected _signed: boolean | undefined;
841
- protected _autoIncrement: boolean;
842
- protected _default: SqlValueType | undefined;
843
- protected _defaultCurrentTimeStamp: boolean;
844
- protected _onUpdateCurrentTimeStamp: boolean;
845
- protected constructor(name: string, type: DBColumnTypes, length?: number | undefined, scale?: number | undefined);
846
- default(value: SqlValueType | undefined): this;
847
- build(): {
848
- data: SerializedNormalColumn;
849
- isPrimary: boolean;
850
- isUnique: boolean;
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
- readonly name: string;
855
- protected type: DBStringTypes;
856
- protected length?: number | undefined;
857
- constructor(name: string, type: DBStringTypes, length?: number | undefined);
858
- default(value: string | null | undefined): this;
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
- readonly name: string;
862
- protected type: DBTextTypes;
863
- constructor(name: string, type: DBTextTypes);
864
- default(value: string | null | undefined): this;
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
- constructor(name: string, type: DBNumberTypes, length?: number, scale?: number);
868
- signed(): this;
869
- unsigned(): this;
870
- zerofill(): this;
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
- readonly name: string;
875
- protected type: DBIntegerTypes;
876
- protected length?: number | undefined;
877
- constructor(name: string, type: DBIntegerTypes, length?: number | undefined);
878
- autoIncrement(): this;
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
- readonly name: string;
882
- protected type: DBFloatingTypes;
883
- protected length?: number | undefined;
884
- protected scale?: number | undefined;
885
- constructor(name: string, type: DBFloatingTypes, length?: number | undefined, scale?: number | undefined);
886
- autoIncrement(): this;
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
- readonly name: string;
890
- protected type: DBColumnTypes.decimal;
891
- protected length?: number | undefined;
892
- protected scale?: number | undefined;
893
- constructor(name: string, type: DBColumnTypes.decimal, length?: number | undefined, scale?: number | undefined);
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
- readonly name: string;
897
- protected type: DBDateTypes;
898
- constructor(name: string, type: DBDateTypes);
899
- default(value: string | number | null | undefined): this;
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
- readonly name: string;
903
- protected type: DBColumnTypes.timestamp | DBColumnTypes.dateTime;
904
- constructor(name: string, type: DBColumnTypes.timestamp | DBColumnTypes.dateTime);
905
- default(value: 'CURRENT_TIMESTAMP' | string | null | undefined): this;
906
- defaultCurrentTimeStamp(): this;
907
- onUpdateCurrentTimeStamp(): this;
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
- protected readonly ref: Reference;
911
- protected readonly parent: Column;
912
- constructor(ref: Reference, parent: Column);
913
- notNull(): this;
914
- nullable(): this;
915
- primary(): this;
916
- unique(): this;
917
- build(): {
918
- data: SerializedReferenceColumn;
919
- isPrimary: boolean;
920
- isUnique: boolean;
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
- private table;
960
- private name;
961
- constructor(table: TableCreator, name: string);
962
- char: (length: number) => StringColumnBuilder;
963
- varchar: (length: number) => StringColumnBuilder;
964
- text: () => TextColumnBuilder;
965
- tinyInt: (length?: number) => IntegerColumnBuilder;
966
- smallInt: (length?: number) => IntegerColumnBuilder;
967
- mediumInt: (length?: number) => IntegerColumnBuilder;
968
- int: (length?: number) => IntegerColumnBuilder;
969
- bigInt: (length?: number) => IntegerColumnBuilder;
970
- float: (length?: number, scale?: number) => FloatColumnBuilder;
971
- double: (length?: number, scale?: number) => FloatColumnBuilder;
972
- decimal: (length?: number, scale?: number) => DecimalColumnBuilder;
973
- year: () => DateColumnBuilder;
974
- date: () => DateColumnBuilder;
975
- time: () => DateColumnBuilder;
976
- dateTime: () => TimeStampColumnBuilder;
977
- timestamp: () => TimeStampColumnBuilder;
978
- private create;
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
- autoIncrementHashId(columnName: string, option?: {
983
- salt?: string;
984
- bigint?: boolean;
985
- }): TableBuilder;
986
- column(columnName: string): ColumnCreator;
987
- addVirtualRelation(relation: Omit<VirtualRelation, 'childTable'>): TableBuilder;
988
- references(reference: Reference, notNull?: boolean): ColumnBuilderBase;
989
- setPrimaryKey(...columnNames: string[]): TableBuilder;
990
- addUniqueKey(...columnNames: string[]): TableBuilder;
991
- createdAt(): TableBuilder;
992
- updatedAt(): TableBuilder;
993
- addIndex(...columns: string[]): TableBuilder;
994
- enableGQL(): TableBuilder;
995
- setGQLOption(option: Partial<GQLOption>): TableBuilder;
996
- addGQLQuery(...query: GQLQuery[]): TableBuilder;
997
- addGQLMutation(...mutation: GQLMutation[]): TableBuilder;
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
- tableName: string;
1001
- protected readonly store: DataStore;
1002
- private readonly table;
1003
- private readonly columns;
1004
- constructor(tableName: string, store: DataStore);
1005
- autoIncrementHashId(columnName: string, option?: {
1006
- salt?: string;
1007
- bigint?: boolean;
1008
- }): TableBuilder;
1009
- column(name: string): ColumnCreator;
1010
- addVirtualRelation(relation: Omit<VirtualRelation, 'childTable'>): this;
1011
- addColumn(column: ColumnBuilderBase): void;
1012
- addUniqueKey(...columnNames: string[]): TableBuilder;
1013
- references(ref: Reference): ReferenceColumnBuilder;
1014
- setPrimaryKey(...columnNames: string[]): TableBuilder;
1015
- create(): TableHandler;
1016
- createdAt(): TableBuilder;
1017
- updatedAt(): TableBuilder;
1018
- addIndex(...columns: string[]): TableBuilder;
1019
- enableGQL(): TableBuilder;
1020
- setGQLOption(option: Partial<GQLOption>): TableBuilder;
1021
- addGQLQuery(...query: GQLQuery[]): TableBuilder;
1022
- addGQLMutation(...mutation: GQLMutation[]): TableBuilder;
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
- createTable(tableName: string, tableCreator: (table: TableBuilder) => void): MigrationStore;
1027
- dropTable(tableName: string): MigrationStore;
1028
- table(tableName: string): MigrationTable;
1029
- sql(...sql: string[]): MigrationStore;
1030
- setConfig(config: NestedPartial$1<SasatConfig>): MigrationStore;
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
- type TypeFieldDefinition = {
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
- up: (store: MigrationStore) => void | Promise<void>;
1043
- down: (store: MigrationStore) => void | Promise<void>;
1044
- beforeUp?: () => void | Promise<void>;
1045
- afterUp?: () => void | Promise<void>;
1046
- beforeDown?: () => void | Promise<void>;
1047
- afterDown?: () => void | Promise<void>;
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
- type StrOrNum = string | number;
1051
- type ValueType = string | boolean | number | null;
1052
- declare const QExpr: {
1053
- readonly field: (table: string, name: string, alias?: string) => Field;
1054
- readonly fn: (fnName: string, args: Value[], alias?: string) => Fn;
1055
- readonly window: (type: 'ROWS' | 'RANGE', value: WindowContent) => Window;
1056
- readonly windowBetween: (type: 'ROWS' | 'RANGE', start: WindowContent, end: WindowContent) => Window;
1057
- readonly paren: (expression: BooleanValueExpression) => ParenthesisExpression;
1058
- readonly table: (name: string, joins: Join[], alias: string) => QueryTable;
1059
- readonly subQueryTable: (query: Query, joins: Join[], alias: string) => QueryTable;
1060
- readonly join: (table: QueryTable, conditions: BooleanValueExpression, type?: JoinType) => Join;
1061
- readonly value: (value: ValueType) => Literal;
1062
- readonly sort: (field: Field | Fn | Identifier, direction?: SortDirection) => Sort;
1063
- readonly order: (field: Field | Fn | Identifier, direction?: SortDirection) => Sort;
1064
- readonly ident: (identifier: string) => Identifier;
1065
- readonly id: (identifier: string) => Identifier;
1066
- readonly raw: (sql: string) => RawExpression;
1067
- readonly simpleWhere: (tableNameOrAlias: string, where: {
1068
- [field: string]: ValueType | [ComparisonOperators, ValueType];
1069
- }, isOr?: boolean) => BooleanValueExpression;
1070
- readonly and: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
1071
- readonly or: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
1072
- readonly eq: (left: Value, right: Value) => ComparisonExpression;
1073
- readonly neq: (left: Value, right: Value) => ComparisonExpression;
1074
- readonly gt: (left: Value, right: Value) => ComparisonExpression;
1075
- readonly gte: (left: Value, right: Value) => ComparisonExpression;
1076
- readonly lt: (left: Value, right: Value) => ComparisonExpression;
1077
- readonly lte: (left: Value, right: Value) => ComparisonExpression;
1078
- readonly comparison: (left: Value, operator: ComparisonOperators, right: Value) => ComparisonExpression;
1079
- readonly contains: (left: Value, right: string) => BooleanValueExpression;
1080
- readonly notContains: (left: Value, right: string) => BooleanValueExpression;
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
- declare const gqlResolveInfoToField: <T extends Fields<any> = Fields<unknown>>(info: GraphQLResolveInfo$1) => T;
1120
-
1121
- declare const getCurrentDateTimeString: () => string;
1122
-
1123
- declare const getDbClient: (connectionOption?: Partial<mysql2.ConnectionOptions> | undefined, poolOption?: Partial<mysql2.PoolOptions> | undefined, logger?: ((query: string) => void) | undefined) => DBClient;
1124
-
1125
- type Obj = {
1126
- [key: string]: any;
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 assignDeep: (base: Obj, ...objects: Obj[]) => Obj;
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
- type ConditionExpression<T> = ComparisonExpression$1<T> | CompositeCondition<T>;
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
- [k: string]: T[keyof T];
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
- numberOfItem: number;
1158
- where?: BooleanValueExpression;
1159
- offset?: number;
1160
- sort?: Sort[];
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, pagingOption, pick, QExpr as qe, queryToSql, setConfig };
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 };