@microsoft/teamsfx 1.2.1-alpha.39751981b.0 → 1.2.1-alpha.68dc011f1.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 -29
- 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 -29
- package/dist/index.node.cjs.js.map +1 -1
- package/package.json +3 -3
- package/types/teamsfx.d.ts +30 -10
package/dist/index.node.cjs.js
CHANGED
|
@@ -563,7 +563,10 @@ class AppCredential {
|
|
|
563
563
|
*/
|
|
564
564
|
loadAndValidateConfig(config) {
|
|
565
565
|
internalLogger.verbose("Validate authentication configuration");
|
|
566
|
-
if (config.clientId &&
|
|
566
|
+
if (config.clientId &&
|
|
567
|
+
(config.clientSecret || config.certificateContent) &&
|
|
568
|
+
config.tenantId &&
|
|
569
|
+
config.authorityHost) {
|
|
567
570
|
return config;
|
|
568
571
|
}
|
|
569
572
|
const missingValues = [];
|
|
@@ -576,6 +579,9 @@ class AppCredential {
|
|
|
576
579
|
if (!config.tenantId) {
|
|
577
580
|
missingValues.push("tenantId");
|
|
578
581
|
}
|
|
582
|
+
if (!config.authorityHost) {
|
|
583
|
+
missingValues.push("authorityHost");
|
|
584
|
+
}
|
|
579
585
|
const errorMsg = formatString(ErrorMessage.InvalidConfiguration, missingValues.join(", "), "undefined");
|
|
580
586
|
internalLogger.error(errorMsg);
|
|
581
587
|
throw new ErrorWithCode(errorMsg, exports.ErrorCode.InvalidConfiguration);
|
|
@@ -2675,20 +2681,24 @@ class ConversationReferenceStore {
|
|
|
2675
2681
|
*
|
|
2676
2682
|
* @param target - the notification target.
|
|
2677
2683
|
* @param text - the plain text message.
|
|
2684
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
2685
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2678
2686
|
* @returns the response of sending message.
|
|
2679
2687
|
*/
|
|
2680
|
-
function sendMessage(target, text) {
|
|
2681
|
-
return target.sendMessage(text);
|
|
2688
|
+
function sendMessage(target, text, onError) {
|
|
2689
|
+
return target.sendMessage(text, onError);
|
|
2682
2690
|
}
|
|
2683
2691
|
/**
|
|
2684
2692
|
* Send an adaptive card message to a notification target.
|
|
2685
2693
|
*
|
|
2686
2694
|
* @param target - the notification target.
|
|
2687
2695
|
* @param card - the adaptive card raw JSON.
|
|
2696
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
2697
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2688
2698
|
* @returns the response of sending adaptive card message.
|
|
2689
2699
|
*/
|
|
2690
|
-
function sendAdaptiveCard(target, card) {
|
|
2691
|
-
return target.sendAdaptiveCard(card);
|
|
2700
|
+
function sendAdaptiveCard(target, card, onError) {
|
|
2701
|
+
return target.sendAdaptiveCard(card, onError);
|
|
2692
2702
|
}
|
|
2693
2703
|
/**
|
|
2694
2704
|
* A {@link NotificationTarget} that represents a team channel.
|
|
@@ -2718,16 +2728,28 @@ class Channel {
|
|
|
2718
2728
|
* Send a plain text message.
|
|
2719
2729
|
*
|
|
2720
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`.
|
|
2721
2733
|
* @returns the response of sending message.
|
|
2722
2734
|
*/
|
|
2723
|
-
sendMessage(text) {
|
|
2735
|
+
sendMessage(text, onError) {
|
|
2724
2736
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2725
2737
|
const response = {};
|
|
2726
2738
|
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2727
2739
|
const conversation = yield this.newConversation(context);
|
|
2728
2740
|
yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2729
|
-
|
|
2730
|
-
|
|
2741
|
+
try {
|
|
2742
|
+
const res = yield ctx.sendActivity(text);
|
|
2743
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2744
|
+
}
|
|
2745
|
+
catch (error) {
|
|
2746
|
+
if (onError) {
|
|
2747
|
+
yield onError(ctx, error);
|
|
2748
|
+
}
|
|
2749
|
+
else {
|
|
2750
|
+
throw error;
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2731
2753
|
}));
|
|
2732
2754
|
}));
|
|
2733
2755
|
return response;
|
|
@@ -2737,18 +2759,30 @@ class Channel {
|
|
|
2737
2759
|
* Send an adaptive card message.
|
|
2738
2760
|
*
|
|
2739
2761
|
* @param card - the adaptive card raw JSON.
|
|
2762
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
2763
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2740
2764
|
* @returns the response of sending adaptive card message.
|
|
2741
2765
|
*/
|
|
2742
|
-
sendAdaptiveCard(card) {
|
|
2766
|
+
sendAdaptiveCard(card, onError) {
|
|
2743
2767
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2744
2768
|
const response = {};
|
|
2745
2769
|
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2746
2770
|
const conversation = yield this.newConversation(context);
|
|
2747
2771
|
yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2772
|
+
try {
|
|
2773
|
+
const res = yield ctx.sendActivity({
|
|
2774
|
+
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
|
2775
|
+
});
|
|
2776
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2777
|
+
}
|
|
2778
|
+
catch (error) {
|
|
2779
|
+
if (onError) {
|
|
2780
|
+
yield onError(ctx, error);
|
|
2781
|
+
}
|
|
2782
|
+
else {
|
|
2783
|
+
throw error;
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2752
2786
|
}));
|
|
2753
2787
|
}));
|
|
2754
2788
|
return response;
|
|
@@ -2794,16 +2828,28 @@ class Member {
|
|
|
2794
2828
|
* Send a plain text message.
|
|
2795
2829
|
*
|
|
2796
2830
|
* @param text - the plain text message.
|
|
2831
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
2832
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2797
2833
|
* @returns the response of sending message.
|
|
2798
2834
|
*/
|
|
2799
|
-
sendMessage(text) {
|
|
2835
|
+
sendMessage(text, onError) {
|
|
2800
2836
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2801
2837
|
const response = {};
|
|
2802
2838
|
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2803
2839
|
const conversation = yield this.newConversation(context);
|
|
2804
2840
|
yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2805
|
-
|
|
2806
|
-
|
|
2841
|
+
try {
|
|
2842
|
+
const res = yield ctx.sendActivity(text);
|
|
2843
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2844
|
+
}
|
|
2845
|
+
catch (error) {
|
|
2846
|
+
if (onError) {
|
|
2847
|
+
yield onError(ctx, error);
|
|
2848
|
+
}
|
|
2849
|
+
else {
|
|
2850
|
+
throw error;
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2807
2853
|
}));
|
|
2808
2854
|
}));
|
|
2809
2855
|
return response;
|
|
@@ -2813,18 +2859,30 @@ class Member {
|
|
|
2813
2859
|
* Send an adaptive card message.
|
|
2814
2860
|
*
|
|
2815
2861
|
* @param card - the adaptive card raw JSON.
|
|
2862
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
2863
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2816
2864
|
* @returns the response of sending adaptive card message.
|
|
2817
2865
|
*/
|
|
2818
|
-
sendAdaptiveCard(card) {
|
|
2866
|
+
sendAdaptiveCard(card, onError) {
|
|
2819
2867
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2820
2868
|
const response = {};
|
|
2821
2869
|
yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2822
2870
|
const conversation = yield this.newConversation(context);
|
|
2823
2871
|
yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2872
|
+
try {
|
|
2873
|
+
const res = yield ctx.sendActivity({
|
|
2874
|
+
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
|
2875
|
+
});
|
|
2876
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2877
|
+
}
|
|
2878
|
+
catch (error) {
|
|
2879
|
+
if (onError) {
|
|
2880
|
+
yield onError(ctx, error);
|
|
2881
|
+
}
|
|
2882
|
+
else {
|
|
2883
|
+
throw error;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2828
2886
|
}));
|
|
2829
2887
|
}));
|
|
2830
2888
|
return response;
|
|
@@ -2878,14 +2936,26 @@ class TeamsBotInstallation {
|
|
|
2878
2936
|
* Send a plain text message.
|
|
2879
2937
|
*
|
|
2880
2938
|
* @param text - the plain text message.
|
|
2939
|
+
* @param onError - an optional error handler that can catch exceptions during message sending.
|
|
2940
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2881
2941
|
* @returns the response of sending message.
|
|
2882
2942
|
*/
|
|
2883
|
-
sendMessage(text) {
|
|
2943
|
+
sendMessage(text, onError) {
|
|
2884
2944
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2885
2945
|
const response = {};
|
|
2886
2946
|
yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2887
|
-
|
|
2888
|
-
|
|
2947
|
+
try {
|
|
2948
|
+
const res = yield context.sendActivity(text);
|
|
2949
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2950
|
+
}
|
|
2951
|
+
catch (error) {
|
|
2952
|
+
if (onError) {
|
|
2953
|
+
yield onError(context, error);
|
|
2954
|
+
}
|
|
2955
|
+
else {
|
|
2956
|
+
throw error;
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2889
2959
|
}));
|
|
2890
2960
|
return response;
|
|
2891
2961
|
});
|
|
@@ -2894,16 +2964,28 @@ class TeamsBotInstallation {
|
|
|
2894
2964
|
* Send an adaptive card message.
|
|
2895
2965
|
*
|
|
2896
2966
|
* @param card - the adaptive card raw JSON.
|
|
2967
|
+
* @param onError - an optional error handler that can catch exceptions during adaptive card sending.
|
|
2968
|
+
* If not defined, error will be handled by `BotAdapter.onTurnError`.
|
|
2897
2969
|
* @returns the response of sending adaptive card message.
|
|
2898
2970
|
*/
|
|
2899
|
-
sendAdaptiveCard(card) {
|
|
2971
|
+
sendAdaptiveCard(card, onError) {
|
|
2900
2972
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2901
2973
|
const response = {};
|
|
2902
2974
|
yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2975
|
+
try {
|
|
2976
|
+
const res = yield context.sendActivity({
|
|
2977
|
+
attachments: [botbuilder.CardFactory.adaptiveCard(card)],
|
|
2978
|
+
});
|
|
2979
|
+
response.id = res === null || res === void 0 ? void 0 : res.id;
|
|
2980
|
+
}
|
|
2981
|
+
catch (error) {
|
|
2982
|
+
if (onError) {
|
|
2983
|
+
yield onError(context, error);
|
|
2984
|
+
}
|
|
2985
|
+
else {
|
|
2986
|
+
throw error;
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2907
2989
|
}));
|
|
2908
2990
|
return response;
|
|
2909
2991
|
});
|