From 6ac2995b994318c0ad03312b5de52a3293a67dca Mon Sep 17 00:00:00 2001 From: srosset81 Date: Fri, 7 Aug 2026 16:48:24 +0200 Subject: [PATCH] Improve doc --- README.md | 9 +++++++-- examples/antd-app/index.html | 17 ++--------------- src/index.ts | 5 ++--- src/utils.ts | 4 +++- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ede28d4..d37ebaa 100644 --- a/README.md +++ b/README.md @@ -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/). -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 @@ -54,7 +54,11 @@ const shapeTypes : 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 import { authProvider, dataProvider, liveProvider } from "@ng-org/refine-providers"; @@ -107,4 +111,5 @@ export const PostList = () => { ```bash pnpm build pnpm watch +pnpm publish ``` \ No newline at end of file diff --git a/examples/antd-app/index.html b/examples/antd-app/index.html index 60e163f..cd9a256 100644 --- a/examples/antd-app/index.html +++ b/examples/antd-app/index.html @@ -5,11 +5,7 @@ - - + refine authentication example @@ -17,14 +13,5 @@
- + diff --git a/src/index.ts b/src/index.ts index dbc0142..43af2da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 liveProvider } from "./live-provider"; +export { default as authProvider } from "./auth-provider"; +export * from "./auth-provider"; export * from "./types"; export * from "./utils"; diff --git a/src/utils.ts b/src/utils.ts index 0fc9cb8..2927ee6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,8 +1,9 @@ import { BaseKey } from "@refinedev/core"; 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" +// Helper function to retrieve the signal object and eventually close the subscription export const getSignalObject = async (shapeType: ShapeType, ids?: string[], closeSubscription: boolean = true) : Promise> => { const subscription = RdfOrmSubscription.getOrCreate(shapeType, { graphs: ids || [''] }); await subscription.readyPromise; @@ -16,6 +17,7 @@ export const isGraphKey = (key: BaseKey): boolean => { 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) => { if (!obj["@graph"]) { throw new Error("Object is missing @graph property");