From 321b45f23140f31f01161c9c745caa2c1b2efcfb Mon Sep 17 00:00:00 2001 From: Emlyn Bolton <3941071+emlynmac@users.noreply.github.com> Date: Wed, 2 Oct 2024 12:06:23 -0700 Subject: [PATCH 1/5] Create API changes for review; signaling package provides the updates. --- .../communication-chat/package.json | 2 +- .../review/communication-chat.api.md | 20 ++++++++++++++++--- .../communication-chat/src/chatClient.ts | 8 ++++++++ .../communication-chat/src/models/events.ts | 17 +++++++++++++++- 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/sdk/communication/communication-chat/package.json b/sdk/communication/communication-chat/package.json index 1548591081d9..053d8935634d 100644 --- a/sdk/communication/communication-chat/package.json +++ b/sdk/communication/communication-chat/package.json @@ -57,7 +57,7 @@ "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-chat/", "sideEffects": false, diff --git a/sdk/communication/communication-chat/review/communication-chat.api.md b/sdk/communication/communication-chat/review/communication-chat.api.md index 1f55d49378e5..022a267c19e4 100644 --- a/sdk/communication/communication-chat/review/communication-chat.api.md +++ b/sdk/communication/communication-chat/review/communication-chat.api.md @@ -6,7 +6,7 @@ import { ChatMessageDeletedEvent } from '@azure/communication-signaling'; import { ChatMessageEditedEvent } from '@azure/communication-signaling'; -import { ChatMessageReceivedEvent } from '@azure/communication-signaling'; +import { ChatMessageReceivedEvent as ChatMessageReceivedEvent_2 } from '@azure/communication-signaling'; import { ChatThreadCreatedEvent } from '@azure/communication-signaling'; import { ChatThreadDeletedEvent } from '@azure/communication-signaling'; import { ChatThreadPropertiesUpdatedEvent } from '@azure/communication-signaling'; @@ -94,7 +94,7 @@ export interface ChatError { } // @public (undocumented) -export type ChatEventId = "chatMessageReceived" | "chatMessageEdited" | "chatMessageDeleted" | "typingIndicatorReceived" | "readReceiptReceived" | "chatThreadCreated" | "chatThreadDeleted" | "chatThreadPropertiesUpdated" | "participantsAdded" | "participantsRemoved" | "realTimeNotificationConnected" | "realTimeNotificationDisconnected"; +export type ChatEventId = "chatMessageReceived" | "chatMessageEdited" | "chatMessageDeleted" | "typingIndicatorReceived" | "readReceiptReceived" | "chatThreadCreated" | "chatThreadDeleted" | "chatThreadPropertiesUpdated" | "participantsAdded" | "participantsRemoved" | "streamingChatMessageStarted" | "streamingChatMessageChunkReceived" | "realTimeNotificationConnected" | "realTimeNotificationDisconnected"; // @public export interface ChatMessage { @@ -131,7 +131,11 @@ export interface ChatMessageReadReceipt { sender: CommunicationIdentifierKind; } -export { ChatMessageReceivedEvent } +// @public (undocumented) +export interface ChatMessageReceivedEvent extends ChatMessageReceivedEvent_2 { + // (undocumented) + streamingContentType?: "informative" | "streaming" | "final"; +} // @public export type ChatMessageType = "text" | "html" | "topicUpdated" | "participantAdded" | "participantRemoved"; @@ -298,6 +302,16 @@ export interface SendTypingNotificationOptions extends OperationOptions { senderDisplayName?: string; } +// @public (undocumented) +export interface StreamingChatMessageChunkReceivedEvent extends ChatMessageEditedEvent { + // (undocumented) + streamingSequenceNumber: number; +} + +// @public (undocumented) +export interface StreamingChatMessageStartEvent extends ChatMessageReceivedEvent { +} + export { TypingIndicatorReceivedEvent } // @public diff --git a/sdk/communication/communication-chat/src/chatClient.ts b/sdk/communication/communication-chat/src/chatClient.ts index 8e3eafee82a7..762d551e2ee8 100644 --- a/sdk/communication/communication-chat/src/chatClient.ts +++ b/sdk/communication/communication-chat/src/chatClient.ts @@ -510,5 +510,13 @@ export class ChatClient { this.signalingClient.on("participantsRemoved", (payload) => { this.emitter.emit("participantsRemoved", payload); }); + + // this.signalingClient.on("streamingChatMessageStarted", (payload) => { + // this.emitter.emit("streamingChatMessageStarted", payload); + // }); + + // this.signalingClient.on("streamingChatMessageChunkReceived", (payload) => { + // this.emitter.emit("streamingChatMessageCompleted", payload); + // }); } } diff --git a/sdk/communication/communication-chat/src/models/events.ts b/sdk/communication/communication-chat/src/models/events.ts index f5f82e22e462..a432f2246e18 100644 --- a/sdk/communication/communication-chat/src/models/events.ts +++ b/sdk/communication/communication-chat/src/models/events.ts @@ -4,16 +4,27 @@ import { ChatMessageDeletedEvent, ChatMessageEditedEvent, - ChatMessageReceivedEvent, + ChatMessageReceivedEvent as SignallingMessageReceivedEvent, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent, ReadReceiptReceivedEvent, + // StreamingChatMessageChunkReceivedEvent, // TODO: from signaling once package available + // StreamingChatMessageStartEvent, // rush local packages broken TypingIndicatorReceivedEvent, } from "@azure/communication-signaling"; +// TODO: Remove these once the signaling package is available +interface ChatMessageReceivedEvent extends SignallingMessageReceivedEvent { + streamingContentType?: "informative" | "streaming" | "final"; +} +interface StreamingChatMessageStartEvent extends ChatMessageReceivedEvent { } +interface StreamingChatMessageChunkReceivedEvent extends ChatMessageEditedEvent { + streamingSequenceNumber: number; +} + type ChatEventId = | "chatMessageReceived" | "chatMessageEdited" @@ -25,6 +36,8 @@ type ChatEventId = | "chatThreadPropertiesUpdated" | "participantsAdded" | "participantsRemoved" + | "streamingChatMessageStarted" + | "streamingChatMessageChunkReceived" | "realTimeNotificationConnected" | "realTimeNotificationDisconnected"; @@ -40,4 +53,6 @@ export { ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent, + StreamingChatMessageChunkReceivedEvent, + StreamingChatMessageStartEvent, }; From 76f063b5c3575f791267f2fe24898f454d7c55e8 Mon Sep 17 00:00:00 2001 From: Emlyn Bolton <3941071+emlynmac@users.noreply.github.com> Date: Thu, 21 Nov 2024 12:11:01 -0800 Subject: [PATCH 2/5] Update API surface for review prior to signaling library update --- .../communication-chat/src/models/events.ts | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sdk/communication/communication-chat/src/models/events.ts b/sdk/communication/communication-chat/src/models/events.ts index a432f2246e18..8ef92398c372 100644 --- a/sdk/communication/communication-chat/src/models/events.ts +++ b/sdk/communication/communication-chat/src/models/events.ts @@ -4,7 +4,7 @@ import { ChatMessageDeletedEvent, ChatMessageEditedEvent, - ChatMessageReceivedEvent as SignallingMessageReceivedEvent, + ChatMessageReceivedEvent as OldSignalingMessageReceivedEvent, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, @@ -17,13 +17,25 @@ import { } from "@azure/communication-signaling"; // TODO: Remove these once the signaling package is available -interface ChatMessageReceivedEvent extends SignallingMessageReceivedEvent { - streamingContentType?: "informative" | "streaming" | "final"; +export type StreamingContentType = "start" | "informative" | "streaming" | "final"; +export type StreamEndReason = "completed" | "expired" | "canceled"; + +/** + * Type definition for information on a streaming message + */ +export interface StreamingMessageMetadata { + streamingContentType?: StreamingContentType; + streamingSequenceNumber?: number; // Only present on informative or streaming type messages + streamEndReason?: StreamEndReason; // Only present on final type messages } -interface StreamingChatMessageStartEvent extends ChatMessageReceivedEvent { } -interface StreamingChatMessageChunkReceivedEvent extends ChatMessageEditedEvent { - streamingSequenceNumber: number; +interface ChatMessageReceivedEvent extends OldSignalingMessageReceivedEvent { + /** + * If a streaming message, details about the streaming message. + */ + streamingMetadata?: StreamingMessageMetadata; } +interface StreamingChatMessageStartEvent extends ChatMessageReceivedEvent { } +interface StreamingChatMessageChunkReceivedEvent extends ChatMessageEditedEvent { } type ChatEventId = | "chatMessageReceived" From cc9140a624f201c8ab2d149f352b35429d525cd2 Mon Sep 17 00:00:00 2001 From: Emlyn Bolton <3941071+emlynmac@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:05:36 -0800 Subject: [PATCH 3/5] API updates --- .../review/communication-chat.api.md | 21 +++++++++++++++---- .../communication-chat/src/models/events.ts | 5 +---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/sdk/communication/communication-chat/review/communication-chat.api.md b/sdk/communication/communication-chat/review/communication-chat.api.md index 022a267c19e4..f10608170a9d 100644 --- a/sdk/communication/communication-chat/review/communication-chat.api.md +++ b/sdk/communication/communication-chat/review/communication-chat.api.md @@ -133,8 +133,7 @@ export interface ChatMessageReadReceipt { // @public (undocumented) export interface ChatMessageReceivedEvent extends ChatMessageReceivedEvent_2 { - // (undocumented) - streamingContentType?: "informative" | "streaming" | "final"; + streamingMetadata?: StreamingMessageMetadata; } // @public @@ -302,16 +301,30 @@ export interface SendTypingNotificationOptions extends OperationOptions { senderDisplayName?: string; } +// @public (undocumented) +export type StreamEndReason = "completed" | "expired" | "canceled"; + // @public (undocumented) export interface StreamingChatMessageChunkReceivedEvent extends ChatMessageEditedEvent { - // (undocumented) - streamingSequenceNumber: number; } // @public (undocumented) export interface StreamingChatMessageStartEvent extends ChatMessageReceivedEvent { } +// @public (undocumented) +export type StreamingContentType = "start" | "informative" | "streaming" | "final"; + +// @public (undocumented) +export interface StreamingMessageMetadata { + // (undocumented) + streamEndReason?: StreamEndReason; + // (undocumented) + streamingContentType?: StreamingContentType; + // (undocumented) + streamingSequenceNumber?: number; +} + export { TypingIndicatorReceivedEvent } // @public diff --git a/sdk/communication/communication-chat/src/models/events.ts b/sdk/communication/communication-chat/src/models/events.ts index 8ef92398c372..c80af62a64a6 100644 --- a/sdk/communication/communication-chat/src/models/events.ts +++ b/sdk/communication/communication-chat/src/models/events.ts @@ -13,16 +13,13 @@ import { ReadReceiptReceivedEvent, // StreamingChatMessageChunkReceivedEvent, // TODO: from signaling once package available // StreamingChatMessageStartEvent, // rush local packages broken + // StreamingMessageMetadata, // TypingIndicatorReceivedEvent, } from "@azure/communication-signaling"; // TODO: Remove these once the signaling package is available export type StreamingContentType = "start" | "informative" | "streaming" | "final"; export type StreamEndReason = "completed" | "expired" | "canceled"; - -/** - * Type definition for information on a streaming message - */ export interface StreamingMessageMetadata { streamingContentType?: StreamingContentType; streamingSequenceNumber?: number; // Only present on informative or streaming type messages From 1670df8cb429c8b2c541db40707befa8e0f0d539 Mon Sep 17 00:00:00 2001 From: Emlyn Bolton <3941071+emlynmac@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:30:17 -0800 Subject: [PATCH 4/5] Updates from review --- sdk/communication/communication-chat/package.json | 2 +- .../communication-chat/review/communication-chat.api.md | 8 ++++---- sdk/communication/communication-chat/src/models/events.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/communication/communication-chat/package.json b/sdk/communication/communication-chat/package.json index 053d8935634d..1548591081d9 100644 --- a/sdk/communication/communication-chat/package.json +++ b/sdk/communication/communication-chat/package.json @@ -57,7 +57,7 @@ "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "engines": { - "node": ">=20.0.0" + "node": ">=18.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-chat/", "sideEffects": false, diff --git a/sdk/communication/communication-chat/review/communication-chat.api.md b/sdk/communication/communication-chat/review/communication-chat.api.md index f10608170a9d..3089dea07a60 100644 --- a/sdk/communication/communication-chat/review/communication-chat.api.md +++ b/sdk/communication/communication-chat/review/communication-chat.api.md @@ -312,19 +312,19 @@ export interface StreamingChatMessageChunkReceivedEvent extends ChatMessageEdite export interface StreamingChatMessageStartEvent extends ChatMessageReceivedEvent { } -// @public (undocumented) -export type StreamingContentType = "start" | "informative" | "streaming" | "final"; - // @public (undocumented) export interface StreamingMessageMetadata { // (undocumented) streamEndReason?: StreamEndReason; // (undocumented) - streamingContentType?: StreamingContentType; + streamingContentType?: StreamingMessageType; // (undocumented) streamingSequenceNumber?: number; } +// @public (undocumented) +export type StreamingMessageType = "start" | "informative" | "streaming" | "final"; + export { TypingIndicatorReceivedEvent } // @public diff --git a/sdk/communication/communication-chat/src/models/events.ts b/sdk/communication/communication-chat/src/models/events.ts index c80af62a64a6..6e3a773b012f 100644 --- a/sdk/communication/communication-chat/src/models/events.ts +++ b/sdk/communication/communication-chat/src/models/events.ts @@ -18,10 +18,10 @@ import { } from "@azure/communication-signaling"; // TODO: Remove these once the signaling package is available -export type StreamingContentType = "start" | "informative" | "streaming" | "final"; +export type StreamingMessageType = "start" | "informative" | "streaming" | "final"; export type StreamEndReason = "completed" | "expired" | "canceled"; export interface StreamingMessageMetadata { - streamingContentType?: StreamingContentType; + streamingContentType?: StreamingMessageType; streamingSequenceNumber?: number; // Only present on informative or streaming type messages streamEndReason?: StreamEndReason; // Only present on final type messages } From 4ded1b8b81bd89b4a55057ce373077718cef13e1 Mon Sep 17 00:00:00 2001 From: Emlyn Bolton <3941071+emlynmac@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:34:25 -0800 Subject: [PATCH 5/5] Missed changes --- .../communication-chat/review/communication-chat.api.md | 2 +- sdk/communication/communication-chat/src/models/events.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/communication/communication-chat/review/communication-chat.api.md b/sdk/communication/communication-chat/review/communication-chat.api.md index 3089dea07a60..7a7792ffff44 100644 --- a/sdk/communication/communication-chat/review/communication-chat.api.md +++ b/sdk/communication/communication-chat/review/communication-chat.api.md @@ -317,7 +317,7 @@ export interface StreamingMessageMetadata { // (undocumented) streamEndReason?: StreamEndReason; // (undocumented) - streamingContentType?: StreamingMessageType; + streamingMessageType?: StreamingMessageType; // (undocumented) streamingSequenceNumber?: number; } diff --git a/sdk/communication/communication-chat/src/models/events.ts b/sdk/communication/communication-chat/src/models/events.ts index 6e3a773b012f..ff17441fb393 100644 --- a/sdk/communication/communication-chat/src/models/events.ts +++ b/sdk/communication/communication-chat/src/models/events.ts @@ -21,7 +21,7 @@ import { export type StreamingMessageType = "start" | "informative" | "streaming" | "final"; export type StreamEndReason = "completed" | "expired" | "canceled"; export interface StreamingMessageMetadata { - streamingContentType?: StreamingMessageType; + streamingMessageType?: StreamingMessageType; streamingSequenceNumber?: number; // Only present on informative or streaming type messages streamEndReason?: StreamEndReason; // Only present on final type messages }