@microsoft/teamsfx 1.2.1-alpha.311dfaffe.0 → 1.2.1-alpha.34026982f.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 +16 -8
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +111 -34
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +16 -8
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +111 -34
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +4 -5
- package/types/teamsfx.d.ts +30 -10
package/dist/index.esm2017.mjs
CHANGED
|
@@ -532,7 +532,10 @@ class AppCredential {
|
|
|
532
532
|
*/
|
|
533
533
|
loadAndValidateConfig(config) {
|
|
534
534
|
internalLogger.verbose("Validate authentication configuration");
|
|
535
|
-
if (config.clientId &&
|
|
535
|
+
if (config.clientId &&
|
|
536
|
+
(config.clientSecret || config.certificateContent) &&
|
|
537
|
+
config.tenantId &&
|
|
538
|
+
config.authorityHost) {
|
|
536
539
|
return config;
|
|
537
540
|
}
|
|
538
541
|
const missingValues = [];
|
|
@@ -545,6 +548,9 @@ class AppCredential {
|
|
|
545
548
|
if (!config.tenantId) {
|
|
546
549
|
missingValues.push("tenantId");
|
|
547
550
|
}
|
|
551
|
+
if (!config.authorityHost) {
|
|
552
|
+
missingValues.push("authorityHost");
|
|
553
|
+
}
|
|
548
554
|
const errorMsg = formatString(ErrorMessage.InvalidConfiguration, missingValues.join(", "), "undefined");
|
|
549
555
|
internalLogger.error(errorMsg);
|
|
550
556
|
throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);
|
|
@@ -1247,9 +1253,6 @@ class TeamsBotSsoPrompt extends Dialog {
|
|
|
1247
1253
|
if (!this.teamsfx.hasConfig("tenantId")) {
|
|
1248
1254
|
missingConfigurations.push("tenantId");
|
|
1249
1255
|
}
|
|
1250
|
-
if (!this.teamsfx.hasConfig("applicationIdUri")) {
|
|
1251
|
-
missingConfigurations.push("applicationIdUri");
|
|
1252
|
-
}
|
|
1253
1256
|
if (missingConfigurations.length != 0) {
|
|
1254
1257
|
const errorMsg = formatString(ErrorMessage.InvalidConfiguration, missingConfigurations.join(", "), "undefined");
|
|
1255
1258
|
internalLogger.error(errorMsg);
|
|
@@ -1300,9 +1303,7 @@ class TeamsBotSsoPrompt extends Dialog {
|
|
|
1300
1303
|
internalLogger.verbose("Sign in link: " + signInLink);
|
|
1301
1304
|
const tokenExchangeResource = {
|
|
1302
1305
|
id: v4(),
|
|
1303
|
-
uri: this.teamsfx.getConfig("applicationIdUri").replace(/\/$/, "") + "/access_as_user",
|
|
1304
1306
|
};
|
|
1305
|
-
internalLogger.verbose("Token exchange resource uri: " + tokenExchangeResource.uri);
|
|
1306
1307
|
return {
|
|
1307
1308
|
signInLink: signInLink,
|
|
1308
1309
|
tokenExchangeResource: tokenExchangeResource,
|
|
@@ -2586,20 +2587,24 @@ class ConversationReferenceStore {
|
|
|
2586
2587
|
*
|
|
2587
2588
|
* @param target - the notification target.
|
|
2588
2589
|
* @param text - the plain text message.
|
|
2590
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
2591
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2589
2592
|
* @returns the response of sending message.
|
|
2590
2593
|
*/
|
|
2591
|
-
function sendMessage(target, text) {
|
|
2592
|
-
return target.sendMessage(text);
|
|
2594
|
+
function sendMessage(target, text, onError) {
|
|
2595
|
+
return target.sendMessage(text, onError);
|
|
2593
2596
|
}
|
|
2594
2597
|
/**
|
|
2595
2598
|
* Send an adaptive card message to a notification target.
|
|
2596
2599
|
*
|
|
2597
2600
|
* @param target - the notification target.
|
|
2598
2601
|
* @param card - the adaptive card raw JSON.
|
|
2602
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
2603
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2599
2604
|
* @returns the response of sending adaptive card message.
|
|
2600
2605
|
*/
|
|
2601
|
-
function sendAdaptiveCard(target, card) {
|
|
2602
|
-
return target.sendAdaptiveCard(card);
|
|
2606
|
+
function sendAdaptiveCard(target, card, onError) {
|
|
2607
|
+
return target.sendAdaptiveCard(card, onError);
|
|
2603
2608
|
}
|
|
2604
2609
|
/**
|
|
2605
2610
|
* A {@link NotificationTarget} that represents a team channel.
|
|
@@ -2629,15 +2634,27 @@ class Channel {
|
|
|
2629
2634
|
* Send a plain text message.
|
|
2630
2635
|
*
|
|
2631
2636
|
* @param text - the plain text message.
|
|
2637
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
2638
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2632
2639
|
* @returns the response of sending message.
|
|
2633
2640
|
*/
|
|
2634
|
-
async sendMessage(text) {
|
|
2641
|
+
async sendMessage(text, onError) {
|
|
2635
2642
|
const response = {};
|
|
2636
2643
|
await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
2637
2644
|
const conversation = await this.newConversation(context);
|
|
2638
2645
|
await this.parent.adapter.continueConversation(conversation, async (ctx) => {
|
|
2639
|
-
|
|
2640
|
-
|
|
2646
|
+
try {
|
|
2647
|
+
const res = await ctx.sendActivity(text);
|
|
2648
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2649
|
+
}
|
|
2650
|
+
catch (error) {
|
|
2651
|
+
if (onError) {
|
|
2652
|
+
await onError(ctx, error);
|
|
2653
|
+
}
|
|
2654
|
+
else {
|
|
2655
|
+
throw error;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2641
2658
|
});
|
|
2642
2659
|
});
|
|
2643
2660
|
return response;
|
|
@@ -2646,17 +2663,29 @@ class Channel {
|
|
|
2646
2663
|
* Send an adaptive card message.
|
|
2647
2664
|
*
|
|
2648
2665
|
* @param card - the adaptive card raw JSON.
|
|
2666
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
2667
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2649
2668
|
* @returns the response of sending adaptive card message.
|
|
2650
2669
|
*/
|
|
2651
|
-
async sendAdaptiveCard(card) {
|
|
2670
|
+
async sendAdaptiveCard(card, onError) {
|
|
2652
2671
|
const response = {};
|
|
2653
2672
|
await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
2654
2673
|
const conversation = await this.newConversation(context);
|
|
2655
2674
|
await this.parent.adapter.continueConversation(conversation, async (ctx) => {
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2675
|
+
try {
|
|
2676
|
+
const res = await ctx.sendActivity({
|
|
2677
|
+
attachments: [CardFactory.adaptiveCard(card)],
|
|
2678
|
+
});
|
|
2679
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2680
|
+
}
|
|
2681
|
+
catch (error) {
|
|
2682
|
+
if (onError) {
|
|
2683
|
+
await onError(ctx, error);
|
|
2684
|
+
}
|
|
2685
|
+
else {
|
|
2686
|
+
throw error;
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2660
2689
|
});
|
|
2661
2690
|
});
|
|
2662
2691
|
return response;
|
|
@@ -2699,15 +2728,27 @@ class Member {
|
|
|
2699
2728
|
* Send a plain text message.
|
|
2700
2729
|
*
|
|
2701
2730
|
* @param text - the plain text message.
|
|
2731
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
2732
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2702
2733
|
* @returns the response of sending message.
|
|
2703
2734
|
*/
|
|
2704
|
-
async sendMessage(text) {
|
|
2735
|
+
async sendMessage(text, onError) {
|
|
2705
2736
|
const response = {};
|
|
2706
2737
|
await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
2707
2738
|
const conversation = await this.newConversation(context);
|
|
2708
2739
|
await this.parent.adapter.continueConversation(conversation, async (ctx) => {
|
|
2709
|
-
|
|
2710
|
-
|
|
2740
|
+
try {
|
|
2741
|
+
const res = await ctx.sendActivity(text);
|
|
2742
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2743
|
+
}
|
|
2744
|
+
catch (error) {
|
|
2745
|
+
if (onError) {
|
|
2746
|
+
await onError(ctx, error);
|
|
2747
|
+
}
|
|
2748
|
+
else {
|
|
2749
|
+
throw error;
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2711
2752
|
});
|
|
2712
2753
|
});
|
|
2713
2754
|
return response;
|
|
@@ -2716,17 +2757,29 @@ class Member {
|
|
|
2716
2757
|
* Send an adaptive card message.
|
|
2717
2758
|
*
|
|
2718
2759
|
* @param card - the adaptive card raw JSON.
|
|
2760
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
2761
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2719
2762
|
* @returns the response of sending adaptive card message.
|
|
2720
2763
|
*/
|
|
2721
|
-
async sendAdaptiveCard(card) {
|
|
2764
|
+
async sendAdaptiveCard(card, onError) {
|
|
2722
2765
|
const response = {};
|
|
2723
2766
|
await this.parent.adapter.continueConversation(this.parent.conversationReference, async (context) => {
|
|
2724
2767
|
const conversation = await this.newConversation(context);
|
|
2725
2768
|
await this.parent.adapter.continueConversation(conversation, async (ctx) => {
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2769
|
+
try {
|
|
2770
|
+
const res = await ctx.sendActivity({
|
|
2771
|
+
attachments: [CardFactory.adaptiveCard(card)],
|
|
2772
|
+
});
|
|
2773
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2774
|
+
}
|
|
2775
|
+
catch (error) {
|
|
2776
|
+
if (onError) {
|
|
2777
|
+
await onError(ctx, error);
|
|
2778
|
+
}
|
|
2779
|
+
else {
|
|
2780
|
+
throw error;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2730
2783
|
});
|
|
2731
2784
|
});
|
|
2732
2785
|
return response;
|
|
@@ -2777,13 +2830,25 @@ class TeamsBotInstallation {
|
|
|
2777
2830
|
* Send a plain text message.
|
|
2778
2831
|
*
|
|
2779
2832
|
* @param text - the plain text message.
|
|
2833
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
2834
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2780
2835
|
* @returns the response of sending message.
|
|
2781
2836
|
*/
|
|
2782
|
-
async sendMessage(text) {
|
|
2837
|
+
async sendMessage(text, onError) {
|
|
2783
2838
|
const response = {};
|
|
2784
2839
|
await this.adapter.continueConversation(this.conversationReference, async (context) => {
|
|
2785
|
-
|
|
2786
|
-
|
|
2840
|
+
try {
|
|
2841
|
+
const res = await context.sendActivity(text);
|
|
2842
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2843
|
+
}
|
|
2844
|
+
catch (error) {
|
|
2845
|
+
if (onError) {
|
|
2846
|
+
await onError(context, error);
|
|
2847
|
+
}
|
|
2848
|
+
else {
|
|
2849
|
+
throw error;
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2787
2852
|
});
|
|
2788
2853
|
return response;
|
|
2789
2854
|
}
|
|
@@ -2791,15 +2856,27 @@ class TeamsBotInstallation {
|
|
|
2791
2856
|
* Send an adaptive card message.
|
|
2792
2857
|
*
|
|
2793
2858
|
* @param card - the adaptive card raw JSON.
|
|
2859
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
2860
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2794
2861
|
* @returns the response of sending adaptive card message.
|
|
2795
2862
|
*/
|
|
2796
|
-
async sendAdaptiveCard(card) {
|
|
2863
|
+
async sendAdaptiveCard(card, onError) {
|
|
2797
2864
|
const response = {};
|
|
2798
2865
|
await this.adapter.continueConversation(this.conversationReference, async (context) => {
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2866
|
+
try {
|
|
2867
|
+
const res = await context.sendActivity({
|
|
2868
|
+
attachments: [CardFactory.adaptiveCard(card)],
|
|
2869
|
+
});
|
|
2870
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2871
|
+
}
|
|
2872
|
+
catch (error) {
|
|
2873
|
+
if (onError) {
|
|
2874
|
+
await onError(context, error);
|
|
2875
|
+
}
|
|
2876
|
+
else {
|
|
2877
|
+
throw error;
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2803
2880
|
});
|
|
2804
2881
|
return response;
|
|
2805
2882
|
}
|