typeorm 0.3.28-dev.c16ef63 → 0.3.28-dev.d7867eb

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 (37) hide show
  1. package/browser/driver/mongodb/MongoConnectionOptions.d.ts +16 -0
  2. package/browser/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  3. package/browser/driver/mongodb/MongoDriver.js +5 -0
  4. package/browser/driver/mongodb/MongoDriver.js.map +1 -1
  5. package/browser/driver/mongodb/typings.d.ts +5 -0
  6. package/browser/driver/mongodb/typings.js.map +1 -1
  7. package/browser/driver/postgres/PostgresDriver.d.ts +1 -2
  8. package/browser/driver/postgres/PostgresDriver.js +2 -2
  9. package/browser/driver/postgres/PostgresDriver.js.map +1 -1
  10. package/browser/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
  11. package/browser/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  12. package/browser/driver/types/ColumnTypes.d.ts +1 -1
  13. package/browser/driver/types/ColumnTypes.js.map +1 -1
  14. package/browser/entity-schema/EntitySchemaOptions.d.ts +2 -0
  15. package/browser/entity-schema/EntitySchemaOptions.js.map +1 -1
  16. package/browser/entity-schema/EntitySchemaTransformer.js +9 -0
  17. package/browser/entity-schema/EntitySchemaTransformer.js.map +1 -1
  18. package/commands/InitCommand.js +23 -16
  19. package/commands/InitCommand.js.map +1 -1
  20. package/driver/mongodb/MongoConnectionOptions.d.ts +16 -0
  21. package/driver/mongodb/MongoConnectionOptions.js.map +1 -1
  22. package/driver/mongodb/MongoDriver.js +5 -0
  23. package/driver/mongodb/MongoDriver.js.map +1 -1
  24. package/driver/mongodb/typings.d.ts +5 -0
  25. package/driver/mongodb/typings.js.map +1 -1
  26. package/driver/postgres/PostgresDriver.d.ts +1 -2
  27. package/driver/postgres/PostgresDriver.js +2 -2
  28. package/driver/postgres/PostgresDriver.js.map +1 -1
  29. package/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
  30. package/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  31. package/driver/types/ColumnTypes.d.ts +1 -1
  32. package/driver/types/ColumnTypes.js.map +1 -1
  33. package/entity-schema/EntitySchemaOptions.d.ts +2 -0
  34. package/entity-schema/EntitySchemaOptions.js.map +1 -1
  35. package/entity-schema/EntitySchemaTransformer.js +9 -0
  36. package/entity-schema/EntitySchemaTransformer.js.map +1 -1
  37. package/package.json +1 -1
@@ -248,4 +248,20 @@ export interface MongoConnectionOptions extends BaseDataSourceOptions {
248
248
  * Please use the {@link writeConcern} option instead
249
249
  */
250
250
  readonly wtimeoutMS?: number;
251
+ /**
252
+ * Configures a Socks5 proxy host used for creating TCP connections.
253
+ */
254
+ readonly proxyHost?: string;
255
+ /**
256
+ * Configures a Socks5 proxy port used for creating TCP connections.
257
+ */
258
+ readonly proxyPort?: number;
259
+ /**
260
+ * Configures a Socks5 proxy username when the proxy in proxyHost requires username/password authentication.
261
+ */
262
+ readonly proxyUsername?: string;
263
+ /**
264
+ * Configures a Socks5 proxy password when the proxy in proxyHost requires username/password authentication.
265
+ */
266
+ readonly proxyPassword?: string;
251
267
  }
@@ -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 */\nexport interface MongoConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"mongodb\"\n\n /**\n * Connection url where the connection is performed.\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 * MongoClientOptions\n * Synced with https://mongodb.github.io/node-mongodb-native/5.9/interfaces/MongoClientOptions.html\n */\n\n /**\n * The name of the application that created this MongoClient instance.\n * MongoDB 3.4 and newer will print this value in the server log upon establishing each connection.\n * It is also recorded in the slow query log and profile collections\n */\n readonly appName?: string\n\n /**\n * Specify the authentication mechanism that MongoDB will use to authenticate the connection.\n */\n readonly authMechanism?: string\n\n /**\n * Specify the database name associated with the user’s credentials.\n */\n readonly authSource?: string\n\n /**\n * Optionally enable in-use auto encryption\n */\n readonly autoEncryption?: any\n\n /**\n * Verifies the certificate `cert` is issued to `hostname`.\n */\n readonly checkServerIdentity?: Function\n\n /**\n * An array or comma-delimited string of compressors to enable network\n * compression for communication between this client and a mongod/mongos instance.\n */\n readonly compressors?: string | string[]\n\n /**\n * The time in milliseconds to attempt a connection before timing out.\n */\n readonly connectTimeoutMS?: number\n\n /**\n * Allow a driver to force a Single topology type with a connection string containing one host\n */\n readonly directConnection?: boolean\n\n /**\n * IP family\n */\n readonly family?: number\n\n /**\n * Force server to assign `_id` values instead of driver\n */\n readonly forceServerObjectId?: boolean\n\n /**\n * serialize will not emit undefined fields\n * note that the driver sets this to `false`\n */\n readonly ignoreUndefined?: boolean\n\n /**\n * @deprecated TCP Connection keep alive enabled. Will not be able to turn off in the future.\n */\n readonly keepAlive?: boolean\n\n /**\n * @deprecated The number of milliseconds to wait before initiating keepAlive on the TCP socket.\n * Will not be configurable in the future.\n */\n readonly keepAliveInitialDelay?: number\n\n /**\n * The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.\n */\n readonly localThresholdMS?: number\n\n /**\n * Specifies, in seconds, how stale a secondary can be before the client stops using it for read operations.\n */\n readonly maxStalenessSeconds?: number\n\n /**\n * The minimum number of connections in the connection pool.\n */\n readonly minPoolSize?: number\n\n /**\n * Enable command monitoring for this client\n */\n readonly monitorCommands?: boolean\n\n /**\n * TCP Connection no delay\n */\n readonly noDelay?: boolean\n\n /**\n * A primary key factory function for generation of custom `_id` keys\n */\n readonly pkFactory?: any\n\n /**\n * when deserializing a Binary will return it as a node.js Buffer instance.\n */\n readonly promoteBuffers?: boolean\n\n /**\n * when deserializing a Long will fit it into a Number if it's smaller than 53 bits.\n */\n readonly promoteLongs?: boolean\n\n /**\n * when deserializing will promote BSON values to their Node.js closest equivalent types.\n */\n readonly promoteValues?: boolean\n\n /**\n * Enabling the raw option will return a Node.js Buffer which is allocated using allocUnsafe API\n */\n readonly raw?: boolean\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 * Specifies the read preferences for this connection\n */\n readonly readPreference?: ReadPreference | string\n\n /**\n * Specifies the tags document as a comma-separated list of colon-separated key-value pairs.\n */\n readonly readPreferenceTags?: any[]\n\n /**\n * Specifies the name of the replica set, if the mongod is a member of a replica set.\n */\n readonly replicaSet?: string\n\n /**\n * Enable retryable writes.\n */\n readonly retryWrites?: boolean\n\n /**\n * serialize the javascript functions\n */\n readonly serializeFunctions?: boolean\n\n /**\n * The time in milliseconds to attempt a send or receive on a socket before the attempt times out.\n */\n readonly socketTimeoutMS?: number\n\n /**\n * @deprecated A boolean to enable or disables TLS/SSL for the connection.\n * (The ssl option is equivalent to the {@link tls} option.)\n */\n readonly ssl?: boolean\n\n /**\n * @deprecated SSL Root Certificate file path.\n *\n * Will be removed in the next major version. Please use {@link tlsCAFile} instead.\n */\n readonly sslCA?: string\n\n /**\n * @deprecated SSL Certificate revocation list file path.\n *\n * Will be removed in the next major version.\n */\n readonly sslCRL?: string\n\n /**\n * @deprecated SSL Certificate file path.\n *\n * Will be removed in the next major version. Please use {@link tlsCertificateKeyFile} instead.\n */\n readonly sslCert?: string\n\n /**\n * @deprecated SSL Key file file path.\n *\n * Will be removed in the next major version. Please use {@link tlsCertificateKeyFile} instead.\n */\n readonly sslKey?: string\n\n /**\n * @deprecated SSL Certificate pass phrase.\n *\n * Will be removed in the next major version. Please use {@link tlsCertificateKeyFilePassword} instead.\n */\n readonly sslPass?: string\n\n /**\n * @deprecated Validate mongod server certificate against Certificate Authority\n *\n * Will be removed in the next major version. Please use {@link tlsAllowInvalidCertificates} instead.\n */\n readonly sslValidate?: boolean\n\n /**\n * Enables or disables TLS/SSL for the connection.\n */\n readonly tls?: boolean\n\n /**\n * Bypasses validation of the certificates presented by the mongod/mongos instance\n */\n readonly tlsAllowInvalidCertificates?: boolean\n\n /**\n * Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority.\n */\n readonly tlsCAFile?: string\n\n /**\n * Specifies the location of a local .pem file that contains the client's TLS/SSL certificate and key.\n */\n readonly tlsCertificateKeyFile?: string\n\n /**\n * Specifies the password to de-crypt the {@link tlsCertificateKeyFile}.\n */\n readonly tlsCertificateKeyFilePassword?: string\n\n /**\n * @deprecated The write concern w value\n *\n * Please use the {@link writeConcern} option instead\n */\n readonly w?: string | number\n\n /**\n * A MongoDB WriteConcern, which describes the level of acknowledgement\n * requested from MongoDB for write operations.\n */\n readonly writeConcern?: any\n\n /**\n * @deprecated The write concern timeout\n *\n * Please use the {@link writeConcern} option instead\n */\n readonly wtimeoutMS?: number\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 */\nexport interface MongoConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"mongodb\"\n\n /**\n * Connection url where the connection is performed.\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 * MongoClientOptions\n * Synced with https://mongodb.github.io/node-mongodb-native/5.9/interfaces/MongoClientOptions.html\n */\n\n /**\n * The name of the application that created this MongoClient instance.\n * MongoDB 3.4 and newer will print this value in the server log upon establishing each connection.\n * It is also recorded in the slow query log and profile collections\n */\n readonly appName?: string\n\n /**\n * Specify the authentication mechanism that MongoDB will use to authenticate the connection.\n */\n readonly authMechanism?: string\n\n /**\n * Specify the database name associated with the user’s credentials.\n */\n readonly authSource?: string\n\n /**\n * Optionally enable in-use auto encryption\n */\n readonly autoEncryption?: any\n\n /**\n * Verifies the certificate `cert` is issued to `hostname`.\n */\n readonly checkServerIdentity?: Function\n\n /**\n * An array or comma-delimited string of compressors to enable network\n * compression for communication between this client and a mongod/mongos instance.\n */\n readonly compressors?: string | string[]\n\n /**\n * The time in milliseconds to attempt a connection before timing out.\n */\n readonly connectTimeoutMS?: number\n\n /**\n * Allow a driver to force a Single topology type with a connection string containing one host\n */\n readonly directConnection?: boolean\n\n /**\n * IP family\n */\n readonly family?: number\n\n /**\n * Force server to assign `_id` values instead of driver\n */\n readonly forceServerObjectId?: boolean\n\n /**\n * serialize will not emit undefined fields\n * note that the driver sets this to `false`\n */\n readonly ignoreUndefined?: boolean\n\n /**\n * @deprecated TCP Connection keep alive enabled. Will not be able to turn off in the future.\n */\n readonly keepAlive?: boolean\n\n /**\n * @deprecated The number of milliseconds to wait before initiating keepAlive on the TCP socket.\n * Will not be configurable in the future.\n */\n readonly keepAliveInitialDelay?: number\n\n /**\n * The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.\n */\n readonly localThresholdMS?: number\n\n /**\n * Specifies, in seconds, how stale a secondary can be before the client stops using it for read operations.\n */\n readonly maxStalenessSeconds?: number\n\n /**\n * The minimum number of connections in the connection pool.\n */\n readonly minPoolSize?: number\n\n /**\n * Enable command monitoring for this client\n */\n readonly monitorCommands?: boolean\n\n /**\n * TCP Connection no delay\n */\n readonly noDelay?: boolean\n\n /**\n * A primary key factory function for generation of custom `_id` keys\n */\n readonly pkFactory?: any\n\n /**\n * when deserializing a Binary will return it as a node.js Buffer instance.\n */\n readonly promoteBuffers?: boolean\n\n /**\n * when deserializing a Long will fit it into a Number if it's smaller than 53 bits.\n */\n readonly promoteLongs?: boolean\n\n /**\n * when deserializing will promote BSON values to their Node.js closest equivalent types.\n */\n readonly promoteValues?: boolean\n\n /**\n * Enabling the raw option will return a Node.js Buffer which is allocated using allocUnsafe API\n */\n readonly raw?: boolean\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 * Specifies the read preferences for this connection\n */\n readonly readPreference?: ReadPreference | string\n\n /**\n * Specifies the tags document as a comma-separated list of colon-separated key-value pairs.\n */\n readonly readPreferenceTags?: any[]\n\n /**\n * Specifies the name of the replica set, if the mongod is a member of a replica set.\n */\n readonly replicaSet?: string\n\n /**\n * Enable retryable writes.\n */\n readonly retryWrites?: boolean\n\n /**\n * serialize the javascript functions\n */\n readonly serializeFunctions?: boolean\n\n /**\n * The time in milliseconds to attempt a send or receive on a socket before the attempt times out.\n */\n readonly socketTimeoutMS?: number\n\n /**\n * @deprecated A boolean to enable or disables TLS/SSL for the connection.\n * (The ssl option is equivalent to the {@link tls} option.)\n */\n readonly ssl?: boolean\n\n /**\n * @deprecated SSL Root Certificate file path.\n *\n * Will be removed in the next major version. Please use {@link tlsCAFile} instead.\n */\n readonly sslCA?: string\n\n /**\n * @deprecated SSL Certificate revocation list file path.\n *\n * Will be removed in the next major version.\n */\n readonly sslCRL?: string\n\n /**\n * @deprecated SSL Certificate file path.\n *\n * Will be removed in the next major version. Please use {@link tlsCertificateKeyFile} instead.\n */\n readonly sslCert?: string\n\n /**\n * @deprecated SSL Key file file path.\n *\n * Will be removed in the next major version. Please use {@link tlsCertificateKeyFile} instead.\n */\n readonly sslKey?: string\n\n /**\n * @deprecated SSL Certificate pass phrase.\n *\n * Will be removed in the next major version. Please use {@link tlsCertificateKeyFilePassword} instead.\n */\n readonly sslPass?: string\n\n /**\n * @deprecated Validate mongod server certificate against Certificate Authority\n *\n * Will be removed in the next major version. Please use {@link tlsAllowInvalidCertificates} instead.\n */\n readonly sslValidate?: boolean\n\n /**\n * Enables or disables TLS/SSL for the connection.\n */\n readonly tls?: boolean\n\n /**\n * Bypasses validation of the certificates presented by the mongod/mongos instance\n */\n readonly tlsAllowInvalidCertificates?: boolean\n\n /**\n * Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority.\n */\n readonly tlsCAFile?: string\n\n /**\n * Specifies the location of a local .pem file that contains the client's TLS/SSL certificate and key.\n */\n readonly tlsCertificateKeyFile?: string\n\n /**\n * Specifies the password to de-crypt the {@link tlsCertificateKeyFile}.\n */\n readonly tlsCertificateKeyFilePassword?: string\n\n /**\n * @deprecated The write concern w value\n *\n * Please use the {@link writeConcern} option instead\n */\n readonly w?: string | number\n\n /**\n * A MongoDB WriteConcern, which describes the level of acknowledgement\n * requested from MongoDB for write operations.\n */\n readonly writeConcern?: any\n\n /**\n * @deprecated The write concern timeout\n *\n * Please use the {@link writeConcern} option instead\n */\n readonly wtimeoutMS?: number\n\n /**\n * Configures a Socks5 proxy host used for creating TCP connections.\n */\n readonly proxyHost?: string\n\n /**\n * Configures a Socks5 proxy port used for creating TCP connections.\n */\n readonly proxyPort?: number\n\n /**\n * Configures a Socks5 proxy username when the proxy in proxyHost requires username/password authentication.\n */\n readonly proxyUsername?: string\n\n /**\n * Configures a Socks5 proxy password when the proxy in proxyHost requires username/password authentication.\n */\n readonly proxyPassword?: string\n}\n"],"sourceRoot":"../.."}
@@ -133,6 +133,11 @@ export class MongoDriver {
133
133
  "w",
134
134
  "writeConcern",
135
135
  "wtimeoutMS",
136
+ // Proxy configuration for Socks5
137
+ "proxyHost",
138
+ "proxyPort",
139
+ "proxyUsername",
140
+ "proxyPassword",
136
141
  // Undocumented deprecated options
137
142
  // todo: remove next major version
138
143
  "appname",
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/mongodb/MongoDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAK5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAK5E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D;;GAEG;AACH,MAAM,OAAO,WAAW;IAwLpB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QA9J5C;;WAEG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;WAEG;QACH,gBAAW,GAAG,KAAK,CAAA;QAEnB;;WAEG;QACH,uBAAkB,GAAG,MAAe,CAAA;QAEpC;;WAEG;QACH,uBAAkB,GAAiB,EAAE,CAAA;QAOrC;;WAEG;QACH,iBAAY,GAAiB,EAAE,CAAA;QAE/B;;WAEG;QACH,0BAAqB,GAAiB,EAAE,CAAA;QAExC;;WAEG;QACH,6BAAwB,GAAiB,EAAE,CAAA;QAE3C;;WAEG;QACH,yBAAoB,GAAiB,EAAE,CAAA;QAEvC;;WAEG;QACH,oBAAe,GAAsB;YACjC,UAAU,EAAE,KAAK;YACjB,iBAAiB,EAAE,EAAE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AAgB,GAAG,GAAG,aAAa,MAAM,kBAAkB,GACvD,OAAO,CAAC,cAAc;gBACtB,OAAO,CAAC,IAAI,GAAG,WAAW;gBAC1B,WAAW,GAAG,WAClB,IAAI,OAAO,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAA;QAChC,CAAC;aAAM,CAAC;YACJ,gBAAgB,GAAG,GAAG,aAAa,MAAM,kBAAkB,GACvD,OAAO,CAAC,IAAI,IAAI,WACpB,GAAG,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAA;QAC9C,CAAC;QAED,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED;;OAEG;IACO,sBAAsB,CAAC,OAA+B;QAC5D,MAAM,YAAY,GAAQ,EAAE,CAAA;QAE5B,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC7C,IAAI,UAAU,IAAI,OAAO,EAAE,CAAC;gBACxB,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;YAClD,CAAC;QACL,CAAC;QAED,YAAY,CAAC,UAAU,GAAG;YACtB,IAAI,EAAE,SAAS;SAClB,CAAA;QAED,IAAI,UAAU,IAAI,OAAO,EAAE,CAAC;YACxB,YAAY,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;QACrD,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QAE1C,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ","file":"MongoDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { MongoQueryRunner } from \"./MongoQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source/DataSource\"\nimport { MongoConnectionOptions } from \"./MongoConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { MongoSchemaBuilder } from \"../../schema-builder/MongoSchemaBuilder\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { DataSourceOptions } from \"../../data-source/DataSourceOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { ObjectUtils } from \"../../util/ObjectUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with MongoDB.\n */\nexport class MongoDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Underlying mongodb library.\n */\n mongodb: any\n\n /**\n * Mongodb does not require to dynamically create query runner each time,\n * because it does not have a regular connection pool as RDBMS systems have.\n */\n queryRunner?: MongoQueryRunner\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: MongoConnectionOptions\n\n /**\n * Master database used to perform all write queries.\n */\n database?: 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 = false\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"none\" as const\n\n /**\n * Mongodb does not need to have column types because they are not used in schema sync.\n */\n supportedDataTypes: ColumnType[] = []\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[]\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = []\n\n /**\n * Mongodb does not need to have a strong defined mapped column types because they are not used in schema sync.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"int\",\n createDateDefault: \"\",\n updateDate: \"int\",\n updateDateDefault: \"\",\n deleteDate: \"int\",\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"int\",\n migrationTimestamp: \"int\",\n cacheId: \"int\",\n cacheIdentifier: \"int\",\n cacheTime: \"int\",\n cacheDuration: \"int\",\n cacheQuery: \"int\",\n cacheResult: \"int\",\n metadataType: \"int\",\n metadataDatabase: \"int\",\n metadataSchema: \"int\",\n metadataTable: \"int\",\n metadataName: \"int\",\n metadataValue: \"int\",\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\n /**\n * No documentation specifying a maximum length for identifiers could be found\n * for MongoDB.\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep in sync with MongoConnectionOptions\n */\n protected validOptionNames: string[] = [\n \"appName\",\n \"authMechanism\",\n \"authSource\",\n \"autoEncryption\",\n \"checkServerIdentity\",\n \"compressors\",\n \"connectTimeoutMS\",\n \"directConnection\",\n \"family\",\n \"forceServerObjectId\",\n \"ignoreUndefined\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"localThresholdMS\",\n \"maxStalenessSeconds\",\n \"minPoolSize\",\n \"monitorCommands\",\n \"noDelay\",\n \"pkFactory\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"promoteValues\",\n \"raw\",\n \"readConcern\",\n \"readPreference\",\n \"readPreferenceTags\",\n \"replicaSet\",\n \"retryWrites\",\n \"serializeFunctions\",\n \"socketTimeoutMS\",\n \"ssl\",\n \"sslCA\",\n \"sslCRL\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslValidate\",\n \"tls\",\n \"tlsAllowInvalidCertificates\",\n \"tlsCAFile\",\n \"tlsCertificateKeyFile\",\n \"tlsCertificateKeyFilePassword\",\n \"w\",\n \"writeConcern\",\n \"wtimeoutMS\",\n // Undocumented deprecated options\n // todo: remove next major version\n \"appname\",\n \"fsync\",\n \"j\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"wtimeout\",\n ]\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n this.options = connection.options as MongoConnectionOptions\n\n // validate options to make sure everything is correct and driver will be able to establish connection\n this.validateOptions(connection.options)\n\n // load mongodb package\n this.loadDependencies()\n\n this.database = DriverUtils.buildMongoDBDriverOptions(\n this.options,\n ).database\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n const options = DriverUtils.buildMongoDBDriverOptions(this.options)\n\n const client = await this.mongodb.MongoClient.connect(\n this.buildConnectionUrl(options),\n this.buildConnectionOptions(options),\n )\n\n this.queryRunner = new MongoQueryRunner(this.connection, client)\n ObjectUtils.assign(this.queryRunner, {\n manager: this.connection.manager,\n })\n }\n\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {\n const queryRunner = this.queryRunner\n if (!queryRunner) {\n throw new ConnectionIsNotSetError(\"mongodb\")\n }\n\n this.queryRunner = undefined\n await queryRunner.databaseConnection.close()\n }\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new MongoSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return this.queryRunner!\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 throw new TypeORMError(\n `This operation is not supported by Mongodb driver.`,\n )\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return columnName\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n return tableName\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 ): { tableName: string; schema?: string; database?: string } {\n if (InstanceChecker.isEntityMetadata(target)) {\n return {\n tableName: target.tableName,\n }\n }\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n return {\n tableName: target.name,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n return {\n tableName: target.referencedTableName,\n }\n }\n\n return {\n tableName: target,\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n 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 (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type?: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertedId: any) {\n return metadata.objectIdColumn!.createValueMap(insertedId)\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 throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Validate driver options to make sure everything is correct and driver will be able to establish connection.\n */\n protected validateOptions(options: DataSourceOptions) {\n // todo: fix\n // if (!options.url) {\n // if (!options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // }\n }\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): any {\n try {\n const mongodb = this.options.driver || PlatformTools.load(\"mongodb\")\n this.mongodb = mongodb\n } catch (e) {\n throw new DriverPackageNotInstalledError(\"MongoDB\", \"mongodb\")\n }\n }\n\n /**\n * Builds connection url that is passed to underlying driver to perform connection to the mongodb database.\n */\n protected buildConnectionUrl(options: { [key: string]: any }): string {\n const schemaUrlPart = options.type.toLowerCase()\n const credentialsUrlPart =\n options.username && options.password\n ? `${encodeURIComponent(options.username)}:${encodeURIComponent(\n options.password,\n )}@`\n : \"\"\n\n const portUrlPart =\n schemaUrlPart === \"mongodb+srv\" ? \"\" : `:${options.port || \"27017\"}`\n\n let connectionString: string\n if (options.replicaSet) {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.hostReplicaSet ||\n options.host + portUrlPart ||\n \"127.0.0.1\" + portUrlPart\n }/${options.database || \"\"}`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}`\n }\n\n return connectionString\n }\n\n /**\n * Build connection options from MongoConnectionOptions\n */\n protected buildConnectionOptions(options: { [key: string]: any }): any {\n const mongoOptions: any = {}\n\n for (const optionName of this.validOptionNames) {\n if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n mongoOptions.driverInfo = {\n name: \"TypeORM\",\n }\n\n if (\"poolSize\" in options) {\n mongoOptions[\"maxPoolSize\"] = options[\"poolSize\"]\n }\n\n Object.assign(mongoOptions, options.extra)\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/mongodb/MongoDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAK5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAK5E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D;;GAEG;AACH,MAAM,OAAO,WAAW;IA6LpB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAnK5C;;WAEG;QACH,iBAAY,GAAY,KAAK,CAAA;QAE7B;;WAEG;QACH,gBAAW,GAAG,KAAK,CAAA;QAEnB;;WAEG;QACH,uBAAkB,GAAG,MAAe,CAAA;QAEpC;;WAEG;QACH,uBAAkB,GAAiB,EAAE,CAAA;QAOrC;;WAEG;QACH,iBAAY,GAAiB,EAAE,CAAA;QAE/B;;WAEG;QACH,0BAAqB,GAAiB,EAAE,CAAA;QAExC;;WAEG;QACH,6BAAwB,GAAiB,EAAE,CAAA;QAE3C;;WAEG;QACH,yBAAoB,GAAiB,EAAE,CAAA;QAEvC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C,CAAC,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,EAAE,CAAA;QAExE,IAAI,gBAAwB,CAAA;QAC5B,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACrB,gBAAgB,GAAG,GAAG,aAAa,MAAM,kBAAkB,GACvD,OAAO,CAAC,cAAc;gBACtB,OAAO,CAAC,IAAI,GAAG,WAAW;gBAC1B,WAAW,GAAG,WAClB,IAAI,OAAO,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAA;QAChC,CAAC;aAAM,CAAC;YACJ,gBAAgB,GAAG,GAAG,aAAa,MAAM,kBAAkB,GACvD,OAAO,CAAC,IAAI,IAAI,WACpB,GAAG,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAA;QAC9C,CAAC;QAED,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED;;OAEG;IACO,sBAAsB,CAAC,OAA+B;QAC5D,MAAM,YAAY,GAAQ,EAAE,CAAA;QAE5B,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC7C,IAAI,UAAU,IAAI,OAAO,EAAE,CAAC;gBACxB,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;YAClD,CAAC;QACL,CAAC;QAED,YAAY,CAAC,UAAU,GAAG;YACtB,IAAI,EAAE,SAAS;SAClB,CAAA;QAED,IAAI,UAAU,IAAI,OAAO,EAAE,CAAC;YACxB,YAAY,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;QACrD,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QAE1C,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ","file":"MongoDriver.js","sourcesContent":["import { Driver } from \"../Driver\"\nimport { ConnectionIsNotSetError } from \"../../error/ConnectionIsNotSetError\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { MongoQueryRunner } from \"./MongoQueryRunner\"\nimport { ObjectLiteral } from \"../../common/ObjectLiteral\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { DataSource } from \"../../data-source/DataSource\"\nimport { MongoConnectionOptions } from \"./MongoConnectionOptions\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { ColumnType } from \"../types/ColumnTypes\"\nimport { MongoSchemaBuilder } from \"../../schema-builder/MongoSchemaBuilder\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { TableColumn } from \"../../schema-builder/table/TableColumn\"\nimport { DataSourceOptions } from \"../../data-source/DataSourceOptions\"\nimport { EntityMetadata } from \"../../metadata/EntityMetadata\"\nimport { ObjectUtils } from \"../../util/ObjectUtils\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { TypeORMError } from \"../../error\"\nimport { Table } from \"../../schema-builder/table/Table\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { TableForeignKey } from \"../../schema-builder/table/TableForeignKey\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with MongoDB.\n */\nexport class MongoDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Underlying mongodb library.\n */\n mongodb: any\n\n /**\n * Mongodb does not require to dynamically create query runner each time,\n * because it does not have a regular connection pool as RDBMS systems have.\n */\n queryRunner?: MongoQueryRunner\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: MongoConnectionOptions\n\n /**\n * Master database used to perform all write queries.\n */\n database?: 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 = false\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"none\" as const\n\n /**\n * Mongodb does not need to have column types because they are not used in schema sync.\n */\n supportedDataTypes: ColumnType[] = []\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[]\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = []\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = []\n\n /**\n * Mongodb does not need to have a strong defined mapped column types because they are not used in schema sync.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"int\",\n createDateDefault: \"\",\n updateDate: \"int\",\n updateDateDefault: \"\",\n deleteDate: \"int\",\n deleteDateNullable: true,\n version: \"int\",\n treeLevel: \"int\",\n migrationId: \"int\",\n migrationName: \"int\",\n migrationTimestamp: \"int\",\n cacheId: \"int\",\n cacheIdentifier: \"int\",\n cacheTime: \"int\",\n cacheDuration: \"int\",\n cacheQuery: \"int\",\n cacheResult: \"int\",\n metadataType: \"int\",\n metadataDatabase: \"int\",\n metadataSchema: \"int\",\n metadataTable: \"int\",\n metadataName: \"int\",\n metadataValue: \"int\",\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\n /**\n * No documentation specifying a maximum length for identifiers could be found\n * for MongoDB.\n */\n maxAliasLength?: number\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\n }\n\n // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep in sync with MongoConnectionOptions\n */\n protected validOptionNames: string[] = [\n \"appName\",\n \"authMechanism\",\n \"authSource\",\n \"autoEncryption\",\n \"checkServerIdentity\",\n \"compressors\",\n \"connectTimeoutMS\",\n \"directConnection\",\n \"family\",\n \"forceServerObjectId\",\n \"ignoreUndefined\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"localThresholdMS\",\n \"maxStalenessSeconds\",\n \"minPoolSize\",\n \"monitorCommands\",\n \"noDelay\",\n \"pkFactory\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"promoteValues\",\n \"raw\",\n \"readConcern\",\n \"readPreference\",\n \"readPreferenceTags\",\n \"replicaSet\",\n \"retryWrites\",\n \"serializeFunctions\",\n \"socketTimeoutMS\",\n \"ssl\",\n \"sslCA\",\n \"sslCRL\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslValidate\",\n \"tls\",\n \"tlsAllowInvalidCertificates\",\n \"tlsCAFile\",\n \"tlsCertificateKeyFile\",\n \"tlsCertificateKeyFilePassword\",\n \"w\",\n \"writeConcern\",\n \"wtimeoutMS\",\n // Proxy configuration for Socks5\n \"proxyHost\",\n \"proxyPort\",\n \"proxyUsername\",\n \"proxyPassword\",\n // Undocumented deprecated options\n // todo: remove next major version\n \"appname\",\n \"fsync\",\n \"j\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"wtimeout\",\n ]\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected connection: DataSource) {\n this.options = connection.options as MongoConnectionOptions\n\n // validate options to make sure everything is correct and driver will be able to establish connection\n this.validateOptions(connection.options)\n\n // load mongodb package\n this.loadDependencies()\n\n this.database = DriverUtils.buildMongoDBDriverOptions(\n this.options,\n ).database\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n */\n async connect(): Promise<void> {\n const options = DriverUtils.buildMongoDBDriverOptions(this.options)\n\n const client = await this.mongodb.MongoClient.connect(\n this.buildConnectionUrl(options),\n this.buildConnectionOptions(options),\n )\n\n this.queryRunner = new MongoQueryRunner(this.connection, client)\n ObjectUtils.assign(this.queryRunner, {\n manager: this.connection.manager,\n })\n }\n\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {\n const queryRunner = this.queryRunner\n if (!queryRunner) {\n throw new ConnectionIsNotSetError(\"mongodb\")\n }\n\n this.queryRunner = undefined\n await queryRunner.databaseConnection.close()\n }\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new MongoSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return this.queryRunner!\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 throw new TypeORMError(\n `This operation is not supported by Mongodb driver.`,\n )\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return columnName\n }\n\n /**\n * Build full table name with database name, schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(\n tableName: string,\n schema?: string,\n database?: string,\n ): string {\n return tableName\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 ): { tableName: string; schema?: string; database?: string } {\n if (InstanceChecker.isEntityMetadata(target)) {\n return {\n tableName: target.tableName,\n }\n }\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n return {\n tableName: target.name,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n return {\n tableName: target.referencedTableName,\n }\n }\n\n return {\n tableName: target,\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n 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 (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type?: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Calculates column length taking into account the default length values.\n */\n getColumnLength(column: ColumnMetadata): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n createFullType(column: TableColumn): string {\n throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n return Promise.resolve()\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertedId: any) {\n return metadata.objectIdColumn!.createValueMap(insertedId)\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 throw new TypeORMError(\n `MongoDB is schema-less, not supported by this driver.`,\n )\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return false\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Validate driver options to make sure everything is correct and driver will be able to establish connection.\n */\n protected validateOptions(options: DataSourceOptions) {\n // todo: fix\n // if (!options.url) {\n // if (!options.database)\n // throw new DriverOptionNotSetError(\"database\");\n // }\n }\n\n /**\n * Loads all driver dependencies.\n */\n protected loadDependencies(): any {\n try {\n const mongodb = this.options.driver || PlatformTools.load(\"mongodb\")\n this.mongodb = mongodb\n } catch (e) {\n throw new DriverPackageNotInstalledError(\"MongoDB\", \"mongodb\")\n }\n }\n\n /**\n * Builds connection url that is passed to underlying driver to perform connection to the mongodb database.\n */\n protected buildConnectionUrl(options: { [key: string]: any }): string {\n const schemaUrlPart = options.type.toLowerCase()\n const credentialsUrlPart =\n options.username && options.password\n ? `${encodeURIComponent(options.username)}:${encodeURIComponent(\n options.password,\n )}@`\n : \"\"\n\n const portUrlPart =\n schemaUrlPart === \"mongodb+srv\" ? \"\" : `:${options.port || \"27017\"}`\n\n let connectionString: string\n if (options.replicaSet) {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.hostReplicaSet ||\n options.host + portUrlPart ||\n \"127.0.0.1\" + portUrlPart\n }/${options.database || \"\"}`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}`\n }\n\n return connectionString\n }\n\n /**\n * Build connection options from MongoConnectionOptions\n */\n protected buildConnectionOptions(options: { [key: string]: any }): any {\n const mongoOptions: any = {}\n\n for (const optionName of this.validOptionNames) {\n if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n mongoOptions.driverInfo = {\n name: \"TypeORM\",\n }\n\n if (\"poolSize\" in options) {\n mongoOptions[\"maxPoolSize\"] = options[\"poolSize\"]\n }\n\n Object.assign(mongoOptions, options.extra)\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Content of this file below the imports is a copy of mongodb.d.ts from the version of mongodb package
3
+ * listed in package.json:devDependencies. We disabled eslint for this file, since it does not come from us
4
+ * and does not necessary have to adhere to our rules.
5
+ */
1
6
  import type { SrvRecord } from "dns";
2
7
  import type { Socket, TcpNetConnectOpts } from "net";
3
8
  import type { ConnectionOptions as ConnectionOptions_2, TLSSocket, TLSSocketOptions } from "tls";