typeorm 0.3.22-dev.6ba4082 → 0.3.22-dev.81bb9d5

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.
@@ -2,7 +2,6 @@ import { BaseDataSourceOptions } from "../../data-source/BaseDataSourceOptions";
2
2
  import { ReadPreference } from "./typings";
3
3
  /**
4
4
  * MongoDB specific connection options.
5
- * Synced with http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html
6
5
  */
7
6
  export interface MongoConnectionOptions extends BaseDataSourceOptions {
8
7
  /**
@@ -37,246 +36,216 @@ export interface MongoConnectionOptions extends BaseDataSourceOptions {
37
36
  * Database name to connect to.
38
37
  */
39
38
  readonly database?: string;
40
- /**
41
- * Specifies whether to force dispatch all operations to the specified host. Default: false
42
- */
43
- readonly directConnection?: boolean;
44
39
  /**
45
40
  * The driver object
46
41
  * This defaults to require("mongodb")
47
42
  */
48
43
  readonly driver?: any;
49
44
  /**
50
- * Use ssl connection (needs to have a mongod server with ssl support). Default: false
51
- */
52
- readonly ssl?: boolean;
53
- /**
54
- * Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher).
55
- * Default: true
56
- */
57
- readonly sslValidate?: boolean;
58
- /**
59
- * Array of valid certificates either as Buffers or Strings
60
- * (needs to have a mongod server with ssl support, 2.4 or higher).
45
+ * MongoClientOptions
46
+ * Synced with https://mongodb.github.io/node-mongodb-native/5.9/interfaces/MongoClientOptions.html
61
47
  */
62
- readonly sslCA?: string | Buffer;
63
48
  /**
64
- * String or buffer containing the certificate we wish to present
65
- * (needs to have a mongod server with ssl support, 2.4 or higher)
49
+ * The name of the application that created this MongoClient instance.
50
+ * MongoDB 3.4 and newer will print this value in the server log upon establishing each connection.
51
+ * It is also recorded in the slow query log and profile collections
66
52
  */
67
- readonly sslCert?: string | Buffer;
53
+ readonly appName?: string;
68
54
  /**
69
- * String or buffer containing the certificate private key we wish to present
70
- * (needs to have a mongod server with ssl support, 2.4 or higher)
55
+ * Specify the authentication mechanism that MongoDB will use to authenticate the connection.
71
56
  */
72
- readonly sslKey?: string;
73
- /**
74
- * String or buffer containing the certificate password
75
- * (needs to have a mongod server with ssl support, 2.4 or higher)
76
- */
77
- readonly sslPass?: string | Buffer;
57
+ readonly authMechanism?: string;
78
58
  /**
79
- * SSL Certificate revocation list binary buffer
80
- * (needs to have a mongod server with ssl support, 2.4 or higher)
59
+ * Specify the database name associated with the user’s credentials.
81
60
  */
82
- readonly sslCRL?: string | Buffer;
61
+ readonly authSource?: string;
83
62
  /**
84
- * Reconnect on error. Default: true
63
+ * Optionally enable in-use auto encryption
85
64
  */
86
- readonly autoReconnect?: boolean;
65
+ readonly autoEncryption?: any;
87
66
  /**
88
- * TCP Socket NoDelay option. Default: true
67
+ * Verifies the certificate `cert` is issued to `hostname`.
89
68
  */
90
- readonly noDelay?: boolean;
69
+ readonly checkServerIdentity?: Function;
91
70
  /**
92
- * The number of milliseconds to wait before initiating keepAlive on the TCP socket. Default: 30000
71
+ * An array or comma-delimited string of compressors to enable network
72
+ * compression for communication between this client and a mongod/mongos instance.
93
73
  */
94
- readonly keepAlive?: number;
74
+ readonly compressors?: string | string[];
95
75
  /**
96
- * TCP Connection timeout setting. Default: 30000
76
+ * The time in milliseconds to attempt a connection before timing out.
97
77
  */
98
78
  readonly connectTimeoutMS?: number;
99
79
  /**
100
- * Version of IP stack. Can be 4, 6.
101
- * If undefined, will attempt to connect with IPv6, and will fall back to IPv4 on failure
80
+ * Allow a driver to force a Single topology type with a connection string containing one host
102
81
  */
103
- readonly family?: number;
104
- /**
105
- * TCP Socket timeout setting. Default: 360000
106
- */
107
- readonly socketTimeoutMS?: number;
108
- /**
109
- * Server attempt to reconnect #times. Default 30
110
- */
111
- readonly reconnectTries?: number;
112
- /**
113
- * Server will wait #milliseconds between retries. Default 1000
114
- */
115
- readonly reconnectInterval?: number;
116
- /**
117
- * Control if high availability monitoring runs for Replicaset or Mongos proxies. Default true
118
- */
119
- readonly ha?: boolean;
120
- /**
121
- * The High availability period for replicaset inquiry. Default: 10000
122
- */
123
- readonly haInterval?: number;
82
+ readonly directConnection?: boolean;
124
83
  /**
125
- * The name of the replicaset to connect to
84
+ * IP family
126
85
  */
127
- readonly replicaSet?: string;
86
+ readonly family?: number;
128
87
  /**
129
- * Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms).
130
- * Default: 15
88
+ * Force server to assign `_id` values instead of driver
131
89
  */
132
- readonly acceptableLatencyMS?: number;
90
+ readonly forceServerObjectId?: boolean;
133
91
  /**
134
- * Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms).
135
- * Default: 15
92
+ * serialize will not emit undefined fields
93
+ * note that the driver sets this to `false`
136
94
  */
137
- readonly secondaryAcceptableLatencyMS?: number;
95
+ readonly ignoreUndefined?: boolean;
138
96
  /**
139
- * Sets if the driver should connect even if no primary is available. Default: false
97
+ * @deprecated TCP Connection keep alive enabled. Will not be able to turn off in the future.
140
98
  */
141
- readonly connectWithNoPrimary?: boolean;
99
+ readonly keepAlive?: boolean;
142
100
  /**
143
- * If the database authentication is dependent on another databaseName.
101
+ * @deprecated The number of milliseconds to wait before initiating keepAlive on the TCP socket.
102
+ * Will not be configurable in the future.
144
103
  */
145
- readonly authSource?: string;
104
+ readonly keepAliveInitialDelay?: number;
146
105
  /**
147
- * The write concern.
106
+ * The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.
148
107
  */
149
- readonly w?: string | number;
108
+ readonly localThresholdMS?: number;
150
109
  /**
151
- * The write concern timeout value.
110
+ * Specifies, in seconds, how stale a secondary can be before the client stops using it for read operations.
152
111
  */
153
- readonly wtimeout?: number;
112
+ readonly maxStalenessSeconds?: number;
154
113
  /**
155
- * Specify a journal write concern. Default: false
114
+ * The minimum number of connections in the connection pool.
156
115
  */
157
- readonly j?: boolean;
116
+ readonly minPoolSize?: number;
158
117
  /**
159
- * Force server to assign _id values instead of driver. Default: false
118
+ * Enable command monitoring for this client
160
119
  */
161
- readonly forceServerObjectId?: boolean;
120
+ readonly monitorCommands?: boolean;
162
121
  /**
163
- * Serialize functions on any object. Default: false
122
+ * TCP Connection no delay
164
123
  */
165
- readonly serializeFunctions?: boolean;
124
+ readonly noDelay?: boolean;
166
125
  /**
167
- * Specify if the BSON serializer should ignore undefined fields. Default: false
126
+ * A primary key factory function for generation of custom `_id` keys
168
127
  */
169
- readonly ignoreUndefined?: boolean;
128
+ readonly pkFactory?: any;
170
129
  /**
171
- * Return document results as raw BSON buffers. Default: false
130
+ * when deserializing a Binary will return it as a node.js Buffer instance.
172
131
  */
173
- readonly raw?: boolean;
132
+ readonly promoteBuffers?: boolean;
174
133
  /**
175
- * Promotes Long values to number if they fit inside the 53 bits resolution. Default: true
134
+ * when deserializing a Long will fit it into a Number if it's smaller than 53 bits.
176
135
  */
177
136
  readonly promoteLongs?: boolean;
178
137
  /**
179
- * Promotes Binary BSON values to native Node Buffers. Default: false
180
- */
181
- readonly promoteBuffers?: boolean;
182
- /**
183
- * Promotes BSON values to native types where possible, set to false to only receive wrapper types. Default: true
138
+ * when deserializing will promote BSON values to their Node.js closest equivalent types.
184
139
  */
185
140
  readonly promoteValues?: boolean;
186
141
  /**
187
- * Enable the wrapping of the callback in the current domain, disabled by default to avoid perf hit. Default: false
142
+ * Enabling the raw option will return a Node.js Buffer which is allocated using allocUnsafe API
188
143
  */
189
- readonly domainsEnabled?: boolean;
144
+ readonly raw?: boolean;
190
145
  /**
191
- * Sets a cap on how many operations the driver will buffer up before giving up on getting a working connection,
192
- * default is -1 which is unlimited.
146
+ * Specify a read concern for the collection (only MongoDB 3.2 or higher supported)
193
147
  */
194
- readonly bufferMaxEntries?: number;
148
+ readonly readConcern?: any;
195
149
  /**
196
- * The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY,
197
- * ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
150
+ * Specifies the read preferences for this connection
198
151
  */
199
152
  readonly readPreference?: ReadPreference | string;
200
153
  /**
201
- * A primary key factory object for generation of custom _id keys.
154
+ * Specifies the tags document as a comma-separated list of colon-separated key-value pairs.
202
155
  */
203
- readonly pkFactory?: any;
156
+ readonly readPreferenceTags?: any[];
204
157
  /**
205
- * A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible.
158
+ * Specifies the name of the replica set, if the mongod is a member of a replica set.
206
159
  */
207
- readonly promiseLibrary?: any;
160
+ readonly replicaSet?: string;
208
161
  /**
209
- * Specify a read concern for the collection. (only MongoDB 3.2 or higher supported).
162
+ * Enable retryable writes.
210
163
  */
211
- readonly readConcern?: any;
164
+ readonly retryWrites?: boolean;
212
165
  /**
213
- * Specify a maxStalenessSeconds value for secondary reads, minimum is 90 seconds
166
+ * serialize the javascript functions
214
167
  */
215
- readonly maxStalenessSeconds?: number;
168
+ readonly serializeFunctions?: boolean;
216
169
  /**
217
- * Specify the log level used by the driver logger (error/warn/info/debug).
170
+ * The time in milliseconds to attempt a send or receive on a socket before the attempt times out.
218
171
  */
219
- readonly loggerLevel?: "error" | "warn" | "info" | "debug";
172
+ readonly socketTimeoutMS?: number;
220
173
  /**
221
- * 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
222
- * Default: true
174
+ * @deprecated A boolean to enable or disables TLS/SSL for the connection.
175
+ * (The ssl option is equivalent to the tls option.)
223
176
  */
224
- readonly checkServerIdentity?: boolean | Function;
177
+ readonly ssl?: boolean;
225
178
  /**
226
- * Validate MongoClient passed in options for correctness. Default: false
179
+ * @deprecated SSL Root Certificate file path.
180
+ *
181
+ * Will be removed in the next major version. Please use tlsCAFile instead.
227
182
  */
228
- readonly validateOptions?: boolean | any;
183
+ readonly sslCA?: string;
229
184
  /**
230
- * 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
185
+ * @deprecated SSL Certificate revocation list file path.
186
+ *
187
+ * Will be removed in the next major version.
231
188
  */
232
- readonly appname?: string;
189
+ readonly sslCRL?: string;
233
190
  /**
234
- * Sets the authentication mechanism that MongoDB will use to authenticate the connection
191
+ * @deprecated SSL Certificate file path.
192
+ *
193
+ * Will be removed in the next major version. Please use tlsCertificateKeyFile instead.
235
194
  */
236
- readonly authMechanism?: string;
195
+ readonly sslCert?: string;
237
196
  /**
238
- * Type of compression to use: snappy or zlib
197
+ * @deprecated SSL Key file file path.
198
+ *
199
+ * Will be removed in the next major version. Please use tlsCertificateKeyFile instead.
239
200
  */
240
- readonly compression?: any;
201
+ readonly sslKey?: string;
241
202
  /**
242
- * Specify a file sync write concern. Default: false
203
+ * @deprecated SSL Certificate pass phrase.
204
+ *
205
+ * Will be removed in the next major version. Please use tlsCertificateKeyFilePassword instead.
243
206
  */
244
- readonly fsync?: boolean;
207
+ readonly sslPass?: string;
245
208
  /**
246
- * Read preference tags
209
+ * @deprecated Validate mongod server certificate against Certificate Authority
210
+ *
211
+ * Will be removed in the next major version. Please use tlsAllowInvalidCertificates instead.
247
212
  */
248
- readonly readPreferenceTags?: any[];
213
+ readonly sslValidate?: boolean;
249
214
  /**
250
- * The number of retries for a tailable cursor. Default: 5
215
+ * Enables or disables TLS/SSL for the connection.
251
216
  */
252
- readonly numberOfRetries?: number;
217
+ readonly tls?: boolean;
253
218
  /**
254
- * Enable auto reconnecting for single server instances. Default: true
219
+ * Bypasses validation of the certificates presented by the mongod/mongos instance
255
220
  */
256
- readonly auto_reconnect?: boolean;
221
+ readonly tlsAllowInvalidCertificates?: boolean;
257
222
  /**
258
- * Enable command monitoring for this client. Default: false
223
+ * Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority.
259
224
  */
260
- readonly monitorCommands?: boolean;
225
+ readonly tlsCAFile?: string;
261
226
  /**
262
- * If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections
227
+ * Specifies the location of a local .pem file that contains the client's TLS/SSL certificate and key.
263
228
  */
264
- readonly minSize?: number;
229
+ readonly tlsCertificateKeyFile?: string;
265
230
  /**
266
- * Determines whether or not to use the new url parser. Default: false
231
+ * Specifies the password to de-crypt the tlsCertificateKeyFile.
267
232
  */
268
- readonly useNewUrlParser?: boolean;
233
+ readonly tlsCertificateKeyFilePassword?: string;
269
234
  /**
270
- * Determines whether or not to use the new Server Discovery and Monitoring engine. Default: false
271
- * https://github.com/mongodb/node-mongodb-native/releases/tag/v3.2.1
235
+ * @deprecated The write concern w value
236
+ *
237
+ * Please use the `writeConcern` option instead
272
238
  */
273
- readonly useUnifiedTopology?: boolean;
239
+ readonly w?: string | number;
274
240
  /**
275
- * Automatic Client-Side Field Level Encryption configuration.
241
+ * A MongoDB WriteConcern, which describes the level of acknowledgement
242
+ * requested from MongoDB for write operations.
276
243
  */
277
- readonly autoEncryption?: any;
244
+ readonly writeConcern?: any;
278
245
  /**
279
- * Enables or disables the ability to retry writes upon encountering transient network errors.
246
+ * @deprecated The write concern timeout
247
+ *
248
+ * Please use the `writeConcern` option instead
280
249
  */
281
- readonly retryWrites?: boolean;
250
+ readonly wtimeoutMS?: number;
282
251
  }
@@ -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 the connection is performed.\n */\n readonly url?: string\n\n /**\n * Database host.\n */\n readonly host?: string\n\n /**\n * Database host replica set.\n */\n readonly hostReplicaSet?: string\n\n /**\n * Database host port.\n */\n readonly port?: number\n\n /**\n * Database username.\n */\n readonly username?: string\n\n /**\n * Database password.\n */\n readonly password?: string\n\n /**\n * Database name to connect to.\n */\n readonly database?: string\n\n /**\n * 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":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/mongodb/MongoConnectionOptions.ts"],"names":[],"mappings":"","file":"MongoConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { ReadPreference } from \"./typings\"\n\n/**\n * MongoDB specific connection options.\n */\nexport interface MongoConnectionOptions extends BaseDataSourceOptions {\n /**\n * Database type.\n */\n readonly type: \"mongodb\"\n\n /**\n * Connection url where the connection is performed.\n */\n readonly url?: string\n\n /**\n * Database host.\n */\n readonly host?: string\n\n /**\n * Database host replica set.\n */\n readonly hostReplicaSet?: string\n\n /**\n * Database host port.\n */\n readonly port?: number\n\n /**\n * Database username.\n */\n readonly username?: string\n\n /**\n * Database password.\n */\n readonly password?: string\n\n /**\n * Database name to connect to.\n */\n readonly database?: string\n\n /**\n * The driver object\n * This defaults to require(\"mongodb\")\n */\n readonly driver?: any\n\n /**\n * MongoClientOptions\n * Synced with https://mongodb.github.io/node-mongodb-native/5.9/interfaces/MongoClientOptions.html\n */\n\n /**\n * The name of the application that created this MongoClient instance.\n * MongoDB 3.4 and newer will print this value in the server log upon establishing each connection.\n * It is also recorded in the slow query log and profile collections\n */\n readonly appName?: string\n\n /**\n * Specify the authentication mechanism that MongoDB will use to authenticate the connection.\n */\n readonly authMechanism?: string\n\n /**\n * Specify the database name associated with the user’s credentials.\n */\n readonly authSource?: string\n\n /**\n * Optionally enable in-use auto encryption\n */\n readonly autoEncryption?: any\n\n /**\n * Verifies the certificate `cert` is issued to `hostname`.\n */\n readonly checkServerIdentity?: Function\n\n /**\n * An array or comma-delimited string of compressors to enable network\n * compression for communication between this client and a mongod/mongos instance.\n */\n readonly compressors?: string | string[]\n\n /**\n * The time in milliseconds to attempt a connection before timing out.\n */\n readonly connectTimeoutMS?: number\n\n /**\n * Allow a driver to force a Single topology type with a connection string containing one host\n */\n readonly directConnection?: boolean\n\n /**\n * IP family\n */\n readonly family?: number\n\n /**\n * Force server to assign `_id` values instead of driver\n */\n readonly forceServerObjectId?: boolean\n\n /**\n * serialize will not emit undefined fields\n * note that the driver sets this to `false`\n */\n readonly ignoreUndefined?: boolean\n\n /**\n * @deprecated TCP Connection keep alive enabled. Will not be able to turn off in the future.\n */\n readonly keepAlive?: boolean\n\n /**\n * @deprecated The number of milliseconds to wait before initiating keepAlive on the TCP socket.\n * Will not be configurable in the future.\n */\n readonly keepAliveInitialDelay?: number\n\n /**\n * The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.\n */\n readonly localThresholdMS?: number\n\n /**\n * Specifies, in seconds, how stale a secondary can be before the client stops using it for read operations.\n */\n readonly maxStalenessSeconds?: number\n\n /**\n * The minimum number of connections in the connection pool.\n */\n readonly minPoolSize?: number\n\n /**\n * Enable command monitoring for this client\n */\n readonly monitorCommands?: boolean\n\n /**\n * TCP Connection no delay\n */\n readonly noDelay?: boolean\n\n /**\n * A primary key factory function for generation of custom `_id` keys\n */\n readonly pkFactory?: any\n\n /**\n * when deserializing a Binary will return it as a node.js Buffer instance.\n */\n readonly promoteBuffers?: boolean\n\n /**\n * when deserializing a Long will fit it into a Number if it's smaller than 53 bits.\n */\n readonly promoteLongs?: boolean\n\n /**\n * when deserializing will promote BSON values to their Node.js closest equivalent types.\n */\n readonly promoteValues?: boolean\n\n /**\n * Enabling the raw option will return a Node.js Buffer which is allocated using allocUnsafe API\n */\n readonly raw?: boolean\n\n /**\n * Specify a read concern for the collection (only MongoDB 3.2 or higher supported)\n */\n readonly readConcern?: any\n\n /**\n * Specifies the read preferences for this connection\n */\n readonly readPreference?: ReadPreference | string\n\n /**\n * Specifies the tags document as a comma-separated list of colon-separated key-value pairs.\n */\n readonly readPreferenceTags?: any[]\n\n /**\n * Specifies the name of the replica set, if the mongod is a member of a replica set.\n */\n readonly replicaSet?: string\n\n /**\n * Enable retryable writes.\n */\n readonly retryWrites?: boolean\n\n /**\n * serialize the javascript functions\n */\n readonly serializeFunctions?: boolean\n\n /**\n * The time in milliseconds to attempt a send or receive on a socket before the attempt times out.\n */\n readonly socketTimeoutMS?: number\n\n /**\n * @deprecated A boolean to enable or disables TLS/SSL for the connection.\n * (The ssl option is equivalent to the tls option.)\n */\n readonly ssl?: boolean\n\n /**\n * @deprecated SSL Root Certificate file path.\n *\n * Will be removed in the next major version. Please use tlsCAFile instead.\n */\n readonly sslCA?: string\n\n /**\n * @deprecated SSL Certificate revocation list file path.\n *\n * Will be removed in the next major version.\n */\n readonly sslCRL?: string\n\n /**\n * @deprecated SSL Certificate file path.\n *\n * Will be removed in the next major version. Please use tlsCertificateKeyFile instead.\n */\n readonly sslCert?: string\n\n /**\n * @deprecated SSL Key file file path.\n *\n * Will be removed in the next major version. Please use tlsCertificateKeyFile instead.\n */\n readonly sslKey?: string\n\n /**\n * @deprecated SSL Certificate pass phrase.\n *\n * Will be removed in the next major version. Please use tlsCertificateKeyFilePassword instead.\n */\n readonly sslPass?: string\n\n /**\n * @deprecated Validate mongod server certificate against Certificate Authority\n *\n * Will be removed in the next major version. Please use tlsAllowInvalidCertificates instead.\n */\n readonly sslValidate?: boolean\n\n /**\n * Enables or disables TLS/SSL for the connection.\n */\n readonly tls?: boolean\n\n /**\n * Bypasses validation of the certificates presented by the mongod/mongos instance\n */\n readonly tlsAllowInvalidCertificates?: boolean\n\n /**\n * Specifies the location of a local .pem file that contains the root certificate chain from the Certificate Authority.\n */\n readonly tlsCAFile?: string\n\n /**\n * Specifies the location of a local .pem file that contains the client's TLS/SSL certificate and key.\n */\n readonly tlsCertificateKeyFile?: string\n\n /**\n * Specifies the password to de-crypt the tlsCertificateKeyFile.\n */\n readonly tlsCertificateKeyFilePassword?: string\n\n /**\n * @deprecated The write concern w value\n *\n * Please use the `writeConcern` option instead\n */\n readonly w?: string | number\n\n /**\n * A MongoDB WriteConcern, which describes the level of acknowledgement\n * requested from MongoDB for write operations.\n */\n readonly writeConcern?: any\n\n /**\n * @deprecated The write concern timeout\n *\n * Please use the `writeConcern` option instead\n */\n readonly wtimeoutMS?: number\n}\n"],"sourceRoot":"../.."}
@@ -89,13 +89,12 @@ export declare class MongoDriver implements Driver {
89
89
  * for MongoDB.
90
90
  */
91
91
  maxAliasLength?: number;
92
+ cteCapabilities: CteCapabilities;
92
93
  /**
93
94
  * Valid mongo connection options
94
- * NOTE: Keep sync with MongoConnectionOptions
95
- * Sync with http://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html
95
+ * NOTE: Keep in sync with MongoConnectionOptions
96
96
  */
97
97
  protected validOptionNames: string[];
98
- cteCapabilities: CteCapabilities;
99
98
  constructor(connection: DataSource);
100
99
  /**
101
100
  * Performs connection to the database.
@@ -77,82 +77,71 @@ export class MongoDriver {
77
77
  metadataName: "int",
78
78
  metadataValue: "int",
79
79
  };
80
+ this.cteCapabilities = {
81
+ enabled: false,
82
+ };
80
83
  // -------------------------------------------------------------------------
81
84
  // Protected Properties
82
85
  // -------------------------------------------------------------------------
83
86
  /**
84
87
  * Valid mongo connection options
85
- * NOTE: Keep sync with MongoConnectionOptions
86
- * Sync with http://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html
88
+ * NOTE: Keep in sync with MongoConnectionOptions
87
89
  */
88
90
  this.validOptionNames = [
89
- "poolSize",
90
- "ssl",
91
- "sslValidate",
92
- "sslCA",
93
- "sslCert",
94
- "sslKey",
95
- "sslPass",
96
- "sslCRL",
97
- "autoReconnect",
98
- "noDelay",
99
- "keepAlive",
100
- "keepAliveInitialDelay",
91
+ "appName",
92
+ "authMechanism",
93
+ "authSource",
94
+ "autoEncryption",
95
+ "checkServerIdentity",
96
+ "compressors",
101
97
  "connectTimeoutMS",
98
+ "directConnection",
102
99
  "family",
103
- "socketTimeoutMS",
104
- "reconnectTries",
105
- "reconnectInterval",
106
- "ha",
107
- "haInterval",
108
- "replicaSet",
109
- "secondaryAcceptableLatencyMS",
110
- "acceptableLatencyMS",
111
- "connectWithNoPrimary",
112
- "authSource",
113
- "w",
114
- "wtimeout",
115
- "j",
116
- "writeConcern",
117
100
  "forceServerObjectId",
118
- "serializeFunctions",
119
101
  "ignoreUndefined",
120
- "raw",
121
- "bufferMaxEntries",
122
- "readPreference",
123
- "pkFactory",
124
- "promiseLibrary",
125
- "readConcern",
102
+ "keepAlive",
103
+ "keepAliveInitialDelay",
104
+ "localThresholdMS",
126
105
  "maxStalenessSeconds",
127
- "loggerLevel",
128
- // Do not overwrite BaseDataSourceOptions.logger
129
- // "logger",
130
- "promoteValues",
106
+ "minPoolSize",
107
+ "monitorCommands",
108
+ "noDelay",
109
+ "pkFactory",
131
110
  "promoteBuffers",
132
111
  "promoteLongs",
133
- "domainsEnabled",
134
- "checkServerIdentity",
135
- "validateOptions",
112
+ "promoteValues",
113
+ "raw",
114
+ "readConcern",
115
+ "readPreference",
116
+ "readPreferenceTags",
117
+ "replicaSet",
118
+ "retryWrites",
119
+ "serializeFunctions",
120
+ "socketTimeoutMS",
121
+ "ssl",
122
+ "sslCA",
123
+ "sslCRL",
124
+ "sslCert",
125
+ "sslKey",
126
+ "sslPass",
127
+ "sslValidate",
128
+ "tls",
129
+ "tlsAllowInvalidCertificates",
130
+ "tlsCAFile",
131
+ "tlsCertificateKeyFile",
132
+ "tlsCertificateKeyFilePassword",
133
+ "w",
134
+ "writeConcern",
135
+ "wtimeoutMS",
136
+ // Undocumented deprecated options
137
+ // todo: remove next major version
136
138
  "appname",
137
- // omit auth - we are building url from username and password
138
- // "auth"
139
- "authMechanism",
140
- "compression",
141
139
  "fsync",
142
- "readPreferenceTags",
143
- "numberOfRetries",
144
- "auto_reconnect",
145
- "minSize",
146
- "monitorCommands",
140
+ "j",
147
141
  "useNewUrlParser",
148
142
  "useUnifiedTopology",
149
- "autoEncryption",
150
- "retryWrites",
151
- "directConnection",
143
+ "wtimeout",
152
144
  ];
153
- this.cteCapabilities = {
154
- enabled: false,
155
- };
156
145
  this.options = connection.options;
157
146
  // validate options to make sure everything is correct and driver will be able to establish connection
158
147
  this.validateOptions(connection.options);
@@ -380,10 +369,10 @@ export class MongoDriver {
380
369
  if (options.replicaSet) {
381
370
  connectionString = `${schemaUrlPart}://${credentialsUrlPart}${options.hostReplicaSet ||
382
371
  options.host + portUrlPart ||
383
- "127.0.0.1" + portUrlPart}/${options.database || ""}?replicaSet=${options.replicaSet}${options.tls ? "&tls=true" : ""}`;
372
+ "127.0.0.1" + portUrlPart}/${options.database || ""}`;
384
373
  }
385
374
  else {
386
- connectionString = `${schemaUrlPart}://${credentialsUrlPart}${options.host || "127.0.0.1"}${portUrlPart}/${options.database || ""}${options.tls ? "?tls=true" : ""}`;
375
+ connectionString = `${schemaUrlPart}://${credentialsUrlPart}${options.host || "127.0.0.1"}${portUrlPart}/${options.database || ""}`;
387
376
  }
388
377
  return connectionString;
389
378
  }
@@ -392,15 +381,15 @@ export class MongoDriver {
392
381
  */
393
382
  buildConnectionOptions(options) {
394
383
  const mongoOptions = {};
395
- for (let index = 0; index < this.validOptionNames.length; index++) {
396
- const optionName = this.validOptionNames[index];
397
- if (options.extra && optionName in options.extra) {
398
- mongoOptions[optionName] = options.extra[optionName];
399
- }
400
- else if (optionName in options) {
384
+ for (const optionName of this.validOptionNames) {
385
+ if (optionName in options) {
401
386
  mongoOptions[optionName] = options[optionName];
402
387
  }
403
388
  }
389
+ if ("poolSize" in options) {
390
+ mongoOptions["maxPoolSize"] = options["poolSize"];
391
+ }
392
+ Object.assign(mongoOptions, options.extra);
404
393
  return mongoOptions;
405
394
  }
406
395
  }