UNPKG

@cubicweb/data-provider

Version:

CubicWeb data provider implementation

65 lines (45 loc) 1.9 kB
# @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](https://marmelab.com/react-admin/DataProviders.html#the-data-provider) to learn how this interface works. ## Installation @cubicweb/data-provider is available from NPM: ```bash # With NPM npm i @cubicweb/client # Or with Yarn 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`. ```js import {Client, Schema} from "@cubicweb/client" import {createDataProvider} from "@cubicweb/data-provider" // First create your schema import jsonSchema from "./schema.json" const schema = new Schema(jsonSchema); // Then your client const client = new Client(BASE_URL) // Use those to generate your data provider 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](https://forge.extranet.logilab.fr/cubicweb/cubicwebjs). Please refer to the main README. ## Get Help Contact us on [Matrix](https://matrix.to/#/#cubicweb:matrix.logilab.org) and check the roadmap on the [CubicWeb Repository](https://forge.extranet.logilab.fr/cubicweb/cubicweb).