@microsoft/teamsfx 2.2.3-alpha.e432bab97.0 → 2.2.3-alpha.e58796e43.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/README.md +3 -2
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +35 -3
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +30 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +156 -114
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +26 -9
- package/types/teamsfx.d.ts +3 -3
package/dist/index.node.cjs.js
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
var tslib = require('tslib');
|
6
5
|
var jwt_decode = require('jwt-decode');
|
7
6
|
var msalNode = require('@azure/msal-node');
|
8
7
|
var crypto = require('crypto');
|
@@ -190,6 +189,48 @@ class ErrorWithCode extends Error {
|
|
190
189
|
}
|
191
190
|
}
|
192
191
|
|
192
|
+
/******************************************************************************
|
193
|
+
Copyright (c) Microsoft Corporation.
|
194
|
+
|
195
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
196
|
+
purpose with or without fee is hereby granted.
|
197
|
+
|
198
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
199
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
200
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
201
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
202
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
203
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
204
|
+
PERFORMANCE OF THIS SOFTWARE.
|
205
|
+
***************************************************************************** */
|
206
|
+
|
207
|
+
function __rest(s, e) {
|
208
|
+
var t = {};
|
209
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
210
|
+
t[p] = s[p];
|
211
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
212
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
213
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
214
|
+
t[p[i]] = s[p[i]];
|
215
|
+
}
|
216
|
+
return t;
|
217
|
+
}
|
218
|
+
|
219
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
220
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
221
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
222
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
223
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
224
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
225
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
226
|
+
});
|
227
|
+
}
|
228
|
+
|
229
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
230
|
+
var e = new Error(message);
|
231
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
232
|
+
};
|
233
|
+
|
193
234
|
// Copyright (c) Microsoft Corporation.
|
194
235
|
// Licensed under the MIT license.
|
195
236
|
/**
|
@@ -514,7 +555,7 @@ class AppCredential {
|
|
514
555
|
* Throw error if get access token failed.
|
515
556
|
*/
|
516
557
|
getToken(scopes, options) {
|
517
|
-
return
|
558
|
+
return __awaiter(this, void 0, void 0, function* () {
|
518
559
|
let accessToken;
|
519
560
|
validateScopesType(scopes);
|
520
561
|
const scopesStr = typeof scopes === "string" ? scopes : scopes.join(" ");
|
@@ -652,7 +693,7 @@ class OnBehalfOfUserCredential {
|
|
652
693
|
* If scopes is non-empty, it returns access token for target scope.
|
653
694
|
*/
|
654
695
|
getToken(scopes, options) {
|
655
|
-
return
|
696
|
+
return __awaiter(this, void 0, void 0, function* () {
|
656
697
|
validateScopesType(scopes);
|
657
698
|
const scopesArray = getScopesArray(scopes);
|
658
699
|
let result;
|
@@ -805,7 +846,7 @@ class MsGraphAuthProvider {
|
|
805
846
|
*
|
806
847
|
*/
|
807
848
|
getAccessToken() {
|
808
|
-
return
|
849
|
+
return __awaiter(this, void 0, void 0, function* () {
|
809
850
|
internalLogger.info(`Get Graph Access token with scopes: '${this.scopes.toString()}'`);
|
810
851
|
let accessToken;
|
811
852
|
if (this.credentialOrTeamsFx.getCredential) {
|
@@ -985,7 +1026,7 @@ const defaultSQLScope = "https://database.windows.net/";
|
|
985
1026
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
|
986
1027
|
*/
|
987
1028
|
function getTediousConnectionConfig(teamsfx, databaseName) {
|
988
|
-
return
|
1029
|
+
return __awaiter(this, void 0, void 0, function* () {
|
989
1030
|
internalLogger.info("Get SQL configuration");
|
990
1031
|
try {
|
991
1032
|
isSQLConfigurationValid(teamsfx);
|
@@ -1089,7 +1130,7 @@ function generateDefaultConfig(teamsfx, databaseName) {
|
|
1089
1130
|
* @internal
|
1090
1131
|
*/
|
1091
1132
|
function generateTokenConfig(teamsfx, databaseName) {
|
1092
|
-
return
|
1133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1093
1134
|
internalLogger.verbose("Generate tedious config with MSI token");
|
1094
1135
|
let token;
|
1095
1136
|
try {
|
@@ -1246,7 +1287,7 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
1246
1287
|
*/
|
1247
1288
|
beginDialog(dc) {
|
1248
1289
|
var _a;
|
1249
|
-
return
|
1290
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1250
1291
|
internalLogger.info("Begin Teams Bot SSO Prompt");
|
1251
1292
|
this.ensureMsTeamsChannel(dc);
|
1252
1293
|
// Initialize prompt state
|
@@ -1295,7 +1336,7 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
1295
1336
|
*/
|
1296
1337
|
continueDialog(dc) {
|
1297
1338
|
var _a;
|
1298
|
-
return
|
1339
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1299
1340
|
internalLogger.info("Continue Teams Bot SSO Prompt");
|
1300
1341
|
this.ensureMsTeamsChannel(dc);
|
1301
1342
|
// Check for timeout
|
@@ -1388,7 +1429,7 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
1388
1429
|
* @internal
|
1389
1430
|
*/
|
1390
1431
|
sendOAuthCardAsync(context) {
|
1391
|
-
return
|
1432
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1392
1433
|
internalLogger.verbose("Send OAuth card to get SSO token");
|
1393
1434
|
const account = yield botbuilder.TeamsInfo.getMember(context, context.activity.from.id);
|
1394
1435
|
internalLogger.verbose("Get Teams member account user principal name: " +
|
@@ -1425,7 +1466,7 @@ class TeamsBotSsoPrompt extends botbuilderDialogs.Dialog {
|
|
1425
1466
|
* @internal
|
1426
1467
|
*/
|
1427
1468
|
recognizeToken(dc) {
|
1428
|
-
return
|
1469
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1429
1470
|
const context = dc.context;
|
1430
1471
|
let tokenResponse;
|
1431
1472
|
if (this.isTokenExchangeRequestInvoke(context)) {
|
@@ -1522,7 +1563,7 @@ function createApiClient(apiEndpoint, authProvider) {
|
|
1522
1563
|
baseURL: apiEndpoint,
|
1523
1564
|
});
|
1524
1565
|
instance.interceptors.request.use(function (config) {
|
1525
|
-
return
|
1566
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1526
1567
|
return yield authProvider.AddAuthenticationInfo(config);
|
1527
1568
|
});
|
1528
1569
|
});
|
@@ -1551,7 +1592,7 @@ class BearerTokenAuthProvider {
|
|
1551
1592
|
* @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
|
1552
1593
|
*/
|
1553
1594
|
AddAuthenticationInfo(config) {
|
1554
|
-
return
|
1595
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1555
1596
|
const token = yield this.getToken();
|
1556
1597
|
if (!config.headers) {
|
1557
1598
|
config.headers = {};
|
@@ -1870,7 +1911,7 @@ class TeamsFx {
|
|
1870
1911
|
* @returns UserInfo object.
|
1871
1912
|
*/
|
1872
1913
|
getUserInfo(resources) {
|
1873
|
-
return
|
1914
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1874
1915
|
if (this.identityType !== exports.IdentityType.User) {
|
1875
1916
|
const errorMsg = formatString(ErrorMessage.IdentityTypeNotSupported, this.identityType.toString(), "TeamsFx");
|
1876
1917
|
internalLogger.error(errorMsg);
|
@@ -1901,7 +1942,7 @@ class TeamsFx {
|
|
1901
1942
|
* @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
|
1902
1943
|
*/
|
1903
1944
|
login(scopes, resources) {
|
1904
|
-
return
|
1945
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1905
1946
|
throw new ErrorWithCode(formatString(ErrorMessage.NodejsRuntimeNotSupported, "login"), exports.ErrorCode.RuntimeNotSupported);
|
1906
1947
|
});
|
1907
1948
|
}
|
@@ -2040,6 +2081,7 @@ exports.InvokeResponseErrorCode = void 0;
|
|
2040
2081
|
InvokeResponseErrorCode[InvokeResponseErrorCode["InternalServerError"] = 500] = "InternalServerError";
|
2041
2082
|
})(exports.InvokeResponseErrorCode || (exports.InvokeResponseErrorCode = {}));
|
2042
2083
|
|
2084
|
+
// Copyright (c) Microsoft Corporation.
|
2043
2085
|
/**
|
2044
2086
|
* Available response type for an adaptive card invoke response.
|
2045
2087
|
* @internal
|
@@ -2054,7 +2096,7 @@ var InvokeResponseType;
|
|
2054
2096
|
* Provides methods for formatting various invoke responses a bot can send to respond to an invoke request.
|
2055
2097
|
*
|
2056
2098
|
* @remarks
|
2057
|
-
* All of these functions return an
|
2099
|
+
* All of these functions return an `InvokeResponse` object, which can be
|
2058
2100
|
* passed as input to generate a new `invokeResponse` activity.
|
2059
2101
|
*
|
2060
2102
|
* This example sends an invoke response that contains an adaptive card.
|
@@ -2180,7 +2222,7 @@ class CardActionMiddleware {
|
|
2180
2222
|
}
|
2181
2223
|
onTurn(context, next) {
|
2182
2224
|
var _a, _b, _c;
|
2183
|
-
return
|
2225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2184
2226
|
if (context.activity.name === "adaptiveCard/action") {
|
2185
2227
|
const action = context.activity.value.action;
|
2186
2228
|
const actionVerb = action.verb;
|
@@ -2237,7 +2279,7 @@ class CardActionMiddleware {
|
|
2237
2279
|
});
|
2238
2280
|
}
|
2239
2281
|
sendInvokeResponse(context, response) {
|
2240
|
-
return
|
2282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2241
2283
|
yield context.sendActivity({
|
2242
2284
|
type: botbuilder.ActivityTypes.InvokeResponse,
|
2243
2285
|
value: response,
|
@@ -2306,7 +2348,7 @@ class CommandResponseMiddleware {
|
|
2306
2348
|
}
|
2307
2349
|
addSsoCommand(ssoHandler) {
|
2308
2350
|
var _a;
|
2309
|
-
(_a = this.ssoActivityHandler) === null || _a === void 0 ? void 0 : _a.addCommand((context, tokenResponse, message) =>
|
2351
|
+
(_a = this.ssoActivityHandler) === null || _a === void 0 ? void 0 : _a.addCommand((context, tokenResponse, message) => __awaiter(this, void 0, void 0, function* () {
|
2310
2352
|
const matchResult = this.shouldTrigger(ssoHandler.triggerPatterns, message.text);
|
2311
2353
|
message.matches = Array.isArray(matchResult) ? matchResult : void 0;
|
2312
2354
|
const response = yield ssoHandler.handleCommandReceived(context, message, tokenResponse);
|
@@ -2317,7 +2359,7 @@ class CommandResponseMiddleware {
|
|
2317
2359
|
}
|
2318
2360
|
onTurn(context, next) {
|
2319
2361
|
var _a, _b;
|
2320
|
-
return
|
2362
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2321
2363
|
if (context.activity.type === botbuilder.ActivityTypes.Message) {
|
2322
2364
|
// Invoke corresponding command handler for the command response
|
2323
2365
|
const commandText = this.getActivityText(context.activity);
|
@@ -2356,7 +2398,7 @@ class CommandResponseMiddleware {
|
|
2356
2398
|
});
|
2357
2399
|
}
|
2358
2400
|
processResponse(context, response) {
|
2359
|
-
return
|
2401
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2360
2402
|
if (typeof response === "string") {
|
2361
2403
|
yield context.sendActivity(response);
|
2362
2404
|
}
|
@@ -2547,7 +2589,7 @@ class NotificationMiddleware {
|
|
2547
2589
|
this.conversationReferenceStore = options.conversationReferenceStore;
|
2548
2590
|
}
|
2549
2591
|
onTurn(context, next) {
|
2550
|
-
return
|
2592
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2551
2593
|
const type = this.classifyActivity(context.activity);
|
2552
2594
|
switch (type) {
|
2553
2595
|
case ActivityType.CurrentBotInstalled:
|
@@ -2600,7 +2642,7 @@ class NotificationMiddleware {
|
|
2600
2642
|
}
|
2601
2643
|
tryAddMessagedReference(context) {
|
2602
2644
|
var _a, _b, _c, _d;
|
2603
|
-
return
|
2645
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2604
2646
|
const reference = botbuilder.TurnContext.getConversationReference(context.activity);
|
2605
2647
|
const conversationType = (_a = reference === null || reference === void 0 ? void 0 : reference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
|
2606
2648
|
if (conversationType === "personal" || conversationType === "groupChat") {
|
@@ -2630,7 +2672,7 @@ class LocalFileStorage {
|
|
2630
2672
|
this.filePath = path__namespace.resolve(fileDir, this.localFileName);
|
2631
2673
|
}
|
2632
2674
|
read(key) {
|
2633
|
-
return
|
2675
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2634
2676
|
if (!(yield this.storeFileExists())) {
|
2635
2677
|
return undefined;
|
2636
2678
|
}
|
@@ -2639,7 +2681,7 @@ class LocalFileStorage {
|
|
2639
2681
|
});
|
2640
2682
|
}
|
2641
2683
|
list() {
|
2642
|
-
return
|
2684
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2643
2685
|
if (!(yield this.storeFileExists())) {
|
2644
2686
|
return [];
|
2645
2687
|
}
|
@@ -2648,7 +2690,7 @@ class LocalFileStorage {
|
|
2648
2690
|
});
|
2649
2691
|
}
|
2650
2692
|
write(key, object) {
|
2651
|
-
return
|
2693
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2652
2694
|
if (!(yield this.storeFileExists())) {
|
2653
2695
|
yield this.writeToFile({ [key]: object });
|
2654
2696
|
return;
|
@@ -2658,7 +2700,7 @@ class LocalFileStorage {
|
|
2658
2700
|
});
|
2659
2701
|
}
|
2660
2702
|
delete(key) {
|
2661
|
-
return
|
2703
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2662
2704
|
if (yield this.storeFileExists()) {
|
2663
2705
|
const data = yield this.readFromFile();
|
2664
2706
|
if (data[key] !== undefined) {
|
@@ -2703,7 +2745,7 @@ class LocalFileStorage {
|
|
2703
2745
|
});
|
2704
2746
|
}
|
2705
2747
|
writeToFile(data) {
|
2706
|
-
return
|
2748
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2707
2749
|
return new Promise((resolve, reject) => {
|
2708
2750
|
try {
|
2709
2751
|
const rawData = JSON.stringify(data, undefined, 2);
|
@@ -2731,7 +2773,7 @@ class DefaultConversationReferenceStore {
|
|
2731
2773
|
this.storage = storage;
|
2732
2774
|
}
|
2733
2775
|
add(key, reference, options) {
|
2734
|
-
return
|
2776
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2735
2777
|
if (options.overwrite) {
|
2736
2778
|
yield this.storage.write(key, reference);
|
2737
2779
|
return true;
|
@@ -2745,7 +2787,7 @@ class DefaultConversationReferenceStore {
|
|
2745
2787
|
});
|
2746
2788
|
}
|
2747
2789
|
remove(key, reference) {
|
2748
|
-
return
|
2790
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2749
2791
|
const ref = yield this.storage.read(key);
|
2750
2792
|
if (ref === undefined) {
|
2751
2793
|
return false;
|
@@ -2755,7 +2797,7 @@ class DefaultConversationReferenceStore {
|
|
2755
2797
|
});
|
2756
2798
|
}
|
2757
2799
|
list(pageSize, continuationToken) {
|
2758
|
-
return
|
2800
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2759
2801
|
const data = yield this.storage.list();
|
2760
2802
|
return {
|
2761
2803
|
data,
|
@@ -2823,11 +2865,11 @@ class Channel$1 {
|
|
2823
2865
|
* @returns the response of sending message.
|
2824
2866
|
*/
|
2825
2867
|
sendMessage(text, onError) {
|
2826
|
-
return
|
2868
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2827
2869
|
const response = {};
|
2828
|
-
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) =>
|
2870
|
+
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
2829
2871
|
const conversation = this.newConversation(context);
|
2830
|
-
yield this.parent.adapter.continueConversation(conversation, (ctx) =>
|
2872
|
+
yield this.parent.adapter.continueConversation(conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
|
2831
2873
|
try {
|
2832
2874
|
const res = yield ctx.sendActivity(text);
|
2833
2875
|
response.id = res === null || res === void 0 ? void 0 : res.id;
|
@@ -2854,11 +2896,11 @@ class Channel$1 {
|
|
2854
2896
|
* @returns the response of sending adaptive card message.
|
2855
2897
|
*/
|
2856
2898
|
sendAdaptiveCard(card, onError) {
|
2857
|
-
return
|
2899
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2858
2900
|
const response = {};
|
2859
|
-
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) =>
|
2901
|
+
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
2860
2902
|
const conversation = this.newConversation(context);
|
2861
|
-
yield this.parent.adapter.continueConversation(conversation, (ctx) =>
|
2903
|
+
yield this.parent.adapter.continueConversation(conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
|
2862
2904
|
try {
|
2863
2905
|
const res = yield ctx.sendActivity({
|
2864
2906
|
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
@@ -2921,11 +2963,11 @@ class Member$1 {
|
|
2921
2963
|
* @returns the response of sending message.
|
2922
2964
|
*/
|
2923
2965
|
sendMessage(text, onError) {
|
2924
|
-
return
|
2966
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2925
2967
|
const response = {};
|
2926
|
-
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) =>
|
2968
|
+
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
2927
2969
|
const conversation = yield this.newConversation(context);
|
2928
|
-
yield this.parent.adapter.continueConversation(conversation, (ctx) =>
|
2970
|
+
yield this.parent.adapter.continueConversation(conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
|
2929
2971
|
try {
|
2930
2972
|
const res = yield ctx.sendActivity(text);
|
2931
2973
|
response.id = res === null || res === void 0 ? void 0 : res.id;
|
@@ -2952,11 +2994,11 @@ class Member$1 {
|
|
2952
2994
|
* @returns the response of sending adaptive card message.
|
2953
2995
|
*/
|
2954
2996
|
sendAdaptiveCard(card, onError) {
|
2955
|
-
return
|
2997
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2956
2998
|
const response = {};
|
2957
|
-
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) =>
|
2999
|
+
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
2958
3000
|
const conversation = yield this.newConversation(context);
|
2959
|
-
yield this.parent.adapter.continueConversation(conversation, (ctx) =>
|
3001
|
+
yield this.parent.adapter.continueConversation(conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
|
2960
3002
|
try {
|
2961
3003
|
const res = yield ctx.sendActivity({
|
2962
3004
|
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
@@ -2980,7 +3022,7 @@ class Member$1 {
|
|
2980
3022
|
* @internal
|
2981
3023
|
*/
|
2982
3024
|
newConversation(context) {
|
2983
|
-
return
|
3025
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2984
3026
|
const reference = botbuilder.TurnContext.getConversationReference(context.activity);
|
2985
3027
|
const personalConversation = cloneConversation(reference);
|
2986
3028
|
const connectorClient = context.turnState.get(this.parent.adapter.ConnectorClientKey);
|
@@ -3032,9 +3074,9 @@ class TeamsBotInstallation$1 {
|
|
3032
3074
|
* @returns the response of sending message.
|
3033
3075
|
*/
|
3034
3076
|
sendMessage(text, onError) {
|
3035
|
-
return
|
3077
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3036
3078
|
const response = {};
|
3037
|
-
yield this.adapter.continueConversation(this.conversationReference, (context) =>
|
3079
|
+
yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
3038
3080
|
try {
|
3039
3081
|
const res = yield context.sendActivity(text);
|
3040
3082
|
response.id = res === null || res === void 0 ? void 0 : res.id;
|
@@ -3060,9 +3102,9 @@ class TeamsBotInstallation$1 {
|
|
3060
3102
|
* @returns the response of sending adaptive card message.
|
3061
3103
|
*/
|
3062
3104
|
sendAdaptiveCard(card, onError) {
|
3063
|
-
return
|
3105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3064
3106
|
const response = {};
|
3065
|
-
yield this.adapter.continueConversation(this.conversationReference, (context) =>
|
3107
|
+
yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
3066
3108
|
try {
|
3067
3109
|
const res = yield context.sendActivity({
|
3068
3110
|
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
@@ -3087,13 +3129,13 @@ class TeamsBotInstallation$1 {
|
|
3087
3129
|
* @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
|
3088
3130
|
*/
|
3089
3131
|
channels() {
|
3090
|
-
return
|
3132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3091
3133
|
const channels = [];
|
3092
3134
|
if (this.type !== exports.NotificationTargetType.Channel) {
|
3093
3135
|
return channels;
|
3094
3136
|
}
|
3095
3137
|
let teamsChannels = [];
|
3096
|
-
yield this.adapter.continueConversation(this.conversationReference, (context) =>
|
3138
|
+
yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
3097
3139
|
const teamId = getTeamsBotInstallationId(context);
|
3098
3140
|
if (teamId !== undefined) {
|
3099
3141
|
teamsChannels = yield botbuilder.TeamsInfo.getTeamChannels(context, teamId);
|
@@ -3111,9 +3153,9 @@ class TeamsBotInstallation$1 {
|
|
3111
3153
|
* @returns an array of members from where the bot is installed.
|
3112
3154
|
*/
|
3113
3155
|
members() {
|
3114
|
-
return
|
3156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3115
3157
|
const members = [];
|
3116
|
-
yield this.adapter.continueConversation(this.conversationReference, (context) =>
|
3158
|
+
yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
3117
3159
|
let continuationToken;
|
3118
3160
|
do {
|
3119
3161
|
const pagedMembers = yield botbuilder.TeamsInfo.getPagedMembers(context, undefined, continuationToken);
|
@@ -3132,12 +3174,12 @@ class TeamsBotInstallation$1 {
|
|
3132
3174
|
* @returns the team details if bot is installed into a team, otherwise returns undefined.
|
3133
3175
|
*/
|
3134
3176
|
getTeamDetails() {
|
3135
|
-
return
|
3177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3136
3178
|
if (this.type !== exports.NotificationTargetType.Channel) {
|
3137
3179
|
return undefined;
|
3138
3180
|
}
|
3139
3181
|
let teamDetails;
|
3140
|
-
yield this.adapter.continueConversation(this.conversationReference, (context) =>
|
3182
|
+
yield this.adapter.continueConversation(this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
3141
3183
|
const teamId = getTeamsBotInstallationId(context);
|
3142
3184
|
if (teamId !== undefined) {
|
3143
3185
|
teamDetails = yield botbuilder.TeamsInfo.getTeamDetails(context, teamId);
|
@@ -3180,7 +3222,7 @@ class NotificationBot$1 {
|
|
3180
3222
|
* @returns - an array of {@link TeamsBotInstallation}.
|
3181
3223
|
*/
|
3182
3224
|
installations() {
|
3183
|
-
return
|
3225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3184
3226
|
if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
|
3185
3227
|
throw new Error("NotificationBot has not been initialized.");
|
3186
3228
|
}
|
@@ -3189,7 +3231,7 @@ class NotificationBot$1 {
|
|
3189
3231
|
for (const reference of references) {
|
3190
3232
|
// validate connection
|
3191
3233
|
let valid = true;
|
3192
|
-
yield this.adapter.continueConversation(reference, (context) =>
|
3234
|
+
yield this.adapter.continueConversation(reference, (context) => __awaiter(this, void 0, void 0, function* () {
|
3193
3235
|
try {
|
3194
3236
|
// try get member to see if the installation is still valid
|
3195
3237
|
yield botbuilder.TeamsInfo.getPagedMembers(context, 1);
|
@@ -3221,7 +3263,7 @@ class NotificationBot$1 {
|
|
3221
3263
|
* @returns the first {@link Member} where predicate is true, and undefined otherwise.
|
3222
3264
|
*/
|
3223
3265
|
findMember(predicate, scope) {
|
3224
|
-
return
|
3266
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3225
3267
|
for (const target of yield this.installations()) {
|
3226
3268
|
if (this.matchSearchScope(target, scope)) {
|
3227
3269
|
for (const member of yield target.members()) {
|
@@ -3244,7 +3286,7 @@ class NotificationBot$1 {
|
|
3244
3286
|
* @returns the first {@link Channel} where predicate is true, and undefined otherwise.
|
3245
3287
|
*/
|
3246
3288
|
findChannel(predicate) {
|
3247
|
-
return
|
3289
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3248
3290
|
for (const target of yield this.installations()) {
|
3249
3291
|
if (target.type === exports.NotificationTargetType.Channel) {
|
3250
3292
|
const teamDetails = yield target.getTeamDetails();
|
@@ -3267,7 +3309,7 @@ class NotificationBot$1 {
|
|
3267
3309
|
* @returns an array of {@link Member} where predicate is true, and empty array otherwise.
|
3268
3310
|
*/
|
3269
3311
|
findAllMembers(predicate, scope) {
|
3270
|
-
return
|
3312
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3271
3313
|
const members = [];
|
3272
3314
|
for (const target of yield this.installations()) {
|
3273
3315
|
if (this.matchSearchScope(target, scope)) {
|
@@ -3289,7 +3331,7 @@ class NotificationBot$1 {
|
|
3289
3331
|
* @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
|
3290
3332
|
*/
|
3291
3333
|
findAllChannels(predicate) {
|
3292
|
-
return
|
3334
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3293
3335
|
const channels = [];
|
3294
3336
|
for (const target of yield this.installations()) {
|
3295
3337
|
if (target.type === exports.NotificationTargetType.Channel) {
|
@@ -3382,7 +3424,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
|
|
3382
3424
|
const dialog = new botbuilderDialogs.WaterfallDialog(commandId, [
|
3383
3425
|
this.ssoStep.bind(this),
|
3384
3426
|
this.dedupStep.bind(this),
|
3385
|
-
(stepContext) =>
|
3427
|
+
(stepContext) => __awaiter(this, void 0, void 0, function* () {
|
3386
3428
|
const tokenResponse = stepContext.result.tokenResponse;
|
3387
3429
|
const context = stepContext.context;
|
3388
3430
|
const message = stepContext.result.message;
|
@@ -3419,7 +3461,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
|
|
3419
3461
|
* @param accessor The instance of StatePropertyAccessor for dialog system.
|
3420
3462
|
*/
|
3421
3463
|
run(context, accessor) {
|
3422
|
-
return
|
3464
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3423
3465
|
const dialogSet = new botbuilderDialogs.DialogSet(accessor);
|
3424
3466
|
dialogSet.add(this);
|
3425
3467
|
const dialogContext = yield dialogSet.createContext(context);
|
@@ -3447,7 +3489,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
|
|
3447
3489
|
return text;
|
3448
3490
|
}
|
3449
3491
|
commandRouteStep(stepContext) {
|
3450
|
-
return
|
3492
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3451
3493
|
const turnContext = stepContext.context;
|
3452
3494
|
const text = this.getActivityText(turnContext.activity);
|
3453
3495
|
const commandId = this.getMatchesCommandId(text);
|
@@ -3460,7 +3502,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
|
|
3460
3502
|
});
|
3461
3503
|
}
|
3462
3504
|
ssoStep(stepContext) {
|
3463
|
-
return
|
3505
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3464
3506
|
try {
|
3465
3507
|
const turnContext = stepContext.context;
|
3466
3508
|
const text = this.getActivityText(turnContext.activity);
|
@@ -3478,7 +3520,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
|
|
3478
3520
|
});
|
3479
3521
|
}
|
3480
3522
|
dedupStep(stepContext) {
|
3481
|
-
return
|
3523
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3482
3524
|
const tokenResponse = stepContext.result;
|
3483
3525
|
if (!tokenResponse) {
|
3484
3526
|
internalLogger.error(ErrorMessage.FailedToRetrieveSsoToken);
|
@@ -3507,7 +3549,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
|
|
3507
3549
|
* @param context Context for the current turn of conversation.
|
3508
3550
|
*/
|
3509
3551
|
onEndDialog(context) {
|
3510
|
-
return
|
3552
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3511
3553
|
const conversationId = context.activity.conversation.id;
|
3512
3554
|
const currentDedupKeys = this.dedupStorageKeys.filter((key) => key.indexOf(conversationId) > 0);
|
3513
3555
|
yield this.dedupStorage.delete(currentDedupKeys);
|
@@ -3523,7 +3565,7 @@ class BotSsoExecutionDialog extends botbuilderDialogs.ComponentDialog {
|
|
3523
3565
|
* @returns boolean value indicate whether the message should be removed
|
3524
3566
|
*/
|
3525
3567
|
shouldDedup(context) {
|
3526
|
-
return
|
3568
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3527
3569
|
const storeItem = {
|
3528
3570
|
eTag: context.activity.value.id,
|
3529
3571
|
};
|
@@ -3623,7 +3665,7 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
|
|
3623
3665
|
const userState = (_b = (_a = ssoConfig.dialog) === null || _a === void 0 ? void 0 : _a.userState) !== null && _b !== void 0 ? _b : new botbuilder.UserState(memoryStorage);
|
3624
3666
|
const conversationState = (_d = (_c = ssoConfig.dialog) === null || _c === void 0 ? void 0 : _c.conversationState) !== null && _d !== void 0 ? _d : new botbuilder.ConversationState(memoryStorage);
|
3625
3667
|
const dedupStorage = (_f = (_e = ssoConfig.dialog) === null || _e === void 0 ? void 0 : _e.dedupStorage) !== null && _f !== void 0 ? _f : memoryStorage;
|
3626
|
-
const _l = ssoConfig.aad, { scopes } = _l, customConfig =
|
3668
|
+
const _l = ssoConfig.aad, { scopes } = _l, customConfig = __rest(_l, ["scopes"]);
|
3627
3669
|
const settings = {
|
3628
3670
|
scopes: scopes,
|
3629
3671
|
timeout: (_h = (_g = ssoConfig.dialog) === null || _g === void 0 ? void 0 : _g.ssoPromptConfig) === null || _h === void 0 ? void 0 : _h.timeout,
|
@@ -3633,7 +3675,7 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
|
|
3633
3675
|
this.conversationState = conversationState;
|
3634
3676
|
this.dialogState = conversationState.createProperty("DialogState");
|
3635
3677
|
this.userState = userState;
|
3636
|
-
this.onMessage((context, next) =>
|
3678
|
+
this.onMessage((context, next) => __awaiter(this, void 0, void 0, function* () {
|
3637
3679
|
yield this.ssoExecutionDialog.run(context, this.dialogState);
|
3638
3680
|
yield next();
|
3639
3681
|
}));
|
@@ -3657,7 +3699,7 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
|
|
3657
3699
|
const _super = Object.create(null, {
|
3658
3700
|
run: { get: () => super.run }
|
3659
3701
|
});
|
3660
|
-
return
|
3702
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3661
3703
|
try {
|
3662
3704
|
yield _super.run.call(this, context);
|
3663
3705
|
}
|
@@ -3677,7 +3719,7 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
|
|
3677
3719
|
* It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
|
3678
3720
|
*/
|
3679
3721
|
handleTeamsSigninVerifyState(context, query) {
|
3680
|
-
return
|
3722
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3681
3723
|
yield this.ssoExecutionDialog.run(context, this.dialogState);
|
3682
3724
|
});
|
3683
3725
|
}
|
@@ -3687,11 +3729,11 @@ class DefaultBotSsoExecutionActivityHandler extends botbuilder.TeamsActivityHand
|
|
3687
3729
|
* @param query Signin state (part of signin action auth flow) verification invoke query
|
3688
3730
|
* @returns A promise that represents the work queued.
|
3689
3731
|
*
|
3690
|
-
* @
|
3732
|
+
* @remarks
|
3691
3733
|
* It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
|
3692
3734
|
*/
|
3693
3735
|
handleTeamsSigninTokenExchange(context, query) {
|
3694
|
-
return
|
3736
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3695
3737
|
yield this.ssoExecutionDialog.run(context, this.dialogState);
|
3696
3738
|
});
|
3697
3739
|
}
|
@@ -3797,7 +3839,7 @@ class ConversationBot$1 {
|
|
3797
3839
|
})
|
3798
3840
|
: new botbuilder.BotFrameworkAdapter(adapterConfig);
|
3799
3841
|
// the default error handler
|
3800
|
-
adapter.onTurnError = (context, error) =>
|
3842
|
+
adapter.onTurnError = (context, error) => __awaiter(this, void 0, void 0, function* () {
|
3801
3843
|
// This check writes out errors to console.
|
3802
3844
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
3803
3845
|
console.error(`[onTurnError] unhandled error: ${error}`);
|
@@ -3833,10 +3875,10 @@ class ConversationBot$1 {
|
|
3833
3875
|
* ```
|
3834
3876
|
*/
|
3835
3877
|
requestHandler(req, res, logic) {
|
3836
|
-
return
|
3878
|
+
return __awaiter(this, void 0, void 0, function* () {
|
3837
3879
|
if (logic === undefined) {
|
3838
3880
|
// create empty logic
|
3839
|
-
logic = () =>
|
3881
|
+
logic = () => __awaiter(this, void 0, void 0, function* () { });
|
3840
3882
|
}
|
3841
3883
|
yield this.adapter.processActivity(req, res, logic);
|
3842
3884
|
});
|
@@ -4053,7 +4095,7 @@ function getSignInResponseForMessageExtension(teamsfx, scopes) {
|
|
4053
4095
|
* @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
|
4054
4096
|
*/
|
4055
4097
|
function executionWithTokenAndConfig(context, authConfig, initiateLoginEndpoint, scopes, logic) {
|
4056
|
-
return
|
4098
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4057
4099
|
const valueObj = context.activity.value;
|
4058
4100
|
if (!valueObj.authentication || !valueObj.authentication.token) {
|
4059
4101
|
internalLogger.verbose("No AccessToken in request, return silentAuth for AccessToken");
|
@@ -4103,7 +4145,7 @@ function executionWithTokenAndConfig(context, authConfig, initiateLoginEndpoint,
|
|
4103
4145
|
* @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
|
4104
4146
|
*/
|
4105
4147
|
function executionWithToken(context, config, scopes, logic) {
|
4106
|
-
return
|
4148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4107
4149
|
const valueObj = context.activity.value;
|
4108
4150
|
if (!valueObj.authentication || !valueObj.authentication.token) {
|
4109
4151
|
internalLogger.verbose("No AccessToken in request, return silentAuth for AccessToken");
|
@@ -4155,7 +4197,7 @@ function executionWithToken(context, config, scopes, logic) {
|
|
4155
4197
|
* @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
|
4156
4198
|
*/
|
4157
4199
|
function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
|
4158
|
-
return
|
4200
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4159
4201
|
if (context.activity.name != "composeExtension/query") {
|
4160
4202
|
internalLogger.error(ErrorMessage.OnlySupportInQueryActivity);
|
4161
4203
|
throw new ErrorWithCode(formatString(ErrorMessage.OnlySupportInQueryActivity), exports.ErrorCode.FailedOperation);
|
@@ -4182,7 +4224,7 @@ function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
|
|
4182
4224
|
* @returns A MessageExtension Response for the activity. If the logic not return any, return void instead.
|
4183
4225
|
*/
|
4184
4226
|
function handleMessageExtensionQueryWithSSO(context, config, initiateLoginEndpoint, scopes, logic) {
|
4185
|
-
return
|
4227
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4186
4228
|
if (context.activity.name != "composeExtension/query") {
|
4187
4229
|
internalLogger.error(ErrorMessage.OnlySupportInQueryActivity);
|
4188
4230
|
throw new ErrorWithCode(formatString(ErrorMessage.OnlySupportInQueryActivity), exports.ErrorCode.FailedOperation);
|
@@ -4360,11 +4402,11 @@ class Channel {
|
|
4360
4402
|
* @returns The response of sending message.
|
4361
4403
|
*/
|
4362
4404
|
sendMessage(text, onError) {
|
4363
|
-
return
|
4405
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4364
4406
|
const response = {};
|
4365
|
-
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) =>
|
4407
|
+
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4366
4408
|
const conversation = yield this.newConversation(context);
|
4367
|
-
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) =>
|
4409
|
+
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
|
4368
4410
|
try {
|
4369
4411
|
const res = yield ctx.sendActivity(text);
|
4370
4412
|
response.id = res === null || res === void 0 ? void 0 : res.id;
|
@@ -4392,11 +4434,11 @@ class Channel {
|
|
4392
4434
|
* @returns The response of sending adaptive card message.
|
4393
4435
|
*/
|
4394
4436
|
sendAdaptiveCard(card, onError) {
|
4395
|
-
return
|
4437
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4396
4438
|
const response = {};
|
4397
|
-
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) =>
|
4439
|
+
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4398
4440
|
const conversation = yield this.newConversation(context);
|
4399
|
-
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) =>
|
4441
|
+
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
|
4400
4442
|
try {
|
4401
4443
|
const res = yield ctx.sendActivity({
|
4402
4444
|
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
@@ -4460,11 +4502,11 @@ class Member {
|
|
4460
4502
|
* @returns The response of sending message.
|
4461
4503
|
*/
|
4462
4504
|
sendMessage(text, onError) {
|
4463
|
-
return
|
4505
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4464
4506
|
const response = {};
|
4465
|
-
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) =>
|
4507
|
+
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4466
4508
|
const conversation = yield this.newConversation(context);
|
4467
|
-
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) =>
|
4509
|
+
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
|
4468
4510
|
try {
|
4469
4511
|
const res = yield ctx.sendActivity(text);
|
4470
4512
|
response.id = res === null || res === void 0 ? void 0 : res.id;
|
@@ -4492,11 +4534,11 @@ class Member {
|
|
4492
4534
|
* @returns The response of sending adaptive card message.
|
4493
4535
|
*/
|
4494
4536
|
sendAdaptiveCard(card, onError) {
|
4495
|
-
return
|
4537
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4496
4538
|
const response = {};
|
4497
|
-
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) =>
|
4539
|
+
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, this.parent.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4498
4540
|
const conversation = yield this.newConversation(context);
|
4499
|
-
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) =>
|
4541
|
+
yield this.parent.adapter.continueConversationAsync(this.parent.botAppId, conversation, (ctx) => __awaiter(this, void 0, void 0, function* () {
|
4500
4542
|
try {
|
4501
4543
|
const res = yield ctx.sendActivity({
|
4502
4544
|
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
@@ -4520,7 +4562,7 @@ class Member {
|
|
4520
4562
|
* @internal
|
4521
4563
|
*/
|
4522
4564
|
newConversation(context) {
|
4523
|
-
return
|
4565
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4524
4566
|
const reference = botbuilder.TurnContext.getConversationReference(context.activity);
|
4525
4567
|
const personalConversation = cloneConversation(reference);
|
4526
4568
|
const connectorClient = context.turnState.get(this.parent.adapter.ConnectorClientKey);
|
@@ -4572,9 +4614,9 @@ class TeamsBotInstallation {
|
|
4572
4614
|
* @returns The response of sending message.
|
4573
4615
|
*/
|
4574
4616
|
sendMessage(text, onError) {
|
4575
|
-
return
|
4617
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4576
4618
|
const response = {};
|
4577
|
-
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) =>
|
4619
|
+
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4578
4620
|
try {
|
4579
4621
|
const res = yield context.sendActivity(text);
|
4580
4622
|
response.id = res === null || res === void 0 ? void 0 : res.id;
|
@@ -4601,9 +4643,9 @@ class TeamsBotInstallation {
|
|
4601
4643
|
* @returns The response of sending adaptive card message.
|
4602
4644
|
*/
|
4603
4645
|
sendAdaptiveCard(card, onError) {
|
4604
|
-
return
|
4646
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4605
4647
|
const response = {};
|
4606
|
-
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) =>
|
4648
|
+
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4607
4649
|
try {
|
4608
4650
|
const res = yield context.sendActivity({
|
4609
4651
|
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
@@ -4628,13 +4670,13 @@ class TeamsBotInstallation {
|
|
4628
4670
|
* @returns An array of channels if bot is installed into a team, otherwise returns an empty array.
|
4629
4671
|
*/
|
4630
4672
|
channels() {
|
4631
|
-
return
|
4673
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4632
4674
|
const channels = [];
|
4633
4675
|
if (this.type !== exports.NotificationTargetType.Channel) {
|
4634
4676
|
return channels;
|
4635
4677
|
}
|
4636
4678
|
let teamsChannels = [];
|
4637
|
-
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) =>
|
4679
|
+
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4638
4680
|
const teamId = getTeamsBotInstallationId(context);
|
4639
4681
|
if (teamId !== undefined) {
|
4640
4682
|
teamsChannels = yield botbuilder.TeamsInfo.getTeamChannels(context, teamId);
|
@@ -4654,12 +4696,12 @@ class TeamsBotInstallation {
|
|
4654
4696
|
* @returns An array of members from where the bot is installed.
|
4655
4697
|
*/
|
4656
4698
|
getPagedMembers(pageSize, continuationToken) {
|
4657
|
-
return
|
4699
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4658
4700
|
let result = {
|
4659
4701
|
data: [],
|
4660
4702
|
continuationToken: "",
|
4661
4703
|
};
|
4662
|
-
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) =>
|
4704
|
+
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4663
4705
|
const pagedMembers = yield botbuilder.TeamsInfo.getPagedMembers(context, pageSize, continuationToken);
|
4664
4706
|
result = {
|
4665
4707
|
data: pagedMembers.members.map((m) => new Member(this, m)),
|
@@ -4677,7 +4719,7 @@ class TeamsBotInstallation {
|
|
4677
4719
|
* @deprecated Use `getPagedMembers` instead.
|
4678
4720
|
*/
|
4679
4721
|
members() {
|
4680
|
-
return
|
4722
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4681
4723
|
const members = [];
|
4682
4724
|
let continuationToken;
|
4683
4725
|
do {
|
@@ -4694,12 +4736,12 @@ class TeamsBotInstallation {
|
|
4694
4736
|
* @returns The team details if bot is installed into a team, otherwise returns `undefined`.
|
4695
4737
|
*/
|
4696
4738
|
getTeamDetails() {
|
4697
|
-
return
|
4739
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4698
4740
|
if (this.type !== exports.NotificationTargetType.Channel) {
|
4699
4741
|
return undefined;
|
4700
4742
|
}
|
4701
4743
|
let teamDetails;
|
4702
|
-
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) =>
|
4744
|
+
yield this.adapter.continueConversationAsync(this.botAppId, this.conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4703
4745
|
const teamId = getTeamsBotInstallationId(context);
|
4704
4746
|
if (teamId !== undefined) {
|
4705
4747
|
teamDetails = yield botbuilder.TeamsInfo.getTeamDetails(context, teamId);
|
@@ -4755,9 +4797,9 @@ class NotificationBot {
|
|
4755
4797
|
* @returns Returns false if recieves `BotNotInConversationRoster` error, otherwise returns true.
|
4756
4798
|
*/
|
4757
4799
|
validateInstallation(conversationReference) {
|
4758
|
-
return
|
4800
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4759
4801
|
let isValid = true;
|
4760
|
-
yield this.adapter.continueConversationAsync(this.botAppId, conversationReference, (context) =>
|
4802
|
+
yield this.adapter.continueConversationAsync(this.botAppId, conversationReference, (context) => __awaiter(this, void 0, void 0, function* () {
|
4761
4803
|
try {
|
4762
4804
|
// try get member to see if the installation is still valid
|
4763
4805
|
yield botbuilder.TeamsInfo.getPagedMembers(context, 1);
|
@@ -4783,7 +4825,7 @@ class NotificationBot {
|
|
4783
4825
|
* @returns An array of {@link TeamsBotInstallation} with paged data and continuation token.
|
4784
4826
|
*/
|
4785
4827
|
getPagedInstallations(pageSize, continuationToken, validationEnabled = true) {
|
4786
|
-
return
|
4828
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4787
4829
|
if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
|
4788
4830
|
throw new Error("NotificationBot has not been initialized.");
|
4789
4831
|
}
|
@@ -4820,7 +4862,7 @@ class NotificationBot {
|
|
4820
4862
|
* @deprecated Use getPagedInstallations instead.
|
4821
4863
|
*/
|
4822
4864
|
installations() {
|
4823
|
-
return
|
4865
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4824
4866
|
let continuationToken;
|
4825
4867
|
const targets = [];
|
4826
4868
|
do {
|
@@ -4843,7 +4885,7 @@ class NotificationBot {
|
|
4843
4885
|
* @returns The first {@link Member} where predicate is true, and `undefined` otherwise.
|
4844
4886
|
*/
|
4845
4887
|
findMember(predicate, scope) {
|
4846
|
-
return
|
4888
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4847
4889
|
for (const target of yield this.installations()) {
|
4848
4890
|
if (this.matchSearchScope(target, scope)) {
|
4849
4891
|
for (const member of yield target.members()) {
|
@@ -4867,7 +4909,7 @@ class NotificationBot {
|
|
4867
4909
|
* @returns The first {@link Channel} where predicate is true, and `undefined` otherwise.
|
4868
4910
|
*/
|
4869
4911
|
findChannel(predicate) {
|
4870
|
-
return
|
4912
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4871
4913
|
for (const target of yield this.installations()) {
|
4872
4914
|
if (target.type === exports.NotificationTargetType.Channel) {
|
4873
4915
|
const teamDetails = yield target.getTeamDetails();
|
@@ -4891,7 +4933,7 @@ class NotificationBot {
|
|
4891
4933
|
* @returns An array of {@link Member} where predicate is true, and empty array otherwise.
|
4892
4934
|
*/
|
4893
4935
|
findAllMembers(predicate, scope) {
|
4894
|
-
return
|
4936
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4895
4937
|
const members = [];
|
4896
4938
|
for (const target of yield this.installations()) {
|
4897
4939
|
if (this.matchSearchScope(target, scope)) {
|
@@ -4914,7 +4956,7 @@ class NotificationBot {
|
|
4914
4956
|
* @returns An array of {@link Channel} where predicate is true, and empty array otherwise.
|
4915
4957
|
*/
|
4916
4958
|
findAllChannels(predicate) {
|
4917
|
-
return
|
4959
|
+
return __awaiter(this, void 0, void 0, function* () {
|
4918
4960
|
const channels = [];
|
4919
4961
|
for (const target of yield this.installations()) {
|
4920
4962
|
if (target.type === exports.NotificationTargetType.Channel) {
|
@@ -5067,7 +5109,7 @@ class ConversationBot {
|
|
5067
5109
|
const botFrameworkAuthentication = new botbuilder.ConfigurationBotFrameworkAuthentication({}, credentialsFactory);
|
5068
5110
|
const adapter = new botbuilder.CloudAdapter(botFrameworkAuthentication);
|
5069
5111
|
// the default error handler
|
5070
|
-
adapter.onTurnError = (context, error) =>
|
5112
|
+
adapter.onTurnError = (context, error) => __awaiter(this, void 0, void 0, function* () {
|
5071
5113
|
// This check writes out errors to console.
|
5072
5114
|
console.error(`[onTurnError] unhandled error`, error);
|
5073
5115
|
// Send a trace activity, which will be displayed in Bot Framework Emulator
|
@@ -5102,10 +5144,10 @@ class ConversationBot {
|
|
5102
5144
|
* ```
|
5103
5145
|
*/
|
5104
5146
|
requestHandler(req, res, logic) {
|
5105
|
-
return
|
5147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
5106
5148
|
if (logic === undefined) {
|
5107
5149
|
// create empty logic
|
5108
|
-
logic = () =>
|
5150
|
+
logic = () => __awaiter(this, void 0, void 0, function* () { });
|
5109
5151
|
}
|
5110
5152
|
yield this.adapter.process(req, res, logic);
|
5111
5153
|
});
|