typeorm 0.3.15 → 0.3.16-dev.e0165e7

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.
@@ -38,6 +38,10 @@ export interface MongoConnectionOptions extends BaseDataSourceOptions {
38
38
  * Database name to connect to.
39
39
  */
40
40
  readonly database?: string;
41
+ /**
42
+ * Specifies whether to force dispatch all operations to the specified host. Default: false
43
+ */
44
+ readonly directConnection?: boolean;
41
45
  /**
42
46
  * The driver object
43
47
  * This defaults to require("mongodb")
@@ -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 * 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 * Specifies whether to force dispatch all operations to the specified host. Default: false\n */\n readonly directConnection?: boolean\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":"../.."}
@@ -148,6 +148,7 @@ export class MongoDriver {
148
148
  "useUnifiedTopology",
149
149
  "autoEncryption",
150
150
  "retryWrites",
151
+ "directConnection",
151
152
  ];
152
153
  this.cteCapabilities = {
153
154
  enabled: false,
@@ -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,wBAAw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G,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAChC,EAAE,CAAA;SACL;QAED,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED;;OAEG;IACO,sBAAsB,CAAC,OAA+B;QAC5D,MAAM,YAAY,GAAQ,EAAE,CAAA;QAE5B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;YAE/C,IAAI,OAAO,CAAC,KAAK,IAAI,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE;gBAC9C,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;aACvD;iBAAM,IAAI,UAAU,IAAI,OAAO,EAAE;gBAC9B,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;aACjD;SACJ;QAED,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 // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep sync with MongoConnectionOptions\n * Sync with http://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html\n */\n protected validOptionNames: string[] = [\n \"poolSize\",\n \"ssl\",\n \"sslValidate\",\n \"sslCA\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslCRL\",\n \"autoReconnect\",\n \"noDelay\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"connectTimeoutMS\",\n \"family\",\n \"socketTimeoutMS\",\n \"reconnectTries\",\n \"reconnectInterval\",\n \"ha\",\n \"haInterval\",\n \"replicaSet\",\n \"secondaryAcceptableLatencyMS\",\n \"acceptableLatencyMS\",\n \"connectWithNoPrimary\",\n \"authSource\",\n \"w\",\n \"wtimeout\",\n \"j\",\n \"writeConcern\",\n \"forceServerObjectId\",\n \"serializeFunctions\",\n \"ignoreUndefined\",\n \"raw\",\n \"bufferMaxEntries\",\n \"readPreference\",\n \"pkFactory\",\n \"promiseLibrary\",\n \"readConcern\",\n \"maxStalenessSeconds\",\n \"loggerLevel\",\n // Do not overwrite BaseDataSourceOptions.logger\n // \"logger\",\n \"promoteValues\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"domainsEnabled\",\n \"checkServerIdentity\",\n \"validateOptions\",\n \"appname\",\n // omit auth - we are building url from username and password\n // \"auth\"\n \"authMechanism\",\n \"compression\",\n \"fsync\",\n \"readPreferenceTags\",\n \"numberOfRetries\",\n \"auto_reconnect\",\n \"minSize\",\n \"monitorCommands\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"autoEncryption\",\n \"retryWrites\",\n ]\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\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 if (!this.queryRunner) throw new ConnectionIsNotSetError(\"mongodb\")\n // const handler = (err: any) => (err ? fail(err) : ok())\n this.queryRunner.databaseConnection.close()\n this.queryRunner = undefined\n // return ok()\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 ? `${options.username}:${options.password}@`\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 || \"\"}?replicaSet=${options.replicaSet}${\n options.tls ? \"&tls=true\" : \"\"\n }`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}${\n options.tls ? \"?tls=true\" : \"\"\n }`\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 (let index = 0; index < this.validOptionNames.length; index++) {\n const optionName = this.validOptionNames[index]\n\n if (options.extra && optionName in options.extra) {\n mongoOptions[optionName] = options.extra[optionName]\n } else if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\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;IAmMpB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAzK5C;;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;YACr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pB,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,OAAO,CAAC,UAAU,GACvD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAChC,EAAE,CAAA;SACL;aAAM;YACH,gBAAgB,GAAG,GAAG,aAAa,MAAM,kBAAkB,GACvD,OAAO,CAAC,IAAI,IAAI,WACpB,GAAG,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,EAAE,GACpC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAChC,EAAE,CAAA;SACL;QAED,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED;;OAEG;IACO,sBAAsB,CAAC,OAA+B;QAC5D,MAAM,YAAY,GAAQ,EAAE,CAAA;QAE5B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;YAE/C,IAAI,OAAO,CAAC,KAAK,IAAI,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE;gBAC9C,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;aACvD;iBAAM,IAAI,UAAU,IAAI,OAAO,EAAE;gBAC9B,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;aACjD;SACJ;QAED,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 // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep sync with MongoConnectionOptions\n * Sync with http://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html\n */\n protected validOptionNames: string[] = [\n \"poolSize\",\n \"ssl\",\n \"sslValidate\",\n \"sslCA\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslCRL\",\n \"autoReconnect\",\n \"noDelay\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"connectTimeoutMS\",\n \"family\",\n \"socketTimeoutMS\",\n \"reconnectTries\",\n \"reconnectInterval\",\n \"ha\",\n \"haInterval\",\n \"replicaSet\",\n \"secondaryAcceptableLatencyMS\",\n \"acceptableLatencyMS\",\n \"connectWithNoPrimary\",\n \"authSource\",\n \"w\",\n \"wtimeout\",\n \"j\",\n \"writeConcern\",\n \"forceServerObjectId\",\n \"serializeFunctions\",\n \"ignoreUndefined\",\n \"raw\",\n \"bufferMaxEntries\",\n \"readPreference\",\n \"pkFactory\",\n \"promiseLibrary\",\n \"readConcern\",\n \"maxStalenessSeconds\",\n \"loggerLevel\",\n // Do not overwrite BaseDataSourceOptions.logger\n // \"logger\",\n \"promoteValues\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"domainsEnabled\",\n \"checkServerIdentity\",\n \"validateOptions\",\n \"appname\",\n // omit auth - we are building url from username and password\n // \"auth\"\n \"authMechanism\",\n \"compression\",\n \"fsync\",\n \"readPreferenceTags\",\n \"numberOfRetries\",\n \"auto_reconnect\",\n \"minSize\",\n \"monitorCommands\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"autoEncryption\",\n \"retryWrites\",\n \"directConnection\",\n ]\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\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 if (!this.queryRunner) throw new ConnectionIsNotSetError(\"mongodb\")\n // const handler = (err: any) => (err ? fail(err) : ok())\n this.queryRunner.databaseConnection.close()\n this.queryRunner = undefined\n // return ok()\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 ? `${options.username}:${options.password}@`\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 || \"\"}?replicaSet=${options.replicaSet}${\n options.tls ? \"&tls=true\" : \"\"\n }`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}${\n options.tls ? \"?tls=true\" : \"\"\n }`\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 (let index = 0; index < this.validOptionNames.length; index++) {\n const optionName = this.validOptionNames[index]\n\n if (options.extra && optionName in options.extra) {\n mongoOptions[optionName] = options.extra[optionName]\n } else if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
@@ -38,6 +38,10 @@ export interface MongoConnectionOptions extends BaseDataSourceOptions {
38
38
  * Database name to connect to.
39
39
  */
40
40
  readonly database?: string;
41
+ /**
42
+ * Specifies whether to force dispatch all operations to the specified host. Default: false
43
+ */
44
+ readonly directConnection?: boolean;
41
45
  /**
42
46
  * The driver object
43
47
  * This defaults to require("mongodb")
@@ -1 +1 @@
1
- {"version":3,"sources":["../../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":"../.."}
1
+ {"version":3,"sources":["../../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 * Specifies whether to force dispatch all operations to the specified host. Default: false\n */\n readonly directConnection?: boolean\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":"../.."}
@@ -151,6 +151,7 @@ class MongoDriver {
151
151
  "useUnifiedTopology",
152
152
  "autoEncryption",
153
153
  "retryWrites",
154
+ "directConnection",
154
155
  ];
155
156
  this.cteCapabilities = {
156
157
  enabled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I,EAAE,GACpC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAChC,EAAE,CAAA;SACL;QAED,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED;;OAEG;IACO,sBAAsB,CAAC,OAA+B;QAC5D,MAAM,YAAY,GAAQ,EAAE,CAAA;QAE5B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;YAE/C,IAAI,OAAO,CAAC,KAAK,IAAI,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE;gBAC9C,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;aACvD;iBAAM,IAAI,UAAU,IAAI,OAAO,EAAE;gBAC9B,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;aACjD;SACJ;QAED,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ;AA9hBD,kCA8hBC","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 // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep sync with MongoConnectionOptions\n * Sync with http://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html\n */\n protected validOptionNames: string[] = [\n \"poolSize\",\n \"ssl\",\n \"sslValidate\",\n \"sslCA\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslCRL\",\n \"autoReconnect\",\n \"noDelay\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"connectTimeoutMS\",\n \"family\",\n \"socketTimeoutMS\",\n \"reconnectTries\",\n \"reconnectInterval\",\n \"ha\",\n \"haInterval\",\n \"replicaSet\",\n \"secondaryAcceptableLatencyMS\",\n \"acceptableLatencyMS\",\n \"connectWithNoPrimary\",\n \"authSource\",\n \"w\",\n \"wtimeout\",\n \"j\",\n \"writeConcern\",\n \"forceServerObjectId\",\n \"serializeFunctions\",\n \"ignoreUndefined\",\n \"raw\",\n \"bufferMaxEntries\",\n \"readPreference\",\n \"pkFactory\",\n \"promiseLibrary\",\n \"readConcern\",\n \"maxStalenessSeconds\",\n \"loggerLevel\",\n // Do not overwrite BaseDataSourceOptions.logger\n // \"logger\",\n \"promoteValues\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"domainsEnabled\",\n \"checkServerIdentity\",\n \"validateOptions\",\n \"appname\",\n // omit auth - we are building url from username and password\n // \"auth\"\n \"authMechanism\",\n \"compression\",\n \"fsync\",\n \"readPreferenceTags\",\n \"numberOfRetries\",\n \"auto_reconnect\",\n \"minSize\",\n \"monitorCommands\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"autoEncryption\",\n \"retryWrites\",\n ]\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\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 if (!this.queryRunner) throw new ConnectionIsNotSetError(\"mongodb\")\n // const handler = (err: any) => (err ? fail(err) : ok())\n this.queryRunner.databaseConnection.close()\n this.queryRunner = undefined\n // return ok()\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 ? `${options.username}:${options.password}@`\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 || \"\"}?replicaSet=${options.replicaSet}${\n options.tls ? \"&tls=true\" : \"\"\n }`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}${\n options.tls ? \"?tls=true\" : \"\"\n }`\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 (let index = 0; index < this.validOptionNames.length; index++) {\n const optionName = this.validOptionNames[index]\n\n if (options.extra && optionName in options.extra) {\n mongoOptions[optionName] = options.extra[optionName]\n } else if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../../src/driver/mongodb/MongoDriver.ts"],"names":[],"mappings":";;;AACA,iFAA6E;AAC7E,+FAA2F;AAE3F,yDAAqD;AAGrD,gEAA4D;AAK5D,gFAA4E;AAK5E,wDAAoD;AACpD,8EAA0E;AAE1E,gDAA4C;AAC5C,uCAA0C;AAI1C,gEAA4D;AAG5D;;GAEG;AACH,MAAa,WAAW;IAmMpB,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,YAAsB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAzK5C;;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;YACrB,UAAU,EAAE,KAAK;YACjB,iBAAiB,EAAE,EAAE;YACrB,UAAU,EAAE,KAAK;YACjB,kBAAkB,EAAE,IAAI;YACxB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,KAAK;YAChB,WAAW,EAAE,KAAK;YAClB,aAAa,EAAE,KAAK;YACpB,kBAAkB,EAAE,KAAK;YACzB,OAAO,EAAE,KAAK;YACd,eAAe,EAAE,KAAK;YACtB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,KAAK;YACpB,UAAU,EA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AG,aAAa,MAAM,kBAAkB,GACvD,OAAO,CAAC,IAAI,IAAI,WACpB,GAAG,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,EAAE,GACpC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAChC,EAAE,CAAA;SACL;QAED,OAAO,gBAAgB,CAAA;IAC3B,CAAC;IAED;;OAEG;IACO,sBAAsB,CAAC,OAA+B;QAC5D,MAAM,YAAY,GAAQ,EAAE,CAAA;QAE5B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;YAE/C,IAAI,OAAO,CAAC,KAAK,IAAI,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE;gBAC9C,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;aACvD;iBAAM,IAAI,UAAU,IAAI,OAAO,EAAE;gBAC9B,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;aACjD;SACJ;QAED,OAAO,YAAY,CAAA;IACvB,CAAC;CACJ;AA/hBD,kCA+hBC","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 // -------------------------------------------------------------------------\n // Protected Properties\n // -------------------------------------------------------------------------\n\n /**\n * Valid mongo connection options\n * NOTE: Keep sync with MongoConnectionOptions\n * Sync with http://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html\n */\n protected validOptionNames: string[] = [\n \"poolSize\",\n \"ssl\",\n \"sslValidate\",\n \"sslCA\",\n \"sslCert\",\n \"sslKey\",\n \"sslPass\",\n \"sslCRL\",\n \"autoReconnect\",\n \"noDelay\",\n \"keepAlive\",\n \"keepAliveInitialDelay\",\n \"connectTimeoutMS\",\n \"family\",\n \"socketTimeoutMS\",\n \"reconnectTries\",\n \"reconnectInterval\",\n \"ha\",\n \"haInterval\",\n \"replicaSet\",\n \"secondaryAcceptableLatencyMS\",\n \"acceptableLatencyMS\",\n \"connectWithNoPrimary\",\n \"authSource\",\n \"w\",\n \"wtimeout\",\n \"j\",\n \"writeConcern\",\n \"forceServerObjectId\",\n \"serializeFunctions\",\n \"ignoreUndefined\",\n \"raw\",\n \"bufferMaxEntries\",\n \"readPreference\",\n \"pkFactory\",\n \"promiseLibrary\",\n \"readConcern\",\n \"maxStalenessSeconds\",\n \"loggerLevel\",\n // Do not overwrite BaseDataSourceOptions.logger\n // \"logger\",\n \"promoteValues\",\n \"promoteBuffers\",\n \"promoteLongs\",\n \"domainsEnabled\",\n \"checkServerIdentity\",\n \"validateOptions\",\n \"appname\",\n // omit auth - we are building url from username and password\n // \"auth\"\n \"authMechanism\",\n \"compression\",\n \"fsync\",\n \"readPreferenceTags\",\n \"numberOfRetries\",\n \"auto_reconnect\",\n \"minSize\",\n \"monitorCommands\",\n \"useNewUrlParser\",\n \"useUnifiedTopology\",\n \"autoEncryption\",\n \"retryWrites\",\n \"directConnection\",\n ]\n\n cteCapabilities: CteCapabilities = {\n enabled: false,\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 if (!this.queryRunner) throw new ConnectionIsNotSetError(\"mongodb\")\n // const handler = (err: any) => (err ? fail(err) : ok())\n this.queryRunner.databaseConnection.close()\n this.queryRunner = undefined\n // return ok()\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 ? `${options.username}:${options.password}@`\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 || \"\"}?replicaSet=${options.replicaSet}${\n options.tls ? \"&tls=true\" : \"\"\n }`\n } else {\n connectionString = `${schemaUrlPart}://${credentialsUrlPart}${\n options.host || \"127.0.0.1\"\n }${portUrlPart}/${options.database || \"\"}${\n options.tls ? \"?tls=true\" : \"\"\n }`\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 (let index = 0; index < this.validOptionNames.length; index++) {\n const optionName = this.validOptionNames[index]\n\n if (options.extra && optionName in options.extra) {\n mongoOptions[optionName] = options.extra[optionName]\n } else if (optionName in options) {\n mongoOptions[optionName] = options[optionName]\n }\n }\n\n return mongoOptions\n }\n}\n"],"sourceRoot":"../.."}
package/package.json CHANGED
@@ -1,268 +1 @@
1
- {
2
- "name": "typeorm",
3
- "private": false,
4
- "version": "0.3.15",
5
- "description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB databases.",
6
- "license": "MIT",
7
- "readmeFilename": "README.md",
8
- "author": {
9
- "name": "Umed Khudoiberdiev",
10
- "email": "pleerock.me@gmail.com"
11
- },
12
- "engines": {
13
- "node": ">= 12.9.0"
14
- },
15
- "exports": {
16
- ".": {
17
- "types": "./index.d.ts",
18
- "node": {
19
- "import": "./index.mjs",
20
- "require": "./index.js",
21
- "types": "./index.d.ts"
22
- },
23
- "browser": {
24
- "require": "./index.js",
25
- "import": "./browser/index.js",
26
- "default": "./index.js"
27
- }
28
- },
29
- "./browser": {
30
- "types": "./index.d.ts",
31
- "default": "./browser/index.js"
32
- },
33
- "./*.js": "./*.js",
34
- "./*": {
35
- "require": "./*.js",
36
- "import": "./*"
37
- }
38
- },
39
- "main": "./index.js",
40
- "module": "./index.mjs",
41
- "types": "./index.d.ts",
42
- "browser": {
43
- "./browser/connection/ConnectionOptionsReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js",
44
- "./browser/connection/options-reader/ConnectionOptionsXmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js",
45
- "./browser/connection/options-reader/ConnectionOptionsYmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js",
46
- "./browser/driver/aurora-data-api/AuroraDataApiDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
47
- "./browser/driver/better-sqlite3/BetterSqlite3Driver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
48
- "./browser/driver/cockroachdb/CockroachDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
49
- "./browser/driver/mongodb/MongoDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
50
- "./browser/driver/mongodb/MongoQueryRunner.js": "./browser/platform/BrowserDisabledDriversDummy.js",
51
- "./browser/driver/mysql/MysqlDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
52
- "./browser/driver/oracle/OracleDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
53
- "./browser/driver/postgres/PostgresDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
54
- "./browser/driver/sap/SapDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
55
- "./browser/driver/sqlite/SqliteDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
56
- "./browser/driver/sqlserver/SqlServerDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js",
57
- "./browser/entity-manager/MongoEntityManager.js": "./browser/platform/BrowserDisabledDriversDummy.js",
58
- "./browser/logger/FileLogger.js": "./browser/platform/BrowserFileLoggerDummy.js",
59
- "./browser/platform/PlatformTools.js": "./browser/platform/BrowserPlatformTools.js",
60
- "./browser/repository/MongoRepository.js": "./browser/platform/BrowserDisabledDriversDummy.js",
61
- "./browser/util/DirectoryExportedClassesLoader.js": "./browser/platform/BrowserDirectoryExportedClassesLoader.js",
62
- "./index.js": "./browser/index.js",
63
- "./index.mjs": "./browser/index.js"
64
- },
65
- "repository": {
66
- "type": "git",
67
- "url": "https://github.com/typeorm/typeorm.git"
68
- },
69
- "bugs": {
70
- "url": "https://github.com/typeorm/typeorm/issues"
71
- },
72
- "homepage": "https://typeorm.io",
73
- "tags": [
74
- "orm",
75
- "typescript",
76
- "typescript-orm",
77
- "mysql",
78
- "mysql-orm",
79
- "postgresql",
80
- "postgresql-orm",
81
- "mariadb",
82
- "mariadb-orm",
83
- "spanner",
84
- "sqlite",
85
- "sqlite-orm",
86
- "sql-server",
87
- "sql-server-orm",
88
- "oracle",
89
- "oracle-orm",
90
- "cloud-spanner",
91
- "cloud-spanner-orm"
92
- ],
93
- "devDependencies": {
94
- "@types/app-root-path": "^1.2.4",
95
- "@types/chai": "^4.3.4",
96
- "@types/chai-as-promised": "^7.1.5",
97
- "@types/debug": "^4.1.7",
98
- "@types/mkdirp": "^1.0.2",
99
- "@types/mocha": "^10.0.1",
100
- "@types/node": "^18.13.0",
101
- "@types/sha.js": "^2.4.0",
102
- "@types/sinon": "^10.0.13",
103
- "@types/source-map-support": "^0.5.6",
104
- "@types/uuid": "^9.0.0",
105
- "@types/yargs": "^17.0.22",
106
- "better-sqlite3": "^8.1.0",
107
- "chai": "^4.3.7",
108
- "chai-as-promised": "^7.1.1",
109
- "class-transformer": "^0.5.1",
110
- "conventional-changelog-angular": "^5.0.13",
111
- "conventional-changelog-cli": "^2.2.2",
112
- "del": "6.1.1",
113
- "gulp": "^4.0.2",
114
- "gulp-istanbul": "^1.1.3",
115
- "gulp-mocha": "^8.0.0",
116
- "gulp-rename": "^2.0.0",
117
- "gulp-replace": "^1.1.4",
118
- "gulp-shell": "^0.8.0",
119
- "gulp-sourcemaps": "^3.0.0",
120
- "gulp-typescript": "^6.0.0-alpha.1",
121
- "gulpclass": "^0.2.0",
122
- "husky": "^8.0.3",
123
- "mocha": "^10.2.0",
124
- "mongodb": "^5.2.0",
125
- "mssql": "^9.1.1",
126
- "mysql": "^2.18.1",
127
- "mysql2": "^3.1.1",
128
- "pg": "^8.9.0",
129
- "pg-query-stream": "^4.3.0",
130
- "prettier": "^2.8.3",
131
- "redis": "^4.6.4",
132
- "remap-istanbul": "^0.13.0",
133
- "rimraf": "^4.1.2",
134
- "sinon": "^15.0.1",
135
- "sinon-chai": "^3.7.0",
136
- "source-map-support": "^0.5.21",
137
- "sql.js": "^1.8.0",
138
- "sqlite3": "^5.1.4",
139
- "ts-node": "^10.9.1",
140
- "typeorm-aurora-data-api-driver": "^2.4.4",
141
- "typescript": "^4.9.5"
142
- },
143
- "peerDependencies": {
144
- "@google-cloud/spanner": "^5.18.0",
145
- "@sap/hana-client": "^2.12.25",
146
- "better-sqlite3": "^7.1.2 || ^8.0.0",
147
- "hdb-pool": "^0.1.6",
148
- "ioredis": "^5.0.4",
149
- "mongodb": "^5.2.0",
150
- "mssql": "^9.1.1",
151
- "mysql2": "^2.2.5 || ^3.0.1",
152
- "oracledb": "^5.1.0",
153
- "pg": "^8.5.1",
154
- "pg-native": "^3.0.0",
155
- "pg-query-stream": "^4.0.0",
156
- "redis": "^3.1.1 || ^4.0.0",
157
- "sql.js": "^1.4.0",
158
- "sqlite3": "^5.0.3",
159
- "ts-node": "^10.7.0",
160
- "typeorm-aurora-data-api-driver": "^2.0.0"
161
- },
162
- "peerDependenciesMeta": {
163
- "@google-cloud/spanner": {
164
- "optional": true
165
- },
166
- "@sap/hana-client": {
167
- "optional": true
168
- },
169
- "better-sqlite3": {
170
- "optional": true
171
- },
172
- "hdb-pool": {
173
- "optional": true
174
- },
175
- "ioredis": {
176
- "optional": true
177
- },
178
- "mongodb": {
179
- "optional": true
180
- },
181
- "mssql": {
182
- "optional": true
183
- },
184
- "mysql2": {
185
- "optional": true
186
- },
187
- "oracledb": {
188
- "optional": true
189
- },
190
- "pg": {
191
- "optional": true
192
- },
193
- "pg-native": {
194
- "optional": true
195
- },
196
- "pg-query-stream": {
197
- "optional": true
198
- },
199
- "redis": {
200
- "optional": true
201
- },
202
- "sql.js": {
203
- "optional": true
204
- },
205
- "sqlite3": {
206
- "optional": true
207
- },
208
- "ts-node": {
209
- "optional": true
210
- },
211
- "typeorm-aurora-data-api-driver": {
212
- "optional": true
213
- }
214
- },
215
- "dependencies": {
216
- "@sqltools/formatter": "^1.2.5",
217
- "app-root-path": "^3.1.0",
218
- "buffer": "^6.0.3",
219
- "chalk": "^4.1.2",
220
- "cli-highlight": "^2.1.11",
221
- "debug": "^4.3.4",
222
- "dotenv": "^16.0.3",
223
- "glob": "^8.1.0",
224
- "mkdirp": "^2.1.3",
225
- "reflect-metadata": "^0.1.13",
226
- "sha.js": "^2.4.11",
227
- "tslib": "^2.5.0",
228
- "uuid": "^9.0.0",
229
- "yargs": "^17.6.2"
230
- },
231
- "scripts": {
232
- "test": "rimraf ./build && tsc && mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 90000 ./build/compiled/test",
233
- "test-fast": "mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 90000 ./build/compiled/test",
234
- "compile": "rimraf ./build && tsc",
235
- "watch": "./node_modules/.bin/tsc -w",
236
- "package": "gulp package",
237
- "pack": "gulp pack",
238
- "lint": "prettier --check \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"",
239
- "format": "prettier --write --end-of-line auto \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"",
240
- "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2"
241
- },
242
- "bin": {
243
- "typeorm": "./cli.js",
244
- "typeorm-ts-node-commonjs": "./cli-ts-node-commonjs.js",
245
- "typeorm-ts-node-esm": "./cli-ts-node-esm.js"
246
- },
247
- "funding": "https://opencollective.com/typeorm",
248
- "collective": {
249
- "type": "opencollective",
250
- "url": "https://opencollective.com/typeorm",
251
- "logo": "https://opencollective.com/opencollective/logo.txt"
252
- },
253
- "nyc": {
254
- "all": true,
255
- "cache": false,
256
- "exclude": [
257
- "**/*.d.ts"
258
- ],
259
- "extension": [
260
- ".ts"
261
- ],
262
- "include": [
263
- "build/compiled/src/**",
264
- "src/**"
265
- ],
266
- "reporter": "json"
267
- }
268
- }
1
+ { "name": "typeorm", "private": false, "version": "0.3.16-dev.e0165e7", "description": "Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB databases.", "license": "MIT", "readmeFilename": "README.md", "author": { "name": "Umed Khudoiberdiev", "email": "pleerock.me@gmail.com" }, "engines": { "node": ">= 12.9.0" }, "exports": { ".": { "types": "./index.d.ts", "node": { "import": "./index.mjs", "require": "./index.js", "types": "./index.d.ts" }, "browser": { "require": "./index.js", "import": "./browser/index.js", "default": "./index.js" } }, "./browser": { "types": "./index.d.ts", "default": "./browser/index.js" }, "./*.js": "./*.js", "./*": { "require": "./*.js", "import": "./*" } }, "main": "./index.js", "module": "./index.mjs", "types": "./index.d.ts", "browser": { "./browser/connection/ConnectionOptionsReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/connection/options-reader/ConnectionOptionsXmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/connection/options-reader/ConnectionOptionsYmlReader.js": "./browser/platform/BrowserConnectionOptionsReaderDummy.js", "./browser/driver/aurora-data-api/AuroraDataApiDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/better-sqlite3/BetterSqlite3Driver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/cockroachdb/CockroachDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/MongoDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mongodb/MongoQueryRunner.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/mysql/MysqlDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/oracle/OracleDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/postgres/PostgresDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sap/SapDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sqlite/SqliteDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/driver/sqlserver/SqlServerDriver.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/entity-manager/MongoEntityManager.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/logger/FileLogger.js": "./browser/platform/BrowserFileLoggerDummy.js", "./browser/platform/PlatformTools.js": "./browser/platform/BrowserPlatformTools.js", "./browser/repository/MongoRepository.js": "./browser/platform/BrowserDisabledDriversDummy.js", "./browser/util/DirectoryExportedClassesLoader.js": "./browser/platform/BrowserDirectoryExportedClassesLoader.js", "./index.js": "./browser/index.js", "./index.mjs": "./browser/index.js" }, "repository": { "type": "git", "url": "https://github.com/typeorm/typeorm.git" }, "bugs": { "url": "https://github.com/typeorm/typeorm/issues" }, "homepage": "https://typeorm.io", "tags": [ "orm", "typescript", "typescript-orm", "mysql", "mysql-orm", "postgresql", "postgresql-orm", "mariadb", "mariadb-orm", "spanner", "sqlite", "sqlite-orm", "sql-server", "sql-server-orm", "oracle", "oracle-orm", "cloud-spanner", "cloud-spanner-orm" ], "devDependencies": { "@types/app-root-path": "^1.2.4", "@types/chai": "^4.3.4", "@types/chai-as-promised": "^7.1.5", "@types/debug": "^4.1.7", "@types/mkdirp": "^1.0.2", "@types/mocha": "^10.0.1", "@types/node": "^18.13.0", "@types/sha.js": "^2.4.0", "@types/sinon": "^10.0.13", "@types/source-map-support": "^0.5.6", "@types/uuid": "^9.0.0", "@types/yargs": "^17.0.22", "better-sqlite3": "^8.1.0", "chai": "^4.3.7", "chai-as-promised": "^7.1.1", "class-transformer": "^0.5.1", "conventional-changelog-angular": "^5.0.13", "conventional-changelog-cli": "^2.2.2", "del": "6.1.1", "gulp": "^4.0.2", "gulp-istanbul": "^1.1.3", "gulp-mocha": "^8.0.0", "gulp-rename": "^2.0.0", "gulp-replace": "^1.1.4", "gulp-shell": "^0.8.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", "gulpclass": "^0.2.0", "husky": "^8.0.3", "mocha": "^10.2.0", "mongodb": "^5.2.0", "mssql": "^9.1.1", "mysql": "^2.18.1", "mysql2": "^3.1.1", "pg": "^8.9.0", "pg-query-stream": "^4.3.0", "prettier": "^2.8.3", "redis": "^4.6.4", "remap-istanbul": "^0.13.0", "rimraf": "^4.1.2", "sinon": "^15.0.1", "sinon-chai": "^3.7.0", "source-map-support": "^0.5.21", "sql.js": "^1.8.0", "sqlite3": "^5.1.4", "ts-node": "^10.9.1", "typeorm-aurora-data-api-driver": "^2.4.4", "typescript": "^4.9.5" }, "peerDependencies": { "@google-cloud/spanner": "^5.18.0", "@sap/hana-client": "^2.12.25", "better-sqlite3": "^7.1.2 || ^8.0.0", "hdb-pool": "^0.1.6", "ioredis": "^5.0.4", "mongodb": "^5.2.0", "mssql": "^9.1.1", "mysql2": "^2.2.5 || ^3.0.1", "oracledb": "^5.1.0", "pg": "^8.5.1", "pg-native": "^3.0.0", "pg-query-stream": "^4.0.0", "redis": "^3.1.1 || ^4.0.0", "sql.js": "^1.4.0", "sqlite3": "^5.0.3", "ts-node": "^10.7.0", "typeorm-aurora-data-api-driver": "^2.0.0" }, "peerDependenciesMeta": { "@google-cloud/spanner": { "optional": true }, "@sap/hana-client": { "optional": true }, "better-sqlite3": { "optional": true }, "hdb-pool": { "optional": true }, "ioredis": { "optional": true }, "mongodb": { "optional": true }, "mssql": { "optional": true }, "mysql2": { "optional": true }, "oracledb": { "optional": true }, "pg": { "optional": true }, "pg-native": { "optional": true }, "pg-query-stream": { "optional": true }, "redis": { "optional": true }, "sql.js": { "optional": true }, "sqlite3": { "optional": true }, "ts-node": { "optional": true }, "typeorm-aurora-data-api-driver": { "optional": true } }, "dependencies": { "@sqltools/formatter": "^1.2.5", "app-root-path": "^3.1.0", "buffer": "^6.0.3", "chalk": "^4.1.2", "cli-highlight": "^2.1.11", "debug": "^4.3.4", "dotenv": "^16.0.3", "glob": "^8.1.0", "mkdirp": "^2.1.3", "reflect-metadata": "^0.1.13", "sha.js": "^2.4.11", "tslib": "^2.5.0", "uuid": "^9.0.0", "yargs": "^17.6.2" }, "scripts": { "test": "rimraf ./build && tsc && mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 90000 ./build/compiled/test", "test-fast": "mocha --file ./build/compiled/test/utils/test-setup.js --bail --recursive --timeout 90000 ./build/compiled/test", "compile": "rimraf ./build && tsc", "watch": "./node_modules/.bin/tsc -w", "package": "gulp package", "pack": "gulp pack", "lint": "prettier --check \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"", "format": "prettier --write --end-of-line auto \"./src/**/*.ts\" \"./test/**/*.ts\" \"./sample/**/*.ts\"", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2" }, "bin": { "typeorm": "./cli.js", "typeorm-ts-node-commonjs": "./cli-ts-node-commonjs.js", "typeorm-ts-node-esm": "./cli-ts-node-esm.js" }, "funding": "https://opencollective.com/typeorm", "collective": { "type": "opencollective", "url": "https://opencollective.com/typeorm", "logo": "https://opencollective.com/opencollective/logo.txt" }, "nyc": { "all": true, "cache": false, "exclude": [ "**/*.d.ts" ], "extension": [ ".ts" ], "include": [ "build/compiled/src/**", "src/**" ], "reporter": "json" } }