Skip to content

Commit

Permalink
[@azure/eventgrid] Add Missing Events (#29872)
Browse files Browse the repository at this point in the history
### Packages impacted by this PR

@azure/eventgrid

### Issues associated with this PR

#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.
  • Loading branch information
sarangan12 authored Jun 3, 2024
1 parent e82103b commit 58e7c37
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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" */
Expand Down Expand Up @@ -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<any>[] = [
{
Expand Down Expand Up @@ -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<any>[] = 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 () => {
Expand Down Expand Up @@ -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())),
Expand Down
10 changes: 5 additions & 5 deletions sdk/eventgrid/eventgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion sdk/eventgrid/eventgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
39 changes: 39 additions & 0 deletions sdk/eventgrid/eventgrid/review/eventgrid.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions sdk/eventgrid/eventgrid/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,8 @@ export {
KnownAcsInteractiveReplyKind,
AcsMessageDeliveryStatus,
KnownAcsMessageDeliveryStatus,
AcsChatThreadCreatedEventData,
AcsChatThreadDeletedEventData,
AcsChatThreadPropertiesUpdatedEventData,
AcsChatThreadEventInThreadBase,
} from "./generated/models";
9 changes: 9 additions & 0 deletions sdk/eventgrid/eventgrid/src/predicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ import {
AcsMessageDeliveryStatusUpdatedEventData,
AcsMessageReceivedEventData,
AcsRouterWorkerUpdatedEventData,
AcsChatThreadDeletedEventData,
AcsChatThreadCreatedEventData,
AcsChatThreadPropertiesUpdatedEventData,
} from "./generated/models";

import { CloudEvent, EventGridEvent } from "./models";
Expand Down Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventgrid/eventgrid/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});

0 comments on commit 58e7c37

Please sign in to comment.