-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switchPipe()() misses casePipe results from return array #71
Comments
The exception, like for every BotAction since #66, is being aborted, which When it's aborted, an AbortLineSignal is returned or a PipeValue (depending on the Aborting in switchPipe is different in that it's like a soft-abort, it wants to abort the assembled functionality, but not the returning of the actions' resolved responses. That requires one additional assembledLines to abort... need to think more on this If it's not aborted, the returned array will consist of PipeValue's and possibly MatchesSignal's. Did consider returning a MatchesSignal's |
Traditional switch/case/break statement: switch(value){
case 10:
// run code
break; // this is triggered IF case 1 matches
case 'test':
// run code
break; // this is triggered IF case 'test' matches
default:
// ran if not break earlier
} The idea is to copy the flow with switchPipe/casePipe/abort(1) await pipe()(
switchPipe(value)( // can be a BotAction to resolve for pipeValue to inject, or just a pipeValue to inject
pipeCase(10)(
// run assembled actions if value === 10
),
abort(1), // stops assembled BotActions from running in switchPipe IF a pipeCase() has matched
pipeCase('test')(
// run assembled actions if value === 'test'
),
abort() // same as abort(1) as no param fallback sets value to 1
// default code can be put directly here without pipeCase
)
)(mockPage) |
current concept for switchPipe abort behavior if an assembled botaction returns an infinite AbortLineSignal(0) then return that otherwise, if no case matches, process a returned AbortLineSignal by 1 assembledLines (subtract 1 from assembledLines) then for either no case matches or has matches, upon abortline signal do the following: 0 = dont break line, append abortLineSignal.pipeValue to return array otherwise proceed like normal (pipe values returned by functions are appended to return array and MatchesSignal is also appended to return array) |
* switchPipe()() abort line signal unit-tests * toPipe as BotAction Abort Behavior unit-test * switchPipe()() code standardized & cleaned - abortlinesignal, matchessignal, and regular pipeValues returned are supported - includes unique abortlinesignal/matchessignal behavior - fixes issue #71 and implements the related pseudo-code, commented at the bottom
Botmation/src/botmation/actions/assembly-lines.ts
Line 162 in 6dd013d
In the event a
pipeCase()()
returns aMatchesSignal
, the results of which need to be added (pushed) unto the results array that is returned in the endAdd test
Reduce push calls
Should it push the signal itself or the pipeValue... or unto the results array that is returned at the end?
The text was updated successfully, but these errors were encountered: