Commit Graph

803 Commits

Author SHA1 Message Date
FoxxMD
e7fbd9baaf fix: Fix how general errors are transformed into errors with cause 2022-03-28 12:48:45 -04:00
FoxxMD
065014dc10 feat(ui): Implement finding actioned events by permalink 2022-03-25 15:07:40 -04:00
FoxxMD
ed13840881 feat(ui): Implement pagination for actioned events 2022-03-25 14:04:47 -04:00
FoxxMD
5c83d457f5 fix(database): Fix getting author name from snoowrap object for storing activity 2022-03-25 14:01:12 -04:00
FoxxMD
12daba0161 fix(dispatch): Fix including too many properties in dispatch data
Using spread was including client/logger/etc. which can't be serialized
2022-03-25 14:00:48 -04:00
FoxxMD
ebf7c00849 fix(filter): Fix queuedAt timestamp for re-hydrated delay activities 2022-03-25 13:59:47 -04:00
FoxxMD
1dd9090088 fix(filter): Include source in criteria for stored result, if source is used
* Only for *stored* result so that cached results don't include source
2022-03-25 13:59:20 -04:00
FoxxMD
dc2c35f822 refactor(ui): Finish fixing formatting for actioned events 2022-03-25 12:27:59 -04:00
FoxxMD
d916ccfb6e fix: Fix formatting for filter summaries
* Determine what actual crit object is based on object shape (could be from app or api)
* Initialize filters are undefined so they overwrite null values from api when transforming for ui
2022-03-25 11:56:02 -04:00
FoxxMD
5a10cf0f4d fix(database): Revert filter criteria to using hash-based id instead of random
* Accidentally changed this to random. Oops.
* Needed to move author crit result into same file as base class to fix a circular dependency issue
2022-03-25 11:54:39 -04:00
FoxxMD
323833ebb6 refactor(ui): Transform db response data into old actioned event interface for ui consumption
For now just structure it the same so the ui doesn't need to be refactored as well
2022-03-25 11:42:29 -04:00
FoxxMD
ed234baf76 refactor(events): Replace boilerplate filter joins with function builder 2022-03-25 11:41:28 -04:00
FoxxMD
5a7738b5b2 feat(database): Implement event pagination 2022-03-24 16:08:45 -04:00
FoxxMD
66a63b1a74 feat(database): Implement basic, all-time historical stat tracking in database
* Simplify/refactor stats to only track all-time in database...
  * remove "last reload" stats from app and ui
  * simplify tracked stats to counts only (no maps-of-types counts)
* Add migration function in stat init to convert any all-time stats in cache to database, when database is empty
2022-03-24 14:39:50 -04:00
FoxxMD
fc3479fb8a refactor(database): Update typeorm/dependencies and fix naming strategy
* Use updated logger adapter so that typeorm can be updated
* Update to typeorm 0.3.3
* Refactor naming strategy to be what i want it to be
2022-03-24 12:44:49 -04:00
FoxxMD
b5557335dc feat(database): Add indexes for unique data 2022-03-24 11:42:33 -04:00
FoxxMD
9b5111aabf feat(database): Implement activity source data structure
* Implement a generic activity source to track where an event was retrieved from and some initial parameters
* Consolidate dispatch action data into generic source
* Refactor delayUtil logic for event handling to prevent blocking worker for a non-trivial amount of time by dispatching event
2022-03-24 11:20:52 -04:00
FoxxMD
37f6878d54 feat(database): Implement dispatched action persistence
Add 'tardyTolerant' option to dispatch action config so user can determine if an action should still run if its pasts its dispatch date
2022-03-23 17:04:48 -04:00
FoxxMD
5edc116b13 refactor(database): Refactor createdAt implementation for more accuracy
* Implement own createdAt functionality using hooks and dayjs so we can use unix timestamp to eliminate TZ ambiguity and increase granularity to milliseconds
* hook insert/load to convert timestamp between dayjs and int
* Set value on class instantiation rather than object save to preserve actual creation time
2022-03-23 15:22:59 -04:00
FoxxMD
6c8bbdff1f feat(database): Make all non-updateable entities have random, friendly ids
* Replace any incremented, generated number id with a random id from nanoid
* Replace UUID with random id from nanoid
2022-03-23 14:48:17 -04:00
FoxxMD
1dde56c208 refactor(database): Add relations map for actioned event function
* And add event order by createdAt
2022-03-23 14:19:45 -04:00
FoxxMD
aba3989063 refactor(database): Drop support for mongodb
* CM data is highly relational so it doesn't make sense to support both rdbms and document dbs
* repository usage is different for mongo, not supporting both
2022-03-23 13:54:31 -04:00
FoxxMD
5c6a797703 refactor(database): Include reddit fullname and short identifier in activity entity for database
* Use setter/getter to parse id/name to make it easier to use fullname or short id interchangeably
* rename title to content to reflect property usage better
2022-03-23 13:32:06 -04:00
FoxxMD
5a236400f0 feat(database): Implement action results persisting to event 2022-03-23 13:00:21 -04:00
FoxxMD
21efc3024d fix(run): Fix triggered result for run to use actual run result entity 2022-03-23 12:59:54 -04:00
FoxxMD
b2d0403150 refactor(action): Move logic for touched entities for recent self into action to simplify 2022-03-23 12:59:12 -04:00
FoxxMD
298239039d refactor: Move common properties for runnable components (action,rule,check,run) into a base class
* DRY
* Add runFilters function to class
2022-03-23 12:10:09 -04:00
FoxxMD
8c33e44e3c fix(database): Fix duplicated filter criteria
* Refactor/remove Author class and replace with function (was unnecessary class)
* Workaround fix for composite key on filter criteria entity
2022-03-23 11:20:25 -04:00
FoxxMD
a16d0ad0f0 refactor(database): Remove unnecessary insert cascades
Relations for entities that are already persisted and should not be duplicated
2022-03-23 09:42:32 -04:00
FoxxMD
5971ef7565 refactor(database): Partially working implementation for actioned event using database
* Reworked many mappings to fix cascades and relationships
* Add constructors to entities where useful
* Renamed many db entities classes to be different than interface names
* Re-generated initial migration and added convenience npm script for running it
* Added ormconfig for typeorm 3 cli
* Create all run/check/rule/action premises (static info) on manager creation
2022-03-22 15:07:38 -04:00
FoxxMD
b62f7f7bb5 refactor: Move RuleResult interface and associated structures into interfaces common file 2022-03-22 09:01:06 -04:00
FoxxMD
b137e8682b feat(database): Implement action/action premise database creation
* Refactor init migration to fix mappings
* Implement initialization method for actions to hydrate their action/premise entities
2022-03-21 16:19:08 -04:00
FoxxMD
f19ac19b27 feat(database): Implement rule/rule premise database creation
* Add second migration script for adding initial rule types
* Implement initialization method for rules to hydrate their rule/premise entities
2022-03-21 15:59:52 -04:00
FoxxMD
e667c29da2 feat(database): Begin database entity creation and association on startup
* Create/find bot entity
* Create/find subreddit entities for each manager
* Create/find manager entities
* Pass bot/manager entities to Manager and SubredditResources
2022-03-18 15:37:38 -04:00
FoxxMD
bced882c75 refactor(db): Update typeorm to 0.3.0 2022-03-18 15:34:55 -04:00
FoxxMD
8c738ecd49 refactor(database): More entity mapping updates and migration refresh 2022-03-18 15:34:34 -04:00
FoxxMD
828f4cf676 fix(database): Fix db paths and logging options 2022-03-18 15:33:02 -04:00
FoxxMD
c70254061a fix(contributor): Update db-branch specific changes to support new contributor action 2022-03-18 15:31:36 -04:00
FoxxMD
8ce19a61f5 Merge branch 'edge' into databaseSupport
# Conflicts:
#	src/Action/index.ts
2022-03-18 12:14:12 -04:00
FoxxMD
b01e2a98f9 feat(contributor): Implement subreddit contributor functionality
* Add action to add/remove subreddit contributor
* Add 'isContributor' author criteria
* Use cache to store subreddit contributors
2022-03-18 11:38:04 -04:00
FoxxMD
b2a6ae440e fix(schema): Update schema to include new snoowrap options 2022-03-18 10:19:38 -04:00
FoxxMD
b61f99355f refactor(action): Add premise to action results 2022-03-17 14:18:47 -04:00
FoxxMD
b7f78f5eb1 refactor(database): New entities and init migration for database 2022-03-17 14:04:47 -04:00
FoxxMD
b561fa6b3c refactor(database): Partial conflict resolution with edge
Still need to refactor interfaces/code related to storing actioned events
2022-03-17 10:00:21 -04:00
FoxxMD
d82032073b Merge branch 'edge' into databaseSupport
# Conflicts:
#	package-lock.json
#	package.json
#	src/App.ts
#	src/Common/interfaces.ts
#	src/ConfigBuilder.ts
#	src/Subreddit/Manager.ts
#	src/Subreddit/SubredditResources.ts
#	src/Utils/loggerFactory.ts
#	src/Web/Client/index.ts
#	src/Web/Server/server.ts
#	src/Web/assets/views/events.ejs
#	src/index.ts
#	src/util.ts
2022-03-17 09:41:54 -04:00
FoxxMD
935d983626 feat(client): Implement snoowrap retry on timeout errors
Makes CM less sensitive to random blips in reddit API by enabling snoowrap to retry some network-issue related error codes alongside status codes

* Add timeoutCodes as an operator configurable array of error codes that is passed to extended snoowrap
* Patch snoowrap to check for timeout codes on request error and use retry logic if found
* Additionally, add retryErrorCodes (status codes) to operator configuration
2022-03-16 12:31:04 -04:00
FoxxMD
f6fb0dc877 docs: Add development instructions for mocking reddit api network issues 2022-03-16 12:02:30 -04:00
FoxxMD
3dd16bba79 fix(config): Fix snoowrap options not being passed to bot 2022-03-16 12:01:03 -04:00
FoxxMD
c46fe6f128 feat(dispatch): Add cancel action in ui for delayed actions 2022-03-14 12:06:43 -04:00
FoxxMD
074c3c7340 fix(migrations): Escape prefix value before parsing to regex 2022-03-11 15:25:12 -05:00