Improve doc

This commit is contained in:
srosset81
2026-08-07 16:48:24 +02:00
parent 7a4b15f894
commit 6ac2995b99
4 changed files with 14 additions and 21 deletions
+7 -2
View File
@@ -6,7 +6,7 @@ Data, auth and live providers that can be used in any [Refine](https://refine.de
> For a quick overview, have a look at our [example app](./examples/antd-app/). > For a quick overview, have a look at our [example app](./examples/antd-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](https://shex.io/) which are transformed into "shape types" using [its own tool](https://docs.nextgraph.org/en/reference/shex-orm/). So naturally our data provider needs to receive a list of shape types in order to identify resources. 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](https://shex.io/) which are transformed into "shape types" using [its own tool](https://docs.nextgraph.org/en/reference/shex-orm/). So naturally our data provider needs to receive a list of shape types in order to identify resources.
### 1. Define your shapes ### 1. Define your shapes
@@ -54,7 +54,11 @@ const shapeTypes : ShapeTypes = {
export default shapeTypes; export default shapeTypes;
``` ```
### 3. Add the providers to Refine ### 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.
```tsx ```tsx
import { authProvider, dataProvider, liveProvider } from "@ng-org/refine-providers"; import { authProvider, dataProvider, liveProvider } from "@ng-org/refine-providers";
@@ -107,4 +111,5 @@ export const PostList = () => {
```bash ```bash
pnpm build pnpm build
pnpm watch pnpm watch
pnpm publish
``` ```
+2 -15
View File
@@ -5,11 +5,7 @@
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using refine" /> <meta name="description" content="Web site created using Refine" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" /> <link rel="manifest" href="/manifest.json" />
<title>refine authentication example</title> <title>refine authentication example</title>
</head> </head>
@@ -17,14 +13,5 @@
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/src/index.tsx"></script> <script type="module" src="/src/index.tsx"></script>
<!-- </body>
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm run dev` or `yarn dev`.
To create a production bundle, use `npm run build` or `yarn build`.
--></body>
</html> </html>
+2 -3
View File
@@ -1,8 +1,7 @@
export { default as authProvider } from "./auth-provider";
export * from "./auth-provider";
export { default as dataProvider } from "./data-provider"; export { default as dataProvider } from "./data-provider";
export { default as liveProvider } from "./live-provider"; export { default as liveProvider } from "./live-provider";
export { default as authProvider } from "./auth-provider";
export * from "./auth-provider";
export * from "./types"; export * from "./types";
export * from "./utils"; export * from "./utils";
+3 -1
View File
@@ -1,8 +1,9 @@
import { BaseKey } from "@refinedev/core"; import { BaseKey } from "@refinedev/core";
import { RdfOrmSubscription } from "@ng-org/orm"; import { RdfOrmSubscription } from "@ng-org/orm";
import type { ShapeType } from "@ng-org/shex-orm"; import { ShapeType } from "@ng-org/shex-orm";
import { DeepSignalSet, DeepPatch } from "@ng-org/alien-deepsignals" import { DeepSignalSet, DeepPatch } from "@ng-org/alien-deepsignals"
// Helper function to retrieve the signal object and eventually close the subscription
export const getSignalObject = async (shapeType: ShapeType<any>, ids?: string[], closeSubscription: boolean = true) : Promise<DeepSignalSet<any>> => { export const getSignalObject = async (shapeType: ShapeType<any>, ids?: string[], closeSubscription: boolean = true) : Promise<DeepSignalSet<any>> => {
const subscription = RdfOrmSubscription.getOrCreate(shapeType, { graphs: ids || [''] }); const subscription = RdfOrmSubscription.getOrCreate(shapeType, { graphs: ids || [''] });
await subscription.readyPromise; await subscription.readyPromise;
@@ -16,6 +17,7 @@ export const isGraphKey = (key: BaseKey): boolean => {
return key !== null && typeof key === "string" && key.includes(":v:"); return key !== null && typeof key === "string" && key.includes(":v:");
} }
// Add the mandatory `id` property to the object, based on the `@graph` property.
export const addIdToObject = (obj: any) => { export const addIdToObject = (obj: any) => {
if (!obj["@graph"]) { if (!obj["@graph"]) {
throw new Error("Object is missing @graph property"); throw new Error("Object is missing @graph property");