sasat 0.22.3 → 0.22.5
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 +16 -15
- package/dist/cli/index.mjs +2 -1
- package/dist/comparison-BpTtc1iD.d.mts +42 -0
- package/dist/comparison-CIb9xu5T.d.cts +42 -0
- package/dist/dbClient-2mFJTQw7.d.mts +35 -0
- package/dist/dbClient-Bnk1JKBU.d.cts +35 -0
- package/dist/index.cjs +31 -94
- package/dist/index.d.cts +3 -738
- package/dist/index.d.mts +4 -739
- package/dist/index.mjs +3 -62
- package/dist/makeCondition-3MdYUm5k.mjs +134 -0
- package/dist/makeCondition-DKSyAkri.cjs +139 -0
- package/dist/{migrate-BRNxkHCx.cjs → migrate-BDE07ocG.cjs} +3013 -3511
- package/dist/{migrate-Cbj2OVbY.mjs → migrate-DnqBdQ6r.mjs} +3019 -3385
- package/dist/migration/index.cjs +64 -0
- package/dist/migration/index.d.cts +657 -0
- package/dist/migration/index.d.mts +657 -0
- package/dist/migration/index.mjs +61 -0
- package/dist/testing/index.cjs +3 -0
- package/dist/testing/index.d.cts +12 -0
- package/dist/testing/index.d.mts +12 -0
- package/dist/testing/index.mjs +2 -0
- package/dist/util-C5Jevn5B.cjs +377 -0
- package/dist/util-Dkw5bD7a.mjs +239 -0
- package/package.json +16 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,87 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { i as setConfig, n as ComparisonOperators, t as ComparisonExpression$1 } from "./comparison-BpTtc1iD.mjs";
|
|
2
|
+
import { a as SQLExecutor, i as SQLClient, n as DBClient, o as SQLTransaction, r as QueryResponse, s as SqlValueType, t as CommandResponse } from "./dbClient-2mFJTQw7.mjs";
|
|
2
3
|
import * as _$mysql2_promise0 from "mysql2/promise";
|
|
3
4
|
import { ConnectionOptions, PoolOptions } from "mysql2/promise";
|
|
5
|
+
import pkg from "sqlstring";
|
|
4
6
|
import { GraphQLResolveInfo } from "graphql";
|
|
5
7
|
import Hashids from "hashids";
|
|
6
8
|
import { GraphQLResolveInfo as GraphQLResolveInfo$1 } from "graphql/type/index.js";
|
|
7
9
|
|
|
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;
|
|
48
|
-
};
|
|
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
10
|
//#region src/db/connectors/mysql/client.d.ts
|
|
86
11
|
declare class MysqlClient extends DBClient {
|
|
87
12
|
readonly connectionOption: ConnectionOptions;
|
|
@@ -95,13 +20,6 @@ declare class MysqlClient extends DBClient {
|
|
|
95
20
|
//#region src/db/formatQuery.d.ts
|
|
96
21
|
declare const formatQuery: (str: TemplateStringsArray, ...params: any[]) => string;
|
|
97
22
|
//#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
23
|
//#region src/runtime/dsl/query/query.d.ts
|
|
106
24
|
declare enum QueryNodeKind {
|
|
107
25
|
Field = 0,
|
|
@@ -408,659 +326,6 @@ type TypeFieldDefinition = {
|
|
|
408
326
|
}[];
|
|
409
327
|
};
|
|
410
328
|
//#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
|
|
442
|
-
type ContextConditionValue = {
|
|
443
|
-
kind: "context";
|
|
444
|
-
field: string;
|
|
445
|
-
onNotDefined: OnNotDefinedAction;
|
|
446
|
-
};
|
|
447
|
-
type FixedConditionValue = {
|
|
448
|
-
kind: "fixed";
|
|
449
|
-
value: string | number;
|
|
450
|
-
};
|
|
451
|
-
type TodayStartConditionValue = {
|
|
452
|
-
kind: "today";
|
|
453
|
-
type: "date" | "datetime";
|
|
454
|
-
thresholdHour?: number;
|
|
455
|
-
};
|
|
456
|
-
type NowConditionValue = {
|
|
457
|
-
kind: "now";
|
|
458
|
-
};
|
|
459
|
-
type OnNotDefinedAction = {
|
|
460
|
-
action: "error";
|
|
461
|
-
message: string;
|
|
462
|
-
} | {
|
|
463
|
-
action: "defaultValue";
|
|
464
|
-
value: string | number;
|
|
465
|
-
};
|
|
466
|
-
type ConditionValue = ContextConditionValue | FixedConditionValue | TodayStartConditionValue | NowConditionValue;
|
|
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;
|
|
482
|
-
};
|
|
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;
|
|
493
|
-
} | {
|
|
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[];
|
|
508
|
-
};
|
|
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
|
|
528
|
-
type ColumnOptions = {
|
|
529
|
-
updatable: boolean;
|
|
530
|
-
autoIncrementHashId: boolean;
|
|
531
|
-
hashSalt?: string;
|
|
532
|
-
};
|
|
533
|
-
interface SerializedColumnBase {
|
|
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;
|
|
548
|
-
}
|
|
549
|
-
interface SerializedNormalColumn extends SerializedColumnBase {
|
|
550
|
-
hasReference: false;
|
|
551
|
-
}
|
|
552
|
-
interface Reference {
|
|
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;
|
|
563
|
-
}
|
|
564
|
-
interface SerializedReferenceColumn extends SerializedColumnBase {
|
|
565
|
-
hasReference: true;
|
|
566
|
-
reference: Reference;
|
|
567
|
-
}
|
|
568
|
-
type SerializedColumn = SerializedNormalColumn | SerializedReferenceColumn;
|
|
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
|
|
598
|
-
interface Index {
|
|
599
|
-
constraintName: string;
|
|
600
|
-
columns: string[];
|
|
601
|
-
}
|
|
602
|
-
declare class DBIndex implements Index, Serializable<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;
|
|
611
|
-
}
|
|
612
|
-
//#endregion
|
|
613
|
-
//#region src/migration/serialized/serializedStore.d.ts
|
|
614
|
-
interface SerializedTable {
|
|
615
|
-
columns: SerializedColumn[];
|
|
616
|
-
primaryKey: string[];
|
|
617
|
-
uniqueKeys: string[][];
|
|
618
|
-
indexes: Index[];
|
|
619
|
-
tableName: string;
|
|
620
|
-
gqlOption: GQLOption;
|
|
621
|
-
virtualRelations: VirtualRelation[];
|
|
622
|
-
}
|
|
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
|
|
670
|
-
interface Column extends Serializable<SerializedColumn> {
|
|
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;
|
|
680
|
-
}
|
|
681
|
-
declare class BaseColumn implements Column {
|
|
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;
|
|
697
|
-
}
|
|
698
|
-
declare class ReferenceColumn extends BaseColumn {
|
|
699
|
-
data: SerializedReferenceColumn;
|
|
700
|
-
constructor(data: SerializedReferenceColumn, table: Table);
|
|
701
|
-
getConstraintName(): string;
|
|
702
|
-
}
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region src/migration/dataStore.d.ts
|
|
705
|
-
interface DataStore {
|
|
706
|
-
table(tableName: string): Table;
|
|
707
|
-
}
|
|
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
|
|
734
|
-
interface GqlFromContextParam {
|
|
735
|
-
column: string;
|
|
736
|
-
contextName?: string;
|
|
737
|
-
}
|
|
738
|
-
type GQLMutation = {
|
|
739
|
-
type: "create" | "update" | "delete";
|
|
740
|
-
noReFetch: boolean;
|
|
741
|
-
middlewares: string[];
|
|
742
|
-
contextFields: GqlFromContextParam[];
|
|
743
|
-
subscription: {
|
|
744
|
-
enabled: boolean;
|
|
745
|
-
subscriptionFilter: string[];
|
|
746
|
-
};
|
|
747
|
-
};
|
|
748
|
-
type GQLQuery = {
|
|
749
|
-
type: "single" | "list-all" | "list-paging";
|
|
750
|
-
name: string;
|
|
751
|
-
conditions: QueryConditionNode[];
|
|
752
|
-
middlewares: string[];
|
|
753
|
-
} | {
|
|
754
|
-
type: "primary";
|
|
755
|
-
name?: never;
|
|
756
|
-
conditions: never[];
|
|
757
|
-
middlewares: string[];
|
|
758
|
-
};
|
|
759
|
-
interface GQLOption {
|
|
760
|
-
enabled: boolean;
|
|
761
|
-
queries: GQLQuery[];
|
|
762
|
-
mutations: GQLMutation[];
|
|
763
|
-
}
|
|
764
|
-
//#endregion
|
|
765
|
-
//#region src/migration/creators/columnBuilder.d.ts
|
|
766
|
-
declare abstract class ColumnBuilderBase {
|
|
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
|
-
};
|
|
785
|
-
}
|
|
786
|
-
declare abstract class ColumnBuilder extends ColumnBuilderBase {
|
|
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
|
-
};
|
|
803
|
-
}
|
|
804
|
-
declare class StringColumnBuilder extends ColumnBuilder {
|
|
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;
|
|
810
|
-
}
|
|
811
|
-
declare class TextColumnBuilder extends ColumnBuilder {
|
|
812
|
-
readonly name: string;
|
|
813
|
-
protected type: DBTextTypes;
|
|
814
|
-
constructor(name: string, type: DBTextTypes);
|
|
815
|
-
default(value: string | null | undefined): this;
|
|
816
|
-
}
|
|
817
|
-
declare class NumberColumnBuilder extends ColumnBuilder {
|
|
818
|
-
signed(): this;
|
|
819
|
-
unsigned(): this;
|
|
820
|
-
zerofill(): this;
|
|
821
|
-
default(value: number | null | undefined): this;
|
|
822
|
-
}
|
|
823
|
-
declare class IntegerColumnBuilder extends NumberColumnBuilder {
|
|
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;
|
|
829
|
-
}
|
|
830
|
-
declare class FloatColumnBuilder extends NumberColumnBuilder {
|
|
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;
|
|
837
|
-
}
|
|
838
|
-
declare class DecimalColumnBuilder extends NumberColumnBuilder {
|
|
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);
|
|
844
|
-
}
|
|
845
|
-
declare class DateColumnBuilder extends ColumnBuilder {
|
|
846
|
-
readonly name: string;
|
|
847
|
-
protected type: DBDateTypes;
|
|
848
|
-
constructor(name: string, type: DBDateTypes);
|
|
849
|
-
default(value: string | number | null | undefined): this;
|
|
850
|
-
}
|
|
851
|
-
declare class TimeStampColumnBuilder extends ColumnBuilder {
|
|
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;
|
|
858
|
-
}
|
|
859
|
-
declare class ReferenceColumnBuilder extends ColumnBuilderBase {
|
|
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
|
-
};
|
|
872
|
-
}
|
|
873
|
-
//#endregion
|
|
874
|
-
//#region src/migration/creators/columnCreator.d.ts
|
|
875
|
-
declare class ColumnCreator {
|
|
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;
|
|
896
|
-
}
|
|
897
|
-
//#endregion
|
|
898
|
-
//#region src/migration/creators/tableCreator.d.ts
|
|
899
|
-
interface 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;
|
|
916
|
-
}
|
|
917
|
-
declare class TableCreator implements 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;
|
|
941
|
-
}
|
|
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
|
|
980
|
-
interface MigrationStore extends DataStore {
|
|
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;
|
|
986
|
-
}
|
|
987
|
-
//#endregion
|
|
988
|
-
//#region src/migration/front/migration.d.ts
|
|
989
|
-
interface SasatMigration {
|
|
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>;
|
|
996
|
-
}
|
|
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
|
-
};
|
|
1029
|
-
};
|
|
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;
|
|
1040
|
-
};
|
|
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
329
|
//#region src/runtime/createTypeDef.d.ts
|
|
1065
330
|
type TypeDef = Record<string, TypeFieldDefinition>;
|
|
1066
331
|
declare const createTypeDef: (typeDefs: Record<string, TypeDef>, inputs: Record<string, TypeDef>) => string;
|
|
@@ -1224,4 +489,4 @@ declare const pagingOption$1: (option: ListQueryOption) => DsPagingOption;
|
|
|
1224
489
|
//#region src/index.d.ts
|
|
1225
490
|
type PagingOption = ListQueryOption;
|
|
1226
491
|
//#endregion
|
|
1227
|
-
export { type BooleanValueExpression, type CommandResponse, type ComparisonOperators, CompositeCondition,
|
|
492
|
+
export { type BooleanValueExpression, type CommandResponse, type ComparisonOperators, CompositeCondition, type CustomCondition, type EntityResult, type EntityType, type Fields, type ListQueryOption, type LockMode, MysqlClient, PagingOption, QExpr, QExpr as qe, type Query, type QueryOptions, type QueryResponse, type RelationMap, type ResolverMiddleware, type SQLClient, type SQLExecutor, type SQLTransaction, SasatDBDatasource, Sql, SqlString, type TableInfo, type TypeFieldDefinition, assignDeep, createTypeDef, dateOffset, dateToDateString, dateToDatetimeString, formatQuery, getCurrentDateTimeString, getDayRange, getDayRangeQExpr, getDbClient, getTodayDateString, getTodayDateTimeString, gqlResolveInfoToField, makeNumberIdEncoder, makeParamsMiddleware, makeResolver, pagingOption$1 as pagingOption, pick, queryToSql, setConfig };
|