@depup/mongodb 7.1.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/LICENSE.md +201 -0
  2. package/README.md +33 -0
  3. package/etc/prepare.js +12 -0
  4. package/lib/admin.js +136 -0
  5. package/lib/admin.js.map +1 -0
  6. package/lib/bson.js +85 -0
  7. package/lib/bson.js.map +1 -0
  8. package/lib/bulk/common.js +835 -0
  9. package/lib/bulk/common.js.map +1 -0
  10. package/lib/bulk/ordered.js +67 -0
  11. package/lib/bulk/ordered.js.map +1 -0
  12. package/lib/bulk/unordered.js +92 -0
  13. package/lib/bulk/unordered.js.map +1 -0
  14. package/lib/change_stream.js +513 -0
  15. package/lib/change_stream.js.map +1 -0
  16. package/lib/client-side-encryption/auto_encrypter.js +272 -0
  17. package/lib/client-side-encryption/auto_encrypter.js.map +1 -0
  18. package/lib/client-side-encryption/client_encryption.js +609 -0
  19. package/lib/client-side-encryption/client_encryption.js.map +1 -0
  20. package/lib/client-side-encryption/errors.js +138 -0
  21. package/lib/client-side-encryption/errors.js.map +1 -0
  22. package/lib/client-side-encryption/mongocryptd_manager.js +85 -0
  23. package/lib/client-side-encryption/mongocryptd_manager.js.map +1 -0
  24. package/lib/client-side-encryption/providers/aws.js +23 -0
  25. package/lib/client-side-encryption/providers/aws.js.map +1 -0
  26. package/lib/client-side-encryption/providers/azure.js +132 -0
  27. package/lib/client-side-encryption/providers/azure.js.map +1 -0
  28. package/lib/client-side-encryption/providers/gcp.js +16 -0
  29. package/lib/client-side-encryption/providers/gcp.js.map +1 -0
  30. package/lib/client-side-encryption/providers/index.js +43 -0
  31. package/lib/client-side-encryption/providers/index.js.map +1 -0
  32. package/lib/client-side-encryption/state_machine.js +427 -0
  33. package/lib/client-side-encryption/state_machine.js.map +1 -0
  34. package/lib/cmap/auth/auth_provider.js +51 -0
  35. package/lib/cmap/auth/auth_provider.js.map +1 -0
  36. package/lib/cmap/auth/aws4.js +161 -0
  37. package/lib/cmap/auth/aws4.js.map +1 -0
  38. package/lib/cmap/auth/aws_temporary_credentials.js +103 -0
  39. package/lib/cmap/auth/aws_temporary_credentials.js.map +1 -0
  40. package/lib/cmap/auth/gssapi.js +155 -0
  41. package/lib/cmap/auth/gssapi.js.map +1 -0
  42. package/lib/cmap/auth/mongo_credentials.js +169 -0
  43. package/lib/cmap/auth/mongo_credentials.js.map +1 -0
  44. package/lib/cmap/auth/mongodb_aws.js +128 -0
  45. package/lib/cmap/auth/mongodb_aws.js.map +1 -0
  46. package/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js +84 -0
  47. package/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js.map +1 -0
  48. package/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +62 -0
  49. package/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js.map +1 -0
  50. package/lib/cmap/auth/mongodb_oidc/callback_workflow.js +141 -0
  51. package/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map +1 -0
  52. package/lib/cmap/auth/mongodb_oidc/command_builders.js +44 -0
  53. package/lib/cmap/auth/mongodb_oidc/command_builders.js.map +1 -0
  54. package/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +39 -0
  55. package/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js.map +1 -0
  56. package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js +122 -0
  57. package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map +1 -0
  58. package/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +32 -0
  59. package/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js.map +1 -0
  60. package/lib/cmap/auth/mongodb_oidc/token_cache.js +52 -0
  61. package/lib/cmap/auth/mongodb_oidc/token_cache.js.map +1 -0
  62. package/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +23 -0
  63. package/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js.map +1 -0
  64. package/lib/cmap/auth/mongodb_oidc.js +73 -0
  65. package/lib/cmap/auth/mongodb_oidc.js.map +1 -0
  66. package/lib/cmap/auth/plain.js +26 -0
  67. package/lib/cmap/auth/plain.js.map +1 -0
  68. package/lib/cmap/auth/providers.js +22 -0
  69. package/lib/cmap/auth/providers.js.map +1 -0
  70. package/lib/cmap/auth/scram.js +254 -0
  71. package/lib/cmap/auth/scram.js.map +1 -0
  72. package/lib/cmap/auth/x509.js +36 -0
  73. package/lib/cmap/auth/x509.js.map +1 -0
  74. package/lib/cmap/command_monitoring_events.js +223 -0
  75. package/lib/cmap/command_monitoring_events.js.map +1 -0
  76. package/lib/cmap/commands.js +535 -0
  77. package/lib/cmap/commands.js.map +1 -0
  78. package/lib/cmap/connect.js +381 -0
  79. package/lib/cmap/connect.js.map +1 -0
  80. package/lib/cmap/connection.js +571 -0
  81. package/lib/cmap/connection.js.map +1 -0
  82. package/lib/cmap/connection_pool.js +558 -0
  83. package/lib/cmap/connection_pool.js.map +1 -0
  84. package/lib/cmap/connection_pool_events.js +190 -0
  85. package/lib/cmap/connection_pool_events.js.map +1 -0
  86. package/lib/cmap/errors.js +108 -0
  87. package/lib/cmap/errors.js.map +1 -0
  88. package/lib/cmap/handshake/client_metadata.js +242 -0
  89. package/lib/cmap/handshake/client_metadata.js.map +1 -0
  90. package/lib/cmap/metrics.js +62 -0
  91. package/lib/cmap/metrics.js.map +1 -0
  92. package/lib/cmap/stream_description.js +70 -0
  93. package/lib/cmap/stream_description.js.map +1 -0
  94. package/lib/cmap/wire_protocol/compression.js +178 -0
  95. package/lib/cmap/wire_protocol/compression.js.map +1 -0
  96. package/lib/cmap/wire_protocol/constants.js +21 -0
  97. package/lib/cmap/wire_protocol/constants.js.map +1 -0
  98. package/lib/cmap/wire_protocol/on_data.js +111 -0
  99. package/lib/cmap/wire_protocol/on_data.js.map +1 -0
  100. package/lib/cmap/wire_protocol/on_demand/document.js +222 -0
  101. package/lib/cmap/wire_protocol/on_demand/document.js.map +1 -0
  102. package/lib/cmap/wire_protocol/responses.js +315 -0
  103. package/lib/cmap/wire_protocol/responses.js.map +1 -0
  104. package/lib/cmap/wire_protocol/shared.js +35 -0
  105. package/lib/cmap/wire_protocol/shared.js.map +1 -0
  106. package/lib/collection.js +751 -0
  107. package/lib/collection.js.map +1 -0
  108. package/lib/connection_string.js +1090 -0
  109. package/lib/connection_string.js.map +1 -0
  110. package/lib/constants.js +170 -0
  111. package/lib/constants.js.map +1 -0
  112. package/lib/cursor/abstract_cursor.js +924 -0
  113. package/lib/cursor/abstract_cursor.js.map +1 -0
  114. package/lib/cursor/aggregation_cursor.js +164 -0
  115. package/lib/cursor/aggregation_cursor.js.map +1 -0
  116. package/lib/cursor/change_stream_cursor.js +104 -0
  117. package/lib/cursor/change_stream_cursor.js.map +1 -0
  118. package/lib/cursor/client_bulk_write_cursor.js +52 -0
  119. package/lib/cursor/client_bulk_write_cursor.js.map +1 -0
  120. package/lib/cursor/explainable_cursor.js +36 -0
  121. package/lib/cursor/explainable_cursor.js.map +1 -0
  122. package/lib/cursor/find_cursor.js +399 -0
  123. package/lib/cursor/find_cursor.js.map +1 -0
  124. package/lib/cursor/list_collections_cursor.js +34 -0
  125. package/lib/cursor/list_collections_cursor.js.map +1 -0
  126. package/lib/cursor/list_indexes_cursor.js +32 -0
  127. package/lib/cursor/list_indexes_cursor.js.map +1 -0
  128. package/lib/cursor/list_search_indexes_cursor.js +14 -0
  129. package/lib/cursor/list_search_indexes_cursor.js.map +1 -0
  130. package/lib/cursor/run_command_cursor.js +94 -0
  131. package/lib/cursor/run_command_cursor.js.map +1 -0
  132. package/lib/db.js +419 -0
  133. package/lib/db.js.map +1 -0
  134. package/lib/deps.js +112 -0
  135. package/lib/deps.js.map +1 -0
  136. package/lib/encrypter.js +106 -0
  137. package/lib/encrypter.js.map +1 -0
  138. package/lib/error.js +1380 -0
  139. package/lib/error.js.map +1 -0
  140. package/lib/explain.js +59 -0
  141. package/lib/explain.js.map +1 -0
  142. package/lib/gridfs/download.js +305 -0
  143. package/lib/gridfs/download.js.map +1 -0
  144. package/lib/gridfs/index.js +164 -0
  145. package/lib/gridfs/index.js.map +1 -0
  146. package/lib/gridfs/upload.js +358 -0
  147. package/lib/gridfs/upload.js.map +1 -0
  148. package/lib/index.js +193 -0
  149. package/lib/index.js.map +1 -0
  150. package/lib/mongo_client.js +557 -0
  151. package/lib/mongo_client.js.map +1 -0
  152. package/lib/mongo_client_auth_providers.js +80 -0
  153. package/lib/mongo_client_auth_providers.js.map +1 -0
  154. package/lib/mongo_logger.js +655 -0
  155. package/lib/mongo_logger.js.map +1 -0
  156. package/lib/mongo_types.js +56 -0
  157. package/lib/mongo_types.js.map +1 -0
  158. package/lib/operations/aggregate.js +90 -0
  159. package/lib/operations/aggregate.js.map +1 -0
  160. package/lib/operations/client_bulk_write/client_bulk_write.js +51 -0
  161. package/lib/operations/client_bulk_write/client_bulk_write.js.map +1 -0
  162. package/lib/operations/client_bulk_write/command_builder.js +340 -0
  163. package/lib/operations/client_bulk_write/command_builder.js.map +1 -0
  164. package/lib/operations/client_bulk_write/common.js +3 -0
  165. package/lib/operations/client_bulk_write/common.js.map +1 -0
  166. package/lib/operations/client_bulk_write/executor.js +120 -0
  167. package/lib/operations/client_bulk_write/executor.js.map +1 -0
  168. package/lib/operations/client_bulk_write/results_merger.js +204 -0
  169. package/lib/operations/client_bulk_write/results_merger.js.map +1 -0
  170. package/lib/operations/command.js +83 -0
  171. package/lib/operations/command.js.map +1 -0
  172. package/lib/operations/count.js +45 -0
  173. package/lib/operations/count.js.map +1 -0
  174. package/lib/operations/create_collection.js +109 -0
  175. package/lib/operations/create_collection.js.map +1 -0
  176. package/lib/operations/delete.js +125 -0
  177. package/lib/operations/delete.js.map +1 -0
  178. package/lib/operations/distinct.js +61 -0
  179. package/lib/operations/distinct.js.map +1 -0
  180. package/lib/operations/drop.js +93 -0
  181. package/lib/operations/drop.js.map +1 -0
  182. package/lib/operations/end_sessions.js +34 -0
  183. package/lib/operations/end_sessions.js.map +1 -0
  184. package/lib/operations/estimated_document_count.js +41 -0
  185. package/lib/operations/estimated_document_count.js.map +1 -0
  186. package/lib/operations/execute_operation.js +239 -0
  187. package/lib/operations/execute_operation.js.map +1 -0
  188. package/lib/operations/find.js +148 -0
  189. package/lib/operations/find.js.map +1 -0
  190. package/lib/operations/find_and_modify.js +158 -0
  191. package/lib/operations/find_and_modify.js.map +1 -0
  192. package/lib/operations/get_more.js +62 -0
  193. package/lib/operations/get_more.js.map +1 -0
  194. package/lib/operations/indexes.js +186 -0
  195. package/lib/operations/indexes.js.map +1 -0
  196. package/lib/operations/insert.js +70 -0
  197. package/lib/operations/insert.js.map +1 -0
  198. package/lib/operations/kill_cursors.js +43 -0
  199. package/lib/operations/kill_cursors.js.map +1 -0
  200. package/lib/operations/list_collections.js +53 -0
  201. package/lib/operations/list_collections.js.map +1 -0
  202. package/lib/operations/list_databases.js +40 -0
  203. package/lib/operations/list_databases.js.map +1 -0
  204. package/lib/operations/operation.js +102 -0
  205. package/lib/operations/operation.js.map +1 -0
  206. package/lib/operations/profiling_level.js +43 -0
  207. package/lib/operations/profiling_level.js.map +1 -0
  208. package/lib/operations/remove_user.js +27 -0
  209. package/lib/operations/remove_user.js.map +1 -0
  210. package/lib/operations/rename.js +38 -0
  211. package/lib/operations/rename.js.map +1 -0
  212. package/lib/operations/run_command.js +47 -0
  213. package/lib/operations/run_command.js.map +1 -0
  214. package/lib/operations/search_indexes/create.js +33 -0
  215. package/lib/operations/search_indexes/create.js.map +1 -0
  216. package/lib/operations/search_indexes/drop.js +43 -0
  217. package/lib/operations/search_indexes/drop.js.map +1 -0
  218. package/lib/operations/search_indexes/update.js +35 -0
  219. package/lib/operations/search_indexes/update.js.map +1 -0
  220. package/lib/operations/set_profiling_level.js +53 -0
  221. package/lib/operations/set_profiling_level.js.map +1 -0
  222. package/lib/operations/stats.js +27 -0
  223. package/lib/operations/stats.js.map +1 -0
  224. package/lib/operations/update.js +188 -0
  225. package/lib/operations/update.js.map +1 -0
  226. package/lib/operations/validate_collection.js +37 -0
  227. package/lib/operations/validate_collection.js.map +1 -0
  228. package/lib/read_concern.js +73 -0
  229. package/lib/read_concern.js.map +1 -0
  230. package/lib/read_preference.js +191 -0
  231. package/lib/read_preference.js.map +1 -0
  232. package/lib/sdam/common.js +49 -0
  233. package/lib/sdam/common.js.map +1 -0
  234. package/lib/sdam/events.js +146 -0
  235. package/lib/sdam/events.js.map +1 -0
  236. package/lib/sdam/monitor.js +544 -0
  237. package/lib/sdam/monitor.js.map +1 -0
  238. package/lib/sdam/server.js +404 -0
  239. package/lib/sdam/server.js.map +1 -0
  240. package/lib/sdam/server_description.js +204 -0
  241. package/lib/sdam/server_description.js.map +1 -0
  242. package/lib/sdam/server_selection.js +294 -0
  243. package/lib/sdam/server_selection.js.map +1 -0
  244. package/lib/sdam/server_selection_events.js +85 -0
  245. package/lib/sdam/server_selection_events.js.map +1 -0
  246. package/lib/sdam/srv_polling.js +108 -0
  247. package/lib/sdam/srv_polling.js.map +1 -0
  248. package/lib/sdam/topology.js +652 -0
  249. package/lib/sdam/topology.js.map +1 -0
  250. package/lib/sdam/topology_description.js +383 -0
  251. package/lib/sdam/topology_description.js.map +1 -0
  252. package/lib/sessions.js +892 -0
  253. package/lib/sessions.js.map +1 -0
  254. package/lib/sort.js +103 -0
  255. package/lib/sort.js.map +1 -0
  256. package/lib/timeout.js +296 -0
  257. package/lib/timeout.js.map +1 -0
  258. package/lib/transactions.js +135 -0
  259. package/lib/transactions.js.map +1 -0
  260. package/lib/utils.js +1163 -0
  261. package/lib/utils.js.map +1 -0
  262. package/lib/write_concern.js +100 -0
  263. package/lib/write_concern.js.map +1 -0
  264. package/mongodb.d.ts +9018 -0
  265. package/package.json +197 -0
  266. package/src/admin.ts +173 -0
  267. package/src/bson.ts +149 -0
  268. package/src/bulk/common.ts +1251 -0
  269. package/src/bulk/ordered.ts +83 -0
  270. package/src/bulk/unordered.ts +115 -0
  271. package/src/change_stream.ts +1160 -0
  272. package/src/client-side-encryption/auto_encrypter.ts +469 -0
  273. package/src/client-side-encryption/client_encryption.ts +1150 -0
  274. package/src/client-side-encryption/errors.ts +144 -0
  275. package/src/client-side-encryption/mongocryptd_manager.ts +100 -0
  276. package/src/client-side-encryption/providers/aws.ts +33 -0
  277. package/src/client-side-encryption/providers/azure.ts +181 -0
  278. package/src/client-side-encryption/providers/gcp.ts +16 -0
  279. package/src/client-side-encryption/providers/index.ts +207 -0
  280. package/src/client-side-encryption/state_machine.ts +651 -0
  281. package/src/cmap/auth/auth_provider.ts +77 -0
  282. package/src/cmap/auth/aws4.ts +207 -0
  283. package/src/cmap/auth/aws_temporary_credentials.ts +129 -0
  284. package/src/cmap/auth/gssapi.ts +203 -0
  285. package/src/cmap/auth/mongo_credentials.ts +292 -0
  286. package/src/cmap/auth/mongodb_aws.ts +179 -0
  287. package/src/cmap/auth/mongodb_oidc/automated_callback_workflow.ts +88 -0
  288. package/src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts +73 -0
  289. package/src/cmap/auth/mongodb_oidc/callback_workflow.ts +188 -0
  290. package/src/cmap/auth/mongodb_oidc/command_builders.ts +53 -0
  291. package/src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts +46 -0
  292. package/src/cmap/auth/mongodb_oidc/human_callback_workflow.ts +141 -0
  293. package/src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts +31 -0
  294. package/src/cmap/auth/mongodb_oidc/token_cache.ts +62 -0
  295. package/src/cmap/auth/mongodb_oidc/token_machine_workflow.ts +22 -0
  296. package/src/cmap/auth/mongodb_oidc.ts +185 -0
  297. package/src/cmap/auth/plain.ts +25 -0
  298. package/src/cmap/auth/providers.ts +22 -0
  299. package/src/cmap/auth/scram.ts +344 -0
  300. package/src/cmap/auth/x509.ts +43 -0
  301. package/src/cmap/command_monitoring_events.ts +316 -0
  302. package/src/cmap/commands.ts +788 -0
  303. package/src/cmap/connect.ts +518 -0
  304. package/src/cmap/connection.ts +931 -0
  305. package/src/cmap/connection_pool.ts +831 -0
  306. package/src/cmap/connection_pool_events.ts +300 -0
  307. package/src/cmap/errors.ts +119 -0
  308. package/src/cmap/handshake/client_metadata.ts +353 -0
  309. package/src/cmap/metrics.ts +58 -0
  310. package/src/cmap/stream_description.ts +96 -0
  311. package/src/cmap/wire_protocol/compression.ts +211 -0
  312. package/src/cmap/wire_protocol/constants.ts +17 -0
  313. package/src/cmap/wire_protocol/on_data.ts +139 -0
  314. package/src/cmap/wire_protocol/on_demand/document.ts +358 -0
  315. package/src/cmap/wire_protocol/responses.ts +393 -0
  316. package/src/cmap/wire_protocol/shared.ts +48 -0
  317. package/src/collection.ts +1314 -0
  318. package/src/connection_string.ts +1297 -0
  319. package/src/constants.ts +176 -0
  320. package/src/cursor/abstract_cursor.ts +1247 -0
  321. package/src/cursor/aggregation_cursor.ts +245 -0
  322. package/src/cursor/change_stream_cursor.ts +171 -0
  323. package/src/cursor/client_bulk_write_cursor.ts +83 -0
  324. package/src/cursor/explainable_cursor.ts +51 -0
  325. package/src/cursor/find_cursor.ts +497 -0
  326. package/src/cursor/list_collections_cursor.ts +50 -0
  327. package/src/cursor/list_indexes_cursor.ts +37 -0
  328. package/src/cursor/list_search_indexes_cursor.ts +20 -0
  329. package/src/cursor/run_command_cursor.ts +178 -0
  330. package/src/db.ts +621 -0
  331. package/src/deps.ts +227 -0
  332. package/src/encrypter.ts +127 -0
  333. package/src/error.ts +1567 -0
  334. package/src/explain.ts +124 -0
  335. package/src/gridfs/download.ts +483 -0
  336. package/src/gridfs/index.ts +264 -0
  337. package/src/gridfs/upload.ts +537 -0
  338. package/src/index.ts +633 -0
  339. package/src/mongo_client.ts +1155 -0
  340. package/src/mongo_client_auth_providers.ts +87 -0
  341. package/src/mongo_logger.ts +1081 -0
  342. package/src/mongo_types.ts +678 -0
  343. package/src/operations/aggregate.ts +153 -0
  344. package/src/operations/client_bulk_write/client_bulk_write.ts +72 -0
  345. package/src/operations/client_bulk_write/command_builder.ts +487 -0
  346. package/src/operations/client_bulk_write/common.ts +276 -0
  347. package/src/operations/client_bulk_write/executor.ts +149 -0
  348. package/src/operations/client_bulk_write/results_merger.ts +260 -0
  349. package/src/operations/command.ts +171 -0
  350. package/src/operations/count.ts +74 -0
  351. package/src/operations/create_collection.ts +218 -0
  352. package/src/operations/delete.ts +183 -0
  353. package/src/operations/distinct.ts +92 -0
  354. package/src/operations/drop.ts +130 -0
  355. package/src/operations/end_sessions.ts +44 -0
  356. package/src/operations/estimated_document_count.ts +61 -0
  357. package/src/operations/execute_operation.ts +319 -0
  358. package/src/operations/find.ts +254 -0
  359. package/src/operations/find_and_modify.ts +319 -0
  360. package/src/operations/get_more.ts +108 -0
  361. package/src/operations/indexes.ts +418 -0
  362. package/src/operations/insert.ts +108 -0
  363. package/src/operations/kill_cursors.ts +64 -0
  364. package/src/operations/list_collections.ts +108 -0
  365. package/src/operations/list_databases.ts +68 -0
  366. package/src/operations/operation.ts +181 -0
  367. package/src/operations/profiling_level.ts +46 -0
  368. package/src/operations/remove_user.ts +36 -0
  369. package/src/operations/rename.ts +60 -0
  370. package/src/operations/run_command.ts +79 -0
  371. package/src/operations/search_indexes/create.ts +56 -0
  372. package/src/operations/search_indexes/drop.ts +58 -0
  373. package/src/operations/search_indexes/update.ts +45 -0
  374. package/src/operations/set_profiling_level.ts +74 -0
  375. package/src/operations/stats.ts +37 -0
  376. package/src/operations/update.ts +318 -0
  377. package/src/operations/validate_collection.ts +50 -0
  378. package/src/read_concern.ts +88 -0
  379. package/src/read_preference.ts +256 -0
  380. package/src/sdam/common.ts +74 -0
  381. package/src/sdam/events.ts +219 -0
  382. package/src/sdam/monitor.ts +771 -0
  383. package/src/sdam/server.ts +595 -0
  384. package/src/sdam/server_description.ts +297 -0
  385. package/src/sdam/server_selection.ts +415 -0
  386. package/src/sdam/server_selection_events.ts +142 -0
  387. package/src/sdam/srv_polling.ts +146 -0
  388. package/src/sdam/topology.ts +1100 -0
  389. package/src/sdam/topology_description.ts +548 -0
  390. package/src/sessions.ts +1244 -0
  391. package/src/sort.ts +141 -0
  392. package/src/timeout.ts +405 -0
  393. package/src/transactions.ts +181 -0
  394. package/src/utils.ts +1434 -0
  395. package/src/write_concern.ts +183 -0
  396. package/tsconfig.json +46 -0
@@ -0,0 +1,558 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionPool = exports.PoolState = void 0;
4
+ const timers_1 = require("timers");
5
+ const constants_1 = require("../constants");
6
+ const error_1 = require("../error");
7
+ const mongo_types_1 = require("../mongo_types");
8
+ const timeout_1 = require("../timeout");
9
+ const utils_1 = require("../utils");
10
+ const connect_1 = require("./connect");
11
+ const connection_1 = require("./connection");
12
+ const connection_pool_events_1 = require("./connection_pool_events");
13
+ const errors_1 = require("./errors");
14
+ const metrics_1 = require("./metrics");
15
+ /** @internal */
16
+ exports.PoolState = Object.freeze({
17
+ paused: 'paused',
18
+ ready: 'ready',
19
+ closed: 'closed'
20
+ });
21
+ /**
22
+ * A pool of connections which dynamically resizes, and emit events related to pool activity
23
+ * @internal
24
+ */
25
+ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
26
+ /**
27
+ * Emitted when the connection pool is created.
28
+ * @event
29
+ */
30
+ static { this.CONNECTION_POOL_CREATED = constants_1.CONNECTION_POOL_CREATED; }
31
+ /**
32
+ * Emitted once when the connection pool is closed
33
+ * @event
34
+ */
35
+ static { this.CONNECTION_POOL_CLOSED = constants_1.CONNECTION_POOL_CLOSED; }
36
+ /**
37
+ * Emitted each time the connection pool is cleared and it's generation incremented
38
+ * @event
39
+ */
40
+ static { this.CONNECTION_POOL_CLEARED = constants_1.CONNECTION_POOL_CLEARED; }
41
+ /**
42
+ * Emitted each time the connection pool is marked ready
43
+ * @event
44
+ */
45
+ static { this.CONNECTION_POOL_READY = constants_1.CONNECTION_POOL_READY; }
46
+ /**
47
+ * Emitted when a connection is created.
48
+ * @event
49
+ */
50
+ static { this.CONNECTION_CREATED = constants_1.CONNECTION_CREATED; }
51
+ /**
52
+ * Emitted when a connection becomes established, and is ready to use
53
+ * @event
54
+ */
55
+ static { this.CONNECTION_READY = constants_1.CONNECTION_READY; }
56
+ /**
57
+ * Emitted when a connection is closed
58
+ * @event
59
+ */
60
+ static { this.CONNECTION_CLOSED = constants_1.CONNECTION_CLOSED; }
61
+ /**
62
+ * Emitted when an attempt to check out a connection begins
63
+ * @event
64
+ */
65
+ static { this.CONNECTION_CHECK_OUT_STARTED = constants_1.CONNECTION_CHECK_OUT_STARTED; }
66
+ /**
67
+ * Emitted when an attempt to check out a connection fails
68
+ * @event
69
+ */
70
+ static { this.CONNECTION_CHECK_OUT_FAILED = constants_1.CONNECTION_CHECK_OUT_FAILED; }
71
+ /**
72
+ * Emitted each time a connection is successfully checked out of the connection pool
73
+ * @event
74
+ */
75
+ static { this.CONNECTION_CHECKED_OUT = constants_1.CONNECTION_CHECKED_OUT; }
76
+ /**
77
+ * Emitted each time a connection is successfully checked into the connection pool
78
+ * @event
79
+ */
80
+ static { this.CONNECTION_CHECKED_IN = constants_1.CONNECTION_CHECKED_IN; }
81
+ constructor(server, options) {
82
+ super();
83
+ this.on('error', utils_1.noop);
84
+ this.options = Object.freeze({
85
+ connectionType: connection_1.Connection,
86
+ ...options,
87
+ maxPoolSize: options.maxPoolSize ?? 100,
88
+ minPoolSize: options.minPoolSize ?? 0,
89
+ maxConnecting: options.maxConnecting ?? 2,
90
+ maxIdleTimeMS: options.maxIdleTimeMS ?? 0,
91
+ waitQueueTimeoutMS: options.waitQueueTimeoutMS ?? 0,
92
+ minPoolSizeCheckFrequencyMS: options.minPoolSizeCheckFrequencyMS ?? 100,
93
+ autoEncrypter: options.autoEncrypter
94
+ });
95
+ if (this.options.minPoolSize > this.options.maxPoolSize) {
96
+ throw new error_1.MongoInvalidArgumentError('Connection pool minimum size must not be greater than maximum pool size');
97
+ }
98
+ this.poolState = exports.PoolState.paused;
99
+ this.server = server;
100
+ this.connections = new utils_1.List();
101
+ this.pending = 0;
102
+ this.checkedOut = new Set();
103
+ this.minPoolSizeTimer = undefined;
104
+ this.generation = 0;
105
+ this.serviceGenerations = new Map();
106
+ this.connectionCounter = (0, utils_1.makeCounter)(1);
107
+ this.cancellationToken = new mongo_types_1.CancellationToken();
108
+ this.cancellationToken.setMaxListeners(Infinity);
109
+ this.waitQueue = new utils_1.List();
110
+ this.metrics = new metrics_1.ConnectionPoolMetrics();
111
+ this.processingWaitQueue = false;
112
+ this.mongoLogger = this.server.topology.client?.mongoLogger;
113
+ this.component = 'connection';
114
+ queueMicrotask(() => {
115
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_CREATED, new connection_pool_events_1.ConnectionPoolCreatedEvent(this));
116
+ });
117
+ }
118
+ /** The address of the endpoint the pool is connected to */
119
+ get address() {
120
+ return this.options.hostAddress.toString();
121
+ }
122
+ /**
123
+ * Check if the pool has been closed
124
+ *
125
+ * TODO(NODE-3263): We can remove this property once shell no longer needs it
126
+ */
127
+ get closed() {
128
+ return this.poolState === exports.PoolState.closed;
129
+ }
130
+ /** An integer expressing how many total connections (available + pending + in use) the pool currently has */
131
+ get totalConnectionCount() {
132
+ return (this.availableConnectionCount + this.pendingConnectionCount + this.currentCheckedOutCount);
133
+ }
134
+ /** An integer expressing how many connections are currently available in the pool. */
135
+ get availableConnectionCount() {
136
+ return this.connections.length;
137
+ }
138
+ get pendingConnectionCount() {
139
+ return this.pending;
140
+ }
141
+ get currentCheckedOutCount() {
142
+ return this.checkedOut.size;
143
+ }
144
+ get waitQueueSize() {
145
+ return this.waitQueue.length;
146
+ }
147
+ get loadBalanced() {
148
+ return this.options.loadBalanced;
149
+ }
150
+ get serverError() {
151
+ return this.server.description.error;
152
+ }
153
+ /**
154
+ * This is exposed ONLY for use in mongosh, to enable
155
+ * killing all connections if a user quits the shell with
156
+ * operations in progress.
157
+ *
158
+ * This property may be removed as a part of NODE-3263.
159
+ */
160
+ get checkedOutConnections() {
161
+ return this.checkedOut;
162
+ }
163
+ /**
164
+ * Get the metrics information for the pool when a wait queue timeout occurs.
165
+ */
166
+ waitQueueErrorMetrics() {
167
+ return this.metrics.info(this.options.maxPoolSize);
168
+ }
169
+ /**
170
+ * Set the pool state to "ready"
171
+ */
172
+ ready() {
173
+ if (this.poolState !== exports.PoolState.paused) {
174
+ return;
175
+ }
176
+ this.poolState = exports.PoolState.ready;
177
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_READY, new connection_pool_events_1.ConnectionPoolReadyEvent(this));
178
+ (0, timers_1.clearTimeout)(this.minPoolSizeTimer);
179
+ this.ensureMinPoolSize();
180
+ }
181
+ /**
182
+ * Check a connection out of this pool. The connection will continue to be tracked, but no reference to it
183
+ * will be held by the pool. This means that if a connection is checked out it MUST be checked back in or
184
+ * explicitly destroyed by the new owner.
185
+ */
186
+ async checkOut(options) {
187
+ const checkoutTime = (0, utils_1.processTimeMS)();
188
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_STARTED, new connection_pool_events_1.ConnectionCheckOutStartedEvent(this));
189
+ const { promise, resolve, reject } = (0, utils_1.promiseWithResolvers)();
190
+ const timeout = options.timeoutContext.connectionCheckoutTimeout;
191
+ const waitQueueMember = {
192
+ resolve,
193
+ reject,
194
+ cancelled: false,
195
+ checkoutTime
196
+ };
197
+ const abortListener = (0, utils_1.addAbortListener)(options.signal, function () {
198
+ waitQueueMember.cancelled = true;
199
+ reject(this.reason);
200
+ });
201
+ this.waitQueue.push(waitQueueMember);
202
+ queueMicrotask(() => this.processWaitQueue());
203
+ try {
204
+ timeout?.throwIfExpired();
205
+ return await (timeout ? Promise.race([promise, timeout]) : promise);
206
+ }
207
+ catch (error) {
208
+ if (timeout_1.TimeoutError.is(error)) {
209
+ timeout?.clear();
210
+ waitQueueMember.cancelled = true;
211
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_FAILED, new connection_pool_events_1.ConnectionCheckOutFailedEvent(this, 'timeout', waitQueueMember.checkoutTime));
212
+ const timeoutError = new errors_1.WaitQueueTimeoutError(this.loadBalanced
213
+ ? this.waitQueueErrorMetrics()
214
+ : 'Timed out while checking out a connection from connection pool', this.address);
215
+ if (options.timeoutContext.csotEnabled()) {
216
+ throw new error_1.MongoOperationTimeoutError('Timed out during connection checkout', {
217
+ cause: timeoutError
218
+ });
219
+ }
220
+ throw timeoutError;
221
+ }
222
+ throw error;
223
+ }
224
+ finally {
225
+ abortListener?.[utils_1.kDispose]();
226
+ timeout?.clear();
227
+ }
228
+ }
229
+ /**
230
+ * Check a connection into the pool.
231
+ *
232
+ * @param connection - The connection to check in
233
+ */
234
+ checkIn(connection) {
235
+ if (!this.checkedOut.has(connection)) {
236
+ return;
237
+ }
238
+ const poolClosed = this.closed;
239
+ const stale = this.connectionIsStale(connection);
240
+ const willDestroy = !!(poolClosed || stale || connection.closed);
241
+ if (!willDestroy) {
242
+ connection.markAvailable();
243
+ this.connections.unshift(connection);
244
+ }
245
+ this.checkedOut.delete(connection);
246
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECKED_IN, new connection_pool_events_1.ConnectionCheckedInEvent(this, connection));
247
+ if (willDestroy) {
248
+ const reason = connection.closed ? 'error' : poolClosed ? 'poolClosed' : 'stale';
249
+ this.destroyConnection(connection, reason);
250
+ }
251
+ queueMicrotask(() => this.processWaitQueue());
252
+ }
253
+ /**
254
+ * Clear the pool
255
+ *
256
+ * Pool reset is handled by incrementing the pool's generation count. Any existing connection of a
257
+ * previous generation will eventually be pruned during subsequent checkouts.
258
+ */
259
+ clear(options = {}) {
260
+ if (this.closed) {
261
+ return;
262
+ }
263
+ // handle load balanced case
264
+ if (this.loadBalanced) {
265
+ const { serviceId } = options;
266
+ if (!serviceId) {
267
+ throw new error_1.MongoRuntimeError('ConnectionPool.clear() called in load balanced mode with no serviceId.');
268
+ }
269
+ const sid = serviceId.toHexString();
270
+ const generation = this.serviceGenerations.get(sid);
271
+ // Only need to worry if the generation exists, since it should
272
+ // always be there but typescript needs the check.
273
+ if (generation == null) {
274
+ throw new error_1.MongoRuntimeError('Service generations are required in load balancer mode.');
275
+ }
276
+ else {
277
+ // Increment the generation for the service id.
278
+ this.serviceGenerations.set(sid, generation + 1);
279
+ }
280
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_CLEARED, new connection_pool_events_1.ConnectionPoolClearedEvent(this, { serviceId }));
281
+ return;
282
+ }
283
+ // handle non load-balanced case
284
+ const interruptInUseConnections = options.interruptInUseConnections ?? false;
285
+ const oldGeneration = this.generation;
286
+ this.generation += 1;
287
+ const alreadyPaused = this.poolState === exports.PoolState.paused;
288
+ this.poolState = exports.PoolState.paused;
289
+ this.clearMinPoolSizeTimer();
290
+ if (!alreadyPaused) {
291
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_CLEARED, new connection_pool_events_1.ConnectionPoolClearedEvent(this, {
292
+ interruptInUseConnections
293
+ }));
294
+ }
295
+ if (interruptInUseConnections) {
296
+ queueMicrotask(() => this.interruptInUseConnections(oldGeneration));
297
+ }
298
+ this.processWaitQueue();
299
+ }
300
+ /**
301
+ * Closes all stale in-use connections in the pool with a resumable PoolClearedOnNetworkError.
302
+ *
303
+ * Only connections where `connection.generation <= minGeneration` are killed.
304
+ */
305
+ interruptInUseConnections(minGeneration) {
306
+ for (const connection of this.checkedOut) {
307
+ if (connection.generation <= minGeneration) {
308
+ connection.onError(new errors_1.PoolClearedOnNetworkError(this));
309
+ }
310
+ }
311
+ }
312
+ /** For MongoClient.close() procedures */
313
+ closeCheckedOutConnections() {
314
+ for (const conn of this.checkedOut) {
315
+ conn.onError(new error_1.MongoClientClosedError());
316
+ }
317
+ }
318
+ /** Close the pool */
319
+ close() {
320
+ if (this.closed) {
321
+ return;
322
+ }
323
+ // immediately cancel any in-flight connections
324
+ this.cancellationToken.emit('cancel');
325
+ // end the connection counter
326
+ if (typeof this.connectionCounter.return === 'function') {
327
+ this.connectionCounter.return(undefined);
328
+ }
329
+ this.poolState = exports.PoolState.closed;
330
+ this.clearMinPoolSizeTimer();
331
+ this.processWaitQueue();
332
+ for (const conn of this.connections) {
333
+ this.emitAndLog(ConnectionPool.CONNECTION_CLOSED, new connection_pool_events_1.ConnectionClosedEvent(this, conn, 'poolClosed'));
334
+ conn.destroy();
335
+ }
336
+ this.connections.clear();
337
+ this.emitAndLog(ConnectionPool.CONNECTION_POOL_CLOSED, new connection_pool_events_1.ConnectionPoolClosedEvent(this));
338
+ }
339
+ /**
340
+ * @internal
341
+ * Reauthenticate a connection
342
+ */
343
+ async reauthenticate(connection) {
344
+ const authContext = connection.authContext;
345
+ if (!authContext) {
346
+ throw new error_1.MongoRuntimeError('No auth context found on connection.');
347
+ }
348
+ const credentials = authContext.credentials;
349
+ if (!credentials) {
350
+ throw new error_1.MongoMissingCredentialsError('Connection is missing credentials when asked to reauthenticate');
351
+ }
352
+ const resolvedCredentials = credentials.resolveAuthMechanism(connection.hello);
353
+ const provider = this.server.topology.client.s.authProviders.getOrCreateProvider(resolvedCredentials.mechanism, resolvedCredentials.mechanismProperties);
354
+ if (!provider) {
355
+ throw new error_1.MongoMissingCredentialsError(`Reauthenticate failed due to no auth provider for ${credentials.mechanism}`);
356
+ }
357
+ await provider.reauth(authContext);
358
+ return;
359
+ }
360
+ /** Clear the min pool size timer */
361
+ clearMinPoolSizeTimer() {
362
+ const minPoolSizeTimer = this.minPoolSizeTimer;
363
+ if (minPoolSizeTimer) {
364
+ (0, timers_1.clearTimeout)(minPoolSizeTimer);
365
+ }
366
+ }
367
+ destroyConnection(connection, reason) {
368
+ this.emitAndLog(ConnectionPool.CONNECTION_CLOSED, new connection_pool_events_1.ConnectionClosedEvent(this, connection, reason));
369
+ // destroy the connection
370
+ connection.destroy();
371
+ }
372
+ connectionIsStale(connection) {
373
+ const serviceId = connection.serviceId;
374
+ if (this.loadBalanced && serviceId) {
375
+ const sid = serviceId.toHexString();
376
+ const generation = this.serviceGenerations.get(sid);
377
+ return connection.generation !== generation;
378
+ }
379
+ return connection.generation !== this.generation;
380
+ }
381
+ connectionIsIdle(connection) {
382
+ return !!(this.options.maxIdleTimeMS && connection.idleTime > this.options.maxIdleTimeMS);
383
+ }
384
+ /**
385
+ * Destroys a connection if the connection is perished.
386
+ *
387
+ * @returns `true` if the connection was destroyed, `false` otherwise.
388
+ */
389
+ destroyConnectionIfPerished(connection) {
390
+ const isStale = this.connectionIsStale(connection);
391
+ const isIdle = this.connectionIsIdle(connection);
392
+ if (!isStale && !isIdle && !connection.closed) {
393
+ return false;
394
+ }
395
+ const reason = connection.closed ? 'error' : isStale ? 'stale' : 'idle';
396
+ this.destroyConnection(connection, reason);
397
+ return true;
398
+ }
399
+ createConnection(callback) {
400
+ // Note that metadata may have changed on the client but have
401
+ // been frozen here, so we pull the metadata promise always from the client
402
+ // no matter what options were set at the construction of the pool.
403
+ const connectOptions = {
404
+ ...this.options,
405
+ id: this.connectionCounter.next().value,
406
+ generation: this.generation,
407
+ cancellationToken: this.cancellationToken,
408
+ mongoLogger: this.mongoLogger,
409
+ authProviders: this.server.topology.client.s.authProviders,
410
+ metadata: this.server.topology.client.options.metadata
411
+ };
412
+ this.pending++;
413
+ // This is our version of a "virtual" no-I/O connection as the spec requires
414
+ const connectionCreatedTime = (0, utils_1.processTimeMS)();
415
+ this.emitAndLog(ConnectionPool.CONNECTION_CREATED, new connection_pool_events_1.ConnectionCreatedEvent(this, { id: connectOptions.id }));
416
+ (0, connect_1.connect)(connectOptions).then(connection => {
417
+ // The pool might have closed since we started trying to create a connection
418
+ if (this.poolState !== exports.PoolState.ready) {
419
+ this.pending--;
420
+ connection.destroy();
421
+ callback(this.closed ? new errors_1.PoolClosedError(this) : new errors_1.PoolClearedError(this));
422
+ return;
423
+ }
424
+ // forward all events from the connection to the pool
425
+ for (const event of [...constants_1.APM_EVENTS, connection_1.Connection.CLUSTER_TIME_RECEIVED]) {
426
+ connection.on(event, (e) => this.emit(event, e));
427
+ }
428
+ if (this.loadBalanced) {
429
+ connection.on(connection_1.Connection.PINNED, pinType => this.metrics.markPinned(pinType));
430
+ connection.on(connection_1.Connection.UNPINNED, pinType => this.metrics.markUnpinned(pinType));
431
+ const serviceId = connection.serviceId;
432
+ if (serviceId) {
433
+ let generation;
434
+ const sid = serviceId.toHexString();
435
+ if ((generation = this.serviceGenerations.get(sid))) {
436
+ connection.generation = generation;
437
+ }
438
+ else {
439
+ this.serviceGenerations.set(sid, 0);
440
+ connection.generation = 0;
441
+ }
442
+ }
443
+ }
444
+ connection.markAvailable();
445
+ this.emitAndLog(ConnectionPool.CONNECTION_READY, new connection_pool_events_1.ConnectionReadyEvent(this, connection, connectionCreatedTime));
446
+ this.pending--;
447
+ callback(undefined, connection);
448
+ }, error => {
449
+ this.pending--;
450
+ this.server.handleError(error);
451
+ this.emitAndLog(ConnectionPool.CONNECTION_CLOSED, new connection_pool_events_1.ConnectionClosedEvent(this, { id: connectOptions.id, serviceId: undefined }, 'error',
452
+ // TODO(NODE-5192): Remove this cast
453
+ error));
454
+ if (error instanceof error_1.MongoNetworkError || error instanceof error_1.MongoServerError) {
455
+ error.connectionGeneration = connectOptions.generation;
456
+ }
457
+ callback(error ?? new error_1.MongoRuntimeError('Connection creation failed without error'));
458
+ });
459
+ }
460
+ ensureMinPoolSize() {
461
+ const minPoolSize = this.options.minPoolSize;
462
+ if (this.poolState !== exports.PoolState.ready) {
463
+ return;
464
+ }
465
+ this.connections.prune(connection => this.destroyConnectionIfPerished(connection));
466
+ if (this.totalConnectionCount < minPoolSize &&
467
+ this.pendingConnectionCount < this.options.maxConnecting) {
468
+ // NOTE: ensureMinPoolSize should not try to get all the pending
469
+ // connection permits because that potentially delays the availability of
470
+ // the connection to a checkout request
471
+ this.createConnection((err, connection) => {
472
+ if (!err && connection) {
473
+ this.connections.push(connection);
474
+ queueMicrotask(() => this.processWaitQueue());
475
+ }
476
+ if (this.poolState === exports.PoolState.ready) {
477
+ (0, timers_1.clearTimeout)(this.minPoolSizeTimer);
478
+ this.minPoolSizeTimer = (0, timers_1.setTimeout)(() => this.ensureMinPoolSize(), this.options.minPoolSizeCheckFrequencyMS);
479
+ }
480
+ });
481
+ }
482
+ else {
483
+ (0, timers_1.clearTimeout)(this.minPoolSizeTimer);
484
+ this.minPoolSizeTimer = (0, timers_1.setTimeout)(() => this.ensureMinPoolSize(), this.options.minPoolSizeCheckFrequencyMS);
485
+ }
486
+ }
487
+ processWaitQueue() {
488
+ if (this.processingWaitQueue) {
489
+ return;
490
+ }
491
+ this.processingWaitQueue = true;
492
+ while (this.waitQueueSize) {
493
+ const waitQueueMember = this.waitQueue.first();
494
+ if (!waitQueueMember) {
495
+ this.waitQueue.shift();
496
+ continue;
497
+ }
498
+ if (waitQueueMember.cancelled) {
499
+ this.waitQueue.shift();
500
+ continue;
501
+ }
502
+ if (this.poolState !== exports.PoolState.ready) {
503
+ const reason = this.closed ? 'poolClosed' : 'connectionError';
504
+ const error = this.closed ? new errors_1.PoolClosedError(this) : new errors_1.PoolClearedError(this);
505
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_FAILED, new connection_pool_events_1.ConnectionCheckOutFailedEvent(this, reason, waitQueueMember.checkoutTime, error));
506
+ this.waitQueue.shift();
507
+ waitQueueMember.reject(error);
508
+ continue;
509
+ }
510
+ if (!this.availableConnectionCount) {
511
+ break;
512
+ }
513
+ const connection = this.connections.shift();
514
+ if (!connection) {
515
+ break;
516
+ }
517
+ if (!this.destroyConnectionIfPerished(connection)) {
518
+ this.checkedOut.add(connection);
519
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECKED_OUT, new connection_pool_events_1.ConnectionCheckedOutEvent(this, connection, waitQueueMember.checkoutTime));
520
+ this.waitQueue.shift();
521
+ waitQueueMember.resolve(connection);
522
+ }
523
+ }
524
+ const { maxPoolSize, maxConnecting } = this.options;
525
+ while (this.waitQueueSize > 0 &&
526
+ this.pendingConnectionCount < maxConnecting &&
527
+ (maxPoolSize === 0 || this.totalConnectionCount < maxPoolSize)) {
528
+ const waitQueueMember = this.waitQueue.shift();
529
+ if (!waitQueueMember || waitQueueMember.cancelled) {
530
+ continue;
531
+ }
532
+ this.createConnection((err, connection) => {
533
+ if (waitQueueMember.cancelled) {
534
+ if (!err && connection) {
535
+ this.connections.push(connection);
536
+ }
537
+ }
538
+ else {
539
+ if (err) {
540
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_FAILED,
541
+ // TODO(NODE-5192): Remove this cast
542
+ new connection_pool_events_1.ConnectionCheckOutFailedEvent(this, 'connectionError', waitQueueMember.checkoutTime, err));
543
+ waitQueueMember.reject(err);
544
+ }
545
+ else if (connection) {
546
+ this.checkedOut.add(connection);
547
+ this.emitAndLog(ConnectionPool.CONNECTION_CHECKED_OUT, new connection_pool_events_1.ConnectionCheckedOutEvent(this, connection, waitQueueMember.checkoutTime));
548
+ waitQueueMember.resolve(connection);
549
+ }
550
+ }
551
+ queueMicrotask(() => this.processWaitQueue());
552
+ });
553
+ }
554
+ this.processingWaitQueue = false;
555
+ }
556
+ }
557
+ exports.ConnectionPool = ConnectionPool;
558
+ //# sourceMappingURL=connection_pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection_pool.js","sourceRoot":"","sources":["../../src/cmap/connection_pool.ts"],"names":[],"mappings":";;;AAAA,mCAAkD;AAGlD,4CAasB;AACtB,oCAUkB;AAClB,gDAAsF;AAEtF,wCAA+D;AAC/D,oCASkB;AAClB,uCAAoC;AACpC,6CAAyF;AACzF,qEAYkC;AAClC,qCAKkB;AAClB,uCAAkD;AA4BlD,gBAAgB;AACH,QAAA,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACR,CAAC,CAAC;AAmBZ;;;GAGG;AACH,MAAa,cAAe,SAAQ,+BAAuC;IAmBzE;;;OAGG;aACa,4BAAuB,GAAG,mCAAuB,CAAC;IAClE;;;OAGG;aACa,2BAAsB,GAAG,kCAAsB,CAAC;IAChE;;;OAGG;aACa,4BAAuB,GAAG,mCAAuB,CAAC;IAClE;;;OAGG;aACa,0BAAqB,GAAG,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