From 6d6b24feaaa04b094f25fb49ff99041356cbadb0 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Fri, 22 Jan 2021 17:11:22 +0000 Subject: [PATCH 1/3] Add TokenCredential as part of the type of the credentials input --- lib/azureServiceClient.ts | 7 ++++--- package.json | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/azureServiceClient.ts b/lib/azureServiceClient.ts index d63927e..a981d2d 100644 --- a/lib/azureServiceClient.ts +++ b/lib/azureServiceClient.ts @@ -1,7 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -import { HttpOperationResponse, OperationArguments, OperationSpec, RequestOptionsBase, RequestPrepareOptions, ServiceClient, ServiceClientCredentials, ServiceClientOptions, WebResource, getDefaultUserAgentValue as getDefaultUserAgentValueFromMsRest } from "@azure/ms-rest-js"; +import { HttpOperationResponse, OperationArguments, OperationSpec, RequestOptionsBase, RequestPrepareOptions, ServiceClient, ServiceClientCredentials, ServiceClientOptions, WebResource, getDefaultUserAgentValue as getDefaultUserAgentValueFromMsRest, TokenCredentials } from "@azure/ms-rest-js"; +import { TokenCredential } from "@azure/core-auth"; import { createLROPollerFromInitialResponse, createLROPollerFromPollState, LROPoller } from "./lroPoller"; import { LROPollState } from "./lroPollStrategy"; import * as Constants from "./util/constants"; @@ -38,12 +39,12 @@ export class AzureServiceClient extends ServiceClient { */ public longRunningOperationRetryTimeout?: number; - constructor(credentials: ServiceClientCredentials, options?: AzureServiceClientOptions) { + constructor(credentials: ServiceClientCredentials | TokenCredential, options?: AzureServiceClientOptions) { super(credentials, options = updateOptionsWithDefaultValues(options)); // For convenience, if the credentials have an associated AzureEnvironment, // automatically use the baseUri from that environment. - const env = (credentials as any).environment; + const env = (credentials as any)?.environment; if (env && !this.baseUri) { this.baseUri = env.resourceManagerEndpointUrl; } diff --git a/package.json b/package.json index eca14cf..b790358 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ ], "license": "MIT", "dependencies": { + "@azure/core-auth": "^1.1.4", "@azure/ms-rest-js": "^2.0.4", "tslib": "^1.10.0" }, From 0e59752332c0fcb0032944b6027f4d36eeb68c65 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Fri, 22 Jan 2021 17:13:02 +0000 Subject: [PATCH 2/3] remove unneeded dep --- lib/azureServiceClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/azureServiceClient.ts b/lib/azureServiceClient.ts index a981d2d..521d9be 100644 --- a/lib/azureServiceClient.ts +++ b/lib/azureServiceClient.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -import { HttpOperationResponse, OperationArguments, OperationSpec, RequestOptionsBase, RequestPrepareOptions, ServiceClient, ServiceClientCredentials, ServiceClientOptions, WebResource, getDefaultUserAgentValue as getDefaultUserAgentValueFromMsRest, TokenCredentials } from "@azure/ms-rest-js"; +import { HttpOperationResponse, OperationArguments, OperationSpec, RequestOptionsBase, RequestPrepareOptions, ServiceClient, ServiceClientCredentials, ServiceClientOptions, WebResource, getDefaultUserAgentValue as getDefaultUserAgentValueFromMsRest } from "@azure/ms-rest-js"; import { TokenCredential } from "@azure/core-auth"; import { createLROPollerFromInitialResponse, createLROPollerFromPollState, LROPoller } from "./lroPoller"; import { LROPollState } from "./lroPollStrategy"; From 2b7e6bc4a6aaf63cdf0b54763ce2445c9cd2cc13 Mon Sep 17 00:00:00 2001 From: deyaaeldeen Date: Tue, 26 Jan 2021 22:02:10 +0000 Subject: [PATCH 3/3] prepare a release --- Changelog.md | 5 ++++- lib/util/constants.ts | 2 +- package.json | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index f7fccbb..4958b2c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,7 @@ # Changelog +## 2.1.0 - 2021-01-26 +- Added support for @azure/identity's TokenCredential. For more information, see https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/README.md#credentials + ## 2.0.1 - 2019-07-30 - In `getOperationResponse()` if the `resource` is of type `string` and we get an error while performing `JSON.parse()` then instead of letting the error be thrown we set the `resource` as-is as the `response.parsedBody` @@ -85,4 +88,4 @@ - Initial version of the isomorphic azure runtime along with type definitions that works in the browser as well as the node.js environment - Supports polling for long running operations - - Provides definition of CloudError \ No newline at end of file + - Provides definition of CloudError diff --git a/lib/util/constants.ts b/lib/util/constants.ts index 6b0abdf..5636397 100644 --- a/lib/util/constants.ts +++ b/lib/util/constants.ts @@ -27,4 +27,4 @@ export const DEFAULT_LANGUAGE = "en-us"; * @const * @type {string} */ -export const msRestAzureVersion = "2.0.1"; +export const msRestAzureVersion = "2.1.0"; diff --git a/package.json b/package.json index b790358..af5fe6d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "email": "azsdkteam@microsoft.com", "url": "https://github.com/Azure/ms-rest-azure-js" }, - "version": "2.0.2", + "version": "2.1.0", "description": "Isomorphic Azure client runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest", "tags": [ "isomorphic", @@ -42,7 +42,7 @@ "license": "MIT", "dependencies": { "@azure/core-auth": "^1.1.4", - "@azure/ms-rest-js": "^2.0.4", + "@azure/ms-rest-js": "^2.2.0", "tslib": "^1.10.0" }, "devDependencies": {