@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
|
@@ -1,46 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AWSSDKCredentialProvider = void 0;
|
|
4
|
+
const process = require("process");
|
|
4
5
|
const deps_1 = require("../../deps");
|
|
5
6
|
const error_1 = require("../../error");
|
|
6
|
-
const utils_1 = require("../../utils");
|
|
7
|
-
const AWS_RELATIVE_URI = 'http://169.254.170.2';
|
|
8
|
-
const AWS_EC2_URI = 'http://169.254.169.254';
|
|
9
|
-
const AWS_EC2_PATH = '/latest/meta-data/iam/security-credentials';
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*
|
|
13
|
-
* Fetches temporary AWS credentials.
|
|
14
|
-
*/
|
|
15
|
-
class AWSTemporaryCredentialProvider {
|
|
16
|
-
static get awsSDK() {
|
|
17
|
-
AWSTemporaryCredentialProvider._awsSDK ??= (0, deps_1.getAwsCredentialProvider)();
|
|
18
|
-
return AWSTemporaryCredentialProvider._awsSDK;
|
|
19
|
-
}
|
|
20
|
-
static get isAWSSDKInstalled() {
|
|
21
|
-
return !('kModuleError' in AWSTemporaryCredentialProvider.awsSDK);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.AWSTemporaryCredentialProvider = AWSTemporaryCredentialProvider;
|
|
25
7
|
/** @internal */
|
|
26
|
-
class AWSSDKCredentialProvider
|
|
8
|
+
class AWSSDKCredentialProvider {
|
|
27
9
|
/**
|
|
28
10
|
* Create the SDK credentials provider.
|
|
29
11
|
* @param credentialsProvider - The credentials provider.
|
|
30
12
|
*/
|
|
31
13
|
constructor(credentialsProvider) {
|
|
32
|
-
super();
|
|
33
14
|
if (credentialsProvider) {
|
|
34
15
|
this._provider = credentialsProvider;
|
|
35
16
|
}
|
|
36
17
|
}
|
|
18
|
+
static get awsSDK() {
|
|
19
|
+
AWSSDKCredentialProvider._awsSDK ??= (0, deps_1.getAwsCredentialProvider)();
|
|
20
|
+
return AWSSDKCredentialProvider._awsSDK;
|
|
21
|
+
}
|
|
37
22
|
/**
|
|
38
23
|
* The AWS SDK caches credentials automatically and handles refresh when the credentials have expired.
|
|
39
24
|
* To ensure this occurs, we need to cache the `provider` returned by the AWS sdk and re-use it when fetching credentials.
|
|
40
25
|
*/
|
|
41
26
|
get provider() {
|
|
42
|
-
if ('kModuleError' in
|
|
43
|
-
throw
|
|
27
|
+
if ('kModuleError' in AWSSDKCredentialProvider.awsSDK) {
|
|
28
|
+
throw AWSSDKCredentialProvider.awsSDK.kModuleError;
|
|
44
29
|
}
|
|
45
30
|
if (this._provider) {
|
|
46
31
|
return this._provider;
|
|
@@ -83,10 +68,10 @@ class AWSSDKCredentialProvider extends AWSTemporaryCredentialProvider {
|
|
|
83
68
|
(AWS_STS_REGIONAL_ENDPOINTS === 'legacy' && !LEGACY_REGIONS.has(AWS_REGION));
|
|
84
69
|
this._provider =
|
|
85
70
|
awsRegionSettingsExist && useRegionalSts
|
|
86
|
-
?
|
|
71
|
+
? AWSSDKCredentialProvider.awsSDK.fromNodeProviderChain({
|
|
87
72
|
clientConfig: { region: AWS_REGION }
|
|
88
73
|
})
|
|
89
|
-
:
|
|
74
|
+
: AWSSDKCredentialProvider.awsSDK.fromNodeProviderChain();
|
|
90
75
|
return this._provider;
|
|
91
76
|
}
|
|
92
77
|
async getCredentials() {
|
|
@@ -115,36 +100,4 @@ class AWSSDKCredentialProvider extends AWSTemporaryCredentialProvider {
|
|
|
115
100
|
}
|
|
116
101
|
}
|
|
117
102
|
exports.AWSSDKCredentialProvider = AWSSDKCredentialProvider;
|
|
118
|
-
/**
|
|
119
|
-
* @internal
|
|
120
|
-
* Fetches credentials manually (without the AWS SDK), as outlined in the [Obtaining Credentials](https://github.com/mongodb/specifications/blob/master/source/auth/auth.md#obtaining-credentials)
|
|
121
|
-
* section of the Auth spec.
|
|
122
|
-
*/
|
|
123
|
-
class LegacyAWSTemporaryCredentialProvider extends AWSTemporaryCredentialProvider {
|
|
124
|
-
async getCredentials() {
|
|
125
|
-
// If the environment variable AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
126
|
-
// is set then drivers MUST assume that it was set by an AWS ECS agent
|
|
127
|
-
if (process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) {
|
|
128
|
-
return await (0, utils_1.request)(`${AWS_RELATIVE_URI}${process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}`);
|
|
129
|
-
}
|
|
130
|
-
// Otherwise assume we are on an EC2 instance
|
|
131
|
-
// get a token
|
|
132
|
-
const token = await (0, utils_1.request)(`${AWS_EC2_URI}/latest/api/token`, {
|
|
133
|
-
method: 'PUT',
|
|
134
|
-
json: false,
|
|
135
|
-
headers: { 'X-aws-ec2-metadata-token-ttl-seconds': 30 }
|
|
136
|
-
});
|
|
137
|
-
// get role name
|
|
138
|
-
const roleName = await (0, utils_1.request)(`${AWS_EC2_URI}/${AWS_EC2_PATH}`, {
|
|
139
|
-
json: false,
|
|
140
|
-
headers: { 'X-aws-ec2-metadata-token': token }
|
|
141
|
-
});
|
|
142
|
-
// get temp credentials
|
|
143
|
-
const creds = await (0, utils_1.request)(`${AWS_EC2_URI}/${AWS_EC2_PATH}/${roleName}`, {
|
|
144
|
-
headers: { 'X-aws-ec2-metadata-token': token }
|
|
145
|
-
});
|
|
146
|
-
return creds;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.LegacyAWSTemporaryCredentialProvider = LegacyAWSTemporaryCredentialProvider;
|
|
150
103
|
//# sourceMappingURL=aws_temporary_credentials.js.map
|
|
@@ -42,9 +42,7 @@ class GSSAPI extends auth_provider_1.AuthProvider {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
exports.GSSAPI = GSSAPI;
|
|
45
|
-
async function makeKerberosClient(
|
|
46
|
-
const { hostAddress } = authContext.options;
|
|
47
|
-
const { credentials } = authContext;
|
|
45
|
+
async function makeKerberosClient({ options: { hostAddress, runtime: { os } }, credentials }) {
|
|
48
46
|
if (!hostAddress || typeof hostAddress.host !== 'string' || !credentials) {
|
|
49
47
|
throw new error_1.MongoInvalidArgumentError('Connection must have host and port and credentials defined.');
|
|
50
48
|
}
|
|
@@ -63,7 +61,7 @@ async function makeKerberosClient(authContext) {
|
|
|
63
61
|
Object.assign(initOptions, { user: username, password: password });
|
|
64
62
|
}
|
|
65
63
|
const spnHost = mechanismProperties.SERVICE_HOST ?? host;
|
|
66
|
-
let spn = `${serviceName}${
|
|
64
|
+
let spn = `${serviceName}${os.platform() === 'win32' ? '/' : '@'}${spnHost}`;
|
|
67
65
|
if ('SERVICE_REALM' in mechanismProperties) {
|
|
68
66
|
spn = `${spn}@${mechanismProperties.SERVICE_REALM}`;
|
|
69
67
|
}
|
|
@@ -115,7 +113,7 @@ async function performGSSAPICanonicalizeHostName(host, mechanismProperties) {
|
|
|
115
113
|
const { address } = await dns.promises.lookup(host);
|
|
116
114
|
try {
|
|
117
115
|
// Perform a reverse ptr lookup on the ip address.
|
|
118
|
-
const results = await dns.promises.
|
|
116
|
+
const results = await dns.promises.resolve(address, 'PTR');
|
|
119
117
|
// If the ptr did not error but had no results, return the host.
|
|
120
118
|
return results.length > 0 ? results[0] : host;
|
|
121
119
|
}
|
|
@@ -135,7 +133,7 @@ async function performGSSAPICanonicalizeHostName(host, mechanismProperties) {
|
|
|
135
133
|
async function resolveCname(host) {
|
|
136
134
|
// Attempt to resolve the host name
|
|
137
135
|
try {
|
|
138
|
-
const results = await dns.promises.
|
|
136
|
+
const results = await dns.promises.resolve(host, 'CNAME');
|
|
139
137
|
// Get the first resolved host id
|
|
140
138
|
return results.length > 0 ? results[0] : host;
|
|
141
139
|
}
|
|
@@ -35,7 +35,8 @@ exports.DEFAULT_ALLOWED_HOSTS = [
|
|
|
35
35
|
'*.mongodbgov.net',
|
|
36
36
|
'localhost',
|
|
37
37
|
'127.0.0.1',
|
|
38
|
-
'::1'
|
|
38
|
+
'::1',
|
|
39
|
+
'*.mongo.com'
|
|
39
40
|
];
|
|
40
41
|
/** Error for when the token audience is missing in the environment. */
|
|
41
42
|
const TOKEN_RESOURCE_MISSING_ERROR = 'TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure or gcp.';
|
|
@@ -53,21 +54,6 @@ class MongoCredentials {
|
|
|
53
54
|
}
|
|
54
55
|
this.mechanism = options.mechanism || providers_1.AuthMechanism.MONGODB_DEFAULT;
|
|
55
56
|
this.mechanismProperties = options.mechanismProperties || {};
|
|
56
|
-
if (this.mechanism.match(/MONGODB-AWS/i)) {
|
|
57
|
-
if (!this.username && process.env.AWS_ACCESS_KEY_ID) {
|
|
58
|
-
this.username = process.env.AWS_ACCESS_KEY_ID;
|
|
59
|
-
}
|
|
60
|
-
if (!this.password && process.env.AWS_SECRET_ACCESS_KEY) {
|
|
61
|
-
this.password = process.env.AWS_SECRET_ACCESS_KEY;
|
|
62
|
-
}
|
|
63
|
-
if (this.mechanismProperties.AWS_SESSION_TOKEN == null &&
|
|
64
|
-
process.env.AWS_SESSION_TOKEN != null) {
|
|
65
|
-
this.mechanismProperties = {
|
|
66
|
-
...this.mechanismProperties,
|
|
67
|
-
AWS_SESSION_TOKEN: process.env.AWS_SESSION_TOKEN
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
57
|
if (this.mechanism === providers_1.AuthMechanism.MONGODB_OIDC && !this.mechanismProperties.ALLOWED_HOSTS) {
|
|
72
58
|
this.mechanismProperties = {
|
|
73
59
|
...this.mechanismProperties,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MongoDBAWS = void 0;
|
|
4
|
+
const bson_1 = require("../../bson");
|
|
4
5
|
const BSON = require("../../bson");
|
|
5
|
-
const deps_1 = require("../../deps");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const auth_provider_1 = require("./auth_provider");
|
|
9
9
|
const aws_temporary_credentials_1 = require("./aws_temporary_credentials");
|
|
10
|
+
const aws4_1 = require("./aws4");
|
|
10
11
|
const mongo_credentials_1 = require("./mongo_credentials");
|
|
11
12
|
const providers_1 = require("./providers");
|
|
12
13
|
const ASCII_N = 110;
|
|
@@ -20,37 +21,26 @@ const bsonOptions = {
|
|
|
20
21
|
class MongoDBAWS extends auth_provider_1.AuthProvider {
|
|
21
22
|
constructor(credentialProvider) {
|
|
22
23
|
super();
|
|
23
|
-
this.
|
|
24
|
-
this.credentialFetcher = aws_temporary_credentials_1.AWSTemporaryCredentialProvider.isAWSSDKInstalled
|
|
25
|
-
? new aws_temporary_credentials_1.AWSSDKCredentialProvider(credentialProvider)
|
|
26
|
-
: new aws_temporary_credentials_1.LegacyAWSTemporaryCredentialProvider();
|
|
24
|
+
this.credentialFetcher = new aws_temporary_credentials_1.AWSSDKCredentialProvider(credentialProvider);
|
|
27
25
|
}
|
|
28
26
|
async auth(authContext) {
|
|
29
27
|
const { connection } = authContext;
|
|
30
28
|
if (!authContext.credentials) {
|
|
31
29
|
throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
|
|
32
30
|
}
|
|
33
|
-
if ('kModuleError' in deps_1.aws4) {
|
|
34
|
-
throw deps_1.aws4['kModuleError'];
|
|
35
|
-
}
|
|
36
|
-
const { sign } = deps_1.aws4;
|
|
37
31
|
if ((0, utils_1.maxWireVersion)(connection) < 9) {
|
|
38
32
|
throw new error_1.MongoCompatibilityError('MONGODB-AWS authentication requires MongoDB version 4.4 or later');
|
|
39
33
|
}
|
|
40
|
-
|
|
41
|
-
authContext.credentials = await makeTempCredentials(authContext.credentials, this.credentialFetcher);
|
|
42
|
-
}
|
|
34
|
+
authContext.credentials = await makeTempCredentials(authContext.credentials, this.credentialFetcher);
|
|
43
35
|
const { credentials } = authContext;
|
|
44
36
|
const accessKeyId = credentials.username;
|
|
45
37
|
const secretAccessKey = credentials.password;
|
|
46
38
|
// Allow the user to specify an AWS session token for authentication with temporary credentials.
|
|
47
39
|
const sessionToken = credentials.mechanismProperties.AWS_SESSION_TOKEN;
|
|
48
|
-
// If all three defined, include sessionToken, else include username and pass
|
|
49
|
-
const awsCredentials =
|
|
40
|
+
// If all three defined, include sessionToken, else only include username and pass
|
|
41
|
+
const awsCredentials = sessionToken
|
|
50
42
|
? { accessKeyId, secretAccessKey, sessionToken }
|
|
51
|
-
: accessKeyId
|
|
52
|
-
? { accessKeyId, secretAccessKey }
|
|
53
|
-
: undefined;
|
|
43
|
+
: { accessKeyId, secretAccessKey };
|
|
54
44
|
const db = credentials.source;
|
|
55
45
|
const nonce = await (0, utils_1.randomBytes)(32);
|
|
56
46
|
// All messages between MongoDB clients and servers are sent as BSON objects
|
|
@@ -68,7 +58,7 @@ class MongoDBAWS extends auth_provider_1.AuthProvider {
|
|
|
68
58
|
// TODO(NODE-3483)
|
|
69
59
|
throw new error_1.MongoRuntimeError(`Invalid server nonce length ${serverNonce.length}, expected 64`);
|
|
70
60
|
}
|
|
71
|
-
if (!
|
|
61
|
+
if (!bson_1.ByteUtils.equals(serverNonce.subarray(0, nonce.byteLength), nonce)) {
|
|
72
62
|
// throw because the serverNonce's leading 32 bytes must equal the client nonce's 32 bytes
|
|
73
63
|
// https://github.com/mongodb/specifications/blob/master/source/auth/auth.md#conversation-5
|
|
74
64
|
// TODO(NODE-3483)
|
|
@@ -79,7 +69,7 @@ class MongoDBAWS extends auth_provider_1.AuthProvider {
|
|
|
79
69
|
throw new error_1.MongoRuntimeError(`Server returned an invalid host: "${host}"`);
|
|
80
70
|
}
|
|
81
71
|
const body = 'Action=GetCallerIdentity&Version=2011-06-15';
|
|
82
|
-
const
|
|
72
|
+
const headers = await (0, aws4_1.aws4Sign)({
|
|
83
73
|
method: 'POST',
|
|
84
74
|
host,
|
|
85
75
|
region: deriveRegion(serverResponse.h),
|
|
@@ -87,15 +77,16 @@ class MongoDBAWS extends auth_provider_1.AuthProvider {
|
|
|
87
77
|
headers: {
|
|
88
78
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
89
79
|
'Content-Length': body.length,
|
|
90
|
-
'X-MongoDB-Server-Nonce':
|
|
80
|
+
'X-MongoDB-Server-Nonce': bson_1.ByteUtils.toBase64(serverNonce),
|
|
91
81
|
'X-MongoDB-GS2-CB-Flag': 'n'
|
|
92
82
|
},
|
|
93
83
|
path: '/',
|
|
94
|
-
body
|
|
84
|
+
body,
|
|
85
|
+
date: new Date()
|
|
95
86
|
}, awsCredentials);
|
|
96
87
|
const payload = {
|
|
97
|
-
a:
|
|
98
|
-
d:
|
|
88
|
+
a: headers.Authorization,
|
|
89
|
+
d: headers['X-Amz-Date']
|
|
99
90
|
};
|
|
100
91
|
if (sessionToken) {
|
|
101
92
|
payload.t = sessionToken;
|
package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.azureCallback = void 0;
|
|
4
4
|
const azure_1 = require("../../../client-side-encryption/providers/azure");
|
|
5
5
|
const error_1 = require("../../../error");
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
@@ -15,7 +15,7 @@ const TOKEN_RESOURCE_MISSING_ERROR = 'TOKEN_RESOURCE must be set in the auth mec
|
|
|
15
15
|
* @param params - The OIDC callback parameters.
|
|
16
16
|
* @returns The OIDC response.
|
|
17
17
|
*/
|
|
18
|
-
const
|
|
18
|
+
const azureCallback = async (params) => {
|
|
19
19
|
const tokenAudience = params.tokenAudience;
|
|
20
20
|
const username = params.username;
|
|
21
21
|
if (!tokenAudience) {
|
|
@@ -27,7 +27,7 @@ const callback = async (params) => {
|
|
|
27
27
|
}
|
|
28
28
|
return response;
|
|
29
29
|
};
|
|
30
|
-
exports.
|
|
30
|
+
exports.azureCallback = azureCallback;
|
|
31
31
|
/**
|
|
32
32
|
* Hit the Azure endpoint to get the token data.
|
|
33
33
|
*/
|
package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.gcpCallback = void 0;
|
|
4
4
|
const error_1 = require("../../../error");
|
|
5
5
|
const utils_1 = require("../../../utils");
|
|
6
6
|
/** GCP base URL. */
|
|
@@ -14,14 +14,14 @@ const TOKEN_RESOURCE_MISSING_ERROR = 'TOKEN_RESOURCE must be set in the auth mec
|
|
|
14
14
|
* @param params - The OIDC callback parameters.
|
|
15
15
|
* @returns The OIDC response.
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const gcpCallback = async (params) => {
|
|
18
18
|
const tokenAudience = params.tokenAudience;
|
|
19
19
|
if (!tokenAudience) {
|
|
20
20
|
throw new error_1.MongoGCPError(TOKEN_RESOURCE_MISSING_ERROR);
|
|
21
21
|
}
|
|
22
22
|
return await getGcpTokenData(tokenAudience);
|
|
23
23
|
};
|
|
24
|
-
exports.
|
|
24
|
+
exports.gcpCallback = gcpCallback;
|
|
25
25
|
/**
|
|
26
26
|
* Hit the GCP endpoint to get the token data.
|
|
27
27
|
*/
|
package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.k8sCallback = void 0;
|
|
4
4
|
const promises_1 = require("fs/promises");
|
|
5
|
+
const process = require("process");
|
|
5
6
|
/** The fallback file name */
|
|
6
7
|
const FALLBACK_FILENAME = '/var/run/secrets/kubernetes.io/serviceaccount/token';
|
|
7
8
|
/** The azure environment variable for the file name. */
|
|
@@ -13,7 +14,7 @@ const AWS_FILENAME = 'AWS_WEB_IDENTITY_TOKEN_FILE';
|
|
|
13
14
|
* @param params - The OIDC callback parameters.
|
|
14
15
|
* @returns The OIDC response.
|
|
15
16
|
*/
|
|
16
|
-
const
|
|
17
|
+
const k8sCallback = async () => {
|
|
17
18
|
let filename;
|
|
18
19
|
if (process.env[AZURE_FILENAME]) {
|
|
19
20
|
filename = process.env[AZURE_FILENAME];
|
|
@@ -27,5 +28,5 @@ const callback = async () => {
|
|
|
27
28
|
const token = await (0, promises_1.readFile)(filename, 'utf8');
|
|
28
29
|
return { accessToken: token };
|
|
29
30
|
};
|
|
30
|
-
exports.
|
|
31
|
+
exports.k8sCallback = k8sCallback;
|
|
31
32
|
//# sourceMappingURL=k8s_machine_workflow.js.map
|
package/.output/server/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.tokenMachineCallback = void 0;
|
|
4
4
|
const fs = require("fs");
|
|
5
|
+
const process = require("process");
|
|
5
6
|
const error_1 = require("../../../error");
|
|
6
7
|
/** Error for when the token is missing in the environment. */
|
|
7
8
|
const TOKEN_MISSING_ERROR = 'OIDC_TOKEN_FILE must be set in the environment.';
|
|
@@ -10,7 +11,7 @@ const TOKEN_MISSING_ERROR = 'OIDC_TOKEN_FILE must be set in the environment.';
|
|
|
10
11
|
* @param params - The OIDC callback parameters.
|
|
11
12
|
* @returns The OIDC response.
|
|
12
13
|
*/
|
|
13
|
-
const
|
|
14
|
+
const tokenMachineCallback = async () => {
|
|
14
15
|
const tokenFile = process.env.OIDC_TOKEN_FILE;
|
|
15
16
|
if (!tokenFile) {
|
|
16
17
|
throw new error_1.MongoAWSError(TOKEN_MISSING_ERROR);
|
|
@@ -18,5 +19,5 @@ const callback = async () => {
|
|
|
18
19
|
const token = await fs.promises.readFile(tokenFile, 'utf8');
|
|
19
20
|
return { accessToken: token };
|
|
20
21
|
};
|
|
21
|
-
exports.
|
|
22
|
+
exports.tokenMachineCallback = tokenMachineCallback;
|
|
22
23
|
//# sourceMappingURL=token_machine_workflow.js.map
|
|
@@ -15,10 +15,10 @@ const MISSING_CREDENTIALS_ERROR = 'AuthContext must provide credentials.';
|
|
|
15
15
|
exports.OIDC_VERSION = 1;
|
|
16
16
|
/** @internal */
|
|
17
17
|
exports.OIDC_WORKFLOWS = new Map();
|
|
18
|
-
exports.OIDC_WORKFLOWS.set('test', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), token_machine_workflow_1.
|
|
19
|
-
exports.OIDC_WORKFLOWS.set('azure', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), azure_machine_workflow_1.
|
|
20
|
-
exports.OIDC_WORKFLOWS.set('gcp', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), gcp_machine_workflow_1.
|
|
21
|
-
exports.OIDC_WORKFLOWS.set('k8s', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), k8s_machine_workflow_1.
|
|
18
|
+
exports.OIDC_WORKFLOWS.set('test', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), token_machine_workflow_1.tokenMachineCallback));
|
|
19
|
+
exports.OIDC_WORKFLOWS.set('azure', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), azure_machine_workflow_1.azureCallback));
|
|
20
|
+
exports.OIDC_WORKFLOWS.set('gcp', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), gcp_machine_workflow_1.gcpCallback));
|
|
21
|
+
exports.OIDC_WORKFLOWS.set('k8s', () => new automated_callback_workflow_1.AutomatedCallbackWorkflow(new token_cache_1.TokenCache(), k8s_machine_workflow_1.k8sCallback));
|
|
22
22
|
/**
|
|
23
23
|
* OIDC auth provider.
|
|
24
24
|
*/
|
|
@@ -12,7 +12,7 @@ class Plain extends auth_provider_1.AuthProvider {
|
|
|
12
12
|
throw new error_1.MongoMissingCredentialsError('AuthContext must provide credentials.');
|
|
13
13
|
}
|
|
14
14
|
const { username, password } = credentials;
|
|
15
|
-
const payload = new bson_1.Binary(
|
|
15
|
+
const payload = new bson_1.Binary(bson_1.ByteUtils.fromUTF8(`\x00${username}\x00${password}`));
|
|
16
16
|
const command = {
|
|
17
17
|
saslStart: 1,
|
|
18
18
|
mechanism: 'PLAIN',
|
|
@@ -4,7 +4,6 @@ exports.AUTH_MECHS_AUTH_SRC_EXTERNAL = exports.AuthMechanism = void 0;
|
|
|
4
4
|
/** @public */
|
|
5
5
|
exports.AuthMechanism = Object.freeze({
|
|
6
6
|
MONGODB_AWS: 'MONGODB-AWS',
|
|
7
|
-
MONGODB_CR: 'MONGODB-CR',
|
|
8
7
|
MONGODB_DEFAULT: 'DEFAULT',
|
|
9
8
|
MONGODB_GSSAPI: 'GSSAPI',
|
|
10
9
|
MONGODB_PLAIN: 'PLAIN',
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ScramSHA256 = exports.ScramSHA1 = void 0;
|
|
4
4
|
const saslprep_1 = require("@mongodb-js/saslprep");
|
|
5
|
-
const crypto = require("crypto");
|
|
6
5
|
const bson_1 = require("../../bson");
|
|
7
6
|
const error_1 = require("../../error");
|
|
8
7
|
const utils_1 = require("../../utils");
|
|
@@ -45,11 +44,11 @@ function cleanUsername(username) {
|
|
|
45
44
|
function clientFirstMessageBare(username, nonce) {
|
|
46
45
|
// NOTE: This is done b/c Javascript uses UTF-16, but the server is hashing in UTF-8.
|
|
47
46
|
// Since the username is not sasl-prep-d, we need to do this here.
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
return bson_1.ByteUtils.concat([
|
|
48
|
+
bson_1.ByteUtils.fromUTF8('n='),
|
|
49
|
+
bson_1.ByteUtils.fromUTF8(username),
|
|
50
|
+
bson_1.ByteUtils.fromUTF8(',r='),
|
|
51
|
+
bson_1.ByteUtils.fromUTF8(bson_1.ByteUtils.toBase64(nonce))
|
|
53
52
|
]);
|
|
54
53
|
}
|
|
55
54
|
function makeFirstMessage(cryptoMethod, credentials, nonce) {
|
|
@@ -60,7 +59,7 @@ function makeFirstMessage(cryptoMethod, credentials, nonce) {
|
|
|
60
59
|
return {
|
|
61
60
|
saslStart: 1,
|
|
62
61
|
mechanism,
|
|
63
|
-
payload: new bson_1.Binary(
|
|
62
|
+
payload: new bson_1.Binary(bson_1.ByteUtils.concat([bson_1.ByteUtils.fromUTF8('n,,'), clientFirstMessageBare(username, nonce)])),
|
|
64
63
|
autoAuthorize: 1,
|
|
65
64
|
options: { skipEmptyExchange: true }
|
|
66
65
|
};
|
|
@@ -93,7 +92,7 @@ async function continueScramConversation(cryptoMethod, response, authContext) {
|
|
|
93
92
|
const username = cleanUsername(credentials.username);
|
|
94
93
|
const password = credentials.password;
|
|
95
94
|
const processedPassword = cryptoMethod === 'sha256' ? (0, saslprep_1.saslprep)(password) : passwordDigest(username, password);
|
|
96
|
-
const payload =
|
|
95
|
+
const payload = bson_1.ByteUtils.isUint8Array(response.payload)
|
|
97
96
|
? new bson_1.Binary(response.payload)
|
|
98
97
|
: response.payload;
|
|
99
98
|
const dict = parsePayload(payload);
|
|
@@ -110,27 +109,27 @@ async function continueScramConversation(cryptoMethod, response, authContext) {
|
|
|
110
109
|
}
|
|
111
110
|
// Set up start of proof
|
|
112
111
|
const withoutProof = `c=biws,r=${rnonce}`;
|
|
113
|
-
const saltedPassword = HI(processedPassword,
|
|
114
|
-
const clientKey = HMAC(cryptoMethod, saltedPassword, 'Client Key');
|
|
115
|
-
const serverKey = HMAC(cryptoMethod, saltedPassword, 'Server Key');
|
|
116
|
-
const storedKey = H(cryptoMethod, clientKey);
|
|
112
|
+
const saltedPassword = await HI(processedPassword, bson_1.ByteUtils.fromBase64(salt), iterations, cryptoMethod);
|
|
113
|
+
const clientKey = await HMAC(cryptoMethod, saltedPassword, 'Client Key');
|
|
114
|
+
const serverKey = await HMAC(cryptoMethod, saltedPassword, 'Server Key');
|
|
115
|
+
const storedKey = await H(cryptoMethod, clientKey);
|
|
117
116
|
const authMessage = [
|
|
118
117
|
clientFirstMessageBare(username, nonce),
|
|
119
118
|
payload.toString('utf8'),
|
|
120
119
|
withoutProof
|
|
121
120
|
].join(',');
|
|
122
|
-
const clientSignature = HMAC(cryptoMethod, storedKey, authMessage);
|
|
121
|
+
const clientSignature = await HMAC(cryptoMethod, storedKey, authMessage);
|
|
123
122
|
const clientProof = `p=${xor(clientKey, clientSignature)}`;
|
|
124
123
|
const clientFinal = [withoutProof, clientProof].join(',');
|
|
125
|
-
const serverSignature = HMAC(cryptoMethod, serverKey, authMessage);
|
|
124
|
+
const serverSignature = await HMAC(cryptoMethod, serverKey, authMessage);
|
|
126
125
|
const saslContinueCmd = {
|
|
127
126
|
saslContinue: 1,
|
|
128
127
|
conversationId: response.conversationId,
|
|
129
|
-
payload: new bson_1.Binary(
|
|
128
|
+
payload: new bson_1.Binary(bson_1.ByteUtils.fromUTF8(clientFinal))
|
|
130
129
|
};
|
|
131
130
|
const r = await connection.command((0, utils_1.ns)(`${db}.$cmd`), saslContinueCmd, undefined);
|
|
132
131
|
const parsedResponse = parsePayload(r.payload);
|
|
133
|
-
if (!compareDigest(
|
|
132
|
+
if (!compareDigest(bson_1.ByteUtils.fromBase64(parsedResponse.v), serverSignature)) {
|
|
134
133
|
throw new error_1.MongoRuntimeError('Server returned an invalid signature');
|
|
135
134
|
}
|
|
136
135
|
if (r.done !== false) {
|
|
@@ -140,7 +139,7 @@ async function continueScramConversation(cryptoMethod, response, authContext) {
|
|
|
140
139
|
const retrySaslContinueCmd = {
|
|
141
140
|
saslContinue: 1,
|
|
142
141
|
conversationId: r.conversationId,
|
|
143
|
-
payload:
|
|
142
|
+
payload: bson_1.ByteUtils.allocate(0)
|
|
144
143
|
};
|
|
145
144
|
await connection.command((0, utils_1.ns)(`${db}.$cmd`), retrySaslContinueCmd, undefined);
|
|
146
145
|
}
|
|
@@ -164,41 +163,51 @@ function passwordDigest(username, password) {
|
|
|
164
163
|
if (password.length === 0) {
|
|
165
164
|
throw new error_1.MongoInvalidArgumentError('Password cannot be empty');
|
|
166
165
|
}
|
|
167
|
-
let
|
|
166
|
+
let nodeCrypto;
|
|
168
167
|
try {
|
|
169
|
-
|
|
168
|
+
// TODO: NODE-7424 - remove dependency on 'crypto' for SCRAM-SHA-1 authentication
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
170
|
+
nodeCrypto = require('crypto');
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
throw new error_1.MongoRuntimeError('Node.js crypto module is required for SCRAM-SHA-1 authentication', {
|
|
174
|
+
cause: e
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const md5 = nodeCrypto.createHash('md5');
|
|
179
|
+
md5.update(`${username}:mongo:${password}`, 'utf8');
|
|
180
|
+
return md5.digest('hex');
|
|
170
181
|
}
|
|
171
182
|
catch (err) {
|
|
172
|
-
if (
|
|
183
|
+
if (nodeCrypto.getFips()) {
|
|
173
184
|
// This error is (slightly) more helpful than what comes from OpenSSL directly, e.g.
|
|
174
185
|
// 'Error: error:060800C8:digital envelope routines:EVP_DigestInit_ex:disabled for FIPS'
|
|
175
186
|
throw new Error('Auth mechanism SCRAM-SHA-1 is not supported in FIPS mode');
|
|
176
187
|
}
|
|
177
188
|
throw err;
|
|
178
189
|
}
|
|
179
|
-
md5.update(`${username}:mongo:${password}`, 'utf8');
|
|
180
|
-
return md5.digest('hex');
|
|
181
190
|
}
|
|
182
191
|
// XOR two buffers
|
|
183
192
|
function xor(a, b) {
|
|
184
|
-
if (!Buffer.isBuffer(a)) {
|
|
185
|
-
a = Buffer.from(a);
|
|
186
|
-
}
|
|
187
|
-
if (!Buffer.isBuffer(b)) {
|
|
188
|
-
b = Buffer.from(b);
|
|
189
|
-
}
|
|
190
193
|
const length = Math.max(a.length, b.length);
|
|
191
194
|
const res = [];
|
|
192
195
|
for (let i = 0; i < length; i += 1) {
|
|
193
196
|
res.push(a[i] ^ b[i]);
|
|
194
197
|
}
|
|
195
|
-
return
|
|
198
|
+
return bson_1.ByteUtils.toBase64(bson_1.ByteUtils.fromNumberArray(res));
|
|
196
199
|
}
|
|
197
|
-
function H(method, text) {
|
|
198
|
-
|
|
200
|
+
async function H(method, text) {
|
|
201
|
+
const buffer = await crypto.subtle.digest(method === 'sha256' ? 'SHA-256' : 'SHA-1', text);
|
|
202
|
+
return new Uint8Array(buffer);
|
|
199
203
|
}
|
|
200
|
-
function HMAC(method, key, text) {
|
|
201
|
-
|
|
204
|
+
async function HMAC(method, key, text) {
|
|
205
|
+
const keyBuffer = bson_1.ByteUtils.toLocalBufferType(key);
|
|
206
|
+
const cryptoKey = await crypto.subtle.importKey('raw', keyBuffer, { name: 'HMAC', hash: { name: method === 'sha256' ? 'SHA-256' : 'SHA-1' } }, false, ['sign', 'verify']);
|
|
207
|
+
const textData = typeof text === 'string' ? new TextEncoder().encode(text) : text;
|
|
208
|
+
const textBuffer = bson_1.ByteUtils.toLocalBufferType(textData);
|
|
209
|
+
const signature = await crypto.subtle.sign('HMAC', cryptoKey, textBuffer);
|
|
210
|
+
return new Uint8Array(signature);
|
|
202
211
|
}
|
|
203
212
|
let _hiCache = {};
|
|
204
213
|
let _hiCacheCount = 0;
|
|
@@ -210,14 +219,21 @@ const hiLengthMap = {
|
|
|
210
219
|
sha256: 32,
|
|
211
220
|
sha1: 20
|
|
212
221
|
};
|
|
213
|
-
function HI(data, salt, iterations, cryptoMethod) {
|
|
222
|
+
async function HI(data, salt, iterations, cryptoMethod) {
|
|
214
223
|
// omit the work if already generated
|
|
215
|
-
const key = [data,
|
|
224
|
+
const key = [data, bson_1.ByteUtils.toBase64(salt), iterations].join('_');
|
|
216
225
|
if (_hiCache[key] != null) {
|
|
217
226
|
return _hiCache[key];
|
|
218
227
|
}
|
|
219
|
-
|
|
220
|
-
const
|
|
228
|
+
const keyMaterial = await crypto.subtle.importKey('raw', new TextEncoder().encode(data), { name: 'PBKDF2' }, false, ['deriveBits']);
|
|
229
|
+
const params = {
|
|
230
|
+
name: 'PBKDF2',
|
|
231
|
+
salt: salt,
|
|
232
|
+
iterations: iterations,
|
|
233
|
+
hash: { name: cryptoMethod === 'sha256' ? 'SHA-256' : 'SHA-1' }
|
|
234
|
+
};
|
|
235
|
+
const derivedBits = await crypto.subtle.deriveBits(params, keyMaterial, hiLengthMap[cryptoMethod] * 8);
|
|
236
|
+
const saltedData = new Uint8Array(derivedBits);
|
|
221
237
|
// cache a copy to speed up the next lookup, but prevent unbounded cache growth
|
|
222
238
|
if (_hiCacheCount >= 200) {
|
|
223
239
|
_hiCachePurge();
|
|
@@ -230,9 +246,6 @@ function compareDigest(lhs, rhs) {
|
|
|
230
246
|
if (lhs.length !== rhs.length) {
|
|
231
247
|
return false;
|
|
232
248
|
}
|
|
233
|
-
if (typeof crypto.timingSafeEqual === 'function') {
|
|
234
|
-
return crypto.timingSafeEqual(lhs, rhs);
|
|
235
|
-
}
|
|
236
249
|
let result = 0;
|
|
237
250
|
for (let i = 0; i < lhs.length; i++) {
|
|
238
251
|
result |= lhs[i] ^ rhs[i];
|