Skip to content
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

Upgrade pipeRunner typing #85

Open
mrWh1te opened this issue Dec 3, 2020 · 3 comments
Open

Upgrade pipeRunner typing #85

mrWh1te opened this issue Dec 3, 2020 · 3 comments

Comments

@mrWh1te
Copy link
Owner

mrWh1te commented Dec 3, 2020

pipeObject = wrapValueInPipe(nextPipeValueOrUndefined as PipeValue|undefined)

Remove as PipeValue|undefined, perhaps through a generic, the function can have a type state for the pipe object/value that can be organically updated with each resolved BotAction.

This may end up making a major change where the Pipe object is put at the start of the injects to preserve type in array destructuring. That effects everything in Botmation.

Originally, the pipe object was put at the end of the injects array to make the expected injects order the same between chain and pipe, with no dev effort. So a BotAction that expects inject1, inject2, inject3 will get the same injects whether or not its ran inside a chain or pipe (if injected the same injects).

Putting the pipe object at the start of the injects array will set all the expected injects index off by 1. It creates a problem for dev's making BotAction's that use injects, in terms of chain and pipe compatibility

To get around this, Botmation can have a new standard helper function to get the pipe object/value and injects in the same "chain" like order. The downside, it would put a new requirement on dev's creating BotAction's that use injects, to always use this function.

Need time to think about this. Maybe this is a good time to explore "hooks" in some kind of way? Doesn't have to be programmed the same way as in React, but has a familiar syntax that may work here i.e. getInjects(), getPipeValue()

The goal is for all assemblers that carry a value such as Pipe and SwitchPipe will be upgraded with similar typing functionality, once this simpler function is upgraded

@mrWh1te
Copy link
Owner Author

mrWh1te commented Dec 3, 2020

exploration - hooks

could replace injects as param in BotAction to a custom hook?

could do the same with page ?

what if the only param a BotAction had was pipeValue?: PipeValue ?

how do hooks effect testing strategy?

add & set inject BotAction's

  • ability to append an inject to the array of injects destructured via hook
  • ability to set a key->value i.e. user->userInject to be specifically objected via hook
  • concern: A botaction would then require another botaction to run prior, for injects setup in order for the hooks to work

@mrWh1te
Copy link
Owner Author

mrWh1te commented Dec 4, 2020

what if injects were an object, with methods, like a Map

But, in addition, have some kind of array for dev's who have no need for keys when accessing using injects

@mrWh1te
Copy link
Owner Author

mrWh1te commented Dec 7, 2020

what if everything passed into a BotAction (pipe object & injects) were wrapped in a single object?

This object could support both key'ed injects and anon injects

then the difference between chain and pipe parameterization is negligible

mrWh1te added a commit that referenced this issue Mar 15, 2021
- run assembled botactions if a virtual dice with X sides rolls a 1
   - number of sides X is set via HO param, default is 1
   - number to roll can be set via 2nd HO param, default is 1
- rollDice() helper function
mrWh1te added a commit that referenced this issue Apr 21, 2021
* instagram & core botactions/helpers

- viewStories 
- instagram navigation botactions
- instagram save your login info UX botactions
- elementExistsInDocument & textExistsInDocument helpers
- elementExists, textExists botactions

* bug fix - edge case for no element found in $ botaction #102

* clickText

* clickElementWithText helper

* fix #102 $$ multiple elements scraping

- undefined edge case will not attempt to parse undefine but return
undefined

* botactions getCookies & deleteCookies & instagram logout

- used in tandem in a pipe to delete cookies for urls associated with a
browser page
   - this in replace of deleteAllCookiesForCurrentUrl BotAction

* instagram logout

* deleteIndexedDB by database name

* e2e test $() for not finding html node

- edge-case behavior modified -> originally threw error, now returns
undefined

* e2e test textExists & elementExists

* e2e clickText

- ignore serialized code injected into puppeteer, covered by e2e

* e2e clickText edge-case

* integration test getCookies

* integration test deleteCookies

* e2e cookies testing

* rollDice()() BotAction #85

- run assembled botactions if a virtual dice with X sides rolls a 1
   - number of sides X is set via HO param, default is 1
   - number to roll can be set via 2nd HO param, default is 1

* helper diceRoll() unit-test

- added edge-case for dice with zero or negative number of sides which
on roll, returns 0

* probably() botaction - new established BotAction group: Random

- randomDecimal helper using pseudo Math.random()
- rollDice() has probability limitation of no probabilities greater than
50% therefore need another botaction
- rollDice()() uses probably()()

- randomDiceRoll() helper similar to randomDecimal() helper

* added ability to override random decimal function

- if prefer not pseudo random ie random derived via buffer/crypto then
set your own function in the helper
- probably()() HO 2nd param (optional) to override random number generator
- instead of using pseudo random number generating, use a
buffer/crypto/other

* randomDecimal HO injector for overriding the default pseudo random generating function

* not going to force pipe() on randomDecimal()() injector

- similar to files()(), because indexedDB has botactions that rely on
piping, and the context might be a chain, so with that you want to
enforce pipe because it makes sense (however arugably oppose it can be
said)

* unit & integration tests

- BotActions group Random: randomDecimal()(), rollDice()(), probably()()

* random botactions test coverage

* indexed-db e2e testing

* house cleaning

* code smells

* Nullish Assignment

* simplify goTo implementation

* readmes updated

* consolidated instagram URL helpers into simpler constants

* fix instagram barrel + desktop widths

* new published minor versions for core and instagram pckgs

- instagram reference latest core pckg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant