Data middleware and resource#672
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit cba69a8:
|
| }); | ||
| afterEach(() => { | ||
| resolvers.restore(); | ||
| sb.resetHistory(); |
There was a problem hiding this comment.
do we use this abbreviation elsewhere? sb?
adedc32 to
4595172
Compare
This reverts commit 2e41c1b.
939a586 to
8f683d7
Compare
|
For APIs that do not provide a Additionally it would be beneficial if the data api could be used without providing pagination details, for example if a user wants to return a single resource. Here is an implementation of the HNPWA using data/resources that demonstrates these two scenarios https://github.com/agubler/dojo-resource-hnpwa The resources are defined in |

Type: bug / feature
The following has been addressed in the PR:
prettieras per the readme code style guidelinesDescription:
Adds a data middleware capable of making widgets data aware and able to deal with a resource.
resourcewill be added to the widget's properties. This can be used to pass a resource to be interacted with.createDataMiddlewarefunction which takes a generic to determine the type of data the widget requires, this adds atransformfunction to the widget properties which uses the generic to ensure the correct data type is supplied.Data middleware API interface:
ResourceOptionsare made up of:When a widget using the middleware is destroyed, the middleware will disconnect from the resource.
The Resource will need to provide the following API
Both API
Will work in future with resources.
Resolves #660
Codesandbox of it in use with dummy resource: https://codesandbox.io/s/hardcore-swartz-kezpc