@nullix/zod-mongoose-studio 1.0.13 → 2.1.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 (268) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/builds/latest.json +1 -1
  3. package/.output/public/_nuxt/builds/meta/8b851c04-1848-472a-b5cd-0727aaaf90f4.json +1 -0
  4. package/.output/server/chunks/nitro/nitro.mjs +232 -232
  5. package/.output/server/chunks/routes/api/parse.post.mjs +54 -11
  6. package/.output/server/chunks/routes/api/parse.post.mjs.map +1 -1
  7. package/.output/server/node_modules/bson/lib/bson.cjs +157 -48
  8. package/.output/server/node_modules/bson/package.json +9 -11
  9. package/.output/server/node_modules/kareem/index.js +228 -343
  10. package/.output/server/node_modules/kareem/package.json +3 -3
  11. package/.output/server/node_modules/mongodb/lib/bson.js +27 -5
  12. package/.output/server/node_modules/mongodb/lib/bulk/common.js +7 -9
  13. package/.output/server/node_modules/mongodb/lib/change_stream.js +91 -39
  14. package/.output/server/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js +21 -14
  15. package/.output/server/node_modules/mongodb/lib/client-side-encryption/client_encryption.js +2 -5
  16. package/.output/server/node_modules/mongodb/lib/client-side-encryption/errors.js +3 -1
  17. package/.output/server/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js +1 -1
  18. package/.output/server/node_modules/mongodb/lib/client-side-encryption/state_machine.js +1 -0
  19. package/.output/server/node_modules/mongodb/lib/cmap/auth/aws4.js +161 -0
  20. package/.output/server/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js +11 -58
  21. package/.output/server/node_modules/mongodb/lib/cmap/auth/gssapi.js +4 -6
  22. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js +2 -16
  23. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js +14 -23
  24. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +3 -3
  25. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +3 -3
  26. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +4 -3
  27. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +4 -3
  28. package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js +4 -4
  29. package/.output/server/node_modules/mongodb/lib/cmap/auth/plain.js +1 -1
  30. package/.output/server/node_modules/mongodb/lib/cmap/auth/providers.js +0 -1
  31. package/.output/server/node_modules/mongodb/lib/cmap/auth/scram.js +53 -40
  32. package/.output/server/node_modules/mongodb/lib/cmap/commands.js +46 -39
  33. package/.output/server/node_modules/mongodb/lib/cmap/connect.js +35 -3
  34. package/.output/server/node_modules/mongodb/lib/cmap/connection.js +36 -32
  35. package/.output/server/node_modules/mongodb/lib/cmap/connection_pool.js +67 -67
  36. package/.output/server/node_modules/mongodb/lib/cmap/connection_pool_events.js +3 -3
  37. package/.output/server/node_modules/mongodb/lib/cmap/errors.js +1 -1
  38. package/.output/server/node_modules/mongodb/lib/cmap/handshake/client_metadata.js +15 -13
  39. package/.output/server/node_modules/mongodb/lib/cmap/metrics.js +3 -3
  40. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/compression.js +26 -10
  41. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/constants.js +3 -1
  42. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js +0 -1
  43. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js +9 -9
  44. package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/responses.js +2 -2
  45. package/.output/server/node_modules/mongodb/lib/collection.js +1 -1
  46. package/.output/server/node_modules/mongodb/lib/connection_string.js +30 -15
  47. package/.output/server/node_modules/mongodb/lib/cursor/abstract_cursor.js +17 -34
  48. package/.output/server/node_modules/mongodb/lib/cursor/change_stream_cursor.js +2 -2
  49. package/.output/server/node_modules/mongodb/lib/cursor/find_cursor.js +37 -26
  50. package/.output/server/node_modules/mongodb/lib/cursor/run_command_cursor.js +1 -1
  51. package/.output/server/node_modules/mongodb/lib/db.js +6 -7
  52. package/.output/server/node_modules/mongodb/lib/deps.js +0 -13
  53. package/.output/server/node_modules/mongodb/lib/error.js +7 -10
  54. package/.output/server/node_modules/mongodb/lib/gridfs/download.js +7 -6
  55. package/.output/server/node_modules/mongodb/lib/gridfs/index.js +9 -9
  56. package/.output/server/node_modules/mongodb/lib/gridfs/upload.js +17 -23
  57. package/.output/server/node_modules/mongodb/lib/index.js +2 -4
  58. package/.output/server/node_modules/mongodb/lib/mongo_client.js +58 -67
  59. package/.output/server/node_modules/mongodb/lib/mongo_client_auth_providers.js +0 -6
  60. package/.output/server/node_modules/mongodb/lib/mongo_logger.js +11 -5
  61. package/.output/server/node_modules/mongodb/lib/mongo_types.js +1 -2
  62. package/.output/server/node_modules/mongodb/lib/operations/aggregate.js +0 -3
  63. package/.output/server/node_modules/mongodb/lib/operations/create_collection.js +0 -1
  64. package/.output/server/node_modules/mongodb/lib/operations/drop.js +8 -9
  65. package/.output/server/node_modules/mongodb/lib/operations/end_sessions.js +34 -0
  66. package/.output/server/node_modules/mongodb/lib/operations/execute_operation.js +121 -45
  67. package/.output/server/node_modules/mongodb/lib/operations/operation.js +1 -0
  68. package/.output/server/node_modules/mongodb/lib/read_preference.js +10 -14
  69. package/.output/server/node_modules/mongodb/lib/runtime_adapters.js +32 -0
  70. package/.output/server/node_modules/mongodb/lib/sdam/monitor.js +8 -8
  71. package/.output/server/node_modules/mongodb/lib/sdam/server.js +55 -43
  72. package/.output/server/node_modules/mongodb/lib/sdam/server_description.js +1 -1
  73. package/.output/server/node_modules/mongodb/lib/sdam/server_selection.js +135 -72
  74. package/.output/server/node_modules/mongodb/lib/sdam/srv_polling.js +3 -3
  75. package/.output/server/node_modules/mongodb/lib/sdam/topology.js +37 -77
  76. package/.output/server/node_modules/mongodb/lib/sdam/topology_description.js +1 -1
  77. package/.output/server/node_modules/mongodb/lib/sessions.js +150 -40
  78. package/.output/server/node_modules/mongodb/lib/transactions.js +2 -13
  79. package/.output/server/node_modules/mongodb/lib/utils.js +42 -90
  80. package/.output/server/node_modules/mongodb/package.json +49 -45
  81. package/.output/server/node_modules/mongodb-connection-string-url/lib/index.js +45 -19
  82. package/.output/server/node_modules/mongodb-connection-string-url/lib/redact.js +30 -19
  83. package/.output/server/node_modules/mongodb-connection-string-url/package.json +25 -16
  84. package/.output/server/node_modules/mongoose/lib/aggregate.js +108 -127
  85. package/.output/server/node_modules/mongoose/lib/cast/bigint.js +3 -3
  86. package/.output/server/node_modules/mongoose/lib/cast/boolean.js +3 -3
  87. package/.output/server/node_modules/mongoose/lib/cast/double.js +4 -4
  88. package/.output/server/node_modules/mongoose/lib/cast/int32.js +2 -2
  89. package/.output/server/node_modules/mongoose/lib/cast/number.js +6 -6
  90. package/.output/server/node_modules/mongoose/lib/cast/string.js +3 -3
  91. package/.output/server/node_modules/mongoose/lib/cast/uuid.js +5 -48
  92. package/.output/server/node_modules/mongoose/lib/cast.js +16 -24
  93. package/.output/server/node_modules/mongoose/lib/collection.js +6 -6
  94. package/.output/server/node_modules/mongoose/lib/connection.js +108 -105
  95. package/.output/server/node_modules/mongoose/lib/cursor/aggregationCursor.js +23 -33
  96. package/.output/server/node_modules/mongoose/lib/cursor/changeStream.js +60 -40
  97. package/.output/server/node_modules/mongoose/lib/cursor/queryCursor.js +21 -25
  98. package/.output/server/node_modules/mongoose/lib/document.js +712 -531
  99. package/.output/server/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js +85 -130
  100. package/.output/server/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js +32 -41
  101. package/.output/server/node_modules/mongoose/lib/error/cast.js +21 -12
  102. package/.output/server/node_modules/mongoose/lib/error/createCollectionsError.js +2 -2
  103. package/.output/server/node_modules/mongoose/lib/error/divergentArray.js +1 -1
  104. package/.output/server/node_modules/mongoose/lib/error/eachAsyncMultiError.js +1 -1
  105. package/.output/server/node_modules/mongoose/lib/error/index.js +3 -3
  106. package/.output/server/node_modules/mongoose/lib/error/invalidSchemaOption.js +1 -1
  107. package/.output/server/node_modules/mongoose/lib/error/messages.js +1 -0
  108. package/.output/server/node_modules/mongoose/lib/error/missingSchema.js +1 -1
  109. package/.output/server/node_modules/mongoose/lib/error/objectParameter.js +4 -5
  110. package/.output/server/node_modules/mongoose/lib/error/overwriteModel.js +1 -1
  111. package/.output/server/node_modules/mongoose/lib/error/setOptionError.js +3 -3
  112. package/.output/server/node_modules/mongoose/lib/error/strict.js +3 -3
  113. package/.output/server/node_modules/mongoose/lib/error/strictPopulate.js +2 -2
  114. package/.output/server/node_modules/mongoose/lib/error/syncIndexes.js +2 -2
  115. package/.output/server/node_modules/mongoose/lib/error/validation.js +2 -10
  116. package/.output/server/node_modules/mongoose/lib/error/validator.js +1 -1
  117. package/.output/server/node_modules/mongoose/lib/error/version.js +2 -2
  118. package/.output/server/node_modules/mongoose/lib/helpers/aggregate/prepareDiscriminatorPipeline.js +4 -4
  119. package/.output/server/node_modules/mongoose/lib/helpers/buildMiddlewareFilter.js +24 -0
  120. package/.output/server/node_modules/mongoose/lib/helpers/clone.js +35 -18
  121. package/.output/server/node_modules/mongoose/lib/helpers/common.js +5 -5
  122. package/.output/server/node_modules/mongoose/lib/helpers/cursor/eachAsync.js +4 -4
  123. package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getConstructor.js +1 -1
  124. package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getDiscriminatorByValue.js +1 -1
  125. package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js +1 -1
  126. package/.output/server/node_modules/mongoose/lib/helpers/discriminator/mergeDiscriminatorSchema.js +10 -5
  127. package/.output/server/node_modules/mongoose/lib/helpers/document/applyDefaults.js +1 -1
  128. package/.output/server/node_modules/mongoose/lib/helpers/document/applyTimestamps.js +11 -10
  129. package/.output/server/node_modules/mongoose/lib/helpers/document/applyVirtuals.js +10 -9
  130. package/.output/server/node_modules/mongoose/lib/helpers/document/cleanModifiedSubpaths.js +1 -1
  131. package/.output/server/node_modules/mongoose/lib/helpers/document/compile.js +17 -14
  132. package/.output/server/node_modules/mongoose/lib/helpers/document/getDeepestSubdocumentForPath.js +3 -3
  133. package/.output/server/node_modules/mongoose/lib/helpers/document/getEmbeddedDiscriminatorPath.js +2 -2
  134. package/.output/server/node_modules/mongoose/lib/helpers/document/isInPathsToSave.js +24 -0
  135. package/.output/server/node_modules/mongoose/lib/helpers/get.js +1 -1
  136. package/.output/server/node_modules/mongoose/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +1 -1
  137. package/.output/server/node_modules/mongoose/lib/helpers/indexes/getRelatedIndexes.js +3 -3
  138. package/.output/server/node_modules/mongoose/lib/helpers/indexes/isIndexEqual.js +3 -4
  139. package/.output/server/node_modules/mongoose/lib/helpers/indexes/isIndexSpecEqual.js +3 -3
  140. package/.output/server/node_modules/mongoose/lib/helpers/isBsonType.js +1 -1
  141. package/.output/server/node_modules/mongoose/lib/helpers/isMongooseObject.js +1 -1
  142. package/.output/server/node_modules/mongoose/lib/helpers/isObject.js +2 -2
  143. package/.output/server/node_modules/mongoose/lib/helpers/isSimpleValidator.js +2 -2
  144. package/.output/server/node_modules/mongoose/lib/helpers/minimize.js +2 -2
  145. package/.output/server/node_modules/mongoose/lib/helpers/model/applyDefaultsToPOJO.js +2 -2
  146. package/.output/server/node_modules/mongoose/lib/helpers/model/applyHooks.js +55 -54
  147. package/.output/server/node_modules/mongoose/lib/helpers/model/applyMethods.js +2 -2
  148. package/.output/server/node_modules/mongoose/lib/helpers/model/applyStaticHooks.js +1 -48
  149. package/.output/server/node_modules/mongoose/lib/helpers/model/castBulkWrite.js +8 -12
  150. package/.output/server/node_modules/mongoose/lib/helpers/model/discriminator.js +1 -1
  151. package/.output/server/node_modules/mongoose/lib/helpers/parallelLimit.js +18 -36
  152. package/.output/server/node_modules/mongoose/lib/helpers/pluralize.js +4 -4
  153. package/.output/server/node_modules/mongoose/lib/helpers/populate/assignRawDocsToIdStructure.js +4 -11
  154. package/.output/server/node_modules/mongoose/lib/helpers/populate/assignVals.js +10 -10
  155. package/.output/server/node_modules/mongoose/lib/helpers/populate/createPopulateQueryFilter.js +3 -3
  156. package/.output/server/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js +197 -69
  157. package/.output/server/node_modules/mongoose/lib/helpers/populate/getSchemaTypes.js +15 -15
  158. package/.output/server/node_modules/mongoose/lib/helpers/populate/markArraySubdocsPopulated.js +1 -1
  159. package/.output/server/node_modules/mongoose/lib/helpers/populate/modelNamesFromRefPath.js +10 -2
  160. package/.output/server/node_modules/mongoose/lib/helpers/populate/setPopulatedVirtualValue.js +5 -5
  161. package/.output/server/node_modules/mongoose/lib/helpers/printJestWarning.js +1 -1
  162. package/.output/server/node_modules/mongoose/lib/helpers/processConnectionOptions.js +1 -1
  163. package/.output/server/node_modules/mongoose/lib/helpers/projection/hasIncludedChildren.js +1 -1
  164. package/.output/server/node_modules/mongoose/lib/helpers/projection/isPathExcluded.js +3 -3
  165. package/.output/server/node_modules/mongoose/lib/helpers/projection/isSubpath.js +1 -1
  166. package/.output/server/node_modules/mongoose/lib/helpers/projection/parseProjection.js +9 -4
  167. package/.output/server/node_modules/mongoose/lib/helpers/query/cast$expr.js +8 -10
  168. package/.output/server/node_modules/mongoose/lib/helpers/query/castFilterPath.js +1 -1
  169. package/.output/server/node_modules/mongoose/lib/helpers/query/castUpdate.js +44 -38
  170. package/.output/server/node_modules/mongoose/lib/helpers/query/getEmbeddedDiscriminatorPath.js +8 -8
  171. package/.output/server/node_modules/mongoose/lib/helpers/query/handleImmutable.js +8 -8
  172. package/.output/server/node_modules/mongoose/lib/helpers/schema/applyPlugins.js +2 -2
  173. package/.output/server/node_modules/mongoose/lib/helpers/schema/applyReadConcern.js +1 -1
  174. package/.output/server/node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js +4 -2
  175. package/.output/server/node_modules/mongoose/lib/helpers/schema/getIndexes.js +5 -11
  176. package/.output/server/node_modules/mongoose/lib/helpers/schema/getSubdocumentStrictValue.js +2 -2
  177. package/.output/server/node_modules/mongoose/lib/helpers/schema/handleIdOption.js +1 -1
  178. package/.output/server/node_modules/mongoose/lib/helpers/schema/idGetter.js +1 -1
  179. package/.output/server/node_modules/mongoose/lib/helpers/schematype/handleImmutable.js +1 -1
  180. package/.output/server/node_modules/mongoose/lib/helpers/setDefaultsOnInsert.js +26 -13
  181. package/.output/server/node_modules/mongoose/lib/helpers/timestamps/setDocumentTimestamps.js +2 -2
  182. package/.output/server/node_modules/mongoose/lib/helpers/timestamps/setupTimestamps.js +60 -38
  183. package/.output/server/node_modules/mongoose/lib/helpers/update/applyTimestampsToUpdate.js +13 -10
  184. package/.output/server/node_modules/mongoose/lib/helpers/update/castArrayFilters.js +4 -4
  185. package/.output/server/node_modules/mongoose/lib/helpers/update/decorateUpdateWithVersionKey.js +1 -1
  186. package/.output/server/node_modules/mongoose/lib/helpers/update/modifiedPaths.js +2 -2
  187. package/.output/server/node_modules/mongoose/lib/helpers/update/removeUnusedArrayFilters.js +7 -2
  188. package/.output/server/node_modules/mongoose/lib/helpers/updateValidators.js +58 -119
  189. package/.output/server/node_modules/mongoose/lib/model.js +940 -946
  190. package/.output/server/node_modules/mongoose/lib/mongoose.js +131 -79
  191. package/.output/server/node_modules/mongoose/lib/options/schemaArrayOptions.js +2 -2
  192. package/.output/server/node_modules/mongoose/lib/options/schemaBufferOptions.js +1 -1
  193. package/.output/server/node_modules/mongoose/lib/options/schemaDocumentArrayOptions.js +23 -0
  194. package/.output/server/node_modules/mongoose/lib/options/schemaNumberOptions.js +3 -3
  195. package/.output/server/node_modules/mongoose/lib/options/schemaObjectIdOptions.js +2 -2
  196. package/.output/server/node_modules/mongoose/lib/options/schemaStringOptions.js +6 -6
  197. package/.output/server/node_modules/mongoose/lib/options/schemaSubdocumentOptions.js +23 -0
  198. package/.output/server/node_modules/mongoose/lib/options/schemaTypeOptions.js +27 -13
  199. package/.output/server/node_modules/mongoose/lib/options/virtualOptions.js +12 -12
  200. package/.output/server/node_modules/mongoose/lib/plugins/index.js +0 -1
  201. package/.output/server/node_modules/mongoose/lib/plugins/saveSubdocs.js +84 -92
  202. package/.output/server/node_modules/mongoose/lib/plugins/sharding.js +33 -15
  203. package/.output/server/node_modules/mongoose/lib/plugins/trackTransaction.js +29 -25
  204. package/.output/server/node_modules/mongoose/lib/query.js +700 -548
  205. package/.output/server/node_modules/mongoose/lib/queryHelpers.js +34 -32
  206. package/.output/server/node_modules/mongoose/lib/schema/array.js +69 -113
  207. package/.output/server/node_modules/mongoose/lib/schema/bigint.js +18 -20
  208. package/.output/server/node_modules/mongoose/lib/schema/boolean.js +20 -22
  209. package/.output/server/node_modules/mongoose/lib/schema/buffer.js +23 -25
  210. package/.output/server/node_modules/mongoose/lib/schema/date.js +19 -21
  211. package/.output/server/node_modules/mongoose/lib/schema/decimal128.js +16 -18
  212. package/.output/server/node_modules/mongoose/lib/schema/documentArray.js +94 -131
  213. package/.output/server/node_modules/mongoose/lib/schema/documentArrayElement.js +50 -16
  214. package/.output/server/node_modules/mongoose/lib/schema/double.js +16 -18
  215. package/.output/server/node_modules/mongoose/lib/schema/index.js +1 -0
  216. package/.output/server/node_modules/mongoose/lib/schema/int32.js +17 -19
  217. package/.output/server/node_modules/mongoose/lib/schema/map.js +17 -24
  218. package/.output/server/node_modules/mongoose/lib/schema/mixed.js +14 -14
  219. package/.output/server/node_modules/mongoose/lib/schema/number.js +38 -28
  220. package/.output/server/node_modules/mongoose/lib/schema/objectId.js +18 -20
  221. package/.output/server/node_modules/mongoose/lib/schema/operators/exists.js +1 -1
  222. package/.output/server/node_modules/mongoose/lib/schema/operators/geospatial.js +1 -1
  223. package/.output/server/node_modules/mongoose/lib/schema/operators/text.js +4 -4
  224. package/.output/server/node_modules/mongoose/lib/schema/string.js +42 -27
  225. package/.output/server/node_modules/mongoose/lib/schema/subdocument.js +47 -58
  226. package/.output/server/node_modules/mongoose/lib/schema/union.js +54 -4
  227. package/.output/server/node_modules/mongoose/lib/schema/uuid.js +17 -40
  228. package/.output/server/node_modules/mongoose/lib/schema.js +235 -176
  229. package/.output/server/node_modules/mongoose/lib/schemaType.js +227 -158
  230. package/.output/server/node_modules/mongoose/lib/stateMachine.js +5 -8
  231. package/.output/server/node_modules/mongoose/lib/types/array/index.js +5 -5
  232. package/.output/server/node_modules/mongoose/lib/types/array/methods/index.js +27 -28
  233. package/.output/server/node_modules/mongoose/lib/types/arraySubdocument.js +11 -11
  234. package/.output/server/node_modules/mongoose/lib/types/buffer.js +15 -15
  235. package/.output/server/node_modules/mongoose/lib/types/decimal128.js +1 -1
  236. package/.output/server/node_modules/mongoose/lib/types/documentArray/index.js +4 -4
  237. package/.output/server/node_modules/mongoose/lib/types/documentArray/methods/index.js +15 -13
  238. package/.output/server/node_modules/mongoose/lib/types/double.js +1 -1
  239. package/.output/server/node_modules/mongoose/lib/types/map.js +20 -71
  240. package/.output/server/node_modules/mongoose/lib/types/objectid.js +1 -1
  241. package/.output/server/node_modules/mongoose/lib/types/subdocument.js +32 -81
  242. package/.output/server/node_modules/mongoose/lib/types/uuid.js +1 -1
  243. package/.output/server/node_modules/mongoose/lib/utils.js +91 -70
  244. package/.output/server/node_modules/mongoose/lib/validOptions.js +4 -3
  245. package/.output/server/node_modules/mongoose/lib/virtualType.js +18 -18
  246. package/.output/server/node_modules/mongoose/package.json +46 -63
  247. package/.output/server/node_modules/mquery/lib/collection/collection.js +3 -1
  248. package/.output/server/node_modules/mquery/lib/collection/node.js +17 -3
  249. package/.output/server/node_modules/mquery/lib/mquery.js +136 -93
  250. package/.output/server/node_modules/mquery/lib/permissions.js +21 -6
  251. package/.output/server/node_modules/mquery/package.json +4 -7
  252. package/.output/server/package.json +7 -9
  253. package/package.json +3 -3
  254. package/.output/public/_nuxt/builds/meta/0d6006db-fbb0-4297-85cf-bf92ceafcb79.json +0 -1
  255. package/.output/server/node_modules/debug/package.json +0 -64
  256. package/.output/server/node_modules/debug/src/browser.js +0 -272
  257. package/.output/server/node_modules/debug/src/common.js +0 -292
  258. package/.output/server/node_modules/debug/src/index.js +0 -10
  259. package/.output/server/node_modules/debug/src/node.js +0 -263
  260. package/.output/server/node_modules/mongodb/lib/client-side-encryption/crypto_callbacks.js +0 -81
  261. package/.output/server/node_modules/mongodb/lib/resource_management.js +0 -58
  262. package/.output/server/node_modules/mongoose/lib/browserDocument.js +0 -101
  263. package/.output/server/node_modules/mongoose/lib/documentProvider.js +0 -30
  264. package/.output/server/node_modules/mongoose/lib/helpers/createJSONSchemaTypeDefinition.js +0 -24
  265. package/.output/server/node_modules/mongoose/lib/helpers/promiseOrCallback.js +0 -54
  266. package/.output/server/node_modules/mongoose/lib/plugins/validateBeforeSave.js +0 -51
  267. package/.output/server/node_modules/supports-color/index.js +0 -202
  268. package/.output/server/node_modules/supports-color/package.json +0 -64
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.kDispose = exports.randomBytes = exports.COSMOS_DB_MSG = exports.DOCUMENT_DB_MSG = exports.COSMOS_DB_CHECK = exports.DOCUMENT_DB_CHECK = exports.MONGODB_WARNING_CODE = exports.DEFAULT_PK_FACTORY = exports.HostAddress = exports.BufferPool = exports.List = exports.MongoDBCollectionNamespace = exports.MongoDBNamespace = exports.ByteUtils = void 0;
3
+ exports.kDispose = exports.randomBytes = exports.COSMOS_DB_MSG = exports.DOCUMENT_DB_MSG = exports.COSMOS_DB_CHECK = exports.DOCUMENT_DB_CHECK = exports.MONGODB_WARNING_CODE = exports.DEFAULT_PK_FACTORY = exports.HostAddress = exports.BufferPool = exports.List = exports.MongoDBCollectionNamespace = exports.MongoDBNamespace = void 0;
4
4
  exports.isUint8Array = isUint8Array;
5
5
  exports.hostMatchesWildcards = hostMatchesWildcards;
6
6
  exports.normalizeHintField = normalizeHintField;
7
7
  exports.isObject = isObject;
8
8
  exports.mergeOptions = mergeOptions;
9
9
  exports.filterOptions = filterOptions;
10
- exports.applyRetryableWrites = applyRetryableWrites;
11
10
  exports.isPromiseLike = isPromiseLike;
12
11
  exports.decorateWithCollation = decorateWithCollation;
13
12
  exports.decorateWithReadConcern = decorateWithReadConcern;
@@ -19,7 +18,7 @@ exports.maxWireVersion = maxWireVersion;
19
18
  exports.arrayStrictEqual = arrayStrictEqual;
20
19
  exports.errorStrictEqual = errorStrictEqual;
21
20
  exports.makeStateMachine = makeStateMachine;
22
- exports.now = now;
21
+ exports.processTimeMS = processTimeMS;
23
22
  exports.calculateDurationInMs = calculateDurationInMs;
24
23
  exports.hasAtomicOperators = hasAtomicOperators;
25
24
  exports.resolveTimeoutOptions = resolveTimeoutOptions;
@@ -39,7 +38,6 @@ exports.parseInteger = parseInteger;
39
38
  exports.parseUnsignedInteger = parseUnsignedInteger;
40
39
  exports.checkParentDomainMatch = checkParentDomainMatch;
41
40
  exports.get = get;
42
- exports.request = request;
43
41
  exports.isHostMatch = isHostMatch;
44
42
  exports.promiseWithResolvers = promiseWithResolvers;
45
43
  exports.squashError = squashError;
@@ -51,13 +49,10 @@ exports.noop = noop;
51
49
  exports.decorateDecryptionResult = decorateDecryptionResult;
52
50
  exports.addAbortListener = addAbortListener;
53
51
  exports.abortable = abortable;
54
- const crypto = require("crypto");
55
52
  const fs_1 = require("fs");
56
53
  const http = require("http");
54
+ const process = require("process");
57
55
  const timers_1 = require("timers");
58
- const url = require("url");
59
- const url_1 = require("url");
60
- const util_1 = require("util");
61
56
  const bson_1 = require("./bson");
62
57
  const constants_1 = require("./cmap/wire_protocol/constants");
63
58
  const constants_2 = require("./constants");
@@ -66,22 +61,6 @@ const read_concern_1 = require("./read_concern");
66
61
  const read_preference_1 = require("./read_preference");
67
62
  const common_1 = require("./sdam/common");
68
63
  const write_concern_1 = require("./write_concern");
69
- exports.ByteUtils = {
70
- toLocalBufferType(buffer) {
71
- return Buffer.isBuffer(buffer)
72
- ? buffer
73
- : Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
74
- },
75
- equals(seqA, seqB) {
76
- return exports.ByteUtils.toLocalBufferType(seqA).equals(seqB);
77
- },
78
- compare(seqA, seqB) {
79
- return exports.ByteUtils.toLocalBufferType(seqA).compare(seqB);
80
- },
81
- toBase64(uint8array) {
82
- return exports.ByteUtils.toLocalBufferType(uint8array).toString('base64');
83
- }
84
- };
85
64
  /**
86
65
  * Returns true if value is a Uint8Array or a Buffer
87
66
  * @param value - any value that may be a Uint8Array
@@ -98,11 +77,26 @@ function isUint8Array(value) {
98
77
  */
99
78
  function hostMatchesWildcards(host, wildcards) {
100
79
  for (const wildcard of wildcards) {
101
- if (host === wildcard ||
102
- (wildcard.startsWith('*.') && host?.endsWith(wildcard.substring(2, wildcard.length))) ||
103
- (wildcard.startsWith('*/') && host?.endsWith(wildcard.substring(2, wildcard.length)))) {
80
+ // Exact match always wins
81
+ if (host === wildcard) {
104
82
  return true;
105
83
  }
84
+ // Wildcard match with leading *.
85
+ if (wildcard.startsWith('*.')) {
86
+ const suffix = wildcard.substring(2);
87
+ // Exact match or strict subdomain match
88
+ if (host === suffix || host.endsWith(`.${suffix}`)) {
89
+ return true;
90
+ }
91
+ }
92
+ // Wildcard match with leading */
93
+ if (wildcard.startsWith('*/')) {
94
+ const suffix = wildcard.substring(2);
95
+ // Exact match or strict subpath match
96
+ if (host === suffix || host.endsWith(`/${suffix}`)) {
97
+ return true;
98
+ }
99
+ }
106
100
  }
107
101
  return false;
108
102
  }
@@ -155,19 +149,6 @@ function filterOptions(options, names) {
155
149
  // Filtered options
156
150
  return filterOptions;
157
151
  }
158
- /**
159
- * Applies retryWrites: true to a command if retryWrites is set on the command's database.
160
- * @internal
161
- *
162
- * @param target - The target command to which we will apply retryWrites.
163
- * @param db - The database from which we can inherit a retryWrites value.
164
- */
165
- function applyRetryableWrites(target, db) {
166
- if (db && db.s.options?.retryWrites) {
167
- target.retryWrites = true;
168
- }
169
- return target;
170
- }
171
152
  /**
172
153
  * Applies a write concern to a command based on well defined inheritance rules, optionally
173
154
  * detecting support for the write concern in the first place.
@@ -302,7 +283,7 @@ function* makeCounter(seed = 0) {
302
283
  * @internal
303
284
  */
304
285
  function uuidV4() {
305
- const result = crypto.randomBytes(16);
286
+ const result = crypto.getRandomValues(new Uint8Array(16));
306
287
  result[6] = (result[6] & 0x0f) | 0x40;
307
288
  result[8] = (result[8] & 0x3f) | 0x80;
308
289
  return result;
@@ -381,17 +362,20 @@ function makeStateMachine(stateTable) {
381
362
  target.s.state = newState;
382
363
  };
383
364
  }
384
- /** @internal */
385
- function now() {
386
- const hrtime = process.hrtime();
387
- return Math.floor(hrtime[0] * 1000 + hrtime[1] / 1000000);
365
+ /**
366
+ * This function returns the number of milliseconds since an arbitrary point in time.
367
+ * This function should only be used to measure time intervals.
368
+ * @internal
369
+ * */
370
+ function processTimeMS() {
371
+ return Math.floor(performance.now());
388
372
  }
389
373
  /** @internal */
390
374
  function calculateDurationInMs(started) {
391
375
  if (typeof started !== 'number') {
392
376
  return -1;
393
377
  }
394
- const elapsed = now() - started;
378
+ const elapsed = processTimeMS() - started;
395
379
  return elapsed < 0 ? 0 : elapsed;
396
380
  }
397
381
  /** @internal */
@@ -663,12 +647,12 @@ class BufferPool {
663
647
  }
664
648
  const firstBuffer = this.buffers.first();
665
649
  if (firstBuffer != null && firstBuffer.byteLength >= 4) {
666
- return firstBuffer.readInt32LE(0);
650
+ return bson_1.NumberUtils.getInt32LE(firstBuffer, 0);
667
651
  }
668
652
  // Unlikely case: an int32 is split across buffers.
669
653
  // Use read and put the returned buffer back on top
670
654
  const top4Bytes = this.read(4);
671
- const value = top4Bytes.readInt32LE(0);
655
+ const value = bson_1.NumberUtils.getInt32LE(top4Bytes, 0);
672
656
  // Put it back.
673
657
  this.totalByteLength += 4;
674
658
  this.buffers.unshift(top4Bytes);
@@ -681,11 +665,11 @@ class BufferPool {
681
665
  }
682
666
  // oversized request returns empty buffer
683
667
  if (size > this.totalByteLength) {
684
- return Buffer.alloc(0);
668
+ return bson_1.ByteUtils.allocate(0);
685
669
  }
686
670
  // We know we have enough, we just don't know how it is spread across chunks
687
671
  // TODO(NODE-4732): alloc API should change based on raw option
688
- const result = Buffer.allocUnsafe(size);
672
+ const result = bson_1.ByteUtils.allocateUnsafe(size);
689
673
  for (let bytesRead = 0; bytesRead < size;) {
690
674
  const buffer = this.buffers.shift();
691
675
  if (buffer == null) {
@@ -721,7 +705,7 @@ class HostAddress {
721
705
  const urlString = `iLoveJS://${escapedHost}`;
722
706
  let url;
723
707
  try {
724
- url = new url_1.URL(urlString);
708
+ url = new URL(urlString);
725
709
  }
726
710
  catch (urlError) {
727
711
  const runtimeError = new error_1.MongoRuntimeError(`Unable to parse ${escapedHost} with URL`);
@@ -902,7 +886,7 @@ function compareObjectId(oid1, oid2) {
902
886
  if (oid2 == null) {
903
887
  return 1;
904
888
  }
905
- return exports.ByteUtils.compare(oid1.id, oid2.id);
889
+ return bson_1.ByteUtils.compare(oid1.id, oid2.id);
906
890
  }
907
891
  function parseInteger(value) {
908
892
  if (typeof value === 'number')
@@ -979,41 +963,6 @@ function get(url, options = {}) {
979
963
  }, 10000);
980
964
  });
981
965
  }
982
- async function request(uri, options = {}) {
983
- return await new Promise((resolve, reject) => {
984
- const requestOptions = {
985
- method: 'GET',
986
- timeout: 10000,
987
- json: true,
988
- ...url.parse(uri),
989
- ...options
990
- };
991
- const req = http.request(requestOptions, res => {
992
- res.setEncoding('utf8');
993
- let data = '';
994
- res.on('data', d => {
995
- data += d;
996
- });
997
- res.once('end', () => {
998
- if (options.json === false) {
999
- resolve(data);
1000
- return;
1001
- }
1002
- try {
1003
- const parsed = JSON.parse(data);
1004
- resolve(parsed);
1005
- }
1006
- catch {
1007
- // TODO(NODE-3483)
1008
- reject(new error_1.MongoRuntimeError(`Invalid JSON response: "${data}"`));
1009
- }
1010
- });
1011
- });
1012
- req.once('timeout', () => req.destroy(new error_1.MongoNetworkTimeoutError(`Network request to ${uri} timed out after ${options.timeout} ms`)));
1013
- req.once('error', error => reject(error));
1014
- req.end();
1015
- });
1016
- }
1017
966
  /** @internal */
1018
967
  exports.DOCUMENT_DB_CHECK = /(\.docdb\.amazonaws\.com$)|(\.docdb-elastic\.amazonaws\.com$)/;
1019
968
  /** @internal */
@@ -1048,7 +997,10 @@ function promiseWithResolvers() {
1048
997
  function squashError(_error) {
1049
998
  return;
1050
999
  }
1051
- exports.randomBytes = (0, util_1.promisify)(crypto.randomBytes);
1000
+ const randomBytes = (size) => {
1001
+ return Promise.resolve(crypto.getRandomValues(new Uint8Array(size)));
1002
+ };
1003
+ exports.randomBytes = randomBytes;
1052
1004
  /**
1053
1005
  * Replicates the events.once helper.
1054
1006
  *
@@ -1116,10 +1068,10 @@ function noop() {
1116
1068
  function decorateDecryptionResult(decrypted, original, isTopLevelDecorateCall = true) {
1117
1069
  if (isTopLevelDecorateCall) {
1118
1070
  // The original value could have been either a JS object or a BSON buffer
1119
- if (Buffer.isBuffer(original)) {
1071
+ if (bson_1.ByteUtils.isUint8Array(original)) {
1120
1072
  original = (0, bson_1.deserialize)(original);
1121
1073
  }
1122
- if (Buffer.isBuffer(decrypted)) {
1074
+ if (bson_1.ByteUtils.isUint8Array(decrypted)) {
1123
1075
  throw new error_1.MongoRuntimeError('Expected result of decryption to be deserialized BSON object');
1124
1076
  }
1125
1077
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb",
3
- "version": "6.20.0",
3
+ "version": "7.2.0",
4
4
  "description": "The official MongoDB driver for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -26,17 +26,17 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@mongodb-js/saslprep": "^1.3.0",
29
- "bson": "^6.10.4",
30
- "mongodb-connection-string-url": "^3.0.2"
29
+ "bson": "^7.2.0",
30
+ "mongodb-connection-string-url": "^7.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@aws-sdk/credential-providers": "^3.188.0",
34
- "@mongodb-js/zstd": "^1.1.0 || ^2.0.0",
35
- "gcp-metadata": "^5.2.0",
36
- "kerberos": "^2.0.1",
37
- "mongodb-client-encryption": ">=6.0.0 <7",
33
+ "@aws-sdk/credential-providers": "^3.806.0",
34
+ "@mongodb-js/zstd": "^7.0.0",
35
+ "gcp-metadata": "^7.0.1",
36
+ "kerberos": "^7.0.0",
37
+ "mongodb-client-encryption": ">=7.0.0 <7.1.0",
38
38
  "snappy": "^7.3.2",
39
- "socks": "^2.7.1"
39
+ "socks": "^2.8.6"
40
40
  },
41
41
  "peerDependenciesMeta": {
42
42
  "@aws-sdk/credential-providers": {
@@ -65,12 +65,12 @@
65
65
  "@aws-sdk/credential-providers": "^3.876.0",
66
66
  "@iarna/toml": "^2.2.5",
67
67
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
68
- "@microsoft/api-extractor": "^7.52.11",
68
+ "@microsoft/api-extractor": "^7.54.0",
69
69
  "@microsoft/tsdoc-config": "^0.17.1",
70
- "@mongodb-js/zstd": "^2.0.1",
70
+ "@mongodb-js/zstd": "^7.0.0",
71
71
  "@types/chai": "^4.3.17",
72
72
  "@types/chai-subset": "^1.3.5",
73
- "@types/express": "^5.0.3",
73
+ "@types/express": "^5.0.5",
74
74
  "@types/kerberos": "^1.1.5",
75
75
  "@types/mocha": "^10.0.9",
76
76
  "@types/node": "^22.15.3",
@@ -79,12 +79,14 @@
79
79
  "@types/sinon": "^17.0.4",
80
80
  "@types/sinon-chai": "^4.0.0",
81
81
  "@types/whatwg-url": "^13.0.0",
82
- "@typescript-eslint/eslint-plugin": "^8.41.0",
82
+ "@typescript-eslint/eslint-plugin": "^8.46.3",
83
83
  "@typescript-eslint/parser": "^8.31.1",
84
+ "aws4": "^1.13.2",
84
85
  "chai": "^4.4.1",
85
86
  "chai-subset": "^1.6.0",
86
87
  "chalk": "^4.1.2",
87
- "eslint": "^9.34.0",
88
+ "esbuild": "^0.27.2",
89
+ "eslint": "^9.39.1",
88
90
  "eslint-config-prettier": "^10.1.8",
89
91
  "eslint-plugin-mocha": "^10.4.1",
90
92
  "eslint-plugin-prettier": "^5.5.4",
@@ -92,13 +94,12 @@
92
94
  "eslint-plugin-tsdoc": "^0.4.0",
93
95
  "eslint-plugin-unused-imports": "^4.2.0",
94
96
  "express": "^5.1.0",
95
- "gcp-metadata": "^5.3.0",
97
+ "gcp-metadata": "^7.0.1",
96
98
  "js-yaml": "^4.1.0",
97
- "mocha": "^11.7.1",
99
+ "mocha": "^11.7.5",
98
100
  "mocha-sinon": "^2.1.2",
99
- "mongodb-client-encryption": "^6.5.0",
100
- "mongodb-legacy": "^6.1.3",
101
- "nyc": "^15.1.0",
101
+ "mongodb-client-encryption": "^7.0.0",
102
+ "nyc": "^17.1.0",
102
103
  "prettier": "^3.6.2",
103
104
  "semver": "^7.7.2",
104
105
  "sinon": "^18.0.1",
@@ -115,7 +116,7 @@
115
116
  },
116
117
  "license": "Apache-2.0",
117
118
  "engines": {
118
- "node": ">=16.20.1"
119
+ "node": ">=20.19.0"
119
120
  },
120
121
  "bugs": {
121
122
  "url": "https://jira.mongodb.org/projects/NODE/issues/"
@@ -124,44 +125,47 @@
124
125
  "scripts": {
125
126
  "build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
126
127
  "build:ts": "node ./node_modules/typescript/bin/tsc",
127
- "build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts lib/beta.d.ts",
128
+ "build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts",
128
129
  "build:docs": "./etc/docs/build.ts",
129
130
  "build:typedoc": "typedoc",
130
131
  "build:nightly": "node ./.github/scripts/nightly.mjs",
131
132
  "check:bench": "npm --prefix test/benchmarks/driver_bench start",
132
133
  "check:coverage": "nyc npm run test:all",
133
134
  "check:integration-coverage": "nyc npm run check:test",
134
- "check:lambda": "nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js",
135
- "check:lambda:aws": "nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js",
135
+ "check:lambda": "npm run build:bundle && nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js",
136
+ "check:lambda:aws": "npm run build:bundle && nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js",
136
137
  "check:lint": "npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd",
137
138
  "check:eslint": "npm run build:dts && ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --max-warnings=0 --ext '.js,.ts' src test",
138
139
  "check:tsd": "tsd --version && tsd",
139
- "check:dependencies": "mocha test/action/dependency.test.ts",
140
- "check:dts": "node ./node_modules/typescript/bin/tsc --noEmit mongodb.d.ts && tsd",
141
- "check:search-indexes": "nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts",
142
- "check:test": "mocha --config test/mocha_mongodb.js test/integration",
143
- "check:unit": "nyc mocha test/unit",
140
+ "check:dependencies": "npm run build:bundle && mocha test/action/dependency.test.ts",
141
+ "check:dts": "npm run build:bundle && node ./node_modules/typescript/bin/tsc --target es2023 --module commonjs --noEmit mongodb.d.ts && tsd",
142
+ "check:search-indexes": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts",
143
+ "check:test": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration",
144
+ "check:test-bundled": "MONGODB_BUNDLED=true npm run check:test",
145
+ "check:unit": "npm run build:bundle && nyc mocha test/unit",
146
+ "check:unit-bundled": "MONGODB_BUNDLED=true npm run check:unit",
144
147
  "check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
145
- "check:atlas": "nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts",
146
- "check:resource-management": "nyc mocha --config test/manual/mocharc.js test/manual/resource_management.test.ts",
147
- "check:drivers-atlas-testing": "nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts",
148
- "check:adl": "nyc mocha --config test/mocha_mongodb.js test/manual/atlas-data-lake-testing",
149
- "check:aws": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts",
150
- "check:oidc-auth": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts",
151
- "check:oidc-test": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts",
152
- "check:oidc-azure": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_azure.prose.05.test.ts",
153
- "check:oidc-gcp": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_gcp.prose.06.test.ts",
154
- "check:oidc-k8s": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_k8s.prose.07.test.ts",
155
- "check:kerberos": "nyc mocha --config test/manual/mocharc.js test/manual/kerberos.test.ts",
156
- "check:tls": "nyc mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts",
157
- "check:ldap": "nyc mocha --config test/manual/mocharc.js test/manual/ldap.test.ts",
158
- "check:socks5": "nyc mocha --config test/manual/mocharc.js test/manual/socks5.test.ts",
159
- "check:csfle": "nyc mocha --config test/mocha_mongodb.js test/integration/client-side-encryption",
160
- "check:snappy": "nyc mocha test/unit/assorted/snappy.test.js",
161
- "check:x509": "nyc mocha test/manual/x509_auth.test.ts",
148
+ "check:atlas": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts",
149
+ "check:drivers-atlas-testing": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts",
150
+ "check:aws": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts test/integration/auth/mongodb_aws.prose.test.ts",
151
+ "check:oidc-auth": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts",
152
+ "check:oidc-test": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts",
153
+ "check:kerberos": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/kerberos.test.ts",
154
+ "check:tls": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts",
155
+ "check:ldap": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/ldap.test.ts",
156
+ "check:socks5": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/socks5.test.ts",
157
+ "check:csfle": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/client-side-encryption",
158
+ "check:snappy": "npm run build:bundle && nyc mocha test/unit/assorted/snappy.test.js",
159
+ "check:x509": "npm run build:bundle && nyc mocha test/manual/x509_auth.test.ts",
160
+ "build:bundle": "npm run bundle:driver && npm run bundle:types && npm run build:runtime-barrel",
161
+ "build:runtime-barrel": "node etc/build-runtime-barrel.mjs",
162
+ "bundle:driver": "node etc/bundle-driver.mjs",
163
+ "bundle:types": "npx tsc --project ./tsconfig.json --declaration --emitDeclarationOnly --declarationDir test/tools/runner/bundle/types",
162
164
  "fix:eslint": "npm run check:eslint -- --fix",
163
165
  "prepare": "node etc/prepare.js",
164
166
  "preview:docs": "ts-node etc/docs/preview.ts",
167
+ "switch:to-bundled": "MONGODB_BUNDLED=true npm run build:runtime-barrel",
168
+ "switch:to-unbundled": "MONGODB_BUNDLED=false npm run build:runtime-barrel",
165
169
  "test": "npm run check:lint && npm run test:all",
166
170
  "test:all": "npm run check:unit && npm run check:test",
167
171
  "update:docs": "npm run build:docs -- --yes"
@@ -6,8 +6,7 @@ const redact_1 = require("./redact");
6
6
  Object.defineProperty(exports, "redactConnectionString", { enumerable: true, get: function () { return redact_1.redactConnectionString; } });
7
7
  const DUMMY_HOSTNAME = '__this_is_a_placeholder__';
8
8
  function connectionStringHasValidScheme(connectionString) {
9
- return (connectionString.startsWith('mongodb://') ||
10
- connectionString.startsWith('mongodb+srv://'));
9
+ return connectionString.startsWith('mongodb://') || connectionString.startsWith('mongodb+srv://');
11
10
  }
12
11
  const HOSTS_REGEX = /^(?<protocol>[^/]+):\/\/(?:(?<username>[^:@]*)(?::(?<password>[^@]*))?@)?(?<hosts>(?!:)[^/?@]*)(?<rest>.*)/;
13
12
  class CaseInsensitiveMap extends Map {
@@ -79,8 +78,8 @@ class MongoParseError extends Error {
79
78
  }
80
79
  }
81
80
  class ConnectionString extends URLWithoutHost {
81
+ _hosts;
82
82
  constructor(uri, options = {}) {
83
- var _a;
84
83
  const { looseValidation } = options;
85
84
  if (!looseValidation && !connectionStringHasValidScheme(uri)) {
86
85
  throw new MongoParseError('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');
@@ -89,20 +88,20 @@ class ConnectionString extends URLWithoutHost {
89
88
  if (!match) {
90
89
  throw new MongoParseError(`Invalid connection string "${uri}"`);
91
90
  }
92
- const { protocol, username, password, hosts, rest } = (_a = match.groups) !== null && _a !== void 0 ? _a : {};
91
+ const { protocol, username, password, hosts, rest } = match.groups ?? {};
93
92
  if (!looseValidation) {
94
93
  if (!protocol || !hosts) {
95
94
  throw new MongoParseError(`Protocol and host list are required in "${uri}"`);
96
95
  }
97
96
  try {
98
- decodeURIComponent(username !== null && username !== void 0 ? username : '');
99
- decodeURIComponent(password !== null && password !== void 0 ? password : '');
97
+ decodeURIComponent(username ?? '');
98
+ decodeURIComponent(password ?? '');
100
99
  }
101
100
  catch (err) {
102
101
  throw new MongoParseError(err.message);
103
102
  }
104
103
  const illegalCharacters = /[:/?#[\]@]/gi;
105
- if (username === null || username === void 0 ? void 0 : username.match(illegalCharacters)) {
104
+ if (username?.match(illegalCharacters)) {
106
105
  throw new MongoParseError(`Username contains unescaped characters ${username}`);
107
106
  }
108
107
  if (!username || !password) {
@@ -111,7 +110,7 @@ class ConnectionString extends URLWithoutHost {
111
110
  throw new MongoParseError('URI contained empty userinfo section');
112
111
  }
113
112
  }
114
- if (password === null || password === void 0 ? void 0 : password.match(illegalCharacters)) {
113
+ if (password?.match(illegalCharacters)) {
115
114
  throw new MongoParseError('Password contains unescaped characters');
116
115
  }
117
116
  }
@@ -151,14 +150,30 @@ class ConnectionString extends URLWithoutHost {
151
150
  }
152
151
  Object.setPrototypeOf(this.searchParams, caseInsenstiveURLSearchParams(this.searchParams.constructor).prototype);
153
152
  }
154
- get host() { return DUMMY_HOSTNAME; }
155
- set host(_ignored) { throw new Error('No single host for connection string'); }
156
- get hostname() { return DUMMY_HOSTNAME; }
157
- set hostname(_ignored) { throw new Error('No single host for connection string'); }
158
- get port() { return ''; }
159
- set port(_ignored) { throw new Error('No single host for connection string'); }
160
- get href() { return this.toString(); }
161
- set href(_ignored) { throw new Error('Cannot set href for connection strings'); }
153
+ get host() {
154
+ return DUMMY_HOSTNAME;
155
+ }
156
+ set host(_ignored) {
157
+ throw new Error('No single host for connection string');
158
+ }
159
+ get hostname() {
160
+ return DUMMY_HOSTNAME;
161
+ }
162
+ set hostname(_ignored) {
163
+ throw new Error('No single host for connection string');
164
+ }
165
+ get port() {
166
+ return '';
167
+ }
168
+ set port(_ignored) {
169
+ throw new Error('No single host for connection string');
170
+ }
171
+ get href() {
172
+ return this.toString();
173
+ }
174
+ set href(_ignored) {
175
+ throw new Error('Cannot set href for connection strings');
176
+ }
162
177
  get isSRV() {
163
178
  return this.protocol.includes('srv');
164
179
  }
@@ -180,19 +195,30 @@ class ConnectionString extends URLWithoutHost {
180
195
  return (0, redact_1.redactValidConnectionString)(this, options);
181
196
  }
182
197
  typedSearchParams() {
183
- const sametype = false && new (caseInsenstiveURLSearchParams(whatwg_url_1.URLSearchParams))();
198
+ const _sametype = false && new (caseInsenstiveURLSearchParams(whatwg_url_1.URLSearchParams))();
184
199
  return this.searchParams;
185
200
  }
186
201
  [Symbol.for('nodejs.util.inspect.custom')]() {
187
202
  const { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash } = this;
188
- return { href, origin, protocol, username, password, hosts, pathname, search, searchParams, hash };
203
+ return {
204
+ href,
205
+ origin,
206
+ protocol,
207
+ username,
208
+ password,
209
+ hosts,
210
+ pathname,
211
+ search,
212
+ searchParams,
213
+ hash
214
+ };
189
215
  }
190
216
  }
191
217
  exports.ConnectionString = ConnectionString;
192
218
  class CommaAndColonSeparatedRecord extends CaseInsensitiveMap {
193
219
  constructor(from) {
194
220
  super();
195
- for (const entry of (from !== null && from !== void 0 ? from : '').split(',')) {
221
+ for (const entry of (from ?? '').split(',')) {
196
222
  if (!entry)
197
223
  continue;
198
224
  const colonIndex = entry.indexOf(':');
@@ -15,21 +15,31 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.redactConnectionString = exports.redactValidConnectionString = void 0;
36
+ exports.redactValidConnectionString = redactValidConnectionString;
37
+ exports.redactConnectionString = redactConnectionString;
27
38
  const index_1 = __importStar(require("./index"));
28
39
  function redactValidConnectionString(inputUrl, options) {
29
- var _a, _b;
30
40
  const url = inputUrl.clone();
31
- const replacementString = (_a = options === null || options === void 0 ? void 0 : options.replacementString) !== null && _a !== void 0 ? _a : '_credentials_';
32
- const redactUsernames = (_b = options === null || options === void 0 ? void 0 : options.redactUsernames) !== null && _b !== void 0 ? _b : true;
41
+ const replacementString = options?.replacementString ?? '_credentials_';
42
+ const redactUsernames = options?.redactUsernames ?? true;
33
43
  if ((url.username || url.password) && redactUsernames) {
34
44
  url.username = replacementString;
35
45
  url.password = '';
@@ -55,26 +65,28 @@ function redactValidConnectionString(inputUrl, options) {
55
65
  }
56
66
  return url;
57
67
  }
58
- exports.redactValidConnectionString = redactValidConnectionString;
59
68
  function redactConnectionString(uri, options) {
60
- var _a, _b;
61
- const replacementString = (_a = options === null || options === void 0 ? void 0 : options.replacementString) !== null && _a !== void 0 ? _a : '<credentials>';
62
- const redactUsernames = (_b = options === null || options === void 0 ? void 0 : options.redactUsernames) !== null && _b !== void 0 ? _b : true;
69
+ const replacementString = options?.replacementString ?? '<credentials>';
70
+ const redactUsernames = options?.redactUsernames ?? true;
63
71
  let parsed;
64
72
  try {
65
73
  parsed = new index_1.default(uri);
66
74
  }
67
- catch (_c) { }
75
+ catch {
76
+ }
68
77
  if (parsed) {
69
78
  options = { ...options, replacementString: '___credentials___' };
70
- return parsed.redact(options).toString().replace(/___credentials___/g, replacementString);
79
+ return parsed
80
+ .redact(options)
81
+ .toString()
82
+ .replace(/___credentials___/g, replacementString);
71
83
  }
72
84
  const R = replacementString;
73
85
  const replacements = [
74
86
  uri => uri.replace(redactUsernames ? /(\/\/)(.*)(@)/g : /(\/\/[^@]*:)(.*)(@)/g, `$1${R}$3`),
75
87
  uri => uri.replace(/(AWS_SESSION_TOKEN(:|%3A))([^,&]+)/gi, `$1${R}`),
76
88
  uri => uri.replace(/(tlsCertificateKeyFilePassword=)([^&]+)/gi, `$1${R}`),
77
- uri => redactUsernames ? uri.replace(/(proxyUsername=)([^&]+)/gi, `$1${R}`) : uri,
89
+ uri => (redactUsernames ? uri.replace(/(proxyUsername=)([^&]+)/gi, `$1${R}`) : uri),
78
90
  uri => uri.replace(/(proxyPassword=)([^&]+)/gi, `$1${R}`)
79
91
  ];
80
92
  for (const replacer of replacements) {
@@ -82,5 +94,4 @@ function redactConnectionString(uri, options) {
82
94
  }
83
95
  return uri;
84
96
  }
85
- exports.redactConnectionString = redactConnectionString;
86
97
  //# sourceMappingURL=redact.js.map