@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,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const Mixed = require('../schema/mixed');
3
4
  const MongooseError = require('../error/mongooseError');
4
5
  const clone = require('../helpers/clone');
5
6
  const deepEqual = require('../utils').deepEqual;
@@ -17,30 +18,14 @@ const populateModelSymbol = require('../helpers/symbols').populateModelSymbol;
17
18
  */
18
19
 
19
20
  class MongooseMap extends Map {
20
- constructor(v, path, doc, schemaType, options) {
21
+ constructor(v, path, doc, schemaType) {
21
22
  if (getConstructorName(v) === 'Object') {
22
23
  v = Object.keys(v).reduce((arr, key) => arr.concat([[key, v[key]]]), []);
23
24
  }
24
25
  super(v);
25
- this.$__parent = doc != null && doc.$__ != null ? doc : null;
26
-
27
- // Calculate the full path from the root document
28
- // Priority: parent.$basePath (from subdoc) > options.path (from parent map/structure) > path (schema path)
29
- // Subdocuments have the most up-to-date path info, so prefer that over options.path
30
- if (this.$__parent?.$isSingleNested && this.$__parent.$basePath) {
31
- this.$__path = this.$__parent.$basePath + '.' + path;
32
- // Performance optimization: store path relative to parent subdocument
33
- // to avoid string operations in set() hot path
34
- this.$__pathRelativeToParent = path;
35
- } else if (options?.path) {
36
- this.$__path = options.path;
37
- this.$__pathRelativeToParent = null;
38
- } else {
39
- this.$__path = path;
40
- this.$__pathRelativeToParent = null;
41
- }
42
-
43
- this.$__schemaType = schemaType;
26
+ this.$__parent = doc?.$__ != null ? doc : null;
27
+ this.$__path = path;
28
+ this.$__schemaType = schemaType == null ? new Mixed(path) : schemaType;
44
29
 
45
30
  this.$__runDeferred();
46
31
  }
@@ -50,16 +35,8 @@ class MongooseMap extends Map {
50
35
 
51
36
  super.set(key, value);
52
37
 
53
- if (value != null && value.$isSingleNested) {
38
+ if (value?.$isSingleNested) {
54
39
  value.$basePath = this.$__path + '.' + key;
55
- // Store the path relative to parent subdoc for efficient markModified()
56
- if (this.$__pathRelativeToParent != null) {
57
- // Map's parent is a subdocument, store path relative to that subdoc
58
- value.$pathRelativeToParent = this.$__pathRelativeToParent + '.' + key;
59
- } else {
60
- // Map's parent is root document, store the full path
61
- value.$pathRelativeToParent = this.$__path + '.' + key;
62
- }
63
40
  }
64
41
  }
65
42
 
@@ -129,7 +106,7 @@ class MongooseMap extends Map {
129
106
 
130
107
  let _fullPath;
131
108
  const parent = this.$__parent;
132
- const populated = parent != null && parent.$__ && parent.$__.populated ?
109
+ const populated = parent?.$__?.populated ?
133
110
  parent.$populated(fullPath.call(this), true) || parent.$populated(this.$__path, true) :
134
111
  null;
135
112
  const priorVal = this.get(key);
@@ -159,16 +136,9 @@ class MongooseMap extends Map {
159
136
  }
160
137
  } else {
161
138
  try {
162
- let options = null;
163
- if (this.$__schemaType.$isMongooseDocumentArray || this.$__schemaType.$isSingleNested || this.$__schemaType.$isMongooseArray || this.$__schemaType.$isSchemaMap) {
164
- options = { path: fullPath.call(this) };
165
- // For subdocuments, also pass the relative path to avoid string operations
166
- if (this.$__schemaType.$isSingleNested) {
167
- options.pathRelativeToParent = this.$__pathRelativeToParent != null ?
168
- this.$__pathRelativeToParent + '.' + key :
169
- this.$__path + '.' + key;
170
- }
171
- }
139
+ const options = this.$__schemaType.$isMongooseDocumentArray || this.$__schemaType.$isSingleNested || this.$__schemaType.$isMongooseArray || this.$__schemaType.$isSchemaMap ?
140
+ { path: fullPath.call(this) } :
141
+ null;
172
142
  value = this.$__schemaType.applySetters(
173
143
  value,
174
144
  this.$__parent,
@@ -177,7 +147,7 @@ class MongooseMap extends Map {
177
147
  options
178
148
  );
179
149
  } catch (error) {
180
- if (this.$__parent != null && this.$__parent.$__ != null) {
150
+ if (this.$__parent?.$__ != null) {
181
151
  this.$__parent.invalidate(fullPath.call(this), error);
182
152
  return;
183
153
  }
@@ -187,34 +157,13 @@ class MongooseMap extends Map {
187
157
 
188
158
  super.set(key, value);
189
159
 
190
- // Set relative path on subdocuments to avoid string operations in markModified()
191
- // The path should be relative to the parent subdocument (if any), not just the key
192
- if (value != null && value.$isSingleNested) {
193
- if (this.$__pathRelativeToParent != null) {
194
- // Map's parent is a subdocument, store path relative to that subdoc (e.g., 'items.i2')
195
- value.$pathRelativeToParent = this.$__pathRelativeToParent + '.' + key;
196
- } else {
197
- // Map's parent is root document, store just the full path
198
- value.$pathRelativeToParent = this.$__path + '.' + key;
199
- }
200
- }
201
-
202
- if (parent != null && parent.$__ != null && !deepEqual(value, priorVal)) {
203
- // Optimization: if parent is a subdocument, use precalculated relative path
204
- // to avoid building a full path just to strip the parent's prefix
205
- let pathToMark;
206
- if (this.$__pathRelativeToParent != null) {
207
- // Parent is a subdocument - use precalculated relative path (e.g., 'items.i1')
208
- pathToMark = this.$__pathRelativeToParent + '.' + key;
209
- } else {
210
- // Parent is root document or map - use full path
211
- pathToMark = fullPath.call(this);
212
- }
213
- parent.markModified(pathToMark);
160
+ if (parent?.$__ != null && !deepEqual(value, priorVal)) {
161
+ const path = fullPath.call(this);
162
+ parent.markModified(path);
214
163
  // If overwriting the full document array or subdoc, make sure to clean up any paths that were modified
215
164
  // before re: #15108
216
165
  if (this.$__schemaType.$isMongooseDocumentArray || this.$__schemaType.$isSingleNested) {
217
- cleanModifiedSubpaths(parent, pathToMark);
166
+ cleanModifiedSubpaths(parent, path);
218
167
  }
219
168
  }
220
169
 
@@ -275,7 +224,7 @@ class MongooseMap extends Map {
275
224
  }
276
225
 
277
226
  toObject(options) {
278
- if (options && options.flattenMaps) {
227
+ if (options?.flattenMaps) {
279
228
  const ret = {};
280
229
  const keys = this.keys();
281
230
  for (const key of keys) {
@@ -302,13 +251,13 @@ class MongooseMap extends Map {
302
251
  *
303
252
  * @api public
304
253
  * @method toJSON
305
- * @param {Object} [options]
306
- * @param {Boolean} [options.flattenMaps=false] set to `true` to convert the map to a POJO rather than a native JavaScript map
254
+ * @param {object} [options]
255
+ * @param {boolean} [options.flattenMaps=false] set to `true` to convert the map to a POJO rather than a native JavaScript map
307
256
  * @memberOf Map
308
257
  */
309
258
 
310
259
  toJSON(options) {
311
- if (typeof (options && options.flattenMaps) === 'boolean' ? options.flattenMaps : true) {
260
+ if (typeof options?.flattenMaps === 'boolean' ? options.flattenMaps : true) {
312
261
  const ret = {};
313
262
  const keys = this.keys();
314
263
  for (const key of keys) {
@@ -396,7 +345,7 @@ Object.defineProperty(MongooseMap.prototype, '$__deferredCalls', {
396
345
  /**
397
346
  * Since maps are stored as objects under the hood, keys must be strings
398
347
  * and can't contain any invalid characters
399
- * @param {String} key
348
+ * @param {string} key
400
349
  * @api private
401
350
  */
402
351
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const ObjectId = require('bson').ObjectId;
13
+ const ObjectId = require('mongodb/lib/bson').ObjectId;
14
14
  const objectIdSymbol = require('../helpers/symbols').objectIdSymbol;
15
15
 
16
16
  /**
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const Document = require('../document');
4
- const immediate = require('../helpers/immediate');
5
4
  const internalToObjectOptions = require('../options').internalToObjectOptions;
6
5
  const util = require('util');
7
6
  const utils = require('../utils');
@@ -15,11 +14,7 @@ module.exports = Subdocument;
15
14
  * @api private
16
15
  */
17
16
 
18
- function Subdocument(value, fields, parent, skipId, options) {
19
- if (typeof skipId === 'object' && skipId != null && options == null) {
20
- options = skipId;
21
- skipId = undefined;
22
- }
17
+ function Subdocument(value, fields, parent, options) {
23
18
  if (parent != null) {
24
19
  // If setting a nested path, should copy isNew from parent re: gh-7048
25
20
  const parentOptions = { isNew: parent.isNew };
@@ -28,24 +23,10 @@ function Subdocument(value, fields, parent, skipId, options) {
28
23
  }
29
24
  options = Object.assign(parentOptions, options);
30
25
  }
31
- if (options != null && options.path != null) {
26
+ if (options?.path != null) {
32
27
  this.$basePath = options.path;
33
28
  }
34
- if (options != null && options.pathRelativeToParent != null) {
35
- this.$pathRelativeToParent = options.pathRelativeToParent;
36
- }
37
-
38
- // Don't pass `path` to Document constructor: path is used for storing the
39
- // absolute path to this schematype relative to the top-level document, but
40
- // subdocuments use relative paths (relative to the parent document) to track changes.
41
- // This avoids the subdocument's fields receiving the subdocument's path as options.path.
42
- let documentOptions = options;
43
- if (options != null && options.path != null) {
44
- documentOptions = Object.assign({}, options);
45
- delete documentOptions.path;
46
- }
47
-
48
- Document.call(this, value, fields, skipId, documentOptions);
29
+ Document.call(this, value, fields, options);
49
30
 
50
31
  delete this.$__.priorDoc;
51
32
  }
@@ -79,7 +60,11 @@ Subdocument.prototype.toBSON = function() {
79
60
  *
80
61
  * _This is a no-op. Does not actually save the doc to the db._
81
62
  *
82
- * @param {Function} [fn]
63
+ * @param {object} [options]
64
+ * @param {boolean} [options.suppressWarning=false] If `true`, suppress the warning about calling `save()` on a subdoc.
65
+ * @param {boolean|object} [options.middleware=true] set to `false` to skip all user-defined middleware
66
+ * @param {boolean} [options.middleware.pre=true] set to `false` to skip only pre hooks
67
+ * @param {boolean} [options.middleware.post=true] set to `false` to skip only post hooks
83
68
  * @return {Promise} resolved Promise
84
69
  * @api private
85
70
  */
@@ -94,24 +79,17 @@ Subdocument.prototype.save = async function save(options) {
94
79
  'if you\'re sure this behavior is right for your app.');
95
80
  }
96
81
 
97
- return new Promise((resolve, reject) => {
98
- this.$__save((err) => {
99
- if (err != null) {
100
- return reject(err);
101
- }
102
- resolve(this);
103
- });
104
- });
82
+ return await this.$__save(options);
105
83
  };
106
84
 
107
85
  /**
108
86
  * Given a path relative to this document, return the path relative
109
87
  * to the top-level document.
110
- * @param {String} path
88
+ * @param {string} path
111
89
  * @method $__fullPath
112
90
  * @memberOf Subdocument
113
91
  * @instance
114
- * @returns {String}
92
+ * @returns {string}
115
93
  * @api private
116
94
  */
117
95
 
@@ -128,8 +106,8 @@ Subdocument.prototype.$__fullPath = function(path) {
128
106
  /**
129
107
  * Given a path relative to this document, return the path relative
130
108
  * to the parent document.
131
- * @param {String} p
132
- * @returns {String}
109
+ * @param {string} p
110
+ * @returns {string}
133
111
  * @method $__pathRelativeToParent
134
112
  * @memberOf Subdocument
135
113
  * @instance
@@ -137,12 +115,6 @@ Subdocument.prototype.$__fullPath = function(path) {
137
115
  */
138
116
 
139
117
  Subdocument.prototype.$__pathRelativeToParent = function(p) {
140
- // If this subdocument has a stored relative path (set by map when subdoc is created),
141
- // use it directly to avoid string operations
142
- if (this.$pathRelativeToParent != null) {
143
- return p == null ? this.$pathRelativeToParent : this.$pathRelativeToParent + '.' + p;
144
- }
145
-
146
118
  if (p == null) {
147
119
  return this.$basePath;
148
120
  }
@@ -164,8 +136,15 @@ Subdocument.prototype.$__pathRelativeToParent = function(p) {
164
136
  * @api private
165
137
  */
166
138
 
167
- Subdocument.prototype.$__save = function(fn) {
168
- return immediate(() => fn(null, this));
139
+ Subdocument.prototype.$__save = async function $__save(options) {
140
+ try {
141
+ await this._execDocumentPreHooks('save', options, [options]);
142
+ } catch (error) {
143
+ await this._execDocumentPostHooks('save', options, error);
144
+ return;
145
+ }
146
+
147
+ await this._execDocumentPostHooks('save', options);
169
148
  };
170
149
 
171
150
  /*!
@@ -188,13 +167,9 @@ Subdocument.prototype.$isValid = function(path) {
188
167
  Subdocument.prototype.markModified = function(path) {
189
168
  Document.prototype.markModified.call(this, path);
190
169
  const parent = this.$parent();
170
+ const fullPath = this.$__pathRelativeToParent(path);
191
171
 
192
- if (parent == null) {
193
- return;
194
- }
195
-
196
- const pathToMark = this.$__pathRelativeToParent(path);
197
- if (pathToMark == null) {
172
+ if (parent == null || fullPath == null) {
198
173
  return;
199
174
  }
200
175
 
@@ -202,8 +177,7 @@ Subdocument.prototype.markModified = function(path) {
202
177
  if (parent.isDirectModified(myPath) || this.isNew) {
203
178
  return;
204
179
  }
205
-
206
- this.$__parent.markModified(pathToMark, this);
180
+ this.$__parent.markModified(fullPath, this);
207
181
  };
208
182
 
209
183
  /*!
@@ -229,7 +203,7 @@ Subdocument.prototype.isModified = function(paths, options, modifiedPaths) {
229
203
  /**
230
204
  * Marks a path as valid, removing existing validation errors.
231
205
  *
232
- * @param {String} path the field to mark as valid
206
+ * @param {string} path the field to mark as valid
233
207
  * @api private
234
208
  * @method $markValid
235
209
  * @memberOf Subdocument
@@ -286,7 +260,7 @@ Subdocument.prototype.ownerDocument = function() {
286
260
  return this.$__.ownerDocument;
287
261
  }
288
262
 
289
- let parent = this; // eslint-disable-line consistent-this
263
+ let parent = this;
290
264
  const paths = [];
291
265
  const seenDocs = new Set([parent]);
292
266
 
@@ -318,7 +292,7 @@ Subdocument.prototype.ownerDocument = function() {
318
292
  */
319
293
 
320
294
  Subdocument.prototype.$__fullPathWithIndexes = function() {
321
- let parent = this; // eslint-disable-line consistent-this
295
+ let parent = this;
322
296
  const paths = [];
323
297
  const seenDocs = new Set([parent]);
324
298
 
@@ -371,22 +345,6 @@ Subdocument.prototype.$__setParent = function $__setParent(parent) {
371
345
  this.$__parent = parent;
372
346
  };
373
347
 
374
- /**
375
- * no-op for hooks
376
- * @param {Function} cb
377
- * @method $__deleteOne
378
- * @memberOf Subdocument
379
- * @instance
380
- * @api private
381
- */
382
-
383
- Subdocument.prototype.$__deleteOne = function(cb) {
384
- if (cb == null) {
385
- return;
386
- }
387
- return cb(null, this);
388
- };
389
-
390
348
  /**
391
349
  * ignore
392
350
  * @method $__removeFromParent
@@ -402,27 +360,20 @@ Subdocument.prototype.$__removeFromParent = function() {
402
360
  /**
403
361
  * Null-out this subdoc
404
362
  *
405
- * @param {Object} [options]
406
- * @param {Function} [callback] optional callback for compatibility with Document.prototype.remove
363
+ * @param {object} [options]
407
364
  */
408
365
 
409
- Subdocument.prototype.deleteOne = function(options, callback) {
410
- if (typeof options === 'function') {
411
- callback = options;
412
- options = null;
413
- }
366
+ Subdocument.prototype.deleteOne = function deleteOne(options) {
414
367
  registerRemoveListener(this);
415
368
 
416
369
  // If removing entire doc, no need to remove subdoc
417
- if (!options || !options.noop) {
370
+ if (!options?.noop) {
418
371
  this.$__removeFromParent();
419
372
 
420
373
  const owner = this.ownerDocument();
421
374
  owner.$__.removedSubdocs = owner.$__.removedSubdocs || [];
422
375
  owner.$__.removedSubdocs.push(this);
423
376
  }
424
-
425
- return this.$__deleteOne(callback);
426
377
  };
427
378
 
428
379
  /*!
@@ -460,7 +411,7 @@ Subdocument.prototype.$toObject = function $toObject(options, json) {
460
411
 
461
412
  // If `$toObject()` was called recursively, respect the minimize option, including schematype level minimize.
462
413
  // If minimize is set, then we can minimize out the whole object.
463
- if (Object.keys(ret).length === 0 && options?._calledWithOptions != null) {
414
+ if (utils.hasOwnKeys(ret) === false && options?._calledWithOptions != null) {
464
415
  const minimize = options._calledWithOptions?.minimize ?? this?.$__schemaTypeOptions?.minimize ?? options.minimize;
465
416
  if (minimize && !this.constructor.$__required) {
466
417
  return undefined;
@@ -10,4 +10,4 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- module.exports = require('bson').UUID;
13
+ module.exports = require('mongodb/lib/bson').UUID;