typeorm 0.3.23-dev.c15cb07 → 0.3.23-dev.fe71a0c

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.
Files changed (89) hide show
  1. package/browser/cache/DbQueryResultCache.js +1 -1
  2. package/browser/cache/DbQueryResultCache.js.map +1 -1
  3. package/browser/cache/RedisQueryResultCache.js +1 -1
  4. package/browser/cache/RedisQueryResultCache.js.map +1 -1
  5. package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js +2 -2
  6. package/browser/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
  7. package/browser/driver/cockroachdb/CockroachQueryRunner.js +2 -2
  8. package/browser/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
  9. package/browser/driver/cordova/CordovaQueryRunner.js +2 -2
  10. package/browser/driver/cordova/CordovaQueryRunner.js.map +1 -1
  11. package/browser/driver/expo/ExpoQueryRunner.js +2 -2
  12. package/browser/driver/expo/ExpoQueryRunner.js.map +1 -1
  13. package/browser/driver/expo/legacy/ExpoLegacyQueryRunner.js +2 -2
  14. package/browser/driver/expo/legacy/ExpoLegacyQueryRunner.js.map +1 -1
  15. package/browser/driver/mysql/MysqlConnectionOptions.d.ts +6 -0
  16. package/browser/driver/mysql/MysqlConnectionOptions.js.map +1 -1
  17. package/browser/driver/mysql/MysqlQueryRunner.js +8 -3
  18. package/browser/driver/mysql/MysqlQueryRunner.js.map +1 -1
  19. package/browser/driver/nativescript/NativescriptQueryRunner.js +2 -2
  20. package/browser/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
  21. package/browser/driver/oracle/OracleQueryRunner.js +2 -2
  22. package/browser/driver/oracle/OracleQueryRunner.js.map +1 -1
  23. package/browser/driver/postgres/PostgresQueryRunner.js +2 -2
  24. package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
  25. package/browser/driver/react-native/ReactNativeQueryRunner.js +2 -2
  26. package/browser/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
  27. package/browser/driver/sap/SapQueryRunner.js +2 -2
  28. package/browser/driver/sap/SapQueryRunner.js.map +1 -1
  29. package/browser/driver/spanner/SpannerQueryRunner.js +4 -4
  30. package/browser/driver/spanner/SpannerQueryRunner.js.map +1 -1
  31. package/browser/driver/sqlite/SqliteQueryRunner.js +2 -2
  32. package/browser/driver/sqlite/SqliteQueryRunner.js.map +1 -1
  33. package/browser/driver/sqljs/SqljsQueryRunner.js +2 -2
  34. package/browser/driver/sqljs/SqljsQueryRunner.js.map +1 -1
  35. package/browser/driver/sqlserver/SqlServerQueryRunner.js +2 -2
  36. package/browser/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
  37. package/browser/driver/types/GeoJsonTypes.d.ts +20 -15
  38. package/browser/driver/types/GeoJsonTypes.js.map +1 -1
  39. package/browser/metadata/EntityListenerMetadata.js +14 -2
  40. package/browser/metadata/EntityListenerMetadata.js.map +1 -1
  41. package/browser/query-builder/SelectQueryBuilder.js +1 -1
  42. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  43. package/browser/repository/MongoRepository.d.ts +1 -1
  44. package/browser/repository/MongoRepository.js.map +1 -1
  45. package/cache/DbQueryResultCache.js +1 -1
  46. package/cache/DbQueryResultCache.js.map +1 -1
  47. package/cache/RedisQueryResultCache.js +1 -1
  48. package/cache/RedisQueryResultCache.js.map +1 -1
  49. package/driver/better-sqlite3/BetterSqlite3QueryRunner.js +2 -2
  50. package/driver/better-sqlite3/BetterSqlite3QueryRunner.js.map +1 -1
  51. package/driver/cockroachdb/CockroachQueryRunner.js +2 -2
  52. package/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
  53. package/driver/cordova/CordovaQueryRunner.js +2 -2
  54. package/driver/cordova/CordovaQueryRunner.js.map +1 -1
  55. package/driver/expo/ExpoQueryRunner.js +2 -2
  56. package/driver/expo/ExpoQueryRunner.js.map +1 -1
  57. package/driver/expo/legacy/ExpoLegacyQueryRunner.js +2 -2
  58. package/driver/expo/legacy/ExpoLegacyQueryRunner.js.map +1 -1
  59. package/driver/mysql/MysqlConnectionOptions.d.ts +6 -0
  60. package/driver/mysql/MysqlConnectionOptions.js.map +1 -1
  61. package/driver/mysql/MysqlQueryRunner.js +8 -3
  62. package/driver/mysql/MysqlQueryRunner.js.map +1 -1
  63. package/driver/nativescript/NativescriptQueryRunner.js +2 -2
  64. package/driver/nativescript/NativescriptQueryRunner.js.map +1 -1
  65. package/driver/oracle/OracleQueryRunner.js +2 -2
  66. package/driver/oracle/OracleQueryRunner.js.map +1 -1
  67. package/driver/postgres/PostgresQueryRunner.js +2 -2
  68. package/driver/postgres/PostgresQueryRunner.js.map +1 -1
  69. package/driver/react-native/ReactNativeQueryRunner.js +2 -2
  70. package/driver/react-native/ReactNativeQueryRunner.js.map +1 -1
  71. package/driver/sap/SapQueryRunner.js +2 -2
  72. package/driver/sap/SapQueryRunner.js.map +1 -1
  73. package/driver/spanner/SpannerQueryRunner.js +4 -4
  74. package/driver/spanner/SpannerQueryRunner.js.map +1 -1
  75. package/driver/sqlite/SqliteQueryRunner.js +2 -2
  76. package/driver/sqlite/SqliteQueryRunner.js.map +1 -1
  77. package/driver/sqljs/SqljsQueryRunner.js +2 -2
  78. package/driver/sqljs/SqljsQueryRunner.js.map +1 -1
  79. package/driver/sqlserver/SqlServerQueryRunner.js +2 -2
  80. package/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
  81. package/driver/types/GeoJsonTypes.d.ts +20 -15
  82. package/driver/types/GeoJsonTypes.js.map +1 -1
  83. package/metadata/EntityListenerMetadata.js +14 -2
  84. package/metadata/EntityListenerMetadata.js.map +1 -1
  85. package/package.json +1 -1
  86. package/query-builder/SelectQueryBuilder.js +1 -1
  87. package/query-builder/SelectQueryBuilder.js.map +1 -1
  88. package/repository/MongoRepository.d.ts +1 -1
  89. package/repository/MongoRepository.js.map +1 -1
@@ -1,54 +1,59 @@
1
+ /**
2
+ * Position object.
3
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1
4
+ */
5
+ export type Position = number[];
1
6
  /**
2
7
  * Point geometry object.
3
- * https://tools.ietf.org/html/rfc7946#section-3.1.2
8
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.2
4
9
  */
5
10
  export type Point = {
6
11
  type: "Point";
7
- coordinates: number[];
12
+ coordinates: Position;
8
13
  };
9
14
  /**
10
15
  * LineString geometry object.
11
- * https://tools.ietf.org/html/rfc7946#section-3.1.4
16
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.4
12
17
  */
13
18
  export type LineString = {
14
19
  type: "LineString";
15
- coordinates: number[][];
20
+ coordinates: Position[];
16
21
  };
17
22
  /**
18
23
  * Polygon geometry object.
19
- * https://tools.ietf.org/html/rfc7946#section-3.1.6
24
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6
20
25
  */
21
26
  export type Polygon = {
22
27
  type: "Polygon";
23
- coordinates: number[][][];
28
+ coordinates: Position[][];
24
29
  };
25
30
  /**
26
31
  * MultiPoint geometry object.
27
- * https://tools.ietf.org/html/rfc7946#section-3.1.3
32
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.3
28
33
  */
29
34
  export type MultiPoint = {
30
35
  type: "MultiPoint";
31
- coordinates: number[][];
36
+ coordinates: Position[];
32
37
  };
33
38
  /**
34
39
  * MultiLineString geometry object.
35
- * https://tools.ietf.org/html/rfc7946#section-3.1.5
40
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.5
36
41
  */
37
42
  export type MultiLineString = {
38
43
  type: "MultiLineString";
39
- coordinates: number[][][];
44
+ coordinates: Position[][];
40
45
  };
41
46
  /**
42
47
  * MultiPolygon geometry object.
43
- * https://tools.ietf.org/html/rfc7946#section-3.1.7
48
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.7
44
49
  */
45
50
  export type MultiPolygon = {
46
51
  type: "MultiPolygon";
47
- coordinates: number[][][][];
52
+ coordinates: Position[][][];
48
53
  };
49
54
  /**
50
55
  * Geometry Collection
51
- * https://tools.ietf.org/html/rfc7946#section-3.1.8
56
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.8
52
57
  */
53
58
  export type GeometryCollection = {
54
59
  type: "GeometryCollection";
@@ -61,7 +66,7 @@ export type Geometry = Point | LineString | Polygon | MultiPoint | MultiLineStri
61
66
  export type Geography = Geometry;
62
67
  /**
63
68
  * A feature object which contains a geometry and associated properties.
64
- * https://tools.ietf.org/html/rfc7946#section-3.2
69
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.2
65
70
  */
66
71
  export type Feature = {
67
72
  type: "Feature";
@@ -74,7 +79,7 @@ export type Feature = {
74
79
  };
75
80
  /**
76
81
  * A collection of feature objects.
77
- * https://tools.ietf.org/html/rfc7946#section-3.3
82
+ * https://datatracker.ietf.org/doc/html/rfc7946#section-3.3
78
83
  */
79
84
  export type FeatureCollection = {
80
85
  type: "FeatureCollection";
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/types/GeoJsonTypes.ts"],"names":[],"mappings":"","file":"GeoJsonTypes.js","sourcesContent":["/**\n * Point geometry object.\n * https://tools.ietf.org/html/rfc7946#section-3.1.2\n */\nexport type Point = {\n type: \"Point\"\n coordinates: number[]\n}\n\n/**\n * LineString geometry object.\n * https://tools.ietf.org/html/rfc7946#section-3.1.4\n */\nexport type LineString = {\n type: \"LineString\"\n coordinates: number[][]\n}\n\n/**\n * Polygon geometry object.\n * https://tools.ietf.org/html/rfc7946#section-3.1.6\n */\nexport type Polygon = {\n type: \"Polygon\"\n coordinates: number[][][]\n}\n\n/**\n * MultiPoint geometry object.\n * https://tools.ietf.org/html/rfc7946#section-3.1.3\n */\nexport type MultiPoint = {\n type: \"MultiPoint\"\n coordinates: number[][]\n}\n\n/**\n * MultiLineString geometry object.\n * https://tools.ietf.org/html/rfc7946#section-3.1.5\n */\nexport type MultiLineString = {\n type: \"MultiLineString\"\n coordinates: number[][][]\n}\n\n/**\n * MultiPolygon geometry object.\n * https://tools.ietf.org/html/rfc7946#section-3.1.7\n */\nexport type MultiPolygon = {\n type: \"MultiPolygon\"\n coordinates: number[][][][]\n}\n\n/**\n * Geometry Collection\n * https://tools.ietf.org/html/rfc7946#section-3.1.8\n */\nexport type GeometryCollection = {\n type: \"GeometryCollection\"\n geometries: (\n | Point\n | LineString\n | Polygon\n | MultiPoint\n | MultiLineString\n | MultiPolygon\n )[]\n}\n\n/**\n * Union of Geometry objects.\n */\nexport type Geometry =\n | Point\n | LineString\n | Polygon\n | MultiPoint\n | MultiLineString\n | MultiPolygon\n | GeometryCollection\nexport type Geography = Geometry\n\n/**\n * A feature object which contains a geometry and associated properties.\n * https://tools.ietf.org/html/rfc7946#section-3.2\n */\nexport type Feature = {\n type: \"Feature\"\n geometry: Geometry\n id?: string | number\n bbox?: number[]\n properties: { [name: string]: any } | null\n}\n\n/**\n * A collection of feature objects.\n * https://tools.ietf.org/html/rfc7946#section-3.3\n */\nexport type FeatureCollection = {\n type: \"FeatureCollection\"\n bbox?: number[]\n features: Feature[]\n}\n\n/**\n * Union of GeoJSON objects.\n */\nexport type GeoJSON = Geometry | Feature | FeatureCollection\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/types/GeoJsonTypes.ts"],"names":[],"mappings":"","file":"GeoJsonTypes.js","sourcesContent":["/**\n * Position object.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1\n */\nexport type Position = number[]\n\n/**\n * Point geometry object.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.2\n */\nexport type Point = {\n type: \"Point\"\n coordinates: Position\n}\n\n/**\n * LineString geometry object.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.4\n */\nexport type LineString = {\n type: \"LineString\"\n coordinates: Position[]\n}\n\n/**\n * Polygon geometry object.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6\n */\nexport type Polygon = {\n type: \"Polygon\"\n coordinates: Position[][]\n}\n\n/**\n * MultiPoint geometry object.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.3\n */\nexport type MultiPoint = {\n type: \"MultiPoint\"\n coordinates: Position[]\n}\n\n/**\n * MultiLineString geometry object.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.5\n */\nexport type MultiLineString = {\n type: \"MultiLineString\"\n coordinates: Position[][]\n}\n\n/**\n * MultiPolygon geometry object.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.7\n */\nexport type MultiPolygon = {\n type: \"MultiPolygon\"\n coordinates: Position[][][]\n}\n\n/**\n * Geometry Collection\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.8\n */\nexport type GeometryCollection = {\n type: \"GeometryCollection\"\n geometries: (\n | Point\n | LineString\n | Polygon\n | MultiPoint\n | MultiLineString\n | MultiPolygon\n )[]\n}\n\n/**\n * Union of Geometry objects.\n */\nexport type Geometry =\n | Point\n | LineString\n | Polygon\n | MultiPoint\n | MultiLineString\n | MultiPolygon\n | GeometryCollection\nexport type Geography = Geometry\n\n/**\n * A feature object which contains a geometry and associated properties.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.2\n */\nexport type Feature = {\n type: \"Feature\"\n geometry: Geometry\n id?: string | number\n bbox?: number[]\n properties: { [name: string]: any } | null\n}\n\n/**\n * A collection of feature objects.\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.3\n */\nexport type FeatureCollection = {\n type: \"FeatureCollection\"\n bbox?: number[]\n features: Feature[]\n}\n\n/**\n * Union of GeoJSON objects.\n */\nexport type GeoJSON = Geometry | Feature | FeatureCollection\n"],"sourceRoot":"../.."}
@@ -29,8 +29,20 @@ export class EntityListenerMetadata {
29
29
  * Executes listener method of the given entity.
30
30
  */
31
31
  execute(entity) {
32
- if (!this.embeddedMetadata)
33
- return entity[this.propertyName]();
32
+ // Check if the Embedded Metadata does not exist
33
+ if (!this.embeddedMetadata) {
34
+ // Get the Entity's Method
35
+ const entityMethod = entity[this.propertyName];
36
+ // Check if the Entity Method does not exist
37
+ if (!entityMethod)
38
+ throw new Error(`Entity listener method "${this.propertyName}" does not exist in entity "${entity.constructor.name}".`);
39
+ // Check if the Entity Method is not a function
40
+ if (typeof entityMethod !== "function")
41
+ throw new Error(`Entity listener method "${this.propertyName}" in entity "${entity.constructor.name}" must be a function but got "${typeof entityMethod}".`);
42
+ // Call and return the Entity Method
43
+ return entityMethod.call(entity);
44
+ }
45
+ // Call the Embedded Method
34
46
  this.callEntityEmbeddedMethod(entity, this.embeddedMetadata.propertyPath.split("."));
35
47
  }
36
48
  // ---------------------------------------------------------------------
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/metadata/EntityListenerMetadata.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,OAAO,sBAAsB;IA+B/B,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,YAAY,OAIX;QACG,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;QAC5C,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAA;QAChD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAA;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,CAAA;QAC7C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA;IACjC,CAAC;IAED,wEAAwE;IACxE,iBAAiB;IACjB,wEAAwE;IAExE;;OAEG;IACH,SAAS,CAAC,MAAqB;QAC3B,2DAA2D;QAC3D,OAAO,CACH,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,MAAM,CAAC,WAAW,IAAI,oIAAoI;YACzL,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,UAAU;gBAC7C,MAAM,CAAC,WAAW,CAAC,SAAS;oBACxB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CACtC,CAAA,CAAC,yDAAyD;IAC/D,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,MAAqB;QACzB,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAA;QAE9D,IAAI,CAAC,wBAAwB,CACzB,MAAM,EACN,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAChD,CAAA;IACL,CAAC;IAED,wEAAwE;IACxE,oBAAoB;IACpB,wEAAwE;IAExE;;OAEG;IACO,wBAAwB,CAC9B,MAAqB,EACrB,aAAuB;QAEvB,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,EAAE,CAAA;QAC1C,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YAAE,OAAM;QAElD,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;gBACtC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,QAAuB,EAAE,EAAE,CACjD,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAChC,CAAA;YACL,CAAC;iBAAM,CAAC;gBACJ,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAA;YAC7C,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,MAAM,CAAC,YAAY,CAAC;gBACpB,IAAI,CAAC,wBAAwB,CACzB,MAAM,CAAC,YAAY,CAAC,EACpB,aAAa,CAChB,CAAA;QACT,CAAC;IACL,CAAC;CACJ","file":"EntityListenerMetadata.js","sourcesContent":["import { EventListenerType } from \"./types/EventListenerTypes\"\nimport { EntityListenerMetadataArgs } from \"../metadata-args/EntityListenerMetadataArgs\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { EntityMetadata } from \"./EntityMetadata\"\nimport { EmbeddedMetadata } from \"./EmbeddedMetadata\"\n\n/**\n * This metadata contains all information about entity's listeners.\n */\nexport class EntityListenerMetadata {\n // ---------------------------------------------------------------------\n // Properties\n // ---------------------------------------------------------------------\n\n /**\n * Entity metadata of the listener.\n */\n entityMetadata: EntityMetadata\n\n /**\n * Embedded metadata of the listener, in the case if listener is in embedded.\n */\n embeddedMetadata?: EmbeddedMetadata\n\n /**\n * Target class to which metadata is applied.\n * This can be different then entityMetadata.target in the case if listener is in the embedded.\n */\n target: Function | string\n\n /**\n * Target's property name to which this metadata is applied.\n */\n propertyName: string\n\n /**\n * The type of the listener.\n */\n type: EventListenerType\n\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(options: {\n entityMetadata: EntityMetadata\n embeddedMetadata?: EmbeddedMetadata\n args: EntityListenerMetadataArgs\n }) {\n this.entityMetadata = options.entityMetadata\n this.embeddedMetadata = options.embeddedMetadata\n this.target = options.args.target\n this.propertyName = options.args.propertyName\n this.type = options.args.type\n }\n\n // ---------------------------------------------------------------------\n // Public Methods\n // ---------------------------------------------------------------------\n\n /**\n * Checks if entity listener is allowed to be executed on the given entity.\n */\n isAllowed(entity: ObjectLiteral) {\n // todo: create in entity metadata method like isInherited?\n return (\n this.entityMetadata.target === entity.constructor || // todo: .constructor won't work for entity schemas, but there are no entity listeners in schemas since there are no objects, right?\n (typeof this.entityMetadata.target === \"function\" &&\n entity.constructor.prototype instanceof\n this.entityMetadata.target)\n ) // todo: also need to implement entity schema inheritance\n }\n\n /**\n * Executes listener method of the given entity.\n */\n execute(entity: ObjectLiteral) {\n if (!this.embeddedMetadata) return entity[this.propertyName]()\n\n this.callEntityEmbeddedMethod(\n entity,\n this.embeddedMetadata.propertyPath.split(\".\"),\n )\n }\n\n // ---------------------------------------------------------------------\n // Protected Methods\n // ---------------------------------------------------------------------\n\n /**\n * Calls embedded entity listener method no matter how nested it is.\n */\n protected callEntityEmbeddedMethod(\n entity: ObjectLiteral,\n propertyPaths: string[],\n ): void {\n const propertyPath = propertyPaths.shift()\n if (!propertyPath || !entity[propertyPath]) return\n\n if (propertyPaths.length === 0) {\n if (Array.isArray(entity[propertyPath])) {\n entity[propertyPath].map((embedded: ObjectLiteral) =>\n embedded[this.propertyName](),\n )\n } else {\n entity[propertyPath][this.propertyName]()\n }\n } else {\n if (entity[propertyPath])\n this.callEntityEmbeddedMethod(\n entity[propertyPath],\n propertyPaths,\n )\n }\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/metadata/EntityListenerMetadata.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,OAAO,sBAAsB;IA+B/B,wEAAwE;IACxE,cAAc;IACd,wEAAwE;IAExE,YAAY,OAIX;QACG,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;QAC5C,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAA;QAChD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAA;QACjC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,CAAA;QAC7C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA;IACjC,CAAC;IAED,wEAAwE;IACxE,iBAAiB;IACjB,wEAAwE;IAExE;;OAEG;IACH,SAAS,CAAC,MAAqB;QAC3B,2DAA2D;QAC3D,OAAO,CACH,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,MAAM,CAAC,WAAW,IAAI,oIAAoI;YACzL,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,UAAU;gBAC7C,MAAM,CAAC,WAAW,CAAC,SAAS;oBACxB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CACtC,CAAA,CAAC,yDAAyD;IAC/D,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,MAAqB;QACzB,gDAAgD;QAChD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACzB,0BAA0B;YAC1B,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;YAE9C,4CAA4C;YAC5C,IAAI,CAAC,YAAY;gBACb,MAAM,IAAI,KAAK,CACX,2BAA2B,IAAI,CAAC,YAAY,+BAA+B,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,CACzG,CAAA;YAEL,+CAA+C;YAC/C,IAAI,OAAO,YAAY,KAAK,UAAU;gBAClC,MAAM,IAAI,KAAK,CACX,2BAA2B,IAAI,CAAC,YAAY,gBACxC,MAAM,CAAC,WAAW,CAAC,IACvB,iCAAiC,OAAO,YAAY,IAAI,CAC3D,CAAA;YAEL,oCAAoC;YACpC,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACpC,CAAC;QAED,2BAA2B;QAC3B,IAAI,CAAC,wBAAwB,CACzB,MAAM,EACN,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAChD,CAAA;IACL,CAAC;IAED,wEAAwE;IACxE,oBAAoB;IACpB,wEAAwE;IAExE;;OAEG;IACO,wBAAwB,CAC9B,MAAqB,EACrB,aAAuB;QAEvB,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,EAAE,CAAA;QAC1C,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YAAE,OAAM;QAElD,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;gBACtC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,QAAuB,EAAE,EAAE,CACjD,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAChC,CAAA;YACL,CAAC;iBAAM,CAAC;gBACJ,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAA;YAC7C,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,MAAM,CAAC,YAAY,CAAC;gBACpB,IAAI,CAAC,wBAAwB,CACzB,MAAM,CAAC,YAAY,CAAC,EACpB,aAAa,CAChB,CAAA;QACT,CAAC;IACL,CAAC;CACJ","file":"EntityListenerMetadata.js","sourcesContent":["import { EventListenerType } from \"./types/EventListenerTypes\"\nimport { EntityListenerMetadataArgs } from \"../metadata-args/EntityListenerMetadataArgs\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { EntityMetadata } from \"./EntityMetadata\"\nimport { EmbeddedMetadata } from \"./EmbeddedMetadata\"\n\n/**\n * This metadata contains all information about entity's listeners.\n */\nexport class EntityListenerMetadata {\n // ---------------------------------------------------------------------\n // Properties\n // ---------------------------------------------------------------------\n\n /**\n * Entity metadata of the listener.\n */\n entityMetadata: EntityMetadata\n\n /**\n * Embedded metadata of the listener, in the case if listener is in embedded.\n */\n embeddedMetadata?: EmbeddedMetadata\n\n /**\n * Target class to which metadata is applied.\n * This can be different then entityMetadata.target in the case if listener is in the embedded.\n */\n target: Function | string\n\n /**\n * Target's property name to which this metadata is applied.\n */\n propertyName: string\n\n /**\n * The type of the listener.\n */\n type: EventListenerType\n\n // ---------------------------------------------------------------------\n // Constructor\n // ---------------------------------------------------------------------\n\n constructor(options: {\n entityMetadata: EntityMetadata\n embeddedMetadata?: EmbeddedMetadata\n args: EntityListenerMetadataArgs\n }) {\n this.entityMetadata = options.entityMetadata\n this.embeddedMetadata = options.embeddedMetadata\n this.target = options.args.target\n this.propertyName = options.args.propertyName\n this.type = options.args.type\n }\n\n // ---------------------------------------------------------------------\n // Public Methods\n // ---------------------------------------------------------------------\n\n /**\n * Checks if entity listener is allowed to be executed on the given entity.\n */\n isAllowed(entity: ObjectLiteral) {\n // todo: create in entity metadata method like isInherited?\n return (\n this.entityMetadata.target === entity.constructor || // todo: .constructor won't work for entity schemas, but there are no entity listeners in schemas since there are no objects, right?\n (typeof this.entityMetadata.target === \"function\" &&\n entity.constructor.prototype instanceof\n this.entityMetadata.target)\n ) // todo: also need to implement entity schema inheritance\n }\n\n /**\n * Executes listener method of the given entity.\n */\n execute(entity: ObjectLiteral) {\n // Check if the Embedded Metadata does not exist\n if (!this.embeddedMetadata) {\n // Get the Entity's Method\n const entityMethod = entity[this.propertyName]\n\n // Check if the Entity Method does not exist\n if (!entityMethod)\n throw new Error(\n `Entity listener method \"${this.propertyName}\" does not exist in entity \"${entity.constructor.name}\".`,\n )\n\n // Check if the Entity Method is not a function\n if (typeof entityMethod !== \"function\")\n throw new Error(\n `Entity listener method \"${this.propertyName}\" in entity \"${\n entity.constructor.name\n }\" must be a function but got \"${typeof entityMethod}\".`,\n )\n\n // Call and return the Entity Method\n return entityMethod.call(entity)\n }\n\n // Call the Embedded Method\n this.callEntityEmbeddedMethod(\n entity,\n this.embeddedMetadata.propertyPath.split(\".\"),\n )\n }\n\n // ---------------------------------------------------------------------\n // Protected Methods\n // ---------------------------------------------------------------------\n\n /**\n * Calls embedded entity listener method no matter how nested it is.\n */\n protected callEntityEmbeddedMethod(\n entity: ObjectLiteral,\n propertyPaths: string[],\n ): void {\n const propertyPath = propertyPaths.shift()\n if (!propertyPath || !entity[propertyPath]) return\n\n if (propertyPaths.length === 0) {\n if (Array.isArray(entity[propertyPath])) {\n entity[propertyPath].map((embedded: ObjectLiteral) =>\n embedded[this.propertyName](),\n )\n } else {\n entity[propertyPath][this.propertyName]()\n }\n } else {\n if (entity[propertyPath])\n this.callEntityEmbeddedMethod(\n entity[propertyPath],\n propertyPaths,\n )\n }\n }\n}\n"],"sourceRoot":".."}
@@ -2190,7 +2190,7 @@ export class SelectQueryBuilder extends QueryBuilder {
2190
2190
  await this.connection.queryResultCache.storeInCache({
2191
2191
  identifier: this.expressionMap.cacheId,
2192
2192
  query: queryId,
2193
- time: new Date().getTime(),
2193
+ time: Date.now(),
2194
2194
  duration: this.expressionMap.cacheDuration ||
2195
2195
  cacheOptions.duration ||
2196
2196
  1000,