typeorm 0.3.10-dev.f24b262 → 0.3.11-dev.8a837f9

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 (107) hide show
  1. package/browser/data-source/BaseDataSourceOptions.d.ts +4 -0
  2. package/browser/data-source/BaseDataSourceOptions.js.map +1 -1
  3. package/browser/decorator/options/RelationOptions.d.ts +5 -2
  4. package/browser/decorator/options/RelationOptions.js.map +1 -1
  5. package/browser/driver/aurora-mysql/AuroraMysqlConnectionOptions.d.ts +1 -0
  6. package/browser/driver/aurora-mysql/AuroraMysqlConnectionOptions.js.map +1 -1
  7. package/browser/driver/aurora-postgres/AuroraPostgresConnectionOptions.d.ts +1 -0
  8. package/browser/driver/aurora-postgres/AuroraPostgresConnectionOptions.js.map +1 -1
  9. package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.d.ts +1 -0
  10. package/browser/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
  11. package/browser/driver/capacitor/CapacitorConnectionOptions.d.ts +1 -0
  12. package/browser/driver/capacitor/CapacitorConnectionOptions.js.map +1 -1
  13. package/browser/driver/cockroachdb/CockroachDriver.js +1 -0
  14. package/browser/driver/cockroachdb/CockroachDriver.js.map +1 -1
  15. package/browser/driver/cordova/CordovaConnectionOptions.d.ts +1 -0
  16. package/browser/driver/cordova/CordovaConnectionOptions.js.map +1 -1
  17. package/browser/driver/expo/ExpoConnectionOptions.d.ts +1 -0
  18. package/browser/driver/expo/ExpoConnectionOptions.js.map +1 -1
  19. package/browser/driver/mongodb/MongoConnectionOptions.d.ts +0 -4
  20. package/browser/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  21. package/browser/driver/mysql/MysqlDriver.js +1 -1
  22. package/browser/driver/mysql/MysqlDriver.js.map +1 -1
  23. package/browser/driver/nativescript/NativescriptConnectionOptions.d.ts +1 -0
  24. package/browser/driver/nativescript/NativescriptConnectionOptions.js.map +1 -1
  25. package/browser/driver/oracle/OracleDriver.js +2 -0
  26. package/browser/driver/oracle/OracleDriver.js.map +1 -1
  27. package/browser/driver/postgres/PostgresDriver.js +1 -0
  28. package/browser/driver/postgres/PostgresDriver.js.map +1 -1
  29. package/browser/driver/react-native/ReactNativeConnectionOptions.d.ts +1 -0
  30. package/browser/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
  31. package/browser/driver/sap/SapConnectionOptions.d.ts +1 -0
  32. package/browser/driver/sap/SapConnectionOptions.js.map +1 -1
  33. package/browser/driver/spanner/SpannerConnectionOptions.d.ts +1 -0
  34. package/browser/driver/spanner/SpannerConnectionOptions.js.map +1 -1
  35. package/browser/driver/sqlite/SqliteConnectionOptions.d.ts +1 -0
  36. package/browser/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
  37. package/browser/driver/sqljs/SqljsConnectionOptions.d.ts +1 -0
  38. package/browser/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
  39. package/browser/driver/sqljs/SqljsDriver.d.ts +1 -0
  40. package/browser/driver/sqljs/SqljsDriver.js +3 -1
  41. package/browser/driver/sqljs/SqljsDriver.js.map +1 -1
  42. package/browser/driver/sqljs/SqljsQueryRunner.js +3 -1
  43. package/browser/driver/sqljs/SqljsQueryRunner.js.map +1 -1
  44. package/browser/driver/sqlserver/SqlServerConnectionOptions.d.ts +1 -0
  45. package/browser/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  46. package/browser/entity-schema/EntitySchemaRelationOptions.d.ts +4 -2
  47. package/browser/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
  48. package/browser/metadata/RelationMetadata.d.ts +4 -2
  49. package/browser/metadata/RelationMetadata.js.map +1 -1
  50. package/browser/persistence/subject-builder/OneToManySubjectBuilder.js +30 -27
  51. package/browser/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
  52. package/browser/query-builder/SelectQueryBuilder.js +1 -1
  53. package/browser/query-builder/SelectQueryBuilder.js.map +1 -1
  54. package/data-source/BaseDataSourceOptions.d.ts +4 -0
  55. package/data-source/BaseDataSourceOptions.js.map +1 -1
  56. package/decorator/options/RelationOptions.d.ts +5 -2
  57. package/decorator/options/RelationOptions.js.map +1 -1
  58. package/driver/aurora-mysql/AuroraMysqlConnectionOptions.d.ts +1 -0
  59. package/driver/aurora-mysql/AuroraMysqlConnectionOptions.js.map +1 -1
  60. package/driver/aurora-postgres/AuroraPostgresConnectionOptions.d.ts +1 -0
  61. package/driver/aurora-postgres/AuroraPostgresConnectionOptions.js.map +1 -1
  62. package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.d.ts +1 -0
  63. package/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js.map +1 -1
  64. package/driver/capacitor/CapacitorConnectionOptions.d.ts +1 -0
  65. package/driver/capacitor/CapacitorConnectionOptions.js.map +1 -1
  66. package/driver/cockroachdb/CockroachDriver.js +1 -0
  67. package/driver/cockroachdb/CockroachDriver.js.map +1 -1
  68. package/driver/cordova/CordovaConnectionOptions.d.ts +1 -0
  69. package/driver/cordova/CordovaConnectionOptions.js.map +1 -1
  70. package/driver/expo/ExpoConnectionOptions.d.ts +1 -0
  71. package/driver/expo/ExpoConnectionOptions.js.map +1 -1
  72. package/driver/mongodb/MongoConnectionOptions.d.ts +0 -4
  73. package/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  74. package/driver/mysql/MysqlDriver.js +1 -1
  75. package/driver/mysql/MysqlDriver.js.map +1 -1
  76. package/driver/nativescript/NativescriptConnectionOptions.d.ts +1 -0
  77. package/driver/nativescript/NativescriptConnectionOptions.js.map +1 -1
  78. package/driver/oracle/OracleDriver.js +2 -0
  79. package/driver/oracle/OracleDriver.js.map +1 -1
  80. package/driver/postgres/PostgresDriver.js +1 -0
  81. package/driver/postgres/PostgresDriver.js.map +1 -1
  82. package/driver/react-native/ReactNativeConnectionOptions.d.ts +1 -0
  83. package/driver/react-native/ReactNativeConnectionOptions.js.map +1 -1
  84. package/driver/sap/SapConnectionOptions.d.ts +1 -0
  85. package/driver/sap/SapConnectionOptions.js.map +1 -1
  86. package/driver/spanner/SpannerConnectionOptions.d.ts +1 -0
  87. package/driver/spanner/SpannerConnectionOptions.js.map +1 -1
  88. package/driver/sqlite/SqliteConnectionOptions.d.ts +1 -0
  89. package/driver/sqlite/SqliteConnectionOptions.js.map +1 -1
  90. package/driver/sqljs/SqljsConnectionOptions.d.ts +1 -0
  91. package/driver/sqljs/SqljsConnectionOptions.js.map +1 -1
  92. package/driver/sqljs/SqljsDriver.d.ts +1 -0
  93. package/driver/sqljs/SqljsDriver.js +3 -1
  94. package/driver/sqljs/SqljsDriver.js.map +1 -1
  95. package/driver/sqljs/SqljsQueryRunner.js +3 -1
  96. package/driver/sqljs/SqljsQueryRunner.js.map +1 -1
  97. package/driver/sqlserver/SqlServerConnectionOptions.d.ts +1 -0
  98. package/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  99. package/entity-schema/EntitySchemaRelationOptions.d.ts +4 -2
  100. package/entity-schema/EntitySchemaRelationOptions.js.map +1 -1
  101. package/metadata/RelationMetadata.d.ts +4 -2
  102. package/metadata/RelationMetadata.js.map +1 -1
  103. package/package.json +1 -1
  104. package/persistence/subject-builder/OneToManySubjectBuilder.js +30 -27
  105. package/persistence/subject-builder/OneToManySubjectBuilder.js.map +1 -1
  106. package/query-builder/SelectQueryBuilder.js +1 -1
  107. package/query-builder/SelectQueryBuilder.js.map +1 -1
@@ -68,6 +68,10 @@ export interface BaseDataSourceOptions {
68
68
  * Maximum number of milliseconds query should be executed before logger log a warning.
69
69
  */
70
70
  readonly maxQueryExecutionTime?: number;
71
+ /**
72
+ * Maximum number of clients the pool should contain.
73
+ */
74
+ readonly poolSize?: number;
71
75
  /**
72
76
  * Indicates if database schema should be auto created on every application launch.
73
77
  * Be careful with this option and don't use this in production - otherwise you can lose production data.
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/data-source/BaseDataSourceOptions.ts"],"names":[],"mappings":"","file":"BaseDataSourceOptions.js","sourcesContent":["import { EntitySchema } from \"../entity-schema/EntitySchema\"\nimport { LoggerOptions } from \"../logger/LoggerOptions\"\nimport { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport { DatabaseType } from \"../driver/types/DatabaseType\"\nimport { Logger } from \"../logger/Logger\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { QueryResultCache } from \"../cache/QueryResultCache\"\nimport { MixedList } from \"../common/MixedList\"\n\n/**\n * BaseDataSourceOptions is set of DataSourceOptions shared by all database types.\n */\nexport interface BaseDataSourceOptions {\n /**\n * Database type. This value is required.\n */\n readonly type: DatabaseType\n\n /**\n * Connection name. If connection name is not given then it will be called \"default\".\n * Different connections must have different names.\n *\n * @deprecated\n */\n readonly name?: string\n\n /**\n * Entities to be loaded for this connection.\n * Accepts both entity classes and directories where from entities need to be loaded.\n * Directories support glob patterns.\n */\n readonly entities?: MixedList<Function | string | EntitySchema>\n\n /**\n * Subscribers to be loaded for this connection.\n * Accepts both subscriber classes and directories where from subscribers need to be loaded.\n * Directories support glob patterns.\n */\n readonly subscribers?: MixedList<Function | string>\n\n /**\n * Migrations to be loaded for this connection.\n * Accepts both migration classes and glob patterns representing migration files.\n */\n readonly migrations?: MixedList<Function | string>\n\n /**\n * Migrations table name, in case of different name from \"migrations\".\n * Accepts single string name.\n */\n readonly migrationsTableName?: string\n\n /**\n * Transaction mode for migrations to run in\n */\n readonly migrationsTransactionMode?: \"all\" | \"none\" | \"each\"\n\n /**\n * Typeorm metadata table name, in case of different name from \"typeorm_metadata\".\n * Accepts single string name.\n */\n readonly metadataTableName?: string\n\n /**\n * Naming strategy to be used to name tables and columns in the database.\n */\n readonly namingStrategy?: NamingStrategyInterface\n\n /**\n * Logging options.\n */\n readonly logging?: LoggerOptions\n\n /**\n * Logger instance used to log queries and events in the ORM.\n */\n readonly logger?:\n | \"advanced-console\"\n | \"simple-console\"\n | \"file\"\n | \"debug\"\n | Logger\n\n /**\n * Maximum number of milliseconds query should be executed before logger log a warning.\n */\n readonly maxQueryExecutionTime?: number\n\n /**\n * Indicates if database schema should be auto created on every application launch.\n * Be careful with this option and don't use this in production - otherwise you can lose production data.\n * This option is useful during debug and development.\n * Alternative to it, you can use CLI and run schema:sync command.\n *\n * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.\n * Instead, it syncs just by creating indices.\n */\n readonly synchronize?: boolean\n\n /**\n * Indicates if migrations should be auto run on every application launch.\n * Alternative to it, you can use CLI and run migrations:run command.\n */\n readonly migrationsRun?: boolean\n\n /**\n * Drops the schema each time connection is being established.\n * Be careful with this option and don't use this in production - otherwise you'll lose all production data.\n * This option is useful during debug and development.\n */\n readonly dropSchema?: boolean\n\n /**\n * Prefix to use on all tables (collections) of this connection in the database.\n */\n readonly entityPrefix?: string\n\n /**\n * When creating new Entity instances, skip all constructors when true.\n */\n readonly entitySkipConstructor?: boolean\n\n /**\n * Extra connection options to be passed to the underlying driver.\n *\n * todo: deprecate this and move all database-specific types into hts own connection options object.\n */\n readonly extra?: any\n\n /**\n * Specifies how relations must be loaded - using \"joins\" or separate queries.\n * If you are loading too much data with nested joins it's better to load relations\n * using separate queries.\n *\n * Default strategy is \"join\", but this default can be changed here.\n * Also, strategy can be set per-query in FindOptions and QueryBuilder.\n */\n readonly relationLoadStrategy?: \"join\" | \"query\"\n\n /**\n * Optionally applied \"typename\" to the model.\n * If set, then each hydrated model will have this property with the target model / entity name inside.\n *\n * (works like a discriminator property).\n */\n readonly typename?: string\n\n /**\n * Holds reference to the baseDirectory where configuration file are expected.\n *\n * @internal\n */\n baseDirectory?: string\n\n /**\n * Allows to setup cache options.\n */\n readonly cache?:\n | boolean\n | {\n /**\n * Type of caching.\n *\n * - \"database\" means cached values will be stored in the separate table in database. This is default value.\n * - \"redis\" means cached values will be stored inside redis. You must provide redis connection options.\n */\n readonly type?:\n | \"database\"\n | \"redis\"\n | \"ioredis\"\n | \"ioredis/cluster\" // todo: add mongodb and other cache providers as well in the future\n\n /**\n * Factory function for custom cache providers that implement QueryResultCache.\n */\n readonly provider?: (connection: DataSource) => QueryResultCache\n\n /**\n * Configurable table name for \"database\" type cache.\n * Default value is \"query-result-cache\"\n */\n readonly tableName?: string\n\n /**\n * Used to provide redis connection options.\n */\n readonly options?: any\n\n /**\n * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.\n */\n readonly alwaysEnabled?: boolean\n\n /**\n * Time in milliseconds in which cache will expire.\n * This can be setup per-query.\n * Default value is 1000 which is equivalent to 1 second.\n */\n readonly duration?: number\n\n /**\n * Used to specify if cache errors should be ignored, and pass through the call to the Database.\n */\n readonly ignoreErrors?: boolean\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/data-source/BaseDataSourceOptions.ts"],"names":[],"mappings":"","file":"BaseDataSourceOptions.js","sourcesContent":["import { EntitySchema } from \"../entity-schema/EntitySchema\"\nimport { LoggerOptions } from \"../logger/LoggerOptions\"\nimport { NamingStrategyInterface } from \"../naming-strategy/NamingStrategyInterface\"\nimport { DatabaseType } from \"../driver/types/DatabaseType\"\nimport { Logger } from \"../logger/Logger\"\nimport { DataSource } from \"../data-source/DataSource\"\nimport { QueryResultCache } from \"../cache/QueryResultCache\"\nimport { MixedList } from \"../common/MixedList\"\n\n/**\n * BaseDataSourceOptions is set of DataSourceOptions shared by all database types.\n */\nexport interface BaseDataSourceOptions {\n /**\n * Database type. This value is required.\n */\n readonly type: DatabaseType\n\n /**\n * Connection name. If connection name is not given then it will be called \"default\".\n * Different connections must have different names.\n *\n * @deprecated\n */\n readonly name?: string\n\n /**\n * Entities to be loaded for this connection.\n * Accepts both entity classes and directories where from entities need to be loaded.\n * Directories support glob patterns.\n */\n readonly entities?: MixedList<Function | string | EntitySchema>\n\n /**\n * Subscribers to be loaded for this connection.\n * Accepts both subscriber classes and directories where from subscribers need to be loaded.\n * Directories support glob patterns.\n */\n readonly subscribers?: MixedList<Function | string>\n\n /**\n * Migrations to be loaded for this connection.\n * Accepts both migration classes and glob patterns representing migration files.\n */\n readonly migrations?: MixedList<Function | string>\n\n /**\n * Migrations table name, in case of different name from \"migrations\".\n * Accepts single string name.\n */\n readonly migrationsTableName?: string\n\n /**\n * Transaction mode for migrations to run in\n */\n readonly migrationsTransactionMode?: \"all\" | \"none\" | \"each\"\n\n /**\n * Typeorm metadata table name, in case of different name from \"typeorm_metadata\".\n * Accepts single string name.\n */\n readonly metadataTableName?: string\n\n /**\n * Naming strategy to be used to name tables and columns in the database.\n */\n readonly namingStrategy?: NamingStrategyInterface\n\n /**\n * Logging options.\n */\n readonly logging?: LoggerOptions\n\n /**\n * Logger instance used to log queries and events in the ORM.\n */\n readonly logger?:\n | \"advanced-console\"\n | \"simple-console\"\n | \"file\"\n | \"debug\"\n | Logger\n\n /**\n * Maximum number of milliseconds query should be executed before logger log a warning.\n */\n readonly maxQueryExecutionTime?: number\n\n /**\n * Maximum number of clients the pool should contain.\n */\n readonly poolSize?: number\n\n /**\n * Indicates if database schema should be auto created on every application launch.\n * Be careful with this option and don't use this in production - otherwise you can lose production data.\n * This option is useful during debug and development.\n * Alternative to it, you can use CLI and run schema:sync command.\n *\n * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.\n * Instead, it syncs just by creating indices.\n */\n readonly synchronize?: boolean\n\n /**\n * Indicates if migrations should be auto run on every application launch.\n * Alternative to it, you can use CLI and run migrations:run command.\n */\n readonly migrationsRun?: boolean\n\n /**\n * Drops the schema each time connection is being established.\n * Be careful with this option and don't use this in production - otherwise you'll lose all production data.\n * This option is useful during debug and development.\n */\n readonly dropSchema?: boolean\n\n /**\n * Prefix to use on all tables (collections) of this connection in the database.\n */\n readonly entityPrefix?: string\n\n /**\n * When creating new Entity instances, skip all constructors when true.\n */\n readonly entitySkipConstructor?: boolean\n\n /**\n * Extra connection options to be passed to the underlying driver.\n *\n * todo: deprecate this and move all database-specific types into hts own connection options object.\n */\n readonly extra?: any\n\n /**\n * Specifies how relations must be loaded - using \"joins\" or separate queries.\n * If you are loading too much data with nested joins it's better to load relations\n * using separate queries.\n *\n * Default strategy is \"join\", but this default can be changed here.\n * Also, strategy can be set per-query in FindOptions and QueryBuilder.\n */\n readonly relationLoadStrategy?: \"join\" | \"query\"\n\n /**\n * Optionally applied \"typename\" to the model.\n * If set, then each hydrated model will have this property with the target model / entity name inside.\n *\n * (works like a discriminator property).\n */\n readonly typename?: string\n\n /**\n * Holds reference to the baseDirectory where configuration file are expected.\n *\n * @internal\n */\n baseDirectory?: string\n\n /**\n * Allows to setup cache options.\n */\n readonly cache?:\n | boolean\n | {\n /**\n * Type of caching.\n *\n * - \"database\" means cached values will be stored in the separate table in database. This is default value.\n * - \"redis\" means cached values will be stored inside redis. You must provide redis connection options.\n */\n readonly type?:\n | \"database\"\n | \"redis\"\n | \"ioredis\"\n | \"ioredis/cluster\" // todo: add mongodb and other cache providers as well in the future\n\n /**\n * Factory function for custom cache providers that implement QueryResultCache.\n */\n readonly provider?: (connection: DataSource) => QueryResultCache\n\n /**\n * Configurable table name for \"database\" type cache.\n * Default value is \"query-result-cache\"\n */\n readonly tableName?: string\n\n /**\n * Used to provide redis connection options.\n */\n readonly options?: any\n\n /**\n * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.\n */\n readonly alwaysEnabled?: boolean\n\n /**\n * Time in milliseconds in which cache will expire.\n * This can be setup per-query.\n * Default value is 1000 which is equivalent to 1 second.\n */\n readonly duration?: number\n\n /**\n * Used to specify if cache errors should be ignored, and pass through the call to the Database.\n */\n readonly ignoreErrors?: boolean\n }\n}\n"],"sourceRoot":".."}
@@ -55,7 +55,10 @@ export interface RelationOptions {
55
55
  */
56
56
  persistence?: boolean;
57
57
  /**
58
- * When a child row is removed from its parent, determines if the child row should be orphaned (default) or deleted.
58
+ * When a parent is saved (with cascading but) without a child row that still exists in database, this will control what shall happen to them.
59
+ * delete will remove these rows from database.
60
+ * nullify will remove the relation key.
61
+ * disable will keep the relation intact. Removal of related item is only possible through its own repo.
59
62
  */
60
- orphanedRowAction?: "nullify" | "delete" | "soft-delete";
63
+ orphanedRowAction?: "nullify" | "delete" | "soft-delete" | "disable";
61
64
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/decorator/options/RelationOptions.ts"],"names":[],"mappings":"","file":"RelationOptions.js","sourcesContent":["import { DeferrableType } from \"../../metadata/types/DeferrableType\"\nimport { OnDeleteType } from \"../../metadata/types/OnDeleteType\"\nimport { OnUpdateType } from \"../../metadata/types/OnUpdateType\"\n\n/**\n * Describes all relation's options.\n */\nexport interface RelationOptions {\n /**\n * Sets cascades options for the given relation.\n * If set to true then it means that related object can be allowed to be inserted or updated in the database.\n * You can separately restrict cascades to insertion or updation using following syntax:\n *\n * cascade: [\"insert\", \"update\", \"remove\", \"soft-remove\", \"recover\"] // include or exclude one of them\n */\n cascade?:\n | boolean\n | (\"insert\" | \"update\" | \"remove\" | \"soft-remove\" | \"recover\")[]\n\n /**\n * Indicates if relation column value can be nullable or not.\n */\n nullable?: boolean\n\n /**\n * Database cascade action on delete.\n */\n onDelete?: OnDeleteType\n\n /**\n * Database cascade action on update.\n */\n onUpdate?: OnUpdateType\n\n /**\n * Indicate if foreign key constraints can be deferred.\n */\n deferrable?: DeferrableType\n\n /**\n * Indicates whether foreign key constraints will be created for join columns.\n * Can be used only for many-to-one and owner one-to-one relations.\n * Defaults to true.\n */\n createForeignKeyConstraints?: boolean\n\n /**\n * Set this relation to be lazy. Note: lazy relations are promises. When you call them they return promise\n * which resolve relation result then. If your property's type is Promise then this relation is set to lazy automatically.\n */\n lazy?: boolean\n\n /**\n * Set this relation to be eager.\n * Eager relations are always loaded automatically when relation's owner entity is loaded using find* methods.\n * Only using QueryBuilder prevents loading eager relations.\n * Eager flag cannot be set from both sides of relation - you can eager load only one side of the relationship.\n */\n eager?: boolean\n\n /**\n * Indicates if persistence is enabled for the relation.\n * By default its enabled, but if you want to avoid any changes in the relation to be reflected in the database you can disable it.\n * If its disabled you can only change a relation from inverse side of a relation or using relation query builder functionality.\n * This is useful for performance optimization since its disabling avoid multiple extra queries during entity save.\n */\n persistence?: boolean\n\n /**\n * When a child row is removed from its parent, determines if the child row should be orphaned (default) or deleted.\n */\n orphanedRowAction?: \"nullify\" | \"delete\" | \"soft-delete\"\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/decorator/options/RelationOptions.ts"],"names":[],"mappings":"","file":"RelationOptions.js","sourcesContent":["import { DeferrableType } from \"../../metadata/types/DeferrableType\"\nimport { OnDeleteType } from \"../../metadata/types/OnDeleteType\"\nimport { OnUpdateType } from \"../../metadata/types/OnUpdateType\"\n\n/**\n * Describes all relation's options.\n */\nexport interface RelationOptions {\n /**\n * Sets cascades options for the given relation.\n * If set to true then it means that related object can be allowed to be inserted or updated in the database.\n * You can separately restrict cascades to insertion or updation using following syntax:\n *\n * cascade: [\"insert\", \"update\", \"remove\", \"soft-remove\", \"recover\"] // include or exclude one of them\n */\n cascade?:\n | boolean\n | (\"insert\" | \"update\" | \"remove\" | \"soft-remove\" | \"recover\")[]\n\n /**\n * Indicates if relation column value can be nullable or not.\n */\n nullable?: boolean\n\n /**\n * Database cascade action on delete.\n */\n onDelete?: OnDeleteType\n\n /**\n * Database cascade action on update.\n */\n onUpdate?: OnUpdateType\n\n /**\n * Indicate if foreign key constraints can be deferred.\n */\n deferrable?: DeferrableType\n\n /**\n * Indicates whether foreign key constraints will be created for join columns.\n * Can be used only for many-to-one and owner one-to-one relations.\n * Defaults to true.\n */\n createForeignKeyConstraints?: boolean\n\n /**\n * Set this relation to be lazy. Note: lazy relations are promises. When you call them they return promise\n * which resolve relation result then. If your property's type is Promise then this relation is set to lazy automatically.\n */\n lazy?: boolean\n\n /**\n * Set this relation to be eager.\n * Eager relations are always loaded automatically when relation's owner entity is loaded using find* methods.\n * Only using QueryBuilder prevents loading eager relations.\n * Eager flag cannot be set from both sides of relation - you can eager load only one side of the relationship.\n */\n eager?: boolean\n\n /**\n * Indicates if persistence is enabled for the relation.\n * By default its enabled, but if you want to avoid any changes in the relation to be reflected in the database you can disable it.\n * If its disabled you can only change a relation from inverse side of a relation or using relation query builder functionality.\n * This is useful for performance optimization since its disabling avoid multiple extra queries during entity save.\n */\n persistence?: boolean\n\n /**\n * When a parent is saved (with cascading but) without a child row that still exists in database, this will control what shall happen to them.\n * delete will remove these rows from database.\n * nullify will remove the relation key.\n * disable will keep the relation intact. Removal of related item is only possible through its own repo.\n */\n orphanedRowAction?: \"nullify\" | \"delete\" | \"soft-delete\" | \"disable\"\n}\n"],"sourceRoot":"../.."}
@@ -31,4 +31,5 @@ export interface AuroraMysqlConnectionOptions extends BaseDataSourceOptions, Aur
31
31
  * (Default: true)
32
32
  */
33
33
  readonly legacySpatialSupport?: boolean;
34
+ readonly poolSize?: never;
34
35
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/aurora-mysql/AuroraMysqlConnectionOptions.ts"],"names":[],"mappings":"","file":"AuroraMysqlConnectionOptions.js","sourcesContent":["import { AuroraMysqlConnectionCredentialsOptions } from \"./AuroraMysqlConnectionCredentialsOptions\"\nimport { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * MySQL specific connection options.\n *\n * @see https://github.com/mysqljs/mysql#connection-options\n */\nexport interface AuroraMysqlConnectionOptions\n extends BaseDataSourceOptions,\n AuroraMysqlConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"aurora-mysql\"\n\n readonly region: string\n\n readonly secretArn: string\n\n readonly resourceArn: string\n\n readonly database: string\n\n /**\n * The driver object\n * This defaults to require(\"typeorm-aurora-data-api-driver\")\n */\n readonly driver?: any\n\n readonly serviceConfigOptions?: { [key: string]: any } // pass optional AWS.ConfigurationOptions here\n\n readonly formatOptions?: { [key: string]: any; castParameters: boolean }\n\n /**\n * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.\n * (Default: true)\n */\n readonly legacySpatialSupport?: boolean\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/aurora-mysql/AuroraMysqlConnectionOptions.ts"],"names":[],"mappings":"","file":"AuroraMysqlConnectionOptions.js","sourcesContent":["import { AuroraMysqlConnectionCredentialsOptions } from \"./AuroraMysqlConnectionCredentialsOptions\"\nimport { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * MySQL specific connection options.\n *\n * @see https://github.com/mysqljs/mysql#connection-options\n */\nexport interface AuroraMysqlConnectionOptions\n extends BaseDataSourceOptions,\n AuroraMysqlConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"aurora-mysql\"\n\n readonly region: string\n\n readonly secretArn: string\n\n readonly resourceArn: string\n\n readonly database: string\n\n /**\n * The driver object\n * This defaults to require(\"typeorm-aurora-data-api-driver\")\n */\n readonly driver?: any\n\n readonly serviceConfigOptions?: { [key: string]: any } // pass optional AWS.ConfigurationOptions here\n\n readonly formatOptions?: { [key: string]: any; castParameters: boolean }\n\n /**\n * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.\n * (Default: true)\n */\n readonly legacySpatialSupport?: boolean\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
@@ -31,4 +31,5 @@ export interface AuroraPostgresConnectionOptions extends BaseDataSourceOptions {
31
31
  [key: string]: any;
32
32
  castParameters: boolean;
33
33
  };
34
+ readonly poolSize?: never;
34
35
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/aurora-postgres/AuroraPostgresConnectionOptions.ts"],"names":[],"mappings":"","file":"AuroraPostgresConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Postgres-specific connection options.\n */\nexport interface AuroraPostgresConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"aurora-postgres\"\n\n readonly region: string\n\n readonly secretArn: string\n\n readonly resourceArn: string\n\n readonly database: string\n\n /**\n * The driver object\n * This defaults to require(\"typeorm-aurora-data-api-driver\")\n */\n readonly driver?: any\n\n /**\n * The Postgres extension to use to generate UUID columns. Defaults to uuid-ossp.\n * If pgcrypto is selected, TypeORM will use the gen_random_uuid() function from this extension.\n * If uuid-ossp is selected, TypeORM will use the uuid_generate_v4() function from this extension.\n */\n readonly uuidExtension?: \"pgcrypto\" | \"uuid-ossp\"\n\n readonly transformParameters?: boolean\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 readonly serviceConfigOptions?: { [key: string]: any }\n\n readonly formatOptions?: { [key: string]: any; castParameters: boolean }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/aurora-postgres/AuroraPostgresConnectionOptions.ts"],"names":[],"mappings":"","file":"AuroraPostgresConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Postgres-specific connection options.\n */\nexport interface AuroraPostgresConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"aurora-postgres\"\n\n readonly region: string\n\n readonly secretArn: string\n\n readonly resourceArn: string\n\n readonly database: string\n\n /**\n * The driver object\n * This defaults to require(\"typeorm-aurora-data-api-driver\")\n */\n readonly driver?: any\n\n /**\n * The Postgres extension to use to generate UUID columns. Defaults to uuid-ossp.\n * If pgcrypto is selected, TypeORM will use the gen_random_uuid() function from this extension.\n * If uuid-ossp is selected, TypeORM will use the uuid_generate_v4() function from this extension.\n */\n readonly uuidExtension?: \"pgcrypto\" | \"uuid-ossp\"\n\n readonly transformParameters?: boolean\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 readonly serviceConfigOptions?: { [key: string]: any }\n\n readonly formatOptions?: { [key: string]: any; castParameters: boolean }\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
@@ -56,4 +56,5 @@ export interface BetterSqlite3ConnectionOptions extends BaseDataSourceOptions {
56
56
  * Relative or absolute path to the native addon (better_sqlite3.node).
57
57
  */
58
58
  readonly nativeBinding?: string;
59
+ readonly poolSize?: never;
59
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/better-sqlite3/BetterSqlite3ConnectionOptions.ts"],"names":[],"mappings":"","file":"BetterSqlite3ConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface BetterSqlite3ConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"better-sqlite3\"\n\n /**\n * Storage type or path to the storage.\n */\n readonly database: string\n\n /**\n * The driver object\n * This defaults to require(\"better-sqlite3\")\n */\n readonly driver?: any\n\n /**\n * Encryption key for for SQLCipher.\n */\n readonly key?: string\n\n /**\n * Cache size of sqlite statement to speed up queries.\n * Default: 100.\n */\n readonly statementCacheSize?: number\n\n /**\n * Function to run before a database is used in typeorm.\n * You can set pragmas, register plugins or register\n * functions or aggregates in this function.\n */\n readonly prepareDatabase?: (db: any) => void | Promise<void>\n\n /**\n * Open the database connection in readonly mode.\n * Default: false.\n */\n readonly readonly?: boolean\n\n /**\n * If the database does not exist, an Error will be thrown instead of creating a new file.\n * This option does not affect in-memory or readonly database connections.\n * Default: false.\n */\n readonly fileMustExist?: boolean\n\n /**\n * The number of milliseconds to wait when executing queries\n * on a locked database, before throwing a SQLITE_BUSY error.\n * Default: 5000.\n */\n readonly timeout?: number\n\n /**\n * Provide a function that gets called with every SQL string executed by the database connection.\n */\n readonly verbose?: Function\n\n /**\n * Relative or absolute path to the native addon (better_sqlite3.node).\n */\n readonly nativeBinding?: string\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/better-sqlite3/BetterSqlite3ConnectionOptions.ts"],"names":[],"mappings":"","file":"BetterSqlite3ConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface BetterSqlite3ConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"better-sqlite3\"\n\n /**\n * Storage type or path to the storage.\n */\n readonly database: string\n\n /**\n * The driver object\n * This defaults to require(\"better-sqlite3\")\n */\n readonly driver?: any\n\n /**\n * Encryption key for for SQLCipher.\n */\n readonly key?: string\n\n /**\n * Cache size of sqlite statement to speed up queries.\n * Default: 100.\n */\n readonly statementCacheSize?: number\n\n /**\n * Function to run before a database is used in typeorm.\n * You can set pragmas, register plugins or register\n * functions or aggregates in this function.\n */\n readonly prepareDatabase?: (db: any) => void | Promise<void>\n\n /**\n * Open the database connection in readonly mode.\n * Default: false.\n */\n readonly readonly?: boolean\n\n /**\n * If the database does not exist, an Error will be thrown instead of creating a new file.\n * This option does not affect in-memory or readonly database connections.\n * Default: false.\n */\n readonly fileMustExist?: boolean\n\n /**\n * The number of milliseconds to wait when executing queries\n * on a locked database, before throwing a SQLITE_BUSY error.\n * Default: 5000.\n */\n readonly timeout?: number\n\n /**\n * Provide a function that gets called with every SQL string executed by the database connection.\n */\n readonly verbose?: Function\n\n /**\n * Relative or absolute path to the native addon (better_sqlite3.node).\n */\n readonly nativeBinding?: string\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
@@ -27,4 +27,5 @@ export interface CapacitorConnectionOptions extends BaseDataSourceOptions {
27
27
  * The SQLite journal mode (optional)
28
28
  */
29
29
  readonly journalMode?: "DELETE" | "TRUNCATE" | "PERSIST" | "MEMORY" | "WAL" | "OFF";
30
+ readonly poolSize?: never;
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/capacitor/CapacitorConnectionOptions.ts"],"names":[],"mappings":"","file":"CapacitorConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface CapacitorConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"capacitor\"\n\n /**\n * The capacitor-sqlite instance. For example, `new SQLiteConnection(CapacitorSQLite)`.\n */\n readonly driver: any\n\n /**\n * Database name (capacitor-sqlite will add the suffix `SQLite.db`)\n */\n readonly database: string\n\n /**\n * Set the mode for database encryption\n */\n readonly mode?: \"no-encryption\" | \"encryption\" | \"secret\" | \"newsecret\"\n\n /**\n * Database version\n */\n readonly version?: number\n\n /**\n * The SQLite journal mode (optional)\n */\n readonly journalMode?:\n | \"DELETE\"\n | \"TRUNCATE\"\n | \"PERSIST\"\n | \"MEMORY\"\n | \"WAL\"\n | \"OFF\"\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/capacitor/CapacitorConnectionOptions.ts"],"names":[],"mappings":"","file":"CapacitorConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface CapacitorConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"capacitor\"\n\n /**\n * The capacitor-sqlite instance. For example, `new SQLiteConnection(CapacitorSQLite)`.\n */\n readonly driver: any\n\n /**\n * Database name (capacitor-sqlite will add the suffix `SQLite.db`)\n */\n readonly database: string\n\n /**\n * Set the mode for database encryption\n */\n readonly mode?: \"no-encryption\" | \"encryption\" | \"secret\" | \"newsecret\"\n\n /**\n * Database version\n */\n readonly version?: number\n\n /**\n * The SQLite journal mode (optional)\n */\n readonly journalMode?:\n | \"DELETE\"\n | \"TRUNCATE\"\n | \"PERSIST\"\n | \"MEMORY\"\n | \"WAL\"\n | \"OFF\"\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
@@ -705,6 +705,7 @@ export class CockroachDriver {
705
705
  port: credentials.port,
706
706
  ssl: credentials.ssl,
707
707
  application_name: options.applicationName,
708
+ max: options.poolSize,
708
709
  }, options.extra || {});
709
710
  // create a connection pool
710
711
  const pool = new this.postgres.Pool(connectionOptions);
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/cockroach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;IAClB,CAAC;CACJ","file":"CockroachDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { CockroachConnectionCredentialsOptions } from \"./CockroachConnectionCredentialsOptions\"\nimport { CockroachConnectionOptions } from \"./CockroachConnectionOptions\"\nimport { DateUtils } from \"../../util/DateUtils\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source/DataSource\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { QueryRunner } from \"../../query-runner/QueryRunner\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { CockroachQueryRunner } from \"./CockroachQueryRunner\"\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 { ObjectUtils } from \"../../util/ObjectUtils\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\n\n/**\n * Organizes communication with Cockroach DBMS.\n */\nexport class CockroachDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by driver.\n */\n connection: DataSource\n\n /**\n * Cockroach underlying library.\n */\n postgres: any\n\n /**\n * Pool for master database.\n */\n master: any\n\n /**\n * Pool for slave databases.\n * Used in replication.\n */\n slaves: any[] = []\n\n /**\n * We store all created query runners because we need to release them.\n */\n connectedQueryRunners: QueryRunner[] = []\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: CockroachConnectionOptions\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 * Schema that's used internally by Postgres for object resolution.\n *\n * Because we never set this we have to track it in separately from the `schema` so\n * we know when we have to specify the full schema or not.\n *\n * In most cases this will be `public`.\n */\n searchSchema?: 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.cockroachlabs.com/docs/stable/data-types.html\n */\n supportedDataTypes: ColumnType[] = [\n \"array\",\n \"bool\",\n \"boolean\",\n \"bytes\",\n \"bytea\",\n \"blob\",\n \"date\",\n \"numeric\",\n \"decimal\",\n \"dec\",\n \"float\",\n \"float4\",\n \"float8\",\n \"double precision\",\n \"real\",\n \"inet\",\n \"int\",\n \"int4\",\n \"integer\",\n \"int2\",\n \"int8\",\n \"int64\",\n \"smallint\",\n \"bigint\",\n \"interval\",\n \"string\",\n \"character varying\",\n \"character\",\n \"char\",\n \"char varying\",\n \"varchar\",\n \"text\",\n \"time\",\n \"time without time zone\",\n \"timestamp\",\n \"timestamptz\",\n \"timestamp without time zone\",\n \"timestamp with time zone\",\n \"json\",\n \"jsonb\",\n \"uuid\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n readonly supportedUpsertType = \"on-conflict-do-update\"\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 \"character varying\",\n \"char varying\",\n \"varchar\",\n \"character\",\n \"char\",\n \"string\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\"numeric\", \"decimal\", \"dec\"]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\"numeric\", \"decimal\", \"dec\"]\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 createDate: \"timestamptz\",\n createDateDefault: \"now()\",\n updateDate: \"timestamptz\",\n updateDateDefault: \"now()\",\n deleteDate: \"timestamptz\",\n deleteDateNullable: true,\n version: Number,\n treeLevel: Number,\n migrationId: Number,\n migrationName: \"varchar\",\n migrationTimestamp: \"int8\",\n cacheId: Number,\n cacheIdentifier: \"varchar\",\n cacheTime: \"int8\",\n cacheDuration: Number,\n cacheQuery: \"string\",\n cacheResult: \"string\",\n metadataType: \"varchar\",\n metadataDatabase: \"varchar\",\n metadataSchema: \"varchar\",\n metadataTable: \"varchar\",\n metadataName: \"varchar\",\n metadataValue: \"string\",\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 char: { length: 1 },\n }\n\n /**\n * No documentation specifying a maximum length for identifiers could be found\n * for CockroarchDb.\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities = {\n enabled: true,\n writable: true,\n materializedHint: true,\n requiresRecursiveHint: true,\n }\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as CockroachConnectionOptions\n this.isReplicated = this.options.replication ? true : false\n\n // load postgres package\n this.loadDependencies()\n\n this.database = DriverUtils.buildDriverOptions(\n this.options.replication\n ? this.options.replication.master\n : this.options,\n ).database\n this.schema = DriverUtils.buildDriverOptions(this.options).schema\n\n // ObjectUtils.assign(this.options, DriverUtils.buildDriverOptions(connection.options)); // todo: do it better way\n // validate options to make sure everything is set\n // todo: revisit validation with replication in mind\n // if (!this.options.host)\n // throw new DriverOptionNotSetError(\"host\");\n // if (!this.options.username)\n // throw new DriverOptionNotSetError(\"username\");\n // if (!this.options.database)\n // throw new DriverOptionNotSetError(\"database\");\n }\n\n // -------------------------------------------------------------------------\n // Public Implemented Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * Based on pooling options, it can either create connection immediately,\n * either create a pool and create connection when needed.\n */\n async connect(): Promise<void> {\n if (this.options.replication) {\n this.slaves = await Promise.all(\n this.options.replication.slaves.map((slave) => {\n return this.createPool(this.options, slave)\n }),\n )\n this.master = await this.createPool(\n this.options,\n this.options.replication.master,\n )\n } else {\n this.master = await this.createPool(this.options, this.options)\n }\n\n if (!this.database || !this.searchSchema) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n if (!this.database) {\n this.database = await queryRunner.getCurrentDatabase()\n }\n\n if (!this.searchSchema) {\n this.searchSchema = await queryRunner.getCurrentSchema()\n }\n\n await queryRunner.release()\n }\n\n if (!this.schema) {\n this.schema = this.searchSchema\n }\n }\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n async afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with database.\n */\n async disconnect(): Promise<void> {\n if (!this.master)\n return Promise.reject(new ConnectionIsNotSetError(\"cockroachdb\"))\n\n await this.closePool(this.master)\n await Promise.all(this.slaves.map((slave) => this.closePool(slave)))\n this.master = undefined\n this.slaves = []\n }\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 CockroachQueryRunner(this, mode)\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 (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 (\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date ||\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"timestamptz\" ||\n columnMetadata.type === \"timestamp with time zone\" ||\n columnMetadata.type === \"timestamp without time zone\"\n ) {\n return DateUtils.mixedDateToDate(value)\n } else if (\n [\"json\", \"jsonb\", ...this.spatialTypes].indexOf(\n columnMetadata.type,\n ) >= 0\n ) {\n return JSON.stringify(value)\n } else if (columnMetadata.type === \"simple-array\") {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(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 // unique_rowid() generates bigint value and should not be converted to number\n if (\n ([Number, \"int4\", \"smallint\", \"int2\"].some(\n (v) => v === columnMetadata.type,\n ) &&\n !columnMetadata.isArray) ||\n columnMetadata.generationStrategy === \"increment\"\n ) {\n value = parseInt(value)\n } else if (columnMetadata.type === Boolean) {\n value = value ? true : false\n } else if (\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date ||\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"timestamptz\" ||\n columnMetadata.type === \"timestamp with time zone\" ||\n columnMetadata.type === \"timestamp without time zone\"\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (columnMetadata.type === \"simple-array\") {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(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 * 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 schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(tableName: string, schema?: string): string {\n let tablePath = [tableName]\n\n if (schema) {\n tablePath.unshift(schema)\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 = this.schema\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n // name is sometimes a path\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 // referencedTableName is sometimes a path\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: driverDatabase,\n schema: (parts.length > 1 ? parts[0] : undefined) || driverSchema,\n tableName: parts.length > 1 ? parts[1] : parts[0],\n }\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 isArray?: boolean\n isGenerated?: boolean\n generationStrategy?: \"increment\" | \"uuid\" | \"rowid\"\n }): string {\n if (\n column.type === Number ||\n column.type === \"integer\" ||\n column.type === \"int\" ||\n column.type === \"bigint\" ||\n column.type === \"int64\"\n ) {\n return \"int8\"\n } else if (\n column.type === String ||\n column.type === \"character varying\" ||\n column.type === \"char varying\"\n ) {\n return \"varchar\"\n } else if (\n column.type === Date ||\n column.type === \"timestamp without time zone\"\n ) {\n return \"timestamp\"\n } else if (column.type === \"timestamp with time zone\") {\n return \"timestamptz\"\n } else if (column.type === \"time without time zone\") {\n return \"time\"\n } else if (column.type === Boolean || column.type === \"boolean\") {\n return \"bool\"\n } else if (\n column.type === \"simple-array\" ||\n column.type === \"simple-json\" ||\n column.type === \"text\"\n ) {\n return \"string\"\n } else if (column.type === \"bytea\" || column.type === \"blob\") {\n return \"bytes\"\n } else if (column.type === \"smallint\") {\n return \"int2\"\n } else if (column.type === \"numeric\" || column.type === \"dec\") {\n return \"decimal\"\n } else if (\n column.type === \"double precision\" ||\n column.type === \"float\"\n ) {\n return \"float8\"\n } else if (column.type === \"real\") {\n return \"float4\"\n } else if (column.type === \"character\") {\n return \"char\"\n } else if (column.type === \"json\") {\n return \"jsonb\"\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 const arrayCast = columnMetadata.isArray\n ? `::${columnMetadata.type}[]`\n : \"\"\n\n if (typeof defaultValue === \"number\") {\n return `(${defaultValue})`\n }\n\n if (typeof defaultValue === \"boolean\") {\n return defaultValue ? \"true\" : \"false\"\n }\n\n if (typeof defaultValue === \"function\") {\n const value = defaultValue()\n if (value.toUpperCase() === \"CURRENT_TIMESTAMP\") {\n return \"current_timestamp()\"\n } else if (value.toUpperCase() === \"CURRENT_DATE\") {\n return \"current_date()\"\n }\n return value\n }\n\n if (typeof defaultValue === \"string\") {\n return `'${defaultValue}'${arrayCast}`\n }\n\n if (ObjectUtils.isObject(defaultValue) && defaultValue !== null) {\n return `'${JSON.stringify(defaultValue)}'`\n }\n\n if (defaultValue === undefined || defaultValue === null) {\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.uniques.some(\n (uq) => uq.columns.length === 1 && uq.columns[0] === column,\n )\n }\n\n /**\n * Returns default column lengths, which is required on column creation.\n */\n getColumnLength(column: ColumnMetadata): string {\n return column.length ? column.length.toString() : \"\"\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 if (column.length) {\n type += \"(\" + column.length + \")\"\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 async obtainMasterConnection(): Promise<any> {\n if (!this.master) {\n throw new TypeORMError(\"Driver not Connected\")\n }\n\n return new Promise((ok, fail) => {\n this.master.connect((err: any, connection: any, release: any) => {\n err ? fail(err) : ok([connection, release])\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 async obtainSlaveConnection(): Promise<any> {\n if (!this.slaves.length) return this.obtainMasterConnection()\n\n const random = Math.floor(Math.random() * this.slaves.length)\n\n return new Promise((ok, fail) => {\n this.slaves[random].connect(\n (err: any, connection: any, release: any) => {\n err ? fail(err) : ok([connection, release])\n },\n )\n })\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n *\n * todo: slow. optimize Object.keys(), OrmUtils.mergeDeep and column.createValueMap parts\n */\n createGeneratedMap(metadata: EntityMetadata, insertResult: ObjectLiteral) {\n if (!insertResult) return undefined\n\n return Object.keys(insertResult).reduce((map, key) => {\n const column = metadata.findColumnWithDatabaseName(key)\n if (column) {\n OrmUtils.mergeDeep(\n map,\n column.createValueMap(\n this.prepareHydratedValue(insertResult[key], column),\n ),\n )\n }\n return map\n }, {} as ObjectLiteral)\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(\"comment:\", tableColumn.comment, this.escapeComment(columnMetadata.comment));\n // console.log(\"default:\", tableColumn.default, columnMetadata.default);\n // console.log(\"default changed:\", !this.compareDefaultValues(this.normalizeDefault(columnMetadata), tableColumn.default));\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(\"==========================================\");\n\n return (\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n tableColumn.length !== columnMetadata.length ||\n tableColumn.precision !== columnMetadata.precision ||\n (columnMetadata.scale !== undefined &&\n tableColumn.scale !== columnMetadata.scale) ||\n tableColumn.comment !==\n this.escapeComment(columnMetadata.comment) ||\n (!tableColumn.isGenerated &&\n this.lowerDefaultValueIfNecessary(\n this.normalizeDefault(columnMetadata),\n ) !== tableColumn.default) || // we included check for generated here, because generated columns already can have default values\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n tableColumn.isGenerated !== columnMetadata.isGenerated ||\n tableColumn.generatedType !== columnMetadata.generatedType ||\n (tableColumn.asExpression || \"\").trim() !==\n (columnMetadata.asExpression || \"\").trim()\n )\n })\n }\n\n private lowerDefaultValueIfNecessary(value: string | undefined) {\n if (!value) {\n return value\n }\n return value\n .split(`'`)\n .map((v, i) => {\n return i % 2 === 1 ? v : v.toLowerCase()\n })\n .join(`'`)\n }\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return true\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return true\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"$\" + (index + 1)\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads postgres query stream package.\n */\n loadStreamDependency() {\n try {\n return PlatformTools.load(\"pg-query-stream\")\n } catch (e) {\n // todo: better error for browser env\n throw new TypeORMError(\n `To use streams you should install pg-query-stream package. Please run npm i pg-query-stream --save command.`,\n )\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * If driver dependency is not given explicitly, then try to load it via \"require\".\n */\n protected loadDependencies(): void {\n try {\n const postgres = this.options.driver || PlatformTools.load(\"pg\")\n this.postgres = postgres\n try {\n const pgNative =\n this.options.nativeDriver || PlatformTools.load(\"pg-native\")\n if (pgNative && this.postgres.native)\n this.postgres = this.postgres.native\n } catch (e) {}\n } catch (e) {\n // todo: better error for browser env\n throw new DriverPackageNotInstalledError(\"Postgres\", \"pg\")\n }\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected async createPool(\n options: CockroachConnectionOptions,\n credentials: CockroachConnectionCredentialsOptions,\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 const connectionOptions = Object.assign(\n {},\n {\n host: credentials.host,\n user: credentials.username,\n password: credentials.password,\n database: credentials.database,\n port: credentials.port,\n ssl: credentials.ssl,\n application_name: options.applicationName,\n },\n options.extra || {},\n )\n\n // create a connection pool\n const pool = new this.postgres.Pool(connectionOptions)\n const { logger } = this.connection\n\n const poolErrorHandler =\n options.poolErrorHandler ||\n ((error: any) =>\n logger.log(\"warn\", `Postgres pool raised an error. ${error}`))\n\n /*\n Attaching an error handler to pool errors is essential, as, otherwise, errors raised will go unhandled and\n cause the hosting app to crash.\n */\n pool.on(\"error\", poolErrorHandler)\n\n return new Promise((ok, fail) => {\n pool.connect((err: any, connection: any, release: Function) => {\n if (err) return fail(err)\n release()\n ok(pool)\n })\n })\n }\n\n /**\n * Closes connection pool.\n */\n protected async closePool(pool: any): Promise<void> {\n await Promise.all(\n this.connectedQueryRunners.map((queryRunner) =>\n queryRunner.release(),\n ),\n )\n return new Promise<void>((ok, fail) => {\n pool.end((err: any) => (err ? fail(err) : ok()))\n })\n }\n\n /**\n * Escapes a given comment.\n */\n protected escapeComment(comment?: string) {\n if (!comment) return comment\n\n comment = comment.replace(/'/g, \"''\").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/cockroachdb/CockroachDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAE7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAK5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAO5E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,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,CAAA;gBACT,EAAE,CAAC,IAAI,CAAC,CAAA;YACZ,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,SAAS,CAAC,IAAS;QAC/B,MAAM,OAAO,CAAC,GAAG,CACb,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAC3C,WAAW,CAAC,OAAO,EAAE,CACxB,CACJ,CAAA;QACD,OAAO,IAAI,OAAO,CAAO,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE;YAClC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;QACpD,CAAC,CAAC,CAAA;IACN,CAAC;IAED;;OAEG;IACO,aAAa,CAAC,OAAgB;QACpC,IAAI,CAAC,OAAO;YAAE,OAAO,OAAO,CAAA;QAE5B,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAA,CAAC,wCAAwC;QAErG,OAAO,OAAO,CAAA;IAClB,CAAC;CACJ","file":"CockroachDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { CockroachConnectionCredentialsOptions } from \"./CockroachConnectionCredentialsOptions\"\nimport { CockroachConnectionOptions } from \"./CockroachConnectionOptions\"\nimport { DateUtils } from \"../../util/DateUtils\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source/DataSource\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { QueryRunner } from \"../../query-runner/QueryRunner\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { CockroachQueryRunner } from \"./CockroachQueryRunner\"\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 { ObjectUtils } from \"../../util/ObjectUtils\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\n\n/**\n * Organizes communication with Cockroach DBMS.\n */\nexport class CockroachDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by driver.\n */\n connection: DataSource\n\n /**\n * Cockroach underlying library.\n */\n postgres: any\n\n /**\n * Pool for master database.\n */\n master: any\n\n /**\n * Pool for slave databases.\n * Used in replication.\n */\n slaves: any[] = []\n\n /**\n * We store all created query runners because we need to release them.\n */\n connectedQueryRunners: QueryRunner[] = []\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: CockroachConnectionOptions\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 * Schema that's used internally by Postgres for object resolution.\n *\n * Because we never set this we have to track it in separately from the `schema` so\n * we know when we have to specify the full schema or not.\n *\n * In most cases this will be `public`.\n */\n searchSchema?: 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.cockroachlabs.com/docs/stable/data-types.html\n */\n supportedDataTypes: ColumnType[] = [\n \"array\",\n \"bool\",\n \"boolean\",\n \"bytes\",\n \"bytea\",\n \"blob\",\n \"date\",\n \"numeric\",\n \"decimal\",\n \"dec\",\n \"float\",\n \"float4\",\n \"float8\",\n \"double precision\",\n \"real\",\n \"inet\",\n \"int\",\n \"int4\",\n \"integer\",\n \"int2\",\n \"int8\",\n \"int64\",\n \"smallint\",\n \"bigint\",\n \"interval\",\n \"string\",\n \"character varying\",\n \"character\",\n \"char\",\n \"char varying\",\n \"varchar\",\n \"text\",\n \"time\",\n \"time without time zone\",\n \"timestamp\",\n \"timestamptz\",\n \"timestamp without time zone\",\n \"timestamp with time zone\",\n \"json\",\n \"jsonb\",\n \"uuid\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n readonly supportedUpsertType = \"on-conflict-do-update\"\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 \"character varying\",\n \"char varying\",\n \"varchar\",\n \"character\",\n \"char\",\n \"string\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\"numeric\", \"decimal\", \"dec\"]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\"numeric\", \"decimal\", \"dec\"]\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 createDate: \"timestamptz\",\n createDateDefault: \"now()\",\n updateDate: \"timestamptz\",\n updateDateDefault: \"now()\",\n deleteDate: \"timestamptz\",\n deleteDateNullable: true,\n version: Number,\n treeLevel: Number,\n migrationId: Number,\n migrationName: \"varchar\",\n migrationTimestamp: \"int8\",\n cacheId: Number,\n cacheIdentifier: \"varchar\",\n cacheTime: \"int8\",\n cacheDuration: Number,\n cacheQuery: \"string\",\n cacheResult: \"string\",\n metadataType: \"varchar\",\n metadataDatabase: \"varchar\",\n metadataSchema: \"varchar\",\n metadataTable: \"varchar\",\n metadataName: \"varchar\",\n metadataValue: \"string\",\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 char: { length: 1 },\n }\n\n /**\n * No documentation specifying a maximum length for identifiers could be found\n * for CockroarchDb.\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities = {\n enabled: true,\n writable: true,\n materializedHint: true,\n requiresRecursiveHint: true,\n }\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as CockroachConnectionOptions\n this.isReplicated = this.options.replication ? true : false\n\n // load postgres package\n this.loadDependencies()\n\n this.database = DriverUtils.buildDriverOptions(\n this.options.replication\n ? this.options.replication.master\n : this.options,\n ).database\n this.schema = DriverUtils.buildDriverOptions(this.options).schema\n\n // ObjectUtils.assign(this.options, DriverUtils.buildDriverOptions(connection.options)); // todo: do it better way\n // validate options to make sure everything is set\n // todo: revisit validation with replication in mind\n // if (!this.options.host)\n // throw new DriverOptionNotSetError(\"host\");\n // if (!this.options.username)\n // throw new DriverOptionNotSetError(\"username\");\n // if (!this.options.database)\n // throw new DriverOptionNotSetError(\"database\");\n }\n\n // -------------------------------------------------------------------------\n // Public Implemented Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * Based on pooling options, it can either create connection immediately,\n * either create a pool and create connection when needed.\n */\n async connect(): Promise<void> {\n if (this.options.replication) {\n this.slaves = await Promise.all(\n this.options.replication.slaves.map((slave) => {\n return this.createPool(this.options, slave)\n }),\n )\n this.master = await this.createPool(\n this.options,\n this.options.replication.master,\n )\n } else {\n this.master = await this.createPool(this.options, this.options)\n }\n\n if (!this.database || !this.searchSchema) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n if (!this.database) {\n this.database = await queryRunner.getCurrentDatabase()\n }\n\n if (!this.searchSchema) {\n this.searchSchema = await queryRunner.getCurrentSchema()\n }\n\n await queryRunner.release()\n }\n\n if (!this.schema) {\n this.schema = this.searchSchema\n }\n }\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n async afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with database.\n */\n async disconnect(): Promise<void> {\n if (!this.master)\n return Promise.reject(new ConnectionIsNotSetError(\"cockroachdb\"))\n\n await this.closePool(this.master)\n await Promise.all(this.slaves.map((slave) => this.closePool(slave)))\n this.master = undefined\n this.slaves = []\n }\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 CockroachQueryRunner(this, mode)\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 (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 (\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date ||\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"timestamptz\" ||\n columnMetadata.type === \"timestamp with time zone\" ||\n columnMetadata.type === \"timestamp without time zone\"\n ) {\n return DateUtils.mixedDateToDate(value)\n } else if (\n [\"json\", \"jsonb\", ...this.spatialTypes].indexOf(\n columnMetadata.type,\n ) >= 0\n ) {\n return JSON.stringify(value)\n } else if (columnMetadata.type === \"simple-array\") {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(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 // unique_rowid() generates bigint value and should not be converted to number\n if (\n ([Number, \"int4\", \"smallint\", \"int2\"].some(\n (v) => v === columnMetadata.type,\n ) &&\n !columnMetadata.isArray) ||\n columnMetadata.generationStrategy === \"increment\"\n ) {\n value = parseInt(value)\n } else if (columnMetadata.type === Boolean) {\n value = value ? true : false\n } else if (\n columnMetadata.type === \"datetime\" ||\n columnMetadata.type === Date ||\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"timestamptz\" ||\n columnMetadata.type === \"timestamp with time zone\" ||\n columnMetadata.type === \"timestamp without time zone\"\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (columnMetadata.type === \"simple-array\") {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(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 * 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 schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(tableName: string, schema?: string): string {\n let tablePath = [tableName]\n\n if (schema) {\n tablePath.unshift(schema)\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 = this.schema\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n // name is sometimes a path\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 // referencedTableName is sometimes a path\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: driverDatabase,\n schema: (parts.length > 1 ? parts[0] : undefined) || driverSchema,\n tableName: parts.length > 1 ? parts[1] : parts[0],\n }\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 isArray?: boolean\n isGenerated?: boolean\n generationStrategy?: \"increment\" | \"uuid\" | \"rowid\"\n }): string {\n if (\n column.type === Number ||\n column.type === \"integer\" ||\n column.type === \"int\" ||\n column.type === \"bigint\" ||\n column.type === \"int64\"\n ) {\n return \"int8\"\n } else if (\n column.type === String ||\n column.type === \"character varying\" ||\n column.type === \"char varying\"\n ) {\n return \"varchar\"\n } else if (\n column.type === Date ||\n column.type === \"timestamp without time zone\"\n ) {\n return \"timestamp\"\n } else if (column.type === \"timestamp with time zone\") {\n return \"timestamptz\"\n } else if (column.type === \"time without time zone\") {\n return \"time\"\n } else if (column.type === Boolean || column.type === \"boolean\") {\n return \"bool\"\n } else if (\n column.type === \"simple-array\" ||\n column.type === \"simple-json\" ||\n column.type === \"text\"\n ) {\n return \"string\"\n } else if (column.type === \"bytea\" || column.type === \"blob\") {\n return \"bytes\"\n } else if (column.type === \"smallint\") {\n return \"int2\"\n } else if (column.type === \"numeric\" || column.type === \"dec\") {\n return \"decimal\"\n } else if (\n column.type === \"double precision\" ||\n column.type === \"float\"\n ) {\n return \"float8\"\n } else if (column.type === \"real\") {\n return \"float4\"\n } else if (column.type === \"character\") {\n return \"char\"\n } else if (column.type === \"json\") {\n return \"jsonb\"\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 const arrayCast = columnMetadata.isArray\n ? `::${columnMetadata.type}[]`\n : \"\"\n\n if (typeof defaultValue === \"number\") {\n return `(${defaultValue})`\n }\n\n if (typeof defaultValue === \"boolean\") {\n return defaultValue ? \"true\" : \"false\"\n }\n\n if (typeof defaultValue === \"function\") {\n const value = defaultValue()\n if (value.toUpperCase() === \"CURRENT_TIMESTAMP\") {\n return \"current_timestamp()\"\n } else if (value.toUpperCase() === \"CURRENT_DATE\") {\n return \"current_date()\"\n }\n return value\n }\n\n if (typeof defaultValue === \"string\") {\n return `'${defaultValue}'${arrayCast}`\n }\n\n if (ObjectUtils.isObject(defaultValue) && defaultValue !== null) {\n return `'${JSON.stringify(defaultValue)}'`\n }\n\n if (defaultValue === undefined || defaultValue === null) {\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.uniques.some(\n (uq) => uq.columns.length === 1 && uq.columns[0] === column,\n )\n }\n\n /**\n * Returns default column lengths, which is required on column creation.\n */\n getColumnLength(column: ColumnMetadata): string {\n return column.length ? column.length.toString() : \"\"\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 if (column.length) {\n type += \"(\" + column.length + \")\"\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 async obtainMasterConnection(): Promise<any> {\n if (!this.master) {\n throw new TypeORMError(\"Driver not Connected\")\n }\n\n return new Promise((ok, fail) => {\n this.master.connect((err: any, connection: any, release: any) => {\n err ? fail(err) : ok([connection, release])\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 async obtainSlaveConnection(): Promise<any> {\n if (!this.slaves.length) return this.obtainMasterConnection()\n\n const random = Math.floor(Math.random() * this.slaves.length)\n\n return new Promise((ok, fail) => {\n this.slaves[random].connect(\n (err: any, connection: any, release: any) => {\n err ? fail(err) : ok([connection, release])\n },\n )\n })\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n *\n * todo: slow. optimize Object.keys(), OrmUtils.mergeDeep and column.createValueMap parts\n */\n createGeneratedMap(metadata: EntityMetadata, insertResult: ObjectLiteral) {\n if (!insertResult) return undefined\n\n return Object.keys(insertResult).reduce((map, key) => {\n const column = metadata.findColumnWithDatabaseName(key)\n if (column) {\n OrmUtils.mergeDeep(\n map,\n column.createValueMap(\n this.prepareHydratedValue(insertResult[key], column),\n ),\n )\n }\n return map\n }, {} as ObjectLiteral)\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(\"comment:\", tableColumn.comment, this.escapeComment(columnMetadata.comment));\n // console.log(\"default:\", tableColumn.default, columnMetadata.default);\n // console.log(\"default changed:\", !this.compareDefaultValues(this.normalizeDefault(columnMetadata), tableColumn.default));\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(\"==========================================\");\n\n return (\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n tableColumn.length !== columnMetadata.length ||\n tableColumn.precision !== columnMetadata.precision ||\n (columnMetadata.scale !== undefined &&\n tableColumn.scale !== columnMetadata.scale) ||\n tableColumn.comment !==\n this.escapeComment(columnMetadata.comment) ||\n (!tableColumn.isGenerated &&\n this.lowerDefaultValueIfNecessary(\n this.normalizeDefault(columnMetadata),\n ) !== tableColumn.default) || // we included check for generated here, because generated columns already can have default values\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n tableColumn.isGenerated !== columnMetadata.isGenerated ||\n tableColumn.generatedType !== columnMetadata.generatedType ||\n (tableColumn.asExpression || \"\").trim() !==\n (columnMetadata.asExpression || \"\").trim()\n )\n })\n }\n\n private lowerDefaultValueIfNecessary(value: string | undefined) {\n if (!value) {\n return value\n }\n return value\n .split(`'`)\n .map((v, i) => {\n return i % 2 === 1 ? v : v.toLowerCase()\n })\n .join(`'`)\n }\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return true\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return true\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"$\" + (index + 1)\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads postgres query stream package.\n */\n loadStreamDependency() {\n try {\n return PlatformTools.load(\"pg-query-stream\")\n } catch (e) {\n // todo: better error for browser env\n throw new TypeORMError(\n `To use streams you should install pg-query-stream package. Please run npm i pg-query-stream --save command.`,\n )\n }\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * If driver dependency is not given explicitly, then try to load it via \"require\".\n */\n protected loadDependencies(): void {\n try {\n const postgres = this.options.driver || PlatformTools.load(\"pg\")\n this.postgres = postgres\n try {\n const pgNative =\n this.options.nativeDriver || PlatformTools.load(\"pg-native\")\n if (pgNative && this.postgres.native)\n this.postgres = this.postgres.native\n } catch (e) {}\n } catch (e) {\n // todo: better error for browser env\n throw new DriverPackageNotInstalledError(\"Postgres\", \"pg\")\n }\n }\n\n /**\n * Creates a new connection pool for a given database credentials.\n */\n protected async createPool(\n options: CockroachConnectionOptions,\n credentials: CockroachConnectionCredentialsOptions,\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 const connectionOptions = Object.assign(\n {},\n {\n host: credentials.host,\n user: credentials.username,\n password: credentials.password,\n database: credentials.database,\n port: credentials.port,\n ssl: credentials.ssl,\n application_name: options.applicationName,\n max: options.poolSize,\n },\n options.extra || {},\n )\n\n // create a connection pool\n const pool = new this.postgres.Pool(connectionOptions)\n const { logger } = this.connection\n\n const poolErrorHandler =\n options.poolErrorHandler ||\n ((error: any) =>\n logger.log(\"warn\", `Postgres pool raised an error. ${error}`))\n\n /*\n Attaching an error handler to pool errors is essential, as, otherwise, errors raised will go unhandled and\n cause the hosting app to crash.\n */\n pool.on(\"error\", poolErrorHandler)\n\n return new Promise((ok, fail) => {\n pool.connect((err: any, connection: any, release: Function) => {\n if (err) return fail(err)\n release()\n ok(pool)\n })\n })\n }\n\n /**\n * Closes connection pool.\n */\n protected async closePool(pool: any): Promise<void> {\n await Promise.all(\n this.connectedQueryRunners.map((queryRunner) =>\n queryRunner.release(),\n ),\n )\n return new Promise<void>((ok, fail) => {\n pool.end((err: any) => (err ? fail(err) : ok()))\n })\n }\n\n /**\n * Escapes a given comment.\n */\n protected escapeComment(comment?: string) {\n if (!comment) return comment\n\n comment = comment.replace(/'/g, \"''\").replace(/\\u0000/g, \"\") // Null bytes aren't allowed in comments\n\n return comment\n }\n}\n"],"sourceRoot":"../.."}
@@ -20,4 +20,5 @@ export interface CordovaConnectionOptions extends BaseDataSourceOptions {
20
20
  * Storage Location
21
21
  */
22
22
  readonly location: string;
23
+ readonly poolSize?: never;
23
24
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/cordova/CordovaConnectionOptions.ts"],"names":[],"mappings":"","file":"CordovaConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface CordovaConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"cordova\"\n\n /**\n * Database name.\n */\n readonly database: string\n\n /**\n * The driver object\n * This defaults to `window.sqlitePlugin`\n */\n readonly driver?: any\n\n /**\n * Storage Location\n */\n readonly location: string\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/cordova/CordovaConnectionOptions.ts"],"names":[],"mappings":"","file":"CordovaConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface CordovaConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"cordova\"\n\n /**\n * Database name.\n */\n readonly database: string\n\n /**\n * The driver object\n * This defaults to `window.sqlitePlugin`\n */\n readonly driver?: any\n\n /**\n * Storage Location\n */\n readonly location: string\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
@@ -15,4 +15,5 @@ export interface ExpoConnectionOptions extends BaseDataSourceOptions {
15
15
  * Driver module
16
16
  */
17
17
  readonly driver: any;
18
+ readonly poolSize?: never;
18
19
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/expo/ExpoConnectionOptions.ts"],"names":[],"mappings":"","file":"ExpoConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface ExpoConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"expo\"\n\n /**\n * Database name.\n */\n readonly database: string\n\n /**\n * Driver module\n */\n readonly driver: any\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/expo/ExpoConnectionOptions.ts"],"names":[],"mappings":"","file":"ExpoConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\n\n/**\n * Sqlite-specific connection options.\n */\nexport interface ExpoConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"expo\"\n\n /**\n * Database name.\n */\n readonly database: string\n\n /**\n * Driver module\n */\n readonly driver: any\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
@@ -43,10 +43,6 @@ export interface MongoConnectionOptions extends BaseDataSourceOptions {
43
43
  * This defaults to require("mongodb")
44
44
  */
45
45
  readonly driver?: any;
46
- /**
47
- * Set the maximum poolSize for each individual server or proxy connection.
48
- */
49
- readonly poolSize?: number;
50
46
  /**
51
47
  * Use ssl connection (needs to have a mongod server with ssl support). Default: false
52
48
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/mongodb/MongoConnectionOptions.ts"],"names":[],"mappings":"","file":"MongoConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { ReadPreference } from \"./typings\"\n\n/**\n * MongoDB specific connection options.\n * Synced with http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html\n */\nexport interface MongoConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"mongodb\"\n\n /**\n * Connection url where perform connection to.\n */\n readonly url?: string\n\n /**\n * Database host.\n */\n readonly host?: string\n\n /**\n * Database host replica set.\n */\n readonly hostReplicaSet?: string\n\n /**\n * Database host port.\n */\n readonly port?: number\n\n /**\n * Database username.\n */\n readonly username?: string\n\n /**\n * Database password.\n */\n readonly password?: string\n\n /**\n * Database name to connect to.\n */\n readonly database?: string\n\n /**\n * The driver object\n * This defaults to require(\"mongodb\")\n */\n readonly driver?: any\n\n /**\n * Set the maximum poolSize for each individual server or proxy connection.\n */\n readonly poolSize?: number\n\n /**\n * Use ssl connection (needs to have a mongod server with ssl support). Default: false\n */\n readonly ssl?: boolean\n\n /**\n * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).\n * Default: true\n */\n readonly sslValidate?: boolean\n\n /**\n * Array of valid certificates either as Buffers or Strings\n * (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n readonly sslCA?: string | Buffer\n\n /**\n * String or buffer containing the certificate we wish to present\n * (needs to have a mongod server with ssl support, 2.4 or higher)\n */\n readonly sslCert?: string | Buffer\n\n /**\n * String or buffer containing the certificate private key we wish to present\n * (needs to have a mongod server with ssl support, 2.4 or higher)\n */\n readonly sslKey?: string\n\n /**\n * String or buffer containing the certificate password\n * (needs to have a mongod server with ssl support, 2.4 or higher)\n */\n readonly sslPass?: string | Buffer\n\n /**\n * SSL Certificate revocation list binary buffer\n * (needs to have a mongod server with ssl support, 2.4 or higher)\n */\n readonly sslCRL?: string | Buffer\n\n /**\n * Reconnect on error. Default: true\n */\n readonly autoReconnect?: boolean\n\n /**\n * TCP Socket NoDelay option. Default: true\n */\n readonly noDelay?: boolean\n\n /**\n * The number of milliseconds to wait before initiating keepAlive on the TCP socket. Default: 30000\n */\n readonly keepAlive?: number\n\n /**\n * TCP Connection timeout setting. Default: 30000\n */\n readonly connectTimeoutMS?: number\n\n /**\n * Version of IP stack. Can be 4, 6.\n * If undefined, will attempt to connect with IPv6, and will fall back to IPv4 on failure\n */\n readonly family?: number\n\n /**\n * TCP Socket timeout setting. Default: 360000\n */\n readonly socketTimeoutMS?: number\n\n /**\n * Server attempt to reconnect #times. Default 30\n */\n readonly reconnectTries?: number\n\n /**\n * Server will wait #milliseconds between retries. Default 1000\n */\n readonly reconnectInterval?: number\n\n /**\n * Control if high availability monitoring runs for Replicaset or Mongos proxies. Default true\n */\n readonly ha?: boolean\n\n /**\n * The High availability period for replicaset inquiry. Default: 10000\n */\n readonly haInterval?: number\n\n /**\n * The name of the replicaset to connect to\n */\n readonly replicaSet?: string\n\n /**\n * Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms).\n * Default: 15\n */\n readonly acceptableLatencyMS?: number\n\n /**\n * Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms).\n * Default: 15\n */\n readonly secondaryAcceptableLatencyMS?: number\n\n /**\n * Sets if the driver should connect even if no primary is available. Default: false\n */\n readonly connectWithNoPrimary?: boolean\n\n /**\n * If the database authentication is dependent on another databaseName.\n */\n readonly authSource?: string\n\n /**\n * The write concern.\n */\n readonly w?: string | number\n\n /**\n * The write concern timeout value.\n */\n readonly wtimeout?: number\n\n /**\n * Specify a journal write concern. Default: false\n */\n readonly j?: boolean\n\n /**\n * Force server to assign _id values instead of driver. Default: false\n */\n readonly forceServerObjectId?: boolean\n\n /**\n * Serialize functions on any object. Default: false\n */\n readonly serializeFunctions?: boolean\n\n /**\n * Specify if the BSON serializer should ignore undefined fields. Default: false\n */\n readonly ignoreUndefined?: boolean\n\n /**\n * Return document results as raw BSON buffers. Default: false\n */\n readonly raw?: boolean\n\n /**\n * Promotes Long values to number if they fit inside the 53 bits resolution. Default: true\n */\n readonly promoteLongs?: boolean\n\n /**\n * Promotes Binary BSON values to native Node Buffers. Default: false\n */\n readonly promoteBuffers?: boolean\n\n /**\n * Promotes BSON values to native types where possible, set to false to only receive wrapper types. Default: true\n */\n readonly promoteValues?: boolean\n\n /**\n * Enable the wrapping of the callback in the current domain, disabled by default to avoid perf hit. Default: false\n */\n readonly domainsEnabled?: boolean\n\n /**\n * Sets a cap on how many operations the driver will buffer up before giving up on getting a working connection,\n * default is -1 which is unlimited.\n */\n readonly bufferMaxEntries?: number\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY,\n * ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readonly readPreference?: ReadPreference | string\n\n /**\n * A primary key factory object for generation of custom _id keys.\n */\n readonly pkFactory?: any\n\n /**\n * A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.\n */\n readonly promiseLibrary?: any\n\n /**\n * Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).\n */\n readonly readConcern?: any\n\n /**\n * Specify a maxStalenessSeconds value for secondary reads, minimum is 90 seconds\n */\n readonly maxStalenessSeconds?: number\n\n /**\n * Specify the log level used by the driver logger (error/warn/info/debug).\n */\n readonly loggerLevel?: \"error\" | \"warn\" | \"info\" | \"debug\"\n\n // Do not overwrite BaseDataSourceOptions.logger\n // readonly logger?: any;\n\n /**\n * Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function\n * Default: true\n */\n readonly checkServerIdentity?: boolean | Function\n\n /**\n * Validate MongoClient passed in options for correctness. Default: false\n */\n readonly validateOptions?: boolean | any\n\n /**\n * The name of the application that created this MongoClient instance. MongoDB 3.4 and newer will print this value in the server log upon establishing each connection. It is also recorded in the slow query log and profile collections\n */\n readonly appname?: string\n\n /**\n * Sets the authentication mechanism that MongoDB will use to authenticate the connection\n */\n readonly authMechanism?: string\n\n /**\n * Type of compression to use: snappy or zlib\n */\n readonly compression?: any\n\n /**\n * Specify a file sync write concern. Default: false\n */\n readonly fsync?: boolean\n\n /**\n * Read preference tags\n */\n readonly readPreferenceTags?: any[]\n\n /**\n * The number of retries for a tailable cursor. Default: 5\n */\n readonly numberOfRetries?: number\n\n /**\n * Enable auto reconnecting for single server instances. Default: true\n */\n readonly auto_reconnect?: boolean\n\n /**\n * Enable command monitoring for this client. Default: false\n */\n readonly monitorCommands?: boolean\n\n /**\n * If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections\n */\n readonly minSize?: number\n\n /**\n * Determines whether or not to use the new url parser. Default: false\n */\n readonly useNewUrlParser?: boolean\n\n /**\n * Determines whether or not to use the new Server Discovery and Monitoring engine. Default: false\n * https://github.com/mongodb/node-mongodb-native/releases/tag/v3.2.1\n */\n readonly useUnifiedTopology?: boolean\n\n /**\n * Automatic Client-Side Field Level Encryption configuration.\n */\n readonly autoEncryption?: any\n\n /**\n * Enables or disables the ability to retry writes upon encountering transient network errors.\n */\n readonly retryWrites?: boolean\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/mongodb/MongoConnectionOptions.ts"],"names":[],"mappings":"","file":"MongoConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { ReadPreference } from \"./typings\"\n\n/**\n * MongoDB specific connection options.\n * Synced with http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html\n */\nexport interface MongoConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"mongodb\"\n\n /**\n * Connection url where perform connection to.\n */\n readonly url?: string\n\n /**\n * Database host.\n */\n readonly host?: string\n\n /**\n * Database host replica set.\n */\n readonly hostReplicaSet?: string\n\n /**\n * Database host port.\n */\n readonly port?: number\n\n /**\n * Database username.\n */\n readonly username?: string\n\n /**\n * Database password.\n */\n readonly password?: string\n\n /**\n * Database name to connect to.\n */\n readonly database?: string\n\n /**\n * The driver object\n * This defaults to require(\"mongodb\")\n */\n readonly driver?: any\n\n /**\n * Use ssl connection (needs to have a mongod server with ssl support). Default: false\n */\n readonly ssl?: boolean\n\n /**\n * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).\n * Default: true\n */\n readonly sslValidate?: boolean\n\n /**\n * Array of valid certificates either as Buffers or Strings\n * (needs to have a mongod server with ssl support, 2.4 or higher).\n */\n readonly sslCA?: string | Buffer\n\n /**\n * String or buffer containing the certificate we wish to present\n * (needs to have a mongod server with ssl support, 2.4 or higher)\n */\n readonly sslCert?: string | Buffer\n\n /**\n * String or buffer containing the certificate private key we wish to present\n * (needs to have a mongod server with ssl support, 2.4 or higher)\n */\n readonly sslKey?: string\n\n /**\n * String or buffer containing the certificate password\n * (needs to have a mongod server with ssl support, 2.4 or higher)\n */\n readonly sslPass?: string | Buffer\n\n /**\n * SSL Certificate revocation list binary buffer\n * (needs to have a mongod server with ssl support, 2.4 or higher)\n */\n readonly sslCRL?: string | Buffer\n\n /**\n * Reconnect on error. Default: true\n */\n readonly autoReconnect?: boolean\n\n /**\n * TCP Socket NoDelay option. Default: true\n */\n readonly noDelay?: boolean\n\n /**\n * The number of milliseconds to wait before initiating keepAlive on the TCP socket. Default: 30000\n */\n readonly keepAlive?: number\n\n /**\n * TCP Connection timeout setting. Default: 30000\n */\n readonly connectTimeoutMS?: number\n\n /**\n * Version of IP stack. Can be 4, 6.\n * If undefined, will attempt to connect with IPv6, and will fall back to IPv4 on failure\n */\n readonly family?: number\n\n /**\n * TCP Socket timeout setting. Default: 360000\n */\n readonly socketTimeoutMS?: number\n\n /**\n * Server attempt to reconnect #times. Default 30\n */\n readonly reconnectTries?: number\n\n /**\n * Server will wait #milliseconds between retries. Default 1000\n */\n readonly reconnectInterval?: number\n\n /**\n * Control if high availability monitoring runs for Replicaset or Mongos proxies. Default true\n */\n readonly ha?: boolean\n\n /**\n * The High availability period for replicaset inquiry. Default: 10000\n */\n readonly haInterval?: number\n\n /**\n * The name of the replicaset to connect to\n */\n readonly replicaSet?: string\n\n /**\n * Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms).\n * Default: 15\n */\n readonly acceptableLatencyMS?: number\n\n /**\n * Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms).\n * Default: 15\n */\n readonly secondaryAcceptableLatencyMS?: number\n\n /**\n * Sets if the driver should connect even if no primary is available. Default: false\n */\n readonly connectWithNoPrimary?: boolean\n\n /**\n * If the database authentication is dependent on another databaseName.\n */\n readonly authSource?: string\n\n /**\n * The write concern.\n */\n readonly w?: string | number\n\n /**\n * The write concern timeout value.\n */\n readonly wtimeout?: number\n\n /**\n * Specify a journal write concern. Default: false\n */\n readonly j?: boolean\n\n /**\n * Force server to assign _id values instead of driver. Default: false\n */\n readonly forceServerObjectId?: boolean\n\n /**\n * Serialize functions on any object. Default: false\n */\n readonly serializeFunctions?: boolean\n\n /**\n * Specify if the BSON serializer should ignore undefined fields. Default: false\n */\n readonly ignoreUndefined?: boolean\n\n /**\n * Return document results as raw BSON buffers. Default: false\n */\n readonly raw?: boolean\n\n /**\n * Promotes Long values to number if they fit inside the 53 bits resolution. Default: true\n */\n readonly promoteLongs?: boolean\n\n /**\n * Promotes Binary BSON values to native Node Buffers. Default: false\n */\n readonly promoteBuffers?: boolean\n\n /**\n * Promotes BSON values to native types where possible, set to false to only receive wrapper types. Default: true\n */\n readonly promoteValues?: boolean\n\n /**\n * Enable the wrapping of the callback in the current domain, disabled by default to avoid perf hit. Default: false\n */\n readonly domainsEnabled?: boolean\n\n /**\n * Sets a cap on how many operations the driver will buffer up before giving up on getting a working connection,\n * default is -1 which is unlimited.\n */\n readonly bufferMaxEntries?: number\n\n /**\n * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY,\n * ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).\n */\n readonly readPreference?: ReadPreference | string\n\n /**\n * A primary key factory object for generation of custom _id keys.\n */\n readonly pkFactory?: any\n\n /**\n * A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.\n */\n readonly promiseLibrary?: any\n\n /**\n * Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).\n */\n readonly readConcern?: any\n\n /**\n * Specify a maxStalenessSeconds value for secondary reads, minimum is 90 seconds\n */\n readonly maxStalenessSeconds?: number\n\n /**\n * Specify the log level used by the driver logger (error/warn/info/debug).\n */\n readonly loggerLevel?: \"error\" | \"warn\" | \"info\" | \"debug\"\n\n // Do not overwrite BaseDataSourceOptions.logger\n // readonly logger?: any;\n\n /**\n * Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function\n * Default: true\n */\n readonly checkServerIdentity?: boolean | Function\n\n /**\n * Validate MongoClient passed in options for correctness. Default: false\n */\n readonly validateOptions?: boolean | any\n\n /**\n * The name of the application that created this MongoClient instance. MongoDB 3.4 and newer will print this value in the server log upon establishing each connection. It is also recorded in the slow query log and profile collections\n */\n readonly appname?: string\n\n /**\n * Sets the authentication mechanism that MongoDB will use to authenticate the connection\n */\n readonly authMechanism?: string\n\n /**\n * Type of compression to use: snappy or zlib\n */\n readonly compression?: any\n\n /**\n * Specify a file sync write concern. Default: false\n */\n readonly fsync?: boolean\n\n /**\n * Read preference tags\n */\n readonly readPreferenceTags?: any[]\n\n /**\n * The number of retries for a tailable cursor. Default: 5\n */\n readonly numberOfRetries?: number\n\n /**\n * Enable auto reconnecting for single server instances. Default: true\n */\n readonly auto_reconnect?: boolean\n\n /**\n * Enable command monitoring for this client. Default: false\n */\n readonly monitorCommands?: boolean\n\n /**\n * If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections\n */\n readonly minSize?: number\n\n /**\n * Determines whether or not to use the new url parser. Default: false\n */\n readonly useNewUrlParser?: boolean\n\n /**\n * Determines whether or not to use the new Server Discovery and Monitoring engine. Default: false\n * https://github.com/mongodb/node-mongodb-native/releases/tag/v3.2.1\n */\n readonly useUnifiedTopology?: boolean\n\n /**\n * Automatic Client-Side Field Level Encryption configuration.\n */\n readonly autoEncryption?: any\n\n /**\n * Enables or disables the ability to retry writes upon encountering transient network errors.\n */\n readonly retryWrites?: boolean\n}\n"],"sourceRoot":"../.."}
@@ -973,7 +973,7 @@ export class MysqlDriver {
973
973
  socketPath: credentials.socketPath,
974
974
  }, options.acquireTimeout === undefined
975
975
  ? {}
976
- : { acquireTimeout: options.acquireTimeout }, options.extra || {});
976
+ : { acquireTimeout: options.acquireTimeout }, { connectionLimit: options.poolSize }, options.extra || {});
977
977
  }
978
978
  /**
979
979
  * Creates a new connection pool for a given database credentials.