@microsoft/agents-hosting-express 1.0.7-g73d3d58001 → 1.0.13-gef996e80de
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@microsoft/agents-hosting-express",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.13-gef996e80de",
|
|
5
5
|
"homepage": "https://github.com/microsoft/Agents-for-js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"main": "dist/src/index.js",
|
|
20
20
|
"types": "dist/src/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@microsoft/agents-hosting": "1.0.
|
|
22
|
+
"@microsoft/agents-hosting": "1.0.13-gef996e80de",
|
|
23
23
|
"express": "^5.1.0"
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import express from 'express';
|
|
5
6
|
import { ActivityHandler, AgentApplication, AuthConfiguration, TurnState } from '@microsoft/agents-hosting';
|
|
6
7
|
/**
|
|
7
8
|
* Starts an Express server for handling Agent requests.
|
|
@@ -31,4 +32,4 @@ import { ActivityHandler, AgentApplication, AuthConfiguration, TurnState } from
|
|
|
31
32
|
* ```
|
|
32
33
|
*
|
|
33
34
|
*/
|
|
34
|
-
export declare const startServer: (agent: AgentApplication<TurnState<any, any>> | ActivityHandler, authConfiguration?: AuthConfiguration) =>
|
|
35
|
+
export declare const startServer: (agent: AgentApplication<TurnState<any, any>> | ActivityHandler, authConfiguration?: AuthConfiguration) => express.Express;
|
package/dist/src/startServer.js
CHANGED
|
@@ -42,13 +42,14 @@ const package_json_1 = require("@microsoft/agents-hosting/package.json");
|
|
|
42
42
|
const startServer = (agent, authConfiguration) => {
|
|
43
43
|
const authConfig = authConfiguration !== null && authConfiguration !== void 0 ? authConfiguration : (0, agents_hosting_1.loadAuthConfigFromEnv)();
|
|
44
44
|
let adapter;
|
|
45
|
+
let headerPropagation;
|
|
45
46
|
if (agent instanceof agents_hosting_1.ActivityHandler || !agent.adapter) {
|
|
46
47
|
adapter = new agents_hosting_1.CloudAdapter();
|
|
47
48
|
}
|
|
48
49
|
else {
|
|
49
50
|
adapter = agent.adapter;
|
|
51
|
+
headerPropagation = agent === null || agent === void 0 ? void 0 : agent.options.headerPropagation;
|
|
50
52
|
}
|
|
51
|
-
const headerPropagation = agent === null || agent === void 0 ? void 0 : agent.options.headerPropagation;
|
|
52
53
|
const server = (0, express_1.default)();
|
|
53
54
|
server.use(express_1.default.json());
|
|
54
55
|
server.use((0, agents_hosting_1.authorizeJWT)(authConfig));
|
|
@@ -57,6 +58,7 @@ const startServer = (agent, authConfiguration) => {
|
|
|
57
58
|
server.listen(port, async () => {
|
|
58
59
|
console.log(`\nServer listening to port ${port} on sdk ${package_json_1.version} for appId ${authConfig.clientId} debug ${process.env.DEBUG}`);
|
|
59
60
|
}).on('error', console.error);
|
|
61
|
+
return server;
|
|
60
62
|
};
|
|
61
63
|
exports.startServer = startServer;
|
|
62
64
|
//# sourceMappingURL=startServer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startServer.js","sourceRoot":"","sources":["../../src/startServer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,sDAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"startServer.js","sourceRoot":"","sources":["../../src/startServer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,sDAA2C;AAC3C,8DAAoM;AACpM,yEAAgE;AAChE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACI,MAAM,WAAW,GAAG,C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K,CAAC,CAAA;IAC7B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AA1BY,QAAA,WAAW,eA0BvB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@microsoft/agents-hosting-express",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.13-gef996e80de",
|
|
5
5
|
"homepage": "https://github.com/microsoft/Agents-for-js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"main": "dist/src/index.js",
|
|
20
20
|
"types": "dist/src/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@microsoft/agents-hosting": "1.0.
|
|
22
|
+
"@microsoft/agents-hosting": "1.0.13-gef996e80de",
|
|
23
23
|
"express": "^5.1.0"
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
package/src/startServer.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import express, { Response } from 'express'
|
|
7
|
-
import { ActivityHandler, AgentApplication, AuthConfiguration, authorizeJWT, CloudAdapter, loadAuthConfigFromEnv, Request, TurnState } from '@microsoft/agents-hosting'
|
|
7
|
+
import { ActivityHandler, AgentApplication, AuthConfiguration, authorizeJWT, CloudAdapter, HeaderPropagationDefinition, loadAuthConfigFromEnv, Request, TurnState } from '@microsoft/agents-hosting'
|
|
8
8
|
import { version } from '@microsoft/agents-hosting/package.json'
|
|
9
9
|
/**
|
|
10
10
|
* Starts an Express server for handling Agent requests.
|
|
@@ -34,17 +34,17 @@ import { version } from '@microsoft/agents-hosting/package.json'
|
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
36
|
*/
|
|
37
|
-
export const startServer = (agent: AgentApplication<TurnState<any, any>> | ActivityHandler, authConfiguration?: AuthConfiguration) => {
|
|
37
|
+
export const startServer = (agent: AgentApplication<TurnState<any, any>> | ActivityHandler, authConfiguration?: AuthConfiguration) : express.Express => {
|
|
38
38
|
const authConfig: AuthConfiguration = authConfiguration ?? loadAuthConfigFromEnv()
|
|
39
39
|
let adapter: CloudAdapter
|
|
40
|
+
let headerPropagation: HeaderPropagationDefinition | undefined
|
|
40
41
|
if (agent instanceof ActivityHandler || !agent.adapter) {
|
|
41
42
|
adapter = new CloudAdapter()
|
|
42
43
|
} else {
|
|
43
44
|
adapter = agent.adapter as CloudAdapter
|
|
45
|
+
headerPropagation = (agent as AgentApplication<TurnState<any, any>>)?.options.headerPropagation
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
const headerPropagation = (agent as AgentApplication<TurnState<any, any>>)?.options.headerPropagation
|
|
47
|
-
|
|
48
48
|
const server = express()
|
|
49
49
|
server.use(express.json())
|
|
50
50
|
server.use(authorizeJWT(authConfig))
|
|
@@ -59,4 +59,5 @@ export const startServer = (agent: AgentApplication<TurnState<any, any>> | Activ
|
|
|
59
59
|
server.listen(port, async () => {
|
|
60
60
|
console.log(`\nServer listening to port ${port} on sdk ${version} for appId ${authConfig.clientId} debug ${process.env.DEBUG}`)
|
|
61
61
|
}).on('error', console.error)
|
|
62
|
+
return server
|
|
62
63
|
}
|