@azure/communication-chat 1.4.0-beta.1 → 1.4.0
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 +51 -109
- package/dist/index.js.map +1 -1
- package/dist-esm/src/chatClient.js +5 -11
- package/dist-esm/src/chatClient.js.map +1 -1
- package/dist-esm/src/chatThreadClient.js +9 -33
- package/dist-esm/src/chatThreadClient.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 +2 -37
- 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/models.js.map +1 -1
- package/dist-esm/src/models/options.js.map +1 -1
- package/package.json +15 -13
- package/types/communication-chat.d.ts +7 -30
package/dist/index.js
CHANGED
|
@@ -12,8 +12,7 @@ var events = require('events');
|
|
|
12
12
|
var uuid = require('uuid');
|
|
13
13
|
var communicationSignaling = require('@azure/communication-signaling');
|
|
14
14
|
|
|
15
|
-
function
|
|
16
|
-
if (e && e.__esModule) return e;
|
|
15
|
+
function _interopNamespaceDefault(e) {
|
|
17
16
|
var n = Object.create(null);
|
|
18
17
|
if (e) {
|
|
19
18
|
Object.keys(e).forEach(function (k) {
|
|
@@ -26,13 +25,14 @@ function _interopNamespace(e) {
|
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
|
-
n
|
|
28
|
+
n.default = e;
|
|
30
29
|
return Object.freeze(n);
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
var coreClient__namespace = /*#__PURE__*/
|
|
32
|
+
var coreClient__namespace = /*#__PURE__*/_interopNamespaceDefault(coreClient);
|
|
34
33
|
|
|
35
34
|
// Copyright (c) Microsoft Corporation.
|
|
35
|
+
// Licensed under the MIT license.
|
|
36
36
|
const mapToCreateChatThreadOptionsRestModel = (options) => {
|
|
37
37
|
const { participants, idempotencyToken } = options, rest = tslib.__rest(options, ["participants", "idempotencyToken"]);
|
|
38
38
|
return Object.assign({ repeatabilityRequestId: idempotencyToken }, rest);
|
|
@@ -139,7 +139,7 @@ const mapToReadReceiptSdkModel = (readReceipt) => {
|
|
|
139
139
|
const tracingClient = coreTracing.createTracingClient({
|
|
140
140
|
namespace: "Azure.Communication",
|
|
141
141
|
packageName: "@azure/communication-chat",
|
|
142
|
-
packageVersion: "1.4.0
|
|
142
|
+
packageVersion: "1.4.0"
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
/*
|
|
@@ -630,13 +630,6 @@ const ChatParticipant = {
|
|
|
630
630
|
type: {
|
|
631
631
|
name: "DateTime"
|
|
632
632
|
}
|
|
633
|
-
},
|
|
634
|
-
metadata: {
|
|
635
|
-
serializedName: "metadata",
|
|
636
|
-
type: {
|
|
637
|
-
name: "Dictionary",
|
|
638
|
-
value: { type: { name: "String" } }
|
|
639
|
-
}
|
|
640
633
|
}
|
|
641
634
|
}
|
|
642
635
|
}
|
|
@@ -654,15 +647,9 @@ const ChatAttachment = {
|
|
|
654
647
|
}
|
|
655
648
|
},
|
|
656
649
|
attachmentType: {
|
|
650
|
+
defaultValue: "image",
|
|
651
|
+
isConstant: true,
|
|
657
652
|
serializedName: "attachmentType",
|
|
658
|
-
required: true,
|
|
659
|
-
type: {
|
|
660
|
-
name: "Enum",
|
|
661
|
-
allowedValues: ["teamsInlineImage", "teamsImage", "file"]
|
|
662
|
-
}
|
|
663
|
-
},
|
|
664
|
-
contentType: {
|
|
665
|
-
serializedName: "contentType",
|
|
666
653
|
type: {
|
|
667
654
|
name: "String"
|
|
668
655
|
}
|
|
@@ -675,7 +662,6 @@ const ChatAttachment = {
|
|
|
675
662
|
},
|
|
676
663
|
url: {
|
|
677
664
|
serializedName: "url",
|
|
678
|
-
required: true,
|
|
679
665
|
type: {
|
|
680
666
|
name: "String"
|
|
681
667
|
}
|
|
@@ -803,13 +789,6 @@ const CreateChatThreadRequest = {
|
|
|
803
789
|
}
|
|
804
790
|
}
|
|
805
791
|
}
|
|
806
|
-
},
|
|
807
|
-
metadata: {
|
|
808
|
-
serializedName: "metadata",
|
|
809
|
-
type: {
|
|
810
|
-
name: "Dictionary",
|
|
811
|
-
value: { type: { name: "String" } }
|
|
812
|
-
}
|
|
813
792
|
}
|
|
814
793
|
}
|
|
815
794
|
}
|
|
@@ -880,13 +859,6 @@ const ChatThreadProperties = {
|
|
|
880
859
|
type: {
|
|
881
860
|
name: "DateTime"
|
|
882
861
|
}
|
|
883
|
-
},
|
|
884
|
-
metadata: {
|
|
885
|
-
serializedName: "metadata",
|
|
886
|
-
type: {
|
|
887
|
-
name: "Dictionary",
|
|
888
|
-
value: { type: { name: "String" } }
|
|
889
|
-
}
|
|
890
862
|
}
|
|
891
863
|
}
|
|
892
864
|
}
|
|
@@ -964,13 +936,6 @@ const UpdateChatThreadRequest = {
|
|
|
964
936
|
type: {
|
|
965
937
|
name: "String"
|
|
966
938
|
}
|
|
967
|
-
},
|
|
968
|
-
metadata: {
|
|
969
|
-
serializedName: "metadata",
|
|
970
|
-
type: {
|
|
971
|
-
name: "Dictionary",
|
|
972
|
-
value: { type: { name: "String" } }
|
|
973
|
-
}
|
|
974
939
|
}
|
|
975
940
|
}
|
|
976
941
|
}
|
|
@@ -992,33 +957,33 @@ const SendTypingNotificationRequest = {
|
|
|
992
957
|
|
|
993
958
|
var Mappers = /*#__PURE__*/Object.freeze({
|
|
994
959
|
__proto__: null,
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
CommunicationUserIdentifierModel: CommunicationUserIdentifierModel,
|
|
999
|
-
PhoneNumberIdentifierModel: PhoneNumberIdentifierModel,
|
|
1000
|
-
MicrosoftTeamsUserIdentifierModel: MicrosoftTeamsUserIdentifierModel,
|
|
1001
|
-
CommunicationErrorResponse: CommunicationErrorResponse,
|
|
960
|
+
AddChatParticipantsRequest: AddChatParticipantsRequest,
|
|
961
|
+
AddChatParticipantsResult: AddChatParticipantsResult,
|
|
962
|
+
ChatAttachment: ChatAttachment,
|
|
1002
963
|
ChatError: ChatError,
|
|
1003
|
-
SendReadReceiptRequest: SendReadReceiptRequest,
|
|
1004
|
-
SendChatMessageRequest: SendChatMessageRequest,
|
|
1005
|
-
SendChatMessageResult: SendChatMessageResult,
|
|
1006
|
-
ChatMessagesCollection: ChatMessagesCollection,
|
|
1007
964
|
ChatMessage: ChatMessage,
|
|
1008
965
|
ChatMessageContent: ChatMessageContent,
|
|
966
|
+
ChatMessageReadReceipt: ChatMessageReadReceipt,
|
|
967
|
+
ChatMessageReadReceiptsCollection: ChatMessageReadReceiptsCollection,
|
|
968
|
+
ChatMessagesCollection: ChatMessagesCollection,
|
|
1009
969
|
ChatParticipant: ChatParticipant,
|
|
1010
|
-
ChatAttachment: ChatAttachment,
|
|
1011
|
-
UpdateChatMessageRequest: UpdateChatMessageRequest,
|
|
1012
970
|
ChatParticipantsCollection: ChatParticipantsCollection,
|
|
1013
|
-
|
|
1014
|
-
AddChatParticipantsResult: AddChatParticipantsResult,
|
|
1015
|
-
CreateChatThreadRequest: CreateChatThreadRequest,
|
|
1016
|
-
CreateChatThreadResult: CreateChatThreadResult,
|
|
971
|
+
ChatThreadItem: ChatThreadItem,
|
|
1017
972
|
ChatThreadProperties: ChatThreadProperties,
|
|
1018
973
|
ChatThreadsItemCollection: ChatThreadsItemCollection,
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
974
|
+
CommunicationErrorResponse: CommunicationErrorResponse,
|
|
975
|
+
CommunicationIdentifierModel: CommunicationIdentifierModel,
|
|
976
|
+
CommunicationUserIdentifierModel: CommunicationUserIdentifierModel,
|
|
977
|
+
CreateChatThreadRequest: CreateChatThreadRequest,
|
|
978
|
+
CreateChatThreadResult: CreateChatThreadResult,
|
|
979
|
+
MicrosoftTeamsUserIdentifierModel: MicrosoftTeamsUserIdentifierModel,
|
|
980
|
+
PhoneNumberIdentifierModel: PhoneNumberIdentifierModel,
|
|
981
|
+
SendChatMessageRequest: SendChatMessageRequest,
|
|
982
|
+
SendChatMessageResult: SendChatMessageResult,
|
|
983
|
+
SendReadReceiptRequest: SendReadReceiptRequest,
|
|
984
|
+
SendTypingNotificationRequest: SendTypingNotificationRequest,
|
|
985
|
+
UpdateChatMessageRequest: UpdateChatMessageRequest,
|
|
986
|
+
UpdateChatThreadRequest: UpdateChatThreadRequest
|
|
1022
987
|
});
|
|
1023
988
|
|
|
1024
989
|
/*
|
|
@@ -1081,7 +1046,7 @@ const skip = {
|
|
|
1081
1046
|
const apiVersion = {
|
|
1082
1047
|
parameterPath: "apiVersion",
|
|
1083
1048
|
mapper: {
|
|
1084
|
-
defaultValue: "2023-07
|
|
1049
|
+
defaultValue: "2023-11-07",
|
|
1085
1050
|
isConstant: true,
|
|
1086
1051
|
serializedName: "api-version",
|
|
1087
1052
|
type: {
|
|
@@ -2081,7 +2046,7 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
|
|
|
2081
2046
|
const defaults = {
|
|
2082
2047
|
requestContentType: "application/json; charset=utf-8"
|
|
2083
2048
|
};
|
|
2084
|
-
const packageDetails = `azsdk-js-communication-chat/1.4.0
|
|
2049
|
+
const packageDetails = `azsdk-js-communication-chat/1.4.0`;
|
|
2085
2050
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
2086
2051
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
2087
2052
|
: `${packageDetails}`;
|
|
@@ -2092,7 +2057,7 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
|
|
|
2092
2057
|
// Parameter assignments
|
|
2093
2058
|
this.endpoint = endpoint;
|
|
2094
2059
|
// Assigning values to Constant parameters
|
|
2095
|
-
this.apiVersion = options.apiVersion || "2023-07
|
|
2060
|
+
this.apiVersion = options.apiVersion || "2023-11-07";
|
|
2096
2061
|
this.chatThread = new ChatThreadImpl(this);
|
|
2097
2062
|
this.chat = new ChatImpl(this);
|
|
2098
2063
|
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
@@ -2125,9 +2090,11 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
|
|
|
2125
2090
|
}
|
|
2126
2091
|
|
|
2127
2092
|
// Copyright (c) Microsoft Corporation.
|
|
2093
|
+
// Licensed under the MIT license.
|
|
2128
2094
|
const logger = logger$1.createClientLogger("communication-chat");
|
|
2129
2095
|
|
|
2130
2096
|
// Copyright (c) Microsoft Corporation.
|
|
2097
|
+
// Licensed under the MIT license.
|
|
2131
2098
|
/**
|
|
2132
2099
|
* Creates a new CommunicationTokenCredentialPolicy factory.
|
|
2133
2100
|
*
|
|
@@ -2144,6 +2111,7 @@ const createCommunicationTokenCredentialPolicy = (credential) => {
|
|
|
2144
2111
|
};
|
|
2145
2112
|
|
|
2146
2113
|
// Copyright (c) Microsoft Corporation.
|
|
2114
|
+
// Licensed under the MIT license.
|
|
2147
2115
|
const minimumTypingIntervalInMilliSeconds = 8000;
|
|
2148
2116
|
/**
|
|
2149
2117
|
* The client to do chat operations
|
|
@@ -2184,15 +2152,6 @@ class ChatThreadClient {
|
|
|
2184
2152
|
await this.client.chatThread.updateChatThreadProperties(this.threadId, { topic: topic }, updatedOptions);
|
|
2185
2153
|
});
|
|
2186
2154
|
}
|
|
2187
|
-
/**
|
|
2188
|
-
* Updates a thread's properties.
|
|
2189
|
-
* @param options - Operation options.
|
|
2190
|
-
*/
|
|
2191
|
-
updateProperties(options = {}) {
|
|
2192
|
-
return tracingClient.withSpan("ChatThreadClient-UpdateProperties", options, async (updatedOptions) => {
|
|
2193
|
-
await this.client.chatThread.updateChatThreadProperties(this.threadId, options, updatedOptions);
|
|
2194
|
-
});
|
|
2195
|
-
}
|
|
2196
2155
|
/**
|
|
2197
2156
|
* Sends a chat message to a thread identified by threadId.
|
|
2198
2157
|
* Returns the id of the created message.
|
|
@@ -2244,16 +2203,11 @@ class ChatThreadClient {
|
|
|
2244
2203
|
return tslib.__asyncGenerator(this, arguments, function* listMessagesAll_1() {
|
|
2245
2204
|
var _a, e_1, _b, _c;
|
|
2246
2205
|
try {
|
|
2247
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listMessagesPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
2206
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listMessagesPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
2248
2207
|
_c = _f.value;
|
|
2249
2208
|
_d = false;
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
2253
|
-
}
|
|
2254
|
-
finally {
|
|
2255
|
-
_d = true;
|
|
2256
|
-
}
|
|
2209
|
+
const page = _c;
|
|
2210
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
2257
2211
|
}
|
|
2258
2212
|
}
|
|
2259
2213
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -2353,16 +2307,11 @@ class ChatThreadClient {
|
|
|
2353
2307
|
return tslib.__asyncGenerator(this, arguments, function* listParticipantsAll_1() {
|
|
2354
2308
|
var _a, e_2, _b, _c;
|
|
2355
2309
|
try {
|
|
2356
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listParticipantsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
2310
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listParticipantsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
2357
2311
|
_c = _f.value;
|
|
2358
2312
|
_d = false;
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
2362
|
-
}
|
|
2363
|
-
finally {
|
|
2364
|
-
_d = true;
|
|
2365
|
-
}
|
|
2313
|
+
const page = _c;
|
|
2314
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
2366
2315
|
}
|
|
2367
2316
|
}
|
|
2368
2317
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -2470,16 +2419,11 @@ class ChatThreadClient {
|
|
|
2470
2419
|
return tslib.__asyncGenerator(this, arguments, function* listReadReceiptsAll_1() {
|
|
2471
2420
|
var _a, e_3, _b, _c;
|
|
2472
2421
|
try {
|
|
2473
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listReadReceiptsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
2422
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listReadReceiptsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
2474
2423
|
_c = _f.value;
|
|
2475
2424
|
_d = false;
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
2479
|
-
}
|
|
2480
|
-
finally {
|
|
2481
|
-
_d = true;
|
|
2482
|
-
}
|
|
2425
|
+
const page = _c;
|
|
2426
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
2483
2427
|
}
|
|
2484
2428
|
}
|
|
2485
2429
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -2536,6 +2480,7 @@ class ChatThreadClient {
|
|
|
2536
2480
|
}
|
|
2537
2481
|
|
|
2538
2482
|
// Copyright (c) Microsoft Corporation.
|
|
2483
|
+
// Licensed under the MIT license.
|
|
2539
2484
|
/**
|
|
2540
2485
|
* Generated Universally Unique Identifier
|
|
2541
2486
|
*
|
|
@@ -2547,6 +2492,7 @@ function generateUuid() {
|
|
|
2547
2492
|
}
|
|
2548
2493
|
|
|
2549
2494
|
// Copyright (c) Microsoft Corporation.
|
|
2495
|
+
// Licensed under the MIT license.
|
|
2550
2496
|
const getSignalingClient = (credential, logger, options) => {
|
|
2551
2497
|
var _a, _b;
|
|
2552
2498
|
if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
@@ -2561,6 +2507,8 @@ const getSignalingClient = (credential, logger, options) => {
|
|
|
2561
2507
|
};
|
|
2562
2508
|
|
|
2563
2509
|
// Copyright (c) Microsoft Corporation.
|
|
2510
|
+
// Licensed under the MIT license.
|
|
2511
|
+
/// <reference lib="esnext.asynciterable" />
|
|
2564
2512
|
/**
|
|
2565
2513
|
* The client to do chat operations
|
|
2566
2514
|
*/
|
|
@@ -2579,6 +2527,7 @@ class ChatClient {
|
|
|
2579
2527
|
this.isRealtimeNotificationsStarted = false;
|
|
2580
2528
|
this.tokenCredential = credential;
|
|
2581
2529
|
this.clientOptions = Object.assign({}, options);
|
|
2530
|
+
this.clientOptions.signalingClientOptions = Object.assign(Object.assign({}, this.clientOptions.signalingClientOptions), { resourceEndpoint: this.endpoint });
|
|
2582
2531
|
const internalPipelineOptions = Object.assign(Object.assign({}, options), {
|
|
2583
2532
|
loggingOptions: {
|
|
2584
2533
|
logger: logger.info,
|
|
@@ -2587,8 +2536,7 @@ class ChatClient {
|
|
|
2587
2536
|
this.client = new ChatApiClient(this.endpoint, Object.assign({ endpoint: this.endpoint }, internalPipelineOptions));
|
|
2588
2537
|
const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
|
|
2589
2538
|
this.client.pipeline.addPolicy(authPolicy);
|
|
2590
|
-
|
|
2591
|
-
this.signalingClient = getSignalingClient(credential, logger, options.signalingClientOptions);
|
|
2539
|
+
this.signalingClient = getSignalingClient(credential, logger, this.clientOptions.signalingClientOptions);
|
|
2592
2540
|
}
|
|
2593
2541
|
/**
|
|
2594
2542
|
* Returns ChatThreadClient with the specific thread id.
|
|
@@ -2612,7 +2560,6 @@ class ChatClient {
|
|
|
2612
2560
|
const result = await this.client.chat.createChatThread({
|
|
2613
2561
|
topic: request.topic,
|
|
2614
2562
|
participants: (_b = options.participants) === null || _b === void 0 ? void 0 : _b.map((participant) => mapToChatParticipantRestModel(participant)),
|
|
2615
|
-
metadata: options.metadata,
|
|
2616
2563
|
}, updatedRestModelOptions);
|
|
2617
2564
|
return mapToCreateChatThreadResultSdkModel(result);
|
|
2618
2565
|
});
|
|
@@ -2642,16 +2589,11 @@ class ChatClient {
|
|
|
2642
2589
|
return tslib.__asyncGenerator(this, arguments, function* listChatThreadsAll_1() {
|
|
2643
2590
|
var _a, e_1, _b, _c;
|
|
2644
2591
|
try {
|
|
2645
|
-
for (var _d = true, _e = tslib.__asyncValues(this.listChatThreadsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
2592
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listChatThreadsPage({}, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
2646
2593
|
_c = _f.value;
|
|
2647
2594
|
_d = false;
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
2651
|
-
}
|
|
2652
|
-
finally {
|
|
2653
|
-
_d = true;
|
|
2654
|
-
}
|
|
2595
|
+
const page = _c;
|
|
2596
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
|
|
2655
2597
|
}
|
|
2656
2598
|
}
|
|
2657
2599
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|