Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@soonflow/core

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soonflow/core - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

4

dist/commonHandler.d.ts

@@ -13,3 +13,3 @@ import { FlowNode, FlowNodeHandle, FlowNodeRuleMethods } from './interface';

*/
protected _runFlowHandler(this: This, handler: (node: FlowNode, output: FlowNodeHandle) => Promise<void>): Promise<void>;
protected _runFlowHandler(this: This, handler: (node: FlowNode, output: FlowNodeHandle) => Promise<void>): Promise<undefined>;
/**

@@ -23,4 +23,4 @@ * 对流程节点进行操作

*/
protected _operateFlowNode(this: This, optType: OperateMethodNames, node: FlowNode, outputHandle: FlowNodeHandle): Promise<void>;
protected _operateFlowNode(this: This, optType: OperateMethodNames, node: FlowNode, outputHandle: FlowNodeHandle): Promise<undefined>;
}
export {};

@@ -1,1 +0,1 @@

import{Signal as e}from"@robotlegsjs/signals";function t(e,t){return this.edges.filter((o=>o.sourceNodeId===e&&o.sourceNodeHandleId===t))}class o{async _runFlowHandler(e){const t=this.nodes.filter((({isStartNode:e})=>e));if(0===t.length)return Promise.reject("In SoonFlow: CommonHandler _runFlowHandler not find startNode");for(let o=0;o<t.length;o++)for(let s=0;s<t[o].outputs.length;s++)await e.call(this,t[o],t[o].outputs[s]);return Promise.resolve()}async _operateFlowNode(e,o,s){const n=t.call(this,o.id,s.id);if(0===n.length)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find edges");const r=n.map((e=>e.targetNodeId));for(let t=0;t<r.length;t++){const n=r[t],d=this.nodes.find((e=>e.id===n));if(!d)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find nextNode");const{type:i}=d,a=this.nodeTypeMethods[i];if(!a)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find nodeTypeMethod");await(a[e]?.call(this,{prevNode:o,node:d,inputData:s.data}))}return Promise.resolve()}}class s extends o{nodes;edges;nodeTypeMethods;outInstances;#e=new Map;constructor(e,t,o,s){super(),this.nodes=e,this.edges=t,this.nodeTypeMethods=o,this.outInstances=s}getOutInstance(e){return this.outInstances[e]}getPrevNodeList(e){const t=this.edges.filter((t=>t.targetNodeHandleId===e)),o=[];return t.forEach((e=>{this.nodes.forEach((t=>{t.outputs.some((t=>t.id===e.sourceNodeHandleId))&&(o.find((e=>e.id===t.id))||o.push(t))}))})),o}async runParse(){return this._runFlowHandler(this.parseFlowNode)}async parseFlowNode(e,t){return this._operateFlowNode("parse",e,t)}addSignal(t,o){const s=new e;s.add(o),this.#e.set(t,s)}dispatchSignal(e){this.#e.get(e)?.dispatch()}}class n extends o{nodes;edges;nodeTypeMethods;outInstances;constructor(e,t,o,s){super(),this.nodes=e,this.edges=t,this.nodeTypeMethods=o,this.outInstances=s,this.#t()}#t(){this._runFlowHandler(this.unregisterFlowNode)}async unregisterFlowNode(e,t){return this._operateFlowNode("unregister",e,t)}}const r=(e,...t)=>{console.error(`In SoonFlow: ${e}`,...t)};class d{nodeTypeMethods;outInstances;constructor(e,t){this.nodeTypeMethods=e,this.outInstances=t}async parseFlow(e,t){return new s(e,t,this.nodeTypeMethods,this.outInstances).runParse()}unregisterFlow(e,t){new n(e,t,this.nodeTypeMethods,this.outInstances)}}export{s as SoonFlowParse,n as SoonFlowUnregister,d as default,r as error};
import{Signal as e}from"@robotlegsjs/signals";function t(e,t){return this.edges.filter((o=>o.sourceNodeId===e&&o.sourceNodeHandleId===t))}class o{async _runFlowHandler(e){const t=this.nodes.filter((({isStartNode:e})=>e));if(0===t.length)return Promise.reject("In SoonFlow: CommonHandler _runFlowHandler not find startNode");for(let o=0;o<t.length;o++)for(let s=0;s<t[o].outputs.length;s++)await e.call(this,t[o],t[o].outputs[s])}async _operateFlowNode(e,o,s){const n=t.call(this,o.id,s.id);if(console.log(" _operateFlowNode resolve done"),0===n.length)return;const r=n.map((e=>e.targetNodeId));for(let t=0;t<r.length;t++){const n=r[t],d=this.nodes.find((e=>e.id===n));if(!d)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find nextNode");const{type:a}=d,i=this.nodeTypeMethods[a];if(!i)return Promise.reject("In SoonFlow: CommonHandler _operateFlowNode not find nodeTypeMethod");await(i[e]?.call(this,{prevNode:o,node:d,inputData:s.data}))}}}class s extends o{nodes;edges;nodeTypeMethods;outInstances;#e=new Map;constructor(e,t,o,s){super(),this.nodes=e,this.edges=t,this.nodeTypeMethods=o,this.outInstances=s}getOutInstance(e){return this.outInstances[e]}getPrevNodeList(e){const t=this.edges.filter((t=>t.targetNodeHandleId===e)),o=[];return t.forEach((e=>{this.nodes.forEach((t=>{t.outputs.some((t=>t.id===e.sourceNodeHandleId))&&(o.find((e=>e.id===t.id))||o.push(t))}))})),o}async runParse(){return this._runFlowHandler(this.parseFlowNode)}async parseFlowNode(e,t){return this._operateFlowNode("parse",e,t)}addSignal(t,o){const s=new e;s.add(o),this.#e.set(t,s)}dispatchSignal(e){this.#e.get(e)?.dispatch()}}class n extends o{nodes;edges;nodeTypeMethods;outInstances;constructor(e,t,o,s){super(),this.nodes=e,this.edges=t,this.nodeTypeMethods=o,this.outInstances=s,this.#t()}#t(){this._runFlowHandler(this.unregisterFlowNode)}async unregisterFlowNode(e,t){return this._operateFlowNode("unregister",e,t)}}const r=(e,...t)=>{console.error(`In SoonFlow: ${e}`,...t)};class d{nodeTypeMethods;outInstances;constructor(e,t){this.nodeTypeMethods=e,this.outInstances=t}async parseFlow(e,t){return new s(e,t,this.nodeTypeMethods,this.outInstances).runParse()}unregisterFlow(e,t){new n(e,t,this.nodeTypeMethods,this.outInstances)}}export{s as SoonFlowParse,n as SoonFlowUnregister,d as default,r as error};

@@ -19,3 +19,3 @@ import { CommonHandler } from './commonHandler';

getPrevNodeList(targetNodeHandleId: string): FlowNode[];
runParse(): Promise<void>;
runParse(): Promise<undefined>;
parseFlowNode(node: FlowNode, outputHandle: FlowNodeHandle): Promise<void>;

@@ -22,0 +22,0 @@ addSignal<V = any>(key: string, fn: (data: V) => void): void;

{
"name": "@soonflow/core",
"version": "0.2.4",
"version": "0.2.5",
"description": "Ssoonflow Core",

@@ -17,3 +17,3 @@ "main": "dist/index.esm.js",

},
"gitHead": "4664211906a87c7733212ace764f6dd3d20566fb"
"gitHead": "a3ce8f06e19e9c5aa7357631b0326e69c30cb735"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc