@microsoft/agents-hosting 1.1.0-alpha.5 → 1.1.0-alpha.75
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.d.ts +1 -1
- package/dist/src/activityWireCompat.js +11 -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 +28 -13
- package/dist/src/app/agentApplication.js +93 -82
- 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/{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 +93 -0
- package/dist/src/app/auth/handlers/agenticAuthorization.js +134 -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/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.js +2 -1
- package/dist/src/app/streaming/streamingResponse.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 +209 -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 +41 -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 +64 -0
- package/dist/src/auth/msalConnectionManager.js +148 -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 +128 -60
- package/dist/src/cloudAdapter.js.map +1 -1
- package/dist/src/connector-client/connectorClient.d.ts +15 -0
- package/dist/src/connector-client/connectorClient.js +49 -15
- 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/customUserTokenAPI.d.ts +1 -0
- package/dist/src/oauth/customUserTokenAPI.js +11 -0
- package/dist/src/oauth/customUserTokenAPI.js.map +1 -0
- 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 +60 -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 +12 -4
- package/src/agent-client/agentClient.ts +9 -3
- package/src/agent-client/agentResponseHandler.ts +5 -2
- package/src/app/agentApplication.ts +98 -77
- package/src/app/agentApplicationBuilder.ts +2 -2
- package/src/app/agentApplicationOptions.ts +10 -2
- package/src/app/appRoute.ts +8 -0
- 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 +182 -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/routeList.ts +24 -5
- package/src/app/streaming/streamingResponse.ts +2 -1
- package/src/auth/MemoryCache.ts +59 -0
- package/src/auth/authConfiguration.ts +245 -52
- package/src/auth/authConstants.ts +11 -0
- package/src/auth/authProvider.ts +31 -0
- package/src/auth/connections.ts +47 -0
- package/src/auth/index.ts +2 -0
- package/src/auth/jwt-middleware.ts +38 -21
- package/src/auth/msalConnectionManager.ts +175 -0
- package/src/auth/msalTokenProvider.ts +209 -9
- package/src/baseAdapter.ts +10 -29
- package/src/cloudAdapter.ts +189 -71
- package/src/connector-client/connectorClient.ts +59 -15
- package/src/index.ts +0 -1
- package/src/oauth/customUserTokenAPI.ts +5 -0
- package/src/oauth/index.ts +0 -1
- package/src/oauth/userTokenClient.ts +74 -22
- 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,14 @@
|
|
|
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
7
|
import { 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'
|
|
12
|
+
import { getTokenServiceEndpoint } from './customUserTokenAPI'
|
|
10
13
|
|
|
11
14
|
const logger = debug('agents:user-token-client')
|
|
12
15
|
|
|
@@ -15,19 +18,31 @@ const logger = debug('agents:user-token-client')
|
|
|
15
18
|
*/
|
|
16
19
|
export class UserTokenClient {
|
|
17
20
|
client: AxiosInstance
|
|
21
|
+
private msAppId: string = ''
|
|
18
22
|
/**
|
|
19
23
|
* Creates a new instance of UserTokenClient.
|
|
20
24
|
* @param msAppId The Microsoft application ID.
|
|
21
25
|
*/
|
|
22
|
-
constructor (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
constructor (msAppId: string)
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new instance of UserTokenClient.
|
|
29
|
+
* @param axiosInstance The axios instance.
|
|
30
|
+
*/
|
|
31
|
+
constructor (axiosInstance: AxiosInstance)
|
|
32
|
+
|
|
33
|
+
constructor (param: string | AxiosInstance) {
|
|
34
|
+
if (typeof param === 'string') {
|
|
35
|
+
const baseURL = getTokenServiceEndpoint()
|
|
36
|
+
this.client = axios.create({
|
|
37
|
+
baseURL,
|
|
38
|
+
headers: {
|
|
39
|
+
Accept: 'application/json',
|
|
40
|
+
'User-Agent': getProductInfo(),
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
} else {
|
|
44
|
+
this.client = param
|
|
45
|
+
}
|
|
31
46
|
|
|
32
47
|
this.client.interceptors.request.use((config) => {
|
|
33
48
|
const { method, url, data, headers, params } = config
|
|
@@ -79,15 +94,47 @@ export class UserTokenClient {
|
|
|
79
94
|
})
|
|
80
95
|
}
|
|
81
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new instance of UserTokenClient with authentication.
|
|
99
|
+
* @param baseURL - The base URL for the API.
|
|
100
|
+
* @param authConfig - The authentication configuration.
|
|
101
|
+
* @param authProvider - The authentication provider.
|
|
102
|
+
* @param scope - The scope for the authentication token.
|
|
103
|
+
* @param headers - Optional headers to propagate in the request.
|
|
104
|
+
* @returns A new instance of ConnectorClient.
|
|
105
|
+
*/
|
|
106
|
+
static async createClientWithScope (
|
|
107
|
+
baseURL: string,
|
|
108
|
+
authProvider: AuthProvider,
|
|
109
|
+
scope: string,
|
|
110
|
+
headers?: HeaderPropagationCollection
|
|
111
|
+
): Promise<UserTokenClient> {
|
|
112
|
+
// TODO: add header propagation logic
|
|
113
|
+
const axiosInstance = axios.create({
|
|
114
|
+
baseURL,
|
|
115
|
+
headers: {
|
|
116
|
+
Accept: 'application/json',
|
|
117
|
+
'Content-Type': 'application/json', // Required by transformRequest
|
|
118
|
+
'User-Agent': getProductInfo(),
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
const token = await (authProvider as MsalTokenProvider).getAccessToken(scope)
|
|
122
|
+
if (token.length > 1) {
|
|
123
|
+
axiosInstance.defaults.headers.common.Authorization = `Bearer ${token}`
|
|
124
|
+
}
|
|
125
|
+
return new UserTokenClient(axiosInstance)
|
|
126
|
+
}
|
|
127
|
+
|
|
82
128
|
/**
|
|
83
129
|
* Gets the user token.
|
|
84
130
|
* @param connectionName The connection name.
|
|
85
|
-
* @param
|
|
131
|
+
* @param channelIdComposite The channel ID.
|
|
86
132
|
* @param userId The user ID.
|
|
87
133
|
* @param code The optional code.
|
|
88
134
|
* @returns A promise that resolves to the user token.
|
|
89
135
|
*/
|
|
90
|
-
async getUserToken (connectionName: string,
|
|
136
|
+
async getUserToken (connectionName: string, channelIdComposite: string, userId: string, code?: string) : Promise<TokenResponse> {
|
|
137
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
91
138
|
const params = { connectionName, channelId, userId, code }
|
|
92
139
|
const response = await this.client.get('/api/usertoken/GetToken', { params })
|
|
93
140
|
if (response?.data) {
|
|
@@ -100,10 +147,11 @@ export class UserTokenClient {
|
|
|
100
147
|
* Signs the user out.
|
|
101
148
|
* @param userId The user ID.
|
|
102
149
|
* @param connectionName The connection name.
|
|
103
|
-
* @param
|
|
150
|
+
* @param channelIdComposite The channel ID.
|
|
104
151
|
* @returns A promise that resolves when the sign-out operation is complete.
|
|
105
152
|
*/
|
|
106
|
-
async signOut (userId: string, connectionName: string,
|
|
153
|
+
async signOut (userId: string, connectionName: string, channelIdComposite: string) : Promise<void> {
|
|
154
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
107
155
|
const params = { userId, connectionName, channelId }
|
|
108
156
|
const response = await this.client.delete('/api/usertoken/SignOut', { params })
|
|
109
157
|
if (response.status !== 200) {
|
|
@@ -137,11 +185,12 @@ export class UserTokenClient {
|
|
|
137
185
|
* Exchanges the token.
|
|
138
186
|
* @param userId The user ID.
|
|
139
187
|
* @param connectionName The connection name.
|
|
140
|
-
* @param
|
|
188
|
+
* @param channelIdComposite The channel ID.
|
|
141
189
|
* @param tokenExchangeRequest The token exchange request.
|
|
142
190
|
* @returns A promise that resolves to the exchanged token.
|
|
143
191
|
*/
|
|
144
|
-
async exchangeTokenAsync (userId: string, connectionName: string,
|
|
192
|
+
async exchangeTokenAsync (userId: string, connectionName: string, channelIdComposite: string, tokenExchangeRequest: TokenExchangeRequest) : Promise<TokenResponse> {
|
|
193
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
145
194
|
const params = { userId, connectionName, channelId }
|
|
146
195
|
const response = await this.client.post('/api/usertoken/exchange', tokenExchangeRequest, { params })
|
|
147
196
|
if (response?.data) {
|
|
@@ -155,7 +204,7 @@ export class UserTokenClient {
|
|
|
155
204
|
* Gets the token or sign-in resource.
|
|
156
205
|
* @param userId The user ID.
|
|
157
206
|
* @param connectionName The connection name.
|
|
158
|
-
* @param
|
|
207
|
+
* @param channelIdComposite The channel ID.
|
|
159
208
|
* @param conversation The conversation reference.
|
|
160
209
|
* @param relatesTo The related conversation reference.
|
|
161
210
|
* @param code The code.
|
|
@@ -163,7 +212,8 @@ export class UserTokenClient {
|
|
|
163
212
|
* @param fwdUrl The forward URL.
|
|
164
213
|
* @returns A promise that resolves to the token or sign-in resource response.
|
|
165
214
|
*/
|
|
166
|
-
async getTokenOrSignInResource (userId: string, connectionName: string,
|
|
215
|
+
async getTokenOrSignInResource (userId: string, connectionName: string, channelIdComposite: string, conversation: ConversationReference, relatesTo: ConversationReference, code: string, finalRedirect: string = '', fwdUrl: string = '') : Promise<TokenOrSinginResourceResponse> {
|
|
216
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
167
217
|
const state = Buffer.from(JSON.stringify({ conversation, relatesTo, connectionName, msAppId: this.msAppId })).toString('base64')
|
|
168
218
|
const params = { userId, connectionName, channelId, state, code, finalRedirect, fwdUrl }
|
|
169
219
|
const response = await this.client.get('/api/usertoken/GetTokenOrSignInResource', { params })
|
|
@@ -173,11 +223,12 @@ export class UserTokenClient {
|
|
|
173
223
|
/**
|
|
174
224
|
* Gets the token status.
|
|
175
225
|
* @param userId The user ID.
|
|
176
|
-
* @param
|
|
226
|
+
* @param channelIdComposite The channel ID.
|
|
177
227
|
* @param include The optional include parameter.
|
|
178
228
|
* @returns A promise that resolves to the token status.
|
|
179
229
|
*/
|
|
180
|
-
async getTokenStatus (userId: string,
|
|
230
|
+
async getTokenStatus (userId: string, channelIdComposite: string, include: string = null!): Promise<TokenStatus[]> {
|
|
231
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
181
232
|
const params = { userId, channelId, include }
|
|
182
233
|
const response = await this.client.get('/api/usertoken/GetTokenStatus', { params })
|
|
183
234
|
return response.data as TokenStatus[]
|
|
@@ -187,11 +238,12 @@ export class UserTokenClient {
|
|
|
187
238
|
* Gets the AAD tokens.
|
|
188
239
|
* @param userId The user ID.
|
|
189
240
|
* @param connectionName The connection name.
|
|
190
|
-
* @param
|
|
241
|
+
* @param channelIdComposite The channel ID.
|
|
191
242
|
* @param resourceUrls The resource URLs.
|
|
192
243
|
* @returns A promise that resolves to the AAD tokens.
|
|
193
244
|
*/
|
|
194
|
-
async getAadTokens (userId: string, connectionName: string,
|
|
245
|
+
async getAadTokens (userId: string, connectionName: string, channelIdComposite: string, resourceUrls: AadResourceUrls) : Promise<Record<string, TokenResponse>> {
|
|
246
|
+
const [channelId] = Activity.parseChannelId(channelIdComposite)
|
|
195
247
|
const params = { userId, connectionName, channelId }
|
|
196
248
|
const response = await this.client.post('/api/usertoken/GetAadTokens', resourceUrls, { params })
|
|
197
249
|
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
|
*
|