@microsoft/agents-hosting-express 0.6.1 → 0.6.16-gc874f0c9d8

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.
@@ -6,15 +6,16 @@ import { ActivityHandler, AgentApplication, AuthConfiguration, TurnState } from
6
6
  /**
7
7
  * Starts an Express server for handling Agent requests.
8
8
  *
9
- * @param agent - The AgentApplication instance to process incoming activities.
9
+ * @param agent - The AgentApplication or ActivityHandler instance to process incoming activities.
10
10
  * @param authConfiguration - Optional custom authentication configuration. If not provided,
11
- * configuration will be loaded from environment variables.
12
- * @returns void
11
+ * configuration will be loaded from environment variables using loadAuthConfigFromEnv().
12
+ * @returns void - This function does not return a value as it starts a long-running server process.
13
13
  *
14
14
  * @remarks
15
15
  * This function sets up an Express server with the necessary middleware and routes for handling
16
- * bot requests. It configures JWT authorization middleware and sets up the message endpoint.
17
- * The server will listen on the port specified in the environment (or 3978 by default).
16
+ * agent requests. It configures JWT authorization middleware and sets up the message endpoint.
17
+ * The server will listen on the port specified in the PORT environment variable (or 3978 by default)
18
+ * and logs startup information including the SDK version and configured app ID.
18
19
  *
19
20
  * @example
20
21
  * ```typescript
@@ -3,39 +3,6 @@
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
- Object.defineProperty(o, "default", { enumerable: true, value: v });
19
- }) : function(o, v) {
20
- o["default"] = v;
21
- });
22
- var __importStar = (this && this.__importStar) || (function () {
23
- var ownKeys = function(o) {
24
- ownKeys = Object.getOwnPropertyNames || function (o) {
25
- var ar = [];
26
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
- return ar;
28
- };
29
- return ownKeys(o);
30
- };
31
- return function (mod) {
32
- if (mod && mod.__esModule) return mod;
33
- var result = {};
34
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
- __setModuleDefault(result, mod);
36
- return result;
37
- };
38
- })();
39
6
  var __importDefault = (this && this.__importDefault) || function (mod) {
40
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
41
8
  };
@@ -43,18 +10,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
43
10
  exports.startServer = void 0;
44
11
  const express_1 = __importDefault(require("express"));
45
12
  const agents_hosting_1 = require("@microsoft/agents-hosting");
13
+ const package_json_1 = require("@microsoft/agents-hosting/package.json");
46
14
  /**
47
15
  * Starts an Express server for handling Agent requests.
48
16
  *
49
- * @param agent - The AgentApplication instance to process incoming activities.
17
+ * @param agent - The AgentApplication or ActivityHandler instance to process incoming activities.
50
18
  * @param authConfiguration - Optional custom authentication configuration. If not provided,
51
- * configuration will be loaded from environment variables.
52
- * @returns void
19
+ * configuration will be loaded from environment variables using loadAuthConfigFromEnv().
20
+ * @returns void - This function does not return a value as it starts a long-running server process.
53
21
  *
54
22
  * @remarks
55
23
  * This function sets up an Express server with the necessary middleware and routes for handling
56
- * bot requests. It configures JWT authorization middleware and sets up the message endpoint.
57
- * The server will listen on the port specified in the environment (or 3978 by default).
24
+ * agent requests. It configures JWT authorization middleware and sets up the message endpoint.
25
+ * The server will listen on the port specified in the PORT environment variable (or 3978 by default)
26
+ * and logs startup information including the SDK version and configured app ID.
58
27
  *
59
28
  * @example
60
29
  * ```typescript
@@ -84,8 +53,7 @@ const startServer = (agent, authConfiguration) => {
84
53
  server.post('/api/messages', (req, res) => adapter.process(req, res, (context) => agent.run(context)));
85
54
  const port = process.env.PORT || 3978;
86
55
  server.listen(port, async () => {
87
- const version = (await Promise.resolve().then(() => __importStar(require('@microsoft/agents-hosting/package.json')))).version;
88
- console.log(`\nServer listening to port ${port} on sdk ${version} for appId ${authConfig.clientId} debug ${process.env.DEBUG}`);
56
+ console.log(`\nServer listening to port ${port} on sdk ${package_json_1.version} for appId ${authConfig.clientId} debug ${process.env.DEBUG}`);
89
57
  }).on('error', console.error);
90
58
  };
91
59
  exports.startServer = startServer;
@@ -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,IAAI,OAAqB,CAAA;IACzB,IAAI,KAAK,YAAY,gCAAe,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACvD,OAAO,GAAG,IAAI,6BAAY,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,KAAK,CAAC,OAAuB,CAAA;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,O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AC,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,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,WAAW,sBAAO,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;AAtBY,QAAA,WAAW,eAsBvB"}
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.6.1",
4
+ "version": "0.6.16-gc874f0c9d8",
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.6.1",
22
+ "@microsoft/agents-hosting": "0.6.16-gc874f0c9d8",
23
23
  "express": "^5.1.0"
24
24
  },
25
25
  "license": "MIT",
@@ -5,19 +5,20 @@
5
5
 
6
6
  import express, { Response } from 'express'
7
7
  import { ActivityHandler, AgentApplication, AuthConfiguration, authorizeJWT, CloudAdapter, 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.
11
11
  *
12
- * @param agent - The AgentApplication instance to process incoming activities.
12
+ * @param agent - The AgentApplication or ActivityHandler instance to process incoming activities.
13
13
  * @param authConfiguration - Optional custom authentication configuration. If not provided,
14
- * configuration will be loaded from environment variables.
15
- * @returns void
14
+ * configuration will be loaded from environment variables using loadAuthConfigFromEnv().
15
+ * @returns void - This function does not return a value as it starts a long-running server process.
16
16
  *
17
17
  * @remarks
18
18
  * This function sets up an Express server with the necessary middleware and routes for handling
19
- * bot requests. It configures JWT authorization middleware and sets up the message endpoint.
20
- * The server will listen on the port specified in the environment (or 3978 by default).
19
+ * agent requests. It configures JWT authorization middleware and sets up the message endpoint.
20
+ * The server will listen on the port specified in the PORT environment variable (or 3978 by default)
21
+ * and logs startup information including the SDK version and configured app ID.
21
22
  *
22
23
  * @example
23
24
  * ```typescript
@@ -52,7 +53,6 @@ export const startServer = (agent: AgentApplication<TurnState<any, any>> | Activ
52
53
 
53
54
  const port = process.env.PORT || 3978
54
55
  server.listen(port, async () => {
55
- const version = (await import('@microsoft/agents-hosting/package.json')).version
56
56
  console.log(`\nServer listening to port ${port} on sdk ${version} for appId ${authConfig.clientId} debug ${process.env.DEBUG}`)
57
57
  }).on('error', console.error)
58
58
  }