@nullix/zod-mongoose-studio 1.0.13 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{Db4IAypj.js → 0J_bLG6U.js} +1 -1
- package/.output/public/_nuxt/{Y39o1QEi.js → 5KLjKHc1.js} +1 -1
- package/.output/public/_nuxt/{B4zoPYF-.js → B2UrsJHg.js} +1 -1
- package/.output/public/_nuxt/{BSqjh6Vk.js → BC5hGokz.js} +1 -1
- package/.output/public/_nuxt/{BS4yU4O0.js → BJwN20Xm.js} +1 -1
- package/.output/public/_nuxt/{D8_n84hl.js → BMgDPqps.js} +1 -1
- package/.output/public/_nuxt/{CqNsQbt9.js → B_sGF2qN.js} +1 -1
- package/.output/public/_nuxt/{NAqlztEN.js → BeaJ7I-K.js} +10 -10
- package/.output/public/_nuxt/{WZ0WK9cR.js → BkE1sm_1.js} +1 -1
- package/.output/public/_nuxt/{kBtP64Rx.js → CADbZwE5.js} +1 -1
- package/.output/public/_nuxt/{B8qGaxNm.js → CB0WRoVi.js} +1 -1
- package/.output/public/_nuxt/{BV6uALfO.js → CCh0PVV0.js} +1 -1
- package/.output/public/_nuxt/{CP9Z7-_9.js → Cr0GW7rA.js} +1 -1
- package/.output/public/_nuxt/{DeCqoVOS.js → DJe7Wxdv.js} +1 -1
- package/.output/public/_nuxt/{dBZQW7JD.js → DRBrUaE5.js} +1 -1
- package/.output/public/_nuxt/{Db19R32y.js → DV2n9B6m.js} +1 -1
- package/.output/public/_nuxt/{CvnpbYw0.js → DVD-jGiv.js} +1 -1
- package/.output/public/_nuxt/{BWajNATZ.js → Dk9qGA5X.js} +3 -3
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/dc761332-547d-4953-b51d-b2d453009b48.json +1 -0
- package/.output/public/_nuxt/error-404.64pZEiDn.css +1 -0
- package/.output/public/_nuxt/error-500.DHOpI0Ir.css +1 -0
- package/.output/public/_nuxt/{BoHhCIKW.js → koEZfutw.js} +3 -3
- package/.output/public/_nuxt/{B_782F4p.js → r6LdR7DN.js} +1 -1
- package/.output/public/_nuxt/{BEI71c6K.js → rEfOp38p.js} +1 -1
- package/.output/server/chunks/_/error-500.mjs.map +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/{error-404-8tbBXju4.mjs → error-404-BN-7rNE4.mjs} +4 -4
- package/.output/server/chunks/build/error-404-BN-7rNE4.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-styles.Byx46oLR.mjs +8 -0
- package/.output/server/chunks/build/error-404-styles.Byx46oLR.mjs.map +1 -0
- package/.output/server/chunks/build/{error-500-DxFsom1i.mjs → error-500-DhIQ-2yt.mjs} +4 -4
- package/.output/server/chunks/build/error-500-DhIQ-2yt.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-styles.BL3UT0Wa.mjs +8 -0
- package/.output/server/chunks/build/error-500-styles.BL3UT0Wa.mjs.map +1 -0
- package/.output/server/chunks/build/{index-BB-Clavm.mjs → index-Dnrh1ePF.mjs} +1 -1
- package/.output/server/chunks/build/index-Dnrh1ePF.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +9 -9
- package/.output/server/chunks/build/styles.mjs +4 -4
- package/.output/server/chunks/nitro/nitro.mjs +333 -333
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/renderer.mjs.map +1 -1
- package/.output/server/node_modules/bson/lib/bson.cjs +157 -48
- package/.output/server/node_modules/bson/package.json +9 -11
- package/.output/server/node_modules/kareem/index.js +228 -343
- package/.output/server/node_modules/kareem/package.json +3 -3
- package/.output/server/node_modules/mongodb/lib/bson.js +27 -5
- package/.output/server/node_modules/mongodb/lib/bulk/common.js +7 -9
- package/.output/server/node_modules/mongodb/lib/change_stream.js +91 -39
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js +21 -14
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/client_encryption.js +2 -5
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/errors.js +3 -1
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js +1 -1
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/state_machine.js +1 -0
- package/.output/server/node_modules/mongodb/lib/cmap/auth/aws4.js +161 -0
- package/.output/server/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js +11 -58
- package/.output/server/node_modules/mongodb/lib/cmap/auth/gssapi.js +4 -6
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js +2 -16
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js +14 -23
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +3 -3
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +3 -3
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +4 -3
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +4 -3
- package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js +4 -4
- package/.output/server/node_modules/mongodb/lib/cmap/auth/plain.js +1 -1
- package/.output/server/node_modules/mongodb/lib/cmap/auth/providers.js +0 -1
- package/.output/server/node_modules/mongodb/lib/cmap/auth/scram.js +53 -40
- package/.output/server/node_modules/mongodb/lib/cmap/commands.js +46 -39
- package/.output/server/node_modules/mongodb/lib/cmap/connect.js +35 -3
- package/.output/server/node_modules/mongodb/lib/cmap/connection.js +36 -32
- package/.output/server/node_modules/mongodb/lib/cmap/connection_pool.js +67 -67
- package/.output/server/node_modules/mongodb/lib/cmap/connection_pool_events.js +3 -3
- package/.output/server/node_modules/mongodb/lib/cmap/errors.js +1 -1
- package/.output/server/node_modules/mongodb/lib/cmap/handshake/client_metadata.js +15 -13
- package/.output/server/node_modules/mongodb/lib/cmap/metrics.js +3 -3
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/compression.js +26 -10
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/constants.js +3 -1
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js +0 -1
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js +9 -9
- package/.output/server/node_modules/mongodb/lib/cmap/wire_protocol/responses.js +2 -2
- package/.output/server/node_modules/mongodb/lib/collection.js +1 -1
- package/.output/server/node_modules/mongodb/lib/connection_string.js +30 -15
- package/.output/server/node_modules/mongodb/lib/cursor/abstract_cursor.js +17 -34
- package/.output/server/node_modules/mongodb/lib/cursor/change_stream_cursor.js +2 -2
- package/.output/server/node_modules/mongodb/lib/cursor/find_cursor.js +37 -26
- package/.output/server/node_modules/mongodb/lib/cursor/run_command_cursor.js +1 -1
- package/.output/server/node_modules/mongodb/lib/db.js +6 -7
- package/.output/server/node_modules/mongodb/lib/deps.js +0 -13
- package/.output/server/node_modules/mongodb/lib/error.js +7 -10
- package/.output/server/node_modules/mongodb/lib/gridfs/download.js +7 -6
- package/.output/server/node_modules/mongodb/lib/gridfs/index.js +9 -9
- package/.output/server/node_modules/mongodb/lib/gridfs/upload.js +17 -23
- package/.output/server/node_modules/mongodb/lib/index.js +2 -4
- package/.output/server/node_modules/mongodb/lib/mongo_client.js +58 -67
- package/.output/server/node_modules/mongodb/lib/mongo_client_auth_providers.js +0 -6
- package/.output/server/node_modules/mongodb/lib/mongo_logger.js +11 -5
- package/.output/server/node_modules/mongodb/lib/mongo_types.js +1 -2
- package/.output/server/node_modules/mongodb/lib/operations/aggregate.js +0 -3
- package/.output/server/node_modules/mongodb/lib/operations/create_collection.js +0 -1
- package/.output/server/node_modules/mongodb/lib/operations/drop.js +8 -9
- package/.output/server/node_modules/mongodb/lib/operations/end_sessions.js +34 -0
- package/.output/server/node_modules/mongodb/lib/operations/execute_operation.js +121 -45
- package/.output/server/node_modules/mongodb/lib/operations/operation.js +1 -0
- package/.output/server/node_modules/mongodb/lib/read_preference.js +10 -14
- package/.output/server/node_modules/mongodb/lib/runtime_adapters.js +32 -0
- package/.output/server/node_modules/mongodb/lib/sdam/monitor.js +8 -8
- package/.output/server/node_modules/mongodb/lib/sdam/server.js +55 -43
- package/.output/server/node_modules/mongodb/lib/sdam/server_description.js +1 -1
- package/.output/server/node_modules/mongodb/lib/sdam/server_selection.js +135 -72
- package/.output/server/node_modules/mongodb/lib/sdam/srv_polling.js +3 -3
- package/.output/server/node_modules/mongodb/lib/sdam/topology.js +37 -77
- package/.output/server/node_modules/mongodb/lib/sdam/topology_description.js +1 -1
- package/.output/server/node_modules/mongodb/lib/sessions.js +150 -40
- package/.output/server/node_modules/mongodb/lib/transactions.js +2 -13
- package/.output/server/node_modules/mongodb/lib/utils.js +42 -90
- package/.output/server/node_modules/mongodb/package.json +49 -45
- package/.output/server/node_modules/mongodb-connection-string-url/lib/index.js +45 -19
- package/.output/server/node_modules/mongodb-connection-string-url/lib/redact.js +30 -19
- package/.output/server/node_modules/mongodb-connection-string-url/package.json +25 -16
- package/.output/server/node_modules/mongoose/lib/aggregate.js +108 -127
- package/.output/server/node_modules/mongoose/lib/cast/bigint.js +3 -3
- package/.output/server/node_modules/mongoose/lib/cast/boolean.js +3 -3
- package/.output/server/node_modules/mongoose/lib/cast/double.js +4 -4
- package/.output/server/node_modules/mongoose/lib/cast/int32.js +2 -2
- package/.output/server/node_modules/mongoose/lib/cast/number.js +6 -6
- package/.output/server/node_modules/mongoose/lib/cast/string.js +3 -3
- package/.output/server/node_modules/mongoose/lib/cast/uuid.js +5 -48
- package/.output/server/node_modules/mongoose/lib/cast.js +16 -24
- package/.output/server/node_modules/mongoose/lib/collection.js +6 -6
- package/.output/server/node_modules/mongoose/lib/connection.js +108 -105
- package/.output/server/node_modules/mongoose/lib/cursor/aggregationCursor.js +23 -33
- package/.output/server/node_modules/mongoose/lib/cursor/changeStream.js +60 -40
- package/.output/server/node_modules/mongoose/lib/cursor/queryCursor.js +21 -25
- package/.output/server/node_modules/mongoose/lib/document.js +712 -531
- package/.output/server/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js +85 -130
- package/.output/server/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js +32 -41
- package/.output/server/node_modules/mongoose/lib/error/cast.js +21 -12
- package/.output/server/node_modules/mongoose/lib/error/createCollectionsError.js +2 -2
- package/.output/server/node_modules/mongoose/lib/error/divergentArray.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/eachAsyncMultiError.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/index.js +3 -3
- package/.output/server/node_modules/mongoose/lib/error/invalidSchemaOption.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/messages.js +1 -0
- package/.output/server/node_modules/mongoose/lib/error/missingSchema.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/objectParameter.js +4 -5
- package/.output/server/node_modules/mongoose/lib/error/overwriteModel.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/setOptionError.js +3 -3
- package/.output/server/node_modules/mongoose/lib/error/strict.js +3 -3
- package/.output/server/node_modules/mongoose/lib/error/strictPopulate.js +2 -2
- package/.output/server/node_modules/mongoose/lib/error/syncIndexes.js +2 -2
- package/.output/server/node_modules/mongoose/lib/error/validation.js +2 -10
- package/.output/server/node_modules/mongoose/lib/error/validator.js +1 -1
- package/.output/server/node_modules/mongoose/lib/error/version.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/aggregate/prepareDiscriminatorPipeline.js +4 -4
- package/.output/server/node_modules/mongoose/lib/helpers/buildMiddlewareFilter.js +24 -0
- package/.output/server/node_modules/mongoose/lib/helpers/clone.js +35 -18
- package/.output/server/node_modules/mongoose/lib/helpers/common.js +5 -5
- package/.output/server/node_modules/mongoose/lib/helpers/cursor/eachAsync.js +4 -4
- package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getConstructor.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getDiscriminatorByValue.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/discriminator/mergeDiscriminatorSchema.js +10 -5
- package/.output/server/node_modules/mongoose/lib/helpers/document/applyDefaults.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/document/applyTimestamps.js +11 -10
- package/.output/server/node_modules/mongoose/lib/helpers/document/applyVirtuals.js +10 -9
- package/.output/server/node_modules/mongoose/lib/helpers/document/cleanModifiedSubpaths.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/document/compile.js +17 -14
- package/.output/server/node_modules/mongoose/lib/helpers/document/getDeepestSubdocumentForPath.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/document/getEmbeddedDiscriminatorPath.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/document/isInPathsToSave.js +24 -0
- package/.output/server/node_modules/mongoose/lib/helpers/get.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/indexes/getRelatedIndexes.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/indexes/isIndexEqual.js +3 -4
- package/.output/server/node_modules/mongoose/lib/helpers/indexes/isIndexSpecEqual.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/isBsonType.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/isMongooseObject.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/isObject.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/isSimpleValidator.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/minimize.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/model/applyDefaultsToPOJO.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/model/applyHooks.js +55 -54
- package/.output/server/node_modules/mongoose/lib/helpers/model/applyMethods.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/model/applyStaticHooks.js +1 -48
- package/.output/server/node_modules/mongoose/lib/helpers/model/castBulkWrite.js +8 -12
- package/.output/server/node_modules/mongoose/lib/helpers/model/discriminator.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/parallelLimit.js +18 -36
- package/.output/server/node_modules/mongoose/lib/helpers/pluralize.js +4 -4
- package/.output/server/node_modules/mongoose/lib/helpers/populate/assignRawDocsToIdStructure.js +4 -11
- package/.output/server/node_modules/mongoose/lib/helpers/populate/assignVals.js +10 -10
- package/.output/server/node_modules/mongoose/lib/helpers/populate/createPopulateQueryFilter.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js +197 -69
- package/.output/server/node_modules/mongoose/lib/helpers/populate/getSchemaTypes.js +15 -15
- package/.output/server/node_modules/mongoose/lib/helpers/populate/markArraySubdocsPopulated.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/populate/modelNamesFromRefPath.js +10 -2
- package/.output/server/node_modules/mongoose/lib/helpers/populate/setPopulatedVirtualValue.js +5 -5
- package/.output/server/node_modules/mongoose/lib/helpers/printJestWarning.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/processConnectionOptions.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/projection/hasIncludedChildren.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/projection/isPathExcluded.js +3 -3
- package/.output/server/node_modules/mongoose/lib/helpers/projection/isSubpath.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/projection/parseProjection.js +9 -4
- package/.output/server/node_modules/mongoose/lib/helpers/query/cast$expr.js +8 -10
- package/.output/server/node_modules/mongoose/lib/helpers/query/castFilterPath.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/query/castUpdate.js +44 -38
- package/.output/server/node_modules/mongoose/lib/helpers/query/getEmbeddedDiscriminatorPath.js +8 -8
- package/.output/server/node_modules/mongoose/lib/helpers/query/handleImmutable.js +8 -8
- package/.output/server/node_modules/mongoose/lib/helpers/schema/applyPlugins.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/schema/applyReadConcern.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js +4 -2
- package/.output/server/node_modules/mongoose/lib/helpers/schema/getIndexes.js +5 -11
- package/.output/server/node_modules/mongoose/lib/helpers/schema/getSubdocumentStrictValue.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/schema/handleIdOption.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/schema/idGetter.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/schematype/handleImmutable.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/setDefaultsOnInsert.js +26 -13
- package/.output/server/node_modules/mongoose/lib/helpers/timestamps/setDocumentTimestamps.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/timestamps/setupTimestamps.js +60 -38
- package/.output/server/node_modules/mongoose/lib/helpers/update/applyTimestampsToUpdate.js +13 -10
- package/.output/server/node_modules/mongoose/lib/helpers/update/castArrayFilters.js +4 -4
- package/.output/server/node_modules/mongoose/lib/helpers/update/decorateUpdateWithVersionKey.js +1 -1
- package/.output/server/node_modules/mongoose/lib/helpers/update/modifiedPaths.js +2 -2
- package/.output/server/node_modules/mongoose/lib/helpers/update/removeUnusedArrayFilters.js +7 -2
- package/.output/server/node_modules/mongoose/lib/helpers/updateValidators.js +58 -119
- package/.output/server/node_modules/mongoose/lib/model.js +940 -946
- package/.output/server/node_modules/mongoose/lib/mongoose.js +131 -79
- package/.output/server/node_modules/mongoose/lib/options/schemaArrayOptions.js +2 -2
- package/.output/server/node_modules/mongoose/lib/options/schemaBufferOptions.js +1 -1
- package/.output/server/node_modules/mongoose/lib/options/schemaDocumentArrayOptions.js +23 -0
- package/.output/server/node_modules/mongoose/lib/options/schemaNumberOptions.js +3 -3
- package/.output/server/node_modules/mongoose/lib/options/schemaObjectIdOptions.js +2 -2
- package/.output/server/node_modules/mongoose/lib/options/schemaStringOptions.js +6 -6
- package/.output/server/node_modules/mongoose/lib/options/schemaSubdocumentOptions.js +23 -0
- package/.output/server/node_modules/mongoose/lib/options/schemaTypeOptions.js +27 -13
- package/.output/server/node_modules/mongoose/lib/options/virtualOptions.js +12 -12
- package/.output/server/node_modules/mongoose/lib/plugins/index.js +0 -1
- package/.output/server/node_modules/mongoose/lib/plugins/saveSubdocs.js +84 -92
- package/.output/server/node_modules/mongoose/lib/plugins/sharding.js +33 -15
- package/.output/server/node_modules/mongoose/lib/plugins/trackTransaction.js +29 -25
- package/.output/server/node_modules/mongoose/lib/query.js +700 -548
- package/.output/server/node_modules/mongoose/lib/queryHelpers.js +34 -32
- package/.output/server/node_modules/mongoose/lib/schema/array.js +69 -113
- package/.output/server/node_modules/mongoose/lib/schema/bigint.js +18 -20
- package/.output/server/node_modules/mongoose/lib/schema/boolean.js +20 -22
- package/.output/server/node_modules/mongoose/lib/schema/buffer.js +23 -25
- package/.output/server/node_modules/mongoose/lib/schema/date.js +19 -21
- package/.output/server/node_modules/mongoose/lib/schema/decimal128.js +16 -18
- package/.output/server/node_modules/mongoose/lib/schema/documentArray.js +94 -131
- package/.output/server/node_modules/mongoose/lib/schema/documentArrayElement.js +50 -16
- package/.output/server/node_modules/mongoose/lib/schema/double.js +16 -18
- package/.output/server/node_modules/mongoose/lib/schema/index.js +1 -0
- package/.output/server/node_modules/mongoose/lib/schema/int32.js +17 -19
- package/.output/server/node_modules/mongoose/lib/schema/map.js +17 -24
- package/.output/server/node_modules/mongoose/lib/schema/mixed.js +14 -14
- package/.output/server/node_modules/mongoose/lib/schema/number.js +38 -28
- package/.output/server/node_modules/mongoose/lib/schema/objectId.js +18 -20
- package/.output/server/node_modules/mongoose/lib/schema/operators/exists.js +1 -1
- package/.output/server/node_modules/mongoose/lib/schema/operators/geospatial.js +1 -1
- package/.output/server/node_modules/mongoose/lib/schema/operators/text.js +4 -4
- package/.output/server/node_modules/mongoose/lib/schema/string.js +42 -27
- package/.output/server/node_modules/mongoose/lib/schema/subdocument.js +47 -58
- package/.output/server/node_modules/mongoose/lib/schema/union.js +54 -4
- package/.output/server/node_modules/mongoose/lib/schema/uuid.js +17 -40
- package/.output/server/node_modules/mongoose/lib/schema.js +235 -176
- package/.output/server/node_modules/mongoose/lib/schemaType.js +227 -158
- package/.output/server/node_modules/mongoose/lib/stateMachine.js +5 -8
- package/.output/server/node_modules/mongoose/lib/types/array/index.js +5 -5
- package/.output/server/node_modules/mongoose/lib/types/array/methods/index.js +27 -28
- package/.output/server/node_modules/mongoose/lib/types/arraySubdocument.js +11 -11
- package/.output/server/node_modules/mongoose/lib/types/buffer.js +15 -15
- package/.output/server/node_modules/mongoose/lib/types/decimal128.js +1 -1
- package/.output/server/node_modules/mongoose/lib/types/documentArray/index.js +4 -4
- package/.output/server/node_modules/mongoose/lib/types/documentArray/methods/index.js +15 -13
- package/.output/server/node_modules/mongoose/lib/types/double.js +1 -1
- package/.output/server/node_modules/mongoose/lib/types/map.js +20 -71
- package/.output/server/node_modules/mongoose/lib/types/objectid.js +1 -1
- package/.output/server/node_modules/mongoose/lib/types/subdocument.js +32 -81
- package/.output/server/node_modules/mongoose/lib/types/uuid.js +1 -1
- package/.output/server/node_modules/mongoose/lib/utils.js +91 -70
- package/.output/server/node_modules/mongoose/lib/validOptions.js +4 -3
- package/.output/server/node_modules/mongoose/lib/virtualType.js +18 -18
- package/.output/server/node_modules/mongoose/package.json +46 -63
- package/.output/server/node_modules/mquery/lib/collection/collection.js +3 -1
- package/.output/server/node_modules/mquery/lib/collection/node.js +17 -3
- package/.output/server/node_modules/mquery/lib/mquery.js +136 -93
- package/.output/server/node_modules/mquery/lib/permissions.js +21 -6
- package/.output/server/node_modules/mquery/package.json +4 -7
- package/.output/server/package.json +7 -9
- package/package.json +3 -3
- package/.output/public/_nuxt/builds/meta/0d6006db-fbb0-4297-85cf-bf92ceafcb79.json +0 -1
- package/.output/public/_nuxt/error-404.CTWLHxjC.css +0 -1
- package/.output/public/_nuxt/error-500.UBfk8-QP.css +0 -1
- package/.output/server/chunks/build/error-404-8tbBXju4.mjs.map +0 -1
- package/.output/server/chunks/build/error-404-styles.BeWfK6Py.mjs +0 -8
- package/.output/server/chunks/build/error-404-styles.BeWfK6Py.mjs.map +0 -1
- package/.output/server/chunks/build/error-500-DxFsom1i.mjs.map +0 -1
- package/.output/server/chunks/build/error-500-styles.CPUUvoY-.mjs +0 -8
- package/.output/server/chunks/build/error-500-styles.CPUUvoY-.mjs.map +0 -1
- package/.output/server/chunks/build/index-BB-Clavm.mjs.map +0 -1
- package/.output/server/node_modules/debug/package.json +0 -64
- package/.output/server/node_modules/debug/src/browser.js +0 -272
- package/.output/server/node_modules/debug/src/common.js +0 -292
- package/.output/server/node_modules/debug/src/index.js +0 -10
- package/.output/server/node_modules/debug/src/node.js +0 -263
- package/.output/server/node_modules/mongodb/lib/client-side-encryption/crypto_callbacks.js +0 -81
- package/.output/server/node_modules/mongodb/lib/resource_management.js +0 -58
- package/.output/server/node_modules/mongoose/lib/browserDocument.js +0 -101
- package/.output/server/node_modules/mongoose/lib/documentProvider.js +0 -30
- package/.output/server/node_modules/mongoose/lib/helpers/createJSONSchemaTypeDefinition.js +0 -24
- package/.output/server/node_modules/mongoose/lib/helpers/promiseOrCallback.js +0 -54
- package/.output/server/node_modules/mongoose/lib/plugins/validateBeforeSave.js +0 -51
- package/.output/server/node_modules/supports-color/index.js +0 -202
- 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 {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
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 {
|
|
58
|
-
* @param {
|
|
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 {
|
|
145
|
-
* @return {
|
|
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 {
|
|
157
|
-
* @param {
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
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 {
|
|
61
|
-
* @param {
|
|
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 {
|
|
163
|
-
* @return {
|
|
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 {
|
|
219
|
-
* @param {
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
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 => !!
|
|
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 {
|
|
67
|
-
* @param {
|
|
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 {
|
|
123
|
+
* @param {any} value
|
|
125
124
|
* @param {Document} doc
|
|
126
|
-
* @return {
|
|
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 {
|
|
139
|
+
* @param {object} value
|
|
141
140
|
* @param {Document} doc document that triggers the casting
|
|
142
|
-
* @param {
|
|
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
|
|
148
|
+
if (value?.isMongooseBuffer) {
|
|
150
149
|
return value;
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
if (Buffer.isBuffer(value)) {
|
|
154
|
-
if (!value
|
|
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
|
|
177
|
+
if (value?._id) {
|
|
179
178
|
value = value._id;
|
|
180
179
|
}
|
|
181
180
|
|
|
182
|
-
if (value
|
|
181
|
+
if (value?.isMongooseBuffer) {
|
|
183
182
|
return value;
|
|
184
183
|
}
|
|
185
184
|
|
|
186
185
|
if (Buffer.isBuffer(value)) {
|
|
187
|
-
if (!value
|
|
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://
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
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 {
|
|
67
|
-
* @param {
|
|
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 {
|
|
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 {
|
|
215
|
+
* @param {any} value
|
|
217
216
|
* @param {Document} doc
|
|
218
|
-
* @return {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
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 {
|
|
62
|
-
* @param {
|
|
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 {
|
|
156
|
+
* @param {any} value
|
|
158
157
|
* @param {Document} doc
|
|
159
|
-
* @return {
|
|
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 {
|
|
181
|
-
* @param {
|
|
182
|
-
* @param {
|
|
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 {
|
|
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
|
-
|
|
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() {
|