pecunia-root 0.1.1 → 0.1.2
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/dist/adapters/prisma-adapter/index.d.mts +1 -1
- package/dist/adapters/prisma-adapter/index.mjs +1 -1
- package/dist/adapters/prisma-adapter/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -2
- package/dist/index.mjs +1 -2
- package/package.json +2 -16
- package/dist/_virtual/rolldown_runtime.mjs +0 -8
- package/dist/adapters/mongodb-adapter/index.d.mts +0 -35
- package/dist/adapters/mongodb-adapter/index.mjs +0 -314
- package/dist/adapters/mongodb-adapter/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@mongodb-js_saslprep@1.4.4/node_modules/@mongodb-js/saslprep/dist/code-points-data.mjs +0 -14
- package/dist/node_modules/.pnpm/@mongodb-js_saslprep@1.4.4/node_modules/@mongodb-js/saslprep/dist/code-points-data.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@mongodb-js_saslprep@1.4.4/node_modules/@mongodb-js/saslprep/dist/index.mjs +0 -54
- package/dist/node_modules/.pnpm/@mongodb-js_saslprep@1.4.4/node_modules/@mongodb-js/saslprep/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@mongodb-js_saslprep@1.4.4/node_modules/@mongodb-js/saslprep/dist/memory-code-points.mjs +0 -36
- package/dist/node_modules/.pnpm/@mongodb-js_saslprep@1.4.4/node_modules/@mongodb-js/saslprep/dist/memory-code-points.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@mongodb-js_saslprep@1.4.4/node_modules/@mongodb-js/saslprep/dist/node.mjs +0 -27
- package/dist/node_modules/.pnpm/@mongodb-js_saslprep@1.4.4/node_modules/@mongodb-js/saslprep/dist/node.mjs.map +0 -1
- package/dist/node_modules/.pnpm/bson@6.10.4/node_modules/bson/lib/bson.mjs +0 -3728
- package/dist/node_modules/.pnpm/bson@6.10.4/node_modules/bson/lib/bson.mjs.map +0 -1
- package/dist/node_modules/.pnpm/memory-pager@1.5.0/node_modules/memory-pager/index.mjs +0 -137
- package/dist/node_modules/.pnpm/memory-pager@1.5.0/node_modules/memory-pager/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb-connection-string-url@3.0.2/node_modules/mongodb-connection-string-url/lib/index.mjs +0 -211
- package/dist/node_modules/.pnpm/mongodb-connection-string-url@3.0.2/node_modules/mongodb-connection-string-url/lib/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb-connection-string-url@3.0.2/node_modules/mongodb-connection-string-url/lib/redact.mjs +0 -95
- package/dist/node_modules/.pnpm/mongodb-connection-string-url@3.0.2/node_modules/mongodb-connection-string-url/lib/redact.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/admin.mjs +0 -158
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/admin.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/bson.mjs +0 -195
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/bson.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/bulk/common.mjs +0 -710
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/bulk/common.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/bulk/ordered.mjs +0 -53
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/bulk/ordered.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/bulk/unordered.mjs +0 -63
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/bulk/unordered.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/change_stream.mjs +0 -368
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/change_stream.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.mjs +0 -234
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.mjs +0 -545
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/crypto_callbacks.mjs +0 -83
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/crypto_callbacks.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/errors.mjs +0 -146
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/errors.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.mjs +0 -58
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/providers/aws.mjs +0 -30
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/providers/aws.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/providers/azure.mjs +0 -135
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/providers/azure.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/providers/gcp.mjs +0 -25
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/providers/gcp.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/providers/index.mjs +0 -47
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/providers/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/state_machine.mjs +0 -362
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/state_machine.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/auth_provider.mjs +0 -58
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/auth_provider.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.mjs +0 -123
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/gssapi.mjs +0 -128
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/gssapi.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongo_credentials.mjs +0 -133
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongo_credentials.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_aws.mjs +0 -126
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_aws.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.mjs +0 -79
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.mjs +0 -65
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.mjs +0 -127
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.mjs +0 -47
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.mjs +0 -44
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.mjs +0 -101
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.mjs +0 -33
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.mjs +0 -53
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.mjs +0 -29
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.mjs +0 -83
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/plain.mjs +0 -36
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/plain.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/providers.mjs +0 -32
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/providers.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/scram.mjs +0 -206
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/scram.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/x509.mjs +0 -45
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/x509.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/command_monitoring_events.mjs +0 -213
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/command_monitoring_events.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/commands.mjs +0 -411
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/commands.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/connect.mjs +0 -288
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/connect.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/connection.mjs +0 -423
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/connection.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/connection_pool.mjs +0 -483
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/connection_pool.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/connection_pool_events.mjs +0 -207
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/connection_pool_events.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/errors.mjs +0 -116
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/errors.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/handshake/client_metadata.mjs +0 -183
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/handshake/client_metadata.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/metrics.mjs +0 -55
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/metrics.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/stream_description.mjs +0 -60
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/stream_description.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/compression.mjs +0 -139
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/compression.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/constants.mjs +0 -28
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/constants.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/on_data.mjs +0 -117
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/on_data.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.mjs +0 -182
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/responses.mjs +0 -304
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/responses.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/shared.mjs +0 -34
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/wire_protocol/shared.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/collection.mjs +0 -739
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/collection.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/connection_string.mjs +0 -805
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/connection_string.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/constants.mjs +0 -174
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/constants.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/abstract_cursor.mjs +0 -726
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/abstract_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/aggregation_cursor.mjs +0 -172
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/aggregation_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/change_stream_cursor.mjs +0 -103
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/change_stream_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.mjs +0 -66
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/explainable_cursor.mjs +0 -41
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/explainable_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/find_cursor.mjs +0 -365
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/find_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/list_collections_cursor.mjs +0 -50
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/list_collections_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/list_indexes_cursor.mjs +0 -48
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/list_indexes_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.mjs +0 -23
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/run_command_cursor.mjs +0 -106
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cursor/run_command_cursor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/db.mjs +0 -428
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/db.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/deps.mjs +0 -124
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/deps.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/encrypter.mjs +0 -95
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/encrypter.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/error.mjs +0 -1305
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/error.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/explain.mjs +0 -59
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/explain.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/gridfs/download.mjs +0 -250
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/gridfs/download.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/gridfs/index.mjs +0 -170
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/gridfs/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/gridfs/upload.mjs +0 -315
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/gridfs/upload.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/index.mjs +0 -925
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/mongo_client.mjs +0 -520
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/mongo_client.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/mongo_client_auth_providers.mjs +0 -90
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/mongo_client_auth_providers.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/mongo_logger.mjs +0 -582
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/mongo_logger.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/mongo_types.mjs +0 -64
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/mongo_types.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/aggregate.mjs +0 -86
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/aggregate.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.mjs +0 -60
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.mjs +0 -264
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/client_bulk_write/executor.mjs +0 -109
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/client_bulk_write/executor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.mjs +0 -172
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/command.mjs +0 -68
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/command.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/count.mjs +0 -53
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/count.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/create_collection.mjs +0 -123
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/create_collection.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/delete.mjs +0 -119
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/delete.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/distinct.mjs +0 -65
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/distinct.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/drop.mjs +0 -97
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/drop.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/estimated_document_count.mjs +0 -47
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/estimated_document_count.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/execute_operation.mjs +0 -188
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/execute_operation.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/find.mjs +0 -103
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/find.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/find_and_modify.mjs +0 -136
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/find_and_modify.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/get_more.mjs +0 -61
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/get_more.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/indexes.mjs +0 -179
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/indexes.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/insert.mjs +0 -77
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/insert.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/kill_cursors.mjs +0 -48
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/kill_cursors.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/list_collections.mjs +0 -60
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/list_collections.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/list_databases.mjs +0 -43
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/list_databases.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/operation.mjs +0 -105
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/operation.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/profiling_level.mjs +0 -50
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/profiling_level.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/remove_user.mjs +0 -39
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/remove_user.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/rename.mjs +0 -49
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/rename.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/run_command.mjs +0 -58
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/run_command.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/search_indexes/create.mjs +0 -46
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/search_indexes/create.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/search_indexes/drop.mjs +0 -48
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/search_indexes/drop.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/search_indexes/update.mjs +0 -46
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/search_indexes/update.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/set_profiling_level.mjs +0 -67
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/set_profiling_level.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/stats.mjs +0 -37
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/stats.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/update.mjs +0 -171
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/update.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/validate_collection.mjs +0 -45
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/operations/validate_collection.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/read_concern.mjs +0 -71
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/read_concern.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/read_preference.mjs +0 -165
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/read_preference.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/resource_management.mjs +0 -62
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/resource_management.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/common.mjs +0 -51
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/common.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/events.mjs +0 -156
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/events.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/monitor.mjs +0 -477
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/monitor.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/server.mjs +0 -315
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/server.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/server_description.mjs +0 -157
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/server_description.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/server_selection.mjs +0 -184
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/server_selection.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/server_selection_events.mjs +0 -96
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/server_selection_events.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/srv_polling.mjs +0 -107
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/srv_polling.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/topology.mjs +0 -540
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/topology.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/topology_description.mjs +0 -298
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sdam/topology_description.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sessions.mjs +0 -623
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sessions.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sort.mjs +0 -91
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/sort.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/timeout.mjs +0 -254
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/timeout.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/transactions.mjs +0 -138
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/transactions.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/utils.mjs +0 -993
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/utils.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/write_concern.mjs +0 -81
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/write_concern.mjs.map +0 -1
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/package.mjs +0 -171
- package/dist/node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/package.mjs.map +0 -1
- package/dist/node_modules/.pnpm/punycode@2.3.1/node_modules/punycode/punycode.mjs +0 -295
- package/dist/node_modules/.pnpm/punycode@2.3.1/node_modules/punycode/punycode.mjs.map +0 -1
- package/dist/node_modules/.pnpm/sparse-bitfield@3.0.3/node_modules/sparse-bitfield/index.mjs +0 -81
- package/dist/node_modules/.pnpm/sparse-bitfield@3.0.3/node_modules/sparse-bitfield/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/tr46@5.1.1/node_modules/tr46/index.mjs +0 -206
- package/dist/node_modules/.pnpm/tr46@5.1.1/node_modules/tr46/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/tr46@5.1.1/node_modules/tr46/lib/mappingTable.mjs +0 -33590
- package/dist/node_modules/.pnpm/tr46@5.1.1/node_modules/tr46/lib/mappingTable.mjs.map +0 -1
- package/dist/node_modules/.pnpm/tr46@5.1.1/node_modules/tr46/lib/regexes.mjs +0 -37
- package/dist/node_modules/.pnpm/tr46@5.1.1/node_modules/tr46/lib/regexes.mjs.map +0 -1
- package/dist/node_modules/.pnpm/tr46@5.1.1/node_modules/tr46/lib/statusMapping.mjs +0 -18
- package/dist/node_modules/.pnpm/tr46@5.1.1/node_modules/tr46/lib/statusMapping.mjs.map +0 -1
- package/dist/node_modules/.pnpm/webidl-conversions@7.0.0/node_modules/webidl-conversions/lib/index.mjs +0 -252
- package/dist/node_modules/.pnpm/webidl-conversions@7.0.0/node_modules/webidl-conversions/lib/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/index.mjs +0 -41
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/Function.mjs +0 -41
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/Function.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URL-impl.mjs +0 -173
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URL-impl.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URL.mjs +0 -334
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URL.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URLSearchParams-impl.mjs +0 -90
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URLSearchParams-impl.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URLSearchParams.mjs +0 -356
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/URLSearchParams.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/encoding.mjs +0 -23
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/encoding.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/infra.mjs +0 -29
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/infra.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/percent-encoding.mjs +0 -140
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/percent-encoding.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/url-state-machine.mjs +0 -831
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/url-state-machine.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/urlencoded.mjs +0 -77
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/urlencoded.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/utils.mjs +0 -147
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/lib/utils.mjs.map +0 -1
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/webidl2js-wrapper.mjs +0 -17
- package/dist/node_modules/.pnpm/whatwg-url@14.2.0/node_modules/whatwg-url/webidl2js-wrapper.mjs.map +0 -1
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin, __require } from "../../../../../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
-
import { require_bson } from "../bson.mjs";
|
|
3
|
-
import { require_error } from "../error.mjs";
|
|
4
|
-
import { require_utils } from "../utils.mjs";
|
|
5
|
-
import { require_timeout } from "../timeout.mjs";
|
|
6
|
-
import { require_deps } from "../deps.mjs";
|
|
7
|
-
import { require_errors } from "./errors.mjs";
|
|
8
|
-
import { require_client_encryption } from "./client_encryption.mjs";
|
|
9
|
-
import { require_abstract_cursor } from "../cursor/abstract_cursor.mjs";
|
|
10
|
-
|
|
11
|
-
//#region ../../node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/state_machine.js
|
|
12
|
-
var require_state_machine = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.StateMachine = void 0;
|
|
15
|
-
const fs = __require("fs/promises");
|
|
16
|
-
const net = __require("net");
|
|
17
|
-
const tls = __require("tls");
|
|
18
|
-
const bson_1 = require_bson();
|
|
19
|
-
const abstract_cursor_1 = require_abstract_cursor();
|
|
20
|
-
const deps_1 = require_deps();
|
|
21
|
-
const error_1 = require_error();
|
|
22
|
-
const timeout_1 = require_timeout();
|
|
23
|
-
const utils_1 = require_utils();
|
|
24
|
-
const client_encryption_1 = require_client_encryption();
|
|
25
|
-
const errors_1 = require_errors();
|
|
26
|
-
let socks = null;
|
|
27
|
-
function loadSocks() {
|
|
28
|
-
if (socks == null) {
|
|
29
|
-
const socksImport = (0, deps_1.getSocks)();
|
|
30
|
-
if ("kModuleError" in socksImport) throw socksImport.kModuleError;
|
|
31
|
-
socks = socksImport;
|
|
32
|
-
}
|
|
33
|
-
return socks;
|
|
34
|
-
}
|
|
35
|
-
const MONGOCRYPT_CTX_ERROR = 0;
|
|
36
|
-
const MONGOCRYPT_CTX_NEED_MONGO_COLLINFO = 1;
|
|
37
|
-
const MONGOCRYPT_CTX_NEED_MONGO_MARKINGS = 2;
|
|
38
|
-
const MONGOCRYPT_CTX_NEED_MONGO_KEYS = 3;
|
|
39
|
-
const MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS = 7;
|
|
40
|
-
const MONGOCRYPT_CTX_NEED_KMS = 4;
|
|
41
|
-
const MONGOCRYPT_CTX_READY = 5;
|
|
42
|
-
const MONGOCRYPT_CTX_DONE = 6;
|
|
43
|
-
const HTTPS_PORT = 443;
|
|
44
|
-
const stateToString = new Map([
|
|
45
|
-
[MONGOCRYPT_CTX_ERROR, "MONGOCRYPT_CTX_ERROR"],
|
|
46
|
-
[MONGOCRYPT_CTX_NEED_MONGO_COLLINFO, "MONGOCRYPT_CTX_NEED_MONGO_COLLINFO"],
|
|
47
|
-
[MONGOCRYPT_CTX_NEED_MONGO_MARKINGS, "MONGOCRYPT_CTX_NEED_MONGO_MARKINGS"],
|
|
48
|
-
[MONGOCRYPT_CTX_NEED_MONGO_KEYS, "MONGOCRYPT_CTX_NEED_MONGO_KEYS"],
|
|
49
|
-
[MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS, "MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS"],
|
|
50
|
-
[MONGOCRYPT_CTX_NEED_KMS, "MONGOCRYPT_CTX_NEED_KMS"],
|
|
51
|
-
[MONGOCRYPT_CTX_READY, "MONGOCRYPT_CTX_READY"],
|
|
52
|
-
[MONGOCRYPT_CTX_DONE, "MONGOCRYPT_CTX_DONE"]
|
|
53
|
-
]);
|
|
54
|
-
const INSECURE_TLS_OPTIONS = [
|
|
55
|
-
"tlsInsecure",
|
|
56
|
-
"tlsAllowInvalidCertificates",
|
|
57
|
-
"tlsAllowInvalidHostnames"
|
|
58
|
-
];
|
|
59
|
-
/**
|
|
60
|
-
* Helper function for logging. Enabled by setting the environment flag MONGODB_CRYPT_DEBUG.
|
|
61
|
-
* @param msg - Anything you want to be logged.
|
|
62
|
-
*/
|
|
63
|
-
function debug(msg) {
|
|
64
|
-
if (process.env.MONGODB_CRYPT_DEBUG) console.error(msg);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* This is kind of a hack. For `rewrapManyDataKey`, we have tests that
|
|
68
|
-
* guarantee that when there are no matching keys, `rewrapManyDataKey` returns
|
|
69
|
-
* nothing. We also have tests for auto encryption that guarantee for `encrypt`
|
|
70
|
-
* we return an error when there are no matching keys. This error is generated in
|
|
71
|
-
* subsequent iterations of the state machine.
|
|
72
|
-
* Some apis (`encrypt`) throw if there are no filter matches and others (`rewrapManyDataKey`)
|
|
73
|
-
* do not. We set the result manually here, and let the state machine continue. `libmongocrypt`
|
|
74
|
-
* will inform us if we need to error by setting the state to `MONGOCRYPT_CTX_ERROR` but
|
|
75
|
-
* otherwise we'll return `{ v: [] }`.
|
|
76
|
-
*/
|
|
77
|
-
let EMPTY_V;
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
* An internal class that executes across a MongoCryptContext until either
|
|
81
|
-
* a finishing state or an error is reached. Do not instantiate directly.
|
|
82
|
-
*/
|
|
83
|
-
var StateMachine = class {
|
|
84
|
-
constructor(options, bsonOptions = (0, bson_1.pluckBSONSerializeOptions)(options)) {
|
|
85
|
-
this.options = options;
|
|
86
|
-
this.bsonOptions = bsonOptions;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Executes the state machine according to the specification
|
|
90
|
-
*/
|
|
91
|
-
async execute(executor, context, options) {
|
|
92
|
-
const keyVaultNamespace = executor._keyVaultNamespace;
|
|
93
|
-
const keyVaultClient = executor._keyVaultClient;
|
|
94
|
-
const metaDataClient = executor._metaDataClient;
|
|
95
|
-
const mongocryptdClient = executor._mongocryptdClient;
|
|
96
|
-
const mongocryptdManager = executor._mongocryptdManager;
|
|
97
|
-
let result = null;
|
|
98
|
-
const getStatus = () => context.status;
|
|
99
|
-
const getState = () => context.state;
|
|
100
|
-
while (getState() !== MONGOCRYPT_CTX_DONE && getState() !== MONGOCRYPT_CTX_ERROR) {
|
|
101
|
-
options.signal?.throwIfAborted();
|
|
102
|
-
debug(`[context#${context.id}] ${stateToString.get(getState()) || getState()}`);
|
|
103
|
-
switch (getState()) {
|
|
104
|
-
case MONGOCRYPT_CTX_NEED_MONGO_COLLINFO: {
|
|
105
|
-
const filter = (0, bson_1.deserialize)(context.nextMongoOperation());
|
|
106
|
-
if (!metaDataClient) throw new errors_1.MongoCryptError("unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_COLLINFO but metadata client is undefined");
|
|
107
|
-
const collInfoCursor = this.fetchCollectionInfo(metaDataClient, context.ns, filter, options);
|
|
108
|
-
for await (const collInfo of collInfoCursor) {
|
|
109
|
-
context.addMongoOperationResponse((0, bson_1.serialize)(collInfo));
|
|
110
|
-
if (getState() === MONGOCRYPT_CTX_ERROR) break;
|
|
111
|
-
}
|
|
112
|
-
if (getState() === MONGOCRYPT_CTX_ERROR) break;
|
|
113
|
-
context.finishMongoOperation();
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
case MONGOCRYPT_CTX_NEED_MONGO_MARKINGS: {
|
|
117
|
-
const command = context.nextMongoOperation();
|
|
118
|
-
if (getState() === MONGOCRYPT_CTX_ERROR) break;
|
|
119
|
-
if (!mongocryptdClient) throw new errors_1.MongoCryptError("unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_MARKINGS but mongocryptdClient is undefined");
|
|
120
|
-
const markedCommand = mongocryptdManager ? await mongocryptdManager.withRespawn(this.markCommand.bind(this, mongocryptdClient, context.ns, command, options)) : await this.markCommand(mongocryptdClient, context.ns, command, options);
|
|
121
|
-
context.addMongoOperationResponse(markedCommand);
|
|
122
|
-
context.finishMongoOperation();
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
case MONGOCRYPT_CTX_NEED_MONGO_KEYS: {
|
|
126
|
-
const filter = context.nextMongoOperation();
|
|
127
|
-
const keys = await this.fetchKeys(keyVaultClient, keyVaultNamespace, filter, options);
|
|
128
|
-
if (keys.length === 0) result = EMPTY_V ??= (0, bson_1.serialize)({ v: [] });
|
|
129
|
-
for (const key of keys) context.addMongoOperationResponse((0, bson_1.serialize)(key));
|
|
130
|
-
context.finishMongoOperation();
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
case MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS: {
|
|
134
|
-
const kmsProviders = await executor.askForKMSCredentials();
|
|
135
|
-
context.provideKMSProviders((0, bson_1.serialize)(kmsProviders));
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
case MONGOCRYPT_CTX_NEED_KMS:
|
|
139
|
-
await Promise.all(this.requests(context, options));
|
|
140
|
-
context.finishKMSRequests();
|
|
141
|
-
break;
|
|
142
|
-
case MONGOCRYPT_CTX_READY: {
|
|
143
|
-
const finalizedContext = context.finalize();
|
|
144
|
-
if (getState() === MONGOCRYPT_CTX_ERROR) {
|
|
145
|
-
const message = getStatus().message || "Finalization error";
|
|
146
|
-
throw new errors_1.MongoCryptError(message);
|
|
147
|
-
}
|
|
148
|
-
result = finalizedContext;
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
default: throw new errors_1.MongoCryptError(`Unknown state: ${getState()}`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (getState() === MONGOCRYPT_CTX_ERROR || result == null) {
|
|
155
|
-
const message = getStatus().message;
|
|
156
|
-
if (!message) debug(`unidentifiable error in MongoCrypt - received an error status from \`libmongocrypt\` but received no error message.`);
|
|
157
|
-
throw new errors_1.MongoCryptError(message ?? "unidentifiable error in MongoCrypt - received an error status from `libmongocrypt` but received no error message.");
|
|
158
|
-
}
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Handles the request to the KMS service. Exposed for testing purposes. Do not directly invoke.
|
|
163
|
-
* @param kmsContext - A C++ KMS context returned from the bindings
|
|
164
|
-
* @returns A promise that resolves when the KMS reply has be fully parsed
|
|
165
|
-
*/
|
|
166
|
-
async kmsRequest(request, options) {
|
|
167
|
-
const parsedUrl = request.endpoint.split(":");
|
|
168
|
-
const port = parsedUrl[1] != null ? Number.parseInt(parsedUrl[1], 10) : HTTPS_PORT;
|
|
169
|
-
const socketOptions = {
|
|
170
|
-
host: parsedUrl[0],
|
|
171
|
-
servername: parsedUrl[0],
|
|
172
|
-
port,
|
|
173
|
-
...(0, client_encryption_1.autoSelectSocketOptions)(this.options.socketOptions || {})
|
|
174
|
-
};
|
|
175
|
-
const message = request.message;
|
|
176
|
-
const buffer = new utils_1.BufferPool();
|
|
177
|
-
let netSocket;
|
|
178
|
-
let socket;
|
|
179
|
-
function destroySockets() {
|
|
180
|
-
for (const sock of [socket, netSocket]) if (sock) sock.destroy();
|
|
181
|
-
}
|
|
182
|
-
function onerror(cause) {
|
|
183
|
-
return new errors_1.MongoCryptError("KMS request failed", { cause });
|
|
184
|
-
}
|
|
185
|
-
function onclose() {
|
|
186
|
-
return new errors_1.MongoCryptError("KMS request closed");
|
|
187
|
-
}
|
|
188
|
-
const tlsOptions = this.options.tlsOptions;
|
|
189
|
-
if (tlsOptions) {
|
|
190
|
-
const kmsProvider = request.kmsProvider;
|
|
191
|
-
const providerTlsOptions = tlsOptions[kmsProvider];
|
|
192
|
-
if (providerTlsOptions) {
|
|
193
|
-
const error = this.validateTlsOptions(kmsProvider, providerTlsOptions);
|
|
194
|
-
if (error) throw error;
|
|
195
|
-
try {
|
|
196
|
-
await this.setTlsOptions(providerTlsOptions, socketOptions);
|
|
197
|
-
} catch (err) {
|
|
198
|
-
throw onerror(err);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
let abortListener;
|
|
203
|
-
try {
|
|
204
|
-
if (this.options.proxyOptions && this.options.proxyOptions.proxyHost) {
|
|
205
|
-
netSocket = new net.Socket();
|
|
206
|
-
const { promise: willConnect, reject: rejectOnNetSocketError, resolve: resolveOnNetSocketConnect } = (0, utils_1.promiseWithResolvers)();
|
|
207
|
-
netSocket.once("error", (err) => rejectOnNetSocketError(onerror(err))).once("close", () => rejectOnNetSocketError(onclose())).once("connect", () => resolveOnNetSocketConnect());
|
|
208
|
-
const netSocketOptions = {
|
|
209
|
-
...socketOptions,
|
|
210
|
-
host: this.options.proxyOptions.proxyHost,
|
|
211
|
-
port: this.options.proxyOptions.proxyPort || 1080
|
|
212
|
-
};
|
|
213
|
-
netSocket.connect(netSocketOptions);
|
|
214
|
-
await willConnect;
|
|
215
|
-
try {
|
|
216
|
-
socks ??= loadSocks();
|
|
217
|
-
socketOptions.socket = (await socks.SocksClient.createConnection({
|
|
218
|
-
existing_socket: netSocket,
|
|
219
|
-
command: "connect",
|
|
220
|
-
destination: {
|
|
221
|
-
host: socketOptions.host,
|
|
222
|
-
port: socketOptions.port
|
|
223
|
-
},
|
|
224
|
-
proxy: {
|
|
225
|
-
host: "iLoveJavaScript",
|
|
226
|
-
port: 0,
|
|
227
|
-
type: 5,
|
|
228
|
-
userId: this.options.proxyOptions.proxyUsername,
|
|
229
|
-
password: this.options.proxyOptions.proxyPassword
|
|
230
|
-
}
|
|
231
|
-
})).socket;
|
|
232
|
-
} catch (err) {
|
|
233
|
-
throw onerror(err);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
socket = tls.connect(socketOptions, () => {
|
|
237
|
-
socket.write(message);
|
|
238
|
-
});
|
|
239
|
-
const { promise: willResolveKmsRequest, reject: rejectOnTlsSocketError, resolve } = (0, utils_1.promiseWithResolvers)();
|
|
240
|
-
abortListener = (0, utils_1.addAbortListener)(options?.signal, function() {
|
|
241
|
-
destroySockets();
|
|
242
|
-
rejectOnTlsSocketError(this.reason);
|
|
243
|
-
});
|
|
244
|
-
socket.once("error", (err) => rejectOnTlsSocketError(onerror(err))).once("close", () => rejectOnTlsSocketError(onclose())).on("data", (data) => {
|
|
245
|
-
buffer.append(data);
|
|
246
|
-
while (request.bytesNeeded > 0 && buffer.length) {
|
|
247
|
-
const bytesNeeded = Math.min(request.bytesNeeded, buffer.length);
|
|
248
|
-
request.addResponse(buffer.read(bytesNeeded));
|
|
249
|
-
}
|
|
250
|
-
if (request.bytesNeeded <= 0) resolve();
|
|
251
|
-
});
|
|
252
|
-
await (options?.timeoutContext?.csotEnabled() ? Promise.all([willResolveKmsRequest, timeout_1.Timeout.expires(options.timeoutContext?.remainingTimeMS)]) : willResolveKmsRequest);
|
|
253
|
-
} catch (error) {
|
|
254
|
-
if (error instanceof timeout_1.TimeoutError) throw new error_1.MongoOperationTimeoutError("KMS request timed out");
|
|
255
|
-
throw error;
|
|
256
|
-
} finally {
|
|
257
|
-
destroySockets();
|
|
258
|
-
abortListener?.[utils_1.kDispose]();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
*requests(context, options) {
|
|
262
|
-
for (let request = context.nextKMSRequest(); request != null; request = context.nextKMSRequest()) yield this.kmsRequest(request, options);
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Validates the provided TLS options are secure.
|
|
266
|
-
*
|
|
267
|
-
* @param kmsProvider - The KMS provider name.
|
|
268
|
-
* @param tlsOptions - The client TLS options for the provider.
|
|
269
|
-
*
|
|
270
|
-
* @returns An error if any option is invalid.
|
|
271
|
-
*/
|
|
272
|
-
validateTlsOptions(kmsProvider, tlsOptions) {
|
|
273
|
-
const tlsOptionNames = Object.keys(tlsOptions);
|
|
274
|
-
for (const option of INSECURE_TLS_OPTIONS) if (tlsOptionNames.includes(option)) return new errors_1.MongoCryptError(`Insecure TLS options prohibited for ${kmsProvider}: ${option}`);
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Sets only the valid secure TLS options.
|
|
278
|
-
*
|
|
279
|
-
* @param tlsOptions - The client TLS options for the provider.
|
|
280
|
-
* @param options - The existing connection options.
|
|
281
|
-
*/
|
|
282
|
-
async setTlsOptions(tlsOptions, options) {
|
|
283
|
-
if (tlsOptions.secureContext) options.secureContext = tlsOptions.secureContext;
|
|
284
|
-
if (tlsOptions.tlsCertificateKeyFile) options.cert = options.key = await fs.readFile(tlsOptions.tlsCertificateKeyFile);
|
|
285
|
-
if (tlsOptions.tlsCAFile) options.ca = await fs.readFile(tlsOptions.tlsCAFile);
|
|
286
|
-
if (tlsOptions.tlsCertificateKeyFilePassword) options.passphrase = tlsOptions.tlsCertificateKeyFilePassword;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Fetches collection info for a provided namespace, when libmongocrypt
|
|
290
|
-
* enters the `MONGOCRYPT_CTX_NEED_MONGO_COLLINFO` state. The result is
|
|
291
|
-
* used to inform libmongocrypt of the schema associated with this
|
|
292
|
-
* namespace. Exposed for testing purposes. Do not directly invoke.
|
|
293
|
-
*
|
|
294
|
-
* @param client - A MongoClient connected to the topology
|
|
295
|
-
* @param ns - The namespace to list collections from
|
|
296
|
-
* @param filter - A filter for the listCollections command
|
|
297
|
-
* @param callback - Invoked with the info of the requested collection, or with an error
|
|
298
|
-
*/
|
|
299
|
-
fetchCollectionInfo(client, ns, filter, options) {
|
|
300
|
-
const { db } = utils_1.MongoDBCollectionNamespace.fromString(ns);
|
|
301
|
-
return client.db(db).listCollections(filter, {
|
|
302
|
-
promoteLongs: false,
|
|
303
|
-
promoteValues: false,
|
|
304
|
-
timeoutContext: options?.timeoutContext && new abstract_cursor_1.CursorTimeoutContext(options?.timeoutContext, Symbol()),
|
|
305
|
-
signal: options?.signal,
|
|
306
|
-
nameOnly: false
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Calls to the mongocryptd to provide markings for a command.
|
|
311
|
-
* Exposed for testing purposes. Do not directly invoke.
|
|
312
|
-
* @param client - A MongoClient connected to a mongocryptd
|
|
313
|
-
* @param ns - The namespace (database.collection) the command is being executed on
|
|
314
|
-
* @param command - The command to execute.
|
|
315
|
-
* @param callback - Invoked with the serialized and marked bson command, or with an error
|
|
316
|
-
*/
|
|
317
|
-
async markCommand(client, ns, command, options) {
|
|
318
|
-
const { db } = utils_1.MongoDBCollectionNamespace.fromString(ns);
|
|
319
|
-
const bsonOptions = {
|
|
320
|
-
promoteLongs: false,
|
|
321
|
-
promoteValues: false
|
|
322
|
-
};
|
|
323
|
-
const rawCommand = (0, bson_1.deserialize)(command, bsonOptions);
|
|
324
|
-
const commandOptions = {
|
|
325
|
-
timeoutMS: void 0,
|
|
326
|
-
signal: void 0
|
|
327
|
-
};
|
|
328
|
-
if (options?.timeoutContext?.csotEnabled()) commandOptions.timeoutMS = options.timeoutContext.remainingTimeMS;
|
|
329
|
-
if (options?.signal) commandOptions.signal = options.signal;
|
|
330
|
-
const response = await client.db(db).command(rawCommand, {
|
|
331
|
-
...bsonOptions,
|
|
332
|
-
...commandOptions
|
|
333
|
-
});
|
|
334
|
-
return (0, bson_1.serialize)(response, this.bsonOptions);
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Requests keys from the keyVault collection on the topology.
|
|
338
|
-
* Exposed for testing purposes. Do not directly invoke.
|
|
339
|
-
* @param client - A MongoClient connected to the topology
|
|
340
|
-
* @param keyVaultNamespace - The namespace (database.collection) of the keyVault Collection
|
|
341
|
-
* @param filter - The filter for the find query against the keyVault Collection
|
|
342
|
-
* @param callback - Invoked with the found keys, or with an error
|
|
343
|
-
*/
|
|
344
|
-
fetchKeys(client, keyVaultNamespace, filter, options) {
|
|
345
|
-
const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(keyVaultNamespace);
|
|
346
|
-
const commandOptions = {
|
|
347
|
-
timeoutContext: void 0,
|
|
348
|
-
signal: void 0
|
|
349
|
-
};
|
|
350
|
-
if (options?.timeoutContext != null) commandOptions.timeoutContext = new abstract_cursor_1.CursorTimeoutContext(options.timeoutContext, Symbol());
|
|
351
|
-
if (options?.signal != null) commandOptions.signal = options.signal;
|
|
352
|
-
return client.db(dbName).collection(collectionName, { readConcern: { level: "majority" } }).find((0, bson_1.deserialize)(filter), commandOptions).toArray();
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
exports.StateMachine = StateMachine;
|
|
356
|
-
}));
|
|
357
|
-
|
|
358
|
-
//#endregion
|
|
359
|
-
export default require_state_machine();
|
|
360
|
-
|
|
361
|
-
export { require_state_machine };
|
|
362
|
-
//# sourceMappingURL=state_machine.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state_machine.mjs","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/client-side-encryption/state_machine.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.StateMachine = void 0;\nconst fs = require(\"fs/promises\");\nconst net = require(\"net\");\nconst tls = require(\"tls\");\nconst bson_1 = require(\"../bson\");\nconst abstract_cursor_1 = require(\"../cursor/abstract_cursor\");\nconst deps_1 = require(\"../deps\");\nconst error_1 = require(\"../error\");\nconst timeout_1 = require(\"../timeout\");\nconst utils_1 = require(\"../utils\");\nconst client_encryption_1 = require(\"./client_encryption\");\nconst errors_1 = require(\"./errors\");\nlet socks = null;\nfunction loadSocks() {\n if (socks == null) {\n const socksImport = (0, deps_1.getSocks)();\n if ('kModuleError' in socksImport) {\n throw socksImport.kModuleError;\n }\n socks = socksImport;\n }\n return socks;\n}\n// libmongocrypt states\nconst MONGOCRYPT_CTX_ERROR = 0;\nconst MONGOCRYPT_CTX_NEED_MONGO_COLLINFO = 1;\nconst MONGOCRYPT_CTX_NEED_MONGO_MARKINGS = 2;\nconst MONGOCRYPT_CTX_NEED_MONGO_KEYS = 3;\nconst MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS = 7;\nconst MONGOCRYPT_CTX_NEED_KMS = 4;\nconst MONGOCRYPT_CTX_READY = 5;\nconst MONGOCRYPT_CTX_DONE = 6;\nconst HTTPS_PORT = 443;\nconst stateToString = new Map([\n [MONGOCRYPT_CTX_ERROR, 'MONGOCRYPT_CTX_ERROR'],\n [MONGOCRYPT_CTX_NEED_MONGO_COLLINFO, 'MONGOCRYPT_CTX_NEED_MONGO_COLLINFO'],\n [MONGOCRYPT_CTX_NEED_MONGO_MARKINGS, 'MONGOCRYPT_CTX_NEED_MONGO_MARKINGS'],\n [MONGOCRYPT_CTX_NEED_MONGO_KEYS, 'MONGOCRYPT_CTX_NEED_MONGO_KEYS'],\n [MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS, 'MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS'],\n [MONGOCRYPT_CTX_NEED_KMS, 'MONGOCRYPT_CTX_NEED_KMS'],\n [MONGOCRYPT_CTX_READY, 'MONGOCRYPT_CTX_READY'],\n [MONGOCRYPT_CTX_DONE, 'MONGOCRYPT_CTX_DONE']\n]);\nconst INSECURE_TLS_OPTIONS = [\n 'tlsInsecure',\n 'tlsAllowInvalidCertificates',\n 'tlsAllowInvalidHostnames'\n];\n/**\n * Helper function for logging. Enabled by setting the environment flag MONGODB_CRYPT_DEBUG.\n * @param msg - Anything you want to be logged.\n */\nfunction debug(msg) {\n if (process.env.MONGODB_CRYPT_DEBUG) {\n // eslint-disable-next-line no-console\n console.error(msg);\n }\n}\n/**\n * This is kind of a hack. For `rewrapManyDataKey`, we have tests that\n * guarantee that when there are no matching keys, `rewrapManyDataKey` returns\n * nothing. We also have tests for auto encryption that guarantee for `encrypt`\n * we return an error when there are no matching keys. This error is generated in\n * subsequent iterations of the state machine.\n * Some apis (`encrypt`) throw if there are no filter matches and others (`rewrapManyDataKey`)\n * do not. We set the result manually here, and let the state machine continue. `libmongocrypt`\n * will inform us if we need to error by setting the state to `MONGOCRYPT_CTX_ERROR` but\n * otherwise we'll return `{ v: [] }`.\n */\nlet EMPTY_V;\n/**\n * @internal\n * An internal class that executes across a MongoCryptContext until either\n * a finishing state or an error is reached. Do not instantiate directly.\n */\n// TODO(DRIVERS-2671): clarify CSOT behavior for FLE APIs\nclass StateMachine {\n constructor(options, bsonOptions = (0, bson_1.pluckBSONSerializeOptions)(options)) {\n this.options = options;\n this.bsonOptions = bsonOptions;\n }\n /**\n * Executes the state machine according to the specification\n */\n async execute(executor, context, options) {\n const keyVaultNamespace = executor._keyVaultNamespace;\n const keyVaultClient = executor._keyVaultClient;\n const metaDataClient = executor._metaDataClient;\n const mongocryptdClient = executor._mongocryptdClient;\n const mongocryptdManager = executor._mongocryptdManager;\n let result = null;\n // Typescript treats getters just like properties: Once you've tested it for equality\n // it cannot change. Which is exactly the opposite of what we use state and status for.\n // Every call to at least `addMongoOperationResponse` and `finalize` can change the state.\n // These wrappers let us write code more naturally and not add compiler exceptions\n // to conditions checks inside the state machine.\n const getStatus = () => context.status;\n const getState = () => context.state;\n while (getState() !== MONGOCRYPT_CTX_DONE && getState() !== MONGOCRYPT_CTX_ERROR) {\n options.signal?.throwIfAborted();\n debug(`[context#${context.id}] ${stateToString.get(getState()) || getState()}`);\n switch (getState()) {\n case MONGOCRYPT_CTX_NEED_MONGO_COLLINFO: {\n const filter = (0, bson_1.deserialize)(context.nextMongoOperation());\n if (!metaDataClient) {\n throw new errors_1.MongoCryptError('unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_COLLINFO but metadata client is undefined');\n }\n const collInfoCursor = this.fetchCollectionInfo(metaDataClient, context.ns, filter, options);\n for await (const collInfo of collInfoCursor) {\n context.addMongoOperationResponse((0, bson_1.serialize)(collInfo));\n if (getState() === MONGOCRYPT_CTX_ERROR)\n break;\n }\n if (getState() === MONGOCRYPT_CTX_ERROR)\n break;\n context.finishMongoOperation();\n break;\n }\n case MONGOCRYPT_CTX_NEED_MONGO_MARKINGS: {\n const command = context.nextMongoOperation();\n if (getState() === MONGOCRYPT_CTX_ERROR)\n break;\n if (!mongocryptdClient) {\n throw new errors_1.MongoCryptError('unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_MARKINGS but mongocryptdClient is undefined');\n }\n // When we are using the shared library, we don't have a mongocryptd manager.\n const markedCommand = mongocryptdManager\n ? await mongocryptdManager.withRespawn(this.markCommand.bind(this, mongocryptdClient, context.ns, command, options))\n : await this.markCommand(mongocryptdClient, context.ns, command, options);\n context.addMongoOperationResponse(markedCommand);\n context.finishMongoOperation();\n break;\n }\n case MONGOCRYPT_CTX_NEED_MONGO_KEYS: {\n const filter = context.nextMongoOperation();\n const keys = await this.fetchKeys(keyVaultClient, keyVaultNamespace, filter, options);\n if (keys.length === 0) {\n // See docs on EMPTY_V\n result = EMPTY_V ??= (0, bson_1.serialize)({ v: [] });\n }\n for (const key of keys) {\n context.addMongoOperationResponse((0, bson_1.serialize)(key));\n }\n context.finishMongoOperation();\n break;\n }\n case MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS: {\n const kmsProviders = await executor.askForKMSCredentials();\n context.provideKMSProviders((0, bson_1.serialize)(kmsProviders));\n break;\n }\n case MONGOCRYPT_CTX_NEED_KMS: {\n await Promise.all(this.requests(context, options));\n context.finishKMSRequests();\n break;\n }\n case MONGOCRYPT_CTX_READY: {\n const finalizedContext = context.finalize();\n if (getState() === MONGOCRYPT_CTX_ERROR) {\n const message = getStatus().message || 'Finalization error';\n throw new errors_1.MongoCryptError(message);\n }\n result = finalizedContext;\n break;\n }\n default:\n throw new errors_1.MongoCryptError(`Unknown state: ${getState()}`);\n }\n }\n if (getState() === MONGOCRYPT_CTX_ERROR || result == null) {\n const message = getStatus().message;\n if (!message) {\n debug(`unidentifiable error in MongoCrypt - received an error status from \\`libmongocrypt\\` but received no error message.`);\n }\n throw new errors_1.MongoCryptError(message ??\n 'unidentifiable error in MongoCrypt - received an error status from `libmongocrypt` but received no error message.');\n }\n return result;\n }\n /**\n * Handles the request to the KMS service. Exposed for testing purposes. Do not directly invoke.\n * @param kmsContext - A C++ KMS context returned from the bindings\n * @returns A promise that resolves when the KMS reply has be fully parsed\n */\n async kmsRequest(request, options) {\n const parsedUrl = request.endpoint.split(':');\n const port = parsedUrl[1] != null ? Number.parseInt(parsedUrl[1], 10) : HTTPS_PORT;\n const socketOptions = {\n host: parsedUrl[0],\n servername: parsedUrl[0],\n port,\n ...(0, client_encryption_1.autoSelectSocketOptions)(this.options.socketOptions || {})\n };\n const message = request.message;\n const buffer = new utils_1.BufferPool();\n let netSocket;\n let socket;\n function destroySockets() {\n for (const sock of [socket, netSocket]) {\n if (sock) {\n sock.destroy();\n }\n }\n }\n function onerror(cause) {\n return new errors_1.MongoCryptError('KMS request failed', { cause });\n }\n function onclose() {\n return new errors_1.MongoCryptError('KMS request closed');\n }\n const tlsOptions = this.options.tlsOptions;\n if (tlsOptions) {\n const kmsProvider = request.kmsProvider;\n const providerTlsOptions = tlsOptions[kmsProvider];\n if (providerTlsOptions) {\n const error = this.validateTlsOptions(kmsProvider, providerTlsOptions);\n if (error) {\n throw error;\n }\n try {\n await this.setTlsOptions(providerTlsOptions, socketOptions);\n }\n catch (err) {\n throw onerror(err);\n }\n }\n }\n let abortListener;\n try {\n if (this.options.proxyOptions && this.options.proxyOptions.proxyHost) {\n netSocket = new net.Socket();\n const { promise: willConnect, reject: rejectOnNetSocketError, resolve: resolveOnNetSocketConnect } = (0, utils_1.promiseWithResolvers)();\n netSocket\n .once('error', err => rejectOnNetSocketError(onerror(err)))\n .once('close', () => rejectOnNetSocketError(onclose()))\n .once('connect', () => resolveOnNetSocketConnect());\n const netSocketOptions = {\n ...socketOptions,\n host: this.options.proxyOptions.proxyHost,\n port: this.options.proxyOptions.proxyPort || 1080\n };\n netSocket.connect(netSocketOptions);\n await willConnect;\n try {\n socks ??= loadSocks();\n socketOptions.socket = (await socks.SocksClient.createConnection({\n existing_socket: netSocket,\n command: 'connect',\n destination: { host: socketOptions.host, port: socketOptions.port },\n proxy: {\n // host and port are ignored because we pass existing_socket\n host: 'iLoveJavaScript',\n port: 0,\n type: 5,\n userId: this.options.proxyOptions.proxyUsername,\n password: this.options.proxyOptions.proxyPassword\n }\n })).socket;\n }\n catch (err) {\n throw onerror(err);\n }\n }\n socket = tls.connect(socketOptions, () => {\n socket.write(message);\n });\n const { promise: willResolveKmsRequest, reject: rejectOnTlsSocketError, resolve } = (0, utils_1.promiseWithResolvers)();\n abortListener = (0, utils_1.addAbortListener)(options?.signal, function () {\n destroySockets();\n rejectOnTlsSocketError(this.reason);\n });\n socket\n .once('error', err => rejectOnTlsSocketError(onerror(err)))\n .once('close', () => rejectOnTlsSocketError(onclose()))\n .on('data', data => {\n buffer.append(data);\n while (request.bytesNeeded > 0 && buffer.length) {\n const bytesNeeded = Math.min(request.bytesNeeded, buffer.length);\n request.addResponse(buffer.read(bytesNeeded));\n }\n if (request.bytesNeeded <= 0) {\n resolve();\n }\n });\n await (options?.timeoutContext?.csotEnabled()\n ? Promise.all([\n willResolveKmsRequest,\n timeout_1.Timeout.expires(options.timeoutContext?.remainingTimeMS)\n ])\n : willResolveKmsRequest);\n }\n catch (error) {\n if (error instanceof timeout_1.TimeoutError)\n throw new error_1.MongoOperationTimeoutError('KMS request timed out');\n throw error;\n }\n finally {\n // There's no need for any more activity on this socket at this point.\n destroySockets();\n abortListener?.[utils_1.kDispose]();\n }\n }\n *requests(context, options) {\n for (let request = context.nextKMSRequest(); request != null; request = context.nextKMSRequest()) {\n yield this.kmsRequest(request, options);\n }\n }\n /**\n * Validates the provided TLS options are secure.\n *\n * @param kmsProvider - The KMS provider name.\n * @param tlsOptions - The client TLS options for the provider.\n *\n * @returns An error if any option is invalid.\n */\n validateTlsOptions(kmsProvider, tlsOptions) {\n const tlsOptionNames = Object.keys(tlsOptions);\n for (const option of INSECURE_TLS_OPTIONS) {\n if (tlsOptionNames.includes(option)) {\n return new errors_1.MongoCryptError(`Insecure TLS options prohibited for ${kmsProvider}: ${option}`);\n }\n }\n }\n /**\n * Sets only the valid secure TLS options.\n *\n * @param tlsOptions - The client TLS options for the provider.\n * @param options - The existing connection options.\n */\n async setTlsOptions(tlsOptions, options) {\n // If a secureContext is provided, ensure it is set.\n if (tlsOptions.secureContext) {\n options.secureContext = tlsOptions.secureContext;\n }\n if (tlsOptions.tlsCertificateKeyFile) {\n const cert = await fs.readFile(tlsOptions.tlsCertificateKeyFile);\n options.cert = options.key = cert;\n }\n if (tlsOptions.tlsCAFile) {\n options.ca = await fs.readFile(tlsOptions.tlsCAFile);\n }\n if (tlsOptions.tlsCertificateKeyFilePassword) {\n options.passphrase = tlsOptions.tlsCertificateKeyFilePassword;\n }\n }\n /**\n * Fetches collection info for a provided namespace, when libmongocrypt\n * enters the `MONGOCRYPT_CTX_NEED_MONGO_COLLINFO` state. The result is\n * used to inform libmongocrypt of the schema associated with this\n * namespace. Exposed for testing purposes. Do not directly invoke.\n *\n * @param client - A MongoClient connected to the topology\n * @param ns - The namespace to list collections from\n * @param filter - A filter for the listCollections command\n * @param callback - Invoked with the info of the requested collection, or with an error\n */\n fetchCollectionInfo(client, ns, filter, options) {\n const { db } = utils_1.MongoDBCollectionNamespace.fromString(ns);\n const cursor = client.db(db).listCollections(filter, {\n promoteLongs: false,\n promoteValues: false,\n timeoutContext: options?.timeoutContext && new abstract_cursor_1.CursorTimeoutContext(options?.timeoutContext, Symbol()),\n signal: options?.signal,\n nameOnly: false\n });\n return cursor;\n }\n /**\n * Calls to the mongocryptd to provide markings for a command.\n * Exposed for testing purposes. Do not directly invoke.\n * @param client - A MongoClient connected to a mongocryptd\n * @param ns - The namespace (database.collection) the command is being executed on\n * @param command - The command to execute.\n * @param callback - Invoked with the serialized and marked bson command, or with an error\n */\n async markCommand(client, ns, command, options) {\n const { db } = utils_1.MongoDBCollectionNamespace.fromString(ns);\n const bsonOptions = { promoteLongs: false, promoteValues: false };\n const rawCommand = (0, bson_1.deserialize)(command, bsonOptions);\n const commandOptions = {\n timeoutMS: undefined,\n signal: undefined\n };\n if (options?.timeoutContext?.csotEnabled()) {\n commandOptions.timeoutMS = options.timeoutContext.remainingTimeMS;\n }\n if (options?.signal) {\n commandOptions.signal = options.signal;\n }\n const response = await client.db(db).command(rawCommand, {\n ...bsonOptions,\n ...commandOptions\n });\n return (0, bson_1.serialize)(response, this.bsonOptions);\n }\n /**\n * Requests keys from the keyVault collection on the topology.\n * Exposed for testing purposes. Do not directly invoke.\n * @param client - A MongoClient connected to the topology\n * @param keyVaultNamespace - The namespace (database.collection) of the keyVault Collection\n * @param filter - The filter for the find query against the keyVault Collection\n * @param callback - Invoked with the found keys, or with an error\n */\n fetchKeys(client, keyVaultNamespace, filter, options) {\n const { db: dbName, collection: collectionName } = utils_1.MongoDBCollectionNamespace.fromString(keyVaultNamespace);\n const commandOptions = {\n timeoutContext: undefined,\n signal: undefined\n };\n if (options?.timeoutContext != null) {\n commandOptions.timeoutContext = new abstract_cursor_1.CursorTimeoutContext(options.timeoutContext, Symbol());\n }\n if (options?.signal != null) {\n commandOptions.signal = options.signal;\n }\n return client\n .db(dbName)\n .collection(collectionName, { readConcern: { level: 'majority' } })\n .find((0, bson_1.deserialize)(filter), commandOptions)\n .toArray();\n }\n}\nexports.StateMachine = StateMachine;\n//# sourceMappingURL=state_machine.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;AACA,QAAO,eAAe,SAAS,cAAc,EAAE,OAAO,MAAM,CAAC;AAC7D,SAAQ,eAAe,KAAK;CAC5B,MAAM,eAAa,cAAc;CACjC,MAAM,gBAAc,MAAM;CAC1B,MAAM,gBAAc,MAAM;CAC1B,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,IAAI,QAAQ;CACZ,SAAS,YAAY;AACjB,MAAI,SAAS,MAAM;GACf,MAAM,eAAe,GAAG,OAAO,WAAW;AAC1C,OAAI,kBAAkB,YAClB,OAAM,YAAY;AAEtB,WAAQ;;AAEZ,SAAO;;CAGX,MAAM,uBAAuB;CAC7B,MAAM,qCAAqC;CAC3C,MAAM,qCAAq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odb@6.21.0/node_modules/mongodb/lib/cmap/auth/auth_provider.mjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin } from "../../../../../../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
-
import { require_error } from "../../error.mjs";
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/auth_provider.js
|
|
5
|
-
var require_auth_provider = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.AuthProvider = exports.AuthContext = void 0;
|
|
8
|
-
const error_1 = require_error();
|
|
9
|
-
/**
|
|
10
|
-
* Context used during authentication
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
var AuthContext = class {
|
|
14
|
-
constructor(connection, credentials, options) {
|
|
15
|
-
/** If the context is for reauthentication. */
|
|
16
|
-
this.reauthenticating = false;
|
|
17
|
-
this.connection = connection;
|
|
18
|
-
this.credentials = credentials;
|
|
19
|
-
this.options = options;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
exports.AuthContext = AuthContext;
|
|
23
|
-
/**
|
|
24
|
-
* Provider used during authentication.
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
var AuthProvider = class {
|
|
28
|
-
/**
|
|
29
|
-
* Prepare the handshake document before the initial handshake.
|
|
30
|
-
*
|
|
31
|
-
* @param handshakeDoc - The document used for the initial handshake on a connection
|
|
32
|
-
* @param authContext - Context for authentication flow
|
|
33
|
-
*/
|
|
34
|
-
async prepare(handshakeDoc, _authContext) {
|
|
35
|
-
return handshakeDoc;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Reauthenticate.
|
|
39
|
-
* @param context - The shared auth context.
|
|
40
|
-
*/
|
|
41
|
-
async reauth(context) {
|
|
42
|
-
if (context.reauthenticating) throw new error_1.MongoRuntimeError("Reauthentication already in progress.");
|
|
43
|
-
try {
|
|
44
|
-
context.reauthenticating = true;
|
|
45
|
-
await this.auth(context);
|
|
46
|
-
} finally {
|
|
47
|
-
context.reauthenticating = false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
exports.AuthProvider = AuthProvider;
|
|
52
|
-
}));
|
|
53
|
-
|
|
54
|
-
//#endregion
|
|
55
|
-
export default require_auth_provider();
|
|
56
|
-
|
|
57
|
-
export { require_auth_provider };
|
|
58
|
-
//# sourceMappingURL=auth_provider.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth_provider.mjs","names":[],"sources":["../../../../../../../../../../../node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/auth_provider.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AuthProvider = exports.AuthContext = void 0;\nconst error_1 = require(\"../../error\");\n/**\n * Context used during authentication\n * @internal\n */\nclass AuthContext {\n constructor(connection, credentials, options) {\n /** If the context is for reauthentication. */\n this.reauthenticating = false;\n this.connection = connection;\n this.credentials = credentials;\n this.options = options;\n }\n}\nexports.AuthContext = AuthContext;\n/**\n * Provider used during authentication.\n * @internal\n */\nclass AuthProvider {\n /**\n * Prepare the handshake document before the initial handshake.\n *\n * @param handshakeDoc - The document used for the initial handshake on a connection\n * @param authContext - Context for authentication flow\n */\n async prepare(handshakeDoc, _authContext) {\n return handshakeDoc;\n }\n /**\n * Reauthenticate.\n * @param context - The shared auth context.\n */\n async reauth(context) {\n if (context.reauthenticating) {\n throw new error_1.MongoRuntimeError('Reauthentication already in progress.');\n }\n try {\n context.reauthenticating = true;\n await this.auth(context);\n }\n finally {\n context.reauthenticating = false;\n }\n }\n}\nexports.AuthProvider = AuthProvider;\n//# sourceMappingURL=auth_provider.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;AACA,QAAO,eAAe,SAAS,cAAc,EAAE,OAAO,MAAM,CAAC;AAC7D,SAAQ,eAAe,QAAQ,cAAc,KAAK;CAClD,MAAM;;;;;CAKN,IAAM,cAAN,MAAkB;EACd,YAAY,YAAY,aAAa,SAAS;;AAE1C,QAAK,mBAAmB;AACxB,QAAK,aAAa;AAClB,QAAK,cAAc;AACnB,QAAK,UAAU;;;AAGvB,SAAQ,cAAc;;;;;CAKtB,IAAM,eAAN,MAAmB;;;;;;;EAOf,MAAM,QAAQ,cAAc,cAAc;AACtC,UAAO;;;;;;EAMX,MAAM,OAAO,SAAS;AAClB,OAAI,QAAQ,iBACR,OAAM,IAAI,QAAQ,kBAAkB,wCAAwC;AAEhF,OAAI;AACA,YAAQ,mBAAmB;AAC3B,UAAM,KAAK,KAAK,QAAQ;aAEpB;AACJ,YAAQ,mBAAmB;;;;AAIvC,SAAQ,eAAe"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { __commonJSMin } from "../../../../../../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
-
import { require_error } from "../../error.mjs";
|
|
3
|
-
import { require_utils } from "../../utils.mjs";
|
|
4
|
-
import { require_deps } from "../../deps.mjs";
|
|
5
|
-
|
|
6
|
-
//#region ../../node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js
|
|
7
|
-
var require_aws_temporary_credentials = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.LegacyAWSTemporaryCredentialProvider = exports.AWSSDKCredentialProvider = exports.AWSTemporaryCredentialProvider = void 0;
|
|
10
|
-
const deps_1 = require_deps();
|
|
11
|
-
const error_1 = require_error();
|
|
12
|
-
const utils_1 = require_utils();
|
|
13
|
-
const AWS_RELATIVE_URI = "http://169.254.170.2";
|
|
14
|
-
const AWS_EC2_URI = "http://169.254.169.254";
|
|
15
|
-
const AWS_EC2_PATH = "/latest/meta-data/iam/security-credentials";
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
*
|
|
19
|
-
* Fetches temporary AWS credentials.
|
|
20
|
-
*/
|
|
21
|
-
var AWSTemporaryCredentialProvider = class AWSTemporaryCredentialProvider {
|
|
22
|
-
static get awsSDK() {
|
|
23
|
-
AWSTemporaryCredentialProvider._awsSDK ??= (0, deps_1.getAwsCredentialProvider)();
|
|
24
|
-
return AWSTemporaryCredentialProvider._awsSDK;
|
|
25
|
-
}
|
|
26
|
-
static get isAWSSDKInstalled() {
|
|
27
|
-
return !("kModuleError" in AWSTemporaryCredentialProvider.awsSDK);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
exports.AWSTemporaryCredentialProvider = AWSTemporaryCredentialProvider;
|
|
31
|
-
/** @internal */
|
|
32
|
-
var AWSSDKCredentialProvider = class extends AWSTemporaryCredentialProvider {
|
|
33
|
-
/**
|
|
34
|
-
* Create the SDK credentials provider.
|
|
35
|
-
* @param credentialsProvider - The credentials provider.
|
|
36
|
-
*/
|
|
37
|
-
constructor(credentialsProvider) {
|
|
38
|
-
super();
|
|
39
|
-
if (credentialsProvider) this._provider = credentialsProvider;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* The AWS SDK caches credentials automatically and handles refresh when the credentials have expired.
|
|
43
|
-
* To ensure this occurs, we need to cache the `provider` returned by the AWS sdk and re-use it when fetching credentials.
|
|
44
|
-
*/
|
|
45
|
-
get provider() {
|
|
46
|
-
if ("kModuleError" in AWSTemporaryCredentialProvider.awsSDK) throw AWSTemporaryCredentialProvider.awsSDK.kModuleError;
|
|
47
|
-
if (this._provider) return this._provider;
|
|
48
|
-
let { AWS_STS_REGIONAL_ENDPOINTS = "", AWS_REGION = "" } = process.env;
|
|
49
|
-
AWS_STS_REGIONAL_ENDPOINTS = AWS_STS_REGIONAL_ENDPOINTS.toLowerCase();
|
|
50
|
-
AWS_REGION = AWS_REGION.toLowerCase();
|
|
51
|
-
/** The option setting should work only for users who have explicit settings in their environment, the driver should not encode "defaults" */
|
|
52
|
-
const awsRegionSettingsExist = AWS_REGION.length !== 0 && AWS_STS_REGIONAL_ENDPOINTS.length !== 0;
|
|
53
|
-
/**
|
|
54
|
-
* If AWS_STS_REGIONAL_ENDPOINTS is set to regional, users are opting into the new behavior of respecting the region settings
|
|
55
|
-
*
|
|
56
|
-
* If AWS_STS_REGIONAL_ENDPOINTS is set to legacy, then "old" regions need to keep using the global setting.
|
|
57
|
-
* Technically the SDK gets this wrong, it reaches out to 'sts.us-east-1.amazonaws.com' when it should be 'sts.amazonaws.com'.
|
|
58
|
-
* That is not our bug to fix here. We leave that up to the SDK.
|
|
59
|
-
*/
|
|
60
|
-
const useRegionalSts = AWS_STS_REGIONAL_ENDPOINTS === "regional" || AWS_STS_REGIONAL_ENDPOINTS === "legacy" && !new Set([
|
|
61
|
-
"ap-northeast-1",
|
|
62
|
-
"ap-south-1",
|
|
63
|
-
"ap-southeast-1",
|
|
64
|
-
"ap-southeast-2",
|
|
65
|
-
"aws-global",
|
|
66
|
-
"ca-central-1",
|
|
67
|
-
"eu-central-1",
|
|
68
|
-
"eu-north-1",
|
|
69
|
-
"eu-west-1",
|
|
70
|
-
"eu-west-2",
|
|
71
|
-
"eu-west-3",
|
|
72
|
-
"sa-east-1",
|
|
73
|
-
"us-east-1",
|
|
74
|
-
"us-east-2",
|
|
75
|
-
"us-west-1",
|
|
76
|
-
"us-west-2"
|
|
77
|
-
]).has(AWS_REGION);
|
|
78
|
-
this._provider = awsRegionSettingsExist && useRegionalSts ? AWSTemporaryCredentialProvider.awsSDK.fromNodeProviderChain({ clientConfig: { region: AWS_REGION } }) : AWSTemporaryCredentialProvider.awsSDK.fromNodeProviderChain();
|
|
79
|
-
return this._provider;
|
|
80
|
-
}
|
|
81
|
-
async getCredentials() {
|
|
82
|
-
try {
|
|
83
|
-
const creds = await this.provider();
|
|
84
|
-
return {
|
|
85
|
-
AccessKeyId: creds.accessKeyId,
|
|
86
|
-
SecretAccessKey: creds.secretAccessKey,
|
|
87
|
-
Token: creds.sessionToken,
|
|
88
|
-
Expiration: creds.expiration
|
|
89
|
-
};
|
|
90
|
-
} catch (error) {
|
|
91
|
-
throw new error_1.MongoAWSError(error.message, { cause: error });
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
exports.AWSSDKCredentialProvider = AWSSDKCredentialProvider;
|
|
96
|
-
/**
|
|
97
|
-
* @internal
|
|
98
|
-
* 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)
|
|
99
|
-
* section of the Auth spec.
|
|
100
|
-
*/
|
|
101
|
-
var LegacyAWSTemporaryCredentialProvider = class extends AWSTemporaryCredentialProvider {
|
|
102
|
-
async getCredentials() {
|
|
103
|
-
if (process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) return await (0, utils_1.request)(`${AWS_RELATIVE_URI}${process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}`);
|
|
104
|
-
const token = await (0, utils_1.request)(`${AWS_EC2_URI}/latest/api/token`, {
|
|
105
|
-
method: "PUT",
|
|
106
|
-
json: false,
|
|
107
|
-
headers: { "X-aws-ec2-metadata-token-ttl-seconds": 30 }
|
|
108
|
-
});
|
|
109
|
-
const roleName = await (0, utils_1.request)(`${AWS_EC2_URI}/${AWS_EC2_PATH}`, {
|
|
110
|
-
json: false,
|
|
111
|
-
headers: { "X-aws-ec2-metadata-token": token }
|
|
112
|
-
});
|
|
113
|
-
return await (0, utils_1.request)(`${AWS_EC2_URI}/${AWS_EC2_PATH}/${roleName}`, { headers: { "X-aws-ec2-metadata-token": token } });
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
exports.LegacyAWSTemporaryCredentialProvider = LegacyAWSTemporaryCredentialProvider;
|
|
117
|
-
}));
|
|
118
|
-
|
|
119
|
-
//#endregion
|
|
120
|
-
export default require_aws_temporary_credentials();
|
|
121
|
-
|
|
122
|
-
export { require_aws_temporary_credentials };
|
|
123
|
-
//# sourceMappingURL=aws_temporary_credentials.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aws_temporary_credentials.mjs","names":[],"sources":["../../../../../../../../../../../node_modules/.pnpm/mongodb@6.21.0/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LegacyAWSTemporaryCredentialProvider = exports.AWSSDKCredentialProvider = exports.AWSTemporaryCredentialProvider = void 0;\nconst deps_1 = require(\"../../deps\");\nconst error_1 = require(\"../../error\");\nconst utils_1 = require(\"../../utils\");\nconst AWS_RELATIVE_URI = 'http://169.254.170.2';\nconst AWS_EC2_URI = 'http://169.254.169.254';\nconst AWS_EC2_PATH = '/latest/meta-data/iam/security-credentials';\n/**\n * @internal\n *\n * Fetches temporary AWS credentials.\n */\nclass AWSTemporaryCredentialProvider {\n static get awsSDK() {\n AWSTemporaryCredentialProvider._awsSDK ??= (0, deps_1.getAwsCredentialProvider)();\n return AWSTemporaryCredentialProvider._awsSDK;\n }\n static get isAWSSDKInstalled() {\n return !('kModuleError' in AWSTemporaryCredentialProvider.awsSDK);\n }\n}\nexports.AWSTemporaryCredentialProvider = AWSTemporaryCredentialProvider;\n/** @internal */\nclass AWSSDKCredentialProvider extends AWSTemporaryCredentialProvider {\n /**\n * Create the SDK credentials provider.\n * @param credentialsProvider - The credentials provider.\n */\n constructor(credentialsProvider) {\n super();\n if (credentialsProvider) {\n this._provider = credentialsProvider;\n }\n }\n /**\n * The AWS SDK caches credentials automatically and handles refresh when the credentials have expired.\n * To ensure this occurs, we need to cache the `provider` returned by the AWS sdk and re-use it when fetching credentials.\n */\n get provider() {\n if ('kModuleError' in AWSTemporaryCredentialProvider.awsSDK) {\n throw AWSTemporaryCredentialProvider.awsSDK.kModuleError;\n }\n if (this._provider) {\n return this._provider;\n }\n let { AWS_STS_REGIONAL_ENDPOINTS = '', AWS_REGION = '' } = process.env;\n AWS_STS_REGIONAL_ENDPOINTS = AWS_STS_REGIONAL_ENDPOINTS.toLowerCase();\n AWS_REGION = AWS_REGION.toLowerCase();\n /** The option setting should work only for users who have explicit settings in their environment, the driver should not encode \"defaults\" */\n const awsRegionSettingsExist = AWS_REGION.length !== 0 && AWS_STS_REGIONAL_ENDPOINTS.length !== 0;\n /**\n * The following regions use the global AWS STS endpoint, sts.amazonaws.com, by default\n * https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html\n */\n const LEGACY_REGIONS = new Set([\n 'ap-northeast-1',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'aws-global',\n 'ca-central-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-west-1',\n 'us-west-2'\n ]);\n /**\n * If AWS_STS_REGIONAL_ENDPOINTS is set to regional, users are opting into the new behavior of respecting the region settings\n *\n * If AWS_STS_REGIONAL_ENDPOINTS is set to legacy, then \"old\" regions need to keep using the global setting.\n * Technically the SDK gets this wrong, it reaches out to 'sts.us-east-1.amazonaws.com' when it should be 'sts.amazonaws.com'.\n * That is not our bug to fix here. We leave that up to the SDK.\n */\n const useRegionalSts = AWS_STS_REGIONAL_ENDPOINTS === 'regional' ||\n (AWS_STS_REGIONAL_ENDPOINTS === 'legacy' && !LEGACY_REGIONS.has(AWS_REGION));\n this._provider =\n awsRegionSettingsExist && useRegionalSts\n ? AWSTemporaryCredentialProvider.awsSDK.fromNodeProviderChain({\n clientConfig: { region: AWS_REGION }\n })\n : AWSTemporaryCredentialProvider.awsSDK.fromNodeProviderChain();\n return this._provider;\n }\n async getCredentials() {\n /*\n * Creates a credential provider that will attempt to find credentials from the\n * following sources (listed in order of precedence):\n *\n * - Environment variables exposed via process.env\n * - SSO credentials from token cache\n * - Web identity token credentials\n * - Shared credentials and config ini files\n * - The EC2/ECS Instance Metadata Service\n */\n try {\n const creds = await this.provider();\n return {\n AccessKeyId: creds.accessKeyId,\n SecretAccessKey: creds.secretAccessKey,\n Token: creds.sessionToken,\n Expiration: creds.expiration\n };\n }\n catch (error) {\n throw new error_1.MongoAWSError(error.message, { cause: error });\n }\n }\n}\nexports.AWSSDKCredentialProvider = AWSSDKCredentialProvider;\n/**\n * @internal\n * 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)\n * section of the Auth spec.\n */\nclass LegacyAWSTemporaryCredentialProvider extends AWSTemporaryCredentialProvider {\n async getCredentials() {\n // If the environment variable AWS_CONTAINER_CREDENTIALS_RELATIVE_URI\n // is set then drivers MUST assume that it was set by an AWS ECS agent\n if (process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) {\n return await (0, utils_1.request)(`${AWS_RELATIVE_URI}${process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}`);\n }\n // Otherwise assume we are on an EC2 instance\n // get a token\n const token = await (0, utils_1.request)(`${AWS_EC2_URI}/latest/api/token`, {\n method: 'PUT',\n json: false,\n headers: { 'X-aws-ec2-metadata-token-ttl-seconds': 30 }\n });\n // get role name\n const roleName = await (0, utils_1.request)(`${AWS_EC2_URI}/${AWS_EC2_PATH}`, {\n json: false,\n headers: { 'X-aws-ec2-metadata-token': token }\n });\n // get temp credentials\n const creds = await (0, utils_1.request)(`${AWS_EC2_URI}/${AWS_EC2_PATH}/${roleName}`, {\n headers: { 'X-aws-ec2-metadata-token': token }\n });\n return creds;\n }\n}\nexports.LegacyAWSTemporaryCredentialProvider = LegacyAWSTemporaryCredentialProvider;\n//# sourceMappingURL=aws_temporary_credentials.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;AACA,QAAO,eAAe,SAAS,cAAc,EAAE,OAAO,MAAM,CAAC;AAC7D,SAAQ,uCAAuC,QAAQ,2BAA2B,QAAQ,iCAAiC,KAAK;CAChI,MAAM;CACN,MAAM;CAC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