@azure/cosmos 4.4.1 → 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 +1 -0
- package/dist/browser/client/Item/Items.d.ts.map +1 -1
- package/dist/browser/client/Item/Items.js +20 -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/documents/PartitionKeyDefinition.d.ts +1 -1
- package/dist/browser/documents/PartitionKeyDefinition.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/hybridQueryExecutionContext.d.ts +3 -1
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.js +10 -2
- package/dist/browser/queryExecutionContext/hybridQueryExecutionContext.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.d.ts.map +1 -1
- package/dist/browser/queryIterator.js +2 -3
- 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 +1 -0
- package/dist/commonjs/client/Item/Items.d.ts.map +1 -1
- package/dist/commonjs/client/Item/Items.js +18 -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/documents/PartitionKeyDefinition.d.ts +1 -1
- package/dist/commonjs/documents/PartitionKeyDefinition.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/hybridQueryExecutionContext.d.ts +3 -1
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.js +10 -2
- package/dist/commonjs/queryExecutionContext/hybridQueryExecutionContext.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.d.ts.map +1 -1
- package/dist/commonjs/queryIterator.js +2 -3
- 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/tsdoc-metadata.json +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 +1 -0
- package/dist/esm/client/Item/Items.d.ts.map +1 -1
- package/dist/esm/client/Item/Items.js +20 -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/documents/PartitionKeyDefinition.d.ts +1 -1
- package/dist/esm/documents/PartitionKeyDefinition.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/hybridQueryExecutionContext.d.ts +3 -1
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.js +10 -2
- package/dist/esm/queryExecutionContext/hybridQueryExecutionContext.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.d.ts.map +1 -1
- package/dist/esm/queryIterator.js +2 -3
- 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 +1 -0
- package/dist/react-native/client/Item/Items.d.ts.map +1 -1
- package/dist/react-native/client/Item/Items.js +20 -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/documents/PartitionKeyDefinition.d.ts +1 -1
- package/dist/react-native/documents/PartitionKeyDefinition.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/hybridQueryExecutionContext.d.ts +3 -1
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.d.ts.map +1 -1
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.js +10 -2
- package/dist/react-native/queryExecutionContext/hybridQueryExecutionContext.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.d.ts.map +1 -1
- package/dist/react-native/queryIterator.js +2 -3
- 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 +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeoutFailoverRetryPolicy.js","sourceRoot":"","sources":["../../../src/retry/timeoutFailoverRetryPolicy.ts"],"names":[],"mappings":";;;AAGA,6DAAuD;AAEvD,iDAA+D;AAE/D,yDAAmD;AAGnD,gEAA8D;
|
|
1
|
+
{"version":3,"file":"timeoutFailoverRetryPolicy.js","sourceRoot":"","sources":["../../../src/retry/timeoutFailoverRetryPolicy.ts"],"names":[],"mappings":";;;AAGA,6DAAuD;AAEvD,iDAA+D;AAE/D,yDAAmD;AAGnD,gEAA8D;AAK9D;;;;;;GAMG;AACH,MAAa,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,uBAAkB,GAAG,CAAC,CAAC;IAa3B,CAAC;IAEJ;;;;OAIG;IACK,6BAA6B;QACnC,MAAM,OAAO,GAAG,wBAAS,CAAC,WAAW,CAAC,OAAO,IAAI,IAAI,CAAC,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/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;AAzHD,gEAyHC","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"}
|
|
@@ -7,6 +7,7 @@ const CosmosDiagnostics_js_1 = require("../CosmosDiagnostics.js");
|
|
|
7
7
|
const helper_js_1 = require("../common/helper.js");
|
|
8
8
|
const diagnostics_js_1 = require("../utils/diagnostics.js");
|
|
9
9
|
const CollectionRoutingMapFactory_js_1 = require("./CollectionRoutingMapFactory.js");
|
|
10
|
+
const hash_js_1 = require("../utils/hashing/hash.js");
|
|
10
11
|
/** @hidden */
|
|
11
12
|
class PartitionKeyRangeCache {
|
|
12
13
|
constructor(clientContext) {
|
|
@@ -41,6 +42,16 @@ class PartitionKeyRangeCache {
|
|
|
41
42
|
}, diagnosticNode, CosmosDiagnostics_js_1.MetadataLookUpType.PartitionKeyRangeLookUp);
|
|
42
43
|
return (0, CollectionRoutingMapFactory_js_1.createCompleteRoutingMap)(resources.map((r) => [r, true]));
|
|
43
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Given a partition key, returns the partition key range id
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
async getPartitionKeyRangeIdFromPartitionKey(collectionLink, partitionKey, partitionKeyDefinition, diagnosticNode) {
|
|
50
|
+
const hashedPartitionKey = (0, hash_js_1.hashPartitionKey)(partitionKey, partitionKeyDefinition);
|
|
51
|
+
const partitionKeyRanges = (await this.onCollectionRoutingMap(collectionLink, diagnosticNode)).getOrderedParitionKeyRanges();
|
|
52
|
+
const partitionKeyRangeId = (0, hash_js_1.binarySearchOnPartitionKeyRanges)(partitionKeyRanges, hashedPartitionKey);
|
|
53
|
+
return partitionKeyRangeId;
|
|
54
|
+
}
|
|
44
55
|
}
|
|
45
56
|
exports.PartitionKeyRangeCache = PartitionKeyRangeCache;
|
|
46
57
|
//# 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,kEAA6D;AAG7D,mDAAoD;AAEpD,4DAAkE;AAClE,qFAA4E;
|
|
1
|
+
{"version":3,"file":"partitionKeyRangeCache.js","sourceRoot":"","sources":["../../../src/routing/partitionKeyRangeCache.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,kEAA6D;AAG7D,mDAAoD;AAEpD,4DAAkE;AAClE,qFAA4E;AAK5E,sDAA8F;AAE9F,cAAc;AACd,MAAa,sBAAsB;IAKjC,YAAoB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAC9C,IAAI,CAAC,kCAAkC,GAAG,EAAE,CAAC;IAC/C,CAAC;IAC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EAC9C,cAAsC;QAEtC,MAAM,kBAAkB,GAAG,IAAA,0BAAgB,EAAC,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,IAAA,0CAAgC,EAC1D,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;QACF,OAAO,mBAAmB,CAAC;IAC7B,CAAC;CACF;AA/ED,wDA+EC","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"]}
|
|
@@ -4,10 +4,17 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.checkURL = checkURL;
|
|
6
6
|
exports.sanitizeEndpoint = sanitizeEndpoint;
|
|
7
|
+
exports.normalizeEndpoint = normalizeEndpoint;
|
|
7
8
|
function checkURL(testString) {
|
|
8
9
|
return new URL(testString);
|
|
9
10
|
}
|
|
10
11
|
function sanitizeEndpoint(url) {
|
|
11
12
|
return new URL(url).href.replace(/\/$/, "");
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
function normalizeEndpoint(endpoint) {
|
|
18
|
+
return endpoint.replace(/\s+/g, "").toLowerCase();
|
|
19
|
+
}
|
|
13
20
|
//# 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,4BAEC;AAED,4CAEC;
|
|
1
|
+
{"version":3,"file":"checkURL.js","sourceRoot":"","sources":["../../../src/utils/checkURL.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,4BAEC;AAED,4CAEC;AAKD,8CAEC;AAbD,SAAgB,QAAQ,CAAC,UAAkB;IACzC,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC;AAED,SAAgB,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,SAAgB,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"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.hashPartitionKey = hashPartitionKey;
|
|
6
|
+
exports.binarySearchOnPartitionKeyRanges = binarySearchOnPartitionKeyRanges;
|
|
6
7
|
const index_js_1 = require("../../documents/index.js");
|
|
8
|
+
const batch_js_1 = require("../batch.js");
|
|
7
9
|
const multiHash_js_1 = require("./multiHash.js");
|
|
8
10
|
const v1_js_1 = require("./v1.js");
|
|
9
11
|
const v2_js_1 = require("./v2.js");
|
|
@@ -25,4 +27,22 @@ function hashPartitionKey(partitionKey, partitionDefinition) {
|
|
|
25
27
|
return (0, multiHash_js_1.hashMultiHashPartitionKey)(partitionKey);
|
|
26
28
|
}
|
|
27
29
|
}
|
|
30
|
+
function binarySearchOnPartitionKeyRanges(partitionKeyRanges, hashedPartitionKey) {
|
|
31
|
+
let low = 0;
|
|
32
|
+
let high = partitionKeyRanges.length - 1;
|
|
33
|
+
while (low <= high) {
|
|
34
|
+
const mid = Math.floor((low + high) / 2);
|
|
35
|
+
const range = partitionKeyRanges[mid];
|
|
36
|
+
if ((0, batch_js_1.isKeyInRange)(range.minInclusive, range.maxExclusive, hashedPartitionKey)) {
|
|
37
|
+
return range.id;
|
|
38
|
+
}
|
|
39
|
+
else if (hashedPartitionKey.localeCompare(range.minInclusive) < 0) {
|
|
40
|
+
high = mid - 1;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
low = mid + 1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
28
48
|
//# sourceMappingURL=hash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../../src/utils/hashing/hash.ts"],"names":[],"mappings":";AAA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,uBAAY,EAAC,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,CAAC;AAGxE,OAAO,KAAK,EAAyB,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAE5F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAMhF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAKtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"Cl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AG,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"}
|
|
@@ -18,19 +18,20 @@ import { DefaultDiagnosticFormatter } from "./diagnostics/DiagnosticFormatter.js
|
|
|
18
18
|
import { CosmosDbDiagnosticLevel } from "./diagnostics/CosmosDbDiagnosticLevel.js";
|
|
19
19
|
import { randomUUID } from "@azure/core-util";
|
|
20
20
|
import { getUserAgent } from "./common/platform.js";
|
|
21
|
+
import { PartitionKeyRangeCache } from "./routing/partitionKeyRangeCache.js";
|
|
21
22
|
const logger = createClientLogger("ClientContext");
|
|
22
23
|
const QueryJsonContentType = "application/query+json";
|
|
23
24
|
const HttpHeaders = Constants.HttpHeaders;
|
|
24
25
|
/**
|
|
25
|
-
* @hidden
|
|
26
26
|
* @hidden
|
|
27
27
|
*/
|
|
28
28
|
export class ClientContext {
|
|
29
|
-
constructor(cosmosClientOptions, globalEndpointManager, clientConfig, diagnosticLevel) {
|
|
29
|
+
constructor(cosmosClientOptions, globalEndpointManager, clientConfig, diagnosticLevel, globalPartitionEndpointManager) {
|
|
30
30
|
this.cosmosClientOptions = cosmosClientOptions;
|
|
31
31
|
this.globalEndpointManager = globalEndpointManager;
|
|
32
32
|
this.clientConfig = clientConfig;
|
|
33
33
|
this.diagnosticLevel = diagnosticLevel;
|
|
34
|
+
this.globalPartitionEndpointManager = globalPartitionEndpointManager;
|
|
34
35
|
/** boolean flag to support operations with client-side encryption */
|
|
35
36
|
this.enableEncryption = false;
|
|
36
37
|
if (cosmosClientOptions.clientEncryptionOptions) {
|
|
@@ -58,9 +59,10 @@ export class ClientContext {
|
|
|
58
59
|
}));
|
|
59
60
|
}
|
|
60
61
|
this.initializeDiagnosticSettings(diagnosticLevel);
|
|
62
|
+
this.partitionKeyRangeCache = new PartitionKeyRangeCache(this);
|
|
61
63
|
}
|
|
62
64
|
/** @hidden */
|
|
63
|
-
async read({ path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, }) {
|
|
65
|
+
async read({ path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
64
66
|
try {
|
|
65
67
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: HTTPMethod.get, path, operationType: OperationType.Read, resourceId,
|
|
66
68
|
options,
|
|
@@ -71,6 +73,7 @@ export class ClientContext {
|
|
|
71
73
|
resourceType,
|
|
72
74
|
});
|
|
73
75
|
request.headers = await this.buildHeaders(request);
|
|
76
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
74
77
|
if (resourceType === ResourceType.clientencryptionkey) {
|
|
75
78
|
request.headers[HttpHeaders.AllowCachedReadsHeader] = true;
|
|
76
79
|
if (options.databaseRid) {
|
|
@@ -175,7 +178,7 @@ export class ClientContext {
|
|
|
175
178
|
};
|
|
176
179
|
return new QueryIterator(this, query, options, cb);
|
|
177
180
|
}
|
|
178
|
-
async delete({ path, resourceType, resourceId, options = {}, partitionKey, method = HTTPMethod.delete, diagnosticNode, }) {
|
|
181
|
+
async delete({ path, resourceType, resourceId, options = {}, partitionKey, method = HTTPMethod.delete, diagnosticNode, partitionKeyRangeId, }) {
|
|
179
182
|
try {
|
|
180
183
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: method, operationType: OperationType.Delete, path,
|
|
181
184
|
resourceType,
|
|
@@ -187,6 +190,7 @@ export class ClientContext {
|
|
|
187
190
|
resourceType,
|
|
188
191
|
});
|
|
189
192
|
request.headers = await this.buildHeaders(request);
|
|
193
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
190
194
|
this.applySessionToken(request);
|
|
191
195
|
// deleteResource will use WriteEndpoint since it uses DELETE operation
|
|
192
196
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
@@ -204,7 +208,7 @@ export class ClientContext {
|
|
|
204
208
|
throw err;
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
|
-
async patch({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, }) {
|
|
211
|
+
async patch({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
208
212
|
try {
|
|
209
213
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: HTTPMethod.patch, operationType: OperationType.Patch, path,
|
|
210
214
|
resourceType,
|
|
@@ -217,6 +221,7 @@ export class ClientContext {
|
|
|
217
221
|
resourceType,
|
|
218
222
|
});
|
|
219
223
|
request.headers = await this.buildHeaders(request);
|
|
224
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
220
225
|
this.applySessionToken(request);
|
|
221
226
|
// patch will use WriteEndpoint
|
|
222
227
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
@@ -229,7 +234,7 @@ export class ClientContext {
|
|
|
229
234
|
throw err;
|
|
230
235
|
}
|
|
231
236
|
}
|
|
232
|
-
async create({ body, path, resourceType, resourceId, diagnosticNode, options = {}, partitionKey, }) {
|
|
237
|
+
async create({ body, path, resourceType, resourceId, diagnosticNode, options = {}, partitionKey, partitionKeyRangeId, }) {
|
|
233
238
|
try {
|
|
234
239
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: HTTPMethod.post, operationType: OperationType.Create, path,
|
|
235
240
|
resourceType,
|
|
@@ -242,6 +247,7 @@ export class ClientContext {
|
|
|
242
247
|
resourceType,
|
|
243
248
|
});
|
|
244
249
|
request.headers = await this.buildHeaders(request);
|
|
250
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
245
251
|
// create will use WriteEndpoint since it uses POST operation
|
|
246
252
|
this.applySessionToken(request);
|
|
247
253
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
@@ -290,7 +296,7 @@ export class ClientContext {
|
|
|
290
296
|
}
|
|
291
297
|
}
|
|
292
298
|
}
|
|
293
|
-
async replace({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, }) {
|
|
299
|
+
async replace({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
294
300
|
try {
|
|
295
301
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: HTTPMethod.put, operationType: OperationType.Replace, path,
|
|
296
302
|
resourceType,
|
|
@@ -303,6 +309,7 @@ export class ClientContext {
|
|
|
303
309
|
resourceType,
|
|
304
310
|
});
|
|
305
311
|
request.headers = await this.buildHeaders(request);
|
|
312
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
306
313
|
this.applySessionToken(request);
|
|
307
314
|
// replace will use WriteEndpoint since it uses PUT operation
|
|
308
315
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
@@ -315,7 +322,7 @@ export class ClientContext {
|
|
|
315
322
|
throw err;
|
|
316
323
|
}
|
|
317
324
|
}
|
|
318
|
-
async upsert({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, }) {
|
|
325
|
+
async upsert({ body, path, resourceType, resourceId, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
319
326
|
try {
|
|
320
327
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: HTTPMethod.post, operationType: OperationType.Upsert, path,
|
|
321
328
|
resourceType,
|
|
@@ -328,6 +335,7 @@ export class ClientContext {
|
|
|
328
335
|
resourceType,
|
|
329
336
|
});
|
|
330
337
|
request.headers = await this.buildHeaders(request);
|
|
338
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
331
339
|
request.headers[HttpHeaders.IsUpsert] = true;
|
|
332
340
|
this.applySessionToken(request);
|
|
333
341
|
// upsert will use WriteEndpoint since it uses POST operation
|
|
@@ -341,7 +349,7 @@ export class ClientContext {
|
|
|
341
349
|
throw err;
|
|
342
350
|
}
|
|
343
351
|
}
|
|
344
|
-
async execute({ sprocLink, params, options = {}, partitionKey, diagnosticNode, }) {
|
|
352
|
+
async execute({ sprocLink, params, options = {}, partitionKey, diagnosticNode, partitionKeyRangeId, }) {
|
|
345
353
|
// Accept a single parameter or an array of parameters.
|
|
346
354
|
// Didn't add type annotation for this because we should legacy this behavior
|
|
347
355
|
if (params !== null && params !== undefined && !Array.isArray(params)) {
|
|
@@ -355,6 +363,7 @@ export class ClientContext {
|
|
|
355
363
|
resourceType: ResourceType.sproc,
|
|
356
364
|
});
|
|
357
365
|
request.headers = await this.buildHeaders(request);
|
|
366
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
358
367
|
// executeStoredProcedure will use WriteEndpoint since it uses POST operation
|
|
359
368
|
request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(diagnosticNode, request.resourceType, request.operationType);
|
|
360
369
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
@@ -396,7 +405,7 @@ export class ClientContext {
|
|
|
396
405
|
getReadEndpoints() {
|
|
397
406
|
return this.globalEndpointManager.getReadEndpoints();
|
|
398
407
|
}
|
|
399
|
-
async batch({ body, path, partitionKey, resourceId, options = {}, diagnosticNode, }) {
|
|
408
|
+
async batch({ body, path, partitionKey, resourceId, options = {}, diagnosticNode, partitionKeyRangeId, }) {
|
|
400
409
|
try {
|
|
401
410
|
const request = Object.assign(Object.assign({}, this.getContextDerivedPropsForRequestCreation()), { method: HTTPMethod.post, operationType: OperationType.Batch, path,
|
|
402
411
|
body, resourceType: ResourceType.item, resourceId,
|
|
@@ -407,6 +416,7 @@ export class ClientContext {
|
|
|
407
416
|
resourceType: ResourceType.item,
|
|
408
417
|
});
|
|
409
418
|
request.headers = await this.buildHeaders(request);
|
|
419
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
410
420
|
request.headers[HttpHeaders.IsBatchRequest] = true;
|
|
411
421
|
request.headers[HttpHeaders.IsBatchAtomic] = true;
|
|
412
422
|
this.applySessionToken(request);
|
|
@@ -432,6 +442,7 @@ export class ClientContext {
|
|
|
432
442
|
resourceType: ResourceType.item,
|
|
433
443
|
});
|
|
434
444
|
request.headers = await this.buildHeaders(request);
|
|
445
|
+
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
435
446
|
request.headers[HttpHeaders.IsBatchRequest] = true;
|
|
436
447
|
request.headers[HttpHeaders.PartitionKeyRangeID] = partitionKeyRangeId;
|
|
437
448
|
request.headers[HttpHeaders.IsBatchAtomic] = false;
|
|
@@ -535,6 +546,7 @@ export class ClientContext {
|
|
|
535
546
|
plugins: this.cosmosClientOptions.plugins,
|
|
536
547
|
pipeline: this.pipeline,
|
|
537
548
|
httpClient: this.cosmosClientOptions.httpClient,
|
|
549
|
+
globalPartitionEndpointManager: this.globalPartitionEndpointManager,
|
|
538
550
|
};
|
|
539
551
|
}
|
|
540
552
|
getClientConfig() {
|
|
@@ -544,7 +556,7 @@ export class ClientContext {
|
|
|
544
556
|
* @internal
|
|
545
557
|
*/
|
|
546
558
|
refreshUserAgent(hostFramework) {
|
|
547
|
-
const updatedUserAgent = getUserAgent(this.cosmosClientOptions
|
|
559
|
+
const updatedUserAgent = getUserAgent(this.cosmosClientOptions, hostFramework);
|
|
548
560
|
this.cosmosClientOptions.defaultHeaders[Constants.HttpHeaders.UserAgent] = updatedUserAgent;
|
|
549
561
|
this.cosmosClientOptions.defaultHeaders[Constants.HttpHeaders.CustomUserAgent] =
|
|
550
562
|
updatedUserAgent;
|
|
@@ -555,5 +567,12 @@ export class ClientContext {
|
|
|
555
567
|
getRetryOptions() {
|
|
556
568
|
return this.connectionPolicy.retryOptions;
|
|
557
569
|
}
|
|
570
|
+
/**
|
|
571
|
+
* @internal
|
|
572
|
+
*/
|
|
573
|
+
isPartitionLevelFailOverEnabled() {
|
|
574
|
+
return (this.connectionPolicy.enablePartitionLevelFailover ||
|
|
575
|
+
this.connectionPolicy.enablePartitionLevelCircuitBreaker);
|
|
576
|
+
}
|
|
558
577
|
}
|
|
559
578
|
//# sourceMappingURL=ClientContext.js.map
|