@microsoft/teamsfx 0.7.1-beta.c23501411.0 → 0.7.1-beta.dc88fcdc0.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.esm2017.mjs +65 -38
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.node.cjs.js +67 -38
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
package/dist/index.node.cjs.js
CHANGED
|
@@ -1968,6 +1968,41 @@ class TeamsFx {
|
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
1970
|
|
|
1971
|
+
// Copyright (c) Microsoft Corporation.
|
|
1972
|
+
// Licensed under the MIT license.
|
|
1973
|
+
/**
|
|
1974
|
+
* @internal
|
|
1975
|
+
*/
|
|
1976
|
+
function cloneConversation(conversation) {
|
|
1977
|
+
return JSON.parse(JSON.stringify(conversation));
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* @internal
|
|
1981
|
+
*/
|
|
1982
|
+
function getTargetType(conversationReference) {
|
|
1983
|
+
var _a;
|
|
1984
|
+
const conversationType = (_a = conversationReference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
|
|
1985
|
+
if (conversationType === "personal") {
|
|
1986
|
+
return "Person";
|
|
1987
|
+
}
|
|
1988
|
+
else if (conversationType === "groupChat") {
|
|
1989
|
+
return "Group";
|
|
1990
|
+
}
|
|
1991
|
+
else if (conversationType === "channel") {
|
|
1992
|
+
return "Channel";
|
|
1993
|
+
}
|
|
1994
|
+
else {
|
|
1995
|
+
return undefined;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1999
|
+
* @internal
|
|
2000
|
+
*/
|
|
2001
|
+
function getTeamsBotInstallationId(context) {
|
|
2002
|
+
var _a, _b, _c, _d;
|
|
2003
|
+
return (_d = (_c = (_b = (_a = context.activity) === null || _a === void 0 ? void 0 : _a.channelData) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : context.activity.conversation.id;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
1971
2006
|
// Copyright (c) Microsoft Corporation.
|
|
1972
2007
|
/**
|
|
1973
2008
|
* @internal
|
|
@@ -1998,6 +2033,10 @@ class NotificationMiddleware {
|
|
|
1998
2033
|
yield this.conversationReferenceStore.set(reference);
|
|
1999
2034
|
break;
|
|
2000
2035
|
}
|
|
2036
|
+
case ActivityType.CurrentBotMessaged: {
|
|
2037
|
+
yield this.tryAddMessagedReference(context);
|
|
2038
|
+
break;
|
|
2039
|
+
}
|
|
2001
2040
|
case ActivityType.CurrentBotUninstalled:
|
|
2002
2041
|
case ActivityType.TeamDeleted: {
|
|
2003
2042
|
const reference = botbuilder.TurnContext.getConversationReference(context.activity);
|
|
@@ -2029,8 +2068,33 @@ class NotificationMiddleware {
|
|
|
2029
2068
|
return ActivityType.TeamRestored;
|
|
2030
2069
|
}
|
|
2031
2070
|
}
|
|
2071
|
+
else if (activityType === "message") {
|
|
2072
|
+
return ActivityType.CurrentBotMessaged;
|
|
2073
|
+
}
|
|
2032
2074
|
return ActivityType.Unknown;
|
|
2033
2075
|
}
|
|
2076
|
+
tryAddMessagedReference(context) {
|
|
2077
|
+
var _a, _b, _c, _d;
|
|
2078
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2079
|
+
const reference = botbuilder.TurnContext.getConversationReference(context.activity);
|
|
2080
|
+
const conversationType = (_a = reference === null || reference === void 0 ? void 0 : reference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
|
|
2081
|
+
if (conversationType === "personal" || conversationType === "groupChat") {
|
|
2082
|
+
if (!(yield this.conversationReferenceStore.check(reference))) {
|
|
2083
|
+
yield this.conversationReferenceStore.set(reference);
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
else if (conversationType === "channel") {
|
|
2087
|
+
const teamId = (_d = (_c = (_b = context.activity) === null || _b === void 0 ? void 0 : _b.channelData) === null || _c === void 0 ? void 0 : _c.team) === null || _d === void 0 ? void 0 : _d.id;
|
|
2088
|
+
if (teamId !== undefined) {
|
|
2089
|
+
const teamReference = cloneConversation(reference);
|
|
2090
|
+
teamReference.conversation.id = teamId;
|
|
2091
|
+
if (!(yield this.conversationReferenceStore.check(teamReference))) {
|
|
2092
|
+
yield this.conversationReferenceStore.set(teamReference);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2034
2098
|
}
|
|
2035
2099
|
class CommandResponseMiddleware {
|
|
2036
2100
|
constructor(handlers) {
|
|
@@ -2283,41 +2347,6 @@ class ConversationReferenceStore {
|
|
|
2283
2347
|
}
|
|
2284
2348
|
}
|
|
2285
2349
|
|
|
2286
|
-
// Copyright (c) Microsoft Corporation.
|
|
2287
|
-
// Licensed under the MIT license.
|
|
2288
|
-
/**
|
|
2289
|
-
* @internal
|
|
2290
|
-
*/
|
|
2291
|
-
function cloneConversation(conversation) {
|
|
2292
|
-
return Object.assign({}, conversation);
|
|
2293
|
-
}
|
|
2294
|
-
/**
|
|
2295
|
-
* @internal
|
|
2296
|
-
*/
|
|
2297
|
-
function getTargetType(conversationReference) {
|
|
2298
|
-
var _a;
|
|
2299
|
-
const conversationType = (_a = conversationReference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
|
|
2300
|
-
if (conversationType === "personal") {
|
|
2301
|
-
return "Person";
|
|
2302
|
-
}
|
|
2303
|
-
else if (conversationType === "groupChat") {
|
|
2304
|
-
return "Group";
|
|
2305
|
-
}
|
|
2306
|
-
else if (conversationType === "channel") {
|
|
2307
|
-
return "Channel";
|
|
2308
|
-
}
|
|
2309
|
-
else {
|
|
2310
|
-
return undefined;
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
/**
|
|
2314
|
-
* @internal
|
|
2315
|
-
*/
|
|
2316
|
-
function getTeamsBotInstallationId(context) {
|
|
2317
|
-
var _a, _b, _c, _d;
|
|
2318
|
-
return (_d = (_c = (_b = (_a = context.activity) === null || _a === void 0 ? void 0 : _a.channelData) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : context.activity.conversation.id;
|
|
2319
|
-
}
|
|
2320
|
-
|
|
2321
2350
|
// Copyright (c) Microsoft Corporation.
|
|
2322
2351
|
/**
|
|
2323
2352
|
* Send a plain text message to a notification target.
|
|
@@ -2650,12 +2679,12 @@ class NotificationBot {
|
|
|
2650
2679
|
if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
|
|
2651
2680
|
throw new Error("NotificationBot has not been initialized.");
|
|
2652
2681
|
}
|
|
2653
|
-
const references =
|
|
2682
|
+
const references = yield this.conversationReferenceStore.getAll();
|
|
2654
2683
|
const targets = [];
|
|
2655
2684
|
for (const reference of references) {
|
|
2656
2685
|
// validate connection
|
|
2657
2686
|
let valid = true;
|
|
2658
|
-
this.adapter.continueConversation(reference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2687
|
+
yield this.adapter.continueConversation(reference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2659
2688
|
try {
|
|
2660
2689
|
// try get member to see if the installation is still valid
|
|
2661
2690
|
yield botbuilder.TeamsInfo.getPagedMembers(context, 1);
|
|
@@ -2670,7 +2699,7 @@ class NotificationBot {
|
|
|
2670
2699
|
targets.push(new TeamsBotInstallation(this.adapter, reference));
|
|
2671
2700
|
}
|
|
2672
2701
|
else {
|
|
2673
|
-
this.conversationReferenceStore.delete(reference);
|
|
2702
|
+
yield this.conversationReferenceStore.delete(reference);
|
|
2674
2703
|
}
|
|
2675
2704
|
}
|
|
2676
2705
|
return targets;
|