@azure/communication-chat 1.6.0-beta.1 → 1.6.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +64 -5
- package/dist/index.js.map +1 -1
- package/dist-esm/src/generated/src/chatApiClient.js +2 -2
- package/dist-esm/src/generated/src/chatApiClient.js.map +1 -1
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +44 -0
- package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/src/models/parameters.js +1 -1
- package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/tracing.js +1 -1
- package/dist-esm/src/generated/src/tracing.js.map +1 -1
- package/dist-esm/src/models/mappers.js +14 -1
- package/dist-esm/src/models/mappers.js.map +1 -1
- package/dist-esm/src/models/models.js.map +1 -1
- package/package.json +7 -8
- package/types/communication-chat.d.ts +19 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../../src/models/mappers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAEL,kCAAkC,EAClC,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AAerC,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,OAAgC,EACc,EAAE;IAChD,MAAM,EAAE,YAAY,EAAE,gBAAgB,KAAc,OAAO,EAAhB,IAAI,UAAK,OAAO,EAArD,oCAA2C,CAAU,CAAC;IAC5D,uBACE,sBAAsB,EAAE,gBAAgB,IACrC,IAAI,EACP;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,eAAgC,EACL,EAAE;IAC7B,MAAM,EAAE,EAAE,KAAc,eAAe,EAAxB,IAAI,UAAK,eAAe,EAAjC,MAAe,CAAkB,CAAC;IACxC,uCACK,IAAI,KACP,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EAAG;IACrB,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,WAA6C,EACrB,EAAE;IAC1B,MAAM,EAAE,6BAA6B,KAAc,WAAW,EAApB,IAAI,UAAK,WAAW,EAAxD,iCAA0C,CAAc,CAAC;IAC/D,uCACK,IAAI,KACP,MAAM,EAAE,kCAAkC,CACxC,6BAAkE,CACnE,IACD;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n SerializedCommunicationIdentifier,\n deserializeCommunicationIdentifier,\n serializeCommunicationIdentifier,\n} from \"@azure/communication-common\";\nimport * as RestModel from \"../generated/src/models\";\nimport { AddParticipantsRequest, SendMessageRequest } from \"./requests\";\nimport { CreateChatThreadOptions, SendMessageOptions, UpdateMessageOptions } from \"./options\";\nimport {\n ChatAttachment,\n ChatMessage,\n ChatMessageContent,\n ChatMessageReadReceipt,\n ChatParticipant,\n ChatRetentionPolicy,\n ChatThreadProperties,\n CreateChatThreadResult,\n} from \"./models\";\n\nexport const mapToCreateChatThreadOptionsRestModel = (\n options: CreateChatThreadOptions,\n): RestModel.ChatCreateChatThreadOptionalParams => {\n const { participants, idempotencyToken, ...rest } = options;\n return {\n repeatabilityRequestId: idempotencyToken,\n ...rest,\n };\n};\n\n/**\n * @internal\n * Mapping chat participant customer model to chat participant REST model\n */\nexport const mapToChatParticipantRestModel = (\n chatParticipant: ChatParticipant,\n): RestModel.ChatParticipant => {\n const { id, ...rest } = chatParticipant;\n return {\n ...rest,\n communicationIdentifier: serializeCommunicationIdentifier(id),\n };\n};\n\n/**\n * @internal\n * Mapping add participants request to add chat participants request REST model\n */\nexport const mapToAddChatParticipantsRequestRestModel = (\n addParticipantsRequest: AddParticipantsRequest,\n): RestModel.AddChatParticipantsRequest => {\n return {\n participants: addParticipantsRequest.participants?.map((participant) =>\n mapToChatParticipantRestModel(participant),\n ),\n };\n};\n\n/**\n * @internal\n * Mapping chat attachment SDK model to chat attachment REST model\n */\nexport const mapToChatAttachmentRestModel = (\n chatAttachment: ChatAttachment,\n): RestModel.ChatAttachment => {\n const { attachmentType, ...rest } = chatAttachment;\n if (attachmentType === \"unknown\") {\n throw new Error(\"'unknown' attachmentType not supported\");\n }\n return {\n ...rest,\n attachmentType: attachmentType,\n };\n};\n\n/**\n * @internal\n * Mapping send message request and options to send chat message request REST model\n */\nexport const mapToSendChatMessageRequestRestModel = (\n sendMessageRequest: SendMessageRequest,\n sendMessageOptions: SendMessageOptions,\n): RestModel.SendChatMessageRequest => {\n const { attachments, ...restOptions } = sendMessageOptions;\n let request: RestModel.SendChatMessageRequest = { ...sendMessageRequest, ...restOptions };\n if (attachments) {\n request = {\n ...request,\n attachments: attachments?.map((attachment) => mapToChatAttachmentRestModel(attachment)),\n };\n }\n return request;\n};\n\n/**\n * @internal\n * Mapping update message options to update chat message request REST model\n */\nexport const mapToUpdateChatMessageRequestRestModel = (\n updateMessageOptions: UpdateMessageOptions,\n): RestModel.UpdateChatMessageRequest => {\n const { attachments, ...restOptions } = updateMessageOptions;\n let request: RestModel.UpdateChatMessageRequest = { ...restOptions };\n if (attachments) {\n request = {\n ...request,\n attachments: attachments?.map((attachment) => mapToChatAttachmentRestModel(attachment)),\n };\n }\n return request;\n};\n\n/**\n * @internal\n * Mapping chat participant REST model to chat participant SDK model\n */\nexport const mapToChatParticipantSdkModel = (\n chatParticipant: RestModel.ChatParticipant,\n): ChatParticipant => {\n const { communicationIdentifier, ...rest } = chatParticipant;\n return {\n ...rest,\n id: deserializeCommunicationIdentifier(\n communicationIdentifier as SerializedCommunicationIdentifier,\n ),\n };\n};\n\n/**\n * @internal\n * Mapping chat attachment REST model to chat attachment SDK model\n */\nexport const mapToChatAttachmentSdkModel = (\n chatAttachment: RestModel.ChatAttachment,\n): ChatAttachment => {\n const { attachmentType, ...rest } = chatAttachment;\n return {\n ...rest,\n attachmentType: attachmentType,\n };\n};\n\n/**\n * @internal\n */\nexport const mapToChatContentSdkModel = (\n content: RestModel.ChatMessageContent,\n): ChatMessageContent => {\n const { participants, attachments, initiatorCommunicationIdentifier, ...otherChatContents } =\n content;\n let result: ChatMessageContent = { ...otherChatContents };\n if (initiatorCommunicationIdentifier) {\n const initiator = deserializeCommunicationIdentifier(\n initiatorCommunicationIdentifier as SerializedCommunicationIdentifier,\n );\n result = { ...result, initiator };\n }\n if (participants) {\n result = {\n ...result,\n participants: participants?.map((participant) => mapToChatParticipantSdkModel(participant)),\n };\n }\n if (attachments) {\n result = {\n ...result,\n attachments: attachments?.map((attachment) => mapToChatAttachmentSdkModel(attachment)),\n };\n }\n return result;\n};\n\n/**\n * @internal\n * Mapping chat message REST model to chat message SDK model\n */\nexport const mapToChatMessageSdkModel = (chatMessage: RestModel.ChatMessage): ChatMessage => {\n const { content, senderCommunicationIdentifier, ...otherChatMessage } = chatMessage;\n let result: ChatMessage = { ...otherChatMessage };\n if (content) {\n result = {\n ...result,\n content: mapToChatContentSdkModel(content),\n };\n }\n if (senderCommunicationIdentifier) {\n const sender = deserializeCommunicationIdentifier(\n senderCommunicationIdentifier as SerializedCommunicationIdentifier,\n );\n result = { ...result, sender };\n }\n return result;\n};\n\n/**\n * @internal\n * Mapping chat messages collection REST model to chat message SDK model array\n */\nexport const mapToChatMessagesSdkModelArray = (\n chatMessagesCollection: RestModel.ChatMessagesCollection,\n): ChatMessage[] => {\n return chatMessagesCollection.value?.map((chatMessage) => mapToChatMessageSdkModel(chatMessage));\n};\n\n/**\n * @internal\n * Mapping chat retention policy REST model to chat retention policy SDK model\n */\nexport const mapToRetentionPolicySdkModel = (\n retentionPolicy: RestModel.ChatRetentionPolicyUnion,\n): ChatRetentionPolicy => {\n if (retentionPolicy.kind === \"threadCreationDate\") {\n return retentionPolicy as RestModel.ThreadCreationDateRetentionPolicy;\n }\n if (retentionPolicy.kind === \"none\") {\n return retentionPolicy as RestModel.NoneRetentionPolicy;\n } else {\n throw new Error(`Retention Policy ${retentionPolicy.kind} is not supported`);\n }\n};\n\n/**\n * @internal\n * Mapping chat thread REST model to chat thread SDK model\n */\nexport const mapToChatThreadPropertiesSdkModel = (\n chatThread: RestModel.ChatThreadProperties,\n): ChatThreadProperties => {\n const { createdByCommunicationIdentifier, retentionPolicy, ...rest } = chatThread;\n let result: ChatThreadProperties = { ...rest };\n if (createdByCommunicationIdentifier) {\n result = {\n ...result,\n createdBy: deserializeCommunicationIdentifier(\n createdByCommunicationIdentifier as SerializedCommunicationIdentifier,\n ),\n };\n }\n\n if (retentionPolicy) {\n result = {\n ...result,\n retentionPolicy: mapToRetentionPolicySdkModel(retentionPolicy),\n };\n }\n\n return result;\n};\n\n/**\n * @internal\n * Mapping chat thread REST model to chat thread SDK model\n */\nexport const mapToCreateChatThreadResultSdkModel = (\n result: RestModel.CreateChatThreadResult,\n): CreateChatThreadResult => {\n const { chatThread, ...rest } = result;\n if (chatThread) {\n return {\n ...rest,\n chatThread: mapToChatThreadPropertiesSdkModel(chatThread),\n };\n } else {\n return { ...rest };\n }\n};\n\n/**\n * @internal\n * Mapping read receipt REST model to read receipt SDK model\n */\nexport const mapToReadReceiptSdkModel = (\n readReceipt: RestModel.ChatMessageReadReceipt,\n): ChatMessageReadReceipt => {\n const { senderCommunicationIdentifier, ...rest } = readReceipt;\n return {\n ...rest,\n sender: deserializeCommunicationIdentifier(\n senderCommunicationIdentifier as SerializedCommunicationIdentifier,\n ),\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../../src/models/mappers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAEL,kCAAkC,EAClC,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AAgBrC,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,OAAgC,EACc,EAAE;IAChD,MAAM,EAAE,YAAY,EAAE,gBAAgB,KAAc,OAAO,EAAhB,IAAI,UAAK,OAAO,EAArD,oCAA2C,CAAU,CAAC;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8B,IAAI,CAAE,CAAC;IAC/C,IAAI,gCAAgC,EAAE,CAAC;QACrC,MAAM,mCACD,MAAM,KACT,SAAS,EAAE,kCAAkC,CAC3C,gCAAqE,CACtE,GACF,CAAC;IACJ,CAAC;IAED,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,mCACD,MAAM,KACT,eAAe,EAAE,4BAA4B,CAAC,eAAe,CAAC,GAC/D,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CACjD,MAAwC,EAChB,EAAE;IAC1B,MAAM,EAAE,UAAU,KAAc,MAAM,EAAf,IAAI,UAAK,MAAM,EAAhC,cAAuB,CAAS,CAAC;IACvC,IAAI,UAAU,EAAE,CAAC;QACf,uCACK,IAAI,KACP,UAAU,EAAE,iCAAiC,CAAC,UAAU,CAAC,IACzD;IACJ,CAAC;SAAM,CAAC;QACN,yBAAY,IAAI,EAAG;IACrB,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,WAA6C,EACrB,EAAE;IAC1B,MAAM,EAAE,6BAA6B,KAAc,WAAW,EAApB,IAAI,UAAK,WAAW,EAAxD,iCAA0C,CAAc,CAAC;IAC/D,uCACK,IAAI,KACP,MAAM,EAAE,kCAAkC,CACxC,6BAAkE,CACnE,IACD;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n SerializedCommunicationIdentifier,\n deserializeCommunicationIdentifier,\n serializeCommunicationIdentifier,\n} from \"@azure/communication-common\";\nimport * as RestModel from \"../generated/src/models\";\nimport { AddParticipantsRequest, SendMessageRequest } from \"./requests\";\nimport { CreateChatThreadOptions, SendMessageOptions, UpdateMessageOptions } from \"./options\";\nimport {\n ChatAttachment,\n ChatMessage,\n ChatMessageContent,\n ChatMessageReadReceipt,\n ChatParticipant,\n ChatRetentionPolicy,\n ChatThreadProperties,\n CreateChatThreadResult,\n PolicyViolation,\n} from \"./models\";\n\nexport const mapToCreateChatThreadOptionsRestModel = (\n options: CreateChatThreadOptions,\n): RestModel.ChatCreateChatThreadOptionalParams => {\n const { participants, idempotencyToken, ...rest } = options;\n return {\n repeatabilityRequestId: idempotencyToken,\n ...rest,\n };\n};\n\n/**\n * @internal\n * Mapping chat participant customer model to chat participant REST model\n */\nexport const mapToChatParticipantRestModel = (\n chatParticipant: ChatParticipant,\n): RestModel.ChatParticipant => {\n const { id, ...rest } = chatParticipant;\n return {\n ...rest,\n communicationIdentifier: serializeCommunicationIdentifier(id),\n };\n};\n\n/**\n * @internal\n * Mapping add participants request to add chat participants request REST model\n */\nexport const mapToAddChatParticipantsRequestRestModel = (\n addParticipantsRequest: AddParticipantsRequest,\n): RestModel.AddChatParticipantsRequest => {\n return {\n participants: addParticipantsRequest.participants?.map((participant) =>\n mapToChatParticipantRestModel(participant),\n ),\n };\n};\n\n/**\n * @internal\n * Mapping chat attachment SDK model to chat attachment REST model\n */\nexport const mapToChatAttachmentRestModel = (\n chatAttachment: ChatAttachment,\n): RestModel.ChatAttachment => {\n const { attachmentType, ...rest } = chatAttachment;\n if (attachmentType === \"unknown\") {\n throw new Error(\"'unknown' attachmentType not supported\");\n }\n return {\n ...rest,\n attachmentType: attachmentType,\n };\n};\n\n/**\n * @internal\n * Mapping send message request and options to send chat message request REST model\n */\nexport const mapToSendChatMessageRequestRestModel = (\n sendMessageRequest: SendMessageRequest,\n sendMessageOptions: SendMessageOptions,\n): RestModel.SendChatMessageRequest => {\n const { attachments, ...restOptions } = sendMessageOptions;\n let request: RestModel.SendChatMessageRequest = { ...sendMessageRequest, ...restOptions };\n if (attachments) {\n request = {\n ...request,\n attachments: attachments?.map((attachment) => mapToChatAttachmentRestModel(attachment)),\n };\n }\n return request;\n};\n\n/**\n * @internal\n * Mapping update message options to update chat message request REST model\n */\nexport const mapToUpdateChatMessageRequestRestModel = (\n updateMessageOptions: UpdateMessageOptions,\n): RestModel.UpdateChatMessageRequest => {\n const { attachments, ...restOptions } = updateMessageOptions;\n let request: RestModel.UpdateChatMessageRequest = { ...restOptions };\n if (attachments) {\n request = {\n ...request,\n attachments: attachments?.map((attachment) => mapToChatAttachmentRestModel(attachment)),\n };\n }\n return request;\n};\n\n/**\n * @internal\n * Mapping chat participant REST model to chat participant SDK model\n */\nexport const mapToChatParticipantSdkModel = (\n chatParticipant: RestModel.ChatParticipant,\n): ChatParticipant => {\n const { communicationIdentifier, ...rest } = chatParticipant;\n return {\n ...rest,\n id: deserializeCommunicationIdentifier(\n communicationIdentifier as SerializedCommunicationIdentifier,\n ),\n };\n};\n\n/**\n * @internal\n * Mapping chat attachment REST model to chat attachment SDK model\n */\nexport const mapToChatAttachmentSdkModel = (\n chatAttachment: RestModel.ChatAttachment,\n): ChatAttachment => {\n const { attachmentType, ...rest } = chatAttachment;\n return {\n ...rest,\n attachmentType: attachmentType,\n };\n};\n\n/**\n * @internal\n */\nexport const mapToChatContentSdkModel = (\n content: RestModel.ChatMessageContent,\n): ChatMessageContent => {\n const { participants, attachments, initiatorCommunicationIdentifier, ...otherChatContents } =\n content;\n let result: ChatMessageContent = { ...otherChatContents };\n if (initiatorCommunicationIdentifier) {\n const initiator = deserializeCommunicationIdentifier(\n initiatorCommunicationIdentifier as SerializedCommunicationIdentifier,\n );\n result = { ...result, initiator };\n }\n if (participants) {\n result = {\n ...result,\n participants: participants?.map((participant) => mapToChatParticipantSdkModel(participant)),\n };\n }\n if (attachments) {\n result = {\n ...result,\n attachments: attachments?.map((attachment) => mapToChatAttachmentSdkModel(attachment)),\n };\n }\n return result;\n};\n\n/**\n * @internal\n */\nexport const mapToChatPolicyViolationSdkModel = (\n policyVolation: RestModel.PolicyViolation,\n): PolicyViolation => {\n const { state } = policyVolation;\n const result: PolicyViolation = {\n result: state,\n };\n return result;\n};\n\n/**\n * @internal\n * Mapping chat message REST model to chat message SDK model\n */\nexport const mapToChatMessageSdkModel = (chatMessage: RestModel.ChatMessage): ChatMessage => {\n const { content, senderCommunicationIdentifier, policyViolation, ...otherChatMessage } =\n chatMessage;\n let result: ChatMessage = { ...otherChatMessage };\n if (content) {\n result = {\n ...result,\n content: mapToChatContentSdkModel(content),\n };\n }\n if (senderCommunicationIdentifier) {\n const sender = deserializeCommunicationIdentifier(\n senderCommunicationIdentifier as SerializedCommunicationIdentifier,\n );\n result = { ...result, sender };\n }\n if (policyViolation) {\n result = {\n ...result,\n policyViolation: mapToChatPolicyViolationSdkModel(policyViolation),\n };\n }\n return result;\n};\n\n/**\n * @internal\n * Mapping chat messages collection REST model to chat message SDK model array\n */\nexport const mapToChatMessagesSdkModelArray = (\n chatMessagesCollection: RestModel.ChatMessagesCollection,\n): ChatMessage[] => {\n return chatMessagesCollection.value?.map((chatMessage) => mapToChatMessageSdkModel(chatMessage));\n};\n\n/**\n * @internal\n * Mapping chat retention policy REST model to chat retention policy SDK model\n */\nexport const mapToRetentionPolicySdkModel = (\n retentionPolicy: RestModel.ChatRetentionPolicyUnion,\n): ChatRetentionPolicy => {\n if (retentionPolicy.kind === \"threadCreationDate\") {\n return retentionPolicy as RestModel.ThreadCreationDateRetentionPolicy;\n }\n if (retentionPolicy.kind === \"none\") {\n return retentionPolicy as RestModel.NoneRetentionPolicy;\n } else {\n throw new Error(`Retention Policy ${retentionPolicy.kind} is not supported`);\n }\n};\n\n/**\n * @internal\n * Mapping chat thread REST model to chat thread SDK model\n */\nexport const mapToChatThreadPropertiesSdkModel = (\n chatThread: RestModel.ChatThreadProperties,\n): ChatThreadProperties => {\n const { createdByCommunicationIdentifier, retentionPolicy, ...rest } = chatThread;\n let result: ChatThreadProperties = { ...rest };\n if (createdByCommunicationIdentifier) {\n result = {\n ...result,\n createdBy: deserializeCommunicationIdentifier(\n createdByCommunicationIdentifier as SerializedCommunicationIdentifier,\n ),\n };\n }\n\n if (retentionPolicy) {\n result = {\n ...result,\n retentionPolicy: mapToRetentionPolicySdkModel(retentionPolicy),\n };\n }\n\n return result;\n};\n\n/**\n * @internal\n * Mapping chat thread REST model to chat thread SDK model\n */\nexport const mapToCreateChatThreadResultSdkModel = (\n result: RestModel.CreateChatThreadResult,\n): CreateChatThreadResult => {\n const { chatThread, ...rest } = result;\n if (chatThread) {\n return {\n ...rest,\n chatThread: mapToChatThreadPropertiesSdkModel(chatThread),\n };\n } else {\n return { ...rest };\n }\n};\n\n/**\n * @internal\n * Mapping read receipt REST model to read receipt SDK model\n */\nexport const mapToReadReceiptSdkModel = (\n readReceipt: RestModel.ChatMessageReadReceipt,\n): ChatMessageReadReceipt => {\n const { senderCommunicationIdentifier, ...rest } = readReceipt;\n return {\n ...rest,\n sender: deserializeCommunicationIdentifier(\n senderCommunicationIdentifier as SerializedCommunicationIdentifier,\n ),\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/models/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommunicationIdentifier, CommunicationIdentifierKind } from \"@azure/communication-common\";\nimport { ChatError, ChatMessageType } from \"../generated/src\";\n\nexport {\n AddChatParticipantsResult,\n ChatMessageType,\n ChatThreadItem,\n ChatError,\n SendChatMessageResult,\n} from \"../generated/src/models\";\n\n/** Chat thread. */\nexport interface ChatThreadProperties {\n /** Chat thread id. */\n id: string;\n /** Chat thread topic. */\n topic: string;\n /** The timestamp when the chat thread was created. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n createdOn: Date;\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n readonly createdBy?: CommunicationIdentifierKind;\n /** The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /** metadata */\n metadata?: Record<string, string>;\n /** Data retention policy for auto deletion. */\n retentionPolicy?: ChatRetentionPolicy;\n}\n\n/** Thread retention policy based on thread creation date. */\nexport interface ThreadCreationDateRetentionPolicy {\n /** Polymorphic discriminator, which specifies the different types this object can be */\n kind: \"threadCreationDate\";\n /** Indicates how many days after the thread creation the thread will be deleted. */\n deleteThreadAfterDays: number;\n}\n\n/** No thread retention policy. */\nexport interface NoneRetentionPolicy {\n /** Polymorphic discriminator, which specifies the different types this object can be */\n kind: \"none\";\n}\n\n/** Data retention policy for auto deletion. */\nexport declare type ChatRetentionPolicy = ThreadCreationDateRetentionPolicy | NoneRetentionPolicy;\n\n/** Chat message. */\nexport interface ChatMessage {\n /** The id of the chat message. This id is server generated. */\n id: string;\n /** The chat message type. */\n type: ChatMessageType;\n /** Sequence of the chat message in the conversation. */\n sequenceId: string;\n /** Version of the chat message. */\n version: string;\n /** Content of a chat message. */\n content?: ChatMessageContent;\n /** The display name of the chat message sender. This property is used to populate sender name for push notifications. */\n senderDisplayName?: string;\n /** The timestamp when the chat message arrived at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n createdOn: Date;\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n sender?: CommunicationIdentifierKind;\n /** The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /** The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n editedOn?: Date;\n /** metadata */\n metadata?: Record<string, string>;\n}\n\n/** Content of a chat message. */\nexport interface ChatMessageContent {\n /** Chat message content for messages of types text or html. */\n message?: string;\n /** Chat message content for messages of type topicUpdated. */\n topic?: string;\n /** Chat message content for messages of types participantAdded or participantRemoved. */\n participants?: ChatParticipant[];\n /** List of attachments for this message */\n attachments?: ChatAttachment[];\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n initiator?: CommunicationIdentifierKind;\n}\n\n/** An attachment in a chat message. */\nexport interface ChatAttachment {\n /** Id of the attachment */\n id: string;\n /** The type of attachment. */\n attachmentType: ChatAttachmentType;\n /** The name of the attachment content. */\n name?: string;\n /** The URL where the attachment can be downloaded */\n url?: string;\n /** The URL where the preview of attachment can be downloaded */\n previewUrl?: string;\n}\n\n/** A chat message read receipt indicates the time a chat message was read by a recipient. */\nexport interface ChatMessageReadReceipt {\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n sender: CommunicationIdentifierKind;\n /** Id of the chat message that has been read. This id is generated by the server. */\n chatMessageId: string;\n /** The time at which the message was read. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n readOn: Date;\n}\n\n/** A participant of the chat thread. */\nexport interface ChatParticipant {\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n id: CommunicationIdentifier;\n /** Display name for the chat participant. */\n displayName?: string;\n /** Time from which the chat history is shared with the participant. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n shareHistoryTime?: Date;\n /** metadata */\n metadata?: Record<string, string>;\n}\n\n/** Result of the create chat thread operation. */\nexport interface CreateChatThreadResult {\n /** Chat thread. */\n chatThread?: ChatThreadProperties;\n /**\n * The participants that failed to be added to the chat thread.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly invalidParticipants?: ChatError[];\n}\n\n/**\n * Arguments for retrieving the next page of search results.\n */\nexport interface ListPageSettings {\n /**\n * A token used for retrieving the next page of results when the server\n * enforces pagination.\n */\n continuationToken?: string;\n}\n\n/** Result payload for uploading an image. */\nexport interface UploadChatImageResult {\n /** Id of the image. */\n id: string;\n /** The type of attachment. */\n attachmentType?: ChatAttachmentType;\n /** The name including file extension type of the attachment. */\n name?: string;\n}\n\n/** Type of Supported Attachments. */\nexport type ChatAttachmentType = \"image\" | \"file\" | \"unknown\";\n"]}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/models/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CommunicationIdentifier, CommunicationIdentifierKind } from \"@azure/communication-common\";\nimport { ChatError, ChatMessageType } from \"../generated/src\";\n\nexport {\n AddChatParticipantsResult,\n ChatMessageType,\n ChatThreadItem,\n ChatError,\n SendChatMessageResult,\n} from \"../generated/src/models\";\n\n/** Chat thread. */\nexport interface ChatThreadProperties {\n /** Chat thread id. */\n id: string;\n /** Chat thread topic. */\n topic: string;\n /** The timestamp when the chat thread was created. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n createdOn: Date;\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n readonly createdBy?: CommunicationIdentifierKind;\n /** The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /** metadata */\n metadata?: Record<string, string>;\n /** Data retention policy for auto deletion. */\n retentionPolicy?: ChatRetentionPolicy;\n /** Messaging policy for a chat thread. */\n messagingPolicy?: MessagingPolicy;\n}\n\n/** Thread retention policy based on thread creation date. */\nexport interface ThreadCreationDateRetentionPolicy {\n /** Polymorphic discriminator, which specifies the different types this object can be */\n kind: \"threadCreationDate\";\n /** Indicates how many days after the thread creation the thread will be deleted. */\n deleteThreadAfterDays: number;\n}\n\n/** No thread retention policy. */\nexport interface NoneRetentionPolicy {\n /** Polymorphic discriminator, which specifies the different types this object can be */\n kind: \"none\";\n}\n\n/** Data retention policy for auto deletion. */\nexport declare type ChatRetentionPolicy = ThreadCreationDateRetentionPolicy | NoneRetentionPolicy;\n\n/** Chat message. */\nexport interface ChatMessage {\n /** The id of the chat message. This id is server generated. */\n id: string;\n /** The chat message type. */\n type: ChatMessageType;\n /** Sequence of the chat message in the conversation. */\n sequenceId: string;\n /** Version of the chat message. */\n version: string;\n /** Content of a chat message. */\n content?: ChatMessageContent;\n /** The display name of the chat message sender. This property is used to populate sender name for push notifications. */\n senderDisplayName?: string;\n /** The timestamp when the chat message arrived at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n createdOn: Date;\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n sender?: CommunicationIdentifierKind;\n /** The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /** The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n editedOn?: Date;\n /** metadata */\n metadata?: Record<string, string>;\n /** Policy Violation of a chat message. */\n policyViolation?: PolicyViolation;\n}\n\n/** Content of a chat message. */\nexport interface ChatMessageContent {\n /** Chat message content for messages of types text or html. */\n message?: string;\n /** Chat message content for messages of type topicUpdated. */\n topic?: string;\n /** Chat message content for messages of types participantAdded or participantRemoved. */\n participants?: ChatParticipant[];\n /** List of attachments for this message */\n attachments?: ChatAttachment[];\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n initiator?: CommunicationIdentifierKind;\n}\n\n/** An attachment in a chat message. */\nexport interface ChatAttachment {\n /** Id of the attachment */\n id: string;\n /** The type of attachment. */\n attachmentType: ChatAttachmentType;\n /** The name of the attachment content. */\n name?: string;\n /** The URL where the attachment can be downloaded */\n url?: string;\n /** The URL where the preview of attachment can be downloaded */\n previewUrl?: string;\n}\n\n/** A chat message read receipt indicates the time a chat message was read by a recipient. */\nexport interface ChatMessageReadReceipt {\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n sender: CommunicationIdentifierKind;\n /** Id of the chat message that has been read. This id is generated by the server. */\n chatMessageId: string;\n /** The time at which the message was read. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n readOn: Date;\n}\n\n/** A participant of the chat thread. */\nexport interface ChatParticipant {\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\n id: CommunicationIdentifier;\n /** Display name for the chat participant. */\n displayName?: string;\n /** Time from which the chat history is shared with the participant. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n shareHistoryTime?: Date;\n /** metadata */\n metadata?: Record<string, string>;\n}\n\n/** Result of the create chat thread operation. */\nexport interface CreateChatThreadResult {\n /** Chat thread. */\n chatThread?: ChatThreadProperties;\n /**\n * The participants that failed to be added to the chat thread.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly invalidParticipants?: ChatError[];\n}\n\n/**\n * Arguments for retrieving the next page of search results.\n */\nexport interface ListPageSettings {\n /**\n * A token used for retrieving the next page of results when the server\n * enforces pagination.\n */\n continuationToken?: string;\n}\n\n/** Result payload for uploading an image. */\nexport interface UploadChatImageResult {\n /** Id of the image. */\n id: string;\n /** The type of attachment. */\n attachmentType?: ChatAttachmentType;\n /** The name including file extension type of the attachment. */\n name?: string;\n}\n\n/** Type of Supported Attachments. */\nexport type ChatAttachmentType = \"image\" | \"file\" | \"unknown\";\n\n/** Result of Policy Violation message. */\nexport type PolicyViolationMessageResult = \"contentBlocked\" | \"warning\";\n\n/** Policy violation of a message (if applicable). */\nexport interface PolicyViolation {\n /** Result of Policy Violation message. */\n result: PolicyViolationMessageResult;\n}\n\n/** Messaging policy of a chat thread. */\nexport interface MessagingPolicy {\n /** Boolean to track whether or not messages is restricted to only text. */\n textOnlyChat?: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/communication-chat",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.2",
|
|
4
4
|
"description": "Azure client library for Azure Communication Chat services",
|
|
5
5
|
"sdk-type": "client",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
"build:node": "tsc -p . && dev-tool run bundle",
|
|
13
13
|
"build:samples": "echo Obsolete.",
|
|
14
14
|
"build:test": "tsc -p . && dev-tool run bundle",
|
|
15
|
-
"build": "npm run clean && tsc -p . && dev-tool run bundle &&
|
|
15
|
+
"build": "npm run clean && tsc -p . && dev-tool run bundle && dev-tool run extract-api",
|
|
16
16
|
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
17
17
|
"clean": "rimraf --glob dist dist-* temp types *.tgz *.log",
|
|
18
18
|
"execute:samples": "dev-tool samples run samples-dev",
|
|
19
|
-
"extract-api": "tsc -p . &&
|
|
19
|
+
"extract-api": "tsc -p . && dev-tool run extract-api",
|
|
20
20
|
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
21
21
|
"generate:client": "autorest --typescript ./swagger/README.md && rushx format",
|
|
22
22
|
"integration-test:browser": "dev-tool run test:browser",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@azure/abort-controller": "^1.0.0",
|
|
66
66
|
"@azure/communication-common": "^2.3.1",
|
|
67
|
-
"@azure/communication-signaling": "1.0.0-beta.
|
|
67
|
+
"@azure/communication-signaling": "1.0.0-beta.27",
|
|
68
68
|
"@azure/core-auth": "^1.3.0",
|
|
69
69
|
"@azure/core-client": "^1.3.0",
|
|
70
70
|
"@azure/core-paging": "^1.1.1",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@azure-tools/test-credential": "^1.0.0",
|
|
80
|
-
"@azure-tools/test-recorder": "^3.
|
|
80
|
+
"@azure-tools/test-recorder": "^3.5.1",
|
|
81
81
|
"@azure/communication-identity": "^1.1.0-beta.2",
|
|
82
82
|
"@azure/core-util": "^1.0.0",
|
|
83
83
|
"@azure/dev-tool": "^1.0.0",
|
|
@@ -105,13 +105,12 @@
|
|
|
105
105
|
"karma-mocha-reporter": "^2.2.5",
|
|
106
106
|
"karma-sourcemap-loader": "^0.3.8",
|
|
107
107
|
"mocha": "^10.0.0",
|
|
108
|
-
"
|
|
108
|
+
"nyc": "^15.1.0",
|
|
109
109
|
"rimraf": "^5.0.5",
|
|
110
110
|
"sinon": "^17.0.0",
|
|
111
111
|
"typescript": "~5.4.5",
|
|
112
112
|
"util": "^0.12.1",
|
|
113
|
-
"ts-node": "^10.0.0"
|
|
114
|
-
"esm": "^3.2.18"
|
|
113
|
+
"ts-node": "^10.0.0"
|
|
115
114
|
},
|
|
116
115
|
"//metadata": {
|
|
117
116
|
"constantPaths": [
|
|
@@ -305,6 +305,8 @@ export declare interface ChatMessage {
|
|
|
305
305
|
editedOn?: Date;
|
|
306
306
|
/** metadata */
|
|
307
307
|
metadata?: Record<string, string>;
|
|
308
|
+
/** Policy Violation of a chat message. */
|
|
309
|
+
policyViolation?: PolicyViolation;
|
|
308
310
|
}
|
|
309
311
|
|
|
310
312
|
/** Content of a chat message. */
|
|
@@ -533,6 +535,8 @@ export declare interface ChatThreadProperties {
|
|
|
533
535
|
metadata?: Record<string, string>;
|
|
534
536
|
/** Data retention policy for auto deletion. */
|
|
535
537
|
retentionPolicy?: ChatRetentionPolicy;
|
|
538
|
+
/** Messaging policy for a chat thread. */
|
|
539
|
+
messagingPolicy?: MessagingPolicy;
|
|
536
540
|
}
|
|
537
541
|
|
|
538
542
|
export { ChatThreadPropertiesUpdatedEvent }
|
|
@@ -624,6 +628,12 @@ export declare type ListParticipantsOptions = RestListParticipantsOptions;
|
|
|
624
628
|
*/
|
|
625
629
|
export declare type ListReadReceiptsOptions = RestListReadReceiptsOptions;
|
|
626
630
|
|
|
631
|
+
/** Messaging policy of a chat thread. */
|
|
632
|
+
export declare interface MessagingPolicy {
|
|
633
|
+
/** Boolean to track whether or not messages is restricted to only text. */
|
|
634
|
+
textOnlyChat?: boolean;
|
|
635
|
+
}
|
|
636
|
+
|
|
627
637
|
/** No thread retention policy. */
|
|
628
638
|
export declare interface NoneRetentionPolicy {
|
|
629
639
|
/** Polymorphic discriminator, which specifies the different types this object can be */
|
|
@@ -634,6 +644,15 @@ export { ParticipantsAddedEvent }
|
|
|
634
644
|
|
|
635
645
|
export { ParticipantsRemovedEvent }
|
|
636
646
|
|
|
647
|
+
/** Policy violation of a message (if applicable). */
|
|
648
|
+
export declare interface PolicyViolation {
|
|
649
|
+
/** Result of Policy Violation message. */
|
|
650
|
+
result: PolicyViolationMessageResult;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/** Result of Policy Violation message. */
|
|
654
|
+
export declare type PolicyViolationMessageResult = "contentBlocked" | "warning";
|
|
655
|
+
|
|
637
656
|
export { ReadReceiptReceivedEvent }
|
|
638
657
|
|
|
639
658
|
/**
|