sasat 0.19.21 → 0.19.23
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/lib/cli/commands/migrate.js +1 -1
- package/lib/generatorv2/codegen/ts/generateQueryResolver.js +2 -1
- package/lib/generatorv2/codegen/ts/relationMap/getRequiredColumnNames.d.ts +1 -1
- package/lib/generatorv2/codegen/ts/relationMap/makeJoinConditionValue.d.ts +2 -1
- package/lib/generatorv2/codegen/ts/scripts/fieldToProperty.d.ts +1 -1
- package/lib/generatorv2/codegen/ts/scripts/gqlString.d.ts +2 -1
- package/lib/generatorv2/codegen/tscodegen_v2.d.ts +10 -10
- package/lib/generatorv2/codegen/tscodegen_v2.js +12 -12
- package/lib/generatorv2/codegen_v2.js +20 -21
- package/lib/generatorv2/nodes/FieldNode.d.ts +27 -0
- package/lib/generatorv2/nodes/FieldNode.js +78 -0
- package/lib/generatorv2/nodes/ReferencedNode.d.ts +33 -0
- package/lib/generatorv2/nodes/ReferencedNode.js +92 -0
- package/lib/generatorv2/nodes/entityNode.d.ts +5 -52
- package/lib/generatorv2/nodes/entityNode.js +2 -170
- package/lib/generatorv2/parser/makeMutationNodes.js +9 -10
- package/lib/migration/front/storeMigrator.d.ts +2 -2
- package/lib/migration/front/storeMigrator.js +2 -2
- package/lib/tsg/file.d.ts +1 -0
- package/lib/tsg/file.js +4 -2
- package/package.json +12 -13
|
@@ -15,6 +15,7 @@ export const migrate = async (options) => {
|
|
|
15
15
|
writeCurrentSchema(result.store);
|
|
16
16
|
await new CodeGen_v2(storeHandler).generate();
|
|
17
17
|
}
|
|
18
|
+
Console.success(`current migration is ${current}`);
|
|
18
19
|
}
|
|
19
20
|
catch (e) {
|
|
20
21
|
Console.error(e.message);
|
|
@@ -22,6 +23,5 @@ export const migrate = async (options) => {
|
|
|
22
23
|
}
|
|
23
24
|
finally {
|
|
24
25
|
await getDbClient().release();
|
|
25
|
-
Console.success(`current migration is ${current}`);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
@@ -52,7 +52,8 @@ const getHashIdArgs = (entity, query) => {
|
|
|
52
52
|
}
|
|
53
53
|
const getHashIdArg = (arg, field) => {
|
|
54
54
|
const columnName = field.column;
|
|
55
|
-
const hashIdOpt = entity.fields.find(e => e.columnName === columnName)
|
|
55
|
+
const hashIdOpt = entity.fields.find(e => e.columnName === columnName)
|
|
56
|
+
?.hashId;
|
|
56
57
|
if (!hashIdOpt)
|
|
57
58
|
return null;
|
|
58
59
|
return {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ReferencedNode, ReferenceNode } from '../../../nodes/
|
|
1
|
+
import { ReferencedNode, ReferenceNode } from '../../../nodes/ReferencedNode.js';
|
|
2
2
|
export declare const getChildRequiredNames: (ref: ReferencedNode | ReferenceNode) => string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EntityNode
|
|
1
|
+
import { EntityNode } from '../../../nodes/entityNode.js';
|
|
2
2
|
import { JoinConditionValue } from '../../../nodes/JoinConditionNode.js';
|
|
3
3
|
import { TsExpression } from '../../../../tsg/index.js';
|
|
4
|
+
import { ReferencedNode, ReferenceNode } from '../../../nodes/ReferencedNode.js';
|
|
4
5
|
export declare const makeJoinConditionValueQExpr: (node: EntityNode, cv: JoinConditionValue) => TsExpression;
|
|
5
6
|
export declare const makeJoinConditionValue: (node: EntityNode, ref: ReferenceNode | ReferencedNode) => import("../../../../tsg/index.js").PropertyAssignment;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ArgNode, TypeNode } from '../../../nodes/typeNode.js';
|
|
2
|
-
import { FieldNode, ReferencedNode, ReferenceNode } from '../../../nodes/entityNode.js';
|
|
3
2
|
import { MutationNode } from '../../../nodes/mutationNode.js';
|
|
4
3
|
import { SubscriptionNode } from '../../../nodes/subscriptionNode.js';
|
|
5
4
|
import { QueryNode } from '../../../nodes/queryNode.js';
|
|
5
|
+
import { ReferencedNode, ReferenceNode } from '../../../nodes/ReferencedNode.js';
|
|
6
|
+
import { FieldNode } from '../../../nodes/FieldNode.js';
|
|
6
7
|
export declare const GQLString: {
|
|
7
8
|
args: (args: ArgNode[]) => string;
|
|
8
9
|
field: (field: FieldNode) => string;
|
|
@@ -6,16 +6,16 @@ export type FileData = {
|
|
|
6
6
|
};
|
|
7
7
|
export declare class TsCodegen_v2 {
|
|
8
8
|
readonly fileExtension = "ts";
|
|
9
|
-
generateEntity: (node: EntityNode) => string
|
|
10
|
-
generateDatasource: (node: EntityNode) => string
|
|
11
|
-
generateGeneratedDatasource: (node: EntityNode) => string
|
|
12
|
-
generateGqlTypeDefs: (root: RootNode) => string
|
|
13
|
-
generateGqlResolver: (root: RootNode) => string
|
|
14
|
-
generateGqlQuery: (root: RootNode) => string
|
|
15
|
-
generateGqlMutation: (root: RootNode) => string
|
|
16
|
-
generateGqlSubscription: (root: RootNode) => string
|
|
17
|
-
generateGQLContext: (root: RootNode) => string
|
|
18
|
-
generateFiles: (root: RootNode) => FileData[]
|
|
9
|
+
generateEntity: (node: EntityNode) => Promise<string>;
|
|
10
|
+
generateDatasource: (node: EntityNode) => Promise<string>;
|
|
11
|
+
generateGeneratedDatasource: (node: EntityNode) => Promise<string>;
|
|
12
|
+
generateGqlTypeDefs: (root: RootNode) => Promise<string>;
|
|
13
|
+
generateGqlResolver: (root: RootNode) => Promise<string>;
|
|
14
|
+
generateGqlQuery: (root: RootNode) => Promise<string>;
|
|
15
|
+
generateGqlMutation: (root: RootNode) => Promise<string>;
|
|
16
|
+
generateGqlSubscription: (root: RootNode) => Promise<string>;
|
|
17
|
+
generateGQLContext: (root: RootNode) => Promise<string>;
|
|
18
|
+
generateFiles: (root: RootNode) => Promise<FileData[]>;
|
|
19
19
|
generateOnceFiles: () => FileData[];
|
|
20
20
|
generateConditions: (root: RootNode, currentFile: string) => string | null;
|
|
21
21
|
generateIDEncoders: (root: RootNode, currentFile: string) => string | null;
|
|
@@ -16,22 +16,22 @@ import { generateMiddlewares } from './ts/generateMiddlewares.js';
|
|
|
16
16
|
export class TsCodegen_v2 {
|
|
17
17
|
constructor() {
|
|
18
18
|
this.fileExtension = 'ts';
|
|
19
|
-
this.generateEntity = (node) => generateEntityFile(node).
|
|
20
|
-
this.generateDatasource = (node) => generateDatasource(node).
|
|
21
|
-
this.generateGeneratedDatasource = (node) => generateAutoGeneratedDatasource(node).
|
|
22
|
-
this.generateGqlTypeDefs = (root) => generateTypeDefs(root).
|
|
23
|
-
this.generateGqlResolver = (root) => generateResolver(root).
|
|
24
|
-
this.generateGqlQuery = (root) => generateQueryResolver(root).
|
|
25
|
-
this.generateGqlMutation = (root) => generateMutationResolver(root).
|
|
26
|
-
this.generateGqlSubscription = (root) => generateSubscription(root).
|
|
27
|
-
this.generateGQLContext = (root) => generateContext(root).
|
|
28
|
-
this.generateFiles = (root) => {
|
|
19
|
+
this.generateEntity = (node) => generateEntityFile(node).generate();
|
|
20
|
+
this.generateDatasource = (node) => generateDatasource(node).generate();
|
|
21
|
+
this.generateGeneratedDatasource = (node) => generateAutoGeneratedDatasource(node).generate();
|
|
22
|
+
this.generateGqlTypeDefs = (root) => generateTypeDefs(root).generate();
|
|
23
|
+
this.generateGqlResolver = (root) => generateResolver(root).generate();
|
|
24
|
+
this.generateGqlQuery = (root) => generateQueryResolver(root).generate();
|
|
25
|
+
this.generateGqlMutation = (root) => generateMutationResolver(root).generate();
|
|
26
|
+
this.generateGqlSubscription = (root) => generateSubscription(root).generate();
|
|
27
|
+
this.generateGQLContext = (root) => generateContext(root).generate();
|
|
28
|
+
this.generateFiles = async (root) => {
|
|
29
29
|
return [
|
|
30
30
|
{
|
|
31
31
|
name: 'relationMap',
|
|
32
|
-
body: generateRelationMap(root).
|
|
32
|
+
body: await generateRelationMap(root).generate(),
|
|
33
33
|
},
|
|
34
|
-
{ name: 'fields', body: generateFields(root).
|
|
34
|
+
{ name: 'fields', body: await generateFields(root).generate() },
|
|
35
35
|
];
|
|
36
36
|
};
|
|
37
37
|
this.generateOnceFiles = () => {
|
|
@@ -23,8 +23,8 @@ export class CodeGen_v2 {
|
|
|
23
23
|
...this.root.entities.map(it => this.generateEntity(it)),
|
|
24
24
|
...this.root.entities.map(it => this.generateDatasource(it)),
|
|
25
25
|
...this.root.entities.map(it => this.generateGeneratedDatasource(it)),
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
this.generateGql(this.root),
|
|
27
|
+
this.generateFiles(this.root),
|
|
28
28
|
...this.generateOnceFiles(),
|
|
29
29
|
this.generateCondition(this.root),
|
|
30
30
|
this.generateIDEncoders(this.root),
|
|
@@ -41,29 +41,28 @@ export class CodeGen_v2 {
|
|
|
41
41
|
getFullPath(basePath, entityName) {
|
|
42
42
|
return path.join(basePath, `${entityName}.${this.codeGen.fileExtension}`);
|
|
43
43
|
}
|
|
44
|
-
generateEntity(node) {
|
|
45
|
-
return writeFile(this.getFullPath(this.generateEntityDir, node.name.name), this.codeGen.generateEntity(node));
|
|
44
|
+
async generateEntity(node) {
|
|
45
|
+
return writeFile(this.getFullPath(this.generateEntityDir, node.name.name), await this.codeGen.generateEntity(node));
|
|
46
46
|
}
|
|
47
|
-
generateDatasource(node) {
|
|
48
|
-
return writeFileIfNotExist(this.getFullPath(this.dbDataSourceDir, node.name.name), this.codeGen.generateDatasource(node));
|
|
47
|
+
async generateDatasource(node) {
|
|
48
|
+
return writeFileIfNotExist(this.getFullPath(this.dbDataSourceDir, node.name.name), await this.codeGen.generateDatasource(node));
|
|
49
49
|
}
|
|
50
|
-
generateGeneratedDatasource(node) {
|
|
51
|
-
return writeFile(this.getFullPath(this.generateDbDataSourceDir, node.name.name), this.codeGen.generateGeneratedDatasource(node));
|
|
50
|
+
async generateGeneratedDatasource(node) {
|
|
51
|
+
return writeFile(this.getFullPath(this.generateDbDataSourceDir, node.name.name), await this.codeGen.generateGeneratedDatasource(node));
|
|
52
52
|
}
|
|
53
|
-
generateGql(rootNode) {
|
|
54
|
-
return [
|
|
55
|
-
writeFile(this.getFullPath(this.generateDir, 'typeDefs'), this.codeGen.generateGqlTypeDefs(rootNode)),
|
|
56
|
-
writeFile(this.getFullPath(this.generateDir, 'resolver'), this.codeGen.generateGqlResolver(rootNode)),
|
|
57
|
-
writeFile(this.getFullPath(this.generateDir, 'query'), this.codeGen.generateGqlQuery(rootNode)),
|
|
58
|
-
writeFile(this.getFullPath(this.generateDir, 'mutation'), this.codeGen.generateGqlMutation(rootNode)),
|
|
59
|
-
writeFile(this.getFullPath(this.generateDir, 'subscription'), this.codeGen.generateGqlSubscription(rootNode)),
|
|
60
|
-
writeFile(this.getFullPath(this.generateDir, 'context'), this.codeGen.generateGQLContext(rootNode)),
|
|
61
|
-
];
|
|
53
|
+
async generateGql(rootNode) {
|
|
54
|
+
return Promise.all([
|
|
55
|
+
writeFile(this.getFullPath(this.generateDir, 'typeDefs'), await this.codeGen.generateGqlTypeDefs(rootNode)),
|
|
56
|
+
writeFile(this.getFullPath(this.generateDir, 'resolver'), await this.codeGen.generateGqlResolver(rootNode)),
|
|
57
|
+
writeFile(this.getFullPath(this.generateDir, 'query'), await this.codeGen.generateGqlQuery(rootNode)),
|
|
58
|
+
writeFile(this.getFullPath(this.generateDir, 'mutation'), await this.codeGen.generateGqlMutation(rootNode)),
|
|
59
|
+
writeFile(this.getFullPath(this.generateDir, 'subscription'), await this.codeGen.generateGqlSubscription(rootNode)),
|
|
60
|
+
writeFile(this.getFullPath(this.generateDir, 'context'), await this.codeGen.generateGQLContext(rootNode)),
|
|
61
|
+
]);
|
|
62
62
|
}
|
|
63
|
-
generateFiles(rootNode) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.map(it => writeFileIfNotExist(this.getFullPath(this.generateDir, it.name), it.body));
|
|
63
|
+
async generateFiles(rootNode) {
|
|
64
|
+
const files = await this.codeGen.generateFiles(rootNode);
|
|
65
|
+
return Promise.all(files.map(it => writeFileIfNotExist(this.getFullPath(this.generateDir, it.name), it.body)));
|
|
67
66
|
}
|
|
68
67
|
generateOnceFiles() {
|
|
69
68
|
return this.codeGen
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GQLPrimitive } from '../scripts/gqlTypes.js';
|
|
2
|
+
import { DBColumnTypes } from '../../migration/column/columnTypes.js';
|
|
3
|
+
import { ColumnOptions, SerializedColumn } from '../../migration/serialized/serializedColumn.js';
|
|
4
|
+
import { EntityNode } from './entityNode.js';
|
|
5
|
+
import { DataStoreHandler } from '../../migration/dataStore.js';
|
|
6
|
+
import { BaseColumn } from '../../migration/serializable/column.js';
|
|
7
|
+
export type FieldNode = {
|
|
8
|
+
entity: EntityNode;
|
|
9
|
+
fieldName: string;
|
|
10
|
+
columnName: string;
|
|
11
|
+
gqlType: GQLPrimitive | string;
|
|
12
|
+
dbType: DBColumnTypes;
|
|
13
|
+
isNullable: boolean;
|
|
14
|
+
isArray: boolean;
|
|
15
|
+
isPrimary: boolean;
|
|
16
|
+
isUpdatable: boolean;
|
|
17
|
+
isGQLOpen: boolean;
|
|
18
|
+
isAutoIncrement: boolean;
|
|
19
|
+
column: SerializedColumn;
|
|
20
|
+
option: ColumnOptions;
|
|
21
|
+
hashId?: {
|
|
22
|
+
encoder: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const makeFieldNode: (store: DataStoreHandler, entity: EntityNode, column: BaseColumn) => FieldNode;
|
|
26
|
+
export declare const makeCreatableFieldNode: (store: DataStoreHandler, entity: EntityNode, column: BaseColumn) => FieldNode | null;
|
|
27
|
+
export declare const makeUpdatableFieldNode: (store: DataStoreHandler, entity: EntityNode, column: BaseColumn) => FieldNode | null;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const getHashId = (store, entity, column) => {
|
|
2
|
+
if (!column.isReference()) {
|
|
3
|
+
if (column.data.option.autoIncrementHashId)
|
|
4
|
+
return { encoder: entity.IDEncoderName() };
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
const ref = column.data.reference;
|
|
8
|
+
const parent = store.table(ref.parentTable);
|
|
9
|
+
if (!parent.column(ref.parentColumn).data.option.autoIncrementHashId)
|
|
10
|
+
return undefined;
|
|
11
|
+
return {
|
|
12
|
+
encoder: parent.getEntityName().IDEncoderName(),
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export const makeFieldNode = (store, entity, column) => {
|
|
16
|
+
const hashId = getHashId(store, entity.name, column);
|
|
17
|
+
return {
|
|
18
|
+
entity,
|
|
19
|
+
fieldName: column.fieldName(),
|
|
20
|
+
columnName: column.columnName(),
|
|
21
|
+
gqlType: hashId ? 'ID' : column.gqlType(),
|
|
22
|
+
dbType: column.dataType(),
|
|
23
|
+
isAutoIncrement: column.data.autoIncrement,
|
|
24
|
+
isArray: false,
|
|
25
|
+
isPrimary: column.isPrimary(),
|
|
26
|
+
isNullable: column.isNullable(),
|
|
27
|
+
isUpdatable: !(column.data.onUpdateCurrentTimeStamp || column.isPrimary()) &&
|
|
28
|
+
column.data.option.updatable,
|
|
29
|
+
isGQLOpen: true,
|
|
30
|
+
column: column.data,
|
|
31
|
+
option: column.data.option,
|
|
32
|
+
hashId,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export const makeCreatableFieldNode = (store, entity, column) => {
|
|
36
|
+
if (column.data.autoIncrement || column.data.defaultCurrentTimeStamp)
|
|
37
|
+
return null;
|
|
38
|
+
const hashId = getHashId(store, entity.name, column);
|
|
39
|
+
return {
|
|
40
|
+
entity,
|
|
41
|
+
fieldName: column.fieldName(),
|
|
42
|
+
columnName: column.columnName(),
|
|
43
|
+
gqlType: hashId ? 'ID' : column.gqlType(),
|
|
44
|
+
dbType: column.dataType(),
|
|
45
|
+
isAutoIncrement: column.data.autoIncrement,
|
|
46
|
+
isArray: false,
|
|
47
|
+
isPrimary: column.isPrimary(),
|
|
48
|
+
isNullable: column.isNullableOnCreate(),
|
|
49
|
+
isUpdatable: column.isUpdatable(),
|
|
50
|
+
isGQLOpen: !(column.table.gqlOption.mutations.find(it => it.type === 'create')
|
|
51
|
+
?.contextFields || []).some(it => it.column === column.columnName()),
|
|
52
|
+
column: column.data,
|
|
53
|
+
option: column.data.option,
|
|
54
|
+
hashId: getHashId(store, entity.name, column),
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export const makeUpdatableFieldNode = (store, entity, column) => {
|
|
58
|
+
if (!column.isUpdatable() || !column.data.option.updatable)
|
|
59
|
+
return null;
|
|
60
|
+
const hashId = getHashId(store, entity.name, column);
|
|
61
|
+
return {
|
|
62
|
+
entity,
|
|
63
|
+
fieldName: column.fieldName(),
|
|
64
|
+
columnName: column.columnName(),
|
|
65
|
+
gqlType: hashId ? 'ID' : column.gqlType(),
|
|
66
|
+
dbType: column.dataType(),
|
|
67
|
+
isAutoIncrement: column.data.autoIncrement,
|
|
68
|
+
isArray: false,
|
|
69
|
+
isNullable: true,
|
|
70
|
+
isPrimary: false,
|
|
71
|
+
isUpdatable: true,
|
|
72
|
+
isGQLOpen: !(column.table.gqlOption.mutations.find(it => it.type === 'update')
|
|
73
|
+
?.contextFields || []).some(it => it.column === column.columnName()),
|
|
74
|
+
column: column.data,
|
|
75
|
+
option: column.data.option,
|
|
76
|
+
hashId: getHashId(store, entity.name, column),
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Table, TableHandler } from '../../migration/serializable/table.js';
|
|
2
|
+
import { ReferenceColumn } from '../../migration/serializable/column.js';
|
|
3
|
+
import { DataStoreHandler } from '../../migration/dataStore.js';
|
|
4
|
+
import { VirtualRelation } from '../../migration/data/virtualRelation.js';
|
|
5
|
+
import { JoinConditionNode } from './JoinConditionNode.js';
|
|
6
|
+
import { EntityNode } from './entityNode.js';
|
|
7
|
+
export declare class ReferenceNode {
|
|
8
|
+
readonly entity: EntityNode;
|
|
9
|
+
readonly fieldName: string;
|
|
10
|
+
readonly tableName: string;
|
|
11
|
+
readonly parentTableName: string;
|
|
12
|
+
readonly joinCondition: JoinConditionNode[];
|
|
13
|
+
readonly isArray: boolean;
|
|
14
|
+
readonly isNullable: boolean;
|
|
15
|
+
readonly isPrimary: boolean;
|
|
16
|
+
readonly isGQLOpen: boolean;
|
|
17
|
+
static fromReference(entity: EntityNode, column: ReferenceColumn, parentTable: Table): ReferenceNode | null;
|
|
18
|
+
static formVirtualRelation(ds: DataStoreHandler, entity: EntityNode, rel: VirtualRelation): ReferenceNode | null;
|
|
19
|
+
private constructor();
|
|
20
|
+
}
|
|
21
|
+
export declare class ReferencedNode {
|
|
22
|
+
readonly entity: EntityNode;
|
|
23
|
+
readonly fieldName: string;
|
|
24
|
+
readonly childTable: string;
|
|
25
|
+
readonly joinCondition: JoinConditionNode[];
|
|
26
|
+
readonly isArray: boolean;
|
|
27
|
+
readonly isNullable: boolean;
|
|
28
|
+
readonly isPrimary: boolean;
|
|
29
|
+
readonly isGQLOpen: boolean;
|
|
30
|
+
static fromReference(entity: EntityNode, parentTable: TableHandler, column: ReferenceColumn): ReferencedNode | null;
|
|
31
|
+
static fromVirtualRelation(ds: DataStoreHandler, entity: EntityNode, rel: VirtualRelation): ReferencedNode | null;
|
|
32
|
+
private constructor();
|
|
33
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Conditions } from '../../migration/makeCondition.js';
|
|
2
|
+
export class ReferenceNode {
|
|
3
|
+
static fromReference(entity, column, parentTable) {
|
|
4
|
+
const ref = column.data.reference;
|
|
5
|
+
if (!ref.fieldName)
|
|
6
|
+
return null;
|
|
7
|
+
return new ReferenceNode(entity, ref.fieldName, column.table.tableName, ref.parentTable, makeJoinCondition(ref.parentColumn, column.columnName()), false, false, column.isPrimary(), column.table.gqlOption.enabled && parentTable.gqlOption.enabled);
|
|
8
|
+
}
|
|
9
|
+
static formVirtualRelation(ds, entity, rel) {
|
|
10
|
+
if (!rel.childFieldName)
|
|
11
|
+
return null;
|
|
12
|
+
return new ReferenceNode(entity, rel.childFieldName, rel.childTable, rel.parentTable, rel.conditions, rel.childType === undefined || rel.childType === 'array', rel.childType === 'nullable', false, ds.table(rel.parentTable).gqlOption.enabled &&
|
|
13
|
+
ds.table(rel.childTable).gqlOption.enabled);
|
|
14
|
+
}
|
|
15
|
+
constructor(entity, fieldName, tableName, parentTableName, joinCondition, isArray, isNullable, isPrimary, isGQLOpen) {
|
|
16
|
+
this.entity = entity;
|
|
17
|
+
this.fieldName = fieldName;
|
|
18
|
+
this.tableName = tableName;
|
|
19
|
+
this.parentTableName = parentTableName;
|
|
20
|
+
this.joinCondition = joinCondition;
|
|
21
|
+
this.isArray = isArray;
|
|
22
|
+
this.isNullable = isNullable;
|
|
23
|
+
this.isPrimary = isPrimary;
|
|
24
|
+
this.isGQLOpen = isGQLOpen;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class ReferencedNode {
|
|
28
|
+
static fromReference(entity, parentTable, column) {
|
|
29
|
+
const ref = column.data.reference;
|
|
30
|
+
if (!ref.parentFieldName)
|
|
31
|
+
return null;
|
|
32
|
+
return new ReferencedNode(entity, ref.parentFieldName, column.table.tableName, makeJoinCondition(column.columnName(), ref.parentColumn), ref.relation === 'Many', ref.relation === 'OneOrZero', column.isPrimary(), parentTable.gqlOption.enabled && column.table.gqlOption.enabled);
|
|
33
|
+
}
|
|
34
|
+
static fromVirtualRelation(ds, entity, rel) {
|
|
35
|
+
if (!rel.parentFieldName)
|
|
36
|
+
return null;
|
|
37
|
+
return new ReferencedNode(entity, rel.parentFieldName, rel.childTable, rel.conditions.map(reverseConditionNode), rel.parentType === undefined || rel.parentType === 'array', rel.parentType === 'nullable', false, ds.table(rel.parentTable).gqlOption.enabled &&
|
|
38
|
+
ds.table(rel.childTable).gqlOption.enabled);
|
|
39
|
+
}
|
|
40
|
+
constructor(entity, fieldName, childTable, joinCondition, isArray, isNullable, isPrimary, isGQLOpen) {
|
|
41
|
+
this.entity = entity;
|
|
42
|
+
this.fieldName = fieldName;
|
|
43
|
+
this.childTable = childTable;
|
|
44
|
+
this.joinCondition = joinCondition;
|
|
45
|
+
this.isArray = isArray;
|
|
46
|
+
this.isNullable = isNullable;
|
|
47
|
+
this.isPrimary = isPrimary;
|
|
48
|
+
this.isGQLOpen = isGQLOpen;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const reverseConditionValue = (cv) => {
|
|
52
|
+
if (cv.kind === 'parent') {
|
|
53
|
+
return {
|
|
54
|
+
...cv,
|
|
55
|
+
kind: 'child',
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else if (cv.kind === 'child') {
|
|
59
|
+
return {
|
|
60
|
+
...cv,
|
|
61
|
+
kind: 'parent',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return cv;
|
|
65
|
+
};
|
|
66
|
+
const reverseRangeCondition = (condition) => {
|
|
67
|
+
if (condition.kind === 'range') {
|
|
68
|
+
return {
|
|
69
|
+
kind: condition.kind,
|
|
70
|
+
begin: reverseConditionValue(condition.begin),
|
|
71
|
+
end: reverseConditionValue(condition.end),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return condition;
|
|
75
|
+
};
|
|
76
|
+
const reverseConditionNode = (condition) => {
|
|
77
|
+
if (condition.kind === 'custom')
|
|
78
|
+
return {
|
|
79
|
+
...condition,
|
|
80
|
+
parentRequiredFields: condition.childRequiredFields,
|
|
81
|
+
childRequiredFields: condition.parentRequiredFields,
|
|
82
|
+
};
|
|
83
|
+
if (condition.operator === 'BETWEEN') {
|
|
84
|
+
return Conditions.rel.between(reverseConditionValue(condition.left), reverseRangeCondition(condition.right));
|
|
85
|
+
}
|
|
86
|
+
return Conditions.rel.comparison(reverseConditionValue(condition.right), condition.operator, reverseConditionValue(condition.left));
|
|
87
|
+
};
|
|
88
|
+
const makeJoinCondition = (parentColumn, childColumn) => {
|
|
89
|
+
return [
|
|
90
|
+
Conditions.rel.comparison(Conditions.value.parent(parentColumn), '=', Conditions.value.child(childColumn)),
|
|
91
|
+
];
|
|
92
|
+
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { DBColumnTypes } from '../../migration/column/columnTypes.js';
|
|
2
2
|
import { DataStoreHandler } from '../../migration/dataStore.js';
|
|
3
|
-
import {
|
|
4
|
-
import { ReferenceColumn } from '../../migration/serializable/column.js';
|
|
5
|
-
import { ColumnOptions, SerializedColumn } from '../../migration/serialized/serializedColumn.js';
|
|
3
|
+
import { TableHandler } from '../../migration/serializable/table.js';
|
|
6
4
|
import { EntityName } from './entityName.js';
|
|
7
5
|
import { GQLPrimitive } from '../scripts/gqlTypes.js';
|
|
8
|
-
import { VirtualRelation } from '../../migration/data/virtualRelation.js';
|
|
9
|
-
import { JoinConditionNode } from './JoinConditionNode.js';
|
|
10
6
|
import { GQLQuery } from '../../migration/data/GQLOption.js';
|
|
11
7
|
import { MutationNode } from './mutationNode.js';
|
|
8
|
+
import { ReferencedNode, ReferenceNode } from './ReferencedNode.js';
|
|
9
|
+
import { FieldNode } from './FieldNode.js';
|
|
12
10
|
export declare class EntityNode {
|
|
13
11
|
readonly name: EntityName;
|
|
14
12
|
readonly tableName: string;
|
|
@@ -26,56 +24,11 @@ export declare class EntityNode {
|
|
|
26
24
|
identifyFields(): FieldNode[];
|
|
27
25
|
primaryQueryName(): string;
|
|
28
26
|
}
|
|
29
|
-
|
|
30
|
-
readonly entity: EntityNode;
|
|
31
|
-
readonly fieldName: string;
|
|
32
|
-
readonly tableName: string;
|
|
33
|
-
readonly parentTableName: string;
|
|
34
|
-
readonly joinCondition: JoinConditionNode[];
|
|
35
|
-
readonly isArray: boolean;
|
|
36
|
-
readonly isNullable: boolean;
|
|
37
|
-
readonly isPrimary: boolean;
|
|
38
|
-
readonly isGQLOpen: boolean;
|
|
39
|
-
static fromReference(entity: EntityNode, column: ReferenceColumn, parentTable: Table): ReferenceNode | null;
|
|
40
|
-
static formVirtualRelation(ds: DataStoreHandler, entity: EntityNode, rel: VirtualRelation): ReferenceNode | null;
|
|
41
|
-
private constructor();
|
|
42
|
-
}
|
|
43
|
-
export declare class ReferencedNode {
|
|
44
|
-
readonly entity: EntityNode;
|
|
45
|
-
readonly fieldName: string;
|
|
46
|
-
readonly childTable: string;
|
|
47
|
-
readonly joinCondition: JoinConditionNode[];
|
|
48
|
-
readonly isArray: boolean;
|
|
49
|
-
readonly isNullable: boolean;
|
|
50
|
-
readonly isPrimary: boolean;
|
|
51
|
-
readonly isGQLOpen: boolean;
|
|
52
|
-
static fromReference(entity: EntityNode, parentTable: TableHandler, column: ReferenceColumn): ReferencedNode | null;
|
|
53
|
-
static fromVirtualRelation(ds: DataStoreHandler, entity: EntityNode, rel: VirtualRelation): ReferencedNode | null;
|
|
54
|
-
private constructor();
|
|
55
|
-
}
|
|
56
|
-
export type SubTypeNode = {
|
|
27
|
+
type SubTypeNode = {
|
|
57
28
|
gqlEnabled: boolean;
|
|
58
29
|
fields: FieldNode[];
|
|
59
30
|
};
|
|
60
|
-
|
|
61
|
-
entity: EntityNode;
|
|
62
|
-
fieldName: string;
|
|
63
|
-
columnName: string;
|
|
64
|
-
gqlType: GQLPrimitive | string;
|
|
65
|
-
dbType: DBColumnTypes;
|
|
66
|
-
isNullable: boolean;
|
|
67
|
-
isArray: boolean;
|
|
68
|
-
isPrimary: boolean;
|
|
69
|
-
isUpdatable: boolean;
|
|
70
|
-
isGQLOpen: boolean;
|
|
71
|
-
isAutoIncrement: boolean;
|
|
72
|
-
column: SerializedColumn;
|
|
73
|
-
option: ColumnOptions;
|
|
74
|
-
hashId?: {
|
|
75
|
-
encoder: string;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
export type FindMethodNode = {
|
|
31
|
+
type FindMethodNode = {
|
|
79
32
|
name: string;
|
|
80
33
|
params: ParameterNode[];
|
|
81
34
|
isArray: boolean;
|
|
@@ -2,86 +2,9 @@ import { makeFindQueryName } from '../codegen/names.js';
|
|
|
2
2
|
import { EntityName } from './entityName.js';
|
|
3
3
|
import { columnTypeToGqlPrimitive } from '../scripts/columnToGqlType.js';
|
|
4
4
|
import { nonNullable } from '../../runtime/util.js';
|
|
5
|
-
import { Conditions } from '../../migration/makeCondition.js';
|
|
6
5
|
import { makeEntityMutationNodes } from '../parser/makeMutationNodes.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (column.data.option.autoIncrementHashId)
|
|
10
|
-
return { encoder: entity.IDEncoderName() };
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
const ref = column.data.reference;
|
|
14
|
-
const parent = store.table(ref.parentTable);
|
|
15
|
-
if (!parent.column(ref.parentColumn).data.option.autoIncrementHashId)
|
|
16
|
-
return undefined;
|
|
17
|
-
return {
|
|
18
|
-
encoder: parent.getEntityName().IDEncoderName(),
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
const makeFieldNode = (store, entity, column) => {
|
|
22
|
-
const hashId = getHashId(store, entity.name, column);
|
|
23
|
-
return {
|
|
24
|
-
entity,
|
|
25
|
-
fieldName: column.fieldName(),
|
|
26
|
-
columnName: column.columnName(),
|
|
27
|
-
gqlType: hashId ? 'ID' : column.gqlType(),
|
|
28
|
-
dbType: column.dataType(),
|
|
29
|
-
isAutoIncrement: column.data.autoIncrement,
|
|
30
|
-
isArray: false,
|
|
31
|
-
isPrimary: column.isPrimary(),
|
|
32
|
-
isNullable: column.isNullable(),
|
|
33
|
-
isUpdatable: !(column.data.onUpdateCurrentTimeStamp || column.isPrimary()) &&
|
|
34
|
-
column.data.option.updatable,
|
|
35
|
-
isGQLOpen: true,
|
|
36
|
-
column: column.data,
|
|
37
|
-
option: column.data.option,
|
|
38
|
-
hashId,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
const makeCreatableFieldNode = (store, entity, column) => {
|
|
42
|
-
if (column.data.autoIncrement || column.data.defaultCurrentTimeStamp)
|
|
43
|
-
return null;
|
|
44
|
-
const hashId = getHashId(store, entity.name, column);
|
|
45
|
-
return {
|
|
46
|
-
entity,
|
|
47
|
-
fieldName: column.fieldName(),
|
|
48
|
-
columnName: column.columnName(),
|
|
49
|
-
gqlType: hashId ? 'ID' : column.gqlType(),
|
|
50
|
-
dbType: column.dataType(),
|
|
51
|
-
isAutoIncrement: column.data.autoIncrement,
|
|
52
|
-
isArray: false,
|
|
53
|
-
isPrimary: column.isPrimary(),
|
|
54
|
-
isNullable: column.isNullableOnCreate(),
|
|
55
|
-
isUpdatable: column.isUpdatable(),
|
|
56
|
-
isGQLOpen: !(column.table.gqlOption.mutations.find(it => it.type === 'create')
|
|
57
|
-
?.contextFields || []).some(it => it.column === column.columnName()),
|
|
58
|
-
column: column.data,
|
|
59
|
-
option: column.data.option,
|
|
60
|
-
hashId: getHashId(store, entity.name, column),
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
const makeUpdatableFieldNode = (store, entity, column) => {
|
|
64
|
-
if (!column.isUpdatable() || !column.data.option.updatable)
|
|
65
|
-
return null;
|
|
66
|
-
const hashId = getHashId(store, entity.name, column);
|
|
67
|
-
return {
|
|
68
|
-
entity,
|
|
69
|
-
fieldName: column.fieldName(),
|
|
70
|
-
columnName: column.columnName(),
|
|
71
|
-
gqlType: hashId ? 'ID' : column.gqlType(),
|
|
72
|
-
dbType: column.dataType(),
|
|
73
|
-
isAutoIncrement: column.data.autoIncrement,
|
|
74
|
-
isArray: false,
|
|
75
|
-
isNullable: true,
|
|
76
|
-
isPrimary: false,
|
|
77
|
-
isUpdatable: true,
|
|
78
|
-
isGQLOpen: !(column.table.gqlOption.mutations.find(it => it.type === 'update')
|
|
79
|
-
?.contextFields || []).some(it => it.column === column.columnName()),
|
|
80
|
-
column: column.data,
|
|
81
|
-
option: column.data.option,
|
|
82
|
-
hashId: getHashId(store, entity.name, column),
|
|
83
|
-
};
|
|
84
|
-
};
|
|
6
|
+
import { ReferencedNode, ReferenceNode } from './ReferencedNode.js';
|
|
7
|
+
import { makeCreatableFieldNode, makeFieldNode, makeUpdatableFieldNode, } from './FieldNode.js';
|
|
85
8
|
export class EntityNode {
|
|
86
9
|
constructor(store, table) {
|
|
87
10
|
this.name = EntityName.fromTableName(table.tableName);
|
|
@@ -141,60 +64,6 @@ export class EntityNode {
|
|
|
141
64
|
return makeFindQueryName(this.identifyFields().map(it => it.fieldName));
|
|
142
65
|
}
|
|
143
66
|
}
|
|
144
|
-
const makeJoinCondition = (parentColumn, childColumn) => {
|
|
145
|
-
return [
|
|
146
|
-
Conditions.rel.comparison(Conditions.value.parent(parentColumn), '=', Conditions.value.child(childColumn)),
|
|
147
|
-
];
|
|
148
|
-
};
|
|
149
|
-
export class ReferenceNode {
|
|
150
|
-
static fromReference(entity, column, parentTable) {
|
|
151
|
-
const ref = column.data.reference;
|
|
152
|
-
if (!ref.fieldName)
|
|
153
|
-
return null;
|
|
154
|
-
return new ReferenceNode(entity, ref.fieldName, column.table.tableName, ref.parentTable, makeJoinCondition(ref.parentColumn, column.columnName()), false, false, column.isPrimary(), column.table.gqlOption.enabled && parentTable.gqlOption.enabled);
|
|
155
|
-
}
|
|
156
|
-
static formVirtualRelation(ds, entity, rel) {
|
|
157
|
-
if (!rel.childFieldName)
|
|
158
|
-
return null;
|
|
159
|
-
return new ReferenceNode(entity, rel.childFieldName, rel.childTable, rel.parentTable, rel.conditions, rel.childType === undefined || rel.childType === 'array', rel.childType === 'nullable', false, ds.table(rel.parentTable).gqlOption.enabled &&
|
|
160
|
-
ds.table(rel.childTable).gqlOption.enabled);
|
|
161
|
-
}
|
|
162
|
-
constructor(entity, fieldName, tableName, parentTableName, joinCondition, isArray, isNullable, isPrimary, isGQLOpen) {
|
|
163
|
-
this.entity = entity;
|
|
164
|
-
this.fieldName = fieldName;
|
|
165
|
-
this.tableName = tableName;
|
|
166
|
-
this.parentTableName = parentTableName;
|
|
167
|
-
this.joinCondition = joinCondition;
|
|
168
|
-
this.isArray = isArray;
|
|
169
|
-
this.isNullable = isNullable;
|
|
170
|
-
this.isPrimary = isPrimary;
|
|
171
|
-
this.isGQLOpen = isGQLOpen;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
export class ReferencedNode {
|
|
175
|
-
static fromReference(entity, parentTable, column) {
|
|
176
|
-
const ref = column.data.reference;
|
|
177
|
-
if (!ref.parentFieldName)
|
|
178
|
-
return null;
|
|
179
|
-
return new ReferencedNode(entity, ref.parentFieldName, column.table.tableName, makeJoinCondition(column.columnName(), ref.parentColumn), ref.relation === 'Many', ref.relation === 'OneOrZero', column.isPrimary(), parentTable.gqlOption.enabled && column.table.gqlOption.enabled);
|
|
180
|
-
}
|
|
181
|
-
static fromVirtualRelation(ds, entity, rel) {
|
|
182
|
-
if (!rel.parentFieldName)
|
|
183
|
-
return null;
|
|
184
|
-
return new ReferencedNode(entity, rel.parentFieldName, rel.childTable, rel.conditions.map(reverseConditionNode), rel.parentType === undefined || rel.parentType === 'array', rel.parentType === 'nullable', false, ds.table(rel.parentTable).gqlOption.enabled &&
|
|
185
|
-
ds.table(rel.childTable).gqlOption.enabled);
|
|
186
|
-
}
|
|
187
|
-
constructor(entity, fieldName, childTable, joinCondition, isArray, isNullable, isPrimary, isGQLOpen) {
|
|
188
|
-
this.entity = entity;
|
|
189
|
-
this.fieldName = fieldName;
|
|
190
|
-
this.childTable = childTable;
|
|
191
|
-
this.joinCondition = joinCondition;
|
|
192
|
-
this.isArray = isArray;
|
|
193
|
-
this.isNullable = isNullable;
|
|
194
|
-
this.isPrimary = isPrimary;
|
|
195
|
-
this.isGQLOpen = isGQLOpen;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
67
|
const makePrimitiveParameterNode = (fieldName, columnName, dbtype) => ({
|
|
199
68
|
entity: false,
|
|
200
69
|
fieldName,
|
|
@@ -202,40 +71,3 @@ const makePrimitiveParameterNode = (fieldName, columnName, dbtype) => ({
|
|
|
202
71
|
dbtype,
|
|
203
72
|
gqltype: columnTypeToGqlPrimitive(dbtype),
|
|
204
73
|
});
|
|
205
|
-
const reverseConditionValue = (cv) => {
|
|
206
|
-
if (cv.kind === 'parent') {
|
|
207
|
-
return {
|
|
208
|
-
...cv,
|
|
209
|
-
kind: 'child',
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
else if (cv.kind === 'child') {
|
|
213
|
-
return {
|
|
214
|
-
...cv,
|
|
215
|
-
kind: 'parent',
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
return cv;
|
|
219
|
-
};
|
|
220
|
-
const reverseRangeCondition = (condition) => {
|
|
221
|
-
if (condition.kind === 'range') {
|
|
222
|
-
return {
|
|
223
|
-
kind: condition.kind,
|
|
224
|
-
begin: reverseConditionValue(condition.begin),
|
|
225
|
-
end: reverseConditionValue(condition.end),
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
return condition;
|
|
229
|
-
};
|
|
230
|
-
const reverseConditionNode = (condition) => {
|
|
231
|
-
if (condition.kind === 'custom')
|
|
232
|
-
return {
|
|
233
|
-
...condition,
|
|
234
|
-
parentRequiredFields: condition.childRequiredFields,
|
|
235
|
-
childRequiredFields: condition.parentRequiredFields,
|
|
236
|
-
};
|
|
237
|
-
if (condition.operator === 'BETWEEN') {
|
|
238
|
-
return Conditions.rel.between(reverseConditionValue(condition.left), reverseRangeCondition(condition.right));
|
|
239
|
-
}
|
|
240
|
-
return Conditions.rel.comparison(reverseConditionValue(condition.right), condition.operator, reverseConditionValue(condition.left));
|
|
241
|
-
};
|
|
@@ -100,17 +100,16 @@ const makeDeleteMutationNode = (table, entity, mutation) => {
|
|
|
100
100
|
array: false,
|
|
101
101
|
entity: false,
|
|
102
102
|
},
|
|
103
|
-
args:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
103
|
+
args: entity.identifyFields().map(it => ({
|
|
104
|
+
name: it.fieldName,
|
|
105
|
+
type: {
|
|
106
|
+
typeName: it.gqlType,
|
|
107
|
+
nullable: false,
|
|
108
|
+
array: false,
|
|
109
|
+
entity: false,
|
|
110
|
+
dbType: it.dbType,
|
|
112
111
|
},
|
|
113
|
-
|
|
112
|
+
})),
|
|
114
113
|
mutationType: 'delete',
|
|
115
114
|
subscription: mutation.subscription.enabled,
|
|
116
115
|
requireIdDecodeMiddleware: entity.identifyFields().some(it => it.hashId),
|
|
@@ -6,7 +6,7 @@ export interface MigrationStore extends DataStore {
|
|
|
6
6
|
createTable(tableName: string, tableCreator: (table: TableBuilder) => void): MigrationStore;
|
|
7
7
|
dropTable(tableName: string): MigrationStore;
|
|
8
8
|
table(tableName: string): MigrationTable;
|
|
9
|
-
sql(sql: string): MigrationStore;
|
|
9
|
+
sql(...sql: string[]): MigrationStore;
|
|
10
10
|
}
|
|
11
11
|
export declare class StoreMigrator implements MigrationStore {
|
|
12
12
|
protected tables: TableMigrator[];
|
|
@@ -18,7 +18,7 @@ export declare class StoreMigrator implements MigrationStore {
|
|
|
18
18
|
addQuery(...query: string[]): void;
|
|
19
19
|
createTable(tableName: string, tableCreator: (table: TableBuilder) => void): MigrationStore;
|
|
20
20
|
dropTable(tableName: string): MigrationStore;
|
|
21
|
-
sql(sql: string): MigrationStore;
|
|
21
|
+
sql(...sql: string[]): MigrationStore;
|
|
22
22
|
getSql(): string[];
|
|
23
23
|
resetQueue(): void;
|
|
24
24
|
serialize(): SerializedStore;
|
package/lib/tsg/file.d.ts
CHANGED
package/lib/tsg/file.js
CHANGED
|
@@ -15,8 +15,7 @@ export class TsFile extends TsCode {
|
|
|
15
15
|
]
|
|
16
16
|
.map(it => it.toString())
|
|
17
17
|
.join('\n');
|
|
18
|
-
return (
|
|
19
|
-
TsFile.prettier(string));
|
|
18
|
+
return (this.esLintDisabled ? '/* eslint-disable */\n' : '') + string;
|
|
20
19
|
}
|
|
21
20
|
resolveImport(imports) {
|
|
22
21
|
const map = {};
|
|
@@ -41,4 +40,7 @@ export class TsFile extends TsCode {
|
|
|
41
40
|
static prettier(code) {
|
|
42
41
|
return prettier.format(code, { parser: 'typescript' });
|
|
43
42
|
}
|
|
43
|
+
generate() {
|
|
44
|
+
return TsFile.prettier(this.toString());
|
|
45
|
+
}
|
|
44
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sasat",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.23",
|
|
4
4
|
"repository": "https://github.com/nin138/sasat.git",
|
|
5
5
|
"author": "nin138 <ninian138@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
"test:single": "env-cmd jest --silent=false --verbose false",
|
|
22
22
|
"test:base": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
23
23
|
"resetdb": "docker-compose exec db sh -c \"mysql -u root < /docker-entrypoint-initdb.d/temp.sql\"",
|
|
24
|
-
"prepare": "yarn build",
|
|
25
|
-
"postinstall": "husky install",
|
|
24
|
+
"prepare": "yarn build && husky install",
|
|
26
25
|
"sasat": "yarn env-cmd ts-node-esm ./src/cli/cli.ts",
|
|
27
26
|
"server": "yarn env-cmd ts-node-esm -r tsconfig-paths/register ./test/testServer.ts"
|
|
28
27
|
},
|
|
@@ -36,28 +35,28 @@
|
|
|
36
35
|
"js-yaml": "^4.1.0",
|
|
37
36
|
"mysql2": "^3.4.4",
|
|
38
37
|
"pluralize": "^8.0.0",
|
|
39
|
-
"prettier": "^
|
|
38
|
+
"prettier": "^3.0.0",
|
|
40
39
|
"sqlstring": "^2.3.3",
|
|
41
40
|
"typescript": "^5.1.6"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"@apollo/server": "^4.7.5",
|
|
45
44
|
"@types/fs-extra": "11.0.1",
|
|
46
|
-
"@types/jest": "29.5.
|
|
45
|
+
"@types/jest": "29.5.3",
|
|
47
46
|
"@types/js-yaml": "4.0.5",
|
|
48
|
-
"@types/node": "20.
|
|
49
|
-
"@types/pluralize": "0.0.
|
|
47
|
+
"@types/node": "20.4.2",
|
|
48
|
+
"@types/pluralize": "0.0.30",
|
|
50
49
|
"@types/prettier": "2.7.3",
|
|
51
50
|
"@types/sqlstring": "2.3.0",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "
|
|
53
|
-
"@typescript-eslint/parser": "
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "6.0.0",
|
|
52
|
+
"@typescript-eslint/parser": "6.0.0",
|
|
54
53
|
"env-cmd": "10.1.0",
|
|
55
|
-
"eslint": "8.
|
|
54
|
+
"eslint": "8.45.0",
|
|
56
55
|
"eslint-config-prettier": "8.8.0",
|
|
57
56
|
"eslint-plugin-import": "^2.27.5",
|
|
58
|
-
"eslint-plugin-prettier": "
|
|
57
|
+
"eslint-plugin-prettier": "5.0.0",
|
|
59
58
|
"husky": "8.0.3",
|
|
60
|
-
"jest": "29.6.
|
|
59
|
+
"jest": "29.6.1",
|
|
61
60
|
"lint-staged": "13.2.3",
|
|
62
61
|
"sasat": "link:./lib",
|
|
63
62
|
"ts-jest": "29.1.1",
|
|
@@ -74,5 +73,5 @@
|
|
|
74
73
|
]
|
|
75
74
|
},
|
|
76
75
|
"type": "module",
|
|
77
|
-
"packageManager": "yarn@3.6.
|
|
76
|
+
"packageManager": "yarn@3.6.1"
|
|
78
77
|
}
|