graphai 2.0.10 → 2.0.12
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/bundle.cjs.js +1 -1
- package/lib/bundle.cjs.js.map +1 -1
- package/lib/bundle.esm.js +34 -3
- package/lib/bundle.esm.js.map +1 -1
- package/lib/bundle.umd.js +1 -1
- package/lib/bundle.umd.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/lib/node.d.ts +1 -0
- package/lib/node.js +9 -0
- package/lib/type.d.ts +4 -0
- package/lib/utils/data_source.js +1 -1
- package/lib/utils/prop_function.js +22 -1
- package/lib/validators/common.js +1 -0
- package/package.json +4 -4
package/lib/bundle.esm.js
CHANGED
|
@@ -143,6 +143,10 @@ const propStringFunction = (result, propId) => {
|
|
|
143
143
|
if (propId === "toUpperCase()") {
|
|
144
144
|
return result.toUpperCase();
|
|
145
145
|
}
|
|
146
|
+
const equalMatch = propId.match(/^equal\(([A-Za-z0-9!#$%&()*+,\-./:;<=>?@]+)\)/);
|
|
147
|
+
if (equalMatch) {
|
|
148
|
+
return result === equalMatch[1];
|
|
149
|
+
}
|
|
146
150
|
const sliceMatch = propId.match(/^slice\((-?\d+)(?:,\s*(-?\d+))?\)/);
|
|
147
151
|
if (sliceMatch) {
|
|
148
152
|
if (sliceMatch[2] !== undefined) {
|
|
@@ -170,6 +174,10 @@ const propNumberFunction = (result, propId) => {
|
|
|
170
174
|
if (match) {
|
|
171
175
|
return Number(result) + Number(match[1]);
|
|
172
176
|
}
|
|
177
|
+
const equalMatch = propId.match(/^equal\(([A-Za-z0-9!#$%&()*+,\-/:;<=>?@]+)\)/);
|
|
178
|
+
if (equalMatch) {
|
|
179
|
+
return result === Number(equalMatch[1]);
|
|
180
|
+
}
|
|
173
181
|
}
|
|
174
182
|
return undefined;
|
|
175
183
|
};
|
|
@@ -181,7 +189,20 @@ const propBooleanFunction = (result, propId) => {
|
|
|
181
189
|
}
|
|
182
190
|
return undefined;
|
|
183
191
|
};
|
|
184
|
-
const
|
|
192
|
+
const propUndefinrdFunction = (result, propId) => {
|
|
193
|
+
if (result === undefined) {
|
|
194
|
+
const equalMatch = propId.match(/^default\(([A-Za-z0-9!#$%&()*+,\-/:;<=>?@]+)\)/);
|
|
195
|
+
if (equalMatch) {
|
|
196
|
+
if (equalMatch[1].match(/^[0-9-]+$/)) {
|
|
197
|
+
return Number(equalMatch[1]);
|
|
198
|
+
}
|
|
199
|
+
return equalMatch[1];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return undefined;
|
|
203
|
+
};
|
|
204
|
+
// TODO if (result === undefined) {default()}
|
|
205
|
+
const propFunctions = [propArrayFunction, propObjectFunction, propStringFunction, propNumberFunction, propBooleanFunction, propUndefinrdFunction];
|
|
185
206
|
const utilsFunctions = (input, nodes) => {
|
|
186
207
|
if (input === "@now" || input === "@now_ms") {
|
|
187
208
|
return Date.now();
|
|
@@ -451,7 +472,7 @@ const getNestedData = (result, propId, propFunctions) => {
|
|
|
451
472
|
return undefined;
|
|
452
473
|
};
|
|
453
474
|
const innerGetDataFromSource = (result, propIds, propFunctions) => {
|
|
454
|
-
if (
|
|
475
|
+
if (propIds && propIds.length > 0) {
|
|
455
476
|
const propId = propIds[0];
|
|
456
477
|
const ret = getNestedData(result, propId, propFunctions);
|
|
457
478
|
if (ret === undefined) {
|
|
@@ -596,6 +617,7 @@ class ComputedNode extends Node {
|
|
|
596
617
|
this.filterParams = data.filterParams ?? {};
|
|
597
618
|
this.passThrough = data.passThrough;
|
|
598
619
|
this.retryLimit = data.retry ?? graph.retryLimit ?? 0;
|
|
620
|
+
this.repeatUntil = data.repeatUntil;
|
|
599
621
|
this.timeout = data.timeout;
|
|
600
622
|
this.isResult = data.isResult ?? false;
|
|
601
623
|
this.priority = data.priority ?? 0;
|
|
@@ -831,6 +853,14 @@ class ComputedNode extends Node {
|
|
|
831
853
|
GraphAILogger.log(`-- transactionId mismatch with ${this.nodeId} (probably timeout)`);
|
|
832
854
|
return;
|
|
833
855
|
}
|
|
856
|
+
if (this.repeatUntil?.exists) {
|
|
857
|
+
const dummyResult = { self: { result: this.getResult(result) } };
|
|
858
|
+
const repeatResult = resultsOf({ data: this.repeatUntil?.exists }, dummyResult, [], true);
|
|
859
|
+
if (isNull(repeatResult?.data)) {
|
|
860
|
+
this.retry(NodeState.Failed, Error("Repeat Until"));
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
834
864
|
// after process
|
|
835
865
|
this.afterExecute(result, localLog);
|
|
836
866
|
}
|
|
@@ -971,6 +1001,7 @@ const computedNodeAttributeKeys = [
|
|
|
971
1001
|
"anyInput",
|
|
972
1002
|
"params",
|
|
973
1003
|
"retry",
|
|
1004
|
+
"repeatUntil",
|
|
974
1005
|
"timeout",
|
|
975
1006
|
"agent",
|
|
976
1007
|
"graph",
|
|
@@ -1614,5 +1645,5 @@ class GraphAI {
|
|
|
1614
1645
|
}
|
|
1615
1646
|
}
|
|
1616
1647
|
|
|
1617
|
-
export { GraphAI, GraphAILogger, NodeState, TaskManager, ValidationError, agentInfoWrapper, assert, debugResultKey, defaultAgentInfo, defaultConcurrency, defaultTestContext, graphDataLatestVersion, inputs2dataSources, isComputedNodeData, isObject, isStaticNodeData, parseNodeName, sleep, strIntentionalError };
|
|
1648
|
+
export { GraphAI, GraphAILogger, NodeState, TaskManager, ValidationError, agentInfoWrapper, assert, debugResultKey, defaultAgentInfo, defaultConcurrency, defaultTestContext, graphDataLatestVersion, inputs2dataSources, isComputedNodeData, isNull, isObject, isStaticNodeData, parseNodeName, sleep, strIntentionalError };
|
|
1618
1649
|
//# sourceMappingURL=bundle.esm.js.map
|