cloudfoundry / cloudfoundry/stratos
Entity Catalogue - Allow endpoints and actions to provide action pipelines
@nwmac is already working on this.
Since Jan 8, 2020.
- Dominant language
- TypeScript
- Stars
- 267
- Forks
- 137
- Avg merge
- 5h 14m
- Merged PRs (30d)
- 77
Description
Action Pipelines
At the moment most api requests go via the api effect and all the validation that comes with it. A lot of the code within the validation loop is only applicable to cloud foundry entities. We should simplify the current api effect down to it's mots basic function api action called -> api request made -> a simple complete or failure action is called. This basic pipeline can be split up into phases:
Phase 0 - trigger phase: Api action is called triggering a pipeline.
Phase 1: Api request.
Phase 2: Build and call complete or failure action.
Once we have the basic phases we can describe our base pipeline in code:
defaultPipeline: [
makeApiRequest,
completeOrFailRequest
]
We should then create another pipeline just for the cloud foundry validation:
cloudFoundryPipeline: [
makeApiRequest,
validateCloudFoundryEntities,
completeOrFailRequest
]
or make it simpler by allowing entities to omit the default pipeline
cloudFoundryPipelineConfig: {
includeDefaultPipeline: true,
pipeline: [
validateCloudFoundryEntities
]
}
which would be the same as:
cloudFoundryPipelineConfig: {
includeDefaultPipeline: false,
pipeline: [
makeApiRequest,
validateCloudFoundryEntities,
completeOrFailRequest
]
}
Where would we register pipelines?
My first thought would be to register a number of pipelines to the endpoint type. The endpoint could have a default pipeline that all actions of this type would go through my default. Each action (see #3625) could then override the pipeline by providing a key to a registered pipeline for the endpoint type (or a pipeline config?). If no default is provided by the endpoint and no override is provided by the action then the stratos default pipeline would be used.
It's worth noting that we should allow for pipelines that don't make network requests, that might be useful for internal actions.
We should look at using the @ngrx/store compose function to build pipelines.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.