sasat 0.22.7 → 0.22.9
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 +24 -3
- package/dist/cli/index.mjs +25 -4
- package/dist/comparison-Bkk-qNRi.d.cts +79 -0
- package/dist/comparison-HpKmxsjs.d.mts +79 -0
- package/dist/index-1a8KLRT7.d.mts +495 -0
- package/dist/index-lrk3IfPF.d.cts +495 -0
- package/dist/index.cjs +22 -825
- package/dist/index.d.cts +3 -495
- package/dist/index.d.mts +3 -495
- package/dist/index.mjs +2 -804
- package/dist/{migrate-DnqBdQ6r.mjs → migrate-D-XR7Z0F.mjs} +93 -71
- package/dist/{migrate-BDE07ocG.cjs → migrate-iJE4FjRh.cjs} +96 -68
- package/dist/migration/index.cjs +1 -1
- package/dist/migration/index.d.cts +2 -2
- package/dist/migration/index.d.mts +2 -2
- package/dist/migration/index.mjs +1 -1
- package/dist/src-CdwAbJV0.cjs +926 -0
- package/dist/src-DebKrtYl.mjs +806 -0
- package/dist/testing/index.cjs +70 -1
- package/dist/testing/index.d.cts +19 -2
- package/dist/testing/index.d.mts +19 -2
- package/dist/testing/index.mjs +69 -2
- package/package.json +1 -1
- package/dist/comparison-BpTtc1iD.d.mts +0 -42
- package/dist/comparison-CIb9xu5T.d.cts +0 -42
- package/dist/dbClient-2mFJTQw7.d.mts +0 -35
- package/dist/dbClient-Bnk1JKBU.d.cts +0 -35
- /package/dist/{makeCondition-3MdYUm5k.mjs → makeCondition-BQj-Av95.mjs} +0 -0
- /package/dist/{makeCondition-DKSyAkri.cjs → makeCondition-DljWZv_v.cjs} +0 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { a as QueryResponse, c as SQLTransaction, i as DBClient, l as SqlValueType, n as ComparisonOperators, r as CommandResponse, s as SQLExecutor, t as ComparisonExpression$1 } from "./comparison-Bkk-qNRi.cjs";
|
|
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
|
+
import pkg from "sqlstring";
|
|
8
|
+
|
|
9
|
+
//#region src/db/connectors/mysql/client.d.ts
|
|
10
|
+
declare class MysqlClient extends DBClient {
|
|
11
|
+
readonly connectionOption: ConnectionOptions;
|
|
12
|
+
release(): Promise<void>;
|
|
13
|
+
constructor(connectionOption: ConnectionOptions, logger?: (query: string) => void);
|
|
14
|
+
protected getConnection(): Promise<_$mysql2_promise0.Connection>;
|
|
15
|
+
transaction(): Promise<SQLTransaction>;
|
|
16
|
+
protected execSql(sql: string): Promise<QueryResponse | CommandResponse>;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/db/formatQuery.d.ts
|
|
20
|
+
declare const formatQuery: (str: TemplateStringsArray, ...params: any[]) => string;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/runtime/dsl/query/query.d.ts
|
|
23
|
+
declare enum QueryNodeKind {
|
|
24
|
+
Field = 0,
|
|
25
|
+
Function = 1,
|
|
26
|
+
Table = 2,
|
|
27
|
+
Join = 3,
|
|
28
|
+
CompoundExpr = 4,
|
|
29
|
+
ComparisonExpr = 5,
|
|
30
|
+
IsNullExpr = 6,
|
|
31
|
+
Parenthesis = 7,
|
|
32
|
+
InExpr = 8,
|
|
33
|
+
BetweenExpr = 9,
|
|
34
|
+
ContainsExpr = 10,
|
|
35
|
+
Literal = 11,
|
|
36
|
+
Sort = 12,
|
|
37
|
+
Identifier = 13,
|
|
38
|
+
Exists = 14,
|
|
39
|
+
Raw = 15,
|
|
40
|
+
GroupBy = 16,
|
|
41
|
+
Over = 17,
|
|
42
|
+
Window = 18
|
|
43
|
+
}
|
|
44
|
+
type LockMode = "FOR UPDATE" | "FOR SHARE";
|
|
45
|
+
type Query = {
|
|
46
|
+
select: SelectExpr[];
|
|
47
|
+
from: QueryTable;
|
|
48
|
+
where?: BooleanValueExpression;
|
|
49
|
+
groupBy?: GroupByExpr;
|
|
50
|
+
having?: BooleanValueExpression;
|
|
51
|
+
sort?: Sort[];
|
|
52
|
+
limit?: number;
|
|
53
|
+
offset?: number;
|
|
54
|
+
lock?: LockMode;
|
|
55
|
+
join?: Join[];
|
|
56
|
+
};
|
|
57
|
+
type GroupByExpr = {
|
|
58
|
+
kind: QueryNodeKind.GroupBy;
|
|
59
|
+
cols: (Field | Identifier)[];
|
|
60
|
+
};
|
|
61
|
+
type Field = {
|
|
62
|
+
kind: QueryNodeKind.Field;
|
|
63
|
+
table: string;
|
|
64
|
+
name: string;
|
|
65
|
+
alias?: string;
|
|
66
|
+
};
|
|
67
|
+
type Fn = {
|
|
68
|
+
kind: QueryNodeKind.Function;
|
|
69
|
+
fnName: string;
|
|
70
|
+
args: Value[];
|
|
71
|
+
over?: Over;
|
|
72
|
+
alias?: string;
|
|
73
|
+
};
|
|
74
|
+
type Over = {
|
|
75
|
+
kind: QueryNodeKind.Over;
|
|
76
|
+
orderBy?: Sort[];
|
|
77
|
+
partitionBy?: Identifier[];
|
|
78
|
+
window?: Window;
|
|
79
|
+
};
|
|
80
|
+
type Window = {
|
|
81
|
+
kind: QueryNodeKind.Window;
|
|
82
|
+
type: "ROWS" | "RANGE";
|
|
83
|
+
between: true;
|
|
84
|
+
start: WindowContent;
|
|
85
|
+
end: WindowContent;
|
|
86
|
+
} | {
|
|
87
|
+
kind: QueryNodeKind.Window;
|
|
88
|
+
type: "ROWS" | "RANGE";
|
|
89
|
+
between: false;
|
|
90
|
+
value: WindowContent;
|
|
91
|
+
};
|
|
92
|
+
type WINDOW_TYPES_NO_ARG = "UNBOUNDED PRECEDING" | "UNBOUNDED FOLLOWING" | "CURRENT ROW";
|
|
93
|
+
type WINDOW_TYPES_ARG = "PRECEDING" | "FOLLOWING";
|
|
94
|
+
type WindowContent = {
|
|
95
|
+
type: WINDOW_TYPES_NO_ARG;
|
|
96
|
+
} | {
|
|
97
|
+
type: WINDOW_TYPES_ARG;
|
|
98
|
+
value: number;
|
|
99
|
+
};
|
|
100
|
+
type SelectExpr = Field | Fn | Identifier | RawExpression;
|
|
101
|
+
type QueryTable = {
|
|
102
|
+
kind: QueryNodeKind.Table;
|
|
103
|
+
alias: string;
|
|
104
|
+
joins: Join[];
|
|
105
|
+
} & ({
|
|
106
|
+
subquery?: false;
|
|
107
|
+
name: string;
|
|
108
|
+
} | {
|
|
109
|
+
subquery: true;
|
|
110
|
+
query: Query;
|
|
111
|
+
});
|
|
112
|
+
type JoinType = "INNER" | "LEFT" | "RIGHT" | "OUTER";
|
|
113
|
+
type Join = {
|
|
114
|
+
kind: QueryNodeKind.Join;
|
|
115
|
+
type?: JoinType;
|
|
116
|
+
table: QueryTable;
|
|
117
|
+
conditions: BooleanValueExpression;
|
|
118
|
+
};
|
|
119
|
+
type ParenthesisExpression = {
|
|
120
|
+
kind: QueryNodeKind.Parenthesis;
|
|
121
|
+
expression: BooleanValueExpression;
|
|
122
|
+
};
|
|
123
|
+
type RawExpression = {
|
|
124
|
+
kind: QueryNodeKind.Raw;
|
|
125
|
+
expr: string;
|
|
126
|
+
};
|
|
127
|
+
type ExistsExpression = {
|
|
128
|
+
kind: QueryNodeKind.Exists;
|
|
129
|
+
query: Query | RawExpression;
|
|
130
|
+
};
|
|
131
|
+
type BooleanValueExpression = CompoundExpression | ComparisonExpression | IsNullExpression | ParenthesisExpression | InExpression | BetweenExpression | ContainsExpression | ExistsExpression | RawExpression;
|
|
132
|
+
type IsNullExpression = {
|
|
133
|
+
kind: QueryNodeKind.IsNullExpr;
|
|
134
|
+
expr: Value;
|
|
135
|
+
isNot: boolean;
|
|
136
|
+
};
|
|
137
|
+
type CompoundOperator = "AND" | "OR";
|
|
138
|
+
type CompoundExpression = {
|
|
139
|
+
kind: QueryNodeKind.CompoundExpr;
|
|
140
|
+
left: BooleanValueExpression;
|
|
141
|
+
operator: CompoundOperator;
|
|
142
|
+
right: BooleanValueExpression;
|
|
143
|
+
};
|
|
144
|
+
type ComparisonExpression = {
|
|
145
|
+
kind: QueryNodeKind.ComparisonExpr;
|
|
146
|
+
left: Value;
|
|
147
|
+
operator: ComparisonOperators;
|
|
148
|
+
right: Value;
|
|
149
|
+
};
|
|
150
|
+
type ContainType = "start" | "end" | "contains";
|
|
151
|
+
type ContainsExpression = {
|
|
152
|
+
kind: QueryNodeKind.ContainsExpr;
|
|
153
|
+
type: ContainType;
|
|
154
|
+
left: Value;
|
|
155
|
+
isNot: boolean;
|
|
156
|
+
right: string;
|
|
157
|
+
};
|
|
158
|
+
type InExpression = {
|
|
159
|
+
kind: QueryNodeKind.InExpr;
|
|
160
|
+
left: Value;
|
|
161
|
+
operator: "IN" | "NOT IN";
|
|
162
|
+
} & ({
|
|
163
|
+
query: Query | RawExpression;
|
|
164
|
+
} | {
|
|
165
|
+
right: Value[];
|
|
166
|
+
});
|
|
167
|
+
type BetweenExpression = {
|
|
168
|
+
kind: QueryNodeKind.BetweenExpr;
|
|
169
|
+
left: Value;
|
|
170
|
+
begin: Value;
|
|
171
|
+
end: Value;
|
|
172
|
+
};
|
|
173
|
+
type Value = Literal | Field | Fn | Identifier;
|
|
174
|
+
type Identifier = {
|
|
175
|
+
kind: QueryNodeKind.Identifier;
|
|
176
|
+
identifier: string;
|
|
177
|
+
};
|
|
178
|
+
type Literal = {
|
|
179
|
+
kind: QueryNodeKind.Literal;
|
|
180
|
+
value: string | boolean | number | null;
|
|
181
|
+
};
|
|
182
|
+
type SortDirection = "ASC" | "DESC";
|
|
183
|
+
type Sort = {
|
|
184
|
+
kind: QueryNodeKind.Sort;
|
|
185
|
+
field: Field | Fn | Identifier;
|
|
186
|
+
direction?: SortDirection;
|
|
187
|
+
};
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/runtime/dsl/query/sql/queryToSql.d.ts
|
|
190
|
+
declare const queryToSql: (query: Query) => string;
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/runtime/types.d.ts
|
|
193
|
+
type CustomCondition<Context> = (args: MakeConditionArg<Context>) => BooleanValueExpression;
|
|
194
|
+
type AllowReadonly<T> = T | Readonly<T>;
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/runtime/field.d.ts
|
|
197
|
+
type Fields<Entity, Relation = Record<string, unknown>> = {
|
|
198
|
+
fields: AllowReadonly<keyof Entity & string>[];
|
|
199
|
+
relations?: Relation;
|
|
200
|
+
tableAlias?: string;
|
|
201
|
+
joinOn?: BooleanValueExpression;
|
|
202
|
+
joinType?: "INNER" | "LEFT";
|
|
203
|
+
};
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/runtime/dsl/query/createQueryResolveInfo.d.ts
|
|
206
|
+
type MakeConditionArg<Context = unknown, Entity = unknown> = {
|
|
207
|
+
childTableAlias: string;
|
|
208
|
+
context?: Context;
|
|
209
|
+
} & ({
|
|
210
|
+
parentTableAlias: string;
|
|
211
|
+
parent?: undefined;
|
|
212
|
+
} | {
|
|
213
|
+
parent: Partial<Entity>;
|
|
214
|
+
parentTableAlias?: undefined;
|
|
215
|
+
});
|
|
216
|
+
type MakeCondition<Context, Entity = any> = (arg: MakeConditionArg<Context, Entity>) => BooleanValueExpression;
|
|
217
|
+
type RelationInfo<Context = unknown> = {
|
|
218
|
+
table: string;
|
|
219
|
+
condition: MakeCondition<Context>;
|
|
220
|
+
array: boolean;
|
|
221
|
+
nullable: boolean;
|
|
222
|
+
requiredColumns: string[];
|
|
223
|
+
};
|
|
224
|
+
type RelationMap<Context = unknown> = {
|
|
225
|
+
[from: string]: {
|
|
226
|
+
[to: string]: RelationInfo<Context>;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
type TableInfo = {
|
|
230
|
+
[tableName: string]: {
|
|
231
|
+
identifiableKeys: string[];
|
|
232
|
+
identifiableFields: string[];
|
|
233
|
+
columnMap: {
|
|
234
|
+
[fieldName: string]: string;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/runtime/sql/runQuery.d.ts
|
|
240
|
+
type PagingOption$1 = {
|
|
241
|
+
numberOfItem: number;
|
|
242
|
+
where?: BooleanValueExpression;
|
|
243
|
+
offset?: number;
|
|
244
|
+
sort?: Sort[];
|
|
245
|
+
join?: Join[];
|
|
246
|
+
};
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/runtime/sasatDBDatasource.d.ts
|
|
249
|
+
type EntityType = Record<string, SqlValueType>;
|
|
250
|
+
type EntityResult<Entity, Identifiable> = Identifiable & Partial<Entity>;
|
|
251
|
+
interface Repository<Entity, Identifiable, Creatable, Updatable> {
|
|
252
|
+
create(entity: Creatable): Promise<Entity>;
|
|
253
|
+
update(entity: Updatable): Promise<CommandResponse>;
|
|
254
|
+
delete(entity: Identifiable): Promise<CommandResponse>;
|
|
255
|
+
}
|
|
256
|
+
type ListQueryOption = {
|
|
257
|
+
numberOfItem: number;
|
|
258
|
+
offset?: number;
|
|
259
|
+
order?: string;
|
|
260
|
+
asc?: boolean;
|
|
261
|
+
join?: Join[];
|
|
262
|
+
};
|
|
263
|
+
type QueryOptions = {
|
|
264
|
+
where?: BooleanValueExpression;
|
|
265
|
+
sort?: Sort[];
|
|
266
|
+
limit?: number;
|
|
267
|
+
offset?: number;
|
|
268
|
+
lock?: LockMode;
|
|
269
|
+
join?: Join[];
|
|
270
|
+
};
|
|
271
|
+
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> {
|
|
272
|
+
protected client: SQLExecutor;
|
|
273
|
+
protected abstract relationMap: RelationMap<any>;
|
|
274
|
+
protected abstract tableInfo: TableInfo;
|
|
275
|
+
abstract readonly tableName: string;
|
|
276
|
+
abstract readonly fields: string[];
|
|
277
|
+
protected abstract readonly primaryKeys: string[];
|
|
278
|
+
protected abstract readonly identifyFields: string[];
|
|
279
|
+
protected abstract readonly autoIncrementColumn?: string | undefined;
|
|
280
|
+
constructor(client?: SQLExecutor);
|
|
281
|
+
protected abstract getDefaultValueString(): Partial<{ [P in keyof Entity]: Entity[P] | string | null | never }> | never;
|
|
282
|
+
create(entity: Creatable, option?: {
|
|
283
|
+
ignore?: boolean;
|
|
284
|
+
upsert?: {
|
|
285
|
+
updateColumns: string[];
|
|
286
|
+
};
|
|
287
|
+
}): Promise<Entity>;
|
|
288
|
+
createBulk(entities: Creatable[], option?: {
|
|
289
|
+
ignore?: boolean;
|
|
290
|
+
upsert?: {
|
|
291
|
+
updateColumns: string[];
|
|
292
|
+
};
|
|
293
|
+
}): Promise<CommandResponse | null>;
|
|
294
|
+
upsert<T extends Creatable & Partial<Entity>>(entity: T, updateFields?: (keyof T)[]): Promise<Entity>;
|
|
295
|
+
update(entity: Updatable): Promise<CommandResponse>;
|
|
296
|
+
updateWhere(update: Omit<Updatable, keyof Identifiable>, condition: BooleanValueExpression): Promise<CommandResponse>;
|
|
297
|
+
delete(entity: Identifiable): Promise<CommandResponse>;
|
|
298
|
+
deleteWhere(condition: BooleanValueExpression): Promise<CommandResponse>;
|
|
299
|
+
first(fields?: EntityFields | Readonly<EntityFields>, option?: QueryOptions, context?: unknown): Promise<QueryResult | null>;
|
|
300
|
+
find(fields?: EntityFields, options?: QueryOptions, context?: unknown): Promise<QueryResult[]>;
|
|
301
|
+
findPageable(paging: PagingOption$1, fields?: EntityFields, options?: QueryOptions, context?: unknown): Promise<QueryResult[]>;
|
|
302
|
+
private executeQuery;
|
|
303
|
+
private createIdentifiableExpression;
|
|
304
|
+
getRelationMap(): {
|
|
305
|
+
[to: string]: RelationInfo<any>;
|
|
306
|
+
};
|
|
307
|
+
protected fieldToColumn(fields: string[]): string[];
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/db/getDbClient.d.ts
|
|
311
|
+
declare const getDbClient: (option?: Partial<PoolOptions>, logger?: (query: string) => void) => DBClient;
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/db/sql/expression/conditionExpression.d.ts
|
|
314
|
+
type ConditionExpression<T> = ComparisonExpression$1<T> | CompositeCondition<T>;
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/db/sql/expression/compositeCondition.d.ts
|
|
317
|
+
declare class CompositeCondition<T> {
|
|
318
|
+
private type;
|
|
319
|
+
private conditions;
|
|
320
|
+
private constructor();
|
|
321
|
+
static or<T>(conditions: ConditionExpression<T>[]): CompositeCondition<T>;
|
|
322
|
+
static and<T>(conditions: ConditionExpression<T>[]): CompositeCondition<T>;
|
|
323
|
+
toSQL(): string;
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/generatorv2/codegen/ts/scripts/typeDefinition.d.ts
|
|
327
|
+
type TypeFieldDefinition = {
|
|
328
|
+
return: string;
|
|
329
|
+
args?: {
|
|
330
|
+
name: string;
|
|
331
|
+
type: string;
|
|
332
|
+
}[];
|
|
333
|
+
};
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/runtime/createTypeDef.d.ts
|
|
336
|
+
type TypeDef = Record<string, TypeFieldDefinition>;
|
|
337
|
+
declare const createTypeDef: (typeDefs: Record<string, TypeDef>, inputs: Record<string, TypeDef>) => string;
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/runtime/date.d.ts
|
|
340
|
+
declare const dateOffset: (date: Date, timeZoneHour?: number) => Date;
|
|
341
|
+
declare const dateToDatetimeString: (d: Date) => string;
|
|
342
|
+
declare const dateToDateString: (d: Date) => string;
|
|
343
|
+
declare const getTodayDateString: (timeZoneHour?: number) => string;
|
|
344
|
+
declare const getTodayDateTimeString: (timeZoneHour?: number) => string;
|
|
345
|
+
declare const getDayRange: (date: Date, timeZoneHour?: number) => [string, string];
|
|
346
|
+
declare const getDayRangeQExpr: (date: Date, timeZoneHour?: number) => [Literal, Literal];
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/runtime/dsl/factory.d.ts
|
|
349
|
+
type StrOrNum = string | number;
|
|
350
|
+
type ValueType = string | boolean | number | null;
|
|
351
|
+
declare const QExpr: {
|
|
352
|
+
readonly field: (table: string, name: string, alias?: string) => Field;
|
|
353
|
+
readonly fn: (fnName: string, args: Value[], alias?: string) => Fn;
|
|
354
|
+
readonly window: (type: "ROWS" | "RANGE", value: WindowContent) => Window;
|
|
355
|
+
readonly windowBetween: (type: "ROWS" | "RANGE", start: WindowContent, end: WindowContent) => Window;
|
|
356
|
+
readonly paren: (expression: BooleanValueExpression) => ParenthesisExpression;
|
|
357
|
+
readonly table: (name: string, joins: Join[], alias: string) => QueryTable;
|
|
358
|
+
readonly subQueryTable: (query: Query, joins: Join[], alias: string) => QueryTable;
|
|
359
|
+
readonly join: (table: QueryTable, conditions: BooleanValueExpression, type?: JoinType) => Join;
|
|
360
|
+
readonly value: (value: ValueType) => Literal;
|
|
361
|
+
readonly sort: (field: Field | Fn | Identifier, direction?: SortDirection) => Sort;
|
|
362
|
+
readonly order: (field: Field | Fn | Identifier, direction?: SortDirection) => Sort;
|
|
363
|
+
readonly ident: (identifier: string) => Identifier;
|
|
364
|
+
readonly id: (identifier: string) => Identifier;
|
|
365
|
+
readonly raw: (sql: string) => RawExpression;
|
|
366
|
+
readonly simpleWhere: (tableNameOrAlias: string, where: {
|
|
367
|
+
[field: string]: ValueType | [ComparisonOperators, ValueType];
|
|
368
|
+
}, isOr?: boolean) => BooleanValueExpression;
|
|
369
|
+
readonly and: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
370
|
+
readonly or: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
371
|
+
readonly eq: (left: Value, right: Value) => ComparisonExpression;
|
|
372
|
+
readonly neq: (left: Value, right: Value) => ComparisonExpression;
|
|
373
|
+
readonly gt: (left: Value, right: Value) => ComparisonExpression;
|
|
374
|
+
readonly gte: (left: Value, right: Value) => ComparisonExpression;
|
|
375
|
+
readonly lt: (left: Value, right: Value) => ComparisonExpression;
|
|
376
|
+
readonly lte: (left: Value, right: Value) => ComparisonExpression;
|
|
377
|
+
readonly comparison: (left: Value, operator: ComparisonOperators, right: Value) => ComparisonExpression;
|
|
378
|
+
readonly contains: (left: Value, right: string) => BooleanValueExpression;
|
|
379
|
+
readonly notContains: (left: Value, right: string) => BooleanValueExpression;
|
|
380
|
+
readonly startsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
381
|
+
readonly notStartsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
382
|
+
readonly endsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
383
|
+
readonly notEndsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
384
|
+
readonly in: (left: Value, right: StrOrNum[] | Query | RawExpression) => BooleanValueExpression;
|
|
385
|
+
readonly notIn: (left: Value, values: StrOrNum[]) => InExpression;
|
|
386
|
+
readonly between: (left: Value, begin: Value, end: Value) => BetweenExpression;
|
|
387
|
+
readonly isNull: (expr: Value) => IsNullExpression;
|
|
388
|
+
readonly isNotNull: (expr: Value) => IsNullExpression;
|
|
389
|
+
readonly exists: (query: RawExpression | Query) => ExistsExpression;
|
|
390
|
+
readonly conditions: {
|
|
391
|
+
simpleWhere: (tableNameOrAlias: string, where: {
|
|
392
|
+
[field: string]: ValueType | [ComparisonOperators, ValueType];
|
|
393
|
+
}, isOr?: boolean) => BooleanValueExpression;
|
|
394
|
+
and: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
395
|
+
or: (...expr: Array<BooleanValueExpression | undefined | null>) => BooleanValueExpression;
|
|
396
|
+
eq: (left: Value, right: Value) => ComparisonExpression;
|
|
397
|
+
neq: (left: Value, right: Value) => ComparisonExpression;
|
|
398
|
+
gt: (left: Value, right: Value) => ComparisonExpression;
|
|
399
|
+
gte: (left: Value, right: Value) => ComparisonExpression;
|
|
400
|
+
lt: (left: Value, right: Value) => ComparisonExpression;
|
|
401
|
+
lte: (left: Value, right: Value) => ComparisonExpression;
|
|
402
|
+
comparison: (left: Value, operator: ComparisonOperators, right: Value) => ComparisonExpression;
|
|
403
|
+
contains: (left: Value, right: string) => BooleanValueExpression;
|
|
404
|
+
notContains: (left: Value, right: string) => BooleanValueExpression;
|
|
405
|
+
startsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
406
|
+
notStartsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
407
|
+
endsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
408
|
+
notEndsWith: (left: Value, right: string) => BooleanValueExpression;
|
|
409
|
+
in: (left: Value, right: StrOrNum[] | Query | RawExpression) => BooleanValueExpression;
|
|
410
|
+
notIn: (left: Value, values: StrOrNum[]) => InExpression;
|
|
411
|
+
between: (left: Value, begin: Value, end: Value) => BetweenExpression;
|
|
412
|
+
isNull: (expr: Value) => IsNullExpression;
|
|
413
|
+
isNotNull: (expr: Value) => IsNullExpression;
|
|
414
|
+
exists: (query: RawExpression | Query) => ExistsExpression;
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/runtime/dsl/query/sql/nodeToSql.d.ts
|
|
419
|
+
declare const Sql: {
|
|
420
|
+
select: (expr: SelectExpr) => string;
|
|
421
|
+
literal: (literal: Literal) => string;
|
|
422
|
+
fieldInCondition: (identifier: Field) => string;
|
|
423
|
+
fieldInSelect: (identifier: Field) => string;
|
|
424
|
+
identifier: (ident: Identifier) => string;
|
|
425
|
+
fn: (fn: Fn) => string;
|
|
426
|
+
value: (v: Value) => string;
|
|
427
|
+
between: (expr: BetweenExpression) => string;
|
|
428
|
+
contains: (expr: ContainsExpression) => string;
|
|
429
|
+
in: (expr: InExpression) => string;
|
|
430
|
+
comparison: (expr: ComparisonExpression) => string;
|
|
431
|
+
compound: (expr: CompoundExpression) => string;
|
|
432
|
+
isNull: (expr: IsNullExpression) => string;
|
|
433
|
+
paren: (expr: ParenthesisExpression) => string;
|
|
434
|
+
table: (table: QueryTable) => string;
|
|
435
|
+
join: (join: Join) => string;
|
|
436
|
+
booleanValue: (expr: BooleanValueExpression) => string;
|
|
437
|
+
exists: (expr: ExistsExpression) => string;
|
|
438
|
+
sort: (expr: Sort) => string;
|
|
439
|
+
sorts: (sorts: Sort[]) => string;
|
|
440
|
+
queryOrRaw: (expr: Query | RawExpression) => string;
|
|
441
|
+
};
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/runtime/gqlResolveInfoToField.d.ts
|
|
444
|
+
declare const gqlResolveInfoToField: <T extends Fields<any> = Fields<unknown>>(info: GraphQLResolveInfo) => T;
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/runtime/id.d.ts
|
|
447
|
+
type NumberIdEncoder = {
|
|
448
|
+
encode: (id: number) => string;
|
|
449
|
+
decode: (id: string) => number;
|
|
450
|
+
};
|
|
451
|
+
declare const makeNumberIdEncoder: (hashId: Hashids) => NumberIdEncoder;
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/runtime/resolverMiddleware.d.ts
|
|
454
|
+
type ResolverMiddleware<Context, RequiredParams = any, IncomingParams = RequiredParams> = (args: ResolverArgs<Context, IncomingParams | RequiredParams>) => ResolverArgs<Context, RequiredParams | IncomingParams>;
|
|
455
|
+
declare const makeParamsMiddleware: <RequiredParams, IncomingParams = RequiredParams>(update: (params: RequiredParams) => IncomingParams) => ResolverMiddleware<never, RequiredParams, IncomingParams>;
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/runtime/makeResolver.d.ts
|
|
458
|
+
type ResolverArgs<Context, Params = unknown> = [_: unknown, params: Params, context: Context, info: GraphQLResolveInfo$1];
|
|
459
|
+
type Resolver<Context, Params> = (_: unknown, params: Params, context: Context, info: GraphQLResolveInfo$1) => unknown;
|
|
460
|
+
declare const makeResolver: <Context, RequiredParams, IncomingParams = RequiredParams>(resolver: Resolver<Context, RequiredParams>, middlewares?: ResolverMiddleware<Context, RequiredParams, IncomingParams>[]) => Resolver<Context, RequiredParams>;
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/runtime/sql/sqlString.d.ts
|
|
463
|
+
declare const escape: typeof pkg.escape;
|
|
464
|
+
declare const SqlString: {
|
|
465
|
+
escape: (value: Parameters<typeof escape>[0]) => string;
|
|
466
|
+
escapeId: (name: string) => string;
|
|
467
|
+
};
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region src/runtime/util.d.ts
|
|
470
|
+
declare const pick: <T extends object>(target: T, keys: Array<keyof T>) => {
|
|
471
|
+
[k: string]: T[keyof T];
|
|
472
|
+
};
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region src/util/assignDeep.d.ts
|
|
475
|
+
type Obj = {
|
|
476
|
+
[key: string]: any;
|
|
477
|
+
};
|
|
478
|
+
declare const assignDeep: (base: Obj, ...objects: Obj[]) => Obj;
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/util/dateUtil.d.ts
|
|
481
|
+
declare const getCurrentDateTimeString: () => string;
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/runtime/pagingOption.d.ts
|
|
484
|
+
type DsPagingOption = {
|
|
485
|
+
numberOfItem: number;
|
|
486
|
+
where?: BooleanValueExpression;
|
|
487
|
+
offset?: number;
|
|
488
|
+
sort?: Sort[];
|
|
489
|
+
};
|
|
490
|
+
declare const pagingOption$1: (option: ListQueryOption) => DsPagingOption;
|
|
491
|
+
//#endregion
|
|
492
|
+
//#region src/index.d.ts
|
|
493
|
+
type PagingOption = ListQueryOption;
|
|
494
|
+
//#endregion
|
|
495
|
+
export { RelationMap as A, CompositeCondition as C, ListQueryOption as D, EntityType as E, BooleanValueExpression as F, LockMode as I, Query as L, Fields as M, CustomCondition as N, QueryOptions as O, queryToSql as P, formatQuery as R, TypeFieldDefinition as S, EntityResult as T, getDayRange as _, pick as a, getTodayDateTimeString as b, ResolverMiddleware as c, gqlResolveInfoToField as d, Sql as f, dateToDatetimeString as g, dateToDateString as h, assignDeep as i, TableInfo as j, SasatDBDatasource as k, makeParamsMiddleware as l, dateOffset as m, pagingOption$1 as n, SqlString as o, QExpr as p, getCurrentDateTimeString as r, makeResolver as s, PagingOption as t, makeNumberIdEncoder as u, getDayRangeQExpr as v, getDbClient as w, createTypeDef as x, getTodayDateString as y, MysqlClient as z };
|