Commit Graph

59 Commits

Author SHA1 Message Date
Jan Jakes
d9c47a40f2 Add permissions to manage automations
[MAILPOET-4287]
2022-05-19 10:09:05 +02:00
Jan Jakes
3660d12dd0 Return workflow list data in workflows endpoint
[MAILPOET-4287]
2022-05-19 10:09:05 +02:00
Jan Jakes
47c5111996 Add method to fetch list of workflows to workflow storage
[MAILPOET-4287]
2022-05-19 10:09:05 +02:00
Jan Jakes
1b46765f47 Fix workflow date loading
[MAILPOET-4287]
2022-05-19 10:09:05 +02:00
Jan Jakes
adf6dd3ce9 Add schema for workflow post endpoint
[MAILPOET-4207]
2022-04-20 15:30:50 +02:00
Jan Jakes
29df2dddb6 Sanitize unknown params
[MAILPOET-4207]
2022-04-20 15:30:50 +02:00
Jan Jakes
679f2200bd Rename endpoint "factory" to a more exact "container"
[MAILPOET-4207]
2022-04-20 15:30:50 +02:00
Jan Jakes
c5ff597267 Add the possibility to specify request schema
[MAILPOET-4207]
2022-04-20 15:30:50 +02:00
Jan Jakes
a06a8af0d5 Use WP-native params to support all REST API request formats
[MAILPOET-4207]
2022-04-20 15:30:50 +02:00
Jan Jakes
6b1c6929d1 Migrate existing endpoints to the new structure
[MAILPOET-4207]
2022-04-20 15:30:50 +02:00
Jan Jakes
f7888480b4 Make API endpoint a simple single-action class
[MAILPOET-4207]
2022-04-20 15:30:50 +02:00
John Oleksowicz
da144a3778 Include all possibilities for validation
Although not required at the moment, validation could certainly involve
the current step as well as the workflow itself.

[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
John Oleksowicz
cbabaf9e4e Idiomatic way of specifying mixed return type
[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
John Oleksowicz
c5065c0d8d Remove unnecessary abstract class
[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
John Oleksowicz
5227481a42 Revert to a simpler approach
Having separate objects for validation results is unnecessary and overly
 complicated at this point, and we should wait to introduce that kind of
  complexity only when/if it's clearly needed.

[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
John Oleksowicz
954b23d151 State-independent validation
We need to be able to validate an action in a workflow in the UI,
outside the context of a specific workflow run, so the validation can't
check things like the specific entities loaded in a subject.

[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
John Oleksowicz
2cce9bf7ad An idea for splitting validation and running
[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
John Oleksowicz
b2f2f2665c Add getValue method to Field
[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
John Oleksowicz
69b523171f Initial stab at a welcome email action
[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
John Oleksowicz
9e4303e6f6 Fix updatedAt assignment
[MAILPOET-4191]
2022-04-18 09:10:23 +02:00
David Remer
53fc49d1eb Simplify phpcs:disable comments
Additionally this commit contains a conversion from %d to %s in a query

[MAILPOET-4219]
2022-04-04 17:12:33 +02:00
David Remer
cb55cae1b2 Escape SQL queries following wp org sniffs
[MAILPOET-4129]
2022-04-04 17:12:33 +02:00
Jan Jakes
efdca49f2e Use LIKE escaping from $wpdb
[MAILPOET-4055]
2022-03-14 09:36:21 +01:00
Jan Jakes
686e046c40 Fix trigger_key column type
[MAILPOET-4055]
2022-03-14 09:36:21 +01:00
Jan Jakes
952696fe42 Check for workflow run status in workflow runner
[MAILPOET-4055]
2022-03-14 09:36:21 +01:00
Jan Jakes
f443992f81 Mark workflow runs with errors as failed
[MAILPOET-4055]
2022-03-14 09:36:21 +01:00
Jan Jakes
0d990e1b18 Clean Action Scheduler data in automation migrator reset
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
3a22521a55 Add json encode/decode wrapper class
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
fc16bacadc Add "core" automation integration & implement wait action
The "core" integration will provide triggers, actions, and subjects
that are not specific to any 3rd party integration.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
716050b7de Save subject data in workflow runs
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
50b889a1bd Add workflow data subject & field interfaces
A subject contains multiple fields. Each field has a type and they
can be filtered and used later on.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
d9d7df0b84 Add column for workflow data subjects
Data subjects will carry the data through a workflow.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
b62bc21849 Enqueue next step or complete workflow in step runner
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
ac04ade359 Implement action step runner
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
a7cd2b74b4 Fetch workflow, workflow run, and step in workflow step runner
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
66eaf555b5 Catch all errors in step runner
Action Scheduler handles only exceptions, not other errors.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
0c8c86c0a8 Add basic workflow step runner service
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
4a8f37172a Enqueue next workflow step in trigger handler
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
6d040571aa Add simple Action Scheduler wrapper service
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
e4b09ab6de Create new workflow run in trigger handler
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
b88e310f7e Add storage service for workflow runs & create workflow run method
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
a191c691f5 Add hook and basic handler for automation triggers
For now trigger keys are stored in the workflow as a JSON array.
This is not optimal in case someone has many workflows but as
workflows are user-created it's unlinkely someone will have thousands
of them. We can consider adding a workflow_triggers table as well.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
933ee0c8c8 Call "registerHooks" method for all triggers of all active workflows
This is needed so the triggers actually work – their hooks need to be
registered when the triggers are in some active workflows.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
55a25427fc Add initialize hook to register automation integrations
Those need to be registered after Automation engine is initialized.

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
634cd11af9 Add automation integration interface
An integration is a set of triggers, actions, subjects, etc.
(E.g. "MailPoet integration".)

[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
db21cfa8a5 Add registry service for workflow triggers and actions
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
c97476e8c3 Add controller to create workflows via REST API
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
41cb2c4034 Add storage service for workflows & create workflow method
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
97ad4cffb5 Add interface for workflow actions
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00
Jan Jakes
ee6cdeceab Add interface for workflow triggers
[MAILPOET-4136]
2022-03-14 09:36:21 +01:00