@nullix/zod-mongoose-studio 1.0.12 → 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 +342 -342
- 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/b59771ef-8e58-4078-9d18-ccc01cba96e9.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
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module dependencies.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const tty = require('tty');
|
|
6
|
-
const util = require('util');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This is the Node.js implementation of `debug()`.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
exports.init = init;
|
|
13
|
-
exports.log = log;
|
|
14
|
-
exports.formatArgs = formatArgs;
|
|
15
|
-
exports.save = save;
|
|
16
|
-
exports.load = load;
|
|
17
|
-
exports.useColors = useColors;
|
|
18
|
-
exports.destroy = util.deprecate(
|
|
19
|
-
() => {},
|
|
20
|
-
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Colors.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
31
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
32
|
-
const supportsColor = require('supports-color');
|
|
33
|
-
|
|
34
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
35
|
-
exports.colors = [
|
|
36
|
-
20,
|
|
37
|
-
21,
|
|
38
|
-
26,
|
|
39
|
-
27,
|
|
40
|
-
32,
|
|
41
|
-
33,
|
|
42
|
-
38,
|
|
43
|
-
39,
|
|
44
|
-
40,
|
|
45
|
-
41,
|
|
46
|
-
42,
|
|
47
|
-
43,
|
|
48
|
-
44,
|
|
49
|
-
45,
|
|
50
|
-
56,
|
|
51
|
-
57,
|
|
52
|
-
62,
|
|
53
|
-
63,
|
|
54
|
-
68,
|
|
55
|
-
69,
|
|
56
|
-
74,
|
|
57
|
-
75,
|
|
58
|
-
76,
|
|
59
|
-
77,
|
|
60
|
-
78,
|
|
61
|
-
79,
|
|
62
|
-
80,
|
|
63
|
-
81,
|
|
64
|
-
92,
|
|
65
|
-
93,
|
|
66
|
-
98,
|
|
67
|
-
99,
|
|
68
|
-
112,
|
|
69
|
-
113,
|
|
70
|
-
128,
|
|
71
|
-
129,
|
|
72
|
-
134,
|
|
73
|
-
135,
|
|
74
|
-
148,
|
|
75
|
-
149,
|
|
76
|
-
160,
|
|
77
|
-
161,
|
|
78
|
-
162,
|
|
79
|
-
163,
|
|
80
|
-
164,
|
|
81
|
-
165,
|
|
82
|
-
166,
|
|
83
|
-
167,
|
|
84
|
-
168,
|
|
85
|
-
169,
|
|
86
|
-
170,
|
|
87
|
-
171,
|
|
88
|
-
172,
|
|
89
|
-
173,
|
|
90
|
-
178,
|
|
91
|
-
179,
|
|
92
|
-
184,
|
|
93
|
-
185,
|
|
94
|
-
196,
|
|
95
|
-
197,
|
|
96
|
-
198,
|
|
97
|
-
199,
|
|
98
|
-
200,
|
|
99
|
-
201,
|
|
100
|
-
202,
|
|
101
|
-
203,
|
|
102
|
-
204,
|
|
103
|
-
205,
|
|
104
|
-
206,
|
|
105
|
-
207,
|
|
106
|
-
208,
|
|
107
|
-
209,
|
|
108
|
-
214,
|
|
109
|
-
215,
|
|
110
|
-
220,
|
|
111
|
-
221
|
|
112
|
-
];
|
|
113
|
-
}
|
|
114
|
-
} catch (error) {
|
|
115
|
-
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
|
120
|
-
*
|
|
121
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
122
|
-
*/
|
|
123
|
-
|
|
124
|
-
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
|
125
|
-
return /^debug_/i.test(key);
|
|
126
|
-
}).reduce((obj, key) => {
|
|
127
|
-
// Camel-case
|
|
128
|
-
const prop = key
|
|
129
|
-
.substring(6)
|
|
130
|
-
.toLowerCase()
|
|
131
|
-
.replace(/_([a-z])/g, (_, k) => {
|
|
132
|
-
return k.toUpperCase();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// Coerce string value into JS value
|
|
136
|
-
let val = process.env[key];
|
|
137
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
138
|
-
val = true;
|
|
139
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
140
|
-
val = false;
|
|
141
|
-
} else if (val === 'null') {
|
|
142
|
-
val = null;
|
|
143
|
-
} else {
|
|
144
|
-
val = Number(val);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
obj[prop] = val;
|
|
148
|
-
return obj;
|
|
149
|
-
}, {});
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
|
-
function useColors() {
|
|
156
|
-
return 'colors' in exports.inspectOpts ?
|
|
157
|
-
Boolean(exports.inspectOpts.colors) :
|
|
158
|
-
tty.isatty(process.stderr.fd);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Adds ANSI color escape codes if enabled.
|
|
163
|
-
*
|
|
164
|
-
* @api public
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
|
-
function formatArgs(args) {
|
|
168
|
-
const {namespace: name, useColors} = this;
|
|
169
|
-
|
|
170
|
-
if (useColors) {
|
|
171
|
-
const c = this.color;
|
|
172
|
-
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
173
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
174
|
-
|
|
175
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
176
|
-
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
177
|
-
} else {
|
|
178
|
-
args[0] = getDate() + name + ' ' + args[0];
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function getDate() {
|
|
183
|
-
if (exports.inspectOpts.hideDate) {
|
|
184
|
-
return '';
|
|
185
|
-
}
|
|
186
|
-
return new Date().toISOString() + ' ';
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
function log(...args) {
|
|
194
|
-
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Save `namespaces`.
|
|
199
|
-
*
|
|
200
|
-
* @param {String} namespaces
|
|
201
|
-
* @api private
|
|
202
|
-
*/
|
|
203
|
-
function save(namespaces) {
|
|
204
|
-
if (namespaces) {
|
|
205
|
-
process.env.DEBUG = namespaces;
|
|
206
|
-
} else {
|
|
207
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
|
208
|
-
// string 'null' or 'undefined'. Just delete instead.
|
|
209
|
-
delete process.env.DEBUG;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Load `namespaces`.
|
|
215
|
-
*
|
|
216
|
-
* @return {String} returns the previously persisted debug modes
|
|
217
|
-
* @api private
|
|
218
|
-
*/
|
|
219
|
-
|
|
220
|
-
function load() {
|
|
221
|
-
return process.env.DEBUG;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Init logic for `debug` instances.
|
|
226
|
-
*
|
|
227
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
|
228
|
-
* differently for a particular `debug` instance.
|
|
229
|
-
*/
|
|
230
|
-
|
|
231
|
-
function init(debug) {
|
|
232
|
-
debug.inspectOpts = {};
|
|
233
|
-
|
|
234
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
235
|
-
for (let i = 0; i < keys.length; i++) {
|
|
236
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
module.exports = require('./common')(exports);
|
|
241
|
-
|
|
242
|
-
const {formatters} = module.exports;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
246
|
-
*/
|
|
247
|
-
|
|
248
|
-
formatters.o = function (v) {
|
|
249
|
-
this.inspectOpts.colors = this.useColors;
|
|
250
|
-
return util.inspect(v, this.inspectOpts)
|
|
251
|
-
.split('\n')
|
|
252
|
-
.map(str => str.trim())
|
|
253
|
-
.join(' ');
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
258
|
-
*/
|
|
259
|
-
|
|
260
|
-
formatters.O = function (v) {
|
|
261
|
-
this.inspectOpts.colors = this.useColors;
|
|
262
|
-
return util.inspect(v, this.inspectOpts);
|
|
263
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hmacSha256Hook = exports.hmacSha512Hook = exports.aes256CtrDecryptHook = exports.aes256CtrEncryptHook = exports.aes256CbcDecryptHook = exports.aes256CbcEncryptHook = void 0;
|
|
4
|
-
exports.makeAES256Hook = makeAES256Hook;
|
|
5
|
-
exports.randomHook = randomHook;
|
|
6
|
-
exports.sha256Hook = sha256Hook;
|
|
7
|
-
exports.makeHmacHook = makeHmacHook;
|
|
8
|
-
exports.signRsaSha256Hook = signRsaSha256Hook;
|
|
9
|
-
const crypto = require("crypto");
|
|
10
|
-
function makeAES256Hook(method, mode) {
|
|
11
|
-
return function (key, iv, input, output) {
|
|
12
|
-
let result;
|
|
13
|
-
try {
|
|
14
|
-
const cipher = crypto[method](mode, key, iv);
|
|
15
|
-
cipher.setAutoPadding(false);
|
|
16
|
-
result = cipher.update(input);
|
|
17
|
-
const final = cipher.final();
|
|
18
|
-
if (final.length > 0) {
|
|
19
|
-
result = Buffer.concat([result, final]);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
return e;
|
|
24
|
-
}
|
|
25
|
-
result.copy(output);
|
|
26
|
-
return result.length;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function randomHook(buffer, count) {
|
|
30
|
-
try {
|
|
31
|
-
crypto.randomFillSync(buffer, 0, count);
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
return e;
|
|
35
|
-
}
|
|
36
|
-
return count;
|
|
37
|
-
}
|
|
38
|
-
function sha256Hook(input, output) {
|
|
39
|
-
let result;
|
|
40
|
-
try {
|
|
41
|
-
result = crypto.createHash('sha256').update(input).digest();
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
return e;
|
|
45
|
-
}
|
|
46
|
-
result.copy(output);
|
|
47
|
-
return result.length;
|
|
48
|
-
}
|
|
49
|
-
function makeHmacHook(algorithm) {
|
|
50
|
-
return (key, input, output) => {
|
|
51
|
-
let result;
|
|
52
|
-
try {
|
|
53
|
-
result = crypto.createHmac(algorithm, key).update(input).digest();
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
return e;
|
|
57
|
-
}
|
|
58
|
-
result.copy(output);
|
|
59
|
-
return result.length;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function signRsaSha256Hook(key, input, output) {
|
|
63
|
-
let result;
|
|
64
|
-
try {
|
|
65
|
-
const signer = crypto.createSign('sha256WithRSAEncryption');
|
|
66
|
-
const privateKey = Buffer.from(`-----BEGIN PRIVATE KEY-----\n${key.toString('base64')}\n-----END PRIVATE KEY-----\n`);
|
|
67
|
-
result = signer.update(input).end().sign(privateKey);
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
return e;
|
|
71
|
-
}
|
|
72
|
-
result.copy(output);
|
|
73
|
-
return result.length;
|
|
74
|
-
}
|
|
75
|
-
exports.aes256CbcEncryptHook = makeAES256Hook('createCipheriv', 'aes-256-cbc');
|
|
76
|
-
exports.aes256CbcDecryptHook = makeAES256Hook('createDecipheriv', 'aes-256-cbc');
|
|
77
|
-
exports.aes256CtrEncryptHook = makeAES256Hook('createCipheriv', 'aes-256-ctr');
|
|
78
|
-
exports.aes256CtrDecryptHook = makeAES256Hook('createDecipheriv', 'aes-256-ctr');
|
|
79
|
-
exports.hmacSha512Hook = makeHmacHook('sha512');
|
|
80
|
-
exports.hmacSha256Hook = makeHmacHook('sha256');
|
|
81
|
-
//# sourceMappingURL=crypto_callbacks.js.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configureResourceManagement = configureResourceManagement;
|
|
4
|
-
exports.configureExplicitResourceManagement = configureExplicitResourceManagement;
|
|
5
|
-
/** @internal */
|
|
6
|
-
function configureResourceManagement(target) {
|
|
7
|
-
Symbol.asyncDispose &&
|
|
8
|
-
Object.defineProperty(target, Symbol.asyncDispose, {
|
|
9
|
-
value: async function asyncDispose() {
|
|
10
|
-
await this.asyncDispose();
|
|
11
|
-
},
|
|
12
|
-
enumerable: false,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @beta
|
|
19
|
-
* @experimental
|
|
20
|
-
*
|
|
21
|
-
* Attaches `Symbol.asyncDispose` methods to the MongoClient, Cursors, sessions and change streams
|
|
22
|
-
* if Symbol.asyncDispose is defined.
|
|
23
|
-
*
|
|
24
|
-
* It's usually not necessary to call this method - the driver attempts to attach these methods
|
|
25
|
-
* itself when its loaded. However, sometimes the driver may be loaded before `Symbol.asyncDispose`
|
|
26
|
-
* is defined, in which case it is necessary to call this method directly. This can happen if the
|
|
27
|
-
* application is polyfilling `Symbol.asyncDispose`.
|
|
28
|
-
*
|
|
29
|
-
* Example:
|
|
30
|
-
*
|
|
31
|
-
* ```typescript
|
|
32
|
-
* import { configureExplicitResourceManagement, MongoClient } from 'mongodb/lib/beta';
|
|
33
|
-
*
|
|
34
|
-
* Symbol.asyncDispose ??= Symbol('dispose');
|
|
35
|
-
* load();
|
|
36
|
-
*
|
|
37
|
-
* await using client = new MongoClient(...);
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
function configureExplicitResourceManagement() {
|
|
41
|
-
// We must import lazily here, because there's a circular dependency between the resource management
|
|
42
|
-
// file and each resources' file. We could move `configureResourceManagement` to a separate
|
|
43
|
-
// function, but keeping all resource-management related code together seemed preferable and I chose
|
|
44
|
-
// lazy requiring of resources instead.
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
46
|
-
const { MongoClient } = require('./mongo_client');
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
48
|
-
const { ClientSession } = require('./sessions');
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
50
|
-
const { AbstractCursor } = require('./cursor/abstract_cursor');
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
52
|
-
const { ChangeStream } = require('./change_stream');
|
|
53
|
-
configureResourceManagement(MongoClient.prototype);
|
|
54
|
-
configureResourceManagement(ClientSession.prototype);
|
|
55
|
-
configureResourceManagement(AbstractCursor.prototype);
|
|
56
|
-
configureResourceManagement(ChangeStream.prototype);
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=resource_management.js.map
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Module dependencies.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
'use strict';
|
|
6
|
-
|
|
7
|
-
const NodeJSDocument = require('./document');
|
|
8
|
-
const EventEmitter = require('events').EventEmitter;
|
|
9
|
-
const MongooseError = require('./error/index');
|
|
10
|
-
const Schema = require('./schema');
|
|
11
|
-
const ObjectId = require('./types/objectid');
|
|
12
|
-
const ValidationError = MongooseError.ValidationError;
|
|
13
|
-
const applyHooks = require('./helpers/model/applyHooks');
|
|
14
|
-
const isObject = require('./helpers/isObject');
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Document constructor.
|
|
18
|
-
*
|
|
19
|
-
* @param {Object} obj the values to set
|
|
20
|
-
* @param {Object} schema
|
|
21
|
-
* @param {Object} [fields] optional object containing the fields which were selected in the query returning this document and any populated paths data
|
|
22
|
-
* @param {Boolean} [skipId] bool, should we auto create an ObjectId _id
|
|
23
|
-
* @inherits NodeJS EventEmitter https://nodejs.org/api/events.html#class-eventemitter
|
|
24
|
-
* @event `init`: Emitted on a document after it has was retrieved from the db and fully hydrated by Mongoose.
|
|
25
|
-
* @event `save`: Emitted when the document is successfully saved
|
|
26
|
-
* @api private
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
function Document(obj, schema, fields, skipId, skipInit) {
|
|
30
|
-
if (!(this instanceof Document)) {
|
|
31
|
-
return new Document(obj, schema, fields, skipId, skipInit);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (isObject(schema) && !schema.instanceOfSchema) {
|
|
35
|
-
schema = new Schema(schema);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// When creating EmbeddedDocument, it already has the schema and he doesn't need the _id
|
|
39
|
-
schema = this.schema || schema;
|
|
40
|
-
|
|
41
|
-
// Generate ObjectId if it is missing, but it requires a scheme
|
|
42
|
-
if (!this.schema && schema.options._id) {
|
|
43
|
-
obj = obj || {};
|
|
44
|
-
|
|
45
|
-
if (obj._id === undefined) {
|
|
46
|
-
obj._id = new ObjectId();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (!schema) {
|
|
51
|
-
throw new MongooseError.MissingSchemaError();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
this.$__setSchema(schema);
|
|
55
|
-
|
|
56
|
-
NodeJSDocument.call(this, obj, fields, skipId, skipInit);
|
|
57
|
-
|
|
58
|
-
applyHooks(this, schema, { decorateDoc: true });
|
|
59
|
-
|
|
60
|
-
// apply methods
|
|
61
|
-
for (const m in schema.methods) {
|
|
62
|
-
this[m] = schema.methods[m];
|
|
63
|
-
}
|
|
64
|
-
// apply statics
|
|
65
|
-
for (const s in schema.statics) {
|
|
66
|
-
this[s] = schema.statics[s];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/*!
|
|
71
|
-
* Inherit from the NodeJS document
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
Document.prototype = Object.create(NodeJSDocument.prototype);
|
|
75
|
-
Document.prototype.constructor = Document;
|
|
76
|
-
|
|
77
|
-
/*!
|
|
78
|
-
* ignore
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
Document.events = new EventEmitter();
|
|
82
|
-
|
|
83
|
-
/*!
|
|
84
|
-
* Browser doc exposes the event emitter API
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
Document.$emitter = new EventEmitter();
|
|
88
|
-
|
|
89
|
-
['on', 'once', 'emit', 'listeners', 'removeListener', 'setMaxListeners',
|
|
90
|
-
'removeAllListeners', 'addListener'].forEach(function(emitterFn) {
|
|
91
|
-
Document[emitterFn] = function() {
|
|
92
|
-
return Document.$emitter[emitterFn].apply(Document.$emitter, arguments);
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
/*!
|
|
97
|
-
* Module exports.
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
Document.ValidationError = ValidationError;
|
|
101
|
-
module.exports = exports = Document;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/* eslint-env browser */
|
|
4
|
-
|
|
5
|
-
/*!
|
|
6
|
-
* Module dependencies.
|
|
7
|
-
*/
|
|
8
|
-
const Document = require('./document.js');
|
|
9
|
-
const BrowserDocument = require('./browserDocument.js');
|
|
10
|
-
|
|
11
|
-
let isBrowser = false;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Returns the Document constructor for the current context
|
|
15
|
-
*
|
|
16
|
-
* @api private
|
|
17
|
-
*/
|
|
18
|
-
module.exports = function documentProvider() {
|
|
19
|
-
if (isBrowser) {
|
|
20
|
-
return BrowserDocument;
|
|
21
|
-
}
|
|
22
|
-
return Document;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/*!
|
|
26
|
-
* ignore
|
|
27
|
-
*/
|
|
28
|
-
module.exports.setBrowser = function(flag) {
|
|
29
|
-
isBrowser = flag;
|
|
30
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Handles creating `{ type: 'object' }` vs `{ bsonType: 'object' }` vs `{ bsonType: ['object', 'null'] }`
|
|
5
|
-
*
|
|
6
|
-
* @param {String} type
|
|
7
|
-
* @param {String} bsonType
|
|
8
|
-
* @param {Boolean} useBsonType
|
|
9
|
-
* @param {Boolean} isRequired
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
module.exports = function createJSONSchemaTypeArray(type, bsonType, useBsonType, isRequired) {
|
|
13
|
-
if (useBsonType) {
|
|
14
|
-
if (isRequired) {
|
|
15
|
-
return { bsonType };
|
|
16
|
-
}
|
|
17
|
-
return { bsonType: [bsonType, 'null'] };
|
|
18
|
-
} else {
|
|
19
|
-
if (isRequired) {
|
|
20
|
-
return { type };
|
|
21
|
-
}
|
|
22
|
-
return { type: [type, 'null'] };
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const immediate = require('./immediate');
|
|
4
|
-
|
|
5
|
-
const emittedSymbol = Symbol('mongoose#emitted');
|
|
6
|
-
|
|
7
|
-
module.exports = function promiseOrCallback(callback, fn, ee, Promise) {
|
|
8
|
-
if (typeof callback === 'function') {
|
|
9
|
-
try {
|
|
10
|
-
return fn(function(error) {
|
|
11
|
-
if (error != null) {
|
|
12
|
-
if (ee != null && ee.listeners != null && ee.listeners('error').length > 0 && !error[emittedSymbol]) {
|
|
13
|
-
error[emittedSymbol] = true;
|
|
14
|
-
ee.emit('error', error);
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
callback(error);
|
|
18
|
-
} catch (error) {
|
|
19
|
-
return immediate(() => {
|
|
20
|
-
throw error;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
callback.apply(this, arguments);
|
|
26
|
-
});
|
|
27
|
-
} catch (error) {
|
|
28
|
-
if (ee != null && ee.listeners != null && ee.listeners('error').length > 0 && !error[emittedSymbol]) {
|
|
29
|
-
error[emittedSymbol] = true;
|
|
30
|
-
ee.emit('error', error);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return callback(error);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
Promise = Promise || global.Promise;
|
|
38
|
-
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
fn(function(error, res) {
|
|
41
|
-
if (error != null) {
|
|
42
|
-
if (ee != null && ee.listeners != null && ee.listeners('error').length > 0 && !error[emittedSymbol]) {
|
|
43
|
-
error[emittedSymbol] = true;
|
|
44
|
-
ee.emit('error', error);
|
|
45
|
-
}
|
|
46
|
-
return reject(error);
|
|
47
|
-
}
|
|
48
|
-
if (arguments.length > 2) {
|
|
49
|
-
return resolve(Array.prototype.slice.call(arguments, 1));
|
|
50
|
-
}
|
|
51
|
-
resolve(res);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/*!
|
|
4
|
-
* ignore
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = function validateBeforeSave(schema) {
|
|
8
|
-
const unshift = true;
|
|
9
|
-
schema.pre('save', false, function validateBeforeSave(next, options) {
|
|
10
|
-
const _this = this;
|
|
11
|
-
// Nested docs have their own presave
|
|
12
|
-
if (this.$isSubdocument) {
|
|
13
|
-
return next();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const hasValidateBeforeSaveOption = options &&
|
|
17
|
-
(typeof options === 'object') &&
|
|
18
|
-
('validateBeforeSave' in options);
|
|
19
|
-
|
|
20
|
-
let shouldValidate;
|
|
21
|
-
if (hasValidateBeforeSaveOption) {
|
|
22
|
-
shouldValidate = !!options.validateBeforeSave;
|
|
23
|
-
} else {
|
|
24
|
-
shouldValidate = this.$__schema.options.validateBeforeSave;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Validate
|
|
28
|
-
if (shouldValidate) {
|
|
29
|
-
const hasValidateModifiedOnlyOption = options &&
|
|
30
|
-
(typeof options === 'object') &&
|
|
31
|
-
('validateModifiedOnly' in options);
|
|
32
|
-
const validateOptions = hasValidateModifiedOnlyOption ?
|
|
33
|
-
{ validateModifiedOnly: options.validateModifiedOnly } :
|
|
34
|
-
null;
|
|
35
|
-
this.$validate(validateOptions).then(
|
|
36
|
-
() => {
|
|
37
|
-
this.$op = 'save';
|
|
38
|
-
next();
|
|
39
|
-
},
|
|
40
|
-
error => {
|
|
41
|
-
_this.$__schema.s.hooks.execPost('save:error', _this, [_this], { error: error }, function(error) {
|
|
42
|
-
_this.$op = 'save';
|
|
43
|
-
next(error);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
} else {
|
|
48
|
-
next();
|
|
49
|
-
}
|
|
50
|
-
}, null, unshift);
|
|
51
|
-
};
|