dojo / framework

Dojo Framework. A Progressive Framework for Modern Web Apps
https://dojo.io/
Other
586 stars 79 forks source link

Support for custom resource APIs #878

Closed agubler closed 3 years ago

agubler commented 3 years ago

Type: feature

The following has been addressed in the PR:

Description:

Extends dojo resources to support defining and providing custom APIs in a resource template. With additional support for updating/creating data within a resource.

Creating a template with a custom API

const template = createResourceTemplate<Data, { save: (item: Data) => void }>({
    idKey: 'id',
    save: (item, controls) => {
        controls.push([item]);
    }
});

Create resource middleware that defines a custom API

const resource = createResourceMiddleware<Data, { save: (item: Data) => void }>()
codesandbox-ci[bot] commented 3 years ago

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 87773078d2940296efabf988cb6a65030aa34744:

Sandbox Source
dojo/dojo-codesandbox-template Configuration
codecov[bot] commented 3 years ago

Codecov Report

Merging #878 (f50fff3) into master (820d3bc) will decrease coverage by 0.12%. The diff coverage is 91.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #878      +/-   ##
==========================================
- Coverage   94.58%   94.46%   -0.13%     
==========================================
  Files         127      127              
  Lines        7959     7999      +40     
  Branches     1859     1871      +12     
==========================================
+ Hits         7528     7556      +28     
- Misses        431      443      +12     
Impacted Files Coverage Δ
src/testing/renderer.ts 97.32% <ø> (ø)
src/core/middleware/resources.ts 94.36% <91.89%> (-2.93%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 820d3bc...8777307. Read the comment docs.