graphai 2.0.11 → 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.esm.js CHANGED
@@ -174,7 +174,7 @@ const propNumberFunction = (result, propId) => {
174
174
  if (match) {
175
175
  return Number(result) + Number(match[1]);
176
176
  }
177
- const equalMatch = propId.match(/^equal\(([A-Za-z0-9!#$%&()*+,\-./:;<=>?@]+)\)/);
177
+ const equalMatch = propId.match(/^equal\(([A-Za-z0-9!#$%&()*+,\-/:;<=>?@]+)\)/);
178
178
  if (equalMatch) {
179
179
  return result === Number(equalMatch[1]);
180
180
  }
@@ -189,7 +189,20 @@ const propBooleanFunction = (result, propId) => {
189
189
  }
190
190
  return undefined;
191
191
  };
192
- const propFunctions = [propArrayFunction, propObjectFunction, propStringFunction, propNumberFunction, propBooleanFunction];
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];
193
206
  const utilsFunctions = (input, nodes) => {
194
207
  if (input === "@now" || input === "@now_ms") {
195
208
  return Date.now();
@@ -459,7 +472,7 @@ const getNestedData = (result, propId, propFunctions) => {
459
472
  return undefined;
460
473
  };
461
474
  const innerGetDataFromSource = (result, propIds, propFunctions) => {
462
- if (!isNull(result) && propIds && propIds.length > 0) {
475
+ if (propIds && propIds.length > 0) {
463
476
  const propId = propIds[0];
464
477
  const ret = getNestedData(result, propId, propFunctions);
465
478
  if (ret === undefined) {
@@ -604,6 +617,7 @@ class ComputedNode extends Node {
604
617
  this.filterParams = data.filterParams ?? {};
605
618
  this.passThrough = data.passThrough;
606
619
  this.retryLimit = data.retry ?? graph.retryLimit ?? 0;
620
+ this.repeatUntil = data.repeatUntil;
607
621
  this.timeout = data.timeout;
608
622
  this.isResult = data.isResult ?? false;
609
623
  this.priority = data.priority ?? 0;
@@ -839,6 +853,14 @@ class ComputedNode extends Node {
839
853
  GraphAILogger.log(`-- transactionId mismatch with ${this.nodeId} (probably timeout)`);
840
854
  return;
841
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
+ }
842
864
  // after process
843
865
  this.afterExecute(result, localLog);
844
866
  }
@@ -979,6 +1001,7 @@ const computedNodeAttributeKeys = [
979
1001
  "anyInput",
980
1002
  "params",
981
1003
  "retry",
1004
+ "repeatUntil",
982
1005
  "timeout",
983
1006
  "agent",
984
1007
  "graph",
@@ -1622,5 +1645,5 @@ class GraphAI {
1622
1645
  }
1623
1646
  }
1624
1647
 
1625
- 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 };
1626
1649
  //# sourceMappingURL=bundle.esm.js.map