@microsoft/agents-hosting-express 0.4.3 → 0.5.4-ga4d0401645

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.
@@ -71,7 +71,13 @@ const agents_hosting_1 = require("@microsoft/agents-hosting");
71
71
  */
72
72
  const startServer = (agent, authConfiguration) => {
73
73
  const authConfig = authConfiguration !== null && authConfiguration !== void 0 ? authConfiguration : (0, agents_hosting_1.loadAuthConfigFromEnv)();
74
- const adapter = new agents_hosting_1.CloudAdapter(authConfig);
74
+ let adapter;
75
+ if (agent instanceof agents_hosting_1.ActivityHandler || !agent.adapter) {
76
+ adapter = new agents_hosting_1.CloudAdapter(authConfig);
77
+ }
78
+ else {
79
+ adapter = agent.adapter;
80
+ }
75
81
  const server = (0, express_1.default)();
76
82
  server.use(express_1.default.json());
77
83
  server.use((0, agents_hosting_1.authorizeJWT)(authConfig));
@@ -1 +1 @@
1
- {"version":3,"file":"startServer.js","sourceRoot":"","sources":["../../src/startServer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAA2C;AAC3C,8DAAuK;AAEvK;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACI,MAAM,WAAW,GAAG,CAAC,KAA8D,EAAE,iBAAqC,EAAE,EAAE;IACnI,MAAM,UAAU,GAAsB,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,IAAA,sCAAqB,GAAE,CAAA;IAClF,MAAM,OAAO,GAAG,IAAI,6BAAY,CAAC,UAAU,CAAC,CAAA;IAC5C,MAAM,MAAM,GAAG,IAAA,iBAAO,GAAE,CAAA;IACxB,MAAM,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1B,MAAM,CAAC,GAAG,CAAC,IAAA,6BAAY,EAAC,UAAU,CAAC,CAAC,CAAA;IAEpC,MAAM,CAAC,IAAI,CAAC,eAAe,E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IACzC,CAAC;IACD,MAAM,MAAM,GAAG,IAAA,iBAAO,GAAE,CAAA;IACxB,MAAM,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1B,MAAM,CAAC,GAAG,CAAC,IAAA,6BAAY,EAAC,UAAU,CAAC,CAAC,CAAA;IAEpC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE,CAC3D,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,EAAE,CACpC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CACnB,CACF,CAAA;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAA;IACrC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;QAC7B,MAAM,OAAO,GAAG,CAAC,wDAAa,wCAAwC,GAAC,CAAC,CAAC,OAAO,CAAA;QAChF,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,WAAW,OAAO,cAAc,UAAU,CAAC,QAAQ,UAAU,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;IACjI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;AAC/B,CAAC,CAAA;AAvBY,QAAA,WAAW,eAuBvB"}
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": "0.4.3",
4
+ "version": "0.5.4-ga4d0401645",
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": "0.4.3",
22
+ "@microsoft/agents-hosting": "0.5.4-ga4d0401645",
23
23
  "express": "^5.1.0"
24
24
  },
25
25
  "license": "MIT",
@@ -34,7 +34,12 @@ import { ActivityHandler, AgentApplication, AuthConfiguration, authorizeJWT, Clo
34
34
  */
35
35
  export const startServer = (agent: AgentApplication<TurnState<any, any>> | ActivityHandler, authConfiguration?: AuthConfiguration) => {
36
36
  const authConfig: AuthConfiguration = authConfiguration ?? loadAuthConfigFromEnv()
37
- const adapter = new CloudAdapter(authConfig)
37
+ let adapter: CloudAdapter
38
+ if (agent instanceof ActivityHandler || !agent.adapter) {
39
+ adapter = new CloudAdapter(authConfig)
40
+ } else {
41
+ adapter = agent.adapter as CloudAdapter
42
+ }
38
43
  const server = express()
39
44
  server.use(express.json())
40
45
  server.use(authorizeJWT(authConfig))