@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
@@ -7,14 +7,13 @@
7
7
  const CastError = require('../error/cast');
8
8
  const SchemaType = require('../schemaType');
9
9
  const castBigInt = require('../cast/bigint');
10
- const createJSONSchemaTypeDefinition = require('../helpers/createJSONSchemaTypeDefinition');
11
10
 
12
11
  /**
13
12
  * BigInt SchemaType constructor.
14
13
  *
15
- * @param {String} path
16
- * @param {Object} options
17
- * @param {Object} schemaOptions
14
+ * @param {string} path
15
+ * @param {object} options
16
+ * @param {object} schemaOptions
18
17
  * @param {Schema} parentSchema
19
18
  * @inherits SchemaType
20
19
  * @api public
@@ -52,10 +51,10 @@ SchemaBigInt._cast = castBigInt;
52
51
  * #### Example:
53
52
  *
54
53
  * // Make all bigints required by default
55
- * mongoose.Schema.BigInt.set('required', true);
54
+ * mongoose.Schema.Types.BigInt.set('required', true);
56
55
  *
57
- * @param {String} option The option you'd like to set the value for
58
- * @param {Any} value value for option
56
+ * @param {string} option The option you'd like to set the value for
57
+ * @param {any} value value for option
59
58
  * @return {undefined}
60
59
  * @function set
61
60
  * @static
@@ -72,7 +71,7 @@ SchemaBigInt.setters = [];
72
71
  * #### Example:
73
72
  *
74
73
  * // Convert bigints to numbers
75
- * mongoose.Schema.BigInt.get(v => v == null ? v : Number(v));
74
+ * mongoose.Schema.Types.BigInt.get(v => v == null ? v : Number(v));
76
75
  *
77
76
  * @param {Function} getter
78
77
  * @return {this}
@@ -90,7 +89,7 @@ SchemaBigInt.get = SchemaType.get;
90
89
  *
91
90
  * // Make Mongoose cast empty string '' to false.
92
91
  * const original = mongoose.Schema.Types.BigInt.cast();
93
- * mongoose.Schema.BigInt.cast(v => {
92
+ * mongoose.Schema.Types.BigInt.cast(v => {
94
93
  * if (v === '') {
95
94
  * return false;
96
95
  * }
@@ -98,7 +97,7 @@ SchemaBigInt.get = SchemaType.get;
98
97
  * });
99
98
  *
100
99
  * // Or disable casting entirely
101
- * mongoose.Schema.BigInt.cast(false);
100
+ * mongoose.Schema.Types.BigInt.cast(false);
102
101
  *
103
102
  * @param {Function} caster
104
103
  * @return {Function}
@@ -141,8 +140,8 @@ SchemaBigInt.checkRequired = SchemaType.checkRequired;
141
140
  /**
142
141
  * Check if the given value satisfies a required validator.
143
142
  *
144
- * @param {Any} value
145
- * @return {Boolean}
143
+ * @param {any} value
144
+ * @return {boolean}
146
145
  * @api public
147
146
  */
148
147
 
@@ -153,8 +152,8 @@ SchemaBigInt.prototype.checkRequired = function(value) {
153
152
  /**
154
153
  * Casts to bigint
155
154
  *
156
- * @param {Object} value
157
- * @param {Object} model this value is optional
155
+ * @param {object} value
156
+ * @param {object} model this value is optional
158
157
  * @api private
159
158
  */
160
159
 
@@ -213,7 +212,7 @@ function handleSingle(val, context) {
213
212
  /**
214
213
  * Casts contents for queries.
215
214
  *
216
- * @param {String} $conditional
215
+ * @param {string} $conditional
217
216
  * @param {any} val
218
217
  * @api private
219
218
  */
@@ -261,14 +260,13 @@ SchemaBigInt.prototype._castNullish = function _castNullish(v) {
261
260
  /**
262
261
  * Returns this schema type's representation in a JSON schema.
263
262
  *
264
- * @param [options]
265
- * @param [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
266
- * @returns {Object} JSON schema properties
263
+ * @param {object} [options]
264
+ * @param {boolean} [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
265
+ * @returns {object} JSON schema properties
267
266
  */
268
267
 
269
268
  SchemaBigInt.prototype.toJSONSchema = function toJSONSchema(options) {
270
- const isRequired = this.options.required && typeof this.options.required !== 'function';
271
- return createJSONSchemaTypeDefinition('string', 'long', options?.useBsonType, isRequired);
269
+ return this._createJSONSchemaTypeDefinition('string', 'long', options);
272
270
  };
273
271
 
274
272
  SchemaBigInt.prototype.autoEncryptionType = function autoEncryptionType() {
@@ -7,14 +7,13 @@
7
7
  const CastError = require('../error/cast');
8
8
  const SchemaType = require('../schemaType');
9
9
  const castBoolean = require('../cast/boolean');
10
- const createJSONSchemaTypeDefinition = require('../helpers/createJSONSchemaTypeDefinition');
11
10
 
12
11
  /**
13
12
  * Boolean SchemaType constructor.
14
13
  *
15
- * @param {String} path
16
- * @param {Object} options
17
- * @param {Object} schemaOptions
14
+ * @param {string} path
15
+ * @param {object} options
16
+ * @param {object} schemaOptions
18
17
  * @param {Schema} parentSchema
19
18
  * @inherits SchemaType
20
19
  * @api public
@@ -52,13 +51,13 @@ SchemaBoolean._cast = castBoolean;
52
51
  * #### Example:
53
52
  *
54
53
  * // Make all booleans have `default` of false.
55
- * mongoose.Schema.Boolean.set('default', false);
54
+ * mongoose.Schema.Types.Boolean.set('default', false);
56
55
  *
57
56
  * const Order = mongoose.model('Order', new Schema({ isPaid: Boolean }));
58
57
  * new Order({ }).isPaid; // false
59
58
  *
60
- * @param {String} option The option you'd like to set the value for
61
- * @param {Any} value value for option
59
+ * @param {string} option The option you'd like to set the value for
60
+ * @param {any} value value for option
62
61
  * @return {undefined}
63
62
  * @function set
64
63
  * @static
@@ -74,7 +73,7 @@ SchemaBoolean.setters = [];
74
73
  *
75
74
  * #### Example:
76
75
  *
77
- * mongoose.Schema.Boolean.get(v => v === true ? 'yes' : 'no');
76
+ * mongoose.Schema.Types.Boolean.get(v => v === true ? 'yes' : 'no');
78
77
  *
79
78
  * const Order = mongoose.model('Order', new Schema({ isPaid: Boolean }));
80
79
  * new Order({ isPaid: false }).isPaid; // 'no'
@@ -94,8 +93,8 @@ SchemaBoolean.get = SchemaType.get;
94
93
  * #### Example:
95
94
  *
96
95
  * // Make Mongoose cast empty string '' to false.
97
- * const original = mongoose.Schema.Boolean.cast();
98
- * mongoose.Schema.Boolean.cast(v => {
96
+ * const original = mongoose.Schema.Types.Boolean.cast();
97
+ * mongoose.Schema.Types.Boolean.cast(v => {
99
98
  * if (v === '') {
100
99
  * return false;
101
100
  * }
@@ -103,7 +102,7 @@ SchemaBoolean.get = SchemaType.get;
103
102
  * });
104
103
  *
105
104
  * // Or disable casting entirely
106
- * mongoose.Schema.Boolean.cast(false);
105
+ * mongoose.Schema.Types.Boolean.cast(false);
107
106
  *
108
107
  * @param {Function} caster
109
108
  * @return {Function}
@@ -159,8 +158,8 @@ SchemaBoolean.checkRequired = SchemaType.checkRequired;
159
158
  * to satisfy a required validator, it must be strictly equal to true or to
160
159
  * false.
161
160
  *
162
- * @param {Any} value
163
- * @return {Boolean}
161
+ * @param {any} value
162
+ * @return {boolean}
164
163
  * @api public
165
164
  */
166
165
 
@@ -175,7 +174,7 @@ SchemaBoolean.prototype.checkRequired = function(value) {
175
174
  *
176
175
  * const M = mongoose.model('Test', new Schema({ b: Boolean }));
177
176
  * new M({ b: 'affirmative' }).b; // undefined
178
- * mongoose.Schema.Boolean.convertToTrue.add('affirmative');
177
+ * mongoose.Schema.Types.Boolean.convertToTrue.add('affirmative');
179
178
  * new M({ b: 'affirmative' }).b; // true
180
179
  *
181
180
  * @property convertToTrue
@@ -215,8 +214,8 @@ Object.defineProperty(SchemaBoolean, 'convertToFalse', {
215
214
  /**
216
215
  * Casts to boolean
217
216
  *
218
- * @param {Object} value
219
- * @param {Object} model this value is optional
217
+ * @param {object} value
218
+ * @param {object} model this value is optional
220
219
  * @api private
221
220
  */
222
221
 
@@ -257,7 +256,7 @@ Object.defineProperty(SchemaBoolean.prototype, '$conditionalHandlers', {
257
256
  /**
258
257
  * Casts contents for queries.
259
258
  *
260
- * @param {String} $conditional
259
+ * @param {string} $conditional
261
260
  * @param {any} val
262
261
  * @api private
263
262
  */
@@ -311,14 +310,13 @@ SchemaBoolean.prototype._castNullish = function _castNullish(v) {
311
310
  /**
312
311
  * Returns this schema type's representation in a JSON schema.
313
312
  *
314
- * @param [options]
315
- * @param [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
316
- * @returns {Object} JSON schema properties
313
+ * @param {object} [options]
314
+ * @param {boolean} [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
315
+ * @returns {object} JSON schema properties
317
316
  */
318
317
 
319
318
  SchemaBoolean.prototype.toJSONSchema = function toJSONSchema(options) {
320
- const isRequired = this.options.required && typeof this.options.required !== 'function';
321
- return createJSONSchemaTypeDefinition('boolean', 'bool', options?.useBsonType, isRequired);
319
+ return this._createJSONSchemaTypeDefinition('boolean', 'bool', options);
322
320
  };
323
321
 
324
322
  SchemaBoolean.prototype.autoEncryptionType = function autoEncryptionType() {
@@ -7,7 +7,6 @@
7
7
  const MongooseBuffer = require('../types/buffer');
8
8
  const SchemaBufferOptions = require('../options/schemaBufferOptions');
9
9
  const SchemaType = require('../schemaType');
10
- const createJSONSchemaTypeDefinition = require('../helpers/createJSONSchemaTypeDefinition');
11
10
  const handleBitwiseOperator = require('./operators/bitwise');
12
11
  const utils = require('../utils');
13
12
 
@@ -17,9 +16,9 @@ const CastError = SchemaType.CastError;
17
16
  /**
18
17
  * Buffer SchemaType constructor
19
18
  *
20
- * @param {String} key
21
- * @param {Object} options
22
- * @param {Object} schemaOptions
19
+ * @param {string} key
20
+ * @param {object} options
21
+ * @param {object} schemaOptions
23
22
  * @param {Schema} parentSchema
24
23
  * @inherits SchemaType
25
24
  * @api public
@@ -50,7 +49,7 @@ SchemaBuffer.prototype.OptionsConstructor = SchemaBufferOptions;
50
49
  * ignore
51
50
  */
52
51
 
53
- SchemaBuffer._checkRequired = v => !!(v && v.length);
52
+ SchemaBuffer._checkRequired = v => !!v?.length;
54
53
 
55
54
  /**
56
55
  * Sets a default option for all Buffer instances.
@@ -58,13 +57,13 @@ SchemaBuffer._checkRequired = v => !!(v && v.length);
58
57
  * #### Example:
59
58
  *
60
59
  * // Make all buffers have `required` of true by default.
61
- * mongoose.Schema.Buffer.set('required', true);
60
+ * mongoose.Schema.Types.Buffer.set('required', true);
62
61
  *
63
62
  * const User = mongoose.model('User', new Schema({ test: Buffer }));
64
63
  * new User({ }).validateSync().errors.test.message; // Path `test` is required.
65
64
  *
66
- * @param {String} option The option you'd like to set the value for
67
- * @param {Any} value value for option
65
+ * @param {string} option The option you'd like to set the value for
66
+ * @param {any} value value for option
68
67
  * @return {undefined}
69
68
  * @function set
70
69
  * @static
@@ -121,9 +120,9 @@ SchemaBuffer.checkRequired = SchemaType.checkRequired;
121
120
  * required validator, a buffer must not be null or undefined and have
122
121
  * non-zero length.
123
122
  *
124
- * @param {Any} value
123
+ * @param {any} value
125
124
  * @param {Document} doc
126
- * @return {Boolean}
125
+ * @return {boolean}
127
126
  * @api public
128
127
  */
129
128
 
@@ -137,21 +136,21 @@ SchemaBuffer.prototype.checkRequired = function(value, doc) {
137
136
  /**
138
137
  * Casts contents
139
138
  *
140
- * @param {Object} value
139
+ * @param {object} value
141
140
  * @param {Document} doc document that triggers the casting
142
- * @param {Boolean} init
141
+ * @param {boolean} init
143
142
  * @api private
144
143
  */
145
144
 
146
145
  SchemaBuffer.prototype.cast = function(value, doc, init, prev, options) {
147
146
  let ret;
148
147
  if (SchemaType._isRef(this, value, doc, init)) {
149
- if (value && value.isMongooseBuffer) {
148
+ if (value?.isMongooseBuffer) {
150
149
  return value;
151
150
  }
152
151
 
153
152
  if (Buffer.isBuffer(value)) {
154
- if (!value || !value.isMongooseBuffer) {
153
+ if (!value?.isMongooseBuffer) {
155
154
  value = new MongooseBuffer(value, [this.path, doc]);
156
155
  if (this.options.subtype != null) {
157
156
  value._subtype = this.options.subtype;
@@ -175,16 +174,16 @@ SchemaBuffer.prototype.cast = function(value, doc, init, prev, options) {
175
174
  }
176
175
 
177
176
  // documents
178
- if (value && value._id) {
177
+ if (value?._id) {
179
178
  value = value._id;
180
179
  }
181
180
 
182
- if (value && value.isMongooseBuffer) {
181
+ if (value?.isMongooseBuffer) {
183
182
  return value;
184
183
  }
185
184
 
186
185
  if (Buffer.isBuffer(value)) {
187
- if (!value || !value.isMongooseBuffer) {
186
+ if (!value?.isMongooseBuffer) {
188
187
  value = new MongooseBuffer(value, [this.path, doc]);
189
188
  if (this.options.subtype != null) {
190
189
  value._subtype = this.options.subtype;
@@ -235,7 +234,7 @@ SchemaBuffer.prototype.cast = function(value, doc, init, prev, options) {
235
234
 
236
235
  /**
237
236
  * Sets the default [subtype](https://studio3t.com/whats-new/best-practices-uuid-mongodb/)
238
- * for this buffer. You can find a [list of allowed subtypes here](https://api.mongodb.com/python/current/api/bson/binary.html).
237
+ * for this buffer. You can find a [list of allowed subtypes here](https://www.mongodb.com/docs/manual/reference/bson-types/#binary-data).
239
238
  *
240
239
  * #### Example:
241
240
  *
@@ -244,7 +243,7 @@ SchemaBuffer.prototype.cast = function(value, doc, init, prev, options) {
244
243
  * const m = new M({ uuid: 'test string' });
245
244
  * m.uuid._subtype; // 4
246
245
  *
247
- * @param {Number} subtype the default subtype
246
+ * @param {number} subtype the default subtype
248
247
  * @return {SchemaType} this
249
248
  * @api public
250
249
  */
@@ -292,7 +291,7 @@ Object.defineProperty(SchemaBuffer.prototype, '$conditionalHandlers', {
292
291
  /**
293
292
  * Casts contents for queries.
294
293
  *
295
- * @param {String} $conditional
294
+ * @param {string} $conditional
296
295
  * @param {any} [value]
297
296
  * @api private
298
297
  */
@@ -322,14 +321,13 @@ SchemaBuffer.prototype.castForQuery = function($conditional, val, context) {
322
321
  /**
323
322
  * Returns this schema type's representation in a JSON schema.
324
323
  *
325
- * @param [options]
326
- * @param [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
327
- * @returns {Object} JSON schema properties
324
+ * @param {object} [options]
325
+ * @param {boolean} [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
326
+ * @returns {object} JSON schema properties
328
327
  */
329
328
 
330
329
  SchemaBuffer.prototype.toJSONSchema = function toJSONSchema(options) {
331
- const isRequired = this.options.required && typeof this.options.required !== 'function';
332
- return createJSONSchemaTypeDefinition('string', 'binData', options?.useBsonType, isRequired);
330
+ return this._createJSONSchemaTypeDefinition('string', 'binData', options);
333
331
  };
334
332
 
335
333
  SchemaBuffer.prototype.autoEncryptionType = function autoEncryptionType() {
@@ -8,7 +8,6 @@ const MongooseError = require('../error/index');
8
8
  const SchemaDateOptions = require('../options/schemaDateOptions');
9
9
  const SchemaType = require('../schemaType');
10
10
  const castDate = require('../cast/date');
11
- const createJSONSchemaTypeDefinition = require('../helpers/createJSONSchemaTypeDefinition');
12
11
  const getConstructorName = require('../helpers/getConstructorName');
13
12
  const utils = require('../utils');
14
13
 
@@ -17,9 +16,9 @@ const CastError = SchemaType.CastError;
17
16
  /**
18
17
  * Date SchemaType constructor.
19
18
  *
20
- * @param {String} key
21
- * @param {Object} options
22
- * @param {Object} schemaOptions
19
+ * @param {string} key
20
+ * @param {object} options
21
+ * @param {object} schemaOptions
23
22
  * @param {Schema} parentSchema
24
23
  * @inherits SchemaType
25
24
  * @api public
@@ -58,13 +57,13 @@ SchemaDate._cast = castDate;
58
57
  * #### Example:
59
58
  *
60
59
  * // Make all dates have `required` of true by default.
61
- * mongoose.Schema.Date.set('required', true);
60
+ * mongoose.Schema.Types.Date.set('required', true);
62
61
  *
63
62
  * const User = mongoose.model('User', new Schema({ test: Date }));
64
63
  * new User({ }).validateSync().errors.test.message; // Path `test` is required.
65
64
  *
66
- * @param {String} option The option you'd like to set the value for
67
- * @param {Any} value value for option
65
+ * @param {string} option The option you'd like to set the value for
66
+ * @param {any} value value for option
68
67
  * @return {undefined}
69
68
  * @function set
70
69
  * @static
@@ -81,7 +80,7 @@ SchemaDate.setters = [];
81
80
  * #### Example:
82
81
  *
83
82
  * // Always convert Dates to string
84
- * mongoose.Date.get(v => v.toString());
83
+ * mongoose.Schema.Types.Date.get(v => v.toString());
85
84
  *
86
85
  * const Model = mongoose.model('Test', new Schema({ date: { type: Date, default: () => new Date() } }));
87
86
  * typeof (new Model({}).date); // 'string'
@@ -166,7 +165,7 @@ SchemaDate._defaultCaster = v => {
166
165
  * const schema = new Schema({ createdAt: Date });
167
166
  * schema.path('createdAt').expires('7d');
168
167
  *
169
- * @param {Number|String} when
168
+ * @param {number|string} when
170
169
  * @added 3.0.0
171
170
  * @return {SchemaType} this
172
171
  * @api public
@@ -213,9 +212,9 @@ SchemaDate.checkRequired = SchemaType.checkRequired;
213
212
  * Check if the given value satisfies a required validator. To satisfy
214
213
  * a required validator, the given value must be an instance of `Date`.
215
214
  *
216
- * @param {Any} value
215
+ * @param {any} value
217
216
  * @param {Document} doc
218
- * @return {Boolean}
217
+ * @return {boolean}
219
218
  * @api public
220
219
  */
221
220
 
@@ -257,7 +256,7 @@ SchemaDate.prototype.checkRequired = function(value, doc) {
257
256
  * })
258
257
  *
259
258
  * @param {Date} value minimum date
260
- * @param {String} [message] optional custom error message
259
+ * @param {string} [message] optional custom error message
261
260
  * @return {SchemaType} this
262
261
  * @see Customized Error Messages https://mongoosejs.com/docs/api/error.html#Error.messages
263
262
  * @api public
@@ -319,7 +318,7 @@ SchemaDate.prototype.min = function(value, message) {
319
318
  * })
320
319
  *
321
320
  * @param {Date} maximum date
322
- * @param {String} [message] optional custom error message
321
+ * @param {string} [message] optional custom error message
323
322
  * @return {SchemaType} this
324
323
  * @see Customized Error Messages https://mongoosejs.com/docs/api/error.html#Error.messages
325
324
  * @api public
@@ -359,7 +358,7 @@ SchemaDate.prototype.max = function(value, message) {
359
358
  /**
360
359
  * Casts to date
361
360
  *
362
- * @param {Object} value to cast
361
+ * @param {object} value to cast
363
362
  * @api private
364
363
  */
365
364
 
@@ -383,7 +382,7 @@ SchemaDate.prototype.cast = function(value) {
383
382
  /**
384
383
  * Date Query casting.
385
384
  *
386
- * @param {Any} val
385
+ * @param {any} val
387
386
  * @api private
388
387
  */
389
388
 
@@ -417,7 +416,7 @@ Object.defineProperty(SchemaDate.prototype, '$conditionalHandlers', {
417
416
  /**
418
417
  * Casts contents for queries.
419
418
  *
420
- * @param {String} $conditional
419
+ * @param {string} $conditional
421
420
  * @param {any} [value]
422
421
  * @api private
423
422
  */
@@ -446,14 +445,13 @@ SchemaDate.prototype.castForQuery = function($conditional, val, context) {
446
445
  /**
447
446
  * Returns this schema type's representation in a JSON schema.
448
447
  *
449
- * @param [options]
450
- * @param [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
451
- * @returns {Object} JSON schema properties
448
+ * @param {object} [options]
449
+ * @param {boolean} [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
450
+ * @returns {object} JSON schema properties
452
451
  */
453
452
 
454
453
  SchemaDate.prototype.toJSONSchema = function toJSONSchema(options) {
455
- const isRequired = this.options.required && typeof this.options.required !== 'function';
456
- return createJSONSchemaTypeDefinition('string', 'date', options?.useBsonType, isRequired);
454
+ return this._createJSONSchemaTypeDefinition('string', 'date', options);
457
455
  };
458
456
 
459
457
  SchemaDate.prototype.autoEncryptionType = function autoEncryptionType() {
@@ -7,15 +7,14 @@
7
7
  const SchemaType = require('../schemaType');
8
8
  const CastError = SchemaType.CastError;
9
9
  const castDecimal128 = require('../cast/decimal128');
10
- const createJSONSchemaTypeDefinition = require('../helpers/createJSONSchemaTypeDefinition');
11
10
  const isBsonType = require('../helpers/isBsonType');
12
11
 
13
12
  /**
14
13
  * Decimal128 SchemaType constructor.
15
14
  *
16
- * @param {String} key
17
- * @param {Object} options
18
- * @param {Object} schemaOptions
15
+ * @param {string} key
16
+ * @param {object} options
17
+ * @param {object} schemaOptions
19
18
  * @param {Schema} parentSchema
20
19
  * @inherits SchemaType
21
20
  * @api public
@@ -53,13 +52,13 @@ SchemaDecimal128._cast = castDecimal128;
53
52
  * #### Example:
54
53
  *
55
54
  * // Make all decimal 128s have `required` of true by default.
56
- * mongoose.Schema.Decimal128.set('required', true);
55
+ * mongoose.Schema.Types.Decimal128.set('required', true);
57
56
  *
58
57
  * const User = mongoose.model('User', new Schema({ test: mongoose.Decimal128 }));
59
58
  * new User({ }).validateSync().errors.test.message; // Path `test` is required.
60
59
  *
61
- * @param {String} option The option you'd like to set the value for
62
- * @param {Any} value value for option
60
+ * @param {string} option The option you'd like to set the value for
61
+ * @param {any} value value for option
63
62
  * @return {undefined}
64
63
  * @function set
65
64
  * @static
@@ -76,7 +75,7 @@ SchemaDecimal128.setters = [];
76
75
  * #### Example:
77
76
  *
78
77
  * // Automatically convert Decimal128s to Numbers
79
- * mongoose.Schema.Decimal128.get(v => v == null ? v : Number(v));
78
+ * mongoose.Schema.Types.Decimal128.get(v => v == null ? v : Number(v));
80
79
  *
81
80
  * @param {Function} getter
82
81
  * @return {this}
@@ -154,9 +153,9 @@ SchemaDecimal128.checkRequired = SchemaType.checkRequired;
154
153
  /**
155
154
  * Check if the given value satisfies a required validator.
156
155
  *
157
- * @param {Any} value
156
+ * @param {any} value
158
157
  * @param {Document} doc
159
- * @return {Boolean}
158
+ * @return {boolean}
160
159
  * @api public
161
160
  */
162
161
 
@@ -177,9 +176,9 @@ SchemaDecimal128.prototype.checkRequired = function checkRequired(value, doc) {
177
176
  /**
178
177
  * Casts to Decimal128
179
178
  *
180
- * @param {Object} value
181
- * @param {Object} doc
182
- * @param {Boolean} init whether this is an initialization cast
179
+ * @param {object} value
180
+ * @param {object} doc
181
+ * @param {boolean} init whether this is an initialization cast
183
182
  * @api private
184
183
  */
185
184
 
@@ -242,14 +241,13 @@ Object.defineProperty(SchemaDecimal128.prototype, '$conditionalHandlers', {
242
241
  /**
243
242
  * Returns this schema type's representation in a JSON schema.
244
243
  *
245
- * @param [options]
246
- * @param [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
247
- * @returns {Object} JSON schema properties
244
+ * @param {object} [options]
245
+ * @param {boolean} [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
246
+ * @returns {object} JSON schema properties
248
247
  */
249
248
 
250
249
  SchemaDecimal128.prototype.toJSONSchema = function toJSONSchema(options) {
251
- const isRequired = this.options.required && typeof this.options.required !== 'function';
252
- return createJSONSchemaTypeDefinition('string', 'decimal', options?.useBsonType, isRequired);
250
+ return this._createJSONSchemaTypeDefinition('string', 'decimal', options);
253
251
  };
254
252
 
255
253
  SchemaDecimal128.prototype.autoEncryptionType = function autoEncryptionType() {