@nullix/zod-mongoose-studio 1.0.13 → 2.0.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 (314) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{Db4IAypj.js → 0J_bLG6U.js} +1 -1
  3. package/.output/public/_nuxt/{Y39o1QEi.js → 5KLjKHc1.js} +1 -1
  4. package/.output/public/_nuxt/{B4zoPYF-.js → B2UrsJHg.js} +1 -1
  5. package/.output/public/_nuxt/{BSqjh6Vk.js → BC5hGokz.js} +1 -1
  6. package/.output/public/_nuxt/{BS4yU4O0.js → BJwN20Xm.js} +1 -1
  7. package/.output/public/_nuxt/{D8_n84hl.js → BMgDPqps.js} +1 -1
  8. package/.output/public/_nuxt/{CqNsQbt9.js → B_sGF2qN.js} +1 -1
  9. package/.output/public/_nuxt/{NAqlztEN.js → BeaJ7I-K.js} +10 -10
  10. package/.output/public/_nuxt/{WZ0WK9cR.js → BkE1sm_1.js} +1 -1
  11. package/.output/public/_nuxt/{kBtP64Rx.js → CADbZwE5.js} +1 -1
  12. package/.output/public/_nuxt/{B8qGaxNm.js → CB0WRoVi.js} +1 -1
  13. package/.output/public/_nuxt/{BV6uALfO.js → CCh0PVV0.js} +1 -1
  14. package/.output/public/_nuxt/{CP9Z7-_9.js → Cr0GW7rA.js} +1 -1
  15. package/.output/public/_nuxt/{DeCqoVOS.js → DJe7Wxdv.js} +1 -1
  16. package/.output/public/_nuxt/{dBZQW7JD.js → DRBrUaE5.js} +1 -1
  17. package/.output/public/_nuxt/{Db19R32y.js → DV2n9B6m.js} +1 -1
  18. package/.output/public/_nuxt/{CvnpbYw0.js → DVD-jGiv.js} +1 -1
  19. package/.output/public/_nuxt/{BWajNATZ.js → Dk9qGA5X.js} +3 -3
  20. package/.output/public/_nuxt/builds/latest.json +1 -1
  21. package/.output/public/_nuxt/builds/meta/dc761332-547d-4953-b51d-b2d453009b48.json +1 -0
  22. package/.output/public/_nuxt/error-404.64pZEiDn.css +1 -0
  23. package/.output/public/_nuxt/error-500.DHOpI0Ir.css +1 -0
  24. package/.output/public/_nuxt/{BoHhCIKW.js → koEZfutw.js} +3 -3
  25. package/.output/public/_nuxt/{B_782F4p.js → r6LdR7DN.js} +1 -1
  26. package/.output/public/_nuxt/{BEI71c6K.js → rEfOp38p.js} +1 -1
  27. package/.output/server/chunks/_/error-500.mjs.map +1 -1
  28. package/.output/server/chunks/build/client.precomputed.mjs +1 -1
  29. package/.output/server/chunks/build/{error-404-8tbBXju4.mjs → error-404-BN-7rNE4.mjs} +4 -4
  30. package/.output/server/chunks/build/error-404-BN-7rNE4.mjs.map +1 -0
  31. package/.output/server/chunks/build/error-404-styles.Byx46oLR.mjs +8 -0
  32. package/.output/server/chunks/build/error-404-styles.Byx46oLR.mjs.map +1 -0
  33. package/.output/server/chunks/build/{error-500-DxFsom1i.mjs → error-500-DhIQ-2yt.mjs} +4 -4
  34. package/.output/server/chunks/build/error-500-DhIQ-2yt.mjs.map +1 -0
  35. package/.output/server/chunks/build/error-500-styles.BL3UT0Wa.mjs +8 -0
  36. package/.output/server/chunks/build/error-500-styles.BL3UT0Wa.mjs.map +1 -0
  37. package/.output/server/chunks/build/{index-BB-Clavm.mjs → index-Dnrh1ePF.mjs} +1 -1
  38. package/.output/server/chunks/build/index-Dnrh1ePF.mjs.map +1 -0
  39. package/.output/server/chunks/build/server.mjs +9 -9
  40. package/.output/server/chunks/build/styles.mjs +4 -4
  41. package/.output/server/chunks/nitro/nitro.mjs +333 -333
  42. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  43. package/.output/server/chunks/routes/renderer.mjs.map +1 -1
  44. package/.output/server/node_modules/bson/lib/bson.cjs +157 -48
  45. package/.output/server/node_modules/bson/package.json +9 -11
  46. package/.output/server/node_modules/kareem/index.js +228 -343
  47. package/.output/server/node_modules/kareem/package.json +3 -3
  48. package/.output/server/node_modules/mongodb/lib/bson.js +27 -5
  49. package/.output/server/node_modules/mongodb/lib/bulk/common.js +7 -9
  50. package/.output/server/node_modules/mongodb/lib/change_stream.js +91 -39
  51. package/.output/server/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js +21 -14
  52. package/.output/server/node_modules/mongodb/lib/client-side-encryption/client_encryption.js +2 -5
  53. package/.output/server/node_modules/mongodb/lib/client-side-encryption/errors.js +3 -1
  54. package/.output/server/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js +1 -1
  55. package/.output/server/node_modules/mongodb/lib/client-side-encryption/state_machine.js +1 -0
  56. package/.output/server/node_modules/mongodb/lib/cmap/auth/aws4.js +161 -0
  57. package/.output/server/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js +11 -58
  58. package/.output/server/node_modules/mongodb/lib/cmap/auth/gssapi.js +4 -6
  59. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js +2 -16
  60. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js +14 -23
  61. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +3 -3
  62. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +3 -3
  63. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +4 -3
  64. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +4 -3
  65. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js +4 -4
  66. package/.output/server/node_modules/mongodb/lib/cmap/auth/plain.js +1 -1
  67. package/.output/server/node_modules/mongodb/lib/cmap/auth/providers.js +0 -1
  68. package/.output/server/node_modules/mongodb/lib/cmap/auth/scram.js +53 -40
  69. package/.output/server/node_modules/mongodb/lib/cmap/commands.js +46 -39
  70. package/.output/server/node_modules/mongodb/lib/cmap/connect.js +35 -3
  71. package/.output/server/node_modules/mongodb/lib/cmap/connection.js +36 -32
  72. package/.output/server/node_modules/mongodb/lib/cmap/connection_pool.js +67 -67
  73. package/.output/server/node_modules/mongodb/lib/cmap/connection_pool_events.js +3 -3
  74. package/.output/server/node_modules/mongodb/lib/cmap/errors.js +1 -1
  75. package/.output/server/node_modules/mongodb/lib/cmap/handshake/client_metadata.js +15 -13
  76. package/.output/server/node_modules/mongodb/lib/cmap/metrics.js +3 -3
  77. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/compression.js +26 -10
  78. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/constants.js +3 -1
  79. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js +0 -1
  80. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js +9 -9
  81. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/responses.js +2 -2
  82. package/.output/server/node_modules/mongodb/lib/collection.js +1 -1
  83. package/.output/server/node_modules/mongodb/lib/connection_string.js +30 -15
  84. package/.output/server/node_modules/mongodb/lib/cursor/abstract_cursor.js +17 -34
  85. package/.output/server/node_modules/mongodb/lib/cursor/change_stream_cursor.js +2 -2
  86. package/.output/server/node_modules/mongodb/lib/cursor/find_cursor.js +37 -26
  87. package/.output/server/node_modules/mongodb/lib/cursor/run_command_cursor.js +1 -1
  88. package/.output/server/node_modules/mongodb/lib/db.js +6 -7
  89. package/.output/server/node_modules/mongodb/lib/deps.js +0 -13
  90. package/.output/server/node_modules/mongodb/lib/error.js +7 -10
  91. package/.output/server/node_modules/mongodb/lib/gridfs/download.js +7 -6
  92. package/.output/server/node_modules/mongodb/lib/gridfs/index.js +9 -9
  93. package/.output/server/node_modules/mongodb/lib/gridfs/upload.js +17 -23
  94. package/.output/server/node_modules/mongodb/lib/index.js +2 -4
  95. package/.output/server/node_modules/mongodb/lib/mongo_client.js +58 -67
  96. package/.output/server/node_modules/mongodb/lib/mongo_client_auth_providers.js +0 -6
  97. package/.output/server/node_modules/mongodb/lib/mongo_logger.js +11 -5
  98. package/.output/server/node_modules/mongodb/lib/mongo_types.js +1 -2
  99. package/.output/server/node_modules/mongodb/lib/operations/aggregate.js +0 -3
  100. package/.output/server/node_modules/mongodb/lib/operations/create_collection.js +0 -1
  101. package/.output/server/node_modules/mongodb/lib/operations/drop.js +8 -9
  102. package/.output/server/node_modules/mongodb/lib/operations/end_sessions.js +34 -0
  103. package/.output/server/node_modules/mongodb/lib/operations/execute_operation.js +121 -45
  104. package/.output/server/node_modules/mongodb/lib/operations/operation.js +1 -0
  105. package/.output/server/node_modules/mongodb/lib/read_preference.js +10 -14
  106. package/.output/server/node_modules/mongodb/lib/runtime_adapters.js +32 -0
  107. package/.output/server/node_modules/mongodb/lib/sdam/monitor.js +8 -8
  108. package/.output/server/node_modules/mongodb/lib/sdam/server.js +55 -43
  109. package/.output/server/node_modules/mongodb/lib/sdam/server_description.js +1 -1
  110. package/.output/server/node_modules/mongodb/lib/sdam/server_selection.js +135 -72
  111. package/.output/server/node_modules/mongodb/lib/sdam/srv_polling.js +3 -3
  112. package/.output/server/node_modules/mongodb/lib/sdam/topology.js +37 -77
  113. package/.output/server/node_modules/mongodb/lib/sdam/topology_description.js +1 -1
  114. package/.output/server/node_modules/mongodb/lib/sessions.js +150 -40
  115. package/.output/server/node_modules/mongodb/lib/transactions.js +2 -13
  116. package/.output/server/node_modules/mongodb/lib/utils.js +42 -90
  117. package/.output/server/node_modules/mongodb/package.json +49 -45
  118. package/.output/server/node_modules/mongodb-connection-string-url/lib/index.js +45 -19
  119. package/.output/server/node_modules/mongodb-connection-string-url/lib/redact.js +30 -19
  120. package/.output/server/node_modules/mongodb-connection-string-url/package.json +25 -16
  121. package/.output/server/node_modules/mongoose/lib/aggregate.js +108 -127
  122. package/.output/server/node_modules/mongoose/lib/cast/bigint.js +3 -3
  123. package/.output/server/node_modules/mongoose/lib/cast/boolean.js +3 -3
  124. package/.output/server/node_modules/mongoose/lib/cast/double.js +4 -4
  125. package/.output/server/node_modules/mongoose/lib/cast/int32.js +2 -2
  126. package/.output/server/node_modules/mongoose/lib/cast/number.js +6 -6
  127. package/.output/server/node_modules/mongoose/lib/cast/string.js +3 -3
  128. package/.output/server/node_modules/mongoose/lib/cast/uuid.js +5 -48
  129. package/.output/server/node_modules/mongoose/lib/cast.js +16 -24
  130. package/.output/server/node_modules/mongoose/lib/collection.js +6 -6
  131. package/.output/server/node_modules/mongoose/lib/connection.js +108 -105
  132. package/.output/server/node_modules/mongoose/lib/cursor/aggregationCursor.js +23 -33
  133. package/.output/server/node_modules/mongoose/lib/cursor/changeStream.js +60 -40
  134. package/.output/server/node_modules/mongoose/lib/cursor/queryCursor.js +21 -25
  135. package/.output/server/node_modules/mongoose/lib/document.js +712 -531
  136. package/.output/server/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js +85 -130
  137. package/.output/server/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js +32 -41
  138. package/.output/server/node_modules/mongoose/lib/error/cast.js +21 -12
  139. package/.output/server/node_modules/mongoose/lib/error/createCollectionsError.js +2 -2
  140. package/.output/server/node_modules/mongoose/lib/error/divergentArray.js +1 -1
  141. package/.output/server/node_modules/mongoose/lib/error/eachAsyncMultiError.js +1 -1
  142. package/.output/server/node_modules/mongoose/lib/error/index.js +3 -3
  143. package/.output/server/node_modules/mongoose/lib/error/invalidSchemaOption.js +1 -1
  144. package/.output/server/node_modules/mongoose/lib/error/messages.js +1 -0
  145. package/.output/server/node_modules/mongoose/lib/error/missingSchema.js +1 -1
  146. package/.output/server/node_modules/mongoose/lib/error/objectParameter.js +4 -5
  147. package/.output/server/node_modules/mongoose/lib/error/overwriteModel.js +1 -1
  148. package/.output/server/node_modules/mongoose/lib/error/setOptionError.js +3 -3
  149. package/.output/server/node_modules/mongoose/lib/error/strict.js +3 -3
  150. package/.output/server/node_modules/mongoose/lib/error/strictPopulate.js +2 -2
  151. package/.output/server/node_modules/mongoose/lib/error/syncIndexes.js +2 -2
  152. package/.output/server/node_modules/mongoose/lib/error/validation.js +2 -10
  153. package/.output/server/node_modules/mongoose/lib/error/validator.js +1 -1
  154. package/.output/server/node_modules/mongoose/lib/error/version.js +2 -2
  155. package/.output/server/node_modules/mongoose/lib/helpers/aggregate/prepareDiscriminatorPipeline.js +4 -4
  156. package/.output/server/node_modules/mongoose/lib/helpers/buildMiddlewareFilter.js +24 -0
  157. package/.output/server/node_modules/mongoose/lib/helpers/clone.js +35 -18
  158. package/.output/server/node_modules/mongoose/lib/helpers/common.js +5 -5
  159. package/.output/server/node_modules/mongoose/lib/helpers/cursor/eachAsync.js +4 -4
  160. package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getConstructor.js +1 -1
  161. package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getDiscriminatorByValue.js +1 -1
  162. package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js +1 -1
  163. package/.output/server/node_modules/mongoose/lib/helpers/discriminator/mergeDiscriminatorSchema.js +10 -5
  164. package/.output/server/node_modules/mongoose/lib/helpers/document/applyDefaults.js +1 -1
  165. package/.output/server/node_modules/mongoose/lib/helpers/document/applyTimestamps.js +11 -10
  166. package/.output/server/node_modules/mongoose/lib/helpers/document/applyVirtuals.js +10 -9
  167. package/.output/server/node_modules/mongoose/lib/helpers/document/cleanModifiedSubpaths.js +1 -1
  168. package/.output/server/node_modules/mongoose/lib/helpers/document/compile.js +17 -14
  169. package/.output/server/node_modules/mongoose/lib/helpers/document/getDeepestSubdocumentForPath.js +3 -3
  170. package/.output/server/node_modules/mongoose/lib/helpers/document/getEmbeddedDiscriminatorPath.js +2 -2
  171. package/.output/server/node_modules/mongoose/lib/helpers/document/isInPathsToSave.js +24 -0
  172. package/.output/server/node_modules/mongoose/lib/helpers/get.js +1 -1
  173. package/.output/server/node_modules/mongoose/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +1 -1
  174. package/.output/server/node_modules/mongoose/lib/helpers/indexes/getRelatedIndexes.js +3 -3
  175. package/.output/server/node_modules/mongoose/lib/helpers/indexes/isIndexEqual.js +3 -4
  176. package/.output/server/node_modules/mongoose/lib/helpers/indexes/isIndexSpecEqual.js +3 -3
  177. package/.output/server/node_modules/mongoose/lib/helpers/isBsonType.js +1 -1
  178. package/.output/server/node_modules/mongoose/lib/helpers/isMongooseObject.js +1 -1
  179. package/.output/server/node_modules/mongoose/lib/helpers/isObject.js +2 -2
  180. package/.output/server/node_modules/mongoose/lib/helpers/isSimpleValidator.js +2 -2
  181. package/.output/server/node_modules/mongoose/lib/helpers/minimize.js +2 -2
  182. package/.output/server/node_modules/mongoose/lib/helpers/model/applyDefaultsToPOJO.js +2 -2
  183. package/.output/server/node_modules/mongoose/lib/helpers/model/applyHooks.js +55 -54
  184. package/.output/server/node_modules/mongoose/lib/helpers/model/applyMethods.js +2 -2
  185. package/.output/server/node_modules/mongoose/lib/helpers/model/applyStaticHooks.js +1 -48
  186. package/.output/server/node_modules/mongoose/lib/helpers/model/castBulkWrite.js +8 -12
  187. package/.output/server/node_modules/mongoose/lib/helpers/model/discriminator.js +1 -1
  188. package/.output/server/node_modules/mongoose/lib/helpers/parallelLimit.js +18 -36
  189. package/.output/server/node_modules/mongoose/lib/helpers/pluralize.js +4 -4
  190. package/.output/server/node_modules/mongoose/lib/helpers/populate/assignRawDocsToIdStructure.js +4 -11
  191. package/.output/server/node_modules/mongoose/lib/helpers/populate/assignVals.js +10 -10
  192. package/.output/server/node_modules/mongoose/lib/helpers/populate/createPopulateQueryFilter.js +3 -3
  193. package/.output/server/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js +197 -69
  194. package/.output/server/node_modules/mongoose/lib/helpers/populate/getSchemaTypes.js +15 -15
  195. package/.output/server/node_modules/mongoose/lib/helpers/populate/markArraySubdocsPopulated.js +1 -1
  196. package/.output/server/node_modules/mongoose/lib/helpers/populate/modelNamesFromRefPath.js +10 -2
  197. package/.output/server/node_modules/mongoose/lib/helpers/populate/setPopulatedVirtualValue.js +5 -5
  198. package/.output/server/node_modules/mongoose/lib/helpers/printJestWarning.js +1 -1
  199. package/.output/server/node_modules/mongoose/lib/helpers/processConnectionOptions.js +1 -1
  200. package/.output/server/node_modules/mongoose/lib/helpers/projection/hasIncludedChildren.js +1 -1
  201. package/.output/server/node_modules/mongoose/lib/helpers/projection/isPathExcluded.js +3 -3
  202. package/.output/server/node_modules/mongoose/lib/helpers/projection/isSubpath.js +1 -1
  203. package/.output/server/node_modules/mongoose/lib/helpers/projection/parseProjection.js +9 -4
  204. package/.output/server/node_modules/mongoose/lib/helpers/query/cast$expr.js +8 -10
  205. package/.output/server/node_modules/mongoose/lib/helpers/query/castFilterPath.js +1 -1
  206. package/.output/server/node_modules/mongoose/lib/helpers/query/castUpdate.js +44 -38
  207. package/.output/server/node_modules/mongoose/lib/helpers/query/getEmbeddedDiscriminatorPath.js +8 -8
  208. package/.output/server/node_modules/mongoose/lib/helpers/query/handleImmutable.js +8 -8
  209. package/.output/server/node_modules/mongoose/lib/helpers/schema/applyPlugins.js +2 -2
  210. package/.output/server/node_modules/mongoose/lib/helpers/schema/applyReadConcern.js +1 -1
  211. package/.output/server/node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js +4 -2
  212. package/.output/server/node_modules/mongoose/lib/helpers/schema/getIndexes.js +5 -11
  213. package/.output/server/node_modules/mongoose/lib/helpers/schema/getSubdocumentStrictValue.js +2 -2
  214. package/.output/server/node_modules/mongoose/lib/helpers/schema/handleIdOption.js +1 -1
  215. package/.output/server/node_modules/mongoose/lib/helpers/schema/idGetter.js +1 -1
  216. package/.output/server/node_modules/mongoose/lib/helpers/schematype/handleImmutable.js +1 -1
  217. package/.output/server/node_modules/mongoose/lib/helpers/setDefaultsOnInsert.js +26 -13
  218. package/.output/server/node_modules/mongoose/lib/helpers/timestamps/setDocumentTimestamps.js +2 -2
  219. package/.output/server/node_modules/mongoose/lib/helpers/timestamps/setupTimestamps.js +60 -38
  220. package/.output/server/node_modules/mongoose/lib/helpers/update/applyTimestampsToUpdate.js +13 -10
  221. package/.output/server/node_modules/mongoose/lib/helpers/update/castArrayFilters.js +4 -4
  222. package/.output/server/node_modules/mongoose/lib/helpers/update/decorateUpdateWithVersionKey.js +1 -1
  223. package/.output/server/node_modules/mongoose/lib/helpers/update/modifiedPaths.js +2 -2
  224. package/.output/server/node_modules/mongoose/lib/helpers/update/removeUnusedArrayFilters.js +7 -2
  225. package/.output/server/node_modules/mongoose/lib/helpers/updateValidators.js +58 -119
  226. package/.output/server/node_modules/mongoose/lib/model.js +940 -946
  227. package/.output/server/node_modules/mongoose/lib/mongoose.js +131 -79
  228. package/.output/server/node_modules/mongoose/lib/options/schemaArrayOptions.js +2 -2
  229. package/.output/server/node_modules/mongoose/lib/options/schemaBufferOptions.js +1 -1
  230. package/.output/server/node_modules/mongoose/lib/options/schemaDocumentArrayOptions.js +23 -0
  231. package/.output/server/node_modules/mongoose/lib/options/schemaNumberOptions.js +3 -3
  232. package/.output/server/node_modules/mongoose/lib/options/schemaObjectIdOptions.js +2 -2
  233. package/.output/server/node_modules/mongoose/lib/options/schemaStringOptions.js +6 -6
  234. package/.output/server/node_modules/mongoose/lib/options/schemaSubdocumentOptions.js +23 -0
  235. package/.output/server/node_modules/mongoose/lib/options/schemaTypeOptions.js +27 -13
  236. package/.output/server/node_modules/mongoose/lib/options/virtualOptions.js +12 -12
  237. package/.output/server/node_modules/mongoose/lib/plugins/index.js +0 -1
  238. package/.output/server/node_modules/mongoose/lib/plugins/saveSubdocs.js +84 -92
  239. package/.output/server/node_modules/mongoose/lib/plugins/sharding.js +33 -15
  240. package/.output/server/node_modules/mongoose/lib/plugins/trackTransaction.js +29 -25
  241. package/.output/server/node_modules/mongoose/lib/query.js +700 -548
  242. package/.output/server/node_modules/mongoose/lib/queryHelpers.js +34 -32
  243. package/.output/server/node_modules/mongoose/lib/schema/array.js +69 -113
  244. package/.output/server/node_modules/mongoose/lib/schema/bigint.js +18 -20
  245. package/.output/server/node_modules/mongoose/lib/schema/boolean.js +20 -22
  246. package/.output/server/node_modules/mongoose/lib/schema/buffer.js +23 -25
  247. package/.output/server/node_modules/mongoose/lib/schema/date.js +19 -21
  248. package/.output/server/node_modules/mongoose/lib/schema/decimal128.js +16 -18
  249. package/.output/server/node_modules/mongoose/lib/schema/documentArray.js +94 -131
  250. package/.output/server/node_modules/mongoose/lib/schema/documentArrayElement.js +50 -16
  251. package/.output/server/node_modules/mongoose/lib/schema/double.js +16 -18
  252. package/.output/server/node_modules/mongoose/lib/schema/index.js +1 -0
  253. package/.output/server/node_modules/mongoose/lib/schema/int32.js +17 -19
  254. package/.output/server/node_modules/mongoose/lib/schema/map.js +17 -24
  255. package/.output/server/node_modules/mongoose/lib/schema/mixed.js +14 -14
  256. package/.output/server/node_modules/mongoose/lib/schema/number.js +38 -28
  257. package/.output/server/node_modules/mongoose/lib/schema/objectId.js +18 -20
  258. package/.output/server/node_modules/mongoose/lib/schema/operators/exists.js +1 -1
  259. package/.output/server/node_modules/mongoose/lib/schema/operators/geospatial.js +1 -1
  260. package/.output/server/node_modules/mongoose/lib/schema/operators/text.js +4 -4
  261. package/.output/server/node_modules/mongoose/lib/schema/string.js +42 -27
  262. package/.output/server/node_modules/mongoose/lib/schema/subdocument.js +47 -58
  263. package/.output/server/node_modules/mongoose/lib/schema/union.js +54 -4
  264. package/.output/server/node_modules/mongoose/lib/schema/uuid.js +17 -40
  265. package/.output/server/node_modules/mongoose/lib/schema.js +235 -176
  266. package/.output/server/node_modules/mongoose/lib/schemaType.js +227 -158
  267. package/.output/server/node_modules/mongoose/lib/stateMachine.js +5 -8
  268. package/.output/server/node_modules/mongoose/lib/types/array/index.js +5 -5
  269. package/.output/server/node_modules/mongoose/lib/types/array/methods/index.js +27 -28
  270. package/.output/server/node_modules/mongoose/lib/types/arraySubdocument.js +11 -11
  271. package/.output/server/node_modules/mongoose/lib/types/buffer.js +15 -15
  272. package/.output/server/node_modules/mongoose/lib/types/decimal128.js +1 -1
  273. package/.output/server/node_modules/mongoose/lib/types/documentArray/index.js +4 -4
  274. package/.output/server/node_modules/mongoose/lib/types/documentArray/methods/index.js +15 -13
  275. package/.output/server/node_modules/mongoose/lib/types/double.js +1 -1
  276. package/.output/server/node_modules/mongoose/lib/types/map.js +20 -71
  277. package/.output/server/node_modules/mongoose/lib/types/objectid.js +1 -1
  278. package/.output/server/node_modules/mongoose/lib/types/subdocument.js +32 -81
  279. package/.output/server/node_modules/mongoose/lib/types/uuid.js +1 -1
  280. package/.output/server/node_modules/mongoose/lib/utils.js +91 -70
  281. package/.output/server/node_modules/mongoose/lib/validOptions.js +4 -3
  282. package/.output/server/node_modules/mongoose/lib/virtualType.js +18 -18
  283. package/.output/server/node_modules/mongoose/package.json +46 -63
  284. package/.output/server/node_modules/mquery/lib/collection/collection.js +3 -1
  285. package/.output/server/node_modules/mquery/lib/collection/node.js +17 -3
  286. package/.output/server/node_modules/mquery/lib/mquery.js +136 -93
  287. package/.output/server/node_modules/mquery/lib/permissions.js +21 -6
  288. package/.output/server/node_modules/mquery/package.json +4 -7
  289. package/.output/server/package.json +7 -9
  290. package/package.json +3 -3
  291. package/.output/public/_nuxt/builds/meta/0d6006db-fbb0-4297-85cf-bf92ceafcb79.json +0 -1
  292. package/.output/public/_nuxt/error-404.CTWLHxjC.css +0 -1
  293. package/.output/public/_nuxt/error-500.UBfk8-QP.css +0 -1
  294. package/.output/server/chunks/build/error-404-8tbBXju4.mjs.map +0 -1
  295. package/.output/server/chunks/build/error-404-styles.BeWfK6Py.mjs +0 -8
  296. package/.output/server/chunks/build/error-404-styles.BeWfK6Py.mjs.map +0 -1
  297. package/.output/server/chunks/build/error-500-DxFsom1i.mjs.map +0 -1
  298. package/.output/server/chunks/build/error-500-styles.CPUUvoY-.mjs +0 -8
  299. package/.output/server/chunks/build/error-500-styles.CPUUvoY-.mjs.map +0 -1
  300. package/.output/server/chunks/build/index-BB-Clavm.mjs.map +0 -1
  301. package/.output/server/node_modules/debug/package.json +0 -64
  302. package/.output/server/node_modules/debug/src/browser.js +0 -272
  303. package/.output/server/node_modules/debug/src/common.js +0 -292
  304. package/.output/server/node_modules/debug/src/index.js +0 -10
  305. package/.output/server/node_modules/debug/src/node.js +0 -263
  306. package/.output/server/node_modules/mongodb/lib/client-side-encryption/crypto_callbacks.js +0 -81
  307. package/.output/server/node_modules/mongodb/lib/resource_management.js +0 -58
  308. package/.output/server/node_modules/mongoose/lib/browserDocument.js +0 -101
  309. package/.output/server/node_modules/mongoose/lib/documentProvider.js +0 -30
  310. package/.output/server/node_modules/mongoose/lib/helpers/createJSONSchemaTypeDefinition.js +0 -24
  311. package/.output/server/node_modules/mongoose/lib/helpers/promiseOrCallback.js +0 -54
  312. package/.output/server/node_modules/mongoose/lib/plugins/validateBeforeSave.js +0 -51
  313. package/.output/server/node_modules/supports-color/index.js +0 -202
  314. package/.output/server/node_modules/supports-color/package.json +0 -64
@@ -23,6 +23,61 @@ exports.PoolState = Object.freeze({
23
23
  * @internal
24
24
  */
25
25
  class ConnectionPool extends mongo_types_1.TypedEventEmitter {
26
+ /**
27
+ * Emitted when the connection pool is created.
28
+ * @event
29
+ */
30
+ static { this.CONNECTION_POOL_CREATED = constants_1.CONNECTION_POOL_CREATED; }
31
+ /**
32
+ * Emitted once when the connection pool is closed
33
+ * @event
34
+ */
35
+ static { this.CONNECTION_POOL_CLOSED = constants_1.CONNECTION_POOL_CLOSED; }
36
+ /**
37
+ * Emitted each time the connection pool is cleared and it's generation incremented
38
+ * @event
39
+ */
40
+ static { this.CONNECTION_POOL_CLEARED = constants_1.CONNECTION_POOL_CLEARED; }
41
+ /**
42
+ * Emitted each time the connection pool is marked ready
43
+ * @event
44
+ */
45
+ static { this.CONNECTION_POOL_READY = constants_1.CONNECTION_POOL_READY; }
46
+ /**
47
+ * Emitted when a connection is created.
48
+ * @event
49
+ */
50
+ static { this.CONNECTION_CREATED = constants_1.CONNECTION_CREATED; }
51
+ /**
52
+ * Emitted when a connection becomes established, and is ready to use
53
+ * @event
54
+ */
55
+ static { this.CONNECTION_READY = constants_1.CONNECTION_READY; }
56
+ /**
57
+ * Emitted when a connection is closed
58
+ * @event
59
+ */
60
+ static { this.CONNECTION_CLOSED = constants_1.CONNECTION_CLOSED; }
61
+ /**
62
+ * Emitted when an attempt to check out a connection begins
63
+ * @event
64
+ */
65
+ static { this.CONNECTION_CHECK_OUT_STARTED = constants_1.CONNECTION_CHECK_OUT_STARTED; }
66
+ /**
67
+ * Emitted when an attempt to check out a connection fails
68
+ * @event
69
+ */
70
+ static { this.CONNECTION_CHECK_OUT_FAILED = constants_1.CONNECTION_CHECK_OUT_FAILED; }
71
+ /**
72
+ * Emitted each time a connection is successfully checked out of the connection pool
73
+ * @event
74
+ */
75
+ static { this.CONNECTION_CHECKED_OUT = constants_1.CONNECTION_CHECKED_OUT; }
76
+ /**
77
+ * Emitted each time a connection is successfully checked into the connection pool
78
+ * @event
79
+ */
80
+ static { this.CONNECTION_CHECKED_IN = constants_1.CONNECTION_CHECKED_IN; }
26
81
  constructor(server, options) {
27
82
  super();
28
83
  this.on('error', utils_1.noop);
@@ -56,7 +111,7 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
56
111
  this.processingWaitQueue = false;
57
112
  this.mongoLogger = this.server.topology.client?.mongoLogger;
58
113
  this.component = 'connection';
59
- process.nextTick(() => {
114
+ queueMicrotask(() => {
60
115
  this.emitAndLog(ConnectionPool.CONNECTION_POOL_CREATED, new connection_pool_events_1.ConnectionPoolCreatedEvent(this));
61
116
  });
62
117
  }
@@ -129,7 +184,7 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
129
184
  * explicitly destroyed by the new owner.
130
185
  */
131
186
  async checkOut(options) {
132
- const checkoutTime = (0, utils_1.now)();
187
+ const checkoutTime = (0, utils_1.processTimeMS)();
133
188
  this.emitAndLog(ConnectionPool.CONNECTION_CHECK_OUT_STARTED, new connection_pool_events_1.ConnectionCheckOutStartedEvent(this));
134
189
  const { promise, resolve, reject } = (0, utils_1.promiseWithResolvers)();
135
190
  const timeout = options.timeoutContext.connectionCheckoutTimeout;
@@ -144,7 +199,7 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
144
199
  reject(this.reason);
145
200
  });
146
201
  this.waitQueue.push(waitQueueMember);
147
- process.nextTick(() => this.processWaitQueue());
202
+ queueMicrotask(() => this.processWaitQueue());
148
203
  try {
149
204
  timeout?.throwIfExpired();
150
205
  return await (timeout ? Promise.race([promise, timeout]) : promise);
@@ -193,7 +248,7 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
193
248
  const reason = connection.closed ? 'error' : poolClosed ? 'poolClosed' : 'stale';
194
249
  this.destroyConnection(connection, reason);
195
250
  }
196
- process.nextTick(() => this.processWaitQueue());
251
+ queueMicrotask(() => this.processWaitQueue());
197
252
  }
198
253
  /**
199
254
  * Clear the pool
@@ -238,7 +293,7 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
238
293
  }));
239
294
  }
240
295
  if (interruptInUseConnections) {
241
- process.nextTick(() => this.interruptInUseConnections(oldGeneration));
296
+ queueMicrotask(() => this.interruptInUseConnections(oldGeneration));
242
297
  }
243
298
  this.processWaitQueue();
244
299
  }
@@ -342,9 +397,9 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
342
397
  return true;
343
398
  }
344
399
  createConnection(callback) {
345
- // Note that metadata and extendedMetadata may have changed on the client but have
346
- // been frozen here, so we pull the extendedMetadata promise always from the client
347
- // no mattter what options were set at the construction of the pool.
400
+ // Note that metadata may have changed on the client but have
401
+ // been frozen here, so we pull the metadata promise always from the client
402
+ // no matter what options were set at the construction of the pool.
348
403
  const connectOptions = {
349
404
  ...this.options,
350
405
  id: this.connectionCounter.next().value,
@@ -352,11 +407,11 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
352
407
  cancellationToken: this.cancellationToken,
353
408
  mongoLogger: this.mongoLogger,
354
409
  authProviders: this.server.topology.client.s.authProviders,
355
- extendedMetadata: this.server.topology.client.options.extendedMetadata
410
+ metadata: this.server.topology.client.options.metadata
356
411
  };
357
412
  this.pending++;
358
413
  // This is our version of a "virtual" no-I/O connection as the spec requires
359
- const connectionCreatedTime = (0, utils_1.now)();
414
+ const connectionCreatedTime = (0, utils_1.processTimeMS)();
360
415
  this.emitAndLog(ConnectionPool.CONNECTION_CREATED, new connection_pool_events_1.ConnectionCreatedEvent(this, { id: connectOptions.id }));
361
416
  (0, connect_1.connect)(connectOptions).then(connection => {
362
417
  // The pool might have closed since we started trying to create a connection
@@ -416,7 +471,7 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
416
471
  this.createConnection((err, connection) => {
417
472
  if (!err && connection) {
418
473
  this.connections.push(connection);
419
- process.nextTick(() => this.processWaitQueue());
474
+ queueMicrotask(() => this.processWaitQueue());
420
475
  }
421
476
  if (this.poolState === exports.PoolState.ready) {
422
477
  (0, timers_1.clearTimeout)(this.minPoolSizeTimer);
@@ -493,66 +548,11 @@ class ConnectionPool extends mongo_types_1.TypedEventEmitter {
493
548
  waitQueueMember.resolve(connection);
494
549
  }
495
550
  }
496
- process.nextTick(() => this.processWaitQueue());
551
+ queueMicrotask(() => this.processWaitQueue());
497
552
  });
498
553
  }
499
554
  this.processingWaitQueue = false;
500
555
  }
501
556
  }
502
557
  exports.ConnectionPool = ConnectionPool;
503
- /**
504
- * Emitted when the connection pool is created.
505
- * @event
506
- */
507
- ConnectionPool.CONNECTION_POOL_CREATED = constants_1.CONNECTION_POOL_CREATED;
508
- /**
509
- * Emitted once when the connection pool is closed
510
- * @event
511
- */
512
- ConnectionPool.CONNECTION_POOL_CLOSED = constants_1.CONNECTION_POOL_CLOSED;
513
- /**
514
- * Emitted each time the connection pool is cleared and it's generation incremented
515
- * @event
516
- */
517
- ConnectionPool.CONNECTION_POOL_CLEARED = constants_1.CONNECTION_POOL_CLEARED;
518
- /**
519
- * Emitted each time the connection pool is marked ready
520
- * @event
521
- */
522
- ConnectionPool.CONNECTION_POOL_READY = constants_1.CONNECTION_POOL_READY;
523
- /**
524
- * Emitted when a connection is created.
525
- * @event
526
- */
527
- ConnectionPool.CONNECTION_CREATED = constants_1.CONNECTION_CREATED;
528
- /**
529
- * Emitted when a connection becomes established, and is ready to use
530
- * @event
531
- */
532
- ConnectionPool.CONNECTION_READY = constants_1.CONNECTION_READY;
533
- /**
534
- * Emitted when a connection is closed
535
- * @event
536
- */
537
- ConnectionPool.CONNECTION_CLOSED = constants_1.CONNECTION_CLOSED;
538
- /**
539
- * Emitted when an attempt to check out a connection begins
540
- * @event
541
- */
542
- ConnectionPool.CONNECTION_CHECK_OUT_STARTED = constants_1.CONNECTION_CHECK_OUT_STARTED;
543
- /**
544
- * Emitted when an attempt to check out a connection fails
545
- * @event
546
- */
547
- ConnectionPool.CONNECTION_CHECK_OUT_FAILED = constants_1.CONNECTION_CHECK_OUT_FAILED;
548
- /**
549
- * Emitted each time a connection is successfully checked out of the connection pool
550
- * @event
551
- */
552
- ConnectionPool.CONNECTION_CHECKED_OUT = constants_1.CONNECTION_CHECKED_OUT;
553
- /**
554
- * Emitted each time a connection is successfully checked into the connection pool
555
- * @event
556
- */
557
- ConnectionPool.CONNECTION_CHECKED_IN = constants_1.CONNECTION_CHECKED_IN;
558
558
  //# sourceMappingURL=connection_pool.js.map
@@ -86,7 +86,7 @@ class ConnectionReadyEvent extends ConnectionPoolMonitoringEvent {
86
86
  super(pool);
87
87
  /** @internal */
88
88
  this.name = constants_1.CONNECTION_READY;
89
- this.durationMS = (0, utils_1.now)() - connectionCreatedEventTime;
89
+ this.durationMS = (0, utils_1.processTimeMS)() - connectionCreatedEventTime;
90
90
  this.connectionId = connection.id;
91
91
  }
92
92
  }
@@ -134,7 +134,7 @@ class ConnectionCheckOutFailedEvent extends ConnectionPoolMonitoringEvent {
134
134
  super(pool);
135
135
  /** @internal */
136
136
  this.name = constants_1.CONNECTION_CHECK_OUT_FAILED;
137
- this.durationMS = (0, utils_1.now)() - checkoutTime;
137
+ this.durationMS = (0, utils_1.processTimeMS)() - checkoutTime;
138
138
  this.reason = reason;
139
139
  this.error = error;
140
140
  }
@@ -151,7 +151,7 @@ class ConnectionCheckedOutEvent extends ConnectionPoolMonitoringEvent {
151
151
  super(pool);
152
152
  /** @internal */
153
153
  this.name = constants_1.CONNECTION_CHECKED_OUT;
154
- this.durationMS = (0, utils_1.now)() - checkoutTime;
154
+ this.durationMS = (0, utils_1.processTimeMS)() - checkoutTime;
155
155
  this.connectionId = connection.id;
156
156
  }
157
157
  }
@@ -49,7 +49,7 @@ class PoolClearedError extends error_1.MongoNetworkError {
49
49
  : `Connection pool for ${pool.address} was cleared because another operation failed with: "${pool.serverError?.message}"`;
50
50
  super(errorMessage, pool.serverError ? { cause: pool.serverError } : undefined);
51
51
  this.address = pool.address;
52
- this.addErrorLabel(error_1.MongoErrorLabel.PoolRequstedRetry);
52
+ this.addErrorLabel(error_1.MongoErrorLabel.PoolRequestedRetry);
53
53
  }
54
54
  get name() {
55
55
  return 'MongoPoolClearedError';
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LimitedSizeDocument = void 0;
4
4
  exports.isDriverInfoEqual = isDriverInfoEqual;
5
5
  exports.makeClientMetadata = makeClientMetadata;
6
- exports.addContainerMetadata = addContainerMetadata;
7
6
  exports.getFAASEnv = getFAASEnv;
8
- const os = require("os");
9
7
  const process = require("process");
10
8
  const bson_1 = require("../../bson");
11
9
  const error_1 = require("../../error");
@@ -62,13 +60,13 @@ exports.LimitedSizeDocument = LimitedSizeDocument;
62
60
  * 3. Omit the `env` document entirely.
63
61
  * 4. Truncate `platform`. -- special we do not truncate this field
64
62
  */
65
- function makeClientMetadata(driverInfoList, { appName = '' }) {
63
+ async function makeClientMetadata(driverInfoList, { appName = '', runtime: { os } }) {
66
64
  const metadataDocument = new LimitedSizeDocument(512);
67
65
  // Add app name first, it must be sent
68
66
  if (appName.length > 0) {
69
- const name = Buffer.byteLength(appName, 'utf8') <= 128
67
+ const name = bson_1.ByteUtils.utf8ByteLength(appName) <= 128
70
68
  ? appName
71
- : Buffer.from(appName, 'utf8').subarray(0, 128).toString('utf8');
69
+ : bson_1.ByteUtils.toUTF8(bson_1.ByteUtils.fromUTF8(appName), 0, 128, false);
72
70
  metadataDocument.ifItFitsItSits('application', { name });
73
71
  }
74
72
  const driverInfo = {
@@ -99,8 +97,8 @@ function makeClientMetadata(driverInfoList, { appName = '' }) {
99
97
  }
100
98
  // Note: order matters, os.type is last so it will be removed last if we're at maxSize
101
99
  const osInfo = new Map()
102
- .set('name', process.platform)
103
- .set('architecture', process.arch)
100
+ .set('name', os.platform())
101
+ .set('architecture', os.arch())
104
102
  .set('version', os.release())
105
103
  .set('type', os.type());
106
104
  if (!metadataDocument.ifItFitsItSits('os', osInfo)) {
@@ -124,16 +122,16 @@ function makeClientMetadata(driverInfoList, { appName = '' }) {
124
122
  }
125
123
  }
126
124
  }
127
- return metadataDocument.toObject();
125
+ return await addContainerMetadata(metadataDocument.toObject());
128
126
  }
129
127
  let dockerPromise;
130
128
  /** @internal */
131
129
  async function getContainerMetadata() {
132
- const containerMetadata = {};
133
130
  dockerPromise ??= (0, utils_1.fileIsAccessible)('/.dockerenv');
134
131
  const isDocker = await dockerPromise;
135
132
  const { KUBERNETES_SERVICE_HOST = '' } = process.env;
136
133
  const isKubernetes = KUBERNETES_SERVICE_HOST.length > 0 ? true : false;
134
+ const containerMetadata = {};
137
135
  if (isDocker)
138
136
  containerMetadata.runtime = 'docker';
139
137
  if (isKubernetes)
@@ -150,7 +148,10 @@ async function addContainerMetadata(originalMetadata) {
150
148
  if (Object.keys(containerMetadata).length === 0)
151
149
  return originalMetadata;
152
150
  const extendedMetadata = new LimitedSizeDocument(512);
153
- const extendedEnvMetadata = { ...originalMetadata?.env, container: containerMetadata };
151
+ const extendedEnvMetadata = {
152
+ ...originalMetadata?.env,
153
+ container: containerMetadata
154
+ };
154
155
  for (const [key, val] of Object.entries(originalMetadata)) {
155
156
  if (key !== 'env') {
156
157
  extendedMetadata.ifItFitsItSits(key, val);
@@ -226,14 +227,15 @@ function getFAASEnv() {
226
227
  * with a future change to these global objects.
227
228
  */
228
229
  function getRuntimeInfo() {
230
+ const endianness = bson_1.NumberUtils.isBigEndian ? 'BE' : 'LE';
229
231
  if ('Deno' in globalThis) {
230
232
  const version = typeof Deno?.version?.deno === 'string' ? Deno?.version?.deno : '0.0.0-unknown';
231
- return `Deno v${version}, ${os.endianness()}`;
233
+ return `Deno v${version}, ${endianness}`;
232
234
  }
233
235
  if ('Bun' in globalThis) {
234
236
  const version = typeof Bun?.version === 'string' ? Bun?.version : '0.0.0-unknown';
235
- return `Bun v${version}, ${os.endianness()}`;
237
+ return `Bun v${version}, ${endianness}`;
236
238
  }
237
- return `Node.js ${process.version}, ${os.endianness()}`;
239
+ return `Node.js ${process.version}, ${endianness}`;
238
240
  }
239
241
  //# sourceMappingURL=client_metadata.js.map
@@ -8,6 +8,9 @@ class ConnectionPoolMetrics {
8
8
  this.cursorConnections = 0;
9
9
  this.otherConnections = 0;
10
10
  }
11
+ static { this.TXN = 'txn'; }
12
+ static { this.CURSOR = 'cursor'; }
13
+ static { this.OTHER = 'other'; }
11
14
  /**
12
15
  * Mark a connection as pinned for a specific operation.
13
16
  */
@@ -56,7 +59,4 @@ class ConnectionPoolMetrics {
56
59
  }
57
60
  }
58
61
  exports.ConnectionPoolMetrics = ConnectionPoolMetrics;
59
- ConnectionPoolMetrics.TXN = 'txn';
60
- ConnectionPoolMetrics.CURSOR = 'cursor';
61
- ConnectionPoolMetrics.OTHER = 'other';
62
62
  //# sourceMappingURL=metrics.js.map
@@ -5,8 +5,8 @@ exports.compress = compress;
5
5
  exports.decompress = decompress;
6
6
  exports.compressCommand = compressCommand;
7
7
  exports.decompressResponse = decompressResponse;
8
- const util_1 = require("util");
9
8
  const zlib = require("zlib");
9
+ const bson_1 = require("../../bson");
10
10
  const constants_1 = require("../../constants");
11
11
  const deps_1 = require("../../deps");
12
12
  const error_1 = require("../../error");
@@ -32,8 +32,24 @@ exports.uncompressibleCommands = new Set([
32
32
  'copydb'
33
33
  ]);
34
34
  const ZSTD_COMPRESSION_LEVEL = 3;
35
- const zlibInflate = (0, util_1.promisify)(zlib.inflate.bind(zlib));
36
- const zlibDeflate = (0, util_1.promisify)(zlib.deflate.bind(zlib));
35
+ const zlibInflate = (buf) => {
36
+ return new Promise((resolve, reject) => {
37
+ zlib.inflate(buf, (error, result) => {
38
+ if (error)
39
+ return reject(error);
40
+ resolve(result);
41
+ });
42
+ });
43
+ };
44
+ const zlibDeflate = (buf, options) => {
45
+ return new Promise((resolve, reject) => {
46
+ zlib.deflate(buf, options, (error, result) => {
47
+ if (error)
48
+ return reject(error);
49
+ resolve(result);
50
+ });
51
+ });
52
+ };
37
53
  let zstd;
38
54
  let Snappy = null;
39
55
  function loadSnappy() {
@@ -123,7 +139,7 @@ async function compressCommand(command, description) {
123
139
  zlibCompressionLevel: description.zlibCompressionLevel ?? 0
124
140
  });
125
141
  const data = await finalCommand.toBin();
126
- return Buffer.concat(data);
142
+ return bson_1.ByteUtils.concat(data);
127
143
  }
128
144
  /**
129
145
  * @internal
@@ -134,10 +150,10 @@ async function compressCommand(command, description) {
134
150
  */
135
151
  async function decompressResponse(message) {
136
152
  const messageHeader = {
137
- length: message.readInt32LE(0),
138
- requestId: message.readInt32LE(4),
139
- responseTo: message.readInt32LE(8),
140
- opCode: message.readInt32LE(12)
153
+ length: (0, bson_1.readInt32LE)(message, 0),
154
+ requestId: (0, bson_1.readInt32LE)(message, 4),
155
+ responseTo: (0, bson_1.readInt32LE)(message, 8),
156
+ opCode: (0, bson_1.readInt32LE)(message, 12)
141
157
  };
142
158
  if (messageHeader.opCode !== constants_2.OP_COMPRESSED) {
143
159
  const ResponseType = messageHeader.opCode === constants_2.OP_MSG ? commands_1.OpMsgResponse : commands_1.OpReply;
@@ -147,8 +163,8 @@ async function decompressResponse(message) {
147
163
  const header = {
148
164
  ...messageHeader,
149
165
  fromCompressed: true,
150
- opCode: message.readInt32LE(MESSAGE_HEADER_SIZE),
151
- length: message.readInt32LE(MESSAGE_HEADER_SIZE + 4)
166
+ opCode: (0, bson_1.readInt32LE)(message, MESSAGE_HEADER_SIZE),
167
+ length: (0, bson_1.readInt32LE)(message, MESSAGE_HEADER_SIZE + 4)
152
168
  };
153
169
  const compressorID = message[MESSAGE_HEADER_SIZE + 8];
154
170
  const compressedBuffer = message.slice(MESSAGE_HEADER_SIZE + 9);
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OP_MSG = exports.OP_COMPRESSED = exports.OP_DELETE = exports.OP_QUERY = exports.OP_INSERT = exports.OP_UPDATE = exports.OP_REPLY = exports.MIN_SUPPORTED_RAW_DATA_SERVER_VERSION = exports.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION = exports.MIN_SUPPORTED_QE_SERVER_VERSION = exports.MIN_SUPPORTED_QE_WIRE_VERSION = exports.MAX_SUPPORTED_WIRE_VERSION = exports.MIN_SUPPORTED_WIRE_VERSION = exports.MAX_SUPPORTED_SERVER_VERSION = exports.MIN_SUPPORTED_SERVER_VERSION = void 0;
3
+ exports.OP_MSG = exports.OP_COMPRESSED = exports.OP_DELETE = exports.OP_QUERY = exports.OP_INSERT = exports.OP_UPDATE = exports.OP_REPLY = exports.MIN_SUPPORTED_RAW_DATA_SERVER_VERSION = exports.MIN_SUPPORTED_RAW_DATA_WIRE_VERSION = exports.MIN_SUPPORTED_QE_SERVER_VERSION = exports.MIN_SUPPORTED_QE_WIRE_VERSION = exports.MAX_SUPPORTED_WIRE_VERSION = exports.MIN_SUPPORTED_WIRE_VERSION = exports.MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION = exports.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION = exports.MAX_SUPPORTED_SERVER_VERSION = exports.MIN_SUPPORTED_SERVER_VERSION = void 0;
4
4
  exports.MIN_SUPPORTED_SERVER_VERSION = '4.2';
5
5
  exports.MAX_SUPPORTED_SERVER_VERSION = '8.2';
6
+ exports.MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION = 13;
7
+ exports.MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION = '5.0';
6
8
  exports.MIN_SUPPORTED_WIRE_VERSION = 8;
7
9
  exports.MAX_SUPPORTED_WIRE_VERSION = 27;
8
10
  exports.MIN_SUPPORTED_QE_WIRE_VERSION = 21;
@@ -65,7 +65,6 @@ function onData(emitter, { timeoutContext, signal }) {
65
65
  [Symbol.asyncIterator]() {
66
66
  return this;
67
67
  },
68
- // Note this should currently not be used, but is required by the AsyncGenerator interface.
69
68
  async [Symbol.asyncDispose]() {
70
69
  await closeHandler();
71
70
  }
@@ -103,24 +103,24 @@ class OnDemandDocument {
103
103
  case bson_1.BSONType.undefined:
104
104
  return null;
105
105
  case bson_1.BSONType.double:
106
- return (0, bson_1.getFloat64LE)(this.bson, offset);
106
+ return bson_1.NumberUtils.getFloat64LE(this.bson, offset);
107
107
  case bson_1.BSONType.int:
108
- return (0, bson_1.getInt32LE)(this.bson, offset);
108
+ return bson_1.NumberUtils.getInt32LE(this.bson, offset);
109
109
  case bson_1.BSONType.long:
110
- return (0, bson_1.getBigInt64LE)(this.bson, offset);
110
+ return bson_1.NumberUtils.getBigInt64LE(this.bson, offset);
111
111
  case bson_1.BSONType.bool:
112
112
  return Boolean(this.bson[offset]);
113
113
  case bson_1.BSONType.objectId:
114
114
  return new bson_1.ObjectId(this.bson.subarray(offset, offset + 12));
115
115
  case bson_1.BSONType.timestamp:
116
- return new bson_1.Timestamp((0, bson_1.getBigInt64LE)(this.bson, offset));
116
+ return new bson_1.Timestamp(bson_1.NumberUtils.getBigInt64LE(this.bson, offset));
117
117
  case bson_1.BSONType.string:
118
- return (0, bson_1.toUTF8)(this.bson, offset + 4, offset + length - 1, false);
118
+ return bson_1.ByteUtils.toUTF8(this.bson, offset + 4, offset + length - 1, false);
119
119
  case bson_1.BSONType.binData: {
120
- const totalBinarySize = (0, bson_1.getInt32LE)(this.bson, offset);
120
+ const totalBinarySize = bson_1.NumberUtils.getInt32LE(this.bson, offset);
121
121
  const subType = this.bson[offset + 4];
122
122
  if (subType === 2) {
123
- const subType2BinarySize = (0, bson_1.getInt32LE)(this.bson, offset + 1 + 4);
123
+ const subType2BinarySize = bson_1.NumberUtils.getInt32LE(this.bson, offset + 1 + 4);
124
124
  if (subType2BinarySize < 0)
125
125
  throw new bson_1.BSONError('Negative binary type element size found for subtype 0x02');
126
126
  if (subType2BinarySize > totalBinarySize - 4)
@@ -133,7 +133,7 @@ class OnDemandDocument {
133
133
  }
134
134
  case bson_1.BSONType.date:
135
135
  // Pretend this is correct.
136
- return new Date(Number((0, bson_1.getBigInt64LE)(this.bson, offset)));
136
+ return new Date(Number(bson_1.NumberUtils.getBigInt64LE(this.bson, offset)));
137
137
  case bson_1.BSONType.object:
138
138
  return new OnDemandDocument(this.bson, offset);
139
139
  case bson_1.BSONType.array:
@@ -214,7 +214,7 @@ class OnDemandDocument {
214
214
  }
215
215
  /** Returns this document's bytes only */
216
216
  toBytes() {
217
- const size = (0, bson_1.getInt32LE)(this.bson, this.offset);
217
+ const size = bson_1.NumberUtils.getInt32LE(this.bson, this.offset);
218
218
  return this.bson.subarray(this.offset, this.offset + size);
219
219
  }
220
220
  }
@@ -65,6 +65,8 @@ class MongoDBResponse extends document_1.OnDemandDocument {
65
65
  ? new MongoDBResponse(bson, 0, false, elements)
66
66
  : new this(bson, 0, false, elements);
67
67
  }
68
+ // {ok:1}
69
+ static { this.empty = new MongoDBResponse(new Uint8Array([13, 0, 0, 0, 16, 111, 107, 0, 1, 0, 0, 0, 0])); }
68
70
  /**
69
71
  * Returns true iff:
70
72
  * - ok is 0 and the top-level code === 50
@@ -155,8 +157,6 @@ class MongoDBResponse extends document_1.OnDemandDocument {
155
157
  }
156
158
  }
157
159
  exports.MongoDBResponse = MongoDBResponse;
158
- // {ok:1}
159
- MongoDBResponse.empty = new MongoDBResponse(new Uint8Array([13, 0, 0, 0, 16, 111, 107, 0, 1, 0, 0, 0, 0]));
160
160
  /** @internal */
161
161
  class CursorResponse extends MongoDBResponse {
162
162
  constructor() {
@@ -307,7 +307,7 @@ class Collection {
307
307
  // Explicitly set the limit to 1 and singleBatch to true for all commands, per the spec.
308
308
  // noCursorTimeout must be unset as well as batchSize.
309
309
  // See: https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#findone-api-details
310
- const { batchSize: _batchSize, noCursorTimeout: _noCursorTimeout, ...opts } = options;
310
+ const { ...opts } = options;
311
311
  opts.singleBatch = true;
312
312
  const cursor = this.find(filter, opts).limit(1);
313
313
  const result = await cursor.next();
@@ -5,6 +5,7 @@ exports.resolveSRVRecord = resolveSRVRecord;
5
5
  exports.parseOptions = parseOptions;
6
6
  const dns = require("dns");
7
7
  const mongodb_connection_string_url_1 = require("mongodb-connection-string-url");
8
+ const process = require("process");
8
9
  const url_1 = require("url");
9
10
  const mongo_credentials_1 = require("./cmap/auth/mongo_credentials");
10
11
  const providers_1 = require("./cmap/auth/providers");
@@ -15,6 +16,7 @@ const mongo_client_1 = require("./mongo_client");
15
16
  const mongo_logger_1 = require("./mongo_logger");
16
17
  const read_concern_1 = require("./read_concern");
17
18
  const read_preference_1 = require("./read_preference");
19
+ const runtime_adapters_1 = require("./runtime_adapters");
18
20
  const monitor_1 = require("./sdam/monitor");
19
21
  const utils_1 = require("./utils");
20
22
  const write_concern_1 = require("./write_concern");
@@ -22,14 +24,17 @@ const VALID_TXT_RECORDS = ['authSource', 'replicaSet', 'loadBalanced'];
22
24
  const LB_SINGLE_HOST_ERROR = 'loadBalanced option only supported with a single host in the URI';
23
25
  const LB_REPLICA_SET_ERROR = 'loadBalanced option not supported with a replicaSet option';
24
26
  const LB_DIRECT_CONNECTION_ERROR = 'loadBalanced option not supported when directConnection is provided';
25
- function retryDNSTimeoutFor(api) {
27
+ function retryDNSTimeoutFor(rrtype) {
28
+ const resolve = rrtype === 'SRV'
29
+ ? (address) => dns.promises.resolve(address, 'SRV')
30
+ : (address) => dns.promises.resolve(address, 'TXT');
26
31
  return async function dnsReqRetryTimeout(lookupAddress) {
27
32
  try {
28
- return await dns.promises[api](lookupAddress);
33
+ return await resolve(lookupAddress);
29
34
  }
30
35
  catch (firstDNSError) {
31
36
  if (firstDNSError.code === dns.TIMEOUT) {
32
- return await dns.promises[api](lookupAddress);
37
+ return await resolve(lookupAddress);
33
38
  }
34
39
  else {
35
40
  throw firstDNSError;
@@ -37,8 +42,8 @@ function retryDNSTimeoutFor(api) {
37
42
  }
38
43
  };
39
44
  }
40
- const resolveSrv = retryDNSTimeoutFor('resolveSrv');
41
- const resolveTxt = retryDNSTimeoutFor('resolveTxt');
45
+ const resolveSrv = retryDNSTimeoutFor('SRV');
46
+ const resolveTxt = retryDNSTimeoutFor('TXT');
42
47
  /**
43
48
  * Lookup a `mongodb+srv` connection string, combine the parts and reparse it as a normal
44
49
  * connection string.
@@ -308,8 +313,14 @@ function parseOptions(uri, mongoClient = undefined, options = {}) {
308
313
  source: mongoOptions.dbName
309
314
  });
310
315
  }
311
- if (isAws && mongoOptions.credentials.username && !mongoOptions.credentials.password) {
312
- throw new error_1.MongoMissingCredentialsError(`When using ${mongoOptions.credentials.mechanism} password must be set when a username is specified`);
316
+ if (isAws) {
317
+ const { username, password } = mongoOptions.credentials;
318
+ if (username || password) {
319
+ throw new error_1.MongoAPIError('username and password cannot be provided when using MONGODB-AWS. Credentials must be provided in a manner that can be read by the AWS SDK.');
320
+ }
321
+ if (mongoOptions.credentials.mechanismProperties.AWS_SESSION_TOKEN) {
322
+ throw new error_1.MongoAPIError('AWS_SESSION_TOKEN cannot be provided when using MONGODB-AWS. Credentials must be provided in a manner that can be read by the AWS SDK.');
323
+ }
313
324
  }
314
325
  mongoOptions.credentials.validate();
315
326
  // Check if the only auth related option provided was authSource, if so we can remove credentials
@@ -389,6 +400,7 @@ function parseOptions(uri, mongoClient = undefined, options = {}) {
389
400
  mongodbLogComponentSeverities: mongoOptions.mongodbLogComponentSeverities,
390
401
  mongodbLogMaxDocumentLength: mongoOptions.mongodbLogMaxDocumentLength
391
402
  });
403
+ mongoOptions.runtime = (0, runtime_adapters_1.resolveRuntimeAdapters)(options);
392
404
  return mongoOptions;
393
405
  }
394
406
  /**
@@ -459,6 +471,10 @@ function setOption(mongoOptions, key, descriptor, values) {
459
471
  }
460
472
  }
461
473
  exports.OPTIONS = {
474
+ enableOverloadRetargeting: {
475
+ default: false,
476
+ type: 'boolean'
477
+ },
462
478
  appName: {
463
479
  type: 'string'
464
480
  },
@@ -682,6 +698,10 @@ exports.OPTIONS = {
682
698
  default: 15,
683
699
  type: 'uint'
684
700
  },
701
+ maxAdaptiveRetries: {
702
+ default: 2,
703
+ type: 'uint'
704
+ },
685
705
  maxConnecting: {
686
706
  default: 2,
687
707
  transform({ name, values: [value] }) {
@@ -860,6 +880,9 @@ exports.OPTIONS = {
860
880
  default: true,
861
881
  type: 'boolean'
862
882
  },
883
+ runtimeAdapters: {
884
+ type: 'record'
885
+ },
863
886
  serializeFunctions: {
864
887
  type: 'boolean'
865
888
  },
@@ -1075,14 +1098,6 @@ exports.OPTIONS = {
1075
1098
  secureProtocol: { type: 'any' },
1076
1099
  index: { type: 'any' },
1077
1100
  // Legacy options from v3 era
1078
- useNewUrlParser: {
1079
- type: 'boolean',
1080
- deprecated: 'useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version'
1081
- },
1082
- useUnifiedTopology: {
1083
- type: 'boolean',
1084
- deprecated: 'useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version'
1085
- },
1086
1101
  __skipPingOnConnect: { type: 'boolean' }
1087
1102
  };
1088
1103
  exports.DEFAULT_OPTIONS = new CaseInsensitiveMap(Object.entries(exports.OPTIONS)