@azure/communication-chat 1.3.2 → 1.4.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 +143 -51
- package/dist/index.js.map +1 -1
- package/dist-esm/src/chatClient.js +2 -0
- package/dist-esm/src/chatClient.js.map +1 -1
- package/dist-esm/src/chatThreadClient.js +9 -0
- package/dist-esm/src/chatThreadClient.js.map +1 -1
- package/dist-esm/src/generated/src/chatApiClient.js +3 -3
- package/dist-esm/src/generated/src/chatApiClient.js.map +1 -1
- package/dist-esm/src/generated/src/models/index.js +12 -0
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +94 -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/operations/chat.js +0 -5
- package/dist-esm/src/generated/src/operations/chat.js.map +1 -1
- package/dist-esm/src/generated/src/operations/chatThread.js +0 -15
- package/dist-esm/src/generated/src/operations/chatThread.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/models.js.map +1 -1
- package/dist-esm/src/models/options.js.map +1 -1
- package/dist-esm/src/signaling/signalingClient.browser.js +2 -1
- package/dist-esm/src/signaling/signalingClient.browser.js.map +1 -1
- package/dist-esm/src/signaling/signalingClient.js +2 -1
- package/dist-esm/src/signaling/signalingClient.js.map +1 -1
- package/package.json +8 -7
- package/types/communication-chat.d.ts +42 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var tslib = require('tslib');
|
|
6
4
|
var communicationCommon = require('@azure/communication-common');
|
|
7
5
|
var logger$1 = require('@azure/logger');
|
|
@@ -12,8 +10,7 @@ var events = require('events');
|
|
|
12
10
|
var uuid = require('uuid');
|
|
13
11
|
var communicationSignaling = require('@azure/communication-signaling');
|
|
14
12
|
|
|
15
|
-
function
|
|
16
|
-
if (e && e.__esModule) return e;
|
|
13
|
+
function _interopNamespaceDefault(e) {
|
|
17
14
|
var n = Object.create(null);
|
|
18
15
|
if (e) {
|
|
19
16
|
Object.keys(e).forEach(function (k) {
|
|
@@ -26,13 +23,14 @@ function _interopNamespace(e) {
|
|
|
26
23
|
}
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
|
-
n
|
|
26
|
+
n.default = e;
|
|
30
27
|
return Object.freeze(n);
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
var coreClient__namespace = /*#__PURE__*/
|
|
30
|
+
var coreClient__namespace = /*#__PURE__*/_interopNamespaceDefault(coreClient);
|
|
34
31
|
|
|
35
32
|
// Copyright (c) Microsoft Corporation.
|
|
33
|
+
// Licensed under the MIT license.
|
|
36
34
|
const mapToCreateChatThreadOptionsRestModel = (options) => {
|
|
37
35
|
const { participants, idempotencyToken } = options, rest = tslib.__rest(options, ["participants", "idempotencyToken"]);
|
|
38
36
|
return Object.assign({ repeatabilityRequestId: idempotencyToken }, rest);
|
|
@@ -139,7 +137,7 @@ const mapToReadReceiptSdkModel = (readReceipt) => {
|
|
|
139
137
|
const tracingClient = coreTracing.createTracingClient({
|
|
140
138
|
namespace: "Azure.Communication",
|
|
141
139
|
packageName: "@azure/communication-chat",
|
|
142
|
-
packageVersion: "1.
|
|
140
|
+
packageVersion: "1.4.0-beta.1"
|
|
143
141
|
});
|
|
144
142
|
|
|
145
143
|
/*
|
|
@@ -211,6 +209,12 @@ const CommunicationIdentifierModel = {
|
|
|
211
209
|
name: "Composite",
|
|
212
210
|
className: "CommunicationIdentifierModel",
|
|
213
211
|
modelProperties: {
|
|
212
|
+
kind: {
|
|
213
|
+
serializedName: "kind",
|
|
214
|
+
type: {
|
|
215
|
+
name: "String"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
214
218
|
rawId: {
|
|
215
219
|
serializedName: "rawId",
|
|
216
220
|
type: {
|
|
@@ -579,6 +583,18 @@ const ChatMessageContent = {
|
|
|
579
583
|
}
|
|
580
584
|
}
|
|
581
585
|
},
|
|
586
|
+
attachments: {
|
|
587
|
+
serializedName: "attachments",
|
|
588
|
+
type: {
|
|
589
|
+
name: "Sequence",
|
|
590
|
+
element: {
|
|
591
|
+
type: {
|
|
592
|
+
name: "Composite",
|
|
593
|
+
className: "ChatAttachment"
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
},
|
|
582
598
|
initiatorCommunicationIdentifier: {
|
|
583
599
|
serializedName: "initiatorCommunicationIdentifier",
|
|
584
600
|
type: {
|
|
@@ -612,6 +628,61 @@ const ChatParticipant = {
|
|
|
612
628
|
type: {
|
|
613
629
|
name: "DateTime"
|
|
614
630
|
}
|
|
631
|
+
},
|
|
632
|
+
metadata: {
|
|
633
|
+
serializedName: "metadata",
|
|
634
|
+
type: {
|
|
635
|
+
name: "Dictionary",
|
|
636
|
+
value: { type: { name: "String" } }
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
const ChatAttachment = {
|
|
643
|
+
type: {
|
|
644
|
+
name: "Composite",
|
|
645
|
+
className: "ChatAttachment",
|
|
646
|
+
modelProperties: {
|
|
647
|
+
id: {
|
|
648
|
+
serializedName: "id",
|
|
649
|
+
required: true,
|
|
650
|
+
type: {
|
|
651
|
+
name: "String"
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
attachmentType: {
|
|
655
|
+
serializedName: "attachmentType",
|
|
656
|
+
required: true,
|
|
657
|
+
type: {
|
|
658
|
+
name: "Enum",
|
|
659
|
+
allowedValues: ["teamsInlineImage", "teamsImage", "file"]
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
contentType: {
|
|
663
|
+
serializedName: "contentType",
|
|
664
|
+
type: {
|
|
665
|
+
name: "String"
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
name: {
|
|
669
|
+
serializedName: "name",
|
|
670
|
+
type: {
|
|
671
|
+
name: "String"
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
url: {
|
|
675
|
+
serializedName: "url",
|
|
676
|
+
required: true,
|
|
677
|
+
type: {
|
|
678
|
+
name: "String"
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
previewUrl: {
|
|
682
|
+
serializedName: "previewUrl",
|
|
683
|
+
type: {
|
|
684
|
+
name: "String"
|
|
685
|
+
}
|
|
615
686
|
}
|
|
616
687
|
}
|
|
617
688
|
}
|
|
@@ -730,6 +801,13 @@ const CreateChatThreadRequest = {
|
|
|
730
801
|
}
|
|
731
802
|
}
|
|
732
803
|
}
|
|
804
|
+
},
|
|
805
|
+
metadata: {
|
|
806
|
+
serializedName: "metadata",
|
|
807
|
+
type: {
|
|
808
|
+
name: "Dictionary",
|
|
809
|
+
value: { type: { name: "String" } }
|
|
810
|
+
}
|
|
733
811
|
}
|
|
734
812
|
}
|
|
735
813
|
}
|
|
@@ -800,6 +878,13 @@ const ChatThreadProperties = {
|
|
|
800
878
|
type: {
|
|
801
879
|
name: "DateTime"
|
|
802
880
|
}
|
|
881
|
+
},
|
|
882
|
+
metadata: {
|
|
883
|
+
serializedName: "metadata",
|
|
884
|
+
type: {
|
|
885
|
+
name: "Dictionary",
|
|
886
|
+
value: { type: { name: "String" } }
|
|
887
|
+
}
|
|
803
888
|
}
|
|
804
889
|
}
|
|
805
890
|
}
|
|
@@ -877,6 +962,13 @@ const UpdateChatThreadRequest = {
|
|
|
877
962
|
type: {
|
|
878
963
|
name: "String"
|
|
879
964
|
}
|
|
965
|
+
},
|
|
966
|
+
metadata: {
|
|
967
|
+
serializedName: "metadata",
|
|
968
|
+
type: {
|
|
969
|
+
name: "Dictionary",
|
|
970
|
+
value: { type: { name: "String" } }
|
|
971
|
+
}
|
|
880
972
|
}
|
|
881
973
|
}
|
|
882
974
|
}
|
|
@@ -898,32 +990,33 @@ const SendTypingNotificationRequest = {
|
|
|
898
990
|
|
|
899
991
|
var Mappers = /*#__PURE__*/Object.freeze({
|
|
900
992
|
__proto__: null,
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
CommunicationUserIdentifierModel: CommunicationUserIdentifierModel,
|
|
905
|
-
PhoneNumberIdentifierModel: PhoneNumberIdentifierModel,
|
|
906
|
-
MicrosoftTeamsUserIdentifierModel: MicrosoftTeamsUserIdentifierModel,
|
|
907
|
-
CommunicationErrorResponse: CommunicationErrorResponse,
|
|
993
|
+
AddChatParticipantsRequest: AddChatParticipantsRequest,
|
|
994
|
+
AddChatParticipantsResult: AddChatParticipantsResult,
|
|
995
|
+
ChatAttachment: ChatAttachment,
|
|
908
996
|
ChatError: ChatError,
|
|
909
|
-
SendReadReceiptRequest: SendReadReceiptRequest,
|
|
910
|
-
SendChatMessageRequest: SendChatMessageRequest,
|
|
911
|
-
SendChatMessageResult: SendChatMessageResult,
|
|
912
|
-
ChatMessagesCollection: ChatMessagesCollection,
|
|
913
997
|
ChatMessage: ChatMessage,
|
|
914
998
|
ChatMessageContent: ChatMessageContent,
|
|
999
|
+
ChatMessageReadReceipt: ChatMessageReadReceipt,
|
|
1000
|
+
ChatMessageReadReceiptsCollection: ChatMessageReadReceiptsCollection,
|
|
1001
|
+
ChatMessagesCollection: ChatMessagesCollection,
|
|
915
1002
|
ChatParticipant: ChatParticipant,
|
|
916
|
-
UpdateChatMessageRequest: UpdateChatMessageRequest,
|
|
917
1003
|
ChatParticipantsCollection: ChatParticipantsCollection,
|
|
918
|
-
|
|
919
|
-
AddChatParticipantsResult: AddChatParticipantsResult,
|
|
920
|
-
CreateChatThreadRequest: CreateChatThreadRequest,
|
|
921
|
-
CreateChatThreadResult: CreateChatThreadResult,
|
|
1004
|
+
ChatThreadItem: ChatThreadItem,
|
|
922
1005
|
ChatThreadProperties: ChatThreadProperties,
|
|
923
1006
|
ChatThreadsItemCollection: ChatThreadsItemCollection,
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1007
|
+
CommunicationErrorResponse: CommunicationErrorResponse,
|
|
1008
|
+
CommunicationIdentifierModel: CommunicationIdentifierModel,
|
|
1009
|
+
CommunicationUserIdentifierModel: CommunicationUserIdentifierModel,
|
|
1010
|
+
CreateChatThreadRequest: CreateChatThreadRequest,
|
|
1011
|
+
CreateChatThreadResult: CreateChatThreadResult,
|
|
1012
|
+
MicrosoftTeamsUserIdentifierModel: MicrosoftTeamsUserIdentifierModel,
|
|
1013
|
+
PhoneNumberIdentifierModel: PhoneNumberIdentifierModel,
|
|
1014
|
+
SendChatMessageRequest: SendChatMessageRequest,
|
|
1015
|
+
SendChatMessageResult: SendChatMessageResult,
|
|
1016
|
+
SendReadReceiptRequest: SendReadReceiptRequest,
|
|
1017
|
+
SendTypingNotificationRequest: SendTypingNotificationRequest,
|
|
1018
|
+
UpdateChatMessageRequest: UpdateChatMessageRequest,
|
|
1019
|
+
UpdateChatThreadRequest: UpdateChatThreadRequest
|
|
927
1020
|
});
|
|
928
1021
|
|
|
929
1022
|
/*
|
|
@@ -986,7 +1079,7 @@ const skip = {
|
|
|
986
1079
|
const apiVersion = {
|
|
987
1080
|
parameterPath: "apiVersion",
|
|
988
1081
|
mapper: {
|
|
989
|
-
defaultValue: "
|
|
1082
|
+
defaultValue: "2023-07-01-preview",
|
|
990
1083
|
isConstant: true,
|
|
991
1084
|
serializedName: "api-version",
|
|
992
1085
|
type: {
|
|
@@ -1706,11 +1799,6 @@ const listChatReadReceiptsNextOperationSpec = {
|
|
|
1706
1799
|
isError: true
|
|
1707
1800
|
}
|
|
1708
1801
|
},
|
|
1709
|
-
queryParameters: [
|
|
1710
|
-
maxPageSize,
|
|
1711
|
-
skip,
|
|
1712
|
-
apiVersion
|
|
1713
|
-
],
|
|
1714
1802
|
urlParameters: [
|
|
1715
1803
|
endpoint,
|
|
1716
1804
|
chatThreadId,
|
|
@@ -1743,11 +1831,6 @@ const listChatMessagesNextOperationSpec = {
|
|
|
1743
1831
|
isError: true
|
|
1744
1832
|
}
|
|
1745
1833
|
},
|
|
1746
|
-
queryParameters: [
|
|
1747
|
-
maxPageSize,
|
|
1748
|
-
apiVersion,
|
|
1749
|
-
startTime
|
|
1750
|
-
],
|
|
1751
1834
|
urlParameters: [
|
|
1752
1835
|
endpoint,
|
|
1753
1836
|
chatThreadId,
|
|
@@ -1780,11 +1863,6 @@ const listChatParticipantsNextOperationSpec = {
|
|
|
1780
1863
|
isError: true
|
|
1781
1864
|
}
|
|
1782
1865
|
},
|
|
1783
|
-
queryParameters: [
|
|
1784
|
-
maxPageSize,
|
|
1785
|
-
skip,
|
|
1786
|
-
apiVersion
|
|
1787
|
-
],
|
|
1788
1866
|
urlParameters: [
|
|
1789
1867
|
endpoint,
|
|
1790
1868
|
chatThreadId,
|
|
@@ -1971,11 +2049,6 @@ const listChatThreadsNextOperationSpec = {
|
|
|
1971
2049
|
isError: true
|
|
1972
2050
|
}
|
|
1973
2051
|
},
|
|
1974
|
-
queryParameters: [
|
|
1975
|
-
maxPageSize,
|
|
1976
|
-
apiVersion,
|
|
1977
|
-
startTime
|
|
1978
|
-
],
|
|
1979
2052
|
urlParameters: [endpoint, nextLink],
|
|
1980
2053
|
headerParameters: [accept],
|
|
1981
2054
|
serializer
|
|
@@ -2006,18 +2079,18 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
|
|
|
2006
2079
|
const defaults = {
|
|
2007
2080
|
requestContentType: "application/json; charset=utf-8"
|
|
2008
2081
|
};
|
|
2009
|
-
const packageDetails = `azsdk-js-communication-chat/1.
|
|
2082
|
+
const packageDetails = `azsdk-js-communication-chat/1.4.0-beta.1`;
|
|
2010
2083
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
2011
2084
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
2012
2085
|
: `${packageDetails}`;
|
|
2013
2086
|
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
|
2014
2087
|
userAgentPrefix
|
|
2015
|
-
},
|
|
2088
|
+
}, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
|
|
2016
2089
|
super(optionsWithDefaults);
|
|
2017
2090
|
// Parameter assignments
|
|
2018
2091
|
this.endpoint = endpoint;
|
|
2019
2092
|
// Assigning values to Constant parameters
|
|
2020
|
-
this.apiVersion = options.apiVersion || "
|
|
2093
|
+
this.apiVersion = options.apiVersion || "2023-07-01-preview";
|
|
2021
2094
|
this.chatThread = new ChatThreadImpl(this);
|
|
2022
2095
|
this.chat = new ChatImpl(this);
|
|
2023
2096
|
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
@@ -2050,9 +2123,11 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
|
|
|
2050
2123
|
}
|
|
2051
2124
|
|
|
2052
2125
|
// Copyright (c) Microsoft Corporation.
|
|
2126
|
+
// Licensed under the MIT license.
|
|
2053
2127
|
const logger = logger$1.createClientLogger("communication-chat");
|
|
2054
2128
|
|
|
2055
2129
|
// Copyright (c) Microsoft Corporation.
|
|
2130
|
+
// Licensed under the MIT license.
|
|
2056
2131
|
/**
|
|
2057
2132
|
* Creates a new CommunicationTokenCredentialPolicy factory.
|
|
2058
2133
|
*
|
|
@@ -2069,6 +2144,7 @@ const createCommunicationTokenCredentialPolicy = (credential) => {
|
|
|
2069
2144
|
};
|
|
2070
2145
|
|
|
2071
2146
|
// Copyright (c) Microsoft Corporation.
|
|
2147
|
+
// Licensed under the MIT license.
|
|
2072
2148
|
const minimumTypingIntervalInMilliSeconds = 8000;
|
|
2073
2149
|
/**
|
|
2074
2150
|
* The client to do chat operations
|
|
@@ -2109,6 +2185,15 @@ class ChatThreadClient {
|
|
|
2109
2185
|
await this.client.chatThread.updateChatThreadProperties(this.threadId, { topic: topic }, updatedOptions);
|
|
2110
2186
|
});
|
|
2111
2187
|
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Updates a thread's properties.
|
|
2190
|
+
* @param options - Operation options.
|
|
2191
|
+
*/
|
|
2192
|
+
updateProperties(options = {}) {
|
|
2193
|
+
return tracingClient.withSpan("ChatThreadClient-UpdateProperties", options, async (updatedOptions) => {
|
|
2194
|
+
await this.client.chatThread.updateChatThreadProperties(this.threadId, options, updatedOptions);
|
|
2195
|
+
});
|
|
2196
|
+
}
|
|
2112
2197
|
/**
|
|
2113
2198
|
* Sends a chat message to a thread identified by threadId.
|
|
2114
2199
|
* Returns the id of the created message.
|
|
@@ -2452,6 +2537,7 @@ class ChatThreadClient {
|
|
|
2452
2537
|
}
|
|
2453
2538
|
|
|
2454
2539
|
// Copyright (c) Microsoft Corporation.
|
|
2540
|
+
// Licensed under the MIT license.
|
|
2455
2541
|
/**
|
|
2456
2542
|
* Generated Universally Unique Identifier
|
|
2457
2543
|
*
|
|
@@ -2463,12 +2549,14 @@ function generateUuid() {
|
|
|
2463
2549
|
}
|
|
2464
2550
|
|
|
2465
2551
|
// Copyright (c) Microsoft Corporation.
|
|
2552
|
+
// Licensed under the MIT license.
|
|
2466
2553
|
const getSignalingClient = (credential, logger, options) => {
|
|
2467
|
-
var _a;
|
|
2554
|
+
var _a, _b;
|
|
2468
2555
|
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
2469
2556
|
// In React Native
|
|
2470
2557
|
return new communicationSignaling.CommunicationSignalingClient(credential, logger, {
|
|
2471
2558
|
environment: (_a = options === null || options === void 0 ? void 0 : options.environment) !== null && _a !== void 0 ? _a : undefined,
|
|
2559
|
+
resourceEndpoint: (_b = options === null || options === void 0 ? void 0 : options.resourceEndpoint) !== null && _b !== void 0 ? _b : undefined,
|
|
2472
2560
|
});
|
|
2473
2561
|
}
|
|
2474
2562
|
// In node js
|
|
@@ -2476,6 +2564,8 @@ const getSignalingClient = (credential, logger, options) => {
|
|
|
2476
2564
|
};
|
|
2477
2565
|
|
|
2478
2566
|
// Copyright (c) Microsoft Corporation.
|
|
2567
|
+
// Licensed under the MIT license.
|
|
2568
|
+
/// <reference lib="esnext.asynciterable" />
|
|
2479
2569
|
/**
|
|
2480
2570
|
* The client to do chat operations
|
|
2481
2571
|
*/
|
|
@@ -2502,6 +2592,7 @@ class ChatClient {
|
|
|
2502
2592
|
this.client = new ChatApiClient(this.endpoint, Object.assign({ endpoint: this.endpoint }, internalPipelineOptions));
|
|
2503
2593
|
const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
|
|
2504
2594
|
this.client.pipeline.addPolicy(authPolicy);
|
|
2595
|
+
options.signalingClientOptions = Object.assign(Object.assign({}, options.signalingClientOptions), { resourceEndpoint: this.endpoint });
|
|
2505
2596
|
this.signalingClient = getSignalingClient(credential, logger, options.signalingClientOptions);
|
|
2506
2597
|
}
|
|
2507
2598
|
/**
|
|
@@ -2526,6 +2617,7 @@ class ChatClient {
|
|
|
2526
2617
|
const result = await this.client.chat.createChatThread({
|
|
2527
2618
|
topic: request.topic,
|
|
2528
2619
|
participants: (_b = options.participants) === null || _b === void 0 ? void 0 : _b.map((participant) => mapToChatParticipantRestModel(participant)),
|
|
2620
|
+
metadata: options.metadata,
|
|
2529
2621
|
}, updatedRestModelOptions);
|
|
2530
2622
|
return mapToCreateChatThreadResultSdkModel(result);
|
|
2531
2623
|
});
|