@jsbrain/refine-directus
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

codecov build npm version

Directus dataprovider package for refine.

About

refine offers lots of out-of-the box functionality for rapid development, without compromising extreme customizability. Use-cases include, but are not limited to admin panels, B2B applications and dashboards.

A big thanks to Directus for providing the API and js SDK and to @tspvivek for the initial implementation of the package.

Documentation

For more detailed information and usage, refer to the refine data provider documentation. see below notes for more information.

Install

npm install @workatease/refine-directus

Example

Use below login details in example
username: demo@demo.com
password: 123456
url: https://refine.dev/docs/examples/data-provider/directus/

Notes

To enable perform archive instead of delete with DeleteButton pass metaData={softDelete:true,field:value} in DeleteButton if no field is passed then default status field will be used and set to archived example:

<DeleteButton
    hideText
    size="small"
    recordItemId={record.id}
    metaData={{ softDelete: true }}
/>

<DeleteButton
    hideText
    size="small"
    recordItemId={record.id}
    metaData={{ softDelete: true, isDeleted: "true" }}
/>

usage

App.tsx

 import { Directus, authProvider,dataProvider } from '@workatease/refine-directus';
 function App() {
 const directus = new Directus<MyCollections>("https://url");

 return (
  <Refine 
   routerProvider={routerProvider}
   dataProvider={dataProvider(directus)}
   authProvider={authProvider(directus)}  // optional - can use your own auth provider
   ...
 />
 );
 }

Tests

All Tests are run against the latest version of Directus Cloud.

difference From the actual Library

  • Removing hardcoded filter from the data provider for flexibility if status field is not present in the table status: { _neq: 'archived' }
  • or Query support added to the data provider
  • soft delete parameter changed and added support to add custom field for soft delete

TODO

  • make changes packages JSON file package name change
  • update directus sdk to latest version
  • add auth provider
  • add upload utils without react dependency
  • add live provider with help of extension in directus 9 link
  • update examples files
  • automate integration with directus server

Changesets

1.0.10

  • Added rnd value to the url to avoid caching issue

1.0.9

  • update library version
    • "@directus/sdk": "^10.1.4"
    • "@pankod/refine-core": "3.69.0"
  • now support filter startwith, endswith, nstartswith, nendswith

1.0.8

  • Data provider will support soft delete with metaData={softDelete:true,field:value} in DeleteButton
  • Default AuthProvider added to the package

Package Sidebar

Install

npm i @jsbrain/refine-directus

Weekly Downloads

0

Version

1.0.11

License

MIT

Unpacked Size

271 kB

Total Files

14

Last publish

Collaborators

  • jsbrain