@microsoft/teamsfx 0.7.1-beta.94bfabf9b.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 +52 -42
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.node.cjs.js +52 -42
- 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
|
|
@@ -1999,8 +2034,7 @@ class NotificationMiddleware {
|
|
|
1999
2034
|
break;
|
|
2000
2035
|
}
|
|
2001
2036
|
case ActivityType.CurrentBotMessaged: {
|
|
2002
|
-
|
|
2003
|
-
yield this.tryAddMessagedReference(reference);
|
|
2037
|
+
yield this.tryAddMessagedReference(context);
|
|
2004
2038
|
break;
|
|
2005
2039
|
}
|
|
2006
2040
|
case ActivityType.CurrentBotUninstalled:
|
|
@@ -2039,15 +2073,26 @@ class NotificationMiddleware {
|
|
|
2039
2073
|
}
|
|
2040
2074
|
return ActivityType.Unknown;
|
|
2041
2075
|
}
|
|
2042
|
-
tryAddMessagedReference(
|
|
2043
|
-
var _a;
|
|
2076
|
+
tryAddMessagedReference(context) {
|
|
2077
|
+
var _a, _b, _c, _d;
|
|
2044
2078
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2079
|
+
const reference = botbuilder.TurnContext.getConversationReference(context.activity);
|
|
2045
2080
|
const conversationType = (_a = reference === null || reference === void 0 ? void 0 : reference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
|
|
2046
2081
|
if (conversationType === "personal" || conversationType === "groupChat") {
|
|
2047
2082
|
if (!(yield this.conversationReferenceStore.check(reference))) {
|
|
2048
2083
|
yield this.conversationReferenceStore.set(reference);
|
|
2049
2084
|
}
|
|
2050
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
|
+
}
|
|
2051
2096
|
});
|
|
2052
2097
|
}
|
|
2053
2098
|
}
|
|
@@ -2302,41 +2347,6 @@ class ConversationReferenceStore {
|
|
|
2302
2347
|
}
|
|
2303
2348
|
}
|
|
2304
2349
|
|
|
2305
|
-
// Copyright (c) Microsoft Corporation.
|
|
2306
|
-
// Licensed under the MIT license.
|
|
2307
|
-
/**
|
|
2308
|
-
* @internal
|
|
2309
|
-
*/
|
|
2310
|
-
function cloneConversation(conversation) {
|
|
2311
|
-
return Object.assign({}, conversation);
|
|
2312
|
-
}
|
|
2313
|
-
/**
|
|
2314
|
-
* @internal
|
|
2315
|
-
*/
|
|
2316
|
-
function getTargetType(conversationReference) {
|
|
2317
|
-
var _a;
|
|
2318
|
-
const conversationType = (_a = conversationReference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
|
|
2319
|
-
if (conversationType === "personal") {
|
|
2320
|
-
return "Person";
|
|
2321
|
-
}
|
|
2322
|
-
else if (conversationType === "groupChat") {
|
|
2323
|
-
return "Group";
|
|
2324
|
-
}
|
|
2325
|
-
else if (conversationType === "channel") {
|
|
2326
|
-
return "Channel";
|
|
2327
|
-
}
|
|
2328
|
-
else {
|
|
2329
|
-
return undefined;
|
|
2330
|
-
}
|
|
2331
|
-
}
|
|
2332
|
-
/**
|
|
2333
|
-
* @internal
|
|
2334
|
-
*/
|
|
2335
|
-
function getTeamsBotInstallationId(context) {
|
|
2336
|
-
var _a, _b, _c, _d;
|
|
2337
|
-
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;
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
2350
|
// Copyright (c) Microsoft Corporation.
|
|
2341
2351
|
/**
|
|
2342
2352
|
* Send a plain text message to a notification target.
|
|
@@ -2669,12 +2679,12 @@ class NotificationBot {
|
|
|
2669
2679
|
if (this.conversationReferenceStore === undefined || this.adapter === undefined) {
|
|
2670
2680
|
throw new Error("NotificationBot has not been initialized.");
|
|
2671
2681
|
}
|
|
2672
|
-
const references =
|
|
2682
|
+
const references = yield this.conversationReferenceStore.getAll();
|
|
2673
2683
|
const targets = [];
|
|
2674
2684
|
for (const reference of references) {
|
|
2675
2685
|
// validate connection
|
|
2676
2686
|
let valid = true;
|
|
2677
|
-
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* () {
|
|
2678
2688
|
try {
|
|
2679
2689
|
// try get member to see if the installation is still valid
|
|
2680
2690
|
yield botbuilder.TeamsInfo.getPagedMembers(context, 1);
|
|
@@ -2689,7 +2699,7 @@ class NotificationBot {
|
|
|
2689
2699
|
targets.push(new TeamsBotInstallation(this.adapter, reference));
|
|
2690
2700
|
}
|
|
2691
2701
|
else {
|
|
2692
|
-
this.conversationReferenceStore.delete(reference);
|
|
2702
|
+
yield this.conversationReferenceStore.delete(reference);
|
|
2693
2703
|
}
|
|
2694
2704
|
}
|
|
2695
2705
|
return targets;
|