Sylvain Duchesne 259d7fe58d Settle what interchangeability means, and ask for what is missing
Opens the brief that holds this binding to `@activitypods/refine-providers`,
with which it must be interchangeable, and settles its six questions. The
decisive finding of the comparison: the reference asks its server for almost
none of what a Refine resource needs — filters, sorting, pagination and
totals are computed in memory there too — so most of the gap is this
package's own work rather than the polyfill's.

What the engagement is now asked for, in order: a shape-typed write and
removal that can be awaited outside React, a call that closes a session, a
display name, and a write-ownership predicate that would let an interface
hide a control instead of letting it fail.

Two corrections worth their own mention, both found by review rather than
by reading further:

- a non-guarantee about how strongly the upstream authenticates was being
  allowed to dictate the SHAPE of this binding, which had `login` and
  `logout` published as having no surface. Opening a wallet is the act the
  target will have, so the auth provider is wired to it and the missing
  closing call is a request, not an absence of analogue;
- what is internal to the emulation must not be known in this repository at
  all. Restating it here would duplicate a claim this package cannot verify
  and would teach an application a distinction that disappears at migration.
2026-10-01 19:54:45 +02:00
2026-08-07 17:46:31 +02:00
2026-08-07 19:01:07 +03:00
2026-07-10 11:45:54 +02:00
2026-07-10 11:45:54 +02:00

Refine providers for NextGraph

Data, auth and live providers that can be used in any Refine application.

Usage

For a quick overview, have a look at our example app.

Refine relies on the concept of "resources" (which are data types) to manage your application in a structured way. On the other side, NextGraph identifies data types using ShEx shapes which are transformed into "shape types" using its own tool. So naturally our data provider needs to receive a list of shape types in order to identify resources.

1. Define your shapes

Create a /shapes directory and, within it, two subdirectories: /shex and /orm

Within the /shapes/shex directory, create a ShEx file with the shape of the data you want to handle.

Here's an example of a shape for an ActivityStreams Note, saved under the note.shex filename:

PREFIX as: <https://www.w3.org/ns/activitystreams#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

as:Note {
  a [as:Note] ;
  as:title xsd:string ;
  as:content xsd:string ? ;
}

2. Pass the shape types to the data provider

Go to the /shapes directory and run the following command:

npx rdf-orm build --input ./shex --output ./orm

If you created a note.shex file, this will generate three files in the /orm subdirectory:

  • note.schema.ts
  • note.shapeTypes.ts
  • note.typings.ts

Now within the shapes directory, create a shapeTypes.ts like this:

import { ShapeTypes } from "@ng-eventually/refine-providers";
import { NoteShapeType } from "./orm/note.shapeTypes";

const shapeTypes : ShapeTypes = {
  notes: NoteShapeType
}

export default shapeTypes;

3. Configure the providers

Add the providers to Refine. The live provider is optional, but it will allow you to sync data if several users are working on the same data. See the example app for how to handle this correctly in the edit and view pages.

import { authProvider, dataProvider, liveProvider } from "@ng-eventually/refine-providers";
import shapeTypes from "./shapes/shapeTypes";

const ngAuthProvider = authProvider();
const ngDataProvider = dataProvider({ shapeTypes, authProvider: ngAuthProvider })
const ngLiveProvider = liveProvider({ shapeTypes })

const App = () => (
  <Refine
    authProvider={ngAuthProvider}
    dataProvider={ngDataProvider}
    liveProvider={ngLiveProvider}
    options={{ liveMode: "auto", ... }}
    ...
  >
  ...

4. Create the React pages

You can now call the various hooks provided by Refine to create, read, update or delete resources.

For useForm, useTable, useShow, you can pass the Note generated by NextGraph CLI.

Here's an example of a simple list view:

import { List, useTable } from "@refinedev/antd";
import { Table } from "antd";
import { Note } from "./shapes/orm/notes.typings";

export const PostList = () => {
  const { tableProps } = useTable<Note>();
  return (
    <List>
      <Table {...tableProps} owKey="@graph">
        <Table.Column dataIndex="@graph" title="ID" />
        <Table.Column dataIndex="title" title="Title" />
        <Table.Column dataIndex="content" title="Content" />
      </Table>
    </List>
  );
};

Commands

pnpm build
pnpm watch
pnpm publish
S
Description
No description provided
Readme 263 KiB
Languages
TypeScript 100%