sasat 0.14.8 → 0.14.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/lib/cli/commands/dumpDb.js +1 -1
- package/lib/cli/commands/migrate.js +1 -1
- package/lib/db/connectors/mockClient.d.ts +1 -1
- package/lib/db/connectors/mockClient.js +1 -1
- package/lib/db/formatQuery.js +1 -1
- package/lib/db/sql/createTable/createTableParser.js +1 -1
- package/lib/db/sql/createTable/createTableSerializer.js +1 -1
- package/lib/generator/ts/code/importDeclaration.js +1 -1
- package/lib/generator/ts/staticFiles.js +1 -1
- package/lib/migration/front/tableMigrator.d.ts +1 -1
- package/lib/migration/front/tableMigrator.js +1 -1
- package/lib/migration/migrationReader.js +3 -3
- package/lib/migration/migrationTargetResolver.js +1 -1
- package/lib/migration/serialized/serializedColumn.d.ts +1 -1
- package/lib/parser/node/relationNode.d.ts +1 -1
- package/lib/parser/node/repositoryNode.js +1 -1
- package/lib/runtime/dsl/mutation/mutation.d.ts +1 -1
- package/lib/runtime/dsl/query/createQueryResolveInfo.d.ts +1 -1
- package/lib/runtime/dsl/query/fieldToQuery.d.ts +1 -1
- package/lib/runtime/dsl/query/query.d.ts +1 -1
- package/lib/runtime/dsl/replaceAliases.js +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { SqlString } from '../../runtime/sql/sqlString.js';
|
|
|
4
4
|
import { writeYmlFile } from '../../util/fsUtil.js';
|
|
5
5
|
import { DBColumnTypes } from '../../migration/column/columnTypes.js';
|
|
6
6
|
import { config } from '../../config/config.js';
|
|
7
|
-
import { getDbClient } from
|
|
7
|
+
import { getDbClient } from '../../db/getDbClient.js';
|
|
8
8
|
export const dumpDB = async () => {
|
|
9
9
|
const con = getDbClient();
|
|
10
10
|
try {
|
|
@@ -4,7 +4,7 @@ import { Parser } from '../../parser/parser.js';
|
|
|
4
4
|
import { CodeGenerateController } from '../../generator/controller.js';
|
|
5
5
|
import { DataStoreHandler } from '../../migration/dataStore.js';
|
|
6
6
|
import { writeCurrentSchema } from '../../util/fsUtil.js';
|
|
7
|
-
import { getDbClient } from
|
|
7
|
+
import { getDbClient } from '../../db/getDbClient.js';
|
|
8
8
|
export const migrate = async (options) => {
|
|
9
9
|
let current;
|
|
10
10
|
try {
|
package/lib/db/formatQuery.js
CHANGED
|
@@ -205,7 +205,7 @@ export class CreateTableParser {
|
|
|
205
205
|
targetTable,
|
|
206
206
|
targetColumn,
|
|
207
207
|
columnName,
|
|
208
|
-
relation: isColumnUnique ?
|
|
208
|
+
relation: isColumnUnique ? 'OneOrZero' : 'Many',
|
|
209
209
|
relationName: sameTableRefs.length !== 0 ? targetTable + sameTableRefs.length : undefined,
|
|
210
210
|
onUpdate,
|
|
211
211
|
onDelete,
|
|
@@ -65,7 +65,7 @@ const startStrMap = [
|
|
|
65
65
|
targetTable,
|
|
66
66
|
targetColumn,
|
|
67
67
|
columnName,
|
|
68
|
-
relation: isColumnUnique ?
|
|
68
|
+
relation: isColumnUnique ? 'OneOrZero' : 'Many',
|
|
69
69
|
relationName: sameTableRefs.length !== 0 ? targetTable + sameTableRefs.length : undefined,
|
|
70
70
|
onUpdate: onUpdate !== -1 ? tokens[onUpdate + 1].value : undefined,
|
|
71
71
|
onDelete: onDelete !== -1 ? tokens[onDelete + 1].value : undefined,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImportDeclaration } from
|
|
1
|
+
import { ImportDeclaration } from './code/importDeclaration.js';
|
|
2
2
|
const contextFile = `\
|
|
3
3
|
${new ImportDeclaration(['BaseGqlContext'], './__generated__/context').toString()}
|
|
4
4
|
export interface GqlContext extends BaseGqlContext {}
|
|
@@ -6,7 +6,7 @@ import { GqlOption } from '../data/gqlOption.js';
|
|
|
6
6
|
import { Column } from '../serializable/column.js';
|
|
7
7
|
import { SerializedTable } from '../serialized/serializedStore.js';
|
|
8
8
|
import { DBType } from '../column/columnTypes.js';
|
|
9
|
-
import { DBIndex } from
|
|
9
|
+
import { DBIndex } from '../data/index.js';
|
|
10
10
|
export interface MigrationTable extends Table {
|
|
11
11
|
addIndex(...columns: string[]): MigrationTable;
|
|
12
12
|
removeIndex(...columns: string[]): MigrationTable;
|
|
@@ -2,7 +2,7 @@ import { TableHandler } from '../serializable/table.js';
|
|
|
2
2
|
import { NormalColumn } from '../serializable/column.js';
|
|
3
3
|
import { SqlCreator } from '../../db/sql/sqlCreater.js';
|
|
4
4
|
import { SqlString } from '../../runtime/sql/sqlString.js';
|
|
5
|
-
import { DBIndex } from
|
|
5
|
+
import { DBIndex } from '../data/index.js';
|
|
6
6
|
export class TableMigrator {
|
|
7
7
|
constructor(table, store) {
|
|
8
8
|
this.table = table;
|
|
@@ -4,7 +4,7 @@ import * as fs from 'fs';
|
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import ts from 'typescript';
|
|
6
6
|
import { readInitialSchema } from '../util/fsUtil.js';
|
|
7
|
-
import { config } from
|
|
7
|
+
import { config } from '../config/config.js';
|
|
8
8
|
export class MigrationReader {
|
|
9
9
|
read(onMigrate) {
|
|
10
10
|
const files = fs.readdirSync(MigrationTargetResolver.getMigrationDir());
|
|
@@ -21,11 +21,11 @@ export class MigrationReader {
|
|
|
21
21
|
return store;
|
|
22
22
|
}
|
|
23
23
|
static getTsConfig() {
|
|
24
|
-
const configFileName = ts.findConfigFile(
|
|
24
|
+
const configFileName = ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
|
|
25
25
|
if (!configFileName)
|
|
26
26
|
return undefined;
|
|
27
27
|
const configFile = ts.readConfigFile(configFileName, ts.sys.readFile);
|
|
28
|
-
return ts.parseJsonConfigFileContent(configFile.config, ts.sys,
|
|
28
|
+
return ts.parseJsonConfigFileContent(configFile.config, ts.sys, './').options;
|
|
29
29
|
}
|
|
30
30
|
static readMigration(store, fileName, direction) {
|
|
31
31
|
const file = fs.readFileSync(path.join(MigrationTargetResolver.getMigrationDir(), fileName)).toString();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { config } from '../config/config.js';
|
|
4
|
-
import { getDbClient } from
|
|
4
|
+
import { getDbClient } from '../db/getDbClient.js';
|
|
5
5
|
export var Direction;
|
|
6
6
|
(function (Direction) {
|
|
7
7
|
Direction["Up"] = "up";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DBColumnTypes } from '../column/columnTypes.js';
|
|
2
2
|
import { SqlValueType } from '../../db/connectors/dbClient.js';
|
|
3
3
|
import { ForeignKeyReferentialAction } from '../data/foreignKey.js';
|
|
4
|
-
import { Relation } from
|
|
4
|
+
import { Relation } from '../data/relation.js';
|
|
5
5
|
interface SerializedColumnBase {
|
|
6
6
|
hasReference: boolean;
|
|
7
7
|
fieldName: string;
|
|
@@ -2,7 +2,7 @@ import { TypeNode } from './typeNode.js';
|
|
|
2
2
|
import { EntityNode } from './entityNode.js';
|
|
3
3
|
import { ReferenceColumn } from '../../migration/serializable/column.js';
|
|
4
4
|
import { EntityName } from './entityName.js';
|
|
5
|
-
import { Relation } from
|
|
5
|
+
import { Relation } from '../../migration/data/relation.js';
|
|
6
6
|
export declare class RelationNode {
|
|
7
7
|
readonly parent: EntityNode;
|
|
8
8
|
readonly relationName: string | undefined;
|
|
@@ -36,7 +36,7 @@ export class RepositoryNode {
|
|
|
36
36
|
const refMethods = (relation) => {
|
|
37
37
|
return new FindMethodNode([
|
|
38
38
|
new ParameterNode(relation.fromField, new TypeNode(relation.parent.field(relation.fromField).dbType, false, false)),
|
|
39
|
-
], new TypeNode(EntityName.fromTableName(relation.parent.repository.tableName), relation.relation ===
|
|
39
|
+
], new TypeNode(EntityName.fromTableName(relation.parent.repository.tableName), relation.relation === 'Many', false), false);
|
|
40
40
|
};
|
|
41
41
|
const referencedByMethod = (relation) => {
|
|
42
42
|
const to = relation.parent.repository.root.findRepository(relation.toEntityName);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SqlValueType } from '../../../db/connectors/dbClient.js';
|
|
2
2
|
import { TableInfo } from '../query/createQueryResolveInfo.js';
|
|
3
|
-
import { BooleanValueExpression } from
|
|
3
|
+
import { BooleanValueExpression } from '../query/query.js';
|
|
4
4
|
declare type ValueSet = {
|
|
5
5
|
field: string;
|
|
6
6
|
value: SqlValueType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BooleanValueExpression } from './query.js';
|
|
2
2
|
import { QueryResolveInfo } from './sql/hydrate.js';
|
|
3
|
-
import { Fields } from
|
|
3
|
+
import { Fields } from '../../field.js';
|
|
4
4
|
export declare type RelationInfo = {
|
|
5
5
|
table: string;
|
|
6
6
|
on: (parentTableAlias: string, childTableAlias: string) => BooleanValueExpression;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Query } from './query.js';
|
|
2
2
|
import { RelationMap } from './createQueryResolveInfo.js';
|
|
3
|
-
import { Fields } from
|
|
3
|
+
import { Fields } from '../../field.js';
|
|
4
4
|
export declare const fieldToQuery: (tableName: string, fields: Fields, map: RelationMap) => Query;
|
|
@@ -56,7 +56,7 @@ export const replaceAliases = (query, tableInfo) => {
|
|
|
56
56
|
addAlias(query.from);
|
|
57
57
|
const replaceAlias = createAliasReplacer(tableInfo, tableAliases);
|
|
58
58
|
return {
|
|
59
|
-
select: query.select.map(replaceAlias),
|
|
59
|
+
select: query.select.map(replaceAlias).filter(it => it.kind !== QueryNodeKind.Field || it.name),
|
|
60
60
|
from: replaceAlias(query.from),
|
|
61
61
|
where: query.where ? replaceAlias(query.where) : undefined,
|
|
62
62
|
sort: query.sort ? query.sort.map(replaceAlias) : undefined,
|