@cubicweb/data-provider
Originally made for react-admin, this package
provides a set of utility functions to handle entities
with the API.
It allows to generate RQL requests to get, update and
create entities and send those requests to the API
using @cubicweb/client. See react-admin documentation
to learn how this interface works.
Installation
@cubicweb/data-provider is available from NPM:
npm i @cubicweb/client
yarn add @cubicweb/client
Usage
This library exposes the createDataProvider
function
to create a new data provider using a specific schema and client
from @cubicweb/client
.
import {Client, Schema} from "@cubicweb/client"
import {createDataProvider} from "@cubicweb/data-provider"
import jsonSchema from "./schema.json"
const schema = new Schema(jsonSchema);
const client = new Client(BASE_URL)
const dataProvider = createDataProvider(client, schema)
Future of this package
Please note we are trying to move away from this interface.
While it works for react-admin, the interface is
too restrictive for more complex CubicWeb applications.
We are planning on releasing similar helper functions
in another package without restrictions imposed by
react-admin's data-provider interface.
This data provider will then use those helper functions
se we can still use react-admin with CubicWeb.
Contribute
All @cubicweb
libraries are in the cubicwebjs monorepo.
Please refer to the main README.
Get Help
Contact us on Matrix and check the roadmap on the CubicWeb Repository.