oxygen-cli 1.40.1 → 1.40.2-beta.1

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 (441) hide show
  1. package/CHANGELOG.md +1742 -1742
  2. package/LICENSE +672 -672
  3. package/README.md +37 -37
  4. package/build/core/OxygenCore.js +1 -1
  5. package/build/core/OxygenEvents.js +1 -1
  6. package/build/core/OxygenModule.js +1 -1
  7. package/build/core/OxygenService.js +1 -1
  8. package/build/core/OxygenSubModule.js +1 -1
  9. package/build/core/WebDriverModule.js +1 -1
  10. package/build/core/utils.js +1 -1
  11. package/build/errors/HookError.js +1 -1
  12. package/build/errors/ModuleError.js +1 -1
  13. package/build/errors/ModuleUnavailableError.js +1 -1
  14. package/build/errors/OxygenError.js +1 -1
  15. package/build/errors/ScriptNotFound.js +1 -1
  16. package/build/errors/helper.js +2 -1
  17. package/build/index.js +1 -1
  18. package/build/lib/cli-util.js +5 -1
  19. package/build/lib/debugger.js +1 -1
  20. package/build/lib/img-merge.js +1 -1
  21. package/build/lib/launcher.js +1 -1
  22. package/build/lib/logger.js +43 -43
  23. package/build/lib/moduleRequire.js +1 -1
  24. package/build/lib/parallel-launcher.js +1 -1
  25. package/build/lib/param-manager.js +1 -1
  26. package/build/lib/param-reader-csv.js +1 -1
  27. package/build/lib/param-reader-excel.js +1 -1
  28. package/build/lib/param-reader-json.js +1 -1
  29. package/build/lib/text-to-image.js +1 -1
  30. package/build/lib/util.js +1 -1
  31. package/build/model/case-result.js +1 -1
  32. package/build/model/failure.js +1 -1
  33. package/build/model/status.js +1 -1
  34. package/build/model/step-result.js +1 -1
  35. package/build/model/suite-result.js +1 -1
  36. package/build/model/test-result.js +1 -1
  37. package/build/model/testcase.js +1 -1
  38. package/build/model/testsuite.js +1 -1
  39. package/build/ox_modules/index.js +9 -1
  40. package/build/ox_modules/module-assert.js +37 -37
  41. package/build/ox_modules/module-date.js +24 -24
  42. package/build/ox_modules/module-db.js +52 -52
  43. package/build/ox_modules/module-email.js +59 -59
  44. package/build/ox_modules/module-eyes.js +34 -34
  45. package/build/ox_modules/module-http/ntlm-util.js +10 -10
  46. package/build/ox_modules/module-http/ntlm.js +15 -15
  47. package/build/ox_modules/module-http.js +132 -132
  48. package/build/ox_modules/module-log.js +27 -27
  49. package/build/ox_modules/module-mailinator.js +87 -87
  50. package/build/ox_modules/module-mob/commands/alertAccept.js +17 -17
  51. package/build/ox_modules/module-mob/commands/alertDismiss.js +17 -17
  52. package/build/ox_modules/module-mob/commands/assertAlert.js +20 -20
  53. package/build/ox_modules/module-mob/commands/assertText.js +21 -21
  54. package/build/ox_modules/module-mob/commands/assertTitle.js +19 -19
  55. package/build/ox_modules/module-mob/commands/assertValue.js +18 -18
  56. package/build/ox_modules/module-mob/commands/back.js +16 -16
  57. package/build/ox_modules/module-mob/commands/clear.js +19 -19
  58. package/build/ox_modules/module-mob/commands/click.js +17 -17
  59. package/build/ox_modules/module-mob/commands/clickHidden.js +17 -17
  60. package/build/ox_modules/module-mob/commands/clickLong.js +18 -18
  61. package/build/ox_modules/module-mob/commands/clickMultipleTimes.js +18 -18
  62. package/build/ox_modules/module-mob/commands/closeApp.js +16 -16
  63. package/build/ox_modules/module-mob/commands/debug.js +16 -16
  64. package/build/ox_modules/module-mob/commands/dragAndDrop.js +19 -19
  65. package/build/ox_modules/module-mob/commands/enableNetwork.js +27 -27
  66. package/build/ox_modules/module-mob/commands/execute.js +21 -21
  67. package/build/ox_modules/module-mob/commands/findElement.js +20 -20
  68. package/build/ox_modules/module-mob/commands/findElements.js +23 -23
  69. package/build/ox_modules/module-mob/commands/getAlertText.js +17 -17
  70. package/build/ox_modules/module-mob/commands/getAppiumLogs.js +16 -16
  71. package/build/ox_modules/module-mob/commands/getBrowserLogs.js +16 -16
  72. package/build/ox_modules/module-mob/commands/getCurrentActivity.js +15 -15
  73. package/build/ox_modules/module-mob/commands/getCurrentPackage.js +15 -15
  74. package/build/ox_modules/module-mob/commands/getDeviceLogs.js +16 -16
  75. package/build/ox_modules/module-mob/commands/getDeviceTime.js +16 -16
  76. package/build/ox_modules/module-mob/commands/getLocation.js +20 -20
  77. package/build/ox_modules/module-mob/commands/getSource.js +16 -16
  78. package/build/ox_modules/module-mob/commands/getText.js +18 -18
  79. package/build/ox_modules/module-mob/commands/getTitle.js +13 -13
  80. package/build/ox_modules/module-mob/commands/getUrl.js +17 -17
  81. package/build/ox_modules/module-mob/commands/getValue.js +18 -18
  82. package/build/ox_modules/module-mob/commands/getWindowHandles.js +17 -17
  83. package/build/ox_modules/module-mob/commands/hideKeyboard.js +21 -21
  84. package/build/ox_modules/module-mob/commands/index.js +1 -1
  85. package/build/ox_modules/module-mob/commands/installApp.js +16 -16
  86. package/build/ox_modules/module-mob/commands/isAppInstalled.js +16 -16
  87. package/build/ox_modules/module-mob/commands/isCheckable.js +18 -18
  88. package/build/ox_modules/module-mob/commands/isChecked.js +18 -18
  89. package/build/ox_modules/module-mob/commands/isClickable.js +18 -18
  90. package/build/ox_modules/module-mob/commands/isExist.js +19 -19
  91. package/build/ox_modules/module-mob/commands/isSelected.js +23 -23
  92. package/build/ox_modules/module-mob/commands/isVisible.js +19 -19
  93. package/build/ox_modules/module-mob/commands/isWebViewContext.js +16 -16
  94. package/build/ox_modules/module-mob/commands/launchApp.js +15 -15
  95. package/build/ox_modules/module-mob/commands/longPressKeyCode.js +18 -18
  96. package/build/ox_modules/module-mob/commands/open.js +17 -17
  97. package/build/ox_modules/module-mob/commands/pause.js +16 -16
  98. package/build/ox_modules/module-mob/commands/removeApp.js +16 -16
  99. package/build/ox_modules/module-mob/commands/resetApp.js +15 -15
  100. package/build/ox_modules/module-mob/commands/scrollIntoElement.js +22 -22
  101. package/build/ox_modules/module-mob/commands/scrollIntoView.js +27 -27
  102. package/build/ox_modules/module-mob/commands/select.js +24 -24
  103. package/build/ox_modules/module-mob/commands/selectFrame.js +23 -23
  104. package/build/ox_modules/module-mob/commands/selectWindow.js +28 -28
  105. package/build/ox_modules/module-mob/commands/sendKeys.js +29 -29
  106. package/build/ox_modules/module-mob/commands/setContext.js +16 -16
  107. package/build/ox_modules/module-mob/commands/setNativeContext.js +15 -15
  108. package/build/ox_modules/module-mob/commands/setTimeout.js +21 -21
  109. package/build/ox_modules/module-mob/commands/setWebViewContext.js +16 -16
  110. package/build/ox_modules/module-mob/commands/shake.js +16 -16
  111. package/build/ox_modules/module-mob/commands/smsClickLink.js +19 -19
  112. package/build/ox_modules/module-mob/commands/smsGetText.js +20 -20
  113. package/build/ox_modules/module-mob/commands/swipe.js +20 -20
  114. package/build/ox_modules/module-mob/commands/swipeElement.js +20 -20
  115. package/build/ox_modules/module-mob/commands/swipeScreen.js +20 -20
  116. package/build/ox_modules/module-mob/commands/takeScreenshot.js +17 -17
  117. package/build/ox_modules/module-mob/commands/tap.js +17 -17
  118. package/build/ox_modules/module-mob/commands/type.js +20 -20
  119. package/build/ox_modules/module-mob/commands/unlockPattern.js +22 -22
  120. package/build/ox_modules/module-mob/commands/waitForExist.js +18 -18
  121. package/build/ox_modules/module-mob/commands/waitForInteractable.js +17 -17
  122. package/build/ox_modules/module-mob/commands/waitForVisible.js +17 -17
  123. package/build/ox_modules/module-mob.js +74 -74
  124. package/build/ox_modules/module-mongo.js +302 -0
  125. package/build/ox_modules/module-pdf.js +35 -35
  126. package/build/ox_modules/module-proxy.js +77 -77
  127. package/build/ox_modules/module-serial.js +55 -55
  128. package/build/ox_modules/module-shell.js +25 -25
  129. package/build/ox_modules/module-soap.js +72 -72
  130. package/build/ox_modules/module-twilio.js +41 -41
  131. package/build/ox_modules/module-utils.js +91 -91
  132. package/build/ox_modules/module-web/commands/alertAccept.js +17 -17
  133. package/build/ox_modules/module-web/commands/alertDismiss.js +17 -17
  134. package/build/ox_modules/module-web/commands/assertAlert.js +20 -20
  135. package/build/ox_modules/module-web/commands/assertExist.js +17 -17
  136. package/build/ox_modules/module-web/commands/assertSelectedLabel.js +21 -21
  137. package/build/ox_modules/module-web/commands/assertSelectedValue.js +21 -21
  138. package/build/ox_modules/module-web/commands/assertText.js +21 -21
  139. package/build/ox_modules/module-web/commands/assertTextNotPresent.js +18 -18
  140. package/build/ox_modules/module-web/commands/assertTextPresent.js +18 -18
  141. package/build/ox_modules/module-web/commands/assertTitle.js +19 -19
  142. package/build/ox_modules/module-web/commands/assertValue.js +20 -20
  143. package/build/ox_modules/module-web/commands/back.js +16 -16
  144. package/build/ox_modules/module-web/commands/clear.js +18 -18
  145. package/build/ox_modules/module-web/commands/click.js +25 -25
  146. package/build/ox_modules/module-web/commands/clickHidden.js +23 -23
  147. package/build/ox_modules/module-web/commands/closeWindow.js +15 -15
  148. package/build/ox_modules/module-web/commands/debug.js +15 -15
  149. package/build/ox_modules/module-web/commands/deleteCookies.js +12 -12
  150. package/build/ox_modules/module-web/commands/deselect.js +22 -22
  151. package/build/ox_modules/module-web/commands/doubleClick.js +17 -17
  152. package/build/ox_modules/module-web/commands/dragAndDrop.js +20 -20
  153. package/build/ox_modules/module-web/commands/execute.js +24 -24
  154. package/build/ox_modules/module-web/commands/fileBrowse.js +18 -18
  155. package/build/ox_modules/module-web/commands/findElement.js +19 -19
  156. package/build/ox_modules/module-web/commands/findElements.js +22 -22
  157. package/build/ox_modules/module-web/commands/fullscreenWindow.js +14 -14
  158. package/build/ox_modules/module-web/commands/getAlertText.js +16 -16
  159. package/build/ox_modules/module-web/commands/getAttribute.js +19 -19
  160. package/build/ox_modules/module-web/commands/getBrowserLogs.js +17 -17
  161. package/build/ox_modules/module-web/commands/getCookies.js +13 -13
  162. package/build/ox_modules/module-web/commands/getCssValue.js +19 -19
  163. package/build/ox_modules/module-web/commands/getElementCount.js +17 -17
  164. package/build/ox_modules/module-web/commands/getHTML.js +17 -17
  165. package/build/ox_modules/module-web/commands/getSource.js +16 -16
  166. package/build/ox_modules/module-web/commands/getText.js +18 -18
  167. package/build/ox_modules/module-web/commands/getTitle.js +12 -12
  168. package/build/ox_modules/module-web/commands/getUrl.js +16 -16
  169. package/build/ox_modules/module-web/commands/getValue.js +18 -18
  170. package/build/ox_modules/module-web/commands/getWindowHandles.js +16 -16
  171. package/build/ox_modules/module-web/commands/getWindowSize.js +16 -16
  172. package/build/ox_modules/module-web/commands/getXMLPageSource.js +16 -16
  173. package/build/ox_modules/module-web/commands/index.js +1 -1
  174. package/build/ox_modules/module-web/commands/isAlertPresent.js +16 -16
  175. package/build/ox_modules/module-web/commands/isChecked.js +18 -18
  176. package/build/ox_modules/module-web/commands/isExist.js +19 -19
  177. package/build/ox_modules/module-web/commands/isInteractable.js +22 -22
  178. package/build/ox_modules/module-web/commands/isSelected.js +23 -23
  179. package/build/ox_modules/module-web/commands/isVisible.js +19 -19
  180. package/build/ox_modules/module-web/commands/makeVisible.js +25 -25
  181. package/build/ox_modules/module-web/commands/maximizeWindow.js +14 -14
  182. package/build/ox_modules/module-web/commands/minimizeWindow.js +14 -14
  183. package/build/ox_modules/module-web/commands/mock.js +20 -20
  184. package/build/ox_modules/module-web/commands/mockClearAll.js +12 -12
  185. package/build/ox_modules/module-web/commands/mockRestoreAll.js +12 -12
  186. package/build/ox_modules/module-web/commands/newWindow.js +16 -16
  187. package/build/ox_modules/module-web/commands/open.js +16 -16
  188. package/build/ox_modules/module-web/commands/pause.js +15 -15
  189. package/build/ox_modules/module-web/commands/point.js +21 -21
  190. package/build/ox_modules/module-web/commands/pointJS.js +15 -15
  191. package/build/ox_modules/module-web/commands/refresh.js +15 -15
  192. package/build/ox_modules/module-web/commands/rightClick.js +17 -17
  193. package/build/ox_modules/module-web/commands/rightClickActions.js +19 -19
  194. package/build/ox_modules/module-web/commands/scrollToElement.js +21 -21
  195. package/build/ox_modules/module-web/commands/select.js +23 -23
  196. package/build/ox_modules/module-web/commands/selectFrame.js +24 -24
  197. package/build/ox_modules/module-web/commands/selectWindow.js +27 -27
  198. package/build/ox_modules/module-web/commands/sendKeys.js +22 -22
  199. package/build/ox_modules/module-web/commands/setAutoWaitForAngular.js +20 -20
  200. package/build/ox_modules/module-web/commands/setTimeout.js +21 -21
  201. package/build/ox_modules/module-web/commands/setWindowSize.js +17 -17
  202. package/build/ox_modules/module-web/commands/takeScreenshot.js +17 -17
  203. package/build/ox_modules/module-web/commands/type.js +20 -20
  204. package/build/ox_modules/module-web/commands/verifyAlert.js +20 -20
  205. package/build/ox_modules/module-web/commands/verifyExist.js +17 -17
  206. package/build/ox_modules/module-web/commands/verifySelectedLabel.js +21 -21
  207. package/build/ox_modules/module-web/commands/verifySelectedValue.js +21 -21
  208. package/build/ox_modules/module-web/commands/verifyText.js +21 -21
  209. package/build/ox_modules/module-web/commands/verifyTextNotPresent.js +18 -18
  210. package/build/ox_modules/module-web/commands/verifyTextPresent.js +18 -18
  211. package/build/ox_modules/module-web/commands/verifyTitle.js +19 -19
  212. package/build/ox_modules/module-web/commands/verifyValue.js +20 -20
  213. package/build/ox_modules/module-web/commands/waitForAngular.js +19 -19
  214. package/build/ox_modules/module-web/commands/waitForExist.js +17 -17
  215. package/build/ox_modules/module-web/commands/waitForInteractable.js +17 -17
  216. package/build/ox_modules/module-web/commands/waitForNotExist.js +17 -17
  217. package/build/ox_modules/module-web/commands/waitForNotText.js +20 -20
  218. package/build/ox_modules/module-web/commands/waitForNotValue.js +20 -20
  219. package/build/ox_modules/module-web/commands/waitForText.js +20 -20
  220. package/build/ox_modules/module-web/commands/waitForValue.js +20 -20
  221. package/build/ox_modules/module-web/commands/waitForVisible.js +17 -17
  222. package/build/ox_modules/module-web/commands/waitForWindow.js +22 -22
  223. package/build/ox_modules/module-web.js +94 -94
  224. package/build/ox_modules/module-win/commands/assertText.js +17 -17
  225. package/build/ox_modules/module-win/commands/assertTitle.js +15 -15
  226. package/build/ox_modules/module-win/commands/assertValue.js +14 -14
  227. package/build/ox_modules/module-win/commands/back.js +11 -11
  228. package/build/ox_modules/module-win/commands/clear.js +13 -13
  229. package/build/ox_modules/module-win/commands/click.js +13 -13
  230. package/build/ox_modules/module-win/commands/clickLong.js +14 -14
  231. package/build/ox_modules/module-win/commands/clickMultipleTimes.js +14 -14
  232. package/build/ox_modules/module-win/commands/findElement.js +15 -15
  233. package/build/ox_modules/module-win/commands/findElements.js +15 -15
  234. package/build/ox_modules/module-win/commands/getAppiumLogs.js +12 -12
  235. package/build/ox_modules/module-win/commands/getCurrentWindowHandle.js +15 -15
  236. package/build/ox_modules/module-win/commands/getLocation.js +14 -14
  237. package/build/ox_modules/module-win/commands/getSource.js +12 -12
  238. package/build/ox_modules/module-win/commands/getText.js +14 -14
  239. package/build/ox_modules/module-win/commands/getValue.js +14 -14
  240. package/build/ox_modules/module-win/commands/getWindowHandles.js +15 -15
  241. package/build/ox_modules/module-win/commands/index.js +1 -1
  242. package/build/ox_modules/module-win/commands/isCheckable.js +14 -14
  243. package/build/ox_modules/module-win/commands/isChecked.js +14 -14
  244. package/build/ox_modules/module-win/commands/isClickable.js +14 -14
  245. package/build/ox_modules/module-win/commands/isExist.js +15 -15
  246. package/build/ox_modules/module-win/commands/isSelected.js +14 -14
  247. package/build/ox_modules/module-win/commands/isVisible.js +15 -15
  248. package/build/ox_modules/module-win/commands/open.js +13 -13
  249. package/build/ox_modules/module-win/commands/pause.js +12 -12
  250. package/build/ox_modules/module-win/commands/rightClick.js +13 -13
  251. package/build/ox_modules/module-win/commands/selectWindow.js +23 -23
  252. package/build/ox_modules/module-win/commands/sendKeys.js +22 -22
  253. package/build/ox_modules/module-win/commands/setTimeout.js +17 -17
  254. package/build/ox_modules/module-win/commands/takeScreenshot.js +16 -16
  255. package/build/ox_modules/module-win/commands/tap.js +13 -13
  256. package/build/ox_modules/module-win/commands/type.js +16 -16
  257. package/build/ox_modules/module-win/commands/waitForExist.js +14 -14
  258. package/build/ox_modules/module-win/commands/waitForInteractable.js +16 -16
  259. package/build/ox_modules/module-win/commands/waitForVisible.js +13 -13
  260. package/build/ox_modules/module-win.js +47 -47
  261. package/build/ox_modules/utils.js +8 -8
  262. package/build/ox_reporters/excel/template.json +48 -48
  263. package/build/ox_reporters/html/index.ejs +163 -163
  264. package/build/ox_reporters/html/summary.ejs +77 -77
  265. package/build/ox_reporters/html/tests-details.ejs +134 -134
  266. package/build/ox_reporters/html/tests-devices-browsers.ejs +83 -83
  267. package/build/ox_reporters/reporter-excel.js +1 -1
  268. package/build/ox_reporters/reporter-html.js +1 -1
  269. package/build/ox_reporters/reporter-json.js +1 -1
  270. package/build/ox_reporters/reporter-junit.js +1 -1
  271. package/build/ox_reporters/reporter-pdf.js +1 -1
  272. package/build/ox_reporters/reporter-rp.js +1 -1
  273. package/build/ox_reporters/reporter-xml.js +1 -1
  274. package/build/ox_services/service-devtools/submodule-network.js +1 -1
  275. package/build/ox_services/service-devtools.js +1 -1
  276. package/build/reporter/FileReporterBase.js +1 -1
  277. package/build/reporter/ReportAggregator.js +13 -5
  278. package/build/reporter/ReporterBase.js +1 -1
  279. package/build/reporter/WebSocketReporter.js +1 -1
  280. package/build/runners/WorkerProcess.js +1 -1
  281. package/build/runners/cucumber/CucumberEventListener.js +1 -1
  282. package/build/runners/cucumber/CucumberReporter.js +1 -1
  283. package/build/runners/cucumber/CucumberWorker.js +1 -1
  284. package/build/runners/cucumber/index.js +1 -1
  285. package/build/runners/cucumber/worker.js +1 -1
  286. package/build/runners/index.js +1 -1
  287. package/build/runners/oxygen/OxygenWorker.js +1 -1
  288. package/build/runners/oxygen/index.js +1 -1
  289. package/build/runners/oxygen/worker.js +1 -1
  290. package/config/default.json +6 -6
  291. package/log.txt +1614 -0
  292. package/package.json +139 -137
  293. package/reports/2025-06-08_231627/report.html +440 -0
  294. package/reports/2025-06-09_223615/report.html +440 -0
  295. package/transpiled/mongodb/etc/prepare.js +18 -0
  296. package/transpiled/mongodb/lib/admin.js +182 -0
  297. package/transpiled/mongodb/lib/beta.js +26 -0
  298. package/transpiled/mongodb/lib/bson.js +220 -0
  299. package/transpiled/mongodb/lib/bulk/common.js +1041 -0
  300. package/transpiled/mongodb/lib/bulk/ordered.js +76 -0
  301. package/transpiled/mongodb/lib/bulk/unordered.js +102 -0
  302. package/transpiled/mongodb/lib/change_stream.js +517 -0
  303. package/transpiled/mongodb/lib/client-side-encryption/auto_encrypter.js +329 -0
  304. package/transpiled/mongodb/lib/client-side-encryption/client_encryption.js +779 -0
  305. package/transpiled/mongodb/lib/client-side-encryption/crypto_callbacks.js +95 -0
  306. package/transpiled/mongodb/lib/client-side-encryption/errors.js +171 -0
  307. package/transpiled/mongodb/lib/client-side-encryption/mongocryptd_manager.js +98 -0
  308. package/transpiled/mongodb/lib/client-side-encryption/providers/aws.js +34 -0
  309. package/transpiled/mongodb/lib/client-side-encryption/providers/azure.js +186 -0
  310. package/transpiled/mongodb/lib/client-side-encryption/providers/gcp.js +29 -0
  311. package/transpiled/mongodb/lib/client-side-encryption/providers/index.js +58 -0
  312. package/transpiled/mongodb/lib/client-side-encryption/state_machine.js +505 -0
  313. package/transpiled/mongodb/lib/cmap/auth/auth_provider.js +63 -0
  314. package/transpiled/mongodb/lib/cmap/auth/aws_temporary_credentials.js +167 -0
  315. package/transpiled/mongodb/lib/cmap/auth/gssapi.js +207 -0
  316. package/transpiled/mongodb/lib/cmap/auth/mongo_credentials.js +193 -0
  317. package/transpiled/mongodb/lib/cmap/auth/mongodb_aws.js +181 -0
  318. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js +101 -0
  319. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +81 -0
  320. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js +174 -0
  321. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js +59 -0
  322. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +58 -0
  323. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js +138 -0
  324. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +42 -0
  325. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js +71 -0
  326. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +34 -0
  327. package/transpiled/mongodb/lib/cmap/auth/mongodb_oidc.js +111 -0
  328. package/transpiled/mongodb/lib/cmap/auth/plain.js +43 -0
  329. package/transpiled/mongodb/lib/cmap/auth/providers.js +22 -0
  330. package/transpiled/mongodb/lib/cmap/auth/scram.js +318 -0
  331. package/transpiled/mongodb/lib/cmap/auth/x509.js +61 -0
  332. package/transpiled/mongodb/lib/cmap/command_monitoring_events.js +266 -0
  333. package/transpiled/mongodb/lib/cmap/commands.js +605 -0
  334. package/transpiled/mongodb/lib/cmap/connect.js +418 -0
  335. package/transpiled/mongodb/lib/cmap/connection.js +673 -0
  336. package/transpiled/mongodb/lib/cmap/connection_pool.js +688 -0
  337. package/transpiled/mongodb/lib/cmap/connection_pool_events.js +254 -0
  338. package/transpiled/mongodb/lib/cmap/errors.js +128 -0
  339. package/transpiled/mongodb/lib/cmap/handshake/client_metadata.js +278 -0
  340. package/transpiled/mongodb/lib/cmap/metrics.js +67 -0
  341. package/transpiled/mongodb/lib/cmap/stream_description.js +74 -0
  342. package/transpiled/mongodb/lib/cmap/wire_protocol/compression.js +196 -0
  343. package/transpiled/mongodb/lib/cmap/wire_protocol/constants.js +19 -0
  344. package/transpiled/mongodb/lib/cmap/wire_protocol/on_data.js +144 -0
  345. package/transpiled/mongodb/lib/cmap/wire_protocol/on_demand/document.js +278 -0
  346. package/transpiled/mongodb/lib/cmap/wire_protocol/responses.js +376 -0
  347. package/transpiled/mongodb/lib/cmap/wire_protocol/shared.js +49 -0
  348. package/transpiled/mongodb/lib/collection.js +852 -0
  349. package/transpiled/mongodb/lib/connection_string.js +1452 -0
  350. package/transpiled/mongodb/lib/constants.js +162 -0
  351. package/transpiled/mongodb/lib/cursor/abstract_cursor.js +1082 -0
  352. package/transpiled/mongodb/lib/cursor/aggregation_cursor.js +227 -0
  353. package/transpiled/mongodb/lib/cursor/change_stream_cursor.js +136 -0
  354. package/transpiled/mongodb/lib/cursor/client_bulk_write_cursor.js +69 -0
  355. package/transpiled/mongodb/lib/cursor/find_cursor.js +476 -0
  356. package/transpiled/mongodb/lib/cursor/list_collections_cursor.js +48 -0
  357. package/transpiled/mongodb/lib/cursor/list_indexes_cursor.js +46 -0
  358. package/transpiled/mongodb/lib/cursor/list_search_indexes_cursor.js +30 -0
  359. package/transpiled/mongodb/lib/cursor/run_command_cursor.js +125 -0
  360. package/transpiled/mongodb/lib/db.js +467 -0
  361. package/transpiled/mongodb/lib/deps.js +174 -0
  362. package/transpiled/mongodb/lib/encrypter.js +129 -0
  363. package/transpiled/mongodb/lib/error.js +1550 -0
  364. package/transpiled/mongodb/lib/explain.js +122 -0
  365. package/transpiled/mongodb/lib/gridfs/download.js +369 -0
  366. package/transpiled/mongodb/lib/gridfs/index.js +240 -0
  367. package/transpiled/mongodb/lib/gridfs/upload.js +446 -0
  368. package/transpiled/mongodb/lib/index.js +975 -0
  369. package/transpiled/mongodb/lib/mongo_client.js +626 -0
  370. package/transpiled/mongodb/lib/mongo_client_auth_providers.js +98 -0
  371. package/transpiled/mongodb/lib/mongo_logger.js +812 -0
  372. package/transpiled/mongodb/lib/mongo_types.js +71 -0
  373. package/transpiled/mongodb/lib/operations/aggregate.js +129 -0
  374. package/transpiled/mongodb/lib/operations/bulk_write.js +48 -0
  375. package/transpiled/mongodb/lib/operations/client_bulk_write/client_bulk_write.js +96 -0
  376. package/transpiled/mongodb/lib/operations/client_bulk_write/command_builder.js +409 -0
  377. package/transpiled/mongodb/lib/operations/client_bulk_write/common.js +5 -0
  378. package/transpiled/mongodb/lib/operations/client_bulk_write/executor.js +144 -0
  379. package/transpiled/mongodb/lib/operations/client_bulk_write/results_merger.js +228 -0
  380. package/transpiled/mongodb/lib/operations/collections.js +49 -0
  381. package/transpiled/mongodb/lib/operations/command.js +102 -0
  382. package/transpiled/mongodb/lib/operations/count.js +60 -0
  383. package/transpiled/mongodb/lib/operations/create_collection.js +109 -0
  384. package/transpiled/mongodb/lib/operations/delete.js +134 -0
  385. package/transpiled/mongodb/lib/operations/distinct.js +77 -0
  386. package/transpiled/mongodb/lib/operations/drop.js +102 -0
  387. package/transpiled/mongodb/lib/operations/estimated_document_count.js +47 -0
  388. package/transpiled/mongodb/lib/operations/execute_operation.js +251 -0
  389. package/transpiled/mongodb/lib/operations/find.js +197 -0
  390. package/transpiled/mongodb/lib/operations/find_and_modify.js +191 -0
  391. package/transpiled/mongodb/lib/operations/get_more.js +84 -0
  392. package/transpiled/mongodb/lib/operations/indexes.js +197 -0
  393. package/transpiled/mongodb/lib/operations/insert.js +138 -0
  394. package/transpiled/mongodb/lib/operations/is_capped.js +44 -0
  395. package/transpiled/mongodb/lib/operations/kill_cursors.js +58 -0
  396. package/transpiled/mongodb/lib/operations/list_collections.js +66 -0
  397. package/transpiled/mongodb/lib/operations/list_databases.js +56 -0
  398. package/transpiled/mongodb/lib/operations/operation.js +88 -0
  399. package/transpiled/mongodb/lib/operations/options_operation.js +44 -0
  400. package/transpiled/mongodb/lib/operations/profiling_level.js +42 -0
  401. package/transpiled/mongodb/lib/operations/remove_user.js +35 -0
  402. package/transpiled/mongodb/lib/operations/rename.js +48 -0
  403. package/transpiled/mongodb/lib/operations/run_command.js +64 -0
  404. package/transpiled/mongodb/lib/operations/search_indexes/create.js +41 -0
  405. package/transpiled/mongodb/lib/operations/search_indexes/drop.js +51 -0
  406. package/transpiled/mongodb/lib/operations/search_indexes/update.js +40 -0
  407. package/transpiled/mongodb/lib/operations/set_profiling_level.js +70 -0
  408. package/transpiled/mongodb/lib/operations/stats.js +39 -0
  409. package/transpiled/mongodb/lib/operations/update.js +218 -0
  410. package/transpiled/mongodb/lib/operations/validate_collection.js +49 -0
  411. package/transpiled/mongodb/lib/read_concern.js +92 -0
  412. package/transpiled/mongodb/lib/read_preference.js +215 -0
  413. package/transpiled/mongodb/lib/resource_management.js +74 -0
  414. package/transpiled/mongodb/lib/sdam/common.js +53 -0
  415. package/transpiled/mongodb/lib/sdam/events.js +177 -0
  416. package/transpiled/mongodb/lib/sdam/monitor.js +656 -0
  417. package/transpiled/mongodb/lib/sdam/server.js +463 -0
  418. package/transpiled/mongodb/lib/sdam/server_description.js +196 -0
  419. package/transpiled/mongodb/lib/sdam/server_selection.js +283 -0
  420. package/transpiled/mongodb/lib/sdam/server_selection_events.js +112 -0
  421. package/transpiled/mongodb/lib/sdam/srv_polling.js +139 -0
  422. package/transpiled/mongodb/lib/sdam/topology.js +833 -0
  423. package/transpiled/mongodb/lib/sdam/topology_description.js +447 -0
  424. package/transpiled/mongodb/lib/sessions.js +988 -0
  425. package/transpiled/mongodb/lib/sort.js +123 -0
  426. package/transpiled/mongodb/lib/timeout.js +349 -0
  427. package/transpiled/mongodb/lib/transactions.js +149 -0
  428. package/transpiled/mongodb/lib/utils.js +1502 -0
  429. package/transpiled/mongodb/lib/write_concern.js +115 -0
  430. package/types/index.d.ts +70 -70
  431. package/types/module-eyes.d.ts +39 -39
  432. package/types/module-http.d.ts +163 -163
  433. package/types/module-log.d.ts +34 -34
  434. package/types/module-mob.d.ts +966 -966
  435. package/types/module-pdf.d.ts +40 -40
  436. package/types/module-proxy.d.ts +100 -100
  437. package/types/module-shell.d.ts +24 -24
  438. package/types/module-utils.d.ts +99 -99
  439. package/types/module-web.d.ts +1053 -1053
  440. package/types/module-win.d.ts +352 -352
  441. package/types/oxygen.d.ts +53 -53
@@ -0,0 +1,1550 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MongoWriteConcernError = exports.MongoServerSelectionError = exports.MongoSystemError = exports.MongoMissingDependencyError = exports.MongoMissingCredentialsError = exports.MongoCompatibilityError = exports.MongoInvalidArgumentError = exports.MongoParseError = exports.MongoNetworkTimeoutError = exports.MongoNetworkError = exports.MongoClientClosedError = exports.MongoTopologyClosedError = exports.MongoCursorExhaustedError = exports.MongoServerClosedError = exports.MongoCursorInUseError = exports.MongoOperationTimeoutError = exports.MongoUnexpectedServerResponseError = exports.MongoGridFSChunkError = exports.MongoGridFSStreamError = exports.MongoTailableCursorError = exports.MongoChangeStreamError = exports.MongoClientBulkWriteExecutionError = exports.MongoClientBulkWriteCursorError = exports.MongoClientBulkWriteError = exports.MongoGCPError = exports.MongoAzureError = exports.MongoOIDCError = exports.MongoAWSError = exports.MongoKerberosError = exports.MongoExpiredSessionError = exports.MongoTransactionError = exports.MongoNotConnectedError = exports.MongoDecompressionError = exports.MongoBatchReExecutionError = exports.MongoStalePrimaryError = exports.MongoRuntimeError = exports.MongoAPIError = exports.MongoDriverError = exports.MongoServerError = exports.MongoError = exports.MongoErrorLabel = exports.GET_MORE_RESUMABLE_CODES = exports.MONGODB_ERROR_CODES = exports.NODE_IS_RECOVERING_ERROR_MESSAGE = exports.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE = exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE = void 0;
7
+ exports.needsRetryableWriteLabel = needsRetryableWriteLabel;
8
+ exports.isRetryableWriteError = isRetryableWriteError;
9
+ exports.isRetryableReadError = isRetryableReadError;
10
+ exports.isNodeShuttingDownError = isNodeShuttingDownError;
11
+ exports.isSDAMUnrecoverableError = isSDAMUnrecoverableError;
12
+ exports.isNetworkTimeoutError = isNetworkTimeoutError;
13
+ exports.isResumableError = isResumableError;
14
+ /**
15
+ * @internal
16
+ * The legacy error message from the server that indicates the node is not a writable primary
17
+ * https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
18
+ */
19
+
20
+ exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE = new RegExp('not master', 'i');
21
+ /**
22
+ * @internal
23
+ * The legacy error message from the server that indicates the node is not a primary or secondary
24
+ * https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
25
+ */
26
+
27
+ exports.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE = new RegExp('not master or secondary', 'i');
28
+ /**
29
+ * @internal
30
+ * The error message from the server that indicates the node is recovering
31
+ * https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
32
+ */
33
+
34
+ exports.NODE_IS_RECOVERING_ERROR_MESSAGE = new RegExp('node is recovering', 'i');
35
+ /** @internal MongoDB Error Codes */
36
+
37
+ exports.MONGODB_ERROR_CODES = Object.freeze({
38
+ HostUnreachable: 6,
39
+ HostNotFound: 7,
40
+ AuthenticationFailed: 18,
41
+ NetworkTimeout: 89,
42
+ ShutdownInProgress: 91,
43
+ PrimarySteppedDown: 189,
44
+ ExceededTimeLimit: 262,
45
+ SocketException: 9001,
46
+ NotWritablePrimary: 10107,
47
+ InterruptedAtShutdown: 11600,
48
+ InterruptedDueToReplStateChange: 11602,
49
+ NotPrimaryNoSecondaryOk: 13435,
50
+ NotPrimaryOrSecondary: 13436,
51
+ StaleShardVersion: 63,
52
+ StaleEpoch: 150,
53
+ StaleConfig: 13388,
54
+ RetryChangeStream: 234,
55
+ FailedToSatisfyReadPreference: 133,
56
+ CursorNotFound: 43,
57
+ LegacyNotPrimary: 10058,
58
+ // WriteConcernTimeout is WriteConcernFailed on pre-8.1 servers
59
+ WriteConcernTimeout: 64,
60
+ NamespaceNotFound: 26,
61
+ IllegalOperation: 20,
62
+ MaxTimeMSExpired: 50,
63
+ UnknownReplWriteConcern: 79,
64
+ UnsatisfiableWriteConcern: 100,
65
+ Reauthenticate: 391,
66
+ ReadConcernMajorityNotAvailableYet: 134
67
+ }); // From spec https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/change-streams/change-streams.md#resumable-error
68
+
69
+ exports.GET_MORE_RESUMABLE_CODES = new Set([exports.MONGODB_ERROR_CODES.HostUnreachable, exports.MONGODB_ERROR_CODES.HostNotFound, exports.MONGODB_ERROR_CODES.NetworkTimeout, exports.MONGODB_ERROR_CODES.ShutdownInProgress, exports.MONGODB_ERROR_CODES.PrimarySteppedDown, exports.MONGODB_ERROR_CODES.ExceededTimeLimit, exports.MONGODB_ERROR_CODES.SocketException, exports.MONGODB_ERROR_CODES.NotWritablePrimary, exports.MONGODB_ERROR_CODES.InterruptedAtShutdown, exports.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange, exports.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk, exports.MONGODB_ERROR_CODES.NotPrimaryOrSecondary, exports.MONGODB_ERROR_CODES.StaleShardVersion, exports.MONGODB_ERROR_CODES.StaleEpoch, exports.MONGODB_ERROR_CODES.StaleConfig, exports.MONGODB_ERROR_CODES.RetryChangeStream, exports.MONGODB_ERROR_CODES.FailedToSatisfyReadPreference, exports.MONGODB_ERROR_CODES.CursorNotFound]);
70
+ /** @public */
71
+
72
+ exports.MongoErrorLabel = Object.freeze({
73
+ RetryableWriteError: 'RetryableWriteError',
74
+ TransientTransactionError: 'TransientTransactionError',
75
+ UnknownTransactionCommitResult: 'UnknownTransactionCommitResult',
76
+ ResumableChangeStreamError: 'ResumableChangeStreamError',
77
+ HandshakeError: 'HandshakeError',
78
+ ResetPool: 'ResetPool',
79
+ PoolRequstedRetry: 'PoolRequstedRetry',
80
+ InterruptInUseConnections: 'InterruptInUseConnections',
81
+ NoWritesPerformed: 'NoWritesPerformed'
82
+ });
83
+
84
+ function isAggregateError(e) {
85
+ return e != null && typeof e === 'object' && 'errors' in e && Array.isArray(e.errors);
86
+ }
87
+ /**
88
+ * @public
89
+ * @category Error
90
+ *
91
+ * @privateRemarks
92
+ * mongodb-client-encryption has a dependency on this error, it uses the constructor with a string argument
93
+ */
94
+
95
+
96
+ class MongoError extends Error {
97
+ get errorLabels() {
98
+ return Array.from(this.errorLabelSet);
99
+ }
100
+ /**
101
+ * **Do not use this constructor!**
102
+ *
103
+ * Meant for internal use only.
104
+ *
105
+ * @remarks
106
+ * This class is only meant to be constructed within the driver. This constructor is
107
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
108
+ *
109
+ * @public
110
+ **/
111
+
112
+
113
+ constructor(message, options) {
114
+ super(message, options);
115
+ /** @internal */
116
+
117
+ this.errorLabelSet = new Set();
118
+ }
119
+ /** @internal */
120
+
121
+
122
+ static buildErrorMessage(e) {
123
+ if (typeof e === 'string') {
124
+ return e;
125
+ }
126
+
127
+ if (isAggregateError(e) && e.message.length === 0) {
128
+ return e.errors.length === 0 ? 'AggregateError has an empty errors array. Please check the `cause` property for more information.' : e.errors.map(({
129
+ message
130
+ }) => message).join(', ');
131
+ }
132
+
133
+ return e != null && typeof e === 'object' && 'message' in e && typeof e.message === 'string' ? e.message : 'empty error message';
134
+ }
135
+
136
+ get name() {
137
+ return 'MongoError';
138
+ }
139
+ /** Legacy name for server error responses */
140
+
141
+
142
+ get errmsg() {
143
+ return this.message;
144
+ }
145
+ /**
146
+ * Checks the error to see if it has an error label
147
+ *
148
+ * @param label - The error label to check for
149
+ * @returns returns true if the error has the provided error label
150
+ */
151
+
152
+
153
+ hasErrorLabel(label) {
154
+ return this.errorLabelSet.has(label);
155
+ }
156
+
157
+ addErrorLabel(label) {
158
+ this.errorLabelSet.add(label);
159
+ }
160
+
161
+ }
162
+
163
+ exports.MongoError = MongoError;
164
+ /**
165
+ * An error coming from the mongo server
166
+ *
167
+ * @public
168
+ * @category Error
169
+ */
170
+
171
+ class MongoServerError extends MongoError {
172
+ /**
173
+ * **Do not use this constructor!**
174
+ *
175
+ * Meant for internal use only.
176
+ *
177
+ * @remarks
178
+ * This class is only meant to be constructed within the driver. This constructor is
179
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
180
+ *
181
+ * @public
182
+ **/
183
+ constructor(message) {
184
+ super(message.message || message.errmsg || message.$err || 'n/a');
185
+
186
+ if (message.errorLabels) {
187
+ for (const label of message.errorLabels) this.addErrorLabel(label);
188
+ }
189
+
190
+ this.errorResponse = message;
191
+
192
+ for (const name in message) {
193
+ if (name !== 'errorLabels' && name !== 'errmsg' && name !== 'message' && name !== 'errorResponse') {
194
+ this[name] = message[name];
195
+ }
196
+ }
197
+ }
198
+
199
+ get name() {
200
+ return 'MongoServerError';
201
+ }
202
+
203
+ }
204
+
205
+ exports.MongoServerError = MongoServerError;
206
+ /**
207
+ * An error generated by the driver
208
+ *
209
+ * @public
210
+ * @category Error
211
+ */
212
+
213
+ class MongoDriverError extends MongoError {
214
+ /**
215
+ * **Do not use this constructor!**
216
+ *
217
+ * Meant for internal use only.
218
+ *
219
+ * @remarks
220
+ * This class is only meant to be constructed within the driver. This constructor is
221
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
222
+ *
223
+ * @public
224
+ **/
225
+ constructor(message, options) {
226
+ super(message, options);
227
+ }
228
+
229
+ get name() {
230
+ return 'MongoDriverError';
231
+ }
232
+
233
+ }
234
+
235
+ exports.MongoDriverError = MongoDriverError;
236
+ /**
237
+ * An error generated when the driver API is used incorrectly
238
+ *
239
+ * @privateRemarks
240
+ * Should **never** be directly instantiated
241
+ *
242
+ * @public
243
+ * @category Error
244
+ */
245
+
246
+ class MongoAPIError extends MongoDriverError {
247
+ /**
248
+ * **Do not use this constructor!**
249
+ *
250
+ * Meant for internal use only.
251
+ *
252
+ * @remarks
253
+ * This class is only meant to be constructed within the driver. This constructor is
254
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
255
+ *
256
+ * @public
257
+ **/
258
+ constructor(message, options) {
259
+ super(message, options);
260
+ }
261
+
262
+ get name() {
263
+ return 'MongoAPIError';
264
+ }
265
+
266
+ }
267
+
268
+ exports.MongoAPIError = MongoAPIError;
269
+ /**
270
+ * An error generated when the driver encounters unexpected input
271
+ * or reaches an unexpected/invalid internal state.
272
+ *
273
+ * @privateRemarks
274
+ * Should **never** be directly instantiated.
275
+ *
276
+ * @public
277
+ * @category Error
278
+ */
279
+
280
+ class MongoRuntimeError extends MongoDriverError {
281
+ /**
282
+ * **Do not use this constructor!**
283
+ *
284
+ * Meant for internal use only.
285
+ *
286
+ * @remarks
287
+ * This class is only meant to be constructed within the driver. This constructor is
288
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
289
+ *
290
+ * @public
291
+ **/
292
+ constructor(message, options) {
293
+ super(message, options);
294
+ }
295
+
296
+ get name() {
297
+ return 'MongoRuntimeError';
298
+ }
299
+
300
+ }
301
+
302
+ exports.MongoRuntimeError = MongoRuntimeError;
303
+ /**
304
+ * An error generated when a primary server is marked stale, never directly thrown
305
+ *
306
+ * @public
307
+ * @category Error
308
+ */
309
+
310
+ class MongoStalePrimaryError extends MongoRuntimeError {
311
+ /**
312
+ * **Do not use this constructor!**
313
+ *
314
+ * Meant for internal use only.
315
+ *
316
+ * @remarks
317
+ * This class is only meant to be constructed within the driver. This constructor is
318
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
319
+ *
320
+ * @public
321
+ **/
322
+ constructor(message, options) {
323
+ super(message, options);
324
+ }
325
+
326
+ get name() {
327
+ return 'MongoStalePrimaryError';
328
+ }
329
+
330
+ }
331
+
332
+ exports.MongoStalePrimaryError = MongoStalePrimaryError;
333
+ /**
334
+ * An error generated when a batch command is re-executed after one of the commands in the batch
335
+ * has failed
336
+ *
337
+ * @public
338
+ * @category Error
339
+ */
340
+
341
+ class MongoBatchReExecutionError extends MongoAPIError {
342
+ /**
343
+ * **Do not use this constructor!**
344
+ *
345
+ * Meant for internal use only.
346
+ *
347
+ * @remarks
348
+ * This class is only meant to be constructed within the driver. This constructor is
349
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
350
+ *
351
+ * @public
352
+ **/
353
+ constructor(message = 'This batch has already been executed, create new batch to execute') {
354
+ super(message);
355
+ }
356
+
357
+ get name() {
358
+ return 'MongoBatchReExecutionError';
359
+ }
360
+
361
+ }
362
+
363
+ exports.MongoBatchReExecutionError = MongoBatchReExecutionError;
364
+ /**
365
+ * An error generated when the driver fails to decompress
366
+ * data received from the server.
367
+ *
368
+ * @public
369
+ * @category Error
370
+ */
371
+
372
+ class MongoDecompressionError extends MongoRuntimeError {
373
+ /**
374
+ * **Do not use this constructor!**
375
+ *
376
+ * Meant for internal use only.
377
+ *
378
+ * @remarks
379
+ * This class is only meant to be constructed within the driver. This constructor is
380
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
381
+ *
382
+ * @public
383
+ **/
384
+ constructor(message) {
385
+ super(message);
386
+ }
387
+
388
+ get name() {
389
+ return 'MongoDecompressionError';
390
+ }
391
+
392
+ }
393
+
394
+ exports.MongoDecompressionError = MongoDecompressionError;
395
+ /**
396
+ * An error thrown when the user attempts to operate on a database or collection through a MongoClient
397
+ * that has not yet successfully called the "connect" method
398
+ *
399
+ * @public
400
+ * @category Error
401
+ */
402
+
403
+ class MongoNotConnectedError extends MongoAPIError {
404
+ /**
405
+ * **Do not use this constructor!**
406
+ *
407
+ * Meant for internal use only.
408
+ *
409
+ * @remarks
410
+ * This class is only meant to be constructed within the driver. This constructor is
411
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
412
+ *
413
+ * @public
414
+ **/
415
+ constructor(message) {
416
+ super(message);
417
+ }
418
+
419
+ get name() {
420
+ return 'MongoNotConnectedError';
421
+ }
422
+
423
+ }
424
+
425
+ exports.MongoNotConnectedError = MongoNotConnectedError;
426
+ /**
427
+ * An error generated when the user makes a mistake in the usage of transactions.
428
+ * (e.g. attempting to commit a transaction with a readPreference other than primary)
429
+ *
430
+ * @public
431
+ * @category Error
432
+ */
433
+
434
+ class MongoTransactionError extends MongoAPIError {
435
+ /**
436
+ * **Do not use this constructor!**
437
+ *
438
+ * Meant for internal use only.
439
+ *
440
+ * @remarks
441
+ * This class is only meant to be constructed within the driver. This constructor is
442
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
443
+ *
444
+ * @public
445
+ **/
446
+ constructor(message) {
447
+ super(message);
448
+ }
449
+
450
+ get name() {
451
+ return 'MongoTransactionError';
452
+ }
453
+
454
+ }
455
+
456
+ exports.MongoTransactionError = MongoTransactionError;
457
+ /**
458
+ * An error generated when the user attempts to operate
459
+ * on a session that has expired or has been closed.
460
+ *
461
+ * @public
462
+ * @category Error
463
+ */
464
+
465
+ class MongoExpiredSessionError extends MongoAPIError {
466
+ /**
467
+ * **Do not use this constructor!**
468
+ *
469
+ * Meant for internal use only.
470
+ *
471
+ * @remarks
472
+ * This class is only meant to be constructed within the driver. This constructor is
473
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
474
+ *
475
+ * @public
476
+ **/
477
+ constructor(message = 'Cannot use a session that has ended') {
478
+ super(message);
479
+ }
480
+
481
+ get name() {
482
+ return 'MongoExpiredSessionError';
483
+ }
484
+
485
+ }
486
+
487
+ exports.MongoExpiredSessionError = MongoExpiredSessionError;
488
+ /**
489
+ * A error generated when the user attempts to authenticate
490
+ * via Kerberos, but fails to connect to the Kerberos client.
491
+ *
492
+ * @public
493
+ * @category Error
494
+ */
495
+
496
+ class MongoKerberosError extends MongoRuntimeError {
497
+ /**
498
+ * **Do not use this constructor!**
499
+ *
500
+ * Meant for internal use only.
501
+ *
502
+ * @remarks
503
+ * This class is only meant to be constructed within the driver. This constructor is
504
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
505
+ *
506
+ * @public
507
+ **/
508
+ constructor(message) {
509
+ super(message);
510
+ }
511
+
512
+ get name() {
513
+ return 'MongoKerberosError';
514
+ }
515
+
516
+ }
517
+
518
+ exports.MongoKerberosError = MongoKerberosError;
519
+ /**
520
+ * A error generated when the user attempts to authenticate
521
+ * via AWS, but fails
522
+ *
523
+ * @public
524
+ * @category Error
525
+ */
526
+
527
+ class MongoAWSError extends MongoRuntimeError {
528
+ /**
529
+ * **Do not use this constructor!**
530
+ *
531
+ * Meant for internal use only.
532
+ *
533
+ * @remarks
534
+ * This class is only meant to be constructed within the driver. This constructor is
535
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
536
+ *
537
+ * @public
538
+ **/
539
+ constructor(message, options) {
540
+ super(message, options);
541
+ }
542
+
543
+ get name() {
544
+ return 'MongoAWSError';
545
+ }
546
+
547
+ }
548
+
549
+ exports.MongoAWSError = MongoAWSError;
550
+ /**
551
+ * A error generated when the user attempts to authenticate
552
+ * via OIDC callbacks, but fails.
553
+ *
554
+ * @public
555
+ * @category Error
556
+ */
557
+
558
+ class MongoOIDCError extends MongoRuntimeError {
559
+ /**
560
+ * **Do not use this constructor!**
561
+ *
562
+ * Meant for internal use only.
563
+ *
564
+ * @remarks
565
+ * This class is only meant to be constructed within the driver. This constructor is
566
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
567
+ *
568
+ * @public
569
+ **/
570
+ constructor(message) {
571
+ super(message);
572
+ }
573
+
574
+ get name() {
575
+ return 'MongoOIDCError';
576
+ }
577
+
578
+ }
579
+
580
+ exports.MongoOIDCError = MongoOIDCError;
581
+ /**
582
+ * A error generated when the user attempts to authenticate
583
+ * via Azure, but fails.
584
+ *
585
+ * @public
586
+ * @category Error
587
+ */
588
+
589
+ class MongoAzureError extends MongoOIDCError {
590
+ /**
591
+ * **Do not use this constructor!**
592
+ *
593
+ * Meant for internal use only.
594
+ *
595
+ * @remarks
596
+ * This class is only meant to be constructed within the driver. This constructor is
597
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
598
+ *
599
+ * @public
600
+ **/
601
+ constructor(message) {
602
+ super(message);
603
+ }
604
+
605
+ get name() {
606
+ return 'MongoAzureError';
607
+ }
608
+
609
+ }
610
+
611
+ exports.MongoAzureError = MongoAzureError;
612
+ /**
613
+ * A error generated when the user attempts to authenticate
614
+ * via GCP, but fails.
615
+ *
616
+ * @public
617
+ * @category Error
618
+ */
619
+
620
+ class MongoGCPError extends MongoOIDCError {
621
+ /**
622
+ * **Do not use this constructor!**
623
+ *
624
+ * Meant for internal use only.
625
+ *
626
+ * @remarks
627
+ * This class is only meant to be constructed within the driver. This constructor is
628
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
629
+ *
630
+ * @public
631
+ **/
632
+ constructor(message) {
633
+ super(message);
634
+ }
635
+
636
+ get name() {
637
+ return 'MongoGCPError';
638
+ }
639
+
640
+ }
641
+
642
+ exports.MongoGCPError = MongoGCPError;
643
+ /**
644
+ * An error indicating that an error occurred when executing the bulk write.
645
+ *
646
+ * @public
647
+ * @category Error
648
+ */
649
+
650
+ class MongoClientBulkWriteError extends MongoServerError {
651
+ /**
652
+ * Initialize the client bulk write error.
653
+ * @param message - The error message.
654
+ */
655
+ constructor(message) {
656
+ super(message);
657
+ this.writeConcernErrors = [];
658
+ this.writeErrors = new Map();
659
+ }
660
+
661
+ get name() {
662
+ return 'MongoClientBulkWriteError';
663
+ }
664
+
665
+ }
666
+
667
+ exports.MongoClientBulkWriteError = MongoClientBulkWriteError;
668
+ /**
669
+ * An error indicating that an error occurred when processing bulk write results.
670
+ *
671
+ * @public
672
+ * @category Error
673
+ */
674
+
675
+ class MongoClientBulkWriteCursorError extends MongoRuntimeError {
676
+ /**
677
+ * **Do not use this constructor!**
678
+ *
679
+ * Meant for internal use only.
680
+ *
681
+ * @remarks
682
+ * This class is only meant to be constructed within the driver. This constructor is
683
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
684
+ *
685
+ * @public
686
+ **/
687
+ constructor(message) {
688
+ super(message);
689
+ }
690
+
691
+ get name() {
692
+ return 'MongoClientBulkWriteCursorError';
693
+ }
694
+
695
+ }
696
+
697
+ exports.MongoClientBulkWriteCursorError = MongoClientBulkWriteCursorError;
698
+ /**
699
+ * An error indicating that an error occurred on the client when executing a client bulk write.
700
+ *
701
+ * @public
702
+ * @category Error
703
+ */
704
+
705
+ class MongoClientBulkWriteExecutionError extends MongoRuntimeError {
706
+ /**
707
+ * **Do not use this constructor!**
708
+ *
709
+ * Meant for internal use only.
710
+ *
711
+ * @remarks
712
+ * This class is only meant to be constructed within the driver. This constructor is
713
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
714
+ *
715
+ * @public
716
+ **/
717
+ constructor(message) {
718
+ super(message);
719
+ }
720
+
721
+ get name() {
722
+ return 'MongoClientBulkWriteExecutionError';
723
+ }
724
+
725
+ }
726
+
727
+ exports.MongoClientBulkWriteExecutionError = MongoClientBulkWriteExecutionError;
728
+ /**
729
+ * An error generated when a ChangeStream operation fails to execute.
730
+ *
731
+ * @public
732
+ * @category Error
733
+ */
734
+
735
+ class MongoChangeStreamError extends MongoRuntimeError {
736
+ /**
737
+ * **Do not use this constructor!**
738
+ *
739
+ * Meant for internal use only.
740
+ *
741
+ * @remarks
742
+ * This class is only meant to be constructed within the driver. This constructor is
743
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
744
+ *
745
+ * @public
746
+ **/
747
+ constructor(message) {
748
+ super(message);
749
+ }
750
+
751
+ get name() {
752
+ return 'MongoChangeStreamError';
753
+ }
754
+
755
+ }
756
+
757
+ exports.MongoChangeStreamError = MongoChangeStreamError;
758
+ /**
759
+ * An error thrown when the user calls a function or method not supported on a tailable cursor
760
+ *
761
+ * @public
762
+ * @category Error
763
+ */
764
+
765
+ class MongoTailableCursorError extends MongoAPIError {
766
+ /**
767
+ * **Do not use this constructor!**
768
+ *
769
+ * Meant for internal use only.
770
+ *
771
+ * @remarks
772
+ * This class is only meant to be constructed within the driver. This constructor is
773
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
774
+ *
775
+ * @public
776
+ **/
777
+ constructor(message = 'Tailable cursor does not support this operation') {
778
+ super(message);
779
+ }
780
+
781
+ get name() {
782
+ return 'MongoTailableCursorError';
783
+ }
784
+
785
+ }
786
+
787
+ exports.MongoTailableCursorError = MongoTailableCursorError;
788
+ /** An error generated when a GridFSStream operation fails to execute.
789
+ *
790
+ * @public
791
+ * @category Error
792
+ */
793
+
794
+ class MongoGridFSStreamError extends MongoRuntimeError {
795
+ /**
796
+ * **Do not use this constructor!**
797
+ *
798
+ * Meant for internal use only.
799
+ *
800
+ * @remarks
801
+ * This class is only meant to be constructed within the driver. This constructor is
802
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
803
+ *
804
+ * @public
805
+ **/
806
+ constructor(message) {
807
+ super(message);
808
+ }
809
+
810
+ get name() {
811
+ return 'MongoGridFSStreamError';
812
+ }
813
+
814
+ }
815
+
816
+ exports.MongoGridFSStreamError = MongoGridFSStreamError;
817
+ /**
818
+ * An error generated when a malformed or invalid chunk is
819
+ * encountered when reading from a GridFSStream.
820
+ *
821
+ * @public
822
+ * @category Error
823
+ */
824
+
825
+ class MongoGridFSChunkError extends MongoRuntimeError {
826
+ /**
827
+ * **Do not use this constructor!**
828
+ *
829
+ * Meant for internal use only.
830
+ *
831
+ * @remarks
832
+ * This class is only meant to be constructed within the driver. This constructor is
833
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
834
+ *
835
+ * @public
836
+ **/
837
+ constructor(message) {
838
+ super(message);
839
+ }
840
+
841
+ get name() {
842
+ return 'MongoGridFSChunkError';
843
+ }
844
+
845
+ }
846
+
847
+ exports.MongoGridFSChunkError = MongoGridFSChunkError;
848
+ /**
849
+ * An error generated when a **parsable** unexpected response comes from the server.
850
+ * This is generally an error where the driver in a state expecting a certain behavior to occur in
851
+ * the next message from MongoDB but it receives something else.
852
+ * This error **does not** represent an issue with wire message formatting.
853
+ *
854
+ * #### Example
855
+ * When an operation fails, it is the driver's job to retry it. It must perform serverSelection
856
+ * again to make sure that it attempts the operation against a server in a good state. If server
857
+ * selection returns a server that does not support retryable operations, this error is used.
858
+ * This scenario is unlikely as retryable support would also have been determined on the first attempt
859
+ * but it is possible the state change could report a selectable server that does not support retries.
860
+ *
861
+ * @public
862
+ * @category Error
863
+ */
864
+
865
+ class MongoUnexpectedServerResponseError extends MongoRuntimeError {
866
+ /**
867
+ * **Do not use this constructor!**
868
+ *
869
+ * Meant for internal use only.
870
+ *
871
+ * @remarks
872
+ * This class is only meant to be constructed within the driver. This constructor is
873
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
874
+ *
875
+ * @public
876
+ **/
877
+ constructor(message, options) {
878
+ super(message, options);
879
+ }
880
+
881
+ get name() {
882
+ return 'MongoUnexpectedServerResponseError';
883
+ }
884
+
885
+ }
886
+
887
+ exports.MongoUnexpectedServerResponseError = MongoUnexpectedServerResponseError;
888
+ /**
889
+ * @public
890
+ * @category Error
891
+ *
892
+ * The `MongoOperationTimeoutError` class represents an error that occurs when an operation could not be completed within the specified `timeoutMS`.
893
+ * It is generated by the driver in support of the "client side operation timeout" feature so inherits from `MongoDriverError`.
894
+ * When `timeoutMS` is enabled `MongoServerError`s relating to `MaxTimeExpired` errors will be converted to `MongoOperationTimeoutError`
895
+ *
896
+ * @example
897
+ * ```ts
898
+ * try {
899
+ * await blogs.insertOne(blogPost, { timeoutMS: 60_000 })
900
+ * } catch (error) {
901
+ * if (error instanceof MongoOperationTimeoutError) {
902
+ * console.log(`Oh no! writer's block!`, error);
903
+ * }
904
+ * }
905
+ * ```
906
+ */
907
+
908
+ class MongoOperationTimeoutError extends MongoDriverError {
909
+ get name() {
910
+ return 'MongoOperationTimeoutError';
911
+ }
912
+
913
+ }
914
+
915
+ exports.MongoOperationTimeoutError = MongoOperationTimeoutError;
916
+ /**
917
+ * An error thrown when the user attempts to add options to a cursor that has already been
918
+ * initialized
919
+ *
920
+ * @public
921
+ * @category Error
922
+ */
923
+
924
+ class MongoCursorInUseError extends MongoAPIError {
925
+ /**
926
+ * **Do not use this constructor!**
927
+ *
928
+ * Meant for internal use only.
929
+ *
930
+ * @remarks
931
+ * This class is only meant to be constructed within the driver. This constructor is
932
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
933
+ *
934
+ * @public
935
+ **/
936
+ constructor(message = 'Cursor is already initialized') {
937
+ super(message);
938
+ }
939
+
940
+ get name() {
941
+ return 'MongoCursorInUseError';
942
+ }
943
+
944
+ }
945
+
946
+ exports.MongoCursorInUseError = MongoCursorInUseError;
947
+ /**
948
+ * An error generated when an attempt is made to operate
949
+ * on a closed/closing server.
950
+ *
951
+ * @public
952
+ * @category Error
953
+ */
954
+
955
+ class MongoServerClosedError extends MongoAPIError {
956
+ /**
957
+ * **Do not use this constructor!**
958
+ *
959
+ * Meant for internal use only.
960
+ *
961
+ * @remarks
962
+ * This class is only meant to be constructed within the driver. This constructor is
963
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
964
+ *
965
+ * @public
966
+ **/
967
+ constructor(message = 'Server is closed') {
968
+ super(message);
969
+ }
970
+
971
+ get name() {
972
+ return 'MongoServerClosedError';
973
+ }
974
+
975
+ }
976
+
977
+ exports.MongoServerClosedError = MongoServerClosedError;
978
+ /**
979
+ * An error thrown when an attempt is made to read from a cursor that has been exhausted
980
+ *
981
+ * @public
982
+ * @category Error
983
+ */
984
+
985
+ class MongoCursorExhaustedError extends MongoAPIError {
986
+ /**
987
+ * **Do not use this constructor!**
988
+ *
989
+ * Meant for internal use only.
990
+ *
991
+ * @remarks
992
+ * This class is only meant to be constructed within the driver. This constructor is
993
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
994
+ *
995
+ * @public
996
+ **/
997
+ constructor(message) {
998
+ super(message || 'Cursor is exhausted');
999
+ }
1000
+
1001
+ get name() {
1002
+ return 'MongoCursorExhaustedError';
1003
+ }
1004
+
1005
+ }
1006
+
1007
+ exports.MongoCursorExhaustedError = MongoCursorExhaustedError;
1008
+ /**
1009
+ * An error generated when an attempt is made to operate on a
1010
+ * dropped, or otherwise unavailable, database.
1011
+ *
1012
+ * @public
1013
+ * @category Error
1014
+ */
1015
+
1016
+ class MongoTopologyClosedError extends MongoAPIError {
1017
+ /**
1018
+ * **Do not use this constructor!**
1019
+ *
1020
+ * Meant for internal use only.
1021
+ *
1022
+ * @remarks
1023
+ * This class is only meant to be constructed within the driver. This constructor is
1024
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1025
+ *
1026
+ * @public
1027
+ **/
1028
+ constructor(message = 'Topology is closed') {
1029
+ super(message);
1030
+ }
1031
+
1032
+ get name() {
1033
+ return 'MongoTopologyClosedError';
1034
+ }
1035
+
1036
+ }
1037
+
1038
+ exports.MongoTopologyClosedError = MongoTopologyClosedError;
1039
+ /**
1040
+ * An error generated when the MongoClient is closed and async
1041
+ * operations are interrupted.
1042
+ *
1043
+ * @public
1044
+ * @category Error
1045
+ */
1046
+
1047
+ class MongoClientClosedError extends MongoAPIError {
1048
+ /**
1049
+ * **Do not use this constructor!**
1050
+ *
1051
+ * Meant for internal use only.
1052
+ *
1053
+ * @remarks
1054
+ * This class is only meant to be constructed within the driver. This constructor is
1055
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1056
+ *
1057
+ * @public
1058
+ **/
1059
+ constructor() {
1060
+ super('Operation interrupted because client was closed');
1061
+ }
1062
+
1063
+ get name() {
1064
+ return 'MongoClientClosedError';
1065
+ }
1066
+
1067
+ }
1068
+
1069
+ exports.MongoClientClosedError = MongoClientClosedError;
1070
+ /**
1071
+ * An error indicating an issue with the network, including TCP errors and timeouts.
1072
+ * @public
1073
+ * @category Error
1074
+ */
1075
+
1076
+ class MongoNetworkError extends MongoError {
1077
+ /**
1078
+ * **Do not use this constructor!**
1079
+ *
1080
+ * Meant for internal use only.
1081
+ *
1082
+ * @remarks
1083
+ * This class is only meant to be constructed within the driver. This constructor is
1084
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1085
+ *
1086
+ * @public
1087
+ **/
1088
+ constructor(message, options) {
1089
+ super(message, {
1090
+ cause: options?.cause
1091
+ });
1092
+ this.beforeHandshake = !!options?.beforeHandshake;
1093
+ }
1094
+
1095
+ get name() {
1096
+ return 'MongoNetworkError';
1097
+ }
1098
+
1099
+ }
1100
+
1101
+ exports.MongoNetworkError = MongoNetworkError;
1102
+ /**
1103
+ * An error indicating a network timeout occurred
1104
+ * @public
1105
+ * @category Error
1106
+ *
1107
+ * @privateRemarks
1108
+ * mongodb-client-encryption has a dependency on this error with an instanceof check
1109
+ */
1110
+
1111
+ class MongoNetworkTimeoutError extends MongoNetworkError {
1112
+ /**
1113
+ * **Do not use this constructor!**
1114
+ *
1115
+ * Meant for internal use only.
1116
+ *
1117
+ * @remarks
1118
+ * This class is only meant to be constructed within the driver. This constructor is
1119
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1120
+ *
1121
+ * @public
1122
+ **/
1123
+ constructor(message, options) {
1124
+ super(message, options);
1125
+ }
1126
+
1127
+ get name() {
1128
+ return 'MongoNetworkTimeoutError';
1129
+ }
1130
+
1131
+ }
1132
+
1133
+ exports.MongoNetworkTimeoutError = MongoNetworkTimeoutError;
1134
+ /**
1135
+ * An error used when attempting to parse a value (like a connection string)
1136
+ * @public
1137
+ * @category Error
1138
+ */
1139
+
1140
+ class MongoParseError extends MongoDriverError {
1141
+ /**
1142
+ * **Do not use this constructor!**
1143
+ *
1144
+ * Meant for internal use only.
1145
+ *
1146
+ * @remarks
1147
+ * This class is only meant to be constructed within the driver. This constructor is
1148
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1149
+ *
1150
+ * @public
1151
+ **/
1152
+ constructor(message) {
1153
+ super(message);
1154
+ }
1155
+
1156
+ get name() {
1157
+ return 'MongoParseError';
1158
+ }
1159
+
1160
+ }
1161
+
1162
+ exports.MongoParseError = MongoParseError;
1163
+ /**
1164
+ * An error generated when the user supplies malformed or unexpected arguments
1165
+ * or when a required argument or field is not provided.
1166
+ *
1167
+ *
1168
+ * @public
1169
+ * @category Error
1170
+ */
1171
+
1172
+ class MongoInvalidArgumentError extends MongoAPIError {
1173
+ /**
1174
+ * **Do not use this constructor!**
1175
+ *
1176
+ * Meant for internal use only.
1177
+ *
1178
+ * @remarks
1179
+ * This class is only meant to be constructed within the driver. This constructor is
1180
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1181
+ *
1182
+ * @public
1183
+ **/
1184
+ constructor(message, options) {
1185
+ super(message, options);
1186
+ }
1187
+
1188
+ get name() {
1189
+ return 'MongoInvalidArgumentError';
1190
+ }
1191
+
1192
+ }
1193
+
1194
+ exports.MongoInvalidArgumentError = MongoInvalidArgumentError;
1195
+ /**
1196
+ * An error generated when a feature that is not enabled or allowed for the current server
1197
+ * configuration is used
1198
+ *
1199
+ *
1200
+ * @public
1201
+ * @category Error
1202
+ */
1203
+
1204
+ class MongoCompatibilityError extends MongoAPIError {
1205
+ /**
1206
+ * **Do not use this constructor!**
1207
+ *
1208
+ * Meant for internal use only.
1209
+ *
1210
+ * @remarks
1211
+ * This class is only meant to be constructed within the driver. This constructor is
1212
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1213
+ *
1214
+ * @public
1215
+ **/
1216
+ constructor(message) {
1217
+ super(message);
1218
+ }
1219
+
1220
+ get name() {
1221
+ return 'MongoCompatibilityError';
1222
+ }
1223
+
1224
+ }
1225
+
1226
+ exports.MongoCompatibilityError = MongoCompatibilityError;
1227
+ /**
1228
+ * An error generated when the user fails to provide authentication credentials before attempting
1229
+ * to connect to a mongo server instance.
1230
+ *
1231
+ *
1232
+ * @public
1233
+ * @category Error
1234
+ */
1235
+
1236
+ class MongoMissingCredentialsError extends MongoAPIError {
1237
+ /**
1238
+ * **Do not use this constructor!**
1239
+ *
1240
+ * Meant for internal use only.
1241
+ *
1242
+ * @remarks
1243
+ * This class is only meant to be constructed within the driver. This constructor is
1244
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1245
+ *
1246
+ * @public
1247
+ **/
1248
+ constructor(message) {
1249
+ super(message);
1250
+ }
1251
+
1252
+ get name() {
1253
+ return 'MongoMissingCredentialsError';
1254
+ }
1255
+
1256
+ }
1257
+
1258
+ exports.MongoMissingCredentialsError = MongoMissingCredentialsError;
1259
+ /**
1260
+ * An error generated when a required module or dependency is not present in the local environment
1261
+ *
1262
+ * @public
1263
+ * @category Error
1264
+ */
1265
+
1266
+ class MongoMissingDependencyError extends MongoAPIError {
1267
+ /**
1268
+ * **Do not use this constructor!**
1269
+ *
1270
+ * Meant for internal use only.
1271
+ *
1272
+ * @remarks
1273
+ * This class is only meant to be constructed within the driver. This constructor is
1274
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1275
+ *
1276
+ * @public
1277
+ **/
1278
+ constructor(message, options) {
1279
+ super(message, options);
1280
+ this.dependencyName = options.dependencyName;
1281
+ }
1282
+
1283
+ get name() {
1284
+ return 'MongoMissingDependencyError';
1285
+ }
1286
+
1287
+ }
1288
+
1289
+ exports.MongoMissingDependencyError = MongoMissingDependencyError;
1290
+ /**
1291
+ * An error signifying a general system issue
1292
+ * @public
1293
+ * @category Error
1294
+ */
1295
+
1296
+ class MongoSystemError extends MongoError {
1297
+ /**
1298
+ * **Do not use this constructor!**
1299
+ *
1300
+ * Meant for internal use only.
1301
+ *
1302
+ * @remarks
1303
+ * This class is only meant to be constructed within the driver. This constructor is
1304
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1305
+ *
1306
+ * @public
1307
+ **/
1308
+ constructor(message, reason) {
1309
+ if (reason && reason.error) {
1310
+ super(MongoError.buildErrorMessage(reason.error.message || reason.error), {
1311
+ cause: reason.error
1312
+ });
1313
+ } else {
1314
+ super(message);
1315
+ }
1316
+
1317
+ if (reason) {
1318
+ this.reason = reason;
1319
+ }
1320
+
1321
+ this.code = reason.error?.code;
1322
+ }
1323
+
1324
+ get name() {
1325
+ return 'MongoSystemError';
1326
+ }
1327
+
1328
+ }
1329
+
1330
+ exports.MongoSystemError = MongoSystemError;
1331
+ /**
1332
+ * An error signifying a client-side server selection error
1333
+ * @public
1334
+ * @category Error
1335
+ */
1336
+
1337
+ class MongoServerSelectionError extends MongoSystemError {
1338
+ /**
1339
+ * **Do not use this constructor!**
1340
+ *
1341
+ * Meant for internal use only.
1342
+ *
1343
+ * @remarks
1344
+ * This class is only meant to be constructed within the driver. This constructor is
1345
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1346
+ *
1347
+ * @public
1348
+ **/
1349
+ constructor(message, reason) {
1350
+ super(message, reason);
1351
+ }
1352
+
1353
+ get name() {
1354
+ return 'MongoServerSelectionError';
1355
+ }
1356
+
1357
+ }
1358
+
1359
+ exports.MongoServerSelectionError = MongoServerSelectionError;
1360
+ /**
1361
+ * An error thrown when the server reports a writeConcernError
1362
+ * @public
1363
+ * @category Error
1364
+ */
1365
+
1366
+ class MongoWriteConcernError extends MongoServerError {
1367
+ /**
1368
+ * **Do not use this constructor!**
1369
+ *
1370
+ * Meant for internal use only.
1371
+ *
1372
+ * @remarks
1373
+ * This class is only meant to be constructed within the driver. This constructor is
1374
+ * not subject to semantic versioning compatibility guarantees and may change at any time.
1375
+ *
1376
+ * @public
1377
+ **/
1378
+ constructor(result) {
1379
+ super({ ...result.writeConcernError,
1380
+ ...result
1381
+ });
1382
+ this.errInfo = result.writeConcernError.errInfo;
1383
+ this.result = result;
1384
+ }
1385
+
1386
+ get name() {
1387
+ return 'MongoWriteConcernError';
1388
+ }
1389
+
1390
+ }
1391
+
1392
+ exports.MongoWriteConcernError = MongoWriteConcernError; // https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.md#retryable-error
1393
+
1394
+ const RETRYABLE_READ_ERROR_CODES = new Set([exports.MONGODB_ERROR_CODES.HostUnreachable, exports.MONGODB_ERROR_CODES.HostNotFound, exports.MONGODB_ERROR_CODES.NetworkTimeout, exports.MONGODB_ERROR_CODES.ShutdownInProgress, exports.MONGODB_ERROR_CODES.PrimarySteppedDown, exports.MONGODB_ERROR_CODES.SocketException, exports.MONGODB_ERROR_CODES.NotWritablePrimary, exports.MONGODB_ERROR_CODES.InterruptedAtShutdown, exports.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange, exports.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk, exports.MONGODB_ERROR_CODES.NotPrimaryOrSecondary, exports.MONGODB_ERROR_CODES.ExceededTimeLimit, exports.MONGODB_ERROR_CODES.ReadConcernMajorityNotAvailableYet]); // see: https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.md#terms
1395
+
1396
+ const RETRYABLE_WRITE_ERROR_CODES = RETRYABLE_READ_ERROR_CODES;
1397
+
1398
+ function needsRetryableWriteLabel(error, maxWireVersion, serverType) {
1399
+ // pre-4.4 server, then the driver adds an error label for every valid case
1400
+ // execute operation will only inspect the label, code/message logic is handled here
1401
+ if (error instanceof MongoNetworkError) {
1402
+ return true;
1403
+ }
1404
+
1405
+ if (error instanceof MongoError) {
1406
+ if ((maxWireVersion >= 9 || isRetryableWriteError(error)) && !error.hasErrorLabel(exports.MongoErrorLabel.HandshakeError)) {
1407
+ // If we already have the error label no need to add it again. 4.4+ servers add the label.
1408
+ // In the case where we have a handshake error, need to fall down to the logic checking
1409
+ // the codes.
1410
+ return false;
1411
+ }
1412
+ }
1413
+
1414
+ if (error instanceof MongoWriteConcernError) {
1415
+ if (serverType === 'Mongos' && maxWireVersion < 9) {
1416
+ // use original top-level code from server response
1417
+ return RETRYABLE_WRITE_ERROR_CODES.has(error.result.code ?? 0);
1418
+ }
1419
+
1420
+ const code = error.result.writeConcernError.code ?? Number(error.code);
1421
+ return RETRYABLE_WRITE_ERROR_CODES.has(Number.isNaN(code) ? 0 : code);
1422
+ }
1423
+
1424
+ if (error instanceof MongoError) {
1425
+ return RETRYABLE_WRITE_ERROR_CODES.has(Number(error.code));
1426
+ }
1427
+
1428
+ const isNotWritablePrimaryError = exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(error.message);
1429
+
1430
+ if (isNotWritablePrimaryError) {
1431
+ return true;
1432
+ }
1433
+
1434
+ const isNodeIsRecoveringError = exports.NODE_IS_RECOVERING_ERROR_MESSAGE.test(error.message);
1435
+
1436
+ if (isNodeIsRecoveringError) {
1437
+ return true;
1438
+ }
1439
+
1440
+ return false;
1441
+ }
1442
+
1443
+ function isRetryableWriteError(error) {
1444
+ return error.hasErrorLabel(exports.MongoErrorLabel.RetryableWriteError) || error.hasErrorLabel(exports.MongoErrorLabel.PoolRequstedRetry);
1445
+ }
1446
+ /** Determines whether an error is something the driver should attempt to retry */
1447
+
1448
+
1449
+ function isRetryableReadError(error) {
1450
+ const hasRetryableErrorCode = typeof error.code === 'number' ? RETRYABLE_READ_ERROR_CODES.has(error.code) : false;
1451
+
1452
+ if (hasRetryableErrorCode) {
1453
+ return true;
1454
+ }
1455
+
1456
+ if (error instanceof MongoNetworkError) {
1457
+ return true;
1458
+ }
1459
+
1460
+ const isNotWritablePrimaryError = exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(error.message);
1461
+
1462
+ if (isNotWritablePrimaryError) {
1463
+ return true;
1464
+ }
1465
+
1466
+ const isNodeIsRecoveringError = exports.NODE_IS_RECOVERING_ERROR_MESSAGE.test(error.message);
1467
+
1468
+ if (isNodeIsRecoveringError) {
1469
+ return true;
1470
+ }
1471
+
1472
+ return false;
1473
+ }
1474
+
1475
+ const SDAM_RECOVERING_CODES = new Set([exports.MONGODB_ERROR_CODES.ShutdownInProgress, exports.MONGODB_ERROR_CODES.PrimarySteppedDown, exports.MONGODB_ERROR_CODES.InterruptedAtShutdown, exports.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange, exports.MONGODB_ERROR_CODES.NotPrimaryOrSecondary]);
1476
+ const SDAM_NOT_PRIMARY_CODES = new Set([exports.MONGODB_ERROR_CODES.NotWritablePrimary, exports.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk, exports.MONGODB_ERROR_CODES.LegacyNotPrimary]);
1477
+ const SDAM_NODE_SHUTTING_DOWN_ERROR_CODES = new Set([exports.MONGODB_ERROR_CODES.InterruptedAtShutdown, exports.MONGODB_ERROR_CODES.ShutdownInProgress]);
1478
+
1479
+ function isRecoveringError(err) {
1480
+ if (typeof err.code === 'number') {
1481
+ // If any error code exists, we ignore the error.message
1482
+ return SDAM_RECOVERING_CODES.has(err.code);
1483
+ }
1484
+
1485
+ return exports.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE.test(err.message) || exports.NODE_IS_RECOVERING_ERROR_MESSAGE.test(err.message);
1486
+ }
1487
+
1488
+ function isNotWritablePrimaryError(err) {
1489
+ if (typeof err.code === 'number') {
1490
+ // If any error code exists, we ignore the error.message
1491
+ return SDAM_NOT_PRIMARY_CODES.has(err.code);
1492
+ }
1493
+
1494
+ if (isRecoveringError(err)) {
1495
+ return false;
1496
+ }
1497
+
1498
+ return exports.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(err.message);
1499
+ }
1500
+
1501
+ function isNodeShuttingDownError(err) {
1502
+ return !!(typeof err.code === 'number' && SDAM_NODE_SHUTTING_DOWN_ERROR_CODES.has(err.code));
1503
+ }
1504
+ /**
1505
+ * Determines whether SDAM can recover from a given error. If it cannot
1506
+ * then the pool will be cleared, and server state will completely reset
1507
+ * locally.
1508
+ *
1509
+ * @see https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
1510
+ */
1511
+
1512
+
1513
+ function isSDAMUnrecoverableError(error) {
1514
+ // NOTE: null check is here for a strictly pre-CMAP world, a timeout or
1515
+ // close event are considered unrecoverable
1516
+ if (error instanceof MongoParseError || error == null) {
1517
+ return true;
1518
+ }
1519
+
1520
+ return isRecoveringError(error) || isNotWritablePrimaryError(error);
1521
+ }
1522
+
1523
+ function isNetworkTimeoutError(err) {
1524
+ return !!(err instanceof MongoNetworkError && err.message.match(/timed out/));
1525
+ }
1526
+
1527
+ function isResumableError(error, wireVersion) {
1528
+ if (error == null || !(error instanceof MongoError)) {
1529
+ return false;
1530
+ }
1531
+
1532
+ if (error instanceof MongoNetworkError) {
1533
+ return true;
1534
+ }
1535
+
1536
+ if (wireVersion != null && wireVersion >= 9) {
1537
+ // DRIVERS-1308: For 4.4 drivers running against 4.4 servers, drivers will add a special case to treat the CursorNotFound error code as resumable
1538
+ if (error.code === exports.MONGODB_ERROR_CODES.CursorNotFound) {
1539
+ return true;
1540
+ }
1541
+
1542
+ return error.hasErrorLabel(exports.MongoErrorLabel.ResumableChangeStreamError);
1543
+ }
1544
+
1545
+ if (typeof error.code === 'number') {
1546
+ return exports.GET_MORE_RESUMABLE_CODES.has(error.code);
1547
+ }
1548
+
1549
+ return false;
1550
+ }