typeorm 0.3.22-dev.72145b8 → 0.3.22-dev.ae96f87

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.
@@ -2,6 +2,7 @@ import { SelectQueryBuilder } from "../../query-builder/SelectQueryBuilder";
2
2
  /**
3
3
  * Holds a number of children in the closure table of the column.
4
4
  *
5
- * @deprecated Do not use this decorator, it may be removed in the future versions
5
+ * @deprecated This decorator will removed in the future versions.
6
+ * Use {@link VirtualColumn} to calculate the count instead.
6
7
  */
7
8
  export declare function RelationCount<T>(relation: string | ((object: T) => any), alias?: string, queryBuilderFactory?: (qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>): PropertyDecorator;
@@ -2,7 +2,8 @@ import { getMetadataArgsStorage } from "../../globals";
2
2
  /**
3
3
  * Holds a number of children in the closure table of the column.
4
4
  *
5
- * @deprecated Do not use this decorator, it may be removed in the future versions
5
+ * @deprecated This decorator will removed in the future versions.
6
+ * Use {@link VirtualColumn} to calculate the count instead.
6
7
  */
7
8
  export function RelationCount(relation, alias, queryBuilderFactory) {
8
9
  return function (object, propertyName) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/decorator/relations/RelationCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAItD;;;;GAIG;AACH,MAAM,UAAU,aAAa,CACzB,QAAuC,EACvC,KAAc,EACd,mBAE4B;IAE5B,OAAO,UAAU,MAAc,EAAE,YAAoB;QACjD,sBAAsB,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC;YACzC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,KAAK;YACZ,mBAAmB,EAAE,mBAAmB;SACd,CAAC,CAAA;IACnC,CAAC,CAAA;AACL,CAAC","file":"RelationCount.js","sourcesContent":["import { getMetadataArgsStorage } from \"../../globals\"\nimport { RelationCountMetadataArgs } from \"../../metadata-args/RelationCountMetadataArgs\"\nimport { SelectQueryBuilder } from \"../../query-builder/SelectQueryBuilder\"\n\n/**\n * Holds a number of children in the closure table of the column.\n *\n * @deprecated Do not use this decorator, it may be removed in the future versions\n */\nexport function RelationCount<T>(\n relation: string | ((object: T) => any),\n alias?: string,\n queryBuilderFactory?: (\n qb: SelectQueryBuilder<any>,\n ) => SelectQueryBuilder<any>,\n): PropertyDecorator {\n return function (object: Object, propertyName: string) {\n getMetadataArgsStorage().relationCounts.push({\n target: object.constructor,\n propertyName: propertyName,\n relation: relation,\n alias: alias,\n queryBuilderFactory: queryBuilderFactory,\n } as RelationCountMetadataArgs)\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/decorator/relations/RelationCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAItD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CACzB,QAAuC,EACvC,KAAc,EACd,mBAE4B;IAE5B,OAAO,UAAU,MAAc,EAAE,YAAoB;QACjD,sBAAsB,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC;YACzC,MAAM,EAAE,MAAM,CAAC,WAAW;YAC1B,YAAY,EAAE,YAAY;YAC1B,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,KAAK;YACZ,mBAAmB,EAAE,mBAAmB;SACd,CAAC,CAAA;IACnC,CAAC,CAAA;AACL,CAAC","file":"RelationCount.js","sourcesContent":["import { getMetadataArgsStorage } from \"../../globals\"\nimport { RelationCountMetadataArgs } from \"../../metadata-args/RelationCountMetadataArgs\"\nimport { SelectQueryBuilder } from \"../../query-builder/SelectQueryBuilder\"\n\n/**\n * Holds a number of children in the closure table of the column.\n *\n * @deprecated This decorator will removed in the future versions.\n * Use {@link VirtualColumn} to calculate the count instead.\n */\nexport function RelationCount<T>(\n relation: string | ((object: T) => any),\n alias?: string,\n queryBuilderFactory?: (\n qb: SelectQueryBuilder<any>,\n ) => SelectQueryBuilder<any>,\n): PropertyDecorator {\n return function (object: Object, propertyName: string) {\n getMetadataArgsStorage().relationCounts.push({\n target: object.constructor,\n propertyName: propertyName,\n relation: relation,\n alias: alias,\n queryBuilderFactory: queryBuilderFactory,\n } as RelationCountMetadataArgs)\n }\n}\n"],"sourceRoot":"../.."}
@@ -1615,10 +1615,6 @@ export class SelectQueryBuilder extends QueryBuilder {
1615
1615
  });
1616
1616
  }
1617
1617
  else {
1618
- if (column.isVirtualProperty) {
1619
- // Do not add unselected virtual properties to final select
1620
- return;
1621
- }
1622
1618
  finalSelects.push({
1623
1619
  selection: selectionPath,
1624
1620
  aliasName: DriverUtils.buildAlias(this.connection.driver, undefined, aliasName, column.databaseName),
@@ -2460,8 +2456,8 @@ export class SelectQueryBuilder extends QueryBuilder {
2460
2456
  }
2461
2457
  }
2462
2458
  else {
2463
- let andConditions = [];
2464
- for (let key in where) {
2459
+ const andConditions = [];
2460
+ for (const key in where) {
2465
2461
  if (where[key] === undefined || where[key] === null)
2466
2462
  continue;
2467
2463
  const propertyPath = embedPrefix ? embedPrefix + "." + key : key;
@@ -2473,7 +2469,7 @@ export class SelectQueryBuilder extends QueryBuilder {
2473
2469
  if (column) {
2474
2470
  let aliasPath = `${alias}.${propertyPath}`;
2475
2471
  if (column.isVirtualProperty && column.query) {
2476
- aliasPath = `(${column.query(alias)})`;
2472
+ aliasPath = `(${column.query(this.escape(alias))})`;
2477
2473
  }
2478
2474
  // const parameterName = alias + "_" + propertyPath.split(".").join("_") + "_" + parameterIndex;
2479
2475
  // todo: we need to handle other operators as well?
@@ -2482,10 +2478,12 @@ export class SelectQueryBuilder extends QueryBuilder {
2482
2478
  parameterValue = where[key].value;
2483
2479
  }
2484
2480
  if (column.transformer) {
2485
- parameterValue instanceof FindOperator
2486
- ? parameterValue.transformValue(column.transformer)
2487
- : (parameterValue =
2488
- ApplyValueTransformers.transformTo(column.transformer, parameterValue));
2481
+ if (parameterValue instanceof FindOperator) {
2482
+ parameterValue.transformValue(column.transformer);
2483
+ }
2484
+ else {
2485
+ parameterValue = ApplyValueTransformers.transformTo(column.transformer, parameterValue);
2486
+ }
2489
2487
  }
2490
2488
  // if (parameterValue === null) {
2491
2489
  // andConditions.push(`${aliasPath} IS NULL`);