@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,535 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpCompressedRequest = exports.OpMsgResponse = exports.OpMsgRequest = exports.DocumentSequence = exports.OpReply = exports.OpQueryRequest = void 0;
4
+ const BSON = require("../bson");
5
+ const error_1 = require("../error");
6
+ const compression_1 = require("./wire_protocol/compression");
7
+ const constants_1 = require("./wire_protocol/constants");
8
+ // Incrementing request id
9
+ let _requestId = 0;
10
+ // Query flags
11
+ const OPTS_TAILABLE_CURSOR = 2;
12
+ const OPTS_SECONDARY = 4;
13
+ const OPTS_OPLOG_REPLAY = 8;
14
+ const OPTS_NO_CURSOR_TIMEOUT = 16;
15
+ const OPTS_AWAIT_DATA = 32;
16
+ const OPTS_EXHAUST = 64;
17
+ const OPTS_PARTIAL = 128;
18
+ // Response flags
19
+ const CURSOR_NOT_FOUND = 1;
20
+ const QUERY_FAILURE = 2;
21
+ const SHARD_CONFIG_STALE = 4;
22
+ const AWAIT_CAPABLE = 8;
23
+ const encodeUTF8Into = BSON.BSON.onDemand.ByteUtils.encodeUTF8Into;
24
+ /** @internal */
25
+ class OpQueryRequest {
26
+ constructor(databaseName, query, options) {
27
+ /** moreToCome is an OP_MSG only concept */
28
+ this.moreToCome = false;
29
+ // Basic options needed to be passed in
30
+ // TODO(NODE-3483): Replace with MongoCommandError
31
+ const ns = `${databaseName}.$cmd`;
32
+ if (typeof databaseName !== 'string') {
33
+ throw new error_1.MongoRuntimeError('Database name must be a string for a query');
34
+ }
35
+ // TODO(NODE-3483): Replace with MongoCommandError
36
+ if (query == null)
37
+ throw new error_1.MongoRuntimeError('A query document must be specified for query');
38
+ // Validate that we are not passing 0x00 in the collection name
39
+ if (ns.indexOf('\x00') !== -1) {
40
+ // TODO(NODE-3483): Use MongoNamespace static method
41
+ throw new error_1.MongoRuntimeError('Namespace cannot contain a null character');
42
+ }
43
+ // Basic optionsa
44
+ this.databaseName = databaseName;
45
+ this.query = query;
46
+ this.ns = ns;
47
+ // Additional options
48
+ this.numberToSkip = options.numberToSkip || 0;
49
+ this.numberToReturn = options.numberToReturn || 0;
50
+ this.returnFieldSelector = options.returnFieldSelector || undefined;
51
+ this.requestId = options.requestId ?? OpQueryRequest.getRequestId();
52
+ // special case for pre-3.2 find commands, delete ASAP
53
+ this.pre32Limit = options.pre32Limit;
54
+ // Serialization option
55
+ this.serializeFunctions =
56
+ typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
57
+ this.ignoreUndefined =
58
+ typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : false;
59
+ this.maxBsonSize = options.maxBsonSize || 1024 * 1024 * 16;
60
+ this.checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
61
+ this.batchSize = this.numberToReturn;
62
+ // Flags
63
+ this.tailable = false;
64
+ this.secondaryOk = typeof options.secondaryOk === 'boolean' ? options.secondaryOk : false;
65
+ this.oplogReplay = false;
66
+ this.noCursorTimeout = false;
67
+ this.awaitData = false;
68
+ this.exhaust = false;
69
+ this.partial = false;
70
+ }
71
+ /** Assign next request Id. */
72
+ incRequestId() {
73
+ this.requestId = _requestId++;
74
+ }
75
+ /** Peek next request Id. */
76
+ nextRequestId() {
77
+ return _requestId + 1;
78
+ }
79
+ /** Increment then return next request Id. */
80
+ static getRequestId() {
81
+ return ++_requestId;
82
+ }
83
+ // Uses a single allocated buffer for the process, avoiding multiple memory allocations
84
+ toBin() {
85
+ const buffers = [];
86
+ let projection = null;
87
+ // Set up the flags
88
+ let flags = 0;
89
+ if (this.tailable) {
90
+ flags |= OPTS_TAILABLE_CURSOR;
91
+ }
92
+ if (this.secondaryOk) {
93
+ flags |= OPTS_SECONDARY;
94
+ }
95
+ if (this.oplogReplay) {
96
+ flags |= OPTS_OPLOG_REPLAY;
97
+ }
98
+ if (this.noCursorTimeout) {
99
+ flags |= OPTS_NO_CURSOR_TIMEOUT;
100
+ }
101
+ if (this.awaitData) {
102
+ flags |= OPTS_AWAIT_DATA;
103
+ }
104
+ if (this.exhaust) {
105
+ flags |= OPTS_EXHAUST;
106
+ }
107
+ if (this.partial) {
108
+ flags |= OPTS_PARTIAL;
109
+ }
110
+ // If batchSize is different to this.numberToReturn
111
+ if (this.batchSize !== this.numberToReturn)
112
+ this.numberToReturn = this.batchSize;
113
+ // Allocate write protocol header buffer
114
+ const header = Buffer.alloc(4 * 4 + // Header
115
+ 4 + // Flags
116
+ Buffer.byteLength(this.ns) +
117
+ 1 + // namespace
118
+ 4 + // numberToSkip
119
+ 4 // numberToReturn
120
+ );
121
+ // Add header to buffers
122
+ buffers.push(header);
123
+ // Serialize the query
124
+ const query = BSON.serialize(this.query, {
125
+ checkKeys: this.checkKeys,
126
+ serializeFunctions: this.serializeFunctions,
127
+ ignoreUndefined: this.ignoreUndefined
128
+ });
129
+ // Add query document
130
+ buffers.push(query);
131
+ if (this.returnFieldSelector && Object.keys(this.returnFieldSelector).length > 0) {
132
+ // Serialize the projection document
133
+ projection = BSON.serialize(this.returnFieldSelector, {
134
+ checkKeys: this.checkKeys,
135
+ serializeFunctions: this.serializeFunctions,
136
+ ignoreUndefined: this.ignoreUndefined
137
+ });
138
+ // Add projection document
139
+ buffers.push(projection);
140
+ }
141
+ // Total message size
142
+ const totalLength = header.length + query.length + (projection ? projection.length : 0);
143
+ // Set up the index
144
+ let index = 4;
145
+ // Write total document length
146
+ header[3] = (totalLength >> 24) & 0xff;
147
+ header[2] = (totalLength >> 16) & 0xff;
148
+ header[1] = (totalLength >> 8) & 0xff;
149
+ header[0] = totalLength & 0xff;
150
+ // Write header information requestId
151
+ header[index + 3] = (this.requestId >> 24) & 0xff;
152
+ header[index + 2] = (this.requestId >> 16) & 0xff;
153
+ header[index + 1] = (this.requestId >> 8) & 0xff;
154
+ header[index] = this.requestId & 0xff;
155
+ index = index + 4;
156
+ // Write header information responseTo
157
+ header[index + 3] = (0 >> 24) & 0xff;
158
+ header[index + 2] = (0 >> 16) & 0xff;
159
+ header[index + 1] = (0 >> 8) & 0xff;
160
+ header[index] = 0 & 0xff;
161
+ index = index + 4;
162
+ // Write header information OP_QUERY
163
+ header[index + 3] = (constants_1.OP_QUERY >> 24) & 0xff;
164
+ header[index + 2] = (constants_1.OP_QUERY >> 16) & 0xff;
165
+ header[index + 1] = (constants_1.OP_QUERY >> 8) & 0xff;
166
+ header[index] = constants_1.OP_QUERY & 0xff;
167
+ index = index + 4;
168
+ // Write header information flags
169
+ header[index + 3] = (flags >> 24) & 0xff;
170
+ header[index + 2] = (flags >> 16) & 0xff;
171
+ header[index + 1] = (flags >> 8) & 0xff;
172
+ header[index] = flags & 0xff;
173
+ index = index + 4;
174
+ // Write collection name
175
+ index = index + header.write(this.ns, index, 'utf8') + 1;
176
+ header[index - 1] = 0;
177
+ // Write header information flags numberToSkip
178
+ header[index + 3] = (this.numberToSkip >> 24) & 0xff;
179
+ header[index + 2] = (this.numberToSkip >> 16) & 0xff;
180
+ header[index + 1] = (this.numberToSkip >> 8) & 0xff;
181
+ header[index] = this.numberToSkip & 0xff;
182
+ index = index + 4;
183
+ // Write header information flags numberToReturn
184
+ header[index + 3] = (this.numberToReturn >> 24) & 0xff;
185
+ header[index + 2] = (this.numberToReturn >> 16) & 0xff;
186
+ header[index + 1] = (this.numberToReturn >> 8) & 0xff;
187
+ header[index] = this.numberToReturn & 0xff;
188
+ index = index + 4;
189
+ // Return the buffers
190
+ return buffers;
191
+ }
192
+ }
193
+ exports.OpQueryRequest = OpQueryRequest;
194
+ /** @internal */
195
+ class OpReply {
196
+ constructor(message, msgHeader, msgBody, opts) {
197
+ this.index = 0;
198
+ this.sections = [];
199
+ /** moreToCome is an OP_MSG only concept */
200
+ this.moreToCome = false;
201
+ this.parsed = false;
202
+ this.raw = message;
203
+ this.data = msgBody;
204
+ this.opts = opts ?? {
205
+ useBigInt64: false,
206
+ promoteLongs: true,
207
+ promoteValues: true,
208
+ promoteBuffers: false,
209
+ bsonRegExp: false
210
+ };
211
+ // Read the message header
212
+ this.length = msgHeader.length;
213
+ this.requestId = msgHeader.requestId;
214
+ this.responseTo = msgHeader.responseTo;
215
+ this.opCode = msgHeader.opCode;
216
+ this.fromCompressed = msgHeader.fromCompressed;
217
+ // Flag values
218
+ this.useBigInt64 = typeof this.opts.useBigInt64 === 'boolean' ? this.opts.useBigInt64 : false;
219
+ this.promoteLongs = typeof this.opts.promoteLongs === 'boolean' ? this.opts.promoteLongs : true;
220
+ this.promoteValues =
221
+ typeof this.opts.promoteValues === 'boolean' ? this.opts.promoteValues : true;
222
+ this.promoteBuffers =
223
+ typeof this.opts.promoteBuffers === 'boolean' ? this.opts.promoteBuffers : false;
224
+ this.bsonRegExp = typeof this.opts.bsonRegExp === 'boolean' ? this.opts.bsonRegExp : false;
225
+ }
226
+ isParsed() {
227
+ return this.parsed;
228
+ }
229
+ parse() {
230
+ // Don't parse again if not needed
231
+ if (this.parsed)
232
+ return this.sections[0];
233
+ // Position within OP_REPLY at which documents start
234
+ // (See https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/#wire-op-reply)
235
+ this.index = 20;
236
+ // Read the message body
237
+ this.responseFlags = this.data.readInt32LE(0);
238
+ this.cursorId = new BSON.Long(this.data.readInt32LE(4), this.data.readInt32LE(8));
239
+ this.startingFrom = this.data.readInt32LE(12);
240
+ this.numberReturned = this.data.readInt32LE(16);
241
+ if (this.numberReturned < 0 || this.numberReturned > 2 ** 32 - 1) {
242
+ throw new RangeError(`OP_REPLY numberReturned is an invalid array length ${this.numberReturned}`);
243
+ }
244
+ this.cursorNotFound = (this.responseFlags & CURSOR_NOT_FOUND) !== 0;
245
+ this.queryFailure = (this.responseFlags & QUERY_FAILURE) !== 0;
246
+ this.shardConfigStale = (this.responseFlags & SHARD_CONFIG_STALE) !== 0;
247
+ this.awaitCapable = (this.responseFlags & AWAIT_CAPABLE) !== 0;
248
+ // Parse Body
249
+ for (let i = 0; i < this.numberReturned; i++) {
250
+ const bsonSize = this.data[this.index] |
251
+ (this.data[this.index + 1] << 8) |
252
+ (this.data[this.index + 2] << 16) |
253
+ (this.data[this.index + 3] << 24);
254
+ const section = this.data.subarray(this.index, this.index + bsonSize);
255
+ this.sections.push(section);
256
+ // Adjust the index
257
+ this.index = this.index + bsonSize;
258
+ }
259
+ // Set parsed
260
+ this.parsed = true;
261
+ return this.sections[0];
262
+ }
263
+ }
264
+ exports.OpReply = OpReply;
265
+ // Msg Flags
266
+ const OPTS_CHECKSUM_PRESENT = 1;
267
+ const OPTS_MORE_TO_COME = 2;
268
+ const OPTS_EXHAUST_ALLOWED = 1 << 16;
269
+ /** @internal */
270
+ class DocumentSequence {
271
+ /**
272
+ * Create a new document sequence for the provided field.
273
+ * @param field - The field it will replace.
274
+ */
275
+ constructor(field, documents) {
276
+ this.field = field;
277
+ this.documents = [];
278
+ this.chunks = [];
279
+ this.serializedDocumentsLength = 0;
280
+ // Document sequences starts with type 1 at the first byte.
281
+ // Field strings must always be UTF-8.
282
+ const buffer = Buffer.allocUnsafe(1 + 4 + this.field.length + 1);
283
+ buffer[0] = 1;
284
+ // Third part is the field name at offset 5 with trailing null byte.
285
+ encodeUTF8Into(buffer, `${this.field}\0`, 5);
286
+ this.chunks.push(buffer);
287
+ this.header = buffer;
288
+ if (documents) {
289
+ for (const doc of documents) {
290
+ this.push(doc, BSON.serialize(doc));
291
+ }
292
+ }
293
+ }
294
+ /**
295
+ * Push a document to the document sequence. Will serialize the document
296
+ * as well and return the current serialized length of all documents.
297
+ * @param document - The document to add.
298
+ * @param buffer - The serialized document in raw BSON.
299
+ * @returns The new total document sequence length.
300
+ */
301
+ push(document, buffer) {
302
+ this.serializedDocumentsLength += buffer.length;
303
+ // Push the document.
304
+ this.documents.push(document);
305
+ // Push the document raw bson.
306
+ this.chunks.push(buffer);
307
+ // Write the new length.
308
+ this.header?.writeInt32LE(4 + this.field.length + 1 + this.serializedDocumentsLength, 1);
309
+ return this.serializedDocumentsLength + this.header.length;
310
+ }
311
+ /**
312
+ * Get the fully serialized bytes for the document sequence section.
313
+ * @returns The section bytes.
314
+ */
315
+ toBin() {
316
+ return Buffer.concat(this.chunks);
317
+ }
318
+ }
319
+ exports.DocumentSequence = DocumentSequence;
320
+ /** @internal */
321
+ class OpMsgRequest {
322
+ constructor(databaseName, command, options) {
323
+ // Basic options needed to be passed in
324
+ if (command == null)
325
+ throw new error_1.MongoInvalidArgumentError('Query document must be specified for query');
326
+ // Basic optionsa
327
+ this.databaseName = databaseName;
328
+ this.command = command;
329
+ this.command.$db = databaseName;
330
+ // Ensure empty options
331
+ this.options = options ?? {};
332
+ // Additional options
333
+ this.requestId = options.requestId ? options.requestId : OpMsgRequest.getRequestId();
334
+ // Serialization option
335
+ this.serializeFunctions =
336
+ typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
337
+ this.ignoreUndefined =
338
+ typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : false;
339
+ this.checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
340
+ this.maxBsonSize = options.maxBsonSize || 1024 * 1024 * 16;
341
+ // flags
342
+ this.checksumPresent = false;
343
+ this.moreToCome = options.moreToCome ?? command.writeConcern?.w === 0;
344
+ this.exhaustAllowed =
345
+ typeof options.exhaustAllowed === 'boolean' ? options.exhaustAllowed : false;
346
+ }
347
+ toBin() {
348
+ const buffers = [];
349
+ let flags = 0;
350
+ if (this.checksumPresent) {
351
+ flags |= OPTS_CHECKSUM_PRESENT;
352
+ }
353
+ if (this.moreToCome) {
354
+ flags |= OPTS_MORE_TO_COME;
355
+ }
356
+ if (this.exhaustAllowed) {
357
+ flags |= OPTS_EXHAUST_ALLOWED;
358
+ }
359
+ const header = Buffer.alloc(4 * 4 + // Header
360
+ 4 // Flags
361
+ );
362
+ buffers.push(header);
363
+ let totalLength = header.length;
364
+ const command = this.command;
365
+ totalLength += this.makeSections(buffers, command);
366
+ header.writeInt32LE(totalLength, 0); // messageLength
367
+ header.writeInt32LE(this.requestId, 4); // requestID
368
+ header.writeInt32LE(0, 8); // responseTo
369
+ header.writeInt32LE(constants_1.OP_MSG, 12); // opCode
370
+ header.writeUInt32LE(flags, 16); // flags
371
+ return buffers;
372
+ }
373
+ /**
374
+ * Add the sections to the OP_MSG request's buffers and returns the length.
375
+ */
376
+ makeSections(buffers, document) {
377
+ const sequencesBuffer = this.extractDocumentSequences(document);
378
+ const payloadTypeBuffer = Buffer.allocUnsafe(1);
379
+ payloadTypeBuffer[0] = 0;
380
+ const documentBuffer = this.serializeBson(document);
381
+ // First section, type 0
382
+ buffers.push(payloadTypeBuffer);
383
+ buffers.push(documentBuffer);
384
+ // Subsequent sections, type 1
385
+ buffers.push(sequencesBuffer);
386
+ return payloadTypeBuffer.length + documentBuffer.length + sequencesBuffer.length;
387
+ }
388
+ /**
389
+ * Extracts the document sequences from the command document and returns
390
+ * a buffer to be added as multiple sections after the initial type 0
391
+ * section in the message.
392
+ */
393
+ extractDocumentSequences(document) {
394
+ // Pull out any field in the command document that's value is a document sequence.
395
+ const chunks = [];
396
+ for (const [key, value] of Object.entries(document)) {
397
+ if (value instanceof DocumentSequence) {
398
+ chunks.push(value.toBin());
399
+ // Why are we removing the field from the command? This is because it needs to be
400
+ // removed in the OP_MSG request first section, and DocumentSequence is not a
401
+ // BSON type and is specific to the MongoDB wire protocol so there's nothing
402
+ // our BSON serializer can do about this. Since DocumentSequence is not exposed
403
+ // in the public API and only used internally, we are never mutating an original
404
+ // command provided by the user, just our own, and it's cheaper to delete from
405
+ // our own command than copying it.
406
+ delete document[key];
407
+ }
408
+ }
409
+ if (chunks.length > 0) {
410
+ return Buffer.concat(chunks);
411
+ }
412
+ // If we have no document sequences we return an empty buffer for nothing to add
413
+ // to the payload.
414
+ return Buffer.alloc(0);
415
+ }
416
+ serializeBson(document) {
417
+ return BSON.serialize(document, {
418
+ checkKeys: this.checkKeys,
419
+ serializeFunctions: this.serializeFunctions,
420
+ ignoreUndefined: this.ignoreUndefined
421
+ });
422
+ }
423
+ static getRequestId() {
424
+ _requestId = (_requestId + 1) & 0x7fffffff;
425
+ return _requestId;
426
+ }
427
+ }
428
+ exports.OpMsgRequest = OpMsgRequest;
429
+ /** @internal */
430
+ class OpMsgResponse {
431
+ constructor(message, msgHeader, msgBody, opts) {
432
+ this.index = 0;
433
+ this.sections = [];
434
+ this.parsed = false;
435
+ this.raw = message;
436
+ this.data = msgBody;
437
+ this.opts = opts ?? {
438
+ useBigInt64: false,
439
+ promoteLongs: true,
440
+ promoteValues: true,
441
+ promoteBuffers: false,
442
+ bsonRegExp: false
443
+ };
444
+ // Read the message header
445
+ this.length = msgHeader.length;
446
+ this.requestId = msgHeader.requestId;
447
+ this.responseTo = msgHeader.responseTo;
448
+ this.opCode = msgHeader.opCode;
449
+ this.fromCompressed = msgHeader.fromCompressed;
450
+ // Read response flags
451
+ this.responseFlags = msgBody.readInt32LE(0);
452
+ this.checksumPresent = (this.responseFlags & OPTS_CHECKSUM_PRESENT) !== 0;
453
+ this.moreToCome = (this.responseFlags & OPTS_MORE_TO_COME) !== 0;
454
+ this.exhaustAllowed = (this.responseFlags & OPTS_EXHAUST_ALLOWED) !== 0;
455
+ this.useBigInt64 = typeof this.opts.useBigInt64 === 'boolean' ? this.opts.useBigInt64 : false;
456
+ this.promoteLongs = typeof this.opts.promoteLongs === 'boolean' ? this.opts.promoteLongs : true;
457
+ this.promoteValues =
458
+ typeof this.opts.promoteValues === 'boolean' ? this.opts.promoteValues : true;
459
+ this.promoteBuffers =
460
+ typeof this.opts.promoteBuffers === 'boolean' ? this.opts.promoteBuffers : false;
461
+ this.bsonRegExp = typeof this.opts.bsonRegExp === 'boolean' ? this.opts.bsonRegExp : false;
462
+ }
463
+ isParsed() {
464
+ return this.parsed;
465
+ }
466
+ parse() {
467
+ // Don't parse again if not needed
468
+ if (this.parsed)
469
+ return this.sections[0];
470
+ this.index = 4;
471
+ while (this.index < this.data.length) {
472
+ const payloadType = this.data.readUInt8(this.index++);
473
+ if (payloadType === 0) {
474
+ const bsonSize = this.data.readUInt32LE(this.index);
475
+ const bin = this.data.subarray(this.index, this.index + bsonSize);
476
+ this.sections.push(bin);
477
+ this.index += bsonSize;
478
+ }
479
+ else if (payloadType === 1) {
480
+ // It was decided that no driver makes use of payload type 1
481
+ // TODO(NODE-3483): Replace with MongoDeprecationError
482
+ throw new error_1.MongoRuntimeError('OP_MSG Payload Type 1 detected unsupported protocol');
483
+ }
484
+ }
485
+ this.parsed = true;
486
+ return this.sections[0];
487
+ }
488
+ }
489
+ exports.OpMsgResponse = OpMsgResponse;
490
+ const MESSAGE_HEADER_SIZE = 16;
491
+ const COMPRESSION_DETAILS_SIZE = 9; // originalOpcode + uncompressedSize, compressorID
492
+ /**
493
+ * @internal
494
+ *
495
+ * An OP_COMPRESSED request wraps either an OP_QUERY or OP_MSG message.
496
+ */
497
+ class OpCompressedRequest {
498
+ constructor(command, options) {
499
+ this.command = command;
500
+ this.options = {
501
+ zlibCompressionLevel: options.zlibCompressionLevel,
502
+ agreedCompressor: options.agreedCompressor
503
+ };
504
+ }
505
+ // Return whether a command contains an uncompressible command term
506
+ // Will return true if command contains no uncompressible command terms
507
+ static canCompress(command) {
508
+ const commandDoc = command instanceof OpMsgRequest ? command.command : command.query;
509
+ const commandName = Object.keys(commandDoc)[0];
510
+ return !compression_1.uncompressibleCommands.has(commandName);
511
+ }
512
+ async toBin() {
513
+ const concatenatedOriginalCommandBuffer = Buffer.concat(this.command.toBin());
514
+ // otherwise, compress the message
515
+ const messageToBeCompressed = concatenatedOriginalCommandBuffer.slice(MESSAGE_HEADER_SIZE);
516
+ // Extract information needed for OP_COMPRESSED from the uncompressed message
517
+ const originalCommandOpCode = concatenatedOriginalCommandBuffer.readInt32LE(12);
518
+ // Compress the message body
519
+ const compressedMessage = await (0, compression_1.compress)(this.options, messageToBeCompressed);
520
+ // Create the msgHeader of OP_COMPRESSED
521
+ const msgHeader = Buffer.alloc(MESSAGE_HEADER_SIZE);
522
+ msgHeader.writeInt32LE(MESSAGE_HEADER_SIZE + COMPRESSION_DETAILS_SIZE + compressedMessage.length, 0); // messageLength
523
+ msgHeader.writeInt32LE(this.command.requestId, 4); // requestID
524
+ msgHeader.writeInt32LE(0, 8); // responseTo (zero)
525
+ msgHeader.writeInt32LE(constants_1.OP_COMPRESSED, 12); // opCode
526
+ // Create the compression details of OP_COMPRESSED
527
+ const compressionDetails = Buffer.alloc(COMPRESSION_DETAILS_SIZE);
528
+ compressionDetails.writeInt32LE(originalCommandOpCode, 0); // originalOpcode
529
+ compressionDetails.writeInt32LE(messageToBeCompressed.length, 4); // Size of the uncompressed compressedMessage, excluding the MsgHeader
530
+ compressionDetails.writeUInt8(compression_1.Compressor[this.options.agreedCompressor], 8); // compressorID
531
+ return [msgHeader, compressionDetails, compressedMessage];
532
+ }
533
+ }
534
+ exports.OpCompressedRequest = OpCompressedRequest;
535
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/cmap/commands.ts"],"names":[],"mappings":";;;AACA,gCAAgC;AAChC,oCAAwE;AAIxE,6DAKqC;AACrC,yDAA4E;AAE5E,0BAA0B;AAC1B,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,cAAc;AACd,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,iBAAiB;AACjB,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,kBAAkB,GAAG,CAAC,CAAC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