@azure/communication-chat 1.5.0-beta.2 → 1.6.0-alpha.20240502.4
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 +46 -55
- package/dist/index.js.map +1 -1
- package/dist-esm/src/chatClient.js +7 -7
- package/dist-esm/src/chatClient.js.map +1 -1
- package/dist-esm/src/chatThreadClient.js +6 -15
- 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 +2 -0
- package/dist-esm/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/src/generated/src/models/mappers.js +28 -28
- 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 +10 -11
- package/types/communication-chat.d.ts +3 -24
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
+
var communicationSignaling = require('@azure/communication-signaling');
|
|
6
7
|
var communicationCommon = require('@azure/communication-common');
|
|
7
8
|
var logger$1 = require('@azure/logger');
|
|
8
9
|
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
|
@@ -10,7 +11,6 @@ var coreTracing = require('@azure/core-tracing');
|
|
|
10
11
|
var coreClient = require('@azure/core-client');
|
|
11
12
|
var events = require('events');
|
|
12
13
|
var uuid = require('uuid');
|
|
13
|
-
var communicationSignaling = require('@azure/communication-signaling');
|
|
14
14
|
|
|
15
15
|
function _interopNamespaceDefault(e) {
|
|
16
16
|
var n = Object.create(null);
|
|
@@ -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.5.0
|
|
142
|
+
packageVersion: "1.5.0",
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
/*
|
|
@@ -244,6 +244,13 @@ const CommunicationIdentifierModel = {
|
|
|
244
244
|
className: "MicrosoftTeamsUserIdentifierModel",
|
|
245
245
|
},
|
|
246
246
|
},
|
|
247
|
+
microsoftTeamsApp: {
|
|
248
|
+
serializedName: "microsoftTeamsApp",
|
|
249
|
+
type: {
|
|
250
|
+
name: "Composite",
|
|
251
|
+
className: "MicrosoftTeamsAppIdentifierModel",
|
|
252
|
+
},
|
|
253
|
+
},
|
|
247
254
|
},
|
|
248
255
|
},
|
|
249
256
|
};
|
|
@@ -304,6 +311,27 @@ const MicrosoftTeamsUserIdentifierModel = {
|
|
|
304
311
|
},
|
|
305
312
|
},
|
|
306
313
|
};
|
|
314
|
+
const MicrosoftTeamsAppIdentifierModel = {
|
|
315
|
+
type: {
|
|
316
|
+
name: "Composite",
|
|
317
|
+
className: "MicrosoftTeamsAppIdentifierModel",
|
|
318
|
+
modelProperties: {
|
|
319
|
+
appId: {
|
|
320
|
+
serializedName: "appId",
|
|
321
|
+
required: true,
|
|
322
|
+
type: {
|
|
323
|
+
name: "String",
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
cloud: {
|
|
327
|
+
serializedName: "cloud",
|
|
328
|
+
type: {
|
|
329
|
+
name: "String",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
};
|
|
307
335
|
const CommunicationErrorResponse = {
|
|
308
336
|
type: {
|
|
309
337
|
name: "Composite",
|
|
@@ -631,13 +659,6 @@ const ChatParticipant = {
|
|
|
631
659
|
name: "DateTime",
|
|
632
660
|
},
|
|
633
661
|
},
|
|
634
|
-
metadata: {
|
|
635
|
-
serializedName: "metadata",
|
|
636
|
-
type: {
|
|
637
|
-
name: "Dictionary",
|
|
638
|
-
value: { type: { name: "String" } },
|
|
639
|
-
},
|
|
640
|
-
},
|
|
641
662
|
},
|
|
642
663
|
},
|
|
643
664
|
};
|
|
@@ -797,13 +818,6 @@ const CreateChatThreadRequest = {
|
|
|
797
818
|
},
|
|
798
819
|
},
|
|
799
820
|
},
|
|
800
|
-
metadata: {
|
|
801
|
-
serializedName: "metadata",
|
|
802
|
-
type: {
|
|
803
|
-
name: "Dictionary",
|
|
804
|
-
value: { type: { name: "String" } },
|
|
805
|
-
},
|
|
806
|
-
},
|
|
807
821
|
},
|
|
808
822
|
},
|
|
809
823
|
};
|
|
@@ -874,13 +888,6 @@ const ChatThreadProperties = {
|
|
|
874
888
|
name: "DateTime",
|
|
875
889
|
},
|
|
876
890
|
},
|
|
877
|
-
metadata: {
|
|
878
|
-
serializedName: "metadata",
|
|
879
|
-
type: {
|
|
880
|
-
name: "Dictionary",
|
|
881
|
-
value: { type: { name: "String" } },
|
|
882
|
-
},
|
|
883
|
-
},
|
|
884
891
|
},
|
|
885
892
|
},
|
|
886
893
|
};
|
|
@@ -958,13 +965,6 @@ const UpdateChatThreadRequest = {
|
|
|
958
965
|
name: "String",
|
|
959
966
|
},
|
|
960
967
|
},
|
|
961
|
-
metadata: {
|
|
962
|
-
serializedName: "metadata",
|
|
963
|
-
type: {
|
|
964
|
-
name: "Dictionary",
|
|
965
|
-
value: { type: { name: "String" } },
|
|
966
|
-
},
|
|
967
|
-
},
|
|
968
968
|
},
|
|
969
969
|
},
|
|
970
970
|
};
|
|
@@ -1004,6 +1004,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
|
|
|
1004
1004
|
CommunicationUserIdentifierModel: CommunicationUserIdentifierModel,
|
|
1005
1005
|
CreateChatThreadRequest: CreateChatThreadRequest,
|
|
1006
1006
|
CreateChatThreadResult: CreateChatThreadResult,
|
|
1007
|
+
MicrosoftTeamsAppIdentifierModel: MicrosoftTeamsAppIdentifierModel,
|
|
1007
1008
|
MicrosoftTeamsUserIdentifierModel: MicrosoftTeamsUserIdentifierModel,
|
|
1008
1009
|
PhoneNumberIdentifierModel: PhoneNumberIdentifierModel,
|
|
1009
1010
|
SendChatMessageRequest: SendChatMessageRequest,
|
|
@@ -1074,7 +1075,7 @@ const skip = {
|
|
|
1074
1075
|
const apiVersion = {
|
|
1075
1076
|
parameterPath: "apiVersion",
|
|
1076
1077
|
mapper: {
|
|
1077
|
-
defaultValue: "2024-03-
|
|
1078
|
+
defaultValue: "2024-03-07",
|
|
1078
1079
|
isConstant: true,
|
|
1079
1080
|
serializedName: "api-version",
|
|
1080
1081
|
type: {
|
|
@@ -2074,7 +2075,7 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
|
|
|
2074
2075
|
const defaults = {
|
|
2075
2076
|
requestContentType: "application/json; charset=utf-8",
|
|
2076
2077
|
};
|
|
2077
|
-
const packageDetails = `azsdk-js-communication-chat/1.5.0
|
|
2078
|
+
const packageDetails = `azsdk-js-communication-chat/1.5.0`;
|
|
2078
2079
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
2079
2080
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
2080
2081
|
: `${packageDetails}`;
|
|
@@ -2085,7 +2086,7 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
|
|
|
2085
2086
|
// Parameter assignments
|
|
2086
2087
|
this.endpoint = endpoint;
|
|
2087
2088
|
// Assigning values to Constant parameters
|
|
2088
|
-
this.apiVersion = options.apiVersion || "2024-03-
|
|
2089
|
+
this.apiVersion = options.apiVersion || "2024-03-07";
|
|
2089
2090
|
this.chatThread = new ChatThreadImpl(this);
|
|
2090
2091
|
this.chat = new ChatImpl(this);
|
|
2091
2092
|
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
@@ -2180,15 +2181,6 @@ class ChatThreadClient {
|
|
|
2180
2181
|
await this.client.chatThread.updateChatThreadProperties(this.threadId, { topic: topic }, updatedOptions);
|
|
2181
2182
|
});
|
|
2182
2183
|
}
|
|
2183
|
-
/**
|
|
2184
|
-
* Updates a thread's properties.
|
|
2185
|
-
* @param options - Operation options.
|
|
2186
|
-
*/
|
|
2187
|
-
updateProperties(options = {}) {
|
|
2188
|
-
return tracingClient.withSpan("ChatThreadClient-UpdateProperties", options, async (updatedOptions) => {
|
|
2189
|
-
await this.client.chatThread.updateChatThreadProperties(this.threadId, options, updatedOptions);
|
|
2190
|
-
});
|
|
2191
|
-
}
|
|
2192
2184
|
/**
|
|
2193
2185
|
* Sends a chat message to a thread identified by threadId.
|
|
2194
2186
|
* Returns the id of the created message.
|
|
@@ -2215,8 +2207,8 @@ class ChatThreadClient {
|
|
|
2215
2207
|
return mapToChatMessageSdkModel(result);
|
|
2216
2208
|
});
|
|
2217
2209
|
}
|
|
2218
|
-
listMessagesPage(
|
|
2219
|
-
return tslib.__asyncGenerator(this, arguments, function* listMessagesPage_1() {
|
|
2210
|
+
listMessagesPage(pageSettings_1) {
|
|
2211
|
+
return tslib.__asyncGenerator(this, arguments, function* listMessagesPage_1(pageSettings, options = {}) {
|
|
2220
2212
|
if (!pageSettings.continuationToken) {
|
|
2221
2213
|
const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatMessages(this.threadId, options));
|
|
2222
2214
|
pageSettings.continuationToken = currentSetResponse.nextLink;
|
|
@@ -2319,8 +2311,8 @@ class ChatThreadClient {
|
|
|
2319
2311
|
return result;
|
|
2320
2312
|
});
|
|
2321
2313
|
}
|
|
2322
|
-
listParticipantsPage(
|
|
2323
|
-
return tslib.__asyncGenerator(this, arguments, function* listParticipantsPage_1() {
|
|
2314
|
+
listParticipantsPage(continuationState_1) {
|
|
2315
|
+
return tslib.__asyncGenerator(this, arguments, function* listParticipantsPage_1(continuationState, options = {}) {
|
|
2324
2316
|
if (!continuationState.continuationToken) {
|
|
2325
2317
|
const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatParticipants(this.threadId, options));
|
|
2326
2318
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
@@ -2431,8 +2423,8 @@ class ChatThreadClient {
|
|
|
2431
2423
|
await this.client.chatThread.sendChatReadReceipt(this.threadId, request, updatedOptions);
|
|
2432
2424
|
});
|
|
2433
2425
|
}
|
|
2434
|
-
listReadReceiptsPage(
|
|
2435
|
-
return tslib.__asyncGenerator(this, arguments, function* listReadReceiptsPage_1() {
|
|
2426
|
+
listReadReceiptsPage(continuationState_1) {
|
|
2427
|
+
return tslib.__asyncGenerator(this, arguments, function* listReadReceiptsPage_1(continuationState, options = {}) {
|
|
2436
2428
|
if (!continuationState.continuationToken) {
|
|
2437
2429
|
const currentSetResponse = yield tslib.__await(this.client.chatThread.listChatReadReceipts(this.threadId, options));
|
|
2438
2430
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
@@ -2564,16 +2556,16 @@ class ChatClient {
|
|
|
2564
2556
|
this.emitter = new events.EventEmitter();
|
|
2565
2557
|
this.isRealtimeNotificationsStarted = false;
|
|
2566
2558
|
this.tokenCredential = credential;
|
|
2567
|
-
this.clientOptions = Object.assign({}, options);
|
|
2568
2559
|
const internalPipelineOptions = Object.assign(Object.assign({}, options), {
|
|
2569
2560
|
loggingOptions: {
|
|
2570
2561
|
logger: logger.info,
|
|
2571
2562
|
},
|
|
2572
2563
|
});
|
|
2573
2564
|
this.client = new ChatApiClient(this.endpoint, Object.assign({ endpoint: this.endpoint }, internalPipelineOptions));
|
|
2574
|
-
this.clientOptions.signalingClientOptions = Object.assign(Object.assign({}, this.clientOptions.signalingClientOptions), { resourceEndpoint: this.endpoint, gatewayApiVersion: this.client.apiVersion });
|
|
2575
2565
|
const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
|
|
2576
2566
|
this.client.pipeline.addPolicy(authPolicy);
|
|
2567
|
+
this.clientOptions = Object.assign({}, options);
|
|
2568
|
+
this.clientOptions.signalingClientOptions = Object.assign(Object.assign({}, this.clientOptions.signalingClientOptions), { resourceEndpoint: this.endpoint, gatewayApiVersion: this.client.apiVersion });
|
|
2577
2569
|
this.signalingClient = getSignalingClient(credential, logger, this.clientOptions.signalingClientOptions);
|
|
2578
2570
|
}
|
|
2579
2571
|
/**
|
|
@@ -2598,13 +2590,12 @@ class ChatClient {
|
|
|
2598
2590
|
const result = await this.client.chat.createChatThread({
|
|
2599
2591
|
topic: request.topic,
|
|
2600
2592
|
participants: (_b = options.participants) === null || _b === void 0 ? void 0 : _b.map((participant) => mapToChatParticipantRestModel(participant)),
|
|
2601
|
-
metadata: options.metadata,
|
|
2602
2593
|
}, updatedRestModelOptions);
|
|
2603
2594
|
return mapToCreateChatThreadResultSdkModel(result);
|
|
2604
2595
|
});
|
|
2605
2596
|
}
|
|
2606
|
-
listChatThreadsPage(
|
|
2607
|
-
return tslib.__asyncGenerator(this, arguments, function* listChatThreadsPage_1() {
|
|
2597
|
+
listChatThreadsPage(continuationState_1) {
|
|
2598
|
+
return tslib.__asyncGenerator(this, arguments, function* listChatThreadsPage_1(continuationState, options = {}) {
|
|
2608
2599
|
if (!continuationState.continuationToken) {
|
|
2609
2600
|
const currentSetResponse = yield tslib.__await(this.client.chat.listChatThreads(options));
|
|
2610
2601
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
@@ -2734,10 +2725,10 @@ class ChatClient {
|
|
|
2734
2725
|
throw new Error("Realtime notifications are only supported in the browser.");
|
|
2735
2726
|
}
|
|
2736
2727
|
this.signalingClient.on("connectionChanged", (payload) => {
|
|
2737
|
-
if (payload ===
|
|
2728
|
+
if (payload === communicationSignaling.ConnectionState.Connected) {
|
|
2738
2729
|
this.emitter.emit("realTimeNotificationConnected");
|
|
2739
2730
|
}
|
|
2740
|
-
else if (payload ===
|
|
2731
|
+
else if (payload === communicationSignaling.ConnectionState.Disconnected) {
|
|
2741
2732
|
this.emitter.emit("realTimeNotificationDisconnected");
|
|
2742
2733
|
}
|
|
2743
2734
|
});
|