@microsoft/agents-hosting 0.1.49
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/README.md +57 -0
- package/dist/src/activityHandler.d.ts +108 -0
- package/dist/src/activityHandler.js +395 -0
- package/dist/src/activityHandler.js.map +1 -0
- package/dist/src/agent-client/agentClient.d.ts +13 -0
- package/dist/src/agent-client/agentClient.js +75 -0
- package/dist/src/agent-client/agentClient.js.map +1 -0
- package/dist/src/agent-client/expressApi.d.ts +4 -0
- package/dist/src/agent-client/expressApi.js +50 -0
- package/dist/src/agent-client/expressApi.js.map +1 -0
- package/dist/src/agent-client/index.d.ts +2 -0
- package/dist/src/agent-client/index.js +19 -0
- package/dist/src/agent-client/index.js.map +1 -0
- package/dist/src/app/agentApplication.d.ts +47 -0
- package/dist/src/app/agentApplication.js +317 -0
- package/dist/src/app/agentApplication.js.map +1 -0
- package/dist/src/app/appRoute.d.ts +11 -0
- package/dist/src/app/appRoute.js +7 -0
- package/dist/src/app/appRoute.js.map +1 -0
- package/dist/src/app/applicationBuilder.d.ts +18 -0
- package/dist/src/app/applicationBuilder.js +37 -0
- package/dist/src/app/applicationBuilder.js.map +1 -0
- package/dist/src/app/applicationOptions.d.ts +19 -0
- package/dist/src/app/applicationOptions.js +7 -0
- package/dist/src/app/applicationOptions.js.map +1 -0
- package/dist/src/app/attachmentDownloader.d.ts +13 -0
- package/dist/src/app/attachmentDownloader.js +72 -0
- package/dist/src/app/attachmentDownloader.js.map +1 -0
- package/dist/src/app/conversationUpdateEvents.d.ts +5 -0
- package/dist/src/app/conversationUpdateEvents.js +7 -0
- package/dist/src/app/conversationUpdateEvents.js.map +1 -0
- package/dist/src/app/index.d.ts +10 -0
- package/dist/src/app/index.js +27 -0
- package/dist/src/app/index.js.map +1 -0
- package/dist/src/app/inputFileDownloader.d.ts +14 -0
- package/dist/src/app/inputFileDownloader.js +7 -0
- package/dist/src/app/inputFileDownloader.js.map +1 -0
- package/dist/src/app/memory.d.ts +10 -0
- package/dist/src/app/memory.js +7 -0
- package/dist/src/app/memory.js.map +1 -0
- package/dist/src/app/oauth/authenticationOptions.d.ts +7 -0
- package/dist/src/app/oauth/authenticationOptions.js +7 -0
- package/dist/src/app/oauth/authenticationOptions.js.map +1 -0
- package/dist/src/app/oauth/webChatOAuthFlowAppStyle.d.ts +11 -0
- package/dist/src/app/oauth/webChatOAuthFlowAppStyle.js +85 -0
- package/dist/src/app/oauth/webChatOAuthFlowAppStyle.js.map +1 -0
- package/dist/src/app/routeHandler.d.ts +7 -0
- package/dist/src/app/routeHandler.js +7 -0
- package/dist/src/app/routeHandler.js.map +1 -0
- package/dist/src/app/routeSelector.d.ts +7 -0
- package/dist/src/app/routeSelector.js +7 -0
- package/dist/src/app/routeSelector.js.map +1 -0
- package/dist/src/app/turnEvents.d.ts +5 -0
- package/dist/src/app/turnEvents.js +7 -0
- package/dist/src/app/turnEvents.js.map +1 -0
- package/dist/src/app/turnState.d.ts +85 -0
- package/dist/src/app/turnState.js +274 -0
- package/dist/src/app/turnState.js.map +1 -0
- package/dist/src/app/turnStateEntry.d.ts +17 -0
- package/dist/src/app/turnStateEntry.js +39 -0
- package/dist/src/app/turnStateEntry.js.map +1 -0
- package/dist/src/auth/authConfiguration.d.ts +29 -0
- package/dist/src/auth/authConfiguration.js +58 -0
- package/dist/src/auth/authConfiguration.js.map +1 -0
- package/dist/src/auth/authProvider.d.ts +17 -0
- package/dist/src/auth/authProvider.js +7 -0
- package/dist/src/auth/authProvider.js.map +1 -0
- package/dist/src/auth/index.d.ts +4 -0
- package/dist/src/auth/index.js +21 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/auth/jwt-middleware.d.ts +13 -0
- package/dist/src/auth/jwt-middleware.js +97 -0
- package/dist/src/auth/jwt-middleware.js.map +1 -0
- package/dist/src/auth/msalTokenProvider.d.ts +53 -0
- package/dist/src/auth/msalTokenProvider.js +198 -0
- package/dist/src/auth/msalTokenProvider.js.map +1 -0
- package/dist/src/auth/request.d.ts +15 -0
- package/dist/src/auth/request.js +7 -0
- package/dist/src/auth/request.js.map +1 -0
- package/dist/src/baseAdapter.d.ts +88 -0
- package/dist/src/baseAdapter.js +94 -0
- package/dist/src/baseAdapter.js.map +1 -0
- package/dist/src/cards/animationCard.d.ts +36 -0
- package/dist/src/cards/animationCard.js +7 -0
- package/dist/src/cards/animationCard.js.map +1 -0
- package/dist/src/cards/audioCard.d.ts +36 -0
- package/dist/src/cards/audioCard.js +7 -0
- package/dist/src/cards/audioCard.js.map +1 -0
- package/dist/src/cards/cardFactory.d.ts +123 -0
- package/dist/src/cards/cardFactory.js +225 -0
- package/dist/src/cards/cardFactory.js.map +1 -0
- package/dist/src/cards/cardImage.d.ts +16 -0
- package/dist/src/cards/cardImage.js +7 -0
- package/dist/src/cards/cardImage.js.map +1 -0
- package/dist/src/cards/fact.d.ts +13 -0
- package/dist/src/cards/fact.js +7 -0
- package/dist/src/cards/fact.js.map +1 -0
- package/dist/src/cards/heroCard.d.ts +23 -0
- package/dist/src/cards/heroCard.js +7 -0
- package/dist/src/cards/heroCard.js.map +1 -0
- package/dist/src/cards/index.d.ts +17 -0
- package/dist/src/cards/index.js +34 -0
- package/dist/src/cards/index.js.map +1 -0
- package/dist/src/cards/mediaUrl.d.ts +17 -0
- package/dist/src/cards/mediaUrl.js +7 -0
- package/dist/src/cards/mediaUrl.js.map +1 -0
- package/dist/src/cards/o365ConnectorCard.d.ts +35 -0
- package/dist/src/cards/o365ConnectorCard.js +7 -0
- package/dist/src/cards/o365ConnectorCard.js.map +1 -0
- package/dist/src/cards/o365ConnectorCardActionBase.d.ts +22 -0
- package/dist/src/cards/o365ConnectorCardActionBase.js +7 -0
- package/dist/src/cards/o365ConnectorCardActionBase.js.map +1 -0
- package/dist/src/cards/o365ConnectorCardFact.d.ts +17 -0
- package/dist/src/cards/o365ConnectorCardFact.js +7 -0
- package/dist/src/cards/o365ConnectorCardFact.js.map +1 -0
- package/dist/src/cards/o365ConnectorCardImage.d.ts +17 -0
- package/dist/src/cards/o365ConnectorCardImage.js +7 -0
- package/dist/src/cards/o365ConnectorCardImage.js.map +1 -0
- package/dist/src/cards/o365ConnectorCardSection.d.ts +57 -0
- package/dist/src/cards/o365ConnectorCardSection.js +7 -0
- package/dist/src/cards/o365ConnectorCardSection.js.map +1 -0
- package/dist/src/cards/receiptCard.d.ts +44 -0
- package/dist/src/cards/receiptCard.js +7 -0
- package/dist/src/cards/receiptCard.js.map +1 -0
- package/dist/src/cards/receiptItem.d.ts +39 -0
- package/dist/src/cards/receiptItem.js +7 -0
- package/dist/src/cards/receiptItem.js.map +1 -0
- package/dist/src/cards/signinCard.d.ts +14 -0
- package/dist/src/cards/signinCard.js +5 -0
- package/dist/src/cards/signinCard.js.map +1 -0
- package/dist/src/cards/taskModuleAction.d.ts +43 -0
- package/dist/src/cards/taskModuleAction.js +30 -0
- package/dist/src/cards/taskModuleAction.js.map +1 -0
- package/dist/src/cards/thumbnailCard.d.ts +35 -0
- package/dist/src/cards/thumbnailCard.js +7 -0
- package/dist/src/cards/thumbnailCard.js.map +1 -0
- package/dist/src/cards/thumbnailUrl.d.ts +17 -0
- package/dist/src/cards/thumbnailUrl.js +7 -0
- package/dist/src/cards/thumbnailUrl.js.map +1 -0
- package/dist/src/cards/videoCard.d.ts +60 -0
- package/dist/src/cards/videoCard.js +7 -0
- package/dist/src/cards/videoCard.js.map +1 -0
- package/dist/src/claimsIdentity.d.ts +35 -0
- package/dist/src/claimsIdentity.js +43 -0
- package/dist/src/claimsIdentity.js.map +1 -0
- package/dist/src/cloudAdapter.d.ts +128 -0
- package/dist/src/cloudAdapter.js +376 -0
- package/dist/src/cloudAdapter.js.map +1 -0
- package/dist/src/connector-client/attachmentData.d.ts +25 -0
- package/dist/src/connector-client/attachmentData.js +7 -0
- package/dist/src/connector-client/attachmentData.js.map +1 -0
- package/dist/src/connector-client/attachmentInfo.d.ts +22 -0
- package/dist/src/connector-client/attachmentInfo.js +7 -0
- package/dist/src/connector-client/attachmentInfo.js.map +1 -0
- package/dist/src/connector-client/attachmentView.d.ts +17 -0
- package/dist/src/connector-client/attachmentView.js +7 -0
- package/dist/src/connector-client/attachmentView.js.map +1 -0
- package/dist/src/connector-client/connectorClient.d.ts +93 -0
- package/dist/src/connector-client/connectorClient.js +249 -0
- package/dist/src/connector-client/connectorClient.js.map +1 -0
- package/dist/src/connector-client/conversationMembers.d.ts +18 -0
- package/dist/src/connector-client/conversationMembers.js +7 -0
- package/dist/src/connector-client/conversationMembers.js.map +1 -0
- package/dist/src/connector-client/conversationParameters.d.ts +38 -0
- package/dist/src/connector-client/conversationParameters.js +7 -0
- package/dist/src/connector-client/conversationParameters.js.map +1 -0
- package/dist/src/connector-client/conversationResourceResponse.d.ts +21 -0
- package/dist/src/connector-client/conversationResourceResponse.js +7 -0
- package/dist/src/connector-client/conversationResourceResponse.js.map +1 -0
- package/dist/src/connector-client/conversationsResult.d.ts +18 -0
- package/dist/src/connector-client/conversationsResult.js +7 -0
- package/dist/src/connector-client/conversationsResult.js.map +1 -0
- package/dist/src/connector-client/index.d.ts +9 -0
- package/dist/src/connector-client/index.js +26 -0
- package/dist/src/connector-client/index.js.map +1 -0
- package/dist/src/connector-client/resourceResponse.d.ts +13 -0
- package/dist/src/connector-client/resourceResponse.js +7 -0
- package/dist/src/connector-client/resourceResponse.js.map +1 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.js +45 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/invoke/adaptiveCardAuthentication.d.ts +10 -0
- package/dist/src/invoke/adaptiveCardAuthentication.js +7 -0
- package/dist/src/invoke/adaptiveCardAuthentication.js.map +1 -0
- package/dist/src/invoke/adaptiveCardInvokeResponse.d.ts +21 -0
- package/dist/src/invoke/adaptiveCardInvokeResponse.js +7 -0
- package/dist/src/invoke/adaptiveCardInvokeResponse.js.map +1 -0
- package/dist/src/invoke/adaptiveCardInvokeValue.d.ts +23 -0
- package/dist/src/invoke/adaptiveCardInvokeValue.js +7 -0
- package/dist/src/invoke/adaptiveCardInvokeValue.js.map +1 -0
- package/dist/src/invoke/index.d.ts +9 -0
- package/dist/src/invoke/index.js +26 -0
- package/dist/src/invoke/index.js.map +1 -0
- package/dist/src/invoke/invokeException.d.ts +24 -0
- package/dist/src/invoke/invokeException.js +35 -0
- package/dist/src/invoke/invokeException.js.map +1 -0
- package/dist/src/invoke/invokeResponse.d.ts +17 -0
- package/dist/src/invoke/invokeResponse.js +7 -0
- package/dist/src/invoke/invokeResponse.js.map +1 -0
- package/dist/src/invoke/searchInvokeOptions.d.ts +17 -0
- package/dist/src/invoke/searchInvokeOptions.js +7 -0
- package/dist/src/invoke/searchInvokeOptions.js.map +1 -0
- package/dist/src/invoke/searchInvokeResponse.d.ts +10 -0
- package/dist/src/invoke/searchInvokeResponse.js +7 -0
- package/dist/src/invoke/searchInvokeResponse.js.map +1 -0
- package/dist/src/invoke/searchInvokeValue.d.ts +26 -0
- package/dist/src/invoke/searchInvokeValue.js +7 -0
- package/dist/src/invoke/searchInvokeValue.js.map +1 -0
- package/dist/src/invoke/tokenExchangeInvokeRequest.d.ts +21 -0
- package/dist/src/invoke/tokenExchangeInvokeRequest.js +7 -0
- package/dist/src/invoke/tokenExchangeInvokeRequest.js.map +1 -0
- package/dist/src/logger.d.ts +12 -0
- package/dist/src/logger.js +42 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/messageFactory.d.ts +62 -0
- package/dist/src/messageFactory.js +143 -0
- package/dist/src/messageFactory.js.map +1 -0
- package/dist/src/middlewareSet.d.ts +43 -0
- package/dist/src/middlewareSet.js +57 -0
- package/dist/src/middlewareSet.js.map +1 -0
- package/dist/src/oauth/index.d.ts +7 -0
- package/dist/src/oauth/index.js +24 -0
- package/dist/src/oauth/index.js.map +1 -0
- package/dist/src/oauth/oauthCard.d.ts +28 -0
- package/dist/src/oauth/oauthCard.js +5 -0
- package/dist/src/oauth/oauthCard.js.map +1 -0
- package/dist/src/oauth/signingResource.d.ts +19 -0
- package/dist/src/oauth/signingResource.js +5 -0
- package/dist/src/oauth/signingResource.js.map +1 -0
- package/dist/src/oauth/tokenExchangeRequest.d.ts +17 -0
- package/dist/src/oauth/tokenExchangeRequest.js +5 -0
- package/dist/src/oauth/tokenExchangeRequest.js.map +1 -0
- package/dist/src/oauth/tokenExchangeResource.d.ts +17 -0
- package/dist/src/oauth/tokenExchangeResource.js +5 -0
- package/dist/src/oauth/tokenExchangeResource.js.map +1 -0
- package/dist/src/oauth/tokenPostResource.d.ts +9 -0
- package/dist/src/oauth/tokenPostResource.js +5 -0
- package/dist/src/oauth/tokenPostResource.js.map +1 -0
- package/dist/src/oauth/userTokenClient.d.ts +49 -0
- package/dist/src/oauth/userTokenClient.js +117 -0
- package/dist/src/oauth/userTokenClient.js.map +1 -0
- package/dist/src/oauth/webChatOAuthFlow.d.ts +41 -0
- package/dist/src/oauth/webChatOAuthFlow.js +117 -0
- package/dist/src/oauth/webChatOAuthFlow.js.map +1 -0
- package/dist/src/state/agentState.d.ts +71 -0
- package/dist/src/state/agentState.js +122 -0
- package/dist/src/state/agentState.js.map +1 -0
- package/dist/src/state/agentStatePropertyAccesor.d.ts +39 -0
- package/dist/src/state/agentStatePropertyAccesor.js +60 -0
- package/dist/src/state/agentStatePropertyAccesor.js.map +1 -0
- package/dist/src/state/conversationState.d.ts +18 -0
- package/dist/src/state/conversationState.js +38 -0
- package/dist/src/state/conversationState.js.map +1 -0
- package/dist/src/state/index.d.ts +4 -0
- package/dist/src/state/index.js +21 -0
- package/dist/src/state/index.js.map +1 -0
- package/dist/src/state/userState.d.ts +18 -0
- package/dist/src/state/userState.js +38 -0
- package/dist/src/state/userState.js.map +1 -0
- package/dist/src/statusCodes.d.ts +19 -0
- package/dist/src/statusCodes.js +24 -0
- package/dist/src/statusCodes.js.map +1 -0
- package/dist/src/storage/index.d.ts +2 -0
- package/dist/src/storage/index.js +19 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/memoryStorage.d.ts +50 -0
- package/dist/src/storage/memoryStorage.js +100 -0
- package/dist/src/storage/memoryStorage.js.map +1 -0
- package/dist/src/storage/storage.d.ts +47 -0
- package/dist/src/storage/storage.js +7 -0
- package/dist/src/storage/storage.js.map +1 -0
- package/dist/src/tokenResponseEventName.d.ts +5 -0
- package/dist/src/tokenResponseEventName.js +9 -0
- package/dist/src/tokenResponseEventName.js.map +1 -0
- package/dist/src/transcript/consoleTranscriptLogger.d.ts +13 -0
- package/dist/src/transcript/consoleTranscriptLogger.js +21 -0
- package/dist/src/transcript/consoleTranscriptLogger.js.map +1 -0
- package/dist/src/transcript/index.d.ts +4 -0
- package/dist/src/transcript/index.js +21 -0
- package/dist/src/transcript/index.js.map +1 -0
- package/dist/src/transcript/transcriptLogger.d.ts +42 -0
- package/dist/src/transcript/transcriptLogger.js +3 -0
- package/dist/src/transcript/transcriptLogger.js.map +1 -0
- package/dist/src/transcript/transcriptLoggerMiddleware.d.ts +38 -0
- package/dist/src/transcript/transcriptLoggerMiddleware.js +126 -0
- package/dist/src/transcript/transcriptLoggerMiddleware.js.map +1 -0
- package/dist/src/transcript/transcriptStore.d.ts +30 -0
- package/dist/src/transcript/transcriptStore.js +3 -0
- package/dist/src/transcript/transcriptStore.js.map +1 -0
- package/dist/src/turnContext.d.ts +160 -0
- package/dist/src/turnContext.js +286 -0
- package/dist/src/turnContext.js.map +1 -0
- package/dist/src/turnContextStateCollection.d.ts +29 -0
- package/dist/src/turnContextStateCollection.js +56 -0
- package/dist/src/turnContextStateCollection.js.map +1 -0
- package/package.json +48 -0
- package/src/activityHandler.ts +461 -0
- package/src/agent-client/agentClient.ts +84 -0
- package/src/agent-client/expressApi.ts +59 -0
- package/src/agent-client/index.ts +2 -0
- package/src/app/agentApplication.ts +401 -0
- package/src/app/appRoute.ts +13 -0
- package/src/app/applicationBuilder.ts +42 -0
- package/src/app/applicationOptions.ts +21 -0
- package/src/app/attachmentDownloader.ts +83 -0
- package/src/app/conversationUpdateEvents.ts +8 -0
- package/src/app/index.ts +10 -0
- package/src/app/inputFileDownloader.ts +17 -0
- package/src/app/memory.ts +14 -0
- package/src/app/oauth/authenticationOptions.ts +8 -0
- package/src/app/oauth/webChatOAuthFlowAppStyle.ts +90 -0
- package/src/app/routeHandler.ts +9 -0
- package/src/app/routeSelector.ts +10 -0
- package/src/app/turnEvents.ts +6 -0
- package/src/app/turnState.ts +338 -0
- package/src/app/turnStateEntry.ts +46 -0
- package/src/auth/authConfiguration.ts +68 -0
- package/src/auth/authProvider.ts +19 -0
- package/src/auth/index.ts +4 -0
- package/src/auth/jwt-middleware.ts +99 -0
- package/src/auth/msalTokenProvider.ts +202 -0
- package/src/auth/request.ts +20 -0
- package/src/baseAdapter.ts +174 -0
- package/src/cards/animationCard.ts +38 -0
- package/src/cards/audioCard.ts +38 -0
- package/src/cards/cardFactory.ts +276 -0
- package/src/cards/cardImage.ts +18 -0
- package/src/cards/fact.ts +14 -0
- package/src/cards/heroCard.ts +25 -0
- package/src/cards/index.ts +17 -0
- package/src/cards/mediaUrl.ts +18 -0
- package/src/cards/o365ConnectorCard.ts +37 -0
- package/src/cards/o365ConnectorCardActionBase.ts +24 -0
- package/src/cards/o365ConnectorCardFact.ts +18 -0
- package/src/cards/o365ConnectorCardImage.ts +18 -0
- package/src/cards/o365ConnectorCardSection.ts +60 -0
- package/src/cards/receiptCard.ts +46 -0
- package/src/cards/receiptItem.ts +41 -0
- package/src/cards/signinCard.ts +18 -0
- package/src/cards/taskModuleAction.ts +61 -0
- package/src/cards/thumbnailCard.ts +37 -0
- package/src/cards/thumbnailUrl.ts +18 -0
- package/src/cards/videoCard.ts +62 -0
- package/src/claimsIdentity.ts +47 -0
- package/src/cloudAdapter.ts +431 -0
- package/src/connector-client/attachmentData.ts +26 -0
- package/src/connector-client/attachmentInfo.ts +24 -0
- package/src/connector-client/attachmentView.ts +18 -0
- package/src/connector-client/connectorClient.ts +295 -0
- package/src/connector-client/conversationMembers.ts +20 -0
- package/src/connector-client/conversationParameters.ts +40 -0
- package/src/connector-client/conversationResourceResponse.ts +22 -0
- package/src/connector-client/conversationsResult.ts +20 -0
- package/src/connector-client/index.ts +9 -0
- package/src/connector-client/resourceResponse.ts +14 -0
- package/src/index.ts +31 -0
- package/src/invoke/adaptiveCardAuthentication.ts +13 -0
- package/src/invoke/adaptiveCardInvokeResponse.ts +22 -0
- package/src/invoke/adaptiveCardInvokeValue.ts +25 -0
- package/src/invoke/index.ts +9 -0
- package/src/invoke/invokeException.ts +33 -0
- package/src/invoke/invokeResponse.ts +18 -0
- package/src/invoke/searchInvokeOptions.ts +18 -0
- package/src/invoke/searchInvokeResponse.ts +11 -0
- package/src/invoke/searchInvokeValue.ts +28 -0
- package/src/invoke/tokenExchangeInvokeRequest.ts +22 -0
- package/src/logger.ts +43 -0
- package/src/messageFactory.ts +177 -0
- package/src/middlewareSet.ts +76 -0
- package/src/oauth/index.ts +7 -0
- package/src/oauth/oauthCard.ts +32 -0
- package/src/oauth/signingResource.ts +23 -0
- package/src/oauth/tokenExchangeRequest.ts +20 -0
- package/src/oauth/tokenExchangeResource.ts +20 -0
- package/src/oauth/tokenPostResource.ts +12 -0
- package/src/oauth/userTokenClient.ts +116 -0
- package/src/oauth/webChatOAuthFlow.ts +123 -0
- package/src/state/agentState.ts +142 -0
- package/src/state/agentStatePropertyAccesor.ts +61 -0
- package/src/state/conversationState.ts +42 -0
- package/src/state/index.ts +4 -0
- package/src/state/userState.ts +43 -0
- package/src/statusCodes.ts +20 -0
- package/src/storage/index.ts +2 -0
- package/src/storage/memoryStorage.ts +105 -0
- package/src/storage/storage.ts +52 -0
- package/src/tokenResponseEventName.ts +6 -0
- package/src/transcript/consoleTranscriptLogger.ts +20 -0
- package/src/transcript/index.ts +4 -0
- package/src/transcript/transcriptLogger.ts +45 -0
- package/src/transcript/transcriptLoggerMiddleware.ts +151 -0
- package/src/transcript/transcriptStore.ts +38 -0
- package/src/turnContext.ts +335 -0
- package/src/turnContextStateCollection.ts +69 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AttachmentView } from './attachmentView'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents information about an attachment.
|
|
10
|
+
*/
|
|
11
|
+
export interface AttachmentInfo {
|
|
12
|
+
/**
|
|
13
|
+
* The name of the attachment.
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* The type of the attachment.
|
|
18
|
+
*/
|
|
19
|
+
type: string;
|
|
20
|
+
/**
|
|
21
|
+
* The views of the attachment.
|
|
22
|
+
*/
|
|
23
|
+
views: AttachmentView[];
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a view of an attachment.
|
|
8
|
+
*/
|
|
9
|
+
export interface AttachmentView {
|
|
10
|
+
/**
|
|
11
|
+
* The ID of the view.
|
|
12
|
+
*/
|
|
13
|
+
viewId: string;
|
|
14
|
+
/**
|
|
15
|
+
* The size of the view.
|
|
16
|
+
*/
|
|
17
|
+
size: number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */
|
|
2
|
+
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
|
|
3
|
+
import { AuthConfiguration } from '../auth/authConfiguration'
|
|
4
|
+
import { AuthProvider } from '../auth/authProvider'
|
|
5
|
+
import { debug } from '../logger'
|
|
6
|
+
import { Activity } from '@microsoft/agents-activity'
|
|
7
|
+
import { ConversationsResult } from './conversationsResult'
|
|
8
|
+
import { ConversationParameters } from './conversationParameters'
|
|
9
|
+
import { ConversationResourceResponse } from './conversationResourceResponse'
|
|
10
|
+
import { ResourceResponse } from './resourceResponse'
|
|
11
|
+
import { AttachmentInfo } from './attachmentInfo'
|
|
12
|
+
import { AttachmentData } from './attachmentData'
|
|
13
|
+
|
|
14
|
+
const logger = debug('agents:connector-client')
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* ConnectorClient is a client for interacting with the Microsoft Connector API.
|
|
18
|
+
*/
|
|
19
|
+
export class ConnectorClient {
|
|
20
|
+
protected readonly client: AxiosInstance
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Private constructor for the ConnectorClient.
|
|
24
|
+
* @param client - The AxiosInstance to use for HTTP requests.
|
|
25
|
+
*/
|
|
26
|
+
protected constructor (client: AxiosInstance) {
|
|
27
|
+
this.client = client
|
|
28
|
+
this.client.interceptors.response.use(
|
|
29
|
+
(config) => {
|
|
30
|
+
const { status, statusText, config: requestConfig } = config
|
|
31
|
+
logger.debug('Response: ', {
|
|
32
|
+
status,
|
|
33
|
+
statusText,
|
|
34
|
+
host: this.client.getUri(),
|
|
35
|
+
url: requestConfig?.url,
|
|
36
|
+
data: config.config.data,
|
|
37
|
+
method: requestConfig?.method,
|
|
38
|
+
})
|
|
39
|
+
return config
|
|
40
|
+
},
|
|
41
|
+
(error) => {
|
|
42
|
+
const { code, message, stack } = error
|
|
43
|
+
const errorDetails = {
|
|
44
|
+
code,
|
|
45
|
+
host: this.client.getUri(),
|
|
46
|
+
url: error.config.url,
|
|
47
|
+
method: error.config.method,
|
|
48
|
+
data: error.config.data,
|
|
49
|
+
message,
|
|
50
|
+
stack,
|
|
51
|
+
}
|
|
52
|
+
return Promise.reject(errorDetails)
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new instance of ConnectorClient with authentication.
|
|
59
|
+
* @param baseURL - The base URL for the API.
|
|
60
|
+
* @param authConfig - The authentication configuration.
|
|
61
|
+
* @param authProvider - The authentication provider.
|
|
62
|
+
* @param scope - The scope for the authentication token.
|
|
63
|
+
* @returns A new instance of ConnectorClient.
|
|
64
|
+
*/
|
|
65
|
+
static async createClientWithAuthAsync (
|
|
66
|
+
baseURL: string,
|
|
67
|
+
authConfig: AuthConfiguration,
|
|
68
|
+
authProvider: AuthProvider,
|
|
69
|
+
scope: string
|
|
70
|
+
): Promise<ConnectorClient> {
|
|
71
|
+
const axiosInstance = axios.create({
|
|
72
|
+
baseURL,
|
|
73
|
+
headers: {
|
|
74
|
+
Accept: 'application/json'
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const token = await authProvider.getAccessToken(authConfig, scope)
|
|
79
|
+
if (token.length > 1) {
|
|
80
|
+
axiosInstance.defaults.headers.common.Authorization = `Bearer ${token}`
|
|
81
|
+
}
|
|
82
|
+
return new ConnectorClient(axiosInstance)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Retrieves a list of conversations.
|
|
87
|
+
* @param continuationToken - The continuation token for pagination.
|
|
88
|
+
* @returns A list of conversations.
|
|
89
|
+
*/
|
|
90
|
+
public async getConversationsAsync (continuationToken?: string): Promise<ConversationsResult> {
|
|
91
|
+
const config: AxiosRequestConfig = {
|
|
92
|
+
method: 'get',
|
|
93
|
+
url: '/v3/conversations',
|
|
94
|
+
params: continuationToken ? { continuationToken } : undefined
|
|
95
|
+
}
|
|
96
|
+
const response = await this.client(config)
|
|
97
|
+
return response.data
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Creates a new conversation.
|
|
102
|
+
* @param body - The conversation parameters.
|
|
103
|
+
* @returns The conversation resource response.
|
|
104
|
+
*/
|
|
105
|
+
public async createConversationAsync (body: ConversationParameters): Promise<ConversationResourceResponse> {
|
|
106
|
+
const config: AxiosRequestConfig = {
|
|
107
|
+
method: 'post',
|
|
108
|
+
url: '/v3/conversations',
|
|
109
|
+
headers: {
|
|
110
|
+
'Content-Type': 'application/json'
|
|
111
|
+
},
|
|
112
|
+
data: body
|
|
113
|
+
}
|
|
114
|
+
const response: AxiosResponse = await this.client(config)
|
|
115
|
+
return response.data
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Replies to an activity in a conversation.
|
|
120
|
+
* @param conversationId - The ID of the conversation.
|
|
121
|
+
* @param activityId - The ID of the activity.
|
|
122
|
+
* @param body - The activity object.
|
|
123
|
+
* @returns The resource response.
|
|
124
|
+
*/
|
|
125
|
+
public async replyToActivityAsync (
|
|
126
|
+
conversationId: string,
|
|
127
|
+
activityId: string,
|
|
128
|
+
body: Activity
|
|
129
|
+
): Promise<ResourceResponse> {
|
|
130
|
+
if (!conversationId || !activityId) {
|
|
131
|
+
throw new Error('conversationId and activityId are required')
|
|
132
|
+
}
|
|
133
|
+
const config: AxiosRequestConfig = {
|
|
134
|
+
method: 'post',
|
|
135
|
+
url: `v3/conversations/${conversationId}/activities/${encodeURIComponent(activityId)}`,
|
|
136
|
+
headers: {
|
|
137
|
+
'Content-Type': 'application/json'
|
|
138
|
+
},
|
|
139
|
+
data: body
|
|
140
|
+
}
|
|
141
|
+
const response = await this.client(config)
|
|
142
|
+
logger.info('Reply to conversation/activity: ', response.data.id!, activityId)
|
|
143
|
+
return response.data
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Sends an activity to a conversation.
|
|
148
|
+
* @param conversationId - The ID of the conversation.
|
|
149
|
+
* @param body - The activity object.
|
|
150
|
+
* @returns The resource response.
|
|
151
|
+
*/
|
|
152
|
+
public async sendToConversationAsync (
|
|
153
|
+
conversationId: string,
|
|
154
|
+
body: Activity
|
|
155
|
+
): Promise<ResourceResponse> {
|
|
156
|
+
if (!conversationId) {
|
|
157
|
+
throw new Error('conversationId is required')
|
|
158
|
+
}
|
|
159
|
+
const config: AxiosRequestConfig = {
|
|
160
|
+
method: 'post',
|
|
161
|
+
url: `v3/conversations/${conversationId}/activities`,
|
|
162
|
+
headers: {
|
|
163
|
+
'Content-Type': 'application/json'
|
|
164
|
+
},
|
|
165
|
+
data: body
|
|
166
|
+
}
|
|
167
|
+
const response = await this.client(config)
|
|
168
|
+
return response.data
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Updates an activity in a conversation.
|
|
173
|
+
* @param conversationId - The ID of the conversation.
|
|
174
|
+
* @param activityId - The ID of the activity.
|
|
175
|
+
* @param body - The activity object.
|
|
176
|
+
* @returns The resource response.
|
|
177
|
+
*/
|
|
178
|
+
public async updateActivityAsync (
|
|
179
|
+
conversationId: string,
|
|
180
|
+
activityId: string,
|
|
181
|
+
body: Activity
|
|
182
|
+
): Promise<ResourceResponse> {
|
|
183
|
+
if (!conversationId || !activityId) {
|
|
184
|
+
throw new Error('conversationId and activityId are required')
|
|
185
|
+
}
|
|
186
|
+
const config: AxiosRequestConfig = {
|
|
187
|
+
method: 'put',
|
|
188
|
+
url: `v3/conversations/${conversationId}/activities/${activityId}`,
|
|
189
|
+
headers: {
|
|
190
|
+
'Content-Type': 'application/json'
|
|
191
|
+
},
|
|
192
|
+
data: body
|
|
193
|
+
}
|
|
194
|
+
const response = await this.client(config)
|
|
195
|
+
return response.data
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Deletes an activity from a conversation.
|
|
200
|
+
* @param conversationId - The ID of the conversation.
|
|
201
|
+
* @param activityId - The ID of the activity.
|
|
202
|
+
* @returns A promise that resolves when the activity is deleted.
|
|
203
|
+
*/
|
|
204
|
+
public async deleteActivityAsync (
|
|
205
|
+
conversationId: string,
|
|
206
|
+
activityId: string
|
|
207
|
+
): Promise<void> {
|
|
208
|
+
if (!conversationId || !activityId) {
|
|
209
|
+
throw new Error('conversationId and activityId are required')
|
|
210
|
+
}
|
|
211
|
+
const config: AxiosRequestConfig = {
|
|
212
|
+
method: 'delete',
|
|
213
|
+
url: `v3/conversations/${conversationId}/activities/${activityId}`,
|
|
214
|
+
headers: {
|
|
215
|
+
'Content-Type': 'application/json'
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const response = await this.client(config)
|
|
219
|
+
return response.data
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Uploads an attachment to a conversation.
|
|
224
|
+
* @param conversationId - The ID of the conversation.
|
|
225
|
+
* @param body - The attachment data.
|
|
226
|
+
* @returns The resource response.
|
|
227
|
+
*/
|
|
228
|
+
public async uploadAttachment (
|
|
229
|
+
conversationId: string,
|
|
230
|
+
body: AttachmentData
|
|
231
|
+
): Promise<ResourceResponse> {
|
|
232
|
+
if (conversationId === undefined) {
|
|
233
|
+
throw new Error('conversationId is required')
|
|
234
|
+
}
|
|
235
|
+
const config: AxiosRequestConfig = {
|
|
236
|
+
method: 'post',
|
|
237
|
+
url: `v3/conversations/${conversationId}/attachments`,
|
|
238
|
+
headers: {
|
|
239
|
+
'Content-Type': 'application/json'
|
|
240
|
+
},
|
|
241
|
+
data: body
|
|
242
|
+
}
|
|
243
|
+
const response = await this.client(config)
|
|
244
|
+
return response.data
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Retrieves attachment information by attachment ID.
|
|
249
|
+
* @param attachmentId - The ID of the attachment.
|
|
250
|
+
* @returns The attachment information.
|
|
251
|
+
*/
|
|
252
|
+
public async getAttachmentInfo (
|
|
253
|
+
attachmentId: string
|
|
254
|
+
): Promise<AttachmentInfo> {
|
|
255
|
+
if (attachmentId === undefined) {
|
|
256
|
+
throw new Error('attachmentId is required')
|
|
257
|
+
}
|
|
258
|
+
const config: AxiosRequestConfig = {
|
|
259
|
+
method: 'get',
|
|
260
|
+
url: `v3/attachments/${attachmentId}`,
|
|
261
|
+
headers: {
|
|
262
|
+
'Content-Type': 'application/json'
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const response = await this.client(config)
|
|
266
|
+
return response.data
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Retrieves an attachment by attachment ID and view ID.
|
|
271
|
+
* @param attachmentId - The ID of the attachment.
|
|
272
|
+
* @param viewId - The ID of the view.
|
|
273
|
+
* @returns The attachment as a readable stream.
|
|
274
|
+
*/
|
|
275
|
+
public async getAttachment (
|
|
276
|
+
attachmentId: string,
|
|
277
|
+
viewId: string
|
|
278
|
+
): Promise<NodeJS.ReadableStream> {
|
|
279
|
+
if (attachmentId === undefined) {
|
|
280
|
+
throw new Error('attachmentId is required')
|
|
281
|
+
}
|
|
282
|
+
if (viewId === undefined) {
|
|
283
|
+
throw new Error('viewId is required')
|
|
284
|
+
}
|
|
285
|
+
const config: AxiosRequestConfig = {
|
|
286
|
+
method: 'get',
|
|
287
|
+
url: `v3/attachments/${attachmentId}/views/${viewId}`,
|
|
288
|
+
headers: {
|
|
289
|
+
'Content-Type': 'application/json'
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const response = await this.client(config)
|
|
293
|
+
return response.data
|
|
294
|
+
}
|
|
295
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright(c) Microsoft Corporation.All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ChannelAccount } from '@microsoft/agents-activity'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the members of a conversation.
|
|
10
|
+
*/
|
|
11
|
+
export interface ConversationMembers {
|
|
12
|
+
/**
|
|
13
|
+
* The ID of the conversation.
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* The list of members in the conversation.
|
|
18
|
+
*/
|
|
19
|
+
members: ChannelAccount[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright(c) Microsoft Corporation.All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Activity, ChannelAccount } from '@microsoft/agents-activity'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the parameters for creating a conversation.
|
|
10
|
+
*/
|
|
11
|
+
export interface ConversationParameters {
|
|
12
|
+
/**
|
|
13
|
+
* Indicates whether the conversation is a group conversation.
|
|
14
|
+
*/
|
|
15
|
+
isGroup: boolean
|
|
16
|
+
/**
|
|
17
|
+
* The bot account initiating the conversation.
|
|
18
|
+
*/
|
|
19
|
+
bot: ChannelAccount
|
|
20
|
+
/**
|
|
21
|
+
* The members to include in the conversation.
|
|
22
|
+
*/
|
|
23
|
+
members?: ChannelAccount[]
|
|
24
|
+
/**
|
|
25
|
+
* The topic name of the conversation.
|
|
26
|
+
*/
|
|
27
|
+
topicName?: string
|
|
28
|
+
/**
|
|
29
|
+
* The tenant ID of the conversation.
|
|
30
|
+
*/
|
|
31
|
+
tenantId?: string
|
|
32
|
+
/**
|
|
33
|
+
* The initial activity to send to the conversation.
|
|
34
|
+
*/
|
|
35
|
+
activity: Activity
|
|
36
|
+
/**
|
|
37
|
+
* Channel-specific data for the conversation.
|
|
38
|
+
*/
|
|
39
|
+
channelData: unknown
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright(c) Microsoft Corporation.All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the response from a conversation resource operation.
|
|
8
|
+
*/
|
|
9
|
+
export interface ConversationResourceResponse {
|
|
10
|
+
/**
|
|
11
|
+
* The ID of the activity.
|
|
12
|
+
*/
|
|
13
|
+
activityId: string;
|
|
14
|
+
/**
|
|
15
|
+
* The service URL.
|
|
16
|
+
*/
|
|
17
|
+
serviceUrl: string;
|
|
18
|
+
/**
|
|
19
|
+
* The ID of the conversation resource.
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright(c) Microsoft Corporation.All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ConversationMembers } from './conversationMembers'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the result of a conversation query.
|
|
10
|
+
*/
|
|
11
|
+
export interface ConversationsResult {
|
|
12
|
+
/**
|
|
13
|
+
* A token to retrieve the next page of results.
|
|
14
|
+
*/
|
|
15
|
+
continuationToken: string;
|
|
16
|
+
/**
|
|
17
|
+
* A list of conversation members.
|
|
18
|
+
*/
|
|
19
|
+
conversations: ConversationMembers[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './attachmentData'
|
|
2
|
+
export * from './attachmentInfo'
|
|
3
|
+
export * from './attachmentView'
|
|
4
|
+
export * from './connectorClient'
|
|
5
|
+
export * from './conversationMembers'
|
|
6
|
+
export * from './conversationParameters'
|
|
7
|
+
export * from './conversationResourceResponse'
|
|
8
|
+
export * from './conversationsResult'
|
|
9
|
+
export * from './resourceResponse'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright(c) Microsoft Corporation.All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a response containing a resource ID.
|
|
8
|
+
*/
|
|
9
|
+
export interface ResourceResponse {
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier of the resource.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export * from './auth/'
|
|
7
|
+
export { authorizeJWT } from './auth/jwt-middleware'
|
|
8
|
+
|
|
9
|
+
export * from './app'
|
|
10
|
+
export * from './cards'
|
|
11
|
+
export * from './connector-client'
|
|
12
|
+
export * from './invoke'
|
|
13
|
+
export * from './oauth'
|
|
14
|
+
export * from './state'
|
|
15
|
+
export * from './storage'
|
|
16
|
+
export * from './transcript'
|
|
17
|
+
|
|
18
|
+
export * from './activityHandler'
|
|
19
|
+
export * from './cloudAdapter'
|
|
20
|
+
export * from './claimsIdentity'
|
|
21
|
+
export * from './logger'
|
|
22
|
+
export * from './messageFactory'
|
|
23
|
+
export * from './statusCodes'
|
|
24
|
+
export * from './turnContext'
|
|
25
|
+
export * from './turnContextStateCollection'
|
|
26
|
+
export * from './logger'
|
|
27
|
+
export * from './storage/storage'
|
|
28
|
+
|
|
29
|
+
export * from './agent-client'
|
|
30
|
+
|
|
31
|
+
export * from '@microsoft/agents-activity'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { TokenExchangeInvokeRequest } from './tokenExchangeInvokeRequest'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the authentication information for an adaptive card.
|
|
10
|
+
*/
|
|
11
|
+
export interface AdaptiveCardAuthentication extends TokenExchangeInvokeRequest {
|
|
12
|
+
// No-op. This interface was accidentally created as a duplicate of TokenExchangeInvokeRequest but must remain for backwards-compatibility.
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the response of an adaptive card invoke request.
|
|
8
|
+
*/
|
|
9
|
+
export interface AdaptiveCardInvokeResponse {
|
|
10
|
+
/**
|
|
11
|
+
* The status code of the response.
|
|
12
|
+
*/
|
|
13
|
+
statusCode: number
|
|
14
|
+
/**
|
|
15
|
+
* The type of the response.
|
|
16
|
+
*/
|
|
17
|
+
type: string
|
|
18
|
+
/**
|
|
19
|
+
* The value of the response.
|
|
20
|
+
*/
|
|
21
|
+
value: Record<string, unknown>
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AdaptiveCardInvokeAction } from '@microsoft/agents-activity'
|
|
7
|
+
import { AdaptiveCardAuthentication } from './adaptiveCardAuthentication'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents the value of an adaptive card invoke request.
|
|
11
|
+
*/
|
|
12
|
+
export interface AdaptiveCardInvokeValue {
|
|
13
|
+
/**
|
|
14
|
+
* The action to be performed.
|
|
15
|
+
*/
|
|
16
|
+
action: AdaptiveCardInvokeAction
|
|
17
|
+
/**
|
|
18
|
+
* The authentication information.
|
|
19
|
+
*/
|
|
20
|
+
authentication: AdaptiveCardAuthentication
|
|
21
|
+
/**
|
|
22
|
+
* The state of the adaptive card.
|
|
23
|
+
*/
|
|
24
|
+
state: string
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './adaptiveCardAuthentication'
|
|
2
|
+
export * from './adaptiveCardInvokeResponse'
|
|
3
|
+
export * from './adaptiveCardInvokeValue'
|
|
4
|
+
export * from './invokeException'
|
|
5
|
+
export * from './invokeResponse'
|
|
6
|
+
export * from './searchInvokeOptions'
|
|
7
|
+
export * from './searchInvokeResponse'
|
|
8
|
+
export * from './searchInvokeValue'
|
|
9
|
+
export * from './tokenExchangeInvokeRequest'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { StatusCodes } from '../statusCodes'
|
|
7
|
+
import { InvokeResponse } from './invokeResponse'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents an exception that occurs during an invoke operation.
|
|
11
|
+
*/
|
|
12
|
+
export class InvokeException<T = unknown> extends Error {
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new instance of InvokeException.
|
|
15
|
+
* @param status The status code of the exception.
|
|
16
|
+
* @param response The optional response body.
|
|
17
|
+
*/
|
|
18
|
+
constructor (private readonly status: StatusCodes, private readonly response?: T) {
|
|
19
|
+
super()
|
|
20
|
+
this.name = 'InvokeException'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Creates an invoke response from the exception.
|
|
25
|
+
* @returns The invoke response.
|
|
26
|
+
*/
|
|
27
|
+
createInvokeResponse (): InvokeResponse {
|
|
28
|
+
return {
|
|
29
|
+
status: this.status,
|
|
30
|
+
body: this.response
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the response of an invoke request.
|
|
8
|
+
*/
|
|
9
|
+
export interface InvokeResponse<T = any> {
|
|
10
|
+
/**
|
|
11
|
+
* The status code of the response.
|
|
12
|
+
*/
|
|
13
|
+
status: number
|
|
14
|
+
/**
|
|
15
|
+
* The optional body of the response.
|
|
16
|
+
*/
|
|
17
|
+
body?: T
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the options for a search invoke request.
|
|
8
|
+
*/
|
|
9
|
+
export interface SearchInvokeOptions {
|
|
10
|
+
/**
|
|
11
|
+
* The number of items to skip.
|
|
12
|
+
*/
|
|
13
|
+
skip: number
|
|
14
|
+
/**
|
|
15
|
+
* The number of items to retrieve.
|
|
16
|
+
*/
|
|
17
|
+
top: number
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { AdaptiveCardInvokeResponse } from './adaptiveCardInvokeResponse'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the response of a search invoke request.
|
|
10
|
+
*/
|
|
11
|
+
export interface SearchInvokeResponse extends AdaptiveCardInvokeResponse {}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { SearchInvokeOptions } from './searchInvokeOptions'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the value of a search invoke request.
|
|
10
|
+
*/
|
|
11
|
+
export interface SearchInvokeValue {
|
|
12
|
+
/**
|
|
13
|
+
* The kind of search.
|
|
14
|
+
*/
|
|
15
|
+
kind: string
|
|
16
|
+
/**
|
|
17
|
+
* The text of the query.
|
|
18
|
+
*/
|
|
19
|
+
queryText: string
|
|
20
|
+
/**
|
|
21
|
+
* The options for the search query.
|
|
22
|
+
*/
|
|
23
|
+
queryOptions: SearchInvokeOptions
|
|
24
|
+
/**
|
|
25
|
+
* The context of the search.
|
|
26
|
+
*/
|
|
27
|
+
context: any
|
|
28
|
+
}
|