@microsoft/agents-hosting 1.1.0-alpha.2 → 1.1.0-alpha.58
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/package.json +10 -6
- package/dist/src/activityWireCompat.js +8 -3
- package/dist/src/activityWireCompat.js.map +1 -1
- package/dist/src/agent-client/agentClient.js +7 -3
- package/dist/src/agent-client/agentClient.js.map +1 -1
- package/dist/src/agent-client/agentResponseHandler.js +6 -2
- package/dist/src/agent-client/agentResponseHandler.js.map +1 -1
- package/dist/src/app/agentApplication.d.ts +26 -11
- package/dist/src/app/agentApplication.js +94 -86
- package/dist/src/app/agentApplication.js.map +1 -1
- package/dist/src/app/agentApplicationBuilder.d.ts +2 -2
- package/dist/src/app/agentApplicationBuilder.js.map +1 -1
- package/dist/src/app/agentApplicationOptions.d.ts +9 -2
- package/dist/src/app/appRoute.d.ts +7 -0
- package/dist/src/app/attachmentDownloader.d.ts +13 -3
- package/dist/src/app/attachmentDownloader.js +16 -3
- package/dist/src/app/attachmentDownloader.js.map +1 -1
- package/dist/src/app/{authorization.d.ts → auth/authorization.d.ts} +33 -139
- package/dist/src/app/auth/authorization.js +188 -0
- package/dist/src/app/auth/authorization.js.map +1 -0
- package/dist/src/app/auth/authorizationManager.d.ts +71 -0
- package/dist/src/app/auth/authorizationManager.js +170 -0
- package/dist/src/app/auth/authorizationManager.js.map +1 -0
- package/dist/src/app/auth/handlerStorage.d.ts +36 -0
- package/dist/src/app/auth/handlerStorage.js +62 -0
- package/dist/src/app/auth/handlerStorage.js.map +1 -0
- package/dist/src/app/auth/handlers/agenticAuthorization.d.ts +97 -0
- package/dist/src/app/auth/handlers/agenticAuthorization.js +145 -0
- package/dist/src/app/auth/handlers/agenticAuthorization.js.map +1 -0
- package/dist/src/app/auth/handlers/azureBotAuthorization.d.ts +222 -0
- package/dist/src/app/auth/handlers/azureBotAuthorization.js +428 -0
- package/dist/src/app/auth/handlers/azureBotAuthorization.js.map +1 -0
- package/dist/src/app/auth/handlers/index.d.ts +2 -0
- package/dist/src/app/auth/handlers/index.js +19 -0
- package/dist/src/app/auth/handlers/index.js.map +1 -0
- package/dist/src/app/auth/index.d.ts +2 -0
- package/dist/src/app/auth/index.js +19 -0
- package/dist/src/app/auth/index.js.map +1 -0
- package/dist/src/app/auth/types.d.ts +104 -0
- package/dist/src/app/auth/types.js +24 -0
- package/dist/src/app/auth/types.js.map +1 -0
- package/dist/src/app/index.d.ts +2 -3
- package/dist/src/app/index.js +2 -3
- package/dist/src/app/index.js.map +1 -1
- package/dist/src/app/inputFileDownloader.d.ts +10 -3
- package/dist/src/app/routeList.d.ts +1 -1
- package/dist/src/app/routeList.js +22 -5
- package/dist/src/app/routeList.js.map +1 -1
- package/dist/src/app/streaming/streamingResponse.d.ts +11 -1
- package/dist/src/app/streaming/streamingResponse.js +17 -2
- package/dist/src/app/streaming/streamingResponse.js.map +1 -1
- package/dist/src/app/turnState.d.ts +2 -38
- package/dist/src/app/turnState.js +1 -46
- package/dist/src/app/turnState.js.map +1 -1
- package/dist/src/auth/MemoryCache.d.ts +16 -0
- package/dist/src/auth/MemoryCache.js +58 -0
- package/dist/src/auth/MemoryCache.js.map +1 -0
- package/dist/src/auth/authConfiguration.d.ts +44 -2
- package/dist/src/auth/authConfiguration.js +218 -53
- package/dist/src/auth/authConfiguration.js.map +1 -1
- package/dist/src/auth/authConstants.d.ts +11 -0
- package/dist/src/auth/authConstants.js +15 -0
- package/dist/src/auth/authConstants.js.map +1 -0
- package/dist/src/auth/authProvider.d.ts +23 -0
- package/dist/src/auth/connections.d.ts +40 -0
- package/dist/src/auth/connections.js +7 -0
- package/dist/src/auth/connections.js.map +1 -0
- package/dist/src/auth/index.d.ts +2 -0
- package/dist/src/auth/index.js +2 -0
- package/dist/src/auth/index.js.map +1 -1
- package/dist/src/auth/jwt-middleware.js +31 -18
- package/dist/src/auth/jwt-middleware.js.map +1 -1
- package/dist/src/auth/msalConnectionManager.d.ts +63 -0
- package/dist/src/auth/msalConnectionManager.js +124 -0
- package/dist/src/auth/msalConnectionManager.js.map +1 -0
- package/dist/src/auth/msalTokenProvider.d.ts +31 -0
- package/dist/src/auth/msalTokenProvider.js +167 -16
- package/dist/src/auth/msalTokenProvider.js.map +1 -1
- package/dist/src/baseAdapter.d.ts +10 -25
- package/dist/src/baseAdapter.js +2 -15
- package/dist/src/baseAdapter.js.map +1 -1
- package/dist/src/cloudAdapter.d.ts +40 -23
- package/dist/src/cloudAdapter.js +132 -56
- package/dist/src/cloudAdapter.js.map +1 -1
- package/dist/src/connector-client/connectorClient.d.ts +9 -0
- package/dist/src/connector-client/connectorClient.js +39 -9
- package/dist/src/connector-client/connectorClient.js.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/oauth/index.d.ts +0 -1
- package/dist/src/oauth/index.js +0 -1
- package/dist/src/oauth/index.js.map +1 -1
- package/dist/src/oauth/userTokenClient.d.ts +30 -13
- package/dist/src/oauth/userTokenClient.js +64 -26
- package/dist/src/oauth/userTokenClient.js.map +1 -1
- package/dist/src/oauth/userTokenClient.types.d.ts +19 -6
- package/dist/src/turnContext.d.ts +7 -1
- package/dist/src/turnContext.js +11 -4
- package/dist/src/turnContext.js.map +1 -1
- package/package.json +10 -6
- package/src/activityWireCompat.ts +8 -3
- package/src/agent-client/agentClient.ts +9 -3
- package/src/agent-client/agentResponseHandler.ts +5 -2
- package/src/app/agentApplication.ts +98 -79
- package/src/app/agentApplicationBuilder.ts +2 -2
- package/src/app/agentApplicationOptions.ts +10 -2
- package/src/app/appRoute.ts +8 -0
- package/src/app/attachmentDownloader.ts +18 -3
- package/src/app/auth/authorization.ts +252 -0
- package/src/app/auth/authorizationManager.ts +213 -0
- package/src/app/auth/handlerStorage.ts +61 -0
- package/src/app/auth/handlers/agenticAuthorization.ts +194 -0
- package/src/app/auth/handlers/azureBotAuthorization.ts +599 -0
- package/src/app/auth/handlers/index.ts +2 -0
- package/src/app/auth/index.ts +2 -0
- package/src/app/auth/types.ts +111 -0
- package/src/app/index.ts +2 -3
- package/src/app/inputFileDownloader.ts +11 -3
- package/src/app/routeList.ts +24 -5
- package/src/app/streaming/streamingResponse.ts +20 -3
- package/src/app/turnState.ts +2 -61
- package/src/auth/MemoryCache.ts +59 -0
- package/src/auth/authConfiguration.ts +258 -52
- package/src/auth/authConstants.ts +11 -0
- package/src/auth/authProvider.ts +31 -0
- package/src/auth/connections.ts +46 -0
- package/src/auth/index.ts +2 -0
- package/src/auth/jwt-middleware.ts +38 -21
- package/src/auth/msalConnectionManager.ts +150 -0
- package/src/auth/msalTokenProvider.ts +209 -9
- package/src/baseAdapter.ts +10 -29
- package/src/cloudAdapter.ts +192 -67
- package/src/connector-client/connectorClient.ts +49 -10
- package/src/index.ts +0 -1
- package/src/oauth/index.ts +0 -1
- package/src/oauth/userTokenClient.ts +79 -23
- package/src/oauth/userTokenClient.types.ts +20 -8
- package/src/turnContext.ts +16 -5
- package/dist/src/app/authorization.js +0 -387
- package/dist/src/app/authorization.js.map +0 -1
- package/dist/src/claimsIdentity.d.ts +0 -35
- package/dist/src/claimsIdentity.js +0 -43
- package/dist/src/claimsIdentity.js.map +0 -1
- package/dist/src/oauth/oAuthFlow.d.ts +0 -119
- package/dist/src/oauth/oAuthFlow.js +0 -316
- package/dist/src/oauth/oAuthFlow.js.map +0 -1
- package/src/app/authorization.ts +0 -432
- package/src/claimsIdentity.ts +0 -47
- package/src/oauth/oAuthFlow.ts +0 -378
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import axios, { AxiosInstance } from 'axios'
|
|
5
|
-
import { ConversationReference } from '@microsoft/agents-activity'
|
|
5
|
+
import { Activity, ConversationReference } from '@microsoft/agents-activity'
|
|
6
6
|
import { debug } from '@microsoft/agents-activity/logger'
|
|
7
|
-
import { normalizeTokenExchangeState } from '../activityWireCompat'
|
|
7
|
+
import { normalizeOutgoingActivity, normalizeTokenExchangeState } from '../activityWireCompat'
|
|
8
8
|
import { AadResourceUrls, SignInResource, TokenExchangeRequest, TokenOrSinginResourceResponse, TokenResponse, TokenStatus } from './userTokenClient.types'
|
|
9
9
|
import { getProductInfo } from '../getProductInfo'
|
|
10
|
+
import { AuthProvider, MsalTokenProvider } from '../auth'
|
|
11
|
+
import { HeaderPropagationCollection } from '../headerPropagation'
|
|
10
12
|
|
|
11
13
|
const logger = debug('agents:user-token-client')
|
|
12
14
|
|
|
@@ -15,19 +17,31 @@ const logger = debug('agents:user-token-client')
|
|
|
15
17
|
*/
|
|
16
18
|
export class UserTokenClient {
|
|
17
19
|
client: AxiosInstance
|
|
20
|
+
private msAppId: string = ''
|
|
18
21
|
/**
|
|
19
22
|
* Creates a new instance of UserTokenClient.
|
|
20
23
|
* @param msAppId The Microsoft application ID.
|
|
21
24
|
*/
|
|
22
|
-
constructor (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
constructor (msAppId: string)
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new instance of UserTokenClient.
|
|
28
|
+
* @param axiosInstance The axios instance.
|
|
29
|
+
*/
|
|
30
|
+
constructor (axiosInstance: AxiosInstance)
|
|
31
|
+
|
|
32
|
+
constructor (param: string | AxiosInstance) {
|
|
33
|
+
if (typeof param === 'string') {
|
|
34
|
+
const baseURL = 'https://api.botframework.com'
|
|
35
|
+
this.client = axios.create({
|
|
36
|
+
baseURL,
|
|
37
|
+
headers: {
|
|
38
|
+
Accept: 'application/json',
|
|
39
|
+
'User-Agent': getProductInfo(),
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
} else {
|
|
43
|
+
this.client = param
|
|
44
|
+
}
|
|
31
45
|
|
|
32
46
|
this.client.interceptors.request.use((config) => {
|
|
33
47
|
const { method, url, data, headers, params } = config
|
|
@@ -79,15 +93,52 @@ export class UserTokenClient {
|
|
|
79
93
|
})
|
|
80
94
|
}
|
|
81
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new instance of UserTokenClient with authentication.
|
|
98
|
+
* @param baseURL - The base URL for the API.
|
|
99
|
+
* @param authConfig - The authentication configuration.
|
|
100
|
+
* @param authProvider - The authentication provider.
|
|
101
|
+
* @param scope - The scope for the authentication token.
|
|
102
|
+
* @param headers - Optional headers to propagate in the request.
|
|
103
|
+
* @returns A new instance of ConnectorClient.
|
|
104
|
+
*/
|
|
105
|
+
static async createClientWithScope (
|
|
106
|
+
baseURL: string,
|
|
107
|
+
authProvider: AuthProvider,
|
|
108
|
+
scope: string,
|
|
109
|
+
headers?: HeaderPropagationCollection
|
|
110
|
+
): Promise<UserTokenClient> {
|
|
111
|
+
// TODO: add header propagation logic
|
|
112
|
+
const axiosInstance = axios.create({
|
|
113
|
+
baseURL,
|
|
114
|
+
headers: {
|
|
115
|
+
Accept: 'application/json',
|
|
116
|
+
'Content-Type': 'application/json', // Required by transformRequest
|
|
117
|
+
'User-Agent': getProductInfo(),
|
|
118
|
+
},
|
|
119
|
+
transformRequest: [
|
|
120
|
+
(data, headers) => {
|
|
121
|
+
return JSON.stringify(normalizeOutgoingActivity(data))
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
})
|
|
125
|
+
const token = await (authProvider as MsalTokenProvider).getAccessToken(scope)
|
|
126
|
+
if (token.length > 1) {
|
|
127
|
+
axiosInstance.defaults.headers.common.Authorization = `Bearer ${token}`
|
|
128
|
+
}
|
|
129
|
+
return new UserTokenClient(axiosInstance)
|
|
130
|
+
}
|
|
131
|
+
|
|
82
132
|
/**
|
|
83
133
|
* Gets the user token.
|
|
84
134
|
* @param connectionName The connection name.
|
|
85
|
-
* @param
|
|
135
|
+
* @param channelIdComposite The channel ID.
|
|
86
136
|
* @param userId The user ID.
|
|
87
137
|
* @param code The optional code.
|
|
88
138
|
* @returns A promise that resolves to the user token.
|
|
89
139
|
*/
|
|
90
|
-
async getUserToken (connectionName: string,
|
|
140
|
+
async getUserToken (connectionName: string, channelIdComposite: string, userId: string, code?: string) : Promise<TokenResponse> {
|
|
141
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
91
142
|
const params = { connectionName, channelId, userId, code }
|
|
92
143
|
const response = await this.client.get('/api/usertoken/GetToken', { params })
|
|
93
144
|
if (response?.data) {
|
|
@@ -100,10 +151,11 @@ export class UserTokenClient {
|
|
|
100
151
|
* Signs the user out.
|
|
101
152
|
* @param userId The user ID.
|
|
102
153
|
* @param connectionName The connection name.
|
|
103
|
-
* @param
|
|
154
|
+
* @param channelIdComposite The channel ID.
|
|
104
155
|
* @returns A promise that resolves when the sign-out operation is complete.
|
|
105
156
|
*/
|
|
106
|
-
async signOut (userId: string, connectionName: string,
|
|
157
|
+
async signOut (userId: string, connectionName: string, channelIdComposite: string) : Promise<void> {
|
|
158
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
107
159
|
const params = { userId, connectionName, channelId }
|
|
108
160
|
const response = await this.client.delete('/api/usertoken/SignOut', { params })
|
|
109
161
|
if (response.status !== 200) {
|
|
@@ -137,11 +189,12 @@ export class UserTokenClient {
|
|
|
137
189
|
* Exchanges the token.
|
|
138
190
|
* @param userId The user ID.
|
|
139
191
|
* @param connectionName The connection name.
|
|
140
|
-
* @param
|
|
192
|
+
* @param channelIdComposite The channel ID.
|
|
141
193
|
* @param tokenExchangeRequest The token exchange request.
|
|
142
194
|
* @returns A promise that resolves to the exchanged token.
|
|
143
195
|
*/
|
|
144
|
-
async exchangeTokenAsync (userId: string, connectionName: string,
|
|
196
|
+
async exchangeTokenAsync (userId: string, connectionName: string, channelIdComposite: string, tokenExchangeRequest: TokenExchangeRequest) : Promise<TokenResponse> {
|
|
197
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
145
198
|
const params = { userId, connectionName, channelId }
|
|
146
199
|
const response = await this.client.post('/api/usertoken/exchange', tokenExchangeRequest, { params })
|
|
147
200
|
if (response?.data) {
|
|
@@ -155,7 +208,7 @@ export class UserTokenClient {
|
|
|
155
208
|
* Gets the token or sign-in resource.
|
|
156
209
|
* @param userId The user ID.
|
|
157
210
|
* @param connectionName The connection name.
|
|
158
|
-
* @param
|
|
211
|
+
* @param channelIdComposite The channel ID.
|
|
159
212
|
* @param conversation The conversation reference.
|
|
160
213
|
* @param relatesTo The related conversation reference.
|
|
161
214
|
* @param code The code.
|
|
@@ -163,7 +216,8 @@ export class UserTokenClient {
|
|
|
163
216
|
* @param fwdUrl The forward URL.
|
|
164
217
|
* @returns A promise that resolves to the token or sign-in resource response.
|
|
165
218
|
*/
|
|
166
|
-
async getTokenOrSignInResource (userId: string, connectionName: string,
|
|
219
|
+
async getTokenOrSignInResource (userId: string, connectionName: string, channelIdComposite: string, conversation: ConversationReference, relatesTo: ConversationReference, code: string, finalRedirect: string = '', fwdUrl: string = '') : Promise<TokenOrSinginResourceResponse> {
|
|
220
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
167
221
|
const state = Buffer.from(JSON.stringify({ conversation, relatesTo, connectionName, msAppId: this.msAppId })).toString('base64')
|
|
168
222
|
const params = { userId, connectionName, channelId, state, code, finalRedirect, fwdUrl }
|
|
169
223
|
const response = await this.client.get('/api/usertoken/GetTokenOrSignInResource', { params })
|
|
@@ -173,11 +227,12 @@ export class UserTokenClient {
|
|
|
173
227
|
/**
|
|
174
228
|
* Gets the token status.
|
|
175
229
|
* @param userId The user ID.
|
|
176
|
-
* @param
|
|
230
|
+
* @param channelIdComposite The channel ID.
|
|
177
231
|
* @param include The optional include parameter.
|
|
178
232
|
* @returns A promise that resolves to the token status.
|
|
179
233
|
*/
|
|
180
|
-
async getTokenStatus (userId: string,
|
|
234
|
+
async getTokenStatus (userId: string, channelIdComposite: string, include: string = null!): Promise<TokenStatus[]> {
|
|
235
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
181
236
|
const params = { userId, channelId, include }
|
|
182
237
|
const response = await this.client.get('/api/usertoken/GetTokenStatus', { params })
|
|
183
238
|
return response.data as TokenStatus[]
|
|
@@ -187,11 +242,12 @@ export class UserTokenClient {
|
|
|
187
242
|
* Gets the AAD tokens.
|
|
188
243
|
* @param userId The user ID.
|
|
189
244
|
* @param connectionName The connection name.
|
|
190
|
-
* @param
|
|
245
|
+
* @param channelIdComposite The channel ID.
|
|
191
246
|
* @param resourceUrls The resource URLs.
|
|
192
247
|
* @returns A promise that resolves to the AAD tokens.
|
|
193
248
|
*/
|
|
194
|
-
async getAadTokens (userId: string, connectionName: string,
|
|
249
|
+
async getAadTokens (userId: string, connectionName: string, channelIdComposite: string, resourceUrls: AadResourceUrls) : Promise<Record<string, TokenResponse>> {
|
|
250
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
195
251
|
const params = { userId, connectionName, channelId }
|
|
196
252
|
const response = await this.client.post('/api/usertoken/GetAadTokens', resourceUrls, { params })
|
|
197
253
|
return response.data as Record<string, TokenResponse>
|
|
@@ -20,19 +20,31 @@ export interface TokenResponse {
|
|
|
20
20
|
*/
|
|
21
21
|
export interface TokenExchangeRequest {
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
* The URI for the token exchange request.
|
|
24
|
+
*/
|
|
25
25
|
uri?: string;
|
|
26
|
-
|
|
27
26
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
* The token to be exchanged.
|
|
28
|
+
*/
|
|
30
29
|
token?: string;
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Represents the response for a token exchange invoke operation.
|
|
34
|
+
*/
|
|
35
|
+
export interface TokenExchangeInvokeResponse {
|
|
32
36
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
* The connection name associated with the token exchange response.
|
|
38
|
+
*/
|
|
39
|
+
connectionName: string
|
|
40
|
+
/**
|
|
41
|
+
* The ID associated with the token exchange response.
|
|
42
|
+
*/
|
|
43
|
+
id?: string
|
|
44
|
+
/**
|
|
45
|
+
* (Optional) Details about any failure that occurred during the token exchange.
|
|
46
|
+
*/
|
|
47
|
+
failureDetail?: string
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
/**
|
package/src/turnContext.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { TurnContextStateCollection } from './turnContextStateCollection'
|
|
|
7
7
|
import { AttachmentInfo } from './connector-client/attachmentInfo'
|
|
8
8
|
import { AttachmentData } from './connector-client/attachmentData'
|
|
9
9
|
import { StreamingResponse } from './app/streaming/streamingResponse'
|
|
10
|
+
import { JwtPayload } from 'jsonwebtoken'
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Defines a handler for processing and sending activities.
|
|
@@ -71,20 +72,23 @@ export class TurnContext {
|
|
|
71
72
|
private readonly _turn = 'turn'
|
|
72
73
|
private readonly _locale = 'locale'
|
|
73
74
|
private readonly _streamingResponse: StreamingResponse
|
|
75
|
+
private readonly _identity?: JwtPayload
|
|
76
|
+
|
|
74
77
|
/**
|
|
75
78
|
* Initializes a new instance of the TurnContext class.
|
|
76
79
|
*
|
|
77
80
|
* @param adapterOrContext The adapter that created this context, or another TurnContext to clone
|
|
78
81
|
* @param request The activity for the turn (required when first parameter is an adapter)
|
|
79
82
|
*/
|
|
80
|
-
constructor (adapterOrContext: BaseAdapter, request: Activity)
|
|
83
|
+
constructor (adapterOrContext: BaseAdapter, request: Activity, identity?: JwtPayload)
|
|
81
84
|
constructor (adapterOrContext: TurnContext)
|
|
82
|
-
constructor (adapterOrContext: BaseAdapter | TurnContext, request?: Activity) {
|
|
85
|
+
constructor (adapterOrContext: BaseAdapter | TurnContext, request?: Activity, identity?: JwtPayload) {
|
|
83
86
|
if (adapterOrContext instanceof TurnContext) {
|
|
84
87
|
adapterOrContext.copyTo(this)
|
|
85
88
|
} else {
|
|
86
89
|
this._adapter = adapterOrContext
|
|
87
90
|
this._activity = request as Activity
|
|
91
|
+
this._identity = identity as JwtPayload
|
|
88
92
|
}
|
|
89
93
|
this._streamingResponse = new StreamingResponse(this)
|
|
90
94
|
}
|
|
@@ -246,6 +250,7 @@ export class TurnContext {
|
|
|
246
250
|
}
|
|
247
251
|
|
|
248
252
|
/**
|
|
253
|
+
* @deprecated This function will not be supported in future versions. Use TurnContext.turnState.get<ConnectorClient>(CloudAdapter.ConnectorClientKey).
|
|
249
254
|
* Uploads an attachment to the conversation.
|
|
250
255
|
*
|
|
251
256
|
* @param conversationId The ID of the conversation
|
|
@@ -253,20 +258,22 @@ export class TurnContext {
|
|
|
253
258
|
* @returns A promise that resolves to the resource response
|
|
254
259
|
*/
|
|
255
260
|
async uploadAttachment (conversationId: string, attachmentData: AttachmentData): Promise<ResourceResponse> {
|
|
256
|
-
return await this.adapter.uploadAttachment(conversationId, attachmentData)
|
|
261
|
+
return await this.adapter.uploadAttachment(this, conversationId, attachmentData)
|
|
257
262
|
}
|
|
258
263
|
|
|
259
264
|
/**
|
|
265
|
+
* @deprecated This function will not be supported in future versions. Use TurnContext.turnState.get<ConnectorClient>(CloudAdapter.ConnectorClientKey).
|
|
260
266
|
* Gets information about an attachment.
|
|
261
267
|
*
|
|
262
268
|
* @param attachmentId The ID of the attachment
|
|
263
269
|
* @returns A promise that resolves to the attachment information
|
|
264
270
|
*/
|
|
265
271
|
async getAttachmentInfo (attachmentId: string): Promise<AttachmentInfo> {
|
|
266
|
-
return await this.adapter.getAttachmentInfo(attachmentId)
|
|
272
|
+
return await this.adapter.getAttachmentInfo(this, attachmentId)
|
|
267
273
|
}
|
|
268
274
|
|
|
269
275
|
/**
|
|
276
|
+
* @deprecated This function will not be supported in future versions. Use TurnContext.turnState.get<ConnectorClient>(CloudAdapter.ConnectorClientKey).
|
|
270
277
|
* Gets the content of an attachment.
|
|
271
278
|
*
|
|
272
279
|
* @param attachmentId The ID of the attachment
|
|
@@ -274,7 +281,7 @@ export class TurnContext {
|
|
|
274
281
|
* @returns A promise that resolves to a readable stream of the attachment content
|
|
275
282
|
*/
|
|
276
283
|
async getAttachment (attachmentId: string, viewId: string): Promise<NodeJS.ReadableStream> {
|
|
277
|
-
return await this.adapter.getAttachment(attachmentId, viewId)
|
|
284
|
+
return await this.adapter.getAttachment(this, attachmentId, viewId)
|
|
278
285
|
}
|
|
279
286
|
|
|
280
287
|
/**
|
|
@@ -348,6 +355,10 @@ export class TurnContext {
|
|
|
348
355
|
return this._activity as Activity
|
|
349
356
|
}
|
|
350
357
|
|
|
358
|
+
get identity (): JwtPayload {
|
|
359
|
+
return this._identity as JwtPayload
|
|
360
|
+
}
|
|
361
|
+
|
|
351
362
|
/**
|
|
352
363
|
* Gets or sets whether the turn has sent a response to the user.
|
|
353
364
|
*
|