@backtest-kit/graph 3.3.2 → 3.4.0

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/build/index.cjs CHANGED
@@ -40,13 +40,7 @@ const deepFlat = (arr = []) => {
40
40
  return result;
41
41
  };
42
42
 
43
- /**
44
- * Рекурсивно вычисляет значение узла графа.
45
- * Для SourceNode вызывает fetch().
46
- * Для OutputNode сначала резолвит все дочерние nodes параллельно,
47
- * затем передаёт их типизированные значения в compute().
48
- */
49
- const resolve = async (node) => {
43
+ async function resolve(node) {
50
44
  if (!backtestKit.ExecutionContextService.hasContext()) {
51
45
  throw new Error("Execution context is required to resolve graph nodes. Please ensure that resolve() is called within a valid execution context.");
52
46
  }
@@ -60,7 +54,7 @@ const resolve = async (node) => {
60
54
  }
61
55
  const values = await Promise.all(node.nodes.map(resolve));
62
56
  return node.compute(values);
63
- };
57
+ }
64
58
 
65
59
  /**
66
60
  * Преобразует древовидный граф в плоский массив IFlatNode для хранения в БД.
package/build/index.mjs CHANGED
@@ -38,13 +38,7 @@ const deepFlat = (arr = []) => {
38
38
  return result;
39
39
  };
40
40
 
41
- /**
42
- * Рекурсивно вычисляет значение узла графа.
43
- * Для SourceNode вызывает fetch().
44
- * Для OutputNode сначала резолвит все дочерние nodes параллельно,
45
- * затем передаёт их типизированные значения в compute().
46
- */
47
- const resolve = async (node) => {
41
+ async function resolve(node) {
48
42
  if (!ExecutionContextService.hasContext()) {
49
43
  throw new Error("Execution context is required to resolve graph nodes. Please ensure that resolve() is called within a valid execution context.");
50
44
  }
@@ -58,7 +52,7 @@ const resolve = async (node) => {
58
52
  }
59
53
  const values = await Promise.all(node.nodes.map(resolve));
60
54
  return node.compute(values);
61
- };
55
+ }
62
56
 
63
57
  /**
64
58
  * Преобразует древовидный граф в плоский массив IFlatNode для хранения в БД.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backtest-kit/graph",
3
- "version": "3.3.2",
3
+ "version": "3.4.0",
4
4
  "description": "Compose backtest-kit computations as a typed directed acyclic graph. Define source nodes that fetch market data and output nodes that compute derived values — then resolve the whole graph in topological order.",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
@@ -67,15 +67,15 @@
67
67
  "ts-morph": "27.0.2",
68
68
  "tslib": "2.7.0",
69
69
  "typedoc": "0.27.9",
70
- "backtest-kit": "3.3.2",
70
+ "backtest-kit": "3.4.0",
71
71
  "worker-testbed": "1.0.12"
72
72
  },
73
73
  "peerDependencies": {
74
- "backtest-kit": "^3.3.2",
74
+ "backtest-kit": "^3.4.0",
75
75
  "typescript": "^5.0.0"
76
76
  },
77
77
  "dependencies": {
78
- "di-kit": "^1.0.18",
78
+ "di-kit": "^1.1.1",
79
79
  "di-scoped": "^1.0.21",
80
80
  "functools-kit": "^1.0.95",
81
81
  "get-moment-stamp": "^1.1.1"
package/types.d.ts CHANGED
@@ -95,7 +95,8 @@ declare const deepFlat: (arr?: INode[]) => INode[];
95
95
  * Для OutputNode сначала резолвит все дочерние nodes параллельно,
96
96
  * затем передаёт их типизированные значения в compute().
97
97
  */
98
- declare const resolve: <T extends TypedNode>(node: T) => Promise<InferNodeValue<T>>;
98
+ declare function resolve<V extends Value>(node: SourceNode<V>): Promise<V>;
99
+ declare function resolve<TNodes extends TypedNode[], V extends Value>(node: OutputNode<TNodes, V>): Promise<V>;
99
100
 
100
101
  /**
101
102
  * Сериализованная (плоская) форма узла графа для хранения в БД.