typeorm 0.3.12-dev.ae91c05 → 0.3.12-dev.defb409

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 (157) hide show
  1. package/browser/decorator/options/SpatialColumnOptions.d.ts +2 -1
  2. package/browser/decorator/options/SpatialColumnOptions.js.map +1 -1
  3. package/browser/driver/Driver.d.ts +1 -1
  4. package/browser/driver/Driver.js.map +1 -1
  5. package/browser/driver/DriverUtils.js +1 -1
  6. package/browser/driver/DriverUtils.js.map +1 -1
  7. package/browser/driver/aurora-mysql/AuroraMysqlDriver.d.ts +2 -1
  8. package/browser/driver/aurora-mysql/AuroraMysqlDriver.js +1 -1
  9. package/browser/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
  10. package/browser/driver/cockroachdb/CockroachConnectionOptions.d.ts +5 -0
  11. package/browser/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
  12. package/browser/driver/cockroachdb/CockroachDriver.d.ts +19 -14
  13. package/browser/driver/cockroachdb/CockroachDriver.js +128 -13
  14. package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
  15. package/browser/driver/cockroachdb/CockroachQueryRunner.d.ts +28 -0
  16. package/browser/driver/cockroachdb/CockroachQueryRunner.js +283 -11
  17. package/browser/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
  18. package/browser/driver/mongodb/MongoDriver.d.ts +5 -0
  19. package/browser/driver/mongodb/MongoDriver.js.map +1 -1
  20. package/browser/driver/mysql/MysqlDriver.d.ts +2 -1
  21. package/browser/driver/mysql/MysqlDriver.js +1 -1
  22. package/browser/driver/mysql/MysqlDriver.js.map +1 -1
  23. package/browser/driver/oracle/OracleDriver.d.ts +5 -0
  24. package/browser/driver/oracle/OracleDriver.js +4 -0
  25. package/browser/driver/oracle/OracleDriver.js.map +1 -1
  26. package/browser/driver/oracle/OracleQueryRunner.js +15 -7
  27. package/browser/driver/oracle/OracleQueryRunner.js.map +1 -1
  28. package/browser/driver/postgres/PostgresDriver.d.ts +2 -1
  29. package/browser/driver/postgres/PostgresDriver.js +1 -1
  30. package/browser/driver/postgres/PostgresDriver.js.map +1 -1
  31. package/browser/driver/postgres/PostgresQueryRunner.js +11 -36
  32. package/browser/driver/postgres/PostgresQueryRunner.js.map +1 -1
  33. package/browser/driver/sap/SapDriver.d.ts +5 -0
  34. package/browser/driver/sap/SapDriver.js +4 -0
  35. package/browser/driver/sap/SapDriver.js.map +1 -1
  36. package/browser/driver/spanner/SpannerDriver.d.ts +2 -1
  37. package/browser/driver/spanner/SpannerDriver.js +1 -1
  38. package/browser/driver/spanner/SpannerDriver.js.map +1 -1
  39. package/browser/driver/sqlite/SqliteConnectionOptions.d.ts +7 -0
  40. package/browser/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
  41. package/browser/driver/sqlite/SqliteDriver.js +5 -0
  42. package/browser/driver/sqlite/SqliteDriver.js.map +1 -1
  43. package/browser/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +2 -1
  44. package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js +1 -1
  45. package/browser/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
  46. package/browser/driver/sqlserver/SqlServerDriver.d.ts +5 -0
  47. package/browser/driver/sqlserver/SqlServerDriver.js +4 -0
  48. package/browser/driver/sqlserver/SqlServerDriver.js.map +1 -1
  49. package/browser/driver/types/GeoJsonTypes.d.ts +87 -0
  50. package/browser/driver/types/GeoJsonTypes.js +3 -0
  51. package/browser/driver/types/GeoJsonTypes.js.map +1 -0
  52. package/browser/driver/types/UpsertType.d.ts +1 -1
  53. package/browser/driver/types/UpsertType.js.map +1 -1
  54. package/browser/entity-manager/EntityManager.js +2 -0
  55. package/browser/entity-manager/EntityManager.js.map +1 -1
  56. package/browser/find-options/mongodb/MongoFindOneOptions.d.ts +2 -2
  57. package/browser/find-options/mongodb/MongoFindOneOptions.js.map +1 -1
  58. package/browser/index.d.ts +1 -0
  59. package/browser/index.js +1 -0
  60. package/browser/index.js.map +1 -1
  61. package/browser/query-builder/InsertOrUpdateOptions.d.ts +2 -0
  62. package/browser/query-builder/InsertOrUpdateOptions.js.map +1 -1
  63. package/browser/query-builder/InsertQueryBuilder.d.ts +4 -4
  64. package/browser/query-builder/InsertQueryBuilder.js +80 -74
  65. package/browser/query-builder/InsertQueryBuilder.js.map +1 -1
  66. package/browser/query-builder/QueryBuilder.d.ts +4 -0
  67. package/browser/query-builder/QueryBuilder.js +28 -8
  68. package/browser/query-builder/QueryBuilder.js.map +1 -1
  69. package/browser/query-builder/QueryExpressionMap.d.ts +7 -0
  70. package/browser/query-builder/QueryExpressionMap.js +4 -0
  71. package/browser/query-builder/QueryExpressionMap.js.map +1 -1
  72. package/browser/query-builder/SelectQueryBuilder.d.ts +4 -0
  73. package/browser/query-builder/SelectQueryBuilder.js +22 -1
  74. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  75. package/browser/query-builder/UpdateQueryBuilder.js +1 -2
  76. package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
  77. package/browser/repository/UpsertOptions.d.ts +7 -0
  78. package/browser/repository/UpsertOptions.js.map +1 -1
  79. package/decorator/options/SpatialColumnOptions.d.ts +2 -1
  80. package/decorator/options/SpatialColumnOptions.js.map +1 -1
  81. package/driver/Driver.d.ts +1 -1
  82. package/driver/Driver.js.map +1 -1
  83. package/driver/DriverUtils.js +1 -1
  84. package/driver/DriverUtils.js.map +1 -1
  85. package/driver/aurora-mysql/AuroraMysqlDriver.d.ts +2 -1
  86. package/driver/aurora-mysql/AuroraMysqlDriver.js +1 -1
  87. package/driver/aurora-mysql/AuroraMysqlDriver.js.map +1 -1
  88. package/driver/cockroachdb/CockroachConnectionOptions.d.ts +5 -0
  89. package/driver/cockroachdb/CockroachConnectionOptions.js.map +1 -1
  90. package/driver/cockroachdb/CockroachDriver.d.ts +19 -14
  91. package/driver/cockroachdb/CockroachDriver.js +128 -13
  92. package/driver/cockroachdb/CockroachDriver.js.map +1 -1
  93. package/driver/cockroachdb/CockroachQueryRunner.d.ts +28 -0
  94. package/driver/cockroachdb/CockroachQueryRunner.js +283 -11
  95. package/driver/cockroachdb/CockroachQueryRunner.js.map +1 -1
  96. package/driver/mongodb/MongoDriver.d.ts +5 -0
  97. package/driver/mongodb/MongoDriver.js.map +1 -1
  98. package/driver/mysql/MysqlDriver.d.ts +2 -1
  99. package/driver/mysql/MysqlDriver.js +1 -1
  100. package/driver/mysql/MysqlDriver.js.map +1 -1
  101. package/driver/oracle/OracleDriver.d.ts +5 -0
  102. package/driver/oracle/OracleDriver.js +4 -0
  103. package/driver/oracle/OracleDriver.js.map +1 -1
  104. package/driver/oracle/OracleQueryRunner.js +15 -7
  105. package/driver/oracle/OracleQueryRunner.js.map +1 -1
  106. package/driver/postgres/PostgresDriver.d.ts +2 -1
  107. package/driver/postgres/PostgresDriver.js +1 -1
  108. package/driver/postgres/PostgresDriver.js.map +1 -1
  109. package/driver/postgres/PostgresQueryRunner.js +11 -36
  110. package/driver/postgres/PostgresQueryRunner.js.map +1 -1
  111. package/driver/sap/SapDriver.d.ts +5 -0
  112. package/driver/sap/SapDriver.js +4 -0
  113. package/driver/sap/SapDriver.js.map +1 -1
  114. package/driver/spanner/SpannerDriver.d.ts +2 -1
  115. package/driver/spanner/SpannerDriver.js +1 -1
  116. package/driver/spanner/SpannerDriver.js.map +1 -1
  117. package/driver/sqlite/SqliteConnectionOptions.d.ts +7 -0
  118. package/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
  119. package/driver/sqlite/SqliteDriver.js +5 -0
  120. package/driver/sqlite/SqliteDriver.js.map +1 -1
  121. package/driver/sqlite-abstract/AbstractSqliteDriver.d.ts +2 -1
  122. package/driver/sqlite-abstract/AbstractSqliteDriver.js +1 -1
  123. package/driver/sqlite-abstract/AbstractSqliteDriver.js.map +1 -1
  124. package/driver/sqlserver/SqlServerDriver.d.ts +5 -0
  125. package/driver/sqlserver/SqlServerDriver.js +4 -0
  126. package/driver/sqlserver/SqlServerDriver.js.map +1 -1
  127. package/driver/types/GeoJsonTypes.d.ts +87 -0
  128. package/driver/types/GeoJsonTypes.js +4 -0
  129. package/driver/types/GeoJsonTypes.js.map +1 -0
  130. package/driver/types/UpsertType.d.ts +1 -1
  131. package/driver/types/UpsertType.js.map +1 -1
  132. package/entity-manager/EntityManager.js +2 -0
  133. package/entity-manager/EntityManager.js.map +1 -1
  134. package/find-options/mongodb/MongoFindOneOptions.d.ts +2 -2
  135. package/find-options/mongodb/MongoFindOneOptions.js.map +1 -1
  136. package/index.d.ts +1 -0
  137. package/index.js +1 -0
  138. package/index.js.map +1 -1
  139. package/package.json +1 -1
  140. package/query-builder/InsertOrUpdateOptions.d.ts +2 -0
  141. package/query-builder/InsertOrUpdateOptions.js.map +1 -1
  142. package/query-builder/InsertQueryBuilder.d.ts +4 -4
  143. package/query-builder/InsertQueryBuilder.js +80 -74
  144. package/query-builder/InsertQueryBuilder.js.map +1 -1
  145. package/query-builder/QueryBuilder.d.ts +4 -0
  146. package/query-builder/QueryBuilder.js +28 -8
  147. package/query-builder/QueryBuilder.js.map +1 -1
  148. package/query-builder/QueryExpressionMap.d.ts +7 -0
  149. package/query-builder/QueryExpressionMap.js +4 -0
  150. package/query-builder/QueryExpressionMap.js.map +1 -1
  151. package/query-builder/SelectQueryBuilder.d.ts +4 -0
  152. package/query-builder/SelectQueryBuilder.js +22 -1
  153. package/query-builder/SelectQueryBuilder.js.map +1 -1
  154. package/query-builder/UpdateQueryBuilder.js +1 -2
  155. package/query-builder/UpdateQueryBuilder.js.map +1 -1
  156. package/repository/UpsertOptions.d.ts +7 -0
  157. package/repository/UpsertOptions.js.map +1 -1
@@ -1,3 +1,4 @@
1
+ import { Geometry } from "../../driver/types/GeoJsonTypes";
1
2
  /**
2
3
  * Options for spatial columns.
3
4
  */
@@ -6,7 +7,7 @@ export interface SpatialColumnOptions {
6
7
  * Column type's feature type.
7
8
  * Geometry, Point, Polygon, etc.
8
9
  */
9
- spatialFeatureType?: string;
10
+ spatialFeatureType?: Geometry["type"];
10
11
  /**
11
12
  * Column type's SRID.
12
13
  * Spatial Reference ID or EPSG code.
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/decorator/options/SpatialColumnOptions.ts"],"names":[],"mappings":"","file":"SpatialColumnOptions.js","sourcesContent":["/**\n * Options for spatial columns.\n */\nexport interface SpatialColumnOptions {\n /**\n * Column type's feature type.\n * Geometry, Point, Polygon, etc.\n */\n spatialFeatureType?: string\n\n /**\n * Column type's SRID.\n * Spatial Reference ID or EPSG code.\n */\n srid?: number\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/decorator/options/SpatialColumnOptions.ts"],"names":[],"mappings":"","file":"SpatialColumnOptions.js","sourcesContent":["import { Geometry } from \"../../driver/types/GeoJsonTypes\"\n\n/**\n * Options for spatial columns.\n */\nexport interface SpatialColumnOptions {\n /**\n * Column type's feature type.\n * Geometry, Point, Polygon, etc.\n */\n spatialFeatureType?: Geometry[\"type\"]\n\n /**\n * Column type's SRID.\n * Spatial Reference ID or EPSG code.\n */\n srid?: number\n}\n"],"sourceRoot":"../.."}
@@ -56,7 +56,7 @@ export interface Driver {
56
56
  /**
57
57
  * Returns type of upsert supported by driver if any
58
58
  */
59
- supportedUpsertType?: UpsertType;
59
+ supportedUpsertTypes: UpsertType[];
60
60
  /**
61
61
  * Default values of length, precision and scale depends on column data type.
62
62
  * Used in the cases when length/precision/scale is not specified by user.
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/Driver.ts"],"names":[],"mappings":"","file":"Driver.js","sourcesContent":["import { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { ColumnType } from \"./types/ColumnTypes\"\nimport { CteCapabilities } from \"./types/CteCapabilities\"\nimport { MappedColumnTypes } from \"./types/MappedColumnTypes\"\nimport { SchemaBuilder } from \"../schema-builder/SchemaBuilder\"\nimport { DataTypeDefaults } from \"./types/DataTypeDefaults\"\nimport { BaseDataSourceOptions } from \"../data-source/BaseDataSourceOptions\"\nimport { TableColumn } from \"../schema-builder/table/TableColumn\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { ReplicationMode } from \"./types/ReplicationMode\"\nimport { Table } from \"../schema-builder/table/Table\"\nimport { View } from \"../schema-builder/view/View\"\nimport { TableForeignKey } from \"../schema-builder/table/TableForeignKey\"\nimport { UpsertType } from \"./types/UpsertType\"\n\nexport type ReturningType = \"insert\" | \"update\" | \"delete\"\n\n/**\n * Driver organizes TypeORM communication with specific database management system.\n */\nexport interface Driver {\n /**\n * Connection options.\n */\n options: BaseDataSourceOptions\n\n /**\n * Database version/release. Often requires a SQL query to the DB, so it is not always set\n */\n version?: string\n\n /**\n * Database name used to perform all write queries.\n *\n * todo: probably move into query runner.\n */\n database?: string\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport: boolean\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport: \"simple\" | \"nested\" | \"none\"\n\n /**\n * Gets list of supported column data types by a driver.\n */\n supportedDataTypes: ColumnType[]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertType?: UpsertType\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[]\n\n /**\n * Orm has special columns and we need to know what database column types should be for those types.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes\n\n /**\n * Max length allowed by the DBMS for aliases (execution of queries).\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities\n\n /**\n * Dummy table name\n */\n dummyTableName?: string\n\n /**\n * Performs connection to the database.\n * Depend on driver type it may create a connection pool.\n */\n connect(): Promise<void>\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void>\n\n /**\n * Closes connection with database and releases all resources.\n */\n disconnect(): Promise<void>\n\n /**\n * Synchronizes database schema (creates tables, indices, etc).\n */\n createSchemaBuilder(): SchemaBuilder\n\n /**\n * Creates a query runner used for common queries.\n */\n createQueryRunner(mode: ReplicationMode): QueryRunner\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]]\n\n /**\n * Escapes a table name, column name or an alias.\n *\n * todo: probably escape should be able to handle dots in the names and automatically escape them\n */\n escape(name: string): string\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { tableName: string; schema?: string; database?: string }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, column: ColumnMetadata): any\n\n /**\n * Prepares given value to a value to be persisted, based on its column type.\n */\n prepareHydratedValue(value: any, column: ColumnMetadata): any\n\n /**\n * Transforms type of the given column to a database column type.\n */\n normalizeType(column: {\n type?: ColumnType | string\n length?: number | string\n precision?: number | null\n scale?: number\n isArray?: boolean\n }): string\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any>\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any>\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(\n metadata: EntityMetadata,\n insertResult: any,\n entityIndex?: number,\n entityNum?: number,\n ): ObjectLiteral | undefined\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[]\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(returningType: ReturningType): boolean\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/driver/Driver.ts"],"names":[],"mappings":"","file":"Driver.js","sourcesContent":["import { QueryRunner } from \"../query-runner/QueryRunner\"\nimport { ColumnMetadata } from \"../metadata/ColumnMetadata\"\nimport { ObjectLiteral } from \"../common/ObjectLiteral\"\nimport { ColumnType } from \"./types/ColumnTypes\"\nimport { CteCapabilities } from \"./types/CteCapabilities\"\nimport { MappedColumnTypes } from \"./types/MappedColumnTypes\"\nimport { SchemaBuilder } from \"../schema-builder/SchemaBuilder\"\nimport { DataTypeDefaults } from \"./types/DataTypeDefaults\"\nimport { BaseDataSourceOptions } from \"../data-source/BaseDataSourceOptions\"\nimport { TableColumn } from \"../schema-builder/table/TableColumn\"\nimport { EntityMetadata } from \"../metadata/EntityMetadata\"\nimport { ReplicationMode } from \"./types/ReplicationMode\"\nimport { Table } from \"../schema-builder/table/Table\"\nimport { View } from \"../schema-builder/view/View\"\nimport { TableForeignKey } from \"../schema-builder/table/TableForeignKey\"\nimport { UpsertType } from \"./types/UpsertType\"\n\nexport type ReturningType = \"insert\" | \"update\" | \"delete\"\n\n/**\n * Driver organizes TypeORM communication with specific database management system.\n */\nexport interface Driver {\n /**\n * Connection options.\n */\n options: BaseDataSourceOptions\n\n /**\n * Database version/release. Often requires a SQL query to the DB, so it is not always set\n */\n version?: string\n\n /**\n * Database name used to perform all write queries.\n *\n * todo: probably move into query runner.\n */\n database?: string\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport: boolean\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport: \"simple\" | \"nested\" | \"none\"\n\n /**\n * Gets list of supported column data types by a driver.\n */\n supportedDataTypes: ColumnType[]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[]\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[]\n\n /**\n * Orm has special columns and we need to know what database column types should be for those types.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes\n\n /**\n * Max length allowed by the DBMS for aliases (execution of queries).\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities\n\n /**\n * Dummy table name\n */\n dummyTableName?: string\n\n /**\n * Performs connection to the database.\n * Depend on driver type it may create a connection pool.\n */\n connect(): Promise<void>\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void>\n\n /**\n * Closes connection with database and releases all resources.\n */\n disconnect(): Promise<void>\n\n /**\n * Synchronizes database schema (creates tables, indices, etc).\n */\n createSchemaBuilder(): SchemaBuilder\n\n /**\n * Creates a query runner used for common queries.\n */\n createQueryRunner(mode: ReplicationMode): QueryRunner\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]]\n\n /**\n * Escapes a table name, column name or an alias.\n *\n * todo: probably escape should be able to handle dots in the names and automatically escape them\n */\n escape(name: string): string\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { tableName: string; schema?: string; database?: string }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, column: ColumnMetadata): any\n\n /**\n * Prepares given value to a value to be persisted, based on its column type.\n */\n prepareHydratedValue(value: any, column: ColumnMetadata): any\n\n /**\n * Transforms type of the given column to a database column type.\n */\n normalizeType(column: {\n type?: ColumnType | string\n length?: number | string\n precision?: number | null\n scale?: number\n isArray?: boolean\n }): string\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any>\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any>\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(\n metadata: EntityMetadata,\n insertResult: any,\n entityIndex?: number,\n entityNum?: number,\n ): ObjectLiteral | undefined\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[]\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(returningType: ReturningType): boolean\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string\n}\n"],"sourceRoot":".."}
@@ -33,7 +33,7 @@ export class DriverUtils {
33
33
  VersionUtils.isGreaterOrEqual(driver.version, version));
34
34
  }
35
35
  static isPostgresFamily(driver) {
36
- return ["postgres", "aurora-postgres"].includes(driver.options.type);
36
+ return ["postgres", "aurora-postgres", "cockroachdb"].includes(driver.options.type);
37
37
  }
38
38
  /**
39
39
  * Normalizes and builds a new driver options.
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/DriverUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;GAEG;AACH,MAAM,OAAO,WAAW;IACpB,4EAA4E;IAC5E,wBAAwB;IACx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CAAA;SACxD;QAED,+EAA+E;QAC/E,IAAI,UAAU,EAAE;YACZ,cAAc,GAAG,WAAW,CAAA;SAC/B;aAAM;YACH,CAAC;YAAA,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACzC;QAED,IAAI,aAAa,GAAQ;YACrB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,cAAc,EAAE,cAAc;YAC9B,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC;YACtC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC;YACtC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;YACvC,QAAQ,EAAE,SAAS,IAAI,SAAS;SACnC,CAAA;QAED,uDAAuD;QACvD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;YACtD,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SAC7B;QAED,OAAO,aAAa,CAAA;IACxB,CAAC;CACJ","file":"DriverUtils.js","sourcesContent":["import { Driver } from \"./Driver\"\nimport { hash, shorten } from \"../util/StringUtils\"\nimport { VersionUtils } from \"../util/VersionUtils\"\n\n/**\n * Common driver utility functions.\n */\nexport class DriverUtils {\n // -------------------------------------------------------------------------\n // Public Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns true if given driver is SQLite-based driver.\n */\n static isSQLiteFamily(driver: Driver): boolean {\n return [\n \"sqlite\",\n \"cordova\",\n \"react-native\",\n \"nativescript\",\n \"sqljs\",\n \"expo\",\n \"better-sqlite3\",\n \"capacitor\",\n ].includes(driver.options.type)\n }\n\n /**\n * Returns true if given driver is MySQL-based driver.\n */\n static isMySQLFamily(driver: Driver): boolean {\n return [\"mysql\", \"mariadb\"].includes(driver.options.type)\n }\n\n static isReleaseVersionOrGreater(driver: Driver, version: string): boolean {\n return (\n driver.version != null &&\n VersionUtils.isGreaterOrEqual(driver.version, version)\n )\n }\n\n static isPostgresFamily(driver: Driver): boolean {\n return [\"postgres\", \"aurora-postgres\"].includes(driver.options.type)\n }\n\n /**\n * Normalizes and builds a new driver options.\n * Extracts settings from connection url and sets to a new options object.\n */\n static buildDriverOptions(\n options: any,\n buildOptions?: { useSid: boolean },\n ): any {\n if (options.url) {\n const urlDriverOptions = this.parseConnectionUrl(options.url) as {\n [key: string]: any\n }\n\n if (\n buildOptions &&\n buildOptions.useSid &&\n urlDriverOptions.database\n ) {\n urlDriverOptions.sid = urlDriverOptions.database\n }\n\n for (const key of Object.keys(urlDriverOptions)) {\n if (typeof urlDriverOptions[key] === \"undefined\") {\n delete urlDriverOptions[key]\n }\n }\n\n return Object.assign({}, options, urlDriverOptions)\n }\n return Object.assign({}, options)\n }\n\n /**\n * buildDriverOptions for MongodDB only to support replica set\n */\n static buildMongoDBDriverOptions(\n options: any,\n buildOptions?: { useSid: boolean },\n ): any {\n if (options.url) {\n const urlDriverOptions = this.parseMongoDBConnectionUrl(\n options.url,\n ) as { [key: string]: any }\n\n if (\n buildOptions &&\n buildOptions.useSid &&\n urlDriverOptions.database\n ) {\n urlDriverOptions.sid = urlDriverOptions.database\n }\n\n for (const key of Object.keys(urlDriverOptions)) {\n if (typeof urlDriverOptions[key] === \"undefined\") {\n delete urlDriverOptions[key]\n }\n }\n\n return Object.assign({}, options, urlDriverOptions)\n }\n return Object.assign({}, options)\n }\n\n /**\n * Joins and shortens alias if needed.\n *\n * If the alias length is greater than the limit allowed by the current\n * driver, replaces it with a shortend string, if the shortend string\n * is still too long, it will then hash the alias.\n *\n * @param driver Current `Driver`.\n * @param buildOptions Optional settings.\n * @param alias Alias parts.\n *\n * @return An alias that is no longer than the divers max alias length.\n */\n static buildAlias(\n { maxAliasLength }: Driver,\n buildOptions: { shorten?: boolean; joiner?: string } | string,\n ...alias: string[]\n ): string {\n if (typeof buildOptions === \"string\") {\n alias.unshift(buildOptions)\n buildOptions = { shorten: false, joiner: \"_\" }\n } else {\n buildOptions = Object.assign(\n { shorten: false, joiner: \"_\" },\n buildOptions,\n )\n }\n\n const newAlias =\n alias.length === 1 ? alias[0] : alias.join(buildOptions.joiner)\n if (\n maxAliasLength &&\n maxAliasLength > 0 &&\n newAlias.length > maxAliasLength\n ) {\n if (buildOptions.shorten === true) {\n const shortenedAlias = shorten(newAlias)\n if (shortenedAlias.length < maxAliasLength) {\n return shortenedAlias\n }\n }\n\n return hash(newAlias, { length: maxAliasLength })\n }\n\n return newAlias\n }\n\n /**\n * @deprecated use `buildAlias` instead.\n */\n static buildColumnAlias(\n { maxAliasLength }: Driver,\n buildOptions: { shorten?: boolean; joiner?: string } | string,\n ...alias: string[]\n ) {\n return this.buildAlias(\n { maxAliasLength } as Driver,\n buildOptions,\n ...alias,\n )\n }\n\n // -------------------------------------------------------------------------\n // Private Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Extracts connection data from the connection url.\n */\n private static parseConnectionUrl(url: string) {\n const type = url.split(\":\")[0]\n const firstSlashes = url.indexOf(\"//\")\n const preBase = url.substr(firstSlashes + 2)\n const secondSlash = preBase.indexOf(\"/\")\n const base =\n secondSlash !== -1 ? preBase.substr(0, secondSlash) : preBase\n let afterBase =\n secondSlash !== -1 ? preBase.substr(secondSlash + 1) : undefined\n // remove mongodb query params\n if (afterBase && afterBase.indexOf(\"?\") !== -1) {\n afterBase = afterBase.substr(0, afterBase.indexOf(\"?\"))\n }\n\n const lastAtSign = base.lastIndexOf(\"@\")\n const usernameAndPassword = base.substr(0, lastAtSign)\n const hostAndPort = base.substr(lastAtSign + 1)\n\n let username = usernameAndPassword\n let password = \"\"\n const firstColon = usernameAndPassword.indexOf(\":\")\n if (firstColon !== -1) {\n username = usernameAndPassword.substr(0, firstColon)\n password = usernameAndPassword.substr(firstColon + 1)\n }\n const [host, port] = hostAndPort.split(\":\")\n\n return {\n type: type,\n host: host,\n username: decodeURIComponent(username),\n password: decodeURIComponent(password),\n port: port ? parseInt(port) : undefined,\n database: afterBase || undefined,\n }\n }\n\n /**\n * Extracts connection data from the connection url for MongoDB to support replica set.\n */\n private static parseMongoDBConnectionUrl(url: string) {\n const type = url.split(\":\")[0]\n const firstSlashes = url.indexOf(\"//\")\n const preBase = url.substr(firstSlashes + 2)\n const secondSlash = preBase.indexOf(\"/\")\n const base =\n secondSlash !== -1 ? preBase.substr(0, secondSlash) : preBase\n let afterBase =\n secondSlash !== -1 ? preBase.substr(secondSlash + 1) : undefined\n let afterQuestionMark = \"\"\n let host = undefined\n let port = undefined\n let hostReplicaSet = undefined\n let replicaSet = undefined\n\n let optionsObject: any = {}\n\n if (afterBase && afterBase.indexOf(\"?\") !== -1) {\n // split params\n afterQuestionMark = afterBase.substr(\n afterBase.indexOf(\"?\") + 1,\n afterBase.length,\n )\n\n const optionsList = afterQuestionMark.split(\"&\")\n let optionKey: string\n let optionValue: string\n\n // create optionsObject for merge with connectionUrl object before return\n optionsList.forEach((optionItem) => {\n optionKey = optionItem.split(\"=\")[0]\n optionValue = optionItem.split(\"=\")[1]\n optionsObject[optionKey] = optionValue\n })\n\n // specific replicaSet value to set options about hostReplicaSet\n replicaSet = optionsObject[\"replicaSet\"]\n afterBase = afterBase.substr(0, afterBase.indexOf(\"?\"))\n }\n\n const lastAtSign = base.lastIndexOf(\"@\")\n const usernameAndPassword = base.substr(0, lastAtSign)\n const hostAndPort = base.substr(lastAtSign + 1)\n\n let username = usernameAndPassword\n let password = \"\"\n const firstColon = usernameAndPassword.indexOf(\":\")\n if (firstColon !== -1) {\n username = usernameAndPassword.substr(0, firstColon)\n password = usernameAndPassword.substr(firstColon + 1)\n }\n\n // If replicaSet have value set It as hostlist, If not set like standalone host\n if (replicaSet) {\n hostReplicaSet = hostAndPort\n } else {\n ;[host, port] = hostAndPort.split(\":\")\n }\n\n let connectionUrl: any = {\n type: type,\n host: host,\n hostReplicaSet: hostReplicaSet,\n username: decodeURIComponent(username),\n password: decodeURIComponent(password),\n port: port ? parseInt(port) : undefined,\n database: afterBase || undefined,\n }\n\n // Loop to set every options in connectionUrl to object\n for (const [key, value] of Object.entries(optionsObject)) {\n connectionUrl[key] = value\n }\n\n return connectionUrl\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/driver/DriverUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;GAEG;AACH,MAAM,OAAO,WAAW;IACpB,4EAA4E;IAC5E,wBAAwB;IACxB,4EAA4E;IAE5E;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,MAAc;QAChC,OAAO;YACH,QAAQ;YACR,SAAS;YACT,cAAc;YACd,cAAc;YACd,OAAO;YACP,MAAM;YACN,gBAAgB;YAChB,WAAW;SACd,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAc;QAC/B,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,CAAC,yBAAyB,CAAC,MAAc,EAAE,OAAe;QAC5D,OAAO,CACH,MAAM,CAAC,OAAO,IAAI,IAAI;YACtB,YAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CACzD,CAAA;IACL,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,MAAc;QAClC,OAAO,CAAC,UAAU,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC,QAAQ,CAC1D,MAAM,CAAC,OAAO,CAAC,IAAI,CACtB,CAAA;IACL,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CACrB,OAAY,EACZ,Y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VersionUtils } from \"../util/VersionUtils\"\n\n/**\n * Common driver utility functions.\n */\nexport class DriverUtils {\n // -------------------------------------------------------------------------\n // Public Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns true if given driver is SQLite-based driver.\n */\n static isSQLiteFamily(driver: Driver): boolean {\n return [\n \"sqlite\",\n \"cordova\",\n \"react-native\",\n \"nativescript\",\n \"sqljs\",\n \"expo\",\n \"better-sqlite3\",\n \"capacitor\",\n ].includes(driver.options.type)\n }\n\n /**\n * Returns true if given driver is MySQL-based driver.\n */\n static isMySQLFamily(driver: Driver): boolean {\n return [\"mysql\", \"mariadb\"].includes(driver.options.type)\n }\n\n static isReleaseVersionOrGreater(driver: Driver, version: string): boolean {\n return (\n driver.version != null &&\n VersionUtils.isGreaterOrEqual(driver.version, version)\n )\n }\n\n static isPostgresFamily(driver: Driver): boolean {\n return [\"postgres\", \"aurora-postgres\", \"cockroachdb\"].includes(\n driver.options.type,\n )\n }\n\n /**\n * Normalizes and builds a new driver options.\n * Extracts settings from connection url and sets to a new options object.\n */\n static buildDriverOptions(\n options: any,\n buildOptions?: { useSid: boolean },\n ): any {\n if (options.url) {\n const urlDriverOptions = this.parseConnectionUrl(options.url) as {\n [key: string]: any\n }\n\n if (\n buildOptions &&\n buildOptions.useSid &&\n urlDriverOptions.database\n ) {\n urlDriverOptions.sid = urlDriverOptions.database\n }\n\n for (const key of Object.keys(urlDriverOptions)) {\n if (typeof urlDriverOptions[key] === \"undefined\") {\n delete urlDriverOptions[key]\n }\n }\n\n return Object.assign({}, options, urlDriverOptions)\n }\n return Object.assign({}, options)\n }\n\n /**\n * buildDriverOptions for MongodDB only to support replica set\n */\n static buildMongoDBDriverOptions(\n options: any,\n buildOptions?: { useSid: boolean },\n ): any {\n if (options.url) {\n const urlDriverOptions = this.parseMongoDBConnectionUrl(\n options.url,\n ) as { [key: string]: any }\n\n if (\n buildOptions &&\n buildOptions.useSid &&\n urlDriverOptions.database\n ) {\n urlDriverOptions.sid = urlDriverOptions.database\n }\n\n for (const key of Object.keys(urlDriverOptions)) {\n if (typeof urlDriverOptions[key] === \"undefined\") {\n delete urlDriverOptions[key]\n }\n }\n\n return Object.assign({}, options, urlDriverOptions)\n }\n return Object.assign({}, options)\n }\n\n /**\n * Joins and shortens alias if needed.\n *\n * If the alias length is greater than the limit allowed by the current\n * driver, replaces it with a shortend string, if the shortend string\n * is still too long, it will then hash the alias.\n *\n * @param driver Current `Driver`.\n * @param buildOptions Optional settings.\n * @param alias Alias parts.\n *\n * @return An alias that is no longer than the divers max alias length.\n */\n static buildAlias(\n { maxAliasLength }: Driver,\n buildOptions: { shorten?: boolean; joiner?: string } | string,\n ...alias: string[]\n ): string {\n if (typeof buildOptions === \"string\") {\n alias.unshift(buildOptions)\n buildOptions = { shorten: false, joiner: \"_\" }\n } else {\n buildOptions = Object.assign(\n { shorten: false, joiner: \"_\" },\n buildOptions,\n )\n }\n\n const newAlias =\n alias.length === 1 ? alias[0] : alias.join(buildOptions.joiner)\n if (\n maxAliasLength &&\n maxAliasLength > 0 &&\n newAlias.length > maxAliasLength\n ) {\n if (buildOptions.shorten === true) {\n const shortenedAlias = shorten(newAlias)\n if (shortenedAlias.length < maxAliasLength) {\n return shortenedAlias\n }\n }\n\n return hash(newAlias, { length: maxAliasLength })\n }\n\n return newAlias\n }\n\n /**\n * @deprecated use `buildAlias` instead.\n */\n static buildColumnAlias(\n { maxAliasLength }: Driver,\n buildOptions: { shorten?: boolean; joiner?: string } | string,\n ...alias: string[]\n ) {\n return this.buildAlias(\n { maxAliasLength } as Driver,\n buildOptions,\n ...alias,\n )\n }\n\n // -------------------------------------------------------------------------\n // Private Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Extracts connection data from the connection url.\n */\n private static parseConnectionUrl(url: string) {\n const type = url.split(\":\")[0]\n const firstSlashes = url.indexOf(\"//\")\n const preBase = url.substr(firstSlashes + 2)\n const secondSlash = preBase.indexOf(\"/\")\n const base =\n secondSlash !== -1 ? preBase.substr(0, secondSlash) : preBase\n let afterBase =\n secondSlash !== -1 ? preBase.substr(secondSlash + 1) : undefined\n // remove mongodb query params\n if (afterBase && afterBase.indexOf(\"?\") !== -1) {\n afterBase = afterBase.substr(0, afterBase.indexOf(\"?\"))\n }\n\n const lastAtSign = base.lastIndexOf(\"@\")\n const usernameAndPassword = base.substr(0, lastAtSign)\n const hostAndPort = base.substr(lastAtSign + 1)\n\n let username = usernameAndPassword\n let password = \"\"\n const firstColon = usernameAndPassword.indexOf(\":\")\n if (firstColon !== -1) {\n username = usernameAndPassword.substr(0, firstColon)\n password = usernameAndPassword.substr(firstColon + 1)\n }\n const [host, port] = hostAndPort.split(\":\")\n\n return {\n type: type,\n host: host,\n username: decodeURIComponent(username),\n password: decodeURIComponent(password),\n port: port ? parseInt(port) : undefined,\n database: afterBase || undefined,\n }\n }\n\n /**\n * Extracts connection data from the connection url for MongoDB to support replica set.\n */\n private static parseMongoDBConnectionUrl(url: string) {\n const type = url.split(\":\")[0]\n const firstSlashes = url.indexOf(\"//\")\n const preBase = url.substr(firstSlashes + 2)\n const secondSlash = preBase.indexOf(\"/\")\n const base =\n secondSlash !== -1 ? preBase.substr(0, secondSlash) : preBase\n let afterBase =\n secondSlash !== -1 ? preBase.substr(secondSlash + 1) : undefined\n let afterQuestionMark = \"\"\n let host = undefined\n let port = undefined\n let hostReplicaSet = undefined\n let replicaSet = undefined\n\n let optionsObject: any = {}\n\n if (afterBase && afterBase.indexOf(\"?\") !== -1) {\n // split params\n afterQuestionMark = afterBase.substr(\n afterBase.indexOf(\"?\") + 1,\n afterBase.length,\n )\n\n const optionsList = afterQuestionMark.split(\"&\")\n let optionKey: string\n let optionValue: string\n\n // create optionsObject for merge with connectionUrl object before return\n optionsList.forEach((optionItem) => {\n optionKey = optionItem.split(\"=\")[0]\n optionValue = optionItem.split(\"=\")[1]\n optionsObject[optionKey] = optionValue\n })\n\n // specific replicaSet value to set options about hostReplicaSet\n replicaSet = optionsObject[\"replicaSet\"]\n afterBase = afterBase.substr(0, afterBase.indexOf(\"?\"))\n }\n\n const lastAtSign = base.lastIndexOf(\"@\")\n const usernameAndPassword = base.substr(0, lastAtSign)\n const hostAndPort = base.substr(lastAtSign + 1)\n\n let username = usernameAndPassword\n let password = \"\"\n const firstColon = usernameAndPassword.indexOf(\":\")\n if (firstColon !== -1) {\n username = usernameAndPassword.substr(0, firstColon)\n password = usernameAndPassword.substr(firstColon + 1)\n }\n\n // If replicaSet have value set It as hostlist, If not set like standalone host\n if (replicaSet) {\n hostReplicaSet = hostAndPort\n } else {\n ;[host, port] = hostAndPort.split(\":\")\n }\n\n let connectionUrl: any = {\n type: type,\n host: host,\n hostReplicaSet: hostReplicaSet,\n username: decodeURIComponent(username),\n password: decodeURIComponent(password),\n port: port ? parseInt(port) : undefined,\n database: afterBase || undefined,\n }\n\n // Loop to set every options in connectionUrl to object\n for (const [key, value] of Object.entries(optionsObject)) {\n connectionUrl[key] = value\n }\n\n return connectionUrl\n }\n}\n"],"sourceRoot":".."}
@@ -16,6 +16,7 @@ import { ReplicationMode } from "../types/ReplicationMode";
16
16
  import { Table } from "../../schema-builder/table/Table";
17
17
  import { View } from "../../schema-builder/view/View";
18
18
  import { TableForeignKey } from "../../schema-builder/table/TableForeignKey";
19
+ import { UpsertType } from "../types/UpsertType";
19
20
  /**
20
21
  * Organizes communication with MySQL DBMS.
21
22
  */
@@ -69,7 +70,7 @@ export declare class AuroraMysqlDriver implements Driver {
69
70
  /**
70
71
  * Returns type of upsert supported by driver if any
71
72
  */
72
- readonly supportedUpsertType = "on-duplicate-key-update";
73
+ supportedUpsertTypes: UpsertType[];
73
74
  /**
74
75
  * Gets list of spatial column data types.
75
76
  */
@@ -92,7 +92,7 @@ export class AuroraMysqlDriver {
92
92
  /**
93
93
  * Returns type of upsert supported by driver if any
94
94
  */
95
- this.supportedUpsertType = "on-duplicate-key-update";
95
+ this.supportedUpsertTypes = ["on-duplicate-key-update"];
96
96
  /**
97
97
  * Gets list of spatial column data types.
98
98
  */
@@ -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\"../Driver\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { AuroraMysqlQueryRunner } from \"./AuroraMysqlQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { DateUtils } from \"../../util/DateUtils\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { AuroraMysqlConnectionOptions } from \"./AuroraMysqlConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { AuroraMysqlConnectionCredentialsOptions } from \"./AuroraMysqlConnectionCredentialsOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\n\n/**\n * Organizes communication with MySQL DBMS.\n */\nexport class AuroraMysqlDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n connection: DataSource\n\n /**\n * Aurora Data API underlying library.\n */\n DataApiDriver: any\n\n client: any\n\n /**\n * Connection pool.\n * Used in non-replication mode.\n */\n pool: any\n\n /**\n * Pool cluster used in replication mode.\n */\n poolCluster: any\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: AuroraMysqlConnectionOptions\n\n /**\n * Database name used to perform all write queries.\n */\n database?: string\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = true\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"nested\" as const\n\n /**\n * Gets list of supported column data types by a driver.\n *\n * @see https://www.tutorialspoint.com/mysql/mysql-data-types.htm\n * @see https://dev.mysql.com/doc/refman/8.0/en/data-types.html\n */\n supportedDataTypes: ColumnType[] = [\n // numeric types\n \"bit\",\n \"int\",\n \"integer\", // synonym for int\n \"tinyint\",\n \"smallint\",\n \"mediumint\",\n \"bigint\",\n \"float\",\n \"double\",\n \"double precision\", // synonym for double\n \"real\", // synonym for double\n \"decimal\",\n \"dec\", // synonym for decimal\n \"numeric\", // synonym for decimal\n \"fixed\", // synonym for decimal\n \"bool\", // synonym for tinyint\n \"boolean\", // synonym for tinyint\n // date and time types\n \"date\",\n \"datetime\",\n \"timestamp\",\n \"time\",\n \"year\",\n // string types\n \"char\",\n \"nchar\", // synonym for national char\n \"national char\",\n \"varchar\",\n \"nvarchar\", // synonym for national varchar\n \"national varchar\",\n \"blob\",\n \"text\",\n \"tinyblob\",\n \"tinytext\",\n \"mediumblob\",\n \"mediumtext\",\n \"longblob\",\n \"longtext\",\n \"enum\",\n \"set\",\n \"binary\",\n \"varbinary\",\n // json data type\n \"json\",\n // spatial data types\n \"geometry\",\n \"point\",\n \"linestring\",\n \"polygon\",\n \"multipoint\",\n \"multilinestring\",\n \"multipolygon\",\n \"geometrycollection\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n readonly supportedUpsertType = \"on-duplicate-key-update\"\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = [\n \"geometry\",\n \"point\",\n \"linestring\",\n \"polygon\",\n \"multipoint\",\n \"multilinestring\",\n \"multipolygon\",\n \"geometrycollection\",\n ]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = [\n \"char\",\n \"varchar\",\n \"nvarchar\",\n \"binary\",\n \"varbinary\",\n ]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withWidthColumnTypes: ColumnType[] = [\n \"bit\",\n \"tinyint\",\n \"smallint\",\n \"mediumint\",\n \"int\",\n \"integer\",\n \"bigint\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n \"time\",\n \"datetime\",\n \"timestamp\",\n ]\n\n /**\n * Gets list of column data types that supports scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n ]\n\n /**\n * Gets list of column data types that supports UNSIGNED and ZEROFILL attributes.\n */\n unsignedAndZerofillTypes: ColumnType[] = [\n \"int\",\n \"integer\",\n \"smallint\",\n \"tinyint\",\n \"mediumint\",\n \"bigint\",\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n ]\n\n /**\n * ORM has special columns and we need to know what database column types should be for those columns.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"datetime\",\n createDatePrecision: 6,\n createDateDefault: \"CURRENT_TIMESTAMP(6)\",\n updateDate: \"datetime\",\n updateDatePrecision: 6,\n updateDateDefault: \"CURRENT_TIMESTAMP(6)\",\n deleteDate: \"datetime\",\n deleteDatePrecision: 6,\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"varchar\",\n migrationTimestamp: \"bigint\",\n cacheId: \"int\",\n cacheIdentifier: \"varchar\",\n cacheTime: \"bigint\",\n cacheDuration: \"int\",\n cacheQuery: \"text\",\n cacheResult: \"text\",\n metadataType: \"varchar\",\n metadataDatabase: \"varchar\",\n metadataSchema: \"varchar\",\n metadataTable: \"varchar\",\n metadataName: \"varchar\",\n metadataValue: \"text\",\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults = {\n varchar: { length: 255 },\n nvarchar: { length: 255 },\n \"national varchar\": { length: 255 },\n char: { length: 1 },\n binary: { length: 1 },\n varbinary: { length: 255 },\n decimal: { precision: 10, scale: 0 },\n dec: { precision: 10, scale: 0 },\n numeric: { precision: 10, scale: 0 },\n fixed: { precision: 10, scale: 0 },\n float: { precision: 12 },\n double: { precision: 22 },\n time: { precision: 0 },\n datetime: { precision: 0 },\n timestamp: { precision: 0 },\n bit: { width: 1 },\n int: { width: 11 },\n integer: { width: 11 },\n tinyint: { width: 4 },\n smallint: { width: 6 },\n mediumint: { width: 9 },\n bigint: { width: 20 },\n }\n\n /**\n * Max length allowed by MySQL for aliases.\n * @see https://dev.mysql.com/doc/refman/5.5/en/identifiers.html\n */\n maxAliasLength = 63\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as AuroraMysqlConnectionOptions\n\n // load mysql package\n this.loadDependencies()\n\n this.client = new this.DataApiDriver(\n this.options.region,\n this.options.secretArn,\n this.options.resourceArn,\n this.options.database,\n (query: string, parameters?: any[]) =>\n this.connection.logger.logQuery(query, parameters),\n this.options.serviceConfigOptions,\n this.options.formatOptions,\n )\n\n this.database = DriverUtils.buildDriverOptions(this.options).database\n\n // validate options to make sure everything is set\n // todo: revisit validation with replication in mind\n // if (!(this.options.host || (this.options.extra && this.options.extra.socketPath)) && !this.options.socketPath)\n // throw new DriverOptionNotSetError(\"socketPath and host\");\n // if (!this.options.username)\n // throw new DriverOptionNotSetError(\"username\");\n // if (!this.options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // todo: check what is going on when connection is setup without database and how to connect to a database then?\n // todo: provide options to auto-create a database if it does not exist yet\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n if (!this.database) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n this.database = await queryRunner.getCurrentDatabase()\n\n await queryRunner.release()\n }\n }\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {}\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new RdbmsSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return new AuroraMysqlQueryRunner(\n this,\n new this.DataApiDriver(\n this.options.region,\n this.options.secretArn,\n this.options.resourceArn,\n this.options.database,\n (query: string, parameters?: any[]) =>\n this.connection.logger.logQuery(query, parameters),\n this.options.serviceConfigOptions,\n this.options.formatOptions,\n ),\n )\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n const escapedParameters: any[] = Object.keys(nativeParameters).map(\n (key) => nativeParameters[key],\n )\n if (!parameters || !Object.keys(parameters).length)\n return [sql, escapedParameters]\n\n sql = sql.replace(\n /:(\\.\\.\\.)?([A-Za-z0-9_.]+)/g,\n (full, isArray: string, key: string): string => {\n if (!parameters.hasOwnProperty(key)) {\n return full\n }\n\n let value: any = parameters[key]\n\n if (isArray) {\n return value\n .map((v: any) => {\n escapedParameters.push(v)\n return this.createParameter(\n key,\n escapedParameters.length - 1,\n )\n })\n .join(\", \")\n }\n\n if (typeof value === \"function\") {\n return value()\n }\n\n escapedParameters.push(value)\n return this.createParameter(key, escapedParameters.length - 1)\n },\n ) // todo: make replace only in value statements, otherwise problems\n return [sql, escapedParameters]\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return \"`\" + columnName + \"`\"\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n let tablePath = [tableName]\n\n if (database) {\n tablePath.unshift(database)\n }\n\n return tablePath.join(\".\")\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { database?: string; schema?: string; tableName: string } {\n const driverDatabase = this.database\n const driverSchema = undefined\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n const parsed = this.parseTableName(target.name)\n\n return {\n database: target.database || parsed.database || driverDatabase,\n schema: target.schema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n const parsed = this.parseTableName(target.referencedTableName)\n\n return {\n database:\n target.referencedDatabase ||\n parsed.database ||\n driverDatabase,\n schema:\n target.referencedSchema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isEntityMetadata(target)) {\n // EntityMetadata tableName is never a path\n\n return {\n database: target.database || driverDatabase,\n schema: target.schema || driverSchema,\n tableName: target.tableName,\n }\n }\n\n const parts = target.split(\".\")\n\n return {\n database:\n (parts.length > 1 ? parts[0] : undefined) || driverDatabase,\n schema: driverSchema,\n tableName: parts.length > 1 ? parts[1] : parts[0],\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n\n if (\n !this.options.formatOptions ||\n this.options.formatOptions.castParameters !== false\n ) {\n return this.client.preparePersistentValue(value, columnMetadata)\n }\n\n if (value === null || value === undefined) return value\n\n if (columnMetadata.type === Boolean) {\n return value === true ? 1 : 0\n } else if (columnMetadata.type === \"date\") {\n return DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n return DateUtils.mixedDateToTimeString(value)\n } else if (columnMetadata.type === \"json\") {\n return JSON.stringify(value)\n } else if (\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date\n ) {\n return DateUtils.mixedDateToDate(value)\n } else if (\n columnMetadata.type === \"simple-array\" ||\n columnMetadata.type === \"set\"\n ) {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(value)\n } else if (\n columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\"\n ) {\n return \"\" + value\n }\n\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (value === null || value === undefined)\n return columnMetadata.transformer\n ? ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n : value\n\n if (\n !this.options.formatOptions ||\n this.options.formatOptions.castParameters !== false\n ) {\n return this.client.prepareHydratedValue(value, columnMetadata)\n }\n\n if (\n columnMetadata.type === Boolean ||\n columnMetadata.type === \"bool\" ||\n columnMetadata.type === \"boolean\"\n ) {\n value = value ? true : false\n } else if (\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"json\") {\n value = typeof value === \"string\" ? JSON.parse(value) : value\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (\n columnMetadata.type === \"simple-array\" ||\n columnMetadata.type === \"set\"\n ) {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(value)\n } else if (\n (columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\") &&\n columnMetadata.enum &&\n !isNaN(value) &&\n columnMetadata.enum.indexOf(parseInt(value)) >= 0\n ) {\n // convert to number if that exists in possible enum options\n value = parseInt(value)\n } else if (columnMetadata.type === Number) {\n // convert to number if number\n value = !isNaN(+value) ? parseInt(value) : value\n }\n\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n if (column.type === Number || column.type === \"integer\") {\n return \"int\"\n } else if (column.type === String) {\n return \"varchar\"\n } else if (column.type === Date) {\n return \"datetime\"\n } else if ((column.type as any) === Buffer) {\n return \"blob\"\n } else if (column.type === Boolean) {\n return \"tinyint\"\n } else if (column.type === \"uuid\") {\n return \"varchar\"\n } else if (\n column.type === \"simple-array\" ||\n column.type === \"simple-json\"\n ) {\n return \"text\"\n } else if (column.type === \"simple-enum\") {\n return \"enum\"\n } else if (\n column.type === \"double precision\" ||\n column.type === \"real\"\n ) {\n return \"double\"\n } else if (\n column.type === \"dec\" ||\n column.type === \"numeric\" ||\n column.type === \"fixed\"\n ) {\n return \"decimal\"\n } else if (column.type === \"bool\" || column.type === \"boolean\") {\n return \"tinyint\"\n } else if (\n column.type === \"nvarchar\" ||\n column.type === \"national varchar\"\n ) {\n return \"varchar\"\n } else if (column.type === \"nchar\" || column.type === \"national char\") {\n return \"char\"\n } else {\n return (column.type as string) || \"\"\n }\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n const defaultValue = columnMetadata.default\n\n if (defaultValue === null) {\n return undefined\n }\n\n if (\n (columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\") &&\n defaultValue !== undefined\n ) {\n return `'${defaultValue}'`\n }\n\n if (columnMetadata.type === \"set\" && defaultValue !== undefined) {\n return `'${DateUtils.simpleArrayToString(defaultValue)}'`\n }\n\n if (typeof defaultValue === \"number\") {\n return `${defaultValue}`\n }\n\n if (typeof defaultValue === \"boolean\") {\n return defaultValue ? \"1\" : \"0\"\n }\n\n if (typeof defaultValue === \"function\") {\n return defaultValue()\n }\n\n if (typeof defaultValue === \"string\") {\n return `'${defaultValue}'`\n }\n\n if (defaultValue === undefined) {\n return undefined\n }\n\n return `${defaultValue}`\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n return column.entityMetadata.indices.some(\n (idx) =>\n idx.isUnique &&\n idx.columns.length === 1 &&\n idx.columns[0] === column,\n )\n }\n\n /**\n * Returns default column lengths, which is required on column creation.\n */\n getColumnLength(column: ColumnMetadata | TableColumn): string {\n if (column.length) return column.length.toString()\n\n /**\n * fix https://github.com/typeorm/typeorm/issues/1139\n */\n if (column.generationStrategy === \"uuid\") return \"36\"\n\n switch (column.type) {\n case String:\n case \"varchar\":\n case \"nvarchar\":\n case \"national varchar\":\n return \"255\"\n case \"varbinary\":\n return \"255\"\n default:\n return \"\"\n }\n }\n\n /**\n * Creates column type definition including length, precision and scale\n */\n createFullType(column: TableColumn): string {\n let type = column.type\n\n // used 'getColumnLength()' method, because MySQL requires column length for `varchar`, `nvarchar` and `varbinary` data types\n if (this.getColumnLength(column)) {\n type += `(${this.getColumnLength(column)})`\n } else if (column.width) {\n type += `(${column.width})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined &&\n column.scale !== null &&\n column.scale !== undefined\n ) {\n type += `(${column.precision},${column.scale})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined\n ) {\n type += `(${column.precision})`\n }\n\n if (column.isArray) type += \" array\"\n\n return type\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return new Promise<any>((ok, fail) => {\n if (this.poolCluster) {\n this.poolCluster.getConnection(\n \"MASTER\",\n (err: any, dbConnection: any) => {\n err\n ? fail(err)\n : ok(this.prepareDbConnection(dbConnection))\n },\n )\n } else if (this.pool) {\n this.pool.getConnection((err: any, dbConnection: any) => {\n err ? fail(err) : ok(this.prepareDbConnection(dbConnection))\n })\n } else {\n fail(\n new TypeORMError(\n `Connection is not established with mysql database`,\n ),\n )\n }\n })\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n if (!this.poolCluster) return this.obtainMasterConnection()\n\n return new Promise<any>((ok, fail) => {\n this.poolCluster.getConnection(\n \"SLAVE*\",\n (err: any, dbConnection: any) => {\n err ? fail(err) : ok(this.prepareDbConnection(dbConnection))\n },\n )\n })\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(\n metadata: EntityMetadata,\n insertResult: any,\n entityIndex: number,\n ) {\n const generatedMap = metadata.generatedColumns.reduce(\n (map, generatedColumn) => {\n let value: any\n if (\n generatedColumn.generationStrategy === \"increment\" &&\n insertResult.insertId\n ) {\n // NOTE: When multiple rows is inserted by a single INSERT statement,\n // `insertId` is the value generated for the first inserted row only.\n value = insertResult.insertId + entityIndex\n // } else if (generatedColumn.generationStrategy === \"uuid\") {\n // console.log(\"getting db value:\", generatedColumn.databaseName);\n // value = generatedColumn.getEntityValue(uuidMap);\n }\n\n return OrmUtils.mergeDeep(\n map,\n generatedColumn.createValueMap(value),\n )\n },\n {} as ObjectLiteral,\n )\n\n return Object.keys(generatedMap).length > 0 ? generatedMap : undefined\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n return columnMetadatas.filter((columnMetadata) => {\n const tableColumn = tableColumns.find(\n (c) => c.name === columnMetadata.databaseName,\n )\n if (!tableColumn) return false // we don't need new columns, we only need exist and changed\n\n // console.log(\"table:\", columnMetadata.entityMetadata.tableName);\n // console.log(\"name:\", tableColumn.name, columnMetadata.databaseName);\n // console.log(\"type:\", tableColumn.type, this.normalizeType(columnMetadata));\n // console.log(\"length:\", tableColumn.length, columnMetadata.length);\n // console.log(\"width:\", tableColumn.width, columnMetadata.width);\n // console.log(\"precision:\", tableColumn.precision, columnMetadata.precision);\n // console.log(\"scale:\", tableColumn.scale, columnMetadata.scale);\n // console.log(\"zerofill:\", tableColumn.zerofill, columnMetadata.zerofill);\n // console.log(\"unsigned:\", tableColumn.unsigned, columnMetadata.unsigned);\n // console.log(\"asExpression:\", tableColumn.asExpression, columnMetadata.asExpression);\n // console.log(\"generatedType:\", tableColumn.generatedType, columnMetadata.generatedType);\n // console.log(\"comment:\", tableColumn.comment, this.escapeComment(columnMetadata.comment));\n // console.log(\"default:\", tableColumn.default, columnMetadata.default);\n // console.log(\"enum:\", tableColumn.enum, columnMetadata.enum);\n // console.log(\"default changed:\", !this.compareDefaultValues(this.normalizeDefault(columnMetadata), tableColumn.default));\n // console.log(\"onUpdate:\", tableColumn.onUpdate, columnMetadata.onUpdate);\n // console.log(\"isPrimary:\", tableColumn.isPrimary, columnMetadata.isPrimary);\n // console.log(\"isNullable:\", tableColumn.isNullable, columnMetadata.isNullable);\n // console.log(\"isUnique:\", tableColumn.isUnique, this.normalizeIsUnique(columnMetadata));\n // console.log(\"isGenerated:\", tableColumn.isGenerated, columnMetadata.isGenerated);\n // console.log((columnMetadata.generationStrategy !== \"uuid\" && tableColumn.isGenerated !== columnMetadata.isGenerated));\n // console.log(\"==========================================\");\n\n let columnMetadataLength = columnMetadata.length\n if (\n !columnMetadataLength &&\n columnMetadata.generationStrategy === \"uuid\"\n ) {\n // fixing #3374\n columnMetadataLength = this.getColumnLength(columnMetadata)\n }\n\n return (\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n tableColumn.length !== columnMetadataLength ||\n tableColumn.width !== columnMetadata.width ||\n tableColumn.precision !== columnMetadata.precision ||\n tableColumn.scale !== columnMetadata.scale ||\n tableColumn.zerofill !== columnMetadata.zerofill ||\n tableColumn.unsigned !== columnMetadata.unsigned ||\n tableColumn.asExpression !== columnMetadata.asExpression ||\n tableColumn.generatedType !== columnMetadata.generatedType ||\n tableColumn.comment !==\n this.escapeComment(columnMetadata.comment) ||\n !this.compareDefaultValues(\n this.normalizeDefault(columnMetadata),\n tableColumn.default,\n ) ||\n (tableColumn.enum &&\n columnMetadata.enum &&\n !OrmUtils.isArraysEqual(\n tableColumn.enum,\n columnMetadata.enum.map((val) => val + \"\"),\n )) ||\n tableColumn.onUpdate !== columnMetadata.onUpdate ||\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n (columnMetadata.generationStrategy !== \"uuid\" &&\n tableColumn.isGenerated !== columnMetadata.isGenerated)\n )\n })\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return true\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"?\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): void {\n const DataApiDriver =\n this.options.driver ||\n PlatformTools.load(\"typeorm-aurora-data-api-driver\")\n this.DataApiDriver = DataApiDriver\n\n // Driver uses rollup for publishing, which has issues when using typeorm in combination with webpack\n // See https://github.com/webpack/webpack/issues/4742#issuecomment-295556787\n this.DataApiDriver = this.DataApiDriver.default || this.DataApiDriver\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected createConnectionOptions(\n options: AuroraMysqlConnectionOptions,\n credentials: AuroraMysqlConnectionCredentialsOptions,\n ): Promise<any> {\n credentials = Object.assign(\n {},\n credentials,\n DriverUtils.buildDriverOptions(credentials),\n ) // todo: do it better way\n\n // build connection options for the driver\n return Object.assign(\n {},\n {\n resourceArn: options.resourceArn,\n secretArn: options.secretArn,\n database: options.database,\n region: options.region,\n type: options.type,\n },\n {\n host: credentials.host,\n user: credentials.username,\n password: credentials.password,\n database: credentials.database,\n port: credentials.port,\n ssl: options.ssl,\n },\n\n options.extra || {},\n )\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected async createPool(connectionOptions: any): Promise<any> {\n return {}\n }\n\n /**\n * Attaches all required base handlers to a database connection, such as the unhandled error handler.\n */\n private prepareDbConnection(connection: any): any {\n const { logger } = this.connection\n /**\n * Attaching an error handler to connection errors is essential, as, otherwise, errors raised will go unhandled and\n * cause the hosting app to crash.\n */\n if (connection.listeners(\"error\").length === 0) {\n connection.on(\"error\", (error: any) =>\n logger.log(\n \"warn\",\n `MySQL connection raised an error. ${error}`,\n ),\n )\n }\n return connection\n }\n\n /**\n * Checks if \"DEFAULT\" values in the column metadata and in the database are equal.\n */\n protected compareDefaultValues(\n columnMetadataValue: string | undefined,\n databaseValue: string | undefined,\n ): boolean {\n if (\n typeof columnMetadataValue === \"string\" &&\n typeof databaseValue === \"string\"\n ) {\n // we need to cut out \"'\" because in mysql we can understand returned value is a string or a function\n // as result compare cannot understand if default is really changed or not\n columnMetadataValue = columnMetadataValue.replace(/^'+|'+$/g, \"\")\n databaseValue = databaseValue.replace(/^'+|'+$/g, \"\")\n }\n\n return columnMetadataValue === databaseValue\n }\n\n /**\n * Escapes a given comment.\n */\n protected escapeComment(comment?: string) {\n if (!comment) return comment\n\n comment = comment.replace(/\\u0000/g, \"\") // Null bytes aren't allowed in comments\n\n return comment\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/aurora-mysql/AuroraMysqlDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAGjE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAQ5E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAgS1B,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAY,UAAsB;QAxPlC;;WAEG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;WAEG;QACH,gBAAW,GAAG,IAAI,CAAA;QAElB;;WAEG;QACH,uBAAkB,GAAG,QAAiB,CAAA;QAEtC;;;;;WAKG;QACH,uBAAkB,GAAiB;YAC/B,gBAAgB;YAChB,KAAK;YACL,KAAK;YACL,SAAS;YACT,SAAS;YACT,UAAU;YACV,WAAW;YACX,QAAQ;YACR,OAAO;YACP,QAAQ;YACR,kBAAkB;YAClB,MAAM;YACN,SAAS;YACT,KAAK;YACL,SAAS;YACT,OAAO;YACP,MAAM;YACN,SAAS;YACT,sBAAsB;YACtB,MAAM;YACN,UAAU;YACV,WAAW;YACX,MAAM;YACN,MAAM;YACN,eAAe;YACf,MAAM;YACN,OAAO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AAE,CAAC,CAAA,CAAC,wCAAwC;QAEjF,OAAO,OAAO,CAAA;IAClB,CAAC;CACJ","file":"AuroraMysqlDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { AuroraMysqlQueryRunner } from \"./AuroraMysqlQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { DateUtils } from \"../../util/DateUtils\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { AuroraMysqlConnectionOptions } from \"./AuroraMysqlConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { AuroraMysqlConnectionCredentialsOptions } from \"./AuroraMysqlConnectionCredentialsOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with MySQL DBMS.\n */\nexport class AuroraMysqlDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n connection: DataSource\n\n /**\n * Aurora Data API underlying library.\n */\n DataApiDriver: any\n\n client: any\n\n /**\n * Connection pool.\n * Used in non-replication mode.\n */\n pool: any\n\n /**\n * Pool cluster used in replication mode.\n */\n poolCluster: any\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: AuroraMysqlConnectionOptions\n\n /**\n * Database name used to perform all write queries.\n */\n database?: string\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = true\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"nested\" as const\n\n /**\n * Gets list of supported column data types by a driver.\n *\n * @see https://www.tutorialspoint.com/mysql/mysql-data-types.htm\n * @see https://dev.mysql.com/doc/refman/8.0/en/data-types.html\n */\n supportedDataTypes: ColumnType[] = [\n // numeric types\n \"bit\",\n \"int\",\n \"integer\", // synonym for int\n \"tinyint\",\n \"smallint\",\n \"mediumint\",\n \"bigint\",\n \"float\",\n \"double\",\n \"double precision\", // synonym for double\n \"real\", // synonym for double\n \"decimal\",\n \"dec\", // synonym for decimal\n \"numeric\", // synonym for decimal\n \"fixed\", // synonym for decimal\n \"bool\", // synonym for tinyint\n \"boolean\", // synonym for tinyint\n // date and time types\n \"date\",\n \"datetime\",\n \"timestamp\",\n \"time\",\n \"year\",\n // string types\n \"char\",\n \"nchar\", // synonym for national char\n \"national char\",\n \"varchar\",\n \"nvarchar\", // synonym for national varchar\n \"national varchar\",\n \"blob\",\n \"text\",\n \"tinyblob\",\n \"tinytext\",\n \"mediumblob\",\n \"mediumtext\",\n \"longblob\",\n \"longtext\",\n \"enum\",\n \"set\",\n \"binary\",\n \"varbinary\",\n // json data type\n \"json\",\n // spatial data types\n \"geometry\",\n \"point\",\n \"linestring\",\n \"polygon\",\n \"multipoint\",\n \"multilinestring\",\n \"multipolygon\",\n \"geometrycollection\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[] = [\"on-duplicate-key-update\"]\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = [\n \"geometry\",\n \"point\",\n \"linestring\",\n \"polygon\",\n \"multipoint\",\n \"multilinestring\",\n \"multipolygon\",\n \"geometrycollection\",\n ]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = [\n \"char\",\n \"varchar\",\n \"nvarchar\",\n \"binary\",\n \"varbinary\",\n ]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withWidthColumnTypes: ColumnType[] = [\n \"bit\",\n \"tinyint\",\n \"smallint\",\n \"mediumint\",\n \"int\",\n \"integer\",\n \"bigint\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n \"time\",\n \"datetime\",\n \"timestamp\",\n ]\n\n /**\n * Gets list of column data types that supports scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n ]\n\n /**\n * Gets list of column data types that supports UNSIGNED and ZEROFILL attributes.\n */\n unsignedAndZerofillTypes: ColumnType[] = [\n \"int\",\n \"integer\",\n \"smallint\",\n \"tinyint\",\n \"mediumint\",\n \"bigint\",\n \"decimal\",\n \"dec\",\n \"numeric\",\n \"fixed\",\n \"float\",\n \"double\",\n \"double precision\",\n \"real\",\n ]\n\n /**\n * ORM has special columns and we need to know what database column types should be for those columns.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"datetime\",\n createDatePrecision: 6,\n createDateDefault: \"CURRENT_TIMESTAMP(6)\",\n updateDate: \"datetime\",\n updateDatePrecision: 6,\n updateDateDefault: \"CURRENT_TIMESTAMP(6)\",\n deleteDate: \"datetime\",\n deleteDatePrecision: 6,\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"varchar\",\n migrationTimestamp: \"bigint\",\n cacheId: \"int\",\n cacheIdentifier: \"varchar\",\n cacheTime: \"bigint\",\n cacheDuration: \"int\",\n cacheQuery: \"text\",\n cacheResult: \"text\",\n metadataType: \"varchar\",\n metadataDatabase: \"varchar\",\n metadataSchema: \"varchar\",\n metadataTable: \"varchar\",\n metadataName: \"varchar\",\n metadataValue: \"text\",\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults = {\n varchar: { length: 255 },\n nvarchar: { length: 255 },\n \"national varchar\": { length: 255 },\n char: { length: 1 },\n binary: { length: 1 },\n varbinary: { length: 255 },\n decimal: { precision: 10, scale: 0 },\n dec: { precision: 10, scale: 0 },\n numeric: { precision: 10, scale: 0 },\n fixed: { precision: 10, scale: 0 },\n float: { precision: 12 },\n double: { precision: 22 },\n time: { precision: 0 },\n datetime: { precision: 0 },\n timestamp: { precision: 0 },\n bit: { width: 1 },\n int: { width: 11 },\n integer: { width: 11 },\n tinyint: { width: 4 },\n smallint: { width: 6 },\n mediumint: { width: 9 },\n bigint: { width: 20 },\n }\n\n /**\n * Max length allowed by MySQL for aliases.\n * @see https://dev.mysql.com/doc/refman/5.5/en/identifiers.html\n */\n maxAliasLength = 63\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as AuroraMysqlConnectionOptions\n\n // load mysql package\n this.loadDependencies()\n\n this.client = new this.DataApiDriver(\n this.options.region,\n this.options.secretArn,\n this.options.resourceArn,\n this.options.database,\n (query: string, parameters?: any[]) =>\n this.connection.logger.logQuery(query, parameters),\n this.options.serviceConfigOptions,\n this.options.formatOptions,\n )\n\n this.database = DriverUtils.buildDriverOptions(this.options).database\n\n // validate options to make sure everything is set\n // todo: revisit validation with replication in mind\n // if (!(this.options.host || (this.options.extra && this.options.extra.socketPath)) && !this.options.socketPath)\n // throw new DriverOptionNotSetError(\"socketPath and host\");\n // if (!this.options.username)\n // throw new DriverOptionNotSetError(\"username\");\n // if (!this.options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // todo: check what is going on when connection is setup without database and how to connect to a database then?\n // todo: provide options to auto-create a database if it does not exist yet\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n if (!this.database) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n this.database = await queryRunner.getCurrentDatabase()\n\n await queryRunner.release()\n }\n }\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {}\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new RdbmsSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return new AuroraMysqlQueryRunner(\n this,\n new this.DataApiDriver(\n this.options.region,\n this.options.secretArn,\n this.options.resourceArn,\n this.options.database,\n (query: string, parameters?: any[]) =>\n this.connection.logger.logQuery(query, parameters),\n this.options.serviceConfigOptions,\n this.options.formatOptions,\n ),\n )\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n const escapedParameters: any[] = Object.keys(nativeParameters).map(\n (key) => nativeParameters[key],\n )\n if (!parameters || !Object.keys(parameters).length)\n return [sql, escapedParameters]\n\n sql = sql.replace(\n /:(\\.\\.\\.)?([A-Za-z0-9_.]+)/g,\n (full, isArray: string, key: string): string => {\n if (!parameters.hasOwnProperty(key)) {\n return full\n }\n\n let value: any = parameters[key]\n\n if (isArray) {\n return value\n .map((v: any) => {\n escapedParameters.push(v)\n return this.createParameter(\n key,\n escapedParameters.length - 1,\n )\n })\n .join(\", \")\n }\n\n if (typeof value === \"function\") {\n return value()\n }\n\n escapedParameters.push(value)\n return this.createParameter(key, escapedParameters.length - 1)\n },\n ) // todo: make replace only in value statements, otherwise problems\n return [sql, escapedParameters]\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return \"`\" + columnName + \"`\"\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n let tablePath = [tableName]\n\n if (database) {\n tablePath.unshift(database)\n }\n\n return tablePath.join(\".\")\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { database?: string; schema?: string; tableName: string } {\n const driverDatabase = this.database\n const driverSchema = undefined\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n const parsed = this.parseTableName(target.name)\n\n return {\n database: target.database || parsed.database || driverDatabase,\n schema: target.schema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n const parsed = this.parseTableName(target.referencedTableName)\n\n return {\n database:\n target.referencedDatabase ||\n parsed.database ||\n driverDatabase,\n schema:\n target.referencedSchema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isEntityMetadata(target)) {\n // EntityMetadata tableName is never a path\n\n return {\n database: target.database || driverDatabase,\n schema: target.schema || driverSchema,\n tableName: target.tableName,\n }\n }\n\n const parts = target.split(\".\")\n\n return {\n database:\n (parts.length > 1 ? parts[0] : undefined) || driverDatabase,\n schema: driverSchema,\n tableName: parts.length > 1 ? parts[1] : parts[0],\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n\n if (\n !this.options.formatOptions ||\n this.options.formatOptions.castParameters !== false\n ) {\n return this.client.preparePersistentValue(value, columnMetadata)\n }\n\n if (value === null || value === undefined) return value\n\n if (columnMetadata.type === Boolean) {\n return value === true ? 1 : 0\n } else if (columnMetadata.type === \"date\") {\n return DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n return DateUtils.mixedDateToTimeString(value)\n } else if (columnMetadata.type === \"json\") {\n return JSON.stringify(value)\n } else if (\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date\n ) {\n return DateUtils.mixedDateToDate(value)\n } else if (\n columnMetadata.type === \"simple-array\" ||\n columnMetadata.type === \"set\"\n ) {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(value)\n } else if (\n columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\"\n ) {\n return \"\" + value\n }\n\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (value === null || value === undefined)\n return columnMetadata.transformer\n ? ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n : value\n\n if (\n !this.options.formatOptions ||\n this.options.formatOptions.castParameters !== false\n ) {\n return this.client.prepareHydratedValue(value, columnMetadata)\n }\n\n if (\n columnMetadata.type === Boolean ||\n columnMetadata.type === \"bool\" ||\n columnMetadata.type === \"boolean\"\n ) {\n value = value ? true : false\n } else if (\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"json\") {\n value = typeof value === \"string\" ? JSON.parse(value) : value\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (\n columnMetadata.type === \"simple-array\" ||\n columnMetadata.type === \"set\"\n ) {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(value)\n } else if (\n (columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\") &&\n columnMetadata.enum &&\n !isNaN(value) &&\n columnMetadata.enum.indexOf(parseInt(value)) >= 0\n ) {\n // convert to number if that exists in possible enum options\n value = parseInt(value)\n } else if (columnMetadata.type === Number) {\n // convert to number if number\n value = !isNaN(+value) ? parseInt(value) : value\n }\n\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n if (column.type === Number || column.type === \"integer\") {\n return \"int\"\n } else if (column.type === String) {\n return \"varchar\"\n } else if (column.type === Date) {\n return \"datetime\"\n } else if ((column.type as any) === Buffer) {\n return \"blob\"\n } else if (column.type === Boolean) {\n return \"tinyint\"\n } else if (column.type === \"uuid\") {\n return \"varchar\"\n } else if (\n column.type === \"simple-array\" ||\n column.type === \"simple-json\"\n ) {\n return \"text\"\n } else if (column.type === \"simple-enum\") {\n return \"enum\"\n } else if (\n column.type === \"double precision\" ||\n column.type === \"real\"\n ) {\n return \"double\"\n } else if (\n column.type === \"dec\" ||\n column.type === \"numeric\" ||\n column.type === \"fixed\"\n ) {\n return \"decimal\"\n } else if (column.type === \"bool\" || column.type === \"boolean\") {\n return \"tinyint\"\n } else if (\n column.type === \"nvarchar\" ||\n column.type === \"national varchar\"\n ) {\n return \"varchar\"\n } else if (column.type === \"nchar\" || column.type === \"national char\") {\n return \"char\"\n } else {\n return (column.type as string) || \"\"\n }\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n const defaultValue = columnMetadata.default\n\n if (defaultValue === null) {\n return undefined\n }\n\n if (\n (columnMetadata.type === \"enum\" ||\n columnMetadata.type === \"simple-enum\") &&\n defaultValue !== undefined\n ) {\n return `'${defaultValue}'`\n }\n\n if (columnMetadata.type === \"set\" && defaultValue !== undefined) {\n return `'${DateUtils.simpleArrayToString(defaultValue)}'`\n }\n\n if (typeof defaultValue === \"number\") {\n return `${defaultValue}`\n }\n\n if (typeof defaultValue === \"boolean\") {\n return defaultValue ? \"1\" : \"0\"\n }\n\n if (typeof defaultValue === \"function\") {\n return defaultValue()\n }\n\n if (typeof defaultValue === \"string\") {\n return `'${defaultValue}'`\n }\n\n if (defaultValue === undefined) {\n return undefined\n }\n\n return `${defaultValue}`\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n return column.entityMetadata.indices.some(\n (idx) =>\n idx.isUnique &&\n idx.columns.length === 1 &&\n idx.columns[0] === column,\n )\n }\n\n /**\n * Returns default column lengths, which is required on column creation.\n */\n getColumnLength(column: ColumnMetadata | TableColumn): string {\n if (column.length) return column.length.toString()\n\n /**\n * fix https://github.com/typeorm/typeorm/issues/1139\n */\n if (column.generationStrategy === \"uuid\") return \"36\"\n\n switch (column.type) {\n case String:\n case \"varchar\":\n case \"nvarchar\":\n case \"national varchar\":\n return \"255\"\n case \"varbinary\":\n return \"255\"\n default:\n return \"\"\n }\n }\n\n /**\n * Creates column type definition including length, precision and scale\n */\n createFullType(column: TableColumn): string {\n let type = column.type\n\n // used 'getColumnLength()' method, because MySQL requires column length for `varchar`, `nvarchar` and `varbinary` data types\n if (this.getColumnLength(column)) {\n type += `(${this.getColumnLength(column)})`\n } else if (column.width) {\n type += `(${column.width})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined &&\n column.scale !== null &&\n column.scale !== undefined\n ) {\n type += `(${column.precision},${column.scale})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined\n ) {\n type += `(${column.precision})`\n }\n\n if (column.isArray) type += \" array\"\n\n return type\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return new Promise<any>((ok, fail) => {\n if (this.poolCluster) {\n this.poolCluster.getConnection(\n \"MASTER\",\n (err: any, dbConnection: any) => {\n err\n ? fail(err)\n : ok(this.prepareDbConnection(dbConnection))\n },\n )\n } else if (this.pool) {\n this.pool.getConnection((err: any, dbConnection: any) => {\n err ? fail(err) : ok(this.prepareDbConnection(dbConnection))\n })\n } else {\n fail(\n new TypeORMError(\n `Connection is not established with mysql database`,\n ),\n )\n }\n })\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n if (!this.poolCluster) return this.obtainMasterConnection()\n\n return new Promise<any>((ok, fail) => {\n this.poolCluster.getConnection(\n \"SLAVE*\",\n (err: any, dbConnection: any) => {\n err ? fail(err) : ok(this.prepareDbConnection(dbConnection))\n },\n )\n })\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(\n metadata: EntityMetadata,\n insertResult: any,\n entityIndex: number,\n ) {\n const generatedMap = metadata.generatedColumns.reduce(\n (map, generatedColumn) => {\n let value: any\n if (\n generatedColumn.generationStrategy === \"increment\" &&\n insertResult.insertId\n ) {\n // NOTE: When multiple rows is inserted by a single INSERT statement,\n // `insertId` is the value generated for the first inserted row only.\n value = insertResult.insertId + entityIndex\n // } else if (generatedColumn.generationStrategy === \"uuid\") {\n // console.log(\"getting db value:\", generatedColumn.databaseName);\n // value = generatedColumn.getEntityValue(uuidMap);\n }\n\n return OrmUtils.mergeDeep(\n map,\n generatedColumn.createValueMap(value),\n )\n },\n {} as ObjectLiteral,\n )\n\n return Object.keys(generatedMap).length > 0 ? generatedMap : undefined\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n return columnMetadatas.filter((columnMetadata) => {\n const tableColumn = tableColumns.find(\n (c) => c.name === columnMetadata.databaseName,\n )\n if (!tableColumn) return false // we don't need new columns, we only need exist and changed\n\n // console.log(\"table:\", columnMetadata.entityMetadata.tableName);\n // console.log(\"name:\", tableColumn.name, columnMetadata.databaseName);\n // console.log(\"type:\", tableColumn.type, this.normalizeType(columnMetadata));\n // console.log(\"length:\", tableColumn.length, columnMetadata.length);\n // console.log(\"width:\", tableColumn.width, columnMetadata.width);\n // console.log(\"precision:\", tableColumn.precision, columnMetadata.precision);\n // console.log(\"scale:\", tableColumn.scale, columnMetadata.scale);\n // console.log(\"zerofill:\", tableColumn.zerofill, columnMetadata.zerofill);\n // console.log(\"unsigned:\", tableColumn.unsigned, columnMetadata.unsigned);\n // console.log(\"asExpression:\", tableColumn.asExpression, columnMetadata.asExpression);\n // console.log(\"generatedType:\", tableColumn.generatedType, columnMetadata.generatedType);\n // console.log(\"comment:\", tableColumn.comment, this.escapeComment(columnMetadata.comment));\n // console.log(\"default:\", tableColumn.default, columnMetadata.default);\n // console.log(\"enum:\", tableColumn.enum, columnMetadata.enum);\n // console.log(\"default changed:\", !this.compareDefaultValues(this.normalizeDefault(columnMetadata), tableColumn.default));\n // console.log(\"onUpdate:\", tableColumn.onUpdate, columnMetadata.onUpdate);\n // console.log(\"isPrimary:\", tableColumn.isPrimary, columnMetadata.isPrimary);\n // console.log(\"isNullable:\", tableColumn.isNullable, columnMetadata.isNullable);\n // console.log(\"isUnique:\", tableColumn.isUnique, this.normalizeIsUnique(columnMetadata));\n // console.log(\"isGenerated:\", tableColumn.isGenerated, columnMetadata.isGenerated);\n // console.log((columnMetadata.generationStrategy !== \"uuid\" && tableColumn.isGenerated !== columnMetadata.isGenerated));\n // console.log(\"==========================================\");\n\n let columnMetadataLength = columnMetadata.length\n if (\n !columnMetadataLength &&\n columnMetadata.generationStrategy === \"uuid\"\n ) {\n // fixing #3374\n columnMetadataLength = this.getColumnLength(columnMetadata)\n }\n\n return (\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n tableColumn.length !== columnMetadataLength ||\n tableColumn.width !== columnMetadata.width ||\n tableColumn.precision !== columnMetadata.precision ||\n tableColumn.scale !== columnMetadata.scale ||\n tableColumn.zerofill !== columnMetadata.zerofill ||\n tableColumn.unsigned !== columnMetadata.unsigned ||\n tableColumn.asExpression !== columnMetadata.asExpression ||\n tableColumn.generatedType !== columnMetadata.generatedType ||\n tableColumn.comment !==\n this.escapeComment(columnMetadata.comment) ||\n !this.compareDefaultValues(\n this.normalizeDefault(columnMetadata),\n tableColumn.default,\n ) ||\n (tableColumn.enum &&\n columnMetadata.enum &&\n !OrmUtils.isArraysEqual(\n tableColumn.enum,\n columnMetadata.enum.map((val) => val + \"\"),\n )) ||\n tableColumn.onUpdate !== columnMetadata.onUpdate ||\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n (columnMetadata.generationStrategy !== \"uuid\" &&\n tableColumn.isGenerated !== columnMetadata.isGenerated)\n )\n })\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return true\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"?\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): void {\n const DataApiDriver =\n this.options.driver ||\n PlatformTools.load(\"typeorm-aurora-data-api-driver\")\n this.DataApiDriver = DataApiDriver\n\n // Driver uses rollup for publishing, which has issues when using typeorm in combination with webpack\n // See https://github.com/webpack/webpack/issues/4742#issuecomment-295556787\n this.DataApiDriver = this.DataApiDriver.default || this.DataApiDriver\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected createConnectionOptions(\n options: AuroraMysqlConnectionOptions,\n credentials: AuroraMysqlConnectionCredentialsOptions,\n ): Promise<any> {\n credentials = Object.assign(\n {},\n credentials,\n DriverUtils.buildDriverOptions(credentials),\n ) // todo: do it better way\n\n // build connection options for the driver\n return Object.assign(\n {},\n {\n resourceArn: options.resourceArn,\n secretArn: options.secretArn,\n database: options.database,\n region: options.region,\n type: options.type,\n },\n {\n host: credentials.host,\n user: credentials.username,\n password: credentials.password,\n database: credentials.database,\n port: credentials.port,\n ssl: options.ssl,\n },\n\n options.extra || {},\n )\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected async createPool(connectionOptions: any): Promise<any> {\n return {}\n }\n\n /**\n * Attaches all required base handlers to a database connection, such as the unhandled error handler.\n */\n private prepareDbConnection(connection: any): any {\n const { logger } = this.connection\n /**\n * Attaching an error handler to connection errors is essential, as, otherwise, errors raised will go unhandled and\n * cause the hosting app to crash.\n */\n if (connection.listeners(\"error\").length === 0) {\n connection.on(\"error\", (error: any) =>\n logger.log(\n \"warn\",\n `MySQL connection raised an error. ${error}`,\n ),\n )\n }\n return connection\n }\n\n /**\n * Checks if \"DEFAULT\" values in the column metadata and in the database are equal.\n */\n protected compareDefaultValues(\n columnMetadataValue: string | undefined,\n databaseValue: string | undefined,\n ): boolean {\n if (\n typeof columnMetadataValue === \"string\" &&\n typeof databaseValue === \"string\"\n ) {\n // we need to cut out \"'\" because in mysql we can understand returned value is a string or a function\n // as result compare cannot understand if default is really changed or not\n columnMetadataValue = columnMetadataValue.replace(/^'+|'+$/g, \"\")\n databaseValue = databaseValue.replace(/^'+|'+$/g, \"\")\n }\n\n return columnMetadataValue === databaseValue\n }\n\n /**\n * Escapes a given comment.\n */\n protected escapeComment(comment?: string) {\n if (!comment) return comment\n\n comment = comment.replace(/\\u0000/g, \"\") // Null bytes aren't allowed in comments\n\n return comment\n }\n}\n"],"sourceRoot":"../.."}
@@ -8,6 +8,11 @@ export interface CockroachConnectionOptions extends BaseDataSourceOptions, Cockr
8
8
  * Database type.
9
9
  */
10
10
  readonly type: "cockroachdb";
11
+ /**
12
+ * Enable time travel queries on cockroachdb.
13
+ * https://www.cockroachlabs.com/docs/stable/as-of-system-time.html
14
+ */
15
+ readonly timeTravelQueries: boolean;
11
16
  /**
12
17
  * Schema name.
13
18
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/cockroachdb/CockroachConnectionOptions.ts"],"names":[],"mappings":"","file":"CockroachConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { CockroachConnectionCredentialsOptions } from \"./CockroachConnectionCredentialsOptions\"\n\n/**\n * Cockroachdb-specific connection options.\n */\nexport interface CockroachConnectionOptions\n extends BaseDataSourceOptions,\n CockroachConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"cockroachdb\"\n\n /**\n * Schema name.\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to `require(\"pg\")`.\n */\n readonly driver?: any\n\n /**\n * The driver object\n * This defaults to `require(\"pg-native\")`.\n */\n readonly nativeDriver?: any\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: CockroachConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: CockroachConnectionCredentialsOptions[]\n }\n\n /**\n * sets the application_name var to help db administrators identify\n * the service using this connection. Defaults to 'undefined'\n */\n readonly applicationName?: string\n\n /*\n * Function handling errors thrown by drivers pool.\n * Defaults to logging error with `warn` level.\n */\n readonly poolErrorHandler?: (err: any) => any\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/cockroachdb/CockroachConnectionOptions.ts"],"names":[],"mappings":"","file":"CockroachConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { CockroachConnectionCredentialsOptions } from \"./CockroachConnectionCredentialsOptions\"\n\n/**\n * Cockroachdb-specific connection options.\n */\nexport interface CockroachConnectionOptions\n extends BaseDataSourceOptions,\n CockroachConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"cockroachdb\"\n\n /**\n * Enable time travel queries on cockroachdb.\n * https://www.cockroachlabs.com/docs/stable/as-of-system-time.html\n */\n readonly timeTravelQueries: boolean\n\n /**\n * Schema name.\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to `require(\"pg\")`.\n */\n readonly driver?: any\n\n /**\n * The driver object\n * This defaults to `require(\"pg-native\")`.\n */\n readonly nativeDriver?: any\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: CockroachConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: CockroachConnectionCredentialsOptions[]\n }\n\n /**\n * sets the application_name var to help db administrators identify\n * the service using this connection. Defaults to 'undefined'\n */\n readonly applicationName?: string\n\n /*\n * Function handling errors thrown by drivers pool.\n * Defaults to logging error with `warn` level.\n */\n readonly poolErrorHandler?: (err: any) => any\n}\n"],"sourceRoot":"../.."}
@@ -1,22 +1,23 @@
1
- import { Driver } from "../Driver";
2
1
  import { ObjectLiteral } from "../../common/ObjectLiteral";
3
- import { ColumnMetadata } from "../../metadata/ColumnMetadata";
4
- import { CteCapabilities } from "../types/CteCapabilities";
5
- import { CockroachConnectionCredentialsOptions } from "./CockroachConnectionCredentialsOptions";
6
- import { CockroachConnectionOptions } from "./CockroachConnectionOptions";
7
2
  import { DataSource } from "../../data-source/DataSource";
3
+ import { ColumnMetadata } from "../../metadata/ColumnMetadata";
4
+ import { EntityMetadata } from "../../metadata/EntityMetadata";
5
+ import { QueryRunner } from "../../query-runner/QueryRunner";
8
6
  import { RdbmsSchemaBuilder } from "../../schema-builder/RdbmsSchemaBuilder";
9
- import { MappedColumnTypes } from "../types/MappedColumnTypes";
7
+ import { Table } from "../../schema-builder/table/Table";
8
+ import { TableColumn } from "../../schema-builder/table/TableColumn";
9
+ import { TableForeignKey } from "../../schema-builder/table/TableForeignKey";
10
+ import { View } from "../../schema-builder/view/View";
11
+ import { Driver } from "../Driver";
10
12
  import { ColumnType } from "../types/ColumnTypes";
11
- import { QueryRunner } from "../../query-runner/QueryRunner";
13
+ import { CteCapabilities } from "../types/CteCapabilities";
12
14
  import { DataTypeDefaults } from "../types/DataTypeDefaults";
13
- import { TableColumn } from "../../schema-builder/table/TableColumn";
14
- import { EntityMetadata } from "../../metadata/EntityMetadata";
15
- import { CockroachQueryRunner } from "./CockroachQueryRunner";
15
+ import { MappedColumnTypes } from "../types/MappedColumnTypes";
16
16
  import { ReplicationMode } from "../types/ReplicationMode";
17
- import { Table } from "../../schema-builder/table/Table";
18
- import { View } from "../../schema-builder/view/View";
19
- import { TableForeignKey } from "../../schema-builder/table/TableForeignKey";
17
+ import { UpsertType } from "../types/UpsertType";
18
+ import { CockroachConnectionCredentialsOptions } from "./CockroachConnectionCredentialsOptions";
19
+ import { CockroachConnectionOptions } from "./CockroachConnectionOptions";
20
+ import { CockroachQueryRunner } from "./CockroachQueryRunner";
20
21
  /**
21
22
  * Organizes communication with Cockroach DBMS.
22
23
  */
@@ -84,7 +85,7 @@ export declare class CockroachDriver implements Driver {
84
85
  /**
85
86
  * Returns type of upsert supported by driver if any
86
87
  */
87
- readonly supportedUpsertType = "on-conflict-do-update";
88
+ supportedUpsertTypes: UpsertType[];
88
89
  /**
89
90
  * Gets list of spatial column data types.
90
91
  */
@@ -258,4 +259,8 @@ export declare class CockroachDriver implements Driver {
258
259
  * Escapes a given comment.
259
260
  */
260
261
  protected escapeComment(comment?: string): string | undefined;
262
+ /**
263
+ * Builds ENUM type name from given table and column.
264
+ */
265
+ protected buildEnumName(column: ColumnMetadata): string;
261
266
  }