graphai 2.0.9 → 2.0.11

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.
@@ -18,6 +18,18 @@ const propArrayFunction = (result, propId) => {
18
18
  if (propId === "isEmpty()") {
19
19
  return result.length === 0;
20
20
  }
21
+ if (propId === "average()" || propId === "mean()") {
22
+ return result.length ? result.reduce((a, b) => a + b, 0) / result.length : 0;
23
+ }
24
+ if (propId === "sum()") {
25
+ return result.reduce((a, b) => a + b, 0);
26
+ }
27
+ if (propId === "max()") {
28
+ return result.length ? Math.max(...result) : 0;
29
+ }
30
+ if (propId === "min()") {
31
+ return result.length ? Math.min(...result) : 0;
32
+ }
21
33
  // array join
22
34
  const matchJoin = propId.match(/^join\(([,-\s]?)\)$/);
23
35
  if (matchJoin && Array.isArray(matchJoin)) {
@@ -43,13 +55,13 @@ const propObjectFunction = (result, propId) => {
43
55
  const propStringFunction = (result, propId) => {
44
56
  if (typeof result === "string") {
45
57
  if (propId === "codeBlock()") {
46
- const match = ("\n" + result).match(/\n```[a-zA-z]*([\s\S]*?)\n```/);
58
+ const match = ("\n" + result).match(/\n```[a-zA-Z]*([\s\S]*?)\n```/);
47
59
  if (match) {
48
60
  return match[1];
49
61
  }
50
62
  }
51
63
  if (propId === "codeBlockOrRaw()") {
52
- const match = ("\n" + result).match(/\n```[a-zA-z]*([\s\S]*?)\n```/);
64
+ const match = ("\n" + result).match(/\n```[a-zA-Z]*([\s\S]*?)\n```/);
53
65
  if (match) {
54
66
  return match[1];
55
67
  }
@@ -73,6 +85,10 @@ const propStringFunction = (result, propId) => {
73
85
  if (propId === "toUpperCase()") {
74
86
  return result.toUpperCase();
75
87
  }
88
+ const equalMatch = propId.match(/^equal\(([A-Za-z0-9!#$%&()*+,\-./:;<=>?@]+)\)/);
89
+ if (equalMatch) {
90
+ return result === equalMatch[1];
91
+ }
76
92
  const sliceMatch = propId.match(/^slice\((-?\d+)(?:,\s*(-?\d+))?\)/);
77
93
  if (sliceMatch) {
78
94
  if (sliceMatch[2] !== undefined) {
@@ -100,6 +116,10 @@ const propNumberFunction = (result, propId) => {
100
116
  if (match) {
101
117
  return Number(result) + Number(match[1]);
102
118
  }
119
+ const equalMatch = propId.match(/^equal\(([A-Za-z0-9!#$%&()*+,\-./:;<=>?@]+)\)/);
120
+ if (equalMatch) {
121
+ return result === Number(equalMatch[1]);
122
+ }
103
123
  }
104
124
  return undefined;
105
125
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphai",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "Asynchronous data flow execution engine for agentic AI apps.",
5
5
  "main": "lib/bundle.cjs.js",
6
6
  "module": "lib/bundle.esm.js",
@@ -9,13 +9,13 @@
9
9
  "./lib"
10
10
  ],
11
11
  "scripts": {
12
- "build": "rm -r lib/* && tsc && npx rollup -c && tsc-alias",
12
+ "build": "rm -r lib/* && tsc && npx rollup -c",
13
13
  "eslint": "eslint",
14
14
  "typedoc": "npx typedoc src/index.ts --out ../../docs/apiDoc",
15
15
  "typedoc:md": "npx typedoc src/index.ts --out ../../docs/apiDocMd --plugin typedoc-plugin-markdown",
16
16
  "doc": "echo nothing",
17
- "format": "prettier --write '{src,tests,samples}/**/*.ts' *.mjs",
18
- "test": "node --test -r tsconfig-paths/register --require ts-node/register ./tests/**/test_*.ts",
17
+ "format": "prettier --write '{src,tests}/**/*.ts' *.mjs",
18
+ "test": "node --test --require ts-node/register ./tests/**/test_*.ts",
19
19
  "b": "yarn run format && yarn run eslint && yarn run build"
20
20
  },
21
21
  "repository": {
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "homepage": "https://github.com/receptron/graphai#readme",
31
31
  "devDependencies": {
32
- "typedoc": "^0.28.5",
33
- "typedoc-plugin-markdown": "^4.6.4"
32
+ "typedoc": "^0.28.7",
33
+ "typedoc-plugin-markdown": "^4.7.0"
34
34
  },
35
35
  "types": "./lib/index.d.ts",
36
36
  "directories": {