@microsoft/agents-hosting 0.5.4-ga4d0401645 → 0.5.16-g6bdf69cc43
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/src/app/adaptiveCards/adaptiveCardsActions.js +4 -4
- package/dist/src/app/adaptiveCards/adaptiveCardsActions.js.map +1 -1
- package/dist/src/app/agentApplication.d.ts +186 -20
- package/dist/src/app/agentApplication.js +235 -33
- package/dist/src/app/agentApplication.js.map +1 -1
- package/dist/src/app/agentApplicationBuilder.d.ts +1 -1
- package/dist/src/app/agentApplicationOptions.d.ts +1 -1
- package/dist/src/app/appRoute.d.ts +5 -0
- package/dist/src/app/authorization.d.ts +293 -0
- package/dist/src/app/authorization.js +375 -0
- package/dist/src/app/authorization.js.map +1 -0
- package/dist/src/app/index.d.ts +1 -1
- package/dist/src/app/index.js +1 -1
- package/dist/src/app/index.js.map +1 -1
- package/dist/src/app/streaming/citation.d.ts +25 -0
- package/dist/src/app/streaming/{AIEntity.js → citation.js} +1 -1
- package/dist/src/app/streaming/citation.js.map +1 -0
- package/dist/src/app/streaming/{utilities.d.ts → citationUtil.d.ts} +3 -3
- package/dist/src/app/streaming/{utilities.js → citationUtil.js} +5 -36
- package/dist/src/app/streaming/citationUtil.js.map +1 -0
- package/dist/src/app/streaming/streamingResponse.d.ts +3 -4
- package/dist/src/app/streaming/streamingResponse.js +24 -22
- package/dist/src/app/streaming/streamingResponse.js.map +1 -1
- package/dist/src/auth/index.d.ts +1 -0
- package/dist/src/auth/index.js +1 -0
- package/dist/src/auth/index.js.map +1 -1
- package/dist/src/auth/jwt-middleware.js.map +1 -1
- package/dist/src/auth/msalTokenCredential.d.ts +10 -0
- package/dist/src/auth/msalTokenCredential.js +19 -0
- package/dist/src/auth/msalTokenCredential.js.map +1 -0
- package/dist/src/auth/msalTokenProvider.d.ts +1 -0
- package/dist/src/auth/msalTokenProvider.js +15 -0
- package/dist/src/auth/msalTokenProvider.js.map +1 -1
- package/dist/src/cards/cardFactory.d.ts +2 -2
- package/dist/src/cards/cardFactory.js.map +1 -1
- package/dist/src/oauth/index.d.ts +1 -4
- package/dist/src/oauth/index.js +1 -4
- package/dist/src/oauth/index.js.map +1 -1
- package/dist/src/oauth/oAuthFlow.d.ts +62 -19
- package/dist/src/oauth/oAuthFlow.js +193 -67
- package/dist/src/oauth/oAuthFlow.js.map +1 -1
- package/dist/src/oauth/userTokenClient.d.ts +37 -7
- package/dist/src/oauth/userTokenClient.js +56 -15
- package/dist/src/oauth/userTokenClient.js.map +1 -1
- package/dist/src/oauth/userTokenClient.types.d.ts +147 -0
- package/dist/src/oauth/{oAuthCard.js → userTokenClient.types.js} +1 -1
- package/dist/src/oauth/userTokenClient.types.js.map +1 -0
- package/package.json +5 -4
- package/src/app/adaptiveCards/adaptiveCardsActions.ts +4 -4
- package/src/app/agentApplication.ts +248 -33
- package/src/app/agentApplicationBuilder.ts +1 -1
- package/src/app/agentApplicationOptions.ts +1 -1
- package/src/app/appRoute.ts +6 -0
- package/src/app/authorization.ts +418 -0
- package/src/app/index.ts +1 -1
- package/src/app/streaming/citation.ts +29 -0
- package/src/app/streaming/{utilities.ts → citationUtil.ts} +3 -35
- package/src/app/streaming/streamingResponse.ts +28 -27
- package/src/auth/index.ts +1 -0
- package/src/auth/jwt-middleware.ts +1 -1
- package/src/auth/msalTokenCredential.ts +14 -0
- package/src/auth/msalTokenProvider.ts +17 -1
- package/src/cards/cardFactory.ts +2 -3
- package/src/oauth/index.ts +1 -4
- package/src/oauth/oAuthFlow.ts +226 -70
- package/src/oauth/userTokenClient.ts +62 -19
- package/src/oauth/userTokenClient.types.ts +173 -0
- package/dist/src/app/oauth/authorization.d.ts +0 -87
- package/dist/src/app/oauth/authorization.js +0 -135
- package/dist/src/app/oauth/authorization.js.map +0 -1
- package/dist/src/app/streaming/AIEntity.d.ts +0 -36
- package/dist/src/app/streaming/AIEntity.js.map +0 -1
- package/dist/src/app/streaming/actionCall.d.ts +0 -33
- package/dist/src/app/streaming/actionCall.js +0 -7
- package/dist/src/app/streaming/actionCall.js.map +0 -1
- package/dist/src/app/streaming/clientCitation.d.ts +0 -68
- package/dist/src/app/streaming/clientCitation.js +0 -10
- package/dist/src/app/streaming/clientCitation.js.map +0 -1
- package/dist/src/app/streaming/message.d.ts +0 -106
- package/dist/src/app/streaming/message.js +0 -7
- package/dist/src/app/streaming/message.js.map +0 -1
- package/dist/src/app/streaming/sensitivityUsageInfo.d.ts +0 -40
- package/dist/src/app/streaming/sensitivityUsageInfo.js +0 -3
- package/dist/src/app/streaming/sensitivityUsageInfo.js.map +0 -1
- package/dist/src/app/streaming/utilities.js.map +0 -1
- package/dist/src/oauth/oAuthCard.d.ts +0 -27
- package/dist/src/oauth/oAuthCard.js.map +0 -1
- package/dist/src/oauth/signingResource.d.ts +0 -43
- package/dist/src/oauth/signingResource.js +0 -5
- package/dist/src/oauth/signingResource.js.map +0 -1
- package/dist/src/oauth/tokenExchangeRequest.d.ts +0 -17
- package/dist/src/oauth/tokenExchangeRequest.js +0 -5
- package/dist/src/oauth/tokenExchangeRequest.js.map +0 -1
- package/dist/src/oauth/tokenResponse.d.ts +0 -29
- package/dist/src/oauth/tokenResponse.js +0 -25
- package/dist/src/oauth/tokenResponse.js.map +0 -1
- package/src/app/oauth/authorization.ts +0 -162
- package/src/app/streaming/AIEntity.ts +0 -44
- package/src/app/streaming/actionCall.ts +0 -37
- package/src/app/streaming/clientCitation.ts +0 -102
- package/src/app/streaming/message.ts +0 -125
- package/src/app/streaming/sensitivityUsageInfo.ts +0 -48
- package/src/oauth/oAuthCard.ts +0 -30
- package/src/oauth/signingResource.ts +0 -48
- package/src/oauth/tokenExchangeRequest.ts +0 -20
- package/src/oauth/tokenResponse.ts +0 -43
|
@@ -9,7 +9,6 @@ exports.UserTokenClient = void 0;
|
|
|
9
9
|
const axios_1 = __importDefault(require("axios"));
|
|
10
10
|
const logger_1 = require("../logger");
|
|
11
11
|
const activityWireCompat_1 = require("../activityWireCompat");
|
|
12
|
-
const tokenResponse_1 = require("./tokenResponse");
|
|
13
12
|
const getProductInfo_1 = require("../getProductInfo");
|
|
14
13
|
const logger = (0, logger_1.debug)('agents:user-token-client');
|
|
15
14
|
/**
|
|
@@ -19,8 +18,10 @@ class UserTokenClient {
|
|
|
19
18
|
/**
|
|
20
19
|
* Creates a new instance of UserTokenClient.
|
|
21
20
|
* @param token The token to use for authentication.
|
|
21
|
+
* @param msAppId The Microsoft application ID.
|
|
22
22
|
*/
|
|
23
|
-
constructor(token) {
|
|
23
|
+
constructor(token, appId) {
|
|
24
|
+
this.msAppId = appId;
|
|
24
25
|
const baseURL = 'https://api.botframework.com';
|
|
25
26
|
const axiosInstance = axios_1.default.create({
|
|
26
27
|
baseURL,
|
|
@@ -45,16 +46,13 @@ class UserTokenClient {
|
|
|
45
46
|
try {
|
|
46
47
|
const params = { connectionName, channelId, userId, code };
|
|
47
48
|
const response = await this.client.get('/api/usertoken/GetToken', { params });
|
|
48
|
-
return
|
|
49
|
+
return response.data;
|
|
49
50
|
}
|
|
50
51
|
catch (error) {
|
|
51
52
|
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) !== 404) {
|
|
52
53
|
logger.error(error);
|
|
53
54
|
}
|
|
54
|
-
return {
|
|
55
|
-
status: tokenResponse_1.TokenRequestStatus.Failed,
|
|
56
|
-
token: undefined
|
|
57
|
-
};
|
|
55
|
+
return { token: undefined };
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
/**
|
|
@@ -79,18 +77,18 @@ class UserTokenClient {
|
|
|
79
77
|
}
|
|
80
78
|
/**
|
|
81
79
|
* Gets the sign-in resource.
|
|
82
|
-
* @param
|
|
83
|
-
* @param
|
|
80
|
+
* @param msAppId The application ID.
|
|
81
|
+
* @param connectionName The connection name.
|
|
84
82
|
* @param activity The activity.
|
|
85
83
|
* @returns A promise that resolves to the signing resource.
|
|
86
84
|
*/
|
|
87
|
-
async getSignInResource(
|
|
85
|
+
async getSignInResource(msAppId, connectionName, conversation, relatesTo) {
|
|
88
86
|
try {
|
|
89
87
|
const tokenExchangeState = {
|
|
90
|
-
connectionName
|
|
91
|
-
conversation
|
|
88
|
+
connectionName,
|
|
89
|
+
conversation,
|
|
92
90
|
relatesTo,
|
|
93
|
-
msAppId
|
|
91
|
+
msAppId
|
|
94
92
|
};
|
|
95
93
|
const tokenExchangeStateNormalized = (0, activityWireCompat_1.normalizeTokenExchangeState)(tokenExchangeState);
|
|
96
94
|
const state = Buffer.from(JSON.stringify(tokenExchangeStateNormalized)).toString('base64');
|
|
@@ -115,13 +113,56 @@ class UserTokenClient {
|
|
|
115
113
|
try {
|
|
116
114
|
const params = { userId, connectionName, channelId };
|
|
117
115
|
const response = await this.client.post('/api/usertoken/exchange', tokenExchangeRequest, { params });
|
|
118
|
-
return
|
|
116
|
+
return response.data;
|
|
119
117
|
}
|
|
120
118
|
catch (error) {
|
|
121
119
|
logger.error(error);
|
|
122
|
-
return {
|
|
120
|
+
return { token: undefined };
|
|
123
121
|
}
|
|
124
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Gets the token or sign-in resource.
|
|
125
|
+
* @param userId The user ID.
|
|
126
|
+
* @param connectionName The connection name.
|
|
127
|
+
* @param channelId The channel ID.
|
|
128
|
+
* @param conversation The conversation reference.
|
|
129
|
+
* @param relatesTo The related conversation reference.
|
|
130
|
+
* @param code The code.
|
|
131
|
+
* @param finalRedirect The final redirect URL.
|
|
132
|
+
* @param fwdUrl The forward URL.
|
|
133
|
+
* @returns A promise that resolves to the token or sign-in resource response.
|
|
134
|
+
*/
|
|
135
|
+
async getTokenOrSignInResource(userId, connectionName, channelId, conversation, relatesTo, code, finalRedirect = '', fwdUrl = '') {
|
|
136
|
+
const state = Buffer.from(JSON.stringify({ conversation, relatesTo, connectionName, msAppId: this.msAppId })).toString('base64');
|
|
137
|
+
const params = { userId, connectionName, channelId, state, code, finalRedirect, fwdUrl };
|
|
138
|
+
const response = await this.client.get('/api/usertoken/GetTokenOrSignInResource', { params });
|
|
139
|
+
return response.data;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Gets the token status.
|
|
143
|
+
* @param userId The user ID.
|
|
144
|
+
* @param channelId The channel ID.
|
|
145
|
+
* @param include The optional include parameter.
|
|
146
|
+
* @returns A promise that resolves to the token status.
|
|
147
|
+
*/
|
|
148
|
+
async getTokenStatus(userId, channelId, include = null) {
|
|
149
|
+
const params = { userId, channelId, include };
|
|
150
|
+
const response = await this.client.get('/api/usertoken/GetTokenStatus', { params });
|
|
151
|
+
return response.data;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Gets the AAD tokens.
|
|
155
|
+
* @param userId The user ID.
|
|
156
|
+
* @param connectionName The connection name.
|
|
157
|
+
* @param channelId The channel ID.
|
|
158
|
+
* @param resourceUrls The resource URLs.
|
|
159
|
+
* @returns A promise that resolves to the AAD tokens.
|
|
160
|
+
*/
|
|
161
|
+
async getAadTokens(userId, connectionName, channelId, resourceUrls) {
|
|
162
|
+
const params = { userId, connectionName, channelId };
|
|
163
|
+
const response = await this.client.post('/api/usertoken/GetAadTokens', resourceUrls, { params });
|
|
164
|
+
return response.data;
|
|
165
|
+
}
|
|
125
166
|
}
|
|
126
167
|
exports.UserTokenClient = UserTokenClient;
|
|
127
168
|
//# sourceMappingURL=userTokenClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userTokenClient.js","sourceRoot":"","sources":["../../../src/oauth/userTokenClient.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;AAElC,kDAA4C;
|
|
1
|
+
{"version":3,"file":"userTokenClient.js","sourceRoot":"","sources":["../../../src/oauth/userTokenClient.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;AAElC,kDAA4C;AAE5C,sCAAiC;AACjC,8DAAmE;AAEnE,sDAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,0BAA0B,CAAC,CAAA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7C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;QACnF,OAAO,QAAQ,CAAC,IAAqB,CAAA;IACvC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,YAAY,CAAE,MAAc,EAAE,cAAsB,EAAE,SAAiB,EAAE,YAA6B;QAC1G,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,CAAA;QACpD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;QAChG,OAAO,QAAQ,CAAC,IAAqC,CAAA;IACvD,CAAC;CACF;AAzJD,0CAyJC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { CardAction } from '@microsoft/agents-activity';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the response containing OAuth token information.
|
|
4
|
+
* This interface encapsulates all data related to an OAuth token response.
|
|
5
|
+
*/
|
|
6
|
+
export interface TokenResponse {
|
|
7
|
+
/**
|
|
8
|
+
* The OAuth token string, or undefined if no token is available.
|
|
9
|
+
*/
|
|
10
|
+
token: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Represents a request for exchanging tokens.
|
|
14
|
+
* This interface defines the structure of a token exchange request, including the URI, token, and ID.
|
|
15
|
+
*/
|
|
16
|
+
export interface TokenExchangeRequest {
|
|
17
|
+
/**
|
|
18
|
+
* The URI for the token exchange request.
|
|
19
|
+
*/
|
|
20
|
+
uri?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The token to be exchanged.
|
|
23
|
+
*/
|
|
24
|
+
token?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The ID associated with the token exchange request.
|
|
27
|
+
*/
|
|
28
|
+
id?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a resource for exchanging tokens.
|
|
32
|
+
* This interface defines the structure of a token exchange resource, including its ID, URI, and provider ID.
|
|
33
|
+
*/
|
|
34
|
+
export interface TokenExchangeResource {
|
|
35
|
+
/**
|
|
36
|
+
* The ID of the token exchange resource.
|
|
37
|
+
*/
|
|
38
|
+
id?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The URI of the token exchange resource.
|
|
41
|
+
*/
|
|
42
|
+
uri?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The provider ID for the token exchange resource.
|
|
45
|
+
*/
|
|
46
|
+
providerId?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents a resource for posting tokens.
|
|
50
|
+
* This interface defines the structure of a token post resource, including its SAS URL.
|
|
51
|
+
*/
|
|
52
|
+
export interface TokenPostResource {
|
|
53
|
+
/**
|
|
54
|
+
* The SAS URL for the token post resource.
|
|
55
|
+
*/
|
|
56
|
+
sasUrl?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Represents a resource for signing in.
|
|
60
|
+
* This interface defines the structure of a sign-in resource, including the sign-in link, token exchange resource, and token post resource.
|
|
61
|
+
*/
|
|
62
|
+
export interface SignInResource {
|
|
63
|
+
/**
|
|
64
|
+
* The link for signing in.
|
|
65
|
+
*/
|
|
66
|
+
signInLink: string;
|
|
67
|
+
/**
|
|
68
|
+
* The resource for token exchange.
|
|
69
|
+
*/
|
|
70
|
+
tokenExchangeResource: TokenExchangeResource;
|
|
71
|
+
/**
|
|
72
|
+
* The resource for token post.
|
|
73
|
+
*/
|
|
74
|
+
tokenPostResource: TokenPostResource;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Represents an OAuth card.
|
|
78
|
+
* This interface defines the structure of an OAuth card, including its buttons, connection name, text, and associated resources.
|
|
79
|
+
*/
|
|
80
|
+
export interface OAuthCard {
|
|
81
|
+
/**
|
|
82
|
+
* The buttons associated with the OAuth card.
|
|
83
|
+
*/
|
|
84
|
+
buttons: CardAction[];
|
|
85
|
+
/**
|
|
86
|
+
* The connection name for the OAuth card.
|
|
87
|
+
*/
|
|
88
|
+
connectionName: string;
|
|
89
|
+
/**
|
|
90
|
+
* The text content of the OAuth card.
|
|
91
|
+
*/
|
|
92
|
+
text: string;
|
|
93
|
+
/**
|
|
94
|
+
* The token exchange resource for the OAuth card.
|
|
95
|
+
*/
|
|
96
|
+
tokenExchangeResource: TokenExchangeResource;
|
|
97
|
+
/**
|
|
98
|
+
* The token post resource for the OAuth card.
|
|
99
|
+
*/
|
|
100
|
+
tokenPostResource: TokenPostResource;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Represents a response containing either a token or a sign-in resource.
|
|
104
|
+
* This interface defines the structure of a response that includes a token response and a sign-in resource.
|
|
105
|
+
*/
|
|
106
|
+
export interface TokenOrSinginResourceResponse {
|
|
107
|
+
/**
|
|
108
|
+
* The token response containing OAuth token information.
|
|
109
|
+
*/
|
|
110
|
+
tokenResponse: TokenResponse;
|
|
111
|
+
/**
|
|
112
|
+
* The sign-in resource containing sign-in and token exchange information.
|
|
113
|
+
*/
|
|
114
|
+
signInResource: SignInResource;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Represents the status of a token.
|
|
118
|
+
* This interface defines the structure of a token status, including channel ID, connection name, and other metadata.
|
|
119
|
+
*/
|
|
120
|
+
export interface TokenStatus {
|
|
121
|
+
/**
|
|
122
|
+
* The ID of the channel associated with the token.
|
|
123
|
+
*/
|
|
124
|
+
channelId: string;
|
|
125
|
+
/**
|
|
126
|
+
* The connection name associated with the token.
|
|
127
|
+
*/
|
|
128
|
+
connectionName: string;
|
|
129
|
+
/**
|
|
130
|
+
* Indicates whether a token is available.
|
|
131
|
+
*/
|
|
132
|
+
hasToken: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* The display name of the service provider.
|
|
135
|
+
*/
|
|
136
|
+
serviceProviderDisplayName: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Represents a collection of Azure Active Directory (AAD) resource URLs.
|
|
140
|
+
* This interface defines the structure of a collection of resource URLs.
|
|
141
|
+
*/
|
|
142
|
+
export interface AadResourceUrls {
|
|
143
|
+
/**
|
|
144
|
+
* An array of resource URLs.
|
|
145
|
+
*/
|
|
146
|
+
resourceUrls: string[];
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userTokenClient.types.js","sourceRoot":"","sources":["../../../src/oauth/userTokenClient.types.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@microsoft/agents-hosting",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.16-g6bdf69cc43",
|
|
5
5
|
"homepage": "https://github.com/microsoft/Agents-for-js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"main": "dist/src/index.js",
|
|
20
20
|
"types": "dist/src/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@azure/
|
|
23
|
-
"@
|
|
22
|
+
"@azure/core-auth": "^1.9.0",
|
|
23
|
+
"@azure/msal-node": "^3.6.0",
|
|
24
|
+
"@microsoft/agents-activity": "0.5.16-g6bdf69cc43",
|
|
24
25
|
"axios": "^1.9.0",
|
|
25
26
|
"debug": "^4.3.7",
|
|
26
27
|
"jsonwebtoken": "^9.0.2",
|
|
@@ -40,6 +41,6 @@
|
|
|
40
41
|
"./package.json": "./package.json"
|
|
41
42
|
},
|
|
42
43
|
"engines": {
|
|
43
|
-
"node": ">=
|
|
44
|
+
"node": ">=20.0.0"
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -219,10 +219,10 @@ export class AdaptiveCardsActions<TState extends TurnState> {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
await context.sendActivity({
|
|
222
|
+
await context.sendActivity(Activity.fromObject({
|
|
223
223
|
value: { body: response, status: 200 } as InvokeResponse,
|
|
224
224
|
type: ActivityTypes.InvokeResponse
|
|
225
|
-
}
|
|
225
|
+
}))
|
|
226
226
|
}
|
|
227
227
|
},
|
|
228
228
|
true
|
|
@@ -313,8 +313,8 @@ function createSearchSelector (dataset: string | RegExp | RouteSelector): RouteS
|
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
async function sendInvokeResponse (context: TurnContext, response: AdaptiveCardInvokeResponse) {
|
|
316
|
-
await context.sendActivity({
|
|
316
|
+
await context.sendActivity(Activity.fromObject({
|
|
317
317
|
value: { body: response, status: 200 } as InvokeResponse,
|
|
318
318
|
type: ActivityTypes.InvokeResponse
|
|
319
|
-
}
|
|
319
|
+
}))
|
|
320
320
|
}
|