@depup/mongodb 7.1.0-depup.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/LICENSE.md +201 -0
- package/README.md +33 -0
- package/etc/prepare.js +12 -0
- package/lib/admin.js +136 -0
- package/lib/admin.js.map +1 -0
- package/lib/bson.js +85 -0
- package/lib/bson.js.map +1 -0
- package/lib/bulk/common.js +835 -0
- package/lib/bulk/common.js.map +1 -0
- package/lib/bulk/ordered.js +67 -0
- package/lib/bulk/ordered.js.map +1 -0
- package/lib/bulk/unordered.js +92 -0
- package/lib/bulk/unordered.js.map +1 -0
- package/lib/change_stream.js +513 -0
- package/lib/change_stream.js.map +1 -0
- package/lib/client-side-encryption/auto_encrypter.js +272 -0
- package/lib/client-side-encryption/auto_encrypter.js.map +1 -0
- package/lib/client-side-encryption/client_encryption.js +609 -0
- package/lib/client-side-encryption/client_encryption.js.map +1 -0
- package/lib/client-side-encryption/errors.js +138 -0
- package/lib/client-side-encryption/errors.js.map +1 -0
- package/lib/client-side-encryption/mongocryptd_manager.js +85 -0
- package/lib/client-side-encryption/mongocryptd_manager.js.map +1 -0
- package/lib/client-side-encryption/providers/aws.js +23 -0
- package/lib/client-side-encryption/providers/aws.js.map +1 -0
- package/lib/client-side-encryption/providers/azure.js +132 -0
- package/lib/client-side-encryption/providers/azure.js.map +1 -0
- package/lib/client-side-encryption/providers/gcp.js +16 -0
- package/lib/client-side-encryption/providers/gcp.js.map +1 -0
- package/lib/client-side-encryption/providers/index.js +43 -0
- package/lib/client-side-encryption/providers/index.js.map +1 -0
- package/lib/client-side-encryption/state_machine.js +427 -0
- package/lib/client-side-encryption/state_machine.js.map +1 -0
- package/lib/cmap/auth/auth_provider.js +51 -0
- package/lib/cmap/auth/auth_provider.js.map +1 -0
- package/lib/cmap/auth/aws4.js +161 -0
- package/lib/cmap/auth/aws4.js.map +1 -0
- package/lib/cmap/auth/aws_temporary_credentials.js +103 -0
- package/lib/cmap/auth/aws_temporary_credentials.js.map +1 -0
- package/lib/cmap/auth/gssapi.js +155 -0
- package/lib/cmap/auth/gssapi.js.map +1 -0
- package/lib/cmap/auth/mongo_credentials.js +169 -0
- package/lib/cmap/auth/mongo_credentials.js.map +1 -0
- package/lib/cmap/auth/mongodb_aws.js +128 -0
- package/lib/cmap/auth/mongodb_aws.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js +84 -0
- package/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +62 -0
- package/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/callback_workflow.js +141 -0
- package/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/command_builders.js +44 -0
- package/lib/cmap/auth/mongodb_oidc/command_builders.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +39 -0
- package/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js +122 -0
- package/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +32 -0
- package/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/token_cache.js +52 -0
- package/lib/cmap/auth/mongodb_oidc/token_cache.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +23 -0
- package/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js.map +1 -0
- package/lib/cmap/auth/mongodb_oidc.js +73 -0
- package/lib/cmap/auth/mongodb_oidc.js.map +1 -0
- package/lib/cmap/auth/plain.js +26 -0
- package/lib/cmap/auth/plain.js.map +1 -0
- package/lib/cmap/auth/providers.js +22 -0
- package/lib/cmap/auth/providers.js.map +1 -0
- package/lib/cmap/auth/scram.js +254 -0
- package/lib/cmap/auth/scram.js.map +1 -0
- package/lib/cmap/auth/x509.js +36 -0
- package/lib/cmap/auth/x509.js.map +1 -0
- package/lib/cmap/command_monitoring_events.js +223 -0
- package/lib/cmap/command_monitoring_events.js.map +1 -0
- package/lib/cmap/commands.js +535 -0
- package/lib/cmap/commands.js.map +1 -0
- package/lib/cmap/connect.js +381 -0
- package/lib/cmap/connect.js.map +1 -0
- package/lib/cmap/connection.js +571 -0
- package/lib/cmap/connection.js.map +1 -0
- package/lib/cmap/connection_pool.js +558 -0
- package/lib/cmap/connection_pool.js.map +1 -0
- package/lib/cmap/connection_pool_events.js +190 -0
- package/lib/cmap/connection_pool_events.js.map +1 -0
- package/lib/cmap/errors.js +108 -0
- package/lib/cmap/errors.js.map +1 -0
- package/lib/cmap/handshake/client_metadata.js +242 -0
- package/lib/cmap/handshake/client_metadata.js.map +1 -0
- package/lib/cmap/metrics.js +62 -0
- package/lib/cmap/metrics.js.map +1 -0
- package/lib/cmap/stream_description.js +70 -0
- package/lib/cmap/stream_description.js.map +1 -0
- package/lib/cmap/wire_protocol/compression.js +178 -0
- package/lib/cmap/wire_protocol/compression.js.map +1 -0
- package/lib/cmap/wire_protocol/constants.js +21 -0
- package/lib/cmap/wire_protocol/constants.js.map +1 -0
- package/lib/cmap/wire_protocol/on_data.js +111 -0
- package/lib/cmap/wire_protocol/on_data.js.map +1 -0
- package/lib/cmap/wire_protocol/on_demand/document.js +222 -0
- package/lib/cmap/wire_protocol/on_demand/document.js.map +1 -0
- package/lib/cmap/wire_protocol/responses.js +315 -0
- package/lib/cmap/wire_protocol/responses.js.map +1 -0
- package/lib/cmap/wire_protocol/shared.js +35 -0
- package/lib/cmap/wire_protocol/shared.js.map +1 -0
- package/lib/collection.js +751 -0
- package/lib/collection.js.map +1 -0
- package/lib/connection_string.js +1090 -0
- package/lib/connection_string.js.map +1 -0
- package/lib/constants.js +170 -0
- package/lib/constants.js.map +1 -0
- package/lib/cursor/abstract_cursor.js +924 -0
- package/lib/cursor/abstract_cursor.js.map +1 -0
- package/lib/cursor/aggregation_cursor.js +164 -0
- package/lib/cursor/aggregation_cursor.js.map +1 -0
- package/lib/cursor/change_stream_cursor.js +104 -0
- package/lib/cursor/change_stream_cursor.js.map +1 -0
- package/lib/cursor/client_bulk_write_cursor.js +52 -0
- package/lib/cursor/client_bulk_write_cursor.js.map +1 -0
- package/lib/cursor/explainable_cursor.js +36 -0
- package/lib/cursor/explainable_cursor.js.map +1 -0
- package/lib/cursor/find_cursor.js +399 -0
- package/lib/cursor/find_cursor.js.map +1 -0
- package/lib/cursor/list_collections_cursor.js +34 -0
- package/lib/cursor/list_collections_cursor.js.map +1 -0
- package/lib/cursor/list_indexes_cursor.js +32 -0
- package/lib/cursor/list_indexes_cursor.js.map +1 -0
- package/lib/cursor/list_search_indexes_cursor.js +14 -0
- package/lib/cursor/list_search_indexes_cursor.js.map +1 -0
- package/lib/cursor/run_command_cursor.js +94 -0
- package/lib/cursor/run_command_cursor.js.map +1 -0
- package/lib/db.js +419 -0
- package/lib/db.js.map +1 -0
- package/lib/deps.js +112 -0
- package/lib/deps.js.map +1 -0
- package/lib/encrypter.js +106 -0
- package/lib/encrypter.js.map +1 -0
- package/lib/error.js +1380 -0
- package/lib/error.js.map +1 -0
- package/lib/explain.js +59 -0
- package/lib/explain.js.map +1 -0
- package/lib/gridfs/download.js +305 -0
- package/lib/gridfs/download.js.map +1 -0
- package/lib/gridfs/index.js +164 -0
- package/lib/gridfs/index.js.map +1 -0
- package/lib/gridfs/upload.js +358 -0
- package/lib/gridfs/upload.js.map +1 -0
- package/lib/index.js +193 -0
- package/lib/index.js.map +1 -0
- package/lib/mongo_client.js +557 -0
- package/lib/mongo_client.js.map +1 -0
- package/lib/mongo_client_auth_providers.js +80 -0
- package/lib/mongo_client_auth_providers.js.map +1 -0
- package/lib/mongo_logger.js +655 -0
- package/lib/mongo_logger.js.map +1 -0
- package/lib/mongo_types.js +56 -0
- package/lib/mongo_types.js.map +1 -0
- package/lib/operations/aggregate.js +90 -0
- package/lib/operations/aggregate.js.map +1 -0
- package/lib/operations/client_bulk_write/client_bulk_write.js +51 -0
- package/lib/operations/client_bulk_write/client_bulk_write.js.map +1 -0
- package/lib/operations/client_bulk_write/command_builder.js +340 -0
- package/lib/operations/client_bulk_write/command_builder.js.map +1 -0
- package/lib/operations/client_bulk_write/common.js +3 -0
- package/lib/operations/client_bulk_write/common.js.map +1 -0
- package/lib/operations/client_bulk_write/executor.js +120 -0
- package/lib/operations/client_bulk_write/executor.js.map +1 -0
- package/lib/operations/client_bulk_write/results_merger.js +204 -0
- package/lib/operations/client_bulk_write/results_merger.js.map +1 -0
- package/lib/operations/command.js +83 -0
- package/lib/operations/command.js.map +1 -0
- package/lib/operations/count.js +45 -0
- package/lib/operations/count.js.map +1 -0
- package/lib/operations/create_collection.js +109 -0
- package/lib/operations/create_collection.js.map +1 -0
- package/lib/operations/delete.js +125 -0
- package/lib/operations/delete.js.map +1 -0
- package/lib/operations/distinct.js +61 -0
- package/lib/operations/distinct.js.map +1 -0
- package/lib/operations/drop.js +93 -0
- package/lib/operations/drop.js.map +1 -0
- package/lib/operations/end_sessions.js +34 -0
- package/lib/operations/end_sessions.js.map +1 -0
- package/lib/operations/estimated_document_count.js +41 -0
- package/lib/operations/estimated_document_count.js.map +1 -0
- package/lib/operations/execute_operation.js +239 -0
- package/lib/operations/execute_operation.js.map +1 -0
- package/lib/operations/find.js +148 -0
- package/lib/operations/find.js.map +1 -0
- package/lib/operations/find_and_modify.js +158 -0
- package/lib/operations/find_and_modify.js.map +1 -0
- package/lib/operations/get_more.js +62 -0
- package/lib/operations/get_more.js.map +1 -0
- package/lib/operations/indexes.js +186 -0
- package/lib/operations/indexes.js.map +1 -0
- package/lib/operations/insert.js +70 -0
- package/lib/operations/insert.js.map +1 -0
- package/lib/operations/kill_cursors.js +43 -0
- package/lib/operations/kill_cursors.js.map +1 -0
- package/lib/operations/list_collections.js +53 -0
- package/lib/operations/list_collections.js.map +1 -0
- package/lib/operations/list_databases.js +40 -0
- package/lib/operations/list_databases.js.map +1 -0
- package/lib/operations/operation.js +102 -0
- package/lib/operations/operation.js.map +1 -0
- package/lib/operations/profiling_level.js +43 -0
- package/lib/operations/profiling_level.js.map +1 -0
- package/lib/operations/remove_user.js +27 -0
- package/lib/operations/remove_user.js.map +1 -0
- package/lib/operations/rename.js +38 -0
- package/lib/operations/rename.js.map +1 -0
- package/lib/operations/run_command.js +47 -0
- package/lib/operations/run_command.js.map +1 -0
- package/lib/operations/search_indexes/create.js +33 -0
- package/lib/operations/search_indexes/create.js.map +1 -0
- package/lib/operations/search_indexes/drop.js +43 -0
- package/lib/operations/search_indexes/drop.js.map +1 -0
- package/lib/operations/search_indexes/update.js +35 -0
- package/lib/operations/search_indexes/update.js.map +1 -0
- package/lib/operations/set_profiling_level.js +53 -0
- package/lib/operations/set_profiling_level.js.map +1 -0
- package/lib/operations/stats.js +27 -0
- package/lib/operations/stats.js.map +1 -0
- package/lib/operations/update.js +188 -0
- package/lib/operations/update.js.map +1 -0
- package/lib/operations/validate_collection.js +37 -0
- package/lib/operations/validate_collection.js.map +1 -0
- package/lib/read_concern.js +73 -0
- package/lib/read_concern.js.map +1 -0
- package/lib/read_preference.js +191 -0
- package/lib/read_preference.js.map +1 -0
- package/lib/sdam/common.js +49 -0
- package/lib/sdam/common.js.map +1 -0
- package/lib/sdam/events.js +146 -0
- package/lib/sdam/events.js.map +1 -0
- package/lib/sdam/monitor.js +544 -0
- package/lib/sdam/monitor.js.map +1 -0
- package/lib/sdam/server.js +404 -0
- package/lib/sdam/server.js.map +1 -0
- package/lib/sdam/server_description.js +204 -0
- package/lib/sdam/server_description.js.map +1 -0
- package/lib/sdam/server_selection.js +294 -0
- package/lib/sdam/server_selection.js.map +1 -0
- package/lib/sdam/server_selection_events.js +85 -0
- package/lib/sdam/server_selection_events.js.map +1 -0
- package/lib/sdam/srv_polling.js +108 -0
- package/lib/sdam/srv_polling.js.map +1 -0
- package/lib/sdam/topology.js +652 -0
- package/lib/sdam/topology.js.map +1 -0
- package/lib/sdam/topology_description.js +383 -0
- package/lib/sdam/topology_description.js.map +1 -0
- package/lib/sessions.js +892 -0
- package/lib/sessions.js.map +1 -0
- package/lib/sort.js +103 -0
- package/lib/sort.js.map +1 -0
- package/lib/timeout.js +296 -0
- package/lib/timeout.js.map +1 -0
- package/lib/transactions.js +135 -0
- package/lib/transactions.js.map +1 -0
- package/lib/utils.js +1163 -0
- package/lib/utils.js.map +1 -0
- package/lib/write_concern.js +100 -0
- package/lib/write_concern.js.map +1 -0
- package/mongodb.d.ts +9018 -0
- package/package.json +197 -0
- package/src/admin.ts +173 -0
- package/src/bson.ts +149 -0
- package/src/bulk/common.ts +1251 -0
- package/src/bulk/ordered.ts +83 -0
- package/src/bulk/unordered.ts +115 -0
- package/src/change_stream.ts +1160 -0
- package/src/client-side-encryption/auto_encrypter.ts +469 -0
- package/src/client-side-encryption/client_encryption.ts +1150 -0
- package/src/client-side-encryption/errors.ts +144 -0
- package/src/client-side-encryption/mongocryptd_manager.ts +100 -0
- package/src/client-side-encryption/providers/aws.ts +33 -0
- package/src/client-side-encryption/providers/azure.ts +181 -0
- package/src/client-side-encryption/providers/gcp.ts +16 -0
- package/src/client-side-encryption/providers/index.ts +207 -0
- package/src/client-side-encryption/state_machine.ts +651 -0
- package/src/cmap/auth/auth_provider.ts +77 -0
- package/src/cmap/auth/aws4.ts +207 -0
- package/src/cmap/auth/aws_temporary_credentials.ts +129 -0
- package/src/cmap/auth/gssapi.ts +203 -0
- package/src/cmap/auth/mongo_credentials.ts +292 -0
- package/src/cmap/auth/mongodb_aws.ts +179 -0
- package/src/cmap/auth/mongodb_oidc/automated_callback_workflow.ts +88 -0
- package/src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts +73 -0
- package/src/cmap/auth/mongodb_oidc/callback_workflow.ts +188 -0
- package/src/cmap/auth/mongodb_oidc/command_builders.ts +53 -0
- package/src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts +46 -0
- package/src/cmap/auth/mongodb_oidc/human_callback_workflow.ts +141 -0
- package/src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts +31 -0
- package/src/cmap/auth/mongodb_oidc/token_cache.ts +62 -0
- package/src/cmap/auth/mongodb_oidc/token_machine_workflow.ts +22 -0
- package/src/cmap/auth/mongodb_oidc.ts +185 -0
- package/src/cmap/auth/plain.ts +25 -0
- package/src/cmap/auth/providers.ts +22 -0
- package/src/cmap/auth/scram.ts +344 -0
- package/src/cmap/auth/x509.ts +43 -0
- package/src/cmap/command_monitoring_events.ts +316 -0
- package/src/cmap/commands.ts +788 -0
- package/src/cmap/connect.ts +518 -0
- package/src/cmap/connection.ts +931 -0
- package/src/cmap/connection_pool.ts +831 -0
- package/src/cmap/connection_pool_events.ts +300 -0
- package/src/cmap/errors.ts +119 -0
- package/src/cmap/handshake/client_metadata.ts +353 -0
- package/src/cmap/metrics.ts +58 -0
- package/src/cmap/stream_description.ts +96 -0
- package/src/cmap/wire_protocol/compression.ts +211 -0
- package/src/cmap/wire_protocol/constants.ts +17 -0
- package/src/cmap/wire_protocol/on_data.ts +139 -0
- package/src/cmap/wire_protocol/on_demand/document.ts +358 -0
- package/src/cmap/wire_protocol/responses.ts +393 -0
- package/src/cmap/wire_protocol/shared.ts +48 -0
- package/src/collection.ts +1314 -0
- package/src/connection_string.ts +1297 -0
- package/src/constants.ts +176 -0
- package/src/cursor/abstract_cursor.ts +1247 -0
- package/src/cursor/aggregation_cursor.ts +245 -0
- package/src/cursor/change_stream_cursor.ts +171 -0
- package/src/cursor/client_bulk_write_cursor.ts +83 -0
- package/src/cursor/explainable_cursor.ts +51 -0
- package/src/cursor/find_cursor.ts +497 -0
- package/src/cursor/list_collections_cursor.ts +50 -0
- package/src/cursor/list_indexes_cursor.ts +37 -0
- package/src/cursor/list_search_indexes_cursor.ts +20 -0
- package/src/cursor/run_command_cursor.ts +178 -0
- package/src/db.ts +621 -0
- package/src/deps.ts +227 -0
- package/src/encrypter.ts +127 -0
- package/src/error.ts +1567 -0
- package/src/explain.ts +124 -0
- package/src/gridfs/download.ts +483 -0
- package/src/gridfs/index.ts +264 -0
- package/src/gridfs/upload.ts +537 -0
- package/src/index.ts +633 -0
- package/src/mongo_client.ts +1155 -0
- package/src/mongo_client_auth_providers.ts +87 -0
- package/src/mongo_logger.ts +1081 -0
- package/src/mongo_types.ts +678 -0
- package/src/operations/aggregate.ts +153 -0
- package/src/operations/client_bulk_write/client_bulk_write.ts +72 -0
- package/src/operations/client_bulk_write/command_builder.ts +487 -0
- package/src/operations/client_bulk_write/common.ts +276 -0
- package/src/operations/client_bulk_write/executor.ts +149 -0
- package/src/operations/client_bulk_write/results_merger.ts +260 -0
- package/src/operations/command.ts +171 -0
- package/src/operations/count.ts +74 -0
- package/src/operations/create_collection.ts +218 -0
- package/src/operations/delete.ts +183 -0
- package/src/operations/distinct.ts +92 -0
- package/src/operations/drop.ts +130 -0
- package/src/operations/end_sessions.ts +44 -0
- package/src/operations/estimated_document_count.ts +61 -0
- package/src/operations/execute_operation.ts +319 -0
- package/src/operations/find.ts +254 -0
- package/src/operations/find_and_modify.ts +319 -0
- package/src/operations/get_more.ts +108 -0
- package/src/operations/indexes.ts +418 -0
- package/src/operations/insert.ts +108 -0
- package/src/operations/kill_cursors.ts +64 -0
- package/src/operations/list_collections.ts +108 -0
- package/src/operations/list_databases.ts +68 -0
- package/src/operations/operation.ts +181 -0
- package/src/operations/profiling_level.ts +46 -0
- package/src/operations/remove_user.ts +36 -0
- package/src/operations/rename.ts +60 -0
- package/src/operations/run_command.ts +79 -0
- package/src/operations/search_indexes/create.ts +56 -0
- package/src/operations/search_indexes/drop.ts +58 -0
- package/src/operations/search_indexes/update.ts +45 -0
- package/src/operations/set_profiling_level.ts +74 -0
- package/src/operations/stats.ts +37 -0
- package/src/operations/update.ts +318 -0
- package/src/operations/validate_collection.ts +50 -0
- package/src/read_concern.ts +88 -0
- package/src/read_preference.ts +256 -0
- package/src/sdam/common.ts +74 -0
- package/src/sdam/events.ts +219 -0
- package/src/sdam/monitor.ts +771 -0
- package/src/sdam/server.ts +595 -0
- package/src/sdam/server_description.ts +297 -0
- package/src/sdam/server_selection.ts +415 -0
- package/src/sdam/server_selection_events.ts +142 -0
- package/src/sdam/srv_polling.ts +146 -0
- package/src/sdam/topology.ts +1100 -0
- package/src/sdam/topology_description.ts +548 -0
- package/src/sessions.ts +1244 -0
- package/src/sort.ts +141 -0
- package/src/timeout.ts +405 -0
- package/src/transactions.ts +181 -0
- package/src/utils.ts +1434 -0
- package/src/write_concern.ts +183 -0
- package/tsconfig.json +46 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert.js","sourceRoot":"","sources":["../../src/operations/insert.ts"],"names":[],"mappings":";;;AAGA,+DAAkE;AAElE,oCAA4C;AAG5C,oCAAwE;AACxE,uCAA2E;AAC3E,2CAAoD;AACpD,gBAAgB;AAChB,MAAa,eAAgB,SAAQ,0BAA0B;IAM7D,YAAY,EAAoB,EAAE,SAAqB,EAAE,OAAyB;QAChF,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QANnB,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,KAAK,EAAE,CAAC;QACrE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,QAAiB,CAAC;IAC3B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB,EAAE,QAAwB;QAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,C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D,gDAkBC;AAYD,IAAA,yBAAa,EAAC,eAAe,EAAE;IAC7B,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC;AACH,IAAA,yBAAa,EAAC,kBAAkB,EAAE;IAChC,kBAAM,CAAC,SAAS;IAChB,kBAAM,CAAC,eAAe;IACtB,kBAAM,CAAC,iBAAiB;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KillCursorsOperation = void 0;
|
|
4
|
+
const responses_1 = require("../cmap/wire_protocol/responses");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
const operation_1 = require("./operation");
|
|
7
|
+
class KillCursorsOperation extends operation_1.AbstractOperation {
|
|
8
|
+
constructor(cursorId, ns, server, options) {
|
|
9
|
+
super(options);
|
|
10
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
11
|
+
this.ns = ns;
|
|
12
|
+
this.cursorId = cursorId;
|
|
13
|
+
this.server = server;
|
|
14
|
+
}
|
|
15
|
+
get commandName() {
|
|
16
|
+
return 'killCursors';
|
|
17
|
+
}
|
|
18
|
+
buildCommand(_connection, _session) {
|
|
19
|
+
const killCursors = this.ns.collection;
|
|
20
|
+
if (killCursors == null) {
|
|
21
|
+
// Cursors should have adopted the namespace returned by MongoDB
|
|
22
|
+
// which should always defined a collection name (even a pseudo one, ex. db.aggregate())
|
|
23
|
+
throw new error_1.MongoRuntimeError('A collection name must be determined before killCursors');
|
|
24
|
+
}
|
|
25
|
+
const killCursorsCommand = {
|
|
26
|
+
killCursors,
|
|
27
|
+
cursors: [this.cursorId]
|
|
28
|
+
};
|
|
29
|
+
return killCursorsCommand;
|
|
30
|
+
}
|
|
31
|
+
buildOptions(timeoutContext) {
|
|
32
|
+
return {
|
|
33
|
+
session: this.session,
|
|
34
|
+
timeoutContext
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
handleError(_error) {
|
|
38
|
+
// The driver should never emit errors from killCursors, this is spec-ed behavior
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.KillCursorsOperation = KillCursorsOperation;
|
|
42
|
+
(0, operation_1.defineAspects)(KillCursorsOperation, [operation_1.Aspect.MUST_SELECT_SAME_SERVER]);
|
|
43
|
+
//# sourceMappingURL=kill_cursors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kill_cursors.js","sourceRoot":"","sources":["../../src/operations/kill_cursors.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAClE,oCAA8D;AAK9D,2CAA8F;AAY9F,MAAa,oBAAqB,SAAQ,6BAAuB;IAI/D,YAAY,QAAc,EAAE,EAAoB,EAAE,MAAc,EAAE,OAAyB;QACzF,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,iCAA4B,GAAG,2BAAe,CAAC;QAKtD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,aAAsB,CAAC;IAChC,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC;QACvC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACxB,gEAAgE;YAChE,wFAAwF;YACxF,MAAM,IAAI,yBAAiB,CAAC,yDAAyD,CAAC,CAAC;QACzF,CAAC;QAED,MAAM,kBAAkB,GAAuB;YAC7C,WAAW;YACX,OAAO,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;SACzB,CAAC;QAEF,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,cAAc;SACf,CAAC;IACJ,CAAC;IAEQ,WAAW,CAAC,MAAkB;QACrC,iFAAiF;IACnF,CAAC;CACF;AAzCD,oDAyCC;AAED,IAAA,yBAAa,EAAC,oBAAoB,EAAE,CAAC,kBAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListCollectionsOperation = void 0;
|
|
4
|
+
const responses_1 = require("../cmap/wire_protocol/responses");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const command_1 = require("./command");
|
|
7
|
+
const operation_1 = require("./operation");
|
|
8
|
+
/** @internal */
|
|
9
|
+
class ListCollectionsOperation extends command_1.CommandOperation {
|
|
10
|
+
constructor(db, filter, options) {
|
|
11
|
+
super(db, options);
|
|
12
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.CursorResponse;
|
|
13
|
+
this.options = { ...options };
|
|
14
|
+
delete this.options.writeConcern;
|
|
15
|
+
this.db = db;
|
|
16
|
+
this.filter = filter;
|
|
17
|
+
this.nameOnly = !!this.options.nameOnly;
|
|
18
|
+
this.authorizedCollections = !!this.options.authorizedCollections;
|
|
19
|
+
if (typeof this.options.batchSize === 'number') {
|
|
20
|
+
this.batchSize = this.options.batchSize;
|
|
21
|
+
}
|
|
22
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = this.explain ? responses_1.ExplainedCursorResponse : responses_1.CursorResponse;
|
|
23
|
+
}
|
|
24
|
+
get commandName() {
|
|
25
|
+
return 'listCollections';
|
|
26
|
+
}
|
|
27
|
+
buildCommandDocument(connection) {
|
|
28
|
+
const command = {
|
|
29
|
+
listCollections: 1,
|
|
30
|
+
filter: this.filter,
|
|
31
|
+
cursor: this.batchSize ? { batchSize: this.batchSize } : {},
|
|
32
|
+
nameOnly: this.nameOnly,
|
|
33
|
+
authorizedCollections: this.authorizedCollections
|
|
34
|
+
};
|
|
35
|
+
// we check for undefined specifically here to allow falsy values
|
|
36
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
37
|
+
if ((0, utils_1.maxWireVersion)(connection) >= 9 && this.options.comment !== undefined) {
|
|
38
|
+
command.comment = this.options.comment;
|
|
39
|
+
}
|
|
40
|
+
return command;
|
|
41
|
+
}
|
|
42
|
+
handleOk(response) {
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.ListCollectionsOperation = ListCollectionsOperation;
|
|
47
|
+
(0, operation_1.defineAspects)(ListCollectionsOperation, [
|
|
48
|
+
operation_1.Aspect.READ_OPERATION,
|
|
49
|
+
operation_1.Aspect.RETRYABLE,
|
|
50
|
+
operation_1.Aspect.CURSOR_CREATING,
|
|
51
|
+
operation_1.Aspect.SUPPORTS_RAW_DATA
|
|
52
|
+
]);
|
|
53
|
+
//# sourceMappingURL=list_collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_collections.js","sourceRoot":"","sources":["../../src/operations/list_collections.ts"],"names":[],"mappings":";;;AAEA,+DAA0F;AAI1F,oCAA0C;AAC1C,uCAA2E;AAC3E,2CAAoD;AAmBpD,gBAAgB;AAChB,MAAa,wBAAyB,SAAQ,0BAAgC;IAgB5E,YAAY,EAAM,EAAE,MAAgB,EAAE,OAAgC;QACpE,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAhBZ,iCAA4B,GAAG,0BAAc,CAAC;QAkBrD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QACjC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC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iBAAiB;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListDatabasesOperation = void 0;
|
|
4
|
+
const responses_1 = require("../cmap/wire_protocol/responses");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const command_1 = require("./command");
|
|
7
|
+
const operation_1 = require("./operation");
|
|
8
|
+
/** @internal */
|
|
9
|
+
class ListDatabasesOperation extends command_1.CommandOperation {
|
|
10
|
+
constructor(db, options) {
|
|
11
|
+
super(db, options);
|
|
12
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
13
|
+
this.options = options ?? {};
|
|
14
|
+
this.ns = new utils_1.MongoDBNamespace('admin', '$cmd');
|
|
15
|
+
}
|
|
16
|
+
get commandName() {
|
|
17
|
+
return 'listDatabases';
|
|
18
|
+
}
|
|
19
|
+
buildCommandDocument(connection, _session) {
|
|
20
|
+
const cmd = { listDatabases: 1 };
|
|
21
|
+
if (typeof this.options.nameOnly === 'boolean') {
|
|
22
|
+
cmd.nameOnly = this.options.nameOnly;
|
|
23
|
+
}
|
|
24
|
+
if (this.options.filter) {
|
|
25
|
+
cmd.filter = this.options.filter;
|
|
26
|
+
}
|
|
27
|
+
if (typeof this.options.authorizedDatabases === 'boolean') {
|
|
28
|
+
cmd.authorizedDatabases = this.options.authorizedDatabases;
|
|
29
|
+
}
|
|
30
|
+
// we check for undefined specifically here to allow falsy values
|
|
31
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
32
|
+
if ((0, utils_1.maxWireVersion)(connection) >= 9 && this.options.comment !== undefined) {
|
|
33
|
+
cmd.comment = this.options.comment;
|
|
34
|
+
}
|
|
35
|
+
return cmd;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ListDatabasesOperation = ListDatabasesOperation;
|
|
39
|
+
(0, operation_1.defineAspects)(ListDatabasesOperation, [operation_1.Aspect.READ_OPERATION, operation_1.Aspect.RETRYABLE]);
|
|
40
|
+
//# sourceMappingURL=list_databases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list_databases.js","sourceRoot":"","sources":["../../src/operations/list_databases.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAGlE,oCAA4D;AAC5D,uCAA2E;AAC3E,2CAAoD;AAoBpD,gBAAgB;AAChB,MAAa,sBAAuB,SAAQ,0BAAqC;IAI/E,YAAY,EAAM,EAAE,OAA8B;QAChD,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAJZ,iCAA4B,GAAG,2BAAe,CAAC;QAKtD,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,IAAI,wBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,eAAwB,CAAC;IAClC,CAAC;IAEQ,oBAAoB,CAAC,UAAsB,EAAE,QAAwB;QAC5E,MAAM,GAAG,GAAa,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;QAE3C,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC/C,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACvC,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACxB,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACnC,CAAC;QAED,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAC1D,GAAG,CAAC,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC;QAC7D,CAAC;QAED,iEAAiE;QACjE,gDAAgD;QAChD,IAAI,IAAA,sBAAc,EAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1E,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACrC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AArCD,wDAqCC;AAED,IAAA,yBAAa,EAAC,sBAAsB,EAAE,CAAC,kBAAM,CAAC,cAAc,EAAE,kBAAM,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractOperation = exports.Aspect = void 0;
|
|
4
|
+
exports.defineAspects = defineAspects;
|
|
5
|
+
const bson_1 = require("../bson");
|
|
6
|
+
const read_preference_1 = require("../read_preference");
|
|
7
|
+
exports.Aspect = {
|
|
8
|
+
READ_OPERATION: Symbol('READ_OPERATION'),
|
|
9
|
+
WRITE_OPERATION: Symbol('WRITE_OPERATION'),
|
|
10
|
+
RETRYABLE: Symbol('RETRYABLE'),
|
|
11
|
+
EXPLAINABLE: Symbol('EXPLAINABLE'),
|
|
12
|
+
SKIP_COLLATION: Symbol('SKIP_COLLATION'),
|
|
13
|
+
CURSOR_CREATING: Symbol('CURSOR_CREATING'),
|
|
14
|
+
MUST_SELECT_SAME_SERVER: Symbol('MUST_SELECT_SAME_SERVER'),
|
|
15
|
+
COMMAND_BATCHING: Symbol('COMMAND_BATCHING'),
|
|
16
|
+
SUPPORTS_RAW_DATA: Symbol('SUPPORTS_RAW_DATA')
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* This class acts as a parent class for any operation and is responsible for setting this.options,
|
|
20
|
+
* as well as setting and getting a session.
|
|
21
|
+
* Additionally, this class implements `hasAspect`, which determines whether an operation has
|
|
22
|
+
* a specific aspect.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
class AbstractOperation {
|
|
26
|
+
constructor(options = {}) {
|
|
27
|
+
this.readPreference = this.hasAspect(exports.Aspect.WRITE_OPERATION)
|
|
28
|
+
? read_preference_1.ReadPreference.primary
|
|
29
|
+
: (read_preference_1.ReadPreference.fromOptions(options) ?? read_preference_1.ReadPreference.primary);
|
|
30
|
+
// Pull the BSON serialize options from the already-resolved options
|
|
31
|
+
this.bsonOptions = (0, bson_1.resolveBSONOptions)(options);
|
|
32
|
+
this._session = options.session != null ? options.session : undefined;
|
|
33
|
+
this.options = options;
|
|
34
|
+
this.bypassPinningCheck = !!options.bypassPinningCheck;
|
|
35
|
+
}
|
|
36
|
+
hasAspect(aspect) {
|
|
37
|
+
const ctor = this.constructor;
|
|
38
|
+
if (ctor.aspects == null) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return ctor.aspects.has(aspect);
|
|
42
|
+
}
|
|
43
|
+
// Make sure the session is not writable from outside this class.
|
|
44
|
+
get session() {
|
|
45
|
+
return this._session;
|
|
46
|
+
}
|
|
47
|
+
set session(session) {
|
|
48
|
+
this._session = session;
|
|
49
|
+
}
|
|
50
|
+
clearSession() {
|
|
51
|
+
this._session = undefined;
|
|
52
|
+
}
|
|
53
|
+
resetBatch() {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
get canRetryRead() {
|
|
57
|
+
return this.hasAspect(exports.Aspect.RETRYABLE) && this.hasAspect(exports.Aspect.READ_OPERATION);
|
|
58
|
+
}
|
|
59
|
+
get canRetryWrite() {
|
|
60
|
+
return this.hasAspect(exports.Aspect.RETRYABLE) && this.hasAspect(exports.Aspect.WRITE_OPERATION);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Given an instance of a MongoDBResponse, map the response to the correct result type. For
|
|
64
|
+
* example, a `CountOperation` might map the response as follows:
|
|
65
|
+
*
|
|
66
|
+
* ```typescript
|
|
67
|
+
* override handleOk(response: InstanceType<typeof this.SERVER_COMMAND_RESPONSE_TYPE>): TResult {
|
|
68
|
+
* return response.toObject(this.bsonOptions).n ?? 0;
|
|
69
|
+
* }
|
|
70
|
+
*
|
|
71
|
+
* // or, with type safety:
|
|
72
|
+
* override handleOk(response: InstanceType<typeof this.SERVER_COMMAND_RESPONSE_TYPE>): TResult {
|
|
73
|
+
* return response.getNumber('n') ?? 0;
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
handleOk(response) {
|
|
78
|
+
return response.toObject(this.bsonOptions);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Optional.
|
|
82
|
+
*
|
|
83
|
+
* If the operation performs error handling, such as wrapping, renaming the error, or squashing errors
|
|
84
|
+
* this method can be overridden.
|
|
85
|
+
*/
|
|
86
|
+
handleError(error) {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.AbstractOperation = AbstractOperation;
|
|
91
|
+
function defineAspects(operation, aspects) {
|
|
92
|
+
if (!Array.isArray(aspects) && !(aspects instanceof Set)) {
|
|
93
|
+
aspects = [aspects];
|
|
94
|
+
}
|
|
95
|
+
aspects = new Set(aspects);
|
|
96
|
+
Object.defineProperty(operation, 'aspects', {
|
|
97
|
+
value: aspects,
|
|
98
|
+
writable: false
|
|
99
|
+
});
|
|
100
|
+
return aspects;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/operations/operation.ts"],"names":[],"mappings":";;;AAqKA,sCAeC;AAnLD,kCAAuF;AAGvF,wDAA6E;AAMhE,QAAA,MAAM,GAAG;IACpB,cAAc,EAAE,MAAM,CAAC,gBAAgB,CAAC;IACxC,eAAe,EAAE,MAAM,CAAC,iBAAiB,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC;IAClC,cAAc,EAA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,OAAO,CAAC;IAC1B,CAAC;IAED,YAAY;QACV,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,cAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,cAAM,CAAC,cAAc,CAAC,CAAC;IACnF,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,cAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,cAAM,CAAC,eAAe,CAAC,CAAC;IACpF,CAAC;IAaD;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,QAAgE;QACvE,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAY,CAAC;IACxD,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,KAAiB;QAC3B,MAAM,KAAK,CAAC;IACd,CAAC;CACF;AA7GD,8CA6GC;AAED,SAAgB,aAAa,CAC3B,SAAoC,EACpC,OAAwC;IAExC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,YAAY,GAAG,CAAC,EAAE,CAAC;QACzD,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE;QAC1C,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProfilingLevelOperation = void 0;
|
|
4
|
+
const bson_1 = require("../bson");
|
|
5
|
+
const responses_1 = require("../cmap/wire_protocol/responses");
|
|
6
|
+
const error_1 = require("../error");
|
|
7
|
+
const command_1 = require("./command");
|
|
8
|
+
class ProfilingLevelResponse extends responses_1.MongoDBResponse {
|
|
9
|
+
get was() {
|
|
10
|
+
return this.get('was', bson_1.BSONType.int, true);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
class ProfilingLevelOperation extends command_1.CommandOperation {
|
|
15
|
+
constructor(db, options) {
|
|
16
|
+
super(db, options);
|
|
17
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = ProfilingLevelResponse;
|
|
18
|
+
this.options = options;
|
|
19
|
+
}
|
|
20
|
+
get commandName() {
|
|
21
|
+
return 'profile';
|
|
22
|
+
}
|
|
23
|
+
buildCommandDocument(_connection) {
|
|
24
|
+
return { profile: -1 };
|
|
25
|
+
}
|
|
26
|
+
handleOk(response) {
|
|
27
|
+
if (response.ok === 1) {
|
|
28
|
+
const was = response.was;
|
|
29
|
+
if (was === 0)
|
|
30
|
+
return 'off';
|
|
31
|
+
if (was === 1)
|
|
32
|
+
return 'slow_only';
|
|
33
|
+
if (was === 2)
|
|
34
|
+
return 'all';
|
|
35
|
+
throw new error_1.MongoUnexpectedServerResponseError(`Illegal profiling level value ${was}`);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
throw new error_1.MongoUnexpectedServerResponseError('Error with profile command');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.ProfilingLevelOperation = ProfilingLevelOperation;
|
|
43
|
+
//# sourceMappingURL=profiling_level.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiling_level.js","sourceRoot":"","sources":["../../src/operations/profiling_level.ts"],"names":[],"mappings":";;;AAAA,kCAAkD;AAElD,+DAAkE;AAElE,oCAA8D;AAC9D,uCAA2E;AAK3E,MAAM,sBAAuB,SAAQ,2BAAe;IAClD,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,eAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,gBAAgB;AAChB,MAAa,uBAAwB,SAAQ,0BAAwB;IAInE,YAAY,EAAM,EAAE,OAA8B;QAChD,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAJZ,iCAA4B,GAAG,sBAAsB,CAAC;QAK7D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,SAAkB,CAAC;IAC5B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB;QACnD,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;IACzB,CAAC;IAEQ,QAAQ,CAAC,QAAgE;QAChF,IAAI,QAAQ,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;YACzB,IAAI,GAAG,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC5B,IAAI,GAAG,KAAK,CAAC;gBAAE,OAAO,WAAW,CAAC;YAClC,IAAI,GAAG,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC5B,MAAM,IAAI,0CAAkC,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;QACvF,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,0CAAkC,CAAC,4BAA4B,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;CACF;AA5BD,0DA4BC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RemoveUserOperation = void 0;
|
|
4
|
+
const responses_1 = require("../cmap/wire_protocol/responses");
|
|
5
|
+
const command_1 = require("./command");
|
|
6
|
+
const operation_1 = require("./operation");
|
|
7
|
+
/** @internal */
|
|
8
|
+
class RemoveUserOperation extends command_1.CommandOperation {
|
|
9
|
+
constructor(db, username, options) {
|
|
10
|
+
super(db, options);
|
|
11
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.username = username;
|
|
14
|
+
}
|
|
15
|
+
get commandName() {
|
|
16
|
+
return 'dropUser';
|
|
17
|
+
}
|
|
18
|
+
buildCommandDocument(_connection) {
|
|
19
|
+
return { dropUser: this.username };
|
|
20
|
+
}
|
|
21
|
+
handleOk(_response) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.RemoveUserOperation = RemoveUserOperation;
|
|
26
|
+
(0, operation_1.defineAspects)(RemoveUserOperation, [operation_1.Aspect.WRITE_OPERATION]);
|
|
27
|
+
//# sourceMappingURL=remove_user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove_user.js","sourceRoot":"","sources":["../../src/operations/remove_user.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAElE,uCAA2E;AAC3E,2CAAoD;AAKpD,gBAAgB;AAChB,MAAa,mBAAoB,SAAQ,0BAAyB;IAKhE,YAAY,EAAM,EAAE,QAAgB,EAAE,OAA0B;QAC9D,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QALZ,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,UAAmB,CAAC;IAC7B,CAAC;IAEQ,oBAAoB,CAAC,WAAuB;QACnD,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;IAEQ,QAAQ,CAAC,SAAiE;QACjF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAtBD,kDAsBC;AAED,IAAA,yBAAa,EAAC,mBAAmB,EAAE,CAAC,kBAAM,CAAC,eAAe,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenameOperation = void 0;
|
|
4
|
+
const responses_1 = require("../cmap/wire_protocol/responses");
|
|
5
|
+
const collection_1 = require("../collection");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const command_1 = require("./command");
|
|
8
|
+
const operation_1 = require("./operation");
|
|
9
|
+
/** @internal */
|
|
10
|
+
class RenameOperation extends command_1.CommandOperation {
|
|
11
|
+
constructor(collection, newName, options) {
|
|
12
|
+
super(collection, options);
|
|
13
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
14
|
+
this.collection = collection;
|
|
15
|
+
this.newName = newName;
|
|
16
|
+
this.options = options;
|
|
17
|
+
this.ns = new utils_1.MongoDBNamespace('admin', '$cmd');
|
|
18
|
+
}
|
|
19
|
+
get commandName() {
|
|
20
|
+
return 'renameCollection';
|
|
21
|
+
}
|
|
22
|
+
buildCommandDocument(_connection, _session) {
|
|
23
|
+
const renameCollection = this.collection.namespace;
|
|
24
|
+
const to = this.collection.s.namespace.withCollection(this.newName).toString();
|
|
25
|
+
const dropTarget = typeof this.options.dropTarget === 'boolean' ? this.options.dropTarget : false;
|
|
26
|
+
return {
|
|
27
|
+
renameCollection,
|
|
28
|
+
to,
|
|
29
|
+
dropTarget
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
handleOk(_response) {
|
|
33
|
+
return new collection_1.Collection(this.collection.db, this.newName, this.collection.s.options);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.RenameOperation = RenameOperation;
|
|
37
|
+
(0, operation_1.defineAspects)(RenameOperation, [operation_1.Aspect.WRITE_OPERATION]);
|
|
38
|
+
//# sourceMappingURL=rename.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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CAAC;IACrF,CAAC;CACF;AAlCD,0CAkCC;AAED,IAAA,yBAAa,EAAC,eAAe,EAAE,CAAC,kBAAM,CAAC,eAAe,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunCursorCommandOperation = exports.RunCommandOperation = void 0;
|
|
4
|
+
const responses_1 = require("../cmap/wire_protocol/responses");
|
|
5
|
+
const operation_1 = require("../operations/operation");
|
|
6
|
+
/** @internal */
|
|
7
|
+
class RunCommandOperation extends operation_1.AbstractOperation {
|
|
8
|
+
constructor(namespace, command, options) {
|
|
9
|
+
super(options);
|
|
10
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
11
|
+
this.command = command;
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.ns = namespace.withCollection('$cmd');
|
|
14
|
+
}
|
|
15
|
+
get commandName() {
|
|
16
|
+
return 'runCommand';
|
|
17
|
+
}
|
|
18
|
+
buildCommand(_connection, _session) {
|
|
19
|
+
return this.command;
|
|
20
|
+
}
|
|
21
|
+
buildOptions(timeoutContext) {
|
|
22
|
+
return {
|
|
23
|
+
...this.options,
|
|
24
|
+
session: this.session,
|
|
25
|
+
timeoutContext,
|
|
26
|
+
signal: this.options.signal,
|
|
27
|
+
readPreference: this.options.readPreference
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.RunCommandOperation = RunCommandOperation;
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*
|
|
35
|
+
* A specialized subclass of RunCommandOperation for cursor-creating commands.
|
|
36
|
+
*/
|
|
37
|
+
class RunCursorCommandOperation extends RunCommandOperation {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(...arguments);
|
|
40
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.CursorResponse;
|
|
41
|
+
}
|
|
42
|
+
handleOk(response) {
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.RunCursorCommandOperation = RunCursorCommandOperation;
|
|
47
|
+
//# sourceMappingURL=run_command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_command.js","sourceRoot":"","sources":["../../src/operations/run_command.ts"],"names":[],"mappings":";;;AAGA,+DAAkF;AAClF,uDAA4D;AA6B5D,gBAAgB;AAChB,MAAa,mBAAkC,SAAQ,6BAAoB;IAKzE,YAAY,SAA2B,EAAE,OAAiB,EAAE,OAA0B;QACpF,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,YAAqB,CAAC;IAC/B,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,cAAc;YACd,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAC3B,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;SAC5C,CAAC;IACJ,CAAC;CACF;AA7BD,kDA6BC;AAED;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,mBAAmB;IAAlE;;QACW,iCAA4B,GAAG,0BAAc,CAAC;IAOzD,CAAC;IALU,QAAQ,CACf,QAAgE;QAEhE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AARD,8DAQC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateSearchIndexesOperation = void 0;
|
|
4
|
+
const responses_1 = require("../../cmap/wire_protocol/responses");
|
|
5
|
+
const operation_1 = require("../operation");
|
|
6
|
+
/** @internal */
|
|
7
|
+
class CreateSearchIndexesOperation extends operation_1.AbstractOperation {
|
|
8
|
+
constructor(collection, descriptions) {
|
|
9
|
+
super();
|
|
10
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
11
|
+
this.collection = collection;
|
|
12
|
+
this.descriptions = descriptions;
|
|
13
|
+
this.ns = collection.fullNamespace;
|
|
14
|
+
}
|
|
15
|
+
get commandName() {
|
|
16
|
+
return 'createSearchIndexes';
|
|
17
|
+
}
|
|
18
|
+
buildCommand(_connection, _session) {
|
|
19
|
+
const namespace = this.collection.fullNamespace;
|
|
20
|
+
return {
|
|
21
|
+
createSearchIndexes: namespace.collection,
|
|
22
|
+
indexes: this.descriptions
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
handleOk(response) {
|
|
26
|
+
return super.handleOk(response).indexesCreated.map((val) => val.name);
|
|
27
|
+
}
|
|
28
|
+
buildOptions(timeoutContext) {
|
|
29
|
+
return { session: this.session, timeoutContext };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.CreateSearchIndexesOperation = CreateSearchIndexesOperation;
|
|
33
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/operations/search_indexes/create.ts"],"names":[],"mappings":";;;AAEA,kEAAqE;AAKrE,4CAAiD;AAgBjD,gBAAgB;AAChB,MAAa,4BAA6B,SAAQ,6BAA2B;IAK3E,YAAY,UAAsB,EAAE,YAAmD;QACrF,KAAK,EAAE,CAAC;QALD,iCAA4B,GAAG,2BAAe,CAAC;QAMtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,qBAA8B,CAAC;IACxC,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAChD,OAAO;YACL,mBAAmB,EAAE,SAAS,CAAC,UAAU;YACzC,OAAO,EAAE,IAAI,CAAC,YAAY;SAC3B,CAAC;IACJ,CAAC;IAEQ,QAAQ,CAAC,QAAgE;QAChF,OAAO,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAqB,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1F,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnD,CAAC;CACF;AA/BD,oEA+BC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DropSearchIndexOperation = void 0;
|
|
4
|
+
const responses_1 = require("../../cmap/wire_protocol/responses");
|
|
5
|
+
const error_1 = require("../../error");
|
|
6
|
+
const operation_1 = require("../operation");
|
|
7
|
+
/** @internal */
|
|
8
|
+
class DropSearchIndexOperation extends operation_1.AbstractOperation {
|
|
9
|
+
constructor(collection, name) {
|
|
10
|
+
super();
|
|
11
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
12
|
+
this.collection = collection;
|
|
13
|
+
this.name = name;
|
|
14
|
+
this.ns = collection.fullNamespace;
|
|
15
|
+
}
|
|
16
|
+
get commandName() {
|
|
17
|
+
return 'dropSearchIndex';
|
|
18
|
+
}
|
|
19
|
+
buildCommand(_connection, _session) {
|
|
20
|
+
const namespace = this.collection.fullNamespace;
|
|
21
|
+
const command = {
|
|
22
|
+
dropSearchIndex: namespace.collection
|
|
23
|
+
};
|
|
24
|
+
if (typeof this.name === 'string') {
|
|
25
|
+
command.name = this.name;
|
|
26
|
+
}
|
|
27
|
+
return command;
|
|
28
|
+
}
|
|
29
|
+
handleOk(_response) {
|
|
30
|
+
// do nothing
|
|
31
|
+
}
|
|
32
|
+
buildOptions(timeoutContext) {
|
|
33
|
+
return { session: this.session, timeoutContext };
|
|
34
|
+
}
|
|
35
|
+
handleError(error) {
|
|
36
|
+
const isNamespaceNotFoundError = error instanceof error_1.MongoServerError && error.code === error_1.MONGODB_ERROR_CODES.NamespaceNotFound;
|
|
37
|
+
if (!isNamespaceNotFoundError) {
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.DropSearchIndexOperation = DropSearchIndexOperation;
|
|
43
|
+
//# sourceMappingURL=drop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop.js","sourceRoot":"","sources":["../../../src/operations/search_indexes/drop.ts"],"names":[],"mappings":";;;AAEA,kEAAqE;AAErE,uCAAoE;AAIpE,4CAAiD;AAEjD,gBAAgB;AAChB,MAAa,wBAAyB,SAAQ,6BAAuB;IAMnE,YAAY,UAAsB,EAAE,IAAY;QAC9C,KAAK,EAAE,CAAC;QAND,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,iBAA0B,CAAC;IACpC,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAEhD,MAAM,OAAO,GAAa;YACxB,eAAe,EAAE,SAAS,CAAC,UAAU;SACtC,CAAC;QAEF,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAEQ,QAAQ,CAAC,SAA0B;QAC1C,aAAa;IACf,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnD,CAAC;IAEQ,WAAW,CAAC,KAAiB;QACpC,MAAM,wBAAwB,GAC5B,KAAK,YAAY,wBAAgB,IAAI,KAAK,CAAC,IAAI,KAAK,2BAAmB,CAAC,iBAAiB,CAAC;QAC5F,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA9CD,4DA8CC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateSearchIndexOperation = void 0;
|
|
4
|
+
const responses_1 = require("../../cmap/wire_protocol/responses");
|
|
5
|
+
const operation_1 = require("../operation");
|
|
6
|
+
/** @internal */
|
|
7
|
+
class UpdateSearchIndexOperation extends operation_1.AbstractOperation {
|
|
8
|
+
constructor(collection, name, definition) {
|
|
9
|
+
super();
|
|
10
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
11
|
+
this.collection = collection;
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.definition = definition;
|
|
14
|
+
this.ns = collection.fullNamespace;
|
|
15
|
+
}
|
|
16
|
+
get commandName() {
|
|
17
|
+
return 'updateSearchIndex';
|
|
18
|
+
}
|
|
19
|
+
buildCommand(_connection, _session) {
|
|
20
|
+
const namespace = this.collection.fullNamespace;
|
|
21
|
+
return {
|
|
22
|
+
updateSearchIndex: namespace.collection,
|
|
23
|
+
name: this.name,
|
|
24
|
+
definition: this.definition
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
handleOk(_response) {
|
|
28
|
+
// no response.
|
|
29
|
+
}
|
|
30
|
+
buildOptions(timeoutContext) {
|
|
31
|
+
return { session: this.session, timeoutContext };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.UpdateSearchIndexOperation = UpdateSearchIndexOperation;
|
|
35
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/operations/search_indexes/update.ts"],"names":[],"mappings":";;;AAEA,kEAAqE;AAKrE,4CAAiD;AAEjD,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,6BAAuB;IAMrE,YAAY,UAAsB,EAAE,IAAY,EAAE,UAAoB;QACpE,KAAK,EAAE,CAAC;QAND,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,IAAa,WAAW;QACtB,OAAO,mBAA4B,CAAC;IACtC,CAAC;IAEQ,YAAY,CAAC,WAAuB,EAAE,QAAwB;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC;QAChD,OAAO;YACL,iBAAiB,EAAE,SAAS,CAAC,UAAU;YACvC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;IACJ,CAAC;IAEQ,QAAQ,CAAC,SAA0B;QAC1C,eAAe;IACjB,CAAC;IAEQ,YAAY,CAAC,cAA8B;QAClD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnD,CAAC;CACF;AAlCD,gEAkCC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SetProfilingLevelOperation = exports.ProfilingLevel = void 0;
|
|
4
|
+
const responses_1 = require("../cmap/wire_protocol/responses");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const command_1 = require("./command");
|
|
8
|
+
const levelValues = new Set(['off', 'slow_only', 'all']);
|
|
9
|
+
/** @public */
|
|
10
|
+
exports.ProfilingLevel = Object.freeze({
|
|
11
|
+
off: 'off',
|
|
12
|
+
slowOnly: 'slow_only',
|
|
13
|
+
all: 'all'
|
|
14
|
+
});
|
|
15
|
+
/** @internal */
|
|
16
|
+
class SetProfilingLevelOperation extends command_1.CommandOperation {
|
|
17
|
+
constructor(db, level, options) {
|
|
18
|
+
super(db, options);
|
|
19
|
+
this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
|
|
20
|
+
this.options = options;
|
|
21
|
+
switch (level) {
|
|
22
|
+
case exports.ProfilingLevel.off:
|
|
23
|
+
this.profile = 0;
|
|
24
|
+
break;
|
|
25
|
+
case exports.ProfilingLevel.slowOnly:
|
|
26
|
+
this.profile = 1;
|
|
27
|
+
break;
|
|
28
|
+
case exports.ProfilingLevel.all:
|
|
29
|
+
this.profile = 2;
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
this.profile = 0;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
this.level = level;
|
|
36
|
+
}
|
|
37
|
+
get commandName() {
|
|
38
|
+
return 'profile';
|
|
39
|
+
}
|
|
40
|
+
buildCommandDocument(_connection) {
|
|
41
|
+
const level = this.level;
|
|
42
|
+
if (!levelValues.has(level)) {
|
|
43
|
+
// TODO(NODE-3483): Determine error to put here
|
|
44
|
+
throw new error_1.MongoInvalidArgumentError(`Profiling level must be one of "${(0, utils_1.enumToString)(exports.ProfilingLevel)}"`);
|
|
45
|
+
}
|
|
46
|
+
return { profile: this.profile };
|
|
47
|
+
}
|
|
48
|
+
handleOk(_response) {
|
|
49
|
+
return this.level;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.SetProfilingLevelOperation = SetProfilingLevelOperation;
|
|
53
|
+
//# sourceMappingURL=set_profiling_level.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set_profiling_level.js","sourceRoot":"","sources":["../../src/operations/set_profiling_level.ts"],"names":[],"mappings":";;;AAEA,+DAAkE;AAElE,oCAAqD;AACrD,oCAAwC;AACxC,uCAA2E;AAE3E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;AAEzD,cAAc;AACD,QAAA,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1C,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,WAAW;IACrB,GAAG,EAAE,KAAK;CACF,CAAC,CAAC;AAQZ,gBAAgB;AAChB,MAAa,0BAA2B,SAAQ,0BAAgC;IAM9E,YAAY,EAAM,EAAE,KAAqB,EAAE,OAAiC;QAC1E,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QANZ,iCAA4B,GAAG,2BAAe,CAAC;QAOtD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,QAAQ,KAAK,EAAE,CAAC;YACd,KAAK,sBAAc,CAAC,GAAG;gBACrB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;gBACjB,MAAM;YACR,KAAK,sBAAc,CAAC,QAAQ;gBAC1B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;gBACjB,MAAM;YACR,KAAK,sBAAc,CAAC,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