@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
|
@@ -10,7 +10,6 @@ const get_more_1 = require("../operations/get_more");
|
|
|
10
10
|
const kill_cursors_1 = require("../operations/kill_cursors");
|
|
11
11
|
const read_concern_1 = require("../read_concern");
|
|
12
12
|
const read_preference_1 = require("../read_preference");
|
|
13
|
-
const resource_management_1 = require("../resource_management");
|
|
14
13
|
const sessions_1 = require("../sessions");
|
|
15
14
|
const timeout_1 = require("../timeout");
|
|
16
15
|
const utils_1 = require("../utils");
|
|
@@ -61,6 +60,8 @@ exports.CursorTimeoutMode = Object.freeze({
|
|
|
61
60
|
});
|
|
62
61
|
/** @public */
|
|
63
62
|
class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
63
|
+
/** @event */
|
|
64
|
+
static { this.CLOSE = 'close'; }
|
|
64
65
|
/** @internal */
|
|
65
66
|
constructor(client, namespace, options = {}) {
|
|
66
67
|
super();
|
|
@@ -204,8 +205,11 @@ class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
|
204
205
|
get loadBalanced() {
|
|
205
206
|
return !!this.cursorClient.topology?.loadBalanced;
|
|
206
207
|
}
|
|
207
|
-
/**
|
|
208
|
-
|
|
208
|
+
/**
|
|
209
|
+
* @experimental
|
|
210
|
+
* An alias for {@link AbstractCursor.close|AbstractCursor.close()}.
|
|
211
|
+
*/
|
|
212
|
+
async [Symbol.asyncDispose]() {
|
|
209
213
|
await this.close();
|
|
210
214
|
}
|
|
211
215
|
/** Adds cursor to client's tracking so it will be closed by MongoClient.close() */
|
|
@@ -269,7 +273,7 @@ class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
|
269
273
|
}
|
|
270
274
|
}
|
|
271
275
|
}
|
|
272
|
-
stream(
|
|
276
|
+
stream() {
|
|
273
277
|
const readable = new ReadableCursorStream(this);
|
|
274
278
|
const abortListener = (0, utils_1.addAbortListener)(this.signal, function () {
|
|
275
279
|
readable.destroy(this.reason);
|
|
@@ -277,26 +281,6 @@ class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
|
277
281
|
readable.once('end', () => {
|
|
278
282
|
abortListener?.[utils_1.kDispose]();
|
|
279
283
|
});
|
|
280
|
-
if (options?.transform) {
|
|
281
|
-
const transform = options.transform;
|
|
282
|
-
const transformedStream = readable.pipe(new stream_1.Transform({
|
|
283
|
-
objectMode: true,
|
|
284
|
-
highWaterMark: 1,
|
|
285
|
-
transform(chunk, _, callback) {
|
|
286
|
-
try {
|
|
287
|
-
const transformed = transform(chunk);
|
|
288
|
-
callback(undefined, transformed);
|
|
289
|
-
}
|
|
290
|
-
catch (err) {
|
|
291
|
-
callback(err);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}));
|
|
295
|
-
// Bubble errors to transformed stream, because otherwise no way
|
|
296
|
-
// to handle this error.
|
|
297
|
-
readable.on('error', err => transformedStream.emit('error', err));
|
|
298
|
-
return transformedStream;
|
|
299
|
-
}
|
|
300
284
|
return readable;
|
|
301
285
|
}
|
|
302
286
|
async hasNext() {
|
|
@@ -428,7 +412,11 @@ class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
|
428
412
|
}
|
|
429
413
|
}
|
|
430
414
|
else {
|
|
431
|
-
array.push(...
|
|
415
|
+
// Note: previous versions of this logic used `array.push(...)`, which adds each item
|
|
416
|
+
// to the callstack. For large arrays, this can exceed the maximum call size.
|
|
417
|
+
for (const doc of docs) {
|
|
418
|
+
array.push(doc);
|
|
419
|
+
}
|
|
432
420
|
}
|
|
433
421
|
}
|
|
434
422
|
return array;
|
|
@@ -595,7 +583,7 @@ class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
|
595
583
|
}
|
|
596
584
|
}
|
|
597
585
|
/** @internal */
|
|
598
|
-
async getMore(
|
|
586
|
+
async getMore() {
|
|
599
587
|
if (this.cursorId == null) {
|
|
600
588
|
throw new error_1.MongoRuntimeError('Unexpected null cursor id. A cursor creating command should have set this');
|
|
601
589
|
}
|
|
@@ -608,7 +596,7 @@ class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
|
608
596
|
const getMoreOptions = {
|
|
609
597
|
...this.cursorOptions,
|
|
610
598
|
session: this.cursorSession,
|
|
611
|
-
batchSize
|
|
599
|
+
batchSize: this.cursorOptions.batchSize
|
|
612
600
|
};
|
|
613
601
|
const getMoreOperation = new get_more_1.GetMoreOperation(this.cursorNamespace, this.cursorId, this.selectedServer, getMoreOptions);
|
|
614
602
|
return await (0, execute_operation_1.executeOperation)(this.cursorClient, getMoreOperation, this.timeoutContext);
|
|
@@ -667,12 +655,10 @@ class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
|
667
655
|
// If the cursor died or returned documents, return
|
|
668
656
|
if ((this.documents?.length ?? 0) !== 0 || this.isDead)
|
|
669
657
|
return;
|
|
670
|
-
// Otherwise, run a getMore
|
|
671
658
|
}
|
|
672
|
-
//
|
|
673
|
-
const batchSize = this.cursorOptions.batchSize || 1000;
|
|
659
|
+
// Otherwise, run a getMore
|
|
674
660
|
try {
|
|
675
|
-
const response = await this.getMore(
|
|
661
|
+
const response = await this.getMore();
|
|
676
662
|
this.cursorId = response.id;
|
|
677
663
|
this.documents = response;
|
|
678
664
|
}
|
|
@@ -800,8 +786,6 @@ class AbstractCursor extends mongo_types_1.TypedEventEmitter {
|
|
|
800
786
|
}
|
|
801
787
|
}
|
|
802
788
|
exports.AbstractCursor = AbstractCursor;
|
|
803
|
-
/** @event */
|
|
804
|
-
AbstractCursor.CLOSE = 'close';
|
|
805
789
|
class ReadableCursorStream extends stream_1.Readable {
|
|
806
790
|
constructor(cursor) {
|
|
807
791
|
super({
|
|
@@ -880,7 +864,6 @@ class ReadableCursorStream extends stream_1.Readable {
|
|
|
880
864
|
});
|
|
881
865
|
}
|
|
882
866
|
}
|
|
883
|
-
(0, resource_management_1.configureResourceManagement)(AbstractCursor.prototype);
|
|
884
867
|
/**
|
|
885
868
|
* @internal
|
|
886
869
|
* The cursor timeout context is a wrapper around a timeout context
|
|
@@ -91,8 +91,8 @@ class ChangeStreamCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
91
91
|
this.emit(constants_1.RESPONSE);
|
|
92
92
|
return { server, session, response };
|
|
93
93
|
}
|
|
94
|
-
async getMore(
|
|
95
|
-
const response = await super.getMore(
|
|
94
|
+
async getMore() {
|
|
95
|
+
const response = await super.getMore();
|
|
96
96
|
this.maxWireVersion = (0, utils_1.maxWireVersion)(this.server);
|
|
97
97
|
this._processBatch(response);
|
|
98
98
|
this.emit(change_stream_1.ChangeStream.MORE, response);
|
|
@@ -65,35 +65,46 @@ class FindCursor extends explainable_cursor_1.ExplainableCursor {
|
|
|
65
65
|
return { server: findOperation.server, session, response };
|
|
66
66
|
}
|
|
67
67
|
/** @internal */
|
|
68
|
-
async getMore(
|
|
68
|
+
async getMore() {
|
|
69
69
|
const numReturned = this.numReturned;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// is exhausted and return a cursorId of zero.
|
|
87
|
-
// instead, if we determine there are no more documents to request from the server, we preemptively
|
|
88
|
-
// close the cursor
|
|
89
|
-
}
|
|
90
|
-
return responses_1.CursorResponse.emptyGetMore;
|
|
70
|
+
const limit = this.findOptions.limit ?? Infinity;
|
|
71
|
+
const remaining = limit - numReturned;
|
|
72
|
+
if (numReturned === limit && !this.id?.isZero()) {
|
|
73
|
+
// this is an optimization for the special case of a limit for a find command to avoid an
|
|
74
|
+
// extra getMore when the limit has been reached and the limit is a multiple of the batchSize.
|
|
75
|
+
// This is a consequence of the new query engine in 5.0 having no knowledge of the limit as it
|
|
76
|
+
// produces results for the find command. Once a batch is filled up, it is returned and only
|
|
77
|
+
// on the subsequent getMore will the query framework consider the limit, determine the cursor
|
|
78
|
+
// is exhausted and return a cursorId of zero.
|
|
79
|
+
// instead, if we determine there are no more documents to request from the server, we preemptively
|
|
80
|
+
// close the cursor
|
|
81
|
+
try {
|
|
82
|
+
await this.close();
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
(0, utils_1.squashError)(error);
|
|
91
86
|
}
|
|
87
|
+
return responses_1.CursorResponse.emptyGetMore;
|
|
88
|
+
}
|
|
89
|
+
// TODO(DRIVERS-1448): Remove logic to enforce `limit` in the driver
|
|
90
|
+
let cleanup = utils_1.noop;
|
|
91
|
+
const { batchSize } = this.cursorOptions;
|
|
92
|
+
if (batchSize != null && batchSize > remaining) {
|
|
93
|
+
this.cursorOptions.batchSize = remaining;
|
|
94
|
+
// After executing the final getMore, re-assign the batchSize back to its original value so that
|
|
95
|
+
// if the cursor is rewound and executed, the batchSize is still correct.
|
|
96
|
+
cleanup = () => {
|
|
97
|
+
this.cursorOptions.batchSize = batchSize;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const response = await super.getMore();
|
|
102
|
+
this.numReturned = this.numReturned + response.batchSize;
|
|
103
|
+
return response;
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
cleanup?.();
|
|
92
107
|
}
|
|
93
|
-
const response = await super.getMore(batchSize);
|
|
94
|
-
// TODO: wrap this in some logic to prevent it from happening if we don't need this support
|
|
95
|
-
this.numReturned = this.numReturned + response.batchSize;
|
|
96
|
-
return response;
|
|
97
108
|
}
|
|
98
109
|
/**
|
|
99
110
|
* Get the count of documents for this cursor
|
|
@@ -77,7 +77,7 @@ class RunCommandCursor extends abstract_cursor_1.AbstractCursor {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
/** @internal */
|
|
80
|
-
async getMore(
|
|
80
|
+
async getMore() {
|
|
81
81
|
if (!this.session) {
|
|
82
82
|
throw new error_1.MongoRuntimeError('Unexpected null session. A cursor creating command should have set this');
|
|
83
83
|
}
|
|
@@ -72,6 +72,12 @@ const DB_OPTIONS_ALLOW_LIST = [
|
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
74
|
class Db {
|
|
75
|
+
static { this.SYSTEM_NAMESPACE_COLLECTION = CONSTANTS.SYSTEM_NAMESPACE_COLLECTION; }
|
|
76
|
+
static { this.SYSTEM_INDEX_COLLECTION = CONSTANTS.SYSTEM_INDEX_COLLECTION; }
|
|
77
|
+
static { this.SYSTEM_PROFILE_COLLECTION = CONSTANTS.SYSTEM_PROFILE_COLLECTION; }
|
|
78
|
+
static { this.SYSTEM_USER_COLLECTION = CONSTANTS.SYSTEM_USER_COLLECTION; }
|
|
79
|
+
static { this.SYSTEM_COMMAND_COLLECTION = CONSTANTS.SYSTEM_COMMAND_COLLECTION; }
|
|
80
|
+
static { this.SYSTEM_JS_COLLECTION = CONSTANTS.SYSTEM_JS_COLLECTION; }
|
|
75
81
|
/**
|
|
76
82
|
* Creates a new Db instance.
|
|
77
83
|
*
|
|
@@ -246,7 +252,6 @@ class Db {
|
|
|
246
252
|
// Intentionally, we do not inherit options from parent for this operation.
|
|
247
253
|
return await (0, execute_operation_1.executeOperation)(this.client, new rename_1.RenameOperation(this.collection(fromCollection), toCollection, (0, utils_1.resolveOptions)(undefined, {
|
|
248
254
|
...options,
|
|
249
|
-
new_collection: true,
|
|
250
255
|
readPreference: read_preference_1.ReadPreference.primary
|
|
251
256
|
})));
|
|
252
257
|
}
|
|
@@ -411,10 +416,4 @@ class Db {
|
|
|
411
416
|
}
|
|
412
417
|
}
|
|
413
418
|
exports.Db = Db;
|
|
414
|
-
Db.SYSTEM_NAMESPACE_COLLECTION = CONSTANTS.SYSTEM_NAMESPACE_COLLECTION;
|
|
415
|
-
Db.SYSTEM_INDEX_COLLECTION = CONSTANTS.SYSTEM_INDEX_COLLECTION;
|
|
416
|
-
Db.SYSTEM_PROFILE_COLLECTION = CONSTANTS.SYSTEM_PROFILE_COLLECTION;
|
|
417
|
-
Db.SYSTEM_USER_COLLECTION = CONSTANTS.SYSTEM_USER_COLLECTION;
|
|
418
|
-
Db.SYSTEM_COMMAND_COLLECTION = CONSTANTS.SYSTEM_COMMAND_COLLECTION;
|
|
419
|
-
Db.SYSTEM_JS_COLLECTION = CONSTANTS.SYSTEM_JS_COLLECTION;
|
|
420
419
|
//# sourceMappingURL=db.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.aws4 = void 0;
|
|
4
3
|
exports.getKerberos = getKerberos;
|
|
5
4
|
exports.getZstdLibrary = getZstdLibrary;
|
|
6
5
|
exports.getAwsCredentialProvider = getAwsCredentialProvider;
|
|
@@ -94,18 +93,6 @@ function getSocks() {
|
|
|
94
93
|
return { kModuleError };
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
|
-
exports.aws4 = loadAws4();
|
|
98
|
-
function loadAws4() {
|
|
99
|
-
let aws4;
|
|
100
|
-
try {
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
102
|
-
aws4 = require('aws4');
|
|
103
|
-
}
|
|
104
|
-
catch (error) {
|
|
105
|
-
aws4 = makeErrorModule(new error_1.MongoMissingDependencyError('Optional module `aws4` not found. Please install it to enable AWS authentication', { cause: error, dependencyName: 'aws4' }));
|
|
106
|
-
}
|
|
107
|
-
return aws4;
|
|
108
|
-
}
|
|
109
96
|
/** A utility function to get the instance of mongodb-client-encryption, if it exists. */
|
|
110
97
|
function getMongoDBClientEncryption() {
|
|
111
98
|
let mongodbClientEncryption = null;
|
|
@@ -5,7 +5,7 @@ exports.needsRetryableWriteLabel = needsRetryableWriteLabel;
|
|
|
5
5
|
exports.isRetryableWriteError = isRetryableWriteError;
|
|
6
6
|
exports.isRetryableReadError = isRetryableReadError;
|
|
7
7
|
exports.isNodeShuttingDownError = isNodeShuttingDownError;
|
|
8
|
-
exports.
|
|
8
|
+
exports.isStateChangeError = isStateChangeError;
|
|
9
9
|
exports.isNetworkTimeoutError = isNetworkTimeoutError;
|
|
10
10
|
exports.isResumableError = isResumableError;
|
|
11
11
|
/**
|
|
@@ -87,9 +87,11 @@ exports.MongoErrorLabel = Object.freeze({
|
|
|
87
87
|
ResumableChangeStreamError: 'ResumableChangeStreamError',
|
|
88
88
|
HandshakeError: 'HandshakeError',
|
|
89
89
|
ResetPool: 'ResetPool',
|
|
90
|
-
|
|
90
|
+
PoolRequestedRetry: 'PoolRequestedRetry',
|
|
91
91
|
InterruptInUseConnections: 'InterruptInUseConnections',
|
|
92
|
-
NoWritesPerformed: 'NoWritesPerformed'
|
|
92
|
+
NoWritesPerformed: 'NoWritesPerformed',
|
|
93
|
+
RetryableError: 'RetryableError',
|
|
94
|
+
SystemOverloadedError: 'SystemOverloadedError'
|
|
93
95
|
});
|
|
94
96
|
function isAggregateError(e) {
|
|
95
97
|
return e != null && typeof e === 'object' && 'errors' in e && Array.isArray(e.errors);
|
|
@@ -1282,7 +1284,7 @@ function needsRetryableWriteLabel(error, maxWireVersion, serverType) {
|
|
|
1282
1284
|
}
|
|
1283
1285
|
function isRetryableWriteError(error) {
|
|
1284
1286
|
return (error.hasErrorLabel(exports.MongoErrorLabel.RetryableWriteError) ||
|
|
1285
|
-
error.hasErrorLabel(exports.MongoErrorLabel.
|
|
1287
|
+
error.hasErrorLabel(exports.MongoErrorLabel.PoolRequestedRetry));
|
|
1286
1288
|
}
|
|
1287
1289
|
/** Determines whether an error is something the driver should attempt to retry */
|
|
1288
1290
|
function isRetryableReadError(error) {
|
|
@@ -1347,12 +1349,7 @@ function isNodeShuttingDownError(err) {
|
|
|
1347
1349
|
*
|
|
1348
1350
|
* @see https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
|
|
1349
1351
|
*/
|
|
1350
|
-
function
|
|
1351
|
-
// NOTE: null check is here for a strictly pre-CMAP world, a timeout or
|
|
1352
|
-
// close event are considered unrecoverable
|
|
1353
|
-
if (error instanceof MongoParseError || error == null) {
|
|
1354
|
-
return true;
|
|
1355
|
-
}
|
|
1352
|
+
function isStateChangeError(error) {
|
|
1356
1353
|
return isRecoveringError(error) || isNotWritablePrimaryError(error);
|
|
1357
1354
|
}
|
|
1358
1355
|
function isNetworkTimeoutError(err) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GridFSBucketReadStream = void 0;
|
|
4
4
|
const stream_1 = require("stream");
|
|
5
|
+
const bson_1 = require("../bson");
|
|
5
6
|
const abstract_cursor_1 = require("../cursor/abstract_cursor");
|
|
6
7
|
const error_1 = require("../error");
|
|
7
8
|
const timeout_1 = require("../timeout");
|
|
@@ -12,6 +13,11 @@ const timeout_1 = require("../timeout");
|
|
|
12
13
|
* @public
|
|
13
14
|
*/
|
|
14
15
|
class GridFSBucketReadStream extends stream_1.Readable {
|
|
16
|
+
/**
|
|
17
|
+
* Fires when the stream loaded the file document corresponding to the provided id.
|
|
18
|
+
* @event
|
|
19
|
+
*/
|
|
20
|
+
static { this.FILE = 'file'; }
|
|
15
21
|
/**
|
|
16
22
|
* @param chunks - Handle for chunks collection
|
|
17
23
|
* @param files - Handle for files collection
|
|
@@ -89,11 +95,6 @@ class GridFSBucketReadStream extends stream_1.Readable {
|
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
exports.GridFSBucketReadStream = GridFSBucketReadStream;
|
|
92
|
-
/**
|
|
93
|
-
* Fires when the stream loaded the file document corresponding to the provided id.
|
|
94
|
-
* @event
|
|
95
|
-
*/
|
|
96
|
-
GridFSBucketReadStream.FILE = 'file';
|
|
97
98
|
function throwIfInitialized(stream) {
|
|
98
99
|
if (stream.s.init) {
|
|
99
100
|
throw new error_1.MongoGridFSStreamError('Options cannot be changed after the stream is initialized');
|
|
@@ -125,7 +126,7 @@ function doRead(stream) {
|
|
|
125
126
|
if (doc.n < expectedN) {
|
|
126
127
|
return stream.destroy(new error_1.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${doc.n}, expected: ${expectedN}`));
|
|
127
128
|
}
|
|
128
|
-
let buf =
|
|
129
|
+
let buf = bson_1.ByteUtils.isUint8Array(doc.data) ? doc.data : doc.data.buffer;
|
|
129
130
|
if (buf.byteLength !== expectedLength) {
|
|
130
131
|
if (bytesRemaining <= 0) {
|
|
131
132
|
return stream.destroy(new error_1.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${doc.n}, expected file length ${stream.s.file.length} bytes but already read ${stream.s.bytesRead} bytes`));
|
|
@@ -17,6 +17,15 @@ const DEFAULT_GRIDFS_BUCKET_OPTIONS = {
|
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
class GridFSBucket extends mongo_types_1.TypedEventEmitter {
|
|
20
|
+
/**
|
|
21
|
+
* When the first call to openUploadStream is made, the upload stream will
|
|
22
|
+
* check to see if it needs to create the proper indexes on the chunks and
|
|
23
|
+
* files collections. This event is fired either when 1) it determines that
|
|
24
|
+
* no index creation is necessary, 2) when it successfully creates the
|
|
25
|
+
* necessary indexes.
|
|
26
|
+
* @event
|
|
27
|
+
*/
|
|
28
|
+
static { this.INDEX = 'index'; }
|
|
20
29
|
constructor(db, options) {
|
|
21
30
|
super();
|
|
22
31
|
this.on('error', utils_1.noop);
|
|
@@ -152,13 +161,4 @@ class GridFSBucket extends mongo_types_1.TypedEventEmitter {
|
|
|
152
161
|
}
|
|
153
162
|
}
|
|
154
163
|
exports.GridFSBucket = GridFSBucket;
|
|
155
|
-
/**
|
|
156
|
-
* When the first call to openUploadStream is made, the upload stream will
|
|
157
|
-
* check to see if it needs to create the proper indexes on the chunks and
|
|
158
|
-
* files collections. This event is fired either when 1) it determines that
|
|
159
|
-
* no index creation is necessary, 2) when it successfully creates the
|
|
160
|
-
* necessary indexes.
|
|
161
|
-
* @event
|
|
162
|
-
*/
|
|
163
|
-
GridFSBucket.INDEX = 'index';
|
|
164
164
|
//# sourceMappingURL=index.js.map
|
|
@@ -50,7 +50,7 @@ class GridFSBucketWriteStream extends stream_1.Writable {
|
|
|
50
50
|
this.id = options.id ? options.id : new bson_1.ObjectId();
|
|
51
51
|
// properly inherit the default chunksize from parent
|
|
52
52
|
this.chunkSizeBytes = options.chunkSizeBytes || this.bucket.s.options.chunkSizeBytes;
|
|
53
|
-
this.bufToStore =
|
|
53
|
+
this.bufToStore = bson_1.ByteUtils.allocate(this.chunkSizeBytes);
|
|
54
54
|
this.length = 0;
|
|
55
55
|
this.n = 0;
|
|
56
56
|
this.pos = 0;
|
|
@@ -88,7 +88,7 @@ class GridFSBucketWriteStream extends stream_1.Writable {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
return
|
|
91
|
+
return queueMicrotask(callback);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
@@ -105,7 +105,7 @@ class GridFSBucketWriteStream extends stream_1.Writable {
|
|
|
105
105
|
/** @internal */
|
|
106
106
|
_final(callback) {
|
|
107
107
|
if (this.state.streamEnd) {
|
|
108
|
-
return
|
|
108
|
+
return queueMicrotask(callback);
|
|
109
109
|
}
|
|
110
110
|
this.state.streamEnd = true;
|
|
111
111
|
writeRemnant(this, callback);
|
|
@@ -131,11 +131,11 @@ class GridFSBucketWriteStream extends stream_1.Writable {
|
|
|
131
131
|
exports.GridFSBucketWriteStream = GridFSBucketWriteStream;
|
|
132
132
|
function handleError(stream, error, callback) {
|
|
133
133
|
if (stream.state.errored) {
|
|
134
|
-
|
|
134
|
+
queueMicrotask(callback);
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
137
|
stream.state.errored = true;
|
|
138
|
-
|
|
138
|
+
queueMicrotask(() => callback(error));
|
|
139
139
|
}
|
|
140
140
|
function createChunkDoc(filesId, n, data) {
|
|
141
141
|
return {
|
|
@@ -185,13 +185,13 @@ async function checkChunksIndex(stream) {
|
|
|
185
185
|
}
|
|
186
186
|
function checkDone(stream, callback) {
|
|
187
187
|
if (stream.done) {
|
|
188
|
-
return
|
|
188
|
+
return queueMicrotask(callback);
|
|
189
189
|
}
|
|
190
190
|
if (stream.state.streamEnd && stream.state.outstandingRequests === 0 && !stream.state.errored) {
|
|
191
191
|
// Set done so we do not trigger duplicate createFilesDoc
|
|
192
192
|
stream.done = true;
|
|
193
193
|
// Create a new files doc
|
|
194
|
-
const gridFSFile = createFilesDoc(stream.id, stream.length, stream.chunkSizeBytes, stream.filename, stream.options.
|
|
194
|
+
const gridFSFile = createFilesDoc(stream.id, stream.length, stream.chunkSizeBytes, stream.filename, stream.options.metadata);
|
|
195
195
|
if (isAborted(stream, callback)) {
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
@@ -209,7 +209,7 @@ function checkDone(stream, callback) {
|
|
|
209
209
|
});
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
queueMicrotask(callback);
|
|
213
213
|
}
|
|
214
214
|
async function checkIndexes(stream) {
|
|
215
215
|
let remainingTimeMS = stream.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`);
|
|
@@ -252,7 +252,7 @@ async function checkIndexes(stream) {
|
|
|
252
252
|
}
|
|
253
253
|
await checkChunksIndex(stream);
|
|
254
254
|
}
|
|
255
|
-
function createFilesDoc(_id, length, chunkSize, filename,
|
|
255
|
+
function createFilesDoc(_id, length, chunkSize, filename, metadata) {
|
|
256
256
|
const ret = {
|
|
257
257
|
_id,
|
|
258
258
|
length,
|
|
@@ -260,12 +260,6 @@ function createFilesDoc(_id, length, chunkSize, filename, contentType, aliases,
|
|
|
260
260
|
uploadDate: new Date(),
|
|
261
261
|
filename
|
|
262
262
|
};
|
|
263
|
-
if (contentType) {
|
|
264
|
-
ret.contentType = contentType;
|
|
265
|
-
}
|
|
266
|
-
if (aliases) {
|
|
267
|
-
ret.aliases = aliases;
|
|
268
|
-
}
|
|
269
263
|
if (metadata) {
|
|
270
264
|
ret.metadata = metadata;
|
|
271
265
|
}
|
|
@@ -275,13 +269,13 @@ function doWrite(stream, chunk, encoding, callback) {
|
|
|
275
269
|
if (isAborted(stream, callback)) {
|
|
276
270
|
return;
|
|
277
271
|
}
|
|
278
|
-
const inputBuf =
|
|
272
|
+
const inputBuf = typeof chunk === 'string' ? bson_1.ByteUtils.fromUTF8(chunk) : bson_1.ByteUtils.toLocalBufferType(chunk);
|
|
279
273
|
stream.length += inputBuf.length;
|
|
280
274
|
// Input is small enough to fit in our buffer
|
|
281
275
|
if (stream.pos + inputBuf.length < stream.chunkSizeBytes) {
|
|
282
|
-
|
|
276
|
+
bson_1.ByteUtils.copy(inputBuf, stream.bufToStore, stream.pos);
|
|
283
277
|
stream.pos += inputBuf.length;
|
|
284
|
-
|
|
278
|
+
queueMicrotask(callback);
|
|
285
279
|
return;
|
|
286
280
|
}
|
|
287
281
|
// Otherwise, buffer is too big for current chunk, so we need to flush
|
|
@@ -292,12 +286,12 @@ function doWrite(stream, chunk, encoding, callback) {
|
|
|
292
286
|
let outstandingRequests = 0;
|
|
293
287
|
while (inputBufRemaining > 0) {
|
|
294
288
|
const inputBufPos = inputBuf.length - inputBufRemaining;
|
|
295
|
-
|
|
289
|
+
bson_1.ByteUtils.copy(inputBuf, stream.bufToStore, stream.pos, inputBufPos, inputBufPos + numToCopy);
|
|
296
290
|
stream.pos += numToCopy;
|
|
297
291
|
spaceRemaining -= numToCopy;
|
|
298
292
|
let doc;
|
|
299
293
|
if (spaceRemaining === 0) {
|
|
300
|
-
doc = createChunkDoc(stream.id, stream.n,
|
|
294
|
+
doc = createChunkDoc(stream.id, stream.n, new Uint8Array(stream.bufToStore));
|
|
301
295
|
const remainingTimeMS = stream.timeoutContext?.remainingTimeMS;
|
|
302
296
|
if (remainingTimeMS != null && remainingTimeMS <= 0) {
|
|
303
297
|
return handleError(stream, new error_1.MongoOperationTimeoutError(`Upload timed out after ${stream.timeoutContext?.timeoutMS}ms`), callback);
|
|
@@ -333,8 +327,8 @@ function writeRemnant(stream, callback) {
|
|
|
333
327
|
}
|
|
334
328
|
// Create a new buffer to make sure the buffer isn't bigger than it needs
|
|
335
329
|
// to be.
|
|
336
|
-
const remnant =
|
|
337
|
-
|
|
330
|
+
const remnant = bson_1.ByteUtils.allocate(stream.pos);
|
|
331
|
+
bson_1.ByteUtils.copy(stream.bufToStore, remnant, 0, 0, stream.pos);
|
|
338
332
|
const doc = createChunkDoc(stream.id, stream.n, remnant);
|
|
339
333
|
// If the stream was aborted, do not write remnant
|
|
340
334
|
if (isAborted(stream, callback)) {
|
|
@@ -356,7 +350,7 @@ function writeRemnant(stream, callback) {
|
|
|
356
350
|
}
|
|
357
351
|
function isAborted(stream, callback) {
|
|
358
352
|
if (stream.state.aborted) {
|
|
359
|
-
|
|
353
|
+
queueMicrotask(() => callback(new error_1.MongoAPIError('Stream has been aborted')));
|
|
360
354
|
return true;
|
|
361
355
|
}
|
|
362
356
|
return false;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MongoRuntimeError = exports.MongoParseError = exports.MongoOperationTimeoutError = exports.MongoOIDCError = exports.MongoNotConnectedError = exports.MongoNetworkTimeoutError = exports.MongoNetworkError = exports.MongoMissingDependencyError = exports.MongoMissingCredentialsError = exports.MongoKerberosError = exports.MongoInvalidArgumentError = exports.MongoGridFSStreamError = exports.MongoGridFSChunkError = exports.MongoGCPError = exports.MongoExpiredSessionError = exports.MongoError = exports.MongoDriverError = exports.MongoDecompressionError = exports.MongoCursorInUseError = exports.MongoCursorExhaustedError = exports.MongoCompatibilityError = exports.MongoClientClosedError = exports.MongoClientBulkWriteExecutionError = exports.MongoClientBulkWriteError = exports.MongoClientBulkWriteCursorError = exports.MongoChangeStreamError = exports.MongoBatchReExecutionError = exports.MongoAzureError = exports.MongoAWSError = exports.MongoAPIError = exports.ExplainableCursor = exports.ChangeStreamCursor = exports.ClientEncryption = exports.MongoBulkWriteError = exports.UUID = exports.Timestamp = exports.ObjectId = exports.MinKey = exports.MaxKey = exports.Long = exports.Int32 = exports.Double = exports.Decimal128 = exports.DBRef = exports.Code = exports.BSONType = exports.BSONSymbol = exports.BSONRegExp = exports.Binary = exports.BSON = void 0;
|
|
4
|
-
exports.CommandFailedEvent = exports.WriteConcern = exports.ReadPreference = exports.ReadConcern = exports.TopologyType = exports.ServerType = exports.ReadPreferenceMode = exports.ReadConcernLevel = exports.ProfilingLevel = exports.ReturnDocument = exports.SeverityLevel = exports.MongoLoggableComponent = exports.ServerApiVersion = exports.ExplainVerbosity = exports.MongoErrorLabel = exports.CursorTimeoutMode = exports.CURSOR_FLAGS = exports.Compressor = exports.AuthMechanism = exports.GSSAPICanonicalizationValue = exports.AutoEncryptionLoggerLevel = exports.BatchType = exports.UnorderedBulkOperation = exports.OrderedBulkOperation = exports.MongoClient = exports.ListIndexesCursor = exports.ListCollectionsCursor = exports.GridFSBucketWriteStream = exports.GridFSBucketReadStream = exports.GridFSBucket = exports.FindCursor = exports.Db = exports.Collection = exports.ClientSession = exports.ChangeStream = exports.CancellationToken = exports.AggregationCursor = exports.Admin = exports.AbstractCursor = exports.
|
|
5
|
-
exports.MongoClientAuthProviders = exports.MongoCryptKMSRequestNetworkTimeoutError = exports.MongoCryptInvalidArgumentError = exports.MongoCryptError = exports.MongoCryptCreateEncryptedCollectionError = exports.MongoCryptCreateDataKeyError = exports.MongoCryptAzureKMSRequestError = exports.SrvPollingEvent = exports.WaitingForSuitableServerEvent = exports.ServerSelectionSucceededEvent = exports.ServerSelectionStartedEvent = exports.ServerSelectionFailedEvent = exports.ServerSelectionEvent = exports.TopologyOpeningEvent = exports.TopologyDescriptionChangedEvent = exports.TopologyClosedEvent = exports.ServerOpeningEvent = exports.ServerHeartbeatSucceededEvent = exports.ServerHeartbeatStartedEvent = exports.ServerHeartbeatFailedEvent = exports.ServerDescriptionChangedEvent = exports.ServerClosedEvent = exports.ConnectionReadyEvent = exports.ConnectionPoolReadyEvent = exports.ConnectionPoolMonitoringEvent = exports.ConnectionPoolCreatedEvent = exports.ConnectionPoolClosedEvent = exports.ConnectionPoolClearedEvent = exports.ConnectionCreatedEvent = exports.ConnectionClosedEvent = exports.ConnectionCheckOutStartedEvent = exports.ConnectionCheckOutFailedEvent = exports.ConnectionCheckedOutEvent = exports.ConnectionCheckedInEvent = exports.CommandSucceededEvent =
|
|
4
|
+
exports.CommandStartedEvent = exports.CommandFailedEvent = exports.WriteConcern = exports.ReadPreference = exports.ReadConcern = exports.TopologyType = exports.ServerType = exports.ReadPreferenceMode = exports.ReadConcernLevel = exports.ProfilingLevel = exports.ReturnDocument = exports.SeverityLevel = exports.MongoLoggableComponent = exports.ServerApiVersion = exports.ExplainVerbosity = exports.MongoErrorLabel = exports.CursorTimeoutMode = exports.CURSOR_FLAGS = exports.Compressor = exports.AuthMechanism = exports.GSSAPICanonicalizationValue = exports.AutoEncryptionLoggerLevel = exports.BatchType = exports.UnorderedBulkOperation = exports.OrderedBulkOperation = exports.MongoClient = exports.ListIndexesCursor = exports.ListCollectionsCursor = exports.GridFSBucketWriteStream = exports.GridFSBucketReadStream = exports.GridFSBucket = exports.FindCursor = exports.Db = exports.Collection = exports.ClientSession = exports.ChangeStream = exports.CancellationToken = exports.AggregationCursor = exports.Admin = exports.AbstractCursor = exports.MongoWriteConcernError = exports.MongoUnexpectedServerResponseError = exports.MongoTransactionError = exports.MongoTopologyClosedError = exports.MongoTailableCursorError = exports.MongoSystemError = exports.MongoStalePrimaryError = exports.MongoServerSelectionError = exports.MongoServerError = exports.MongoServerClosedError = void 0;
|
|
5
|
+
exports.MongoClientAuthProviders = exports.MongoCryptKMSRequestNetworkTimeoutError = exports.MongoCryptInvalidArgumentError = exports.MongoCryptError = exports.MongoCryptCreateEncryptedCollectionError = exports.MongoCryptCreateDataKeyError = exports.MongoCryptAzureKMSRequestError = exports.SrvPollingEvent = exports.WaitingForSuitableServerEvent = exports.ServerSelectionSucceededEvent = exports.ServerSelectionStartedEvent = exports.ServerSelectionFailedEvent = exports.ServerSelectionEvent = exports.TopologyOpeningEvent = exports.TopologyDescriptionChangedEvent = exports.TopologyClosedEvent = exports.ServerOpeningEvent = exports.ServerHeartbeatSucceededEvent = exports.ServerHeartbeatStartedEvent = exports.ServerHeartbeatFailedEvent = exports.ServerDescriptionChangedEvent = exports.ServerClosedEvent = exports.ConnectionReadyEvent = exports.ConnectionPoolReadyEvent = exports.ConnectionPoolMonitoringEvent = exports.ConnectionPoolCreatedEvent = exports.ConnectionPoolClosedEvent = exports.ConnectionPoolClearedEvent = exports.ConnectionCreatedEvent = exports.ConnectionClosedEvent = exports.ConnectionCheckOutStartedEvent = exports.ConnectionCheckOutFailedEvent = exports.ConnectionCheckedOutEvent = exports.ConnectionCheckedInEvent = exports.CommandSucceededEvent = void 0;
|
|
6
6
|
const admin_1 = require("./admin");
|
|
7
7
|
Object.defineProperty(exports, "Admin", { enumerable: true, get: function () { return admin_1.Admin; } });
|
|
8
8
|
const ordered_1 = require("./bulk/ordered");
|
|
@@ -105,8 +105,6 @@ Object.defineProperty(exports, "MongoTopologyClosedError", { enumerable: true, g
|
|
|
105
105
|
Object.defineProperty(exports, "MongoTransactionError", { enumerable: true, get: function () { return error_1.MongoTransactionError; } });
|
|
106
106
|
Object.defineProperty(exports, "MongoUnexpectedServerResponseError", { enumerable: true, get: function () { return error_1.MongoUnexpectedServerResponseError; } });
|
|
107
107
|
Object.defineProperty(exports, "MongoWriteConcernError", { enumerable: true, get: function () { return error_1.MongoWriteConcernError; } });
|
|
108
|
-
var resource_management_1 = require("./resource_management");
|
|
109
|
-
Object.defineProperty(exports, "configureExplicitResourceManagement", { enumerable: true, get: function () { return resource_management_1.configureExplicitResourceManagement; } });
|
|
110
108
|
// enums
|
|
111
109
|
var common_2 = require("./bulk/common");
|
|
112
110
|
Object.defineProperty(exports, "BatchType", { enumerable: true, get: function () { return common_2.BatchType; } });
|