@azure/cosmos 4.5.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/browser/ClientContext.d.ts.map +1 -1
- package/dist/browser/ClientContext.js +110 -19
- package/dist/browser/ClientContext.js.map +1 -1
- package/dist/browser/CosmosClient.d.ts +13 -0
- package/dist/browser/CosmosClient.d.ts.map +1 -1
- package/dist/browser/CosmosClient.js +19 -3
- package/dist/browser/CosmosClient.js.map +1 -1
- package/dist/browser/CosmosClientOptions.d.ts.map +1 -1
- package/dist/browser/CosmosClientOptions.js.map +1 -1
- package/dist/browser/CosmosDiagnostics.d.ts +4 -0
- package/dist/browser/CosmosDiagnostics.d.ts.map +1 -1
- package/dist/browser/CosmosDiagnostics.js.map +1 -1
- package/dist/browser/GlobalEndpointManagerOptions.d.ts +2 -0
- package/dist/browser/GlobalEndpointManagerOptions.d.ts.map +1 -0
- package/dist/browser/GlobalEndpointManagerOptions.js +2 -0
- package/dist/browser/GlobalEndpointManagerOptions.js.map +1 -0
- package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.js +3 -0
- package/dist/browser/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.js +3 -0
- package/dist/browser/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +5 -0
- package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
- package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.d.ts +1 -0
- package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
- package/dist/browser/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
- package/dist/browser/client/ChangeFeed/changeFeedUtils.js +1 -0
- package/dist/browser/client/ChangeFeed/changeFeedUtils.js.map +1 -1
- package/dist/browser/client/Item/Items.d.ts.map +1 -1
- package/dist/browser/client/Item/Items.js +5 -0
- package/dist/browser/client/Item/Items.js.map +1 -1
- package/dist/browser/common/constants.d.ts +4 -0
- package/dist/browser/common/constants.d.ts.map +1 -1
- package/dist/browser/common/constants.js +5 -1
- package/dist/browser/common/constants.js.map +1 -1
- package/dist/browser/common/helper.d.ts +6 -0
- package/dist/browser/common/helper.d.ts.map +1 -1
- package/dist/browser/common/helper.js +9 -1
- package/dist/browser/common/helper.js.map +1 -1
- package/dist/browser/common/platform.d.ts +1 -0
- package/dist/browser/common/platform.d.ts.map +1 -1
- package/dist/browser/common/platform.js +1 -3
- 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 +10 -4
- package/dist/browser/documents/ConnectionPolicy.d.ts.map +1 -1
- package/dist/browser/documents/ConnectionPolicy.js +2 -2
- package/dist/browser/documents/ConnectionPolicy.js.map +1 -1
- package/dist/browser/documents/DatabaseAccount.d.ts +4 -0
- package/dist/browser/documents/DatabaseAccount.d.ts.map +1 -1
- package/dist/browser/documents/DatabaseAccount.js +9 -0
- package/dist/browser/documents/DatabaseAccount.js.map +1 -1
- package/dist/browser/globalEndpointManager.d.ts +8 -0
- package/dist/browser/globalEndpointManager.d.ts.map +1 -1
- package/dist/browser/globalEndpointManager.js +68 -6
- package/dist/browser/globalEndpointManager.js.map +1 -1
- package/dist/browser/globalPartitionEndpointManager.d.ts +0 -2
- package/dist/browser/globalPartitionEndpointManager.d.ts.map +1 -1
- package/dist/browser/globalPartitionEndpointManager.js +13 -9
- package/dist/browser/globalPartitionEndpointManager.js.map +1 -1
- package/dist/browser/request/RequestHandler.js +2 -2
- package/dist/browser/request/RequestHandler.js.map +1 -1
- package/dist/browser/request/SharedOptions.d.ts +5 -0
- package/dist/browser/request/SharedOptions.d.ts.map +1 -1
- package/dist/browser/request/SharedOptions.js.map +1 -1
- package/dist/browser/retry/retryUtility.d.ts.map +1 -1
- package/dist/browser/retry/retryUtility.js +17 -3
- package/dist/browser/retry/retryUtility.js.map +1 -1
- package/dist/browser/retry/timeoutFailoverRetryPolicy.d.ts +1 -2
- package/dist/browser/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
- package/dist/browser/retry/timeoutFailoverRetryPolicy.js +4 -4
- package/dist/browser/retry/timeoutFailoverRetryPolicy.js.map +1 -1
- package/dist/browser/utils/encode.d.ts +1 -1
- package/dist/browser/utils/encode.d.ts.map +1 -1
- package/dist/browser/utils/encode.js.map +1 -1
- package/dist/commonjs/ClientContext.d.ts.map +1 -1
- package/dist/commonjs/ClientContext.js +110 -19
- package/dist/commonjs/ClientContext.js.map +1 -1
- package/dist/commonjs/CosmosClient.d.ts +13 -0
- package/dist/commonjs/CosmosClient.d.ts.map +1 -1
- package/dist/commonjs/CosmosClient.js +19 -3
- package/dist/commonjs/CosmosClient.js.map +1 -1
- package/dist/commonjs/CosmosClientOptions.d.ts.map +1 -1
- package/dist/commonjs/CosmosClientOptions.js.map +1 -1
- package/dist/commonjs/CosmosDiagnostics.d.ts +4 -0
- package/dist/commonjs/CosmosDiagnostics.d.ts.map +1 -1
- package/dist/commonjs/CosmosDiagnostics.js.map +1 -1
- package/dist/commonjs/GlobalEndpointManagerOptions.d.ts +2 -0
- package/dist/commonjs/GlobalEndpointManagerOptions.d.ts.map +1 -0
- package/dist/commonjs/GlobalEndpointManagerOptions.js +3 -0
- package/dist/commonjs/GlobalEndpointManagerOptions.js.map +1 -0
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.js +3 -0
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.js +3 -0
- package/dist/commonjs/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +5 -0
- package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.d.ts +1 -0
- package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
- package/dist/commonjs/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
- package/dist/commonjs/client/ChangeFeed/changeFeedUtils.js +1 -0
- package/dist/commonjs/client/ChangeFeed/changeFeedUtils.js.map +1 -1
- package/dist/commonjs/client/Item/Items.d.ts.map +1 -1
- package/dist/commonjs/client/Item/Items.js +5 -0
- package/dist/commonjs/client/Item/Items.js.map +1 -1
- package/dist/commonjs/common/constants.d.ts +4 -0
- package/dist/commonjs/common/constants.d.ts.map +1 -1
- package/dist/commonjs/common/constants.js +6 -2
- package/dist/commonjs/common/constants.js.map +1 -1
- package/dist/commonjs/common/helper.d.ts +6 -0
- package/dist/commonjs/common/helper.d.ts.map +1 -1
- package/dist/commonjs/common/helper.js +9 -0
- package/dist/commonjs/common/helper.js.map +1 -1
- package/dist/commonjs/common/platform.d.ts +1 -0
- package/dist/commonjs/common/platform.d.ts.map +1 -1
- package/dist/commonjs/common/platform.js +1 -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 +10 -4
- package/dist/commonjs/documents/ConnectionPolicy.d.ts.map +1 -1
- package/dist/commonjs/documents/ConnectionPolicy.js +2 -2
- package/dist/commonjs/documents/ConnectionPolicy.js.map +1 -1
- package/dist/commonjs/documents/DatabaseAccount.d.ts +4 -0
- package/dist/commonjs/documents/DatabaseAccount.d.ts.map +1 -1
- package/dist/commonjs/documents/DatabaseAccount.js +9 -0
- package/dist/commonjs/documents/DatabaseAccount.js.map +1 -1
- package/dist/commonjs/globalEndpointManager.d.ts +8 -0
- package/dist/commonjs/globalEndpointManager.d.ts.map +1 -1
- package/dist/commonjs/globalEndpointManager.js +68 -6
- package/dist/commonjs/globalEndpointManager.js.map +1 -1
- package/dist/commonjs/globalPartitionEndpointManager.d.ts +0 -2
- package/dist/commonjs/globalPartitionEndpointManager.d.ts.map +1 -1
- package/dist/commonjs/globalPartitionEndpointManager.js +13 -9
- package/dist/commonjs/globalPartitionEndpointManager.js.map +1 -1
- package/dist/commonjs/request/RequestHandler.js +2 -2
- package/dist/commonjs/request/RequestHandler.js.map +1 -1
- package/dist/commonjs/request/SharedOptions.d.ts +5 -0
- package/dist/commonjs/request/SharedOptions.d.ts.map +1 -1
- package/dist/commonjs/request/SharedOptions.js.map +1 -1
- package/dist/commonjs/retry/retryUtility.d.ts.map +1 -1
- package/dist/commonjs/retry/retryUtility.js +17 -3
- package/dist/commonjs/retry/retryUtility.js.map +1 -1
- package/dist/commonjs/retry/timeoutFailoverRetryPolicy.d.ts +1 -2
- package/dist/commonjs/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
- package/dist/commonjs/retry/timeoutFailoverRetryPolicy.js +4 -4
- package/dist/commonjs/retry/timeoutFailoverRetryPolicy.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utils/encode.d.ts +1 -1
- package/dist/commonjs/utils/encode.d.ts.map +1 -1
- package/dist/commonjs/utils/encode.js.map +1 -1
- package/dist/esm/ClientContext.d.ts.map +1 -1
- package/dist/esm/ClientContext.js +110 -19
- package/dist/esm/ClientContext.js.map +1 -1
- package/dist/esm/CosmosClient.d.ts +13 -0
- package/dist/esm/CosmosClient.d.ts.map +1 -1
- package/dist/esm/CosmosClient.js +19 -3
- package/dist/esm/CosmosClient.js.map +1 -1
- package/dist/esm/CosmosClientOptions.d.ts.map +1 -1
- package/dist/esm/CosmosClientOptions.js.map +1 -1
- package/dist/esm/CosmosDiagnostics.d.ts +4 -0
- package/dist/esm/CosmosDiagnostics.d.ts.map +1 -1
- package/dist/esm/CosmosDiagnostics.js.map +1 -1
- package/dist/esm/GlobalEndpointManagerOptions.d.ts +2 -0
- package/dist/esm/GlobalEndpointManagerOptions.d.ts.map +1 -0
- package/dist/esm/GlobalEndpointManagerOptions.js +2 -0
- package/dist/esm/GlobalEndpointManagerOptions.js.map +1 -0
- package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.js +3 -0
- package/dist/esm/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.js +3 -0
- package/dist/esm/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +5 -0
- package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
- package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.d.ts +1 -0
- package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
- package/dist/esm/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
- package/dist/esm/client/ChangeFeed/changeFeedUtils.js +1 -0
- package/dist/esm/client/ChangeFeed/changeFeedUtils.js.map +1 -1
- package/dist/esm/client/Item/Items.d.ts.map +1 -1
- package/dist/esm/client/Item/Items.js +5 -0
- package/dist/esm/client/Item/Items.js.map +1 -1
- package/dist/esm/common/constants.d.ts +4 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +5 -1
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/helper.d.ts +6 -0
- package/dist/esm/common/helper.d.ts.map +1 -1
- package/dist/esm/common/helper.js +9 -1
- package/dist/esm/common/helper.js.map +1 -1
- package/dist/esm/common/platform.d.ts +1 -0
- package/dist/esm/common/platform.d.ts.map +1 -1
- package/dist/esm/common/platform.js +1 -3
- 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 +10 -4
- package/dist/esm/documents/ConnectionPolicy.d.ts.map +1 -1
- package/dist/esm/documents/ConnectionPolicy.js +2 -2
- package/dist/esm/documents/ConnectionPolicy.js.map +1 -1
- package/dist/esm/documents/DatabaseAccount.d.ts +4 -0
- package/dist/esm/documents/DatabaseAccount.d.ts.map +1 -1
- package/dist/esm/documents/DatabaseAccount.js +9 -0
- package/dist/esm/documents/DatabaseAccount.js.map +1 -1
- package/dist/esm/globalEndpointManager.d.ts +8 -0
- package/dist/esm/globalEndpointManager.d.ts.map +1 -1
- package/dist/esm/globalEndpointManager.js +68 -6
- package/dist/esm/globalEndpointManager.js.map +1 -1
- package/dist/esm/globalPartitionEndpointManager.d.ts +0 -2
- package/dist/esm/globalPartitionEndpointManager.d.ts.map +1 -1
- package/dist/esm/globalPartitionEndpointManager.js +13 -9
- package/dist/esm/globalPartitionEndpointManager.js.map +1 -1
- package/dist/esm/request/RequestHandler.js +2 -2
- package/dist/esm/request/RequestHandler.js.map +1 -1
- package/dist/esm/request/SharedOptions.d.ts +5 -0
- package/dist/esm/request/SharedOptions.d.ts.map +1 -1
- package/dist/esm/request/SharedOptions.js.map +1 -1
- package/dist/esm/retry/retryUtility.d.ts.map +1 -1
- package/dist/esm/retry/retryUtility.js +17 -3
- package/dist/esm/retry/retryUtility.js.map +1 -1
- package/dist/esm/retry/timeoutFailoverRetryPolicy.d.ts +1 -2
- package/dist/esm/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
- package/dist/esm/retry/timeoutFailoverRetryPolicy.js +4 -4
- package/dist/esm/retry/timeoutFailoverRetryPolicy.js.map +1 -1
- package/dist/esm/utils/encode.d.ts +1 -1
- package/dist/esm/utils/encode.d.ts.map +1 -1
- package/dist/esm/utils/encode.js.map +1 -1
- package/dist/react-native/ClientContext.d.ts.map +1 -1
- package/dist/react-native/ClientContext.js +110 -19
- package/dist/react-native/ClientContext.js.map +1 -1
- package/dist/react-native/CosmosClient.d.ts +13 -0
- package/dist/react-native/CosmosClient.d.ts.map +1 -1
- package/dist/react-native/CosmosClient.js +19 -3
- package/dist/react-native/CosmosClient.js.map +1 -1
- package/dist/react-native/CosmosClientOptions.d.ts.map +1 -1
- package/dist/react-native/CosmosClientOptions.js.map +1 -1
- package/dist/react-native/CosmosDiagnostics.d.ts +4 -0
- package/dist/react-native/CosmosDiagnostics.d.ts.map +1 -1
- package/dist/react-native/CosmosDiagnostics.js.map +1 -1
- package/dist/react-native/GlobalEndpointManagerOptions.d.ts +2 -0
- package/dist/react-native/GlobalEndpointManagerOptions.d.ts.map +1 -0
- package/dist/react-native/GlobalEndpointManagerOptions.js +2 -0
- package/dist/react-native/GlobalEndpointManagerOptions.js.map +1 -0
- package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.js +3 -0
- package/dist/react-native/client/ChangeFeed/ChangeFeedForEpkRange.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.js +3 -0
- package/dist/react-native/client/ChangeFeed/ChangeFeedForPartitionKey.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts +5 -0
- package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/ChangeFeedIteratorOptions.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.d.ts +1 -0
- package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/InternalChangeFeedOptions.js.map +1 -1
- package/dist/react-native/client/ChangeFeed/changeFeedUtils.d.ts.map +1 -1
- package/dist/react-native/client/ChangeFeed/changeFeedUtils.js +1 -0
- package/dist/react-native/client/ChangeFeed/changeFeedUtils.js.map +1 -1
- package/dist/react-native/client/Item/Items.d.ts.map +1 -1
- package/dist/react-native/client/Item/Items.js +5 -0
- package/dist/react-native/client/Item/Items.js.map +1 -1
- package/dist/react-native/common/constants.d.ts +4 -0
- package/dist/react-native/common/constants.d.ts.map +1 -1
- package/dist/react-native/common/constants.js +5 -1
- package/dist/react-native/common/constants.js.map +1 -1
- package/dist/react-native/common/helper.d.ts +6 -0
- package/dist/react-native/common/helper.d.ts.map +1 -1
- package/dist/react-native/common/helper.js +9 -1
- package/dist/react-native/common/helper.js.map +1 -1
- package/dist/react-native/common/platform.d.ts +1 -0
- package/dist/react-native/common/platform.d.ts.map +1 -1
- package/dist/react-native/common/platform.js +1 -3
- 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 +10 -4
- package/dist/react-native/documents/ConnectionPolicy.d.ts.map +1 -1
- package/dist/react-native/documents/ConnectionPolicy.js +2 -2
- package/dist/react-native/documents/ConnectionPolicy.js.map +1 -1
- package/dist/react-native/documents/DatabaseAccount.d.ts +4 -0
- package/dist/react-native/documents/DatabaseAccount.d.ts.map +1 -1
- package/dist/react-native/documents/DatabaseAccount.js +9 -0
- package/dist/react-native/documents/DatabaseAccount.js.map +1 -1
- package/dist/react-native/globalEndpointManager.d.ts +8 -0
- package/dist/react-native/globalEndpointManager.d.ts.map +1 -1
- package/dist/react-native/globalEndpointManager.js +68 -6
- package/dist/react-native/globalEndpointManager.js.map +1 -1
- package/dist/react-native/globalPartitionEndpointManager.d.ts +0 -2
- package/dist/react-native/globalPartitionEndpointManager.d.ts.map +1 -1
- package/dist/react-native/globalPartitionEndpointManager.js +13 -9
- package/dist/react-native/globalPartitionEndpointManager.js.map +1 -1
- package/dist/react-native/request/RequestHandler.js +2 -2
- package/dist/react-native/request/RequestHandler.js.map +1 -1
- package/dist/react-native/request/SharedOptions.d.ts +5 -0
- package/dist/react-native/request/SharedOptions.d.ts.map +1 -1
- package/dist/react-native/request/SharedOptions.js.map +1 -1
- package/dist/react-native/retry/retryUtility.d.ts.map +1 -1
- package/dist/react-native/retry/retryUtility.js +17 -3
- package/dist/react-native/retry/retryUtility.js.map +1 -1
- package/dist/react-native/retry/timeoutFailoverRetryPolicy.d.ts +1 -2
- package/dist/react-native/retry/timeoutFailoverRetryPolicy.d.ts.map +1 -1
- package/dist/react-native/retry/timeoutFailoverRetryPolicy.js +4 -4
- package/dist/react-native/retry/timeoutFailoverRetryPolicy.js.map +1 -1
- package/dist/react-native/utils/encode.d.ts +1 -1
- package/dist/react-native/utils/encode.d.ts.map +1 -1
- package/dist/react-native/utils/encode.js.map +1 -1
- package/package.json +3 -2
|
@@ -19,6 +19,7 @@ import { CosmosDbDiagnosticLevel } from "./diagnostics/CosmosDbDiagnosticLevel.j
|
|
|
19
19
|
import { randomUUID } from "@azure/core-util";
|
|
20
20
|
import { getUserAgent } from "./common/platform.js";
|
|
21
21
|
import { PartitionKeyRangeCache } from "./routing/partitionKeyRangeCache.js";
|
|
22
|
+
import { AAD_DEFAULT_SCOPE, AAD_AUTH_PREFIX, AAD_RESOURCE_NOT_FOUND_ERROR, } from "./common/constants.js";
|
|
22
23
|
const logger = createClientLogger("ClientContext");
|
|
23
24
|
const QueryJsonContentType = "application/query+json";
|
|
24
25
|
const HttpHeaders = Constants.HttpHeaders;
|
|
@@ -57,16 +58,40 @@ export class ClientContext {
|
|
|
57
58
|
if (cosmosClientOptions.aadCredentials) {
|
|
58
59
|
this.pipeline = createEmptyPipeline();
|
|
59
60
|
const hrefEndpoint = sanitizeEndpoint(cosmosClientOptions.endpoint);
|
|
60
|
-
|
|
61
|
+
// Use custom AAD scope if provided, otherwise use account-based scope
|
|
62
|
+
const accountScope = `${hrefEndpoint}/.default`;
|
|
63
|
+
const primaryScope = cosmosClientOptions.aadScope || accountScope;
|
|
64
|
+
const fallbackScope = AAD_DEFAULT_SCOPE;
|
|
61
65
|
this.pipeline.addPolicy(bearerTokenAuthenticationPolicy({
|
|
62
66
|
credential: cosmosClientOptions.aadCredentials,
|
|
63
|
-
scopes:
|
|
67
|
+
scopes: primaryScope,
|
|
64
68
|
challengeCallbacks: {
|
|
65
69
|
async authorizeRequest({ request, getAccessToken }) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
try {
|
|
71
|
+
const tokenResponse = await getAccessToken([primaryScope], {});
|
|
72
|
+
const authorizationToken = `${AAD_AUTH_PREFIX}${tokenResponse.token}`;
|
|
73
|
+
request.headers.set(Constants.HttpHeaders.Authorization, authorizationToken);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
// If no custom scope is provided and we get AADSTS500011 error,
|
|
77
|
+
// fallback to the default Cosmos scope
|
|
78
|
+
if (!cosmosClientOptions.aadScope &&
|
|
79
|
+
error?.message?.includes(AAD_RESOURCE_NOT_FOUND_ERROR)) {
|
|
80
|
+
try {
|
|
81
|
+
const fallbackTokenResponse = await getAccessToken([fallbackScope], {});
|
|
82
|
+
const authorizationToken = `${AAD_AUTH_PREFIX}${fallbackTokenResponse.token}`;
|
|
83
|
+
request.headers.set(Constants.HttpHeaders.Authorization, authorizationToken);
|
|
84
|
+
}
|
|
85
|
+
catch (fallbackError) {
|
|
86
|
+
// If fallback also fails, throw the original error
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// If custom scope is provided or error is not AADSTS500011, throw the original error
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
70
95
|
},
|
|
71
96
|
},
|
|
72
97
|
}));
|
|
@@ -101,7 +126,13 @@ export class ClientContext {
|
|
|
101
126
|
}
|
|
102
127
|
this.applySessionToken(request);
|
|
103
128
|
// read will use ReadEndpoint since it uses GET operation
|
|
104
|
-
request.endpoint = await this.globalEndpointManager.
|
|
129
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
130
|
+
diagnosticNode: diagnosticNode,
|
|
131
|
+
resourceType: request.resourceType,
|
|
132
|
+
operationType: request.operationType,
|
|
133
|
+
startServiceEndpointIndex: 0,
|
|
134
|
+
excludedLocations: options?.excludedLocations,
|
|
135
|
+
});
|
|
105
136
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
106
137
|
this.captureSessionToken(undefined, path, OperationType.Read, response.headers);
|
|
107
138
|
return response;
|
|
@@ -134,7 +165,13 @@ export class ClientContext {
|
|
|
134
165
|
if (query !== undefined) {
|
|
135
166
|
request.method = HTTPMethod.post;
|
|
136
167
|
}
|
|
137
|
-
request.endpoint = await this.globalEndpointManager.
|
|
168
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
169
|
+
diagnosticNode: diagnosticNode,
|
|
170
|
+
resourceType: request.resourceType,
|
|
171
|
+
operationType: request.operationType,
|
|
172
|
+
startServiceEndpointIndex: 0,
|
|
173
|
+
excludedLocations: options?.excludedLocations,
|
|
174
|
+
});
|
|
138
175
|
request.headers = await this.buildHeaders(request);
|
|
139
176
|
if (startEpk !== undefined && endEpk !== undefined) {
|
|
140
177
|
request.headers[HttpHeaders.StartEpk] = startEpk;
|
|
@@ -178,7 +215,13 @@ export class ClientContext {
|
|
|
178
215
|
operationType: OperationType.Read,
|
|
179
216
|
resourceType,
|
|
180
217
|
});
|
|
181
|
-
request.endpoint = await this.globalEndpointManager.
|
|
218
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
219
|
+
diagnosticNode: diagnosticNode,
|
|
220
|
+
resourceType: request.resourceType,
|
|
221
|
+
operationType: request.operationType,
|
|
222
|
+
startServiceEndpointIndex: 0,
|
|
223
|
+
excludedLocations: options?.excludedLocations,
|
|
224
|
+
});
|
|
182
225
|
request.headers = await this.buildHeaders(request);
|
|
183
226
|
if (correlatedActivityId !== undefined) {
|
|
184
227
|
request.headers[HttpHeaders.CorrelatedActivityId] = correlatedActivityId;
|
|
@@ -232,7 +275,13 @@ export class ClientContext {
|
|
|
232
275
|
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
233
276
|
this.applySessionToken(request);
|
|
234
277
|
// deleteResource will use WriteEndpoint since it uses DELETE operation
|
|
235
|
-
request.endpoint = await this.globalEndpointManager.
|
|
278
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
279
|
+
diagnosticNode: diagnosticNode,
|
|
280
|
+
resourceType: request.resourceType,
|
|
281
|
+
operationType: request.operationType,
|
|
282
|
+
startServiceEndpointIndex: 0,
|
|
283
|
+
excludedLocations: options?.excludedLocations,
|
|
284
|
+
});
|
|
236
285
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
237
286
|
if (parseLink(path).type !== "colls") {
|
|
238
287
|
this.captureSessionToken(undefined, path, OperationType.Delete, response.headers);
|
|
@@ -268,7 +317,13 @@ export class ClientContext {
|
|
|
268
317
|
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
269
318
|
this.applySessionToken(request);
|
|
270
319
|
// patch will use WriteEndpoint
|
|
271
|
-
request.endpoint = await this.globalEndpointManager.
|
|
320
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
321
|
+
diagnosticNode: diagnosticNode,
|
|
322
|
+
resourceType: request.resourceType,
|
|
323
|
+
operationType: request.operationType,
|
|
324
|
+
startServiceEndpointIndex: 0,
|
|
325
|
+
excludedLocations: options?.excludedLocations,
|
|
326
|
+
});
|
|
272
327
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
273
328
|
this.captureSessionToken(undefined, path, OperationType.Patch, response.headers);
|
|
274
329
|
return response;
|
|
@@ -299,7 +354,13 @@ export class ClientContext {
|
|
|
299
354
|
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
300
355
|
// create will use WriteEndpoint since it uses POST operation
|
|
301
356
|
this.applySessionToken(request);
|
|
302
|
-
request.endpoint = await this.globalEndpointManager.
|
|
357
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
358
|
+
diagnosticNode: diagnosticNode,
|
|
359
|
+
resourceType: request.resourceType,
|
|
360
|
+
operationType: request.operationType,
|
|
361
|
+
startServiceEndpointIndex: 0,
|
|
362
|
+
excludedLocations: options?.excludedLocations,
|
|
363
|
+
});
|
|
303
364
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
304
365
|
this.captureSessionToken(undefined, path, OperationType.Create, response.headers);
|
|
305
366
|
return response;
|
|
@@ -366,7 +427,13 @@ export class ClientContext {
|
|
|
366
427
|
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
367
428
|
this.applySessionToken(request);
|
|
368
429
|
// replace will use WriteEndpoint since it uses PUT operation
|
|
369
|
-
request.endpoint = await this.globalEndpointManager.
|
|
430
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
431
|
+
diagnosticNode: diagnosticNode,
|
|
432
|
+
resourceType: request.resourceType,
|
|
433
|
+
operationType: request.operationType,
|
|
434
|
+
startServiceEndpointIndex: 0,
|
|
435
|
+
excludedLocations: options?.excludedLocations,
|
|
436
|
+
});
|
|
370
437
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
371
438
|
this.captureSessionToken(undefined, path, OperationType.Replace, response.headers);
|
|
372
439
|
return response;
|
|
@@ -398,7 +465,13 @@ export class ClientContext {
|
|
|
398
465
|
request.headers[HttpHeaders.IsUpsert] = true;
|
|
399
466
|
this.applySessionToken(request);
|
|
400
467
|
// upsert will use WriteEndpoint since it uses POST operation
|
|
401
|
-
request.endpoint = await this.globalEndpointManager.
|
|
468
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
469
|
+
diagnosticNode: diagnosticNode,
|
|
470
|
+
resourceType: request.resourceType,
|
|
471
|
+
operationType: request.operationType,
|
|
472
|
+
startServiceEndpointIndex: 0,
|
|
473
|
+
excludedLocations: options?.excludedLocations,
|
|
474
|
+
});
|
|
402
475
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
403
476
|
this.captureSessionToken(undefined, path, OperationType.Upsert, response.headers);
|
|
404
477
|
return response;
|
|
@@ -434,7 +507,13 @@ export class ClientContext {
|
|
|
434
507
|
request.headers = await this.buildHeaders(request);
|
|
435
508
|
request.partitionKeyRangeId = partitionKeyRangeId;
|
|
436
509
|
// executeStoredProcedure will use WriteEndpoint since it uses POST operation
|
|
437
|
-
request.endpoint = await this.globalEndpointManager.
|
|
510
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
511
|
+
diagnosticNode: diagnosticNode,
|
|
512
|
+
resourceType: request.resourceType,
|
|
513
|
+
operationType: request.operationType,
|
|
514
|
+
startServiceEndpointIndex: 0,
|
|
515
|
+
excludedLocations: options?.excludedLocations,
|
|
516
|
+
});
|
|
438
517
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
439
518
|
return response;
|
|
440
519
|
}
|
|
@@ -504,7 +583,13 @@ export class ClientContext {
|
|
|
504
583
|
request.headers[HttpHeaders.IsBatchRequest] = true;
|
|
505
584
|
request.headers[HttpHeaders.IsBatchAtomic] = true;
|
|
506
585
|
this.applySessionToken(request);
|
|
507
|
-
request.endpoint = await this.globalEndpointManager.
|
|
586
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
587
|
+
diagnosticNode: diagnosticNode,
|
|
588
|
+
resourceType: request.resourceType,
|
|
589
|
+
operationType: request.operationType,
|
|
590
|
+
startServiceEndpointIndex: 0,
|
|
591
|
+
excludedLocations: options?.excludedLocations,
|
|
592
|
+
});
|
|
508
593
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
509
594
|
this.captureSessionToken(undefined, path, OperationType.Batch, response.headers);
|
|
510
595
|
response.diagnostics = diagnosticNode.toDiagnostic(this.getClientConfig());
|
|
@@ -538,7 +623,13 @@ export class ClientContext {
|
|
|
538
623
|
request.headers[HttpHeaders.IsBatchAtomic] = false;
|
|
539
624
|
request.headers[HttpHeaders.BatchContinueOnError] = bulkOptions.continueOnError ?? true;
|
|
540
625
|
this.applySessionToken(request);
|
|
541
|
-
request.endpoint = await this.globalEndpointManager.
|
|
626
|
+
request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({
|
|
627
|
+
diagnosticNode: diagnosticNode,
|
|
628
|
+
resourceType: request.resourceType,
|
|
629
|
+
operationType: request.operationType,
|
|
630
|
+
startServiceEndpointIndex: 0,
|
|
631
|
+
excludedLocations: options?.excludedLocations,
|
|
632
|
+
});
|
|
542
633
|
const response = await executePlugins(diagnosticNode, request, RequestHandler.request, PluginOn.operation);
|
|
543
634
|
this.captureSessionToken(undefined, path, OperationType.Batch, response.headers);
|
|
544
635
|
return response;
|
|
@@ -664,8 +755,8 @@ export class ClientContext {
|
|
|
664
755
|
* @internal
|
|
665
756
|
*/
|
|
666
757
|
isPartitionLevelFailOverEnabled() {
|
|
667
|
-
return (this.
|
|
668
|
-
this.
|
|
758
|
+
return (this.globalEndpointManager.enablePartitionLevelFailover ||
|
|
759
|
+
this.globalEndpointManager.enablePartitionLevelCircuitBreaker);
|
|
669
760
|
}
|
|
670
761
|
}
|
|
671
762
|
//# sourceMappingURL=ClientContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientContext.js","sourceRoot":"","sources":["../../src/ClientContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,+BAA+B,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGjG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,O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C,WAAW,CAAC,SAAS,CAAC,GAAG,gBAAgB,CAAC;QAC5F,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC;YAC5E,gBAAgB,CAAC;IACrB,CAAC;IAED;;OAEG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,+BAA+B;QACpC,OAAO,CACL,IAAI,CAAC,gBAAgB,CAAC,4BAA4B;YAClD,IAAI,CAAC,gBAAgB,CAAC,kCAAkC,CACzD,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { HttpClient, Pipeline } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy, createEmptyPipeline } from \"@azure/core-rest-pipeline\";\nimport type { PartitionKeyRange } from \"./client/Container/PartitionKeyRange.js\";\nimport type { Resource } from \"./client/Resource.js\";\nimport { Constants, HTTPMethod, OperationType, ResourceType } from \"./common/constants.js\";\nimport { getIdFromLink, getPathFromLink, parseLink } from \"./common/helper.js\";\nimport { StatusCodes, SubStatusCodes } from \"./common/statusCodes.js\";\nimport type { Agent, CosmosClientOptions } from \"./CosmosClientOptions.js\";\nimport type { ConnectionPolicy, PartitionKey } from \"./documents/index.js\";\nimport {\n ConsistencyLevel,\n DatabaseAccount,\n convertToInternalPartitionKey,\n} from \"./documents/index.js\";\nimport type { GlobalEndpointManager } from \"./globalEndpointManager.js\";\nimport type { PluginConfig } from \"./plugins/Plugin.js\";\nimport { PluginOn, executePlugins } from \"./plugins/Plugin.js\";\nimport type { FetchFunctionCallback, SqlQuerySpec } from \"./queryExecutionContext/index.js\";\nimport type { CosmosHeaders } from \"./queryExecutionContext/CosmosHeaders.js\";\nimport { QueryIterator } from \"./queryIterator.js\";\nimport type { ErrorResponse } from \"./request/index.js\";\nimport type { FeedOptions, RequestOptions, Response } from \"./request/index.js\";\nimport type { PartitionedQueryExecutionInfo } from \"./request/ErrorResponse.js\";\nimport { getHeaders } from \"./request/request.js\";\nimport type { RequestContext } from \"./request/RequestContext.js\";\nimport { RequestHandler } from \"./request/RequestHandler.js\";\nimport { SessionContainer } from \"./session/sessionContainer.js\";\nimport type { SessionContext } from \"./session/SessionContext.js\";\nimport type { BulkOptions } from \"./utils/batch.js\";\nimport { sanitizeEndpoint } from \"./utils/checkURL.js\";\nimport { supportedQueryFeaturesBuilder } from \"./utils/supportedQueryFeaturesBuilder.js\";\nimport type { AzureLogger } from \"@azure/logger\";\nimport { createClientLogger } from \"@azure/logger\";\nimport type { ClientConfigDiagnostic, CosmosDiagnostics } from \"./CosmosDiagnostics.js\";\nimport type { DiagnosticNodeInternal } from \"./diagnostics/DiagnosticNodeInternal.js\";\nimport type { DiagnosticWriter } from \"./diagnostics/DiagnosticWriter.js\";\nimport { LogDiagnosticWriter, NoOpDiagnosticWriter } from \"./diagnostics/DiagnosticWriter.js\";\nimport type { DiagnosticFormatter } from \"./diagnostics/DiagnosticFormatter.js\";\nimport { DefaultDiagnosticFormatter } from \"./diagnostics/DiagnosticFormatter.js\";\nimport { CosmosDbDiagnosticLevel } from \"./diagnostics/CosmosDbDiagnosticLevel.js\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { getUserAgent } from \"./common/platform.js\";\nimport type { GlobalPartitionEndpointManager } from \"./globalPartitionEndpointManager.js\";\nimport type { RetryOptions } from \"./retry/retryOptions.js\";\nimport { PartitionKeyRangeCache } from \"./routing/partitionKeyRangeCache.js\";\n\nconst logger: AzureLogger = createClientLogger(\"ClientContext\");\n\nconst QueryJsonContentType = \"application/query+json\";\nconst HttpHeaders = Constants.HttpHeaders;\n/**\n * @hidden\n */\nexport class ClientContext {\n private readonly sessionContainer: SessionContainer;\n private connectionPolicy: ConnectionPolicy;\n private pipeline: Pipeline;\n private diagnosticWriter: DiagnosticWriter;\n private diagnosticFormatter: DiagnosticFormatter;\n public partitionKeyDefinitionCache: { [containerUrl: string]: any }; // TODO: PartitionKeyDefinitionCache\n /** @internal */\n public partitionKeyRangeCache: PartitionKeyRangeCache;\n /** boolean flag to support operations with client-side encryption */\n public enableEncryption: boolean = false;\n\n public constructor(\n private cosmosClientOptions: CosmosClientOptions,\n private globalEndpointManager: GlobalEndpointManager,\n private clientConfig: ClientConfigDiagnostic,\n public diagnosticLevel: CosmosDbDiagnosticLevel,\n private globalPartitionEndpointManager?: GlobalPartitionEndpointManager,\n ) {\n if (cosmosClientOptions.clientEncryptionOptions) {\n this.enableEncryption = true;\n }\n this.connectionPolicy = cosmosClientOptions.connectionPolicy;\n this.sessionContainer = new SessionContainer();\n this.partitionKeyDefinitionCache = {};\n this.pipeline = null;\n if (cosmosClientOptions.aadCredentials) {\n this.pipeline = createEmptyPipeline();\n const hrefEndpoint = sanitizeEndpoint(cosmosClientOptions.endpoint);\n const scope = `${hrefEndpoint}/.default`;\n this.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential: cosmosClientOptions.aadCredentials,\n scopes: scope,\n challengeCallbacks: {\n async authorizeRequest({ request, getAccessToken }) {\n const tokenResponse = await getAccessToken([scope], {});\n const AUTH_PREFIX = `type=aad&ver=1.0&sig=`;\n const authorizationToken = `${AUTH_PREFIX}${tokenResponse.token}`;\n request.headers.set(\"Authorization\", authorizationToken);\n },\n },\n }),\n );\n }\n this.initializeDiagnosticSettings(diagnosticLevel);\n this.partitionKeyRangeCache = new PartitionKeyRangeCache(this);\n }\n\n /** @hidden */\n public async read<T>({\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.get,\n path,\n operationType: OperationType.Read,\n resourceId,\n options,\n resourceType,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Read,\n resourceType,\n });\n\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n if (resourceType === ResourceType.clientencryptionkey) {\n request.headers[HttpHeaders.AllowCachedReadsHeader] = true;\n if (options.databaseRid) {\n request.headers[HttpHeaders.DatabaseRidHeader] = options.databaseRid;\n }\n }\n this.applySessionToken(request);\n\n // read will use ReadEndpoint since it uses GET operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Read, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async queryFeed<T>({\n path,\n resourceType,\n resourceId,\n resultFn,\n query,\n options,\n diagnosticNode,\n partitionKeyRangeId,\n partitionKey,\n startEpk,\n endEpk,\n correlatedActivityId,\n }: {\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n resultFn: (result: { [key: string]: any }) => any[];\n query: SqlQuerySpec | string;\n options: FeedOptions;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n partitionKey?: PartitionKey;\n startEpk?: string | undefined;\n endEpk?: string | undefined;\n correlatedActivityId?: string;\n }): Promise<Response<T & Resource>> {\n // Query operations will use ReadEndpoint even though it uses\n // GET(for queryFeed) and POST(for regular query operations)\n\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.get,\n path,\n operationType: OperationType.Query,\n partitionKeyRangeId,\n resourceId,\n resourceType,\n options,\n body: query,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Query,\n resourceType,\n });\n const requestId = randomUUID();\n if (query !== undefined) {\n request.method = HTTPMethod.post;\n }\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n request.headers = await this.buildHeaders(request);\n\n if (startEpk !== undefined && endEpk !== undefined) {\n request.headers[HttpHeaders.StartEpk] = startEpk;\n request.headers[HttpHeaders.EndEpk] = endEpk;\n request.headers[HttpHeaders.ReadFeedKeyType] = \"EffectivePartitionKeyRange\";\n }\n\n if (query !== undefined) {\n if (correlatedActivityId !== undefined) {\n request.headers[HttpHeaders.CorrelatedActivityId] = correlatedActivityId;\n }\n request.headers[HttpHeaders.IsQuery] = \"true\";\n request.headers[HttpHeaders.ContentType] = QueryJsonContentType;\n if (typeof query === \"string\") {\n request.body = { query }; // Converts query text to query object.\n }\n }\n this.applySessionToken(request);\n logger.info(\n \"query \" +\n requestId +\n \" started\" +\n (request.partitionKeyRangeId ? \" pkrid: \" + request.partitionKeyRangeId : \"\"),\n );\n logger.verbose(request);\n const start = Date.now();\n const response = await RequestHandler.request(request, diagnosticNode);\n logger.info(\"query \" + requestId + \" finished - \" + (Date.now() - start) + \"ms\");\n this.captureSessionToken(undefined, path, OperationType.Query, response.headers);\n return this.processQueryFeedResponse(response, !!query, resultFn);\n }\n\n public async getQueryPlan(\n path: string,\n resourceType: ResourceType,\n resourceId: string,\n query: SqlQuerySpec | string,\n options: FeedOptions = {},\n diagnosticNode: DiagnosticNodeInternal,\n correlatedActivityId?: string,\n ): Promise<Response<PartitionedQueryExecutionInfo>> {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n path,\n operationType: OperationType.Read,\n resourceId,\n resourceType,\n options,\n body: query,\n };\n diagnosticNode.addData({\n operationType: OperationType.Read,\n resourceType,\n });\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n request.headers = await this.buildHeaders(request);\n if (correlatedActivityId !== undefined) {\n request.headers[HttpHeaders.CorrelatedActivityId] = correlatedActivityId;\n }\n request.headers[HttpHeaders.IsQueryPlan] = \"True\";\n request.headers[HttpHeaders.QueryVersion] = \"1.4\";\n request.headers[HttpHeaders.ContentType] = QueryJsonContentType;\n request.headers[HttpHeaders.SupportedQueryFeatures] = supportedQueryFeaturesBuilder(options);\n\n if (typeof query === \"string\") {\n request.body = { query }; // Converts query text to query object.\n }\n\n this.applySessionToken(request);\n const response = await RequestHandler.request(request, diagnosticNode);\n this.captureSessionToken(undefined, path, OperationType.Query, response.headers);\n return response as any;\n }\n\n public queryPartitionKeyRanges(\n collectionLink: string,\n query?: string | SqlQuerySpec,\n options?: FeedOptions,\n ): QueryIterator<PartitionKeyRange> {\n const path = getPathFromLink(collectionLink, ResourceType.pkranges);\n const id = getIdFromLink(collectionLink);\n const cb: FetchFunctionCallback = async (diagNode, innerOptions) => {\n const response = await this.queryFeed({\n path,\n resourceType: ResourceType.pkranges,\n resourceId: id,\n resultFn: (result) => result.PartitionKeyRanges,\n query,\n options: innerOptions,\n diagnosticNode: diagNode,\n });\n return response;\n };\n return new QueryIterator<PartitionKeyRange>(this, query, options, cb);\n }\n\n public async delete<T>({\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n method = HTTPMethod.delete,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n method?: HTTPMethod;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: method,\n operationType: OperationType.Delete,\n path,\n resourceType,\n options,\n resourceId,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Delete,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n this.applySessionToken(request);\n // deleteResource will use WriteEndpoint since it uses DELETE operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n if (parseLink(path).type !== \"colls\") {\n this.captureSessionToken(undefined, path, OperationType.Delete, response.headers);\n } else {\n this.clearSessionToken(path);\n }\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async patch<T>({\n body,\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n body: any;\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.patch,\n operationType: OperationType.Patch,\n path,\n resourceType,\n body,\n resourceId,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Patch,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n this.applySessionToken(request);\n\n // patch will use WriteEndpoint\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Patch, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async create<T, U = T>({\n body,\n path,\n resourceType,\n resourceId,\n diagnosticNode,\n options = {},\n partitionKey,\n partitionKeyRangeId,\n }: {\n body: T;\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n diagnosticNode: DiagnosticNodeInternal;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & U & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Create,\n path,\n resourceType,\n resourceId,\n body,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Create,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n // create will use WriteEndpoint since it uses POST operation\n this.applySessionToken(request);\n\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Create, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n private processQueryFeedResponse(\n res: Response<any>,\n isQuery: boolean,\n resultFn: (result: { [key: string]: any }) => any[],\n ): Response<any> {\n if (isQuery) {\n return {\n result: resultFn(res.result),\n headers: res.headers,\n code: res.code,\n };\n } else {\n const newResult = resultFn(res.result).map((body: any) => body);\n return {\n result: newResult,\n headers: res.headers,\n code: res.code,\n };\n }\n }\n\n private applySessionToken(requestContext: RequestContext): void {\n const request = this.getSessionParams(requestContext.path);\n\n if (requestContext.headers && requestContext.headers[HttpHeaders.SessionToken]) {\n return;\n }\n\n const sessionConsistency: ConsistencyLevel = requestContext.headers[\n HttpHeaders.ConsistencyLevel\n ] as ConsistencyLevel;\n if (!sessionConsistency) {\n return;\n }\n\n if (sessionConsistency !== ConsistencyLevel.Session) {\n return;\n }\n\n if (request.resourceAddress) {\n const sessionToken = this.sessionContainer.get(request);\n if (sessionToken) {\n requestContext.headers[HttpHeaders.SessionToken] = sessionToken;\n }\n }\n }\n\n public async replace<T>({\n body,\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n body: any;\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.put,\n operationType: OperationType.Replace,\n path,\n resourceType,\n body,\n resourceId,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Replace,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n this.applySessionToken(request);\n\n // replace will use WriteEndpoint since it uses PUT operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Replace, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async upsert<T, U = T>({\n body,\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n body: T;\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & U & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Upsert,\n path,\n resourceType,\n body,\n resourceId,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Upsert,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n request.headers[HttpHeaders.IsUpsert] = true;\n this.applySessionToken(request);\n\n // upsert will use WriteEndpoint since it uses POST operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Upsert, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async execute<T>({\n sprocLink,\n params,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n sprocLink: string;\n params?: any[];\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T>> {\n // Accept a single parameter or an array of parameters.\n // Didn't add type annotation for this because we should legacy this behavior\n if (params !== null && params !== undefined && !Array.isArray(params)) {\n params = [params];\n }\n const path = getPathFromLink(sprocLink);\n const id = getIdFromLink(sprocLink);\n\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Execute,\n path,\n resourceType: ResourceType.sproc,\n options,\n resourceId: id,\n body: params,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Execute,\n resourceType: ResourceType.sproc,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n // executeStoredProcedure will use WriteEndpoint since it uses POST operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n return response;\n }\n\n /**\n * Gets the Database account information.\n * @param options - `urlConnection` in the options is the endpoint url whose database account needs to be retrieved.\n * If not present, current client's url will be used.\n */\n public async getDatabaseAccount(\n diagnosticNode: DiagnosticNodeInternal,\n options: RequestOptions = {},\n ): Promise<Response<DatabaseAccount>> {\n const endpoint = options.urlConnection || this.cosmosClientOptions.endpoint;\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n endpoint,\n method: HTTPMethod.get,\n operationType: OperationType.Read,\n path: \"\",\n resourceType: ResourceType.none,\n options,\n };\n diagnosticNode.addData({\n operationType: OperationType.Read,\n resourceType: ResourceType.none,\n });\n request.headers = await this.buildHeaders(request);\n // await options.beforeOperation({ endpoint, request, headers: requestHeaders });\n const { result, headers, code, substatus, diagnostics } = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n\n const databaseAccount = new DatabaseAccount(result, headers);\n return {\n result: databaseAccount,\n headers,\n diagnostics,\n code: code,\n substatus: substatus,\n };\n }\n\n public getWriteEndpoint(diagnosticNode: DiagnosticNodeInternal): Promise<string> {\n return this.globalEndpointManager.getWriteEndpoint(diagnosticNode);\n }\n\n public getReadEndpoint(diagnosticNode: DiagnosticNodeInternal): Promise<string> {\n return this.globalEndpointManager.getReadEndpoint(diagnosticNode);\n }\n\n public getWriteEndpoints(): Promise<readonly string[]> {\n return this.globalEndpointManager.getWriteEndpoints();\n }\n\n public getReadEndpoints(): Promise<readonly string[]> {\n return this.globalEndpointManager.getReadEndpoints();\n }\n\n public async batch<T>({\n body,\n path,\n partitionKey,\n resourceId,\n options = {},\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n body: T;\n path: string;\n partitionKey: PartitionKey;\n resourceId: string;\n options?: RequestOptions;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<any>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Batch,\n path,\n body,\n resourceType: ResourceType.item,\n resourceId,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Batch,\n resourceType: ResourceType.item,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n request.headers[HttpHeaders.IsBatchRequest] = true;\n request.headers[HttpHeaders.IsBatchAtomic] = true;\n\n this.applySessionToken(request);\n\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Batch, response.headers);\n response.diagnostics = diagnosticNode.toDiagnostic(this.getClientConfig());\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async bulk<T>({\n body,\n path,\n partitionKeyRangeId,\n resourceId,\n bulkOptions = {},\n options = {},\n diagnosticNode,\n }: {\n body: T;\n path: string;\n partitionKeyRangeId: string;\n resourceId: string;\n bulkOptions?: BulkOptions;\n options?: RequestOptions;\n diagnosticNode: DiagnosticNodeInternal;\n }): Promise<Response<any>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Batch,\n path,\n body,\n resourceType: ResourceType.item,\n resourceId,\n options,\n };\n diagnosticNode.addData({\n operationType: OperationType.Batch,\n resourceType: ResourceType.item,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n request.headers[HttpHeaders.IsBatchRequest] = true;\n request.headers[HttpHeaders.PartitionKeyRangeID] = partitionKeyRangeId;\n request.headers[HttpHeaders.IsBatchAtomic] = false;\n request.headers[HttpHeaders.BatchContinueOnError] = bulkOptions.continueOnError ?? true;\n this.applySessionToken(request);\n\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpoint(\n diagnosticNode,\n request.resourceType,\n request.operationType,\n );\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Batch, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n private captureSessionToken(\n err: ErrorResponse,\n path: string,\n operationType: OperationType,\n resHeaders: CosmosHeaders,\n ): void {\n const request = this.getSessionParams(path);\n request.operationType = operationType;\n if (\n !err ||\n (!this.isMasterResource(request.resourceType) &&\n (err.code === StatusCodes.PreconditionFailed ||\n err.code === StatusCodes.Conflict ||\n (err.code === StatusCodes.NotFound &&\n err.substatus !== SubStatusCodes.ReadSessionNotAvailable)))\n ) {\n this.sessionContainer.set(request, resHeaders);\n }\n }\n\n public clearSessionToken(path: string): void {\n const request = this.getSessionParams(path);\n this.sessionContainer.remove(request);\n }\n\n public recordDiagnostics(diagnostic: CosmosDiagnostics): void {\n const formatted = this.diagnosticFormatter.format(diagnostic);\n this.diagnosticWriter.write(formatted);\n }\n\n public initializeDiagnosticSettings(diagnosticLevel: CosmosDbDiagnosticLevel): void {\n this.diagnosticFormatter = new DefaultDiagnosticFormatter();\n switch (diagnosticLevel) {\n case CosmosDbDiagnosticLevel.info:\n this.diagnosticWriter = new NoOpDiagnosticWriter();\n break;\n default:\n this.diagnosticWriter = new LogDiagnosticWriter();\n }\n }\n\n // TODO: move\n private getSessionParams(resourceLink: string): SessionContext {\n const resourceId: string = null;\n let resourceAddress: string = null;\n const parserOutput = parseLink(resourceLink);\n\n resourceAddress = parserOutput.objectBody.self;\n\n const resourceType = parserOutput.type;\n return {\n resourceId,\n resourceAddress,\n resourceType,\n isNameBased: true,\n };\n }\n\n private isMasterResource(resourceType: string): boolean {\n if (\n resourceType === Constants.Path.OffersPathSegment ||\n resourceType === Constants.Path.DatabasesPathSegment ||\n resourceType === Constants.Path.UsersPathSegment ||\n resourceType === Constants.Path.PermissionsPathSegment ||\n resourceType === Constants.Path.TopologyPathSegment ||\n resourceType === Constants.Path.DatabaseAccountPathSegment ||\n resourceType === Constants.Path.PartitionKeyRangesPathSegment ||\n resourceType === Constants.Path.CollectionsPathSegment\n ) {\n return true;\n }\n\n return false;\n }\n\n private buildHeaders(requestContext: RequestContext): Promise<CosmosHeaders> {\n return getHeaders({\n clientOptions: this.cosmosClientOptions,\n defaultHeaders: {\n ...this.cosmosClientOptions.defaultHeaders,\n ...requestContext.options.initialHeaders,\n },\n verb: requestContext.method,\n path: requestContext.path,\n resourceId: requestContext.resourceId,\n resourceType: requestContext.resourceType,\n options: requestContext.options,\n partitionKeyRangeId: requestContext.partitionKeyRangeId,\n useMultipleWriteLocations: this.connectionPolicy.useMultipleWriteLocations,\n partitionKey:\n requestContext.partitionKey !== undefined\n ? convertToInternalPartitionKey(requestContext.partitionKey)\n : undefined, // TODO: Move this check from here to PartitionKey\n operationType: requestContext.operationType,\n });\n }\n\n /**\n * Returns collection of properties which are derived from the context for Request Creation.\n * These properties have client wide scope, as opposed to request specific scope.\n * @returns\n */\n private getContextDerivedPropsForRequestCreation(): {\n globalEndpointManager: GlobalEndpointManager;\n connectionPolicy: ConnectionPolicy;\n requestAgent: Agent;\n client?: ClientContext;\n pipeline?: Pipeline;\n plugins: PluginConfig[];\n httpClient?: HttpClient;\n globalPartitionEndpointManager?: GlobalPartitionEndpointManager;\n } {\n return {\n globalEndpointManager: this.globalEndpointManager,\n requestAgent: this.cosmosClientOptions.agent,\n connectionPolicy: this.connectionPolicy,\n client: this,\n plugins: this.cosmosClientOptions.plugins,\n pipeline: this.pipeline,\n httpClient: this.cosmosClientOptions.httpClient,\n globalPartitionEndpointManager: this.globalPartitionEndpointManager,\n };\n }\n\n public getClientConfig(): ClientConfigDiagnostic {\n return this.clientConfig;\n }\n\n /**\n * @internal\n */\n public refreshUserAgent(hostFramework: string): void {\n const updatedUserAgent = getUserAgent(this.cosmosClientOptions, hostFramework);\n this.cosmosClientOptions.defaultHeaders[Constants.HttpHeaders.UserAgent] = updatedUserAgent;\n this.cosmosClientOptions.defaultHeaders[Constants.HttpHeaders.CustomUserAgent] =\n updatedUserAgent;\n }\n\n /**\n * @internal\n */\n public getRetryOptions(): RetryOptions {\n return this.connectionPolicy.retryOptions;\n }\n\n /**\n * @internal\n */\n public isPartitionLevelFailOverEnabled(): boolean {\n return (\n this.connectionPolicy.enablePartitionLevelFailover ||\n this.connectionPolicy.enablePartitionLevelCircuitBreaker\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ClientContext.js","sourceRoot":"","sources":["../../src/ClientContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,+BAA+B,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGjG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAEzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C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AAC,qBAAqB;YACjD,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC,KAAK;YAC5C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO;YACzC,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,mBAAmB,CAAC,UAAU;YAC/C,8BAA8B,EAAE,IAAI,CAAC,8BAA8B;SACpE,CAAC;IACJ,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,aAAqB;QAC3C,MAAM,gBAAgB,GAAG,YAAY,CAAC,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC;QAC/E,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,gBAAgB,CAAC;QAC5F,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC;YAC5E,gBAAgB,CAAC;IACrB,CAAC;IAED;;OAEG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,+BAA+B;QACpC,OAAO,CACL,IAAI,CAAC,qBAAqB,CAAC,4BAA4B;YACvD,IAAI,CAAC,qBAAqB,CAAC,kCAAkC,CAC9D,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { HttpClient, Pipeline } from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy, createEmptyPipeline } from \"@azure/core-rest-pipeline\";\nimport type { PartitionKeyRange } from \"./client/Container/PartitionKeyRange.js\";\nimport type { Resource } from \"./client/Resource.js\";\nimport { Constants, HTTPMethod, OperationType, ResourceType } from \"./common/constants.js\";\nimport { getIdFromLink, getPathFromLink, parseLink } from \"./common/helper.js\";\nimport { StatusCodes, SubStatusCodes } from \"./common/statusCodes.js\";\nimport type { Agent, CosmosClientOptions } from \"./CosmosClientOptions.js\";\nimport type { ConnectionPolicy, PartitionKey } from \"./documents/index.js\";\nimport {\n ConsistencyLevel,\n DatabaseAccount,\n convertToInternalPartitionKey,\n} from \"./documents/index.js\";\nimport type { GlobalEndpointManager } from \"./globalEndpointManager.js\";\nimport type { PluginConfig } from \"./plugins/Plugin.js\";\nimport { PluginOn, executePlugins } from \"./plugins/Plugin.js\";\nimport type { FetchFunctionCallback, SqlQuerySpec } from \"./queryExecutionContext/index.js\";\nimport type { CosmosHeaders } from \"./queryExecutionContext/CosmosHeaders.js\";\nimport { QueryIterator } from \"./queryIterator.js\";\nimport type { ErrorResponse } from \"./request/index.js\";\nimport type { FeedOptions, RequestOptions, Response } from \"./request/index.js\";\nimport type { PartitionedQueryExecutionInfo } from \"./request/ErrorResponse.js\";\nimport { getHeaders } from \"./request/request.js\";\nimport type { RequestContext } from \"./request/RequestContext.js\";\nimport { RequestHandler } from \"./request/RequestHandler.js\";\nimport { SessionContainer } from \"./session/sessionContainer.js\";\nimport type { SessionContext } from \"./session/SessionContext.js\";\nimport type { BulkOptions } from \"./utils/batch.js\";\nimport { sanitizeEndpoint } from \"./utils/checkURL.js\";\nimport { supportedQueryFeaturesBuilder } from \"./utils/supportedQueryFeaturesBuilder.js\";\nimport type { AzureLogger } from \"@azure/logger\";\nimport { createClientLogger } from \"@azure/logger\";\nimport type { ClientConfigDiagnostic, CosmosDiagnostics } from \"./CosmosDiagnostics.js\";\nimport type { DiagnosticNodeInternal } from \"./diagnostics/DiagnosticNodeInternal.js\";\nimport type { DiagnosticWriter } from \"./diagnostics/DiagnosticWriter.js\";\nimport { LogDiagnosticWriter, NoOpDiagnosticWriter } from \"./diagnostics/DiagnosticWriter.js\";\nimport type { DiagnosticFormatter } from \"./diagnostics/DiagnosticFormatter.js\";\nimport { DefaultDiagnosticFormatter } from \"./diagnostics/DiagnosticFormatter.js\";\nimport { CosmosDbDiagnosticLevel } from \"./diagnostics/CosmosDbDiagnosticLevel.js\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { getUserAgent } from \"./common/platform.js\";\nimport type { GlobalPartitionEndpointManager } from \"./globalPartitionEndpointManager.js\";\nimport type { RetryOptions } from \"./retry/retryOptions.js\";\nimport { PartitionKeyRangeCache } from \"./routing/partitionKeyRangeCache.js\";\nimport {\n AAD_DEFAULT_SCOPE,\n AAD_AUTH_PREFIX,\n AAD_RESOURCE_NOT_FOUND_ERROR,\n} from \"./common/constants.js\";\n\nconst logger: AzureLogger = createClientLogger(\"ClientContext\");\n\nconst QueryJsonContentType = \"application/query+json\";\nconst HttpHeaders = Constants.HttpHeaders;\n/**\n * @hidden\n */\nexport class ClientContext {\n private readonly sessionContainer: SessionContainer;\n private connectionPolicy: ConnectionPolicy;\n private pipeline: Pipeline;\n private diagnosticWriter: DiagnosticWriter;\n private diagnosticFormatter: DiagnosticFormatter;\n public partitionKeyDefinitionCache: { [containerUrl: string]: any }; // TODO: PartitionKeyDefinitionCache\n /** @internal */\n public partitionKeyRangeCache: PartitionKeyRangeCache;\n /** boolean flag to support operations with client-side encryption */\n public enableEncryption: boolean = false;\n\n public constructor(\n private cosmosClientOptions: CosmosClientOptions,\n private globalEndpointManager: GlobalEndpointManager,\n private clientConfig: ClientConfigDiagnostic,\n public diagnosticLevel: CosmosDbDiagnosticLevel,\n private globalPartitionEndpointManager?: GlobalPartitionEndpointManager,\n ) {\n if (cosmosClientOptions.clientEncryptionOptions) {\n this.enableEncryption = true;\n }\n this.connectionPolicy = cosmosClientOptions.connectionPolicy;\n this.sessionContainer = new SessionContainer();\n this.partitionKeyDefinitionCache = {};\n this.pipeline = null;\n if (cosmosClientOptions.aadCredentials) {\n this.pipeline = createEmptyPipeline();\n const hrefEndpoint = sanitizeEndpoint(cosmosClientOptions.endpoint);\n\n // Use custom AAD scope if provided, otherwise use account-based scope\n const accountScope = `${hrefEndpoint}/.default`;\n const primaryScope = cosmosClientOptions.aadScope || accountScope;\n const fallbackScope = AAD_DEFAULT_SCOPE;\n\n this.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential: cosmosClientOptions.aadCredentials,\n scopes: primaryScope,\n challengeCallbacks: {\n async authorizeRequest({ request, getAccessToken }) {\n try {\n const tokenResponse = await getAccessToken([primaryScope], {});\n\n const authorizationToken = `${AAD_AUTH_PREFIX}${tokenResponse.token}`;\n request.headers.set(Constants.HttpHeaders.Authorization, authorizationToken);\n } catch (error: any) {\n // If no custom scope is provided and we get AADSTS500011 error,\n // fallback to the default Cosmos scope\n if (\n !cosmosClientOptions.aadScope &&\n error?.message?.includes(AAD_RESOURCE_NOT_FOUND_ERROR)\n ) {\n try {\n const fallbackTokenResponse = await getAccessToken([fallbackScope], {});\n const authorizationToken = `${AAD_AUTH_PREFIX}${fallbackTokenResponse.token}`;\n request.headers.set(Constants.HttpHeaders.Authorization, authorizationToken);\n } catch (fallbackError) {\n // If fallback also fails, throw the original error\n throw error;\n }\n } else {\n // If custom scope is provided or error is not AADSTS500011, throw the original error\n throw error;\n }\n }\n },\n },\n }),\n );\n }\n this.initializeDiagnosticSettings(diagnosticLevel);\n this.partitionKeyRangeCache = new PartitionKeyRangeCache(this);\n }\n\n /** @hidden */\n public async read<T>({\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.get,\n path,\n operationType: OperationType.Read,\n resourceId,\n options,\n resourceType,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Read,\n resourceType,\n });\n\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n if (resourceType === ResourceType.clientencryptionkey) {\n request.headers[HttpHeaders.AllowCachedReadsHeader] = true;\n if (options.databaseRid) {\n request.headers[HttpHeaders.DatabaseRidHeader] = options.databaseRid;\n }\n }\n this.applySessionToken(request);\n\n // read will use ReadEndpoint since it uses GET operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Read, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async queryFeed<T>({\n path,\n resourceType,\n resourceId,\n resultFn,\n query,\n options,\n diagnosticNode,\n partitionKeyRangeId,\n partitionKey,\n startEpk,\n endEpk,\n correlatedActivityId,\n }: {\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n resultFn: (result: { [key: string]: any }) => any[];\n query: SqlQuerySpec | string;\n options: FeedOptions;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n partitionKey?: PartitionKey;\n startEpk?: string | undefined;\n endEpk?: string | undefined;\n correlatedActivityId?: string;\n }): Promise<Response<T & Resource>> {\n // Query operations will use ReadEndpoint even though it uses\n // GET(for queryFeed) and POST(for regular query operations)\n\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.get,\n path,\n operationType: OperationType.Query,\n partitionKeyRangeId,\n resourceId,\n resourceType,\n options,\n body: query,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Query,\n resourceType,\n });\n const requestId = randomUUID();\n if (query !== undefined) {\n request.method = HTTPMethod.post;\n }\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n request.headers = await this.buildHeaders(request);\n\n if (startEpk !== undefined && endEpk !== undefined) {\n request.headers[HttpHeaders.StartEpk] = startEpk;\n request.headers[HttpHeaders.EndEpk] = endEpk;\n request.headers[HttpHeaders.ReadFeedKeyType] = \"EffectivePartitionKeyRange\";\n }\n\n if (query !== undefined) {\n if (correlatedActivityId !== undefined) {\n request.headers[HttpHeaders.CorrelatedActivityId] = correlatedActivityId;\n }\n request.headers[HttpHeaders.IsQuery] = \"true\";\n request.headers[HttpHeaders.ContentType] = QueryJsonContentType;\n if (typeof query === \"string\") {\n request.body = { query }; // Converts query text to query object.\n }\n }\n this.applySessionToken(request);\n logger.info(\n \"query \" +\n requestId +\n \" started\" +\n (request.partitionKeyRangeId ? \" pkrid: \" + request.partitionKeyRangeId : \"\"),\n );\n logger.verbose(request);\n const start = Date.now();\n const response = await RequestHandler.request(request, diagnosticNode);\n logger.info(\"query \" + requestId + \" finished - \" + (Date.now() - start) + \"ms\");\n this.captureSessionToken(undefined, path, OperationType.Query, response.headers);\n return this.processQueryFeedResponse(response, !!query, resultFn);\n }\n\n public async getQueryPlan(\n path: string,\n resourceType: ResourceType,\n resourceId: string,\n query: SqlQuerySpec | string,\n options: FeedOptions = {},\n diagnosticNode: DiagnosticNodeInternal,\n correlatedActivityId?: string,\n ): Promise<Response<PartitionedQueryExecutionInfo>> {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n path,\n operationType: OperationType.Read,\n resourceId,\n resourceType,\n options,\n body: query,\n };\n diagnosticNode.addData({\n operationType: OperationType.Read,\n resourceType,\n });\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n request.headers = await this.buildHeaders(request);\n if (correlatedActivityId !== undefined) {\n request.headers[HttpHeaders.CorrelatedActivityId] = correlatedActivityId;\n }\n request.headers[HttpHeaders.IsQueryPlan] = \"True\";\n request.headers[HttpHeaders.QueryVersion] = \"1.4\";\n request.headers[HttpHeaders.ContentType] = QueryJsonContentType;\n request.headers[HttpHeaders.SupportedQueryFeatures] = supportedQueryFeaturesBuilder(options);\n\n if (typeof query === \"string\") {\n request.body = { query }; // Converts query text to query object.\n }\n\n this.applySessionToken(request);\n const response = await RequestHandler.request(request, diagnosticNode);\n this.captureSessionToken(undefined, path, OperationType.Query, response.headers);\n return response as any;\n }\n\n public queryPartitionKeyRanges(\n collectionLink: string,\n query?: string | SqlQuerySpec,\n options?: FeedOptions,\n ): QueryIterator<PartitionKeyRange> {\n const path = getPathFromLink(collectionLink, ResourceType.pkranges);\n const id = getIdFromLink(collectionLink);\n const cb: FetchFunctionCallback = async (diagNode, innerOptions) => {\n const response = await this.queryFeed({\n path,\n resourceType: ResourceType.pkranges,\n resourceId: id,\n resultFn: (result) => result.PartitionKeyRanges,\n query,\n options: innerOptions,\n diagnosticNode: diagNode,\n });\n return response;\n };\n return new QueryIterator<PartitionKeyRange>(this, query, options, cb);\n }\n\n public async delete<T>({\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n method = HTTPMethod.delete,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n method?: HTTPMethod;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: method,\n operationType: OperationType.Delete,\n path,\n resourceType,\n options,\n resourceId,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Delete,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n this.applySessionToken(request);\n // deleteResource will use WriteEndpoint since it uses DELETE operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n if (parseLink(path).type !== \"colls\") {\n this.captureSessionToken(undefined, path, OperationType.Delete, response.headers);\n } else {\n this.clearSessionToken(path);\n }\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async patch<T>({\n body,\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n body: any;\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.patch,\n operationType: OperationType.Patch,\n path,\n resourceType,\n body,\n resourceId,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Patch,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n this.applySessionToken(request);\n\n // patch will use WriteEndpoint\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Patch, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async create<T, U = T>({\n body,\n path,\n resourceType,\n resourceId,\n diagnosticNode,\n options = {},\n partitionKey,\n partitionKeyRangeId,\n }: {\n body: T;\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n diagnosticNode: DiagnosticNodeInternal;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & U & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Create,\n path,\n resourceType,\n resourceId,\n body,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Create,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n // create will use WriteEndpoint since it uses POST operation\n this.applySessionToken(request);\n\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Create, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n private processQueryFeedResponse(\n res: Response<any>,\n isQuery: boolean,\n resultFn: (result: { [key: string]: any }) => any[],\n ): Response<any> {\n if (isQuery) {\n return {\n result: resultFn(res.result),\n headers: res.headers,\n code: res.code,\n };\n } else {\n const newResult = resultFn(res.result).map((body: any) => body);\n return {\n result: newResult,\n headers: res.headers,\n code: res.code,\n };\n }\n }\n\n private applySessionToken(requestContext: RequestContext): void {\n const request = this.getSessionParams(requestContext.path);\n\n if (requestContext.headers && requestContext.headers[HttpHeaders.SessionToken]) {\n return;\n }\n\n const sessionConsistency: ConsistencyLevel = requestContext.headers[\n HttpHeaders.ConsistencyLevel\n ] as ConsistencyLevel;\n if (!sessionConsistency) {\n return;\n }\n\n if (sessionConsistency !== ConsistencyLevel.Session) {\n return;\n }\n\n if (request.resourceAddress) {\n const sessionToken = this.sessionContainer.get(request);\n if (sessionToken) {\n requestContext.headers[HttpHeaders.SessionToken] = sessionToken;\n }\n }\n }\n\n public async replace<T>({\n body,\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n body: any;\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.put,\n operationType: OperationType.Replace,\n path,\n resourceType,\n body,\n resourceId,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Replace,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n this.applySessionToken(request);\n\n // replace will use WriteEndpoint since it uses PUT operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Replace, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async upsert<T, U = T>({\n body,\n path,\n resourceType,\n resourceId,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n body: T;\n path: string;\n resourceType: ResourceType;\n resourceId: string;\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T & U & Resource>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Upsert,\n path,\n resourceType,\n body,\n resourceId,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Upsert,\n resourceType,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n request.headers[HttpHeaders.IsUpsert] = true;\n this.applySessionToken(request);\n\n // upsert will use WriteEndpoint since it uses POST operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Upsert, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async execute<T>({\n sprocLink,\n params,\n options = {},\n partitionKey,\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n sprocLink: string;\n params?: any[];\n options?: RequestOptions;\n partitionKey?: PartitionKey;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<T>> {\n // Accept a single parameter or an array of parameters.\n // Didn't add type annotation for this because we should legacy this behavior\n if (params !== null && params !== undefined && !Array.isArray(params)) {\n params = [params];\n }\n const path = getPathFromLink(sprocLink);\n const id = getIdFromLink(sprocLink);\n\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Execute,\n path,\n resourceType: ResourceType.sproc,\n options,\n resourceId: id,\n body: params,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Execute,\n resourceType: ResourceType.sproc,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n // executeStoredProcedure will use WriteEndpoint since it uses POST operation\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n return response;\n }\n\n /**\n * Gets the Database account information.\n * @param options - `urlConnection` in the options is the endpoint url whose database account needs to be retrieved.\n * If not present, current client's url will be used.\n */\n public async getDatabaseAccount(\n diagnosticNode: DiagnosticNodeInternal,\n options: RequestOptions = {},\n ): Promise<Response<DatabaseAccount>> {\n const endpoint = options.urlConnection || this.cosmosClientOptions.endpoint;\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n endpoint,\n method: HTTPMethod.get,\n operationType: OperationType.Read,\n path: \"\",\n resourceType: ResourceType.none,\n options,\n };\n diagnosticNode.addData({\n operationType: OperationType.Read,\n resourceType: ResourceType.none,\n });\n request.headers = await this.buildHeaders(request);\n // await options.beforeOperation({ endpoint, request, headers: requestHeaders });\n const { result, headers, code, substatus, diagnostics } = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n\n const databaseAccount = new DatabaseAccount(result, headers);\n return {\n result: databaseAccount,\n headers,\n diagnostics,\n code: code,\n substatus: substatus,\n };\n }\n\n public getWriteEndpoint(diagnosticNode: DiagnosticNodeInternal): Promise<string> {\n return this.globalEndpointManager.getWriteEndpoint(diagnosticNode);\n }\n\n public getReadEndpoint(diagnosticNode: DiagnosticNodeInternal): Promise<string> {\n return this.globalEndpointManager.getReadEndpoint(diagnosticNode);\n }\n\n public getWriteEndpoints(): Promise<readonly string[]> {\n return this.globalEndpointManager.getWriteEndpoints();\n }\n\n public getReadEndpoints(): Promise<readonly string[]> {\n return this.globalEndpointManager.getReadEndpoints();\n }\n\n public async batch<T>({\n body,\n path,\n partitionKey,\n resourceId,\n options = {},\n diagnosticNode,\n partitionKeyRangeId,\n }: {\n body: T;\n path: string;\n partitionKey: PartitionKey;\n resourceId: string;\n options?: RequestOptions;\n diagnosticNode: DiagnosticNodeInternal;\n partitionKeyRangeId?: string;\n }): Promise<Response<any>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Batch,\n path,\n body,\n resourceType: ResourceType.item,\n resourceId,\n options,\n partitionKey,\n };\n diagnosticNode.addData({\n operationType: OperationType.Batch,\n resourceType: ResourceType.item,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n request.headers[HttpHeaders.IsBatchRequest] = true;\n request.headers[HttpHeaders.IsBatchAtomic] = true;\n\n this.applySessionToken(request);\n\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Batch, response.headers);\n response.diagnostics = diagnosticNode.toDiagnostic(this.getClientConfig());\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n public async bulk<T>({\n body,\n path,\n partitionKeyRangeId,\n resourceId,\n bulkOptions = {},\n options = {},\n diagnosticNode,\n }: {\n body: T;\n path: string;\n partitionKeyRangeId: string;\n resourceId: string;\n bulkOptions?: BulkOptions;\n options?: RequestOptions;\n diagnosticNode: DiagnosticNodeInternal;\n }): Promise<Response<any>> {\n try {\n const request: RequestContext = {\n ...this.getContextDerivedPropsForRequestCreation(),\n method: HTTPMethod.post,\n operationType: OperationType.Batch,\n path,\n body,\n resourceType: ResourceType.item,\n resourceId,\n options,\n };\n diagnosticNode.addData({\n operationType: OperationType.Batch,\n resourceType: ResourceType.item,\n });\n request.headers = await this.buildHeaders(request);\n request.partitionKeyRangeId = partitionKeyRangeId;\n request.headers[HttpHeaders.IsBatchRequest] = true;\n request.headers[HttpHeaders.PartitionKeyRangeID] = partitionKeyRangeId;\n request.headers[HttpHeaders.IsBatchAtomic] = false;\n request.headers[HttpHeaders.BatchContinueOnError] = bulkOptions.continueOnError ?? true;\n this.applySessionToken(request);\n\n request.endpoint = await this.globalEndpointManager.resolveServiceEndpointInternal({\n diagnosticNode: diagnosticNode,\n resourceType: request.resourceType,\n operationType: request.operationType,\n startServiceEndpointIndex: 0,\n excludedLocations: options?.excludedLocations,\n });\n const response = await executePlugins(\n diagnosticNode,\n request,\n RequestHandler.request,\n PluginOn.operation,\n );\n this.captureSessionToken(undefined, path, OperationType.Batch, response.headers);\n return response;\n } catch (err: any) {\n this.captureSessionToken(err, path, OperationType.Upsert, (err as ErrorResponse).headers);\n throw err;\n }\n }\n\n private captureSessionToken(\n err: ErrorResponse,\n path: string,\n operationType: OperationType,\n resHeaders: CosmosHeaders,\n ): void {\n const request = this.getSessionParams(path);\n request.operationType = operationType;\n if (\n !err ||\n (!this.isMasterResource(request.resourceType) &&\n (err.code === StatusCodes.PreconditionFailed ||\n err.code === StatusCodes.Conflict ||\n (err.code === StatusCodes.NotFound &&\n err.substatus !== SubStatusCodes.ReadSessionNotAvailable)))\n ) {\n this.sessionContainer.set(request, resHeaders);\n }\n }\n\n public clearSessionToken(path: string): void {\n const request = this.getSessionParams(path);\n this.sessionContainer.remove(request);\n }\n\n public recordDiagnostics(diagnostic: CosmosDiagnostics): void {\n const formatted = this.diagnosticFormatter.format(diagnostic);\n this.diagnosticWriter.write(formatted);\n }\n\n public initializeDiagnosticSettings(diagnosticLevel: CosmosDbDiagnosticLevel): void {\n this.diagnosticFormatter = new DefaultDiagnosticFormatter();\n switch (diagnosticLevel) {\n case CosmosDbDiagnosticLevel.info:\n this.diagnosticWriter = new NoOpDiagnosticWriter();\n break;\n default:\n this.diagnosticWriter = new LogDiagnosticWriter();\n }\n }\n\n // TODO: move\n private getSessionParams(resourceLink: string): SessionContext {\n const resourceId: string = null;\n let resourceAddress: string = null;\n const parserOutput = parseLink(resourceLink);\n\n resourceAddress = parserOutput.objectBody.self;\n\n const resourceType = parserOutput.type;\n return {\n resourceId,\n resourceAddress,\n resourceType,\n isNameBased: true,\n };\n }\n\n private isMasterResource(resourceType: string): boolean {\n if (\n resourceType === Constants.Path.OffersPathSegment ||\n resourceType === Constants.Path.DatabasesPathSegment ||\n resourceType === Constants.Path.UsersPathSegment ||\n resourceType === Constants.Path.PermissionsPathSegment ||\n resourceType === Constants.Path.TopologyPathSegment ||\n resourceType === Constants.Path.DatabaseAccountPathSegment ||\n resourceType === Constants.Path.PartitionKeyRangesPathSegment ||\n resourceType === Constants.Path.CollectionsPathSegment\n ) {\n return true;\n }\n\n return false;\n }\n\n private buildHeaders(requestContext: RequestContext): Promise<CosmosHeaders> {\n return getHeaders({\n clientOptions: this.cosmosClientOptions,\n defaultHeaders: {\n ...this.cosmosClientOptions.defaultHeaders,\n ...requestContext.options.initialHeaders,\n },\n verb: requestContext.method,\n path: requestContext.path,\n resourceId: requestContext.resourceId,\n resourceType: requestContext.resourceType,\n options: requestContext.options,\n partitionKeyRangeId: requestContext.partitionKeyRangeId,\n useMultipleWriteLocations: this.connectionPolicy.useMultipleWriteLocations,\n partitionKey:\n requestContext.partitionKey !== undefined\n ? convertToInternalPartitionKey(requestContext.partitionKey)\n : undefined, // TODO: Move this check from here to PartitionKey\n operationType: requestContext.operationType,\n });\n }\n\n /**\n * Returns collection of properties which are derived from the context for Request Creation.\n * These properties have client wide scope, as opposed to request specific scope.\n * @returns\n */\n private getContextDerivedPropsForRequestCreation(): {\n globalEndpointManager: GlobalEndpointManager;\n connectionPolicy: ConnectionPolicy;\n requestAgent: Agent;\n client?: ClientContext;\n pipeline?: Pipeline;\n plugins: PluginConfig[];\n httpClient?: HttpClient;\n globalPartitionEndpointManager?: GlobalPartitionEndpointManager;\n } {\n return {\n globalEndpointManager: this.globalEndpointManager,\n requestAgent: this.cosmosClientOptions.agent,\n connectionPolicy: this.connectionPolicy,\n client: this,\n plugins: this.cosmosClientOptions.plugins,\n pipeline: this.pipeline,\n httpClient: this.cosmosClientOptions.httpClient,\n globalPartitionEndpointManager: this.globalPartitionEndpointManager,\n };\n }\n\n public getClientConfig(): ClientConfigDiagnostic {\n return this.clientConfig;\n }\n\n /**\n * @internal\n */\n public refreshUserAgent(hostFramework: string): void {\n const updatedUserAgent = getUserAgent(this.cosmosClientOptions, hostFramework);\n this.cosmosClientOptions.defaultHeaders[Constants.HttpHeaders.UserAgent] = updatedUserAgent;\n this.cosmosClientOptions.defaultHeaders[Constants.HttpHeaders.CustomUserAgent] =\n updatedUserAgent;\n }\n\n /**\n * @internal\n */\n public getRetryOptions(): RetryOptions {\n return this.connectionPolicy.retryOptions;\n }\n\n /**\n * @internal\n */\n public isPartitionLevelFailOverEnabled(): boolean {\n return (\n this.globalEndpointManager.enablePartitionLevelFailover ||\n this.globalEndpointManager.enablePartitionLevelCircuitBreaker\n );\n }\n}\n"]}
|
|
@@ -30,6 +30,19 @@ import { ResourceResponse } from "./request/index.js";
|
|
|
30
30
|
* },
|
|
31
31
|
* });
|
|
32
32
|
* ```
|
|
33
|
+
* @example Instantiate a client with AAD authentication and custom scope
|
|
34
|
+
* ```ts snippet:CosmosClientWithAADScope
|
|
35
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
36
|
+
* import { CosmosClient } from "@azure/cosmos";
|
|
37
|
+
*
|
|
38
|
+
* const endpoint = "https://your-account.documents.azure.com";
|
|
39
|
+
* const aadCredentials = new DefaultAzureCredential();
|
|
40
|
+
* const client = new CosmosClient({
|
|
41
|
+
* endpoint,
|
|
42
|
+
* aadCredentials,
|
|
43
|
+
* aadScope: "https://cosmos.azure.com/.default", // Optional custom scope
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
33
46
|
*/
|
|
34
47
|
export declare class CosmosClient {
|
|
35
48
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosClient.d.ts","sourceRoot":"","sources":["../../src/CosmosClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAKxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAEtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKtD
|
|
1
|
+
{"version":3,"file":"CosmosClient.d.ts","sourceRoot":"","sources":["../../src/CosmosClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAKxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAEtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,YAAY;IACvB;;;;;;;;;;;;;;;;OAgBG;IACH,SAAgB,SAAS,EAAE,SAAS,CAAC;IACrC;;;;OAIG;IACH,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,iBAAiB,CAAiB;IAO1C;;OAEG;gBACS,gBAAgB,EAAE,MAAM;IACpC;;;OAGG;gBACS,OAAO,EAAE,mBAAmB;IA2GxC,OAAO,CAAC,gCAAgC;IAoBxC;;OAEG;IACU,kBAAkB,CAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAM7C;;OAEG;IACU,0BAA0B,CACrC,cAAc,EAAE,sBAAsB,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAW7C;;;;OAIG;IACU,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAMhD;;;;OAIG;IACU,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAM/C;;;;OAIG;IACI,iBAAiB,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAItD;;;;OAIG;IACI,gBAAgB,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAIrD;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACI,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ;IAIrC;;;OAGG;IACI,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK;IAI/B;;OAEG;IACI,OAAO,IAAI,IAAI;YAWR,6BAA6B;CA8B5C"}
|
package/dist/esm/CosmosClient.js
CHANGED
|
@@ -40,6 +40,19 @@ import { GlobalPartitionEndpointManager } from "./globalPartitionEndpointManager
|
|
|
40
40
|
* },
|
|
41
41
|
* });
|
|
42
42
|
* ```
|
|
43
|
+
* @example Instantiate a client with AAD authentication and custom scope
|
|
44
|
+
* ```ts snippet:CosmosClientWithAADScope
|
|
45
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
46
|
+
* import { CosmosClient } from "@azure/cosmos";
|
|
47
|
+
*
|
|
48
|
+
* const endpoint = "https://your-account.documents.azure.com";
|
|
49
|
+
* const aadCredentials = new DefaultAzureCredential();
|
|
50
|
+
* const client = new CosmosClient({
|
|
51
|
+
* endpoint,
|
|
52
|
+
* aadCredentials,
|
|
53
|
+
* aadScope: "https://cosmos.azure.com/.default", // Optional custom scope
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
43
56
|
*/
|
|
44
57
|
export class CosmosClient {
|
|
45
58
|
/**
|
|
@@ -99,6 +112,11 @@ export class CosmosClient {
|
|
|
99
112
|
}
|
|
100
113
|
const clientConfig = this.initializeClientConfigDiagnostic(optionsOrConnectionString);
|
|
101
114
|
optionsOrConnectionString.connectionPolicy = Object.assign({}, defaultConnectionPolicy, optionsOrConnectionString.connectionPolicy);
|
|
115
|
+
// If endpoint discovery is disabled, automatically disable partition level features
|
|
116
|
+
if (!optionsOrConnectionString.connectionPolicy.enableEndpointDiscovery) {
|
|
117
|
+
optionsOrConnectionString.connectionPolicy.enablePartitionLevelFailover = false;
|
|
118
|
+
optionsOrConnectionString.connectionPolicy.enablePartitionLevelCircuitBreaker = false;
|
|
119
|
+
}
|
|
102
120
|
optionsOrConnectionString.defaultHeaders = optionsOrConnectionString.defaultHeaders || {};
|
|
103
121
|
optionsOrConnectionString.defaultHeaders[Constants.HttpHeaders.CacheControl] = "no-cache";
|
|
104
122
|
optionsOrConnectionString.defaultHeaders[Constants.HttpHeaders.Version] =
|
|
@@ -117,9 +135,6 @@ export class CosmosClient {
|
|
|
117
135
|
const globalEndpointManager = new GlobalEndpointManager(optionsOrConnectionString, async (diagnosticNode, opts) => this.getDatabaseAccountInternal(diagnosticNode, opts));
|
|
118
136
|
if (optionsOrConnectionString.connectionPolicy.enablePartitionLevelFailover ||
|
|
119
137
|
optionsOrConnectionString.connectionPolicy.enablePartitionLevelCircuitBreaker) {
|
|
120
|
-
if (!optionsOrConnectionString.connectionPolicy.enableEndpointDiscovery) {
|
|
121
|
-
throw new Error("enableEndpointDiscovery must be set to true to use partition level failover or circuit breaker.");
|
|
122
|
-
}
|
|
123
138
|
this.globalPartitionEndpointManager = new GlobalPartitionEndpointManager(optionsOrConnectionString, globalEndpointManager);
|
|
124
139
|
}
|
|
125
140
|
this.clientContext = new ClientContext(optionsOrConnectionString, globalEndpointManager, clientConfig, determineDiagnosticLevel(optionsOrConnectionString.diagnosticLevel, getDiagnosticLevelFromEnvironment()), this.globalPartitionEndpointManager);
|
|
@@ -145,6 +160,7 @@ export class CosmosClient {
|
|
|
145
160
|
diagnosticLevel: optionsOrConnectionString.diagnosticLevel,
|
|
146
161
|
pluginsConfigured: optionsOrConnectionString.plugins !== undefined,
|
|
147
162
|
sDKVersion: Constants.SDKVersion,
|
|
163
|
+
aadScopeOverride: optionsOrConnectionString.aadScope !== undefined,
|
|
148
164
|
};
|
|
149
165
|
}
|
|
150
166
|
/**
|