@microsoft/agents-hosting 1.1.0-alpha.9.g154c2c8a32 → 1.1.4-g8d884129e7

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.
Files changed (152) hide show
  1. package/dist/package.json +10 -6
  2. package/dist/src/activityWireCompat.d.ts +1 -1
  3. package/dist/src/activityWireCompat.js +11 -3
  4. package/dist/src/activityWireCompat.js.map +1 -1
  5. package/dist/src/agent-client/agentClient.js +7 -3
  6. package/dist/src/agent-client/agentClient.js.map +1 -1
  7. package/dist/src/agent-client/agentResponseHandler.js +6 -2
  8. package/dist/src/agent-client/agentResponseHandler.js.map +1 -1
  9. package/dist/src/app/agentApplication.d.ts +26 -11
  10. package/dist/src/app/agentApplication.js +90 -79
  11. package/dist/src/app/agentApplication.js.map +1 -1
  12. package/dist/src/app/agentApplicationBuilder.d.ts +2 -2
  13. package/dist/src/app/agentApplicationBuilder.js.map +1 -1
  14. package/dist/src/app/agentApplicationOptions.d.ts +9 -2
  15. package/dist/src/app/appRoute.d.ts +7 -0
  16. package/dist/src/app/{authorization.d.ts → auth/authorization.d.ts} +41 -139
  17. package/dist/src/app/auth/authorization.js +188 -0
  18. package/dist/src/app/auth/authorization.js.map +1 -0
  19. package/dist/src/app/auth/authorizationManager.d.ts +71 -0
  20. package/dist/src/app/auth/authorizationManager.js +170 -0
  21. package/dist/src/app/auth/authorizationManager.js.map +1 -0
  22. package/dist/src/app/auth/handlerStorage.d.ts +36 -0
  23. package/dist/src/app/auth/handlerStorage.js +62 -0
  24. package/dist/src/app/auth/handlerStorage.js.map +1 -0
  25. package/dist/src/app/auth/handlers/agenticAuthorization.d.ts +93 -0
  26. package/dist/src/app/auth/handlers/agenticAuthorization.js +134 -0
  27. package/dist/src/app/auth/handlers/agenticAuthorization.js.map +1 -0
  28. package/dist/src/app/auth/handlers/azureBotAuthorization.d.ts +226 -0
  29. package/dist/src/app/auth/handlers/azureBotAuthorization.js +429 -0
  30. package/dist/src/app/auth/handlers/azureBotAuthorization.js.map +1 -0
  31. package/dist/src/app/auth/handlers/index.d.ts +2 -0
  32. package/dist/src/app/auth/handlers/index.js +19 -0
  33. package/dist/src/app/auth/handlers/index.js.map +1 -0
  34. package/dist/src/app/auth/index.d.ts +2 -0
  35. package/dist/src/app/auth/index.js +19 -0
  36. package/dist/src/app/auth/index.js.map +1 -0
  37. package/dist/src/app/auth/types.d.ts +104 -0
  38. package/dist/src/app/auth/types.js +24 -0
  39. package/dist/src/app/auth/types.js.map +1 -0
  40. package/dist/src/app/index.d.ts +3 -3
  41. package/dist/src/app/index.js +2 -3
  42. package/dist/src/app/index.js.map +1 -1
  43. package/dist/src/app/routeList.d.ts +1 -1
  44. package/dist/src/app/routeList.js +22 -5
  45. package/dist/src/app/routeList.js.map +1 -1
  46. package/dist/src/app/streaming/streamingResponse.js +2 -1
  47. package/dist/src/app/streaming/streamingResponse.js.map +1 -1
  48. package/dist/src/auth/MemoryCache.d.ts +16 -0
  49. package/dist/src/auth/MemoryCache.js +58 -0
  50. package/dist/src/auth/MemoryCache.js.map +1 -0
  51. package/dist/src/auth/authConfiguration.d.ts +44 -2
  52. package/dist/src/auth/authConfiguration.js +209 -53
  53. package/dist/src/auth/authConfiguration.js.map +1 -1
  54. package/dist/src/auth/authConstants.d.ts +11 -0
  55. package/dist/src/auth/authConstants.js +15 -0
  56. package/dist/src/auth/authConstants.js.map +1 -0
  57. package/dist/src/auth/authProvider.d.ts +26 -0
  58. package/dist/src/auth/connections.d.ts +41 -0
  59. package/dist/src/auth/connections.js +7 -0
  60. package/dist/src/auth/connections.js.map +1 -0
  61. package/dist/src/auth/index.d.ts +2 -0
  62. package/dist/src/auth/index.js +2 -0
  63. package/dist/src/auth/index.js.map +1 -1
  64. package/dist/src/auth/jwt-middleware.js +31 -18
  65. package/dist/src/auth/jwt-middleware.js.map +1 -1
  66. package/dist/src/auth/msalConnectionManager.d.ts +64 -0
  67. package/dist/src/auth/msalConnectionManager.js +148 -0
  68. package/dist/src/auth/msalConnectionManager.js.map +1 -0
  69. package/dist/src/auth/msalTokenProvider.d.ts +38 -0
  70. package/dist/src/auth/msalTokenProvider.js +189 -16
  71. package/dist/src/auth/msalTokenProvider.js.map +1 -1
  72. package/dist/src/baseAdapter.d.ts +10 -25
  73. package/dist/src/baseAdapter.js +2 -15
  74. package/dist/src/baseAdapter.js.map +1 -1
  75. package/dist/src/cards/cardFactory.d.ts +2 -1
  76. package/dist/src/cards/cardFactory.js +3 -2
  77. package/dist/src/cards/cardFactory.js.map +1 -1
  78. package/dist/src/cloudAdapter.d.ts +40 -23
  79. package/dist/src/cloudAdapter.js +143 -63
  80. package/dist/src/cloudAdapter.js.map +1 -1
  81. package/dist/src/connector-client/connectorClient.d.ts +15 -0
  82. package/dist/src/connector-client/connectorClient.js +49 -15
  83. package/dist/src/connector-client/connectorClient.js.map +1 -1
  84. package/dist/src/index.d.ts +0 -1
  85. package/dist/src/index.js +0 -1
  86. package/dist/src/index.js.map +1 -1
  87. package/dist/src/oauth/customUserTokenAPI.d.ts +1 -0
  88. package/dist/src/oauth/customUserTokenAPI.js +11 -0
  89. package/dist/src/oauth/customUserTokenAPI.js.map +1 -0
  90. package/dist/src/oauth/index.d.ts +0 -1
  91. package/dist/src/oauth/index.js +0 -1
  92. package/dist/src/oauth/index.js.map +1 -1
  93. package/dist/src/oauth/userTokenClient.d.ts +30 -13
  94. package/dist/src/oauth/userTokenClient.js +62 -26
  95. package/dist/src/oauth/userTokenClient.js.map +1 -1
  96. package/dist/src/oauth/userTokenClient.types.d.ts +19 -6
  97. package/dist/src/transcript/fileTranscriptLogger.d.ts +109 -0
  98. package/dist/src/transcript/fileTranscriptLogger.js +398 -0
  99. package/dist/src/transcript/fileTranscriptLogger.js.map +1 -0
  100. package/dist/src/turnContext.d.ts +7 -1
  101. package/dist/src/turnContext.js +11 -4
  102. package/dist/src/turnContext.js.map +1 -1
  103. package/package.json +10 -6
  104. package/src/activityWireCompat.ts +12 -4
  105. package/src/agent-client/agentClient.ts +9 -3
  106. package/src/agent-client/agentResponseHandler.ts +5 -2
  107. package/src/app/agentApplication.ts +95 -74
  108. package/src/app/agentApplicationBuilder.ts +2 -2
  109. package/src/app/agentApplicationOptions.ts +10 -2
  110. package/src/app/appRoute.ts +8 -0
  111. package/src/app/auth/authorization.ts +261 -0
  112. package/src/app/auth/authorizationManager.ts +213 -0
  113. package/src/app/auth/handlerStorage.ts +61 -0
  114. package/src/app/auth/handlers/agenticAuthorization.ts +183 -0
  115. package/src/app/auth/handlers/azureBotAuthorization.ts +606 -0
  116. package/src/app/auth/handlers/index.ts +2 -0
  117. package/src/app/auth/index.ts +2 -0
  118. package/src/app/auth/types.ts +111 -0
  119. package/src/app/index.ts +3 -3
  120. package/src/app/routeList.ts +24 -5
  121. package/src/app/streaming/streamingResponse.ts +2 -1
  122. package/src/auth/MemoryCache.ts +59 -0
  123. package/src/auth/authConfiguration.ts +245 -52
  124. package/src/auth/authConstants.ts +11 -0
  125. package/src/auth/authProvider.ts +34 -0
  126. package/src/auth/connections.ts +47 -0
  127. package/src/auth/index.ts +2 -0
  128. package/src/auth/jwt-middleware.ts +38 -21
  129. package/src/auth/msalConnectionManager.ts +175 -0
  130. package/src/auth/msalTokenProvider.ts +231 -9
  131. package/src/baseAdapter.ts +10 -29
  132. package/src/cards/cardFactory.ts +3 -2
  133. package/src/cloudAdapter.ts +207 -72
  134. package/src/connector-client/connectorClient.ts +59 -15
  135. package/src/index.ts +0 -1
  136. package/src/oauth/customUserTokenAPI.ts +5 -0
  137. package/src/oauth/index.ts +0 -1
  138. package/src/oauth/userTokenClient.ts +76 -22
  139. package/src/oauth/userTokenClient.types.ts +20 -8
  140. package/src/transcript/fileTranscriptLogger.ts +409 -0
  141. package/src/turnContext.ts +16 -5
  142. package/dist/src/app/authorization.js +0 -387
  143. package/dist/src/app/authorization.js.map +0 -1
  144. package/dist/src/claimsIdentity.d.ts +0 -35
  145. package/dist/src/claimsIdentity.js +0 -43
  146. package/dist/src/claimsIdentity.js.map +0 -1
  147. package/dist/src/oauth/oAuthFlow.d.ts +0 -119
  148. package/dist/src/oauth/oAuthFlow.js +0 -316
  149. package/dist/src/oauth/oAuthFlow.js.map +0 -1
  150. package/src/app/authorization.ts +0 -432
  151. package/src/claimsIdentity.ts +0 -47
  152. package/src/oauth/oAuthFlow.ts +0 -378
@@ -16,7 +16,6 @@ export * from './activityHandler';
16
16
  export * from './baseAdapter';
17
17
  export * from './cloudAdapter';
18
18
  export * from './middlewareSet';
19
- export * from './claimsIdentity';
20
19
  export * from './messageFactory';
21
20
  export * from './statusCodes';
22
21
  export * from './turnContext';
package/dist/src/index.js CHANGED
@@ -34,7 +34,6 @@ __exportStar(require("./activityHandler"), exports);
34
34
  __exportStar(require("./baseAdapter"), exports);
35
35
  __exportStar(require("./cloudAdapter"), exports);
36
36
  __exportStar(require("./middlewareSet"), exports);
37
- __exportStar(require("./claimsIdentity"), exports);
38
37
  __exportStar(require("./messageFactory"), exports);
39
38
  __exportStar(require("./statusCodes"), exports);
40
39
  __exportStar(require("./turnContext"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,0CAAuB;AACvB,wDAAoD;AAA3C,8GAAA,YAAY,OAAA;AAErB,wCAAqB;AACrB,0CAAuB;AACvB,qDAAkC;AAClC,2CAAwB;AACxB,0CAAuB;AACvB,0CAAuB;AACvB,4CAAyB;AACzB,+CAA4B;AAE5B,oDAAiC;AACjC,gDAA6B;AAC7B,iDAA8B;AAC9B,kDAA+B;AAC/B,mDAAgC;AAChC,mDAAgC;AAChC,gDAA6B;AAC7B,gDAA6B;AAC7B,+DAA4C;AAC5C,oDAAiC;AACjC,sDAAmC;AAEnC,iDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,0CAAuB;AACvB,wDAAoD;AAA3C,8GAAA,YAAY,OAAA;AAErB,wCAAqB;AACrB,0CAAuB;AACvB,qDAAkC;AAClC,2CAAwB;AACxB,0CAAuB;AACvB,0CAAuB;AACvB,4CAAyB;AACzB,+CAA4B;AAE5B,oDAAiC;AACjC,gDAA6B;AAC7B,iDAA8B;AAC9B,kDAA+B;AAC/B,mDAAgC;AAChC,gDAA6B;AAC7B,gDAA6B;AAC7B,+DAA4C;AAC5C,oDAAiC;AACjC,sDAAmC;AAEnC,iDAA8B"}
@@ -0,0 +1 @@
1
+ export declare const getTokenServiceEndpoint: () => string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTokenServiceEndpoint = void 0;
4
+ // Copyright (c) Microsoft Corporation. All rights reserved.
5
+ // Licensed under the MIT License.
6
+ const getTokenServiceEndpoint = () => {
7
+ var _a;
8
+ return (_a = process.env.TOKEN_SERVICE_ENDPOINT) !== null && _a !== void 0 ? _a : 'https://api.botframework.com';
9
+ };
10
+ exports.getTokenServiceEndpoint = getTokenServiceEndpoint;
11
+ //# sourceMappingURL=customUserTokenAPI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customUserTokenAPI.js","sourceRoot":"","sources":["../../../src/oauth/customUserTokenAPI.ts"],"names":[],"mappings":";;;AAAA,4DAA4D;AAC5D,kCAAkC;AAC3B,MAAM,uBAAuB,GAAG,GAAW,EAAE;;IAClD,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,sBAAsB,mCAAI,8BAA8B,CAAA;AAC7E,CAAC,CAAA;AAFY,QAAA,uBAAuB,2BAEnC"}
@@ -1,3 +1,2 @@
1
1
  export * from './userTokenClient';
2
- export * from './oAuthFlow';
3
2
  export * from './userTokenClient.types';
@@ -15,6 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./userTokenClient"), exports);
18
- __exportStar(require("./oAuthFlow"), exports);
19
18
  __exportStar(require("./userTokenClient.types"), exports);
20
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/oauth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,8CAA2B;AAC3B,0DAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/oauth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,0DAAuC"}
@@ -1,34 +1,51 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import { ConversationReference } from '@microsoft/agents-activity';
3
3
  import { AadResourceUrls, SignInResource, TokenExchangeRequest, TokenOrSinginResourceResponse, TokenResponse, TokenStatus } from './userTokenClient.types';
4
+ import { AuthProvider } from '../auth';
5
+ import { HeaderPropagationCollection } from '../headerPropagation';
4
6
  /**
5
7
  * Client for managing user tokens.
6
8
  */
7
9
  export declare class UserTokenClient {
8
- private msAppId;
9
10
  client: AxiosInstance;
11
+ private msAppId;
10
12
  /**
11
13
  * Creates a new instance of UserTokenClient.
12
14
  * @param msAppId The Microsoft application ID.
13
15
  */
14
16
  constructor(msAppId: string);
17
+ /**
18
+ * Creates a new instance of UserTokenClient.
19
+ * @param axiosInstance The axios instance.
20
+ */
21
+ constructor(axiosInstance: AxiosInstance);
22
+ /**
23
+ * Creates a new instance of UserTokenClient with authentication.
24
+ * @param baseURL - The base URL for the API.
25
+ * @param authConfig - The authentication configuration.
26
+ * @param authProvider - The authentication provider.
27
+ * @param scope - The scope for the authentication token.
28
+ * @param headers - Optional headers to propagate in the request.
29
+ * @returns A new instance of ConnectorClient.
30
+ */
31
+ static createClientWithScope(baseURL: string, authProvider: AuthProvider, scope: string, headers?: HeaderPropagationCollection): Promise<UserTokenClient>;
15
32
  /**
16
33
  * Gets the user token.
17
34
  * @param connectionName The connection name.
18
- * @param channelId The channel ID.
35
+ * @param channelIdComposite The channel ID.
19
36
  * @param userId The user ID.
20
37
  * @param code The optional code.
21
38
  * @returns A promise that resolves to the user token.
22
39
  */
23
- getUserToken(connectionName: string, channelId: string, userId: string, code?: string): Promise<TokenResponse>;
40
+ getUserToken(connectionName: string, channelIdComposite: string, userId: string, code?: string): Promise<TokenResponse>;
24
41
  /**
25
42
  * Signs the user out.
26
43
  * @param userId The user ID.
27
44
  * @param connectionName The connection name.
28
- * @param channelId The channel ID.
45
+ * @param channelIdComposite The channel ID.
29
46
  * @returns A promise that resolves when the sign-out operation is complete.
30
47
  */
31
- signOut(userId: string, connectionName: string, channelId: string): Promise<void>;
48
+ signOut(userId: string, connectionName: string, channelIdComposite: string): Promise<void>;
32
49
  /**
33
50
  * Gets the sign-in resource.
34
51
  * @param msAppId The application ID.
@@ -42,16 +59,16 @@ export declare class UserTokenClient {
42
59
  * Exchanges the token.
43
60
  * @param userId The user ID.
44
61
  * @param connectionName The connection name.
45
- * @param channelId The channel ID.
62
+ * @param channelIdComposite The channel ID.
46
63
  * @param tokenExchangeRequest The token exchange request.
47
64
  * @returns A promise that resolves to the exchanged token.
48
65
  */
49
- exchangeTokenAsync(userId: string, connectionName: string, channelId: string, tokenExchangeRequest: TokenExchangeRequest): Promise<TokenResponse>;
66
+ exchangeTokenAsync(userId: string, connectionName: string, channelIdComposite: string, tokenExchangeRequest: TokenExchangeRequest): Promise<TokenResponse>;
50
67
  /**
51
68
  * Gets the token or sign-in resource.
52
69
  * @param userId The user ID.
53
70
  * @param connectionName The connection name.
54
- * @param channelId The channel ID.
71
+ * @param channelIdComposite The channel ID.
55
72
  * @param conversation The conversation reference.
56
73
  * @param relatesTo The related conversation reference.
57
74
  * @param code The code.
@@ -59,23 +76,23 @@ export declare class UserTokenClient {
59
76
  * @param fwdUrl The forward URL.
60
77
  * @returns A promise that resolves to the token or sign-in resource response.
61
78
  */
62
- getTokenOrSignInResource(userId: string, connectionName: string, channelId: string, conversation: ConversationReference, relatesTo: ConversationReference, code: string, finalRedirect?: string, fwdUrl?: string): Promise<TokenOrSinginResourceResponse>;
79
+ getTokenOrSignInResource(userId: string, connectionName: string, channelIdComposite: string, conversation: ConversationReference, relatesTo: ConversationReference, code: string, finalRedirect?: string, fwdUrl?: string): Promise<TokenOrSinginResourceResponse>;
63
80
  /**
64
81
  * Gets the token status.
65
82
  * @param userId The user ID.
66
- * @param channelId The channel ID.
83
+ * @param channelIdComposite The channel ID.
67
84
  * @param include The optional include parameter.
68
85
  * @returns A promise that resolves to the token status.
69
86
  */
70
- getTokenStatus(userId: string, channelId: string, include?: string): Promise<TokenStatus[]>;
87
+ getTokenStatus(userId: string, channelIdComposite: string, include?: string): Promise<TokenStatus[]>;
71
88
  /**
72
89
  * Gets the AAD tokens.
73
90
  * @param userId The user ID.
74
91
  * @param connectionName The connection name.
75
- * @param channelId The channel ID.
92
+ * @param channelIdComposite The channel ID.
76
93
  * @param resourceUrls The resource URLs.
77
94
  * @returns A promise that resolves to the AAD tokens.
78
95
  */
79
- getAadTokens(userId: string, connectionName: string, channelId: string, resourceUrls: AadResourceUrls): Promise<Record<string, TokenResponse>>;
96
+ getAadTokens(userId: string, connectionName: string, channelIdComposite: string, resourceUrls: AadResourceUrls): Promise<Record<string, TokenResponse>>;
80
97
  updateAuthToken(token: string): void;
81
98
  }
@@ -7,28 +7,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.UserTokenClient = void 0;
9
9
  const axios_1 = __importDefault(require("axios"));
10
+ const agents_activity_1 = require("@microsoft/agents-activity");
10
11
  const logger_1 = require("@microsoft/agents-activity/logger");
11
12
  const activityWireCompat_1 = require("../activityWireCompat");
12
13
  const getProductInfo_1 = require("../getProductInfo");
14
+ const customUserTokenAPI_1 = require("./customUserTokenAPI");
13
15
  const logger = (0, logger_1.debug)('agents:user-token-client');
14
16
  /**
15
17
  * Client for managing user tokens.
16
18
  */
17
19
  class UserTokenClient {
18
- /**
19
- * Creates a new instance of UserTokenClient.
20
- * @param msAppId The Microsoft application ID.
21
- */
22
- constructor(msAppId) {
23
- this.msAppId = msAppId;
24
- const baseURL = 'https://api.botframework.com';
25
- this.client = axios_1.default.create({
26
- baseURL,
27
- headers: {
28
- Accept: 'application/json',
29
- 'User-Agent': (0, getProductInfo_1.getProductInfo)(),
30
- }
31
- });
20
+ constructor(param) {
21
+ this.msAppId = '';
22
+ if (typeof param === 'string') {
23
+ const baseURL = (0, customUserTokenAPI_1.getTokenServiceEndpoint)();
24
+ this.client = axios_1.default.create({
25
+ baseURL,
26
+ headers: {
27
+ Accept: 'application/json',
28
+ 'User-Agent': (0, getProductInfo_1.getProductInfo)(),
29
+ }
30
+ });
31
+ }
32
+ else {
33
+ this.client = param;
34
+ }
32
35
  this.client.interceptors.request.use((config) => {
33
36
  const { method, url, data, headers, params } = config;
34
37
  const { Authorization, authorization, ...headersToLog } = headers || {};
@@ -75,15 +78,43 @@ class UserTokenClient {
75
78
  }
76
79
  });
77
80
  }
81
+ /**
82
+ * Creates a new instance of UserTokenClient with authentication.
83
+ * @param baseURL - The base URL for the API.
84
+ * @param authConfig - The authentication configuration.
85
+ * @param authProvider - The authentication provider.
86
+ * @param scope - The scope for the authentication token.
87
+ * @param headers - Optional headers to propagate in the request.
88
+ * @returns A new instance of ConnectorClient.
89
+ */
90
+ static async createClientWithScope(baseURL, authProvider, scope, headers) {
91
+ // TODO: add header propagation logic
92
+ const axiosInstance = axios_1.default.create({
93
+ baseURL,
94
+ headers: {
95
+ Accept: 'application/json',
96
+ 'Content-Type': 'application/json', // Required by transformRequest
97
+ 'User-Agent': (0, getProductInfo_1.getProductInfo)(),
98
+ },
99
+ });
100
+ if (authProvider) {
101
+ const token = await authProvider.getAccessToken(scope);
102
+ if (token.length > 1) {
103
+ axiosInstance.defaults.headers.common.Authorization = `Bearer ${token}`;
104
+ }
105
+ }
106
+ return new UserTokenClient(axiosInstance);
107
+ }
78
108
  /**
79
109
  * Gets the user token.
80
110
  * @param connectionName The connection name.
81
- * @param channelId The channel ID.
111
+ * @param channelIdComposite The channel ID.
82
112
  * @param userId The user ID.
83
113
  * @param code The optional code.
84
114
  * @returns A promise that resolves to the user token.
85
115
  */
86
- async getUserToken(connectionName, channelId, userId, code) {
116
+ async getUserToken(connectionName, channelIdComposite, userId, code) {
117
+ const [channelId] = agents_activity_1.Activity.parseChannelId(channelIdComposite);
87
118
  const params = { connectionName, channelId, userId, code };
88
119
  const response = await this.client.get('/api/usertoken/GetToken', { params });
89
120
  if (response === null || response === void 0 ? void 0 : response.data) {
@@ -95,10 +126,11 @@ class UserTokenClient {
95
126
  * Signs the user out.
96
127
  * @param userId The user ID.
97
128
  * @param connectionName The connection name.
98
- * @param channelId The channel ID.
129
+ * @param channelIdComposite The channel ID.
99
130
  * @returns A promise that resolves when the sign-out operation is complete.
100
131
  */
101
- async signOut(userId, connectionName, channelId) {
132
+ async signOut(userId, connectionName, channelIdComposite) {
133
+ const [channelId] = agents_activity_1.Activity.parseChannelId(channelIdComposite);
102
134
  const params = { userId, connectionName, channelId };
103
135
  const response = await this.client.delete('/api/usertoken/SignOut', { params });
104
136
  if (response.status !== 200) {
@@ -130,11 +162,12 @@ class UserTokenClient {
130
162
  * Exchanges the token.
131
163
  * @param userId The user ID.
132
164
  * @param connectionName The connection name.
133
- * @param channelId The channel ID.
165
+ * @param channelIdComposite The channel ID.
134
166
  * @param tokenExchangeRequest The token exchange request.
135
167
  * @returns A promise that resolves to the exchanged token.
136
168
  */
137
- async exchangeTokenAsync(userId, connectionName, channelId, tokenExchangeRequest) {
169
+ async exchangeTokenAsync(userId, connectionName, channelIdComposite, tokenExchangeRequest) {
170
+ const [channelId] = agents_activity_1.Activity.parseChannelId(channelIdComposite);
138
171
  const params = { userId, connectionName, channelId };
139
172
  const response = await this.client.post('/api/usertoken/exchange', tokenExchangeRequest, { params });
140
173
  if (response === null || response === void 0 ? void 0 : response.data) {
@@ -148,7 +181,7 @@ class UserTokenClient {
148
181
  * Gets the token or sign-in resource.
149
182
  * @param userId The user ID.
150
183
  * @param connectionName The connection name.
151
- * @param channelId The channel ID.
184
+ * @param channelIdComposite The channel ID.
152
185
  * @param conversation The conversation reference.
153
186
  * @param relatesTo The related conversation reference.
154
187
  * @param code The code.
@@ -156,7 +189,8 @@ class UserTokenClient {
156
189
  * @param fwdUrl The forward URL.
157
190
  * @returns A promise that resolves to the token or sign-in resource response.
158
191
  */
159
- async getTokenOrSignInResource(userId, connectionName, channelId, conversation, relatesTo, code, finalRedirect = '', fwdUrl = '') {
192
+ async getTokenOrSignInResource(userId, connectionName, channelIdComposite, conversation, relatesTo, code, finalRedirect = '', fwdUrl = '') {
193
+ const [channelId] = agents_activity_1.Activity.parseChannelId(channelIdComposite);
160
194
  const state = Buffer.from(JSON.stringify({ conversation, relatesTo, connectionName, msAppId: this.msAppId })).toString('base64');
161
195
  const params = { userId, connectionName, channelId, state, code, finalRedirect, fwdUrl };
162
196
  const response = await this.client.get('/api/usertoken/GetTokenOrSignInResource', { params });
@@ -165,11 +199,12 @@ class UserTokenClient {
165
199
  /**
166
200
  * Gets the token status.
167
201
  * @param userId The user ID.
168
- * @param channelId The channel ID.
202
+ * @param channelIdComposite The channel ID.
169
203
  * @param include The optional include parameter.
170
204
  * @returns A promise that resolves to the token status.
171
205
  */
172
- async getTokenStatus(userId, channelId, include = null) {
206
+ async getTokenStatus(userId, channelIdComposite, include = null) {
207
+ const [channelId] = agents_activity_1.Activity.parseChannelId(channelIdComposite);
173
208
  const params = { userId, channelId, include };
174
209
  const response = await this.client.get('/api/usertoken/GetTokenStatus', { params });
175
210
  return response.data;
@@ -178,11 +213,12 @@ class UserTokenClient {
178
213
  * Gets the AAD tokens.
179
214
  * @param userId The user ID.
180
215
  * @param connectionName The connection name.
181
- * @param channelId The channel ID.
216
+ * @param channelIdComposite The channel ID.
182
217
  * @param resourceUrls The resource URLs.
183
218
  * @returns A promise that resolves to the AAD tokens.
184
219
  */
185
- async getAadTokens(userId, connectionName, channelId, resourceUrls) {
220
+ async getAadTokens(userId, connectionName, channelIdComposite, resourceUrls) {
221
+ const [channelId] = agents_activity_1.Activity.parseChannelId(channelIdComposite);
186
222
  const params = { userId, connectionName, channelId };
187
223
  const response = await this.client.post('/api/usertoken/GetAadTokens', resourceUrls, { params });
188
224
  return response.data;
@@ -1 +1 @@
1
- {"version":3,"file":"userTokenClient.js","sourceRoot":"","sources":["../../../src/oauth/userTokenClient.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,kCAAkC;;;;;;AAElC,kDAA4C;AAE5C,8DAAyD;AACzD,8DAAmE;AAEnE,sDAAkD;AAElD,MAAM,MAAM,GAAG,IAAA,cAAK,EAAC,0BAA0B,CAAC,CAAA;AAEhD;;GAEG;AACH,MAAa,eAAe;IAE1B;;;OAGG;IACH,YAAqB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAClC,MAAM,OAAO,GAAG,8BAA8B,CAAA;QAC9C,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO;YACP,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,YAAY,EAAE,IAAA,+BAAc,GAAE;aAC/B;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9C,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAA;YACrD,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,YAAY,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;YACvE,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE;gBACxB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;gBAC1B,GAAG;gBACH,IAAI;gBACJ,MAAM;gBACN,MAAM;gBACN,OAAO,EAAE,YAAY;aACtB,CAAC,CAAA;YACF,OAA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QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAA;IACvE,CAAC;CACF;AA9OD,0CA8OC"}
@@ -15,17 +15,30 @@ export interface TokenResponse {
15
15
  */
16
16
  export interface TokenExchangeRequest {
17
17
  /**
18
- * The URI for the token exchange request.
19
- */
18
+ * The URI for the token exchange request.
19
+ */
20
20
  uri?: string;
21
21
  /**
22
- * The token to be exchanged.
23
- */
22
+ * The token to be exchanged.
23
+ */
24
24
  token?: string;
25
+ }
26
+ /**
27
+ * Represents the response for a token exchange invoke operation.
28
+ */
29
+ export interface TokenExchangeInvokeResponse {
25
30
  /**
26
- * The ID associated with the token exchange request.
27
- */
31
+ * The connection name associated with the token exchange response.
32
+ */
33
+ connectionName: string;
34
+ /**
35
+ * The ID associated with the token exchange response.
36
+ */
28
37
  id?: string;
38
+ /**
39
+ * (Optional) Details about any failure that occurred during the token exchange.
40
+ */
41
+ failureDetail?: string;
29
42
  }
30
43
  /**
31
44
  * Represents a resource for exchanging tokens.
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { PagedResult, TranscriptInfo } from './transcriptLogger';
6
+ import { TranscriptStore } from './transcriptStore';
7
+ import { Activity } from '@microsoft/agents-activity';
8
+ /**
9
+ * FileTranscriptLogger which creates a .transcript file for each conversationId.
10
+ * @remarks
11
+ * This is a useful class for unit tests.
12
+ *
13
+ * Concurrency Safety:
14
+ * - Uses an in-memory promise chain to serialize writes within the same Node.js process
15
+ * - Prevents race conditions and file corruption when multiple concurrent writes occur
16
+ * - Optimized for performance with minimal overhead (no file-based locking)
17
+ *
18
+ * Note: This implementation is designed for single-process scenarios. For multi-server
19
+ * deployments, consider using a database-backed transcript store.
20
+ */
21
+ export declare class FileTranscriptLogger implements TranscriptStore {
22
+ private static readonly TRANSCRIPT_FILE_EXTENSION;
23
+ private static readonly MAX_FILE_NAME_SIZE;
24
+ private readonly _folder;
25
+ private readonly _fileLocks;
26
+ /**
27
+ * Initializes a new instance of the FileTranscriptLogger class.
28
+ * @param folder - Folder to place the transcript files (Default current directory).
29
+ */
30
+ constructor(folder?: string);
31
+ /**
32
+ * Log an activity to the transcript.
33
+ * @param activity - The activity to transcribe.
34
+ * @returns A promise that represents the work queued to execute.
35
+ */
36
+ logActivity(activity: Activity): Promise<void>;
37
+ /**
38
+ * Gets from the store activities that match a set of criteria.
39
+ * @param channelId - The ID of the channel the conversation is in.
40
+ * @param conversationId - The ID of the conversation.
41
+ * @param continuationToken - The continuation token (if available).
42
+ * @param startDate - A cutoff date. Activities older than this date are not included.
43
+ * @returns A promise that resolves with the matching activities.
44
+ */
45
+ getTranscriptActivities(channelId: string, conversationId: string, continuationToken?: string, startDate?: Date): Promise<PagedResult<Activity>>;
46
+ /**
47
+ * Gets the conversations on a channel from the store.
48
+ * @param channelId - The ID of the channel.
49
+ * @param continuationToken - Continuation token (if available).
50
+ * @returns A promise that resolves with all transcripts for the given ChannelID.
51
+ */
52
+ listTranscripts(channelId: string, continuationToken?: string): Promise<PagedResult<TranscriptInfo>>;
53
+ /**
54
+ * Deletes conversation data from the store.
55
+ * @param channelId - The ID of the channel the conversation is in.
56
+ * @param conversationId - The ID of the conversation to delete.
57
+ * @returns A promise that represents the work queued to execute.
58
+ */
59
+ deleteTranscript(channelId: string, conversationId: string): Promise<void>;
60
+ /**
61
+ * Loads a transcript from a file.
62
+ */
63
+ private loadTranscriptAsync;
64
+ /**
65
+ * Executes a file operation with exclusive locking per file.
66
+ * This ensures that concurrent writes to the same transcript file are serialized.
67
+ */
68
+ private withFileLock;
69
+ /**
70
+ * Performs the actual write operation to the transcript file.
71
+ */
72
+ private logActivityToFile;
73
+ /**
74
+ * Updates a message in the transcript.
75
+ */
76
+ private messageUpdateAsync;
77
+ /**
78
+ * Deletes a message from the transcript (tombstones it).
79
+ */
80
+ private messageDeleteAsync;
81
+ /**
82
+ * Sanitizes a string by removing invalid characters.
83
+ */
84
+ private static sanitizeString;
85
+ /**
86
+ * Gets the transcript file path for a conversation.
87
+ */
88
+ private getTranscriptFile;
89
+ /**
90
+ * Gets the channel folder path, creating it if necessary.
91
+ */
92
+ private getChannelFolder;
93
+ /**
94
+ * Checks if a file or directory exists.
95
+ */
96
+ private pathExists;
97
+ /**
98
+ * Gets invalid filename characters for the current platform.
99
+ */
100
+ private getInvalidFileNameChars;
101
+ /**
102
+ * Gets invalid path characters for the current platform.
103
+ */
104
+ private getInvalidPathChars;
105
+ /**
106
+ * Adds file:// protocol to a file path.
107
+ */
108
+ private protocol;
109
+ }