@microsoft/teamsfx 1.0.3-alpha.c580d88b2.0 → 1.0.3-alpha.dad1471c2.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.js +37 -9
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +75 -30
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +37 -9
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +88 -35
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
- package/types/teamsfx.d.ts +53 -19
package/dist/index.esm2017.mjs
CHANGED
|
@@ -295,6 +295,7 @@ function getUserInfoFromSsoToken(ssoToken) {
|
|
|
295
295
|
const userInfo = {
|
|
296
296
|
displayName: tokenObject.name,
|
|
297
297
|
objectId: tokenObject.oid,
|
|
298
|
+
tenantId: tokenObject.tid,
|
|
298
299
|
preferredUserName: "",
|
|
299
300
|
};
|
|
300
301
|
if (tokenObject.ver === "2.0") {
|
|
@@ -1814,6 +1815,32 @@ class TeamsFx {
|
|
|
1814
1815
|
|
|
1815
1816
|
// Copyright (c) Microsoft Corporation.
|
|
1816
1817
|
// Licensed under the MIT license.
|
|
1818
|
+
/**
|
|
1819
|
+
* The target type where the notification will be sent to.
|
|
1820
|
+
*
|
|
1821
|
+
* @remarks
|
|
1822
|
+
* - "Channel" means to a team channel. (By default, notification to a team will be sent to its "General" channel.)
|
|
1823
|
+
* - "Group" means to a group chat.
|
|
1824
|
+
* - "Person" means to a personal chat.
|
|
1825
|
+
*/
|
|
1826
|
+
var NotificationTargetType;
|
|
1827
|
+
(function (NotificationTargetType) {
|
|
1828
|
+
/**
|
|
1829
|
+
* The notification will be sent to a team channel.
|
|
1830
|
+
* (By default, notification to a team will be sent to its "General" channel.)
|
|
1831
|
+
*/
|
|
1832
|
+
NotificationTargetType["Channel"] = "Channel";
|
|
1833
|
+
/**
|
|
1834
|
+
* The notification will be sent to a group chat.
|
|
1835
|
+
*/
|
|
1836
|
+
NotificationTargetType["Group"] = "Group";
|
|
1837
|
+
/**
|
|
1838
|
+
* The notification will be sent to a personal chat.
|
|
1839
|
+
*/
|
|
1840
|
+
NotificationTargetType["Person"] = "Person";
|
|
1841
|
+
})(NotificationTargetType || (NotificationTargetType = {}));
|
|
1842
|
+
|
|
1843
|
+
// Copyright (c) Microsoft Corporation.
|
|
1817
1844
|
/**
|
|
1818
1845
|
* @internal
|
|
1819
1846
|
*/
|
|
@@ -1827,13 +1854,13 @@ function getTargetType(conversationReference) {
|
|
|
1827
1854
|
var _a;
|
|
1828
1855
|
const conversationType = (_a = conversationReference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
|
|
1829
1856
|
if (conversationType === "personal") {
|
|
1830
|
-
return
|
|
1857
|
+
return NotificationTargetType.Person;
|
|
1831
1858
|
}
|
|
1832
1859
|
else if (conversationType === "groupChat") {
|
|
1833
|
-
return
|
|
1860
|
+
return NotificationTargetType.Group;
|
|
1834
1861
|
}
|
|
1835
1862
|
else if (conversationType === "channel") {
|
|
1836
|
-
return
|
|
1863
|
+
return NotificationTargetType.Channel;
|
|
1837
1864
|
}
|
|
1838
1865
|
else {
|
|
1839
1866
|
return undefined;
|
|
@@ -2171,7 +2198,7 @@ class ConversationReferenceStore {
|
|
|
2171
2198
|
*
|
|
2172
2199
|
* @param target - the notification target.
|
|
2173
2200
|
* @param text - the plain text message.
|
|
2174
|
-
* @returns
|
|
2201
|
+
* @returns the response of sending message.
|
|
2175
2202
|
*/
|
|
2176
2203
|
function sendMessage(target, text) {
|
|
2177
2204
|
return target.sendMessage(text);
|
|
@@ -2181,7 +2208,7 @@ function sendMessage(target, text) {
|
|
|
2181
2208
|
*
|
|
2182
2209
|
* @param target - the notification target.
|
|
2183
2210
|
* @param card - the adaptive card raw JSON.
|
|
2184
|
-
* @returns
|
|
2211
|
+
* @returns the response of sending adaptive card message.
|
|
2185
2212
|
*/
|
|
2186
2213
|
function sendAdaptiveCard(target, card) {
|
|
2187
2214
|
return target.sendAdaptiveCard(card);
|
|
@@ -2206,7 +2233,7 @@ class Channel {
|
|
|
2206
2233
|
/**
|
|
2207
2234
|
* Notification target type. For channel it's always "Channel".
|
|
2208
2235
|
*/
|
|
2209
|
-
this.type =
|
|
2236
|
+
this.type = NotificationTargetType.Channel;
|
|
2210
2237
|
this.parent = parent;
|
|
2211
2238
|
this.info = info;
|
|
2212
2239
|
}
|
|
@@ -2214,31 +2241,37 @@ class Channel {
|
|
|
2214
2241
|
* Send a plain text message.
|
|
2215
2242
|
*
|
|
2216
2243
|
* @param text - the plain text message.
|
|
2217
|
-
* @returns
|
|
2244
|
+
* @returns the response of sending message.
|
|
2218
2245
|
*/
|
|
2219
|
-
sendMessage(text) {
|
|
2220
|
-
|
|
2246
|
+
async sendMessage(text) {
|
|
2247
|
+
const response = {};
|
|
2248
|
+
await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
2221
2249
|
const conversation = await this.newConversation(context);
|
|
2222
2250
|
await this.parent.adapter.continueConversation(conversation, async (ctx) => {
|
|
2223
|
-
await ctx.sendActivity(text);
|
|
2251
|
+
const res = await ctx.sendActivity(text);
|
|
2252
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2224
2253
|
});
|
|
2225
2254
|
});
|
|
2255
|
+
return response;
|
|
2226
2256
|
}
|
|
2227
2257
|
/**
|
|
2228
2258
|
* Send an adaptive card message.
|
|
2229
2259
|
*
|
|
2230
2260
|
* @param card - the adaptive card raw JSON.
|
|
2231
|
-
* @returns
|
|
2261
|
+
* @returns the response of sending adaptive card message.
|
|
2232
2262
|
*/
|
|
2233
2263
|
async sendAdaptiveCard(card) {
|
|
2234
|
-
|
|
2264
|
+
const response = {};
|
|
2265
|
+
await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
2235
2266
|
const conversation = await this.newConversation(context);
|
|
2236
2267
|
await this.parent.adapter.continueConversation(conversation, async (ctx) => {
|
|
2237
|
-
await ctx.sendActivity({
|
|
2268
|
+
const res = await ctx.sendActivity({
|
|
2238
2269
|
attachments: [CardFactory.adaptiveCard(card)],
|
|
2239
2270
|
});
|
|
2271
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2240
2272
|
});
|
|
2241
2273
|
});
|
|
2274
|
+
return response;
|
|
2242
2275
|
}
|
|
2243
2276
|
/**
|
|
2244
2277
|
* @internal
|
|
@@ -2270,7 +2303,7 @@ class Member {
|
|
|
2270
2303
|
/**
|
|
2271
2304
|
* Notification target type. For member it's always "Person".
|
|
2272
2305
|
*/
|
|
2273
|
-
this.type =
|
|
2306
|
+
this.type = NotificationTargetType.Person;
|
|
2274
2307
|
this.parent = parent;
|
|
2275
2308
|
this.account = account;
|
|
2276
2309
|
}
|
|
@@ -2278,31 +2311,37 @@ class Member {
|
|
|
2278
2311
|
* Send a plain text message.
|
|
2279
2312
|
*
|
|
2280
2313
|
* @param text - the plain text message.
|
|
2281
|
-
* @returns
|
|
2314
|
+
* @returns the response of sending message.
|
|
2282
2315
|
*/
|
|
2283
|
-
sendMessage(text) {
|
|
2284
|
-
|
|
2316
|
+
async sendMessage(text) {
|
|
2317
|
+
const response = {};
|
|
2318
|
+
await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
2285
2319
|
const conversation = await this.newConversation(context);
|
|
2286
2320
|
await this.parent.adapter.continueConversation(conversation, async (ctx) => {
|
|
2287
|
-
await ctx.sendActivity(text);
|
|
2321
|
+
const res = await ctx.sendActivity(text);
|
|
2322
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2288
2323
|
});
|
|
2289
2324
|
});
|
|
2325
|
+
return response;
|
|
2290
2326
|
}
|
|
2291
2327
|
/**
|
|
2292
2328
|
* Send an adaptive card message.
|
|
2293
2329
|
*
|
|
2294
2330
|
* @param card - the adaptive card raw JSON.
|
|
2295
|
-
* @returns
|
|
2331
|
+
* @returns the response of sending adaptive card message.
|
|
2296
2332
|
*/
|
|
2297
2333
|
async sendAdaptiveCard(card) {
|
|
2298
|
-
|
|
2334
|
+
const response = {};
|
|
2335
|
+
await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
2299
2336
|
const conversation = await this.newConversation(context);
|
|
2300
2337
|
await this.parent.adapter.continueConversation(conversation, async (ctx) => {
|
|
2301
|
-
await ctx.sendActivity({
|
|
2338
|
+
const res = await ctx.sendActivity({
|
|
2302
2339
|
attachments: [CardFactory.adaptiveCard(card)],
|
|
2303
2340
|
});
|
|
2341
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2304
2342
|
});
|
|
2305
2343
|
});
|
|
2344
|
+
return response;
|
|
2306
2345
|
}
|
|
2307
2346
|
/**
|
|
2308
2347
|
* @internal
|
|
@@ -2350,25 +2389,31 @@ class TeamsBotInstallation {
|
|
|
2350
2389
|
* Send a plain text message.
|
|
2351
2390
|
*
|
|
2352
2391
|
* @param text - the plain text message.
|
|
2353
|
-
* @returns
|
|
2392
|
+
* @returns the response of sending message.
|
|
2354
2393
|
*/
|
|
2355
|
-
sendMessage(text) {
|
|
2356
|
-
|
|
2357
|
-
|
|
2394
|
+
async sendMessage(text) {
|
|
2395
|
+
const response = {};
|
|
2396
|
+
await this.adapter.continueConversation(this.conversationReference, async (context) => {
|
|
2397
|
+
const res = await context.sendActivity(text);
|
|
2398
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2358
2399
|
});
|
|
2400
|
+
return response;
|
|
2359
2401
|
}
|
|
2360
2402
|
/**
|
|
2361
2403
|
* Send an adaptive card message.
|
|
2362
2404
|
*
|
|
2363
2405
|
* @param card - the adaptive card raw JSON.
|
|
2364
|
-
* @returns
|
|
2406
|
+
* @returns the response of sending adaptive card message.
|
|
2365
2407
|
*/
|
|
2366
|
-
sendAdaptiveCard(card) {
|
|
2367
|
-
|
|
2368
|
-
|
|
2408
|
+
async sendAdaptiveCard(card) {
|
|
2409
|
+
const response = {};
|
|
2410
|
+
await this.adapter.continueConversation(this.conversationReference, async (context) => {
|
|
2411
|
+
const res = await context.sendActivity({
|
|
2369
2412
|
attachments: [CardFactory.adaptiveCard(card)],
|
|
2370
2413
|
});
|
|
2414
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2371
2415
|
});
|
|
2416
|
+
return response;
|
|
2372
2417
|
}
|
|
2373
2418
|
/**
|
|
2374
2419
|
* Get channels from this bot installation.
|
|
@@ -2730,5 +2775,5 @@ class MessageBuilder {
|
|
|
2730
2775
|
}
|
|
2731
2776
|
}
|
|
2732
2777
|
|
|
2733
|
-
export { ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MessageBuilder, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
2778
|
+
export { ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MessageBuilder, MsGraphAuthProvider, NotificationBot, NotificationTargetType, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
|
|
2734
2779
|
//# sourceMappingURL=index.esm2017.mjs.map
|