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.
@@ -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 "../../db/getDbClient.js";
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 "../../db/getDbClient.js";
7
+ import { getDbClient } from '../../db/getDbClient.js';
8
8
  export const migrate = async (options) => {
9
9
  let current;
10
10
  try {
@@ -1,4 +1,4 @@
1
- import { DBClient, SQLTransaction } from "./dbClient.js";
1
+ import { DBClient, SQLTransaction } from './dbClient.js';
2
2
  declare class MockDBTransaction extends SQLTransaction {
3
3
  commit(): Promise<void>;
4
4
  protected execSql(): Promise<never[]>;
@@ -1,4 +1,4 @@
1
- import { DBClient, SQLTransaction } from "./dbClient.js";
1
+ import { DBClient, SQLTransaction } from './dbClient.js';
2
2
  class MockDBTransaction extends SQLTransaction {
3
3
  commit() {
4
4
  return Promise.resolve();
@@ -1,4 +1,4 @@
1
- import { SqlString } from "../runtime/sql/sqlString.js";
1
+ import { SqlString } from '../runtime/sql/sqlString.js';
2
2
  export const formatQuery = (str, ...params) => {
3
3
  let ret = str[0];
4
4
  for (let i = 0; i < params.length; i++) {
@@ -205,7 +205,7 @@ export class CreateTableParser {
205
205
  targetTable,
206
206
  targetColumn,
207
207
  columnName,
208
- relation: isColumnUnique ? "OneOrZero" : "Many",
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 ? "OneOrZero" : "Many",
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 { config } from "../../../config/config.js";
1
+ import { config } from '../../../config/config.js';
2
2
  export class ImportDeclaration {
3
3
  constructor(types, module) {
4
4
  this.types = types;
@@ -1,4 +1,4 @@
1
- import { ImportDeclaration } from "./code/importDeclaration.js";
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 "../data/index.js";
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 "../data/index.js";
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 "../config/config.js";
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("./", ts.sys.fileExists, "tsconfig.json");
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, "./").options;
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 "../db/getDbClient.js";
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 "../data/relation.js";
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 "../../migration/data/relation.js";
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 === "Many", false), false);
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 "../query/query.js";
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 "../../field.js";
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 "../../field.js";
3
+ import { Fields } from '../../field.js';
4
4
  export declare const fieldToQuery: (tableName: string, fields: Fields, map: RelationMap) => Query;
@@ -1,4 +1,4 @@
1
- import { ComparisonOperators } from "../../../db/sql/expression/comparison.js";
1
+ import { ComparisonOperators } from '../../../db/sql/expression/comparison.js';
2
2
  export declare enum QueryNodeKind {
3
3
  Field = 0,
4
4
  Function = 1,
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sasat",
3
- "version": "0.14.8",
3
+ "version": "0.14.9",
4
4
  "repository": "https://github.com/yanokunpei/sasat.git",
5
5
  "author": "yanokunpei <ninian138@gmail.com>",
6
6
  "license": "MIT",