graphai 2.0.9 → 2.0.10

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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphai",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
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",
@@ -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": {