@receptron/graphai_express 0.0.30 → 0.0.32

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/lib/graph.js CHANGED
@@ -37,7 +37,7 @@ const streamGraphRunner = (agentDictionary, agentFilters = [], streamChunkCallba
37
37
  };
38
38
  const filterList = [...agentFilters, streamAgentFilter];
39
39
  const dispatcher = streamGraphRunnerInternal(agentDictionary, filterList);
40
- const result = await dispatcher(req, res);
40
+ const result = await dispatcher(req);
41
41
  const json_data = JSON.stringify(result);
42
42
  res.write("___END___");
43
43
  res.write(json_data);
@@ -53,7 +53,7 @@ const nonStreamGraphRunner = (agentDictionary, agentFilters = []) => {
53
53
  return async (req, res, next) => {
54
54
  try {
55
55
  const dispatcher = streamGraphRunnerInternal(agentDictionary, agentFilters);
56
- const result = await dispatcher(req, res);
56
+ const result = await dispatcher(req);
57
57
  return res.json(result);
58
58
  }
59
59
  catch (e) {
@@ -64,7 +64,7 @@ const nonStreamGraphRunner = (agentDictionary, agentFilters = []) => {
64
64
  exports.nonStreamGraphRunner = nonStreamGraphRunner;
65
65
  // internal function
66
66
  const streamGraphRunnerInternal = (agentDictionary, agentFilters = []) => {
67
- return async (req, res) => {
67
+ return async (req) => {
68
68
  const { graphData } = req.body;
69
69
  const { config } = req;
70
70
  const graphai = new graphai_1.GraphAI(graphData, agentDictionary, { agentFilters, config: config ?? {} });
package/lib/type.d.ts CHANGED
@@ -13,4 +13,4 @@ export type ExpressAgentInfo = {
13
13
  output: any;
14
14
  stream: boolean;
15
15
  };
16
- export type StreamChunkCallback = (context: AgentFunctionContext, token: string) => void;
16
+ export type StreamChunkCallback = (context: AgentFunctionContext, token: string | Record<string, string>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@receptron/graphai_express",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "description": "GraphAI express web server middleware.",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -10,9 +10,9 @@
10
10
  "build": "tsc && tsc-alias",
11
11
  "eslint": "eslint --fix",
12
12
  "server": "ts-node -r tsconfig-paths/register test/express.ts",
13
- "test_stream": "ts-node -r tsconfig-paths/register test/stream_client.ts",
14
- "test_stream2": "ts-node -r tsconfig-paths/register test/stream_graph.ts",
15
- "test": "ts-node -r tsconfig-paths/register test/client.ts",
13
+ "test_stream": "ts-node -r tsconfig-paths/register test/test_stream_client.ts",
14
+ "test_stream2": "ts-node -r tsconfig-paths/register test/test_stream_graph.ts",
15
+ "test": "node --test -r tsconfig-paths/register --require ts-node/register ./test/test_*.ts",
16
16
  "format": "prettier --write '{src,test}/**/*.{yaml,ts,json}'",
17
17
  "ci": "yarn run format && yarn run eslint && yarn run build"
18
18
  },
@@ -27,26 +27,14 @@
27
27
  },
28
28
  "homepage": "https://github.com/receptron/graphai_utils/tree/main/packages/express#readme",
29
29
  "devDependencies": {
30
- "@graphai/agents": "^0.0.21",
31
- "@types/express": "^4.17.21",
32
- "@types/node": "^20.14.12",
33
- "@types/sinon": "^17.0.3",
34
- "@types/sinon-express-mock": "^1.3.12",
35
- "eslint": "^9.7.0",
36
- "prettier": "^3.3.3",
37
- "sinon": "^18.0.0",
38
- "sinon-express-mock": "^2.2.1",
39
- "ts-node": "^10.9.2",
40
- "tsc-alias": "^1.8.8",
41
- "tsconfig-paths": "^4.2.0",
42
- "typescript": "^5.5.4",
43
- "typescript-eslint": "^7.17.0"
30
+ "sinon": "^19.0.2",
31
+ "sinon-express-mock": "^2.2.1"
44
32
  },
45
33
  "dependencies": {
46
34
  "@graphai/agent_filters": "^0.0.6",
47
35
  "dotenv": "^16.4.5",
48
- "express": "^4.19.2",
49
- "graphai": "^0.5.5"
36
+ "express": "^4.21.0",
37
+ "graphai": "^0.5.8"
50
38
  },
51
39
  "types": "./lib/index.d.ts",
52
40
  "directories": {