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

New Chain-Link: Pipe; Simplifying BotAction & Added New #20

Merged
merged 153 commits into from
Jul 29, 2020
Merged
Changes from 1 commit
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
8a7061f
Experimental Pipe as link in the main Chain
mrWh1te Apr 1, 2020
4b1c55d
Draft 1 for generic BotActionsFactory
Apr 21, 2020
aeee334
Passing Tests
Apr 22, 2020
211b787
Merge branch 'master' of github.com:mrWh1te/Botmation into bot-action…
Apr 22, 2020
3632ba9
Merged in master & fixed build
Apr 22, 2020
0f56850
Merge branch 'master' of github.com:mrWh1te/Botmation into bot-action…
mrWh1te Jun 29, 2020
2c6464e
Previous Action's Resolved Value injected at end
mrWh1te Jun 29, 2020
b5e613b
Updated Comments
mrWh1te Jun 29, 2020
627043b
Simplified waitForNavigation
mrWh1te Jul 11, 2020
2417c47
Improvements
mrWh1te Jul 12, 2020
2450ad8
WIP
mrWh1te Jul 12, 2020
24bd7a5
Ideas
mrWh1te Jul 12, 2020
563ff00
createBotActionFactory() concept
mrWh1te Jul 12, 2020
352dc36
createBotAction concept
mrWh1te Jul 12, 2020
36dd4cc
Notes
mrWh1te Jul 12, 2020
67da178
Going Forward
mrWh1te Jul 12, 2020
99d024e
idea
mrWh1te Jul 12, 2020
e896660
Playing
mrWh1te Jul 12, 2020
5af9ce3
setIndexedDBKeyValue 3 concept
mrWh1te Jul 12, 2020
948419d
Exploring
mrWh1te Jul 12, 2020
c227e20
Question
mrWh1te Jul 12, 2020
69fc34a
WIP
mrWh1te Jul 13, 2020
89edb86
Notes
mrWh1te Jul 13, 2020
b4b4952
IndexedDB Actions WIP
mrWh1te Jul 14, 2020
93d685f
WIP
mrWh1te Jul 14, 2020
078bd94
WIP
mrWh1te Jul 14, 2020
c89071a
Working
mrWh1te Jul 15, 2020
311204e
House Cleaning
mrWh1te Jul 15, 2020
50d516c
Working
mrWh1te Jul 15, 2020
9f98947
Cleaned Up
mrWh1te Jul 15, 2020
00536cf
Working
mrWh1te Jul 15, 2020
d46e17b
Upgraded HO Utility Methods
mrWh1te Jul 15, 2020
9c8df1a
Clean Up
mrWh1te Jul 15, 2020
ba67c68
House Cleaning
mrWh1te Jul 16, 2020
c1801ff
Upgraded Botmation Class & main ChainFactory
mrWh1te Jul 16, 2020
64956bd
New BotAction, BotActionFactory, BotActionsPipeFactory
mrWh1te Jul 16, 2020
700ffe7
Removed BotActionsFactory Link
mrWh1te Jul 16, 2020
b5505a6
Dropped Factory Suffix from Function Names
mrWh1te Jul 16, 2020
65f2b3e
Added LocalStorage Support
mrWh1te Jul 16, 2020
6cdfbf9
Missing Return
mrWh1te Jul 16, 2020
ddb18b8
Review WIP
mrWh1te Jul 16, 2020
7f7ed86
Review WIP
mrWh1te Jul 16, 2020
3e6c5ff
Review Progress & Chain/Pipe Interfacing
mrWh1te Jul 16, 2020
4a4bfdb
Stronger Typing
mrWh1te Jul 16, 2020
f0908e2
Review Complete
mrWh1te Jul 16, 2020
3cf9833
Moved Interface to File
mrWh1te Jul 16, 2020
deab6cb
WIP
mrWh1te Jul 16, 2020
bb92b59
Working injects()() via pipe()()
mrWh1te Jul 16, 2020
ecca2ef
Simplified Injects()()
mrWh1te Jul 16, 2020
d9ef6cc
Fixed Issue with BotActionsPipe
mrWh1te Jul 16, 2020
81a5922
Cleaner
mrWh1te Jul 16, 2020
fe8d80a
Safer
mrWh1te Jul 16, 2020
cd3c8ff
Cleaning Up
mrWh1te Jul 17, 2020
b863784
House Cleaning & Stronger Typing
mrWh1te Jul 17, 2020
629d604
Improvements
mrWh1te Jul 17, 2020
2b9eb90
Simplifing & Tightening
mrWh1te Jul 17, 2020
1104655
Polish
mrWh1te Jul 17, 2020
2c57741
Clean Up & Mini Error Logging Improvement
mrWh1te Jul 18, 2020
0ecb90e
Clean Up
mrWh1te Jul 19, 2020
3863eb5
chain()() BotAction
mrWh1te Jul 19, 2020
77676da
pipe()() and injects()() update
mrWh1te Jul 19, 2020
52d3b1d
chain()() fix
mrWh1te Jul 19, 2020
dddc5d2
errors()()
mrWh1te Jul 19, 2020
0035d17
Clean Up
mrWh1te Jul 19, 2020
4744b66
Added errors()() to indexedDBStore()()
mrWh1te Jul 19, 2020
e751dc0
Working
mrWh1te Jul 20, 2020
906cf30
screenshot() + cleaner questions
mrWh1te Jul 20, 2020
549b522
savePDF() & chain()() progress
mrWh1te Jul 20, 2020
2695d1e
Clean Up
mrWh1te Jul 20, 2020
2024098
Working Concept assemblyLine()()
mrWh1te Jul 20, 2020
841c674
Polish pipe()()
mrWh1te Jul 20, 2020
f1e01e0
Action Runners (Assembly Lines) Faster
mrWh1te Jul 20, 2020
c81846a
injects()() now uses assemblyLine()()
mrWh1te Jul 20, 2020
3af6f9e
Fix
mrWh1te Jul 20, 2020
07c06b8
pipeActionOrActions()()
mrWh1te Jul 20, 2020
489bc35
clean Up
mrWh1te Jul 20, 2020
f30f9a0
/factories deprecated -> 100% BotAction's
mrWh1te Jul 20, 2020
3cb7700
Renamed the Runner BotAction's
mrWh1te Jul 20, 2020
6c25e14
Renamed Factories to Assembly Lines
mrWh1te Jul 20, 2020
259aa30
Deep Review Commence
mrWh1te Jul 22, 2020
f0d00d7
Deep Review WIP - interfaces complete
mrWh1te Jul 22, 2020
0cbe2d8
Deep Review WIP - interfaces/types
mrWh1te Jul 22, 2020
a96592b
Deep Review WIP - helpers utilities & pipe
mrWh1te Jul 22, 2020
6bf1464
Deep Review WIP - helpers/pipe
mrWh1te Jul 22, 2020
4321685
Deep Review WIP - helpers / 4 more
mrWh1te Jul 22, 2020
e4dfb5d
Deep Review WIP / helpers/files
mrWh1te Jul 22, 2020
a399088
Deep Review WIP - helpers/files
mrWh1te Jul 22, 2020
26069be
Deep Review WIP - helpers/console
mrWh1te Jul 22, 2020
a621a4b
Deep Review WIP - actions/assembly-lines
mrWh1te Jul 22, 2020
da02f1b
Deep Review WIP - actions/assembly-lines
mrWh1te Jul 22, 2020
0ed68a5
Deep Review WIP - actions/3
mrWh1te Jul 23, 2020
509ffa4
Deep Review WIP - actions/files & indexeddb
mrWh1te Jul 23, 2020
74b080e
Deep Review WIP - actions/injects & input
mrWh1te Jul 23, 2020
e1559f0
Deep Review WIP - actions/3
mrWh1te Jul 23, 2020
927f8d1
Deep Review WIP - actions/navigation
mrWh1te Jul 23, 2020
8aa0a76
Deep Review WIP - actions/pipe
mrWh1te Jul 23, 2020
03be71e
Deep Review WIP - actions/utilities
mrWh1te Jul 23, 2020
7330722
Deep Review WIP - bots/instagram
mrWh1te Jul 23, 2020
3af4bf1
Deep Review WIP - Botmation class
mrWh1te Jul 23, 2020
84f001d
Deep Review WIP - tests
mrWh1te Jul 23, 2020
ec2c50a
Deep Review WIP - tests complete
mrWh1te Jul 23, 2020
5bbe94b
Deep Review Complete - examples
mrWh1te Jul 23, 2020
5251bd9
Review Complete
mrWh1te Jul 23, 2020
1ed364d
Testing - interfaces
mrWh1te Jul 24, 2020
f4b29ce
Testing - helpers/console
mrWh1te Jul 24, 2020
27dea29
Testing - helpers/console complete
mrWh1te Jul 24, 2020
9d7096b
Testing - helpers/files
mrWh1te Jul 24, 2020
4a092f6
Testing - helpers/files
mrWh1te Jul 24, 2020
10ae135
Testing - helpers/indexed-db
mrWh1te Jul 24, 2020
430f726
Testing - helpers/local-storage
mrWh1te Jul 24, 2020
c67996c
Testing - helpers/navigation
mrWh1te Jul 24, 2020
2719845
Testing - helpers/pipe
mrWh1te Jul 24, 2020
25eab6f
Testing - helpers/pipe
mrWh1te Jul 24, 2020
abbb9e1
Testing - helpers/pipe
mrWh1te Jul 24, 2020
2de49c9
Testing - helpers/pipe
mrWh1te Jul 24, 2020
8575dc0
Testing - helpers/pipe
mrWh1te Jul 24, 2020
98faa93
Testing - helpers/pipe
mrWh1te Jul 24, 2020
d3b08f4
Testing - helpers/console
mrWh1te Jul 24, 2020
5314467
Testing - actions/pipe
mrWh1te Jul 24, 2020
ddb68b8
Testing - actions/output
mrWh1te Jul 24, 2020
bbb9557
Testing - actions/navigation
mrWh1te Jul 24, 2020
63b9c57
Testing - actions/navigation
mrWh1te Jul 24, 2020
2c64136
Testing - actions/local-storage
mrWh1te Jul 25, 2020
8547580
Tweak
mrWh1te Jul 25, 2020
d140be7
Tweak
mrWh1te Jul 25, 2020
42722e6
Tweak
mrWh1te Jul 25, 2020
1f17698
Removed new BotAction focus()
mrWh1te Jul 25, 2020
d66c1b6
Testing - actions/injects
mrWh1te Jul 25, 2020
87c8acf
Testing - actions/files
mrWh1te Jul 25, 2020
fada4a3
Testing - actions/errors
mrWh1te Jul 27, 2020
2f8a41a
Testing - actions/console
mrWh1te Jul 27, 2020
f2882e9
Testing - helpers/console
mrWh1te Jul 27, 2020
897d569
Testing - actions/utilities
mrWh1te Jul 27, 2020
28fcf9d
Testing - helpers/files
mrWh1te Jul 27, 2020
47a9cab
Testing - actions/indexed-db
mrWh1te Jul 28, 2020
b89d885
Testing - actions/indexed-db
mrWh1te Jul 28, 2020
ac9fdad
Testing - actions/indexed-db
mrWh1te Jul 28, 2020
215ef13
Testing - types/objects
mrWh1te Jul 28, 2020
ef9a997
Testing - actions/assembly-lines
mrWh1te Jul 28, 2020
2bba059
Testing - actions/assembly-lines
mrWh1te Jul 28, 2020
5257815
Testing - actions/assembly-lines
mrWh1te Jul 29, 2020
b9b9a2a
Testing - actions/assembly-lines
mrWh1te Jul 29, 2020
fec9def
Testing - actions/assembly-lines
mrWh1te Jul 29, 2020
620816d
Testing - actions/assembly-lines
mrWh1te Jul 29, 2020
4c88196
Testing - cleaning up
mrWh1te Jul 29, 2020
394f0fb
Tweaks / Improvements
mrWh1te Jul 29, 2020
29f54d2
Testing - polish
mrWh1te Jul 29, 2020
73378e7
Testing - helpers/indexed-db & class
mrWh1te Jul 29, 2020
012e69f
Testing - helpers/indexed-db & class
mrWh1te Jul 29, 2020
1930bd5
Testing / Polish IndexedDB Actions/Helpers
mrWh1te Jul 29, 2020
fcd00b4
Testing - helpers/indexed-db
mrWh1te Jul 29, 2020
15aaf04
Testing - actions/theories
mrWh1te Jul 29, 2020
9e9871d
House Cleaning
mrWh1te Jul 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ideas
 - having deeper BotAction types like BotFilesAction that specifies
   injects
 - getting rid of param piped from BotAction (see BotAction5), for a
   more specific BotPipeAction that specifies piped value as 1st inject
 - then a BotAction that relies on options or injects but no piped
   values can be written without any mention of
 - downside is the risk of injecting a piped value when used incorrectly
   without some kind of who is guard or branding of these actions to
know when to pipe value or inject injects, etc
mrWh1te committed Jul 12, 2020
commit 24bd7a589ef915d59240d20d6ad5792145461494
101 changes: 101 additions & 0 deletions instagram.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
[
{
"name": "urlgen",
"value": "\"{\\\"2601:285:301:5810:b84b:322f:8386:f95c\\\": 7922}:1jue6A:Gx1V3EZH29QnD818pt6HRwNon7c\"",
"domain": ".instagram.com",
"path": "/",
"expires": -1,
"size": 92,
"httpOnly": true,
"secure": true,
"session": true
},
{
"name": "rur",
"value": "FTW",
"domain": ".instagram.com",
"path": "/",
"expires": -1,
"size": 6,
"httpOnly": true,
"secure": true,
"session": true
},
{
"name": "shbid",
"value": "3870",
"domain": ".instagram.com",
"path": "/",
"expires": 1595173259.318235,
"size": 9,
"httpOnly": true,
"secure": true,
"session": false
},
{
"name": "csrftoken",
"value": "Di6Z3GiZZp4KFu3vmcQ3V833cycle9aN",
"domain": ".instagram.com",
"path": "/",
"expires": 1626018060.051187,
"size": 41,
"httpOnly": false,
"secure": true,
"session": false
},
{
"name": "mid",
"value": "XwsvBwALAAFz64PEo0_QHS4y6fq2",
"domain": ".instagram.com",
"path": "/",
"expires": 1909928453.279484,
"size": 31,
"httpOnly": false,
"secure": true,
"session": false
},
{
"name": "shbts",
"value": "1594568461.5667205",
"domain": ".instagram.com",
"path": "/",
"expires": 1595173259.318258,
"size": 23,
"httpOnly": true,
"secure": true,
"session": false
},
{
"name": "sessionid",
"value": "547623963%3AAW4v2w0acGgFWW%3A15",
"domain": ".instagram.com",
"path": "/",
"expires": 1626104459.046797,
"size": 40,
"httpOnly": true,
"secure": true,
"session": false
},
{
"name": "ds_user_id",
"value": "547623963",
"domain": ".instagram.com",
"path": "/",
"expires": 1602344460.051264,
"size": 19,
"httpOnly": false,
"secure": true,
"session": false
},
{
"name": "ig_did",
"value": "9C71AECB-0956-4C9B-9801-2B698448D906",
"domain": ".instagram.com",
"path": "/",
"expires": 1909928453.279411,
"size": 42,
"httpOnly": true,
"secure": true,
"session": false
}
]
2 changes: 1 addition & 1 deletion src/botmation/actions/console.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BotAction } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'
import { logMessage, logWarning, logError, logPiped } from '../helpers/console'

/**
2 changes: 1 addition & 1 deletion src/botmation/actions/cookies.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { promises as fs } from 'fs'

import { BotAction } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'
import { getFileUrl } from '../helpers/assets'
import { logError } from '../helpers/console'

2 changes: 1 addition & 1 deletion src/botmation/actions/indexed-db.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { openDB } from 'idb'

import { BotAction } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'
import { logMessage } from 'botmation/helpers/console'
import { BotActionsPipeFactory } from 'botmation/factories/bot-actions-pipe.factory'

2 changes: 1 addition & 1 deletion src/botmation/actions/input.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BotAction } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'

/**
* @description Manually left-click an HTML element on the page given the provided HTML selector
2 changes: 1 addition & 1 deletion src/botmation/actions/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DirectNavigationOptions, NavigationOptions } from 'puppeteer'

import { BotAction } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'
import { getDefaultGoToPageOptions } from '../helpers/navigation'
import { logWarning } from '../helpers/console'

9 changes: 5 additions & 4 deletions src/botmation/actions/output.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PDFOptions } from 'puppeteer'

import { BotAction } from "../interfaces/bot-action.interfaces"
import { BotAction, BotAction3, BotFilesAction } from "../interfaces/bot-actions.interfaces"

import { forAll } from './utilities'
import { goTo } from './navigation'
@@ -11,7 +11,8 @@ import { getFileUrl } from '../helpers/assets'
* It relies on `options`, BotOptions, to determine the URL to save the asset in
* @param fileName name of the file to save the PNG as
*/
export const screenshot = (fileName: string): BotAction => async(page, piped, options) => {

export const screenshot = (fileName: string): BotFilesAction => async(page, piped, options) => {
const fileUrl = getFileUrl(options.screenshots_directory, options, fileName) + '.png'

await page.screenshot({path: fileUrl})
@@ -23,7 +24,7 @@ export const screenshot = (fileName: string): BotAction => async(page, piped, op
* @example screenshotAll('https://google.com', 'https://twitter.com')
* @request add ability like via a closure, to customize the filename for easier reuse in a cycle (like ability to timestamp the file etc)
*/
export const screenshotAll = (...urls: string[]): BotAction => async(page, piped, options) =>
export const screenshotAll = (...urls: string[]): BotFilesAction => async(page, piped, options) =>
await forAll(urls)(
(url) => ([
goTo(url),
@@ -37,7 +38,7 @@ export const screenshotAll = (...urls: string[]): BotAction => async(page, piped
* @alpha
* @TODO verify working & add testing
*/
export const savePDF = (fileName: string, pdfOptions: PDFOptions = {}): BotAction => async(page, piped, options) => {
export const savePDF = (fileName: string, pdfOptions: PDFOptions = {}): BotFilesAction => async(page, piped, options) => {
pdfOptions.path = getFileUrl(options.pdfs_directory, options, fileName) + '.pdf'

await page.pdf(pdfOptions)
2 changes: 1 addition & 1 deletion src/botmation/actions/utilities.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
import { sleep } from '../helpers/utilities'

import { applyBotActionOrActions } from '../helpers/actions'
import { BotAction, ConditionalBotAction } from '../interfaces/bot-action.interfaces'
import { BotAction, ConditionalBotAction } from '../interfaces/bot-actions.interfaces'
import { BotActionsChainFactory } from '../factories/bot-actions-chain.factory'
import { BotOptions } from '../interfaces/bot-options.interfaces'

2 changes: 1 addition & 1 deletion src/botmation/bots/instagram/actions/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page } from 'puppeteer'

import { BotAction } from '../../../interfaces/bot-action.interfaces'
import { BotAction } from '../../../interfaces/bot-actions.interfaces'
import { BotActionsChainFactory } from '../../../factories/bot-actions-chain.factory'

import { goTo, waitForNavigation } from '../../../actions/navigation'
2 changes: 1 addition & 1 deletion src/botmation/bots/instagram/actions/feed.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page } from 'puppeteer'

import { BotAction } from '../../../interfaces/bot-action.interfaces'
import { BotAction } from '../../../interfaces/bot-actions.interfaces'
import { forAsLong } from '../../../actions/utilities'

/**
2 changes: 1 addition & 1 deletion src/botmation/bots/instagram/actions/modals.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
*/
import { Page } from 'puppeteer'

import { BotAction } from 'botmation/interfaces/bot-action.interfaces'
import { BotAction } from 'botmation/interfaces/bot-actions.interfaces'

import { TURN_OFF_NOTIFICATIONS_BUTTON_LABEL } from '../constants/modals'

2 changes: 1 addition & 1 deletion src/botmation/bots/instagram/helpers/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Page } from 'puppeteer'

import { BotOptions } from '../../../interfaces/bot-options.interfaces'
import { ConditionalBotAction } from '../../../interfaces/bot-action.interfaces'
import { ConditionalBotAction } from '../../../interfaces/bot-actions.interfaces'

import { BotActionsPipeFactory } from 'botmation/factories/bot-actions-pipe.factory'
import { getIndexDBStoreDataKeyValue } from 'botmation/actions/indexed-db'
2 changes: 1 addition & 1 deletion src/botmation/class.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
import { Page, Browser } from 'puppeteer'

import { BotOptions } from './interfaces/bot-options.interfaces'
import { BotAction } from './interfaces/bot-action.interfaces'
import { BotAction } from './interfaces/bot-actions.interfaces'
import { BotActionsChainFactory } from './factories/bot-actions-chain.factory'
import { BotmationInterface } from './interfaces/botmation.interface'

2 changes: 1 addition & 1 deletion src/botmation/factories/bot-actions-chain.factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page } from 'puppeteer'

import { BotAction } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'
import { BotOptions } from '../interfaces/bot-options.interfaces'
import { getDefaultBotOptions } from '../helpers/bot-options'

5 changes: 3 additions & 2 deletions src/botmation/factories/bot-actions-pipe.factory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Page } from 'puppeteer'

import { BotAction, piped } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'
import { BotOptions } from '../interfaces/bot-options.interfaces'
import { Piped } from '../types/piped'
import { getDefaultBotOptions } from '../helpers/bot-options'

/**
@@ -14,7 +15,7 @@ import { getDefaultBotOptions } from '../helpers/bot-options'
* @param page Puppeteer.Page
*/
export const BotActionsPipeFactory =
<R = undefined, P = undefined>(page: Page, piped?: piped<P>, overloadOptions: Partial<BotOptions> = {}, ...injects: any[]) =>
<R = undefined, P = undefined>(page: Page, piped?: Piped<P>, overloadOptions: Partial<BotOptions> = {}, ...injects: any[]) =>
async (...actions: BotAction<any, any>[]): Promise<R> => {
let piped = undefined

2 changes: 1 addition & 1 deletion src/botmation/factories/bot-actions.factory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page } from 'puppeteer'

import { BotAction } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'
import { BotOptions } from '../interfaces/bot-options.interfaces'
import { getDefaultBotOptions } from '../helpers/bot-options'

2 changes: 1 addition & 1 deletion src/botmation/helpers/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page } from 'puppeteer'

import { BotAction } from '../interfaces/bot-action.interfaces'
import { BotAction } from '../interfaces/bot-actions.interfaces'
import { BotActionsChainFactory } from '../factories/bot-actions-chain.factory'
import { BotOptions } from '../interfaces/bot-options.interfaces'

14 changes: 7 additions & 7 deletions src/botmation/helpers/assets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BotOptions } from "botmation/interfaces/bot-options.interfaces"
import { BotFilesConfig } from "botmation/interfaces/bot-options.interfaces"

mrWh1te marked this conversation as resolved.
Show resolved Hide resolved
/**
* @description See unit tests for edge-case examples
@@ -12,20 +12,20 @@ export const createFolderURL = (...folderNames: string[]): string =>

/**
* @description See unit tests for edge-case examples
* When it comes to storing newly created assets, we depend on the values of BotOptions in knowing where to store the assets
* When it comes to storing newly created assets, we depend on the values of BotFileOptions in knowing where to store the assets
* @param fileDirectory what are we creating? screenshots, cookies, etc
* @param botOptions pass this in so we can create the URL
* @param botFileOptions pass this in so we can create the URL
* @param fileName
*/
export const getFileUrl = (fileDirectory: string, botOptions: BotOptions, fileName: string = ''): string => {
export const getFileUrl = (fileDirectory: string, filesConfig: BotFilesConfig, fileName: string = ''): string => {
const fileNameWithPrefix = fileName === '' ? '' : '/' + fileName // prefix with folder (optional)

if (botOptions?.parent_output_directory) {
if (filesConfig?.parent_output_directory) {
if (fileDirectory) {
return createFolderURL(botOptions.parent_output_directory, fileDirectory) + fileNameWithPrefix
return createFolderURL(filesConfig.parent_output_directory, fileDirectory) + fileNameWithPrefix
}

return createFolderURL(botOptions.parent_output_directory) + fileNameWithPrefix
return createFolderURL(filesConfig.parent_output_directory) + fileNameWithPrefix
}

if (fileDirectory) {
45 changes: 0 additions & 45 deletions src/botmation/interfaces/bot-action.interfaces.ts

This file was deleted.

Loading