From 58e7c377845064e4e61a1af9e94c530f6ac82704 Mon Sep 17 00:00:00 2001 From: Sarangan Rajamanickam Date: Mon, 3 Jun 2024 10:33:38 -0700 Subject: [PATCH] [@azure/eventgrid] Add Missing Events (#29872) ### Packages impacted by this PR @azure/eventgrid ### Issues associated with this PR https://github.com/Azure/azure-sdk-for-js/issues/28210 ### Describe the problem that is addressed by this PR 3 of the events were missed to be exported. This PR is to export the missing events ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? No special design considerations ### Are there test cases added in this PR? _(If not, why?)_ No ### Provide a list of related PRs _(if any)_ None ### 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) @xirzec Please review and approve the PR. --- .../public/eventGridNamespacesClient.spec.ts | 20 +++++----- sdk/eventgrid/eventgrid/CHANGELOG.md | 10 ++--- sdk/eventgrid/eventgrid/package.json | 2 +- .../eventgrid/review/eventgrid.api.md | 39 +++++++++++++++++++ .../src/generated/generatedClientContext.ts | 2 +- sdk/eventgrid/eventgrid/src/index.ts | 4 ++ sdk/eventgrid/eventgrid/src/predicates.ts | 9 +++++ sdk/eventgrid/eventgrid/src/tracing.ts | 2 +- 8 files changed, 71 insertions(+), 17 deletions(-) diff --git a/sdk/eventgrid/eventgrid-namespaces/test/public/eventGridNamespacesClient.spec.ts b/sdk/eventgrid/eventgrid-namespaces/test/public/eventGridNamespacesClient.spec.ts index c868f1eb69a8..6daea3283760 100644 --- a/sdk/eventgrid/eventgrid-namespaces/test/public/eventGridNamespacesClient.spec.ts +++ b/sdk/eventgrid/eventgrid-namespaces/test/public/eventGridNamespacesClient.spec.ts @@ -12,7 +12,6 @@ import { EventGridDeserializer, } from "../../src"; import { createRecordedClient } from "./utils/recordedClient"; -import { expect } from "chai"; import { Buffer } from "buffer"; /* eslint no-constant-condition: "off" */ @@ -86,12 +85,12 @@ describe("Event Grid Namespace Client", function (this: Suite) { // The Received Cloud Event ID must be equal to the ID of the Event that was published. for (const event of result) { - assert.equal(event.id, eventId); + assert.equal(event.data?.resourceUri, "https://dummyurl.com"); } }); it("publishes multiple cloud events", async () => { - const eventIds: string[] = [`MultipleEventId110002`, `MultipleEventId210003`]; + const eventIds: string[] = ["https://dummyurl.com", "https://dummyurl.com"]; const cloudEvents: CloudEvent[] = [ { @@ -127,11 +126,15 @@ describe("Event Grid Namespace Client", function (this: Suite) { assert.equal(2, receiveResult.value.length); - const receivedEventIds: string[] = [ - receiveResult.value[0].event.id, - receiveResult.value[1].event.id, - ]; - expect(receivedEventIds).to.have.members(eventIds); + const deserializer: EventGridDeserializer = new EventGridDeserializer(); + for (const value of receiveResult.value) { + const result: CloudEvent[] = await deserializer.deserializeCloudEvents( + JSON.stringify(value.event), + ); + for (const event of result) { + assert.equal(event.data?.resourceUri, "https://dummyurl.com"); + } + } }); it("releases a cloud event", async () => { @@ -292,7 +295,6 @@ describe("Event Grid Namespace Client", function (this: Suite) { for (const event of result) { // The Received Cloud Event ID must be equal to the ID of the Event that was published. - assert.equal(event.id, eventId); assert.equal( JSON.stringify(data), JSON.stringify(JSON.parse(Buffer.from(event.data).toString())), diff --git a/sdk/eventgrid/eventgrid/CHANGELOG.md b/sdk/eventgrid/eventgrid/CHANGELOG.md index 6010161a9cfd..430aab353dc8 100644 --- a/sdk/eventgrid/eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/eventgrid/CHANGELOG.md @@ -1,14 +1,14 @@ # Release History -## 5.4.1 (Unreleased) +## 5.5.0 (2026-06-11) ### Features Added -### Breaking Changes - -### Bugs Fixed +- Added new System Events: -### Other Changes + - `Microsoft.Communication.ChatThreadCreated` + - `Microsoft.Communication.ChatThreadDeleted` + - `Microsoft.Communication.ChatThreadPropertiesUpdated` ## 5.4.0 (2024-04-11) diff --git a/sdk/eventgrid/eventgrid/package.json b/sdk/eventgrid/eventgrid/package.json index 19dd36b4fcf4..dcc73fdd3736 100644 --- a/sdk/eventgrid/eventgrid/package.json +++ b/sdk/eventgrid/eventgrid/package.json @@ -3,7 +3,7 @@ "sdk-type": "client", "author": "Microsoft Corporation", "description": "An isomorphic client library for the Azure Event Grid service.", - "version": "5.4.1", + "version": "5.5.0", "keywords": [ "node", "azure", diff --git a/sdk/eventgrid/eventgrid/review/eventgrid.api.md b/sdk/eventgrid/eventgrid/review/eventgrid.api.md index 3a9dba6311bb..00465a47318b 100644 --- a/sdk/eventgrid/eventgrid/review/eventgrid.api.md +++ b/sdk/eventgrid/eventgrid/review/eventgrid.api.md @@ -119,6 +119,18 @@ export type AcsChatParticipantRemovedFromThreadWithUserEventData = AcsChatThread participantRemoved: AcsChatThreadParticipant; }; +// @public +export type AcsChatThreadCreatedEventData = AcsChatThreadEventInThreadBase & { + createdByCommunicationIdentifier: CommunicationIdentifierModel; + properties: { + [propertyName: string]: any; + }; + metadata: { + [propertyName: string]: string; + }; + participants: AcsChatThreadParticipant[]; +}; + // @public export type AcsChatThreadCreatedWithUserEventData = AcsChatThreadEventBase & { createdByCommunicationIdentifier: CommunicationIdentifierModel; @@ -131,12 +143,24 @@ export type AcsChatThreadCreatedWithUserEventData = AcsChatThreadEventBase & { participants: AcsChatThreadParticipant[]; }; +// @public +export type AcsChatThreadDeletedEventData = AcsChatThreadEventInThreadBase & { + deletedByCommunicationIdentifier: CommunicationIdentifierModel; + deleteTime: string; +}; + // @public export type AcsChatThreadEventBase = AcsChatEventBase & { createTime: string; version: number; }; +// @public +export type AcsChatThreadEventInThreadBase = AcsChatEventInThreadBase & { + createTime: string; + version: number; +}; + // @public export interface AcsChatThreadParticipant { displayName: string; @@ -146,6 +170,18 @@ export interface AcsChatThreadParticipant { participantCommunicationIdentifier: CommunicationIdentifierModel; } +// @public +export type AcsChatThreadPropertiesUpdatedEventData = AcsChatThreadEventInThreadBase & { + editedByCommunicationIdentifier: CommunicationIdentifierModel; + editTime: string; + properties: { + [propertyName: string]: any; + }; + metadata: { + [propertyName: string]: string; + }; +}; + // @public export type AcsChatThreadPropertiesUpdatedPerUserEventData = AcsChatThreadEventBase & { editedByCommunicationIdentifier: CommunicationIdentifierModel; @@ -2689,9 +2725,12 @@ export interface SystemEventNameToEventData { "Microsoft.Communication.ChatMessageReceivedInThread": AcsChatMessageReceivedInThreadEventData; "Microsoft.Communication.ChatParticipantAddedToThreadWithUser": AcsChatParticipantAddedToThreadWithUserEventData; "Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser": AcsChatParticipantRemovedFromThreadWithUserEventData; + "Microsoft.Communication.ChatThreadCreated": AcsChatThreadCreatedEventData; "Microsoft.Communication.ChatThreadCreatedWithUser": AcsChatThreadCreatedWithUserEventData; + "Microsoft.Communication.ChatThreadDeleted": AcsChatThreadDeletedEventData; "Microsoft.Communication.ChatThreadParticipantAdded": AcsChatParticipantAddedToThreadEventData; "Microsoft.Communication.ChatThreadParticipantRemoved": AcsChatParticipantRemovedFromThreadEventData; + "Microsoft.Communication.ChatThreadPropertiesUpdated": AcsChatThreadPropertiesUpdatedEventData; "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser": AcsChatThreadPropertiesUpdatedPerUserEventData; "Microsoft.Communication.ChatThreadWithUserDeleted": AcsChatThreadWithUserDeletedEventData; "Microsoft.Communication.EmailDeliveryReportReceived": AcsEmailDeliveryReportReceivedEventData; diff --git a/sdk/eventgrid/eventgrid/src/generated/generatedClientContext.ts b/sdk/eventgrid/eventgrid/src/generated/generatedClientContext.ts index a8fd30a44b18..e69340a8704d 100644 --- a/sdk/eventgrid/eventgrid/src/generated/generatedClientContext.ts +++ b/sdk/eventgrid/eventgrid/src/generated/generatedClientContext.ts @@ -26,7 +26,7 @@ export class GeneratedClientContext extends coreClient.ServiceClient { requestContentType: "application/json; charset=utf-8" }; - const packageDetails = `azsdk-js-eventgrid/5.4.1`; + const packageDetails = `azsdk-js-eventgrid/5.5.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` diff --git a/sdk/eventgrid/eventgrid/src/index.ts b/sdk/eventgrid/eventgrid/src/index.ts index 09e48d88b989..af66ba45538a 100644 --- a/sdk/eventgrid/eventgrid/src/index.ts +++ b/sdk/eventgrid/eventgrid/src/index.ts @@ -359,4 +359,8 @@ export { KnownAcsInteractiveReplyKind, AcsMessageDeliveryStatus, KnownAcsMessageDeliveryStatus, + AcsChatThreadCreatedEventData, + AcsChatThreadDeletedEventData, + AcsChatThreadPropertiesUpdatedEventData, + AcsChatThreadEventInThreadBase, } from "./generated/models"; diff --git a/sdk/eventgrid/eventgrid/src/predicates.ts b/sdk/eventgrid/eventgrid/src/predicates.ts index ebabf2f959a4..517587b06a6f 100644 --- a/sdk/eventgrid/eventgrid/src/predicates.ts +++ b/sdk/eventgrid/eventgrid/src/predicates.ts @@ -209,6 +209,9 @@ import { AcsMessageDeliveryStatusUpdatedEventData, AcsMessageReceivedEventData, AcsRouterWorkerUpdatedEventData, + AcsChatThreadDeletedEventData, + AcsChatThreadCreatedEventData, + AcsChatThreadPropertiesUpdatedEventData, } from "./generated/models"; import { CloudEvent, EventGridEvent } from "./models"; @@ -637,6 +640,12 @@ export interface SystemEventNameToEventData { "Microsoft.Communication.AdvancedMessageReceived": AcsMessageReceivedEventData; /** An interface for the event data of a "Microsoft.Communication.RouterWorkerUpdated" event. */ "Microsoft.Communication.RouterWorkerUpdated": AcsRouterWorkerUpdatedEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatThreadCreated" event. */ + "Microsoft.Communication.ChatThreadCreated": AcsChatThreadCreatedEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatThreadDeleted" event. */ + "Microsoft.Communication.ChatThreadDeleted": AcsChatThreadDeletedEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatThreadPropertiesUpdated" event. */ + "Microsoft.Communication.ChatThreadPropertiesUpdated": AcsChatThreadPropertiesUpdatedEventData; } /** diff --git a/sdk/eventgrid/eventgrid/src/tracing.ts b/sdk/eventgrid/eventgrid/src/tracing.ts index 8689ce04328c..119a3d26f8bf 100644 --- a/sdk/eventgrid/eventgrid/src/tracing.ts +++ b/sdk/eventgrid/eventgrid/src/tracing.ts @@ -10,5 +10,5 @@ import { createTracingClient } from "@azure/core-tracing"; export const tracingClient = createTracingClient({ namespace: "Microsoft.Messaging.EventGrid", packageName: "@azure/event-grid", - packageVersion: "5.4.1", + packageVersion: "5.5.0", });