@azure/cosmos 4.4.1-alpha.20250708.2 → 4.5.0-alpha.20250717.1
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/browser/ClientContext.d.ts +19 -10
- package/dist/browser/ClientContext.d.ts.map +1 -1
- package/dist/browser/ClientContext.js +30 -11
- package/dist/browser/ClientContext.js.map +1 -1
- package/dist/browser/CosmosClient.d.ts.map +1 -1
- package/dist/browser/CosmosClient.js +10 -2
- package/dist/browser/CosmosClient.js.map +1 -1
- package/dist/browser/PartitionKeyRangeFailoverInfo.d.ts +49 -0
- package/dist/browser/PartitionKeyRangeFailoverInfo.d.ts.map +1 -0
- package/dist/browser/PartitionKeyRangeFailoverInfo.js +130 -0
- package/dist/browser/PartitionKeyRangeFailoverInfo.js.map +1 -0
- package/dist/browser/client/ClientUtils.d.ts +3 -1
- package/dist/browser/client/ClientUtils.d.ts.map +1 -1
- package/dist/browser/client/ClientUtils.js +10 -0
- package/dist/browser/client/ClientUtils.js.map +1 -1
- package/dist/browser/client/Item/Item.d.ts.map +1 -1
- package/dist/browser/client/Item/Item.js +13 -0
- package/dist/browser/client/Item/Item.js.map +1 -1
- package/dist/browser/client/Item/Items.d.ts.map +1 -1
- package/dist/browser/client/Item/Items.js +19 -3
- package/dist/browser/client/Item/Items.js.map +1 -1
- package/dist/browser/common/constants.d.ts +20 -0
- package/dist/browser/common/constants.d.ts.map +1 -1
- package/dist/browser/common/constants.js +23 -1
- package/dist/browser/common/constants.js.map +1 -1
- package/dist/browser/common/platform.d.ts +6 -1
- package/dist/browser/common/platform.d.ts.map +1 -1
- package/dist/browser/common/platform.js +23 -4
- package/dist/browser/common/platform.js.map +1 -1
- package/dist/browser/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
- package/dist/browser/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
- package/dist/browser/diagnostics/DiagnosticNodeInternal.js.map +1 -1
- package/dist/browser/documents/ConnectionPolicy.d.ts +6 -0
- package/dist/browser/documents/ConnectionPolicy.d.ts.map +1 -1
- package/dist/browser/documents/ConnectionPolicy.js +2 -0
- package/dist/browser/documents/ConnectionPolicy.js.map +1 -1
- package/dist/browser/documents/DatabaseAccount.d.ts.map +1 -1
- package/dist/browser/documents/DatabaseAccount.js +3 -0
- package/dist/browser/documents/DatabaseAccount.js.map +1 -1
- package/dist/browser/extractPartitionKey.d.ts.map +1 -1
- package/dist/browser/extractPartitionKey.js +33 -20
- package/dist/browser/extractPartitionKey.js.map +1 -1
- package/dist/browser/globalEndpointManager.d.ts +6 -0
- package/dist/browser/globalEndpointManager.d.ts.map +1 -1
- package/dist/browser/globalEndpointManager.js +9 -4
- package/dist/browser/globalEndpointManager.js.map +1 -1
- package/dist/browser/globalPartitionEndpointManager.d.ts +79 -0
- package/dist/browser/globalPartitionEndpointManager.d.ts.map +1 -0
- package/dist/browser/globalPartitionEndpointManager.js +279 -0
- package/dist/browser/globalPartitionEndpointManager.js.map +1 -0
- package/dist/browser/queryExecutionContext/Aggregators/index.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/Aggregators/index.js +1 -0
- package/dist/browser/queryExecutionContext/Aggregators/index.js.map +1 -1
- package/dist/browser/queryExecutionContext/documentProducer.d.ts +2 -3
- package/dist/browser/queryExecutionContext/documentProducer.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/documentProducer.js +16 -21
- package/dist/browser/queryExecutionContext/documentProducer.js.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js +2 -1
- package/dist/browser/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/browser/queryIterator.js +1 -2
- package/dist/browser/queryIterator.js.map +1 -1
- package/dist/browser/request/ErrorResponse.d.ts +1 -1
- package/dist/browser/request/ErrorResponse.d.ts.map +1 -1
- package/dist/browser/request/ErrorResponse.js.map +1 -1
- package/dist/browser/request/RequestContext.d.ts +5 -0
- package/dist/browser/request/RequestContext.d.ts.map +1 -1
- package/dist/browser/request/RequestContext.js.map +1 -1
- package/dist/browser/request/RequestHandler.d.ts.map +1 -1
- package/dist/browser/request/RequestHandler.js +14 -4
- package/dist/browser/request/RequestHandler.js.map +1 -1
- package/dist/browser/retry/RetryPolicy.d.ts +2 -2
- package/dist/browser/retry/RetryPolicy.d.ts.map +1 -1
- package/dist/browser/retry/RetryPolicy.js.map +1 -1
- package/dist/browser/retry/defaultRetryPolicy.d.ts.map +1 -1
- package/dist/browser/retry/defaultRetryPolicy.js +4 -8
- package/dist/browser/retry/defaultRetryPolicy.js.map +1 -1
- package/dist/browser/retry/endpointDiscoveryRetryPolicy.d.ts +5 -3
- package/dist/browser/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
- package/dist/browser/retry/endpointDiscoveryRetryPolicy.js +9 -2
- package/dist/browser/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
- package/dist/browser/retry/retryUtility.d.ts.map +1 -1
- package/dist/browser/retry/retryUtility.js +11 -5
- package/dist/browser/retry/retryUtility.js.map +1 -1
- package/dist/browser/retry/timeoutFailoverRetryPolicy.d.ts +6 -3
- package/dist/browser/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
- package/dist/browser/retry/timeoutFailoverRetryPolicy.js +12 -4
- package/dist/browser/retry/timeoutFailoverRetryPolicy.js.map +1 -1
- package/dist/browser/routing/partitionKeyRangeCache.d.ts.map +1 -1
- package/dist/browser/routing/partitionKeyRangeCache.js +11 -0
- package/dist/browser/routing/partitionKeyRangeCache.js.map +1 -1
- package/dist/browser/utils/checkURL.js +6 -0
- package/dist/browser/utils/checkURL.js.map +1 -1
- package/dist/browser/utils/hashing/hash.d.ts +2 -0
- package/dist/browser/utils/hashing/hash.d.ts.map +1 -1
- package/dist/browser/utils/hashing/hash.js +19 -0
- package/dist/browser/utils/hashing/hash.js.map +1 -1
- package/dist/commonjs/ClientContext.d.ts +19 -10
- package/dist/commonjs/ClientContext.d.ts.map +1 -1
- package/dist/commonjs/ClientContext.js +30 -11
- package/dist/commonjs/ClientContext.js.map +1 -1
- package/dist/commonjs/CosmosClient.d.ts.map +1 -1
- package/dist/commonjs/CosmosClient.js +10 -2
- package/dist/commonjs/CosmosClient.js.map +1 -1
- package/dist/commonjs/PartitionKeyRangeFailoverInfo.d.ts +49 -0
- package/dist/commonjs/PartitionKeyRangeFailoverInfo.d.ts.map +1 -0
- package/dist/commonjs/PartitionKeyRangeFailoverInfo.js +135 -0
- package/dist/commonjs/PartitionKeyRangeFailoverInfo.js.map +1 -0
- package/dist/commonjs/client/ClientUtils.d.ts +3 -1
- package/dist/commonjs/client/ClientUtils.d.ts.map +1 -1
- package/dist/commonjs/client/ClientUtils.js +11 -0
- package/dist/commonjs/client/ClientUtils.js.map +1 -1
- package/dist/commonjs/client/Item/Item.d.ts.map +1 -1
- package/dist/commonjs/client/Item/Item.js +13 -0
- package/dist/commonjs/client/Item/Item.js.map +1 -1
- package/dist/commonjs/client/Item/Items.d.ts.map +1 -1
- package/dist/commonjs/client/Item/Items.js +17 -1
- package/dist/commonjs/client/Item/Items.js.map +1 -1
- package/dist/commonjs/common/constants.d.ts +20 -0
- package/dist/commonjs/common/constants.d.ts.map +1 -1
- package/dist/commonjs/common/constants.js +24 -2
- package/dist/commonjs/common/constants.js.map +1 -1
- package/dist/commonjs/common/platform.d.ts +6 -1
- package/dist/commonjs/common/platform.d.ts.map +1 -1
- package/dist/commonjs/common/platform.js +23 -3
- package/dist/commonjs/common/platform.js.map +1 -1
- package/dist/commonjs/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
- package/dist/commonjs/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
- package/dist/commonjs/diagnostics/DiagnosticNodeInternal.js.map +1 -1
- package/dist/commonjs/documents/ConnectionPolicy.d.ts +6 -0
- package/dist/commonjs/documents/ConnectionPolicy.d.ts.map +1 -1
- package/dist/commonjs/documents/ConnectionPolicy.js +2 -0
- package/dist/commonjs/documents/ConnectionPolicy.js.map +1 -1
- package/dist/commonjs/documents/DatabaseAccount.d.ts.map +1 -1
- package/dist/commonjs/documents/DatabaseAccount.js +3 -0
- package/dist/commonjs/documents/DatabaseAccount.js.map +1 -1
- package/dist/commonjs/extractPartitionKey.d.ts.map +1 -1
- package/dist/commonjs/extractPartitionKey.js +33 -20
- package/dist/commonjs/extractPartitionKey.js.map +1 -1
- package/dist/commonjs/globalEndpointManager.d.ts +6 -0
- package/dist/commonjs/globalEndpointManager.d.ts.map +1 -1
- package/dist/commonjs/globalEndpointManager.js +10 -5
- package/dist/commonjs/globalEndpointManager.js.map +1 -1
- package/dist/commonjs/globalPartitionEndpointManager.d.ts +79 -0
- package/dist/commonjs/globalPartitionEndpointManager.d.ts.map +1 -0
- package/dist/commonjs/globalPartitionEndpointManager.js +283 -0
- package/dist/commonjs/globalPartitionEndpointManager.js.map +1 -0
- package/dist/commonjs/queryExecutionContext/Aggregators/index.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/Aggregators/index.js +1 -0
- package/dist/commonjs/queryExecutionContext/Aggregators/index.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/documentProducer.d.ts +2 -3
- package/dist/commonjs/queryExecutionContext/documentProducer.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/documentProducer.js +15 -20
- package/dist/commonjs/queryExecutionContext/documentProducer.js.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js +2 -1
- package/dist/commonjs/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/commonjs/queryIterator.js +1 -2
- package/dist/commonjs/queryIterator.js.map +1 -1
- package/dist/commonjs/request/ErrorResponse.d.ts +1 -1
- package/dist/commonjs/request/ErrorResponse.d.ts.map +1 -1
- package/dist/commonjs/request/ErrorResponse.js.map +1 -1
- package/dist/commonjs/request/RequestContext.d.ts +5 -0
- package/dist/commonjs/request/RequestContext.d.ts.map +1 -1
- package/dist/commonjs/request/RequestContext.js.map +1 -1
- package/dist/commonjs/request/RequestHandler.d.ts.map +1 -1
- package/dist/commonjs/request/RequestHandler.js +12 -2
- package/dist/commonjs/request/RequestHandler.js.map +1 -1
- package/dist/commonjs/request/defaultAgent.js +4 -4
- package/dist/commonjs/request/defaultAgent.js.map +1 -1
- package/dist/commonjs/retry/RetryPolicy.d.ts +2 -2
- package/dist/commonjs/retry/RetryPolicy.d.ts.map +1 -1
- package/dist/commonjs/retry/RetryPolicy.js.map +1 -1
- package/dist/commonjs/retry/defaultRetryPolicy.d.ts.map +1 -1
- package/dist/commonjs/retry/defaultRetryPolicy.js +3 -7
- package/dist/commonjs/retry/defaultRetryPolicy.js.map +1 -1
- package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.d.ts +5 -3
- package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
- package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.js +9 -2
- package/dist/commonjs/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
- package/dist/commonjs/retry/retryUtility.d.ts.map +1 -1
- package/dist/commonjs/retry/retryUtility.js +11 -5
- package/dist/commonjs/retry/retryUtility.js.map +1 -1
- package/dist/commonjs/retry/timeoutFailoverRetryPolicy.d.ts +6 -3
- package/dist/commonjs/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
- package/dist/commonjs/retry/timeoutFailoverRetryPolicy.js +12 -4
- package/dist/commonjs/retry/timeoutFailoverRetryPolicy.js.map +1 -1
- package/dist/commonjs/routing/partitionKeyRangeCache.d.ts.map +1 -1
- package/dist/commonjs/routing/partitionKeyRangeCache.js +11 -0
- package/dist/commonjs/routing/partitionKeyRangeCache.js.map +1 -1
- package/dist/commonjs/utils/checkURL.js +7 -0
- package/dist/commonjs/utils/checkURL.js.map +1 -1
- package/dist/commonjs/utils/hashing/hash.d.ts +2 -0
- package/dist/commonjs/utils/hashing/hash.d.ts.map +1 -1
- package/dist/commonjs/utils/hashing/hash.js +20 -0
- package/dist/commonjs/utils/hashing/hash.js.map +1 -1
- package/dist/esm/ClientContext.d.ts +19 -10
- package/dist/esm/ClientContext.d.ts.map +1 -1
- package/dist/esm/ClientContext.js +30 -11
- package/dist/esm/ClientContext.js.map +1 -1
- package/dist/esm/CosmosClient.d.ts.map +1 -1
- package/dist/esm/CosmosClient.js +10 -2
- package/dist/esm/CosmosClient.js.map +1 -1
- package/dist/esm/PartitionKeyRangeFailoverInfo.d.ts +49 -0
- package/dist/esm/PartitionKeyRangeFailoverInfo.d.ts.map +1 -0
- package/dist/esm/PartitionKeyRangeFailoverInfo.js +130 -0
- package/dist/esm/PartitionKeyRangeFailoverInfo.js.map +1 -0
- package/dist/esm/client/ClientUtils.d.ts +3 -1
- package/dist/esm/client/ClientUtils.d.ts.map +1 -1
- package/dist/esm/client/ClientUtils.js +10 -0
- package/dist/esm/client/ClientUtils.js.map +1 -1
- package/dist/esm/client/Item/Item.d.ts.map +1 -1
- package/dist/esm/client/Item/Item.js +13 -0
- package/dist/esm/client/Item/Item.js.map +1 -1
- package/dist/esm/client/Item/Items.d.ts.map +1 -1
- package/dist/esm/client/Item/Items.js +19 -3
- package/dist/esm/client/Item/Items.js.map +1 -1
- package/dist/esm/common/constants.d.ts +20 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +23 -1
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/platform.d.ts +6 -1
- package/dist/esm/common/platform.d.ts.map +1 -1
- package/dist/esm/common/platform.js +23 -4
- package/dist/esm/common/platform.js.map +1 -1
- package/dist/esm/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
- package/dist/esm/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
- package/dist/esm/diagnostics/DiagnosticNodeInternal.js.map +1 -1
- package/dist/esm/documents/ConnectionPolicy.d.ts +6 -0
- package/dist/esm/documents/ConnectionPolicy.d.ts.map +1 -1
- package/dist/esm/documents/ConnectionPolicy.js +2 -0
- package/dist/esm/documents/ConnectionPolicy.js.map +1 -1
- package/dist/esm/documents/DatabaseAccount.d.ts.map +1 -1
- package/dist/esm/documents/DatabaseAccount.js +3 -0
- package/dist/esm/documents/DatabaseAccount.js.map +1 -1
- package/dist/esm/extractPartitionKey.d.ts.map +1 -1
- package/dist/esm/extractPartitionKey.js +33 -20
- package/dist/esm/extractPartitionKey.js.map +1 -1
- package/dist/esm/globalEndpointManager.d.ts +6 -0
- package/dist/esm/globalEndpointManager.d.ts.map +1 -1
- package/dist/esm/globalEndpointManager.js +9 -4
- package/dist/esm/globalEndpointManager.js.map +1 -1
- package/dist/esm/globalPartitionEndpointManager.d.ts +79 -0
- package/dist/esm/globalPartitionEndpointManager.d.ts.map +1 -0
- package/dist/esm/globalPartitionEndpointManager.js +279 -0
- package/dist/esm/globalPartitionEndpointManager.js.map +1 -0
- package/dist/esm/queryExecutionContext/Aggregators/index.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/Aggregators/index.js +1 -0
- package/dist/esm/queryExecutionContext/Aggregators/index.js.map +1 -1
- package/dist/esm/queryExecutionContext/documentProducer.d.ts +2 -3
- package/dist/esm/queryExecutionContext/documentProducer.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/documentProducer.js +16 -21
- package/dist/esm/queryExecutionContext/documentProducer.js.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js +2 -1
- package/dist/esm/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/esm/queryIterator.js +1 -2
- package/dist/esm/queryIterator.js.map +1 -1
- package/dist/esm/request/ErrorResponse.d.ts +1 -1
- package/dist/esm/request/ErrorResponse.d.ts.map +1 -1
- package/dist/esm/request/ErrorResponse.js.map +1 -1
- package/dist/esm/request/RequestContext.d.ts +5 -0
- package/dist/esm/request/RequestContext.d.ts.map +1 -1
- package/dist/esm/request/RequestContext.js.map +1 -1
- package/dist/esm/request/RequestHandler.d.ts.map +1 -1
- package/dist/esm/request/RequestHandler.js +14 -4
- package/dist/esm/request/RequestHandler.js.map +1 -1
- package/dist/esm/request/defaultAgent.js +2 -2
- package/dist/esm/request/defaultAgent.js.map +1 -1
- package/dist/esm/retry/RetryPolicy.d.ts +2 -2
- package/dist/esm/retry/RetryPolicy.d.ts.map +1 -1
- package/dist/esm/retry/RetryPolicy.js.map +1 -1
- package/dist/esm/retry/defaultRetryPolicy.d.ts.map +1 -1
- package/dist/esm/retry/defaultRetryPolicy.js +4 -8
- package/dist/esm/retry/defaultRetryPolicy.js.map +1 -1
- package/dist/esm/retry/endpointDiscoveryRetryPolicy.d.ts +5 -3
- package/dist/esm/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
- package/dist/esm/retry/endpointDiscoveryRetryPolicy.js +9 -2
- package/dist/esm/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
- package/dist/esm/retry/retryUtility.d.ts.map +1 -1
- package/dist/esm/retry/retryUtility.js +11 -5
- package/dist/esm/retry/retryUtility.js.map +1 -1
- package/dist/esm/retry/timeoutFailoverRetryPolicy.d.ts +6 -3
- package/dist/esm/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
- package/dist/esm/retry/timeoutFailoverRetryPolicy.js +12 -4
- package/dist/esm/retry/timeoutFailoverRetryPolicy.js.map +1 -1
- package/dist/esm/routing/partitionKeyRangeCache.d.ts.map +1 -1
- package/dist/esm/routing/partitionKeyRangeCache.js +11 -0
- package/dist/esm/routing/partitionKeyRangeCache.js.map +1 -1
- package/dist/esm/utils/checkURL.js +6 -0
- package/dist/esm/utils/checkURL.js.map +1 -1
- package/dist/esm/utils/hashing/hash.d.ts +2 -0
- package/dist/esm/utils/hashing/hash.d.ts.map +1 -1
- package/dist/esm/utils/hashing/hash.js +19 -0
- package/dist/esm/utils/hashing/hash.js.map +1 -1
- package/dist/react-native/ClientContext.d.ts +19 -10
- package/dist/react-native/ClientContext.d.ts.map +1 -1
- package/dist/react-native/ClientContext.js +30 -11
- package/dist/react-native/ClientContext.js.map +1 -1
- package/dist/react-native/CosmosClient.d.ts.map +1 -1
- package/dist/react-native/CosmosClient.js +10 -2
- package/dist/react-native/CosmosClient.js.map +1 -1
- package/dist/react-native/PartitionKeyRangeFailoverInfo.d.ts +49 -0
- package/dist/react-native/PartitionKeyRangeFailoverInfo.d.ts.map +1 -0
- package/dist/react-native/PartitionKeyRangeFailoverInfo.js +130 -0
- package/dist/react-native/PartitionKeyRangeFailoverInfo.js.map +1 -0
- package/dist/react-native/client/ClientUtils.d.ts +3 -1
- package/dist/react-native/client/ClientUtils.d.ts.map +1 -1
- package/dist/react-native/client/ClientUtils.js +10 -0
- package/dist/react-native/client/ClientUtils.js.map +1 -1
- package/dist/react-native/client/Item/Item.d.ts.map +1 -1
- package/dist/react-native/client/Item/Item.js +13 -0
- package/dist/react-native/client/Item/Item.js.map +1 -1
- package/dist/react-native/client/Item/Items.d.ts.map +1 -1
- package/dist/react-native/client/Item/Items.js +19 -3
- package/dist/react-native/client/Item/Items.js.map +1 -1
- package/dist/react-native/common/constants.d.ts +20 -0
- package/dist/react-native/common/constants.d.ts.map +1 -1
- package/dist/react-native/common/constants.js +23 -1
- package/dist/react-native/common/constants.js.map +1 -1
- package/dist/react-native/common/platform.d.ts +6 -1
- package/dist/react-native/common/platform.d.ts.map +1 -1
- package/dist/react-native/common/platform.js +23 -4
- package/dist/react-native/common/platform.js.map +1 -1
- package/dist/react-native/diagnostics/DiagnosticNodeInternal.d.ts +1 -0
- package/dist/react-native/diagnostics/DiagnosticNodeInternal.d.ts.map +1 -1
- package/dist/react-native/diagnostics/DiagnosticNodeInternal.js.map +1 -1
- package/dist/react-native/documents/ConnectionPolicy.d.ts +6 -0
- package/dist/react-native/documents/ConnectionPolicy.d.ts.map +1 -1
- package/dist/react-native/documents/ConnectionPolicy.js +2 -0
- package/dist/react-native/documents/ConnectionPolicy.js.map +1 -1
- package/dist/react-native/documents/DatabaseAccount.d.ts.map +1 -1
- package/dist/react-native/documents/DatabaseAccount.js +3 -0
- package/dist/react-native/documents/DatabaseAccount.js.map +1 -1
- package/dist/react-native/extractPartitionKey.d.ts.map +1 -1
- package/dist/react-native/extractPartitionKey.js +33 -20
- package/dist/react-native/extractPartitionKey.js.map +1 -1
- package/dist/react-native/globalEndpointManager.d.ts +6 -0
- package/dist/react-native/globalEndpointManager.d.ts.map +1 -1
- package/dist/react-native/globalEndpointManager.js +9 -4
- package/dist/react-native/globalEndpointManager.js.map +1 -1
- package/dist/react-native/globalPartitionEndpointManager.d.ts +79 -0
- package/dist/react-native/globalPartitionEndpointManager.d.ts.map +1 -0
- package/dist/react-native/globalPartitionEndpointManager.js +279 -0
- package/dist/react-native/globalPartitionEndpointManager.js.map +1 -0
- package/dist/react-native/queryExecutionContext/Aggregators/index.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/Aggregators/index.js +1 -0
- package/dist/react-native/queryExecutionContext/Aggregators/index.js.map +1 -1
- package/dist/react-native/queryExecutionContext/documentProducer.d.ts +2 -3
- package/dist/react-native/queryExecutionContext/documentProducer.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/documentProducer.js +16 -21
- package/dist/react-native/queryExecutionContext/documentProducer.js.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js +2 -1
- package/dist/react-native/queryExecutionContext/parallelQueryExecutionContextBase.js.map +1 -1
- package/dist/react-native/queryIterator.js +1 -2
- package/dist/react-native/queryIterator.js.map +1 -1
- package/dist/react-native/request/ErrorResponse.d.ts +1 -1
- package/dist/react-native/request/ErrorResponse.d.ts.map +1 -1
- package/dist/react-native/request/ErrorResponse.js.map +1 -1
- package/dist/react-native/request/RequestContext.d.ts +5 -0
- package/dist/react-native/request/RequestContext.d.ts.map +1 -1
- package/dist/react-native/request/RequestContext.js.map +1 -1
- package/dist/react-native/request/RequestHandler.d.ts.map +1 -1
- package/dist/react-native/request/RequestHandler.js +14 -4
- package/dist/react-native/request/RequestHandler.js.map +1 -1
- package/dist/react-native/request/defaultAgent.js +2 -2
- package/dist/react-native/request/defaultAgent.js.map +1 -1
- package/dist/react-native/retry/RetryPolicy.d.ts +2 -2
- package/dist/react-native/retry/RetryPolicy.d.ts.map +1 -1
- package/dist/react-native/retry/RetryPolicy.js.map +1 -1
- package/dist/react-native/retry/defaultRetryPolicy.d.ts.map +1 -1
- package/dist/react-native/retry/defaultRetryPolicy.js +4 -8
- package/dist/react-native/retry/defaultRetryPolicy.js.map +1 -1
- package/dist/react-native/retry/endpointDiscoveryRetryPolicy.d.ts +5 -3
- package/dist/react-native/retry/endpointDiscoveryRetryPolicy.d.ts.map +1 -1
- package/dist/react-native/retry/endpointDiscoveryRetryPolicy.js +9 -2
- package/dist/react-native/retry/endpointDiscoveryRetryPolicy.js.map +1 -1
- package/dist/react-native/retry/retryUtility.d.ts.map +1 -1
- package/dist/react-native/retry/retryUtility.js +11 -5
- package/dist/react-native/retry/retryUtility.js.map +1 -1
- package/dist/react-native/retry/timeoutFailoverRetryPolicy.d.ts +6 -3
- package/dist/react-native/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
- package/dist/react-native/retry/timeoutFailoverRetryPolicy.js +12 -4
- package/dist/react-native/retry/timeoutFailoverRetryPolicy.js.map +1 -1
- package/dist/react-native/routing/partitionKeyRangeCache.d.ts.map +1 -1
- package/dist/react-native/routing/partitionKeyRangeCache.js +11 -0
- package/dist/react-native/routing/partitionKeyRangeCache.js.map +1 -1
- package/dist/react-native/utils/checkURL.js +6 -0
- package/dist/react-native/utils/checkURL.js.map +1 -1
- package/dist/react-native/utils/hashing/hash.d.ts +2 -0
- package/dist/react-native/utils/hashing/hash.d.ts.map +1 -1
- package/dist/react-native/utils/hashing/hash.js +19 -0
- package/dist/react-native/utils/hashing/hash.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeoutFailoverRetryPolicy.js","sourceRoot":"","sources":["../../../src/retry/timeoutFailoverRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"timeoutFailoverRetryPolicy.js","sourceRoot":"","sources":["../../../src/retry/timeoutFailoverRetryPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAK9D;;;;;;GAMG;AACH,MAAM,OAAO,0BAA0B;IAQrC,YACU,qBAA4C,EAC5C,OAAsB,EACtB,UAAsB,EACtB,YAA0B,EAC1B,aAA4B,EAC5B,uBAAgC,EAChC,4BAAqC,EACrC,8BAA+D;QAP/D,0BAAqB,GAArB,qBAAqB,CAAuB;QAC5C,YAAO,GAAP,OAAO,CAAe;QACtB,eAAU,GAAV,UAAU,CAAY;QACtB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,kBAAa,GAAb,aAAa,CAAe;QAC5B,4BAAuB,GAAvB,uBAAuB,CAAS;QAChC,iCAA4B,GAA5B,4BAA4B,CAAS;QACrC,mCAA8B,GAA9B,8BAA8B,CAAiC;QAfjE,yBAAoB,GAAG,GAAG,CAAC;QAC3B,oCAA+B,GAAG,CAAC,CAAC;QACrC,mBAAc,GAAG,CAAC,CAAC;QACnB,uBAA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gB,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACpD,aAAa,GAAG,kBAAkB,GAAG,gBAAgB,CAAC,MAAM,CAAC;gBAC/D,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,CAAC;gBAC/E,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACtD,aAAa,GAAG,kBAAkB,GAAG,iBAAiB,CAAC,MAAM,CAAC;gBAChE,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { RetryPolicy } from \"./RetryPolicy.js\";\nimport { StatusCodes } from \"../common/statusCodes.js\";\nimport type { GlobalEndpointManager } from \"../globalEndpointManager.js\";\nimport { HTTPMethod, isReadRequest } from \"../common/index.js\";\nimport type { OperationType, ResourceType } from \"../common/constants.js\";\nimport { Constants } from \"../common/constants.js\";\nimport type { RetryContext } from \"./RetryContext.js\";\nimport type { CosmosHeaders } from \"../queryExecutionContext/CosmosHeaders.js\";\nimport { TimeoutErrorCode } from \"../request/TimeoutError.js\";\nimport type { ErrorResponse, RequestContext } from \"../request/index.js\";\nimport type { DiagnosticNodeInternal } from \"../diagnostics/DiagnosticNodeInternal.js\";\nimport { GlobalPartitionEndpointManager } from \"../globalPartitionEndpointManager.js\";\n\n/**\n * This class TimeoutFailoverRetryPolicy handles retries for read operations\n * (including data plane,metadata, and query plan) in case of request timeouts\n * (TimeoutError) or service unavailability (503 status code) by performing failover\n * and retrying on other regions.\n * @hidden\n */\nexport class TimeoutFailoverRetryPolicy implements RetryPolicy {\n private maxRetryAttemptCount = 120;\n private maxServiceUnavailableRetryCount = 1;\n public retryAfterInMs = 0;\n public failoverRetryCount = 0;\n public request: any;\n public locationEndpoint: any;\n\n constructor(\n private globalEndpointManager: GlobalEndpointManager,\n private headers: CosmosHeaders,\n private methodType: HTTPMethod,\n private resourceType: ResourceType,\n private operationType: OperationType,\n private enableEndPointDiscovery: boolean,\n private enablePartitionLevelFailover: boolean,\n private globalPartitionEndpointManager?: GlobalPartitionEndpointManager,\n ) {}\n\n /**\n * Checks if a timeout request is valid for the timeout failover retry policy.\n * A valid request should be a data plane, metadata, or query plan request.\n * @returns\n */\n private isValidRequestForTimeoutError(): boolean {\n const isQuery = Constants.HttpHeaders.IsQuery in this.headers;\n const isQueryPlan = Constants.HttpHeaders.IsQueryPlan in this.headers;\n if (this.methodType === HTTPMethod.get || isQuery || isQueryPlan) {\n return true;\n }\n return false;\n }\n\n public async shouldRetry(\n err: ErrorResponse,\n diagnosticNode: DiagnosticNodeInternal,\n retryContext?: RetryContext,\n locationEndpoint?: string,\n requestContext?: RequestContext,\n ): Promise<boolean> {\n if (!err) {\n return false;\n }\n if (!retryContext || !locationEndpoint) {\n return false;\n }\n\n // Mark the partition as unavailable.\n // Let the Retry logic decide if the request should be retried\n if (requestContext && this.globalPartitionEndpointManager) {\n await this.globalPartitionEndpointManager.tryPartitionLevelFailover(\n requestContext,\n diagnosticNode,\n );\n }\n\n // Check if the error is a timeout error (TimeoutErrorCode) and if it is not a valid HTTP network timeout request\n if (err.code === TimeoutErrorCode && !this.isValidRequestForTimeoutError()) {\n return false;\n }\n if (!this.enableEndPointDiscovery) {\n return false;\n }\n if (\n err.code === StatusCodes.ServiceUnavailable &&\n this.failoverRetryCount >= this.maxServiceUnavailableRetryCount\n ) {\n return false;\n }\n if (this.failoverRetryCount >= this.maxRetryAttemptCount) {\n return false;\n }\n const canUseMultipleWriteLocations = this.globalEndpointManager.canUseMultipleWriteLocations(\n this.resourceType,\n this.operationType,\n );\n const readRequest = isReadRequest(this.operationType);\n\n if (!canUseMultipleWriteLocations && !readRequest && !this.enablePartitionLevelFailover) {\n // Write requests on single master cannot be retried if partition level failover is disabled.\n // This means there are no other regions available to serve the writes.\n return false;\n }\n this.failoverRetryCount++;\n // Setting the retryLocationIndex to the next available location for retry.\n // The retryLocationIndex is determined based on the failoverRetryCount, starting from zero.\n retryContext.retryLocationServerIndex = await this.findEndpointIndex(this.failoverRetryCount);\n diagnosticNode.addData({ successfulRetryPolicy: \"timeout-failover\" });\n return true;\n }\n\n /**\n * Determines index of endpoint to be used for retry based upon failoverRetryCount and avalable locations\n * @param failoverRetryCount - count of failovers\n * @returns\n */\n private async findEndpointIndex(failoverRetryCount: number): Promise<number> {\n // count of preferred locations specified by user\n const preferredLocationsCount = this.globalEndpointManager.preferredLocationsCount;\n const readRequest = isReadRequest(this.operationType);\n let endpointIndex = 0;\n // If preferredLocationsCount is not zero, it indicates that the user has specified preferred locations.\n if (preferredLocationsCount !== 0) {\n // The endpointIndex is set based on the preferred location and the failover retry count.\n endpointIndex = failoverRetryCount % preferredLocationsCount;\n } else {\n // In the absence of preferred locations, the endpoint selection is based on the failover count and the number of available locations.\n if (readRequest) {\n const getReadEndpoints = await this.globalEndpointManager.getReadEndpoints();\n if (getReadEndpoints && getReadEndpoints.length > 0) {\n endpointIndex = failoverRetryCount % getReadEndpoints.length;\n }\n } else {\n const getWriteEndpoints = await this.globalEndpointManager.getWriteEndpoints();\n if (getWriteEndpoints && getWriteEndpoints.length > 0) {\n endpointIndex = failoverRetryCount % getWriteEndpoints.length;\n }\n }\n }\n return endpointIndex;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partitionKeyRangeCache.d.ts","sourceRoot":"","sources":["../../../src/routing/partitionKeyRangeCache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAGvF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"partitionKeyRangeCache.d.ts","sourceRoot":"","sources":["../../../src/routing/partitionKeyRangeCache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAGvF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,cAAc;AACd,qBAAa,sBAAsB;IAKrB,OAAO,CAAC,aAAa;IAJjC,OAAO,CAAC,kCAAkC,CAExC;gBAEkB,aAAa,EAAE,aAAa;IAGhD;;;;OAIG;IACU,sBAAsB,CACjC,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,sBAAsB,EACtC,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,4BAA4B,CAAC;IAWxC;;;OAGG;IACU,oBAAoB,CAC/B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,sBAAsB,EACtC,YAAY,GAAE,OAAe,GAC5B,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAKjB,2BAA2B;CAqC1C"}
|
|
@@ -4,6 +4,7 @@ import { MetadataLookUpType } from "../CosmosDiagnostics.js";
|
|
|
4
4
|
import { getIdFromLink } from "../common/helper.js";
|
|
5
5
|
import { withMetadataDiagnostics } from "../utils/diagnostics.js";
|
|
6
6
|
import { createCompleteRoutingMap } from "./CollectionRoutingMapFactory.js";
|
|
7
|
+
import { hashPartitionKey, binarySearchOnPartitionKeyRanges } from "../utils/hashing/hash.js";
|
|
7
8
|
/** @hidden */
|
|
8
9
|
export class PartitionKeyRangeCache {
|
|
9
10
|
constructor(clientContext) {
|
|
@@ -38,5 +39,15 @@ export class PartitionKeyRangeCache {
|
|
|
38
39
|
}, diagnosticNode, MetadataLookUpType.PartitionKeyRangeLookUp);
|
|
39
40
|
return createCompleteRoutingMap(resources.map((r) => [r, true]));
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Given a partition key, returns the partition key range id
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
async getPartitionKeyRangeIdFromPartitionKey(collectionLink, partitionKey, partitionKeyDefinition, diagnosticNode) {
|
|
47
|
+
const hashedPartitionKey = hashPartitionKey(partitionKey, partitionKeyDefinition);
|
|
48
|
+
const partitionKeyRanges = (await this.onCollectionRoutingMap(collectionLink, diagnosticNode)).getOrderedParitionKeyRanges();
|
|
49
|
+
const partitionKeyRangeId = binarySearchOnPartitionKeyRanges(partitionKeyRanges, hashedPartitionKey);
|
|
50
|
+
return partitionKeyRangeId;
|
|
51
|
+
}
|
|
41
52
|
}
|
|
42
53
|
//# sourceMappingURL=partitionKeyRangeCache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partitionKeyRangeCache.js","sourceRoot":"","sources":["../../../src/routing/partitionKeyRangeCache.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"partitionKeyRangeCache.js","sourceRoot":"","sources":["../../../src/routing/partitionKeyRangeCache.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,aAA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,cAAc,CAAC;iBACvC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;QAC3C,CAAC,EACD,cAAc,EACd,kBAAkB,CAAC,uBAAuB,CAC3C,CAAC;QACF,OAAO,wBAAwB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,sCAAsC,CACjD,cAAsB,EACtB,YAAkC,EAClC,sBAA8C,EAC9C,cAAsC;QAEtC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;QAClF,MAAM,kBAAkB,GAAG,CACzB,MAAM,IAAI,CAAC,sBAAsB,CAAC,cAAc,EAAE,cAAc,CAAC,CAClE,CAAC,2BAA2B,EAAE,CAAC;QAEhC,MAAM,mBAAmB,GAAG,gCAAgC,CAC1D,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;QACF,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { MetadataLookUpType } from \"../CosmosDiagnostics.js\";\nimport type { PartitionKeyRange } from \"../client/Container/PartitionKeyRange.js\";\nimport type { ClientContext } from \"../ClientContext.js\";\nimport { getIdFromLink } from \"../common/helper.js\";\nimport type { DiagnosticNodeInternal } from \"../diagnostics/DiagnosticNodeInternal.js\";\nimport { withMetadataDiagnostics } from \"../utils/diagnostics.js\";\nimport { createCompleteRoutingMap } from \"./CollectionRoutingMapFactory.js\";\nimport type { InMemoryCollectionRoutingMap } from \"./inMemoryCollectionRoutingMap.js\";\nimport type { QueryRange } from \"./QueryRange.js\";\nimport type { PartitionKeyDefinition } from \"../documents/PartitionKeyDefinition.js\";\nimport type { PartitionKeyInternal } from \"../documents/PartitionKeyInternal.js\";\nimport { hashPartitionKey, binarySearchOnPartitionKeyRanges } from \"../utils/hashing/hash.js\";\n\n/** @hidden */\nexport class PartitionKeyRangeCache {\n private collectionRoutingMapByCollectionId: {\n [key: string]: Promise<InMemoryCollectionRoutingMap>;\n };\n\n constructor(private clientContext: ClientContext) {\n this.collectionRoutingMapByCollectionId = {};\n }\n /**\n * Finds or Instantiates the requested Collection Routing Map\n * @param collectionLink - Requested collectionLink\n * @hidden\n */\n public async onCollectionRoutingMap(\n collectionLink: string,\n diagnosticNode: DiagnosticNodeInternal,\n forceRefresh: boolean = false,\n ): Promise<InMemoryCollectionRoutingMap> {\n const collectionId = getIdFromLink(collectionLink);\n if (this.collectionRoutingMapByCollectionId[collectionId] === undefined || forceRefresh) {\n this.collectionRoutingMapByCollectionId[collectionId] = this.requestCollectionRoutingMap(\n collectionLink,\n diagnosticNode,\n );\n }\n return this.collectionRoutingMapByCollectionId[collectionId];\n }\n\n /**\n * Given the query ranges and a collection, invokes the callback on the list of overlapping partition key ranges\n * @hidden\n */\n public async getOverlappingRanges(\n collectionLink: string,\n queryRange: QueryRange,\n diagnosticNode: DiagnosticNodeInternal,\n forceRefresh: boolean = false,\n ): Promise<PartitionKeyRange[]> {\n const crm = await this.onCollectionRoutingMap(collectionLink, diagnosticNode, forceRefresh);\n return crm.getOverlappingRanges(queryRange);\n }\n\n private async requestCollectionRoutingMap(\n collectionLink: string,\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<InMemoryCollectionRoutingMap> {\n const { resources } = await withMetadataDiagnostics(\n async (metadataDiagnostics: DiagnosticNodeInternal) => {\n return this.clientContext\n .queryPartitionKeyRanges(collectionLink)\n .fetchAllInternal(metadataDiagnostics);\n },\n diagnosticNode,\n MetadataLookUpType.PartitionKeyRangeLookUp,\n );\n return createCompleteRoutingMap(resources.map((r) => [r, true]));\n }\n\n /**\n * Given a partition key, returns the partition key range id\n * @internal\n */\n public async getPartitionKeyRangeIdFromPartitionKey(\n collectionLink: string,\n partitionKey: PartitionKeyInternal,\n partitionKeyDefinition: PartitionKeyDefinition,\n diagnosticNode: DiagnosticNodeInternal,\n ): Promise<string | undefined> {\n const hashedPartitionKey = hashPartitionKey(partitionKey, partitionKeyDefinition);\n const partitionKeyRanges = (\n await this.onCollectionRoutingMap(collectionLink, diagnosticNode)\n ).getOrderedParitionKeyRanges();\n\n const partitionKeyRangeId = binarySearchOnPartitionKeyRanges(\n partitionKeyRanges,\n hashedPartitionKey,\n );\n return partitionKeyRangeId;\n }\n}\n"]}
|
|
@@ -6,4 +6,10 @@ export function checkURL(testString) {
|
|
|
6
6
|
export function sanitizeEndpoint(url) {
|
|
7
7
|
return new URL(url).href.replace(/\/$/, "");
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export function normalizeEndpoint(endpoint) {
|
|
13
|
+
return endpoint.replace(/\s+/g, "").toLowerCase();
|
|
14
|
+
}
|
|
9
15
|
//# sourceMappingURL=checkURL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkURL.js","sourceRoot":"","sources":["../../../src/utils/checkURL.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,UAAU,QAAQ,CAAC,UAAkB;IACzC,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport function checkURL(testString: string): URL {\n return new URL(testString);\n}\n\nexport function sanitizeEndpoint(url: string): string {\n return new URL(url).href.replace(/\\/$/, \"\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"checkURL.js","sourceRoot":"","sources":["../../../src/utils/checkURL.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,UAAU,QAAQ,CAAC,UAAkB;IACzC,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport function checkURL(testString: string): URL {\n return new URL(testString);\n}\n\nexport function sanitizeEndpoint(url: string): string {\n return new URL(url).href.replace(/\\/$/, \"\");\n}\n\n/**\n * @internal\n */\nexport function normalizeEndpoint(endpoint: string): string {\n return endpoint.replace(/\\s+/g, \"\").toLowerCase();\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PartitionKeyRange } from "../../client/index.js";
|
|
1
2
|
import type { PartitionKeyDefinition, PrimitivePartitionKeyValue } from "../../documents/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* Generate hash of a PartitonKey based on it PartitionKeyDefinition.
|
|
@@ -6,4 +7,5 @@ import type { PartitionKeyDefinition, PrimitivePartitionKeyValue } from "../../d
|
|
|
6
7
|
* @returns
|
|
7
8
|
*/
|
|
8
9
|
export declare function hashPartitionKey(partitionKey: PrimitivePartitionKeyValue[], partitionDefinition: PartitionKeyDefinition): string;
|
|
10
|
+
export declare function binarySearchOnPartitionKeyRanges(partitionKeyRanges: PartitionKeyRange[], hashedPartitionKey: string): string | undefined;
|
|
9
11
|
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../../src/utils/hashing/hash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../../src/utils/hashing/hash.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAOnG;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,0BAA0B,EAAE,EAC1C,mBAAmB,EAAE,sBAAsB,GAC1C,MAAM,CAYR;AAED,wBAAgB,gCAAgC,CAC9C,kBAAkB,EAAE,iBAAiB,EAAE,EACvC,kBAAkB,EAAE,MAAM,GACzB,MAAM,GAAG,SAAS,CAiBpB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { PartitionKeyDefinitionVersion, PartitionKeyKind } from "../../documents/index.js";
|
|
4
|
+
import { isKeyInRange } from "../batch.js";
|
|
4
5
|
import { hashMultiHashPartitionKey } from "./multiHash.js";
|
|
5
6
|
import { hashV1PartitionKey } from "./v1.js";
|
|
6
7
|
import { hashV2PartitionKey } from "./v2.js";
|
|
@@ -22,4 +23,22 @@ export function hashPartitionKey(partitionKey, partitionDefinition) {
|
|
|
22
23
|
return hashMultiHashPartitionKey(partitionKey);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
26
|
+
export function binarySearchOnPartitionKeyRanges(partitionKeyRanges, hashedPartitionKey) {
|
|
27
|
+
let low = 0;
|
|
28
|
+
let high = partitionKeyRanges.length - 1;
|
|
29
|
+
while (low <= high) {
|
|
30
|
+
const mid = Math.floor((low + high) / 2);
|
|
31
|
+
const range = partitionKeyRanges[mid];
|
|
32
|
+
if (isKeyInRange(range.minInclusive, range.maxExclusive, hashedPartitionKey)) {
|
|
33
|
+
return range.id;
|
|
34
|
+
}
|
|
35
|
+
else if (hashedPartitionKey.localeCompare(range.minInclusive) < 0) {
|
|
36
|
+
high = mid - 1;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
low = mid + 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
25
44
|
//# sourceMappingURL=hash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../../src/utils/hashing/hash.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../../src/utils/hashing/hash.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,YAA0C,EAC1C,mBAA2C;IAE3C,MAAM,IAAI,GAAqB,CAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,IAAI,KAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,iBAAiB;IACpG,MAAM,IAAI,GACR,mBAAmB;QACnB,mBAAmB,CAAC,OAAO;QAC3B,mBAAmB,CAAC,OAAO,KAAK,6BAA6B,CAAC,EAAE,CAAC;IACnE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,gBAAgB,CAAC,IAAI;YACxB,OAAO,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACpF,KAAK,gBAAgB,CAAC,SAAS;YAC7B,OAAO,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,kBAAuC,EACvC,kBAA0B;IAE1B,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAG,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC;IAEzC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,YAAY,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAAE,CAAC;YAC7E,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,CAAC;aAAM,IAAI,kBAAkB,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;YACpE,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PartitionKeyRange } from \"../../client/index.js\";\nimport type { PartitionKeyDefinition, PrimitivePartitionKeyValue } from \"../../documents/index.js\";\nimport { PartitionKeyDefinitionVersion, PartitionKeyKind } from \"../../documents/index.js\";\nimport { isKeyInRange } from \"../batch.js\";\nimport { hashMultiHashPartitionKey } from \"./multiHash.js\";\nimport { hashV1PartitionKey } from \"./v1.js\";\nimport { hashV2PartitionKey } from \"./v2.js\";\n\n/**\n * Generate hash of a PartitonKey based on it PartitionKeyDefinition.\n * @param partitionKey - to be hashed.\n * @param partitionDefinition - container's partitionKey definition\n * @returns\n */\nexport function hashPartitionKey(\n partitionKey: PrimitivePartitionKeyValue[],\n partitionDefinition: PartitionKeyDefinition,\n): string {\n const kind: PartitionKeyKind = partitionDefinition?.kind || PartitionKeyKind.Hash; // Default value.\n const isV2 =\n partitionDefinition &&\n partitionDefinition.version &&\n partitionDefinition.version === PartitionKeyDefinitionVersion.V2;\n switch (kind) {\n case PartitionKeyKind.Hash:\n return isV2 ? hashV2PartitionKey(partitionKey) : hashV1PartitionKey(partitionKey);\n case PartitionKeyKind.MultiHash:\n return hashMultiHashPartitionKey(partitionKey);\n }\n}\n\nexport function binarySearchOnPartitionKeyRanges(\n partitionKeyRanges: PartitionKeyRange[],\n hashedPartitionKey: string,\n): string | undefined {\n let low = 0;\n let high = partitionKeyRanges.length - 1;\n\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n const range = partitionKeyRanges[mid];\n\n if (isKeyInRange(range.minInclusive, range.maxExclusive, hashedPartitionKey)) {\n return range.id;\n } else if (hashedPartitionKey.localeCompare(range.minInclusive) < 0) {\n high = mid - 1;\n } else {\n low = mid + 1;\n }\n }\n return undefined;\n}\n"]}
|
|
@@ -13,8 +13,8 @@ import type { BulkOptions } from "./utils/batch.js";
|
|
|
13
13
|
import type { ClientConfigDiagnostic, CosmosDiagnostics } from "./CosmosDiagnostics.js";
|
|
14
14
|
import type { DiagnosticNodeInternal } from "./diagnostics/DiagnosticNodeInternal.js";
|
|
15
15
|
import { CosmosDbDiagnosticLevel } from "./diagnostics/CosmosDbDiagnosticLevel.js";
|
|
16
|
+
import type { GlobalPartitionEndpointManager } from "./globalPartitionEndpointManager.js";
|
|
16
17
|
/**
|
|
17
|
-
* @hidden
|
|
18
18
|
* @hidden
|
|
19
19
|
*/
|
|
20
20
|
export declare class ClientContext {
|
|
@@ -22,6 +22,7 @@ export declare class ClientContext {
|
|
|
22
22
|
private globalEndpointManager;
|
|
23
23
|
private clientConfig;
|
|
24
24
|
diagnosticLevel: CosmosDbDiagnosticLevel;
|
|
25
|
+
private globalPartitionEndpointManager?;
|
|
25
26
|
private readonly sessionContainer;
|
|
26
27
|
private connectionPolicy;
|
|
27
28
|
private pipeline;
|
|
@@ -32,15 +33,16 @@ export declare class ClientContext {
|
|
|
32
33
|
};
|
|
33
34
|
/** boolean flag to support operations with client-side encryption */
|
|
34
35
|
enableEncryption: boolean;
|
|
35
|
-
constructor(cosmosClientOptions: CosmosClientOptions, globalEndpointManager: GlobalEndpointManager, clientConfig: ClientConfigDiagnostic, diagnosticLevel: CosmosDbDiagnosticLevel);
|
|
36
|
+
constructor(cosmosClientOptions: CosmosClientOptions, globalEndpointManager: GlobalEndpointManager, clientConfig: ClientConfigDiagnostic, diagnosticLevel: CosmosDbDiagnosticLevel, globalPartitionEndpointManager?: GlobalPartitionEndpointManager);
|
|
36
37
|
/** @hidden */
|
|
37
|
-
read<T>({ path, resourceType, resourceId, options, partitionKey, diagnosticNode, }: {
|
|
38
|
+
read<T>({ path, resourceType, resourceId, options, partitionKey, diagnosticNode, partitionKeyRangeId, }: {
|
|
38
39
|
path: string;
|
|
39
40
|
resourceType: ResourceType;
|
|
40
41
|
resourceId: string;
|
|
41
42
|
options?: RequestOptions;
|
|
42
43
|
partitionKey?: PartitionKey;
|
|
43
44
|
diagnosticNode: DiagnosticNodeInternal;
|
|
45
|
+
partitionKeyRangeId?: string;
|
|
44
46
|
}): Promise<Response<T & Resource>>;
|
|
45
47
|
queryFeed<T>({ path, resourceType, resourceId, resultFn, query, options, diagnosticNode, partitionKeyRangeId, partitionKey, startEpk, endEpk, correlatedActivityId, }: {
|
|
46
48
|
path: string;
|
|
@@ -60,7 +62,7 @@ export declare class ClientContext {
|
|
|
60
62
|
}): Promise<Response<T & Resource>>;
|
|
61
63
|
getQueryPlan(path: string, resourceType: ResourceType, resourceId: string, query: SqlQuerySpec | string, options: FeedOptions, diagnosticNode: DiagnosticNodeInternal, correlatedActivityId?: string): Promise<Response<PartitionedQueryExecutionInfo>>;
|
|
62
64
|
queryPartitionKeyRanges(collectionLink: string, query?: string | SqlQuerySpec, options?: FeedOptions): QueryIterator<PartitionKeyRange>;
|
|
63
|
-
delete<T>({ path, resourceType, resourceId, options, partitionKey, method, diagnosticNode, }: {
|
|
65
|
+
delete<T>({ path, resourceType, resourceId, options, partitionKey, method, diagnosticNode, partitionKeyRangeId, }: {
|
|
64
66
|
path: string;
|
|
65
67
|
resourceType: ResourceType;
|
|
66
68
|
resourceId: string;
|
|
@@ -68,8 +70,9 @@ export declare class ClientContext {
|
|
|
68
70
|
partitionKey?: PartitionKey;
|
|
69
71
|
method?: HTTPMethod;
|
|
70
72
|
diagnosticNode: DiagnosticNodeInternal;
|
|
73
|
+
partitionKeyRangeId?: string;
|
|
71
74
|
}): Promise<Response<T & Resource>>;
|
|
72
|
-
patch<T>({ body, path, resourceType, resourceId, options, partitionKey, diagnosticNode, }: {
|
|
75
|
+
patch<T>({ body, path, resourceType, resourceId, options, partitionKey, diagnosticNode, partitionKeyRangeId, }: {
|
|
73
76
|
body: any;
|
|
74
77
|
path: string;
|
|
75
78
|
resourceType: ResourceType;
|
|
@@ -77,8 +80,9 @@ export declare class ClientContext {
|
|
|
77
80
|
options?: RequestOptions;
|
|
78
81
|
partitionKey?: PartitionKey;
|
|
79
82
|
diagnosticNode: DiagnosticNodeInternal;
|
|
83
|
+
partitionKeyRangeId?: string;
|
|
80
84
|
}): Promise<Response<T & Resource>>;
|
|
81
|
-
create<T, U = T>({ body, path, resourceType, resourceId, diagnosticNode, options, partitionKey, }: {
|
|
85
|
+
create<T, U = T>({ body, path, resourceType, resourceId, diagnosticNode, options, partitionKey, partitionKeyRangeId, }: {
|
|
82
86
|
body: T;
|
|
83
87
|
path: string;
|
|
84
88
|
resourceType: ResourceType;
|
|
@@ -86,10 +90,11 @@ export declare class ClientContext {
|
|
|
86
90
|
diagnosticNode: DiagnosticNodeInternal;
|
|
87
91
|
options?: RequestOptions;
|
|
88
92
|
partitionKey?: PartitionKey;
|
|
93
|
+
partitionKeyRangeId?: string;
|
|
89
94
|
}): Promise<Response<T & U & Resource>>;
|
|
90
95
|
private processQueryFeedResponse;
|
|
91
96
|
private applySessionToken;
|
|
92
|
-
replace<T>({ body, path, resourceType, resourceId, options, partitionKey, diagnosticNode, }: {
|
|
97
|
+
replace<T>({ body, path, resourceType, resourceId, options, partitionKey, diagnosticNode, partitionKeyRangeId, }: {
|
|
93
98
|
body: any;
|
|
94
99
|
path: string;
|
|
95
100
|
resourceType: ResourceType;
|
|
@@ -97,8 +102,9 @@ export declare class ClientContext {
|
|
|
97
102
|
options?: RequestOptions;
|
|
98
103
|
partitionKey?: PartitionKey;
|
|
99
104
|
diagnosticNode: DiagnosticNodeInternal;
|
|
105
|
+
partitionKeyRangeId?: string;
|
|
100
106
|
}): Promise<Response<T & Resource>>;
|
|
101
|
-
upsert<T, U = T>({ body, path, resourceType, resourceId, options, partitionKey, diagnosticNode, }: {
|
|
107
|
+
upsert<T, U = T>({ body, path, resourceType, resourceId, options, partitionKey, diagnosticNode, partitionKeyRangeId, }: {
|
|
102
108
|
body: T;
|
|
103
109
|
path: string;
|
|
104
110
|
resourceType: ResourceType;
|
|
@@ -106,13 +112,15 @@ export declare class ClientContext {
|
|
|
106
112
|
options?: RequestOptions;
|
|
107
113
|
partitionKey?: PartitionKey;
|
|
108
114
|
diagnosticNode: DiagnosticNodeInternal;
|
|
115
|
+
partitionKeyRangeId?: string;
|
|
109
116
|
}): Promise<Response<T & U & Resource>>;
|
|
110
|
-
execute<T>({ sprocLink, params, options, partitionKey, diagnosticNode, }: {
|
|
117
|
+
execute<T>({ sprocLink, params, options, partitionKey, diagnosticNode, partitionKeyRangeId, }: {
|
|
111
118
|
sprocLink: string;
|
|
112
119
|
params?: any[];
|
|
113
120
|
options?: RequestOptions;
|
|
114
121
|
partitionKey?: PartitionKey;
|
|
115
122
|
diagnosticNode: DiagnosticNodeInternal;
|
|
123
|
+
partitionKeyRangeId?: string;
|
|
116
124
|
}): Promise<Response<T>>;
|
|
117
125
|
/**
|
|
118
126
|
* Gets the Database account information.
|
|
@@ -124,13 +132,14 @@ export declare class ClientContext {
|
|
|
124
132
|
getReadEndpoint(diagnosticNode: DiagnosticNodeInternal): Promise<string>;
|
|
125
133
|
getWriteEndpoints(): Promise<readonly string[]>;
|
|
126
134
|
getReadEndpoints(): Promise<readonly string[]>;
|
|
127
|
-
batch<T>({ body, path, partitionKey, resourceId, options, diagnosticNode, }: {
|
|
135
|
+
batch<T>({ body, path, partitionKey, resourceId, options, diagnosticNode, partitionKeyRangeId, }: {
|
|
128
136
|
body: T;
|
|
129
137
|
path: string;
|
|
130
138
|
partitionKey: PartitionKey;
|
|
131
139
|
resourceId: string;
|
|
132
140
|
options?: RequestOptions;
|
|
133
141
|
diagnosticNode: DiagnosticNodeInternal;
|
|
142
|
+
partitionKeyRangeId?: string;
|
|
134
143
|
}): Promise<Response<any>>;
|
|
135
144
|
bulk<T>({ body, path, partitionKeyRangeId, resourceId, bulkOptions, options, diagnosticNode, }: {
|
|
136
145
|
body: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientContext.d.ts","sourceRoot":"","sources":["../../src/ClientContext.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAa,UAAU,EAAiB,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG3F,OAAO,KAAK,EAAS,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAEL,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,C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,CAAC;QACzB,cAAc,EAAE,sBAAsB,CAAC;QACvC,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IA4Cb,IAAI,CAAC,CAAC,EAAE,EACnB,IAAI,EACJ,IAAI,EACJ,mBAAmB,EACnB,UAAU,EACV,WAAgB,EAChB,OAAY,EACZ,cAAc,GACf,EAAE;QACD,IAAI,EAAE,CAAC,CAAC;QACR,IAAI,EAAE,MAAM,CAAC;QACb,mBAAmB,EAAE,MAAM,CAAC;QAC5B,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,OAAO,CAAC,EAAE,cAAc,CAAC;QACzB,cAAc,EAAE,sBAAsB,CAAC;KACxC,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IA2C1B,OAAO,CAAC,mBAAmB;IAoBpB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKrC,iBAAiB,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAKtD,4BAA4B,CAAC,eAAe,EAAE,uBAAuB,GAAG,IAAI;IAYnF,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,YAAY;IAsBpB;;;;OAIG;IACH,OAAO,CAAC,wCAAwC;IAsBzC,eAAe,IAAI,sBAAsB;CA8BjD"}
|
|
@@ -21,19 +21,20 @@ const DiagnosticFormatter_js_1 = require("./diagnostics/DiagnosticFormatter.js")
|
|
|
21
21
|
const CosmosDbDiagnosticLevel_js_1 = require("./diagnostics/CosmosDbDiagnosticLevel.js");
|
|
22
22
|
const core_util_1 = require("@azure/core-util");
|
|
23
23
|
const platform_js_1 = require("./common/platform.js");
|
|
24
|
+
const partitionKeyRangeCache_js_1 = require("./routing/partitionKeyRangeCache.js");
|
|
24
25
|
const logger = (0, logger_1.createClientLogger)("ClientContext");
|
|
25
26
|
const QueryJsonContentType = "application/query+json";
|
|
26
27
|
const HttpHeaders = constants_js_1.Constants.HttpHeaders;
|
|
27
28
|
/**
|
|
28
|
-
* @hidden
|
|
29
29
|
* @hidden
|
|
30
30
|
*/
|
|
31
31
|
class ClientContext {
|
|
32
|
-
constructor(cosmosClientOptions, globalEndpointManager, clientConfig, diagnosticLevel) {
|
|
32
|
+
constructor(cosmosClientOptions, globalEndpointManager, clientConfig, diagnosticLevel, globalPartitionEndpointManager) {
|
|
33
33
|
this.cosmosClientOptions = cosmosClientOptions;
|
|
34
34
|
this.globalEndpointManager = globalEndpointManager;
|
|
35
35
|
this.clientConfig = clientConfig;
|
|
36
36
|
this.diagnosticLevel = diagnosticLevel;
|
|
37
|
+
this.globalPartitionEndpointManager = globalPartitionEndpointManager;
|
|
37
38
|
/** boolean flag to support operations with client-side encryption */
|
|
38
39
|
this.enableEncryption = false;
|
|
39
40
|
if (cosmosClientOptions.clientEncryptionOptions) {
|
|
@@ -61,9 +62,10 @@ class ClientContext {
|
|
|
61
62
|
}));
|
|
62
63
|
}
|
|
63
64
|
this.initializeDiagnosticSettings(diagnosticLevel);
|
|
65
|
+
this.partitionKeyRangeCache = new partitionKeyRangeCache_js_1.PartitionKeyRangeCache(this);
|
|
64
66
|
}
|
|
65
67
|
/** @hidden */
|
|
66
|
-
async read({ path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, }) {
|
|
68
|
+
async read({ path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
67
69
|
try {
|
|
68
70
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: constants_js_1.HTTPMethod.get, path, operationType: constants_js_1.OperationType.Read, resourceId,
|
|
69
71
|
options,
|
|
@@ -74,6 +76,7 @@ class ClientContext {
|
|
|
74
76
|
resourceType,
|
|
75
77
|
});
|
|
76
78
|
request.headers = await this.buildHeaders(request);
|
|
79
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
77
80
|
if (resourceType === constants_js_1.ResourceType.clientencryptionkey) {
|
|
78
81
|
request.headers[HttpHeaders.AllowCachedReadsHeader] = true;
|
|
79
82
|
if (options.databaseRid) {
|
|
@@ -178,7 +181,7 @@ class ClientContext {
|
|
|
178
181
|
};
|
|
179
182
|
return new queryIterator_js_1.QueryIterator(this, query, options, cb);
|
|
180
183
|
}
|
|
181
|
-
async delete({ path, resourceType, resourceId, options = {}, partitionKey, method = constants_js_1.HTTPMethod.delete, diagnosticNode, }) {
|
|
184
|
+
async delete({ path, resourceType, resourceId, options = {}, partitionKey, method = constants_js_1.HTTPMethod.delete, diagnosticNode, partitionKeyRangeId, }) {
|
|
182
185
|
try {
|
|
183
186
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: method, operationType: constants_js_1.OperationType.Delete, path,
|
|
184
187
|
resourceType,
|
|
@@ -190,6 +193,7 @@ class ClientContext {
|
|
|
190
193
|
resourceType,
|
|
191
194
|
});
|
|
192
195
|
request.headers = await this.buildHeaders(request);
|
|
196
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
193
197
|
this.applySessionToken(request);
|
|
194
198
|
// deleteResource will use WriteEndpoint since it uses DELETE operation
|
|
195
199
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
@@ -207,7 +211,7 @@ class ClientContext {
|
|
|
207
211
|
throw err;
|
|
208
212
|
}
|
|
209
213
|
}
|
|
210
|
-
async patch({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, }) {
|
|
214
|
+
async patch({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
211
215
|
try {
|
|
212
216
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: constants_js_1.HTTPMethod.patch, operationType: constants_js_1.OperationType.Patch, path,
|
|
213
217
|
resourceType,
|
|
@@ -220,6 +224,7 @@ class ClientContext {
|
|
|
220
224
|
resourceType,
|
|
221
225
|
});
|
|
222
226
|
request.headers = await this.buildHeaders(request);
|
|
227
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
223
228
|
this.applySessionToken(request);
|
|
224
229
|
// patch will use WriteEndpoint
|
|
225
230
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
@@ -232,7 +237,7 @@ class ClientContext {
|
|
|
232
237
|
throw err;
|
|
233
238
|
}
|
|
234
239
|
}
|
|
235
|
-
async create({ body, path, resourceType, resourceId, diagnosticNode, options = {}, partitionKey, }) {
|
|
240
|
+
async create({ body, path, resourceType, resourceId, diagnosticNode, options = {}, partitionKey, partitionKeyRangeId, }) {
|
|
236
241
|
try {
|
|
237
242
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: constants_js_1.HTTPMethod.post, operationType: constants_js_1.OperationType.Create, path,
|
|
238
243
|
resourceType,
|
|
@@ -245,6 +250,7 @@ class ClientContext {
|
|
|
245
250
|
resourceType,
|
|
246
251
|
});
|
|
247
252
|
request.headers = await this.buildHeaders(request);
|
|
253
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
248
254
|
// create will use WriteEndpoint since it uses POST operation
|
|
249
255
|
this.applySessionToken(request);
|
|
250
256
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
@@ -293,7 +299,7 @@ class ClientContext {
|
|
|
293
299
|
}
|
|
294
300
|
}
|
|
295
301
|
}
|
|
296
|
-
async replace({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, }) {
|
|
302
|
+
async replace({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
297
303
|
try {
|
|
298
304
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: constants_js_1.HTTPMethod.put, operationType: constants_js_1.OperationType.Replace, path,
|
|
299
305
|
resourceType,
|
|
@@ -306,6 +312,7 @@ class ClientContext {
|
|
|
306
312
|
resourceType,
|
|
307
313
|
});
|
|
308
314
|
request.headers = await this.buildHeaders(request);
|
|
315
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
309
316
|
this.applySessionToken(request);
|
|
310
317
|
// replace will use WriteEndpoint since it uses PUT operation
|
|
311
318
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
@@ -318,7 +325,7 @@ class ClientContext {
|
|
|
318
325
|
throw err;
|
|
319
326
|
}
|
|
320
327
|
}
|
|
321
|
-
async upsert({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, }) {
|
|
328
|
+
async upsert({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
322
329
|
try {
|
|
323
330
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: constants_js_1.HTTPMethod.post, operationType: constants_js_1.OperationType.Upsert, path,
|
|
324
331
|
resourceType,
|
|
@@ -331,6 +338,7 @@ class ClientContext {
|
|
|
331
338
|
resourceType,
|
|
332
339
|
});
|
|
333
340
|
request.headers = await this.buildHeaders(request);
|
|
341
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
334
342
|
request.headers[HttpHeaders.IsUpsert] = true;
|
|
335
343
|
this.applySessionToken(request);
|
|
336
344
|
// upsert will use WriteEndpoint since it uses POST operation
|
|
@@ -344,7 +352,7 @@ class ClientContext {
|
|
|
344
352
|
throw err;
|
|
345
353
|
}
|
|
346
354
|
}
|
|
347
|
-
async execute({ sprocLink, params, options = {}, partitionKey, diagnosticNode, }) {
|
|
355
|
+
async execute({ sprocLink, params, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
348
356
|
// Accept a single parameter or an array of parameters.
|
|
349
357
|
// Didn't add type annotation for this because we should legacy this behavior
|
|
350
358
|
if (params !== null && params !== undefined && !Array.isArray(params)) {
|
|
@@ -358,6 +366,7 @@ class ClientContext {
|
|
|
358
366
|
resourceType: constants_js_1.ResourceType.sproc,
|
|
359
367
|
});
|
|
360
368
|
request.headers = await this.buildHeaders(request);
|
|
369
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
361
370
|
// executeStoredProcedure will use WriteEndpoint since it uses POST operation
|
|
362
371
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
363
372
|
const response = await (0, Plugin_js_1.executePlugins)(diagnosticNode, request, RequestHandler_js_1.RequestHandler.request, Plugin_js_1.PluginOn.operation);
|
|
@@ -399,7 +408,7 @@ class ClientContext {
|
|
|
399
408
|
getReadEndpoints() {
|
|
400
409
|
return this.globalEndpointManager.getReadEndpoints();
|
|
401
410
|
}
|
|
402
|
-
async batch({ body, path, partitionKey, resourceId, options = {}, diagnosticNode, }) {
|
|
411
|
+
async batch({ body, path, partitionKey, resourceId, options = {}, diagnosticNode, partitionKeyRangeId, }) {
|
|
403
412
|
try {
|
|
404
413
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: constants_js_1.HTTPMethod.post, operationType: constants_js_1.OperationType.Batch, path,
|
|
405
414
|
body, resourceType: constants_js_1.ResourceType.item, resourceId,
|
|
@@ -410,6 +419,7 @@ class ClientContext {
|
|
|
410
419
|
resourceType: constants_js_1.ResourceType.item,
|
|
411
420
|
});
|
|
412
421
|
request.headers = await this.buildHeaders(request);
|
|
422
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
413
423
|
request.headers[HttpHeaders.IsBatchRequest] = true;
|
|
414
424
|
request.headers[HttpHeaders.IsBatchAtomic] = true;
|
|
415
425
|
this.applySessionToken(request);
|
|
@@ -435,6 +445,7 @@ class ClientContext {
|
|
|
435
445
|
resourceType: constants_js_1.ResourceType.item,
|
|
436
446
|
});
|
|
437
447
|
request.headers = await this.buildHeaders(request);
|
|
448
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
438
449
|
request.headers[HttpHeaders.IsBatchRequest] = true;
|
|
439
450
|
request.headers[HttpHeaders.PartitionKeyRangeID] = partitionKeyRangeId;
|
|
440
451
|
request.headers[HttpHeaders.IsBatchAtomic] = false;
|
|
@@ -538,6 +549,7 @@ class ClientContext {
|
|
|
538
549
|
plugins: this.cosmosClientOptions.plugins,
|
|
539
550
|
pipeline: this.pipeline,
|
|
540
551
|
httpClient: this.cosmosClientOptions.httpClient,
|
|
552
|
+
globalPartitionEndpointManager: this.globalPartitionEndpointManager,
|
|
541
553
|
};
|
|
542
554
|
}
|
|
543
555
|
getClientConfig() {
|
|
@@ -547,7 +559,7 @@ class ClientContext {
|
|
|
547
559
|
* @internal
|
|
548
560
|
*/
|
|
549
561
|
refreshUserAgent(hostFramework) {
|
|
550
|
-
const updatedUserAgent = (0, platform_js_1.getUserAgent)(this.cosmosClientOptions
|
|
562
|
+
const updatedUserAgent = (0, platform_js_1.getUserAgent)(this.cosmosClientOptions, hostFramework);
|
|
551
563
|
this.cosmosClientOptions.defaultHeaders[constants_js_1.Constants.HttpHeaders.UserAgent] = updatedUserAgent;
|
|
552
564
|
this.cosmosClientOptions.defaultHeaders[constants_js_1.Constants.HttpHeaders.CustomUserAgent] =
|
|
553
565
|
updatedUserAgent;
|
|
@@ -558,6 +570,13 @@ class ClientContext {
|
|
|
558
570
|
getRetryOptions() {
|
|
559
571
|
return this.connectionPolicy.retryOptions;
|
|
560
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* @internal
|
|
575
|
+
*/
|
|
576
|
+
isPartitionLevelFailOverEnabled() {
|
|
577
|
+
return (this.connectionPolicy.enablePartitionLevelFailover ||
|
|
578
|
+
this.connectionPolicy.enablePartitionLevelCircuitBreaker);
|
|
579
|
+
}
|
|
561
580
|
}
|
|
562
581
|
exports.ClientContext = ClientContext;
|
|
563
582
|
//# sourceMappingURL=ClientContext.js.map
|