Update the Core Client Version and Test Recorder (#30032)

### Packages impacted by this PR
@Azure/communication-chat 

### Issues associated with this PR
### Describe the problem that is addressed by this PR

Customer escalated the issue:
The issue was introduced from the @azure/communication-chat@1.4.0. Chat
client updated the internal API client by generating the new service
client version with the `endpoint` param to replace the `baseUri` and
kept the dependency version @azure/core-client@1.3.0 and higher. While
the `endpoint` is introduced only in @azure/core-client@1.6.0.
Customer see error "baseUrl is not specified" if the dependency version
not updated.

Update the @azure/core-client version to fix the issue


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [x] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [x] Added a changelog (if necessary)
This commit is contained in:
luc 2024-06-13 10:43:47 -07:00 коммит произвёл GitHub
Родитель c56038f203
Коммит 1feeb00285
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 34 добавлений и 8 удалений

Просмотреть файл

@ -19275,7 +19275,7 @@ packages:
dev: false
file:projects/communication-chat.tgz:
resolution: {integrity: sha512-LsbGjr9EW8VTWF/5INwJsD2jzswejO0PtWkeP9T3VW/gU7HjW6IrwSw0pvEeJJqgSAES/He5SJVkvmUrZRCpww==, tarball: file:projects/communication-chat.tgz}
resolution: {integrity: sha512-Ig3CWKQBXnEfG9ukjexA74Yq+ZXRdSeHAv1owp0ynN3rCgy89SLaXi3ZmlDQIxQK59djz3Xj3/HtkQZNT/T7rg==, tarball: file:projects/communication-chat.tgz}
name: '@rush-temp/communication-chat'
version: 0.0.0
dependencies:

Просмотреть файл

@ -4,6 +4,13 @@
### Features Added
## 1.5.1 (2024-06-12)
### Bugs Fixed
- Updated @azure/core-client and @azure/core-rest-pipeline version.
## 1.5.0 (2024-04-15)
### Features Added

Просмотреть файл

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "js",
"TagPrefix": "js/communication/communication-chat",
"Tag": "js/communication/communication-chat_829a1529fe"
"Tag": "js/communication/communication-chat_5593dd2de6"
}

Просмотреть файл

@ -66,9 +66,9 @@
"@azure/communication-common": "^2.3.1",
"@azure/communication-signaling": "1.0.0-beta.26",
"@azure/core-auth": "^1.3.0",
"@azure/core-client": "^1.3.0",
"@azure/core-client": "^1.6.0",
"@azure/core-paging": "^1.1.1",
"@azure/core-rest-pipeline": "^1.3.0",
"@azure/core-rest-pipeline": "^1.9.0",
"@azure/core-tracing": "^1.0.0",
"@azure/logger": "^1.0.0",
"events": "^3.0.0",
@ -77,7 +77,7 @@
},
"devDependencies": {
"@azure-tools/test-credential": "^1.0.0",
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-recorder": "^3.5.1",
"@azure/communication-identity": "^1.1.0-beta.2",
"@azure/core-util": "^1.0.0",
"@azure/dev-tool": "^1.0.0",

Просмотреть файл

@ -1,4 +1,4 @@
COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING="endpoint=<endpoint>;accessKey=<accessKey>"
COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING="endpoint=<endpoint>;accessKey=<accessKey>"
# Our tests assume that TEST_MODE is "playback" by default. You can
# change it to "record" to generate new recordings, or "live" to bypass the recorder entirely.

Просмотреть файл

@ -8,6 +8,7 @@ import {
RecorderStartOptions,
assertEnvironmentVariable,
env,
isPlaybackMode,
} from "@azure-tools/test-recorder";
import { ChatClient } from "../../../src";
import {
@ -17,6 +18,7 @@ import {
} from "@azure/communication-common";
import { CommunicationIdentityClient, CommunicationUserToken } from "@azure/communication-identity";
import { generateToken } from "./connectionUtils";
import { NoOpCredential } from "@azure-tools/test-credential";
export interface RecordedClient {
chatClient: ChatClient;
@ -27,7 +29,8 @@ const envSetupForPlayback: { [k: string]: string } = {
COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING: "endpoint=https://endpoint/;accesskey=banana",
};
const fakeToken = generateToken();
const fakeToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTc2MzQ4MDguMTd9.Rx6RqlnKsM09viqebSbPDKRcUp3EIKDEHNVXq3Wb0ms";
export const recorderOptions: RecorderStartOptions = {
envSetupForPlayback,
sanitizerOptions: {
@ -40,6 +43,7 @@ export const recorderOptions: RecorderStartOptions = {
bodyKeySanitizers: [{ jsonPath: "$.accessToken.token", value: fakeToken }],
},
removeCentralSanitizers: [
"AZSDK4001", // url need not be sanitized, fake conn string handles it already
"AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section
"AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section
],
@ -78,7 +82,22 @@ export function createChatClient(userToken: string, recorder: Recorder): ChatCli
return new ChatClient(
url,
new AzureCommunicationTokenCredential(generateToken()),
isPlaybackMode()
? new NoOpAzureCommunicationTokenCredential()
: new AzureCommunicationTokenCredential(userToken),
recorder.configureClientOptions({}),
);
}
/**
* `TokenCredential` implementation for playback.
* If your regular AAD credentials don't take the recorder httpClient option, the AAD traffic won't be recorded.
* In this case, you'll need to bypass the AAD requests with no-op.
*
* Using this NoOpAzureCommunicationTokenCredential as your credential in playback mode would help you bypass the AAD traffic.
*/
export class NoOpAzureCommunicationTokenCredential extends NoOpCredential {
public dispose(): void {
/* intentionally empty */
}
}