@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
package/.output/server/node_modules/mongoose/lib/helpers/document/getDeepestSubdocumentForPath.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* document.
|
|
7
7
|
*
|
|
8
8
|
* @param {Document} doc
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {string[]} parts
|
|
10
10
|
* @param {Schema} schema
|
|
11
|
-
* @returns Document
|
|
11
|
+
* @returns {Document}
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
module.exports = function getDeepestSubdocumentForPath(doc, parts, schema) {
|
|
@@ -17,7 +17,7 @@ module.exports = function getDeepestSubdocumentForPath(doc, parts, schema) {
|
|
|
17
17
|
let subdoc = doc;
|
|
18
18
|
for (let i = 0; i < parts.length - 1; ++i) {
|
|
19
19
|
const curSchemaType = curSchema.path(curPath);
|
|
20
|
-
if (curSchemaType
|
|
20
|
+
if (curSchemaType?.schema) {
|
|
21
21
|
let newSubdoc = subdoc.get(curPath);
|
|
22
22
|
curSchema = curSchemaType.schema;
|
|
23
23
|
curPath = parts[i + 1];
|
package/.output/server/node_modules/mongoose/lib/helpers/document/getEmbeddedDiscriminatorPath.js
CHANGED
|
@@ -8,8 +8,8 @@ const getSchemaDiscriminatorByValue = require('../discriminator/getSchemaDiscrim
|
|
|
8
8
|
* determine path type without knowing the embedded discriminator key.
|
|
9
9
|
*
|
|
10
10
|
* @param {Document} doc
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
11
|
+
* @param {string|string[]} path
|
|
12
|
+
* @param {object} [options]
|
|
13
13
|
* @api private
|
|
14
14
|
*/
|
|
15
15
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns true if `path` is included by the `pathsToSave` filter.
|
|
5
|
+
* Matches exact paths and child paths (e.g. 'metadata.views' is included by 'metadata').
|
|
6
|
+
*
|
|
7
|
+
* @param {string} path
|
|
8
|
+
* @param {Set<string>} pathsToSaveSet - pre-built Set of pathsToSave for O(1) exact lookup
|
|
9
|
+
* @param {string[]} pathsToSave - original array, used for prefix matching
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
module.exports = function isInPathsToSave(path, pathsToSaveSet, pathsToSave) {
|
|
13
|
+
if (pathsToSaveSet.has(path)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
for (const pathToSave of pathsToSave) {
|
|
18
|
+
if (path.slice(0, pathToSave.length) === pathToSave && path.charAt(pathToSave.length) === '.') {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
@@ -4,7 +4,7 @@ module.exports = function decorateDiscriminatorIndexOptions(schema, indexOptions
|
|
|
4
4
|
// If the model is a discriminator and has an index, add a
|
|
5
5
|
// partialFilterExpression by default so the index will only apply
|
|
6
6
|
// to that discriminator.
|
|
7
|
-
const discriminatorName = schema.discriminatorMapping
|
|
7
|
+
const discriminatorName = schema.discriminatorMapping?.value;
|
|
8
8
|
if (discriminatorName && !('sparse' in indexOptions)) {
|
|
9
9
|
const discriminatorKey = schema.options.discriminatorKey;
|
|
10
10
|
indexOptions.partialFilterExpression = indexOptions.partialFilterExpression || {};
|
|
@@ -31,8 +31,8 @@ function getRelatedIndexes({
|
|
|
31
31
|
indexes,
|
|
32
32
|
indexesType
|
|
33
33
|
}) {
|
|
34
|
-
const discriminatorKey = discriminatorMapping
|
|
35
|
-
const discriminatorValue = discriminatorMapping
|
|
34
|
+
const discriminatorKey = discriminatorMapping?.key;
|
|
35
|
+
const discriminatorValue = discriminatorMapping?.value;
|
|
36
36
|
|
|
37
37
|
if (!discriminatorKey) {
|
|
38
38
|
return indexes;
|
|
@@ -57,7 +57,7 @@ function getRelatedIndexes({
|
|
|
57
57
|
function getPartialFilterExpression(index, indexesType) {
|
|
58
58
|
if (indexesType === 'schema') {
|
|
59
59
|
const options = index[1];
|
|
60
|
-
return options
|
|
60
|
+
return options?.partialFilterExpression;
|
|
61
61
|
}
|
|
62
62
|
return index.partialFilterExpression;
|
|
63
63
|
}
|
|
@@ -6,9 +6,9 @@ const utils = require('../../utils');
|
|
|
6
6
|
* Given a Mongoose index definition (key + options objects) and a MongoDB server
|
|
7
7
|
* index definition, determine if the two indexes are equal.
|
|
8
8
|
*
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
9
|
+
* @param {object} schemaIndexKeysObject the Mongoose index spec
|
|
10
|
+
* @param {object} options the Mongoose index definition's options
|
|
11
|
+
* @param {object} dbIndex the index in MongoDB as returned by `listIndexes()`
|
|
12
12
|
* @api private
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -20,7 +20,6 @@ module.exports = function isIndexEqual(schemaIndexKeysObject, options, dbIndex)
|
|
|
20
20
|
// key: { _fts: 'text', _ftsx: 1 },
|
|
21
21
|
// name: 'name_text',
|
|
22
22
|
// ns: 'test.tests',
|
|
23
|
-
// background: true,
|
|
24
23
|
// weights: { name: 1 },
|
|
25
24
|
// default_language: 'english',
|
|
26
25
|
// language_override: 'language',
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* isIndexSpecEqual({ a: 1, b: 1 }, { b: 1, a: 1 }); // false
|
|
9
9
|
* isIndexSpecEqual({ a: 1, b: -1 }, { a: 1, b: 1 }); // false
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
13
|
-
* @returns {
|
|
11
|
+
* @param {object} spec1 The first index specification to compare.
|
|
12
|
+
* @param {object} spec2 The second index specification to compare.
|
|
13
|
+
* @returns {boolean} Returns true if the index specifications are equal, otherwise returns false.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
module.exports = function isIndexSpecEqual(spec1, spec2) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Determines if `arg` is an object.
|
|
5
5
|
*
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {object|Array|string|Function|RegExp|any} arg
|
|
7
7
|
* @api private
|
|
8
|
-
* @return {
|
|
8
|
+
* @return {boolean}
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
module.exports = function(arg) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Determines if `arg` is a flat object.
|
|
5
5
|
*
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {object|Array|string|Function|RegExp|any} arg
|
|
7
7
|
* @api private
|
|
8
|
-
* @return {
|
|
8
|
+
* @return {boolean}
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
module.exports = function isSimpleValidator(obj) {
|
|
@@ -7,8 +7,8 @@ module.exports = minimize;
|
|
|
7
7
|
/**
|
|
8
8
|
* Minimizes an object, removing undefined values and empty objects
|
|
9
9
|
*
|
|
10
|
-
* @param {
|
|
11
|
-
* @return {
|
|
10
|
+
* @param {object} object to minimize
|
|
11
|
+
* @return {object|undefined}
|
|
12
12
|
* @api private
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -23,7 +23,7 @@ module.exports = function applyDefaultsToPOJO(doc, schema) {
|
|
|
23
23
|
if (j === len - 1) {
|
|
24
24
|
if (typeof doc_[piece] !== 'undefined') {
|
|
25
25
|
if (type.$isSingleNested) {
|
|
26
|
-
applyDefaultsToPOJO(doc_[piece], type.
|
|
26
|
+
applyDefaultsToPOJO(doc_[piece], type.schema);
|
|
27
27
|
} else if (type.$isMongooseDocumentArray && Array.isArray(doc_[piece])) {
|
|
28
28
|
doc_[piece].forEach(el => applyDefaultsToPOJO(el, type.schema));
|
|
29
29
|
}
|
|
@@ -36,7 +36,7 @@ module.exports = function applyDefaultsToPOJO(doc, schema) {
|
|
|
36
36
|
doc_[piece] = def;
|
|
37
37
|
|
|
38
38
|
if (type.$isSingleNested) {
|
|
39
|
-
applyDefaultsToPOJO(def, type.
|
|
39
|
+
applyDefaultsToPOJO(def, type.schema);
|
|
40
40
|
} else if (type.$isMongooseDocumentArray && Array.isArray(def)) {
|
|
41
41
|
def.forEach(el => applyDefaultsToPOJO(el, type.schema));
|
|
42
42
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const promiseOrCallback = require('../promiseOrCallback');
|
|
3
|
+
const { buildMiddlewareFilter } = require('../buildMiddlewareFilter');
|
|
5
4
|
|
|
6
5
|
/*!
|
|
7
6
|
* ignore
|
|
@@ -15,10 +14,10 @@ module.exports = applyHooks;
|
|
|
15
14
|
|
|
16
15
|
applyHooks.middlewareFunctions = [
|
|
17
16
|
'deleteOne',
|
|
18
|
-
'save',
|
|
19
|
-
'validate',
|
|
20
17
|
'remove',
|
|
18
|
+
'save',
|
|
21
19
|
'updateOne',
|
|
20
|
+
'validate',
|
|
22
21
|
'init'
|
|
23
22
|
];
|
|
24
23
|
|
|
@@ -33,7 +32,7 @@ const alreadyHookedFunctions = new Set(applyHooks.middlewareFunctions.flatMap(fn
|
|
|
33
32
|
*
|
|
34
33
|
* @param {Model} model
|
|
35
34
|
* @param {Schema} schema
|
|
36
|
-
* @param {
|
|
35
|
+
* @param {object} options
|
|
37
36
|
* @api private
|
|
38
37
|
*/
|
|
39
38
|
|
|
@@ -47,15 +46,15 @@ function applyHooks(model, schema, options) {
|
|
|
47
46
|
contextParameter: true
|
|
48
47
|
};
|
|
49
48
|
const objToDecorate = options.decorateDoc ? model : model.prototype;
|
|
50
|
-
|
|
51
49
|
model.$appliedHooks = true;
|
|
52
50
|
for (const key of Object.keys(schema.paths)) {
|
|
53
|
-
|
|
51
|
+
let type = schema.paths[key];
|
|
54
52
|
let childModel = null;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
childModel =
|
|
53
|
+
|
|
54
|
+
const result = findChildModel(type);
|
|
55
|
+
if (result) {
|
|
56
|
+
childModel = result.childModel;
|
|
57
|
+
type = result.type;
|
|
59
58
|
} else {
|
|
60
59
|
continue;
|
|
61
60
|
}
|
|
@@ -64,7 +63,11 @@ function applyHooks(model, schema, options) {
|
|
|
64
63
|
continue;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
applyHooks(childModel, type.schema, {
|
|
66
|
+
applyHooks(childModel, type.schema, {
|
|
67
|
+
...options,
|
|
68
|
+
decorateDoc: false,
|
|
69
|
+
isChildSchema: true
|
|
70
|
+
});
|
|
68
71
|
if (childModel.discriminators != null) {
|
|
69
72
|
const keys = Object.keys(childModel.discriminators);
|
|
70
73
|
for (const key of keys) {
|
|
@@ -78,41 +81,21 @@ function applyHooks(model, schema, options) {
|
|
|
78
81
|
// promises and make it so that `doc.save.toString()` provides meaningful
|
|
79
82
|
// information.
|
|
80
83
|
|
|
81
|
-
const middleware = schema.
|
|
82
|
-
filter(hook => {
|
|
83
|
-
if (hook.name === 'updateOne' || hook.name === 'deleteOne') {
|
|
84
|
-
return !!hook['document'];
|
|
85
|
-
}
|
|
86
|
-
if (hook.name === 'remove' || hook.name === 'init') {
|
|
87
|
-
return hook['document'] == null || !!hook['document'];
|
|
88
|
-
}
|
|
89
|
-
if (hook.query != null || hook.document != null) {
|
|
90
|
-
return hook.document !== false;
|
|
91
|
-
}
|
|
92
|
-
return true;
|
|
93
|
-
}).
|
|
94
|
-
filter(hook => {
|
|
95
|
-
// If user has overwritten the method, don't apply built-in middleware
|
|
96
|
-
if (schema.methods[hook.name]) {
|
|
97
|
-
return !hook.fn[symbols.builtInMiddleware];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return true;
|
|
101
|
-
});
|
|
84
|
+
const middleware = schema._getDocumentMiddleware();
|
|
102
85
|
|
|
103
86
|
model._middleware = middleware;
|
|
104
87
|
|
|
105
|
-
objToDecorate.$__originalValidate = objToDecorate.$__originalValidate || objToDecorate.$__validate;
|
|
106
|
-
|
|
107
|
-
const internalMethodsToWrap = options && options.isChildSchema ? ['save', 'validate', 'deleteOne'] : ['save', 'validate'];
|
|
108
|
-
for (const method of internalMethodsToWrap) {
|
|
109
|
-
const toWrap = method === 'validate' ? '$__originalValidate' : `$__${method}`;
|
|
110
|
-
const wrapped = middleware.
|
|
111
|
-
createWrapper(method, objToDecorate[toWrap], null, kareemOptions);
|
|
112
|
-
objToDecorate[`$__${method}`] = wrapped;
|
|
113
|
-
}
|
|
114
88
|
objToDecorate.$__init = middleware.
|
|
115
|
-
createWrapperSync('init', objToDecorate.$__init, null,
|
|
89
|
+
createWrapperSync('init', objToDecorate.$__init, null, {
|
|
90
|
+
...kareemOptions,
|
|
91
|
+
getOptions: (args) => {
|
|
92
|
+
const opts = args[1];
|
|
93
|
+
return {
|
|
94
|
+
pre: { filter: buildMiddlewareFilter(opts, 'pre') },
|
|
95
|
+
post: { filter: buildMiddlewareFilter(opts, 'post') }
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
116
99
|
|
|
117
100
|
// Support hooks for custom methods
|
|
118
101
|
const customMethods = Object.keys(schema.methods);
|
|
@@ -134,17 +117,35 @@ function applyHooks(model, schema, options) {
|
|
|
134
117
|
continue;
|
|
135
118
|
}
|
|
136
119
|
const originalMethod = objToDecorate[method];
|
|
137
|
-
objToDecorate[method] =
|
|
138
|
-
|
|
139
|
-
const cb = args.slice(-1).pop();
|
|
140
|
-
const argsWithoutCallback = typeof cb === 'function' ?
|
|
141
|
-
args.slice(0, args.length - 1) : args;
|
|
142
|
-
return promiseOrCallback(cb, callback => {
|
|
143
|
-
return this[`$__${method}`].apply(this,
|
|
144
|
-
argsWithoutCallback.concat([callback]));
|
|
145
|
-
}, model.events);
|
|
146
|
-
};
|
|
147
|
-
objToDecorate[`$__${method}`] = middleware.
|
|
120
|
+
objToDecorate[`$__${method}`] = objToDecorate[method];
|
|
121
|
+
objToDecorate[method] = middleware.
|
|
148
122
|
createWrapper(method, originalMethod, null, customMethodOptions);
|
|
149
123
|
}
|
|
150
124
|
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Check if there is an embedded schematype in the given schematype. Handles drilling down into primitive
|
|
128
|
+
* arrays and maps in case of array of array of subdocs or map of subdocs.
|
|
129
|
+
*
|
|
130
|
+
* @param {SchemaType} curType
|
|
131
|
+
* @returns {{ childModel: Model | typeof Subdocument, curType: SchemaType } | null}
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
function findChildModel(curType) {
|
|
135
|
+
if (curType.$isSingleNested || curType.$isMongooseDocumentArray) {
|
|
136
|
+
return { childModel: curType.Constructor, type: curType };
|
|
137
|
+
}
|
|
138
|
+
if (curType.instance === 'Array') {
|
|
139
|
+
const embedded = curType.getEmbeddedSchemaType();
|
|
140
|
+
if (embedded) {
|
|
141
|
+
return findChildModel(embedded);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (curType.instance === 'Map') {
|
|
145
|
+
const mapType = curType.getEmbeddedSchemaType();
|
|
146
|
+
if (mapType) {
|
|
147
|
+
return findChildModel(mapType);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
@@ -60,8 +60,8 @@ module.exports = function applyMethods(model, schema) {
|
|
|
60
60
|
model.$appliedMethods = true;
|
|
61
61
|
for (const key of Object.keys(schema.paths)) {
|
|
62
62
|
const type = schema.paths[key];
|
|
63
|
-
if (type.$isSingleNested && !type.
|
|
64
|
-
applyMethods(type.
|
|
63
|
+
if (type.$isSingleNested && !type.Constructor.$appliedMethods) {
|
|
64
|
+
applyMethods(type.Constructor, type.schema);
|
|
65
65
|
}
|
|
66
66
|
if (type.$isMongooseDocumentArray && !type.Constructor.$appliedMethods) {
|
|
67
67
|
applyMethods(type.Constructor, type.schema);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const promiseOrCallback = require('../promiseOrCallback');
|
|
4
3
|
const { queryMiddlewareFunctions, aggregateMiddlewareFunctions, modelMiddlewareFunctions, documentMiddlewareFunctions } = require('../../constants');
|
|
5
4
|
|
|
6
5
|
const middlewareFunctions = Array.from(
|
|
@@ -13,14 +12,6 @@ const middlewareFunctions = Array.from(
|
|
|
13
12
|
);
|
|
14
13
|
|
|
15
14
|
module.exports = function applyStaticHooks(model, hooks, statics) {
|
|
16
|
-
const kareemOptions = {
|
|
17
|
-
useErrorHandlers: true,
|
|
18
|
-
numCallbackParams: 1
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
model.$__insertMany = hooks.createWrapper('insertMany',
|
|
22
|
-
model.$__insertMany, model, kareemOptions);
|
|
23
|
-
|
|
24
15
|
hooks = hooks.filter(hook => {
|
|
25
16
|
// If the custom static overwrites an existing middleware, don't apply
|
|
26
17
|
// middleware to it by default. This avoids a potential backwards breaking
|
|
@@ -36,45 +27,7 @@ module.exports = function applyStaticHooks(model, hooks, statics) {
|
|
|
36
27
|
if (hooks.hasHooks(key)) {
|
|
37
28
|
const original = model[key];
|
|
38
29
|
|
|
39
|
-
model[key] =
|
|
40
|
-
const numArgs = arguments.length;
|
|
41
|
-
const lastArg = numArgs > 0 ? arguments[numArgs - 1] : null;
|
|
42
|
-
const cb = typeof lastArg === 'function' ? lastArg : null;
|
|
43
|
-
const args = Array.prototype.slice.
|
|
44
|
-
call(arguments, 0, cb == null ? numArgs : numArgs - 1);
|
|
45
|
-
// Special case: can't use `Kareem#wrap()` because it doesn't currently
|
|
46
|
-
// support wrapped functions that return a promise.
|
|
47
|
-
return promiseOrCallback(cb, callback => {
|
|
48
|
-
hooks.execPre(key, model, args, function(err) {
|
|
49
|
-
if (err != null) {
|
|
50
|
-
return callback(err);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let postCalled = 0;
|
|
54
|
-
const ret = original.apply(model, args.concat(post));
|
|
55
|
-
if (ret != null && typeof ret.then === 'function') {
|
|
56
|
-
ret.then(res => post(null, res), err => post(err));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function post(error, res) {
|
|
60
|
-
if (postCalled++ > 0) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (error != null) {
|
|
65
|
-
return callback(error);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
hooks.execPost(key, model, [res], function(error) {
|
|
69
|
-
if (error != null) {
|
|
70
|
-
return callback(error);
|
|
71
|
-
}
|
|
72
|
-
callback(null, res);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}, model.events);
|
|
77
|
-
};
|
|
30
|
+
model[key] = hooks.createWrapper(key, original);
|
|
78
31
|
}
|
|
79
32
|
}
|
|
80
33
|
};
|
|
@@ -15,8 +15,8 @@ const setDefaultsOnInsert = require('../setDefaultsOnInsert');
|
|
|
15
15
|
* Given a model and a bulkWrite op, return a thunk that handles casting and
|
|
16
16
|
* validating the individual op.
|
|
17
17
|
* @param {Model} originalModel
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
18
|
+
* @param {object} op
|
|
19
|
+
* @param {object} [options]
|
|
20
20
|
* @api private
|
|
21
21
|
*/
|
|
22
22
|
|
|
@@ -113,7 +113,7 @@ module.exports.castUpdateOne = function castUpdateOne(originalModel, updateOne,
|
|
|
113
113
|
|
|
114
114
|
const model = decideModelByObject(originalModel, updateOne['filter']);
|
|
115
115
|
const schema = model.schema;
|
|
116
|
-
const strict = options.strict
|
|
116
|
+
const strict = options.strict ?? model.schema.options.strict;
|
|
117
117
|
|
|
118
118
|
const update = clone(updateOne['update']);
|
|
119
119
|
|
|
@@ -135,9 +135,7 @@ module.exports.castUpdateOne = function castUpdateOne(originalModel, updateOne,
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
const globalSetDefaultsOnInsert = originalModel.base.options.setDefaultsOnInsert;
|
|
138
|
-
const shouldSetDefaultsOnInsert = updateOne.setDefaultsOnInsert
|
|
139
|
-
globalSetDefaultsOnInsert :
|
|
140
|
-
updateOne.setDefaultsOnInsert;
|
|
138
|
+
const shouldSetDefaultsOnInsert = updateOne.setDefaultsOnInsert ?? globalSetDefaultsOnInsert;
|
|
141
139
|
if (shouldSetDefaultsOnInsert !== false) {
|
|
142
140
|
setDefaultsOnInsert(updateOne['filter'], model.schema, update, {
|
|
143
141
|
setDefaultsOnInsert: true,
|
|
@@ -176,12 +174,10 @@ module.exports.castUpdateMany = function castUpdateMany(originalModel, updateMan
|
|
|
176
174
|
|
|
177
175
|
const model = decideModelByObject(originalModel, updateMany['filter']);
|
|
178
176
|
const schema = model.schema;
|
|
179
|
-
const strict = options.strict
|
|
177
|
+
const strict = options.strict ?? model.schema.options.strict;
|
|
180
178
|
|
|
181
179
|
const globalSetDefaultsOnInsert = originalModel.base.options.setDefaultsOnInsert;
|
|
182
|
-
const shouldSetDefaultsOnInsert = updateMany.setDefaultsOnInsert
|
|
183
|
-
globalSetDefaultsOnInsert :
|
|
184
|
-
updateMany.setDefaultsOnInsert;
|
|
180
|
+
const shouldSetDefaultsOnInsert = updateMany.setDefaultsOnInsert ?? globalSetDefaultsOnInsert;
|
|
185
181
|
|
|
186
182
|
if (shouldSetDefaultsOnInsert !== false) {
|
|
187
183
|
setDefaultsOnInsert(updateMany['filter'], model.schema, updateMany['update'], {
|
|
@@ -229,7 +225,7 @@ module.exports.castUpdateMany = function castUpdateMany(originalModel, updateMan
|
|
|
229
225
|
module.exports.castReplaceOne = async function castReplaceOne(originalModel, replaceOne, options) {
|
|
230
226
|
const model = decideModelByObject(originalModel, replaceOne['filter']);
|
|
231
227
|
const schema = model.schema;
|
|
232
|
-
const strict = options.strict
|
|
228
|
+
const strict = options.strict ?? model.schema.options.strict;
|
|
233
229
|
|
|
234
230
|
_addDiscriminatorToObject(schema, replaceOne['filter']);
|
|
235
231
|
replaceOne['filter'] = cast(model.schema, replaceOne['filter'], {
|
|
@@ -238,7 +234,7 @@ module.exports.castReplaceOne = async function castReplaceOne(originalModel, rep
|
|
|
238
234
|
});
|
|
239
235
|
|
|
240
236
|
// set `skipId`, otherwise we get "_id field cannot be changed"
|
|
241
|
-
const doc = new model(replaceOne['replacement'], strict, true);
|
|
237
|
+
const doc = new model(replaceOne['replacement'], strict, { skipId: true });
|
|
242
238
|
if (model.schema.options.timestamps && getTimestampsOpt(replaceOne, options)) {
|
|
243
239
|
doc.initializeTimestamps();
|
|
244
240
|
}
|
|
@@ -68,7 +68,7 @@ function validateDiscriminatorSchemasForEncryption(parentSchema, childSchema) {
|
|
|
68
68
|
*/
|
|
69
69
|
|
|
70
70
|
module.exports = function discriminator(model, name, schema, tiedValue, applyPlugins, mergeHooks, overwriteExisting) {
|
|
71
|
-
if (!
|
|
71
|
+
if (!schema?.instanceOfSchema) {
|
|
72
72
|
throw new Error('You must pass a valid discriminator Schema');
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -6,50 +6,32 @@ module.exports = parallelLimit;
|
|
|
6
6
|
* ignore
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
function parallelLimit(
|
|
10
|
-
let numInProgress = 0;
|
|
11
|
-
let numFinished = 0;
|
|
12
|
-
let error = null;
|
|
13
|
-
|
|
9
|
+
async function parallelLimit(params, fn, limit) {
|
|
14
10
|
if (limit <= 0) {
|
|
15
11
|
throw new Error('Limit must be positive');
|
|
16
12
|
}
|
|
17
13
|
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
14
|
+
if (params.length === 0) {
|
|
15
|
+
return [];
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
18
|
+
const results = [];
|
|
19
|
+
const executing = new Set();
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
for (let index = 0; index < params.length; index++) {
|
|
22
|
+
const param = params[index];
|
|
23
|
+
const p = fn(param, index);
|
|
24
|
+
results.push(p);
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
executing.add(p);
|
|
27
|
+
|
|
28
|
+
const clean = () => executing.delete(p);
|
|
29
|
+
p.then(clean).catch(clean);
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
++numFinished;
|
|
37
|
-
|
|
38
|
-
if (error != null) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (err != null) {
|
|
42
|
-
error = err;
|
|
43
|
-
return callback(error);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
results[index] = res;
|
|
47
|
-
|
|
48
|
-
if (numFinished === fns.length) {
|
|
49
|
-
return callback(null, results);
|
|
50
|
-
} else if (numFinished + numInProgress < fns.length) {
|
|
51
|
-
_start();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
31
|
+
if (executing.size >= limit) {
|
|
32
|
+
await Promise.race(executing);
|
|
33
|
+
}
|
|
54
34
|
}
|
|
35
|
+
|
|
36
|
+
return Promise.all(results);
|
|
55
37
|
}
|
|
@@ -8,13 +8,13 @@ module.exports = pluralize;
|
|
|
8
8
|
|
|
9
9
|
exports.pluralization = [
|
|
10
10
|
[/human$/gi, 'humans'],
|
|
11
|
-
[/(m)an$/gi, '$1en'],
|
|
11
|
+
[/(m|wom)an$/gi, '$1en'],
|
|
12
12
|
[/(pe)rson$/gi, '$1ople'],
|
|
13
13
|
[/(child)$/gi, '$1ren'],
|
|
14
14
|
[/^(ox)$/gi, '$1en'],
|
|
15
15
|
[/(ax|test)is$/gi, '$1es'],
|
|
16
|
-
[/(octop|
|
|
17
|
-
[/(alias|status)$/gi, '$1es'],
|
|
16
|
+
[/(octop|cact|foc|fung|nucle)us$/gi, '$1i'],
|
|
17
|
+
[/(alias|status|virus)$/gi, '$1es'],
|
|
18
18
|
[/(bu)s$/gi, '$1ses'],
|
|
19
19
|
[/(buffal|tomat|potat)o$/gi, '$1oes'],
|
|
20
20
|
[/([ti])um$/gi, '$1a'],
|
|
@@ -76,7 +76,7 @@ const uncountables = exports.uncountables;
|
|
|
76
76
|
* Pluralize function.
|
|
77
77
|
*
|
|
78
78
|
* @author TJ Holowaychuk (extracted from _ext.js_)
|
|
79
|
-
* @param {
|
|
79
|
+
* @param {string} string to pluralize
|
|
80
80
|
* @api private
|
|
81
81
|
*/
|
|
82
82
|
|
package/.output/server/node_modules/mongoose/lib/helpers/populate/assignRawDocsToIdStructure.js
CHANGED
|
@@ -26,8 +26,8 @@ const kHasArray = Symbol('mongoose#assignRawDocsToIdStructure#hasArray');
|
|
|
26
26
|
* @param {Array} rawIds
|
|
27
27
|
* @param {Array} resultDocs
|
|
28
28
|
* @param {Array} resultOrder
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
29
|
+
* @param {object} options
|
|
30
|
+
* @param {boolean} recursed
|
|
31
31
|
* @api private
|
|
32
32
|
*/
|
|
33
33
|
|
|
@@ -78,14 +78,7 @@ function assignRawDocsToIdStructure(rawIds, resultDocs, resultOrder, options, re
|
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
// Workaround for gh-15315 because Mongoose UUIDs don't use BSON UUIDs yet.
|
|
83
|
-
sid = String(id.toUUID());
|
|
84
|
-
} else if (id?.constructor?.name === 'Buffer' && id._subtype === 4 && typeof id.toUUID === 'function') {
|
|
85
|
-
sid = String(id.toUUID());
|
|
86
|
-
} else {
|
|
87
|
-
sid = String(id);
|
|
88
|
-
}
|
|
81
|
+
sid = String(id);
|
|
89
82
|
doc = resultDocs[sid];
|
|
90
83
|
// If user wants separate copies of same doc, use this option
|
|
91
84
|
if (options.clone && doc != null) {
|
|
@@ -111,7 +104,7 @@ function assignRawDocsToIdStructure(rawIds, resultDocs, resultOrder, options, re
|
|
|
111
104
|
} else {
|
|
112
105
|
newOrder.push(doc);
|
|
113
106
|
}
|
|
114
|
-
} else if (id
|
|
107
|
+
} else if (id?.[modelSymbol] != null) {
|
|
115
108
|
newOrder.push(id);
|
|
116
109
|
} else {
|
|
117
110
|
newOrder.push(options.retainNullValues || nullIfNotFound ? null : id);
|